📄 l1_cust.c_traceversion
字号:
// The first char is NOT part of the filename. It is used for
// categorizing the ffs file contents:
// f=rf-cal, F=rf-config,
// t=tx-cal, T=tx-config,
// r=rx-cal, R=rx-config,
// s=sys-cal, S=sys-config,
"f/gsm/rf/afcdac", &rf.afc.eeprom_afc, sizeof(rf.afc.eeprom_afc),
"F/gsm/rf/stdmap", &rf.radio_band_support, sizeof(rf.radio_band_support),
#if (VCXO_ALGO == 1)
"F/gsm/rf/afcparams", &rf.afc.psi_sta_inv, 4 * sizeof(UWORD32) + 4 * sizeof(WORD16),
#else
"F/gsm/rf/afcparams", &rf.afc.psi_sta_inv, 4 * sizeof(UWORD32),
#endif
"R/gsm/rf/rx/agcglobals", &rf.rx.agc, 5 * sizeof(UWORD16),
"R/gsm/rf/rx/il2agc", &rf.rx.agc.il2agc_pwr[0], 3 * sizeof(rf.rx.agc.il2agc_pwr),
"R/gsm/rf/rx/agcwords", &AGC_TABLE, sizeof(AGC_TABLE),
"s/sys/adccal", &adc_cal, sizeof(adc_cal),
"S/sys/abb", &abb, sizeof(abb),
"S/sys/uartswitch", &ser_cfg_info, sizeof(ser_cfg_info),
#endif
NULL, 0, 0 // terminator
};
/*-------------------------------------------------------*/
/* Parameters: none */
/* Return: none */
/* Functionality: Read the RF configurations for */
/* each band from FFS files. These files */
/* are defined for one band, and and used */
/* for all bands. */
/*-------------------------------------------------------*/
const static T_CONFIG_FILE config_files_band[] =
{
// The first char is NOT part of the filename. It is used for
// categorizing the ffs file contents:
// f=rf-cal, F=rf-config,
// t=tx-cal, T=tx-config,
// r=rx-cal, R=rx-config,
// s=sys-cal, S=sys-config,
// generic for all bands
// band[0] is used as template for all bands.
"t/gsm/rf/tx/ramps", &rf_band[0].tx.ramp_tables, sizeof(rf_band[0].tx.ramp_tables),
"t/gsm/rf/tx/levels", &rf_band[0].tx.levels, sizeof(rf_band[0].tx.levels),
"t/gsm/rf/tx/calchan", &rf_band[0].tx.chan_cal_table, sizeof(rf_band[0].tx.chan_cal_table),
"T/gsm/rf/tx/caltemp", &rf_band[0].tx.temp, sizeof(rf_band[0].tx.temp),
"r/gsm/rf/rx/calchan", &rf_band[0].rx.agc_bands, sizeof(rf_band[0].rx.agc_bands),
"R/gsm/rf/rx/caltemp", &rf_band[0].rx.temp, sizeof(rf_band[0].rx.temp),
"r/gsm/rf/rx/agcparams", &rf_band[0].rx.rx_cal_params, sizeof(rf_band[0].rx.rx_cal_params),
NULL, 0, 0 // terminator
};
void config_ffs_read(char type)
{
config_rf_read(type);
config_rf_rw_band(type, 1);
}
void config_ffs_write(char type)
{
config_rf_write(type);
config_rf_rw_band(type, 0);
}
void config_rf_read(char type)
{
const T_CONFIG_FILE *file = config_files_common;
while (file->name != NULL)
{
if (type == '*' || type == file->name[0]) {
ffs_fread(&file->name[1], file->addr, file->size);
}
file++;
}
}
void config_rf_write(char type)
{
const T_CONFIG_FILE *file = config_files_common;
while (file->name != NULL)
{
if (type == '*' || type == file->name[0]) {
ffs_fwrite(&file->name[1], file->addr, file->size);
}
file++;
}
}
void config_rf_rw_band(char type, UWORD8 read)
{
const T_CONFIG_FILE *f1 = config_files_band;
UWORD8 i;
WORD32 offset;
char name[64];
char *p;
UWORD8 std = l1_config.std.id;
#if FFS_WORKAROUND == 1
struct stat_s stat;
UWORD16 time;
#endif
for (i=0; i< GSM_BANDS; i++)
{
if(std_config[std].band[i] !=0 )
{
f1 = &config_files_band[0];
while (f1->name != NULL)
{
offset = (WORD32) f1->addr - (WORD32) &rf_band[0]; //offset in bytes
p = ((char *) &rf_band[i]) + offset;
if (type == '*' || type == f1->name[0])
{
strcpy(name, &f1->name[1]);
strcat(name, ".");
strcat(name, band_config[std_config[std].band[i]].name);
if (read == 1)
ffs_fread(name, p, f1->size);
else //write == 0
{
ffs_fwrite(name, p, f1->size);
// wait until ffs write has finished
#if FFS_WORKAROUND == 1
stat.inode = 0;
time = 0;
do {
rvf_delay(10); // in milliseconds
time += 10;
ffs_stat(name, &stat);
} while (stat.inode == 0 && time < 500);
#endif
}
}
f1++;
}
}
}
}
/*-------------------------------------------------------*/
/* Cust_init_std() */
/*-------------------------------------------------------*/
/* Parameters : */
/* Return : */
/* Functionality : Init Standard variable configuration */
/*-------------------------------------------------------*/
void Cust_init_std(void)
{
UWORD8 std = l1_config.std.id;
UWORD8 band1, band2;
T_RF_BAND *pt1, *pt2;
band1 = std_config[std].band[0];
band2 = std_config[std].band[1];
//get these from std
pt1 = band_config[band1].addr;
pt2 = band_config[band2].addr;
// copy rf-struct from default flash to ram
memcpy(&rf_band[0], pt1, sizeof(T_RF_BAND));
if(std_config[std].band[1] != BAND_NONE )
memcpy(&rf_band[1], pt2, sizeof(T_RF_BAND));
// Read all RF and system configuration from FFS *before* we copy any of
// the rf structure variables to other places, like L1.
config_ffs_read('*');
l1_config.std.first_radio_freq = std_config[std].first_arfcn;
if(band2!=0)
l1_config.std.first_radio_freq_band2 = band_config[band1].max_carrier + 1;
else
l1_config.std.first_radio_freq_band2 = 0; //band1 carrier + 1 else 0
// if band2 is not used it is initialised with zeros
l1_config.std.nbmax_carrier = band_config[band1].max_carrier;
if(band2!=0)
l1_config.std.nbmax_carrier += band_config[band2].max_carrier;
l1_config.std.max_txpwr_band1 = band_config[band1].max_txpwr;
l1_config.std.max_txpwr_band2 = band_config[band2].max_txpwr;
l1_config.std.txpwr_turning_point = std_config[std].txpwr_tp;
l1_config.std.cal_freq1_band1 = 0;
l1_config.std.cal_freq1_band2 = 0;
l1_config.std.g_magic_band1 = rf_band[MULTI_BAND1].rx.rx_cal_params.g_magic;
l1_config.std.lna_att_band1 = rf_band[MULTI_BAND1].rx.rx_cal_params.lna_att;
l1_config.std.lna_switch_thr_low_band1 = rf_band[MULTI_BAND1].rx.rx_cal_params.lna_switch_thr_low;
l1_config.std.lna_switch_thr_high_band1 = rf_band[MULTI_BAND1].rx.rx_cal_params.lna_switch_thr_high;
l1_config.std.swap_iq_band1 = rf_band[MULTI_BAND1].swap_iq;
l1_config.std.g_magic_band2 = rf_band[MULTI_BAND2].rx.rx_cal_params.g_magic;
l1_config.std.lna_att_band2 = rf_band[MULTI_BAND2].rx.rx_cal_params.lna_att;
l1_config.std.lna_switch_thr_low_band2 = rf_band[MULTI_BAND2].rx.rx_cal_params.lna_switch_thr_low;
l1_config.std.lna_switch_thr_high_band2 = rf_band[MULTI_BAND2].rx.rx_cal_params.lna_switch_thr_high;
l1_config.std.swap_iq_band2 = rf_band[MULTI_BAND2].swap_iq;
l1_config.std.radio_freq_index_offset = l1_config.std.first_radio_freq-1;
// init variable indicating which radio bands are supported by the chosen RF
l1_config.std.radio_band_support = rf.radio_band_support;
}
/*-------------------------------------------------------*/
/* Cust_init_params() */
/*-------------------------------------------------------*/
/* Parameters : */
/* Return : */
/* Functionality : Init RF dependent paramters (AGC, TX) */
/*-------------------------------------------------------*/
void Cust_init_params(void)
{
#if (CODE_VERSION==SIMULATION)
extern UWORD16 simu_RX_SYNTH_SETUP_TIME; // set in xxx.txt l3 scenario file
extern UWORD16 simu_TX_SYNTH_SETUP_TIME; // set in xxx.txt l3 scenario file
l1_config.params.rx_synth_setup_time = simu_RX_SYNTH_SETUP_TIME;
l1_config.params.tx_synth_setup_time = simu_TX_SYNTH_SETUP_TIME;
#else
l1_config.params.rx_synth_setup_time = RX_SYNTH_SETUP_TIME;
l1_config.params.tx_synth_setup_time = TX_SYNTH_SETUP_TIME;
#endif
// Convert SYNTH_SETUP_TIME into SPLIT.
// We have kept a margin of 20qbit (EPSILON_MEAS) to cover offset change and Scenario closing time + margin.
l1_config.params.rx_synth_load_split = 1L + (l1_config.params.rx_synth_setup_time + EPSILON_MEAS) / (BP_DURATION/BP_SPLIT);
l1_config.params.tx_synth_load_split = 1L + (l1_config.params.tx_synth_setup_time + EPSILON_MEAS) / (BP_DURATION/BP_SPLIT);
l1_config.params.rx_synth_start_time = TPU_CLOCK_RANGE + PROVISION_TIME - l1_config.params.rx_synth_setup_time;
l1_config.params.tx_synth_start_time = TPU_CLOCK_RANGE - l1_config.params.tx_synth_setup_time;
l1_config.params.rx_change_synchro_time = l1_config.params.rx_synth_start_time - EPSILON_SYNC;
l1_config.params.rx_change_offset_time = l1_config.params.rx_synth_start_time - EPSILON_OFFS;
l1_config.params.tx_change_offset_time = TIME_OFFSET_TX -
TA_MAX -
l1_config.params.tx_synth_setup_time -
EPSILON_OFFS;
// TX duration = ramp up time + burst duration (data + tail bits)
l1_config.params.tx_nb_duration = UL_ABB_DELAY + rf.tx.guard_bits*4 + NB_BURST_DURATION_UL;
l1_config.params.tx_ra_duration = UL_ABB_DELAY + rf.tx.guard_bits*4 + RA_BURST_DURATION;
l1_config.params.tx_nb_load_split = 1L + (l1_config.params.tx_nb_duration - rf.tx.prg_tx - NB_MARGIN) / (BP_DURATION/BP_SPLIT);
l1_config.params.tx_ra_load_split = 1L + (l1_config.params.tx_ra_duration - rf.tx.prg_tx - NB_MARGIN) / (BP_DURATION/BP_SPLIT);
// time for the end of RX and TX TPU scenarios
l1_config.params.rx_tpu_scenario_ending = RX_TPU_SCENARIO_ENDING;
l1_config.params.tx_tpu_scenario_ending = TX_TPU_SCENARIO_ENDING;
// FB26 anchoring time is computed backward to leave only 6 qbit margin between
// FB26 window and next activity (RX time tracking).
// This margin is used as follow:
// Serving offset restore: 1 qbit (SERV_OFFS_REST_LOAD)
// Tpu Sleep: 2 qbit (TPU_SLEEP_LOAD)
// ---------
// Total: 3 qbit
l1_config.params.fb26_anchoring_time = (l1_config.params.rx_synth_start_time -
#if (CODE_VERSION == SIMULATION)
// simulator: end of scenario not included in window (no serialization)
1 -
#else
// RF dependent end of RX TPU scenario
l1_config.params.rx_tpu_scenario_ending -
#endif
EPSILON_SYNC -
TPU_SLEEP_LOAD -
SERV_OFFS_REST_LOAD -
FB26_ACQUIS_DURATION -
PROVISION_TIME +
TPU_CLOCK_RANGE) % TPU_CLOCK_RANGE;
l1_config.params.fb26_change_offset_time = l1_config.params.fb26_anchoring_time +
PROVISION_TIME -
l1_config.params.rx_synth_setup_time -
EPSILON_OFFS;
l1_config.params.guard_bits = rf.tx.guard_bits;
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -