求高手帮助:
最近调试EDMA3,进行数据搬移。但是测试过程中突然发现程序总会开在一个循环判断上,我感觉是edma3的IPR的bit 0没有被置位,也就是没有传输完成中断被探测到。这种情况在我程序里面有时会出现有时又好了,不过现在卡住了。如下为代码:
#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;
/* Global Buffers (Source and Destination) for PING-PONG */
Uint8 srcBuff1[512];
Uint8 dstBuff1[512];
CSL_Edma3Handle hModule;
CSL_Edma3Obj edmaObj;
CSL_Edma3ParamHandle hParamPing;
//CSL_Edma3ParamHandle hParamPong;
CSL_Edma3ChannelObj chObj;
CSL_Edma3CmdIntr regionIntr;
CSL_Edma3ChannelHandle hChannel;
CSL_Edma3ParamSetup myParamSetup;
CSL_Edma3Context context;
CSL_Edma3ChannelAttr chAttr;
CSL_Status status;
static Int32 edma_ping_pong_xfer_gbl_region ()
{
Uint8 channelNum=0;
Uint8 instNum = 1;
/* Start the EDMA PING-PONG test over the Global Region. */
printf ("Debug: Testing EDMA(%d) Ping-Pong Test (Global) Region for Channel %d...\n", instNum, channelNum);
/* 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 3 */
CSL_edma3HwChannelSetupQue(hChannel,CSL_EDMA3_QUE_0);
/* Map the DMA Channel to PARAM Block 2. */
CSL_edma3MapDMAChannelToParamBlock (hModule, channelNum, 0);
/* Obtain a handle to parameter set 2 */
hParamPing = CSL_edma3GetParamHandle(hChannel, 0, &status);
/* Obtain a handle to parameter set 1 */
// hParamPong = CSL_edma3GetParamHandle(hChannel, 1, &status);
/* Setup the parameter entry parameters (Ping buffer) */
// myParamSetup.option = CSL_EDMA3_OPT_MAKE(CSL_EDMA3_ITCCH_DIS, \
CSL_EDMA3_TCCH_DIS, \
CSL_EDMA3_ITCINT_DIS, \
CSL_EDMA3_TCINT_EN, \
0, CSL_EDMA3_TCC_NORMAL,\
CSL_EDMA3_FIFOWIDTH_NONE, \
CSL_EDMA3_STATIC_DIS, \
CSL_EDMA3_SYNC_A, \
CSL_EDMA3_ADDRMODE_INCR, \
CSL_EDMA3_ADDRMODE_INCR );
myParamSetup.option = 0x00100008;
myParamSetup.srcAddr = (Uint32)srcBuff1;
myParamSetup.aCntbCnt = 0x00010200;
myParamSetup.dstAddr = (Uint32)dstBuff1;
myParamSetup.srcDstBidx = 0x0;
myParamSetup.linkBcntrld = 0x0000ffff;
myParamSetup.srcDstCidx = 0x0;
myParamSetup.cCnt = 0x00000001;
/* Ping setup */
CSL_edma3ParamSetup(hParamPing,&myParamSetup);
/* Interrupt enable (Bits 0-1) for the global region interrupts */
regionIntr.region = CSL_EDMA3_REGION_GLOBAL;
regionIntr.intr = 0x3;
regionIntr.intrh = 0x0000;
CSL_edma3HwControl(hModule,CSL_EDMA3_CMD_INTR_ENABLE,®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 0 */
do {
CSL_edma3GetHwStatus(hModule,CSL_EDMA3_QUERY_INTRPEND,®ionIntr);
} while (!(regionIntr.intr & 0x1));
/* Clear the pending bit */
CSL_edma3HwControl(hModule,CSL_EDMA3_CMD_INTRPEND_CLEAR,®ionIntr);
/* Close channel */
CSL_edma3ChannelClose(hChannel);
/* Close EDMA module */
CSL_edma3Close(hModule) ;
return 0;
}
void main (void)
{
Uint32 loopIndex;
printf ("**************************************************\n");
printf ("******************* EDMA Testing *****************\n");
printf ("**************************************************\n");
for (loopIndex = 0; loopIndex < 512; loopIndex++)
{
srcBuff1[loopIndex] = 0xff;
dstBuff1[loopIndex] = 0;
}
edma_ping_pong_xfer_gbl_region ();
for(loopIndex=0;loopIndex<512;loopIndex++)
{
printf("dstBuff1[loopIndex] = %d %d\n",loopIndex,dstBuff1[loopIndex]);
}
printf ("**************************************************\n");
printf ("************* EDMA Testing Successful ************\n");
printf ("**************************************************\n");
return;
}
开住的地方在: /* Poll on IPR bit 0 */
do {
CSL_edma3GetHwStatus(hModule,CSL_EDMA3_QUERY_INTRPEND,®ionIntr);
} while (!(regionIntr.intr & 0x1));
哪位遇到过这种情况,求解答!另外想请教下这段代码是什么意思:
1、 regionIntr.region = CSL_EDMA3_REGION_GLOBAL;
/2、 regionIntr.intr = 0;
/3、regionIntr.intrh = 0;
主要是2和3,。