summaryrefslogtreecommitdiff
path: root/src/kernel/arch/i386/tty
diff options
context:
space:
mode:
authordzwdz2021-10-07 06:25:02 +0000
committerdzwdz2021-10-07 06:25:02 +0000
commitfbf6183ef8c9d49a14bd3ff01f378d67eaebc300 (patch)
tree13380aee9433d727aa66ba7b9580ed91a033414a /src/kernel/arch/i386/tty
parent7e326b5039bff4d422f66bb8e51267f785193985 (diff)
kernel/i386: rename the port io functions with their bit length
Diffstat (limited to 'src/kernel/arch/i386/tty')
-rw-r--r--src/kernel/arch/i386/tty/serial.c28
1 files changed, 14 insertions, 14 deletions
diff --git a/src/kernel/arch/i386/tty/serial.c b/src/kernel/arch/i386/tty/serial.c
index 2b89ecf..f9bb252 100644
--- a/src/kernel/arch/i386/tty/serial.c
+++ b/src/kernel/arch/i386/tty/serial.c
@@ -7,37 +7,37 @@ static const int COM1 = 0x3f8;
static void serial_selftest(void) {
char b = 0x69;
- port_outb(COM1 + 4, 0b00011110); // enable loopback mode
- port_outb(COM1, b);
- assert(port_inb(COM1) == b);
+ port_out8(COM1 + 4, 0b00011110); // enable loopback mode
+ port_out8(COM1, b);
+ assert(port_in8(COM1) == b);
}
void serial_init(void) {
// see https://www.sci.muni.cz/docs/pc/serport.txt
- port_outb(COM1 + 1, 0x00); // disable interrupts, we won't be using them
+ port_out8(COM1 + 1, 0x00); // disable interrupts, we won't be using them
// set baud rate divisor
- port_outb(COM1 + 3, 0b10000000); // enable DLAB
- port_outb(COM1 + 0, 0x01); // divisor = 1 (low byte)
- port_outb(COM1 + 1, 0x00); // (high byte)
+ port_out8(COM1 + 3, 0b10000000); // enable DLAB
+ port_out8(COM1 + 0, 0x01); // divisor = 1 (low byte)
+ port_out8(COM1 + 1, 0x00); // (high byte)
- port_outb(COM1 + 3, 0b00000011); // 8 bits, no parity, one stop bit
- port_outb(COM1 + 2, 0b11000111); // enable FIFO with 14-bit trigger level (???)
+ port_out8(COM1 + 3, 0b00000011); // 8 bits, no parity, one stop bit
+ port_out8(COM1 + 2, 0b11000111); // enable FIFO with 14-bit trigger level (???)
serial_selftest();
- port_outb(COM1 + 4, 0b00001111); // enable everything in the MCR
+ port_out8(COM1 + 4, 0b00001111); // enable everything in the MCR
}
static void serial_putchar(char c) {
- while ((port_inb(COM1 + 5) & 0x20) == 0); // wait for THRE
- port_outb(COM1, c);
+ while ((port_in8(COM1 + 5) & 0x20) == 0); // wait for THRE
+ port_out8(COM1, c);
}
char serial_read(void) {
- while ((port_inb(COM1 + 5) & 0x01) == 0); // wait for DR
- return port_inb(COM1);
+ while ((port_in8(COM1 + 5) & 0x01) == 0); // wait for DR
+ return port_in8(COM1);
}
void serial_write(const char *buf, size_t len) {