summaryrefslogtreecommitdiff
path: root/firmware/drivers/ata.c
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/drivers/ata.c
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/drivers/ata.c')
-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 @@
24#include "system.h" 24#include "system.h"
25#include "debug.h" 25#include "debug.h"
26 26
27#define SECTOR_SIZE 512
27#define ATA_DATA (*((volatile unsigned short*)0x06104100)) 28#define ATA_DATA (*((volatile unsigned short*)0x06104100))
28#define ATA_ERROR (*((volatile unsigned char*)0x06100101)) 29#define ATA_ERROR (*((volatile unsigned char*)0x06100101))
29#define ATA_FEATURE ATA_ERROR 30#define ATA_FEATURE ATA_ERROR
@@ -127,13 +128,14 @@ int ata_read_sectors(unsigned long start,
127 return -1; 128 return -1;
128 } 129 }
129 130
130 for (j=0; j<256; j++) 131 for (j=0; j<SECTOR_SIZE/2; j++)
131 ((unsigned short*)buf)[j] = SWAB16(ATA_DATA); 132 ((unsigned short*)buf)[j] = SWAB16(ATA_DATA);
132 133
133#ifdef USE_INTERRUPT 134#ifdef USE_INTERRUPT
134 /* reading the status register clears the interrupt */ 135 /* reading the status register clears the interrupt */
135 j = ATA_STATUS; 136 j = ATA_STATUS;
136#endif 137#endif
138 buf += SECTOR_SIZE; /* Advance one sector */
137 } 139 }
138 140
139 led(false); 141 led(false);
@@ -177,13 +179,14 @@ int ata_write_sectors(unsigned long start,
177 return 0; 179 return 0;
178 } 180 }
179 181
180 for (j=0; j<256; j++) 182 for (j=0; j<SECTOR_SIZE/2; j++)
181 ATA_DATA = SWAB16(((unsigned short*)buf)[j]); 183 ATA_DATA = SWAB16(((unsigned short*)buf)[j]);
182 184
183#ifdef USE_INTERRUPT 185#ifdef USE_INTERRUPT
184 /* reading the status register clears the interrupt */ 186 /* reading the status register clears the interrupt */
185 j = ATA_STATUS; 187 j = ATA_STATUS;
186#endif 188#endif
189 buf += SECTOR_SIZE;
187 } 190 }
188 191
189 led(false); 192 led(false);