File: DrvDebug.h

package info (click to toggle)
oss4 4.2-build2020-6
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 15,332 kB
  • sloc: ansic: 239,151; cpp: 18,981; sh: 4,590; pascal: 3,863; asm: 1,189; makefile: 553; php: 53; xml: 46
file content (206 lines) | stat: -rw-r--r-- 5,497 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
/****************************************************************************
 DrvDebug.h

 Created: David A. Hoatson, March 1998
	
 Copyright  1998, 1999	Lynx Studio Technology, Inc.

 This software contains the valuable TRADE SECRETS and CONFIDENTIAL INFORMATION 
 of Lynx Studio Technology, Inc. The software is protected under copyright 
 laws as an unpublished work of Lynx Studio Technology, Inc.  Notice is 
 for informational purposes only and does not imply publication.  The user 
 of this software may make copies of the software for use with products 
 manufactured by Lynx Studio Technology, Inc. or under license from 
 Lynx Studio Technology, Inc. and for no other use.

 THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY
 KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE
 IMPLIED WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A PARTICULAR
 PURPOSE.
	
 Environment: Windows NT Kernel mode

 Revision History
 
 When      Who  Description
 --------- ---  ---------------------------------------------------------------
****************************************************************************/
#ifndef _DRVDEBUG_H
#define _DRVDEBUG_H

#define COLOR_UNDERLINE	1
#define COLOR_NORMAL	7
#define COLOR_BOLD_U	9
#define COLOR_BOLD		15
#define COLOR_REVERSE	120

#ifdef DEBUG

VOID DbgEnter (VOID);
VOID DbgExit (VOID);
VOID DbgPrintMono (char *pszFormat, ...);

typedef struct _GLOBAL_INFO *PGLOBAL_INFO;

NTSTATUS CreateLynxDebug (PGLOBAL_INFO pGDI, PDRIVER_OBJECT pDriverObject,
			  PDEVICE_OBJECT pPhysicalDeviceObject,
			  PDEVICE_OBJECT * ppDeviceObject);
NTSTATUS DeleteLynxDebug (PDEVICE_OBJECT pDeviceObject);
NTSTATUS DebugDispatch (IN PIRP pIrp, IN PIO_STACK_LOCATION pIrpStack);

#define USETRACE
#ifdef USETRACE

BOOLEAN TraceCreate (VOID);
BOOLEAN TraceDelete (VOID);
VOID TraceLogChar (UCHAR cChar);
VOID TraceLogString (char *psz);
VOID TraceLogTime (VOID);
VOID TracePrintF (char *pszFormat, ...);
VOID TracePutChar (char cChar, BYTE ucFormat);
VOID TracePutString (char *szStr, BYTE ucFormat);
VOID TracePutPrintF (char *pszFormat, ...);
VOID TracePutX8 (UCHAR uc8, BYTE ucFormat);
VOID TracePutX16 (USHORT w16, BYTE ucFormat);
VOID TracePutX32 (ULONG dw32, BYTE ucFormat);
VOID TracePrintElapsedTime (char *psz);

BOOLEAN TraceTimedEventCreate (int nEventID, char *pszTitle);
VOID TraceTimedEventStart (int nEventID);
VOID TraceTimedEventStop (int nEventID);
BOOLEAN TraceTimedEventRelease (int nEventID);

#else

// Forward declarations of debug functions
VOID DbgPutCh (char cChar, unsigned char cColor);
VOID DbgPutStr (char *szStr, UCHAR cColor);
VOID DbgPutX8 (UCHAR uc8, UCHAR cColor);
VOID DbgPutX16 (USHORT w16, UCHAR cColor);
VOID DbgPutX32 (ULONG dw32, UCHAR cColor);
VOID DbgPrintMono (char *szFormat, ...);
VOID DbgPutTextXY (char *szStr, UCHAR cColor, UCHAR X, UCHAR Y);
VOID DbgPrintF (const char *pszFormat, ...);
VOID DbgPrintElapsedTime (VOID);

