AM261x MCU+ SDK: EDMA

| AM261x MCU+ SDK 26.00.00 |

EDMA

EDMA driver provides API to perform DMA tranfers.

# Features Supported

- DMA, QDMA channels
- Interrupt and Polled mode of operations
- PaRAM Linking
- Channel Chaining
- Manual and Event triggered transfers
- Error Handling

# 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.

- EDMA instances selection
- Region Id selection
- Interrupt mode selection
- DMA Channel management
- QDMA Channel management
- TCC management
- PaRAM management

# Features NOT Supported

- None

# Usage Overview

## API Sequence

To transfer the data using edma, application calls following APIs

- EDMA_init(): Initialize the EDMA driver.
- EDMA_open(): Open an instance of the EDMA driver
- EDMA_getBaseAddr(): Get the edma base address corresponding to the driver handle. This is used in further APIs for initiating the transfers.
- EDMA_configureChannelRegion(): Configure the DMA channel used for transfer
- EDMA_setPaRAM(): Configure the PaRAM corresponding to the transfer
- EDMA_enableTransferRegion(): Enable the data transfer
- EDMA_close(): Closes the EDMA instance.
- EDMA_deinit(): De-Initialize the EDMA driver.

# Important Usage Guidelines

- None

# Example Usage

Include the below file to access the APIs

#include <drivers/edma.h>

Instance Open Example

EDMA_Params params;
params.intrEnable = TRUE;
gEdmaHandle = EDMA_open(CONFIG_EDMA0, &params);
DebugP_assert(gEdmaHandle != NULL);

Instance Close Example

EDMA_close(gEdmaHandle);

Instance transfer Example

uint32_t baseAddr, regionId;
uint8_t *srcBuffPtr, *dstBuffPtr;
int32_t testStatus = SystemP_SUCCESS;
EDMACCPaRAMEntry edmaParam;
uint32_t dmaCh, tcc, param;
baseAddr = EDMA_getBaseAddr(gEdmaHandle);
DebugP_assert(baseAddr != 0);
regionId = EDMA_getRegionId(gEdmaHandle);
DebugP_assert(regionId < SOC_EDMA_NUM_REGIONS);
/* Allocate the resources dma channel, tcc and param */
dmaCh = EDMA_RESOURCE_ALLOC_ANY;
testStatus = EDMA_allocDmaChannel(gEdmaHandle, &dmaCh);
DebugP_assert(testStatus == SystemP_SUCCESS);
tcc = EDMA_RESOURCE_ALLOC_ANY;
testStatus = EDMA_allocTcc(gEdmaHandle, &tcc);
DebugP_assert(testStatus == SystemP_SUCCESS);
param = EDMA_RESOURCE_ALLOC_ANY;
testStatus = EDMA_allocParam(gEdmaHandle, &param);
DebugP_assert(testStatus == SystemP_SUCCESS);
srcBuffPtr = (uint8_t *) gEdmaTestSrcBuff;
dstBuffPtr = (uint8_t *) gEdmaTestDstBuff;
/* Request channel */
EDMA_configureChannelRegion(baseAddr, regionId, EDMA_CHANNEL_TYPE_DMA,
dmaCh, tcc, param, EDMA_TEST_EVT_QUEUE_NO);
/* Program Param Set */
EDMA_ccPaRAMEntry_init(&edmaParam);
edmaParam.srcAddr = (uint32_t) (srcBuffPtr);
edmaParam.destAddr = (uint32_t) (dstBuffPtr);
edmaParam.aCnt = (uint16_t) EDMA_TEST_A_COUNT;
edmaParam.bCnt = (uint16_t) EDMA_TEST_B_COUNT;
edmaParam.cCnt = (uint16_t) EDMA_TEST_C_COUNT;
edmaParam.bCntReload = (uint16_t) EDMA_TEST_B_COUNT;
edmaParam.srcBIdx = (int16_t) EDMA_PARAM_BIDX(EDMA_TEST_A_COUNT);
edmaParam.destBIdx = (int16_t) EDMA_PARAM_BIDX(EDMA_TEST_A_COUNT);
edmaParam.srcCIdx = (int16_t) EDMA_TEST_A_COUNT;
edmaParam.destCIdx = (int16_t) EDMA_TEST_A_COUNT;
edmaParam.linkAddr = 0xFFFFU;
edmaParam.srcBIdxExt = (int8_t) EDMA_PARAM_BIDX_EXT(EDMA_TEST_A_COUNT);
edmaParam.destBIdxExt = (int8_t) EDMA_PARAM_BIDX_EXT(EDMA_TEST_A_COUNT);
edmaParam.opt |=
(EDMA_OPT_TCINTEN_MASK | EDMA_OPT_ITCINTEN_MASK |
((((uint32_t)tcc) << EDMA_OPT_TCC_SHIFT) & EDMA_OPT_TCC_MASK));
EDMA_setPaRAM(baseAddr, param, &edmaParam);
EDMA_enableTransferRegion(
baseAddr, regionId, dmaCh, EDMA_TRIG_MODE_MANUAL);
/* Free channel */
EDMA_freeChannelRegion(baseAddr, regionId, EDMA_CHANNEL_TYPE_DMA,
dmaCh, EDMA_TRIG_MODE_MANUAL, tcc, EDMA_TEST_EVT_QUEUE_NO);
/* Free the EDMA resources managed by driver. */
testStatus = EDMA_freeDmaChannel(gEdmaHandle, &dmaCh);
DebugP_assert(testStatus == SystemP_SUCCESS);
testStatus = EDMA_freeTcc(gEdmaHandle, &tcc);
DebugP_assert(testStatus == SystemP_SUCCESS);
testStatus = EDMA_freeParam(gEdmaHandle, &param);
DebugP_assert(testStatus == SystemP_SUCCESS);

