AM64x MCU+ SDK  08.02.00
UDMA

The UDMA driver provides API to program the DMA module of the DMSS subsystem to setup and initiate DMA transfers.

Features Supported

  • Supports both BCDMA and Packet DMA instances
  • Supports all DMA operations from both instances from all the cores in the SOC except M4F core
  • UDMA block copy for memory to memory transfer
  • PDMA module to initiate transfers to/from PDMA peripherals like UART, McASP, McSPI, ADC, MCAN
  • DMA transfer to/from from native PSIL peripherals like CPSW, SA2UL
  • Event and interrupt management like DMA completion, channel chaining, interrupt sharing using Interrupt Aggregator (IA)
  • Resources management across instances and cores for DMA channels, RX flow, Interrupt Aggregator (IA), Interrupt Routers (IR), Global events, Ring Accelerator (RA)
  • Interaction with DMSC RM module via SCICLIENT for all non-RealTime (NRT) configuration

SysConfig Features

Note
It is strongly recommend to use SysConfig where it is available instead of using direct SW API calls. This will help simplify the SW application and also catch common mistakes early in the development cycle.
  • Selection of UDMA instances - BCDMA, PKTDMA
  • Option to skip default global event registration done as part of Udma_init API
  • Option to provide user function for virtual to physical and physical to virtual address translation
  • Ability of add and configure BCDMA block copy channels
    • Ability to enable interrupt mode for the channel
    • Ability to specify the number of ring entries for the channel
    • Based on above parameters, the SysConfig generated code does below as part of Drivers_open and Drivers_close functions
      • Channel open/close - the handle can be retrieved by the application using g<User_Config_Name>BlkCopyChHandle global variable
      • Set default channel configuration
      • Allocates required ring memories and pass them to channel configuration
      • Register user specified callback when interrupt mode is enabled

Features NOT Supported

  • UDMA driver is not supported for M4F core as the DMSS is present only in the main domain

Important Usage Guidelines

  • UDMA driver doesn't manage/allocate the descriptor and RA memory. The caller need to allocate and provide the required memory.
  • UDMA driver doesn't use any global variables. All the required object memory like channel, driver instance, event etc should be allocated by the caller

Additional Documentation

Example Usage

Include the below file to access the APIs

#include <stdio.h>
#include <drivers/udma.h>

Channel Open Example

int32_t retVal;
Udma_ChHandle chHandle = (Udma_ChHandle) &gUdmaChObj;
uint32_t chType;
Udma_ChPrms chPrms;
Udma_ChTxPrms txPrms;
Udma_ChRxPrms rxPrms;
UdmaChPrms_init(&chPrms, chType);
chPrms.fqRingPrms.ringMem = &gTxRingMem[0U];
chPrms.fqRingPrms.elemCnt = 1;
chPrms.fqRingPrms.ringMemSize = chPrms.fqRingPrms.elemCnt * sizeof(uint64_t);
retVal = Udma_chOpen(drvHandle, chHandle, chType, &chPrms);
if(UDMA_SOK != retVal)
{
printf("[Error] UDMA channel open failed!!\r\n");
}
/* Config TX channel */
UdmaChTxPrms_init(&txPrms, chType);
retVal = Udma_chConfigTx(chHandle, &txPrms);
if(UDMA_SOK != retVal)
{
printf("[Error] UDMA TX channel config failed!!\r\n");
}
/* Config RX channel - which is implicitly paired to TX channel in
* block copy mode */
UdmaChRxPrms_init(&rxPrms, chType);
retVal = Udma_chConfigRx(chHandle, &rxPrms);
if(UDMA_SOK != retVal)
{
printf("[Error] UDMA RX channel config failed!!\r\n");
}
/* Channel enable */
retVal = Udma_chEnable(chHandle);
if(UDMA_SOK != retVal)
{
printf("[Error] UDMA channel enable failed!!\r\n");
}

Channel Close Example

int32_t retVal;
Udma_ChHandle chHandle = (Udma_ChHandle) &gUdmaChObj;
if(UDMA_SOK != retVal)
{
printf("[Error] UDMA channel disable failed!!\r\n");
}
retVal = Udma_chClose(chHandle);
if(UDMA_SOK != retVal)
{
printf("[Error] UDMA channel close failed!!\r\n");
}

API

APIs for UDMA

Udma_ChTxPrms
UDMA TX channel parameters.
Definition: udma_ch.h:263
Udma_ChPrms
UDMA channel open parameters.
Definition: udma_ch.h:203
Udma_chOpen
int32_t Udma_chOpen(Udma_DrvHandle drvHandle, Udma_ChHandle chHandle, uint32_t chType, const Udma_ChPrms *chPrms)
UDMA open channel.
Udma_chEnable
int32_t Udma_chEnable(Udma_ChHandle chHandle)
UDMA channel enable API.
Udma_ChHandle
void * Udma_ChHandle
UDMA channel handle.
Definition: udma_types.h:67
Udma_ChRxPrms
UDMA RX channel parameters.
Definition: udma_ch.h:336
Udma_chDisable
int32_t Udma_chDisable(Udma_ChHandle chHandle, uint32_t timeout)
UDMA channel teardown and disable API.
UDMA_DEFAULT_CH_DISABLE_TIMEOUT
#define UDMA_DEFAULT_CH_DISABLE_TIMEOUT
Default UDMA channel disable timeout.
Definition: udma_types.h:82
Udma_ChPrms::fqRingPrms
Udma_RingPrms fqRingPrms
Definition: udma_ch.h:243
Udma_chConfigTx
int32_t Udma_chConfigTx(Udma_ChHandle chHandle, const Udma_ChTxPrms *txPrms)
UDMA configure TX channel.
UdmaChPrms_init
void UdmaChPrms_init(Udma_ChPrms *chPrms, uint32_t chType)
Udma_ChPrms structure init function.
UDMA_CH_TYPE_TR_BLK_COPY
#define UDMA_CH_TYPE_TR_BLK_COPY
TR block copy type - TX/RX pair.
Definition: udma_ch.h:125
Udma_RingPrms::ringMemSize
uint32_t ringMemSize
Definition: udma_ring.h:132
UdmaChTxPrms_init
void UdmaChTxPrms_init(Udma_ChTxPrms *txPrms, uint32_t chType)
Udma_ChTxPrms structure init function.
UdmaChRxPrms_init
void UdmaChRxPrms_init(Udma_ChRxPrms *rxPrms, uint32_t chType)
Udma_ChRxPrms structure init function.
udma.h
UDMA Driver API/interface file.
Udma_chClose
int32_t Udma_chClose(Udma_ChHandle chHandle)
UDMA close channel.
Udma_RingPrms::elemCnt
uint32_t elemCnt
Definition: udma_ring.h:143
Udma_RingPrms::ringMem
void * ringMem
Definition: udma_ring.h:125
UDMA_SOK
#define UDMA_SOK
API call successful.
Definition: udma_types.h:93
Udma_chConfigRx
int32_t Udma_chConfigRx(Udma_ChHandle chHandle, const Udma_ChRxPrms *rxPrms)
UDMA configure RX channel.