blob: 6758d16aab93d96cef19673a414bd75cb197b0c8 [file] [log] [blame]
/*******************************************************************************
* Copyright Statement:
* --------------------
* This software is protected by Copyright and the information contained
* herein is confidential. The software may not be copied and the information
* contained herein may not be used or disclosed except with the written
* permission of MediaTek Inc. (C) 2001
*
*******************************************************************************/
/*******************************************************************************
*
* Filename:
* ---------
* nvram_el1def_md95.c
*
* Project:
* --------
*
*
* Description:
* ------------
*
*
* Author:
* -------
*
*
*******************************************************************************/
/*===============================================================================================*/
#include "el1d_rf_custom_data_et.h"
#include "kal_general_types.h"
#include "kal_public_api.h"
#include "kal_public_defs.h"
#include "nvram_data_items.h"
#include "lte_custom_rf_dpd.h"
//#include "lte_custom_mipi_dpd.h"
#include "el1d_rf_dpd_custom_data_md95.h"
#include "el1d_rf_custom_data_md95.h"
#include "el1_nvram_def.h"
#if defined(__LTE_RAT__)
#include "el1d_rf_custom_data.h"
#include "el1d_rf_drdi.h"
#include "el1d_rf_cid.h"
#include "el1d_rf_custom_data_md95.h"
#include "mml1_dpd_def.h"
//#include "lrfcustomdata_dpd.h"
void nvram_get_eL1_default_value_to_write(nvram_lid_core_enum lid, kal_uint8 *buffer, kal_uint16 buffer_size)
{
switch (lid)
{
/** EL1D RF General Parammeters */
case NVRAM_EF_EL1_MPRADJTBL_LID:
{
#if 0 /* Temporary disabled by jaska 10-Nov-2015
* => LTE_MPRAdjustTbl commented out in lrfcustomdata.c to be fixed by RFSW */
/* under construction !*/
/* under construction !*/
/* under construction !*/
#endif
}
break;
case NVRAM_EF_EL1_AMPRADJTBL_LID:
{
#if 0 /* Temporary disabled by jaska 10-Nov-2015
* => LTE_AMPRAdjustTbl commented out in lrfcustomdata.c to be fixed by RFSW */
/* under construction !*/
/* under construction !*/
/* under construction !*/
#endif
}
break;
/* Single ANT Feature */
case NVRAM_EF_EL1_RF_RX_PATH_CONFIG_LID:
{
if (buffer != (kal_uint8 *)(&LTE_RF_RX_PATH_CONFIG_DEFAULT))
{
kal_mem_cpy(buffer, &LTE_RF_RX_PATH_CONFIG_DEFAULT, NVRAM_EF_EL1_RF_RX_PATH_CONFIG_SIZE);
}
}
break;
/* MIPI Feature */
case NVRAM_EF_EL1_MIPI_FEATURE_LID:
{
if (buffer != (kal_uint8 *)(&LTE_MIPI_ENABLE))
{
kal_mem_cpy(buffer, &LTE_MIPI_ENABLE, NVRAM_EF_EL1_MIPI_FEATURE_SIZE);
}
}
break;
default:
ASSERT(KAL_FALSE);
break;
}
}
void nvram_get_eL1_default_value_to_write_with_record(nvram_lid_core_enum lid, kal_uint16 rec_index, kal_uint8 *buffer, kal_uint16 buffer_size)
{
#if __IS_EL1D_ET_SUPPORT__
kal_uint32 index_select = rec_index-1;
#endif
// /** DRDI */
EL1D_RF_CUSTOM_DynamicInit();
// EL1D_RF_CUSTOM_DynamicInitMipi();
//
// EL1D_RF_UpdateDatabaseTable();
switch (lid)
{
/** EL1D ET RF Feature*/
// CAL DATA
case NVRAM_EF_EL1_LTE_ET_CAL_DATA_LID:
{
#if __IS_EL1D_ET_SUPPORT__
LTE_ET_NVRAM_CANNOT_OTA_T *p_buffer = (LTE_ET_NVRAM_CANNOT_OTA_T*)buffer;
kal_mem_set(&(p_buffer->band), 0, sizeof(kal_uint16));
kal_mem_set(&(p_buffer->total_route), 0, sizeof(kal_uint16));
kal_mem_set(&(p_buffer->comp_route), 0, sizeof(kal_uint16));
kal_mem_set(&(p_buffer->EtCalDoneFlag), 0, sizeof(kal_uint32));
kal_mem_set(&(p_buffer->cal_info), 0, sizeof(LTE_ET_FAC_PARAMETER_NVRAM_INI_T));
kal_mem_set(&(p_buffer->cal_lab), 0, sizeof(LTE_ET_GAINIDX_LABK_NVRAM_INI_T));
kal_mem_set(&(p_buffer->cal_data), 0, sizeof(LTE_ET_FAC_CALDATA_NVRAM_T));
if (LTE_ET_DRIVER_PARA_SetDefault[index_select]!= 0)
{
kal_mem_cpy(&(p_buffer->pa_para), LTE_ET_DRIVER_PARA_SetDefault[index_select], sizeof(LTE_ET_DRIVER_PARAMETER_NVRAM_CUSTOM_T));
}
else
{
//kal_mem_cpy(&(p_buffer->pa_para), &LTE_BandNone_ET_DRIVER_PARA_SetDefault, sizeof(LTE_ET_DRIVER_PARAMETER_NVRAM_CUSTOM_T));
}
#endif
}
break;
case NVRAM_EF_EL1_LTE_ET_CAL_DATA_CCA_LID:
{
#if __IS_EL1D_ET_SUPPORT__
LTE_ET_NVRAM_CANNOT_OTA_T *p_buffer = (LTE_ET_NVRAM_CANNOT_OTA_T*)buffer;
kal_mem_set(&(p_buffer->band), 0, sizeof(kal_uint16));
kal_mem_set(&(p_buffer->total_route), 0, sizeof(kal_uint16));
kal_mem_set(&(p_buffer->comp_route), 0, sizeof(kal_uint16));
kal_mem_set(&(p_buffer->EtCalDoneFlag), 0, sizeof(kal_uint32));
kal_mem_set(&(p_buffer->cal_info), 0, sizeof(LTE_ET_FAC_PARAMETER_NVRAM_INI_T));
kal_mem_set(&(p_buffer->cal_lab), 0, sizeof(LTE_ET_GAINIDX_LABK_NVRAM_INI_T));
kal_mem_set(&(p_buffer->cal_data), 0, sizeof(LTE_ET_FAC_CALDATA_NVRAM_T));
if (LTE_ET_CCA_DRIVER_PARA_SetDefault[index_select]!= 0)
{
kal_mem_cpy(&(p_buffer->pa_para), LTE_ET_CCA_DRIVER_PARA_SetDefault[index_select], sizeof(LTE_ET_DRIVER_PARAMETER_NVRAM_CUSTOM_T));
}
else
{
//kal_mem_cpy(&(p_buffer->pa_para), &LTE_BandNone_CCA_ET_DRIVER_PARA_SetDefault, sizeof(LTE_ET_DRIVER_PARAMETER_NVRAM_CUSTOM_T));
}
#endif
}
break;
//MANUAL PARAMETER
case NVRAM_EF_EL1_LTE_ET_MANUAL_PARAMETER_LID:
{
#if __IS_EL1D_ET_SUPPORT__
LTE_ET_MANUAL_PARAMETER_NVRAM_CUSTOM_T *p_buffer = (LTE_ET_MANUAL_PARAMETER_NVRAM_CUSTOM_T*)buffer;
if (LTE_ET_MANUAL_PARA_SetDefault[index_select]!= 0)
{
kal_mem_cpy(p_buffer, LTE_ET_MANUAL_PARA_SetDefault[index_select], sizeof(LTE_ET_MANUAL_PARAMETER_NVRAM_CUSTOM_T));
}
else
{
//kal_mem_cpy(p_buffer, &LTE_BandNone_ET_MANUAL_PARA_SetDefault, sizeof(LTE_ET_MANUAL_PARAMETER_NVRAM_CUSTOM_T));
}
#endif
}
break;
case NVRAM_EF_EL1_LTE_ET_MANUAL_PARAMETER_CCA_LID:
{
#if __IS_EL1D_ET_SUPPORT__
LTE_ET_MANUAL_PARAMETER_NVRAM_CUSTOM_T *p_buffer = (LTE_ET_MANUAL_PARAMETER_NVRAM_CUSTOM_T*)buffer;
if (LTE_CCA_ET_MANUAL_PARA_SetDefault[index_select]!= 0)
{
kal_mem_cpy(p_buffer, LTE_CCA_ET_MANUAL_PARA_SetDefault[index_select], sizeof(LTE_ET_MANUAL_PARAMETER_NVRAM_CUSTOM_T));
}
else
{
//kal_mem_cpy(p_buffer, &LTE_BandNone_CCA_ET_MANUAL_PARA_SetDefault, sizeof(LTE_ET_MANUAL_PARAMETER_NVRAM_CUSTOM_T));
}
#endif
}
break;
/** EL1D ET MIPI Feature*/
//SUBBAND FREQ
case NVRAM_EF_EL1_LTE_ET_BAND_FREQ_LID:
{
#if __IS_EL1D_ET_SUPPORT__
kal_uint16 *p_buffer = (kal_uint16*)buffer;
if(LTE_ET_BAND_FREQ_TABLE_SetDefault[index_select] != 0)
{
kal_mem_cpy(p_buffer, LTE_ET_BAND_FREQ_TABLE_SetDefault[index_select], (sizeof(kal_uint16)*LTE_ET_SUBBAND_FREQ_NUM));
}
else
{
//kal_mem_cpy(p_buffer, &LTE_BandNone_FREQ_SetDefault, (sizeof(kal_uint16)*LTE_ET_SUBBAND_FREQ_NUM));
}
#endif
}
break;
//TX EVENT
case NVRAM_EF_EL1_LTE_ET_MIPI_TX_EVENT_LID:
{
#if __IS_EL1D_ET_SUPPORT__
LTE_ET_EVENT_TABLE_T *p_buffer = (LTE_ET_EVENT_TABLE_T*)buffer;
if(LTE_ET_TX_EVENT_TABLE_SetDefault[index_select] != 0)
{
kal_mem_cpy(p_buffer, LTE_ET_TX_EVENT_TABLE_SetDefault[index_select], (sizeof(LTE_ET_EVENT_TABLE_T)*LTE_ET_TX_EVENT_NUM));
}
else
{
//kal_mem_cpy(p_buffer, &LTE_BandNone_ET_TX_EVENT_SetDefault, (sizeof(LTE_ET_EVENT_TABLE_T)*LTE_ET_TX_EVENT_NUM));
}
#endif
}
break;
//TX DATA
case NVRAM_EF_EL1_LTE_ET_MIPI_TX_DATA_LID:
{
#if __IS_EL1D_ET_SUPPORT__
LTE_ET_DATA_SUBBAND_TABLE_T *p_buffer = (LTE_ET_DATA_SUBBAND_TABLE_T*)buffer;
if(LTE_ET_TX_DATA_TABLE_SetDefault[index_select] != 0)
{
kal_mem_cpy(p_buffer, LTE_ET_TX_DATA_TABLE_SetDefault[index_select], (sizeof(LTE_ET_DATA_SUBBAND_TABLE_T)*LTE_ET_TX_DATA_NUM));
}
else
{
//kal_mem_cpy(p_buffer, &LTE_BandNone_ET_TX_DATA_SetDefault, (sizeof(LTE_ET_DATA_SUBBAND_TABLE_T)*LTE_ET_TX_DATA_NUM));
}
#endif
}
break;
//TX TPC EVENT
case NVRAM_EF_EL1_LTE_ET_MIPI_TX_TPC_EVENT_LID:
{
#if __IS_EL1D_ET_SUPPORT__
LTE_ET_EVENT_TABLE_T *p_buffer = (LTE_ET_EVENT_TABLE_T*)buffer;
if(LTE_ET_TPC_EVENT_TABLE_SetDefault[index_select] != 0)
{
kal_mem_cpy(p_buffer, LTE_ET_TPC_EVENT_TABLE_SetDefault[index_select], (sizeof(LTE_ET_EVENT_TABLE_T)*LTE_ET_TPC_EVENT_NUM));
}
else
{
//kal_mem_cpy(p_buffer, &LTE_BandNone_ET_TPC_EVENT_SetDefault, (sizeof(LTE_ET_EVENT_TABLE_T)*LTE_ET_TPC_EVENT_NUM));
}
#endif
}
break;
//TX TPC DATA
case NVRAM_EF_EL1_LTE_ET_MIPI_TX_TPC_DATA_LID:
{
#if __IS_EL1D_ET_SUPPORT__
LTE_ET_DATA_TABLE_T *p_buffer = (LTE_ET_DATA_TABLE_T*)buffer;
if(LTE_ET_TPC_DATA_TABLE_SetDefault[index_select] != 0)
{
kal_mem_cpy(p_buffer, LTE_ET_TPC_DATA_TABLE_SetDefault[index_select], (sizeof(LTE_ET_DATA_TABLE_T)*LTE_ET_TPC_DATA_NUM));
}
else
{
//kal_mem_cpy(p_buffer, &LTE_BandNone_ET_TPC_DATA_SetDefault, (sizeof(LTE_ET_DATA_TABLE_T)*LTE_ET_TPC_DATA_NUM));
}
#endif
}
break;
//TX BW SWITCH SECTION DATA
case NVRAM_EF_EL1_LTE_ET_MIPI_TX_BW_SWITCH_SECTION_DATA_LID:
{
#if __IS_EL1D_ET_SUPPORT__
LTE_ET_BW_SWITCH_SECTION_TABLE_DEFAULT_SIZE *p_buffer = (LTE_ET_BW_SWITCH_SECTION_TABLE_DEFAULT_SIZE*)buffer;
if(LTE_ET_BW_SWITCH_SECTION_DATA_TABLE_SetDefault[index_select].set_default_single_carrier != 0)
{
kal_mem_cpy(&(p_buffer->single_carrier), LTE_ET_BW_SWITCH_SECTION_DATA_TABLE_SetDefault[index_select].set_default_single_carrier, sizeof(LTE_ET_BW_SWITCH_SECTION_SIZE));
}
else
{
//kal_mem_cpy(&(p_buffer->single_carrier), &LTE_BandNone_ET_BW_SWITCH_SECTION_DATA_SetDefault, sizeof(LTE_ET_BW_SWITCH_SECTION_SIZE));
}
if(LTE_ET_BW_SWITCH_SECTION_DATA_TABLE_SetDefault[index_select].set_default_cca != 0)
{
kal_mem_cpy(&(p_buffer->cca), LTE_ET_BW_SWITCH_SECTION_DATA_TABLE_SetDefault[index_select].set_default_cca, sizeof(LTE_ET_BW_SWITCH_SECTION_SIZE));
}
else
{
//kal_mem_cpy(&(p_buffer->cca), &LTE_BandNone_ET_BW_SWITCH_CCA_SECTION_DATA_SetDefault, sizeof(LTE_ET_BW_SWITCH_SECTION_SIZE));
}
#endif
}
break;
//TX ET MODE SETTING DATA
case NVRAM_EF_EL1_LTE_ET_MIPI_TX_ET_MODE_SETTING_DATA_LID:
{
#if __IS_EL1D_ET_SUPPORT__
LTE_MIPI_adda_DATA_EXPAND_SIZE *p_buffer = (LTE_MIPI_adda_DATA_EXPAND_SIZE*)buffer;
if(LTE_ETM_MODE_SETTING_DATA_TABLE_SetDefault[index_select] != 0)
{
kal_mem_cpy(p_buffer, LTE_ETM_MODE_SETTING_DATA_TABLE_SetDefault[index_select], sizeof(LTE_MIPI_adda_DATA_EXPAND_SIZE));
}
else
{
//kal_mem_cpy(p_buffer, &LTE_BandNone_ET_MODE_SETTING_DATA_SetDefault, sizeof(LTE_MIPI_adda_DATA_EXPAND_SIZE));
}
#endif
}
break;
//TX PA SECTION DATA
case NVRAM_EF_EL1_LTE_ET_MIPI_TX_ET_PA_SECTION_DATA_LID:
{
#if __IS_EL1D_ET_SUPPORT__
LTE_ET_TPC_PA_SECTION_TABLE_DEFAULT_SIZE *p_buffer = (LTE_ET_TPC_PA_SECTION_TABLE_DEFAULT_SIZE*)buffer;
if(LTE_ET_PA_TPC_SECTION_DATA_TABLE_SetDefault[index_select].set_default_single_carrier != 0)
{
kal_mem_cpy(&(p_buffer->single_carrier), LTE_ET_PA_TPC_SECTION_DATA_TABLE_SetDefault[index_select].set_default_single_carrier, sizeof(LTE_ET_TPC_PA_SECTION_DATA_MD95_T));
}
else
{
//kal_mem_cpy(&(p_buffer->single_carrier), &LTE_BandNone_ET_MIPI_PA_SECTION_DATA_SetDefault, sizeof(LTE_ET_TPC_PA_SECTION_DATA_MD95_T));
}
if(LTE_ET_PA_TPC_SECTION_DATA_TABLE_SetDefault[index_select].set_default_cca != 0)
{
kal_mem_cpy(&(p_buffer->cca), LTE_ET_PA_TPC_SECTION_DATA_TABLE_SetDefault[index_select].set_default_cca, sizeof(LTE_ET_TPC_PA_SECTION_DATA_MD95_T));
}
else
{
//kal_mem_cpy(&(p_buffer->cca), &LTE_BandNone_ET_MIPI_PA_CCA_SECTION_DATA_SetDefault, sizeof(LTE_ET_TPC_PA_SECTION_DATA_MD95_T));
}
#endif
}
break;
/** EL1D DPD Factory Calibration Data */
case NVRAM_EF_EL1_DPD_FACTORY_CAL_DATA_LID:
{
#if MMDPD_DUMMY_CHK(__IS_EL1D_DPD_SUPPORT__)
LTE_DPD_GROUP_CAL_DEFAULT_SIZE *p_buffer = (LTE_DPD_GROUP_CAL_DEFAULT_SIZE*)buffer;
kal_mem_set(&(p_buffer->single_carrier.lte_dpd_ramp_data), 0, sizeof(LTE_sRAMPDATA));
kal_mem_set(&(p_buffer->cca.lte_dpd_ramp_data), 0, sizeof(LTE_sRAMPDATA));
kal_mem_set(&(p_buffer->single_carrier.lte_dpd_pa_oct_lev_tbl), 0, sizeof(LTE_sPAOCTLVLSETTING));
kal_mem_set(&(p_buffer->cca.lte_dpd_pa_oct_lev_tbl), 0, sizeof(LTE_sPAOCTLVLSETTING));
kal_mem_set(&(p_buffer->single_carrier.lte_dpd_common_cal), 0, sizeof(LTE_DPD_COMMON_CAL_T));
kal_mem_set(&(p_buffer->cca.lte_dpd_common_cal), 0, sizeof(LTE_DPD_COMMON_CAL_T));
kal_mem_set(&(p_buffer->single_carrier.lte_dpd_lut_perband), 0, sizeof(LTE_DPD_LUT_PERBAND_T));
kal_mem_set(&(p_buffer->cca.lte_dpd_lut_perband), 0, sizeof(LTE_DPD_LUT_PERBAND_T));
#endif
}
break;
/*** TX DPD RF ***/
//Common Control
case NVRAM_EF_EL1_DPD_COMMON_CTRL_LID:
{
#if MMDPD_DUMMY_CHK(__IS_EL1D_DPD_SUPPORT__)
//LTE_DPD_COMMON_CTRL_DEFAULT_SIZE *p_buffer = (LTE_DPD_COMMON_CTRL_DEFAULT_SIZE*)buffer;
//if (LTE_DPD_FacCommonData_Table_SetDefault[index_select]!= 0)
//{
// kal_mem_cpy(&(p_buffer->single_carrier), LTE_DPD_FacCommonData_Table_SetDefault[index_select], sizeof(LTE_DPD_COMMON_CTRL_T));
//}
//if (LTE_CCA_DPD_FacCommonData_Table_SetDefault[index_select]!= 0)
//{
// kal_mem_cpy(&(p_buffer->cca), LTE_CCA_DPD_FacCommonData_Table_SetDefault[index_select], sizeof(LTE_DPD_COMMON_CTRL_T));
//}
#endif
}
break;
//PCFE custom parameter
case NVRAM_EF_EL1_DPD_PCFE_CUSTOM_PARA_LID:
{
#if MMDPD_DUMMY_CHK(__IS_EL1D_DPD_SUPPORT__)
//LTE_PCFE_CUSTOM_PARA_T *p_buffer = (LTE_PCFE_CUSTOM_PARA_T*)buffer;
//kal_mem_cpy(p_buffer, &LTE_PCFE_DPD_OTFC_CUSTOM_PARA_SetDefault, sizeof(LTE_PCFE_CUSTOM_PARA_T));
#endif
}
break;
//PCFE non-custom parameter
case NVRAM_EF_EL1_DPD_PCFE_NONCUSTOM_PARA_LID:
{
#if MMDPD_DUMMY_CHK(__IS_EL1D_DPD_SUPPORT__)
//LTE_PCFE_NONCUSTOM_PARA_T *p_buffer = (LTE_PCFE_NONCUSTOM_PARA_T*)buffer;
//kal_mem_cpy(p_buffer, &LTE_PCFE_NONCUSTOM_PARA, sizeof(LTE_PCFE_NONCUSTOM_PARA_T));
#endif
}
break;
//normal mode and otfc custom parameter
case NVRAM_EF_EL1_DPD_NORMAL_MODE_AND_OTFC_CUSTOM_PARA_LID:
{
#if MMDPD_DUMMY_CHK(__IS_EL1D_DPD_SUPPORT__)
//LTE_DPD_NORMAL_MODE_AND_OTFC_CUSTOM_PARA_T *p_buffer = (LTE_DPD_NORMAL_MODE_AND_OTFC_CUSTOM_PARA_T*)buffer;
//kal_mem_cpy(p_buffer, &LTE_DPD_NORMAL_MODE_AND_OTFC_CUSTOM_PARA_SetDefault, sizeof(LTE_DPD_NORMAL_MODE_AND_OTFC_CUSTOM_PARA_T));
#endif
}
break;
//normal mode and otfc non-custom parameter
case NVRAM_EF_EL1_DPD_NORMAL_MODE_AND_OTFC_NONCUSTOM_PARA_LID:
{
#if MMDPD_DUMMY_CHK(__IS_EL1D_DPD_SUPPORT__)
//LTE_DPD_NORMAL_MODE_AND_OTFC_NONCUSTOM_PARA_T *p_buffer = (LTE_DPD_NORMAL_MODE_AND_OTFC_NONCUSTOM_PARA_T*)buffer;
//kal_mem_cpy(p_buffer, &LTE_DPD_NORMAL_MODE_AND_OTFC_NONCUSTOM_PARA, sizeof(LTE_DPD_NORMAL_MODE_AND_OTFC_NONCUSTOM_PARA_T));
#endif
}
break;
default:
{
ASSERT(KAL_FALSE);
}
break;
}
}
#endif // end of #if defined(__LTE_RAT__)