This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

the question is about EDMA on dm6446

the question is about EDMA on dm6446
We want to transfer "srcBuff1[512]" to "dstBuff1[512]" by EDMA.
we write the code,but the code didn't transfer "srcBuff1[512]" to "dstBuff1[512]" .
we don't konw how to remedy the code?

//----------------------------CODE-----------------------------------------

#include<csl.h>
#include<csl_edma.h>
#include <socEdma.h>
#include <csl_edmaAux.h>
#include <soc64plus.h>

/* Globals */
Uint8       srcBuff1[512];
Uint8       srcBuff2[512];
Uint8       dstBuff1[512];
Uint8       dstBuff2[512];
void edma_chain_example (void);
void main(void)
{ edma_chain_example ();
      return;   }

void edma_chain_example (void)
{
    CSL_EdmaHandle             hModule;      //!
    CSL_EdmaParamHandle        hParamBasic;  //!
    CSL_EdmaParamHandle        hParamBasic1;
    CSL_EdmaChanObj         chObj;        //!
    CSL_EdmaChanObj         chObj1;
    CSL_BitMask32            regionIntr[2];
    CSL_EdmaCmdDmaRegion            regionAccess;    //!
    CSL_EdmaChanHandle      hChannel;        //!
    CSL_EdmaChanHandle      hChannel1;
    CSL_EdmaParamSetup         myParamSetup;
    CSL_EdmaParamSetup         myParamSetup1;
    CSL_EdmaContext            context;            //!
    CSL_EdmaChannelParam        chAttr;             //!
    CSL_EdmaChannelParam        chAttr1;
    CSL_Status                  status;             //!
    CSL_EdmaRegionParam regParam;
    CSL_EdmaRegionObj RegionObj;
    CSL_EdmaRegionHandle  shHndl;
    CSL_EdmaHwChannelSetup    setup;
    CSL_EdmaHwChannelSetup    setup1;
    CSL_Status st;
    volatile Uint32             loopIndex;
    printf ("Running Edma Example\n");

    /* Module Initialization */
    status = CSL_edmaInit(&context);
    if (status != CSL_SOK) {
        printf ("Edma module initialization failed\n");  
        return;
    }
   
    /* Module level open */
    hModule = CSL_edmaOpen(NULL,CSL_EDMA_1,NULL,&status);
    if ( (hModule == NULL) || (status != CSL_SOK)) {
        printf ("Edma module open failed\n");   
        return;}
    
    /* DRAE enable(Bits 0-15) for the shadow region 5 */
    regionAccess.region = CSL_EDMA_REGION_5 ;
    regionAccess.drae =   0xFFFF ;    //????
    regionAccess.draeh =  0x0 ;       //???
    status = CSL_edmaHwControl(hModule,CSL_EDMA_CMD_DMAREGION_ENABLE, &regionAccess);
    if (status != CSL_SOK) {
        printf ("Edma region enable command failed\n");
        return;}

     /*Open shadow regions OK3*/
     regParam.regionNum = CSL_EDMA_REGION_5;
     shHndl = CSL_edmaRegionOpen(&RegionObj,CSL_EDMA_1,&regParam,&status);
     if((shHndl== NULL) ||(status != CSL_SOK))
     { printf ("Edma region open failed\n");
        return;}

    /* Channel 0 open in context of shadow region 5 OK4*/
    chAttr.regionNum = CSL_EDMA_REGION_5;
    chAttr.chaNum = CSL_EDMA_CHA0;
    hChannel = CSL_edmaChannelOpen(&chObj, CSL_EDMA_1, &chAttr, &status);  
    if ((hChannel == NULL) || (status != CSL_SOK)) {
        printf ("Edma channel open failed\n");
        return;}
    
    // Channel0 Setup  OK 5
    setup.que =  CSL_EDMA_EVT_QUE0;//???
    setup.paramEntry = CSL_EDMA_CHA0;
   // setup.triggerWord = CSL_EDMA_TRIGWORD_NONE;
    CSL_edmaHwChannelSetup(hChannel,&setup);
   
    /* Obtain a handle to parameter set 0 OK6*/
    hParamBasic = CSL_edmaGetParamHandle(hChannel,CSL_EDMA_CHA0, &status);
    if (hParamBasic == NULL) {
        printf ("Edma get param handle for param entry 0 failed\n");   
        return;}
   
    /* Setup the param set OK7..*/
    myParamSetup.option = CSL_EDMA_OPT_MAKE(  FALSE, FALSE, FALSE, TRUE,8,CSL_EDMA_TCC_NORMAL,CSL_EDMA_FIFOWIDTH_NONE, \
                                              FALSE, CSL_EDMA_SYNC_AB, CSL_EDMA_ADDRMODE_INCR, CSL_EDMA_ADDRMODE_INCR);          
    myParamSetup.srcAddr = (Uint32)srcBuff1;        
    myParamSetup.aCntbCnt = CSL_EDMA_CNT_MAKE(512,2);      
    myParamSetup.dstAddr = (Uint32)dstBuff1;       
    myParamSetup.srcDstBidx = CSL_EDMA_BIDX_MAKE(512,512);    
    myParamSetup.linkBcntrld = CSL_EDMA_LINKBCNTRLD_MAKE(CSL_EDMA_LINK_NULL,0);    
    myParamSetup.srcDstCidx = CSL_EDMA_CIDX_MAKE(0,1);    
    myParamSetup.cCnt = 1;
    myParamSetup.triggerWord = CSL_EDMA_TRIGWORD_NONE;

    status = CSL_edmaParamSetup(hParamBasic, &myParamSetup,CSL_EDMA_PARAM_BASIC/*??*/);
    if (status != CSL_SOK) {
        printf("Edma parameter entry setup is failed\n");
        return;
    }
   
     /* Channel 8 open in context of shadow region 5 */
    chAttr1.regionNum = CSL_EDMA_REGION_5;
    chAttr1.chaNum = CSL_EDMA_CHA8;
    hChannel1 = CSL_edmaChannelOpen(&chObj1, CSL_EDMA_1, &chAttr1, &status);  
    if ((hChannel1 == NULL) || (status != CSL_SOK)) {
        printf ("Edma channel open failed\n");
        return;}

     // Channel8 Setup  OK 5
    setup1.que =  CSL_EDMA_EVT_QUE1;//???
    setup1.paramEntry = CSL_EDMA_CHA8;
   // setup.triggerWord = CSL_EDMA_TRIGWORD_NONE;
    CSL_edmaHwChannelSetup(hChannel1,&setup1);

    /* Obtain a handle to parameter set 8 */
    hParamBasic1 = CSL_edmaGetParamHandle(hChannel1,CSL_EDMA_CHA8, &status);

    /* Setup the param set */
    myParamSetup1.option = CSL_EDMA_OPT_MAKE( FALSE, FALSE, FALSE, TRUE, 1, CSL_EDMA_TCC_NORMAL, CSL_EDMA_FIFOWIDTH_NONE, \
                                              TRUE,CSL_EDMA_SYNC_AB, CSL_EDMA_ADDRMODE_INCR, CSL_EDMA_ADDRMODE_INCR);          
    myParamSetup1.srcAddr = (Uint32)srcBuff2;
    myParamSetup1.aCntbCnt = CSL_EDMA_CNT_MAKE(512,2);      
    myParamSetup1.dstAddr = (Uint32)dstBuff2;       
    myParamSetup1.srcDstBidx = CSL_EDMA_BIDX_MAKE(512,512);    
    myParamSetup1.linkBcntrld = CSL_EDMA_LINKBCNTRLD_MAKE(CSL_EDMA_LINK_NULL,0);    
    myParamSetup1.srcDstCidx = CSL_EDMA_CIDX_MAKE(0,1);    
    myParamSetup1.cCnt = 1;
    myParamSetup.triggerWord = CSL_EDMA_TRIGWORD_NONE;

    status = CSL_edmaParamSetup(hParamBasic1,&myParamSetup1,CSL_EDMA_PARAM_BASIC);
    if (status != CSL_SOK) {
        printf("Edma parameter entry setup is failed\n");
        return;}
   
    /* Enable channel 0 OK8*/
    status = CSL_edmaHwChannelControl(hChannel,CSL_EDMA_CMD_CHANNEL_ENABLE, NULL);
    if (status != CSL_SOK) {
        printf("Edma channel enable command for channel 0 is failed\n");
        return;}
                                     
    /* Enable channel 8 */
    status = CSL_edmaHwChannelControl(hChannel1,CSL_EDMA_CMD_CHANNEL_ENABLE,NULL);
    if (status != CSL_SOK) {
        printf("Edma channel enable command for channel 8 is failed\n");
        return;}
   
    /* Initialize data*/
    for (loopIndex = 0; loopIndex < 512; loopIndex++) {
        srcBuff1[loopIndex] = loopIndex;
        srcBuff2[loopIndex] = loopIndex;
        dstBuff1[loopIndex] = 0;
        dstBuff2[loopIndex] = 0;       }
   
    /* Trigger Channel 0 */
    CSL_edmaHwChannelControl(hChannel,CSL_EDMA_CMD_CHANNEL_SET,NULL);

   // regionIntr.region = CSL_EDMA_REGION_5;
    do {
        /* Poll on interrupt bit 8 */
       st= CSL_edmaGetHwStatus(hModule,CSL_EDMA_QUERY_INTERRUPT_PENDSTATUS,&regionIntr);
 
    } while (!(regionIntr[0] & 0x100));
  
    /* Clear interrupt bit 8 */
    status = CSL_edmaHwControl(hModule,CSL_EDMA_CMD_INTERRUPT_CLEAR, &regionIntr);
    if (status != CSL_SOK) {
        printf("Edma clear interrupt bit 0 command is failed\n");
        return;
    }
   
     /* Disable the region 5 */
    regionAccess.region = CSL_EDMA_REGION_5 ;
    regionAccess.drae =   0xFFFF ;  
    regionAccess.draeh =  0x0 ;
    status = CSL_edmaHwControl(hModule,CSL_EDMA_CMD_DMAREGION_ENABLE, &regionAccess);

    /* clear the EDMA error registers */
  
    CSL_edmaHwChannelControl (hChannel, CSL_EDMA_CMD_CHANNEL_DISABLE, NULL);
    CSL_edmaHwChannelControl (hChannel, CSL_EDMA_CMD_CHANNEL_CLEAR, NULL);
    /* Close channel */
    status = CSL_edmaChannelClose(hChannel);
    if (status != CSL_SOK) {
        printf("Edma channel close failed\n");
        return;}
   
    /* Close edma module */
    status = CSL_edmaClose(hModule);
    if (status != CSL_SOK) {
        printf("Edma module close failed\n");
        return;
    }
   
    printf ("=============================================================\n");
   
    return;
}

  • csl.h 、csl_edma.h、socEdma.h、csl_edmaAux.h、soc64plus.h   were  writen by “Texas Instruments Inc 2002, 2003, 2004, 2005”  for  DM6446

  • Seems like this code is ported over from some other device to DM6446? DM6446 does not have 5 shadow regions, and I see that mentioned in the code.

    What is the source and destination address locations ? Can you also show the memory dump of what is getting programmed into the PARAMs that you have associated with this transfer?

    Regards

    Mukul

  • thank you for Mukul's  answer!

    I refer  the edma code  on C6455 ,and  wrote  this code.   same  functions  on C6455 are  different  from DM6446 ,and I have  remedied 。

    "DM6446 does not have 5 shadow regions"  ,and  how many  shadow regions  DM6446  have?

    I  think  srcBuff1[512] and  dstBuff1[512]  have  their  own  address,we wen  see  them  from  “watch” and “memory” on ccs.

    "Can you also show the memory dump of what is getting programmed into the PARAMs that you have associated with this transfer?"  I don't understand ,  would  you  explain it  or  give me a  example?

     

  • huang huang said:
    I refer  the edma code  on C6455 ,and  wrote  this code.   same  functions  on C6455 are  different  from DM6446 ,and I have  remedied 。

    Thanks for clarifying that. So I hope you are also taking care of making the changes to ensure the linker command file used is for the DM6446 memory map and the EDMA3 base addresses etc are DM6446 specific (not c6455), for instance the EDMA3 CC registers start at address 0x2A00 0000 for c6455 , where as it starts at 0x01c0 0000 etc. the soc*.h files would be different for c6455 vs DM6446. Please keep in mind that these set of functional CSL APIs are not supported for DM6446. For DM6446 , it is recommended to use the EDMA3LLD driver.

    huang huang said:
    "DM6446 does not have 5 shadow regions"  ,and  how many  shadow regions  DM6446  have?

    It has 4 shadow regions. This is explained in the EDMA3 user guide

    http://focus.ti.com/lit/ug/sprue23d/sprue23d.pdf  (Section 2.7.2).

    If you are using DSP to program the EDMA, then I recommend sticking to Shadow Region 1

    huang huang said:
    I  think  srcBuff1[512] and  dstBuff1[512]  have  their  own  address,we wen  see  them  from  “watch” and “memory” on ccs.

    Can you tell me what addresses you see in the watch/memory window. I was just making sure that you are using the DM6446 memory map/linker command file.

    huang huang said:

    "Can you also show the memory dump of what is getting programmed into the PARAMs that you have associated with this transfer?"  I don't understand ,  would  you  explain it  or  give me a  example?

    I am asking for content in the PARAM at addresses 0x01c04000 (for channel 0 PARAM) and 0x01c04100 (for Channel 8 PARAM) , if these are the PARAM locations you are programming, then you should be able to see the ACNT/BCNT/SRC/DST values for these PARAMs from the memory window or using a watch window for hParamBasic/hParamBasci1?

    Regards

    Mukul