Commit a5eda343 authored by Sagar Parsawar's avatar Sagar Parsawar

1. Fixed pbchsim build failure due to prs source file dependacy

2. Fixed GPS time assert in gNB_scheduler_uci.c
parent 26042030
...@@ -34,6 +34,8 @@ ...@@ -34,6 +34,8 @@
#include "LAYER2/nr_pdcp/nr_pdcp_entity.h" #include "LAYER2/nr_pdcp/nr_pdcp_entity.h"
#include "SCHED_NR_UE/pucch_uci_ue_nr.h" #include "SCHED_NR_UE/pucch_uci_ue_nr.h"
#include "openair2/NR_UE_PHY_INTERFACE/NR_IF_Module.h" #include "openair2/NR_UE_PHY_INTERFACE/NR_IF_Module.h"
#include "openair2/GNB_APP/prs_nr_paramdef.h"
#include "PHY/NR_REFSIG/refsig_defs_ue.h"
/* /*
* NR SLOT PROCESSING SEQUENCE * NR SLOT PROCESSING SEQUENCE
...@@ -150,6 +152,162 @@ static void *nrL1_UE_stats_thread(void *param) ...@@ -150,6 +152,162 @@ static void *nrL1_UE_stats_thread(void *param)
return NULL; return NULL;
} }
void RCconfig_nrUE_prs(void *cfg)
{
int j = 0, k = 0, gNB_id = 0;
char aprefix[MAX_OPTNAME_SIZE*2 + 8];
PHY_VARS_NR_UE *ue = (PHY_VARS_NR_UE *)cfg;
paramlist_def_t gParamList = {CONFIG_STRING_PRS_LIST,NULL,0};
paramdef_t gParams[] = PRS_GLOBAL_PARAMS_DESC;
config_getlist( &gParamList,gParams,sizeof(gParams)/sizeof(paramdef_t), NULL);
ue->prs_active_gNBs = *(gParamList.paramarray[j][PRS_ACTIVE_GNBS_IDX].uptr);
paramlist_def_t PRS_ParamList = {{0},NULL,0};
for(int i = 0; i < ue->prs_active_gNBs; i++)
{
paramdef_t PRS_Params[] = PRS_PARAMS_DESC;
sprintf(PRS_ParamList.listname, "%s%i", CONFIG_STRING_PRS_CONFIG, i);
sprintf(aprefix, "%s.[%i]", CONFIG_STRING_PRS_LIST, 0);
config_getlist( &PRS_ParamList,PRS_Params,sizeof(PRS_Params)/sizeof(paramdef_t), aprefix);
if (PRS_ParamList.numelt > 0) {
for (j = 0; j < PRS_ParamList.numelt; j++) {
gNB_id = *(PRS_ParamList.paramarray[j][PRS_GNB_ID].uptr);
if(gNB_id != i) gNB_id = i; // force gNB_id to avoid mismatch
ue->prs_vars[gNB_id]->NumPRSResources = *(PRS_ParamList.paramarray[j][NUM_PRS_RESOURCES].uptr);
for (k = 0; k < ue->prs_vars[gNB_id]->NumPRSResources; k++)
{
ue->prs_vars[gNB_id]->prs_resource[k].prs_cfg.PRSResourceSetPeriod[0] = PRS_ParamList.paramarray[j][PRS_RESOURCE_SET_PERIOD_LIST].uptr[0];
ue->prs_vars[gNB_id]->prs_resource[k].prs_cfg.PRSResourceSetPeriod[1] = PRS_ParamList.paramarray[j][PRS_RESOURCE_SET_PERIOD_LIST].uptr[1];
// per PRS resources parameters
ue->prs_vars[gNB_id]->prs_resource[k].prs_cfg.SymbolStart = PRS_ParamList.paramarray[j][PRS_SYMBOL_START_LIST].uptr[k];
ue->prs_vars[gNB_id]->prs_resource[k].prs_cfg.NumPRSSymbols = PRS_ParamList.paramarray[j][PRS_NUM_SYMBOLS_LIST].uptr[k];
ue->prs_vars[gNB_id]->prs_resource[k].prs_cfg.REOffset = PRS_ParamList.paramarray[j][PRS_RE_OFFSET_LIST].uptr[k];
ue->prs_vars[gNB_id]->prs_resource[k].prs_cfg.NPRSID = PRS_ParamList.paramarray[j][PRS_ID_LIST].uptr[k];
ue->prs_vars[gNB_id]->prs_resource[k].prs_cfg.PRSResourceOffset = PRS_ParamList.paramarray[j][PRS_RESOURCE_OFFSET_LIST].uptr[k];
// Common parameters to all PRS resources
ue->prs_vars[gNB_id]->prs_resource[k].prs_cfg.NumRB = *(PRS_ParamList.paramarray[j][PRS_NUM_RB].uptr);
ue->prs_vars[gNB_id]->prs_resource[k].prs_cfg.RBOffset = *(PRS_ParamList.paramarray[j][PRS_RB_OFFSET].uptr);
ue->prs_vars[gNB_id]->prs_resource[k].prs_cfg.CombSize = *(PRS_ParamList.paramarray[j][PRS_COMB_SIZE].uptr);
ue->prs_vars[gNB_id]->prs_resource[k].prs_cfg.PRSResourceRepetition = *(PRS_ParamList.paramarray[j][PRS_RESOURCE_REPETITION].uptr);
ue->prs_vars[gNB_id]->prs_resource[k].prs_cfg.PRSResourceTimeGap = *(PRS_ParamList.paramarray[j][PRS_RESOURCE_TIME_GAP].uptr);
ue->prs_vars[gNB_id]->prs_resource[k].prs_cfg.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++)
ue->prs_vars[gNB_id]->prs_resource[k].prs_cfg.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++)
ue->prs_vars[gNB_id]->prs_resource[k].prs_cfg.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", gNB_id, &ue->prs_vars[gNB_id]->prs_resource[k].prs_cfg);
LOG_I(PHY, "-----------------------------------------\n");
LOG_I(PHY, "NumPRSResources \t%d\n", ue->prs_vars[gNB_id]->NumPRSResources);
LOG_I(PHY, "PRSResourceSetPeriod \t[%d, %d]\n", ue->prs_vars[gNB_id]->prs_resource[k].prs_cfg.PRSResourceSetPeriod[0], ue->prs_vars[gNB_id]->prs_resource[k].prs_cfg.PRSResourceSetPeriod[1]);
LOG_I(PHY, "NumRB \t\t\t%d\n", ue->prs_vars[gNB_id]->prs_resource[k].prs_cfg.NumRB);
LOG_I(PHY, "RBOffset \t\t%d\n", ue->prs_vars[gNB_id]->prs_resource[k].prs_cfg.RBOffset);
LOG_I(PHY, "CombSize \t\t%d\n", ue->prs_vars[gNB_id]->prs_resource[k].prs_cfg.CombSize);
LOG_I(PHY, "PRSResourceRepetition \t%d\n", ue->prs_vars[gNB_id]->prs_resource[k].prs_cfg.PRSResourceRepetition);
LOG_I(PHY, "PRSResourceTimeGap \t%d\n", ue->prs_vars[gNB_id]->prs_resource[k].prs_cfg.PRSResourceTimeGap);
LOG_I(PHY, "MutingBitRepetition \t%d\n", ue->prs_vars[gNB_id]->prs_resource[k].prs_cfg.MutingBitRepetition);
LOG_I(PHY, "SymbolStart \t\t[");
for (k = 0; k < ue->prs_vars[gNB_id]->NumPRSResources; k++)
printf("%d, ", ue->prs_vars[gNB_id]->prs_resource[k].prs_cfg.SymbolStart);
printf("\b\b]\n");
LOG_I(PHY, "NumPRSSymbols \t\t[");
for (k = 0; k < ue->prs_vars[gNB_id]->NumPRSResources; k++)
printf("%d, ", ue->prs_vars[gNB_id]->prs_resource[k].prs_cfg.NumPRSSymbols);
printf("\b\b]\n");
LOG_I(PHY, "REOffset \t\t[");
for (k = 0; k < ue->prs_vars[gNB_id]->NumPRSResources; k++)
printf("%d, ", ue->prs_vars[gNB_id]->prs_resource[k].prs_cfg.REOffset);
printf("\b\b]\n");
LOG_I(PHY, "PRSResourceOffset \t[");
for (k = 0; k < ue->prs_vars[gNB_id]->NumPRSResources; k++)
printf("%d, ", ue->prs_vars[gNB_id]->prs_resource[k].prs_cfg.PRSResourceOffset);
printf("\b\b]\n");
LOG_I(PHY, "NPRS_ID \t\t[");
for (k = 0; k < ue->prs_vars[gNB_id]->NumPRSResources; k++)
printf("%d, ", ue->prs_vars[gNB_id]->prs_resource[k].prs_cfg.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, ", ue->prs_vars[gNB_id]->prs_resource[k].prs_cfg.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, ", ue->prs_vars[gNB_id]->prs_resource[k].prs_cfg.MutingPattern2[l]);
printf("\b\b]\n");
LOG_I(PHY, "-----------------------------------------\n");
}
}
else
{
LOG_I(NR_PHY,"No %s configuration found\n", PRS_ParamList.listname);
}
}
}
void init_nr_prs_ue_vars(PHY_VARS_NR_UE *ue)
{
NR_UE_PRS **const prs_vars = ue->prs_vars;
NR_DL_FRAME_PARMS *const fp = &ue->frame_parms;
// PRS vars init
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);
for (int 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*sizeof(int32_t));
prs_vars[idx]->prs_resource[k].prs_ch_estimates_time[i] = (int32_t *)malloc16_clear(fp->ofdm_symbol_size*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(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);
}
}
}
// load the config file params
RCconfig_nrUE_prs(ue);
//PRS sequence init
ue->nr_gold_prs = (uint32_t *****)malloc16(ue->prs_active_gNBs*sizeof(uint32_t ****));
uint32_t *****prs = ue->nr_gold_prs;
AssertFatal(prs!=NULL, "NR UE init: positioning reference signal malloc failed\n");
for (int gnb = 0; gnb < ue->prs_active_gNBs; gnb++) {
prs[gnb] = (uint32_t ****)malloc16(ue->prs_vars[gnb]->NumPRSResources*sizeof(uint32_t ***));
AssertFatal(prs[gnb]!=NULL, "NR UE init: positioning reference signal for gnb %d - malloc failed\n", gnb);
for (int rsc = 0; rsc < ue->prs_vars[gnb]->NumPRSResources; rsc++) {
prs[gnb][rsc] = (uint32_t ***)malloc16(fp->slots_per_frame*sizeof(uint32_t **));
AssertFatal(prs[gnb][rsc]!=NULL, "NR UE init: positioning reference signal for gnb %d rsc %d- malloc failed\n", gnb, rsc);
for (int slot=0; slot<fp->slots_per_frame; slot++) {
prs[gnb][rsc][slot] = (uint32_t **)malloc16(fp->symbols_per_slot*sizeof(uint32_t *));
AssertFatal(prs[gnb][rsc][slot]!=NULL, "NR UE init: positioning reference signal for gnb %d rsc %d slot %d - malloc failed\n", gnb, rsc, slot);
for (int symb=0; symb<fp->symbols_per_slot; symb++) {
prs[gnb][rsc][slot][symb] = (uint32_t *)malloc16(NR_MAX_PRS_INIT_LENGTH_DWORD*sizeof(uint32_t));
AssertFatal(prs[gnb][rsc][slot][symb]!=NULL, "NR UE init: positioning reference signal for gnb %d rsc %d slot %d symbol %d - malloc failed\n", gnb, rsc, slot, symb);
} // for symb
} // for slot
} // for rsc
} // for gnb
init_nr_gold_prs(ue);
}
void init_nr_ue_vars(PHY_VARS_NR_UE *ue, void init_nr_ue_vars(PHY_VARS_NR_UE *ue,
uint8_t UE_id, uint8_t UE_id,
uint8_t abstraction_flag) uint8_t abstraction_flag)
...@@ -168,6 +326,9 @@ void init_nr_ue_vars(PHY_VARS_NR_UE *ue, ...@@ -168,6 +326,9 @@ void init_nr_ue_vars(PHY_VARS_NR_UE *ue,
ue->prach_resources[gNB_id] = (NR_PRACH_RESOURCES_t *)malloc16_clear(sizeof(NR_PRACH_RESOURCES_t)); ue->prach_resources[gNB_id] = (NR_PRACH_RESOURCES_t *)malloc16_clear(sizeof(NR_PRACH_RESOURCES_t));
} }
// initialize nr prs vars
init_nr_prs_ue_vars(ue);
// initialize all signal buffers // initialize all signal buffers
init_nr_ue_signal(ue, nb_connected_gNB); init_nr_ue_signal(ue, nb_connected_gNB);
......
...@@ -100,5 +100,6 @@ extern void start_oai_nrue_threads(void); ...@@ -100,5 +100,6 @@ extern void start_oai_nrue_threads(void);
void *UE_thread(void *arg); void *UE_thread(void *arg);
void init_nr_ue_vars(PHY_VARS_NR_UE *ue, uint8_t UE_id, uint8_t abstraction_flag); void init_nr_ue_vars(PHY_VARS_NR_UE *ue, uint8_t UE_id, uint8_t abstraction_flag);
void init_nrUE_standalone_thread(int ue_idx); void init_nrUE_standalone_thread(int ue_idx);
void RCconfig_nrUE_prs(void *cfg);
void init_nr_prs_ue_vars(PHY_VARS_NR_UE *ue);
#endif #endif
...@@ -141,7 +141,6 @@ int init_nr_ue_signal(PHY_VARS_NR_UE *ue, int nb_connected_gNB) ...@@ -141,7 +141,6 @@ int init_nr_ue_signal(PHY_VARS_NR_UE *ue, int nb_connected_gNB)
NR_DL_FRAME_PARMS *const fp = &ue->frame_parms; NR_DL_FRAME_PARMS *const fp = &ue->frame_parms;
NR_UE_COMMON *const common_vars = &ue->common_vars; NR_UE_COMMON *const common_vars = &ue->common_vars;
NR_UE_PBCH **const pbch_vars = ue->pbch_vars; NR_UE_PBCH **const pbch_vars = ue->pbch_vars;
NR_UE_PRS **const prs_vars = ue->prs_vars;
NR_UE_PRACH **const prach_vars = ue->prach_vars; NR_UE_PRACH **const prach_vars = ue->prach_vars;
NR_UE_CSI_IM **const csiim_vars = ue->csiim_vars; NR_UE_CSI_IM **const csiim_vars = ue->csiim_vars;
NR_UE_CSI_RS **const csirs_vars = ue->csirs_vars; NR_UE_CSI_RS **const csirs_vars = ue->csirs_vars;
...@@ -191,55 +190,6 @@ int init_nr_ue_signal(PHY_VARS_NR_UE *ue, int nb_connected_gNB) ...@@ -191,55 +190,6 @@ int init_nr_ue_signal(PHY_VARS_NR_UE *ue, int nb_connected_gNB)
/////////// ///////////
//////////////////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////////////////
// PRS vars
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);
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*sizeof(int32_t));
prs_vars[idx]->prs_resource[k].prs_ch_estimates_time[i] = (int32_t *)malloc16_clear(fp->ofdm_symbol_size*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(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);
}
}
}
// load the config file params
RCconfig_nrUE_prs(ue);
//PRS sequence init
ue->nr_gold_prs = (uint32_t *****)malloc16(ue->prs_active_gNBs*sizeof(uint32_t ****));
uint32_t *****prs = ue->nr_gold_prs;
AssertFatal(prs!=NULL, "NR UE init: positioning reference signal malloc failed\n");
for (int gnb = 0; gnb < ue->prs_active_gNBs; gnb++) {
prs[gnb] = (uint32_t ****)malloc16(ue->prs_vars[gnb]->NumPRSResources*sizeof(uint32_t ***));
AssertFatal(prs[gnb]!=NULL, "NR UE init: positioning reference signal for gnb %d - malloc failed\n", gnb);
for (int rsc = 0; rsc < ue->prs_vars[gnb]->NumPRSResources; rsc++) {
prs[gnb][rsc] = (uint32_t ***)malloc16(fp->slots_per_frame*sizeof(uint32_t **));
AssertFatal(prs[gnb][rsc]!=NULL, "NR UE init: positioning reference signal for gnb %d rsc %d- malloc failed\n", gnb, rsc);
for (int slot=0; slot<fp->slots_per_frame; slot++) {
prs[gnb][rsc][slot] = (uint32_t **)malloc16(fp->symbols_per_slot*sizeof(uint32_t *));
AssertFatal(prs[gnb][rsc][slot]!=NULL, "NR UE init: positioning reference signal for gnb %d rsc %d slot %d - malloc failed\n", gnb, rsc, slot);
for (int symb=0; symb<fp->symbols_per_slot; symb++) {
prs[gnb][rsc][slot][symb] = (uint32_t *)malloc16(NR_MAX_PRS_INIT_LENGTH_DWORD*sizeof(uint32_t));
AssertFatal(prs[gnb][rsc][slot][symb]!=NULL, "NR UE init: positioning reference signal for gnb %d rsc %d slot %d symbol %d - malloc failed\n", gnb, rsc, slot, symb);
} // for symb
} // for slot
} // for rsc
} // for gnb
init_nr_gold_prs(ue);
/////////////////////////PUSCH DMRS init///////////////////////// /////////////////////////PUSCH DMRS init/////////////////////////
/////////// ///////////
......
...@@ -8,11 +8,6 @@ ...@@ -8,11 +8,6 @@
//#define DEBUG_PRS_MAP //#define DEBUG_PRS_MAP
extern short nr_qpsk_mod_table[8]; extern short nr_qpsk_mod_table[8];
int k_prime_table[4][12] = {
{0,1,0,1,0,1,0,1,0,1,0,1},
{0,2,1,3,0,2,1,3,0,2,1,3},
{0,3,1,4,2,5,0,3,1,4,2,5},
{0,6,3,9,1,7,4,10,2,8,5,11}};
int nr_generate_prs(uint32_t **nr_gold_prs, int nr_generate_prs(uint32_t **nr_gold_prs,
int32_t *txdataF, int32_t *txdataF,
...@@ -22,9 +17,9 @@ int nr_generate_prs(uint32_t **nr_gold_prs, ...@@ -22,9 +17,9 @@ int nr_generate_prs(uint32_t **nr_gold_prs,
NR_DL_FRAME_PARMS *frame_parms) NR_DL_FRAME_PARMS *frame_parms)
{ {
int k_prime = 0, k = 0; int k_prime = 0, k = 0, idx;
int16_t mod_prs[NR_MAX_PRS_LENGTH<<1]; int16_t mod_prs[NR_MAX_PRS_LENGTH<<1];
uint8_t idx; int16_t k_prime_table[K_PRIME_TABLE_ROW_SIZE][K_PRIME_TABLE_COL_SIZE] = PRS_K_PRIME_TABLE;
// PRS resource mapping with combsize=k which means PRS symbols exist in every k-th subcarrier in frequency domain // 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 // According to ts138.211 sec.7.4.1.7.2
......
...@@ -40,11 +40,6 @@ ...@@ -40,11 +40,6 @@
//#define DEBUG_PRS_PRINTS //#define DEBUG_PRS_PRINTS
#define IDFT_INTERPOL_FACTOR 1 #define IDFT_INTERPOL_FACTOR 1
extern short nr_qpsk_mod_table[8]; extern short nr_qpsk_mod_table[8];
int k_prime_table[4][12] = {
{0,1,0,1,0,1,0,1,0,1,0,1},
{0,2,1,3,0,2,1,3,0,2,1,3},
{0,3,1,4,2,5,0,3,1,4,2,5},
{0,6,3,9,1,7,4,10,2,8,5,11}};
static inline int abs32(int x) static inline int abs32(int x)
{ {
...@@ -85,6 +80,7 @@ int nr_prs_channel_estimation(uint8_t gNB_id, ...@@ -85,6 +80,7 @@ int nr_prs_channel_estimation(uint8_t gNB_id,
int16_t num_pilots = (12/prs_cfg->CombSize)*prs_cfg->NumRB; int16_t num_pilots = (12/prs_cfg->CombSize)*prs_cfg->NumRB;
int16_t start_offset = (IDFT_INTERPOL_FACTOR-1)*frame_params->ofdm_symbol_size>>1; int16_t start_offset = (IDFT_INTERPOL_FACTOR-1)*frame_params->ofdm_symbol_size>>1;
int16_t k_prime_table[K_PRIME_TABLE_ROW_SIZE][K_PRIME_TABLE_COL_SIZE] = PRS_K_PRIME_TABLE;
for(int l = prs_cfg->SymbolStart; l < prs_cfg->SymbolStart+prs_cfg->NumPRSSymbols; l++) for(int l = prs_cfg->SymbolStart; l < prs_cfg->SymbolStart+prs_cfg->NumPRSSymbols; l++)
{ {
int symInd = l-prs_cfg->SymbolStart; int symInd = l-prs_cfg->SymbolStart;
......
...@@ -418,6 +418,14 @@ typedef struct { ...@@ -418,6 +418,14 @@ typedef struct {
int32_t reserved; int32_t reserved;
} prs_meas_t; } prs_meas_t;
// rel16 prs k_prime table as per ts138.211 sec.7.4.1.7.2
#define K_PRIME_TABLE_ROW_SIZE 4
#define K_PRIME_TABLE_COL_SIZE 12
#define PRS_K_PRIME_TABLE { {0,1,0,1,0,1,0,1,0,1,0,1}, \
{0,2,1,3,0,2,1,3,0,2,1,3}, \
{0,3,1,4,2,5,0,3,1,4,2,5}, \
{0,6,3,9,1,7,4,10,2,8,5,11} };
#define KHz (1000UL) #define KHz (1000UL)
#define MHz (1000*KHz) #define MHz (1000*KHz)
......
...@@ -160,7 +160,6 @@ int main(int argc, char **argv) ...@@ -160,7 +160,6 @@ int main(int argc, char **argv)
int **txdata; int **txdata;
double **s_re,**s_im,**r_re,**r_im; double **s_re,**s_im,**r_re,**r_im;
//double iqim = 0.0; //double iqim = 0.0;
double DS_TDL = .03;
double ip =0.0; double ip =0.0;
//unsigned char pbch_pdu[6]; //unsigned char pbch_pdu[6];
// int sync_pos, sync_pos_slot; // int sync_pos, sync_pos_slot;
...@@ -275,21 +274,6 @@ int main(int argc, char **argv) ...@@ -275,21 +274,6 @@ int main(int argc, char **argv)
channel_model=ETU; channel_model=ETU;
break; break;
case 'H':
channel_model = TDL_C;
DS_TDL = .030; // 30 ns
break;
case 'I':
channel_model = TDL_C;
DS_TDL = .3; // 300ns
break;
case 'J':
channel_model=TDL_D;
DS_TDL = .03;
break;
default: default:
printf("Unsupported channel model! Exiting.\n"); printf("Unsupported channel model! Exiting.\n");
exit(-1); exit(-1);
...@@ -545,8 +529,10 @@ int main(int argc, char **argv) ...@@ -545,8 +529,10 @@ int main(int argc, char **argv)
channel_model, channel_model,
fs, fs,
bw, bw,
DS_TDL, 300e-9,
0, 0, 0, 0); 0,
0,
0, 0);
if (gNB2UE==NULL) { if (gNB2UE==NULL) {
printf("Problem generating channel model. Exiting.\n"); printf("Problem generating channel model. Exiting.\n");
...@@ -689,16 +675,6 @@ int main(int argc, char **argv) ...@@ -689,16 +675,6 @@ int main(int argc, char **argv)
frame_parms->ofdm_symbol_size + frame_parms->nb_prefix_samples); frame_parms->ofdm_symbol_size + frame_parms->nb_prefix_samples);
printf("txlev %d (%f)\n",txlev,10*log10(txlev));*/ printf("txlev %d (%f)\n",txlev,10*log10(txlev));*/
<<<<<<< HEAD
for (i=0; i<frame_length_complex_samples; i++) {
for (aa=0; aa<frame_parms->nb_antennas_tx; aa++) {
s_re[aa][i] = ((double)(((short *)txdata[aa]))[(i<<1)]);
s_im[aa][i] = ((double)(((short *)txdata[aa]))[(i<<1)+1]);
}
}
=======
>>>>>>> origin/develop
for (SNR=snr0; SNR<snr1; SNR+=.2) { for (SNR=snr0; SNR<snr1; SNR+=.2) {
...@@ -707,19 +683,6 @@ int main(int argc, char **argv) ...@@ -707,19 +683,6 @@ int main(int argc, char **argv)
for (trial=0; trial<n_trials; trial++) { for (trial=0; trial<n_trials; trial++) {
<<<<<<< HEAD
if (channel_model != AWGN) {
// multipath channel
multipath_channel(gNB2UE,s_re,s_im,r_re,r_im,frame_length_complex_samples,0,0);
}
else {
for (aa=0; aa<frame_parms->nb_antennas_tx; aa++) {
memcpy(r_re[aa],s_re[aa],frame_length_complex_samples*sizeof(double));
memcpy(r_im[aa],s_im[aa],frame_length_complex_samples*sizeof(double));
}
}
=======
for (i=0; i<frame_length_complex_samples; i++) { for (i=0; i<frame_length_complex_samples; i++) {
for (aa=0; aa<frame_parms->nb_antennas_tx; aa++) { for (aa=0; aa<frame_parms->nb_antennas_tx; aa++) {
r_re[aa][i] = ((double)(((short *)txdata[aa]))[(i<<1)]); r_re[aa][i] = ((double)(((short *)txdata[aa]))[(i<<1)]);
...@@ -730,7 +693,6 @@ int main(int argc, char **argv) ...@@ -730,7 +693,6 @@ int main(int argc, char **argv)
// multipath channel // multipath channel
//multipath_channel(gNB2UE,s_re,s_im,r_re,r_im,frame_length_complex_samples,0); //multipath_channel(gNB2UE,s_re,s_im,r_re,r_im,frame_length_complex_samples,0);
>>>>>>> origin/develop
//AWGN //AWGN
sigma2_dB = 20*log10((double)AMP/4)-SNR; sigma2_dB = 20*log10((double)AMP/4)-SNR;
sigma2 = pow(10,sigma2_dB/10); sigma2 = pow(10,sigma2_dB/10);
...@@ -787,43 +749,17 @@ int main(int argc, char **argv) ...@@ -787,43 +749,17 @@ int main(int argc, char **argv)
UE->symbol_offset = nr_get_ssb_start_symbol(frame_parms,ssb_index); UE->symbol_offset = nr_get_ssb_start_symbol(frame_parms,ssb_index);
int ssb_slot = (UE->symbol_offset/14)+(n_hf*(frame_parms->slots_per_frame>>1)); int ssb_slot = (UE->symbol_offset/14)+(n_hf*(frame_parms->slots_per_frame>>1));
for (int i=UE->symbol_offset+1; i<UE->symbol_offset+4; i++) {
for(int j = 0; j < frame_parms->symbols_per_slot; j++)
{
nr_slot_fep(UE, nr_slot_fep(UE,
&proc, &proc,
j%frame_parms->symbols_per_slot, i%frame_parms->symbols_per_slot,
ssb_slot); ssb_slot);
}
<<<<<<< HEAD
for (int i=UE->symbol_offset+1; i<UE->symbol_offset+4; i++) {
nr_pbch_channel_estimation(UE,&proc,0,ssb_slot,i%frame_parms->symbols_per_slot,i-(UE->symbol_offset+1),ssb_index%8,n_hf);
}
UE->prs_cfg.PRSResourceSetPeriod[0]=40; // PRS resource slot period
UE->prs_cfg.PRSResourceSetPeriod[1]=0; // resource slot offset
UE->prs_cfg.SymbolStart=7;
UE->prs_cfg.NumPRSSymbols=4;
UE->prs_cfg.NumRB=frame_parms->N_RB_DL;
UE->prs_cfg.RBOffset=0;
UE->prs_cfg.CombSize=2;
UE->prs_cfg.REOffset=0;
UE->prs_cfg.PRSResourceOffset=0;
UE->prs_cfg.PRSResourceRepetition=1;
UE->prs_cfg.PRSResourceTimeGap=1;
UE->prs_cfg.NPRSID=0;
//PRS channel estimation
nr_prs_channel_estimation(UE,&proc,frame_parms);
=======
nr_pbch_channel_estimation(UE,estimateSz, dl_ch_estimates, dl_ch_estimates_time, &proc, nr_pbch_channel_estimation(UE,estimateSz, dl_ch_estimates, dl_ch_estimates_time, &proc,
0,ssb_slot,i%frame_parms->symbols_per_slot,i-(UE->symbol_offset+1),ssb_index%8,n_hf); 0,ssb_slot,i%frame_parms->symbols_per_slot,i-(UE->symbol_offset+1),ssb_index%8,n_hf);
} }
fapiPbch_t result; fapiPbch_t result;
>>>>>>> origin/develop
ret = nr_rx_pbch(UE, ret = nr_rx_pbch(UE,
&proc, &proc,
estimateSz, dl_ch_estimates, estimateSz, dl_ch_estimates,
......
...@@ -47,9 +47,9 @@ static void nr_fill_nfapi_pucch(gNB_MAC_INST *nrmac, ...@@ -47,9 +47,9 @@ static void nr_fill_nfapi_pucch(gNB_MAC_INST *nrmac,
{ {
nfapi_nr_ul_tti_request_t *future_ul_tti_req = nfapi_nr_ul_tti_request_t *future_ul_tti_req =
&nrmac->UL_tti_req_ahead[0][pucch->ul_slot]; &nrmac->UL_tti_req_ahead[0][pucch->ul_slot];
AssertFatal(future_ul_tti_req->SFN == pucch->frame if (future_ul_tti_req->SFN != pucch->frame || future_ul_tti_req->Slot != pucch->ul_slot)
&& future_ul_tti_req->Slot == pucch->ul_slot, LOG_W(MAC,
"Current %4d.%2d : future UL_tti_req's frame.slot %4d.%2d does not match PUCCH %4d.%2d\n", "Current %d.%d : future UL_tti_req's frame.slot %4d.%2d does not match PUCCH %4d.%2d\n",
frame,slot, frame,slot,
future_ul_tti_req->SFN, future_ul_tti_req->SFN,
future_ul_tti_req->Slot, future_ul_tti_req->Slot,
......
...@@ -44,7 +44,6 @@ ...@@ -44,7 +44,6 @@
#include "openair2/RRC/NR_UE/rrc_proto.h" #include "openair2/RRC/NR_UE/rrc_proto.h"
#include "openair2/RRC/NR_UE/rrc_vars.h" #include "openair2/RRC/NR_UE/rrc_vars.h"
#include "openair2/GNB_APP/L1_nr_paramdef.h" #include "openair2/GNB_APP/L1_nr_paramdef.h"
#include "openair2/GNB_APP/prs_nr_paramdef.h"
#include "openair2/GNB_APP/gnb_paramdef.h" #include "openair2/GNB_APP/gnb_paramdef.h"
#include "targets/ARCH/ETHERNET/USERSPACE/LIB/if_defs.h" #include "targets/ARCH/ETHERNET/USERSPACE/LIB/if_defs.h"
#include <stdio.h> #include <stdio.h>
...@@ -1343,103 +1342,3 @@ void RCconfig_nr_ue_L1(void) { ...@@ -1343,103 +1342,3 @@ void RCconfig_nr_ue_L1(void) {
} }
} }
} }
void RCconfig_nrUE_prs(void *cfg)
{
int j = 0, k = 0, gNB_id = 0;
char aprefix[MAX_OPTNAME_SIZE*2 + 8];
PHY_VARS_NR_UE *ue = (PHY_VARS_NR_UE *)cfg;
paramlist_def_t gParamList = {CONFIG_STRING_PRS_LIST,NULL,0};
paramdef_t gParams[] = PRS_GLOBAL_PARAMS_DESC;
config_getlist( &gParamList,gParams,sizeof(gParams)/sizeof(paramdef_t), NULL);
ue->prs_active_gNBs = *(gParamList.paramarray[j][PRS_ACTIVE_GNBS_IDX].uptr);
paramlist_def_t PRS_ParamList = {{0},NULL,0};
for(int i = 0; i < ue->prs_active_gNBs; i++)
{
paramdef_t PRS_Params[] = PRS_PARAMS_DESC;
sprintf(PRS_ParamList.listname, "%s%i", CONFIG_STRING_PRS_CONFIG, i);
sprintf(aprefix, "%s.[%i]", CONFIG_STRING_PRS_LIST, 0);
config_getlist( &PRS_ParamList,PRS_Params,sizeof(PRS_Params)/sizeof(paramdef_t), aprefix);
if (PRS_ParamList.numelt > 0) {
for (j = 0; j < PRS_ParamList.numelt; j++) {
gNB_id = *(PRS_ParamList.paramarray[j][PRS_GNB_ID].uptr);
if(gNB_id != i) gNB_id = i; // force gNB_id to avoid mismatch
ue->prs_vars[gNB_id]->NumPRSResources = *(PRS_ParamList.paramarray[j][NUM_PRS_RESOURCES].uptr);
for (k = 0; k < ue->prs_vars[gNB_id]->NumPRSResources; k++)
{
ue->prs_vars[gNB_id]->prs_resource[k].prs_cfg.PRSResourceSetPeriod[0] = PRS_ParamList.paramarray[j][PRS_RESOURCE_SET_PERIOD_LIST].uptr[0];
ue->prs_vars[gNB_id]->prs_resource[k].prs_cfg.PRSResourceSetPeriod[1] = PRS_ParamList.paramarray[j][PRS_RESOURCE_SET_PERIOD_LIST].uptr[1];
// per PRS resources parameters
ue->prs_vars[gNB_id]->prs_resource[k].prs_cfg.SymbolStart = PRS_ParamList.paramarray[j][PRS_SYMBOL_START_LIST].uptr[k];
ue->prs_vars[gNB_id]->prs_resource[k].prs_cfg.NumPRSSymbols = PRS_ParamList.paramarray[j][PRS_NUM_SYMBOLS_LIST].uptr[k];
ue->prs_vars[gNB_id]->prs_resource[k].prs_cfg.REOffset = PRS_ParamList.paramarray[j][PRS_RE_OFFSET_LIST].uptr[k];
ue->prs_vars[gNB_id]->prs_resource[k].prs_cfg.NPRSID = PRS_ParamList.paramarray[j][PRS_ID_LIST].uptr[k];
ue->prs_vars[gNB_id]->prs_resource[k].prs_cfg.PRSResourceOffset = PRS_ParamList.paramarray[j][PRS_RESOURCE_OFFSET_LIST].uptr[k];
// Common parameters to all PRS resources
ue->prs_vars[gNB_id]->prs_resource[k].prs_cfg.NumRB = *(PRS_ParamList.paramarray[j][PRS_NUM_RB].uptr);
ue->prs_vars[gNB_id]->prs_resource[k].prs_cfg.RBOffset = *(PRS_ParamList.paramarray[j][PRS_RB_OFFSET].uptr);
ue->prs_vars[gNB_id]->prs_resource[k].prs_cfg.CombSize = *(PRS_ParamList.paramarray[j][PRS_COMB_SIZE].uptr);
ue->prs_vars[gNB_id]->prs_resource[k].prs_cfg.PRSResourceRepetition = *(PRS_ParamList.paramarray[j][PRS_RESOURCE_REPETITION].uptr);
ue->prs_vars[gNB_id]->prs_resource[k].prs_cfg.PRSResourceTimeGap = *(PRS_ParamList.paramarray[j][PRS_RESOURCE_TIME_GAP].uptr);
ue->prs_vars[gNB_id]->prs_resource[k].prs_cfg.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++)
ue->prs_vars[gNB_id]->prs_resource[k].prs_cfg.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++)
ue->prs_vars[gNB_id]->prs_resource[k].prs_cfg.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", gNB_id, &ue->prs_vars[gNB_id]->prs_resource[k].prs_cfg);
LOG_I(PHY, "-----------------------------------------\n");
LOG_I(PHY, "NumPRSResources \t%d\n", ue->prs_vars[gNB_id]->NumPRSResources);
LOG_I(PHY, "PRSResourceSetPeriod \t[%d, %d]\n", ue->prs_vars[gNB_id]->prs_resource[k].prs_cfg.PRSResourceSetPeriod[0], ue->prs_vars[gNB_id]->prs_resource[k].prs_cfg.PRSResourceSetPeriod[1]);
LOG_I(PHY, "NumRB \t\t\t%d\n", ue->prs_vars[gNB_id]->prs_resource[k].prs_cfg.NumRB);
LOG_I(PHY, "RBOffset \t\t%d\n", ue->prs_vars[gNB_id]->prs_resource[k].prs_cfg.RBOffset);
LOG_I(PHY, "CombSize \t\t%d\n", ue->prs_vars[gNB_id]->prs_resource[k].prs_cfg.CombSize);
LOG_I(PHY, "PRSResourceRepetition \t%d\n", ue->prs_vars[gNB_id]->prs_resource[k].prs_cfg.PRSResourceRepetition);
LOG_I(PHY, "PRSResourceTimeGap \t%d\n", ue->prs_vars[gNB_id]->prs_resource[k].prs_cfg.PRSResourceTimeGap);
LOG_I(PHY, "MutingBitRepetition \t%d\n", ue->prs_vars[gNB_id]->prs_resource[k].prs_cfg.MutingBitRepetition);
LOG_I(PHY, "SymbolStart \t\t[");
for (k = 0; k < ue->prs_vars[gNB_id]->NumPRSResources; k++)
printf("%d, ", ue->prs_vars[gNB_id]->prs_resource[k].prs_cfg.SymbolStart);
printf("\b\b]\n");
LOG_I(PHY, "NumPRSSymbols \t\t[");
for (k = 0; k < ue->prs_vars[gNB_id]->NumPRSResources; k++)
printf("%d, ", ue->prs_vars[gNB_id]->prs_resource[k].prs_cfg.NumPRSSymbols);
printf("\b\b]\n");
LOG_I(PHY, "REOffset \t\t[");
for (k = 0; k < ue->prs_vars[gNB_id]->NumPRSResources; k++)
printf("%d, ", ue->prs_vars[gNB_id]->prs_resource[k].prs_cfg.REOffset);
printf("\b\b]\n");
LOG_I(PHY, "PRSResourceOffset \t[");
for (k = 0; k < ue->prs_vars[gNB_id]->NumPRSResources; k++)
printf("%d, ", ue->prs_vars[gNB_id]->prs_resource[k].prs_cfg.PRSResourceOffset);
printf("\b\b]\n");
LOG_I(PHY, "NPRS_ID \t\t[");
for (k = 0; k < ue->prs_vars[gNB_id]->NumPRSResources; k++)
printf("%d, ", ue->prs_vars[gNB_id]->prs_resource[k].prs_cfg.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, ", ue->prs_vars[gNB_id]->prs_resource[k].prs_cfg.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, ", ue->prs_vars[gNB_id]->prs_resource[k].prs_cfg.MutingPattern2[l]);
printf("\b\b]\n");
LOG_I(PHY, "-----------------------------------------\n");
}
}
else
{
LOG_I(NR_PHY,"No %s configuration found\n", PRS_ParamList.listname);
}
}
}
...@@ -284,7 +284,6 @@ int handle_bcch_dlsch(module_id_t module_id, int cc_id, unsigned int gNB_index, ...@@ -284,7 +284,6 @@ int handle_bcch_dlsch(module_id_t module_id, int cc_id, unsigned int gNB_index,
int handle_dci(module_id_t module_id, int cc_id, unsigned int gNB_index, frame_t frame, int slot, fapi_nr_dci_indication_pdu_t *dci); int handle_dci(module_id_t module_id, int cc_id, unsigned int gNB_index, frame_t frame, int slot, fapi_nr_dci_indication_pdu_t *dci);
void RCconfig_nrUE_prs(void *cfg);
#endif #endif
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