From aff31d45b40f9038d967abbdd287eb9b78b217ca Mon Sep 17 00:00:00 2001 From: francescomani Date: Sun, 3 Aug 2025 10:25:00 +0200 Subject: [PATCH 1/3] formatting --- .../NR_MAC_gNB/gNB_scheduler_primitives.c | 38 +++++++++---------- 1 file changed, 17 insertions(+), 21 deletions(-) diff --git a/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_primitives.c b/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_primitives.c index f8c842706c..e5f2939df8 100644 --- a/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_primitives.c +++ b/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_primitives.c @@ -429,32 +429,28 @@ NR_sched_pdcch_t set_pdcch_structure(gNB_MAC_INST *gNB_mac, NR_ControlResourceSet_t *coreset, NR_ServingCellConfigCommon_t *scc, NR_BWP_t *bwp, - NR_Type0_PDCCH_CSS_config_t *type0_PDCCH_CSS_config) { - - int sps; - NR_sched_pdcch_t pdcch; - + NR_Type0_PDCCH_CSS_config_t *type0_PDCCH_CSS_config) +{ AssertFatal(*ss->controlResourceSetId == coreset->controlResourceSetId, "coreset id in SS %ld does not correspond to the one in coreset %ld", *ss->controlResourceSetId, coreset->controlResourceSetId); + int sps; + NR_sched_pdcch_t pdcch; if (bwp) { // This is not for SIB1 - if(coreset->controlResourceSetId == 0){ - pdcch.BWPSize = gNB_mac->cset0_bwp_size; + if(coreset->controlResourceSetId == 0) { + pdcch.BWPSize = gNB_mac->cset0_bwp_size; pdcch.BWPStart = gNB_mac->cset0_bwp_start; - } - else { - pdcch.BWPSize = NRRIV2BW(bwp->locationAndBandwidth, MAX_BWP_SIZE); + } else { + pdcch.BWPSize = NRRIV2BW(bwp->locationAndBandwidth, MAX_BWP_SIZE); pdcch.BWPStart = NRRIV2PRBOFFSET(bwp->locationAndBandwidth, MAX_BWP_SIZE); } pdcch.SubcarrierSpacing = bwp->subcarrierSpacing; - pdcch.CyclicPrefix = (bwp->cyclicPrefix==NULL) ? 0 : *bwp->cyclicPrefix; - + pdcch.CyclicPrefix = (bwp->cyclicPrefix == NULL) ? 0 : *bwp->cyclicPrefix; //AssertFatal(pdcch_scs==kHz15, "PDCCH SCS above 15kHz not allowed if a symbol above 2 is monitored"); sps = bwp->cyclicPrefix == NULL ? 14 : 12; - } - else { - AssertFatal(type0_PDCCH_CSS_config!=NULL,"type0_PDCCH_CSS_config is null,bwp %p\n",bwp); + } else { + AssertFatal(type0_PDCCH_CSS_config != NULL, "type0_PDCCH_CSS_config is null,bwp %p\n", bwp); pdcch.BWPSize = type0_PDCCH_CSS_config->num_rbs; pdcch.BWPStart = type0_PDCCH_CSS_config->cset_start_rb; pdcch.SubcarrierSpacing = type0_PDCCH_CSS_config->scs_pdcch; @@ -462,15 +458,15 @@ NR_sched_pdcch_t set_pdcch_structure(gNB_MAC_INST *gNB_mac, sps = 14; } - AssertFatal(ss->monitoringSymbolsWithinSlot!=NULL,"ss->monitoringSymbolsWithinSlot is null\n"); - AssertFatal(ss->monitoringSymbolsWithinSlot->buf!=NULL,"ss->monitoringSymbolsWithinSlot->buf is null\n"); + AssertFatal(ss->monitoringSymbolsWithinSlot != NULL, "ss->monitoringSymbolsWithinSlot is null\n"); + BIT_STRING_t *symbolsInSlot = ss->monitoringSymbolsWithinSlot; + AssertFatal(symbolsInSlot->buf != NULL, "ss->monitoringSymbolsWithinSlot->buf is null\n"); // for SPS=14 8 MSBs in positions 13 downto 6 - uint16_t monitoringSymbolsWithinSlot = (ss->monitoringSymbolsWithinSlot->buf[0]<<(sps-8)) | - (ss->monitoringSymbolsWithinSlot->buf[1]>>(16-sps)); + int monitoringSymbolsWithinSlot = (symbolsInSlot->buf[0] << (sps - 8)) | (symbolsInSlot->buf[1] >> (16 - sps)); - for (int i=0; i>(sps-1-i))&1) { + for (int i = 0; i < sps; i++) { + if ((monitoringSymbolsWithinSlot >> (sps - 1 - i)) & 1) { pdcch.StartSymbolIndex=i; break; } From 7f4397a091f2da284fb416091fafd4a2cc7a956f Mon Sep 17 00:00:00 2001 From: francescomani Date: Sun, 3 Aug 2025 10:35:46 +0200 Subject: [PATCH 2/3] workaround to take into account SS0 1st symbol depending on SSB --- openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_primitives.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_primitives.c b/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_primitives.c index e5f2939df8..9828531c35 100644 --- a/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_primitives.c +++ b/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_primitives.c @@ -467,7 +467,7 @@ NR_sched_pdcch_t set_pdcch_structure(gNB_MAC_INST *gNB_mac, for (int i = 0; i < sps; i++) { if ((monitoringSymbolsWithinSlot >> (sps - 1 - i)) & 1) { - pdcch.StartSymbolIndex=i; + pdcch.StartSymbolIndex = ss->searchSpaceId == 0 ? i + type0_PDCCH_CSS_config->first_symbol_index : i; break; } } From 88ec5fb239a9de6395e5c9eea9f00f38228c5276 Mon Sep 17 00:00:00 2001 From: francescomani Date: Sun, 3 Aug 2025 10:41:16 +0200 Subject: [PATCH 3/3] highlighting UE LOG with sync SSC printed --- openair1/PHY/NR_UE_TRANSPORT/nr_initial_sync.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/openair1/PHY/NR_UE_TRANSPORT/nr_initial_sync.c b/openair1/PHY/NR_UE_TRANSPORT/nr_initial_sync.c index d5c2514634..da70fd50e8 100644 --- a/openair1/PHY/NR_UE_TRANSPORT/nr_initial_sync.c +++ b/openair1/PHY/NR_UE_TRANSPORT/nr_initial_sync.c @@ -147,7 +147,7 @@ static bool nr_pbch_detection(const UE_nr_rxtx_proc_t *proc, 1, 1); } - LOG_I(PHY, "Initial sync: pbch decoded sucessfully, ssb index %d\n", *ssb_index); + LOG_A(PHY, "Initial sync: pbch decoded sucessfully, ssb index %d\n", *ssb_index); return true; } }