From 4a9624da0c7cf0c27a00e1ff497d13f2e4a0d03e Mon Sep 17 00:00:00 2001 From: Richard Qin Date: Tue, 10 Nov 2026 01:16:40 +0800 Subject: [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. --- mubios/drivers/kbd.c | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) (limited to 'mubios/drivers/kbd.c') 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) -- cgit v1.2.3