feat: Local/IO APIC, PS/2 keyboard & mouse

This commit is contained in:
daniel committed 2026-02-17 12:44:31 +01:00
1 parent e2f059bf90
commit 641ec4681b
26 files changed
+1730 -3

No files matched your search

+52
View File
@@ -0,0 +1,52 @@
/*
* Keyboard.hpp
* PS/2 Keyboard driver
* Copyright (c) 2025 Daniel Hammer
*/
#pragma once
#include <cstdint>
namespace Drivers::PS2::Keyboard {
// Key event structure
struct KeyEvent {
uint8_t Scancode;
char Ascii;
bool Pressed;
bool Shift;
bool Ctrl;
bool Alt;
bool CapsLock;
};
// Modifier key state
struct ModifierState {
bool LeftShift;
bool RightShift;
bool LeftCtrl;
bool RightCtrl;
bool LeftAlt;
bool RightAlt;
bool CapsLock;
bool NumLock;
bool ScrollLock;
};
// Ring buffer size (must be power of 2)
constexpr uint32_t KeyBufferSize = 256;
void Initialize();
// Interrupt handler -- called from IRQ dispatch (EOI is sent automatically)
void HandleIRQ(uint8_t irq);
// Public interface for consuming key events
bool IsKeyAvailable();
KeyEvent GetKey();
char GetChar();
// Modifier state query
const ModifierState& GetModifiers();
};