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.

DMA example

Other Parts Discussed in Thread: OMAP-L138

Hello,

I am wondering if there are examples on DMA where I can use it in a codec server environment.

I am using OMAP-L138 processor.

I would need to transfer information out of the 8mb cmem to another buffer quickly in the codec stage.

Please help.

Thanks. 

  • Hi John,

    Check out BIOSPSP Software Packages for your device,

    http://software-dl.ti.com/dsps/dsps_public_sw/psp/BIOSPSP/02_10_01/index_FDS.html

    After installing you will find example project configured with DMA mode, you can change it as per your requirement.

    ~\biospsp_03_00_01_00\drivers\examples\evm6748\audio

  • Hi Arvind,

    I tried to implement the example 1 (Async) from this link

    http://processors.wiki.ti.com/index.php/Programming_the_EDMA3_using_the_Low-Level_Driver_%28LLD%29


    I code this in the server as an algorithm where different codecs are able to call.
    I set up the link to the 3 .lib in the link.cmd and is able to compile and test.
    I manage to create the edma3 instance but is not able to open it. Same with my release method, I am able to delete and not able to close it.
    Can you assist to see which part I might be missing out?

    void EDMAConfig(EDMA_Object *EdmaObj)
    { 
    EDMA3_DRV_Result edma3Result = EDMA3_DRV_SOK;
    
    // set global config to defaults in sample Params (located in bios_edma3_drv_sample_C6455_cfg.c)
    EDMA3_DRV_GblConfigParams *globalConfig = &sampleEdma3GblCfgParams; 
    
    // used in DRV_create() function to specify master/slave
    EDMA3_DRV_MiscParam miscParam; 
    
    // used for EDMA3_DRV_open() API and initCfg structure, defined in <edma3_drv.h>
    EDMA3_DRV_InitConfig initCfg;
    
    // located in bios_edma3_drv_sample_C6455_cfg.c
    EDMA3_DRV_InstanceInitConfig *instanceConfig = &sampleInstInitConfig; 
    
    if (EdmaObj->hEdma == NULL)
    {
    // Declare Config structure used to initialize the Driver Instance (needed by DRV_open)
    initCfg.isMaster = TRUE; 
    initCfg.regionId = (EDMA3_RM_RegionId)1u; 
    initCfg.drvSemHandle = NULL; 
    initCfg.drvInstInitConfig = instanceConfig; 
    initCfg.gblerrCb = NULL; 
    initCfg.gblerrData = NULL; 
    miscParam.isSlave = FALSE; 
    
    // EDMA3 Driver Create (called only once for each EDMA3 hardware instance) 
    edma3Result = EDMA3_DRV_create(edma3InstanceId, globalConfig, (void *)&miscParam);
    if (edma3Result != EDMA3_DRV_SOK)
    { 
    // print create failed
    }
    else
    {
    //print success
    
    /* Open the Driver Instance */
    EdmaObj->hEdma = EDMA3_DRV_open (edma3InstanceId, (void *) &initCfg, &edma3Result);
    if(EdmaObj->hEdma == NULL)
    {
    //print open failed
    }
    else
    {
    // print open success
    }
    }
    }
    else
    { 
    // print exists
    }
    }

  • Okay. I figured out that I'm missing an OS Semaphore, so I need to create it and parse in initCfg.drvSemHandle.

    I tried running and it is able to create, open, request channel, enable transfer, free channel and clean up properly.

    The issue comes when I print out the buffer that I am trying to copy. There is no change in terms of the initial and the final buffer.

    Please help.

    #define BUFFSIZE 32
    int16_t SrcBuf[BUFFSIZE]; // Src of transfer int16_t DstBuf[BUFFSIZE]; // Dst of transfer
    
    void init_buffers(void)
    {
    	memset(SrcBuf, 0xAD, sizeof(SrcBuf)); // convenient to init Src to a value
    	memset(DstBuf, 0, sizeof(DstBuf));
    }
    
    void edma_createChan(edma_object_t *EdmaObj, int16_t *Src, int16_t *Dst)
    {
    //.....
    EDMA3_RM_EventQueue eventQ = 0;
    
    EDMA3_RM_TccCallback tccCb = 0;
    
    edma3Result = EDMA3_DRV_requestChannel (EdmaObj->hEdma, &EdmaObj->iChannel, &EdmaObj->iTcc, eventQ, tccCb, NULL);
    
    EDMA3_DRV_setSrcParams (EdmaObj->hEdma, EdmaObj->iChannel, (unsigned int) (Src), EDMA3_DRV_ADDR_MODE_INCR, EDMA3_DRV_W8BIT);
    
    EDMA3_DRV_setDestParams (EdmaObj->hEdma, EdmaObj->iChannel, (unsigned int) (Dst), EDMA3_DRV_ADDR_MODE_INCR, EDMA3_DRV_W8BIT); 
    
    EDMA3_DRV_setSrcIndex(EdmaObj->hEdma, EdmaObj->iChannel, 2, 0); // set SRCBIDX to 2, SRCCIDX to 0 (single AB transfer)
    
    EDMA3_DRV_setDestIndex(EdmaObj->hEdma, EdmaObj->iChannel, 2, 0);// set DSTBIDX to 2, DSTCIDX to 0
    
    EDMA3_DRV_setTransferParams(EdmaObj->hEdma, EdmaObj->iChannel, 2,BUFFSIZE,1,0,EDMA3_DRV_SYNC_AB); //ACNT=2, BCNT=BUFFSIZE, CCNT=1, BCNTRLD=0, SYNC=AB
    
    EDMA3_DRV_setOptField (EdmaObj->hEdma,EdmaObj->iChannel, EDMA3_DRV_OPT_FIELD_TCINTEN, EDMA3_DRV_TCINTEN_EN);
    //....
    }