SAMV71 Xplained Ultra Software Package 1.5

qspi_dma.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 /**
00031  * \file
00032  *
00033  * Implementation of SPI driver, transfer data through DMA.
00034  *
00035  */
00036 
00037 #ifndef QSPI_DMA_H
00038 #define QSPI_DMA_H
00039 
00040 /*----------------------------------------------------------------------------
00041  *        Headers
00042  *----------------------------------------------------------------------------*/
00043 
00044 #include "chip.h"
00045 #include "../../../../utils/utility.h"
00046 
00047 /*----------------------------------------------------------------------------
00048  *        Definitions
00049  *----------------------------------------------------------------------------*/
00050 
00051 /** An unspecified error has occurred.*/
00052 #define QSPID_ERROR          1
00053 
00054 /** SPI driver is currently in use.*/
00055 #define QSPID_ERROR_LOCK     2
00056 
00057 #define QSPID_CH_NOT_ENABLED 0xFF
00058 /*----------------------------------------------------------------------------
00059  *        Types
00060  *----------------------------------------------------------------------------*/
00061 
00062 /** SPI transfer complete callback. */
00063 typedef void (*QspidCallback)(uint8_t, void *);
00064 
00065 /** Constant structure associated with SPI port. This structure prevents
00066     client applications to have access in the same time. */
00067 typedef struct _Qspid {
00068     Qspid_t Qspid;
00069     /** Pointer to DMA driver */
00070     sXdmad *pXdmad;
00071     /** Polling  */
00072     uint8_t Polling;
00073     /** Tx ch num  */
00074     uint8_t TxChNum;
00075     /** Rx ch num  */
00076     uint8_t RxChNum;
00077     /** QSPI Xfr state. */
00078     volatile uint8_t progress;
00079 } QspiDma_t;
00080 
00081 #ifdef __cplusplus
00082 extern "C" {
00083 #endif
00084 /*----------------------------------------------------------------------------
00085  *        Exported functions
00086  *----------------------------------------------------------------------------*/
00087 
00088 uint32_t QSPID_Configure(QspiDma_t *pQspidma, QspiMode_t Mode,
00089                           uint32_t dwConfiguration,  sXdmad *pXdmad);
00090 
00091 uint32_t QSPID_EnableQspiRxChannel(QspiDma_t *pQspidma);
00092 
00093 uint32_t QSPID_EnableQspiTxChannel(QspiDma_t *pQspidma);
00094 
00095 uint32_t QSPID_DisableQspiRxChannel(QspiDma_t *pQspidma);
00096 
00097 uint32_t QSPID_DisableQspiTxChannel(QspiDma_t *pQspidma);
00098 
00099 uint32_t QSPID_DisableSpiChannel(QspiDma_t *pQspidma);
00100 
00101 uint32_t QSPID_EnableSpiChannel(QspiDma_t *pQspidma);
00102 
00103 uint32_t QSPID_ReadWriteQSPI(QspiDma_t *pQspidma, Access_t const ReadWrite);
00104 
00105 uint32_t QSPID_ReadWriteSPI(QspiDma_t *pQspidma, Access_t const ReadWrite);
00106 
00107 uint32_t QSPID_IsBusy(volatile uint8_t *QspiSemaphore);
00108 
00109 #ifdef __cplusplus
00110 }
00111 #endif
00112 
00113 #endif /* #ifndef _SPI_DMA_ */
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Defines