adds a queue library, work for keyb driver

This commit is contained in:
2025-06-02 10:35:57 -04:00
parent 0fc2e6a199
commit ca77157344
5 changed files with 97 additions and 1 deletions

View File

@ -31,6 +31,7 @@ void exception_handler(unsigned int i)
//kinfo("Sending EOI instruction to KEYB");
#endif
unsigned char in = inb(0x60);
char to_print = decode_key_enum(decode_scancode(in));
if (to_print != '\0')
printf("%c", to_print);

View File

@ -1,4 +1,5 @@
#include <stdbool.h>
#include <stdint.h>
#include <kernel/x86/keyb.h>

View File

@ -3,6 +3,20 @@
#ifndef ARCH_KEYB_H
#define ARCH_KEYB_H
#define KEYB_DATA_PORT (0x60)
#define KEYB_STATUS_PORT (0x64)
#define KEYB_COMMAND_PORT (0x64)
#define KEYB_RESP_ERR (0x00)
#define KEYB_RESP_SELF_TEST_PASSED (0xAA)
#define KEYB_RESP_ECHO (0xEE)
#define KEYB_RESP_ACK (0xFA)
#define KEYB_RESP_SELF_TEST_FAILED (0xFC)
#define KEYB_RESP_SELF_TEST_FAILED_TWO (0xFD)
#define KEYB_RESP_RESEND (0xFE)
#define KEYB_RESP_ERR_TWO (0xFF)
typedef enum {
KEY_ESC = 0x01,
KEY_1, KEY_2, KEY_3, KEY_4, KEY_5, KEY_6, KEY_7, KEY_8, KEY_9, KEY_0,
@ -58,8 +72,10 @@ typedef enum {
KEY_F12_R,
} kb_key_press_t;
kb_key_press_t decode_scancode(uint8_t scancode);
kb_key_press_t decode_scancode(uint8_t scancode);
char decode_key_enum(kb_key_press_t keycode);
#endif