comparison gsm-fw/ccd/ccd_config.c @ 648:970d6199f2c5

gsm-fw/ccd/*.[ch]: initial import from the LoCosto source
author Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
date Thu, 04 Sep 2014 05:48:57 +0000
parents
children
comparison
equal deleted inserted replaced
647:a60b375014e3 648:970d6199f2c5
1 /*
2 +-----------------------------------------------------------------------------
3 | Project :
4 | Modul : ccd_config.c
5 +-----------------------------------------------------------------------------
6 | Copyright 2002 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 codec for CCD based on Ccddata
18 +-----------------------------------------------------------------------------
19 */
20
21 #define CCD_CONFIG_C
22
23 /*
24 * standard definitions like UCHAR, ERROR etc.
25 */
26 #include "typedefs.h"
27
28 /* MAX_ERRORS and T_CCD_ERR_ENTRY are defined in ccd_globs.h */
29 #include "ccd_globs.h"
30 #include "ccdtable.h"
31 #include "ccddata.h"
32 /* prototypes of the exported functions are given in ccd.h */
33 #include "ccd.h"
34
35 /*
36 * all coding types with their constant enumeration are given in ccd_codingtypes.h
37 */
38 #include "ccd_codingtypes.h"
39
40 #ifndef CCD_MK
41 #include "mconst.cdg"
42 #endif
43
44 /*
45 * ccdError and ccdWarning are defined in ccdapi.h
46 */
47 #include "ccdapi.h"
48
49 #if defined CCD_MK || !defined _TOOLS_
50 UBYTE cdc_init (T_FUNC_POINTER codec[MAX_CODEC_ID+1][2])
51 {
52 int i, j;
53
54 for (i = 0; i <= MAX_CODEC_ID; i++)
55 {
56 codec[i][0] = cdc_std_encode;
57 codec[i][1] = cdc_std_decode;
58 }
59
60 i = 0;
61 j = 1;
62 #if defined GSM1_V || defined _TOOLS_
63 codec[CCDTYPE_GSM1_V][0] = cdc_gsm1v_encode;
64 codec[CCDTYPE_GSM1_V][1] = cdc_gsm1v_decode;
65 #endif
66
67 j++;
68 #if defined GSM1_TV || defined _TOOLS_
69 codec[CCDTYPE_GSM1_TV][0] = cdc_gsm1tv_encode;
70 codec[CCDTYPE_GSM1_TV][1] = cdc_gsm1tv_decode;
71 #endif
72
73 j++;
74 #if defined GSM2_T || defined _TOOLS_
75 codec[CCDTYPE_GSM2_T][0] = cdc_gsm2t_encode;
76 codec[CCDTYPE_GSM2_T][1] = cdc_gsm2t_decode;
77 #endif
78
79 j++;
80 #if defined GSM3_V || defined _TOOLS_
81 codec[CCDTYPE_GSM3_V][0] = cdc_gsm3v_encode;
82 codec[CCDTYPE_GSM3_V][1] = cdc_gsm3v_decode;
83 #endif
84
85 j++;
86 #if defined GSM3_TV || defined _TOOLS_
87 codec[CCDTYPE_GSM3_TV][0] = cdc_gsm3tv_encode;
88 codec[CCDTYPE_GSM3_TV][1] = cdc_gsm3tv_decode;
89 #endif
90
91 j++;
92 #if defined GSM4_LV || defined _TOOLS_
93 codec[CCDTYPE_GSM4_LV][0] = cdc_gsm4lv_encode;
94 codec[CCDTYPE_GSM4_LV][1] = cdc_gsm4lv_decode;
95 #endif
96
97 j++;
98 #if defined GSM4_TLV || defined _TOOLS_
99 codec[CCDTYPE_GSM4_TLV][0] = cdc_gsm4tlv_encode;
100 codec[CCDTYPE_GSM4_TLV][1] = cdc_gsm4tlv_decode;
101 #endif
102
103 j++;
104 #if defined GSM5_V || defined _TOOLS_
105 codec[CCDTYPE_GSM5_V][0] = cdc_gsm5v_encode;
106 codec[CCDTYPE_GSM5_V][1] = cdc_gsm5v_decode;
107 #endif
108
109 j++;
110 #if defined GSM5_TLV || defined _TOOLS_
111 codec[CCDTYPE_GSM5_TLV][0] = cdc_gsm5tlv_encode;
112 codec[CCDTYPE_GSM5_TLV][1] = cdc_gsm5tlv_decode;
113 #endif
114
115 j++;
116 #if defined GSM6_TLV || defined _TOOLS_
117 codec[CCDTYPE_GSM6_TLV][0] = cdc_gsm6tlv_encode;
118 codec[CCDTYPE_GSM6_TLV][1] = cdc_gsm6tlv_decode;
119 #endif
120
121 j++;
122 #if defined GSM7_LV || defined _TOOLS_
123 codec[CCDTYPE_GSM7_LV][0] = cdc_gsm7lv_encode;
124 codec[CCDTYPE_GSM7_LV][1] = cdc_gsm7lv_decode;
125 #endif
126
127 j++;
128 #if defined GSM1_ASN || defined _TOOLS_
129 codec[CCDTYPE_GSM1_ASN][0] = cdc_gsm1asn_encode;
130 codec[CCDTYPE_GSM1_ASN][1] = cdc_gsm1asn_decode;
131 #endif
132
133 j++;
134 #if defined BCDODD || defined _TOOLS_
135 codec[CCDTYPE_BCDODD][0] = cdc_bcdodd_encode;
136 codec[CCDTYPE_BCDODD][1] = cdc_bcdodd_decode;
137 #endif
138
139 j++;
140 #if defined BCDEVEN || defined _TOOLS_
141 codec[CCDTYPE_BCDEVEN][0] = cdc_bcdeven_encode;
142 codec[CCDTYPE_BCDEVEN][1] = cdc_bcdeven_decode;
143 #endif
144
145 j++;
146 #if defined BCD_NOFILL || defined _TOOLS_
147 codec[CCDTYPE_BCD_NOFILL][0] = cdc_bcd_nofill_encode;
148 codec[CCDTYPE_BCD_NOFILL][1] = cdc_bcd_nofill_decode;
149 #endif
150
151 j++;
152 #if defined BCD_MNC || defined _TOOLS_
153 codec[CCDTYPE_BCD_MNC][0] = cdc_bcd_mnc_encode;
154 codec[CCDTYPE_BCD_MNC][1] = cdc_bcd_mnc_decode;
155 #endif
156
157 j++;
158 #if defined CSN1_S1 || defined _TOOLS_
159 codec[CCDTYPE_CSN1_S1][0] = cdc_csn1_s1_encode;
160 codec[CCDTYPE_CSN1_S1][1] = cdc_csn1_s1_decode;
161 #endif
162
163 j++;
164 #if defined CSN1_SHL || defined _TOOLS_
165 codec[CCDTYPE_CSN1_SHL][0] = cdc_csn1_shl_encode;
166 codec[CCDTYPE_CSN1_SHL][1] = cdc_csn1_shl_decode;
167 #endif
168
169 j++;
170 #if defined S_PADDING || defined _TOOLS_
171 codec[CCDTYPE_S_PADDING][0] = cdc_padd_encode;
172 codec[CCDTYPE_S_PADDING][1] = cdc_padd_decode;
173 #endif
174
175 j++;
176 #if defined T30_IDENT || defined _TOOLS_
177 codec[CCDTYPE_T30_IDENT][0] = cdc_t30_ident_encode;
178 codec[CCDTYPE_T30_IDENT][1] = cdc_t30_ident_decode;
179 #endif
180
181 j++;
182 #if defined BITSTRING || defined _TOOLS_
183 codec[CCDTYPE_BITSTRING][0] = cdc_bitstring_encode;
184 codec[CCDTYPE_BITSTRING][1] = cdc_bitstring_decode;
185 #endif
186
187 j++;
188 #if defined ASN1_INTEGER || defined _TOOLS_
189 codec[CCDTYPE_ASN1_INTEGER][0] = cdc_asn1_integ_encode;
190 codec[CCDTYPE_ASN1_INTEGER][1] = cdc_asn1_integ_decode;
191 #endif
192
193 j++;
194 #if defined ASN1_SEQUENCE || defined _TOOLS_
195 codec[CCDTYPE_ASN1_SEQUENCE][0] = cdc_asn1_seq_encode;
196 codec[CCDTYPE_ASN1_SEQUENCE][1] = cdc_asn1_seq_decode;
197 #endif
198
199 j++;
200 #if defined ASN1_CHOICE || defined _TOOLS_
201 codec[CCDTYPE_ASN1_CHOICE][0] = cdc_asn1_choice_encode;
202 codec[CCDTYPE_ASN1_CHOICE][1] = cdc_asn1_choice_decode;
203 #endif
204
205 j++;
206 #if defined ASN1_OCTET || defined _TOOLS_
207 codec[CCDTYPE_ASN1_OCTET][0] = cdc_asn1_octet_encode;
208 codec[CCDTYPE_ASN1_OCTET][1] = cdc_asn1_octet_decode;
209 #endif
210
211 j++;
212 #if defined NO_CODE || defined _TOOLS_
213 codec[CCDTYPE_NO_CODE][0] = cdc_no_encode;
214 codec[CCDTYPE_NO_CODE][1] = cdc_no_decode;
215 #endif
216
217 j++;
218 #if defined ASN1_INTEGER_EXTENSIBLE || defined _TOOLS_
219 codec[CCDTYPE_ASN1_INTEGER_EXTENSIBLE][0] = cdc_asn1_integ_ext_encode;
220 codec[CCDTYPE_ASN1_INTEGER_EXTENSIBLE][1] = cdc_asn1_integ_ext_decode;
221 #endif
222
223 j++;
224 #if defined ASN1_SEQUENCE_EXTENSIBLE || defined _TOOLS_
225 codec[CCDTYPE_ASN1_SEQUENCE_EXTENSIBLE][0] = cdc_asn1_seq_ext_encode;
226 codec[CCDTYPE_ASN1_SEQUENCE_EXTENSIBLE][1] = cdc_asn1_seq_ext_decode;
227 #endif
228
229 j++;
230 #if defined ASN1_CHOICE_EXTENSIBLE || defined _TOOLS_
231 codec[CCDTYPE_ASN1_CHOICE_EXTENSIBLE][0] = cdc_asn1_choice_ext_encode;
232 codec[CCDTYPE_ASN1_CHOICE_EXTENSIBLE][1] = cdc_asn1_choice_ext_decode;
233 #endif
234
235 j++;
236 #if defined ASN1_OBJ_ID || defined _TOOLS_
237 codec[CCDTYPE_ASN1_OBJ_ID][0] = cdc_asn1_obj_id_encode;
238 codec[CCDTYPE_ASN1_OBJ_ID][1] = cdc_asn1_obj_id_decode;
239 #endif
240
241 j++;
242 #if defined ASN1_OPEN_TYPE || defined _TOOLS_
243 codec[CCDTYPE_ASN1_OPEN_TYPE][0] = cdc_asn1_open_type_encode;
244 codec[CCDTYPE_ASN1_OPEN_TYPE][1] = cdc_asn1_open_type_decode;
245 #endif
246
247 j++;
248 #if defined NONCRITICAL_EXT || defined _TOOLS_
249 codec[CCDTYPE_NONCRITICAL_EXT][0] = cdc_noncritical_ext_encode;
250 codec[CCDTYPE_NONCRITICAL_EXT][1] = cdc_noncritical_ext_decode;
251 #endif
252
253 j++;
254 #if defined CRITICAL_EXT || defined _TOOLS_
255 codec[CCDTYPE_CRITICAL_EXT][0] = cdc_critical_ext_encode;
256 codec[CCDTYPE_CRITICAL_EXT][1] = cdc_critical_ext_decode;
257 #endif
258
259 j++;
260 #if defined S_PADDING_0 || defined _TOOLS_
261 codec[CCDTYPE_S_PADDING_0][0] = cdc_padd_0_encode;
262 codec[CCDTYPE_S_PADDING_0][1] = cdc_padd_0_decode;
263 #endif
264
265 j++;
266 #if defined CSN1_S0 || defined _TOOLS_
267 codec[CCDTYPE_CSN1_S0][0] = cdc_csn1_s0_encode;
268 codec[CCDTYPE_CSN1_S0][1] = cdc_csn1_s0_decode;
269 #endif
270
271
272 j++;
273 #if defined HL_FLAG || defined _TOOLS_
274 codec[CCDTYPE_HL_FLAG][0] = cdc_hl_flag_encode;
275 codec[CCDTYPE_HL_FLAG][1] = cdc_hl_flag_decode;
276 #endif
277
278 j++;
279
280 #if defined FDD_CI || defined _TOOLS_
281 codec[CCDTYPE_FDD_CI][0] = cdc_fdd_ci_encode;
282 codec[CCDTYPE_FDD_CI][1] = cdc_fdd_ci_decode;
283 #endif
284
285 j++;
286
287 #if defined TDD_CI || defined _TOOLS_
288 codec[CCDTYPE_TDD_CI][0] = cdc_tdd_ci_encode;
289 codec[CCDTYPE_TDD_CI][1] = cdc_tdd_ci_decode;
290 #endif
291
292 j++;
293
294 #if defined FREQ_LIST || defined _TOOLS_
295 codec[CCDTYPE_FREQ_LIST][0] = cdc_freq_list_encode;
296 codec[CCDTYPE_FREQ_LIST][1] = cdc_freq_list_decode;
297 #endif
298
299 j++;
300 #if defined CSN1_CONCAT || defined _TOOLS_
301 codec[CCDTYPE_CSN1_CONCAT][0] = cdc_csn1_concat_encode;
302 codec[CCDTYPE_CSN1_CONCAT][1] = cdc_csn1_concat_decode;
303 #endif
304
305 j++;
306 #if defined CCDTYPE_BREAK_COND || defined _TOOLS_
307 codec[CCDTYPE_BREAK_COND][0] = cdc_break_cond_encode;
308 codec[CCDTYPE_BREAK_COND][1] = cdc_break_cond_decode;
309 #endif
310
311 j++;
312 #if defined GSM5_TV || defined _TOOLS_
313 codec[CCDTYPE_GSM5_TV][0] = cdc_gsm5tv_encode;
314 codec[CCDTYPE_GSM5_TV][1] = cdc_gsm5tv_decode;
315 #endif
316
317 j++;
318 #if defined CSN1_CHOICE1 || defined _TOOLS_
319 codec[CCDTYPE_CSN1_CHOICE1][0] = cdc_csn1_choice1_encode;
320 codec[CCDTYPE_CSN1_CHOICE1][1] = cdc_csn1_choice1_decode;
321 #endif
322
323 j++;
324 #if defined CSN1_CHOICE2 || defined _TOOLS_
325 codec[CCDTYPE_CSN1_CHOICE2][0] = cdc_csn1_choice2_encode;
326 codec[CCDTYPE_CSN1_CHOICE2][1] = cdc_csn1_choice2_decode;
327 #endif
328
329 j++;
330 #if defined CSN1_SHL_OPT || defined _TOOLS_
331 codec[CCDTYPE_CSN1_SHL_OPT][0] = cdc_csn1_shl_opt_encode;
332 codec[CCDTYPE_CSN1_SHL_OPT][1] = cdc_csn1_shl_opt_decode;
333 #endif
334
335 j++;
336 #if defined CSN1_S1_OPT || defined _TOOLS_
337 codec[CCDTYPE_CSN1_S1_OPT][0] = cdc_csn1_s1_opt_encode;
338 codec[CCDTYPE_CSN1_S1_OPT][1] = cdc_csn1_s1_opt_decode;
339 #endif
340
341 j++;
342 #if defined CSN1_S0_OPT || defined _TOOLS_
343 codec[CCDTYPE_CSN1_S0_OPT][0] = cdc_csn1_s0_opt_encode;
344 codec[CCDTYPE_CSN1_S0_OPT][1] = cdc_csn1_s0_opt_decode;
345 #endif
346
347 /*
348 * CCD has more co/dec functions than used in the table above.
349 * Look in ccd_codingtypes.h.
350 */
351 /*lint -e774
352 * The follwing instruction checks if it was forgotten to initialize
353 * the codec when the number of coding types was increased; if everything
354 * was OK, the if evaluates for sure to false, causing the lint error
355 */
356 if (j < MAX_CODEC_ID)
357 return ccdWarning;
358 /*lint +e774*/
359
360 return ccdOK;
361 }
362 #endif /* CCD_MK || !_TOOLS_ */