diff --git a/cmake_targets/CMakeLists.txt b/cmake_targets/CMakeLists.txt index c4015fa0cd8504b106c31f09a9cd94965a7c979f..03e2c2d8443f1375bc50b7569b2849d732aadd91 100644 --- a/cmake_targets/CMakeLists.txt +++ b/cmake_targets/CMakeLists.txt @@ -1452,7 +1452,7 @@ set (MAC_SRC ${MAC_DIR}/pre_processor.c ${MAC_DIR}/config.c ${MAC_DIR}/config_ue.c - ${NR_PHY_INTERFACE_DIR}/IF_Module.c + ${NR_PHY_INTERFACE_DIR}/NR_IF_Module.c ${NR_MAC_DIR}/main.c ${NR_MAC_DIR}/config.c ) diff --git a/openair1/PHY/INIT/nr_init.c b/openair1/PHY/INIT/nr_init.c index 00e1f678732b5074ff4798c423532a6f97674a1d..6c616bf62286708dd35e316dfc03a88e53a2a8a8 100644 --- a/openair1/PHY/INIT/nr_init.c +++ b/openair1/PHY/INIT/nr_init.c @@ -57,12 +57,12 @@ int l1_north_init_gNB() { for (j=0;j<RC.nb_L1_CC[i];j++) { AssertFatal(RC.gNB[i][j]!=NULL,"RC.gNB[%d][%d] is null\n",i,j); - if ((RC.gNB[i][j]->if_inst = IF_Module_init(i))<0) return(-1); + if ((RC.gNB[i][j]->if_inst = NR_IF_Module_init(i))<0) return(-1); LOG_I(PHY,"%s() RC.gNB[%d][%d] installing callbacks\n", __FUNCTION__, i, j); - RC.gNB[i][j]->if_inst->PHY_config_req = phy_config_request; - nr_phy_config_request(RC.gNB[i][j]); + RC.gNB[i][j]->if_inst->PHY_config_req = nr_phy_config_request; + nr_phy_config_request(&RC.gNB[i][j]->gNB_config); RC.gNB[i][j]->if_inst->schedule_response = schedule_response; } } @@ -338,7 +338,8 @@ void install_schedule_handlers(IF_Module_t *if_inst) }*/ /// this function is a temporary addition for NR configuration -void nr_phy_config_request(PHY_VARS_gNB *gNB) + +/*void nr_phy_config_request(PHY_VARS_gNB *gNB) { NR_DL_FRAME_PARMS *fp = &gNB->frame_parms; nfapi_config_request_t *gNB_config = &gNB->gNB_config; @@ -367,4 +368,63 @@ void nr_phy_config_request(PHY_VARS_gNB *gNB) gNB->configured = 1; LOG_I(PHY,"gNB configured\n"); +}*/ + + +void nr_phy_config_request(NR_PHY_Config_t *phy_config) +{ + + uint8_t Mod_id = phy_config->Mod_id; + int CC_id = phy_config->CC_id; + + NR_DL_FRAME_PARMS *fp = &RC.gNB[Mod_id][CC_id]->frame_parms; + nfapi_nr_config_request_t *gNB_config = &RC.gNB[Mod_id][CC_id]->gNB_config; + + + gNB_config->nfapi_config.rf_bands.rf_band[0] = phy_config->cfg->nfapi_config.rf_bands.rf_band[0]; //22 + gNB_config->nfapi_config.earfcn.value = phy_config->cfg->nfapi_config.earfcn.value; //6600 + gNB_config->subframe_config.numerology_index_mu.value = phy_config->cfg->subframe_config.numerology_index_mu.value;//1 + gNB_config->rf_config.tx_antenna_ports.value = phy_config->cfg->rf_config.tx_antenna_ports.value; //1 + gNB_config->rf_config.dl_carrierBandwidth.value = phy_config->cfg->rf_config.dl_carrierBandwidth.value;//106; + gNB_config->rf_config.ul_carrierBandwidth.value = phy_config->cfg->rf_config.ul_carrierBandwidth.value;//106; + gNB_config->sch_config.half_frame_index.value = 0; + gNB_config->sch_config.ssb_subcarrier_offset.value = phy_config->cfg->sch_config.ssb_subcarrier_offset.value;//0; + gNB_config->sch_config.n_ssb_crb.value = 86; + gNB_config->sch_config.physical_cell_id.value = phy_config->cfg->sch_config.physical_cell_id.value; + + if (phy_config->cfg->subframe_config.duplex_mode.value == 0) { + gNB_config->subframe_config.duplex_mode.value = TDD; + } + else { + gNB_config->subframe_config.duplex_mode.value = FDD; + } + + RC.gNB[Mod_id][CC_id]->mac_enabled = 1; + + fp->dl_CarrierFreq = from_earfcn(gNB_config->nfapi_config.rf_bands.rf_band[0],gNB_config->nfapi_config.earfcn.value); + fp->ul_CarrierFreq = fp->dl_CarrierFreq - (get_uldl_offset(gNB_config->nfapi_config.rf_bands.rf_band[0])*100000); + fp->threequarter_fs = 0; + + LOG_I(PHY,"Configuring MIB for instance %d, CCid %d : (band %d,N_RB_DL %d, N_RB_UL %d, Nid_cell %d,gNB_tx_antenna_ports %d,DL freq %u)\n", + Mod_id, + CC_id, + gNB_config->nfapi_config.rf_bands.rf_band[0], + gNB_config->rf_config.dl_carrierBandwidth.value, + gNB_config->rf_config.ul_carrierBandwidth.value, + gNB_config->sch_config.physical_cell_id.value, + gNB_config->rf_config.tx_antenna_ports.value, + fp->dl_CarrierFreq ); + + nr_init_frame_parms(gNB_config, fp); + + if (RC.gNB[Mod_id][CC_id]->configured == 1){ + LOG_E(PHY,"Already gNB already configured, do nothing\n"); + return; + } + + RC.gNB[Mod_id][CC_id]->configured = 1; + LOG_I(PHY,"gNB %d/%d configured\n",Mod_id,CC_id); + + + } diff --git a/openair1/PHY/INIT/phy_init.h b/openair1/PHY/INIT/phy_init.h index 40ec1bd308a9a29dbbdf20571ee5e72ed1c8e71c..26793bcad2ce4491ba3893da106e35a98550f75a 100644 --- a/openair1/PHY/INIT/phy_init.h +++ b/openair1/PHY/INIT/phy_init.h @@ -378,7 +378,7 @@ int nr_init_frame_parms(nfapi_config_request_t* config, NR_DL_FRAME_PARMS *frame int nr_init_frame_parms_ue(nfapi_config_request_t* config, NR_DL_FRAME_PARMS *frame_parms); void nr_dump_frame_parms(NR_DL_FRAME_PARMS *frame_parms); int phy_init_nr_gNB(PHY_VARS_gNB *gNB, unsigned char is_secondary_gNB, unsigned char abstraction_flag); -void nr_phy_config_request(PHY_VARS_gNB *gNB); +void nr_phy_config_request(NR_PHY_Config_t *gNB); void phy_free_nr_gNB(PHY_VARS_gNB *gNB); /** @} */ diff --git a/openair1/PHY/defs_NR.h b/openair1/PHY/defs_NR.h index bd48157700d4c6c419c29efee671661dd01d494e..ec9ab60922c2eabd48bf176ae752e100928f2f7e 100644 --- a/openair1/PHY/defs_NR.h +++ b/openair1/PHY/defs_NR.h @@ -114,7 +114,7 @@ typedef struct PHY_VARS_gNB_s { int (*te)(struct PHY_VARS_gNB_s *,uint8_t *,uint8_t,LTE_eNB_DLSCH_t *,int,uint8_t,time_stats_t *,time_stats_t *,time_stats_t *); int (*start_if)(struct RU_t_s *ru,struct PHY_VARS_gNB_s *eNB); uint8_t local_flag; - nfapi_config_request_t gNB_config; + nfapi_nr_config_request_t gNB_config; NR_DL_FRAME_PARMS frame_parms; PHY_MEASUREMENTS_gNB measurements; IF_Module_t *if_inst; diff --git a/openair1/PHY/defs_gNB.h b/openair1/PHY/defs_gNB.h index 9728d6b2d0726867e3a5ec57138c30eca6b5df82..c31b6a8d9ad4038b3c0eeee20a65fa5a845be4ad 100644 --- a/openair1/PHY/defs_gNB.h +++ b/openair1/PHY/defs_gNB.h @@ -35,7 +35,7 @@ #include "defs_eNB.h" #include "defs_nr_common.h" #include "CODING/nrPolar_tools/nr_polar_pbch_defs.h" - +#include "openair2/NR_PHY_INTERFACE/NR_IF_Module.h" typedef struct { uint8_t pbch_a[NR_POLAR_PBCH_PAYLOAD_BITS]; diff --git a/openair2/LAYER2/NR_MAC_gNB/mac.h b/openair2/LAYER2/NR_MAC_gNB/mac.h index 3f686949be13ed4219ad6984666304467b24ec2d..a7b351c0ade98ea432b39a2a7c54b6c93a356584 100644 --- a/openair2/LAYER2/NR_MAC_gNB/mac.h +++ b/openair2/LAYER2/NR_MAC_gNB/mac.h @@ -48,7 +48,7 @@ #include "nfapi_nr_interface.h" -#include "NR_PHY_INTERFACE/IF_Module.h" +#include "NR_PHY_INTERFACE/NR_IF_Module.h" #include "PHY/TOOLS/time_meas.h" diff --git a/openair2/NR_PHY_INTERFACE/IF_Module.c b/openair2/NR_PHY_INTERFACE/NR_IF_Module.c similarity index 98% rename from openair2/NR_PHY_INTERFACE/IF_Module.c rename to openair2/NR_PHY_INTERFACE/NR_IF_Module.c index 10a2958705c4c01c7055d940f384a269bea693de..7ce6f242bb34b335207f058f109d1b2782ebec0a 100644 --- a/openair2/NR_PHY_INTERFACE/IF_Module.c +++ b/openair2/NR_PHY_INTERFACE/NR_IF_Module.c @@ -1,5 +1,5 @@ #include "openair1/PHY/defs_eNB.h" -#include "openair2/NR_PHY_INTERFACE/IF_Module.h" +#include "openair2/NR_PHY_INTERFACE/NR_IF_Module.h" #include "openair1/PHY/phy_extern.h" #include "LAYER2/MAC/mac_extern.h" #include "LAYER2/NR_MAC_gNB/mac_proto.h" diff --git a/openair2/NR_PHY_INTERFACE/IF_Module.h b/openair2/NR_PHY_INTERFACE/NR_IF_Module.h similarity index 100% rename from openair2/NR_PHY_INTERFACE/IF_Module.h rename to openair2/NR_PHY_INTERFACE/NR_IF_Module.h diff --git a/targets/RT/USER/nr-ru.c b/targets/RT/USER/nr-ru.c index d3527354bb6b3ed1bd1ea4f15d39b02dd16a0475..773ae0b0b66b7b1d9a3266fae275983b4b4b985d 100644 --- a/targets/RT/USER/nr-ru.c +++ b/targets/RT/USER/nr-ru.c @@ -132,7 +132,7 @@ extern volatile int oai_exit; extern void nr_phy_init_RU(RU_t*); extern void nr_phy_free_RU(RU_t*); -extern void nr_phy_config_request(PHY_VARS_gNB *gNB); +extern void nr_phy_config_request(NR_PHY_Config_t *gNB); void init_RU(char*); void stop_RU(int nb_ru);