- Make VBEMP compile with msvc/ddk.
[reactos.git] / reactos / drivers / video / miniport / vbe / vbemp.h
1 /*
2 * ReactOS VBE miniport video driver
3 *
4 * Copyright (C) 2004 Filip Navara
5 *
6 * This program is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU General Public License
8 * as published by the Free Software Foundation; either version 2
9 * of the License, or (at your option) any later version.
10 *
11 * This program 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
14 * GNU General Public License for more details.
15 *
16 * You should have received a copy of the GNU General Public License
17 * along with this program; if not, write to the Free Software
18 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
19 */
20
21 #ifndef VBEMP_H
22 #define VBEMP_H
23
24 /* INCLUDES *******************************************************************/
25
26 #ifdef _MSC_VER
27 #include "dderror.h"
28 #include "devioctl.h"
29 #else
30 #include <ntddk.h>
31 #endif
32
33 #include "miniport.h"
34 #include "ntddvdeo.h"
35 #include "video.h"
36
37 #define TAG(A, B, C, D) (ULONG)(((A)<<0) + ((B)<<8) + ((C)<<16) + ((D)<<24))
38 #define TAG_VBE TAG('V', 'B', 'E', ' ')
39
40 /*
41 * Compile-time define to get VBE 1.2 support. The implementation
42 * is far from complete now and so it's left undefined.
43 */
44
45 /* #define VBE12_SUPPORT */
46
47 #include <pshpack1.h>
48
49 /*
50 * VBE Command Definitions
51 */
52
53 #define VBE_GET_CONTROLLER_INFORMATION 0x4F00
54 #define VBE_GET_MODE_INFORMATION 0x4F01
55 #define VBE_SET_VBE_MODE 0x4F02
56 #define VBE_GET_CURRENT_VBE_MODE 0x4F03
57 #define VBE_SAVE_RESTORE_STATE 0x4F04
58 #define VBE_DISPLAY_WINDOW_CONTROL 0x4F05
59 #define VBE_SET_GET_LOGICAL_SCAN_LINE_LENGTH 0x4F06
60 #define VBE_SET_GET_DISPLAY_START 0x4F07
61 #define VBE_SET_GET_DAC_PALETTE_FORMAT 0x4F08
62 #define VBE_SET_GET_PALETTE_DATA 0x4F09
63
64 /* VBE 2.0+ */
65 #define VBE_RETURN_PROTECTED_MODE_INTERFACE 0x4F0A
66 #define VBE_GET_SET_PIXEL_CLOCK 0x4F0B
67
68 /* Extensions */
69 #define VBE_POWER_MANAGEMENT_EXTENSIONS 0x4F10
70 #define VBE_FLAT_PANEL_INTERFACE_EXTENSIONS 0x4F11
71 #define VBE_AUDIO_INTERFACE_EXTENSIONS 0x4F12
72 #define VBE_OEM_EXTENSIONS 0x4F13
73 #define VBE_DISPLAY_DATA_CHANNEL 0x4F14
74
75 /*
76 * VBE Video Mode Information Definitions
77 */
78
79 #define VBE_MODEATTR_LINEAR 0x80
80
81 #define VBE_MEMORYMODEL_PACKEDPIXEL 0x04
82 #define VBE_MEMORYMODEL_DIRECTCOLOR 0x06
83
84 /*
85 * VBE Return Codes
86 */
87
88 #define VBE_SUCCESS 0x4F
89 #define VBE_UNSUCCESSFUL 0x14F
90 #define VBE_NOT_SUPPORTED 0x24F
91 #define VBE_FUNCTION_INVALID 0x34F
92
93 /*
94 * VBE specification defined structure for general adapter info
95 * returned by function VBE_GET_CONTROLLER_INFORMATION command.
96 */
97
98 typedef struct
99 {
100 CHAR Signature[4];
101 USHORT Version;
102 ULONG OemStringPtr;
103 LONG Capabilities;
104 ULONG VideoModePtr;
105 USHORT TotalMemory;
106 USHORT OemSoftwareRevision;
107 ULONG OemVendorNamePtr;
108 ULONG OemProductNamePtr;
109 ULONG OemProductRevPtr;
110 CHAR Reserved[222];
111 CHAR OemData[256];
112 } VBE_INFO, *PVBE_INFO;
113
114 /*
115 * VBE specification defined structure for specific video mode
116 * info returned by function VBE_GET_MODE_INFORMATION command.
117 */
118
119 typedef struct
120 {
121 /* Mandatory information for all VBE revisions */
122 USHORT ModeAttributes;
123 UCHAR WinAAttributes;
124 UCHAR WinBAttributes;
125 USHORT WinGranularity;
126 USHORT WinSize;
127 USHORT WinASegment;
128 USHORT WinBSegment;
129 ULONG WinFuncPtr;
130 USHORT BytesPerScanLine;
131
132 /* Mandatory information for VBE 1.2 and above */
133 USHORT XResolution;
134 USHORT YResolution;
135 UCHAR XCharSize;
136 UCHAR YCharSize;
137 UCHAR NumberOfPlanes;
138 UCHAR BitsPerPixel;
139 UCHAR NumberOfBanks;
140 UCHAR MemoryModel;
141 UCHAR BankSize;
142 UCHAR NumberOfImagePages;
143 UCHAR Reserved1;
144
145 /* Direct Color fields (required for Direct/6 and YUV/7 memory models) */
146 UCHAR RedMaskSize;
147 UCHAR RedFieldPosition;
148 UCHAR GreenMaskSize;
149 UCHAR GreenFieldPosition;
150 UCHAR BlueMaskSize;
151 UCHAR BlueFieldPosition;
152 UCHAR ReservedMaskSize;
153 UCHAR ReservedFieldPosition;
154 UCHAR DirectColorModeInfo;
155
156 /* Mandatory information for VBE 2.0 and above */
157 ULONG PhysBasePtr;
158 ULONG Reserved2;
159 USHORT Reserved3;
160
161 /* Mandatory information for VBE 3.0 and above */
162 USHORT LinBytesPerScanLine;
163 UCHAR BnkNumberOfImagePages;
164 UCHAR LinNumberOfImagePages;
165 UCHAR LinRedMaskSize;
166 UCHAR LinRedFieldPosition;
167 UCHAR LinGreenMaskSize;
168 UCHAR LinGreenFieldPosition;
169 UCHAR LinBlueMaskSize;
170 UCHAR LinBlueFieldPosition;
171 UCHAR LinReservedMaskSize;
172 UCHAR LinReservedFieldPosition;
173 ULONG MaxPixelClock;
174
175 CHAR Reserved4[189];
176 } VBE_MODEINFO, *PVBE_MODEINFO;
177
178 #include <poppack.h>
179
180 typedef struct
181 {
182 /* Interface to Int10 calls */
183 VIDEO_PORT_INT10_INTERFACE Int10Interface;
184
185 /* Trampoline memory for communication with VBE real-mode interface */
186 USHORT TrampolineMemorySegment;
187 USHORT TrampolineMemoryOffset;
188
189 /* General controller/BIOS information */
190 VBE_INFO VbeInfo;
191
192 /* Saved information about video modes */
193 ULONG ModeCount;
194 USHORT *ModeNumbers;
195 PVBE_MODEINFO ModeInfo;
196 USHORT CurrentMode;
197 } VBE_DEVICE_EXTENSION, *PVBE_DEVICE_EXTENSION;
198
199 VP_STATUS STDCALL
200 VBEFindAdapter(
201 IN PVOID HwDeviceExtension,
202 IN PVOID HwContext,
203 IN PWSTR ArgumentString,
204 IN OUT PVIDEO_PORT_CONFIG_INFO ConfigInfo,
205 OUT PUCHAR Again);
206
207 BOOLEAN STDCALL
208 VBEInitialize(PVOID HwDeviceExtension);
209
210 BOOLEAN STDCALL
211 VBEStartIO(
212 PVOID HwDeviceExtension,
213 PVIDEO_REQUEST_PACKET RequestPacket);
214
215 BOOLEAN STDCALL
216 VBEResetHw(
217 PVOID DeviceExtension,
218 ULONG Columns,
219 ULONG Rows);
220
221 VP_STATUS STDCALL
222 VBEGetPowerState(
223 PVOID HwDeviceExtension,
224 ULONG HwId,
225 PVIDEO_POWER_MANAGEMENT VideoPowerControl);
226
227 VP_STATUS STDCALL
228 VBESetPowerState(
229 PVOID HwDeviceExtension,
230 ULONG HwId,
231 PVIDEO_POWER_MANAGEMENT VideoPowerControl);
232
233 BOOLEAN FASTCALL
234 VBESetCurrentMode(
235 PVBE_DEVICE_EXTENSION DeviceExtension,
236 PVIDEO_MODE RequestedMode,
237 PSTATUS_BLOCK StatusBlock);
238
239 BOOLEAN FASTCALL
240 VBEResetDevice(
241 PVBE_DEVICE_EXTENSION DeviceExtension,
242 PSTATUS_BLOCK StatusBlock);
243
244 BOOLEAN FASTCALL
245 VBEMapVideoMemory(
246 PVBE_DEVICE_EXTENSION DeviceExtension,
247 PVIDEO_MEMORY RequestedAddress,
248 PVIDEO_MEMORY_INFORMATION MapInformation,
249 PSTATUS_BLOCK StatusBlock);
250
251 BOOLEAN FASTCALL
252 VBEUnmapVideoMemory(
253 PVBE_DEVICE_EXTENSION DeviceExtension,
254 PVIDEO_MEMORY VideoMemory,
255 PSTATUS_BLOCK StatusBlock);
256
257 BOOLEAN FASTCALL
258 VBEQueryNumAvailModes(
259 PVBE_DEVICE_EXTENSION DeviceExtension,
260 PVIDEO_NUM_MODES Modes,
261 PSTATUS_BLOCK StatusBlock);
262
263 BOOLEAN FASTCALL
264 VBEQueryAvailModes(
265 PVBE_DEVICE_EXTENSION DeviceExtension,
266 PVIDEO_MODE_INFORMATION ReturnedModes,
267 PSTATUS_BLOCK StatusBlock);
268
269 BOOLEAN FASTCALL
270 VBEQueryCurrentMode(
271 PVBE_DEVICE_EXTENSION DeviceExtension,
272 PVIDEO_MODE_INFORMATION VideoModeInfo,
273 PSTATUS_BLOCK StatusBlock);
274
275 BOOLEAN FASTCALL
276 VBESetColorRegisters(
277 PVBE_DEVICE_EXTENSION DeviceExtension,
278 PVIDEO_CLUT ColorLookUpTable,
279 PSTATUS_BLOCK StatusBlock);
280
281 #endif /* VBEMP_H */