comparison src/gpf/ccd/csn1_sh_opt.c @ 5:1ea54a97e831

src/gpf: import of Magnetite src/gpf3
author Mychaela Falconia <falcon@freecalypso.org>
date Sun, 15 Jul 2018 08:11:07 +0000
parents
children
comparison
equal deleted inserted replaced
4:6e457872f745 5:1ea54a97e831
1 /*
2 +-----------------------------------------------------------------------------
3 | Project :
4 | Modul : csn1_sh_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_SH_OPT
18 | elements
19 +-----------------------------------------------------------------------------
20 */
21
22
23 /*
24 * standard definitions like GLOBAL, UCHAR, ERROR etc.
25 */
26 #include "typedefs.h"
27 #include "header.h"
28
29 /*
30 * Prototypes of ccd (USE_DRIVER EQ undef) for prototypes only
31 * look at ccdapi.h
32 */
33 #undef USE_DRIVER
34 #include "ccdapi.h"
35
36 /*
37 * Types and functions for bit access and manipulation
38 */
39 #include "ccd_globs.h"
40 #include "bitfun.h"
41
42 /*
43 * Prototypes of ccd internal functions
44 */
45 #include "ccd.h"
46
47 /*
48 * Declaration of coder/decoder tables
49 */
50 #include "ccdtable.h"
51 #include "ccddata.h"
52
53
54 extern SHORT cdc_csn1_sx_decode (int flag, const ULONG e_ref, T_CCD_Globs *globs);
55 extern SHORT cdc_csn1_sx_encode (int flag, const ULONG e_ref, T_CCD_Globs *globs);
56
57 #ifndef RUN_FLASH
58 /*
59 +------------------------------------------------------------------------+
60 | PROJECT : CCD (6144) MODULE : CDC_GSM |
61 | STATE : code ROUTINE : cdc_csn1_shl_opt_decode |
62 +------------------------------------------------------------------------+
63
64 PURPOSE : Decoding of the GSM Type CSN1 SHL OPT element.
65 This coding type enhances the GSM Type CSN1 SHL. It supports
66 previous behaviour of CSN1_SHL and the lack of the whole
67 element.
68 The coding type CSN1_SHL_OPT is suitable for elements which
69 structures match to the following common definition:
70 { null | L | H { 0 | 1 < value part > }
71
72 The element value can be present, then it is preceded by the
73 flag value H. If the element is represented by the flag L only
74 the value is absent! Besides the absence of the whole element
75 is allowed.
76 */
77
78 SHORT cdc_csn1_shl_opt_decode (const ULONG c_ref, const ULONG e_ref, T_CCD_Globs *globs)
79 {
80
81 #ifdef DEBUG_CCD
82 #ifndef CCD_SYMBOLS
83 TRACE_CCD (globs, "cdc_csn1_shl_opt_decode()");
84 #else
85 TRACE_CCD (globs, "cdc_csn1_shl_opt_decode() %s", ccddata_get_alias((USHORT) e_ref, 1));
86 #endif
87 #endif
88
89 return cdc_csn1_sx_decode (0xFF, e_ref, globs);
90 }
91 #endif /* !RUN_FLASH */
92
93 #ifndef RUN_FLASH
94 /*
95 +------------------------------------------------------------------------+
96 | PROJECT : CCD (6144) MODULE : CDC_GSM |
97 | STATE : code ROUTINE : cdc_csn1_shl_opt_encode |
98 +------------------------------------------------------------------------+
99
100 PURPOSE : Encoding of the GSM Type CSN1 SHL OPT element doesn't differ
101 from encoding of the GSM Type CSN1 SHL.
102 This element consists of a 1 bit valid flag and a value part.
103 If the element is valid (the v_xxx components is TRUE in the
104 decoded message) a H bit will be coded followed by the
105 coding of the value part. Otherwise a L bit will be
106 coded.
107
108 */
109
110 SHORT cdc_csn1_shl_opt_encode (const ULONG c_ref, const ULONG e_ref, T_CCD_Globs *globs)
111 {
112 #ifdef DEBUG_CCD
113 #ifndef CCD_SYMBOLS
114 TRACE_CCD (globs, "cdc_csn1_shl_opt_encode()");
115 #else
116 TRACE_CCD (globs, "cdc_csn1_shl_opt_encode() %s", ccddata_get_alias((USHORT) e_ref, 1));
117 #endif
118 #endif
119
120 return cdc_csn1_sx_encode (0xFF, e_ref, globs);
121 }
122 #endif /* !RUN_FLASH */