SAMV71 Xplained Ultra Software Package 1.4

xdmac.h

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