3.2.8 Direct Memory Access Controller (DMA)

The Direct Memory Access (DMA) controller is designed to handle high data throughput peripherals on the SFR bus by enabling direct access to data memory to reduce the need for intensive CPU management. The DMA controller is structured with multiple channels, each of which can be connected to a selectable peripheral module. When a peripheral module triggers its interrupt, the corresponding DMA channel responds by accessing the SRAM according to its programming without requiring CPU intervention. This direct access not only frees up the CPU to handle other tasks, but also optimizes overall system efficiency.

Each DMA channel can interrupt the CPU once the DMA session is complete, or if other interrupt conditions are met. This mechanism ensures that the CPU is only engaged when necessary, enhancing system performance and making efficient use of resources. Additionally, this setup helps decrease dynamic power dissipation, especially in applications with lower data throughput demands. By offloading the data transfer tasks from the CPU, the DMA controller significantly contributes to improved system functionality and energy efficiency in a variety of applications.

Using The Library

The DMA Controller has these features:

• Six Independent Channels

• Concurrent Operation with the CPU (No DMA Caused Wait States)

• DMA Bus Arbitration Using Fixed Priority and Round Robin Scheme

• Four Address Modes

• Four Transfer Modes

• 8-Bit, 16-Bit or 32-Bit Word Support for Data Transfer

• 24-Bit Source and Destination Address Register for Each Channel, Dynamically Updated and Independently Reloadable

• 32-Bit Transaction Count Register, Dynamically Updated and Independently Reloadable

• Upper and Lower Address Limit Registers

• Counter Half/Full Level Interrupt

• Software Triggered Transfer

• DMA Request for Each Channel can be Selected From Any Supported Interrupt Source

• Pattern Match

• Bus Read/Write Error Fault Indication

Library Interface

Direct Memory Access Controller peripheral library provides the following interfaces:

Functions

NameDescription
DMA_InitializeInitializes the DMA controller of the device
DMA_DeinitializeDe-initializes the DMA controller control and status registers to it's POR state.
DMA_ChannelCallbackRegisterAllows a DMA PLIB client to set an event handler
DMA_ChannelTransferSchedules a DMA transfer on the specified DMA channel
DMA_ChannelIsBusyReturns the busy status of the channel
DMA_ChannelDisableDisables the specified DMA channel
DMA_ChannelEnableEnables the specified DMA channel
DMA_ChannelGetTransferredCountReturns transfer count of the ongoing DMA transfer
DMA_IsSoftwareRequestPendingStatus of the software request of the DMA channel
DMA_ChannelSoftwareTriggerEnableSets the software trigger of the DMA channel
DMA_ChannelPatternMatchSetupSets up DMA pattern matching
DMA_ChannelPatternMatchEnableEnable DMA channel pattern matching
DMA_ChannelPatternMatchDisableDisable DMA channel pattern matching
DMA_ChannelSettingsGetReturns the current channel settings for the specified DMA Channel
DMA_ChannelSettingsSet

Changes the current transfer settings of the specified DMA channel

Data types and constants

NameTypeDescription
DMA_CHANNELTypedefLists the set of channels available for data transfer using DMA
DMA_CHANNEL_CONFIGTypedefDefines the data type for DMA channel configuration
DMA_TRANSFER_EVENTEnumDefines the data type and macros for DMA_TRANSFER_EVENT
DMA_CHANNEL_CALLBACKTypedefPointer to a DMA Transfer Event handler function
DMA_CHANNEL_OBJECTStructFundamental data object for a DMA channel