diff --git a/openair1/PHY/INIT/nr_init.c b/openair1/PHY/INIT/nr_init.c index 708f23e01a..3624f50e87 100644 --- a/openair1/PHY/INIT/nr_init.c +++ b/openair1/PHY/INIT/nr_init.c @@ -41,28 +41,25 @@ #include "SCHED_NR/fapi_nr_l1.h" #include "PHY/NR_REFSIG/ul_ref_seq_nr.h" -int l1_north_init_gNB() { +int l1_north_init_gNB() +{ + AssertFatal(RC.nb_nr_L1_inst > 0, "Failed to init PHY callbacks: nb_nr_L1_inst = %d\n", RC.nb_nr_L1_inst); + AssertFatal(RC.gNB != NULL, "Failed to init PHY callbacks: RC.gNB is null\n"); + LOG_I(NR_PHY, "RC.nb_nr_L1_inst = %d\n", RC.nb_nr_L1_inst); - if (RC.nb_nr_L1_inst > 0 && RC.gNB != NULL) { + for (uint8_t i = 0; i < RC.nb_nr_L1_inst; i++) { - AssertFatal(RC.nb_nr_L1_inst>0,"nb_nr_L1_inst=%d\n",RC.nb_nr_L1_inst); - AssertFatal(RC.gNB!=NULL,"RC.gNB is null\n"); - LOG_D(PHY, "%s() RC.nb_nr_L1_inst:%d\n", __FUNCTION__, RC.nb_nr_L1_inst); - - for (int i=0; iif_inst = NR_IF_Module_init(i))<0) return(-1); - - LOG_D(PHY, "%s() RC.gNB[%d] installing callbacks\n", __FUNCTION__, i); - RC.gNB[i]->if_inst->NR_PHY_config_req = nr_phy_config_request; - RC.gNB[i]->if_inst->NR_Schedule_response = nr_schedule_response; + if ((RC.gNB[i]->if_inst = NR_IF_Module_init(i)) < 0) { + LOG_E(NR_PHY, "Error: Failed to initialize NR_IF_Module for gNB[%d]\n", i); + return -1; } - } else { - LOG_D(PHY, "%s() Not installing PHY callbacks - RC.nb_nr_L1_inst:%d RC.gNB:%p\n", __FUNCTION__, RC.nb_nr_L1_inst, RC.gNB); + + LOG_D(NR_PHY, "RC.gNB[%d]: installing callbacks\n", i); + RC.gNB[i]->if_inst->NR_PHY_config_req = nr_phy_config_request; + RC.gNB[i]->if_inst->NR_Schedule_response = nr_schedule_response; } - return(0); + return 0; } NR_gNB_PHY_STATS_t *get_phy_stats(PHY_VARS_gNB *gNB, uint16_t rnti)