summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-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);