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

C6657 CSL_EDMA3 最后48字节没有传输

尊敬的TI工程师和社区会员,你们好,我最近买了TMS320C6657Lite评估版,帮助老师做一些信号处理算法方面的验证,以便于后续的开发。其中使用到EDMA3将数据从DDR3传输到L2 Cache,产生了三个问题:

1.EDMA3 Low Level Driver是不是一定需要配合SYS/BIOS才能够使用,RTSC工程是否也一定需要SYS/BIOS组件;

2.在使用CSL中EDMA3的API实现数据搬移时,最后48个字节总是没有传输,无论怎样改变数据大小和数据类型,代码附在后面,我使用的是CCS5.4,pdk_C6657_1_1_2_6(代码是L2到L2的数据搬移,软件仿真和硬件上运行都是一样的问题);

3.pdk_C6657_1_1_2_6和pdk_c665x_2_0_4似乎改版很大?

问题2的代码:

/*
 * main.c
 */

#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <time.h>
#include <c6x.h>

#include <ti/csl/csl_edma3.h>

// for C6657, CSL_EDMA3 instance is No. 2
#define CSL_EDMA3			2
#define CSL_EDMA3_PARAM_0	0
#define CSL_EDMA3_TCC_0		CSL_EDMA3_PARAM_0

// data size
#define DATASIZE 128


