From d994d537e91662557ca06f9e5fd2a89cc218fffa Mon Sep 17 00:00:00 2001 From: Roberto Rosca Date: Fri, 26 Jul 2024 10:43:03 +0300 Subject: [PATCH 1/5] Added sib19 structure with initialization --- openair2/GNB_APP/RRC_nr_paramsvalues.h | 14 ++++++++ openair2/GNB_APP/gnb_config.c | 34 ++++++++++++++++-- openair2/LAYER2/NR_MAC_gNB/config.c | 11 ++++++ openair2/LAYER2/NR_MAC_gNB/mac_proto.h | 1 + openair2/LAYER2/NR_MAC_gNB/nr_mac_gNB.h | 4 +++ openair2/RRC/NR/nr_rrc_config.c | 47 +++++++++++++++++++++++++ openair2/RRC/NR/nr_rrc_config.h | 4 +++ 7 files changed, 112 insertions(+), 3 deletions(-) diff --git a/openair2/GNB_APP/RRC_nr_paramsvalues.h b/openair2/GNB_APP/RRC_nr_paramsvalues.h index ddcd5ceafd..bfda253fbf 100644 --- a/openair2/GNB_APP/RRC_nr_paramsvalues.h +++ b/openair2/GNB_APP/RRC_nr_paramsvalues.h @@ -109,6 +109,13 @@ #define GNB_CONFIG_STRING_SSPBCHBLOCKPOWER "ssPBCH_BlockPower" #define GNB_CONFIG_STRING_CELLSPECIFICKOFFSET "cellSpecificKoffset_r17" +#define GNB_CONFIG_STRING_EPHEMERIS_POSITION_X "positionX-r17" +#define GNB_CONFIG_STRING_EPHEMERIS_POSITION_Y "positionY-r17" +#define GNB_CONFIG_STRING_EPHEMERIS_POSITION_Z "positionZ-r17" +#define GNB_CONFIG_STRING_EPHEMERIS_VELOCITY_VX "velocityVX-r17" +#define GNB_CONFIG_STRING_EPHEMERIS_VELOCITY_VY "velocityVY-r17" +#define GNB_CONFIG_STRING_EPHEMERIS_VELOCITY_VZ "velocityVZ-r17" +#define GNB_CONFIG_STRING_TA_COMMON "ta-Common-r17" #define CARRIERBANDWIDTH_OKVALUES {11,18,24,25,31,32,38,51,52,65,66,78,79,93,106,107,121,132,133,135,160,162,189,216,217,245,264,270,273} @@ -232,6 +239,13 @@ {GNB_CONFIG_STRING_NROFUPLINKSYMBOLS2,NULL,0,.i64ptr=&scc->tdd_UL_DL_ConfigurationCommon->pattern2->nrofUplinkSymbols,.defint64val=-1,TYPE_INT64,0},\ {GNB_CONFIG_STRING_SSPBCHBLOCKPOWER,NULL,0,.i64ptr=&scc->ss_PBCH_BlockPower,.defint64val=20,TYPE_INT64,0}, \ {GNB_CONFIG_STRING_CELLSPECIFICKOFFSET,NULL,0,.i64ptr=scc->ext2->ntn_Config_r17->cellSpecificKoffset_r17,.defint64val=0,TYPE_INT64,0}, \ +{GNB_CONFIG_STRING_EPHEMERIS_POSITION_X,NULL,0,.i64ptr=&scc->ext2->ntn_Config_r17->ephemerisInfo_r17->choice.positionVelocity_r17->positionX_r17,.defint64val=LONG_MAX,TYPE_INT64,0}, \ +{GNB_CONFIG_STRING_EPHEMERIS_POSITION_Y,NULL,0,.i64ptr=&scc->ext2->ntn_Config_r17->ephemerisInfo_r17->choice.positionVelocity_r17->positionY_r17,.defint64val=LONG_MAX,TYPE_INT64,0}, \ +{GNB_CONFIG_STRING_EPHEMERIS_POSITION_Z,NULL,0,.i64ptr=&scc->ext2->ntn_Config_r17->ephemerisInfo_r17->choice.positionVelocity_r17->positionZ_r17,.defint64val=LONG_MAX,TYPE_INT64,0}, \ +{GNB_CONFIG_STRING_EPHEMERIS_VELOCITY_VX,NULL,0,.i64ptr=&scc->ext2->ntn_Config_r17->ephemerisInfo_r17->choice.positionVelocity_r17->velocityVX_r17,.defint64val=LONG_MAX,TYPE_INT64,0}, \ +{GNB_CONFIG_STRING_EPHEMERIS_VELOCITY_VY,NULL,0,.i64ptr=&scc->ext2->ntn_Config_r17->ephemerisInfo_r17->choice.positionVelocity_r17->velocityVY_r17,.defint64val=LONG_MAX,TYPE_INT64,0}, \ +{GNB_CONFIG_STRING_EPHEMERIS_VELOCITY_VZ,NULL,0,.i64ptr=&scc->ext2->ntn_Config_r17->ephemerisInfo_r17->choice.positionVelocity_r17->velocityVZ_r17,.defint64val=LONG_MAX,TYPE_INT64,0}, \ +{GNB_CONFIG_STRING_TA_COMMON,NULL,0,.i64ptr=&scc->ext2->ntn_Config_r17->ta_Info_r17->ta_Common_r17,.defint64val=-1,TYPE_INT64,0}, \ {GNB_CONFIG_STRING_MSG1SUBCARRIERSPACING,NULL,0,.i64ptr=scc->uplinkConfigCommon->initialUplinkBWP->rach_ConfigCommon->choice.setup->msg1_SubcarrierSpacing,.defintval=-1,TYPE_INT64,0}} /*-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------*/ diff --git a/openair2/GNB_APP/gnb_config.c b/openair2/GNB_APP/gnb_config.c index 57e081b0e9..000b9f563c 100644 --- a/openair2/GNB_APP/gnb_config.c +++ b/openair2/GNB_APP/gnb_config.c @@ -216,6 +216,13 @@ void prepare_scc(NR_ServingCellConfigCommon_t *scc) { scc->ext2 = CALLOC(1, sizeof(*scc->ext2)); scc->ext2->ntn_Config_r17 = CALLOC(1, sizeof(*scc->ext2->ntn_Config_r17)); scc->ext2->ntn_Config_r17->cellSpecificKoffset_r17 = CALLOC(1, sizeof(*scc->ext2->ntn_Config_r17->cellSpecificKoffset_r17)); + + scc->ext2->ntn_Config_r17->ephemerisInfo_r17 = CALLOC(1, sizeof(*scc->ext2->ntn_Config_r17->ephemerisInfo_r17)); + scc->ext2->ntn_Config_r17->ta_Info_r17 = CALLOC(1, sizeof(*scc->ext2->ntn_Config_r17->ta_Info_r17)); + + scc->ext2->ntn_Config_r17->ephemerisInfo_r17->present = NR_EphemerisInfo_r17_PR_positionVelocity_r17; + scc->ext2->ntn_Config_r17->ephemerisInfo_r17->choice.positionVelocity_r17 = + CALLOC(1, sizeof(*scc->ext2->ntn_Config_r17->ephemerisInfo_r17->choice.positionVelocity_r17)); } // Section 4.1 in 38.213 @@ -436,8 +443,27 @@ void fix_scc(NR_ServingCellConfigCommon_t *scc, uint64_t ssbmap) AssertFatal(*scc->uplinkConfigCommon->initialUplinkBWP->pucch_ConfigCommon->choice.setup->pucch_ResourceCommon < 2, "pucch_ResourceConfig should be 0 or 1 for now\n"); - if(*scc->ext2->ntn_Config_r17->cellSpecificKoffset_r17 == 0) { + if (*scc->ext2->ntn_Config_r17->cellSpecificKoffset_r17 == 0) { free(scc->ext2->ntn_Config_r17->cellSpecificKoffset_r17); + scc->ext2->ntn_Config_r17->cellSpecificKoffset_r17 = NULL; + } + if (scc->ext2->ntn_Config_r17->ta_Info_r17->ta_Common_r17 == -1) { + free(scc->ext2->ntn_Config_r17->ta_Info_r17); + scc->ext2->ntn_Config_r17->ta_Info_r17 = NULL; + } + if (scc->ext2->ntn_Config_r17->ephemerisInfo_r17->choice.positionVelocity_r17->positionX_r17 == LONG_MAX + && scc->ext2->ntn_Config_r17->ephemerisInfo_r17->choice.positionVelocity_r17->positionY_r17 == LONG_MAX + && scc->ext2->ntn_Config_r17->ephemerisInfo_r17->choice.positionVelocity_r17->positionZ_r17 == LONG_MAX + && scc->ext2->ntn_Config_r17->ephemerisInfo_r17->choice.positionVelocity_r17->velocityVX_r17 == LONG_MAX + && scc->ext2->ntn_Config_r17->ephemerisInfo_r17->choice.positionVelocity_r17->velocityVY_r17 == LONG_MAX + && scc->ext2->ntn_Config_r17->ephemerisInfo_r17->choice.positionVelocity_r17->velocityVZ_r17 == LONG_MAX) { + free(scc->ext2->ntn_Config_r17->ephemerisInfo_r17->choice.positionVelocity_r17); + free(scc->ext2->ntn_Config_r17->ephemerisInfo_r17); + scc->ext2->ntn_Config_r17->ephemerisInfo_r17 = NULL; + } + + if (!scc->ext2->ntn_Config_r17->cellSpecificKoffset_r17 && !scc->ext2->ntn_Config_r17->ta_Info_r17 + && !scc->ext2->ntn_Config_r17->ephemerisInfo_r17) { free(scc->ext2->ntn_Config_r17); free(scc->ext2); scc->ext2 = NULL; @@ -1447,9 +1473,11 @@ void RCconfig_nr_macrlc(configmodule_interface_t *cfg) f1ap_served_cell_info_t info; read_du_cell_info(cfg, NODE_IS_DU(node_type), &gnb_id, &gnb_du_id, &name, &info, 1); - if (get_softmodem_params()->sa) + if (get_softmodem_params()->sa) { nr_mac_configure_sib1(RC.nrmac[0], &info.plmn, info.nr_cellid, *info.tac); - + nr_mac_configure_sib19(RC.nrmac[0]); + } + // read F1 Setup information from config and generated MIB/SIB1 // and store it at MAC for sending later NR_BCCH_BCH_Message_t *mib = RC.nrmac[0]->common_channels[0].mib; diff --git a/openair2/LAYER2/NR_MAC_gNB/config.c b/openair2/LAYER2/NR_MAC_gNB/config.c index e0e11c5f2f..944d4af46d 100644 --- a/openair2/LAYER2/NR_MAC_gNB/config.c +++ b/openair2/LAYER2/NR_MAC_gNB/config.c @@ -709,6 +709,17 @@ void nr_mac_configure_sib1(gNB_MAC_INST *nrmac, const f1ap_plmn_t *plmn, uint64_ AssertFatal(cc->sib1_bcch_length > 0, "could not encode SIB1\n"); } +void nr_mac_configure_sib19(gNB_MAC_INST *nrmac) +{ + AssertFatal(get_softmodem_params()->sa > 0, "error: SIB19 only applicable for SA\n"); + NR_COMMON_channels_t *cc = &nrmac->common_channels[0]; + NR_ServingCellConfigCommon_t *scc = cc->ServingCellConfigCommon; + NR_BCCH_DL_SCH_Message_t *sib19 = get_SIB19_NR(scc); + cc->sib19 = sib19; + cc->sib19_bcch_length = encode_SIB19_NR(sib19, cc->sib19_bcch_pdu, sizeof(cc->sib19_bcch_pdu)); + AssertFatal(cc->sib19_bcch_length > 0, "could not encode SIB19\n"); +} + bool nr_mac_add_test_ue(gNB_MAC_INST *nrmac, uint32_t rnti, NR_CellGroupConfig_t *CellGroup) { /* ideally, instead of this function, "users" of this function should call diff --git a/openair2/LAYER2/NR_MAC_gNB/mac_proto.h b/openair2/LAYER2/NR_MAC_gNB/mac_proto.h index 9011e13f75..33933be4d7 100644 --- a/openair2/LAYER2/NR_MAC_gNB/mac_proto.h +++ b/openair2/LAYER2/NR_MAC_gNB/mac_proto.h @@ -47,6 +47,7 @@ void nr_mac_send_f1_setup_req(void); void nr_mac_config_scc(gNB_MAC_INST *nrmac, NR_ServingCellConfigCommon_t *scc, const nr_mac_config_t *mac_config); void nr_mac_configure_sib1(gNB_MAC_INST *nrmac, const f1ap_plmn_t *plmn, uint64_t cellID, int tac); +void nr_mac_configure_sib19(gNB_MAC_INST *nrmac); bool nr_mac_add_test_ue(gNB_MAC_INST *nrmac, uint32_t rnti, NR_CellGroupConfig_t *CellGroup); bool nr_mac_prepare_ra_ue(gNB_MAC_INST *nrmac, uint32_t rnti, NR_CellGroupConfig_t *CellGroup); diff --git a/openair2/LAYER2/NR_MAC_gNB/nr_mac_gNB.h b/openair2/LAYER2/NR_MAC_gNB/nr_mac_gNB.h index ea696faa71..51e403ae49 100644 --- a/openair2/LAYER2/NR_MAC_gNB/nr_mac_gNB.h +++ b/openair2/LAYER2/NR_MAC_gNB/nr_mac_gNB.h @@ -260,6 +260,7 @@ typedef struct { frame_type_t frame_type; NR_BCCH_BCH_Message_t *mib; NR_BCCH_DL_SCH_Message_t *sib1; + NR_BCCH_DL_SCH_Message_t *sib19; NR_ServingCellConfigCommon_t *ServingCellConfigCommon; /// pre-configured ServingCellConfig that is default for every UE NR_ServingCellConfig_t *pre_ServingCellConfig; @@ -268,6 +269,9 @@ typedef struct { /// Outgoing BCCH pdu for PHY uint8_t sib1_bcch_pdu[NR_MAX_SIB_LENGTH / 8]; int sib1_bcch_length; + /// used for sib19 data + uint8_t sib19_bcch_pdu[NR_MAX_SIB_LENGTH / 8]; + int sib19_bcch_length; /// Template for RA computations NR_RA_t ra[NR_NB_RA_PROC_MAX]; /// VRB map for common channels diff --git a/openair2/RRC/NR/nr_rrc_config.c b/openair2/RRC/NR/nr_rrc_config.c index 5631da4c0e..b5e75eba50 100644 --- a/openair2/RRC/NR/nr_rrc_config.c +++ b/openair2/RRC/NR/nr_rrc_config.c @@ -2454,6 +2454,53 @@ int encode_SIB1_NR(NR_BCCH_DL_SCH_Message_t *sib1, uint8_t *buffer, int max_buff return (enc_rval.encoded + 7) / 8; } +NR_BCCH_DL_SCH_Message_t *get_SIB19_NR(const NR_ServingCellConfigCommon_t *scc) +{ + NR_BCCH_DL_SCH_Message_t *sib_message = CALLOC(1, sizeof(NR_BCCH_DL_SCH_Message_t)); + sib_message->message.present = NR_BCCH_DL_SCH_MessageType_PR_c1; + sib_message->message.choice.c1 = CALLOC(1,sizeof(struct NR_BCCH_DL_SCH_MessageType__c1)); + sib_message->message.choice.c1->present = NR_BCCH_DL_SCH_MessageType__c1_PR_systemInformation; + sib_message->message.choice.c1->choice.systemInformation = CALLOC(1,sizeof(struct NR_SystemInformation)); + + struct NR_SystemInformation *sib = sib_message->message.choice.c1->choice.systemInformation; + sib->criticalExtensions.present = NR_SystemInformation__criticalExtensions_PR_systemInformation; + sib->criticalExtensions.choice.systemInformation = CALLOC(1, sizeof(struct NR_SystemInformation_IEs)); + + struct NR_SystemInformation_IEs *ies = sib->criticalExtensions.choice.systemInformation; + + SystemInformation_IEs__sib_TypeAndInfo__Member *sib19 = NULL; + sib19 = CALLOC(1, sizeof(SystemInformation_IEs__sib_TypeAndInfo__Member)); + sib19->present = NR_SystemInformation_IEs__sib_TypeAndInfo__Member_PR_sib19_v1700; + sib19->choice.sib19_v1700 = CALLOC(1, sizeof(struct NR_SIB19_r17)); + + // use ntn-config from NR_ServingCellConfigCommon_t + const int copy_result = asn_copy(&asn_DEF_NR_NTN_Config_r17, (void **) &sib19->choice.sib19_v1700->ntn_Config_r17, scc->ext2->ntn_Config_r17); + AssertFatal(copy_result == 0, "Was unable to copy ntn_Config_r17 from scc to SIB19 structure\n"); + + asn1cSeqAdd(&ies->sib_TypeAndInfo.list, sib19); + + if (LOG_DEBUGFLAG(DEBUG_ASN1)) { + xer_fprint(stdout, &asn_DEF_NR_BCCH_DL_SCH_Message, sib_message); + } + + return sib_message; +} + +int encode_SIB19_NR(NR_BCCH_DL_SCH_Message_t *sib19, uint8_t *buffer, int max_buffer_size) +{ + asn_enc_rval_t enc_rval; + + enc_rval = uper_encode_to_buffer(&asn_DEF_NR_BCCH_DL_SCH_Message, NULL, sib19, buffer, 150); + AssertFatal(enc_rval.encoded > 0, "ASN1 message encoding failed (%s, %lu)!\n", enc_rval.failed_type->name, enc_rval.encoded); + + return ((enc_rval.encoded + 7) / 8); +} + +void free_SIB19_NR(NR_BCCH_DL_SCH_Message_t *sib19) +{ + ASN_STRUCT_FREE(asn_DEF_NR_BCCH_DL_SCH_Message, sib19); +} + static NR_PhysicalCellGroupConfig_t *configure_phy_cellgroup(void) { NR_PhysicalCellGroupConfig_t *physicalCellGroupConfig = calloc(1, sizeof(*physicalCellGroupConfig)); diff --git a/openair2/RRC/NR/nr_rrc_config.h b/openair2/RRC/NR/nr_rrc_config.h index e3f4fed7cb..87640834e5 100644 --- a/openair2/RRC/NR/nr_rrc_config.h +++ b/openair2/RRC/NR/nr_rrc_config.h @@ -74,6 +74,10 @@ NR_BCCH_DL_SCH_Message_t *get_SIB1_NR(const NR_ServingCellConfigCommon_t *scc, void free_SIB1_NR(NR_BCCH_DL_SCH_Message_t *sib1); int encode_SIB1_NR(NR_BCCH_DL_SCH_Message_t *sib1, uint8_t *buffer, int max_buffer_size); +NR_BCCH_DL_SCH_Message_t *get_SIB19_NR(const NR_ServingCellConfigCommon_t *scc); +int encode_SIB19_NR(NR_BCCH_DL_SCH_Message_t *sib19, uint8_t *buffer, int max_buffer_size); +void free_SIB19_NR(NR_BCCH_DL_SCH_Message_t *sib19); + NR_CellGroupConfig_t *get_initial_cellGroupConfig(int uid, const NR_ServingCellConfigCommon_t *scc, const NR_ServingCellConfig_t *servingcellconfigdedicated, From b9d2f916bc7e154bf2e4d6e26da8b7b640210f6a Mon Sep 17 00:00:00 2001 From: Roberto Rosca Date: Mon, 29 Jul 2024 13:16:01 +0300 Subject: [PATCH 2/5] Added scheduling info for sib19 to sib1 --- openair2/RRC/NR/nr_rrc_config.c | 28 +++++++++++++++++++++++++++- 1 file changed, 27 insertions(+), 1 deletion(-) diff --git a/openair2/RRC/NR/nr_rrc_config.c b/openair2/RRC/NR/nr_rrc_config.c index b5e75eba50..1c3b3d0dc8 100644 --- a/openair2/RRC/NR/nr_rrc_config.c +++ b/openair2/RRC/NR/nr_rrc_config.c @@ -2244,6 +2244,29 @@ NR_BCCH_DL_SCH_Message_t *get_SIB1_NR(const NR_ServingCellConfigCommon_t *scc, asn1cSeqAdd(&sib1->si_SchedulingInfo->schedulingInfoList.list,schedulingInfo);*/ + // sib19 scheduling info + // this condition ensures ntn-config is initialized + if (scc->ext2 && scc->ext2->ntn_Config_r17) { + sib1->nonCriticalExtension = CALLOC(1, sizeof(struct NR_SIB1_v1610_IEs)); + sib1->nonCriticalExtension->nonCriticalExtension = CALLOC(1, sizeof(struct NR_SIB1_v1630_IEs)); + sib1->nonCriticalExtension->nonCriticalExtension->nonCriticalExtension = CALLOC(1, sizeof(struct NR_SIB1_v1700_IEs)); + + struct NR_SI_SchedulingInfo_v1700 *sib_v17_scheduling_info = CALLOC(1, sizeof(struct NR_SI_SchedulingInfo_v1700)); + + struct NR_SchedulingInfo2_r17 *si_schedulinginfo2_r17 = CALLOC(1, sizeof(struct NR_SchedulingInfo2_r17)); + si_schedulinginfo2_r17->si_BroadcastStatus_r17 = NR_SchedulingInfo2_r17__si_BroadcastStatus_r17_broadcasting; + si_schedulinginfo2_r17->si_WindowPosition_r17 = 2; + si_schedulinginfo2_r17->si_Periodicity_r17 = NR_SchedulingInfo2_r17__si_Periodicity_r17_rf16; + + struct NR_SIB_TypeInfo_v1700 *sib_type_info = CALLOC(1, sizeof(struct NR_SIB_TypeInfo_v1700)); + sib_type_info->sibType_r17.present = NR_SIB_TypeInfo_v1700__sibType_r17_PR_type1_r17; + sib_type_info->sibType_r17.choice.type1_r17 = NR_SIB_TypeInfo_v1700__sibType_r17__type1_r17_sibType19; + + asn1cSeqAdd(&si_schedulinginfo2_r17->sib_MappingInfo_r17.list, sib_type_info); + asn1cSeqAdd(&sib_v17_scheduling_info->schedulingInfoList2_r17.list, si_schedulinginfo2_r17); + sib1->nonCriticalExtension->nonCriticalExtension->nonCriticalExtension->si_SchedulingInfo_v1700 = sib_v17_scheduling_info; + } + // servingCellConfigCommon asn1cCalloc(sib1->servingCellConfigCommon, ServCellCom); NR_BWP_DownlinkCommon_t *initialDownlinkBWP = &ServCellCom->downlinkConfigCommon.initialDownlinkBWP; @@ -2434,7 +2457,10 @@ NR_BCCH_DL_SCH_Message_t *get_SIB1_NR(const NR_ServingCellConfigCommon_t *scc, // nonCriticalExtension // TODO: add nonCriticalExtension - //xer_fprint(stdout, &asn_DEF_NR_SIB1, (const void*)sib1_message->message.choice.c1->choice.systemInformationBlockType1); + if (LOG_DEBUGFLAG(DEBUG_ASN1)) { + xer_fprint(stdout, &asn_DEF_NR_SIB1, sib1_message->message.choice.c1->choice.systemInformationBlockType1); + } + return sib1_message; } From a197c0a41a4ed3b3214091f36d4ddc1b4fcf83bc Mon Sep 17 00:00:00 2001 From: Roberto Rosca Date: Mon, 5 Aug 2024 15:45:53 +0300 Subject: [PATCH 3/5] Schedule SIB19 based on scheduling info from SIB1 --- openair2/LAYER2/NR_MAC_COMMON/nr_mac_common.h | 2 + openair2/LAYER2/NR_MAC_gNB/gNB_scheduler.c | 6 +- openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_RA.c | 6 +- .../LAYER2/NR_MAC_gNB/gNB_scheduler_bch.c | 400 +++++++++++++++++- .../LAYER2/NR_MAC_gNB/gNB_scheduler_dlsch.c | 2 +- .../NR_MAC_gNB/gNB_scheduler_primitives.c | 16 +- .../LAYER2/NR_MAC_gNB/gNB_scheduler_ulsch.c | 2 +- openair2/LAYER2/NR_MAC_gNB/mac_proto.h | 9 +- openair2/LAYER2/NR_MAC_gNB/nr_mac_gNB.h | 15 + openair2/RRC/NR/nr_rrc_config.c | 2 +- 10 files changed, 445 insertions(+), 15 deletions(-) diff --git a/openair2/LAYER2/NR_MAC_COMMON/nr_mac_common.h b/openair2/LAYER2/NR_MAC_COMMON/nr_mac_common.h index b2fd085285..4ce1571390 100644 --- a/openair2/LAYER2/NR_MAC_COMMON/nr_mac_common.h +++ b/openair2/LAYER2/NR_MAC_COMMON/nr_mac_common.h @@ -231,6 +231,8 @@ NR_tda_info_t get_info_from_tda_tables(default_table_type_t table_type, int dmrs_TypeA_Position, int normal_CP); +NR_tda_info_t set_tda_info_from_list(NR_PDSCH_TimeDomainResourceAllocationList_t *tdalist, int tda_index); + default_table_type_t get_default_table_type(int mux_pattern); void fill_coresetZero(NR_ControlResourceSet_t *coreset0, NR_Type0_PDCCH_CSS_config_t *type0_PDCCH_CSS_config); diff --git a/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler.c b/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler.c index ad18ead1f4..5158a3c237 100644 --- a/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler.c +++ b/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler.c @@ -262,9 +262,11 @@ void gNB_dlsch_ulsch_scheduler(module_id_t module_idP, frame_t frame, sub_frame_ // This schedules MIB schedule_nr_mib(module_idP, frame, slot, &sched_info->DL_req); - // This schedules SIB1 - if (get_softmodem_params()->sa == 1) + // This schedules SIB1 and SIB19 + if (get_softmodem_params()->sa == 1) { schedule_nr_sib1(module_idP, frame, slot, &sched_info->DL_req, &sched_info->TX_req); + schedule_nr_sib19(module_idP, frame, slot, &sched_info->DL_req, &sched_info->TX_req); + } // This schedule PRACH if we are not in phy_test mode if (get_softmodem_params()->phy_test == 0) { diff --git a/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_RA.c b/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_RA.c index 160cde63f5..e42cc0bf9d 100644 --- a/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_RA.c +++ b/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_RA.c @@ -673,7 +673,7 @@ static void nr_generate_Msg3_retransmission(module_id_t module_idP, ul_dci_request_pdu->PDUSize = (uint8_t)(2+sizeof(nfapi_nr_dl_tti_pdcch_pdu)); pdcch_pdu_rel15 = &ul_dci_request_pdu->pdcch_pdu.pdcch_pdu_rel15; ul_dci_req->numPdus += 1; - nr_configure_pdcch(pdcch_pdu_rel15, coreset, &ra->sched_pdcch); + nr_configure_pdcch(pdcch_pdu_rel15, coreset, &ra->sched_pdcch, false); nr_mac->pdcch_pdu_idx[CC_id][coresetid] = pdcch_pdu_rel15; } @@ -1335,7 +1335,7 @@ static void nr_generate_Msg2(module_id_t module_idP, dl_tti_pdcch_pdu->PDUSize = (uint8_t)(2 + sizeof(nfapi_nr_dl_tti_pdcch_pdu)); dl_req->nPDUs += 1; pdcch_pdu_rel15 = &dl_tti_pdcch_pdu->pdcch_pdu.pdcch_pdu_rel15; - nr_configure_pdcch(pdcch_pdu_rel15, coreset, &ra->sched_pdcch); + nr_configure_pdcch(pdcch_pdu_rel15, coreset, &ra->sched_pdcch, false); nr_mac->pdcch_pdu_idx[CC_id][coresetid] = pdcch_pdu_rel15; } @@ -1577,7 +1577,7 @@ static void prepare_dl_pdus(gNB_MAC_INST *nr_mac, dl_tti_pdcch_pdu->PDUSize = (uint8_t)(2 + sizeof(nfapi_nr_dl_tti_pdcch_pdu)); dl_req->nPDUs += 1; pdcch_pdu_rel15 = &dl_tti_pdcch_pdu->pdcch_pdu.pdcch_pdu_rel15; - nr_configure_pdcch(pdcch_pdu_rel15, coreset, &ra->sched_pdcch); + nr_configure_pdcch(pdcch_pdu_rel15, coreset, &ra->sched_pdcch, false); nr_mac->pdcch_pdu_idx[CC_id][coresetid] = pdcch_pdu_rel15; } diff --git a/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_bch.c b/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_bch.c index 4e3133aff3..87b95f2e71 100644 --- a/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_bch.c +++ b/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_bch.c @@ -398,6 +398,128 @@ static uint32_t schedule_control_sib1(module_id_t module_id, return TBS; } + +static uint32_t schedule_control_other_si(module_id_t module_id, + int CC_id, + NR_Type0_PDCCH_CSS_config_t *type0_PDCCH_CSS_config, + int time_domain_allocation, + NR_pdsch_dmrs_t *dmrs_parms, + NR_tda_info_t *tda_info, + uint8_t candidate_idx, + uint16_t num_total_bytes) +{ + gNB_MAC_INST *gNB_mac = RC.nrmac[module_id]; + NR_COMMON_channels_t *cc = &gNB_mac->common_channels[CC_id]; + NR_ServingCellConfigCommon_t *scc = cc->ServingCellConfigCommon; + uint16_t *vrb_map = cc->vrb_map; + + if (gNB_mac->sched_osi == NULL){ + gNB_mac->sched_osi = calloc(1, sizeof(NR_UE_sched_osi_ctrl_t)); + struct NR_PDCCH_ConfigCommon__commonSearchSpaceList *commonSearchSpaceList = scc->downlinkConfigCommon->initialDownlinkBWP->pdcch_ConfigCommon->choice.setup->commonSearchSpaceList; + NR_SearchSpaceId_t osi_SearchSpace = *scc->downlinkConfigCommon->initialDownlinkBWP->pdcch_ConfigCommon->choice.setup->searchSpaceOtherSystemInformation; + AssertFatal(commonSearchSpaceList->list.count > 0, "common SearchSpace list has 0 elements\n"); + for (int i = 0; i < commonSearchSpaceList->list.count; i++) { + NR_SearchSpace_t * ss = commonSearchSpaceList->list.array[i]; + if (ss->searchSpaceId == osi_SearchSpace) + gNB_mac->sched_osi->search_space = ss; + } + AssertFatal(gNB_mac->sched_osi->search_space!=NULL,"SearchSpace cannot be null for RA\n"); + + gNB_mac->sched_osi->coreset = get_coreset(gNB_mac, scc, NULL, gNB_mac->sched_osi->search_space, NR_SearchSpace__searchSpaceType_PR_common); + gNB_mac->sched_osi->sched_pdcch = set_pdcch_structure(NULL, + gNB_mac->sched_osi->search_space, + gNB_mac->sched_osi->coreset, + scc, + NULL, + type0_PDCCH_CSS_config); + } + + NR_sched_pdsch_t *pdsch = &gNB_mac->sched_osi->sched_pdsch; + pdsch->time_domain_allocation = time_domain_allocation; + pdsch->dmrs_parms = *dmrs_parms; + pdsch->tda_info = *tda_info; + pdsch->mcs = 0; // starting from mcs 0 + gNB_mac->sched_osi->num_total_bytes = num_total_bytes; + + uint8_t nr_of_candidates; + + for (int i=0; i<3; i++) { + find_aggregation_candidates(&gNB_mac->sched_osi->aggregation_level, &nr_of_candidates, gNB_mac->sched_ctrlCommon->search_space,4<0) break; // choosing the lower value of aggregation level available + } + AssertFatal(nr_of_candidates>0,"nr_of_candidates is 0\n"); + gNB_mac->sched_osi->cce_index = find_pdcch_candidate(gNB_mac, + CC_id, + gNB_mac->sched_osi->aggregation_level, + nr_of_candidates, + &gNB_mac->sched_osi->sched_pdcch, + gNB_mac->sched_osi->coreset, + 0); + + AssertFatal(gNB_mac->sched_osi->cce_index >= 0, "Could not find CCE for coreset0\n"); + + const uint16_t bwpSize = type0_PDCCH_CSS_config->num_rbs; + int rbStart = type0_PDCCH_CSS_config->cset_start_rb; + + // Calculate number of PRB_DMRS + uint8_t N_PRB_DMRS = pdsch->dmrs_parms.N_PRB_DMRS; + uint16_t dmrs_length = pdsch->dmrs_parms.N_DMRS_SLOT; + LOG_D(MAC,"dlDmrsSymbPos %x\n",pdsch->dmrs_parms.dl_dmrs_symb_pos); + int mcsTableIdx = 0; + int rbSize = 0; + uint32_t TBS = 0; + do { + if(rbSize < bwpSize && !(vrb_map[rbStart + rbSize]&SL_to_bitmap(tda_info->startSymbolIndex, tda_info->nrOfSymbols))) + rbSize++; + else{ + if (pdsch->mcs<10) + pdsch->mcs++; + else + break; + } + TBS = nr_compute_tbs(nr_get_Qm_dl(pdsch->mcs, mcsTableIdx), + nr_get_code_rate_dl(pdsch->mcs, mcsTableIdx), + rbSize, tda_info->nrOfSymbols, N_PRB_DMRS * dmrs_length,0, 0,1) >> 3; + } while (TBS < gNB_mac->sched_osi->num_total_bytes); + + if (TBS < gNB_mac->sched_osi->num_total_bytes) { + for (int rb = 0; rb < bwpSize; rb++) + LOG_I(NR_MAC, "vrb_map[%d] %x\n", rbStart + rb, vrb_map[rbStart + rb]); + } + AssertFatal( + TBS >= gNB_mac->sched_osi->num_total_bytes, + "Couldn't allocate enough resources for %d bytes in SIB1 PDSCH (rbStart %d, rbSize %d, bwpSize %d SLmask %x - [%d,%d])\n", + gNB_mac->sched_osi->num_total_bytes, + rbStart, + rbSize, + bwpSize, + SL_to_bitmap(tda_info->startSymbolIndex, tda_info->nrOfSymbols), + tda_info->startSymbolIndex, + tda_info->nrOfSymbols); + + pdsch->rbSize = rbSize; + pdsch->rbStart = 0; + + LOG_D(NR_MAC,"mcs = %i\n", pdsch->mcs); + LOG_D(NR_MAC,"startSymbolIndex = %i\n", tda_info->startSymbolIndex); + LOG_D(NR_MAC,"nrOfSymbols = %i\n", tda_info->nrOfSymbols); + LOG_D(NR_MAC, "rbSize = %i\n", pdsch->rbSize); + LOG_D(NR_MAC,"TBS = %i\n", TBS); + LOG_D(NR_MAC,"dmrs_length %d\n",dmrs_length); + LOG_D(NR_MAC,"N_PRB_DMRS = %d\n",N_PRB_DMRS); + LOG_D(NR_MAC,"mappingtype = %d\n", tda_info->mapping_type); + // Mark the corresponding RBs as used + fill_pdcch_vrb_map(gNB_mac, + CC_id, + &gNB_mac->sched_osi->sched_pdcch, + gNB_mac->sched_osi->cce_index, + gNB_mac->sched_osi->aggregation_level); + for (int rb = 0; rb < pdsch->rbSize; rb++) { + vrb_map[rb + rbStart] |= SL_to_bitmap(tda_info->startSymbolIndex, tda_info->nrOfSymbols); + } + return TBS; +} + static void nr_fill_nfapi_dl_sib1_pdu(int Mod_idP, nfapi_nr_dl_tti_request_body_t *dl_req, int pdu_index, @@ -419,7 +541,8 @@ static void nr_fill_nfapi_dl_sib1_pdu(int Mod_idP, nfapi_nr_dl_tti_pdcch_pdu_rel15_t *pdcch_pdu_rel15 = &dl_tti_pdcch_pdu->pdcch_pdu.pdcch_pdu_rel15; nr_configure_pdcch(pdcch_pdu_rel15, gNB_mac->sched_ctrlCommon->coreset, - &gNB_mac->sched_ctrlCommon->sched_pdcch); + &gNB_mac->sched_ctrlCommon->sched_pdcch, + false); nfapi_nr_dl_tti_request_pdu_t *dl_tti_pdsch_pdu = &dl_req->dl_tti_pdu_list[dl_req->nPDUs]; memset((void*)dl_tti_pdsch_pdu,0,sizeof(nfapi_nr_dl_tti_request_pdu_t)); @@ -543,6 +666,155 @@ static void nr_fill_nfapi_dl_sib1_pdu(int Mod_idP, LOG_D(MAC,"numDlDci: %i\n", pdcch_pdu_rel15->numDlDci); } + +static void nr_fill_nfapi_dl_other_si_pdu(int Mod_idP, + nfapi_nr_dl_tti_request_body_t *dl_req, + int pdu_index, + NR_Type0_PDCCH_CSS_config_t *type0_PDCCH_CSS_config, + uint32_t TBS, + int StartSymbolIndex, + int NrOfSymbols) +{ + gNB_MAC_INST *gNB_mac = RC.nrmac[Mod_idP]; + NR_COMMON_channels_t *cc = gNB_mac->common_channels; + NR_ServingCellConfigCommon_t *scc = cc->ServingCellConfigCommon; + int mcsTableIdx = 0; + NR_sched_pdsch_t *pdsch = &gNB_mac->sched_osi->sched_pdsch; + nfapi_nr_dl_tti_request_pdu_t *dl_tti_pdcch_pdu = &dl_req->dl_tti_pdu_list[dl_req->nPDUs]; + memset((void*)dl_tti_pdcch_pdu,0,sizeof(nfapi_nr_dl_tti_request_pdu_t)); + dl_tti_pdcch_pdu->PDUType = NFAPI_NR_DL_TTI_PDCCH_PDU_TYPE; + dl_tti_pdcch_pdu->PDUSize = (uint16_t)(4+sizeof(nfapi_nr_dl_tti_pdcch_pdu)); + dl_req->nPDUs += 1; + nfapi_nr_dl_tti_pdcch_pdu_rel15_t *pdcch_pdu_rel15 = &dl_tti_pdcch_pdu->pdcch_pdu.pdcch_pdu_rel15; + nr_configure_pdcch(pdcch_pdu_rel15, + gNB_mac->sched_osi->coreset, + &gNB_mac->sched_osi->sched_pdcch, + true); + + nfapi_nr_dl_tti_request_pdu_t *dl_tti_pdsch_pdu = &dl_req->dl_tti_pdu_list[dl_req->nPDUs]; + memset((void*)dl_tti_pdsch_pdu,0,sizeof(nfapi_nr_dl_tti_request_pdu_t)); + dl_tti_pdsch_pdu->PDUType = NFAPI_NR_DL_TTI_PDSCH_PDU_TYPE; + dl_tti_pdsch_pdu->PDUSize = (uint16_t)(4+sizeof(nfapi_nr_dl_tti_pdsch_pdu)); + dl_req->nPDUs += 1; + nfapi_nr_dl_tti_pdsch_pdu_rel15_t *pdsch_pdu_rel15 = &dl_tti_pdsch_pdu->pdsch_pdu.pdsch_pdu_rel15; + + pdsch_pdu_rel15->precodingAndBeamforming.num_prgs=0; + pdsch_pdu_rel15->precodingAndBeamforming.prg_size=0; + pdsch_pdu_rel15->precodingAndBeamforming.dig_bf_interfaces=0; + pdsch_pdu_rel15->precodingAndBeamforming.prgs_list[0].pm_idx = 0; + pdsch_pdu_rel15->precodingAndBeamforming.prgs_list[0].dig_bf_interface_list[0].beam_idx = 0; + + pdcch_pdu_rel15->CoreSetType = NFAPI_NR_CSET_CONFIG_MIB_SIB1; + + pdsch_pdu_rel15->pduBitmap = 0; + pdsch_pdu_rel15->rnti = SI_RNTI; + pdsch_pdu_rel15->pduIndex = pdu_index; + + pdsch_pdu_rel15->BWPSize = type0_PDCCH_CSS_config->num_rbs; + pdsch_pdu_rel15->BWPStart = type0_PDCCH_CSS_config->cset_start_rb; + + pdsch_pdu_rel15->SubcarrierSpacing = type0_PDCCH_CSS_config->scs_pdcch; + pdsch_pdu_rel15->CyclicPrefix = 0; + + pdsch_pdu_rel15->NrOfCodewords = 1; + pdsch_pdu_rel15->targetCodeRate[0] = nr_get_code_rate_dl(pdsch->mcs, mcsTableIdx); + pdsch_pdu_rel15->qamModOrder[0] = nr_get_Qm_dl(pdsch->mcs, mcsTableIdx); + pdsch_pdu_rel15->mcsIndex[0] = pdsch->mcs; + pdsch_pdu_rel15->mcsTable[0] = mcsTableIdx; + pdsch_pdu_rel15->rvIndex[0] = nr_rv_round_map[0]; + pdsch_pdu_rel15->dataScramblingId = *scc->physCellId; + pdsch_pdu_rel15->nrOfLayers = 1; + pdsch_pdu_rel15->transmissionScheme = 0; + pdsch_pdu_rel15->refPoint = 1; + pdsch_pdu_rel15->dmrsConfigType = 0; + pdsch_pdu_rel15->dlDmrsScramblingId = *scc->physCellId; + pdsch_pdu_rel15->SCID = 0; + pdsch_pdu_rel15->numDmrsCdmGrpsNoData = pdsch->dmrs_parms.numDmrsCdmGrpsNoData; + pdsch_pdu_rel15->dmrsPorts = 1; + pdsch_pdu_rel15->resourceAlloc = 1; + pdsch_pdu_rel15->rbStart = pdsch->rbStart; + pdsch_pdu_rel15->rbSize = pdsch->rbSize; + pdsch_pdu_rel15->VRBtoPRBMapping = 0; + pdsch_pdu_rel15->TBSize[0] = TBS; + pdsch_pdu_rel15->StartSymbolIndex = StartSymbolIndex; + pdsch_pdu_rel15->NrOfSymbols = NrOfSymbols; + pdsch_pdu_rel15->dlDmrsSymbPos = pdsch->dmrs_parms.dl_dmrs_symb_pos; + LOG_D(NR_MAC,"sib19:bwpStart %d, bwpSize %d\n",pdsch_pdu_rel15->BWPStart,pdsch_pdu_rel15->BWPSize); + LOG_D(NR_MAC,"sib19:rbStart %d, rbSize %d\n",pdsch_pdu_rel15->rbStart,pdsch_pdu_rel15->rbSize); + LOG_D(NR_MAC,"sib19:dlDmrsSymbPos = 0x%x\n", pdsch_pdu_rel15->dlDmrsSymbPos); + + pdsch_pdu_rel15->maintenance_parms_v3.tbSizeLbrmBytes = nr_compute_tbslbrm(0, + pdsch_pdu_rel15->BWPSize, + 1); + pdsch_pdu_rel15->maintenance_parms_v3.ldpcBaseGraph = get_BG(TBS<<3,pdsch_pdu_rel15->targetCodeRate[0]); + + /* Fill PDCCH DL DCI PDU */ + nfapi_nr_dl_dci_pdu_t *dci_pdu = &pdcch_pdu_rel15->dci_pdu[pdcch_pdu_rel15->numDlDci]; + pdcch_pdu_rel15->numDlDci++; + dci_pdu->RNTI = SI_RNTI; + dci_pdu->ScramblingId = *scc->physCellId; + dci_pdu->ScramblingRNTI = 0; + dci_pdu->AggregationLevel = gNB_mac->sched_osi->aggregation_level; + dci_pdu->CceIndex = gNB_mac->sched_osi->cce_index; + dci_pdu->beta_PDCCH_1_0 = 0; + dci_pdu->powerControlOffsetSS = 1; + + /* DCI payload */ + dci_pdu_rel15_t dci_payload; + memset(&dci_payload, 0, sizeof(dci_pdu_rel15_t)); + + dci_payload.bwp_indicator.val = 0; + + // frequency domain assignment + dci_payload.frequency_domain_assignment.val = PRBalloc_to_locationandbandwidth0( + pdsch_pdu_rel15->rbSize, pdsch_pdu_rel15->rbStart, type0_PDCCH_CSS_config->num_rbs); + + dci_payload.time_domain_assignment.val = gNB_mac->sched_osi->sched_pdsch.time_domain_allocation; + dci_payload.mcs = pdsch->mcs; + dci_payload.rv = pdsch_pdu_rel15->rvIndex[0]; + dci_payload.harq_pid.val = 0; + dci_payload.ndi = 0; + dci_payload.dai[0].val = 0; + dci_payload.tpc = 0; // table 7.2.1-1 in 38.213 + dci_payload.pucch_resource_indicator = 0; + dci_payload.pdsch_to_harq_feedback_timing_indicator.val = 0; + dci_payload.antenna_ports.val = 0; + dci_payload.dmrs_sequence_initialization.val = pdsch_pdu_rel15->SCID; + dci_payload.system_info_indicator = 1; + + int dci_format = NR_DL_DCI_FORMAT_1_0; + int rnti_type = TYPE_SI_RNTI_; + + fill_dci_pdu_rel15(NULL, + NULL, + NULL, + &pdcch_pdu_rel15->dci_pdu[pdcch_pdu_rel15->numDlDci - 1], + &dci_payload, + dci_format, + rnti_type, + 0, + gNB_mac->sched_osi->search_space, + gNB_mac->sched_osi->coreset, + 0, + gNB_mac->cset0_bwp_size); + + + LOG_D(MAC,"BWPSize: %i\n", pdcch_pdu_rel15->BWPSize); + LOG_D(MAC,"BWPStart: %i\n", pdcch_pdu_rel15->BWPStart); + LOG_D(MAC,"SubcarrierSpacing: %i\n", pdcch_pdu_rel15->SubcarrierSpacing); + LOG_D(MAC,"CyclicPrefix: %i\n", pdcch_pdu_rel15->CyclicPrefix); + LOG_D(MAC,"StartSymbolIndex: %i\n", pdcch_pdu_rel15->StartSymbolIndex); + LOG_D(MAC,"DurationSymbols: %i\n", pdcch_pdu_rel15->DurationSymbols); + for(int n=0;n<6;n++) LOG_D(MAC,"FreqDomainResource[%i]: %x\n",n, pdcch_pdu_rel15->FreqDomainResource[n]); + LOG_D(MAC,"CceRegMappingType: %i\n", pdcch_pdu_rel15->CceRegMappingType); + LOG_D(MAC,"RegBundleSize: %i\n", pdcch_pdu_rel15->RegBundleSize); + LOG_D(MAC,"InterleaverSize: %i\n", pdcch_pdu_rel15->InterleaverSize); + LOG_D(MAC,"CoreSetType: %i\n", pdcch_pdu_rel15->CoreSetType); + LOG_D(MAC,"ShiftIndex: %i\n", pdcch_pdu_rel15->ShiftIndex); + LOG_D(MAC,"precoderGranularity: %i\n", pdcch_pdu_rel15->precoderGranularity); + LOG_D(MAC,"numDlDci: %i\n", pdcch_pdu_rel15->numDlDci); +} + void schedule_nr_sib1(module_id_t module_idP, frame_t frameP, sub_frame_t slotP, @@ -643,3 +915,129 @@ void schedule_nr_sib1(module_id_t module_idP, } } } + +void schedule_nr_sib19(module_id_t module_idP, + frame_t frameP, + sub_frame_t slotP, + nfapi_nr_dl_tti_request_t *DL_req, + nfapi_nr_tx_data_request_t *TX_req) +{ + /* already mutex protected: held in gNB_dlsch_ulsch_scheduler() */ + // TODO: Get these values from RRC + + const int CC_id = 0; + uint8_t candidate_idx = 0; + + gNB_MAC_INST *gNB_mac = RC.nrmac[module_idP]; + NR_ServingCellConfigCommon_t *scc = gNB_mac->common_channels[CC_id].ServingCellConfigCommon; + NR_COMMON_channels_t *cc = &gNB_mac->common_channels[0]; + + // get sib19 scheduling info from sib1 + struct NR_SI_SchedulingInfo_v1700* si_schedulinginfo2_r17 = cc->sib1->message.choice.c1->choice.systemInformationBlockType1->nonCriticalExtension->nonCriticalExtension->nonCriticalExtension->si_SchedulingInfo_v1700; + struct NR_SchedulingInfo2_r17* sib19_sched_info = NULL; + + bool found = false; + for (int i = 0; i < si_schedulinginfo2_r17->schedulingInfoList2_r17.list.count; i++) + { + for (int j= 0; j < si_schedulinginfo2_r17->schedulingInfoList2_r17.list.array[i]->sib_MappingInfo_r17.list.count; j++) + { + if (si_schedulinginfo2_r17->schedulingInfoList2_r17.list.array[i]->sib_MappingInfo_r17.list.array[j]->sibType_r17.choice.type1_r17 == + NR_SIB_TypeInfo_v1700__sibType_r17__type1_r17_sibType19) + { + found = true; + sib19_sched_info = si_schedulinginfo2_r17->schedulingInfoList2_r17.list.array[i]; + break; + } + } + if (found) + break; + } + + if (!found) + { + LOG_D(GNB_APP, "SIB1 does not contain scheduling info for SIB19\n"); + return; + } + + // convert periodicity enum type into actual frames number + int frame = 8 << sib19_sched_info->si_Periodicity_r17; + + int time_domain_allocation = 1; // row 0 of pdsch tda common table + int L_max; + switch (scc->ssb_PositionsInBurst->present) { + case 1: + L_max = 4; + break; + case 2: + L_max = 8; + break; + case 3: + L_max = 64; + break; + default: + AssertFatal(0,"SSB bitmap size value %d undefined (allowed values 1,2,3)\n", + scc->ssb_PositionsInBurst->present); + } + + const int window_length = 10; + for (int i=0; itype0_PDCCH_CSS_config[i]; + if(((frameP - 1) % frame == 0) && + (slotP == ((sib19_sched_info->si_WindowPosition_r17 % window_length) - 1)) && + (type0_PDCCH_CSS_config->num_rbs > 0)) + { + + LOG_D(NR_MAC,"(%d.%d) SIB19 transmission: ssb_index %d\n", frameP, slotP, type0_PDCCH_CSS_config->ssb_index); + + NR_tda_info_t tda_info = set_tda_info_from_list(scc->downlinkConfigCommon->initialDownlinkBWP->pdsch_ConfigCommon->choice.setup->pdsch_TimeDomainAllocationList, time_domain_allocation); + LOG_D(NR_MAC,"tda_info.startSymbolIndex: %d, tda_info.nrOfSymbols: %d\n", tda_info.startSymbolIndex, tda_info.nrOfSymbols); + + AssertFatal((tda_info.startSymbolIndex + tda_info.nrOfSymbols) < 14, "SIB19 TDA %d would cause overlap with CSI-RS. Please select a different SIB1 TDA.\n", time_domain_allocation); + + NR_pdsch_dmrs_t dmrs_parms = get_dl_dmrs_params(scc, + NULL, + &tda_info, + 1); + + // Configure sched_osi for SIB19 + uint32_t TBS = schedule_control_other_si(module_idP, CC_id, + type0_PDCCH_CSS_config, + time_domain_allocation, + &dmrs_parms, + &tda_info, + candidate_idx, + cc->sib19_bcch_length); + + nfapi_nr_dl_tti_request_body_t *dl_req = &DL_req->dl_tti_request_body; + int pdu_index = gNB_mac->pdu_index[0]++; + nr_fill_nfapi_dl_other_si_pdu(module_idP, dl_req, pdu_index, type0_PDCCH_CSS_config, TBS, tda_info.startSymbolIndex, tda_info.nrOfSymbols); + + const int ntx_req = TX_req->Number_of_PDUs; + nfapi_nr_pdu_t *tx_req = &TX_req->pdu_list[ntx_req]; + + // Data to be transmitted + memcpy(tx_req->TLVs[0].value.direct, cc->sib19_bcch_pdu, TBS); + xer_fprint(stdout, &asn_DEF_NR_BCCH_DL_SCH_Message,(void *)cc->sib19); + + tx_req->PDU_length = TBS; + tx_req->PDU_index = pdu_index; + tx_req->num_TLV = 1; + tx_req->TLVs[0].length = TBS + 2; + TX_req->Number_of_PDUs++; + TX_req->SFN = frameP; + TX_req->Slot = slotP; + + type0_PDCCH_CSS_config->active = false; + + T(T_GNB_MAC_DL_PDU_WITH_DATA, + T_INT(module_idP), + T_INT(CC_id), + T_INT(0xffff), + T_INT(frameP), + T_INT(slotP), + T_INT(0 /* harq_pid */), + T_BUFFER(cc->sib19_bcch_pdu, cc->sib19_bcch_length)); + } + } +} \ No newline at end of file diff --git a/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_dlsch.c b/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_dlsch.c index 334c263501..c7f2a97212 100644 --- a/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_dlsch.c +++ b/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_dlsch.c @@ -1074,7 +1074,7 @@ void nr_schedule_ue_spec(module_id_t module_id, pdcch_pdu = &dl_tti_pdcch_pdu->pdcch_pdu.pdcch_pdu_rel15; LOG_D(NR_MAC,"Trying to configure DL pdcch for UE %04x, bwp %d, cs %d\n", UE->rnti, bwp_id, coresetid); NR_ControlResourceSet_t *coreset = sched_ctrl->coreset; - nr_configure_pdcch(pdcch_pdu, coreset, &sched_ctrl->sched_pdcch); + nr_configure_pdcch(pdcch_pdu, coreset, &sched_ctrl->sched_pdcch, false); gNB_mac->pdcch_pdu_idx[CC_id][coresetid] = pdcch_pdu; } diff --git a/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_primitives.c b/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_primitives.c index 5bc2a97fd7..f5c322ecaa 100644 --- a/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_primitives.c +++ b/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_primitives.c @@ -870,7 +870,8 @@ int nr_get_default_pucch_res(int pucch_ResourceCommon) { void nr_configure_pdcch(nfapi_nr_dl_tti_pdcch_pdu_rel15_t *pdcch_pdu, NR_ControlResourceSet_t *coreset, - NR_sched_pdcch_t *pdcch) { + NR_sched_pdcch_t *pdcch, + bool otherSI) { pdcch_pdu->BWPSize = pdcch->BWPSize; @@ -892,12 +893,17 @@ void nr_configure_pdcch(nfapi_nr_dl_tti_pdcch_pdu_rel15_t *pdcch_pdu, pdcch_pdu->InterleaverSize = pdcch->InterleaverSize; pdcch_pdu->ShiftIndex = pdcch->ShiftIndex; - if(coreset->controlResourceSetId == 0) { - pdcch_pdu->CoreSetType = NFAPI_NR_CSET_CONFIG_MIB_SIB1; - } else{ + if (otherSI) { pdcch_pdu->CoreSetType = NFAPI_NR_CSET_CONFIG_PDCCH_CONFIG; } - + else { + if (coreset->controlResourceSetId == 0) { + pdcch_pdu->CoreSetType = NFAPI_NR_CSET_CONFIG_MIB_SIB1; + } else { + pdcch_pdu->CoreSetType = NFAPI_NR_CSET_CONFIG_PDCCH_CONFIG; + } + } + //precoderGranularity pdcch_pdu->precoderGranularity = coreset->precoderGranularity; } diff --git a/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_ulsch.c b/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_ulsch.c index d091d486ff..77ad81a67e 100644 --- a/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_ulsch.c +++ b/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_ulsch.c @@ -2558,7 +2558,7 @@ void nr_schedule_ulsch(module_id_t module_id, frame_t frame, sub_frame_t slot, n ul_dci_request_pdu->PDUSize = (uint8_t)(4+sizeof(nfapi_nr_dl_tti_pdcch_pdu)); pdcch_pdu = &ul_dci_request_pdu->pdcch_pdu.pdcch_pdu_rel15; ul_dci_req->numPdus += 1; - nr_configure_pdcch(pdcch_pdu, coreset, &sched_ctrl->sched_pdcch); + nr_configure_pdcch(pdcch_pdu, coreset, &sched_ctrl->sched_pdcch, false); pdcch_pdu_coreset[coresetid] = pdcch_pdu; } diff --git a/openair2/LAYER2/NR_MAC_gNB/mac_proto.h b/openair2/LAYER2/NR_MAC_gNB/mac_proto.h index 33933be4d7..5ab125eade 100644 --- a/openair2/LAYER2/NR_MAC_gNB/mac_proto.h +++ b/openair2/LAYER2/NR_MAC_gNB/mac_proto.h @@ -87,6 +87,12 @@ void schedule_nr_sib1(module_id_t module_idP, nfapi_nr_dl_tti_request_t *DL_req, nfapi_nr_tx_data_request_t *TX_req); +void schedule_nr_sib19(module_id_t module_idP, + frame_t frameP, + sub_frame_t slotP, + nfapi_nr_dl_tti_request_t *DL_req, + nfapi_nr_tx_data_request_t *TX_req); + void schedule_nr_mib(module_id_t module_idP, frame_t frameP, sub_frame_t slotP, nfapi_nr_dl_tti_request_t *DL_req); /* \brief main UL scheduler function. Calls a preprocessor to decide on @@ -203,7 +209,8 @@ void find_search_space(int ss_type, void nr_configure_pdcch(nfapi_nr_dl_tti_pdcch_pdu_rel15_t *pdcch_pdu, NR_ControlResourceSet_t *coreset, - NR_sched_pdcch_t *pdcch); + NR_sched_pdcch_t *pdcch, + bool otherSI); NR_sched_pdcch_t set_pdcch_structure(gNB_MAC_INST *gNB_mac, NR_SearchSpace_t *ss, diff --git a/openair2/LAYER2/NR_MAC_gNB/nr_mac_gNB.h b/openair2/LAYER2/NR_MAC_gNB/nr_mac_gNB.h index 51e403ae49..1306652033 100644 --- a/openair2/LAYER2/NR_MAC_gNB/nr_mac_gNB.h +++ b/openair2/LAYER2/NR_MAC_gNB/nr_mac_gNB.h @@ -667,6 +667,19 @@ typedef struct { seq_arr_t lc_config; } NR_UE_sched_ctrl_t; +typedef struct { + NR_SearchSpace_t *search_space; + NR_ControlResourceSet_t *coreset; + + NR_sched_pdcch_t sched_pdcch; + NR_sched_pdsch_t sched_pdsch; + + uint32_t num_total_bytes; + + int cce_index; + uint8_t aggregation_level; +} NR_UE_sched_osi_ctrl_t; + typedef struct { uicc_t *uicc; } NRUEcontext_t; @@ -881,7 +894,9 @@ typedef struct gNB_MAC_INST_s { nr_mac_config_t radio_config; + NR_UE_sched_osi_ctrl_t *sched_osi; NR_UE_sched_ctrl_t *sched_ctrlCommon; + uint16_t cset0_bwp_start; uint16_t cset0_bwp_size; NR_Type0_PDCCH_CSS_config_t type0_PDCCH_CSS_config[64]; diff --git a/openair2/RRC/NR/nr_rrc_config.c b/openair2/RRC/NR/nr_rrc_config.c index 1c3b3d0dc8..2042d0d1f1 100644 --- a/openair2/RRC/NR/nr_rrc_config.c +++ b/openair2/RRC/NR/nr_rrc_config.c @@ -2256,7 +2256,7 @@ NR_BCCH_DL_SCH_Message_t *get_SIB1_NR(const NR_ServingCellConfigCommon_t *scc, struct NR_SchedulingInfo2_r17 *si_schedulinginfo2_r17 = CALLOC(1, sizeof(struct NR_SchedulingInfo2_r17)); si_schedulinginfo2_r17->si_BroadcastStatus_r17 = NR_SchedulingInfo2_r17__si_BroadcastStatus_r17_broadcasting; si_schedulinginfo2_r17->si_WindowPosition_r17 = 2; - si_schedulinginfo2_r17->si_Periodicity_r17 = NR_SchedulingInfo2_r17__si_Periodicity_r17_rf16; + si_schedulinginfo2_r17->si_Periodicity_r17 = NR_SchedulingInfo2_r17__si_Periodicity_r17_rf8; struct NR_SIB_TypeInfo_v1700 *sib_type_info = CALLOC(1, sizeof(struct NR_SIB_TypeInfo_v1700)); sib_type_info->sibType_r17.present = NR_SIB_TypeInfo_v1700__sibType_r17_PR_type1_r17; From 8bc2271001f221f4ca48422b3503a8b2101c12d7 Mon Sep 17 00:00:00 2001 From: Roberto Rosca Date: Tue, 6 Aug 2024 13:39:53 +0300 Subject: [PATCH 4/5] conf parameters added (commented) + schedule sib19 only if parameters present in conf file --- openair2/GNB_APP/gnb_config.c | 3 +- openair2/LAYER2/NR_MAC_gNB/gNB_scheduler.c | 6 ++-- .../LAYER2/NR_MAC_gNB/gNB_scheduler_bch.c | 31 +++++++++---------- openair2/RRC/NR/nr_rrc_config.c | 4 +-- .../gnb.sa.band66.fr1.25PRB.usrpx300.conf | 7 +++++ 5 files changed, 30 insertions(+), 21 deletions(-) diff --git a/openair2/GNB_APP/gnb_config.c b/openair2/GNB_APP/gnb_config.c index 000b9f563c..d1ed728f35 100644 --- a/openair2/GNB_APP/gnb_config.c +++ b/openair2/GNB_APP/gnb_config.c @@ -1475,7 +1475,8 @@ void RCconfig_nr_macrlc(configmodule_interface_t *cfg) if (get_softmodem_params()->sa) { nr_mac_configure_sib1(RC.nrmac[0], &info.plmn, info.nr_cellid, *info.tac); - nr_mac_configure_sib19(RC.nrmac[0]); + if (scc->ext2 && scc->ext2->ntn_Config_r17) + nr_mac_configure_sib19(RC.nrmac[0]); } // read F1 Setup information from config and generated MIB/SIB1 diff --git a/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler.c b/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler.c index 5158a3c237..2b3003a0ec 100644 --- a/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler.c +++ b/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler.c @@ -262,10 +262,12 @@ void gNB_dlsch_ulsch_scheduler(module_id_t module_idP, frame_t frame, sub_frame_ // This schedules MIB schedule_nr_mib(module_idP, frame, slot, &sched_info->DL_req); - // This schedules SIB1 and SIB19 + // This schedules SIB1 + // SIB19 will be scheduled if ntn_Config_r17 is initialized if (get_softmodem_params()->sa == 1) { schedule_nr_sib1(module_idP, frame, slot, &sched_info->DL_req, &sched_info->TX_req); - schedule_nr_sib19(module_idP, frame, slot, &sched_info->DL_req, &sched_info->TX_req); + if (cc->sib19) + schedule_nr_sib19(module_idP, frame, slot, &sched_info->DL_req, &sched_info->TX_req); } // This schedule PRACH if we are not in phy_test mode diff --git a/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_bch.c b/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_bch.c index 87b95f2e71..92826e31ce 100644 --- a/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_bch.c +++ b/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_bch.c @@ -398,7 +398,6 @@ static uint32_t schedule_control_sib1(module_id_t module_id, return TBS; } - static uint32_t schedule_control_other_si(module_id_t module_id, int CC_id, NR_Type0_PDCCH_CSS_config_t *type0_PDCCH_CSS_config, @@ -413,7 +412,7 @@ static uint32_t schedule_control_other_si(module_id_t module_id, NR_ServingCellConfigCommon_t *scc = cc->ServingCellConfigCommon; uint16_t *vrb_map = cc->vrb_map; - if (gNB_mac->sched_osi == NULL){ + if (gNB_mac->sched_osi == NULL) { gNB_mac->sched_osi = calloc(1, sizeof(NR_UE_sched_osi_ctrl_t)); struct NR_PDCCH_ConfigCommon__commonSearchSpaceList *commonSearchSpaceList = scc->downlinkConfigCommon->initialDownlinkBWP->pdcch_ConfigCommon->choice.setup->commonSearchSpaceList; NR_SearchSpaceId_t osi_SearchSpace = *scc->downlinkConfigCommon->initialDownlinkBWP->pdcch_ConfigCommon->choice.setup->searchSpaceOtherSystemInformation; @@ -471,7 +470,7 @@ static uint32_t schedule_control_other_si(module_id_t module_id, do { if(rbSize < bwpSize && !(vrb_map[rbStart + rbSize]&SL_to_bitmap(tda_info->startSymbolIndex, tda_info->nrOfSymbols))) rbSize++; - else{ + else { if (pdsch->mcs<10) pdsch->mcs++; else @@ -744,8 +743,8 @@ static void nr_fill_nfapi_dl_other_si_pdu(int Mod_idP, LOG_D(NR_MAC,"sib19:dlDmrsSymbPos = 0x%x\n", pdsch_pdu_rel15->dlDmrsSymbPos); pdsch_pdu_rel15->maintenance_parms_v3.tbSizeLbrmBytes = nr_compute_tbslbrm(0, - pdsch_pdu_rel15->BWPSize, - 1); + pdsch_pdu_rel15->BWPSize, + 1); pdsch_pdu_rel15->maintenance_parms_v3.ldpcBaseGraph = get_BG(TBS<<3,pdsch_pdu_rel15->targetCodeRate[0]); /* Fill PDCCH DL DCI PDU */ @@ -933,17 +932,19 @@ void schedule_nr_sib19(module_id_t module_idP, NR_COMMON_channels_t *cc = &gNB_mac->common_channels[0]; // get sib19 scheduling info from sib1 - struct NR_SI_SchedulingInfo_v1700* si_schedulinginfo2_r17 = cc->sib1->message.choice.c1->choice.systemInformationBlockType1->nonCriticalExtension->nonCriticalExtension->nonCriticalExtension->si_SchedulingInfo_v1700; - struct NR_SchedulingInfo2_r17* sib19_sched_info = NULL; + struct NR_SI_SchedulingInfo_v1700 *si_schedulinginfo2_r17 = cc->sib1->message.choice.c1->choice.systemInformationBlockType1->nonCriticalExtension->nonCriticalExtension->nonCriticalExtension->si_SchedulingInfo_v1700; + struct NR_SchedulingInfo2_r17 *sib19_sched_info = NULL; + + if (!si_schedulinginfo2_r17) { + LOG_E(GNB_APP, "SIB1 does not contain si_SchedulingInfo_v1700\n"); + return; + } bool found = false; - for (int i = 0; i < si_schedulinginfo2_r17->schedulingInfoList2_r17.list.count; i++) - { - for (int j= 0; j < si_schedulinginfo2_r17->schedulingInfoList2_r17.list.array[i]->sib_MappingInfo_r17.list.count; j++) - { + for (int i = 0; i < si_schedulinginfo2_r17->schedulingInfoList2_r17.list.count; i++) { + for (int j= 0; j < si_schedulinginfo2_r17->schedulingInfoList2_r17.list.array[i]->sib_MappingInfo_r17.list.count; j++) { if (si_schedulinginfo2_r17->schedulingInfoList2_r17.list.array[i]->sib_MappingInfo_r17.list.array[j]->sibType_r17.choice.type1_r17 == - NR_SIB_TypeInfo_v1700__sibType_r17__type1_r17_sibType19) - { + NR_SIB_TypeInfo_v1700__sibType_r17__type1_r17_sibType19) { found = true; sib19_sched_info = si_schedulinginfo2_r17->schedulingInfoList2_r17.list.array[i]; break; @@ -985,8 +986,7 @@ void schedule_nr_sib19(module_id_t module_idP, NR_Type0_PDCCH_CSS_config_t *type0_PDCCH_CSS_config = &gNB_mac->type0_PDCCH_CSS_config[i]; if(((frameP - 1) % frame == 0) && (slotP == ((sib19_sched_info->si_WindowPosition_r17 % window_length) - 1)) && - (type0_PDCCH_CSS_config->num_rbs > 0)) - { + (type0_PDCCH_CSS_config->num_rbs > 0)) { LOG_D(NR_MAC,"(%d.%d) SIB19 transmission: ssb_index %d\n", frameP, slotP, type0_PDCCH_CSS_config->ssb_index); @@ -1018,7 +1018,6 @@ void schedule_nr_sib19(module_id_t module_idP, // Data to be transmitted memcpy(tx_req->TLVs[0].value.direct, cc->sib19_bcch_pdu, TBS); - xer_fprint(stdout, &asn_DEF_NR_BCCH_DL_SCH_Message,(void *)cc->sib19); tx_req->PDU_length = TBS; tx_req->PDU_index = pdu_index; diff --git a/openair2/RRC/NR/nr_rrc_config.c b/openair2/RRC/NR/nr_rrc_config.c index 2042d0d1f1..e3f310a4c9 100644 --- a/openair2/RRC/NR/nr_rrc_config.c +++ b/openair2/RRC/NR/nr_rrc_config.c @@ -2245,7 +2245,7 @@ NR_BCCH_DL_SCH_Message_t *get_SIB1_NR(const NR_ServingCellConfigCommon_t *scc, asn1cSeqAdd(&sib1->si_SchedulingInfo->schedulingInfoList.list,schedulingInfo);*/ // sib19 scheduling info - // this condition ensures ntn-config is initialized + // ensure ntn-config is initialized if (scc->ext2 && scc->ext2->ntn_Config_r17) { sib1->nonCriticalExtension = CALLOC(1, sizeof(struct NR_SIB1_v1610_IEs)); sib1->nonCriticalExtension->nonCriticalExtension = CALLOC(1, sizeof(struct NR_SIB1_v1630_IEs)); @@ -2458,7 +2458,7 @@ NR_BCCH_DL_SCH_Message_t *get_SIB1_NR(const NR_ServingCellConfigCommon_t *scc, // TODO: add nonCriticalExtension if (LOG_DEBUGFLAG(DEBUG_ASN1)) { - xer_fprint(stdout, &asn_DEF_NR_SIB1, sib1_message->message.choice.c1->choice.systemInformationBlockType1); + xer_fprint(stdout, &asn_DEF_NR_BCCH_DL_SCH_Message, sib1_message); } return sib1_message; diff --git a/targets/PROJECTS/GENERIC-NR-5GC/CONF/gnb.sa.band66.fr1.25PRB.usrpx300.conf b/targets/PROJECTS/GENERIC-NR-5GC/CONF/gnb.sa.band66.fr1.25PRB.usrpx300.conf index 07beb41fb0..4e3ddd7f4a 100644 --- a/targets/PROJECTS/GENERIC-NR-5GC/CONF/gnb.sa.band66.fr1.25PRB.usrpx300.conf +++ b/targets/PROJECTS/GENERIC-NR-5GC/CONF/gnb.sa.band66.fr1.25PRB.usrpx300.conf @@ -165,6 +165,13 @@ gNBs = #ntn_Config_r17 # cellSpecificKoffset_r17 = 478; # GEO satellite # cellSpecificKoffset_r17 = 40; # LEO satellite +# ta-Common-r17 = 29319745; +# positionX-r17 = 0; +# positionY-r17 = 0; +# positionZ-r17 = 32433846; +# velocityVX-r17 = 0; +# velocityVY-r17 = 0; +# velocityVZ-r17 = 0; } ); From b6b3cc519748ef686ce04b1288960485b1ac05ac Mon Sep 17 00:00:00 2001 From: Roberto Rosca Date: Tue, 13 Aug 2024 11:17:22 +0300 Subject: [PATCH 5/5] Refactor SIB scheduling - refactor nr_fill_nfapi_dl_SIB_pdu to use it on both SIB1 and OtherSI - extract tbs related calculations into function get_tbs to avoid duplicates - moved OtherSI search space initializations to nr_mac_config_scc --- openair2/LAYER2/NR_MAC_gNB/config.c | 20 + openair2/LAYER2/NR_MAC_gNB/gNB_scheduler.c | 2 +- .../LAYER2/NR_MAC_gNB/gNB_scheduler_bch.c | 570 +++++++----------- .../NR_MAC_gNB/gNB_scheduler_primitives.c | 14 +- openair2/LAYER2/NR_MAC_gNB/mac_proto.h | 7 +- 5 files changed, 246 insertions(+), 367 deletions(-) diff --git a/openair2/LAYER2/NR_MAC_gNB/config.c b/openair2/LAYER2/NR_MAC_gNB/config.c index 944d4af46d..e4cd0d4ef0 100644 --- a/openair2/LAYER2/NR_MAC_gNB/config.c +++ b/openair2/LAYER2/NR_MAC_gNB/config.c @@ -694,9 +694,29 @@ void nr_mac_config_scc(gNB_MAC_INST *nrmac, NR_ServingCellConfigCommon_t *scc, c NR_RA_t *ra = &cc->ra[n]; nr_clear_ra_proc(ra); } + + nr_fill_sched_osi(nrmac, scc->downlinkConfigCommon->initialDownlinkBWP->pdcch_ConfigCommon); NR_SCHED_UNLOCK(&nrmac->sched_lock); } +void nr_fill_sched_osi(gNB_MAC_INST *nrmac, const struct NR_SetupRelease_PDCCH_ConfigCommon *pdcch_ConfigCommon) +{ + NR_SearchSpaceId_t *osi_SearchSpace = pdcch_ConfigCommon->choice.setup->searchSpaceOtherSystemInformation; + if (osi_SearchSpace) { + nrmac->sched_osi = CALLOC(1, sizeof(*nrmac->sched_osi)); + + struct NR_PDCCH_ConfigCommon__commonSearchSpaceList *commonSearchSpaceList = + pdcch_ConfigCommon->choice.setup->commonSearchSpaceList; + AssertFatal(commonSearchSpaceList->list.count > 0, "common SearchSpace list has 0 elements\n"); + for (int i = 0; i < commonSearchSpaceList->list.count; i++) { + NR_SearchSpace_t *ss = commonSearchSpaceList->list.array[i]; + if (ss->searchSpaceId == *osi_SearchSpace) + nrmac->sched_osi->search_space = ss; + } + AssertFatal(nrmac->sched_osi->search_space != NULL, "SearchSpace cannot be null for OSI\n"); + } +} + void nr_mac_configure_sib1(gNB_MAC_INST *nrmac, const f1ap_plmn_t *plmn, uint64_t cellID, int tac) { AssertFatal(get_softmodem_params()->sa > 0, "error: SIB1 only applicable for SA\n"); diff --git a/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler.c b/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler.c index 2b3003a0ec..fd059bc1be 100644 --- a/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler.c +++ b/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler.c @@ -267,7 +267,7 @@ void gNB_dlsch_ulsch_scheduler(module_id_t module_idP, frame_t frame, sub_frame_ if (get_softmodem_params()->sa == 1) { schedule_nr_sib1(module_idP, frame, slot, &sched_info->DL_req, &sched_info->TX_req); if (cc->sib19) - schedule_nr_sib19(module_idP, frame, slot, &sched_info->DL_req, &sched_info->TX_req); + schedule_nr_sib19(module_idP, frame, slot, &sched_info->DL_req, &sched_info->TX_req, cc->sib19_bcch_length, cc->sib19_bcch_pdu); } // This schedule PRACH if we are not in phy_test mode diff --git a/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_bch.c b/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_bch.c index 92826e31ce..18ce58f2d4 100644 --- a/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_bch.c +++ b/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_bch.c @@ -276,6 +276,75 @@ void schedule_nr_mib(module_id_t module_idP, frame_t frameP, sub_frame_t slotP, } } +uint32_t get_tbs(NR_Type0_PDCCH_CSS_config_t *type0_PDCCH_CSS_config, + NR_sched_pdsch_t *pdsch, + uint32_t num_total_bytes, + uint16_t *vrb_map) +{ + NR_tda_info_t *tda_info = &pdsch->tda_info; + + const uint16_t bwpSize = type0_PDCCH_CSS_config->num_rbs; + int rbStart = type0_PDCCH_CSS_config->cset_start_rb; + + // Calculate number of PRB_DMRS + uint8_t N_PRB_DMRS = pdsch->dmrs_parms.N_PRB_DMRS; + uint16_t dmrs_length = pdsch->dmrs_parms.N_DMRS_SLOT; + LOG_D(MAC, "dlDmrsSymbPos %x\n", pdsch->dmrs_parms.dl_dmrs_symb_pos); + int mcsTableIdx = 0; + int rbSize = 0; + uint32_t TBS = 0; + do { + if (rbSize < bwpSize && !(vrb_map[rbStart + rbSize] & SL_to_bitmap(tda_info->startSymbolIndex, tda_info->nrOfSymbols))) + rbSize++; + else { + if (pdsch->mcs < 10) + pdsch->mcs++; + else + break; + } + TBS = nr_compute_tbs(nr_get_Qm_dl(pdsch->mcs, mcsTableIdx), + nr_get_code_rate_dl(pdsch->mcs, mcsTableIdx), + rbSize, + tda_info->nrOfSymbols, + N_PRB_DMRS * dmrs_length, + 0, + 0, + 1) + >> 3; + } while (TBS < num_total_bytes); + + if (TBS < num_total_bytes) { + for (int rb = 0; rb < bwpSize; rb++) + LOG_I(NR_MAC, "vrb_map[%d] %x\n", rbStart + rb, vrb_map[rbStart + rb]); + } + AssertFatal( + TBS >= num_total_bytes, + "Couldn't allocate enough resources for %d bytes in SIB PDSCH (rbStart %d, rbSize %d, bwpSize %d SLmask %x - [%d,%d])\n", + num_total_bytes, + rbStart, + rbSize, + bwpSize, + SL_to_bitmap(tda_info->startSymbolIndex, tda_info->nrOfSymbols), + tda_info->startSymbolIndex, + tda_info->nrOfSymbols); + + pdsch->rbSize = rbSize; + pdsch->rbStart = 0; + + LOG_D( + NR_MAC, + "mcs=%i, startSymbolIndex = %i, nrOfSymbols = %i, rbSize = %i, TBS = %i, dmrs_length %d, N_PRB_DMRS = %d, mappingtype = %d\n", + pdsch->mcs, + tda_info->startSymbolIndex, + tda_info->nrOfSymbols, + pdsch->rbSize, + TBS, + dmrs_length, + N_PRB_DMRS, + tda_info->mapping_type); + return TBS; +} + static uint32_t schedule_control_sib1(module_id_t module_id, int CC_id, NR_Type0_PDCCH_CSS_config_t *type0_PDCCH_CSS_config, @@ -335,56 +404,8 @@ static uint32_t schedule_control_sib1(module_id_t module_id, AssertFatal(gNB_mac->sched_ctrlCommon->cce_index >= 0, "Could not find CCE for coreset0\n"); - const uint16_t bwpSize = type0_PDCCH_CSS_config->num_rbs; - int rbStart = type0_PDCCH_CSS_config->cset_start_rb; + uint32_t TBS = get_tbs(type0_PDCCH_CSS_config, &gNB_mac->sched_ctrlCommon->sched_pdsch, gNB_mac->sched_ctrlCommon->num_total_bytes, vrb_map); - // Calculate number of PRB_DMRS - uint8_t N_PRB_DMRS = pdsch->dmrs_parms.N_PRB_DMRS; - uint16_t dmrs_length = pdsch->dmrs_parms.N_DMRS_SLOT; - LOG_D(MAC,"dlDmrsSymbPos %x\n",pdsch->dmrs_parms.dl_dmrs_symb_pos); - int mcsTableIdx = 0; - int rbSize = 0; - uint32_t TBS = 0; - do { - if(rbSize < bwpSize && !(vrb_map[rbStart + rbSize]&SL_to_bitmap(tda_info->startSymbolIndex, tda_info->nrOfSymbols))) - rbSize++; - else{ - if (pdsch->mcs<10) - pdsch->mcs++; - else - break; - } - TBS = nr_compute_tbs(nr_get_Qm_dl(pdsch->mcs, mcsTableIdx), - nr_get_code_rate_dl(pdsch->mcs, mcsTableIdx), - rbSize, tda_info->nrOfSymbols, N_PRB_DMRS * dmrs_length,0, 0,1) >> 3; - } while (TBS < gNB_mac->sched_ctrlCommon->num_total_bytes); - - if (TBS < gNB_mac->sched_ctrlCommon->num_total_bytes) { - for (int rb = 0; rb < bwpSize; rb++) - LOG_I(NR_MAC, "vrb_map[%d] %x\n", rbStart + rb, vrb_map[rbStart + rb]); - } - AssertFatal( - TBS >= gNB_mac->sched_ctrlCommon->num_total_bytes, - "Couldn't allocate enough resources for %d bytes in SIB1 PDSCH (rbStart %d, rbSize %d, bwpSize %d SLmask %x - [%d,%d])\n", - gNB_mac->sched_ctrlCommon->num_total_bytes, - rbStart, - rbSize, - bwpSize, - SL_to_bitmap(tda_info->startSymbolIndex, tda_info->nrOfSymbols), - tda_info->startSymbolIndex, - tda_info->nrOfSymbols); - - pdsch->rbSize = rbSize; - pdsch->rbStart = 0; - - LOG_D(NR_MAC,"mcs = %i\n", pdsch->mcs); - LOG_D(NR_MAC,"startSymbolIndex = %i\n", tda_info->startSymbolIndex); - LOG_D(NR_MAC,"nrOfSymbols = %i\n", tda_info->nrOfSymbols); - LOG_D(NR_MAC, "rbSize = %i\n", pdsch->rbSize); - LOG_D(NR_MAC,"TBS = %i\n", TBS); - LOG_D(NR_MAC,"dmrs_length %d\n",dmrs_length); - LOG_D(NR_MAC,"N_PRB_DMRS = %d\n",N_PRB_DMRS); - LOG_D(NR_MAC,"mappingtype = %d\n", tda_info->mapping_type); // Mark the corresponding RBs as used fill_pdcch_vrb_map(gNB_mac, CC_id, @@ -393,44 +414,31 @@ static uint32_t schedule_control_sib1(module_id_t module_id, gNB_mac->sched_ctrlCommon->aggregation_level, beam); for (int rb = 0; rb < pdsch->rbSize; rb++) { - vrb_map[rb + rbStart] |= SL_to_bitmap(tda_info->startSymbolIndex, tda_info->nrOfSymbols); + vrb_map[rb + type0_PDCCH_CSS_config->cset_start_rb] |= SL_to_bitmap(tda_info->startSymbolIndex, tda_info->nrOfSymbols); } return TBS; } static uint32_t schedule_control_other_si(module_id_t module_id, - int CC_id, - NR_Type0_PDCCH_CSS_config_t *type0_PDCCH_CSS_config, - int time_domain_allocation, - NR_pdsch_dmrs_t *dmrs_parms, - NR_tda_info_t *tda_info, - uint8_t candidate_idx, - uint16_t num_total_bytes) + int CC_id, + NR_Type0_PDCCH_CSS_config_t *type0_PDCCH_CSS_config, + int time_domain_allocation, + NR_pdsch_dmrs_t *dmrs_parms, + NR_tda_info_t *tda_info, + uint8_t candidate_idx, + int beam, + uint16_t num_total_bytes) { gNB_MAC_INST *gNB_mac = RC.nrmac[module_id]; NR_COMMON_channels_t *cc = &gNB_mac->common_channels[CC_id]; NR_ServingCellConfigCommon_t *scc = cc->ServingCellConfigCommon; - uint16_t *vrb_map = cc->vrb_map; + uint16_t *vrb_map = cc->vrb_map[beam]; - if (gNB_mac->sched_osi == NULL) { - gNB_mac->sched_osi = calloc(1, sizeof(NR_UE_sched_osi_ctrl_t)); - struct NR_PDCCH_ConfigCommon__commonSearchSpaceList *commonSearchSpaceList = scc->downlinkConfigCommon->initialDownlinkBWP->pdcch_ConfigCommon->choice.setup->commonSearchSpaceList; - NR_SearchSpaceId_t osi_SearchSpace = *scc->downlinkConfigCommon->initialDownlinkBWP->pdcch_ConfigCommon->choice.setup->searchSpaceOtherSystemInformation; - AssertFatal(commonSearchSpaceList->list.count > 0, "common SearchSpace list has 0 elements\n"); - for (int i = 0; i < commonSearchSpaceList->list.count; i++) { - NR_SearchSpace_t * ss = commonSearchSpaceList->list.array[i]; - if (ss->searchSpaceId == osi_SearchSpace) - gNB_mac->sched_osi->search_space = ss; - } - AssertFatal(gNB_mac->sched_osi->search_space!=NULL,"SearchSpace cannot be null for RA\n"); - - gNB_mac->sched_osi->coreset = get_coreset(gNB_mac, scc, NULL, gNB_mac->sched_osi->search_space, NR_SearchSpace__searchSpaceType_PR_common); - gNB_mac->sched_osi->sched_pdcch = set_pdcch_structure(NULL, - gNB_mac->sched_osi->search_space, - gNB_mac->sched_osi->coreset, - scc, - NULL, - type0_PDCCH_CSS_config); + if (!gNB_mac->sched_osi->coreset) { + gNB_mac->sched_osi->coreset = + get_coreset(gNB_mac, scc, NULL, gNB_mac->sched_osi->search_space, NR_SearchSpace__searchSpaceType_PR_common); + gNB_mac->sched_osi->sched_pdcch = + set_pdcch_structure(NULL, gNB_mac->sched_osi->search_space, gNB_mac->sched_osi->coreset, scc, NULL, type0_PDCCH_CSS_config); } NR_sched_pdsch_t *pdsch = &gNB_mac->sched_osi->sched_pdsch; @@ -442,109 +450,77 @@ static uint32_t schedule_control_other_si(module_id_t module_id, uint8_t nr_of_candidates; - for (int i=0; i<3; i++) { - find_aggregation_candidates(&gNB_mac->sched_osi->aggregation_level, &nr_of_candidates, gNB_mac->sched_ctrlCommon->search_space,4<0) break; // choosing the lower value of aggregation level available + for (int i = 0; i < 3; i++) { + find_aggregation_candidates(&gNB_mac->sched_osi->aggregation_level, + &nr_of_candidates, + gNB_mac->sched_ctrlCommon->search_space, + 4 << i); + if (nr_of_candidates > 0) + break; // choosing the lower value of aggregation level available } - AssertFatal(nr_of_candidates>0,"nr_of_candidates is 0\n"); + AssertFatal(nr_of_candidates > 0, "nr_of_candidates is 0\n"); gNB_mac->sched_osi->cce_index = find_pdcch_candidate(gNB_mac, - CC_id, - gNB_mac->sched_osi->aggregation_level, - nr_of_candidates, - &gNB_mac->sched_osi->sched_pdcch, - gNB_mac->sched_osi->coreset, - 0); + CC_id, + gNB_mac->sched_osi->aggregation_level, + nr_of_candidates, + beam, + &gNB_mac->sched_osi->sched_pdcch, + gNB_mac->sched_osi->coreset, + 0); AssertFatal(gNB_mac->sched_osi->cce_index >= 0, "Could not find CCE for coreset0\n"); - const uint16_t bwpSize = type0_PDCCH_CSS_config->num_rbs; - int rbStart = type0_PDCCH_CSS_config->cset_start_rb; - // Calculate number of PRB_DMRS - uint8_t N_PRB_DMRS = pdsch->dmrs_parms.N_PRB_DMRS; - uint16_t dmrs_length = pdsch->dmrs_parms.N_DMRS_SLOT; - LOG_D(MAC,"dlDmrsSymbPos %x\n",pdsch->dmrs_parms.dl_dmrs_symb_pos); - int mcsTableIdx = 0; - int rbSize = 0; - uint32_t TBS = 0; - do { - if(rbSize < bwpSize && !(vrb_map[rbStart + rbSize]&SL_to_bitmap(tda_info->startSymbolIndex, tda_info->nrOfSymbols))) - rbSize++; - else { - if (pdsch->mcs<10) - pdsch->mcs++; - else - break; - } - TBS = nr_compute_tbs(nr_get_Qm_dl(pdsch->mcs, mcsTableIdx), - nr_get_code_rate_dl(pdsch->mcs, mcsTableIdx), - rbSize, tda_info->nrOfSymbols, N_PRB_DMRS * dmrs_length,0, 0,1) >> 3; - } while (TBS < gNB_mac->sched_osi->num_total_bytes); - - if (TBS < gNB_mac->sched_osi->num_total_bytes) { - for (int rb = 0; rb < bwpSize; rb++) - LOG_I(NR_MAC, "vrb_map[%d] %x\n", rbStart + rb, vrb_map[rbStart + rb]); - } - AssertFatal( - TBS >= gNB_mac->sched_osi->num_total_bytes, - "Couldn't allocate enough resources for %d bytes in SIB1 PDSCH (rbStart %d, rbSize %d, bwpSize %d SLmask %x - [%d,%d])\n", - gNB_mac->sched_osi->num_total_bytes, - rbStart, - rbSize, - bwpSize, - SL_to_bitmap(tda_info->startSymbolIndex, tda_info->nrOfSymbols), - tda_info->startSymbolIndex, - tda_info->nrOfSymbols); - - pdsch->rbSize = rbSize; - pdsch->rbStart = 0; - - LOG_D(NR_MAC,"mcs = %i\n", pdsch->mcs); - LOG_D(NR_MAC,"startSymbolIndex = %i\n", tda_info->startSymbolIndex); - LOG_D(NR_MAC,"nrOfSymbols = %i\n", tda_info->nrOfSymbols); - LOG_D(NR_MAC, "rbSize = %i\n", pdsch->rbSize); - LOG_D(NR_MAC,"TBS = %i\n", TBS); - LOG_D(NR_MAC,"dmrs_length %d\n",dmrs_length); - LOG_D(NR_MAC,"N_PRB_DMRS = %d\n",N_PRB_DMRS); - LOG_D(NR_MAC,"mappingtype = %d\n", tda_info->mapping_type); + uint32_t TBS = get_tbs(type0_PDCCH_CSS_config, &gNB_mac->sched_osi->sched_pdsch, gNB_mac->sched_osi->num_total_bytes, vrb_map); // Mark the corresponding RBs as used fill_pdcch_vrb_map(gNB_mac, CC_id, &gNB_mac->sched_osi->sched_pdcch, gNB_mac->sched_osi->cce_index, - gNB_mac->sched_osi->aggregation_level); + gNB_mac->sched_osi->aggregation_level, + beam); for (int rb = 0; rb < pdsch->rbSize; rb++) { - vrb_map[rb + rbStart] |= SL_to_bitmap(tda_info->startSymbolIndex, tda_info->nrOfSymbols); + vrb_map[rb + type0_PDCCH_CSS_config->cset_start_rb] |= SL_to_bitmap(tda_info->startSymbolIndex, tda_info->nrOfSymbols); } return TBS; } -static void nr_fill_nfapi_dl_sib1_pdu(int Mod_idP, - nfapi_nr_dl_tti_request_body_t *dl_req, - int pdu_index, - NR_Type0_PDCCH_CSS_config_t *type0_PDCCH_CSS_config, - uint32_t TBS, - int StartSymbolIndex, - int NrOfSymbols) +static void nr_fill_nfapi_dl_SIB_pdu(int Mod_idP, + NR_UE_sched_osi_ctrl_t *sched_osi, + NR_UE_sched_ctrl_t *sched_ctrlCommon, + nfapi_nr_dl_tti_request_body_t *dl_req, + int pdu_index, + NR_Type0_PDCCH_CSS_config_t *type0_PDCCH_CSS_config, + uint32_t TBS, + int StartSymbolIndex, + int NrOfSymbols) { + // will set data according to SIB type (SIB1/OtherSI) + NR_sched_pdsch_t *pdsch = (sched_ctrlCommon ? &sched_ctrlCommon->sched_pdsch : &sched_osi->sched_pdsch); + NR_sched_pdcch_t *pdcch = (sched_ctrlCommon ? &sched_ctrlCommon->sched_pdcch : &sched_osi->sched_pdcch); + NR_SearchSpace_t *search_space = (sched_ctrlCommon ? sched_ctrlCommon->search_space : sched_osi->search_space); + NR_ControlResourceSet_t *coreset = (sched_ctrlCommon ? sched_ctrlCommon->coreset : sched_osi->coreset); + uint8_t aggregation_level = (sched_ctrlCommon ? sched_ctrlCommon->aggregation_level : sched_osi->aggregation_level); + int cce_index = (sched_ctrlCommon ? sched_ctrlCommon->cce_index : sched_osi->cce_index); + gNB_MAC_INST *gNB_mac = RC.nrmac[Mod_idP]; NR_COMMON_channels_t *cc = gNB_mac->common_channels; NR_ServingCellConfigCommon_t *scc = cc->ServingCellConfigCommon; int mcsTableIdx = 0; - NR_sched_pdsch_t *pdsch = &gNB_mac->sched_ctrlCommon->sched_pdsch; + nfapi_nr_dl_tti_request_pdu_t *dl_tti_pdcch_pdu = &dl_req->dl_tti_pdu_list[dl_req->nPDUs]; - memset((void*)dl_tti_pdcch_pdu,0,sizeof(nfapi_nr_dl_tti_request_pdu_t)); + memset(dl_tti_pdcch_pdu, 0, sizeof(*dl_tti_pdcch_pdu)); dl_tti_pdcch_pdu->PDUType = NFAPI_NR_DL_TTI_PDCCH_PDU_TYPE; dl_tti_pdcch_pdu->PDUSize = (uint16_t)(4+sizeof(nfapi_nr_dl_tti_pdcch_pdu)); dl_req->nPDUs += 1; nfapi_nr_dl_tti_pdcch_pdu_rel15_t *pdcch_pdu_rel15 = &dl_tti_pdcch_pdu->pdcch_pdu.pdcch_pdu_rel15; nr_configure_pdcch(pdcch_pdu_rel15, - gNB_mac->sched_ctrlCommon->coreset, - &gNB_mac->sched_ctrlCommon->sched_pdcch, - false); + coreset, + pdcch, + sched_ctrlCommon ? false : true); nfapi_nr_dl_tti_request_pdu_t *dl_tti_pdsch_pdu = &dl_req->dl_tti_pdu_list[dl_req->nPDUs]; - memset((void*)dl_tti_pdsch_pdu,0,sizeof(nfapi_nr_dl_tti_request_pdu_t)); + memset(dl_tti_pdsch_pdu, 0, sizeof(*dl_tti_pdcch_pdu)); dl_tti_pdsch_pdu->PDUType = NFAPI_NR_DL_TTI_PDSCH_PDU_TYPE; dl_tti_pdsch_pdu->PDUSize = (uint16_t)(4+sizeof(nfapi_nr_dl_tti_pdsch_pdu)); dl_req->nPDUs += 1; @@ -591,156 +567,14 @@ static void nr_fill_nfapi_dl_sib1_pdu(int Mod_idP, pdsch_pdu_rel15->StartSymbolIndex = StartSymbolIndex; pdsch_pdu_rel15->NrOfSymbols = NrOfSymbols; pdsch_pdu_rel15->dlDmrsSymbPos = pdsch->dmrs_parms.dl_dmrs_symb_pos; - LOG_D(NR_MAC,"sib1:bwpStart %d, bwpSize %d\n",pdsch_pdu_rel15->BWPStart,pdsch_pdu_rel15->BWPSize); - LOG_D(NR_MAC,"sib1:rbStart %d, rbSize %d\n",pdsch_pdu_rel15->rbStart,pdsch_pdu_rel15->rbSize); - LOG_D(NR_MAC,"sib1:dlDmrsSymbPos = 0x%x\n", pdsch_pdu_rel15->dlDmrsSymbPos); - pdsch_pdu_rel15->maintenance_parms_v3.tbSizeLbrmBytes = nr_compute_tbslbrm(0, - pdsch_pdu_rel15->BWPSize, - 1); - pdsch_pdu_rel15->maintenance_parms_v3.ldpcBaseGraph = get_BG(TBS<<3,pdsch_pdu_rel15->targetCodeRate[0]); - - /* Fill PDCCH DL DCI PDU */ - nfapi_nr_dl_dci_pdu_t *dci_pdu = &pdcch_pdu_rel15->dci_pdu[pdcch_pdu_rel15->numDlDci]; - pdcch_pdu_rel15->numDlDci++; - dci_pdu->RNTI = SI_RNTI; - dci_pdu->ScramblingId = *scc->physCellId; - dci_pdu->ScramblingRNTI = 0; - dci_pdu->AggregationLevel = gNB_mac->sched_ctrlCommon->aggregation_level; - dci_pdu->CceIndex = gNB_mac->sched_ctrlCommon->cce_index; - dci_pdu->beta_PDCCH_1_0 = 0; - dci_pdu->powerControlOffsetSS = 1; - - /* DCI payload */ - dci_pdu_rel15_t dci_payload; - memset(&dci_payload, 0, sizeof(dci_pdu_rel15_t)); - - dci_payload.bwp_indicator.val = 0; - - // frequency domain assignment - dci_payload.frequency_domain_assignment.val = PRBalloc_to_locationandbandwidth0( - pdsch_pdu_rel15->rbSize, pdsch_pdu_rel15->rbStart, type0_PDCCH_CSS_config->num_rbs); - - dci_payload.time_domain_assignment.val = gNB_mac->sched_ctrlCommon->sched_pdsch.time_domain_allocation; - dci_payload.mcs = pdsch->mcs; - dci_payload.rv = pdsch_pdu_rel15->rvIndex[0]; - dci_payload.harq_pid.val = 0; - dci_payload.ndi = 0; - dci_payload.dai[0].val = 0; - dci_payload.tpc = 0; // table 7.2.1-1 in 38.213 - dci_payload.pucch_resource_indicator = 0; - dci_payload.pdsch_to_harq_feedback_timing_indicator.val = 0; - dci_payload.antenna_ports.val = 0; - dci_payload.dmrs_sequence_initialization.val = pdsch_pdu_rel15->SCID; - - int dci_format = NR_DL_DCI_FORMAT_1_0; - int rnti_type = TYPE_SI_RNTI_; - - fill_dci_pdu_rel15(NULL, - NULL, - NULL, - &pdcch_pdu_rel15->dci_pdu[pdcch_pdu_rel15->numDlDci - 1], - &dci_payload, - dci_format, - rnti_type, - 0, - gNB_mac->sched_ctrlCommon->search_space, - gNB_mac->sched_ctrlCommon->coreset, - 0, // parameter not needed for DCI 1_0 - gNB_mac->cset0_bwp_size); - - LOG_D(MAC,"BWPSize: %i\n", pdcch_pdu_rel15->BWPSize); - LOG_D(MAC,"BWPStart: %i\n", pdcch_pdu_rel15->BWPStart); - LOG_D(MAC,"SubcarrierSpacing: %i\n", pdcch_pdu_rel15->SubcarrierSpacing); - LOG_D(MAC,"CyclicPrefix: %i\n", pdcch_pdu_rel15->CyclicPrefix); - LOG_D(MAC,"StartSymbolIndex: %i\n", pdcch_pdu_rel15->StartSymbolIndex); - LOG_D(MAC,"DurationSymbols: %i\n", pdcch_pdu_rel15->DurationSymbols); - for(int n=0;n<6;n++) LOG_D(MAC,"FreqDomainResource[%i]: %x\n",n, pdcch_pdu_rel15->FreqDomainResource[n]); - LOG_D(MAC,"CceRegMappingType: %i\n", pdcch_pdu_rel15->CceRegMappingType); - LOG_D(MAC,"RegBundleSize: %i\n", pdcch_pdu_rel15->RegBundleSize); - LOG_D(MAC,"InterleaverSize: %i\n", pdcch_pdu_rel15->InterleaverSize); - LOG_D(MAC,"CoreSetType: %i\n", pdcch_pdu_rel15->CoreSetType); - LOG_D(MAC,"ShiftIndex: %i\n", pdcch_pdu_rel15->ShiftIndex); - LOG_D(MAC,"precoderGranularity: %i\n", pdcch_pdu_rel15->precoderGranularity); - LOG_D(MAC,"numDlDci: %i\n", pdcch_pdu_rel15->numDlDci); -} - - -static void nr_fill_nfapi_dl_other_si_pdu(int Mod_idP, - nfapi_nr_dl_tti_request_body_t *dl_req, - int pdu_index, - NR_Type0_PDCCH_CSS_config_t *type0_PDCCH_CSS_config, - uint32_t TBS, - int StartSymbolIndex, - int NrOfSymbols) -{ - gNB_MAC_INST *gNB_mac = RC.nrmac[Mod_idP]; - NR_COMMON_channels_t *cc = gNB_mac->common_channels; - NR_ServingCellConfigCommon_t *scc = cc->ServingCellConfigCommon; - int mcsTableIdx = 0; - NR_sched_pdsch_t *pdsch = &gNB_mac->sched_osi->sched_pdsch; - nfapi_nr_dl_tti_request_pdu_t *dl_tti_pdcch_pdu = &dl_req->dl_tti_pdu_list[dl_req->nPDUs]; - memset((void*)dl_tti_pdcch_pdu,0,sizeof(nfapi_nr_dl_tti_request_pdu_t)); - dl_tti_pdcch_pdu->PDUType = NFAPI_NR_DL_TTI_PDCCH_PDU_TYPE; - dl_tti_pdcch_pdu->PDUSize = (uint16_t)(4+sizeof(nfapi_nr_dl_tti_pdcch_pdu)); - dl_req->nPDUs += 1; - nfapi_nr_dl_tti_pdcch_pdu_rel15_t *pdcch_pdu_rel15 = &dl_tti_pdcch_pdu->pdcch_pdu.pdcch_pdu_rel15; - nr_configure_pdcch(pdcch_pdu_rel15, - gNB_mac->sched_osi->coreset, - &gNB_mac->sched_osi->sched_pdcch, - true); - - nfapi_nr_dl_tti_request_pdu_t *dl_tti_pdsch_pdu = &dl_req->dl_tti_pdu_list[dl_req->nPDUs]; - memset((void*)dl_tti_pdsch_pdu,0,sizeof(nfapi_nr_dl_tti_request_pdu_t)); - dl_tti_pdsch_pdu->PDUType = NFAPI_NR_DL_TTI_PDSCH_PDU_TYPE; - dl_tti_pdsch_pdu->PDUSize = (uint16_t)(4+sizeof(nfapi_nr_dl_tti_pdsch_pdu)); - dl_req->nPDUs += 1; - nfapi_nr_dl_tti_pdsch_pdu_rel15_t *pdsch_pdu_rel15 = &dl_tti_pdsch_pdu->pdsch_pdu.pdsch_pdu_rel15; - - pdsch_pdu_rel15->precodingAndBeamforming.num_prgs=0; - pdsch_pdu_rel15->precodingAndBeamforming.prg_size=0; - pdsch_pdu_rel15->precodingAndBeamforming.dig_bf_interfaces=0; - pdsch_pdu_rel15->precodingAndBeamforming.prgs_list[0].pm_idx = 0; - pdsch_pdu_rel15->precodingAndBeamforming.prgs_list[0].dig_bf_interface_list[0].beam_idx = 0; - - pdcch_pdu_rel15->CoreSetType = NFAPI_NR_CSET_CONFIG_MIB_SIB1; - - pdsch_pdu_rel15->pduBitmap = 0; - pdsch_pdu_rel15->rnti = SI_RNTI; - pdsch_pdu_rel15->pduIndex = pdu_index; - - pdsch_pdu_rel15->BWPSize = type0_PDCCH_CSS_config->num_rbs; - pdsch_pdu_rel15->BWPStart = type0_PDCCH_CSS_config->cset_start_rb; - - pdsch_pdu_rel15->SubcarrierSpacing = type0_PDCCH_CSS_config->scs_pdcch; - pdsch_pdu_rel15->CyclicPrefix = 0; - - pdsch_pdu_rel15->NrOfCodewords = 1; - pdsch_pdu_rel15->targetCodeRate[0] = nr_get_code_rate_dl(pdsch->mcs, mcsTableIdx); - pdsch_pdu_rel15->qamModOrder[0] = nr_get_Qm_dl(pdsch->mcs, mcsTableIdx); - pdsch_pdu_rel15->mcsIndex[0] = pdsch->mcs; - pdsch_pdu_rel15->mcsTable[0] = mcsTableIdx; - pdsch_pdu_rel15->rvIndex[0] = nr_rv_round_map[0]; - pdsch_pdu_rel15->dataScramblingId = *scc->physCellId; - pdsch_pdu_rel15->nrOfLayers = 1; - pdsch_pdu_rel15->transmissionScheme = 0; - pdsch_pdu_rel15->refPoint = 1; - pdsch_pdu_rel15->dmrsConfigType = 0; - pdsch_pdu_rel15->dlDmrsScramblingId = *scc->physCellId; - pdsch_pdu_rel15->SCID = 0; - pdsch_pdu_rel15->numDmrsCdmGrpsNoData = pdsch->dmrs_parms.numDmrsCdmGrpsNoData; - pdsch_pdu_rel15->dmrsPorts = 1; - pdsch_pdu_rel15->resourceAlloc = 1; - pdsch_pdu_rel15->rbStart = pdsch->rbStart; - pdsch_pdu_rel15->rbSize = pdsch->rbSize; - pdsch_pdu_rel15->VRBtoPRBMapping = 0; - pdsch_pdu_rel15->TBSize[0] = TBS; - pdsch_pdu_rel15->StartSymbolIndex = StartSymbolIndex; - pdsch_pdu_rel15->NrOfSymbols = NrOfSymbols; - pdsch_pdu_rel15->dlDmrsSymbPos = pdsch->dmrs_parms.dl_dmrs_symb_pos; - LOG_D(NR_MAC,"sib19:bwpStart %d, bwpSize %d\n",pdsch_pdu_rel15->BWPStart,pdsch_pdu_rel15->BWPSize); - LOG_D(NR_MAC,"sib19:rbStart %d, rbSize %d\n",pdsch_pdu_rel15->rbStart,pdsch_pdu_rel15->rbSize); - LOG_D(NR_MAC,"sib19:dlDmrsSymbPos = 0x%x\n", pdsch_pdu_rel15->dlDmrsSymbPos); + LOG_D(NR_MAC, + "OtherSI:bwpStart %d, bwpSize %d, rbStart %d, rbSize %d, dlDmrsSymbPos = 0x%x\n", + pdsch_pdu_rel15->BWPStart, + pdsch_pdu_rel15->BWPSize, + pdsch_pdu_rel15->rbStart, + pdsch_pdu_rel15->rbSize, + pdsch_pdu_rel15->dlDmrsSymbPos); pdsch_pdu_rel15->maintenance_parms_v3.tbSizeLbrmBytes = nr_compute_tbslbrm(0, pdsch_pdu_rel15->BWPSize, @@ -753,8 +587,8 @@ static void nr_fill_nfapi_dl_other_si_pdu(int Mod_idP, dci_pdu->RNTI = SI_RNTI; dci_pdu->ScramblingId = *scc->physCellId; dci_pdu->ScramblingRNTI = 0; - dci_pdu->AggregationLevel = gNB_mac->sched_osi->aggregation_level; - dci_pdu->CceIndex = gNB_mac->sched_osi->cce_index; + dci_pdu->AggregationLevel = aggregation_level; + dci_pdu->CceIndex = cce_index; dci_pdu->beta_PDCCH_1_0 = 0; dci_pdu->powerControlOffsetSS = 1; @@ -768,7 +602,7 @@ static void nr_fill_nfapi_dl_other_si_pdu(int Mod_idP, dci_payload.frequency_domain_assignment.val = PRBalloc_to_locationandbandwidth0( pdsch_pdu_rel15->rbSize, pdsch_pdu_rel15->rbStart, type0_PDCCH_CSS_config->num_rbs); - dci_payload.time_domain_assignment.val = gNB_mac->sched_osi->sched_pdsch.time_domain_allocation; + dci_payload.time_domain_assignment.val = pdsch->time_domain_allocation; dci_payload.mcs = pdsch->mcs; dci_payload.rv = pdsch_pdu_rel15->rvIndex[0]; dci_payload.harq_pid.val = 0; @@ -779,7 +613,7 @@ static void nr_fill_nfapi_dl_other_si_pdu(int Mod_idP, dci_payload.pdsch_to_harq_feedback_timing_indicator.val = 0; dci_payload.antenna_ports.val = 0; dci_payload.dmrs_sequence_initialization.val = pdsch_pdu_rel15->SCID; - dci_payload.system_info_indicator = 1; + dci_payload.system_info_indicator = sched_ctrlCommon ? 0 : 1; int dci_format = NR_DL_DCI_FORMAT_1_0; int rnti_type = TYPE_SI_RNTI_; @@ -792,26 +626,28 @@ static void nr_fill_nfapi_dl_other_si_pdu(int Mod_idP, dci_format, rnti_type, 0, - gNB_mac->sched_osi->search_space, - gNB_mac->sched_osi->coreset, + search_space, + coreset, 0, gNB_mac->cset0_bwp_size); - - LOG_D(MAC,"BWPSize: %i\n", pdcch_pdu_rel15->BWPSize); - LOG_D(MAC,"BWPStart: %i\n", pdcch_pdu_rel15->BWPStart); - LOG_D(MAC,"SubcarrierSpacing: %i\n", pdcch_pdu_rel15->SubcarrierSpacing); - LOG_D(MAC,"CyclicPrefix: %i\n", pdcch_pdu_rel15->CyclicPrefix); - LOG_D(MAC,"StartSymbolIndex: %i\n", pdcch_pdu_rel15->StartSymbolIndex); - LOG_D(MAC,"DurationSymbols: %i\n", pdcch_pdu_rel15->DurationSymbols); - for(int n=0;n<6;n++) LOG_D(MAC,"FreqDomainResource[%i]: %x\n",n, pdcch_pdu_rel15->FreqDomainResource[n]); - LOG_D(MAC,"CceRegMappingType: %i\n", pdcch_pdu_rel15->CceRegMappingType); - LOG_D(MAC,"RegBundleSize: %i\n", pdcch_pdu_rel15->RegBundleSize); - LOG_D(MAC,"InterleaverSize: %i\n", pdcch_pdu_rel15->InterleaverSize); - LOG_D(MAC,"CoreSetType: %i\n", pdcch_pdu_rel15->CoreSetType); - LOG_D(MAC,"ShiftIndex: %i\n", pdcch_pdu_rel15->ShiftIndex); - LOG_D(MAC,"precoderGranularity: %i\n", pdcch_pdu_rel15->precoderGranularity); - LOG_D(MAC,"numDlDci: %i\n", pdcch_pdu_rel15->numDlDci); + LOG_D(MAC, + "BWPSize: %3i, BWPStart: %3i, SubcarrierSpacing: %i, CyclicPrefix: %i, StartSymbolIndex: %i, DurationSymbols: %i, " + "CceRegMappingType: %i, RegBundleSize: %i, InterleaverSize: %i, CoreSetType: %i, ShiftIndex: %i, precoderGranularity: %i, " + "numDlDci: %i\n", + pdcch_pdu_rel15->BWPSize, + pdcch_pdu_rel15->BWPStart, + pdcch_pdu_rel15->SubcarrierSpacing, + pdcch_pdu_rel15->CyclicPrefix, + pdcch_pdu_rel15->StartSymbolIndex, + pdcch_pdu_rel15->DurationSymbols, + pdcch_pdu_rel15->CceRegMappingType, + pdcch_pdu_rel15->RegBundleSize, + pdcch_pdu_rel15->InterleaverSize, + pdcch_pdu_rel15->CoreSetType, + pdcch_pdu_rel15->ShiftIndex, + pdcch_pdu_rel15->precoderGranularity, + pdcch_pdu_rel15->numDlDci); } void schedule_nr_sib1(module_id_t module_idP, @@ -885,7 +721,15 @@ void schedule_nr_sib1(module_id_t module_idP, nfapi_nr_dl_tti_request_body_t *dl_req = &DL_req->dl_tti_request_body; int pdu_index = gNB_mac->pdu_index[0]++; - nr_fill_nfapi_dl_sib1_pdu(module_idP, dl_req, pdu_index, type0_PDCCH_CSS_config, TBS, tda_info.startSymbolIndex, tda_info.nrOfSymbols); + nr_fill_nfapi_dl_SIB_pdu(module_idP, + NULL, + gNB_mac->sched_ctrlCommon, + dl_req, + pdu_index, + type0_PDCCH_CSS_config, + TBS, + tda_info.startSymbolIndex, + tda_info.nrOfSymbols); const int ntx_req = TX_req->Number_of_PDUs; nfapi_nr_pdu_t *tx_req = &TX_req->pdu_list[ntx_req]; @@ -915,14 +759,30 @@ void schedule_nr_sib1(module_id_t module_idP, } } +struct NR_SchedulingInfo2_r17 *find_sib19_sched_info(const struct NR_SI_SchedulingInfo_v1700 *si_schedulinginfo2_r17) +{ + for (int i = 0; i < si_schedulinginfo2_r17->schedulingInfoList2_r17.list.count; i++) { + const struct NR_SIB_Mapping_v1700 *sib_MappingInfo_r17 = + &si_schedulinginfo2_r17->schedulingInfoList2_r17.list.array[i]->sib_MappingInfo_r17; + for (int j = 0; j < sib_MappingInfo_r17->list.count; j++) { + if (sib_MappingInfo_r17->list.array[j]->sibType_r17.choice.type1_r17 + == NR_SIB_TypeInfo_v1700__sibType_r17__type1_r17_sibType19) { + return si_schedulinginfo2_r17->schedulingInfoList2_r17.list.array[i]; + } + } + } + return NULL; +} + void schedule_nr_sib19(module_id_t module_idP, frame_t frameP, sub_frame_t slotP, nfapi_nr_dl_tti_request_t *DL_req, - nfapi_nr_tx_data_request_t *TX_req) + nfapi_nr_tx_data_request_t *TX_req, + int sib19_bcch_length, + uint8_t *sib19_bcch_pdu) { /* already mutex protected: held in gNB_dlsch_ulsch_scheduler() */ - // TODO: Get these values from RRC const int CC_id = 0; uint8_t candidate_idx = 0; @@ -931,35 +791,23 @@ void schedule_nr_sib19(module_id_t module_idP, NR_ServingCellConfigCommon_t *scc = gNB_mac->common_channels[CC_id].ServingCellConfigCommon; NR_COMMON_channels_t *cc = &gNB_mac->common_channels[0]; + // there is no reason to execute further if sched_osi not initialized + if (!gNB_mac->sched_osi) + return; + // get sib19 scheduling info from sib1 struct NR_SI_SchedulingInfo_v1700 *si_schedulinginfo2_r17 = cc->sib1->message.choice.c1->choice.systemInformationBlockType1->nonCriticalExtension->nonCriticalExtension->nonCriticalExtension->si_SchedulingInfo_v1700; - struct NR_SchedulingInfo2_r17 *sib19_sched_info = NULL; - if (!si_schedulinginfo2_r17) { LOG_E(GNB_APP, "SIB1 does not contain si_SchedulingInfo_v1700\n"); return; } - bool found = false; - for (int i = 0; i < si_schedulinginfo2_r17->schedulingInfoList2_r17.list.count; i++) { - for (int j= 0; j < si_schedulinginfo2_r17->schedulingInfoList2_r17.list.array[i]->sib_MappingInfo_r17.list.count; j++) { - if (si_schedulinginfo2_r17->schedulingInfoList2_r17.list.array[i]->sib_MappingInfo_r17.list.array[j]->sibType_r17.choice.type1_r17 == - NR_SIB_TypeInfo_v1700__sibType_r17__type1_r17_sibType19) { - found = true; - sib19_sched_info = si_schedulinginfo2_r17->schedulingInfoList2_r17.list.array[i]; - break; - } - } - if (found) - break; - } - - if (!found) - { + struct NR_SchedulingInfo2_r17 *sib19_sched_info = find_sib19_sched_info(si_schedulinginfo2_r17); + if (!sib19_sched_info) { LOG_D(GNB_APP, "SIB1 does not contain scheduling info for SIB19\n"); return; } - + // convert periodicity enum type into actual frames number int frame = 8 << sib19_sched_info->si_Periodicity_r17; @@ -988,6 +836,9 @@ void schedule_nr_sib19(module_id_t module_idP, (slotP == ((sib19_sched_info->si_WindowPosition_r17 % window_length) - 1)) && (type0_PDCCH_CSS_config->num_rbs > 0)) { + const int n_slots_frame = nr_slots_per_frame[*scc->ssbSubcarrierSpacing]; + NR_beam_alloc_t beam = beam_allocation_procedure(&gNB_mac->beam_info, frameP, slotP, i, n_slots_frame); + AssertFatal(beam.idx >= 0, "Cannot allocate SIB19 corresponding to SSB %d in any available beam\n", i); LOG_D(NR_MAC,"(%d.%d) SIB19 transmission: ssb_index %d\n", frameP, slotP, type0_PDCCH_CSS_config->ssb_index); NR_tda_info_t tda_info = set_tda_info_from_list(scc->downlinkConfigCommon->initialDownlinkBWP->pdsch_ConfigCommon->choice.setup->pdsch_TimeDomainAllocationList, time_domain_allocation); @@ -1001,23 +852,34 @@ void schedule_nr_sib19(module_id_t module_idP, 1); // Configure sched_osi for SIB19 - uint32_t TBS = schedule_control_other_si(module_idP, CC_id, - type0_PDCCH_CSS_config, - time_domain_allocation, - &dmrs_parms, - &tda_info, - candidate_idx, - cc->sib19_bcch_length); + uint32_t TBS = schedule_control_other_si(module_idP, + CC_id, + type0_PDCCH_CSS_config, + time_domain_allocation, + &dmrs_parms, + &tda_info, + candidate_idx, + beam.idx, + sib19_bcch_length); nfapi_nr_dl_tti_request_body_t *dl_req = &DL_req->dl_tti_request_body; int pdu_index = gNB_mac->pdu_index[0]++; - nr_fill_nfapi_dl_other_si_pdu(module_idP, dl_req, pdu_index, type0_PDCCH_CSS_config, TBS, tda_info.startSymbolIndex, tda_info.nrOfSymbols); + + nr_fill_nfapi_dl_SIB_pdu(module_idP, + gNB_mac->sched_osi, + NULL, + dl_req, + pdu_index, + type0_PDCCH_CSS_config, + TBS, + tda_info.startSymbolIndex, + tda_info.nrOfSymbols); const int ntx_req = TX_req->Number_of_PDUs; nfapi_nr_pdu_t *tx_req = &TX_req->pdu_list[ntx_req]; // Data to be transmitted - memcpy(tx_req->TLVs[0].value.direct, cc->sib19_bcch_pdu, TBS); + memcpy(tx_req->TLVs[0].value.direct, sib19_bcch_pdu, TBS); tx_req->PDU_length = TBS; tx_req->PDU_index = pdu_index; @@ -1032,11 +894,11 @@ void schedule_nr_sib19(module_id_t module_idP, T(T_GNB_MAC_DL_PDU_WITH_DATA, T_INT(module_idP), T_INT(CC_id), - T_INT(0xffff), + T_INT(SI_RNTI), T_INT(frameP), T_INT(slotP), T_INT(0 /* harq_pid */), - T_BUFFER(cc->sib19_bcch_pdu, cc->sib19_bcch_length)); + T_BUFFER(sib19_bcch_pdu, sib19_bcch_length)); } } } \ No newline at end of file diff --git a/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_primitives.c b/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_primitives.c index f5c322ecaa..6d0dc01112 100644 --- a/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_primitives.c +++ b/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_primitives.c @@ -893,17 +893,9 @@ void nr_configure_pdcch(nfapi_nr_dl_tti_pdcch_pdu_rel15_t *pdcch_pdu, pdcch_pdu->InterleaverSize = pdcch->InterleaverSize; pdcch_pdu->ShiftIndex = pdcch->ShiftIndex; - if (otherSI) { - pdcch_pdu->CoreSetType = NFAPI_NR_CSET_CONFIG_PDCCH_CONFIG; - } - else { - if (coreset->controlResourceSetId == 0) { - pdcch_pdu->CoreSetType = NFAPI_NR_CSET_CONFIG_MIB_SIB1; - } else { - pdcch_pdu->CoreSetType = NFAPI_NR_CSET_CONFIG_PDCCH_CONFIG; - } - } - + pdcch_pdu->CoreSetType = + (otherSI || coreset->controlResourceSetId != 0) ? NFAPI_NR_CSET_CONFIG_PDCCH_CONFIG : NFAPI_NR_CSET_CONFIG_MIB_SIB1; + //precoderGranularity pdcch_pdu->precoderGranularity = coreset->precoderGranularity; } diff --git a/openair2/LAYER2/NR_MAC_gNB/mac_proto.h b/openair2/LAYER2/NR_MAC_gNB/mac_proto.h index 5ab125eade..a869e172fd 100644 --- a/openair2/LAYER2/NR_MAC_gNB/mac_proto.h +++ b/openair2/LAYER2/NR_MAC_gNB/mac_proto.h @@ -46,6 +46,7 @@ void mac_top_init_gNB(ngran_node_t node_type, void nr_mac_send_f1_setup_req(void); void nr_mac_config_scc(gNB_MAC_INST *nrmac, NR_ServingCellConfigCommon_t *scc, const nr_mac_config_t *mac_config); +void nr_fill_sched_osi(gNB_MAC_INST *nrmac, const struct NR_SetupRelease_PDCCH_ConfigCommon *pdcch_ConfigCommon); void nr_mac_configure_sib1(gNB_MAC_INST *nrmac, const f1ap_plmn_t *plmn, uint64_t cellID, int tac); void nr_mac_configure_sib19(gNB_MAC_INST *nrmac); @@ -91,7 +92,11 @@ void schedule_nr_sib19(module_id_t module_idP, frame_t frameP, sub_frame_t slotP, nfapi_nr_dl_tti_request_t *DL_req, - nfapi_nr_tx_data_request_t *TX_req); + nfapi_nr_tx_data_request_t *TX_req, + int sib19_bcch_length, + uint8_t *sib19_bcch_pdu); + +struct NR_SchedulingInfo2_r17* find_sib19_sched_info(const struct NR_SI_SchedulingInfo_v1700*); void schedule_nr_mib(module_id_t module_idP, frame_t frameP, sub_frame_t slotP, nfapi_nr_dl_tti_request_t *DL_req);