summaryrefslogtreecommitdiff
path: root/firmware
diff options
context:
space:
mode:
authorBjörn Stenberg <bjorn@haxx.se>2002-08-14 14:34:54 +0000
committerBjörn Stenberg <bjorn@haxx.se>2002-08-14 14:34:54 +0000
commited027a9d59e665f14d573d673092906f2ab61f98 (patch)
treef8f0ae67122af5891622cf0174ba84473f1e354b /firmware
parent7bd9d0ab89a02bbc31655f6a9c51517ec0d7d302 (diff)
downloadrockbox-ed027a9d59e665f14d573d673092906f2ab61f98.tar.gz
rockbox-ed027a9d59e665f14d573d673092906f2ab61f98.zip
Allow (slow) reading to odd address
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@1734 a1c6a512-1295-4272-9138-f99709370657
Diffstat (limited to 'firmware')
-rw-r--r--firmware/drivers/ata.c17
1 files changed, 15 insertions, 2 deletions
diff --git a/firmware/drivers/ata.c b/firmware/drivers/ata.c
index 29d2851875..9d5e02dc34 100644
--- a/firmware/drivers/ata.c
+++ b/firmware/drivers/ata.c
@@ -145,6 +145,8 @@ int ata_read_sectors(unsigned long start,
145 int i; 145 int i;
146 int ret = 0; 146 int ret = 0;
147 147
148 DEBUGF("ata_read(%X,%d,%X)\n",start,count,buf);
149
148#ifndef USE_STANDBY 150#ifndef USE_STANDBY
149 if ( sleeping ) { 151 if ( sleeping ) {
150#ifdef USE_POWEROFF 152#ifdef USE_POWEROFF
@@ -184,8 +186,19 @@ int ata_read_sectors(unsigned long start,
184 return -1; 186 return -1;
185 } 187 }
186 188
187 for (j=0; j<SECTOR_SIZE/2; j++) 189 /* if destination address is odd, use byte copying,
188 ((unsigned short*)buf)[j] = SWAB16(ATA_DATA); 190 otherwise use word copying */
191 if ( (unsigned int)buf & 1 ) {
192 for (j=0; j<SECTOR_SIZE/2; j++) {
193 unsigned short tmp = SWAB16(ATA_DATA);
194 ((unsigned char*)buf)[j*2] = tmp >> 8;
195 ((unsigned char*)buf)[j*2+1] = tmp & 0xff;
196 }
197 }
198 else {
199 for (j=0; j<SECTOR_SIZE/2; j++)
200 ((unsigned short*)buf)[j] = SWAB16(ATA_DATA);
201 }
189 202
190#ifdef USE_INTERRUPT 203#ifdef USE_INTERRUPT
191 /* reading the status register clears the interrupt */ 204 /* reading the status register clears the interrupt */