From 72aa5aa45e52b29ee96ff596cc533f65a70040c5 Mon Sep 17 00:00:00 2001 From: okcsampson Date: Thu, 8 Jun 2017 16:08:38 +0000 Subject: [PATCH] change ofdm to compile options git-svn-id: https://svn.code.sf.net/p/freetel/code@3162 01035d8c-6547-0410-b346-abe4f91aad63 --- codec2-dev/src/codec2_ofdm.h | 8 ++--- codec2-dev/src/ofdm_internal.h | 59 ++++++++++++++++++++-------------- 2 files changed, 38 insertions(+), 29 deletions(-) diff --git a/codec2-dev/src/codec2_ofdm.h b/codec2-dev/src/codec2_ofdm.h index 8d3eb486..81fda55c 100644 --- a/codec2-dev/src/codec2_ofdm.h +++ b/codec2-dev/src/codec2_ofdm.h @@ -27,16 +27,14 @@ struct OFDM; /* Prototypes */ -struct OFDM *ofdm_create(float, float, int, float, float, int, int); +struct OFDM *ofdm_create(void); void ofdm_destroy(struct OFDM *); -int ofdm_errno(void); -COMP *ofdm_mod(struct OFDM *ofdm, int *); +void ofdm_mod(struct OFDM *ofdm, COMP [OFDM_ROWSPERFRAME][OFDM_M + OFDM_NCP], int *); int *ofdm_demod(struct OFDM *ofdm, COMP *); -/* getters and setters */ +/* option setters */ void set_verbose(struct OFDM *, int); -int get_verbose(struct OFDM *); void set_timing_enable(struct OFDM *, bool); void set_foff_est_enable(struct OFDM *, bool); void set_phase_est_enable(struct OFDM *, bool); diff --git a/codec2-dev/src/ofdm_internal.h b/codec2-dev/src/ofdm_internal.h index ac48989a..17ee0ca2 100644 --- a/codec2-dev/src/ofdm_internal.h +++ b/codec2-dev/src/ofdm_internal.h @@ -18,10 +18,37 @@ extern "C" { #include #ifndef M_PI -#define M_PI 3.14159265358979323846f /* math constant */ +#define M_PI 3.14159265358979323846f /* math constant */ #endif -#define TAU (2.0f * M_PI) /* mathematical constant */ +#define TAU (2.0f * M_PI) /* mathematical constant */ + +#define OFDM_NC 16 +#define OFDM_TS 0.018f +#define OFDM_RS (1.0f / OFDM_TS) +#define OFDM_FS 8000.0f +#define OFDM_BPS 2 +#define OFDM_TCP 0.002f +#define OFDM_NS 8 +#define OFDM_CENTRE 1500.0f + +/* To prevent C99 warning */ + +#define OFDM_M 144 +#define OFDM_NCP 16 + +#ifdef OLD_STYLE +/* This will produce a warning in C99 as (int) makes these variable */ + +#define OFDM_M ((int)(OFDM_FS / OFDM_RS)) +#define OFDM_NCP ((int)(OFDM_TCP * OFDM_FS)) +#endif + +#define OFDM_FTWINDOWWIDTH 11 +#define OFDM_BITSPERFRAME (OFDM_NS * OFDM_NC * OFDM_BPS) +#define OFDM_ROWSPERFRAME (OFDM_BITSPERFRAME / (OFDM_NC * OFDM_BPS)) +#define OFDM_SAMPLESPERFRAME (OFDM_ROWSPERFRAME * (OFDM_M + OFDM_NCP)) +#define OFDM_RXBUF (3 * OFDM_SAMPLESPERFRAME + 3 * (OFDM_M + OFDM_NCP)) /* * QPSK Quadrant bit-pair values - Gray Coded @@ -39,40 +66,23 @@ const complex float constellation[] = { }; struct OFDM { - float Fs; - float Ts; - float Rs; - float Tcp; - float Fcentre; float foff_est_gain; float foff_est_hz; - int Nbitsperframe; - int Nrowsperframe; - int Nsamperframe; - int Ns; - int Nc; - int M; - int bps; - int ftwindow_width; int verbose; int sample_point; int timing_est; int nin; - int Nrxbuf; - int Ncp; bool timing_en; bool foff_est_en; bool phase_est_en; - /* dynamic heap memory allocation */ - - complex float *rate_fs_pilot_samples; - complex float **W; - complex float *rxbuf; - complex float *pilots; - float *w; + complex float rate_fs_pilot_samples[OFDM_M + OFDM_NC]; + complex float W[OFDM_NC + 2][OFDM_M]; + complex float rxbuf[OFDM_RXBUF]; + complex float pilots[OFDM_NC + 2]; + float w[OFDM_NC + 2]; }; #ifdef __cplusplus @@ -80,3 +90,4 @@ struct OFDM { #endif #endif + -- 2.25.1