FreeCalypso > hg > fc-magnetite
comparison src/g23m-gsm/sms/sms.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 : GSM-PS (8410) | |
4 | Modul : SMS | |
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 : Definitions for the Protocol Stack Entity | |
18 | Short Message Service | |
19 +----------------------------------------------------------------------------- | |
20 */ | |
21 | |
22 #ifndef SMS_H | |
23 #define SMS_H | |
24 | |
25 #include <stdio.h> | |
26 #ifdef TI_PS_HCOMM_CHANGE | |
27 #include "cl_hComm_handle.h" | |
28 #endif | |
29 | |
30 #ifdef TI_GSP_STR2IND_S2I_STRING | |
31 typedef unsigned int T_S2I_STRING; | |
32 #else | |
33 typedef char * T_S2I_STRING; | |
34 #define S2I_STRING(x) (x) | |
35 #endif | |
36 | |
37 #ifdef TI_PS_OP_VSI_NO_CALL_ID | |
38 #define TIMER_START(C,I,T) vsi_t_start_nc(I,T) | |
39 #define TIMER_PSTART(C,I,T,R) vsi_t_pstart_nc(I,T,R) | |
40 #define TIMER_STOP(C,I) vsi_t_stop_nc(I) | |
41 #define TIMER_STATUS(C,I,T) vsi_t_status_nc(I,T) | |
42 #define SUSPEND_SELF(C,T) vsi_t_sleep_nc(T) | |
43 #define SYSTEM_TIME(C,T) vsi_t_time_nc(T) | |
44 #else /* TI_PS_OP_VSI_NO_CALL_ID */ | |
45 #define TIMER_START(C,I,T) vsi_t_start(C,I,T) | |
46 #define TIMER_PSTART(C,I,T,R) vsi_t_pstart(C,I,T,R) | |
47 #define TIMER_STOP(C,I) vsi_t_stop(C,I) | |
48 #define TIMER_STATUS(C,I,T) vsi_t_status(C,I,T) | |
49 #define SUSPEND_SELF(C,T) vsi_t_sleep(C,T) | |
50 #define SYSTEM_TIME(C,T) vsi_t_time(C,T) | |
51 #endif /* TI_PS_OP_VSI_NO_CALL_ID */ | |
52 | |
53 /* | |
54 * Definition whether a shared CCD buffer shall be used | |
55 */ | |
56 /* #undef SHARED_CCD_BUF */ | |
57 | |
58 #ifndef _TARGET_ | |
59 | |
60 #define FF_CPHS /* This flag is only required for SIMULATION defined in .xml file, | |
61 to remove the redefinition warning put under comment */ | |
62 #endif /* _TARGET_ */ | |
63 | |
64 #define FF_SMS_23430 | |
65 | |
66 #if defined(FF_SMS_23430) | |
67 #define FF_SMS_NW_RCG_SIM | |
68 #endif | |
69 | |
70 /*==== MACROS =====================================================*/ | |
71 | |
72 #if FALSE | |
73 #define SMS_SDU_COPY(_d_,_s_,_t_) memcpy(_d_,_s_,\ | |
74 (offsetof(T_##_t_,sdu)+offsetof(T_sdu,buf)+\ | |
75 BYTELEN(D_SDU_OFF(_s_)+D_SDU_LEN(_s_)))) | |
76 #else | |
77 #define SMS_SDU_COPY(_d_,_s_,_t_) memcpy(&(_d_)->sdu,&(_s_)->sdu,\ | |
78 offsetof(T_sdu,buf)+\ | |
79 BYTELEN(D_SDU_OFF(_s_)+D_SDU_LEN(_s_))) | |
80 #endif | |
81 | |
82 #define GET_SMS_INSTANCE(ti) csf_get_sms_instance(ti) | |
83 #define GET_NEW_SMS_INSTANCE(ti) csf_get_new_sms_instance(ti) | |
84 #define FREE_SMS_INSTANCE(ti) csf_free_sms_instance(ti) | |
85 #define GET_MO_INSTANCE(_sd_) ((_sd_)->inst = INST_MO) | |
86 #define GET_MT_INSTANCE(_sd_) ((_sd_)->inst = INST_MT) | |
87 | |
88 /* | |
89 * The assert() macro as defined by the frame stops the task, | |
90 * not only in simulation but also on the target. For the | |
91 * simulation this is a desired behaviour, for the target it is not. | |
92 */ | |
93 #ifndef WIN32 | |
94 #undef assert | |
95 #define assert(x) if (!(x)) { TRACE_ERROR ("Assertion failed"); } | |
96 #endif | |
97 | |
98 #define CMMS_ACTIVE ((sms_data->cmms_mode EQ CMMS_MODE_ONE) \ | |
99 OR (sms_data->cmms_mode EQ CMMS_MODE_TWO)) | |
100 | |
101 /*==== CONSTANTS ==================================================*/ | |
102 | |
103 #define DISPLAY 0 | |
104 #define IGNORE 0xFE // return RP-ACK if handled unsuccessfully | |
105 #define NOTHING 0xFF // return RP-ERROR if handled unsuccessfully | |
106 | |
107 #define MAX_SMS_CALLS 2 | |
108 | |
109 #define INST_MO 0 | |
110 #define INST_MT 1 | |
111 | |
112 #define SMS_INST sms_data->data[sms_data->inst] | |
113 | |
114 #define ENTITY_DATA sms_data | |
115 | |
116 /* | |
117 * Recognition of certain networks (SIM opearators) | |
118 */ | |
119 | |
120 #define NW_SIM_NONE 0 /* no special network given */ | |
121 #define NW_SIM_23430 1 /* SIM provided by operator 234-30 */ | |
122 | |
123 /* | |
124 * Dynamic Configuration Numbers | |
125 */ | |
126 enum | |
127 { | |
128 SMS_CONF_EVENT_TIMER_SET = 1, | |
129 SMS_CONF_EVENT_TIMER_RESET = 2, | |
130 SMS_CONF_EVENT_TIMER_SPEED_UP = 3, | |
131 SMS_CONF_EVENT_TIMER_SLOW_DOWN = 4, | |
132 SMS_CONF_EVENT_TIMER_SUPPRESS = 5, | |
133 SMS_CONF_EVENT_PAUSE = 6, | |
134 SMS_CONF_EVENT_RESUME = 7, | |
135 | |
136 SMS_CONF_EVENT_END, | |
137 SMS_CONF_EVENT_MAX = (SMS_CONF_EVENT_END - 1) | |
138 }; | |
139 typedef UBYTE SMS_CONF_EVENT_ENUM_TYPE; | |
140 | |
141 /* | |
142 * Timer definitions, MAX_SMS_TIMER | |
143 * | |
144 * Description : The constants defines the timers and the number of timers | |
145 * available in the timer pool. | |
146 * Note : One CP and one RL timer per instance. | |
147 */ | |
148 #define TC1M 0 | |
149 #define TR1M 1 | |
150 #define TR2M 2 | |
151 #define TRAM 3 | |
152 #define TLCT 4 /* concatenation timer */ | |
153 #define TMMS 5 /* CMMS Timer */ | |
154 #define MAX_SMS_TIMER 6 | |
155 | |
156 /* | |
157 * Protocoldiscriminator SMS | |
158 */ | |
159 #define ENCODE_OFFSET 32 | |
160 #define BSIZE_TI_PD 8 | |
161 | |
162 /* | |
163 * Protocoldiscriminator SMS | |
164 */ | |
165 #define PD_SMS 9 | |
166 | |
167 /* | |
168 * Max size of SMS-message | |
169 */ | |
170 #define MAX_SMS_MESSAGE_SIZE (MAX_BITSTREAM_LEN_SMS>>3) | |
171 | |
172 /* | |
173 * Max size of TP user data | |
174 */ | |
175 #define MAX_CHARACTERS_TPUD 141 | |
176 | |
177 /* | |
178 * Max size of sim-sms-record | |
179 */ | |
180 #define SIM_LENGTH_SMS_RECORD 176 | |
181 | |
182 /* | |
183 * access values | |
184 */ | |
185 #define ACCESS_EMPTY 0 | |
186 | |
187 /* | |
188 * length of U_CP_DATA | |
189 */ | |
190 #define LEN_U_CP_DATA (252*8) | |
191 | |
192 /* | |
193 * Max length of D_CP_USER_DATA | |
194 */ | |
195 #define MAX_LEN_CP_USER_DATA 249 | |
196 #define MIN_CP_LEN 3 | |
197 #define MIN_CP_ACK_LEN 2 | |
198 | |
199 /* | |
200 * constants for GSMS: active downlink | |
201 */ | |
202 #if defined (GPRS) | |
203 #define SMS_DOWNLINK_NONE 0 /* no downlink assigned yet */ | |
204 #define SMS_DOWNLINK_MMSMS 1 /* downlink is MM using SAP MMSMS */ | |
205 #define SMS_DOWNLINK_LL_CHECK 2 /* downlink LL is being checked */ | |
206 #define SMS_DOWNLINK_LL 3 /* downlink is LL, registered */ | |
207 | |
208 /* | |
209 * constants for GSMS: LLC flow control | |
210 */ | |
211 #define SMS_LLC_UNKNOWN 0x00 | |
212 #define SMS_LLC_AVAILABLE 0x01 | |
213 #define SMS_LLC_BUSY 0x02 /* LLC is busy, no instance waiting */ | |
214 #define SMS_LLC_BUSY_WAITING 0x03 /* LLC is busy and instance is waiting */ | |
215 | |
216 /* constants for GSMS: SMS entity flow control status towards LLC */ | |
217 #define SMS_FLOW_UNKNOWN 0x00 | |
218 #define SMS_FLOW_AVAILABLE 0x01 /* availability of SMS signalled to LLC */ | |
219 #define SMS_FLOW_BUSY 0x02 /* SMS entity is busy */ | |
220 | |
221 /* cp type of acknowledgement to be sent */ | |
222 #define SMS_CP_NONE 0x00 | |
223 #define SMS_CP_ACK 0x01 | |
224 #define SMS_CP_ERROR 0x02 | |
225 #endif /* GPRS */ | |
226 | |
227 /* | |
228 * a modified version of the S/GET_STATE macros for tracing SMS_INST states | |
229 */ | |
230 #ifdef NTRACE | |
231 #define SMS_INST_SET_STATE(PROCESS,STATE) SMS_INST.state[PROCESS] = STATE | |
232 #define SMS_INST_GET_STATE(PROCESS) SMS_INST.state[PROCESS] | |
233 #else | |
234 #define SMS_INST_SET_STATE(PROCESS,STATE)\ | |
235 { vsi_o_strace (VSI_CALLER\ | |
236 PROCESS_NAME_SMS_INST[PROCESS],\ | |
237 PROCESS##_NAME [ SMS_INST.state[PROCESS] ],\ | |
238 PROCESS##_NAME [ STATE ]);\ | |
239 SMS_INST.state[PROCESS] = (STATE); } | |
240 #define SMS_INST_GET_STATE(PROCESS)\ | |
241 vsi_o_strace (VSI_CALLER\ | |
242 PROCESS_NAME_SMS_INST[PROCESS],\ | |
243 PROCESS##_NAME [ SMS_INST.state[PROCESS] ],\ | |
244 NULL ),\ | |
245 SMS_INST.state[PROCESS] | |
246 #endif /* else, #ifdef NTRACE */ | |
247 | |
248 /* | |
249 * CP States | |
250 */ | |
251 #define CP_IDLE 0 /* 3gpp, MO+MT */ | |
252 #define CP_MM_CONNECTION_PENDING 1 /* 3gpp, MO */ | |
253 #define CP_WAIT_FOR_ACK 2 /* 3gpp, MO+MT */ | |
254 #define CP_MM_CONNECTION_ESTABLISHED 3 /* 3gpp, MO+MT */ | |
255 | |
256 #if defined (GPRS) | |
257 /* | |
258 * CP States for GSMS | |
259 */ | |
260 #define CP_GSMS_IDLE 4 /* 3gpp */ | |
261 #define CP_GSMS_MO_WAIT_FOR_CP_ACK 5 /* 3gpp */ | |
262 #define CP_GSMS_MT_WAIT_FOR_CP_ACK 6 /* 3gpp */ | |
263 #define CP_GSMS_MO_WAIT_FOR_CP_DATA 7 /* 3gpp */ | |
264 #define CP_GSMS_MT_WAIT_FOR_RP_ACK 8 /* 3gpp */ | |
265 #endif /* GPRS */ | |
266 | |
267 #if defined (GPRS) | |
268 EXTERN const char * const | |
269 STATE_CP_NAME[]; | |
270 #define STATE_CP_NAME_INIT \ | |
271 "CP_IDLE", \ | |
272 "CP_MM_CONNECTION_PENDING", \ | |
273 "CP_WAIT_FOR_ACK", \ | |
274 "CP_MM_CONNECTION_ESTABLISHED", \ | |
275 "CP_GSMS_IDLE", \ | |
276 "CP_GSMS_MO_WAIT_FOR_CP_ACK", \ | |
277 "CP_GSMS_MT_WAIT_FOR_CP_ACK", \ | |
278 "CP_GSMS_MO_WAIT_FOR_CP_DATA", \ | |
279 "CP_GSMS_MT_WAIT_FOR_RP_ACK" | |
280 #else | |
281 EXTERN const char * const | |
282 STATE_CP_NAME[]; | |
283 #define STATE_CP_NAME_INIT \ | |
284 "CP_IDLE", \ | |
285 "CP_MM_CONNECTION_PENDING", \ | |
286 "CP_WAIT_FOR_ACK", \ | |
287 "CP_MM_CONNECTION_ESTABLISHED" | |
288 #endif | |
289 | |
290 /* | |
291 * RL States | |
292 */ | |
293 #define RL_IDLE 0 /* 3gpp */ | |
294 #define RL_WAIT_FOR_ACK 1 /* 3gpp */ | |
295 #define RL_WAIT_FOR_SMMA_ACK 2 /* TI */ | |
296 #define RL_WAIT_FOR_SEND_ACK 3 /* 3gpp */ | |
297 #define RL_WAIT_FOR_RETRANS_TIMER 4 /* 3gpp */ | |
298 #define RL_ESTABLISH 5 /* TI */ | |
299 #define RL_ESTABLISHED 6 /* TI */ | |
300 #define RL_WAIT_FOR_SEND_ERROR 7 /* TI */ | |
301 | |
302 EXTERN const char * const | |
303 STATE_RL_NAME[]; | |
304 #define STATE_RL_NAME_INIT \ | |
305 "RL_IDLE", \ | |
306 "RL_WAIT_FOR_ACK", \ | |
307 "RL_WAIT_FOR_SMMA_ACK", \ | |
308 "RL_WAIT_FOR_SEND_ACK", \ | |
309 "RL_WAIT_FOR_RETRANS_TIMER", \ | |
310 "RL_ESTABLISH", \ | |
311 "RL_ESTABLISHED", \ | |
312 "RL_WAIT_FOR_SEND_ERROR" | |
313 | |
314 /* | |
315 * TL States | |
316 */ | |
317 #define TL_IDLE 0 | |
318 #define TL_SEND 1 | |
319 #define TL_COMMAND 2 | |
320 #define TL_RECEIVE 3 | |
321 #define TL_OTHER 4 | |
322 #define TL_ESTABLISH 5 | |
323 #define TL_SEND_CONTD 6 | |
324 | |
325 EXTERN const char * const | |
326 STATE_TL_NAME[]; | |
327 #define STATE_TL_NAME_INIT \ | |
328 "TL_IDLE", \ | |
329 "TL_SEND", \ | |
330 "TL_COMMAND", \ | |
331 "TL_RECEIVE", \ | |
332 "TL_OTHER", \ | |
333 "TL_ESTABLISH", \ | |
334 "TL_SEND_CONTD" | |
335 | |
336 /* | |
337 * SMS manages 3 (MAX_STATE_SMS_INST) states per SMS_INST: CP, RL, TL | |
338 */ | |
339 #define STATE_CP 0 | |
340 #define STATE_RL 1 | |
341 #define STATE_TL 2 | |
342 #define MAX_STATE_SMS_INST 3 | |
343 | |
344 EXTERN const char * const | |
345 PROCESS_NAME_SMS_INST[]; | |
346 #define PROCESS_NAME_SMS_INST_INIT \ | |
347 "STATE_CP" , \ | |
348 "STATE_RL" , \ | |
349 "STATE_TL" | |
350 | |
351 /* | |
352 * A definition of the states of SMS_INST is provided in SMS_PEI.C | |
353 */ | |
354 #if defined(SMS_PEI_C) && ! defined(NTRACE) | |
355 GLOBAL const char * const STATE_CP_NAME[] = { STATE_CP_NAME_INIT }; | |
356 GLOBAL const char * const STATE_RL_NAME[] = { STATE_RL_NAME_INIT }; | |
357 GLOBAL const char * const STATE_TL_NAME[] = { STATE_TL_NAME_INIT }; | |
358 GLOBAL const char * const PROCESS_NAME_SMS_INST[] = { PROCESS_NAME_SMS_INST_INIT }; | |
359 #endif | |
360 | |
361 /* | |
362 * MMI States | |
363 */ | |
364 #define MMI_IDLE 0 | |
365 #define MMI_READ 1 | |
366 #define MMI_WRITE 2 | |
367 #define MMI_DELETE 3 | |
368 #define MMI_FIND_FIRST 4 | |
369 #define MMI_FIND_NEXT 5 | |
370 #define MMI_REPLACE 6 | |
371 #define MMI_STATE_UPDATE 7 | |
372 #define MMI_READ_STATE_UPDATE 8 | |
373 #define MMI_RESUME 9 | |
374 | |
375 /* N950 Memory Optimization - Implements Measure #39*/ | |
376 EXTERN T_S2I_STRING const | |
377 STATE_MMI_NAME[]; | |
378 /* | |
379 * NET States | |
380 */ | |
381 #define NET_IDLE 0 | |
382 #define NET_WRITE 1 | |
383 #define NET_READ 2 | |
384 #define NET_23430_WRITE 3 | |
385 #define NET_23430_DELETE 4 | |
386 | |
387 /* N950 Memory Optimization - Implements Measure #39*/ | |
388 EXTERN T_S2I_STRING const | |
389 STATE_NET_NAME[]; | |
390 /* | |
391 * EST States - substates for connection establishment | |
392 */ | |
393 enum | |
394 { | |
395 EST_IDLE = 0, /* no connection establishment */ | |
396 EST_SEND = 1, /* conn establishment for send */ | |
397 EST_RTX = 2, /* conn est for retransmission */ | |
398 EST_CMD = 3, /* conn est for command */ | |
399 EST_SMMA = 4 /* conn est for smma message */ | |
400 }; | |
401 | |
402 /* N950 Memory Optimization - Implements Measure #39*/ | |
403 EXTERN T_S2I_STRING const | |
404 STATE_EST_NAME[]; | |
405 /* | |
406 * SMS manages 3 (MAX_STATE) states: MMI, NET, EST | |
407 */ | |
408 #ifdef OPTION_MULTITHREAD | |
409 #define PROCESS_NAME _ENTITY_PREFIXED(PROCESS_NAME) | |
410 #endif | |
411 | |
412 #define STATE_MMI 0 | |
413 #define STATE_NET 1 | |
414 #define STATE_EST 2 | |
415 #define MAX_STATE 3 | |
416 | |
417 /* N950 Memory Optimization - Implements Measure #39*/ | |
418 EXTERN T_S2I_STRING const | |
419 PROCESS_NAME[]; | |
420 /* | |
421 * A definition of the states is provided in SMS_PEI.C | |
422 */ | |
423 #if defined(SMS_PEI_C) && ! defined(NTRACE) | |
424 /* N950 Memory Optimization - Implements Measure #39*/ | |
425 GLOBAL T_S2I_STRING const STATE_MMI_NAME[] = | |
426 { | |
427 | |
428 S2I_STRING("MMI_IDLE"), | |
429 S2I_STRING("MMI_READ"), | |
430 S2I_STRING("MMI_WRITE"), | |
431 S2I_STRING("MMI_DELETE"), | |
432 S2I_STRING("MMI_FIND_FIRST"), | |
433 S2I_STRING("MMI_FIND_NEXT"), | |
434 S2I_STRING("MMI_REPLACE"), | |
435 S2I_STRING("MMI_STATE_UPDATE"), | |
436 S2I_STRING("MMI_READ_STATE_UPDATE"), | |
437 S2I_STRING("MMI_RESUME") | |
438 }; | |
439 #ifndef FF_SMS_23430 | |
440 GLOBAL T_S2I_STRING const STATE_NET_NAME[] = | |
441 { | |
442 S2I_STRING("NET_IDLE"), | |
443 S2I_STRING("NET_WRITE"), | |
444 S2I_STRING("NET_READ") | |
445 }; | |
446 #else | |
447 GLOBAL T_S2I_STRING const STATE_NET_NAME[] = | |
448 { | |
449 S2I_STRING("NET_IDLE"), | |
450 S2I_STRING("NET_WRITE"), | |
451 S2I_STRING("NET_READ"), | |
452 S2I_STRING("NET_23430_WRITE"), | |
453 S2I_STRING("NET_23430_DELETE") | |
454 }; | |
455 #endif /* else, #ifndef FF_SMS_23430 */ | |
456 | |
457 GLOBAL T_S2I_STRING const STATE_EST_NAME[] = | |
458 { | |
459 | |
460 S2I_STRING("EST_IDLE"), | |
461 S2I_STRING("EST_SEND"), | |
462 S2I_STRING("EST_RTX"), | |
463 S2I_STRING("EST_CMD"), | |
464 S2I_STRING("EST_SMMA") | |
465 }; | |
466 | |
467 GLOBAL T_S2I_STRING const PROCESS_NAME[] = | |
468 { | |
469 | |
470 S2I_STRING("MMI"), | |
471 S2I_STRING("NET"), | |
472 S2I_STRING("EST") | |
473 }; | |
474 #endif | |
475 | |
476 #define ACCESS_BY_MMI 0x01 | |
477 #define ACCESS_BY_NET 0x02 | |
478 #define ACCESS_BY_EST 0x03 | |
479 | |
480 #define SIM_SMS_FREE (SMS_RECORD_FREE) | |
481 #define SIM_SMS_MT_READ (SMS_RECORD_REC_READ) | |
482 #define SIM_SMS_MT_TO_BE_READ (SMS_RECORD_REC_UNREAD) | |
483 #define SIM_SMS_MO_SENT (SMS_RECORD_STO_SENT) | |
484 #define SIM_SMS_MO_TO_BE_SEND (SMS_RECORD_STO_UNSENT) | |
485 #define SIM_SMS_PENDING 0xFF /* new entry, not yet confirmed */ | |
486 | |
487 #define SMS_MAX_SIM_ACCESS 2 | |
488 | |
489 /*==== TYPES ======================================================*/ | |
490 | |
491 /* | |
492 * IE Header Structure | |
493 */ | |
494 typedef struct | |
495 { | |
496 UBYTE iei; /* Information Element Identifier */ | |
497 UBYTE ie_length; /* Length of Information Element */ | |
498 } T_SMS_PDU_IE_HDR; | |
499 | |
500 /* | |
501 * Conactenation header structure for 8 bit reference number | |
502 */ | |
503 typedef struct | |
504 { | |
505 UBYTE ref_nr; /* Reference Number */ | |
506 UBYTE max_nr; /* Maximum number of short messages | |
507 in the concatenated short message */ | |
508 UBYTE seq_nr; /* Sequence number of the current | |
509 short message */ | |
510 } T_SMS_PDU_CONCAT_8BIT_HDR; | |
511 | |
512 /* | |
513 * Conactenation header structure for 16 bit reference number | |
514 */ | |
515 typedef struct | |
516 { | |
517 USHORT ref_nr; /* Reference Number */ | |
518 UBYTE max_nr; /* Maximum Sequence Number */ | |
519 UBYTE seq_nr; /* Sequence Number */ | |
520 } T_SMS_PDU_CONCAT_16BIT_HDR; | |
521 | |
522 /* | |
523 * Conactenation header common structure | |
524 */ | |
525 typedef struct | |
526 { | |
527 USHORT ref_nr; /* Reference Number */ | |
528 UBYTE max_nr; /* Maximum Sequence Number */ | |
529 UBYTE seq_nr; /* Sequence Number */ | |
530 } T_SMS_CONCAT_HDR; | |
531 | |
532 typedef struct | |
533 { | |
534 UBYTE t_mode; | |
535 ULONG t_val; | |
536 } T_TIMER_CONFIG; | |
537 | |
538 | |
539 typedef struct | |
540 { | |
541 T_MMSMS_DATA_REQ *mo_msg; | |
542 T_sms_sdu *sms_sdu; | |
543 T_SIM_READ_RECORD_CNF *sim_read; | |
544 UBYTE state[MAX_STATE_SMS_INST]; | |
545 UBYTE tl_retx; /* Number of retransmissions on TL level */ | |
546 #ifdef REL99 | |
547 UBYTE failed_msg_retx; /* stores whether MO msg is sent thru retransmission request */ | |
548 UBYTE failed_msg_rec_num;/* stores record number of last failed msg */ | |
549 UBYTE failed_msg_mem; /* stores memory location of last failed msg */ | |
550 #endif | |
551 UBYTE retx; | |
552 UBYTE retrans; | |
553 UBYTE msg_ref; | |
554 UBYTE ti; | |
555 UBYTE tp_mr; | |
556 UBYTE tp_mr_ret; /* TP-MR to be returned to higher layer */ | |
557 | |
558 /* cp_release_req() in state XXX_CP_WAIT_FOR_ACK received, | |
559 * delay the release until the next CP state is entered. */ | |
560 BOOL r_flag; | |
561 /* CP_ACK pending: outstanding CP_ACK in outbound direction */ | |
562 BOOL cp_ack_pending; | |
563 UBYTE act_mem; | |
564 UBYTE act_record; | |
565 UBYTE act_status; | |
566 UBYTE act_rdmode; | |
567 UBYTE act_condx; | |
568 UBYTE act_modifier; | |
569 UBYTE pid; | |
570 UBYTE dcs; | |
571 #if defined (GPRS) | |
572 UBYTE downlink; /* downlink of this instance: LLC or MMSMS */ | |
573 UBYTE ack_type; /* type of message to be sent */ | |
574 UBYTE cp_cause; /* cause value of CP-ERROR to be sent */ | |
575 T_cp_user_data_dl *cp_user_data_dl; | |
576 #endif | |
577 BOOL t_running[MAX_SMS_TIMER]; | |
578 } T_SMS_INST; | |
579 | |
580 typedef struct | |
581 { | |
582 UBYTE *status_field; /* status each record */ | |
583 UBYTE *pid_field; /* PID flag of each record */ | |
584 UBYTE mem_type; /* Type of used memory */ | |
585 UBYTE max_record; /* number of available records */ | |
586 UBYTE any_valid; /* at least one used record exists */ | |
587 } T_BACKUP; | |
588 | |
589 typedef struct | |
590 { | |
591 /* SIM EF file identifier. path_info need not be stored as SMS is using | |
592 * only non-conflicting files | |
593 * Data-field identification | |
594 */ | |
595 USHORT datafield; | |
596 /* record number, used only for linear fixed EFs */ | |
597 UBYTE rec_num; | |
598 /* flag indicating whether this entry is used */ | |
599 UBYTE entry_used; | |
600 } T_SMS_SIM_ACCESS_INFO; | |
601 | |
602 /* | |
603 * CONCATENATION CONTROL | |
604 */ | |
605 typedef struct | |
606 { | |
607 BOOL concatenation; /* whether concatenated submits are | |
608 currently processed */ | |
609 BOOL release_pending; /* release outstanding */ | |
610 BOOL end; /* end of concatenated stream */ | |
611 BOOL pad; /* */ | |
612 T_SMS_CONCAT_HDR nr; /* current number */ | |
613 } T_SMS_CONCAT_CNTRL; | |
614 | |
615 /* | |
616 * PAUSE RESUME CONTROL | |
617 */ | |
618 typedef struct | |
619 { | |
620 U8 delivery_state; /* pause or resume, SMS_DELIVER_STATUS_xxx */ | |
621 BOOL mem_full_sent; /* whether mem capacity exceeded | |
622 message was sent to HLR due to | |
623 user pause request */ | |
624 U16 save_cause; /* safed cause value while sim updating */ | |
625 } T_SMS_PR_CNTRL; | |
626 | |
627 typedef struct | |
628 { | |
629 T_SMS_INST data[MAX_SMS_CALLS]; | |
630 T_rp_data_dl *rp_data_dl; /* points to income RL data */ | |
631 /* | |
632 * following is a hack: since we cannot pass values to timer we safe it here: | |
633 */ | |
634 UBYTE timer_ti; /* TI for running timer */ | |
635 UBYTE mhc; /* message Handling compatibility */ | |
636 UBYTE mt; | |
637 UBYTE ds; | |
638 UBYTE mem3; | |
639 UBYTE inst; | |
640 UBYTE ent_state; | |
641 UBYTE state[MAX_STATE]; | |
642 BOOL mem_cap_avail; /* as stated on SIM */ | |
643 UBYTE access_fifo[2]; | |
644 UBYTE sim_phase; /* value of EF(Phase) */ | |
645 UBYTE use_mem_a; | |
646 UBYTE use_mem_b; | |
647 T_BACKUP me_backup; | |
648 T_BACKUP sim_backup; | |
649 | |
650 /* In the ME status field a backup of the SMS status is stored, | |
651 * the ME PID field is a bitarray which stores whether a given | |
652 * SMS is of the replacement type or not. | |
653 * For asynchronous memory those fields are mandatory, for | |
654 * synchronous memory the backup is optional. | |
655 */ | |
656 /* UBYTE me_status_field [MAX_RECORD_ME]; */ | |
657 /* UBYTE me_pid_field [(MAX_RECORD_ME+7)/8]; */ | |
658 UBYTE sim_status_field [MAX_RECORD_SIM]; | |
659 UBYTE sim_pid_field[(MAX_RECORD_SIM+7)/8]; | |
660 | |
661 /* SMS entity has finished reading SMS entries from the SIM. */ | |
662 BOOL init_done; | |
663 | |
664 /* SMS entries changed by SAT, not begun reading records from the SIM. */ | |
665 BOOL sim_mem_update; | |
666 | |
667 /* concatenation control field */ | |
668 T_SMS_CONCAT_CNTRL concat_cntrl; | |
669 /* pause resume control field */ | |
670 T_SMS_PR_CNTRL pr_cntrl; | |
671 | |
672 UBYTE nw_spec; | |
673 #ifdef FF_CPHS | |
674 UBYTE cphs_sim; /* CPHS SIM recognized */ | |
675 #endif | |
676 #ifdef SIM_TOOLKIT | |
677 UBYTE download_sms; | |
678 T_SIM_FILE_UPDATE_IND *file_update_ind; | |
679 /* MMI state backup */ | |
680 UBYTE stored_mmi_state; | |
681 /* Backup the read_cnf primitive */ | |
682 T_SIM_READ_RECORD_CNF *stored_read_cnf; | |
683 #endif /* #ifdef SIM_TOOLKIT */ | |
684 #if defined (GPRS) | |
685 UBYTE mo_dst_pref; /* preferred dest. (GPRS/CCT) for MO SM */ | |
686 UBYTE llc_flow; /* LLC flow control */ | |
687 UBYTE sms_flow; /* SMS entity flow control */ | |
688 #endif | |
689 /* To indicate that release is pending for the previous connection */ | |
690 BOOL cmms_release_pending; | |
691 UBYTE cmms_mode; | |
692 T_TIME timer_values[MAX_SMS_TIMER]; | |
693 /* Used to store information on the SIM Accesses that are currently happening. | |
694 * The array is indexed by the req_id that was sent in SIM_XXX_REQ */ | |
695 T_SMS_SIM_ACCESS_INFO sms_sim_access_info[SMS_MAX_SIM_ACCESS]; | |
696 } T_SMS_DATA; | |
697 | |
698 /*==== MACROS =====================================================*/ | |
699 | |
700 #define DATA_INST(_sd_) ((_sd_)->data[(_sd_)->inst]) | |
701 | |
702 #define SMS_STATE(_sd_) (DATA_INST(_sd_).state) | |
703 #define SMS_RETX(_sd_) (DATA_INST(_sd_).retx) | |
704 #define SMS_RETRANS(_sd_) (DATA_INST(_sd_).retrans) | |
705 #define SMS_CP_REF(_sd_) (DATA_INST(_sd_).ti) | |
706 #define SMS_RP_REF(_sd_) (DATA_INST(_sd_).msg_ref) | |
707 #define SMS_TP_REF(_sd_) (DATA_INST(_sd_).tp_mr) | |
708 #define SMS_TP_REF_RET(_sd_) (DATA_INST(_sd_).tp_mr_ret) | |
709 /* #define SMS_RP_FLAG(_sd_) (DATA_INST(_sd_).r_flag) */ /* Not used */ | |
710 #define SMS_SEL_MEM(_sd_) (DATA_INST(_sd_).act_mem) | |
711 #define SMS_SEL_REC(_sd_) (DATA_INST(_sd_).act_record) | |
712 #define SMS_REC_STATUS(_sd_) (DATA_INST(_sd_).act_status) | |
713 #define SMS_READ_MODE(_sd_) (DATA_INST(_sd_).act_rdmode) | |
714 #define SMS_CONDX(_sd_) (DATA_INST(_sd_).act_condx) | |
715 #define SMS_MODIFY(_sd_) (DATA_INST(_sd_).act_modifier) | |
716 #define SMS_DATA_REQ(_sd_) (DATA_INST(_sd_).mo_msg) | |
717 #define SMS_SDU(_sd_) (DATA_INST(_sd_).sms_sdu) | |
718 #define SMS_SIM_READ(_sd_) (DATA_INST(_sd_).sim_read) | |
719 #define SMS_RP_RCVD(_sd_) ((*_sd_).rp_data_dl) | |
720 #define SMS_PID(_sd_) (DATA_INST(_sd_).pid) | |
721 #define SMS_DCS(_sd_) (DATA_INST(_sd_).dcs) | |
722 | |
723 #define SMS_ENT_STATE(_sd_) ((_sd_)->ent_state) | |
724 #define SMS_SIM_PHASE(_sd_) ((_sd_)->sim_phase) | |
725 #define SMS_SIM_STATE(_sd_) ((_sd_)->state) | |
726 #define SMS_SIM_MEM_AVAIL(_sd_) ((_sd_)->mem_cap_avail) | |
727 #define SMS_SIM_ACCESS(_sd_) ((_sd_)->access_fifo) | |
728 #define SMS_SAT_DWNLD(_sd_) ((_sd_)->download_sms) | |
729 #define SMS_MT_ACK_MODE(_sd_) ((_sd_)->mhc) | |
730 #define SMS_MT_HANDLING(_sd_) ((_sd_)->mt) | |
731 #define SMS_ST_REPORT(_sd_) ((_sd_)->ds) | |
732 #define SMS_MEM_CFG(_sd_) ((_sd_)->mem3) | |
733 #define SMS_USE_MEMA(_sd_) ((_sd_)->use_mem_a) | |
734 #define SMS_USE_MEMB(_sd_) ((_sd_)->use_mem_b) | |
735 #define SMS_SIM_PROP(_sd_) ((_sd_)->sim_backup) | |
736 #define SMS_ME_PROP(_sd_) ((_sd_)->me_backup) | |
737 #define SMS_NETWORK(_sd_) ((_sd_)->nw_spec) | |
738 | |
739 #ifdef FF_CPHS | |
740 #define SMS_CPHS(_sd_) ((_sd_)->cphs_sim) | |
741 #endif /* #ifdef FF_CPHS */ | |
742 | |
743 #if defined (GPRS) | |
744 #define SMS_ROUTE(_sd_) (DATA_INST(_sd_).downlink) | |
745 #define SMS_CP_ACK_TYPE(_sd_) (DATA_INST(_sd_).ack_type) | |
746 #define SMS_CP_CAUSE(_sd_) (DATA_INST(_sd_).cp_cause) | |
747 #define SMS_CP_UDL(_sd_) (DATA_INST(_sd_).cp_user_data_dl) | |
748 #define SMS_ROUTE_PREF(_sd_) ((_sd_)->mo_dst_pref) | |
749 #define SMS_LLC_FLOW(_sd_) ((_sd_)->llc_flow) | |
750 #define SMS_SMS_FLOW(_sd_) ((_sd_)->sms_flow) | |
751 #endif | |
752 | |
753 | |
754 /*==== EXPORT =====================================================*/ | |
755 | |
756 /* | |
757 * Prototypes Formatter | |
758 */ | |
759 EXTERN void for_init_sms (void); | |
760 | |
761 /* | |
762 * Prototypes Transfer-Layer Primitives | |
763 */ | |
764 | |
765 EXTERN void tl_init (void); | |
766 EXTERN void tl_init_complete (void); | |
767 EXTERN void tl_mnsms_configure_req (T_MNSMS_CONFIGURE_REQ *configure_req); | |
768 #ifdef GPRS | |
769 EXTERN void tl_mnsms_mo_serv_req (T_MNSMS_MO_SERV_REQ *mo_serv_req); | |
770 #endif | |
771 #ifdef SIM_PERS_OTA | |
772 EXTERN void tl_mnsms_OTA_message_res (T_MNSMS_OTA_MESSAGE_RES *mnsms_OTA_message_res); | |
773 #endif | |
774 EXTERN void tl_mnsms_command_req (T_MNSMS_COMMAND_REQ *command_req); | |
775 EXTERN void tl_mnsms_delete_req (T_MNSMS_DELETE_REQ *delete_req); | |
776 EXTERN void tl_mnsms_read_req (T_MNSMS_READ_REQ *read_req); | |
777 EXTERN void tl_mnsms_store_req (T_MNSMS_STORE_REQ *store_req); | |
778 EXTERN void tl_mnsms_submit_req (T_MNSMS_SUBMIT_REQ *submit_req); | |
779 EXTERN void tl_mnsms_pause_req (T_MNSMS_PAUSE_REQ *pause_req); | |
780 EXTERN void tl_mnsms_resume_req (T_MNSMS_RESUME_REQ *resume_req); | |
781 EXTERN void tl_mnsms_query_req (T_MNSMS_QUERY_REQ *query_req); | |
782 EXTERN void tl_sim_sms_insert_ind (T_SIM_SMS_INSERT_IND *insert_ind); | |
783 #if defined(SIM_TOOLKIT) OR defined(FF_CPHS) | |
784 EXTERN void tl_sim_read_cnf (T_SIM_READ_CNF *read_cnf); | |
785 #endif /* #if defined(SIM_TOOLKIT) OR defined(FF_CPHS) */ | |
786 #ifdef SIM_TOOLKIT | |
787 EXTERN void tl_sim_file_update_ind (T_SIM_FILE_UPDATE_IND *file_update_ind); | |
788 #endif /* #ifdef SIM_TOOLKIT */ | |
789 EXTERN void tl_sim_update_cnf (T_SIM_UPDATE_CNF *update_cnf); | |
790 EXTERN void tl_sim_update_record_cnf (T_SIM_UPDATE_RECORD_CNF *update_cnf); | |
791 EXTERN void tl_sim_read_record_cnf (T_SIM_READ_RECORD_CNF *read_cnf); | |
792 EXTERN void tl_sim_remove_ind (T_SIM_REMOVE_IND *remove_ind); | |
793 #if defined(SIM_TOOLKIT) AND defined(SAT_SMS_DNL_SUPPORT) | |
794 EXTERN void tl_sim_toolkit_cnf (T_SIM_TOOLKIT_CNF *toolkit_cnf); | |
795 #endif /* #if defined(SIM_TOOLKIT) AND defined(SAT_SMS_DNL_SUPPORT) */ | |
796 EXTERN void tl_mnsms_error_ind (USHORT error); | |
797 EXTERN void tl_mnsms_ack_res (T_MNSMS_ACK_RES *ack_res); | |
798 EXTERN UBYTE tl_check_class_2 (UBYTE dcs); | |
799 EXTERN BOOL tl_build_envelope_sms_download (T_rp_data_dl *rp_data_dl); | |
800 EXTERN void tl_mnsms_read_cnf (UBYTE mem_type, | |
801 UBYTE record, | |
802 UBYTE *data, | |
803 USHORT error); | |
804 | |
805 | |
806 | |
807 EXTERN void tl_mnsms_store_cnf (UBYTE mem_type, | |
808 UBYTE record, | |
809 USHORT error); | |
810 EXTERN void tl_mnsms_submit_cnf (UBYTE mem_type, | |
811 UBYTE record, | |
812 UBYTE tp_mr, | |
813 USHORT cause, | |
814 T_sms_sdu *sms_sdu); | |
815 EXTERN void tl_mnsms_command_cnf (UBYTE tp_mr, | |
816 USHORT cause, | |
817 T_sms_sdu *sms_sdu); | |
818 EXTERN void tl_mnsms_delete_cnf (UBYTE mem_type, | |
819 UBYTE record, | |
820 UBYTE next_rec, | |
821 USHORT error); | |
822 EXTERN void tl_mnsms_resume_cnf (USHORT cause); | |
823 EXTERN void tl_mnsms_query_cnf (U8 query_type, | |
824 U8 status); | |
825 | |
826 /* | |
827 * Prototypes Transfer-Layer Signals | |
828 */ | |
829 EXTERN void tl_establish_cnf (BOOL success); | |
830 EXTERN void tl_establish_cnf_send (void); | |
831 EXTERN void tl_establish_cnf_rtx (void); | |
832 EXTERN void tl_establish_cnf_cmd (void); | |
833 EXTERN void tl_data_ind (T_rp_data_dl *rp_data_dl); | |
834 EXTERN void tl_report_ind (T_rp_user_data *rp_user_data, | |
835 USHORT cause); | |
836 EXTERN void tl_timeout_ind (USHORT timer_id); | |
837 | |
838 | |
839 /* | |
840 * Prototypes Transfer-Layer Functions | |
841 */ | |
842 EXTERN void tl_establish_connection (BOOL incr); | |
843 EXTERN void tl_build_status_rep (T_rp_data_dl *rp_data_dl, | |
844 T_MNSMS_STATUS_IND *status_ind); | |
845 EXTERN BOOL tl_modify_submit (T_SIM_PDU *sim_pdu, | |
846 UBYTE modify, | |
847 T_sms_sdu *sms_sdu, | |
848 UBYTE *rec_data); | |
849 EXTERN BOOL tl_prepare_submit (T_SIM_PDU *sim_pdu, | |
850 T_U_CP_DATA *cp_data); | |
851 EXTERN void tl_build_deliver_rep (T_MNSMS_ACK_RES *ack_res, | |
852 UBYTE msg_ref, | |
853 T_MMSMS_DATA_REQ *data_req, | |
854 T_U_CP_DATA *cp_data); | |
855 EXTERN USHORT tl_convert_sim_error (USHORT sim_error); | |
856 EXTERN BOOL tl_convert_mo_to_mem (T_MMSMS_DATA_REQ *data_req, | |
857 UBYTE *data); | |
858 EXTERN void tl_convert_mt_to_mem (T_rp_data_dl *rp_data_dl, | |
859 UBYTE *data); | |
860 EXTERN UBYTE tl_convert_sim_to_mmi (UBYTE mem_type, | |
861 UBYTE record, | |
862 UBYTE *data, | |
863 UBYTE length); | |
864 EXTERN void tl_message_ind_from_sim (UBYTE mem_type, | |
865 UBYTE record, | |
866 UBYTE max_record, | |
867 UBYTE *data); | |
868 EXTERN void tl_message_ind_from_net (UBYTE mem_type, | |
869 UBYTE record, | |
870 UBYTE max_record, | |
871 T_rp_data_dl *rp_data_dl); | |
872 EXTERN void tl_read_me_memory (USHORT index, | |
873 UBYTE status); | |
874 EXTERN void tl_read_sim_memory (USHORT index, | |
875 UBYTE status); | |
876 EXTERN void tl_sim_read_req (USHORT datafield, | |
877 UBYTE length); | |
878 EXTERN void tl_sim_read_record_req (UBYTE record); | |
879 EXTERN void tl_sim_update_req (UBYTE record, | |
880 UBYTE status, | |
881 UBYTE *data); | |
882 EXTERN void tl_sim_conv_update_req (UBYTE record, | |
883 T_rp_data_dl *rp_data_dl); | |
884 EXTERN void tl_handle_message (T_TP_DELIVER *sms_deliver); | |
885 #ifdef FF_SMS_23430 | |
886 EXTERN BOOL tl_handle_23430 (T_TP_DELIVER *sms_deliver); | |
887 #endif /* #ifdef FF_SMS_23430 */ | |
888 EXTERN void tl_build_sim_update_req (void); | |
889 EXTERN UBYTE tl_read_access_fifo (void); | |
890 EXTERN void tl_set_access_fifo (UBYTE access); | |
891 EXTERN BOOL tl_sms_memo_exceeded (BOOL avail); | |
892 EXTERN void tl_sms_memo_pause (void); | |
893 EXTERN void tl_sms_memo_resume (void); | |
894 EXTERN void tl_mnsms_report_ind (UBYTE ent_state); | |
895 EXTERN void tl_read_sim_message (USHORT index); | |
896 EXTERN void tl_find_first (UBYTE mem_type); | |
897 EXTERN void tl_find_next (UBYTE mem_type, | |
898 UBYTE index); | |
899 EXTERN void tl_adjust_message_len (UBYTE tp_vt_mti, | |
900 BUF_tpdu *tpdu); | |
901 EXTERN void tl_get_pid_dcs (UBYTE status, | |
902 T_sms_sdu *sms_sdu, | |
903 UBYTE *pid, | |
904 UBYTE *dcs); | |
905 EXTERN BOOL tl_find_status_pid (UBYTE mem_type, | |
906 UBYTE index, | |
907 UBYTE *data, | |
908 T_BACKUP *backup); | |
909 EXTERN UBYTE tl_get_free_space (UBYTE mem_type); | |
910 EXTERN void tl_store_pid (T_BACKUP *backup, | |
911 unsigned index, | |
912 UBYTE pid); | |
913 EXTERN void tl_store_status (T_BACKUP *backup, | |
914 unsigned index, | |
915 UBYTE status); | |
916 EXTERN UBYTE tl_get_status (T_BACKUP *backup, | |
917 unsigned index); | |
918 EXTERN int tl_check_mt_pid (T_BACKUP *backup, | |
919 unsigned index, | |
920 UBYTE pid); | |
921 EXTERN UBYTE tl_check_status_value (UBYTE status); | |
922 EXTERN int tl_search_record (T_BACKUP *backup, | |
923 USHORT index, | |
924 UBYTE status); | |
925 EXTERN UBYTE tl_search_record_for_delete (T_BACKUP *backup, | |
926 UBYTE index, | |
927 UBYTE status); | |
928 EXTERN BOOL tl_check_replace_entry (UBYTE *new_data, | |
929 UBYTE *old_data); | |
930 EXTERN void tl_replace_message (T_TP_DELIVER *sms_deliver); | |
931 EXTERN void tl_sim_toolkit_confirm (T_SIM_TOOLKIT_CNF *toolkit_cnf); | |
932 EXTERN void tl_cmms_start (void); | |
933 EXTERN void tl_cmms_end (void); | |
934 EXTERN void tl_mnsms_cmms_end_ind (void); | |
935 #ifdef FF_SMS_NW_RCG_SIM | |
936 EXTERN void tl_check_network_on_sim (UBYTE *data); | |
937 #endif /* #ifdef FF_SMS_NW_RCG_SIM */ | |
938 EXTERN void tl_pause (void); | |
939 EXTERN void tl_resume (void); | |
940 EXTERN void tl_query_deliver_status (void); | |
941 EXTERN BOOL tl_concat_check (T_sms_sdu *sms_sdu); | |
942 EXTERN void tl_concat_cntrl (T_SMS_CONCAT_HDR *concat_hdr); | |
943 | |
944 #ifdef REL99 | |
945 EXTERN void tl_mnsms_retrans_req (T_MNSMS_RETRANS_REQ *mnsms_retrans_req); | |
946 EXTERN void tl_mnsms_retrans_cnf (UBYTE mem_type, | |
947 UBYTE record, | |
948 UBYTE tp_mr, | |
949 USHORT cause, | |
950 T_sms_sdu *sms_sdu ); | |
951 EXTERN void tl_mnsms_send_prog_ind (); | |
952 #endif | |
953 | |
954 | |
955 EXTERN BOOL tl_sms_reserve_req_id (UBYTE *acc_ix_ptr); | |
956 | |
957 /* | |
958 * Prototypes Relay-Layer Primitives | |
959 */ | |
960 | |
961 EXTERN void rl_init (void); | |
962 | |
963 /* | |
964 * Prototypes Relay-Layer Signals | |
965 */ | |
966 EXTERN void rl_establish_req (UBYTE ti); | |
967 EXTERN void rl_establish_cnf (BOOL success); | |
968 EXTERN void rl_release_req (UBYTE ti); | |
969 EXTERN void rl_data_ind (T_cp_user_data_dl *cp_user_data_dl); | |
970 EXTERN BOOL rl_data_req (UBYTE msg_ref, | |
971 T_U_CP_DATA *cp_data); | |
972 EXTERN void rl_error_ind (USHORT cause); | |
973 EXTERN void rl_report_req_ack (T_rp_user_data *rp_user_data); | |
974 EXTERN void rl_report_req_error (USHORT cause, | |
975 T_rp_user_data *rp_user_data); | |
976 EXTERN BOOL rl_mem_avail_req (void); | |
977 EXTERN void rl_start_tram_req (void); | |
978 | |
979 /* | |
980 * Prototypes Relay-Layer Functions | |
981 */ | |
982 | |
983 EXTERN void rl_build_rp_error (UBYTE msg_ref, | |
984 USHORT error, | |
985 T_U_CP_DATA *cp_data, | |
986 T_rp_user_data *rp_user_data); | |
987 EXTERN void rl_build_rp_smma (UBYTE msg_ref, | |
988 T_U_CP_DATA *cp_data); | |
989 EXTERN UBYTE rl_temp_failure (UBYTE cause); | |
990 #ifdef GPRS | |
991 | |
992 EXTERN void rl_proceed (void); | |
993 | |
994 EXTERN void rl_build_rp_error_gprs (UBYTE ti, | |
995 T_LL_UNITDATA_REQ *data_req, | |
996 USHORT error, | |
997 UBYTE msg_ref, | |
998 T_U_CP_DATA *cp_data, | |
999 T_stk_cmd *stk_cmd); | |
1000 #endif /* #ifdef GPRS */ | |
1001 | |
1002 /* | |
1003 * Prototypes Control-Protocol Primitives | |
1004 */ | |
1005 | |
1006 EXTERN void cp_init (void); | |
1007 EXTERN void cp_mmsms_error_ind (T_MMSMS_ERROR_IND *error_ind); | |
1008 EXTERN void cp_mmsms_establish_cnf (T_MMSMS_ESTABLISH_CNF *establish_cnf); | |
1009 EXTERN void cp_mmsms_release_ind (T_MMSMS_RELEASE_IND *release_ind); | |
1010 EXTERN void for_mmsms_establish_ind (T_MMSMS_ESTABLISH_IND *establish_ind); | |
1011 EXTERN void for_mmsms_data_ind (T_MMSMS_DATA_IND *data_ind); | |
1012 #if defined (GPRS) | |
1013 EXTERN void for_ll_unitdata_ind (T_LL_UNITDATA_IND *unitdata_ind); | |
1014 EXTERN void for_ll_unitready_ind (T_LL_UNITREADY_IND *unitready_ind); | |
1015 EXTERN void cp_gmmsms_reg_state_cnf (T_GMMSMS_REG_STATE_CNF *reg_state_res); | |
1016 #endif | |
1017 | |
1018 /* | |
1019 * Prototypes Control-Protocol Signals | |
1020 */ | |
1021 EXTERN void cp_establish_req (UBYTE ti); | |
1022 EXTERN void cp_abort_req (void); | |
1023 EXTERN void cp_data_ind_cp_ack (void); | |
1024 EXTERN void cp_data_ind_cp_data (T_D_CP_DATA *cp_data); | |
1025 EXTERN void cp_data_ind_cp_error (UBYTE errcs); | |
1026 EXTERN void cp_data_ind_cp_unknown (void); | |
1027 EXTERN void cp_data_req (T_U_CP_DATA *cp_data); | |
1028 EXTERN void cp_est_ind_cp_ack (void); | |
1029 EXTERN void cp_est_ind_cp_data (T_D_CP_DATA *cp_data); | |
1030 EXTERN void cp_est_ind_cp_error (UBYTE cp_error); | |
1031 EXTERN void cp_est_ind_cp_unknown (void); | |
1032 EXTERN void cp_release_req (UBYTE ti); | |
1033 #if defined (GPRS) | |
1034 EXTERN void cp_send_data_gsms (void); | |
1035 EXTERN void cp_data_req_gsms (T_MMSMS_DATA_REQ *rp_data); | |
1036 EXTERN void cp_error_req_gsms (UBYTE cause, | |
1037 BOOL free_ti); | |
1038 EXTERN void cp_send_getunitdata_req (void); | |
1039 #endif | |
1040 | |
1041 | |
1042 /* | |
1043 * Prototypes Control-Protocol Functions | |
1044 */ | |
1045 | |
1046 EXTERN void cp_add_pd_ti (UBYTE ti, | |
1047 T_sdu *sdu); | |
1048 EXTERN void cp_build_cp_ack (void); | |
1049 EXTERN void cp_build_cp_error (UBYTE error); | |
1050 EXTERN void cp_send_release_req (UBYTE ti); | |
1051 | |
1052 #if defined (GPRS) | |
1053 EXTERN void cp_init_ll_unitdata_req (T_LL_UNITDATA_REQ *unitdata_req); | |
1054 #endif | |
1055 /* | |
1056 * If all entities are linked into one module this definitions | |
1057 * prefixes all this functions with the enity name | |
1058 */ | |
1059 | |
1060 /* | |
1061 * Prototypes Timer | |
1062 */ | |
1063 EXTERN void sms_timer_start (USHORT id); | |
1064 EXTERN void sms_timer_stop (USHORT id); | |
1065 EXTERN BOOL sms_timer_check (USHORT id); | |
1066 /* | |
1067 * If all entities are linked into one module this definitions | |
1068 * prefixes all this functions with the enity name | |
1069 */ | |
1070 #ifdef OPTION_MULTITHREAD | |
1071 #define tim_exec_timeout _ENTITY_PREFIXED(tim_exec_timeout) | |
1072 #define tim_start_timer _ENTITY_PREFIXED(tim_start_timer) | |
1073 #define tim_stop_timer _ENTITY_PREFIXED(tim_stop_timer) | |
1074 #endif /* #ifdef OPTION_MULTITHREAD */ | |
1075 EXTERN void tim_exec_timeout (USHORT index); | |
1076 EXTERN void tim_start_timer (USHORT index, T_TIME value); | |
1077 EXTERN void tim_stop_timer (USHORT index); | |
1078 | |
1079 EXTERN void tim_tc1m (void); | |
1080 EXTERN void tim_tr1m (void); | |
1081 EXTERN void tim_tr2m (void); | |
1082 EXTERN void tim_tram (void); | |
1083 EXTERN void tim_tlct (void); | |
1084 EXTERN void tim_tmms (void); | |
1085 | |
1086 /* | |
1087 * SMS primitives Engineering Mode | |
1088 * Bitmask for the event tracing | |
1089 */ | |
1090 | |
1091 /* | |
1092 * Prototypes Customer Specific Functions | |
1093 */ | |
1094 | |
1095 EXTERN UBYTE csf_get_new_mo_ti(); | |
1096 EXTERN T_SMS_DATA *csf_get_sms_instance (UBYTE ti); | |
1097 EXTERN T_SMS_DATA *csf_get_new_sms_instance (UBYTE ti); | |
1098 EXTERN void csf_free_sms_instance (UBYTE ti); | |
1099 | |
1100 #define TIMERSTART(i,v) tim_start_timer (i, v); | |
1101 #define TIMERSTOP(i) tim_stop_timer (i); | |
1102 | |
1103 /* | |
1104 * If all entities are linked into one module this definitions | |
1105 * prefixes the global data with the enity name | |
1106 */ | |
1107 #ifdef OPTION_MULTITHREAD | |
1108 #ifdef TI_PS_HCOMM_CHANGE | |
1109 #else | |
1110 #define hCommMMI _ENTITY_PREFIXED(hCommMMI) | |
1111 #define hCommMM _ENTITY_PREFIXED(hCommMM) | |
1112 #define hCommSIM _ENTITY_PREFIXED(hCommSIM) | |
1113 #endif /* TI_PS_HCOMM_CHANGE */ | |
1114 #ifdef GPRS | |
1115 #define hCommLLC _ENTITY_PREFIXED(hCommLLC) | |
1116 #define hCommGMM _ENTITY_PREFIXED(hCommGMM) | |
1117 #endif /* GPRS */ | |
1118 | |
1119 #define _decodedMsg _ENTITY_PREFIXED(_decodedMsg) | |
1120 #define _CCDbuf _ENTITY_PREFIXED(_CCDBuf) | |
1121 #define data_base _ENTITY_PREFIXED(data_base) | |
1122 #endif /* #ifdef OPTION_MULTITHREAD */ | |
1123 #ifdef TI_PS_HCOMM_CHANGE | |
1124 #else | |
1125 EXTERN T_HANDLE hCommMMI; /* MMI Communication */ | |
1126 EXTERN T_HANDLE hCommSIM; /* SIM Communication */ | |
1127 EXTERN T_HANDLE hCommMM; /* MM Communication */ | |
1128 #endif /* TI_PS_HCOMM_CHANGE */ | |
1129 #ifdef GPRS | |
1130 EXTERN T_HANDLE hCommLLC; /* LLC Communication */ | |
1131 EXTERN T_HANDLE hCommGMM; /* GMM Communication */ | |
1132 #endif /* GPRS */ | |
1133 EXTERN T_HANDLE sms_handle; | |
1134 | |
1135 #ifndef SHARED_CCD_BUF | |
1136 #define CCD_START | |
1137 #define CCD_END | |
1138 EXTERN UBYTE _decodedMsg []; | |
1139 #else | |
1140 EXTERN UBYTE * _decodedMsg; | |
1141 EXTERN UBYTE _CCDbuf; | |
1142 #define CCD_START if(!_CCDbuf){_decodedMsg = ccd_begin();_CCDbuf=TRUE;} | |
1143 #define CCD_END if(_CCDbuf){ccd_end();_CCDbuf=FALSE;} | |
1144 #endif /* else, #ifndef SHARED_CCD_BUF */ | |
1145 | |
1146 EXTERN T_SMS_DATA data_base; | |
1147 | |
1148 #define GET_INSTANCE(p) &data_base | |
1149 | |
1150 #define GET_INSTANCE_DATA register T_SMS_DATA *sms_data= &data_base | |
1151 | |
1152 #if !defined(NTRACE) && !defined(NCONFIG) | |
1153 /* | |
1154 * If all entities are linked into one module this definitions | |
1155 * prefixes the global data with the entity name | |
1156 */ | |
1157 #ifdef OPTION_MULTITHREAD | |
1158 #define partab _ENTITY_PREFIXED(partab) | |
1159 #endif /* #ifdef OPTION_MULTITHREAD */ | |
1160 | |
1161 EXTERN const KW_DATA partab[]; | |
1162 #endif /* #if !defined(NTRACE) && !defined(NCONFIG) */ | |
1163 | |
1164 /* Implements Measure#32: Row 84, 96, 87, 89, 95, 97, 104, 109 & 113 */ | |
1165 EXTERN const char * const ef_sms_id; | |
1166 | |
1167 #define SMS_INST_TC1M ((USHORT)(TC1M*MAX_SMS_CALLS+sms_data->inst)) | |
1168 #define SMS_INST_TR1M ((USHORT)(TR1M*MAX_SMS_CALLS+sms_data->inst)) | |
1169 #define SMS_INST_TR2M ((USHORT)(TR2M*MAX_SMS_CALLS+sms_data->inst)) | |
1170 #define SMS_INST_TRAM ((USHORT)(TRAM*MAX_SMS_CALLS+sms_data->inst)) | |
1171 #define SMS_INST_TLCT ((USHORT)(TLCT*MAX_SMS_CALLS+sms_data->inst)) | |
1172 | |
1173 #endif /* #ifndef SMS_H */ |