From d196529cf815eb1e6b68c99b8c44ec5b3163906a Mon Sep 17 00:00:00 2001 From: Sagar Parsawar Date: Wed, 16 Mar 2022 17:24:14 +0100 Subject: [PATCH] OAI UE: PRS mutliple gNB fixes --- openair1/PHY/INIT/nr_init_ue.c | 4 +-- .../nr_dl_channel_estimation.c | 6 ++-- openair1/PHY/defs_nr_UE.h | 1 + openair1/PHY/defs_nr_common.h | 32 +++++++++---------- openair2/NR_UE_PHY_INTERFACE/NR_IF_Module.c | 2 +- 5 files changed, 23 insertions(+), 22 deletions(-) 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..ff64530b52 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 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/openair2/NR_UE_PHY_INTERFACE/NR_IF_Module.c b/openair2/NR_UE_PHY_INTERFACE/NR_IF_Module.c index 2be3a2537e..dea0cdaa10 100644 --- a/openair2/NR_UE_PHY_INTERFACE/NR_IF_Module.c +++ b/openair2/NR_UE_PHY_INTERFACE/NR_IF_Module.c @@ -1313,7 +1313,7 @@ void RCconfig_nrUE_prs(void *cfg) ue->prs_vars[gNB_id]->prs_cfg.NPRSID = *(PRS_ParamList.paramarray[j][PRS_ID].uptr); 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]);