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.

decreasing time execution by using EDMA3

Other Parts Discussed in Thread: TMS320C6455

Hi

My tools are:

OS: win XP

CCS: 3.3

DSP: C6455

In my program I used memset() for zeroing external memory(200 KB) and it consumed a lot of time (7 ms) for solving the problem I decided to use EDMA3 via CSL.

Question :

Is my solution correct? Do you have better solution?

Best Regards

 

  • Hi,

    Thanks for your post.

    To my understanding, EDMA3 CSL approach would be the better optimized approach without any doubt.

    There are EDMA CSL examples to perform a simple memory to memory transfer using EDMA and you shall download the C6455 DSK software package in the below link:

    http://c6000.spectrumdigital.com/dsk6455/v2/files/dsk6455_v2.zip

    After you download the package, the EDMA CSL examples shall be found at the below path:

    ~\dsk6455_v2\boards\dsk6455_v2\csl_c6455\example\edma\edma2x_example

    In addition to the above, there are several EDMA examples (interrupt, ping pong buffering etc), in which you shall refer the EDMA configuration for all usecase examples. For more info, you shall refer the C6455 CSL API reference guide & release notes at the below path:

    ~\dsk6455_v2\boards\dsk6455_v2\docs\csl

    Please refer the below C645x EDMA3 controller user guide in which there is a block move example which performs EDMA transfer:

    http://www.ti.com/lit/ug/spru966c/spru966c.pdf

    Thanks & regards,

    Sivaraj K

    -------------------------------------------------------------------------------------------------------

    Please click the Verify Answer button on this post if it answers your question.

    --------------------------------------------------------------------------------------------------------

  • Hi
    Thanks for your answer
    I download CSL vesrsion "03.00.10.02" and I have two question.

    Question 1:
    How can I integrate CSL to CCS3.3?

    In tms320c6455 data sheet, It said there is EDMA3 in the device.
    Question 2:
    Why the example that you said above is edma2?(~\dsk6455_v2\boards\dsk6455_v2\csl_c6455\example\edma\edma2x_example)

    Regards
  • Hi,

    Thanks for your update.

    I think, to address Question#1, I think, you have to link the CSL library in the linker library search path in the project properties, and create a new CCSv3.3 based .pjt & include all source file dependencies which should be part of C compiler standard includes, source file include definitions and other library dependencies would build & execute the project successfully.

    To address Question#2, It is not edma2 and it is EDMA3 which is the appropriate device module as per datasheet and there shouldn't be any confusion on this.

    and edma2x_example should be the 2D EDMA data transfer example type which is the example name. Kindly do not misunderstand the device and software example terminologies.

    Thanks & regards,

    Sivaraj K

    -------------------------------------------------------------------------------------------------------

    Please click the Verify Answer button on this post if it answers your question.

    --------------------------------------------------------------------------------------------------------

  • Dear Sivaraj

    For programming and working with EDMA3 I have done the following:

    1) I studied "sprugs5b.pdf".

    2)I integrated CSL library to my project succesfully.

    3) I ran TI CSL EDMA example (edma_ping_pong_xfer_gbl_reg) succesfully.

    4) I modified TI CSL EDMA example (edma_ping_pong_xfer_gbl_reg) according to my application and run it. I describe my modifications and next I ask some questions.

    My goal: I want to zero 1,638,400B from start of DDR2 memory(0XE0000000).

    My new PaRAM:

    My code:

    8712.Edma.c
    /*  ===========================================================================
     *   Copyright (c) Texas Instruments Inc 2002, 2003, 2004, 2005
     *
     *   Use of this software is controlled by the terms and conditions found in the
     *   license agreement under which this software has been supplied.
     *   ==========================================================================
     */
    
    /** ===========================================================================
     *
     *   @file  Edma_ping_pong_xfer_gbl_reg.c
     *
     *   @path  $(CSLPATH)\example\edma\edma_ping_pong_xfer_gbl_reg\src
     *
     *   @desc  Example of EDMA
     *
     *  ============================================================================
     *   @n Target Platform: EVM
     *  ============================================================================
     *   @n <b> Example Description </b>
     *   @n This is an example of the CSL EDMA usage for the channel Initialization 
     *      for ping pong buffer transfer where channels are opened in the 
     *      global region. This example, 
     *        1. Initializes and opens the CSL EDMA module
     *        2. Sets up Edma module to default values 
     *        3. Opens EDMA channel 0 in the region 1
     *        4. Sets up the channel queue 3
     *        5. Gets the param handle for PARAM 0, 1, 2 
     *        6. Sets up the EDMA PARAM for ping and pong buffers
     *        7. Enables Interrupt (Bit 0-2) for the global region interrupts
     *        8. Manually triggers the channel 0
     *        9. Polls 0n IPR bit 0 and 2
     *        10. Clears the pending bit
     *        11. Does the data comparision to ensure the transffered data is proper 
     *            or not
     *        12. Displays the result based on step 11
     *
     * =============================================================================
     *      
     *   <b> Procedure to run the example </b>
     *   @verbatim
     *      1. Configure the CCS setup to work with the emulator being used
     *      2. Please refer CCS manual for setup configuration and loading 
     *         proper GEL file
     *      3. Launch CCS window
     *      4. Open project Edma_ping_pong_xfer_gbl_reg.pjt
     *      5. Build the project and load the .out file of the project.
     *          
     *   @endverbatim
     *
     */
     
    /* ============================================================================
     *  Revision History
     *  ===============
     *  29-May-2004 Ruchika Kharwar    File Created.
     *
     *  16-Dec-2005 ds                Updated documentation 
     * ============================================================================
     */
    
    #include <stdio.h>
    #include <csl_edma3.h>
    #include <soc.h>
    /* defines*/
    #define DestAddr 0xE0000000
    
    /*
     * =============================================================================
     *   @func  edma_ping_pong_xfer_gbl_region
     *  
     *   @arg
     *      NONE
     *
     *   @desc
     *      This is the example routine which perform edma ping pong buffer transfer
     *      where channel is open in the global region.
     *      It implements following steps
     *          1. Intializes and Opens the Edma and Intc module.
     *          2. Sets up the interrupt for the edma global region.
     *          3. Sets up the edma module using the API csl_edma3Hwsetup () 
     *          4. Enables the edma global region
     *          5. Opens the channel nd get the param handle for PARAM 0, 1, 2
     *          6. Sets up the edma param entry for ping and pong buffers 
     *          7. Enables the edma interrupt using CSL_EDMA3_CMD_INTR_ENABLE. 
     *          7. Enables Interrupt (Bit 0-2) for the global region interrupts
     *          8. Manually triggers the channel 0
     *          9. Polls 0n IPR bit 0 
     *          10. Clear the pending bit
     *          11. Manually triggers the channel 0
     *          12. Polls 0n IPR bit 2 
     *          13. Clears the pending bit
     *          14. Compares the data in the destination buffer is proper or not.
     *          15. Closes the edma module and channel.
     *
     *   @return
     *      NONE
     *
     * =============================================================================
     */
    
    void edma_memset(void)
    {    
        CSL_Edma3Handle                 hModule;
        CSL_Edma3HwSetup                hwSetup;
        CSL_Edma3Obj                    edmaObj;
        CSL_Edma3ParamHandle            hParamPing;
        CSL_Edma3ParamHandle            hParamPong;
        CSL_Edma3ParamHandle            hParamBasic;
        CSL_Edma3ChannelObj             chObj;
        CSL_Edma3CmdIntr                regionIntr;
        CSL_Edma3ChannelHandle          hChannel;
        CSL_Edma3ParamSetup             myParamSetup;
        CSL_Edma3Context                context;
        CSL_Edma3ChannelAttr            chAttr;
        CSL_Status                      status;
        CSL_Edma3HwDmaChannelSetup      dmahwSetup;
        Uint8                            srcBuff1[64];
        
    	Uint8 i,*ptr;
    
    
    	memset(srcBuff1,0,64);
    
       /* Module initialization */
        status = CSL_edma3Init(&context);
        if (status != CSL_SOK) {
            printf ("Edma module initialization failed\n");   
            return;
        }
        
        /* Module level open */
        hModule = CSL_edma3Open(&edmaObj,CSL_EDMA3,NULL,&status);
        if ( (hModule == NULL) || (status != CSL_SOK)) {
            printf ("Edma module open failed\n");    
            return;
        }
        
        /* Module setup */
        dmahwSetup.paramNum = 0;
        dmahwSetup.que      = CSL_EDMA3_QUE_0;
        hwSetup.dmaChaSetup = &dmahwSetup;
        hwSetup.qdmaChaSetup = NULL;
        status = CSL_edma3HwSetup(hModule,&hwSetup);	//?????????????
        if (status != CSL_SOK) {
             printf ("Hardware setup failed\n");
             CSL_edma3Close (hModule);
             return;
        } 
               
        /* Channel open */
        chAttr.regionNum = CSL_EDMA3_REGION_GLOBAL;
        chAttr.chaNum = CSL_EDMA3_CHA_DSP_EVT;
        hChannel = CSL_edma3ChannelOpen(&chObj, CSL_EDMA3, &chAttr, &status);
        if ((hChannel == NULL) || (status != CSL_SOK)) {
            printf ("Edma channel open failed\n");    
            return;
        }
        
        /* Change Channel Default queue setup from 0 to 3  */
        status = CSL_edma3HwChannelSetupQue(hChannel,CSL_EDMA3_QUE_3);
        if (status != CSL_SOK) {
            printf ("Edma channel setup que failed\n");    
            return;
        }
    
        /* Obtain a handle to parameter set 0 */
        hParamBasic = CSL_edma3GetParamHandle(hChannel,0,&status);
        if (hParamBasic == NULL) {
            printf ("Edma get param handle for param entry 0 failed\n");    
            return;
        }
        
        /* Setup the parameter entry parameters (Ping buffer) */
        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(64,25600);   // (aCnt,bCnt)    
        myParamSetup.dstAddr = (Uint32)DestAddr;        
        myParamSetup.srcDstBidx = CSL_EDMA3_BIDX_MAKE(0,64); // bIndex   
        myParamSetup.linkBcntrld = CSL_EDMA3_LINKBCNTRLD_MAKE(CSL_EDMA3_LINK_NULL /*0xffff*/,0);//(hParamPong,0);//(link, bCntrl)     
        myParamSetup.srcDstCidx = CSL_EDMA3_CIDX_MAKE(0,1); // cIndex     
        myParamSetup.cCnt = 1;
        status = CSL_edma3ParamSetup(hParamBasic,&myParamSetup);
        if (status != CSL_SOK) {
            printf("Edma parameter entry setup is failed\n");
            return;
        }
        
        /* Interrupt enable (Bits 0-1)  for the global region interrupts */
        regionIntr.region =  CSL_EDMA3_REGION_GLOBAL  ;   
        regionIntr.intr  =   0x3 ;   
        regionIntr.intrh  =  0x0000 ;
        CSL_edma3HwControl(hModule,CSL_EDMA3_CMD_INTR_ENABLE,&regionIntr);
    
        /* Trigger channel */
        CSL_edma3HwChannelControl(hChannel,CSL_EDMA3_CMD_CHANNEL_SET,NULL); 
       /*regionIntr.region =  CSL_EDMA3_REGION_GLOBAL  ;   
        regionIntr.intr  =   0 ;   
        regionIntr.intrh  =  0 ;*/
    
        /* Poll on IPR bit 0 */
        do {
            status=CSL_edma3GetHwStatus(hModule,CSL_EDMA3_QUERY_INTRPEND,&regionIntr);
        } while (!(regionIntr.intr & 0x2));
     
    //================================= Test ====================================== 
    	/*ptr=(Uint8*)DestAddr+100;
    	for(i=0;i<180;i++){
    		if(*(ptr++)!=0)
    			printf("Edma3 Transfer failed %d\n",i);
    	}*/
    //=======================================================================
        /* Close channel */
        status = CSL_edma3ChannelClose(hChannel);
        if (status != CSL_SOK) {
            printf("Edma channel close failed\n");
            return;
        }
        
        /* Close edma module */
        status = CSL_edma3Close(hModule);
        if (status != CSL_SOK) {
            printf("Edma module close failed\n");
            return;
        }
        
        //printf ("=============================================================\n");
        
        return;
    }
    
    

    after I compared memset() with my new EDMA function(edma_memset();), I saw confusing results as below:

    1) I filled DDR2 memory as below:

    2) when I use memset() function, the memory becomes zero, immediately.

    my code:

    Result when running memset():

    3) I repeated the test again by my new EDMA function:

    My code:

    Result when running edma_memset():

    when I used my edma function two confusing problem happened:

    1) The invalid value that shown at above picture.

    2) the memory wasn't zero immediately like memset() function, It became zero after for cycle of running the program.

    What should I do? Please, guide me.

    Thank you so much