Hi All,
I want to transfer the Data on the EDMA channel using Channel No 20 and setting the Channel Manually however it is not transferring the Data.
If I use the Channel No 0 It transfers the data. Attaching the code snippet . Can anybody pls help me in understanding this. I am working on TCI6482DSK.
Code Snippet:
volatile Uint32 index, dummy_cnt;
Uint8 lsu_no;
CSL_SrioContext context;
CSL_Status status;
CSL_SrioHandle hSrio;
CSL_SrioObj srioObj;
CSL_InstNum srioNum = 0;
/* Instance number of the SRIO */
CSL_SrioParam srioParam;
Uint32 clearData;
CSL_SrioDirectIO_ConfigXfr lsu_conf = {0};
CSL_SrioPortData response;
volatile Uint32 loopIndex;
#if
1
printf (
"Running Edma Example\n");
/* Module Initialization */
edma_status = CSL_edma3Init(&edma_context);
if (edma_status != CSL_SOK) {
"Edma module initialization failed\n");
return;
}
/* Module level open */
hModule = CSL_edma3Open(&edmaObj,CSL_EDMA3,
NULL,&edma_status);
if ( (hModule == NULL) || (edma_status != CSL_SOK)) {
"Edma module open failed\n");
/* Module setup */
dmahwSetup.paramNum = 0;
dmahwSetup.que = CSL_EDMA3_QUE_0;
hwSetup.dmaChaSetup = &dmahwSetup;
hwSetup.qdmaChaSetup =
NULL;
edma_status = CSL_edma3HwSetup(hModule,&hwSetup);
"Hardware setup failed\n");
CSL_edma3Close (hModule);
/* Channel 20 open in context of global region 5 */
chAttr.regionNum = CSL_EDMA3_REGION_GLOBAL;
chAttr.chaNum = CSL_EDMA3_CHA_RIOINT1;
hChannel = CSL_edma3ChannelOpen(&chObj, CSL_EDMA3, &chAttr, &edma_status);
if ((hChannel == NULL) || (edma_status != CSL_SOK)) {
"Edma channel open failed\n");
/* Get the PaRAM number associated with this channel */
edma_status = CSL_edma3GetHwChannelSetupParam(hChannel,¶mNum);
"Setup Param failed\n");
/* Obtain a handle to parameter set 20 */
hParamBasic = CSL_edma3GetParamHandle(hChannel, paramNum, &edma_status);
if (hParamBasic == NULL) {
"Edma get param handle for param entry 0 failed\n");
/* Setup the param set */
myParamSetup.option = CSL_EDMA3_OPT_MAKE( CSL_EDMA3_ITCCH_DIS, \
CSL_EDMA3_TCCH_EN, \
CSL_EDMA3_ITCINT_DIS, \
CSL_EDMA3_TCINT_EN,\
8,
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)srcBuff1;
myParamSetup.aCntbCnt = CSL_EDMA3_CNT_MAKE(512,2);
myParamSetup.dstAddr = (Uint32)dstBuff1;
myParamSetup.srcDstBidx = CSL_EDMA3_BIDX_MAKE(512,512);
myParamSetup.linkBcntrld = CSL_EDMA3_LINKBCNTRLD_MAKE(CSL_EDMA3_LINK_NULL,0);
myParamSetup.srcDstCidx = CSL_EDMA3_CIDX_MAKE(0,1);
myParamSetup.cCnt = 1;
edma_status = CSL_edma3ParamSetup(hParamBasic, &myParamSetup);
printf(
"Edma parameter entry setup is failed\n");
/* Initialize data */
for (loopIndex = 0; loopIndex < 512; loopIndex++) {
srcBuff1[loopIndex] = loopIndex;
dstBuff1[loopIndex] = 0;
/* Enable channel 0 */
edma_status = CSL_edma3HwChannelControl(hChannel,CSL_EDMA3_CMD_CHANNEL_ENABLE,
NULL);
"Edma channel enable command for channel 0 is failed\n");
/* Trigger Channel 0 */
CSL_edma3HwChannelControl(hChannel,CSL_EDMA3_CMD_CHANNEL_SET,
Himanshu Charaya,
Welcome to the TI E2E forum. I hope you will find many good answers here and in the TI.com documents and in the TI Wiki Pages. Be sure to search those for helpful information and to browse for the questions others may have asked on similar topics.
Are you aware that TCI6xxx devices are not supported on the forum? They are supported through your local Field Application Engineering team. Please work with them, if you are not sure who your local Field Application Engineer is, please work with your local sales representative to find out who they are.
Where did you get your example project that you used to start this test code? Most likely, it does not setup the DMA channels correctly.
In the E2E thread here is an example that you can try starting from that may have the initialization done correctly. I am only guessing at your problem, but this is a common one.
How did you paste in your code snippet? The formatting makes it difficult to visually parse and understand the code. Pure ASCII text is the easiest to paste, in my opinion, but there is a button in the icon box for the forum editor that is "Paste from Word"; you can use that one to paste formatted text from any of the Microsoft programs.
Regards,RandyP
If you need more help, please reply back. If this answers the question, please click Verify Answer , below.
Search for answers, Ask a question, click Verify when complete, Help others, Learn more.
Thanks RandyP.
Your post was really helpful. I may have missed some of initialization part. Actually i was working on the examples provided in CSL_6482 and trying to do prototyping for transferring the data through SRIO and interrupt the EDMA after completion of SRIO data. As SRIO interrupt is mapped to 20 edma channel so i used ICRR to route the transfer completion on EDMA3 Channel 20. However routing of completion event is not initiating the EDMA transfers. Pls let me know/suggest if there is anything wrong.
Code Snippet is attached.
Regards
Himanshu Charaya
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <csl_edma3.h>
#include <soc.h>
#include <csl_srio.h>
#include <cslr_dev.h>
#define TRANSFER_SIZE 16
#define SRIO_SET_DEVICE_ID(base_dev_id, large_base_dev_id) \
CSL_FMK(SRIO_BASE_ID_BASE_DEVICEID, base_dev_id) | \
CSL_FMK(SRIO_BASE_ID_LARGE_BASE_DEVICEID, large_base_dev_id)
#define LARGE_DEV_ID 0xBEEF
#define SMALL_DEV_ID 0xAB
#define SRIO_PKT_TYPE_NWRITE 0x54
#define SRIO_PKT_TYPE_NREAD 0x24
#define SELECTED_LSU 0
/* Globals EDMA3 */
Uint32 Data_buf_for_test[8192];
Uint32 Data_Rand[8192];
volatile Uint32 count = 0;
volatile Uint32 index = 0;
volatile Uint32 Sys_Count = 0;
volatile Uint32 aa = 0;
/* Edma handle */
CSL_Edma3Handle hModule;
int tccsrio;
void Error_Count(void);
/* Globals SRIO */
volatile Uint32 dummy_cnt;
CSL_SrioContext context_srio;
CSL_InstNum srioNum = 0; /* Instance number of the SRIO */
/* globals */
static Uint8 src[TRANSFER_SIZE];
static Uint8 dst[TRANSFER_SIZE];
static CSL_SrioHwSetup setup = CSL_SRIO_HWSETUP_DEFAULTS;
/* Function prototypes */
void srio_Create_Setup (
CSL_SrioHwSetup *pSetup
int main(void)
{
CSL_Edma3HwSetup hwSetup;
CSL_Edma3Obj edmaObj;
CSL_Edma3ParamHandle hParamBasic;
CSL_Edma3ChannelObj chObj;
CSL_Edma3ChannelHandle hChannel;
CSL_Edma3ParamSetup myParamSetup;
CSL_Edma3Context context;
CSL_Edma3ChannelAttr chAttr;
Uint16 paramNum;
CSL_Edma3HwDmaChannelSetup dmahwSetup[CSL_EDMA3_NUM_DMACH] =
CSL_EDMA3_DMACHANNELSETUP_DEFAULT;
CSL_Edma3HwQdmaChannelSetup qdmahwSetup[CSL_EDMA3_NUM_QDMACH] =
CSL_EDMA3_QDMACHANNELSETUP_DEFAULT;
Uint32 loopIndex;
for (loopIndex = 0; loopIndex < 8192; loopIndex++) {
Data_Rand[loopIndex] = loopIndex;
/* Module initialization */
status = CSL_edma3Init(&context);
if (status != CSL_SOK) {
Sys_Count ++;
return 1;
/* Edma module open */
hModule = CSL_edma3Open(&edmaObj,CSL_EDMA3,NULL,&status);
if ( (hModule == NULL) || (status != CSL_SOK)) {
// *((volatile Uint32 *)0x02a00308) = 0xffffffff; // EMCR
// *((volatile Uint32 *)0x02a0030c) = 0xffffffff; // EMCRH
tccsrio = CSL_EDMA3_CHA_RIOINT1;
/* Edma module setup sets default paramnum and queue for ALL dma and qdma channels */
//dmahwSetup[0].paramNum = 0; // no need to change paramNum from default, but you could do it here
//dmahwSetup[tccCh0].que = CSL_EDMA3_QUE_0;
dmahwSetup[tccsrio].que = CSL_EDMA3_QUE_0;
hwSetup.dmaChaSetup = dmahwSetup;
hwSetup.qdmaChaSetup = qdmahwSetup;
status = CSL_edma3HwSetup(hModule,&hwSetup);
/* Channel SRIO (20) open */
chAttr.chaNum = tccsrio;
hChannel = CSL_edma3ChannelOpen(&chObj, CSL_EDMA3, &chAttr, &status);
if ( (hChannel == NULL) || (status != CSL_SOK)) {
status = CSL_edma3GetHwChannelSetupParam(hChannel,¶mNum);
/* Get a handle to the param set */
hParamBasic = CSL_edma3GetParamHandle(hChannel,paramNum,&status);
/* clear the test_data buffer */
memset(Data_buf_for_test, 0, 8192*sizeof(Uint32));
// *((volatile Uint32 *)0x02A01008) = 0xffffffff; // ECR
// *((volatile Uint32 *)0x02A0100C) = 0xffffffff; // ECRH
// *((volatile Uint32 *)0x02A01030) = 0x00000000; // EESR
// *((volatile Uint32 *)0x02A01034) = 0x00100000; // EESRH
/* Edma parameter entry Setup */
myParamSetup.option = CSL_EDMA3_OPT_MAKE(CSL_EDMA3_ITCCH_DIS,
CSL_EDMA3_TCCH_DIS,
CSL_EDMA3_ITCINT_DIS,
CSL_EDMA3_TCINT_EN,
tccsrio,
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)Data_Rand; // source address
myParamSetup.aCntbCnt = CSL_EDMA3_CNT_MAKE(32768,1); // Acnt Bcnt
myParamSetup.dstAddr = (Uint32)Data_buf_for_test; // destination address
// myParamSetup.dstAddr = 0xc0000000; // destination address
myParamSetup.srcDstBidx = CSL_EDMA3_BIDX_MAKE(0,0); // B src and dst index
myParamSetup.linkBcntrld = CSL_EDMA3_LINKBCNTRLD_MAKE (CSL_EDMA3_LINK_NULL,
0); // link and Bcnt reload
myParamSetup.srcDstCidx = CSL_EDMA3_CIDX_MAKE(0,0); // C src and dst index
myParamSetup.cCnt = 1; // C cnt
status = CSL_edma3ParamSetup(hParamBasic,&myParamSetup);
// *((volatile Uint32 *)0x02A01040) = 0xffffffff; // SECR
// *((volatile Uint32 *)0x02A01044) = 0xffffffff; // SECRH
// *((volatile Uint32 *)0x02A02070) = 0xffffffff; // ICR
// *((volatile Uint32 *)0x02A02074) = 0xffffffff; // ICRH
count++;
/* error count */
Error_Count();
/* Start the SRIO */
/* Unlock the powersaver control register */
CSL_FINST (((CSL_DevRegs*)CSL_DEV_REGS)->PERLOCK, DEV_PERLOCK_LOCKVAL,
UNLOCK);
/* Enable the SRIO */
CSL_FINST (((CSL_DevRegs*)CSL_DEV_REGS)->PERCFG0, DEV_PERCFG0_SRIOCTL,
ENABLE);
/* Initialization and Open of the SRIO */
status = CSL_srioInit (&context_srio);
hSrio = CSL_srioOpen (&srioObj, srioNum, &srioParam, &status);
printf("SRIO: ... Cannot open SRIO, failed\n");
/* Create the setup structure */
srio_Create_Setup (&setup);
/* Setup the SRIO with the selected setup in the last step */
status = CSL_srioHwSetup (hSrio, &setup);
printf("SRIO: ... Hardwrae setup, failed\n");
/* Setup the source and destination */
for(index=0; index<TRANSFER_SIZE; index++) {
src[index] = index + 1;
dst[index] = 0;
/* Create an LSU configuration */
lsu_conf.srcNodeAddr = (Uint32)&src[0]; /* Source address */
lsu_conf.dstNodeAddr.addressHi = 0;
lsu_conf.dstNodeAddr.addressLo = (Uint32)&dst[0]; /* Destination address */
lsu_conf.byteCnt = TRANSFER_SIZE;
lsu_conf.idSize = 1; /* 16 bit device id */
lsu_conf.priority = 2; /* PKT priority is 2 */
lsu_conf.xambs = 0; /* Not an extended
address */
lsu_conf.dstId = LARGE_DEV_ID;
/* Changed the code to generate interrupt */
lsu_conf.intrReq = 1; /* Setting the interrupts */
lsu_conf.pktType = SRIO_PKT_TYPE_NWRITE;
/* write with no
response */
lsu_conf.hopCount = 0; /* Valid for
maintainance pkt */
lsu_conf.doorbellInfo = 0; /* Not a doorbell pkt */
lsu_conf.outPortId = 0; /* Tx on Port 0 */
/* Configure the LSU1 and start transmission */
lsu_no = SELECTED_LSU;
/* Route the transaction completion interrupt to EDMA Which is at INDST1 */
hSrio->regs->LSU_ICRR[lsu_no] = 1;
/* Manually trigger the channel */
status = CSL_edma3HwChannelControl(hChannel,CSL_EDMA3_CMD_CHANNEL_SET,NULL);
CSL_srioLsuSetup (hSrio, &lsu_conf, lsu_no);
/* Wait for the completion of transfer */
response.index = lsu_no;
do {
CSL_srioGetHwStatus (hSrio, CSL_SRIO_QUERY_LSU_BSY_STAT, &response);
}while(response.data == 1);
/* A delay, above checks seems to be not working
may be because, it is a write operation with
no response */
for(index=0; index<0x10000; index++) {
dummy_cnt = index + 1;
dummy_cnt++;
/* For Clearing the Interrupt */
clearData = CSL_SRIO_LSU_INTR0;
CSL_srioHwControl(hSrio, CSL_SRIO_CMD_LSU_INTR_CLEAR, &clearData);
if (index == TRANSFER_SIZE) {
printf("SRIO: ... LSU transfered %d bytes of data correctly\n",
TRANSFER_SIZE);
} else {
printf("SRIO: ... LSU failed to transfer data\n");
/* Channel close */
status = CSL_edma3ChannelClose(hChannel);
/* Edma module close */
status = CSL_edma3Close(hModule);
return 0;
/* Event trigger the channel */
status = CSL_edma3HwChannelControl(hChannel,CSL_EDMA3_CMD_CHANNEL_ENABLE,NULL);
In the CCS debugger, you can view an expression such as hmodule, then click the + signs to get to the registers for the EDMA3. You can do the same with the SRIO.
For debug purposes, comment out the call that enabled the EDMA Event (has _CHANNEL_ENABLE). Run the code then look at the ER register to see if the bit is set for this channel. If it is set, then the problem is in the programming of the EDMA; if it is not set, then the problem is in the programming of the SRIO and routing the event to the EDMA.
Hi RandyP
Thanks for your suggestion i have debugged the issue and now interrupt is routing to INDST1 and data transfer is taking place however this only works when i reset the device.
If I debug without resetting the device data transfer doesn't take place as the corresponding bit in ER is not set this implies that SRIO interrupt routing is not taking place correctly.
I have tried to find the difference between two states and found that only two registers HOST BASE ID BLOCK ((FFFF in worng) and (ABEF in Pass)). and SP_ACKID_STAT that is in LSU REG5 are different.
Can you please suggest why SRIO is not able to route the interrupt without resetting the device.
Thanks
Himanshu
Himanshu,
To be clear, is your concern for
We sometimes use interrupt and event interchangeably, so it can help to be more clear on this point.
My first thought is that the continuing operation of the SRIO interface has caused an error condition to occur in the EDMA logic. Please check the EMR and SER registers to see if they are set for this DMA channel. That could prevent additional transfers from occurring.