SAMV71 Xplained Ultra Software Package 1.4

qspi_dma.h

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