diff options
author | Stefan Weil <weil@mail.berlios.de> | 2009-10-26 21:51:41 +0100 |
---|---|---|
committer | Anthony Liguori <aliguori@us.ibm.com> | 2009-10-30 08:39:32 -0500 |
commit | 718b8aec624f4cf647f749305c582edc299ef9ab (patch) | |
tree | c7b395919fd38e8909a213b71c97f73a12758ce2 /hw/serial.c | |
parent | 45eea13b242c3671c2caa3bce93c77c1c0f5cbcc (diff) |
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>
Diffstat (limited to 'hw/serial.c')
-rw-r--r-- | hw/serial.c | 8 |
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); |