The Pedigree Project 0.1
include/pedigree/kernel/machine/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_VGA_H
21#define MACHINE_VGA_H
22
23#include "pedigree/kernel/processor/types.h"
24
25class Framebuffer;
26
30class Vga {
31 public:
32 virtual ~Vga();
33
38 virtual bool setLargestTextMode() = 0;
39
43 virtual size_t getNumCols() = 0;
44
48 virtual size_t getNumRows() = 0;
49
60 virtual void pokeBuffer(uint8_t* pBuffer, size_t nBufLen) = 0;
61
70 virtual void peekBuffer(uint8_t* pBuffer, size_t nBufLen) = 0;
71
77 virtual void moveCursor(size_t nX, size_t nY) = 0;
78
79 // Memory-backed consoles need an explicit presentation after direct cell writes.
80 virtual void flush() {}
81
82 // Terminal only: interrupts must be disabled and all other CPUs stopped.
83 // The interrupted CPU may itself own the console lock; execution cannot resume.
84 virtual void enterPanicMode() {}
85
86 // The provider and its mapped pixels must remain valid for the kernel lifetime.
87 // Console presentation calls redraw with interrupts disabled; it must not wait.
88 virtual bool setFramebuffer(Framebuffer*) {
89 return false;
90 }
91
92 virtual operator uint16_t*() const = 0;
93};
94
95#endif
virtual void moveCursor(size_t nX, size_t nY)=0
virtual bool setLargestTextMode()=0
virtual size_t getNumRows()=0
virtual void pokeBuffer(uint8_t *pBuffer, size_t nBufLen)=0
virtual size_t getNumCols()=0
virtual void peekBuffer(uint8_t *pBuffer, size_t nBufLen)=0