From 69619d725a9d87a1b780f8754c1ba73379d960be Mon Sep 17 00:00:00 2001 From: Andre Puschmann Date: Wed, 8 Sep 2021 23:13:27 +0200 Subject: [PATCH] band_helper: add helper to derive UL ARFCN from DL ARFCN --- lib/include/srsran/common/band_helper.h | 11 +++++++++++ lib/src/common/band_helper.cc | 20 +++++++++++++++++++- 2 files changed, 30 insertions(+), 1 deletion(-) diff --git a/lib/include/srsran/common/band_helper.h b/lib/include/srsran/common/band_helper.h index 0ffde42c9..2779cf9c8 100644 --- a/lib/include/srsran/common/band_helper.h +++ b/lib/include/srsran/common/band_helper.h @@ -59,6 +59,17 @@ public: */ uint16_t get_band_from_dl_arfcn(uint32_t arfcn) const; + /** + * @brief Get the respective UL ARFCN of a DL ARFCN + * + * For paired spectrum (FDD) the function returns the respective ARFCN in the same band. + * For unparied spectrum (TDD) the function returns the same ARFCN. + * + * @param dl_arfcn The DL ARFCN + * @return uint32_t + */ + uint32_t get_ul_arfcn_from_dl_arfcn(uint32_t dl_arfcn) const; + /** * @brief Selects the SSB pattern case according to the band number and subcarrier spacing * @remark Described by TS 38.101-1 Table 5.4.3.3-1: Applicable SS raster entries per operating band diff --git a/lib/src/common/band_helper.cc b/lib/src/common/band_helper.cc index 5b760a480..b2ea0f925 100644 --- a/lib/src/common/band_helper.cc +++ b/lib/src/common/band_helper.cc @@ -32,7 +32,7 @@ double srsran_band_helper::nr_arfcn_to_freq(uint32_t nr_arfcn) return (params.F_REF_Offs_MHz * 1e6 + params.delta_F_global_kHz * (nr_arfcn - params.N_REF_Offs) * 1e3); } -// Implements 5.4.2.1 in TS 38.401 +// Implements 5.4.2.1 in TS 38.104 std::vector srsran_band_helper::get_bands_nr(uint32_t nr_arfcn, srsran_band_helper::delta_f_raster_t delta_f_raster) { @@ -79,6 +79,24 @@ uint16_t srsran_band_helper::get_band_from_dl_arfcn(uint32_t arfcn) const return UINT16_MAX; } +uint32_t srsran_band_helper::get_ul_arfcn_from_dl_arfcn(uint32_t dl_arfcn) const +{ + // return same ARFCN for TDD bands + if (get_duplex_mode(get_band_from_dl_arfcn(dl_arfcn)) == SRSRAN_DUPLEX_MODE_TDD) { + return dl_arfcn; + } + + // derive UL ARFCN for FDD bands + for (const auto& band : nr_band_table_fr1) { + if (band.band == get_band_from_dl_arfcn(dl_arfcn)) { + uint32_t offset = (dl_arfcn - band.dl_nref_first) / band.dl_nref_step; + return (band.ul_nref_first + offset * band.ul_nref_step); + } + } + + return UINT16_MAX; +} + srsran_ssb_patern_t srsran_band_helper::get_ssb_pattern(uint16_t band, srsran_subcarrier_spacing_t scs) const { // Look for the given band and SCS