From 665d1caa0b1553d1b517355645d043048179a373 Mon Sep 17 00:00:00 2001 From: englab Date: Fri, 11 Feb 2022 17:17:07 -0500 Subject: [PATCH 1/6] First examples of global structure elements move to function stack --- openair1/PHY/INIT/nr_init_ue.c | 8 +++---- openair1/PHY/NR_UE_TRANSPORT/dci_nr.c | 31 ++++++++++++++++++--------- openair1/PHY/defs_nr_UE.h | 4 ++-- 3 files changed, 27 insertions(+), 16 deletions(-) diff --git a/openair1/PHY/INIT/nr_init_ue.c b/openair1/PHY/INIT/nr_init_ue.c index c193733aef..4a1ce1c3eb 100644 --- a/openair1/PHY/INIT/nr_init_ue.c +++ b/openair1/PHY/INIT/nr_init_ue.c @@ -378,10 +378,10 @@ int init_nr_ue_signal(PHY_VARS_NR_UE *ue, ue->pdcch_vars[th_id][gNB_id]->llr16 = (int16_t *)malloc16_clear( 2*4*100*12*sizeof(uint16_t) ); ue->pdcch_vars[th_id][gNB_id]->wbar = (int16_t *)malloc16_clear( 2*4*100*12*sizeof(uint16_t) ); ue->pdcch_vars[th_id][gNB_id]->e_rx = (int16_t *)malloc16_clear( 4*2*100*12 ); - ue->pdcch_vars[th_id][gNB_id]->rxdataF_comp = (int32_t **)malloc16_clear( 4*fp->nb_antennas_rx*sizeof(int32_t *) ); + //ue->pdcch_vars[th_id][gNB_id]->rxdataF_comp = (int32_t **)malloc16_clear( 4*fp->nb_antennas_rx*sizeof(int32_t *) ); ue->pdcch_vars[th_id][gNB_id]->dl_ch_rho_ext = (int32_t **)malloc16_clear( 4*fp->nb_antennas_rx*sizeof(int32_t *) ); ue->pdcch_vars[th_id][gNB_id]->rho = (int32_t **)malloc16( fp->nb_antennas_rx*sizeof(int32_t *) ); - ue->pdcch_vars[th_id][gNB_id]->rxdataF_ext = (int32_t **)malloc16_clear( 4*fp->nb_antennas_rx*sizeof(int32_t *) ); + // ue->pdcch_vars[th_id][gNB_id]->rxdataF_ext = (int32_t **)malloc16_clear( 4*fp->nb_antennas_rx*sizeof(int32_t *) ); ue->pdcch_vars[th_id][gNB_id]->dl_ch_estimates_ext = (int32_t **)malloc16_clear( 4*fp->nb_antennas_rx*sizeof(int32_t *) ); // Channel estimates ue->pdcch_vars[th_id][gNB_id]->dl_ch_estimates = (int32_t **)malloc16_clear(4*fp->nb_antennas_rx*sizeof(int32_t *)); @@ -396,9 +396,9 @@ int init_nr_ue_signal(PHY_VARS_NR_UE *ue, ue->pdcch_vars[th_id][gNB_id]->dl_ch_estimates_time[idx] = (int32_t *)malloc16_clear( sizeof(int32_t)*fp->ofdm_symbol_size*2 ); // size_t num = 7*2*fp->N_RB_DL*12; size_t num = 4*273*12; // 4 symbols, 100 PRBs, 12 REs per PRB - ue->pdcch_vars[th_id][gNB_id]->rxdataF_comp[idx] = (int32_t *)malloc16_clear(sizeof(int32_t) * num); + //ue->pdcch_vars[th_id][gNB_id]->rxdataF_comp[idx] = (int32_t *)malloc16_clear(sizeof(int32_t) * num); ue->pdcch_vars[th_id][gNB_id]->dl_ch_rho_ext[idx] = (int32_t *)malloc16_clear(sizeof(int32_t) * num); - ue->pdcch_vars[th_id][gNB_id]->rxdataF_ext[idx] = (int32_t *)malloc16_clear(sizeof(int32_t) * num); + // ue->pdcch_vars[th_id][gNB_id]->rxdataF_ext[idx] = (int32_t *)malloc16_clear(sizeof(int32_t) * num); ue->pdcch_vars[th_id][gNB_id]->dl_ch_estimates_ext[idx] = (int32_t *)malloc16_clear(sizeof(int32_t) * num); } } diff --git a/openair1/PHY/NR_UE_TRANSPORT/dci_nr.c b/openair1/PHY/NR_UE_TRANSPORT/dci_nr.c index 84c9627c8a..74b229c451 100644 --- a/openair1/PHY/NR_UE_TRANSPORT/dci_nr.c +++ b/openair1/PHY/NR_UE_TRANSPORT/dci_nr.c @@ -206,7 +206,7 @@ void nr_pdcch_demapping_deinterleaving(uint32_t *llr, } } -int32_t nr_pdcch_llr(NR_DL_FRAME_PARMS *frame_parms, int32_t **rxdataF_comp, +int32_t nr_pdcch_llr(NR_DL_FRAME_PARMS *frame_parms, int32_t col, int32_t rxdataF_comp[][col], int16_t *pdcch_llr, uint8_t symbol,uint32_t coreset_nbr_rb) { int16_t *rxF = (int16_t *) &rxdataF_comp[0][(symbol * coreset_nbr_rb * 12)]; int32_t i; @@ -343,7 +343,8 @@ void nr_pdcch_channel_level(int32_t **dl_ch_estimates_ext, // This function will extract the mapped DM-RS PDCCH REs as per 38.211 Section 7.4.1.3.2 (Mapping to physical resources) void nr_pdcch_extract_rbs_single(int32_t **rxdataF, int32_t **dl_ch_estimates, - int32_t **rxdataF_ext, + int32_t col, + int32_t rxdataF_ext[][col], int32_t **dl_ch_estimates_ext, uint8_t symbol, NR_DL_FRAME_PARMS *frame_parms, @@ -537,9 +538,9 @@ void nr_pdcch_extract_rbs_single(int32_t **rxdataF, #define print_shorts(s,x) printf("%s %d,%d,%d,%d,%d,%d,%d,%d\n",s,(x)[0],(x)[1],(x)[2],(x)[3],(x)[4],(x)[5],(x)[6],(x)[7]) -void nr_pdcch_channel_compensation(int32_t **rxdataF_ext, +void nr_pdcch_channel_compensation(int32_t col, int32_t rxdataF_ext[][col], int32_t **dl_ch_estimates_ext, - int32_t **rxdataF_comp, + int32_t rxdataF_comp[][col], int32_t **rho, NR_DL_FRAME_PARMS *frame_parms, uint8_t symbol, @@ -650,7 +651,8 @@ void nr_pdcch_channel_compensation(int32_t **rxdataF_ext, void nr_pdcch_detection_mrc(NR_DL_FRAME_PARMS *frame_parms, - int32_t **rxdataF_comp, + int32_t col, + int32_t rxdataF_comp[][col], uint8_t symbol) { #if defined(__x86_64__) || defined(__i386__) __m128i *rxdataF_comp128_0,*rxdataF_comp128_1; @@ -698,6 +700,13 @@ int32_t nr_rx_pdcch(PHY_VARS_NR_UE *ue, int32_t avgs; int32_t avgP[4]; int n_rb,rb_offset; + + /// \brief Pointers to extracted PDCCH symbols in frequency-domain. + /// - first index: ? [0..7] (hard coded) FIXME! accessed via \c nb_antennas_rx + /// - second index: ? [0..168*N_RB_DL[ + int32_t rxdataF_ext[4*frame_parms->nb_antennas_rx][4*273*12]; // 4 symbols, 100 PRBs, 12 REs per PRB] + int32_t rxdataF_comp[4*frame_parms->nb_antennas_rx][4*273*12]; // 4 symbols, 100 PRBs, 12 REs per PRB] + get_coreset_rballoc(rel15->coreset.frequency_domain_resource,&n_rb,&rb_offset); LOG_D(PHY,"pdcch coreset: freq %x, n_rb %d, rb_offset %d\n", rel15->coreset.frequency_domain_resource[0],n_rb,rb_offset); @@ -706,7 +715,8 @@ int32_t nr_rx_pdcch(PHY_VARS_NR_UE *ue, nr_pdcch_extract_rbs_single(common_vars->common_vars_rx_data_per_thread[proc->thread_id].rxdataF, pdcch_vars->dl_ch_estimates, - pdcch_vars->rxdataF_ext, + 4*273*12, + rxdataF_ext, pdcch_vars->dl_ch_estimates_ext, s, frame_parms, @@ -739,9 +749,9 @@ int32_t nr_rx_pdcch(PHY_VARS_NR_UE *ue, LOG_D(PHY,"we enter nr_pdcch_channel_compensation(log2_maxh=%d)\n",log2_maxh); LOG_D(PHY,"in nr_pdcch_channel_compensation(rxdataF_ext x dl_ch_estimates_ext -> rxdataF_comp)\n"); // compute LLRs for ofdm symbol 0 only - nr_pdcch_channel_compensation(pdcch_vars->rxdataF_ext, + nr_pdcch_channel_compensation(4*273*12, rxdataF_ext, pdcch_vars->dl_ch_estimates_ext, - pdcch_vars->rxdataF_comp, + rxdataF_comp, NULL, frame_parms, s, @@ -749,13 +759,14 @@ int32_t nr_rx_pdcch(PHY_VARS_NR_UE *ue, n_rb); // log2_maxh+I0_shift if (frame_parms->nb_antennas_rx > 1) { LOG_D(PHY,"we enter nr_pdcch_detection_mrc(frame_parms->nb_antennas_rx=%d)\n", frame_parms->nb_antennas_rx); - nr_pdcch_detection_mrc(frame_parms, pdcch_vars->rxdataF_comp,s); + nr_pdcch_detection_mrc(frame_parms, 4*273*12, rxdataF_comp,s); } LOG_D(PHY,"we enter nr_pdcch_llr(for symbol %d), pdcch_vars[eNB_id]->rxdataF_comp ---> pdcch_vars[eNB_id]->llr \n",s); LOG_D(PHY,"in nr_pdcch_llr(rxdataF_comp -> llr)\n"); nr_pdcch_llr(frame_parms, - pdcch_vars->rxdataF_comp, + 4*273*12, + rxdataF_comp, pdcch_vars->llr, s, n_rb); diff --git a/openair1/PHY/defs_nr_UE.h b/openair1/PHY/defs_nr_UE.h index 69978f5548..b411398d34 100644 --- a/openair1/PHY/defs_nr_UE.h +++ b/openair1/PHY/defs_nr_UE.h @@ -583,11 +583,11 @@ typedef struct { /// \brief Pointers to extracted PDCCH symbols in frequency-domain. /// - first index: ? [0..7] (hard coded) FIXME! accessed via \c nb_antennas_rx /// - second index: ? [0..168*N_RB_DL[ - int32_t **rxdataF_ext; + // int32_t **rxdataF_ext; /// \brief Pointers to extracted and compensated PDCCH symbols in frequency-domain. /// - first index: ? [0..7] (hard coded) FIXME! accessed via \c nb_antennas_rx /// - second index: ? [0..168*N_RB_DL[ - int32_t **rxdataF_comp; + // int32_t **rxdataF_comp; /// \brief Hold the channel estimates in frequency domain. /// - first index: ? [0..7] (hard coded) FIXME! accessed via \c nb_antennas_rx /// - second index: samples? [0..symbols_per_tti*(ofdm_symbol_size+LTE_CE_FILTER_LENGTH)[ From c918e76f7423053552fc0a8d3f9e3b4791588413 Mon Sep 17 00:00:00 2001 From: Mario Hudon Date: Thu, 24 Feb 2022 15:28:50 -0500 Subject: [PATCH 2/6] Complete NR_UE_PDCCH global variable/structure cleanup --- executables/nr-ue.c | 5 +- openair1/PHY/INIT/nr_init_ue.c | 32 -------- .../nr_dl_channel_estimation.c | 7 +- openair1/PHY/NR_UE_ESTIMATION/nr_estimation.h | 4 +- openair1/PHY/NR_UE_TRANSPORT/dci_nr.c | 76 +++++++++++-------- .../PHY/NR_UE_TRANSPORT/nr_initial_sync.c | 41 ++++++---- openair1/PHY/NR_UE_TRANSPORT/nr_pbch.c | 5 +- .../NR_UE_TRANSPORT/nr_transport_proto_ue.h | 15 +++- openair1/PHY/defs_nr_UE.h | 60 ++------------- openair1/SCHED_NR_UE/defs.h | 22 ++++-- openair1/SCHED_NR_UE/fapi_nr_ue_l1.c | 19 ++--- openair1/SCHED_NR_UE/phy_procedures_nr_ue.c | 61 +++++++++------ openair1/SIMULATION/NR_PHY/dlsim.c | 6 +- .../SIMULATION/NR_PHY/nr_dummy_functions.c | 3 +- openair1/SIMULATION/NR_PHY/pbchsim.c | 10 ++- openair2/LAYER2/NR_MAC_UE/mac_proto.h | 12 ++- openair2/LAYER2/NR_MAC_UE/nr_ue_procedures.c | 4 +- openair2/LAYER2/NR_MAC_UE/nr_ue_scheduler.c | 19 +++-- openair2/NR_UE_PHY_INTERFACE/NR_IF_Module.c | 7 +- openair2/NR_UE_PHY_INTERFACE/NR_IF_Module.h | 8 ++ 20 files changed, 211 insertions(+), 205 deletions(-) diff --git a/executables/nr-ue.c b/executables/nr-ue.c index 05f9efae3c..d556636e98 100644 --- a/executables/nr-ue.c +++ b/executables/nr-ue.c @@ -697,6 +697,7 @@ void processSlotRX(void *arg) { int rx_slot_type = nr_ue_slot_select(cfg, proc->frame_rx, proc->nr_slot_rx); int tx_slot_type = nr_ue_slot_select(cfg, proc->frame_tx, proc->nr_slot_tx); uint8_t gNB_id = 0; + NR_UE_PDCCH_CONFIG phy_pdcch_config={0}; if (IS_SOFTMODEM_NOS1 || get_softmodem_params()->sa) { /* send tick to RLC and PDCP every ms */ @@ -712,7 +713,7 @@ void processSlotRX(void *arg) { if(UE->if_inst != NULL && UE->if_inst->dl_indication != NULL) { nr_downlink_indication_t dl_indication; - nr_fill_dl_indication(&dl_indication, NULL, NULL, proc, UE, gNB_id); + nr_fill_dl_indication(&dl_indication, NULL, NULL, proc, UE, gNB_id, &phy_pdcch_config); UE->if_inst->dl_indication(&dl_indication, NULL); } @@ -721,7 +722,7 @@ void processSlotRX(void *arg) { phy_procedures_slot_parallelization_nrUE_RX( UE, proc, 0, 0, 1, no_relay, NULL ); #else uint64_t a=rdtsc(); - phy_procedures_nrUE_RX(UE, proc, gNB_id, get_nrUE_params()->nr_dlsch_parallel, &rxtxD->txFifo); + phy_procedures_nrUE_RX(UE, proc, gNB_id, get_nrUE_params()->nr_dlsch_parallel, &phy_pdcch_config, &rxtxD->txFifo); LOG_D(PHY, "In %s: slot %d, time %lu\n", __FUNCTION__, proc->nr_slot_rx, (rdtsc()-a)/3500); #endif diff --git a/openair1/PHY/INIT/nr_init_ue.c b/openair1/PHY/INIT/nr_init_ue.c index 4a1ce1c3eb..7d0b0c59ed 100644 --- a/openair1/PHY/INIT/nr_init_ue.c +++ b/openair1/PHY/INIT/nr_init_ue.c @@ -372,38 +372,6 @@ int init_nr_ue_signal(PHY_VARS_NR_UE *ue, } } - // 100 PRBs * 12 REs/PRB * 4 PDCCH SYMBOLS * 2 LLRs/RE - for (th_id=0; th_idpdcch_vars[th_id][gNB_id]->llr = (int16_t *)malloc16_clear( 2*4*100*12*sizeof(uint16_t) ); - ue->pdcch_vars[th_id][gNB_id]->llr16 = (int16_t *)malloc16_clear( 2*4*100*12*sizeof(uint16_t) ); - ue->pdcch_vars[th_id][gNB_id]->wbar = (int16_t *)malloc16_clear( 2*4*100*12*sizeof(uint16_t) ); - ue->pdcch_vars[th_id][gNB_id]->e_rx = (int16_t *)malloc16_clear( 4*2*100*12 ); - //ue->pdcch_vars[th_id][gNB_id]->rxdataF_comp = (int32_t **)malloc16_clear( 4*fp->nb_antennas_rx*sizeof(int32_t *) ); - ue->pdcch_vars[th_id][gNB_id]->dl_ch_rho_ext = (int32_t **)malloc16_clear( 4*fp->nb_antennas_rx*sizeof(int32_t *) ); - ue->pdcch_vars[th_id][gNB_id]->rho = (int32_t **)malloc16( fp->nb_antennas_rx*sizeof(int32_t *) ); - // ue->pdcch_vars[th_id][gNB_id]->rxdataF_ext = (int32_t **)malloc16_clear( 4*fp->nb_antennas_rx*sizeof(int32_t *) ); - ue->pdcch_vars[th_id][gNB_id]->dl_ch_estimates_ext = (int32_t **)malloc16_clear( 4*fp->nb_antennas_rx*sizeof(int32_t *) ); - // Channel estimates - ue->pdcch_vars[th_id][gNB_id]->dl_ch_estimates = (int32_t **)malloc16_clear(4*fp->nb_antennas_rx*sizeof(int32_t *)); - ue->pdcch_vars[th_id][gNB_id]->dl_ch_estimates_time = (int32_t **)malloc16_clear(4*fp->nb_antennas_rx*sizeof(int32_t *)); - - for (i=0; inb_antennas_rx; i++) { - ue->pdcch_vars[th_id][gNB_id]->rho[i] = (int32_t *)malloc16_clear( sizeof(int32_t)*(100*12*4)); - - for (j=0; j<4; j++) { - int idx = (j*fp->nb_antennas_rx)+i; - ue->pdcch_vars[th_id][gNB_id]->dl_ch_estimates[idx] = (int32_t *)malloc16_clear( sizeof(int32_t)*fp->symbols_per_slot*(fp->ofdm_symbol_size+LTE_CE_FILTER_LENGTH) ); - ue->pdcch_vars[th_id][gNB_id]->dl_ch_estimates_time[idx] = (int32_t *)malloc16_clear( sizeof(int32_t)*fp->ofdm_symbol_size*2 ); - // size_t num = 7*2*fp->N_RB_DL*12; - size_t num = 4*273*12; // 4 symbols, 100 PRBs, 12 REs per PRB - //ue->pdcch_vars[th_id][gNB_id]->rxdataF_comp[idx] = (int32_t *)malloc16_clear(sizeof(int32_t) * num); - ue->pdcch_vars[th_id][gNB_id]->dl_ch_rho_ext[idx] = (int32_t *)malloc16_clear(sizeof(int32_t) * num); - // ue->pdcch_vars[th_id][gNB_id]->rxdataF_ext[idx] = (int32_t *)malloc16_clear(sizeof(int32_t) * num); - ue->pdcch_vars[th_id][gNB_id]->dl_ch_estimates_ext[idx] = (int32_t *)malloc16_clear(sizeof(int32_t) * num); - } - } - } - // PBCH pbch_vars[gNB_id]->rxdataF_ext = (int32_t **)malloc16( fp->nb_antennas_rx*sizeof(int32_t *) ); pbch_vars[gNB_id]->rxdataF_comp = (int32_t **)malloc16_clear( 4*fp->nb_antennas_rx*sizeof(int32_t *) ); diff --git a/openair1/PHY/NR_UE_ESTIMATION/nr_dl_channel_estimation.c b/openair1/PHY/NR_UE_ESTIMATION/nr_dl_channel_estimation.c index 30eae2d30f..3cec2bd171 100644 --- a/openair1/PHY/NR_UE_ESTIMATION/nr_dl_channel_estimation.c +++ b/openair1/PHY/NR_UE_ESTIMATION/nr_dl_channel_estimation.c @@ -467,7 +467,9 @@ int nr_pdcch_channel_estimation(PHY_VARS_NR_UE *ue, unsigned char Ns, unsigned char symbol, unsigned short coreset_start_subcarrier, - unsigned short nb_rb_coreset) + unsigned short nb_rb_coreset, + int32_t pdcch_est_size, + int32_t pdcch_dl_ch_estimates[][pdcch_est_size]) { unsigned char aarx; @@ -476,7 +478,6 @@ int nr_pdcch_channel_estimation(PHY_VARS_NR_UE *ue, int16_t ch[2],*pil,*rxF,*dl_ch,*fl,*fm,*fr; int ch_offset,symbol_offset; - int **dl_ch_estimates =ue->pdcch_vars[proc->thread_id][gNB_id]->dl_ch_estimates; int **rxdataF=ue->common_vars.common_vars_rx_data_per_thread[proc->thread_id].rxdataF; ch_offset = ue->frame_parms.ofdm_symbol_size*symbol; @@ -511,7 +512,7 @@ int nr_pdcch_channel_estimation(PHY_VARS_NR_UE *ue, k = coreset_start_subcarrier; pil = (int16_t *)&pilot[0]; rxF = (int16_t *)&rxdataF[aarx][(symbol_offset+k+1)]; - dl_ch = (int16_t *)&dl_ch_estimates[aarx][ch_offset]; + dl_ch = (int16_t *)&pdcch_dl_ch_estimates[aarx][ch_offset]; memset(dl_ch,0,4*(ue->frame_parms.ofdm_symbol_size)); diff --git a/openair1/PHY/NR_UE_ESTIMATION/nr_estimation.h b/openair1/PHY/NR_UE_ESTIMATION/nr_estimation.h index c5330ce2f2..d2d5f08c2c 100644 --- a/openair1/PHY/NR_UE_ESTIMATION/nr_estimation.h +++ b/openair1/PHY/NR_UE_ESTIMATION/nr_estimation.h @@ -45,7 +45,9 @@ int nr_pdcch_channel_estimation(PHY_VARS_NR_UE *ue, unsigned char Ns, unsigned char symbol, unsigned short coreset_start_subcarrier, - unsigned short nb_rb_coreset); + unsigned short nb_rb_coreset, + int32_t pdcch_est_size, + int32_t pdcch_dl_ch_estimates[][pdcch_est_size]); int nr_pbch_dmrs_correlation(PHY_VARS_NR_UE *ue, UE_nr_rxtx_proc_t *proc, diff --git a/openair1/PHY/NR_UE_TRANSPORT/dci_nr.c b/openair1/PHY/NR_UE_TRANSPORT/dci_nr.c index 74b229c451..4bb474f40d 100644 --- a/openair1/PHY/NR_UE_TRANSPORT/dci_nr.c +++ b/openair1/PHY/NR_UE_TRANSPORT/dci_nr.c @@ -206,7 +206,7 @@ void nr_pdcch_demapping_deinterleaving(uint32_t *llr, } } -int32_t nr_pdcch_llr(NR_DL_FRAME_PARMS *frame_parms, int32_t col, int32_t rxdataF_comp[][col], +int32_t nr_pdcch_llr(NR_DL_FRAME_PARMS *frame_parms, int32_t rx_size, int32_t rxdataF_comp[][rx_size], int16_t *pdcch_llr, uint8_t symbol,uint32_t coreset_nbr_rb) { int16_t *rxF = (int16_t *) &rxdataF_comp[0][(symbol * coreset_nbr_rb * 12)]; int32_t i; @@ -275,7 +275,8 @@ int32_t pdcch_llr(NR_DL_FRAME_PARMS *frame_parms, //__m128i avg128P; //compute average channel_level on each (TX,RX) antenna pair -void nr_pdcch_channel_level(int32_t **dl_ch_estimates_ext, +void nr_pdcch_channel_level(int32_t rx_size, + int32_t dl_ch_estimates_ext[][rx_size], NR_DL_FRAME_PARMS *frame_parms, int32_t *avg, int symbol, @@ -342,10 +343,11 @@ void nr_pdcch_channel_level(int32_t **dl_ch_estimates_ext, // This function will extract the mapped DM-RS PDCCH REs as per 38.211 Section 7.4.1.3.2 (Mapping to physical resources) void nr_pdcch_extract_rbs_single(int32_t **rxdataF, - int32_t **dl_ch_estimates, - int32_t col, - int32_t rxdataF_ext[][col], - int32_t **dl_ch_estimates_ext, + int32_t est_size, + int32_t dl_ch_estimates[][est_size], + int32_t rx_size, + int32_t rxdataF_ext[][rx_size], + int32_t dl_ch_estimates_ext[][rx_size], uint8_t symbol, NR_DL_FRAME_PARMS *frame_parms, uint8_t *coreset_freq_dom, @@ -538,9 +540,9 @@ void nr_pdcch_extract_rbs_single(int32_t **rxdataF, #define print_shorts(s,x) printf("%s %d,%d,%d,%d,%d,%d,%d,%d\n",s,(x)[0],(x)[1],(x)[2],(x)[3],(x)[4],(x)[5],(x)[6],(x)[7]) -void nr_pdcch_channel_compensation(int32_t col, int32_t rxdataF_ext[][col], - int32_t **dl_ch_estimates_ext, - int32_t rxdataF_comp[][col], +void nr_pdcch_channel_compensation(int32_t rx_size, int32_t rxdataF_ext[][rx_size], + int32_t dl_ch_estimates_ext[][rx_size], + int32_t rxdataF_comp[][rx_size], int32_t **rho, NR_DL_FRAME_PARMS *frame_parms, uint8_t symbol, @@ -651,8 +653,8 @@ void nr_pdcch_channel_compensation(int32_t col, int32_t rxdataF_ext[][col], void nr_pdcch_detection_mrc(NR_DL_FRAME_PARMS *frame_parms, - int32_t col, - int32_t rxdataF_comp[][col], + int32_t rx_size, + int32_t rxdataF_comp[][rx_size], uint8_t symbol) { #if defined(__x86_64__) || defined(__i386__) __m128i *rxdataF_comp128_0,*rxdataF_comp128_1; @@ -688,24 +690,30 @@ void nr_pdcch_detection_mrc(NR_DL_FRAME_PARMS *frame_parms, int32_t nr_rx_pdcch(PHY_VARS_NR_UE *ue, UE_nr_rxtx_proc_t *proc, + int32_t pdcch_est_size, + int32_t pdcch_dl_ch_estimates[][pdcch_est_size], + int16_t *pdcch_e_rx, fapi_nr_dl_config_dci_dl_pdu_rel15_t *rel15) { uint32_t frame = proc->frame_rx; uint32_t slot = proc->nr_slot_rx; NR_UE_COMMON *common_vars = &ue->common_vars; NR_DL_FRAME_PARMS *frame_parms = &ue->frame_parms; - NR_UE_PDCCH *pdcch_vars = ue->pdcch_vars[proc->thread_id][0]; uint8_t log2_maxh, aarx; int32_t avgs; int32_t avgP[4]; int n_rb,rb_offset; - /// \brief Pointers to extracted PDCCH symbols in frequency-domain. - /// - first index: ? [0..7] (hard coded) FIXME! accessed via \c nb_antennas_rx - /// - second index: ? [0..168*N_RB_DL[ - int32_t rxdataF_ext[4*frame_parms->nb_antennas_rx][4*273*12]; // 4 symbols, 100 PRBs, 12 REs per PRB] - int32_t rxdataF_comp[4*frame_parms->nb_antennas_rx][4*273*12]; // 4 symbols, 100 PRBs, 12 REs per PRB] + // Pointers to extracted PDCCH symbols in frequency-domain. + int32_t rx_size = 4*273*12; + int32_t rxdataF_ext[4*frame_parms->nb_antennas_rx][rx_size]; + int32_t rxdataF_comp[4*frame_parms->nb_antennas_rx][rx_size]; + int32_t pdcch_dl_ch_estimates_ext[4*frame_parms->nb_antennas_rx][rx_size]; + + // Pointer to llrs, 4-bit resolution. + int32_t llr_size = 2*4*100*12; + int16_t llr[llr_size]; get_coreset_rballoc(rel15->coreset.frequency_domain_resource,&n_rb,&rb_offset); LOG_D(PHY,"pdcch coreset: freq %x, n_rb %d, rb_offset %d\n", @@ -714,10 +722,11 @@ int32_t nr_rx_pdcch(PHY_VARS_NR_UE *ue, LOG_D(PHY,"in nr_pdcch_extract_rbs_single(rxdataF -> rxdataF_ext || dl_ch_estimates -> dl_ch_estimates_ext)\n"); nr_pdcch_extract_rbs_single(common_vars->common_vars_rx_data_per_thread[proc->thread_id].rxdataF, - pdcch_vars->dl_ch_estimates, - 4*273*12, + pdcch_est_size, + pdcch_dl_ch_estimates, + rx_size, rxdataF_ext, - pdcch_vars->dl_ch_estimates_ext, + pdcch_dl_ch_estimates_ext, s, frame_parms, rel15->coreset.frequency_domain_resource, @@ -727,7 +736,8 @@ int32_t nr_rx_pdcch(PHY_VARS_NR_UE *ue, LOG_D(PHY,"we enter nr_pdcch_channel_level(avgP=%d) => compute channel level based on ofdm symbol 0, pdcch_vars[eNB_id]->dl_ch_estimates_ext\n",*avgP); LOG_D(PHY,"in nr_pdcch_channel_level(dl_ch_estimates_ext -> dl_ch_estimates_ext)\n"); // compute channel level based on ofdm symbol 0 - nr_pdcch_channel_level(pdcch_vars->dl_ch_estimates_ext, + nr_pdcch_channel_level(rx_size, + pdcch_dl_ch_estimates_ext, frame_parms, avgP, s, @@ -749,8 +759,8 @@ int32_t nr_rx_pdcch(PHY_VARS_NR_UE *ue, LOG_D(PHY,"we enter nr_pdcch_channel_compensation(log2_maxh=%d)\n",log2_maxh); LOG_D(PHY,"in nr_pdcch_channel_compensation(rxdataF_ext x dl_ch_estimates_ext -> rxdataF_comp)\n"); // compute LLRs for ofdm symbol 0 only - nr_pdcch_channel_compensation(4*273*12, rxdataF_ext, - pdcch_vars->dl_ch_estimates_ext, + nr_pdcch_channel_compensation(rx_size, rxdataF_ext, + pdcch_dl_ch_estimates_ext, rxdataF_comp, NULL, frame_parms, @@ -759,15 +769,15 @@ int32_t nr_rx_pdcch(PHY_VARS_NR_UE *ue, n_rb); // log2_maxh+I0_shift if (frame_parms->nb_antennas_rx > 1) { LOG_D(PHY,"we enter nr_pdcch_detection_mrc(frame_parms->nb_antennas_rx=%d)\n", frame_parms->nb_antennas_rx); - nr_pdcch_detection_mrc(frame_parms, 4*273*12, rxdataF_comp,s); + nr_pdcch_detection_mrc(frame_parms, rx_size, rxdataF_comp,s); } LOG_D(PHY,"we enter nr_pdcch_llr(for symbol %d), pdcch_vars[eNB_id]->rxdataF_comp ---> pdcch_vars[eNB_id]->llr \n",s); LOG_D(PHY,"in nr_pdcch_llr(rxdataF_comp -> llr)\n"); nr_pdcch_llr(frame_parms, - 4*273*12, + rx_size, rxdataF_comp, - pdcch_vars->llr, + llr, s, n_rb); #if T_TRACER @@ -783,8 +793,8 @@ int32_t nr_rx_pdcch(PHY_VARS_NR_UE *ue, } LOG_D(PHY,"we enter nr_pdcch_demapping_deinterleaving(), number of candidates %d\n",rel15->number_of_candidates); - nr_pdcch_demapping_deinterleaving((uint32_t *) pdcch_vars->llr, - (uint32_t *) pdcch_vars->e_rx, + nr_pdcch_demapping_deinterleaving((uint32_t *) llr, + (uint32_t *) pdcch_e_rx, rel15->coreset.duration, rel15->coreset.StartSymbolIndex, n_rb, @@ -869,10 +879,10 @@ uint16_t nr_dci_false_detection(uint64_t *dci, uint8_t nr_dci_decoding_procedure(PHY_VARS_NR_UE *ue, UE_nr_rxtx_proc_t *proc, + int16_t *pdcch_e_rx, fapi_nr_dci_indication_t *dci_ind, - fapi_nr_dl_config_dci_dl_pdu_rel15_t *rel15) { - - NR_UE_PDCCH *pdcch_vars = ue->pdcch_vars[proc->thread_id][0]; + fapi_nr_dl_config_dci_dl_pdu_rel15_t *rel15, + NR_UE_PDCCH_CONFIG *phy_pdcch_config) { //int gNB_id = 0; int16_t tmp_e[16*108]; @@ -902,7 +912,7 @@ uint8_t nr_dci_decoding_procedure(PHY_VARS_NR_UE *ue, LOG_D(PHY, "Trying DCI candidate %d of %d number of candidates, CCE %d (%d), L %d, length %d, format %s\n", j, rel15->number_of_candidates, CCEind, CCEind*9*6*2, L, dci_length,nr_dci_format_string[rel15->dci_format_options[k]]); - nr_pdcch_unscrambling(&pdcch_vars->e_rx[CCEind*108], rel15->coreset.scrambling_rnti, L*108, rel15->coreset.pdcch_dmrs_scrambling_id, tmp_e); + nr_pdcch_unscrambling(&pdcch_e_rx[CCEind*108], rel15->coreset.scrambling_rnti, L*108, rel15->coreset.pdcch_dmrs_scrambling_id, tmp_e); #ifdef DEBUG_DCI_DECODING uint32_t * z = (uint32_t *) &pdcch_vars->e_rx[CCEind*108]; @@ -947,7 +957,7 @@ uint8_t nr_dci_decoding_procedure(PHY_VARS_NR_UE *ue, } } } - pdcch_vars->nb_search_space = 0; + phy_pdcch_config->nb_search_space = 0; return(dci_ind->number_of_dcis); } diff --git a/openair1/PHY/NR_UE_TRANSPORT/nr_initial_sync.c b/openair1/PHY/NR_UE_TRANSPORT/nr_initial_sync.c index 2963ad5010..0ea277c2a9 100644 --- a/openair1/PHY/NR_UE_TRANSPORT/nr_initial_sync.c +++ b/openair1/PHY/NR_UE_TRANSPORT/nr_initial_sync.c @@ -104,7 +104,7 @@ void free_list(NR_UE_SSB *node) { } -int nr_pbch_detection(UE_nr_rxtx_proc_t * proc, PHY_VARS_NR_UE *ue, int pbch_initial_symbol) +int nr_pbch_detection(UE_nr_rxtx_proc_t * proc, PHY_VARS_NR_UE *ue, int pbch_initial_symbol, NR_UE_PDCCH_CONFIG *phy_pdcch_config) { NR_DL_FRAME_PARMS *frame_parms=&ue->frame_parms; int ret =-1; @@ -159,7 +159,8 @@ int nr_pbch_detection(UE_nr_rxtx_proc_t * proc, PHY_VARS_NR_UE *ue, int pbch_ini frame_parms, 0, temp_ptr->i_ssb, - SISO); + SISO, + phy_pdcch_config); temp_ptr=temp_ptr->next_ssb; } @@ -209,6 +210,8 @@ int nr_initial_sync(UE_nr_rxtx_proc_t *proc, NR_DL_FRAME_PARMS *fp = &ue->frame_parms; int ret=-1; int rx_power=0; //aarx, + + NR_UE_PDCCH_CONFIG phy_pdcch_config={0}; VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_NR_INITIAL_UE_SYNC, VCD_FUNCTION_IN); @@ -293,7 +296,7 @@ int nr_initial_sync(UE_nr_rxtx_proc_t *proc, rx_sss_nr(ue, proc, &metric_tdd_ncp, &phase_tdd_ncp); nr_gold_pbch(ue); - ret = nr_pbch_detection(proc, ue, 1); // start pbch detection at first symbol after pss + ret = nr_pbch_detection(proc, ue, 1, &phy_pdcch_config); // start pbch detection at first symbol after pss if (ret == 0) { // sync at symbol ue->symbol_offset @@ -472,33 +475,39 @@ int nr_initial_sync(UE_nr_rxtx_proc_t *proc, // if stand alone and sync on ssb do sib1 detection as part of initial sync if (sa==1 && ret==0) { bool dec = false; - NR_UE_PDCCH *pdcch_vars = ue->pdcch_vars[proc->thread_id][0]; int gnb_id = 0; //FIXME int coreset_nb_rb=0; int coreset_start_rb=0; - for(int n_ss = 0; n_ssnb_search_space; n_ss++) { - uint8_t nb_symb_pdcch = pdcch_vars->pdcch_config[n_ss].coreset.duration; - int start_symb = pdcch_vars->pdcch_config[n_ss].coreset.StartSymbolIndex; - get_coreset_rballoc(pdcch_vars->pdcch_config[n_ss].coreset.frequency_domain_resource,&coreset_nb_rb,&coreset_start_rb); + // Hold the channel estimates in frequency domain. + int32_t pdcch_est_size = fp->symbols_per_slot*(fp->ofdm_symbol_size+LTE_CE_FILTER_LENGTH); + int32_t pdcch_dl_ch_estimates[4*fp->nb_antennas_rx][pdcch_est_size]; + + + for(int n_ss = 0; n_ssslot, - is*fp->samples_per_frame+pdcch_vars->sfn*fp->samples_per_frame+ue->rx_offset); + phy_pdcch_config.slot, + is*fp->samples_per_frame+phy_pdcch_config.sfn*fp->samples_per_frame+ue->rx_offset); if (coreset_nb_rb > 0) nr_pdcch_channel_estimation(ue, proc, 0, - pdcch_vars->slot, + phy_pdcch_config.slot, l, - fp->first_carrier_offset+(pdcch_vars->pdcch_config[n_ss].BWPStart + coreset_start_rb)*12, - coreset_nb_rb); + fp->first_carrier_offset+(phy_pdcch_config.pdcch_config[n_ss].BWPStart + coreset_start_rb)*12, + coreset_nb_rb, + pdcch_est_size, + pdcch_dl_ch_estimates); } - int dci_cnt = nr_ue_pdcch_procedures(gnb_id, ue, proc, n_ss); + int dci_cnt = nr_ue_pdcch_procedures(gnb_id, ue, proc, pdcch_est_size, pdcch_dl_ch_estimates, &phy_pdcch_config, n_ss); if (dci_cnt>0){ NR_UE_DLSCH_t *dlsch = ue->dlsch_SI[gnb_id]; if (dlsch && (dlsch->active == 1)) { @@ -511,8 +520,8 @@ int nr_initial_sync(UE_nr_rxtx_proc_t *proc, nr_slot_fep_init_sync(ue, proc, m, - pdcch_vars->slot, // same slot and offset as pdcch - is*fp->samples_per_frame+pdcch_vars->sfn*fp->samples_per_frame+ue->rx_offset); + phy_pdcch_config.slot, // same slot and offset as pdcch + is*fp->samples_per_frame+phy_pdcch_config.sfn*fp->samples_per_frame+ue->rx_offset); } int ret = nr_ue_pdsch_procedures(ue, diff --git a/openair1/PHY/NR_UE_TRANSPORT/nr_pbch.c b/openair1/PHY/NR_UE_TRANSPORT/nr_pbch.c index dff347f7c0..ef791034ad 100644 --- a/openair1/PHY/NR_UE_TRANSPORT/nr_pbch.c +++ b/openair1/PHY/NR_UE_TRANSPORT/nr_pbch.c @@ -414,7 +414,8 @@ int nr_rx_pbch( PHY_VARS_NR_UE *ue, NR_DL_FRAME_PARMS *frame_parms, uint8_t gNB_id, uint8_t i_ssb, - MIMO_mode_t mimo_mode) { + MIMO_mode_t mimo_mode, + NR_UE_PDCCH_CONFIG *phy_pdcch_config) { NR_UE_COMMON *nr_ue_common_vars = &ue->common_vars; int max_h=0; @@ -604,7 +605,7 @@ int nr_rx_pbch( PHY_VARS_NR_UE *ue, fapi_nr_rx_indication_t *rx_ind = calloc(1, sizeof(*rx_ind)); uint16_t number_pdus = 1; - nr_fill_dl_indication(&dl_indication, NULL, rx_ind, proc, ue, gNB_id); + nr_fill_dl_indication(&dl_indication, NULL, rx_ind, proc, ue, gNB_id, phy_pdcch_config); nr_fill_rx_indication(rx_ind, FAPI_NR_RX_PDU_TYPE_SSB, gNB_id, ue, NULL, NULL, number_pdus, proc); if (ue->if_inst && ue->if_inst->dl_indication) diff --git a/openair1/PHY/NR_UE_TRANSPORT/nr_transport_proto_ue.h b/openair1/PHY/NR_UE_TRANSPORT/nr_transport_proto_ue.h index 3cb002f9e1..6b160b5b34 100644 --- a/openair1/PHY/NR_UE_TRANSPORT/nr_transport_proto_ue.h +++ b/openair1/PHY/NR_UE_TRANSPORT/nr_transport_proto_ue.h @@ -1105,6 +1105,9 @@ uint32_t dlsch_decoding_emul(PHY_VARS_NR_UE *phy_vars_ue, int32_t nr_rx_pdcch(PHY_VARS_NR_UE *ue, UE_nr_rxtx_proc_t *proc, + int32_t pdcch_est_size, + int32_t pdcch_dl_ch_estimates[][pdcch_est_size], + int16_t *pdcch_e_rx, fapi_nr_dl_config_dci_dl_pdu_rel15_t *rel15); @@ -1156,11 +1159,13 @@ int nr_rx_pbch( PHY_VARS_NR_UE *ue, NR_DL_FRAME_PARMS *frame_parms, uint8_t eNB_id, uint8_t i_ssb, - MIMO_mode_t mimo_mode); + MIMO_mode_t mimo_mode, + NR_UE_PDCCH_CONFIG *phy_pdcch_config); int nr_pbch_detection(UE_nr_rxtx_proc_t *proc, - PHY_VARS_NR_UE *ue, - int pbch_initial_symbol); + PHY_VARS_NR_UE *ue, + int pbch_initial_symbol, + NR_UE_PDCCH_CONFIG *phy_pdcch_config); uint16_t rx_pbch_emul(PHY_VARS_NR_UE *phy_vars_ue, uint8_t eNB_id, @@ -1667,8 +1672,10 @@ uint8_t get_prach_prb_offset(NR_DL_FRAME_PARMS *frame_parms, uint8_t nr_dci_decoding_procedure(PHY_VARS_NR_UE *ue, UE_nr_rxtx_proc_t *proc, + int16_t *pdcch_e_rx, fapi_nr_dci_indication_t *dci_ind, - fapi_nr_dl_config_dci_dl_pdu_rel15_t *rel15); + fapi_nr_dl_config_dci_dl_pdu_rel15_t *rel15, + NR_UE_PDCCH_CONFIG *phy_pdcch_config); /** \brief This function is the top-level entry point to PDSCH demodulation, after frequency-domain transformation and channel estimation. It performs diff --git a/openair1/PHY/defs_nr_UE.h b/openair1/PHY/defs_nr_UE.h index b411398d34..1064f23d01 100644 --- a/openair1/PHY/defs_nr_UE.h +++ b/openair1/PHY/defs_nr_UE.h @@ -580,64 +580,20 @@ typedef struct { } NR_UE_PDCCH_SEARCHSPACE; #endif typedef struct { - /// \brief Pointers to extracted PDCCH symbols in frequency-domain. - /// - first index: ? [0..7] (hard coded) FIXME! accessed via \c nb_antennas_rx - /// - second index: ? [0..168*N_RB_DL[ - // int32_t **rxdataF_ext; - /// \brief Pointers to extracted and compensated PDCCH symbols in frequency-domain. - /// - first index: ? [0..7] (hard coded) FIXME! accessed via \c nb_antennas_rx - /// - second index: ? [0..168*N_RB_DL[ - // int32_t **rxdataF_comp; - /// \brief Hold the channel estimates in frequency domain. - /// - first index: ? [0..7] (hard coded) FIXME! accessed via \c nb_antennas_rx - /// - second index: samples? [0..symbols_per_tti*(ofdm_symbol_size+LTE_CE_FILTER_LENGTH)[ - int32_t **dl_ch_estimates; - /// \brief Hold the channel estimates in time domain (used for tracking). - /// - first index: ? [0..7] (hard coded) FIXME! accessed via \c nb_antennas_rx - /// - second index: samples? [0..2*ofdm_symbol_size[ - int32_t **dl_ch_estimates_time; - /// \brief Pointers to extracted channel estimates of PDCCH symbols. - /// - first index: ? [0..7] (hard coded) FIXME! accessed via \c nb_antennas_rx - /// - second index: ? [0..168*N_RB_DL[ - int32_t **dl_ch_estimates_ext; - /// \brief Pointers to channel cross-correlation vectors for multi-gNB detection. - /// - first index: ? [0..7] (hard coded) FIXME! accessed via \c nb_antennas_rx - /// - second index: ? [0..168*N_RB_DL[ - int32_t **dl_ch_rho_ext; - /// \brief Pointers to channel cross-correlation vectors for multi-gNB detection. - /// - first index: rx antenna [0..nb_antennas_rx[ - /// - second index: ? [0..] - int32_t **rho; - /// \brief Pointer to llrs, 4-bit resolution. - /// - first index: ? [0..48*N_RB_DL[ - int16_t *llr; - /// \brief Pointer to llrs, 16-bit resolution. - /// - first index: ? [0..96*N_RB_DL[ - int16_t *llr16; - /// \brief \f$\overline{w}\f$ from 36-211. - /// - first index: ? [0..48*N_RB_DL[ - int16_t *wbar; - /// \brief PDCCH/DCI e-sequence (input to rate matching). - /// - first index: ? [0..96*N_RB_DL[ - int16_t *e_rx; - /// Total number of PDU errors (diagnostic mode) - uint32_t dci_errors; + int nb_search_space; + uint16_t sfn; + uint16_t slot; + fapi_nr_dl_config_dci_dl_pdu_rel15_t pdcch_config[FAPI_NR_MAX_SS]; +} NR_UE_PDCCH_CONFIG; + +typedef struct { /// Total number of PDU received uint32_t dci_received; /// Total number of DCI False detection (diagnostic mode) uint32_t dci_false; /// Total number of DCI missed (diagnostic mode) uint32_t dci_missed; - /// nCCE for PDCCH per subframe - uint8_t nCCE[10]; - //Check for specific DCIFormat and AgregationLevel - uint8_t dciFormat; - uint8_t agregationLevel; - int nb_search_space; - fapi_nr_dl_config_dci_dl_pdu_rel15_t pdcch_config[FAPI_NR_MAX_SS]; - // frame and slot for sib1 in initial sync - uint16_t sfn; - uint16_t slot; + /* #ifdef NR_PDCCH_DEFS_NR_UE int nb_searchSpaces; diff --git a/openair1/SCHED_NR_UE/defs.h b/openair1/SCHED_NR_UE/defs.h index b3527365a5..48b5e446d3 100644 --- a/openair1/SCHED_NR_UE/defs.h +++ b/openair1/SCHED_NR_UE/defs.h @@ -111,16 +111,18 @@ int phy_procedures_RN_UE_RX(unsigned char last_slot, unsigned char next_slot, re void phy_procedures_nrUE_TX(PHY_VARS_NR_UE *ue, UE_nr_rxtx_proc_t *proc, uint8_t eNB_id); /*! \brief Scheduling for UE RX procedures in normal subframes. - @param ue Pointer to UE variables on which to act - @param proc Pointer to proc information - @param gNB_id Local id of eNB on which to act - @param dlsch_parallel use multithreaded dlsch processing - @param txFifo Result fifo if PDSCH is run in parallel + @param ue Pointer to UE variables on which to act + @param proc Pointer to proc information + @param gNB_id Local id of eNB on which to act + @param dlsch_parallel use multithreaded dlsch processing + @param phy_pdcch_config PDCCH Config for this slot + @param txFifo Result fifo if PDSCH is run in parallel */ int phy_procedures_nrUE_RX(PHY_VARS_NR_UE *ue, UE_nr_rxtx_proc_t *proc, uint8_t gNB_id, uint8_t dlsch_parallel, + NR_UE_PDCCH_CONFIG *phy_pdcch_config, notifiedFIFO_t *txFifo); int phy_procedures_slot_parallelization_nrUE_RX(PHY_VARS_NR_UE *ue, UE_nr_rxtx_proc_t *proc, uint8_t eNB_id, uint8_t abstraction_flag, uint8_t do_pdcch_flag, relaying_type_t r_type); @@ -400,7 +402,8 @@ void nr_fill_dl_indication(nr_downlink_indication_t *dl_ind, fapi_nr_rx_indication_t *rx_ind, UE_nr_rxtx_proc_t *proc, PHY_VARS_NR_UE *ue, - uint8_t gNB_id); + uint8_t gNB_id, + void *phy_data); /*@}*/ @@ -434,8 +437,11 @@ int nr_ue_pdsch_procedures(PHY_VARS_NR_UE *ue, NR_UE_DLSCH_t *dlsch0, NR_UE_DLSCH_t *dlsch1); int nr_ue_pdcch_procedures(uint8_t gNB_id, - PHY_VARS_NR_UE *ue, - UE_nr_rxtx_proc_t *proc, + PHY_VARS_NR_UE *ue, + UE_nr_rxtx_proc_t *proc, + int32_t pdcch_est_size, + int32_t pdcch_dl_ch_estimates[][pdcch_est_size], + NR_UE_PDCCH_CONFIG *phy_pdcch_config, int n_ss); diff --git a/openair1/SCHED_NR_UE/fapi_nr_ue_l1.c b/openair1/SCHED_NR_UE/fapi_nr_ue_l1.c index f67c84a07c..c1fbc9f4bd 100644 --- a/openair1/SCHED_NR_UE/fapi_nr_ue_l1.c +++ b/openair1/SCHED_NR_UE/fapi_nr_ue_l1.c @@ -223,15 +223,13 @@ int8_t nr_ue_scheduled_response(nr_scheduled_response_t *scheduled_response){ // Note: we have to handle the thread IDs for this. To be revisited completely. thread_id = scheduled_response->thread_id; NR_UE_DLSCH_t *dlsch0 = NULL; - NR_UE_PDCCH *pdcch_vars = PHY_vars_UE_g[module_id][cc_id]->pdcch_vars[thread_id][0]; NR_UE_ULSCH_t *ulsch0 = PHY_vars_UE_g[module_id][cc_id]->ulsch[thread_id][0][0]; NR_UE_PUCCH *pucch_vars = PHY_vars_UE_g[module_id][cc_id]->pucch_vars[thread_id][0]; + NR_UE_PDCCH_CONFIG *phy_pdcch_config = NULL; if(scheduled_response->dl_config != NULL){ fapi_nr_dl_config_request_t *dl_config = scheduled_response->dl_config; - pdcch_vars->nb_search_space = 0; - for (i = 0; i < dl_config->number_pdus; ++i){ AssertFatal(dl_config->number_pdus < FAPI_NR_DL_CONFIG_LIST_NUM,"dl_config->number_pdus %d out of bounds\n",dl_config->number_pdus); AssertFatal(dl_config->dl_config_list[i].pdu_type<=FAPI_NR_DL_CONFIG_TYPES,"pdu_type %d > 2\n",dl_config->dl_config_list[i].pdu_type); @@ -239,13 +237,16 @@ int8_t nr_ue_scheduled_response(nr_scheduled_response_t *scheduled_response){ __FUNCTION__, scheduled_response->frame, slot, dl_pdu_type[dl_config->dl_config_list[i].pdu_type - 1], dl_config->number_pdus); if (dl_config->dl_config_list[i].pdu_type == FAPI_NR_DL_CONFIG_TYPE_DCI) { - + if (NULL == phy_pdcch_config) { + phy_pdcch_config = (NR_UE_PDCCH_CONFIG *)scheduled_response->phy_data; + phy_pdcch_config->nb_search_space = 0; + } fapi_nr_dl_config_dci_dl_pdu_rel15_t *pdcch_config = &dl_config->dl_config_list[i].dci_config_pdu.dci_config_rel15; - memcpy((void*)&pdcch_vars->pdcch_config[pdcch_vars->nb_search_space],(void*)pdcch_config,sizeof(*pdcch_config)); - pdcch_vars->nb_search_space = pdcch_vars->nb_search_space + 1; - pdcch_vars->sfn = scheduled_response->frame; - pdcch_vars->slot = slot; - LOG_D(PHY,"Number of DCI SearchSpaces %d\n",pdcch_vars->nb_search_space); + memcpy((void*)&phy_pdcch_config->pdcch_config[phy_pdcch_config->nb_search_space],(void*)pdcch_config,sizeof(*pdcch_config)); + phy_pdcch_config->nb_search_space = phy_pdcch_config->nb_search_space + 1; + phy_pdcch_config->sfn = scheduled_response->frame; + phy_pdcch_config->slot = slot; + LOG_D(PHY,"Number of DCI SearchSpaces %d\n",phy_pdcch_config->nb_search_space); } else { diff --git a/openair1/SCHED_NR_UE/phy_procedures_nr_ue.c b/openair1/SCHED_NR_UE/phy_procedures_nr_ue.c index b0ad4b4a83..3d3ab001b0 100644 --- a/openair1/SCHED_NR_UE/phy_procedures_nr_ue.c +++ b/openair1/SCHED_NR_UE/phy_procedures_nr_ue.c @@ -91,7 +91,8 @@ void nr_fill_dl_indication(nr_downlink_indication_t *dl_ind, fapi_nr_rx_indication_t *rx_ind, UE_nr_rxtx_proc_t *proc, PHY_VARS_NR_UE *ue, - uint8_t gNB_id){ + uint8_t gNB_id, + void *phy_data){ memset((void*)dl_ind, 0, sizeof(nr_downlink_indication_t)); @@ -101,6 +102,7 @@ void nr_fill_dl_indication(nr_downlink_indication_t *dl_ind, dl_ind->frame = proc->frame_rx; dl_ind->slot = proc->nr_slot_rx; dl_ind->thread_id = proc->thread_id; + dl_ind->phy_data = phy_data; if (dci_ind) { @@ -359,7 +361,8 @@ void nr_ue_measurement_procedures(uint16_t l, void nr_ue_pbch_procedures(uint8_t gNB_id, PHY_VARS_NR_UE *ue, UE_nr_rxtx_proc_t *proc, - uint8_t abstraction_flag) + uint8_t abstraction_flag, + NR_UE_PDCCH_CONFIG *phy_pdcch_config) { int ret = 0; @@ -377,7 +380,8 @@ void nr_ue_pbch_procedures(uint8_t gNB_id, &ue->frame_parms, gNB_id, (ue->frame_parms.ssb_index)&7, - SISO); + SISO, + phy_pdcch_config); if (ret==0) { @@ -484,6 +488,9 @@ unsigned int nr_get_tx_amp(int power_dBm, int power_max_dBm, int N_RB_UL, int nb int nr_ue_pdcch_procedures(uint8_t gNB_id, PHY_VARS_NR_UE *ue, UE_nr_rxtx_proc_t *proc, + int32_t pdcch_est_size, + int32_t pdcch_dl_ch_estimates[][pdcch_est_size], + NR_UE_PDCCH_CONFIG *phy_pdcch_config, int n_ss) { int frame_rx = proc->frame_rx; @@ -492,8 +499,7 @@ int nr_ue_pdcch_procedures(uint8_t gNB_id, fapi_nr_dci_indication_t *dci_ind = calloc(1, sizeof(*dci_ind)); nr_downlink_indication_t dl_indication; - NR_UE_PDCCH *pdcch_vars = ue->pdcch_vars[proc->thread_id][gNB_id]; - fapi_nr_dl_config_dci_dl_pdu_rel15_t *rel15 = &pdcch_vars->pdcch_config[n_ss]; + fapi_nr_dl_config_dci_dl_pdu_rel15_t *rel15 = &phy_pdcch_config->pdcch_config[n_ss]; /* // unsigned int dci_cnt=0, i; //removed for nr_ue_pdcch_procedures and added in the loop for nb_coreset_active @@ -675,9 +681,14 @@ int nr_ue_pdcch_procedures(uint8_t gNB_id, #endif */ - + + /// \brief PDCCH/DCI e-sequence (input to rate matching). + /// - first index: ? [0..96*N_RB_DL[ + int32_t pdcch_e_rx_size = 2*4*100*12; + int16_t pdcch_e_rx[pdcch_e_rx_size]; + VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_RX_PDCCH, VCD_FUNCTION_IN); - nr_rx_pdcch(ue, proc, rel15); + nr_rx_pdcch(ue, proc, pdcch_est_size, pdcch_dl_ch_estimates, pdcch_e_rx, rel15); VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_RX_PDCCH, VCD_FUNCTION_OUT); @@ -688,7 +699,7 @@ int nr_ue_pdcch_procedures(uint8_t gNB_id, n_ss); #endif - dci_cnt = nr_dci_decoding_procedure(ue, proc, dci_ind, rel15); + dci_cnt = nr_dci_decoding_procedure(ue, proc, pdcch_e_rx, dci_ind, rel15, phy_pdcch_config); #ifdef NR_PDCCH_SCHED_DEBUG LOG_I(PHY,"<-NR_PDCCH_PHY_PROCEDURES_LTE_UE (nr_ue_pdcch_procedures)-> Ending function nr_dci_decoding_procedure() -> dci_cnt=%u\n",dci_cnt); @@ -745,7 +756,7 @@ int nr_ue_pdcch_procedures(uint8_t gNB_id, */ // fill dl_indication message - nr_fill_dl_indication(&dl_indication, dci_ind, NULL, proc, ue, gNB_id); + nr_fill_dl_indication(&dl_indication, dci_ind, NULL, proc, ue, gNB_id, phy_pdcch_config); // send to mac ue->if_inst->dl_indication(&dl_indication, NULL); @@ -1013,16 +1024,16 @@ bool nr_ue_dlsch_procedures(PHY_VARS_NR_UE *ue, switch (pdsch) { case RA_PDSCH: - nr_fill_dl_indication(&dl_indication, NULL, rx_ind, proc, ue, gNB_id); + nr_fill_dl_indication(&dl_indication, NULL, rx_ind, proc, ue, gNB_id, NULL); nr_fill_rx_indication(rx_ind, FAPI_NR_RX_PDU_TYPE_RAR, gNB_id, ue, dlsch0, NULL, number_pdus, proc); ue->UE_mode[gNB_id] = RA_RESPONSE; break; case PDSCH: - nr_fill_dl_indication(&dl_indication, NULL, rx_ind, proc, ue, gNB_id); + nr_fill_dl_indication(&dl_indication, NULL, rx_ind, proc, ue, gNB_id, NULL); nr_fill_rx_indication(rx_ind, FAPI_NR_RX_PDU_TYPE_DLSCH, gNB_id, ue, dlsch0, NULL, number_pdus, proc); break; case SI_PDSCH: - nr_fill_dl_indication(&dl_indication, NULL, rx_ind, proc, ue, gNB_id); + nr_fill_dl_indication(&dl_indication, NULL, rx_ind, proc, ue, gNB_id, NULL); nr_fill_rx_indication(rx_ind, FAPI_NR_RX_PDU_TYPE_SIB, gNB_id, ue, dlsch0, NULL, number_pdus, proc); break; default: @@ -1586,6 +1597,7 @@ int phy_procedures_nrUE_RX(PHY_VARS_NR_UE *ue, UE_nr_rxtx_proc_t *proc, uint8_t gNB_id, uint8_t dlsch_parallel, + NR_UE_PDCCH_CONFIG *phy_pdcch_config, notifiedFIFO_t *txFifo ) { @@ -1593,10 +1605,9 @@ int phy_procedures_nrUE_RX(PHY_VARS_NR_UE *ue, int nr_slot_rx = proc->nr_slot_rx; int slot_pbch; int slot_ssb; - NR_UE_PDCCH *pdcch_vars = ue->pdcch_vars[proc->thread_id][0]; fapi_nr_config_request_t *cfg = &ue->nrUE_config; - uint8_t nb_symb_pdcch = pdcch_vars->nb_search_space > 0 ? pdcch_vars->pdcch_config[0].coreset.duration : 0; + uint8_t nb_symb_pdcch = phy_pdcch_config->nb_search_space > 0 ? phy_pdcch_config->pdcch_config[0].coreset.duration : 0; uint8_t dci_cnt = 0; NR_DL_FRAME_PARMS *fp = &ue->frame_parms; @@ -1614,8 +1625,8 @@ int phy_procedures_nrUE_RX(PHY_VARS_NR_UE *ue, int coreset_nb_rb=0; int coreset_start_rb=0; - if (pdcch_vars->nb_search_space > 0) - get_coreset_rballoc(pdcch_vars->pdcch_config[0].coreset.frequency_domain_resource,&coreset_nb_rb,&coreset_start_rb); + if (phy_pdcch_config->nb_search_space > 0) + get_coreset_rballoc(phy_pdcch_config->pdcch_config[0].coreset.frequency_domain_resource,&coreset_nb_rb,&coreset_start_rb); slot_pbch = is_pbch_in_slot(cfg, frame_rx, nr_slot_rx, fp); slot_ssb = is_ssb_in_slot(cfg, frame_rx, nr_slot_rx, fp); @@ -1642,7 +1653,7 @@ int phy_procedures_nrUE_RX(PHY_VARS_NR_UE *ue, if ((ue->decode_MIB == 1) && slot_pbch) { LOG_D(PHY," ------ Decode MIB: frame.slot %d.%d ------ \n", frame_rx%1024, nr_slot_rx); - nr_ue_pbch_procedures(gNB_id, ue, proc, 0); + nr_ue_pbch_procedures(gNB_id, ue, proc, 0, phy_pdcch_config); if (ue->no_timing_correction==0) { LOG_D(PHY,"start adjust sync slot = %d no timing %d\n", nr_slot_rx, ue->no_timing_correction); @@ -1681,13 +1692,17 @@ int phy_procedures_nrUE_RX(PHY_VARS_NR_UE *ue, nr_slot_rx); } + // Hold the channel estimates in frequency domain. + int32_t pdcch_est_size = fp->symbols_per_slot*(fp->ofdm_symbol_size+LTE_CE_FILTER_LENGTH); + int32_t pdcch_dl_ch_estimates[4*fp->nb_antennas_rx][pdcch_est_size]; + dci_cnt = 0; - for(int n_ss = 0; n_ssnb_search_space; n_ss++) { + for(int n_ss = 0; n_ssnb_search_space; n_ss++) { for (uint16_t l=0; lfirst_carrier_offset, pdcch_vars->pdcch_config[n_ss].BWPStart, coreset_start_rb, coreset_nb_rb); + fp->first_carrier_offset, phy_pdcch_config->pdcch_config[n_ss].BWPStart, coreset_start_rb, coreset_nb_rb); if (coreset_nb_rb > 0) nr_pdcch_channel_estimation(ue, @@ -1695,13 +1710,15 @@ int phy_procedures_nrUE_RX(PHY_VARS_NR_UE *ue, gNB_id, nr_slot_rx, l, - fp->first_carrier_offset+(pdcch_vars->pdcch_config[n_ss].BWPStart + coreset_start_rb)*12, - coreset_nb_rb); + fp->first_carrier_offset+(phy_pdcch_config->pdcch_config[n_ss].BWPStart + coreset_start_rb)*12, + coreset_nb_rb, + pdcch_est_size, + pdcch_dl_ch_estimates); stop_meas(&ue->ofdm_demod_stats); } - dci_cnt = dci_cnt + nr_ue_pdcch_procedures(gNB_id, ue, proc, n_ss); + dci_cnt = dci_cnt + nr_ue_pdcch_procedures(gNB_id, ue, proc, pdcch_est_size, pdcch_dl_ch_estimates, phy_pdcch_config, n_ss); } VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_UE_SLOT_FEP_PDCCH, VCD_FUNCTION_OUT); diff --git a/openair1/SIMULATION/NR_PHY/dlsim.c b/openair1/SIMULATION/NR_PHY/dlsim.c index 4a0da8eade..637df5ccb0 100644 --- a/openair1/SIMULATION/NR_PHY/dlsim.c +++ b/openair1/SIMULATION/NR_PHY/dlsim.c @@ -962,6 +962,8 @@ int main(int argc, char **argv) nr_dcireq_t dcireq; nr_scheduled_response_t scheduled_response; + NR_UE_PDCCH_CONFIG phy_pdcch_config={0}; + memset((void*)&dcireq,0,sizeof(dcireq)); memset((void*)&scheduled_response,0,sizeof(scheduled_response)); dcireq.module_id = 0; @@ -976,6 +978,7 @@ int main(int argc, char **argv) scheduled_response.frame = frame; scheduled_response.slot = slot; scheduled_response.thread_id = 0; + scheduled_response.phy_data = &phy_pdcch_config; nr_ue_phy_config_request(&UE_mac->phy_config); //NR_COMMON_channels_t *cc = RC.nrmac[0]->common_channels; @@ -1218,6 +1221,7 @@ int main(int argc, char **argv) &UE_proc, 0, dlsch_threads, + &phy_pdcch_config, NULL); //printf("dlsim round %d ends\n",round); @@ -1365,8 +1369,6 @@ int main(int argc, char **argv) LOG_M("chestF0.m","chF0",&UE->pdsch_vars[0][0]->dl_ch_estimates_ext[0][0],g_rbSize*12*14,1,1); write_output("rxF_comp.m","rxFc",&UE->pdsch_vars[0][0]->rxdataF_comp0[0][0],N_RB_DL*12*14,1,1); LOG_M("rxF_llr.m","rxFllr",UE->pdsch_vars[UE_proc.thread_id][0]->llr[0],available_bits,1,0); - LOG_M("pdcch_rxFcomp.m","pdcch_rxFcomp",&UE->pdcch_vars[0][0]->rxdataF_comp[0][0],96*12,1,1); - LOG_M("pdcch_rxFllr.m","pdcch_rxFllr",UE->pdcch_vars[0][0]->llr,96*12,1,1); break; } diff --git a/openair1/SIMULATION/NR_PHY/nr_dummy_functions.c b/openair1/SIMULATION/NR_PHY/nr_dummy_functions.c index 7a47410129..a37b8473e8 100644 --- a/openair1/SIMULATION/NR_PHY/nr_dummy_functions.c +++ b/openair1/SIMULATION/NR_PHY/nr_dummy_functions.c @@ -27,7 +27,8 @@ void nr_fill_dl_indication(nr_downlink_indication_t *dl_ind, fapi_nr_rx_indication_t *rx_ind, UE_nr_rxtx_proc_t *proc, PHY_VARS_NR_UE *ue, - uint8_t gNB_id) {} + uint8_t gNB_id, + void *phy_data) {} void nr_fill_rx_indication(fapi_nr_rx_indication_t *rx_ind, uint8_t pdu_type, uint8_t gNB_id, diff --git a/openair1/SIMULATION/NR_PHY/pbchsim.c b/openair1/SIMULATION/NR_PHY/pbchsim.c index 2413a86912..f9bafd2032 100644 --- a/openair1/SIMULATION/NR_PHY/pbchsim.c +++ b/openair1/SIMULATION/NR_PHY/pbchsim.c @@ -74,7 +74,10 @@ void init_downlink_harq_status(NR_DL_UE_HARQ_t *dl_harq) {} int nr_ue_pdcch_procedures(uint8_t gNB_id, PHY_VARS_NR_UE *ue, UE_nr_rxtx_proc_t *proc, - int n_ss) { + int32_t pdcch_est_size, + int32_t pdcch_dl_ch_estimates[][pdcch_est_size], + NR_UE_PDCCH_CONFIG *phy_pdcch_config, + int n_ss) { return 0; } @@ -720,6 +723,8 @@ int main(int argc, char **argv) } else { UE_nr_rxtx_proc_t proc={0}; + NR_UE_PDCCH_CONFIG phy_pdcch_config={0}; + UE->rx_offset=0; uint8_t ssb_index = 0; while (!((SSB_positions >> ssb_index) & 0x01)) ssb_index++; // to select the first transmitted ssb @@ -742,7 +747,8 @@ int main(int argc, char **argv) frame_parms, 0, ssb_index%8, - SISO); + SISO, + &phy_pdcch_config); if (ret==0) { //UE->rx_ind.rx_indication_body->mib_pdu.ssb_index; //not yet detected automatically diff --git a/openair2/LAYER2/NR_MAC_UE/mac_proto.h b/openair2/LAYER2/NR_MAC_UE/mac_proto.h index 288716ed85..8aa601f301 100644 --- a/openair2/LAYER2/NR_MAC_UE/mac_proto.h +++ b/openair2/LAYER2/NR_MAC_UE/mac_proto.h @@ -48,6 +48,7 @@ void nr_ue_init_mac(module_id_t module_idP); \param module_id module id \param cc_id component carrier id \param gNB_index gNB index + \param phy_data PHY structure to be filled in by the callee in the FAPI call (L1 caller -> indication to L2 -> FAPI call to L1 callee) \param extra_bits extra bits for frame calculation \param l_ssb_equal_64 check if ssb number of candicate is equal 64, 1=equal; 0=non equal. Reference 38.212 7.1.1 \param pduP pointer to pdu @@ -56,7 +57,8 @@ void nr_ue_init_mac(module_id_t module_idP); int8_t nr_ue_decode_mib( module_id_t module_id, int cc_id, - uint8_t gNB_index, + uint8_t gNB_index, + void *phy_data, uint8_t extra_bits, uint32_t ssb_length, uint32_t ssb_index, @@ -132,7 +134,7 @@ NR_UE_L2_STATE_t nr_ue_scheduler(nr_downlink_indication_t *dl_info, nr_uplink_in @param int cc_id CC ID @param frame_t frame frame number @param int slot reference number - @param UE_nr_rxtx_proc_t *proc pointer to process context */ + @param void *phy_pata pointer to a PHY specific structure to be filled in the scheduler response (can be null) */ void fill_scheduled_response(nr_scheduled_response_t *scheduled_response, fapi_nr_dl_config_request_t *dl_config, fapi_nr_ul_config_request_t *ul_config, @@ -141,7 +143,8 @@ void fill_scheduled_response(nr_scheduled_response_t *scheduled_response, int cc_id, frame_t frame, int slot, - int thread_id); + int thread_id, + void *phy_data); /*! \fn int8_t nr_ue_get_SR(module_id_t module_idP, frame_t frameP, slot_t slotP); \brief Called by PHY to get sdu for PUSCH transmission. It performs the following operations: Checks BSR for DCCH, DCCH1 and DTCH corresponding to previous values computed either in SR or BSR procedures. It gets rlc status indications on DCCH,DCCH1 and DTCH and forms BSR elements and PHR in MAC header. CRNTI element is not supported yet. It computes transport block for up to 3 SDUs and generates header and forms the complete MAC SDU. @@ -369,7 +372,8 @@ void nr_ue_sib1_scheduler(module_id_t module_idP, uint8_t ssb_subcarrier_offset, uint32_t ssb_index, uint16_t ssb_start_subcarrier, - frequency_range_t frequency_range); + frequency_range_t frequency_range, + void *phy_data); /* \brief Function called by PHY to process the received RAR and check that the preamble matches what was sent by the gNB. It provides the timing advance and t-CRNTI. @param Mod_id Index of UE instance diff --git a/openair2/LAYER2/NR_MAC_UE/nr_ue_procedures.c b/openair2/LAYER2/NR_MAC_UE/nr_ue_procedures.c index 85bb10290a..e0a0aa9ce4 100644 --- a/openair2/LAYER2/NR_MAC_UE/nr_ue_procedures.c +++ b/openair2/LAYER2/NR_MAC_UE/nr_ue_procedures.c @@ -288,6 +288,7 @@ int get_rnti_type(NR_UE_MAC_INST_t *mac, uint16_t rnti){ int8_t nr_ue_decode_mib(module_id_t module_id, int cc_id, uint8_t gNB_index, + void *phy_data, uint8_t extra_bits, // 8bits 38.212 c7.1.1 uint32_t ssb_length, uint32_t ssb_index, @@ -363,7 +364,8 @@ int8_t nr_ue_decode_mib(module_id_t module_id, ssb_subcarrier_offset, ssb_index, ssb_start_subcarrier, - mac->frequency_range); + mac->frequency_range, + phy_data); } else { NR_ServingCellConfigCommon_t *scc = mac->scc; diff --git a/openair2/LAYER2/NR_MAC_UE/nr_ue_scheduler.c b/openair2/LAYER2/NR_MAC_UE/nr_ue_scheduler.c index 5284f7fc53..7f393cce6b 100644 --- a/openair2/LAYER2/NR_MAC_UE/nr_ue_scheduler.c +++ b/openair2/LAYER2/NR_MAC_UE/nr_ue_scheduler.c @@ -89,7 +89,8 @@ void fill_scheduled_response(nr_scheduled_response_t *scheduled_response, int cc_id, frame_t frame, int slot, - int thread_id){ + int thread_id, + void *phy_data){ scheduled_response->dl_config = dl_config; scheduled_response->ul_config = ul_config; @@ -99,6 +100,7 @@ void fill_scheduled_response(nr_scheduled_response_t *scheduled_response, scheduled_response->frame = frame; scheduled_response->slot = slot; scheduled_response->thread_id = thread_id; + scheduled_response->phy_data = phy_data; } @@ -922,7 +924,7 @@ NR_UE_L2_STATE_t nr_ue_scheduler(nr_downlink_indication_t *dl_info, nr_uplink_in nr_ue_dcireq(&dcireq); //to be replaced with function pointer later mac->dl_config_request = dcireq.dl_config_req; - fill_scheduled_response(&scheduled_response, &dcireq.dl_config_req, NULL, NULL, mod_id, cc_id, rx_frame, rx_slot, dl_info->thread_id); + fill_scheduled_response(&scheduled_response, &dcireq.dl_config_req, NULL, NULL, mod_id, cc_id, rx_frame, rx_slot, dl_info->thread_id, dl_info->phy_data); if(mac->if_module != NULL && mac->if_module->scheduled_response != NULL) mac->if_module->scheduled_response(&scheduled_response); } @@ -938,7 +940,7 @@ NR_UE_L2_STATE_t nr_ue_scheduler(nr_downlink_indication_t *dl_info, nr_uplink_in fill_dci_search_candidates(mac->ra.ss, rel15); dl_config->number_pdus = 1; LOG_D(MAC,"mac->cg %p: Calling fill_scheduled_response rnti %x, type0_pdcch, num_pdus %d\n",mac->cg,rel15->rnti,dl_config->number_pdus); - fill_scheduled_response(&scheduled_response, dl_config, NULL, NULL, mod_id, cc_id, rx_frame, rx_slot, dl_info->thread_id); + fill_scheduled_response(&scheduled_response, dl_config, NULL, NULL, mod_id, cc_id, rx_frame, rx_slot, dl_info->thread_id, dl_info->phy_data); if(mac->if_module != NULL && mac->if_module->scheduled_response != NULL) mac->if_module->scheduled_response(&scheduled_response); } @@ -1037,7 +1039,7 @@ NR_UE_L2_STATE_t nr_ue_scheduler(nr_downlink_indication_t *dl_info, nr_uplink_in } pthread_mutex_unlock(&ul_config->mutex_ul_config); // avoid double lock - fill_scheduled_response(&scheduled_response, NULL, ul_config, &tx_req, mod_id, cc_id, frame_tx, slot_tx, ul_info->thread_id); + fill_scheduled_response(&scheduled_response, NULL, ul_config, &tx_req, mod_id, cc_id, frame_tx, slot_tx, ul_info->thread_id, NULL); if(mac->if_module != NULL && mac->if_module->scheduled_response != NULL){ mac->if_module->scheduled_response(&scheduled_response); } @@ -2189,7 +2191,7 @@ void nr_ue_pucch_scheduler(module_id_t module_idP, frame_t frameP, int slotP, in O_SR, O_ACK, O_CSI); LOG_D(NR_MAC,"Configuring pucch, is_common = %d\n",pucch->is_common); nr_scheduled_response_t scheduled_response; - fill_scheduled_response(&scheduled_response, NULL, ul_config, NULL, module_idP, 0 /*TBR fix*/, frameP, slotP, thread_id); + fill_scheduled_response(&scheduled_response, NULL, ul_config, NULL, module_idP, 0 /*TBR fix*/, frameP, slotP, thread_id, NULL); if(mac->if_module != NULL && mac->if_module->scheduled_response != NULL) mac->if_module->scheduled_response(&scheduled_response); } @@ -2339,7 +2341,7 @@ void nr_ue_prach_scheduler(module_id_t module_idP, frame_t frameP, sub_frame_t s } } // if format1 - fill_scheduled_response(&scheduled_response, NULL, ul_config, NULL, module_idP, 0 /*TBR fix*/, frameP, slotP, thread_id); + fill_scheduled_response(&scheduled_response, NULL, ul_config, NULL, module_idP, 0 /*TBR fix*/, frameP, slotP, thread_id, NULL); if(mac->if_module != NULL && mac->if_module->scheduled_response != NULL) mac->if_module->scheduled_response(&scheduled_response); } // is_nr_prach_slot @@ -2354,7 +2356,8 @@ void nr_ue_sib1_scheduler(module_id_t module_idP, uint8_t ssb_subcarrier_offset, uint32_t ssb_index, uint16_t ssb_start_subcarrier, - frequency_range_t frequency_range) { + frequency_range_t frequency_range, + void *phy_data) { NR_UE_MAC_INST_t *mac = get_mac_inst(module_idP); nr_scheduled_response_t scheduled_response; @@ -2402,7 +2405,7 @@ void nr_ue_sib1_scheduler(module_id_t module_idP, slot_s = mac->type0_PDCCH_CSS_config.n_c; } LOG_D(MAC,"Calling fill_scheduled_response, type0_pdcch, num_pdus %d\n",dl_config->number_pdus); - fill_scheduled_response(&scheduled_response, dl_config, NULL, NULL, module_idP, cc_id, frame_s, slot_s, 0); // TODO fix thread_id, for now assumed 0 + fill_scheduled_response(&scheduled_response, dl_config, NULL, NULL, module_idP, cc_id, frame_s, slot_s, 0, phy_data); // TODO fix thread_id, for now assumed 0 if (dl_config->number_pdus) { if(mac->if_module != NULL && mac->if_module->scheduled_response != NULL) diff --git a/openair2/NR_UE_PHY_INTERFACE/NR_IF_Module.c b/openair2/NR_UE_PHY_INTERFACE/NR_IF_Module.c index c7b54950d7..d2a8032ace 100644 --- a/openair2/NR_UE_PHY_INTERFACE/NR_IF_Module.c +++ b/openair2/NR_UE_PHY_INTERFACE/NR_IF_Module.c @@ -1001,7 +1001,7 @@ void *nrue_standalone_pnf_task(void *context) // L2 Abstraction Layer int handle_bcch_bch(module_id_t module_id, int cc_id, - unsigned int gNB_index, uint8_t *pduP, + unsigned int gNB_index, void *phy_data, uint8_t *pduP, unsigned int additional_bits, uint32_t ssb_index, uint32_t ssb_length, uint16_t ssb_start_subcarrier, uint16_t cell_id){ @@ -1009,6 +1009,7 @@ int handle_bcch_bch(module_id_t module_id, int cc_id, return nr_ue_decode_mib(module_id, cc_id, gNB_index, + phy_data, additional_bits, ssb_length, // Lssb = 64 is not support ssb_index, @@ -1142,7 +1143,7 @@ int nr_ue_dl_indication(nr_downlink_indication_t *dl_info, NR_UL_TIME_ALIGNMENT_ if (ret >= 0) { AssertFatal( nr_ue_if_module_inst[module_id] != NULL, "IF module is NULL!\n" ); AssertFatal( nr_ue_if_module_inst[module_id]->scheduled_response != NULL, "scheduled_response is NULL!\n" ); - fill_scheduled_response(&scheduled_response, dl_config, NULL, NULL, dl_info->module_id, dl_info->cc_id, dl_info->frame, dl_info->slot, dl_info->thread_id); + fill_scheduled_response(&scheduled_response, dl_config, NULL, NULL, dl_info->module_id, dl_info->cc_id, dl_info->frame, dl_info->slot, dl_info->thread_id, dl_info->phy_data); nr_ue_if_module_inst[module_id]->scheduled_response(&scheduled_response); } memset(def_dci_pdu_rel15, 0, sizeof(*def_dci_pdu_rel15)); @@ -1163,7 +1164,7 @@ int nr_ue_dl_indication(nr_downlink_indication_t *dl_info, NR_UL_TIME_ALIGNMENT_ switch(dl_info->rx_ind->rx_indication_body[i].pdu_type){ case FAPI_NR_RX_PDU_TYPE_SSB: mac->ssb_rsrp_dBm = (dl_info->rx_ind->rx_indication_body+i)->ssb_pdu.rsrp_dBm; - ret_mask |= (handle_bcch_bch(dl_info->module_id, dl_info->cc_id, dl_info->gNB_index, + ret_mask |= (handle_bcch_bch(dl_info->module_id, dl_info->cc_id, dl_info->gNB_index, dl_info->phy_data, (dl_info->rx_ind->rx_indication_body+i)->ssb_pdu.pdu, (dl_info->rx_ind->rx_indication_body+i)->ssb_pdu.additional_bits, (dl_info->rx_ind->rx_indication_body+i)->ssb_pdu.ssb_index, diff --git a/openair2/NR_UE_PHY_INTERFACE/NR_IF_Module.h b/openair2/NR_UE_PHY_INTERFACE/NR_IF_Module.h index 2a8a514769..fbc862eb8d 100755 --- a/openair2/NR_UE_PHY_INTERFACE/NR_IF_Module.h +++ b/openair2/NR_UE_PHY_INTERFACE/NR_IF_Module.h @@ -94,6 +94,9 @@ typedef struct { /// dci reception indication structure fapi_nr_dci_indication_t *dci_ind; + /// PHY specific data structure that can be passed on to L2 via nr_downlink_indication_t and + /// back to L1 via the nr_scheduled_response_t + void *phy_data; } nr_downlink_indication_t; @@ -147,6 +150,9 @@ typedef struct { /// data transmission request structure fapi_nr_tx_request_t *tx_request; + /// PHY data structure initially passed on to L2 via the nr_downlink_indication_t and + /// returned to L1 via nr_scheduled_response_t + void *phy_data; } nr_scheduled_response_t; typedef struct { @@ -255,6 +261,7 @@ int nr_ue_dcireq(nr_dcireq_t *dcireq); // TODO check /**\brief handle BCCH-BCH message from dl_indication + \param phy_data PHY structure to be filled in by the callee in the FAPI call (L1 caller -> indication to L2 -> FAPI call to L1 callee) \param pduP pointer to bch pdu \param additional_bits corresponding to 38.212 ch.7 \param ssb_index SSB index within 0 - (L_ssb-1) corresponding to 38.331 ch.13 parameter i @@ -263,6 +270,7 @@ int nr_ue_dcireq(nr_dcireq_t *dcireq); int handle_bcch_bch(module_id_t module_id, int cc_id, unsigned int gNB_index, + void *phy_data, uint8_t *pduP, unsigned int additional_bits, uint32_t ssb_index, From 4a00c99ab0af31c538ce135af0797550564c6685 Mon Sep 17 00:00:00 2001 From: Mario Hudon Date: Wed, 23 Mar 2022 17:11:02 -0400 Subject: [PATCH 3/6] Fixed rebaseline to develop --- openair1/PHY/INIT/nr_init_ue.c | 34 +++------------------ openair1/PHY/NR_UE_TRANSPORT/nr_pbch.c | 6 +--- openair1/SCHED_NR_UE/fapi_nr_ue_l1.c | 3 +- openair2/NR_UE_PHY_INTERFACE/NR_IF_Module.c | 2 +- 4 files changed, 9 insertions(+), 36 deletions(-) diff --git a/openair1/PHY/INIT/nr_init_ue.c b/openair1/PHY/INIT/nr_init_ue.c index cab4583efd..94f3564baa 100644 --- a/openair1/PHY/INIT/nr_init_ue.c +++ b/openair1/PHY/INIT/nr_init_ue.c @@ -410,9 +410,13 @@ int init_nr_ue_signal(PHY_VARS_NR_UE *ue, int nb_connected_gNB) ue->pdsch_vars[th_id][gNB_id]->dl_ch_magb1[k][l][idx] = (int32_t *)malloc16_clear(7*2*sizeof(int32_t)*(fp->N_RB_DL*12)); } } - } } } + + // RACH + prach_vars[gNB_id]->prachF = (int16_t *)malloc16_clear( sizeof(int)*(7*2*sizeof(int)*(fp->ofdm_symbol_size*12)) ); + prach_vars[gNB_id]->prach = (int16_t *)malloc16_clear( sizeof(int)*(7*2*sizeof(int)*(fp->ofdm_symbol_size*12)) ); + } // initialization for the last instance of pdsch_vars (used for MU-MIMO) @@ -539,34 +543,6 @@ void term_nr_ue_signal(PHY_VARS_NR_UE *ue, int nb_connected_gNB) free_and_zero(ue->pdsch_vars[th_id][gNB_id]); } - for (int th_id = 0; th_id < RX_NB_TH_MAX; th_id++) { - for (int i = 0; i < fp->nb_antennas_rx; i++) { - for (int j = 0; j < 4; j++) { - int idx = j * fp->nb_antennas_rx + i; - free_and_zero(ue->pdcch_vars[th_id][gNB_id]->dl_ch_estimates[idx]); - free_and_zero(ue->pdcch_vars[th_id][gNB_id]->dl_ch_estimates_time[idx]); - free_and_zero(ue->pdcch_vars[th_id][gNB_id]->rxdataF_comp[idx]); - free_and_zero(ue->pdcch_vars[th_id][gNB_id]->dl_ch_rho_ext[idx]); - free_and_zero(ue->pdcch_vars[th_id][gNB_id]->rxdataF_ext[idx]); - free_and_zero(ue->pdcch_vars[th_id][gNB_id]->dl_ch_estimates_ext[idx]); - } - free_and_zero(ue->pdcch_vars[th_id][gNB_id]->rho[i]); - } - free_and_zero(ue->pdcch_vars[th_id][gNB_id]->llr); - free_and_zero(ue->pdcch_vars[th_id][gNB_id]->llr16); - free_and_zero(ue->pdcch_vars[th_id][gNB_id]->wbar); - free_and_zero(ue->pdcch_vars[th_id][gNB_id]->e_rx); - free_and_zero(ue->pdcch_vars[th_id][gNB_id]->rxdataF_comp); - free_and_zero(ue->pdcch_vars[th_id][gNB_id]->dl_ch_rho_ext); - free_and_zero(ue->pdcch_vars[th_id][gNB_id]->rho); - free_and_zero(ue->pdcch_vars[th_id][gNB_id]->rxdataF_ext); - free_and_zero(ue->pdcch_vars[th_id][gNB_id]->dl_ch_estimates_ext); - free_and_zero(ue->pdcch_vars[th_id][gNB_id]->dl_ch_estimates); - free_and_zero(ue->pdcch_vars[th_id][gNB_id]->dl_ch_estimates_time); - - free_and_zero(ue->pdcch_vars[th_id][gNB_id]); - } - for (int i = 0; i < fp->nb_antennas_rx; i++) { free_and_zero(ue->nr_srs_info->srs_received_signal[i]); free_and_zero(ue->nr_srs_info->srs_ls_estimated_channel[i]); diff --git a/openair1/PHY/NR_UE_TRANSPORT/nr_pbch.c b/openair1/PHY/NR_UE_TRANSPORT/nr_pbch.c index dcb373e057..48b08d761e 100644 --- a/openair1/PHY/NR_UE_TRANSPORT/nr_pbch.c +++ b/openair1/PHY/NR_UE_TRANSPORT/nr_pbch.c @@ -391,12 +391,8 @@ int nr_rx_pbch( PHY_VARS_NR_UE *ue, uint8_t gNB_id, uint8_t i_ssb, MIMO_mode_t mimo_mode, -<<<<<<< HEAD - NR_UE_PDCCH_CONFIG *phy_pdcch_config) { - -======= + NR_UE_PDCCH_CONFIG *phy_pdcch_config, fapiPbch_t *result) { ->>>>>>> oai-eurecom/develop NR_UE_COMMON *nr_ue_common_vars = &ue->common_vars; int max_h=0; int symbol; diff --git a/openair1/SCHED_NR_UE/fapi_nr_ue_l1.c b/openair1/SCHED_NR_UE/fapi_nr_ue_l1.c index 4aa0c5d4b3..279a0d8ce5 100644 --- a/openair1/SCHED_NR_UE/fapi_nr_ue_l1.c +++ b/openair1/SCHED_NR_UE/fapi_nr_ue_l1.c @@ -286,6 +286,7 @@ int8_t nr_ue_scheduled_response(nr_scheduled_response_t *scheduled_response){ if(scheduled_response->dl_config != NULL){ fapi_nr_dl_config_request_t *dl_config = scheduled_response->dl_config; fapi_nr_dl_config_dlsch_pdu_rel15_t *dlsch_config_pdu; + fapi_nr_dl_config_dci_dl_pdu_rel15_t *pdcch_config; for (int i = 0; i < dl_config->number_pdus; ++i){ AssertFatal(dl_config->number_pdus < FAPI_NR_DL_CONFIG_LIST_NUM,"dl_config->number_pdus %d out of bounds\n",dl_config->number_pdus); @@ -299,7 +300,7 @@ int8_t nr_ue_scheduled_response(nr_scheduled_response_t *scheduled_response){ phy_pdcch_config = (NR_UE_PDCCH_CONFIG *)scheduled_response->phy_data; phy_pdcch_config->nb_search_space = 0; } - fapi_nr_dl_config_dci_dl_pdu_rel15_t *pdcch_config = &dl_config->dl_config_list[i].dci_config_pdu.dci_config_rel15; + pdcch_config = &dl_config->dl_config_list[i].dci_config_pdu.dci_config_rel15; memcpy((void*)&phy_pdcch_config->pdcch_config[phy_pdcch_config->nb_search_space],(void*)pdcch_config,sizeof(*pdcch_config)); phy_pdcch_config->nb_search_space = phy_pdcch_config->nb_search_space + 1; phy_pdcch_config->sfn = scheduled_response->frame; diff --git a/openair2/NR_UE_PHY_INTERFACE/NR_IF_Module.c b/openair2/NR_UE_PHY_INTERFACE/NR_IF_Module.c index 7ae66ec448..6ba740eeaf 100644 --- a/openair2/NR_UE_PHY_INTERFACE/NR_IF_Module.c +++ b/openair2/NR_UE_PHY_INTERFACE/NR_IF_Module.c @@ -1013,7 +1013,7 @@ int handle_bcch_bch(module_id_t module_id, int cc_id, return nr_ue_decode_mib(module_id, cc_id, gNB_index, - phy_data, + phy_data, additional_bits, ssb_length, // Lssb = 64 is not support ssb_index, From 1985393d518e1afbc8e32e77dc40b7f5e3b57b2e Mon Sep 17 00:00:00 2001 From: Mario Hudon Date: Wed, 30 Mar 2022 11:38:53 -0400 Subject: [PATCH 4/6] - Fixed NR UE Scope build - Added a double data buffer in the NR UE Scope to reduce the risk of race condition/data corruption between the Scope thread and the Rx thread --- openair1/PHY/NR_UE_TRANSPORT/dci_nr.c | 7 ++ openair1/PHY/TOOLS/nr_phy_scope.c | 81 +++++++++++++----------- openair1/PHY/TOOLS/phy_scope_interface.h | 2 + 3 files changed, 52 insertions(+), 38 deletions(-) diff --git a/openair1/PHY/NR_UE_TRANSPORT/dci_nr.c b/openair1/PHY/NR_UE_TRANSPORT/dci_nr.c index 293588b978..3add2c7b99 100644 --- a/openair1/PHY/NR_UE_TRANSPORT/dci_nr.c +++ b/openair1/PHY/NR_UE_TRANSPORT/dci_nr.c @@ -42,6 +42,7 @@ #include "PHY/CODING/coding_extern.h" #include "PHY/sse_intrin.h" #include "common/utils/nr/nr_common.h" +#include #include "assertions.h" #include "T.h" @@ -766,6 +767,9 @@ int32_t nr_rx_pdcch(PHY_VARS_NR_UE *ue, s, log2_maxh, n_rb); // log2_maxh+I0_shift + + UEscopeCopy(ue, pdcchRxdataF_comp, rxdataF_comp, sizeof(struct complex16), frame_parms->nb_antennas_rx, rx_size); + if (frame_parms->nb_antennas_rx > 1) { LOG_D(PHY,"we enter nr_pdcch_detection_mrc(frame_parms->nb_antennas_rx=%d)\n", frame_parms->nb_antennas_rx); nr_pdcch_detection_mrc(frame_parms, rx_size, rxdataF_comp,s); @@ -779,6 +783,9 @@ int32_t nr_rx_pdcch(PHY_VARS_NR_UE *ue, llr, s, n_rb); + + UEscopeCopy(ue, pdcchLlr, llr, sizeof(int16_t), 1, llr_size); + #if T_TRACER // T(T_UE_PHY_PDCCH_IQ, T_INT(frame_parms->N_RB_DL), T_INT(frame_parms->N_RB_DL), diff --git a/openair1/PHY/TOOLS/nr_phy_scope.c b/openair1/PHY/TOOLS/nr_phy_scope.c index fe0f785ef4..81ca5bf3dd 100644 --- a/openair1/PHY/TOOLS/nr_phy_scope.c +++ b/openair1/PHY/TOOLS/nr_phy_scope.c @@ -678,52 +678,42 @@ static void uePbchIQ (scopeGraphData_t **data, OAIgraph_t *graph, PHY_VARS_NR_U static void uePcchLLR (scopeGraphData_t **data, OAIgraph_t *graph, PHY_VARS_NR_UE *phy_vars_ue, int eNB_id, int UE_id) { // PDCCH LLRs - if (!phy_vars_ue->pdcch_vars[0][eNB_id]->llr) + if (!data[pdcchLlr]) return; //int num_re = 4*273*12; // 12*frame_parms->N_RB_DL*num_pdcch_symbols //int Qm = 2; - int coded_bits_per_codeword = 2*4*100*12; //num_re*Qm; + const int sz=data[pdcchLlr]->lineSz; float *llr, *bit; - oai_xygraph_getbuff(graph, &bit, &llr, coded_bits_per_codeword*RX_NB_TH_MAX, 0); - int base=0; + oai_xygraph_getbuff(graph, &bit, &llr, sz, 0); - for (int thr=0 ; thr < RX_NB_TH_MAX ; thr ++ ) { - int16_t *pdcch_llr = (int16_t *) phy_vars_ue->pdcch_vars[thr][eNB_id]->llr; + int16_t *pdcch_llr = (int16_t *)(data[pdcchLlr]+1); - for (int i=0; ipdcch_vars[0][eNB_id]->rxdataF_comp[0]) + if (!data[pdcchRxdataF_comp]) return; - int nb=4*273*12; // 12*frame_parms->N_RB_DL*num_pdcch_symbols + const int sz=data[pdcchRxdataF_comp]->lineSz; + //const int antennas=data[pdcchRxdataF_comp]->colSz; + // We take the first antenna only for now float *I, *Q; - oai_xygraph_getbuff(graph, &I, &Q, nb*RX_NB_TH_MAX, 0); - int base=0; + oai_xygraph_getbuff(graph, &I, &Q, sz, 0); - for (int thr=0 ; thr < RX_NB_TH_MAX ; thr ++ ) { - scopeSample_t *pdcch_comp = (scopeSample_t *) phy_vars_ue->pdcch_vars[thr][eNB_id]->rxdataF_comp[0]; + scopeSample_t *pdcch_comp = (scopeSample_t *) (data[pdcchRxdataF_comp]+1); - for (int i=0; i< nb; i++) { - I[base+i] = pdcch_comp[i].r; - Q[base+i] = pdcch_comp[i].i; - } - - base+=nb; + for (int i=0; iscopeData)->liveData=calloc(sizeof(scopeGraphData_t *), UEdataTypeNumberOfItems); while (!oai_exit) { fl_freeze_form(form_nrue->phy_scope); @@ -925,28 +914,43 @@ static void *nrUEscopeThread(void *arg) { } void UEcopyData(PHY_VARS_NR_UE *ue, enum UEdataType type, void *dataIn, int elementSz, int colSz, int lineSz) { + // Local static copy of the scope data bufs + // The active data buf is alterned to avoid interference between the Scope thread (display) and the Rx thread (data input) + // Index of "2" could be set to the number of Rx threads + 1 + static scopeGraphData_t *copyDataBufs[UEdataTypeNumberOfItems][2] = {0}; + static int copyDataBufsIdx[UEdataTypeNumberOfItems] = {0}; + scopeData_t *tmp=(scopeData_t *)ue->scopeData; if (tmp) { - scopeGraphData_t *live= ((scopeGraphData_t **)tmp->liveData)[type]; + // Begin of critical zone between UE Rx threads that might copy new data at the same time: might require a mutex + int newCopyDataIdx = (copyDataBufsIdx[type]==0)?1:0; + copyDataBufsIdx[type] = newCopyDataIdx; + // End of critical zone between UE Rx threads - if (live == NULL || live->dataSize < elementSz*colSz*lineSz) { - scopeGraphData_t *ptr=realloc(live, sizeof(scopeGraphData_t) + elementSz*colSz*lineSz); + // New data will be copied in a different buffer than the live one + scopeGraphData_t *copyData= copyDataBufs[type][newCopyDataIdx]; + + if (copyData == NULL || copyData->dataSize < elementSz*colSz*lineSz) { + scopeGraphData_t *ptr=realloc(copyData, sizeof(scopeGraphData_t) + elementSz*colSz*lineSz); if (!ptr) { LOG_E(PHY,"can't realloc\n"); return; } else { - live=ptr; + copyData=ptr; } } - live->dataSize=elementSz*colSz*lineSz; - live->elementSz=elementSz; - live->colSz=colSz; - live->lineSz=lineSz; - memcpy(live+1, dataIn, elementSz*colSz*lineSz); - ((scopeGraphData_t **)tmp->liveData)[type]=live; + copyData->dataSize=elementSz*colSz*lineSz; + copyData->elementSz=elementSz; + copyData->colSz=colSz; + copyData->lineSz=lineSz; + memcpy(copyData+1, dataIn, elementSz*colSz*lineSz); + copyDataBufs[type][newCopyDataIdx] = copyData; + + // The new data just copied in the local static buffer becomes live now + ((scopeGraphData_t **)tmp->liveData)[type]=copyData; } } @@ -954,6 +958,7 @@ void nrUEinitScope(PHY_VARS_NR_UE *ue) { AssertFatal(ue->scopeData=malloc(sizeof(scopeData_t)),""); scopeData_t *scope=(scopeData_t *) ue->scopeData; scope->copyData=UEcopyData; + AssertFatal(scope->liveData=calloc(sizeof(scopeGraphData_t *), UEdataTypeNumberOfItems),""); pthread_t forms_thread; threadCreate(&forms_thread, nrUEscopeThread, ue, "scope", -1, OAI_PRIORITY_RT_LOW); } diff --git a/openair1/PHY/TOOLS/phy_scope_interface.h b/openair1/PHY/TOOLS/phy_scope_interface.h index 9cd8e1dc40..6162e1eee5 100644 --- a/openair1/PHY/TOOLS/phy_scope_interface.h +++ b/openair1/PHY/TOOLS/phy_scope_interface.h @@ -45,6 +45,8 @@ enum UEdataType { pbchDlChEstimateTime, pbchLlr, pbchRxdataF_comp, + pdcchLlr, + pdcchRxdataF_comp, UEdataTypeNumberOfItems }; From b98f10b73643840200e9f952d2ecb286cad15800 Mon Sep 17 00:00:00 2001 From: Mario Hudon Date: Mon, 4 Apr 2022 14:32:27 -0400 Subject: [PATCH 5/6] - Fixed failing CI tests - Memory leak - Seg fault in dlsim tests --- openair1/PHY/INIT/nr_init_ue.c | 4 ++++ openair1/SCHED_NR_UE/phy_procedures_nr_ue.c | 4 ++-- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/openair1/PHY/INIT/nr_init_ue.c b/openair1/PHY/INIT/nr_init_ue.c index ca18b7509b..67c5605f2b 100644 --- a/openair1/PHY/INIT/nr_init_ue.c +++ b/openair1/PHY/INIT/nr_init_ue.c @@ -526,6 +526,10 @@ void term_nr_ue_signal(PHY_VARS_NR_UE *ue, int nb_connected_gNB) free_and_zero(ue->pdsch_vars[th_id][gNB_id]); } + for (int th_id = 0; th_id < RX_NB_TH_MAX; th_id++) { + free_and_zero(ue->pdcch_vars[th_id][gNB_id]); + } + for (int i = 0; i < fp->nb_antennas_rx; i++) { free_and_zero(ue->nr_srs_info->srs_received_signal[i]); free_and_zero(ue->nr_srs_info->srs_ls_estimated_channel[i]); diff --git a/openair1/SCHED_NR_UE/phy_procedures_nr_ue.c b/openair1/SCHED_NR_UE/phy_procedures_nr_ue.c index 2f643866e5..20c9b7a1ac 100644 --- a/openair1/SCHED_NR_UE/phy_procedures_nr_ue.c +++ b/openair1/SCHED_NR_UE/phy_procedures_nr_ue.c @@ -1478,8 +1478,8 @@ int phy_procedures_nrUE_RX(PHY_VARS_NR_UE *ue, } // Hold the channel estimates in frequency domain. - int32_t pdcch_est_size = fp->symbols_per_slot*(fp->ofdm_symbol_size+LTE_CE_FILTER_LENGTH); - int32_t pdcch_dl_ch_estimates[4*fp->nb_antennas_rx][pdcch_est_size]; + int32_t pdcch_est_size = ((((fp->symbols_per_slot*(fp->ofdm_symbol_size+LTE_CE_FILTER_LENGTH))+15)/16)*16); + __attribute__ ((aligned(16))) int32_t pdcch_dl_ch_estimates[4*fp->nb_antennas_rx][pdcch_est_size]; dci_cnt = 0; for(int n_ss = 0; n_ssnb_search_space; n_ss++) { From 2e99d33f2701282393a73aea547f894ef9d1633b Mon Sep 17 00:00:00 2001 From: Mario Hudon Date: Mon, 4 Apr 2022 15:41:36 -0400 Subject: [PATCH 6/6] Fixed compile warning --- openair1/PHY/INIT/nr_init_ue.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/openair1/PHY/INIT/nr_init_ue.c b/openair1/PHY/INIT/nr_init_ue.c index b8b89209a1..2c4835136c 100644 --- a/openair1/PHY/INIT/nr_init_ue.c +++ b/openair1/PHY/INIT/nr_init_ue.c @@ -159,7 +159,7 @@ int init_nr_ue_signal(PHY_VARS_NR_UE *ue, int nb_connected_gNB) NR_UE_COMMON *const common_vars = &ue->common_vars; NR_UE_PBCH **const pbch_vars = ue->pbch_vars; NR_UE_PRACH **const prach_vars = ue->prach_vars; - int i,j,slot,symb, gNB_id, th_id; + int i,slot,symb, gNB_id, th_id; NR_UE_SRS **const srs_vars = ue->srs_vars;