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