diff options
author | patacongo <patacongo@42af7a65-404d-4744-a932-0658087f49c3> | 2009-03-29 18:02:35 +0000 |
---|---|---|
committer | patacongo <patacongo@42af7a65-404d-4744-a932-0658087f49c3> | 2009-03-29 18:02:35 +0000 |
commit | eb8bf2893617f690ab073a5d1b697bd12e5220a0 (patch) | |
tree | 7e66acd74d0437a7f8aa6bcadf882f075391dd38 /nuttx/include | |
parent | d2e5f38c3b7eefe042f36392660dbea013ee1705 (diff) | |
download | px4-nuttx-eb8bf2893617f690ab073a5d1b697bd12e5220a0.tar.gz px4-nuttx-eb8bf2893617f690ab073a5d1b697bd12e5220a0.tar.bz2 px4-nuttx-eb8bf2893617f690ab073a5d1b697bd12e5220a0.zip |
Add enum argument to SPI select method
git-svn-id: svn://svn.code.sf.net/p/nuttx/code/trunk@1666 42af7a65-404d-4744-a932-0658087f49c3
Diffstat (limited to 'nuttx/include')
-rw-r--r-- | nuttx/include/nuttx/spi.h | 26 |
1 files changed, 21 insertions, 5 deletions
diff --git a/nuttx/include/nuttx/spi.h b/nuttx/include/nuttx/spi.h index 896ed6e8f..f3dfa82a7 100644 --- a/nuttx/include/nuttx/spi.h +++ b/nuttx/include/nuttx/spi.h @@ -53,17 +53,22 @@ * Name: SPI_SELECT * * Description: - * Enable/disable the SPI chip select. Required. + * Enable/disable the SPI chip select. The implementation of this method + * must include handshaking: If a device is selected, it must hold off + * all other attempts to select the device until the device is deselected. + * Required. * * Input Parameters: - * select: TRUE: chip selected, FALSE: chip de-selected + * dev - Device-specific state data + * devid - Identifies the device to select + * selected - TRUE: slave selected, FALSE: slave de-selected * * Returned Value: * None * ****************************************************************************/ -#define SPI_SELECT(d,b) ((d)->ops->select(d,b)) +#define SPI_SELECT(d,id,s) ((d)->ops->select(d,id,s)) /**************************************************************************** * Name: SPI_SETFREQUENCY @@ -183,12 +188,23 @@ typedef void (*mediachange_t)(void *arg); +/* If the board supports multiple SPI devices, this enumeration identifies + * which is selected or de-seleted. + */ + +enum spidev_e +{ + SPIDEV_NONE = 0, /* Not a valid value */ + SPIDEV_MMCSD, /* Select SPI MMC/SD device */ + SPIDEV_ETHERNET /* Select SPI ethernet device */ +}; + /* The SPI vtable */ struct spi_dev_s; struct spi_ops_s { - void (*select)(FAR struct spi_dev_s *dev, boolean selected); + void (*select)(FAR struct spi_dev_s *dev, enum spidev_e devid, boolean selected); uint32 (*setfrequency)(FAR struct spi_dev_s *dev, uint32 frequency); ubyte (*status)(FAR struct spi_dev_s *dev); ubyte (*sndbyte)(FAR struct spi_dev_s *dev, ubyte ch); @@ -223,7 +239,7 @@ extern "C" { * Name: up_spiinitialize * * Description: - * Initialize the selected SPI port + * Initialize the selected SPI port. * * Input Parameter: * Port number (for hardware that has mutiple SPI interfaces) |