LDMA
Detailed Description
Linked Direct Memory Access (LDMA) Peripheral API.
LDMA API functions provide full support for the LDMA peripheral.
LDMA supports these DMA transfer types:
- Memory to memory.
- Memory to peripheral.
- Peripheral to memory.
- Peripheral to peripheral.
- Constant value to memory.
LDMA supports linked lists of DMA descriptors allowing:
- Circular and ping-pong buffer transfers.
- Scatter-gather transfers.
- Looped transfers.
LDMA has some advanced features:
- Intra-channel synchronization (SYNC), allowing hardware events to pause and restart a DMA sequence.
- Immediate-write (WRI), allowing DMA to write a constant anywhere in the memory map.
- Complex flow control allowing if-else constructs.
Basic understanding of LDMA controller is assumed. Please refer to the reference manual for further details. The LDMA examples described in the reference manual are particularly helpful in understanding LDMA operations.
In order to use the DMA controller, the initialization function LDMA_Init() must have been executed once (normally during system initialization).
DMA transfers are initiated by a call to LDMA_StartTransfer() , transfer properties are controlled by the contents of LDMA_TransferCfg_t and LDMA_Descriptor_t structure parameters. The LDMA_Descriptor_t structure parameter may be a pointer to an array of descriptors, descriptors in array should be linked together as needed.
Transfer and descriptor initialization macros are provided for the most common transfer types. Due to the flexibility of LDMA peripheral, only a small subset of all possible initializer macros are provided, users should create new ones when needed.
Examples of LDMA usage:
A simple memory to memory transfer:
A linked list of three memory to memory transfers:
DMA from serial port peripheral to memory:
Ping-pong DMA from serial port peripheral to memory:
- Note
- LDMA module does not implement LDMA interrupt handler. A template for an LDMA IRQ handler is included here as an example.
Data Structures |
|
union | LDMA_Descriptor_t |
DMA descriptor.
|
|
struct | LDMA_Init_t |
LDMA initialization configuration structure.
|
|
struct | LDMA_TransferCfg_t |
DMA transfer configuration structure.
|
|
Macros |
|
#define | LDMA_DESCRIPTOR_LINKABS_M2M_BYTE (src, dest, count) |
DMA descriptor initializer for linked memory to memory byte transfer.
|
|
#define | LDMA_DESCRIPTOR_LINKABS_M2M_HALF (src, dest, count) |
DMA descriptor initializer for linked memory to memory half-word transfer.
|
|
#define | LDMA_DESCRIPTOR_LINKABS_M2M_WORD (src, dest, count) |
DMA descriptor initializer for linked memory to memory word transfer.
|
|
#define | LDMA_DESCRIPTOR_LINKABS_SYNC (set, clr, matchValue, matchEnable) |
DMA descriptor initializer for SYNC transfer.
|
|
#define | LDMA_DESCRIPTOR_LINKABS_WRITE (value, address) |
DMA descriptor initializer for Immediate WRITE transfer.
|
|
#define | LDMA_DESCRIPTOR_LINKREL_M2M_BYTE (src, dest, count, linkjmp) |
DMA descriptor initializer for linked memory to memory byte transfer.
|
|
#define | LDMA_DESCRIPTOR_LINKREL_M2M_HALF (src, dest, count, linkjmp) |
DMA descriptor initializer for linked memory to memory half-word transfer.
|
|
#define | LDMA_DESCRIPTOR_LINKREL_M2M_WORD (src, dest, count, linkjmp) |
DMA descriptor initializer for linked memory to memory word transfer.
|
|
#define | LDMA_DESCRIPTOR_LINKREL_M2P_BYTE (src, dest, count, linkjmp) |
DMA descriptor initializer for byte transfers from memory to a peripheral.
|
|
#define | LDMA_DESCRIPTOR_LINKREL_P2M_BYTE (src, dest, count, linkjmp) |
DMA descriptor initializer for byte transfers from a peripheral to memory.
|
|
#define | LDMA_DESCRIPTOR_LINKREL_P2M_WORD (src, dest, count, linkjmp) |
DMA descriptor initializer for word transfers from a peripheral to memory.
|
|
#define | LDMA_DESCRIPTOR_LINKREL_SYNC (set, clr, matchValue, matchEnable, linkjmp) |
DMA descriptor initializer for SYNC transfer.
|
|
#define | LDMA_DESCRIPTOR_LINKREL_WRITE (value, address, linkjmp) |
DMA descriptor initializer for Immediate WRITE transfer.
|
|
#define | LDMA_DESCRIPTOR_SINGLE_M2M_BYTE (src, dest, count) |
DMA descriptor initializer for single memory to memory byte transfer.
|
|
#define | LDMA_DESCRIPTOR_SINGLE_M2M_HALF (src, dest, count) |
DMA descriptor initializer for single memory to memory half-word transfer.
|
|
#define | LDMA_DESCRIPTOR_SINGLE_M2M_WORD (src, dest, count) |
DMA descriptor initializer for single memory to memory word transfer.
|
|
#define | LDMA_DESCRIPTOR_SINGLE_M2P_BYTE (src, dest, count) |
DMA descriptor initializer for byte transfers from memory to a peripheral.
|
|
#define | LDMA_DESCRIPTOR_SINGLE_P2M_BYTE (src, dest, count) |
DMA descriptor initializer for byte transfers from a peripheral to memory.
|
|
#define | LDMA_DESCRIPTOR_SINGLE_P2P_BYTE (src, dest, count) |
DMA descriptor initializer for byte transfers from a peripheral to a peripheral.
|
|
#define | LDMA_DESCRIPTOR_SINGLE_SYNC (set, clr, matchValue, matchEnable) |
DMA descriptor initializer for SYNC transfer.
|
|
#define | LDMA_DESCRIPTOR_SINGLE_WRITE (value, address) |
DMA descriptor initializer for Immediate WRITE transfer.
|
|
#define | LDMA_INIT_DEFAULT |
Default DMA initialization structure.
|
|
#define | LDMA_TRANSFER_CFG_MEMORY () |
Generic DMA transfer configuration for memory to memory transfers.
|
|
#define | LDMA_TRANSFER_CFG_MEMORY_LOOP (loopCnt) |
Generic DMA transfer configuration for looped memory to memory transfers.
|
|
#define | LDMA_TRANSFER_CFG_PERIPHERAL (signal) |
Generic DMA transfer configuration for memory to/from peripheral transfers.
|
|
#define | LDMA_TRANSFER_CFG_PERIPHERAL_LOOP (signal, loopCnt) |
Generic DMA transfer configuration for looped memory to/from peripheral transfers.
|
|
Enumerations |
|
enum |
LDMA_CfgArbSlots_t
{
ldmaCfgArbSlotsAs1 = _LDMA_CH_CFG_ARBSLOTS_ONE, ldmaCfgArbSlotsAs2 = _LDMA_CH_CFG_ARBSLOTS_TWO, ldmaCfgArbSlotsAs4 = _LDMA_CH_CFG_ARBSLOTS_FOUR, ldmaCfgArbSlotsAs8 = _LDMA_CH_CFG_ARBSLOTS_EIGHT } |
enum |
LDMA_CfgDstIncSign_t
{
ldmaCfgDstIncSignPos = _LDMA_CH_CFG_DSTINCSIGN_POSITIVE, ldmaCfgDstIncSignNeg = _LDMA_CH_CFG_DSTINCSIGN_NEGATIVE } |
enum |
LDMA_CfgSrcIncSign_t
{
ldmaCfgSrcIncSignPos = _LDMA_CH_CFG_SRCINCSIGN_POSITIVE, ldmaCfgSrcIncSignNeg = _LDMA_CH_CFG_SRCINCSIGN_NEGATIVE } |
enum |
LDMA_CtrlBlockSize_t
{
ldmaCtrlBlockSizeUnit1 = _LDMA_CH_CTRL_BLOCKSIZE_UNIT1, ldmaCtrlBlockSizeUnit2 = _LDMA_CH_CTRL_BLOCKSIZE_UNIT2, ldmaCtrlBlockSizeUnit3 = _LDMA_CH_CTRL_BLOCKSIZE_UNIT3, ldmaCtrlBlockSizeUnit4 = _LDMA_CH_CTRL_BLOCKSIZE_UNIT4, ldmaCtrlBlockSizeUnit6 = _LDMA_CH_CTRL_BLOCKSIZE_UNIT6, ldmaCtrlBlockSizeUnit8 = _LDMA_CH_CTRL_BLOCKSIZE_UNIT8, ldmaCtrlBlockSizeUnit16 = _LDMA_CH_CTRL_BLOCKSIZE_UNIT16, ldmaCtrlBlockSizeUnit32 = _LDMA_CH_CTRL_BLOCKSIZE_UNIT32, ldmaCtrlBlockSizeUnit64 = _LDMA_CH_CTRL_BLOCKSIZE_UNIT64, ldmaCtrlBlockSizeUnit128 = _LDMA_CH_CTRL_BLOCKSIZE_UNIT128, ldmaCtrlBlockSizeUnit256 = _LDMA_CH_CTRL_BLOCKSIZE_UNIT256, ldmaCtrlBlockSizeUnit512 = _LDMA_CH_CTRL_BLOCKSIZE_UNIT512, ldmaCtrlBlockSizeUnit1024 = _LDMA_CH_CTRL_BLOCKSIZE_UNIT1024, ldmaCtrlBlockSizeAll = _LDMA_CH_CTRL_BLOCKSIZE_ALL } |
enum |
LDMA_CtrlDstAddrMode_t
{
ldmaCtrlDstAddrModeAbs = _LDMA_CH_CTRL_DSTMODE_ABSOLUTE, ldmaCtrlDstAddrModeRel = _LDMA_CH_CTRL_DSTMODE_RELATIVE } |
enum |
LDMA_CtrlDstInc_t
{
ldmaCtrlDstIncOne = _LDMA_CH_CTRL_DSTINC_ONE, ldmaCtrlDstIncTwo = _LDMA_CH_CTRL_DSTINC_TWO, ldmaCtrlDstIncFour = _LDMA_CH_CTRL_DSTINC_FOUR, ldmaCtrlDstIncNone = _LDMA_CH_CTRL_DSTINC_NONE } |
enum |
LDMA_CtrlReqMode_t
{
ldmaCtrlReqModeBlock = _LDMA_CH_CTRL_REQMODE_BLOCK, ldmaCtrlReqModeAll = _LDMA_CH_CTRL_REQMODE_ALL } |
enum |
LDMA_CtrlSize_t
{
ldmaCtrlSizeByte = _LDMA_CH_CTRL_SIZE_BYTE, ldmaCtrlSizeHalf = _LDMA_CH_CTRL_SIZE_HALFWORD, ldmaCtrlSizeWord = _LDMA_CH_CTRL_SIZE_WORD } |
enum |
LDMA_CtrlSrcAddrMode_t
{
ldmaCtrlSrcAddrModeAbs = _LDMA_CH_CTRL_SRCMODE_ABSOLUTE, ldmaCtrlSrcAddrModeRel = _LDMA_CH_CTRL_SRCMODE_RELATIVE } |
enum |
LDMA_CtrlSrcInc_t
{
ldmaCtrlSrcIncOne = _LDMA_CH_CTRL_SRCINC_ONE, ldmaCtrlSrcIncTwo = _LDMA_CH_CTRL_SRCINC_TWO, ldmaCtrlSrcIncFour = _LDMA_CH_CTRL_SRCINC_FOUR, ldmaCtrlSrcIncNone = _LDMA_CH_CTRL_SRCINC_NONE } |
enum |
LDMA_CtrlStructType_t
{
ldmaCtrlStructTypeXfer = _LDMA_CH_CTRL_STRUCTTYPE_TRANSFER, ldmaCtrlStructTypeSync = _LDMA_CH_CTRL_STRUCTTYPE_SYNCHRONIZE, ldmaCtrlStructTypeWrite = _LDMA_CH_CTRL_STRUCTTYPE_WRITE } |
enum |
LDMA_LinkMode_t
{
ldmaLinkModeAbs = _LDMA_CH_LINK_LINKMODE_ABSOLUTE, ldmaLinkModeRel = _LDMA_CH_LINK_LINKMODE_RELATIVE } |
enum |
LDMA_PeripheralSignal_t
{
ldmaPeripheralSignal_NONE = LDMAXBAR_CH_REQSEL_SOURCESEL_NONE, ldmaPeripheralSignal_LDMAXBAR_PRSREQ0 = LDMAXBAR_CH_REQSEL_SIGSEL_LDMAXBARPRSREQ0 | LDMAXBAR_CH_REQSEL_SOURCESEL_LDMAXBAR, ldmaPeripheralSignal_LDMAXBAR_PRSREQ1 = LDMAXBAR_CH_REQSEL_SIGSEL_LDMAXBARPRSREQ1 | LDMAXBAR_CH_REQSEL_SOURCESEL_LDMAXBAR, ldmaPeripheralSignal_TIMER0_CC0 = LDMAXBAR_CH_REQSEL_SIGSEL_TIMER0CC0 | LDMAXBAR_CH_REQSEL_SOURCESEL_TIMER0, ldmaPeripheralSignal_TIMER0_CC1 = LDMAXBAR_CH_REQSEL_SIGSEL_TIMER0CC1 | LDMAXBAR_CH_REQSEL_SOURCESEL_TIMER0, ldmaPeripheralSignal_TIMER0_CC2 = LDMAXBAR_CH_REQSEL_SIGSEL_TIMER0CC2 | LDMAXBAR_CH_REQSEL_SOURCESEL_TIMER0, ldmaPeripheralSignal_TIMER0_UFOF = LDMAXBAR_CH_REQSEL_SIGSEL_TIMER0UFOF | LDMAXBAR_CH_REQSEL_SOURCESEL_TIMER0, ldmaPeripheralSignal_TIMER1_CC0 = LDMAXBAR_CH_REQSEL_SIGSEL_TIMER1CC0 | LDMAXBAR_CH_REQSEL_SOURCESEL_TIMER1, ldmaPeripheralSignal_TIMER1_CC1 = LDMAXBAR_CH_REQSEL_SIGSEL_TIMER1CC1 | LDMAXBAR_CH_REQSEL_SOURCESEL_TIMER1, ldmaPeripheralSignal_TIMER1_CC2 = LDMAXBAR_CH_REQSEL_SIGSEL_TIMER1CC2 | LDMAXBAR_CH_REQSEL_SOURCESEL_TIMER1, ldmaPeripheralSignal_TIMER1_UFOF = LDMAXBAR_CH_REQSEL_SIGSEL_TIMER1UFOF | LDMAXBAR_CH_REQSEL_SOURCESEL_TIMER1, ldmaPeripheralSignal_USART0_RXDATAV = LDMAXBAR_CH_REQSEL_SIGSEL_USART0RXDATAV | LDMAXBAR_CH_REQSEL_SOURCESEL_USART0, ldmaPeripheralSignal_USART0_RXDATAVRIGHT = LDMAXBAR_CH_REQSEL_SIGSEL_USART0RXDATAVRIGHT | LDMAXBAR_CH_REQSEL_SOURCESEL_USART0, ldmaPeripheralSignal_USART0_TXBL = LDMAXBAR_CH_REQSEL_SIGSEL_USART0TXBL | LDMAXBAR_CH_REQSEL_SOURCESEL_USART0, ldmaPeripheralSignal_USART0_TXBLRIGHT = LDMAXBAR_CH_REQSEL_SIGSEL_USART0TXBLRIGHT | LDMAXBAR_CH_REQSEL_SOURCESEL_USART0, ldmaPeripheralSignal_USART0_TXEMPTY = LDMAXBAR_CH_REQSEL_SIGSEL_USART0TXEMPTY | LDMAXBAR_CH_REQSEL_SOURCESEL_USART0, ldmaPeripheralSignal_USART1_RXDATAV = LDMAXBAR_CH_REQSEL_SIGSEL_USART1RXDATAV | LDMAXBAR_CH_REQSEL_SOURCESEL_USART1, ldmaPeripheralSignal_USART1_RXDATAVRIGHT = LDMAXBAR_CH_REQSEL_SIGSEL_USART1RXDATAVRIGHT | LDMAXBAR_CH_REQSEL_SOURCESEL_USART1, ldmaPeripheralSignal_USART1_TXBL = LDMAXBAR_CH_REQSEL_SIGSEL_USART1TXBL | LDMAXBAR_CH_REQSEL_SOURCESEL_USART1, ldmaPeripheralSignal_USART1_TXBLRIGHT = LDMAXBAR_CH_REQSEL_SIGSEL_USART1TXBLRIGHT | LDMAXBAR_CH_REQSEL_SOURCESEL_USART1, ldmaPeripheralSignal_USART1_TXEMPTY = LDMAXBAR_CH_REQSEL_SIGSEL_USART1TXEMPTY | LDMAXBAR_CH_REQSEL_SOURCESEL_USART1, ldmaPeripheralSignal_USART2_RXDATAV = LDMAXBAR_CH_REQSEL_SIGSEL_USART2RXDATAV | LDMAXBAR_CH_REQSEL_SOURCESEL_USART2, ldmaPeripheralSignal_USART2_RXDATAVRIGHT = LDMAXBAR_CH_REQSEL_SIGSEL_USART2RXDATAVRIGHT | LDMAXBAR_CH_REQSEL_SOURCESEL_USART2, ldmaPeripheralSignal_USART2_TXBL = LDMAXBAR_CH_REQSEL_SIGSEL_USART2TXBL | LDMAXBAR_CH_REQSEL_SOURCESEL_USART2, ldmaPeripheralSignal_USART2_TXBLRIGHT = LDMAXBAR_CH_REQSEL_SIGSEL_USART2TXBLRIGHT | LDMAXBAR_CH_REQSEL_SOURCESEL_USART2, ldmaPeripheralSignal_USART2_TXEMPTY = LDMAXBAR_CH_REQSEL_SIGSEL_USART2TXEMPTY | LDMAXBAR_CH_REQSEL_SOURCESEL_USART2, ldmaPeripheralSignal_I2C0_RXDATAV = LDMAXBAR_CH_REQSEL_SIGSEL_I2C0RXDATAV | LDMAXBAR_CH_REQSEL_SOURCESEL_I2C0, ldmaPeripheralSignal_I2C0_TXBL = LDMAXBAR_CH_REQSEL_SIGSEL_I2C0TXBL | LDMAXBAR_CH_REQSEL_SOURCESEL_I2C0, ldmaPeripheralSignal_I2C1_RXDATAV = LDMAXBAR_CH_REQSEL_SIGSEL_I2C1RXDATAV | LDMAXBAR_CH_REQSEL_SOURCESEL_I2C1, ldmaPeripheralSignal_I2C1_TXBL = LDMAXBAR_CH_REQSEL_SIGSEL_I2C1TXBL | LDMAXBAR_CH_REQSEL_SOURCESEL_I2C1, ldmaPeripheralSignal_AGC_RSSI = LDMAXBAR_CH_REQSEL_SIGSEL_AGCRSSI | LDMAXBAR_CH_REQSEL_SOURCESEL_AGC, ldmaPeripheralSignal_PROTIMER_BOF = LDMAXBAR_CH_REQSEL_SIGSEL_PROTIMERBOF | LDMAXBAR_CH_REQSEL_SOURCESEL_PROTIMER, ldmaPeripheralSignal_PROTIMER_CC0 = LDMAXBAR_CH_REQSEL_SIGSEL_PROTIMERCC0 | LDMAXBAR_CH_REQSEL_SOURCESEL_PROTIMER, ldmaPeripheralSignal_PROTIMER_CC1 = LDMAXBAR_CH_REQSEL_SIGSEL_PROTIMERCC1 | LDMAXBAR_CH_REQSEL_SOURCESEL_PROTIMER, ldmaPeripheralSignal_PROTIMER_CC2 = LDMAXBAR_CH_REQSEL_SIGSEL_PROTIMERCC2 | LDMAXBAR_CH_REQSEL_SOURCESEL_PROTIMER, ldmaPeripheralSignal_PROTIMER_CC3 = LDMAXBAR_CH_REQSEL_SIGSEL_PROTIMERCC3 | LDMAXBAR_CH_REQSEL_SOURCESEL_PROTIMER, ldmaPeripheralSignal_PROTIMER_CC4 = LDMAXBAR_CH_REQSEL_SIGSEL_PROTIMERCC4 | LDMAXBAR_CH_REQSEL_SOURCESEL_PROTIMER, ldmaPeripheralSignal_PROTIMER_POF = LDMAXBAR_CH_REQSEL_SIGSEL_PROTIMERPOF | LDMAXBAR_CH_REQSEL_SOURCESEL_PROTIMER, ldmaPeripheralSignal_PROTIMER_WOF = LDMAXBAR_CH_REQSEL_SIGSEL_PROTIMERWOF | LDMAXBAR_CH_REQSEL_SOURCESEL_PROTIMER, ldmaPeripheralSignal_MODEM_DEBUG = LDMAXBAR_CH_REQSEL_SIGSEL_MODEMDEBUG | LDMAXBAR_CH_REQSEL_SOURCESEL_MODEM, ldmaPeripheralSignal_IADC0_IADC_SCAN = LDMAXBAR_CH_REQSEL_SIGSEL_IADC0IADC_SCAN | LDMAXBAR_CH_REQSEL_SOURCESEL_IADC0, ldmaPeripheralSignal_IADC0_IADC_SINGLE = LDMAXBAR_CH_REQSEL_SIGSEL_IADC0IADC_SINGLE | LDMAXBAR_CH_REQSEL_SOURCESEL_IADC0, ldmaPeripheralSignal_MSC_WDATA = LDMAXBAR_CH_REQSEL_SIGSEL_MSCWDATA | LDMAXBAR_CH_REQSEL_SOURCESEL_MSC, ldmaPeripheralSignal_TIMER2_CC0 = LDMAXBAR_CH_REQSEL_SIGSEL_TIMER2CC0 | LDMAXBAR_CH_REQSEL_SOURCESEL_TIMER2, ldmaPeripheralSignal_TIMER2_CC1 = LDMAXBAR_CH_REQSEL_SIGSEL_TIMER2CC1 | LDMAXBAR_CH_REQSEL_SOURCESEL_TIMER2, ldmaPeripheralSignal_TIMER2_CC2 = LDMAXBAR_CH_REQSEL_SIGSEL_TIMER2CC2 | LDMAXBAR_CH_REQSEL_SOURCESEL_TIMER2, ldmaPeripheralSignal_TIMER2_UFOF = LDMAXBAR_CH_REQSEL_SIGSEL_TIMER2UFOF | LDMAXBAR_CH_REQSEL_SOURCESEL_TIMER2, ldmaPeripheralSignal_TIMER3_CC0 = LDMAXBAR_CH_REQSEL_SIGSEL_TIMER3CC0 | LDMAXBAR_CH_REQSEL_SOURCESEL_TIMER3, ldmaPeripheralSignal_TIMER3_CC1 = LDMAXBAR_CH_REQSEL_SIGSEL_TIMER3CC1 | LDMAXBAR_CH_REQSEL_SOURCESEL_TIMER3, ldmaPeripheralSignal_TIMER3_CC2 = LDMAXBAR_CH_REQSEL_SIGSEL_TIMER3CC2 | LDMAXBAR_CH_REQSEL_SOURCESEL_TIMER3, ldmaPeripheralSignal_TIMER3_UFOF = LDMAXBAR_CH_REQSEL_SIGSEL_TIMER3UFOF | LDMAXBAR_CH_REQSEL_SOURCESEL_TIMER3 } |
Functions |
|
__STATIC_INLINE bool | LDMA_ChannelEnabled (int ch) |
Check if a certain channel is enabled.
|
|
void | LDMA_DeInit (void) |
De-initialize the LDMA controller.
|
|
void | LDMA_EnableChannelRequest (int ch, bool enable) |
Enable or disable an LDMA channel request.
|
|
void | LDMA_Init (const LDMA_Init_t *init) |
Initialize the LDMA controller.
|
|
__STATIC_INLINE void | LDMA_IntClear (uint32_t flags) |
Clear one or more pending LDMA interrupts.
|
|
__STATIC_INLINE void | LDMA_IntDisable (uint32_t flags) |
Disable one or more LDMA interrupts.
|
|
__STATIC_INLINE void | LDMA_IntEnable (uint32_t flags) |
Enable one or more LDMA interrupts.
|
|
__STATIC_INLINE uint32_t | LDMA_IntGet (void) |
Get pending LDMA interrupt flags.
|
|
__STATIC_INLINE uint32_t | LDMA_IntGetEnabled (void) |
Get enabled and pending LDMA interrupt flags. Useful for handling more interrupt sources in the same interrupt handler.
|
|
__STATIC_INLINE void | LDMA_IntSet (uint32_t flags) |
Set one or more pending LDMA interrupts.
|
|
void | LDMA_StartTransfer (int ch, const LDMA_TransferCfg_t *transfer, const LDMA_Descriptor_t *descriptor) |
Start a DMA transfer.
|
|
void | LDMA_StopTransfer (int ch) |
Stop a DMA transfer.
|
|
bool | LDMA_TransferDone (int ch) |
Check if a DMA transfer has completed.
|
|
uint32_t | LDMA_TransferRemainingCount (int ch) |
Get the number of items remaining in a transfer.
|
|
Macro Definition Documentation
#define LDMA_DESCRIPTOR_LINKABS_M2M_BYTE | ( |
src,
|
|
dest,
|
|||
count
|
|||
) |
em_ldma.h:199
em_ldma.h:133
em_ldma.h:172
em_ldma.h:187
em_ldma.h:193
em_ldma.h:151
em_ldma.h:164
em_ldma.h:159
em_ldma.h:179
DMA descriptor initializer for linked memory to memory byte transfer.
Link address must be an absolute address.
- Note
- The linkAddr member of the transfer descriptor is not initialized.
- Parameters
-
[in] src
Source data address. [in] dest
Destination data address. [in] count
Number of bytes to transfer.
Definition at line
1149
of file
em_ldma.h
.
#define LDMA_DESCRIPTOR_LINKABS_M2M_HALF | ( |
src,
|
|
dest,
|
|||
count
|
|||
) |
em_ldma.h:199
em_ldma.h:133
em_ldma.h:187
em_ldma.h:193
em_ldma.h:151
em_ldma.h:173
em_ldma.h:164
em_ldma.h:159
em_ldma.h:179
DMA descriptor initializer for linked memory to memory half-word transfer.
Link address must be an absolute address.
- Note
- The linkAddr member of the transfer descriptor is not initialized.
- Parameters
-
[in] src
Source data address. [in] dest
Destination data address. [in] count
Number of half-words to transfer.
Definition at line
1111
of file
em_ldma.h
.
#define LDMA_DESCRIPTOR_LINKABS_M2M_WORD | ( |
src,
|
|
dest,
|
|||
count
|
|||
) |
em_ldma.h:199
em_ldma.h:133
em_ldma.h:187
em_ldma.h:193
em_ldma.h:151
em_ldma.h:174
em_ldma.h:164
em_ldma.h:159
em_ldma.h:179
DMA descriptor initializer for linked memory to memory word transfer.
Link address must be an absolute address.
- Note
- The linkAddr member of the transfer descriptor is not initialized.
- Parameters
-
[in] src
Source data address. [in] dest
Destination data address. [in] count
Number of words to transfer.
Definition at line
1073
of file
em_ldma.h
.
#define LDMA_DESCRIPTOR_LINKABS_SYNC | ( |
set,
|
|
clr,
|
|||
matchValue,
|
|||
matchEnable
|
|||
) |
em_ldma.h:199
em_ldma.h:152
DMA descriptor initializer for SYNC transfer.
Link address must be an absolute address.
- Note
- The linkAddr member of the transfer descriptor is not initialized.
- Parameters
-
[in] set
Sync pattern bits to set. [in] clr
Sync pattern bits to clear. [in] matchValue
Sync pattern to match. [in] matchEnable
Sync pattern bits to enable for match.
Definition at line
1675
of file
em_ldma.h
.
#define LDMA_DESCRIPTOR_LINKABS_WRITE | ( |
value,
|
|
address
|
|||
) |
em_ldma.h:199
em_ldma.h:153
DMA descriptor initializer for Immediate WRITE transfer.
Link address must be an absolute address.
- Note
- The linkAddr member of the transfer descriptor is not initialized.
- Parameters
-
[in] value
Immediate value to write. [in] address
Write address.
Definition at line
1563
of file
em_ldma.h
.
#define LDMA_DESCRIPTOR_LINKREL_M2M_BYTE | ( |
src,
|
|
dest,
|
|||
count,
|
|||
linkjmp
|
|||
) |
em_ldma.h:133
em_ldma.h:172
em_ldma.h:187
em_ldma.h:193
em_ldma.h:151
em_ldma.h:164
em_ldma.h:159
em_ldma.h:200
em_ldma.h:179
DMA descriptor initializer for linked memory to memory byte transfer.
Link address is a relative address.
- Note
- The linkAddr member of transfer descriptor is initialized to 4, assuming that the next descriptor immediately follows this descriptor (in memory).
- Parameters
-
[in] src
Source data address. [in] dest
Destination data address. [in] count
Number of bytes to transfer. [in] linkjmp
Address of descriptor to link to, expressed as a signed number of descriptors from "here". 1=one descriptor forward in memory, 0=this descriptor, -1=one descriptor back in memory.
Definition at line
1281
of file
em_ldma.h
.
#define LDMA_DESCRIPTOR_LINKREL_M2M_HALF | ( |
src,
|
|
dest,
|
|||
count,
|
|||
linkjmp
|
|||
) |
em_ldma.h:133
em_ldma.h:187
em_ldma.h:193
em_ldma.h:151
em_ldma.h:173
em_ldma.h:164
em_ldma.h:159
em_ldma.h:200
em_ldma.h:179
DMA descriptor initializer for linked memory to memory half-word transfer.
Link address is a relative address.
- Note
- The linkAddr member of transfer descriptor is initialized to 4, assuming that the next descriptor immediately follows this descriptor (in memory).
- Parameters
-
[in] src
Source data address. [in] dest
Destination data address. [in] count
Number of half-words to transfer. [in] linkjmp
Address of descriptor to link to, expressed as a signed number of descriptors from "here". 1=one descriptor forward in memory, 0=this descriptor, -1=one descriptor back in memory.
Definition at line
1237
of file
em_ldma.h
.
#define LDMA_DESCRIPTOR_LINKREL_M2M_WORD | ( |
src,
|
|
dest,
|
|||
count,
|
|||
linkjmp
|
|||
) |
em_ldma.h:133
em_ldma.h:187
em_ldma.h:193
em_ldma.h:151
em_ldma.h:174
em_ldma.h:164
em_ldma.h:159
em_ldma.h:200
em_ldma.h:179
DMA descriptor initializer for linked memory to memory word transfer.
Link address is a relative address.
- Note
- The linkAddr member of the transfer descriptor is initialized to 4, assuming that the next descriptor immediately follows this descriptor (in memory).
- Parameters
-
[in] src
Source data address. [in] dest
Destination data address. [in] count
Number of words to transfer. [in] linkjmp
Address of descriptor to link to, expressed as a signed number of descriptors from "here". 1=one descriptor forward in memory, 0=this descriptor, -1=one descriptor back in memory.
Definition at line
1193
of file
em_ldma.h
.
#define LDMA_DESCRIPTOR_LINKREL_M2P_BYTE | ( |
src,
|
|
dest,
|
|||
count,
|
|||
linkjmp
|
|||
) |
em_ldma.h:133
em_ldma.h:172
em_ldma.h:187
em_ldma.h:193
em_ldma.h:158
em_ldma.h:151
em_ldma.h:164
em_ldma.h:182
em_ldma.h:200
DMA descriptor initializer for byte transfers from memory to a peripheral.
- Parameters
-
[in] src
Source data address. [in] dest
Peripheral data register destination address. [in] count
Number of bytes to transfer. [in] linkjmp
Address of descriptor to link to, expressed as a signed number of descriptors from "here". 1=one descriptor forward in memory, 0=this descriptor, -1=one descriptor back in memory.
Definition at line
1494
of file
em_ldma.h
.
#define LDMA_DESCRIPTOR_LINKREL_P2M_BYTE | ( |
src,
|
|
dest,
|
|||
count,
|
|||
linkjmp
|
|||
) |
em_ldma.h:133
em_ldma.h:172
em_ldma.h:187
em_ldma.h:193
em_ldma.h:158
em_ldma.h:151
em_ldma.h:167
em_ldma.h:200
em_ldma.h:179
DMA descriptor initializer for byte transfers from a peripheral to memory.
- Parameters
-
[in] src
Peripheral data source register address. [in] dest
Destination data address. [in] count
Number of bytes to transfer. [in] linkjmp
Address of descriptor to link to, expressed as a signed number of descriptors from "here". 1=one descriptor forward in memory, 0=this descriptor, -1=one descriptor back in memory.
Definition at line
1418
of file
em_ldma.h
.
#define LDMA_DESCRIPTOR_LINKREL_P2M_WORD | ( |
src,
|
|
dest,
|
|||
count,
|
|||
linkjmp
|
|||
) |
em_ldma.h:133
em_ldma.h:187
em_ldma.h:193
em_ldma.h:158
em_ldma.h:151
em_ldma.h:174
em_ldma.h:167
em_ldma.h:200
em_ldma.h:179
DMA descriptor initializer for word transfers from a peripheral to memory.
- Parameters
-
[in] src
Peripheral data source register address. [in] dest
Destination data address. [in] count
Number of words to transfer. [in] linkjmp
Address of descriptor to link to, expressed as a signed number of descriptors from "here". 1=one descriptor forward in memory, 0=this descriptor, -1=one descriptor back in memory.
Definition at line
1456
of file
em_ldma.h
.
#define LDMA_DESCRIPTOR_LINKREL_SYNC | ( |
set,
|
|
clr,
|
|||
matchValue,
|
|||
matchEnable,
|
|||
linkjmp
|
|||
) |
em_ldma.h:152
em_ldma.h:200
DMA descriptor initializer for SYNC transfer.
- Parameters
-
[in] set
Sync pattern bits to set. [in] clr
Sync pattern bits to clear. [in] matchValue
Sync pattern to match. [in] matchEnable
Sync pattern bits to enable for match. [in] linkjmp
Address of descriptor to link to, expressed as a signed number of descriptors from "here". 1=one descriptor forward in memory, 0=this descriptor, -1=one descriptor back in memory.
Definition at line
1716
of file
em_ldma.h
.
#define LDMA_DESCRIPTOR_LINKREL_WRITE | ( |
value,
|
|
address,
|
|||
linkjmp
|
|||
) |
em_ldma.h:153
em_ldma.h:200
DMA descriptor initializer for Immediate WRITE transfer.
- Parameters
-
[in] value
Immediate value to write. [in] address
Write address. [in] linkjmp
Address of descriptor to link to, expressed as a signed number of descriptors from "here". 1=one descriptor forward in memory, 0=this descriptor, -1=one descriptor back in memory.
Definition at line
1600
of file
em_ldma.h
.
#define LDMA_DESCRIPTOR_SINGLE_M2M_BYTE | ( |
src,
|
|
dest,
|
|||
count
|
|||
) |
em_ldma.h:133
em_ldma.h:172
em_ldma.h:187
em_ldma.h:193
em_ldma.h:151
em_ldma.h:164
em_ldma.h:159
em_ldma.h:179
DMA descriptor initializer for single memory to memory byte transfer.
- Parameters
-
[in] src
Source data address. [in] dest
Destination data address. [in] count
Number of bytes to transfer.
Definition at line
1035
of file
em_ldma.h
.
#define LDMA_DESCRIPTOR_SINGLE_M2M_HALF | ( |
src,
|
|
dest,
|
|||
count
|
|||
) |
em_ldma.h:133
em_ldma.h:187
em_ldma.h:193
em_ldma.h:151
em_ldma.h:173
em_ldma.h:164
em_ldma.h:159
em_ldma.h:179
DMA descriptor initializer for single memory to memory half-word transfer.
- Parameters
-
[in] src
Source data address. [in] dest
Destination data address. [in] count
Number of half-words to transfer.
Definition at line
1002
of file
em_ldma.h
.
#define LDMA_DESCRIPTOR_SINGLE_M2M_WORD | ( |
src,
|
|
dest,
|
|||
count
|
|||
) |
em_ldma.h:133
em_ldma.h:187
em_ldma.h:193
em_ldma.h:151
em_ldma.h:174
em_ldma.h:164
em_ldma.h:159
em_ldma.h:179
DMA descriptor initializer for single memory to memory word transfer.
- Parameters
-
[in] src
Source data address. [in] dest
Destination data address. [in] count
Number of words to transfer.
Definition at line
969
of file
em_ldma.h
.
#define LDMA_DESCRIPTOR_SINGLE_M2P_BYTE | ( |
src,
|
|
dest,
|
|||
count
|
|||
) |
em_ldma.h:133
em_ldma.h:172
em_ldma.h:187
em_ldma.h:193
em_ldma.h:158
em_ldma.h:151
em_ldma.h:164
em_ldma.h:182
DMA descriptor initializer for byte transfers from memory to a peripheral.
- Parameters
-
[in] src
Source data address. [in] dest
Peripheral data register destination address. [in] count
Number of bytes to transfer.
Definition at line
1380
of file
em_ldma.h
.
#define LDMA_DESCRIPTOR_SINGLE_P2M_BYTE | ( |
src,
|
|
dest,
|
|||
count
|
|||
) |
em_ldma.h:133
em_ldma.h:172
em_ldma.h:187
em_ldma.h:193
em_ldma.h:158
em_ldma.h:151
em_ldma.h:167
em_ldma.h:179
DMA descriptor initializer for byte transfers from a peripheral to memory.
- Parameters
-
[in] src
Peripheral data source register address. [in] dest
Destination data address. [in] count
Number of bytes to transfer.
Definition at line
1314
of file
em_ldma.h
.
#define LDMA_DESCRIPTOR_SINGLE_P2P_BYTE | ( |
src,
|
|
dest,
|
|||
count
|
|||
) |
em_ldma.h:133
em_ldma.h:172
em_ldma.h:187
em_ldma.h:193
em_ldma.h:158
em_ldma.h:151
em_ldma.h:167
em_ldma.h:182
DMA descriptor initializer for byte transfers from a peripheral to a peripheral.
- Parameters
-
[in] src
Peripheral data source register address. [in] dest
Peripheral data destination register address. [in] count
Number of bytes to transfer.
Definition at line
1347
of file
em_ldma.h
.
#define LDMA_DESCRIPTOR_SINGLE_SYNC | ( |
set,
|
|
clr,
|
|||
matchValue,
|
|||
matchEnable
|
|||
) |
em_ldma.h:152
DMA descriptor initializer for SYNC transfer.
- Parameters
-
[in] set
Sync pattern bits to set. [in] clr
Sync pattern bits to clear. [in] matchValue
Sync pattern to match. [in] matchEnable
Sync pattern bits to enable for match.
Definition at line
1634
of file
em_ldma.h
.
#define LDMA_DESCRIPTOR_SINGLE_WRITE | ( |
value,
|
|
address
|
|||
) |
em_ldma.h:153
DMA descriptor initializer for Immediate WRITE transfer.
- Parameters
-
[in] value
Immediate value to write. [in] address
Write address.
Definition at line
1526
of file
em_ldma.h
.
#define LDMA_INIT_DEFAULT |
Default DMA initialization structure.
Definition at line
909
of file
em_ldma.h
.
Referenced by DMADRV_Init() .
#define LDMA_TRANSFER_CFG_MEMORY | ( |
|
) |
em_ldma.h:205
em_ldma.h:219
Generic DMA transfer configuration for memory to memory transfers.
Definition at line
921
of file
em_ldma.h
.
#define LDMA_TRANSFER_CFG_MEMORY_LOOP | ( |
loopCnt
|
) |
em_ldma.h:205
em_ldma.h:219
Generic DMA transfer configuration for looped memory to memory transfers.
Definition at line
932
of file
em_ldma.h
.
#define LDMA_TRANSFER_CFG_PERIPHERAL | ( |
signal
|
) |
em_ldma.h:205
em_ldma.h:219
Generic DMA transfer configuration for memory to/from peripheral transfers.
Definition at line
944
of file
em_ldma.h
.
#define LDMA_TRANSFER_CFG_PERIPHERAL_LOOP | ( |
signal,
|
|
loopCnt
|
|||
) |
em_ldma.h:205
em_ldma.h:219
Generic DMA transfer configuration for looped memory to/from peripheral transfers.
Definition at line
955
of file
em_ldma.h
.
Enumeration Type Documentation
enum LDMA_CfgArbSlots_t |
Insert extra arbitration slots to increase channel arbitration priority.
Definition at line
204
of file
em_ldma.h
.
enum LDMA_CfgDstIncSign_t |
enum LDMA_CfgSrcIncSign_t |
enum LDMA_CtrlBlockSize_t |
Controls the number of unit data transfers per arbitration cycle, providing a means to balance DMA channels' load on the controller.
Definition at line
132
of file
em_ldma.h
.
enum LDMA_CtrlDstInc_t |
Destination address increment unit size.
Definition at line
178
of file
em_ldma.h
.
enum LDMA_CtrlReqMode_t |
enum LDMA_CtrlSize_t |
enum LDMA_CtrlSrcInc_t |
Source address increment unit size.
Definition at line
163
of file
em_ldma.h
.
enum LDMA_LinkMode_t |
Function Documentation
__STATIC_INLINE bool LDMA_ChannelEnabled | ( | int |
ch
|
) |
Check if a certain channel is enabled.
- Parameters
-
[in] ch
LDMA channel to check.
- Returns
- return true if the LDMA channel is enabled and false if the channel is not enabled.
Definition at line
1769
of file
em_ldma.h
.
Referenced by DMADRV_TransferActive() .
void LDMA_DeInit | ( | void |
|
) |
De-initialize the LDMA controller.
LDMA interrupts are disabled and the LDMA clock is stopped.
Definition at line
85
of file
em_ldma.c
.
References CMU_ClockEnable() , and cmuClock_LDMA .
Referenced by DMADRV_DeInit() .
void LDMA_EnableChannelRequest | ( | int |
ch,
|
bool |
enable
|
||
) |
Enable or disable an LDMA channel request.
Use this function to enable or disable an LDMA channel request. This will prevent the LDMA from proceeding after its current transaction if disabled.
- Parameters
-
[in] channel
LDMA channel to enable or disable requests. [in] enable
If 'true', the request will be enabled. If 'false', the request will be disabled.
Definition at line
121
of file
em_ldma.c
.
References BUS_RegBitWrite() .
Referenced by DMADRV_PauseTransfer() , and DMADRV_ResumeTransfer() .
void LDMA_Init | ( | const LDMA_Init_t * |
init
|
) |
Initialize the LDMA controller.
This function will disable all the LDMA channels and enable the LDMA bus clock in the CMU. This function will also enable the LDMA IRQ in the NVIC and set the LDMA IRQ priority to a user-configurable priority. The LDMA interrupt priority is configured using the LDMA_Init_t structure.
- Note
- Since this function enables the LDMA IRQ, always add a custom LDMA_IRQHandler to the application to handle any interrupts from LDMA.
- Parameters
-
[in] init
A pointer to the initialization structure used to configure the LDMA.
Definition at line
146
of file
em_ldma.c
.
References CMU_ClockEnable() , cmuClock_LDMA , LDMA_Init_t::ldmaInitCtrlNumFixed , LDMA_Init_t::ldmaInitCtrlSyncPrsClrEn , LDMA_Init_t::ldmaInitCtrlSyncPrsSetEn , and LDMA_Init_t::ldmaInitIrqPriority .
Referenced by DMADRV_Init() .
__STATIC_INLINE void LDMA_IntClear | ( | uint32_t |
flags
|
) |
Clear one or more pending LDMA interrupts.
- Parameters
-
[in] flags
Pending LDMA interrupt sources to clear. Use one or more valid interrupt flags for the LDMA module. The flags are LDMA_IFC_ERROR and one done flag for each channel.
Definition at line
1792
of file
em_ldma.h
.
__STATIC_INLINE void LDMA_IntDisable | ( | uint32_t |
flags
|
) |
Disable one or more LDMA interrupts.
- Parameters
-
[in] flags
LDMA interrupt sources to disable. Use one or more valid interrupt flags for LDMA module. The flags are LDMA_IEN_ERROR and one done flag for each channel.
Definition at line
1810
of file
em_ldma.h
.
__STATIC_INLINE void LDMA_IntEnable | ( | uint32_t |
flags
|
) |
Enable one or more LDMA interrupts.
- Note
- Depending on the use, a pending interrupt may already be set prior to enabling the interrupt. To ignore a pending interrupt, consider using LDMA_IntClear() prior to enabling the interrupt.
- Parameters
-
[in] flags
LDMA interrupt sources to enable. Use one or more valid interrupt flags for LDMA module. The flags are LDMA_IEN_ERROR and one done flag for each channel.
Definition at line
1829
of file
em_ldma.h
.
__STATIC_INLINE uint32_t LDMA_IntGet | ( | void |
|
) |
Get pending LDMA interrupt flags.
- Note
- Event bits are not cleared by the use of this function.
- Returns
- LDMA interrupt sources pending. Returns one or more valid interrupt flags for LDMA module. The flags are LDMA_IF_ERROR and one flag for each LDMA channel.
Definition at line
1846
of file
em_ldma.h
.
__STATIC_INLINE uint32_t LDMA_IntGetEnabled | ( | void |
|
) |
Get enabled and pending LDMA interrupt flags. Useful for handling more interrupt sources in the same interrupt handler.
- Note
- Interrupt flags are not cleared by the use of this function.
- Returns
-
Pending and enabled LDMA interrupt sources Return value is the bitwise AND of
- the enabled interrupt sources in LDMA_IEN and
- the pending interrupt flags LDMA_IF
Definition at line
1865
of file
em_ldma.h
.
__STATIC_INLINE void LDMA_IntSet | ( | uint32_t |
flags
|
) |
Set one or more pending LDMA interrupts.
- Parameters
-
[in] flags
LDMA interrupt sources to set to pending. Use one or more valid interrupt flags for LDMA module. The flags are LDMA_IFS_ERROR and one done flag for each LDMA channel.
Definition at line
1882
of file
em_ldma.h
.
void LDMA_StartTransfer | ( | int |
ch,
|
const LDMA_TransferCfg_t * |
transfer,
|
||
const LDMA_Descriptor_t * |
descriptor
|
||
) |
Start a DMA transfer.
- Parameters
-
[in] ch
A DMA channel. [in] transfer
The initialization structure used to configure the transfer. [in] descriptor
The transfer descriptor, which can be an array of descriptors linked together.
Definition at line
238
of file
em_ldma.c
.
References BUS_RegMaskedClear() , CORE_DECLARE_IRQ_STATE , CORE_ENTER_ATOMIC , CORE_EXIT_ATOMIC , LDMA_TransferCfg_t::ldmaCfgArbSlots , LDMA_TransferCfg_t::ldmaCfgDstIncSign , LDMA_TransferCfg_t::ldmaCfgSrcIncSign , LDMA_TransferCfg_t::ldmaCtrlSyncPrsClrOff , LDMA_TransferCfg_t::ldmaCtrlSyncPrsClrOn , LDMA_TransferCfg_t::ldmaCtrlSyncPrsSetOff , LDMA_TransferCfg_t::ldmaCtrlSyncPrsSetOn , LDMA_TransferCfg_t::ldmaDbgHalt , LDMA_TransferCfg_t::ldmaLoopCnt , LDMA_TransferCfg_t::ldmaReqDis , and LDMA_TransferCfg_t::ldmaReqSel .
Referenced by DMADRV_LdmaStartTransfer() .
void LDMA_StopTransfer | ( | int |
ch
|
) |
Stop a DMA transfer.
- Note
- The DMA will complete the current AHB burst transfer before stopping.
- Parameters
-
[in] ch
A DMA channel to stop.
Definition at line
379
of file
em_ldma.c
.
References BUS_RegMaskedClear() , and CORE_ATOMIC_SECTION .
Referenced by DMADRV_StopTransfer() .
bool LDMA_TransferDone | ( | int |
ch
|
) |
Check if a DMA transfer has completed.
- Parameters
-
[in] ch
A DMA channel to check.
- Returns
- True if transfer has completed, false if not.
Definition at line
405
of file
em_ldma.c
.
References CORE_ATOMIC_SECTION .
Referenced by DMADRV_TransferDone() .
uint32_t LDMA_TransferRemainingCount | ( | int |
ch
|
) |
Get the number of items remaining in a transfer.
- Note
- This function does not take into account that a DMA transfer with a chain of linked transfers might be ongoing. It will only check the count for the current transfer.
- Parameters
-
[in] ch
The channel number of the transfer to check.
- Returns
- A number of items remaining in the transfer.
Definition at line
442
of file
em_ldma.c
.
References CORE_ATOMIC_SECTION .
Referenced by DMADRV_TransferRemainingCount() .