From a19ae009f9f571d25a90aca5cc5e05d3c76e1aed Mon Sep 17 00:00:00 2001 From: Danny Holman Date: Fri, 16 Feb 2024 13:29:51 -0600 Subject: arch: i386: add basic keyboard driver Add a basic driver for the PS/2 keyboard. This driver just prints whatever it receives back out to the framebuffer. Signed-off-by: Danny Holman --- arch/i386/include/kernel/keyboard.h | 33 +++++++++++++++++++++++++++++++++ 1 file changed, 33 insertions(+) create mode 100644 arch/i386/include/kernel/keyboard.h (limited to 'arch/i386/include') diff --git a/arch/i386/include/kernel/keyboard.h b/arch/i386/include/kernel/keyboard.h new file mode 100644 index 0000000..8f39a70 --- /dev/null +++ b/arch/i386/include/kernel/keyboard.h @@ -0,0 +1,33 @@ +#ifndef I386_KEYBOARD_H +#define I386_KEYBOARD_H + +#include +#include + +#define KB_STAT 0x64 +#define KB_DATA 0x60 + +#define KB_DIB 0x01 +#define KB_SHIFT (1<<0) +#define KB_CTL (1<<1) +#define KB_ALT (1<<2) +#define KB_CPSLK (1<<3) +#define KB_NUMLK (1<<4) +#define KB_SCLLK (1<<5) +#define KB_E0ESC (1<<6) + +#define KB_HOME 0xE0 +#define KB_END 0xE1 +#define KB_UP 0xE2 +#define KB_DOWN 0xE3 +#define KB_LEFT 0xE4 +#define KB_RGHT 0xE5 +#define KB_PGUP 0xE6 +#define KB_PGDN 0xE7 +#define KB_INS 0xE8 +#define KB_DEL 0xE9 + +char keyboard_getchar(void); +void keyboard_handler(struct isr_frame *frame); + +#endif -- cgit v1.2.3