TI中文支持网
TI专业的中文技术问题搜集分享网站

求教关于edma3的问题

我运行TI自带的edma3数据搬移的例子, 搬移2个数组(src1,src2)到2个数组(dst1,dst2)可以成功,但当我再加一个数组,想尝试搬移三个数组(src1,2,3)到dst1,dst2,dst3,就失败了, 该怎么做

Zhan Xiang:

您的描述不太清楚,麻烦说明使用的是哪个用例?操作方式相关信息。

First Last1:

回复 Zhan Xiang:

就是TI自带的edma_test.c

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.srcAddr = (Uint32)srcBuff1; myParamSetup.aCntbCnt = CSL_EDMA3_CNT_MAKE(256,1); myParamSetup.dstAddr = (Uint32)dstBuff1; myParamSetup.srcDstBidx = CSL_EDMA3_BIDX_MAKE(1,1); myParamSetup.linkBcntrld= CSL_EDMA3_LINKBCNTRLD_MAKE(hParamPong,0); myParamSetup.srcDstCidx = CSL_EDMA3_CIDX_MAKE(0,1); myParamSetup.cCnt = 1;

/* Ping setup */ if (CSL_edma3ParamSetup(hParamPing,&myParamSetup) != CSL_SOK) { printf ("Error: EDMA Parameter Entry Setup failed\n"); return -1; }; /* Pong setup */ myParamSetup.linkBcntrld = CSL_EDMA3_LINKBCNTRLD_MAKE(hParamPing,0); myParamSetup.option = CSL_EDMA3_OPT_MAKE(CSL_EDMA3_ITCCH_DIS, \ CSL_EDMA3_TCCH_DIS, \ CSL_EDMA3_ITCINT_DIS, \ CSL_EDMA3_TCINT_EN,\ 1, CSL_EDMA3_TCC_NORMAL,\ CSL_EDMA3_FIFOWIDTH_NONE, \ CSL_EDMA3_STATIC_EN, \ CSL_EDMA3_SYNC_A, \ CSL_EDMA3_ADDRMODE_INCR, \ CSL_EDMA3_ADDRMODE_INCR ); myParamSetup.srcAddr = (Uint32)srcBuff2; myParamSetup.dstAddr = (Uint32)dstBuff2; if (CSL_edma3ParamSetup(hParamPong,&myParamSetup) != CSL_SOK) { printf ("Error: EDMA Parameter Entry Setup failed\n"); return -1; };

/*******************************/

我加了一组类似的链接,

myParamSetup.linkBcntrld = CSL_EDMA3_LINKBCNTRLD_MAKE(hParamOut,0); myParamSetup.option = CSL_EDMA3_OPT_MAKE(CSL_EDMA3_ITCCH_DIS, \CSL_EDMA3_TCCH_DIS, \CSL_EDMA3_ITCINT_DIS, \CSL_EDMA3_TCINT_EN,\1, CSL_EDMA3_TCC_NORMAL,\CSL_EDMA3_FIFOWIDTH_NONE, \CSL_EDMA3_STATIC_EN, \CSL_EDMA3_SYNC_A, \CSL_EDMA3_ADDRMODE_INCR, \CSL_EDMA3_ADDRMODE_INCR );myParamSetup.srcAddr = (Uint32)srcBuff3;myParamSetup.dstAddr = (Uint32)dstBuff3; if (CSL_edma3ParamSetup(hParamPong,&myParamSetup) != CSL_SOK) {printf ("Error: EDMA Parameter Entry Setup failed\n"); return -1;} ;

其他的没改,前两组数据可以搬进去, 我自己加的一组就搬不过去了,是不下面的程序要改哪些参数?

/* 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,&regionIntr);

/* 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,&regionIntr); } while (!(regionIntr.intr & 0x1));

/* Clear the pending bit */ CSL_edma3HwControl(hModule,CSL_EDMA3_CMD_INTRPEND_CLEAR,&regionIntr);

/* Trigger Channel */ CSL_edma3HwChannelControl(hChannel,CSL_EDMA3_CMD_CHANNEL_SET,NULL); /* Poll on IPR bit 2 */ do { CSL_edma3GetHwStatus(hModule,CSL_EDMA3_QUERY_INTRPEND,&regionIntr); } while (!(regionIntr.intr & 0x2));

