Part Number: EVMK2G
Hi experts,
For my work I developed a bare metal code on the evaluation board EVMK2G that is loaded in the DSP C66x by means of the on-board debugger TI XDS2xxx.
I downloaded the ti-processor-sdk-rtos-k2g-evm-06.03.00.106-Windows-x86-Install.exe and I installed CCS10.2
Currently I want to program the EDMA in order to copy data between memories.
I run the CSL example C:\ti_hpc\pdk_k2g_1_0_16\packages\ti\csl\example\edma\edma_test.c and it does not work.
#include "edma.h"
#include <stdio.h>
//#include <ti/csl/csl_edma3.h>
//#include <ti/csl/csl_edma3Aux.h>
//#include <ti/csl/csl_cacheAux.h>
//#include <ti/csl/hw_types.h>
#include <ti/csl/soc/k2g/src/cslr_soc_baseaddress.h>
/* Global Buffers (Source and Destination) for PING-PONG */
Uint8 srcBuff1[3];
Uint8 dstBuff1[3];
CSL_Edma3Context context;
CSL_Edma3Obj edmaObj;
CSL_Edma3Handle hModule;
CSL_Status status;
CSL_Edma3ChannelHandle hChannel;
CSL_Edma3ChannelAttr chAttr;
CSL_Edma3ChannelObj chObj;
CSL_Edma3ParamSetup myParamSetup;
CSL_Edma3ParamHandle hParamSet2;
CSL_Edma3CmdIntr regionIntr;
void main_dma (void)
{
Uint8 channelNum = 0;
Uint8 instNum = 0;
Uint32 loopIndex;
Uint32 ParamSetNum = 2;
printf ("\n**************************************************\n");
printf ("***************** EDMA Testing start *************\n");
printf ("**************************************************\n");
/* 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);
/* Initialize data */
for (loopIndex = 0; loopIndex < 3; loopIndex++)
{
srcBuff1[loopIndex] = loopIndex+11;
dstBuff1[loopIndex] = 0;
}
CSL_edma3Init(&context); // Module initialization
hModule = CSL_edma3Open(&edmaObj, instNum, NULL, &status); // Open the EDMA Module using the provided instance number
chAttr.regionNum = CSL_EDMA3_REGION_GLOBAL;
chAttr.chaNum = channelNum;
hChannel = CSL_edma3ChannelOpen(&chObj, instNum, &chAttr, &status);
CSL_edma3HwChannelSetupQue(hChannel,CSL_EDMA3_QUE_1);
CSL_edma3MapDMAChannelToParamBlock (hModule, channelNum, ParamSetNum); // Map the DMA Channel 0 to PARAM Block 2 (Channel0 --> Paramset2)
hParamSet2 = CSL_edma3GetParamHandle(hChannel, ParamSetNum, &status); // Obtain a handle to parameter set 2
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(5,1);
myParamSetup.dstAddr = (Uint32)dstBuff1;
myParamSetup.srcDstBidx = CSL_EDMA3_BIDX_MAKE(1,1);
myParamSetup.linkBcntrld= CSL_EDMA3_LINKBCNTRLD_MAKE(0,0);
myParamSetup.srcDstCidx = CSL_EDMA3_CIDX_MAKE(0,1);
myParamSetup.cCnt = 1;
CSL_edma3ParamSetup(hParamSet2,&myParamSetup);
regionIntr.region = CSL_EDMA3_REGION_GLOBAL;
regionIntr.intr = 0x3;
regionIntr.intrh = 0x0000;
CSL_edma3HwControl(hModule,CSL_EDMA3_CMD_INTR_ENABLE,®ionIntr);
//CSL_edma3HwChannelControl(hChannel,CSL_EDMA3_CMD_CHANNEL_SET,NULL); // Trigger channel
CSL_edma3SetDMAChannelEvent ((CSL_Edma3Handle)hChannel,hChannel->region, hChannel->chaNum);
printf ("**************************************************\n");
printf ("***************** EDMA Testing End ***************\n");
printf ("**************************************************\n");
/* The test passed. */
return 0;
} // end main_dma
I noticed that the EDMACC0_ESR register has not been set. Therefore, the manual trigger would not be set.
Can the DSP manually triggers a DMA channel?
According the TMR of 66AK2G1x: "The event set registers (EDMACC_ESR/EDMACC_ESRH) allows the DSP (EDMA programmers) to manually set events to initiate DMA transfer requests. DSP writes of 1 to any event set register (E n) bits set the corresponding bits in the registers".
I simply tried the basic command HW_WR_REG32(0x2701010U, 0x01) where 0x2701010 is the address of EDMACC0_ESR. However, by means of the debugger I verified that the register ESR is always 0x0.
Any suggestions concerning how to manually trigger an EDMA channel by means of the DSP?
I thank you in advance.
Best regards,
Benito