/** * Configures the baud rate of the given serial port. The base clock rate is 115200 bps * * @param com: The serial port to configure * @param divisor: the divisor. */ void serial_configure_baud_rate(unsigned short com, unsigned char divisor) { outb(SERIAL_IRQ_COMMAND_PORT(com), 0); // Disable all interrupts outb(SERIAL_LINE_COMMAND_PORT(com), SERIAL_LINE_ENABLE_DLAB); outb(SERIAL_BAUD_RATE_LOW_PORT(com), divisor); outb(SERIAL_BAUD_RATE_HIGH_PORT(com), 0); }
void serial_configure_baud_rate(unsigned short com, unsigned short divisor){ outb(SERIAL_LINE_COMMAND_PORT(com), SERIAL_LINE_ENABLE_DLAB); //saying take high byte first outb(SERIAL_DATA_PORT(com), (divisor >> 8) & 0x00FF);//so you force the top 8 bits first outb(SERIAL_DATA_PORT(com), divisor & 0x00FF);//then the low 8 bits }
void serial_configure_line(unsigned short com){ /*Bit: |7 |6 |5 4 3 | 2 | 1 0 | * |d |b | prty | s | d1 | * |0 |0 |0 0 0 | 0 | 1 1 | = 0x03 */ outb(SERIAL_LINE_COMMAND_PORT(com), 0x03); }
void serial_configure_baud_rate(unsigned short com, unsigned short divisor) { outb(SERIAL_LINE_COMMAND_PORT(com), SERIAL_LINE_ENABLE_DLAB); outb(SERIAL_DATA_PORT(com), (divisor >> 8) & 0x00FF); outb(SERIAL_DATA_PORT(com), divisor & 0x00FF); }
/** serial_configure_line * * Configures the line of the given serial port. The port is set to have a * data lenght of 8 bits, no parity bits, one stop bits and break control * disabled. */ void serial_configure_line(unsigned short com, unsigned char config) { outb(SERIAL_LINE_COMMAND_PORT(com), config); }
void serial_configure_bit_rate(uint16_t com, uint16_t divisor){ outb(SERIAL_LINE_COMMAND_PORT(com), SERIAL_LINE_ENABLE_DLAB); outb(SERIAL_DATA_PORT(com), (divisor >> 8) & 0x00FF); outb(SERIAL_DATA_PORT(com), divisor & 0x00FF); }
void serial_configure_line(uint16_t com){ outb(SERIAL_LINE_COMMAND_PORT(com), 0x03); }