feat(serial): add write
Signed-off-by: Julien CLEMENT <julien.clement@epita.fr>
This commit is contained in:
parent
202fc190ac
commit
e92cc8877f
12
k/serial.c
12
k/serial.c
@ -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);
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user