From: Stefan Weil <weil@mail.berlios.de>
To: qemu-devel@nongnu.org
Subject: [Qemu-devel] [PATCH] serial: Add missing bit
Date: Mon, 26 Oct 2009 21:51:41 +0100 [thread overview]
Message-ID: <1256590301-18483-1-git-send-email-weil@mail.berlios.de> (raw)
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>
---
hw/serial.c | 8 +++++---
1 files changed, 5 insertions(+), 3 deletions(-)
diff --git a/hw/serial.c b/hw/serial.c
index eb14f11..7552fee 100644
--- a/hw/serial.c
+++ b/hw/serial.c
@@ -231,15 +231,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;
@@ -696,12 +698,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);
--
1.5.6.5
reply other threads:[~2009-10-26 20:51 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1256590301-18483-1-git-send-email-weil@mail.berlios.de \
--to=weil@mail.berlios.de \
--cc=qemu-devel@nongnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).