Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 27 Sep 2010 15:55:30 +0000 (UTC)
From:      Bernd Walter <ticso@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r213201 - head/sys/arm/at91
Message-ID:  <201009271555.o8RFtUTl041093@svn.freebsd.org>

next in thread | raw e-mail | index | archive | help
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);
 				}
 			}



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