diff --git a/lib/include/srsran/asn1/rrc_nr_utils.h b/lib/include/srsran/asn1/rrc_nr_utils.h index 18d284646..60c38cfa5 100644 --- a/lib/include/srsran/asn1/rrc_nr_utils.h +++ b/lib/include/srsran/asn1/rrc_nr_utils.h @@ -58,6 +58,7 @@ struct serving_cell_cfg_common_s; struct serving_cell_cfg_s; struct pdcch_cfg_common_s; struct pdcch_cfg_s; +struct mib_s; } // namespace rrc_nr } // namespace asn1 @@ -115,6 +116,7 @@ bool make_phy_carrier_cfg(const asn1::rrc_nr::freq_info_dl_s& freq_info_dl, srsr bool make_phy_ssb_cfg(const srsran_carrier_nr_t& carrier, const asn1::rrc_nr::serving_cell_cfg_common_s& serv_cell_cfg, phy_cfg_nr_t::ssb_cfg_t* ssb); +bool make_phy_mib(const asn1::rrc_nr::mib_s& mib_cfg, srsran_mib_nr_t* mib); bool make_pdsch_cfg_from_serv_cell(const asn1::rrc_nr::serving_cell_cfg_s& serv_cell, srsran_sch_hl_cfg_nr_t* sch_hl); bool make_csi_cfg_from_serv_cell(const asn1::rrc_nr::serving_cell_cfg_s& serv_cell, srsran_csi_hl_cfg_t* csi_hl); bool make_duplex_cfg_from_serv_cell(const asn1::rrc_nr::serving_cell_cfg_common_s& serv_cell, diff --git a/lib/src/asn1/rrc_nr_utils.cc b/lib/src/asn1/rrc_nr_utils.cc index e11633519..e27321582 100644 --- a/lib/src/asn1/rrc_nr_utils.cc +++ b/lib/src/asn1/rrc_nr_utils.cc @@ -1480,6 +1480,23 @@ bool make_phy_ssb_cfg(const srsran_carrier_nr_t& carrier, return true; } +bool make_phy_mib(const asn1::rrc_nr::mib_s& mib_cfg, srsran_mib_nr_t* mib) +{ + mib->sfn = 0; + mib->ssb_idx = 0; + mib->hrf = 0; + mib->scs_common = + mib_cfg.sub_carrier_spacing_common.value == asn1::rrc_nr::mib_s::sub_carrier_spacing_common_opts::scs15or60 + ? srsran_subcarrier_spacing_15kHz + : srsran_subcarrier_spacing_30kHz; + mib->ssb_offset = mib_cfg.ssb_subcarrier_offset; + mib->dmrs_typeA_pos = (srsran_dmrs_sch_typeA_pos_t)mib_cfg.dmrs_type_a_position.value; + mib->coreset0_idx = mib_cfg.pdcch_cfg_sib1.ctrl_res_set_zero; + mib->ss0_idx = mib_cfg.pdcch_cfg_sib1.search_space_zero; + mib->cell_barred = mib_cfg.cell_barred.value == asn1::rrc_nr::mib_s::cell_barred_opts::barred; + mib->intra_freq_reselection = mib_cfg.intra_freq_resel.value == asn1::rrc_nr::mib_s::intra_freq_resel_opts::allowed; +} + bool make_pdsch_cfg_from_serv_cell(const asn1::rrc_nr::serving_cell_cfg_s& serv_cell, srsran_sch_hl_cfg_nr_t* sch_hl) { if (serv_cell.csi_meas_cfg_present and diff --git a/srsgnb/hdr/stack/mac/sched_nr_interface.h b/srsgnb/hdr/stack/mac/sched_nr_interface.h index fc4a10766..edfef63e5 100644 --- a/srsgnb/hdr/stack/mac/sched_nr_interface.h +++ b/srsgnb/hdr/stack/mac/sched_nr_interface.h @@ -75,6 +75,7 @@ public: srsran_duplex_config_nr_t duplex = {}; srsran::phy_cfg_nr_t::ssb_cfg_t ssb = {}; srsran::bounded_vector bwps{1}; // idx0 for BWP-common + srsran_mib_nr_t mib; srsran::bounded_vector sibs; }; diff --git a/srsgnb/hdr/stack/mac/sched_nr_signalling.h b/srsgnb/hdr/stack/mac/sched_nr_signalling.h index 2ddf60eb1..e7cf95677 100644 --- a/srsgnb/hdr/stack/mac/sched_nr_signalling.h +++ b/srsgnb/hdr/stack/mac/sched_nr_signalling.h @@ -36,14 +36,18 @@ void sched_nzp_csi_rs(srsran::const_span nzp_csi_rs_set * * @param[in] sl_point Slot point carrying information about current slot. * @param[in] ssb_periodicity Periodicity of SSB in ms. - * @param[out] ssb_list List of SSB messages to be sent to PHY. + * @param[in] mib MIB message content + * @param[out] ssb_list List of SSB messages to be sent to PHY. * * @remark This function a is basic scheduling function that uses the following simplified assumption: * 1) Subcarrier spacing: 15kHz * 2) Frequency below 3GHz * 3) Position in Burst is 1000, i.e., Only the first SSB of the 4 opportunities gets scheduled */ -void sched_ssb_basic(const slot_point& sl_point, uint32_t ssb_periodicity, ssb_list& ssb_list); +void sched_ssb_basic(const slot_point& sl_point, + uint32_t ssb_periodicity, + const srsran_mib_nr_t& mib, + ssb_list& ssb_list); /// Fill DCI fields with SIB info bool fill_dci_sib(prb_interval interv, uint32_t sib_idx, const bwp_params_t& bwp_cfg, srsran_dci_dl_nr_t& dci); diff --git a/srsgnb/src/stack/mac/sched_nr_signalling.cc b/srsgnb/src/stack/mac/sched_nr_signalling.cc index 020d0aff1..3da24f9cc 100644 --- a/srsgnb/src/stack/mac/sched_nr_signalling.cc +++ b/srsgnb/src/stack/mac/sched_nr_signalling.cc @@ -46,7 +46,10 @@ void sched_nzp_csi_rs(srsran::const_span nzp_csi_rs_set } } -void sched_ssb_basic(const slot_point& sl_point, uint32_t ssb_periodicity, ssb_list& ssb_list) +void sched_ssb_basic(const slot_point& sl_point, + uint32_t ssb_periodicity, + const srsran_mib_nr_t& mib, + ssb_list& ssb_list) { if (ssb_list.full()) { srslog::fetch_basic_logger("MAC-NR").error("SCHED: Failed to allocate SSB"); @@ -66,17 +69,13 @@ void sched_ssb_basic(const slot_point& sl_point, uint32_t ssb_periodicity, ssb_l // code below is simplified, it assumes 15kHz subcarrier spacing and sub 3GHz carrier if (sl_point_mod == 0) { ssb_t ssb_msg = {}; - srsran_mib_nr_t mib_msg = {}; + srsran_mib_nr_t mib_msg = mib; mib_msg.sfn = sl_point.sfn(); mib_msg.hrf = (sl_point.slot_idx() % SRSRAN_NSLOTS_PER_FRAME_NR(srsran_subcarrier_spacing_15kHz) >= SRSRAN_NSLOTS_PER_FRAME_NR(srsran_subcarrier_spacing_15kHz) / 2); // This corresponds to "Position in Burst" = 1000 mib_msg.ssb_idx = 0; - // Setting the following 4 parameters is redundant, but it makes it explicit what values are passed to PHY - mib_msg.dmrs_typeA_pos = srsran_dmrs_sch_typeA_pos_2; - mib_msg.scs_common = srsran_subcarrier_spacing_15kHz; - mib_msg.coreset0_idx = 0; - mib_msg.ss0_idx = 0; + // Remaining MIB parameters remain constant // Pack mib message to be sent to PHY int packing_ret_code = srsran_pbch_msg_nr_mib_pack(&mib_msg, &ssb_msg.pbch_msg); @@ -95,7 +94,7 @@ void sched_dl_signalling(bwp_slot_allocator& bwp_alloc) cfg.idx = sl_pdcch.to_uint(); // Schedule SSB - sched_ssb_basic(sl_pdcch, bwp_params.cell_cfg.ssb.periodicity_ms, sl_grid.dl.phy.ssb); + sched_ssb_basic(sl_pdcch, bwp_params.cell_cfg.ssb.periodicity_ms, bwp_params.cell_cfg.mib, sl_grid.dl.phy.ssb); // Schedule NZP-CSI-RS sched_nzp_csi_rs(bwp_params.cfg.pdsch.nzp_csi_rs_sets, cfg, sl_grid.dl.phy.nzp_csi_rs); diff --git a/srsgnb/src/stack/mac/test/sched_nr_cfg_generators.h b/srsgnb/src/stack/mac/test/sched_nr_cfg_generators.h index fdbd02589..1ed5b0ca4 100644 --- a/srsgnb/src/stack/mac/test/sched_nr_cfg_generators.h +++ b/srsgnb/src/stack/mac/test/sched_nr_cfg_generators.h @@ -35,9 +35,11 @@ inline sched_nr_interface::cell_cfg_t get_default_cell_cfg( { sched_nr_interface::cell_cfg_t cell_cfg{}; - cell_cfg.carrier = phy_cfg.carrier; - cell_cfg.duplex = phy_cfg.duplex; - cell_cfg.ssb = phy_cfg.ssb; + cell_cfg.carrier = phy_cfg.carrier; + cell_cfg.duplex = phy_cfg.duplex; + cell_cfg.ssb = phy_cfg.ssb; + cell_cfg.mib.coreset0_idx = 6; + cell_cfg.mib.scs_common = srsran_subcarrier_spacing_15kHz; cell_cfg.bwps.resize(1); cell_cfg.bwps[0].pdcch = phy_cfg.pdcch; diff --git a/srsgnb/src/stack/rrc/rrc_nr.cc b/srsgnb/src/stack/rrc/rrc_nr.cc index 89babc3c7..f9f2e06ba 100644 --- a/srsgnb/src/stack/rrc/rrc_nr.cc +++ b/srsgnb/src/stack/rrc/rrc_nr.cc @@ -270,6 +270,8 @@ void rrc_nr::config_mac() srsran_assert(ret2, "Invalid NR cell configuration."); ret2 = srsran::make_duplex_cfg_from_serv_cell(base_sp_cell_cfg.recfg_with_sync.sp_cell_cfg_common, &cell.duplex); srsran_assert(ret2, "Invalid NR cell configuration."); + ret2 = srsran::make_phy_mib(cell_ctxt->mib, &cell.mib); + srsran_assert(ret2, "Invalid NR cell MIB configuration."); // Set SIB1 and SI messages cell.sibs.resize(cell_ctxt->sib_buffer.size());