This thread has been locked.
If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.
仿照官方例程写了个简单的EDMA3块传输程序,将数据从0X800000000 搬运到0x80000200,程序如下,但是一直卡在等待传输完成的中断循环处,不知道是不是哪里的寄存器配置出了问题?麻烦看一下。测试平台为c6678 EVM。另外在使能中断的时候具体该使能几号中断呢?
#include <stdio.h>
#include "csl_edma3.h"
#include "csl_edma3Aux.h"
CSL_TpccRegs* gEDMACC0Regs = (CSL_TpccRegs*)CSL_EDMA0CC_REGS;
CSL_TpccRegs* gEDMACC1Regs = (CSL_TpccRegs*)CSL_EDMA1CC_REGS;
CSL_TpccRegs* gEDMACC2Regs = (CSL_TpccRegs*)CSL_EDMA2CC_REGS;
static Int32 edma_test_xfer_gbl_region (Int32 instNum, Uint8 channelNum)
{
CSL_Edma3Handle hModule;
CSL_Edma3Obj edmaObj;
CSL_Edma3ParamHandle hParamblock;
// CSL_Edma3ParamHandle hParamPong;
CSL_Edma3ChannelObj chObj;
CSL_Edma3CmdIntr regionIntr;
CSL_Edma3ChannelHandle hChannel;
CSL_Edma3ParamSetup myParamSetup;
CSL_Edma3Context context;
CSL_Edma3ChannelAttr chAttr;
CSL_Status status;
/* Module initialization */
CSL_edma3Init(&context);
/* Open the EDMA Module using the provided instance number */
hModule = CSL_edma3Open(&edmaObj, instNum, NULL, &status);
/* Channel open */
chAttr.regionNum = CSL_EDMA3_REGION_GLOBAL;
chAttr.chaNum = channelNum;
hChannel = CSL_edma3ChannelOpen(&chObj, instNum, &chAttr, &status);
/* Change Channel Default queue setup from 0 to 1 */
CSL_edma3HwChannelSetupQue(hChannel,CSL_EDMA3_QUE_1);
/* Map the DMA Channel to PARAM Block 1. */
CSL_edma3MapDMAChannelToParamBlock (hModule, channelNum, 1);
/* Obtain a handle to parameter set 1 */
hParamblock = CSL_edma3GetParamHandle(hChannel, 1, &status);
/* Setup the parameter entry parameters (Ping buffer) */
myParamSetup.option = 0x00102008;
myParamSetup.srcAddr = 0x80000000;
myParamSetup.aCntbCnt = 0x01000001;
myParamSetup.dstAddr = 0x80000200;
myParamSetup.srcDstBidx = 0x00000000;
myParamSetup.linkBcntrld= 0xFFFF0000;
myParamSetup.srcDstCidx = 0x00000000;
myParamSetup.cCnt = 0x0001;
/* block setup */
CSL_edma3ParamSetup(hParamblock,&myParamSetup);
/* Interrupt enable (Bits 0-1) for the global region interrupts */
regionIntr.region = CSL_EDMA3_REGION_GLOBAL;
regionIntr.intr = 0x2;
regionIntr.intrh = 0x0000;
CSL_edma3HwControl(hModule,CSL_EDMA3_CMD_INTR_ENABLE,®ionIntr);
/* Clear the pending bit */
CSL_edma3HwControl(hModule,CSL_EDMA3_CMD_INTRPEND_CLEAR,®ionIntr);
/* Trigger Channel */
CSL_edma3HwChannelControl(hChannel,CSL_EDMA3_CMD_CHANNEL_SET,NULL);
regionIntr.region = CSL_EDMA3_REGION_GLOBAL;
regionIntr.intr = 0;
regionIntr.intrh = 0;
/* Poll on IPR bit 1 ,waiting the completion interrupt*/
do {
CSL_edma3GetHwStatus(hModule,CSL_EDMA3_QUERY_INTRPEND,®ionIntr);
} while (!(regionIntr.intr & 0x2));
/* Close channel */
CSL_edma3ChannelClose(hChannel);
/* Close EDMA module */
CSL_edma3Close(hModule);
/* The test passed. */
return 0;
}
void main (void)
{
Uint16 i;
Uint8 channelNum = 1;
Uint8 instNum = 0;
Uint8 *pointer1 = (Uint8 *)(0X80000000);
Uint8 *pointer2 = (Uint8 *)(0X80000200);
for(i = 0; i <= 255; i++ )
{
*(pointer1+i) = i;
}
edma_test_xfer_gbl_region (instNum, channelNum);
/*check the bulk transfer result*/
for(i = 0; i <= 255; i++ )
{
if((Uint8 *)(pointer1 + i) == (Uint8 *)(pointer2 + i))
printf("data in address %x is right",(pointer2 + i));
}
return;
}
谢谢,确实是写反了,而且LINK和BCNTTRLD也写反了。现在我已经测试了上面的程序,MSMC到MSMC、L2到L2、DDR3到L2、DDR3到MSMC都能互传,但是只要目的地址是DDR3就不能传送,L2和MSMC之间也不恩能够互传,不知道可能是哪里出了问题了呢?或者是我的配置有什么问题?我的GEL文件时使用的安装包自带的。L2为core0的L2。下面是cmd文件:
-c
-heap 0x2000
-stack 0x2000
/* Memory Map 1 - the default */
MEMORY
{
L1D: o = 00f00000h l = 00007FFFh
L1P: o = 00e00000h l = 00007FFFh
MSMC: o = 0C000000h l = 001FFFFFh/*Multicore Shared memory controller*/
L2: o = 10800000h l = 0007FFFFh
DDR3: o = 80000000h l = 20000000h
}
SECTIONS
{
.csl_vect > MSMC
.text > MSMC
.stack > MSMC
.bss > MSMC
.cinit > MSMC
.cio > MSMC
.const > MSMC
.data > MSMC
.switch > MSMC
.sysmem > MSMC
.far > MSMC
.test_mem > MSMC
.test_ddr3 > DDR3
.test_L2 > L2
}
源代码中添加了
#pragma DATA_SECTION(srcbuff1,".test_ddr3")
#pragma DATA_SECTION(srcbuff2,".test_ddr3")
#pragma DATA_SECTION(dstbuff1,".test_ddr3")
#pragma DATA_SECTION(dstbuff2,".test_ddr3")
1. 确认一下你配置给EDMA的src, dst地址是否和buffer的地址匹配
2. 用DSP核做memcpy,看能不能做正确的搬移,如果能,那DDR初始化应该没问题
James Li2 您好。
1.我仔细检查了自己的参数配置中的dst和src地址,并没有发现和buffer不匹配的错误。(我在cmd文件中将dst和src都分配到了ddr3中,PaRAM中的设置如下:‘
myParamSetup.srcAddr = (Uint32)srcbuff1;
myParamSetup.dstAddr = (Uint32)dstbuff1;)
#pragma DATA_SECTION(srcbuff1,".test_ddr3")
#pragma DATA_SECTION(dstbuff1,".test_ddr3")
cmd文件中:
DDR3: o = 80000000h l = 20000000h
.test_ddr3 > DDR3
2.我编写了一段memcopy的代码,先将srcbuff和dstbuff的数据空间都分配到ddr3,然后将srcbuff中的数据复制到dstbuff中,也并没有什么异常。
请问还可能有别的什么原因吗?现在使用EDMA3时,当目的地址是ddr3时,仍然不能传送数据。
谢谢!