diff options
author | Tomasz Malesinski <tomal@rockbox.org> | 2007-09-22 22:53:29 +0000 |
---|---|---|
committer | Tomasz Malesinski <tomal@rockbox.org> | 2007-09-22 22:53:29 +0000 |
commit | 7d1eeddf93bc1ba23c348b6f64742b3fce85420f (patch) | |
tree | 0a3f35a46bcf08c38957f704eb68ec14ce0b83b5 /firmware/drivers/ata_flash.c | |
parent | 8f8dbf47426e59328dda394b15db6fac2442e8e1 (diff) |
ata_flash.c: write 32 bits to the buffer at a time when reading a sector.
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@14822 a1c6a512-1295-4272-9138-f99709370657
Diffstat (limited to 'firmware/drivers/ata_flash.c')
-rw-r--r-- | firmware/drivers/ata_flash.c | 26 |
1 files changed, 24 insertions, 2 deletions
diff --git a/firmware/drivers/ata_flash.c b/firmware/drivers/ata_flash.c index ccdc8c2443..078cc6b494 100644 --- a/firmware/drivers/ata_flash.c +++ b/firmware/drivers/ata_flash.c @@ -149,6 +149,7 @@ int flash_read_id(int no) { int flash_read_sector(int sector, unsigned char* buf, unsigned char* oob) { + unsigned long *bufl = (unsigned long *)buf; int chip, chip_sector; int i; @@ -167,8 +168,29 @@ int flash_read_sector(int sector, unsigned char* buf, flash_wait_ready(); - for (i = 0; i < 512; i++) - buf[i] = flash_read_data(); + if ((unsigned long)buf & 3) + { + for (i = 0; i < 512; i++) + buf[i] = flash_read_data(); + } + else + { + for (i = 0; i < 512 / 4; i++) { + unsigned long v; +#ifdef ROCKBOX_LITTLE_ENDIAN + v = flash_read_data(); + v |= (unsigned long)flash_read_data() << 8; + v |= (unsigned long)flash_read_data() << 16; + v |= (unsigned long)flash_read_data() << 24; +#else + v = (unsigned long)flash_read_data() << 24; + v |= (unsigned long)flash_read_data() << 16; + v |= (unsigned long)flash_read_data() << 8; + v |= flash_read_data(); +#endif + bufl[i] = v; + } + } flash_write_cmd(0x05); flash_write_addr((chip_sector & 3) * 0x10); |