Commit 828387c5 authored by Sagar Parsawar's avatar Sagar Parsawar Committed by Eurecom

OAI UE: Added prs measurements in structure

parent 1d920ee1
...@@ -332,12 +332,16 @@ int init_nr_ue_signal(PHY_VARS_NR_UE *ue, ...@@ -332,12 +332,16 @@ int init_nr_ue_signal(PHY_VARS_NR_UE *ue,
// PRS channel estimates // PRS channel estimates
prs_vars[idx]->prs_ch_estimates = (int32_t **)malloc16_clear( fp->nb_antennas_rx*sizeof(int32_t *) ); prs_vars[idx]->prs_ch_estimates = (int32_t **)malloc16_clear( fp->nb_antennas_rx*sizeof(int32_t *) );
prs_vars[idx]->prs_ch_estimates_time = (int32_t **)malloc16_clear( fp->nb_antennas_rx*sizeof(int32_t *) ); prs_vars[idx]->prs_ch_estimates_time = (int32_t **)malloc16_clear( fp->nb_antennas_rx*sizeof(int32_t *) );
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"); AssertFatal(((prs_vars[idx]->prs_ch_estimates!=NULL) || (prs_vars[idx]->prs_ch_estimates_time!=NULL)), "NR UE init: PRS channel estimates malloc failed for gNB_id %d\n", idx);
prs_vars[idx]->prs_meas = (prs_meas_t **)malloc16_clear( fp->nb_antennas_rx*sizeof(prs_meas_t *) );
AssertFatal((prs_vars[idx]->prs_meas!=NULL), "NR UE init: PRS measurements malloc failed for gNB_id %d\n", idx);
for (i=0; i<fp->nb_antennas_rx; i++) { for (i=0; i<fp->nb_antennas_rx; i++) {
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[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)); 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); 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 for rx_ant %d\n", i);
prs_vars[idx]->prs_meas[i] = (prs_meas_t *)malloc16_clear(NR_SYMBOLS_PER_SLOT*sizeof(prs_meas_t) );
AssertFatal((prs_vars[idx]->prs_meas[i]!=NULL), "NR UE init: PRS measurements malloc failed for rx_ant %d\n", i);
} }
} }
// DLSCH // DLSCH
......
...@@ -54,6 +54,7 @@ int nr_prs_channel_estimation(uint8_t gNB_id, ...@@ -54,6 +54,7 @@ int nr_prs_channel_estimation(uint8_t gNB_id,
int32_t **rxdataF = ue->common_vars.common_vars_rx_data_per_thread[proc->thread_id].rxdataF; int32_t **rxdataF = ue->common_vars.common_vars_rx_data_per_thread[proc->thread_id].rxdataF;
uint32_t **nr_gold_prs = ue->nr_gold_prs[proc->nr_slot_rx]; uint32_t **nr_gold_prs = ue->nr_gold_prs[proc->nr_slot_rx];
prs_data_t *prs_cfg = &ue->prs_vars[gNB_id]->prs_cfg; prs_data_t *prs_cfg = &ue->prs_vars[gNB_id]->prs_cfg;
prs_meas_t **prs_meas = ue->prs_vars[gNB_id]->prs_meas;
int32_t **prs_chestF = ue->prs_vars[gNB_id]->prs_ch_estimates; int32_t **prs_chestF = ue->prs_vars[gNB_id]->prs_ch_estimates;
int32_t **prs_chestT = ue->prs_vars[gNB_id]->prs_ch_estimates_time; int32_t **prs_chestT = ue->prs_vars[gNB_id]->prs_ch_estimates_time;
...@@ -64,9 +65,7 @@ int nr_prs_channel_estimation(uint8_t gNB_id, ...@@ -64,9 +65,7 @@ int nr_prs_channel_estimation(uint8_t gNB_id,
int32_t *ch_time = (int32_t *)malloc16_clear(frame_params->ofdm_symbol_size*sizeof(int32_t)); int32_t *ch_time = (int32_t *)malloc16_clear(frame_params->ofdm_symbol_size*sizeof(int32_t));
AssertFatal(((ch_freq != NULL) || (ch_time != NULL)), "nr_prs_channel_estimation: channel estimate buffer initialization failed!!"); AssertFatal(((ch_freq != NULL) || (ch_time != NULL)), "nr_prs_channel_estimation: channel estimate buffer initialization failed!!");
int16_t *ch_init = ch_freq; int16_t *ch_init = ch_freq;
int32_t ch_pwr= 0;
int32_t tdoa[NR_MAX_NUM_PRS_SYMB] = {0};
int32_t ch_pwr[NR_MAX_NUM_PRS_SYMB] = {0};
#ifdef DEBUG_PRS_CHEST #ifdef DEBUG_PRS_CHEST
char filename[128] = {0}, varname[128] = {0}; char filename[128] = {0}, varname[128] = {0};
#endif #endif
...@@ -409,13 +408,23 @@ int nr_prs_channel_estimation(uint8_t gNB_id, ...@@ -409,13 +408,23 @@ int nr_prs_channel_estimation(uint8_t gNB_id,
// rearrange impulse response // rearrange impulse response
memcpy((int16_t *)&prs_chestT[rxAnt][l*frame_params->ofdm_symbol_size], &ch_time[frame_params->ofdm_symbol_size>>1], (frame_params->ofdm_symbol_size>>1)*sizeof(int32_t)); memcpy((int16_t *)&prs_chestT[rxAnt][l*frame_params->ofdm_symbol_size], &ch_time[frame_params->ofdm_symbol_size>>1], (frame_params->ofdm_symbol_size>>1)*sizeof(int32_t));
memcpy((int16_t *)&prs_chestT[rxAnt][l*frame_params->ofdm_symbol_size + (frame_params->ofdm_symbol_size>>1)], &ch_time[0], (frame_params->ofdm_symbol_size>>1)*sizeof(int32_t)); memcpy((int16_t *)&prs_chestT[rxAnt][l*frame_params->ofdm_symbol_size + (frame_params->ofdm_symbol_size>>1)], &ch_time[0], (frame_params->ofdm_symbol_size>>1)*sizeof(int32_t));
// peak estimator // peak estimator
peak_estimator(&prs_chestT[rxAnt][l*frame_params->ofdm_symbol_size], peak_estimator(&prs_chestT[rxAnt][l*frame_params->ofdm_symbol_size],
frame_params->ofdm_symbol_size, frame_params->ofdm_symbol_size,
&tdoa[l], &prs_meas[rxAnt][l].dl_toa,
&ch_pwr[l]); &ch_pwr);
LOG_I(PHY, "[gNB %d][Rx %d] TDoA for PRS symbol %2d ==> %d / %d samples, peak channel power %.1f dB\n", gNB_id, rxAnt, l, tdoa[l]-(frame_params->ofdm_symbol_size>>1), frame_params->ofdm_symbol_size, 10*log10(ch_pwr[l])); LOG_I(PHY, "[gNB %d][Rx %d][sfn %d][slot %d] ToA for PRS symbol %2d ==> %d / %d samples, peak channel power %.1f dB\n", gNB_id, rxAnt, proc->frame_rx, proc->nr_slot_rx, l, prs_meas[rxAnt][l].dl_toa-(frame_params->ofdm_symbol_size>>1), frame_params->ofdm_symbol_size, 10*log10(ch_pwr));
//prs measurements
prs_meas[rxAnt][l].gNB_id = 0;
prs_meas[rxAnt][l].timestamp = 0;
prs_meas[rxAnt][l].sfn = proc->frame_rx;
prs_meas[rxAnt][l].slot = proc->nr_slot_rx;
prs_meas[rxAnt][l].symbol = l;
prs_meas[rxAnt][l].rxAnt_idx = rxAnt;
prs_meas[rxAnt][l].snr = 0;
prs_meas[rxAnt][l].dl_aoa = 0;
} // for rxAnt } // for rxAnt
} //for l } //for l
...@@ -436,6 +445,10 @@ int nr_prs_channel_estimation(uint8_t gNB_id, ...@@ -436,6 +445,10 @@ int nr_prs_channel_estimation(uint8_t gNB_id,
#endif #endif
// T tracer dump // T tracer dump
T(T_UE_PHY_INPUT_SIGNAL, T_INT(gNB_id),
T_INT(proc->frame_rx), T_INT(proc->nr_slot_rx),
T_INT(rxAnt), T_BUFFER(&rxdataF[rxAnt][0], frame_params->samples_per_slot_wCP*sizeof(int32_t)));
T(T_UE_PHY_DL_CHANNEL_ESTIMATE_FREQ, T_INT(gNB_id), 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(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_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)));
......
...@@ -387,7 +387,8 @@ typedef struct { ...@@ -387,7 +387,8 @@ typedef struct {
prs_data_t prs_cfg; prs_data_t prs_cfg;
int32_t **prs_ch_estimates; int32_t **prs_ch_estimates;
int32_t **prs_ch_estimates_time; int32_t **prs_ch_estimates_time;
int64_t reserved; int32_t reserved;
prs_meas_t **prs_meas;
} NR_UE_PRS; } NR_UE_PRS;
#define NR_PDCCH_DEFS_NR_UE #define NR_PDCCH_DEFS_NR_UE
...@@ -831,9 +832,9 @@ typedef struct { ...@@ -831,9 +832,9 @@ typedef struct {
NR_UE_DLSCH_t *dlsch_p[NUMBER_OF_CONNECTED_gNB_MAX]; NR_UE_DLSCH_t *dlsch_p[NUMBER_OF_CONNECTED_gNB_MAX];
NR_UE_DLSCH_t *dlsch_MCH[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]; NR_UE_PRS *prs_vars[NR_MAX_PRS_COMB_SIZE];
uint16_t prs_active_gNBs; uint16_t prs_active_gNBs;
uint8_t prs_start_symb; uint8_t prs_start_symb;
uint8_t prs_end_symb; uint8_t prs_end_symb;
//Paging parameters //Paging parameters
uint32_t IMSImod1024; uint32_t IMSImod1024;
......
...@@ -377,21 +377,34 @@ struct NR_DL_FRAME_PARMS { ...@@ -377,21 +377,34 @@ struct NR_DL_FRAME_PARMS {
// PRS structures prototype // PRS structures prototype
typedef struct { typedef struct {
uint16_t PRSResourceSetPeriod[2]; //[slot period, slot offset] 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 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 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 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 NumRB; //number of RBs in freq domain a scalar =< 275 RB
uint8_t NumPRSSymbols; //number of PRS symbols in time domain uint8_t NumPRSSymbols; //number of PRS symbols in time domain
uint8_t SymbolStart; //starting OFDM symbol of PRS resource 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 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 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. 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 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]; uint32_t MutingPattern2[2];
uint8_t MutingBitRepetition; uint8_t MutingBitRepetition;
uint16_t NPRSID; uint16_t NPRSID;
} prs_data_t; //32bytes } prs_data_t; //32bytes
typedef struct {
int8_t gNB_id;
int32_t timestamp;
int32_t sfn;
int8_t slot;
int8_t symbol;
int8_t rxAnt_idx;
int32_t dl_toa;
int32_t dl_aoa;
int32_t snr;
int32_t reserved;
} prs_meas_t;
#define KHz (1000UL) #define KHz (1000UL)
#define MHz (1000*KHz) #define MHz (1000*KHz)
......
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