OAI UE: Added prs measurements in structure
This commit is contained in:
@@ -332,12 +332,16 @@ int init_nr_ue_signal(PHY_VARS_NR_UE *ue,
|
||||
// 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_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++) {
|
||||
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);
|
||||
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
|
||||
|
||||
@@ -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;
|
||||
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_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_chestT = ue->prs_vars[gNB_id]->prs_ch_estimates_time;
|
||||
|
||||
@@ -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));
|
||||
AssertFatal(((ch_freq != NULL) || (ch_time != NULL)), "nr_prs_channel_estimation: channel estimate buffer initialization failed!!");
|
||||
int16_t *ch_init = ch_freq;
|
||||
|
||||
int32_t tdoa[NR_MAX_NUM_PRS_SYMB] = {0};
|
||||
int32_t ch_pwr[NR_MAX_NUM_PRS_SYMB] = {0};
|
||||
int32_t ch_pwr= 0;
|
||||
#ifdef DEBUG_PRS_CHEST
|
||||
char filename[128] = {0}, varname[128] = {0};
|
||||
#endif
|
||||
@@ -409,13 +408,23 @@ int nr_prs_channel_estimation(uint8_t gNB_id,
|
||||
// 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 + (frame_params->ofdm_symbol_size>>1)], &ch_time[0], (frame_params->ofdm_symbol_size>>1)*sizeof(int32_t));
|
||||
|
||||
|
||||
// peak estimator
|
||||
peak_estimator(&prs_chestT[rxAnt][l*frame_params->ofdm_symbol_size],
|
||||
frame_params->ofdm_symbol_size,
|
||||
&tdoa[l],
|
||||
&ch_pwr[l]);
|
||||
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]));
|
||||
&prs_meas[rxAnt][l].dl_toa,
|
||||
&ch_pwr);
|
||||
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 l
|
||||
|
||||
@@ -436,6 +445,10 @@ int nr_prs_channel_estimation(uint8_t gNB_id,
|
||||
#endif
|
||||
|
||||
// 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_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)));
|
||||
|
||||
@@ -387,7 +387,8 @@ typedef struct {
|
||||
prs_data_t prs_cfg;
|
||||
int32_t **prs_ch_estimates;
|
||||
int32_t **prs_ch_estimates_time;
|
||||
int64_t reserved;
|
||||
int32_t reserved;
|
||||
prs_meas_t **prs_meas;
|
||||
} NR_UE_PRS;
|
||||
|
||||
#define NR_PDCCH_DEFS_NR_UE
|
||||
@@ -831,9 +832,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;
|
||||
uint16_t prs_active_gNBs;
|
||||
uint8_t prs_start_symb;
|
||||
uint8_t prs_end_symb;
|
||||
|
||||
//Paging parameters
|
||||
uint32_t IMSImod1024;
|
||||
|
||||
@@ -377,21 +377,34 @@ struct NR_DL_FRAME_PARMS {
|
||||
// PRS structures prototype
|
||||
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.
|
||||
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;
|
||||
uint8_t MutingBitRepetition;
|
||||
uint16_t NPRSID;
|
||||
} 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 MHz (1000*KHz)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user