diff options
Diffstat (limited to 'src/kernel/io/io.c')
-rw-r--r-- | src/kernel/io/io.c | 53 |
1 files changed, 27 insertions, 26 deletions
diff --git a/src/kernel/io/io.c b/src/kernel/io/io.c index c4dad52..1f67c11 100644 --- a/src/kernel/io/io.c +++ b/src/kernel/io/io.c @@ -3,74 +3,75 @@ uint8_t inb(uint16_t port) { - uint8_t value; - asm ("inb %1, %0" : "=a"(value) : "Nd"(port)); - return value; + uint8_t value; + asm("inb %1, %0" : "=a"(value) : "Nd"(port)); + return value; } uint16_t inw(uint16_t port) { - uint16_t value; - asm ("inw %1, %0" : "=a"(value) : "Nd"(port)); - return value; + uint16_t value; + asm("inw %1, %0" : "=a"(value) : "Nd"(port)); + return value; } uint32_t inl(uint16_t port) { - uint32_t value; - asm ("inl %1, %0" : "=a"(value) : "Nd"(port)); - return value; + uint32_t value; + asm("inl %1, %0" : "=a"(value) : "Nd"(port)); + return value; } void cli() { - asm volatile ("cli"); + asm volatile("cli"); } void sti() { - asm volatile ("sti"); + asm volatile("sti"); } void hlt() { - asm volatile ("hlt"); + asm volatile("hlt"); } void outb(uint16_t port, uint8_t data) { - asm ("outb %0, %1"::"a" (data), "Nd"(port)); + asm("outb %0, %1" ::"a"(data), "Nd"(port)); } void outw(uint16_t port, uint16_t data) { - asm ("outw %0, %1"::"a" (data), "Nd"(port)); + asm("outw %0, %1" ::"a"(data), "Nd"(port)); } void outl(uint16_t port, uint32_t data) { - asm ("outl %0, %1"::"a" (data), "Nd"(port)); + asm("outl %0, %1" ::"a"(data), "Nd"(port)); } void init_serial() { - outb(0x3f8 + 1, 0x00); - outb(0x3f8 + 3, 0x80); - outb(0x3f8 + 0, 0x03); - outb(0x3f8 + 1, 0x00); - outb(0x3f8 + 3, 0x03); - outb(0x3f8 + 2, 0xC7); - outb(0x3f8 + 4, 0x0B); - vga_log("Installed serial connection"); + outb(0x3f8 + 1, 0x00); + outb(0x3f8 + 3, 0x80); + outb(0x3f8 + 0, 0x03); + outb(0x3f8 + 1, 0x00); + outb(0x3f8 + 3, 0x03); + outb(0x3f8 + 2, 0xC7); + outb(0x3f8 + 4, 0x0B); + vga_log("Installed serial connection"); } int is_transmit_empty() { - return inb(0x3f8 + 5) & 0x20; + return inb(0x3f8 + 5) & 0x20; } void serial_put(char ch) { - while (is_transmit_empty() == 0); - outb(0x3f8, (uint8_t) ch); + while (is_transmit_empty() == 0) + ; + outb(0x3f8, (uint8_t)ch); } |