the question is about EDMA on dm6446
We want to transfer "srcBuff1[512]" to "dstBuff1[512]" by EDMA.
we write the code,but the code didn't transfer "srcBuff1[512]" to "dstBuff1[512]" .
we don't konw how to remedy the code?
//----------------------------CODE-----------------------------------------
#include<csl.h>
#include<csl_edma.h>
#include <socEdma.h>
#include <csl_edmaAux.h>
#include <soc64plus.h>
/* Globals */
Uint8 srcBuff1[512];
Uint8 srcBuff2[512];
Uint8 dstBuff1[512];
Uint8 dstBuff2[512];
void edma_chain_example (void);
void main(void)
{ edma_chain_example ();
return; }
void edma_chain_example (void)
{
CSL_EdmaHandle hModule; //!
CSL_EdmaParamHandle hParamBasic; //!
CSL_EdmaParamHandle hParamBasic1;
CSL_EdmaChanObj chObj; //!
CSL_EdmaChanObj chObj1;
CSL_BitMask32 regionIntr[2];
CSL_EdmaCmdDmaRegion regionAccess; //!
CSL_EdmaChanHandle hChannel; //!
CSL_EdmaChanHandle hChannel1;
CSL_EdmaParamSetup myParamSetup;
CSL_EdmaParamSetup myParamSetup1;
CSL_EdmaContext context; //!
CSL_EdmaChannelParam chAttr; //!
CSL_EdmaChannelParam chAttr1;
CSL_Status status; //!
CSL_EdmaRegionParam regParam;
CSL_EdmaRegionObj RegionObj;
CSL_EdmaRegionHandle shHndl;
CSL_EdmaHwChannelSetup setup;
CSL_EdmaHwChannelSetup setup1;
CSL_Status st;
volatile Uint32 loopIndex;
printf ("Running Edma Example\n");
/* Module Initialization */
status = CSL_edmaInit(&context);
if (status != CSL_SOK) {
printf ("Edma module initialization failed\n");
return;
}
/* Module level open */
hModule = CSL_edmaOpen(NULL,CSL_EDMA_1,NULL,&status);
if ( (hModule == NULL) || (status != CSL_SOK)) {
printf ("Edma module open failed\n");
return;}
/* DRAE enable(Bits 0-15) for the shadow region 5 */
regionAccess.region = CSL_EDMA_REGION_5 ;
regionAccess.drae = 0xFFFF ; //????
regionAccess.draeh = 0x0 ; //???
status = CSL_edmaHwControl(hModule,CSL_EDMA_CMD_DMAREGION_ENABLE, ®ionAccess);
if (status != CSL_SOK) {
printf ("Edma region enable command failed\n");
return;}
/*Open shadow regions OK3*/
regParam.regionNum = CSL_EDMA_REGION_5;
shHndl = CSL_edmaRegionOpen(&RegionObj,CSL_EDMA_1,®Param,&status);
if((shHndl== NULL) ||(status != CSL_SOK))
{ printf ("Edma region open failed\n");
return;}
/* Channel 0 open in context of shadow region 5 OK4*/
chAttr.regionNum = CSL_EDMA_REGION_5;
chAttr.chaNum = CSL_EDMA_CHA0;
hChannel = CSL_edmaChannelOpen(&chObj, CSL_EDMA_1, &chAttr, &status);
if ((hChannel == NULL) || (status != CSL_SOK)) {
printf ("Edma channel open failed\n");
return;}
// Channel0 Setup OK 5
setup.que = CSL_EDMA_EVT_QUE0;//???
setup.paramEntry = CSL_EDMA_CHA0;
// setup.triggerWord = CSL_EDMA_TRIGWORD_NONE;
CSL_edmaHwChannelSetup(hChannel,&setup);
/* Obtain a handle to parameter set 0 OK6*/
hParamBasic = CSL_edmaGetParamHandle(hChannel,CSL_EDMA_CHA0, &status);
if (hParamBasic == NULL) {
printf ("Edma get param handle for param entry 0 failed\n");
return;}
/* Setup the param set OK7..*/
myParamSetup.option = CSL_EDMA_OPT_MAKE( FALSE, FALSE, FALSE, TRUE,8,CSL_EDMA_TCC_NORMAL,CSL_EDMA_FIFOWIDTH_NONE, \
FALSE, CSL_EDMA_SYNC_AB, CSL_EDMA_ADDRMODE_INCR, CSL_EDMA_ADDRMODE_INCR);
myParamSetup.srcAddr = (Uint32)srcBuff1;
myParamSetup.aCntbCnt = CSL_EDMA_CNT_MAKE(512,2);
myParamSetup.dstAddr = (Uint32)dstBuff1;
myParamSetup.srcDstBidx = CSL_EDMA_BIDX_MAKE(512,512);
myParamSetup.linkBcntrld = CSL_EDMA_LINKBCNTRLD_MAKE(CSL_EDMA_LINK_NULL,0);
myParamSetup.srcDstCidx = CSL_EDMA_CIDX_MAKE(0,1);
myParamSetup.cCnt = 1;
myParamSetup.triggerWord = CSL_EDMA_TRIGWORD_NONE;
status = CSL_edmaParamSetup(hParamBasic, &myParamSetup,CSL_EDMA_PARAM_BASIC/*??*/);
if (status != CSL_SOK) {
printf("Edma parameter entry setup is failed\n");
return;
}
/* Channel 8 open in context of shadow region 5 */
chAttr1.regionNum = CSL_EDMA_REGION_5;
chAttr1.chaNum = CSL_EDMA_CHA8;
hChannel1 = CSL_edmaChannelOpen(&chObj1, CSL_EDMA_1, &chAttr1, &status);
if ((hChannel1 == NULL) || (status != CSL_SOK)) {
printf ("Edma channel open failed\n");
return;}
// Channel8 Setup OK 5
setup1.que = CSL_EDMA_EVT_QUE1;//???
setup1.paramEntry = CSL_EDMA_CHA8;
// setup.triggerWord = CSL_EDMA_TRIGWORD_NONE;
CSL_edmaHwChannelSetup(hChannel1,&setup1);
/* Obtain a handle to parameter set 8 */
hParamBasic1 = CSL_edmaGetParamHandle(hChannel1,CSL_EDMA_CHA8, &status);
/* Setup the param set */
myParamSetup1.option = CSL_EDMA_OPT_MAKE( FALSE, FALSE, FALSE, TRUE, 1, CSL_EDMA_TCC_NORMAL, CSL_EDMA_FIFOWIDTH_NONE, \
TRUE,CSL_EDMA_SYNC_AB, CSL_EDMA_ADDRMODE_INCR, CSL_EDMA_ADDRMODE_INCR);
myParamSetup1.srcAddr = (Uint32)srcBuff2;
myParamSetup1.aCntbCnt = CSL_EDMA_CNT_MAKE(512,2);
myParamSetup1.dstAddr = (Uint32)dstBuff2;
myParamSetup1.srcDstBidx = CSL_EDMA_BIDX_MAKE(512,512);
myParamSetup1.linkBcntrld = CSL_EDMA_LINKBCNTRLD_MAKE(CSL_EDMA_LINK_NULL,0);
myParamSetup1.srcDstCidx = CSL_EDMA_CIDX_MAKE(0,1);
myParamSetup1.cCnt = 1;
myParamSetup.triggerWord = CSL_EDMA_TRIGWORD_NONE;
status = CSL_edmaParamSetup(hParamBasic1,&myParamSetup1,CSL_EDMA_PARAM_BASIC);
if (status != CSL_SOK) {
printf("Edma parameter entry setup is failed\n");
return;}
/* Enable channel 0 OK8*/
status = CSL_edmaHwChannelControl(hChannel,CSL_EDMA_CMD_CHANNEL_ENABLE, NULL);
if (status != CSL_SOK) {
printf("Edma channel enable command for channel 0 is failed\n");
return;}
/* Enable channel 8 */
status = CSL_edmaHwChannelControl(hChannel1,CSL_EDMA_CMD_CHANNEL_ENABLE,NULL);
if (status != CSL_SOK) {
printf("Edma channel enable command for channel 8 is failed\n");
return;}
/* Initialize data*/
for (loopIndex = 0; loopIndex < 512; loopIndex++) {
srcBuff1[loopIndex] = loopIndex;
srcBuff2[loopIndex] = loopIndex;
dstBuff1[loopIndex] = 0;
dstBuff2[loopIndex] = 0; }
/* Trigger Channel 0 */
CSL_edmaHwChannelControl(hChannel,CSL_EDMA_CMD_CHANNEL_SET,NULL);
// regionIntr.region = CSL_EDMA_REGION_5;
do {
/* Poll on interrupt bit 8 */
st= CSL_edmaGetHwStatus(hModule,CSL_EDMA_QUERY_INTERRUPT_PENDSTATUS,®ionIntr);
} while (!(regionIntr[0] & 0x100));
/* Clear interrupt bit 8 */
status = CSL_edmaHwControl(hModule,CSL_EDMA_CMD_INTERRUPT_CLEAR, ®ionIntr);
if (status != CSL_SOK) {
printf("Edma clear interrupt bit 0 command is failed\n");
return;
}
/* Disable the region 5 */
regionAccess.region = CSL_EDMA_REGION_5 ;
regionAccess.drae = 0xFFFF ;
regionAccess.draeh = 0x0 ;
status = CSL_edmaHwControl(hModule,CSL_EDMA_CMD_DMAREGION_ENABLE, ®ionAccess);
/* clear the EDMA error registers */
CSL_edmaHwChannelControl (hChannel, CSL_EDMA_CMD_CHANNEL_DISABLE, NULL);
CSL_edmaHwChannelControl (hChannel, CSL_EDMA_CMD_CHANNEL_CLEAR, NULL);
/* Close channel */
status = CSL_edmaChannelClose(hChannel);
if (status != CSL_SOK) {
printf("Edma channel close failed\n");
return;}
/* Close edma module */
status = CSL_edmaClose(hModule);
if (status != CSL_SOK) {
printf("Edma module close failed\n");
return;
}
printf ("=============================================================\n");
return;
}