X-Git-Url: https://pintos-os.org/cgi-bin/gitweb.cgi?a=blobdiff_plain;f=src%2Fdevices%2Fserial.c;h=d92a87ce1540be2af42940622491a4a28be078c2;hb=af9c2002e29df71e9dcba3cfec7ba8284d7cef82;hp=1d0607ba0006b91f3d93770136d596bb3e969e59;hpb=605dc396d6dc9f2111e1c1938daa51e3f3bc75c3;p=pintos-anon diff --git a/src/devices/serial.c b/src/devices/serial.c index 1d0607b..d92a87c 100644 --- a/src/devices/serial.c +++ b/src/devices/serial.c @@ -9,7 +9,9 @@ /* Register definitions for the 16550A UART used in PCs. The 16550A has a lot more going on than shown here, but this - is all we need. */ + is all we need. + + Refer to [PC16650D] for hardware information. */ /* I/O port base address for the first serial port. */ #define IO_BASE 0x3f8 @@ -61,9 +63,9 @@ serial_init_poll (void) ASSERT (mode == UNINIT); outb (IER_REG, 0); /* Turn off all interrupts. */ outb (FCR_REG, 0); /* Disable FIFO. */ - set_serial (9600); /* 9600 bps, N-8-1. */ + set_serial (115200); /* 115.2 kbps, N-8-1. */ outb (MCR_REG, MCR_OUT2); /* Turn on OUT2 output line. */ - intq_init (&txq, "serial xmit"); + intq_init (&txq); mode = POLL; } @@ -74,7 +76,7 @@ void serial_init_queue (void) { ASSERT (mode == POLL); - intr_register (0x20 + 4, 0, INTR_OFF, serial_interrupt, "serial"); + intr_register_ext (0x20 + 4, serial_interrupt, "serial"); mode = QUEUE; } @@ -129,6 +131,8 @@ set_serial (int bps) int baud_base = 1843200 / 16; /* Base rate of 16550A. */ uint16_t divisor = baud_base / bps; /* Clock rate divisor. */ + ASSERT (bps >= 300 && bps <= 115200); + /* Enable DLAB. */ outb (LCR_REG, LCR_N81 | LCR_DLAB);