Data Structures | Macros | Typedefs
DMA

Configures and controls MSP432's DMA controller which is built around ARM's uDMA controller. More...

Data Structures

struct  _DMA_ControlTable
 

Macros

#define DMA_TaskStructEntry(transferCount,itemSize,srcIncrement,srcAddr,dstIncrement,dstAddr,arbSize,mode)
 

Typedefs

typedef struct _DMA_ControlTable DMA_ControlTable
 

Detailed Description

Configures and controls MSP432's DMA controller which is built around ARM's uDMA controller.


Module Operation


The Micro Direct Memory Access (DMA) API provides functions to configure the MSP432 uDMA controller. The DMA controller is designed to work with the ARM Cortex-M processor and provides an efficient and low-overhead means of transferring blocks of data in the system.

The DMA controller has the following features:

The uDMA controller supports several different transfer modes, allowing for complex transfer schemes. The following transfer modes are provided:

Detailed explanation of the various transfer modes is beyond the scope of this document. Please refer to the device data sheet for more information on the operation of the uDMA controller.


Programming Example


The DriverLib package contains a variety of different code examples that demonstrate the usage of the DMA module. These code examples are accessible under the examples/ folder of the MSPWare release as well as through TI Resource Explorer if using Code Composer Studio. These code examples provide a comprehensive list of use cases as well as practical applications involving each module.

Below is a very brief example of how to configure the DMA controller to transfer from a data array (data_array) to the EUSCI I2C module to be sent over the I2C line. This is useful in the sense that the EUSCI module does not constantly have to wake up the CPU in order to load the next byte into the buffer.

/* Configuring DMA module */
MAP_DMA_setControlBase(controlTable);
/* Assigning Channel 2 to EUSCIB1TX0, and Channel 5 to EUSCIB2RX0 and
* enabling channels 2 and 5*/
/* Disabling channel attributes */
/* Setting Control Indexes */
UDMA_MODE_BASIC, data_array,
(void*) MAP_I2C_getTransmitBufferAddressForDMA(EUSCI_B1_MODULE), 1024);
(void*)MAP_I2C_getReceiveBufferAddressForDMA(EUSCI_B2_MODULE), recBuffer,
1024);
/* Assigning/Enabling Interrupts */
/* Now that the DMA is primed and setup, enabling the channels. The EUSCI
* hardware should take over and transfer/receive all bytes */
/* Sending the start condition */
MAP_I2C_masterSendStart(EUSCI_B1_MODULE);
while(!MAP_I2C_masterIsStartSent(EUSCI_B1_MODULE));

Macro Definition Documentation

#define DMA_TaskStructEntry (   transferCount,
  itemSize,
  srcIncrement,
  srcAddr,
  dstIncrement,
  dstAddr,
  arbSize,
  mode 
)
Value:
{ \
(((srcIncrement) == UDMA_SRC_INC_NONE) ? (void *)(srcAddr) : \
((void *)(&((uint8_t *)(srcAddr))[((transferCount) << \
((srcIncrement) >> 26)) - 1]))), \
(((dstIncrement) == UDMA_DST_INC_NONE) ? (void *)(dstAddr) : \
((void *)(&((uint8_t *)(dstAddr))[((transferCount) << \
((dstIncrement) >> 30)) - 1]))), \
(srcIncrement) | (dstIncrement) | (itemSize) | (arbSize) | \
(((transferCount) - 1) << 4) | \
((((mode) == UDMA_MODE_MEM_SCATTER_GATHER) || \
(mode) | UDMA_MODE_ALT_SELECT : (mode)), 0 \
}
#define UDMA_MODE_MEM_SCATTER_GATHER
Definition: dma.h:175
#define UDMA_SRC_INC_NONE
Definition: dma.h:193
#define UDMA_MODE_ALT_SELECT
Definition: dma.h:179
#define UDMA_MODE_PER_SCATTER_GATHER
Definition: dma.h:177
#define UDMA_DST_INC_NONE
Definition: dma.h:189

A helper macro for building scatter-gather task table entries.

This macro is intended to be used to help populate a table of DMA tasks for a scatter-gather transfer. This macro will calculate the values for the fields of a task structure entry based on the input parameters.

There are specific requirements for the values of each parameter. No checking is done so it is up to the caller to ensure that correct values are used for the parameters.

The transferCount parameter is the number of items that will be transferred by this task. It must be in the range 1-1024.

The itemSize parameter is the bit size of the transfer data. It must be one of UDMA_SIZE_8, UDMA_SIZE_16, or UDMA_SIZE_32.

The srcIncrement parameter is the increment size for the source data. It must be one of UDMA_SRC_INC_8, UDMA_SRC_INC_16, UDMA_SRC_INC_32, or UDMA_SRC_INC_NONE.

The srcAddr parameter is a void pointer to the beginning of the source data.

The dstIncrement parameter is the increment size for the destination data. It must be one of UDMA_DST_INC_8, UDMA_DST_INC_16, UDMA_DST_INC_32, or UDMA_DST_INC_NONE.

The dstAddr parameter is a void pointer to the beginning of the location where the data will be transferred.

The arbSize parameter is the arbitration size for the transfer, and must be one of UDMA_ARB_1, UDMA_ARB_2, UDMA_ARB_4, and so on up to UDMA_ARB_1024. This is used to select the arbitration size in powers of 2, from 1 to 1024.

The mode parameter is the mode to use for this transfer task. It must be one of UDMA_MODE_BASIC, UDMA_MODE_AUTO, UDMA_MODE_MEM_SCATTER_GATHER, or UDMA_MODE_PER_SCATTER_GATHER. Note that normally all tasks will be one of the scatter-gather modes while the last task is a task list will be AUTO or BASIC.

This macro is intended to be used to initialize individual entries of a structure of DMA_ControlTable type, like this:

DMA_ControlTable MyTaskList[] =
{
UDMA_SRC_INC_8, MySourceBuf,
UDMA_DST_INC_8, MyDestBuf,
DMA_TaskStructEntry(Task2Count, ... ),
}
Parameters
transferCountis the count of items to transfer for this task.
itemSizeis the bit size of the items to transfer for this task.
srcIncrementis the bit size increment for source data.
srcAddris the starting address of the data to transfer.
dstIncrementis the bit size increment for destination data.
dstAddris the starting address of the destination data.
arbSizeis the arbitration size to use for the transfer task.
modeis the transfer mode for this task.
Returns
Nothing; this is not a function.

Typedef Documentation


Copyright 2014, Texas Instruments Incorporated