From 3dea00b006cb7c1ec87fc2e87f2c326e1cc08934 Mon Sep 17 00:00:00 2001 From: luis_pereira87 Date: Thu, 8 May 2025 08:49:35 +0100 Subject: [PATCH] Get and store CORESET start RB --- .../NR_MAC_gNB/gNB_scheduler_primitives.c | 18 +++++++++++++----- openair2/LAYER2/NR_MAC_gNB/nr_mac_gNB.h | 3 ++- 2 files changed, 15 insertions(+), 6 deletions(-) diff --git a/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_primitives.c b/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_primitives.c index 03ec701880..acb84a78f0 100644 --- a/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_primitives.c +++ b/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_primitives.c @@ -497,13 +497,21 @@ NR_sched_pdcch_t set_pdcch_structure(gNB_MAC_INST *gNB_mac, pdcch.ShiftIndex = 0; } - int N_rb = 0; // nb of rbs of coreset per symbol - for (int i=0;i<6;i++) { - for (int t=0;t<8;t++) { - N_rb+=((coreset->frequencyDomainResources.buf[i]>>t)&1); + uint16_t N_rb = 0; // nb of rbs of coreset per symbol + uint16_t rb_start = 0; + for (int i = 0; i < 6; i++) { + for (int t = 0; t < 8; t++) { + if (coreset->frequencyDomainResources.buf[i] >> (7 - t) & 1) { + if (N_rb == 0) { + rb_start = 48 * i + t * 6; + } + N_rb++; + } } } - pdcch.n_rb = N_rb*=6; // each bit of frequencyDomainResources represents 6 PRBs + + pdcch.rb_start = rb_start; + pdcch.n_rb = N_rb *= 6; // each bit of frequencyDomainResources represents 6 PRBs return pdcch; } diff --git a/openair2/LAYER2/NR_MAC_gNB/nr_mac_gNB.h b/openair2/LAYER2/NR_MAC_gNB/nr_mac_gNB.h index 1e7ac572ef..0b977de276 100644 --- a/openair2/LAYER2/NR_MAC_gNB/nr_mac_gNB.h +++ b/openair2/LAYER2/NR_MAC_gNB/nr_mac_gNB.h @@ -198,7 +198,8 @@ typedef struct NR_sched_pdcch { uint8_t InterleaverSize; uint16_t ShiftIndex; uint8_t DurationSymbols; - int n_rb; + uint16_t n_rb; + uint16_t rb_start; } NR_sched_pdcch_t; /*! \brief gNB template for the Random access information */