2 * Copyright (c) 1999-2003 Apple Computer, Inc. All rights reserved.
4 * @APPLE_LICENSE_HEADER_START@
6 * Portions Copyright (c) 1999-2003 Apple Computer, Inc. All Rights
7 * Reserved. This file contains Original Code and/or Modifications of
8 * Original Code as defined in and that are subject to the Apple Public
9 * Source License Version 2.0 (the "License"). You may not use this file
10 * except in compliance with the License. Please obtain a copy of the
11 * License at http://www.apple.com/publicsource and read it before using
14 * The Original Code and all software distributed under the License are
15 * distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY KIND, EITHER
16 * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
17 * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
18 * FITNESS FOR A PARTICULAR PURPOSE OR NON- INFRINGEMENT. Please see the
19 * License for the specific language governing rights and limitations
22 * @APPLE_LICENSE_HEADER_END@
24 // Copyright 1997 by Apple Computer, Inc., all rights reserved.
25 /* Copyright 1996-1997 NeXT Software, Inc.
27 * vesa.h - mode info obtained via int10
31 * 30 Jul 1996 Doug Mitchell at NeXT
35 #ifndef __LIBSAIO_VBE_H
36 #define __LIBSAIO_VBE_H
38 #define MIN_VESA_VERSION 0x200
40 #define SEG(address) \
41 ((unsigned short)(((unsigned long)address & 0xffff0000) >> 4))
43 #define OFF(address) \
44 ((unsigned short)((unsigned long)address & 0x0000ffff))
46 #define VBEMakeUInt32(x) \
47 (((unsigned long)x##_high << 24) | \
48 ((unsigned long)x##_2 << 16) | \
49 ((unsigned long)x##_1 << 8) | \
50 (unsigned long)x##_low)
52 #define VBEDecodeFP(t, fp) \
53 ((t)(((fp ## _low) | ((fp ## _1 ) << 8)) + \
54 (((fp ## _2) << 4) | ((fp ## _high ) << 12))))
60 funcGetControllerInfo
= 0x4F00,
61 funcGetModeInfo
= 0x4F01,
63 funcGetCurrentMode
= 0x4F03,
64 funcSaveRestoreState
= 0x4F04,
65 funcWindowControl
= 0x4F05,
66 funcGetSetScanLineLength
= 0x4F06,
67 funcGetSetDisplayStart
= 0x4F07,
68 funcGetSetPaletteFormat
= 0x4F08,
69 funcGetSetPaletteData
= 0x4F09,
70 funcGetProtModeInterdace
= 0x4F0A,
71 funcGetSetPixelClock
= 0x4F0B
77 subfuncSetSecondary
= 0x02,
78 subfuncGetSecondary
= 0x03
87 errFuncNotSupported
= 2,
92 * Per-controller info, returned in function 4f00.
95 unsigned char VESASignature
[4];
96 unsigned short VESAVersion
;
98 * Avoid packing problem...
100 unsigned char OEMStringPtr_low
;
101 unsigned char OEMStringPtr_1
;
102 unsigned char OEMStringPtr_2
;
103 unsigned char OEMStringPtr_high
;
104 unsigned char Capabilities_low
;
105 unsigned char Capabilities_1
;
106 unsigned char Capabilities_2
;
107 unsigned char Capabilities_high
;
108 unsigned char VideoModePtr_low
;
109 unsigned char VideoModePtr_1
;
110 unsigned char VideoModePtr_2
;
111 unsigned char VideoModePtr_high
;
112 unsigned short TotalMemory
;
113 unsigned char Reserved
[242];
120 capDACWidthIsSwitchableBit
= (1 << 0), /* 1 = yes; 0 = no */
121 capControllerIsNotVGACompatableBit
= (1 << 1), /* 1 = no; 0 = yes */
122 capOldRAMDAC
= (1 << 2) /* 1 = yes; 0 = no */
126 * Per-mode info, returned in function 4f02.
129 unsigned short ModeAttributes
;
130 unsigned char WinAAttributes
;
131 unsigned char WinBAttributes
;
132 unsigned short WinGranularity
;
133 unsigned short WinSize
;
134 unsigned short WinASegment
;
135 unsigned short WinABegment
;
137 unsigned short BytesPerScanline
;
138 unsigned short XResolution
;
139 unsigned short YResolution
;
140 unsigned char XCharSize
;
141 unsigned char YCharSize
;
142 unsigned char NumberOfPlanes
;
143 unsigned char BitsPerPixel
;
144 unsigned char NumberOfBanks
;
145 unsigned char MemoryModel
;
146 unsigned char BankSize
;
147 unsigned char NumberOfImagePages
;
148 unsigned char Reserved
;
149 unsigned char RedMaskSize
;
150 unsigned char RedFieldPosition
;
151 unsigned char GreenMaskSize
;
152 unsigned char GreenFieldPosition
;
153 unsigned char BlueMaskSize
;
154 unsigned char BlueFieldPosition
;
155 unsigned char RsvdMaskSize
;
156 unsigned char RsvdFieldPosition
;
157 unsigned char DirectColorModeInfo
;
158 unsigned char PhysBasePtr_low
;
159 unsigned char PhysBasePtr_1
;
160 unsigned char PhysBasePtr_2
;
161 unsigned char PhysBasePtr_high
;
162 void * OffScreenMemOffset
;
163 unsigned short OffScreenMemSize
;
164 unsigned char Reserved1
[206];
168 * ModeAttributes bits
171 maModeIsSupportedBit
= (1 << 0), /* mode is supported */
172 maExtendedInfoAvailableBit
= (1 << 1), /* extended info available */
173 maOutputFuncSupportedBit
= (1 << 2), /* output functions supported */
174 maColorModeBit
= (1 << 3), /* 1 = color; 0 = mono */
175 maGraphicsModeBit
= (1 << 4), /* 1 = graphics; 0 = text */
176 maModeIsNotVGACompatableBit
= (1 << 5), /* 1 = not compat; 0 = compat */
177 maVGAMemoryModeNotAvailBit
= (1 << 6), /* 1 = not avail; 0 = avail */
178 maLinearFrameBufferAvailBit
= (1 << 7) /* 1 = avail; 0 = not avail */
185 mode640x400x256
= 0x100,
186 mode640x480x256
= 0x101,
187 mode800x600x16
= 0x102,
188 mode800x600x256
= 0x103,
189 mode1024x768x16
= 0x104,
190 mode1024x768x256
= 0x105,
191 mode1280x1024x16
= 0x106,
192 mode1280x1024x256
= 0x107,
194 mode132Cx25R
= 0x109,
195 mode132Cx43R
= 0x10A,
196 mode132Cx50R
= 0x10B,
197 mode132Cx60R
= 0x10C,
198 mode320x200x555
= 0x10D,
199 mode320x200x565
= 0x10E,
200 mode320x200x888
= 0x10F,
201 mode640x480x555
= 0x110,
202 mode640x480x565
= 0x111,
203 mode640x480x888
= 0x112,
204 mode800x600x555
= 0x113,
205 mode800x600x565
= 0x114,
206 mode800x600x888
= 0x115,
207 mode1024x768x555
= 0x116,
208 mode1024x768x565
= 0x117,
209 mode1024x768x888
= 0x118,
210 mode1280x1024x555
= 0x119,
211 mode1280x1024x565
= 0x11A,
212 mode1280x1024x888
= 0x11B,
213 modeSpecial
= 0x81FF,
214 modeEndOfList
= 0xFFFF
218 * Get/Set VBE Mode parameters
221 kCustomRefreshRateBit
= (1 << 11),
222 kLinearFrameBufferBit
= (1 << 14),
223 kPreserveMemoryBit
= (1 << 15)
227 * CRTC information block passed to function 4F02
228 * to override default refresh rate.
233 unsigned short HTotal
;
234 unsigned short HSyncStart
;
235 unsigned short HSyncEnd
;
236 unsigned short VTotal
;
237 unsigned short VSyncStart
;
238 unsigned short VSyncEnd
;
240 unsigned long PixelClock
; /* in Hz */
241 unsigned short RefreshRate
; /* units of 0.01 Hz */
242 unsigned char Reserved
[40];
248 * Defined flags for 'Flags' field in VBECRTCInfoBlock.
251 kCRTCDoubleScannedMode
= (1 << 0),
252 kCRTCInterlacedMode
= (1 << 1),
253 kCRTCNegativeHorizontalSync
= (1 << 2),
254 kCRTCNegativeVerticalSync
= (1 << 3)
258 * The type of paramter passed to generateCRTCTimings().
261 kCRTCParamRefreshRate
,
268 typedef unsigned long VBEPalette
[256];
270 extern int getVBEInfo(void *vinfo_p
);
271 extern int getVBEModeInfo(int mode
, void *minfo_p
);
272 extern int getVBEDACFormat(unsigned char *format
);
273 extern int setVBEDACFormat(unsigned char format
);
274 extern int setVBEPalette(void *palette
);
275 extern int getVBEPalette(void *palette
);
276 extern int setVBEMode(unsigned short mode
, const VBECRTCInfoBlock
*timing
);
277 extern int getVBECurrentMode(unsigned short *mode
);
278 extern int getVBEPixelClock(unsigned short mode
, unsigned long *pixelClock
);
279 extern int generateCRTCTiming(unsigned short width
,
280 unsigned short height
,
281 unsigned long paramValue
,
283 VBECRTCInfoBlock
* timing
);
285 #endif /* !__LIBSAIO_VBE_H */