From 11d925c0b27001ded5c11dcc15a4bd41d59a8597 Mon Sep 17 00:00:00 2001 From: Xavier Arteaga Date: Thu, 13 May 2021 17:32:24 +0200 Subject: [PATCH] Minor SSB fix and changes --- lib/include/srsran/phy/sync/ssb.h | 12 ++++++------ lib/src/phy/sync/ssb.c | 12 ++++++------ lib/src/phy/sync/test/ssb_measure_test.c | 2 +- 3 files changed, 13 insertions(+), 13 deletions(-) diff --git a/lib/include/srsran/phy/sync/ssb.h b/lib/include/srsran/phy/sync/ssb.h index 0f6d3ae93..ed4221236 100644 --- a/lib/include/srsran/phy/sync/ssb.h +++ b/lib/include/srsran/phy/sync/ssb.h @@ -43,12 +43,12 @@ * @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 - srsran_subcarrier_spacing_t min_scs; ///< Minimum subcarrier spacing - bool enable_correlate; ///< Enables PSS/SSS correlation and peak search (UE cell search) - bool enable_encode; ///< Enables PBCH Encoder (intended for gNb) - bool enable_decode; ///< Enables PBCH Decoder (intented for UE) - bool enable_measure; ///< Enables PSS/SSS CSI measurements and frequency domain search + double max_srate_hz; ///< Maximum sampling rate in Hz, set to zero to use default + srsran_subcarrier_spacing_t min_scs; ///< Minimum subcarrier spacing + bool enable_search; ///< Enables PSS/SSS blind search + bool enable_measure; ///< Enables PSS/SSS CSI measurements and frequency domain search + bool enable_encode; ///< Enables PBCH Encoder + bool enable_decode; ///< Enables PBCH Decoder } srsran_ssb_args_t; /** diff --git a/lib/src/phy/sync/ssb.c b/lib/src/phy/sync/ssb.c index 67dd41950..29dc18bf8 100644 --- a/lib/src/phy/sync/ssb.c +++ b/lib/src/phy/sync/ssb.c @@ -35,14 +35,14 @@ static int ssb_init_corr(srsran_ssb_t* q) { // Initialise correlation only if it is enabled - if (!q->args.enable_correlate) { + if (!q->args.enable_search) { return SRSRAN_SUCCESS; } // For each PSS sequence allocate for (uint32_t N_id_2 = 0; N_id_2 < SRSRAN_NOF_NID_2_NR; N_id_2++) { // Allocate sequences - q->pss_seq[N_id_2] = srsran_vec_cf_malloc(2 * q->max_symbol_sz); + q->pss_seq[N_id_2] = srsran_vec_cf_malloc(SSB_CORR_SZ * q->max_symbol_sz); if (q->pss_seq[N_id_2] == NULL) { ERROR("Malloc"); return SRSRAN_ERROR; @@ -301,7 +301,7 @@ static void ssb_modulate_symbol(srsran_ssb_t* q, cf_t ssb_grid[SRSRAN_SSB_NOF_RE static int ssb_setup_corr(srsran_ssb_t* q) { // Skip if disabled - if (!q->args.enable_correlate) { + if (!q->args.enable_search) { return SRSRAN_SUCCESS; } @@ -417,7 +417,7 @@ int srsran_ssb_set_cfg(srsran_ssb_t* q, const srsran_ssb_cfg_t* cfg) } // Replan iFFT - if ((q->args.enable_encode || q->args.enable_correlate) && q->symbol_sz != symbol_sz) { + if ((q->args.enable_encode || q->args.enable_search) && q->symbol_sz != symbol_sz) { // free the current IFFT, it internally checks if the plan was created srsran_dft_plan_free(&q->ifft); @@ -430,7 +430,7 @@ int srsran_ssb_set_cfg(srsran_ssb_t* q, const srsran_ssb_cfg_t* cfg) } // Replan FFT - if ((q->args.enable_measure || q->args.enable_decode) && q->symbol_sz != symbol_sz) { + if ((q->args.enable_measure || q->args.enable_decode || q->args.enable_search) && q->symbol_sz != symbol_sz) { // free the current FFT, it internally checks if the plan was created srsran_dft_plan_free(&q->fft); @@ -740,7 +740,7 @@ int srsran_ssb_csi_search(srsran_ssb_t* q, return SRSRAN_ERROR_INVALID_INPUTS; } - if (!q->args.enable_correlate) { + if (!q->args.enable_search) { ERROR("SSB is not configured for search"); 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 58257af10..a1dfe34b7 100644 --- a/lib/src/phy/sync/test/ssb_measure_test.c +++ b/lib/src/phy/sync/test/ssb_measure_test.c @@ -174,7 +174,7 @@ int main(int argc, char** argv) srsran_ssb_args_t ssb_args = {}; ssb_args.enable_encode = true; ssb_args.enable_measure = true; - ssb_args.enable_correlate = true; + ssb_args.enable_search = true; if (buffer == NULL) { ERROR("Malloc");