MCUXpresso SDK API Reference Manual  Rev 2.16.000
NXP Semiconductors
 All Data Structures Functions Variables Typedefs Enumerations Enumerator Groups Pages
DMA Peripheral and Driver Overview

Content including 1) peripheral features, work logic and work method; 2) driver design logic and use method; 3) typical use case. More...

Peripheral features

The DMA controller module enables fast transfers of data, providing an efficient way to move blocks of data with minimal processor interaction.

How this peripheral works

As soon as a channel has been initialized, it may be started by setting DCRn[START] or a properly-selected peripheral DMA request, depending on the status of DCRn[ERQ]. Each channel can be programmed to select one peripheral request from a set of 16 possible request inputs. The DMA controller supports dual-address transfers using its bus master connection to the system bus. The DMA channels support transfers up to 32 data bits in size and have the same memory map addressibility as the processor. Any operation involving a DMA channel follows the same three steps:

  1. Channel initialization The transfer control descriptor, contained in the channel registers, is loaded with address pointers, a byte-transfer count, and control information using accesses from the slave peripheral bus.
  2. Data transfer The DMA accepts requests for data transfers. Upon receipt of a request, it provides address and bus control for the transfers via its master connection to the system bus and temporary storage for the read data. The channel performs one or more source read and destination write data transfers.
  3. Channel termination Occurs after the operation is finished successfully or due to an error. The channel indicates the operation status in the channel's DSR, described in the definitions of the DMA Status Registers (DSRn) and Byte Count Registers (BCRn).

How this driver is designed to make this peripheral works

The DMA peripheral is powerful with complex transfer features supported. To satisfy different user getting different demands for the feature sets/optimization level/flexibility/abstraction level, 2 parallel layers are provided in this driver (DO NOT MIX THE USAGE OF THESE 2 LAYERS!!!):

Below introduce the detail data structure/API for the two layers.

How to use this driver

Functional Layer

Transactional Layer

Typical Use Cases

  1. single transfer (using dma transactional layer)
    * DMA_Init(DEMO_DMA_BASEADDR, &dmaConfig);
    * DMA_TransferChannelCreateHandle(DEMO_DMA_BASEADDR, &g_DMA_Handle, DEMO_DMA_CHANNEL_0, DMA_Callback, NULL);
    * DMA_GetChannelDefaultTransferConfig(&transferConfig, g_u32SrcAddr, g_u32DestAddr,
    * sizeof(g_u32SrcAddr[0]) * BUFF_LENGTH, kDMA_ChannelTransferWidth8Bits,
    * DMA_TransferChannelSubmit(&g_DMA_Handle, &transferConfig);
    * DMA_TransferChannelStart(&g_DMA_Handle, false);
    *
  2. Memory to peripheral (using kDmaCH0_IIC0_ipd_Req as peripheral)
    * DMA_Init(DEMO_DMA_BASEADDR, &dmaConfig);
    * DMA_SetChannelPeripheralRequest(DEMO_DMA_BASEADDR, DEMO_DMA_CHANNEL_0, kDmaCH0_IIC0_ipd_Req);
    * DMA_TransferChannelCreateHandle(DEMO_DMA_BASEADDR, &g_DMA_Handle, DEMO_DMA_CHANNEL_0, DMA_Callback, NULL);
    * DMA_GetChannelDefaultTransferConfig(&transferConfig, g_u32SrcAddr, g_u32DestAddr,
    * sizeof(g_u32SrcAddr[0]) * BUFF_LENGTH, kDMA_ChannelTransferWidth8Bits,
    * DMA_TransferChannelSubmit(&g_DMA_Handle, &transferConfig);
    * DMA_TransferChannelStart(&g_DMA_Handle, true);
    *