projects
/
pintos-anon
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Make tests public. Rewrite most tests. Add tests.
[pintos-anon]
/
src
/
devices
/
serial.c
diff --git
a/src/devices/serial.c
b/src/devices/serial.c
index 8dc7f18cfbd0272b630e0d85c87abf119be23173..d92a87ce1540be2af42940622491a4a28be078c2 100644
(file)
--- a/
src/devices/serial.c
+++ b/
src/devices/serial.c
@@
-63,9
+63,9
@@
serial_init_poll (void)
ASSERT (mode == UNINIT);
outb (IER_REG, 0); /* Turn off all interrupts. */
outb (FCR_REG, 0); /* Disable FIFO. */
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 k
bps, N-8-1. */
outb (MCR_REG, MCR_OUT2); /* Turn on OUT2 output line. */
outb (MCR_REG, MCR_OUT2); /* Turn on OUT2 output line. */
- intq_init (&txq
, "serial xmit"
);
+ intq_init (&txq);
mode = POLL;
}
mode = POLL;
}
@@
-76,7
+76,7
@@
void
serial_init_queue (void)
{
ASSERT (mode == POLL);
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;
}
mode = QUEUE;
}
@@
-131,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. */
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);
/* Enable DLAB. */
outb (LCR_REG, LCR_N81 | LCR_DLAB);