source: rtems/c/src/lib/libbsp/arm/atsam/libraries/libchip/include/xdmac.h @ fd12159

5
Last change on this file since fd12159 was fd12159, checked in by Sebastian Huber <sebastian.huber@…>, on 12/15/16 at 05:12:46

bsp/atsam: Use inline functions for XDMA access

  • Property mode set to 100644
File size: 18.8 KB
Line 
1/* ---------------------------------------------------------------------------- */
2/*                  Atmel Microcontroller Software Support                      */
3/*                       SAM Software Package License                           */
4/* ---------------------------------------------------------------------------- */
5/* Copyright (c) 2015, Atmel Corporation                                        */
6/*                                                                              */
7/* All rights reserved.                                                         */
8/*                                                                              */
9/* Redistribution and use in source and binary forms, with or without           */
10/* modification, are permitted provided that the following condition is met:    */
11/*                                                                              */
12/* - Redistributions of source code must retain the above copyright notice,     */
13/* this list of conditions and the disclaimer below.                            */
14/*                                                                              */
15/* Atmel's name may not be used to endorse or promote products derived from     */
16/* this software without specific prior written permission.                     */
17/*                                                                              */
18/* DISCLAIMER:  THIS SOFTWARE IS PROVIDED BY ATMEL "AS IS" AND ANY EXPRESS OR   */
19/* IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF */
20/* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT ARE   */
21/* DISCLAIMED. IN NO EVENT SHALL ATMEL BE LIABLE FOR ANY DIRECT, INDIRECT,      */
22/* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT */
23/* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA,  */
24/* OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF    */
25/* LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING         */
26/* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, */
27/* EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.                           */
28/* ---------------------------------------------------------------------------- */
29
30/** \file */
31
32/** \addtogroup dmac_module Working with DMAC
33 *  \ingroup peripherals_module
34 *
35 * \section Usage
36 * <ul>
37 * <li> Enable or disable the a DMAC controller with DMAC_Enable() and or
38 * DMAC_Disable().</li>
39 * <li> Enable or disable %Dma interrupt using DMAC_EnableIt()or
40 * DMAC_DisableIt().</li>
41 * <li> Get %Dma interrupt status by DMAC_GetStatus() and
42 * DMAC_GetInterruptMask().</li>
43 * <li> Enable or disable specified %Dma channel with DMAC_EnableChannel() or
44 * DMAC_DisableChannel().</li>
45 * <li> Get %Dma channel status by DMAC_GetChannelStatus().</li>
46 * <li> ControlA and ControlB register is set by DMAC_SetControlA() and
47 * DMAC_SetControlB().</li>
48 * <li> Configure source and/or destination start address with
49 * DMAC_SetSourceAddr() and/or DMAC_SetDestinationAddr().</li>
50 * <li> Set %Dma descriptor address using DMAC_SetDescriptorAddr().</li>
51 * <li> Set source transfer buffer size with DMAC_SetBufferSize().</li>
52 * <li> Configure source and/or destination Picture-In-Picuture mode with
53 * DMAC_SetSourcePip() and/or DMAC_SetDestPip().</li>
54 * </ul>
55 *
56 * For more accurate information, please look at the DMAC section of the
57 * Datasheet.
58 *
59 * \sa \ref dmad_module
60 *
61 * Related files :\n
62 * \ref dmac.c\n
63 * \ref dmac.h.\n
64 *
65 */
66
67#ifndef DMAC_H
68#define DMAC_H
69/**@{*/
70
71/*------------------------------------------------------------------------------
72 *         Headers
73 *----------------------------------------------------------------------------*/
74
75#include "chip.h"
76
77#ifndef __rtems__
78#include <../../../../utils/utility.h>
79#endif /* __rtems__ */
80#include <stdint.h>
81#include <assert.h>
82
83/*------------------------------------------------------------------------------
84 *         Definitions
85 *----------------------------------------------------------------------------*/
86
87/** \addtogroup dmac_defines DMAC Definitions
88 *      @{
89 */
90/** Number of DMA channels */
91#define XDMAC_CONTROLLER_NUM            1
92/** Number of DMA channels */
93#define XDMAC_CHANNEL_NUM               24
94/** Max DMA single transfer size */
95#define XDMAC_MAX_BT_SIZE               0xFFFF
96/**     @}*/
97
98/*----------------------------------------------------------------------------
99 *         Macro
100 *----------------------------------------------------------------------------*/
101#define XDMA_GET_DATASIZE(size) ((size==0)? XDMAC_CC_DWIDTH_BYTE : \
102                                                                 ((size==1)? XDMAC_CC_DWIDTH_HALFWORD : \
103                                                                  (XDMAC_CC_DWIDTH_WORD)))
104#define XDMA_GET_CC_SAM(s)      ((s==0)? XDMAC_CC_SAM_FIXED_AM : \
105                                                                 ((s==1)? XDMAC_CC_SAM_INCREMENTED_AM : \
106                                                                  ((s==2)? XDMAC_CC_SAM_UBS_AM : \
107                                                                   XDMAC_CC_SAM_UBS_DS_AM)))
108#define XDMA_GET_CC_DAM(d)      ((d==0)? XDMAC_CC_DAM_FIXED_AM : \
109                                                                 ((d==1)? XDMAC_CC_DAM_INCREMENTED_AM : \
110                                                                  ((d==2)? XDMAC_CC_DAM_UBS_AM : \
111                                                                   XDMAC_CC_DAM_UBS_DS_AM)))
112#define XDMA_GET_CC_MEMSET(m)   ((m==0)? XDMAC_CC_MEMSET_NORMAL_MODE : \
113                                                                 XDMAC_CC_MEMSET_HW_MODE)
114
115/*------------------------------------------------------------------------------
116 *         Global functions
117 *----------------------------------------------------------------------------*/
118/** \addtogroup dmac_functions
119 *      @{
120 */
121
122#ifdef __cplusplus
123extern "C" {
124#endif
125
126/**
127 * \brief Get XDMAC global type.
128 *
129 * \param pXdmac Pointer to the XDMAC peripheral.
130 */
131static inline uint32_t XDMAC_GetType(Xdmac *pXdmac)
132{
133        assert(pXdmac);
134        return pXdmac->XDMAC_GTYPE;
135}
136
137/**
138 * \brief Get XDMAC global configuration.
139 *
140 * \param pXdmac Pointer to the XDMAC peripheral.
141 */
142static inline uint32_t XDMAC_GetConfig(Xdmac *pXdmac)
143{
144        assert(pXdmac);
145        return pXdmac->XDMAC_GCFG;
146}
147
148/**
149 * \brief Get XDMAC global weighted arbiter configuration.
150 *
151 * \param pXdmac Pointer to the XDMAC peripheral.
152 */
153static inline uint32_t XDMAC_GetArbiter(Xdmac *pXdmac)
154{
155        assert(pXdmac);
156        return pXdmac->XDMAC_GWAC;
157}
158
159/**
160 * \brief Enables XDMAC global interrupt.
161 *
162 * \param pXdmac Pointer to the XDMAC peripheral.
163 * \param dwInteruptMask IT to be enabled.
164 */
165static inline void XDMAC_EnableGIt (Xdmac *pXdmac, uint8_t dwInteruptMask)
166{
167        assert(pXdmac);
168        pXdmac->XDMAC_GIE = (XDMAC_GIE_IE0 << dwInteruptMask);
169}
170
171/**
172 * \brief Disables XDMAC global interrupt
173 *
174 * \param pXdmac Pointer to the XDMAC peripheral.
175 * \param dwInteruptMask IT to be enabled
176 */
177static inline void XDMAC_DisableGIt (Xdmac *pXdmac, uint8_t dwInteruptMask)
178{
179        assert(pXdmac);
180        pXdmac->XDMAC_GID = (XDMAC_GID_ID0 << dwInteruptMask);
181}
182
183/**
184 * \brief Get XDMAC global interrupt mask.
185 *
186 * \param pXdmac Pointer to the XDMAC peripheral.
187 */
188static inline uint32_t XDMAC_GetGItMask(Xdmac *pXdmac)
189{
190        assert(pXdmac);
191        return (pXdmac->XDMAC_GIM);
192}
193
194/**
195 * \brief Get XDMAC global interrupt status.
196 *
197 * \param pXdmac Pointer to the XDMAC peripheral.
198 */
199static inline uint32_t XDMAC_GetGIsr(Xdmac *pXdmac)
200{
201        assert(pXdmac);
202        return (pXdmac->XDMAC_GIS);
203}
204
205/**
206 * \brief Get XDMAC masked global interrupt.
207 *
208 * \param pXdmac Pointer to the XDMAC peripheral.
209 */
210static inline uint32_t XDMAC_GetMaskedGIsr(Xdmac *pXdmac)
211{
212        uint32_t _dwStatus;
213        assert(pXdmac);
214        _dwStatus = pXdmac->XDMAC_GIS;
215        _dwStatus &= pXdmac->XDMAC_GIM;
216        return _dwStatus;
217}
218
219/**
220 * \brief enables the relevant channel of given XDMAC.
221 *
222 * \param pXdmac Pointer to the XDMAC peripheral.
223 * \param channel Particular channel number.
224 */
225static inline void XDMAC_EnableChannel(Xdmac *pXdmac, uint8_t channel)
226{
227        assert(pXdmac);
228        assert(channel < XDMAC_CHANNEL_NUM);
229        pXdmac->XDMAC_GE = (XDMAC_GE_EN0 << channel);
230}
231
232/**
233 * \brief enables the relevant channels of given XDMAC.
234 *
235 * \param pXdmac Pointer to the XDMAC peripheral.
236 * \param bmChannels Channels bitmap.
237 */
238static inline void XDMAC_EnableChannels(Xdmac *pXdmac, uint32_t bmChannels)
239{
240        assert(pXdmac);
241        pXdmac->XDMAC_GE = bmChannels;
242}
243
244/**
245 * \brief Disables the relevant channel of given XDMAC.
246 *
247 * \param pXdmac Pointer to the XDMAC peripheral.
248 * \param channel Particular channel number.
249 */
250static inline void XDMAC_DisableChannel(Xdmac *pXdmac, uint8_t channel)
251{
252        assert(pXdmac);
253        assert(channel < XDMAC_CHANNEL_NUM);
254        pXdmac->XDMAC_GD = (XDMAC_GD_DI0 << channel);
255}
256
257/**
258 * \brief Disables the relevant channels of given XDMAC.
259 *
260 * \param pXdmac Pointer to the XDMAC peripheral.
261 * \param bmChannels Channels bitmap.
262 */
263static inline void XDMAC_DisableChannels(Xdmac *pXdmac, uint32_t bmChannels)
264{
265        assert(pXdmac);
266        pXdmac->XDMAC_GD = bmChannels;
267}
268
269
270/**
271 * \brief Get Global channel status of given XDMAC.
272 * \note: When set to 1, this bit indicates that the channel x is enabled.
273   If a channel disable request is issued, this bit remains asserted
274   until pending transaction is completed.
275 * \param pXdmac Pointer to the XDMAC peripheral.
276 */
277static inline uint32_t XDMAC_GetGlobalChStatus(Xdmac *pXdmac)
278{
279        assert(pXdmac);
280        return pXdmac->XDMAC_GS;
281}
282
283/**
284 * \brief Suspend the relevant channel's read.
285 *
286 * \param pXdmac Pointer to the XDMAC peripheral.
287 * \param channel Particular channel number.
288 */
289static inline void XDMAC_SuspendReadChannel(Xdmac *pXdmac, uint8_t channel)
290{
291        assert(pXdmac);
292        assert(channel < XDMAC_CHANNEL_NUM);
293        pXdmac->XDMAC_GRS |= XDMAC_GRS_RS0 << channel;
294}
295
296/**
297 * \brief Suspend the relevant channel's write.
298 *
299 * \param pXdmac Pointer to the XDMAC peripheral.
300 * \param channel Particular channel number.
301 */
302static inline void XDMAC_SuspendWriteChannel(Xdmac *pXdmac, uint8_t channel)
303{
304        assert(pXdmac);
305        assert(channel < XDMAC_CHANNEL_NUM);
306        pXdmac->XDMAC_GWS |= XDMAC_GWS_WS0 << channel;
307}
308
309/**
310 * \brief Suspend the relevant channel's read & write.
311 *
312 * \param pXdmac Pointer to the XDMAC peripheral.
313 * \param channel Particular channel number.
314 */
315static inline void XDMAC_SuspendReadWriteChannel(Xdmac *pXdmac, uint8_t channel)
316{
317        assert(pXdmac);
318        assert(channel < XDMAC_CHANNEL_NUM);
319        pXdmac->XDMAC_GRWS = (XDMAC_GRWS_RWS0 << channel);
320}
321
322/**
323 * \brief Resume the relevant channel's read & write.
324 *
325 * \param pXdmac Pointer to the XDMAC peripheral.
326 * \param channel Particular channel number.
327 */
328static inline void XDMAC_ResumeReadWriteChannel(Xdmac *pXdmac, uint8_t channel)
329{
330        assert(pXdmac);
331        assert(channel < XDMAC_CHANNEL_NUM);
332        pXdmac->XDMAC_GRWR = (XDMAC_GRWR_RWR0 << channel);
333}
334
335/**
336 * \brief Set software transfer request on the relevant channel.
337 *
338 * \param pXdmac Pointer to the XDMAC peripheral.
339 * \param channel Particular channel number.
340 */
341static inline void XDMAC_SoftwareTransferReq(Xdmac *pXdmac, uint8_t channel)
342{
343
344        assert(pXdmac);
345        assert(channel < XDMAC_CHANNEL_NUM);
346        pXdmac->XDMAC_GSWR = (XDMAC_GSWR_SWREQ0 << channel);
347}
348
349/**
350 * \brief Get software transfer status of the relevant channel.
351 *
352 * \param pXdmac Pointer to the XDMAC peripheral.
353 */
354static inline uint32_t XDMAC_GetSoftwareTransferStatus(Xdmac *pXdmac)
355{
356
357        assert(pXdmac);
358        return pXdmac->XDMAC_GSWS;
359}
360
361/**
362 * \brief Get interrupt status for the relevant channel of given XDMA.
363 *
364 * \param pXdmac Pointer to the XDMAC peripheral.
365 * \param channel Particular channel number.
366 */
367static inline uint32_t XDMAC_GetChannelIsr (Xdmac *pXdmac, uint8_t channel)
368{
369        assert(pXdmac);
370        assert(channel < XDMAC_CHANNEL_NUM);
371        return pXdmac->XDMAC_CHID[channel].XDMAC_CIS;
372}
373
374/**
375 * \brief Set software flush request on the relevant channel.
376 * \note: This API is used as polling without enabling FIE interrupt.
377 * The user can use it in interrupt mode after deleting while sentense.
378 * \param pXdmac Pointer to the XDMAC peripheral.
379 * \param channel Particular channel number.
380 */
381static inline void XDMAC_SoftwareFlushReq(Xdmac *pXdmac, uint8_t channel)
382{
383        assert(pXdmac);
384        assert(channel < XDMAC_CHANNEL_NUM);
385        pXdmac->XDMAC_GSWF = (XDMAC_GSWF_SWF0 << channel);
386
387        while (!(XDMAC_GetChannelIsr(pXdmac, channel) & XDMAC_CIS_FIS));
388}
389
390/**
391 * \brief Disable interrupt with mask on the relevant channel of given XDMA.
392 *
393 * \param pXdmac Pointer to the XDMAC peripheral.
394 * \param channel Particular channel number.
395 * \param dwInteruptMask Interrupt mask.
396 */
397static inline void XDMAC_EnableChannelIt (Xdmac *pXdmac, uint8_t channel,
398                                                        uint8_t dwInteruptMask)
399{
400        assert(pXdmac);
401        assert(channel < XDMAC_CHANNEL_NUM);
402        pXdmac->XDMAC_CHID[channel].XDMAC_CIE = dwInteruptMask;
403}
404
405/**
406 * \brief Enable interrupt with mask on the relevant channel of given XDMA.
407 *
408 * \param pXdmac Pointer to the XDMAC peripheral.
409 * \param channel Particular channel number.
410 * \param dwInteruptMask Interrupt mask.
411 */
412static inline void XDMAC_DisableChannelIt (Xdmac *pXdmac, uint8_t channel,
413                                                         uint8_t dwInteruptMask)
414{
415        assert(pXdmac);
416        assert(channel < XDMAC_CHANNEL_NUM);
417        pXdmac->XDMAC_CHID[channel].XDMAC_CID = dwInteruptMask;
418}
419
420/**
421 * \brief Get interrupt mask for the relevant channel of given XDMA.
422 *
423 * \param pXdmac Pointer to the XDMAC peripheral.
424 * \param channel Particular channel number.
425 */
426static inline uint32_t XDMAC_GetChannelItMask (Xdmac *pXdmac, uint8_t channel)
427{
428        assert(pXdmac);
429        assert(channel < XDMAC_CHANNEL_NUM);
430        return pXdmac->XDMAC_CHID[channel].XDMAC_CIM;
431}
432
433/**
434 * \brief Get masked interrupt status for the relevant channel of given XDMA.
435 *
436 * \param pXdmac Pointer to the XDMAC peripheral.
437 * \param channel Particular channel number.
438 */
439static inline uint32_t XDMAC_GetMaskChannelIsr (Xdmac *pXdmac, uint8_t channel)
440{
441        uint32_t status;
442        assert(pXdmac);
443        assert(channel < XDMAC_CHANNEL_NUM);
444        status = pXdmac->XDMAC_CHID[channel].XDMAC_CIS;
445        status &= pXdmac->XDMAC_CHID[channel].XDMAC_CIM;
446
447        return status;
448}
449
450/**
451 * \brief Set source address for the relevant channel of given XDMA.
452 *
453 * \param pXdmac Pointer to the XDMAC peripheral.
454 * \param channel Particular channel number.
455 * \param addr Source address.
456 */
457static inline void XDMAC_SetSourceAddr(Xdmac *pXdmac, uint8_t channel, uint32_t addr)
458{
459        assert(pXdmac);
460        assert(channel < XDMAC_CHANNEL_NUM);
461        pXdmac->XDMAC_CHID[channel].XDMAC_CSA = addr;
462}
463
464/**
465 * \brief Set destination address for the relevant channel of given XDMA.
466 *
467 * \param pXdmac Pointer to the XDMAC peripheral.
468 * \param channel Particular channel number.
469 * \param addr Destination address.
470 */
471static inline void XDMAC_SetDestinationAddr(Xdmac *pXdmac, uint8_t channel, uint32_t addr)
472{
473        assert(pXdmac);
474        assert(channel < XDMAC_CHANNEL_NUM);
475        pXdmac->XDMAC_CHID[channel].XDMAC_CDA = addr;
476}
477
478/**
479 * \brief Set next descriptor's address & interface for the relevant channel of
480 *  given XDMA.
481 *
482 * \param pXdmac Pointer to the XDMAC peripheral.
483 * \param channel Particular channel number.
484 * \param addr Address of next descriptor.
485 * \param ndaif Interface of next descriptor.
486 */
487static inline void XDMAC_SetDescriptorAddr(Xdmac *pXdmac, uint8_t channel,
488                                                         uint32_t addr, uint8_t ndaif)
489{
490        assert(pXdmac);
491        assert(ndaif < 2);
492        assert(channel < XDMAC_CHANNEL_NUM);
493        pXdmac->XDMAC_CHID[channel].XDMAC_CNDA =  (addr & 0xFFFFFFFC) | ndaif;
494}
495
496/**
497 * \brief Set next descriptor's configuration for the relevant channel of
498 *  given XDMA.
499 *
500 * \param pXdmac Pointer to the XDMAC peripheral.
501 * \param channel Particular channel number.
502 * \param config Configuration of next descriptor.
503 */
504static inline void XDMAC_SetDescriptorControl(Xdmac *pXdmac, uint8_t channel, uint8_t config)
505{
506        assert(pXdmac);
507        assert(channel < XDMAC_CHANNEL_NUM);
508        pXdmac->XDMAC_CHID[channel].XDMAC_CNDC = config;
509}
510
511/**
512 * \brief Set microblock length for the relevant channel of given XDMA.
513 *
514 * \param pXdmac Pointer to the XDMAC peripheral.
515 * \param channel Particular channel number.
516 * \param ublen Microblock length.
517 */
518static inline void XDMAC_SetMicroblockControl(Xdmac *pXdmac, uint8_t channel, uint32_t ublen)
519{
520        assert(pXdmac);
521        assert(channel < XDMAC_CHANNEL_NUM);
522        pXdmac->XDMAC_CHID[channel].XDMAC_CUBC = XDMAC_CUBC_UBLEN(ublen);
523}
524
525/**
526 * \brief Set block length for the relevant channel of given XDMA.
527 *
528 * \param pXdmac Pointer to the XDMAC peripheral.
529 * \param channel Particular channel number.
530 * \param blen Block length.
531 */
532static inline void XDMAC_SetBlockControl(Xdmac *pXdmac, uint8_t channel, uint16_t blen)
533{
534        assert(pXdmac);
535        assert(channel < XDMAC_CHANNEL_NUM);
536        pXdmac->XDMAC_CHID[channel].XDMAC_CBC = XDMAC_CBC_BLEN(blen);
537}
538
539/**
540 * \brief Set configuration for the relevant channel of given XDMA.
541 *
542 * \param pXdmac Pointer to the XDMAC peripheral.
543 * \param channel Particular channel number.
544 * \param config Channel configuration.
545 */
546static inline void XDMAC_SetChannelConfig(Xdmac *pXdmac, uint8_t channel, uint32_t config)
547{
548        assert(pXdmac);
549        assert(channel < XDMAC_CHANNEL_NUM);
550        pXdmac->XDMAC_CHID[channel].XDMAC_CC = config;
551}
552
553/**
554 * \brief Get the relevant channel's configuration of given XDMA.
555 *
556 * \param pXdmac Pointer to the XDMAC peripheral.
557 * \param channel Particular channel number.
558 */
559static inline uint32_t XDMAC_GetChannelConfig(Xdmac *pXdmac, uint8_t channel)
560{
561        assert(pXdmac);
562        assert(channel < XDMAC_CHANNEL_NUM);
563        return pXdmac->XDMAC_CHID[channel].XDMAC_CC;
564}
565
566/**
567 * \brief Set the relevant channel's data stride memory pattern of given XDMA.
568 *
569 * \param pXdmac Pointer to the XDMAC peripheral.
570 * \param channel Particular channel number.
571 * \param dds_msp Data stride memory pattern.
572 */
573static inline void XDMAC_SetDataStride_MemPattern(Xdmac *pXdmac, uint8_t channel,
574                                                                        uint32_t dds_msp)
575{
576
577        assert(pXdmac);
578        assert(channel < XDMAC_CHANNEL_NUM);
579        pXdmac->XDMAC_CHID[channel].XDMAC_CDS_MSP = dds_msp;
580}
581
582/**
583 * \brief Set the relevant channel's source microblock stride of given XDMA.
584 *
585 * \param pXdmac Pointer to the XDMAC peripheral.
586 * \param channel Particular channel number.
587 * \param subs Source microblock stride.
588 */
589static inline void XDMAC_SetSourceMicroBlockStride(Xdmac *pXdmac, uint8_t channel,
590                                                                         uint32_t subs)
591{
592        assert(pXdmac);
593        assert(channel < XDMAC_CHANNEL_NUM);
594        pXdmac->XDMAC_CHID[channel].XDMAC_CSUS = XDMAC_CSUS_SUBS(subs);
595}
596
597/**
598 * \brief Set the relevant channel's destination microblock stride of given XDMA.
599 *
600 * \param pXdmac Pointer to the XDMAC peripheral.
601 * \param channel Particular channel number.
602 * \param dubs Destination microblock stride.
603 */
604static inline void XDMAC_SetDestinationMicroBlockStride(Xdmac *pXdmac, uint8_t channel,
605                uint32_t dubs)
606{
607        assert(pXdmac);
608        assert(channel < XDMAC_CHANNEL_NUM);
609        pXdmac->XDMAC_CHID[channel].XDMAC_CDUS = XDMAC_CDUS_DUBS(dubs);
610}
611
612/**
613 * \brief Get the relevant channel's destination address of given XDMA.
614 *
615 * \param pXdmac Pointer to the XDMAC peripheral.
616 * \param channel Particular channel number.
617 */
618static inline uint32_t XDMAC_GetChDestinationAddr(Xdmac *pXdmac, uint8_t channel)
619{
620        assert(pXdmac);
621        assert(channel < XDMAC_CHANNEL_NUM);
622        return pXdmac->XDMAC_CHID[channel].XDMAC_CDA;
623}
624
625static inline void XDMAC_StartTransfer(Xdmac *pXdmac, uint8_t channel)
626{
627        assert(pXdmac);
628        assert(channel < XDMAC_CHANNEL_NUM);
629        pXdmac->XDMAC_GE = (XDMAC_GE_EN0 << channel);
630        pXdmac->XDMAC_GIE = (XDMAC_GIE_IE0 << channel);
631}
632
633#ifdef __cplusplus
634}
635#endif
636
637/**     @}*/
638/**@}*/
639#endif //#ifndef DMAC_H
640
Note: See TracBrowser for help on using the repository browser.