aboutsummaryrefslogtreecommitdiff
path: root/mubios/drivers/kbd.c
diff options
context:
space:
mode:
authorRichard Qin <richard.qin.x@gmail.com>2026-11-10 01:16:40 +0800
committerRichard Qin <richard.qin.x@gmail.com>2026-11-10 01:16:40 +0800
commit4a9624da0c7cf0c27a00e1ff497d13f2e4a0d03e (patch)
tree91b95e736fa08a071e7814872fc822c2d3fcd682 /mubios/drivers/kbd.c
parent9f45c30789b6133d4b5fb4ef07f0818a3ea4de48 (diff)
downloadrcc-project-4a9624da0c7cf0c27a00e1ff497d13f2e4a0d03e.tar.gz
rcc-project-4a9624da0c7cf0c27a00e1ff497d13f2e4a0d03e.tar.xz
[mubios] Implement serial input and BIOS console key handling
Implement UART receive, transmit timeouts, configuration and status reporting for INT 14h functions 00h-03h. Initialize the BDA serial timeout and expose the driver interfaces. Translate terminal characters and CSI/SS3 escape sequences into BIOS keyboard events for INT 16h. Add blocking reads, non-consuming status queries, enhanced key reads and keyboard buffer insertion.
Diffstat (limited to 'mubios/drivers/kbd.c')
-rw-r--r--mubios/drivers/kbd.c12
1 files changed, 7 insertions, 5 deletions
diff --git a/mubios/drivers/kbd.c b/mubios/drivers/kbd.c
index 4de0a96..eb99e70 100644
--- a/mubios/drivers/kbd.c
+++ b/mubios/drivers/kbd.c
@@ -33,9 +33,9 @@
/*
* 8042 command byte bits.
- * Bit 0 enables the keyboard IRQ, bit 1 the auxiliary port IRQ, bit 4 and bit 5
- * hold the keyboard and auxiliary clock, and bit 6 selects set 1 scan codes on
- * the keyboard interface.
+ * Bit 0 enables the keyboard IRQ, bit 1 the auxiliary port IRQ, bit 4 and bit
+ * 5 hold the keyboard and auxiliary clock, and bit 6 selects set 1 scan codes
+ * on the keyboard interface.
*/
#define KBD_CONFIG_IRQ1 0x01u
#define KBD_CONFIG_IRQ12 0x02u
@@ -103,7 +103,8 @@ kbd_init (void)
/* Disable both ports before the controller is reconfigured. */
kbd_write_command (KBD_CMD_DISABLE_KBD);
- /* Drain the self-test and any pending scan code left in the output buffer. */
+ /* Drain the self-test and any pending scan code left in the output buffer.
+ */
while ((io_in8 (KBD_STATUS_PORT) & KBD_STATUS_OBF) != 0u)
(void)io_in8 (KBD_DATA_PORT);
@@ -115,7 +116,8 @@ kbd_init (void)
config = io_in8 (KBD_DATA_PORT);
- config &= (u8)~(KBD_CONFIG_DISABLE_KBD_CLOCK | KBD_CONFIG_DISABLE_AUX_CLOCK);
+ config
+ &= (u8) ~(KBD_CONFIG_DISABLE_KBD_CLOCK | KBD_CONFIG_DISABLE_AUX_CLOCK);
config |= KBD_CONFIG_IRQ1 | KBD_CONFIG_IRQ12 | KBD_CONFIG_TRANSLATE;
if (kbd_write_command (KBD_CMD_WRITE_CONFIG) != 0)