FreeCalypso > hg > freecalypso-citrine
comparison g23m-gsm/cc/cc_time.c @ 0:75a11d740a02
initial import of gsm-fw from freecalypso-sw rev 1033:5ab737ac3ad7
author | Mychaela Falconia <falcon@freecalypso.org> |
---|---|
date | Thu, 09 Jun 2016 00:02:41 +0000 |
parents | |
children |
comparison
equal
deleted
inserted
replaced
-1:000000000000 | 0:75a11d740a02 |
---|---|
1 /* | |
2 +----------------------------------------------------------------------------- | |
3 | Project : GSM-PS (6147) | |
4 | Modul : CC_TIME | |
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 : This Modul defines the timer handling functions | |
18 | for the component CC of the mobile station | |
19 +----------------------------------------------------------------------------- | |
20 */ | |
21 | |
22 #ifndef CC_TIM_C | |
23 #define CC_TIM_C | |
24 | |
25 #include "config.h" | |
26 #include "fixedconf.h" | |
27 #include "condat-features.h" | |
28 | |
29 #define ENTITY_CC | |
30 /*==== INCLUDES ===================================================*/ | |
31 | |
32 #include <string.h> | |
33 #include "typedefs.h" | |
34 #include "pcm.h" | |
35 #include "vsi.h" | |
36 #include "custom.h" | |
37 #include "gsm.h" | |
38 #include "message.h" | |
39 #include "ccdapi.h" | |
40 #include "prim.h" | |
41 #include "cnf_cc.h" | |
42 #include "mon_cc.h" | |
43 #include "pei.h" | |
44 #include "tok.h" | |
45 #include "cc.h" | |
46 #include "cc_em.h" | |
47 | |
48 /*==== EXPORT =====================================================*/ | |
49 /*==== PRIVAT =====================================================*/ | |
50 /*==== PROTOTYPES =====================================================*/ | |
51 /* Implements Measure# 30, 31 */ | |
52 LOCAL void tim_mncc_rel_ind (void); | |
53 /*==== VARIABLES ==================================================*/ | |
54 | |
55 /*==== FUNCTIONS ==================================================*/ | |
56 | |
57 /* | |
58 +--------------------------------------------------------------------+ | |
59 | PROJECT : GSM-PS (6147) MODULE : CC_TIM | | |
60 | STATE : code ROUTINE : tim_exec_timeout | | |
61 +--------------------------------------------------------------------+ | |
62 | |
63 PURPOSE : execute timeout | |
64 | |
65 */ | |
66 | |
67 GLOBAL void tim_exec_timeout (USHORT index) | |
68 { | |
69 GET_INSTANCE_DATA; | |
70 | |
71 TRACE_FUNCTION ("tim_exec_timeout()"); | |
72 | |
73 /* | |
74 * Processing of Timeout Function | |
75 */ | |
76 if (index < MAX_CC_CALLS) | |
77 { | |
78 /* | |
79 * Not DTMF (T336, T337), any other CC timer | |
80 */ | |
81 cc_data->ti = cc_data->stored_ti_values[index]; | |
82 cc_data->index_ti = (UBYTE)index; | |
83 | |
84 switch (cc_data->state[cc_data->index_ti]) | |
85 { | |
86 case M_CC_CS_01: | |
87 tim_t303_u0_1 (); | |
88 break; | |
89 case M_CC_CS_03: | |
90 tim_t332_u0_3 (); | |
91 break; | |
92 case M_CC_CS_05: | |
93 tim_t335_u0_5 (); | |
94 break; | |
95 case M_CC_CS_1: | |
96 tim_t303_u1 (); | |
97 break; | |
98 case M_CC_CS_3: | |
99 tim_t310_u3 (); | |
100 break; | |
101 case M_CC_CS_8: | |
102 tim_t313_u8 (); | |
103 break; | |
104 case M_CC_CS_11: | |
105 tim_t305_u11 (); | |
106 break; | |
107 case M_CC_CS_19: | |
108 tim_t308_u19 (); | |
109 break; | |
110 case M_CC_CS_26: | |
111 tim_t323_u26 (); | |
112 break; | |
113 } | |
114 } | |
115 else | |
116 { | |
117 /* | |
118 * DTMF timer, either T336 or T337 | |
119 */ | |
120 T_DTMF * p_dtmf; | |
121 | |
122 cc_data->index_ti = (UBYTE)(index - MAX_CC_CALLS); | |
123 cc_data->ti = cc_data->stored_ti_values[cc_data->index_ti]; | |
124 p_dtmf = &cc_data->dtmf[cc_data->index_ti]; | |
125 | |
126 switch (p_dtmf->state) | |
127 { | |
128 case DTMF_SEND_REQUEST: | |
129 tim_t336 (); | |
130 break; | |
131 case DTMF_STOP_REQUEST: | |
132 tim_t337 (); | |
133 break; | |
134 default: /* Not expected */ | |
135 break; | |
136 } | |
137 } | |
138 } | |
139 /* | |
140 +--------------------------------------------------------------------+ | |
141 | PROJECT : GSM-PS (6147) MODULE : CC_TIM | | |
142 | STATE : code ROUTINE : tim_t303_u0_1 | | |
143 +--------------------------------------------------------------------+ | |
144 | |
145 PURPOSE : Timeout of timer T303 in state U0.1 | |
146 | |
147 */ | |
148 | |
149 GLOBAL void tim_t303_u0_1 () | |
150 { | |
151 PALLOC (rej_ind, MNCC_REJECT_IND); | |
152 | |
153 GET_INSTANCE_DATA; | |
154 | |
155 TRACE_FUNCTION ("tim_t303_u0_1()"); | |
156 | |
157 EM_CC_TIMEOUT_T303; | |
158 | |
159 rej_ind->ti = cc_data->ti; | |
160 rej_ind->cause = CAUSE_MAKE(DEFBY_STD, ORIGSIDE_MS, MNCC_CC_ORIGINATING_ENTITY, M_CC_CAUSE_TIMER); | |
161 PSENDX (MMI, rej_ind); | |
162 for_rel_req (); | |
163 cc_set_state (M_CC_CS_0); | |
164 } | |
165 | |
166 /* | |
167 +--------------------------------------------------------------------+ | |
168 | PROJECT : GSM-PS (6147) MODULE : CC_TIM | | |
169 | STATE : code ROUTINE : tim_t303_u1 | | |
170 +--------------------------------------------------------------------+ | |
171 | |
172 PURPOSE : Timeout of timer T303 in state U1 | |
173 | |
174 */ | |
175 | |
176 GLOBAL void tim_t303_u1 () | |
177 { | |
178 GET_INSTANCE_DATA; | |
179 | |
180 TRACE_FUNCTION ("tim_t303_u1()"); | |
181 | |
182 EM_CC_TIMEOUT_T303; | |
183 | |
184 cc_data->timer [cc_data->index_ti] = T303; | |
185 cc_disconnect_after_timeout (); | |
186 cc_set_state (M_CC_CS_11); | |
187 } | |
188 | |
189 /* | |
190 +--------------------------------------------------------------------+ | |
191 | PROJECT : GSM-PS (6147) MODULE : CC_TIM | | |
192 | STATE : code ROUTINE : tim_t305_u11 | | |
193 +--------------------------------------------------------------------+ | |
194 | |
195 PURPOSE : Timeout of timer T305 in state U11 | |
196 | |
197 */ | |
198 | |
199 GLOBAL void tim_t305_u11 () | |
200 { | |
201 PALLOC (disc_ind, MNCC_DISCONNECT_IND); | |
202 | |
203 GET_INSTANCE_DATA; | |
204 | |
205 TRACE_FUNCTION ("tim_t305_u11()"); | |
206 | |
207 cc_data->timer [cc_data->index_ti] = T305; | |
208 CCD_START; | |
209 { | |
210 MCAST (release, U_RELEASE); | |
211 | |
212 cc_build_release (release, | |
213 cc_data->cc_cause[cc_data->index_ti], | |
214 NULL, MNCC_SS_VER_NOT_PRES); | |
215 for_release (release); | |
216 } | |
217 CCD_END; | |
218 | |
219 disc_ind->ti = cc_data->ti; | |
220 disc_ind->cause = cc_data->cc_cause [cc_data->index_ti]; | |
221 /* Setting raw_cause to empty as this is a local release | |
222 * of MM connection,CC is not receiving any cause value | |
223 * from Network | |
224 */ | |
225 disc_ind->c_raw_cause = 0; | |
226 disc_ind->diagnostic = NOT_PRESENT_8BIT; | |
227 disc_ind->progress_desc = MNCC_PROG_NOT_PRES; | |
228 PSENDX (MMI, disc_ind); | |
229 | |
230 TIMERSTART (T308, T308_VALUE); | |
231 cc_set_state (M_CC_CS_19); | |
232 } | |
233 | |
234 /* | |
235 +--------------------------------------------------------------------+ | |
236 | PROJECT : GSM-PS (6147) MODULE : CC_TIM | | |
237 | STATE : code ROUTINE : tim_t308_u19 | | |
238 +--------------------------------------------------------------------+ | |
239 | |
240 PURPOSE : Timeout of timer T308 in state U19 | |
241 | |
242 */ | |
243 | |
244 GLOBAL void tim_t308_u19 () | |
245 { | |
246 GET_INSTANCE_DATA; | |
247 | |
248 TRACE_FUNCTION ("tim_t308_u19()"); | |
249 | |
250 cc_data->timer [cc_data->index_ti] = T308; | |
251 | |
252 if (cc_data->t308_counter [cc_data->index_ti] EQ 0) | |
253 { | |
254 CCD_START; | |
255 { | |
256 MCAST (release, U_RELEASE); | |
257 | |
258 cc_data->t308_counter[cc_data->index_ti]++; | |
259 cc_build_release (release, | |
260 cc_data->cc_cause [cc_data->index_ti], | |
261 NULL, MNCC_SS_VER_NOT_PRES); | |
262 for_release (release); | |
263 } | |
264 CCD_END; | |
265 TIMERSTART (T308, T308_VALUE); | |
266 } | |
267 else | |
268 { | |
269 cc_reset_dtmf (); | |
270 | |
271 { | |
272 PALLOC (rel_cnf, MNCC_RELEASE_CNF); | |
273 rel_cnf->ti = cc_data->ti; | |
274 rel_cnf->cause = CAUSE_MAKE(DEFBY_STD, ORIGSIDE_MS, MNCC_CC_ORIGINATING_ENTITY, M_CC_CAUSE_TIMER); | |
275 rel_cnf->c_raw_cause = 0; | |
276 PSENDX (MMI, rel_cnf); | |
277 } | |
278 | |
279 for_rel_req (); | |
280 cc_set_state (M_CC_CS_0); | |
281 } | |
282 } | |
283 | |
284 /* | |
285 +--------------------------------------------------------------------+ | |
286 | PROJECT : GSM-PS (6147) MODULE : CC_TIM | | |
287 | STATE : code ROUTINE : tim_t310_u3 | | |
288 +--------------------------------------------------------------------+ | |
289 | |
290 PURPOSE : Timeout of timer T310 in state U3 | |
291 | |
292 */ | |
293 | |
294 GLOBAL void tim_t310_u3 () | |
295 { | |
296 GET_INSTANCE_DATA; | |
297 | |
298 TRACE_FUNCTION ("tim_t310_u3()"); | |
299 | |
300 cc_data->timer [cc_data->index_ti] = T310; | |
301 cc_disconnect_after_timeout (); | |
302 cc_set_state (M_CC_CS_11); | |
303 } | |
304 | |
305 /* | |
306 +--------------------------------------------------------------------+ | |
307 | PROJECT : GSM-PS (6147) MODULE : CC_TIM | | |
308 | STATE : code ROUTINE : tim_t313_u8 | | |
309 +--------------------------------------------------------------------+ | |
310 | |
311 PURPOSE : Timeout of timer T313 in state U8 | |
312 | |
313 */ | |
314 | |
315 GLOBAL void tim_t313_u8 () | |
316 { | |
317 GET_INSTANCE_DATA; | |
318 | |
319 PALLOC (setup_comp, MNCC_SETUP_COMPL_IND); | |
320 | |
321 TRACE_FUNCTION ("tim_t313_u8()"); | |
322 | |
323 EM_CC_DISCONNECT_SENT; | |
324 | |
325 cc_data->timer [cc_data->index_ti] = T313; | |
326 CCD_START; | |
327 { | |
328 MCAST (disconnect, U_DISCONNECT); | |
329 | |
330 cc_build_disconnect (disconnect, | |
331 CAUSE_MAKE(DEFBY_STD, | |
332 ORIGSIDE_MS, | |
333 MNCC_CC_ORIGINATING_ENTITY, | |
334 M_CC_CAUSE_TIMER), | |
335 NULL, MNCC_SS_VER_NOT_PRES); | |
336 for_disconnect (disconnect); | |
337 } | |
338 CCD_END; | |
339 | |
340 setup_comp->ti = cc_data->ti; | |
341 setup_comp->cause = CAUSE_MAKE(DEFBY_STD, | |
342 ORIGSIDE_MS, | |
343 MNCC_CC_ORIGINATING_ENTITY, | |
344 M_CC_CAUSE_TIMER); | |
345 PSENDX (MMI, setup_comp); | |
346 TIMERSTART (T305, T305_VALUE); | |
347 cc_set_state (M_CC_CS_11); | |
348 } | |
349 | |
350 /* | |
351 +--------------------------------------------------------------------+ | |
352 | PROJECT : GSM-PS (6147) MODULE : CC_TIM | | |
353 | STATE : code ROUTINE : tim_t323_u26 | | |
354 +--------------------------------------------------------------------+ | |
355 | |
356 PURPOSE : Timeout of timer T323 in state U26 | |
357 | |
358 */ | |
359 | |
360 GLOBAL void tim_t323_u26 () | |
361 { | |
362 GET_INSTANCE_DATA; | |
363 | |
364 PALLOC (modify_cnf, MNCC_MODIFY_CNF); | |
365 | |
366 TRACE_FUNCTION ("tim_t323_u26()"); | |
367 | |
368 cc_data->timer [cc_data->index_ti] = T323; | |
369 | |
370 CCD_START; | |
371 { | |
372 MCAST (disconnect, U_DISCONNECT); | |
373 | |
374 cc_build_disconnect (disconnect, | |
375 CAUSE_MAKE(DEFBY_STD, | |
376 ORIGSIDE_MS, | |
377 MNCC_CC_ORIGINATING_ENTITY, | |
378 M_CC_CAUSE_TIMER), | |
379 NULL, MNCC_SS_VER_NOT_PRES); | |
380 for_disconnect (disconnect); | |
381 } | |
382 CCD_END; | |
383 | |
384 modify_cnf->ti = cc_data->ti; | |
385 modify_cnf->cause = CAUSE_MAKE(DEFBY_STD, ORIGSIDE_MS, MNCC_CC_ORIGINATING_ENTITY, M_CC_CAUSE_TIMER); | |
386 /* Setting raw_cause to empty as we are not sending any cause from network*/ | |
387 modify_cnf->c_raw_cause = 0; | |
388 | |
389 PSENDX (MMI, modify_cnf); | |
390 | |
391 TIMERSTART (T305, T305_VALUE); | |
392 cc_set_state (M_CC_CS_11); | |
393 } | |
394 | |
395 /* | |
396 +--------------------------------------------------------------------+ | |
397 | PROJECT : GSM-PS (6147) MODULE : CC_TIM | | |
398 | STATE : code ROUTINE : tim_t332_u0_3 | | |
399 +--------------------------------------------------------------------+ | |
400 | |
401 PURPOSE : Timeout of timer T332 in state U0.3 | |
402 | |
403 */ | |
404 | |
405 GLOBAL void tim_t332_u0_3 () | |
406 { | |
407 GET_INSTANCE_DATA; | |
408 | |
409 TRACE_FUNCTION ("tim_t332_u0_3()"); | |
410 | |
411 cc_data->timer [cc_data->index_ti] = T332; | |
412 | |
413 /* Inform MMI */ | |
414 /* Implements Measure# 30, 31 */ | |
415 tim_mncc_rel_ind (); | |
416 | |
417 /* Send RELEASE COMPLETE to network */ | |
418 CCD_START; | |
419 { | |
420 MCAST (rel_com, U_RELEASE_COMP); | |
421 cc_build_release_complete (rel_com, CAUSE_MAKE(DEFBY_STD, | |
422 ORIGSIDE_MS, | |
423 MNCC_CC_ORIGINATING_ENTITY, | |
424 M_CC_CAUSE_TIMER)); | |
425 for_release_complete (rel_com); | |
426 } | |
427 CCD_END; | |
428 | |
429 /* Release MM connection */ | |
430 for_rel_req (); | |
431 | |
432 /* Next state is NULL */ | |
433 cc_set_state (M_CC_CS_0); | |
434 } | |
435 | |
436 /* | |
437 +--------------------------------------------------------------------+ | |
438 | PROJECT : GSM-PS (6147) MODULE : CC_TIM | | |
439 | STATE : code ROUTINE : tim_t335_u0_5 | | |
440 +--------------------------------------------------------------------+ | |
441 | |
442 PURPOSE : Timeout of timer T335 in state U0.5 | |
443 | |
444 */ | |
445 | |
446 GLOBAL void tim_t335_u0_5 () | |
447 { | |
448 GET_INSTANCE_DATA; | |
449 TRACE_FUNCTION ("tim_t335_u0_5()"); | |
450 | |
451 cc_data->timer [cc_data->index_ti] = T335; | |
452 | |
453 /* Forget stored setup container */ | |
454 PFREE (cc_data->stored_ccbs_setup); | |
455 cc_data->stored_ccbs_setup = NULL; | |
456 | |
457 /* Inform MMI */ | |
458 /* Implements Measure# 30, 31 */ | |
459 tim_mncc_rel_ind (); | |
460 | |
461 /* Send RELEASE COMPLETE to network */ | |
462 CCD_START; | |
463 { | |
464 MCAST (rel_com, U_RELEASE_COMP); | |
465 cc_build_release_complete (rel_com, CAUSE_MAKE(DEFBY_STD, | |
466 ORIGSIDE_MS, | |
467 MNCC_CC_ORIGINATING_ENTITY, | |
468 M_CC_CAUSE_TIMER)); | |
469 for_release_complete (rel_com); | |
470 } | |
471 CCD_END; | |
472 | |
473 /* Release MM connection */ | |
474 for_rel_req (); | |
475 | |
476 /* Next state is NULL */ | |
477 cc_set_state (M_CC_CS_0); | |
478 } | |
479 | |
480 /* | |
481 +--------------------------------------------------------------------+ | |
482 | PROJECT : GSM-PS (6147) MODULE : CC_TIM | | |
483 | STATE : code ROUTINE : tim_t336 | | |
484 +--------------------------------------------------------------------+ | |
485 | |
486 PURPOSE : Timeout of timer T336 | |
487 | |
488 */ | |
489 | |
490 GLOBAL void tim_t336 () | |
491 { | |
492 GET_INSTANCE_DATA; | |
493 | |
494 T_DTMF * p_dtmf; | |
495 | |
496 TRACE_FUNCTION ("tim_t336()"); | |
497 | |
498 cc_data->timer [cc_data->index_ti] = T336; | |
499 p_dtmf = &cc_data->dtmf[cc_data->index_ti]; | |
500 | |
501 /* | |
502 * Send error indication to MMI. DTMF transmission maybe has failed. | |
503 * This point may be discussed, but TS 24.008 doesn't say that a | |
504 * positive indication as a feedback for a successful transmission | |
505 * should be generated. | |
506 */ | |
507 { | |
508 PALLOC (dtmf_cnf, MNCC_START_DTMF_CNF); | |
509 dtmf_cnf->ti = cc_data->ti; | |
510 dtmf_cnf->key = p_dtmf->key; | |
511 dtmf_cnf->cause = CAUSE_MAKE(DEFBY_STD, ORIGSIDE_MS, MNCC_CC_ORIGINATING_ENTITY, M_CC_CAUSE_TIMER); | |
512 dtmf_cnf->dtmf_mod = p_dtmf->mode; | |
513 PSENDX (MMI, dtmf_cnf); | |
514 } | |
515 | |
516 cc_stop_dtmf (); | |
517 } | |
518 | |
519 /* | |
520 +--------------------------------------------------------------------+ | |
521 | PROJECT : GSM-PS (6147) MODULE : CC_TIM | | |
522 | STATE : code ROUTINE : tim_t337 | | |
523 +--------------------------------------------------------------------+ | |
524 | |
525 PURPOSE : Timeout of timer T337 | |
526 | |
527 */ | |
528 | |
529 GLOBAL void tim_t337 () | |
530 { | |
531 GET_INSTANCE_DATA; | |
532 | |
533 TRACE_FUNCTION ("tim_t337()"); | |
534 | |
535 cc_data->timer [cc_data->index_ti] = T337; | |
536 | |
537 cc_stop_dtmf (); | |
538 } | |
539 | |
540 | |
541 /* Implements Measure# 30, 31 */ | |
542 /* | |
543 +--------------------------------------------------------------------+ | |
544 | PROJECT : GSM-PS (6147) MODULE : CC_TIM | | |
545 | STATE : code ROUTINE : tim_mncc_rel_ind | | |
546 +--------------------------------------------------------------------+ | |
547 | |
548 PURPOSE : Build and send MNCC_RELEASE_IND | |
549 | |
550 */ | |
551 | |
552 LOCAL void tim_mncc_rel_ind (void) | |
553 { | |
554 GET_INSTANCE_DATA; | |
555 | |
556 TRACE_FUNCTION ("tim_mncc_rel_ind"); | |
557 { | |
558 PALLOC (release, MNCC_RELEASE_IND); | |
559 release->ti = cc_data->ti; | |
560 release->cause = CAUSE_MAKE(DEFBY_STD, ORIGSIDE_MS, MNCC_CC_ORIGINATING_ENTITY, M_CC_CAUSE_TIMER); | |
561 release->c_raw_cause = 0; | |
562 PSENDX (MMI, release); | |
563 } | |
564 } | |
565 | |
566 #endif /* #ifndef CC_TIM_C */ |