projects
/
pintos-anon
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Check that the serial rate is reasonable.
[pintos-anon]
/
src
/
devices
/
serial.c
diff --git
a/src/devices/serial.c
b/src/devices/serial.c
index 1d0607ba0006b91f3d93770136d596bb3e969e59..099b22841efeafd4289f718210ffb592f8148f57 100644
(file)
--- a/
src/devices/serial.c
+++ b/
src/devices/serial.c
@@
-9,7
+9,9
@@
\f
/* Register definitions for the 16550A UART used in PCs.
The 16550A has a lot more going on than shown here, but this
\f
/* 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
/* I/O port base address for the first serial port. */
#define IO_BASE 0x3f8
@@
-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. */
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);