FreeCalypso > hg > fc-selenite
comparison src/g23m-fad/t30/t30_kers.c @ 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 : GSM-F&D (8411) | |
4 | Modul : t30_kers | |
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 functions for processing | |
18 | of incomming signals for the component T30 of the mobile station | |
19 +----------------------------------------------------------------------------- | |
20 */ | |
21 | |
22 #ifndef T30_KERS_C | |
23 #define T30_KERS_C | |
24 #endif | |
25 | |
26 #define ENTITY_T30 | |
27 | |
28 #define MEMCOPLEN(d,s,c) memcpy(t30_data->hdlc_rcv.d, s, MINIMUM(t30_data->hdlc_rcv.c, NSF_LEN)) | |
29 | |
30 /*==== INCLUDES ===================================================*/ | |
31 | |
32 #include <string.h> | |
33 #include <stdlib.h> | |
34 #include <stddef.h> | |
35 #include "typedefs.h" | |
36 #include "pcm.h" | |
37 #include "vsi.h" | |
38 #include "macdef.h" | |
39 #include "pconst.cdg" | |
40 #include "mconst.cdg" | |
41 #include "message.h" | |
42 #include "ccdapi.h" | |
43 #include "custom.h" | |
44 #include "gsm.h" | |
45 #include "prim.h" | |
46 #include "cnf_t30.h" | |
47 #include "mon_t30.h" | |
48 #include "pei.h" | |
49 #include "tok.h" | |
50 #include "dti.h" /* functionality of the dti library */ | |
51 #include "t30.h" | |
52 | |
53 /*==== CONST =======================================================*/ | |
54 /*==== TYPES =======================================================*/ | |
55 /*==== VAR EXPORT ==================================================*/ | |
56 /*==== VAR LOCAL ===================================================*/ | |
57 /*==== FUNCTIONS ===================================================*/ | |
58 | |
59 LOCAL void snd_fad_rcv_tcf_req(void) | |
60 { | |
61 PALLOC (fad_rcv_tcf_req, FAD_RCV_TCF_REQ); | |
62 fad_rcv_tcf_req->trans_rate = t30_data->trans_rate; | |
63 PSENDX (FAD, fad_rcv_tcf_req); | |
64 } | |
65 | |
66 LOCAL void snd_t30_cap_ind(void) | |
67 { | |
68 PALLOC (t30_cap_ind, T30_CAP_IND); | |
69 memcpy (&t30_cap_ind->hdlc_info, &t30_data->hdlc_rcv, sizeof(T_hdlc_info)); | |
70 memset (&t30_data->hdlc_rcv, 0, sizeof(T_hdlc_info)); | |
71 PSENDX (MMI, t30_cap_ind); | |
72 } | |
73 | |
74 GLOBAL void act_on_sgn_req(void) | |
75 { | |
76 switch (t30_data->sgn_req) | |
77 { | |
78 case SGN_EOM: | |
79 SET_STATE (KER, T30_SND_SGN); | |
80 _decodedMsg[0] = BCS_EOM; | |
81 sig_ker_bcs_bdat_req (FINAL_YES); | |
82 break; | |
83 | |
84 case SGN_EOP: | |
85 SET_STATE (KER, T30_SND_SGN); | |
86 _decodedMsg[0] = BCS_EOP; | |
87 sig_ker_bcs_bdat_req (FINAL_YES); | |
88 break; | |
89 | |
90 case SGN_MPS: | |
91 SET_STATE (KER, T30_SND_SGN); | |
92 _decodedMsg[0] = BCS_MPS; | |
93 sig_ker_bcs_bdat_req (FINAL_YES); | |
94 break; | |
95 | |
96 case SGN_PRI_EOM: | |
97 SET_STATE (KER, T30_SND_SGN); | |
98 _decodedMsg[0] = BCS_PRI_EOM; | |
99 sig_ker_bcs_bdat_req (FINAL_YES); | |
100 break; | |
101 | |
102 case SGN_PRI_EOP: | |
103 SET_STATE (KER, T30_SND_SGN); | |
104 _decodedMsg[0] = BCS_PRI_EOP; | |
105 sig_ker_bcs_bdat_req (FINAL_YES); | |
106 break; | |
107 | |
108 case SGN_PRI_MPS: | |
109 SET_STATE (KER, T30_SND_SGN); | |
110 _decodedMsg[0] = BCS_PRI_MPS; | |
111 sig_ker_bcs_bdat_req (FINAL_YES); | |
112 break; | |
113 | |
114 default: | |
115 break; | |
116 } | |
117 } | |
118 | |
119 /* | |
120 +--------------------------------------------------------------------+ | |
121 | PROJECT : GSM-F&D (8411) MODULE : T30_KERS | | |
122 | STATE : code ROUTINE : sig_bcs_ker_bdat_ind| | |
123 +--------------------------------------------------------------------+ | |
124 PURPOSE : Process signal BDAT_IND received from process BCS. | |
125 This signal contains a received HDLC frame from FAD, | |
126 decoded by CCD. | |
127 */ | |
128 | |
129 GLOBAL void sig_bcs_ker_bdat_ind (void) | |
130 { | |
131 TRACE_FUNCTION ("sig_bcs_ker_bdat_ind()"); | |
132 | |
133 switch (GET_STATE (KER)) | |
134 { | |
135 case T30_NULL: | |
136 #ifdef _SIMULATION_ /* test BCS formatter only */ | |
137 if (t30_data->test_mode & TST_BCS) | |
138 { | |
139 SHORT size = 0; | |
140 switch (_decodedMsg[0]) | |
141 { | |
142 case BCS_DIS: size = sizeof(T_BCS_DIS) ; break; | |
143 case BCS_CSI: size = sizeof(T_BCS_CSI) ; break; | |
144 case BCS_NSF: size = sizeof(T_BCS_NSF) ; break; | |
145 case BCS_DTC: size = sizeof(T_BCS_DTC) ; break; | |
146 case BCS_CIG: size = sizeof(T_BCS_CIG) ; break; | |
147 case BCS_NSC: size = sizeof(T_BCS_NSC) ; break; | |
148 case BCS_PWD_POLL: size = sizeof(T_BCS_PWD_POLL) ; break; | |
149 case BCS_SEP: size = sizeof(T_BCS_SEP) ; break; | |
150 case BCS_DCS: size = sizeof(T_BCS_DCS) ; break; | |
151 case BCS_TSI: size = sizeof(T_BCS_TSI) ; break; | |
152 case BCS_NSS: size = sizeof(T_BCS_NSS) ; break; | |
153 case BCS_SUB: size = sizeof(T_BCS_SUB) ; break; | |
154 case BCS_PWD_SND: size = sizeof(T_BCS_PWD_SND) ; break; | |
155 | |
156 case BCS_CFR: | |
157 case BCS_FTT: | |
158 case BCS_EOM: | |
159 case BCS_MPS: | |
160 case BCS_EOP: | |
161 case BCS_PRI_EOM: | |
162 case BCS_PRI_MPS: | |
163 case BCS_PRI_EOP: | |
164 case BCS_MCF: | |
165 case BCS_RTP: | |
166 case BCS_RTN: | |
167 case BCS_PIP: | |
168 case BCS_PIN: | |
169 case BCS_DCN: | |
170 case BCS_CRP: | |
171 size = 1; | |
172 break; | |
173 } | |
174 { | |
175 PALLOC_SDU (dti_data_test_ind, DTI2_DATA_TEST_IND, REPORT_SIZE_BITS); | |
176 dti_data_test_ind->link_id = t30_data->link_id; | |
177 dti_data_test_ind->parameters.p_id = DTI_PID_UOS; | |
178 dti_data_test_ind->parameters.st_lines.st_flow = DTI_FLOW_OFF; | |
179 dti_data_test_ind->parameters.st_lines.st_line_sa = DTI_SA_ON; | |
180 dti_data_test_ind->parameters.st_lines.st_line_sb = DTI_SB_ON; | |
181 dti_data_test_ind->parameters.st_lines.st_break_len = DTI_BREAK_OFF; | |
182 dti_data_test_ind->sdu.l_buf = size << 3; | |
183 dti_data_test_ind->sdu.o_buf = 0; | |
184 memcpy (dti_data_test_ind->sdu.buf, _decodedMsg, size); | |
185 PSENDX (MMI, dti_data_test_ind); | |
186 } | |
187 } | |
188 #endif | |
189 break; | |
190 | |
191 case T30_IDLE: | |
192 { | |
193 switch (_decodedMsg[0]) | |
194 { | |
195 case BCS_CIG: TRACE_EVENT ("Rec BCS_CIG"); | |
196 { | |
197 MCAST (bcs_cig, BCS_CIG); | |
198 t30_data->hdlc_rcv.c_cig = bcs_cig->c_clg_sub_nr; | |
199 MEMCOPSIZ(t30_data->hdlc_rcv.cig, bcs_cig->clg_sub_nr); | |
200 } | |
201 break; | |
202 | |
203 case BCS_CSI: TRACE_EVENT ("Rec BCS_CSI"); | |
204 { | |
205 MCAST (bcs_csi, BCS_CSI); | |
206 t30_data->hdlc_rcv.c_csi = bcs_csi->c_cld_sub_nr; | |
207 MEMCOPSIZ(t30_data->hdlc_rcv.csi, bcs_csi->cld_sub_nr); | |
208 } | |
209 break; | |
210 | |
211 case BCS_DCN: TRACE_EVENT ("Rec BCS_DCN"); | |
212 SET_STATE (KER, T30_IDLE); | |
213 TIMERSTOP (T1_INDEX); | |
214 snd_t30_sgn_ind(SGN_DCN); | |
215 break; | |
216 | |
217 case BCS_DIS: TRACE_EVENT ("Rec BCS_DIS"); | |
218 { | |
219 MCAST (bcs_dis, BCS_DIS); | |
220 TIMERSTOP (T1_INDEX); | |
221 ker_fill_dis_info (bcs_dis); | |
222 t30_data->fmod = FMOD_SND; | |
223 t30_data->repeat = 1; | |
224 t30_data->dir = 0x80; | |
225 snd_t30_cap_ind(); | |
226 SET_STATE (KER, T30_SND_CAP); | |
227 memset (&t30_data->hdlc_snd, 0, sizeof(T_hdlc_info)); | |
228 } | |
229 break; | |
230 | |
231 case BCS_DTC: TRACE_EVENT ("Rec BCS_DTC"); | |
232 { | |
233 MCAST (bcs_dtc, BCS_DTC); | |
234 TIMERSTOP (T1_INDEX); | |
235 ker_fill_dtc_info (bcs_dtc); | |
236 t30_data->fmod = FMOD_SND; | |
237 t30_data->repeat = 1; | |
238 snd_t30_cap_ind(); | |
239 SET_STATE (KER, T30_SND_CAP); | |
240 memset (&t30_data->hdlc_snd, 0, sizeof(T_hdlc_info)); | |
241 } | |
242 break; | |
243 | |
244 case BCS_NSC: TRACE_EVENT ("Rec BCS_NSC"); | |
245 { | |
246 MCAST (bcs_nsc, BCS_NSC); | |
247 t30_data->hdlc_rcv.c_nsc = (UBYTE)(bcs_nsc->non_std_fac.l_non_std_fac >> 3); | |
248 MEMCOPLEN(nsc, bcs_nsc->non_std_fac.b_non_std_fac, c_nsc); | |
249 } | |
250 break; | |
251 | |
252 case BCS_NSF: TRACE_EVENT ("Rec BCS_NSF"); | |
253 { | |
254 MCAST (bcs_nsf, BCS_NSF); | |
255 t30_data->hdlc_rcv.c_nsf = (UBYTE)(bcs_nsf->non_std_fac.l_non_std_fac >> 3); | |
256 MEMCOPLEN(nsf, bcs_nsf->non_std_fac.b_non_std_fac, c_nsf); | |
257 } | |
258 break; | |
259 | |
260 case BCS_PWD_POLL: TRACE_EVENT ("Rec BCS_PWD_POLL"); | |
261 { | |
262 MCAST (bcs_pwd_poll, BCS_PWD_POLL); | |
263 t30_data->hdlc_rcv.c_pwd = bcs_pwd_poll->c_pm_pword; | |
264 MEMCOPSIZ(t30_data->hdlc_rcv.pwd, bcs_pwd_poll->pm_pword); | |
265 } | |
266 break; | |
267 | |
268 case BCS_SEP: TRACE_EVENT ("Rec BCS_SEP"); | |
269 { | |
270 MCAST (bcs_sep, BCS_SEP); | |
271 t30_data->hdlc_rcv.c_sep = bcs_sep->c_pm_sub_addr; | |
272 MEMCOPSIZ(t30_data->hdlc_rcv.sep, bcs_sep->pm_sub_addr); | |
273 } | |
274 break; | |
275 | |
276 default: | |
277 TIMERSTOP (T1_INDEX); | |
278 snd_error_ind(ERR_PH_B_SND_COMREC_INVALID_CMD_RCVD); | |
279 break; | |
280 } | |
281 break; | |
282 } | |
283 | |
284 case T30_RCV_DCN: | |
285 switch (_decodedMsg[0]) | |
286 { | |
287 case BCS_DCN: TRACE_EVENT ("Rec BCS_DCN"); | |
288 snd_complete_ind(CMPL_EOP); | |
289 break; | |
290 | |
291 default: | |
292 snd_error_ind(ERR_PH_D_RCV_INVALID_RESP_RCVD); | |
293 SET_STATE (KER, T30_IDLE); | |
294 break; | |
295 } | |
296 TIMERSTOP (T2_INDEX); | |
297 break; | |
298 | |
299 case T30_RCV_DCS: | |
300 { | |
301 switch (_decodedMsg[0]) | |
302 { | |
303 case BCS_CIG: TRACE_EVENT ("Rec BCS_CIG"); | |
304 { | |
305 MCAST (bcs_cig, BCS_CIG); | |
306 t30_data->hdlc_rcv.c_cig = bcs_cig->c_clg_sub_nr; | |
307 MEMCOPSIZ(t30_data->hdlc_rcv.cig, bcs_cig->clg_sub_nr); | |
308 } | |
309 break; | |
310 | |
311 case BCS_CRP: TRACE_EVENT ("Rec BCS_CRP"); | |
312 SET_STATE (KER, T30_RCV_DIS); | |
313 ker_send_dis (); | |
314 break; | |
315 | |
316 case BCS_CSI: TRACE_EVENT ("Rec BCS_CSI"); | |
317 { | |
318 MCAST (bcs_csi, BCS_CSI); | |
319 t30_data->hdlc_rcv.c_csi = bcs_csi->c_cld_sub_nr; | |
320 MEMCOPSIZ(t30_data->hdlc_rcv.csi, bcs_csi->cld_sub_nr); | |
321 } | |
322 break; | |
323 | |
324 case BCS_DCN: TRACE_EVENT ("Rec BCS_DCN"); | |
325 SET_STATE (KER, T30_IDLE); | |
326 TIMERSTOP (T1_INDEX); | |
327 TIMERSTOP (T4_INDEX); | |
328 snd_t30_sgn_ind(SGN_DCN); | |
329 break; | |
330 | |
331 case BCS_DCS: TRACE_EVENT ("Rec BCS_DCS"); | |
332 { | |
333 MCAST (bcs_dcs, BCS_DCS); | |
334 ker_fill_dcs_info (bcs_dcs); | |
335 } | |
336 TIMERSTOP (T1_INDEX); | |
337 TIMERSTOP (T4_INDEX); | |
338 | |
339 if (t30_data->fmod NEQ FMOD_POLL) | |
340 t30_data->dir = 0; | |
341 | |
342 t30_data->fmod = FMOD_RCV; | |
343 t30_data->repeat = 1; | |
344 snd_t30_cap_ind(); | |
345 SET_STATE (KER, T30_RCV_TCF); | |
346 snd_fad_rcv_tcf_req(); | |
347 break; | |
348 | |
349 case BCS_DIS: TRACE_EVENT ("Rec BCS_DIS"); | |
350 { | |
351 MCAST (bcs_dis, BCS_DIS); | |
352 ker_fill_dis_info (bcs_dis); | |
353 } | |
354 TIMERSTOP (T1_INDEX); | |
355 TIMERSTOP (T4_INDEX); | |
356 t30_data->fmod = FMOD_SND; | |
357 t30_data->prev = HDLC_ADDR; | |
358 t30_data->dir = 0x80; | |
359 snd_t30_cap_ind(); | |
360 SET_STATE (KER, T30_IDLE); | |
361 break; | |
362 | |
363 case BCS_DTC: TRACE_EVENT ("Rec BCS_DTC"); | |
364 { | |
365 MCAST (bcs_dtc, BCS_DTC); | |
366 ker_fill_dtc_info (bcs_dtc); | |
367 } | |
368 TIMERSTOP (T1_INDEX); | |
369 TIMERSTOP (T4_INDEX); | |
370 | |
371 if (t30_data->fmod NEQ FMOD_POLL) | |
372 t30_data->dir = 0; | |
373 | |
374 t30_data->fmod = FMOD_POLL; | |
375 snd_t30_cap_ind(); | |
376 SET_STATE (KER, T30_SND_CAP); | |
377 break; | |
378 | |
379 case BCS_MPS: TRACE_EVENT ("Rec BCS_MPS"); | |
380 switch (t30_data->prev) | |
381 { | |
382 case BCS_RTN: | |
383 _decodedMsg[0] = BCS_RTN; | |
384 SET_STATE (KER, T30_RCV_RT2); | |
385 sig_ker_bcs_bdat_req (FINAL_YES); | |
386 break; | |
387 | |
388 case BCS_RTP: TRACE_EVENT ("Rec BCS_RTP"); | |
389 _decodedMsg[0] = BCS_RTP; | |
390 SET_STATE (KER, T30_RCV_RT2); | |
391 sig_ker_bcs_bdat_req (FINAL_YES); | |
392 break; | |
393 | |
394 default: | |
395 snd_error_ind(ERR_PH_B_RCV_INVALID_RESP_RCVD); | |
396 TIMERSTOP (T1_INDEX); | |
397 TIMERSTOP (T4_INDEX); | |
398 SET_STATE (KER, T30_IDLE); | |
399 break; | |
400 } | |
401 break; | |
402 | |
403 case BCS_NSC: TRACE_EVENT ("Rec BCS_NSC"); | |
404 { | |
405 MCAST (bcs_nsc, BCS_NSC); | |
406 t30_data->hdlc_rcv.c_nsc = (UBYTE)(bcs_nsc->non_std_fac.l_non_std_fac >> 3); | |
407 MEMCOPLEN(nsc, bcs_nsc->non_std_fac.b_non_std_fac, c_nsc); | |
408 } | |
409 break; | |
410 | |
411 case BCS_NSF: TRACE_EVENT ("Rec BCS_NSF"); | |
412 { | |
413 MCAST (bcs_nsf, BCS_NSF); | |
414 t30_data->hdlc_rcv.c_nsf = (UBYTE)(bcs_nsf->non_std_fac.l_non_std_fac >> 3); | |
415 MEMCOPLEN(nsf, bcs_nsf->non_std_fac.b_non_std_fac, c_nsf); | |
416 } | |
417 break; | |
418 | |
419 case BCS_NSS: TRACE_EVENT ("Rec BCS_NSS"); | |
420 { | |
421 MCAST (bcs_nss, BCS_NSS); | |
422 t30_data->hdlc_rcv.c_nss = (UBYTE)(bcs_nss->non_std_fac.l_non_std_fac >> 3); | |
423 MEMCOPLEN(nss, bcs_nss->non_std_fac.b_non_std_fac, c_nss); | |
424 } | |
425 break; | |
426 | |
427 case BCS_PWD_POLL: TRACE_EVENT ("Rec BCS_PWD_POLL"); | |
428 { | |
429 MCAST (bcs_pwd_poll, BCS_PWD_POLL); | |
430 t30_data->hdlc_rcv.c_pwd = bcs_pwd_poll->c_pm_pword; | |
431 MEMCOPSIZ(t30_data->hdlc_rcv.pwd, bcs_pwd_poll->pm_pword); | |
432 } | |
433 break; | |
434 | |
435 case BCS_PWD_SND: TRACE_EVENT ("Rec BCS_PWD_SND"); | |
436 { | |
437 MCAST (bcs_pwd_snd, BCS_PWD_SND); | |
438 t30_data->hdlc_rcv.c_pwd = bcs_pwd_snd->c_sm_pword; | |
439 MEMCOPSIZ(t30_data->hdlc_rcv.pwd, bcs_pwd_snd->sm_pword); | |
440 } | |
441 break; | |
442 | |
443 case BCS_SEP: TRACE_EVENT ("Rec BCS_SEP"); | |
444 { | |
445 MCAST (bcs_sep, BCS_SEP); | |
446 t30_data->hdlc_rcv.c_sep = bcs_sep->c_pm_sub_addr; | |
447 MEMCOPSIZ(t30_data->hdlc_rcv.sep, bcs_sep->pm_sub_addr); | |
448 } | |
449 break; | |
450 | |
451 case BCS_SUB: TRACE_EVENT ("Rec BCS_SUB"); | |
452 { | |
453 MCAST (bcs_sub, BCS_SUB); | |
454 t30_data->hdlc_rcv.c_sub = bcs_sub->c_sub_addr; | |
455 MEMCOPSIZ(t30_data->hdlc_rcv.sub, bcs_sub->sub_addr); | |
456 } | |
457 break; | |
458 | |
459 case BCS_TSI: TRACE_EVENT ("Rec BCS_TSI"); | |
460 { | |
461 MCAST (bcs_tsi, BCS_TSI); | |
462 t30_data->hdlc_rcv.c_tsi = bcs_tsi->c_tra_sub_nr; | |
463 MEMCOPSIZ(t30_data->hdlc_rcv.tsi, bcs_tsi->tra_sub_nr); | |
464 } | |
465 break; | |
466 | |
467 default: | |
468 TRACE_EVENT_P1 ("Rec %02x", _decodedMsg[0]); | |
469 snd_error_ind(ERR_PH_B_RCV_INVALID_RESP_RCVD); | |
470 TIMERSTOP (T1_INDEX); | |
471 TIMERSTOP (T4_INDEX); | |
472 SET_STATE (KER, T30_IDLE); | |
473 break; | |
474 } | |
475 break; | |
476 } | |
477 | |
478 case T30_RCV_TCF: | |
479 switch (_decodedMsg[0]) | |
480 { | |
481 case BCS_DCS: TRACE_EVENT ("Rec BCS_DCS"); | |
482 TIMERSTOP (T1_INDEX); | |
483 TIMERSTOP (T4_INDEX); | |
484 | |
485 if (t30_data->rate_modified) | |
486 snd_fad_rcv_tcf_req(); | |
487 break; | |
488 } | |
489 break; | |
490 | |
491 case T30_RCV_MSG: | |
492 switch (_decodedMsg[0]) | |
493 { | |
494 case BCS_DCN: TRACE_EVENT ("Rec BCS_DCN"); | |
495 snd_t30_sgn_ind(SGN_DCN); | |
496 SET_STATE (KER, T30_IDLE); | |
497 TIMERSTOP (T2_INDEX); | |
498 break; | |
499 | |
500 case BCS_MPS: TRACE_EVENT ("Rec BCS_MPS"); | |
501 TIMERSTOP (T2_INDEX); | |
502 _decodedMsg[0] = t30_data->prev; | |
503 SET_STATE (KER, T30_RCV_CFR); | |
504 sig_ker_bcs_bdat_req (FINAL_YES); | |
505 break; | |
506 | |
507 case BCS_TSI: TRACE_EVENT ("Rec BCS_TSI"); | |
508 { | |
509 MCAST (bcs_tsi, BCS_TSI); | |
510 t30_data->hdlc_rcv.c_tsi = bcs_tsi->c_tra_sub_nr; | |
511 MEMCOPSIZ(t30_data->hdlc_rcv.tsi, bcs_tsi->tra_sub_nr); | |
512 } | |
513 SET_STATE (KER, T30_RCV_DCS); | |
514 break; | |
515 | |
516 default: | |
517 snd_error_ind(ERR_PH_B_RCV_INVALID_RESP_RCVD); | |
518 TIMERSTOP (T2_INDEX); | |
519 SET_STATE (KER, T30_IDLE); | |
520 break; | |
521 } | |
522 break; | |
523 | |
524 case T30_RCV_PST: | |
525 TIMERSTOP (T2_INDEX); | |
526 switch (_decodedMsg[0]) | |
527 { | |
528 case BCS_DCN: TRACE_EVENT ("Rec BCS_DCN"); | |
529 SET_STATE (KER, T30_IDLE); | |
530 snd_t30_sgn_ind(SGN_DCN); | |
531 break; | |
532 | |
533 case BCS_EOM: TRACE_EVENT ("Rec BCS_EOM"); | |
534 t30_data->res = SGN_EOM; | |
535 snd_t30_sgn_ind(SGN_EOM); | |
536 break; | |
537 | |
538 case BCS_EOP: TRACE_EVENT ("Rec BCS_EOP"); | |
539 t30_data->res = SGN_EOP; | |
540 snd_t30_sgn_ind(SGN_EOP); | |
541 break; | |
542 | |
543 case BCS_MPS: TRACE_EVENT ("Rec BCS_MPS"); | |
544 t30_data->res = SGN_MPS; | |
545 snd_t30_sgn_ind(SGN_MPS); | |
546 break; | |
547 | |
548 case BCS_PRI_EOM: TRACE_EVENT ("Rec BCS_PRI_EOM"); | |
549 t30_data->res = SGN_PRI_EOM; | |
550 snd_t30_sgn_ind(SGN_PRI_EOM); | |
551 break; | |
552 | |
553 case BCS_PRI_EOP: TRACE_EVENT ("Rec BCS_PRI_EOP"); | |
554 t30_data->res = SGN_PRI_EOP; | |
555 snd_t30_sgn_ind(SGN_PRI_EOP); | |
556 break; | |
557 | |
558 case BCS_PRI_MPS: TRACE_EVENT ("Rec BCS_PRI_MPS"); | |
559 t30_data->res = SGN_PRI_MPS; | |
560 snd_t30_sgn_ind(SGN_PRI_MPS); | |
561 break; | |
562 | |
563 default: | |
564 snd_error_ind(ERR_PH_D_RCV_INVALID_RESP_RCVD); | |
565 SET_STATE (KER, T30_IDLE); | |
566 break; | |
567 } | |
568 break; | |
569 | |
570 case T30_RCV_T2: | |
571 TIMERSTOP (T2_INDEX); | |
572 switch (_decodedMsg[0]) | |
573 { | |
574 case BCS_DCN: TRACE_EVENT ("Rec BCS_DCN"); | |
575 snd_t30_sgn_ind(SGN_DCN); | |
576 SET_STATE (KER, T30_IDLE); | |
577 break; | |
578 | |
579 case BCS_EOM: TRACE_EVENT ("Rec BCS_EOM"); | |
580 TIMERSTART (T2_INDEX, T2_VALUE); | |
581 _decodedMsg[0] = BCS_MCF; | |
582 sig_ker_bcs_bdat_req (FINAL_YES); | |
583 break; | |
584 | |
585 default: | |
586 snd_error_ind(ERR_PH_D_RCV_INVALID_RESP_RCVD); | |
587 SET_STATE (KER, T30_IDLE); | |
588 break; | |
589 } | |
590 break; | |
591 | |
592 case T30_SND_CFR: | |
593 switch (_decodedMsg[0]) | |
594 { | |
595 case BCS_CFR: TRACE_EVENT ("Rec BCS_CFR"); | |
596 TIMERSTOP (T4_INDEX); | |
597 SET_STATE (KER, T30_SND_MSG); | |
598 t30_data->mux.mode = MUX_MSG; | |
599 sig_ker_mux_mux_req (); | |
600 snd_t30_phase_ind(MSG_PHASE); | |
601 break; | |
602 | |
603 case BCS_CIG: TRACE_EVENT ("Rec BCS_CIG"); | |
604 { | |
605 MCAST (bcs_cig, BCS_CIG); | |
606 t30_data->hdlc_rcv.c_cig = bcs_cig->c_clg_sub_nr; | |
607 MEMCOPSIZ(t30_data->hdlc_rcv.cig, bcs_cig->clg_sub_nr); | |
608 } | |
609 break; | |
610 | |
611 case BCS_CRP: TRACE_EVENT ("Rec BCS_CRP"); | |
612 TIMERSTOP (T4_INDEX); | |
613 t30_data->repeat++; | |
614 SET_STATE (KER, T30_SND_CAP); | |
615 snd_t30_sgn_ind(SGN_CRP); | |
616 break; | |
617 | |
618 case BCS_CSI: TRACE_EVENT ("Rec BCS_CSI"); | |
619 { | |
620 MCAST (bcs_csi, BCS_CSI); | |
621 t30_data->hdlc_rcv.c_csi = bcs_csi->c_cld_sub_nr; | |
622 MEMCOPSIZ(t30_data->hdlc_rcv.csi, bcs_csi->cld_sub_nr); | |
623 } | |
624 break; | |
625 | |
626 case BCS_DCN: TRACE_EVENT ("Rec BCS_DCN"); | |
627 SET_STATE (KER, T30_IDLE); | |
628 TIMERSTOP (T4_INDEX); | |
629 snd_t30_sgn_ind(SGN_DCN); | |
630 break; | |
631 | |
632 case BCS_DIS: TRACE_EVENT ("Rec BCS_DIS"); | |
633 TIMERSTOP (T4_INDEX); | |
634 | |
635 if (t30_data->repeat++ EQ 3) | |
636 { | |
637 snd_error_ind(ERR_PH_B_SND_DIS_DTC_RCVD_3_TIMES); | |
638 SET_STATE (KER, T30_IDLE); | |
639 } | |
640 else | |
641 { | |
642 MCAST (bcs_dis, BCS_DIS); | |
643 ker_fill_dis_info (bcs_dis); | |
644 t30_data->fmod = FMOD_SND; | |
645 snd_t30_cap_ind(); | |
646 SET_STATE (KER, T30_SND_CAP); | |
647 } | |
648 memset (&t30_data->hdlc_snd, 0, sizeof(T_hdlc_info)); | |
649 break; | |
650 | |
651 case BCS_DTC: TRACE_EVENT ("Rec BCS_DTC"); | |
652 TIMERSTOP (T4_INDEX); | |
653 if (t30_data->repeat++ EQ 3) | |
654 { | |
655 snd_error_ind(ERR_PH_B_SND_DIS_DTC_RCVD_3_TIMES); | |
656 SET_STATE (KER, T30_IDLE); | |
657 } | |
658 else | |
659 { | |
660 MCAST (bcs_dtc, BCS_DTC); | |
661 ker_fill_dtc_info (bcs_dtc); | |
662 t30_data->fmod = FMOD_POLL; | |
663 snd_t30_cap_ind(); | |
664 SET_STATE (KER, T30_SND_CAP); | |
665 } | |
666 memset (&t30_data->hdlc_snd, 0, sizeof(T_hdlc_info)); | |
667 break; | |
668 | |
669 case BCS_FTT: TRACE_EVENT ("Rec BCS_FTT"); | |
670 TIMERSTOP (T4_INDEX); | |
671 SET_STATE (KER, T30_SND_CAP); | |
672 snd_t30_sgn_ind(SGN_FTT); | |
673 break; | |
674 | |
675 case BCS_NSC: TRACE_EVENT ("Rec BCS_NSC"); | |
676 { | |
677 MCAST (bcs_nsc, BCS_NSC); | |
678 t30_data->hdlc_rcv.c_nsc = (UBYTE)(bcs_nsc->non_std_fac.l_non_std_fac >> 3); | |
679 MEMCOPLEN(nsc, bcs_nsc->non_std_fac.b_non_std_fac, c_nsc); | |
680 } | |
681 break; | |
682 | |
683 case BCS_NSF: TRACE_EVENT ("Rec BCS_NSF"); | |
684 { | |
685 MCAST (bcs_nsf, BCS_NSF); | |
686 t30_data->hdlc_rcv.c_nsf = (UBYTE)(bcs_nsf->non_std_fac.l_non_std_fac >> 3); | |
687 MEMCOPLEN(nsf, bcs_nsf->non_std_fac.b_non_std_fac, c_nsf); | |
688 } | |
689 break; | |
690 | |
691 default: | |
692 snd_error_ind(ERR_PH_B_SND_INVALID_RESP_RCVD); | |
693 TIMERSTOP (T4_INDEX); | |
694 SET_STATE (KER, T30_IDLE); | |
695 break; | |
696 } | |
697 break; | |
698 | |
699 case T30_SND_MCF: | |
700 switch (_decodedMsg[0]) | |
701 { | |
702 case BCS_CRP: TRACE_EVENT ("Rec BCS_CRP"); | |
703 if (t30_data->repeat EQ 3) | |
704 { | |
705 snd_error_ind(ERR_PH_D_SND_RSPREC); | |
706 SET_STATE (KER, T30_DCN); | |
707 _decodedMsg[0] = BCS_DCN; | |
708 sig_ker_bcs_bdat_req (FINAL_YES); | |
709 } | |
710 else | |
711 { | |
712 t30_data->repeat++; | |
713 act_on_sgn_req(); | |
714 } | |
715 break; | |
716 | |
717 case BCS_DCN: TRACE_EVENT ("Rec BCS_DCN"); | |
718 SET_STATE (KER, T30_IDLE); | |
719 TIMERSTOP (T4_INDEX); | |
720 snd_t30_sgn_ind(SGN_DCN); | |
721 break; | |
722 | |
723 case BCS_MCF: TRACE_EVENT ("Rec BCS_MCF"); | |
724 switch (t30_data->sgn_req) | |
725 { | |
726 case SGN_EOM: | |
727 TIMERSTOP (T1_INDEX); | |
728 TIMERSTOP (T4_INDEX); | |
729 snd_complete_ind(CMPL_EOM); | |
730 break; | |
731 | |
732 case SGN_EOP: | |
733 TIMERSTOP (T4_INDEX); | |
734 _decodedMsg[0] = BCS_DCN; | |
735 SET_STATE (KER, T30_SND_DCN); | |
736 sig_ker_bcs_bdat_req (FINAL_YES); | |
737 break; | |
738 | |
739 case SGN_MPS: | |
740 TIMERSTOP (T4_INDEX); | |
741 SET_STATE (KER, T30_SND_MSG); | |
742 t30_data->mux.mode = MUX_MSG; | |
743 sig_ker_mux_mux_req (); | |
744 snd_t30_phase_ind(MSG_PHASE); | |
745 break; | |
746 | |
747 default: | |
748 break; | |
749 } | |
750 break; | |
751 | |
752 case BCS_PIN: TRACE_EVENT ("Rec BCS_PIN"); | |
753 TIMERSTOP (T4_INDEX); | |
754 SET_STATE (KER, T30_SND_PI); | |
755 snd_t30_sgn_ind(SGN_PIN); | |
756 break; | |
757 | |
758 case BCS_PIP: TRACE_EVENT ("Rec BCS_PIP"); | |
759 TIMERSTOP (T4_INDEX); | |
760 SET_STATE (KER, T30_SND_PI); | |
761 snd_t30_sgn_ind(SGN_PIP); | |
762 break; | |
763 | |
764 case BCS_RTN: TRACE_EVENT ("Rec BCS_RTN"); | |
765 TIMERSTOP (T4_INDEX); | |
766 switch (t30_data->sgn_req) | |
767 { | |
768 case SGN_EOM: | |
769 SET_STATE (KER, T30_IDLE); | |
770 snd_t30_sgn_ind(SGN_RTN); | |
771 break; | |
772 | |
773 case SGN_EOP: | |
774 case SGN_MPS: | |
775 SET_STATE (KER, T30_SND_CAP); | |
776 snd_t30_sgn_ind(SGN_RTN); | |
777 break; | |
778 | |
779 default: | |
780 snd_error_ind(ERR_PH_D_SND_UNSPEC); | |
781 SET_STATE (KER, T30_DCN); | |
782 _decodedMsg[0] = BCS_DCN; | |
783 sig_ker_bcs_bdat_req (FINAL_YES); | |
784 break; | |
785 } | |
786 break; | |
787 | |
788 case BCS_RTP: TRACE_EVENT ("Rec BCS_RTP"); | |
789 TIMERSTOP (T4_INDEX); | |
790 switch (t30_data->sgn_req) | |
791 { | |
792 case SGN_EOM: | |
793 SET_STATE (KER, T30_IDLE); | |
794 snd_t30_sgn_ind(SGN_RTP); | |
795 break; | |
796 | |
797 case SGN_EOP: | |
798 _decodedMsg[0] = BCS_DCN; | |
799 SET_STATE (KER, T30_SND_DCN); | |
800 sig_ker_bcs_bdat_req (FINAL_YES); | |
801 break; | |
802 | |
803 case SGN_MPS: | |
804 SET_STATE (KER, T30_SND_CAP); | |
805 snd_t30_sgn_ind(SGN_RTP); | |
806 break; | |
807 | |
808 default: | |
809 snd_error_ind(ERR_PH_D_SND_UNSPEC); | |
810 SET_STATE (KER, T30_DCN); | |
811 _decodedMsg[0] = BCS_DCN; | |
812 sig_ker_bcs_bdat_req(FINAL_YES); | |
813 break; | |
814 } | |
815 break; | |
816 | |
817 default: | |
818 TIMERSTOP (T4_INDEX); | |
819 switch (t30_data->sgn_req) | |
820 { | |
821 case SGN_EOM: case SGN_PRI_EOM: | |
822 snd_error_ind(ERR_PH_D_SND_INVALID_RESP_TO_EOM); | |
823 break; | |
824 | |
825 case SGN_EOP: case SGN_PRI_EOP: | |
826 snd_error_ind(ERR_PH_D_SND_INVALID_RESP_TO_EOP); | |
827 break; | |
828 | |
829 case SGN_MPS: case SGN_PRI_MPS: | |
830 snd_error_ind(ERR_PH_D_SND_INVALID_RESP_TO_MPS); | |
831 break; | |
832 | |
833 default: | |
834 snd_error_ind(ERR_PH_D_SND_UNSPEC); | |
835 break; | |
836 } | |
837 SET_STATE (KER, T30_DCN); | |
838 _decodedMsg[0] = BCS_DCN; | |
839 sig_ker_bcs_bdat_req (FINAL_YES); | |
840 break; | |
841 } | |
842 break; | |
843 | |
844 default: | |
845 break; | |
846 } | |
847 } | |
848 | |
849 /* | |
850 +--------------------------------------------------------------------+ | |
851 | PROJECT : GSM-F&D (8411) MODULE : T30_KERS | | |
852 | STATE : code ROUTINE : sig_msg_ker_mdat_ind| | |
853 +--------------------------------------------------------------------+ | |
854 PURPOSE : Process signal MDAT_IND received from process BCS. | |
855 The signal contains a fax data block which is passed to DTI. | |
856 */ | |
857 GLOBAL void sig_msg_ker_mdat_ind (T_FAD_DATA_IND *fad_data_ind) | |
858 { | |
859 TRACE_FUNCTION ("sig_msg_ker_mdat_ind()"); | |
860 switch (GET_STATE (KER)) | |
861 { | |
862 case T30_RCV_DAT: | |
863 if (fad_data_ind->final) | |
864 { | |
865 TIMERSTART (T2_INDEX, MSG_VALUE); | |
866 SET_STATE (KER, T30_RCV_RDYF); | |
867 } | |
868 else | |
869 { | |
870 SET_STATE (KER, T30_RCV_RDY); | |
871 } | |
872 prepare_dti_data_ind(fad_data_ind); | |
873 snd_dti_data_ind(&t30_data->dti_data_ind); | |
874 break; | |
875 | |
876 case T30_RCV_DATW: | |
877 if (fad_data_ind->final) | |
878 { | |
879 TIMERSTART (T2_INDEX, MSG_VALUE); | |
880 SET_STATE (KER, T30_RCV_RDYF); | |
881 } | |
882 else | |
883 { | |
884 TIMERSTOP (T2_INDEX); | |
885 SET_STATE (KER, T30_RCV_RDY); | |
886 } | |
887 prepare_dti_data_ind(fad_data_ind); | |
888 snd_dti_data_ind(&t30_data->dti_data_ind); | |
889 break; | |
890 | |
891 case T30_RCV_MSG: | |
892 case T30_RCV_MSGW: | |
893 if (fad_data_ind->final) | |
894 { | |
895 TIMERSTART (T2_INDEX, MSG_VALUE); | |
896 SET_STATE (KER, T30_RCV_RDYF); | |
897 } | |
898 prepare_dti_data_ind(fad_data_ind); | |
899 break; | |
900 | |
901 case T30_RCV_RDY: | |
902 prepare_dti_data_ind(fad_data_ind); | |
903 break; | |
904 | |
905 default: | |
906 TRACE_EVENT("ERROR: FAD_DATA_IND in wrong KER state"); | |
907 break; | |
908 } | |
909 } | |
910 | |
911 /* | |
912 +--------------------------------------------------------------------+ | |
913 | PROJECT : GSM-F&D (8411) MODULE : T30_KERS | | |
914 | STATE : code ROUTINE : sig_bcs_ker_err_ind | | |
915 +--------------------------------------------------------------------+ | |
916 PURPOSE : Process signal ERR_IND received from process BCS. | |
917 This signal contains an error message from the BCS formatter. | |
918 */ | |
919 GLOBAL void sig_bcs_ker_err_ind (UBYTE cause) | |
920 { | |
921 const char tab[8][25] = | |
922 { | |
923 "", | |
924 "BUF_FULL", | |
925 "CCD_DEC", | |
926 "CCD_ENC", | |
927 "FCS", | |
928 "FINAL", | |
929 "FRAME_NO_FLAG", | |
930 "FRAME_TOO_MANY_FRAMES" | |
931 }; | |
932 | |
933 TRACE_FUNCTION ("sig_bcs_ker_err_ind()"); | |
934 TRACE_EVENT_P2("*** BCS error cause = %d, %s", cause, tab[cause]); | |
935 | |
936 switch (GET_STATE (KER)) | |
937 { | |
938 case T30_SND_CFR: | |
939 { | |
940 switch (cause) | |
941 { | |
942 case ERR_FCS: | |
943 { | |
944 TIMERSTOP (T4_INDEX); | |
945 t30_data->repeat++; | |
946 SET_STATE (KER, T30_SND_CAP); | |
947 snd_t30_sgn_ind(SGN_FCS_ERR); | |
948 break; | |
949 } | |
950 default: | |
951 break; | |
952 } | |
953 break ; | |
954 } | |
955 case T30_SND_MCF: | |
956 switch (cause) | |
957 { | |
958 case ERR_FCS: | |
959 if (t30_data->repeat EQ 3) | |
960 { | |
961 snd_error_ind(ERR_PH_D_SND_RSPREC); | |
962 SET_STATE (KER, T30_DCN); | |
963 _decodedMsg[0] = BCS_DCN; | |
964 sig_ker_bcs_bdat_req (FINAL_YES); | |
965 } | |
966 break; | |
967 | |
968 default: | |
969 t30_data->repeat++; | |
970 act_on_sgn_req(); | |
971 break; | |
972 } | |
973 break; | |
974 | |
975 default: | |
976 break; | |
977 } | |
978 } | |
979 #undef MEMCOPLEN |