Initial NR OFDM symbol size compatibility

master
Xavier Arteaga 4 years ago committed by Xavier Arteaga
parent 10a7b63c6a
commit 83a5ce96ed

@ -311,6 +311,14 @@ SRSLTE_API const char* srslte_mcs_table_to_str(srslte_mcs_table_t mcs_table);
*/ */
SRSLTE_API srslte_mcs_table_t srslte_mcs_table_from_str(const char* str); SRSLTE_API srslte_mcs_table_t srslte_mcs_table_from_str(const char* str);
/**
* @brief Computes the minimum valid symbol size for a given amount of PRB
* @attention The valid FFT sizes are radix 2 and radix 3 between 128 to 4096 points.
* @param nof_prb Number of PRB
* @return The minimum valid FFT size if the number of PRB is in range, 0 otherwise
*/
SRSLTE_API uint32_t srslte_min_symbol_sz_rb(uint32_t nof_prb);
#ifdef __cplusplus #ifdef __cplusplus
} }
#endif #endif

@ -76,8 +76,28 @@ typedef struct SRSLTE_API {
cf_t* window_offset_buffer; cf_t* window_offset_buffer;
} srslte_ofdm_t; } srslte_ofdm_t;
/**
* @brief Initialises or reconfigures OFDM receiver
*
* @note The reconfiguration of the OFDM object considers only CP, number of PRB and optionally the FFT size
* @attention The OFDM object must be zeroed externally prior calling the initialization for first time
*
* @param q OFDM object
* @param cfg OFDM configuration
* @return SRSLTE_SUCCESS if the initialization/reconfiguration is successful, SRSLTE_ERROR code otherwise
*/
SRSLTE_API int srslte_ofdm_rx_init_cfg(srslte_ofdm_t* q, srslte_ofdm_cfg_t* cfg); SRSLTE_API int srslte_ofdm_rx_init_cfg(srslte_ofdm_t* q, srslte_ofdm_cfg_t* cfg);
/**
* @brief Initialises or reconfigures OFDM transmitter
*
* @note The reconfiguration of the OFDM object considers only CP, number of PRB and optionally the FFT size
* @attention The OFDM object must be zeroed externally prior calling the initialization for first time
*
* @param q OFDM object
* @param cfg OFDM configuration
* @return SRSLTE_SUCCESS if the initialization/reconfiguration is successful, SRSLTE_ERROR code otherwise
*/
SRSLTE_API int srslte_ofdm_tx_init_cfg(srslte_ofdm_t* q, srslte_ofdm_cfg_t* cfg); SRSLTE_API int srslte_ofdm_tx_init_cfg(srslte_ofdm_t* q, srslte_ofdm_cfg_t* cfg);
SRSLTE_API int SRSLTE_API int

@ -74,3 +74,25 @@ srslte_mcs_table_t srslte_mcs_table_from_str(const char* str)
} }
return srslte_mcs_table_N; return srslte_mcs_table_N;
} }
#define PHY_COMMON_NR_NOF_VALID_SYMB_SZ 10U
static const uint32_t phy_common_nr_valid_symbol_sz[PHY_COMMON_NR_NOF_VALID_SYMB_SZ] =
{128, 256, 384, 512, 768, 1024, 1536, 2048, 3072, 4096};
uint32_t srslte_min_symbol_sz_rb(uint32_t nof_prb)
{
uint32_t nof_re = nof_prb * SRSLTE_NRE;
if (nof_re == 0) {
return 0;
}
for (uint32_t i = 0; i < PHY_COMMON_NR_NOF_VALID_SYMB_SZ; i++) {
if (phy_common_nr_valid_symbol_sz[i] > nof_re) {
return phy_common_nr_valid_symbol_sz[i];
}
}
return 0;
}

@ -276,15 +276,11 @@ int srslte_ofdm_tx_init(srslte_ofdm_t* q, srslte_cp_t cp, cf_t* in_buffer, cf_t*
int srslte_ofdm_tx_init_cfg(srslte_ofdm_t* q, srslte_ofdm_cfg_t* cfg) int srslte_ofdm_tx_init_cfg(srslte_ofdm_t* q, srslte_ofdm_cfg_t* cfg)
{ {
bzero(q, sizeof(srslte_ofdm_t));
return ofdm_init_mbsfn_(q, cfg, SRSLTE_DFT_BACKWARD); return ofdm_init_mbsfn_(q, cfg, SRSLTE_DFT_BACKWARD);
} }
int srslte_ofdm_rx_init_cfg(srslte_ofdm_t* q, srslte_ofdm_cfg_t* cfg) int srslte_ofdm_rx_init_cfg(srslte_ofdm_t* q, srslte_ofdm_cfg_t* cfg)
{ {
bzero(q, sizeof(srslte_ofdm_t));
return ofdm_init_mbsfn_(q, cfg, SRSLTE_DFT_FORWARD); return ofdm_init_mbsfn_(q, cfg, SRSLTE_DFT_FORWARD);
} }

@ -138,7 +138,11 @@ int srslte_ue_dl_nr_set_carrier(srslte_ue_dl_nr_t* q, const srslte_carrier_nr_t*
if (carrier->nof_prb != q->carrier.nof_prb) { if (carrier->nof_prb != q->carrier.nof_prb) {
for (uint32_t i = 0; i < q->nof_rx_antennas; i++) { for (uint32_t i = 0; i < q->nof_rx_antennas; i++) {
srslte_ofdm_rx_set_prb(&q->fft[i], SRSLTE_CP_NORM, carrier->nof_prb); srslte_ofdm_cfg_t cfg = {};
cfg.nof_prb = carrier->nof_prb;
cfg.symbol_sz = srslte_min_symbol_sz_rb(carrier->nof_prb);
cfg.cp = SRSLTE_CP_NORM;
srslte_ofdm_rx_init_cfg(&q->fft[i], &cfg);
} }
} }

Loading…
Cancel
Save