FreeCalypso > hg > freecalypso-sw
comparison gsm-fw/ccd/csn1_s0.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 : CCD | |
4 | Modul : csn1_s0.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_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 | |
70 SHORT cdc_csn1_s0_decode (const ULONG c_ref, const ULONG e_ref, T_CCD_Globs *globs) | |
71 { | |
72 #ifdef DEBUG_CCD | |
73 #ifndef CCD_SYMBOLS | |
74 TRACE_CCD (globs, "cdc_csn1_s0_decode()"); | |
75 #else | |
76 TRACE_CCD (globs, "cdc_csn1_s0_decode() %s", ccddata_get_alias((USHORT) e_ref, 1)); | |
77 #endif | |
78 #endif | |
79 | |
80 return cdc_csn1_sx_decode (0, e_ref, globs); | |
81 } | |
82 #endif /* !RUN_FLASH */ | |
83 | |
84 #ifndef RUN_FLASH | |
85 /* | |
86 +--------------------------------------------------------------------+ | |
87 | PROJECT : CCD (6144) MODULE : CDC_GSM | | |
88 | STATE : code ROUTINE : cdc_csn1_s0_encode | | |
89 +--------------------------------------------------------------------+ | |
90 | |
91 PURPOSE : Encoding of the non-standard type CSN1 S0 element. | |
92 The encoding rule for this type is very similar to CSN.1 | |
93 type. Except for the presence flag which is 0 in this | |
94 case. The encoded bit pattern consists of a 0 bit as | |
95 valid flag and a value part. If the element is present | |
96 (the v_xxx component is TRUE in the decoded message) | |
97 a 0 bit will be coded followed by the encoded value part. | |
98 Otherwise a 1 bit will be encoded. | |
99 Possible array types are given by melem[e_ref].repType: | |
100 0) ' ' => {0| IE} (no array) | |
101 1) 'i' => {0 IE} ** 1 (many repeations up to a 1 bit) | |
102 2) 'v' => {0|1 IE}* val (val is another IE) | |
103 3) 'c' => {0|1 IE}* 3 (3 is an example) | |
104 */ | |
105 | |
106 SHORT cdc_csn1_s0_encode (const ULONG c_ref, const ULONG e_ref, T_CCD_Globs *globs) | |
107 { | |
108 #ifdef DEBUG_CCD | |
109 #ifndef CCD_SYMBOLS | |
110 TRACE_CCD (globs, "cdc_csn1_s0_encode()"); | |
111 #else | |
112 TRACE_CCD (globs, "cdc_csn1_s0_encode() %s", ccddata_get_alias((USHORT) e_ref, 1)); | |
113 #endif | |
114 #endif | |
115 | |
116 return cdc_csn1_sx_encode (0, e_ref, globs); | |
117 } | |
118 #endif /* !RUN_FLASH */ |