Branch setupapi
[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 <ddk/miniport.h>
28 #include <ddk/video.h>
29 #include <ddk/ntddvdeo.h>
30 #include <ddk/ntapi.h>
31 #define NDEBUG
32 #include <debug.h>
33
34 int swprintf(wchar_t *buf, const wchar_t *fmt, ...);
35 int vsprintf(char *buf, const char *fmt, va_list args);
36
37 BOOLEAN STDCALL
38 HalDisableSystemInterrupt(ULONG Vector,
39 KIRQL Irql);
40
41 BOOLEAN STDCALL
42 HalEnableSystemInterrupt(ULONG Vector,
43 KIRQL Irql,
44 KINTERRUPT_MODE InterruptMode);
45
46 PIMAGE_NT_HEADERS STDCALL RtlImageNtHeader(IN PVOID BaseAddress);
47
48 #define TAG_VIDEO_PORT TAG('V', 'I', 'D', 'P')
49
50 typedef struct _VIDEO_PORT_ADDRESS_MAPPING
51 {
52 LIST_ENTRY List;
53 PVOID MappedAddress;
54 PVOID MappedUserAddress;
55 ULONG NumberOfUchars;
56 PHYSICAL_ADDRESS IoAddress;
57 ULONG SystemIoBusNumber;
58 UINT MappingCount;
59 UINT UserMappingCount;
60 } VIDEO_PORT_ADDRESS_MAPPING, *PVIDEO_PORT_ADDRESS_MAPPING;
61
62 typedef struct _VIDEO_PORT_DRIVER_EXTENSION
63 {
64 VIDEO_HW_INITIALIZATION_DATA InitializationData;
65 PVOID HwContext;
66 UNICODE_STRING RegistryPath;
67 } VIDEO_PORT_DRIVER_EXTENSION, *PVIDEO_PORT_DRIVER_EXTENSION;
68
69 typedef struct _VIDEO_PORT_DEVICE_EXTENSTION
70 {
71 PDEVICE_OBJECT PhysicalDeviceObject;
72 PDEVICE_OBJECT FunctionalDeviceObject;
73 PDEVICE_OBJECT NextDeviceObject;
74 UNICODE_STRING RegistryPath;
75 PKINTERRUPT InterruptObject;
76 KSPIN_LOCK InterruptSpinLock;
77 ULONG InterruptVector;
78 ULONG InterruptLevel;
79 ULONG AdapterInterfaceType;
80 ULONG SystemIoBusNumber;
81 ULONG SystemIoSlotNumber;
82 LIST_ENTRY AddressMappingListHead;
83 KDPC DpcObject;
84 VIDEO_PORT_DRIVER_EXTENSION *DriverExtension;
85 ULONG DeviceOpened;
86 CHAR MiniPortDeviceExtension[1];
87 } VIDEO_PORT_DEVICE_EXTENSION, *PVIDEO_PORT_DEVICE_EXTENSION;
88
89 #define VIDEO_PORT_GET_DEVICE_EXTENSION(MiniportExtension) \
90 CONTAINING_RECORD( \
91 HwDeviceExtension, \
92 VIDEO_PORT_DEVICE_EXTENSION, \
93 MiniPortDeviceExtension)
94
95 /* dispatch.c */
96
97 NTSTATUS STDCALL
98 IntVideoPortAddDevice(
99 IN PDRIVER_OBJECT DriverObject,
100 IN PDEVICE_OBJECT PhysicalDeviceObject);
101
102 NTSTATUS STDCALL
103 IntVideoPortDispatchOpen(
104 IN PDEVICE_OBJECT DeviceObject,
105 IN PIRP Irp);
106
107 NTSTATUS STDCALL
108 IntVideoPortDispatchClose(
109 IN PDEVICE_OBJECT DeviceObject,
110 IN PIRP Irp);
111
112 NTSTATUS STDCALL
113 IntVideoPortDispatchCleanup(
114 IN PDEVICE_OBJECT DeviceObject,
115 IN PIRP Irp);
116
117 NTSTATUS STDCALL
118 IntVideoPortDispatchDeviceControl(
119 IN PDEVICE_OBJECT DeviceObject,
120 IN PIRP Irp);
121
122 NTSTATUS STDCALL
123 IntVideoPortDispatchPnp(
124 IN PDEVICE_OBJECT DeviceObject,
125 IN PIRP Irp);
126
127 NTSTATUS STDCALL
128 IntVideoPortDispatchPower(
129 IN PDEVICE_OBJECT DeviceObject,
130 IN PIRP Irp);
131
132 VOID STDCALL
133 IntVideoPortUnload(PDRIVER_OBJECT DriverObject);
134
135 /* timer.c */
136
137 BOOLEAN STDCALL
138 IntVideoPortSetupTimer(
139 IN PDEVICE_OBJECT DeviceObject,
140 IN PVIDEO_PORT_DRIVER_EXTENSION DriverExtension);
141
142 /* interrupt.c */
143
144 BOOLEAN STDCALL
145 IntVideoPortSetupInterrupt(
146 IN PDEVICE_OBJECT DeviceObject,
147 IN PVIDEO_PORT_DRIVER_EXTENSION DriverExtension,
148 IN PVIDEO_PORT_CONFIG_INFO ConfigInfo);
149
150 /* videoprt.c */
151
152 extern ULONG CsrssInitialized;
153 extern PEPROCESS Csrss;
154
155 PVOID STDCALL
156 VideoPortGetProcAddress(
157 IN PVOID HwDeviceExtension,
158 IN PUCHAR FunctionName);
159
160 VOID FASTCALL
161 IntAttachToCSRSS(PEPROCESS *CallingProcess, PEPROCESS *PrevAttachedProcess);
162
163 VOID FASTCALL
164 IntDetachFromCSRSS(PEPROCESS *CallingProcess, PEPROCESS *PrevAttachedProcess);
165
166 NTSTATUS STDCALL
167 IntVideoPortFindAdapter(
168 IN PDRIVER_OBJECT DriverObject,
169 IN PVIDEO_PORT_DRIVER_EXTENSION DriverExtension,
170 IN PDEVICE_OBJECT PhysicalDeviceObject);
171
172 /* int10.c */
173
174 VP_STATUS STDCALL
175 IntInt10AllocateBuffer(
176 IN PVOID Context,
177 OUT PUSHORT Seg,
178 OUT PUSHORT Off,
179 IN OUT PULONG Length);
180
181 VP_STATUS STDCALL
182 IntInt10FreeBuffer(
183 IN PVOID Context,
184 IN USHORT Seg,
185 IN USHORT Off);
186
187 VP_STATUS STDCALL
188 IntInt10ReadMemory(
189 IN PVOID Context,
190 IN USHORT Seg,
191 IN USHORT Off,
192 OUT PVOID Buffer,
193 IN ULONG Length);
194
195 VP_STATUS STDCALL
196 IntInt10WriteMemory(
197 IN PVOID Context,
198 IN USHORT Seg,
199 IN USHORT Off,
200 IN PVOID Buffer,
201 IN ULONG Length);
202
203 VP_STATUS STDCALL
204 IntInt10CallBios(
205 IN PVOID Context,
206 IN OUT PINT10_BIOS_ARGUMENTS BiosArguments);
207
208 VP_STATUS STDCALL
209 VideoPortInt10(
210 IN PVOID HwDeviceExtension,
211 IN PVIDEO_X86_BIOS_ARGUMENTS BiosArguments);
212
213 #endif /* VIDEOPRT_H */