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.

TDA4VM: c71 udma

Part Number: TDA4VM

Hi team,

Customer uses the following code and wants to move data through the UDMA channel. However, it was found that moving from DDR to L2 was not possible on the C71 platform and the C66 core did not have this issue.

Data can be moved from DDR to L2 memory when channel number is set to 8, that is, to dru channel. The test code is as follows:

void test_udma()
{
    uint8_t data_check = 0;
    uint8_t *src_buf1 = NULL;
    uint32_t data_len = 1024 * 8;
    volatile uint8_t *p_wr = (volatile uint8_t *)(appMemAlloc(APP_MEM_HEAP_DDR, data_len, APP_UDMA_CACHELINE_ALIGNMENT));//(uint8_t *)(0x70020000);//
    volatile uint8_t *p_rd = (volatile uint8_t *)(appMemAlloc(APP_MEM_HEAP_L2, data_len, APP_UDMA_CACHELINE_ALIGNMENT));//(uint8_t *)(0x70022000);//
    unsigned int i = 0;
    int ret_val = 0;
    app_udma_ch_handle_t    udmaChIn;
    app_udma_copy_nd_prms_t prms_nd_in;


    memset(p_rd, 0x0, data_len);
    appLogPrintf("UDMA: p_rd addr is %p\r\n", p_rd);
    for(i = 0; i < data_len; i++)
    {
        p_wr[i] = i % 256;
    }
    appMemCacheWb((void *)p_wr, data_len);
    udmaChIn = appUdmaCopyNDGetHandle(8);
    // src_buf1 = (uint8_t *)(appMemAlloc(APP_UDMA_HEAP_ID, data_len, APP_UDMA_CACHELINE_ALIGNMENT));
    // if(src_buf1 == NULL)
    // {
    //     Platform_Printf("%s, %d\r\n" , __FUNCTION__, __LINE__);
    //     return -1;
    // }
    prms_nd_in.copy_mode    = 2;
    prms_nd_in.src_addr     = appMemGetVirt2PhyBufPtr((uint64_t) (p_wr), APP_UDMA_HEAP_ID);
    prms_nd_in.dest_addr    = appMemGetVirt2PhyBufPtr((uint64_t) (p_rd), APP_MEM_HEAP_L2);
    prms_nd_in.icnt0        = data_len;
    prms_nd_in.icnt1        = 1;
    prms_nd_in.icnt2        = 1;
    prms_nd_in.icnt3        = 1;
    prms_nd_in.dim1         = data_len;
    prms_nd_in.dim2         = 0;
    prms_nd_in.dim3         = 0;

    prms_nd_in.dicnt0       = prms_nd_in.icnt0;
    prms_nd_in.dicnt1       = prms_nd_in.icnt1;
    prms_nd_in.dicnt2       = 1; /* Ping-pong */
    prms_nd_in.dicnt3       = 1;
    prms_nd_in.ddim1        = data_len;
    prms_nd_in.ddim2        = 0;
    prms_nd_in.ddim3        = 0;

   

    // appUdmaCopyNDPrmsPrint(&prms_nd_in, "IN");
    // appUdmaCopyNDPrmsPrint(&prms_nd_out, "OUT");

    udmaChIn = appUdmaCopyNDGetHandle(0);
    ret_val = appUdmaCopyNDInit(udmaChIn, &prms_nd_in);
    if(ret_val != 0){
        appLogPrintf("UDMA: ERROR: appUdmaCopyNDInit %d!!\n", udmaChIn);
        return 7;
    }
    appLogPrintf("UDMA: SUCCESS: appUdmaCopyNDInit %d!!\n", udmaChIn);
    ret_val = appUdmaCopyNDTrigger(udmaChIn);
    if(ret_val != 0){
        appLogPrintf("UDMA: ERROR: appUdmaCopyNDTrigger %d!!\n", ret_val);
    }
    appLogPrintf("UDMA: SUCCESS: appUdmaCopyNDTrigger %d!!\n", ret_val);
    ret_val = appUdmaCopyNDWait(udmaChIn);
    if(ret_val != 0){
        appLogPrintf("UDMA: ERROR: appUdmaCopyNDWait %d!!\n", ret_val);
    }
    appLogPrintf("UDMA: SUCCESS: appUdmaCopyNDWait %d!!\n", ret_val);
    appUdmaCopyNDDeinit(udmaChIn);
    //appMemCacheInv((void *)src_buf1, data_len);
    for(i = 0; i < data_len; i++)
    {
        data_check =  p_rd[i];
        if(data_check != (i % 256))
        {
            appLogPrintf("%s().data is %d error, i is %d\r\n" , __FUNCTION__, data_check, i);
        }
    }  
}

Data shifting can be done when udmaChIn = appUdmaCopyNDgetHandle(8); that is, when configured for DRU channel transfer. The address of the L2 memory is 0x64800000 

The customer would like to know how to move from DDR to L2 memory using the udma channel?

Thanks.

Best Regards,

Cherry