comparison gpf/inc/ccdapi.h @ 0:75a11d740a02

initial import of gsm-fw from freecalypso-sw rev 1033:5ab737ac3ad7
author Mychaela Falconia <falcon@freecalypso.org>
date Thu, 09 Jun 2016 00:02:41 +0000
parents
children
comparison
equal deleted inserted replaced
-1:000000000000 0:75a11d740a02
1 /*
2 +-----------------------------------------------------------------------------
3 | Project :
4 | Modul : ccdapi.h
5 +-----------------------------------------------------------------------------
6 | Copyright 2002 Texas Instruments Berlin, AG
7 | All rights reserved.
8 |
9 | This file is confidential and a trade secret of Texas
10 | Instruments Berlin, AG
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 Berlin, AG.
16 +-----------------------------------------------------------------------------
17 | Purpose : Condat Coder Decoder Application Interface
18 |
19 | Use this header to integrate the condat coder decoder
20 | in your target system !
21 |
22 | The application must define USE_DRIVER if CCD is
23 | not linked but used as a driver
24 +-----------------------------------------------------------------------------
25 */
26
27 #ifndef CCDAPI_H
28 #define CCDAPI_H
29
30 #ifdef __cplusplus
31 extern "C" {
32 #endif /*_cplusplus*/
33
34 /**************************************************************
35 Types and constants for CCD
36 used in application, in stub1 (api) and in driver body
37 **************************************************************/
38
39 /*==== CONSTANTS ==================================================*/
40 /*
41 * constants for the direction-parameter for coding/decoding
42 */
43
44 #define UPLINK 0
45 #define DOWNLINK 1
46 #define BOTH UPLINK
47
48 /* ccd Error codes */
49 #define ccdOK 0
50 #define ccdWarning 1
51 #define ccdError 2
52 #ifdef _TOOLS_
53 #define CCD_DLL_ERROR 23
54 #endif /* _TOOLS_ */
55
56 /* reentrancy */
57 #define CCD_REENTRANT 0
58
59 /*
60 * Error codes to use with ccd_setError()
61 */
62 #define ERR_NO_MORE_ERROR 0 /* Returned by ccd_getFirst/NextError */
63 /* in case of the end of the error list */
64
65 #define ERR_INVALID_CALC 1 /* Invalid combination of calculations */
66 /* Error params: none */
67
68 #define ERR_PATTERN_MISMATCH 2 /* A spare pattern does not match with */
69 /* the specified content */
70 /* Error params[0] = bitposition */
71
72 #define ERR_COMPREH_REQUIRED 3 /* Comprehension of an unknown TAG */
73 /* required. */
74 /* Error params[0] = TAG */
75 /* [1] = bitposition */
76
77 #define ERR_IE_NOT_EXPECTED 4 /* Unknown or unexpected TAG found */
78 /* Error params[0] = TAG */
79 /* [1] = bitposition */
80
81 #define ERR_IE_SEQUENCE 5 /* A valid TAG is found but not in the */
82 /* defined sequence. */
83 /* Error params[0] = TAG */
84 /* [1] = bitposition */
85
86 #define ERR_MAX_IE_EXCEED 6 /* A repeatable TAG is found but it */
87 /* occurs more often than it is defined */
88 /* Error params[0] = TAG */
89 /* [1] = bitposition */
90
91 #define ERR_MAND_ELEM_MISS 7 /* A as mandatory defined element is */
92 /* not in the message */
93 /* Error params: none */
94
95 #define ERR_EOC_TAG_MISSING 8 /* A indefinite length is specified for */
96 /* an ASN.1 element but the correspond. */
97 /* End of Component TAG is missing */
98 /* Error params[0] = TAG */
99 /* [1] = bitposition */
100
101 #define ERR_INVALID_MID 9 /* The message starts with an undefined */
102 /* message identifier; more exactly: */
103 /* with the three given parameters mId, */
104 /* entity, and direction for the coding */
105 /* or decoding of a Message functions */
106 /* CCD was not able to identify the */
107 /* Message */
108 /* Error params[0] = Message ID */
109
110 #define ERR_INVALID_TYPE 10 /* The actual element has an invalid */
111 /* type e.g. S_PADDING without a spare */
112 /* Error params[0] = bitposition */
113
114 #define ERR_MAX_REPEAT 11 /* A repeatable element occurs to often */
115 /* in the message */
116
117 #define ERR_NO_MEM 12 /* Memory allocation failed. May result */
118 /* occur when using pointer types. */
119 /* (Dynamic array addition) */
120
121 #define ERR_ADDR_INFO_PART 13 /* CCD recognizes a message with a */
122 /* disallowed addressing option */
123
124 #define ERR_DISTRIB_PART 14 /* CCD recognizes an error during */
125 /* decoding of the message distribution */
126 /* part */
127
128 #define ERR_NON_DISTRIB_PART 15 /* CCD recognizes an error during */
129 /* decoding of the message non- */
130 /* distribution part */
131
132 #define ERR_MESSAGE_ESCAPE 16 /* CCD detects an unknown message part, */
133 /* which is marked whith a message */
134 /* escape error label being used to */
135 /* provide an escape for, e.g. a future */
136 /* modification of the message syntax */
137
138 #define ERR_IGNORE 17 /* CCD detects a part of the message */
139 /* that is syntactically incorrect and */
140 /* is allowed to ignore this part */
141
142 #define ERR_18 18 /* dummy to complete error list - */
143 /* may be used in furture enhancement */
144
145 #define ERR_19 19 /* dummy to complete error list - */
146 /* may be used in furture enhancement */
147
148 #define ERR_INTERNAL_ERROR 20 /* An internal error occured */
149 /* (hopefully not!) */
150 /* Error params[0] = none */
151 #define ERR_DEFECT_CCDDATA 21 /* The value read from a ccd table */
152 /* (one of the *.cdg files) is not */
153 /* expected by CCD, e.g. extGroup has */
154 /* another value than ' ', '+', '-', */
155 /* '!' or '#'. */
156 /* Error params[0] = bitposition */
157 /* this error code is needed only in */
158 /* the development phase. */
159 #define ERR_END_OF_BUF 22 /* According to the lenght indicator */
160 /* there must be more bits to read but */
161 /* end of bit buffer is reached */
162
163 #define ERR_INT_VALUE 23 /* Error on encoding of integer value. */
164 /* IE of coding type ASN1_INTEGER is */
165 /* out of the given range. */
166
167 #define ERR_LONG_MSG 24 /* UNUSED error code */
168 /* According to l_buf and due to an */
169 /* unknown message extension there are */
170 /* more bits to be decoded than CCD or */
171 /* ccddata expects. */
172
173 #define ERR_ASN1_ENCODING 25 /* Error on IE in the outermost level. */
174 #define ERR_ASN1_MAND_IE 26 /* Error on mandatory IE of type */
175 /* ASN1_INTEGER. The decoded value is */
176 /* out of the range given by the loaded */
177 /* ccd data tables. */
178 /* data tables. */
179 #define ERR_ASN1_OPT_IE 27 /* Error on optional IE of type. */
180 /* ASN1_INTEGER. The decoded value is */
181 /* out of the range given by the loaded */
182 /* ccd data tables. */
183 #define ERR_ASN1_COND_IE 28 /* UNUSED error code */
184 #define ERR_COND_ELEM_MISS 29 /* UNUSED error code */
185 /* Condition is met but the IE is not */
186 /* present in the message. */
187 #define ERR_BUFFER_OF 30 /* On coding, more bits were written, */
188 /* than the input l_buf suggested. */
189
190 #define ERR_NONCRITICAL_EXT 31 /* Warning (if decoding) or error (if */
191 /* encoding) on inappropriate usage of */
192 /* a nonCriticalExtensions element. */
193 /* The CCDTYPE_NONCRITICAL_EXTENSIONS */
194 /* says the IE is not extended yet from */
195 /* a CCD point of view. So it needs */
196 /* neither to be encoded nor decoded. */
197 /* In the latter case additional parts */
198 /* at the end the message will be */
199 /* ignored by CCD. Known extensions are */
200 /* to be encoded by CCD. */
201
202 #define ERR_CRITICAL_EXT 32 /* Error on inappropriate usage of a */
203 /* nonCriticalExtensions element. The */
204 /* CCDTYPE_CRITICAL_EXTENSIONS says */
205 /* the IE is not extended yet, from a */
206 /* CCD point of view. So it needs not */
207 /* to be encoded or decoded. In latter */
208 /* case message is not comprehendable */
209 /* and must be rejected. */
210
211 #define ERR_INVALID_CCDID 33 /* The ccd identifier for the element */
212 /* to be decoded did not result a valid */
213 /* data table entry. */
214
215 #define ERR_MSG_LEN 34 /* Decoding is just finished. But the */
216 /* CCD internal bit pointer is beyond */
217 /* the given message length, l_buf e.g. */
218
219 #define ERR_INVALID_PTR 35 /* Pointer used in C struct for encoding*/
220 /* is not valid. */
221 #define ERR_PROTOCOL_EXTENSION 36 /* IE of type S_PADDING_0 is preceded */
222 /* by 1 instead of 0. */
223 /* Error params[0] = CCDID */
224 /* [1] = bitposition */
225
226 #define ERR_BITSTR_COMP 37 /* Length of bit array encoded as */
227 /* composition is bigger than expected */
228 /* Error params[0] = CCDID */
229 /* [1] = addr in C-struct */
230
231 #define ERR_ELEM_LEN 38 /* The current information element's */
232 /* length doesn't match to the length */
233 /* required by its nested elements */
234
235 #define ERR_LEN_MISMATCH 39 /* The length of a superordinated */
236 /* doesn't match to read an GSM5_V */
237 /* element, which extends to the */
238 /* message end. */
239
240 #define ERR_CONCAT_LEN 40 /* Coding of a truncated concatenation */
241 /* doesn't fill the rest of message */
242 /* buffer.(length given by l_buf) */
243
244 #define ERR_UNEXPECT_PAD 41 /* an inchoate byte is filled with */
245 /* padding bits which are not expected */
246
247 #define ERR_CSN1_CHOICE 42 /* the number of CHOICE components */
248 /* doesn't match to number of possible */
249 /* alternatives */
250
251 #define MAX_CCD_ERROR 43
252
253 /*
254 * max number of parameters per error for parlist
255 * param ccd_getFirst/NextError
256 */
257 #define MAX_ERR_PAR 3
258 #define CCD_ERR_KIND_PARA_LIST 1
259 #define CCD_ERR_KIND_IE_TYPE 2
260
261
262 /*==== TYPES ======================================================*/
263
264 /*
265 * T_MSGBUF contains the coded message.
266 * o_buf specified the * offset (in Bits), * where the message
267 * starts in the buffer.
268 * l_buf contains the * length (in Bits) of the coded message.
269 * buf contains the * bitcoded message as an array of Bytes.
270 *
271 * (Do not modify this structure !)
272 */
273
274 typedef struct
275 {
276 USHORT l_buf;
277 USHORT o_buf;
278 UBYTE buf [1];
279 } T_MSGBUF;
280
281
282 /*
283 * new style of error information container, used in umts
284 */
285 #ifdef CCD_USE_ENUM_IDS
286 #include "ccdid.h" /* to get enumeration for fault elements */
287 typedef T_CCD_ID T_ERR_INFO;
288 #else
289 typedef ULONG T_ERR_INFO;
290 #endif
291
292 typedef struct
293 {
294 T_ERR_INFO err_info;
295 ULONG err_IEaddr;
296 } T_CCD_ERR_TYPE;
297
298 /*
299 * old style of error information container, used in gsm/gprs
300 */
301 #define MAX_ERR_PAR 3
302 typedef struct
303 {
304 UBYTE num_para;
305 USHORT err_list[MAX_ERR_PAR];
306 } T_CCD_PARA_LIST;
307
308 /*
309 * union supports old and new type of error information container
310 */
311 typedef union
312 {
313 T_CCD_PARA_LIST para_list;
314 T_CCD_ERR_TYPE err_type;
315 } T_CCD_ERR_PARA;
316
317 /*
318 * general structure for error information passed to CCD caller
319 */
320 typedef struct
321 {
322 UBYTE error;
323 UBYTE kind;
324 T_CCD_ERR_PARA para;
325 } T_CCD_ERR_ENTRY;
326
327
328 /**************************************************************
329 function codes for CCD interface functions
330 used in stub1 (application side) and stub2 (driver side)
331 **************************************************************/
332
333 #define CCD_INIT 1
334 #define CCD_CODMSG 2
335 #define CCD_DECMSG 3
336 #define CCD_DECBYTE 4
337 #define CCD_CODBYTE 5
338 #define CCD_DECLONG 6
339 #define CCD_CODLONG 7
340 #define CCD_BITCOPY 8
341 #define CCD_FIRST_ERR 9
342 #define CCD_NEXT_ERR 10
343
344 #if !defined (CCDDATA_PREF)
345 #if defined (_TOOLS_) && defined (CCDDATA_LOAD)
346 #define CCDDATA_PREF(ccd_fun) cddl_##ccd_fun
347 #else
348 #define CCDDATA_PREF(ccd_fun) ccd_fun
349 #endif /* _TOOLS_ && CCDDATA_LOAD */
350 #endif /* !CCDDATA_PREF */
351
352 #if defined _TOOLS_ || defined (CCD_TEST)
353 /*
354 * Preparation for issue patching coded bits for generating
355 * air messages with errors. This feature is not yet supported
356 * by CCD.
357 */
358 #define CCDP_NO_ERROR 0
359 #define CCDP_NOT_FOUND 1
360 #define CCDP_VALIDFLAG_SEEN 2
361 #define CCDP_UNKNOWN_ERROR 3
362 #define MAXREC 50
363 typedef struct
364 {
365 U16 elemid[MAXREC];
366 U16 numelems;
367 U16 bitwidth;
368 U8* bits;
369 U8 errorcode;
370 } T_patch_info;
371 #endif /* _TOOLS_ */
372
373 /*==================== description ===================================*/
374
375 /*
376 * ccd_init
377 *
378 * Initializing the ccd-Module, must be called once before
379 * any encoding/decoding
380 */
381
382 /*
383 * ccd_begin
384 *
385 * Returns the address of the CCD buffer for decoded
386 * messages and locks it until ccd_end() is called
387 */
388
389 /*
390 * ccd_end
391 *
392 * Unlocks the CCD buffer for decoded
393 * messages
394 */
395
396 /*
397 * ccd_codeMsg
398 *
399 * layer : <IN> CCDENT_CMCE, CCDENT_MLE ..
400 * direction: <IN> UPLINK, DOWNLINK
401 * mBuf : <IN> mBuf.o_buf - Offset in Bits from the
402 * start of mBuf.buf.
403 * <OUT> mBuf.l_buf - Contains the length of
404 * the message in Bits after
405 * coding.
406 * <OUT> mBuf.buf - Contains the bitcoded message
407 * after coding.
408 * mStruct: <IN> Pointer to the message specific structure.
409 * The first element must contain the
410 * message-type (PDU-Type) as a UBYTE value.
411 *
412 * pt : <IN> If pt != 0xff the CCD will not decode the
413 * the PDU-Type from the bitstream. In this
414 * case pt is the coding of the PDU-Type.
415 */
416
417 /*
418 * ccd_decodeMsg
419 *
420 * layer : <IN> CCDENT_CMCE, CCDENT_MLE, ...
421 * direction: <IN> UPLINK, DOWNLINK
422 * mBuf : <IN> mBuf.o_buf - Offset in Bits from start
423 * of mBuf.buf where the
424 * message starts.
425 * <IN> mBuf.l_buf - Contains the length of the
426 * message in Bits.
427 * <IN> mBuf.buf - Contains the bitcoded message.
428 * mStruct : <OUT> Pointer to the message specific structure.
429 * The first element contains the message-type
430 * (PDU-Type) as a UBYTE value after decoding.
431 * pt : <IN> If pt != 0xff the CCD will not decode the
432 * the PDU-Type from the bitstream. In this
433 * case pt is the coding of the PDU-Type.
434 */
435
436 /**************************************************************
437 function prototypes for CCD interface functions
438 used in application, stub2 (driver side) and driver body
439 **************************************************************/
440 #ifndef CCD_PATCH_C
441 #ifdef _TOOLS_
442 extern int CCDDATA_PREF(ccd_set_patch_infos) (T_patch_info* pinfo);
443 #endif /* _TOOLS_ */
444 #endif /* CCD_PATCH_C */
445
446 #ifndef CCD_C
447 extern BYTE CCDDATA_PREF(ccd_init) (void);
448 extern int CCDDATA_PREF(ccd_exit) (void);
449
450 extern UBYTE* CCDDATA_PREF(ccd_begin) (void);
451
452 extern void CCDDATA_PREF(ccd_end) (void);
453
454 extern BYTE CCDDATA_PREF(ccd_decodeMsg) (UBYTE entity,
455 UBYTE direction,
456 T_MSGBUF *mBuf,
457 UBYTE *mStruct,
458 UBYTE pt);
459
460 extern S8 CCDDATA_PREF(ccd_decodeMsgPtr) (U8 entity,
461 U8 direction,
462 U16 l_buf,
463 U16 o_buf,
464 U8 *buf,
465 U8 **mStructPtr,
466 U8 pt);
467
468 extern BYTE CCDDATA_PREF(ccd_codeMsg) (UBYTE entity,
469 UBYTE direction,
470 T_MSGBUF *mBuf,
471 UBYTE *mStruct,
472 UBYTE pt);
473
474 extern S8 CCDDATA_PREF(ccd_codeMsgPtr) (U8 entity,
475 U8 direction,
476 U16 *l_buf,
477 U16 o_buf,
478 U8 *buf,
479 U8 *mStruct,
480 U8 pt);
481
482 extern UBYTE ccd_setStore (ULONG regNo,
483 ULONG value);
484 #ifdef _TOOLS_
485 extern ULONG CCDDATA_PREF(ccd_init_ccddata) (void);
486 #else
487 extern int ccd_register (int decmsgbuf_size);
488 #endif /* _TOOLS_ */
489 #endif /*! CCD_C */
490
491 #ifndef CCD_ELEM_C
492 extern int CCDDATA_PREF(ccd_encodeElem) (ULONG ccdid,
493 USHORT *l_buf,
494 USHORT o_buf,
495 UCHAR *buf,
496 UCHAR *eStruct);
497
498 extern int CCDDATA_PREF(ccd_decodeElem) (ULONG ccdid,
499 USHORT l_buf,
500 USHORT o_buf,
501 UCHAR *buf,
502 UCHAR *eStruct);
503
504 #endif /* CCD_ELEM_C */
505
506 #ifndef CCD_ERR_C
507 extern UBYTE CCDDATA_PREF(ccd_getFirstError) (UBYTE entity,
508 USHORT *parlist);
509
510 extern UBYTE CCDDATA_PREF(ccd_getNextError) (UBYTE entity,
511 USHORT *parlist);
512
513 extern ULONG CCDDATA_PREF(ccd_getFirstFault)
514 (T_CCD_ERR_ENTRY **ccd_err_entry);
515
516 extern ULONG CCDDATA_PREF(ccd_getNextFault)
517 (T_CCD_ERR_ENTRY **ccd_err_entry);
518
519 extern void CCDDATA_PREF(ccd_free_faultlist) (void);
520
521 extern int CCDDATA_PREF(ccd_get_numFaults) (void);
522 #endif /*! CCD_ERR_C */
523
524 #ifndef CDC_STD_C
525 extern BYTE CCDDATA_PREF(ccd_decodeByte) (UBYTE *bitstream,
526 USHORT startbit,
527 USHORT bitlen,
528 UBYTE *value);
529
530 extern BYTE CCDDATA_PREF(ccd_codeByte) (UBYTE *bitstream,
531 USHORT startbit,
532 USHORT bitlen,
533 UBYTE val);
534
535 extern BYTE CCDDATA_PREF(ccd_codeLong) (UBYTE *bitstream,
536 USHORT startbit,
537 USHORT bitlen,
538 ULONG value);
539
540 extern BYTE CCDDATA_PREF(ccd_decodeLong) (UBYTE *bitstream,
541 USHORT startbit,
542 USHORT bitlen,
543 ULONG *value);
544
545 extern void CCDDATA_PREF(ccd_bitcopy) (UBYTE *dest,
546 UBYTE *source,
547 USHORT bitlen,
548 USHORT offset);
549 #endif /*! CCD_STD_C */
550
551
552 #ifdef __cplusplus
553 }
554 #endif /*_cplusplus*/
555
556 #endif
557