2
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
1 /*
|
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
2 +-----------------------------------------------------------------------------
|
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
3 | Project :
|
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
4 | Modul : gsm5_tlv.c
|
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
5 +-----------------------------------------------------------------------------
|
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
6 | Copyright 2002 Texas Instruments Berlin, AG
|
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
7 | All rights reserved.
|
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
8 |
|
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
9 | This file is confidential and a trade secret of Texas
|
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
10 | Instruments Berlin, AG
|
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
11 | The receipt of or possession of this file does not convey
|
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
12 | any rights to reproduce or disclose its contents or to
|
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
13 | manufacture, use, or sell anything it may describe, in
|
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
14 | whole, or in part, without the specific written consent of
|
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
15 | Texas Instruments Berlin, AG.
|
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
16 +-----------------------------------------------------------------------------
|
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
17 | Purpose : Definition of encoding and decoding functions for GSM5_TLV elements
|
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
18 +-----------------------------------------------------------------------------
|
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
19 */
|
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
20
|
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
21
|
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
22 /*
|
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
23 * standard definitions like GLOBAL, UCHAR, ERROR etc.
|
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
24 */
|
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
25 #include "typedefs.h"
|
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
26 #include "header.h"
|
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
27
|
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
28 /*
|
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
29 * Prototypes of ccd (USE_DRIVER EQ undef) for prototypes only
|
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
30 * look at ccdapi.h
|
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
31 */
|
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
32 #undef USE_DRIVER
|
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
33 #include "ccdapi.h"
|
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
34
|
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
35 /*
|
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
36 * Types and functions for bit access and manipulation
|
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
37 */
|
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
38 #include "ccd_globs.h"
|
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
39 #include "bitfun.h"
|
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
40
|
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
41 /*
|
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
42 * Prototypes of ccd internal functions
|
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
43 */
|
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
44 #include "ccd.h"
|
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
45
|
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
46 /*
|
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
47 * Declaration of coder/decoder tables
|
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
48 */
|
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
49 #include "ccdtable.h"
|
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
50 #include "ccddata.h"
|
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
51
|
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
52 #ifndef RUN_INT_RAM
|
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
53 /*
|
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
54 +--------------------------------------------------------------------+
|
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
55 | PROJECT : CCD (6144) MODULE : CDC_GSM |
|
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
56 | STATE : code ROUTINE : cdc_gsm5tlv_decode |
|
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
57 +--------------------------------------------------------------------+
|
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
58
|
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
59 PURPOSE : Decoding of the GSM Type 5TLV element. This element
|
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
60 consists of a 8 bit T component a
|
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
61 8 or 16 Bit L component and a V component wich
|
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
62 length depends on the value of the L component.
|
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
63 If the length is in the range 0x00-0x7f the L component
|
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
64 consist of one byte. For bigger length 0x80-0xff the
|
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
65 L component consists of two bytes. The first byte is
|
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
66 tied to 0x81 and the second byte contains a value in the
|
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
67 range 0x80 to 0xff.
|
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
68
|
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
69
|
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
70 */
|
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
71
|
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
72 SHORT cdc_gsm5tlv_decode (const ULONG c_ref, const ULONG e_ref, T_CCD_Globs *globs)
|
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
73 {
|
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
74 T_TLV_SORT tlv_inf;
|
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
75
|
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
76 tlv_inf.gotTag = TRUE;
|
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
77 tlv_inf.gotLen = TRUE;
|
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
78
|
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
79 #ifdef DEBUG_CCD
|
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
80 #ifndef CCD_SYMBOLS
|
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
81 TRACE_CCD (globs, "cdc_gsm5tlv_decode()");
|
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
82 #else
|
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
83 TRACE_CCD (globs, "cdc_gsm5tlv_decode() %s", ccddata_get_alias((USHORT) e_ref, 1));
|
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
84 #endif
|
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
85 #endif
|
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
86
|
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
87 return cdc_tlv_decode (c_ref, e_ref, &tlv_inf, globs);
|
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
88 }
|
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
89 #endif /* !RUN_INT_RAM */
|
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
90
|
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
91 #ifndef RUN_INT_RAM
|
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
92 /*
|
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
93 +--------------------------------------------------------------------+
|
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
94 | PROJECT : CCD (6144) MODULE : CDC_GSM |
|
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
95 | STATE : code ROUTINE : cdc_gsm5tlv_encode |
|
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
96 +--------------------------------------------------------------------+
|
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
97
|
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
98 PURPOSE : Encoding of the GSM Type 5TLV element. This element
|
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
99 consists of a 8 bit T component a
|
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
100 8 or 16 Bit L component and a V component wich
|
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
101 length depends on the value of the L component.
|
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
102 If the length is in the range 0x00-0x7f the L component
|
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
103 consist of one byte. For bigger length 0x80-0xff the
|
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
104 L component consists of two bytes. The first byte is
|
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
105 tied to 0x81 and the second byte contains a value in the
|
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
106 range 0x80 to 0xff.
|
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
107
|
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
108 */
|
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
109
|
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
110 SHORT cdc_gsm5tlv_encode (const ULONG c_ref, const ULONG e_ref, T_CCD_Globs *globs)
|
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
111 {
|
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
112 #ifdef DEBUG_CCD
|
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
113 #ifndef CCD_SYMBOLS
|
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
114 TRACE_CCD (globs, "cdc_gsm5tlv_encode()");
|
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
115 #else
|
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
116 TRACE_CCD (globs, "cdc_gsm5tlv_encode() %s", ccddata_get_alias((USHORT) e_ref, 1));
|
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
117 #endif
|
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
118 #endif
|
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
119
|
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
120 cdc_tlv_encode (e_ref, 8, 8, globs);
|
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
121
|
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
122 return 1;
|
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
123 }
|
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
124 #endif /* !RUN_INT_RAM */
|