littleosbook / littleosbook

Source for the little book about OS development
http://littleosbook.github.io/
2.21k stars 241 forks source link

4.3.2 Configuring the Line: high byte should go in base + 1 port #38

Open andrewnguyen opened 9 years ago

andrewnguyen commented 9 years ago

4.3.2 has the code listing:

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);
}

but according to http://wiki.osdev.org/Serial_ports the high byte should go into the base+1 port.

BizzyIzDizzy commented 7 years ago

I believe you are correct: UART registers Check Divisor Latch Low Byte and Divisor Latch High Byte.