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.tar.gz
rockbox-7d8598f30e68aee6766bfc1272834d45f3bfa9b4.zip
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 0faf431836..159b007f64 100644
--- a/firmware/drivers/ata_mmc.c
+++ b/firmware/drivers/ata_mmc.c
@@ -242,18 +242,24 @@ static unsigned char poll_byte(int timeout)
242static unsigned char poll_busy(int timeout) 242static unsigned char poll_busy(int timeout)
243{ 243{
244 int i; 244 int i;
245 unsigned char data; 245 unsigned char data, dummy;
246 246
247 while (!(SSR1 &SCI_TEND)); /* wait for end of transfer */ 247 while (!(SSR1 &SCI_TEND)); /* wait for end of transfer */
248 TDR1 = 0xFF; /* send do-nothing data in parallel */ 248 TDR1 = 0xFF; /* send do-nothing data in parallel */
249 249
250 /* get data response */
251 SSR1 = 0; /* start receiving */
252 while (!(SSR1 & SCI_RDRF)); /* wait for data */
253 data = RDR1; /* read byte */
254
255 /* wait until the card is ready again */
250 i = 0; 256 i = 0;
251 do { 257 do {
252 SSR1 = 0; /* start receiving */ 258 SSR1 = 0; /* start receiving */
253 while (!(SSR1 & SCI_RDRF)); /* wait for data */ 259 while (!(SSR1 & SCI_RDRF)); /* wait for data */
254 data = RDR1; /* read byte */ 260 dummy = RDR1; /* read byte */
255 } while ((data == 0x00) && (++i < timeout)); 261 } while ((dummy != 0xFF) && (++i < timeout));
256 262
257 return fliptable[(signed char)data]; 263 return fliptable[(signed char)data];
258} 264}
259 265