FreeCalypso > hg > fc-magnetite
comparison src/g23m-fad/t30/t30_pei.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 : | |
4 | Modul : | |
5 +----------------------------------------------------------------------------- | |
6 | Copyright 2002 Texas Instruments Berlin, AG | |
7 | All rights reserved. | |
8 | | |
9 | This file is confidential and a trade secret of Texas | |
10 | Instruments Berlin, AG | |
11 | The receipt of or possession of this file does not convey | |
12 | any rights to reproduce or disclose its contents or to | |
13 | manufacture, use, or sell anything it may describe, in | |
14 | whole, or in part, without the specific written consent of | |
15 | Texas Instruments Berlin, AG. | |
16 +----------------------------------------------------------------------------- | |
17 | Purpose : This module implements the process body interface | |
18 | for the entity T30 of the mobile station. | |
19 +----------------------------------------------------------------------------- | |
20 */ | |
21 | |
22 #ifndef T30_PEI_C | |
23 #define T30_PEI_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 GLOBAL DTI_HANDLE t30_hDTI; /* DTI connection for DTI library */ | |
54 | |
55 /*==== PRIVATE ====================================================*/ | |
56 | |
57 /*==== VARIABLES ==================================================*/ | |
58 | |
59 LOCAL BOOL first_access = TRUE; | |
60 LOCAL T_MONITOR t30_mon; | |
61 | |
62 /*==== FUNCTIONS ==================================================*/ | |
63 | |
64 LOCAL void pei_dti_connect_req (T_DTI2_CONNECT_REQ*); | |
65 LOCAL void pei_dti_connect_cnf (T_DTI2_CONNECT_CNF*); | |
66 LOCAL void pei_dti_connect_ind (T_DTI2_CONNECT_IND*); | |
67 LOCAL void pei_dti_connect_res (T_DTI2_CONNECT_RES*); | |
68 LOCAL void pei_dti_disconnect_req (T_DTI2_DISCONNECT_REQ*); | |
69 LOCAL void pei_dti_disconnect_ind (T_DTI2_DISCONNECT_IND*); | |
70 LOCAL void pei_dti_data_req (T_DTI2_DATA_REQ*); | |
71 LOCAL void pei_dti_getdata_req (T_DTI2_GETDATA_REQ*); | |
72 LOCAL void pei_dti_data_ind (T_DTI2_DATA_IND*); | |
73 LOCAL void pei_dti_ready_ind (T_DTI2_READY_IND*); | |
74 | |
75 #ifdef _SIMULATION_ /* DTI_DATA_TEST_REQ/IND */ | |
76 LOCAL const void pei_dti_data_test_req (T_DTI2_DATA_TEST_REQ*); | |
77 LOCAL const void pei_dti_data_test_ind (T_DTI2_DATA_TEST_IND*); | |
78 #endif | |
79 | |
80 LOCAL void pei_dti_callback(UBYTE instance, | |
81 UBYTE interfac, | |
82 UBYTE channel, | |
83 UBYTE reason, | |
84 T_DTI2_DATA_IND* dti_data_ind); | |
85 /* | |
86 +--------------------------------------------------------------------+ | |
87 | PROJECT : GSM-F&D (8411) MODULE : T30_PEI | | |
88 | STATE : code ROUTINE : pei_not_supported | | |
89 +--------------------------------------------------------------------+ | |
90 | |
91 PURPOSE : An unsupported primitive is received. | |
92 | |
93 */ | |
94 | |
95 LOCAL void pei_not_supported (void *data) | |
96 { | |
97 TRACE_FUNCTION ("pei_not_supported()"); | |
98 | |
99 PFREE (data); | |
100 } | |
101 | |
102 /* | |
103 * Use MAK_FUNC_0 for primitives which contains no SDU. | |
104 * Use MAK_FUNC_S for primitives which contains a SDU. | |
105 */ | |
106 | |
107 /* | |
108 * jumptable for the entity service access point. | |
109 * Contains the processing-function addresses and opcodes | |
110 * of request and response primitives. | |
111 */ | |
112 | |
113 LOCAL const T_FUNC dti_ul_table[] = { | |
114 MAK_FUNC_0( pei_dti_connect_req , DTI2_CONNECT_REQ ), | |
115 MAK_FUNC_0( pei_dti_connect_res , DTI2_CONNECT_RES ), | |
116 MAK_FUNC_0( pei_dti_disconnect_req, DTI2_DISCONNECT_REQ ), | |
117 MAK_FUNC_0( pei_dti_getdata_req , DTI2_GETDATA_REQ ), | |
118 MAK_FUNC_0( pei_dti_data_req , DTI2_DATA_REQ ) | |
119 | |
120 #ifdef _SIMULATION_ /* DTI_DATA_TEST_REQ */ | |
121 , | |
122 MAK_FUNC_S( pei_dti_data_test_req , DTI2_DATA_TEST_REQ ) | |
123 #endif | |
124 }; | |
125 | |
126 LOCAL const T_FUNC dti_dl_table[] = { | |
127 MAK_FUNC_0( pei_dti_connect_ind , DTI2_CONNECT_IND ), | |
128 MAK_FUNC_0( pei_dti_connect_cnf , DTI2_CONNECT_CNF ), | |
129 MAK_FUNC_0( pei_dti_disconnect_ind , DTI2_DISCONNECT_IND ), | |
130 MAK_FUNC_0( pei_dti_ready_ind , DTI2_READY_IND ), | |
131 MAK_FUNC_0( pei_dti_data_ind , DTI2_DATA_IND ) | |
132 | |
133 #ifdef _SIMULATION_ /* DTI_DATA_TEST_IND */ | |
134 , | |
135 MAK_FUNC_S( pei_dti_data_test_ind , DTI2_DATA_TEST_IND ) | |
136 #endif | |
137 }; | |
138 | |
139 LOCAL const T_FUNC fad_table[] = | |
140 { | |
141 MAK_FUNC_S(mux_fad_data_ind , FAD_DATA_IND ), | |
142 MAK_FUNC_0(ker_fad_data_cnf , FAD_DATA_CNF ), | |
143 MAK_FUNC_0(ker_fad_snd_tcf_cnf , FAD_SND_TCF_CNF ), | |
144 MAK_FUNC_0(ker_fad_rcv_tcf_cnf , FAD_RCV_TCF_CNF ), | |
145 MAK_FUNC_0(ker_fad_ready_ind , FAD_READY_IND ), | |
146 MAK_FUNC_0(mux_fad_mux_ind , FAD_MUX_IND ), | |
147 MAK_FUNC_0(ker_fad_error_ind , FAD_ERROR_IND ), | |
148 MAK_FUNC_0(ker_fad_deactivate_cnf, FAD_DEACTIVATE_CNF), | |
149 MAK_FUNC_0(ker_fad_activate_cnf , FAD_ACTIVATE_CNF ) | |
150 }; | |
151 | |
152 | |
153 LOCAL const T_FUNC t30_table[] = | |
154 { | |
155 MAK_FUNC_0(ker_t30_activate_req , T30_ACTIVATE_REQ ), | |
156 MAK_FUNC_0(ker_t30_config_req , T30_CONFIG_REQ ), | |
157 MAK_FUNC_0(ker_t30_cap_req , T30_CAP_REQ ), | |
158 MAK_FUNC_0(ker_t30_sgn_req , T30_SGN_REQ ), | |
159 MAK_FUNC_0(ker_t30_modify_req , T30_MODIFY_REQ ), | |
160 MAK_FUNC_0(ker_t30_deactivate_req , T30_DEACTIVATE_REQ), | |
161 MAK_FUNC_0(ker_t30_dti_req , T30_DTI_REQ ) | |
162 }; | |
163 | |
164 /* | |
165 +--------------------------------------------------------------------+ | |
166 | PROJECT : GSM-F&D (8411) MODULE : T30_PEI | | |
167 | STATE : code ROUTINE : pei_primitive | | |
168 +--------------------------------------------------------------------+ | |
169 | |
170 PURPOSE : Process protocol specific primitive. | |
171 | |
172 */ | |
173 LOCAL SHORT pei_primitive (void * ptr) | |
174 { | |
175 T_PRIM * prim = ptr; | |
176 /* | |
177 * | | |
178 * MMI UPPER LAYER | |
179 * | | |
180 * +-------------v------------+ | |
181 * | | | |
182 * | T30 | | |
183 * | | | |
184 * +-------------^------------+ | |
185 * | | |
186 * FAD LOWER LAYER | |
187 * | | |
188 * | |
189 */ | |
190 | |
191 TRACE_FUNCTION ("pei_primitive()"); | |
192 | |
193 if (prim NEQ NULL) | |
194 { | |
195 ULONG opc = prim->custom.opc; | |
196 USHORT n; | |
197 const T_FUNC *table; | |
198 | |
199 VSI_PPM_REC ((T_PRIM_HEADER *)prim, __FILE__, __LINE__); | |
200 PTRACE_IN (opc); | |
201 | |
202 t30_data = GET_INSTANCE (prim); | |
203 | |
204 switch (SAP_NR(opc)) | |
205 { | |
206 case DTI2_UL: | |
207 table = dti_ul_table; n = TAB_SIZE (dti_ul_table); | |
208 /* | |
209 * to be able to distinguish DTI1/DTI2 opcodes, | |
210 * the ones for DTI2 start at 0x50 | |
211 */ | |
212 opc -= 0x50; | |
213 break; | |
214 case SAP_NR(DTI2_DL): | |
215 table = dti_dl_table; | |
216 n = TAB_SIZE (dti_dl_table); | |
217 /* | |
218 * to be able to distinguish DTI1/DTI2 opcodes, | |
219 * the ones for DTI2 start at 0x50 | |
220 */ | |
221 opc -= 0x50; | |
222 break; | |
223 | |
224 case SAP_NR(FAD_DL): | |
225 table = fad_table; | |
226 n = TAB_SIZE (fad_table); | |
227 break; | |
228 | |
229 case SAP_NR(T30_UL): | |
230 table = t30_table; | |
231 n = TAB_SIZE (t30_table); | |
232 break; | |
233 | |
234 default: | |
235 table = NULL; | |
236 n = 0; | |
237 break; | |
238 } | |
239 | |
240 if (table != NULL) | |
241 { | |
242 if ((PRIM_NR(opc)) < n) | |
243 { | |
244 table += PRIM_NR(opc); | |
245 #ifdef PALLOC_TRANSITION | |
246 P_SDU(prim) = table->soff ? (T_sdu*) (((char*)&prim->data) + table->soff) : 0; | |
247 #ifndef NO_COPY_ROUTING | |
248 P_LEN(prim) = table->size + sizeof (T_PRIM_HEADER); | |
249 #endif /* NO_COPY_ROUTING */ | |
250 #endif /* PALLOC_TRANSITION */ | |
251 JUMP (table->func) (P2D(prim)); | |
252 } | |
253 else | |
254 { | |
255 pei_not_supported (P2D(prim)); | |
256 } | |
257 return PEI_OK; | |
258 } | |
259 | |
260 /* | |
261 * Primitive is no GSM Primitive | |
262 * then forward to the environment | |
263 */ | |
264 | |
265 #ifdef GSM_ONLY | |
266 PFREE (P2D(prim)) | |
267 | |
268 return PEI_ERROR; | |
269 #else | |
270 if (opc & SYS_MASK) | |
271 vsi_c_primitive (VSI_CALLER prim); | |
272 else | |
273 { | |
274 PFREE (P2D(prim)); | |
275 return PEI_ERROR; | |
276 } | |
277 #endif | |
278 } | |
279 return PEI_OK; | |
280 } | |
281 | |
282 | |
283 /* | |
284 +--------------------------------------------------------------------+ | |
285 | PROJECT : GSM-F&D (8411) MODULE : T30_PEI | | |
286 | STATE : code ROUTINE : pei_init | | |
287 +--------------------------------------------------------------------+ | |
288 | |
289 PURPOSE : Initialize Protocol Stack Entity | |
290 | |
291 */ | |
292 LOCAL SHORT pei_init (T_HANDLE handle) | |
293 { | |
294 t30_handle = handle; | |
295 | |
296 TRACE_FUNCTION ("pei_init()"); | |
297 | |
298 if (hCommFAD < VSI_OK) | |
299 { | |
300 if ((hCommFAD = vsi_c_open (VSI_CALLER FAD_NAME)) < VSI_OK) | |
301 return PEI_ERROR; | |
302 } | |
303 | |
304 if (hCommMMI < VSI_OK) | |
305 { | |
306 if ((hCommMMI = vsi_c_open (VSI_CALLER ACI_NAME)) < VSI_OK) | |
307 return PEI_ERROR; | |
308 } | |
309 | |
310 /* | |
311 * initialize dtilib for this entity | |
312 */ | |
313 t30_hDTI = dti_init(T30_INSTANCES, handle, DTI_DEFAULT_OPTIONS, pei_dti_callback); | |
314 | |
315 if(!t30_hDTI) | |
316 return PEI_ERROR; | |
317 /* | |
318 * Initialize CCD and the other entity specific processes | |
319 */ | |
320 ccd_init (); | |
321 | |
322 t30_data = &t30_data_base[0]; | |
323 t30_data_magic_num = 0; /* memory is not yet initialized */ | |
324 | |
325 return PEI_OK; | |
326 } | |
327 | |
328 /* | |
329 +--------------------------------------------------------------------+ | |
330 | PROJECT : GSM-F&D (8411) MODULE : T30_PEI | | |
331 | STATE : code ROUTINE : pei_timeout | | |
332 +--------------------------------------------------------------------+ | |
333 | |
334 PURPOSE : Process timeout | |
335 | |
336 */ | |
337 LOCAL SHORT pei_timeout (USHORT index) | |
338 { | |
339 TRACE_FUNCTION ("pei_timeout ()"); | |
340 t30_timeout (index); | |
341 return PEI_OK; | |
342 } | |
343 | |
344 /* | |
345 +--------------------------------------------------------------------+ | |
346 | PROJECT : GSM-F&D (8411) MODULE : T30_PEI | | |
347 | STATE : code ROUTINE : pei_exit | | |
348 +--------------------------------------------------------------------+ | |
349 | |
350 PURPOSE : Close Resources and terminate | |
351 | |
352 */ | |
353 LOCAL SHORT pei_exit (void) | |
354 { | |
355 TRACE_FUNCTION ("pei_exit()"); | |
356 /* | |
357 * shut down dtilib communication | |
358 */ | |
359 dti_disconnect(); | |
360 dti_deinit(t30_hDTI); | |
361 /* | |
362 * clean up communication | |
363 */ | |
364 vsi_c_close (VSI_CALLER hCommFAD); | |
365 hCommFAD = VSI_ERROR; | |
366 vsi_c_close (VSI_CALLER hCommMMI); | |
367 hCommMMI = VSI_ERROR; | |
368 return PEI_OK; | |
369 } | |
370 | |
371 /* | |
372 +--------------------------------------------------------------------+ | |
373 | PROJECT : GSM-F&D (8411) MODULE : T30_PEI | | |
374 | STATE : code ROUTINE : pei_config | | |
375 +--------------------------------------------------------------------+ | |
376 | |
377 PURPOSE : Dynamic Configuration | |
378 | |
379 */ | |
380 | |
381 #if !defined (NCONFIG) | |
382 | |
383 LOCAL KW_DATA kwtab[] = | |
384 { | |
385 #ifdef OPTION_TIMER | |
386 T30_TIMER_SET, TIMER_SET, | |
387 T30_TIMER_RESET, TIMER_RESET, | |
388 T30_TIMER_SPEED_UP, TIMER_SPEED_UP, | |
389 T30_TIMER_SLOW_DOWN, TIMER_SLOW_DOWN, | |
390 T30_TIMER_SUPPRESS, TIMER_SUPPRESS, | |
391 #endif | |
392 "", 0 | |
393 }; | |
394 | |
395 LOCAL KW_DATA partab[] = | |
396 { | |
397 #ifdef OPTION_TIMER | |
398 T1_NAME, T1, | |
399 T2_NAME, T2, | |
400 T4_NAME, T4, | |
401 #endif | |
402 "", 0 | |
403 }; | |
404 | |
405 #endif | |
406 | |
407 LOCAL SHORT pei_config (T_PEI_CONFIG inString) | |
408 { | |
409 #if !defined (NCONFIG) | |
410 SHORT valno; | |
411 SHORT keyno; | |
412 char *s = inString; | |
413 char *keyw; | |
414 char *val [10]; | |
415 | |
416 #ifdef OPTION_TIMER | |
417 BOOL t_man = FALSE; | |
418 UBYTE t_mod = 0; | |
419 SHORT t_num = 0; | |
420 LONG t_val = 0; | |
421 #endif | |
422 | |
423 TRACE_FUNCTION ("pei_config()"); | |
424 TRACE_EVENT (s); | |
425 | |
426 tok_init (s); | |
427 | |
428 /* | |
429 * Parse next keyword and number of variables | |
430 */ | |
431 | |
432 while ((valno = tok_next(&keyw,val)) != TOK_EOCS) | |
433 { | |
434 switch ((keyno = tok_key((KW_DATA *)kwtab, keyw))) | |
435 { | |
436 case TOK_NOT_FOUND: | |
437 TRACE_ERROR ("[PEI_CONFIG]: Illegal Keyword"); | |
438 break; | |
439 | |
440 #ifdef OPTION_TIMER | |
441 case TIMER_SET: | |
442 if (valno EQ 2) | |
443 { | |
444 t_man = TRUE; | |
445 t_num = tok_key((KW_DATA *)partab,val[0]); | |
446 t_mod = TIMER_SET; | |
447 t_val = atoi(val[1]); | |
448 | |
449 if (t_val < 0L) | |
450 t_val = 0L; | |
451 } | |
452 else | |
453 TRACE_ERROR ("[PEI_CONFIG]: Wrong Number of Parameters"); | |
454 break; | |
455 | |
456 case TIMER_RESET: | |
457 case TIMER_SUPPRESS: /* manipulation of a timer */ | |
458 if (valno EQ 1) | |
459 { | |
460 t_man = TRUE; | |
461 t_num = tok_key((KW_DATA *)partab,val[0]); | |
462 t_mod = (UBYTE) keyno; | |
463 t_val = 0L; | |
464 } | |
465 else | |
466 TRACE_ERROR ("[PEI_CONFIG]: Wrong Number of Parameters"); | |
467 break; | |
468 | |
469 case TIMER_SPEED_UP: | |
470 case TIMER_SLOW_DOWN: | |
471 if (valno EQ 2) | |
472 { | |
473 t_man = TRUE; | |
474 t_num = tok_key((KW_DATA *)partab,val[0]); | |
475 t_mod = (UBYTE) keyno; | |
476 t_val = atoi(val[1]); | |
477 if (t_val <= 0L) | |
478 t_val = 1L; | |
479 } | |
480 else | |
481 TRACE_ERROR ("[PEI_CONFIG]: Wrong Number of Parameters"); | |
482 break; | |
483 #endif | |
484 | |
485 default: | |
486 break; | |
487 } | |
488 | |
489 #ifdef OPTION_TIMER | |
490 if (t_man) | |
491 { | |
492 /* | |
493 * A timer is manipulated | |
494 */ | |
495 t_man = FALSE; | |
496 | |
497 if (t_num >= 0) | |
498 vsi_t_config (VSI_CALLER (USHORT)t_num, t_mod, t_val); | |
499 else | |
500 TRACE_ERROR ("[PEI_CONFIG]: Parameter out of Range"); | |
501 } | |
502 #endif | |
503 } | |
504 #endif | |
505 return PEI_OK; | |
506 } | |
507 | |
508 /* | |
509 +--------------------------------------------------------------------+ | |
510 | PROJECT : GSM-F&D (8411) MODULE : T30_PEI | | |
511 | STATE : code ROUTINE : pei_monitor | | |
512 +--------------------------------------------------------------------+ | |
513 | |
514 PURPOSE : Monitoring of physical Parameters | |
515 | |
516 */ | |
517 LOCAL SHORT pei_monitor (void **monitor) | |
518 { | |
519 TRACE_FUNCTION ("pei_monitor()"); | |
520 t30_mon.version = VERSION_T30; | |
521 *monitor = &t30_mon; | |
522 return PEI_OK; | |
523 } | |
524 | |
525 /* | |
526 +------------------------------------------------------------------------------ | |
527 | Function : pei_dti_connect_req | |
528 +------------------------------------------------------------------------------ | |
529 | PURPOSE : Call the process function dti_dti_connect_req | |
530 +------------------------------------------------------------------------------ | |
531 */ | |
532 | |
533 LOCAL void pei_dti_connect_req(T_DTI2_CONNECT_REQ *dti_connect_req) | |
534 { | |
535 dti_dti_connect_req (t30_hDTI, dti_connect_req); | |
536 } | |
537 | |
538 /* | |
539 +------------------------------------------------------------------------------ | |
540 | Function : pei_dti_connect_cnf | |
541 +------------------------------------------------------------------------------ | |
542 | PURPOSE : Call the process function dti_dti_connect_cnf | |
543 +------------------------------------------------------------------------------ | |
544 */ | |
545 | |
546 LOCAL void pei_dti_connect_cnf(T_DTI2_CONNECT_CNF *dti_connect_cnf) | |
547 { | |
548 dti_dti_connect_cnf(t30_hDTI, dti_connect_cnf); | |
549 } | |
550 | |
551 /* | |
552 +------------------------------------------------------------------------------ | |
553 | Function : pei_dti_connect_ind | |
554 +------------------------------------------------------------------------------ | |
555 | PURPOSE : Call the process function dti_dti_connect_ind | |
556 +------------------------------------------------------------------------------ | |
557 */ | |
558 | |
559 LOCAL void pei_dti_connect_ind(T_DTI2_CONNECT_IND *dti_connect_ind) | |
560 { | |
561 dti_dti_connect_ind(t30_hDTI, dti_connect_ind); | |
562 } | |
563 | |
564 /* | |
565 +------------------------------------------------------------------------------ | |
566 | Function : pei_dti_connect_res | |
567 +------------------------------------------------------------------------------ | |
568 | PURPOSE : Call the process function dti_dti_connect_res | |
569 +------------------------------------------------------------------------------ | |
570 */ | |
571 | |
572 LOCAL void pei_dti_connect_res(T_DTI2_CONNECT_RES *dti_connect_res) | |
573 { | |
574 dti_dti_connect_res(t30_hDTI, dti_connect_res); | |
575 } | |
576 | |
577 /* | |
578 +------------------------------------------------------------------------------ | |
579 | Function : pei_dti_disconnect_req | |
580 +------------------------------------------------------------------------------ | |
581 | PURPOSE : Call the process function dti_dti_disconnect_req | |
582 +------------------------------------------------------------------------------ | |
583 */ | |
584 | |
585 LOCAL void pei_dti_disconnect_req(T_DTI2_DISCONNECT_REQ *dti_disconnect_req) | |
586 { | |
587 dti_dti_disconnect_req (t30_hDTI, dti_disconnect_req); | |
588 } | |
589 | |
590 /* | |
591 +------------------------------------------------------------------------------ | |
592 | Function : pei_dti_disconnect_ind | |
593 +------------------------------------------------------------------------------ | |
594 | PURPOSE : Call the process function dti_dti_disconnect_ind | |
595 +------------------------------------------------------------------------------ | |
596 */ | |
597 | |
598 LOCAL void pei_dti_disconnect_ind(T_DTI2_DISCONNECT_IND *dti_disconnect_ind) | |
599 { | |
600 dti_dti_disconnect_ind (t30_hDTI, dti_disconnect_ind); | |
601 } | |
602 | |
603 /* | |
604 +------------------------------------------------------------------------------ | |
605 | Function : pei_dti_data_req | |
606 +------------------------------------------------------------------------------ | |
607 | PURPOSE : Call the process function dti_dti_data_req | |
608 +------------------------------------------------------------------------------ | |
609 */ | |
610 | |
611 LOCAL void pei_dti_data_req(T_DTI2_DATA_REQ *dti_data_req) | |
612 { | |
613 dti_dti_data_req (t30_hDTI, dti_data_req); | |
614 } | |
615 | |
616 /* | |
617 +------------------------------------------------------------------------------ | |
618 | Function : pei_dti_getdata_req | |
619 +------------------------------------------------------------------------------ | |
620 | PURPOSE : Call the process function dti_dti_data_req | |
621 +------------------------------------------------------------------------------ | |
622 */ | |
623 | |
624 LOCAL void pei_dti_getdata_req(T_DTI2_GETDATA_REQ *dti_getdata_req) | |
625 { | |
626 dti_dti_getdata_req (t30_hDTI, dti_getdata_req); | |
627 } | |
628 | |
629 /* | |
630 +------------------------------------------------------------------------------ | |
631 | Function : pei_dti_data_ind | |
632 +------------------------------------------------------------------------------ | |
633 | PURPOSE : Call the process function dti_dti_data_ind | |
634 +------------------------------------------------------------------------------ | |
635 */ | |
636 | |
637 LOCAL void pei_dti_data_ind(T_DTI2_DATA_IND *dti_data_ind) | |
638 { | |
639 dti_dti_data_ind (t30_hDTI, dti_data_ind); | |
640 } | |
641 | |
642 /* | |
643 +------------------------------------------------------------------------------ | |
644 | Function : pei_dti_ready_ind | |
645 +------------------------------------------------------------------------------ | |
646 | PURPOSE : Call the process function dti_dti_ready_ind | |
647 +------------------------------------------------------------------------------ | |
648 */ | |
649 | |
650 LOCAL void pei_dti_ready_ind(T_DTI2_READY_IND *dti_ready_ind) | |
651 { | |
652 dti_dti_ready_ind (t30_hDTI, dti_ready_ind); | |
653 } | |
654 | |
655 /* | |
656 +------------------------------------------------------------------------------ | |
657 | Function: pei_dti_callback | |
658 +------------------------------------------------------------------------------ | |
659 | PURPOSE : Callback function for DTILIB | |
660 +------------------------------------------------------------------------------ | |
661 */ | |
662 LOCAL void pei_dti_callback(U8 instance, U8 interfac, U8 channel, | |
663 U8 reason, T_DTI2_DATA_IND *dti_data_ind) | |
664 { | |
665 TRACE_FUNCTION("pei_dti_callback"); | |
666 | |
667 if (interfac NEQ T30_DTI_UP_INTERFACE || channel NEQ T30_DTI_UP_CHANNEL) | |
668 { | |
669 TRACE_ERROR("[PEI_DTI_CALLBACK] channel or interface not valid!"); | |
670 return; /* error, not found */ | |
671 } | |
672 | |
673 t30_data = &t30_data_base[instance]; | |
674 | |
675 if (t30_hDTI NEQ D_NO_DATA_BASE) | |
676 { | |
677 switch (reason) | |
678 { | |
679 case DTI_REASON_CONNECTION_OPENED: | |
680 sig_dti_ker_connection_opened_ind(); | |
681 break; | |
682 | |
683 case DTI_REASON_CONNECTION_CLOSED: | |
684 sig_dti_ker_connection_closed_ind(); | |
685 break; | |
686 | |
687 case DTI_REASON_DATA_RECEIVED: | |
688 | |
689 /* | |
690 * prevent dtilib from automatically sending flow control primitives | |
691 */ | |
692 dti_stop(t30_hDTI, T30_DTI_UP_DEF_INSTANCE, T30_DTI_UP_INTERFACE, T30_DTI_UP_CHANNEL); | |
693 | |
694 PACCESS (dti_data_ind); | |
695 { | |
696 /* | |
697 * DTI2_DATA_IND is interpreted as DTI2_DATA_REQ | |
698 */ | |
699 PPASS (dti_data_ind, dti_data_req, DTI2_DATA_REQ); | |
700 sig_dti_ker_data_received_ind(dti_data_req); | |
701 } | |
702 break; | |
703 | |
704 case DTI_REASON_TX_BUFFER_FULL: | |
705 sig_dti_ker_tx_buffer_full_ind(); | |
706 break; | |
707 | |
708 case DTI_REASON_TX_BUFFER_READY: | |
709 sig_dti_ker_tx_buffer_ready_ind(); | |
710 break; | |
711 | |
712 default: | |
713 TRACE_ERROR("unknown DTILIB reason parameter"); | |
714 break; | |
715 } | |
716 } | |
717 else | |
718 { | |
719 TRACE_ERROR("Pointer to DTILIB database not existing"); | |
720 } | |
721 } | |
722 | |
723 #ifdef _SIMULATION_ /* DTI_DATA_TEST_REQ/IND */ | |
724 | |
725 /* | |
726 +------------------------------------------------------------------------------ | |
727 | Function : pei_dti_data_test_req | |
728 +------------------------------------------------------------------------------ | |
729 | PURPOSE : Call the process function dti_dti_data_test_req | |
730 +------------------------------------------------------------------------------ | |
731 */ | |
732 | |
733 LOCAL const void pei_dti_data_test_req(T_DTI2_DATA_TEST_REQ *dti_data_test_req) | |
734 { | |
735 switch (GET_STATE (KER)) | |
736 { | |
737 case T30_NULL: | |
738 if (t30_data->test_mode & TST_BCS) | |
739 { | |
740 t30_data->mux.mode = MUX_BCS; | |
741 sig_ker_mux_mux_req (); | |
742 memcpy (_decodedMsg, dti_data_test_req->sdu.buf, dti_data_test_req->sdu.l_buf >> 3); | |
743 sig_ker_bcs_bdat_req (dti_data_test_req->parameters.st_lines.st_flow); /* used as FINAL flag */ | |
744 } | |
745 return; | |
746 | |
747 default: | |
748 break; | |
749 } | |
750 dti_dti_data_test_req (t30_hDTI, dti_data_test_req); | |
751 } | |
752 | |
753 /* | |
754 +------------------------------------------------------------------------------ | |
755 | Function : pei_dti_data_test_ind | |
756 +------------------------------------------------------------------------------ | |
757 | PURPOSE : Call the process function dti_dti_data_test_ind | |
758 +------------------------------------------------------------------------------ | |
759 */ | |
760 | |
761 LOCAL const void pei_dti_data_test_ind(T_DTI2_DATA_TEST_IND *dti_data_test_ind) | |
762 { | |
763 dti_dti_data_test_ind (t30_hDTI, dti_data_test_ind); | |
764 } | |
765 | |
766 #endif | |
767 | |
768 /* | |
769 +--------------------------------------------------------------------+ | |
770 | PROJECT : GSM-F&D (8411) MODULE : T30_PEI | | |
771 | STATE : code ROUTINE : pei_create | | |
772 +--------------------------------------------------------------------+ | |
773 | |
774 PURPOSE : Create the Protocol Stack Entity | |
775 | |
776 */ | |
777 | |
778 /*lint -e714 : Symbol not referenced */ | |
779 /*lint -e765 : external could be made static */ | |
780 GLOBAL SHORT t30_pei_create (T_PEI_INFO const **info) | |
781 { | |
782 static const T_PEI_INFO pei_info = | |
783 { | |
784 "T30", | |
785 { | |
786 pei_init, | |
787 pei_exit, | |
788 pei_primitive, | |
789 pei_timeout, | |
790 NULL, /* no signal function */ | |
791 NULL, /* no run function */ | |
792 pei_config, | |
793 pei_monitor, | |
794 }, | |
795 1024, /* Stack Size */ | |
796 10, /* Queue Entries */ | |
797 205, /* Priority */ | |
798 3, /* number of timer */ | |
799 0x03|PRIM_NO_SUSPEND /* flags */ | |
800 }; | |
801 | |
802 TRACE_FUNCTION ("t30_pei_create()"); | |
803 | |
804 /* | |
805 * Close Resources if open | |
806 */ | |
807 | |
808 if (first_access) | |
809 first_access = FALSE; | |
810 else | |
811 pei_exit (); | |
812 | |
813 /* | |
814 * Export startup configuration data | |
815 */ | |
816 *info = &pei_info; | |
817 return PEI_OK; | |
818 } | |
819 |