comparison src/g23m-gsm/sim/sim_em.h @ 1:d393cd9bb723

src/g23m-*: initial import from Magnetite
author Mychaela Falconia <falcon@freecalypso.org>
date Sun, 15 Jul 2018 04:40:46 +0000
parents
children
comparison
equal deleted inserted replaced
0:b6a5e36de839 1:d393cd9bb723
1 /*
2 +-----------------------------------------------------------------------------
3 | Project :
4 | Modul :
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 : Engineering Mode (EM) Declarations + Macros
18 |
19 +-----------------------------------------------------------------------------
20 */
21 #ifndef SIM_EM_H
22 #define SIM_EM_H
23
24 #ifdef FF_EM_MODE
25
26 /* ------------ data declarations for EM ---------------- */
27 /*
28 * Ring buffer is by one bigger than max. number of prims, because it
29 * needs always one termination entry.
30 * To optimize the buffersize, the data is packed in the buffer as follows:
31 * type, length, value
32 * Value is the combination of the additional parameters as defined in 8443.601, coded as UBYTE.
33 */
34 #define EM_SIM_BUFFER_SIZE 67
35
36 /*
37 * EM_MAX_SIM_EVENTS defines maximum number of event traces for the engineering mode.
38 * The number is increased by one to ensure that the event numbers defined in the
39 * corresponding document are the same as in the sources.
40 */
41 #define EM_MAX_SIM_EVENTS 26
42
43 /*
44 * The offset is used to indicate the source entity the event trace is from.
45 * L1/ALR = 0x00, DL = 0x2D, RR = 0x37, MM = 0x5F, CC = 0x78, SS = 0xAF, SMS = 0xBE, SIM = E1
46 */
47 #define SIM_OFFSET 0xE1
48
49 /*
50 * Type is combination of entity index(upper nibble) plus event number(lower nibble).
51 * Bit 8 7 6 5 4 3 2 1
52 * | entity | event number |
53 */
54
55 #define SIM_V_1 (1 + SIM_OFFSET)
56 #define SIM_V_2 (2 + SIM_OFFSET)
57 #define SIM_V_3 (3 + SIM_OFFSET)
58 #define SIM_V_4 (4 + SIM_OFFSET)
59 #define SIM_V_5 (5 + SIM_OFFSET)
60 #define SIM_V_6 (6 + SIM_OFFSET)
61 #define SIM_V_7 (7 + SIM_OFFSET)
62 #define SIM_V_8 (8 + SIM_OFFSET)
63 #define SIM_V_9 (9 + SIM_OFFSET)
64 #define SIM_V_10 (10+ SIM_OFFSET)
65 #define SIM_V_11 (11+ SIM_OFFSET)
66 #define SIM_V_12 (12+ SIM_OFFSET)
67 #define SIM_V_13 (13+ SIM_OFFSET)
68 #define SIM_V_14 (14+ SIM_OFFSET)
69 #define SIM_V_15 (15+ SIM_OFFSET)
70 #define SIM_V_16 (16+ SIM_OFFSET)
71 #define SIM_V_17 (17+ SIM_OFFSET)
72 #define SIM_V_18 (18+ SIM_OFFSET)
73 #define SIM_V_19 (19+ SIM_OFFSET)
74 #define SIM_V_20 (20+ SIM_OFFSET)
75 #define SIM_V_21 (21+ SIM_OFFSET)
76 #define SIM_V_22 (22+ SIM_OFFSET)
77 #define SIM_V_23 (23+ SIM_OFFSET)
78 #define SIM_V_24 (24+ SIM_OFFSET)
79 #define SIM_V_25 (25+ SIM_OFFSET)
80
81
82 /* Event tracing flags for EM */
83 EXTERN BOOL sim_v[EM_MAX_SIM_EVENTS];
84
85 /*---------Functions ---------*/
86
87 /*
88 * SIM primitives Engineering Mode
89 * Bitmask for the event tracing
90 */
91
92 EXTERN void sim_em_sim_event_req (T_EM_SIM_EVENT_REQ *em_sim_event_req);
93 EXTERN void em_init_sim_event_trace (void);
94
95 /*
96 * If all entities are linked into one module this definitions
97 * prefixes all this functions with the enity name
98 */
99 #ifdef OPTION_MULTITHREAD
100 #define em_write_buffer_2 _ENTITY_PREFIXED(em_write_buffer_2)
101 #define em_write_buffer_3 _ENTITY_PREFIXED(em_write_buffer_3)
102 #define em_write_buffer_3a _ENTITY_PREFIXED(em_write_buffer_3a)
103 #define check_write_index _ENTITY_PREFIXED(check_write_index)
104 #endif
105
106 EXTERN UBYTE em_write_buffer_2 (UBYTE event_no);
107 EXTERN UBYTE em_write_buffer_3 (UBYTE event_no, UBYTE value);
108 EXTERN UBYTE em_write_buffer_3a (UBYTE event_no, USHORT value);
109 static UBYTE check_write_index (UBYTE n);
110
111 /*-----------------------Event Macro Definition -----------*/
112
113 #define SIM_EM_READ_BINARY_FILE\
114 /* Read binary file */\
115 if (sim_v[1])\
116 {\
117 sim_v[1] = em_write_buffer_3a (SIM_V_1, sim_read_req->datafield);\
118 } /* sim_v[1] */
119
120 #define SIM_EM_READ_RECORD_FILE\
121 /* Read record file */\
122 if (sim_v[2])\
123 {\
124 sim_v[2] = em_write_buffer_3a (SIM_V_2, sim_read_record_req->datafield);\
125 } /* sim_v[2] */
126
127 #define SIM_EM_UPDATE_BINARY_FILE\
128 /* Update binary file */\
129 if (sim_v[3])\
130 {\
131 sim_v[3] = em_write_buffer_3a (SIM_V_3, sim_update_req->datafield);\
132 } /* sim_v[3] */
133
134 #define SIM_EM_UPDATE_RECORD\
135 /* Update record */\
136 if (sim_v[4])\
137 {\
138 sim_v[4] = em_write_buffer_3a (SIM_V_4, sim_update_record_req->datafield);\
139 } /* sim_v[4] */
140
141 #define SIM_EM_INCREMENT_FILE\
142 /* Increment file */\
143 if (sim_v[5])\
144 {\
145 sim_v[5] = em_write_buffer_3a (SIM_V_5, sim_increment_req->datafield);\
146 } /* sim_v[5] */
147
148 #define SIM_EM_VERIFY_PIN\
149 /* Verify PIN */\
150 if (sim_v[6])\
151 {\
152 sim_v[6] = em_write_buffer_3 (SIM_V_6, sim_verify_pin_req->pin_id);\
153 } /* sim_v[6] */
154
155 #define SIM_EM_CHANGE_PIN\
156 /* Change PIN */\
157 if (sim_v[7])\
158 {\
159 sim_v[7] = em_write_buffer_3 (SIM_V_7, sim_change_pin_req->pin_id);\
160 } /* sim_v[7] */
161
162 #define SIM_EM_DISABLE_PIN\
163 /* Disable PIN */\
164 if (sim_v[8])\
165 {\
166 sim_v[8] = em_write_buffer_3 (SIM_V_8, NOT_PRESENT_8BIT);\
167 } /* sim_v[8] */
168
169 #define SIM_EM_ENABLE_PIN\
170 /* Enable PIN */\
171 if (sim_v[9])\
172 {\
173 sim_v[9] = em_write_buffer_3 (SIM_V_9, NOT_PRESENT_8BIT);\
174 } /* sim_v[9] */
175
176 #define SIM_EM_UNBLOCK_PIN\
177 /* Unblock PIN */\
178 if (sim_v[10])\
179 {\
180 sim_v[10] = em_write_buffer_3 (SIM_V_10, sim_unblock_req->pin_id);\
181 } /* sim_v[10] */
182
183 #define SIM_EM_AUTHENTICATION\
184 /* Authentication */\
185 if (sim_v[11])\
186 {\
187 sim_v[11] = em_write_buffer_2 (SIM_V_11);\
188 } /* sim_v[11] */
189
190 #define SIM_EM_SIM_ACTIVATION_STARTED\
191 /* SIM activation started */\
192 if (sim_v[12])\
193 {\
194 sim_v[12] = em_write_buffer_2 (SIM_V_12);\
195 } /* sim_v[12] */
196
197 #define SIM_EM_SIM_ACTIVATION_RESULT\
198 /* SIM activation result */\
199 if (sim_v[13])\
200 {\
201 sim_v[13] = em_write_buffer_3a (SIM_V_13, sim_activate_cnf->cause);\
202 } /* sim_v[13] */
203
204 #define SIM_EM_READ_MMI_PARAMETER\
205 /* Read MMI parameters */\
206 if (sim_v[14])\
207 {\
208 sim_v[14] = em_write_buffer_2 (SIM_V_14);\
209 } /* sim_v[14] */
210
211 #define SIM_EM_READ_MM_PARAMETER\
212 /* Read MM parameters */\
213 if (sim_v[15])\
214 {\
215 sim_v[15] = em_write_buffer_2 (SIM_V_15);\
216 } /* sim_v[15] */
217
218 #define SIM_EM_READ_SMS_PARAMETER\
219 /* Read SMS parameters */\
220 if (sim_v[16])\
221 {\
222 sim_v[16] = em_write_buffer_2 (SIM_V_16);\
223 } /* sim_v[16] */
224
225 #define SIM_EM_SIM_REMOVE\
226 /* SIM removing */\
227 if (sim_v[17])\
228 {\
229 sim_v[17] = em_write_buffer_2 (SIM_V_17);\
230 } /* sim_v[17] */
231
232 #define SIM_EM_PARAMETER_UPDATE\
233 /* Parameter update */\
234 if (sim_v[18])\
235 {\
236 sim_v[18] = em_write_buffer_2 (SIM_V_18);\
237 } /* sim_v[18] */
238
239 #define SIM_EM_PARAMETER_SYNCHRONISATION\
240 /* Parameter synchronisation */\
241 if (sim_v[19])\
242 {\
243 sim_v[19] = em_write_buffer_2 (SIM_V_19);\
244 } /* sim_v[19] */
245
246 #define SIM_EM_FDN_ENABLE\
247 /* FDN enable */\
248 if (sim_v[20])\
249 {\
250 sim_v[20] = em_write_buffer_2 (SIM_V_20);\
251 } /* sim_v[20] */
252
253 #define SIM_EM_ADN_ENABLE\
254 /* ADN enable */\
255 if (sim_v[21])\
256 {\
257 sim_v[21] = em_write_buffer_2 (SIM_V_21);\
258 } /* sim_v[21] */
259
260 #define SIM_EM_SIM_TOOLKIT_ACTIVATION\
261 /* SIM Toolkit activation */\
262 if (sim_v[22])\
263 {\
264 sim_v[22] = em_write_buffer_2 (SIM_V_22);\
265 } /* sim_v[22] */
266
267 #define SIM_EM_PROACTIVE_COMMAND\
268 /* Proactive cmd */\
269 if (sim_v[23])\
270 {\
271 sim_v[23] = em_write_buffer_3 (SIM_V_23, cmd_type);\
272 } /* sim_v[23] */
273
274 #define SIM_EM_TERMINAL_RESPONSE\
275 /* Terminal Response */\
276 if (sim_v[24])\
277 {\
278 sim_v[24] = em_write_buffer_3a (SIM_V_24, sw1sw2);\
279 } /* sim_v[24] */
280
281 #define SIM_EM_ENVELOPE\
282 /* Envelope */\
283 if (sim_v[24])\
284 {\
285 sim_v[24] = em_write_buffer_3a (SIM_V_24, sw1sw2);\
286 } /* sim_v[24] */
287
288 #else /*FF_EM_MODE not defined*/
289
290 #define SIM_EM_READ_BINARY_FILE /*Event 1*/
291 #define SIM_EM_READ_RECORD_FILE /*Event 2*/
292 #define SIM_EM_UPDATE_BINARY_FILE /*Event 3*/
293 #define SIM_EM_UPDATE_RECORD /*Event 4*/
294 #define SIM_EM_INCREMENT_FILE /*Event 5*/
295 #define SIM_EM_VERIFY_PIN /*Event 6*/
296 #define SIM_EM_CHANGE_PIN /*Event 7*/
297 #define SIM_EM_DISABLE_PIN /*Event 8*/
298 #define SIM_EM_ENABLE_PIN /*Event 9*/
299 #define SIM_EM_UNBLOCK_PIN /*Event 10*/
300 #define SIM_EM_AUTHENTICATION /*Event 11*/
301 #define SIM_EM_SIM_ACTIVATION_STARTED /*Event 12*/
302 #define SIM_EM_SIM_ACTIVATION_RESULT /*Event 13*/
303 #define SIM_EM_READ_MMI_PARAMETER /*Event 14*/
304 #define SIM_EM_READ_MM_PARAMETER /*Event 15*/
305 #define SIM_EM_READ_SMS_PARAMETER /*Event 16*/
306 #define SIM_EM_SIM_REMOVE /*Event 17*/
307 #define SIM_EM_PARAMETER_UPDATE /*Event 18*/
308 #define SIM_EM_PARAMETER_SYNCHRONISATION /*Event 19*/
309 #define SIM_EM_FDN_ENABLE /*Event 20*/
310 #define SIM_EM_ADN_ENABLE /*Event 21*/
311 #define SIM_EM_SIM_TOOLKIT_ACTIVATION /*Event 22*/
312 #define SIM_EM_PROACTIVE_COMMAND /*Event 23*/
313 #define SIM_EM_TERMINAL_RESPONSE /*Event 24*/
314 #define SIM_EM_ENVELOPE /*Event 25*/
315
316 #endif /*FF_EM_MODE*/
317 #endif /* SIM_EM_H */