| 1 | /**************************************************************************** |
|---|
| 2 | |
|---|
| 3 | Copyright 2007 Virginia Polytechnic Institute and State University |
|---|
| 4 | |
|---|
| 5 | This file is part of the OSSIE FrameAssembler. |
|---|
| 6 | |
|---|
| 7 | OSSIE FrameAssembler is free software; you can redistribute it and/or modify |
|---|
| 8 | it under the terms of the GNU General Public License as published by |
|---|
| 9 | the Free Software Foundation; either version 2 of the License, or |
|---|
| 10 | (at your option) any later version. |
|---|
| 11 | |
|---|
| 12 | OSSIE FrameAssembler is distributed in the hope that it will be useful, |
|---|
| 13 | but WITHOUT ANY WARRANTY; without even the implied warranty of |
|---|
| 14 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|---|
| 15 | GNU General Public License for more details. |
|---|
| 16 | |
|---|
| 17 | You should have received a copy of the GNU General Public License |
|---|
| 18 | along with OSSIE FrameAssembler; if not, write to the Free Software |
|---|
| 19 | Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
|---|
| 20 | |
|---|
| 21 | ****************************************************************************/ |
|---|
| 22 | |
|---|
| 23 | |
|---|
| 24 | #ifndef FRAMEASSEMBLERDSP_IMPL_H |
|---|
| 25 | #define FRAMEASSEMBLERDSP_IMPL_H |
|---|
| 26 | |
|---|
| 27 | #include <stdlib.h> |
|---|
| 28 | #include "sigproc/SigProc.h" |
|---|
| 29 | #include "PNCodes.h" |
|---|
| 30 | |
|---|
| 31 | #define FRAME_SIZE_1 2048 ///< Frame size option 1 |
|---|
| 32 | #define FRAME_SIZE_2 4096 ///< Frame size option 2 |
|---|
| 33 | #define FRAME_SIZE_3 8192 ///< Frame size option 3 |
|---|
| 34 | #define FRAME_SIZE_4 512 ///< Frame size option 4 |
|---|
| 35 | |
|---|
| 36 | |
|---|
| 37 | |
|---|
| 38 | /** \brief |
|---|
| 39 | * |
|---|
| 40 | * |
|---|
| 41 | */ |
|---|
| 42 | class FrameAssemblerDSP |
|---|
| 43 | { |
|---|
| 44 | public: |
|---|
| 45 | /// Initializing constructor |
|---|
| 46 | FrameAssemblerDSP(); |
|---|
| 47 | |
|---|
| 48 | /// Destructor |
|---|
| 49 | ~FrameAssemblerDSP(); |
|---|
| 50 | |
|---|
| 51 | protected: |
|---|
| 52 | /// Configure frame for particular modulation scheme |
|---|
| 53 | void ConfigureModulationScheme(SigProc::ModulationScheme _ms); |
|---|
| 54 | |
|---|
| 55 | /// Configure frame for a certain number of output symbols |
|---|
| 56 | void ConfigureFrameType(unsigned int _ft); |
|---|
| 57 | |
|---|
| 58 | /// Configure frame for a certain number of output symbols |
|---|
| 59 | void ConfigureFrameSize(unsigned int _fs); |
|---|
| 60 | |
|---|
| 61 | /// |
|---|
| 62 | unsigned int frameSize; |
|---|
| 63 | |
|---|
| 64 | /// |
|---|
| 65 | unsigned int numFrameSymbolsAssembled; |
|---|
| 66 | |
|---|
| 67 | /// |
|---|
| 68 | char ** controlBlock; |
|---|
| 69 | |
|---|
| 70 | /// Generates 512-bit \c 10101010 phasing pattern |
|---|
| 71 | void AssemblePhasingPattern(short * I_out, short * Q_out); |
|---|
| 72 | |
|---|
| 73 | /// Generates 512-bit header |
|---|
| 74 | void AssembleHeader(short * I_out, short * Q_out); |
|---|
| 75 | |
|---|
| 76 | /// Modulates input bits |
|---|
| 77 | void AssembleFrame(char * bits_in, short * I_out, short * Q_out); |
|---|
| 78 | |
|---|
| 79 | /// Generates postamble... |
|---|
| 80 | /// \todo determine what information should be included here |
|---|
| 81 | void AssemblePostamble(); |
|---|
| 82 | |
|---|
| 83 | /// Operational mode |
|---|
| 84 | enum { |
|---|
| 85 | ASSEMBLE_PREAMBLE, |
|---|
| 86 | ASSEMBLE_HEADER, |
|---|
| 87 | ASSEMBLE_FRAME, |
|---|
| 88 | ASSEMBLE_EOM_CODE |
|---|
| 89 | } operationalMode; |
|---|
| 90 | |
|---|
| 91 | /// Type of frame to configure |
|---|
| 92 | enum { |
|---|
| 93 | FRAME_TYPE_DATA=0, |
|---|
| 94 | FRAME_TYPE_CONTROL=1, |
|---|
| 95 | FRAME_TYPE_X, |
|---|
| 96 | FRAME_TYPE_Y |
|---|
| 97 | } frameType; |
|---|
| 98 | |
|---|
| 99 | private: |
|---|
| 100 | /// Disallow copy constructor |
|---|
| 101 | FrameAssemblerDSP(FrameAssemblerDSP&); |
|---|
| 102 | |
|---|
| 103 | /// |
|---|
| 104 | void WriteSequence(char * bits_in, unsigned int N_in, short * I_out, short * Q_out); |
|---|
| 105 | |
|---|
| 106 | }; |
|---|
| 107 | |
|---|
| 108 | #endif |
|---|
| 109 | |
|---|