FreeCalypso > hg > fc-selenite
comparison src/gpf/ccd/tdd_ci.c @ 5:1ea54a97e831
src/gpf: import of Magnetite src/gpf3
author | Mychaela Falconia <falcon@freecalypso.org> |
---|---|
date | Sun, 15 Jul 2018 08:11:07 +0000 |
parents | |
children |
comparison
equal
deleted
inserted
replaced
4:6e457872f745 | 5:1ea54a97e831 |
---|---|
1 /* | |
2 +----------------------------------------------------------------------------- | |
3 | Project : CCD | |
4 | Modul : tdd_ci.c | |
5 +----------------------------------------------------------------------------- | |
6 | Copyright 2004 Texas Instruments Deutschland GmbH | |
7 | All rights reserved. | |
8 | | |
9 | This file is confidential and a trade secret of Texas | |
10 | Instruments Deutschland GmbH | |
11 | The receipt of or possession of this file does not convey | |
12 | any rights to reproduce or disclose its contents or to | |
13 | manufacture, use, or sell anything it may describe, in | |
14 | whole, or in part, without the specific written consent of | |
15 | Texas Instruments Deutschland GmbH. | |
16 +----------------------------------------------------------------------------- | |
17 | Purpose : Definition of encoding and decoding functions for TDD_CI type | |
18 +----------------------------------------------------------------------------- | |
19 */ | |
20 | |
21 | |
22 /* | |
23 * standard definitions like GLOBAL, UCHAR, ERROR etc. | |
24 */ | |
25 #include "typedefs.h" | |
26 #include "header.h" | |
27 | |
28 /* | |
29 * Types and functions for bit access and manipulation | |
30 */ | |
31 #include "ccd_globs.h" | |
32 | |
33 /* | |
34 * Prototypes of ccd internal functions | |
35 */ | |
36 #include "ccd.h" | |
37 #include "bitfun.h" | |
38 | |
39 /* | |
40 * Declaration of coder/decoder tables | |
41 */ | |
42 #include "ccdtable.h" | |
43 /* | |
44 * Function prototypes of CCD-CCDDATA interface | |
45 */ | |
46 #include "ccddata.h" | |
47 | |
48 | |
49 #if !(defined (CCD_TEST)) | |
50 #include "vsi.h" | |
51 #endif | |
52 | |
53 #ifndef RUN_INT_RAM | |
54 /* Attention: static data, only used in cdc_tdd_ci_decode */ | |
55 static const U8 params_bSize[21] = | |
56 { | |
57 0, | |
58 9, | |
59 17, 25, | |
60 32, 39, 46, 53, | |
61 59, 65, 71, 77, 83, 89, 95, 101, | |
62 106, 111, 116, 121, 126 | |
63 }; | |
64 /* | |
65 +--------------------------------------------------------------------+ | |
66 | PROJECT : CCD MODULE : cdc_tdd_ci_decode | | |
67 +--------------------------------------------------------------------+ | |
68 | |
69 PURPOSE : Decoding of the TDD_CELL_INFORMATION Field reusing | |
70 RANGE 511 format of frequency lists (with w0=0.). | |
71 This field allows to compute a set of 9-bit-long | |
72 TDD_CELL_INFORMATION aprameters. | |
73 The IE is preceded by TDD_Indic0(1 bit) and made of the | |
74 following two IEs: | |
75 1) NR_OF_TDD_CELLS(5 bit field), | |
76 2) TDD_CELL_INFORMATION information parameters | |
77 | |
78 TDD_Indic0 indicates if the parameter value '0000000000' | |
79 is a member of the set. | |
80 The total number of bits q of this field depends on the | |
81 value of the parameter NR_OF_TDD_CELLS = m | |
82 as follows (with q=0 if m=0): | |
83 m q m q m q m q m q | |
84 0 0 5 39 10 71 15 101 20 126 | |
85 1 9 6 46 11 77 16 106 21-31 0 | |
86 2 17 7 53 12 83 17 111 | |
87 3 25 8 59 13 89 18 116 | |
88 4 32 9 65 14 95 19 121 | |
89 | |
90 The message is sent from net to MS and a MS supporting | |
91 enhanced measurements has to understand it. | |
92 | |
93 The space this IE takes in the C-structure is made of a | |
94 counter for the number of decoded parameter and an array | |
95 of them. | |
96 */ | |
97 | |
98 SHORT cdc_tdd_ci_decode (const ULONG c_ref, const ULONG e_ref, T_CCD_Globs *globs) | |
99 { | |
100 U8 ListSize = 0; | |
101 U16 ListBitLen = 0; | |
102 ULONG cix_ref, num_prolog_steps, prolog_step_ref; | |
103 short *w; | |
104 | |
105 #ifdef DEBUG_CCD | |
106 TRACE_CCD (globs, "cdc_tdd_ci_decode()"); | |
107 #ifdef CCD_SYMBOLS | |
108 TRACE_CCD (globs, "decoding list %s with range 512 format", | |
109 ccddata_get_alias((USHORT) e_ref, 1)); | |
110 #else | |
111 TRACE_CCD (globs, "decoding list %d of range 512 format", melem[e_ref].elemRef); | |
112 #endif | |
113 #endif | |
114 | |
115 globs->SeekTLVExt = FALSE; | |
116 cix_ref = melem[e_ref].calcIdxRef; | |
117 num_prolog_steps = calcidx[cix_ref].numPrologSteps; | |
118 prolog_step_ref = calcidx[cix_ref].prologStepRef; | |
119 | |
120 /* | |
121 * if this element have a defined Prolog | |
122 * we have to process it before decoding the bitstream | |
123 */ | |
124 if (num_prolog_steps) | |
125 { | |
126 ccd_performOperations (num_prolog_steps, prolog_step_ref, globs); | |
127 } | |
128 | |
129 /* | |
130 * First read NR_OF_TDD_CELLS (5 bits). | |
131 */ | |
132 globs->pstructOffs = melem[e_ref].structOffs;; | |
133 bf_readBits (5, globs); | |
134 ListSize = globs->pstruct[globs->pstructOffs++]; | |
135 | |
136 /* If n=0 there is nothing to do for this IE. */ | |
137 if (!ListSize) | |
138 { | |
139 return 1; | |
140 } | |
141 | |
142 /* Read the corresponding bit number or suppose the maximum length. */ | |
143 if (ListSize <= 20) | |
144 { | |
145 ListBitLen = params_bSize [ListSize]; | |
146 } | |
147 else | |
148 { | |
149 /* If n>20 there is nothing to do for this IE. */ | |
150 return 1; | |
151 } | |
152 /* | |
153 * Bit size for params is bigger than the size of unread bits in the | |
154 * message buffer. Danger: buffer overwriting! | |
155 */ | |
156 if ( ListBitLen > globs->maxBitpos - globs->bitpos) | |
157 { | |
158 ccd_recordFault (globs, ERR_ELEM_LEN, BREAK, (USHORT) e_ref, | |
159 globs->pstruct + globs->pstructOffs); | |
160 ListBitLen = (U16)(globs->maxBitpos - globs->bitpos); | |
161 } | |
162 /* | |
163 * Use dynamic memory for calculation instead of global memory or stack. | |
164 */ | |
165 MALLOC (w, 257 * sizeof (U16)); | |
166 | |
167 | |
168 /* | |
169 * Decode the W-parameter. | |
170 * As a rule for this type w(0) must be 0. | |
171 */ | |
172 w[0] = 0; | |
173 cdc_decode_param (param_512+1, &w[1], ListBitLen, globs); | |
174 | |
175 /* | |
176 * Decode and set the remaining channel number according the | |
177 * algorithm described in GSM 4.08. | |
178 */ | |
179 cdc_decode_frequencies (511, &w[1], 0, TDD_CI_LIST, globs); | |
180 | |
181 /* Free the dynamic allocated memory. */ | |
182 MFREE (w); | |
183 | |
184 return 1; | |
185 } | |
186 #endif /* !RUN_INT_RAM */ | |
187 | |
188 #ifndef RUN_INT_RAM | |
189 /* | |
190 +--------------------------------------------------------------------+ | |
191 | PROJECT : CCD MODULE : cdc_tdd_ci_encode | | |
192 +--------------------------------------------------------------------+ | |
193 | |
194 PURPOSE : Encoding function is not needed, since this message is | |
195 sent from net to MS. | |
196 It could be only useful for testing procedure if there | |
197 were an encoder function at this place. | |
198 This will be a future work. | |
199 | |
200 */ | |
201 | |
202 SHORT cdc_tdd_ci_encode (const ULONG c_ref, const ULONG e_ref, T_CCD_Globs *globs) | |
203 { | |
204 | |
205 #ifdef DEBUG_CCD | |
206 TRACE_CCD (globs, "cdc_tdd_ci_encode()"); | |
207 #endif | |
208 #ifdef TARGET_WIN32 | |
209 /* TBD */ | |
210 #endif | |
211 return 1; | |
212 } | |
213 #endif /* !RUN_INT_RAM */ |