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.

66AK2G12: Using EDMA in Linux RT

Part Number: 66AK2G12

Hi,

My customer wants to use EDMA in 66AK2G12.

OS used are below:
C66x(DSP): TI RTOS(processor_sdk_rtos_k2g_6_03_00_106)
ARM Cortex A15(CPU): Linux-RT(ti-processor-sdk-linux-rt-k2g-evm-06.03.00.106)

Q1)
In their system, both DSP and ARM use EDMA.
Customer afraid there may be access conflicts between DSP and ARM at EDMA.
If so, are there any guideline or sample codes to avoid conflicts?

Q2)
Customer found below sample code in SDK.
ti-processor-sdk-linux-rt-k2g-evm-06.03.00.106\example-applications\openmpacc-examples-1.5.6.0\edmamgr\edmamgr_main.cpp
It seems EDMA transfer function (EdmaMgr_copy1D1D) is called without calling EDMA initialization function (EdmaMgr_init).
Is this valid? No need to call EdmaMgr_init ?

Thanks and regards,
Koichiro Tashiro

  • Hi,

    In their system, both DSP and ARM use EDMA.
    Customer afraid there may be access conflicts between DSP and ARM at EDMA.
    If so, are there any guideline or sample codes to avoid conflicts?

    Did you mean EDMA resource conflict or memory read/write conflict? If EDMA resource conflict is the concern, then just provide different core id to EdmaMgr_init() function for DSP and ARM. If memory read/write conflict is the concern, then you'll need to make sure your application code on DSP and ARM don't access same memory simultaneously.

    It seems EDMA transfer function (EdmaMgr_copy1D1D) is called without calling EDMA initialization function (EdmaMgr_init).
    Is this valid? No need to call EdmaMgr_init ?

    EdmaMgr_init() is called under the hook by OpenCL monitor during initialization, so those examples do not need to call EdmaMgr_init(). 

    Regards,

    Jianzhong

  • Hi Jianzhong,

    If EDMA resource conflict is the concern, then just provide different core id to EdmaMgr_init() function for DSP and ARM.

    Do you mean both DSP TI RTOS and ARM Linux use the same API (EdmaMgr_Init) ?
    It seems RTOS side does not use EdmaMgr.
    https://software-dl.ti.com/processor-sdk-rtos/esd/docs/latest/rtos/index_device_drv.html#edma3
    Could you clarify this point?
     

    EdmaMgr_init() is called under the hook by OpenCL monitor during initialization


    Customer wants to know exact code where EdmaMgr_Init() is called.
    Could you point me the code location?

    Thanks and regards,
    Koichiro Tashiro

  • Hi Koichiro Tashiro,

    Linux EDMA usage is handled under the DMA Engine framework by Linux kernel. Any kernel driver which requires DMA would call DMA Engine API to allocate/config/start a DMA channel. The kernel device tree shows mcasp0 uses edma0 channel 24 & 25, mcasp1 uses edma1 channel 48 & 49, mcasp2 uses edma1 channel 50 & 51. You can find detailed information in <sdk>/board-support/linux-rt-.../arch/arm/boot/dts/keystone-k2g.dtsi.

    RTOS EDMA usage can be handled either through Framework Component (EDMA manager) or by EDMA LLD. Both have well documented APIs. 

    If EDMA is used by both Linux ARM and RTOS DSP, resource conflict can be avoided as long as ARM and DSP don't use the same EDMA resource (different controllers or different channels). However, there is no example for this use case in Processor-SDK and therefore it hasn't been validated. 

    Regarding the examples in Linux SDK using EDMA manager that you mentioned, those examples are actually offloaded by OpenCL to run on the DSP. EdmaMgr_init() is called by OpenCL monitor on C66x. Before any of those examples is offloaded to DSP, OpenCL monitor will already have called EdmaMgr_init() under the hook:

    Hope this is helpful.

    Regards,

    Jianzhong

  • Hi Jianzhong,

    Thanks for your detailed answer. There are a few additional questions from customer.

    If EDMA is used by both Linux ARM and RTOS DSP, resource conflict can be avoided as long as ARM and DSP don't use the same EDMA resource (different controllers or different channels).

    Q3) For example, MMC/SD is mapped to EDMA_1 controller according to TRM Table 10-8.
    If ARM uses MMC/SD, Linux ARM needs to use EDMA_1 controller, correct?
    In this case, EDMA_0 controller is used by DSP only? Or ARM still can use EDMA_0 controller if channels are different than DSP?
    (ex. EDMA_0 ch0 to 31 are used by DSP. EDMA_0 ch32 to 63 are used by ARM.)


    Linux EDMA usage is handled under the DMA Engine framework by Linux kernel. Any kernel driver which requires DMA would call DMA Engine API to allocate/config/start a DMA channel. The kernel device tree shows mcasp0 uses edma0 channel 24 & 25, mcasp1 uses edma1 channel 48 & 49, mcasp2 uses edma1 channel 50 & 51. You can find detailed information in <sdk>/board-support/linux-rt-.../arch/arm/boot/dts/keystone-k2g.dtsi.

    RTOS EDMA usage can be handled either through Framework Component (EDMA manager) or by EDMA LLD. Both have well documented APIs. 

    Q4) Customer understood;
    - Linux uses EDMA manager only.
    - RTOS can use both EMDA manager and LLD. Which one is recommended, EDMA manger or LLD?

    Q5) When EMDA manger is used, src and dst addresses used by EdmaMgr_copy1D1D or EdmaMgr_copy1D2D are virtual address or physical address?

    Thanks and regards,
    Koichiro Tashiro

  • For example, MMC/SD is mapped to EDMA_1 controller according to TRM Table 10-8.
    If ARM uses MMC/SD, Linux ARM needs to use EDMA_1 controller, correct?

    That is correct.

    In this case, EDMA_0 controller is used by DSP only? Or ARM still can use EDMA_0 controller if channels are different than DSP?
    (ex. EDMA_0 ch0 to 31 are used by DSP. EDMA_0 ch32 to 63 are used by ARM.)

    ARM and DSP can use the same controller but different channels.

    - Linux uses EDMA manager only.
    - RTOS can use both EMDA manager and LLD. Which one is recommended, EDMA manger or LLD?

    Linux uses DMA engine, as documented here: https://www.kernel.org/doc/html/v4.19/driver-api/dmaengine/index.html. The examples using EDMA manager are actually offloaded to DSP, so they are DSP applications.

    EDMA LLD is recommended for RTOS DSP. It provides API to request a specific channel mapped to an EDMA event.

    When EMDA manger is used, src and dst addresses used by EdmaMgr_copy1D1D or EdmaMgr_copy1D2D are virtual address or physical address?

    They are physical addresses. EDMA manager or LLD doesn't do address translation.

    Regards,

    Jianzhong