comparison src/gpf/tst/drv/mux_pei.c @ 6:8b2a9a374324

src/gpf: addition of Magnetite src/gpf2
author Mychaela Falconia <falcon@freecalypso.org>
date Sun, 15 Jul 2018 08:15:49 +0000
parents
children
comparison
equal deleted inserted replaced
5:1ea54a97e831 6:8b2a9a374324
1 /*
2 +------------------------------------------------------------------------------
3 | File: mux_pei.c
4 +------------------------------------------------------------------------------
5 | Copyright 2002 Texas Instruments Berlin, AG
6 | All rights reserved.
7 |
8 | This file is confidential and a trade secret of Texas
9 | Instruments Berlin, AG
10 | The receipt of or possession of this file does not convey
11 | any rights to reproduce or disclose its contents or to
12 | manufacture, use, or sell anything it may describe, in
13 | whole, or in part, without the specific written consent of
14 | Texas Instruments Berlin, AG.
15 +-----------------------------------------------------------------------------
16 | Purpose : This module implements the process body interface
17 | for the entity mux (used by tst for multiplexer driver).
18 +-----------------------------------------------------------------------------
19 */
20
21 #ifndef MUX_PEI_C
22 #define MUX_PEI_C
23 #endif
24
25 #ifndef ENTITY_MUX
26 #define ENTITY_MUX
27 #endif
28
29 #define ENTITY_UART /* test only */
30
31 /*==== INCLUDES =============================================================*/
32
33
34 #include "stdlib.h"
35 #include <stdio.h>
36 #include "string.h"
37 #include "typedefs.h"
38
39 #include "tools.h"
40 #include "os.h"
41 #include "gdi.h"
42 #include "vsi.h"
43 #include "glob_defs.h"
44 #include "frame.h"
45 #include "prim.h" /* to get the definitions of used SAP and directions */
46 #include "gsm.h"
47 #include "pei.h"
48 #include "route.h"
49 #include "dti.h" /* functionality of the dti library */
50 #include "mux.h" /* to get the global entity definitions */
51
52 /*==== CONSTS ================================================================*/
53
54 #undef VSI_CALLER
55 #define VSI_CALLER m_handle,
56
57 /*
58 * Wait as long as possible. This is the time in ms that is waited for a
59 * message in the input queue in the active variant.
60 * It can be decreased by the customer.
61 */
62 #define MUX_TIMEOUT 0xffffffff
63
64 /*==== TYPES =================================================================*/
65
66 typedef struct
67 {
68 char *version;
69 } T_MONITOR;
70
71 /*==== GLOBAL VARIABLES ======================================================*/
72 /*==== LOCALS ================================================================*/
73
74 static int m_first = 1;
75 static T_MONITOR m_mon;
76
77 static int m_uart_ready = 0;
78
79 static T_desc2 * m_send_data=NULL;
80 static USHORT m_send_len=0;
81
82 T_HANDLE m_handle;
83 T_DRV_SIGNAL m_signal;
84
85 GLOBAL DTI_HANDLE mtst_hDTI; /* handle for DTI library */
86 T_QMSG QueueMsg;
87 /*==== EXTERNAL DEFINED FUNCTIONS ==========================================*/
88
89 /*==== PRIMITIVE HANDLER FUNCTIONS ==========================================*/
90
91 static void primitive_not_supported (T_PRIM_HEADER *data);
92 static void dti_data_req (T_DTI2_DATA_REQ *ptr);
93
94 /*
95 * Jumptables to primitive handler functions. One table per SAP.
96 *
97 * Use MAK_FUNC_0 for primitives which contains no SDU.
98 * Use MAK_FUNC_S for primitives which contains a SDU.
99 */
100
101 LOCAL const T_FUNC dti_ul_table[] = {
102 MAK_FUNC_0( primitive_not_supported , DTI2_CONNECT_REQ ), /* 3700x */
103 MAK_FUNC_0( primitive_not_supported , DTI2_CONNECT_RES ), /* 3701x */
104 MAK_FUNC_0( primitive_not_supported , DTI2_DISCONNECT_REQ ), /* 3702x */
105 MAK_FUNC_0( primitive_not_supported , DTI2_GETDATA_REQ ), /* 3703x */
106 MAK_FUNC_0( dti_data_req , DTI2_DATA_REQ ) /* 3704x */
107 #if defined (_SIMULATION_)
108 ,
109 MAK_FUNC_S( primitive_not_supported , DTI2_DATA_TEST_REQ )
110 #endif /* _SIMULATION_ */
111 };
112
113 LOCAL const T_FUNC dti_dl_table[] = {
114 MAK_FUNC_0( pei_dti_dti_connect_ind , DTI2_CONNECT_IND ), /* 7700x */
115 MAK_FUNC_0( pei_dti_dti_connect_cnf , DTI2_CONNECT_CNF ), /* 7701x */
116 MAK_FUNC_0( pei_dti_dti_disconnect_ind , DTI2_DISCONNECT_IND ), /* 7702x */
117 MAK_FUNC_0( pei_dti_dti_ready_ind , DTI2_READY_IND ), /* 7703x */
118 MAK_FUNC_0( pei_dti_dti_data_ind , DTI2_DATA_IND ) /* 7704x */
119 #if defined (_SIMULATION_)
120 ,
121 MAK_FUNC_S( pei_dti_dti_data_test_ind , DTI2_DATA_TEST_IND )
122 #endif /* _SIMULATION_ */
123 };
124
125
126 /*==== PRIVATE FUNCTIONS ====================================================*/
127
128 /*
129 +------------------------------------------------------------------------------
130 | Function : primitive_not_supported
131 +------------------------------------------------------------------------------
132 | Description : This function handles unsupported primitives.
133 |
134 | Parameters : data - not used
135 |
136 | Return : void
137 +------------------------------------------------------------------------------
138 */
139 static void primitive_not_supported (T_PRIM_HEADER *data)
140 {
141 //TRACE_FUNCTION ("primitive_not_supported");
142
143 PFREE (data);
144 }
145
146 /*
147 +------------------------------------------------------------------------------
148 | Function : pei_primitive
149 +------------------------------------------------------------------------------
150 | Description : Process protocol specific primitive.
151 |
152 | Parameters : prim - pointer to the received primitive
153 |
154 | Return : PEI_OK - function succeeded
155 | PEI_ERROR - function failed
156 +------------------------------------------------------------------------------
157
158 | |
159 TST UART UPLINK
160 | |
161 +------v-----------v-------+
162 | |
163 | MUX |
164 | |
165 +-------------^------------+
166 |
167 UART DOWNLINK
168 |
169
170 */
171 static short pei_primitive (void *ptr)
172 {
173 /*
174 * the following line of code causes a warning on tms470 compiler, that cannot be avoided
175 * without changing the PEI interface. Warning will not cause a problem
176 */
177 T_PRIM * prim=(T_PRIM*)ptr;
178
179 //TRACE_FUNCTION ("pei_primitive");
180
181 if (prim != NULL)
182 {
183 unsigned short opc = (unsigned short)prim->custom.opc;
184 unsigned short n;
185 const T_FUNC *table;
186
187 /*
188 * This must be called for Partition Pool supervision. Will be replaced
189 * by another macro some time.
190 */
191 VSI_PPM_REC (&prim->custom, __FILE__, __LINE__);
192
193 //PTRACE_IN (opc);
194
195 switch (opc & OPC_MASK)
196 {
197 case DTI_DL: /* defined in prim.h */
198 table = dti_dl_table;
199 n = TAB_SIZE (dti_dl_table);
200 /*
201 * to be able to distinguish DTI1/DTI2 opcodes,
202 * the ones for DTI2 start at 0x50
203 */
204 opc -= 0x50;
205 break;
206 case DTI_UL: /* defined in prim.h */
207 table = dti_ul_table;
208 n = TAB_SIZE (dti_ul_table);
209 /*
210 * to be able to distinguish DTI1/DTI2 opcodes,
211 * the ones for DTI2 start at 0x50
212 */
213 opc -= 0x50;
214 break;
215 default:
216 table = NULL;
217 n = 0;
218 break;
219 }
220
221 if (table != NULL)
222 {
223 if ((opc & PRM_MASK) < n)
224 {
225 table += opc & PRM_MASK;
226 P_SDU(prim) = table->soff ?
227 (T_sdu*) (((char*)&prim->data) + table->soff) : 0;
228 P_LEN(prim) = table->size + sizeof (T_PRIM_HEADER);
229 JUMP (table->func) (P2D(prim));
230 }
231 else
232 {
233 primitive_not_supported (P2D(prim));
234 }
235 return PEI_OK;
236 }
237
238 /*
239 * primitive is not a GSM primitive - forward it to the environment
240 */
241 if (opc & SYS_MASK)
242 vsi_c_primitive (VSI_CALLER prim);
243 else
244 {
245 PFREE (P2D(prim));
246 return PEI_ERROR;
247 }
248 }
249 return PEI_OK;
250 }
251
252 /*
253 +------------------------------------------------------------------------------
254 | Function : pei_init
255 +------------------------------------------------------------------------------
256 | Description : Initialize Protocol Stack Entity
257 |
258 | Parameters : handle - task handle
259 |
260 | Return : PEI_OK - entity initialised
261 | PEI_ERROR - entity not (yet) initialised
262 +------------------------------------------------------------------------------
263 */
264 static short pei_init (T_HANDLE handle)
265 {
266 /* Initialize task handle */
267 m_handle = handle;
268 mux_data.dti_state = CLOSED;
269
270 /*
271 * initialize dtilib for this entity
272 */
273 mtst_hDTI = dti_init(
274 1, /* max simultaneous connections */
275 handle,
276 DTI_NO_TRACE,
277 pei_sig_callback
278 );
279 if(!mtst_hDTI)
280 return PEI_ERROR;
281
282 /* set no suspend for us and TST */
283 vsi_trcsuspend ( VSI_CALLER vsi_c_open (0,"MTST"), 0);
284 vsi_trcsuspend ( VSI_CALLER vsi_c_open (0,"TST"), 0);
285
286 return (PEI_OK);
287 }
288
289 /*
290 +------------------------------------------------------------------------------
291 | Function : pei_timeout
292 +------------------------------------------------------------------------------
293 | Description : Process timeout.
294 |
295 | Parameters : index - timer index
296 |
297 | Return : PEI_OK - timeout processed
298 | PEI_ERROR - timeout not processed
299 +------------------------------------------------------------------------------
300 */
301 static short pei_timeout (unsigned short index)
302 {
303 //TRACE_FUNCTION ("pei_timeout");
304
305 /* Process timeout */
306 switch (index)
307 {
308 case 0:
309 /* Call of timeout routine */
310 break;
311 default:
312 //TRACE_ERROR("Unknown Timeout");
313 return PEI_ERROR;
314 }
315
316 return PEI_OK;
317 }
318
319 /*
320 +------------------------------------------------------------------------------
321 | Function : pei_signal
322 +------------------------------------------------------------------------------
323 | Description : Process signal.
324 |
325 | Parameters : opc - signal operation code
326 | data - pointer to primitive
327 |
328 | Return : PEI_OK - signal processed
329 | PEI_ERROR - signal not processed
330 +------------------------------------------------------------------------------
331 */
332 static short pei_signal (unsigned long opc, void* data)
333 {
334 //TRACE_FUNCTION ("pei_signal");
335
336 /* Process signal */
337 switch (opc)
338 {
339 default:
340 //TRACE_ERROR("Unknown Signal OPC");
341 return PEI_ERROR;
342 }
343
344 return PEI_OK;
345 }
346
347 /*
348 +------------------------------------------------------------------------------
349 | Function : pei_exit
350 +------------------------------------------------------------------------------
351 | Description : Close Resources and terminate.
352 |
353 | Parameters : -
354 |
355 | Return : PEI_OK - exit sucessful
356 +------------------------------------------------------------------------------
357 */
358 static short pei_exit (void)
359 {
360 //TRACE_FUNCTION ("pei_exit");
361
362 /*
363 * Close communication channels
364 */
365
366 if (mux_data.dti_state NEQ CLOSED)
367 {
368 dti_close
369 (
370 mtst_hDTI,
371 MTST_DTI_DN_INSTANCE,
372 MTST_DTI_DN_INTERFACE,
373 MTST_DTI_DN_CHANNEL,
374 FALSE
375 );
376 mux_data.dti_state = CLOSED;
377 }
378
379 /*
380 * Shut down dtilib
381 */
382 dti_deinit(mtst_hDTI);
383
384 return PEI_OK;
385 }
386
387
388 /* for test only - begin */
389 #define MTST_TRACE 0x4f20
390 typedef struct {
391 char str[80];
392 } T_MTST_TRACE;
393
394 void trace_aci(const char* str)
395 {
396 PALLOC(ptr,MTST_TRACE);
397 strcpy(ptr->str,str);
398
399 PSEND(vsi_c_open(VSI_CALLER "MMI"), ptr);
400 }
401 /* for test only - end */
402
403 /*
404 +------------------------------------------------------------------------------
405 | Function : pei_config
406 +------------------------------------------------------------------------------
407 | Description : Dynamic Configuration.
408 |
409 | Parameters : Buffer - configuration string (
410 | to start: "<DTI-partner> <tui> <c_id>"
411 | to stop: "STOP")
412 |
413 | Return : PEI_OK - sucessful
414 | PEI_ERROR - not successful
415 +------------------------------------------------------------------------------
416 */
417 static short pei_config (char *Buffer)
418 {
419 char token [10];
420 char peer_name [10];
421
422 USHORT len;
423
424 ULONG link_id;
425
426 //TRACE_FUNCTION ("pei_config");
427 //TRACE_FUNCTION (Buffer);
428
429 if ( ConfigTimer ( VSI_CALLER Buffer, NULL ) == VSI_OK )
430 return PEI_OK;
431
432 /*
433 * further dynamic configuration
434 */
435
436 /* interprete configuration string */
437 if (!(len = GetNextToken (Buffer, token, " #")))
438 {
439 return DRV_INVALID_PARAMS;
440 }
441 else
442 {
443 Buffer += (len+1);
444 }
445 if (strcmp(token,"STOP")==0)
446 {
447 dti_close
448 (
449 mtst_hDTI,
450 MTST_DTI_DN_INSTANCE,
451 MTST_DTI_DN_INTERFACE,
452 MTST_DTI_DN_CHANNEL,
453 FALSE
454 );
455 mux_data.dti_state=CLOSED;
456 mux_data.h_comm_mtst=VSI_ERROR;
457 m_uart_ready=0;
458 if (mux_data.send_data_buf_count>0) {
459 /* clear send_buffer */
460 T_desc2 *d_new;
461 T_desc2 *d=m_send_data;
462 while (d)
463 {
464 d_new=(T_desc2 *)d->next;
465 MFREE(d);
466 d=d_new;
467 }
468
469 mux_data.send_data_buf_count=0;
470 }
471
472 return PEI_OK;
473 }
474 strcpy(peer_name, token);
475
476 if (!(len = GetNextToken (Buffer, token, " #")))
477 {
478 return DRV_INVALID_PARAMS;
479 }
480 else
481 {
482 Buffer += (len+1);
483 }
484 link_id=atoi(token);
485
486 if(
487 dti_open (
488 mtst_hDTI,
489 MTST_DTI_DN_INSTANCE,
490 MTST_DTI_DN_INTERFACE,
491 MTST_DTI_DN_CHANNEL,
492 0,
493 DTI_CHANNEL_TO_LOWER_LAYER,
494 DTI_QUEUE_UNUSED,
495 DTI_VERSION_10,
496 (U8*)peer_name,
497 link_id
498 ) EQ FALSE)
499 return DRV_INVALID_PARAMS;
500
501 /* reset send_data_buf counter */
502 mux_data.send_data_buf_count=0;
503
504 /* set internal communication handle */
505 while ( (mux_data.h_comm_mtst=vsi_c_open (0, "MTST")) == VSI_ERROR)
506 {
507 vsi_t_sleep(0,100);
508 };
509
510 /* inform UART that we are ready to receive next data package */
511 {
512 dti_start
513 (
514 mtst_hDTI,
515 MTST_DTI_DN_INSTANCE,
516 MTST_DTI_DN_INTERFACE,
517 MTST_DTI_DN_CHANNEL
518 );
519 }
520
521 return PEI_OK;
522 }
523
524 /*
525 +------------------------------------------------------------------------------
526 | Function : pei_monitor
527 +------------------------------------------------------------------------------
528 | Description : Monitoring of physical Parameters.
529 |
530 | Parameters : out_monitor - return the address of the data to be monitored
531 |
532 | Return : PEI_OK - sucessful (address in out_monitor is valid)
533 | PEI_ERROR - not successful
534 +------------------------------------------------------------------------------
535 */
536 static short pei_monitor (void ** out_monitor)
537 {
538 //TRACE_FUNCTION ("pei_monitor");
539
540 /*
541 * Version = "0.S" (S = Step).
542 */
543 m_mon.version = "MTST 1.0";
544 *out_monitor = &m_mon;
545
546 return PEI_OK;
547 }
548
549 /*==== PUBLIC FUNCTIONS =====================================================*/
550
551 /*
552 +------------------------------------------------------------------------------
553 | Function : pei_create
554 +------------------------------------------------------------------------------
555 | Description : Create the Protocol Stack Entity.
556 |
557 | Parameters : info - Pointer to the structure of entity parameters
558 |
559 | Return : PEI_OK - entity created successfully
560 |
561 +------------------------------------------------------------------------------
562 */
563 SHORT pei_create (T_PEI_INFO const **info)
564 {
565 static T_PEI_INFO pei_info =
566 {
567 "MTST", /* name */
568 { /* pei-table */
569 pei_init,
570 pei_exit,
571 pei_primitive,
572 pei_timeout,
573 pei_signal,
574 0,
575 pei_config,
576 pei_monitor
577 },
578 1024, /* stack size */
579 10, /* queue entries */
580 100, /* priority (1->low, 255->high) */
581 0, /* number of timers */
582 PASSIVE_BODY|COPY_BY_REF|TRC_NO_SUSPEND
583 /* flags: bit 0 active(0) body/passive(1) */
584 }; /* bit 1 com by copy(0)/reference(1) */
585
586 //TRACE_FUNCTION ("pei_create");
587
588 /*
589 * Close Resources if open
590 */
591 if (!m_first)
592 {
593 pei_exit();
594 }
595
596 m_first=0;
597
598 /*
599 * Export startup configuration data
600 */
601 *info = &pei_info;
602
603 return PEI_OK;
604 }
605 /***********+++++-----------------+++++++*******++----++**********/
606
607 /*
608 +------------------------------------------------------------------------------
609 | Function : sig_dti_pei_tx_buffer_ready_ind
610 +------------------------------------------------------------------------------
611 | Description : sent from UART to indicate that it is ready to
612 | receive new data via DTI_DATA_REQ
613 |
614 | Parameters :
615 |
616 | Return :
617 |
618 +------------------------------------------------------------------------------
619 */
620 GLOBAL const void sig_dti_pei_tx_buffer_ready_ind ()
621 {
622 m_uart_ready++;
623 }
624
625 /***********+++++-----------------+++++++*******++----++**********/
626
627 /*
628 +------------------------------------------------------------------------------
629 | Function : dti_data_req
630 +------------------------------------------------------------------------------
631 | Description : sent from TST to deliver new data to MTST
632 |
633 | Parameters : ptr - Pointer to the structure of the primitive
634 |
635 | Return :
636 |
637 +------------------------------------------------------------------------------
638 */
639 static void dti_data_req (T_DTI2_DATA_REQ *ptr)
640 {
641 T_desc2 *d=0;
642
643 /* PPASS without traces */
644 T_DTI2_DATA_IND *prim = (T_DTI2_DATA_IND*)ptr;
645 D_OPC(prim) = (DTI2_DATA_IND);
646
647 if (!m_uart_ready)
648 {
649 if (mux_data.send_data_buf_count > MAX_SEND_BUF_COUNT-2)
650 {
651 /* free data */
652 T_desc2 *d_new;
653 T_desc2 *d=(T_desc2 *)prim->desc_list2.first;
654 while (d)
655 {
656 d_new=(T_desc2 *)d->next;
657 MFREE(d);
658 d=d_new;
659 }
660
661 if (mux_data.send_data_buf_count == MAX_SEND_BUF_COUNT)
662 {
663 /* buffer full -> free prim and exit */
664 PFREE(prim);
665 return;
666 }
667 else
668 {
669 /* buffer almost full -> send SYST information */
670 char infostr[]="\x02T0036001FMTSTPCO ERROR: SEND-BUFFER FULL\x0a";
671 USHORT len=sizeof(infostr)-1;
672 MALLOC(d,(USHORT)(sizeof(T_desc2)+len-1));
673 prim->desc_list2.first=(ULONG)d;
674 prim->desc_list2.list_len=len;
675 d->next = 0;
676 d->len = len;
677 d->size = len;
678 d->offset = 0;
679 memcpy(d->buffer,infostr,len);
680 }
681 }
682
683 if (m_send_data)
684 {
685 /* find last send_data descriptor */
686 d=m_send_data;
687 while (d->next)
688 {
689 d=(T_desc2 *)d->next;
690 }
691 /* concat new data */
692 d->next=prim->desc_list2.first;
693 m_send_len+=prim->desc_list2.list_len;
694 }
695 else
696 {
697 m_send_data=(T_desc2 *)prim->desc_list2.first;
698 d=m_send_data;
699 while (d)
700 {
701 m_send_len+=d->len;
702 d=(T_desc2 *)d->next;
703 }
704 }
705 mux_data.send_data_buf_count++;
706
707 /* free prim */
708 PFREE(prim);
709 return;
710 }
711
712 m_uart_ready--;
713 mux_data.send_data_buf_count=0;
714
715 if (m_send_data)
716 {
717 /* find last data descriptor in stored data */
718 d=m_send_data;
719 while (d->next)
720 {
721 d=(T_desc2 *)d->next;
722 }
723 /* concat new data to stored data */
724 d->next=prim->desc_list2.first;
725 prim->desc_list2.first=(ULONG)m_send_data;
726 prim->desc_list2.list_len+=m_send_len;
727
728 /* clear send_data */
729 m_send_data=(T_desc2 *)0;
730 m_send_len=0;
731 }
732
733 /* send prim */
734 dti_send_data
735 (
736 mtst_hDTI,
737 MTST_DTI_DN_INSTANCE,
738 MTST_DTI_DN_INTERFACE,
739 MTST_DTI_DN_CHANNEL,
740 prim
741 );
742 }
743
744 /***********+++++-----------------+++++++*******++----++**********/
745
746 /*
747 +------------------------------------------------------------------------------
748 | Function : sig_dti_pei_data_received_ind
749 +------------------------------------------------------------------------------
750 | Description : sent from UART to deliver new data
751 |
752 | Parameters : ptr - Pointer to the structure of the primitive
753 |
754 | Return :
755 |
756 +------------------------------------------------------------------------------
757 */
758 GLOBAL const void sig_dti_pei_data_received_ind (T_DTI2_DATA_IND *ptr)
759 {
760 T_DTI2_DATA_IND *prim = ptr;
761
762 /* prevent dtilib from automatically sending flow control primitives */
763 dti_stop
764 (
765 mtst_hDTI,
766 MTST_DTI_DN_INSTANCE,
767 MTST_DTI_DN_INTERFACE,
768 MTST_DTI_DN_CHANNEL
769 );
770
771 if ( mux_data.EnabledSignalType & DRV_SIGTYPE_READ )
772 {
773 m_signal.SignalType = DRV_SIGTYPE_READ;
774 m_signal.DrvHandle = mux_data.Handle;
775
776 mux_data.recv_data=(T_desc2 *)prim->desc_list2.first;
777
778 (mux_data.Callback)( &m_signal );
779 }
780 PFREE(prim);
781 }
782
783 /***********+++++-----------------+++++++*******++----++**********/
784
785 /*
786 * dtilib wrapping and support functions
787 */
788
789 /*
790 +------------------------------------------------------------------------------
791 | Function : pei_dti_dti_connect_req
792 +------------------------------------------------------------------------------
793 | PURPOSE : Call the process function dti_dti_connect_req
794 +------------------------------------------------------------------------------
795 */
796
797 GLOBAL const void pei_dti_dti_connect_req (
798 T_DTI2_CONNECT_REQ *dti_connect_req
799 )
800 {
801 dti_dti_connect_req (mtst_hDTI, dti_connect_req);
802 }
803
804 /*
805 +------------------------------------------------------------------------------
806 | Function : pei_dti_dti_connect_cnf
807 +------------------------------------------------------------------------------
808 | PURPOSE : Call the process function dti_dti_connect_cnf
809 +------------------------------------------------------------------------------
810 */
811
812 GLOBAL const void pei_dti_dti_connect_cnf (
813 T_DTI2_CONNECT_CNF *dti_connect_cnf
814 )
815 {
816 dti_dti_connect_cnf(mtst_hDTI, dti_connect_cnf);
817 }
818
819 /*
820 +------------------------------------------------------------------------------
821 | Function : pei_dti_dti_connect_ind
822 +------------------------------------------------------------------------------
823 | PURPOSE : Call the process function dti_dti_connect_ind
824 +------------------------------------------------------------------------------
825 */
826
827 GLOBAL const void pei_dti_dti_connect_ind (
828 T_DTI2_CONNECT_IND *dti_connect_ind
829 )
830 {
831 dti_dti_connect_ind(mtst_hDTI, dti_connect_ind);
832 }
833
834 /*
835 +------------------------------------------------------------------------------
836 | Function : pei_dti_dti_connect_res
837 +------------------------------------------------------------------------------
838 | PURPOSE : Call the process function dti_dti_connect_res
839 +------------------------------------------------------------------------------
840 */
841
842 GLOBAL const void pei_dti_dti_connect_res (
843 T_DTI2_CONNECT_RES *dti_connect_res
844 )
845 {
846 dti_dti_connect_res(mtst_hDTI, dti_connect_res);
847 }
848
849 /*
850 +------------------------------------------------------------------------------
851 | Function : pei_dti_dti_disconnect_req
852 +------------------------------------------------------------------------------
853 | PURPOSE : Call the process function dti_dti_disconnect_req
854 +------------------------------------------------------------------------------
855 */
856
857 GLOBAL const void pei_dti_dti_disconnect_req (
858 T_DTI2_DISCONNECT_REQ *dti_disconnect_req
859 )
860 {
861 dti_dti_disconnect_req (mtst_hDTI, dti_disconnect_req);
862 }
863
864 /*
865 +------------------------------------------------------------------------------
866 | Function : pei_dti_dti_disconnect_ind
867 +------------------------------------------------------------------------------
868 | PURPOSE : Call the process function dti_dti_disconnect_ind
869 +------------------------------------------------------------------------------
870 */
871
872 GLOBAL const void pei_dti_dti_disconnect_ind (
873 T_DTI2_DISCONNECT_IND *dti_disconnect_ind
874 )
875 {
876 dti_dti_disconnect_ind (mtst_hDTI, dti_disconnect_ind);
877 }
878
879 /*
880 +------------------------------------------------------------------------------
881 | Function : pei_dti_dti_data_req
882 +------------------------------------------------------------------------------
883 | PURPOSE : Call the process function dti_dti_data_req
884 +------------------------------------------------------------------------------
885 */
886
887 GLOBAL const void pei_dti_dti_data_req (
888 T_DTI2_DATA_REQ *dti_data_req
889 )
890 {
891 dti_dti_data_req (mtst_hDTI, dti_data_req);
892 }
893
894 /*
895 +------------------------------------------------------------------------------
896 | Function : pei_dti_dti_getdata_req
897 +------------------------------------------------------------------------------
898 | PURPOSE : Call the process function dti_dti_data_req
899 +------------------------------------------------------------------------------
900 */
901
902 GLOBAL const void pei_dti_dti_getdata_req (
903 T_DTI2_GETDATA_REQ *dti_getdata_req
904 )
905 {
906 dti_dti_getdata_req (mtst_hDTI, dti_getdata_req);
907 }
908
909 /*
910 +------------------------------------------------------------------------------
911 | Function : pei_dti_dti_data_ind
912 +------------------------------------------------------------------------------
913 | PURPOSE : Call the process function dti_dti_data_ind
914 +------------------------------------------------------------------------------
915 */
916
917 GLOBAL const void pei_dti_dti_data_ind (
918 T_DTI2_DATA_IND *dti_data_ind
919 )
920 {
921 dti_dti_data_ind (mtst_hDTI, dti_data_ind);
922 }
923
924 /*
925 +------------------------------------------------------------------------------
926 | Function : pei_dti_dti_ready_ind
927 +------------------------------------------------------------------------------
928 | PURPOSE : Call the process function dti_dti_ready_ind
929 +------------------------------------------------------------------------------
930 */
931
932 GLOBAL const void pei_dti_dti_ready_ind (
933 T_DTI2_READY_IND *dti_ready_ind
934 )
935 {
936 dti_dti_ready_ind (mtst_hDTI, dti_ready_ind);
937 }
938
939 #ifdef _SIMULATION_
940
941 /*
942 +------------------------------------------------------------------------------
943 | Function : pei_dti_dti_data_test_req
944 +------------------------------------------------------------------------------
945 | PURPOSE : Call the process function dti_dti_data_test_req
946 +------------------------------------------------------------------------------
947 */
948
949 GLOBAL const void pei_dti_dti_data_test_req (
950 T_DTI2_DATA_TEST_REQ *dti_data_test_req
951 )
952 {
953 dti_dti_data_test_req (mtst_hDTI, dti_data_test_req);
954 }
955
956 /*
957 +------------------------------------------------------------------------------
958 | Function : pei_dti_dti_data_test_ind
959 +------------------------------------------------------------------------------
960 | PURPOSE : Call the process function dti_dti_data_test_ind
961 +------------------------------------------------------------------------------
962 */
963
964 GLOBAL const void pei_dti_dti_data_test_ind (
965 T_DTI2_DATA_TEST_IND *dti_data_test_ind
966 )
967 {
968 dti_dti_data_test_ind (mtst_hDTI, dti_data_test_ind);
969 }
970
971 #endif /* _SIMULATION_ */
972
973
974 /*
975 +------------------------------------------------------------------------------
976 | Function: pei_sig_callback
977 +------------------------------------------------------------------------------
978 | PURPOSE : Callback function for DTILIB
979 +------------------------------------------------------------------------------
980 */
981
982 GLOBAL void pei_sig_callback(U8 instance, U8 interfac, U8 channel,
983 U8 reason, T_DTI2_DATA_IND *dti_data_ind)
984 {
985 TRACE_FUNCTION("pei_sig_callback");
986
987 #ifdef _SIMULATION_
988 if(instance NEQ MTST_DTI_UP_INSTANCE ||
989 interfac NEQ MTST_DTI_UP_INTERFACE ||
990 channel NEQ MTST_DTI_UP_CHANNEL)
991 {
992 TRACE_ERROR("[PEI_SIG_CALLBACK] invalid parameters!");
993 return; /* error, not found */
994 }
995 #endif /* _SIMULATION_ */
996
997 if (mtst_hDTI NEQ D_NO_DATA_BASE)
998 {
999 switch (reason)
1000 {
1001 case DTI_REASON_CONNECTION_OPENED:
1002 sig_dti_pei_connection_opened_ind();
1003 break;
1004
1005 case DTI_REASON_CONNECTION_CLOSED:
1006 sig_dti_pei_connection_closed_ind();
1007 break;
1008
1009 case DTI_REASON_DATA_RECEIVED:
1010
1011 /*
1012 * DTI2_DATA_IND is interpreted as DTI2_DATA_REQ
1013 */
1014 PACCESS (dti_data_ind);
1015 sig_dti_pei_data_received_ind(dti_data_ind);
1016 break;
1017
1018 case DTI_REASON_TX_BUFFER_FULL:
1019 sig_dti_pei_tx_buffer_full_ind();
1020 break;
1021
1022 case DTI_REASON_TX_BUFFER_READY:
1023 sig_dti_pei_tx_buffer_ready_ind();
1024 break;
1025
1026 default:
1027 TRACE_ERROR("unknown DTILIB reason parameter");
1028 break;
1029 } /* end switch */
1030 } /* end if */
1031 else
1032 {
1033 TRACE_ERROR("Pointer to DTILIB database not existing");
1034 }
1035 } /* pei_sig_callback() */
1036
1037 /*==== END OF FILE ==========================================================*/
1038