comparison src/gpf3/ccd/csn1_s0_opt.c @ 2:c41a534f33c6

src/gpf3: preened GPF goo from TCS3.2
author Mychaela Falconia <falcon@freecalypso.org>
date Sun, 25 Sep 2016 23:52:50 +0000
parents
children
comparison
equal deleted inserted replaced
1:864b8cc0cf63 2:c41a534f33c6
1 /*
2 +-----------------------------------------------------------------------------
3 | Project : CCD
4 | Modul : csn1_s0_opt.c
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 : Definition of encoding and decoding functions for CSN1_S0 elements
18 +-----------------------------------------------------------------------------
19 */
20
21 /*
22 * standard definitions like GLOBAL, UCHAR, ERROR etc.
23 */
24 #include "typedefs.h"
25 #include "header.h"
26
27 /*
28 * Prototypes of ccd (USE_DRIVER EQ undef) for prototypes only
29 * look at ccdapi.h
30 */
31 #undef USE_DRIVER
32 #include "ccdapi.h"
33
34 /*
35 * Types and functions for bit access and manipulation
36 */
37 #include "ccd_globs.h"
38 #include "bitfun.h"
39
40 /*
41 * Prototypes of ccd internal functions
42 */
43 #include "ccd.h"
44
45 /*
46 * Declaration of coder/decoder tables
47 */
48 #include "ccdtable.h"
49 #include "ccddata.h"
50
51 extern SHORT cdc_csn1_sx_decode (int flag, const ULONG e_ref, T_CCD_Globs *globs);
52 extern SHORT cdc_csn1_sx_encode (int flag, const ULONG e_ref, T_CCD_Globs *globs);
53
54 #ifndef RUN_FLASH
55 /*
56 +------------------------------------------------------------------------+
57 | PROJECT : CCD (6144) MODULE : CCD |
58 | STATE : code ROUTINE : cdc_csn1_s0_opt_decode |
59 +------------------------------------------------------------------------+
60
61 PURPOSE : Decoding of the non-standard type CSN1 S0 element.
62 The encoding rule for this type is very similar to the
63 CSN.1 type. Except for the presence flag which is 0 in
64 this case.
65 The encoded IE consists of one bit for presence flag and
66 a value part. Only if the flag bit is equal 0 the value
67 part will follow it.
68
69 The element value can be present, then it is preceded by the
70 flag value 0. If the element is represented by the flag 1 only
71 the value is absent! Besides the absence of the whole element
72 is allowed.
73 */
74
75 SHORT cdc_csn1_s0_opt_decode (const ULONG c_ref, const ULONG e_ref, T_CCD_Globs *globs)
76 {
77 #ifdef DEBUG_CCD
78 #ifndef CCD_SYMBOLS
79 TRACE_CCD (globs, "cdc_csn1_s0_opt_decode()");
80 #else
81 TRACE_CCD (globs, "cdc_csn1_s0_opt_decode() %s", ccddata_get_alias((USHORT) e_ref, 1));
82 #endif
83 #endif
84
85 return cdc_csn1_sx_decode (0, e_ref, globs);
86 }
87 #endif /* !RUN_FLASH */
88
89 #ifndef RUN_FLASH
90 /*
91 +------------------------------------------------------------------------+
92 | PROJECT : CCD (6144) MODULE : CDC_GSM |
93 | STATE : code ROUTINE : cdc_csn1_s0_opt_encode |
94 +------------------------------------------------------------------------+
95
96 PURPOSE : Encoding of the non-standard type CSN1 S0 element.
97 The encoding rule for this type is very similar to CSN.1
98 type. Except for the presence flag which is 0 in this
99 case. The encoded bit pattern consists of a 0 bit as
100 valid flag and a value part. If the element is present
101 (the v_xxx component is TRUE in the decoded message)
102 a 0 bit will be coded followed by the encoded value part.
103 Otherwise a 1 bit will be encoded.
104 Possible array types are given by melem[e_ref].repType:
105 0) ' ' => {0| IE} (no array)
106 1) 'i' => {0 IE} ** 1 (many repeations up to a 1 bit)
107 2) 'v' => {0|1 IE}* val (val is another IE)
108 3) 'c' => {0|1 IE}* 3 (3 is an example)
109 */
110
111 SHORT cdc_csn1_s0_opt_encode (const ULONG c_ref, const ULONG e_ref, T_CCD_Globs *globs)
112 {
113 #ifdef DEBUG_CCD
114 #ifndef CCD_SYMBOLS
115 TRACE_CCD (globs, "cdc_csn1_s0_opt_encode()");
116 #else
117 TRACE_CCD (globs, "cdc_csn1_s0_opt_encode() %s", ccddata_get_alias((USHORT) e_ref, 1));
118 #endif
119 #endif
120
121 return cdc_csn1_sx_encode (0, e_ref, globs);
122 }
123 #endif /* !RUN_FLASH */