AM64x MCU+ SDK  08.03.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

DMSS Overview

The primary goal of the Data Movement Subsystem (DMSS) is to ensure that data can be efficiently transferred from a producer to a consumer so that the real time requirements of the system can be met. The Data Movement architecture aims to facilitate Direct Memory Access (DMA) and to provide a consistent Application Programming Interface (API) to the host software. Data movement tasks are commonly offloaded from the host processor to peripheral hardware to increase system performance. Significant performance gains may result from careful design of the interface between the host software and the underlying acceleration hardware. In networking applications packet transmission and reception are critical tasks. In general purpose compute, ping pong buffer pre-fetch and store are critical tasks as are general misaligned block copy operations.

The block diagram provides a high level picture of not only the 2 different interconnect fabrics but also some key standard data movement components that have been defined and placed in the various parts of the low cost compliant SoC. Packet DMA (PKTDMA) and Block Copy DMA (BCDMA) which are the two instances of the DMSS specification serving different use cases.

DMSS Block Diagram

Packet DMA (PKTDMA)

The PKTDMA is intended to perform similar functions as the packet oriented DMA. The PKTDMA module supports the transmission and reception of various packet types. The PKTDMA is architected to facilitate the segmentation and reassembly of DMA data structure compliant packets to/from smaller data blocks that are natively compatible with the specific requirements of each connected peripheral. Multiple TX and RX channels are provided within the DMA which allow multiple segmentation or reassembly operations to be ongoing. The DMA controller maintains state information for each of the channels which allows packet segmentation and reassembly operations to be time division multiplexed between channels in order to share the underlying DMA hardware. An internal DMA scheduler is used to control the ordering and rate at which this multiplexing occurs for Transmit operations. The ordering and rate of Receive operations is indirectly controlled by the order in which blocks are pushed into the DMA on the RX PSI-L interface.

Packet DMA Block Diagram

Block Copy DMA (BCDMA)

The Block Copy DMA is intended to perform similar functions as the EDMA or the UDMA-P/UTC. The BCDMA module moves data from a memory mapped source address set to a corresponding memory mapped address set. The BCDMA maintains state information for each of the channels which allows data copy operations to be time division multiplexed between channels in order to share the underlying DMA hardware. An internal DMA scheduler is used to control the ordering and rate at which this multiplexing occurs.

Block Copy DMA Block Diagram

DMSS Transfer Overciew

Below section describes the high level flow of the driver for the data transfer

Transfer Request (TR) Record

Transfer configuration is specified in the TR record. Size of TR is variable from 16 bytes to 64 bytes. Specified via TR Type in FLAGS field

TR record fields

Below table summarizes different TR types and the transfer type for which they are used

TR Type Descriptrion
Type 0 1D (word0-3)
Type 1 2D (word0-4)
Type 2 3D (word0-6)
Type 3 4D (word0-8)
Type 5 Cache warm (word0-15) (MSMC DRU ONLY)
Type 8 4D Block Copy (word0-15)
Type 9 4D Block Copy with reformatting (word0-15) (MSMC DRU ONLY)
Type 10 2D Block Copy (word0-15)
Type 11 2D Block Copy with reformatting (word0-15) (MSMC DRU ONLY)
Type 15 4D Block Copy with reformatting and indirection (word0-15) (MSMC DRU ONLY)

UDMA Setup/Flow

Below diagram shows the high level flow for the transfer requests from application and driver

UDMA setup TRPD flow

Below diagram shows the UDMA transfer API flow

UDMA API flow

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.