summaryrefslogtreecommitdiff
path: root/src/kernel/arch/i386/tty/serial.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/kernel/arch/i386/tty/serial.c')
-rw-r--r--src/kernel/arch/i386/tty/serial.c5
1 files changed, 5 insertions, 0 deletions
diff --git a/src/kernel/arch/i386/tty/serial.c b/src/kernel/arch/i386/tty/serial.c
index 6ddc05b..2b89ecf 100644
--- a/src/kernel/arch/i386/tty/serial.c
+++ b/src/kernel/arch/i386/tty/serial.c
@@ -35,6 +35,11 @@ static void serial_putchar(char c) {
port_outb(COM1, c);
}
+char serial_read(void) {
+ while ((port_inb(COM1 + 5) & 0x01) == 0); // wait for DR
+ return port_inb(COM1);
+}
+
void serial_write(const char *buf, size_t len) {
for (size_t i = 0; i < len; i++)
serial_putchar(buf[i]);