summaryrefslogtreecommitdiffstats
path: root/firmware
diff options
context:
space:
mode:
authorLinus Nielsen Feltzing <linus@haxx.se>2002-06-12 09:28:22 +0000
committerLinus Nielsen Feltzing <linus@haxx.se>2002-06-12 09:28:22 +0000
commita4058ec28ac8a53f4c18e76580fb9b2321ec1322 (patch)
treef56dc99190955e8b23e76bdde58beaa40ce31f72 /firmware
parent1165b9a63fc6151c742267bda665833ca0fd3088 (diff)
downloadrockbox-a4058ec28ac8a53f4c18e76580fb9b2321ec1322.tar.gz
rockbox-a4058ec28ac8a53f4c18e76580fb9b2321ec1322.zip
ata_read_sectors() couldn't read more that one sector
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@974 a1c6a512-1295-4272-9138-f99709370657
Diffstat (limited to 'firmware')
-rw-r--r--firmware/drivers/ata.c7
1 files changed, 5 insertions, 2 deletions
diff --git a/firmware/drivers/ata.c b/firmware/drivers/ata.c
index 4a8e25b58d..7f4cb270f8 100644
--- a/firmware/drivers/ata.c
+++ b/firmware/drivers/ata.c
@@ -24,6 +24,7 @@
#include "system.h"
#include "debug.h"
+#define SECTOR_SIZE 512
#define ATA_DATA (*((volatile unsigned short*)0x06104100))
#define ATA_ERROR (*((volatile unsigned char*)0x06100101))
#define ATA_FEATURE ATA_ERROR
@@ -127,13 +128,14 @@ int ata_read_sectors(unsigned long start,
return -1;
}
- for (j=0; j<256; j++)
+ for (j=0; j<SECTOR_SIZE/2; j++)
((unsigned short*)buf)[j] = SWAB16(ATA_DATA);
#ifdef USE_INTERRUPT
/* reading the status register clears the interrupt */
j = ATA_STATUS;
#endif
+ buf += SECTOR_SIZE; /* Advance one sector */
}
led(false);
@@ -177,13 +179,14 @@ int ata_write_sectors(unsigned long start,
return 0;
}
- for (j=0; j<256; j++)
+ for (j=0; j<SECTOR_SIZE/2; j++)
ATA_DATA = SWAB16(((unsigned short*)buf)[j]);
#ifdef USE_INTERRUPT
/* reading the status register clears the interrupt */
j = ATA_STATUS;
#endif
+ buf += SECTOR_SIZE;
}
led(false);