-
复制代码最近刚刚开始学习dm642,使用edma中遇到一个问题,下面是描述:
一个edma搬运数据的程序段,放在一个工程A中,可以用。但是转到工程B中,edma搬运用不了了。。。然后我将两个程序的build op
tion 以及bios设置,头文件都写成一样的了,但是edma在工程B中还是用不了,,,我贴下代码,求大神帮忙!!(两个工程都用了bios)
1.包含edma初始化及cpu触发函数等的一个c文件。。
- #include <assert.h>
- #include <csl_edma.h>
- unsigned int TESTSRC[32]=
- {
- 0x12345678,0x87654321,0x12345678,0x87654321,
- 0x12345678,0x87654321,0x12345678,0x87654321,
- 0x12345678,0x87654321,0x12345678,0x87654321,
- 0x12345678,0x87654321,0x12345678,0x87654321,
- 0x12345678,0x87654321,0x12345678,0x87654321,
- 0x12345678,0x87654321,0x12345678,0x87654321,
- 0x12345678,0x87654321,0x12345678,0x87654321,
- 0x12345678,0x87654321,0x12345678,0x87654321,
- };
- unsigned int TESTDST[32]=
- {
- 0x00000000,0x00000000,0x00000000,0x00000000,
- 0x00000000,0x00000000,0x00000000,0x00000000,
- 0x00000000,0x00000000,0x00000000,0x00000000,
- 0x00000000,0x00000000,0x00000000,0x00000000,
- 0x00000000,0x00000000,0x00000000,0x00000000,
- 0x00000000,0x00000000,0x00000000,0x00000000,
- 0x00000000,0x00000000,0x00000000,0x00000000,
- 0x00000000,0x00000000,0x00000000,0x00000000,
- };
- static EDMA_Handle hEdmaNewApply;
- void TEST_One_Edma()
- {
- unsigned int i;
- Uint32 disi=0;
- Uint32 tcc,src;
- EDMA_Handle hEdma;
- EDMA_Config cfgEdma;
- tcc=EDMA_intAlloc(-1);
- assert(tcc != -1);
- hEdma = EDMA_open(tcc,EDMA_OPEN_RESET);
- assert(hEdma != EDMA_HINV);
- hEdmaNewApply=hEdma;
- /** Make EDMA parameters OPT **/
- cfgEdma.opt=EDMA_OPT_RMK(
- EDMA_OPT_PRI_LOW, //MEDIUM
- EDMA_OPT_ESIZE_32BIT,
- EDMA_OPT_2DS_YES,
- EDMA_OPT_SUM_INC,
- EDMA_OPT_2DD_YES,
- EDMA_OPT_DUM_INC,
- EDMA_OPT_TCINT_NO,//(i== EVT_Y ? EDMA_OPT_TCINT_YES:EDMA_OPT_TCINT_NO),//only event Y generate interrupt
- EDMA_OPT_TCC_OF(8),
- EDMA_OPT_TCCM_OF(0),
- EDMA_OPT_ATCINT_NO,
- EDMA_OPT_ATCC_OF(0),
- EDMA_OPT_PDTS_DISABLE,
- EDMA_OPT_PDTD_DISABLE,
- EDMA_OPT_LINK_NO,//NOTE!!!
- EDMA_OPT_FS_YES );//array sync
- cfgEdma.src = (Uint32) TESTSRC;
- cfgEdma.cnt = EDMA_CNT_RMK(1,4);//dchan->numLines-1
- cfgEdma.dst = (Uint32) TESTDST;
- cfgEdma.idx = EDMA_IDX_RMK(0,0);//pitch
- cfgEdma.rld = EDMA_RLD_RMK(0,0);
- /** Configure EDMA parameters **/
- EDMA_config(hEdma,&cfgEdma);
- EDMA_disableChannel(hEdma);
- EDMA_clearChannel(hEdma);
- EDMA_enableChannel(hEdma);
-
- }
- void Trigger_the_testEDMA()
- {
- Uint32 src,dst;
- Uint32 *P,*P1;
- static Uint8 ii=0;
- P=TESTSRC;
- P1=TESTDST;
- ii++;
- if(ii>=4)
- ii=0;
- for(src=0;src<32;src++)
- TESTSRC[src]-=1;
- src=(Uint32)(P)+ii*4*8;
- dst=(Uint32)(P1)+ii*4*8;
- EDMA_RSETH(hEdmaNewApply,SRC,src);;
- EDMA_RSETH(hEdmaNewApply,CNT,EDMA_CNT_RMK(1,4));
- EDMA_RSETH(hEdmaNewApply,DST,dst);
- EDMA_RSETH(hEdmaNewApply,IDX,0);
- EDMA_RSETH(hEdmaNewApply,RLD,0);
- EDMA_setChannel(hEdmaNewApply);
- }
复制代码这个是main.c
- #include <std.h>
- #include <csl.h>
- #include <csl_edma.h>
- #include <csl_emif.h>
- #include <assert.h>
- #include "dm642param.h"
-
- void main()
- {
- CSL_init();
- TEST_One_Edma();
- }
复制代码然后会在一个task中一直调用Trigger_the_testEDMA()这个函数。
各位大神,小弟已经纠结了5天了,谁来帮帮忙!!非常感谢!!
一周热门 更多>