summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJens Arnold <amiconn@rockbox.org>2004-09-29 22:44:02 +0000
committerJens Arnold <amiconn@rockbox.org>2004-09-29 22:44:02 +0000
commit7d8598f30e68aee6766bfc1272834d45f3bfa9b4 (patch)
treefbb0e3df332eb6af484a482e1d75dc865e0d80d0
parent4e4231069ac7c0eac28443355ca9a6905823ea53 (diff)
downloadrockbox-7d8598f30e68aee6766bfc1272834d45f3bfa9b4.zip
rockbox-7d8598f30e68aee6766bfc1272834d45f3bfa9b4.tar.gz
rockbox-7d8598f30e68aee6766bfc1272834d45f3bfa9b4.tar.bz2
rockbox-7d8598f30e68aee6766bfc1272834d45f3bfa9b4.tar.xz
Writing to mmc does work now, but not always correct yet. It caused a corrupt file system once, so beware
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@5132 a1c6a512-1295-4272-9138-f99709370657
-rw-r--r--firmware/drivers/ata_mmc.c16
1 files changed, 11 insertions, 5 deletions
diff --git a/firmware/drivers/ata_mmc.c b/firmware/drivers/ata_mmc.c
index 0faf431..159b007 100644
--- a/firmware/drivers/ata_mmc.c
+++ b/firmware/drivers/ata_mmc.c
@@ -242,18 +242,24 @@ static unsigned char poll_byte(int timeout)
static unsigned char poll_busy(int timeout)
{
int i;
- unsigned char data;
+ unsigned char data, dummy;
while (!(SSR1 &SCI_TEND)); /* wait for end of transfer */
TDR1 = 0xFF; /* send do-nothing data in parallel */
-
+
+ /* get data response */
+ SSR1 = 0; /* start receiving */
+ while (!(SSR1 & SCI_RDRF)); /* wait for data */
+ data = RDR1; /* read byte */
+
+ /* wait until the card is ready again */
i = 0;
do {
SSR1 = 0; /* start receiving */
while (!(SSR1 & SCI_RDRF)); /* wait for data */
- data = RDR1; /* read byte */
- } while ((data == 0x00) && (++i < timeout));
-
+ dummy = RDR1; /* read byte */
+ } while ((dummy != 0xFF) && (++i < timeout));
+
return fliptable[(signed char)data];
}