1
0
Fork 0
forked from len0rd/rockbox

Read byte by byte rather than DMA for unaligned transfer

git-svn-id: svn://svn.rockbox.org/rockbox/trunk@11927 a1c6a512-1295-4272-9138-f99709370657
This commit is contained in:
Greg White 2007-01-06 01:26:36 +00:00
parent e370776120
commit ebcd762fb2

View file

@ -54,6 +54,19 @@ void ata_device_init(void)
void copy_read_sectors(unsigned char* buf, int wordcount) void copy_read_sectors(unsigned char* buf, int wordcount)
{ {
/* Unaligned transfer - slow copy */
if ( (unsigned long)buf & 1)
{ /* not 16-bit aligned, copy byte by byte */
unsigned short tmp = 0;
unsigned char* bufend = buf + wordcount*2;
do
{
tmp = ATA_DATA;
*buf++ = tmp & 0xff; /* I assume big endian */
*buf++ = tmp >> 8; /* and don't use the SWAB16 macro */
} while (buf < bufend); /* tail loop is faster */
return;
}
/* This should never happen, but worth watching for */ /* This should never happen, but worth watching for */
if(wordcount > (1 << 18)) if(wordcount > (1 << 18))
panicf("atd-meg-fx.c: copy_read_sectors: too many sectors per read!"); panicf("atd-meg-fx.c: copy_read_sectors: too many sectors per read!");