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
65{
66 BLACK = 0,
67 BLUE = 1,
68 GREEN = 2,
69 CYAN = 3,
70 RED = 4,
72 BROWN = 6,
81 WHITE = 15,
82};
83
94class VGA : public Device
95{
96 public:
97
105 VGA(const u32 inode,
106 const Size width = 80,
107 const Size height = 25);
108
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 */
Input/Output operations specific to the ARM architecture.
Definition ARMIO.h:40
Abstract device class interface.
Definition Device.h:36
Abstract Input/Output buffer.
Definition IOBuffer.h:38
Video Graphics Array (VGA) support.
Definition VGA.h:95
virtual FileSystem::Result read(IOBuffer &buffer, Size &size, const Size offset)
Read video memory.
Definition VGA.cpp:63
virtual FileSystem::Result write(IOBuffer &buffer, Size &size, const Size offset)
Write video memory.
Definition VGA.cpp:76
u16 * vga
VGA video memory address.
Definition VGA.h:151
virtual FileSystem::Result initialize()
Initialize the VGA device.
Definition VGA.cpp:33
Size height
Number of characters vertically.
Definition VGA.h:157
Arch::IO m_io
Port I/O object.
Definition VGA.h:160
Size width
Number of characters horizontally.
Definition VGA.h:154
unsigned int u32
Unsigned 32-bit number.
Definition Types.h:53
unsigned short u16
Unsigned 16-bit number.
Definition Types.h:56
unsigned int Size
Any sane size indicator cannot go negative.
Definition Types.h:128
Colors
VGA color attributes.
Definition VGA.h:65
@ LIGHTGREY
Definition VGA.h:73
@ LIGHTGREEN
Definition VGA.h:76
@ BROWN
Definition VGA.h:72
@ LIGHTBLUE
Definition VGA.h:75
@ WHITE
Definition VGA.h:81
@ LIGHTBROWN
Definition VGA.h:80
@ BLUE
Definition VGA.h:67
@ MAGENTA
Definition VGA.h:71
@ GREEN
Definition VGA.h:68
@ CYAN
Definition VGA.h:69
@ DARKGREY
Definition VGA.h:74
@ LIGHTCYAN
Definition VGA.h:77
@ LIGHTMAGENTA
Definition VGA.h:79
@ LIGHTRED
Definition VGA.h:78
@ BLACK
Definition VGA.h:66
@ RED
Definition VGA.h:70
Result
Result code for filesystem Actions.
Definition FileSystem.h:53