# API

APIs for EDMA

SOC_EDMA_NUM_REGIONS
#define SOC_EDMA_NUM_REGIONS
Number of EDMA Regions.
Definition: cslr_soc_defines.h:97
EDMA_freeTcc
int32_t EDMA_freeTcc(EDMA_Handle handle, uint32_t *tcc)
Function to free the tcc Channel.
EDMA_enableTransferRegion
uint32_t EDMA_enableTransferRegion(uint32_t baseAddr, uint32_t regionId, uint32_t chNum, uint32_t trigMode)
Start EDMA transfer on the specified channel.
EDMA_getRegionId
uint32_t EDMA_getRegionId(EDMA_Handle handle)
Function to get the edma region.
EDMA_PARAM_BIDX_EXT
#define EDMA_PARAM_BIDX_EXT(val)
Definition: edma/v0/edma.h:138
EDMA_CHANNEL_TYPE_DMA
#define EDMA_CHANNEL_TYPE_DMA
Values that can be used for parameter chType in API's.
Definition: edma/v0/edma.h:161
EDMA_freeDmaChannel
int32_t EDMA_freeDmaChannel(EDMA_Handle handle, uint32_t *dmaCh)
Function to free the Dma Channel.
EDMA_getBaseAddr
uint32_t EDMA_getBaseAddr(EDMA_Handle handle)
Function to get the edma base address.
edma.h
EDMA_OPT_TCC_MASK
#define EDMA_OPT_TCC_MASK
Definition: edma/v0/edma.h:294
EDMA_allocDmaChannel
int32_t EDMA_allocDmaChannel(EDMA_Handle handle, uint32_t *dmaCh)
Function to allocate the Dma Channel.
EDMA_close
void EDMA_close(EDMA_Handle handle)
Function to close a EDMA peripheral specified by the EDMA handle.
EDMA_OPT_ITCINTEN_MASK
#define EDMA_OPT_ITCINTEN_MASK
Definition: edma/v0/edma.h:292
EDMA_OPT_TCINTEN_MASK
#define EDMA_OPT_TCINTEN_MASK
Definition: edma/v0/edma.h:290
SystemP_SUCCESS
#define SystemP_SUCCESS
Return status when the API execution was successful.
Definition: SystemP.h:56
EDMA_freeChannelRegion
uint32_t EDMA_freeChannelRegion(uint32_t baseAddr, uint32_t regionId, uint32_t chType, uint32_t chNum, uint32_t trigMode, uint32_t tccNum, uint32_t evtQNum)
Free the specified channel (DMA/QDMA/Link) and its associated resources (PaRAM Set,...
EDMA_PARAM_BIDX
#define EDMA_PARAM_BIDX(val)
Definition: edma/v0/edma.h:135
EDMA_OPT_TCC_SHIFT
#define EDMA_OPT_TCC_SHIFT
Definition: edma/v0/edma.h:296
EDMA_TRIG_MODE_MANUAL
#define EDMA_TRIG_MODE_MANUAL
Definition: edma/v0/edma.h:147
EDMA_freeParam
int32_t EDMA_freeParam(EDMA_Handle handle, uint32_t *param)
Function to free the Param.
EDMA_open
EDMA_Handle EDMA_open(uint32_t index, const EDMA_Params *prms)
This function opens a given EDMA instance.
EDMA_configureChannelRegion
uint32_t EDMA_configureChannelRegion(uint32_t baseAddr, uint32_t regionId, uint32_t chType, uint32_t chNum, uint32_t tccNum, uint32_t paramId, uint32_t evtQNum)
Request a DMA/QDMA/Link channel.
EDMA_allocParam
int32_t EDMA_allocParam(EDMA_Handle handle, uint32_t *param)
Function to allocate Param Set.
TRUE
#define TRUE
Definition: os_defs.h:29
EDMA_setPaRAM
void EDMA_setPaRAM(uint32_t baseAddr, uint32_t paRAMId, const EDMACCPaRAMEntry *newPaRAM)
Copy the user specified PaRAM Set onto the PaRAM Set associated with the logical channel (DMA/Link).
EDMA_Params
EDMA open parameters passed to EDMA_open() function.
Definition: edma/v0/edma.h:544
DebugP_assert
#define DebugP_assert(expression)
Function to call for assert check.
Definition: DebugP.h:187
EDMA_RESOURCE_ALLOC_ANY
#define EDMA_RESOURCE_ALLOC_ANY
Definition: edma/v0/edma.h:371
EDMA_ccPaRAMEntry_init
void EDMA_ccPaRAMEntry_init(EDMACCPaRAMEntry *paramEntry)
Clear a PaRAM Set .
EDMA_Params::intrEnable
uint32_t intrEnable
Definition: edma/v0/edma.h:545
EDMA_allocTcc
int32_t EDMA_allocTcc(EDMA_Handle handle, uint32_t *tcc)
Function to allocate Tcc.