1b8a27ccb16bfb12450698c1dbfbe6ef35f5eb43
[reactos.git] / reactos / drivers / base / green / green.h
1 #include <stdarg.h>
2 #include <ntddk.h>
3 #include <ndk/iotypes.h>
4 #include <windef.h>
5 #define WINBASEAPI
6 typedef struct _SECURITY_ATTRIBUTES SECURITY_ATTRIBUTES, *PSECURITY_ATTRIBUTES;
7 #include <ntddser.h>
8 #include <kbdmou.h>
9 #include <wincon.h>
10 #include <drivers/blue/ntddblue.h>
11
12 NTSYSAPI
13 NTSTATUS
14 NTAPI
15 RtlDuplicateUnicodeString(
16 IN ULONG Flags,
17 IN PCUNICODE_STRING SourceString,
18 OUT PUNICODE_STRING DestinationString
19 );
20 #define RTL_DUPLICATE_UNICODE_STRING_NULL_TERMINATE 1
21
22 #define INFINITE -1
23 #define KEYBOARD_BUFFER_SIZE 100
24
25 typedef enum
26 {
27 GreenPDO,
28 ScreenPDO,
29 KeyboardPDO,
30 GreenFDO,
31 ScreenFDO,
32 KeyboardFDO,
33 PassThroughFDO,
34 } GREEN_DEVICE_TYPE;
35
36 typedef struct _COMMON_DEVICE_EXTENSION
37 {
38 GREEN_DEVICE_TYPE Type;
39 } COMMON_DEVICE_EXTENSION, *PCOMMON_DEVICE_EXTENSION;
40
41 /* For PassThroughFDO devices */
42 typedef struct _COMMON_FDO_DEVICE_EXTENSION
43 {
44 GREEN_DEVICE_TYPE Type;
45 PDEVICE_OBJECT LowerDevice;
46 } COMMON_FDO_DEVICE_EXTENSION, *PCOMMON_FDO_DEVICE_EXTENSION;
47
48 /* For KeyboardFDO devices */
49 typedef struct _KEYBOARD_DEVICE_EXTENSION
50 {
51 COMMON_FDO_DEVICE_EXTENSION Common;
52 PDEVICE_OBJECT Green;
53
54 CONNECT_DATA ClassInformation;
55 HANDLE WorkerThreadHandle;
56 KDPC KeyboardDpc;
57
58 ULONG ActiveQueue;
59 ULONG InputDataCount[2];
60 KEYBOARD_INPUT_DATA KeyboardInputData[2][KEYBOARD_BUFFER_SIZE];
61 } KEYBOARD_DEVICE_EXTENSION, *PKEYBOARD_DEVICE_EXTENSION;
62
63 /* For ScreenFDO devices */
64 typedef struct _SCREEN_DEVICE_EXTENSION
65 {
66 COMMON_FDO_DEVICE_EXTENSION Common;
67 PDEVICE_OBJECT Green;
68
69 PUCHAR VideoMemory; /* Pointer to video memory */
70 USHORT CharAttribute; /* Current color attribute */
71 ULONG Mode;
72 UCHAR ScanLines; /* Height of a text line */
73 UCHAR Rows; /* Number of rows */
74 UCHAR Columns; /* Number of columns */
75 UCHAR TabWidth;
76
77 ULONG LogicalOffset; /* Position of the cursor */
78
79 UCHAR SendBuffer[1024];
80 ULONG SendBufferPosition;
81 PDEVICE_OBJECT PreviousBlue;
82 } SCREEN_DEVICE_EXTENSION, *PSCREEN_DEVICE_EXTENSION;
83
84 /* For GreenFDO devices */
85 typedef struct _GREEN_DEVICE_EXTENSION
86 {
87 COMMON_FDO_DEVICE_EXTENSION Common;
88 PDEVICE_OBJECT Serial;
89
90 SERIAL_LINE_CONTROL LineControl;
91 SERIAL_TIMEOUTS Timeouts;
92
93 PDEVICE_OBJECT KeyboardPdo;
94 PDEVICE_OBJECT ScreenPdo;
95 PDEVICE_OBJECT KeyboardFdo;
96 PDEVICE_OBJECT ScreenFdo;
97 } GREEN_DEVICE_EXTENSION, *PGREEN_DEVICE_EXTENSION;
98
99 typedef struct _GREEN_DRIVER_EXTENSION
100 {
101 UNICODE_STRING RegistryPath;
102
103 UNICODE_STRING AttachedDeviceName;
104 ULONG DeviceReported;
105 ULONG SampleRate;
106
107 PDEVICE_OBJECT GreenMainDO;
108 } GREEN_DRIVER_EXTENSION, *PGREEN_DRIVER_EXTENSION;
109
110 /************************************ createclose.c */
111
112 NTSTATUS NTAPI
113 GreenCreate(
114 IN PDEVICE_OBJECT DeviceObject,
115 IN PIRP Irp);
116
117 NTSTATUS NTAPI
118 GreenClose(
119 IN PDEVICE_OBJECT DeviceObject,
120 IN PIRP Irp);
121
122 /************************************ dispatch.c */
123
124 NTSTATUS NTAPI
125 GreenDispatch(
126 IN PDEVICE_OBJECT DeviceObject,
127 IN PIRP Irp);
128
129 /************************************ keyboard.c */
130
131 NTSTATUS
132 KeyboardAddDevice(
133 IN PDRIVER_OBJECT DriverObject,
134 IN PDEVICE_OBJECT Pdo);
135
136 NTSTATUS
137 KeyboardInternalDeviceControl(
138 IN PDEVICE_OBJECT DeviceObject,
139 IN PIRP Irp);
140
141 /************************************ misc.c */
142
143 NTSTATUS
144 GreenDeviceIoControl(
145 IN PDEVICE_OBJECT DeviceObject,
146 IN ULONG CtlCode,
147 IN PVOID InputBuffer OPTIONAL,
148 IN ULONG InputBufferSize,
149 IN OUT PVOID OutputBuffer OPTIONAL,
150 IN OUT PULONG OutputBufferSize);
151
152 NTSTATUS
153 ReadRegistryEntries(
154 IN PUNICODE_STRING RegistryPath,
155 IN PGREEN_DRIVER_EXTENSION DriverExtension);
156
157 /************************************ pnp.c */
158
159 NTSTATUS NTAPI
160 GreenAddDevice(
161 IN PDRIVER_OBJECT DriverObject,
162 IN PDEVICE_OBJECT Pdo);
163
164 NTSTATUS
165 GreenPnp(
166 IN PDEVICE_OBJECT DeviceObject,
167 IN PIRP Irp);
168
169 /************************************ power.c */
170
171 NTSTATUS
172 GreenPower(
173 IN PDEVICE_OBJECT DeviceObject,
174 IN PIRP Irp);
175
176 /************************************ screen.c */
177
178 NTSTATUS
179 ScreenAddDevice(
180 IN PDRIVER_OBJECT DriverObject,
181 IN PDEVICE_OBJECT Pdo);
182
183 NTSTATUS
184 ScreenWrite(
185 IN PDEVICE_OBJECT DeviceObject,
186 IN PIRP Irp);
187
188 NTSTATUS
189 ScreenDeviceControl(
190 IN PDEVICE_OBJECT DeviceObject,
191 IN PIRP Irp);