UbixOS V2 2.0

ogDisplay_UbixOS.h
Go to the documentation of this file.
1 /*-
2 * Copyright (c) 2002-2018 The UbixOS Project.
3 * All rights reserved.
4 *
5 * This was developed by Christopher W. Olsen for the UbixOS Project.
6 *
7 * Redistribution and use in source and binary forms, with or without modification, are permitted
8 * provided that the following conditions are met:
9 *
10 * 1) Redistributions of source code must retain the above copyright notice, this list of
11 * conditions, the following disclaimer and the list of authors.
12 * 2) Redistributions in binary form must reproduce the above copyright notice, this list of
13 * conditions, the following disclaimer and the list of authors in the documentation and/or
14 * other materials provided with the distribution.
15 * 3) Neither the name of the UbixOS Project nor the names of its contributors may be used to
16 * endorse or promote products derived from this software without specific prior written
17 * permission.
18 *
19 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED
20 * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
21 * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS
22 * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
23 * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA,
24 * OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
25 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
26 * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
27 */
28
29 #ifndef OGDISPLAY_UBIXOS_H
30 #define OGDISPLAY_UBIXOS_H
31
32 #include <sys/types.h>
33 #include <objgfx40/objgfx40.h>
34
35 struct ogModeInfo {
36 uint16_t modeAttributes __attribute__((packed));
37 uint8_t windowAFlags __attribute__((packed));
38 uint8_t windowBFlags __attribute__((packed));
39 uint16_t granularity __attribute__((packed));
40 uint16_t windowSize __attribute__((packed));
41 uint16_t windowASeg __attribute__((packed));
42 uint16_t windowBSeg __attribute__((packed));
43 void* bankSwitch __attribute__((packed));
44 uint16_t bytesPerLine __attribute__((packed));
45 uint16_t xRes __attribute__((packed));
46 uint16_t yRes __attribute__((packed));
47 uint8_t charWidth __attribute__((packed));
48 uint8_t charHeight __attribute__((packed));
49 uint8_t numBitPlanes __attribute__((packed));
50 uint8_t bitsPerPixel __attribute__((packed));
51 uint8_t numberOfBanks __attribute__((packed));
52 uint8_t memoryModel __attribute__((packed));
53 uint8_t bankSize __attribute__((packed));
54 uint8_t numOfImagePages __attribute__((packed));
55 uint8_t reserved __attribute__((packed));
56 // Direct colour fields (required for Direct/6 and YUV/7 memory models
57 uint8_t redMaskSize __attribute__((packed));
58 uint8_t redFieldPosition __attribute__((packed));
59 uint8_t greenMaskSize __attribute__((packed));
60 uint8_t greenFieldPosition __attribute__((packed));
61 uint8_t blueMaskSize __attribute__((packed));
62 uint8_t blueFieldPosition __attribute__((packed));
63 uint8_t alphaMaskSize __attribute__((packed));
64 uint8_t alphaFieldPosition __attribute__((packed));
65 uint8_t directColourMode __attribute__((packed));
66 // VESA 2.0 specific fields
67 uint32_t physBasePtr __attribute__((packed));
68 void* offScreenMemOffset __attribute__((packed));
69 uint16_t offScreenMemSize __attribute__((packed));
70 uint8_t paddington[461] __attribute__((packed));
71 };
72
73 struct ogVESAInfo {
74 char VBESignature[4] __attribute__((packed));
75 uint8_t minVersion __attribute__((packed));
76 uint8_t majVersion __attribute__((packed));
77 uint32_t OEMStringPtr __attribute__((packed));
78 uint32_t capabilities __attribute__((packed));
79 uint32_t videoModePtr __attribute__((packed));
80 uint16_t totalMemory __attribute__((packed));
81 // VESA 2.0 specific fields
82 uint16_t OEMSoftwareRev __attribute__((packed));
83 uint32_t OEMVendorNamePtr __attribute__((packed));
84 uint32_t OEMProductNamePtr __attribute__((packed));
85 uint32_t OEMProductRevPtr __attribute__((packed));
86 uint8_t paddington[474] __attribute__((packed));
87 };
88
89 class ogDisplay_UbixOS: public ogSurface {
90 protected:
91 void * pages[2];
92 uint32_t activePage;
93 uint32_t visualPage;
94 ogVESAInfo * VESAInfo;
95 ogModeInfo * modeInfo;
96
97 uint16_t FindMode(uint32_t, uint32_t, uint32_t);
98 void GetModeInfo(uint16_t);
99 void GetVESAInfo(void);
100 void SetMode(uint16_t);
101 void SetPal(void);
102 public:
103 ogDisplay_UbixOS(void);
104 virtual bool ogAlias(ogSurface&, uint32_t, uint32_t, uint32_t, uint32_t);
105 virtual bool ogClone(ogSurface&);
106 virtual void ogCopyPalette(ogSurface&);
107 virtual bool ogCreate(uint32_t, uint32_t, ogPixelFmt);
108 virtual bool ogLoadPalette(const char *);
109 virtual void ogSetPalette(const ogRGBA8[]);
110 virtual void ogSetPalette(uint8_t, uint8_t, uint8_t, uint8_t);
111 virtual void ogSetPalette(uint8_t, uint8_t, uint8_t, uint8_t, uint8_t);
112 virtual ~ogDisplay_UbixOS(void);
113 };
114 // ogDisplay_UbixOS
115
116 #endif
ogModeInfo
Definition: ogDisplay_UbixOS.h:35
ogVESAInfo::__attribute__
char VBESignature[4] __attribute__((packed))
ogDisplay_UbixOS::SetMode
void SetMode(uint16_t)
Definition: ogDisplay_UbixOS.cc:99
types.h
ogDisplay_UbixOS::ogLoadPalette
virtual bool ogLoadPalette(const char *)
Definition: ogDisplay_UbixOS.cc:259
ogDisplay_UbixOS::GetVESAInfo
void GetVESAInfo(void)
Definition: ogDisplay_UbixOS.cc:70
ogDisplay_UbixOS::~ogDisplay_UbixOS
virtual ~ogDisplay_UbixOS(void)
Definition: ogDisplay_UbixOS.cc:291
ogVESAInfo
Definition: ogDisplay_UbixOS.h:73
uint16_t
__uint16_t uint16_t
Definition: types.h:45
ogDisplay_UbixOS::ogCopyPalette
virtual void ogCopyPalette(ogSurface &)
Definition: ogDisplay_UbixOS.cc:253
ogDisplay_UbixOS::activePage
uint32_t activePage
Definition: ogDisplay_UbixOS.h:92
ogDisplay_UbixOS
Definition: ogDisplay_UbixOS.h:89
ogDisplay_UbixOS::ogAlias
virtual bool ogAlias(ogSurface &, uint32_t, uint32_t, uint32_t, uint32_t)
Definition: ogDisplay_UbixOS.cc:223
ogDisplay_UbixOS::visualPage
uint32_t visualPage
Definition: ogDisplay_UbixOS.h:93
uint32_t
__uint32_t uint32_t
Definition: types.h:46
granularity
unsigned int granularity
Definition: gdt.h:85
ogDisplay_UbixOS::ogSetPalette
virtual void ogSetPalette(const ogRGBA8[])
ogModeInfo::__attribute__
uint16_t modeAttributes __attribute__((packed))
ogDisplay_UbixOS::SetPal
void SetPal(void)
Definition: ogDisplay_UbixOS.cc:211
ogDisplay_UbixOS::ogClone
virtual bool ogClone(ogSurface &)
Definition: ogDisplay_UbixOS.cc:248
ogDisplay_UbixOS::pages
void * pages[2]
Definition: ogDisplay_UbixOS.h:91
ogDisplay_UbixOS::FindMode
uint16_t FindMode(uint32_t, uint32_t, uint32_t)
Definition: ogDisplay_UbixOS.cc:79
ogDisplay_UbixOS::VESAInfo
ogVESAInfo * VESAInfo
Definition: ogDisplay_UbixOS.h:94
ogDisplay_UbixOS::GetModeInfo
void GetModeInfo(uint16_t)
Definition: ogDisplay_UbixOS.cc:65
ogDisplay_UbixOS::modeInfo
ogModeInfo * modeInfo
Definition: ogDisplay_UbixOS.h:95
uint8_t
__uint8_t uint8_t
Definition: types.h:44
ogDisplay_UbixOS::ogCreate
virtual bool ogCreate(uint32_t, uint32_t, ogPixelFmt)
Definition: ogDisplay_UbixOS.cc:228
ogDisplay_UbixOS::ogDisplay_UbixOS
ogDisplay_UbixOS(void)
Definition: ogDisplay_UbixOS.cc:52