All Data Structures Functions Variables Typedefs Enumerations Enumerator Groups Pages
DMA Manager

## Overview

DMA Manager provides a series of functions to manage the DMAMUX channels.

# Function groups

## DMAMGR Initialization and De-initialization

This function group initializes and deinitializes the DMA Manager.

## DMAMGR Operation

This function group requests/releases the DMAMUX channel and configures the channel request source.

# Typical use case

## DMAMGR static channel allocate

DMAMUX_Type *dmamux_base;
uint8_t channel;
/* Initialize DMAMGR */
DMAMGR_Init();
/* Request a DMAMUX channel by static allocate mechanism */
dmamux_base = DMAMUX0;
channel = 0;
DMAMGR_RequestChannel(kDmaRequestMux0AlwaysOn63, &dmamux_base, &channel, kDMAMGR_STATIC_ALLOCATE);

## DMAMGR dynamic channel allocate

DMAMUX_Type *dmamux_base;
uint8_t channel;
/* Initialize DMAMGR */
DMAMGR_Init();
/* Request a DMAMUX channel by static allocate mechanism */
dmamux_base = DMAMUX0;
channel = 0;
DMAMGR_RequestChannel(kDmaRequestMux0AlwaysOn63, &dmamux_base, &channel, kDMAMGR_DYNAMIC_ALLOCATE);

## Macros

#define | DMAMGR_DYNAMIC_ALLOCATE 0xFFU
| Dynamic channel allocate mechanism. More...

## Enumerations

enum | _dma_manager_status { kStatus_DMAMGR_ChannelOccupied = MAKE_STATUS(kStatusGroup_DMAMGR, 0), kStatus_DMAMGR_ChannelNotUsed = MAKE_STATUS(kStatusGroup_DMAMGR, 1), kStatus_DMAMGR_NoFreeChannel = MAKE_STATUS(kStatusGroup_DMAMGR, 2), kStatus_DMAMGR_ChannelNotMatchSource = MAKE_STATUS(kStatusGroup_DMAMGR, 3) }
| DMA manager status. More...

## DMAMGR Initialize and De-initialize

void | DMAMGR_Init (void)
| Initializes the DAM manager. More...
void | DMAMGR_Deinit (void)
| Deinitializes the DMA manager. More...

## DMAMGR Operation

status_t | DMAMGR_RequestChannel (dma_request_source_t requestSource, uint8_t virtualChannel, void *handle)
| Requests a DMA channel. More...
status_t | DMAMGR_ReleaseChannel (void *handle)
| Releases a DMA channel. More...

## Macro Definition Documentation

#define DMAMGR_DYNAMIC_ALLOCATE 0xFFU

## Enumeration Type Documentation

enum _dma_manager_status

Enumerator
kStatus_DMAMGR_ChannelOccupied | Channel has been occupied.
kStatus_DMAMGR_ChannelNotUsed | Channel has not been used.
kStatus_DMAMGR_NoFreeChannel | All channel has been occupied.
kStatus_DMAMGR_ChannelNotMatchSource | Channel do not match the request source.

## Function Documentation

void DMAMGR_Init | ( | void |  | ) |

This function initializes the DMA manager, ungates all DMAMUX clocks, and initializes the eDMA or DMA peripheral.

void DMAMGR_Deinit | ( | void |  | ) |

This function deinitializes the DMA manager, disables all DMAMUX channel, gates all DMAMUX clock, and deinitializes the eDMA or DMA peripheral.

status_t DMAMGR_RequestChannel | ( | dma_request_source_t | requestSource,
|  | uint8_t | virtualChannel,
|  | void * | handle
| ) |  |

This function request a DMA channel which is not occupied. There are two channels to allocate the mechanism dynamic and static. For the dynamic allocation mechanism (virtualChannel = DMAMGR_DYNAMIC_ALLOCATE), DMAMGR allocates a DMA channel according to the given request source and then configure it. For static allocation mechanism, DMAMGR configures the given channel according to the given request source and channel number.

Parameters

  requestSource | DMA channel request source number. See the soc.h.
  virtualChannel | The channel number user wants to occupy. If using the dynamic channel allocate mechanism, set the virtualChannel equal to DMAMGR_DYNAMIC_ALLOCATE.
  handle | DMA or eDMA handle pointer.

Return values

  kStatus_Success | In dynamic/static channel allocate mechanism, allocate DMAMUX channel successfully.
  kStatus_DMAMGR_NoFreeChannel | In dynamic channel allocate mechanism, all DMAMUX channels has been occupied.
  kStatus_DMAMGR_ChannelNotMatchSource | In static channel allocate mechanism, the given channel do not match the given request.
  kStatus_DMAMGR_ChannelOccupied | In static channel allocate mechanism, the given channel has been occupied.

status_t DMAMGR_ReleaseChannel | ( | void * | handle | ) |

This function releases an occupied DMA channel.

Parameters

  handle | DMA or eDMA handle pointer.

Return values

  kStatus_Success | Release the given channel successfully.
  kStatus_DMAMGR_ChannelNotUsed | The given channel which to be released is not been used before.