diff --git a/common/utils/nr/nr_common.h b/common/utils/nr/nr_common.h index bdd10e789671f23ff47091d6072c37eb8d95dc77..88444182633fd2e4f326d66003486970876fc836 100644 --- a/common/utils/nr/nr_common.h +++ b/common/utils/nr/nr_common.h @@ -142,7 +142,7 @@ typedef struct frame_structure_s { int8_t numb_slots_frame; int8_t numb_slots_period; int8_t numb_period_frame; - bool is_tdd; + frame_type_t frame_type; } frame_structure_t; typedef struct { diff --git a/openair1/SCHED_NR/phy_frame_config_nr.c b/openair1/SCHED_NR/phy_frame_config_nr.c index bff35ce4fffd8f67b080d6cccc4b9a4e0ff69060..63fd570b4c01deb36e5f88e6076ee9f4a51823a6 100644 --- a/openair1/SCHED_NR/phy_frame_config_nr.c +++ b/openair1/SCHED_NR/phy_frame_config_nr.c @@ -395,7 +395,7 @@ void free_tdd_configuration_dedicated_nr(NR_DL_FRAME_PARMS *frame_parms) { void do_tdd_config_sim(PHY_VARS_gNB *gNB, int mu) { - frame_structure_t fs = {.is_tdd = true}; + frame_structure_t fs = {.frame_type = TDD}; fs.numb_slots_frame = (1 << mu) * NR_NUMBER_OF_SUBFRAMES_PER_FRAME; fs.numb_period_frame = get_nb_periods_per_frame(gNB->gNB_config.tdd_table.tdd_period.value); fs.numb_slots_period = fs.numb_slots_frame / fs.numb_period_frame; diff --git a/openair2/LAYER2/NR_MAC_gNB/config.c b/openair2/LAYER2/NR_MAC_gNB/config.c index 5e9c466e031d931a57bcc10a823c272c8e4b5913..0a511defafb00032f7417ecbfc903a4061e97e91 100644 --- a/openair2/LAYER2/NR_MAC_gNB/config.c +++ b/openair2/LAYER2/NR_MAC_gNB/config.c @@ -380,7 +380,7 @@ int get_first_ul_slot(const frame_structure_t *fs, bool mixed) { DevAssert(fs); - if (fs->is_tdd) { + if (fs->frame_type == TDD) { for (int i = 0; i < fs->numb_slots_period; i++) { if ((mixed && is_ul_slot(i, fs)) || fs->period_cfg.tdd_slot_bitmap[i].slot_type == TDD_NR_UPLINK_SLOT) { return i; @@ -396,7 +396,7 @@ int get_first_ul_slot(const frame_structure_t *fs, bool mixed) */ int get_dl_slots_per_period(const frame_structure_t *fs) { - return fs->is_tdd ? fs->period_cfg.num_dl_slots : fs->numb_slots_frame; + return fs->frame_type == TDD ? fs->period_cfg.num_dl_slots : fs->numb_slots_frame; } /** @@ -404,7 +404,7 @@ int get_dl_slots_per_period(const frame_structure_t *fs) */ int get_ul_slots_per_period(const frame_structure_t *fs) { - return fs->is_tdd ? fs->period_cfg.num_ul_slots : fs->numb_slots_frame; + return fs->frame_type == TDD ? fs->period_cfg.num_ul_slots : fs->numb_slots_frame; } /** @@ -416,7 +416,7 @@ int get_full_ul_slots_per_period(const frame_structure_t *fs) { DevAssert(fs); - if (!fs->is_tdd) + if (fs->frame_type == FDD) return fs->numb_slots_frame; int count = 0; @@ -438,7 +438,7 @@ int get_full_dl_slots_per_period(const frame_structure_t *fs) { DevAssert(fs); - if (!fs->is_tdd) + if (fs->frame_type == FDD) return fs->numb_slots_frame; int count = 0; @@ -456,7 +456,7 @@ int get_full_dl_slots_per_period(const frame_structure_t *fs) */ int get_ul_slots_per_frame(const frame_structure_t *fs) { - return fs->is_tdd ? fs->numb_period_frame * get_ul_slots_per_period(fs) : fs->numb_slots_frame; + return fs->frame_type == TDD ? fs->numb_period_frame * get_ul_slots_per_period(fs) : fs->numb_slots_frame; } /** @@ -471,7 +471,7 @@ int get_ul_slot_offset(const frame_structure_t *fs, int idx, bool count_mixed) DevAssert(fs); // FDD - if (!fs->is_tdd) + if (fs->frame_type == FDD) return idx; // UL slots indexes in period @@ -514,10 +514,10 @@ void config_frame_structure(int mu, if (frame_type == TDD) { fs->numb_period_frame = get_nb_periods_per_frame(tdd_period); fs->numb_slots_period = fs->numb_slots_frame / fs->numb_period_frame; - fs->is_tdd = true; + fs->frame_type = TDD; config_tdd_patterns(scc->tdd_UL_DL_ConfigurationCommon, fs); } else { // FDD - fs->is_tdd = false; + fs->frame_type = FDD; fs->numb_period_frame = 1; fs->numb_slots_period = fs->numb_slots_frame; } diff --git a/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler.c b/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler.c index c6a42324d9f6fe355c7dbfe178e34aa5eaee7b36..73e09f6e13ef89fac2fc72e78d89e3ebb0cb47d0 100644 --- a/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler.c +++ b/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler.c @@ -126,7 +126,7 @@ static void clear_beam_information(NR_beam_info_t *beam_info, int frame, int slo */ bool is_ul_slot(const slot_t slot, const frame_structure_t *fs) { - if (!fs->is_tdd) + if (fs->frame_type == FDD) return true; const tdd_period_config_t *pc = &fs->period_cfg; slot_t s = get_slot_idx_in_period(slot, fs); @@ -142,7 +142,7 @@ bool is_ul_slot(const slot_t slot, const frame_structure_t *fs) */ bool is_dl_slot(const slot_t slot, const frame_structure_t *fs) { - if (!fs->is_tdd) + if (fs->frame_type == FDD) return true; const tdd_period_config_t *pc = &fs->period_cfg; slot_t s = get_slot_idx_in_period(slot, fs); @@ -156,7 +156,7 @@ bool is_dl_slot(const slot_t slot, const frame_structure_t *fs) */ bool is_mixed_slot(const slot_t slot, const frame_structure_t *fs) { - if (!fs->is_tdd) + if (fs->frame_type == FDD) return false; slot_t s = get_slot_idx_in_period(slot, fs); const tdd_period_config_t *pc = &fs->period_cfg; diff --git a/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_RA.c b/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_RA.c index 5981381bb39ad9287560ae37bc6e7b06057aaf7e..2d91fb7ffe61662a1faae60f085487ff18c71d0f 100644 --- a/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_RA.c +++ b/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_RA.c @@ -971,7 +971,7 @@ static bool get_feasible_msg3_tda(const NR_ServingCellConfigCommon_t *scc, int abs_slot = slot + k2 + mu_delta; int temp_frame = (frame + (abs_slot / slots_per_frame)) & 1023; int temp_slot = abs_slot % slots_per_frame; // msg3 slot according to 8.3 in 38.213 - if (fs->is_tdd && !is_ul_slot(temp_slot, fs)) + if (fs->frame_type == TDD && !is_ul_slot(temp_slot, fs)) continue; const tdd_bitmap_t *tdd_slot_bitmap = fs->period_cfg.tdd_slot_bitmap; diff --git a/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_dlsch.c b/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_dlsch.c index b63eb010a11fc4aee89678b6dfa4e3e008837e29..231e5c2e99bb04c7a3daffd73fc373cc49e533c3 100644 --- a/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_dlsch.c +++ b/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_dlsch.c @@ -61,7 +61,7 @@ int get_dl_tda(const gNB_MAC_INST *nrmac, int slot) if (nrmac->UE_info.sched_csirs > 0) return 1; - if (fs->is_tdd) { + if (fs->frame_type == TDD) { int s = get_slot_idx_in_period(slot, fs); // if there is a mixed slot where we can transmit DL const tdd_bitmap_t *tdd_slot_bitmap = fs->period_cfg.tdd_slot_bitmap; diff --git a/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_uci.c b/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_uci.c index 90cd1a4654959654261c6ab363f9430f995a0228..1fcceae2b98c301f3383d3daece884cc2e760333 100644 --- a/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_uci.c +++ b/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_uci.c @@ -1036,7 +1036,7 @@ int nr_acknack_scheduling(gNB_MAC_INST *mac, continue; const int pucch_slot = (slot + pdsch_to_harq_feedback[f] + NTN_gNB_Koffset) % n_slots_frame; // check if the slot is UL - if (fs->is_tdd) { + if (fs->frame_type == TDD) { int mod_slot = pucch_slot % fs->numb_slots_period; if (!is_ul_slot(mod_slot, fs)) continue; diff --git a/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_ulsch.c b/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_ulsch.c index c67af3bb3b9ddb4ba9d9f0ce0b85c359fda48f16..8eff77ef8202de41f4d434ad4125e9245bc81eed 100644 --- a/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_ulsch.c +++ b/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_ulsch.c @@ -48,7 +48,7 @@ int get_ul_tda(gNB_MAC_INST *nrmac, int frame, int slot) /* there is a mixed slot only when in TDD */ frame_structure_t *fs = &nrmac->frame_structure; - if (fs->is_tdd) { + if (fs->frame_type == TDD) { // if there is uplink symbols in mixed slot int s = get_slot_idx_in_period(slot, fs); tdd_bitmap_t *tdd_slot_bitmap = fs->period_cfg.tdd_slot_bitmap; @@ -1535,7 +1535,7 @@ static bool nr_UE_is_to_be_scheduled(const frame_structure_t *fs, * Force the default transmission in a full slot as early * as possible in the UL portion of TDD period (last_ul_slot) */ int num_slots_per_period = fs->numb_slots_period; - int last_ul_slot = fs->is_tdd ? get_first_ul_slot(fs, false) : sched_ctrl->last_ul_slot; + int last_ul_slot = fs->frame_type == TDD ? get_first_ul_slot(fs, false) : sched_ctrl->last_ul_slot; const int last_ul_sched = sched_ctrl->last_ul_frame * n + last_ul_slot; const int diff = (now - last_ul_sched + 1024 * n) % (1024 * n); /* UE is to be scheduled if diff --git a/openair2/RRC/NR/nr_rrc_config.c b/openair2/RRC/NR/nr_rrc_config.c index d2266a74f3e02784a92536443c352e0b0f73a105..4fe0a2d764b81034e1d6e1433fbf3b444a6faad1 100644 --- a/openair2/RRC/NR/nr_rrc_config.c +++ b/openair2/RRC/NR/nr_rrc_config.c @@ -1262,7 +1262,7 @@ static void set_SR_periodandoffset(NR_SchedulingRequestResourceConfig_t *schedul { const frame_structure_t *fs = &RC.nrmac[0]->frame_structure; int sr_slot = 1; // in FDD SR in slot 1 - if (fs->is_tdd) + if (fs->frame_type == TDD) sr_slot = get_first_ul_slot(fs, true); schedulingRequestResourceConfig->periodicityAndOffset = calloc(1,sizeof(*schedulingRequestResourceConfig->periodicityAndOffset));