-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathserial.c
47 lines (42 loc) · 932 Bytes
/
serial.c
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
36
37
38
39
40
41
42
43
44
45
46
47
#include <type.h>
#include <io.h>
#include <console.h>
#include <serial.h>
#include <uart.h>
struct console serialcon;
/* The serial port meta-driver */
void serial_console_start(struct console *c)
{
//Interrupt register here.
return;
}
int serial_console_write(struct console *c,char *p,u32 len)
{
while (len)
{
serial_write(c->data.data,*p++);
len--;
}
return len;
}
int serial_console_write_str(struct console *c,char *p)
{
while (*p)
{
serial_write(c->data.data,*p++);
}
return 1;
}
int serial_console_read(struct console *c,char *p,u32 len)
{
//To be implented.
return len;
}
void serial_default_console_init(int port)
{
serialcon.data.data = port;
serialcon.console_cap = 0xff;
serialcon.console_write = serial_console_write;
serialcon.console_write_str = serial_console_write_str;
serialcon.console_read = serial_console_read;
}