FreeCalypso > hg > fc-tourmaline
comparison src/gpf/ccd/fdd_ci.c @ 0:4e78acac3d88
src/{condat,cs,gpf,nucleus}: import from Selenite
author | Mychaela Falconia <falcon@freecalypso.org> |
---|---|
date | Fri, 16 Oct 2020 06:23:26 +0000 |
parents | |
children |
comparison
equal
deleted
inserted
replaced
-1:000000000000 | 0:4e78acac3d88 |
---|---|
1 /* | |
2 +----------------------------------------------------------------------------- | |
3 | Project : CCD | |
4 | Modul : fdd_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 FDD_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 * Function prototypes of CCD-CCDDATA interface | |
34 */ | |
35 #include "ccddata.h" | |
36 | |
37 | |
38 /* | |
39 * Prototypes of ccd internal functions | |
40 */ | |
41 #include "ccd.h" | |
42 #include "bitfun.h" | |
43 | |
44 /* | |
45 * Declaration of coder/decoder tables | |
46 */ | |
47 #include "ccdtable.h" | |
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_fdd_ci_decode */ | |
55 static const U8 params_bSize[17] = | |
56 { | |
57 0, | |
58 10, | |
59 19, 28, | |
60 36, 44, 52, 60, | |
61 67, 74, 81, 88, 95, 102, 109, 116, | |
62 122 | |
63 }; | |
64 /* | |
65 +--------------------------------------------------------------------+ | |
66 | PROJECT : CCD MODULE : cdc_fdd_ci_decode | | |
67 +--------------------------------------------------------------------+ | |
68 | |
69 PURPOSE : Decoding of the FDD_CELL_INFORMATION Field reusing | |
70 RANGE 1024 format of frequency list information. | |
71 The IE is preceded by FDD_Indic0(1 bit) and made of the | |
72 following two IEs: | |
73 1) NR_OF_FDD_CELLS(5 bit field), | |
74 2) FDD_CELL_INFORMATION information parameters | |
75 | |
76 FDD_Indic0 indicates if the parameter value '0000000000' | |
77 is a member of the set. | |
78 | |
79 FDD_CELL_INFORMATION or "Scrambling Codes and Diversity | |
80 Field" is a bit filed of length | |
81 p(Number_of_Scrambling_Codes_and_Diversity), | |
82 whereas the function p(x) is defined by the table below | |
83 with n = Number_of_Scrambling_Codes_and_Diversity. | |
84 n p n p n p n p | |
85 0 0 5 44 10 81 15 116 | |
86 1 10 6 52 11 88 16 122 | |
87 2 19 7 60 12 95 17-31 0 | |
88 3 28 8 67 13 102 | |
89 4 36 9 74 14 109 | |
90 | |
91 The message is sent from net to MS and a MS supporting | |
92 enhanced measurements has to understand it. | |
93 | |
94 The space this IE takes in the C-structure is made of a | |
95 counter for the number of decoded parameter and an array | |
96 of them. | |
97 */ | |
98 | |
99 SHORT cdc_fdd_ci_decode (const ULONG c_ref, const ULONG e_ref, T_CCD_Globs *globs) | |
100 { | |
101 U8 ListSize = 0; | |
102 U16 ListBitLen = 0; | |
103 ULONG cix_ref, num_prolog_steps, prolog_step_ref; | |
104 short *w; | |
105 | |
106 #ifdef DEBUG_CCD | |
107 TRACE_CCD (globs, "cdc_fdd_ci_decode()"); | |
108 #ifdef CCD_SYMBOLS | |
109 TRACE_CCD (globs, "decoding list %s with range 1024 format", | |
110 ccddata_get_alias((USHORT) e_ref, 1)); | |
111 #else | |
112 TRACE_CCD (globs, "decoding elem %d with range 1024 format", melem[e_ref].elemRef); | |
113 #endif | |
114 #endif | |
115 | |
116 globs->SeekTLVExt = FALSE; | |
117 | |
118 cix_ref = melem[e_ref].calcIdxRef; | |
119 num_prolog_steps = calcidx[cix_ref].numPrologSteps; | |
120 prolog_step_ref = calcidx[cix_ref].prologStepRef; | |
121 | |
122 /* | |
123 * if this element have a defined Prolog | |
124 * we have to process it before decoding the bitstream | |
125 */ | |
126 if (num_prolog_steps) | |
127 { | |
128 ccd_performOperations (num_prolog_steps, prolog_step_ref, globs); | |
129 } | |
130 | |
131 /* | |
132 * First read NR_OF_FDD_CELLS (5 bits). | |
133 */ | |
134 globs->pstructOffs = melem[e_ref].structOffs;; | |
135 bf_readBits (5, globs); | |
136 ListSize = globs->pstruct[globs->pstructOffs++]; | |
137 | |
138 /* If n=0 there is nothing to do for this IE. */ | |
139 if (!ListSize) | |
140 { | |
141 return 1; | |
142 } | |
143 | |
144 /* Read the corresponding bit number or suppose the maximum length. */ | |
145 if (ListSize <= 16) | |
146 { | |
147 ListBitLen = params_bSize [ListSize]; | |
148 } | |
149 else | |
150 { | |
151 /* If n>17 there is nothing to do for this IE. */ | |
152 return 1; | |
153 } | |
154 /* | |
155 * Bit size for params is bigger than the size of unread bits in the | |
156 * message buffer. Danger: buffer overwriting! | |
157 */ | |
158 if ( ListBitLen > globs->maxBitpos - globs->bitpos) | |
159 { | |
160 ccd_recordFault (globs, ERR_ELEM_LEN, BREAK, (USHORT) e_ref, | |
161 globs->pstruct + globs->pstructOffs); | |
162 ListBitLen = (U16)(globs->maxBitpos - globs->bitpos); | |
163 } | |
164 | |
165 /* | |
166 * Use dynamic memory for calculation instead of global memory or stack. | |
167 */ | |
168 MALLOC (w, 257 * sizeof (U16)); | |
169 | |
170 /* Decode the W-parameter. */ | |
171 cdc_decode_param (param_1024, w, ListBitLen, globs); | |
172 | |
173 /* | |
174 * Decode and set the remaining channel number according the | |
175 * algorithm described in GSM 4.08. | |
176 */ | |
177 cdc_decode_frequencies (1023, &w[0], 0, FDD_CI_LIST, globs); | |
178 | |
179 /* Free the dynamic allocated memory. */ | |
180 MFREE (w); | |
181 | |
182 return 1; | |
183 } | |
184 #endif /* !RUN_INT_RAM */ | |
185 | |
186 #ifndef RUN_INT_RAM | |
187 /* | |
188 +--------------------------------------------------------------------+ | |
189 | PROJECT : CCD MODULE : cdc_fdd_ci_encode | | |
190 +--------------------------------------------------------------------+ | |
191 | |
192 PURPOSE : Encoding function is not needed, since this message is | |
193 sent only from net to MS. | |
194 It could be only useful for testing procedure if there | |
195 were an encoder function at this place. | |
196 This will be a future work. | |
197 */ | |
198 | |
199 SHORT cdc_fdd_ci_encode (const ULONG c_ref, const ULONG e_ref, T_CCD_Globs *globs) | |
200 { | |
201 | |
202 #ifdef DEBUG_CCD | |
203 TRACE_CCD (globs, "cdc_fdd_ci_encode()"); | |
204 #endif | |
205 #ifdef TARGET_WIN32 | |
206 /* TBD */ | |
207 #endif | |
208 return 1; | |
209 } | |
210 #endif /* !RUN_INT_RAM */ |