feat(serial): add write

Signed-off-by: Julien CLEMENT <julien.clement@epita.fr>
This commit is contained in:
Julien CLEMENT 2021-07-12 20:03:55 +02:00
parent 202fc190ac
commit e92cc8877f
2 changed files with 13 additions and 1 deletions

@ -22,5 +22,15 @@ void serial_init(void)
int write(const char *buf, size_t count)
{
return 0;
int sent;
for(sent = 0; sent < count; ++sent)
{
u8 line_status = inb(COM1 + 5);
if (!line_status & EMPTY_TRANSMITTER)
break;
outb(COM1, buf[sent]);
}
return sent;
}

@ -18,6 +18,8 @@
#define DLAB (0x1 << 7)
#define EMPTY_TRANSMITTER (0x1 << 5)
void serial_init(void);
int write(const char *buf, size_t count);