forked from Bananymous/banan-os
Kernel: Add support for text mode terminal
This probably won't be used at all but it was so simple and made me do really nice refactorings so i decided to add it :)
This commit is contained in:
42
kernel/include/kernel/Terminal/TextModeTerminal.h
Normal file
42
kernel/include/kernel/Terminal/TextModeTerminal.h
Normal file
@@ -0,0 +1,42 @@
|
||||
#pragma once
|
||||
|
||||
#include <kernel/Terminal/TerminalDriver.h>
|
||||
|
||||
namespace Kernel
|
||||
{
|
||||
|
||||
class TextModeTerminalDriver final : public TerminalDriver
|
||||
{
|
||||
public:
|
||||
static BAN::ErrorOr<BAN::RefPtr<TextModeTerminalDriver>> create_from_boot_info();
|
||||
~TextModeTerminalDriver();
|
||||
|
||||
uint32_t width() const override { return m_width; }
|
||||
uint32_t height() const override { return m_height; }
|
||||
|
||||
void putchar_at(uint16_t, uint32_t, uint32_t, Color, Color) override;
|
||||
void clear(Color) override;
|
||||
|
||||
void set_cursor_shown(bool) override;
|
||||
void set_cursor_position(uint32_t, uint32_t) override;
|
||||
|
||||
private:
|
||||
TextModeTerminalDriver(paddr_t paddr, uint32_t width, uint32_t height, uint32_t pitch)
|
||||
: m_paddr(paddr)
|
||||
, m_width(width)
|
||||
, m_height(height)
|
||||
, m_pitch(pitch)
|
||||
{}
|
||||
|
||||
BAN::ErrorOr<void> initialize();
|
||||
|
||||
private:
|
||||
const paddr_t m_paddr;
|
||||
const uint32_t m_width;
|
||||
const uint32_t m_height;
|
||||
const uint32_t m_pitch;
|
||||
vaddr_t m_vaddr { 0 };
|
||||
static constexpr Color s_cursor_color = TerminalColor::BRIGHT_WHITE;
|
||||
};
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user