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

6678的EDMA如果不查询传输完成,则不能搬移数据。

自己编写的EDMA的程序,发起EDMA后,查询传输完成,则在目的地址看到想要的数据了。但是如果不加查询传输完成,而是发起EDMA搬移后,加一个非常长的延时,在目的地址也看不到想要的数据。

user1212849:

EDMA的子函数如下:

#include "KeyStone_common.h"#include "mycommon.h"#include "myedma.h"//#include "myedmatest.h"#include "mydelay.h"#include <csl_edma3.h>

int *ParamRegAddr;

volatile Uint32 * TPCC_ESR; volatile Uint32 * TPCC_IPR; volatile Uint32 * TPCC_ICR; CSL_TpccRegs* EDMACCRegs;

int edma_instNum; int edma_tcNum; int edma_channelNum; int edma_paraNum; int edma_regionNum;

void my_edma_init(int coreid) {

switch(coreid) { case 0: edma_instNum=0; edma_tcNum=0; edma_paraNum=0; break; case 1: edma_instNum=0; edma_tcNum=1; edma_paraNum=1; break; case 2: edma_instNum=1; edma_tcNum=0; edma_paraNum=2; break; case 3: edma_instNum=1; edma_tcNum=1; edma_paraNum=3; break; case 4: edma_instNum=1; edma_tcNum=2; edma_paraNum=4; break; case 5: edma_instNum=1; edma_tcNum=3; edma_paraNum=5; break; case 6: edma_instNum=2; edma_tcNum=0; edma_paraNum=6; break; case 7: edma_instNum=2; edma_tcNum=1; edma_paraNum=7; break; default: break; }

edma_channelNum=(edma_paraNum&0x000000ff); edma_regionNum=edma_paraNum;

EDMACCRegs=gpEDMA_CC_regs[edma_instNum];//确定采用哪个通道控制器0 1 2

my_edma_init_reg_globle( edma_instNum,//int instNum,//0 1 2 edma_tcNum,//int tcNum,//instNum 0:0 1 instNum 1:0 1 2 3 instNum 2:0 1 2 3 edma_channelNum,//int channelNum,// edma_paraNum//int paraNum,//==core id 0-7 );

}

void my_edma_init_reg_globle( int instNum,//0 1 2 int tcNum,//instNum 0:0 1 instNum 1:0 1 2 3 instNum 2:0 1 2 3 int channelNum,// int paraNum//==core id 0-7 ) {

int i; unsigned int * uipPaRAM;

/*clear PaRAM*/ uipPaRAM= (unsigned int *)&(gpEDMA_CC0_regs->PARAMSET[0]); for(i=0; i<8*CSL_EDMA3_TPCC0_NUM_PARAMSETS; i++) *uipPaRAM++=0;

uipPaRAM= (unsigned int *)&(gpEDMA_CC1_regs->PARAMSET[0]); for(i=0; i<8*CSL_EDMA3_TPCC1_NUM_PARAMSETS; i++) *uipPaRAM++=0;

uipPaRAM= (unsigned int *)&(gpEDMA_CC2_regs->PARAMSET[0]); for(i=0; i<8*CSL_EDMA3_TPCC2_NUM_PARAMSETS; i++) *uipPaRAM++=0;

/*Assign PaRAM for different edma channels*/ //将模块的channel与参数通道绑定 gpEDMA_CC_regs[instNum]->TPCC_DCHMAP[channelNum]=paraNum<<CSL_TPCC_TPCC_DCHMAP0_PAENTRY_SHIFT;

/*Assign TC/Queue for different channels*/ //将传输通道与channel绑定 Uint8 dmaRegIndex; Uint8 lsb;

/* There are 8 channels per register; use this to determine the DMAQNUM register Index. */ dmaRegIndex = channelNum >> 3;

/* Compute the bit position where the value is to be written. */ lsb = (channelNum – (dmaRegIndex * 8)) << 2;

/* Write the event Queue */ CSL_FINSR(gpEDMA_CC_regs[instNum]->TPCC_DMAQNUM[dmaRegIndex], lsb + 2, lsb, tcNum);

ParamRegAddr=(int*)&(gpEDMA_CC_regs[instNum]->PARAMSET[paraNum]);

if(edma_channelNum<32) { TPCC_ESR= &EDMACCRegs->TPCC_ESR; TPCC_IPR= &EDMACCRegs->TPCC_IPR; TPCC_ICR= &EDMACCRegs->TPCC_ICR; } else { TPCC_ESR= &EDMACCRegs->TPCC_ESRH; TPCC_IPR= &EDMACCRegs->TPCC_IPRH; TPCC_ICR= &EDMACCRegs->TPCC_ICRH; edma_channelNum -= 32; } }

//函数名称:my_edma_param_init//函数作用:初始化edma使用的param空间的值//输入参数:

//输出参数:无//返回 值:无//注意事项:没有初始化dst,dst用来触发qdma的传输void my_edma_transfer_wait( //unsigned int edma3cc_id,// 0 1 2 //unsigned int channel,//cc0:0-15 cc1:0-63 cc2:0-63 //unsigned int param_id, unsigned int reg0_opt,

unsigned int reg1_srcAddr,

unsigned short reg2_acnt, unsigned short reg2_bcnt,

unsigned int reg3_dstAddr,

unsigned short reg4_srcbidx, unsigned short reg4_dstbidx,

unsigned short reg5_link, unsigned short reg5_bcntrld,

unsigned short reg6_srccidx, unsigned short reg6_dstcidx,

unsigned short reg7_ccnt ){

// int edma_instNum;// int edma_tcNum;// int edma_channelNum;// int edma_paraNum;// int edma_regionNum;

EDMACCRegs->PARAMSET[edma_paraNum].OPT =reg0_opt; EDMACCRegs->PARAMSET[edma_paraNum].SRC =reg1_srcAddr; EDMACCRegs->PARAMSET[edma_paraNum].A_B_CNT =(reg2_bcnt<<16)|(reg2_acnt&0xffff); EDMACCRegs->PARAMSET[edma_paraNum].DST =reg3_dstAddr; EDMACCRegs->PARAMSET[edma_paraNum].SRC_DST_BIDX =(reg4_dstbidx<<16)|(reg4_srcbidx&0xffff); EDMACCRegs->PARAMSET[edma_paraNum].LINK_BCNTRLD =(reg5_bcntrld<<16)|(reg5_link&0xffff); EDMACCRegs->PARAMSET[edma_paraNum].SRC_DST_CIDX =(reg6_dstcidx<<16)|(reg6_srccidx&0xffff); EDMACCRegs->PARAMSET[edma_paraNum].CCNT =reg7_ccnt;

EDMACCRegs->TPCC_IESR|=(1<<edma_channelNum);

/*Manually trigger the EDMA*/ (*TPCC_ESR)= 1<<(edma_channelNum);

//if(wait) //{ /*wait for completion*/ //mydelay_nms(1000); while(0==((*TPCC_IPR)&(1<<(edma_channelNum))));

/*clear completion flag*/ (*TPCC_ICR)= 1<<(edma_channelNum);

}

