annotate gsm-fw/gpf/tst_pei/tstdriver.c @ 322:5d1e22505446

GPF: tif library sources imported from Leonardo version
author Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
date Sun, 13 Apr 2014 07:21:57 +0000
parents
children 7228920a0834
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
322
5d1e22505446 GPF: tif library sources imported from Leonardo version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1 /*
5d1e22505446 GPF: tif library sources imported from Leonardo version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2 +------------------------------------------------------------------------------
5d1e22505446 GPF: tif library sources imported from Leonardo version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
3 | File: tstdriver.c
5d1e22505446 GPF: tif library sources imported from Leonardo version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
4 +------------------------------------------------------------------------------
5d1e22505446 GPF: tif library sources imported from Leonardo version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
5 | Copyright 2004 Texas Instruments Deutschland, AG
5d1e22505446 GPF: tif library sources imported from Leonardo version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
6 | All rights reserved.
5d1e22505446 GPF: tif library sources imported from Leonardo version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
7 |
5d1e22505446 GPF: tif library sources imported from Leonardo version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
8 | This file is confidential and a trade secret of Texas
5d1e22505446 GPF: tif library sources imported from Leonardo version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
9 | Instruments Berlin, AG
5d1e22505446 GPF: tif library sources imported from Leonardo version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
10 | The receipt of or possession of this file does not convey
5d1e22505446 GPF: tif library sources imported from Leonardo version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
11 | any rights to reproduce or disclose its contents or to
5d1e22505446 GPF: tif library sources imported from Leonardo version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
12 | manufacture, use, or sell anything it may describe, in
5d1e22505446 GPF: tif library sources imported from Leonardo version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
13 | whole, or in part, without the specific written consent of
5d1e22505446 GPF: tif library sources imported from Leonardo version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
14 | Texas Instruments Deutschland, AG.
5d1e22505446 GPF: tif library sources imported from Leonardo version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
15 +-----------------------------------------------------------------------------
5d1e22505446 GPF: tif library sources imported from Leonardo version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
16 | Purpose : This Modul contains a table of all the drivers that may be
5d1e22505446 GPF: tif library sources imported from Leonardo version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
17 | used for the test interface.
5d1e22505446 GPF: tif library sources imported from Leonardo version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
18 +-----------------------------------------------------------------------------
5d1e22505446 GPF: tif library sources imported from Leonardo version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
19 */
5d1e22505446 GPF: tif library sources imported from Leonardo version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
20
5d1e22505446 GPF: tif library sources imported from Leonardo version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
21 #ifndef __TST_DRV_C__
5d1e22505446 GPF: tif library sources imported from Leonardo version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
22 #define __TST_DRV_C__
5d1e22505446 GPF: tif library sources imported from Leonardo version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
23 #endif
5d1e22505446 GPF: tif library sources imported from Leonardo version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
24
5d1e22505446 GPF: tif library sources imported from Leonardo version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
25 /*==== INCLUDES ===================================================*/
5d1e22505446 GPF: tif library sources imported from Leonardo version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
26
5d1e22505446 GPF: tif library sources imported from Leonardo version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
27 #include "string.h"
5d1e22505446 GPF: tif library sources imported from Leonardo version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
28
5d1e22505446 GPF: tif library sources imported from Leonardo version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
29 #include "typedefs.h"
5d1e22505446 GPF: tif library sources imported from Leonardo version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
30 #include "os.h"
5d1e22505446 GPF: tif library sources imported from Leonardo version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
31 #include "vsi.h"
5d1e22505446 GPF: tif library sources imported from Leonardo version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
32 #include "gdi.h"
5d1e22505446 GPF: tif library sources imported from Leonardo version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
33 #include "drvconf.h"
5d1e22505446 GPF: tif library sources imported from Leonardo version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
34 #include "tstdriver.h"
5d1e22505446 GPF: tif library sources imported from Leonardo version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
35 #include "tst_mux.h"
5d1e22505446 GPF: tif library sources imported from Leonardo version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
36
5d1e22505446 GPF: tif library sources imported from Leonardo version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
37 /*==== TYPES ======================================================*/
5d1e22505446 GPF: tif library sources imported from Leonardo version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
38
5d1e22505446 GPF: tif library sources imported from Leonardo version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
39
5d1e22505446 GPF: tif library sources imported from Leonardo version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
40 /*==== VARIABLES ==================================================*/
5d1e22505446 GPF: tif library sources imported from Leonardo version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
41
5d1e22505446 GPF: tif library sources imported from Leonardo version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
42 T_TST_MUX_CHANNEL tst_mux_chan_struct[ MAX_TST_CHANNEL ];
5d1e22505446 GPF: tif library sources imported from Leonardo version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
43 T_HANDLE tst_mux_drv_handle;
5d1e22505446 GPF: tif library sources imported from Leonardo version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
44
5d1e22505446 GPF: tif library sources imported from Leonardo version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
45 /*
5d1e22505446 GPF: tif library sources imported from Leonardo version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
46 * just a hack - clean up needed
5d1e22505446 GPF: tif library sources imported from Leonardo version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
47 */
5d1e22505446 GPF: tif library sources imported from Leonardo version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
48 #define MAX_PROT_PRIM_SIZE 236
5d1e22505446 GPF: tif library sources imported from Leonardo version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
49 ULONG DrvSndData[(MAX_PROT_PRIM_SIZE + sizeof(T_PRIM_HEADER) + 3) / 4];
5d1e22505446 GPF: tif library sources imported from Leonardo version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
50 ULONG X_PrimData[(sizeof(T_PRIM_X) + sizeof(T_S_HEADER) + 3) / 4 ];
5d1e22505446 GPF: tif library sources imported from Leonardo version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
51
5d1e22505446 GPF: tif library sources imported from Leonardo version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
52 /*==== EXTERNALS ==================================================*/
5d1e22505446 GPF: tif library sources imported from Leonardo version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
53
5d1e22505446 GPF: tif library sources imported from Leonardo version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
54 extern T_HANDLE TST_Handle;
5d1e22505446 GPF: tif library sources imported from Leonardo version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
55 extern T_HANDLE TIF_Handle;
5d1e22505446 GPF: tif library sources imported from Leonardo version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
56 extern UBYTE TST_DrvState;
5d1e22505446 GPF: tif library sources imported from Leonardo version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
57
5d1e22505446 GPF: tif library sources imported from Leonardo version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
58 #ifndef _TARGET_
5d1e22505446 GPF: tif library sources imported from Leonardo version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
59 extern USHORT TIF_Init ( USHORT DrvHandle, T_DRV_CB_FUNC CallbackFunc,
5d1e22505446 GPF: tif library sources imported from Leonardo version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
60 T_DRV_EXPORT const **DrvInfo );
5d1e22505446 GPF: tif library sources imported from Leonardo version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
61 extern USHORT TR_Init ( USHORT DrvHandle, T_DRV_CB_FUNC CallbackFunc,
5d1e22505446 GPF: tif library sources imported from Leonardo version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
62 T_DRV_EXPORT const **DrvInfo );
5d1e22505446 GPF: tif library sources imported from Leonardo version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
63 extern USHORT NODRV_Init ( USHORT DrvHandle, T_DRV_CB_FUNC CallbackFunc,
5d1e22505446 GPF: tif library sources imported from Leonardo version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
64 T_DRV_EXPORT const **DrvInfo );
5d1e22505446 GPF: tif library sources imported from Leonardo version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
65 extern USHORT socket_Init ( USHORT DrvHandle, T_DRV_CB_FUNC CallbackFunc,
5d1e22505446 GPF: tif library sources imported from Leonardo version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
66 T_DRV_EXPORT const **DrvInfo );
5d1e22505446 GPF: tif library sources imported from Leonardo version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
67 extern USHORT SER_Init ( USHORT DrvHandle, T_DRV_CB_FUNC CallbackFunc,
5d1e22505446 GPF: tif library sources imported from Leonardo version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
68 T_DRV_EXPORT const **DrvInfo );
5d1e22505446 GPF: tif library sources imported from Leonardo version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
69 #endif
5d1e22505446 GPF: tif library sources imported from Leonardo version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
70
5d1e22505446 GPF: tif library sources imported from Leonardo version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
71 /*==== CONSTANTS ==================================================*/
5d1e22505446 GPF: tif library sources imported from Leonardo version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
72 #ifdef _TARGET_
5d1e22505446 GPF: tif library sources imported from Leonardo version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
73 #ifndef RUN_INT_RAM
5d1e22505446 GPF: tif library sources imported from Leonardo version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
74 const T_TST_DRV_ENTRY tst_drv_list[ MAX_AVAILABLE_DRV ] =
5d1e22505446 GPF: tif library sources imported from Leonardo version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
75 {
5d1e22505446 GPF: tif library sources imported from Leonardo version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
76 { { NULL, NULL, NULL, NULL }, 0 }
5d1e22505446 GPF: tif library sources imported from Leonardo version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
77 };
5d1e22505446 GPF: tif library sources imported from Leonardo version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
78 #endif /* RUN_INT_RAM */
5d1e22505446 GPF: tif library sources imported from Leonardo version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
79 #else /* _TARGET_ */
5d1e22505446 GPF: tif library sources imported from Leonardo version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
80
5d1e22505446 GPF: tif library sources imported from Leonardo version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
81 const T_TST_DRV_ENTRY tst_drv_list[ MAX_AVAILABLE_DRV ] =
5d1e22505446 GPF: tif library sources imported from Leonardo version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
82 {
5d1e22505446 GPF: tif library sources imported from Leonardo version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
83 { { TIF_NAME, TIF_Init, "TST", NULL }, 1 },
5d1e22505446 GPF: tif library sources imported from Leonardo version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
84 { { TR_NAME, TR_Init, NULL, NULL }, 2 },
5d1e22505446 GPF: tif library sources imported from Leonardo version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
85 { { SOCKET_NAME, socket_Init, NULL, NULL }, 3 },
5d1e22505446 GPF: tif library sources imported from Leonardo version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
86 #if !defined (_LINUX_) && !defined (_SOLARIS_)
5d1e22505446 GPF: tif library sources imported from Leonardo version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
87 { { SER_NAME, SER_Init, NULL, "" }, 3 },
5d1e22505446 GPF: tif library sources imported from Leonardo version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
88 #endif
5d1e22505446 GPF: tif library sources imported from Leonardo version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
89 { { NODRV_NAME, NODRV_Init, NULL, NULL }, 3 },
5d1e22505446 GPF: tif library sources imported from Leonardo version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
90 { { NULL, NULL, NULL, NULL }, 0 }
5d1e22505446 GPF: tif library sources imported from Leonardo version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
91 };
5d1e22505446 GPF: tif library sources imported from Leonardo version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
92 #endif /* _TARGET_ */
5d1e22505446 GPF: tif library sources imported from Leonardo version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
93
5d1e22505446 GPF: tif library sources imported from Leonardo version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
94
5d1e22505446 GPF: tif library sources imported from Leonardo version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
95 /*==== VARIABLES ==================================================*/
5d1e22505446 GPF: tif library sources imported from Leonardo version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
96
5d1e22505446 GPF: tif library sources imported from Leonardo version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
97
5d1e22505446 GPF: tif library sources imported from Leonardo version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
98 /*==== FUNCTIONS ==================================================*/
5d1e22505446 GPF: tif library sources imported from Leonardo version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
99
5d1e22505446 GPF: tif library sources imported from Leonardo version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
100
5d1e22505446 GPF: tif library sources imported from Leonardo version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
101 #ifndef _TARGET_
5d1e22505446 GPF: tif library sources imported from Leonardo version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
102 /*
5d1e22505446 GPF: tif library sources imported from Leonardo version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
103 +--------------------------------------------------------------------+
5d1e22505446 GPF: tif library sources imported from Leonardo version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
104 | PROJECT : GPF MODULE : TSTDRIVER |
5d1e22505446 GPF: tif library sources imported from Leonardo version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
105 | STATE : code ROUTINE : NODRV_Init |
5d1e22505446 GPF: tif library sources imported from Leonardo version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
106 +--------------------------------------------------------------------+
5d1e22505446 GPF: tif library sources imported from Leonardo version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
107
5d1e22505446 GPF: tif library sources imported from Leonardo version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
108 PURPOSE : initialize empty driver
5d1e22505446 GPF: tif library sources imported from Leonardo version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
109
5d1e22505446 GPF: tif library sources imported from Leonardo version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
110 */
5d1e22505446 GPF: tif library sources imported from Leonardo version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
111 GLOBAL USHORT NODRV_Init ( USHORT DrvHandle, T_DRV_CB_FUNC CallbackFunc, T_DRV_EXPORT const **DrvInfo )
5d1e22505446 GPF: tif library sources imported from Leonardo version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
112 {
5d1e22505446 GPF: tif library sources imported from Leonardo version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
113 static const T_DRV_EXPORT NODRV_Info =
5d1e22505446 GPF: tif library sources imported from Leonardo version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
114 {
5d1e22505446 GPF: tif library sources imported from Leonardo version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
115 NODRV_NAME,
5d1e22505446 GPF: tif library sources imported from Leonardo version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
116 0,
5d1e22505446 GPF: tif library sources imported from Leonardo version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
117 {
5d1e22505446 GPF: tif library sources imported from Leonardo version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
118 #ifdef _TOOLS_
5d1e22505446 GPF: tif library sources imported from Leonardo version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
119 NULL,
5d1e22505446 GPF: tif library sources imported from Leonardo version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
120 #endif
5d1e22505446 GPF: tif library sources imported from Leonardo version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
121 NULL,
5d1e22505446 GPF: tif library sources imported from Leonardo version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
122 NULL,
5d1e22505446 GPF: tif library sources imported from Leonardo version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
123 NULL,
5d1e22505446 GPF: tif library sources imported from Leonardo version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
124 NULL,
5d1e22505446 GPF: tif library sources imported from Leonardo version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
125 NULL,
5d1e22505446 GPF: tif library sources imported from Leonardo version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
126 NULL,
5d1e22505446 GPF: tif library sources imported from Leonardo version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
127 NULL,
5d1e22505446 GPF: tif library sources imported from Leonardo version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
128 NULL,
5d1e22505446 GPF: tif library sources imported from Leonardo version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
129 NULL,
5d1e22505446 GPF: tif library sources imported from Leonardo version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
130 NULL,
5d1e22505446 GPF: tif library sources imported from Leonardo version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
131 NULL,
5d1e22505446 GPF: tif library sources imported from Leonardo version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
132 }
5d1e22505446 GPF: tif library sources imported from Leonardo version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
133 };
5d1e22505446 GPF: tif library sources imported from Leonardo version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
134
5d1e22505446 GPF: tif library sources imported from Leonardo version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
135 *DrvInfo = &NODRV_Info;
5d1e22505446 GPF: tif library sources imported from Leonardo version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
136 return DRV_OK;
5d1e22505446 GPF: tif library sources imported from Leonardo version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
137 }
5d1e22505446 GPF: tif library sources imported from Leonardo version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
138 #endif /* ndef _TARGET_ */
5d1e22505446 GPF: tif library sources imported from Leonardo version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
139
5d1e22505446 GPF: tif library sources imported from Leonardo version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
140
5d1e22505446 GPF: tif library sources imported from Leonardo version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
141 #ifndef RUN_INT_RAM
5d1e22505446 GPF: tif library sources imported from Leonardo version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
142 /*
5d1e22505446 GPF: tif library sources imported from Leonardo version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
143 +--------------------------------------------------------------------+
5d1e22505446 GPF: tif library sources imported from Leonardo version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
144 | PROJECT : GPF MODULE : TSTDRIVER |
5d1e22505446 GPF: tif library sources imported from Leonardo version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
145 | STATE : code ROUTINE : tst_drv_open |
5d1e22505446 GPF: tif library sources imported from Leonardo version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
146 +--------------------------------------------------------------------+
5d1e22505446 GPF: tif library sources imported from Leonardo version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
147 */
5d1e22505446 GPF: tif library sources imported from Leonardo version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
148
5d1e22505446 GPF: tif library sources imported from Leonardo version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
149 SHORT tst_drv_open (char *drv_name, T_TST_DRV_ENTRY **drv_info )
5d1e22505446 GPF: tif library sources imported from Leonardo version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
150 {
5d1e22505446 GPF: tif library sources imported from Leonardo version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
151 USHORT i;
5d1e22505446 GPF: tif library sources imported from Leonardo version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
152
5d1e22505446 GPF: tif library sources imported from Leonardo version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
153 for ( i = 0; i < MAX_AVAILABLE_DRV; i++ )
5d1e22505446 GPF: tif library sources imported from Leonardo version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
154 {
5d1e22505446 GPF: tif library sources imported from Leonardo version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
155 if ( tst_drv_list[i].entry.Name && drv_name
5d1e22505446 GPF: tif library sources imported from Leonardo version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
156 && !strcmp ( drv_name, tst_drv_list[i].entry.Name ) )
5d1e22505446 GPF: tif library sources imported from Leonardo version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
157 {
5d1e22505446 GPF: tif library sources imported from Leonardo version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
158 *drv_info = (T_TST_DRV_ENTRY*)&tst_drv_list[i];
5d1e22505446 GPF: tif library sources imported from Leonardo version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
159 return VSI_OK;
5d1e22505446 GPF: tif library sources imported from Leonardo version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
160 }
5d1e22505446 GPF: tif library sources imported from Leonardo version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
161 }
5d1e22505446 GPF: tif library sources imported from Leonardo version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
162 return VSI_ERROR;
5d1e22505446 GPF: tif library sources imported from Leonardo version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
163 }
5d1e22505446 GPF: tif library sources imported from Leonardo version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
164 #endif
5d1e22505446 GPF: tif library sources imported from Leonardo version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
165
5d1e22505446 GPF: tif library sources imported from Leonardo version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
166 #ifndef RUN_INT_RAM
5d1e22505446 GPF: tif library sources imported from Leonardo version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
167 /*
5d1e22505446 GPF: tif library sources imported from Leonardo version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
168 +--------------------------------------------------------------------+
5d1e22505446 GPF: tif library sources imported from Leonardo version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
169 | PROJECT : GSM-GPF (8415) MODULE : TSTDRIVER |
5d1e22505446 GPF: tif library sources imported from Leonardo version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
170 | STATE : code ROUTINE : tst_drv_write |
5d1e22505446 GPF: tif library sources imported from Leonardo version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
171 +--------------------------------------------------------------------+
5d1e22505446 GPF: tif library sources imported from Leonardo version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
172
5d1e22505446 GPF: tif library sources imported from Leonardo version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
173 PURPOSE: Send a message via the test interface
5d1e22505446 GPF: tif library sources imported from Leonardo version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
174
5d1e22505446 GPF: tif library sources imported from Leonardo version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
175 */
5d1e22505446 GPF: tif library sources imported from Leonardo version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
176 GLOBAL SHORT tst_drv_write ( T_HANDLE caller, ULONG opc, char *dest, char *Buffer )
5d1e22505446 GPF: tif library sources imported from Leonardo version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
177 {
5d1e22505446 GPF: tif library sources imported from Leonardo version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
178 T_PRIM_HEADER *prim;
5d1e22505446 GPF: tif library sources imported from Leonardo version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
179 T_S_HEADER *s_hdr;
5d1e22505446 GPF: tif library sources imported from Leonardo version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
180 T_VOID_STRUCT *ptr = (T_VOID_STRUCT*)Buffer; /* just to reduce number of alignment warnings */
5d1e22505446 GPF: tif library sources imported from Leonardo version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
181 T_VOID_STRUCT *snd_ptr;
5d1e22505446 GPF: tif library sources imported from Leonardo version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
182 T_PRIM_X *x_prim = (T_PRIM_X*)X_PrimData;
5d1e22505446 GPF: tif library sources imported from Leonardo version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
183
5d1e22505446 GPF: tif library sources imported from Leonardo version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
184 x_prim->prim_ptr = NULL;
5d1e22505446 GPF: tif library sources imported from Leonardo version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
185 prim = (T_PRIM_HEADER*)DrvSndData;
5d1e22505446 GPF: tif library sources imported from Leonardo version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
186 prim->opc = opc;
5d1e22505446 GPF: tif library sources imported from Leonardo version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
187 if ( opc == 0 || opc == SYS_MASK ) /* opc = 0 -> trace -> to PCO */
5d1e22505446 GPF: tif library sources imported from Leonardo version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
188 {
5d1e22505446 GPF: tif library sources imported from Leonardo version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
189 prim->len = sizeof(T_PRIM_HEADER);
5d1e22505446 GPF: tif library sources imported from Leonardo version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
190 if ( Buffer != NULL )
5d1e22505446 GPF: tif library sources imported from Leonardo version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
191 {
5d1e22505446 GPF: tif library sources imported from Leonardo version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
192 prim->len += strlen(Buffer);
5d1e22505446 GPF: tif library sources imported from Leonardo version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
193 strcpy ((char*)P2D(prim), Buffer );
5d1e22505446 GPF: tif library sources imported from Leonardo version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
194 }
5d1e22505446 GPF: tif library sources imported from Leonardo version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
195 }
5d1e22505446 GPF: tif library sources imported from Leonardo version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
196 else
5d1e22505446 GPF: tif library sources imported from Leonardo version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
197 {
5d1e22505446 GPF: tif library sources imported from Leonardo version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
198 x_prim->prim_ptr = prim;
5d1e22505446 GPF: tif library sources imported from Leonardo version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
199 x_prim->p_hdr.opc = opc;
5d1e22505446 GPF: tif library sources imported from Leonardo version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
200 if ( D_LEN(ptr) <= MAX_PROT_PRIM_SIZE )
5d1e22505446 GPF: tif library sources imported from Leonardo version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
201 {
5d1e22505446 GPF: tif library sources imported from Leonardo version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
202 prim->len = D_LEN(ptr);
5d1e22505446 GPF: tif library sources imported from Leonardo version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
203 memcpy ((char*)P2D(prim), Buffer, (D_LEN(ptr)-sizeof(T_PRIM_HEADER)));
5d1e22505446 GPF: tif library sources imported from Leonardo version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
204 }
5d1e22505446 GPF: tif library sources imported from Leonardo version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
205 else
5d1e22505446 GPF: tif library sources imported from Leonardo version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
206 {
5d1e22505446 GPF: tif library sources imported from Leonardo version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
207 /*
5d1e22505446 GPF: tif library sources imported from Leonardo version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
208 * modify type to trace and send warning
5d1e22505446 GPF: tif library sources imported from Leonardo version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
209 */
5d1e22505446 GPF: tif library sources imported from Leonardo version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
210 prim->opc = 0;
5d1e22505446 GPF: tif library sources imported from Leonardo version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
211 strcpy ((char*)P2D(prim), "Error: DirectDrvWrite -> Primitive to large to be transmitted");
5d1e22505446 GPF: tif library sources imported from Leonardo version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
212 prim->len = strlen((char*)P2D(prim)) + sizeof(T_PRIM_HEADER);
5d1e22505446 GPF: tif library sources imported from Leonardo version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
213 }
5d1e22505446 GPF: tif library sources imported from Leonardo version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
214 }
5d1e22505446 GPF: tif library sources imported from Leonardo version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
215 prim->sh_offset = S_HDR_OFFSET(prim->len);
5d1e22505446 GPF: tif library sources imported from Leonardo version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
216 s_hdr = (T_S_HEADER*)((ULONG*)prim + prim->sh_offset);
5d1e22505446 GPF: tif library sources imported from Leonardo version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
217 os_GetTime(TST_Handle,&s_hdr->time);
5d1e22505446 GPF: tif library sources imported from Leonardo version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
218 s_hdr->snd[0] = (char)caller;
5d1e22505446 GPF: tif library sources imported from Leonardo version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
219 if ( caller )
5d1e22505446 GPF: tif library sources imported from Leonardo version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
220 s_hdr->snd[0] |= (char)HANDLE_BIT;
5d1e22505446 GPF: tif library sources imported from Leonardo version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
221 if ( dest )
5d1e22505446 GPF: tif library sources imported from Leonardo version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
222 strcpy (s_hdr->rcv, dest);
5d1e22505446 GPF: tif library sources imported from Leonardo version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
223
5d1e22505446 GPF: tif library sources imported from Leonardo version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
224 if ( TST_DrvState == TST_DRV_CONNECTED )
5d1e22505446 GPF: tif library sources imported from Leonardo version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
225 {
5d1e22505446 GPF: tif library sources imported from Leonardo version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
226 if ( x_prim->prim_ptr != NULL )
5d1e22505446 GPF: tif library sources imported from Leonardo version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
227 {
5d1e22505446 GPF: tif library sources imported from Leonardo version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
228 /*lint -e419 suppress - Warning -- Apparent data overrun for function 'memcpy... */
5d1e22505446 GPF: tif library sources imported from Leonardo version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
229 memcpy ( ((char*)x_prim) + sizeof(T_PRIM_X), s_hdr, sizeof(T_S_HEADER) );
5d1e22505446 GPF: tif library sources imported from Leonardo version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
230 /*lint +e419 */
5d1e22505446 GPF: tif library sources imported from Leonardo version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
231 x_prim->p_hdr.sh_offset = sizeof(T_PRIM_X)>>2;
5d1e22505446 GPF: tif library sources imported from Leonardo version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
232 snd_ptr = (T_VOID_STRUCT*)x_prim;
5d1e22505446 GPF: tif library sources imported from Leonardo version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
233 }
5d1e22505446 GPF: tif library sources imported from Leonardo version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
234 else
5d1e22505446 GPF: tif library sources imported from Leonardo version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
235 snd_ptr = (T_VOID_STRUCT*)prim;
5d1e22505446 GPF: tif library sources imported from Leonardo version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
236 if ( vsi_d_write ( TST_Handle, TIF_Handle, (void*)snd_ptr, prim->len ) != VSI_OK )
5d1e22505446 GPF: tif library sources imported from Leonardo version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
237 return DRV_BUFFER_FULL;
5d1e22505446 GPF: tif library sources imported from Leonardo version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
238 else
5d1e22505446 GPF: tif library sources imported from Leonardo version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
239 return DRV_OK;
5d1e22505446 GPF: tif library sources imported from Leonardo version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
240 }
5d1e22505446 GPF: tif library sources imported from Leonardo version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
241 return DRV_OK;
5d1e22505446 GPF: tif library sources imported from Leonardo version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
242 }
5d1e22505446 GPF: tif library sources imported from Leonardo version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
243 #endif
5d1e22505446 GPF: tif library sources imported from Leonardo version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
244
5d1e22505446 GPF: tif library sources imported from Leonardo version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
245 #ifndef RUN_INT_RAM
5d1e22505446 GPF: tif library sources imported from Leonardo version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
246 /*
5d1e22505446 GPF: tif library sources imported from Leonardo version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
247 +------------------------------------------------------------------------------
5d1e22505446 GPF: tif library sources imported from Leonardo version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
248 | Function : tst_mux_send
5d1e22505446 GPF: tif library sources imported from Leonardo version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
249 +------------------------------------------------------------------------------
5d1e22505446 GPF: tif library sources imported from Leonardo version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
250 | Description : send message via specified test interface channnel
5d1e22505446 GPF: tif library sources imported from Leonardo version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
251 |
5d1e22505446 GPF: tif library sources imported from Leonardo version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
252 | Parameters : id - channel ID
5d1e22505446 GPF: tif library sources imported from Leonardo version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
253 | buffer - pointer to message
5d1e22505446 GPF: tif library sources imported from Leonardo version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
254 | size - message length
5d1e22505446 GPF: tif library sources imported from Leonardo version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
255 |
5d1e22505446 GPF: tif library sources imported from Leonardo version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
256 | Return : DRV_OK
5d1e22505446 GPF: tif library sources imported from Leonardo version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
257 | DRV_BUFFER_FULL
5d1e22505446 GPF: tif library sources imported from Leonardo version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
258 | DRV_BUFFER_FULL
5d1e22505446 GPF: tif library sources imported from Leonardo version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
259 +------------------------------------------------------------------------------
5d1e22505446 GPF: tif library sources imported from Leonardo version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
260 */
5d1e22505446 GPF: tif library sources imported from Leonardo version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
261 int tst_mux_send ( U8 id, void * buffer, int size )
5d1e22505446 GPF: tif library sources imported from Leonardo version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
262 {
5d1e22505446 GPF: tif library sources imported from Leonardo version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
263 int chan_id;
5d1e22505446 GPF: tif library sources imported from Leonardo version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
264 int i;
5d1e22505446 GPF: tif library sources imported from Leonardo version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
265 int snd_size;
5d1e22505446 GPF: tif library sources imported from Leonardo version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
266 char *p_dst;
5d1e22505446 GPF: tif library sources imported from Leonardo version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
267 char *p_src;
5d1e22505446 GPF: tif library sources imported from Leonardo version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
268
5d1e22505446 GPF: tif library sources imported from Leonardo version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
269 snd_size = size + 3; /* 3 additional bytes for framing and chan id */
5d1e22505446 GPF: tif library sources imported from Leonardo version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
270 if ( size > MAX_TST_MUX_CMD_LEN-3)
5d1e22505446 GPF: tif library sources imported from Leonardo version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
271 {
5d1e22505446 GPF: tif library sources imported from Leonardo version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
272 return DRV_INVALID_PARAMS;
5d1e22505446 GPF: tif library sources imported from Leonardo version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
273 }
5d1e22505446 GPF: tif library sources imported from Leonardo version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
274
5d1e22505446 GPF: tif library sources imported from Leonardo version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
275 for ( chan_id = 0; chan_id < MAX_TST_CHANNEL; chan_id++ )
5d1e22505446 GPF: tif library sources imported from Leonardo version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
276 {
5d1e22505446 GPF: tif library sources imported from Leonardo version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
277 if ( tst_mux_chan_struct[chan_id].channel_id == id )
5d1e22505446 GPF: tif library sources imported from Leonardo version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
278 {
5d1e22505446 GPF: tif library sources imported from Leonardo version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
279 p_dst = (char*)tst_mux_chan_struct[chan_id].send_data;
5d1e22505446 GPF: tif library sources imported from Leonardo version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
280 p_src = (char*)buffer;
5d1e22505446 GPF: tif library sources imported from Leonardo version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
281 *p_dst++ = 0x02;
5d1e22505446 GPF: tif library sources imported from Leonardo version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
282 *p_dst++ = id;
5d1e22505446 GPF: tif library sources imported from Leonardo version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
283 for ( i = 0; i < size; i++ )
5d1e22505446 GPF: tif library sources imported from Leonardo version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
284 {
5d1e22505446 GPF: tif library sources imported from Leonardo version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
285 if ( *p_src == 0x10 || *p_src == 0x02 )
5d1e22505446 GPF: tif library sources imported from Leonardo version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
286 {
5d1e22505446 GPF: tif library sources imported from Leonardo version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
287 if ( snd_size < MAX_TST_MUX_CMD_LEN-1 )
5d1e22505446 GPF: tif library sources imported from Leonardo version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
288 {
5d1e22505446 GPF: tif library sources imported from Leonardo version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
289 *p_dst++ = 0x10;
5d1e22505446 GPF: tif library sources imported from Leonardo version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
290 snd_size++;
5d1e22505446 GPF: tif library sources imported from Leonardo version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
291 }
5d1e22505446 GPF: tif library sources imported from Leonardo version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
292 }
5d1e22505446 GPF: tif library sources imported from Leonardo version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
293 *p_dst++ = *p_src++;
5d1e22505446 GPF: tif library sources imported from Leonardo version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
294 }
5d1e22505446 GPF: tif library sources imported from Leonardo version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
295 *p_dst = 0x02;
5d1e22505446 GPF: tif library sources imported from Leonardo version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
296
5d1e22505446 GPF: tif library sources imported from Leonardo version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
297 if ( vsi_d_write ( 0, tst_mux_drv_handle, tst_mux_chan_struct[chan_id].send_data, snd_size) != VSI_OK )
5d1e22505446 GPF: tif library sources imported from Leonardo version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
298 {
5d1e22505446 GPF: tif library sources imported from Leonardo version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
299 return DRV_BUFFER_FULL;
5d1e22505446 GPF: tif library sources imported from Leonardo version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
300 }
5d1e22505446 GPF: tif library sources imported from Leonardo version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
301 return DRV_OK;
5d1e22505446 GPF: tif library sources imported from Leonardo version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
302 }
5d1e22505446 GPF: tif library sources imported from Leonardo version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
303 }
5d1e22505446 GPF: tif library sources imported from Leonardo version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
304 return DRV_INVALID_PARAMS;
5d1e22505446 GPF: tif library sources imported from Leonardo version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
305 }
5d1e22505446 GPF: tif library sources imported from Leonardo version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
306 #endif
5d1e22505446 GPF: tif library sources imported from Leonardo version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
307
5d1e22505446 GPF: tif library sources imported from Leonardo version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
308 #ifndef RUN_INT_RAM
5d1e22505446 GPF: tif library sources imported from Leonardo version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
309 /*
5d1e22505446 GPF: tif library sources imported from Leonardo version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
310 +------------------------------------------------------------------------------
5d1e22505446 GPF: tif library sources imported from Leonardo version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
311 | Function : tst_mux_register
5d1e22505446 GPF: tif library sources imported from Leonardo version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
312 +------------------------------------------------------------------------------
5d1e22505446 GPF: tif library sources imported from Leonardo version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
313 | Description : register callback that is called if data is received on
5d1e22505446 GPF: tif library sources imported from Leonardo version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
314 | specified test interface channnel
5d1e22505446 GPF: tif library sources imported from Leonardo version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
315 |
5d1e22505446 GPF: tif library sources imported from Leonardo version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
316 | Parameters : id - channel ID
5d1e22505446 GPF: tif library sources imported from Leonardo version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
317 | callback - callback function
5d1e22505446 GPF: tif library sources imported from Leonardo version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
318 |
5d1e22505446 GPF: tif library sources imported from Leonardo version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
319 | Return : DRV_OK
5d1e22505446 GPF: tif library sources imported from Leonardo version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
320 | DRV_INITFAILURE
5d1e22505446 GPF: tif library sources imported from Leonardo version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
321 +------------------------------------------------------------------------------
5d1e22505446 GPF: tif library sources imported from Leonardo version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
322 */
5d1e22505446 GPF: tif library sources imported from Leonardo version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
323 int tst_mux_register ( U8 id, void (*callback)(void * buffer, int size))
5d1e22505446 GPF: tif library sources imported from Leonardo version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
324 {
5d1e22505446 GPF: tif library sources imported from Leonardo version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
325 int i;
5d1e22505446 GPF: tif library sources imported from Leonardo version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
326
5d1e22505446 GPF: tif library sources imported from Leonardo version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
327 for ( i = 0; i < MAX_TST_CHANNEL; i++ )
5d1e22505446 GPF: tif library sources imported from Leonardo version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
328 {
5d1e22505446 GPF: tif library sources imported from Leonardo version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
329 if ( tst_mux_chan_struct[i].channel_id == 0 )
5d1e22505446 GPF: tif library sources imported from Leonardo version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
330 {
5d1e22505446 GPF: tif library sources imported from Leonardo version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
331 tst_mux_chan_struct[i].channel_id = id;
5d1e22505446 GPF: tif library sources imported from Leonardo version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
332 tst_mux_chan_struct[i].rcv_callback = callback;
5d1e22505446 GPF: tif library sources imported from Leonardo version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
333 MALLOC(tst_mux_chan_struct[i].send_data,MAX_TST_MUX_CMD_LEN);
5d1e22505446 GPF: tif library sources imported from Leonardo version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
334 return DRV_OK;
5d1e22505446 GPF: tif library sources imported from Leonardo version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
335 }
5d1e22505446 GPF: tif library sources imported from Leonardo version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
336 }
5d1e22505446 GPF: tif library sources imported from Leonardo version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
337 return DRV_INITFAILURE;
5d1e22505446 GPF: tif library sources imported from Leonardo version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
338 }
5d1e22505446 GPF: tif library sources imported from Leonardo version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
339 #endif
5d1e22505446 GPF: tif library sources imported from Leonardo version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
340
5d1e22505446 GPF: tif library sources imported from Leonardo version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
341 #ifndef RUN_INT_RAM
5d1e22505446 GPF: tif library sources imported from Leonardo version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
342 /*
5d1e22505446 GPF: tif library sources imported from Leonardo version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
343 +------------------------------------------------------------------------------
5d1e22505446 GPF: tif library sources imported from Leonardo version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
344 | Function : tst_mux_callback
5d1e22505446 GPF: tif library sources imported from Leonardo version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
345 +------------------------------------------------------------------------------
5d1e22505446 GPF: tif library sources imported from Leonardo version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
346 | Description : callback that is called if data is received on
5d1e22505446 GPF: tif library sources imported from Leonardo version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
347 | specified test interface channnel
5d1e22505446 GPF: tif library sources imported from Leonardo version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
348 |
5d1e22505446 GPF: tif library sources imported from Leonardo version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
349 | Parameters : id - channel ID
5d1e22505446 GPF: tif library sources imported from Leonardo version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
350 | buffer - data
5d1e22505446 GPF: tif library sources imported from Leonardo version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
351 | size - number of received bytes
5d1e22505446 GPF: tif library sources imported from Leonardo version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
352 |
5d1e22505446 GPF: tif library sources imported from Leonardo version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
353 | Return : DRV_OK
5d1e22505446 GPF: tif library sources imported from Leonardo version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
354 | DRV_INITFAILURE
5d1e22505446 GPF: tif library sources imported from Leonardo version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
355 +------------------------------------------------------------------------------
5d1e22505446 GPF: tif library sources imported from Leonardo version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
356 */
5d1e22505446 GPF: tif library sources imported from Leonardo version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
357 void tst_mux_callback ( U8 id, void * buffer, int size )
5d1e22505446 GPF: tif library sources imported from Leonardo version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
358 {
5d1e22505446 GPF: tif library sources imported from Leonardo version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
359 char * rcv_ptr;
5d1e22505446 GPF: tif library sources imported from Leonardo version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
360 char * dta_ptr;
5d1e22505446 GPF: tif library sources imported from Leonardo version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
361 char * p_rd;
5d1e22505446 GPF: tif library sources imported from Leonardo version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
362 char * p_wr;
5d1e22505446 GPF: tif library sources imported from Leonardo version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
363 int rd_bytes = size;
5d1e22505446 GPF: tif library sources imported from Leonardo version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
364 int bytes_to_read = size;
5d1e22505446 GPF: tif library sources imported from Leonardo version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
365 int total_wr_bytes = size;
5d1e22505446 GPF: tif library sources imported from Leonardo version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
366 int total_rd_bytes = 0;
5d1e22505446 GPF: tif library sources imported from Leonardo version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
367 int i;
5d1e22505446 GPF: tif library sources imported from Leonardo version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
368 int stuffed_byte = 0;
5d1e22505446 GPF: tif library sources imported from Leonardo version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
369
5d1e22505446 GPF: tif library sources imported from Leonardo version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
370
5d1e22505446 GPF: tif library sources imported from Leonardo version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
371 MALLOC(rcv_ptr, size);
5d1e22505446 GPF: tif library sources imported from Leonardo version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
372 p_rd = rcv_ptr;
5d1e22505446 GPF: tif library sources imported from Leonardo version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
373 do
5d1e22505446 GPF: tif library sources imported from Leonardo version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
374 {
5d1e22505446 GPF: tif library sources imported from Leonardo version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
375 vsi_d_read ( 0, tst_mux_drv_handle, (void*)rcv_ptr, (ULONG*)&rd_bytes );
5d1e22505446 GPF: tif library sources imported from Leonardo version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
376 total_rd_bytes += rd_bytes;
5d1e22505446 GPF: tif library sources imported from Leonardo version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
377 if ( total_rd_bytes < bytes_to_read )
5d1e22505446 GPF: tif library sources imported from Leonardo version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
378 {
5d1e22505446 GPF: tif library sources imported from Leonardo version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
379 rcv_ptr += rd_bytes;
5d1e22505446 GPF: tif library sources imported from Leonardo version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
380 rd_bytes = bytes_to_read - total_rd_bytes;
5d1e22505446 GPF: tif library sources imported from Leonardo version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
381 }
5d1e22505446 GPF: tif library sources imported from Leonardo version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
382 } while ( total_rd_bytes < bytes_to_read );
5d1e22505446 GPF: tif library sources imported from Leonardo version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
383
5d1e22505446 GPF: tif library sources imported from Leonardo version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
384
5d1e22505446 GPF: tif library sources imported from Leonardo version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
385 MALLOC(dta_ptr, size);
5d1e22505446 GPF: tif library sources imported from Leonardo version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
386 p_wr = dta_ptr;
5d1e22505446 GPF: tif library sources imported from Leonardo version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
387 for ( i = 0; i < size; i++ )
5d1e22505446 GPF: tif library sources imported from Leonardo version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
388 {
5d1e22505446 GPF: tif library sources imported from Leonardo version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
389 if ( stuffed_byte == 1 )
5d1e22505446 GPF: tif library sources imported from Leonardo version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
390 {
5d1e22505446 GPF: tif library sources imported from Leonardo version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
391 stuffed_byte = 0;
5d1e22505446 GPF: tif library sources imported from Leonardo version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
392 *p_wr++ = *p_rd++;
5d1e22505446 GPF: tif library sources imported from Leonardo version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
393 }
5d1e22505446 GPF: tif library sources imported from Leonardo version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
394 if ( *p_rd == 0x10 )
5d1e22505446 GPF: tif library sources imported from Leonardo version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
395 {
5d1e22505446 GPF: tif library sources imported from Leonardo version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
396 stuffed_byte = 1;
5d1e22505446 GPF: tif library sources imported from Leonardo version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
397 p_rd++;
5d1e22505446 GPF: tif library sources imported from Leonardo version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
398 total_wr_bytes--;
5d1e22505446 GPF: tif library sources imported from Leonardo version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
399 }
5d1e22505446 GPF: tif library sources imported from Leonardo version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
400 else
5d1e22505446 GPF: tif library sources imported from Leonardo version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
401 {
5d1e22505446 GPF: tif library sources imported from Leonardo version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
402 *p_wr++ = *p_rd++;
5d1e22505446 GPF: tif library sources imported from Leonardo version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
403 }
5d1e22505446 GPF: tif library sources imported from Leonardo version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
404 }
5d1e22505446 GPF: tif library sources imported from Leonardo version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
405 MFREE(rcv_ptr);
5d1e22505446 GPF: tif library sources imported from Leonardo version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
406
5d1e22505446 GPF: tif library sources imported from Leonardo version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
407 if ( tst_mux_chan_struct[id].rcv_callback != NULL )
5d1e22505446 GPF: tif library sources imported from Leonardo version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
408 {
5d1e22505446 GPF: tif library sources imported from Leonardo version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
409 (tst_mux_chan_struct[id].rcv_callback)(dta_ptr,total_wr_bytes);
5d1e22505446 GPF: tif library sources imported from Leonardo version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
410 }
5d1e22505446 GPF: tif library sources imported from Leonardo version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
411 MFREE(dta_ptr);
5d1e22505446 GPF: tif library sources imported from Leonardo version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
412
5d1e22505446 GPF: tif library sources imported from Leonardo version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
413 }
5d1e22505446 GPF: tif library sources imported from Leonardo version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
414 #endif
5d1e22505446 GPF: tif library sources imported from Leonardo version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
415
5d1e22505446 GPF: tif library sources imported from Leonardo version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
416 #ifndef RUN_INT_RAM
5d1e22505446 GPF: tif library sources imported from Leonardo version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
417 /*
5d1e22505446 GPF: tif library sources imported from Leonardo version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
418 +------------------------------------------------------------------------------
5d1e22505446 GPF: tif library sources imported from Leonardo version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
419 | Function : tst_mux_init
5d1e22505446 GPF: tif library sources imported from Leonardo version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
420 +------------------------------------------------------------------------------
5d1e22505446 GPF: tif library sources imported from Leonardo version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
421 | Description : register callback that is called if data is received on
5d1e22505446 GPF: tif library sources imported from Leonardo version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
422 | specified test interface channnel
5d1e22505446 GPF: tif library sources imported from Leonardo version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
423 |
5d1e22505446 GPF: tif library sources imported from Leonardo version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
424 | Parameters : id - channel ID
5d1e22505446 GPF: tif library sources imported from Leonardo version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
425 | callback - callback function
5d1e22505446 GPF: tif library sources imported from Leonardo version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
426 |
5d1e22505446 GPF: tif library sources imported from Leonardo version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
427 | Return : DRV_OK
5d1e22505446 GPF: tif library sources imported from Leonardo version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
428 | DRV_INITFAILURE
5d1e22505446 GPF: tif library sources imported from Leonardo version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
429 +------------------------------------------------------------------------------
5d1e22505446 GPF: tif library sources imported from Leonardo version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
430 */
5d1e22505446 GPF: tif library sources imported from Leonardo version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
431 int tst_mux_init ( void )
5d1e22505446 GPF: tif library sources imported from Leonardo version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
432 {
5d1e22505446 GPF: tif library sources imported from Leonardo version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
433 int i;
5d1e22505446 GPF: tif library sources imported from Leonardo version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
434
5d1e22505446 GPF: tif library sources imported from Leonardo version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
435 if ( (tst_mux_drv_handle = vsi_d_open ( TST_Handle, (char*)TR_NAME )) == VSI_ERROR )
5d1e22505446 GPF: tif library sources imported from Leonardo version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
436 {
5d1e22505446 GPF: tif library sources imported from Leonardo version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
437 return DRV_INITFAILURE;
5d1e22505446 GPF: tif library sources imported from Leonardo version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
438 }
5d1e22505446 GPF: tif library sources imported from Leonardo version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
439 for ( i = 0; i < MAX_TST_CHANNEL; i++ )
5d1e22505446 GPF: tif library sources imported from Leonardo version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
440 {
5d1e22505446 GPF: tif library sources imported from Leonardo version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
441 tst_mux_chan_struct[i].channel_id = 0;
5d1e22505446 GPF: tif library sources imported from Leonardo version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
442 tst_mux_chan_struct[i].rcv_callback = NULL;
5d1e22505446 GPF: tif library sources imported from Leonardo version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
443 tst_mux_chan_struct[i].rcv_data_ptr = NULL;
5d1e22505446 GPF: tif library sources imported from Leonardo version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
444 tst_mux_chan_struct[i].rcv_data_size = 0;
5d1e22505446 GPF: tif library sources imported from Leonardo version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
445 }
5d1e22505446 GPF: tif library sources imported from Leonardo version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
446 return DRV_OK;
5d1e22505446 GPF: tif library sources imported from Leonardo version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
447 }
5d1e22505446 GPF: tif library sources imported from Leonardo version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
448 #endif