📄 l1_cust.c_traceversion
字号:
return(pwr_data);
}
#endif
/*-------------------------------------------------------*/
/* Cust_Init_Layer1 */
/*-------------------------------------------------------*/
/* Parameters : */
/* Return : */
/* Functionality : Load and boot the DSP */
/* Initialize shared memory and L1 data structures */
/*-------------------------------------------------------*/
void Cust_Init_Layer1(void)
{
T_MMI_L1_CONFIG cfg;
// Get the current band configuration from the flash
#if (OP_WCP==1)
extern unsigned char ffs_GetBand();
cfg.std = ffs_GetBand();
#else // NO OP_WCP
// cfg.std = std;
cfg.std = STD;
#endif // OP_WCP
cfg.tx_pwr_code = 1;
// sleep management configuration
cfg.pwr_mngt = 0;
cfg.pwr_mngt_mode_authorized = NO_SLEEP; //Sleep mode
cfg.pwr_mngt_clocks = 0x5ff; // list of clocks cut in Big Sleep
#if (CODE_VERSION != SIMULATION)
cfg.dwnld = DWNLD; //external define from makefile
#endif
l1_initialize(&cfg);
get_cal_from_nvmem((UWORD8 *)&rf, sizeof(rf), RF_ID);
get_cal_from_nvmem((UWORD8 *)&adc_cal, sizeof(adc_cal), ADC_ID);
}
/*****************************************************************************************/
/*************************** TESTMODE functions **********************************/
/*****************************************************************************************/
/*------------------------------------------------------*/
/* madc_hex_2_physical */
/*------------------------------------------------------*/
/* Parameters : */
/* Return : */
/* Functionality : Function to convert MAD hexadecimal */
/* values into physical values */
/*------------------------------------------------------*/
void madc_hex_2_physical (UWORD16 *adc_hex, T_ADC *adc_phy)
{
WORD16 i;
UWORD16 y;
WORD16 Smin = 0, Smax = TEMP_TABLE_SIZE-1;
WORD16 index = (TEMP_TABLE_SIZE-1)/2; /* y is the adc code after compensation of ADC slope error introduced by VREF error */
//store raw ADC values
memcpy(&adc.raw[0], adc_hex, sizeof(adc.raw));
// Convert Vbat [mV] : direct equation with slope and offset compensation
for (i = ADC_VBAT; i<ADC_RFTEMP; i++)
adc.converted[i] = (((UWORD32)(adc_cal.a[i] * adc.raw[i])) >>10) + adc_cal.b[i];
/*Convert RF Temperature [Celsius]: binsearch into a table*/
y = ((UWORD32)(adc_cal.a[ADC_RFTEMP] * adc.raw[ADC_RFTEMP]))>>8; /* rf.tempcal is the calibration of VREF*/
while((Smax-Smin) > 1 )
{
if(y < temperature[index].adc)
Smax=index;
else
Smin=index;
index = (Smax+Smin)/2;
}
adc.converted[ADC_RFTEMP] = temperature[index].temp;
for (i = ADC_RFTEMP+1; i<ADC_INDEX_END; i++)
adc.converted[i] = (((UWORD32)(adc_cal.a[i] * adc.raw[i])) >>10) + adc_cal.b[i];
//store converted ADC values
memcpy(adc_phy, &adc.converted[0], sizeof(adc.raw));
}
/*------------------------------------------------------*/
/* get_cal_from_nvmem */
/*------------------------------------------------------*/
/* Parameters : */
/* Return : */
/* Functionality : Copy calibrated parameter to */
/* calibration structure in RAM */
/*------------------------------------------------------*/
void get_cal_from_nvmem (UWORD8 *ptr, UWORD16 len, UWORD8 id)
{
}
/*------------------------------------------------------*/
/* save_cal_from_nvmem */
/*------------------------------------------------------*/
/* Parameters : */
/* Return : */
/* Functionality : Copy calibrated structure from RAM */
/* into NV memory */
/*------------------------------------------------------*/
UWORD8 save_cal_in_nvmem (UWORD8 *ptr, UWORD16 len, UWORD8 id)
{
#if (OP_WCP == 1)
// FFS backup implementation an Avenger 2
// Request MPU-S to backup the FFS
// after full calibration of device
extern void ffs_backup(void);
ffs_backup();
#endif
return (0);
}
#if (TRACE_TYPE == 4)
/*------------------------------------------------------*/
/* l1_cst_l1_parameters */
/*------------------------------------------------------*/
/* Parameters : s: pointer on configuration string */
/* Return : nothing: global var are set */
/* Functionality : Set global L1 vars for dynamic trace */
/* and configuration */
/* */
/* This function is called when a CST message is sent */
/* from the Condat Panel. */
/*------------------------------------------------------*/
void l1_cst_l1_parameters(char *s)
{
/*
a sample command string can be:
L1_PARAMS=<1,2,3,4,5> or
L1_PARAMS=<1,23,3E32,4,5>
with n parameters (here: 5 params); n>=1
parameters are decoded as hexadecimal unsigned integers (UWORD16)
*/
UWORD8 uNParams = 0; /* Number of parameters */
UWORD32 aParam[10]; /* Parameters array */
UWORD8 uIndex = 0;
/* *** retrieve all parameters *** */
while (s[uIndex] != '<') uIndex++;
uIndex++;
aParam[0] = 0;
/* uIndex points on 1st parameter */
while (s[uIndex] != '>')
{
if (s[uIndex] == ',')
{
uNParams++;
aParam[uNParams] = 0;
}
else
{
/* uIndex points on a parameter char */
UWORD8 uChar = s[uIndex];
aParam[uNParams] = aParam[uNParams] << 4; /* shift 4 bits left */
if ((uChar>='0') && (uChar<='9'))
aParam[uNParams] += (uChar - '0'); /* retrieve value */
else if ((uChar>='A') && (uChar<='F'))
aParam[uNParams] += (10 + uChar - 'A'); /* retrieve value */
else if ((uChar>='a') && (uChar<='f'))
aParam[uNParams] += (10 + uChar - 'a'); /* retrieve value */
}
uIndex++; /* go to next char */
}
/* increment number of params */
uNParams++;
/* *** handle parameters *** */
/*
1st param: command type
2nd param: argument for command type
*/
switch (aParam[0])
{
case 0: /* Trace setting */
/* The 2nd parameter contains the trace bitmap*/
if (uNParams >=2)
trace_info.current_config->l1_dyn_trace = aParam[1];
else
trace_info.current_config->l1_dyn_trace = 0; /* error case: disable all trace */
Trace_dyn_trace_change();
break;
default: /* ignore it */
break;
} // switch
}
#endif
#if ((CHIPSET == 2) || (CHIPSET == 3) || (CHIPSET == 4) || \
(CHIPSET == 5) || (CHIPSET == 6) || (CHIPSET == 7) || \
(CHIPSET == 8) || (CHIPSET == 9) || (CHIPSET == 10) || \
(CHIPSET == 11) || (CHIPSET == 12))
/*-------------------------------------------------------*/
/* power_down_config() : temporary implementation !!! */
/*-------------------------------------------------------*/
/* Parameters : sleep_mode (NO, SMALL, BIG, DEEP or ALL) */
/* clocks to be cut in BIG sleep */
/* Return : */
/* Functionality : set the l1s variables */
/* l1s.pw_mgr.mode_authorized and l1s.pw_mgr.clocks */
/* according to the desired mode. */
/*-------------------------------------------------------*/
void power_down_config(UWORD8 sleep_mode, UWORD16 clocks)
{
#if (OP_L1_STANDALONE == 1)
if(sleep_mode != NO_SLEEP)
#endif
{
l1_config.pwr_mngt = PWR_MNGT;
l1s.pw_mgr.mode_authorized = sleep_mode;
l1s.pw_mgr.clocks = clocks;
}
#if (OP_L1_STANDALONE == 0)
l1s.pw_mgr.enough_gaug = FALSE;
#endif
}
#endif
/* glowing,2004-06-16, import from M188 */
void layer1_em_get_rxlevqual(WORD32 *l1_rxlev_scell,WORD32 *l1_rxlev_dedic_sub,
WORD32 *l1_rxqual_dedic,WORD32 *l1_rxqual_dedic_sub)
{
/*
xmzhou_trace_string_value("values***********",(UINT32)(l1a_l1s_com.Scell_info.meas.acc));
xmzhou_trace_string_value("values***********",(UINT32)(l1a_l1s_com.Scell_info.meas.nbr_meas));
xmzhou_trace_string_value("values***********",(UINT32)(l1a_l1s_com.Smeas_dedic.acc_sub));
xmzhou_trace_string_value("values***********",(UINT32)(l1a_l1s_com.Smeas_dedic.nbr_meas_sub));
xmzhou_trace_string_value("values***********",(UINT32)(l1a_l1s_com.Smeas_dedic.qual_acc_full));
xmzhou_trace_string_value("values***********",(UINT32)(l1a_l1s_com.Smeas_dedic.qual_nbr_meas_full));
xmzhou_trace_string_value("values***********",(UINT32)(l1a_l1s_com.Smeas_dedic.qual_acc_sub));
xmzhou_trace_string_value("values***********",(UINT32)(l1a_l1s_com.Smeas_dedic.qual_nbr_meas_sub));
*/
if(l1a_l1s_com.Scell_info.meas.nbr_meas != 0){
*l1_rxlev_scell=(WORD32)(l1a_l1s_com.Scell_info.meas.acc)/(WORD32)(l1a_l1s_com.Scell_info.meas.nbr_meas);
}else{
*l1_rxlev_scell=(WORD32)(l1a_l1s_com.Scell_info.meas.acc)/(WORD32)(4);
}
// xmzhou_trace_string_value("l1_rxlev_scell",(UINT32)(*l1_rxlev_scell));
if(l1a_l1s_com.Smeas_dedic.nbr_meas_sub !=0){
*l1_rxlev_dedic_sub=(WORD32)(l1a_l1s_com.Smeas_dedic.acc_sub)/(WORD32)(l1a_l1s_com.Smeas_dedic.nbr_meas_sub);
}else{
*l1_rxlev_dedic_sub=0;
}
// xmzhou_trace_string_value("l1_rxlev_dedic_sub",(UINT32)(*l1_rxlev_dedic_sub));
if(l1a_l1s_com.Smeas_dedic.qual_nbr_meas_full !=0){
*l1_rxqual_dedic=(WORD32)(l1a_l1s_com.Smeas_dedic.qual_acc_full)/(WORD32)(l1a_l1s_com.Smeas_dedic.qual_nbr_meas_full);
}else{
*l1_rxqual_dedic=0;
}
// xmzhou_trace_string_value("l1_rxqual_dedic",(UINT32)(*l1_rxqual_dedic));
if(l1a_l1s_com.Smeas_dedic.qual_nbr_meas_sub){
*l1_rxqual_dedic_sub=(WORD32)(l1a_l1s_com.Smeas_dedic.qual_acc_sub)/(WORD32)(l1a_l1s_com.Smeas_dedic.qual_nbr_meas_sub);
}else{
*l1_rxqual_dedic_sub=0;
}
// xmzhou_trace_string_value("l1_rxqual_dedic_sub",(UINT32)(*l1_rxqual_dedic_sub));
}
void layer1_em_get_mode(WORD32 *l1_mode)
{
*l1_mode=l1a_l1s_com.mode;
}
/*glowing,2004-06-16, end of import */
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -