PERFORCE change 100313 for review
Warner Losh
imp at FreeBSD.org
Thu Jun 29 20:49:02 UTC 2006
http://perforce.freebsd.org/chv.cgi?CH=100313
Change 100313 by imp at imp_lighthouse on 2006/06/29 20:48:51
Set number of stop bits correctly, or at least more correctly,
rather than always setting it to 2. We note that it appears
that the only time 1.5 stop bits were used was on 5-bit
BAUDOT, so if 2 stop bits are requested, use 1.5 bits for 5-bit
characters.
Affected files ...
.. //depot/projects/arm/src/sys/arm/at91/uart_dev_at91usart.c#32 edit
Differences ...
==== //depot/projects/arm/src/sys/arm/at91/uart_dev_at91usart.c#32 (text+ko) ====
@@ -160,16 +160,19 @@
}
/*
- * Or in the stop bits. Note: The hardware supports
- * 1.5 stop bits in async mode, but there's no way to
- * specify that AFAICT.
+ * Or in the stop bits. Note: The hardware supports 1.5 stop
+ * bits in async mode, but there's no way to specify that
+ * AFAICT. Instead, rely on the convention documented at
+ * http://www.lammertbies.nl/comm/info/RS-232_specs.html which
+ * states that 1.5 stop bits are used for 5 bit bytes and
+ * 2 stop bits only for longer bytes.
*/
- if (stopbits > 1)
+ if (stopbits == 1)
+ mr |= USART_MR_NBSTOP_1;
+ else if (databits > 5)
mr |= USART_MR_NBSTOP_2;
else
- mr |= USART_MR_NBSTOP_2;
- /* else if (stopbits == 1.5)
- mr |= USART_MR_NBSTOP_1_5; */
+ mr |= USART_MR_NBSTOP_1_5;
/*
* We want normal plumbing mode too, none of this fancy
More information about the p4-projects
mailing list