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
This commit is contained in:
patacongo
2009-03-29 18:02:35 +00:00
parent c67c66b43c
commit 4c00d46df2
2 changed files with 17 additions and 9 deletions
+9 -5
View File
@@ -1,7 +1,7 @@
/**************************************************************************** /****************************************************************************
* config/mcu123-lpc214x/src/up_spi.c * config/mcu123-lpc214x/src/up_spi.c
* *
* Copyright (C) 2008 Gregory Nutt. All rights reserved. * Copyright (C) 2008-2009 Gregory Nutt. All rights reserved.
* Author: Gregory Nutt <spudmonkey@racsa.co.cr> * Author: Gregory Nutt <spudmonkey@racsa.co.cr>
* *
* This logic emulates the Prolific PL2303 serial/USB converter * This logic emulates the Prolific PL2303 serial/USB converter
@@ -88,7 +88,7 @@
* Private Function Prototypes * Private Function Prototypes
****************************************************************************/ ****************************************************************************/
static void spi_select(FAR struct spi_dev_s *dev, boolean selected); static void spi_select(FAR struct spi_dev_s *dev, enum spidev_e devid, boolean selected);
static uint32 spi_setfrequency(FAR struct spi_dev_s *dev, uint32 frequency); static uint32 spi_setfrequency(FAR struct spi_dev_s *dev, uint32 frequency);
static ubyte spi_status(FAR struct spi_dev_s *dev); static ubyte spi_status(FAR struct spi_dev_s *dev);
static ubyte spi_sndbyte(FAR struct spi_dev_s *dev, ubyte ch); static ubyte spi_sndbyte(FAR struct spi_dev_s *dev, ubyte ch);
@@ -123,17 +123,21 @@ static struct spi_dev_s g_spidev = { &g_spiops };
* Name: spi_select * Name: spi_select
* *
* Description: * Description:
* Enable/disable the SPI slave select * Enable/disable the SPI slave 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 deselecte.
* *
* Input Parameters: * Input Parameters:
* selected: TRUE: slave selected, FALSE: slave de-selected * dev - Device-specific state data
* devid - Identifies the device to select
* selected - TRUE: slave selected, FALSE: slave de-selected
* *
* Returned Value: * Returned Value:
* None * None
* *
****************************************************************************/ ****************************************************************************/
static void spi_select(FAR struct spi_dev_s *dev, boolean selected) static void spi_select(FAR struct spi_dev_s *dev, enum spidev_e devid, boolean selected)
{ {
uint32 bit = 1 << 20; uint32 bit = 1 << 20;
+8 -4
View File
@@ -265,7 +265,7 @@ static inline void spi_putreg(FAR struct str71x_spidev_s *priv, ubyte offset,
/* SPI methods */ /* SPI methods */
static void spi_select(FAR struct spi_dev_s *dev, boolean selected); static void spi_select(FAR struct spi_dev_s *dev, enum spidev_e devid, boolean selected);
static uint32 spi_setfrequency(FAR struct spi_dev_s *dev, uint32 frequency); static uint32 spi_setfrequency(FAR struct spi_dev_s *dev, uint32 frequency);
static ubyte spi_status(FAR struct spi_dev_s *dev); static ubyte spi_status(FAR struct spi_dev_s *dev);
static ubyte spi_sndbyte(FAR struct spi_dev_s *dev, ubyte ch); static ubyte spi_sndbyte(FAR struct spi_dev_s *dev, ubyte ch);
@@ -357,17 +357,21 @@ static inline void spi_putreg(FAR struct str71x_spidev_s *priv, ubyte offset, ui
* Name: spi_select * Name: spi_select
* *
* Description: * Description:
* Enable/disable the SPI slave select * Enable/disable the SPI slave 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.
* *
* Input Parameters: * Input Parameters:
* selected: TRUE: slave selected, FALSE: slave de-selected * dev - Device-specific state data
* devid - Identifies the device to select
* selected - TRUE: slave selected, FALSE: slave de-selected
* *
* Returned Value: * Returned Value:
* None * None
* *
****************************************************************************/ ****************************************************************************/
static void spi_select(FAR struct spi_dev_s *dev, boolean selected) static void spi_select(FAR struct spi_dev_s *dev, enum spidev_e devid, boolean selected)
{ {
FAR struct str71x_spidev_s *priv = (FAR struct str71x_spidev_s *)dev; FAR struct str71x_spidev_s *priv = (FAR struct str71x_spidev_s *)dev;
uint16 reg16; uint16 reg16;