1 /* ----------------------------------------------------------------------------
\r
2 * SAM Software Package License
\r
3 * ----------------------------------------------------------------------------
\r
4 * Copyright (c) 2014, Atmel Corporation
\r
6 * All rights reserved.
\r
8 * Redistribution and use in source and binary forms, with or without
\r
9 * modification, are permitted provided that the following conditions are met:
\r
11 * - Redistributions of source code must retain the above copyright notice,
\r
12 * this list of conditions and the disclaimer below.
\r
14 * Atmel's name may not be used to endorse or promote products derived from
\r
15 * this software without specific prior written permission.
\r
17 * DISCLAIMER: THIS SOFTWARE IS PROVIDED BY ATMEL "AS IS" AND ANY EXPRESS OR
\r
18 * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
\r
19 * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT ARE
\r
20 * DISCLAIMED. IN NO EVENT SHALL ATMEL BE LIABLE FOR ANY DIRECT, INDIRECT,
\r
21 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
\r
22 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA,
\r
23 * OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
\r
24 * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
\r
25 * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
\r
26 * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
\r
27 * ----------------------------------------------------------------------------
\r
35 * Interface for configuration the Analog-to-Digital Converter (AFEC) peripheral.
\r
39 * -# Configurate the pins for AFEC.
\r
40 * -# Initialize the AFEC with AFEC_Initialize().
\r
41 * -# Set AFEC clock and timing with AFEC_SetClock() and AFEC_SetTiming().
\r
42 * -# Select the active channel using AFEC_EnableChannel().
\r
43 * -# Start the conversion with AFEC_StartConversion().
\r
44 * -# Wait the end of the conversion by polling status with AFEC_GetStatus().
\r
45 * -# Finally, get the converted data using AFEC_GetConvertedData() or AFEC_GetLastConvertedData().
\r
51 /*----------------------------------------------------------------------------
\r
53 *----------------------------------------------------------------------------*/
\r
58 /*----------------------------------------------------------------------------
\r
60 *----------------------------------------------------------------------------*/
\r
62 /** AFE transfer complete callback. */
\r
63 typedef void (*AfeCallback)( uint8_t, void* ) ;
\r
65 /** \brief Spi Transfer Request prepared by the application upper layer.
\r
67 * This structure is sent to the AFE_SendCommand function to start the transfer.
\r
68 * At the end of the transfer, the callback is invoked by the interrupt handler.
\r
72 /** Pointer to the Rx data. */
\r
74 /** Rx size in bytes. */
\r
76 /** Callback function invoked at the end of transfer. */
\r
77 AfeCallback callback;
\r
78 /** Callback arguments. */
\r
83 /** Constant structure associated with AFE port. This structure prevents
\r
84 client applications to have access in the same time. */
\r
87 /** Pointer to AFE Hardware registers */
\r
89 /** Current SpiCommand being processed */
\r
90 AfeCmd *pCurrentCommand ;
\r
91 /** Pointer to DMA driver */
\r
93 /** AFEC Id as defined in the product datasheet */
\r
95 /** Mutual exclusion semaphore. */
\r
96 volatile int8_t semaphore ;
\r
100 /*------------------------------------------------------------------------------
\r
102 *------------------------------------------------------------------------------*/
\r
104 #define AFE_ERROR 1
\r
105 #define AFE_ERROR_LOCK 2
\r
106 /*------------------------------------------------------------------------------
\r
107 * Exported functions
\r
108 *------------------------------------------------------------------------------*/
\r
109 extern uint32_t Afe_ConfigureDma( AfeDma *pAfed ,
\r
113 extern uint32_t Afe_SendData( AfeDma *pAfed, AfeCmd *pCommand);
\r
116 #endif /* #ifndef _AFE_DMA_ */
\r