comparison src/g23m-gprs/sndcp/sndcp_pei.c @ 183:219afcfc6250

src/g23m-gprs: initial import from TCS3.2/LoCosto
author Mychaela Falconia <falcon@freecalypso.org>
date Thu, 13 Oct 2016 04:24:13 +0000
parents
children a04cde1fb771
comparison
equal deleted inserted replaced
182:f02d0a0e1849 183:219afcfc6250
1 /*
2 +-----------------------------------------------------------------------------
3 | Project : GPRS (8441)
4 | Modul : sndcp_pei.c
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 SNDCP
19 |
20 | Exported functions:
21 |
22 | pei_create - Create the Protocol Stack Entity
23 | pei_init - Initialize Protocol Stack Entity
24 | pei_primitive - Process Primitive
25 | pei_timeout - Process Timeout
26 | pei_exit - Close resources and terminate
27 | pei_run - Process Primitive
28 | pei_config - Dynamic Configuration
29 | pei_monitor - Monitoring of physical Parameters
30 +-----------------------------------------------------------------------------
31 */
32
33 #define SNDCP_PEI_C
34
35 #define ENTITY_SNDCP
36
37 /*==== INCLUDES =============================================================*/
38
39 #include <stddef.h> /* to get definition of offsetof(), for MAK_FUNC_S */
40 #include "typedefs.h" /* to get Condat data types */
41 #include "vsi.h" /* to get a lot of macros */
42 #include "macdef.h"
43 #include "gprs.h"
44 #include "gsm.h" /* to get a lot of macros */
45 #include "cnf_sndcp.h" /* to get cnf-definitions */
46 #include "mon_sndcp.h" /* to get mon-definitions */
47 #include "prim.h" /* to get the definitions of used SAP and directions */
48
49 #include "dti.h" /* To get dti lib */
50
51 #include "sndcp.h" /* to get the global entity definitions */
52
53 #include "ccdapi.h" /* to get ccd stuff */
54
55 #include "sndcp_ciaf.h" /* to get functions for service mg */
56 #include "sndcp_ciap.h" /* to get primitive handling for service mg */
57 #include "sndcp_cias.h" /* to get signal handling for service mg*/
58
59 #include "sndcp_mgf.h" /* to get functions for service mg */
60 #include "sndcp_mgp.h" /* to get primitive handling for service mg */
61 #include "sndcp_mgs.h" /* to get signal handling for service mg*/
62
63 #include "sndcp_ndf.h" /* to get functions for service nd */
64 #include "sndcp_ndp.h" /* to get primitive handling for service nd */
65 #include "sndcp_nds.h" /* to get signal handling for service nd */
66
67 #include "sndcp_nuf.h" /* to get functions for service nu */
68 #include "sndcp_nup.h" /* to get primitive handling for service nu */
69 #include "sndcp_nus.h" /* to get signal handling for service nu */
70
71 #include "sndcp_pdf.h" /* to get functions for service pd */
72 #include "sndcp_pdaf.h" /* to get functions for service pda */
73
74 #include "sndcp_suf.h" /* to get functions for service su */
75 #include "sndcp_sup.h" /* to get primitive handling for service su */
76 #include "sndcp_sus.h" /* to get signal handling for service su */
77
78 #include "sndcp_suaf.h" /* to get functions for service sua */
79 #include "sndcp_suap.h" /* to get primitive handling for service sua */
80 #include "sndcp_suas.h" /* to get signal handling for service sua */
81
82 #include "sndcp_sdf.h" /* to get functions for service sd */
83 #include "sndcp_sdp.h" /* to get primitive handling for service sd */
84 #include "sndcp_sds.h" /* to get signal handling for service sd */
85
86 #include "sndcp_sdaf.h" /* to get functions for service sda */
87 #include "sndcp_sdap.h" /* to get primitive handling for service sda */
88 #include "sndcp_sdas.h" /* to get signal handling for service sda */
89
90 #include "sndcp_pdp.h" /* to get primitive handling for service pd */
91 #include "sndcp_pds.h" /* to get signal handling for service pd */
92
93 #include "sndcp_pdap.h" /* to get primitive handling for service pda */
94 #include "sndcp_pdas.h" /* to get signal handling for service pda */
95
96 #include "sndcp_f.h"
97
98 #include <string.h> /* to get memcpy() */
99 #include <stdlib.h> /* to get atoi() */
100
101
102
103 /*==== DEFINITIONS ==========================================================*/
104 #define TCPIP_NAME "TCP"
105 /*==== TYPES ================================================================*/
106
107 /*==== GLOBAL VARS ==========================================================*/
108
109 /*==== LOCAL VARS ===========================================================*/
110
111 #ifdef _SNDCP_DTI_2_
112
113 LOCAL void sndcp_dti_dti_connect_cnf (T_DTI2_CONNECT_CNF
114 *dti2_connect_cnf);
115 LOCAL void sndcp_dti_dti_connect_ind (T_DTI2_CONNECT_IND
116 *dti2_connect_ind);
117 LOCAL void sndcp_dti_dti_disconnect_ind (T_DTI2_DISCONNECT_IND
118 *dti2_disconnect_ind);
119 LOCAL void sndcp_dti_dti_ready_ind (T_DTI2_READY_IND
120 *dti2_ready_ind);
121 LOCAL void sndcp_dti_dti_data_ind (T_DTI2_DATA_IND
122 *dti2_data_ind);
123 LOCAL void sndcp_dti_dti_getdata_req (T_DTI2_GETDATA_REQ
124 *dti_getdata_req);
125 LOCAL void sndcp_dti_dti_data_req (T_DTI2_DATA_REQ
126 *dti_data_req);
127 LOCAL void sndcp_dti_dti_connect_req (T_DTI2_CONNECT_REQ
128 *dti2_connect_req);
129 LOCAL void sndcp_dti_dti_connect_res (T_DTI2_CONNECT_RES
130 *dti2_connect_res);
131 LOCAL void sndcp_dti_dti_disconnect_req (T_DTI2_DISCONNECT_REQ
132 *dti2_disconnect_req);
133 #ifdef _SIMULATION_
134 LOCAL void sndcp_dti_dti_data_test_req (T_DTI2_DATA_TEST_REQ
135 *dti_data_test_req);
136 LOCAL void sndcp_dti_dti_data_test_ind (T_DTI2_DATA_TEST_IND
137 *dti_data_test_ind);
138 #endif /*_SIMULATION_*/
139
140 #else /*_SNDCP_DTI_2_*/
141
142 LOCAL void sndcp_dti_dti_getdata_req (T_DTI_GETDATA_REQ
143 *dti_getdata_req);
144
145 LOCAL void sndcp_dti_dti_data_req (T_DTI_DATA_REQ
146 *dti_data_req);
147 #ifdef _SIMULATION_
148 LOCAL void sndcp_dti_dti_data_test_req (T_DTI_DATA_TEST_REQ
149 *dti_data_test_req);
150 #endif
151
152 LOCAL void sndcp_dti_dti_ready_ind (T_DTI_READY_IND
153 *dti_ready_ind);
154
155 LOCAL void sndcp_dti_dti_data_ind (T_DTI_DATA_IND
156 *dti_data_ind);
157
158 #ifdef _SIMULATION_
159 LOCAL void sndcp_dti_dti_data_test_ind (T_DTI_DATA_TEST_IND
160 *dti_data_test_ind);
161 #endif
162 #endif /* _SNDCP_DTI_2_ */
163
164
165 static BOOL first_access = TRUE;
166 static T_MONITOR sndcp_mon;
167
168
169
170 #ifdef TI_PS_OP_ICUT_SNDCP
171
172 /* PDP_TBR added SNDCP terminal loopback */
173 U8 SNDCP_LOOPBACK = FALSE;
174
175 BOOL bufFull[SNDCP_NUMBER_OF_NSAPIS] = {FALSE,FALSE,FALSE,FALSE, FALSE,FALSE,FALSE,FALSE,
176 FALSE,FALSE,FALSE,FALSE, FALSE,FALSE,FALSE,FALSE};
177 T_DTI2_DATA_IND *saveDti2_data_ind[SNDCP_NUMBER_OF_NSAPIS] = {NULL,NULL,NULL,NULL,NULL,NULL,
178 NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL};
179
180 #endif /* TI_PS_OP_ICUT_SNDCP */
181
182
183
184
185 /*
186 * Jumptables to primitive handler functions. One table per SAP.
187 *
188 * Use MAK_FUNC_0 for primitives which contains no SDU.
189 * Use MAK_FUNC_S for primitives which contains a SDU.
190 */
191
192 /*
193 * Function is needed for function_table[]. This declaration can be removed
194 * as soon as this function is no more called (i.e. all primitives are
195 * handled).
196 */
197 LOCAL void primitive_not_supported (void *data);
198
199 #ifndef SNDCP_UPM_INCLUDED
200 static const T_FUNC snsm_table[] =
201 {
202 MAK_FUNC_0(mg_snsm_activate_ind, SNSM_ACTIVATE_IND), /* 6700 */
203 MAK_FUNC_0(mg_snsm_deactivate_ind, SNSM_DEACTIVATE_IND), /* 6701 */
204 MAK_FUNC_0(mg_snsm_modify_ind, SNSM_MODIFY_IND), /* 6702 */
205 MAK_FUNC_0(mg_snsm_sequence_ind, SNSM_SEQUENCE_IND) /* 6703 */
206 };
207 #endif
208
209 #ifndef SNDCP_UPM_INCLUDED
210 static const T_FUNC sn_table[] =
211 {
212 MAK_FUNC_N(primitive_not_supported, 0), /* 2800 */
213 MAK_FUNC_N(primitive_not_supported, 0), /* 2801 */
214 MAK_FUNC_N(primitive_not_supported, 0), /* 2802 */
215 MAK_FUNC_N(primitive_not_supported, 0), /* 2803 */
216 MAK_FUNC_N(primitive_not_supported, 0), /* 2804 */
217 MAK_FUNC_N(primitive_not_supported, 0), /* 2805 */
218 MAK_FUNC_N(primitive_not_supported, 0), /* 2806 */
219 MAK_FUNC_N(primitive_not_supported, 0) /* 2807 */
220 #ifdef _SNDCP_MEAN_TRACE_
221 ,
222 MAK_FUNC_0(sndcp_sn_count_req, SN_COUNT_REQ) /* 2808 */
223 #endif
224 ,
225 MAK_FUNC_0(mg_sn_switch_req, SN_SWITCH_REQ) /* 2809 */
226 };
227
228 #else /*#ifndef SNDCP_UPM_INCLUDED*/
229
230 static const T_FUNC sn_table[] =
231 { /* edge mode */
232 MAK_FUNC_0(mg_snsm_activate_ind, SN_ACTIVATE_REQ), /*0x8000009E */
233 MAK_FUNC_0(mg_snsm_deactivate_ind, SN_DEACTIVATE_REQ), /*0x8001009E */
234 #ifdef TI_DUAL_MODE
235 MAK_FUNC_0(mg_get_pending_pdu_req, SN_GET_PENDING_PDU_REQ), /*0x8002009E */
236 #else
237 MAK_FUNC_N(primitive_not_supported, SN_GET_PENDING_PDU_REQ), /* 0x8002009E */
238 #endif
239 MAK_FUNC_0(mg_snsm_modify_ind, SN_MODIFY_REQ), /*0x8003009E */
240 MAK_FUNC_0(mg_snsm_sequence_ind, SN_SEQUENCE_REQ), /*0x8004009E */
241 MAK_FUNC_0(sndcp_sn_count_req, SN_COUNT_REQ), /*0x8005009E */
242 MAK_FUNC_0(mg_sn_dti_req, SN_DTI_REQ) /*0x8006009E */
243
244 };
245 #endif /*#ifdef SNDCP_UPM_INCLUDED*/
246
247 static const T_FUNC ll_table[] =
248 {
249 MAK_FUNC_0(mg_ll_reset_ind, LL_RESET_IND), /* 6200 */
250 MAK_FUNC_S(mg_ll_establish_cnf, LL_ESTABLISH_CNF), /* 6201 */
251 MAK_FUNC_S(mg_ll_establish_ind, LL_ESTABLISH_IND), /* 6202 */
252 MAK_FUNC_0(mg_ll_release_cnf, LL_RELEASE_CNF), /* 6203 */
253 MAK_FUNC_0(mg_ll_release_ind, LL_RELEASE_IND), /* 6204 */
254 MAK_FUNC_S(mg_ll_xid_cnf, LL_XID_CNF), /* 6205 */
255 MAK_FUNC_S(mg_ll_xid_ind, LL_XID_IND), /* 6206 */
256 MAK_FUNC_0(sua_ll_ready_ind, LL_READY_IND), /* 6207 */
257 MAK_FUNC_0(su_ll_unitready_ind, LL_UNITREADY_IND), /* 6208 */
258 MAK_FUNC_0(sua_ll_data_cnf, LL_DATA_CNF), /* 6209 */
259 MAK_FUNC_S(pda_ll_data_ind, LL_DATA_IND), /* 620A */
260 MAK_FUNC_S(pd_ll_unitdata_ind, LL_UNITDATA_IND), /* 620B */
261 MAK_FUNC_0(mg_ll_status_ind, LL_STATUS_IND) /* 620C */
262 };
263
264 #ifdef _SNDCP_DTI_2_
265
266 /*
267 * Jumptable for the DTI service access point for downlink data transmission.
268 * Contains the processing-function addresses and opcodes of
269 * indication and confirm primitives. Use of DTILIB can be selected.
270 *
271 */
272
273 LOCAL const T_FUNC ddl_table_dti[] = {
274
275 MAK_FUNC_0(sndcp_dti_dti_connect_ind, DTI2_CONNECT_IND), /* 7750 */
276 MAK_FUNC_0(sndcp_dti_dti_connect_cnf, DTI2_CONNECT_CNF), /* 7751 */
277 MAK_FUNC_0(sndcp_dti_dti_disconnect_ind, DTI2_DISCONNECT_IND), /* 7752 */
278 MAK_FUNC_0(sndcp_dti_dti_ready_ind, DTI2_READY_IND), /* 7753 */
279 MAK_FUNC_0(sndcp_dti_dti_data_ind, DTI2_DATA_IND) /* 7754 */
280
281 #if defined (_SIMULATION_)
282 ,
283 MAK_FUNC_0(sndcp_dti_dti_data_test_ind, DTI2_DATA_TEST_IND) /* 7755 */
284 #endif
285
286 };
287
288 /*
289 * Jumptable for the DTI service access point for uplink data transmission.
290 * Contains the processing-function addresses and opcodes of
291 * request and response primitives.
292 */
293
294
295 LOCAL const T_FUNC dul_table_dti[] = {
296
297 MAK_FUNC_0(sndcp_dti_dti_connect_req, DTI2_CONNECT_REQ), /*0x3750*/
298 MAK_FUNC_0(sndcp_dti_dti_connect_res, DTI2_CONNECT_RES), /*0x3751*/
299 MAK_FUNC_0(sndcp_dti_dti_disconnect_req, DTI2_DISCONNECT_REQ), /*0x3752*/
300 MAK_FUNC_0(sndcp_dti_dti_getdata_req, DTI2_GETDATA_REQ), /*0x3753*/
301 MAK_FUNC_0(sndcp_dti_dti_data_req, DTI2_DATA_REQ) /*0x3754*/
302
303 #if defined (_SIMULATION_)
304 ,
305 MAK_FUNC_0(sndcp_dti_dti_data_test_req, DTI2_DATA_TEST_REQ), /*0x3755*/
306 MAK_FUNC_N(primitive_not_supported, DTI2_DUMMY_REQ) /*0x3756*/
307 #endif /* _SIMULATION_ */
308 };
309
310 #else /*_SNDCP_DTI_2_*/
311
312 /*
313 * Jumptable for the DTI service access point for uplink data transmission.
314 * Contains the processing-function addresses and opcodes of
315 * request and response primitives.
316 */
317
318 LOCAL const T_FUNC dul_table_dti[] = {
319
320 MAK_FUNC_0(sndcp_dti_dti_getdata_req, DTI_GETDATA_REQ),
321 MAK_FUNC_0(sndcp_dti_dti_data_req, DTI_DATA_REQ)
322
323 #if defined (_SIMULATION_)
324 ,
325 MAK_FUNC_S(sndcp_dti_dti_data_test_req, DTI_DATA_TEST_REQ)
326 #endif /* _SIMULATION_ */
327 };
328
329
330 /*
331 * Jumptable for the DTI service access point for downlink data transmission.
332 * Contains the processing-function addresses and opcodes of
333 * indication and confirm primitives. Use of DTILIB can be selected.
334 *
335 */
336
337
338 LOCAL const T_FUNC ddl_table_dti[] = {
339
340 MAK_FUNC_0(sndcp_dti_dti_ready_ind, DTI_READY_IND),
341 MAK_FUNC_0(sndcp_dti_dti_data_ind, DTI_DATA_IND)
342
343 #if defined (_SIMULATION_)
344 ,
345 MAK_FUNC_S(sndcp_dti_dti_data_test_ind, DTI_DATA_TEST_IND)
346 #endif
347 };
348 #endif /* SNDCP_DTI_2_ */
349
350 /*==== DIAGNOSTICS ==========================================================*/
351
352 /*==== END DIAGNOSTICS ======================================================*/
353
354 /*==== PRIVATE FUNCTIONS ====================================================*/
355
356 /*
357 +------------------------------------------------------------------------------
358 | Function : primitive_not_supported
359 +------------------------------------------------------------------------------
360 | Description : This function handles unsupported primitives.
361 |
362 | Parameters : -
363 |
364 | Return : -
365 |
366 +------------------------------------------------------------------------------
367 */
368 LOCAL void primitive_not_supported (void *data)
369 {
370 TRACE_FUNCTION ("primitive_not_supported");
371
372 PFREE (data);
373 }
374
375 #ifdef _SNDCP_DTI_2_
376 /*
377 +------------------------------------------------------------------------------
378 | Function : sndcp_dti_dti_connect_cnf
379 +------------------------------------------------------------------------------
380 | Description : This function handles primitive DTI_DTI2_CONNECT_CNF.
381 |
382 | Parameters : received primitive
383 |
384 | Return : -
385 |
386 +------------------------------------------------------------------------------
387 */
388 LOCAL void sndcp_dti_dti_connect_cnf (T_DTI2_CONNECT_CNF *dti2_connect_cnf)
389 {
390 TRACE_FUNCTION ("sndcp_dti_dti_connect_cnf");
391
392 dti_dti_connect_cnf (sndcp_data->hDTI, dti2_connect_cnf);
393 }
394
395
396 /*
397 +------------------------------------------------------------------------------
398 | Function : sndcp_dti_dti_connect_ind
399 +------------------------------------------------------------------------------
400 | Description : This function handles primitive DTI_DTI2_CONNECT_IND.
401 |
402 | Parameters : received primitive
403 |
404 | Return : -
405 |
406 +------------------------------------------------------------------------------
407 */
408 LOCAL void sndcp_dti_dti_connect_ind (T_DTI2_CONNECT_IND *dti2_connect_ind)
409 {
410 TRACE_FUNCTION ("sndcp_dti_dti_connect_ind");
411
412 dti_dti_connect_ind (sndcp_data->hDTI, dti2_connect_ind);
413 }
414
415 /*
416 +------------------------------------------------------------------------------
417 | Function : sndcp_dti_dti_disconnect_ind
418 +------------------------------------------------------------------------------
419 | Description : This function handles primitive DTI_DTI2_DISCONNECT_IND.
420 |
421 | Parameters : received primitive
422 |
423 | Return : -
424 |
425 +------------------------------------------------------------------------------
426 */
427 LOCAL void sndcp_dti_dti_disconnect_ind (T_DTI2_DISCONNECT_IND *dti2_disconnect_ind)
428 {
429 TRACE_FUNCTION ("sndcp_dti_dti_disconnect_ind");
430
431 dti_dti_disconnect_ind (sndcp_data->hDTI, dti2_disconnect_ind);
432 }
433
434 /*
435 +------------------------------------------------------------------------------
436 | Function : sndcp_dti_dti_getdata_req
437 +------------------------------------------------------------------------------
438 | Description : This function handles primitive DTI_DTI_GETDATA_REQ.
439 |
440 | Parameters : received primitive
441 |
442 | Return : -
443 |
444 +------------------------------------------------------------------------------
445 */
446
447 LOCAL void sndcp_dti_dti_getdata_req (T_DTI2_GETDATA_REQ *dti2_getdata_req)
448 {
449 TRACE_FUNCTION ("sndcp_dti_dti_getdata_req");
450
451 dti_dti_getdata_req (sndcp_data->hDTI, dti2_getdata_req);
452 }
453
454 /*
455 +------------------------------------------------------------------------------
456 | Function : sndcp_dti_dti_data_req
457 +------------------------------------------------------------------------------
458 | Description : This function handles primitive DTI_DTI_DATA_REQ.
459 |
460 | Parameters : received primitive
461 |
462 | Return : -
463 |
464 +------------------------------------------------------------------------------
465 */
466 LOCAL void sndcp_dti_dti_data_req (T_DTI2_DATA_REQ *dti2_data_req)
467 {
468 TRACE_FUNCTION ("sndcp_dti_dti_data_req");
469
470 dti_dti_data_req (sndcp_data->hDTI, dti2_data_req);
471 }
472
473 /*
474 +------------------------------------------------------------------------------
475 | Function : sndcp_dti_dti_data_test_req
476 +------------------------------------------------------------------------------
477 | Description : This function handles primitive DTI_DTI_DATA_TEST_REQ.
478 |
479 | Parameters : received primitive
480 |
481 | Return : -
482 |
483 +------------------------------------------------------------------------------
484 */
485 #ifdef _SIMULATION_
486 LOCAL void sndcp_dti_dti_data_test_req (T_DTI2_DATA_TEST_REQ
487 *dti2_data_test_req)
488 {
489 TRACE_FUNCTION ("sndcp_dti_dti_data_test_req");
490
491 dti_dti_data_test_req (sndcp_data->hDTI, dti2_data_test_req);
492 }
493 #endif
494
495 /*
496 +------------------------------------------------------------------------------
497 | Function : sndcp_dti_dti_data_ind
498 +------------------------------------------------------------------------------
499 | Description : This function handles primitive DTI_DTI_DATA_IND.
500 |
501 | Parameters : received primitive
502 |
503 | Return : -
504 |
505 +------------------------------------------------------------------------------
506 */
507 LOCAL void sndcp_dti_dti_data_ind (T_DTI2_DATA_IND *dti2_data_ind)
508 {
509 TRACE_FUNCTION ("sndcp_dti_dti_data_ind");
510
511 dti_dti_data_ind (sndcp_data->hDTI, dti2_data_ind);
512 }
513
514 /*
515 +------------------------------------------------------------------------------
516 | Function : sndcp_dti_dti_ready_ind
517 +------------------------------------------------------------------------------
518 | Description : This function handles primitive DTI_DTI_READY_IND.
519 |
520 | Parameters : received primitive
521 |
522 | Return : -
523 |
524 +------------------------------------------------------------------------------
525 */
526 LOCAL void sndcp_dti_dti_ready_ind (T_DTI2_READY_IND *dti2_ready_ind)
527 {
528 TRACE_FUNCTION ("sndcp_dti_dti_ready_ind");
529
530 dti_dti_ready_ind (sndcp_data->hDTI, dti2_ready_ind);
531 }
532
533 /*
534 +------------------------------------------------------------------------------
535 | Function : sndcp_dti_dti_data_test_ind
536 +------------------------------------------------------------------------------
537 | Description : This function handles primitive DTI_DTI_DATA_TEST_IND.
538 |
539 | Parameters : received primitive
540 |
541 | Return : -
542 |
543 +------------------------------------------------------------------------------
544 */
545 #ifdef _SIMULATION_
546 LOCAL void sndcp_dti_dti_data_test_ind (T_DTI2_DATA_TEST_IND *dti2_data_test_ind)
547 {
548 TRACE_FUNCTION ("sndcp_dti_dti_data_test_ind");
549
550 dti_dti_data_test_ind (sndcp_data->hDTI, dti2_data_test_ind);
551 }
552 #endif
553
554 /*
555 +------------------------------------------------------------------------------
556 | Function : sndcp_dti_dti_connect_req
557 +------------------------------------------------------------------------------
558 | Description : This function handles primitive DTI_DTI_DATA_REQ.
559 |
560 | Parameters : received primitive
561 |
562 | Return : -
563 |
564 +------------------------------------------------------------------------------
565 */
566 LOCAL void sndcp_dti_dti_connect_req (T_DTI2_CONNECT_REQ *dti2_connect_req)
567 {
568 TRACE_FUNCTION ("sndcp_dti_dti_connect_req");
569
570 dti_dti_connect_req (sndcp_data->hDTI, dti2_connect_req);
571 if ( sndcp_data->nsapi_neighbor_ra[sndcp_data->nsapi] EQ TCPIP_NAME)
572 {
573 mg_dti_open(sndcp_data->nsapi);
574 }
575 }
576 /*
577 +------------------------------------------------------------------------------
578 | Function : sndcp_dti_dti_connect_res
579 +------------------------------------------------------------------------------
580 | Description : This function handles primitive DTI_DTI_DATA_REQ.
581 |
582 | Parameters : received primitive
583 |
584 | Return : -
585 |
586 +------------------------------------------------------------------------------
587 */
588 LOCAL void sndcp_dti_dti_connect_res (T_DTI2_CONNECT_RES *dti2_connect_res)
589 {
590 TRACE_FUNCTION ("sndcp_dti_dti_connect_res");
591
592 dti_dti_connect_res (sndcp_data->hDTI, dti2_connect_res);
593 }
594 /*
595 +------------------------------------------------------------------------------
596 | Function : sndcp_dti_dti_disconnect_req
597 +------------------------------------------------------------------------------
598 | Description : This function handles primitive DTI_DTI_DATA_REQ.
599 |
600 | Parameters : received primitive
601 |
602 | Return : -
603 |
604 +------------------------------------------------------------------------------
605 */
606 LOCAL void sndcp_dti_dti_disconnect_req (T_DTI2_DISCONNECT_REQ *dti2_disconnect_req)
607 {
608 TRACE_FUNCTION ("sndcp_dti_dti_disconnect_req");
609
610 dti_dti_disconnect_req (sndcp_data->hDTI, dti2_disconnect_req);
611 }
612
613
614 #else /* _SNDCP_DTI_2_ */
615
616 /*
617 +------------------------------------------------------------------------------
618 | Function : sndcp_dti_dti_getdata_req
619 +------------------------------------------------------------------------------
620 | Description : This function handles primitive DTI_DTI_GETDATA_REQ.
621 |
622 | Parameters : received primitive
623 |
624 | Return : -
625 |
626 +------------------------------------------------------------------------------
627 */
628
629 LOCAL void sndcp_dti_dti_getdata_req (T_DTI_GETDATA_REQ *dti_getdata_req)
630 {
631 TRACE_FUNCTION ("sndcp_dti_dti_getdata_req");
632
633 dti_dti_getdata_req (sndcp_data->hDTI, dti_getdata_req);
634 }
635
636 /*
637 +------------------------------------------------------------------------------
638 | Function : sndcp_dti_dti_data_req
639 +------------------------------------------------------------------------------
640 | Description : This function handles primitive DTI_DTI_DATA_REQ.
641 |
642 | Parameters : received primitive
643 |
644 | Return : -
645 |
646 +------------------------------------------------------------------------------
647 */
648 LOCAL void sndcp_dti_dti_data_req (T_DTI_DATA_REQ *dti_data_req)
649 {
650 TRACE_FUNCTION ("sndcp_dti_dti_data_req");
651
652 dti_dti_data_req (sndcp_data->hDTI, dti_data_req);
653 }
654
655 /*
656 +------------------------------------------------------------------------------
657 | Function : sndcp_dti_dti_data_test_req
658 +------------------------------------------------------------------------------
659 | Description : This function handles primitive DTI_DTI_DATA_TEST_REQ.
660 |
661 | Parameters : received primitive
662 |
663 | Return : -
664 |
665 +------------------------------------------------------------------------------
666 */
667 #ifdef _SIMULATION_
668 LOCAL void sndcp_dti_dti_data_test_req (T_DTI_DATA_TEST_REQ
669 *dti_data_test_req)
670 {
671 TRACE_FUNCTION ("sndcp_dti_dti_data_test_req");
672
673 dti_dti_data_test_req (sndcp_data->hDTI, dti_data_test_req);
674 }
675 #endif
676
677 /*
678 +------------------------------------------------------------------------------
679 | Function : sndcp_dti_dti_data_ind
680 +------------------------------------------------------------------------------
681 | Description : This function handles primitive DTI_DTI_DATA_IND.
682 |
683 | Parameters : received primitive
684 |
685 | Return : -
686 |
687 +------------------------------------------------------------------------------
688 */
689 LOCAL void sndcp_dti_dti_data_ind (T_DTI_DATA_IND *dti_data_ind)
690 {
691 TRACE_FUNCTION ("sndcp_dti_dti_data_ind");
692
693 dti_dti_data_ind (sndcp_data->hDTI, dti_data_ind);
694 }
695
696 /*
697 +------------------------------------------------------------------------------
698 | Function : sndcp_dti_dti_ready_ind
699 +------------------------------------------------------------------------------
700 | Description : This function handles primitive DTI_DTI_READY_IND.
701 |
702 | Parameters : received primitive
703 |
704 | Return : -
705 |
706 +------------------------------------------------------------------------------
707 */
708 LOCAL void sndcp_dti_dti_ready_ind (T_DTI_READY_IND *dti_ready_ind)
709 {
710 TRACE_FUNCTION ("sndcp_dti_dti_ready_ind");
711
712 dti_dti_ready_ind (sndcp_data->hDTI, dti_ready_ind);
713 }
714
715 /*
716 +------------------------------------------------------------------------------
717 | Function : sndcp_dti_dti_data_test_ind
718 +------------------------------------------------------------------------------
719 | Description : This function handles primitive DTI_DTI_DATA_TEST_IND.
720 |
721 | Parameters : received primitive
722 |
723 | Return : -
724 |
725 +------------------------------------------------------------------------------
726 */
727 #ifdef _SIMULATION_
728 LOCAL void sndcp_dti_dti_data_test_ind (T_DTI_DATA_TEST_IND *dti_data_test_ind)
729 {
730 TRACE_FUNCTION ("sndcp_dti_dti_data_test_ind");
731
732 dti_dti_data_test_ind (sndcp_data->hDTI, dti_data_test_ind);
733 }
734 #endif
735
736 #endif /* _SNDCP_DTI_2_ */
737
738
739 /*==== PUBLIC FUNCTIONS =====================================================*/
740
741 /*
742 +------------------------------------------------------------------------------
743 | Function : pei_primitive
744 +------------------------------------------------------------------------------
745 | Description : This function is called by the frame when a primitive is
746 | received and needs to be processed.
747 |
748 | |
749 | MMI UPLINK
750 | |
751 | +-------------v------------+
752 | | |
753 | | SNDCP |
754 | | |
755 | +------^------^-----^------+
756 | | | |
757 | SM CCI LLC DOWNLINK
758 | | | |
759 |
760 |
761 | Parameters : prim - Pointer to the received primitive
762 |
763 | Return : PEI_OK - function succeeded
764 | PEI_ERROR - function failed
765 |
766 +------------------------------------------------------------------------------
767 */
768
769 LOCAL SHORT pei_primitive (void * primptr)
770 {
771 TRACE_FUNCTION ("pei_primitive");
772
773 if (primptr NEQ NULL)
774 {
775 T_PRIM *prim = (T_PRIM *)primptr;
776 #ifdef SNDCP_UPM_INCLUDED
777 U32 opc = (prim->custom.opc);
778 #else
779 USHORT opc = (USHORT)(prim->custom.opc);
780 #endif
781 USHORT n;
782 const T_FUNC *table;
783
784 /*
785 * This must be called for Partition Pool supervision. Will be replaced
786 * by another macro some time.
787 */
788 VSI_PPM_REC (&prim->custom, __FILE__, __LINE__);
789
790 #ifdef SNDCP_UPM_INCLUDED
791 PTRACE_IN (opc);
792
793 switch (SAP_NR(opc))
794 {
795 case SAP_NR(SN_UL):
796 table = sn_table;
797 n = TAB_SIZE (sn_table);
798 break;
799 case SAP_NR(LL_DL):
800 table = ll_table;
801 n = TAB_SIZE (ll_table);
802 break;
803 case DTI2_DL:
804 opc -= 0x50;
805 table = ddl_table_dti;
806 n = TAB_SIZE (ddl_table_dti);
807 break;
808 case DTI2_UL:
809 opc -= 0x50;
810 table = dul_table_dti;
811 n = TAB_SIZE (dul_table_dti);
812 break;
813 default:
814 table = NULL;
815 n = 0;
816 break;
817 }
818 #else /*#ifdef SNDCP_UPM_INCLUDED*/
819
820 PTRACE_IN (opc);
821
822 switch (SAP_NR(opc))
823 {
824 case SAP_NR(SN_UL):
825 table = sn_table;
826 n = TAB_SIZE (sn_table);
827 break;
828 case SNSM_DL:
829 table = snsm_table;
830 n = TAB_SIZE (snsm_table);
831 break;
832 case SAP_NR(LL_DL):
833 table = ll_table;
834 n = TAB_SIZE (ll_table);
835 break;
836 #ifdef _SNDCP_DTI_2_
837 case DTI2_DL:
838 opc -= 0x50;
839 table = ddl_table_dti;
840 n = TAB_SIZE (ddl_table_dti);
841 break;
842 case DTI2_UL:
843 opc -= 0x50;
844 table = dul_table_dti;
845 n = TAB_SIZE (dul_table_dti);
846 break;
847 #else /* _SNDCP_DTI_2_ */
848 case DTI_DL:
849 table = ddl_table_dti;
850 n = TAB_SIZE (ddl_table_dti);
851 break;
852 case DTI_UL:
853 table = dul_table_dti;
854 n = TAB_SIZE (dul_table_dti);
855 break;
856 #endif /* _SNDCP_DTI_2_ */
857 default:
858 table = NULL;
859 n = 0;
860 break;
861 }
862 #endif
863 if (table != NULL)
864 {
865 #ifdef SNDCP_UPM_INCLUDED
866 if ((PRIM_NR(opc)) < n)
867 {
868 table += PRIM_NR(opc);
869 #else
870 if ((opc & PRM_MASK) < n)
871 {
872 table += opc & PRM_MASK;
873 #endif
874 #ifdef PALLOC_TRANSITION
875 P_SDU(prim) =
876 table->soff ? (T_sdu*)
877 (((char*)&prim->data) + table->soff) : 0;
878 #ifndef NO_COPY_ROUTING
879 P_LEN(prim) = table->size + sizeof (T_PRIM_HEADER);
880 #endif /* NO_COPY_ROUTING */
881 #endif /* PALLOC_TRANSITION */
882 JUMP (table->func) (P2D(prim));
883 }
884 else
885 {
886 primitive_not_supported (P2D(prim));
887 }
888 return PEI_OK;
889 }
890
891 /*
892 * primitive is not a GSM primitive - forward it to the environment
893 */
894 if (opc & SYS_MASK)
895 vsi_c_primitive (VSI_CALLER prim);
896 else
897 {
898 PFREE (P2D(prim));
899 return PEI_ERROR;
900 }
901 }
902 return PEI_OK;
903 }
904
905
906 /*
907 +------------------------------------------------------------------------------
908 | Function : pei_init
909 +------------------------------------------------------------------------------
910 | Description : This function is called by the frame. It is used to initialise
911 | the entitiy.
912 |
913 | Parameters : handle - task handle
914 |
915 | Return : PEI_OK - entity initialised
916 | PEI_ERROR - entity not (yet) initialised
917 |
918 +------------------------------------------------------------------------------
919 */
920
921
922 LOCAL SHORT pei_init (T_HANDLE handle)
923 {
924 #ifdef FLOW_TRACE
925 UBYTE i = 0;
926 UBYTE j = 0;
927 UBYTE k = 0;
928 #endif
929
930 TRACE_FUNCTION ("pei_init");
931
932 /*
933 * Initialize task handle
934 */
935 SNDCP_handle = handle;
936
937 /*
938 * Open communication channels
939 */
940 if (hCommMMI < VSI_OK)
941 {
942
943 #ifdef _SNDCP_DTI_2_
944 if ((hCommMMI = vsi_c_open (VSI_CALLER ACI_NAME)) < VSI_OK)
945 return PEI_ERROR;
946 }
947 #else /* _SNDCP_DTI_2_ */
948 if ((hCommMMI = vsi_c_open (VSI_CALLER MMI_NAME)) < VSI_OK)
949 return PEI_ERROR;
950 }
951 #endif /* _SNDCP_DTI_2_ */
952
953
954 #ifdef SNDCP_UPM_INCLUDED
955 if (hCommUPM < VSI_OK)
956 {
957 if ((hCommUPM = vsi_c_open (VSI_CALLER UPM_NAME)) < VSI_OK)
958 return PEI_ERROR;
959 }
960 #else
961 if (hCommSM < VSI_OK)
962 {
963 if ((hCommSM = vsi_c_open (VSI_CALLER SM_NAME)) < VSI_OK)
964 return PEI_ERROR;
965 }
966
967 #endif /*#ifdef SNDCP_UPM_INCLUDED*/
968
969 if (hCommLLC < VSI_OK)
970 {
971 if ((hCommLLC = vsi_c_open (VSI_CALLER LLC_NAME)) < VSI_OK)
972 return PEI_ERROR;
973 }
974
975 /*
976 * Initialize global pointer sndcp_data. This is required to access all
977 * entity data.
978 */
979 sndcp_data = &sndcp_data_base;
980
981
982 #ifdef FLOW_TRACE
983 for(i = 0; i < 5; i++) {
984 for (j = 0; j < 2; j++) {
985 for (k = 0; j < 2; j++) {
986 sndcp_trace_flow_control(i, j, k, FALSE);
987 }
988 }
989 }
990 #endif
991
992
993 /*
994 * Initialize global data.
995 *
996 * These arrays are not reset here:
997 * nsapi_qos_ra,
998 * nsapi_sapi_ra,
999 * nsapi_prio_ra,
1000 * nsapi_tlli_ra,
1001 *
1002 */
1003 {
1004 UBYTE nsapi = 0;
1005 UBYTE sapi_index = 0;
1006 for (nsapi = 0; nsapi < SNDCP_NUMBER_OF_NSAPIS; nsapi++) {
1007 sndcp_data->nsapi_used_ra[nsapi] = FALSE;
1008 sndcp_data->nsapi_ack_ra[nsapi] = FALSE;
1009 sndcp_data->nsapi_state_ra[nsapi] = MG_IDLE;
1010
1011 sndcp_data->nsapi_direction_ra[nsapi] = FALSE;
1012 sndcp_data->nsapi_interface_ra[nsapi] = SNDCP_INTERFACE_UNACK;
1013 sndcp_data->nsapi_linkid_ra[nsapi] = 0;
1014 sndcp_data->nsapi_neighbor_ra[nsapi] = NULL;
1015
1016 sndcp_data->cur_segment_number[nsapi] = 0;
1017
1018 #ifdef _SNDCP_MEAN_TRACE_
1019
1020 sndcp_data->start_time_uplink_ack [nsapi] = 0;
1021 sndcp_data->start_time_uplink_unack [nsapi] = 0;
1022 sndcp_data->start_time_downlink_ack [nsapi] = 0;
1023 sndcp_data->start_time_downlink_unack [nsapi] = 0;
1024
1025 sndcp_data->cur_time_uplink_ack [nsapi] = 0;
1026 sndcp_data->cur_time_uplink_unack [nsapi] = 0;
1027 sndcp_data->cur_time_downlink_ack [nsapi] = 0;
1028 sndcp_data->cur_time_downlink_unack [nsapi] = 0;
1029
1030 sndcp_data->cur_num_uplink_ack [nsapi] = 0;
1031 sndcp_data->cur_num_uplink_unack [nsapi] = 0;
1032 sndcp_data->cur_num_downlink_ack [nsapi] = 0;
1033 sndcp_data->cur_num_downlink_unack [nsapi] = 0;
1034
1035 sndcp_data->cur_pac_uplink_ack [nsapi] = 0;
1036 sndcp_data->cur_pac_uplink_unack [nsapi] = 0;
1037 sndcp_data->cur_pac_downlink_ack [nsapi] = 0;
1038 sndcp_data->cur_pac_downlink_unack [nsapi] = 0;
1039 #ifndef NCONFIG
1040 sndcp_data->data_count[nsapi] = 0;
1041 #endif
1042
1043
1044 #endif /* _SNDCP_MEAN_TRACE_ */
1045 }
1046 for (sapi_index = 0; sapi_index < SNDCP_NUMBER_OF_SAPIS; sapi_index++) {
1047 sndcp_data->sapi_ack_ra[sapi_index] = FALSE;
1048 sndcp_data->sapi_state_ra[sapi_index] = MG_IDLE;
1049 }
1050 }
1051
1052 sndcp_data->vj_count = 0;
1053 sndcp_data->always_xid = TRUE;
1054
1055 #ifndef NCONFIG
1056 sndcp_data->millis = 0;
1057 #endif
1058
1059 sndcp_data->trace_ip_header = FALSE;
1060 sndcp_data->trace_ip_datagram = FALSE;
1061 sndcp_data->trace_ip_bin = FALSE;
1062 sndcp_data->ip_filter = FALSE;
1063
1064 sndcp_data->nsapi_rcv_rdy_b4_used=0;
1065
1066
1067 /*
1068 * Initialize entity data (call init function of every service)
1069 */
1070 cia_init();
1071 mg_init();
1072 nd_init();
1073 nu_init();
1074 pd_init();
1075 pda_init();
1076 sd_init();
1077 sda_init();
1078 su_init();
1079 sua_init();
1080
1081 sndcp_data->hDTI =
1082 dti_init(SNDCP_MAX_DTI_LINKS, /* U8 maximum_links */
1083 SNDCP_handle, /* T_HANDLE handle, */
1084 #ifdef _SNDCP_DTI_2_
1085 DTI_DEFAULT_OPTIONS, /* U32 */
1086 #endif /* _SNDCP_DTI_2_ */
1087 sndcp_sig_callback);
1088
1089 return (PEI_OK);
1090 }
1091
1092 /*
1093 +------------------------------------------------------------------------------
1094 | Function : pei_timeout
1095 +------------------------------------------------------------------------------
1096 | Description : This function is called by the frame when a timer has expired.
1097 |
1098 | Parameters : index - timer index
1099 |
1100 | Return : PEI_OK - timeout processed
1101 | PEI_ERROR - timeout not processed
1102 |
1103 +------------------------------------------------------------------------------
1104 */
1105
1106 LOCAL SHORT pei_timeout (USHORT index)
1107 {
1108 TRACE_FUNCTION ("pei_timeout");
1109
1110 /*
1111 * Process timeout
1112 */
1113 if (index < TIMER_MAX) {
1114 mg_exp_re_est_timer((UBYTE)index);
1115 } else {
1116 TRACE_ERROR("Unknown Timeout");
1117 }
1118
1119 return PEI_OK;
1120 }
1121
1122 /*
1123 +------------------------------------------------------------------------------
1124 | Function : pei_signal
1125 +------------------------------------------------------------------------------
1126 | Description : This function is called by the frame when a signal has been
1127 | received.
1128 |
1129 | Parameters : opc - signal operation code
1130 | *data - pointer to primitive
1131 |
1132 | Return : PEI_OK - signal processed
1133 | PEI_ERROR - signal not processed
1134 |
1135 +------------------------------------------------------------------------------
1136 */
1137 LOCAL SHORT pei_signal (ULONG opc, void *data)
1138 {
1139 TRACE_FUNCTION ("pei_signal");
1140
1141 /*
1142 * Process signal
1143 */
1144 /*
1145 switch (opc)
1146 {
1147 default:
1148 */
1149 TRACE_ERROR("Unknown Signal OPC");
1150 /*
1151 break;
1152 } */
1153
1154 return PEI_OK;
1155 }
1156
1157 /*
1158 +------------------------------------------------------------------------------
1159 | Function : pei_exit
1160 +------------------------------------------------------------------------------
1161 | Description : This function is called by the frame when the entity is
1162 | terminated. All open resources are freed.
1163 |
1164 | Parameters : -
1165 |
1166 | Return : PEI_OK - exit sucessful
1167 | PEI_ERROR - exit not sueccessful
1168 |
1169 +------------------------------------------------------------------------------
1170 */
1171 LOCAL SHORT pei_exit (void)
1172 {
1173 UBYTE nsapi = 0;
1174
1175 TRACE_FUNCTION ("pei_exit");
1176
1177 /*
1178 * Close communication channels
1179 */
1180 vsi_c_close (VSI_CALLER hCommMMI);
1181 hCommMMI = VSI_ERROR;
1182
1183 #ifdef SNDCP_UPM_INCLUDED
1184 vsi_c_close (VSI_CALLER hCommUPM);
1185 hCommUPM = VSI_ERROR;
1186 #else
1187 vsi_c_close (VSI_CALLER hCommSM);
1188 hCommSM = VSI_ERROR;
1189 #endif
1190
1191 vsi_c_close (VSI_CALLER hCommLLC);
1192 hCommLLC = VSI_ERROR;
1193
1194 for (nsapi = 0; nsapi < SNDCP_NUMBER_OF_NSAPIS; nsapi++) {
1195 mg_delete_npdus(nsapi);
1196 }
1197
1198 dti_deinit(sndcp_data->hDTI);
1199 sndcp_data->hDTI = NULL;
1200
1201
1202 return PEI_OK;
1203 }
1204
1205 /*
1206 +------------------------------------------------------------------------------
1207 | Function : pei_run
1208 +------------------------------------------------------------------------------
1209 | Description : This function is called by the frame when entering the main
1210 | loop. This fucntion is only required in the active variant.
1211 |
1212 | This function is not used.
1213 |
1214 | Parameters : handle - Communication handle
1215 |
1216 | Return : PEI_OK - sucessful
1217 | PEI_ERROR - not successful
1218 |
1219 +------------------------------------------------------------------------------
1220 */
1221 LOCAL SHORT pei_run (T_HANDLE TaskHandle, T_HANDLE ComHandle )
1222 {
1223 /*
1224 * !!!!! Does not compile!
1225 *
1226 T_QMSG Message;
1227
1228 TRACE_FUNCTION ("pei_run");
1229
1230 if (pei_init (TaskHandle) != PEI_OK)
1231 return PEI_ERROR;
1232
1233 while (!exit_flag)
1234 {
1235 vsi_c_await (VSI_CALLER ComHandle, &Message);
1236 switch (Message.MsgType)
1237 {
1238 case MSG_PRIMITIVE:
1239 pei_primitive (Message.Msg.Primitive.Prim );
1240 break;
1241 case MSG_SIGNAL:
1242 pei_signal ( (USHORT)Message.Msg.Signal.SigOPC,
1243 Message.Msg.Signal.SigBuffer );
1244 break;
1245 case MSG_TIMEOUT:
1246 pei_timeout ( (USHORT)Message.Msg.Timer.Index );
1247 break;
1248 default:
1249 TRACE_ERROR("Unknown Message Type");
1250 break;
1251 }
1252 }
1253
1254 *
1255 *
1256 */
1257
1258 return PEI_OK;
1259 }
1260
1261 /*
1262 +------------------------------------------------------------------------------
1263 | Function : pei_config
1264 +------------------------------------------------------------------------------
1265 | Description : This function is called by the frame when a primitive is
1266 | received indicating dynamic configuration.
1267 |
1268 | This function is not used in this entity.
1269 |
1270 | Parameters : handle - Communication handle
1271 |
1272 | Return : PEI_OK - sucessful
1273 | PEI_ERROR - not successful
1274 |
1275 +------------------------------------------------------------------------------
1276 */
1277 LOCAL SHORT pei_config (char *inString)
1278 {
1279 TRACE_FUNCTION ("pei_config");
1280 TRACE_FUNCTION (inString);
1281
1282 #ifndef NCONFIG
1283 /*
1284 * Parse next keyword and number of variables
1285 */
1286
1287 /*if(!strcmp(inString,"DISCARD")) {*/
1288 if (inString[0] == 'D' && /* DISCARD NSAPI */
1289 inString[1] == 'I' &&
1290 inString[2] == 'S' &&
1291 inString[3] == 'C' &&
1292 inString[4] == 'A' &&
1293 inString[5] == 'R' &&
1294 inString[6] == 'D') {
1295
1296 UBYTE nsapi = (UBYTE)atoi(&inString[8]);
1297
1298 TRACE_EVENT_P1("Each DTI2_DATA Prim on NSAPI %d will be discarded", nsapi);
1299 nu_config_discard(nsapi);
1300 } else if (inString[0] == 'R' && /* RESUME NSAPI */
1301 inString[1] == 'E' &&
1302 inString[2] == 'S' &&
1303 inString[3] == 'U' &&
1304 inString[4] == 'M' &&
1305 inString[5] == 'E') {
1306
1307 UBYTE nsapi = (UBYTE)atoi(&inString[7]);
1308 TRACE_EVENT_P1 ("Each DTI2_DATA Prim on NSAPI %d will be forwarded", nsapi);
1309 nu_config_resume(nsapi);
1310 } else if (inString[0] == 'S' &&
1311 inString[1] == 'E' &&
1312 inString[2] == 'N' &&
1313 inString[3] == 'D') {
1314
1315 UBYTE nsapi = (UBYTE)atoi(&inString[4]);
1316
1317 U32 octets = (U32)atoi(&inString[7]);
1318
1319 nu_config_send(nsapi, octets);
1320
1321 } else if (inString[0] == 'P' &&
1322 inString[1] == 'R' &&
1323 inString[2] == 'I' &&
1324 inString[3] == 'O') {
1325
1326 UBYTE nsapi = (UBYTE)atoi(&inString[4]);
1327 UBYTE prio = (UBYTE)atoi(&inString[7]);
1328
1329 sndcp_set_nsapi_prio(nsapi, prio);
1330 } else if (inString[0] == 'N' &&
1331 inString[1] == 'O' &&
1332 inString[2] == ' ' &&
1333 inString[3] == 'X' &&
1334 inString[4] == 'I' &&
1335 inString[5] == 'D') {
1336
1337
1338 sndcp_no_xid();
1339
1340
1341 } else if (inString[0] == 'D' &&
1342 inString[1] == 'E' &&
1343 inString[2] == 'L' &&
1344 inString[3] == 'A' &&
1345 inString[4] == 'Y') {
1346
1347 USHORT millis = (USHORT)atoi(&inString[5]);
1348
1349 mg_config_delay(millis);
1350
1351 } else if (inString[0] == 'T' && /* TRACE_HEADER_ON */
1352 inString[1] == 'R' &&
1353 inString[2] == 'A' &&
1354 inString[3] == 'C' &&
1355 inString[4] == 'E' &&
1356 inString[5] == '_' &&
1357 inString[6] == 'H' &&
1358 inString[7] == 'E' &&
1359 inString[8] == 'A' &&
1360 inString[9] == 'D' &&
1361 inString[10] == 'E' &&
1362 inString[11] == 'R' &&
1363 inString[12] == '_' &&
1364 inString[13] == 'O' &&
1365 inString[14] == 'N') {
1366 sndcp_data->trace_ip_header = TRUE;
1367 } else if (inString[0] == 'T' && /* TRACE_HEADER_OFF */
1368 inString[1] == 'R' &&
1369 inString[2] == 'A' &&
1370 inString[3] == 'C' &&
1371 inString[4] == 'E' &&
1372 inString[5] == '_' &&
1373 inString[6] == 'H' &&
1374 inString[7] == 'E' &&
1375 inString[8] == 'A' &&
1376 inString[9] == 'D' &&
1377 inString[10] == 'E' &&
1378 inString[11] == 'R' &&
1379 inString[12] == '_' &&
1380 inString[13] == 'O' &&
1381 inString[14] == 'F' &&
1382 inString[15] == 'F') {
1383 sndcp_data->trace_ip_header = FALSE;
1384 }else if (inString[0] == 'T' && /* TRACE_PACKET_ON */
1385 inString[1] == 'R' &&
1386 inString[2] == 'A' &&
1387 inString[3] == 'C' &&
1388 inString[4] == 'E' &&
1389 inString[5] == '_' &&
1390 inString[6] == 'P' &&
1391 inString[7] == 'A' &&
1392 inString[8] == 'C' &&
1393 inString[9] == 'K' &&
1394 inString[10] == 'E' &&
1395 inString[11] == 'T' &&
1396 inString[12] == '_' &&
1397 inString[13] == 'O' &&
1398 inString[14] == 'N') {
1399 sndcp_data->trace_ip_datagram = TRUE;
1400 } else if (inString[0] == 'T' && /* TRACE_PACKET_OFF */
1401 inString[1] == 'R' &&
1402 inString[2] == 'A' &&
1403 inString[3] == 'C' &&
1404 inString[4] == 'E' &&
1405 inString[5] == '_' &&
1406 inString[6] == 'P' &&
1407 inString[7] == 'A' &&
1408 inString[8] == 'C' &&
1409 inString[9] == 'K' &&
1410 inString[10] == 'E' &&
1411 inString[11] == 'T' &&
1412 inString[12] == '_' &&
1413 inString[13] == 'O' &&
1414 inString[14] == 'F' &&
1415 inString[15] == 'F') {
1416 sndcp_data->trace_ip_datagram = FALSE;
1417
1418
1419
1420 #ifdef TI_PS_OP_ICUT_SNDCP
1421 /* PDP_TBR added SNDCP terminal loopback */
1422 } else if ( inString[0] == 'L' &&
1423 inString[1] == 'O' &&
1424 inString[2] == 'O' &&
1425 inString[3] == 'P' &&
1426 inString[4] == 'B' &&
1427 inString[5] == 'A' &&
1428 inString[6] == 'C' &&
1429 inString[7] == 'K')
1430 {
1431 SNDCP_LOOPBACK = 1;
1432 TRACE_EVENT("SNDCP LOOPBACK");
1433
1434 #endif /* TI_PS_OP_ICUT_SNDCP */
1435
1436 } else if (inString[0] == 'T' && /* TRACE_IP_BIN */
1437 inString[1] == 'R' &&
1438 inString[2] == 'A' &&
1439 inString[3] == 'C' &&
1440 inString[4] == 'E' &&
1441 inString[5] == '_' &&
1442 inString[6] == 'I' &&
1443 inString[7] == 'P' &&
1444 inString[8] == '_' &&
1445 inString[9] == 'B' &&
1446 inString[10] == 'I' &&
1447 inString[11] == 'N') {
1448 sndcp_data->trace_ip_bin = TRUE;
1449 } else if (inString[0] == 'I' && /* IP_FILTER_OFF */
1450 inString[1] == 'P' &&
1451 inString[2] == '_' &&
1452 inString[3] == 'F' &&
1453 inString[4] == 'I' &&
1454 inString[5] == 'L' &&
1455 inString[6] == 'T' &&
1456 inString[7] == 'E' &&
1457 inString[8] == 'R' &&
1458 inString[9] == '_' &&
1459 inString[10] == 'O' &&
1460 inString[11] == 'F' &&
1461 inString[12] == 'F') {
1462
1463 TRACE_EVENT("INFO IP FILTER: IP filter is disabled.");
1464 sndcp_data->ip_filter = FALSE;
1465 } else if (inString[0] == 'I' && /* IP_FILTER_ON */
1466 inString[1] == 'P' &&
1467 inString[2] == '_' &&
1468 inString[3] == 'F' &&
1469 inString[4] == 'I' &&
1470 inString[5] == 'L' &&
1471 inString[6] == 'T' &&
1472 inString[7] == 'E' &&
1473 inString[8] == 'R' &&
1474 inString[9] == '_' &&
1475 inString[10] == 'O' &&
1476 inString[11] == 'N') {
1477
1478 TRACE_EVENT("INFO IP FILTER: IP filter is enabled.");
1479 sndcp_data->ip_filter = TRUE;
1480 } else {
1481 TRACE_EVENT("ERROR PEI SNDCP: unknown Config Primitive!");
1482 }
1483
1484 #endif
1485
1486 return PEI_OK;
1487 }
1488
1489 /*
1490 +------------------------------------------------------------------------------
1491 | Function : pei_monitor
1492 +------------------------------------------------------------------------------
1493 | Description : This function is called by the frame in case sudden entity
1494 | specific data is requested (e.g. entity Version).
1495 |
1496 | Parameters : out_monitor - return the address of the data to be
1497 | monitoredCommunication handle
1498 |
1499 | Return : PEI_OK - sucessful (address in out_monitor is valid)
1500 | PEI_ERROR - not successful
1501 |
1502 +------------------------------------------------------------------------------
1503 */
1504 LOCAL SHORT pei_monitor (void ** out_monitor)
1505 {
1506 TRACE_FUNCTION ("pei_monitor");
1507
1508 /*
1509 * Version = "0.S" (S = Step).
1510 */
1511 sndcp_mon.version = "SNDCP 0.1";
1512 *out_monitor = &sndcp_mon;
1513
1514 return PEI_OK;
1515 }
1516
1517 /*
1518 +------------------------------------------------------------------------------
1519 | Function : pei_create
1520 +------------------------------------------------------------------------------
1521 | Description : This function is called by the frame when the process is
1522 | created.
1523 |
1524 | Parameters : out_name - Pointer to the buffer in which to locate
1525 | the name of this entity
1526 |
1527 | Return : PEI_OK - entity created successfuly
1528 | PEI_ERROR - entity could not be created
1529 |
1530 +------------------------------------------------------------------------------
1531 */
1532 GLOBAL SHORT pei_create (T_PEI_INFO **info)
1533 {
1534 static T_PEI_INFO pei_info =
1535 {
1536 "SND", /* name */
1537 { /* pei-table */
1538 pei_init,
1539 pei_exit,
1540 pei_primitive,
1541 pei_timeout,
1542 pei_signal,
1543 pei_run,
1544 pei_config,
1545 pei_monitor
1546 },
1547 1536, /* stack size */
1548 10, /* queue entries */
1549 185, /* priority (1->low, 255->high) */
1550 TIMER_MAX, /* number of timers */
1551 0x03|PRIM_NO_SUSPEND /* flags: bit 0 active(0) body/passive(1) */
1552 }; /* bit 1 com by copy(0)/reference(1) */
1553
1554
1555 TRACE_FUNCTION ("pei_create");
1556
1557 /*
1558 * Close Resources if open
1559 */
1560 if (first_access)
1561 first_access = FALSE;
1562 else
1563 pei_exit();
1564
1565 /*
1566 * Export startup configuration data
1567 */
1568 *info = &pei_info;
1569
1570 return PEI_OK;
1571 }
1572
1573 /*==== END OF FILE ==========================================================*/