fixed a few MDMA-related quirks. DMA still doesn't work when running from RAM
This commit is contained in:
@@ -35,7 +35,7 @@ CFLAGS=-mcpu=5474\
|
||||
-g\
|
||||
-Wno-multichar\
|
||||
-Winline\
|
||||
-Os \
|
||||
-O \
|
||||
-fomit-frame-pointer\
|
||||
-ffreestanding\
|
||||
-fleading-underscore\
|
||||
|
||||
@@ -154,6 +154,8 @@ SECTIONS
|
||||
__RAMBAR0 = 0xFF100000;
|
||||
__RAMBAR0_SIZE = 0x00001000;
|
||||
|
||||
__SUP_SP = __RAMBAR0 + __RAMBAR0_SIZE - 4;
|
||||
|
||||
/* system variables */
|
||||
|
||||
/* RAMBAR0 0 to 0x7FF -> exception vectors */
|
||||
@@ -175,8 +177,7 @@ SECTIONS
|
||||
_video_sbt = __RAMBAR0 + 0x83C;
|
||||
_rt_mbar = __RAMBAR0 + 0x844; /* (c)0f */
|
||||
|
||||
/* 4KB on-chip Core SRAM1: -> supervisor stack */
|
||||
/* 4KB on-chip Core SRAM1 */
|
||||
__RAMBAR1 = 0xFF101000;
|
||||
__RAMBAR1_SIZE = 0x00001000;
|
||||
__SUP_SP = __RAMBAR1 + __RAMBAR1_SIZE - 4;
|
||||
}
|
||||
|
||||
@@ -11,13 +11,13 @@
|
||||
* Turn Execution Unit tasks ON (#define) or OFF (#undef)
|
||||
*/
|
||||
#undef MCD_INCLUDE_EU
|
||||
//#define MCD_INCLUDE_EU
|
||||
|
||||
/*
|
||||
* Number of DMA channels
|
||||
*/
|
||||
#define NCHANNELS 16
|
||||
|
||||
#define MCD_INCLUDE_EU
|
||||
/*
|
||||
* Total number of variants
|
||||
*/
|
||||
|
||||
@@ -11,6 +11,7 @@
|
||||
*/
|
||||
|
||||
#include "MCD_dma.h"
|
||||
#include "MCD_tasksInit.h"
|
||||
|
||||
extern dmaRegs *MCD_dmaBar;
|
||||
|
||||
|
||||
@@ -42,9 +42,11 @@ void *dma_memcpy(void *dst, void *src, size_t n)
|
||||
|
||||
memcpy(d, s, n);
|
||||
|
||||
//#endif /* _NOT_USED_ */
|
||||
|
||||
end = MCF_SLT0_SCNT;
|
||||
|
||||
time = (start - end) / 132;
|
||||
time = (start - end) / 132 / 1000;
|
||||
xprintf("memcpy() took %d ms (%d.%d Mbytes/second)\r\n",
|
||||
time, n / time / 1000, n / time % 1000);
|
||||
flush_and_invalidate_caches();
|
||||
@@ -62,15 +64,15 @@ void *dma_memcpy(void *dst, void *src, size_t n)
|
||||
xprintf("finished\r\n");
|
||||
|
||||
start = MCF_SLT0_SCNT;
|
||||
ret = MCD_startDma(0, src, 4, dst, 4, n, 4, DMA_ALWAYS, 7, MCD_SINGLE_DMA|MCD_TT_FLAGS_CW|MCD_TT_FLAGS_RL|MCD_TT_FLAGS_SP, 0);
|
||||
ret = MCD_startDma(1, src, 4, dst, 4, n, 4, DMA_ALWAYS, 0, MCD_SINGLE_DMA, 0);
|
||||
if (ret == MCD_OK)
|
||||
{
|
||||
xprintf("DMA on channel 0 successfully started\r\n");
|
||||
xprintf("DMA on channel 1 successfully started\r\n");
|
||||
}
|
||||
|
||||
do
|
||||
{
|
||||
ret = MCD_dmaStatus(0);
|
||||
ret = MCD_dmaStatus(1);
|
||||
switch (ret)
|
||||
{
|
||||
case MCD_NO_DMA:
|
||||
@@ -102,10 +104,9 @@ void *dma_memcpy(void *dst, void *src, size_t n)
|
||||
break;
|
||||
}
|
||||
} while (ret != MCD_DONE);
|
||||
xprintf("\r\n");
|
||||
|
||||
end = MCF_SLT0_SCNT;
|
||||
time = (start - end) / 132;
|
||||
time = (start - end) / 132 / 1000;
|
||||
xprintf("start = %d, end = %d, time = %d\r\n", start, end, time);
|
||||
xprintf("took %d ms (%d.%d Mbytes/second)\r\n", time, n / time / 1000, n / time % 1000);
|
||||
|
||||
@@ -136,14 +137,14 @@ void *dma_memcpy(void *dst, void *src, size_t n)
|
||||
xprintf("DMA copy verification successful!\r\n");
|
||||
end = MCF_SLT0_SCNT;
|
||||
|
||||
time = (start - end) / 132;
|
||||
time = (start - end) / 132 / 1000;
|
||||
xprintf("took %d ms (%d.%d Mbytes/second)\r\n", time, n / time / 1000, n / time % 1000);
|
||||
|
||||
}
|
||||
|
||||
#ifdef _NOT_USED_
|
||||
__asm__ __volatile__("move.w sr,d0\n\t"
|
||||
"stop #0x270\n\t"
|
||||
"stop #0x2700\n\t"
|
||||
"move.w d0,sr": : :); /* halt CPU until DMA finished */
|
||||
#endif /* _NOT_USED_ */
|
||||
|
||||
@@ -157,7 +158,7 @@ int dma_init(void)
|
||||
char *long_version;
|
||||
|
||||
xprintf("MCD DMA API initialization: ");
|
||||
res = MCD_initDma((dmaRegs *) &MCF_DMA_TASKBAR, SYS_SRAM, MCD_RELOC_TASKS | MCD_COMM_PREFETCH_EN);
|
||||
res = MCD_initDma((dmaRegs *) &_MBAR[0x8000], SYS_SRAM, MCD_RELOC_TASKS | MCD_COMM_PREFETCH_EN);
|
||||
if (res != MCD_OK)
|
||||
{
|
||||
xprintf("DMA API initialization failed (0x%x)\r\n", res);
|
||||
|
||||
@@ -44,7 +44,7 @@ _rom_entry:
|
||||
move.l #__RAMBAR1 + 0x1,d0
|
||||
movec d0,RAMBAR1
|
||||
|
||||
/* set stack pointer to end of SRAM1 */
|
||||
/* set stack pointer to end of SRAM */
|
||||
lea __SUP_SP,a7
|
||||
move.l #0,(sp)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user