svn commit: r213201 - head/sys/arm/at91

Bernd Walter ticso at FreeBSD.org
Mon Sep 27 15:55:31 UTC 2010


Author: ticso
Date: Mon Sep 27 15:55:30 2010
New Revision: 213201
URL: http://svn.freebsd.org/changeset/base/213201

Log:
  fix off by one error for twi reads with len != 1.
  STOP must be requested before the last byte is received.

Modified:
  head/sys/arm/at91/at91_twi.c

Modified: head/sys/arm/at91/at91_twi.c
==============================================================================
--- head/sys/arm/at91/at91_twi.c	Mon Sep 27 15:24:16 2010	(r213200)
+++ head/sys/arm/at91/at91_twi.c	Mon Sep 27 15:55:30 2010	(r213201)
@@ -348,7 +348,7 @@ at91_twi_transfer(device_t dev, struct i
 				if ((sr = RD4(sc, TWI_SR)) & TWI_SR_RXRDY) {
 					len--;
 					*buf++ = RD4(sc, TWI_RHR) & 0xff;
-					if (len == 0 && msgs[i].len != 1)
+					if (len == 1)
 						WR4(sc, TWI_CR, TWI_CR_STOP);
 				}
 			}


More information about the svn-src-head mailing list