diff --git a/openair1/PHY/INIT/nr_init_ue.c b/openair1/PHY/INIT/nr_init_ue.c index f55d18661f..6ab53be0c9 100644 --- a/openair1/PHY/INIT/nr_init_ue.c +++ b/openair1/PHY/INIT/nr_init_ue.c @@ -335,8 +335,8 @@ int init_nr_ue_signal(PHY_VARS_NR_UE *ue, AssertFatal(((prs_vars[idx]->prs_ch_estimates!=NULL) || (prs_vars[idx]->prs_ch_estimates_time!=NULL)), "NR UE init: PRS channel estimates malloc failed\n"); for (i=0; inb_antennas_rx; i++) { - prs_vars[idx]->prs_ch_estimates[i] = (int32_t *)malloc16_clear(fp->ofdm_symbol_size*NR_MAX_NUM_PRS_SYMB*sizeof(int32_t)); - prs_vars[idx]->prs_ch_estimates_time[i] = (int32_t *)malloc16_clear(fp->ofdm_symbol_size*NR_MAX_NUM_PRS_SYMB*sizeof(int32_t)); + prs_vars[idx]->prs_ch_estimates[i] = (int32_t *)malloc16_clear(fp->ofdm_symbol_size*NR_SYMBOLS_PER_SLOT*sizeof(int32_t)); + prs_vars[idx]->prs_ch_estimates_time[i] = (int32_t *)malloc16_clear(fp->ofdm_symbol_size*NR_SYMBOLS_PER_SLOT*sizeof(int32_t)); AssertFatal(((prs_vars[idx]->prs_ch_estimates[i]!=NULL) || (prs_vars[idx]->prs_ch_estimates_time[i]!=NULL)), "NR UE init: PRS channel estimates malloc failed %d\n", i); } } 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 508a7f22de..a2d571bf3a 100644 --- a/openair1/PHY/NR_UE_ESTIMATION/nr_dl_channel_estimation.c +++ b/openair1/PHY/NR_UE_ESTIMATION/nr_dl_channel_estimation.c @@ -36,7 +36,7 @@ //#define DEBUG_PDCCH //#define DEBUG_CH //#define DEBUG_PRS_CHEST -#define DEBUG_PRS_PRINTS +//#define DEBUG_PRS_PRINTS extern short nr_qpsk_mod_table[8]; int nr_prs_channel_estimation(uint8_t gNB_id, @@ -436,11 +436,11 @@ int nr_prs_channel_estimation(uint8_t gNB_id, #endif // T tracer dump - T(T_UE_PHY_DL_CHANNEL_ESTIMATE_FREQ, T_INT(0), + T(T_UE_PHY_DL_CHANNEL_ESTIMATE_FREQ, T_INT(gNB_id), T_INT(proc->frame_rx), T_INT(proc->nr_slot_rx), T_INT(rxAnt), T_BUFFER(&prs_chestF[rxAnt][prs_cfg->SymbolStart*frame_params->ofdm_symbol_size], prs_cfg->NumPRSSymbols*frame_params->ofdm_symbol_size*sizeof(int32_t))); - T(T_UE_PHY_DL_CHANNEL_ESTIMATE, T_INT(0), + T(T_UE_PHY_DL_CHANNEL_ESTIMATE, T_INT(gNB_id), T_INT(proc->frame_rx), T_INT(proc->nr_slot_rx), T_INT(rxAnt), T_BUFFER(&prs_chestT[rxAnt][prs_cfg->SymbolStart*frame_params->ofdm_symbol_size], prs_cfg->NumPRSSymbols*frame_params->ofdm_symbol_size*sizeof(int32_t))); diff --git a/openair1/PHY/defs_nr_UE.h b/openair1/PHY/defs_nr_UE.h index c3777a4f54..3acad7f96f 100644 --- a/openair1/PHY/defs_nr_UE.h +++ b/openair1/PHY/defs_nr_UE.h @@ -387,6 +387,7 @@ typedef struct { prs_data_t prs_cfg; int32_t **prs_ch_estimates; int32_t **prs_ch_estimates_time; + int64_t reserved; } NR_UE_PRS; #define NR_PDCCH_DEFS_NR_UE @@ -830,6 +831,9 @@ typedef struct { NR_UE_DLSCH_t *dlsch_p[NUMBER_OF_CONNECTED_gNB_MAX]; NR_UE_DLSCH_t *dlsch_MCH[NUMBER_OF_CONNECTED_gNB_MAX]; NR_UE_PRS *prs_vars[NR_MAX_PRS_COMB_SIZE]; + uint16_t prs_active_gNBs; + uint8_t prs_start_symb; + uint8_t prs_end_symb; //Paging parameters uint32_t IMSImod1024; diff --git a/openair1/PHY/defs_nr_common.h b/openair1/PHY/defs_nr_common.h index cfcd88258e..aba8f93ba1 100644 --- a/openair1/PHY/defs_nr_common.h +++ b/openair1/PHY/defs_nr_common.h @@ -375,22 +375,22 @@ struct NR_DL_FRAME_PARMS { }; // PRS structures prototype -typedef struct prs { - int PRSResourceSetPeriod[2]; //[slot period, slot offset] - int PRSResourceOffset; // array if more than one resource sets.slot offset (0...511) (default 0) - int PRSResourceRepetition;// slot offset (1 (default), 2, 4, 6, 8, 16, 32) - int PRSResourceTimeGap; // slot offset (1 (default), 2, 4, 6, 8, 16, 32) - int NumRB; //number of RBs in freq domain a scalar =< 275 RB - int NumPRSSymbols; //number of PRS symbols in time domain - int SymbolStart; //starting OFDM symbol of PRS resource in time domain - int RBOffset; //Starting PRB index of all PRS resources in a PRS resource set. - int CombSize; //RE density of all PRS resources in a PRS resource set. i∈{2,4,6,12} - int REOffset; //Starting RE offset in the first OFDM symbol of each PRS resource in a PRS resource set. - int MutingPattern1[2]; //Muting bit pattern option-1, specified as [] or a binary-valued vector of length 2, 4, 6, 8, 16, or 32. - int MutingPattern2[2]; - int MutingBitRepetition; - int NPRSID; -} prs_data_t; +typedef struct { + uint16_t PRSResourceSetPeriod[2]; //[slot period, slot offset] + uint8_t PRSResourceOffset; // array if more than one resource sets.slot offset (0...511) (default 0) + uint8_t PRSResourceRepetition;// slot offset (1 (default), 2, 4, 6, 8, 16, 32) + uint8_t PRSResourceTimeGap; // slot offset (1 (default), 2, 4, 6, 8, 16, 32) + uint8_t NumRB; //number of RBs in freq domain a scalar =< 275 RB + uint8_t NumPRSSymbols; //number of PRS symbols in time domain + uint8_t SymbolStart; //starting OFDM symbol of PRS resource in time domain + uint8_t RBOffset; //Starting PRB index of all PRS resources in a PRS resource set. + uint8_t CombSize; //RE density of all PRS resources in a PRS resource set. i∈{2,4,6,12} + uint8_t REOffset; //Starting RE offset in the first OFDM symbol of each PRS resource in a PRS resource set. + uint32_t MutingPattern1[2]; //Muting bit pattern option-1, specified as [] or a binary-valued vector of length 2, 4, 6, 8, 16, or 32. + uint32_t MutingPattern2[2]; + uint8_t MutingBitRepetition; + uint16_t NPRSID; +} prs_data_t; //32bytes #define KHz (1000UL) #define MHz (1000*KHz) diff --git a/openair1/SCHED_NR_UE/phy_procedures_nr_ue.c b/openair1/SCHED_NR_UE/phy_procedures_nr_ue.c index bfcf1a5954..6114d30652 100644 --- a/openair1/SCHED_NR_UE/phy_procedures_nr_ue.c +++ b/openair1/SCHED_NR_UE/phy_procedures_nr_ue.c @@ -1674,7 +1674,7 @@ int phy_procedures_nrUE_RX(PHY_VARS_NR_UE *ue, ue->prs_vars[gNB_id]->prs_cfg.PRSResourceTimeGap=1; ue->prs_vars[gNB_id]->prs_cfg.NPRSID=0; */ - for(int j = ue->prs_vars[gNB_id]->prs_cfg.SymbolStart; j < (ue->prs_vars[gNB_id]->prs_cfg.SymbolStart + ue->prs_vars[gNB_id]->prs_cfg.NumPRSSymbols); j++) + for(int j = ue->prs_start_symb; j < ue->prs_end_symb; j++) { nr_slot_fep(ue, proc, @@ -1683,7 +1683,8 @@ int phy_procedures_nrUE_RX(PHY_VARS_NR_UE *ue, } //PRS channel estimation - nr_prs_channel_estimation(gNB_id,ue,proc,fp); + for(int gIdx = 0; gIdx < ue->prs_active_gNBs; gIdx++) + nr_prs_channel_estimation(gIdx,ue,proc,fp); } if ((frame_rx%64 == 0) && (nr_slot_rx==0)) { diff --git a/openair2/NR_UE_PHY_INTERFACE/NR_IF_Module.c b/openair2/NR_UE_PHY_INTERFACE/NR_IF_Module.c index 2be3a2537e..e7b6d4e514 100644 --- a/openair2/NR_UE_PHY_INTERFACE/NR_IF_Module.c +++ b/openair2/NR_UE_PHY_INTERFACE/NR_IF_Module.c @@ -1278,17 +1278,17 @@ void RCconfig_nr_ue_L1(void) { void RCconfig_nrUE_prs(void *cfg) { - int j = 0, gNB_id = 0; + int j = 0, gNB_id = 0, prs_start = 0, prs_end = 0; char aprefix[MAX_OPTNAME_SIZE*2 + 8]; PHY_VARS_NR_UE *ue = (PHY_VARS_NR_UE *)cfg; paramlist_def_t gParamList = {CONFIG_STRING_PRS_LIST,NULL,0}; paramdef_t gParams[] = PRS_GLOBAL_PARAMS_DESC; config_getlist( &gParamList,gParams,sizeof(gParams)/sizeof(paramdef_t), NULL); - int num_gnbs = *(gParamList.paramarray[j][PRS_ACTIVE_GNBS_IDX].uptr); + ue->prs_active_gNBs = *(gParamList.paramarray[j][PRS_ACTIVE_GNBS_IDX].uptr); paramlist_def_t PRS_ParamList = {{0},NULL,0}; - for(int i = 0; i < num_gnbs; i++) + for(int i = 0; i < ue->prs_active_gNBs; i++) { paramdef_t PRS_Params[] = PRS_PARAMS_DESC; sprintf(PRS_ParamList.listname, "%s%i", CONFIG_STRING_PRS_CONFIG, i); @@ -1311,9 +1311,18 @@ void RCconfig_nrUE_prs(void *cfg) ue->prs_vars[gNB_id]->prs_cfg.PRSResourceRepetition = *(PRS_ParamList.paramarray[j][PRS_RESOURCE_REPETITION].uptr); ue->prs_vars[gNB_id]->prs_cfg.PRSResourceTimeGap = *(PRS_ParamList.paramarray[j][PRS_RESOURCE_TIME_GAP].uptr); ue->prs_vars[gNB_id]->prs_cfg.NPRSID = *(PRS_ParamList.paramarray[j][PRS_ID].uptr); - + if(gNB_id==0) + { + prs_start = ue->prs_vars[gNB_id]->prs_cfg.SymbolStart; + prs_end = ue->prs_vars[gNB_id]->prs_cfg.SymbolStart+ue->prs_vars[gNB_id]->prs_cfg.NumPRSSymbols; + } + else + { + prs_start = MIN((prs_start), (ue->prs_vars[gNB_id]->prs_cfg.SymbolStart)); + prs_end = MAX((prs_end), (ue->prs_vars[gNB_id]->prs_cfg.SymbolStart+ue->prs_vars[gNB_id]->prs_cfg.NumPRSSymbols)); + } LOG_I(PHY, "--------------------------\n"); - LOG_I(PHY, "PRS Config for gNB_id %d\n", gNB_id); + LOG_I(PHY, "PRS Config for gNB_id %d @ %p\n", gNB_id, &ue->prs_vars[gNB_id]->prs_cfg); LOG_I(PHY, "--------------------------\n"); LOG_I(PHY, "PRSResourceSetPeriod0 %d\n", ue->prs_vars[gNB_id]->prs_cfg.PRSResourceSetPeriod[0]); LOG_I(PHY, "PRSResourceSetPeriod1 %d\n", ue->prs_vars[gNB_id]->prs_cfg.PRSResourceSetPeriod[1]); @@ -1335,4 +1344,7 @@ void RCconfig_nrUE_prs(void *cfg) LOG_I(NR_PHY,"No %s configuration found\n", PRS_ParamList.listname); } } + ue->prs_start_symb = prs_start; + ue->prs_end_symb = prs_end; + LOG_I(PHY, "prs_active_gNBs %d, prs_start_symb %d, prs_end_symb %d\n", ue->prs_active_gNBs, ue->prs_start_symb, ue->prs_end_symb); }