summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorStefan Weil <weil@mail.berlios.de>2009-10-26 21:51:41 +0100
committerAnthony Liguori <aliguori@us.ibm.com>2009-10-30 08:39:32 -0500
commit930c141151225133c9447325cc484ef21ca8cbe6 (patch)
treec7b395919fd38e8909a213b71c97f73a12758ce2
parent2ea9444ad33cce943df240d92402e7a71c7fe816 (diff)
downloadqemu-930c141151225133c9447325cc484ef21ca8cbe6.tar.gz
qemu-930c141151225133c9447325cc484ef21ca8cbe6.tar.bz2
qemu-930c141151225133c9447325cc484ef21ca8cbe6.zip
serial: Add missing bit
Serial frames always start with a start bit. This bit was missing in frame size calculation. Signed-off-by: Stefan Weil <weil@mail.berlios.de> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
-rw-r--r--hw/serial.c8
1 files changed, 5 insertions, 3 deletions
diff --git a/hw/serial.c b/hw/serial.c
index 86ac543ecd..9353201c5d 100644
--- a/hw/serial.c
+++ b/hw/serial.c
@@ -232,15 +232,17 @@ static void serial_update_parameters(SerialState *s)
if (s->divider == 0)
return;
+ /* Start bit. */
frame_size = 1;
if (s->lcr & 0x08) {
+ /* Parity bit. */
+ frame_size++;
if (s->lcr & 0x10)
parity = 'E';
else
parity = 'O';
} else {
parity = 'N';
- frame_size = 0;
}
if (s->lcr & 0x04)
stop_bits = 2;
@@ -692,12 +694,12 @@ static void serial_reset(void *opaque)
s->lcr = 0;
s->lsr = UART_LSR_TEMT | UART_LSR_THRE;
s->msr = UART_MSR_DCD | UART_MSR_DSR | UART_MSR_CTS;
- /* Default to 9600 baud, no parity, one stop bit */
+ /* Default to 9600 baud, 1 start bit, 8 data bits, 1 stop bit, no parity. */
s->divider = 0x0C;
s->mcr = UART_MCR_OUT2;
s->scr = 0;
s->tsr_retry = 0;
- s->char_transmit_time = (get_ticks_per_sec() / 9600) * 9;
+ s->char_transmit_time = (get_ticks_per_sec() / 9600) * 10;
s->poll_msl = 0;
fifo_clear(s,RECV_FIFO);