diff options
author | patacongo <patacongo@42af7a65-404d-4744-a932-0658087f49c3> | 2010-05-15 01:15:52 +0000 |
---|---|---|
committer | patacongo <patacongo@42af7a65-404d-4744-a932-0658087f49c3> | 2010-05-15 01:15:52 +0000 |
commit | abcc509bf98d1a87b05ee17dffa700ffaacaf30b (patch) | |
tree | 645b3e63abbf7dc0d84436c404fcce1050c8c047 /nuttx/configs/olimex-strp711/src | |
parent | c6c6c52fdb8e2fe474563b71437d80f4d3c67e59 (diff) | |
download | px4-nuttx-abcc509bf98d1a87b05ee17dffa700ffaacaf30b.tar.gz px4-nuttx-abcc509bf98d1a87b05ee17dffa700ffaacaf30b.tar.bz2 px4-nuttx-abcc509bf98d1a87b05ee17dffa700ffaacaf30b.zip |
In progress changes for OLED display work
git-svn-id: svn://svn.code.sf.net/p/nuttx/code/trunk@2669 42af7a65-404d-4744-a932-0658087f49c3
Diffstat (limited to 'nuttx/configs/olimex-strp711/src')
-rw-r--r-- | nuttx/configs/olimex-strp711/src/up_spi.c | 37 |
1 files changed, 36 insertions, 1 deletions
diff --git a/nuttx/configs/olimex-strp711/src/up_spi.c b/nuttx/configs/olimex-strp711/src/up_spi.c index c01cbbc87..5ca35b72e 100644 --- a/nuttx/configs/olimex-strp711/src/up_spi.c +++ b/nuttx/configs/olimex-strp711/src/up_spi.c @@ -390,6 +390,9 @@ static inline void spi_drain(FAR struct str71x_spidev_s *priv); /* SPI methods */ +#ifndef CONFIG_SPI_OWNBUS +static int spi_lock(FAR struct spi_dev_s *dev, bool lock); +#endif static void spi_select(FAR struct spi_dev_s *dev, enum spi_dev_e devid, bool selected); static uint32_t spi_setfrequency(FAR struct spi_dev_s *dev, uint32_t frequency); static uint8_t spi_status(FAR struct spi_dev_s *dev, enum spi_dev_e devid); @@ -403,7 +406,9 @@ static void spi_recvblock(FAR struct spi_dev_s *dev, FAR void *buffer, size_t static const struct spi_ops_s g_spiops = { - .lock = 0, /* Not yet implemented */ +#ifndef CONFIG_SPI_OWNBUS + .lock = spi_lock, +#endif .select = spi_select, .setfrequency = spi_setfrequency, .status = spi_status, @@ -527,6 +532,36 @@ static inline void spi_drain(FAR struct str71x_spidev_s *priv) } /**************************************************************************** + * Name: spi_lock + * + * Description: + * On SPI busses where there are multiple devices, it will be necessary to + * lock SPI to have exclusive access to the busses for a sequence of + * transfers. The bus should be locked before the chip is selected. After + * locking the SPI bus, the caller should then also call the setfrequency, + * setbits, and setmode methods to make sure that the SPI is properly + * configured for the device. If the SPI buss is being shared, then it + * may have been left in an incompatible state. + * + * Input Parameters: + * dev - Device-specific state data + * lock - true: Lock spi bus, false: unlock SPI bus + * + * Returned Value: + * None + * + ****************************************************************************/ + +#ifndef CONFIG_SPI_OWNBUS +static int spi_lock(FAR struct spi_dev_s *dev, bool lock) +{ + /* Not implemented */ + + return -ENOSYS; +} +#endif + +/**************************************************************************** * Name: spi_select * * Description: |