This commit is contained in:
Nicholas Orlowsky 2025-02-28 21:25:17 -05:00
parent ce2b373313
commit 9114529153
46 changed files with 126016 additions and 125522 deletions

View file

@ -1,36 +0,0 @@
#pragma once
#include "../../arch/i386/asm.c"
#define COM1 (0x3F8)
int serial_init() {
outb(COM1 + 1, 0x01);
outb(COM1 + 3, 0x80);
outb(COM1 + 0, 0x03);
outb(COM1 + 1, 0x00);
outb(COM1 + 3, 0x03);
outb(COM1 + 2, 0xC7);
outb(COM1 + 4, 0x0B);
outb(COM1 + 4, 0x0F);
return 0;
}
int serial_has_tx() {
return inb(COM1 + 5) & 0x20;
}
int serial_has_rx() {
return inb(COM1 + 5) & 1;
}
void serial_tx(char a) {
while (serial_has_tx() == 0);
outb(COM1,a);
}
char serial_rx() {
while (serial_has_rx() == 0);
return inb(COM1);
}