comparison gsm-fw/gpf/inc/Ccdedit.h @ 316:79080922d8e4

GPF: FRAME C sources and include files imported from LoCosto source
author Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
date Thu, 10 Apr 2014 04:06:05 +0000
parents
children
comparison
equal deleted inserted replaced
315:1b4beffc8055 316:79080922d8e4
1 /*
2 +-------------------------------------------------------------------------------
3 | Project :
4 | Modul : Ccdedit.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 : Coder Decoder Edit functions
18 +-------------------------------------------------------------------------------
19 */
20
21 #ifndef __CCDEDIT_H__
22 #define __CCDEDIT_H__
23
24 #ifdef __cplusplus
25 extern "C" {
26 #endif /*_cplusplus*/
27
28 /*
29 * The handle structure for primitives/messages
30 */
31 /*
32 * level of substructured elements in substructures
33 */
34 #define MAX_LEVELS 20
35
36 typedef enum
37 {
38 TRAVERSE_ARRAY,
39 TRAVERSE_STRUCTURE
40 } T_CTX_STATE;
41
42 typedef enum
43 {
44 NoArray,
45 FixArray,
46 VarArray
47 } T_ATYPE;
48
49 typedef enum
50 {
51 FromMsg, FromPrim
52 } T_ELM_SRC;
53
54 typedef struct
55 {
56 USHORT structIdx;
57 USHORT elemIdx;
58 UBYTE elemType;
59 T_CTX_STATE state;
60 USHORT arrayIndex;
61 USHORT repeats; /* valid repeats */
62 USHORT numElems;
63 U32 levelOffset;
64 T_ATYPE arrayType; /* elem is an fix or */
65 /* variable or no array */
66 } T_CCDE_CONTEXT;
67
68 typedef struct
69 {
70 UBYTE level;
71 BOOL canDescent;
72 T_ELM_SRC source;
73 U32 maxCSize;
74 USHORT lenVarPart; /* length of the variable
75 part e.g. a SDU */
76 T_CCDE_CONTEXT context[MAX_LEVELS];
77 } T_CCDE_HANDLE;
78
79 typedef enum
80 {
81 noptr,
82 usptr,
83 ctptr
84 } T_PTRTYPE;
85
86 /*
87 * The type of the C-structure component
88 */
89 typedef enum
90 {
91 T_none,
92 T_byte,
93 T_short,
94 T_long,
95 T_buffer,
96 T_struct,
97 T_union,
98 T_issdu,
99 T_ductrl
100 } T_BTYPE;
101
102 #define NO_REF 0xffff
103
104 #define SHORT_NAME_LENGTH 256
105 #define ALIAS_NAME_LENGTH 256
106 #define LONG_NAME_LENGTH 100
107 #define SYMBOLIC_VAL_LENGTH 150
108
109
110 typedef struct
111 {
112 T_ELM_SRC esource; /* source of element(MSG/PRIM)*/
113 T_BTYPE btype; /* C-type of element */
114 T_ATYPE arrayType; /* elem is an fix or */
115 T_PTRTYPE ptrtype; /* pointer type */
116 BOOL isOptional;
117 BOOL isValid;
118 U32 bytelen; /* length in byte */
119 U32 offset; /* byteoffs in C-Structure*/
120 /* variable or no array */
121 USHORT maxRepeat; /* max repeats if isArray */
122 USHORT validRepeats; /* valid repeats */
123 USHORT index; /* act. idx in array */
124 USHORT ccdIndex;
125 UBYTE level; /* level of descending */
126 BOOL u_member;
127 U32 u_ctrl; /* union tag */
128 USHORT elemref; /* elemref from [pm]elem.cdg */
129 USHORT bitstring; /* it is an ANS1_BITSTRINGS */
130 USHORT issigned; /* it is a signed variable */
131 USHORT c_implicit; /* counter c_xxx is generated */
132 char sname[SHORT_NAME_LENGTH+1];
133 char aname[ALIAS_NAME_LENGTH+1];
134 char lname[LONG_NAME_LENGTH+1];
135 char symbolicValue[SYMBOLIC_VAL_LENGTH+1];
136 int valcheck; /* indicates if value was in range */
137 } T_CCDE_ELEM_DESCR;
138
139 /*
140 * Definitions of returnvalues of the ccd_xxxx functions.
141 */
142
143 #define CCDEDIT_OK 0
144 #define CCDEDIT_PRIM_NOT_FOUND 1
145 #define CCDEDIT_END_OF_PRIM 2
146 #define CCDEDIT_PRIMITIVE_ERROR 3
147 #define CCDEDIT_MESSAGE_NOT_FOUND 1
148 #define CCDEDIT_END_OF_MSG 2
149 #define CCDEDIT_MESSAGE_ERROR 3
150 #define CCDEDIT_COMP_NOT_FOUND 1
151 #define CCDEDIT_END_OF_COMP 2
152 #define CCDEDIT_COMP_ERROR 3
153 #define CCDEDIT_UTAG_ERROR 1
154 #define CCDEDIT_DLL_ERROR 10
155 #define CCDEDIT_ERROR -2
156
157 /* and for the former tdc functions */
158 #define NO_ENTRY_FOUND 0xffffffff
159
160 #if !defined (CCDDATA_PREF)
161 #if defined (_TOOLS_) && defined (CCDDATA_LOAD)
162 #define CCDDATA_PREF(cde_fun) cddl_##cde_fun
163 #else
164 #define CCDDATA_PREF(cde_fun) cde_fun
165 #endif /* _TOOLS_ && CCDDATA_LOAD */
166 #endif /* !CCDDATA_PREF */
167
168 #ifndef CCDEDIT_C
169
170 /*
171 * Initialize the internal data of ccdedit. Must be called before any
172 * of the other functions.
173 */
174 extern void CCDDATA_PREF(cde_init) (void);
175
176 /*
177 * This function works with similar results like cde_comp_first,
178 * but not the whole comp table is searched for the name of the
179 * component. Instead the previous set elemref in the
180 * parameter edescr is taken to directly jump to the component.
181 * The component found is compared with the given name in
182 * edescr. If equal chandle is defined. Otherwise there is an error.
183 */
184 extern USHORT CCDDATA_PREF(cde_get_comp) (T_CCDE_HANDLE* chandle,
185 T_CCDE_ELEM_DESCR* edescr);
186
187 /*
188 * Selects the primitive for edit processing. The code of the
189 * primitive (primcode) must be passed to the function.
190 * The function returns a State and the primname in (*name)
191 * and a handle for this edit process (phandle).
192 * After a successful call the component maxCSize of the
193 * phandle contains the size of the C-Structure for this primitive.
194 */
195 extern USHORT CCDDATA_PREF(cde_prim_first) (T_CCDE_HANDLE * phandle,
196 ULONG primcode,
197 char * name);
198 /*
199 * Get the next element of the selected primitive. All informations
200 * of this element is stored into the element descriptor (pdescr).
201 */
202 extern USHORT CCDDATA_PREF(cde_prim_next) (T_CCDE_HANDLE * phandle,
203 UBYTE descent,
204 T_CCDE_ELEM_DESCR * pdescr);
205
206
207 /*
208 * Selects the message for edit processing. The message type (type),
209 * the (entity) and the (direction) must be passed to this function.
210 * The function returns a State and the messagename in (*name)
211 * and a handle for this edit process (mhandle).
212 * After a successful call the component maxCSize of the
213 * mhandle contains the size of the C-Structure for this message.
214 */
215 extern USHORT CCDDATA_PREF(cde_msg_first) (T_CCDE_HANDLE * mhandle,
216 UBYTE type,
217 UBYTE direction,
218 UBYTE entity,
219 char * name);
220
221
222 /*
223 * Get the next element of the selected primitive. All informations
224 * of this element is stored into the element descriptor (iedescr).
225 */
226 extern USHORT CCDDATA_PREF(cde_msg_next) (T_CCDE_HANDLE * mhandle,
227 UBYTE descent,
228 T_CCDE_ELEM_DESCR * iedescr);
229
230 /*
231 * Selects at COMPOSITION (structure) for edit processing.
232 * The short name (compname) of this composition must be passed
233 * to this function.
234 * The function returns a State and ahandle for this
235 * edit process (chandle).
236 * This function may be used for sub-structures (compositions)
237 * of primitives and messages.
238 * After a successful call the component maxCSize of the
239 * chandle contains the size of the C-Structure for this composition.
240 */
241 extern USHORT CCDDATA_PREF(cde_comp_first) (T_CCDE_HANDLE * chandle,
242 T_ELM_SRC source,
243 char * compname);
244
245 /*
246 * Get the next element of the selected composition. All informations
247 * of this element is stored into the element descriptor (cdescr).
248 */
249 extern USHORT CCDDATA_PREF(cde_comp_next) (T_CCDE_HANDLE * chandle,
250 UBYTE descent,
251 T_CCDE_ELEM_DESCR * descr);
252
253 /*
254 * Add the "Comment" of the SAP-/MSG-catalogues to the member symbolicValue
255 * of a given T_CCDE_ELEM_DESCR.
256 * This functionality was part of cde_read_elem and is now extracted
257 * to a dedicated function.
258 */
259 extern char* CCDDATA_PREF(cde_get_symval) (int elem_value,
260 T_CCDE_ELEM_DESCR* edescr);
261
262 /*
263 * Read the value of the element out of the C-Structure (cstruct)
264 * which containes a primitive or a decoded message. The infomations
265 * of the element is stored in the input parameter edescr, wich is
266 * previously assigned by a cde_xxxx_next () call. The value of this
267 * element is stored in the memory area addressed by (*value).
268 * After this call, the component symbolicValue of the edescr-struct
269 * is updated with a symbolic value string, (if any defined).
270 */
271 extern USHORT CCDDATA_PREF(cde_read_elem) (T_CCDE_HANDLE * handle,
272 void * cstruct,
273 T_CCDE_ELEM_DESCR * edescr,
274 UBYTE * value);
275
276
277 /*
278 * prepares the writing of elements, by setting valid flag,
279 * union controller and length of vaiable arrays if necessary.
280 * First version: union controller only.
281 */
282 extern void CCDDATA_PREF(cde_write_prepare) (T_CCDE_HANDLE * handle,
283 void * cstruct,
284 T_CCDE_ELEM_DESCR * edescr);
285
286 /*
287 * Store the value from the memory area which is addressed by (*value)
288 * into the corrensponding position into the C-Structure (cstruct)
289 * which containes a primitive or a decoded message. The infomations
290 * of the element is stored in the input parameter edescr, wich is
291 * previously assigned by a cde_xxxx_next () call.
292 */
293 extern USHORT CCDDATA_PREF(cde_write_elem) (T_CCDE_HANDLE * handle,
294 void * cstruct,
295 T_CCDE_ELEM_DESCR * edescr,
296 UBYTE * value);
297
298
299 /*
300 * This function requests if the given name is the name of
301 * a primitive or of a message. If the function returns
302 * CCDEDIT_OK the return parameter source is set to FromPrim
303 * or to FromMsg. Otherwise CCDEDIT_PRIM_NOT_FOUND/CCD_EDIT_MESSAGE_NOT_FOUND
304 * is returned.
305 */
306 extern USHORT CCDDATA_PREF(cde_get_type) (char * name,
307 T_ELM_SRC * source);
308
309 /*
310 * This function requests the opcode of a primitive. The
311 * name of the primitive is given by the input paramater name.
312 * If the function returns CCDEDIT_OK the parameter primcode
313 * contains the 16 bit opcode. Otherwise CCDEDIT_PRIM_NOT_FOUND
314 * is returned.
315 */
316 extern USHORT CCDDATA_PREF(cde_get_primcode) (char * name,
317 ULONG * primcode);
318
319
320
321 /*
322 * This function requests the opcode, the direction and the
323 * entity index of a message. The name of the message is given
324 * by the input paramater name.
325 * If the function returns CCDEDIT_OK the return parameters types,
326 * direction and entity contains the right values.
327 * Otherwise CCDEDIT_MESSAGE_NOT_FOUND is returned.
328 */
329 extern USHORT CCDDATA_PREF(cde_get_msgcode) (char * name,
330 UBYTE * type,
331 UBYTE * direction,
332 UBYTE * entity);
333
334 /*
335 * This function finds out if an AIM is a downlink or uplink.
336 */
337 extern int CCDDATA_PREF(cde_get_is_downlink) (ULONG comp_index);
338
339 /*
340 * This function searches the comp index in either pcomp or mcomp
341 */
342 extern ULONG CCDDATA_PREF(cde_get_comp_index) (CHAR* comp_name,
343 T_ELM_SRC table);
344
345 /*
346 * This function gets the element name for a given index + offset.
347 */
348 extern CHAR* CCDDATA_PREF(cde_get_element_name) (ULONG comp_index,
349 USHORT elem_off,
350 T_ELM_SRC table);
351
352 /*
353 * This function gets the array kind - e.g. the cSize of the
354 * arrays (byte, short og long).
355 */
356 extern ULONG CCDDATA_PREF(cde_get_array_kind) (CHAR* var_name, T_ELM_SRC table);
357
358 #endif /* !CCDEDIT_C */
359
360 #ifdef __cplusplus
361 }
362 #endif /*_cplusplus*/
363
364 #endif