comparison src/g23m-fad/t30/t30_tim.c @ 174:90eb61ecd093

src/g23m-fad: initial import from TCS3.2/LoCosto
author Mychaela Falconia <falcon@freecalypso.org>
date Wed, 12 Oct 2016 05:40:46 +0000
parents
children
comparison
equal deleted inserted replaced
173:bf64d785238a 174:90eb61ecd093
1 /*
2 +-----------------------------------------------------------------------------
3 | Project : GSM-F&D (8411)
4 | Modul : T30_TIM
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 T30 of the mobile station
19 +-----------------------------------------------------------------------------
20 */
21
22 #ifndef T30_TIM_C
23 #define T30_TIM_C
24 #endif
25
26 #define ENTITY_T30
27
28 /*==== INCLUDES ===================================================*/
29
30 #include <string.h>
31 #include <stdlib.h>
32 #include <stddef.h>
33 #include "typedefs.h"
34 #include "pcm.h"
35 #include "vsi.h"
36 #include "macdef.h"
37 #include "pconst.cdg"
38 #include "mconst.cdg"
39 #include "message.h"
40 #include "ccdapi.h"
41 #include "custom.h"
42 #include "gsm.h"
43 #include "prim.h"
44 #include "cnf_t30.h"
45 #include "mon_t30.h"
46 #include "pei.h"
47 #include "tok.h"
48 #include "dti.h" /* functionality of the dti library */
49 #include "t30.h"
50
51 /*==== EXPORT =====================================================*/
52
53 /*==== PRIVAT =====================================================*/
54
55 /*==== VARIABLES ==================================================*/
56
57 /*==== FUNCTIONS ==================================================*/
58
59 /*
60 +--------------------------------------------------------------------+
61 | PROJECT : GSM-F&D (8411) MODULE : T30_TIM |
62 | STATE : code ROUTINE : tim_t1 |
63 +--------------------------------------------------------------------+
64
65 PURPOSE : Timeout of timer T1
66
67 */
68 LOCAL void tim_t1 (void)
69 {
70 TRACE_FUNCTION ("tim_t1()");
71
72 switch (GET_STATE (KER))
73 {
74 case T30_IDLE:
75 snd_error_ind(ERR_PH_A_T1_TIMEOUT);
76 break;
77
78 #ifdef _SIMULATION_ /* test of timer T1 */
79 case T30_RCV_DIS:
80 #endif
81 case T30_RCV_DCS:
82 snd_error_ind(ERR_PH_A_T1_TIMEOUT);
83 TIMERSTOP (T4_INDEX);
84 SET_STATE (KER, T30_IDLE);
85 break;
86
87 default:
88 break;
89 }
90 t30_data->data_cnf = FALSE;
91 }
92
93 /*
94 +--------------------------------------------------------------------+
95 | PROJECT : GSM-F&D (8411) MODULE : T30_TIM |
96 | STATE : code ROUTINE : tim_t2 |
97 +--------------------------------------------------------------------+
98
99 PURPOSE : Timeout of timer T2
100
101 */
102
103 LOCAL void tim_t2 (void)
104 {
105 TRACE_FUNCTION ("tim_t2()");
106
107 switch (GET_STATE (KER))
108 {
109 case T30_RCV_TCF:
110 snd_error_ind(ERR_PH_B_RCV_NO_RESP);
111 SET_STATE (KER, T30_IDLE);
112 break;
113
114 case T30_RCV_DCN:
115 case T30_RCV_MSG:
116 case T30_RCV_PST:
117 snd_error_ind(ERR_PH_D_RCV_NO_RESP);
118 SET_STATE (KER, T30_IDLE);
119 break;
120
121 case T30_RCV_T2:
122 snd_complete_ind(CMPL_EOM);
123 break;
124
125 default:
126 break;
127 }
128 t30_data->rate_modified = FALSE;
129 t30_data->data_cnf = FALSE;
130 }
131
132 /*
133 +--------------------------------------------------------------------+
134 | PROJECT : GSM-F&D (8411) MODULE : T30_TIM |
135 | STATE : code ROUTINE : tim_t4 |
136 +--------------------------------------------------------------------+
137
138 PURPOSE : Timeout of timer T4
139
140 */
141
142 LOCAL void tim_t4 (void)
143 {
144 TRACE_FUNCTION ("tim_t4()");
145
146 if (!t30_data->data_cnf)
147 TRACE_EVENT ("*** no fad_data_cnf received");
148
149 switch (GET_STATE (KER))
150 {
151 case T30_RCV_DCS:
152 {
153 if (t30_data->rate_modified)
154 {
155 TIMERSTART (T4_INDEX, T4_VALUE);
156 break;
157 }
158 SET_STATE (KER, T30_RCV_DIS);
159
160 if (t30_data->data_cnf)
161 ker_send_dis ();
162 else
163 TIMERSTART (T4_INDEX, T4_VALUE);
164
165 break;
166 }
167
168 case T30_SND_CFR:
169 {
170 if (t30_data->repeat EQ 3)
171 {
172 snd_error_ind(ERR_PH_B_SND_DCS_RPTD_3_TIMES);
173 SET_STATE (KER, T30_DCN);
174 if (t30_data->data_cnf)
175 {
176 _decodedMsg[0] = BCS_DCN;
177 sig_ker_bcs_bdat_req (FINAL_YES);
178 }
179 }
180 else
181 {
182 t30_data->repeat++;
183 if (t30_data->data_cnf)
184 {
185 SET_STATE (KER, T30_SND_CAP);
186 snd_t30_sgn_ind(SGN_NO_RES);
187 }
188 else
189 {
190 TIMERSTART (T4_INDEX, T4_VALUE);
191 }
192 }
193 break;
194 }
195
196 case T30_SND_DCN:
197 {
198 snd_complete_ind(CMPL_EOP);
199 break;
200 }
201
202 case T30_SND_MCF:
203 {
204 if (t30_data->repeat EQ 3)
205 {
206 switch (t30_data->sgn_req)
207 {
208 case SGN_EOM:
209 case SGN_PRI_EOM:
210 snd_error_ind(ERR_PH_D_SND_EOM_RPTD_3_TIMES);
211 break;
212
213 case SGN_EOP:
214 case SGN_PRI_EOP:
215 snd_error_ind(ERR_PH_D_SND_EOP_RPTD_3_TIMES);
216 break;
217
218 case SGN_MPS:
219 case SGN_PRI_MPS:
220 snd_error_ind(ERR_PH_D_SND_MPS_RPTD_3_TIMES);
221 break;
222
223 default:
224 snd_error_ind(ERR_PH_D_SND_UNSPEC);
225 break;
226 }
227 SET_STATE (KER, T30_DCN);
228 if (t30_data->data_cnf)
229 {
230 _decodedMsg[0] = BCS_DCN;
231 sig_ker_bcs_bdat_req (FINAL_YES);
232 }
233 }
234 else /* t30_data->repeat < 3 */
235 {
236 t30_data->repeat++;
237 act_on_sgn_req();
238 if (!t30_data->data_cnf)
239 {
240 TIMERSTART (T4_INDEX, T4_VALUE);
241 }
242 }
243 break;
244 }
245
246 default:
247 break;
248
249 } /* end switch */
250
251 t30_data->data_cnf = FALSE;
252 }
253
254 /*
255 +--------------------------------------------------------------------+
256 | PROJECT : GSM-F&D (8411) MODULE : T30_TIM |
257 | STATE : code ROUTINE : t30_timeout |
258 +--------------------------------------------------------------------+
259
260 PURPOSE : execute timeout function
261
262 */
263
264 GLOBAL void t30_timeout (USHORT index)
265 {
266 TRACE_FUNCTION ("t30_timeout()");
267 switch (index)
268 {
269 case T1_INDEX:
270 tim_t1 ();
271 break;
272 case T2_INDEX:
273 tim_t2 ();
274 break;
275 case T4_INDEX:
276 tim_t4 ();
277 break;
278 }
279 }
280