diff --git a/executables/nr-uesoftmodem.c b/executables/nr-uesoftmodem.c index 7663e9ebd8..091c2f730b 100644 --- a/executables/nr-uesoftmodem.c +++ b/executables/nr-uesoftmodem.c @@ -508,6 +508,7 @@ int main( int argc, char **argv ) { init_symbol_rotation(&UE[CC_id]->frame_parms); init_timeshift_rotation(&UE[CC_id]->frame_parms); init_nr_ue_vars(UE[CC_id], 0, abstraction_flag); + RCconfig_nrUE_prs(UE[CC_id]); } init_openair0(); diff --git a/openair1/SCHED_NR/phy_procedures_nr_gNB.c b/openair1/SCHED_NR/phy_procedures_nr_gNB.c index a6eb596395..c107a3a546 100644 --- a/openair1/SCHED_NR/phy_procedures_nr_gNB.c +++ b/openair1/SCHED_NR/phy_procedures_nr_gNB.c @@ -100,7 +100,7 @@ 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 @@ -114,8 +114,8 @@ void nr_common_signal_procedures (PHY_VARS_gNB *gNB,int frame,int slot,nfapi_nr_ 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, &prs_data, cfg, fp); +*/ + 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)) { diff --git a/openair1/SCHED_NR_UE/phy_procedures_nr_ue.c b/openair1/SCHED_NR_UE/phy_procedures_nr_ue.c index 94f2b584cd..2fe72db761 100644 --- a/openair1/SCHED_NR_UE/phy_procedures_nr_ue.c +++ b/openair1/SCHED_NR_UE/phy_procedures_nr_ue.c @@ -1659,7 +1659,8 @@ 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_cfg.PRSResourceSetPeriod[0]=40; // PRS resource slot period ue->prs_cfg.PRSResourceSetPeriod[1]=0; // resource slot offset ue->prs_cfg.SymbolStart=7; @@ -1672,7 +1673,7 @@ int phy_procedures_nrUE_RX(PHY_VARS_NR_UE *ue, ue->prs_cfg.PRSResourceRepetition=1; ue->prs_cfg.PRSResourceTimeGap=1; ue->prs_cfg.NPRSID=0; - +*/ for(int j = ue->prs_cfg.SymbolStart; j < (ue->prs_cfg.SymbolStart + ue->prs_cfg.NumPRSSymbols); j++) { nr_slot_fep(ue, diff --git a/openair2/GNB_APP/gnb_app.c b/openair2/GNB_APP/gnb_app.c index 7d51d95840..d66d5835ab 100644 --- a/openair2/GNB_APP/gnb_app.c +++ b/openair2/GNB_APP/gnb_app.c @@ -183,6 +183,7 @@ void *gNB_app_task(void *args_p) LOG_I(PHY, "%s() Task ready initialize structures\n", __FUNCTION__); RCconfig_NR_L1(); + RCconfig_nr_prs(); if (RC.nb_nr_macrlc_inst>0) RCconfig_nr_macrlc(); diff --git a/openair2/GNB_APP/gnb_config.c b/openair2/GNB_APP/gnb_config.c index 9710dd1814..29ef6d72a8 100644 --- a/openair2/GNB_APP/gnb_config.c +++ b/openair2/GNB_APP/gnb_config.c @@ -54,6 +54,7 @@ #include "nfapi_pnf.h" //#include "L1_paramdef.h" +#include "prs_nr_paramdef.h" #include "L1_nr_paramdef.h" #include "MACRLC_nr_paramdef.h" #include "common/config/config_userapi.h" @@ -602,6 +603,64 @@ void RCconfig_nr_flexran() } } +void RCconfig_nr_prs(void) +{ + uint16_t j; + + paramdef_t PRS_Params[] = PRS_PARAMS_DESC; + paramlist_def_t PRS_ParamList = {GNB_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); + memset(RC.gNB,0,(1+NUMBER_OF_gNB_MAX)*sizeof(PHY_VARS_gNB*)); + } + + 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) { + RC.gNB[j] = (PHY_VARS_gNB *)malloc(sizeof(PHY_VARS_gNB)); + LOG_I(NR_PHY,"RC.gNB[%d] = %p\n",j,RC.gNB[j]); + memset(RC.gNB[j],0,sizeof(PHY_VARS_gNB)); + 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); + + LOG_I(NR_PHY, "PRS Config for gNB_ID %d\n", j); + LOG_I(NR_PHY, "PRSResourceSetPeriod0 %d\n", RC.gNB[j]->prs_cfg.PRSResourceSetPeriod[0]); + LOG_I(NR_PHY, "PRSResourceSetPeriod1 %d\n", RC.gNB[j]->prs_cfg.PRSResourceSetPeriod[1]); + LOG_I(NR_PHY, "SymbolStart %d\n", RC.gNB[j]->prs_cfg.SymbolStart); + LOG_I(NR_PHY, "NumPRSSymbols %d\n", RC.gNB[j]->prs_cfg.NumPRSSymbols); + LOG_I(NR_PHY, "NumRB %d\n", RC.gNB[j]->prs_cfg.NumRB); + LOG_I(NR_PHY, "RBOffset %d\n", RC.gNB[j]->prs_cfg.RBOffset); + LOG_I(NR_PHY, "CombSize %d\n", RC.gNB[j]->prs_cfg.CombSize); + LOG_I(NR_PHY, "REOffset %d\n", RC.gNB[j]->prs_cfg.REOffset); + LOG_I(NR_PHY, "PRSResourceOffset %d\n", RC.gNB[j]->prs_cfg.PRSResourceOffset); + LOG_I(NR_PHY, "PRSResourceRepetition %d\n", RC.gNB[j]->prs_cfg.PRSResourceRepetition); + LOG_I(NR_PHY, "PRSResourceTimeGap %d\n", RC.gNB[j]->prs_cfg.PRSResourceTimeGap); + } // for j + } + else + { + LOG_I(NR_PHY,"No " GNB_CONFIG_STRING_PRS_CONFIG " configuration found\n"); + } +} + void RCconfig_NR_L1(void) { int j; paramdef_t GNBSParams[] = GNBSPARAMS_DESC; @@ -2172,6 +2231,7 @@ void nr_read_config_and_init(void) { uint32_t gnb_nb = RC.nb_nr_inst; RCconfig_NR_L1(); + RCconfig_nr_prs(); set_node_type(); RCconfig_nr_macrlc(); diff --git a/openair2/GNB_APP/gnb_config.h b/openair2/GNB_APP/gnb_config.h index 013997f439..b75277545c 100644 --- a/openair2/GNB_APP/gnb_config.h +++ b/openair2/GNB_APP/gnb_config.h @@ -92,6 +92,7 @@ typedef struct ru_config_s { */ extern void NRRCconfig_RU(void); extern void RCconfig_nr_flexran(void); +extern void RCconfig_nr_prs(void); extern void RCconfig_NR_L1(void); extern void RCconfig_nr_macrlc(void); extern int RCconfig_nr_gtpu(void ); diff --git a/openair2/GNB_APP/gnb_paramdef.h b/openair2/GNB_APP/gnb_paramdef.h index 5b879e04f6..2c4422ef64 100644 --- a/openair2/GNB_APP/gnb_paramdef.h +++ b/openair2/GNB_APP/gnb_paramdef.h @@ -352,7 +352,8 @@ typedef enum { #define CONFIG_STRING_L1_LIST "L1s" #define CONFIG_STRING_L1_CONFIG "l1_config" - +/* PRS configuration section names */ +#define GNB_CONFIG_STRING_PRS_CONFIG "prs_config" /*----------------------------------------------------------------------------------------------------------------------------------------------------*/ diff --git a/openair2/GNB_APP/prs_nr_paramdef.h b/openair2/GNB_APP/prs_nr_paramdef.h new file mode 100644 index 0000000000..4aa2b08a53 --- /dev/null +++ b/openair2/GNB_APP/prs_nr_paramdef.h @@ -0,0 +1,87 @@ +/* + * Licensed to the OpenAirInterface (OAI) Software Alliance under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The OpenAirInterface Software Alliance licenses this file to You under + * the OAI Public License, Version 1.1 (the "License"); you may not use this file + * except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.openairinterface.org/?page_id=698 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + *------------------------------------------------------------------------------- + * For more information about the OpenAirInterface (OAI) Software Alliance: + * contact@openairinterface.org + */ + +/*! \file openair2/GNB_APP/prs_nr_paramdef.f + * \brief definition of configuration parameters for PRS + * \author + * \date 2022 + * \version 0.1 + * \company EURECOM + * \email: + * \note + * \warning + */ + +#ifndef __GNB_APP_PRS_NR_PARAMDEF__H__ +#define __GNB_APP_PRS_NR_PARAMDEF__H__ + +/*-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------*/ + + +/* PRS configuration parameters names */ +#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_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_RESOURCE_REPETITION "PRSResourceRepetition" +#define CONFIG_STRING_PRS_RESOURCE_TIME_GAP "PRSResourceTimeGap" +#define CONFIG_STRING_PRS_ID "NPRS_ID" + + +/*----------------------------------------------------------------------------------------------------------------------------------------------------*/ +/* PRS configuration parameters */ +/* optname helpstr paramflags XXXptr defXXXval type numelt */ +/*----------------------------------------------------------------------------------------------------------------------------------------------------*/ +#define PRS_PARAMS_DESC { \ +{CONFIG_STRING_PRS_RESOURCE_SET_PERIOD0, NULL, 0, uptr:NULL, defintval:40, TYPE_UINT, 0}, \ +{CONFIG_STRING_PRS_RESOURCE_SET_PERIOD1, NULL, 0, uptr:NULL, defintval:0, TYPE_UINT, 0}, \ +{CONFIG_STRING_PRS_SYMBOL_START, NULL, 0, uptr:NULL, defintval:7, TYPE_UINT, 0}, \ +{CONFIG_STRING_PRS_NUM_SYMBOLS, NULL, 0, uptr:NULL, defintval:4, TYPE_UINT, 0}, \ +{CONFIG_STRING_PRS_NUM_RB, NULL, 0, uptr:NULL, defintval:106, TYPE_UINT, 0}, \ +{CONFIG_STRING_PRS_RB_OFFSET, NULL, 0, uptr:NULL, defintval:0, TYPE_UINT, 0}, \ +{CONFIG_STRING_PRS_COMB_SIZE, NULL, 0, uptr:NULL, defintval:4, TYPE_UINT, 0}, \ +{CONFIG_STRING_PRS_RE_OFFSET, NULL, 0, uptr:NULL, defintval:0, TYPE_UINT, 0}, \ +{CONFIG_STRING_PRS_RESOURCE_OFFSET, NULL, 0, uptr:NULL, defintval:0, TYPE_UINT, 0}, \ +{CONFIG_STRING_PRS_RESOURCE_REPETITION, NULL, 0, uptr:NULL, defintval:1, TYPE_UINT, 0}, \ +{CONFIG_STRING_PRS_RESOURCE_TIME_GAP, NULL, 0, uptr:NULL, defuintval:1, TYPE_UINT, 0}, \ +{CONFIG_STRING_PRS_ID, NULL, 0, uptr:NULL, defintval:0, TYPE_UINT, 0} \ +} + +#define PRS_RESOURCE_SET_PERIOD0 0 +#define PRS_RESOURCE_SET_PERIOD1 1 +#define PRS_SYMBOL_START 2 +#define PRS_NUM_SYMBOLS 3 +#define PRS_NUM_RB 4 +#define PRS_RB_OFFSET 5 +#define PRS_COMB_SIZE 6 +#define PRS_RE_OFFSET 7 +#define PRS_RESOURCE_OFFSET 8 +#define PRS_RESOURCE_REPETITION 9 +#define PRS_RESOURCE_TIME_GAP 10 +#define PRS_ID 11 + +/*----------------------------------------------------------------------------------------------------------------------------------------------------*/ +#endif diff --git a/openair2/NR_UE_PHY_INTERFACE/NR_IF_Module.c b/openair2/NR_UE_PHY_INTERFACE/NR_IF_Module.c index c7b54950d7..ff0a20d5b3 100644 --- a/openair2/NR_UE_PHY_INTERFACE/NR_IF_Module.c +++ b/openair2/NR_UE_PHY_INTERFACE/NR_IF_Module.c @@ -39,6 +39,7 @@ #include "executables/softmodem-common.h" #include "openair2/RRC/NR_UE/rrc_proto.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 "targets/ARCH/ETHERNET/USERSPACE/LIB/if_defs.h" #include @@ -1274,3 +1275,44 @@ void RCconfig_nr_ue_L1(void) { } } } + +void RCconfig_nrUE_prs(void *cfg) +{ + int j = 0; + PHY_VARS_NR_UE *ue = (PHY_VARS_NR_UE *)cfg; + paramdef_t PRS_Params[] = PRS_PARAMS_DESC; + paramlist_def_t PRS_ParamList = {GNB_CONFIG_STRING_PRS_CONFIG,NULL,0}; + config_getlist( &PRS_ParamList,PRS_Params,sizeof(PRS_Params)/sizeof(paramdef_t), NULL); + printf("Inside RCconfig_nrUE_prs\n"); + + if (PRS_ParamList.numelt > 0) { + ue->prs_cfg.PRSResourceSetPeriod[0] = *(PRS_ParamList.paramarray[j][PRS_RESOURCE_SET_PERIOD0].uptr); + ue->prs_cfg.PRSResourceSetPeriod[1] = *(PRS_ParamList.paramarray[j][PRS_RESOURCE_SET_PERIOD1].uptr); + ue->prs_cfg.SymbolStart = *(PRS_ParamList.paramarray[j][PRS_SYMBOL_START].uptr); + ue->prs_cfg.NumPRSSymbols = *(PRS_ParamList.paramarray[j][PRS_NUM_SYMBOLS].uptr); + ue->prs_cfg.NumRB = *(PRS_ParamList.paramarray[j][PRS_NUM_RB].uptr); + ue->prs_cfg.RBOffset = *(PRS_ParamList.paramarray[j][PRS_RB_OFFSET].uptr); + ue->prs_cfg.CombSize = *(PRS_ParamList.paramarray[j][PRS_COMB_SIZE].uptr); + ue->prs_cfg.REOffset = *(PRS_ParamList.paramarray[j][PRS_RE_OFFSET].uptr); + ue->prs_cfg.PRSResourceOffset = *(PRS_ParamList.paramarray[j][PRS_RESOURCE_OFFSET].uptr); + ue->prs_cfg.PRSResourceRepetition = *(PRS_ParamList.paramarray[j][PRS_RESOURCE_REPETITION].uptr); + ue->prs_cfg.PRSResourceTimeGap = *(PRS_ParamList.paramarray[j][PRS_RESOURCE_TIME_GAP].uptr); + + LOG_I(NR_PHY, "PRS Config for at nrUE %d\n", 0); + LOG_I(NR_PHY, "PRSResourceSetPeriod0 %d\n", ue->prs_cfg.PRSResourceSetPeriod[0]); + LOG_I(NR_PHY, "PRSResourceSetPeriod1 %d\n", ue->prs_cfg.PRSResourceSetPeriod[1]); + LOG_I(NR_PHY, "SymbolStart %d\n", ue->prs_cfg.SymbolStart); + LOG_I(NR_PHY, "NumPRSSymbols %d\n", ue->prs_cfg.NumPRSSymbols); + LOG_I(NR_PHY, "NumRB %d\n", ue->prs_cfg.NumRB); + LOG_I(NR_PHY, "RBOffset %d\n", ue->prs_cfg.RBOffset); + LOG_I(NR_PHY, "CombSize %d\n", ue->prs_cfg.CombSize); + LOG_I(NR_PHY, "REOffset %d\n", ue->prs_cfg.REOffset); + LOG_I(NR_PHY, "PRSResourceOffset %d\n", ue->prs_cfg.PRSResourceOffset); + LOG_I(NR_PHY, "PRSResourceRepetition %d\n", ue->prs_cfg.PRSResourceRepetition); + LOG_I(NR_PHY, "PRSResourceTimeGap %d\n", ue->prs_cfg.PRSResourceTimeGap); + } + else + { + LOG_I(NR_PHY,"No " GNB_CONFIG_STRING_PRS_CONFIG " configuration found\n"); + } +} diff --git a/openair2/NR_UE_PHY_INTERFACE/NR_IF_Module.h b/openair2/NR_UE_PHY_INTERFACE/NR_IF_Module.h index 2a8a514769..f1c881ffc4 100755 --- a/openair2/NR_UE_PHY_INTERFACE/NR_IF_Module.h +++ b/openair2/NR_UE_PHY_INTERFACE/NR_IF_Module.h @@ -278,5 +278,7 @@ 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); +void RCconfig_nrUE_prs(void *cfg); + #endif diff --git a/targets/PROJECTS/GENERIC-NR-5GC/CONF/gnb.sa.band78.fr1.106PRB.usrpb210.conf b/targets/PROJECTS/GENERIC-NR-5GC/CONF/gnb.sa.band78.fr1.106PRB.usrpb210.conf index d9b62064c1..068d4291c3 100644 --- a/targets/PROJECTS/GENERIC-NR-5GC/CONF/gnb.sa.band78.fr1.106PRB.usrpb210.conf +++ b/targets/PROJECTS/GENERIC-NR-5GC/CONF/gnb.sa.band78.fr1.106PRB.usrpb210.conf @@ -43,6 +43,7 @@ gNBs = searchSpaceZero = 0; } ); + servingCellConfigCommon = ( { @@ -214,6 +215,23 @@ 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; +} +); + L1s = ( { num_cc = 1;