#include #include "serial.h" int comport = 0; #define SER_LATCH_LO 0 #define SER_LATCH_HI 1 #define SER_TX 0 #define SER_LCR 3 #define SER_LSR 5 void ser_init(int port, int baudrate, int protocol) { int far *comport_addr = MK_FP(0x0040, 0x0000); int lcr; comport = comport_addr[port]; outp(comport + SER_LCR, 0x80); outp(comport + SER_LATCH_HI, baudrate >> 8); outp(comport + SER_LATCH_LO, baudrate & 0xff); outp(comport + SER_LCR, protocol); } void ser_write_byte(char byte) { while (!(inp(comport + SER_LSR) & 0x20)) {} outp(comport + SER_TX, byte); } void ser_write(char *str) { for (; *str; str ++) { ser_write_byte(*str); } }