From abcc509bf98d1a87b05ee17dffa700ffaacaf30b Mon Sep 17 00:00:00 2001 From: patacongo Date: Sat, 15 May 2010 01:15:52 +0000 Subject: 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 --- nuttx/arch/arm/src/lm3s/lm3s_ssi.c | 37 ++++++++++++++++++++++++++++++++++++- 1 file changed, 36 insertions(+), 1 deletion(-) (limited to 'nuttx/arch/arm/src/lm3s') diff --git a/nuttx/arch/arm/src/lm3s/lm3s_ssi.c b/nuttx/arch/arm/src/lm3s/lm3s_ssi.c index bbe04bd1b..73b995671 100755 --- a/nuttx/arch/arm/src/lm3s/lm3s_ssi.c +++ b/nuttx/arch/arm/src/lm3s/lm3s_ssi.c @@ -232,6 +232,9 @@ static int ssi_interrupt(int irq, void *context); /* SPI methods */ +#ifndef CONFIG_SPI_OWNBUS +static int ssi_lock(FAR struct spi_dev_s *dev, bool lock); +#endif static void ssi_setfrequencyinternal(struct lm3s_ssidev_s *priv, uint32_t frequency); static uint32_t ssi_setfrequency(FAR struct spi_dev_s *dev, @@ -260,7 +263,9 @@ static void ssi_recvblock(FAR struct spi_dev_s *dev, FAR void *buffer, static const struct spi_ops_s g_spiops = { - .lock = 0, /* Not yet implemented */ +#ifndef CONFIG_SPI_OWNBUS + .lock = ssi_lock, +#endif .select = lm3s_spiselect, /* Provided externally by board logic */ .setfrequency = ssi_setfrequency, .setmode = ssi_setmode, @@ -968,6 +973,36 @@ static int ssi_interrupt(int irq, void *context) } #endif +/**************************************************************************** + * Name: ssi_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 ssi_lock(FAR struct spi_dev_s *dev, bool lock) +{ + /* Not implemented */ + + return -ENOSYS; +} +#endif + /**************************************************************************** * Name: ssi_setfrequency * -- cgit v1.2.3