summaryrefslogtreecommitdiffstats
path: root/firmware
diff options
context:
space:
mode:
authorDaniel Ankers <dan@weirdo.org.uk>2007-02-04 03:20:36 +0000
committerDaniel Ankers <dan@weirdo.org.uk>2007-02-04 03:20:36 +0000
commit67ec6177a7ed1934cf2ef97f0863c07f40498cc8 (patch)
tree255ff7ceea5364c0507589e7e9c825b007a00318 /firmware
parenta7af649766ff3a673783ac375a264ab69fbbe104 (diff)
downloadrockbox-67ec6177a7ed1934cf2ef97f0863c07f40498cc8.tar.gz
rockbox-67ec6177a7ed1934cf2ef97f0863c07f40498cc8.tar.bz2
rockbox-67ec6177a7ed1934cf2ef97f0863c07f40498cc8.zip
Work around a bug in the Sansa flash driver
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@12187 a1c6a512-1295-4272-9138-f99709370657
Diffstat (limited to 'firmware')
-rw-r--r--firmware/target/arm/sandisk/sansa-e200/ata-e200.c29
1 files changed, 8 insertions, 21 deletions
diff --git a/firmware/target/arm/sandisk/sansa-e200/ata-e200.c b/firmware/target/arm/sandisk/sansa-e200/ata-e200.c
index b94363e6b1..bfb0d27f97 100644
--- a/firmware/target/arm/sandisk/sansa-e200/ata-e200.c
+++ b/firmware/target/arm/sandisk/sansa-e200/ata-e200.c
@@ -267,27 +267,14 @@ static void copy_write_sectors(const unsigned char* buf, int wordcount)
static void copy_write_sectors(const unsigned char* buf, int wordcount)
{
- if ( (unsigned long)buf & 1)
- { /* not 16-bit aligned, copy byte by byte */
- unsigned short tmp = 0;
- const unsigned char* bufend = buf + wordcount*2;
- do
- {
- tmp = (unsigned short) *buf++;
- tmp |= (unsigned short) *buf++ << 8;
- DATA_REG = tmp;
- } while (buf < bufend); /* tail loop is faster */
- }
- else
- { /* 16-bit aligned, can do faster copy */
- unsigned short* wbuf = (unsigned short*)buf;
- unsigned short* wbufend = wbuf + wordcount;
- do
- {
- DATA_REG = *wbuf;
- asm volatile("nop\n\t");
- } while (++wbuf < wbufend); /* tail loop is faster */
- }
+ unsigned short tmp = 0;
+ const unsigned char* bufend = buf + wordcount*2;
+ do
+ {
+ tmp = (unsigned short) *buf++;
+ tmp |= (unsigned short) *buf++ << 8;
+ DATA_REG = tmp;
+ } while (buf < bufend); /* tail loop is faster */
}