DSP

The difference between DMA、EDMA、QDMA、DATA_XXX

2019-07-13 15:32发布

 EDMA: in C64x DSP is a basically enhanced version of the DMA which was used in the C620x/C670x devices.The EDMA includes several enhancements to the DMA. For more details please refer spru234b.pdf literature. QDMA: is an quick DMA which is local to the CPU. So, QDMA allows direct and quick CPU-initiated DMA submission without having to submit requests to the EDMA channel controller. A QDMA transfer is best suited for applications that require quick data transfers, such as data requests in a tight loop algorithm.
And is used to move data in the background, QDMA or quick DMA stands for CPU triggered transfers, and EDMA stands for event synchronized transfers triggered by hardware events.
DAT module can be used to move data to/from external memory to CPU by DMA/EDMA hardware.
DAT_copy: -API Copies a linear block of data from Src to Dst using DMA or EDMA hardware. (Refer ch.6 in Spru401e.pdf lit)
An example code is given for your clarification. void main(void)
{
    byte *src; // source pointer
    byte *dst; // destination pointer
      int i; // loop counter
    unsigned long id; // transfer id for dma
    // initialise CSL
    CSL_init();
    // configure L2 cache
    CACHE_reset();
    CACHE_setL2Mode(CACHE_64KCACHE);
    CACHE_enableCaching(CACHE_EMIFA_CE00);
    // allocate memory
    if ((src = calloc(256, sizeof(byte))) == NULL)
    {
        printf("Can't allocate src!/n");
        exit(1);
    }
    if ((dst = calloc(256, sizeof(byte))) == NULL)
    {
        printf("Can't allocate dst!/n");
        exit(1);
    }
    // initialise src data
    for (i = 0; i < 256; i++)
    src[i] = i;

    printf("Performing DMA test./n");    // open dma channel
    if (!DAT_open(DAT_CHAANY, DAT_PRI_LOW, 0))
    {
        printf("Can't open DMA channel!/n");
        exit(2);
    }
    // dma src to dst
    id = DAT_copy(src, dst, 256); //linear copy of 256 bytes
    DAT_wait(id);
    // check result
    for (i = 0; i < 256; i++)
    if ((src[i] - dst[i]) != 0)
    printf("src[%d] = %d, dst[%d] = %d/n", i, src[i], i, dst[i]);
    printf("DMA test done./n/n");     free(src);
    free(dst);
    DAT_close(); }