/* Check transfer by comparing the source and destination buffers */ if(Verify_Transfer( 256, 1, 1, 0, 0, 0, 0, srcBuff1, dstBuff1, TRUE) == FALSE) { printf ("Error: Verification (Source1/Destination1) Failed\n"); return -1; } if(Verify_Transfer( 256, 1, 1, 0, 0, 0, 0, srcBuff2, dstBuff2, TRUE) == FALSE) { printf ("Error: Verification (Source2/Destination2) Failed\n"); return -1; } /* Close channel */ if (CSL_edma3ChannelClose(hChannel) != CSL_SOK) { printf("Error: EDMA Channel Close failed\n"); return -1; } /* Close EDMA module */ if (CSL_edma3Close(hModule) != CSL_SOK) { printf("Error: EDMA Module Close failed\n"); return -1; };

直接copy过来看着有点乱  麻烦了

First Last1:

回复 First Last1:

hParamOut 是我自己定义的

hParamOut = CSL_edma3GetParamHandle(hChannel,3,&status);

Zhan Xiang:

回复 First Last1:

EDMA有3个要素:

1. 触发方式,event 触发/手动触发/event chain式触发

2. PaRAM配置

3. 触发使能和提交

1.看你的代码你应该用的是手动触发,你要确认你新增的触发源是否和以前的有冲突;

2. 新增触发源对应的PaRAM选择是否正确

3. PaRAM的配置中,参数是否正确,例如使用全局地址

4. 判断传输完成的event 设置是否正确,例如TCC的配置是否有冲突

First Last1:

回复 Zhan Xiang:

我新增的触发源和参数配置都是没问题的,TCC是否有冲突是怎么看的?后面这三个函数调用机制我不太懂,搬移2组他调用2次,我搬移三组是否就调用三次?

regionIntr.region = CSL_EDMA3_REGION_GLOBAL; regionIntr.intr = 0x7; regionIntr.intrh = 0x0000; CSL_edma3HwControl(hModule,CSL_EDMA3_CMD_INTR_ENABLE,&regionIntr);

/* Trigger channel */ CSL_edma3HwChannelControl(hChannel,CSL_EDMA3_CMD_CHANNEL_SET,NULL);

CSL_edma3GetHwStatus(hModule,CSL_EDMA3_QUERY_INTRPEND,&regionIntr);

First Last1:

回复 Zhan Xiang:

谢谢你 将的很清楚 不过我改了TCC还是跑不了  另外我不知道我的regionintr配置是否正确 麻烦你帮我看下。

