The Pedigree Project 0.1
kernel/machine/mach_pc/Vga.h
1/*
2 * Copyright (c) 2008-2014, Pedigree Developers
3 *
4 * Please see the CONTRIB file in the root of the source tree for a full
5 * list of contributors.
6 *
7 * Permission to use, copy, modify, and distribute this software for any
8 * purpose with or without fee is hereby granted, provided that the above
9 * copyright notice and this permission notice appear in all copies.
10 *
11 * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
12 * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
13 * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
14 * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
15 * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
16 * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
17 * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
18 */
19
20#ifndef MACHINE_X86_VGA_H
21#define MACHINE_X86_VGA_H
22#include "pedigree/kernel/Spinlock.h"
23#include "pedigree/kernel/machine/Vga.h"
24#include "pedigree/kernel/processor/MemoryMappedIo.h"
25#include "pedigree/kernel/processor/types.h"
26
27#include "FramebufferConsole.h"
28
32class X86Vga : public Vga {
33 public:
34 X86Vga();
35 virtual ~X86Vga();
36
41 virtual bool setLargestTextMode();
42
46 virtual size_t getNumCols() {
47 return FramebufferConsole::Columns;
48 }
49
53 virtual size_t getNumRows() {
54 return FramebufferConsole::Rows;
55 }
56
67 virtual void pokeBuffer(uint8_t* pBuffer, size_t nBufLen);
68
78 virtual void peekBuffer(uint8_t* pBuffer, size_t nBufLen);
79
85 virtual void moveCursor(size_t nX, size_t nY);
86 virtual void flush();
87 bool setFramebuffer(Framebuffer* framebuffer) override;
88 void enterPanicMode() override {
89 m_PanicMode = true;
90 }
91
92 bool initialise();
93
94 operator uint16_t*() const {
95 return const_cast<uint16_t*>(m_Console.cells());
96 }
97
98 private:
99 X86Vga(const X86Vga&);
100 X86Vga& operator=(const X86Vga&);
101
102 MemoryMappedIo m_Framebuffer;
103 Spinlock m_ConsoleLock{false, true};
104 bool m_PanicMode = false;
105 FramebufferConsole m_Console;
106 Framebuffer* m_pConsoleFramebuffer = nullptr;
107};
108
109#endif
Memory mapped I/O range.
virtual bool setLargestTextMode()
virtual void pokeBuffer(uint8_t *pBuffer, size_t nBufLen)
virtual size_t getNumCols()
virtual void moveCursor(size_t nX, size_t nY)
virtual void peekBuffer(uint8_t *pBuffer, size_t nBufLen)
virtual size_t getNumRows()