add helper to create cexp function for entire subframe

This commit is contained in:
Andre Puschmann 2019-05-08 15:17:04 +02:00
parent 4f42c0796c
commit 4edcedd2b3
2 changed files with 16 additions and 0 deletions

View File

@ -53,4 +53,6 @@ SRSLTE_API void srslte_cexptab_gen_direct(cf_t *x,
float freq,
uint32_t len);
SRSLTE_API void srslte_cexptab_gen_sf(cf_t* x, float freq, uint32_t fft_size);
#endif // SRSLTE_CEXPTAB_H

View File

@ -25,6 +25,7 @@
#include <assert.h>
#include <complex.h>
#include "srslte/phy/common/phy_common.h"
#include "srslte/phy/utils/cexptab.h"
int srslte_cexptab_init(srslte_cexptab_t *h, uint32_t size) {
@ -76,3 +77,16 @@ void srslte_cexptab_gen_direct(cf_t *x, float freq, uint32_t len) {
}
}
void srslte_cexptab_gen_sf(cf_t* x, float freq, uint32_t fft_size)
{
cf_t* ptr = x;
for (uint32_t n = 0; n < 2; n++) {
for (uint32_t i = 0; i < 7; i++) {
uint32_t cplen = SRSLTE_CP_LEN_NORM(i, fft_size);
for (uint32_t t = 0; t < fft_size + cplen; t++) {
ptr[t] = cexpf(I * 2 * M_PI * ((float)t - (float)cplen) * freq / fft_size);
}
ptr += fft_size + cplen;
}
}
}