root/experimental/components/Demodulator/src/DemodulatorDSP.h @ 3998

Revision 3998, 3.1 KB (checked in by jgaeddert, 6 years ago)

Adding more demod functions, writing test scripts

  • Property svn:eol-style set to native
Line 
1/****************************************************************************
2
3Copyright 2007 Virginia Polytechnic Institute and State University
4
5This file is part of the OSSIE Demodulator.
6
7OSSIE Demodulator is free software; you can redistribute it and/or modify
8it under the terms of the GNU General Public License as published by
9the Free Software Foundation; either version 2 of the License, or
10(at your option) any later version.
11
12OSSIE Demodulator is distributed in the hope that it will be useful,
13but WITHOUT ANY WARRANTY; without even the implied warranty of
14MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
15GNU General Public License for more details.
16
17You should have received a copy of the GNU General Public License
18along with OSSIE Demodulator; if not, write to the Free Software
19Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
20
21****************************************************************************/
22
23
24#ifndef __DEMODULATORDSP_IMPL_H__
25#define __DEMODULATORDSP_IMPL_H__
26
27#include <stdlib.h>
28#include "sigproc/SigProc.h"
29
30#define BIT0 0
31#define BIT1 1
32
33#define TARGET_SIGNAL_ENERGY 10000
34
35#define DEMOD_COS_22_5 0.923879532511287
36#define DEMOD_SIN_22_5 0.382683432365090
37
38#define QAM16_THRESHOLD 6324    ///< 16-QAM threshold for RMS=10000 signal
39#define PAM4_THRESHOLD 8944     ///< 4-PAM threshold for RMS=10000 signal
40
41/// Modulation scheme
42enum ModulationScheme {
43    MOD_BPSK,
44    MOD_QPSK,
45    MOD_8PSK,
46    MOD_16QAM,
47    MOD_4PAM,
48    MOD_DBPSK,
49    MOD_DQPSK,
50    MOD_D8PSK
51};
52
53/** \brief
54 *
55 *
56 */
57class DemodulatorDSP
58{
59  public:
60    /// Initializing constructor
61    DemodulatorDSP();
62
63    /// Destructor
64    ~DemodulatorDSP();
65
66    /// Set modulation scheme
67    void SetModulationScheme(ModulationScheme _ms);
68
69    /// Demodulates sequence of symbols
70    void DemodulateSequence(
71        short * I_in,
72        short * Q_in,
73        unsigned int N_in,
74        char * bits_out);
75
76  protected:
77    /// Demodulation function pointer
78    void (*Demodulate) (
79        short & I_in,
80        short & Q_in,
81        char * bits_out);
82
83    ///
84    ///\todo check amplitude correction method
85    void ScaleSignalAmplitude(
86        short * I_in,
87        short * Q_in,
88        unsigned int N_in,
89        unsigned int targetEnergy);
90
91    unsigned int bitsPerSymbol;     ///< Number of bits represented by each symbol
92    short state_i;                  ///< In-phase state for differential mode
93    short state_q;                  ///< Quadrature state for differential mode
94    ModulationScheme mod_scheme;    ///< Current (de)modulation scheme
95    bool differentialMode;          ///< Differential PSK mode flag
96
97  private:
98    /// Disallow copy constructor
99    DemodulatorDSP(DemodulatorDSP&);
100
101};
102
103#endif
104
105///
106void DemodulateBPSK(
107    short & I_in,
108    short & Q_in,
109    char * bits_out);
110
111///
112void DemodulateQPSK(
113    short & I_in,
114    short & Q_in,
115    char * bits_out);
116
117///
118void Demodulate8PSK(
119    short & I_in,
120    short & Q_in,
121    char * bits_out);
122
123///
124void Demodulate16QAM(
125    short & I_in,
126    short & Q_in,
127    char * bits_out);
128
129///
130void Demodulate4PAM(
131    short & I_in,
132    short & Q_in,
133    char * bits_out);
134
Note: See TracBrowser for help on using the browser.