summaryrefslogtreecommitdiff
path: root/nuttx/configs/vsn/src/spi.c
diff options
context:
space:
mode:
authorpatacongo <patacongo@42af7a65-404d-4744-a932-0658087f49c3>2011-03-26 01:04:10 +0000
committerpatacongo <patacongo@42af7a65-404d-4744-a932-0658087f49c3>2011-03-26 01:04:10 +0000
commit54150a8f62d57bd3af5efce1439ba3c29e20f07f (patch)
tree4c791787398c9f76ccd9c8a56e1dd139c2a4e8e4 /nuttx/configs/vsn/src/spi.c
parentc62abcf9c8c26757ac5e6fbf0fd9813f1ba087a6 (diff)
downloadpx4-nuttx-54150a8f62d57bd3af5efce1439ba3c29e20f07f.tar.gz
px4-nuttx-54150a8f62d57bd3af5efce1439ba3c29e20f07f.tar.bz2
px4-nuttx-54150a8f62d57bd3af5efce1439ba3c29e20f07f.zip
Incorporate changes from Uros Platise
git-svn-id: svn://svn.code.sf.net/p/nuttx/code/trunk@3419 42af7a65-404d-4744-a932-0658087f49c3
Diffstat (limited to 'nuttx/configs/vsn/src/spi.c')
-rw-r--r--nuttx/configs/vsn/src/spi.c37
1 files changed, 19 insertions, 18 deletions
diff --git a/nuttx/configs/vsn/src/spi.c b/nuttx/configs/vsn/src/spi.c
index 742fcfd41..a452197b7 100644
--- a/nuttx/configs/vsn/src/spi.c
+++ b/nuttx/configs/vsn/src/spi.c
@@ -37,12 +37,17 @@
*
************************************************************************************/
-/************************************************************************************
- * Included Files
- ************************************************************************************/
+/** \file
+ * \author Gregory Nutt, Uros Platise
+ * \brief SPI Slave Selects
+ */
+
#include <nuttx/config.h>
#include <nuttx/spi.h>
+
+#if defined(CONFIG_STM32_SPI1) || defined(CONFIG_STM32_SPI2) || defined(CONFIG_STM32_SPI3)
+
#include <arch/board/board.h>
#include <stdint.h>
@@ -55,7 +60,6 @@
#include "stm32_internal.h"
#include "vsn.h"
-#if defined(CONFIG_STM32_SPI1) || defined(CONFIG_STM32_SPI2) || defined(CONFIG_STM32_SPI3)
/************************************************************************************
* Definitions
@@ -79,22 +83,15 @@
# define spivdbg(x...)
#endif
-/************************************************************************************
- * Private Functions
- ************************************************************************************/
/************************************************************************************
* Public Functions
************************************************************************************/
-/************************************************************************************
- * Name: stm32_spiinitialize
- *
- * Description:
- * Called to configure SPI chip select GPIO pins for the VSN board.
- *
- ************************************************************************************/
+/** Called to configure SPI chip select GPIO pins for the VSN board.
+ */
+
void weak_function stm32_spiinitialize(void)
{
/* NOTE: Clocking for SPI1 and/or SPI2 and SPI3 was already provided in stm32_rcc.c.
@@ -109,10 +106,8 @@ void weak_function stm32_spiinitialize(void)
#endif
}
-/****************************************************************************
- * Name: stm32_spi1/2/3select and stm32_spi1/2/3status
+/** Selects: stm32_spi1/2/3select and stm32_spi1/2/3status
*
- * Description:
* The external functions, stm32_spi1/2/3select and stm32_spi1/2/3status must be
* provided by board-specific logic. They are implementations of the select
* and status methods of the SPI interface defined by struct spi_ops_s (see
@@ -132,9 +127,10 @@ void weak_function stm32_spiinitialize(void)
* mmcsd_spislotinitialize(), for example, will bind the SPI driver to
* the SPI MMC/SD driver).
*
- ****************************************************************************/
+ **/
#ifdef CONFIG_STM32_SPI1
+
void stm32_spi1select(FAR struct spi_dev_s *dev, enum spi_dev_e devid, bool selected)
{
spidbg("devid: %d CS: %s\n", (int)devid, selected ? "assert" : "de-assert");
@@ -144,9 +140,11 @@ uint8_t stm32_spi1status(FAR struct spi_dev_s *dev, enum spi_dev_e devid)
{
return SPI_STATUS_PRESENT;
}
+
#endif
#ifdef CONFIG_STM32_SPI2
+
void stm32_spi2select(FAR struct spi_dev_s *dev, enum spi_dev_e devid, bool selected)
{
spidbg("devid: %d CS: %s\n", (int)devid, selected ? "assert" : "de-assert");
@@ -156,9 +154,11 @@ uint8_t stm32_spi2status(FAR struct spi_dev_s *dev, enum spi_dev_e devid)
{
return SPI_STATUS_PRESENT;
}
+
#endif
#ifdef CONFIG_STM32_SPI3
+
void stm32_spi3select(FAR struct spi_dev_s *dev, enum spi_dev_e devid, bool selected)
{
spidbg("devid: %d CS: %s\n", (int)devid, selected ? "assert" : "de-assert");
@@ -173,6 +173,7 @@ uint8_t stm32_spi3status(FAR struct spi_dev_s *dev, enum spi_dev_e devid)
{
return SPI_STATUS_PRESENT;
}
+
#endif
#endif /* CONFIG_STM32_SPI1 || CONFIG_STM32_SPI2 */