/* 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);
#include <stdbool.h>
#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
};
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
#endif
#endif
+