PERFORCE change 105982 for review
Warner Losh
imp at FreeBSD.org
Mon Sep 11 13:03:05 PDT 2006
http://perforce.freebsd.org/chv.cgi?CH=105982
Change 105982 by imp at imp_lighthouse on 2006/09/11 20:02:30
Revert back to baseline for further debugging.
Affected files ...
.. //depot/projects/arm/src/sys/arm/at91/at91_twi.c#24 edit
Differences ...
==== //depot/projects/arm/src/sys/arm/at91/at91_twi.c#24 (text+ko) ====
@@ -131,8 +131,8 @@
WR4(sc, TWI_CR, TWI_CR_SWRST);
WR4(sc, TWI_CR, TWI_CR_MSEN | TWI_CR_SVDIS);
WR4(sc, TWI_CWGR, sc->cwgr);
- WR4(sc, TWI_IER, TWI_SR_RXRDY | TWI_SR_OVRE | TWI_SR_UNRE |
- TWI_SR_NACK);
+// WR4(sc, TWI_IER, TWI_SR_RXRDY | TWI_SR_OVRE | TWI_SR_UNRE |
+// TWI_SR_NACK);
if ((sc->iicbus = device_add_child(dev, "iicbus", -1)) == NULL)
device_printf(dev, "could not allocate iicbus instance\n");
@@ -229,9 +229,9 @@
int err = 0;
int counter = 10000;
- while (!(RD4(sc, TWI_SR) & bit) && counter-- != 0)
- continue;
- if (counter == 0)
+ while (!(RD4(sc, TWI_SR) & bit) && counter-- >= 0)
+ DELAY(10);
+ if (counter <= 0)
err = EIO;
return (err);
}
@@ -297,7 +297,7 @@
WR4(sc, TWI_MMR, ~TWI_MMR_MREAD & RD4(sc, TWI_MMR));
WR4(sc, TWI_CR, TWI_CR_START);
sc->sc_started = 1;
- WR4(sc, TWI_IER, TWI_SR_TXRDY);
+// WR4(sc, TWI_IER, TWI_SR_TXRDY);
while (len--) {
WR4(sc, TWI_THR, *walker++);
while (!(sc->flags & TXRDY)) {
@@ -327,7 +327,7 @@
WR4(sc, TWI_MMR, TWI_MMR_MREAD | RD4(sc, TWI_MMR));
WR4(sc, TWI_CR, TWI_CR_START);
sc->sc_started = 1;
- WR4(sc, TWI_IER, TWI_SR_RXRDY);
+// WR4(sc, TWI_IER, TWI_SR_RXRDY);
while (len-- > 0) {
err = 0;
while (!(sc->flags & RXRDY)) {
@@ -446,8 +446,10 @@
while (len--) {
if (len == 0)
WR4(sc, TWI_CR, TWI_CR_STOP);
- if (!at91_twi_wait(sc, TWI_SR_RXRDY))
+ if (!at91_twi_wait(sc, TWI_SR_RXRDY)) {
+ printf("1\n");
return (EIO);
+ }
*buf++ = RD4(sc, TWI_RHR) & 0xff;
}
} else {
@@ -455,12 +457,16 @@
WR4(sc, TWI_THR, *buf++);
if (len == 0)
WR4(sc, TWI_CR, TWI_CR_STOP);
- if (!at91_twi_wait(sc, TWI_SR_TXRDY))
+ if (!at91_twi_wait(sc, TWI_SR_TXRDY)) {
+ printf("3\n");
return (EIO);
+ }
}
}
- if (!at91_twi_wait(sc, TWI_SR_TXCOMP))
+ if (!at91_twi_wait(sc, TWI_SR_TXCOMP)) {
+ printf("2\n");
return (EIO);
+ }
}
return (0);
}
More information about the p4-projects
mailing list