Commit 4e869190 authored by Sagar Parsawar's avatar Sagar Parsawar

gNB & nrUE: Added multiple PRS resources scheduling

parent 8b9c76be
......@@ -328,20 +328,22 @@ int init_nr_ue_signal(PHY_VARS_NR_UE *ue,
for(int idx = 0; idx < NR_MAX_PRS_COMB_SIZE; idx++)
{
prs_vars[idx] = (NR_UE_PRS *)malloc16_clear(sizeof(NR_UE_PRS));
for(int k = 0; k < NR_MAX_PRS_RESOURCES_PER_SET; k++)
{
// PRS channel estimates
prs_vars[idx]->prs_resource[k].prs_ch_estimates = (int32_t **)malloc16_clear( fp->nb_antennas_rx*sizeof(int32_t *) );
prs_vars[idx]->prs_resource[k].prs_ch_estimates_time = (int32_t **)malloc16_clear( fp->nb_antennas_rx*sizeof(int32_t *) );
AssertFatal(((prs_vars[idx]->prs_resource[k].prs_ch_estimates!=NULL) || (prs_vars[idx]->prs_resource[k].prs_ch_estimates_time!=NULL)), "NR UE init: PRS channel estimates malloc failed for gNB_id %d\n", idx);
prs_vars[idx]->prs_resource[k].prs_meas = (prs_meas_t **)malloc16_clear( fp->nb_antennas_rx*sizeof(prs_meas_t *) );
AssertFatal((prs_vars[idx]->prs_resource[k].prs_meas!=NULL), "NR UE init: PRS measurements malloc failed for gNB_id %d\n", idx);
// 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 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 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);
for (i=0; i<fp->nb_antennas_rx; i++) {
prs_vars[idx]->prs_resource[k].prs_ch_estimates[i] = (int32_t *)malloc16_clear(fp->ofdm_symbol_size*NR_SYMBOLS_PER_SLOT*sizeof(int32_t));
prs_vars[idx]->prs_resource[k].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_resource[k].prs_ch_estimates[i]!=NULL) || (prs_vars[idx]->prs_resource[k].prs_ch_estimates_time[i]!=NULL)), "NR UE init: PRS channel estimates malloc failed for rx_ant %d\n", i);
prs_vars[idx]->prs_resource[k].prs_meas[i] = (prs_meas_t *)malloc16_clear(NR_SYMBOLS_PER_SLOT*sizeof(prs_meas_t) );
AssertFatal((prs_vars[idx]->prs_resource[k].prs_meas[i]!=NULL), "NR UE init: PRS measurements malloc failed for rx_ant %d\n", i);
}
}
}
// DLSCH
......
......@@ -50,16 +50,17 @@ static inline int abs32(int x)
}
int nr_prs_channel_estimation(uint8_t gNB_id,
uint8_t rsc_id,
PHY_VARS_NR_UE *ue,
UE_nr_rxtx_proc_t *proc,
NR_DL_FRAME_PARMS *frame_params)
{
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;
prs_data_t *prs_cfg = &ue->prs_vars[gNB_id]->prs_resource[rsc_id].prs_cfg;
prs_meas_t **prs_meas = ue->prs_vars[gNB_id]->prs_resource[rsc_id].prs_meas;
int32_t **prs_chestF = ue->prs_vars[gNB_id]->prs_resource[rsc_id].prs_ch_estimates;
int32_t **prs_chestT = ue->prs_vars[gNB_id]->prs_resource[rsc_id].prs_ch_estimates_time;
uint8_t rxAnt = 0, idx = prs_cfg->NPRSID;
int16_t *rxF, *pil, *fl, *fm, *fmm, *fml, *fmr, *fr, mod_prs[NR_MAX_PRS_LENGTH<<1];
......@@ -92,7 +93,7 @@ int nr_prs_channel_estimation(uint8_t gNB_id,
}
#ifdef DEBUG_PRS_PRINTS
printf("[gNB %d] PRS config l %d k_prime %d:\nprs_cfg->SymbolStart %d\nprs_cfg->NumPRSSymbols %d\nprs_cfg->NumRB %d\nprs_cfg->CombSize %d\n", gNB_id, l, k_prime, prs_cfg->SymbolStart, prs_cfg->NumPRSSymbols, prs_cfg->NumRB, prs_cfg->CombSize);
printf("[gNB %d][rsc %d] PRS config l %d k_prime %d:\nprs_cfg->SymbolStart %d\nprs_cfg->NumPRSSymbols %d\nprs_cfg->NumRB %d\nprs_cfg->CombSize %d\n", gNB_id, rsc_id, l, k_prime, prs_cfg->SymbolStart, prs_cfg->NumPRSSymbols, prs_cfg->NumRB, prs_cfg->CombSize);
#endif
// Pilots generation and modulation
for (int m = 0; m < num_pilots; m++)
......@@ -483,11 +484,10 @@ int nr_prs_channel_estimation(uint8_t gNB_id,
frame_params->ofdm_symbol_size,
&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));
LOG_I(PHY, "[gNB %d][rsc %d][Rx %d][sfn %d][slot %d] ToA for PRS symbol %2d ==> %d / %d samples, peak channel power %.1f dB\n", gNB_id, rsc_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 = gNB_id;
prs_meas[rxAnt][l].timestamp = 0; //TODO
prs_meas[rxAnt][l].sfn = proc->frame_rx;
prs_meas[rxAnt][l].slot = proc->nr_slot_rx;
prs_meas[rxAnt][l].rxAnt_idx = rxAnt;
......
......@@ -34,6 +34,7 @@
/* A function to perform the channel estimation of DL PRS signal */
int nr_prs_channel_estimation(uint8_t gNB_id,
uint8_t rsc_id,
PHY_VARS_NR_UE *ue,
UE_nr_rxtx_proc_t *proc,
NR_DL_FRAME_PARMS *frame_params);
......
......@@ -227,6 +227,11 @@ typedef struct {
gNB_PRACH_list_t list[NUMBER_OF_NR_PRACH_MAX];
} NR_gNB_PRACH;
typedef struct {
uint8_t NumPRSResources;
prs_data_t prs_cfg[NR_MAX_PRS_RESOURCES_PER_SET];
} NR_gNB_PRS;
typedef struct {
/// Nfapi ULSCH PDU
nfapi_nr_pusch_pdu_t ulsch_pdu;
......@@ -757,6 +762,7 @@ typedef struct PHY_VARS_gNB_s {
nr_cce_t cce_list[MAX_DCI_CORESET][NR_MAX_PDCCH_AGG_LEVEL];
NR_gNB_COMMON common_vars;
NR_gNB_PRACH prach_vars;
NR_gNB_PRS prs_vars;
NR_gNB_PUSCH *pusch_vars[NUMBER_OF_NR_ULSCH_MAX];
NR_gNB_PUCCH_t *pucch[NUMBER_OF_NR_PUCCH_MAX];
NR_gNB_PDCCH_t pdcch_pdu[NUMBER_OF_NR_PDCCH_MAX];
......@@ -771,7 +777,6 @@ typedef struct PHY_VARS_gNB_s {
NR_gNB_SCH_STATS_t ulsch_stats[NUMBER_OF_NR_SCH_STATS_MAX];
NR_gNB_UCI_STATS_t uci_stats[NUMBER_OF_NR_UCI_STATS_MAX];
t_nrPolar_params *uci_polarParams;
prs_data_t prs_cfg;
uint8_t pbch_configured;
char gNB_generate_rar;
......
......@@ -389,6 +389,11 @@ typedef struct {
int32_t **prs_ch_estimates_time;
int32_t reserved;
prs_meas_t **prs_meas;
} NR_PRS_RESOURCE_t;
typedef struct {
uint8_t NumPRSResources;
NR_PRS_RESOURCE_t prs_resource[NR_MAX_PRS_RESOURCES_PER_SET];
} NR_UE_PRS;
#define NR_PDCCH_DEFS_NR_UE
......@@ -832,7 +837,7 @@ 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_active_gNBs;
uint8_t prs_start_symb;
uint8_t prs_end_symb;
......
......@@ -84,6 +84,8 @@
#define NR_MAX_PRS_INIT_LENGTH_DWORD 102 // ceil(NR_MAX_CSI_RS_LENGTH/32)
#define NR_MAX_NUM_PRS_SYMB 12
#define NR_MAX_PRS_COMB_SIZE 12
#define NR_MAX_PRS_RESOURCES_PER_SET 64
#define NR_MAX_PRS_MUTING_PATTERN_LENGTH 32
#define NR_MAX_PUSCH_DMRS_LENGTH NR_MAX_PDSCH_DMRS_LENGTH
#define NR_MAX_PUSCH_DMRS_INIT_LENGTH_DWORD NR_MAX_PDSCH_DMRS_INIT_LENGTH_DWORD
......@@ -376,28 +378,26 @@ 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.
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
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[32]; // Muting bit pattern option-1, specified as [] or a binary-valued vector of length 2, 4, 6, 8, 16, or 32
uint32_t MutingPattern2[32]; // Muting bit pattern option-2, specified as [] or a binary-valued vector of length 2, 4, 6, 8, 16, or 32
uint8_t MutingBitRepetition; // Muting bit repetition factor, specified as 1, 2, 4, or 8
uint16_t NPRSID; // Sequence identity of each PRS resource specified as a scalar or a vector of integers in the range [0, 4095]
} prs_data_t;
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;
......
......@@ -67,6 +67,21 @@ void nr_set_ssb_first_subcarrier(nfapi_nr_config_request_scf_t *cfg, NR_DL_FRAME
LOG_D(PHY, "SSB first subcarrier %d (%d,%d)\n", fp->ssb_start_subcarrier,cfg->ssb_table.ssb_offset_point_a.value,sco);
}
uint8_t check_prs_slot_gNB(uint8_t *prs_rsc_id, NR_gNB_PRS *prs_vars, int nr_slot_tx)
{
uint8_t is_prs_slot = 0, rsc_id = 0;
for(rsc_id = 0; rsc_id < prs_vars->NumPRSResources; rsc_id++)
{
if((prs_vars->prs_cfg[rsc_id].PRSResourceSetPeriod[1] + prs_vars->prs_cfg[rsc_id].PRSResourceOffset) == nr_slot_tx)
{
is_prs_slot = 1;
*prs_rsc_id = rsc_id;
break;
}
}
return is_prs_slot;
}
void nr_common_signal_procedures (PHY_VARS_gNB *gNB,int frame,int slot,nfapi_nr_dl_tti_ssb_pdu ssb_pdu) {
NR_DL_FRAME_PARMS *fp=&gNB->frame_parms;
......@@ -100,23 +115,6 @@ void nr_common_signal_procedures (PHY_VARS_gNB *gNB,int frame,int slot,nfapi_nr_
else
nr_generate_pbch_dmrs(gNB->nr_gold_pbch_dmrs[0][ssb_index&7],&txdataF[0][txdataF_offset], AMP, ssb_start_symbol, cfg, fp);
/*
prs_data_t prs_data;
prs_data.PRSResourceSetPeriod[0]=40; // PRS resource slot period
prs_data.PRSResourceSetPeriod[1]=0; // resource slot offset
prs_data.SymbolStart=7;
prs_data.NumPRSSymbols=4;
prs_data.NumRB=fp->N_RB_DL;
prs_data.RBOffset=0;
prs_data.CombSize=4;
prs_data.REOffset=0;
prs_data.PRSResourceOffset=0;
prs_data.PRSResourceRepetition=1;
prs_data.PRSResourceTimeGap=1;
prs_data.NPRSID=0;
*/
nr_generate_prs(gNB->nr_gold_prs[slot],&txdataF[0][txdataF_offset], AMP, &gNB->prs_cfg, cfg, fp);
if (T_ACTIVE(T_GNB_PHY_MIB)) {
unsigned char bch[3];
......@@ -156,6 +154,7 @@ void phy_procedures_gNB_TX(processingData_L1tx_t *msgTx,
nfapi_nr_config_request_scf_t *cfg = &gNB->gNB_config;
int offset = gNB->CC_id;
int txdataF_offset = (slot%2)*fp->samples_per_slot_wCP;
uint8_t rsc_id = 0, is_prs_slot = 0;
if ((cfg->cell_config.frame_duplex_type.value == TDD) &&
(nr_slot_select(cfg,frame,slot) == NR_UPLINK_SLOT)) return;
......@@ -170,6 +169,14 @@ void phy_procedures_gNB_TX(processingData_L1tx_t *msgTx,
memset(&gNB->common_vars.beam_id[aa][slot*fp->symbols_per_slot],255,fp->symbols_per_slot*sizeof(uint8_t));
}
// Check for PRS slot
is_prs_slot = check_prs_slot_gNB(&rsc_id, &gNB->prs_vars, slot);
if(is_prs_slot)
{
LOG_I(PHY,"gNB_TX: frame %d, slot %d, slots_per_frame %d, PRS Resource ID %d\n",frame,slot, fp->slots_per_frame, rsc_id);
nr_generate_prs(gNB->nr_gold_prs[slot],&gNB->common_vars.txdataF[0][txdataF_offset], AMP, &gNB->prs_vars.prs_cfg[rsc_id], cfg, fp);
}
VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_PHY_PROCEDURES_gNB_COMMON_TX,1);
for (int i=0; i<fp->Lmax; i++) {
if (msgTx->ssb[i].active) {
......
......@@ -54,5 +54,6 @@ void nr_fep_full(RU_t *ru, int slot);
void nr_fep_full_2thread(RU_t *ru, int slot);
void feptx_prec(RU_t *ru,int frame_tx,int tti_tx);
int nr_phy_init_RU(RU_t *ru);
uint8_t check_prs_slot_gNB(uint8_t *prs_rsc_id, NR_gNB_PRS *prs_vars, int nr_slot_tx);
#endif
......@@ -388,6 +388,7 @@ int get_tx_harq_id(NR_UE_ULSCH_t *ulsch, int slot_tx);
int is_pbch_in_slot(fapi_nr_config_request_t *config, int frame, int slot, NR_DL_FRAME_PARMS *fp);
int is_ssb_in_slot(fapi_nr_config_request_t *config, int frame, int slot, NR_DL_FRAME_PARMS *fp);
uint8_t check_prs_slot_nrUE(PHY_VARS_NR_UE *ue, uint8_t *prs_gNB_id, uint8_t *prs_rsc_id, int nr_slot_rx);
/*! \brief This function prepares the dl indication to pass to the MAC
@param
......
......@@ -1581,6 +1581,24 @@ int is_pbch_in_slot(fapi_nr_config_request_t *config, int frame, int slot, NR_DL
}
}
uint8_t check_prs_slot_nrUE(PHY_VARS_NR_UE *ue, uint8_t *prs_gNB_id, uint8_t *prs_rsc_id, int nr_slot_rx)
{
uint8_t is_prs_slot = 0, rsc_id = 0, gNB_id = 0;
for(gNB_id = 0; gNB_id < ue->prs_active_gNBs; gNB_id++)
{
for(rsc_id = 0; rsc_id < ue->prs_vars[gNB_id]->NumPRSResources; rsc_id++)
{
if((ue->prs_vars[gNB_id]->prs_resource[rsc_id].prs_cfg.PRSResourceSetPeriod[1] + ue->prs_vars[gNB_id]->prs_resource[rsc_id].prs_cfg.PRSResourceOffset) == nr_slot_rx)
{
is_prs_slot = 1;
*prs_rsc_id = rsc_id;
*prs_gNB_id = gNB_id;
return is_prs_slot;
}
}
}
return is_prs_slot;
}
int phy_procedures_nrUE_RX(PHY_VARS_NR_UE *ue,
UE_nr_rxtx_proc_t *proc,
......@@ -1595,6 +1613,7 @@ int phy_procedures_nrUE_RX(PHY_VARS_NR_UE *ue,
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 rsc_id = 0, is_prs_slot = 0, prs_gNB_id = 0;
uint8_t nb_symb_pdcch = pdcch_vars->nb_search_space > 0 ? pdcch_vars->pdcch_config[0].coreset.duration : 0;
uint8_t dci_cnt = 0;
......@@ -1659,21 +1678,12 @@ int phy_procedures_nrUE_RX(PHY_VARS_NR_UE *ue,
nr_ue_rrc_measurements(ue, proc, nr_slot_rx);
VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_UE_SLOT_FEP_PBCH, VCD_FUNCTION_OUT);
}
}
/*
ue->prs_vars[gNB_id]->prs_cfg.PRSResourceSetPeriod[0]=40; // PRS resource slot period
ue->prs_vars[gNB_id]->prs_cfg.PRSResourceSetPeriod[1]=0; // resource slot offset
ue->prs_vars[gNB_id]->prs_cfg.SymbolStart=7;
ue->prs_vars[gNB_id]->prs_cfg.NumPRSSymbols=4;
ue->prs_vars[gNB_id]->prs_cfg.NumRB=fp->N_RB_DL;
ue->prs_vars[gNB_id]->prs_cfg.RBOffset=0;
ue->prs_vars[gNB_id]->prs_cfg.CombSize=4;
ue->prs_vars[gNB_id]->prs_cfg.REOffset=0;
ue->prs_vars[gNB_id]->prs_cfg.PRSResourceOffset=0;
ue->prs_vars[gNB_id]->prs_cfg.PRSResourceRepetition=1;
ue->prs_vars[gNB_id]->prs_cfg.PRSResourceTimeGap=1;
ue->prs_vars[gNB_id]->prs_cfg.NPRSID=0;
*/
// Check for PRS slot
is_prs_slot = check_prs_slot_nrUE(ue, &prs_gNB_id, &rsc_id, nr_slot_rx);
if (is_prs_slot)
{
for(int j = ue->prs_start_symb; j < ue->prs_end_symb; j++)
{
nr_slot_fep(ue,
......@@ -1683,8 +1693,10 @@ int phy_procedures_nrUE_RX(PHY_VARS_NR_UE *ue,
}
//PRS channel estimation
for(int gIdx = 0; gIdx < ue->prs_active_gNBs; gIdx++)
nr_prs_channel_estimation(gIdx,ue,proc,fp);
//for(int gIdx = 0; gIdx < ue->prs_active_gNBs; gIdx++)
{
nr_prs_channel_estimation(prs_gNB_id,rsc_id,ue,proc,fp);
}
}
if ((frame_rx%64 == 0) && (nr_slot_rx==0)) {
......
......@@ -605,7 +605,7 @@ void RCconfig_nr_flexran()
void RCconfig_nr_prs(void)
{
uint16_t j;
uint16_t j = 0, k = 0;
paramdef_t PRS_Params[] = PRS_PARAMS_DESC;
paramlist_def_t PRS_ParamList = {CONFIG_STRING_PRS_CONFIG,NULL,0};
......@@ -619,7 +619,6 @@ void RCconfig_nr_prs(void)
config_getlist( &PRS_ParamList,PRS_Params,sizeof(PRS_Params)/sizeof(paramdef_t), NULL);
if (PRS_ParamList.numelt > 0) {
for (j = 0; j < RC.nb_nr_L1_inst; j++) {
if (RC.gNB[j] == NULL) {
......@@ -629,35 +628,72 @@ void RCconfig_nr_prs(void)
RC.gNB[j]->Mod_id = j;
}
RC.gNB[j]->prs_cfg.PRSResourceSetPeriod[0] = *(PRS_ParamList.paramarray[j][PRS_RESOURCE_SET_PERIOD0].uptr);
RC.gNB[j]->prs_cfg.PRSResourceSetPeriod[1] = *(PRS_ParamList.paramarray[j][PRS_RESOURCE_SET_PERIOD1].uptr);
RC.gNB[j]->prs_cfg.SymbolStart = *(PRS_ParamList.paramarray[j][PRS_SYMBOL_START].uptr);
RC.gNB[j]->prs_cfg.NumPRSSymbols = *(PRS_ParamList.paramarray[j][PRS_NUM_SYMBOLS].uptr);
RC.gNB[j]->prs_cfg.NumRB = *(PRS_ParamList.paramarray[j][PRS_NUM_RB].uptr);
RC.gNB[j]->prs_cfg.RBOffset = *(PRS_ParamList.paramarray[j][PRS_RB_OFFSET].uptr);
RC.gNB[j]->prs_cfg.CombSize = *(PRS_ParamList.paramarray[j][PRS_COMB_SIZE].uptr);
RC.gNB[j]->prs_cfg.REOffset = *(PRS_ParamList.paramarray[j][PRS_RE_OFFSET].uptr);
RC.gNB[j]->prs_cfg.PRSResourceOffset = *(PRS_ParamList.paramarray[j][PRS_RESOURCE_OFFSET].uptr);
RC.gNB[j]->prs_cfg.PRSResourceRepetition = *(PRS_ParamList.paramarray[j][PRS_RESOURCE_REPETITION].uptr);
RC.gNB[j]->prs_cfg.PRSResourceTimeGap = *(PRS_ParamList.paramarray[j][PRS_RESOURCE_TIME_GAP].uptr);
RC.gNB[j]->prs_cfg.NPRSID = *(PRS_ParamList.paramarray[j][PRS_ID].uptr);
LOG_I(PHY, "--------------------------\n");
LOG_I(PHY, "PRS Config for gNB_ID %d\n", j);
LOG_I(PHY, "--------------------------\n");
LOG_I(PHY, "PRSResourceSetPeriod0 %d\n", RC.gNB[j]->prs_cfg.PRSResourceSetPeriod[0]);
LOG_I(PHY, "PRSResourceSetPeriod1 %d\n", RC.gNB[j]->prs_cfg.PRSResourceSetPeriod[1]);
LOG_I(PHY, "SymbolStart %d\n", RC.gNB[j]->prs_cfg.SymbolStart);
LOG_I(PHY, "NumPRSSymbols %d\n", RC.gNB[j]->prs_cfg.NumPRSSymbols);
LOG_I(PHY, "NumRB %d\n", RC.gNB[j]->prs_cfg.NumRB);
LOG_I(PHY, "RBOffset %d\n", RC.gNB[j]->prs_cfg.RBOffset);
LOG_I(PHY, "CombSize %d\n", RC.gNB[j]->prs_cfg.CombSize);
LOG_I(PHY, "REOffset %d\n", RC.gNB[j]->prs_cfg.REOffset);
LOG_I(PHY, "PRSResourceOffset %d\n", RC.gNB[j]->prs_cfg.PRSResourceOffset);
LOG_I(PHY, "PRSResourceRepetition %d\n", RC.gNB[j]->prs_cfg.PRSResourceRepetition);
LOG_I(PHY, "PRSResourceTimeGap %d\n", RC.gNB[j]->prs_cfg.PRSResourceTimeGap);
LOG_I(PHY, "NPRS_ID %d\n", RC.gNB[j]->prs_cfg.NPRSID);
LOG_I(PHY, "--------------------------\n");
RC.gNB[j]->prs_vars.NumPRSResources = *(PRS_ParamList.paramarray[j][NUM_PRS_RESOURCES].uptr);
for (k = 0; k < RC.gNB[j]->prs_vars.NumPRSResources; k++)
{
RC.gNB[j]->prs_vars.prs_cfg[k].PRSResourceSetPeriod[0] = PRS_ParamList.paramarray[j][PRS_RESOURCE_SET_PERIOD_LIST].uptr[0];
RC.gNB[j]->prs_vars.prs_cfg[k].PRSResourceSetPeriod[1] = PRS_ParamList.paramarray[j][PRS_RESOURCE_SET_PERIOD_LIST].uptr[1];
// per PRS resources parameters
RC.gNB[j]->prs_vars.prs_cfg[k].SymbolStart = PRS_ParamList.paramarray[j][PRS_SYMBOL_START_LIST].uptr[k];
RC.gNB[j]->prs_vars.prs_cfg[k].NumPRSSymbols = PRS_ParamList.paramarray[j][PRS_NUM_SYMBOLS_LIST].uptr[k];
RC.gNB[j]->prs_vars.prs_cfg[k].REOffset = PRS_ParamList.paramarray[j][PRS_RE_OFFSET_LIST].uptr[k];
RC.gNB[j]->prs_vars.prs_cfg[k].PRSResourceOffset = PRS_ParamList.paramarray[j][PRS_RESOURCE_OFFSET_LIST].uptr[k];
RC.gNB[j]->prs_vars.prs_cfg[k].NPRSID = PRS_ParamList.paramarray[j][PRS_ID_LIST].uptr[k];
// Common parameters to all PRS resources
RC.gNB[j]->prs_vars.prs_cfg[k].NumRB = *(PRS_ParamList.paramarray[j][PRS_NUM_RB].uptr);
RC.gNB[j]->prs_vars.prs_cfg[k].RBOffset = *(PRS_ParamList.paramarray[j][PRS_RB_OFFSET].uptr);
RC.gNB[j]->prs_vars.prs_cfg[k].CombSize = *(PRS_ParamList.paramarray[j][PRS_COMB_SIZE].uptr);
RC.gNB[j]->prs_vars.prs_cfg[k].PRSResourceRepetition = *(PRS_ParamList.paramarray[j][PRS_RESOURCE_REPETITION].uptr);
RC.gNB[j]->prs_vars.prs_cfg[k].PRSResourceTimeGap = *(PRS_ParamList.paramarray[j][PRS_RESOURCE_TIME_GAP].uptr);
RC.gNB[j]->prs_vars.prs_cfg[k].MutingBitRepetition = *(PRS_ParamList.paramarray[j][PRS_MUTING_BIT_REPETITION].uptr);
for (int l = 0; l < PRS_ParamList.paramarray[j][PRS_MUTING_PATTERN1_LIST].numelt; l++)
RC.gNB[j]->prs_vars.prs_cfg[k].MutingPattern1[l] = PRS_ParamList.paramarray[j][PRS_MUTING_PATTERN1_LIST].uptr[l];
for (int l = 0; l < PRS_ParamList.paramarray[j][PRS_MUTING_PATTERN2_LIST].numelt; l++)
RC.gNB[j]->prs_vars.prs_cfg[k].MutingPattern2[l] = PRS_ParamList.paramarray[j][PRS_MUTING_PATTERN2_LIST].uptr[l];
} // for k
k = 0;
LOG_I(PHY, "-----------------------------------------\n");
LOG_I(PHY, "PRS Config for gNB_id %d @ %p\n", j, &RC.gNB[j]->prs_vars.prs_cfg[k]);
LOG_I(PHY, "-----------------------------------------\n");
LOG_I(PHY, "NumPRSResources \t%d\n", RC.gNB[j]->prs_vars.NumPRSResources);
LOG_I(PHY, "PRSResourceSetPeriod \t[%d, %d]\n", RC.gNB[j]->prs_vars.prs_cfg[k].PRSResourceSetPeriod[0], RC.gNB[j]->prs_vars.prs_cfg[k].PRSResourceSetPeriod[1]);
LOG_I(PHY, "NumRB \t\t\t%d\n", RC.gNB[j]->prs_vars.prs_cfg[k].NumRB);
LOG_I(PHY, "RBOffset \t\t%d\n", RC.gNB[j]->prs_vars.prs_cfg[k].RBOffset);
LOG_I(PHY, "CombSize \t\t%d\n", RC.gNB[j]->prs_vars.prs_cfg[k].CombSize);
LOG_I(PHY, "PRSResourceRepetition \t%d\n", RC.gNB[j]->prs_vars.prs_cfg[k].PRSResourceRepetition);
LOG_I(PHY, "PRSResourceTimeGap \t%d\n", RC.gNB[j]->prs_vars.prs_cfg[k].PRSResourceTimeGap);
LOG_I(PHY, "MutingBitRepetition \t%d\n", RC.gNB[j]->prs_vars.prs_cfg[k].MutingBitRepetition);
LOG_I(PHY, "SymbolStart \t\t[");
for (k = 0; k < RC.gNB[j]->prs_vars.NumPRSResources; k++)
printf("%d, ", RC.gNB[j]->prs_vars.prs_cfg[k].SymbolStart);
printf("\b\b]\n");
LOG_I(PHY, "NumPRSSymbols \t\t[");
for (k = 0; k < RC.gNB[j]->prs_vars.NumPRSResources; k++)
printf("%d, ", RC.gNB[j]->prs_vars.prs_cfg[k].NumPRSSymbols);
printf("\b\b]\n");
LOG_I(PHY, "REOffset \t\t[");
for (k = 0; k < RC.gNB[j]->prs_vars.NumPRSResources; k++)
printf("%d, ", RC.gNB[j]->prs_vars.prs_cfg[k].REOffset);
printf("\b\b]\n");
LOG_I(PHY, "PRSResourceOffset \t[");
for (k = 0; k < RC.gNB[j]->prs_vars.NumPRSResources; k++)
printf("%d, ", RC.gNB[j]->prs_vars.prs_cfg[k].PRSResourceOffset);
printf("\b\b]\n");
LOG_I(PHY, "NPRS_ID \t\t[");
for (k = 0; k < RC.gNB[j]->prs_vars.NumPRSResources; k++)
printf("%d, ", RC.gNB[j]->prs_vars.prs_cfg[k].NPRSID);
printf("\b\b]\n");
LOG_I(PHY, "MutingPattern1 \t\t[");
for (int l = 0, k = 0; l < PRS_ParamList.paramarray[j][PRS_MUTING_PATTERN1_LIST].numelt; l++)
printf("%d, ", RC.gNB[j]->prs_vars.prs_cfg[k].MutingPattern1[l]);
printf("\b\b]\n");
LOG_I(PHY, "MutingPattern2 \t\t[");
for (int l = 0, k = 0; l < PRS_ParamList.paramarray[j][PRS_MUTING_PATTERN2_LIST].numelt; l++)
printf("%d, ", RC.gNB[j]->prs_vars.prs_cfg[k].MutingPattern2[l]);
printf("\b\b]\n");
LOG_I(PHY, "-----------------------------------------\n");
} // for j
}
else
......
......@@ -38,6 +38,7 @@
/* PRS configuration section names */
#define CONFIG_STRING_PRS_LIST "PRSs"
#define CONFIG_STRING_PRS_CONFIG "prs_config"
#define CONFIG_STRING_MQTT_CONFIG "mqtt_config"
/* Global parameters */
......@@ -55,18 +56,21 @@
/* PRS configuration parameters names */
#define CONFIG_STRING_GNB_ID "gNB_id"
#define CONFIG_STRING_PRS_RESOURCE_SET_PERIOD0 "PRSResourceSetPeriod0"
#define CONFIG_STRING_PRS_RESOURCE_SET_PERIOD1 "PRSResourceSetPeriod1"
#define CONFIG_STRING_PRS_SYMBOL_START "SymbolStart"
#define CONFIG_STRING_PRS_NUM_SYMBOLS "NumPRSSymbols"
#define CONFIG_STRING_NUM_PRS_RESOURCES "NumPRSResources"
#define CONFIG_STRING_PRS_RESOURCE_SET_PERIOD_LIST "PRSResourceSetPeriod"
#define CONFIG_STRING_PRS_SYMBOL_START_LIST "SymbolStart"
#define CONFIG_STRING_PRS_NUM_SYMBOLS_LIST "NumPRSSymbols"
#define CONFIG_STRING_PRS_NUM_RB "NumRB"
#define CONFIG_STRING_PRS_RB_OFFSET "RBOffset"
#define CONFIG_STRING_PRS_COMB_SIZE "CombSize"
#define CONFIG_STRING_PRS_RE_OFFSET "REOffset"
#define CONFIG_STRING_PRS_RESOURCE_OFFSET "PRSResourceOffset"
#define CONFIG_STRING_PRS_RE_OFFSET_LIST "REOffset"
#define CONFIG_STRING_PRS_RESOURCE_OFFSET_LIST "PRSResourceOffset"
#define CONFIG_STRING_PRS_RESOURCE_REPETITION "PRSResourceRepetition"
#define CONFIG_STRING_PRS_RESOURCE_TIME_GAP "PRSResourceTimeGap"
#define CONFIG_STRING_PRS_ID "NPRS_ID"
#define CONFIG_STRING_PRS_ID_LIST "NPRS_ID"
#define CONFIG_STRING_PRS_MUTING_PATTERN1_LIST "MutingPattern1"
#define CONFIG_STRING_PRS_MUTING_PATTERN2_LIST "MutingPattern2"
#define CONFIG_STRING_PRS_MUTING_BIT_REPETITION "MutingBitRepetition"
/*----------------------------------------------------------------------------------------------------------------------------------------------------*/
......@@ -74,34 +78,40 @@
/* optname helpstr paramflags XXXptr defXXXval type numelt */
/*----------------------------------------------------------------------------------------------------------------------------------------------------*/
#define PRS_PARAMS_DESC { \
{CONFIG_STRING_GNB_ID, NULL, 0, uptr:NULL, defuintval:0, TYPE_UINT, 0}, \
{CONFIG_STRING_PRS_RESOURCE_SET_PERIOD0, NULL, 0, uptr:NULL, defuintval:0, TYPE_UINT, 0}, \
{CONFIG_STRING_PRS_RESOURCE_SET_PERIOD1, NULL, 0, uptr:NULL, defuintval:0, TYPE_UINT, 0}, \
{CONFIG_STRING_PRS_SYMBOL_START, NULL, 0, uptr:NULL, defuintval:0, TYPE_UINT, 0}, \
{CONFIG_STRING_PRS_NUM_SYMBOLS, NULL, 0, uptr:NULL, defuintval:0, TYPE_UINT, 0}, \
{CONFIG_STRING_PRS_NUM_RB, NULL, 0, uptr:NULL, defuintval:0, TYPE_UINT, 0}, \
{CONFIG_STRING_PRS_RB_OFFSET, NULL, 0, uptr:NULL, defuintval:0, TYPE_UINT, 0}, \
{CONFIG_STRING_PRS_COMB_SIZE, NULL, 0, uptr:NULL, defuintval:0, TYPE_UINT, 0}, \
{CONFIG_STRING_PRS_RE_OFFSET, NULL, 0, uptr:NULL, defuintval:0, TYPE_UINT, 0}, \
{CONFIG_STRING_PRS_RESOURCE_OFFSET, NULL, 0, uptr:NULL, defuintval:0, TYPE_UINT, 0}, \
{CONFIG_STRING_PRS_RESOURCE_REPETITION, NULL, 0, uptr:NULL, defuintval:0, TYPE_UINT, 0}, \
{CONFIG_STRING_PRS_RESOURCE_TIME_GAP, NULL, 0, uptr:NULL, defuintval:0, TYPE_UINT, 0}, \
{CONFIG_STRING_PRS_ID, NULL, 0, uptr:NULL, defuintval:0, TYPE_UINT, 0} \
{CONFIG_STRING_GNB_ID, NULL, 0, uptr:NULL, defuintval:0, TYPE_UINT, 0}, \
{CONFIG_STRING_NUM_PRS_RESOURCES, NULL, 0, uptr:NULL, defuintval:0, TYPE_UINT, 0}, \
{CONFIG_STRING_PRS_RESOURCE_SET_PERIOD_LIST, NULL, 0, uptr:NULL, defintarrayval:0, TYPE_UINTARRAY, 0}, \
{CONFIG_STRING_PRS_SYMBOL_START_LIST, NULL, 0, uptr:NULL, defintarrayval:0, TYPE_UINTARRAY, 0}, \
{CONFIG_STRING_PRS_NUM_SYMBOLS_LIST, NULL, 0, uptr:NULL, defintarrayval:0, TYPE_UINTARRAY, 0}, \
{CONFIG_STRING_PRS_NUM_RB, NULL, 0, uptr:NULL, defuintval:0, TYPE_UINT, 0}, \
{CONFIG_STRING_PRS_RB_OFFSET, NULL, 0, uptr:NULL, defuintval:0, TYPE_UINT, 0}, \
{CONFIG_STRING_PRS_COMB_SIZE, NULL, 0, uptr:NULL, defuintval:0, TYPE_UINT, 0}, \
{CONFIG_STRING_PRS_RE_OFFSET_LIST, NULL, 0, uptr:NULL, defintarrayval:0, TYPE_UINTARRAY, 0}, \
{CONFIG_STRING_PRS_RESOURCE_OFFSET_LIST, NULL, 0, uptr:NULL, defintarrayval:0, TYPE_UINTARRAY, 0}, \
{CONFIG_STRING_PRS_RESOURCE_REPETITION, NULL, 0, uptr:NULL, defuintval:0, TYPE_UINT, 0}, \
{CONFIG_STRING_PRS_RESOURCE_TIME_GAP, NULL, 0, uptr:NULL, defuintval:0, TYPE_UINT, 0}, \
{CONFIG_STRING_PRS_ID_LIST, NULL, 0, uptr:NULL, defintarrayval:0, TYPE_UINTARRAY, 0}, \
{CONFIG_STRING_PRS_MUTING_PATTERN1_LIST, NULL, 0, uptr:NULL, defintarrayval:0, TYPE_UINTARRAY, 0}, \
{CONFIG_STRING_PRS_MUTING_PATTERN2_LIST, NULL, 0, uptr:NULL, defintarrayval:0, TYPE_UINTARRAY, 0}, \
{CONFIG_STRING_PRS_MUTING_BIT_REPETITION, NULL, 0, uptr:NULL, defuintval:0, TYPE_UINT, 0} \
}
#define PRS_GNB_ID 0
#define PRS_RESOURCE_SET_PERIOD0 1
#define PRS_RESOURCE_SET_PERIOD1 2
#define PRS_SYMBOL_START 3
#define PRS_NUM_SYMBOLS 4
#define NUM_PRS_RESOURCES 1
#define PRS_RESOURCE_SET_PERIOD_LIST 2
#define PRS_SYMBOL_START_LIST 3
#define PRS_NUM_SYMBOLS_LIST 4
#define PRS_NUM_RB 5
#define PRS_RB_OFFSET 6
#define PRS_COMB_SIZE 7
#define PRS_RE_OFFSET 8
#define PRS_RESOURCE_OFFSET 9
#define PRS_RE_OFFSET_LIST 8
#define PRS_RESOURCE_OFFSET_LIST 9
#define PRS_RESOURCE_REPETITION 10
#define PRS_RESOURCE_TIME_GAP 11
#define PRS_ID 12
#define PRS_ID_LIST 12
#define PRS_MUTING_PATTERN1_LIST 13
#define PRS_MUTING_PATTERN2_LIST 14
#define PRS_MUTING_BIT_REPETITION 15
/*----------------------------------------------------------------------------------------------------------------------------------------------------*/
#endif
This diff is collapsed.
......@@ -217,18 +217,21 @@ MACRLCs = (
prs_config = (
{
PRSResourceSetPeriod0 = 40;
PRSResourceSetPeriod1 = 0;
SymbolStart = 7;
NumPRSSymbols = 4;
NumRB = 106;
RBOffset = 0;
CombSize = 4;
REOffset = 0;
PRSResourceOffset = 0;
PRSResourceRepetition = 1;
PRSResourceTimeGap = 1;
NPRS_ID = 0;
NumPRSResources = 2;
PRSResourceSetPeriod = [20, 5];
SymbolStart = [7, 8];
NumPRSSymbols = [5, 5];
NumRB = 106;
RBOffset = 0;
CombSize = 4;
REOffset = [0, 1];
PRSResourceOffset = [0, 1];
PRSResourceRepetition = 1;
PRSResourceTimeGap = 1;
NPRS_ID = [0, 5];
MutingPattern1 = [];
MutingPattern2 = [];
MutingBitRepetition = 1;
}
);
......
PRSs =
(
{
Active_gNBs = 2;
Active_gNBs = 1;
prs_config0 = (
{
gNB_id = 0;
PRSResourceSetPeriod0 = 40;
PRSResourceSetPeriod1 = 0;
SymbolStart = 7;
NumPRSSymbols = 4;
NumPRSResources = 2;
PRSResourceSetPeriod = [20, 5];
SymbolStart = [7, 8];
NumPRSSymbols = [5, 5];
NumRB = 106;
RBOffset = 0;
CombSize = 4;
REOffset = 0;
PRSResourceOffset = 0;
REOffset = [0, 1];
PRSResourceOffset = [0, 1];
PRSResourceRepetition = 1;
PRSResourceTimeGap = 1;
NPRS_ID = 0;
NPRS_ID = [0, 5];
MutingPattern1 = [];
MutingPattern2 = [];
MutingBitRepetition = 1;
}
);
......@@ -35,6 +38,9 @@ PRSs =
PRSResourceRepetition = 1;
PRSResourceTimeGap = 1;
NPRS_ID = 0;
MutingPattern1 = [0];
MutingPattern2 = [0];
MutingBitRepetition = 1;
}
);
}
......
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