change ofdm to compile options
authorokcsampson <okcsampson@01035d8c-6547-0410-b346-abe4f91aad63>
Thu, 8 Jun 2017 16:08:38 +0000 (16:08 +0000)
committerokcsampson <okcsampson@01035d8c-6547-0410-b346-abe4f91aad63>
Thu, 8 Jun 2017 16:08:38 +0000 (16:08 +0000)
git-svn-id: https://svn.code.sf.net/p/freetel/code@3162 01035d8c-6547-0410-b346-abe4f91aad63

codec2-dev/src/codec2_ofdm.h
codec2-dev/src/ofdm_internal.h

index 8d3eb4866f2b52dda9349b8519f8713af0415a06..81fda55cd0adf5a88615e3288a69fb02644dce76 100644 (file)
@@ -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);
index ac48989a214f0e7bf4f61606c283cc5c90391e2b..17ee0ca22556acb075ac243342eb2119b01bcba1 100644 (file)
@@ -18,10 +18,37 @@ extern "C" {
 #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
@@ -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
+