3 Copyright (C) 2006-2009 Jörg Pfähler
5 This program is free software; you can redistribute it and/or
6 modify it under the terms of the GNU General Public License
7 as published by the Free Software Foundation; either version 2
8 of the License, or (at your option) any later version.
10 This program is distributed in the hope that it will be useful,
11 but WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 GNU General Public License for more details.
15 You should have received a copy of the GNU General Public License
16 along with this program; if not, write to the Free Software
17 Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
19 #ifndef LIGHTOS_KERNEL_X86_VBE_HPP
20 #define LIGHTOS_KERNEL_X86_VBE_HPP
22 /*! \addtogroup kernel kernel */
24 /*! \addtogroup device device */
34 /*! The VESA BIOS Extensions */
38 /*! Information about a video mode */
41 /*! The width in pixel */
43 /*! The height in pixel */
45 /*! The bits per pixel */
47 /*! The address of the frame buffer */
50 /*! Get the vbe class instance */
51 inline static vbe
&instance(){if (inst
== 0)inst
= new vbe();return *inst
;}
52 /*! Get the major version */
53 unsigned int majorVersion() const{return major
;}
54 /*! Get the minor version */
55 unsigned int minorVersion() const{return minor
;}
57 const std::string
&oem() const{return oemName
;}
58 /*! Get the vendor name */
59 const std::string
&vendor() const{return vendorName
;}
60 /*! Get the product name */
61 const std::string
&product() const{return productName
;}
62 /*! Get the product revision */
63 const std::string
&revision() const{return productRevision
;}
64 /*! Get the number of available modes */
65 unsigned int modeCount() const{return modes
.size();}
66 /*! Get information about an mode */
67 bool getModeInfo(unsigned int index
, videoMode
&mode
) const;
68 /*! Set the video mode */
69 bool setMode(unsigned int index
);
71 /*! The VBE info structure */
75 unsigned short version
;
78 unsigned int videoMode
;
79 unsigned short totalMemory
;
80 unsigned short oemSoftwareRevision
;
81 unsigned int oemVendorName
;
82 unsigned int oemProductName
;
83 unsigned int oemProductRevision
;
84 unsigned char res
[222];
85 unsigned char oemData
[256];
86 }__attribute__((packed
));
87 /*! The VBE mode info structure */
90 unsigned short attributes
;
91 unsigned char winAAttributes
;
92 unsigned char winBAttributes
;
93 unsigned short winGranularity
;
94 unsigned short winSize
;
95 unsigned short winASegment
;
96 unsigned short winBSegment
;
98 unsigned short bytesPerScanline
;
99 unsigned short xResolution
;
100 unsigned short yResolution
;
101 unsigned char xCharSize
;
102 unsigned char yCharSize
;
103 unsigned char numberOfPlanes
;
104 unsigned char bitsPerPixel
;
105 unsigned char numberOfBanks
;
106 unsigned char memoryModel
;
107 unsigned char BankSize
;
108 unsigned char numberOfImagePages
;
110 unsigned char redMaskSize
;
111 unsigned char refFieldPosition
;
112 unsigned char greenMaskSize
;
113 unsigned char greenFieldPosition
;
114 unsigned char blueMaskSize
;
115 unsigned char blueFieldPosition
;
116 unsigned char rsvdMaskSize
;
117 unsigned char rsvdFieldPosition
;
118 unsigned char directColorModeInfo
;
119 unsigned int physicalBase
;
120 unsigned int offscreenMemOffset
;
121 unsigned short offscreenMemSize
;
122 unsigned char res2
[206];
123 }__attribute__((packed
));
124 /*! The constructor */
126 /*! The destructor */
128 /*! The vbe instance */
130 /*! The VBE major version */
132 /*! The VBE minor version */
134 /*! The video memory size */
139 std::string vendorName
;
141 std::string productName
;
142 /*! The product revision */
143 std::string productRevision
;
144 /*! List of available modes */
145 std::vector
<unsigned short> modes
;
146 /*! Information on the available modes */
147 std::vector
<modeInfo
*> modesInfo
;