blob: d02eaefd3530e8cde9b00cf82ecbd523337ac648 [file] [log] [blame]
Eric Biedermanb138ac82003-04-22 18:44:01 +00001static void outb(unsigned char value, unsigned short port)
2{
3 __builtin_outb(value, port);
4}
5
6static unsigned char inb(unsigned short port)
7{
8 return __builtin_inb(port);
9}
10static int uart_can_tx_byte(void)
11{
12 return inb(0x3f8 + 0x05) & 0x20;
13}
14
15static void uart_wait_to_tx_byte(void)
16{
17 while(!uart_can_tx_byte())
18 ;
19}
20
21static void uart_wait_until_sent(void)
22{
23 while(!(inb(0x3f8 + 0x05) & 0x40))
24 ;
25}
26
27static void uart_tx_byte(unsigned char data)
28{
29 uart_wait_to_tx_byte();
30 outb(data, 0x3f8 + 0x00);
31
32 uart_wait_until_sent();
33}
34
35static void print_debug(const char *str)
36{
37 unsigned char ch;
38 while((ch = *str++) != '\0') {
39 uart_tx_byte(ch);
40 }
41}
42
43static void main(void)
44{
45 print_debug("one\r\n");
46 print_debug("two\r\n");
47}