int EdmaTrans (){ CSL_Edma3Handle hModule; CSL_Edma3Obj edmaObj; CSL_Edma3ParamHandle hParamPing; CSL_Edma3ParamHandle hParamPong; CSL_Edma3ParamHandle hParamOut; CSL_Edma3ChannelObj chObj; CSL_Edma3CmdIntr regionIntr; CSL_Edma3ChannelHandle hChannel; CSL_Edma3ParamSetup myParamSetup; CSL_Edma3Context context; CSL_Edma3ChannelAttr chAttr; CSL_Status status;

int instNum; unsigned char channelNum;

instNum = 1; channelNum = 1;

/* Module initialization */ if (CSL_edma3Init(&context) != CSL_SOK) { printf ("Error: EDMA module initialization failed\n"); return -1; }

/* Open the EDMA Module using the provided instance number */ hModule = CSL_edma3Open(&edmaObj, instNum, NULL, &status); if ( (hModule == NULL) || (status != CSL_SOK)) { printf ("Error: EDMA module open failed\n"); return -1; }

/* Channel open */ chAttr.regionNum = CSL_EDMA3_REGION_GLOBAL; chAttr.chaNum = channelNum; hChannel = CSL_edma3ChannelOpen(&chObj, instNum, &chAttr, &status); if ((hChannel == NULL) || (status != CSL_SOK)) { printf ("Error: Unable to open EDMA Channel:%d\n", channelNum); return -1; }

if(!instNum) { /* For first EDMA instance there are only 2 TCs and 2 event queues * Modify the channel default queue setup from 0 to 1 */ if (CSL_edma3HwChannelSetupQue(hChannel,CSL_EDMA3_QUE_1) != CSL_SOK) { printf ("Error: EDMA channel setup queue failed\n"); return -1; } } else { /* For EDMA instance 1 and 2 maximum of 4 TCs and 4 event queues are supported * Change Channel Default queue setup from 0 to 3 */ if (CSL_edma3HwChannelSetupQue(hChannel,CSL_EDMA3_QUE_3) != CSL_SOK) { printf ("Error: EDMA channel setup queue failed\n"); return -1; } }

CSL_edma3MapDMAChannelToParamBlock (hModule, channelNum, 2);

hParamPing = CSL_edma3GetParamHandle(hChannel, 2, &status);

/* Obtain a handle to parameter set 1 */ hParamPong = CSL_edma3GetParamHandle(hChannel, 1, &status);

hParamOut = CSL_edma3GetParamHandle(hChannel,3,&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.srcAddr = (Uint32)srcBuff1; myParamSetup.aCntbCnt = CSL_EDMA3_CNT_MAKE(15,1); myParamSetup.dstAddr = (Uint32) dstBuff1; myParamSetup.srcDstBidx = CSL_EDMA3_BIDX_MAKE(0,0); myParamSetup.linkBcntrld= CSL_EDMA3_LINKBCNTRLD_MAKE(hParamPong,0); myParamSetup.srcDstCidx = CSL_EDMA3_CIDX_MAKE(0,0); myParamSetup.cCnt = 1;

/* Ping setup */ if (CSL_edma3ParamSetup(hParamPing,&myParamSetup) != CSL_SOK) { printf ("Error: EDMA Parameter Entry Setup failed\n"); return -1; }

/* Pong setup */

myParamSetup.option = CSL_EDMA3_OPT_MAKE(CSL_EDMA3_ITCCH_DIS, CSL_EDMA3_TCCH_DIS, CSL_EDMA3_ITCINT_DIS, CSL_EDMA3_TCINT_EN, 1, 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.srcAddr = (Uint32)srcBuff2;myParamSetup.aCntbCnt = CSL_EDMA3_CNT_MAKE(15,1);myParamSetup.dstAddr = (Uint32)dstBuff2; myParamSetup.srcDstBidx = CSL_EDMA3_BIDX_MAKE(1,0); myParamSetup.linkBcntrld = CSL_EDMA3_LINKBCNTRLD_MAKE(hParamPing,0); myParamSetup.srcDstCidx = CSL_EDMA3_CIDX_MAKE(0,0); myParamSetup.cCnt = 1;

if (CSL_edma3ParamSetup(hParamPong,&myParamSetup) != CSL_SOK) { printf ("Error: EDMA Parameter Entry Setup failed\n"); return -1; }

myParamSetup.option = CSL_EDMA3_OPT_MAKE(CSL_EDMA3_ITCCH_DIS, CSL_EDMA3_TCCH_DIS, CSL_EDMA3_ITCINT_DIS, CSL_EDMA3_TCINT_EN, 2, 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.srcAddr = (Uint32)srcBuff3; myParamSetup.dstAddr = (Uint32) dstBuff3; myParamSetup.linkBcntrld = CSL_EDMA3_LINKBCNTRLD_MAKE(hParamOut,0);

CSL_edma3ParamSetup(hParamOut,&myParamSetup);

regionIntr.region = CSL_EDMA3_REGION_GLOBAL; regionIntr.intr = 0x7; regionIntr.intrh = 0x0000; CSL_edma3HwControl(hModule,CSL_EDMA3_CMD_INTR_ENABLE,&regionIntr);

CSL_edma3HwChannelControl(hChannel,CSL_EDMA3_CMD_CHANNEL_SET,NULL);

CSL_edma3GetHwStatus(hModule,CSL_EDMA3_QUERY_INTRPEND,&regionIntr);

/* 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,&regionIntr);

/* Trigger channel */ CSL_edma3HwChannelControl(hChannel,CSL_EDMA3_CMD_CHANNEL_SET,NULL);

regionIntr.region = CSL_EDMA3_REGION_GLOBAL; regionIntr.intr = 0; regionIntr.intrh = 0;

CSL_edma3GetHwStatus(hModule,CSL_EDMA3_QUERY_INTRPEND,&regionIntr);

/* Clear the pending bit */ CSL_edma3HwControl(hModule,CSL_EDMA3_CMD_INTRPEND_CLEAR,&regionIntr);

/* Trigger Channel */ CSL_edma3HwChannelControl(hChannel,CSL_EDMA3_CMD_CHANNEL_SET,NULL);

/* Poll on IPR bit 2 */ CSL_edma3GetHwStatus(hModule,CSL_EDMA3_QUERY_INTRPEND,&regionIntr);

if (CSL_edma3ChannelClose(hChannel) != CSL_SOK) { printf("Error: EDMA Channel Close failed\n"); return -1; }

if (CSL_edma3Close(hModule) != CSL_SOK) { printf("Error: EDMA Module Close failed\n"); return -1; }

return 0;}

First Last1:

回复 Zhan Xiang:

其实我做的是TCP3E一个传输的任务,只要简单的完成TCP3E传输功能 ,不使用BIOS  他的EDMA3需要传输 配置信息和输入数据进入TCP3E,然后传输turbo encoder后的结果出来 ,所以我感觉edma3 需要三次传输。

Zhan Xiang:

回复 First Last1:

建议不要直接增加代码,你先理解清楚样例中的实现是如何对EDMA进行操作的,之后再按照你的需求进行修改。

赞(0)
未经允许不得转载:TI中文支持网 » 求教关于edma3的问题
分享到: 更多 (0)