This source file includes following definitions.
- serial_in
- serial_out
- prom_putchar
1
2
3
4
5
6
7
8 #include <linux/serial_reg.h>
9 #include <asm/setup.h>
10
11 #include <loongson.h>
12
13 #define PORT(base, offset) (u8 *)(base + offset)
14
15 static inline unsigned int serial_in(unsigned char *base, int offset)
16 {
17 return readb(PORT(base, offset));
18 }
19
20 static inline void serial_out(unsigned char *base, int offset, int value)
21 {
22 writeb(value, PORT(base, offset));
23 }
24
25 void prom_putchar(char c)
26 {
27 int timeout;
28 unsigned char *uart_base;
29
30 uart_base = (unsigned char *)_loongson_uart_base[0];
31 timeout = 1024;
32
33 while (((serial_in(uart_base, UART_LSR) & UART_LSR_THRE) == 0) &&
34 (timeout-- > 0))
35 ;
36
37 serial_out(uart_base, UART_TX, c);
38 }