FreeNOS
VGA.h
Go to the documentation of this file.
1 /*
2  * Copyright (C) 2009 Niek Linnenbank
3  *
4  * This program is free software: you can redistribute it and/or modify
5  * it under the terms of the GNU General Public License as published by
6  * the Free Software Foundation, either version 3 of the License, or
7  * (at your option) any later version.
8  *
9  * This program is distributed in the hope that it will be useful,
10  * but WITHOUT ANY WARRANTY; without even the implied warranty of
11  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12  * GNU General Public License for more details.
13  *
14  * You should have received a copy of the GNU General Public License
15  * along with this program. If not, see <http://www.gnu.org/licenses/>.
16  */
17 
18 #ifndef __SERVER_VIDEO_VGA_H
19 #define __SERVER_VIDEO_VGA_H
20 
21 #include <FreeNOS/System.h>
22 #include <DeviceServer.h>
23 #include <Types.h>
24 
34 #define VGA_PADDR (0xb8000)
35 
37 #define VGA_IOADDR 0x3d4
38 
40 #define VGA_IODATA 0x3d5
41 
48 #define VGA_ATTR(front,back) \
49  (((back & 0xf) << 4) | ((front & 0xf)))
50 
58 #define VGA_CHAR(ch,front,back) \
59  ((VGA_ATTR(front,back) << 8) | (ch & 0xff))
60 
64 enum Colors
65 {
66  BLACK = 0,
67  BLUE = 1,
68  GREEN = 2,
69  CYAN = 3,
70  RED = 4,
71  MAGENTA = 5,
72  BROWN = 6,
73  LIGHTGREY = 7,
74  DARKGREY = 8,
75  LIGHTBLUE = 9,
76  LIGHTGREEN = 10,
77  LIGHTCYAN = 11,
78  LIGHTRED = 12,
80  LIGHTBROWN = 14,
81  WHITE = 15,
82 };
83 
94 class VGA : public Device
95 {
96  public:
97 
105  VGA(const u32 inode,
106  const Size width = 80,
107  const Size height = 25);
108 
118  virtual FileSystem::Result initialize();
119 
130  virtual FileSystem::Result read(IOBuffer & buffer,
131  Size & size,
132  const Size offset);
133 
144  virtual FileSystem::Result write(IOBuffer & buffer,
145  Size & size,
146  const Size offset);
147 
148  private:
149 
152 
155 
158 
161 };
162 
168 #endif /* __SERVER_VIDEO_VGA_H */
LIGHTGREY
@ LIGHTGREY
Definition: VGA.h:73
VGA::read
virtual FileSystem::Result read(IOBuffer &buffer, Size &size, const Size offset)
Read video memory.
Definition: VGA.cpp:63
DeviceServer.h
GREEN
@ GREEN
Definition: VGA.h:68
DARKGREY
@ DARKGREY
Definition: VGA.h:74
Types.h
ARMIO
Input/Output operations specific to the ARM architecture.
Definition: ARMIO.h:39
LIGHTBROWN
@ LIGHTBROWN
Definition: VGA.h:80
VGA::initialize
virtual FileSystem::Result initialize()
Initialize the VGA device.
Definition: VGA.cpp:33
Colors
Colors
VGA color attributes.
Definition: VGA.h:64
Device
Abstract device class interface.
Definition: Device.h:35
VGA::vga
u16 * vga
VGA video memory address.
Definition: VGA.h:151
VGA::height
Size height
Number of characters vertically.
Definition: VGA.h:157
WHITE
@ WHITE
Definition: VGA.h:81
BLUE
@ BLUE
Definition: VGA.h:67
u16
unsigned short u16
Unsigned 16-bit number.
Definition: Types.h:56
IOBuffer
Abstract Input/Output buffer.
Definition: IOBuffer.h:37
u32
unsigned int u32
Unsigned 32-bit number.
Definition: Types.h:53
LIGHTMAGENTA
@ LIGHTMAGENTA
Definition: VGA.h:79
Size
unsigned int Size
Any sane size indicator cannot go negative.
Definition: Types.h:128
BROWN
@ BROWN
Definition: VGA.h:72
CYAN
@ CYAN
Definition: VGA.h:69
LIGHTCYAN
@ LIGHTCYAN
Definition: VGA.h:77
VGA::VGA
VGA(const u32 inode, const Size width=80, const Size height=25)
Class constructor function.
Definition: VGA.cpp:23
MAGENTA
@ MAGENTA
Definition: VGA.h:71
VGA::write
virtual FileSystem::Result write(IOBuffer &buffer, Size &size, const Size offset)
Write video memory.
Definition: VGA.cpp:76
FileSystem::Result
Result
Result code for filesystem Actions.
Definition: FileSystem.h:52
VGA::m_io
Arch::IO m_io
Port I/O object.
Definition: VGA.h:160
LIGHTGREEN
@ LIGHTGREEN
Definition: VGA.h:76
VGA
Video Graphics Array (VGA) support.
Definition: VGA.h:94
RED
@ RED
Definition: VGA.h:70
LIGHTBLUE
@ LIGHTBLUE
Definition: VGA.h:75
VGA::width
Size width
Number of characters horizontally.
Definition: VGA.h:154
LIGHTRED
@ LIGHTRED
Definition: VGA.h:78
BLACK
@ BLACK
Definition: VGA.h:66