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
This commit is contained in:
parent
4e4231069a
commit
7d8598f30e
1 changed files with 11 additions and 5 deletions
|
@ -242,17 +242,23 @@ static unsigned char poll_byte(int timeout)
|
||||||
static unsigned char poll_busy(int timeout)
|
static unsigned char poll_busy(int timeout)
|
||||||
{
|
{
|
||||||
int i;
|
int i;
|
||||||
unsigned char data;
|
unsigned char data, dummy;
|
||||||
|
|
||||||
while (!(SSR1 &SCI_TEND)); /* wait for end of transfer */
|
while (!(SSR1 &SCI_TEND)); /* wait for end of transfer */
|
||||||
TDR1 = 0xFF; /* send do-nothing data in parallel */
|
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;
|
i = 0;
|
||||||
do {
|
do {
|
||||||
SSR1 = 0; /* start receiving */
|
SSR1 = 0; /* start receiving */
|
||||||
while (!(SSR1 & SCI_RDRF)); /* wait for data */
|
while (!(SSR1 & SCI_RDRF)); /* wait for data */
|
||||||
data = RDR1; /* read byte */
|
dummy = RDR1; /* read byte */
|
||||||
} while ((data == 0x00) && (++i < timeout));
|
} while ((dummy != 0xFF) && (++i < timeout));
|
||||||
|
|
||||||
return fliptable[(signed char)data];
|
return fliptable[(signed char)data];
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue