#ifndef __SERIAL_H #define __SERIAL_H #define SERIAL_COM1_BASE 0x3F8 // com1 base port extern void init_serial(); /** serial_configure_baud_rate: * Sets the speed of the data being sent. The default speed of a serial * port is 115200 bits/s. The argument is a divisor of that number, hence * the resulting speed becomes (115200 / divisor) bits/s. * * @param com The COM port to configure * @param divisor The divisor */ extern void serial_configure_baud_rate(unsigned short com, unsigned short divisor); // configures line of a serial port extern void serial_configure_line(unsigned short com); // Bit: | 7 6 | 5 | 4 | 3 | 2 | 1 | 0 | // Content: | lvl | bs | r | dma | clt | clr | e | // 0xc7 /* *Enables FIFO *Clear both receiver and transmission FIFO queues *Use 14 bytes as size of queue */ extern void serial_configure_buffers(unsigned short com); // write data into the serial port extern void serial_write(unsigned short com, char data); // configure the modem of our serial port // Bit: | 7 | 6 | 5 | 4 | 3 | 2 | 1 | 0 | // Content: | r | r | af | lb | ao2 | ao1 | rts | dtr | extern void serial_configure_modem(unsigned short com); /** serial_is_transmit_fifo_empty: * Checks whether the transmit FIFO queue is empty or not for the given COM * port. * * @param com The COM port * @return 0 if the transmit FIFO queue is not empty * 1 if the transmit FIFO queue is empty */ extern int serial_is_trasmit_fifo_empty(unsigned short com); extern void serial_print(char *string); // print out over a serial port // printf style func for serial port void serial_printf(char *format, ...); #endif