diff --git a/sources/BaS.c b/sources/BaS.c index 7418fec..7fd0829 100644 --- a/sources/BaS.c +++ b/sources/BaS.c @@ -155,7 +155,7 @@ void nvram_init(void) /* ACP interrupt controller */ #define FPGA_INTR_CONTRL (volatile uint32_t *) 0xf0010000 -#define FPGA_INTR_ENABLE (volatile uint32_t *) 0xf0010004 +#define FPGA_INTR_ENABLE (volatile uint8_t *) 0xf0010004 #define FPGA_INTR_PENDIN (volatile uint32_t *) 0xf0010008 void enable_coldfire_interrupts() diff --git a/sources/spidma.c b/sources/spidma.c index f2eed3f..b9c752a 100644 --- a/sources/spidma.c +++ b/sources/spidma.c @@ -16,11 +16,30 @@ extern char _SYS_SRAM[]; void *dma_memcpy(void *dst, void *src, size_t n) { int ret; + int32_t start = MCF_SLT_SCNT(0); + int32_t end; ret = MCD_startDma(0, src, 1, dst, 1, n, 1, DMA_ALWAYS, 0, MCD_SINGLE_DMA, 0); + if (ret == MCD_OK) + { + xprintf("DMA on channel 0 successfully started\r\n"); + } + + do + { + ret = MCD_dmaStatus(0); + xprintf("."); + } while (ret != MCD_DONE); + xprintf("\r\n"); + + end = MCF_SLT_SCNT(0); + + xprintf("took %d seconds (1 Mbyte)\r\n", (end - start) / 132 / 1000); +#ifdef _NOT_USED_ __asm__ __volatile__("move.w sr,d0\n\t" "stop #0x270\n\t" "move.w d0,sr": : :); /* halt CPU until DMA finished */ +#endif /* _NOT_USED_ */ return dst; } @@ -36,6 +55,10 @@ int spidma_init(void) return 0; } xprintf("DMA API initialized. Tasks are at %p\r\n", SYS_SRAM); + + // test + dma_memcpy((void *) 0x40000000, (void *) 0x30000000, 0x100000); + xprintf("DMA finished\r\n"); return 1; }