k-chow/k/serial.c
Julien CLEMENT 202fc190ac feat(serial): add serial initialization and gitignore
Signed-off-by: Julien CLEMENT <julien.clement@epita.fr>
2021-07-12 19:46:21 +02:00

27 lines
545 B
C

#include <stddef.h>
#include "serial.h"
#include "io.h"
void set_baud_rate(void)
{
u8 line_control_register = inb(COM1 + 3);
outb(COM1 + 3, DLAB | line_control_register);
outb(COM1, 3);
outb(COM1 + 1, 0);
outb(COM1 + 3, line_control_register);
}
void serial_init(void)
{
outb(COM1 + 3, NO_PARITY | EIGHT_BITS_LENGTH);
outb(COM1 + 2, FIFO | TRIGGER_LVL_14 | CLEAR_TRANSMIT_FIFO
| CLEAR_RECEIVE_FIFO);
outb(COM1 + 1, ENABLE_TRANSMITTER);
}
int write(const char *buf, size_t count)
{
return 0;
}