diff --git a/lib/include/srsran/common/phy_cfg_nr.h b/lib/include/srsran/common/phy_cfg_nr.h index 8d2d482a6..327d28443 100644 --- a/lib/include/srsran/common/phy_cfg_nr.h +++ b/lib/include/srsran/common/phy_cfg_nr.h @@ -148,6 +148,13 @@ struct phy_cfg_nr_t { bool get_pusch_uci_cfg(const srsran_slot_cfg_t& slot_cfg, const srsran_uci_cfg_nr_t& uci_cfg, srsran_sch_cfg_nr_t& pusch_cfg) const; + + /** + * @brief Generate SSB configuration from the overall configuration + * @attention Sampling rate is the only parameter missing + * @return valid SSB configuration + */ + srsran_ssb_cfg_t get_ssb_cfg() const; }; } // namespace srsran diff --git a/lib/src/common/phy_cfg_nr.cc b/lib/src/common/phy_cfg_nr.cc index 47251b440..cc096bb90 100644 --- a/lib/src/common/phy_cfg_nr.cc +++ b/lib/src/common/phy_cfg_nr.cc @@ -11,6 +11,7 @@ */ #include "srsran/common/phy_cfg_nr.h" +#include "srsran/common/band_helper.h" #include "srsran/srsran.h" namespace srsran { @@ -337,4 +338,30 @@ bool phy_cfg_nr_t::get_pusch_uci_cfg(const srsran_slot_cfg_t& slot_cfg, return true; } +srsran_ssb_cfg_t phy_cfg_nr_t::get_ssb_cfg() const +{ + // Retrieve band + srsran::srsran_band_helper bh = srsran::srsran_band_helper(); + uint16_t band = bh.get_band_from_dl_freq_Hz(carrier.dl_center_frequency_hz); + srsran_assert(band != UINT16_MAX, + "DL frequency %f MHz does not belong to any valid band", + carrier.dl_center_frequency_hz / 1e6); + + // Make SSB configuration + srsran_ssb_cfg_t ssb_cfg = {}; + ssb_cfg.center_freq_hz = carrier.dl_center_frequency_hz; + ssb_cfg.ssb_freq_hz = carrier.ssb_center_freq_hz; + ssb_cfg.scs = ssb.scs; + ssb_cfg.pattern = bh.get_ssb_pattern(band, ssb.scs); + ssb_cfg.duplex_mode = duplex.mode; + ssb_cfg.periodicity_ms = ssb.periodicity_ms; + + srsran_assert(ssb_cfg.pattern != SRSRAN_SSB_PATTERN_INVALID, + "Invalid SSB pattern for band %d and SSB subcarrier spacing %s", + band, + srsran_subcarrier_spacing_to_str(ssb.scs)); + + return ssb_cfg; +} + } // namespace srsran diff --git a/lib/src/common/phy_cfg_nr_default.cc b/lib/src/common/phy_cfg_nr_default.cc index 3db7be641..5cc362700 100644 --- a/lib/src/common/phy_cfg_nr_default.cc +++ b/lib/src/common/phy_cfg_nr_default.cc @@ -417,6 +417,17 @@ phy_cfg_nr_default_t::phy_cfg_nr_default_t(const reference_cfg_t& reference_cfg) srsran_assertion_failure("Invalid TDD reference"); } + if (duplex.mode == SRSRAN_DUPLEX_MODE_TDD) { + carrier.dl_center_frequency_hz = 3513.6e6; + ssb.scs = srsran_subcarrier_spacing_30kHz; + } else { + carrier.dl_center_frequency_hz = 881.5e6; + ssb.scs = srsran_subcarrier_spacing_15kHz; + } + carrier.ssb_center_freq_hz = carrier.dl_center_frequency_hz; + ssb.position_in_burst[0] = true; + ssb.periodicity_ms = 5; + switch (reference_cfg.pdcch) { case reference_cfg_t::R_PDCCH_CUSTOM_COMMON_SS: make_pdcch_custom_common_ss(pdcch, carrier);