]> git.saurik.com Git - apple/boot.git/blame - i386/libsaio/vbe.h
boot-80.1.tar.gz
[apple/boot.git] / i386 / libsaio / vbe.h
CommitLineData
14c7c974
A
1/*
2 * Copyright (c) 1999 Apple Computer, Inc. All rights reserved.
3 *
4 * @APPLE_LICENSE_HEADER_START@
5 *
6 * Portions Copyright (c) 1999 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 1.1 (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
12 * this file.
13 *
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
20 * under the License.
21 *
22 * @APPLE_LICENSE_HEADER_END@
23 */
24// Copyright 1997 by Apple Computer, Inc., all rights reserved.
25/* Copyright 1996-1997 NeXT Software, Inc.
26 *
27 * vesa.h - mode info obtained via int10
28 *
29 * Revision History
30 * ----------------
31 * 30 Jul 1996 Doug Mitchell at NeXT
32 * Created.
33 */
34
35#ifndef __LIBSAIO_VBE_H
36#define __LIBSAIO_VBE_H
37
38/*
39 * Graphics mode settings.
40 */
41extern BOOL in_linear_mode;
42extern unsigned char * frame_buffer;
43extern unsigned short screen_width;
44extern unsigned short screen_height;
45extern unsigned char bits_per_pixel;
46extern unsigned short screen_rowbytes;
47
48#define MIN_VESA_VERSION 0x200
49
50#define SEG(address) \
51 ((unsigned short)(((unsigned long)address & 0xffff0000) >> 4))
52#define OFF(address) ((unsigned short)((unsigned long)address & 0x0000ffff))
53#define RTOV(low, one, two, high) \
54 (((unsigned long)high << 12) | ((unsigned long)one << 8) | \
55 (unsigned long)low)
56#define ADDRESS(low, one, two, high) \
57 (((unsigned long)high << 24) | ((unsigned long)two << 16) | \
58 ((unsigned long)one << 8) | (unsigned long)low)
59
60/*
61 * Functions
62 */
63enum {
64 funcGetControllerInfo = 0x4F00,
65 funcGetModeInfo = 0x4F01,
66 funcSetMode = 0x4F02,
67 funcGetCurrentMode = 0x4F03,
68 funcSaveRestoreState = 0x4F04,
69 funcWindowControl = 0x4F05,
70 funcGetSetScanLineLength = 0x4F06,
71 funcGetSetDisplayStart = 0x4F07,
72 funcGetSetPaletteFormat = 0x4F08,
73 funcGetSetPaletteData = 0x4F09,
74 funcGetProtModeInterdace = 0x4F0A
75};
76
77enum {
78 subfuncSet = 0x00,
79 subfuncGet = 0x01,
80 subfuncSetSecondary = 0x02,
81 subfuncGetSecondary = 0x03
82};
83
84/*
85 * errors.
86 */
87enum {
88 errSuccess = 0,
89 errFuncFailed = 1,
90 errFuncNotSupported = 2,
91 errFuncInvalid = 3
92};
93
94/*
95 * Per-controller info, returned in function 4f00.
96 */
97typedef struct {
98 unsigned char VESASignature[4];
99 unsigned short VESAVersion;
100 /*
101 * Avoid packing problem...
102 */
103 unsigned char OEMStringPtr_low;
104 unsigned char OEMStringPtr_1;
105 unsigned char OEMStringPtr_2;
106 unsigned char OEMStringPtr_high;
107 unsigned char Capabilities_low;
108 unsigned char Capabilities_1;
109 unsigned char Capabilities_2;
110 unsigned char Capabilities_high;
111 unsigned char VideoModePtr_low;
112 unsigned char VideoModePtr_1;
113 unsigned char VideoModePtr_2;
114 unsigned char VideoModePtr_high;
115 unsigned short TotalMemory;
116 unsigned char Reserved[242];
117} VBEInfoBlock;
118
119/*
120 * Capabilites
121 */
122enum {
123 capDACWidthIsSwitchableBit = (1 << 0), /* 1 = yes; 0 = no */
124 capControllerIsNotVGACompatableBit = (1 << 1), /* 1 = no; 0 = yes */
125 capOldRAMDAC = (1 << 2) /* 1 = yes; 0 = no */
126};
127
128/*
129 * Per-mode info, returned in function 4f02.
130 */
131typedef struct {
132 unsigned short ModeAttributes;
133 unsigned char WinAAttributes;
134 unsigned char WinBAttributes;
135 unsigned short WinGranularity;
136 unsigned short WinSize;
137 unsigned short WinASegment;
138 unsigned short WinABegment;
139 void * WinFuncPtr;
140 unsigned short BytesPerScanline;
141 unsigned short XResolution;
142 unsigned short YResolution;
143 unsigned char XCharSize;
144 unsigned char YCharSize;
145 unsigned char NumberOfPlanes;
146 unsigned char BitsPerPixel;
147 unsigned char NumberOfBanks;
148 unsigned char MemoryModel;
149 unsigned char BankSize;
150 unsigned char NumberOfImagePages;
151 unsigned char Reserved;
152 unsigned char RedMaskSize;
153 unsigned char RedFieldPosition;
154 unsigned char GreenMaskSize;
155 unsigned char GreenFieldPosition;
156 unsigned char BlueMaskSize;
157 unsigned char BlueFieldPosition;
158 unsigned char RsvdMaskSize;
159 unsigned char RsvdFieldPosition;
160 unsigned char DirectColorModeInfo;
161 unsigned char PhysBasePtr_low;
162 unsigned char PhysBasePtr_1;
163 unsigned char PhysBasePtr_2;
164 unsigned char PhysBasePtr_high;
165 void * OffScreenMemOffset;
166 unsigned short OffScreenMemSize;
167 unsigned char Reserved1[206];
168} VBEModeInfoBlock;
169
170/*
171 * ModeAttributes bits
172 */
173enum {
174 maModeIsSupportedBit = (1 << 0), /* mode is supported */
175 maExtendedInfoAvailableBit = (1 << 1), /* extended info available */
176 maOutputFuncSupportedBit = (1 << 2), /* output functions supported */
177 maColorModeBit = (1 << 3), /* 1 = color; 0 = mono */
178 maGraphicsModeBit = (1 << 4), /* 1 = graphics; 0 = text */
179 maModeIsNotVGACompatableBit = (1 << 5), /* 1 = not compat; 0 = compat */
180 maVGAMemoryModeNotAvailBit = (1 << 6), /* 1 = not avail; 0 = avail */
181 maLinearFrameBufferAvailBit = (1 << 7) /* 1 = avail; 0 = not avail */
182};
183
184/*
185 * Modes
186 */
187enum {
188 mode640x400x256 = 0x100,
189 mode640x480x256 = 0x101,
190 mode800x600x16 = 0x102,
191 mode800x600x256 = 0x103,
192 mode1024x768x16 = 0x104,
193 mode1024x768x256 = 0x105,
194 mode1280x1024x16 = 0x106,
195 mode1280x1024x256 = 0x107,
196 mode80Cx60R = 0x108,
197 mode132Cx25R = 0x109,
198 mode132Cx43R = 0x10A,
199 mode132Cx50R = 0x10B,
200 mode132Cx60R = 0x10C,
201 mode320x200x555 = 0x10D,
202 mode320x200x565 = 0x10E,
203 mode320x200x888 = 0x10F,
204 mode640x480x555 = 0x110,
205 mode640x480x565 = 0x111,
206 mode640x480x888 = 0x112,
207 mode800x600x555 = 0x113,
208 mode800x600x565 = 0x114,
209 mode800x600x888 = 0x115,
210 mode1024x768x555 = 0x116,
211 mode1024x768x565 = 0x117,
212 mode1024x768x888 = 0x118,
213 mode1280x1024x555 = 0x119,
214 mode1280x1024x565 = 0x11A,
215 mode1280x1024x888 = 0x11B,
216 modeSpecial = 0x81FF
217};
218
219/*
220 * Get/Set VBE Mode parameters
221 */
222enum {
223 kLinearFrameBufferBit = (1 << 14),
224 kPreserveMemoryBit = (1 << 15)
225};
226
227/*
228 * Palette
229 */
230typedef unsigned long VBEPalette[256];
231
232extern int getVBEInfo(void *vinfo_p);
233extern int getVBEModeInfo(int mode, void *minfo_p);
234extern int getVBEDACFormat(unsigned char *format);
235extern int setVBEDACFormat(unsigned char format);
236extern int setVBEPalette(void *palette);
237extern int getVBEPalette(void *palette);
238extern int setVBEMode(unsigned short mode);
239extern int getVBECurrentMode(unsigned short *mode);
240
241#endif /* !__LIBSAIO_VBE_H */