PCI, Serial, Shell improvements (VGA is broken)
This commit is contained in:
parent
50f5723733
commit
dac2cff511
14 changed files with 125490 additions and 64 deletions
36
kernel/drivers/serial.c
Normal file
36
kernel/drivers/serial.c
Normal file
|
@ -0,0 +1,36 @@
|
|||
#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);
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue