Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 29 Jun 2006 20:48:56 GMT
From:      Warner Losh <imp@FreeBSD.org>
To:        Perforce Change Reviews <perforce@freebsd.org>
Subject:   PERFORCE change 100313 for review
Message-ID:  <200606292048.k5TKmuaQ020068@repoman.freebsd.org>

next in thread | raw e-mail | index | archive | help
http://perforce.freebsd.org/chv.cgi?CH=100313

Change 100313 by imp@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



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200606292048.k5TKmuaQ020068>