aboutsummaryrefslogtreecommitdiffstats
path: root/os/io/platforms/STM32/spi_lld.h
diff options
context:
space:
mode:
authorgdisirio <gdisirio@35acf78f-673a-0410-8e92-d51de3d6d3f4>2009-10-24 10:09:28 +0000
committergdisirio <gdisirio@35acf78f-673a-0410-8e92-d51de3d6d3f4>2009-10-24 10:09:28 +0000
commitfb68f0d51775b7e0bafa82fa67573e652babb6a6 (patch)
tree98788291c76294f69bc497d890e82d56fde226bf /os/io/platforms/STM32/spi_lld.h
parent09194e6f2232390b16ed37c65cf750bd47bc4bf4 (diff)
downloadChibiOS-fb68f0d51775b7e0bafa82fa67573e652babb6a6.tar.gz
ChibiOS-fb68f0d51775b7e0bafa82fa67573e652babb6a6.tar.bz2
ChibiOS-fb68f0d51775b7e0bafa82fa67573e652babb6a6.zip
git-svn-id: svn://svn.code.sf.net/p/chibios/svn/trunk@1251 35acf78f-673a-0410-8e92-d51de3d6d3f4
Diffstat (limited to 'os/io/platforms/STM32/spi_lld.h')
-rw-r--r--os/io/platforms/STM32/spi_lld.h44
1 files changed, 35 insertions, 9 deletions
diff --git a/os/io/platforms/STM32/spi_lld.h b/os/io/platforms/STM32/spi_lld.h
index 26a70d0a4..23193bc0d 100644
--- a/os/io/platforms/STM32/spi_lld.h
+++ b/os/io/platforms/STM32/spi_lld.h
@@ -27,19 +27,32 @@
#ifndef _SPI_LLD_H_
#define _SPI_LLD_H_
+#undef FALSE
+#undef TRUE
+#include <stm32f10x.h>
+#define FALSE 0
+#define TRUE (!FALSE)
+
/*===========================================================================*/
/* Driver pre-compile time settings. */
/*===========================================================================*/
/**
- * @brief Enables the mutual exclusion APIs on the SPI bus.
+ * @brief SPI1 driver enable switch.
+ * @details If set to @p TRUE the support for SPI is included.
+ * @note The default is @p TRUE.
*/
-#if !defined(SPI_USE_MUTUAL_EXCLUSION) || defined(__DOXYGEN__)
-#define SPI_USE_MUTUAL_EXCLUSION TRUE
+#if !defined(USE_STM32_SPI1) || defined(__DOXYGEN__)
+#define USE_STM32_SPI1 TRUE
#endif
-#if SPI_USE_MUTUAL_EXCLUSION && !CH_USE_MUTEXES && !CH_USE_SEMAPHORES
-#error "SPI_USE_MUTUAL_EXCLUSION requires CH_USE_MUTEXES and/or CH_USE_SEMAPHORES"
+/**
+ * @brief SPI1 driver enable switch.
+ * @details If set to @p TRUE the support for SPI is included.
+ * @note The default is @p TRUE.
+ */
+#if !defined(USE_STM32_SPI2) || defined(__DOXYGEN__)
+#define USE_STM32_SPI2 TRUE
#endif
/*===========================================================================*/
@@ -50,9 +63,9 @@
* @brief Driver state machine possible states.
*/
typedef enum {
- SPI_UNINIT = 0,//!< SPI_UNINIT
- SPI_IDLE = 1, //!< SPI_IDLE
- SPI_ACTIVE = 2 //!< SPI_ACTIVE
+ SPI_UNINIT = 0,
+ SPI_IDLE = 1,
+ SPI_ACTIVE = 2
} spistate_t;
/**
@@ -85,16 +98,28 @@ typedef struct {
#endif
#endif /* SPI_USE_MUTUAL_EXCLUSION */
/**
- * Current configuration data.
+ * @brief Current configuration data.
*/
const SPIConfig *spd_config;
/* End of the mandatory fields.*/
+ SPI_TypeDef *spd_spi;
+ DMA_Channel_TypeDef *spd_dmarx;
+ DMA_Channel_TypeDef *spd_dmatx;
} SPIDriver;
/*===========================================================================*/
/* External declarations. */
/*===========================================================================*/
+/** @cond never*/
+#if USE_STM32_SPI1
+extern SPIDriver SPID1;
+#endif
+
+#if USE_STM32_SPI2
+extern SPIDriver SPID2;
+#endif
+
#ifdef __cplusplus
extern "C" {
#endif
@@ -106,6 +131,7 @@ extern "C" {
#ifdef __cplusplus
}
#endif
+/** @endcond*/
#endif /* _SPI_LLD_H_ */