Chameleon

Chameleon Svn Source Tree

Root/branches/azimutz/Chazi/i386/libsaio/vbe.h

1/*
2 * Copyright (c) 1999-2003 Apple Computer, Inc. All rights reserved.
3 *
4 * @APPLE_LICENSE_HEADER_START@
5 *
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
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//#include "edid.h"//Azi:autoresolution <-- included in
39#include "autoresolution.h"
40
41#define MIN_VESA_VERSION 0x200
42
43#define SEG(address) \
44 ((unsigned short)(((unsigned long)address & 0xffff0000) >> 4))
45
46#define OFF(address) \
47 ((unsigned short)((unsigned long)address & 0x0000ffff))
48
49#define VBEMakeUInt32(x) \
50 (((unsigned long)x##_high << 24) | \
51 ((unsigned long)x##_2 << 16) | \
52 ((unsigned long)x##_1 << 8) | \
53 (unsigned long)x##_low)
54
55#define VBEDecodeFP(t, fp) \
56 ((t)(((fp ## _low) | ((fp ## _1 ) << 8)) + \
57 (((fp ## _2) << 4) | ((fp ## _high ) << 12))))
58
59/*
60 * Functions
61 */
62enum {
63 funcGetControllerInfo = 0x4F00,
64 funcGetModeInfo = 0x4F01,
65 funcSetMode = 0x4F02,
66 funcGetCurrentMode = 0x4F03,
67 funcSaveRestoreState = 0x4F04,
68 funcWindowControl = 0x4F05,
69 funcGetSetScanLineLength = 0x4F06,
70 funcGetSetDisplayStart = 0x4F07,
71 funcGetSetPaletteFormat = 0x4F08,
72 funcGetSetPaletteData = 0x4F09,
73 funcGetProtModeInterdace = 0x4F0A,
74 funcGetSetPixelClock = 0x4F0B
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[236];
117 unsigned char OEMData[256];
118} VBEInfoBlock;
119
120/*
121 * Capabilites
122 */
123enum {
124 capDACWidthIsSwitchableBit = (1 << 0), /* 1 = yes; 0 = no */
125 capControllerIsNotVGACompatableBit = (1 << 1), /* 1 = no; 0 = yes */
126 capOldRAMDAC = (1 << 2) /* 1 = yes; 0 = no */
127};
128
129/*
130 * Per-mode info, returned in function 4f02.
131 */
132typedef struct {
133 unsigned short ModeAttributes;
134 unsigned char WinAAttributes;
135 unsigned char WinBAttributes;
136 unsigned short WinGranularity;
137 unsigned short WinSize;
138 unsigned short WinASegment;
139 unsigned short WinABegment;
140 void * WinFuncPtr;
141 unsigned short BytesPerScanline;
142 unsigned short XResolution;
143 unsigned short YResolution;
144 unsigned char XCharSize;
145 unsigned char YCharSize;
146 unsigned char NumberOfPlanes;
147 unsigned char BitsPerPixel;
148 unsigned char NumberOfBanks;
149 unsigned char MemoryModel;
150 unsigned char BankSize;
151 unsigned char NumberOfImagePages;
152 unsigned char Reserved;
153 unsigned char RedMaskSize;
154 unsigned char RedFieldPosition;
155 unsigned char GreenMaskSize;
156 unsigned char GreenFieldPosition;
157 unsigned char BlueMaskSize;
158 unsigned char BlueFieldPosition;
159 unsigned char RsvdMaskSize;
160 unsigned char RsvdFieldPosition;
161 unsigned char DirectColorModeInfo;
162 unsigned char PhysBasePtr_low;
163 unsigned char PhysBasePtr_1;
164 unsigned char PhysBasePtr_2;
165 unsigned char PhysBasePtr_high;
166 void * OffScreenMemOffset;
167 unsigned short OffScreenMemSize;
168 unsigned char Reserved1[206];
169} VBEModeInfoBlock;
170
171/*
172 * ModeAttributes bits
173 */
174enum {
175 maModeIsSupportedBit = (1 << 0), /* mode is supported */
176 maExtendedInfoAvailableBit = (1 << 1), /* extended info available */
177 maOutputFuncSupportedBit = (1 << 2), /* output functions supported */
178 maColorModeBit = (1 << 3), /* 1 = color; 0 = mono */
179 maGraphicsModeBit = (1 << 4), /* 1 = graphics; 0 = text */
180 maModeIsNotVGACompatableBit = (1 << 5), /* 1 = not compat; 0 = compat */
181 maVGAMemoryModeNotAvailBit = (1 << 6), /* 1 = not avail; 0 = avail */
182 maLinearFrameBufferAvailBit = (1 << 7) /* 1 = avail; 0 = not avail */
183};
184
185/*
186 * Modes
187 */
188enum {
189 mode640x400x256 = 0x100,
190 mode640x480x256 = 0x101,
191 mode800x600x16 = 0x102,
192 mode800x600x256 = 0x103,
193 mode1024x768x16 = 0x104,
194 mode1024x768x256 = 0x105,
195 mode1280x1024x16 = 0x106,
196 mode1280x1024x256 = 0x107,
197 mode80Cx60R = 0x108,
198 mode132Cx25R = 0x109,
199 mode132Cx43R = 0x10A,
200 mode132Cx50R = 0x10B,
201 mode132Cx60R = 0x10C,
202 mode320x200x555 = 0x10D,
203 mode320x200x565 = 0x10E,
204 mode320x200x888 = 0x10F,
205 mode640x480x555 = 0x110,
206 mode640x480x565 = 0x111,
207 mode640x480x888 = 0x112,
208 mode800x600x555 = 0x113,
209 mode800x600x565 = 0x114,
210 mode800x600x888 = 0x115,
211 mode1024x768x555 = 0x116,
212 mode1024x768x565 = 0x117,
213 mode1024x768x888 = 0x118,
214 mode1280x1024x555 = 0x119,
215 mode1280x1024x565 = 0x11A,
216 mode1280x1024x888 = 0x11B,
217 modeSpecial = 0x81FF,
218 modeEndOfList = 0xFFFF
219};
220
221/*
222 * Get/Set VBE Mode parameters
223 */
224enum {
225 kCustomRefreshRateBit = (1 << 11),
226 kLinearFrameBufferBit = (1 << 14),
227 kPreserveMemoryBit = (1 << 15)
228};
229
230/*
231 * CRTC information block passed to function 4F02
232 * to override default refresh rate.
233 */
234#pragma pack(1)
235
236typedef struct {
237 unsigned short HTotal;
238 unsigned short HSyncStart;
239 unsigned short HSyncEnd;
240 unsigned short VTotal;
241 unsigned short VSyncStart;
242 unsigned short VSyncEnd;
243 unsigned char Flags;
244 unsigned long PixelClock; /* in Hz */
245 unsigned short RefreshRate; /* units of 0.01 Hz */
246 unsigned char Reserved[40];
247} VBECRTCInfoBlock;
248
249#pragma pack()
250
251/*
252 * Defined flags for 'Flags' field in VBECRTCInfoBlock.
253 */
254enum {
255 kCRTCDoubleScannedMode = (1 << 0),
256 kCRTCInterlacedMode = (1 << 1),
257 kCRTCNegativeHorizontalSync = (1 << 2),
258 kCRTCNegativeVerticalSync = (1 << 3)
259};
260
261/*
262 * The type of paramter passed to generateCRTCTimings().
263 */
264enum {
265 kCRTCParamRefreshRate,
266 kCRTCParamPixelClock
267};
268
269/*
270 * Palette
271 */
272typedef unsigned long VBEPalette[256];
273
274/*
275 * DDC - AutoResolution
276 */
277extern int getEDID(void *ddcblock, uint8_t blocksleft);
278
279extern int getVBEInfo(void *vinfo_p);
280extern int getVBEModeInfo(int mode, void *minfo_p);
281extern int getVBEDACFormat(unsigned char *format);
282extern int setVBEDACFormat(unsigned char format);
283extern int setVBEPalette(void *palette);
284extern int getVBEPalette(void *palette);
285extern int setVBEMode(unsigned short mode, const VBECRTCInfoBlock *timing);
286extern int getVBECurrentMode(unsigned short *mode);
287extern int getVBEPixelClock(unsigned short mode, unsigned long *pixelClock);
288extern int generateCRTCTiming(unsigned short width,
289 unsigned short height,
290 unsigned long paramValue,
291 int paramType,
292 VBECRTCInfoBlock * timing);
293
294#endif /* !__LIBSAIO_VBE_H */
295

Archive Download this file

Revision: 515