annotate gsm-fw/gpf/tst_drv/titrc.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 ffb0442ffccf
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: titrc.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 Module defines the functionality of the TITRC driver
5d1e22505446 GPF: tif library sources imported from Leonardo version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
17 | to communicate with the TI trace task.
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
5d1e22505446 GPF: tif library sources imported from Leonardo version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
22 #ifndef __TITRC_C__
5d1e22505446 GPF: tif library sources imported from Leonardo version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
23 #define __TITRC_C__
5d1e22505446 GPF: tif library sources imported from Leonardo version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
24 #endif
5d1e22505446 GPF: tif library sources imported from Leonardo version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
25
5d1e22505446 GPF: tif library sources imported from Leonardo version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
26 #include "typedefs.h"
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 #include "tstheader.h"
5d1e22505446 GPF: tif library sources imported from Leonardo version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
29 #include "rvt_gen.h"
5d1e22505446 GPF: tif library sources imported from Leonardo version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
30 #include "gdi.h"
5d1e22505446 GPF: tif library sources imported from Leonardo version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
31 #include "serialswitch.h"
5d1e22505446 GPF: tif library sources imported from Leonardo version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
32
5d1e22505446 GPF: tif library sources imported from Leonardo version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
33 /*==== TYPES ======================================================*/
5d1e22505446 GPF: tif library sources imported from Leonardo version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
34
5d1e22505446 GPF: tif library sources imported from Leonardo version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
35 typedef struct
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 USHORT Handle;
5d1e22505446 GPF: tif library sources imported from Leonardo version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
38 USHORT EnabledSignalType;
5d1e22505446 GPF: tif library sources imported from Leonardo version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
39 T_DRV_CB_FUNC Callback;
5d1e22505446 GPF: tif library sources imported from Leonardo version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
40 T_RVT_USER_ID trc_id;
5d1e22505446 GPF: tif library sources imported from Leonardo version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
41 unsigned char connected;
5d1e22505446 GPF: tif library sources imported from Leonardo version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
42 T_RVT_BUFFER read_ptr;
5d1e22505446 GPF: tif library sources imported from Leonardo version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
43 unsigned int read_len;
5d1e22505446 GPF: tif library sources imported from Leonardo version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
44 } T_TITRC_DATA;
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 /*==== CONSTANTS ==================================================*/
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 ALLOWED_TITRC_SIGNALS (DRV_SIGTYPE_READ|DRV_SIGTYPE_CONNECT)
5d1e22505446 GPF: tif library sources imported from Leonardo version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
49
5d1e22505446 GPF: tif library sources imported from Leonardo version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
50
5d1e22505446 GPF: tif library sources imported from Leonardo version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
51 /*==== EXTERNALS ==================================================*/
5d1e22505446 GPF: tif library sources imported from Leonardo version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
52
5d1e22505446 GPF: tif library sources imported from Leonardo version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
53 extern USHORT emergeny_trace;
5d1e22505446 GPF: tif library sources imported from Leonardo version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
54
5d1e22505446 GPF: tif library sources imported from Leonardo version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
55 /*==== VARIABLES ==================================================*/
5d1e22505446 GPF: tif library sources imported from Leonardo version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
56
5d1e22505446 GPF: tif library sources imported from Leonardo version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
57 #ifndef RUN_INT_RAM
5d1e22505446 GPF: tif library sources imported from Leonardo version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
58 T_TITRC_DATA TITRC_Data;
5d1e22505446 GPF: tif library sources imported from Leonardo version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
59 T_DRV_SIGNAL Signal;
5d1e22505446 GPF: tif library sources imported from Leonardo version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
60 #else
5d1e22505446 GPF: tif library sources imported from Leonardo version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
61 extern T_TITRC_DATA TITRC_Data;
5d1e22505446 GPF: tif library sources imported from Leonardo version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
62 #endif
5d1e22505446 GPF: tif library sources imported from Leonardo version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
63
5d1e22505446 GPF: tif library sources imported from Leonardo version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
64 #ifndef RUN_FLASH
5d1e22505446 GPF: tif library sources imported from Leonardo version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
65 char header_buffer[TST_BIG_HEADER_SIZE];
5d1e22505446 GPF: tif library sources imported from Leonardo version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
66 #endif
5d1e22505446 GPF: tif library sources imported from Leonardo version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
67
5d1e22505446 GPF: tif library sources imported from Leonardo version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
68 /*==== FUNCTIONS ==================================================*/
5d1e22505446 GPF: tif library sources imported from Leonardo version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
69
5d1e22505446 GPF: tif library sources imported from Leonardo version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
70 #ifndef RUN_INT_RAM
5d1e22505446 GPF: tif library sources imported from Leonardo version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
71 extern USHORT TITRC_Write ( void *Buffer, ULONG *BytesToWrite ) ;
5d1e22505446 GPF: tif library sources imported from Leonardo version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
72 #endif
5d1e22505446 GPF: tif library sources imported from Leonardo version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
73
5d1e22505446 GPF: tif library sources imported from Leonardo version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
74 #ifndef RUN_INT_RAM
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 +--------------------------------------------------------------------+
5d1e22505446 GPF: tif library sources imported from Leonardo version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
77 | PROJECT : GSM-Frame (8415) MODULE : TITRC |
5d1e22505446 GPF: tif library sources imported from Leonardo version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
78 | STATE : code ROUTINE : TITRC_Read |
5d1e22505446 GPF: tif library sources imported from Leonardo version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
79 +--------------------------------------------------------------------+
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 PURPOSE : read data from driver
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 */
5d1e22505446 GPF: tif library sources imported from Leonardo version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
84 USHORT TITRC_Read ( void *Buffer, ULONG *BytesToRead )
5d1e22505446 GPF: tif library sources imported from Leonardo version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
85 {
5d1e22505446 GPF: tif library sources imported from Leonardo version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
86
5d1e22505446 GPF: tif library sources imported from Leonardo version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
87 if ( TITRC_Data.read_ptr )
5d1e22505446 GPF: tif library sources imported from Leonardo version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
88 {
5d1e22505446 GPF: tif library sources imported from Leonardo version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
89 if ( *BytesToRead != 0 )
5d1e22505446 GPF: tif library sources imported from Leonardo version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
90 {
5d1e22505446 GPF: tif library sources imported from Leonardo version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
91 if ( *BytesToRead > TITRC_Data.read_len )
5d1e22505446 GPF: tif library sources imported from Leonardo version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
92 *BytesToRead = TITRC_Data.read_len;
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 memcpy ( Buffer, TITRC_Data.read_ptr, *BytesToRead );
5d1e22505446 GPF: tif library sources imported from Leonardo version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
95
5d1e22505446 GPF: tif library sources imported from Leonardo version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
96 if ( *BytesToRead < TITRC_Data.read_len )
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 TITRC_Data.read_ptr += *BytesToRead;
5d1e22505446 GPF: tif library sources imported from Leonardo version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
99 TITRC_Data.read_len -= *BytesToRead;
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 else
5d1e22505446 GPF: tif library sources imported from Leonardo version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
102 TITRC_Data.read_ptr = NULL;
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 else
5d1e22505446 GPF: tif library sources imported from Leonardo version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
105 {
5d1e22505446 GPF: tif library sources imported from Leonardo version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
106 *BytesToRead = TITRC_Data.read_len;
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 }
5d1e22505446 GPF: tif library sources imported from Leonardo version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
109 else
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 *BytesToRead = 0;
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
5d1e22505446 GPF: tif library sources imported from Leonardo version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
114 return DRV_OK;
5d1e22505446 GPF: tif library sources imported from Leonardo version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
115 }
5d1e22505446 GPF: tif library sources imported from Leonardo version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
116 #endif
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 #ifndef RUN_FLASH
5d1e22505446 GPF: tif library sources imported from Leonardo version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
119 /*
5d1e22505446 GPF: tif library sources imported from Leonardo version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
120 +--------------------------------------------------------------------+
5d1e22505446 GPF: tif library sources imported from Leonardo version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
121 | PROJECT : GSM-Frame (8415) MODULE : TITRC |
5d1e22505446 GPF: tif library sources imported from Leonardo version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
122 | STATE : code ROUTINE : TITRC_Write |
5d1e22505446 GPF: tif library sources imported from Leonardo version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
123 +--------------------------------------------------------------------+
5d1e22505446 GPF: tif library sources imported from Leonardo version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
124
5d1e22505446 GPF: tif library sources imported from Leonardo version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
125 PURPOSE : write data to driver
5d1e22505446 GPF: tif library sources imported from Leonardo version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
126
5d1e22505446 GPF: tif library sources imported from Leonardo version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
127 */
5d1e22505446 GPF: tif library sources imported from Leonardo version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
128 USHORT TITRC_Write ( void *Buffer, ULONG *BytesToWrite )
5d1e22505446 GPF: tif library sources imported from Leonardo version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
129 {
5d1e22505446 GPF: tif library sources imported from Leonardo version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
130 T_RVT_FORMAT msg_format;
5d1e22505446 GPF: tif library sources imported from Leonardo version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
131 char *ptr = (char*)Buffer;
5d1e22505446 GPF: tif library sources imported from Leonardo version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
132 ULONG BytesWritten;
5d1e22505446 GPF: tif library sources imported from Leonardo version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
133 ULONG ToWrite;
5d1e22505446 GPF: tif library sources imported from Leonardo version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
134 T_RVT_BUFFER rvt_buffer;
5d1e22505446 GPF: tif library sources imported from Leonardo version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
135
5d1e22505446 GPF: tif library sources imported from Leonardo version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
136 msg_format = RVT_BINARY_FORMAT;
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 if ( emergeny_trace )
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 ptr--;
5d1e22505446 GPF: tif library sources imported from Leonardo version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
141 *ptr = 0x13;
5d1e22505446 GPF: tif library sources imported from Leonardo version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
142 ToWrite = (ULONG)*BytesToWrite;
5d1e22505446 GPF: tif library sources imported from Leonardo version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
143 ToWrite += 1;
5d1e22505446 GPF: tif library sources imported from Leonardo version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
144 BytesWritten = (ULONG)SER_tr_WriteNBytes (1, (SYS_UWORD8*)ptr, (SYS_UWORD32)ToWrite);
5d1e22505446 GPF: tif library sources imported from Leonardo version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
145 *BytesToWrite = BytesWritten;
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 else
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 if ( *BytesToWrite & PRIM_HEADER_FLAG )
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 memcpy ( header_buffer, (char*)Buffer, TST_BIG_HEADER_SIZE );
5d1e22505446 GPF: tif library sources imported from Leonardo version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
152 return DRV_OK;
5d1e22505446 GPF: tif library sources imported from Leonardo version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
153 }
5d1e22505446 GPF: tif library sources imported from Leonardo version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
154 if ( *BytesToWrite & PRIM_DATA_FLAG )
5d1e22505446 GPF: tif library sources imported from Leonardo version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
155 {
5d1e22505446 GPF: tif library sources imported from Leonardo version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
156 ToWrite = *BytesToWrite & ~PRIM_DATA_FLAG;
5d1e22505446 GPF: tif library sources imported from Leonardo version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
157 if ( rvt_mem_alloc(TITRC_Data.trc_id, ToWrite+TST_BIG_HEADER_SIZE, &rvt_buffer) != RVT_OK )
5d1e22505446 GPF: tif library sources imported from Leonardo version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
158 return DRV_BUFFER_FULL;
5d1e22505446 GPF: tif library sources imported from Leonardo version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
159 if ( rvt_buffer != NULL )
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 memcpy ( (char*)rvt_buffer, header_buffer, TST_BIG_HEADER_SIZE );
5d1e22505446 GPF: tif library sources imported from Leonardo version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
162 memcpy ( (char*)rvt_buffer+TST_BIG_HEADER_SIZE, (char*)Buffer, ToWrite );
5d1e22505446 GPF: tif library sources imported from Leonardo version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
163 if ( rvt_send_trace_no_cpy ( rvt_buffer, TITRC_Data.trc_id, (T_RVT_MSG_LG)ToWrite+TST_BIG_HEADER_SIZE, msg_format ) != RVT_OK )
5d1e22505446 GPF: tif library sources imported from Leonardo version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
164 return DRV_BUFFER_FULL;
5d1e22505446 GPF: tif library sources imported from Leonardo version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
165 else
5d1e22505446 GPF: tif library sources imported from Leonardo version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
166 return DRV_OK;
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 if ( rvt_send_trace_cpy ( (T_RVT_BUFFER)Buffer, TITRC_Data.trc_id, (T_RVT_MSG_LG)*BytesToWrite, msg_format ) != RVT_OK )
5d1e22505446 GPF: tif library sources imported from Leonardo version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
170 return DRV_BUFFER_FULL;
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 return DRV_OK;
5d1e22505446 GPF: tif library sources imported from Leonardo version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
173 }
5d1e22505446 GPF: tif library sources imported from Leonardo version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
174 #endif
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 #ifndef RUN_INT_RAM
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 +--------------------------------------------------------------------+
5d1e22505446 GPF: tif library sources imported from Leonardo version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
179 | PROJECT : GSM-Frame (8415) MODULE : TITRC |
5d1e22505446 GPF: tif library sources imported from Leonardo version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
180 | STATE : code ROUTINE : TITRC_SetSignal |
5d1e22505446 GPF: tif library sources imported from Leonardo version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
181 +--------------------------------------------------------------------+
5d1e22505446 GPF: tif library sources imported from Leonardo version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
182
5d1e22505446 GPF: tif library sources imported from Leonardo version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
183 PURPOSE : enable signal for the driver
5d1e22505446 GPF: tif library sources imported from Leonardo version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
184
5d1e22505446 GPF: tif library sources imported from Leonardo version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
185 */
5d1e22505446 GPF: tif library sources imported from Leonardo version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
186 USHORT TITRC_SetSignal ( USHORT SignalType )
5d1e22505446 GPF: tif library sources imported from Leonardo version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
187 {
5d1e22505446 GPF: tif library sources imported from Leonardo version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
188 if ( !(SignalType & ALLOWED_TITRC_SIGNALS) )
5d1e22505446 GPF: tif library sources imported from Leonardo version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
189 return DRV_INVALID_PARAMS;
5d1e22505446 GPF: tif library sources imported from Leonardo version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
190 else
5d1e22505446 GPF: tif library sources imported from Leonardo version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
191 TITRC_Data.EnabledSignalType |= SignalType;
5d1e22505446 GPF: tif library sources imported from Leonardo version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
192
5d1e22505446 GPF: tif library sources imported from Leonardo version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
193 return DRV_OK;
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 #endif
5d1e22505446 GPF: tif library sources imported from Leonardo version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
196
5d1e22505446 GPF: tif library sources imported from Leonardo version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
197 #ifndef RUN_INT_RAM
5d1e22505446 GPF: tif library sources imported from Leonardo version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
198 /*
5d1e22505446 GPF: tif library sources imported from Leonardo version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
199 +--------------------------------------------------------------------+
5d1e22505446 GPF: tif library sources imported from Leonardo version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
200 | PROJECT : GSM-Frame (8415) MODULE : TITRC |
5d1e22505446 GPF: tif library sources imported from Leonardo version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
201 | STATE : code ROUTINE : TITRC_ResetSignal |
5d1e22505446 GPF: tif library sources imported from Leonardo version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
202 +--------------------------------------------------------------------+
5d1e22505446 GPF: tif library sources imported from Leonardo version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
203
5d1e22505446 GPF: tif library sources imported from Leonardo version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
204 PURPOSE : disable signal for the driver
5d1e22505446 GPF: tif library sources imported from Leonardo version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
205
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 USHORT TITRC_ResetSignal ( USHORT SignalType )
5d1e22505446 GPF: tif library sources imported from Leonardo version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
208 {
5d1e22505446 GPF: tif library sources imported from Leonardo version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
209 if ( !(SignalType & ALLOWED_TITRC_SIGNALS) )
5d1e22505446 GPF: tif library sources imported from Leonardo version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
210 return DRV_INVALID_PARAMS;
5d1e22505446 GPF: tif library sources imported from Leonardo version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
211 else
5d1e22505446 GPF: tif library sources imported from Leonardo version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
212 TITRC_Data.EnabledSignalType &= ~SignalType;
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 return DRV_OK;
5d1e22505446 GPF: tif library sources imported from Leonardo version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
215 }
5d1e22505446 GPF: tif library sources imported from Leonardo version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
216 #endif
5d1e22505446 GPF: tif library sources imported from Leonardo version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
217
5d1e22505446 GPF: tif library sources imported from Leonardo version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
218 #ifndef RUN_INT_RAM
5d1e22505446 GPF: tif library sources imported from Leonardo version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
219 /*
5d1e22505446 GPF: tif library sources imported from Leonardo version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
220 +--------------------------------------------------------------------+
5d1e22505446 GPF: tif library sources imported from Leonardo version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
221 | PROJECT : GSM-Frame (8415) MODULE : TITRC |
5d1e22505446 GPF: tif library sources imported from Leonardo version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
222 | STATE : code ROUTINE : TITRC_SetConfig |
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
5d1e22505446 GPF: tif library sources imported from Leonardo version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
225 PURPOSE : set configuration for the driver
5d1e22505446 GPF: tif library sources imported from Leonardo version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
226
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 USHORT TITRC_SetConfig ( char *Buffer )
5d1e22505446 GPF: tif library sources imported from Leonardo version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
229 {
5d1e22505446 GPF: tif library sources imported from Leonardo version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
230
5d1e22505446 GPF: tif library sources imported from Leonardo version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
231 if ( TITRC_Data.connected == FALSE )
5d1e22505446 GPF: tif library sources imported from Leonardo version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
232 {
5d1e22505446 GPF: tif library sources imported from Leonardo version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
233 Signal.SignalType = DRV_SIGTYPE_CONNECT;
5d1e22505446 GPF: tif library sources imported from Leonardo version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
234 Signal.DrvHandle = TITRC_Data.Handle;
5d1e22505446 GPF: tif library sources imported from Leonardo version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
235 (TITRC_Data.Callback)( &Signal );
5d1e22505446 GPF: tif library sources imported from Leonardo version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
236 TITRC_Data.connected = TRUE;
5d1e22505446 GPF: tif library sources imported from Leonardo version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
237 }
5d1e22505446 GPF: tif library sources imported from Leonardo version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
238 return DRV_OK;
5d1e22505446 GPF: tif library sources imported from Leonardo version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
239 }
5d1e22505446 GPF: tif library sources imported from Leonardo version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
240 #endif
5d1e22505446 GPF: tif library sources imported from Leonardo version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
241
5d1e22505446 GPF: tif library sources imported from Leonardo version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
242 #ifndef RUN_INT_RAM
5d1e22505446 GPF: tif library sources imported from Leonardo version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
243 /*
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 | PROJECT : GSM-Frame (8415) MODULE : TITRC |
5d1e22505446 GPF: tif library sources imported from Leonardo version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
246 | STATE : code ROUTINE : TITRC_Callback |
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
5d1e22505446 GPF: tif library sources imported from Leonardo version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
249 PURPOSE : callback function of the driver
5d1e22505446 GPF: tif library sources imported from Leonardo version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
250
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 int callback_busy = 0;
5d1e22505446 GPF: tif library sources imported from Leonardo version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
253 void TITRC_Callback ( T_RVT_BUFFER ptr, UINT16 len )
5d1e22505446 GPF: tif library sources imported from Leonardo version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
254 {
5d1e22505446 GPF: tif library sources imported from Leonardo version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
255 if ( callback_busy == 1 )
5d1e22505446 GPF: tif library sources imported from Leonardo version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
256 for (;;)
5d1e22505446 GPF: tif library sources imported from Leonardo version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
257 ;
5d1e22505446 GPF: tif library sources imported from Leonardo version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
258
5d1e22505446 GPF: tif library sources imported from Leonardo version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
259 callback_busy = 1;
5d1e22505446 GPF: tif library sources imported from Leonardo version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
260 if ( TITRC_Data.EnabledSignalType & DRV_SIGTYPE_READ )
5d1e22505446 GPF: tif library sources imported from Leonardo version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
261 {
5d1e22505446 GPF: tif library sources imported from Leonardo version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
262 TITRC_Data.read_ptr = ptr;
5d1e22505446 GPF: tif library sources imported from Leonardo version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
263 TITRC_Data.read_len = len;
5d1e22505446 GPF: tif library sources imported from Leonardo version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
264 Signal.SignalType = DRV_SIGTYPE_READ;
5d1e22505446 GPF: tif library sources imported from Leonardo version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
265 Signal.DrvHandle = TITRC_Data.Handle;
5d1e22505446 GPF: tif library sources imported from Leonardo version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
266 (TITRC_Data.Callback)( &Signal );
5d1e22505446 GPF: tif library sources imported from Leonardo version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
267 }
5d1e22505446 GPF: tif library sources imported from Leonardo version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
268 callback_busy = 0;
5d1e22505446 GPF: tif library sources imported from Leonardo version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
269 }
5d1e22505446 GPF: tif library sources imported from Leonardo version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
270 #endif
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 #ifndef RUN_INT_RAM
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 | PROJECT : GSM-Frame (8415) MODULE : TITRC |
5d1e22505446 GPF: tif library sources imported from Leonardo version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
276 | STATE : code ROUTINE : TITRC_Init |
5d1e22505446 GPF: tif library sources imported from Leonardo version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
277 +--------------------------------------------------------------------+
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 PURPOSE : initialize driver
5d1e22505446 GPF: tif library sources imported from Leonardo version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
280
5d1e22505446 GPF: tif library sources imported from Leonardo version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
281 */
5d1e22505446 GPF: tif library sources imported from Leonardo version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
282 USHORT TITRC_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
283 {
5d1e22505446 GPF: tif library sources imported from Leonardo version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
284 static const T_DRV_EXPORT TITRC_Info =
5d1e22505446 GPF: tif library sources imported from Leonardo version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
285 {
5d1e22505446 GPF: tif library sources imported from Leonardo version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
286 "TITRC",
5d1e22505446 GPF: tif library sources imported from Leonardo version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
287 0,
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 #ifdef _TOOLS_
5d1e22505446 GPF: tif library sources imported from Leonardo version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
290 TITRC_Init,
5d1e22505446 GPF: tif library sources imported from Leonardo version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
291 #endif
5d1e22505446 GPF: tif library sources imported from Leonardo version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
292 NULL,
5d1e22505446 GPF: tif library sources imported from Leonardo version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
293 TITRC_Read,
5d1e22505446 GPF: tif library sources imported from Leonardo version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
294 TITRC_Write,
5d1e22505446 GPF: tif library sources imported from Leonardo version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
295 NULL,
5d1e22505446 GPF: tif library sources imported from Leonardo version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
296 NULL,
5d1e22505446 GPF: tif library sources imported from Leonardo version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
297 NULL,
5d1e22505446 GPF: tif library sources imported from Leonardo version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
298 TITRC_SetSignal,
5d1e22505446 GPF: tif library sources imported from Leonardo version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
299 TITRC_ResetSignal,
5d1e22505446 GPF: tif library sources imported from Leonardo version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
300 TITRC_SetConfig,
5d1e22505446 GPF: tif library sources imported from Leonardo version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
301 NULL,
5d1e22505446 GPF: tif library sources imported from Leonardo version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
302 NULL,
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 };
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 TITRC_Data.connected = FALSE;
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 TITRC_Data.Handle = DrvHandle;
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 TITRC_Data.EnabledSignalType = 0;
5d1e22505446 GPF: tif library sources imported from Leonardo version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
311
5d1e22505446 GPF: tif library sources imported from Leonardo version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
312 TITRC_Data.Callback = CallbackFunc;
5d1e22505446 GPF: tif library sources imported from Leonardo version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
313
5d1e22505446 GPF: tif library sources imported from Leonardo version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
314 if ( rvt_register_id ( (char*)"L23",&TITRC_Data.trc_id, TITRC_Callback ) == RVT_INVALID_PARAMETER )
5d1e22505446 GPF: tif library sources imported from Leonardo version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
315 return DRV_INITFAILURE;
5d1e22505446 GPF: tif library sources imported from Leonardo version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
316
5d1e22505446 GPF: tif library sources imported from Leonardo version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
317 *DrvInfo = &TITRC_Info;
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 }
5d1e22505446 GPF: tif library sources imported from Leonardo version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
321 #endif