comparison src/g23m-gsm/sms/sms_em.h @ 104:27a4235405c6

src/g23m-gsm: import from LoCosto source
author Mychaela Falconia <falcon@freecalypso.org>
date Tue, 04 Oct 2016 18:24:05 +0000
parents
children
comparison
equal deleted inserted replaced
103:76d139c7a25e 104:27a4235405c6
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 SMS_EM_H
22 #define SMS_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_SMS_BUFFER_SIZE 110
35
36 /*
37 * EM_MAX_SMS_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_SMS_EVENTS 34
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 SMS_OFFSET 0xBE
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 #define SMS_V_1 (1 + SMS_OFFSET)
55 #define SMS_V_2 (2 + SMS_OFFSET)
56 #define SMS_V_3 (3 + SMS_OFFSET)
57 #define SMS_V_4 (4 + SMS_OFFSET)
58 #define SMS_V_5 (5 + SMS_OFFSET)
59 #define SMS_V_6 (6 + SMS_OFFSET)
60 #define SMS_V_7 (7 + SMS_OFFSET)
61 #define SMS_V_8 (8 + SMS_OFFSET)
62 #define SMS_V_9 (9 + SMS_OFFSET)
63 #define SMS_V_10 (10+ SMS_OFFSET)
64 #define SMS_V_11 (11+ SMS_OFFSET)
65 #define SMS_V_12 (12+ SMS_OFFSET)
66 #define SMS_V_13 (13+ SMS_OFFSET)
67 #define SMS_V_14 (14+ SMS_OFFSET)
68 #define SMS_V_15 (15+ SMS_OFFSET)
69 #define SMS_V_16 (16+ SMS_OFFSET)
70 #define SMS_V_17 (17+ SMS_OFFSET)
71 #define SMS_V_18 (18+ SMS_OFFSET)
72 #define SMS_V_19 (19+ SMS_OFFSET)
73 #define SMS_V_20 (20+ SMS_OFFSET)
74 #define SMS_V_21 (21+ SMS_OFFSET)
75 #define SMS_V_22 (22+ SMS_OFFSET)
76 #define SMS_V_23 (23+ SMS_OFFSET)
77 #define SMS_V_24 (24+ SMS_OFFSET)
78 #define SMS_V_25 (25+ SMS_OFFSET)
79 #define SMS_V_26 (26+ SMS_OFFSET)
80 #define SMS_V_27 (27+ SMS_OFFSET)
81 #define SMS_V_28 (28+ SMS_OFFSET)
82 #define SMS_V_29 (29+ SMS_OFFSET)
83 #define SMS_V_30 (30+ SMS_OFFSET)
84 #define SMS_V_31 (31+ SMS_OFFSET)
85 #define SMS_V_32 (32+ SMS_OFFSET)
86 #define SMS_V_33 (33+ SMS_OFFSET)
87
88 EXTERN BOOL sms_v[EM_MAX_SMS_EVENTS];
89 EXTERN UBYTE em_change_flag;
90 EXTERN UBYTE em_sms_event_buffer[EM_SMS_BUFFER_SIZE];
91 EXTERN UBYTE em_sms_buffer_write;
92
93 /*-------------------Functions------------*/
94
95 EXTERN void sms_em_sms_event_req (T_EM_SMS_EVENT_REQ *em_sms_event_req);
96
97 /*
98 * If all entities are linked into one module this definitions
99 * prefixes all this functions with the enity name
100 */
101 #ifdef OPTION_MULTITHREAD
102 #define em_write_buffer_2 _ENTITY_PREFIXED(em_write_buffer_2)
103 #define em_write_buffer_3 _ENTITY_PREFIXED(em_write_buffer_3)
104 #define em_write_buffer_3a _ENTITY_PREFIXED(em_write_buffer_3a)
105 #define em_write_buffer_4 _ENTITY_PREFIXED(em_write_buffer_4)
106 #define em_write_buffer_4a _ENTITY_PREFIXED(em_write_buffer_4a)
107 #define em_write_buffer_5 _ENTITY_PREFIXED(em_write_buffer_5)
108 #define em_write_buffer_6 _ENTITY_PREFIXED(em_write_buffer_6)
109 #define check_write_index _ENTITY_PREFIXED(check_write_index)
110 #endif
111
112 EXTERN UBYTE em_write_buffer_2 (UBYTE event_no);
113 EXTERN UBYTE em_write_buffer_3 (UBYTE event_no, UBYTE value);
114 EXTERN UBYTE em_write_buffer_3a (UBYTE event_no, USHORT value);
115 EXTERN UBYTE em_write_buffer_4 (UBYTE event_no, UBYTE value1, UBYTE value2);
116 EXTERN UBYTE em_write_buffer_4a (UBYTE event_no, UBYTE value, USHORT cs);
117 EXTERN UBYTE em_write_buffer_5 (UBYTE event_no, UBYTE value1, UBYTE value2, UBYTE value3);
118 EXTERN UBYTE em_write_buffer_6 (UBYTE event_no, UBYTE value, UBYTE value1, UBYTE value2, UBYTE value3);
119
120 EXTERN void em_init_sms_event_trace(void);
121
122
123 /*------------------- Macros --------------*/
124 #define SMS_EM_SET_CHANGE_FLAG_1\
125 em_change_flag = 1;
126
127 #define SMS_EM_SET_CHANGE_FLAG_2\
128 em_change_flag = 2;
129
130 #define SMS_EM_MO_SHORT_MESSAGE\
131 /* MO short message **/\
132 if (sms_v[1])\
133 {\
134 sms_v[1] = em_write_buffer_3 (SMS_V_1, SMS_TP_REF(sms_data));\
135 } /* sms_v[1] */
136
137 #define SMS_EM_SEND_RP_DATA\
138 /* SEND RP-Data*/\
139 if (sms_v[2])\
140 {\
141 sms_v[2] = em_write_buffer_3 (SMS_V_2, msg_ref);\
142 } /* sms_v[2] */
143
144
145 #define SMS_EM_MM_CONNECTION_ESTABLISHMENT\
146 /* MM connection establishment */\
147 if (sms_v[3])\
148 {\
149 sms_v[3] = em_write_buffer_3 (SMS_V_3, SMS_INST.ti);\
150 } /* sms_v[3] */
151
152 #define SMS_EM_MM_CONNECTION_ESTABLISHED\
153 /* MM connection established */\
154 if (sms_v[4])\
155 {\
156 sms_v[4] = em_write_buffer_3 (SMS_V_4, establish_cnf->ti);\
157 } /* sms_v[4] */
158
159 #define SMS_EM_SEND_CP_DATA\
160 /* Send CP-Data */\
161 if (sms_v[5])\
162 {\
163 sms_v[5] = em_write_buffer_2 (SMS_V_5);\
164 } /* sms_v[5] */
165
166 #define SMS_EM_MM_CONNECTION_FAILED\
167 /* MM connection failed */\
168 if (sms_v[6])\
169 {\
170 sms_v[6] = em_write_buffer_3a(SMS_V_6, release_ind->cause);\
171 } /* sms_v[6] */
172
173 #define SMS_EM_TIMEOUT_TR1M\
174 /* Timeout TR1M */\
175 if (sms_v[7])\
176 {\
177 sms_v[7] = em_write_buffer_2 (SMS_V_7);\
178 } /* sms_v[7] */
179
180 #define SMS_EM_RECEIVE_CP_ACKNOWLEDGE\
181 /* Receive CP-ACK */\
182 if (sms_v[8])\
183 {\
184 sms_v[8] = em_write_buffer_3 (SMS_V_8, ti);\
185 } /* sms_v[8] */
186
187 #define SMS_EM_RECEIVE_CP_DATA\
188 /* Receive CP-Data */\
189 if (sms_v[9])\
190 {\
191 sms_v[9] = em_write_buffer_3 (SMS_V_9, ti);\
192 } /* sms_v[9] */
193
194 #define SMS_EM_RECEIVE_UNKNOWN\
195 /* Receive unknown */\
196 if (sms_v[10])\
197 {\
198 sms_v[10] = em_write_buffer_4 (SMS_V_10, ti, _decodedMsg[0]);\
199 } /* sms_v[10] */
200
201 #define SMS_EM_SEND_CP_ERROR\
202 /* Send CP-Error */\
203 if (sms_v[11])\
204 {\
205 sms_v[11] = em_write_buffer_2 (SMS_V_11);\
206 } /* sms_v[11] */
207
208 #define SMS_EM_RECEIVE_CP_ERROR\
209 /* Receive CP-Error */\
210 if (sms_v[12])\
211 {\
212 sms_v[12] = em_write_buffer_2 (SMS_V_12);\
213 } /* sms_v[12] */
214
215 #define SMS_EM_LOSS_OF_MM_CONNECTION\
216 /* Loss of MM connection */\
217 if (sms_v[13])\
218 {\
219 sms_v[13] = em_write_buffer_2 (SMS_V_13);\
220 } /* sms_v[13] */
221
222 #define SMS_EM_ABORT_OF_MM_CONNECTION\
223 /* Abort of MM-Connection */\
224 if (sms_v[14])\
225 {\
226 sms_v[14] = em_write_buffer_2 (SMS_V_14);\
227 } /* sms_v[14] */
228
229 #define SMS_EM_TIMEOUT_TC1M\
230 /* Timeout TC1M */\
231 if (sms_v[15])\
232 {\
233 sms_v[15] = em_write_buffer_2 (SMS_V_15);\
234 } /* sms_v[15] */
235
236 #define SMS_EM_TIMEOUT_TR2M\
237 /* Timeout TR2M */\
238 if (sms_v[16])\
239 {\
240 sms_v[16] = em_write_buffer_2 (SMS_V_16);\
241 } /* sms_v[16] */
242
243 #define SMS_EM_SEND_CP_ACKNOWLEDGE\
244 /* Send CP ACK */\
245 if (sms_v[17])\
246 {\
247 sms_v[17] = em_write_buffer_2 (SMS_V_17);\
248 } /* sms_v[17] */
249
250 #define SMS_EM_RECEIVE_RP_ERROR\
251 /* Receive RP-Error */\
252 if (sms_v[18])\
253 {\
254 sms_v[18] = em_write_buffer_4 (SMS_V_18, cp_user_data_dl->reference,\
255 cp_user_data_dl->rp_error.rp_cause.rp_cause_value);\
256 } /* sms_v[18] */
257
258 #define SMS_EM_RECEIVE_RP_AKNOWLEDGE\
259 /* RECEIVE RP-Akn */\
260 if (sms_v[19])\
261 {\
262 sms_v[19] = em_write_buffer_3 (SMS_V_19, cp_user_data_dl->reference);\
263 } /* sms_v[19] */
264
265 #define SMS_EM_RECEIVE_RP_DATA\
266 /* Receive RP-DATA */\
267 if (sms_v[20])\
268 {\
269 sms_v[20] = em_write_buffer_3 (SMS_V_20, cp_user_data_dl->reference);\
270 } /* sms_v[20] */
271
272 #define SMS_EM_RECEIVE_UNKNOWN_2\
273 /* Receive Unknown */\
274 if (sms_v[21])\
275 {\
276 sms_v[21] = em_write_buffer_4 (SMS_V_21, cp_user_data_dl->reference,\
277 cp_user_data_dl->rp_mti);\
278 } /* sms_v[21] */
279
280 #define SMS_EM_SEND_RP_ERROR\
281 /* Send RP-Error */\
282 if (sms_v[22])\
283 {\
284 sms_v[22] = em_write_buffer_4 (SMS_V_22, SMS_RP_REF(sms_data),\
285 SMS_RP_CS_MSG_NOT_COMP);\
286 } /* sms_v[22] */
287
288 #define SMS_EM_MO_SHORT_MESSAGE_COMMAND\
289 /* MO short message */\
290 if (sms_v[23])\
291 {\
292 sms_v[23] = em_write_buffer_4 (SMS_V_23, SMS_TP_REF(sms_data),\
293 sim_pdu->tpdu.b_tpdu[4]); /* TP-MN */\
294 } /* sms_v[23] */
295
296 #define SMS_EM_DISPLAY_MT_SHORT_MESSAGE\
297 /* Display MT short message */\
298 if (sms_v[24])\
299 {\
300 sms_v[24] = em_write_buffer_4 (SMS_V_24, sms_deliver->tp_pid,\
301 sms_deliver->tp_dcs);\
302 } /* sms_v[24] */
303
304 #define SMS_EM_STORE_MT_MESSAGE\
305 if (record NEQ SMS_RECORD_NOT_EXIST)\
306 {\
307 /* Store MT message in ME/SIM */\
308 if (sms_v[25])\
309 {\
310 sms_v[25] = em_write_buffer_4 (SMS_V_25, mem_type, record);\
311 } /* sms_v[25] */\
312 }
313
314 #define SMS_EM_REPLACE_SMS_IN_ME\
315 /* Replace SMS in ME */\
316 if (sms_v[26])\
317 {\
318 sms_v[26] = em_write_buffer_6 (SMS_V_26, MEM_ME, (UBYTE)i,\
319 sms_deliver->tp_pid,\
320 sms_deliver->tp_dcs);\
321 } /* sms_v[26] */
322
323 #define SMS_EM_REPLACE_SMS_IN_SIM\
324 /* Replace SMS in SIM */\
325 if (sms_v[26])\
326 {\
327 sms_v[26] = em_write_buffer_6 (SMS_V_26, MEM_SM, record,\
328 SMS_PID(sms_data), SMS_DCS(sms_data));\
329 } /* sms_v[26] */
330
331 #define SMS_EM_SMS_STATUS_MESSAGE\
332 /* SMS status message */\
333 if (sms_v[27])\
334 {\
335 sms_v[27] = em_write_buffer_2 (SMS_V_27);\
336 } /* sms_v[27] */
337
338 #define SMS_EM_RECEIVE_SIM_TOOLKIT_DATA_DOWNLOAD\
339 /* Receive SIM toolkit data download */\
340 if (sms_v[28])\
341 {\
342 sms_v[28] = em_write_buffer_4 (SMS_V_28, SMS_DCS(sms_data), SMS_PID(sms_data));\
343 } /* sms_v[28] */
344
345 #define SMS_EM_STORE_MO_SHORT_MESSAGE\
346 if (em_change_flag == 1) /* new sms */\
347 {\
348 /* Store SMS */\
349 if (sms_v[29])\
350 {\
351 sms_v[29] = em_write_buffer_4 (SMS_V_29, MEM_ME, (UBYTE)index);\
352 } /* sms_v[29] */\
353 }
354
355 #define SMS_EM_STORE_MO_SHORT_MESSAGE_2\
356 if (em_change_flag == 1) /* new sms */\
357 {\
358 /* Store SMS */\
359 if (sms_v[29])\
360 {\
361 sms_v[29] = em_write_buffer_4 (SMS_V_29, MEM_SM, record);\
362 } /* sms_v[29] */\
363 }
364
365 #define SMS_EM_CHANGE_SHORT_MESSAGE\
366 if (em_change_flag == 2) /* change sms */\
367 {\
368 /* Store SMS */\
369 if (sms_v[30])\
370 {\
371 sms_v[30] = em_write_buffer_4 (SMS_V_30, MEM_ME, (UBYTE)index);\
372 } /* sms_v[30] */\
373 }
374
375 #define SMS_EM_CHANGE_SHORT_MESSAGE_2\
376 if (em_change_flag == 2) /* change sms */\
377 {\
378 /* Store SMS */\
379 if (sms_v[30])\
380 {\
381 sms_v[30] = em_write_buffer_4 (SMS_V_30, MEM_SM, record);\
382 } /* sms_v[30] */\
383 }
384
385 #define SMS_EM_READ_SHORT_MESSAGE\
386 /* Read short message */\
387 if (sms_v[31])\
388 {\
389 sms_v[31] = em_write_buffer_4 (SMS_V_31, MEM_ME, (UBYTE)index);\
390 } /* sms_v[31] */
391
392 #define SMS_EM_READ_SHORT_MESSAGE_2\
393 /* Read short message - MO SMS*/\
394 if (sms_v[31])\
395 {\
396 sms_v[31] = em_write_buffer_4 (SMS_V_31, MEM_SM, record);\
397 } /* sms_v[31] */
398
399 #define SMS_EM_DELETE_SHORT_MESSAGE\
400 if (error EQ SIM_NO_ERROR)\
401 {\
402 /* Delete short message */\
403 if (sms_v[32])\
404 {\
405 sms_v[32] = em_write_buffer_4 (SMS_V_32, mem_type, record);\
406 } /* sms_v[32] */\
407 }
408
409 #define SMS_EM_UNKNOWN_TRANSACTION\
410 /* Unknown Transaction */\
411 if (sms_v[33])\
412 {\
413 sms_v[33] = em_write_buffer_5 (SMS_V_33, ti, _decodedMsg[0], pd);\
414 } /* sms_v[33] */
415
416 #else /*FF_EM_MODE */
417
418 #define SMS_EM_SET_CHANGE_FLAG_1
419 #define SMS_EM_SET_CHANGE_FLAG_2
420
421 #define SMS_EM_MO_SHORT_MESSAGE /*Event 1*/
422 #define SMS_EM_SEND_RP_DATA /*Event 2*/
423 #define SMS_EM_MM_CONNECTION_ESTABLISHMENT /*Event 3*/
424 #define SMS_EM_MM_CONNECTION_ESTABLISHED /*Event 4*/
425 #define SMS_EM_SEND_CP_DATA /*Event 5*/
426 #define SMS_EM_MM_CONNECTION_FAILED /*Event 6*/
427 #define SMS_EM_TIMEOUT_TR1M /*Event 7*/
428 #define SMS_EM_RECEIVE_CP_ACKNOWLEDGE /*Event 8*/
429 #define SMS_EM_RECEIVE_CP_DATA /*Event 9*/
430 #define SMS_EM_RECEIVE_UNKNOWN /*Event 10*/
431 #define SMS_EM_SEND_CP_ERROR /*Event 11*/
432 #define SMS_EM_RECEIVE_CP_ERROR /*Event 12*/
433 #define SMS_EM_LOSS_OF_MM_CONNECTION /*Event 13*/
434 #define SMS_EM_ABORT_OF_MM_CONNECTION /*Event 14*/
435 #define SMS_EM_TIMEOUT_TC1M /*Event 15*/
436 #define SMS_EM_TIMEOUT_TR2M /*Event 16*/
437 #define SMS_EM_SEND_CP_ACKNOWLEDGE /*Event 17*/
438 #define SMS_EM_RECEIVE_RP_ERROR /*Event 18*/
439 #define SMS_EM_RECEIVE_RP_AKNOWLEDGE /*Event 19*/
440 #define SMS_EM_RECEIVE_RP_DATA /*Event 20*/
441 #define SMS_EM_RECEIVE_UNKNOWN_2 /*Event 21*/
442 #define SMS_EM_SEND_RP_ERROR /*Event 22*/
443 #define SMS_EM_MO_SHORT_MESSAGE_COMMAND /*Event 23*/
444 #define SMS_EM_DISPLAY_MT_SHORT_MESSAGE /*Event 24*/
445 #define SMS_EM_STORE_MT_MESSAGE /*Event 25*/
446 #define SMS_EM_REPLACE_SMS_IN_ME /*Event 26*/
447 #define SMS_EM_REPLACE_SMS_IN_SIM /*Event 26*/
448 #define SMS_EM_SMS_STATUS_MESSAGE /*Event 27*/
449 #define SMS_EM_RECEIVE_SIM_TOOLKIT_DATA_DOWNLOAD /*Event 28*/
450 #define SMS_EM_STORE_MO_SHORT_MESSAGE /*Event 29*/
451 #define SMS_EM_STORE_MO_SHORT_MESSAGE_2 /*Event 29*/
452 #define SMS_EM_CHANGE_SHORT_MESSAGE /*Event 30*/
453 #define SMS_EM_CHANGE_SHORT_MESSAGE_2 /*Event 30*/
454 #define SMS_EM_READ_SHORT_MESSAGE /*Event 31*/
455 #define SMS_EM_READ_SHORT_MESSAGE_2 /*Event 31*/
456 #define SMS_EM_DELETE_SHORT_MESSAGE /*Event 32*/
457 #define SMS_EM_UNKNOWN_TRANSACTION /*Event 33*/
458
459
460 #endif /*FF_EM_MODE */
461 #endif /* SMS_EM_H */