Commit cb6c7824 authored by hongzhi wang's avatar hongzhi wang

ue improve sync stability

parent 284c4413
...@@ -658,6 +658,9 @@ int init_nr_ue_signal(PHY_VARS_NR_UE *ue, ...@@ -658,6 +658,9 @@ int init_nr_ue_signal(PHY_VARS_NR_UE *ue,
printf("Initializing UE vars (abstraction %"PRIu8") for eNB TXant %"PRIu8", UE RXant %"PRIu8"\n",abstraction_flag,fp->nb_antennas_tx,fp->nb_antennas_rx); printf("Initializing UE vars (abstraction %"PRIu8") for eNB TXant %"PRIu8", UE RXant %"PRIu8"\n",abstraction_flag,fp->nb_antennas_tx,fp->nb_antennas_rx);
//LOG_D(PHY,"[MSC_NEW][FRAME 00000][PHY_UE][MOD %02u][]\n", ue->Mod_id+NB_eNB_INST); //LOG_D(PHY,"[MSC_NEW][FRAME 00000][PHY_UE][MOD %02u][]\n", ue->Mod_id+NB_eNB_INST);
//phy_init_nr_top(&ue->frame_parms);
//nr_init_frame_parms_ue(&ue->frame_parms);
// many memory allocation sizes are hard coded // many memory allocation sizes are hard coded
AssertFatal( fp->nb_antennas_rx <= 2, "hard coded allocation for ue_common_vars->dl_ch_estimates[eNB_id]" ); AssertFatal( fp->nb_antennas_rx <= 2, "hard coded allocation for ue_common_vars->dl_ch_estimates[eNB_id]" );
AssertFatal( ue->n_connected_eNB <= NUMBER_OF_CONNECTED_eNB_MAX, "n_connected_eNB is too large" ); AssertFatal( ue->n_connected_eNB <= NUMBER_OF_CONNECTED_eNB_MAX, "n_connected_eNB is too large" );
......
...@@ -151,8 +151,7 @@ int nr_init_frame_parms(nfapi_nr_config_request_t* config, ...@@ -151,8 +151,7 @@ int nr_init_frame_parms(nfapi_nr_config_request_t* config,
return 0; return 0;
} }
int nr_init_frame_parms_ue(nfapi_nr_config_request_t* config, int nr_init_frame_parms_ue(NR_DL_FRAME_PARMS *frame_parms)
NR_DL_FRAME_PARMS *frame_parms)
{ {
int N_RB = 106; int N_RB = 106;
......
...@@ -375,7 +375,7 @@ void phy_config_request(PHY_Config_t *phy_config); ...@@ -375,7 +375,7 @@ void phy_config_request(PHY_Config_t *phy_config);
int init_frame_parms(LTE_DL_FRAME_PARMS *frame_parms,uint8_t osf); int init_frame_parms(LTE_DL_FRAME_PARMS *frame_parms,uint8_t osf);
void dump_frame_parms(LTE_DL_FRAME_PARMS *frame_parms); void dump_frame_parms(LTE_DL_FRAME_PARMS *frame_parms);
int nr_init_frame_parms(nfapi_nr_config_request_t* config, NR_DL_FRAME_PARMS *frame_parms); int nr_init_frame_parms(nfapi_nr_config_request_t* config, NR_DL_FRAME_PARMS *frame_parms);
int nr_init_frame_parms_ue(nfapi_nr_config_request_t* config, NR_DL_FRAME_PARMS *frame_parms); int nr_init_frame_parms_ue(NR_DL_FRAME_PARMS *frame_parms);
void nr_dump_frame_parms(NR_DL_FRAME_PARMS *frame_parms); void nr_dump_frame_parms(NR_DL_FRAME_PARMS *frame_parms);
int phy_init_nr_gNB(PHY_VARS_gNB *gNB, unsigned char is_secondary_gNB, unsigned char abstraction_flag); int phy_init_nr_gNB(PHY_VARS_gNB *gNB, unsigned char is_secondary_gNB, unsigned char abstraction_flag);
void nr_phy_config_request(NR_PHY_Config_t *gNB); void nr_phy_config_request(NR_PHY_Config_t *gNB);
......
...@@ -112,21 +112,21 @@ int nr_pbch_channel_estimation(PHY_VARS_NR_UE *ue, ...@@ -112,21 +112,21 @@ int nr_pbch_channel_estimation(PHY_VARS_NR_UE *ue,
multadd_complex_vector_real_scalar(dl_ch-(ue->frame_parms.ofdm_symbol_size<<1), multadd_complex_vector_real_scalar(dl_ch-(ue->frame_parms.ofdm_symbol_size<<1),
ue->ch_est_alpha,dl_ch-(ue->frame_parms.ofdm_symbol_size<<1), ue->ch_est_alpha,dl_ch-(ue->frame_parms.ofdm_symbol_size<<1),
1,ue->frame_parms.ofdm_symbol_size); 1,ue->frame_parms.ofdm_symbol_size);
#ifdef DEBUG_CH //#ifdef DEBUG_CH
printf("ch est pilot addr %p RB_DL %d\n",&pilot[p][0], ue->frame_parms.N_RB_DL); printf("ch est pilot addr %p RB_DL %d\n",&pilot[p][0], ue->frame_parms.N_RB_DL);
printf("k %d, first_carrier %d\n",k,ue->frame_parms.first_carrier_offset); printf("k %d, first_carrier %d\n",k,ue->frame_parms.first_carrier_offset);
printf("rxF addr %p\n", rxF); printf("rxF addr %p\n", rxF);
printf("dl_ch addr %p\n",dl_ch); printf("dl_ch addr %p\n",dl_ch);
#endif //#endif
if ((ue->frame_parms.N_RB_DL&1)==0) { //if ((ue->frame_parms.N_RB_DL&1)==0) {
// Treat first 2 pilots specially (left edge) // Treat first 2 pilots specially (left edge)
ch[0] = (int16_t)(((int32_t)pil[0]*rxF[0] - (int32_t)pil[1]*rxF[1])>>15); ch[0] = (int16_t)(((int32_t)pil[0]*rxF[0] - (int32_t)pil[1]*rxF[1])>>15);
ch[1] = (int16_t)(((int32_t)pil[0]*rxF[1] + (int32_t)pil[1]*rxF[0])>>15); ch[1] = (int16_t)(((int32_t)pil[0]*rxF[1] + (int32_t)pil[1]*rxF[0])>>15);
#ifdef DEBUG_CH //#ifdef DEBUG_CH
printf("ch 0 %d\n",((int32_t)pil[0]*rxF[0] - (int32_t)pil[1]*rxF[1])); printf("ch 0 %d\n",((int32_t)pil[0]*rxF[0] - (int32_t)pil[1]*rxF[1]));
printf("pilot 0 : rxF - > (%d,%d) addr %p ch -> (%d,%d), pil -> (%d,%d) \n",rxF[0],rxF[1],&rxF[0],ch[0],ch[1],pil[0],pil[1]); printf("pilot 0 : rxF - > (%d,%d) addr %p ch -> (%d,%d), pil -> (%d,%d) \n",rxF[0],rxF[1],&rxF[0],ch[0],ch[1],pil[0],pil[1]);
#endif //#endif
multadd_real_vector_complex_scalar(fl, multadd_real_vector_complex_scalar(fl,
ch, ch,
dl_ch, dl_ch,
...@@ -214,7 +214,7 @@ int nr_pbch_channel_estimation(PHY_VARS_NR_UE *ue, ...@@ -214,7 +214,7 @@ int nr_pbch_channel_estimation(PHY_VARS_NR_UE *ue,
} }
} //}
} }
......
...@@ -55,7 +55,7 @@ void set_default_frame_parms_single(nfapi_nr_config_request_t *config, NR_DL_FRA ...@@ -55,7 +55,7 @@ void set_default_frame_parms_single(nfapi_nr_config_request_t *config, NR_DL_FRA
int nr_pbch_detection(PHY_VARS_NR_UE *ue, runmode_t mode) int nr_pbch_detection(PHY_VARS_NR_UE *ue, runmode_t mode)
{ {
printf("nr pbch detec RB_DL %d\n", ue->frame_parms.N_RB_DL);
uint8_t l,pbch_decoded,frame_mod4,pbch_tx_ant,dummy; uint8_t l,pbch_decoded,frame_mod4,pbch_tx_ant,dummy;
NR_DL_FRAME_PARMS *frame_parms=&ue->frame_parms; NR_DL_FRAME_PARMS *frame_parms=&ue->frame_parms;
char phich_resource[6]; char phich_resource[6];
...@@ -175,9 +175,10 @@ int nr_initial_sync(PHY_VARS_NR_UE *ue, runmode_t mode) ...@@ -175,9 +175,10 @@ int nr_initial_sync(PHY_VARS_NR_UE *ue, runmode_t mode)
// LOG_I(PHY,"**************************************************************\n"); // LOG_I(PHY,"**************************************************************\n");
// First try FDD normal prefix // First try FDD normal prefix
frame_parms->Ncp=NORMAL; frame_parms->Ncp=NORMAL;
frame_parms->frame_type=FDD; frame_parms->frame_type=TDD;
set_default_frame_parms_single(config,frame_parms); set_default_frame_parms_single(config,frame_parms);
nr_init_frame_parms_ue(config,frame_parms); nr_init_frame_parms_ue(frame_parms);
printf("nr_initial sync ue RB_DL %d\n", ue->frame_parms.N_RB_DL);
/* /*
write_output("rxdata0.m","rxd0",ue->common_vars.rxdata[0],10*frame_parms->samples_per_tti,1,1); write_output("rxdata0.m","rxd0",ue->common_vars.rxdata[0],10*frame_parms->samples_per_tti,1,1);
exit(-1); exit(-1);
......
...@@ -696,8 +696,8 @@ int nr_rx_pbch( PHY_VARS_NR_UE *ue, ...@@ -696,8 +696,8 @@ int nr_rx_pbch( PHY_VARS_NR_UE *ue,
//#ifdef DEBUG_PBCH //#ifdef DEBUG_PBCH
for (i=0; i<(NR_POLAR_PBCH_PAYLOAD_BITS>>3); i++){ for (i=0; i<(NR_POLAR_PBCH_PAYLOAD_BITS>>3); i++){
printf("unscrambling pbch_a[%d] = %x \n", i,pbch_a[i]); //printf("unscrambling pbch_a[%d] = %x \n", i,pbch_a[i]);
printf("[PBCH] decoder_output[%d] = %x\n",i,decoded_output[i]); printf("[PBCH] decoder payload[%d] = %x\n",i,decoded_output[i]);
} }
//#endif //#endif
ue->dl_indication.rx_ind = &ue->rx_ind; // hang on rx_ind instance ue->dl_indication.rx_ind = &ue->rx_ind; // hang on rx_ind instance
......
...@@ -697,12 +697,13 @@ static void *UE_thread_rxn_txnp4(void *arg) { ...@@ -697,12 +697,13 @@ static void *UE_thread_rxn_txnp4(void *arg) {
if (UE->mode != loop_through_memory) if (UE->mode != loop_through_memory)
phy_procedures_UE_TX(UE,proc,0,0,UE->mode,no_relay); phy_procedures_UE_TX(UE,proc,0,0,UE->mode,no_relay);
#endif #endif
#if 0
if ((subframe_select( &UE->frame_parms, proc->subframe_tx) == SF_S) && if ((subframe_select( &UE->frame_parms, proc->subframe_tx) == SF_S) &&
(UE->frame_parms.frame_type == TDD)) (UE->frame_parms.frame_type == TDD))
if (UE->mode != loop_through_memory) if (UE->mode != loop_through_memory)
//phy_procedures_UE_S_TX(UE,0,0,no_relay); //phy_procedures_UE_S_TX(UE,0,0,no_relay);
updateTimes(current, &t3, 10000, timing_proc_name); updateTimes(current, &t3, 10000, timing_proc_name);
#endif
if (pthread_mutex_lock(&proc->mutex_rxtx) != 0) { if (pthread_mutex_lock(&proc->mutex_rxtx) != 0) {
LOG_E( PHY, "[SCHED][UE] error locking mutex for UE RXTX\n" ); LOG_E( PHY, "[SCHED][UE] error locking mutex for UE RXTX\n" );
......
...@@ -245,7 +245,7 @@ int emulate_rf = 0; ...@@ -245,7 +245,7 @@ int emulate_rf = 0;
threads_t threads= {-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1}; threads_t threads= {-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1};
/* forward declarations */ /* forward declarations */
void set_default_frame_parms(nfapi_nr_config_request_t *config[MAX_NUM_CCs], NR_DL_FRAME_PARMS *frame_parms[MAX_NUM_CCs]); void set_default_frame_parms(NR_DL_FRAME_PARMS *frame_parms[MAX_NUM_CCs]);
/* see file openair2/LAYER2/MAC/main.c for why abstraction_flag is needed /* see file openair2/LAYER2/MAC/main.c for why abstraction_flag is needed
...@@ -628,7 +628,7 @@ int T_port = 2021; /* default port to listen to to wait for the tracer */ ...@@ -628,7 +628,7 @@ int T_port = 2021; /* default port to listen to to wait for the tracer */
int T_dont_fork = 0; /* default is to fork, see 'T_init' to understand */ int T_dont_fork = 0; /* default is to fork, see 'T_init' to understand */
#endif #endif
void set_default_frame_parms(nfapi_nr_config_request_t *config[MAX_NUM_CCs], NR_DL_FRAME_PARMS *frame_parms[MAX_NUM_CCs]) { void set_default_frame_parms(NR_DL_FRAME_PARMS *frame_parms[MAX_NUM_CCs]) {
int CC_id; int CC_id;
...@@ -700,7 +700,6 @@ void set_default_frame_parms_single(nfapi_nr_config_request_t *config, NR_DL_FRA ...@@ -700,7 +700,6 @@ void set_default_frame_parms_single(nfapi_nr_config_request_t *config, NR_DL_FRA
//int CC_id; //int CC_id;
//for (CC_id=0; CC_id<MAX_NUM_CCs; CC_id++) { //for (CC_id=0; CC_id<MAX_NUM_CCs; CC_id++) {
frame_parms = (NR_DL_FRAME_PARMS*) malloc(sizeof(NR_DL_FRAME_PARMS));
/* Set some default values that may be overwritten while reading options */ /* Set some default values that may be overwritten while reading options */
frame_parms = (NR_DL_FRAME_PARMS*) malloc(sizeof(NR_DL_FRAME_PARMS)); frame_parms = (NR_DL_FRAME_PARMS*) malloc(sizeof(NR_DL_FRAME_PARMS));
config = (nfapi_nr_config_request_t*) malloc(sizeof(nfapi_nr_config_request_t)); config = (nfapi_nr_config_request_t*) malloc(sizeof(nfapi_nr_config_request_t));
...@@ -899,7 +898,7 @@ int main( int argc, char **argv ) { ...@@ -899,7 +898,7 @@ int main( int argc, char **argv ) {
set_latency_target(); set_latency_target();
// set default parameters // set default parameters
set_default_frame_parms(config,frame_parms); set_default_frame_parms(frame_parms);
// initialize logging // initialize logging
logInit(); logInit();
...@@ -985,6 +984,7 @@ int main( int argc, char **argv ) { ...@@ -985,6 +984,7 @@ int main( int argc, char **argv ) {
LOG_I(HW, "Version: %s\n", PACKAGE_VERSION); LOG_I(HW, "Version: %s\n", PACKAGE_VERSION);
// set_default_frame_parms(frame_parms);//
// init the parameters // init the parameters
for (CC_id=0; CC_id<MAX_NUM_CCs; CC_id++) { for (CC_id=0; CC_id<MAX_NUM_CCs; CC_id++) {
...@@ -995,10 +995,10 @@ int main( int argc, char **argv ) { ...@@ -995,10 +995,10 @@ int main( int argc, char **argv ) {
LOG_I(PHY,"Set nb_rx_antenna %d , nb_tx_antenna %d \n",frame_parms[CC_id]->nb_antennas_rx, frame_parms[CC_id]->nb_antennas_tx); LOG_I(PHY,"Set nb_rx_antenna %d , nb_tx_antenna %d \n",frame_parms[CC_id]->nb_antennas_rx, frame_parms[CC_id]->nb_antennas_tx);
set_default_frame_parms(config[CC_id],frame_parms[CC_id]); //set_default_frame_parms(config[CC_id],frame_parms[CC_id]);
//init_ul_hopping(frame_parms[CC_id]); //init_ul_hopping(frame_parms[CC_id]);
nr_init_frame_parms_ue(config[CC_id],frame_parms[CC_id]); nr_init_frame_parms_ue(frame_parms[CC_id]);
printf("after init frame_parms %d\n",frame_parms[CC_id]->ofdm_symbol_size); printf("after init frame_parms %d\n",frame_parms[CC_id]->ofdm_symbol_size);
// phy_init_top(frame_parms[CC_id]); // phy_init_top(frame_parms[CC_id]);
phy_init_nr_top(frame_parms[CC_id]); phy_init_nr_top(frame_parms[CC_id]);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment