]> git.sur5r.net Git - freertos/blobdiff - FreeRTOS/Demo/CORTEX_M7_SAMV71_Xplained/libchip_samv7/include/afe_dma.h
Kernel changes:
[freertos] / FreeRTOS / Demo / CORTEX_M7_SAMV71_Xplained / libchip_samv7 / include / afe_dma.h
diff --git a/FreeRTOS/Demo/CORTEX_M7_SAMV71_Xplained/libchip_samv7/include/afe_dma.h b/FreeRTOS/Demo/CORTEX_M7_SAMV71_Xplained/libchip_samv7/include/afe_dma.h
new file mode 100644 (file)
index 0000000..5911993
--- /dev/null
@@ -0,0 +1,117 @@
+/* ----------------------------------------------------------------------------\r
+ *         SAM Software Package License\r
+ * ----------------------------------------------------------------------------\r
+ * Copyright (c) 2014, Atmel Corporation\r
+ *\r
+ * All rights reserved.\r
+ *\r
+ * Redistribution and use in source and binary forms, with or without\r
+ * modification, are permitted provided that the following conditions are met:\r
+ *\r
+ * - Redistributions of source code must retain the above copyright notice,\r
+ * this list of conditions and the disclaimer below.\r
+ *\r
+ * Atmel's name may not be used to endorse or promote products derived from\r
+ * this software without specific prior written permission.\r
+ *\r
+ * DISCLAIMER: THIS SOFTWARE IS PROVIDED BY ATMEL "AS IS" AND ANY EXPRESS OR\r
+ * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF\r
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT ARE\r
+ * DISCLAIMED. IN NO EVENT SHALL ATMEL BE LIABLE FOR ANY DIRECT, INDIRECT,\r
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT\r
+ * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA,\r
+ * OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF\r
+ * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING\r
+ * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,\r
+ * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.\r
+ * ----------------------------------------------------------------------------\r
+ */\r
+\r
+/**\r
+ *  \file\r
+ *\r
+ *  \section Purpose\r
+ *\r
+ *  Interface for configuration the Analog-to-Digital Converter (AFEC) peripheral.\r
+ *\r
+ *  \section Usage\r
+ *\r
+ *  -# Configurate the pins for AFEC.\r
+ *  -# Initialize the AFEC with AFEC_Initialize().\r
+ *  -# Set AFEC clock and timing with AFEC_SetClock() and AFEC_SetTiming().\r
+ *  -# Select the active channel using AFEC_EnableChannel().\r
+ *  -# Start the conversion with AFEC_StartConversion().\r
+ *  -# Wait the end of the conversion by polling status with AFEC_GetStatus().\r
+ *  -# Finally, get the converted data using AFEC_GetConvertedData() or AFEC_GetLastConvertedData().\r
+ *\r
+*/\r
+#ifndef _AFE_DMA_\r
+#define _AFE_DMA_\r
+\r
+/*----------------------------------------------------------------------------\r
+ *        Headers\r
+ *----------------------------------------------------------------------------*/\r
+\r
+#include "chip.h"\r
+\r
+\r
+/*----------------------------------------------------------------------------\r
+ *        Types\r
+ *----------------------------------------------------------------------------*/\r
+\r
+/** AFE transfer complete callback. */\r
+typedef void (*AfeCallback)( uint8_t, void* ) ;\r
+\r
+/** \brief Spi Transfer Request prepared by the application upper layer.\r
+ *\r
+ * This structure is sent to the AFE_SendCommand function to start the transfer.\r
+ * At the end of the transfer, the callback is invoked by the interrupt handler.\r
+ */\r
+typedef struct\r
+{\r
+    /** Pointer to the Rx data. */\r
+    uint32_t *pRxBuff;\r
+    /** Rx size in bytes. */\r
+    uint16_t RxSize;\r
+    /** Callback function invoked at the end of transfer. */\r
+    AfeCallback callback;\r
+    /** Callback arguments. */\r
+    void *pArgument;\r
+} AfeCmd ;\r
+\r
+\r
+/** Constant structure associated with AFE port. This structure prevents\r
+    client applications to have access in the same time. */\r
+typedef struct \r
+{\r
+    /** Pointer to AFE Hardware registers */\r
+    Afec* pAfeHw ;\r
+    /** Current SpiCommand being processed */\r
+    AfeCmd *pCurrentCommand ;\r
+    /** Pointer to DMA driver */\r
+    sXdmad* pXdmad;\r
+    /** AFEC Id as defined in the product datasheet */\r
+    uint8_t afeId ;\r
+    /** Mutual exclusion semaphore. */\r
+    volatile int8_t semaphore ;\r
+} AfeDma;\r
+\r
+\r
+/*------------------------------------------------------------------------------\r
+ *         Definitions\r
+ *------------------------------------------------------------------------------*/\r
+#define AFE_OK          0\r
+#define AFE_ERROR       1\r
+#define AFE_ERROR_LOCK  2\r
+/*------------------------------------------------------------------------------\r
+ *         Exported functions\r
+ *------------------------------------------------------------------------------*/\r
+extern uint32_t Afe_ConfigureDma( AfeDma *pAfed ,\r
+                           Afec *pAfeHw ,\r
+                           uint8_t AfeId,\r
+                           sXdmad *pXdmad );\r
+extern uint32_t Afe_SendData( AfeDma *pAfed, AfeCmd *pCommand);\r
+\r
+\r
+#endif /* #ifndef _AFE_DMA_ */\r
+\r