2 static char rcsid[] = "$Id$";
5 /* Should support 8250, 16450, 16550, 16550A type uarts */
27 static inline int uart8250_can_tx_byte(unsigned base_port)
29 return inb(base_port + UART_LSR) & 0x20;
32 static inline void uart8250_wait_to_tx_byte(unsigned base_port)
34 while(!uart8250_can_tx_byte(base_port))
38 static inline void uart8250_wait_until_sent(unsigned base_port)
40 while(!(inb(base_port + UART_LSR) & 0x40))
44 void uart8250_tx_byte(unsigned base_port, unsigned char data)
46 uart8250_wait_to_tx_byte(base_port);
47 outb(data, base_port + UART_TBR);
48 /* Make certain the data clears the fifos */
49 uart8250_wait_until_sent(base_port);
52 void uart8250_init(unsigned base_port, unsigned divisor, unsigned lcs)
55 /* disable interrupts */
56 outb(0x0, base_port + UART_IER);
58 outb(0x01, base_port + UART_FCR);
59 /* Set Baud Rate Divisor to 12 ==> 115200 Baud */
60 outb(0x80 | lcs, base_port + UART_LCR);
61 outb(divisor & 0xFF, base_port + UART_DLL);
62 outb((divisor >> 8) & 0xFF, base_port + UART_DLM);
63 outb(lcs, base_port + UART_LCR);