//函数名称:my_edma_param_init//函数作用:初始化edma使用的param空间的值//输入参数:

//输出参数:无//返回 值:无//注意事项:没有初始化dst,dst用来触发qdma的传输void my_edma_transfer_no_wait( //unsigned int edma3cc_id,// 0 1 2 //unsigned int channel,//cc0:0-15 cc1:0-63 cc2:0-63 //unsigned int param_id, unsigned int reg0_opt,

unsigned int reg1_srcAddr,

unsigned short reg2_acnt, unsigned short reg2_bcnt,

unsigned int reg3_dstAddr,

unsigned short reg4_srcbidx, unsigned short reg4_dstbidx,

unsigned short reg5_link, unsigned short reg5_bcntrld,

unsigned short reg6_srccidx, unsigned short reg6_dstcidx,

unsigned short reg7_ccnt ){

// int edma_instNum;// int edma_tcNum;// int edma_channelNum;// int edma_paraNum;// int edma_regionNum;

EDMACCRegs->PARAMSET[edma_paraNum].OPT =reg0_opt; EDMACCRegs->PARAMSET[edma_paraNum].SRC =reg1_srcAddr; EDMACCRegs->PARAMSET[edma_paraNum].A_B_CNT =(reg2_bcnt<<16)|(reg2_acnt&0xffff); EDMACCRegs->PARAMSET[edma_paraNum].DST =reg3_dstAddr; EDMACCRegs->PARAMSET[edma_paraNum].SRC_DST_BIDX =(reg4_dstbidx<<16)|(reg4_srcbidx&0xffff); EDMACCRegs->PARAMSET[edma_paraNum].LINK_BCNTRLD =(reg5_bcntrld<<16)|(reg5_link&0xffff); EDMACCRegs->PARAMSET[edma_paraNum].SRC_DST_CIDX =(reg6_dstcidx<<16)|(reg6_srccidx&0xffff); EDMACCRegs->PARAMSET[edma_paraNum].CCNT =reg7_ccnt;

EDMACCRegs->TPCC_IESR|=(1<<edma_channelNum); /*if(edma_channelNum<32) { TPCC_ESR= &EDMACCRegs->TPCC_ESR; TPCC_IPR= &EDMACCRegs->TPCC_IPR; TPCC_ICR= &EDMACCRegs->TPCC_ICR; } else { TPCC_ESR= &EDMACCRegs->TPCC_ESRH; TPCC_IPR= &EDMACCRegs->TPCC_IPRH; TPCC_ICR= &EDMACCRegs->TPCC_ICRH; edma_channelNum -= 32; }*/

/*Manually trigger the EDMA*/ (*TPCC_ESR)= 1<<(edma_channelNum);

//if(wait) //{ /*wait for completion*/ //mydelay_nms(1000);// while(0==((*TPCC_IPR)&(1<<(edma_channelNum))));//// /*clear completion flag*/// (*TPCC_ICR)= 1<<(edma_channelNum);//

}

user1212849:

void my_edma_init(int coreid)是EDMA初始化。my_edma_transfer_wait设置EDMA参数,并触发EDMA,并加查询。my_edma_transfer_no_wait设置EDMA参数,并触发EDMA,没有加查询

Wesley He:

回复 user1212849:

Hi, 

I saw no relationship between whether you check the IPR bit and if the data is landed or not. How do you know the data is landed? By software or CCS/JTAG? Is this happening on a particular EDMA channel, transfer controller? Let's say you setup the EDMA, and trigger the transfer with ESR bit, don't use software to check IPR bit, just look at the EDMA IPR register in JTAG/CCS, do you see the IPR set? If yes, do you see the data landed? Also you may need to look at EDMA user guide, 4.2.2 Error Registers to see if any error logged if data really didn't transfer.

Please find more details in this link, thanks. http://e2e.ti.com/support/dsp/c6000_multi-core_dsps/f/639/p/659713/2424603#2424603

Regards,

Wesley

赞(0)
未经允许不得转载:TI中文支持网 » 6678的EDMA如果不查询传输完成,则不能搬移数据。
分享到: 更多 (0)