From 5668505d6b9515c21488e7be1ea40f076d0eb14e Mon Sep 17 00:00:00 2001 From: Greg White Date: Fri, 5 Jan 2007 04:17:25 +0000 Subject: Switch DMA wait loop to idle CPU git-svn-id: svn://svn.rockbox.org/rockbox/trunk@11914 a1c6a512-1295-4272-9138-f99709370657 --- firmware/target/arm/gigabeat/meg-fx/ata-meg-fx.c | 29 ++++++++++++++-------- .../target/arm/gigabeat/meg-fx/system-meg-fx.c | 2 ++ 2 files changed, 20 insertions(+), 11 deletions(-) (limited to 'firmware/target/arm') 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 de4626e288..361b9d4b6f 100644 --- a/firmware/target/arm/gigabeat/meg-fx/ata-meg-fx.c +++ b/firmware/target/arm/gigabeat/meg-fx/ata-meg-fx.c @@ -57,14 +57,15 @@ void copy_read_sectors(unsigned char* buf, int wordcount) /* This should never happen, but worth watching for */ if(wordcount > (1 << 18)) panicf("atd-meg-fx.c: copy_read_sectors: too many sectors per read!"); -#undef GIGABEAT_DEBUG_ATA + +//#define GIGABEAT_DEBUG_ATA #ifdef GIGABEAT_DEBUG_ATA - static int line = 0; - static char str[256]; - snprintf(str, sizeof(str), "DMA to %08x, %d", buf, wordcount); - lcd_puts(16, line, str); - line = (line+1) % 32; - lcd_update(); + static int line = 0; + static char str[256]; + snprintf(str, sizeof(str), "ODD DMA to %08x, %d", buf, wordcount); + lcd_puts(10, line, str); + line = (line+1) % 32; + lcd_update(); #endif /* Reset the channel */ DMASKTRIG0 |= 4; @@ -81,20 +82,26 @@ void copy_read_sectors(unsigned char* buf, int wordcount) DIDSTC0 = 0; /* DACK/DREQ Sync to AHB, Int on Transfer complete, Whole service, No reload, 16-bit transfers */ - DCON0 = ((1 << 30) | (1<<27) | (1<<22) | (1<<20)) | wordcount; + DCON0 = ((1 << 30) | (1<< 29) | (1<<27) | (1<<22) | (1<<20)) | wordcount; /* Activate the channel */ DMASKTRIG0 = 0x2; - /* Dump cache for the buffer */ - dump_dcache_range((void *)buf, wordcount*2); + invalidate_dcache_range((void *)buf, wordcount*2); + INTMSK &= ~(1<<17); /* unmask the interrupt */ + SRCPND = (1<<17); /* clear any pending interrupts */ /* Start DMA */ DMASKTRIG0 |= 0x1; /* Wait for transfer to complete */ while((DSTAT0 & 0x000fffff)) - yield(); + CLKCON |= (1 << 2); /* set IDLE bit */ + /* Dump cache for the buffer */ +} + +void dma0(void) +{ } diff --git a/firmware/target/arm/gigabeat/meg-fx/system-meg-fx.c b/firmware/target/arm/gigabeat/meg-fx/system-meg-fx.c index b8bcda3c95..b2b4a6207b 100644 --- a/firmware/target/arm/gigabeat/meg-fx/system-meg-fx.c +++ b/firmware/target/arm/gigabeat/meg-fx/system-meg-fx.c @@ -33,6 +33,8 @@ void irq(void) /* Timer 4 */ if ((intpending & TIMER4_MASK) != 0) timer4(); + else if ((intpending & DMA0_MASK) != 0) + dma0(); else { /* unexpected interrupt */ -- cgit v1.2.3