comparison gsm-fw/ccd/no_code.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 : no_code.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 NO_CODE 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 #ifndef RUN_INT_RAM
52 /*
53 +--------------------------------------------------------------------+
54 | PROJECT : CCD (6144) MODULE : CDC_GSM |
55 | STATE : code ROUTINE : cdc_no_decode |
56 +--------------------------------------------------------------------+
57
58 PURPOSE : Either reading a value from the stack and writing it into
59 the C structure or processing the error branch in case of
60 a message escape error label.
61 An IE of this type does not occur in the air message.
62
63 EXAMPLE (reading stack value):
64 The first usage of this type is the IE "tlv_len" in a
65 Multi Rate Configuration. In this case "tlv_len" is to be
66 used for evaluating conditions which decide for the content
67 of Multi Rate Configuration IE.
68
69 EXMAPLE (message escape):
70 A part of a message, which depends on a certain protocol
71 status, is marked by the 'Message escape' error label. It
72 is preceeded by an amount of bits given by the specification.
73 Some of these bit combinations are concatenated with a
74 well-defined message structure. All the rest of combinations
75 are expected to provide an escape
76 -> use coding type 'NO_CODE'.
77 */
78
79 SHORT cdc_no_decode (const ULONG c_ref, const ULONG e_ref, T_CCD_Globs *globs)
80 {
81 U16 cixRef = melem[e_ref].calcIdxRef;
82
83 #ifdef DEBUG_CCD
84 #ifndef CCD_SYMBOLS
85 TRACE_CCD (globs, "cdc_no_decode()");
86 #endif
87 #endif
88
89 /*
90 * if this element is conditional, check the condition
91 */
92 if (calcidx[cixRef].numCondCalcs != 0
93 AND ! ccd_conditionOK (e_ref, globs))
94 return 1;
95
96 if (calcidx[cixRef].numPrologSteps)
97 {
98 switch (calc[calcidx[cixRef].prologStepRef].operation)
99 {
100 case 'Z': /* address information part error */
101 globs->errLabel = ERR_ADDR_INFO_PART;
102 break;
103
104 case 'D': /* distribution part error */
105 globs->errLabel = ERR_DISTRIB_PART;
106 break;
107
108 case 'N': /* non distribution part error */
109 globs->errLabel = ERR_NON_DISTRIB_PART;
110 break;
111
112 case 'M': /* message escape */
113 globs->errLabel = ERR_MESSAGE_ESCAPE;
114 break;
115
116 default:
117 break;
118 }
119 }
120
121 if (globs->errLabel)
122 {
123 #ifdef DEBUG_CCD
124 #ifdef CCD_SYMBOLS
125 TRACE_CCD (globs, "cdc_no_decode() %s", ccddata_get_alias((USHORT) e_ref, 1));
126 #endif
127 #endif
128 ccd_setError (globs, globs->errLabel, BREAK, globs->bitpos, (USHORT) -1);
129 }
130
131 else
132 {
133 #ifdef DEBUG_CCD
134 #ifdef CCD_SYMBOLS
135 if (calcidx[cixRef].numPrologSteps == 0)
136 TRACE_CCD (globs, "writing 2 bytes (%ld) to struct", globs->KeepReg[0]);
137 else
138 TRACE_CCD (globs, "cdc_no_decode() %s", ccddata_get_alias((USHORT) e_ref, 1));
139
140 #endif
141 #endif
142
143 globs->pstructOffs = melem[e_ref].structOffs;
144 *(U16*) (globs->pstruct + globs->pstructOffs) = (U16) globs->KeepReg[0];
145 }
146
147 return 1;
148 }
149 #endif /* !RUN_INT_RAM */
150
151 #ifndef RUN_INT_RAM
152 /*
153 +--------------------------------------------------------------------+
154 | PROJECT : CCD (6144) MODULE : CDC_GSM |
155 | STATE : code ROUTINE : cdc_no_encode |
156 +--------------------------------------------------------------------+
157
158 PURPOSE : An IE of this type does not occure in the air message.
159 Nevertheless the variable in the C structure must be
160 written by the caller entity.
161 EXAMPLE:
162 The first usage of this type is the IE "tlv_len" in a
163 Multi Rate Configuration. In this case "tlv_len" is to be used
164 for evaluating conditions which decide for the content of
165 Multi Rate Configuration IE.
166
167 */
168
169 SHORT cdc_no_encode (const ULONG c_ref, const ULONG e_ref, T_CCD_Globs *globs)
170 {
171 #ifdef DEBUG_CCD
172 #ifndef CCD_SYMBOLS
173 TRACE_CCD (globs, "cdc_no_encode()");
174 #else
175 TRACE_CCD (globs, "cdc_no_encode() %s", ccddata_get_alias((USHORT) e_ref, 1));
176 #endif
177 #endif
178 return 1;
179 }
180 #endif /* !RUN_INT_RAM */