13 #define SER_LCR_DLAB 0x80
16 #define SER_LSR_THR_EMPTY 0x20
20 #define SER_BAUD_BASE 115200
21 #define SER_BAUD_REQ 115200
23 void _outb(unsigned short port, unsigned char d)
25 outb(SER_BASE + port, d);
28 unsigned char _inb(unsigned short port)
30 return inb(SER_BASE + port);
35 unsigned short baud = SER_BAUD_REQ / SER_BAUD_BASE;
36 _outb(SER_LCR, _inb(SER_LCR) | SER_LCR_DLAB);
37 _outb(SER_DLL, baud & 0xFF);
38 _outb(SER_DLM, baud >> 8);
39 _outb(SER_LCR, _inb(SER_LCR) & ~SER_LCR_DLAB);
41 _outb(SER_FCR, 0x0); /* FIFOs off */
42 _outb(SER_LCR, 0x03); /* 8 data bits, one stop bit, no parity */
45 void serial_tx(unsigned char c)
47 while (!(_inb(SER_LSR) & SER_LSR_THR_EMPTY))