summaryrefslogtreecommitdiff
path: root/nuttx/arch/arm/src/stm32
diff options
context:
space:
mode:
authorpatacongo <patacongo@42af7a65-404d-4744-a932-0658087f49c3>2010-12-03 01:37:56 +0000
committerpatacongo <patacongo@42af7a65-404d-4744-a932-0658087f49c3>2010-12-03 01:37:56 +0000
commit5076c4bb878881610884750c5a8fd43bdf99c471 (patch)
treec28e5e59c702dfc7394e9d365b9bcb7c3209b7ea /nuttx/arch/arm/src/stm32
parent42a5fb251254f855b5f3911337d56f0cccfcc37f (diff)
downloadpx4-nuttx-5076c4bb878881610884750c5a8fd43bdf99c471.tar.gz
px4-nuttx-5076c4bb878881610884750c5a8fd43bdf99c471.tar.bz2
px4-nuttx-5076c4bb878881610884750c5a8fd43bdf99c471.zip
Add cmddata method to the SPI interface
git-svn-id: svn://svn.code.sf.net/p/nuttx/code/trunk@3157 42af7a65-404d-4744-a932-0658087f49c3
Diffstat (limited to 'nuttx/arch/arm/src/stm32')
-rwxr-xr-xnuttx/arch/arm/src/stm32/stm32_internal.h25
-rwxr-xr-xnuttx/arch/arm/src/stm32/stm32_spi.c9
2 files changed, 25 insertions, 9 deletions
diff --git a/nuttx/arch/arm/src/stm32/stm32_internal.h b/nuttx/arch/arm/src/stm32/stm32_internal.h
index d7e40ba63..9c13f04ef 100755
--- a/nuttx/arch/arm/src/stm32/stm32_internal.h
+++ b/nuttx/arch/arm/src/stm32/stm32_internal.h
@@ -1,7 +1,7 @@
/************************************************************************************
* arch/arm/src/stm32/stm32_internal.h
*
- * Copyright (C) 2009 Gregory Nutt. All rights reserved.
+ * Copyright (C) 2009-2010 Gregory Nutt. All rights reserved.
* Author: Gregory Nutt <spudmonkey@racsa.co.cr>
*
* Redistribution and use in source and binary forms, with or without
@@ -445,21 +445,25 @@ EXTERN int stm32_ethinitialize(int intf);
* Name: 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
- * include/nuttx/spi.h). All other methods (including up_spiinitialize())
- * are provided by common STM32 logic. To use this common SPI logic on your
- * board:
+ * The external functions, stm32_spi1/2/3select, stm32_spi1/2/3status, and
+ * stm32_spi1/2/3cmddata must be provided by board-specific logic. These are
+ * implementations of the select, status, and cmddata methods of the SPI interface
+ * defined by struct spi_ops_s (see include/nuttx/spi.h). All other methods
+ * (including up_spiinitialize()) are provided by common STM32 logic. To use this
+ * common SPI logic on your board:
*
* 1. Provide logic in stm32_boardinitialize() to configure SPI chip select
* pins.
* 2. Provide stm32_spi1/2/3select() and stm32_spi1/2/3status() functions in your
* board-specific logic. These functions will perform chip selection and
* status operations using GPIOs in the way your board is configured.
- * 3. Add a calls to up_spiinitialize() in your low level application
+ * 3. If CONFIG_SPI_CMDDATA is defined in your NuttX configuration file, then
+ * provide stm32_spi1/2/3cmddata() functions in your board-specific logic.
+ * These functions will perform cmd/data selection operations using GPIOs in the
+ * way your board is configured.
+ * 4. Add a calls to up_spiinitialize() in your low level application
* initialization logic
- * 4. The handle returned by up_spiinitialize() may then be used to bind the
+ * 5. The handle returned by up_spiinitialize() may then be used to bind the
* SPI driver to higher level logic (e.g., calling
* mmcsd_spislotinitialize(), for example, will bind the SPI driver to
* the SPI MMC/SD driver).
@@ -470,10 +474,13 @@ struct spi_dev_s;
enum spi_dev_e;
EXTERN void stm32_spi1select(FAR struct spi_dev_s *dev, enum spi_dev_e devid, bool selected);
EXTERN uint8_t stm32_spi1status(FAR struct spi_dev_s *dev, enum spi_dev_e devid);
+EXTERN int stm32_spi1cmddata(FAR struct spi_dev_s *dev, enum spi_dev_e devid, bool cmd);
EXTERN void stm32_spi2select(FAR struct spi_dev_s *dev, enum spi_dev_e devid, bool selected);
EXTERN uint8_t stm32_spi2status(FAR struct spi_dev_s *dev, enum spi_dev_e devid);
+EXTERN int stm32_spi2cmddata(FAR struct spi_dev_s *dev, enum spi_dev_e devid, bool cmd);
EXTERN void stm32_spi3select(FAR struct spi_dev_s *dev, enum spi_dev_e devid, bool selected);
EXTERN uint8_t stm32_spi3status(FAR struct spi_dev_s *dev, enum spi_dev_e devid);
+EXTERN int stm32_spi3cmddata(FAR struct spi_dev_s *dev, enum spi_dev_e devid, bool cmd);
/************************************************************************************
* Name: stm32_usbpullup
diff --git a/nuttx/arch/arm/src/stm32/stm32_spi.c b/nuttx/arch/arm/src/stm32/stm32_spi.c
index 4605f8a30..5e28ee879 100755
--- a/nuttx/arch/arm/src/stm32/stm32_spi.c
+++ b/nuttx/arch/arm/src/stm32/stm32_spi.c
@@ -209,6 +209,9 @@ static const struct spi_ops_s g_sp1iops =
.setmode = spi_setmode,
.setbits = spi_setbits,
.status = stm32_spi1status,
+#ifdef CONFIG_SPI_CMDDATA
+ .cmddata = stm32_spi1cmddata,
+#endif
.send = spi_send,
#ifdef CONFIG_SPI_EXCHANGE
.exchange = spi_exchange,
@@ -245,6 +248,9 @@ static const struct spi_ops_s g_sp2iops =
.setmode = spi_setmode,
.setbits = spi_setbits,
.status = stm32_spi2status,
+#ifdef CONFIG_SPI_CMDDATA
+ .cmddata = stm32_spi2cmddata,
+#endif
.send = spi_send,
#ifdef CONFIG_SPI_EXCHANGE
.exchange = spi_exchange,
@@ -281,6 +287,9 @@ static const struct spi_ops_s g_sp3iops =
.setmode = spi_setmode,
.setbits = spi_setbits,
.status = stm32_spi3status,
+#ifdef CONFIG_SPI_CMDDATA
+ .cmddata = stm32_spi3cmddata,
+#endif
.send = spi_send,
#ifdef CONFIG_SPI_EXCHANGE
.exchange = spi_exchange,