merge ROS Shell without integrated explorer part into trunk
[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 #ifdef DBG
35 #define DPRINT(arg) DbgPrint arg;
36 #else
37 #define DPRINT(arg)
38 #endif
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 WORD Version;
102 DWORD OemStringPtr;
103 LONG Capabilities;
104 DWORD VideoModePtr;
105 WORD TotalMemory;
106 WORD OemSoftwareRevision;
107 DWORD OemVendorNamePtr;
108 DWORD OemProductNamePtr;
109 DWORD 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 WORD ModeAttributes;
123 BYTE WinAAttributes;
124 BYTE WinBAttributes;
125 WORD WinGranularity;
126 WORD WinSize;
127 WORD WinASegment;
128 WORD WinBSegment;
129 DWORD WinFuncPtr;
130 WORD BytesPerScanLine;
131
132 /* Mandatory information for VBE 1.2 and above */
133 WORD XResolution;
134 WORD YResolution;
135 BYTE XCharSize;
136 BYTE YCharSize;
137 BYTE NumberOfPlanes;
138 BYTE BitsPerPixel;
139 BYTE NumberOfBanks;
140 BYTE MemoryModel;
141 BYTE BankSize;
142 BYTE NumberOfImagePages;
143 BYTE Reserved1;
144
145 /* Direct Color fields (required for Direct/6 and YUV/7 memory models) */
146 BYTE RedMaskSize;
147 BYTE RedFieldPosition;
148 BYTE GreenMaskSize;
149 BYTE GreenFieldPosition;
150 BYTE BlueMaskSize;
151 BYTE BlueFieldPosition;
152 BYTE ReservedMaskSize;
153 BYTE ReservedFieldPosition;
154 BYTE DirectColorModeInfo;
155
156 /* Mandatory information for VBE 2.0 and above */
157 DWORD PhysBasePtr;
158 DWORD Reserved2;
159 WORD Reserved3;
160
161 /* Mandatory information for VBE 3.0 and above */
162 WORD LinBytesPerScanLine;
163 BYTE BnkNumberOfImagePages;
164 BYTE LinNumberOfImagePages;
165 BYTE LinRedMaskSize;
166 BYTE LinRedFieldPosition;
167 BYTE LinGreenMaskSize;
168 BYTE LinGreenFieldPosition;
169 BYTE LinBlueMaskSize;
170 BYTE LinBlueFieldPosition;
171 BYTE LinReservedMaskSize;
172 BYTE LinReservedFieldPosition;
173 DWORD 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 WORD *ModeNumbers;
195 PVBE_MODEINFO ModeInfo;
196 WORD 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 BOOL FASTCALL
234 VBESetCurrentMode(
235 PVBE_DEVICE_EXTENSION DeviceExtension,
236 PVIDEO_MODE RequestedMode,
237 PSTATUS_BLOCK StatusBlock);
238
239 BOOL FASTCALL
240 VBEResetDevice(
241 PVBE_DEVICE_EXTENSION DeviceExtension,
242 PSTATUS_BLOCK StatusBlock);
243
244 BOOL FASTCALL
245 VBEMapVideoMemory(
246 PVBE_DEVICE_EXTENSION DeviceExtension,
247 PVIDEO_MEMORY RequestedAddress,
248 PVIDEO_MEMORY_INFORMATION MapInformation,
249 PSTATUS_BLOCK StatusBlock);
250
251 BOOL FASTCALL
252 VBEUnmapVideoMemory(
253 PVBE_DEVICE_EXTENSION DeviceExtension,
254 PVIDEO_MEMORY VideoMemory,
255 PSTATUS_BLOCK StatusBlock);
256
257 BOOL FASTCALL
258 VBEQueryNumAvailModes(
259 PVBE_DEVICE_EXTENSION DeviceExtension,
260 PVIDEO_NUM_MODES Modes,
261 PSTATUS_BLOCK StatusBlock);
262
263 BOOL FASTCALL
264 VBEQueryAvailModes(
265 PVBE_DEVICE_EXTENSION DeviceExtension,
266 PVIDEO_MODE_INFORMATION ReturnedModes,
267 PSTATUS_BLOCK StatusBlock);
268
269 BOOL FASTCALL
270 VBEQueryCurrentMode(
271 PVBE_DEVICE_EXTENSION DeviceExtension,
272 PVIDEO_MODE_INFORMATION VideoModeInfo,
273 PSTATUS_BLOCK StatusBlock);
274
275 BOOL FASTCALL
276 VBESetColorRegisters(
277 PVBE_DEVICE_EXTENSION DeviceExtension,
278 PVIDEO_CLUT ColorLookUpTable,
279 PSTATUS_BLOCK StatusBlock);
280
281 #endif /* VBEMP_H */