summaryrefslogtreecommitdiff
path: root/firmware/target/arm/gigabeat/meg-fx/ata-meg-fx.c
diff options
context:
space:
mode:
Diffstat (limited to 'firmware/target/arm/gigabeat/meg-fx/ata-meg-fx.c')
-rw-r--r--firmware/target/arm/gigabeat/meg-fx/ata-meg-fx.c11
1 files changed, 7 insertions, 4 deletions
diff --git a/firmware/target/arm/gigabeat/meg-fx/ata-meg-fx.c b/firmware/target/arm/gigabeat/meg-fx/ata-meg-fx.c
index 8e246045e6..00b5e09ed3 100644
--- a/firmware/target/arm/gigabeat/meg-fx/ata-meg-fx.c
+++ b/firmware/target/arm/gigabeat/meg-fx/ata-meg-fx.c
@@ -53,10 +53,11 @@ void ata_device_init(void)
53{ 53{
54} 54}
55 55
56#if !defined(BOOTLOADER)
56void copy_read_sectors(unsigned char* buf, int wordcount) 57void copy_read_sectors(unsigned char* buf, int wordcount)
57{ 58{
58 __buttonlight_trigger(); 59 __buttonlight_trigger();
59 60
60 /* Unaligned transfer - slow copy */ 61 /* Unaligned transfer - slow copy */
61 if ( (unsigned long)buf & 1) 62 if ( (unsigned long)buf & 1)
62 { /* not 16-bit aligned, copy byte by byte */ 63 { /* not 16-bit aligned, copy byte by byte */
@@ -94,7 +95,9 @@ void copy_read_sectors(unsigned char* buf, int wordcount)
94 DISRC0 = (int) 0x18000000; 95 DISRC0 = (int) 0x18000000;
95 DISRCC0 = 0x1; 96 DISRCC0 = 0x1;
96 /* Dest mapped to physical address, on AHB bus, increment */ 97 /* Dest mapped to physical address, on AHB bus, increment */
97 DIDST0 = (int) (buf + 0x30000000); 98 DIDST0 = (int) buf;
99 if(DIDST0 < 0x30000000)
100 DIDST0 += 0x30000000;
98 DIDSTC0 = 0; 101 DIDSTC0 = 0;
99 102
100 /* DACK/DREQ Sync to AHB, Int on Transfer complete, Whole service, No reload, 16-bit transfers */ 103 /* DACK/DREQ Sync to AHB, Int on Transfer complete, Whole service, No reload, 16-bit transfers */
@@ -112,10 +115,10 @@ void copy_read_sectors(unsigned char* buf, int wordcount)
112 115
113 /* Wait for transfer to complete */ 116 /* Wait for transfer to complete */
114 while((DSTAT0 & 0x000fffff)) 117 while((DSTAT0 & 0x000fffff))
115 CLKCON |= (1 << 2); /* set IDLE bit */ 118 yield();
116 /* Dump cache for the buffer */ 119 /* Dump cache for the buffer */
117} 120}
118 121#endif
119void dma0(void) 122void dma0(void)
120{ 123{
121} 124}