Commit a292f1a2 authored by Sagar Parsawar's avatar Sagar Parsawar

Changes in prs config parsing function, added help string

parent 7bc69f50
This diff is collapsed.
......@@ -136,7 +136,7 @@ void nr_init_prs(PHY_VARS_gNB* gNB)
for (rsc_id = 0; rsc_id < gNB->prs_vars.NumPRSResources; rsc_id++) {
Nid = gNB->prs_vars.prs_cfg[rsc_id].NPRSID; // seed value
LOG_I(PHY, "Initiaized NR-PRS sequence with PRS_ID %d\n", Nid);
LOG_I(PHY, "Initiaized NR-PRS sequence with PRS_ID %3d for resource %d\n", Nid, rsc_id);
for (slotNum = 0; slotNum < fp->slots_per_frame; slotNum++) {
for (symNum = 0; symNum < fp->symbols_per_slot ; symNum++) {
reset = 1;
......
......@@ -137,7 +137,7 @@ void init_nr_gold_prs(PHY_VARS_NR_UE* ue)
for(gnb = 0; gnb < ue->prs_active_gNBs; gnb++) {
for(rsc = 0; rsc < ue->prs_vars[gnb]->NumPRSResources; rsc++) {
Nid = ue->prs_vars[gnb]->prs_resource[rsc].prs_cfg.NPRSID; // seed value
LOG_I(PHY,"Initialised NR-PRS sequence with PRS_ID %d\n",Nid);
LOG_I(PHY,"Initialised NR-PRS sequence with PRS_ID %3d for resource %d\n",Nid, rsc);
for (slotNum = 0; slotNum < fp->slots_per_frame; slotNum++) {
for (symNum = 0; symNum < fp->symbols_per_slot ; symNum++) {
reset = 1;
......
......@@ -12,7 +12,7 @@ extern short nr_qpsk_mod_table[8];
int nr_generate_prs(uint32_t **nr_gold_prs,
int32_t *txdataF,
int16_t amp,
prs_data_t *prs_data,
prs_config_t *prs_cfg,
nfapi_nr_config_request_scf_t *config,
NR_DL_FRAME_PARMS *frame_parms)
{
......@@ -23,26 +23,26 @@ int nr_generate_prs(uint32_t **nr_gold_prs,
// PRS resource mapping with combsize=k which means PRS symbols exist in every k-th subcarrier in frequency domain
// According to ts138.211 sec.7.4.1.7.2
for (int l = prs_data->SymbolStart; l < prs_data->SymbolStart + prs_data->NumPRSSymbols; l++) {
for (int l = prs_cfg->SymbolStart; l < prs_cfg->SymbolStart + prs_cfg->NumPRSSymbols; l++) {
int symInd = l-prs_data->SymbolStart;
if (prs_data->CombSize == 2) {
int symInd = l-prs_cfg->SymbolStart;
if (prs_cfg->CombSize == 2) {
k_prime = k_prime_table[0][symInd];
}
else if (prs_data->CombSize == 4){
else if (prs_cfg->CombSize == 4){
k_prime = k_prime_table[1][symInd];
}
else if (prs_data->CombSize == 6){
else if (prs_cfg->CombSize == 6){
k_prime = k_prime_table[2][symInd];
}
else if (prs_data->CombSize == 12){
else if (prs_cfg->CombSize == 12){
k_prime = k_prime_table[3][symInd];
}
k = (prs_data->REOffset+k_prime) % prs_data->CombSize + prs_data->RBOffset*12 + frame_parms->first_carrier_offset;
k = (prs_cfg->REOffset+k_prime) % prs_cfg->CombSize + prs_cfg->RBOffset*12 + frame_parms->first_carrier_offset;
// QPSK modulation
for (int m = 0; m < (12/prs_data->CombSize) * prs_data->NumRB; m++) {
for (int m = 0; m < (12/prs_cfg->CombSize) * prs_cfg->NumRB; m++) {
idx = (((nr_gold_prs[l][(m<<1)>>5])>>((m<<1)&0x1f))&3);
mod_prs[m<<1] = nr_qpsk_mod_table[idx<<1];
mod_prs[(m<<1)+1] = nr_qpsk_mod_table[(idx<<1) + 1];
......@@ -64,14 +64,14 @@ int nr_generate_prs(uint32_t **nr_gold_prs,
((int16_t *)txdataF)[((l*frame_parms->ofdm_symbol_size + k)<<1)+1]);
#endif
k = k + prs_data->CombSize;
k = k + prs_cfg->CombSize;
if (k >= frame_parms->ofdm_symbol_size)
k-=frame_parms->ofdm_symbol_size;
}
}
#ifdef DEBUG_PRS_MAP
LOG_M("nr_prs.m", "prs",(int16_t *)&txdataF[prs_data->SymbolStart*frame_parms->ofdm_symbol_size],prs_data->NumPRSSymbols*frame_parms->ofdm_symbol_size, 1, 1);
LOG_M("nr_prs.m", "prs",(int16_t *)&txdataF[prs_cfg->SymbolStart*frame_parms->ofdm_symbol_size],prs_cfg->NumPRSSymbols*frame_parms->ofdm_symbol_size, 1, 1);
#endif
return 0;
}
......@@ -42,7 +42,7 @@
int nr_generate_prs(uint32_t **nr_gold_prs,
int32_t *txdataF,
int16_t amp,
prs_data_t *prs_data,
prs_config_t *prs_cfg,
nfapi_nr_config_request_scf_t *config,
NR_DL_FRAME_PARMS *frame_parms);
......
......@@ -53,7 +53,7 @@ int nr_prs_channel_estimation(uint8_t gNB_id,
NR_DL_FRAME_PARMS *frame_params)
{
int32_t **rxdataF = ue->common_vars.common_vars_rx_data_per_thread[proc->thread_id].rxdataF;
prs_data_t *prs_cfg = &ue->prs_vars[gNB_id]->prs_resource[rsc_id].prs_cfg;
prs_config_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;
......
......@@ -226,7 +226,7 @@ typedef struct {
typedef struct {
uint8_t NumPRSResources;
prs_data_t prs_cfg[NR_MAX_PRS_RESOURCES_PER_SET];
prs_config_t prs_cfg[NR_MAX_PRS_RESOURCES_PER_SET];
} NR_gNB_PRS;
typedef struct {
......
......@@ -348,7 +348,7 @@ typedef struct {
#define NR_PRS_IDFT_OVERSAMP_FACTOR 1 // IDFT oversampling factor for NR PRS channel estimates in time domain, ALLOWED value 16x, and 1x is default(ie. IDFT size is frame_params->ofdm_symbol_size)
typedef struct {
prs_data_t prs_cfg;
prs_config_t prs_cfg;
int32_t **prs_ch_estimates;
int32_t **prs_ch_estimates_time;
int32_t reserved;
......
......@@ -389,23 +389,23 @@ struct NR_DL_FRAME_PARMS {
uint32_t ofdm_offset_divisor;
};
// PRS structures prototype
// PRS config structures
typedef struct {
uint16_t PRSResourceSetPeriod[2]; // [slot period, slot offset]
uint16_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)
uint16_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
uint16_t PRSResourceSetPeriod[2]; // [slot period, slot offset] of a PRS resource set
uint16_t PRSResourceOffset; // Slot offset of each PRS resource defined relative to the slot offset of the PRS resource set (0...511)
uint8_t PRSResourceRepetition; // Repetition factor for all PRS resources in resource set (1 /*default*/, 2, 4, 6, 8, 16, 32)
uint8_t PRSResourceTimeGap; // Slot offset between two consecutive repetition indices of all PRS resources in a PRS resource set (1 /*default*/, 2, 4, 6, 8, 16, 32)
uint16_t NumRB; // Number of PRBs allocated to all PRS resources in a PRS resource set (<= 272 and multiples of 4)
uint8_t NumPRSSymbols; // Number of OFDM symbols in a slot allocated to each PRS resource in a PRS resource set
uint8_t SymbolStart; // Starting OFDM symbol of each PRS resource in a PRS resource set
uint16_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 (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;
uint16_t NPRSID; // Sequence identity of each PRS resource in a PRS resource set, specified in the range [0, 4095]
} prs_config_t;
typedef struct {
int8_t gNB_id;
......
......@@ -674,10 +674,11 @@ void RCconfig_nr_flexran()
void RCconfig_nr_prs(void)
{
uint16_t j = 0, k = 0;
prs_config_t *prs_config = NULL;
char str[7][100] = {'\0'}; int16_t n[7] = {0};
paramdef_t PRS_Params[] = PRS_PARAMS_DESC;
paramlist_def_t PRS_ParamList = {CONFIG_STRING_PRS_CONFIG,NULL,0};
if (RC.gNB == NULL) {
RC.gNB = (PHY_VARS_gNB **)malloc((1+NUMBER_OF_gNB_MAX)*sizeof(PHY_VARS_gNB*));
LOG_I(NR_PHY,"RC.gNB = %p\n",RC.gNB);
......@@ -696,77 +697,72 @@ void RCconfig_nr_prs(void)
RC.gNB[j]->Mod_id = j;
}
memset(n,0,sizeof(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];
prs_config = &RC.gNB[j]->prs_vars.prs_cfg[k];
prs_config->PRSResourceSetPeriod[0] = PRS_ParamList.paramarray[j][PRS_RESOURCE_SET_PERIOD_LIST].uptr[0];
prs_config->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];
prs_config->SymbolStart = PRS_ParamList.paramarray[j][PRS_SYMBOL_START_LIST].uptr[k];
prs_config->NumPRSSymbols = PRS_ParamList.paramarray[j][PRS_NUM_SYMBOLS_LIST].uptr[k];
prs_config->REOffset = PRS_ParamList.paramarray[j][PRS_RE_OFFSET_LIST].uptr[k];
prs_config->PRSResourceOffset = PRS_ParamList.paramarray[j][PRS_RESOURCE_OFFSET_LIST].uptr[k];
prs_config->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);
prs_config->NumRB = *(PRS_ParamList.paramarray[j][PRS_NUM_RB].uptr);
prs_config->RBOffset = *(PRS_ParamList.paramarray[j][PRS_RB_OFFSET].uptr);
prs_config->CombSize = *(PRS_ParamList.paramarray[j][PRS_COMB_SIZE].uptr);
prs_config->PRSResourceRepetition = *(PRS_ParamList.paramarray[j][PRS_RESOURCE_REPETITION].uptr);
prs_config->PRSResourceTimeGap = *(PRS_ParamList.paramarray[j][PRS_RESOURCE_TIME_GAP].uptr);
prs_config->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];
{
prs_config->MutingPattern1[l] = PRS_ParamList.paramarray[j][PRS_MUTING_PATTERN1_LIST].uptr[l];
if (k == 0) // print only for 0th resource
n[5] += snprintf(str[5]+n[5],sizeof(str[5]),"%d, ",prs_config->MutingPattern1[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];
{
prs_config->MutingPattern2[l] = PRS_ParamList.paramarray[j][PRS_MUTING_PATTERN2_LIST].uptr[l];
if (k == 0) // print only for 0th resource
n[6] += snprintf(str[6]+n[6],sizeof(str[6]),"%d, ",prs_config->MutingPattern2[l]);
}
// print to buffer
n[0] += snprintf(str[0]+n[0],sizeof(str[0]),"%d, ",prs_config->SymbolStart);
n[1] += snprintf(str[1]+n[1],sizeof(str[1]),"%d, ",prs_config->NumPRSSymbols);
n[2] += snprintf(str[2]+n[2],sizeof(str[2]),"%d, ",prs_config->REOffset);
n[3] += snprintf(str[3]+n[3],sizeof(str[3]),"%d, ",prs_config->PRSResourceOffset);
n[4] += snprintf(str[4]+n[4],sizeof(str[4]),"%d, ",prs_config->NPRSID);
} // for k
k = 0;
prs_config = &RC.gNB[j]->prs_vars.prs_cfg[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, "PRS Config for gNB_id %d @ %p\n", j, prs_config);
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, "PRSResourceSetPeriod \t[%d, %d]\n", prs_config->PRSResourceSetPeriod[0], prs_config->PRSResourceSetPeriod[1]);
LOG_I(PHY, "NumRB \t\t\t%d\n", prs_config->NumRB);
LOG_I(PHY, "RBOffset \t\t%d\n", prs_config->RBOffset);
LOG_I(PHY, "CombSize \t\t%d\n", prs_config->CombSize);
LOG_I(PHY, "PRSResourceRepetition \t%d\n", prs_config->PRSResourceRepetition);
LOG_I(PHY, "PRSResourceTimeGap \t%d\n", prs_config->PRSResourceTimeGap);
LOG_I(PHY, "MutingBitRepetition \t%d\n", prs_config->MutingBitRepetition);
LOG_I(PHY, "SymbolStart \t\t[%s\b\b]\n", str[0]);
LOG_I(PHY, "NumPRSSymbols \t\t[%s\b\b]\n", str[1]);
LOG_I(PHY, "REOffset \t\t[%s\b\b]\n", str[2]);
LOG_I(PHY, "PRSResourceOffset \t[%s\b\b]\n", str[3]);
LOG_I(PHY, "NPRS_ID \t\t[%s\b\b]\n", str[4]);
LOG_I(PHY, "MutingPattern1 \t\t[%s\b\b]\n", str[5]);
LOG_I(PHY, "MutingPattern2 \t\t[%s\b\b]\n", str[6]);
LOG_I(PHY, "-----------------------------------------\n");
} // for j
}
else
{
LOG_I(NR_PHY,"No " CONFIG_STRING_PRS_CONFIG " configuration found\n");
LOG_E(PHY,"No " CONFIG_STRING_PRS_CONFIG " configuration found..!!\n");
}
}
......
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