1 /* Should support 8250, 16450, 16550, 16550A type uarts */
23 static inline int uart8250_can_tx_byte(unsigned base_port)
25 return inb(base_port + UART_LSR) & 0x20;
28 static inline void uart8250_wait_to_tx_byte(unsigned base_port)
30 while(!uart8250_can_tx_byte(base_port))
34 static inline void uart8250_wait_until_sent(unsigned base_port)
36 while(!(inb(base_port + UART_LSR) & 0x40))
40 void uart8250_tx_byte(unsigned base_port, unsigned char data)
42 uart8250_wait_to_tx_byte(base_port);
43 outb(data, base_port + UART_TBR);
44 /* Make certain the data clears the fifos */
45 uart8250_wait_until_sent(base_port);
48 void uart8250_init(unsigned base_port, unsigned divisor, unsigned lcs)
51 /* disable interrupts */
52 outb(0x0, base_port + UART_IER);
54 outb(0x01, base_port + UART_FCR);
55 /* Set Baud Rate Divisor to 12 ==> 115200 Baud */
56 outb(0x80 | lcs, base_port + UART_LCR);
57 outb(divisor & 0xFF, base_port + UART_DLL);
58 outb((divisor >> 8) & 0xFF, base_port + UART_DLM);
59 outb(lcs, base_port + UART_LCR);