diff options
| author | Linus Nielsen Feltzing <linus@haxx.se> | 2002-06-12 09:28:22 +0000 |
|---|---|---|
| committer | Linus Nielsen Feltzing <linus@haxx.se> | 2002-06-12 09:28:22 +0000 |
| commit | a4058ec28ac8a53f4c18e76580fb9b2321ec1322 (patch) | |
| tree | f56dc99190955e8b23e76bdde58beaa40ce31f72 | |
| parent | 1165b9a63fc6151c742267bda665833ca0fd3088 (diff) | |
| download | rockbox-a4058ec28ac8a53f4c18e76580fb9b2321ec1322.zip rockbox-a4058ec28ac8a53f4c18e76580fb9b2321ec1322.tar.gz rockbox-a4058ec28ac8a53f4c18e76580fb9b2321ec1322.tar.bz2 rockbox-a4058ec28ac8a53f4c18e76580fb9b2321ec1322.tar.xz | |
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
| -rw-r--r-- | firmware/drivers/ata.c | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/firmware/drivers/ata.c b/firmware/drivers/ata.c index 4a8e25b..7f4cb27 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); |