25 lines
834 B
C
25 lines
834 B
C
#ifndef SERIAL_H
|
|
#define SERIAL_H
|
|
/* All the I/O ports are calculated relative to the data port. This is
|
|
because all serial ports have their ports in the same order but they
|
|
start at different values.
|
|
*/
|
|
|
|
#define COM1_PORT 0x3F8
|
|
|
|
#define SERIAL_DATA_PORT(base) (base)
|
|
#define SERIAL_FIFO_COMMAND_PORT(base) (base + 2)
|
|
#define SERIAL_LINE_COMMAND_PORT(base) (base + 3)
|
|
#define SERIAL_MODEM_COMMAND_PORT(base) (base + 4)
|
|
#define SERIAL_LINE_STATUS_PORT(base) (base + 5)
|
|
|
|
// Tells the serial port to expect the highest 8 bits on the data port first,
|
|
// followed by the lowest 8 bits.
|
|
#define SERIAL_LINE_ENABLE_DLAB 0x80
|
|
|
|
void set_serial_baud_rate(unsigned short, unsigned short);
|
|
void configure_serial_line(unsigned short);
|
|
int serial_transmit_fifo_empty(unsigned int);
|
|
void write_to_com(unsigned int, char*);
|
|
#endif
|