blob: 98108ebee588fa0250041b7784b3a097ab9e4217 (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
|
// MIT License, Copyright (c) 2020 Marvin Borner
#include <cpu.h>
#include <def.h>
#include <serial.h>
#include <str.h>
void serial_install(void)
{
outb(0x3f8 + 1, 0x00);
outb(0x3f8 + 3, 0x80);
outb(0x3f8 + 0, 0x03);
outb(0x3f8 + 1, 0x00);
outb(0x3f8 + 3, 0x03);
outb(0x3f8 + 2, 0xC7);
outb(0x3f8 + 4, 0x0B);
}
static int is_transmit_empty(void)
{
return inb(0x3f8 + 5) & 0x20;
}
void serial_put(char ch)
{
while (is_transmit_empty() == 0)
;
outb(0x3f8, (u8)ch);
}
void serial_print(const char *data)
{
for (u32 i = 0; i < strlen(data); i++)
serial_put(data[i]);
}
|