#endif

VOID LEDOn (BYTE ucState);
VOID LEDOff (BYTE ucState);

#define	LED_0	(1<<0)
#define	LED_1	(1<<1)
#define	LED_2	(1<<2)
#define	LED_3	(1<<3)
#define	LED_4	(1<<4)
#define	LED_5	(1<<5)
#define	LED_6	(1<<6)
#define	LED_7	(1<<7)

#ifdef USETRACE
#define DC( a )				TracePutChar( a, COLOR_NORMAL )
#define DB( a, b )			TracePutChar( a, b )
#define DS( a, b )			TracePutString( a, b )
#define DPS( _SZ_ )			TracePutPrintF _SZ_
#define DX8( a, b )			TracePutX8( a, b )
#define DX16( a, b )		TracePutX16( a, b )
#define DX32( a, b )		TracePutX32( a, b )
#define DPET( _SZ_ )		TracePrintElapsedTime( _SZ_ )
#define DPF( _SZ_ )			TracePrintF _SZ_

#define TECreate( ID, _SZ_ ) TraceTimedEventCreate( ID, _SZ_ )
#define TEStart( ID )		TraceTimedEventStart( ID )
#define TEStop( ID )		TraceTimedEventStop( ID )
#define TERelease( ID )		TraceTimedEventRelease( ID )
#else
#ifndef DOS
#define DC( a )				DbgPutCh( a, COLOR_NORMAL )
#define DB( a, b )			DbgPutCh( a, b )
#define DS( a, b )			DbgPutStr( a, b )
#define DPS( _SZ_ )
#define DX8( a, b )			DbgPutX8( a, b )
#define DX16( a, b )		DbgPutX16( a, b )
#define DX32( a, b )		DbgPutX32( a, b )
#define DSXY( a, b, c, d )	DbgPutTextXY( a, b, c, d )
#define DPET( _SZ_ )		DbgPrintElapsedTime()
#else
#define DbgInitialize()
#define DbgClose()

#define DC( a )
#define DB( a, b )
#define DS( a, b )
#define DPS( _SZ_ )
#define DX8( a, b )
#define DX16( a, b )
#define DX32( a, b )
#define DSXY( a, b, c, d )
#define DPET( _SZ_ )

#define TECreate( ID, _SZ_ )
#define TEStart( ID )
#define TEStop( ID )
#define TERelease( ID )
#endif
#endif

#ifdef ALPHA
#define DPF( _SZ_ )		DbgPrint _SZ_
#define DPET( _SZ_ )	DbgPrintElapsedTime()
#endif

#ifdef DOS
#define DPF( _SZ_ )		printf _SZ_
#define DPET( _SZ_ )
#endif

#ifdef MACINTOSH
#define DPF( _SZ_ )	DbgPrintF _SZ_
	//#define DPET()
#endif

#ifndef USETRACE
#ifdef NT
typedef struct _MONO_INFO
{
  //KSPIN_LOCK    DeviceSpinLock;
  KMUTEX DeviceMutex;
} MONO_INFO, *PMONO_INFO;

#define DPF( _SZ_ )		DbgPrintMono _SZ_
#define DPET( _SZ_ )	DbgPrintElapsedTime()
#endif
#endif

#ifndef DPF
#define DPF( _SZ_ )		DbgPrintMono _SZ_
#endif

#else // non-debug
#if defined(sun)
#undef DS
#endif

#define DbgInitialize()
#define DbgClose()

#define DC( a )
#define DB( a, b )
#define DS( a, b )
#define DPS( _SZ_ )
#define DX8( a, b )
#define DX16( a, b )
#define DX32( a, b )
#ifndef DPF
#define DPF(_X_)
#endif
#define DSXY( a, b, c, d )
#define DPET( _SZ_ )

#define TECreate( ID, _SZ_ )
#define TEStart( ID )
#define TEStop( ID )
#define TERelease( ID )
#endif

#endif