From e07263ee2607d247b85b7b58b35a822162421f68 Mon Sep 17 00:00:00 2001 From: Xavier Arteaga Date: Tue, 17 Aug 2021 13:35:16 +0200 Subject: [PATCH] Added band helper for getting band from ARFCN --- lib/include/srsran/common/band_helper.h | 7 +++++++ lib/src/common/band_helper.cc | 12 ++++++++++++ 2 files changed, 19 insertions(+) diff --git a/lib/include/srsran/common/band_helper.h b/lib/include/srsran/common/band_helper.h index a362a6b29..0ffde42c9 100644 --- a/lib/include/srsran/common/band_helper.h +++ b/lib/include/srsran/common/band_helper.h @@ -52,6 +52,13 @@ public: */ uint16_t get_band_from_dl_freq_Hz(double dl_freq_Hz) const; + /** + * @brief Get the lowest band that includes a given Downlink ARFCN + * @param arfcn Given ARFCN + * @return The band number if the ARFCN is bounded in a band, UINT16_MAX otherwise + */ + uint16_t get_band_from_dl_arfcn(uint32_t 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 76e2821e1..5b760a480 100644 --- a/lib/src/common/band_helper.cc +++ b/lib/src/common/band_helper.cc @@ -67,6 +67,18 @@ uint16_t srsran_band_helper::get_band_from_dl_freq_Hz(double freq) const return UINT16_MAX; } +uint16_t srsran_band_helper::get_band_from_dl_arfcn(uint32_t arfcn) const +{ + for (const nr_band& band : nr_band_table_fr1) { + // Check given ARFCN is between the first and last possible ARFCN and matches step + if (arfcn >= band.dl_nref_first and arfcn <= band.dl_nref_last and + (arfcn - band.dl_nref_first) % band.dl_nref_step == 0) { + return band.band; + } + } + 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