FreeCalypso > hg > ffs-editor
comparison src/cs/layer1/gtt_include/ctm/init_interleaver.h @ 0:92470e5d0b9e
src: partial import from FC Selenite
| author | Mychaela Falconia <falcon@freecalypso.org> |
|---|---|
| date | Fri, 15 May 2020 01:28:16 +0000 |
| parents | |
| children |
comparison
equal
deleted
inserted
replaced
| -1:000000000000 | 0:92470e5d0b9e |
|---|---|
| 1 /* | |
| 2 ******************************************************************************* | |
| 3 * | |
| 4 * COPYRIGHT (C) 2000 BY ERICSSON EUROLAB DEUTSCHLAND GmbH | |
| 5 * 90411 NUERNBERG, GERMANY, Tel Int + 49 911 5217 100 | |
| 6 * | |
| 7 * The program(s) may be used and/or copied only with the | |
| 8 * written permission from Ericsson or in accordance | |
| 9 * with the terms and conditions stipulated in the agreement or | |
| 10 * contract under which the program(s) have been supplied. | |
| 11 * | |
| 12 ******************************************************************************* | |
| 13 * | |
| 14 * File : init_interleaver.h | |
| 15 * Purpose : initialization of the diagonal (chain) interleaver; | |
| 16 * definition of the type interleaver_state_t | |
| 17 * | |
| 18 ******************************************************************************* | |
| 19 */ | |
| 20 #ifndef init_interleaver_h | |
| 21 #define init_interleaver_h "$Id: $" | |
| 22 | |
| 23 /* | |
| 24 ******************************************************************************* | |
| 25 * INCLUDE FILES | |
| 26 ******************************************************************************* | |
| 27 */ | |
| 28 | |
| 29 #include "ctm_typedefs.h" | |
| 30 | |
| 31 /* | |
| 32 ******************************************************************************* | |
| 33 * DECLARATION OF PROTOTYPES | |
| 34 ******************************************************************************* | |
| 35 */ | |
| 36 #if (TTY_SYNC_MCU == 1) | |
| 37 #define RESYNC_OFFSET 384 | |
| 38 #endif | |
| 39 | |
| 40 /* --------------------------------------------------------------------- */ | |
| 41 /* interleaver_state_t: */ | |
| 42 /* type definition for storing the states of the diag_interleaver and */ | |
| 43 /* diag_deinterleaver, respectively (each instance of */ | |
| 44 /* interleavers/deinterleavers must have its own variable of this type */ | |
| 45 /* --------------------------------------------------------------------- */ | |
| 46 | |
| 47 typedef struct { | |
| 48 WORD16 B, D; /* dimensions of the (de)interleaver */ | |
| 49 WORD16 rows; /* Number of rows in buffer */ | |
| 50 WORD16 clmn; /* actual index within the (de)interleaver matrix */ | |
| 51 WORD16 ready; /* Number of ready rows in (de)interleaver */ | |
| 52 WORD16 *vector; /* memory of the (de)interleaver */ | |
| 53 WORD16 num_sync_lines1;/* number of preceding lines in the interl. matrix*/ | |
| 54 WORD16 num_sync_lines2;/* number of preceding lines in the interl. matrix*/ | |
| 55 WORD16 num_sync_bits; /* number of sync bits (demodulator sync) */ | |
| 56 WORD16 *sync_index_vec;/* indices of the bits for deintl. synchronization*/ | |
| 57 WORD16 *scramble_vec; /* sequence for scrambling */ | |
| 58 WORD16 *sequence; /* m-sequence for synchronisation */ | |
| 59 | |
| 60 } interleaver_state_t; | |
| 61 | |
| 62 | |
| 63 /* --------------------------------------------------------------------- */ | |
| 64 /* init_interleaver: */ | |
| 65 /* function for initialization of diag_interleaver and */ | |
| 66 /* diag_deinterleaver, respectively. The dimensions of the interleaver */ | |
| 67 /* must be specified: */ | |
| 68 /* B = (horizontal) blocklength, D = (vertical distance) */ | |
| 69 /* According to this specifications, this function initializes a */ | |
| 70 /* variable of type interleaver_state_t. */ | |
| 71 /* */ | |
| 72 /* Additionally, this function adds two types of sync information to the */ | |
| 73 /* bitstream. The first sync info is for the demodulator and consists */ | |
| 74 /* of a sequence of alternating bits so that the tones produced by the */ | |
| 75 /* modulator are not the same all the time. This is essential for the */ | |
| 76 /* demodulator to find the transitions between adjacent bits. The bits */ | |
| 77 /* for this demodulator synchronization simply precede the bitstream. */ | |
| 78 /* A good choice for this is e.g. num_sync_lines1=2, which results in */ | |
| 79 /* 14 additional bits in case of the (B=7, D=2) interleaver. */ | |
| 80 /* */ | |
| 81 /* The second sync info is for synchronizing the deinterleaver and */ | |
| 82 /* of a m-sequence with excellent autocorrelation properties. These bits */ | |
| 83 /* are positioned at the locations of the dummy bits, which are not used */ | |
| 84 /* by the interleaver. In addition, even more bits for this */ | |
| 85 /* can be spent by inserting additional sync bits, which precede the */ | |
| 86 /* interleaver's bitstream. This is indicated by chosing */ | |
| 87 /* num_sync_lines2>0. */ | |
| 88 /* */ | |
| 89 /* Example: (B=7, D=2)-interleaver, */ | |
| 90 /* num_sync_lines1=2 (demodulator sync bits are marked by 'd') */ | |
| 91 /* num_sync_lines2=1 (deinterleaver sync bits are marked by 'x')*/ | |
| 92 /* */ | |
| 93 /* d d d d d d d */ | |
| 94 /* d d d d d d d */ | |
| 95 /* x x x x x x x */ | |
| 96 /* 1 x x x x x x */ | |
| 97 /* 8 x x x x x x */ | |
| 98 /* 15 2 x x x x x */ | |
| 99 /* 22 9 x x x x x */ | |
| 100 /* 29 16 3 x x x x */ | |
| 101 /* 36 23 10 x x x x */ | |
| 102 /* 43 30 17 4 x x x */ | |
| 103 /* 50 37 24 11 x x x */ | |
| 104 /* 57 44 31 18 5 x x */ | |
| 105 /* 64 51 38 25 12 x x */ | |
| 106 /* 71 58 45 32 19 6 x */ | |
| 107 /* 78 65 52 39 26 13 x */ | |
| 108 /* 85 72 59 46 33 20 7 */ | |
| 109 /* 92 79 66 53 40 27 14 */ | |
| 110 /* 99 86 73 60 47 34 21 */ | |
| 111 /* --------------------------------------------------------------------- */ | |
| 112 | |
| 113 void init_interleaver(interleaver_state_t *intl_state, | |
| 114 WORD16 B, WORD16 D, | |
| 115 WORD16 num_sync_lines1, WORD16 num_sync_lines2); | |
| 116 /* | |
| 117 *********************************************************************** | |
| 118 * Shutdown_interleaver() * | |
| 119 * ********************* * | |
| 120 * Deallocate dyamically created buffers. * | |
| 121 * * | |
| 122 * Input variables: * | |
| 123 * intl_state : pointer to a variable of interleaver_state_t * | |
| 124 * containing the interleaver state machine. * | |
| 125 *********************************************************************** | |
| 126 */ | |
| 127 void Shutdown_interleaver(interleaver_state_t *intl_state); | |
| 128 | |
| 129 /* --------------------------------------------------------------------- */ | |
| 130 /* reinit_interleaver: */ | |
| 131 /* Same as init_interleaver() but without new allocation of buffers. */ | |
| 132 /* This function shall be used for initiation each new burst. */ | |
| 133 /* --------------------------------------------------------------------- */ | |
| 134 | |
| 135 void reinit_interleaver(interleaver_state_t *intl_state); | |
| 136 | |
| 137 | |
| 138 void init_deinterleaver(interleaver_state_t *intl_state, | |
| 139 WORD16 B, WORD16 D); | |
| 140 | |
| 141 /* | |
| 142 *********************************************************************** | |
| 143 * Shutdown_deinterleaver() * | |
| 144 * ************************ * | |
| 145 * Deallocate dyamically created buffers. * | |
| 146 * * | |
| 147 * Input variables: * | |
| 148 * intl_state : pointer to a variable of interleaver_state_t * | |
| 149 * containing the deinterleaver state machine. * | |
| 150 *********************************************************************** | |
| 151 */ | |
| 152 void Shutdown_deinterleaver(interleaver_state_t *intl_state); | |
| 153 | |
| 154 void reinit_deinterleaver(interleaver_state_t *intl_state); | |
| 155 | |
| 156 /* --------------------------------------------------------------------- */ | |
| 157 /* calc_mute_positions: */ | |
| 158 /* Calculation of the indices of the bits that have to be muted within */ | |
| 159 /* one burst. The indices are returned in the vector mute_positions. */ | |
| 160 /* --------------------------------------------------------------------- */ | |
| 161 | |
| 162 void calc_mute_positions(WORD16 *mute_positions, | |
| 163 WORD16 num_rows_to_mute, | |
| 164 WORD16 start_position, | |
| 165 WORD16 B, | |
| 166 WORD16 D); | |
| 167 | |
| 168 BOOL mutingRequired(WORD16 actualIndex, | |
| 169 WORD16 *mute_positions, | |
| 170 WORD16 length_mute_positions); | |
| 171 | |
| 172 /* --------------------------------------------------------------------- */ | |
| 173 /* generate_scrambling_sequence: */ | |
| 174 /* Generation of the sequence used for scrambling. The sequence consists */ | |
| 175 /* of 0 and 1 elements. The sequence is stored into the vector *sequence */ | |
| 176 /* and the length of the sequence is specified by the variable length. */ | |
| 177 /* --------------------------------------------------------------------- */ | |
| 178 | |
| 179 void generate_scrambling_sequence(WORD16 *sequence, WORD16 length); | |
| 180 | |
| 181 #endif | |
| 182 | |
| 183 | |
| 184 |
