I want to use DAT_copy() to copy DDR2 data to L2 on DM648 CCS3.3, when I use DAT_copy() and DAT_wait() 100 times, the program could run rightly, when I use DAT_copy() and DAT_wait() 100 times in a tsk loop, while the tsk loop run every one time, the DAT_copy() and DAT_wait() run 100 times, the tsk just could run a few times, and then the program stops in the DAT_wait() func.
The interfaces of DAT APIs DM648 use CSL2.x, the header added, #include <csl_dat.h>, and the implement of DAT APIs use EDMA3 Driver and Resource Manager Package (EDMA3LLD) in csl2_dat.c, and the related lib edma3_drv_bios.lib and edma3_rm_bios.lib added. If you just copy 10 or less, the program run rightly and the data of copied is also right, but if you use it in the tsk loop and run always, it will stop in DAT_wait(), even if you give enough time to wait in the tsk loop.
#include <tsk.h>
#include <csl_dat.h>
#define HEIGHT 120
#define WIDTH 2096
#pragma DATA_SECTION(TestSrcBuf, ".extheap") //DDR2
#pragma DATA_ALIGN(TestSrcBuf, 64)
unsigned char TestSrcBuf[HEIGHT*WIDTH];
#pragma DATA_SECTION(TestDstBuf, ".inheap") //L2
#pragma DATA_ALIGN(TestDstBuf, 64)
unsigned char TestDstBuf[HEIGHT*WIDTH];
#pragma CODE_SECTION(TskCommand, ".incode")
void TskCommand()
{
int i,cnt=0;
int id;
while(1)
{
for(i=0;i<HEIGHT;i++)
{
id = DAT_copy(TestSrcBuf+i*WIDTH,TestDstBuf+i*WIDTH,WIDTH);
DAT_wait(id);
}
//wait 100ms
EVMDM648_waitusec(100000);
//-------------------------------------
// other image process func
//-------------------------------------
}
}
EDMA init did in main() func:
edma_init();
DAT_open(DAT_CHAANY, DAT_PRI_LOW, DAT_OPEN_2D);
The edma_init() is in C:\dvsdk_1_11_00_00_DM648\edma3_lld_1_05_00\examples\CSL2_DAT_DEMO\demo, and the EDMA init and DAT_open() are successful, because I can copy a few times and the datas are right, if you change while(1) to for(cnt=0;cnt<100;cnt++), the program will run rightly.
So, I want to ask why it heppens, and how to solve the problem. How to use DAT on DM648 CCS3.3? I doubt if the way I use the DAT is wrong.
Thank you!
Yonghao