仿照官方例程写了个简单的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;
}
