Fixed file tests with new fft size

master
ismagom 9 years ago
parent 48076a77fa
commit 7306d88f83

@ -209,6 +209,8 @@ SRSLTE_API bool srslte_symbol_sz_isvalid(uint32_t symbol_sz);
SRSLTE_API int srslte_symbol_sz(uint32_t nof_prb);
SRSLTE_API int srslte_symbol_sz_power2(uint32_t nof_prb);
SRSLTE_API int srslte_nof_prb(uint32_t symbol_sz);
SRSLTE_API int srslte_sampling_freq_hz(uint32_t nof_prb);

@ -60,6 +60,12 @@ typedef struct SRSLTE_API{
cf_t *shift_buffer;
}srslte_ofdm_t;
SRSLTE_API int srslte_ofdm_init_(srslte_ofdm_t *q,
srslte_cp_t cp,
int symbol_sz,
int nof_prb,
srslte_dft_dir_t dir);
SRSLTE_API int srslte_ofdm_rx_init(srslte_ofdm_t *q,
srslte_cp_t cp_type,
uint32_t nof_prb);

@ -36,7 +36,7 @@
#include "srslte/common/sequence.h"
#define USE_REDUCED_SAMPLING_RATES
//#define USE_REDUCED_SAMPLING_RATES
@ -197,6 +197,24 @@ int srslte_sampling_freq_hz(uint32_t nof_prb) {
}
}
int srslte_symbol_sz_power2(uint32_t nof_prb) {
if (nof_prb<=6) {
return 128;
} else if (nof_prb<=15) {
return 256;
} else if (nof_prb<=25) {
return 512;
} else if (nof_prb<=50) {
return 1024;
} else if (nof_prb<=75) {
return 1536;
} else if (nof_prb<=100) {
return 2048;
} else {
return -1;
}
}
int srslte_symbol_sz(uint32_t nof_prb) {
if (nof_prb<=0) {
return SRSLTE_ERROR;
@ -214,23 +232,12 @@ int srslte_symbol_sz(uint32_t nof_prb) {
return 1024;
} else if (nof_prb<=100) {
return 1536;
} else {
return SRSLTE_ERROR;
}
#else
if (nof_prb<=6) {
return 128;
} else if (nof_prb<=15) {
return 256;
} else if (nof_prb<=25) {
return 512;
} else if (nof_prb<=50) {
return 1024;
} else if (nof_prb<=75) {
return 1536;
} else if (nof_prb<=100) {
return 2048;
}
return srslte_symbol_sz_power2(nof_prb);
#endif
return SRSLTE_ERROR;
}
int srslte_nof_prb(uint32_t symbol_sz)

@ -37,13 +37,8 @@
#include "srslte/utils/debug.h"
#include "srslte/utils/vector.h"
int srslte_ofdm_init_(srslte_ofdm_t *q, srslte_cp_t cp, uint32_t nof_prb, srslte_dft_dir_t dir) {
int symbol_sz = srslte_symbol_sz(nof_prb);
int srslte_ofdm_init_(srslte_ofdm_t *q, srslte_cp_t cp, int symbol_sz, int nof_prb, srslte_dft_dir_t dir) {
if (symbol_sz < 0) {
fprintf(stderr, "Error: Invalid nof_prb=%d\n", nof_prb);
return -1;
}
if (srslte_dft_plan_c(&q->fft_plan, symbol_sz, dir)) {
fprintf(stderr, "Error: Creating DFT plan\n");
return -1;
@ -85,7 +80,12 @@ void srslte_ofdm_free_(srslte_ofdm_t *q) {
}
int srslte_ofdm_rx_init(srslte_ofdm_t *q, srslte_cp_t cp, uint32_t nof_prb) {
return srslte_ofdm_init_(q, cp, nof_prb, SRSLTE_DFT_FORWARD);
int symbol_sz = srslte_symbol_sz(nof_prb);
if (symbol_sz < 0) {
fprintf(stderr, "Error: Invalid nof_prb=%d\n", nof_prb);
return -1;
}
return srslte_ofdm_init_(q, cp, symbol_sz, nof_prb, SRSLTE_DFT_FORWARD);
}
void srslte_ofdm_rx_free(srslte_ofdm_t *q) {
@ -96,7 +96,13 @@ int srslte_ofdm_tx_init(srslte_ofdm_t *q, srslte_cp_t cp, uint32_t nof_prb) {
uint32_t i;
int ret;
ret = srslte_ofdm_init_(q, cp, nof_prb, SRSLTE_DFT_BACKWARD);
int symbol_sz = srslte_symbol_sz(nof_prb);
if (symbol_sz < 0) {
fprintf(stderr, "Error: Invalid nof_prb=%d\n", nof_prb);
return -1;
}
ret = srslte_ofdm_init_(q, cp, symbol_sz, nof_prb, SRSLTE_DFT_BACKWARD);
if (ret == SRSLTE_SUCCESS) {
srslte_dft_plan_set_norm(&q->fft_plan, false);

@ -138,7 +138,7 @@ int base_init() {
return -1;
}
if (srslte_ofdm_rx_init(&fft, cell.cp, cell.nof_prb)) {
if (srslte_ofdm_init_(&fft, cell.cp, srslte_symbol_sz_power2(cell.nof_prb), cell.nof_prb, SRSLTE_DFT_FORWARD)) {
fprintf(stderr, "Error initializing FFT\n");
return -1;
}

@ -149,7 +149,7 @@ int base_init() {
return -1;
}
if (srslte_ofdm_rx_init(&fft, cell.cp, cell.nof_prb)) {
if (srslte_ofdm_init_(&fft, cell.cp, srslte_symbol_sz_power2(cell.nof_prb), cell.nof_prb, SRSLTE_DFT_FORWARD)) {
fprintf(stderr, "Error initializing FFT\n");
return -1;
}

@ -157,7 +157,7 @@ int base_init() {
return -1;
}
if (srslte_ofdm_rx_init(&fft, cell.cp, cell.nof_prb)) {
if (srslte_ofdm_init_(&fft, cell.cp, srslte_symbol_sz_power2(cell.nof_prb), cell.nof_prb, SRSLTE_DFT_FORWARD)) {
fprintf(stderr, "Error initializing FFT\n");
return -1;
}

@ -172,7 +172,7 @@ int base_init() {
return -1;
}
if (srslte_ofdm_rx_init(&fft, cell.cp, cell.nof_prb)) {
if (srslte_ofdm_init_(&fft, cell.cp, srslte_symbol_sz_power2(cell.nof_prb), cell.nof_prb, SRSLTE_DFT_FORWARD)) {
fprintf(stderr, "Error initializing FFT\n");
return -1;
}

Loading…
Cancel
Save