summaryrefslogtreecommitdiff
path: root/src/kernel/arch/i386/tty/serial.c
diff options
context:
space:
mode:
authordzwdz2022-03-26 21:06:07 +0100
committerdzwdz2022-03-26 21:06:07 +0100
commit38d1712e31e60de9f2afe85873b2174e002e3e99 (patch)
tree19c402747631d6df2dbd7c9222d7871b941e94ee /src/kernel/arch/i386/tty/serial.c
parent96f021e783f1e99a1ce7d34c0dfeaef524abc2d1 (diff)
kernel: IRQs; PS/2 keyboard support
Diffstat (limited to 'src/kernel/arch/i386/tty/serial.c')
-rw-r--r--src/kernel/arch/i386/tty/serial.c8
1 files changed, 5 insertions, 3 deletions
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) {