36e73d33cd1cb39fa2fe614518d0b1aafc288ae8
[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 Library General Public
8 * License as published by the Free Software Foundation; either
9 * version 2 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 * Library General Public License for more details.
15 *
16 * You should have received a copy of the GNU Library General Public
17 * License along with this library; see the file COPYING.LIB.
18 * If not, write to the Free Software Foundation,
19 * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
20 *
21 * $Id$
22 */
23
24 #ifndef VIDEOPRT_H
25 #define VIDEOPRT_H
26
27 #include <stdio.h>
28 #include <ntddk.h>
29 #include <miniport.h>
30 #include <video.h>
31 #include <ntddvdeo.h>
32 #include <ntagp.h>
33 #include <ntifs.h>
34 #include <ndk/ntndk.h>
35 #include <reactos/helper.h>
36
37 #define NDEBUG
38 #include <debug.h>
39
40 #define TAG_VIDEO_PORT TAG('V', 'I', 'D', 'P')
41
42 #define DPFLTR_IHVVIDEO_ID 0 /* FIXME */
43
44 typedef struct _VIDEO_PORT_ADDRESS_MAPPING
45 {
46 LIST_ENTRY List;
47 PVOID MappedAddress;
48 ULONG NumberOfUchars;
49 PHYSICAL_ADDRESS IoAddress;
50 ULONG SystemIoBusNumber;
51 UINT MappingCount;
52 } VIDEO_PORT_ADDRESS_MAPPING, *PVIDEO_PORT_ADDRESS_MAPPING;
53
54 struct _VIDEO_PORT_AGP_VIRTUAL_MAPPING;
55
56 typedef struct _VIDEO_PORT_AGP_MAPPING
57 {
58 ULONG NumberOfPages;
59 PVOID MapHandle;
60 PHYSICAL_ADDRESS PhysicalAddress;
61 } VIDEO_PORT_AGP_MAPPING, *PVIDEO_PORT_AGP_MAPPING;
62
63 typedef struct _VIDEO_PORT_AGP_VIRTUAL_MAPPING
64 {
65 PVIDEO_PORT_AGP_MAPPING AgpMapping;
66 HANDLE ProcessHandle;
67 PVOID MappedAddress;
68 } VIDEO_PORT_AGP_VIRTUAL_MAPPING, *PVIDEO_PORT_AGP_VIRTUAL_MAPPING;
69
70 typedef struct _VIDEO_PORT_DRIVER_EXTENSION
71 {
72 VIDEO_HW_INITIALIZATION_DATA InitializationData;
73 PVOID HwContext;
74 UNICODE_STRING RegistryPath;
75 } VIDEO_PORT_DRIVER_EXTENSION, *PVIDEO_PORT_DRIVER_EXTENSION;
76
77 typedef struct _VIDEO_PORT_DEVICE_EXTENSTION
78 {
79 ULONG DeviceNumber;
80 PDRIVER_OBJECT DriverObject;
81 PDEVICE_OBJECT PhysicalDeviceObject;
82 PDEVICE_OBJECT FunctionalDeviceObject;
83 PDEVICE_OBJECT NextDeviceObject;
84 UNICODE_STRING RegistryPath;
85 PKINTERRUPT InterruptObject;
86 KSPIN_LOCK InterruptSpinLock;
87 PCM_RESOURCE_LIST AllocatedResources;
88 ULONG InterruptVector;
89 ULONG InterruptLevel;
90 BOOLEAN InterruptShared;
91 INTERFACE_TYPE AdapterInterfaceType;
92 ULONG SystemIoBusNumber;
93 ULONG SystemIoSlotNumber;
94 LIST_ENTRY AddressMappingListHead;
95 KDPC DpcObject;
96 VIDEO_PORT_DRIVER_EXTENSION *DriverExtension;
97 ULONG DeviceOpened;
98 AGP_BUS_INTERFACE_STANDARD AgpInterface;
99 KMUTEX DeviceLock;
100 CHAR MiniPortDeviceExtension[1];
101 } VIDEO_PORT_DEVICE_EXTENSION, *PVIDEO_PORT_DEVICE_EXTENSION;
102
103 #define VIDEO_PORT_GET_DEVICE_EXTENSION(MiniportExtension) \
104 CONTAINING_RECORD( \
105 HwDeviceExtension, \
106 VIDEO_PORT_DEVICE_EXTENSION, \
107 MiniPortDeviceExtension)
108
109 /* agp.c */
110
111 NTSTATUS NTAPI
112 IntAgpGetInterface(
113 IN PVOID HwDeviceExtension,
114 IN OUT PINTERFACE Interface);
115
116 /* dispatch.c */
117
118 NTSTATUS NTAPI
119 IntVideoPortAddDevice(
120 IN PDRIVER_OBJECT DriverObject,
121 IN PDEVICE_OBJECT PhysicalDeviceObject);
122
123 NTSTATUS NTAPI
124 IntVideoPortDispatchOpen(
125 IN PDEVICE_OBJECT DeviceObject,
126 IN PIRP Irp);
127
128 NTSTATUS NTAPI
129 IntVideoPortDispatchClose(
130 IN PDEVICE_OBJECT DeviceObject,
131 IN PIRP Irp);
132
133 NTSTATUS NTAPI
134 IntVideoPortDispatchCleanup(
135 IN PDEVICE_OBJECT DeviceObject,
136 IN PIRP Irp);
137
138 NTSTATUS NTAPI
139 IntVideoPortDispatchDeviceControl(
140 IN PDEVICE_OBJECT DeviceObject,
141 IN PIRP Irp);
142
143 NTSTATUS NTAPI
144 IntVideoPortDispatchPnp(
145 IN PDEVICE_OBJECT DeviceObject,
146 IN PIRP Irp);
147
148 NTSTATUS NTAPI
149 IntVideoPortDispatchPower(
150 IN PDEVICE_OBJECT DeviceObject,
151 IN PIRP Irp);
152
153 NTSTATUS NTAPI
154 IntVideoPortDispatchWrite(
155 IN PDEVICE_OBJECT DeviceObject,
156 IN PIRP Irp);
157
158 VOID NTAPI
159 IntVideoPortUnload(PDRIVER_OBJECT DriverObject);
160
161 /* timer.c */
162
163 BOOLEAN NTAPI
164 IntVideoPortSetupTimer(
165 IN PDEVICE_OBJECT DeviceObject,
166 IN PVIDEO_PORT_DRIVER_EXTENSION DriverExtension);
167
168 /* interrupt.c */
169
170 BOOLEAN NTAPI
171 IntVideoPortSetupInterrupt(
172 IN PDEVICE_OBJECT DeviceObject,
173 IN PVIDEO_PORT_DRIVER_EXTENSION DriverExtension,
174 IN PVIDEO_PORT_CONFIG_INFO ConfigInfo);
175
176 /* resource.c */
177
178 NTSTATUS NTAPI
179 IntVideoPortMapPhysicalMemory(
180 IN HANDLE Process,
181 IN PHYSICAL_ADDRESS PhysicalAddress,
182 IN ULONG SizeInBytes,
183 IN ULONG Protect,
184 IN OUT PVOID *VirtualAddress OPTIONAL);
185
186 /* videoprt.c */
187
188 extern ULONG CsrssInitialized;
189 extern PKPROCESS Csrss;
190
191 VP_STATUS NTAPI
192 VideoPortEnumerateChildren(
193 IN PVOID HwDeviceExtension,
194 IN PVOID Reserved);
195
196 PVOID NTAPI
197 VideoPortGetProcAddress(
198 IN PVOID HwDeviceExtension,
199 IN PUCHAR FunctionName);
200
201 VOID FASTCALL
202 IntAttachToCSRSS(PKPROCESS *CallingProcess, PKAPC_STATE ApcState);
203
204 VOID FASTCALL
205 IntDetachFromCSRSS(PKPROCESS *CallingProcess, PKAPC_STATE ApcState);
206
207 NTSTATUS NTAPI
208 IntVideoPortCreateAdapterDeviceObject(
209 IN PDRIVER_OBJECT DriverObject,
210 IN PVIDEO_PORT_DRIVER_EXTENSION DriverExtension,
211 IN PDEVICE_OBJECT PhysicalDeviceObject OPTIONAL,
212 OUT PDEVICE_OBJECT *DeviceObject OPTIONAL);
213
214 NTSTATUS NTAPI
215 IntVideoPortFindAdapter(
216 IN PDRIVER_OBJECT DriverObject,
217 IN PVIDEO_PORT_DRIVER_EXTENSION DriverExtension,
218 IN PDEVICE_OBJECT DeviceObject);
219
220 /* int10.c */
221
222 VP_STATUS NTAPI
223 IntInt10AllocateBuffer(
224 IN PVOID Context,
225 OUT PUSHORT Seg,
226 OUT PUSHORT Off,
227 IN OUT PULONG Length);
228
229 VP_STATUS NTAPI
230 IntInt10FreeBuffer(
231 IN PVOID Context,
232 IN USHORT Seg,
233 IN USHORT Off);
234
235 VP_STATUS NTAPI
236 IntInt10ReadMemory(
237 IN PVOID Context,
238 IN USHORT Seg,
239 IN USHORT Off,
240 OUT PVOID Buffer,
241 IN ULONG Length);
242
243 VP_STATUS NTAPI
244 IntInt10WriteMemory(
245 IN PVOID Context,
246 IN USHORT Seg,
247 IN USHORT Off,
248 IN PVOID Buffer,
249 IN ULONG Length);
250
251 VP_STATUS NTAPI
252 IntInt10CallBios(
253 IN PVOID Context,
254 IN OUT PINT10_BIOS_ARGUMENTS BiosArguments);
255
256 VP_STATUS NTAPI
257 VideoPortInt10(
258 IN PVOID HwDeviceExtension,
259 IN PVIDEO_X86_BIOS_ARGUMENTS BiosArguments);
260
261 #endif /* VIDEOPRT_H */