- Video Miniport driver not use ntddk.h, but miniport.h. But, Reactos miniport.h...
[reactos.git] / reactos / drivers / video / videoprt / videoprt.h
1 /*
2 * VideoPort driver
3 *
4 * Copyright (C) 2002, 2003, 2004 ReactOS Team
5 *
6 * This library is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU Lesser General Public
8 * License as published by the Free Software Foundation; either
9 * version 2.1 of the License, or (at your option) any later version.
10 *
11 * This library is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 * Lesser General Public License for more details.
15 *
16 * You should have received a copy of the GNU Lesser General Public
17 * License along with this library; if not, write to the Free Software
18 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
19 *
20 */
21
22 #ifndef VIDEOPRT_H
23 #define VIDEOPRT_H
24
25 #include <stdio.h>
26 #include <ntddk.h>
27 #define __BROKEN__
28 #include <miniport.h>
29 #include <video.h>
30 #include <ntddvdeo.h>
31 #include <ntagp.h>
32 #include <ntifs.h>
33 #include <ndk/ntndk.h>
34 #include <dderror.h>
35 #include <windef.h>
36
37 #include <debug.h>
38
39 #define TAG_VIDEO_PORT 'PDIV'
40 #define TAG_VIDEO_PORT_BUFFER '\0mpV'
41
42 typedef struct _VIDEO_PORT_ADDRESS_MAPPING
43 {
44 LIST_ENTRY List;
45 PVOID MappedAddress;
46 ULONG NumberOfUchars;
47 PHYSICAL_ADDRESS IoAddress;
48 ULONG SystemIoBusNumber;
49 UINT MappingCount;
50 } VIDEO_PORT_ADDRESS_MAPPING, *PVIDEO_PORT_ADDRESS_MAPPING;
51
52 struct _VIDEO_PORT_AGP_VIRTUAL_MAPPING;
53
54 typedef struct _VIDEO_PORT_AGP_MAPPING
55 {
56 ULONG NumberOfPages;
57 PVOID MapHandle;
58 PHYSICAL_ADDRESS PhysicalAddress;
59 } VIDEO_PORT_AGP_MAPPING, *PVIDEO_PORT_AGP_MAPPING;
60
61 typedef struct _VIDEO_PORT_AGP_VIRTUAL_MAPPING
62 {
63 PVIDEO_PORT_AGP_MAPPING AgpMapping;
64 HANDLE ProcessHandle;
65 PVOID MappedAddress;
66 } VIDEO_PORT_AGP_VIRTUAL_MAPPING, *PVIDEO_PORT_AGP_VIRTUAL_MAPPING;
67
68 typedef struct _VIDEO_PORT_DRIVER_EXTENSION
69 {
70 VIDEO_HW_INITIALIZATION_DATA InitializationData;
71 PVOID HwContext;
72 UNICODE_STRING RegistryPath;
73 } VIDEO_PORT_DRIVER_EXTENSION, *PVIDEO_PORT_DRIVER_EXTENSION;
74
75 typedef struct _VIDEO_PORT_DEVICE_EXTENSTION
76 {
77 ULONG DeviceNumber;
78 PDRIVER_OBJECT DriverObject;
79 PDEVICE_OBJECT PhysicalDeviceObject;
80 PDEVICE_OBJECT FunctionalDeviceObject;
81 PDEVICE_OBJECT NextDeviceObject;
82 UNICODE_STRING RegistryPath;
83 PKINTERRUPT InterruptObject;
84 KSPIN_LOCK InterruptSpinLock;
85 PCM_RESOURCE_LIST AllocatedResources;
86 ULONG InterruptVector;
87 ULONG InterruptLevel;
88 BOOLEAN InterruptShared;
89 INTERFACE_TYPE AdapterInterfaceType;
90 ULONG SystemIoBusNumber;
91 ULONG SystemIoSlotNumber;
92 LIST_ENTRY AddressMappingListHead;
93 KDPC DpcObject;
94 VIDEO_PORT_DRIVER_EXTENSION *DriverExtension;
95 ULONG DeviceOpened;
96 AGP_BUS_INTERFACE_STANDARD AgpInterface;
97 KMUTEX DeviceLock;
98 CHAR MiniPortDeviceExtension[1];
99 } VIDEO_PORT_DEVICE_EXTENSION, *PVIDEO_PORT_DEVICE_EXTENSION;
100
101 #define VIDEO_PORT_GET_DEVICE_EXTENSION(MiniportExtension) \
102 CONTAINING_RECORD( \
103 HwDeviceExtension, \
104 VIDEO_PORT_DEVICE_EXTENSION, \
105 MiniPortDeviceExtension)
106
107 typedef struct _VIDEO_PORT_EVENT
108 {
109 /* Public part */
110 ENG_EVENT;
111
112 /* Private part */
113 KEVENT Event;
114 } VIDEO_PORT_EVENT, *PVIDEO_PORT_EVENT;
115
116 /* agp.c */
117
118 NTSTATUS
119 IopInitiatePnpIrp(
120 PDEVICE_OBJECT DeviceObject,
121 PIO_STATUS_BLOCK IoStatusBlock,
122 ULONG MinorFunction,
123 PIO_STACK_LOCATION Stack OPTIONAL);
124
125 NTSTATUS NTAPI
126 IntAgpGetInterface(
127 IN PVOID HwDeviceExtension,
128 IN OUT PINTERFACE Interface);
129
130 /* dispatch.c */
131
132 NTSTATUS NTAPI
133 IntVideoPortAddDevice(
134 IN PDRIVER_OBJECT DriverObject,
135 IN PDEVICE_OBJECT PhysicalDeviceObject);
136
137 NTSTATUS NTAPI
138 IntVideoPortDispatchOpen(
139 IN PDEVICE_OBJECT DeviceObject,
140 IN PIRP Irp);
141
142 NTSTATUS NTAPI
143 IntVideoPortDispatchClose(
144 IN PDEVICE_OBJECT DeviceObject,
145 IN PIRP Irp);
146
147 NTSTATUS NTAPI
148 IntVideoPortDispatchCleanup(
149 IN PDEVICE_OBJECT DeviceObject,
150 IN PIRP Irp);
151
152 NTSTATUS NTAPI
153 IntVideoPortDispatchDeviceControl(
154 IN PDEVICE_OBJECT DeviceObject,
155 IN PIRP Irp);
156
157 NTSTATUS NTAPI
158 IntVideoPortDispatchPnp(
159 IN PDEVICE_OBJECT DeviceObject,
160 IN PIRP Irp);
161
162 NTSTATUS NTAPI
163 IntVideoPortDispatchPower(
164 IN PDEVICE_OBJECT DeviceObject,
165 IN PIRP Irp);
166
167 NTSTATUS NTAPI
168 IntVideoPortDispatchSystemControl(
169 IN PDEVICE_OBJECT DeviceObject,
170 IN PIRP Irp);
171
172 NTSTATUS NTAPI
173 IntVideoPortDispatchWrite(
174 IN PDEVICE_OBJECT DeviceObject,
175 IN PIRP Irp);
176
177 VOID NTAPI
178 IntVideoPortUnload(PDRIVER_OBJECT DriverObject);
179
180 /* timer.c */
181
182 BOOLEAN NTAPI
183 IntVideoPortSetupTimer(
184 IN PDEVICE_OBJECT DeviceObject,
185 IN PVIDEO_PORT_DRIVER_EXTENSION DriverExtension);
186
187 /* interrupt.c */
188
189 BOOLEAN NTAPI
190 IntVideoPortSetupInterrupt(
191 IN PDEVICE_OBJECT DeviceObject,
192 IN PVIDEO_PORT_DRIVER_EXTENSION DriverExtension,
193 IN PVIDEO_PORT_CONFIG_INFO ConfigInfo);
194
195 /* resource.c */
196
197 NTSTATUS NTAPI
198 IntVideoPortMapPhysicalMemory(
199 IN HANDLE Process,
200 IN PHYSICAL_ADDRESS PhysicalAddress,
201 IN ULONG SizeInBytes,
202 IN ULONG Protect,
203 IN OUT PVOID *VirtualAddress OPTIONAL);
204
205 /* videoprt.c */
206
207 extern ULONG CsrssInitialized;
208 extern PKPROCESS Csrss;
209 extern ULONG VideoPortDeviceNumber;
210
211 VOID FASTCALL
212 IntAttachToCSRSS(PKPROCESS *CallingProcess, PKAPC_STATE ApcState);
213
214 VOID FASTCALL
215 IntDetachFromCSRSS(PKPROCESS *CallingProcess, PKAPC_STATE ApcState);
216
217 NTSTATUS NTAPI
218 IntVideoPortCreateAdapterDeviceObject(
219 IN PDRIVER_OBJECT DriverObject,
220 IN PVIDEO_PORT_DRIVER_EXTENSION DriverExtension,
221 IN PDEVICE_OBJECT PhysicalDeviceObject OPTIONAL,
222 OUT PDEVICE_OBJECT *DeviceObject OPTIONAL);
223
224 NTSTATUS NTAPI
225 IntVideoPortFindAdapter(
226 IN PDRIVER_OBJECT DriverObject,
227 IN PVIDEO_PORT_DRIVER_EXTENSION DriverExtension,
228 IN PDEVICE_OBJECT DeviceObject);
229
230 PVOID NTAPI
231 IntVideoPortGetProcAddress(
232 IN PVOID HwDeviceExtension,
233 IN PUCHAR FunctionName);
234
235 /* int10.c */
236
237 VP_STATUS NTAPI
238 IntInt10AllocateBuffer(
239 IN PVOID Context,
240 OUT PUSHORT Seg,
241 OUT PUSHORT Off,
242 IN OUT PULONG Length);
243
244 VP_STATUS NTAPI
245 IntInt10FreeBuffer(
246 IN PVOID Context,
247 IN USHORT Seg,
248 IN USHORT Off);
249
250 VP_STATUS NTAPI
251 IntInt10ReadMemory(
252 IN PVOID Context,
253 IN USHORT Seg,
254 IN USHORT Off,
255 OUT PVOID Buffer,
256 IN ULONG Length);
257
258 VP_STATUS NTAPI
259 IntInt10WriteMemory(
260 IN PVOID Context,
261 IN USHORT Seg,
262 IN USHORT Off,
263 IN PVOID Buffer,
264 IN ULONG Length);
265
266 VP_STATUS NTAPI
267 IntInt10CallBios(
268 IN PVOID Context,
269 IN OUT PINT10_BIOS_ARGUMENTS BiosArguments);
270
271 #endif /* VIDEOPRT_H */