From a82b2da2dd19888ab0b3bc8534ff26b579f02b84 Mon Sep 17 00:00:00 2001 From: Andre Puschmann Date: Thu, 23 Apr 2020 10:19:53 +0200 Subject: [PATCH] dft_precoding: add helper to get largest valid PRB --- lib/include/srslte/phy/dft/dft_precoding.h | 2 ++ lib/src/phy/dft/dft_precoding.c | 9 +++++++++ 2 files changed, 11 insertions(+) diff --git a/lib/include/srslte/phy/dft/dft_precoding.h b/lib/include/srslte/phy/dft/dft_precoding.h index e87189e3f..2cbee27c8 100644 --- a/lib/include/srslte/phy/dft/dft_precoding.h +++ b/lib/include/srslte/phy/dft/dft_precoding.h @@ -53,6 +53,8 @@ SRSLTE_API void srslte_dft_precoding_free(srslte_dft_precoding_t* q); SRSLTE_API bool srslte_dft_precoding_valid_prb(uint32_t nof_prb); +SRSLTE_API uint32_t srslte_dft_precoding_get_valid_prb(uint32_t nof_prb); + SRSLTE_API int srslte_dft_precoding(srslte_dft_precoding_t* q, cf_t* input, cf_t* output, uint32_t nof_prb, uint32_t nof_symbols); diff --git a/lib/src/phy/dft/dft_precoding.c b/lib/src/phy/dft/dft_precoding.c index 3fdde3a7a..a68a4565f 100644 --- a/lib/src/phy/dft/dft_precoding.c +++ b/lib/src/phy/dft/dft_precoding.c @@ -102,6 +102,15 @@ bool srslte_dft_precoding_valid_prb(uint32_t nof_prb) return false; } +/* Return largest integer that fulfills the DFT precoding PRB criterion (TS 36.213 Section 14.1.1.4C) */ +uint32_t srslte_dft_precoding_get_valid_prb(uint32_t nof_prb) +{ + while (srslte_dft_precoding_valid_prb(nof_prb) == false) { + nof_prb--; + } + return nof_prb; +} + int srslte_dft_precoding(srslte_dft_precoding_t* q, cf_t* input, cf_t* output, uint32_t nof_prb, uint32_t nof_symbols) {