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:
@@ -3,7 +3,8 @@
|
||||
#include <stdint.h>
|
||||
|
||||
#define BANAN_BOOTLOADER_MAGIC 0xD3C60CFF
|
||||
#define BANAN_BOOTLOADER_FB_RGB 1
|
||||
#define BANAN_BOOTLOADER_FB_RGB 1
|
||||
#define BANAN_BOOTLOADER_FB_TEXT 2
|
||||
|
||||
struct BananBootFramebufferInfo
|
||||
{
|
||||
|
||||
@@ -15,6 +15,7 @@ namespace Kernel
|
||||
None,
|
||||
Unknown,
|
||||
RGB,
|
||||
Text,
|
||||
};
|
||||
|
||||
paddr_t address;
|
||||
|
||||
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;
|
||||
};
|
||||
|
||||
}
|
||||
@@ -11,7 +11,8 @@
|
||||
#define MULTIBOOT2_TAG_OLD_RSDP 14
|
||||
#define MULTIBOOT2_TAG_NEW_RSDP 15
|
||||
|
||||
#define MULTIBOOT2_FRAMEBUFFER_TYPE_RGB 1
|
||||
#define MULTIBOOT2_FRAMEBUFFER_TYPE_RGB 1
|
||||
#define MULTIBOOT2_FRAMEBUFFER_TYPE_TEXT 2
|
||||
|
||||
#define MULTIBOOT2_MAGIC 0x36d76289
|
||||
|
||||
|
||||
Reference in New Issue
Block a user