iLLD_TC27xD  1.0
IfxDma.h
Go to the documentation of this file.
1 /**
2  * \file IfxDma.h
3  * \brief DMA basic functionality
4  * \ingroup IfxLld_Dma
5  *
6  * \version iLLD_1_0_0_11_0
7  * \copyright Copyright (c) 2013 Infineon Technologies AG. All rights reserved.
8  *
9  *
10  * IMPORTANT NOTICE
11  *
12  *
13  * Infineon Technologies AG (Infineon) is supplying this file for use
14  * exclusively with Infineon's microcontroller products. This file can be freely
15  * distributed within development tools that are supporting such microcontroller
16  * products.
17  *
18  * THIS SOFTWARE IS PROVIDED "AS IS". NO WARRANTIES, WHETHER EXPRESS, IMPLIED
19  * OR STATUTORY, INCLUDING, BUT NOT LIMITED TO, IMPLIED WARRANTIES OF
20  * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE APPLY TO THIS SOFTWARE.
21  * INFINEON SHALL NOT, IN ANY CIRCUMSTANCES, BE LIABLE FOR SPECIAL, INCIDENTAL,
22  * OR CONSEQUENTIAL DAMAGES, FOR ANY REASON WHATSOEVER.
23  *
24  * \defgroup IfxLld_Dma_Std_Enum Enumerations
25  * \ingroup IfxLld_Dma_Std
26  * \defgroup IfxLld_Dma_Std_Reset Reset Functions
27  * \ingroup IfxLld_Dma_Std
28  * \defgroup IfxLld_Dma_Std_Channel_Transaction Channel Transaction Functions
29  * \ingroup IfxLld_Dma_Std
30  * \defgroup IfxLld_Dma_Std_Move_Engine Move Engine functions
31  * \ingroup IfxLld_Dma_Std
32  * \defgroup IfxLld_Dma_Std_Channel_Configure Channel configuration Functions
33  * \ingroup IfxLld_Dma_Std
34  * \defgroup IfxLld_Dma_Std_Channel_Halt Channel Halt Functions
35  * \ingroup IfxLld_Dma_Std
36  * \defgroup IfxLld_Dma_Std_Double_Buffer Double Buffer functions
37  * \ingroup IfxLld_Dma_Std
38  * \defgroup IfxLld_Dma_Std_Interrupts Interrupt functions
39  * \ingroup IfxLld_Dma_Std
40  */
41 
42 #ifndef IFXDMA_H
43 #define IFXDMA_H 1
44 
45 /******************************************************************************/
46 /*----------------------------------Includes----------------------------------*/
47 /******************************************************************************/
48 
49 #include "_Impl/IfxDma_cfg.h"
50 #include "IfxDma_bf.h"
52 #include "IfxDma_reg.h"
53 #include "Src/Std/IfxSrc.h"
54 #include "Scu/Std/IfxScuWdt.h"
55 #include "Scu/Std/IfxScuCcu.h"
56 
57 /******************************************************************************/
58 /*--------------------------------Enumerations--------------------------------*/
59 /******************************************************************************/
60 
61 /** \addtogroup IfxLld_Dma_Std_Enum
62  * \{ */
63 /** \brief Bus Master Mode definition
64  * Definition in Ifx_DMA.MODE[4].B.MODE
65  */
66 typedef enum
67 {
68  IfxDma_BusMasterMode_user = 0, /**< \brief Selected hardware resource performs Bus access in user mode */
69  IfxDma_BusMasterMode_supervisor = 1 /**< \brief Selected hardware resource performs Bus access in supervisor mode */
71 
72 /** \brief Channel Bus Priority definition
73  */
74 typedef enum
75 {
76  IfxDma_ChannelBusPriority_low = 0, /**< \brief low priority */
77  IfxDma_ChannelBusPriority_medium = 1, /**< \brief medium priority */
78  IfxDma_ChannelBusPriority_high = 2 /**< \brief high priority */
80 
81 /** \brief DMA circular buffer (wrap around) definition
82  * Definition in Ifx_DMA.CH[64].ADICR.B.CBLS and Ifx_DMA.CH[64].ADICR.B.CBLD
83  */
84 typedef enum
85 {
86  IfxDma_ChannelIncrementCircular_none = 0, /**< \brief no circular buffer operation */
87  IfxDma_ChannelIncrementCircular_2 = 1, /**< \brief circular buffer size is 2 byte */
88  IfxDma_ChannelIncrementCircular_4 = 2, /**< \brief circular buffer size is 4 byte */
89  IfxDma_ChannelIncrementCircular_8 = 3, /**< \brief circular buffer size is 8 byte */
90  IfxDma_ChannelIncrementCircular_16 = 4, /**< \brief circular buffer size is 16 byte */
91  IfxDma_ChannelIncrementCircular_32 = 5, /**< \brief circular buffer size is 32 byte */
92  IfxDma_ChannelIncrementCircular_64 = 6, /**< \brief circular buffer size is 64 byte */
93  IfxDma_ChannelIncrementCircular_128 = 7, /**< \brief circular buffer size is 128 byte */
94  IfxDma_ChannelIncrementCircular_256 = 8, /**< \brief circular buffer size is 256 byte */
95  IfxDma_ChannelIncrementCircular_512 = 9, /**< \brief circular buffer size is 512 byte */
96  IfxDma_ChannelIncrementCircular_1024 = 10, /**< \brief circular buffer size is 1024 byte */
97  IfxDma_ChannelIncrementCircular_2048 = 11, /**< \brief circular buffer size is 2048 byte */
98  IfxDma_ChannelIncrementCircular_4096 = 12, /**< \brief circular buffer size is 4096 byte */
99  IfxDma_ChannelIncrementCircular_8192 = 13, /**< \brief circular buffer size is 8192 byte */
100  IfxDma_ChannelIncrementCircular_16384 = 14, /**< \brief circular buffer size is 16384 byte */
101  IfxDma_ChannelIncrementCircular_32768 = 15 /**< \brief circular buffer size is 32768 byte */
103 
104 /** \brief DMA incrementation direction definition
105  * Definition in Ifx_DMA.CH[64].ADICR.B.INCS
106  */
107 typedef enum
108 {
109  IfxDma_ChannelIncrementDirection_negative = 0, /**< \brief pointer is decremented */
110  IfxDma_ChannelIncrementDirection_positive = 1 /**< \brief pointer is incremented */
112 
113 /** \brief DMA incrementation definition
114  * Definition in Ifx_DMA.CH[64].ADICR.B.SMF
115  */
116 typedef enum
117 {
118  IfxDma_ChannelIncrementStep_1 = 0, /**< \brief increment by 1 width */
119  IfxDma_ChannelIncrementStep_2 = 1, /**< \brief increment by 2 width */
120  IfxDma_ChannelIncrementStep_4 = 2, /**< \brief increment by 4 width */
121  IfxDma_ChannelIncrementStep_8 = 3, /**< \brief increment by 8 width */
122  IfxDma_ChannelIncrementStep_16 = 4, /**< \brief increment by 16 width */
123  IfxDma_ChannelIncrementStep_32 = 5, /**< \brief increment by 32 width */
124  IfxDma_ChannelIncrementStep_64 = 6, /**< \brief increment by 64 width */
125  IfxDma_ChannelIncrementStep_128 = 7 /**< \brief increment by 128 width */
127 
128 /** \brief Channel Transfer Interrupt generation mechanism.
129  * Definition in Ifx_DMA.CH[64].ADICR.B.INTCT (bit 0)
130  */
131 typedef enum
132 {
133  IfxDma_ChannelInterruptControl_thresholdLimitMatch = 0, /**< \brief interrupt when transfer count (TCOUNT) equals the threshold limit (IRDV) */
134  IfxDma_ChannelInterruptControl_transferCountDecremented = 1 /**< \brief interrupt when transfer count (TCOUNT) is decremented */
136 
137 /** \brief DMA transfer definition
138  * Definition in Ifx_DMA.BLK0.ME.CHCR.B.BLKM and Ifx_DMA.BLK1.ME.CHCR.B.BLKM
139  */
140 typedef enum
141 {
142  IfxDma_ChannelMove_1 = 0, /**< \brief 1 DMA move per DMA transfer */
143  IfxDma_ChannelMove_2 = 1, /**< \brief 2 DMA move per DMA transfer */
144  IfxDma_ChannelMove_4 = 2, /**< \brief 4 DMA move per DMA transfer */
145  IfxDma_ChannelMove_8 = 3, /**< \brief 8 DMA move per DMA transfer */
146  IfxDma_ChannelMove_16 = 4, /**< \brief 16 DMA move per DMA transfer */
147  IfxDma_ChannelMove_3 = 5, /**< \brief 3 DMA move per DMA transfer */
148  IfxDma_ChannelMove_5 = 6, /**< \brief 5 DMA move per DMA transfer */
149  IfxDma_ChannelMove_9 = 7 /**< \brief 9 DMA move per DMA transfer */
151 
152 /** \brief DMA move size definition
153  * Definition in Ifx_DMA.BLK0.ME.CHCR.B.CHDW and Ifx_DMA.BLK1.ME.CHCR.B.CHDW
154  */
155 typedef enum
156 {
157  IfxDma_ChannelMoveSize_8bit = 0, /**< \brief 1 DMA move is 8 bit wide */
158  IfxDma_ChannelMoveSize_16bit = 1, /**< \brief 1 DMA move is 16 bit wide */
159  IfxDma_ChannelMoveSize_32bit = 2, /**< \brief 1 DMA move is 32 bit wide */
160  IfxDma_ChannelMoveSize_64bit = 3, /**< \brief 1 DMA move is 64 bit wide */
161  IfxDma_ChannelMoveSize_128bit = 4, /**< \brief 1 DMA move is 128 bit wide */
162  IfxDma_ChannelMoveSize_256bit = 5 /**< \brief 1 DMA move is 256 bit wide */
164 
165 /** \brief DMA operation mode
166  * Definition in Ifx_DMA.BLK0.ME.CHCR.B.CHMODE and Ifx_DMA.BLK1.ME.CHCR.B.CHMODE
167  */
168 typedef enum
169 {
170  IfxDma_ChannelOperationMode_single = 0, /**< \brief channel disabled after transaction */
171  IfxDma_ChannelOperationMode_continuous = 1 /**< \brief channel stays enabled after transaction */
173 
174 /** \brief Pattern detection selection
175  * Definition in Ifx_DMA.BLK0.ME.CHCR.B.PATSEL and Ifx_DMA.BLK1.ME.CHCR.B.PATSEL
176  */
177 typedef enum
178 {
179  IfxDma_ChannelPattern_0_disable = 0, /**< \brief Pattern detect 0 disabled */
180  IfxDma_ChannelPattern_0_mode1 = 1, /**< \brief Compare match configuration 1 : pattern compare of MExR.RD[0] to PAT0[0] masked by PAT0[2] */
181  IfxDma_ChannelPattern_0_mode2 = 2, /**< \brief Compare match configuration 2 : pattern compare of MExR.RD[0] to PAT0[1] masked by PAT0[3] */
182  IfxDma_ChannelPattern_0_mode3 = 3, /**< \brief Compare match configuration 3 : pattern compare of MExR.RD[0] to PAT0[0] masked by PAT0[2] of actual DMA read move and pattern compare of MExR.RD[0] to PAT0[1] masked by PAT0[3] of previous DMA read move */
183  IfxDma_ChannelPattern_1_disable = 4, /**< \brief Pattern detect 1 disabled */
184  IfxDma_ChannelPattern_1_mode1 = 5, /**< \brief Compare match configuration 1 : pattern compare of MExR.RD[0] to PAT1[0] masked by PAT1[2] */
185  IfxDma_ChannelPattern_1_mode2 = 6, /**< \brief Compare match configuration 2 : pattern compare of MExR.RD[0] to PAT1[1] masked by PAT1[3] */
186  IfxDma_ChannelPattern_1_mode3 = 7 /**< \brief Compare match configuration 3 : pattern compare of MExR.RD[0] to PAT1[0] masked by PAT1[2] of actual DMA read move and pattern compare of MExR.RD[0] to PAT1[1] masked by PAT1[3] of previous DMA read move */
188 
189 /** \brief Channel Priority definition
190  */
191 typedef enum
192 {
193  IfxDma_ChannelPriority_low = 0, /**< \brief low priority */
194  IfxDma_ChannelPriority_medium = 1, /**< \brief medium priority */
195  IfxDma_ChannelPriority_high = 2 /**< \brief high priority */
197 
198 /** \brief DMA request mode
199  * Definition in Ifx_DMA.BLK0.ME.CHCR.B.RROAT and Ifx_DMA.BLK1.ME.CHCR.B.RROAT
200  */
201 typedef enum
202 {
203  IfxDma_ChannelRequestMode_oneTransferPerRequest = 0, /**< \brief a request initiates a single transfer */
204  IfxDma_ChannelRequestMode_completeTransactionPerRequest = 1 /**< \brief a request initiates a complete transaction */
206 
207 /** \brief DMA request selection
208  * Definition in Ifx_DMA.BLK0.ME.CHCR.B.PRSEL and Ifx_DMA.BLK1.ME.CHCR.B.PRSEL
209  */
210 typedef enum
211 {
212  IfxDma_ChannelRequestSource_peripheral = 0, /**< \brief Transfer Request via Hardware Trigger */
213  IfxDma_ChannelRequestSource_daisyChain = 1 /**< \brief Transfer Request via next (higher priority) channel */
215 
216 /** \brief shadow definition definition
217  * Definition in Ifx_DMA.CH[64].ADICR.B.SHCT
218  */
219 typedef enum
220 {
221  IfxDma_ChannelShadow_none = 0, /**< \brief shadow address register not used. Source and destination address register are written directly */
222  IfxDma_ChannelShadow_src = 1, /**< \brief Shadow address register used for source address buffering. When writing to SADRmx, the address is buffered in SHADRmx and transferred to SADRmx with the start of the next DMA transaction */
223  IfxDma_ChannelShadow_dst = 2, /**< \brief Shadow address register used for destination address buffering. When writing to DADRmx, the address is buffered in SHADRmx and transferred to DADRmx with the start of the next DMA transaction */
224  IfxDma_ChannelShadow_srcDirectWrite = 5, /**< \brief Shadow address used for source buffering. When writing to SADRz, the address is buffered in SHADRz and transferred to SADRz with the start of the next DMA transaction */
225  IfxDma_ChannelShadow_dstDirectWrite = 6, /**< \brief Shadow address used for destination buffering. When writing to DADRz, the address is buffered in SHADRz and transferred to DADRz with the start of the next DMA transaction */
226  IfxDma_ChannelShadow_doubleSourceBufferingSwSwitch = 8, /**< \brief Software switch only. Shadow address used for double buffering */
227  IfxDma_ChannelShadow_doubleSourceBufferingHwSwSwitch = 9, /**< \brief Automatic Hardware and Software switch. Shadow address used for double buffering */
228  IfxDma_ChannelShadow_doubleDestinationBufferingSwSwitch = 10, /**< \brief Software switch only. Shadow address used for double buffering */
229  IfxDma_ChannelShadow_doubleDestinationBufferingHwSwSwitch = 11, /**< \brief Automatic Hardware and Software switch. Shadow address used for double buffering */
230  IfxDma_ChannelShadow_linkedList = 12, /**< \brief The DMA controller reads a DMA channel transaction control set and overwrites 8 X words in the corresponding DMARAM channel z */
231  IfxDma_ChannelShadow_accumulatedLinkedList = 13, /**< \brief The DMA controller reads a DMA channel transaction control set and overwrites 6 X words in the corresponding DMARAM channel z */
232  IfxDma_ChannelShadow_safeLinkedList = 14, /**< \brief The DMA controller reads a DMA channel transaction control set. The Linked List only proceeds with the next DMA transaction if the existing SDCRC checksum matches the expected SDCRC checksum in the loaded from the new DMA transaction control set */
233  IfxDma_ChannelShadow_conditionalLinkedList = 15 /**< \brief Shadow address register (MExSHADR) and source and destination address CRC register (MExSDCRC) are used as address pointers to a Linked List. The selection of the address pointer is determined by DMA channel pattern detection conditions */
235 
236 typedef enum
237 {
238  IfxDma_HardwareResourcePartition_0 = 0, /**< \brief "Set of DMA channels are associated with hardware resource partition " + str(x) */
239  IfxDma_HardwareResourcePartition_1, /**< \brief "Set of DMA channels are associated with hardware resource partition " + str(x) */
240  IfxDma_HardwareResourcePartition_2, /**< \brief "Set of DMA channels are associated with hardware resource partition " + str(x) */
241  IfxDma_HardwareResourcePartition_3 /**< \brief "Set of DMA channels are associated with hardware resource partition " + str(x) */
243 
244 /** \brief DMA move engine definition
245  */
246 typedef enum
247 {
248  IfxDma_MoveEngine_0 = 0, /**< \brief first move engine */
249  IfxDma_MoveEngine_1 = 1 /**< \brief second move engine */
251 
252 /** \brief Enable/disable the sensitivity of the module to sleep signal\n
253  * Definition in Ifx_DMA.CLC.B.EDIS
254  */
255 typedef enum
256 {
257  IfxDma_SleepMode_enable = 0, /**< \brief enables sleep mode */
258  IfxDma_SleepMode_disable = 1 /**< \brief disables sleep mode */
260 
261 /** \} */
262 
263 /** \addtogroup IfxLld_Dma_Std_Reset
264  * \{ */
265 
266 /******************************************************************************/
267 /*-------------------------Inline Function Prototypes-------------------------*/
268 /******************************************************************************/
269 
270 /** \brief Return the status of a DMA channel (reset / not reset)
271  * \param dma pointer to DMA module
272  * \param channelId DMA channel number
273  * \return TRUE if the channel is reset
274  * FALSE if the channel is not reset
275  *
276  * \code
277  * // check whether the channel is reset or not and also the hardware trigger disabled
278  *
279  * if (IfxDma_isChannelReset(chn[0].dma, chn[0].channelId) &&
280  * (!IfxDma_isChannelTransactionEnabled(chn[0].dma, chn[0].channelId))) {
281  * // Dma is out of RESET and there is no hardware request enabled
282  * IfxDma_Dma_startChannelTransaction(&chn[0]);
283  * }
284  * \endcode
285  *
286  */
287 IFX_INLINE boolean IfxDma_isChannelReset(Ifx_DMA *dma, IfxDma_ChannelId channelId);
288 
289 /** \brief Reset the channel
290  * \param dma pointer to DMA module
291  * \param channelId DMA channel number
292  * \return None
293  *
294  * \code
295  * // Apply reset to the channel
296  * IfxDma_resetChannel(chn[0].dma, chn[0].channelId);
297  * \endcode
298  *
299  */
300 IFX_INLINE void IfxDma_resetChannel(Ifx_DMA *dma, IfxDma_ChannelId channelId);
301 
302 /** \} */
303 
304 /** \addtogroup IfxLld_Dma_Std_Channel_Transaction
305  * \{ */
306 
307 /******************************************************************************/
308 /*-------------------------Inline Function Prototypes-------------------------*/
309 /******************************************************************************/
310 
311 /** \brief Clear the channel transaction request lost flag status
312  * \param dma pointer to DMA module
313  * \param channelId DMA channel number
314  * \return None
315  *
316  * \code
317  * // Clear the channel transaction request lost flag status
318  * IfxDma_clearChannelTransactionRequestLost(chn[0].dma, chn[0].channelId);
319  * \endcode
320  *
321  */
323 
324 /** \brief Disable a DMA channel hardware transaction request
325  * \param dma pointer to DMA module
326  * \param channelId DMA channel number
327  * \return None
328  *
329  * A coding example can be found in \ref IfxDma_enableChannelTransaction
330  *
331  */
332 IFX_INLINE void IfxDma_disableChannelTransaction(Ifx_DMA *dma, IfxDma_ChannelId channelId);
333 
334 /** \brief Disable the generation of a channel transaction lost error interrupt
335  * \param dma pointer to DMA module
336  * \param channelId DMA channel number
337  * \return None
338  *
339  * \code
340  * // Disable the transaction request lost interrupt for given channel
341  * IfxDma_disableChannelTransactionLostError(chn[0].dma, chn[0].channelId);
342  * \endcode
343  *
344  */
346 
347 /** \brief Enable a DMA channel hardware transaction request
348  * \param dma pointer to DMA module
349  * \param channelId DMA channel number
350  * \return None
351  *
352  * \code
353  * unsigned *src = (unsigned *)((unsigned)&SRC_DMACH0.U + 4*NUM_CHANNELS);
354  * for(int chn=0; chn<NUM_CHANNELS; ++chn, ++src) {
355  * IfxSrc_setRequest(src);
356  * }
357  *
358  * // Do not restrict the hardware triggering to only one transaction
359  *
360  * IfxDma_setChannelContinuousMode(chn[0].dma, chn[0].channelId);
361  * IfxDma_setChannelContinuousMode(chn[1].dma, chn[1].channelId);
362  * IfxDma_setChannelContinuousMode(chn[2].dma, chn[2].channelId);
363  *
364  * // Check for end of transaction
365  *
366  * while(!(IfxDma_getAndClearChannelInterrupt(chn[0].dma, chn[0].channelId)));
367  *
368  * // Enable the hardware trigger for channel 3
369  * IfxDma_enableChannelTransaction(chn[3].dma, chn[3].channelId);
370  *
371  * // Disable the hardware trigger for channel 2
372  * IfxDma_disableChannelTransaction(chn[2].dma, chn[2].channelId);
373  * // Hardware triggers for second time
374  *
375  * unsigned *SRc = (unsigned *)((unsigned)&SRC_DMACH0.U + 4*NUM_CHANNELS);
376  * for(int chn=0; chn<NUM_CHANNELS; ++chn, ++src) {
377  * IfxSrc_setRequest(src);
378  * }
379  *
380  * // Restrict the hardware triggering to only one transaction
381  * IfxDma_setChannelSingleMode(chn[0].dma, chn[0].channelId);
382  * IfxDma_setChannelSingleMode(chn[1].dma, chn[1].channelId);
383  * \endcode
384  *
385  */
386 IFX_INLINE void IfxDma_enableChannelTransaction(Ifx_DMA *dma, IfxDma_ChannelId channelId);
387 
388 /** \brief Enable the generation of a channel transaction lost error interrupt
389  * \param dma pointer to DMA module
390  * \param channelId DMA channel number
391  * \return None
392  *
393  * \code
394  * // Enable the transaction request lost interrupt for given channel
395  * IfxDma_enableChannelTransactionLostError(chn[0].dma, chn[0].channelId);
396  * \endcode
397  *
398  */
400 
401 /** \brief Check the channel transaction request lost flag status
402  * \param dma pointer to DMA module
403  * \param channelId DMA channel number
404  * \return TRUE if the TRL is set
405  * FALSE if the TRL is not set
406  *
407  * \code
408  * boolean trlFlag;
409  *
410  * // Check whether the channel transaction request lost flag is set or not
411  * trlFlag = IfxDma_getChannelTransactionRequestLost(chn[0].dma, chn[0].channelId));
412  * \endcode
413  *
414  */
416 
417 /** \brief Converts DMA circular range to circular code
418  * \param range DMA circular range
419  * \return DMA circular code
420  */
422 
423 /** \brief Return the hardware transaction request status of a DMA channel
424  * \param dma pointer to DMA module
425  * \param channelId DMA channel number
426  * \return TRUE if the hardware transaction request is enabled
427  * FALSE if the hardware transaction request is disabled
428  *
429  * A coding example can be found in \ref IfxDma_isChannelReset
430  *
431  */
432 IFX_INLINE boolean IfxDma_isChannelTransactionEnabled(Ifx_DMA *dma, IfxDma_ChannelId channelId);
433 
434 /** \brief Return the status of a DMA channel (transaction pending)
435  * \param dma pointer to DMA module
436  * \param channelId DMA channel number
437  * \return TRUE if a transaction request for the given channel is pending
438  *
439  * \code
440  * // check for the channel request pending with the channel
441  * if (IfxDma_isChannelTransactionPending(chn[0].dma, chn[0].channelId) == TRUE) {
442  * // There is channel request pending for channel 0
443  * result |= 0;
444  * }
445  * \endcode
446  *
447  */
448 IFX_INLINE boolean IfxDma_isChannelTransactionPending(Ifx_DMA *dma, IfxDma_ChannelId channelId);
449 
450 /** \brief Sets the sensitivity of the module to sleep signal
451  * \param dma pointer to DMA registers
452  * \param mode mode selection (enable/disable)
453  * \return None
454  */
455 IFX_INLINE void IfxDma_setSleepMode(Ifx_DMA *dma, IfxDma_SleepMode mode);
456 
457 /** \brief Request a DMA channel transaction
458  * \param dma pointer to DMA module
459  * \param channelId DMA channel number
460  * \return None
461  *
462  * A coding example can be found in \ref IfxDma_Dma_startChannelTransaction
463  *
464  */
465 IFX_INLINE void IfxDma_startChannelTransaction(Ifx_DMA *dma, IfxDma_ChannelId channelId);
466 
467 /** \} */
468 
469 /** \addtogroup IfxLld_Dma_Std_Move_Engine
470  * \{ */
471 
472 /******************************************************************************/
473 /*-------------------------Inline Function Prototypes-------------------------*/
474 /******************************************************************************/
475 
476 /** \brief Clear the DMA error status flags
477  * \param dma pointer to DMA module
478  * \param moveEngine pointer to the DMA move engine
479  * \param mask value holds the bits to clear or mask
480  * \return None
481  *
482  * \code
483  * // Clear the status of the error flags (as defined in _Impl/IfxDma_cfg.h)
484  * IfxDma_clearErrorFlags(chn[0].dma,IfxDma_MoveEngine_1,
485  * IFXDMA_ERROR_S | // move engine source error
486  * IFXDMA_ERROR_D | // move engine destination error
487  * IFXDMA_ERROR_SPB | // bus error on SPB
488  * IFXDMA_ERROR_SRI | // bus error on SRI
489  * IFXDMA_ERROR_RAM | // RAM error
490  * IFXDMA_ERROR_SLL | // safe linked list CRC checksum error
491  * IFXDMA_ERROR_DLL); // failed linked list load error
492  * \endcode
493  *
494  */
495 IFX_INLINE void IfxDma_clearErrorFlags(Ifx_DMA *dma, IfxDma_MoveEngine moveEngine, uint32 mask);
496 
497 /** \brief Disable the generation of a Move engine destination error interrupt
498  * \param dma pointer to DMA module
499  * \param moveEngine pointer to the DMA move engine
500  * \return None
501  *
502  * A coding example can be found in \ref IfxDma_disableMoveEngineSourceError
503  *
504  */
506 
507 /** \brief Disable the generation of a Move engine source error interrupt
508  * \param dma pointer to DMA module
509  * \param moveEngine pointer to the DMA move engine
510  * \return None
511  *
512  * \code
513  * // Disable the move engine source and destination move errors
514  * IfxDma_disableMoveEngineSourceError(chn[0].dma,IfxDma_MoveEngine_1);
515  * IfxDma_disableMoveEngineDestinationError(chn[0].dma,IfxDma_MoveEngine_1);
516  * \endcode
517  *
518  */
520 
521 /** \brief Enable the generation of a Move engine destination error interrupt
522  * \param dma pointer to DMA module
523  * \param moveEngine pointer to the DMA move engine
524  * \return None
525  *
526  * A coding example can be found in \ref IfxDma_enableMoveEngineSourceError
527  *
528  */
530 
531 /** \brief Enable the generation of a Move engine source error interrupt
532  * \param dma pointer to DMA module
533  * \param moveEngine pointer to the DMA move engine
534  * \return None
535  *
536  * \code
537  * // Enable the move engine source and destination move errors
538  * IfxDma_enableMoveEngineSourceError(chn[0].dma,IfxDma_MoveEngine_1);
539  * IfxDma_enableMoveEngineDestinationError(chn[0].dma,IfxDma_MoveEngine_1);
540  * \endcode
541  *
542  */
544 
545 /** \brief Return the DMA error status flags
546  * \param dma pointer to DMA module
547  * \param moveEngine pointer to the DMA move engine
548  * \return the content of the DMA.ERRSR register
549  *
550  * \code
551  * uint32 errorFlags = 0;
552  *
553  * // Get the status of the error flags of move engine
554  * errorFlags = IfxDma_getErrorFlags(chn[0].dma,IfxDma_MoveEngine_1);
555  *
556  * if( errorFlags & IFXDMA_ERROR_S ) { // move engine source error
557  * }
558  *
559  * if( errorFlags & IFXDMA_ERROR_D ) { // move engine destination error
560  * // ...
561  * }
562  *
563  * if( errorFlags & IFXDMA_ERROR_SPB ) { // bus error on SPB
564  * // ...
565  * }
566  *
567  * if( errorFlags & IFXDMA_ERROR_SRI ) { // bus error on SRI
568  * // ...
569  * }
570  *
571  * if( errorFlags & IFXDMA_ERROR_RAM ) { // RAM error
572  * // ...
573  * }
574  *
575  * if( errorFlags & IFXDMA_ERROR_SLL ) { // safe linked list CRC checksum error
576  * // ...
577  * }
578  *
579  * if( errorFlags & IFXDMA_ERROR_DLL ) { // failed linked list load error
580  * // ...
581  * }
582  * \endcode
583  *
584  */
585 IFX_INLINE uint32 IfxDma_getErrorFlags(Ifx_DMA *dma, IfxDma_MoveEngine moveEngine);
586 
587 /** \} */
588 
589 /** \addtogroup IfxLld_Dma_Std_Channel_Configure
590  * \{ */
591 
592 /******************************************************************************/
593 /*-------------------------Inline Function Prototypes-------------------------*/
594 /******************************************************************************/
595 
596 /** \brief Get a channel source address
597  * \param dma pointer to DMA module
598  * \param channelId DMA channel number
599  * \return Actual channel destination address
600  *
601  * \code
602  * uint32 destAddr = IfxDma_getChannelDestinationAddress(chn[2].dma, chn[2].channelId);
603  *
604  * \endcode
605  *
606  */
608 
609 /** \brief Get a channel source address
610  * \param dma pointer to DMA module
611  * \param channelId DMA channel number
612  * \return Actual channel source address
613  *
614  * \code
615  * uint32 sourceAddr = IfxDma_getChannelSourceAddress(chn[2].dma, chn[2].channelId);
616  * \endcode
617  *
618  */
620 
621 /** \brief Return remaining DMA transfer count
622  * \param dma pointer to DMA module
623  * \param channelId DMA channel number
624  * \return Remaining DMA transfer count
625  *
626  * \code
627  * // Wait till transfer count (TCOUNT) becomes 0
628  *
629  * bool notFinished;
630  * do {
631  * notFinished = false;
632  * if( IfxDma_getChannelTransferCount(chn[0].dma, chn[0].channelId) ) {
633  * notFinished = true;
634  * break;
635  * }
636  * } while( notFinished );
637  * \endcode
638  *
639  */
641 
642 /** \brief get the time stamp
643  * \param dma pointer to DMA module
644  * \return the current time stamp
645  *
646  * \code
647  * uint32 timestamp = IfxDma_getTimestamp(chn[0].dma);
648  * \endcode
649  *
650  */
652 
653 /** \brief Configure the move count for each DMA channel transfer
654  * \param dma pointer to DMA module
655  * \param channelId DMA channel number
656  * \param blockMode value holds the number of moves with in a DMA transfer
657  * \return None
658  *
659  * A coding example can be found in \ref IfxDma_setChannelTransferCount
660  *
661  */
662 IFX_INLINE void IfxDma_setChannelBlockMode(Ifx_DMA *dma, IfxDma_ChannelId channelId, IfxDma_ChannelMove blockMode);
663 
664 /** \brief Configure a DMA channel to "continous transaction mode"
665  * After a transaction, the hardware request transaction remain enabled
666  * \param dma pointer to DMA module
667  * \param channelId DMA channel number
668  * \return None
669  *
670  * A coding example can be found in \ref IfxDma_enableChannelTransaction
671  *
672  */
673 IFX_INLINE void IfxDma_setChannelContinuousMode(Ifx_DMA *dma, IfxDma_ChannelId channelId);
674 
675 /** \brief Configure the destination address
676  * \param dma pointer to DMA module
677  * \param channelId DMA channel number
678  * \param address is the Initial address of the destination pointer
679  * \return None
680  *
681  * A coding example can be found in \ref IfxDma_setChannelSourceAddress
682  *
683  */
684 IFX_INLINE void IfxDma_setChannelDestinationAddress(Ifx_DMA *dma, IfxDma_ChannelId channelId, void *address);
685 
686 /** \brief Configure a DMA channel destination pointer
687  * \param dma pointer to DMA module
688  * \param channelId DMA channel number
689  * \param incStep Specifies the pointer incrementation step
690  * \param direction Specifies the incrementation direction
691  * \param size Specifies the size of the circular buffer
692  * \return None
693  *
694  * A coding example can be found in \ref IfxDma_setChannelSourceIncrementStep
695  *
696  */
698 
699 /** \brief Configure a DMA channel move
700  * \param dma pointer to DMA module
701  * \param channelId DMA channel number
702  * \param moveSize value holds the opcode or size of data of individual moves with in a DMA transfer
703  * \return None
704  *
705  * A coding example can be found in \ref IfxDma_setChannelTransferCount
706  *
707  */
708 IFX_INLINE void IfxDma_setChannelMoveSize(Ifx_DMA *dma, IfxDma_ChannelId channelId, IfxDma_ChannelMoveSize moveSize);
709 
710 /** \brief Configure a DMA channel shadow pointer
711  * \param dma pointer to DMA module
712  * \param channelId DMA channel number
713  * \param shadow Specifies the shadow pointer
714  * \return None
715  *
716  * \code
717  * // Push the shadow mode into double buffer
718  * IfxDma_setChannelShadow(chn[0].dma, chn[0].channelId,
719  * IfxDma_ChannelShadow_doubleSourceBufferingSwSwitch);
720  * \endcode
721  *
722  */
723 IFX_INLINE void IfxDma_setChannelShadow(Ifx_DMA *dma, IfxDma_ChannelId channelId, IfxDma_ChannelShadow shadow);
724 
725 /** \brief Configure a DMA channel to "single transaction mode"
726  * After a transaction, the hardware request transaction is disabled, and must be set by software again
727  * \param dma pointer to DMA module
728  * \param channelId DMA channel number
729  * \return None
730  *
731  * A coding example can be found in \ref IfxDma_enableChannelTransaction
732  *
733  */
734 IFX_INLINE void IfxDma_setChannelSingleMode(Ifx_DMA *dma, IfxDma_ChannelId channelId);
735 
736 /** \brief Configure a DMA channel to "single transaction mode"
737  * One transfer request starts a complete DMA transaction
738  * \param dma pointer to DMA module
739  * \param channelId DMA channel number
740  * \return None
741  *
742  * A coding example can be found in \ref IfxDma_setChannelTransferCount
743  *
744  */
746 
747 /** \brief Configure a DMA channel to "single transfer mode"
748  * A transfer request is required for each transfer
749  * \param dma pointer to DMA module
750  * \param channelId DMA channel number
751  * \return None
752  *
753  * A coding example can be found in \ref IfxDma_setChannelTransferCount
754  *
755  */
756 IFX_INLINE void IfxDma_setChannelSingleTransfer(Ifx_DMA *dma, IfxDma_ChannelId channelId);
757 
758 /** \brief Configure the source address
759  * \param dma pointer to DMA module
760  * \param channelId DMA channel number
761  * \param address is the Initial address of the source pointer
762  * \return None
763  *
764  * \code
765  * // Check for the end of current transaction and before trigger the channel request for
766  * // for another channel, re configure the source and destination addresses
767  *
768  * while(!(IfxDma_getAndClearChannelInterrupt(chn[1].dma, chn[1].channelId)));
769  *
770  * // Re-Program the source address for the channel 2
771  * IfxDma_setChannelSourceAddress(chn[2].dma, chn[2].channelId,Sadr);
772  *
773  * // Re-Program the destination address for channel 2
774  * IfxDma_setChannelDestinationAddress(chn[2].dma, chn[2].channelId,Dadr);
775  *
776  * // Start DMA transaction for channel 2
777  * IfxDma_Dma_startChannelTransaction(&chn[2]);
778  * \endcode
779  *
780  */
781 IFX_INLINE void IfxDma_setChannelSourceAddress(Ifx_DMA *dma, IfxDma_ChannelId channelId, const void *address);
782 
783 /** \brief Configure a DMA channel source pointer
784  * \param dma pointer to DMA module
785  * \param channelId DMA channel number
786  * \param incStep Specifies the pointer incrementation step
787  * \param direction Specifies the incrementation direction
788  * \param size Specifies the size of the circular buffer
789  * \return None
790  *
791  * \code
792  * // Re-program the source and destination circular buffer control fields
793  * IfxDma_setChannelSourceIncrementStep(chn[0].dma, chn[0].channelId, IfxDma_ChannelIncrementStep_2, IfxDma_ChannelIncrementDirection_negative, IfxDma_ChannelIncrementCircular_16);
794  *
795  * IfxDma_setChannelDestinationIncrementStep(chn[0].dma, chn[0].channelId, IfxDma_ChannelIncrementStep_2, IfxDma_ChannelIncrementDirection_negative, IfxDma_ChannelIncrementCircular_16);
796  * \endcode
797  *
798  */
800 
801 /** \brief Configure the move count of a DMA channel transaction
802  * \param dma pointer to DMA module
803  * \param channelId DMA channel number
804  * \param transferCount value holds the DMA transfers within a transaction (1..16383; 0 handled like 1 transaction)
805  * \return None
806  *
807  * \code
808  * // Start DMA transaction
809  * IfxDma_Dma_startChannelTransaction(&chn[0]);
810  *
811  * // Wait till end of transaction
812  * while(!(IfxDma_getAndClearChannelInterrupt(chn[0].dma, chn[0].channelId)));
813  *
814  * // Change the TREL configuration for channel 1
815  * IfxDma_setChannelTransferCount(chn[1].dma, chn[1].channelId,0x6);
816  *
817  * // Change the BLKM configuration for channel 1
818  * IfxDma_setChannelBlockMode(chn[1].dma, chn[1].channelId,IfxDma_ChannelMove_3);
819  *
820  * // Change the Move size configuration for channel 1
821  * IfxDma_setChannelMoveSize(chn[1].dma, chn[1].channelId,IfxDma_ChannelMoveSize_64bit);
822  *
823  * // Pull down the channel pending request after the first transfer is initiated
824  * IfxDma_setChannelSingleTransfer(chn[1].dma, chn[1].channelId);
825  *
826  * // Pull down the channel pending request after the transaction gets over
827  * IfxDma_setChannelSingleTransaction(chn[2].dma, chn[2].channelId);
828  *
829  * // Start DMA transaction
830  * IfxDma_Dma_startChannelTransaction(&chn[1]);
831  *
832  * // Start DMA transaction
833  * IfxDma_Dma_startChannelTransaction(&chn[2]);
834  * \endcode
835  *
836  */
837 IFX_INLINE void IfxDma_setChannelTransferCount(Ifx_DMA *dma, IfxDma_ChannelId channelId, uint32 transferCount);
838 
839 /** \brief Configure the shadow pointer register to read only
840  * \param dma pointer to DMA module
841  * \param channelId DMA channel number
842  * \return None
843  *
844  * \code
845  * // Disable the shadow mode to come out of double buffer mode
846  * IfxDma_writeChannelShadowDisable(chn[0].dma, chn[0].channelId);
847  * \endcode
848  *
849  */
850 IFX_INLINE void IfxDma_writeChannelShadowDisable(Ifx_DMA *dma, IfxDma_ChannelId channelId);
851 
852 /** \brief Configure the shadow pointer register to write-able
853  * \param dma pointer to DMA module
854  * \param channelId DMA channel number
855  * \return None
856  *
857  * \code
858  * // Enable the shadow mode to come out of double buffer mode
859  * IfxDma_writeChannelShadowEnable(chn[0].dma, chn[0].channelId);
860  * \endcode
861  *
862  */
863 IFX_INLINE void IfxDma_writeChannelShadowEnable(Ifx_DMA *dma, IfxDma_ChannelId channelId);
864 
865 /** \} */
866 
867 /** \addtogroup IfxLld_Dma_Std_Channel_Halt
868  * \{ */
869 
870 /******************************************************************************/
871 /*-------------------------Inline Function Prototypes-------------------------*/
872 /******************************************************************************/
873 
874 /** \brief Clear channel halt request and aknowledgement
875  * \param dma pointer to DMA module
876  * \param channelId DMA channel number
877  * \return None
878  *
879  * \code
880  * // Quit the halt mode of operation
881  * IfxDma_clearChannelHalt(chn[0].dma, chn[0].channelId);
882  * \endcode
883  *
884  */
885 IFX_INLINE void IfxDma_clearChannelHalt(Ifx_DMA *dma, IfxDma_ChannelId channelId);
886 
887 /** \brief Get channel halt aknowledgement
888  * \param dma pointer to DMA module
889  * \param channelId DMA channel number
890  * \return halt aknowledgement
891  *
892  * \code
893  * // Check for the channel halt aknowledgement
894  * while(!(IfxDma_getChannelHalt(chn[0].dma, chn[0].channelId)));
895  * \endcode
896  *
897  */
898 IFX_INLINE boolean IfxDma_getChannelHalt(Ifx_DMA *dma, IfxDma_ChannelId channelId);
899 
900 /** \brief setting channel halt request
901  * \param dma pointer to DMA module
902  * \param channelId DMA channel number
903  * \return None
904  *
905  * \code
906  * // Halt the channel processing
907  * IfxDma_setChannelHalt(chn[0].dma,chn[0].channelId);
908  * \endcode
909  *
910  */
911 IFX_INLINE void IfxDma_setChannelHalt(Ifx_DMA *dma, IfxDma_ChannelId channelId);
912 
913 /** \} */
914 
915 /** \addtogroup IfxLld_Dma_Std_Double_Buffer
916  * \{ */
917 
918 /******************************************************************************/
919 /*-------------------------Inline Function Prototypes-------------------------*/
920 /******************************************************************************/
921 
922 /** \brief get information on buffer being read by software and clear the notification flag
923  * \param dma pointer to DMA module
924  * \param channelId DMA channel number
925  * \return TRUE if one of the buffers is being read by software
926  * FALSE if one of the buffers is already read by software
927  *
928  * \code
929  * // Check the buffer being read (Double buffer operation mode)
930  * while(!(IfxDma_getDoubleBufferRead(chn[0].dma, chn[0].channelId)));
931  * \endcode
932  *
933  */
934 IFX_INLINE boolean IfxDma_getDoubleBufferRead(Ifx_DMA *dma, IfxDma_ChannelId channelId);
935 
936 /** \brief get Double buffer selection
937  * \param dma pointer to DMA module
938  * \param channelId channelId DMA channel number
939  * \return TRUE if buffer 1 is being filled
940  * FALSE if buffer 0 is being filled
941  *
942  * \code
943  * boolean buffer_being_filled;
944  *
945  * // Check the buffer being filled (Double buffer operation mode)
946  * buffer_being_filled = IfxDma_getDoubleBufferSelection(chn[0].dma, chn[0].channelId));
947  * \endcode
948  *
949  */
950 IFX_INLINE boolean IfxDma_getDoubleBufferSelection(Ifx_DMA *dma, IfxDma_ChannelId channelId);
951 
952 /** \brief keeps the double buffer active
953  * \param dma pointer to DMA module
954  * \param channelId DMA channel number
955  * \return None
956  *
957  * \code
958  * IfxDma_keepDoubleBufferActive(chn[0].dma, chn[0].channelId);
959  * \endcode
960  *
961  */
962 IFX_INLINE void IfxDma_keepDoubleBufferActive(Ifx_DMA *dma, IfxDma_ChannelId channelId);
963 
964 /** \brief Double buffer switch application
965  * \param dma pointer to DMA module
966  * \param channelId DMA channel number
967  * \return None
968  *
969  * \code
970  * // Apply software buffer switch
971  * IfxDma_switchDoubleBuffer(chn[0].dma, chn[0].channelId);
972  * \endcode
973  *
974  */
975 IFX_INLINE void IfxDma_switchDoubleBuffer(Ifx_DMA *dma, IfxDma_ChannelId channelId);
976 
977 /** \} */
978 
979 /** \addtogroup IfxLld_Dma_Std_Interrupts
980  * \{ */
981 
982 /******************************************************************************/
983 /*-------------------------Inline Function Prototypes-------------------------*/
984 /******************************************************************************/
985 
986 /** \brief Clear a channel transfer interrupt flag
987  * \param dma pointer to DMA module
988  * \param channelId channel for which the interrupt flag should be cleared
989  * \return None
990  *
991  * see Dma.INTSR
992  *
993  */
994 IFX_INLINE void IfxDma_clearChannelInterrupt(Ifx_DMA *dma, IfxDma_ChannelId channelId);
995 
996 /** \brief Disable channel interrupt trigger
997  * \param dma pointer to DMA module
998  * \param channelId DMA channel number
999  * \return None
1000  *
1001  * \code
1002  * IfxDma_disableChannelInterrupt(chn[0].dma, chn[0].channelId);
1003  * \endcode
1004  *
1005  */
1006 IFX_INLINE void IfxDma_disableChannelInterrupt(Ifx_DMA *dma, IfxDma_ChannelId channelId);
1007 
1008 /** \brief Enable channel interrupt trigger
1009  * \param dma pointer to DMA module
1010  * \param channelId DMA channel number
1011  * \return None
1012  *
1013  * \code
1014  * IfxDma_enableChannelInterrupt(chn[0].dma, chn[0].channelId);
1015  * \endcode
1016  *
1017  */
1018 IFX_INLINE void IfxDma_enableChannelInterrupt(Ifx_DMA *dma, IfxDma_ChannelId channelId);
1019 
1020 /** \brief Return and clear a channel transfer interrupt flag
1021  * The flag is automatically cleared with the call to this function
1022  * \param dma pointer to DMA module
1023  * \param channelId DMA channel number
1024  * \return TRUE if the interrupt flag is set
1025  * FALSE if the interrupt flag is not set
1026  *
1027  * \code
1028  * // wait for the end of transaction for intended channel by checking the channel interrupt flag
1029  * // and clear it once it is set and checked
1030  *
1031  * // Wait till end of the transaction
1032  * while(!(IfxDma_getAndClearChannelInterrupt(chn[2].dma, chn[2].channelId)));
1033  * \endcode
1034  *
1035  */
1036 IFX_INLINE boolean IfxDma_getAndClearChannelInterrupt(Ifx_DMA *dma, IfxDma_ChannelId channelId);
1037 
1038 /** \brief Returns and clears the pattern detection interrupt flag
1039  * \param dma pointer to DMA module
1040  * \param channelId DMA channel number
1041  * \return TRUE if pattern detection for a given channel is found
1042  * FALSE if pattern detection for a given channel is not found
1043  *
1044  * \code
1045  * // wait till pattern match is found for given channel
1046  * // and clear it once it is set and checked
1047  *
1048  * // Wait for the pattern detection
1049  * while(!(IfxDma_getAndClearChannelPatternDetectionInterrupt(chn[0].dma, chn[0].channelId)));
1050  * \endcode
1051  *
1052  */
1054 
1055 /** \brief Returns and clears the status of channel wrap destination buffer interrupt trigger flag
1056  * \param dma pointer to DMA module
1057  * \param channelId DMA channel number
1058  * \return TRUE if wrap destination buffer interrupt trigger flag is set
1059  * FALSE if wrap destination buffer interrupt trigger flag is not set or get cleared already
1060  *
1061  * \code
1062  * // wait for the destination buffer wrap interrupt flag
1063  * // and clear it once it is set and checked
1064  * boolean destinationWrapFlag;
1065  *
1066  * destinationWrapFlag = IfxDma_getAndClearChannelWrapDestinationBufferInterrupt(chn[0].dma, chn[0].channelId);
1067  * \endcode
1068  *
1069  */
1071 
1072 /** \brief Returns and clears the status of channel wrap source buffer interrupt trigger flag
1073  * \param dma pointer to DMA module
1074  * \param channelId DMA channel number
1075  * \return TRUE if wrap source buffer interrupt trigger flag is set
1076  * FALSE if wrap source buffer interrupt trigger flag is not set or get cleared already
1077  *
1078  * \code
1079  * // wait for the source buffer wrap interrupt flag
1080  * // and clear it once it is set and checked
1081  * boolean sourceWrapFlag;
1082  *
1083  * sourceWrapFlag = IfxDma_getAndClearChannelWrapSourceBufferInterrupt(chn[0].dma, chn[0].channelId);
1084  * \endcode
1085  *
1086  */
1088 
1089 /** \brief Return a channel transfer interrupt flag
1090  * \param dma pointer to DMA module
1091  * \param channelId channel for which the interrupt flag should be returned
1092  * \return TRUE if the interrupt flag is set
1093  * FALSE if the interrupt flag is not set
1094  *
1095  * see Dma.INTSR
1096  *
1097  */
1098 IFX_INLINE boolean IfxDma_getChannelInterrupt(Ifx_DMA *dma, IfxDma_ChannelId channelId);
1099 
1100 /** \brief Returns whether the old value of pattern detection corresponding pattern comparison operation found a pattern match in previous DMA * read move or not
1101  * \param dma pointer to DMA module
1102  * \param channelId DMA channel number
1103  * \return TRUE if corresponding pattern comparison operation found a pattern match in previous DMA read move or not
1104  * FALSE if corresponding pattern comparison operation did not find a pattern match in previous DMA read move
1105  *
1106  * \code
1107  * boolean patternDetectOldVal;
1108  *
1109  * // Check the old value of the pattern detection
1110  * patternDetectOldVal = IfxDma_getChannelPatternDetectionOldValue(chn[0].dma, chn[0].channelId);
1111  * \endcode
1112  *
1113  */
1115 
1116 /** \brief Returns the SRC pointer for given DMA channel
1117  * \param dma pointer to DMA module
1118  * \param channelId DMA channel number
1119  * \return SRC pointer for given DMA channel
1120  *
1121  * \code
1122  *
1123  * \endcode
1124  *
1125  */
1126 IFX_INLINE volatile Ifx_SRC_SRCR *IfxDma_getSrcPointer(Ifx_DMA *dma, IfxDma_ChannelId channelId);
1127 
1128 /** \brief Setting of channel interrupt service request by software
1129  * \param dma pointer to DMA module
1130  * \param channelId DMA channel number
1131  * \return None
1132  *
1133  * \code
1134  * // Set the channel interrupt service request through software
1135  * IfxDma_setChannelInterruptServiceRequest(chn[0].dma, chn[0].channelId);
1136  * \endcode
1137  *
1138  */
1140 
1141 /** \} */
1142 
1143 /******************************************************************************/
1144 /*---------------------Inline Function Implementations------------------------*/
1145 /******************************************************************************/
1146 
1148 {
1149  dma->TSR[channelId].B.HLTCLR = 1;
1150 }
1151 
1152 
1154 {
1155  dma->CH[channelId].CHCSR.B.CICH = 1;
1156 }
1157 
1158 
1160 {
1161  dma->TSR[channelId].B.CTL = 1;
1162 }
1163 
1164 
1165 IFX_INLINE void IfxDma_clearErrorFlags(Ifx_DMA *dma, IfxDma_MoveEngine moveEngine, uint32 mask)
1166 {
1167  if (moveEngine == IfxDma_MoveEngine_1)
1168  {
1169  dma->BLK1.CLRE.U = mask;
1170  }
1171  else
1172  {
1173  dma->BLK0.CLRE.U = mask;
1174  }
1175 }
1176 
1177 
1179 {
1180  dma->CH[channelId].ADICR.B.INTCT &= ~(1 << 1); // TODO: should we define a special bitmask for this bit manipulation?
1181 }
1182 
1183 
1185 {
1186  dma->TSR[channelId].B.DCH = 1;
1187 }
1188 
1189 
1191 {
1192  dma->CH[channelId].ADICR.B.ETRL = 0;
1193 }
1194 
1195 
1197 {
1198  if (moveEngine == IfxDma_MoveEngine_1)
1199  {
1200  dma->BLK1.EER.B.EDER = 0;
1201  }
1202  else
1203  {
1204  dma->BLK0.EER.B.EDER = 0;
1205  }
1206 }
1207 
1208 
1210 {
1211  if (moveEngine == IfxDma_MoveEngine_1)
1212  {
1213  dma->BLK1.EER.B.ESER = 0;
1214  }
1215  else
1216  {
1217  dma->BLK0.EER.B.ESER = 0;
1218  }
1219 }
1220 
1221 
1223 {
1224  dma->CH[channelId].ADICR.B.INTCT |= (1 << 1); // TODO: should we define a special bitmask for this bit manipulation?
1225 }
1226 
1227 
1229 {
1230  dma->TSR[channelId].B.ECH = 1;
1231 }
1232 
1233 
1235 {
1236  dma->CH[channelId].ADICR.B.ETRL = 1;
1237 }
1238 
1239 
1241 {
1242  if (moveEngine == IfxDma_MoveEngine_1)
1243  {
1244  dma->BLK1.EER.B.EDER = 1;
1245  }
1246  else
1247  {
1248  dma->BLK0.EER.B.EDER = 1;
1249  }
1250 }
1251 
1252 
1254 {
1255  if (moveEngine == IfxDma_MoveEngine_1)
1256  {
1257  dma->BLK1.EER.B.ESER = 1;
1258  }
1259  else
1260  {
1261  dma->BLK0.EER.B.ESER = 1;
1262  }
1263 }
1264 
1265 
1267 {
1268  boolean result;
1269 
1270  result = dma->CH[channelId].CHCSR.B.ICH != 0;
1271 
1272  if (result == 1)
1273  {
1274  dma->CH[channelId].CHCSR.B.CICH = TRUE;
1275  }
1276 
1277  return result;
1278 }
1279 
1280 
1282 {
1283  boolean result;
1284 
1285  result = dma->CH[channelId].CHCSR.B.IPM != 0;
1286 
1287  if (result == 1)
1288  {
1289  dma->CH[channelId].CHCSR.B.CICH = TRUE;
1290  }
1291 
1292  return result;
1293 }
1294 
1295 
1297 {
1298  boolean result;
1299 
1300  result = dma->CH[channelId].CHCSR.B.WRPD != 0;
1301 
1302  if (result == 1)
1303  {
1304  dma->CH[channelId].CHCSR.B.CWRP = TRUE;
1305  }
1306 
1307  return result;
1308 }
1309 
1310 
1312 {
1313  boolean result;
1314 
1315  result = dma->CH[channelId].CHCSR.B.WRPS != 0;
1316 
1317  if (result == 1)
1318  {
1319  dma->CH[channelId].CHCSR.B.CWRP = TRUE;
1320  }
1321 
1322  return result;
1323 }
1324 
1325 
1327 {
1328  return dma->CH[channelId].DADR.U;
1329 }
1330 
1331 
1332 IFX_INLINE boolean IfxDma_getChannelHalt(Ifx_DMA *dma, IfxDma_ChannelId channelId)
1333 {
1334  return dma->TSR[channelId].B.HLTACK != 0;
1335 }
1336 
1337 
1339 {
1340  boolean result;
1341 
1342  result = dma->CH[channelId].CHCSR.B.ICH;
1343 
1344  return result;
1345 }
1346 
1347 
1349 {
1350  return dma->CH[channelId].CHCSR.B.LXO != 0;
1351 }
1352 
1353 
1355 {
1356  return dma->CH[channelId].SADR.U;
1357 }
1358 
1359 
1361 {
1362  return dma->TSR[channelId].B.TRL != 0;
1363 }
1364 
1365 
1367 {
1368  return dma->CH[channelId].CHCSR.B.TCOUNT;
1369 }
1370 
1371 
1373 {
1374  return (IfxDma_ChannelIncrementCircular)(31 - __clz((uint32)range));
1375 }
1376 
1377 
1379 {
1380  boolean result;
1381 
1382  result = dma->CH[channelId].CHCSR.B.FROZEN != 0;
1383 
1384  if (result == 1)
1385  {
1386  dma->CH[channelId].CHCSR.B.FROZEN = FALSE;
1387  }
1388 
1389  return result;
1390 }
1391 
1392 
1394 {
1395  return dma->CH[channelId].CHCSR.B.BUFFER != 0;
1396 }
1397 
1398 
1400 {
1401  if (moveEngine == IfxDma_MoveEngine_1)
1402  {
1403  return dma->BLK1.ERRSR.U;
1404  }
1405  else
1406  {
1407  return dma->BLK0.ERRSR.U;
1408  }
1409 }
1410 
1411 
1412 IFX_INLINE volatile Ifx_SRC_SRCR *IfxDma_getSrcPointer(Ifx_DMA *dma, IfxDma_ChannelId channelId)
1413 {
1414  // only a single DMA available, therefore no check for the dma pointer required
1415  return &MODULE_SRC.DMA.DMA[0].CH[channelId];
1416 }
1417 
1418 
1420 {
1421  return dma->TIME.U;
1422 }
1423 
1424 
1425 IFX_INLINE boolean IfxDma_isChannelReset(Ifx_DMA *dma, IfxDma_ChannelId channelId)
1426 {
1427  return dma->TSR[channelId].B.RST != 0;
1428 }
1429 
1430 
1432 {
1433  return dma->TSR[channelId].B.HTRE != 0;
1434 }
1435 
1436 
1438 {
1439  return dma->TSR[channelId].B.CH != 0;
1440 }
1441 
1442 
1444 {
1445  dma->CH[channelId].CHCSR.U = 0U << IFX_DMA_CH_CHCSR_FROZEN_OFF;
1446 }
1447 
1448 
1449 IFX_INLINE void IfxDma_resetChannel(Ifx_DMA *dma, IfxDma_ChannelId channelId)
1450 {
1451  dma->TSR[channelId].B.RST = 1;
1452 }
1453 
1454 
1456 {
1457  dma->CH[channelId].CHCFGR.B.BLKM = blockMode;
1458 }
1459 
1460 
1462 {
1463  dma->CH[channelId].CHCFGR.B.CHMODE = 1;
1464 }
1465 
1466 
1467 IFX_INLINE void IfxDma_setChannelDestinationAddress(Ifx_DMA *dma, IfxDma_ChannelId channelId, void *address)
1468 {
1469  dma->CH[channelId].DADR.U = (uint32)address;
1470 }
1471 
1472 
1474 {
1475  Ifx_DMA_CH_ADICR adicr;
1476  adicr.U = dma->CH[channelId].ADICR.U;
1477  adicr.B.DMF = incStep;
1478  adicr.B.INCD = direction;
1479  adicr.B.CBLD = size;
1480  dma->CH[channelId].ADICR.U = adicr.U;
1481 }
1482 
1483 
1485 {
1486  dma->TSR[channelId].B.HLTREQ = 1;
1487 }
1488 
1489 
1491 {
1492  dma->CH[channelId].CHCSR.B.SIT = 1;
1493 }
1494 
1495 
1497 {
1498  dma->CH[channelId].CHCFGR.B.CHDW = moveSize;
1499 }
1500 
1501 
1503 {
1504  dma->CH[channelId].ADICR.B.SHCT = shadow;
1505 }
1506 
1507 
1509 {
1510  dma->CH[channelId].CHCFGR.B.CHMODE = 0;
1511 }
1512 
1513 
1515 {
1516  dma->CH[channelId].CHCFGR.B.RROAT = 1;
1517 }
1518 
1519 
1521 {
1522  dma->CH[channelId].CHCFGR.B.RROAT = 0;
1523 }
1524 
1525 
1526 IFX_INLINE void IfxDma_setChannelSourceAddress(Ifx_DMA *dma, IfxDma_ChannelId channelId, const void *address)
1527 {
1528  dma->CH[channelId].SADR.U = (uint32)address;
1529 }
1530 
1531 
1533 {
1534  Ifx_DMA_CH_ADICR adicr;
1535  adicr.U = dma->CH[channelId].ADICR.U;
1536  adicr.B.SMF = incStep;
1537  adicr.B.INCS = direction;
1538  adicr.B.CBLS = size;
1539  dma->CH[channelId].ADICR.U = adicr.U;
1540 }
1541 
1542 
1543 IFX_INLINE void IfxDma_setChannelTransferCount(Ifx_DMA *dma, IfxDma_ChannelId channelId, uint32 transferCount)
1544 {
1545  dma->CH[channelId].CHCFGR.B.TREL = transferCount;
1546 }
1547 
1548 
1550 {
1552  IfxScuWdt_clearCpuEndinit(passwd);
1553  dma->CLC.B.EDIS = mode;
1554  IfxScuWdt_setCpuEndinit(passwd);
1555 }
1556 
1557 
1559 {
1560  dma->CH[channelId].CHCSR.B.SCH = 1;
1561 }
1562 
1563 
1565 {
1566  dma->CH[channelId].CHCSR.B.SWB = 1;
1567 }
1568 
1569 
1571 {
1572  dma->CH[channelId].ADICR.B.SHCT &= ~(3 << 2);
1573 }
1574 
1575 
1577 {
1578  dma->CH[channelId].ADICR.B.SHCT |= (1 << 2);
1579  dma->CH[channelId].ADICR.B.SHCT &= ~(1 << 3);
1580 }
1581 
1582 
1583 #endif /* IFXDMA_H */