Int main(void) {
	
	// edma3 instance and pointer
	CSL_Edma3HandlehModule;
	CSL_Edma3ObjedmaObj;

	// CSL function return
	CSL_Status			status;

	// global or shadow region
	CSL_Edma3CmdDraeregionAccess;
	CSL_Edma3CmdIntr			regionIntr;

	// channel
	CSL_Edma3ChannelObj			chObj;
	CSL_Edma3ChannelHandlehChannel;
	CSL_Edma3ChannelAttrchAttr;

	// param
	CSL_Edma3ParamHandle	hParamBasic;
	CSL_Edma3ParamSetup		myParamSetup;

	// test data
	Int srcBuff[DATASIZE];
	Int dstBuff[DATASIZE];
	Int i;
	for(i = 0; i < DATASIZE; i++){
		srcBuff[i] = i;
		dstBuff[i] = 0;
	}


	// module initialization, always return CSL_SOK
	CSL_edma3Init(NULL);

	// module level open
	hModule = CSL_edma3Open(&edmaObj, CSL_EDMA3, NULL, &status);
	if(hModule == NULL || status != CSL_SOK){
		printf("Edma module open failed\n");
		return 0;
	}

	// DRAE Enable(Bits 0-15) for the Shadow Region 0.
	regionAccess.region = CSL_EDMA3_REGION_0;
	regionAccess.drae =0xFFFF;
	regionAccess.draeh =  0x0000;
	status = CSL_edma3HwControl(hModule, CSL_EDMA3_CMD_DMAREGION_ENABLE, &regionAccess);
	if(status != CSL_SOK){
		printf("Edma region enable command failed\n");
		return 0;
	}

	// Channel 0 Open in context of Shadow region 0
	chAttr.regionNum = CSL_EDMA3_REGION_0;
	chAttr.chaNum= 0;
	hChannel = CSL_edma3ChannelOpen(&chObj, CSL_EDMA3, &chAttr, &status);
	if(hChannel == NULL || status != CSL_SOK){
		printf("Edma channel open failed\n");
		return 0;
	}

	// channel setup
	status = CSL_edma3HwChannelSetupParam(hChannel, CSL_EDMA3_PARAM_0);
	if(status != CSL_SOK){
		printf("Edma channel setup param failed\n");
		return 0;
	}
	// obtain a handle to param set 0
	hParamBasic = CSL_edma3GetParamHandle(hChannel, 0, &status);
	if(hParamBasic == NULL){
		printf("Edma get param handle for param entry 0 failed\n");
		return 0;
	}

	// channel default queue set to be 0
	status = CSL_edma3HwChannelSetupQue(hChannel, CSL_EDMA3_QUE_0);
	if(status != CSL_SOK){
		printf("Edma channel setup que failed\n");
		return 0;
	}

	// setup the parameter set
	myParamSetup.option = CSL_EDMA3_OPT_MAKE(CSL_EDMA3_ITCCH_DIS,
											CSL_EDMA3_TCCH_DIS,
											CSL_EDMA3_ITCINT_DIS,
											CSL_EDMA3_TCINT_EN,
											CSL_EDMA3_TCC_0,
											CSL_EDMA3_TCC_NORMAL,
											CSL_EDMA3_FIFOWIDTH_NONE,
											CSL_EDMA3_STATIC_DIS,
											CSL_EDMA3_SYNC_AB,
											CSL_EDMA3_ADDRMODE_INCR,
											CSL_EDMA3_ADDRMODE_INCR);
	myParamSetup.srcAddr = (Uint32)srcBuff;
	myParamSetup.aCntbCnt = CSL_EDMA3_CNT_MAKE(DATASIZE,4);
	myParamSetup.dstAddr = (Uint32)dstBuff;
	myParamSetup.srcDstBidx = CSL_EDMA3_BIDX_MAKE(DATASIZE,DATASIZE);
	myParamSetup.linkBcntrld = CSL_EDMA3_LINKBCNTRLD_MAKE(CSL_EDMA3_LINK_NULL,0);
	myParamSetup.srcDstCidx = CSL_EDMA3_CIDX_MAKE(0,0);
	myParamSetup.cCnt = 1;
	status = CSL_edma3ParamSetup(hParamBasic, &myParamSetup);
	if(status != CSL_SOK){
		printf("Edma parameter entry setup failed\n");
		return 0;
	}


	// clear any pending event and then enable channel
	status = CSL_edma3HwChannelControl(hChannel,CSL_EDMA3_CMD_CHANNEL_CLEAR,NULL);
	if(status != CSL_SOK){
		printf("Edma channel 0 clear failed\n");
		return 0;
	}
	// Event enable
	status = CSL_edma3HwChannelControl(hChannel,CSL_EDMA3_CMD_CHANNEL_ENABLE,NULL);
	if(status != CSL_SOK){
		printf("Edma channel 0 enable failed\n");
		return 0;
	}

	// trigger channel 0
	CSL_edma3HwChannelControl(hChannel, CSL_EDMA3_CMD_CHANNEL_SET, NULL);

	// poll on interrupt bit 1
	regionIntr.region = CSL_EDMA3_REGION_0;
	while(1){
		CSL_edma3GetHwStatus(hModule, CSL_EDMA3_QUERY_INTRPEND, &regionIntr);
		if(regionIntr.intr & (1<<CSL_EDMA3_PARAM_0)){
			printf("capture interrupt\n");
			break;
		}
	}

	// clear interrupt bits
	status = CSL_edma3HwControl(hModule, CSL_EDMA3_CMD_INTRPEND_CLEAR, &regionIntr);
	if(status != CSL_SOK){
		printf("Edma, clear interrupt bits failed\n");
		return 0;
	}

	for(i = 0; i < DATASIZE; i++){
		if(srcBuff[i] != dstBuff[i]){
			printf("*******************\ntransfer error\n********************\n");
			break;
		}
	}
	if(i == DATASIZE){
		printf("transfer success\n");
	}

	// close channel
	status = CSL_edma3ChannelClose(hChannel);
	if(status != CSL_SOK){
		printf("Edma channel close failed\n");
		return 0;
	}

	// Close the Module.
	status = CSL_edma3Close(hModule);
	if(status != CSL_SOK){
		printf("Edma module close failed\n");
		return 0;
	}

	return 0;
}

包含的头文件和链接的库:

"${CG_TOOL_ROOT}/include"
"D:\ti\pdk_C6657_1_1_2_6\packages"

"libc.a"
"D:\ti\pdk_C6657_1_1_2_6\packages\ti\csl\lib\ti.csl.ae66"

cmd文件里指定以下选项避免printf出错,代码段和数据段都存储在L2 Cache中

-heap 0x8000
-stack 0xC000

产生的现象就是dstBuff里面只有1-115,后面是12个0。

另外,pdk_C6657_1_1_2_6包中的html说明文件有很多代码片段,但是却没有比较完整的例程,如果您能将一些常用的例程分享,将帮了我的大忙,非常感谢!我的邮箱是2455253013@qq.com

Thomas Yang1:

建议参考置顶帖中的STK例程代码,这个是不带SYS/BIOS的,其中有EDMA的例子源代码和使用文档

user4242372:

回复 Thomas Yang1:

谢谢回答,关于我的程序的最后48字节没有传输的问题能够解答一些吗?

赞(0)
未经允许不得转载:TI中文支持网 » C6657 CSL_EDMA3 最后48字节没有传输
分享到: 更多 (0)