SAMV71 Xplained Ultra Software Package 1.5

xdmac.h

Go to the documentation of this file.
00001 /* ---------------------------------------------------------------------------- */
00002 /*                  Atmel Microcontroller Software Support                      */
00003 /*                       SAM Software Package License                           */
00004 /* ---------------------------------------------------------------------------- */
00005 /* Copyright (c) 2015, Atmel Corporation                                        */
00006 /*                                                                              */
00007 /* All rights reserved.                                                         */
00008 /*                                                                              */
00009 /* Redistribution and use in source and binary forms, with or without           */
00010 /* modification, are permitted provided that the following condition is met:    */
00011 /*                                                                              */
00012 /* - Redistributions of source code must retain the above copyright notice,     */
00013 /* this list of conditions and the disclaimer below.                            */
00014 /*                                                                              */
00015 /* Atmel's name may not be used to endorse or promote products derived from     */
00016 /* this software without specific prior written permission.                     */
00017 /*                                                                              */
00018 /* DISCLAIMER:  THIS SOFTWARE IS PROVIDED BY ATMEL "AS IS" AND ANY EXPRESS OR   */
00019 /* IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF */
00020 /* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT ARE   */
00021 /* DISCLAIMED. IN NO EVENT SHALL ATMEL BE LIABLE FOR ANY DIRECT, INDIRECT,      */
00022 /* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT */
00023 /* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA,  */
00024 /* OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF    */
00025 /* LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING         */
00026 /* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, */
00027 /* EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.                           */
00028 /* ---------------------------------------------------------------------------- */
00029 
00030 /** \file */
00031 
00032 /** \addtogroup dmac_module Working with DMAC
00033  *  \ingroup peripherals_module
00034  *
00035  * \section Usage
00036  * <ul>
00037  * <li> Enable or disable the a DMAC controller with DMAC_Enable() and or
00038  * DMAC_Disable().</li>
00039  * <li> Enable or disable %Dma interrupt using DMAC_EnableIt()or
00040  * DMAC_DisableIt().</li>
00041  * <li> Get %Dma interrupt status by DMAC_GetStatus() and
00042  * DMAC_GetInterruptMask().</li>
00043  * <li> Enable or disable specified %Dma channel with DMAC_EnableChannel() or
00044  * DMAC_DisableChannel().</li>
00045  * <li> Get %Dma channel status by DMAC_GetChannelStatus().</li>
00046  * <li> ControlA and ControlB register is set by DMAC_SetControlA() and
00047  * DMAC_SetControlB().</li>
00048  * <li> Configure source and/or destination start address with
00049  * DMAC_SetSourceAddr() and/or DMAC_SetDestinationAddr().</li>
00050  * <li> Set %Dma descriptor address using DMAC_SetDescriptorAddr().</li>
00051  * <li> Set source transfer buffer size with DMAC_SetBufferSize().</li>
00052  * <li> Configure source and/or destination Picture-In-Picuture mode with
00053  * DMAC_SetSourcePip() and/or DMAC_SetDestPip().</li>
00054  * </ul>
00055  *
00056  * For more accurate information, please look at the DMAC section of the
00057  * Datasheet.
00058  *
00059  * \sa \ref dmad_module
00060  *
00061  * Related files :\n
00062  * \ref dmac.c\n
00063  * \ref dmac.h.\n
00064  *
00065  */
00066 
00067 #ifndef DMAC_H
00068 #define DMAC_H
00069 /**@{*/
00070 
00071 /*------------------------------------------------------------------------------
00072  *         Headers
00073  *----------------------------------------------------------------------------*/
00074 
00075 #include "chip.h"
00076 
00077 #include <../../../../utils/utility.h>
00078 #include <stdint.h>
00079 
00080 /*------------------------------------------------------------------------------
00081  *         Definitions
00082  *----------------------------------------------------------------------------*/
00083 
00084 /** \addtogroup dmac_defines DMAC Definitions
00085  *      @{
00086  */
00087 /** Number of DMA channels */
00088 #define XDMAC_CONTROLLER_NUM            1
00089 /** Number of DMA channels */
00090 #define XDMAC_CHANNEL_NUM               24
00091 /** Max DMA single transfer size */
00092 #define XDMAC_MAX_BT_SIZE               0xFFFF
00093 /**     @}*/
00094 
00095 /*----------------------------------------------------------------------------
00096  *         Macro
00097  *----------------------------------------------------------------------------*/
00098 #define XDMA_GET_DATASIZE(size) ((size==0)? XDMAC_CC_DWIDTH_BYTE : \
00099                                  ((size==1)? XDMAC_CC_DWIDTH_HALFWORD : \
00100                                   (XDMAC_CC_DWIDTH_WORD)))
00101 #define XDMA_GET_CC_SAM(s)      ((s==0)? XDMAC_CC_SAM_FIXED_AM : \
00102                                  ((s==1)? XDMAC_CC_SAM_INCREMENTED_AM : \
00103                                   ((s==2)? XDMAC_CC_SAM_UBS_AM : \
00104                                    XDMAC_CC_SAM_UBS_DS_AM)))
00105 #define XDMA_GET_CC_DAM(d)      ((d==0)? XDMAC_CC_DAM_FIXED_AM : \
00106                                  ((d==1)? XDMAC_CC_DAM_INCREMENTED_AM : \
00107                                   ((d==2)? XDMAC_CC_DAM_UBS_AM : \
00108                                    XDMAC_CC_DAM_UBS_DS_AM)))
00109 #define XDMA_GET_CC_MEMSET(m)   ((m==0)? XDMAC_CC_MEMSET_NORMAL_MODE : \
00110                                  XDMAC_CC_MEMSET_HW_MODE)
00111 
00112 /*------------------------------------------------------------------------------
00113  *         Global functions
00114  *----------------------------------------------------------------------------*/
00115 /** \addtogroup dmac_functions
00116  *      @{
00117  */
00118 
00119 #ifdef __cplusplus
00120 extern "C" {
00121 #endif
00122 
00123 extern uint32_t XDMAC_GetType(Xdmac *pXdmac);
00124 extern uint32_t XDMAC_GetConfig(Xdmac *pXdmac);
00125 extern uint32_t XDMAC_GetArbiter(Xdmac *pXdmac);
00126 extern void XDMAC_EnableGIt (Xdmac *pXdmac, uint8_t dwInteruptMask);
00127 extern void XDMAC_DisableGIt (Xdmac *pXdmac, uint8_t dwInteruptMask);
00128 extern uint32_t XDMAC_GetGItMask(Xdmac *pXdmac);
00129 extern uint32_t XDMAC_GetGIsr(Xdmac *pXdmac);
00130 extern uint32_t XDMAC_GetMaskedGIsr(Xdmac *pXdmac);
00131 extern void XDMAC_EnableChannel(Xdmac *pXdmac, uint8_t channel);
00132 extern void XDMAC_EnableChannels(Xdmac *pXdmac, uint32_t bmChannels);
00133 extern void XDMAC_DisableChannel(Xdmac *pXdmac, uint8_t channel);
00134 extern void XDMAC_DisableChannels(Xdmac *pXdmac, uint32_t bmChannels);
00135 extern uint32_t XDMAC_GetGlobalChStatus(Xdmac *pXdmac);
00136 extern void XDMAC_SuspendReadChannel(Xdmac *pXdmac, uint8_t channel);
00137 extern void XDMAC_SuspendWriteChannel(Xdmac *pXdmac, uint8_t channel);
00138 extern void XDMAC_SuspendReadWriteChannel(Xdmac *pXdmac, uint8_t channel);
00139 extern void XDMAC_ResumeReadWriteChannel(Xdmac *pXdmac, uint8_t channel);
00140 extern void XDMAC_SoftwareTransferReq(Xdmac *pXdmac, uint8_t channel);
00141 extern uint32_t XDMAC_GetSoftwareTransferStatus(Xdmac *pXdmac);
00142 extern void XDMAC_SoftwareFlushReq(Xdmac *pXdmac, uint8_t channel);
00143 extern void XDMAC_EnableChannelIt (Xdmac *pXdmac, uint8_t channel,
00144                                    uint8_t dwInteruptMask);
00145 extern void XDMAC_DisableChannelIt (Xdmac *pXdmac, uint8_t channel,
00146                                     uint8_t dwInteruptMask);
00147 extern uint32_t XDMAC_GetChannelItMask (Xdmac *pXdmac, uint8_t channel);
00148 extern uint32_t XDMAC_GetChannelIsr (Xdmac *pXdmac, uint8_t channel);
00149 extern uint32_t XDMAC_GetMaskChannelIsr (Xdmac *pXdmac, uint8_t channel);
00150 extern void XDMAC_SetSourceAddr(Xdmac *pXdmac, uint8_t channel, uint32_t addr);
00151 extern void XDMAC_SetDestinationAddr(Xdmac *pXdmac, uint8_t channel,
00152                                      uint32_t addr);
00153 extern void XDMAC_SetDescriptorAddr(Xdmac *pXdmac, uint8_t channel,
00154                                     uint32_t addr, uint8_t ndaif);
00155 extern void XDMAC_SetDescriptorControl(Xdmac *pXdmac, uint8_t channel,
00156                                        uint8_t config);
00157 extern void XDMAC_SetMicroblockControl(Xdmac *pXdmac, uint8_t channel,
00158                                        uint32_t ublen);
00159 extern void XDMAC_SetBlockControl(Xdmac *pXdmac, uint8_t channel,
00160                                   uint16_t blen);
00161 extern void XDMAC_SetChannelConfig(Xdmac *pXdmac, uint8_t channel,
00162                                    uint32_t config);
00163 extern uint32_t XDMAC_GetChannelConfig(Xdmac *pXdmac, uint8_t channel);
00164 extern void XDMAC_SetDataStride_MemPattern(Xdmac *pXdmac, uint8_t channel,
00165         uint32_t dds_msp);
00166 extern void XDMAC_SetSourceMicroBlockStride(Xdmac *pXdmac, uint8_t channel,
00167         uint32_t subs);
00168 extern void XDMAC_SetDestinationMicroBlockStride(Xdmac *pXdmac, uint8_t channel,
00169         uint32_t dubs);
00170 extern uint32_t XDMAC_GetChDestinationAddr(Xdmac *pXdmac, uint8_t channel);
00171 #ifdef __cplusplus
00172 }
00173 #endif
00174 
00175 /**     @}*/
00176 /**@}*/
00177 #endif //#ifndef DMAC_H
00178 
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Defines