From 38d1712e31e60de9f2afe85873b2174e002e3e99 Mon Sep 17 00:00:00 2001 From: dzwdz Date: Sat, 26 Mar 2022 21:06:07 +0100 Subject: kernel: IRQs; PS/2 keyboard support --- src/kernel/arch/i386/tty/serial.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) (limited to 'src/kernel/arch/i386/tty/serial.c') diff --git a/src/kernel/arch/i386/tty/serial.c b/src/kernel/arch/i386/tty/serial.c index f9bb252..e77ff5c 100644 --- a/src/kernel/arch/i386/tty/serial.c +++ b/src/kernel/arch/i386/tty/serial.c @@ -35,9 +35,11 @@ static void serial_putchar(char c) { port_out8(COM1, c); } -char serial_read(void) { - while ((port_in8(COM1 + 5) & 0x01) == 0); // wait for DR - return port_in8(COM1); +bool serial_poll_read(char *c) { + if ((port_in8(COM1 + 5) & 0x01) == 0) // needs DR + return false; + *c = port_in8(COM1); + return true; } void serial_write(const char *buf, size_t len) { -- cgit v1.2.3