From d9586015f57e3d5988bb89777a903729c1f20b1b Mon Sep 17 00:00:00 2001 From: Xavier Arteaga Date: Fri, 7 May 2021 09:55:40 +0200 Subject: [PATCH] SSB related minor aesthetical corrections --- lib/include/srsran/phy/sync/ssb.h | 9 +-------- lib/src/phy/sync/ssb.c | 12 +++++++----- lib/src/phy/sync/test/ssb_measure_test.c | 6 ++---- 3 files changed, 10 insertions(+), 17 deletions(-) diff --git a/lib/include/srsran/phy/sync/ssb.h b/lib/include/srsran/phy/sync/ssb.h index 31e47a647..66c23f8c5 100644 --- a/lib/include/srsran/phy/sync/ssb.h +++ b/lib/include/srsran/phy/sync/ssb.h @@ -35,7 +35,7 @@ #define SRSRAN_SSB_DEFAULT_BETA 1.0f /** - * @brief Describes SSB object initializatoion arguments + * @brief Describes SSB object initialization arguments */ typedef struct SRSRAN_API { double max_srate_hz; ///< Maximum sampling rate in Hz (common for gNb and UE), set to zero to use default @@ -75,19 +75,12 @@ typedef struct SRSRAN_API { uint32_t cp_sz; ///< Other symbol cyclic prefix size /// Internal Objects - // srsran_pbch_nr_t pbch; ///< PBCH object for encoding/decoding - // srsran_dmrs_pbch_nr_t dmrs; ///< PBCH DMRS object for channel estimation srsran_dft_plan_t ifft; ///< IFFT object for modulating the SSB srsran_dft_plan_t fft; ///< FFT object for demodulate the SSB. /// Frequency/Time domain temporal data cf_t* tmp_freq; cf_t* tmp_time; - - /// Time domain sequences - // cf_t* pss[SRSRAN_NOF_NID_2_NR]; ///< PSS signal for each possible N_id_2 - // cf_t* sss[SRSRAN_NOF_NID_1_NR]; ///< SSS signal for each possible N_id_1 - } srsran_ssb_t; /** diff --git a/lib/src/phy/sync/ssb.c b/lib/src/phy/sync/ssb.c index c1b5da84f..324b6b308 100644 --- a/lib/src/phy/sync/ssb.c +++ b/lib/src/phy/sync/ssb.c @@ -253,7 +253,9 @@ int srsran_ssb_csi_measure(srsran_ssb_t* q, uint32_t N_id, const cf_t* in, srsra return SRSRAN_ERROR; } - cf_t ssb_grid[SRSRAN_SSB_NOF_RE] = {}; + uint32_t N_id_1 = SRSRAN_NID_1_NR(N_id); + uint32_t N_id_2 = SRSRAN_NID_2_NR(N_id); + cf_t ssb_grid[SRSRAN_SSB_NOF_RE] = {}; // Demodulate const cf_t* in_ptr = in; @@ -298,8 +300,8 @@ int srsran_ssb_csi_measure(srsran_ssb_t* q, uint32_t N_id, const cf_t* in, srsra // Extract PSS LSE cf_t pss_lse[SRSRAN_PSS_NR_LEN]; cf_t sss_lse[SRSRAN_SSS_NR_LEN]; - if (srsran_pss_nr_extract_lse(ssb_grid, SRSRAN_NID_2_NR(N_id), pss_lse) < SRSRAN_SUCCESS || - srsran_sss_nr_extract_lse(ssb_grid, SRSRAN_NID_1_NR(N_id), SRSRAN_NID_2_NR(N_id), sss_lse) < SRSRAN_SUCCESS) { + if (srsran_pss_nr_extract_lse(ssb_grid, N_id_2, pss_lse) < SRSRAN_SUCCESS || + srsran_sss_nr_extract_lse(ssb_grid, N_id_1, N_id_2, sss_lse) < SRSRAN_SUCCESS) { ERROR("Error extracting LSE"); return SRSRAN_ERROR; } @@ -317,8 +319,8 @@ int srsran_ssb_csi_measure(srsran_ssb_t* q, uint32_t N_id, const cf_t* in, srsra } // Extract LSE again - if (srsran_pss_nr_extract_lse(ssb_grid, SRSRAN_NID_2_NR(N_id), pss_lse) < SRSRAN_SUCCESS || - srsran_sss_nr_extract_lse(ssb_grid, SRSRAN_NID_1_NR(N_id), SRSRAN_NID_2_NR(N_id), sss_lse) < SRSRAN_SUCCESS) { + if (srsran_pss_nr_extract_lse(ssb_grid, N_id_2, pss_lse) < SRSRAN_SUCCESS || + srsran_sss_nr_extract_lse(ssb_grid, N_id_1, N_id_2, sss_lse) < SRSRAN_SUCCESS) { ERROR("Error extracting LSE"); return SRSRAN_ERROR; } diff --git a/lib/src/phy/sync/test/ssb_measure_test.c b/lib/src/phy/sync/test/ssb_measure_test.c index 1b201a57f..46530d739 100644 --- a/lib/src/phy/sync/test/ssb_measure_test.c +++ b/lib/src/phy/sync/test/ssb_measure_test.c @@ -11,11 +11,11 @@ */ #include "srsran/common/test_common.h" +#include "srsran/phy/channel/ch_awgn.h" #include "srsran/phy/sync/ssb.h" #include "srsran/phy/utils/debug.h" #include "srsran/phy/utils/vector.h" #include -#include #include // NR parameters @@ -103,10 +103,8 @@ static int test_case_1(srsran_ssb_t* ssb) run_channel(); // Measure - srsran_csi_trs_measurements_t meas = {}; - TESTASSERT(srsran_ssb_csi_measure(ssb, pci, buffer, &meas) == SRSRAN_SUCCESS); - gettimeofday(&t[1], NULL); + srsran_csi_trs_measurements_t meas = {}; TESTASSERT(srsran_ssb_csi_measure(ssb, pci, buffer, &meas) == SRSRAN_SUCCESS); gettimeofday(&t[2], NULL); get_time_interval(t);