MAC gNB: implement and use is_type0_occasion()

Implement the Type0-PDCCH occasion helper for reusability and
use it in schedule_nr_sib1. Adopt in a descendant commit
in PCCH scheduling as well.

Changes:
- gNB_scheduler_primitives.c: add is_type0_occasion()
- gNB_scheduler_bch.c: in schedule_nr_sib1, replace inline code
  with is_type0_occasion
- Rename check_frame_sib1 to check_frame_type0, as it is not
  limited to sib1 but applies to PCCH as well.

Signed-off-by: Guido Casati <guido.casati@openairinterface.org>
This commit is contained in:
Guido Casati
2026-02-25 17:58:26 +01:00
parent 096a107704
commit a1162f9fd3
3 changed files with 23 additions and 16 deletions

View File

@@ -461,17 +461,6 @@ static bool check_sib1_tda(gNB_MAC_INST *gNB_mac,
}
}
/** @brief Returns true if @param frame contains a Type0-PDCCH CSS monitoring occasion (TS 38.213 Clause 13). */
static bool check_frame_sib1(const NR_ServingCellConfigCommon_t *scc, const NR_Type0_PDCCH_CSS_config_t *type0, int frame)
{
if (type0->type0_pdcch_ss_mux_pattern == 1)
return (frame % 2) == type0->sfn_c;
DevAssert(scc->ssb_periodicityServingCell);
long ssb_period = *scc->ssb_periodicityServingCell; // every how many frames SSB are generated
int ssb_frame_periodicity = (ssb_period > 1) ? (1 << (ssb_period - 1)) : 1; // 0 is every half frame
return (frame % ssb_frame_periodicity) == 0;
}
void schedule_nr_sib1(module_id_t module_idP,
frame_t frameP,
slot_t slotP,
@@ -490,11 +479,7 @@ void schedule_nr_sib1(module_id_t module_idP,
NR_Type0_PDCCH_CSS_config_t *type0_PDCCH_CSS_config = &gNB_mac->type0_PDCCH_CSS_config[i];
if(check_frame_sib1(scc, type0_PDCCH_CSS_config, frameP) &&
(slotP == type0_PDCCH_CSS_config->slot) &&
(type0_PDCCH_CSS_config->num_rbs > 0) &&
(type0_PDCCH_CSS_config->active == true)) {
if (is_type0_occasion(scc, type0_PDCCH_CSS_config, frameP, slotP) && type0_PDCCH_CSS_config->num_rbs > 0) {
AssertFatal(is_dl_slot(slotP, &gNB_mac->frame_structure),
"Trying to schedule SIB1 for SSB %d in slot %d which is not DL. Check searchSpaceZero configuration.\n",
type0_PDCCH_CSS_config->ssb_index,

View File

@@ -3776,6 +3776,26 @@ int get_max_ssbs(const NR_ServingCellConfigCommon_t *scc)
}
}
/** @brief Returns true if @param frame contains a Type0-PDCCH CSS monitoring occasion (TS 38.213 Clause 13). */
static bool check_frame_type0(const long *ssb_periodicityServingCell, const NR_Type0_PDCCH_CSS_config_t *type0, int frame)
{
if (type0->type0_pdcch_ss_mux_pattern == 1)
return (frame % 2) == type0->sfn_c;
DevAssert(ssb_periodicityServingCell);
long ssb_period = *ssb_periodicityServingCell; // every how many frames SSB are generated
int ssb_frame_periodicity = (ssb_period > 1) ? (1 << (ssb_period - 1)) : 1; // 0 is every half frame
return (frame % ssb_frame_periodicity) == 0;
}
/** @brief True if @param frame, @param slot is the Type0-PDCCH CSS monitoring occasion
* for @param type0 (TS 38.213 Clause 13). Used by SIB1 and paging (SearchSpaceId = 0) scheduling. */
bool is_type0_occasion(NR_ServingCellConfigCommon_t *scc, const NR_Type0_PDCCH_CSS_config_t *type0, int frame, uint32_t slot)
{
DevAssert(scc);
DevAssert(type0);
return type0->active && (slot == type0->slot) && check_frame_type0(scc->ssb_periodicityServingCell, type0, frame);
}
uint64_t get_ssb_bitmap_and_len(const NR_ServingCellConfigCommon_t *scc, uint8_t *len)
{
switch (scc->ssb_PositionsInBurst->present) {

View File

@@ -219,6 +219,8 @@ NR_sched_pdcch_t set_pdcch_structure(gNB_MAC_INST *gNB_mac,
NR_BWP_t *bwp,
NR_Type0_PDCCH_CSS_config_t *type0_PDCCH_CSS_config);
bool is_type0_occasion(NR_ServingCellConfigCommon_t *scc, const NR_Type0_PDCCH_CSS_config_t *type0, int frame, uint32_t slot);
int find_pdcch_candidate(const gNB_MAC_INST *mac,
int cc_id,
int aggregation,