1 /***************************************************************************//**
\r
3 * @brief Direct memory access (LDMA) API
\r
5 *******************************************************************************
\r
7 * <b>(C) Copyright 2015 Silicon Labs, http://www.silabs.com</b>
\r
8 *******************************************************************************
\r
10 * Permission is granted to anyone to use this software for any purpose,
\r
11 * including commercial applications, and to alter it and redistribute it
\r
12 * freely, subject to the following restrictions:
\r
14 * 1. The origin of this software must not be misrepresented; you must not
\r
15 * claim that you wrote the original software.@n
\r
16 * 2. Altered source versions must be plainly marked as such, and must not be
\r
17 * misrepresented as being the original software.@n
\r
18 * 3. This notice may not be removed or altered from any source distribution.
\r
20 * DISCLAIMER OF WARRANTY/LIMITATION OF REMEDIES: Silicon Labs has no
\r
21 * obligation to support this Software. Silicon Labs is providing the
\r
22 * Software "AS IS", with no express or implied warranties of any kind,
\r
23 * including, but not limited to, any implied warranties of merchantability
\r
24 * or fitness for any particular purpose or warranties against infringement
\r
25 * of any proprietary rights of a third party.
\r
27 * Silicon Labs will not be liable for any consequential, incidental, or
\r
28 * special damages, or any other relief, or for any claim by any third party,
\r
29 * arising from your use of this Software.
\r
31 ******************************************************************************/
\r
33 #ifndef __SILICON_LABS_EM_LDMA_H__
\r
34 #define __SILICON_LABS_EM_LDMA_H__
\r
36 #include "em_device.h"
\r
38 #if defined( LDMA_PRESENT ) && ( LDMA_COUNT == 1 )
\r
40 #include <stdbool.h>
\r
47 /***************************************************************************//**
\r
48 * @addtogroup EM_Library
\r
50 ******************************************************************************/
\r
52 /***************************************************************************//**
\r
55 ******************************************************************************/
\r
57 /*******************************************************************************
\r
58 ******************************** ENUMS ************************************
\r
59 ******************************************************************************/
\r
62 * This value controls the number of unit data transfers per arbitration
\r
63 * cycle, providing a means to balance DMA channels' load on the controller.
\r
67 ldmaCtrlBlockSizeUnit1 = _LDMA_CH_CTRL_BLOCKSIZE_UNIT1, /**< One transfer per arbitration. */
\r
68 ldmaCtrlBlockSizeUnit2 = _LDMA_CH_CTRL_BLOCKSIZE_UNIT2, /**< Two transfers per arbitration. */
\r
69 ldmaCtrlBlockSizeUnit3 = _LDMA_CH_CTRL_BLOCKSIZE_UNIT3, /**< Three transfers per arbitration. */
\r
70 ldmaCtrlBlockSizeUnit4 = _LDMA_CH_CTRL_BLOCKSIZE_UNIT4, /**< Four transfers per arbitration. */
\r
71 ldmaCtrlBlockSizeUnit6 = _LDMA_CH_CTRL_BLOCKSIZE_UNIT6, /**< Six transfers per arbitration. */
\r
72 ldmaCtrlBlockSizeUnit8 = _LDMA_CH_CTRL_BLOCKSIZE_UNIT8, /**< Eight transfers per arbitration. */
\r
73 ldmaCtrlBlockSizeUnit16 = _LDMA_CH_CTRL_BLOCKSIZE_UNIT16, /**< 16 transfers per arbitration. */
\r
74 ldmaCtrlBlockSizeUnit32 = _LDMA_CH_CTRL_BLOCKSIZE_UNIT32, /**< 32 transfers per arbitration. */
\r
75 ldmaCtrlBlockSizeUnit64 = _LDMA_CH_CTRL_BLOCKSIZE_UNIT64, /**< 64 transfers per arbitration. */
\r
76 ldmaCtrlBlockSizeUnit128 = _LDMA_CH_CTRL_BLOCKSIZE_UNIT128, /**< 128 transfers per arbitration. */
\r
77 ldmaCtrlBlockSizeUnit256 = _LDMA_CH_CTRL_BLOCKSIZE_UNIT256, /**< 256 transfers per arbitration. */
\r
78 ldmaCtrlBlockSizeUnit512 = _LDMA_CH_CTRL_BLOCKSIZE_UNIT512, /**< 512 transfers per arbitration. */
\r
79 ldmaCtrlBlockSizeUnit1024 = _LDMA_CH_CTRL_BLOCKSIZE_UNIT1024, /**< 1024 transfers per arbitration. */
\r
80 ldmaCtrlBlockSizeAll = _LDMA_CH_CTRL_BLOCKSIZE_ALL /**< Lock arbitration during transfer. */
\r
81 } LDMA_CtrlBlockSize_t;
\r
83 /** DMA structure type. */
\r
86 ldmaCtrlStructTypeXfer = _LDMA_CH_CTRL_STRUCTTYPE_TRANSFER, /**< TRANSFER transfer type. */
\r
87 ldmaCtrlStructTypeSync = _LDMA_CH_CTRL_STRUCTTYPE_SYNCHRONIZE, /**< SYNCHRONIZE transfer type. */
\r
88 ldmaCtrlStructTypeWrite = _LDMA_CH_CTRL_STRUCTTYPE_WRITE /**< WRITE transfer type. */
\r
89 } LDMA_CtrlStructType_t;
\r
91 /** DMA transfer block or cycle selector. */
\r
94 ldmaCtrlReqModeBlock = _LDMA_CH_CTRL_REQMODE_BLOCK, /**< Each DMA request trigger transfer of one block. */
\r
95 ldmaCtrlReqModeAll = _LDMA_CH_CTRL_REQMODE_ALL /**< A DMA request trigger transfer of a complete cycle. */
\r
96 } LDMA_CtrlReqMode_t;
\r
98 /** Source address increment unit size. */
\r
101 ldmaCtrlSrcIncOne = _LDMA_CH_CTRL_SRCINC_ONE, /**< Increment source address by one unit data size. */
\r
102 ldmaCtrlSrcIncTwo = _LDMA_CH_CTRL_SRCINC_TWO, /**< Increment source address by two unit data sizes. */
\r
103 ldmaCtrlSrcIncFour = _LDMA_CH_CTRL_SRCINC_FOUR, /**< Increment source address by four unit data sizes. */
\r
104 ldmaCtrlSrcIncNone = _LDMA_CH_CTRL_SRCINC_NONE /**< Do not increment the source address. */
\r
105 } LDMA_CtrlSrcInc_t;
\r
107 /** DMA transfer unit size. */
\r
110 ldmaCtrlSizeByte = _LDMA_CH_CTRL_SIZE_BYTE, /**< Each unit transfer is a byte. */
\r
111 ldmaCtrlSizeHalf = _LDMA_CH_CTRL_SIZE_HALFWORD, /**< Each unit transfer is a half-word. */
\r
112 ldmaCtrlSizeWord = _LDMA_CH_CTRL_SIZE_WORD /**< Each unit transfer is a word. */
\r
115 /** Destination address increment unit size. */
\r
118 ldmaCtrlDstIncOne = _LDMA_CH_CTRL_DSTINC_ONE, /**< Increment destination address by one unit data size. */
\r
119 ldmaCtrlDstIncTwo = _LDMA_CH_CTRL_DSTINC_TWO, /**< Increment destination address by two unit data sizes. */
\r
120 ldmaCtrlDstIncFour = _LDMA_CH_CTRL_DSTINC_FOUR, /**< Increment destination address by four unit data sizes. */
\r
121 ldmaCtrlDstIncNone = _LDMA_CH_CTRL_DSTINC_NONE /**< Do not increment the destination address. */
\r
122 } LDMA_CtrlDstInc_t;
\r
124 /** Source addressing mode. */
\r
127 ldmaCtrlSrcAddrModeAbs = _LDMA_CH_CTRL_SRCMODE_ABSOLUTE, /**< Address fetched from a linked structure is absolute. */
\r
128 ldmaCtrlSrcAddrModeRel = _LDMA_CH_CTRL_SRCMODE_RELATIVE /**< Address fetched from a linked structure is relative. */
\r
129 } LDMA_CtrlSrcAddrMode_t;
\r
131 /** Destination addressing mode. */
\r
134 ldmaCtrlDstAddrModeAbs = _LDMA_CH_CTRL_DSTMODE_ABSOLUTE, /**< Address fetched from a linked structure is absolute. */
\r
135 ldmaCtrlDstAddrModeRel = _LDMA_CH_CTRL_DSTMODE_RELATIVE /**< Address fetched from a linked structure is relative. */
\r
136 } LDMA_CtrlDstAddrMode_t;
\r
138 /** DMA linkload address mode. */
\r
141 ldmaLinkModeAbs = _LDMA_CH_LINK_LINKMODE_ABSOLUTE, /**< Link address is an absolute address value. */
\r
142 ldmaLinkModeRel = _LDMA_CH_LINK_LINKMODE_RELATIVE /**< Link address is a two's complement releative address. */
\r
145 /** Insert extra arbitration slots to increase channel arbitration priority. */
\r
148 ldmaCfgArbSlotsAs1 = _LDMA_CH_CFG_ARBSLOTS_ONE, /**< One arbitration slot selected. */
\r
149 ldmaCfgArbSlotsAs2 = _LDMA_CH_CFG_ARBSLOTS_TWO, /**< Two arbitration slots selected. */
\r
150 ldmaCfgArbSlotsAs4 = _LDMA_CH_CFG_ARBSLOTS_FOUR, /**< Four arbitration slots selected. */
\r
151 ldmaCfgArbSlotsAs8 = _LDMA_CH_CFG_ARBSLOTS_EIGHT /**< Eight arbitration slots selected. */
\r
152 } LDMA_CfgArbSlots_t;
\r
154 /** Source address increment sign. */
\r
157 ldmaCfgSrcIncSignPos = _LDMA_CH_CFG_SRCINCSIGN_POSITIVE, /**< Increment source address. */
\r
158 ldmaCfgSrcIncSignNeg = _LDMA_CH_CFG_SRCINCSIGN_NEGATIVE /**< Decrement source address. */
\r
159 } LDMA_CfgSrcIncSign_t;
\r
161 /** Destination address increment sign. */
\r
164 ldmaCfgDstIncSignPos = _LDMA_CH_CFG_DSTINCSIGN_POSITIVE, /**< Increment destination address. */
\r
165 ldmaCfgDstIncSignNeg = _LDMA_CH_CFG_DSTINCSIGN_NEGATIVE /**< Decrement destination address. */
\r
166 } LDMA_CfgDstIncSign_t;
\r
168 /** Peripherals that can trigger LDMA transfers. */
\r
171 ldmaPeripheralSignal_NONE = LDMA_CH_REQSEL_SOURCESEL_NONE, ///< No peripheral selected for DMA triggering.
\r
172 #if defined( LDMA_CH_REQSEL_SIGSEL_ADC0SCAN )
\r
173 ldmaPeripheralSignal_ADC0_SCAN = LDMA_CH_REQSEL_SIGSEL_ADC0SCAN | LDMA_CH_REQSEL_SOURCESEL_ADC0, ///< Trig on ADC0_SCAN.
\r
175 #if defined( LDMA_CH_REQSEL_SIGSEL_ADC0SINGLE )
\r
176 ldmaPeripheralSignal_ADC0_SINGLE = LDMA_CH_REQSEL_SIGSEL_ADC0SINGLE | LDMA_CH_REQSEL_SOURCESEL_ADC0, ///< Trig on ADC0_SINGLE.
\r
178 #if defined( LDMA_CH_REQSEL_SIGSEL_AGCRSSI )
\r
179 ldmaPeripheralSignal_AGC_RSSI = LDMA_CH_REQSEL_SIGSEL_AGCRSSI | LDMA_CH_REQSEL_SOURCESEL_AGC, ///< Trig on AGC_RSSI.
\r
181 #if defined( LDMA_CH_REQSEL_SIGSEL_CRYPTODATA0RD )
\r
182 ldmaPeripheralSignal_CRYPTO_DATA0RD = LDMA_CH_REQSEL_SIGSEL_CRYPTODATA0RD | LDMA_CH_REQSEL_SOURCESEL_CRYPTO, ///< Trig on CRYPTO_DATA0RD.
\r
184 #if defined( LDMA_CH_REQSEL_SIGSEL_CRYPTODATA0WR )
\r
185 ldmaPeripheralSignal_CRYPTO_DATA0WR = LDMA_CH_REQSEL_SIGSEL_CRYPTODATA0WR | LDMA_CH_REQSEL_SOURCESEL_CRYPTO, ///< Trig on CRYPTO_DATA0WR.
\r
187 #if defined( LDMA_CH_REQSEL_SIGSEL_CRYPTODATA0XWR )
\r
188 ldmaPeripheralSignal_CRYPTO_DATA0XWR = LDMA_CH_REQSEL_SIGSEL_CRYPTODATA0XWR | LDMA_CH_REQSEL_SOURCESEL_CRYPTO, ///< Trig on CRYPTO_DATA0XWR.
\r
190 #if defined( LDMA_CH_REQSEL_SIGSEL_CRYPTODATA1RD )
\r
191 ldmaPeripheralSignal_CRYPTO_DATA1RD = LDMA_CH_REQSEL_SIGSEL_CRYPTODATA1RD | LDMA_CH_REQSEL_SOURCESEL_CRYPTO, ///< Trig on CRYPTO_DATA1RD.
\r
193 #if defined( LDMA_CH_REQSEL_SIGSEL_CRYPTODATA1WR )
\r
194 ldmaPeripheralSignal_CRYPTO_DATA1WR = LDMA_CH_REQSEL_SIGSEL_CRYPTODATA1WR | LDMA_CH_REQSEL_SOURCESEL_CRYPTO, ///< Trig on CRYPTO_DATA1WR.
\r
196 #if defined( LDMA_CH_REQSEL_SIGSEL_I2C0RXDATAV )
\r
197 ldmaPeripheralSignal_I2C0_RXDATAV = LDMA_CH_REQSEL_SIGSEL_I2C0RXDATAV | LDMA_CH_REQSEL_SOURCESEL_I2C0, ///< Trig on I2C0_RXDATAV.
\r
199 #if defined( LDMA_CH_REQSEL_SIGSEL_I2C0TXBL )
\r
200 ldmaPeripheralSignal_I2C0_TXBL = LDMA_CH_REQSEL_SIGSEL_I2C0TXBL | LDMA_CH_REQSEL_SOURCESEL_I2C0, ///< Trig on I2C0_TXBL.
\r
202 #if defined( LDMA_CH_REQSEL_SIGSEL_LEUART0RXDATAV )
\r
203 ldmaPeripheralSignal_LEUART0_RXDATAV = LDMA_CH_REQSEL_SIGSEL_LEUART0RXDATAV | LDMA_CH_REQSEL_SOURCESEL_LEUART0, ///< Trig on LEUART0_RXDATAV.
\r
205 #if defined( LDMA_CH_REQSEL_SIGSEL_LEUART0TXBL )
\r
206 ldmaPeripheralSignal_LEUART0_TXBL = LDMA_CH_REQSEL_SIGSEL_LEUART0TXBL | LDMA_CH_REQSEL_SOURCESEL_LEUART0, ///< Trig on LEUART0_TXBL.
\r
208 #if defined( LDMA_CH_REQSEL_SIGSEL_LEUART0TXEMPTY )
\r
209 ldmaPeripheralSignal_LEUART0_TXEMPTY = LDMA_CH_REQSEL_SIGSEL_LEUART0TXEMPTY | LDMA_CH_REQSEL_SOURCESEL_LEUART0, ///< Trig on LEUART0_TXEMPTY.
\r
211 #if defined( LDMA_CH_REQSEL_SIGSEL_MODEMDEBUG )
\r
212 ldmaPeripheralSignal_MODEM_DEBUG = LDMA_CH_REQSEL_SIGSEL_MODEMDEBUG | LDMA_CH_REQSEL_SOURCESEL_MODEM, ///< Trig on MODEM_DEBUG.
\r
214 #if defined( LDMA_CH_REQSEL_SIGSEL_MSCWDATA )
\r
215 ldmaPeripheralSignal_MSC_WDATA = LDMA_CH_REQSEL_SIGSEL_MSCWDATA | LDMA_CH_REQSEL_SOURCESEL_MSC, ///< Trig on MSC_WDATA.
\r
217 #if defined( LDMA_CH_REQSEL_SIGSEL_PROTIMERBOF )
\r
218 ldmaPeripheralSignal_PROTIMER_BOF = LDMA_CH_REQSEL_SIGSEL_PROTIMERBOF | LDMA_CH_REQSEL_SOURCESEL_PROTIMER, ///< Trig on PROTIMER_BOF.
\r
220 #if defined( LDMA_CH_REQSEL_SIGSEL_PROTIMERCC0 )
\r
221 ldmaPeripheralSignal_PROTIMER_CC0 = LDMA_CH_REQSEL_SIGSEL_PROTIMERCC0 | LDMA_CH_REQSEL_SOURCESEL_PROTIMER, ///< Trig on PROTIMER_CC0.
\r
223 #if defined( LDMA_CH_REQSEL_SIGSEL_PROTIMERCC1 )
\r
224 ldmaPeripheralSignal_PROTIMER_CC1 = LDMA_CH_REQSEL_SIGSEL_PROTIMERCC1 | LDMA_CH_REQSEL_SOURCESEL_PROTIMER, ///< Trig on PROTIMER_CC1.
\r
226 #if defined( LDMA_CH_REQSEL_SIGSEL_PROTIMERCC2 )
\r
227 ldmaPeripheralSignal_PROTIMER_CC2 = LDMA_CH_REQSEL_SIGSEL_PROTIMERCC2 | LDMA_CH_REQSEL_SOURCESEL_PROTIMER, ///< Trig on PROTIMER_CC2.
\r
229 #if defined( LDMA_CH_REQSEL_SIGSEL_PROTIMERCC3 )
\r
230 ldmaPeripheralSignal_PROTIMER_CC3 = LDMA_CH_REQSEL_SIGSEL_PROTIMERCC3 | LDMA_CH_REQSEL_SOURCESEL_PROTIMER, ///< Trig on PROTIMER_CC3.
\r
232 #if defined( LDMA_CH_REQSEL_SIGSEL_PROTIMERCC4 )
\r
233 ldmaPeripheralSignal_PROTIMER_CC4 = LDMA_CH_REQSEL_SIGSEL_PROTIMERCC4 | LDMA_CH_REQSEL_SOURCESEL_PROTIMER, ///< Trig on PROTIMER_CC4.
\r
235 #if defined( LDMA_CH_REQSEL_SIGSEL_PROTIMERPOF )
\r
236 ldmaPeripheralSignal_PROTIMER_POF = LDMA_CH_REQSEL_SIGSEL_PROTIMERPOF | LDMA_CH_REQSEL_SOURCESEL_PROTIMER, ///< Trig on PROTIMER_POF.
\r
238 #if defined( LDMA_CH_REQSEL_SIGSEL_PROTIMERWOF )
\r
239 ldmaPeripheralSignal_PROTIMER_WOF = LDMA_CH_REQSEL_SIGSEL_PROTIMERWOF | LDMA_CH_REQSEL_SOURCESEL_PROTIMER, ///< Trig on PROTIMER_WOF.
\r
241 #if defined( LDMA_CH_REQSEL_SIGSEL_PRSREQ0 )
\r
242 ldmaPeripheralSignal_PRS_REQ0 = LDMA_CH_REQSEL_SIGSEL_PRSREQ0 | LDMA_CH_REQSEL_SOURCESEL_PRS, ///< Trig on PRS_REQ0.
\r
244 #if defined( LDMA_CH_REQSEL_SIGSEL_PRSREQ1 )
\r
245 ldmaPeripheralSignal_PRS_REQ1 = LDMA_CH_REQSEL_SIGSEL_PRSREQ1 | LDMA_CH_REQSEL_SOURCESEL_PRS, ///< Trig on PRS_REQ1.
\r
247 #if defined( LDMA_CH_REQSEL_SIGSEL_TIMER0CC0 )
\r
248 ldmaPeripheralSignal_TIMER0_CC0 = LDMA_CH_REQSEL_SIGSEL_TIMER0CC0 | LDMA_CH_REQSEL_SOURCESEL_TIMER0, ///< Trig on TIMER0_CC0.
\r
250 #if defined( LDMA_CH_REQSEL_SIGSEL_TIMER0CC1 )
\r
251 ldmaPeripheralSignal_TIMER0_CC1 = LDMA_CH_REQSEL_SIGSEL_TIMER0CC1 | LDMA_CH_REQSEL_SOURCESEL_TIMER0, ///< Trig on TIMER0_CC1.
\r
253 #if defined( LDMA_CH_REQSEL_SIGSEL_TIMER0CC2 )
\r
254 ldmaPeripheralSignal_TIMER0_CC2 = LDMA_CH_REQSEL_SIGSEL_TIMER0CC2 | LDMA_CH_REQSEL_SOURCESEL_TIMER0, ///< Trig on TIMER0_CC2.
\r
256 #if defined( LDMA_CH_REQSEL_SIGSEL_TIMER0UFOF )
\r
257 ldmaPeripheralSignal_TIMER0_UFOF = LDMA_CH_REQSEL_SIGSEL_TIMER0UFOF | LDMA_CH_REQSEL_SOURCESEL_TIMER0, ///< Trig on TIMER0_UFOF.
\r
259 #if defined( LDMA_CH_REQSEL_SIGSEL_TIMER1CC0 )
\r
260 ldmaPeripheralSignal_TIMER1_CC0 = LDMA_CH_REQSEL_SIGSEL_TIMER1CC0 | LDMA_CH_REQSEL_SOURCESEL_TIMER1, ///< Trig on TIMER1_CC0.
\r
262 #if defined( LDMA_CH_REQSEL_SIGSEL_TIMER1CC1 )
\r
263 ldmaPeripheralSignal_TIMER1_CC1 = LDMA_CH_REQSEL_SIGSEL_TIMER1CC1 | LDMA_CH_REQSEL_SOURCESEL_TIMER1, ///< Trig on TIMER1_CC1.
\r
265 #if defined( LDMA_CH_REQSEL_SIGSEL_TIMER1CC2 )
\r
266 ldmaPeripheralSignal_TIMER1_CC2 = LDMA_CH_REQSEL_SIGSEL_TIMER1CC2 | LDMA_CH_REQSEL_SOURCESEL_TIMER1, ///< Trig on TIMER1_CC2.
\r
268 #if defined( LDMA_CH_REQSEL_SIGSEL_TIMER1CC3 )
\r
269 ldmaPeripheralSignal_TIMER1_CC3 = LDMA_CH_REQSEL_SIGSEL_TIMER1CC3 | LDMA_CH_REQSEL_SOURCESEL_TIMER1, ///< Trig on TIMER1_CC3.
\r
271 #if defined( LDMA_CH_REQSEL_SIGSEL_TIMER1UFOF )
\r
272 ldmaPeripheralSignal_TIMER1_UFOF = LDMA_CH_REQSEL_SIGSEL_TIMER1UFOF | LDMA_CH_REQSEL_SOURCESEL_TIMER1, ///< Trig on TIMER1_UFOF.
\r
274 #if defined( LDMA_CH_REQSEL_SIGSEL_USART0RXDATAV )
\r
275 ldmaPeripheralSignal_USART0_RXDATAV = LDMA_CH_REQSEL_SIGSEL_USART0RXDATAV | LDMA_CH_REQSEL_SOURCESEL_USART0, ///< Trig on USART0_RXDATAV.
\r
277 #if defined( LDMA_CH_REQSEL_SIGSEL_USART0TXBL )
\r
278 ldmaPeripheralSignal_USART0_TXBL = LDMA_CH_REQSEL_SIGSEL_USART0TXBL | LDMA_CH_REQSEL_SOURCESEL_USART0, ///< Trig on USART0_TXBL.
\r
280 #if defined( LDMA_CH_REQSEL_SIGSEL_USART0TXEMPTY )
\r
281 ldmaPeripheralSignal_USART0_TXEMPTY = LDMA_CH_REQSEL_SIGSEL_USART0TXEMPTY | LDMA_CH_REQSEL_SOURCESEL_USART0, ///< Trig on USART0_TXEMPTY.
\r
283 #if defined( LDMA_CH_REQSEL_SIGSEL_USART1RXDATAV )
\r
284 ldmaPeripheralSignal_USART1_RXDATAV = LDMA_CH_REQSEL_SIGSEL_USART1RXDATAV | LDMA_CH_REQSEL_SOURCESEL_USART1, ///< Trig on USART1_RXDATAV.
\r
286 #if defined( LDMA_CH_REQSEL_SIGSEL_USART1RXDATAVRIGHT )
\r
287 ldmaPeripheralSignal_USART1_RXDATAVRIGHT = LDMA_CH_REQSEL_SIGSEL_USART1RXDATAVRIGHT | LDMA_CH_REQSEL_SOURCESEL_USART1, ///< Trig on USART1_RXDATAVRIGHT.
\r
289 #if defined( LDMA_CH_REQSEL_SIGSEL_USART1TXBL )
\r
290 ldmaPeripheralSignal_USART1_TXBL = LDMA_CH_REQSEL_SIGSEL_USART1TXBL | LDMA_CH_REQSEL_SOURCESEL_USART1, ///< Trig on USART1_TXBL.
\r
292 #if defined( LDMA_CH_REQSEL_SIGSEL_USART1TXBLRIGHT )
\r
293 ldmaPeripheralSignal_USART1_TXBLRIGHT = LDMA_CH_REQSEL_SIGSEL_USART1TXBLRIGHT | LDMA_CH_REQSEL_SOURCESEL_USART1, ///< Trig on USART1_TXBLRIGHT.
\r
295 #if defined( LDMA_CH_REQSEL_SIGSEL_USART1TXEMPTY )
\r
296 ldmaPeripheralSignal_USART1_TXEMPTY = LDMA_CH_REQSEL_SIGSEL_USART1TXEMPTY | LDMA_CH_REQSEL_SOURCESEL_USART1 ///< Trig on USART1_TXEMPTY.
\r
298 } LDMA_PeripheralSignal_t;
\r
301 /*******************************************************************************
\r
302 ******************************* STRUCTS ***********************************
\r
303 ******************************************************************************/
\r
309 * The LDMA DMA controller supports three different DMA descriptors. Each
\r
310 * consist of four WORD's which map directly onto hw control registers for a
\r
311 * given DMA channel. The three descriptor types are XFER, SYNC and WRI.
\r
312 * Refer to the reference manual for further information.
\r
317 * TRANSFER DMA descriptor, this is the only descriptor type which can be
\r
318 * used to start a DMA transfer.
\r
322 uint32_t structType : 2; /**< Set to 0 to select XFER descriptor type. */
\r
323 uint32_t reserved0 : 1;
\r
324 uint32_t structReq : 1; /**< DMA transfer trigger during LINKLOAD. */
\r
325 uint32_t xferCnt : 11; /**< Transfer count minus one. */
\r
326 uint32_t byteSwap : 1; /**< Enable byte swapping transfers. */
\r
327 uint32_t blockSize : 4; /**< Number of unit transfers per arb. cycle. */
\r
328 uint32_t doneIfs : 1; /**< Generate interrupt when done. */
\r
329 uint32_t reqMode : 1; /**< Block or cycle transfer selector. */
\r
330 uint32_t decLoopCnt : 1; /**< Enable looped transfers. */
\r
331 uint32_t ignoreSrec : 1; /**< Ignore single requests. */
\r
332 uint32_t srcInc : 2; /**< Source address increment unit size. */
\r
333 uint32_t size : 2; /**< DMA transfer unit size. */
\r
334 uint32_t dstInc : 2; /**< Destination address increment unit size. */
\r
335 uint32_t srcAddrMode: 1; /**< Source addressing mode. */
\r
336 uint32_t dstAddrMode: 1; /**< Destination addressing mode. */
\r
338 uint32_t srcAddr; /**< DMA source address. */
\r
339 uint32_t dstAddr; /**< DMA destination address. */
\r
341 uint32_t linkMode : 1; /**< Select absolute or relative link address.*/
\r
342 uint32_t link : 1; /**< Enable LINKLOAD when transfer is done. */
\r
343 int32_t linkAddr : 30; /**< Address of next (linked) descriptor. */
\r
346 /** SYNCHRONIZE DMA descriptor, used for intra channel transfer
\r
351 uint32_t structType : 2; /**< Set to 1 to select SYNC descriptor type. */
\r
352 uint32_t reserved0 : 1;
\r
353 uint32_t structReq : 1; /**< DMA transfer trigger during LINKLOAD. */
\r
354 uint32_t xferCnt : 11; /**< Transfer count minus one. */
\r
355 uint32_t byteSwap : 1; /**< Enable byte swapping transfers. */
\r
356 uint32_t blockSize : 4; /**< Number of unit transfers per arb. cycle. */
\r
357 uint32_t doneIfs : 1; /**< Generate interrupt when done. */
\r
358 uint32_t reqMode : 1; /**< Block or cycle transfer selector. */
\r
359 uint32_t decLoopCnt : 1; /**< Enable looped transfers. */
\r
360 uint32_t ignoreSrec : 1; /**< Ignore single requests. */
\r
361 uint32_t srcInc : 2; /**< Source address increment unit size. */
\r
362 uint32_t size : 2; /**< DMA transfer unit size. */
\r
363 uint32_t dstInc : 2; /**< Destination address increment unit size. */
\r
364 uint32_t srcAddrMode: 1; /**< Source addressing mode. */
\r
365 uint32_t dstAddrMode: 1; /**< Destination addressing mode. */
\r
367 uint32_t syncSet : 8; /**< Set bits in LDMA_CTRL.SYNCTRIG register. */
\r
368 uint32_t syncClr : 8; /**< Clear bits in LDMA_CTRL.SYNCTRIG register*/
\r
369 uint32_t reserved3 : 16;
\r
370 uint32_t matchVal : 8; /**< Sync trig match value. */
\r
371 uint32_t matchEn : 8; /**< Sync trig match enable. */
\r
372 uint32_t reserved4 : 16;
\r
374 uint32_t linkMode : 1; /**< Select absolute or relative link address.*/
\r
375 uint32_t link : 1; /**< Enable LINKLOAD when transfer is done. */
\r
376 int32_t linkAddr : 30; /**< Address of next (linked) descriptor. */
\r
379 /** WRITE DMA descriptor, used for write immediate operations. */
\r
382 uint32_t structType : 2; /**< Set to 2 to select WRITE descriptor type.*/
\r
383 uint32_t reserved0 : 1;
\r
384 uint32_t structReq : 1; /**< DMA transfer trigger during LINKLOAD. */
\r
385 uint32_t xferCnt : 11; /**< Transfer count minus one. */
\r
386 uint32_t byteSwap : 1; /**< Enable byte swapping transfers. */
\r
387 uint32_t blockSize : 4; /**< Number of unit transfers per arb. cycle. */
\r
388 uint32_t doneIfs : 1; /**< Generate interrupt when done. */
\r
389 uint32_t reqMode : 1; /**< Block or cycle transfer selector. */
\r
390 uint32_t decLoopCnt : 1; /**< Enable looped transfers. */
\r
391 uint32_t ignoreSrec : 1; /**< Ignore single requests. */
\r
392 uint32_t srcInc : 2; /**< Source address increment unit size. */
\r
393 uint32_t size : 2; /**< DMA transfer unit size. */
\r
394 uint32_t dstInc : 2; /**< Destination address increment unit size. */
\r
395 uint32_t srcAddrMode: 1; /**< Source addressing mode. */
\r
396 uint32_t dstAddrMode: 1; /**< Destination addressing mode. */
\r
398 uint32_t immVal; /**< Data to be written at dstAddr. */
\r
399 uint32_t dstAddr; /**< DMA write destination address. */
\r
401 uint32_t linkMode : 1; /**< Select absolute or relative link address.*/
\r
402 uint32_t link : 1; /**< Enable LINKLOAD when transfer is done. */
\r
403 int32_t linkAddr : 30; /**< Address of next (linked) descriptor. */
\r
405 } LDMA_Descriptor_t;
\r
407 /** @brief LDMA initialization configuration structure. */
\r
410 uint8_t ldmaInitCtrlNumFixed; /**< Arbitration mode separator.*/
\r
411 uint8_t ldmaInitCtrlSyncPrsClrEn; /**< PRS Synctrig clear enable. */
\r
412 uint8_t ldmaInitCtrlSyncPrsSetEn; /**< PRS Synctrig set enable. */
\r
413 uint8_t ldmaInitIrqPriority; /**< LDMA IRQ priority (0..7). */
\r
418 * DMA transfer configuration structure.
\r
420 * This struct configures all aspects of a DMA transfer.
\r
424 uint32_t ldmaReqSel; /**< Selects DMA trigger source. */
\r
425 uint8_t ldmaCtrlSyncPrsClrOff; /**< PRS Synctrig clear enables to clear. */
\r
426 uint8_t ldmaCtrlSyncPrsClrOn; /**< PRS Synctrig clear enables to set. */
\r
427 uint8_t ldmaCtrlSyncPrsSetOff; /**< PRS Synctrig set enables to clear. */
\r
428 uint8_t ldmaCtrlSyncPrsSetOn; /**< PRS Synctrig set enables to set. */
\r
429 bool ldmaReqDis; /**< Mask the PRS trigger input. */
\r
430 bool ldmaDbgHalt; /**< Dis. DMA trig when cpu is halted. */
\r
431 uint8_t ldmaCfgArbSlots; /**< Arbitration slot number. */
\r
432 uint8_t ldmaCfgSrcIncSign; /**< Source addr. increment sign. */
\r
433 uint8_t ldmaCfgDstIncSign; /**< Dest. addr. increment sign. */
\r
434 uint8_t ldmaLoopCnt; /**< Counter for looped transfers. */
\r
435 } LDMA_TransferCfg_t;
\r
438 /*******************************************************************************
\r
439 ************************** STRUCT INITIALIZERS ****************************
\r
440 ******************************************************************************/
\r
443 /** @brief Default DMA initialization structure. */
\r
444 #define LDMA_INIT_DEFAULT \
\r
446 .ldmaInitCtrlNumFixed = _LDMA_CTRL_NUMFIXED_DEFAULT, /* Fixed priority arbitration. */ \
\r
447 .ldmaInitCtrlSyncPrsClrEn = 0, /* No PRS Synctrig clear enable*/ \
\r
448 .ldmaInitCtrlSyncPrsSetEn = 0, /* No PRS Synctrig set enable. */ \
\r
449 .ldmaInitIrqPriority = 3 /* IRQ priority level 3. */ \
\r
454 * Generic DMA transfer configuration for memory to memory transfers.
\r
456 #define LDMA_TRANSFER_CFG_MEMORY() \
\r
459 false, false, ldmaCfgArbSlotsAs1, \
\r
460 ldmaCfgSrcIncSignPos, ldmaCfgDstIncSignPos, 0 \
\r
465 * Generic DMA transfer configuration for looped memory to memory transfers.
\r
467 #define LDMA_TRANSFER_CFG_MEMORY_LOOP( loopCnt) \
\r
470 false, false, ldmaCfgArbSlotsAs1, \
\r
471 ldmaCfgSrcIncSignPos, ldmaCfgDstIncSignPos, \
\r
477 * Generic DMA transfer configuration for memory to/from peripheral transfers.
\r
479 #define LDMA_TRANSFER_CFG_PERIPHERAL( signal ) \
\r
481 signal, 0, 0, 0, 0, \
\r
482 false, false, ldmaCfgArbSlotsAs1, \
\r
483 ldmaCfgSrcIncSignPos, ldmaCfgDstIncSignPos, 0 \
\r
488 * Generic DMA transfer configuration for looped memory to/from peripheral transfers.
\r
490 #define LDMA_TRANSFER_CFG_PERIPHERAL_LOOP( signal, loopCnt ) \
\r
492 signal, 0, 0, 0, 0, \
\r
493 false, false, ldmaCfgArbSlotsAs1, \
\r
494 ldmaCfgSrcIncSignPos, ldmaCfgDstIncSignPos, loopCnt \
\r
499 * DMA descriptor initializer for single memory to memory word transfer.
\r
500 * @param[in] src Source data address.
\r
501 * @param[in] dest Destination data address.
\r
502 * @param[in] count Number of words to transfer.
\r
504 #define LDMA_DESCRIPTOR_SINGLE_M2M_WORD( src, dest, count ) \
\r
508 .structType = ldmaCtrlStructTypeXfer, \
\r
510 .xferCnt = ( count ) - 1, \
\r
512 .blockSize = ldmaCtrlBlockSizeUnit1, \
\r
514 .reqMode = ldmaCtrlReqModeAll, \
\r
517 .srcInc = ldmaCtrlSrcIncOne, \
\r
518 .size = ldmaCtrlSizeWord, \
\r
519 .dstInc = ldmaCtrlDstIncOne, \
\r
520 .srcAddrMode = ldmaCtrlSrcAddrModeAbs, \
\r
521 .dstAddrMode = ldmaCtrlDstAddrModeAbs, \
\r
522 .srcAddr = (uint32_t)(src), \
\r
523 .dstAddr = (uint32_t)(dest), \
\r
532 * DMA descriptor initializer for single memory to memory half-word transfer.
\r
533 * @param[in] src Source data address.
\r
534 * @param[in] dest Destination data address.
\r
535 * @param[in] count Number of half-words to transfer.
\r
537 #define LDMA_DESCRIPTOR_SINGLE_M2M_HALF( src, dest, count ) \
\r
541 .structType = ldmaCtrlStructTypeXfer, \
\r
543 .xferCnt = ( count ) - 1, \
\r
545 .blockSize = ldmaCtrlBlockSizeUnit1, \
\r
547 .reqMode = ldmaCtrlReqModeAll, \
\r
550 .srcInc = ldmaCtrlSrcIncOne, \
\r
551 .size = ldmaCtrlSizeHalf, \
\r
552 .dstInc = ldmaCtrlDstIncOne, \
\r
553 .srcAddrMode = ldmaCtrlSrcAddrModeAbs, \
\r
554 .dstAddrMode = ldmaCtrlDstAddrModeAbs, \
\r
555 .srcAddr = (uint32_t)(src), \
\r
556 .dstAddr = (uint32_t)(dest), \
\r
565 * DMA descriptor initializer for single memory to memory byte transfer.
\r
566 * @param[in] src Source data address.
\r
567 * @param[in] dest Destination data address.
\r
568 * @param[in] count Number of bytes to transfer.
\r
570 #define LDMA_DESCRIPTOR_SINGLE_M2M_BYTE( src, dest, count ) \
\r
574 .structType = ldmaCtrlStructTypeXfer, \
\r
576 .xferCnt = ( count ) - 1, \
\r
578 .blockSize = ldmaCtrlBlockSizeUnit1, \
\r
580 .reqMode = ldmaCtrlReqModeAll, \
\r
583 .srcInc = ldmaCtrlSrcIncOne, \
\r
584 .size = ldmaCtrlSizeByte, \
\r
585 .dstInc = ldmaCtrlDstIncOne, \
\r
586 .srcAddrMode = ldmaCtrlSrcAddrModeAbs, \
\r
587 .dstAddrMode = ldmaCtrlDstAddrModeAbs, \
\r
588 .srcAddr = (uint32_t)(src), \
\r
589 .dstAddr = (uint32_t)(dest), \
\r
598 * DMA descriptor initializer for linked memory to memory word transfer.
\r
600 * The link address must be an absolute address.
\r
602 * The linkAddr member of the transfer descriptor is not
\r
604 * @param[in] src Source data address.
\r
605 * @param[in] dest Destination data address.
\r
606 * @param[in] count Number of words to transfer.
\r
608 #define LDMA_DESCRIPTOR_LINKABS_M2M_WORD( src, dest, count ) \
\r
612 .structType = ldmaCtrlStructTypeXfer, \
\r
614 .xferCnt = ( count ) - 1, \
\r
616 .blockSize = ldmaCtrlBlockSizeUnit1, \
\r
618 .reqMode = ldmaCtrlReqModeAll, \
\r
621 .srcInc = ldmaCtrlSrcIncOne, \
\r
622 .size = ldmaCtrlSizeWord, \
\r
623 .dstInc = ldmaCtrlDstIncOne, \
\r
624 .srcAddrMode = ldmaCtrlSrcAddrModeAbs, \
\r
625 .dstAddrMode = ldmaCtrlDstAddrModeAbs, \
\r
626 .srcAddr = (uint32_t)(src), \
\r
627 .dstAddr = (uint32_t)(dest), \
\r
628 .linkMode = ldmaLinkModeAbs, \
\r
630 .linkAddr = 0 /* Must be set runtime ! */ \
\r
636 * DMA descriptor initializer for linked memory to memory half-word transfer.
\r
638 * The link address must be an absolute address.
\r
640 * The linkAddr member of the transfer descriptor is not
\r
642 * @param[in] src Source data address.
\r
643 * @param[in] dest Destination data address.
\r
644 * @param[in] count Number of half-words to transfer.
\r
646 #define LDMA_DESCRIPTOR_LINKABS_M2M_HALF( src, dest, count ) \
\r
650 .structType = ldmaCtrlStructTypeXfer, \
\r
652 .xferCnt = ( count ) - 1, \
\r
654 .blockSize = ldmaCtrlBlockSizeUnit1, \
\r
656 .reqMode = ldmaCtrlReqModeAll, \
\r
659 .srcInc = ldmaCtrlSrcIncOne, \
\r
660 .size = ldmaCtrlSizeHalf, \
\r
661 .dstInc = ldmaCtrlDstIncOne, \
\r
662 .srcAddrMode = ldmaCtrlSrcAddrModeAbs, \
\r
663 .dstAddrMode = ldmaCtrlDstAddrModeAbs, \
\r
664 .srcAddr = (uint32_t)(src), \
\r
665 .dstAddr = (uint32_t)(dest), \
\r
666 .linkMode = ldmaLinkModeAbs, \
\r
668 .linkAddr = 0 /* Must be set runtime ! */ \
\r
674 * DMA descriptor initializer for linked memory to memory byte transfer.
\r
676 * The link address must be an absolute address.
\r
678 * The linkAddr member of the transfer descriptor is not
\r
680 * @param[in] src Source data address.
\r
681 * @param[in] dest Destination data address.
\r
682 * @param[in] count Number of bytes to transfer.
\r
684 #define LDMA_DESCRIPTOR_LINKABS_M2M_BYTE( src, dest, count ) \
\r
688 .structType = ldmaCtrlStructTypeXfer, \
\r
690 .xferCnt = ( count ) - 1, \
\r
692 .blockSize = ldmaCtrlBlockSizeUnit1, \
\r
694 .reqMode = ldmaCtrlReqModeAll, \
\r
697 .srcInc = ldmaCtrlSrcIncOne, \
\r
698 .size = ldmaCtrlSizeByte, \
\r
699 .dstInc = ldmaCtrlDstIncOne, \
\r
700 .srcAddrMode = ldmaCtrlSrcAddrModeAbs, \
\r
701 .dstAddrMode = ldmaCtrlDstAddrModeAbs, \
\r
702 .srcAddr = (uint32_t)(src), \
\r
703 .dstAddr = (uint32_t)(dest), \
\r
704 .linkMode = ldmaLinkModeAbs, \
\r
706 .linkAddr = 0 /* Must be set runtime ! */ \
\r
712 * DMA descriptor initializer for linked memory to memory word transfer.
\r
714 * The link address is a relative address.
\r
716 * The linkAddr member of the transfer descriptor is
\r
717 * initialized to 4, assuming that the next descriptor immediately follows
\r
718 * this descriptor (in memory).
\r
719 * @param[in] src Source data address.
\r
720 * @param[in] dest Destination data address.
\r
721 * @param[in] count Number of words to transfer.
\r
722 * @param[in] linkjmp Address of descriptor to link to expressed as a
\r
723 * signed number of descriptors from "here".
\r
724 * 1=one descriptor forward in memory,
\r
725 * 0=one this descriptor,
\r
726 * -1=one descriptor back in memory.
\r
728 #define LDMA_DESCRIPTOR_LINKREL_M2M_WORD( src, dest, count, linkjmp ) \
\r
732 .structType = ldmaCtrlStructTypeXfer, \
\r
734 .xferCnt = ( count ) - 1, \
\r
736 .blockSize = ldmaCtrlBlockSizeUnit1, \
\r
738 .reqMode = ldmaCtrlReqModeAll, \
\r
741 .srcInc = ldmaCtrlSrcIncOne, \
\r
742 .size = ldmaCtrlSizeWord, \
\r
743 .dstInc = ldmaCtrlDstIncOne, \
\r
744 .srcAddrMode = ldmaCtrlSrcAddrModeAbs, \
\r
745 .dstAddrMode = ldmaCtrlDstAddrModeAbs, \
\r
746 .srcAddr = (uint32_t)(src), \
\r
747 .dstAddr = (uint32_t)(dest), \
\r
748 .linkMode = ldmaLinkModeRel, \
\r
750 .linkAddr = ( linkjmp ) * 4 \
\r
756 * DMA descriptor initializer for linked memory to memory half-word transfer.
\r
758 * The link address is a relative address.
\r
760 * The linkAddr member of the transfer descriptor is
\r
761 * initialized to 4, assuming that the next descriptor immediately follows
\r
762 * this descriptor (in memory).
\r
763 * @param[in] src Source data address.
\r
764 * @param[in] dest Destination data address.
\r
765 * @param[in] count Number of half-words to transfer.
\r
766 * @param[in] linkjmp Address of descriptor to link to expressed as a
\r
767 * signed number of descriptors from "here".
\r
768 * 1=one descriptor forward in memory,
\r
769 * 0=one this descriptor,
\r
770 * -1=one descriptor back in memory.
\r
772 #define LDMA_DESCRIPTOR_LINKREL_M2M_HALF( src, dest, count, linkjmp ) \
\r
776 .structType = ldmaCtrlStructTypeXfer, \
\r
778 .xferCnt = ( count ) - 1, \
\r
780 .blockSize = ldmaCtrlBlockSizeUnit1, \
\r
782 .reqMode = ldmaCtrlReqModeAll, \
\r
785 .srcInc = ldmaCtrlSrcIncOne, \
\r
786 .size = ldmaCtrlSizeHalf, \
\r
787 .dstInc = ldmaCtrlDstIncOne, \
\r
788 .srcAddrMode = ldmaCtrlSrcAddrModeAbs, \
\r
789 .dstAddrMode = ldmaCtrlDstAddrModeAbs, \
\r
790 .srcAddr = (uint32_t)(src), \
\r
791 .dstAddr = (uint32_t)(dest), \
\r
792 .linkMode = ldmaLinkModeRel, \
\r
794 .linkAddr = ( linkjmp ) * 4 \
\r
800 * DMA descriptor initializer for linked memory to memory byte transfer.
\r
802 * The link address is a relative address.
\r
804 * The linkAddr member of the transfer descriptor is
\r
805 * initialized to 4, assuming that the next descriptor immediately follows
\r
806 * this descriptor (in memory).
\r
807 * @param[in] src Source data address.
\r
808 * @param[in] dest Destination data address.
\r
809 * @param[in] count Number of bytes to transfer.
\r
810 * @param[in] linkjmp Address of descriptor to link to expressed as a
\r
811 * signed number of descriptors from "here".
\r
812 * 1=one descriptor forward in memory,
\r
813 * 0=one this descriptor,
\r
814 * -1=one descriptor back in memory.
\r
816 #define LDMA_DESCRIPTOR_LINKREL_M2M_BYTE( src, dest, count, linkjmp ) \
\r
820 .structType = ldmaCtrlStructTypeXfer, \
\r
822 .xferCnt = ( count ) - 1, \
\r
824 .blockSize = ldmaCtrlBlockSizeUnit1, \
\r
826 .reqMode = ldmaCtrlReqModeAll, \
\r
829 .srcInc = ldmaCtrlSrcIncOne, \
\r
830 .size = ldmaCtrlSizeByte, \
\r
831 .dstInc = ldmaCtrlDstIncOne, \
\r
832 .srcAddrMode = ldmaCtrlSrcAddrModeAbs, \
\r
833 .dstAddrMode = ldmaCtrlDstAddrModeAbs, \
\r
834 .srcAddr = (uint32_t)(src), \
\r
835 .dstAddr = (uint32_t)(dest), \
\r
836 .linkMode = ldmaLinkModeRel, \
\r
838 .linkAddr = ( linkjmp ) * 4 \
\r
844 * DMA descriptor initializer for byte transfers from a peripheral to memory.
\r
845 * @param[in] src Peripheral data source register address.
\r
846 * @param[in] dest Destination data address.
\r
847 * @param[in] count Number of bytes to transfer.
\r
849 #define LDMA_DESCRIPTOR_SINGLE_P2M_BYTE( src, dest, count ) \
\r
853 .structType = ldmaCtrlStructTypeXfer, \
\r
855 .xferCnt = ( count ) - 1, \
\r
857 .blockSize = ldmaCtrlBlockSizeUnit1, \
\r
859 .reqMode = ldmaCtrlReqModeBlock, \
\r
862 .srcInc = ldmaCtrlSrcIncNone, \
\r
863 .size = ldmaCtrlSizeByte, \
\r
864 .dstInc = ldmaCtrlDstIncOne, \
\r
865 .srcAddrMode = ldmaCtrlSrcAddrModeAbs, \
\r
866 .dstAddrMode = ldmaCtrlDstAddrModeAbs, \
\r
867 .srcAddr = (uint32_t)(src), \
\r
868 .dstAddr = (uint32_t)(dest), \
\r
877 * DMA descriptor initializer for byte transfers from memory to a peripheral
\r
878 * @param[in] src Source data address.
\r
879 * @param[in] dest Peripheral data register destination address.
\r
880 * @param[in] count Number of bytes to transfer.
\r
882 #define LDMA_DESCRIPTOR_SINGLE_M2P_BYTE( src, dest, count ) \
\r
886 .structType = ldmaCtrlStructTypeXfer, \
\r
888 .xferCnt = ( count ) - 1, \
\r
890 .blockSize = ldmaCtrlBlockSizeUnit1, \
\r
892 .reqMode = ldmaCtrlReqModeBlock, \
\r
895 .srcInc = ldmaCtrlSrcIncOne, \
\r
896 .size = ldmaCtrlSizeByte, \
\r
897 .dstInc = ldmaCtrlDstIncNone, \
\r
898 .srcAddrMode = ldmaCtrlSrcAddrModeAbs, \
\r
899 .dstAddrMode = ldmaCtrlDstAddrModeAbs, \
\r
900 .srcAddr = (uint32_t)(src), \
\r
901 .dstAddr = (uint32_t)(dest), \
\r
910 * DMA descriptor initializer for byte transfers from a peripheral to memory.
\r
911 * @param[in] src Peripheral data source register address.
\r
912 * @param[in] dest Destination data address.
\r
913 * @param[in] count Number of bytes to transfer.
\r
914 * @param[in] linkjmp Address of descriptor to link to expressed as a
\r
915 * signed number of descriptors from "here".
\r
916 * 1=one descriptor forward in memory,
\r
917 * 0=one this descriptor,
\r
918 * -1=one descriptor back in memory.
\r
920 #define LDMA_DESCRIPTOR_LINKREL_P2M_BYTE( src, dest, count, linkjmp ) \
\r
924 .structType = ldmaCtrlStructTypeXfer, \
\r
926 .xferCnt = ( count ) - 1, \
\r
928 .blockSize = ldmaCtrlBlockSizeUnit1, \
\r
930 .reqMode = ldmaCtrlReqModeBlock, \
\r
933 .srcInc = ldmaCtrlSrcIncNone, \
\r
934 .size = ldmaCtrlSizeByte, \
\r
935 .dstInc = ldmaCtrlDstIncOne, \
\r
936 .srcAddrMode = ldmaCtrlSrcAddrModeAbs, \
\r
937 .dstAddrMode = ldmaCtrlDstAddrModeAbs, \
\r
938 .srcAddr = (uint32_t)(src), \
\r
939 .dstAddr = (uint32_t)(dest), \
\r
940 .linkMode = ldmaLinkModeRel, \
\r
942 .linkAddr = ( linkjmp ) * 4 \
\r
948 * DMA descriptor initializer for byte transfers from memory to a peripheral
\r
949 * @param[in] src Source data address.
\r
950 * @param[in] dest Peripheral data register destination address.
\r
951 * @param[in] count Number of bytes to transfer.
\r
952 * @param[in] linkjmp Address of descriptor to link to expressed as a
\r
953 * signed number of descriptors from "here".
\r
954 * 1=one descriptor forward in memory,
\r
955 * 0=one this descriptor,
\r
956 * -1=one descriptor back in memory.
\r
958 #define LDMA_DESCRIPTOR_LINKREL_M2P_BYTE( src, dest, count, linkjmp ) \
\r
962 .structType = ldmaCtrlStructTypeXfer, \
\r
964 .xferCnt = ( count ) - 1, \
\r
966 .blockSize = ldmaCtrlBlockSizeUnit1, \
\r
968 .reqMode = ldmaCtrlReqModeBlock, \
\r
971 .srcInc = ldmaCtrlSrcIncOne, \
\r
972 .size = ldmaCtrlSizeByte, \
\r
973 .dstInc = ldmaCtrlDstIncNone, \
\r
974 .srcAddrMode = ldmaCtrlSrcAddrModeAbs, \
\r
975 .dstAddrMode = ldmaCtrlDstAddrModeAbs, \
\r
976 .srcAddr = (uint32_t)(src), \
\r
977 .dstAddr = (uint32_t)(dest), \
\r
978 .linkMode = ldmaLinkModeRel, \
\r
980 .linkAddr = ( linkjmp ) * 4 \
\r
986 * DMA descriptor initializer for Immediate WRITE transfer
\r
987 * @param[in] value Immediate value to write.
\r
988 * @param[in] address Write sddress.
\r
990 #define LDMA_DESCRIPTOR_SINGLE_WRITE( value, address ) \
\r
994 .structType = ldmaCtrlStructTypeWrite, \
\r
1001 .decLoopCnt = 0, \
\r
1002 .ignoreSrec = 0, \
\r
1006 .srcAddrMode = 0, \
\r
1007 .dstAddrMode = 0, \
\r
1008 .immVal = (value), \
\r
1009 .dstAddr = (uint32_t)(address), \
\r
1018 * DMA descriptor initializer for Immediate WRITE transfer
\r
1020 * The link address must be an absolute address.
\r
1022 * The linkAddr member of the transfer descriptor is not
\r
1024 * @param[in] value Immediate value to write.
\r
1025 * @param[in] address Write sddress.
\r
1027 #define LDMA_DESCRIPTOR_LINKABS_WRITE( value, address ) \
\r
1031 .structType = ldmaCtrlStructTypeWrite, \
\r
1038 .decLoopCnt = 0, \
\r
1039 .ignoreSrec = 0, \
\r
1043 .srcAddrMode = 0, \
\r
1044 .dstAddrMode = 0, \
\r
1045 .immVal = (value), \
\r
1046 .dstAddr = (uint32_t)(address), \
\r
1047 .linkMode = ldmaLinkModeAbs, \
\r
1049 .linkAddr = 0 /* Must be set runtime ! */ \
\r
1055 * DMA descriptor initializer for Immediate WRITE transfer
\r
1056 * @param[in] value Immediate value to write.
\r
1057 * @param[in] address Write sddress.
\r
1058 * @param[in] linkjmp Address of descriptor to link to expressed as a
\r
1059 * signed number of descriptors from "here".
\r
1060 * 1=one descriptor forward in memory,
\r
1061 * 0=one this descriptor,
\r
1062 * -1=one descriptor back in memory.
\r
1064 #define LDMA_DESCRIPTOR_LINKREL_WRITE( value, address, linkjmp ) \
\r
1068 .structType = ldmaCtrlStructTypeWrite, \
\r
1075 .decLoopCnt = 0, \
\r
1076 .ignoreSrec = 0, \
\r
1080 .srcAddrMode = 0, \
\r
1081 .dstAddrMode = 0, \
\r
1082 .immVal = (value), \
\r
1083 .dstAddr = (uint32_t)(address), \
\r
1084 .linkMode = ldmaLinkModeRel, \
\r
1086 .linkAddr = ( linkjmp ) * 4 \
\r
1092 * DMA descriptor initializer for SYNC transfer
\r
1093 * @param[in] set Sync pattern bits to set.
\r
1094 * @param[in] clr Sync pattern bits to clear.
\r
1095 * @param[in] matchValue Sync pattern to match.
\r
1096 * @param[in] matchEnable Sync pattern bits to enable for match.
\r
1098 #define LDMA_DESCRIPTOR_SINGLE_SYNC( set, clr, matchValue, matchEnable ) \
\r
1102 .structType = ldmaCtrlStructTypeSync, \
\r
1109 .decLoopCnt = 0, \
\r
1110 .ignoreSrec = 0, \
\r
1114 .srcAddrMode = 0, \
\r
1115 .dstAddrMode = 0, \
\r
1116 .syncSet = (set), \
\r
1117 .syncClr = (clr), \
\r
1118 .matchVal = (matchValue), \
\r
1119 .matchEn = (matchEnable), \
\r
1128 * DMA descriptor initializer for SYNC transfer
\r
1130 * The link address must be an absolute address.
\r
1132 * The linkAddr member of the transfer descriptor is not
\r
1134 * @param[in] set Sync pattern bits to set.
\r
1135 * @param[in] clr Sync pattern bits to clear.
\r
1136 * @param[in] matchValue Sync pattern to match.
\r
1137 * @param[in] matchEnable Sync pattern bits to enable for match.
\r
1139 #define LDMA_DESCRIPTOR_LINKABS_SYNC( set, clr, matchValue, matchEnable ) \
\r
1143 .structType = ldmaCtrlStructTypeSync, \
\r
1150 .decLoopCnt = 0, \
\r
1151 .ignoreSrec = 0, \
\r
1155 .srcAddrMode = 0, \
\r
1156 .dstAddrMode = 0, \
\r
1157 .syncSet = (set), \
\r
1158 .syncClr = (clr), \
\r
1159 .matchVal = (matchValue), \
\r
1160 .matchEn = (matchEnable), \
\r
1161 .linkMode = ldmaLinkModeAbs, \
\r
1163 .linkAddr = 0 /* Must be set runtime ! */ \
\r
1169 * DMA descriptor initializer for SYNC transfer
\r
1170 * @param[in] set Sync pattern bits to set.
\r
1171 * @param[in] clr Sync pattern bits to clear.
\r
1172 * @param[in] matchValue Sync pattern to match.
\r
1173 * @param[in] matchEnable Sync pattern bits to enable for match.
\r
1174 * @param[in] linkjmp Address of descriptor to link to expressed as a
\r
1175 * signed number of descriptors from "here".
\r
1176 * 1=one descriptor forward in memory,
\r
1177 * 0=one this descriptor,
\r
1178 * -1=one descriptor back in memory.
\r
1180 #define LDMA_DESCRIPTOR_LINKREL_SYNC( set, clr, matchValue, matchEnable, linkjmp ) \
\r
1184 .structType = ldmaCtrlStructTypeSync, \
\r
1191 .decLoopCnt = 0, \
\r
1192 .ignoreSrec = 0, \
\r
1196 .srcAddrMode = 0, \
\r
1197 .dstAddrMode = 0, \
\r
1198 .syncSet = (set), \
\r
1199 .syncClr = (clr), \
\r
1200 .matchVal = (matchValue), \
\r
1201 .matchEn = (matchEnable), \
\r
1202 .linkMode = ldmaLinkModeRel, \
\r
1204 .linkAddr = ( linkjmp ) * 4 \
\r
1208 /*******************************************************************************
\r
1209 ***************************** PROTOTYPES **********************************
\r
1210 ******************************************************************************/
\r
1212 void LDMA_DeInit( void );
\r
1213 void LDMA_Init( LDMA_Init_t *init );
\r
1214 void LDMA_StartTransfer( int ch,
\r
1215 LDMA_TransferCfg_t *transfer,
\r
1216 LDMA_Descriptor_t *descriptor );
\r
1217 void LDMA_StopTransfer( int ch );
\r
1218 bool LDMA_TransferDone( int ch );
\r
1219 uint32_t LDMA_TransferRemainingCount( int ch );
\r
1222 /***************************************************************************//**
\r
1224 * Clear one or more pending LDMA interrupts.
\r
1226 * @param[in] flags
\r
1227 * Pending LDMA interrupt sources to clear. Use one or more valid
\r
1228 * interrupt flags for the LDMA module (LDMA_IFC_nnn).
\r
1229 ******************************************************************************/
\r
1230 __STATIC_INLINE void LDMA_IntClear(uint32_t flags)
\r
1232 LDMA->IFC = flags;
\r
1236 /***************************************************************************//**
\r
1238 * Disable one or more LDMA interrupts.
\r
1240 * @param[in] flags
\r
1241 * LDMA interrupt sources to disable. Use one or more valid
\r
1242 * interrupt flags for the LDMA module (LDMA_IEN_nnn).
\r
1243 ******************************************************************************/
\r
1244 __STATIC_INLINE void LDMA_IntDisable(uint32_t flags)
\r
1246 LDMA->IEN &= ~flags;
\r
1250 /***************************************************************************//**
\r
1252 * Enable one or more LDMA interrupts.
\r
1255 * Depending on the use, a pending interrupt may already be set prior to
\r
1256 * enabling the interrupt. Consider using LDMA_IntClear() prior to enabling
\r
1257 * if such a pending interrupt should be ignored.
\r
1259 * @param[in] flags
\r
1260 * LDMA interrupt sources to enable. Use one or more valid
\r
1261 * interrupt flags for the LDMA module (LDMA_IEN_nnn).
\r
1262 ******************************************************************************/
\r
1263 __STATIC_INLINE void LDMA_IntEnable(uint32_t flags)
\r
1265 LDMA->IEN |= flags;
\r
1269 /***************************************************************************//**
\r
1271 * Get pending LDMA interrupt flags.
\r
1274 * The event bits are not cleared by the use of this function.
\r
1277 * LDMA interrupt sources pending. Returns one or more valid
\r
1278 * interrupt flags for the LDMA module (LDMA_IF_nnn).
\r
1279 ******************************************************************************/
\r
1280 __STATIC_INLINE uint32_t LDMA_IntGet(void)
\r
1286 /***************************************************************************//**
\r
1288 * Get enabled and pending LDMA interrupt flags.
\r
1289 * Useful for handling more interrupt sources in the same interrupt handler.
\r
1292 * Interrupt flags are not cleared by the use of this function.
\r
1295 * Pending and enabled LDMA interrupt sources
\r
1296 * The return value is the bitwise AND of
\r
1297 * - the enabled interrupt sources in LDMA_IEN and
\r
1298 * - the pending interrupt flags LDMA_IF
\r
1299 ******************************************************************************/
\r
1300 __STATIC_INLINE uint32_t LDMA_IntGetEnabled(void)
\r
1305 return LDMA->IF & ien;
\r
1309 /***************************************************************************//**
\r
1311 * Set one or more pending LDMA interrupts
\r
1313 * @param[in] flags
\r
1314 * LDMA interrupt sources to set to pending. Use one or more valid
\r
1315 * interrupt flags for the LDMA module (LDMA_IFS_nnn).
\r
1316 ******************************************************************************/
\r
1317 __STATIC_INLINE void LDMA_IntSet(uint32_t flags)
\r
1319 LDMA->IFS = flags;
\r
1322 /** @} (end addtogroup LDMA) */
\r
1323 /** @} (end addtogroup EM_Library) */
\r
1325 #ifdef __cplusplus
\r
1329 #endif /* defined( LDMA_PRESENT ) && ( LDMA_COUNT == 1 ) */
\r
1330 #endif /* __SILICON_LABS_EM_LDMA_H__ */
\r