add CFO correction method with offset

- CFO correction which allows to specify the offset within
  the correction table to allow phase-continuity across
  multi-subframe transmissions (NB-IoT)
This commit is contained in:
Andre Puschmann 2019-05-08 15:15:26 +02:00
parent 7138126896
commit 4f42c0796c
2 changed files with 19 additions and 0 deletions

View File

@ -62,4 +62,7 @@ SRSLTE_API void srslte_cfo_correct(srslte_cfo_t *h,
cf_t *output,
float freq);
SRSLTE_API void
srslte_cfo_correct_offset(srslte_cfo_t* h, const cf_t* input, cf_t* output, float freq, int cexp_offset, int nsamples);
#endif // SRSLTE_CFO_H

View File

@ -101,3 +101,19 @@ void srslte_cfo_correct(srslte_cfo_t *h, const cf_t *input, cf_t *output, float
srslte_vec_apply_cfo(input, freq, output, h->nsamples);
#endif /* SRSLTE_CFO_USE_EXP_TABLE */
}
/* CFO correction which allows to specify the offset within the correction
* table to allow phase-continuity across multi-subframe transmissions (NB-IoT)
* Note that when correction table needs to be regenerated, the regeneration
* takes place for the maximum number of samples
*/
void srslte_cfo_correct_offset(
srslte_cfo_t* h, const cf_t* input, cf_t* output, float freq, int cexp_offset, int nsamples)
{
if (fabs(h->last_freq - freq) > h->tol) {
h->last_freq = freq;
srslte_cexptab_gen(&h->tab, h->cur_cexp, h->last_freq, h->nsamples);
DEBUG("CFO generating new table for frequency %.4fe-6\n", freq * 1e6);
}
srslte_vec_prod_ccc(&h->cur_cexp[cexp_offset], input, output, nsamples);
}