| 7 | #define PORT 0x3F8 // COM 1 |
| 8 | |
| 9 | void initialize_serial() { |
| 10 | outportb(PORT + 1, 0x00); // Disable all interrupts |
| 11 | outportb(PORT + 3, 0x80); // Enable DLAB (set baud rate divisor) |
| 12 | outportb(PORT + 0, 0x03); // Set divisor to 3 (lo byte) 38400 baud |
| 13 | outportb(PORT + 1, 0x00); // (hi byte) |
| 14 | outportb(PORT + 3, 0x03); // 8 bits, no parity, one stop bit |
| 15 | outportb(PORT + 2, 0xC7); // Enable FIFO, clear them, with 14-byte threshold |
| 16 | outportb(PORT + 4, 0x0B); // IRQs enabled, RTS/DSR set |
| 17 | } |
| 18 | |
| 19 | int is_transmit_empty() { |
| 20 | return inportb(PORT + 5) & 0x20; |
no test coverage detected