FreeCalypso > hg > fc-magnetite
comparison src/g23m-fad/l2r/l2r_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 : CSD (8411) | |
4 | Modul : L2r_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 Modul defines the process body interface | |
18 | for the component L2R of the base station | |
19 +----------------------------------------------------------------------------- | |
20 */ | |
21 | |
22 #ifndef L2R_PEI_C | |
23 #define L2R_PEI_C | |
24 #endif | |
25 | |
26 #define ENTITY_L2R | |
27 #define ENTITY_TRA | |
28 | |
29 /*==== INCLUDES ===================================================*/ | |
30 | |
31 #include <string.h> | |
32 | |
33 #include "typedefs.h" | |
34 #include "pconst.cdg" | |
35 #include "vsi.h" | |
36 #include "macdef.h" | |
37 #include "custom.h" | |
38 #include "gsm.h" | |
39 #include "tools.h" | |
40 #include "cus_l2r.h" | |
41 #include "cnf_l2r.h" | |
42 #include "mon_l2r.h" | |
43 #include "prim.h" | |
44 #include "pei.h" | |
45 #include "tok.h" | |
46 #include "dti.h" /* functionality of the dti library */ | |
47 | |
48 #include "cl_ribu.h" | |
49 #include "l2r.h" | |
50 #include "tra_pei.h" | |
51 | |
52 /*==== CONST ======================================================*/ | |
53 /*==== VAR EXPORT =================================================*/ | |
54 | |
55 GLOBAL T_MODE l2r_data_mode = NONTRANSP; /* = default */ | |
56 | |
57 GLOBAL T_TRA_DATA *tra_data; | |
58 GLOBAL T_TRA_DATA *tra_data_first_elem; | |
59 GLOBAL DTI_HANDLE l2r_hDTI; /* DTI connection for DTI library */ | |
60 | |
61 GLOBAL T_HANDLE l2r_handle; | |
62 GLOBAL T_HANDLE hCommCTRL = VSI_ERROR; /* Controller Communication */ | |
63 GLOBAL T_HANDLE hCommRLP = VSI_ERROR; /* RLP Communication */ | |
64 | |
65 #ifdef _SIMULATION_ | |
66 GLOBAL T_HANDLE hCommRA = VSI_ERROR; /* RA Communication */ | |
67 #endif | |
68 | |
69 LOCAL T_HANDLE hCommL2R = VSI_ERROR; /* L2R Communication (used by relay entity) */ | |
70 | |
71 /* | |
72 * instance data base | |
73 */ | |
74 GLOBAL T_L2R_DATA l2r_data_base [L2R_INSTANCES], *l2r_data; | |
75 GLOBAL ULONG l2r_data_magic_num; | |
76 | |
77 /*==== VAR LOCAL ==================================================*/ | |
78 | |
79 LOCAL BOOL first_access = TRUE; | |
80 LOCAL T_MONITOR l2r_mon; | |
81 | |
82 /* | |
83 +------------------------------------------------------------------------------ | |
84 | Function : pei_not_supported | |
85 +------------------------------------------------------------------------------ | |
86 | Description : An unsupported primitive is received. | |
87 | | |
88 | Parameters : data - | |
89 | | |
90 | | |
91 | Return : - | |
92 +------------------------------------------------------------------------------ | |
93 */ | |
94 | |
95 | |
96 LOCAL void pei_not_supported (void *data) | |
97 { | |
98 TRACE_FUNCTION ("pei_not_supported()"); | |
99 PFREE (data); | |
100 } | |
101 | |
102 /* | |
103 * | |
104 * Use MAK_FUNC_0 for primitives which contains no SDU. | |
105 * | |
106 * Use MAK_FUNC_S for primitives which contains a SDU. | |
107 */ | |
108 | |
109 /* | |
110 * jumptable for the entity service access point. Contains | |
111 * the processing-function addresses and opcodes of | |
112 * request and response primitives. | |
113 * | |
114 */ | |
115 | |
116 LOCAL const T_FUNC l2r_table[] = { | |
117 MAK_FUNC_0( mgt_l2r_activate_req , L2R_ACTIVATE_REQ ), | |
118 MAK_FUNC_0( mgt_l2r_deactivate_req , L2R_DEACTIVATE_REQ ), | |
119 MAK_FUNC_0( mgt_l2r_connect_req , L2R_CONNECT_REQ ), | |
120 MAK_FUNC_0( mgt_l2r_disc_req , L2R_DISC_REQ ), | |
121 MAK_FUNC_N( pei_not_supported , 0 ), | |
122 MAK_FUNC_N( pei_not_supported , 0 ), | |
123 MAK_FUNC_N( pei_not_supported , 0 ), | |
124 MAK_FUNC_0( mgt_l2r_dti_req , L2R_DTI_REQ ) | |
125 }; | |
126 | |
127 LOCAL const T_FUNC tra_table[] = { | |
128 MAK_FUNC_0( mgt_tra_activate_req , TRA_ACTIVATE_REQ ), | |
129 MAK_FUNC_0( mgt_tra_deactivate_req , TRA_DEACTIVATE_REQ ), | |
130 MAK_FUNC_0( mgt_tra_dti_req , TRA_DTI_REQ ) | |
131 }; | |
132 | |
133 LOCAL void pei_dti_connect_req(T_DTI2_CONNECT_REQ *dti_connect_req); | |
134 LOCAL void pei_dti_connect_cnf(T_DTI2_CONNECT_CNF *dti_connect_cnf); | |
135 LOCAL void pei_dti_connect_ind(T_DTI2_CONNECT_IND *dti_connect_ind); | |
136 LOCAL void pei_dti_connect_res(T_DTI2_CONNECT_RES *dti_connect_res); | |
137 LOCAL void pei_dti_disconnect_req(T_DTI2_DISCONNECT_REQ *dti_disconnect_req); | |
138 LOCAL void pei_dti_disconnect_ind(T_DTI2_DISCONNECT_IND *dti_disconnect_ind); | |
139 LOCAL void pei_dti_data_req(T_DTI2_DATA_REQ *dti_data_req); | |
140 LOCAL void pei_dti_getdata_req(T_DTI2_GETDATA_REQ *dti_getdata_req); | |
141 LOCAL void pei_dti_data_ind(T_DTI2_DATA_IND *dti_data_ind); | |
142 LOCAL void pei_dti_ready_ind(T_DTI2_READY_IND *dti_ready_ind); | |
143 LOCAL void pei_dti_data_test_req(T_DTI2_DATA_TEST_REQ *dti_data_test_req); | |
144 LOCAL void pei_dti_data_test_ind(T_DTI2_DATA_TEST_IND *dti_data_test_ind); | |
145 | |
146 LOCAL const T_FUNC dti_ul_table[] = { | |
147 MAK_FUNC_0( pei_dti_connect_req , DTI2_CONNECT_REQ ), | |
148 MAK_FUNC_0( pei_dti_connect_res , DTI2_CONNECT_RES ), | |
149 MAK_FUNC_0( pei_dti_disconnect_req , DTI2_DISCONNECT_REQ ), | |
150 MAK_FUNC_0( pei_dti_getdata_req , DTI2_GETDATA_REQ ), | |
151 MAK_FUNC_0( pei_dti_data_req , DTI2_DATA_REQ ) | |
152 #ifdef _SIMULATION_ | |
153 , | |
154 MAK_FUNC_S( pei_dti_data_test_req , DTI2_DATA_TEST_REQ ) | |
155 #endif /* _SIMULATION_ */ | |
156 }; | |
157 | |
158 LOCAL const T_FUNC dti_dl_table[] = { | |
159 MAK_FUNC_0( pei_dti_connect_ind , DTI2_CONNECT_IND ), | |
160 MAK_FUNC_0( pei_dti_connect_cnf , DTI2_CONNECT_CNF ), | |
161 MAK_FUNC_0( pei_dti_disconnect_ind , DTI2_DISCONNECT_IND ), | |
162 MAK_FUNC_0( pei_dti_ready_ind , DTI2_READY_IND ), | |
163 MAK_FUNC_0( pei_dti_data_ind , DTI2_DATA_IND ) | |
164 #ifdef _SIMULATION_ | |
165 , | |
166 MAK_FUNC_S( pei_dti_data_test_ind , DTI2_DATA_TEST_IND ) | |
167 #endif /* _SIMULATION_ */ | |
168 }; | |
169 | |
170 LOCAL const T_FUNC ra_table[] = { | |
171 MAK_FUNC_0( rcv_ra_ready_ind , RA_READY_IND ), | |
172 MAK_FUNC_S( rcv_ra_data_ind , RA_DATA_IND ), | |
173 }; | |
174 | |
175 LOCAL const T_FUNC rlp_table[] = { | |
176 MAK_FUNC_0( mgt_rlp_detach_cnf , RLP_DETACH_CNF ), | |
177 MAK_FUNC_0( mgt_rlp_connect_ind , RLP_CONNECT_IND ), | |
178 MAK_FUNC_0( mgt_rlp_connect_cnf , RLP_CONNECT_CNF ), | |
179 MAK_FUNC_0( mgt_rlp_disc_ind , RLP_DISC_IND ), | |
180 MAK_FUNC_0( mgt_rlp_disc_cnf , RLP_DISC_CNF ), | |
181 MAK_FUNC_0( mgt_rlp_reset_ind , RLP_RESET_IND ), | |
182 MAK_FUNC_0( mgt_rlp_reset_cnf , RLP_RESET_CNF ), | |
183 MAK_FUNC_0( up_rlp_ready_ind , RLP_READY_IND ), | |
184 MAK_FUNC_S( dn_rlp_data_ind , RLP_DATA_IND ), | |
185 MAK_FUNC_S( mgt_rlp_ui_ind , RLP_UI_IND ), | |
186 MAK_FUNC_0( mgt_rlp_xid_ind , RLP_XID_IND ), | |
187 MAK_FUNC_0( mgt_rlp_error_ind , RLP_ERROR_IND ), | |
188 MAK_FUNC_0( mgt_rlp_statistic_ind , RLP_STATISTIC_IND ) | |
189 }; | |
190 | |
191 /* | |
192 +------------------------------------------------------------------------------ | |
193 | Function : pei_primitive | |
194 +------------------------------------------------------------------------------ | |
195 | Description : Process protocol specific primitive. | |
196 | | |
197 | Parameters : ptr - | |
198 | | |
199 | | |
200 | Return : PEI_ERROR - | |
201 | PEI_OK - | |
202 +------------------------------------------------------------------------------ | |
203 */ | |
204 LOCAL SHORT pei_primitive (void * ptr) | |
205 { | |
206 T_PRIM * prim = ptr; | |
207 /* | |
208 * @ADAPT@ | |
209 * | | | |
210 * Controller/UL UPPER LAYER | |
211 * | | | |
212 * v v | |
213 * +-----------(l2r)------(tra)----+ | |
214 * | | | | |
215 * | L2R | TRA | | |
216 * | | | | |
217 * +-------------^----------^------+ | |
218 * | | | |
219 * RLP RA LOWER LAYER | |
220 * | | | |
221 * | |
222 */ | |
223 | |
224 TRACE_FUNCTION ("pei_primitive()"); | |
225 | |
226 if (prim NEQ NULL) | |
227 { | |
228 ULONG opc = prim->custom.opc; | |
229 USHORT n; | |
230 const T_FUNC *table; | |
231 | |
232 VSI_PPM_REC ((T_PRIM_HEADER *)prim, __FILE__, __LINE__); | |
233 | |
234 PTRACE_IN (opc); | |
235 l2r_data = GET_INSTANCE (*primData); | |
236 | |
237 switch (SAP_NR(opc)) | |
238 { | |
239 case SAP_NR(L2R_UL): table = l2r_table; n = TAB_SIZE (l2r_table); break; | |
240 case SAP_NR(TRA_UL): table = tra_table; n = TAB_SIZE (tra_table); break; | |
241 case SAP_NR(RLP_DL): table = rlp_table; n = TAB_SIZE (rlp_table); break; | |
242 case DTI2_UL: | |
243 { | |
244 table = dti_ul_table; n = TAB_SIZE (dti_ul_table); | |
245 /* | |
246 * to be able to distinguish DTI1/DTI2 opcodes, | |
247 * the ones for DTI2 start at 0x50 | |
248 */ | |
249 opc -= 0x50; | |
250 } | |
251 break; | |
252 case DTI2_DL: | |
253 { | |
254 table = dti_dl_table; n = TAB_SIZE (dti_dl_table); | |
255 /* | |
256 * to be able to distinguish DTI1/DTI2 opcodes, | |
257 * the ones for DTI2 start at 0x50 | |
258 */ | |
259 opc -= 0x50; | |
260 } | |
261 break; | |
262 case SAP_NR(RA_DL ): table = ra_table; n = TAB_SIZE (ra_table); break; | |
263 default : table = NULL; n = 0; break; | |
264 } | |
265 | |
266 if (table != NULL ) | |
267 { | |
268 if (PRIM_NR(opc) < n) | |
269 { | |
270 table += PRIM_NR(opc); | |
271 #ifdef PALLOC_TRANSITION | |
272 P_SDU(prim) = table->soff ? (T_sdu*) (((char*)&prim->data) + table->soff) : 0; | |
273 P_LEN(prim) = table->size + sizeof (T_PRIM_HEADER); | |
274 #endif /* PALLOC_TRANSITION */ | |
275 JUMP (table->func) (P2D(prim)); | |
276 } | |
277 else | |
278 { | |
279 pei_not_supported (P2D(prim)); | |
280 } | |
281 return PEI_OK; | |
282 } | |
283 /* | |
284 * Primitive is no GSM Primitive | |
285 * then forward to the environment | |
286 */ | |
287 | |
288 #ifdef GSM_ONLY | |
289 PFREE (P2D(prim)) | |
290 | |
291 return PEI_ERROR; | |
292 #else | |
293 if (opc & SYS_MASK) | |
294 vsi_c_primitive (VSI_CALLER prim); | |
295 else | |
296 { | |
297 PFREE (P2D(prim)); | |
298 return PEI_ERROR; | |
299 } | |
300 #endif /* GSM_ONLY */ | |
301 } | |
302 return PEI_OK; | |
303 } | |
304 | |
305 /* | |
306 +------------------------------------------------------------------------------ | |
307 | Function: pei_sig_callback | |
308 +------------------------------------------------------------------------------ | |
309 | PURPOSE : Callback function for DTILIB | |
310 +------------------------------------------------------------------------------ | |
311 */ | |
312 | |
313 LOCAL void pei_sig_callback(U8 instance, U8 interfac, U8 channel, | |
314 U8 reason, T_DTI2_DATA_IND *dti_data_ind) | |
315 { | |
316 TRACE_FUNCTION("pei_sig_callback"); | |
317 | |
318 if (l2r_data_mode EQ NONTRANSP) | |
319 { | |
320 | |
321 #ifdef _SIMULATION_ | |
322 if (interfac NEQ L2R_DTI_UP_INTERFACE || channel NEQ L2R_DTI_UP_CHANNEL) | |
323 { | |
324 TRACE_ERROR("[PEI_SIG_CALLBACK] channel or interface not valid!"); | |
325 return; /* error, not found */ | |
326 } | |
327 #endif /* _SIMULATION_ */ | |
328 | |
329 if (l2r_hDTI NEQ D_NO_DATA_BASE) | |
330 { | |
331 switch (reason) | |
332 { | |
333 case DTI_REASON_CONNECTION_OPENED: | |
334 sig_dti_mgt_connection_opened_ind(); | |
335 break; | |
336 | |
337 case DTI_REASON_CONNECTION_CLOSED: | |
338 sig_dti_mgt_connection_closed_ind(); | |
339 break; | |
340 | |
341 case DTI_REASON_DATA_RECEIVED: | |
342 PACCESS (dti_data_ind); | |
343 { | |
344 PPASS (dti_data_ind, dti_data_req, DTI2_DATA_REQ); | |
345 sig_dti_up_data_received_ind(dti_data_req); | |
346 } | |
347 break; | |
348 | |
349 case DTI_REASON_TX_BUFFER_FULL: | |
350 sig_dti_dn_tx_buffer_full_ind(); | |
351 break; | |
352 | |
353 case DTI_REASON_TX_BUFFER_READY: | |
354 sig_dti_dn_tx_buffer_ready_ind(); | |
355 break; | |
356 | |
357 default: | |
358 TRACE_ERROR("unknown DTILIB reason parameter"); | |
359 break; | |
360 } | |
361 } | |
362 else | |
363 { | |
364 TRACE_ERROR("Pointer to DTILIB database not existing"); | |
365 } | |
366 } | |
367 else if (l2r_data_mode EQ TRANSP) | |
368 { | |
369 | |
370 #ifdef _SIMULATION_ | |
371 if (interfac NEQ TRA_DTI_UP_INTERFACE || channel NEQ TRA_DTI_UP_CHANNEL) | |
372 { | |
373 TRACE_ERROR("[PEI_SIG_CALLBACK] channel or interface not valid!"); | |
374 return; /* error, not found */ | |
375 } | |
376 #endif /* _SIMULATION_ */ | |
377 | |
378 if (l2r_hDTI NEQ D_NO_DATA_BASE) | |
379 { | |
380 switch (reason) | |
381 { | |
382 case DTI_REASON_CONNECTION_OPENED: | |
383 sig_dti_tra_mgt_connection_opened_ind(); | |
384 break; | |
385 | |
386 case DTI_REASON_CONNECTION_CLOSED: | |
387 sig_dti_tra_mgt_connection_closed_ind(); | |
388 break; | |
389 | |
390 case DTI_REASON_DATA_RECEIVED: | |
391 PACCESS (dti_data_ind); | |
392 { | |
393 PPASS (dti_data_ind, dti_data_req, DTI2_DATA_REQ); | |
394 sig_dti_tra_up_data_received_ind(dti_data_req); | |
395 } | |
396 break; | |
397 | |
398 case DTI_REASON_TX_BUFFER_FULL: | |
399 sig_dti_tra_dn_tx_buffer_full_ind(); | |
400 break; | |
401 | |
402 case DTI_REASON_TX_BUFFER_READY: | |
403 sig_dti_tra_dn_tx_buffer_ready_ind(); | |
404 break; | |
405 | |
406 default: | |
407 TRACE_ERROR("unknown DTILIB reason parameter"); | |
408 break; | |
409 } | |
410 } | |
411 else | |
412 { | |
413 TRACE_ERROR("Pointer to DTILIB database not existing"); | |
414 } | |
415 } | |
416 } /*lint !e715 instance, interfac, channel not referenced */ | |
417 | |
418 /* | |
419 +------------------------------------------------------------------------------ | |
420 | Function : pei_init | |
421 +------------------------------------------------------------------------------ | |
422 | Description : Initialize Protocol Stack Entity | |
423 | | |
424 | Parameters : handle - | |
425 | | |
426 | | |
427 | Return : PEI_OK - | |
428 | PEI_ERROR - | |
429 +------------------------------------------------------------------------------ | |
430 */ | |
431 | |
432 #define CTRL_NAME ACI_NAME | |
433 | |
434 LOCAL SHORT pei_init (T_HANDLE handle) | |
435 { | |
436 BOOL ret = PEI_OK; | |
437 | |
438 tra_data = NULL; | |
439 | |
440 l2r_handle = handle; | |
441 | |
442 TRACE_FUNCTION ("pei_init()"); | |
443 | |
444 if (hCommCTRL < VSI_OK) | |
445 { | |
446 if ((hCommCTRL = vsi_c_open (VSI_CALLER CTRL_NAME)) < VSI_OK) | |
447 return PEI_ERROR; | |
448 } | |
449 | |
450 if (hCommRLP < VSI_OK) | |
451 { | |
452 if ((hCommRLP = vsi_c_open (VSI_CALLER RLP_NAME)) < VSI_OK) | |
453 return PEI_ERROR; | |
454 } | |
455 | |
456 if (hCommL2R < VSI_OK) | |
457 { | |
458 if ((hCommL2R = vsi_c_open (VSI_CALLER L2R_NAME)) < VSI_OK) | |
459 return PEI_ERROR; | |
460 } | |
461 | |
462 #ifdef _SIMULATION_ | |
463 if (hCommRA < VSI_OK) | |
464 { | |
465 if ((hCommRA = vsi_c_open (VSI_CALLER RA_NAME)) < VSI_OK) | |
466 return PEI_ERROR; | |
467 } | |
468 #endif | |
469 | |
470 /* | |
471 * initialize dtilib for this entity | |
472 */ | |
473 l2r_hDTI = dti_init(L2R_INSTANCES, handle, DTI_DEFAULT_OPTIONS, pei_sig_callback); | |
474 | |
475 if(!l2r_hDTI) | |
476 return PEI_ERROR; | |
477 | |
478 l2r_data = &l2r_data_base[0]; | |
479 l2r_data_magic_num = 0; /* memory is not yet initialized */ | |
480 INIT_STATE (DTI, DTI_CLOSED); | |
481 mgt_init(&l2r_data->mgt); | |
482 dn_init(&l2r_data->dn); | |
483 up_init(&l2r_data->up); | |
484 tra_data_first_elem = (T_TRA_DATA *) &l2r_data_base[0]; | |
485 return (ret); | |
486 } | |
487 | |
488 /* | |
489 +------------------------------------------------------------------------------ | |
490 | Function : pei_timeout | |
491 +------------------------------------------------------------------------------ | |
492 | Description : Process timeout | |
493 | | |
494 | Parameters : index - | |
495 | | |
496 | | |
497 | Return : PEI_OK - | |
498 | | |
499 +------------------------------------------------------------------------------ | |
500 */ | |
501 EXTERN void tim_tup_snd (void); | |
502 | |
503 LOCAL SHORT pei_timeout (USHORT index) | |
504 { | |
505 if (index EQ TIMER_TUP_SND) | |
506 { | |
507 tim_tup_snd (); | |
508 } | |
509 return PEI_OK; | |
510 } | |
511 | |
512 /* | |
513 +------------------------------------------------------------------------------ | |
514 | Function : pei_signal | |
515 +------------------------------------------------------------------------------ | |
516 | Description : Functional interface to signal a primitive. | |
517 | | |
518 | Parameters : opc - | |
519 | primData - | |
520 | | |
521 | | |
522 | Return : PEI_OK | |
523 +------------------------------------------------------------------------------ | |
524 */ | |
525 | |
526 LOCAL SHORT pei_signal (ULONG opc, void *primData) | |
527 { | |
528 #ifdef OPTION_SIGNAL | |
529 | |
530 l2r_data = GET_INSTANCE (prim); | |
531 switch (opc) | |
532 { | |
533 case RA_READY_IND: | |
534 rcv_ra_ready_ind | |
535 ( | |
536 (T_RA_READY_IND *)primData | |
537 ); | |
538 break; | |
539 | |
540 case RA_DATA_IND: | |
541 rcv_ra_data_ind | |
542 ( | |
543 (T_RA_DATA_IND *)primData | |
544 ); | |
545 break; | |
546 | |
547 case RA_BREAK_IND: | |
548 rcv_ra_break_ind | |
549 ( | |
550 (T_RA_BREAK_IND *)primData | |
551 ); | |
552 break; | |
553 } | |
554 #endif /* OPTION_SIGNAL */ | |
555 return PEI_OK; | |
556 } | |
557 | |
558 /* | |
559 +------------------------------------------------------------------------------ | |
560 | Function : pei_exit | |
561 +------------------------------------------------------------------------------ | |
562 | Description : Close Resources and terminate | |
563 | | |
564 | Parameters : - | |
565 | | |
566 | | |
567 | Return : PEI_OK - | |
568 +------------------------------------------------------------------------------ | |
569 */ | |
570 | |
571 LOCAL SHORT pei_exit (void) | |
572 { | |
573 TRACE_FUNCTION ("pei_exit()"); | |
574 | |
575 /* | |
576 * clean up vsi communication | |
577 */ | |
578 vsi_c_close (VSI_CALLER hCommCTRL); | |
579 hCommCTRL = VSI_ERROR; | |
580 | |
581 vsi_c_close (VSI_CALLER hCommRLP); | |
582 hCommRLP = VSI_ERROR; | |
583 | |
584 #ifdef _SIMULATION_ | |
585 vsi_c_close (VSI_CALLER hCommRA); | |
586 hCommRA = VSI_ERROR; | |
587 #endif | |
588 | |
589 if (GET_STATE (DTI) NEQ DTI_CLOSED) | |
590 { | |
591 if (l2r_data_mode EQ NONTRANSP) | |
592 { | |
593 dti_close(l2r_hDTI, L2R_DTI_UP_DEF_INSTANCE, L2R_DTI_UP_INTERFACE, L2R_DTI_UP_CHANNEL, FALSE); | |
594 SET_STATE (DTI, DTI_CLOSED); | |
595 } | |
596 else if (l2r_data_mode EQ TRANSP) | |
597 { | |
598 dti_close(l2r_hDTI, TRA_DTI_UP_INSTANCE, TRA_DTI_UP_INTERFACE, TRA_DTI_UP_CHANNEL, FALSE); | |
599 SET_STATE (DTI, DTI_CLOSED); | |
600 } | |
601 } | |
602 | |
603 vsi_c_close (VSI_CALLER hCommL2R); | |
604 hCommL2R = VSI_ERROR; | |
605 | |
606 /* | |
607 * Shut down dtilib communication | |
608 */ | |
609 dti_deinit(l2r_hDTI); | |
610 return PEI_OK; | |
611 } | |
612 | |
613 /* | |
614 +------------------------------------------------------------------------------ | |
615 | Function : pei_config | |
616 +------------------------------------------------------------------------------ | |
617 | Description : Dynamic Configuration | |
618 | | |
619 | Parameters : inString - | |
620 | | |
621 | | |
622 | Return : PEI_OK - | |
623 +------------------------------------------------------------------------------ | |
624 */ | |
625 | |
626 LOCAL SHORT pei_config (T_PEI_CONFIG inString) | |
627 { | |
628 #ifndef NCONFIG | |
629 | |
630 char *s = inString; | |
631 | |
632 const T_STR_IND tmr_name_to_ind[] = | |
633 { | |
634 { "TUP_SND", 1 }, | |
635 { NULL, 0 } | |
636 }; | |
637 | |
638 TRACE_FUNCTION ("pei_config()"); | |
639 TRACE_EVENT (s); | |
640 | |
641 if (ConfigTimer(VSI_CALLER inString, tmr_name_to_ind) EQ VSI_OK) | |
642 return PEI_OK; | |
643 else | |
644 return PEI_ERROR; | |
645 | |
646 #else /* NCONFIG */ | |
647 | |
648 return PEI_OK; | |
649 | |
650 #endif | |
651 } | |
652 | |
653 /* | |
654 +------------------------------------------------------------------------------ | |
655 | Function : pei_monitor | |
656 +------------------------------------------------------------------------------ | |
657 | Description : Monitoring of physical Parameters | |
658 | | |
659 | Parameters : monitor - | |
660 | | |
661 | | |
662 | Return : PEI_OK; | |
663 +------------------------------------------------------------------------------ | |
664 */ | |
665 | |
666 LOCAL SHORT pei_monitor (void **monitor) | |
667 { | |
668 TRACE_FUNCTION ("pei_monitor()"); | |
669 | |
670 l2r_mon.version = VERSION_L2R; | |
671 *monitor = &l2r_mon; | |
672 return PEI_OK; | |
673 } | |
674 | |
675 /* | |
676 +------------------------------------------------------------------------------ | |
677 | Function : pei_dti_connect_req | |
678 +------------------------------------------------------------------------------ | |
679 | PURPOSE : Call the process function dti_dti_connect_req | |
680 +------------------------------------------------------------------------------ | |
681 */ | |
682 | |
683 LOCAL void pei_dti_connect_req(T_DTI2_CONNECT_REQ *dti_connect_req) | |
684 { | |
685 dti_dti_connect_req (l2r_hDTI, dti_connect_req); | |
686 } | |
687 | |
688 /* | |
689 +------------------------------------------------------------------------------ | |
690 | Function : pei_dti_connect_cnf | |
691 +------------------------------------------------------------------------------ | |
692 | PURPOSE : Call the process function dti_dti_connect_cnf | |
693 +------------------------------------------------------------------------------ | |
694 */ | |
695 | |
696 LOCAL void pei_dti_connect_cnf(T_DTI2_CONNECT_CNF *dti_connect_cnf) | |
697 { | |
698 dti_dti_connect_cnf(l2r_hDTI, dti_connect_cnf); | |
699 } | |
700 | |
701 /* | |
702 +------------------------------------------------------------------------------ | |
703 | Function : pei_dti_connect_ind | |
704 +------------------------------------------------------------------------------ | |
705 | PURPOSE : Call the process function dti_dti_connect_ind | |
706 +------------------------------------------------------------------------------ | |
707 */ | |
708 | |
709 LOCAL void pei_dti_connect_ind(T_DTI2_CONNECT_IND *dti_connect_ind) | |
710 { | |
711 dti_dti_connect_ind(l2r_hDTI, dti_connect_ind); | |
712 } | |
713 | |
714 /* | |
715 +------------------------------------------------------------------------------ | |
716 | Function : pei_dti_connect_res | |
717 +------------------------------------------------------------------------------ | |
718 | PURPOSE : Call the process function dti_dti_connect_res | |
719 +------------------------------------------------------------------------------ | |
720 */ | |
721 | |
722 LOCAL void pei_dti_connect_res(T_DTI2_CONNECT_RES *dti_connect_res) | |
723 { | |
724 dti_dti_connect_res(l2r_hDTI, dti_connect_res); | |
725 } | |
726 | |
727 /* | |
728 +------------------------------------------------------------------------------ | |
729 | Function : pei_dti_disconnect_req | |
730 +------------------------------------------------------------------------------ | |
731 | PURPOSE : Call the process function dti_dti_disconnect_req | |
732 +------------------------------------------------------------------------------ | |
733 */ | |
734 | |
735 LOCAL void pei_dti_disconnect_req(T_DTI2_DISCONNECT_REQ *dti_disconnect_req) | |
736 { | |
737 dti_dti_disconnect_req (l2r_hDTI, dti_disconnect_req); | |
738 } | |
739 | |
740 /* | |
741 +------------------------------------------------------------------------------ | |
742 | Function : pei_dti_disconnect_ind | |
743 +------------------------------------------------------------------------------ | |
744 | PURPOSE : Call the process function dti_dti_disconnect_ind | |
745 +------------------------------------------------------------------------------ | |
746 */ | |
747 | |
748 LOCAL void pei_dti_disconnect_ind(T_DTI2_DISCONNECT_IND *dti_disconnect_ind) | |
749 { | |
750 dti_dti_disconnect_ind (l2r_hDTI, dti_disconnect_ind); | |
751 } | |
752 | |
753 /* | |
754 +------------------------------------------------------------------------------ | |
755 | Function : pei_dti_data_req | |
756 +------------------------------------------------------------------------------ | |
757 | PURPOSE : Call the process function dti_dti_data_req | |
758 +------------------------------------------------------------------------------ | |
759 */ | |
760 | |
761 LOCAL void pei_dti_data_req(T_DTI2_DATA_REQ *dti_data_req) | |
762 { | |
763 dti_dti_data_req (l2r_hDTI, dti_data_req); | |
764 } | |
765 | |
766 /* | |
767 +------------------------------------------------------------------------------ | |
768 | Function : pei_dti_getdata_req | |
769 +------------------------------------------------------------------------------ | |
770 | PURPOSE : Call the process function dti_dti_getdata_req | |
771 +------------------------------------------------------------------------------ | |
772 */ | |
773 | |
774 LOCAL void pei_dti_getdata_req(T_DTI2_GETDATA_REQ *dti_getdata_req) | |
775 { | |
776 dti_dti_getdata_req (l2r_hDTI, dti_getdata_req); | |
777 } | |
778 | |
779 /* | |
780 +------------------------------------------------------------------------------ | |
781 | Function : pei_dti_data_ind | |
782 +------------------------------------------------------------------------------ | |
783 | PURPOSE : Call the process function dti_dti_data_ind | |
784 +------------------------------------------------------------------------------ | |
785 */ | |
786 | |
787 LOCAL void pei_dti_data_ind(T_DTI2_DATA_IND *dti_data_ind) | |
788 { | |
789 dti_dti_data_ind (l2r_hDTI, dti_data_ind); | |
790 } | |
791 | |
792 /* | |
793 +------------------------------------------------------------------------------ | |
794 | Function : pei_dti_ready_ind | |
795 +------------------------------------------------------------------------------ | |
796 | PURPOSE : Call the process function dti_dti_ready_ind | |
797 +------------------------------------------------------------------------------ | |
798 */ | |
799 | |
800 LOCAL void pei_dti_ready_ind(T_DTI2_READY_IND *dti_ready_ind) | |
801 { | |
802 dti_dti_ready_ind (l2r_hDTI, dti_ready_ind); | |
803 } | |
804 | |
805 #ifdef _SIMULATION_ | |
806 | |
807 /* | |
808 +------------------------------------------------------------------------------ | |
809 | Function : pei_dti_data_test_req | |
810 +------------------------------------------------------------------------------ | |
811 | PURPOSE : Call the process function dti_dti_data_test_req | |
812 +------------------------------------------------------------------------------ | |
813 */ | |
814 | |
815 LOCAL void pei_dti_data_test_req(T_DTI2_DATA_TEST_REQ *dti_data_test_req) | |
816 { | |
817 dti_dti_data_test_req (l2r_hDTI, dti_data_test_req); | |
818 } | |
819 | |
820 /* | |
821 +------------------------------------------------------------------------------ | |
822 | Function : pei_dti_data_test_ind | |
823 +------------------------------------------------------------------------------ | |
824 | PURPOSE : Call the process function dti_dti_data_test_ind | |
825 +------------------------------------------------------------------------------ | |
826 */ | |
827 | |
828 LOCAL void pei_dti_data_test_ind(T_DTI2_DATA_TEST_IND *dti_data_test_ind) | |
829 { | |
830 dti_dti_data_test_ind (l2r_hDTI, dti_data_test_ind); | |
831 } | |
832 | |
833 #endif /* _SIMULATION_ */ | |
834 | |
835 /* | |
836 +------------------------------------------------------------------------------ | |
837 | Function : pei_create | |
838 +------------------------------------------------------------------------------ | |
839 | Description : Create the Protocol Stack Entity | |
840 | | |
841 | Parameters : info - | |
842 | | |
843 | | |
844 | Return : PEI_OK - | |
845 +------------------------------------------------------------------------------ | |
846 */ | |
847 | |
848 /*lint -e714 : Symbol not referenced */ | |
849 /*lint -e765 : external could be made static */ | |
850 GLOBAL T_PEI_RETURN l2r_pei_create (T_PEI_INFO **info) | |
851 { | |
852 static const T_PEI_INFO pei_info = | |
853 { | |
854 "L2R", | |
855 { | |
856 pei_init, | |
857 pei_exit, | |
858 pei_primitive, | |
859 pei_timeout, | |
860 pei_signal, | |
861 NULL, /* no run function */ | |
862 pei_config, | |
863 pei_monitor | |
864 }, | |
865 1024, | |
866 10, | |
867 205, | |
868 2, | |
869 #ifdef _TARGET_ | |
870 (PASSIVE_BODY|COPY_BY_REF|TRC_NO_SUSPEND|PRIM_NO_SUSPEND) | |
871 #else | |
872 (PASSIVE_BODY|COPY_BY_REF) | |
873 #endif | |
874 }; | |
875 | |
876 TRACE_FUNCTION ("pei_create()"); | |
877 | |
878 /* | |
879 * Close Resources if open | |
880 */ | |
881 if (first_access) | |
882 first_access = FALSE; | |
883 else | |
884 pei_exit (); | |
885 | |
886 /* | |
887 * Export Startup Configuration data | |
888 */ | |
889 *info = (T_PEI_INFO *)&pei_info; | |
890 | |
891 return PEI_OK; | |
892 } |