diff --git a/Documentation/NuttxPortingGuide.html b/Documentation/NuttxPortingGuide.html
index 0923a1786b..1c3ff2d886 100644
--- a/Documentation/NuttxPortingGuide.html
+++ b/Documentation/NuttxPortingGuide.html
@@ -5014,11 +5014,11 @@ int kbd_decode(FAR struct lib_instream_s *stream, FAR struct kbd_getstate_s *sta
That structure defines a call table with the following methods:
void lock(FAR struct spi_dev_s *dev);
- void select(FAR struct spi_dev_s *dev, enum spi_dev_e devid, bool selected);
+
void select(FAR struct spi_dev_s *dev, uint32_t devid, bool selected);
uint32_t setfrequency(FAR struct spi_dev_s *dev, uint32_t frequency);
void setmode(FAR struct spi_dev_s *dev, enum spi_mode_e mode);
void setbits(FAR struct spi_dev_s *dev, int nbits);
- uint8_t status(FAR struct spi_dev_s *dev, enum spi_dev_e devid);
+ uint8_t status(FAR struct spi_dev_s *dev, uint32_t devid);
uint16_t send(FAR struct spi_dev_s *dev, uint16_t wd);
void exchange(FAR struct spi_dev_s *dev, FAR const void *txbuffer, FAR void *rxbuffer, size_t nwords);
int registercallback(FAR struct spi_dev_s *dev, mediachange_t callback, void *arg);
diff --git a/arch/arm/include/stm32l4/chip.h b/arch/arm/include/stm32l4/chip.h
index f24bf5b7e2..52c5ccae69 100644
--- a/arch/arm/include/stm32l4/chip.h
+++ b/arch/arm/include/stm32l4/chip.h
@@ -75,9 +75,11 @@
#if defined(CONFIG_STM32L4_STM32L496XX)
# define STM32L4_SRAM1_SIZE (256*1024) /* 256Kb SRAM1 on AHB bus Matrix */
# define STM32L4_SRAM2_SIZE (64*1024) /* 64Kb SRAM2 on AHB bus Matrix */
-#else
+#elif defined(CONFIG_STM32L4_STM32L476XX) || defined(CONFIG_STM32L4_STM32L486XX)
# define STM32L4_SRAM1_SIZE (96*1024) /* 96Kb SRAM1 on AHB bus Matrix */
# define STM32L4_SRAM2_SIZE (32*1024) /* 32Kb SRAM2 on AHB bus Matrix */
+#else
+# error "Unsupported STM32L4 chip"
#endif
# define STM32L4_NFSMC 1 /* Have FSMC memory controller */
diff --git a/arch/arm/include/stm32l4/stm32l4x6xx_irq.h b/arch/arm/include/stm32l4/stm32l4x6xx_irq.h
index c992ed942f..b675e786bb 100644
--- a/arch/arm/include/stm32l4/stm32l4x6xx_irq.h
+++ b/arch/arm/include/stm32l4/stm32l4x6xx_irq.h
@@ -143,15 +143,34 @@
#define STM32L4_IRQ_TSC (STM32L4_IRQ_FIRST+77) /* 77: TSC global interrupt */
#define STM32L4_IRQ_LCD (STM32L4_IRQ_FIRST+78) /* 78: LCD global interrupt */
#define STM32L4_IRQ_AES (STM32L4_IRQ_FIRST+79) /* 79: AES crypto global interrupt */
-#define STM32L4_IRQ_RNG (STM32L4_IRQ_FIRST+80) /* 80: Rng global interrupt */
+#define STM32L4_IRQ_RNG (STM32L4_IRQ_FIRST+80) /* 80: RNG global interrupt */
#define STM32L4_IRQ_FPU (STM32L4_IRQ_FIRST+81) /* 81: FPU global interrupt */
-#define NR_INTERRUPTS 82
-#define NR_VECTORS (STM32L4_IRQ_FIRST+NR_INTERRUPTS)
+/* STM32L496xx/4A6xx only: */
+
+#define STM32L4_IRQ_HASH_CRS (STM32L4_IRQ_FIRST+82) /* 82: HASH and CRS global interrupt */
+#define STM32L4_IRQ_I2C4EV (STM32L4_IRQ_FIRST+83) /* 83: I2C4 event interrupt */
+#define STM32L4_IRQ_I2C4ER (STM32L4_IRQ_FIRST+84) /* 84: I2C4 error interrupt */
+#define STM32L4_IRQ_DCMI (STM32L4_IRQ_FIRST+85) /* 85: DCMI global interrupt */
+#define STM32L4_IRQ_CAN2TX (STM32L4_IRQ_FIRST+86) /* 86: CAN2 TX interrupts */
+#define STM32L4_IRQ_CAN2RX0 (STM32L4_IRQ_FIRST+87) /* 87: CAN2 RX0 interrupts */
+#define STM32L4_IRQ_CAN2RX1 (STM32L4_IRQ_FIRST+88) /* 88: CAN2 RX1 interrupt */
+#define STM32L4_IRQ_CAN2SCE (STM32L4_IRQ_FIRST+89) /* 89: CAN2 SCE interrupt */
+#define STM32L4_IRQ_DMA2D (STM32L4_IRQ_FIRST+90) /* 90: DMA2D global interrupt */
+
+#if defined(CONFIG_STM32L4_STM32L476XX) || defined(CONFIG_STM32L4_STM32L486XX)
+# define NR_INTERRUPTS 82
+#elif defined(CONFIG_STM32L4_STM32L496XX)
+# define NR_INTERRUPTS 91
+#else
+# error "Unsupported STM32L4 chip"
+#endif
+
+#define NR_VECTORS (STM32L4_IRQ_FIRST+NR_INTERRUPTS)
/* EXTI interrupts (Do not use IRQ numbers) */
-#define NR_IRQS NR_VECTORS
+#define NR_IRQS NR_VECTORS
/****************************************************************************************************
* Public Types
diff --git a/arch/arm/src/efm32/efm32_spi.c b/arch/arm/src/efm32/efm32_spi.c
index d0ae6d378a..01491669fd 100644
--- a/arch/arm/src/efm32/efm32_spi.c
+++ b/arch/arm/src/efm32/efm32_spi.c
@@ -109,11 +109,11 @@ struct efm32_spiconfig_s
/* SPI-specific methods */
- void (*select)(struct spi_dev_s *dev, enum spi_dev_e devid,
+ void (*select)(struct spi_dev_s *dev, uint32_t devid,
bool selected);
- uint8_t (*status)(struct spi_dev_s *dev, enum spi_dev_e devid);
+ uint8_t (*status)(struct spi_dev_s *dev, uint32_t devid);
#ifdef CONFIG_SPI_CMDDATA
- int (*cmddata)(struct spi_dev_s *dev, enum spi_dev_e devid, bool cmd);
+ int (*cmddata)(struct spi_dev_s *dev, uint32_t devid, bool cmd);
#endif
};
@@ -180,7 +180,7 @@ static inline void spi_dmatxstart(FAR struct efm32_spidev_s *priv);
/* SPI methods */
static int spi_lock(struct spi_dev_s *dev, bool lock);
-static void spi_select(struct spi_dev_s *dev, enum spi_dev_e devid,
+static void spi_select(struct spi_dev_s *dev, uint32_t devid,
bool selected);
static uint32_t spi_setfrequency(struct spi_dev_s *dev,
uint32_t frequency);
@@ -190,9 +190,9 @@ static void spi_setbits(struct spi_dev_s *dev, int nbits);
static int spi_hwfeatures(FAR struct spi_dev_s *dev,
spi_hwfeatures_t features);
#endif
-static uint8_t spi_status(struct spi_dev_s *dev, enum spi_dev_e devid);
+static uint8_t spi_status(struct spi_dev_s *dev, uint32_t devid);
#ifdef CONFIG_SPI_CMDDATA
-static int spi_cmddata(struct spi_dev_s *dev, enum spi_dev_e devid,
+static int spi_cmddata(struct spi_dev_s *dev, uint32_t devid,
bool cmd);
#endif
static uint16_t spi_send(struct spi_dev_s *dev, uint16_t wd);
@@ -781,7 +781,7 @@ static int spi_lock(struct spi_dev_s *dev, bool lock)
*
****************************************************************************/
-static void spi_select(struct spi_dev_s *dev, enum spi_dev_e devid,
+static void spi_select(struct spi_dev_s *dev, uint32_t devid,
bool selected)
{
struct efm32_spidev_s *priv = (struct efm32_spidev_s *)dev;
@@ -1147,7 +1147,7 @@ static int spi_hwfeatures(FAR struct spi_dev_s *dev, spi_hwfeatures_t features)
*
****************************************************************************/
-static uint8_t spi_status(struct spi_dev_s *dev, enum spi_dev_e devid)
+static uint8_t spi_status(struct spi_dev_s *dev, uint32_t devid)
{
struct efm32_spidev_s *priv = (struct efm32_spidev_s *)dev;
const struct efm32_spiconfig_s *config;
@@ -1185,7 +1185,7 @@ static uint8_t spi_status(struct spi_dev_s *dev, enum spi_dev_e devid)
****************************************************************************/
#ifdef CONFIG_SPI_CMDDATA
-static int spi_cmddata(struct spi_dev_s *dev, enum spi_dev_e devid,
+static int spi_cmddata(struct spi_dev_s *dev, uint32_t devid,
bool cmd);
{
struct efm32_spidev_s *priv = (struct efm32_spidev_s *)dev;
diff --git a/arch/arm/src/efm32/efm32_spi.h b/arch/arm/src/efm32/efm32_spi.h
index 315eb0615d..9e84fb68dc 100644
--- a/arch/arm/src/efm32/efm32_spi.h
+++ b/arch/arm/src/efm32/efm32_spi.h
@@ -52,7 +52,6 @@
****************************************************************************/
struct spi_dev_s; /* Forward reference */
-enum spi_dev_e; /* Forward reference */
/****************************************************************************
* Name: efm32_spibus_initialize
@@ -101,26 +100,26 @@ struct spi_dev_s *efm32_spibus_initialize(int port);
****************************************************************************/
#ifdef CONFIG_EFM32_USART0_ISSPI
-void efm32_spi0_select(struct spi_dev_s *dev, enum spi_dev_e devid,
+void efm32_spi0_select(struct spi_dev_s *dev, uint32_t devid,
bool selected);
-uint8_t efm32_spi0_status(struct spi_dev_s *dev, enum spi_dev_e devid);
-int efm32_spi0_cmddata(struct spi_dev_s *dev, enum spi_dev_e devid,
+uint8_t efm32_spi0_status(struct spi_dev_s *dev, uint32_t devid);
+int efm32_spi0_cmddata(struct spi_dev_s *dev, uint32_t devid,
bool cmd);
#endif
#ifdef CONFIG_EFM32_USART1_ISSPI
-void efm32_spi1_select(struct spi_dev_s *dev, enum spi_dev_e devid,
+void efm32_spi1_select(struct spi_dev_s *dev, uint32_t devid,
bool selected);
-uint8_t efm32_spi1_status(struct spi_dev_s *dev, enum spi_dev_e devid);
-int efm32_spi1_cmddata(struct spi_dev_s *dev, enum spi_dev_e devid,
+uint8_t efm32_spi1_status(struct spi_dev_s *dev, uint32_t devid);
+int efm32_spi1_cmddata(struct spi_dev_s *dev, uint32_t devid,
bool cmd);
#endif
#ifdef CONFIG_EFM32_USART2_ISSPI
-void efm32_spi2_select(struct spi_dev_s *dev, enum spi_dev_e devid,
+void efm32_spi2_select(struct spi_dev_s *dev, uint32_t devid,
bool selected);
-uint8_t efm32_spi2_status(struct spi_dev_s *dev, enum spi_dev_e devid);
-int efm32_spi2_cmddata(struct spi_dev_s *dev, enum spi_dev_e devid,
+uint8_t efm32_spi2_status(struct spi_dev_s *dev, uint32_t devid);
+int efm32_spi2_cmddata(struct spi_dev_s *dev, uint32_t devid,
bool cmd);
#endif
diff --git a/arch/arm/src/imx1/imx_cspi.h b/arch/arm/src/imx1/imx_cspi.h
index 842a4ca111..f15872c49b 100644
--- a/arch/arm/src/imx1/imx_cspi.h
+++ b/arch/arm/src/imx1/imx_cspi.h
@@ -178,7 +178,6 @@ extern "C"
************************************************************************************/
struct spi_dev_s; /* Forward reference */
-enum spi_dev_e; /* Forward reference */
/****************************************************************************
* Name: imx_spibus_initialize
@@ -225,10 +224,10 @@ FAR struct spi_dev_s *imx_spibus_initialize(int port);
*
****************************************************************************/
-void imx_spiselect(FAR struct spi_dev_s *dev, enum spi_dev_e devid, bool selected);
-uint8_t imx_spistatus(FAR struct spi_dev_s *dev, enum spi_dev_e devid);
+void imx_spiselect(FAR struct spi_dev_s *dev, uint32_t devid, bool selected);
+uint8_t imx_spistatus(FAR struct spi_dev_s *dev, uint32_t devid);
#ifdef CONFIG_SPI_CMDDATA
-int imx_spicmddata(FAR struct spi_dev_s *dev, enum spi_dev_e devid, bool cmd);
+int imx_spicmddata(FAR struct spi_dev_s *dev, uint32_t devid, bool cmd);
#endif
#undef EXTERN
diff --git a/arch/arm/src/imx6/imx_ecspi.c b/arch/arm/src/imx6/imx_ecspi.c
index 0199419681..2018c410bb 100644
--- a/arch/arm/src/imx6/imx_ecspi.c
+++ b/arch/arm/src/imx6/imx_ecspi.c
@@ -138,12 +138,12 @@
/* Per SPI callouts to board-specific logic */
typedef CODE void (*imx_select_t)(FAR struct spi_dev_s *dev,
- enum spi_dev_e devid, bool selected);
+ uint32_t devid, bool selected);
typedef CODE uint8_t (*imx_status_t)(FAR struct spi_dev_s *dev,
- enum spi_dev_e devid);
+ uint32_t devid);
#ifdef CONFIG_SPI_CMDDATA
typedef CODE int (*imx_cmddata_t)(FAR struct spi_dev_s *dev,
- enum spi_dev_e devid, bool cmd);
+ uint32_t devid, bool cmd);
#endif
struct imx_spidev_s
@@ -228,16 +228,16 @@ static int spi_interrupt(int irq, void *context, FAR void *arg);
/* SPI methods */
static int spi_lock(FAR struct spi_dev_s *dev, bool lock);
-static void spi_select(FAR struct spi_dev_s *dev, enum spi_dev_e devid,
+static void spi_select(FAR struct spi_dev_s *dev, uint32_t devid,
bool selected);
static uint32_t spi_setfrequency(FAR struct spi_dev_s *dev,
uint32_t frequency);
static void spi_setmode(FAR struct spi_dev_s *dev, enum spi_mode_e mode);
static void spi_setbits(FAR struct spi_dev_s *dev, int nbits);
static uint16_t spi_send(FAR struct spi_dev_s *dev, uint16_t wd);
-static uint8_t spi_status(FAR struct spi_dev_s *dev, enum spi_dev_e devid);
+static uint8_t spi_status(FAR struct spi_dev_s *dev, uint32_t devid);
#ifdef CONFIG_SPI_CMDDATA
-static int spi_cmddata(FAR struct spi_dev_s *dev, enum spi_dev_e devid,
+static int spi_cmddata(FAR struct spi_dev_s *dev, uint32_t devid,
bool cmd);
#endif
#ifdef CONFIG_SPI_EXCHANGE
@@ -835,7 +835,7 @@ static int spi_lock(FAR struct spi_dev_s *dev, bool lock)
*
****************************************************************************/
-static void spi_select(FAR struct spi_dev_s *dev, enum spi_dev_e devid,
+static void spi_select(FAR struct spi_dev_s *dev, uint32_t devid,
bool selected)
{
struct imx_spidev_s *priv = (struct imx_spidev_s *)dev;
@@ -1051,7 +1051,7 @@ static uint16_t spi_send(FAR struct spi_dev_s *dev, uint16_t wd)
*
****************************************************************************/
-static uint8_t spi_status(FAR struct spi_dev_s *dev, enum spi_dev_e devid)
+static uint8_t spi_status(FAR struct spi_dev_s *dev, uint32_t devid)
{
struct imx_spidev_s *priv = (struct imx_spidev_s *)dev;
uint8_t ret = 0;
@@ -1091,7 +1091,7 @@ static uint8_t spi_status(FAR struct spi_dev_s *dev, enum spi_dev_e devid)
****************************************************************************/
#ifdef CONFIG_SPI_CMDDATA
-static int spi_cmddata(FAR struct spi_dev_s *dev, enum spi_dev_e devid,
+static int spi_cmddata(FAR struct spi_dev_s *dev, uint32_t devid,
bool cmd)
{
struct imx_spidev_s *priv = (struct imx_spidev_s *)dev;
diff --git a/arch/arm/src/imx6/imx_ecspi.h b/arch/arm/src/imx6/imx_ecspi.h
index 40ca57c465..ac30d2291f 100644
--- a/arch/arm/src/imx6/imx_ecspi.h
+++ b/arch/arm/src/imx6/imx_ecspi.h
@@ -70,7 +70,6 @@ extern "C"
************************************************************************************/
struct spi_dev_s; /* Forward reference */
-enum spi_dev_e; /* Forward reference */
/************************************************************************************
* Name: imx_spibus_initialize
@@ -118,42 +117,42 @@ FAR struct spi_dev_s *imx_spibus_initialize(int port);
************************************************************************************/
#ifdef CONFIG_IMX6_ECSPI1
-void imx_spi1select(FAR struct spi_dev_s *dev, enum spi_dev_e devid, bool selected);
-uint8_t imx_spi1status(FAR struct spi_dev_s *dev, enum spi_dev_e devid);
+void imx_spi1select(FAR struct spi_dev_s *dev, uint32_t devid, bool selected);
+uint8_t imx_spi1status(FAR struct spi_dev_s *dev, uint32_t devid);
#ifdef CONFIG_SPI_CMDDATA
-int imx_spi1cmddata(FAR struct spi_dev_s *dev, enum spi_dev_e devid, bool cmd);
+int imx_spi1cmddata(FAR struct spi_dev_s *dev, uint32_t devid, bool cmd);
#endif
#endif
#ifdef CONFIG_IMX6_ECSPI2
-void imx_spi2select(FAR struct spi_dev_s *dev, enum spi_dev_e devid, bool selected);
-uint8_t imx_spi2status(FAR struct spi_dev_s *dev, enum spi_dev_e devid);
+void imx_spi2select(FAR struct spi_dev_s *dev, uint32_t devid, bool selected);
+uint8_t imx_spi2status(FAR struct spi_dev_s *dev, uint32_t devid);
#ifdef CONFIG_SPI_CMDDATA
-int imx_spi2cmddata(FAR struct spi_dev_s *dev, enum spi_dev_e devid, bool cmd);
+int imx_spi2cmddata(FAR struct spi_dev_s *dev, uint32_t devid, bool cmd);
#endif
#endif
#ifdef CONFIG_IMX6_ECSPI3
-void imx_spi3select(FAR struct spi_dev_s *dev, enum spi_dev_e devid, bool selected);
-uint8_t imx_spi3status(FAR struct spi_dev_s *dev, enum spi_dev_e devid);
+void imx_spi3select(FAR struct spi_dev_s *dev, uint32_t devid, bool selected);
+uint8_t imx_spi3status(FAR struct spi_dev_s *dev, uint32_t devid);
#ifdef CONFIG_SPI_CMDDATA
-int imx_spi3cmddata(FAR struct spi_dev_s *dev, enum spi_dev_e devid, bool cmd);
+int imx_spi3cmddata(FAR struct spi_dev_s *dev, uint32_t devid, bool cmd);
#endif
#endif
#ifdef CONFIG_IMX6_ECSPI4
-void imx_spi4select(FAR struct spi_dev_s *dev, enum spi_dev_e devid, bool selected);
-uint8_t imx_spi4status(FAR struct spi_dev_s *dev, enum spi_dev_e devid);
+void imx_spi4select(FAR struct spi_dev_s *dev, uint32_t devid, bool selected);
+uint8_t imx_spi4status(FAR struct spi_dev_s *dev, uint32_t devid);
#ifdef CONFIG_SPI_CMDDATA
-int imx_spi4cmddata(FAR struct spi_dev_s *dev, enum spi_dev_e devid, bool cmd);
+int imx_spi4cmddata(FAR struct spi_dev_s *dev, uint32_t devid, bool cmd);
#endif
#endif
#ifdef CONFIG_IMX6_ECSPI5
-void imx_spi5select(FAR struct spi_dev_s *dev, enum spi_dev_e devid, bool selected);
-uint8_t imx_spi5status(FAR struct spi_dev_s *dev, enum spi_dev_e devid);
+void imx_spi5select(FAR struct spi_dev_s *dev, uint32_t devid, bool selected);
+uint8_t imx_spi5status(FAR struct spi_dev_s *dev, uint32_t devid);
#ifdef CONFIG_SPI_CMDDATA
-int imx_spi5cmddata(FAR struct spi_dev_s *dev, enum spi_dev_e devid, bool cmd);
+int imx_spi5cmddata(FAR struct spi_dev_s *dev, uint32_t devid, bool cmd);
#endif
#endif
diff --git a/arch/arm/src/kinetis/kinetis_spi.h b/arch/arm/src/kinetis/kinetis_spi.h
index 19ce126d10..8222af4424 100644
--- a/arch/arm/src/kinetis/kinetis_spi.h
+++ b/arch/arm/src/kinetis/kinetis_spi.h
@@ -63,8 +63,7 @@ extern "C"
* Public Data
************************************************************************************/
-struct spi_dev_s;
-enum spi_dev_e;
+struct spi_dev_s;
/****************************************************************************
* Public Function Prototypes
@@ -115,24 +114,24 @@ FAR struct spi_dev_s *kinetis_spibus_initialize(int bus);
************************************************************************************/
#ifdef CONFIG_KINETIS_SPI0
-void kinetis_spi0select(FAR struct spi_dev_s *dev, enum spi_dev_e devid, bool selected);
-uint8_t kinetis_spi0status(FAR struct spi_dev_s *dev, enum spi_dev_e devid);
+void kinetis_spi0select(FAR struct spi_dev_s *dev, uint32_t devid, bool selected);
+uint8_t kinetis_spi0status(FAR struct spi_dev_s *dev, uint32_t devid);
#ifdef CONFIG_SPI_CMDDATA
-int kinetis_spi0cmddata(FAR struct spi_dev_s *dev, enum spi_dev_e devid, bool cmd);
+int kinetis_spi0cmddata(FAR struct spi_dev_s *dev, uint32_t devid, bool cmd);
#endif
#endif
#ifdef CONFIG_KINETIS_SPI1
-void kinetis_spi1select(FAR struct spi_dev_s *dev, enum spi_dev_e devid, bool selected);
-uint8_t kinetis_spi1status(FAR struct spi_dev_s *dev, enum spi_dev_e devid);
+void kinetis_spi1select(FAR struct spi_dev_s *dev, uint32_t devid, bool selected);
+uint8_t kinetis_spi1status(FAR struct spi_dev_s *dev, uint32_t devid);
#ifdef CONFIG_SPI_CMDDATA
-int kinetis_spi1cmddata(FAR struct spi_dev_s *dev, enum spi_dev_e devid, bool cmd);
+int kinetis_spi1cmddata(FAR struct spi_dev_s *dev, uint32_t devid, bool cmd);
#endif
#endif
#ifdef CONFIG_KINETIS_SPI2
-void kinetis_spi2select(FAR struct spi_dev_s *dev, enum spi_dev_e devid, bool selected);
-uint8_t kinetis_spi2status(FAR struct spi_dev_s *dev, enum spi_dev_e devid);
+void kinetis_spi2select(FAR struct spi_dev_s *dev, uint32_t devid, bool selected);
+uint8_t kinetis_spi2status(FAR struct spi_dev_s *dev, uint32_t devid);
#ifdef CONFIG_SPI_CMDDATA
-int kinetis_spi2cmddata(FAR struct spi_dev_s *dev, enum spi_dev_e devid, bool cmd);
+int kinetis_spi2cmddata(FAR struct spi_dev_s *dev, uint32_t devid, bool cmd);
#endif
#endif
diff --git a/arch/arm/src/kl/kl_spi.h b/arch/arm/src/kl/kl_spi.h
index 227ab9e6c5..fd621858a6 100644
--- a/arch/arm/src/kl/kl_spi.h
+++ b/arch/arm/src/kl/kl_spi.h
@@ -64,7 +64,6 @@ extern "C"
************************************************************************************/
struct spi_dev_s; /* Forward reference */
-enum spi_dev_e; /* Forward reference */
/****************************************************************************
* Name: kl_spibus_initialize
@@ -111,18 +110,18 @@ FAR struct spi_dev_s *kl_spibus_initialize(int port);
************************************************************************************/
#ifdef CONFIG_KL_SPI0
-void kl_spi0select(FAR struct spi_dev_s *dev, enum spi_dev_e devid, bool selected);
-uint8_t kl_spi0status(FAR struct spi_dev_s *dev, enum spi_dev_e devid);
+void kl_spi0select(FAR struct spi_dev_s *dev, uint32_t devid, bool selected);
+uint8_t kl_spi0status(FAR struct spi_dev_s *dev, uint32_t devid);
#ifdef CONFIG_SPI_CMDDATA
-int kl_spi0cmddata(FAR struct spi_dev_s *dev, enum spi_dev_e devid, bool cmd);
+int kl_spi0cmddata(FAR struct spi_dev_s *dev, uint32_t devid, bool cmd);
#endif
#endif
#ifdef CONFIG_KL_SPI1
-void kl_spi1select(FAR struct spi_dev_s *dev, enum spi_dev_e devid, bool selected);
-uint8_t kl_spi1status(FAR struct spi_dev_s *dev, enum spi_dev_e devid);
+void kl_spi1select(FAR struct spi_dev_s *dev, uint32_t devid, bool selected);
+uint8_t kl_spi1status(FAR struct spi_dev_s *dev, uint32_t devid);
#ifdef CONFIG_SPI_CMDDATA
-int kl_spi1cmddata(FAR struct spi_dev_s *dev, enum spi_dev_e devid, bool cmd);
+int kl_spi1cmddata(FAR struct spi_dev_s *dev, uint32_t devid, bool cmd);
#endif
#endif
diff --git a/arch/arm/src/lpc11xx/lpc11_spi.h b/arch/arm/src/lpc11xx/lpc11_spi.h
index dc8edfa904..1a6786d218 100644
--- a/arch/arm/src/lpc11xx/lpc11_spi.h
+++ b/arch/arm/src/lpc11xx/lpc11_spi.h
@@ -112,10 +112,10 @@ FAR struct spi_dev_s *lpc11_spibus_initialize(int port);
*
************************************************************************************/
-void lpc11_spiselect(FAR struct spi_dev_s *dev, enum spi_dev_e devid, bool selected);
-uint8_t lpc11_spistatus(FAR struct spi_dev_s *dev, enum spi_dev_e devid);
+void lpc11_spiselect(FAR struct spi_dev_s *dev, uint32_t devid, bool selected);
+uint8_t lpc11_spistatus(FAR struct spi_dev_s *dev, uint32_t devid);
#ifdef CONFIG_SPI_CMDDATA
-int lpc11_spicmddata(FAR struct spi_dev_s *dev, enum spi_dev_e devid, bool cmd);
+int lpc11_spicmddata(FAR struct spi_dev_s *dev, uint32_t devid, bool cmd);
#endif
/************************************************************************************
diff --git a/arch/arm/src/lpc11xx/lpc11_ssp.h b/arch/arm/src/lpc11xx/lpc11_ssp.h
index 9910650a30..f117b1cf03 100644
--- a/arch/arm/src/lpc11xx/lpc11_ssp.h
+++ b/arch/arm/src/lpc11xx/lpc11_ssp.h
@@ -113,18 +113,18 @@ FAR struct spi_dev_s *lpc11_sspbus_initialize(int port);
************************************************************************************/
#ifdef CONFIG_LPC11_SSP0
-void lpc11_ssp0select(FAR struct spi_dev_s *dev, enum spi_dev_e devid, bool selected);
-uint8_t lpc11_ssp0status(FAR struct spi_dev_s *dev, enum spi_dev_e devid);
+void lpc11_ssp0select(FAR struct spi_dev_s *dev, uint32_t devid, bool selected);
+uint8_t lpc11_ssp0status(FAR struct spi_dev_s *dev, uint32_t devid);
#ifdef CONFIG_SPI_CMDDATA
-int lpc11_ssp0cmddata(FAR struct spi_dev_s *dev, enum spi_dev_e devid, bool cmd);
+int lpc11_ssp0cmddata(FAR struct spi_dev_s *dev, uint32_t devid, bool cmd);
#endif
#endif
#ifdef CONFIG_LPC11_SSP1
-void lpc11_ssp1select(FAR struct spi_dev_s *dev, enum spi_dev_e devid, bool selected);
-uint8_t lpc11_ssp1status(FAR struct spi_dev_s *dev, enum spi_dev_e devid);
+void lpc11_ssp1select(FAR struct spi_dev_s *dev, uint32_t devid, bool selected);
+uint8_t lpc11_ssp1status(FAR struct spi_dev_s *dev, uint32_t devid);
#ifdef CONFIG_SPI_CMDDATA
-int lpc11_ssp1cmddata(FAR struct spi_dev_s *dev, enum spi_dev_e devid, bool cmd);
+int lpc11_ssp1cmddata(FAR struct spi_dev_s *dev, uint32_t devid, bool cmd);
#endif
#endif
diff --git a/arch/arm/src/lpc17xx/lpc17_spi.h b/arch/arm/src/lpc17xx/lpc17_spi.h
index c2eeea58f9..27d9ba8bb9 100644
--- a/arch/arm/src/lpc17xx/lpc17_spi.h
+++ b/arch/arm/src/lpc17xx/lpc17_spi.h
@@ -71,7 +71,6 @@ extern "C"
************************************************************************************/
struct spi_dev_s; /* Forward reference */
-enum spi_dev_e; /* Forward reference */
/************************************************************************************
* Name: lpc17_spibus_initialize
@@ -115,10 +114,10 @@ FAR struct spi_dev_s *lpc17_spibus_initialize(int port);
*
************************************************************************************/
-void lpc17_spiselect(FAR struct spi_dev_s *dev, enum spi_dev_e devid, bool selected);
-uint8_t lpc17_spistatus(FAR struct spi_dev_s *dev, enum spi_dev_e devid);
+void lpc17_spiselect(FAR struct spi_dev_s *dev, uint32_t devid, bool selected);
+uint8_t lpc17_spistatus(FAR struct spi_dev_s *dev, uint32_t devid);
#ifdef CONFIG_SPI_CMDDATA
-int lpc17_spicmddata(FAR struct spi_dev_s *dev, enum spi_dev_e devid, bool cmd);
+int lpc17_spicmddata(FAR struct spi_dev_s *dev, uint32_t devid, bool cmd);
#endif
/****************************************************************************
diff --git a/arch/arm/src/lpc17xx/lpc17_ssp.h b/arch/arm/src/lpc17xx/lpc17_ssp.h
index 6ea6375b13..c679206ca1 100644
--- a/arch/arm/src/lpc17xx/lpc17_ssp.h
+++ b/arch/arm/src/lpc17xx/lpc17_ssp.h
@@ -113,18 +113,18 @@ FAR struct spi_dev_s *lpc17_sspbus_initialize(int port);
************************************************************************************/
#ifdef CONFIG_LPC17_SSP0
-void lpc17_ssp0select(FAR struct spi_dev_s *dev, enum spi_dev_e devid, bool selected);
-uint8_t lpc17_ssp0status(FAR struct spi_dev_s *dev, enum spi_dev_e devid);
+void lpc17_ssp0select(FAR struct spi_dev_s *dev, uint32_t devid, bool selected);
+uint8_t lpc17_ssp0status(FAR struct spi_dev_s *dev, uint32_t devid);
#ifdef CONFIG_SPI_CMDDATA
-int lpc17_ssp0cmddata(FAR struct spi_dev_s *dev, enum spi_dev_e devid, bool cmd);
+int lpc17_ssp0cmddata(FAR struct spi_dev_s *dev, uint32_t devid, bool cmd);
#endif
#endif
#ifdef CONFIG_LPC17_SSP1
-void lpc17_ssp1select(FAR struct spi_dev_s *dev, enum spi_dev_e devid, bool selected);
-uint8_t lpc17_ssp1status(FAR struct spi_dev_s *dev, enum spi_dev_e devid);
+void lpc17_ssp1select(FAR struct spi_dev_s *dev, uint32_t devid, bool selected);
+uint8_t lpc17_ssp1status(FAR struct spi_dev_s *dev, uint32_t devid);
#ifdef CONFIG_SPI_CMDDATA
-int lpc17_ssp1cmddata(FAR struct spi_dev_s *dev, enum spi_dev_e devid, bool cmd);
+int lpc17_ssp1cmddata(FAR struct spi_dev_s *dev, uint32_t devid, bool cmd);
#endif
#endif
diff --git a/arch/arm/src/lpc2378/lpc23xx_spi.h b/arch/arm/src/lpc2378/lpc23xx_spi.h
index f701c9e1f9..8b5fbda37c 100644
--- a/arch/arm/src/lpc2378/lpc23xx_spi.h
+++ b/arch/arm/src/lpc2378/lpc23xx_spi.h
@@ -154,7 +154,6 @@
************************************************************************************/
struct spi_dev_s; /* Forward reference */
-enum spi_dev_e; /* Forward reference */
/****************************************************************************
* Name: lpc23_spibus_initialize
@@ -178,7 +177,7 @@ FAR struct spi_dev_s *lpc23_spibus_initialize(int port);
*
****************************************************************************/
-void lpc23xx_spiselect(FAR struct spi_dev_s *dev, enum spi_dev_e devid, bool selected);
-uint8_t lpc23xx_spistatus(FAR struct spi_dev_s *dev, enum spi_dev_e devid);
+void lpc23xx_spiselect(FAR struct spi_dev_s *dev, uint32_t devid, bool selected);
+uint8_t lpc23xx_spistatus(FAR struct spi_dev_s *dev, uint32_t devid);
#endif /* __ARCH_ARM_SRC_LPC2378_LPC23XX_SPI_H */
diff --git a/arch/arm/src/lpc31xx/lpc31.h b/arch/arm/src/lpc31xx/lpc31.h
index 4a342a9a83..00ce6b8e35 100644
--- a/arch/arm/src/lpc31xx/lpc31.h
+++ b/arch/arm/src/lpc31xx/lpc31.h
@@ -185,8 +185,6 @@ void lpc31_clockconfig(void);
************************************************************************************/
struct spi_dev_s; /* Forward reference */
-enum spi_dev_e; /* Forward reference */
-
FAR struct spi_dev_s *lpc31_spibus_initialize(int port);
/************************************************************************************
@@ -218,10 +216,10 @@ FAR struct spi_dev_s *lpc31_spibus_initialize(int port);
*
************************************************************************************/
-void lpc31_spiselect(FAR struct spi_dev_s *dev, enum spi_dev_e devid, bool selected);
-uint8_t lpc31_spistatus(FAR struct spi_dev_s *dev, enum spi_dev_e devid);
+void lpc31_spiselect(FAR struct spi_dev_s *dev, uint32_t devid, bool selected);
+uint8_t lpc31_spistatus(FAR struct spi_dev_s *dev, uint32_t devid);
#ifdef CONFIG_SPI_CMDDATA
-int lpc31_spicmddata(FAR struct spi_dev_s *dev, enum spi_dev_e devid, bool cmd);
+int lpc31_spicmddata(FAR struct spi_dev_s *dev, uint32_t devid, bool cmd);
#endif
/************************************************************************************
diff --git a/arch/arm/src/lpc31xx/lpc31_spi.c b/arch/arm/src/lpc31xx/lpc31_spi.c
index ca2544bc26..871eca69da 100644
--- a/arch/arm/src/lpc31xx/lpc31_spi.c
+++ b/arch/arm/src/lpc31xx/lpc31_spi.c
@@ -115,11 +115,11 @@ static inline uint16_t spi_readword(FAR struct lpc31_spidev_s *priv);
static inline void spi_writeword(FAR struct lpc31_spidev_s *priv, uint16_t word);
static int spi_lock(FAR struct spi_dev_s *dev, bool lock);
-static void spi_select(FAR struct spi_dev_s *dev, enum spi_dev_e devid, bool selected);
+static void spi_select(FAR struct spi_dev_s *dev, uint32_t devid, bool selected);
static uint32_t spi_setfrequency(FAR struct spi_dev_s *dev, uint32_t frequency);
static void spi_setmode(FAR struct spi_dev_s *dev, enum spi_mode_e mode);
static void spi_setbits(FAR struct spi_dev_s *dev, int nbits);
-static uint8_t spi_status(FAR struct spi_dev_s *dev, enum spi_dev_e devid);
+static uint8_t spi_status(FAR struct spi_dev_s *dev, uint32_t devid);
static uint16_t spi_send(FAR struct spi_dev_s *dev, uint16_t word);
static void spi_exchange(FAR struct spi_dev_s *dev, FAR const void *txbuffer,
FAR void *rxbuffer, size_t nwords);
@@ -482,7 +482,7 @@ static int spi_lock(FAR struct spi_dev_s *dev, bool lock)
*
****************************************************************************/
-static void spi_select(FAR struct spi_dev_s *dev, enum spi_dev_e devid, bool selected)
+static void spi_select(FAR struct spi_dev_s *dev, uint32_t devid, bool selected)
{
struct lpc31_spidev_s *priv = (struct lpc31_spidev_s *) dev;
uint8_t slave = 0;
@@ -491,15 +491,15 @@ static void spi_select(FAR struct spi_dev_s *dev, enum spi_dev_e devid, bool sel
* be in board specific code..... */
switch (devid)
{
- case SPIDEV_FLASH:
+ case SPIDEV_FLASH(0):
slave = 0;
break;
- case SPIDEV_MMCSD:
+ case SPIDEV_MMCSD(0):
slave = 1;
break;
- case SPIDEV_ETHERNET:
+ case SPIDEV_ETHERNET(0):
slave = 2;
break;
@@ -689,7 +689,7 @@ static void spi_setbits(FAR struct spi_dev_s *dev, int nbits)
*
****************************************************************************/
-static uint8_t spi_status(FAR struct spi_dev_s *dev, enum spi_dev_e devid)
+static uint8_t spi_status(FAR struct spi_dev_s *dev, uint32_t devid)
{
/* FIXME: is there anyway to determine this
* it should probably be board dependant anyway */
diff --git a/arch/arm/src/lpc43xx/lpc43_spi.c b/arch/arm/src/lpc43xx/lpc43_spi.c
index e30b39bf25..43e7e08052 100644
--- a/arch/arm/src/lpc43xx/lpc43_spi.c
+++ b/arch/arm/src/lpc43xx/lpc43_spi.c
@@ -103,7 +103,7 @@ struct lpc43_spidev_s
/* SPI methods */
static int spi_lock(FAR struct spi_dev_s *dev, bool lock);
-static void spi_select(FAR struct spi_dev_s *dev, enum spi_dev_e devid, bool selected);
+static void spi_select(FAR struct spi_dev_s *dev, uint32_t devid, bool selected);
static uint32_t spi_setfrequency(FAR struct spi_dev_s *dev, uint32_t frequency);
static void spi_setmode(FAR struct spi_dev_s *dev, enum spi_mode_e mode);
static void spi_setbits(FAR struct spi_dev_s *dev, int nbits);
diff --git a/arch/arm/src/lpc43xx/lpc43_spi.h b/arch/arm/src/lpc43xx/lpc43_spi.h
index 42ade41b1a..d0414f9af6 100644
--- a/arch/arm/src/lpc43xx/lpc43_spi.h
+++ b/arch/arm/src/lpc43xx/lpc43_spi.h
@@ -122,11 +122,11 @@ FAR struct spi_dev_s *lpc43_spibus_initialize(int port);
*
************************************************************************************/
-void lpc43_spiselect(FAR struct spi_dev_s *dev, enum spi_dev_e devid, bool selected);
-uint8_t lpc43_spistatus(FAR struct spi_dev_s *dev, enum spi_dev_e devid);
+void lpc43_spiselect(FAR struct spi_dev_s *dev, uint32_t devid, bool selected);
+uint8_t lpc43_spistatus(FAR struct spi_dev_s *dev, uint32_t devid);
#ifdef CONFIG_SPI_CMDDATA
-int lpc43_spicmddata(FAR struct spi_dev_s *dev, enum spi_dev_e devid, bool cmd);
+int lpc43_spicmddata(FAR struct spi_dev_s *dev, uint32_t devid, bool cmd);
#endif
/************************************************************************************
diff --git a/arch/arm/src/lpc43xx/lpc43_ssp.h b/arch/arm/src/lpc43xx/lpc43_ssp.h
index 1c98618cbf..5bf708859e 100644
--- a/arch/arm/src/lpc43xx/lpc43_ssp.h
+++ b/arch/arm/src/lpc43xx/lpc43_ssp.h
@@ -121,18 +121,18 @@ FAR struct spi_dev_s *lpc43_sspbus_initialize(int port);
************************************************************************************/
#ifdef CONFIG_LPC43_SSP0
-void lpc43_ssp0select(FAR struct spi_dev_s *dev, enum spi_dev_e devid, bool selected);
-uint8_t lpc43_ssp0status(FAR struct spi_dev_s *dev, enum spi_dev_e devid);
+void lpc43_ssp0select(FAR struct spi_dev_s *dev, uint32_t devid, bool selected);
+uint8_t lpc43_ssp0status(FAR struct spi_dev_s *dev, uint32_t devid);
#ifdef CONFIG_SPI_CMDDATA
-int lpc43_ssp0cmddata(FAR struct spi_dev_s *dev, enum spi_dev_e devid, bool cmd);
+int lpc43_ssp0cmddata(FAR struct spi_dev_s *dev, uint32_t devid, bool cmd);
#endif
#endif
#ifdef CONFIG_LPC43_SSP1
-void lpc43_ssp1select(FAR struct spi_dev_s *dev, enum spi_dev_e devid, bool selected);
-uint8_t lpc43_ssp1status(FAR struct spi_dev_s *dev, enum spi_dev_e devid);
+void lpc43_ssp1select(FAR struct spi_dev_s *dev, uint32_t devid, bool selected);
+uint8_t lpc43_ssp1status(FAR struct spi_dev_s *dev, uint32_t devid);
#ifdef CONFIG_SPI_CMDDATA
-int lpc43_ssp1cmddata(FAR struct spi_dev_s *dev, enum spi_dev_e devid, bool cmd);
+int lpc43_ssp1cmddata(FAR struct spi_dev_s *dev, uint32_t devid, bool cmd);
#endif
#endif
diff --git a/arch/arm/src/sam34/sam_spi.c b/arch/arm/src/sam34/sam_spi.c
index 2cbe3614b6..899eb9bc2e 100644
--- a/arch/arm/src/sam34/sam_spi.c
+++ b/arch/arm/src/sam34/sam_spi.c
@@ -190,7 +190,7 @@ struct sam_spics_s
/* Type of board-specific SPI status function */
-typedef void (*select_t)(enum spi_dev_e devid, bool selected);
+typedef void (*select_t)(uint32_t devid, bool selected);
/* Chip select register offsetrs */
@@ -272,7 +272,7 @@ static inline uintptr_t spi_regaddr(struct sam_spics_s *spics,
/* SPI methods */
static int spi_lock(struct spi_dev_s *dev, bool lock);
-static void spi_select(struct spi_dev_s *dev, enum spi_dev_e devid,
+static void spi_select(struct spi_dev_s *dev, uint32_t devid,
bool selected);
static uint32_t spi_setfrequency(struct spi_dev_s *dev, uint32_t frequency);
static void spi_setmode(struct spi_dev_s *dev, enum spi_mode_e mode);
@@ -916,7 +916,7 @@ static int spi_lock(struct spi_dev_s *dev, bool lock)
*
****************************************************************************/
-static void spi_select(struct spi_dev_s *dev, enum spi_dev_e devid,
+static void spi_select(struct spi_dev_s *dev, uint32_t devid,
bool selected)
{
struct sam_spics_s *spics = (struct sam_spics_s *)dev;
diff --git a/arch/arm/src/sam34/sam_spi.h b/arch/arm/src/sam34/sam_spi.h
index 1d37d340d4..8cebb2f121 100644
--- a/arch/arm/src/sam34/sam_spi.h
+++ b/arch/arm/src/sam34/sam_spi.h
@@ -110,7 +110,6 @@ extern "C"
****************************************************************************/
struct spi_dev_s; /* Forward reference */
-enum spi_dev_e; /* Forward reference */
/****************************************************************************
* Name: sam_spibus_initialize
@@ -189,10 +188,10 @@ struct spi_dev_s *sam_spibus_initialize(int port);
****************************************************************************/
#ifdef CONFIG_SAM34_SPI0
-void sam_spi0select(enum spi_dev_e devid, bool selected);
+void sam_spi0select(uint32_t devid, bool selected);
#endif
#ifdef CONFIG_SAM34_SPI1
-void sam_spi1select(enum spi_dev_e devid, bool selected);
+void sam_spi1select(uint32_t devid, bool selected);
#endif
/****************************************************************************
@@ -211,10 +210,10 @@ void sam_spi1select(enum spi_dev_e devid, bool selected);
****************************************************************************/
#ifdef CONFIG_SAM34_SPI0
-uint8_t sam_spi0status(FAR struct spi_dev_s *dev, enum spi_dev_e devid);
+uint8_t sam_spi0status(FAR struct spi_dev_s *dev, uint32_t devid);
#endif
#ifdef CONFIG_SAM34_SPI1
-uint8_t sam_spi1status(FAR struct spi_dev_s *dev, enum spi_dev_e devid);
+uint8_t sam_spi1status(FAR struct spi_dev_s *dev, uint32_t devid);
#endif
/****************************************************************************
@@ -243,10 +242,10 @@ uint8_t sam_spi1status(FAR struct spi_dev_s *dev, enum spi_dev_e devid);
#ifdef CONFIG_SPI_CMDDATA
#ifdef CONFIG_SAM34_SPI0
-int sam_spi0cmddata(FAR struct spi_dev_s *dev, enum spi_dev_e devid, bool cmd);
+int sam_spi0cmddata(FAR struct spi_dev_s *dev, uint32_t devid, bool cmd);
#endif
#ifdef CONFIG_SAM34_SPI1
-int sam_spi1cmddata(FAR struct spi_dev_s *dev, enum spi_dev_e devid, bool cmd);
+int sam_spi1cmddata(FAR struct spi_dev_s *dev, uint32_t devid, bool cmd);
#endif
#endif
diff --git a/arch/arm/src/sama5/sam_spi.c b/arch/arm/src/sama5/sam_spi.c
index 459e949cad..cda2a36f97 100644
--- a/arch/arm/src/sama5/sam_spi.c
+++ b/arch/arm/src/sama5/sam_spi.c
@@ -182,7 +182,7 @@ struct sam_spics_s
/* Type of board-specific SPI status fuction */
-typedef void (*select_t)(enum spi_dev_e devid, bool selected);
+typedef void (*select_t)(uint32_t devid, bool selected);
/* Chip select register offsetrs */
@@ -263,7 +263,7 @@ static inline uintptr_t spi_physregaddr(struct sam_spics_s *spics,
/* SPI methods */
static int spi_lock(struct spi_dev_s *dev, bool lock);
-static void spi_select(struct spi_dev_s *dev, enum spi_dev_e devid,
+static void spi_select(struct spi_dev_s *dev, uint32_t devid,
bool selected);
static uint32_t spi_setfrequency(struct spi_dev_s *dev, uint32_t frequency);
static void spi_setmode(struct spi_dev_s *dev, enum spi_mode_e mode);
@@ -905,7 +905,7 @@ static int spi_lock(struct spi_dev_s *dev, bool lock)
*
****************************************************************************/
-static void spi_select(struct spi_dev_s *dev, enum spi_dev_e devid,
+static void spi_select(struct spi_dev_s *dev, uint32_t devid,
bool selected)
{
struct sam_spics_s *spics = (struct sam_spics_s *)dev;
diff --git a/arch/arm/src/sama5/sam_spi.h b/arch/arm/src/sama5/sam_spi.h
index cf98863937..705f2248e7 100644
--- a/arch/arm/src/sama5/sam_spi.h
+++ b/arch/arm/src/sama5/sam_spi.h
@@ -104,7 +104,6 @@ extern "C"
****************************************************************************/
struct spi_dev_s; /* Forward reference */
-enum spi_dev_e; /* Forward reference */
/****************************************************************************
* Name: sam_spibus_initialize
@@ -182,10 +181,10 @@ struct spi_dev_s *sam_spibus_initialize(int port);
****************************************************************************/
#ifdef CONFIG_SAMA5_SPI0
-void sam_spi0select(enum spi_dev_e devid, bool selected);
+void sam_spi0select(uint32_t devid, bool selected);
#endif
#ifdef CONFIG_SAMA5_SPI1
-void sam_spi1select(enum spi_dev_e devid, bool selected);
+void sam_spi1select(uint32_t devid, bool selected);
#endif
/****************************************************************************
@@ -204,10 +203,10 @@ void sam_spi1select(enum spi_dev_e devid, bool selected);
****************************************************************************/
#ifdef CONFIG_SAMA5_SPI0
-uint8_t sam_spi0status(FAR struct spi_dev_s *dev, enum spi_dev_e devid);
+uint8_t sam_spi0status(FAR struct spi_dev_s *dev, uint32_t devid);
#endif
#ifdef CONFIG_SAMA5_SPI1
-uint8_t sam_spi1status(FAR struct spi_dev_s *dev, enum spi_dev_e devid);
+uint8_t sam_spi1status(FAR struct spi_dev_s *dev, uint32_t devid);
#endif
/****************************************************************************
@@ -236,10 +235,10 @@ uint8_t sam_spi1status(FAR struct spi_dev_s *dev, enum spi_dev_e devid);
#ifdef CONFIG_SPI_CMDDATA
#ifdef CONFIG_SAMA5_SPI0
-int sam_spi0cmddata(FAR struct spi_dev_s *dev, enum spi_dev_e devid, bool cmd);
+int sam_spi0cmddata(FAR struct spi_dev_s *dev, uint32_t devid, bool cmd);
#endif
#ifdef CONFIG_SAMA5_SPI1
-int sam_spi1cmddata(FAR struct spi_dev_s *dev, enum spi_dev_e devid, bool cmd);
+int sam_spi1cmddata(FAR struct spi_dev_s *dev, uint32_t devid, bool cmd);
#endif
#endif
diff --git a/arch/arm/src/samdl/sam_spi.h b/arch/arm/src/samdl/sam_spi.h
index 6185a5b3f0..7e0cbfa9e0 100644
--- a/arch/arm/src/samdl/sam_spi.h
+++ b/arch/arm/src/samdl/sam_spi.h
@@ -87,7 +87,6 @@ extern "C"
****************************************************************************/
struct spi_dev_s; /* Forward reference */
-enum spi_dev_e; /* Forward reference */
/****************************************************************************
* Name: sam_spibus_initialize
@@ -168,32 +167,32 @@ struct spi_dev_s *sam_spibus_initialize(int port);
****************************************************************************/
#ifdef SAMDL_HAVE_SPI0
-void sam_spi0select(FAR struct spi_dev_s *dev, enum spi_dev_e devid,
+void sam_spi0select(FAR struct spi_dev_s *dev, uint32_t devid,
bool selected);
#endif
#ifdef SAMDL_HAVE_SPI1
-void sam_spi1select(FAR struct spi_dev_s *dev, enum spi_dev_e devid,
+void sam_spi1select(FAR struct spi_dev_s *dev, uint32_t devid,
bool selected);
#endif
#ifdef SAMDL_HAVE_SPI2
-void sam_spi2select(FAR struct spi_dev_s *dev, enum spi_dev_e devid,
+void sam_spi2select(FAR struct spi_dev_s *dev, uint32_t devid,
bool selected);
#endif
#ifdef SAMDL_HAVE_SPI3
-void sam_spi3select(FAR struct spi_dev_s *dev, enum spi_dev_e devid,
+void sam_spi3select(FAR struct spi_dev_s *dev, uint32_t devid,
bool selected);
#endif
#ifdef SAMDL_HAVE_SPI4
-void sam_spi4select(FAR struct spi_dev_s *dev, enum spi_dev_e devid,
+void sam_spi4select(FAR struct spi_dev_s *dev, uint32_t devid,
bool selected);
#endif
#ifdef SAMDL_HAVE_SPI5
-void sam_spi5select(FAR struct spi_dev_s *dev, enum spi_dev_e devid,
+void sam_spi5select(FAR struct spi_dev_s *dev, uint32_t devid,
bool selected);
#endif
@@ -213,27 +212,27 @@ void sam_spi5select(FAR struct spi_dev_s *dev, enum spi_dev_e devid,
****************************************************************************/
#ifdef SAMDL_HAVE_SPI0
-uint8_t sam_spi0status(FAR struct spi_dev_s *dev, enum spi_dev_e devid);
+uint8_t sam_spi0status(FAR struct spi_dev_s *dev, uint32_t devid);
#endif
#ifdef SAMDL_HAVE_SPI1
-uint8_t sam_spi1status(FAR struct spi_dev_s *dev, enum spi_dev_e devid);
+uint8_t sam_spi1status(FAR struct spi_dev_s *dev, uint32_t devid);
#endif
#ifdef SAMDL_HAVE_SPI2
-uint8_t sam_spi2status(FAR struct spi_dev_s *dev, enum spi_dev_e devid);
+uint8_t sam_spi2status(FAR struct spi_dev_s *dev, uint32_t devid);
#endif
#ifdef SAMDL_HAVE_SPI3
-uint8_t sam_spi3status(FAR struct spi_dev_s *dev, enum spi_dev_e devid);
+uint8_t sam_spi3status(FAR struct spi_dev_s *dev, uint32_t devid);
#endif
#ifdef SAMDL_HAVE_SPI4
-uint8_t sam_spi4status(FAR struct spi_dev_s *dev, enum spi_dev_e devid);
+uint8_t sam_spi4status(FAR struct spi_dev_s *dev, uint32_t devid);
#endif
#ifdef SAMDL_HAVE_SPI5
-uint8_t sam_spi5status(FAR struct spi_dev_s *dev, enum spi_dev_e devid);
+uint8_t sam_spi5status(FAR struct spi_dev_s *dev, uint32_t devid);
#endif
/****************************************************************************
@@ -262,27 +261,27 @@ uint8_t sam_spi5status(FAR struct spi_dev_s *dev, enum spi_dev_e devid);
#ifdef CONFIG_SPI_CMDDATA
#ifdef SAMDL_HAVE_SPI0
-int sam_spi0cmddata(FAR struct spi_dev_s *dev, enum spi_dev_e devid, bool cmd);
+int sam_spi0cmddata(FAR struct spi_dev_s *dev, uint32_t devid, bool cmd);
#endif
#ifdef SAMDL_HAVE_SPI1
-int sam_spi1cmddata(FAR struct spi_dev_s *dev, enum spi_dev_e devid, bool cmd);
+int sam_spi1cmddata(FAR struct spi_dev_s *dev, uint32_t devid, bool cmd);
#endif
#ifdef SAMDL_HAVE_SPI2
-int sam_spi2cmddata(FAR struct spi_dev_s *dev, enum spi_dev_e devid, bool cmd);
+int sam_spi2cmddata(FAR struct spi_dev_s *dev, uint32_t devid, bool cmd);
#endif
#ifdef SAMDL_HAVE_SPI3
-int sam_spi3cmddata(FAR struct spi_dev_s *dev, enum spi_dev_e devid, bool cmd);
+int sam_spi3cmddata(FAR struct spi_dev_s *dev, uint32_t devid, bool cmd);
#endif
#ifdef SAMDL_HAVE_SPI4
-int sam_spi4cmddata(FAR struct spi_dev_s *dev, enum spi_dev_e devid, bool cmd);
+int sam_spi4cmddata(FAR struct spi_dev_s *dev, uint32_t devid, bool cmd);
#endif
#ifdef SAMDL_HAVE_SPI5
-int sam_spi5cmddata(FAR struct spi_dev_s *dev, enum spi_dev_e devid, bool cmd);
+int sam_spi5cmddata(FAR struct spi_dev_s *dev, uint32_t devid, bool cmd);
#endif
#endif
diff --git a/arch/arm/src/samv7/sam_spi.c b/arch/arm/src/samv7/sam_spi.c
index de1dec1615..a1df892188 100644
--- a/arch/arm/src/samv7/sam_spi.c
+++ b/arch/arm/src/samv7/sam_spi.c
@@ -181,7 +181,7 @@ struct sam_spics_s
/* Type of board-specific SPI status function */
-typedef void (*select_t)(enum spi_dev_e devid, bool selected);
+typedef void (*select_t)(uint32_t devid, bool selected);
/* Chip select register offsets */
@@ -263,7 +263,7 @@ static inline uintptr_t spi_regaddr(struct sam_spics_s *spics,
/* SPI master methods */
static int spi_lock(struct spi_dev_s *dev, bool lock);
-static void spi_select(struct spi_dev_s *dev, enum spi_dev_e devid,
+static void spi_select(struct spi_dev_s *dev, uint32_t devid,
bool selected);
static uint32_t spi_setfrequency(struct spi_dev_s *dev, uint32_t frequency);
#ifdef CONFIG_SPI_CS_DELAY_CONTROL
@@ -943,7 +943,7 @@ static int spi_lock(struct spi_dev_s *dev, bool lock)
*
****************************************************************************/
-static void spi_select(struct spi_dev_s *dev, enum spi_dev_e devid,
+static void spi_select(struct spi_dev_s *dev, uint32_t devid,
bool selected)
{
struct sam_spics_s *spics = (struct sam_spics_s *)dev;
diff --git a/arch/arm/src/samv7/sam_spi.h b/arch/arm/src/samv7/sam_spi.h
index dded642534..762f34f67d 100644
--- a/arch/arm/src/samv7/sam_spi.h
+++ b/arch/arm/src/samv7/sam_spi.h
@@ -158,7 +158,6 @@ extern "C"
****************************************************************************/
struct spi_dev_s; /* Forward reference */
-enum spi_dev_e; /* Forward reference */
struct spi_sctrlr_s; /* Forward reference */
/****************************************************************************
@@ -255,10 +254,10 @@ FAR struct spi_sctrlr_s *sam_spi_slave_initialize(int port);
****************************************************************************/
#ifdef CONFIG_SAMV7_SPI0_MASTER
-void sam_spi0select(enum spi_dev_e devid, bool selected);
+void sam_spi0select(uint32_t devid, bool selected);
#endif
#ifdef CONFIG_SAMV7_SPI1_MASTER
-void sam_spi1select(enum spi_dev_e devid, bool selected);
+void sam_spi1select(uint32_t devid, bool selected);
#endif
/****************************************************************************
@@ -277,10 +276,10 @@ void sam_spi1select(enum spi_dev_e devid, bool selected);
****************************************************************************/
#ifdef CONFIG_SAMV7_SPI0
-uint8_t sam_spi0status(FAR struct spi_dev_s *dev, enum spi_dev_e devid);
+uint8_t sam_spi0status(FAR struct spi_dev_s *dev, uint32_t devid);
#endif
#ifdef CONFIG_SAMV7_SPI1
-uint8_t sam_spi1status(FAR struct spi_dev_s *dev, enum spi_dev_e devid);
+uint8_t sam_spi1status(FAR struct spi_dev_s *dev, uint32_t devid);
#endif
/****************************************************************************
@@ -309,10 +308,10 @@ uint8_t sam_spi1status(FAR struct spi_dev_s *dev, enum spi_dev_e devid);
#ifdef CONFIG_SPI_CMDDATA
#ifdef CONFIG_SAMV7_SPI0_MASTER
-int sam_spi0cmddata(FAR struct spi_dev_s *dev, enum spi_dev_e devid, bool cmd);
+int sam_spi0cmddata(FAR struct spi_dev_s *dev, uint32_t devid, bool cmd);
#endif
#ifdef CONFIG_SAMV7_SPI1_MASTER
-int sam_spi1cmddata(FAR struct spi_dev_s *dev, enum spi_dev_e devid, bool cmd);
+int sam_spi1cmddata(FAR struct spi_dev_s *dev, uint32_t devid, bool cmd);
#endif
#endif /* CONFIG_SPI_CMDDATA */
diff --git a/arch/arm/src/stm32/stm32_rcc.h b/arch/arm/src/stm32/stm32_rcc.h
index d331ab90b6..79949cd60c 100644
--- a/arch/arm/src/stm32/stm32_rcc.h
+++ b/arch/arm/src/stm32/stm32_rcc.h
@@ -33,8 +33,8 @@
*
************************************************************************************/
-#ifndef __ARCH_ARM_SRC_STM32_STM32_RRC_H
-#define __ARCH_ARM_SRC_STM32_STM32_RRC_H
+#ifndef __ARCH_ARM_SRC_STM32_STM32_RCC_H
+#define __ARCH_ARM_SRC_STM32_STM32_RCC_H
/************************************************************************************
* Included Files
@@ -299,11 +299,7 @@ void stm32_clockenable(void);
* Name: stm32_rcc_enablelse
*
* Description:
- * Enable the External Low-Speed (LSE) Oscillator and, if the RTC is
- * configured, setup the LSE as the RTC clock source, and enable the RTC.
- *
- * For the STM32L15X family, this will also select the LSE as the clock source of
- * the LCD.
+ * Enable the External Low-Speed (LSE) Oscillator.
*
* Input Parameters:
* None
@@ -340,4 +336,4 @@ void stm32_rcc_disablelsi(void);
}
#endif
#endif /* __ASSEMBLY__ */
-#endif /* __ARCH_ARM_SRC_STM32_STM32_RRC_H */
+#endif /* __ARCH_ARM_SRC_STM32_STM32_RCC_H */
diff --git a/arch/arm/src/stm32/stm32_spi.h b/arch/arm/src/stm32/stm32_spi.h
index a9d336cb86..9c757db523 100644
--- a/arch/arm/src/stm32/stm32_spi.h
+++ b/arch/arm/src/stm32/stm32_spi.h
@@ -64,8 +64,7 @@ extern "C"
* Public Data
************************************************************************************/
-struct spi_dev_s;
-enum spi_dev_e;
+struct spi_dev_s;
/************************************************************************************
* Public Functions
@@ -117,39 +116,39 @@ FAR struct spi_dev_s *stm32_spibus_initialize(int bus);
************************************************************************************/
#ifdef CONFIG_STM32_SPI1
-void stm32_spi1select(FAR struct spi_dev_s *dev, enum spi_dev_e devid, bool selected);
-uint8_t stm32_spi1status(FAR struct spi_dev_s *dev, enum spi_dev_e devid);
-int stm32_spi1cmddata(FAR struct spi_dev_s *dev, enum spi_dev_e devid, bool cmd);
+void stm32_spi1select(FAR struct spi_dev_s *dev, uint32_t devid, bool selected);
+uint8_t stm32_spi1status(FAR struct spi_dev_s *dev, uint32_t devid);
+int stm32_spi1cmddata(FAR struct spi_dev_s *dev, uint32_t devid, bool cmd);
#endif
#ifdef CONFIG_STM32_SPI2
-void stm32_spi2select(FAR struct spi_dev_s *dev, enum spi_dev_e devid, bool selected);
-uint8_t stm32_spi2status(FAR struct spi_dev_s *dev, enum spi_dev_e devid);
-int stm32_spi2cmddata(FAR struct spi_dev_s *dev, enum spi_dev_e devid, bool cmd);
+void stm32_spi2select(FAR struct spi_dev_s *dev, uint32_t devid, bool selected);
+uint8_t stm32_spi2status(FAR struct spi_dev_s *dev, uint32_t devid);
+int stm32_spi2cmddata(FAR struct spi_dev_s *dev, uint32_t devid, bool cmd);
#endif
#ifdef CONFIG_STM32_SPI3
-void stm32_spi3select(FAR struct spi_dev_s *dev, enum spi_dev_e devid, bool selected);
-uint8_t stm32_spi3status(FAR struct spi_dev_s *dev, enum spi_dev_e devid);
-int stm32_spi3cmddata(FAR struct spi_dev_s *dev, enum spi_dev_e devid, bool cmd);
+void stm32_spi3select(FAR struct spi_dev_s *dev, uint32_t devid, bool selected);
+uint8_t stm32_spi3status(FAR struct spi_dev_s *dev, uint32_t devid);
+int stm32_spi3cmddata(FAR struct spi_dev_s *dev, uint32_t devid, bool cmd);
#endif
#ifdef CONFIG_STM32_SPI4
-void stm32_spi4select(FAR struct spi_dev_s *dev, enum spi_dev_e devid, bool selected);
-uint8_t stm32_spi4status(FAR struct spi_dev_s *dev, enum spi_dev_e devid);
-int stm32_spi4cmddata(FAR struct spi_dev_s *dev, enum spi_dev_e devid, bool cmd);
+void stm32_spi4select(FAR struct spi_dev_s *dev, uint32_t devid, bool selected);
+uint8_t stm32_spi4status(FAR struct spi_dev_s *dev, uint32_t devid);
+int stm32_spi4cmddata(FAR struct spi_dev_s *dev, uint32_t devid, bool cmd);
#endif
#ifdef CONFIG_STM32_SPI5
-void stm32_spi5select(FAR struct spi_dev_s *dev, enum spi_dev_e devid, bool selected);
-uint8_t stm32_spi5status(FAR struct spi_dev_s *dev, enum spi_dev_e devid);
-int stm32_spi5cmddata(FAR struct spi_dev_s *dev, enum spi_dev_e devid, bool cmd);
+void stm32_spi5select(FAR struct spi_dev_s *dev, uint32_t devid, bool selected);
+uint8_t stm32_spi5status(FAR struct spi_dev_s *dev, uint32_t devid);
+int stm32_spi5cmddata(FAR struct spi_dev_s *dev, uint32_t devid, bool cmd);
#endif
#ifdef CONFIG_STM32_SPI6
-void stm32_spi6select(FAR struct spi_dev_s *dev, enum spi_dev_e devid, bool selected);
-uint8_t stm32_spi6status(FAR struct spi_dev_s *dev, enum spi_dev_e devid);
-int stm32_spi6cmddata(FAR struct spi_dev_s *dev, enum spi_dev_e devid, bool cmd);
+void stm32_spi6select(FAR struct spi_dev_s *dev, uint32_t devid, bool selected);
+uint8_t stm32_spi6status(FAR struct spi_dev_s *dev, uint32_t devid);
+int stm32_spi6cmddata(FAR struct spi_dev_s *dev, uint32_t devid, bool cmd);
#endif
/************************************************************************************
diff --git a/arch/arm/src/stm32/stm32_waste.h b/arch/arm/src/stm32/stm32_waste.h
index 4d13700ea2..6c800c756f 100644
--- a/arch/arm/src/stm32/stm32_waste.h
+++ b/arch/arm/src/stm32/stm32_waste.h
@@ -76,4 +76,4 @@ void up_waste(void);
#endif
#endif /* __ASSEMBLY__ */
-#endif /* __ARCH_ARM_SRC_STM32_STM32_RRC_H */
+#endif /* __ARCH_ARM_SRC_STM32_STM32_WASTE_H */
diff --git a/arch/arm/src/stm32f0/chip/stm32f0_flash.h b/arch/arm/src/stm32f0/chip/stm32f0_flash.h
new file mode 100644
index 0000000000..82a9442156
--- /dev/null
+++ b/arch/arm/src/stm32f0/chip/stm32f0_flash.h
@@ -0,0 +1,115 @@
+/************************************************************************************
+ * arch/arm/src/stm32/chip/stm32f0_flash.h
+ *
+ * Copyright (C) 20017 Gregory Nutt. All rights reserved.
+ * Author: Gregory Nutt
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in
+ * the documentation and/or other materials provided with the
+ * distribution.
+ * 3. Neither the name NuttX nor the names of its contributors may be
+ * used to endorse or promote products derived from this software
+ * without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+ * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+ * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+ * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+ * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+ * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+ * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ *
+ ************************************************************************************/
+
+#ifndef __ARCH_ARM_SRC_STM32F0_CHIP_STM32F0_FLASH_H
+#define __ARCH_ARM_SRC_STM32F0_CHIP_STM32F0_FLASH_H
+
+/************************************************************************************
+ * Included Files
+ ************************************************************************************/
+
+#include
+
+#include "chip.h"
+
+/************************************************************************************
+ * Pre-processor Definitions
+ ************************************************************************************/
+
+/* Register Offsets *****************************************************************/
+
+#define STM32_FLASH_ACR_OFFSET 0x0000
+#define STM32_FLASH_KEYR_OFFSET 0x0004
+#define STM32_FLASH_OPTKEYR_OFFSET 0x0008
+#define STM32_FLASH_SR_OFFSET 0x000c
+#define STM32_FLASH_CR_OFFSET 0x0010
+#define STM32_FLASH_AR_OFFSET 0x0014
+#define STM32_FLASH_OBR_OFFSET 0x001c
+#define STM32_FLASH_WRPR_OFFSET 0x0020
+
+/* Register Addresses ***************************************************************/
+
+#define STM32_FLASH_ACR (STM32F0_FLASHIF_BASE+STM32_FLASH_ACR_OFFSET)
+#define STM32_FLASH_KEYR (STM32F0_FLASHIF_BASE+STM32_FLASH_KEYR_OFFSET)
+#define STM32_FLASH_OPTKEYR (STM32F0_FLASHIF_BASE+STM32_FLASH_OPTKEYR_OFFSET)
+#define STM32_FLASH_SR (STM32F0_FLASHIF_BASE+STM32_FLASH_SR_OFFSET)
+#define STM32_FLASH_CR (STM32F0_FLASHIF_BASE+STM32_FLASH_CR_OFFSET)
+#define STM32_FLASH_AR (STM32F0_FLASHIF_BASE+STM32_FLASH_AR_OFFSET)
+#define STM32_FLASH_OBR (STM32F0_FLASHIF_BASE+STM32_FLASH_OBR_OFFSET)
+#define STM32_FLASH_WRPR (STM32F0_FLASHIF_BASE+STM32_FLASH_WRPR_OFFSET)
+
+/* Register Bitfield Definitions ****************************************************/
+/* Flash Access Control Register (ACR) */
+
+#define FLASH_ACR_LATENCY_SHIFT (0)
+#define FLASH_ACR_LATENCY_MASK (7 << FLASH_ACR_LATENCY_SHIFT)
+# define FLASH_ACR_LATENCY(n) ((n) << FLASH_ACR_LATENCY_SHIFT) /* n wait states */
+# define FLASH_ACR_LATENCY_0 (0 << FLASH_ACR_LATENCY_SHIFT) /* 000: Zero wait states */
+# define FLASH_ACR_LATENCY_1 (1 << FLASH_ACR_LATENCY_SHIFT) /* 001: One wait state */
+#define FLASH_ACR_PRTFBE (1 << 4) /* Bit 4: FLASH prefetch enable */
+#define FLASH_ACR_PRFTBS (1 << 5) /* Bit 5: FLASH Prefetch buffer status */
+
+/* Flash Status Register (SR) */
+
+#define FLASH_SR_BSY (1 << 0) /* Bit 0: Busy */
+#define FLASH_SR_PGERR (1 << 2) /* Bit 2: Programming Error */
+#define FLASH_SR_WRPRT_ERR (1 << 4) /* Bit 3: Write Protection Error */
+#define FLASH_SR_EOP (1 << 5) /* Bit 4: End of Operation */
+
+/* Flash Control Register (CR) */
+
+#define FLASH_CR_PG (1 << 0) /* Bit 0: Program Page */
+#define FLASH_CR_PER (1 << 1) /* Bit 1: Page Erase */
+#define FLASH_CR_MER (1 << 2) /* Bit 2: Mass Erase */
+#define FLASH_CR_OPTPG (1 << 4) /* Bit 4: Option Byte Programming */
+#define FLASH_CR_OPTER (1 << 5) /* Bit 5: Option Byte Erase */
+#define FLASH_CR_STRT (1 << 6) /* Bit 6: Start Erase */
+#define FLASH_CR_LOCK (1 << 7) /* Bit 7: Page Locked or Lock Page */
+#define FLASH_CR_OPTWRE (1 << 9) /* Bit 8: Option Bytes Write Enable */
+#define FLASH_CR_ERRIE (1 << 10) /* Bit 10: Error Interrupt Enable */
+#define FLASH_CR_EOPIE (1 << 12) /* Bit 12: End of Program Interrupt Enable */
+#define FLASH_CR_OBLLAUNCH (1 << 13) /* Bit 13: Force option byte loading */
+
+/* Flash Option byte register */
+#define FLASH_OBR_ /* To be provided */
+
+/************************************************************************************
+ * Public Functions
+ ************************************************************************************/
+
+void stm32_flash_lock(void);
+void stm32_flash_unlock(void);
+
+#endif /* __ARCH_ARM_SRC_STM32F0_CHIP_STM32F0_FLASH_H */
diff --git a/arch/arm/src/stm32f0/chip/stm32f0_rcc.h b/arch/arm/src/stm32f0/chip/stm32f0_rcc.h
index 89464aa682..f499071d05 100644
--- a/arch/arm/src/stm32f0/chip/stm32f0_rcc.h
+++ b/arch/arm/src/stm32f0/chip/stm32f0_rcc.h
@@ -124,15 +124,17 @@
# define RCC_CFGR_PPRE1_HCLKd4 (5 << RCC_CFGR_PPRE1_SHIFT) /* 101: HCLK divided by 4 */
# define RCC_CFGR_PPRE1_HCLKd8 (6 << RCC_CFGR_PPRE1_SHIFT) /* 110: HCLK divided by 8 */
# define RCC_CFGR_PPRE1_HCLKd16 (7 << RCC_CFGR_PPRE1_SHIFT) /* 111: HCLK divided by 16 */
- /* Bits 13-11: Reserve. Keep the reset value */
+ /* Bits 13-11: Reserve. Keep the reset value */
#define RCC_CFGR_ADCPRE (1 << 14) /* Bit 14: ADC prescaler, Obsolete use ADC_CFGR2 */
-#define RCC_CFGR_PLLSRC_SHIFT (15) /* Bit 15: PLL input clock source */
+#define RCC_CFGR_PLLSRC_SHIFT (15) /* Bit 15: PLL input clock source */
#define RCC_CFGR_PLLSRC_MASK (3 << RCC_CFGR_PLLSRC_SHIFT)
# define RCC_CFGR_PLLSRC_HSId2 (0 << RCC_CFGR_PLLSRC_SHIFT) /* 00: HSI/2 as PLL input clock */
# define RCC_CFGR_PLLSRC_HS1_PREDIV (1 << RCC_CFGR_PLLSRC_SHIFT) /* 01: HSE/PREDIV as PLL input clock */
# define RCC_CFGR_PLLSRC_HSE_PREDIV (2 << RCC_CFGR_PLLSRC_SHIFT) /* 10: HSE/PREDIV as PLL input clock */
# define RCC_CFGR_PLLSRC_HSI48_PREDIV (3 << RCC_CFGR_PLLSRC_SHIFT) /* 11: HSI48/PREDIV as PLL input clock */
-#define RCC_CFGR_PLLXTPRE (1 << 17) /* Bit 17: HSE divider for PLL entry */
+#define RCC_CFGR_PLLXTPRE_MASK (1 << 17) /* Bit 17: HSE divider for PLL entry */
+# define RCC_CFGR_PLLXTPRE_DIV1 (0 << 17) /* 0=No divistion */
+# define RCC_CFGR_PLLXTPRE_DIV2 (1 << 17) /* 1=Divide by two */
#define RCC_CFGR_PLLMUL_SHIFT (18) /* Bits 21-18: PLL Multiplication Factor */
#define RCC_CFGR_PLLMUL_MASK (0x0f << RCC_CFGR_PLLMUL_SHIFT)
# define RCC_CFGR_PLLMUL_CLKx2 (0 << RCC_CFGR_PLLMUL_SHIFT) /* 0000: PLL input clock x 2 */
diff --git a/arch/arm/src/stm32f0/stm32f0_clockconfig.c b/arch/arm/src/stm32f0/stm32f0_clockconfig.c
index ca8736bb23..7d57c98b9f 100644
--- a/arch/arm/src/stm32f0/stm32f0_clockconfig.c
+++ b/arch/arm/src/stm32f0/stm32f0_clockconfig.c
@@ -51,6 +51,7 @@
#include "stm32f0_rcc.h"
#include "stm32f0_clockconfig.h"
#include "chip/stm32f0_syscfg.h"
+#include "chip/stm32f0_flash.h"
#include "chip/stm32f0_gpio.h"
/****************************************************************************
@@ -91,11 +92,35 @@ void stm32f0_clockconfig(void)
putreg32(regval, STM32F0_RCC_CR);
while ((getreg32(STM32F0_RCC_CR) & RCC_CR_PLLRDY) != 0);
- /* Configure the PLL. Multiply the HSI to get System Clock */
+ /* Enable FLASH prefetch buffer and set flash latency */
+
+ regval = getreg32(STM32_FLASH_ACR);
+ regval &= ~FLASH_ACR_LATENCY_MASK;
+ regval |= (FLASH_ACR_LATENCY_1 | FLASH_ACR_PRTFBE);
+ putreg32(regval, STM32_FLASH_ACR);
+
+ /* Set HCLK = SYSCLK */
regval = getreg32(STM32F0_RCC_CFGR);
- regval &= ~RCC_CFGR_PLLMUL_MASK;
- regval |= STM32F0_CFGR_PLLMUL;
+ regval &= ~RCC_CFGR_HPRE_MASK;
+ regval |= RCC_CFGR_HPRE_SYSCLK;
+ putreg32(regval, STM32F0_RCC_CFGR);
+
+ /* Set PCLK = HCLK */
+
+ regval &= ~RCC_CFGR_PPRE1_MASK;
+ regval |= RCC_CFGR_PPRE1_HCLK;
+ putreg32(regval, STM32F0_RCC_CFGR);
+
+ /* Configure the PLL to generate the system clock
+ *
+ * 1. Use source = HSI/2
+ * 2. Use PREDIV = 1
+ * 3. Use multiplier from board.h
+ */
+
+ regval &= ~(RCC_CFGR_PLLSRC_MASK | RCC_CFGR_PLLXTPRE_MASK | RCC_CFGR_PLLMUL_MASK);
+ regval |= (RCC_CFGR_PLLSRC_HSId2 | RCC_CFGR_PLLXTPRE_DIV1 | STM32F0_CFGR_PLLMUL);
putreg32(regval, STM32F0_RCC_CFGR);
/* Enable the PLL */
diff --git a/arch/arm/src/stm32f0/stm32f0_serial.c b/arch/arm/src/stm32f0/stm32f0_serial.c
index 632ccab4d6..f0975fad2c 100644
--- a/arch/arm/src/stm32f0/stm32f0_serial.c
+++ b/arch/arm/src/stm32f0/stm32f0_serial.c
@@ -552,7 +552,7 @@ static struct stm32f0_serial_s g_usart3priv =
.priv = &g_usart3priv,
},
- .irq = STM32F0_IRQ_USART3,
+ .irq = STM32F0_IRQ_USART345678,
.parity = CONFIG_USART3_PARITY,
.bits = CONFIG_USART3_BITS,
.stopbits2 = CONFIG_USART3_2STOP,
@@ -613,7 +613,7 @@ static struct stm32f0_serial_s g_usart4priv =
.priv = &g_usart4priv,
},
- .irq = STM32F0_IRQ_USART4,
+ .irq = STM32F0_IRQ_USART345678,
.parity = CONFIG_USART4_PARITY,
.bits = CONFIG_USART4_BITS,
.stopbits2 = CONFIG_USART4_2STOP,
@@ -678,7 +678,7 @@ static struct stm32f0_serial_s g_usart5priv =
.priv = &g_usart5priv,
},
- .irq = STM32F0_IRQ_USART5,
+ .irq = STM32F0_IRQ_USART345678,
.parity = CONFIG_USART5_PARITY,
.bits = CONFIG_USART5_BITS,
.stopbits2 = CONFIG_USART5_2STOP,
@@ -1029,32 +1029,32 @@ static void stm32f0serial_setapbclock(FAR struct uart_dev_s *dev, bool on)
return;
#ifdef CONFIG_STM32F0_USART1
case STM32F0_USART1_BASE:
- rcc_en = RCC_APB2ENR_USART1EN;
+ rcc_en = RCC_APB2ENR_USART1EN;
regaddr = STM32F0_RCC_APB2ENR;
break;
#endif
#ifdef CONFIG_STM32F0_USART2
case STM32F0_USART2_BASE:
- rcc_en = RCC_APB1ENR_USART2EN;
- regaddr =STM32F0_RCC_APB1ENR;
+ rcc_en = RCC_APB1ENR_USART2EN;
+ regaddr = STM32F0_RCC_APB1ENR;
break;
#endif
#ifdef CONFIG_STM32F0_USART3
case STM32F0_USART3_BASE:
- rcc_en = RCC_APB1ENR_USART3EN;
- regaddr =STM32F0_RCC_APB1ENR;
+ rcc_en = RCC_APB1ENR_USART3EN;
+ regaddr = STM32F0_RCC_APB1ENR;
break;
#endif
#ifdef CONFIG_STM32F0_USART4
case STM32F0_USART4_BASE:
- rcc_en = RCC_APB1ENR_USART4EN;
- regaddr =STM32F0_RCC_APB1ENR;
+ rcc_en = RCC_APB1ENR_USART4EN;
+ regaddr = STM32F0_RCC_APB1ENR;
break;
#endif
#ifdef CONFIG_STM32F0_USART5
case STM32F0_USART5_BASE:
- rcc_en = RCC_APB1ENR_USART5EN;
- regaddr =STM32F0_RCC_APB1ENR;
+ rcc_en = RCC_APB1ENR_USART5EN;
+ regaddr = STM32F0_RCC_APB1ENR;
break;
#endif
}
diff --git a/arch/arm/src/stm32f7/stm32_rcc.h b/arch/arm/src/stm32f7/stm32_rcc.h
index 40f3155cca..9320c34aa6 100644
--- a/arch/arm/src/stm32f7/stm32_rcc.h
+++ b/arch/arm/src/stm32f7/stm32_rcc.h
@@ -33,8 +33,8 @@
*
************************************************************************************/
-#ifndef __ARCH_ARM_SRC_STM32F7_STM32_RRC_H
-#define __ARCH_ARM_SRC_STM32F7_STM32_RRC_H
+#ifndef __ARCH_ARM_SRC_STM32F7_STM32_RCC_H
+#define __ARCH_ARM_SRC_STM32F7_STM32_RCC_H
/************************************************************************************
* Included Files
@@ -211,11 +211,7 @@ void stm32_clockenable(void);
* Name: stm32_rcc_enablelse
*
* Description:
- * Enable the External Low-Speed (LSE) Oscillator and, if the RTC is
- * configured, setup the LSE as the RTC clock source, and enable the RTC.
- *
- * For the STM32L15X family, this will also select the LSE as the clock source of
- * the LCD.
+ * Enable the External Low-Speed (LSE) Oscillator.
*
* Input Parameters:
* None
@@ -252,4 +248,4 @@ void stm32_rcc_disablelsi(void);
}
#endif
#endif /* __ASSEMBLY__ */
-#endif /* __ARCH_ARM_SRC_STM32F7_STM32_RRC_H */
+#endif /* __ARCH_ARM_SRC_STM32F7_STM32_RCC_H */
diff --git a/arch/arm/src/stm32f7/stm32_spi.h b/arch/arm/src/stm32f7/stm32_spi.h
index 2a2aa91881..2775107356 100644
--- a/arch/arm/src/stm32f7/stm32_spi.h
+++ b/arch/arm/src/stm32f7/stm32_spi.h
@@ -63,8 +63,7 @@ extern "C"
#define EXTERN extern
#endif
-struct spi_dev_s; /* Forward reference */
-enum spi_dev_e; /* Forward reference */
+struct spi_dev_s; /* Forward reference */
/************************************************************************************
* Name: stm32_spibus_initialize
@@ -112,39 +111,39 @@ FAR struct spi_dev_s *stm32_spibus_initialize(int bus);
************************************************************************************/
#ifdef CONFIG_STM32F7_SPI1
-void stm32_spi1select(FAR struct spi_dev_s *dev, enum spi_dev_e devid, bool selected);
-uint8_t stm32_spi1status(FAR struct spi_dev_s *dev, enum spi_dev_e devid);
-int stm32_spi1cmddata(FAR struct spi_dev_s *dev, enum spi_dev_e devid, bool cmd);
+void stm32_spi1select(FAR struct spi_dev_s *dev, uint32_t devid, bool selected);
+uint8_t stm32_spi1status(FAR struct spi_dev_s *dev, uint32_t devid);
+int stm32_spi1cmddata(FAR struct spi_dev_s *dev, uint32_t devid, bool cmd);
#endif
#ifdef CONFIG_STM32F7_SPI2
-void stm32_spi2select(FAR struct spi_dev_s *dev, enum spi_dev_e devid, bool selected);
-uint8_t stm32_spi2status(FAR struct spi_dev_s *dev, enum spi_dev_e devid);
-int stm32_spi2cmddata(FAR struct spi_dev_s *dev, enum spi_dev_e devid, bool cmd);
+void stm32_spi2select(FAR struct spi_dev_s *dev, uint32_t devid, bool selected);
+uint8_t stm32_spi2status(FAR struct spi_dev_s *dev, uint32_t devid);
+int stm32_spi2cmddata(FAR struct spi_dev_s *dev, uint32_t devid, bool cmd);
#endif
#ifdef CONFIG_STM32F7_SPI3
-void stm32_spi3select(FAR struct spi_dev_s *dev, enum spi_dev_e devid, bool selected);
-uint8_t stm32_spi3status(FAR struct spi_dev_s *dev, enum spi_dev_e devid);
-int stm32_spi3cmddata(FAR struct spi_dev_s *dev, enum spi_dev_e devid, bool cmd);
+void stm32_spi3select(FAR struct spi_dev_s *dev, uint32_t devid, bool selected);
+uint8_t stm32_spi3status(FAR struct spi_dev_s *dev, uint32_t devid);
+int stm32_spi3cmddata(FAR struct spi_dev_s *dev, uint32_t devid, bool cmd);
#endif
#ifdef CONFIG_STM32F7_SPI4
-void stm32_spi4select(FAR struct spi_dev_s *dev, enum spi_dev_e devid, bool selected);
-uint8_t stm32_spi4status(FAR struct spi_dev_s *dev, enum spi_dev_e devid);
-int stm32_spi4cmddata(FAR struct spi_dev_s *dev, enum spi_dev_e devid, bool cmd);
+void stm32_spi4select(FAR struct spi_dev_s *dev, uint32_t devid, bool selected);
+uint8_t stm32_spi4status(FAR struct spi_dev_s *dev, uint32_t devid);
+int stm32_spi4cmddata(FAR struct spi_dev_s *dev, uint32_t devid, bool cmd);
#endif
#ifdef CONFIG_STM32F7_SPI5
-void stm32_spi5select(FAR struct spi_dev_s *dev, enum spi_dev_e devid, bool selected);
-uint8_t stm32_spi5status(FAR struct spi_dev_s *dev, enum spi_dev_e devid);
-int stm32_spi5cmddata(FAR struct spi_dev_s *dev, enum spi_dev_e devid, bool cmd);
+void stm32_spi5select(FAR struct spi_dev_s *dev, uint32_t devid, bool selected);
+uint8_t stm32_spi5status(FAR struct spi_dev_s *dev, uint32_t devid);
+int stm32_spi5cmddata(FAR struct spi_dev_s *dev, uint32_t devid, bool cmd);
#endif
#ifdef CONFIG_STM32F7_SPI6
-void stm32_spi6select(FAR struct spi_dev_s *dev, enum spi_dev_e devid, bool selected);
-uint8_t stm32_spi6status(FAR struct spi_dev_s *dev, enum spi_dev_e devid);
-int stm32_spi6cmddata(FAR struct spi_dev_s *dev, enum spi_dev_e devid, bool cmd);
+void stm32_spi6select(FAR struct spi_dev_s *dev, uint32_t devid, bool selected);
+uint8_t stm32_spi6status(FAR struct spi_dev_s *dev, uint32_t devid);
+int stm32_spi6cmddata(FAR struct spi_dev_s *dev, uint32_t devid, bool cmd);
#endif
/************************************************************************************
diff --git a/arch/arm/src/stm32l4/Kconfig b/arch/arm/src/stm32l4/Kconfig
index 0a8dceb0fc..5af9603644 100644
--- a/arch/arm/src/stm32l4/Kconfig
+++ b/arch/arm/src/stm32l4/Kconfig
@@ -116,6 +116,7 @@ config STM32L4_STM32L496XX
select STM32L4_HAVE_I2C4
select STM32L4_HAVE_CAN2
select STM32L4_HAVE_DCMI
+ select STM32L4_HAVE_DMA2D
choice
prompt "Embedded FLASH size"
@@ -184,6 +185,10 @@ config STM32L4_HAVE_DCMI
bool
default n
+config STM32L4_HAVE_DMA2D
+ bool
+ default n
+
config STM32L4_HAVE_HASH
bool
default n
@@ -307,6 +312,11 @@ config STM32L4_DCMI
default n
depends on STM32L4_HAVE_DCMI
+config STM32L4_DMA2D
+ bool "DMA2D"
+ default n
+ depends on STM32L4_HAVE_DMA2D
+
config STM32L4_HASH
bool "HASH"
default n
diff --git a/arch/arm/src/stm32l4/README.txt b/arch/arm/src/stm32l4/README.txt
index 6b570ededd..9124d966a7 100644
--- a/arch/arm/src/stm32l4/README.txt
+++ b/arch/arm/src/stm32l4/README.txt
@@ -1,9 +1,7 @@
This is a port of NuttX to the STM32L4 Family
-Used development board is the Nucleo L476RG, STM32L4VGDiscovery
-The status is HIGHLY EXPERIMENTAL.
-
-OSTEST application works, but drivers are not complete.
+Used development boards are the Nucleo L476RG, Nucleo L496ZG and
+STM32L4VGDiscovery
Most code is copied and adapted from the STM32 Port.
@@ -24,16 +22,20 @@ RCC : All registers defined, peripherals enabled, basic clock working
SYSCTL : All registers defined
USART : Working in normal mode (no DMA, to be tested, code is written)
DMA : works; at least tested with QSPI
-SRAM2 : OK; can be included in MM region or left separate for special app purposes
+SRAM2 : OK; can be included in MM region or left separate for special app
+ : purposes
FIREWALL : Code written, to be tested, requires support from ldscript
-SPI : Code written, to be tested, including DMA
-I2C : Code written, to be tested (I2C4 missing)
+SPI : OK, tested (Including DMA)
+I2C : Code written, to be tested
RTC : works
QSPI : works in polling, interrupt, DMA, and also memory-mapped modes
-CAN : TODO
-OTGFS : dev implemented, tested, outstanding issue with CDCACM (ACM_SET_LINE_CODING, but otherwise works);
- : host implemented, only build smoke-tested (i.e. builds, but no functional testing yet)
-Timers : Implemented, with PWM oneshot and freerun, tickless OS support. Limited testing (focused on tickless OS so far)
+CAN : OK, tested
+OTGFS : dev implemented, tested, outstanding issue with CDCACM
+ : (ACM_SET_LINE_CODING, but otherwise works); host implemented,
+ : only build smoke-tested (i.e. builds, but no functional testing
+ : yet)
+Timers : Implemented, with PWM oneshot and freerun, tickless OS support.
+ : Limited testing (focused on tickless OS so far), PWM and QE tested OK.
PM : TODO, PWR registers defined
FSMC : TODO
AES : TODO
@@ -46,17 +48,20 @@ ADC : TODO
DAC : TODO
New peripherals with implementation to be written from scratch
-These are Low Priority TODO items, unless someone requests or contributes it.
+These are Low Priority TODO items, unless someone requests or contributes
+it.
TSC : TODO (Touch Screen Controller)
-SWP : TODO (Single wire protocol master, to connect with NFC enabled SIM cards)
+SWP : TODO (Single wire protocol master, to connect with NFC enabled
+ : SIM cards)
LPUART : TODO (Low power UART working with LSE at low baud rates)
LPTIMER : TODO (Low power TIMER)
OPAMP : TODO (Analog operational amplifier)
-COMP : TODO (Analog comparators)
+COMP : There is some code (Analog comparators)
DFSDM : TODO (Digital Filter and Sigma-Delta Modulator)
LCD : TODO (Segment LCD controller)
SAIPLL : works (PLL For Digital Audio interfaces, and other things)
SAI : TODO (Digital Audio interfaces, I2S, SPDIF, etc)
HASH : TODO (SHA-1, SHA-224, SHA-256, HMAC)
DCMI : TODO (Digital Camera interfaces)
+DMA2D : TODO (Chrom-Art Accelerator for image manipulation)
diff --git a/arch/arm/src/stm32l4/chip/stm32l4_exti.h b/arch/arm/src/stm32l4/chip/stm32l4_exti.h
index f9f087a051..4af53eb347 100644
--- a/arch/arm/src/stm32l4/chip/stm32l4_exti.h
+++ b/arch/arm/src/stm32l4/chip/stm32l4_exti.h
@@ -49,8 +49,8 @@
#define STM32L4_NEXTI1 31
#define STM32L4_EXTI1_MASK 0xffffffff
-#define STM32L4_NEXTI2 8
-#define STM32L4_EXTI2_MASK 0x000000ff
+#define STM32L4_NEXTI2 9
+#define STM32L4_EXTI2_MASK 0x000001ff
#define STM32L4_EXTI1_BIT(n) (1 << (n))
#define STM32L4_EXTI2_BIT(n) (1 << (n))
@@ -114,6 +114,7 @@
#define EXTI2_PVM3 (1 << 5) /* EXTI line 37 is connected to the PVM3 wakeup */
#define EXTI2_PVM4 (1 << 6) /* EXTI line 38 is connected to the PVM4 wakeup */
#define EXTI2_LCD (1 << 7) /* EXTI line 39 is connected to the LCD wakeup */
+#define EXTI2_I2C4 (1 << 8) /* EXTI line 40 is connected to the I2C4 wakeup */
/* Interrupt mask register */
diff --git a/arch/arm/src/stm32l4/chip/stm32l4_syscfg.h b/arch/arm/src/stm32l4/chip/stm32l4_syscfg.h
index c1ad478751..2cbffbc7f1 100644
--- a/arch/arm/src/stm32l4/chip/stm32l4_syscfg.h
+++ b/arch/arm/src/stm32l4/chip/stm32l4_syscfg.h
@@ -63,6 +63,7 @@
#define STM32L4_SYSCFG_CFGR2_OFFSET 0x001c /* SYSCFG configuration register 2 */
#define STM32L4_SYSCFG_SWPR_OFFSET 0x0020 /* SYSCFG SRAM2 write protection register */
#define STM32L4_SYSCFG_SKR_OFFSET 0x0024 /* SYSCFG SRAM2 key register */
+#define STM32L4_SYSCFG_SWPR2_OFFSET 0x0028 /* SYSCFG SRAM2 write protection register 2 */
/* Register Addresses *******************************************************************************/
@@ -100,8 +101,9 @@
#define SYSCFG_CFGR1_I2C_PB8_FMP (1 << 18) /* Bit 18: Fast-mode Plus (Fm+) driving capability activation on PB8 */
#define SYSCFG_CFGR1_I2C_PB9_FMP (1 << 19) /* Bit 19: Fast-mode Plus (Fm+) driving capability activation on PB9 */
#define SYSCFG_CFGR1_I2C1_FMP (1 << 20) /* Bit 20: I2C1 Fast-mode Plus (Fm+) driving capability activation */
-#define SYSCFG_CFGR1_I2C2_FMP (1 << 21) /* Bit 21: I2C1 Fast-mode Plus (Fm+) driving capability activation */
-#define SYSCFG_CFGR1_I2C3_FMP (1 << 22) /* Bit 22: I2C1 Fast-mode Plus (Fm+) driving capability activation */
+#define SYSCFG_CFGR1_I2C2_FMP (1 << 21) /* Bit 21: I2C2 Fast-mode Plus (Fm+) driving capability activation */
+#define SYSCFG_CFGR1_I2C3_FMP (1 << 22) /* Bit 22: I2C3 Fast-mode Plus (Fm+) driving capability activation */
+#define SYSCFG_CFGR1_I2C4_FMP (1 << 23) /* Bit 23: I2C4 Fast-mode Plus (Fm+) driving capability activation */
#define SYSCFG_CFGR1_FPU_IE0 (1 << 26) /* Bit 26: FPU Invalid operation interrupt enable */
#define SYSCFG_CFGR1_FPU_IE1 (1 << 27) /* Bit 27: FPU Divide-by-zero interrupt enable */
#define SYSCFG_CFGR1_FPU_IE2 (1 << 28) /* Bit 28: FPU Underflow interrupt enable */
@@ -118,45 +120,47 @@
#define SYSCFG_EXTICR_PORTE (4) /* 0100: PE[x] pin */
#define SYSCFG_EXTICR_PORTF (5) /* 0101: PF[C] pin */
#define SYSCFG_EXTICR_PORTG (6) /* 0110: PG[x] pin */
+#define SYSCFG_EXTICR_PORTH (7) /* 0111: PH[x] pin (only on STM32L496xx/4A6xx) */
+#define SYSCFG_EXTICR_PORTI (8) /* 1000: PI[x] pin (only on STM32L496xx/4A6xx) */
-#define SYSCFG_EXTICR_PORT_MASK (7)
+#define SYSCFG_EXTICR_PORT_MASK (15)
#define SYSCFG_EXTICR_EXTI_SHIFT(g) (((g) & 3) << 2)
#define SYSCFG_EXTICR_EXTI_MASK(g) (SYSCFG_EXTICR_PORT_MASK << (SYSCFG_EXTICR_EXTI_SHIFT(g)))
-#define SYSCFG_EXTICR1_EXTI0_SHIFT (0) /* Bits 0-2: EXTI 0 coinfiguration */
+#define SYSCFG_EXTICR1_EXTI0_SHIFT (0) /* Bits 0-2: EXTI 0 configuration */
#define SYSCFG_EXTICR1_EXTI0_MASK (SYSCFG_EXTICR_PORT_MASK << SYSCFG_EXTICR1_EXTI0_SHIFT)
-#define SYSCFG_EXTICR1_EXTI1_SHIFT (4) /* Bits 4-6: EXTI 1 coinfiguration */
+#define SYSCFG_EXTICR1_EXTI1_SHIFT (4) /* Bits 4-6: EXTI 1 configuration */
#define SYSCFG_EXTICR1_EXTI1_MASK (SYSCFG_EXTICR_PORT_MASK << SYSCFG_EXTICR1_EXTI1_SHIFT)
-#define SYSCFG_EXTICR1_EXTI2_SHIFT (8) /* Bits 8-10: EXTI 2 coinfiguration */
+#define SYSCFG_EXTICR1_EXTI2_SHIFT (8) /* Bits 8-10: EXTI 2 configuration */
#define SYSCFG_EXTICR1_EXTI2_MASK (SYSCFG_EXTICR_PORT_MASK << SYSCFG_EXTICR1_EXTI2_SHIFT)
-#define SYSCFG_EXTICR1_EXTI3_SHIFT (12) /* Bits 12-14: EXTI 3 coinfiguration */
+#define SYSCFG_EXTICR1_EXTI3_SHIFT (12) /* Bits 12-14: EXTI 3 configuration */
#define SYSCFG_EXTICR1_EXTI3_MASK (SYSCFG_EXTICR_PORT_MASK << SYSCFG_EXTICR1_EXTI3_SHIFT)
-#define SYSCFG_EXTICR2_EXTI4_SHIFT (0) /* Bits 0-2: EXTI 4 coinfiguration */
+#define SYSCFG_EXTICR2_EXTI4_SHIFT (0) /* Bits 0-2: EXTI 4 configuration */
#define SYSCFG_EXTICR2_EXTI4_MASK (SYSCFG_EXTICR_PORT_MASK << SYSCFG_EXTICR2_EXTI4_SHIFT)
-#define SYSCFG_EXTICR2_EXTI5_SHIFT (4) /* Bits 4-6: EXTI 5 coinfiguration */
+#define SYSCFG_EXTICR2_EXTI5_SHIFT (4) /* Bits 4-6: EXTI 5 configuration */
#define SYSCFG_EXTICR2_EXTI5_MASK (SYSCFG_EXTICR_PORT_MASK << SYSCFG_EXTICR2_EXTI5_SHIFT)
-#define SYSCFG_EXTICR2_EXTI6_SHIFT (8) /* Bits 8-10: EXTI 6 coinfiguration */
+#define SYSCFG_EXTICR2_EXTI6_SHIFT (8) /* Bits 8-10: EXTI 6 configuration */
#define SYSCFG_EXTICR2_EXTI6_MASK (SYSCFG_EXTICR_PORT_MASK << SYSCFG_EXTICR2_EXTI6_SHIFT)
-#define SYSCFG_EXTICR2_EXTI7_SHIFT (12) /* Bits 12-14: EXTI 7 coinfiguration */
+#define SYSCFG_EXTICR2_EXTI7_SHIFT (12) /* Bits 12-14: EXTI 7 configuration */
#define SYSCFG_EXTICR2_EXTI7_MASK (SYSCFG_EXTICR_PORT_MASK << SYSCFG_EXTICR2_EXTI7_SHIFT)
-#define SYSCFG_EXTICR3_EXTI8_SHIFT (0) /* Bits 0-2: EXTI 8 coinfiguration */
+#define SYSCFG_EXTICR3_EXTI8_SHIFT (0) /* Bits 0-2: EXTI 8 configuration */
#define SYSCFG_EXTICR3_EXTI8_MASK (SYSCFG_EXTICR_PORT_MASK << SYSCFG_EXTICR3_EXTI8_SHIFT)
-#define SYSCFG_EXTICR3_EXTI9_SHIFT (4) /* Bits 4-6: EXTI 9 coinfiguration */
+#define SYSCFG_EXTICR3_EXTI9_SHIFT (4) /* Bits 4-6: EXTI 9 configuration */
#define SYSCFG_EXTICR3_EXTI9_MASK (SYSCFG_EXTICR_PORT_MASK << SYSCFG_EXTICR3_EXTI9_SHIFT)
-#define SYSCFG_EXTICR3_EXTI10_SHIFT (8) /* Bits 8-10: EXTI 10 coinfiguration */
+#define SYSCFG_EXTICR3_EXTI10_SHIFT (8) /* Bits 8-10: EXTI 10 configuration */
#define SYSCFG_EXTICR3_EXTI10_MASK (SYSCFG_EXTICR_PORT_MASK << SYSCFG_EXTICR3_EXTI10_SHIFT)
-#define SYSCFG_EXTICR3_EXTI11_SHIFT (12) /* Bits 12-14: EXTI 11 coinfiguration */
+#define SYSCFG_EXTICR3_EXTI11_SHIFT (12) /* Bits 12-14: EXTI 11 configuration */
#define SYSCFG_EXTICR3_EXTI11_MASK (SYSCFG_EXTICR_PORT_MASK << SYSCFG_EXTICR3_EXTI11_SHIFT)
-#define SYSCFG_EXTICR4_EXTI12_SHIFT (0) /* Bits 0-2: EXTI 12 coinfiguration */
+#define SYSCFG_EXTICR4_EXTI12_SHIFT (0) /* Bits 0-2: EXTI 12 configuration */
#define SYSCFG_EXTICR4_EXTI12_MASK (SYSCFG_EXTICR_PORT_MASK << SYSCFG_EXTICR4_EXTI12_SHIFT)
-#define SYSCFG_EXTICR4_EXTI13_SHIFT (4) /* Bits 4-6: EXTI 13 coinfiguration */
+#define SYSCFG_EXTICR4_EXTI13_SHIFT (4) /* Bits 4-6: EXTI 13 configuration */
#define SYSCFG_EXTICR4_EXTI13_MASK (SYSCFG_EXTICR_PORT_MASK << SYSCFG_EXTICR4_EXTI13_SHIFT)
-#define SYSCFG_EXTICR4_EXTI14_SHIFT (8) /* Bits 8-10: EXTI 14 coinfiguration */
+#define SYSCFG_EXTICR4_EXTI14_SHIFT (8) /* Bits 8-10: EXTI 14 configuration */
#define SYSCFG_EXTICR4_EXTI14_MASK (SYSCFG_EXTICR_PORT_MASK << SYSCFG_EXTICR4_EXTI14_SHIFT)
-#define SYSCFG_EXTICR4_EXTI15_SHIFT (12) /* Bits 12-14: EXTI 15 coinfiguration */
+#define SYSCFG_EXTICR4_EXTI15_SHIFT (12) /* Bits 12-14: EXTI 15 configuration */
#define SYSCFG_EXTICR4_EXTI15_MASK (SYSCFG_EXTICR_PORT_MASK << SYSCFG_EXTICR4_EXTI15_SHIFT)
/* SYSCFG SRAM2 control and status register */
@@ -173,13 +177,16 @@
#define SYSCFG_CFGR2_SPF (1 << 8) /* Bit 8: SRAM2 parity error flag */
/* SYSCFG SRAM2 write protection register */
-/* There is one bit per SRAM2 page */
+/* There is one bit per SRAM2 page (0 to 31) */
/* SYSCFG SRAM2 key register */
#define SYSCFG_SKR_SHIFT 0
#define SYSCFG_SKR_MASK (0xFF << SYSCFG_SKR_SHIFT)
-#endif /* CONFIG_STM32L4_STM32L476XX || CONFIG_STM32L4_STM32L486XX */
+/* SYSCFG SRAM2 write protection register 2 (only on STM32L496xx/4A6xx) */
+/* There is one bit per SRAM2 page (32 to 63) */
+
+#endif /* CONFIG_STM32L4_STM32L476XX || CONFIG_STM32L4_STM32L486XX || CONFIG_STM32L4_STM32L496XX */
#endif /* __ARCH_ARM_SRC_STM32L4_CHIP_STM32L4_SYSCFG_H */
diff --git a/arch/arm/src/stm32l4/chip/stm32l4x6xx_dma.h b/arch/arm/src/stm32l4/chip/stm32l4x6xx_dma.h
index 6e7afac9af..173e0adbe7 100644
--- a/arch/arm/src/stm32l4/chip/stm32l4x6xx_dma.h
+++ b/arch/arm/src/stm32l4/chip/stm32l4x6xx_dma.h
@@ -343,6 +343,11 @@
#define DMACHAN_DAC2 DMACHAN_SETTING(STM32L4_DMA2_CHAN5, 3)
+/* DCMI */
+
+#define DMACHAN_DCMI_1 DMACHAN_SETTING(STM32L4_DMA2_CHAN5, 4)
+#define DMACHAN_DCMI_2 DMACHAN_SETTING(STM32L4_DMA2_CHAN6, 0)
+
/* DFSDM */
#define DMACHAN_DFSDM0 DMACHAN_SETTING(STM32L4_DMA1_CHAN4, 0)
@@ -350,6 +355,10 @@
#define DMACHAN_DFSDM2 DMACHAN_SETTING(STM32L4_DMA1_CHAN6, 0)
#define DMACHAN_DFSDM3 DMACHAN_SETTING(STM32L4_DMA1_CHAN7, 0)
+/* HASH */
+
+#define DMACHAN_HASH_IN DMACHAN_SETTING(STM32L4_DMA2_CHAN7, 6)
+
/* I2C */
#define DMACHAN_I2C1_RX_1 DMACHAN_SETTING(STM32L4_DMA1_CHAN7, 3)
@@ -363,6 +372,9 @@
#define DMACHAN_I2C3_RX DMACHAN_SETTING(STM32L4_DMA1_CHAN3, 2)
#define DMACHAN_I2C3_TX DMACHAN_SETTING(STM32L4_DMA1_CHAN2, 3)
+#define DMACHAN_I2C4_RX DMACHAN_SETTING(STM32L4_DMA2_CHAN1, 0)
+#define DMACHAN_I2C4_TX DMACHAN_SETTING(STM32L4_DMA2_CHAN2, 0)
+
/* QUADSPI */
#define DMACHAN_QUADSPI_1 DMACHAN_SETTING(STM32L4_DMA1_CHAN5, 5)
diff --git a/arch/arm/src/stm32l4/chip/stm32l4x6xx_pinmap.h b/arch/arm/src/stm32l4/chip/stm32l4x6xx_pinmap.h
index 8be6eca5a5..19f90a0148 100644
--- a/arch/arm/src/stm32l4/chip/stm32l4x6xx_pinmap.h
+++ b/arch/arm/src/stm32l4/chip/stm32l4x6xx_pinmap.h
@@ -126,6 +126,11 @@
#define GPIO_CAN1_TX_2 (GPIO_ALT|GPIO_AF9 |GPIO_PORTB|GPIO_PIN9)
#define GPIO_CAN1_TX_3 (GPIO_ALT|GPIO_AF9 |GPIO_PORTD|GPIO_PIN1)
+#define GPIO_CAN2_RX_1 (GPIO_ALT|GPIO_AF3 |GPIO_PORTB|GPIO_PIN5)
+#define GPIO_CAN2_TX_1 (GPIO_ALT|GPIO_AF8 |GPIO_PORTB|GPIO_PIN6)
+#define GPIO_CAN2_RX_2 (GPIO_ALT|GPIO_AF10 |GPIO_PORTB|GPIO_PIN12)
+#define GPIO_CAN2_TX_2 (GPIO_ALT|GPIO_AF10 |GPIO_PORTB|GPIO_PIN13)
+
/* Clocks outputs */
#define GPIO_MCO (GPIO_ALT|GPIO_AF0 |GPIO_PORTA|GPIO_PIN8)
@@ -151,6 +156,15 @@
#define GPIO_DAC1_OUT (GPIO_ANALOG|GPIO_PORTA|GPIO_PIN4)
#define GPIO_DAC2_OUT (GPIO_ANALOG|GPIO_PORTA|GPIO_PIN5)
+/* Digital Camera Interface (DCMI) */
+
+#define GPIO_DCMI_PIXCK_1 (GPIO_ALT|GPIO_AF4|GPIO_PORTA|GPIO_PIN6)
+#define GPIO_DCMI_PIXCK_2 (GPIO_ALT|GPIO_AF10|GPIO_PORTD|GPIO_PIN9)
+#define GPIO_DCMI_HSYNC_1 (GPIO_ALT|GPIO_AF10|GPIO_PORTA|GPIO_PIN4)
+#define GPIO_DCMI_HSYNC_2 (GPIO_ALT|GPIO_AF10|GPIO_PORTD|GPIO_PIN8)
+#define GPIO_DCMI_VSYNC_1 (GPIO_ALT|GPIO_AF10|GPIO_PORTB|GPIO_PIN7)
+/* TODO: DCMI data pins missing */
+
/* Digital Filter for Sigma-Delta Modulators (DFSDM) */
#define GPIO_DFSDM_DATIN0_1 (GPIO_ALT|GPIO_AF6 |GPIO_PORTB|GPIO_PIN1)
@@ -253,6 +267,10 @@
/* I2C */
+/* Note: STM32L496xx/4A6xx devices have few additional mappings for
+ * I2C1-3 that are not defined here.
+ */
+
#define GPIO_I2C1_SDA_1 (GPIO_ALT|GPIO_AF4 |GPIO_PORTB|GPIO_PIN7)
#define GPIO_I2C1_SDA_2 (GPIO_ALT|GPIO_AF4 |GPIO_PORTB|GPIO_PIN9)
#define GPIO_I2C1_SDA_3 (GPIO_ALT|GPIO_AF4 |GPIO_PORTG|GPIO_PIN13)
@@ -278,6 +296,19 @@
#define GPIO_I2C3_SMBA_1 (GPIO_ALT|GPIO_AF4 |GPIO_PORTB|GPIO_PIN2)
#define GPIO_I2C3_SMBA_2 (GPIO_ALT|GPIO_AF4 |GPIO_PORTG|GPIO_PIN6)
+#define GPIO_I2C4_SDA_1 (GPIO_ALT|GPIO_AF5 |GPIO_PORTB|GPIO_PIN7)
+#define GPIO_I2C4_SDA_2 (GPIO_ALT|GPIO_AF3 |GPIO_PORTB|GPIO_PIN11)
+#define GPIO_I2C4_SDA_3 (GPIO_ALT|GPIO_AF2 |GPIO_PORTC|GPIO_PIN1)
+#define GPIO_I2C4_SDA_4 (GPIO_ALT|GPIO_AF4 |GPIO_PORTD|GPIO_PIN13)
+#define GPIO_I2C4_SCL_1 (GPIO_ALT|GPIO_AF5 |GPIO_PORTB|GPIO_PIN6)
+#define GPIO_I2C4_SCL_2 (GPIO_ALT|GPIO_AF3 |GPIO_PORTB|GPIO_PIN10)
+#define GPIO_I2C4_SCL_3 (GPIO_ALT|GPIO_AF2 |GPIO_PORTC|GPIO_PIN0)
+#define GPIO_I2C4_SCL_4 (GPIO_ALT|GPIO_AF4 |GPIO_PORTD|GPIO_PIN12)
+#define GPIO_I2C4_SMBA_1 (GPIO_ALT|GPIO_AF5 |GPIO_PORTA|GPIO_PIN14)
+#define GPIO_I2C4_SMBA_2 (GPIO_ALT|GPIO_AF4 |GPIO_PORTD|GPIO_PIN11)
+#define GPIO_I2C4_SMBA_3 (GPIO_ALT|GPIO_AF4 |GPIO_PORTD|GPIO_PIN11)
+#define GPIO_I2C4_SMBA_4 (GPIO_ALT|GPIO_AF4 |GPIO_PORTF|GPIO_PIN13)
+
/* JTAG */
#define GPIO_JTCK_SWCLK (GPIO_ALT|GPIO_AF0|GPIO_PORTA|GPIO_PIN14)
diff --git a/arch/arm/src/stm32l4/chip/stm32l4x6xx_rcc.h b/arch/arm/src/stm32l4/chip/stm32l4x6xx_rcc.h
index 2aef6f17d5..d180033ad2 100644
--- a/arch/arm/src/stm32l4/chip/stm32l4x6xx_rcc.h
+++ b/arch/arm/src/stm32l4/chip/stm32l4x6xx_rcc.h
@@ -35,8 +35,8 @@
*
****************************************************************************************************/
-#ifndef __ARCH_ARM_SRC_STM32L4_CHIP_STM32F42XXX_RCC_H
-#define __ARCH_ARM_SRC_STM32L4_CHIP_STM32F42XXX_RCC_H
+#ifndef __ARCH_ARM_SRC_STM32L4_CHIP_STM32L4X6XX_RCC_H
+#define __ARCH_ARM_SRC_STM32L4_CHIP_STM32L4X6XX_RCC_H
/****************************************************************************************************
* Included Files
@@ -80,9 +80,11 @@
#define STM32L4_RCC_APB1SMENR1_OFFSET 0x0078 /* RCC APB1 low power mode peripheral clock enable register 1 */
#define STM32L4_RCC_APB1SMENR2_OFFSET 0x007c /* RCC APB1 low power mode peripheral clock enable register 2 */
#define STM32L4_RCC_APB2SMENR_OFFSET 0x0080 /* RCC APB2 low power mode peripheral clock enable register */
-#define STM32L4_RCC_CCIPR_OFFSET 0x0088 /* Peripherals independ clock configuration register */
+#define STM32L4_RCC_CCIPR_OFFSET 0x0088 /* Peripherals independent clock configuration register 1 */
#define STM32L4_RCC_BDCR_OFFSET 0x0090 /* Backup domain control register */
#define STM32L4_RCC_CSR_OFFSET 0x0094 /* Control/status register */
+#define STM32L4_RCC_CRRCR_OFFSET 0x0098 /* Clock recovery RC register */
+#define STM32L4_RCC_CCIPR2_OFFSET 0x009c /* Peripherals independent clock configuration register 2 */
/* Register Addresses *******************************************************************************/
@@ -116,6 +118,8 @@
#define STM32L4_RCC_CCIPR (STM32L4_RCC_BASE+STM32L4_RCC_CCIPR_OFFSET)
#define STM32L4_RCC_BDCR (STM32L4_RCC_BASE+STM32L4_RCC_BDCR_OFFSET)
#define STM32L4_RCC_CSR (STM32L4_RCC_BASE+STM32L4_RCC_CSR_OFFSET)
+#define STM32L4_RCC_CRRCR (STM32L4_RCC_BASE+STM32L4_RCC_CRRCR_OFFSET)
+#define STM32L4_RCC_CCIPR2 (STM32L4_RCC_BASE+STM32L4_RCC_CCIPR2_OFFSET)
/* Register Bitfield Definitions ********************************************************************/
@@ -336,41 +340,44 @@
/* Clock interrupt enable register */
-#define RCC_CIR_LSIRDYIE (1 << 0) /* Bit 0: LSI Ready Interrupt Enable */
-#define RCC_CIR_LSERDYIE (1 << 1) /* Bit 1: LSE Ready Interrupt Enable */
-#define RCC_CIR_MSIRDYIE (1 << 2) /* Bit 2: MSI Ready Interrupt Enable */
-#define RCC_CIR_HSIRDYIE (1 << 3) /* Bit 3: HSI Ready Interrupt Enable */
-#define RCC_CIR_HSERDYIE (1 << 4) /* Bit 4: HSE Ready Interrupt Enable */
-#define RCC_CIR_PLLRDYIE (1 << 5) /* Bit 5: PLL Ready Interrupt Enable */
-#define RCC_CIR_PLLSAI1RDYIE (1 << 6) /* Bit 6: PLLSAI1 Ready Interrupt enable */
-#define RCC_CIR_PLLSAI2RDYIE (1 << 7) /* Bit 7: PLLSAI2 Ready Interrupt enable */
-#define RCC_CIR_LSECSSIE (1 << 9) /* Bit 9: LSE Clock Security System Interrupt Enable */
+#define RCC_CIR_LSIRDYIE (1 << 0) /* Bit 0: LSI Ready Interrupt Enable */
+#define RCC_CIR_LSERDYIE (1 << 1) /* Bit 1: LSE Ready Interrupt Enable */
+#define RCC_CIR_MSIRDYIE (1 << 2) /* Bit 2: MSI Ready Interrupt Enable */
+#define RCC_CIR_HSIRDYIE (1 << 3) /* Bit 3: HSI Ready Interrupt Enable */
+#define RCC_CIR_HSERDYIE (1 << 4) /* Bit 4: HSE Ready Interrupt Enable */
+#define RCC_CIR_PLLRDYIE (1 << 5) /* Bit 5: PLL Ready Interrupt Enable */
+#define RCC_CIR_PLLSAI1RDYIE (1 << 6) /* Bit 6: PLLSAI1 Ready Interrupt enable */
+#define RCC_CIR_PLLSAI2RDYIE (1 << 7) /* Bit 7: PLLSAI2 Ready Interrupt enable */
+#define RCC_CIR_LSECSSIE (1 << 9) /* Bit 9: LSE Clock Security System Interrupt Enable */
+#define RCC_CIR_HSI48RDYIE (1 << 10) /* Bit 10: HSI48 Ready Interrupt Enable */
/* Clock interrupt flag register */
-#define RCC_CIR_LSIRDYIF (1 << 0) /* Bit 0: LSI Ready Interrupt Flag */
-#define RCC_CIR_LSERDYIF (1 << 1) /* Bit 1: LSE Ready Interrupt Flag */
-#define RCC_CIR_MSIRDYIF (1 << 2) /* Bit 2: MSI Ready Interrupt Flag */
-#define RCC_CIR_HSIRDYIF (1 << 3) /* Bit 3: HSI Ready Interrupt Flag */
-#define RCC_CIR_HSERDYIF (1 << 4) /* Bit 4: HSE Ready Interrupt Flag */
-#define RCC_CIR_PLLRDYIF (1 << 5) /* Bit 5: PLL Ready Interrupt Flag */
-#define RCC_CIR_PLLSAI1RDYIF (1 << 6) /* Bit 6: PLLSAI1 Ready Interrupt Flag */
-#define RCC_CIR_PLLSAI2RDYIF (1 << 7) /* Bit 7: PLLSAI2 Ready Interrupt Flag */
-#define RCC_CIR_CSSF (1 << 8) /* Bit 8: Clock Security System Interrupt Flag */
-#define RCC_CIR_LSECSSIF (1 << 9) /* Bit 9: LSE Clock Security System Interrupt Flag */
+#define RCC_CIR_LSIRDYIF (1 << 0) /* Bit 0: LSI Ready Interrupt Flag */
+#define RCC_CIR_LSERDYIF (1 << 1) /* Bit 1: LSE Ready Interrupt Flag */
+#define RCC_CIR_MSIRDYIF (1 << 2) /* Bit 2: MSI Ready Interrupt Flag */
+#define RCC_CIR_HSIRDYIF (1 << 3) /* Bit 3: HSI Ready Interrupt Flag */
+#define RCC_CIR_HSERDYIF (1 << 4) /* Bit 4: HSE Ready Interrupt Flag */
+#define RCC_CIR_PLLRDYIF (1 << 5) /* Bit 5: PLL Ready Interrupt Flag */
+#define RCC_CIR_PLLSAI1RDYIF (1 << 6) /* Bit 6: PLLSAI1 Ready Interrupt Flag */
+#define RCC_CIR_PLLSAI2RDYIF (1 << 7) /* Bit 7: PLLSAI2 Ready Interrupt Flag */
+#define RCC_CIR_CSSF (1 << 8) /* Bit 8: Clock Security System Interrupt Flag */
+#define RCC_CIR_LSECSSIF (1 << 9) /* Bit 9: LSE Clock Security System Interrupt Flag */
+#define RCC_CIR_HSI48RDYIF (1 << 10) /* Bit 10: HSI48 Ready Interrupt Flag */
/* Clock interrupt clear register */
-#define RCC_CIR_LSIRDYIC (1 << 0) /* Bit 0: LSI Ready Interrupt Clear */
-#define RCC_CIR_LSERDYIC (1 << 1) /* Bit 1: LSE Ready Interrupt Clear */
-#define RCC_CIR_MSIRDYIC (1 << 2) /* Bit 2: MSI Ready Interrupt Clear */
-#define RCC_CIR_HSIRDYIC (1 << 3) /* Bit 3: HSI Ready Interrupt Clear */
-#define RCC_CIR_HSERDYIC (1 << 4) /* Bit 4: HSE Ready Interrupt Clear */
-#define RCC_CIR_PLLRDYIC (1 << 5) /* Bit 5: PLL Ready Interrupt Clear */
-#define RCC_CIR_PLLSAI1RDYIC (1 << 6) /* Bit 6: PLLSAI1 Ready Interrupt Clear */
-#define RCC_CIR_PLLSAI2RDYIC (1 << 7) /* Bit 7: PLLSAI2 Ready Interrupt Clear */
-#define RCC_CIR_CSSC (1 << 8) /* Bit 8: Clock Security System Interrupt Clear */
-#define RCC_CIR_LSECSSIC (1 << 9) /* Bit 9: LSE Clock Security System Interrupt Clear */
+#define RCC_CIR_LSIRDYIC (1 << 0) /* Bit 0: LSI Ready Interrupt Clear */
+#define RCC_CIR_LSERDYIC (1 << 1) /* Bit 1: LSE Ready Interrupt Clear */
+#define RCC_CIR_MSIRDYIC (1 << 2) /* Bit 2: MSI Ready Interrupt Clear */
+#define RCC_CIR_HSIRDYIC (1 << 3) /* Bit 3: HSI Ready Interrupt Clear */
+#define RCC_CIR_HSERDYIC (1 << 4) /* Bit 4: HSE Ready Interrupt Clear */
+#define RCC_CIR_PLLRDYIC (1 << 5) /* Bit 5: PLL Ready Interrupt Clear */
+#define RCC_CIR_PLLSAI1RDYIC (1 << 6) /* Bit 6: PLLSAI1 Ready Interrupt Clear */
+#define RCC_CIR_PLLSAI2RDYIC (1 << 7) /* Bit 7: PLLSAI2 Ready Interrupt Clear */
+#define RCC_CIR_CSSC (1 << 8) /* Bit 8: Clock Security System Interrupt Clear */
+#define RCC_CIR_LSECSSIC (1 << 9) /* Bit 9: LSE Clock Security System Interrupt Clear */
+#define RCC_CIR_HSI48RDYIC (1 << 10) /* Bit 10: HSI48 Oscillator Ready Interrupt Clear */
/* AHB1 peripheral reset register */
@@ -379,10 +386,11 @@
#define RCC_AHB1RSTR_FLASHRST (1 << 8) /* Bit 8: Flash memory interface reset */
#define RCC_AHB1RSTR_CRCRST (1 << 12) /* Bit 12: CRC reset */
#define RCC_AHB1RSTR_TSCRST (1 << 16) /* Bit 16: Touch Sensing Controller reset */
+#define RCC_AHB1RSTR_DMA2DRST (1 << 17) /* Bit 17: DMA2D reset */
/* AHB2 peripheral reset register */
-#define RCC_AHB1ENR_GPIOEN(port) (1 << port)
+#define RCC_AHB1ENR_GPIOEN(port) (1 << (port))
#define RCC_AHB2RSTR_GPIOARST (1 << 0) /* Bit 0: IO port A reset */
#define RCC_AHB2RSTR_GPIOBRST (1 << 1) /* Bit 1: IO port B reset */
#define RCC_AHB2RSTR_GPIOCRST (1 << 2) /* Bit 2: IO port C reset */
@@ -391,10 +399,13 @@
#define RCC_AHB2RSTR_GPIOFRST (1 << 5) /* Bit 5: IO port F reset */
#define RCC_AHB2RSTR_GPIOGRST (1 << 6) /* Bit 6: IO port G reset */
#define RCC_AHB2RSTR_GPIOHRST (1 << 7) /* Bit 7: IO port H reset */
+#define RCC_AHB2RSTR_GPIOIRST (1 << 8) /* Bit 8: IO port I reset */
#define RCC_AHB2RSTR_OTGFSRST (1 << 12) /* Bit 12: USB OTG FS module reset */
#define RCC_AHB2RSTR_ADCRST (1 << 13) /* Bit 13: ADC interface reset (common to all ADCs) */
+#define RCC_AHB2RSTR_DCMIRST (1 << 14) /* Bit 14: DCMI interface reset */
#define RCC_AHB2RSTR_AESRST (1 << 16) /* Bit 16: AES Cryptographic module reset */
-#define RCC_AHB2RSTR_RNGRST (1 << 18) /* Bit 6: Random number generator module reset */
+#define RCC_AHB2RSTR_HASHRST (1 << 17) /* Bit 17: HASH module reset */
+#define RCC_AHB2RSTR_RNGRST (1 << 18) /* Bit 18: Random number generator module reset */
/* AHB3 peripheral reset register */
@@ -419,7 +430,9 @@
#define RCC_APB1RSTR1_I2C1RST (1 << 21) /* Bit 21: I2C1 reset */
#define RCC_APB1RSTR1_I2C2RST (1 << 22) /* Bit 22: I2C2 reset */
#define RCC_APB1RSTR1_I2C3RST (1 << 23) /* Bit 23: I2C3 reset */
+#define RCC_APB1RSTR1_CRSRST (1 << 24) /* Bit 24: CRS reset */
#define RCC_APB1RSTR1_CAN1RST (1 << 25) /* Bit 25: CAN1 reset */
+#define RCC_APB1RSTR1_CAN2RST (1 << 26) /* Bit 26: CAN2 reset */
#define RCC_APB1RSTR1_PWRRST (1 << 28) /* Bit 28: Power interface reset */
#define RCC_APB1RSTR1_DAC1RST (1 << 29) /* Bit 29: DAC1 reset */
#define RCC_APB1RSTR1_OPAMPRST (1 << 30) /* Bit 30: OPAMP reset */
@@ -428,6 +441,7 @@
/* APB1 Peripheral reset register 2 */
#define RCC_APB1RSTR2_LPUART1RST (1 << 0) /* Bit 0: Low-power UART 1 reset */
+#define RCC_APB1RSTR2_I2C4RST (1 << 1) /* Bit 1: I2C4 reset */
#define RCC_APB1RSTR2_SWPMI1RST (1 << 2) /* Bit 2: Single Wire Protocol reset */
#define RCC_APB1RSTR2_LPTIM2RST (1 << 5) /* Bit 5: Low-power Timer 2 reset */
@@ -453,6 +467,7 @@
#define RCC_AHB1ENR_FLASHEN (1 << 8) /* Bit 8: Flash memory interface enable */
#define RCC_AHB1ENR_CRCEN (1 << 12) /* Bit 12: CRC enable */
#define RCC_AHB1ENR_TSCEN (1 << 16) /* Bit 16: Touch Sensing Controller enable */
+#define RCC_AHB1ENR_DMA2DEN (1 << 17) /* Bit 17: DMA2D enable */
/* AHB2 Peripheral Clock enable register */
@@ -464,9 +479,12 @@
#define RCC_AHB2ENR_GPIOFEN (1 << 5) /* Bit 5: IO port F enable */
#define RCC_AHB2ENR_GPIOGEN (1 << 6) /* Bit 6: IO port G enable */
#define RCC_AHB2ENR_GPIOHEN (1 << 7) /* Bit 7: IO port H enable */
+#define RCC_AHB2ENR_GPIOIEN (1 << 8) /* Bit 8: IO port I enable */
#define RCC_AHB2ENR_OTGFSEN (1 << 12) /* Bit 12: USB OTG FS module enable */
#define RCC_AHB2ENR_ADCEN (1 << 13) /* Bit 13: ADC interface enable (common to all ADCs) */
+#define RCC_AHB2ENR_DCMIEN (1 << 14) /* Bit 14: DCMI interface enable */
#define RCC_AHB2ENR_AESEN (1 << 16) /* Bit 16: AES Cryptographic module enable */
+#define RCC_AHB2ENR_HASHEN (1 << 17) /* Bit 17: HASH module enable */
#define RCC_AHB2ENR_RNGEN (1 << 18) /* Bit 18: Random number generator module enable */
/* AHB3 Peripheral Clock enable register */
@@ -474,7 +492,7 @@
#define RCC_AHB3ENR_FSMCEN (1 << 0) /* Bit 0: Flexible static memory controller module enable */
#define RCC_AHB3ENR_QSPIEN (1 << 8) /* Bit 8: Quad SPI module enable */
-/* APB1 Peripheral Clock enable register 1*/
+/* APB1 Peripheral Clock enable register 1 */
#define RCC_APB1ENR1_TIM2EN (1 << 0) /* Bit 0: TIM2 enable */
#define RCC_APB1ENR1_TIM3EN (1 << 1) /* Bit 1: TIM3 enable */
@@ -483,6 +501,7 @@
#define RCC_APB1ENR1_TIM6EN (1 << 4) /* Bit 4: TIM6 enable */
#define RCC_APB1ENR1_TIM7EN (1 << 5) /* Bit 5: TIM7 enable */
#define RCC_APB1ENR1_LCDEN (1 << 9) /* Bit 9: LCD controller enable */
+#define RCC_APB1ENR1_RTCAPBEN (1 << 10) /* Bit 10: RTC APB clock enable */
#define RCC_APB1ENR1_WWDGEN (1 << 11) /* Bit 11: Windowed Watchdog enable */
#define RCC_APB1ENR1_SPI2EN (1 << 14) /* Bit 14: SPI2 enable */
#define RCC_APB1ENR1_SPI3EN (1 << 15) /* Bit 15: SPI3 enable */
@@ -493,15 +512,18 @@
#define RCC_APB1ENR1_I2C1EN (1 << 21) /* Bit 21: I2C1 enable */
#define RCC_APB1ENR1_I2C2EN (1 << 22) /* Bit 22: I2C2 enable */
#define RCC_APB1ENR1_I2C3EN (1 << 23) /* Bit 23: I2C3 enable */
+#define RCC_APB1ENR1_CRSEN (1 << 24) /* Bit 24: CRSEN enable */
#define RCC_APB1ENR1_CAN1EN (1 << 25) /* Bit 25: CAN1 enable */
+#define RCC_APB1ENR1_CAN2EN (1 << 26) /* Bit 26: CAN2 enable */
#define RCC_APB1ENR1_PWREN (1 << 28) /* Bit 28: Power interface enable */
#define RCC_APB1ENR1_DAC1EN (1 << 29) /* Bit 29: DAC1 enable */
#define RCC_APB1ENR1_OPAMPEN (1 << 30) /* Bit 30: OPAMP enable */
#define RCC_APB1ENR1_LPTIM1EN (1 << 31) /* Bit 31: Low-power Timer 1 enable */
-/* APB1 Peripheral Clock enable register 2*/
+/* APB1 Peripheral Clock enable register 2 */
#define RCC_APB1ENR2_LPUART1EN (1 << 0) /* Bit 0: Low-power UART 1 enable */
+#define RCC_APB1ENR2_I2C4EN (1 << 1) /* Bit 1: I2C4 enable */
#define RCC_APB1ENR2_SWPMI1EN (1 << 2) /* Bit 2: Single Wire Protocol enable */
#define RCC_APB1ENR2_LPTIM2EN (1 << 5) /* Bit 5: Low-power Timer 2 enable */
@@ -529,6 +551,7 @@
#define RCC_AHB1SMENR_SRAM1SMEN (1 << 9) /* Bit 9: SRAM1 enable during Sleep mode */
#define RCC_AHB1SMENR_CRCLPSMEN (1 << 12) /* Bit 12: CRC enable during Sleep mode */
#define RCC_AHB1SMENR_TSCLPSMEN (1 << 16) /* Bit 16: Touch Sensing Controller enable during Sleep mode */
+#define RCC_AHB1SMENR_DMA2DSMEN (1 << 17) /* Bit 17: DMA2D enable during Sleep mode */
/* RCC AHB2 low power mode peripheral clock enable register */
@@ -540,18 +563,21 @@
#define RCC_AHB2SMENR_GPIOFSMEN (1 << 5) /* Bit 5: IO port F enable during Sleep mode */
#define RCC_AHB2SMENR_GPIOGSMEN (1 << 6) /* Bit 6: IO port G enable during Sleep mode */
#define RCC_AHB2SMENR_GPIOHSMEN (1 << 7) /* Bit 7: IO port H enable during Sleep mode */
+#define RCC_AHB2SMENR_GPIOISMEN (1 << 8) /* Bit 8: IO port I enable during Sleep mode */
#define RCC_AHB2SMENR_SRAM2SMEN (1 << 9) /* Bit 9: SRAM2 enable during Sleep mode */
#define RCC_AHB2SMENR_OTGFSSMEN (1 << 12) /* Bit 12: USB OTG FS module enable during Sleep mode */
#define RCC_AHB2SMENR_ADCSMEN (1 << 13) /* Bit 13: ADC interface enable during Sleep mode (common to all ADCs) */
+#define RCC_AHB2SMENR_DCMISMEN (1 << 14) /* Bit 14: DCMI interface enable during Sleep mode */
#define RCC_AHB2SMENR_AESSMEN (1 << 16) /* Bit 16: AES Cryptographic module enable during Sleep mode */
-#define RCC_AHB2SMENR_RNGSMEN (1 << 18) /* Bit 6: Random number generator module enable during Sleep mode */
+#define RCC_AHB2SMENR_HASHSMEN (1 << 17) /* Bit 17: HASH module enable during Sleep mode */
+#define RCC_AHB2SMENR_RNGSMEN (1 << 18) /* Bit 18: Random number generator module enable during Sleep mode */
/* RCC AHB3 low power mode peripheral clock enable register */
#define RCC_AHB3SMENR_FSMCSMEN (1 << 0) /* Bit 0: Flexible static memory controller module enable during Sleep mode */
#define RCC_AHB3SMENR_QSPISMEN (1 << 8) /* Bit 8: Quad SPI module enable during Sleep mode */
-/* RCC APB1 low power modeperipheral clock enable register 1 */
+/* RCC APB1 low power mode peripheral clock enable register 1 */
#define RCC_APB1SMENR1_TIM2SMEN (1 << 0) /* Bit 0: TIM2 enable during Sleep mode */
#define RCC_APB1SMENR1_TIM3SMEN (1 << 1) /* Bit 1: TIM3 enable during Sleep mode */
@@ -560,6 +586,7 @@
#define RCC_APB1SMENR1_TIM6SMEN (1 << 4) /* Bit 4: TIM6 enable during Sleep mode */
#define RCC_APB1SMENR1_TIM7SMEN (1 << 5) /* Bit 5: TIM7 enable during Sleep mode */
#define RCC_APB1SMENR1_LCDSMEN (1 << 9) /* Bit 9: LCD controller enable during Sleep mode */
+#define RCC_APB1SMENR1_RTCAPBSMEN (1 << 10) /* Bit 10: RTC APB clock enable during Sleep mode */
#define RCC_APB1SMENR1_WWDGSMEN (1 << 11) /* Bit 11: Windowed Watchdog enable during Sleep mode */
#define RCC_APB1SMENR1_SPI2SMEN (1 << 14) /* Bit 14: SPI2 enable during Sleep mode */
#define RCC_APB1SMENR1_SPI3SMEN (1 << 15) /* Bit 15: SPI3 enable during Sleep mode */
@@ -570,7 +597,9 @@
#define RCC_APB1SMENR1_I2C1SMEN (1 << 21) /* Bit 21: I2C1 enable during Sleep mode */
#define RCC_APB1SMENR1_I2C2SMEN (1 << 22) /* Bit 22: I2C2 enable during Sleep mode */
#define RCC_APB1SMENR1_I2C3SMEN (1 << 23) /* Bit 23: I2C3 enable during Sleep mode */
+#define RCC_APB1SMENR1_CRSSMEN (1 << 24) /* Bit 24: CRS enable during Sleep mode */
#define RCC_APB1SMENR1_CAN1SMEN (1 << 25) /* Bit 25: CAN1 enable during Sleep mode */
+#define RCC_APB1SMENR1_CAN2SMEN (1 << 26) /* Bit 26: CAN2 enable during Sleep mode */
#define RCC_APB1SMENR1_PWRSMEN (1 << 28) /* Bit 28: Power interface enable during Sleep mode */
#define RCC_APB1SMENR1_DAC1SMEN (1 << 29) /* Bit 29: DAC1 enable during Sleep mode */
#define RCC_APB1SMENR1_OPAMPSMEN (1 << 30) /* Bit 30: OPAMP enable during Sleep mode */
@@ -579,6 +608,7 @@
/* RCC APB1 low power modeperipheral clock enable register 2 */
#define RCC_APB1SMENR2_LPUART1SMEN (1 << 0) /* Bit 0: Low-power UART 1 enable during Sleep mode */
+#define RCC_APB1SMENR2_I2C4SMEN (1 << 1) /* Bit 1: I2C4 enable during Sleep mode */
#define RCC_APB1SMENR2_SWPMI1SMEN (1 << 2) /* Bit 2: Single Wire Protocol enable during Sleep mode */
#define RCC_APB1SMENR2_LPTIM2SMEN (1 << 5) /* Bit 5: Low-power Timer 2 enable during Sleep mode */
@@ -761,5 +791,21 @@
#define RCC_CSR_WWDGRSTF (1 << 30) /* Bit 30: Window watchdog reset flag */
#define RCC_CSR_LPWRRSTF (1 << 31) /* Bit 31: Low-Power reset flag */
-#endif /* CONFIG_STM32L4_STM32L476XX || CONFIG_STM32L4_STM32L486XX */
-#endif /* __ARCH_ARM_SRC_STM32L4_CHIP_STM32F42XXX_RCC_H */
+/* Clock recovery RC register (only on STM32L496xx/4A6xx) */
+
+#define RCC_CRRCR_HSI48CAL_SHIFT 7
+# define RCC_CRRCR_HSI48CAL_MASK (0x01ff << RCC_CRRCR_HSI48CAL_SHIFT) /* HSI48 clock calibration */
+
+#define RCC_CRRCR_HSI48ON (1 << 0) /* Bit 0: HSI48 clock enable */
+#define RCC_CRRCR_HSI48RDY (1 << 1) /* Bit 1: HSI48 clock ready flag */
+
+/* Peripheral Independent Clock Configuration 2 register (only on STM32L496xx/4A6xx) */
+
+#define RCC_CCIPR2_I2C4SEL_SHIFT (0)
+#define RCC_CCIPR2_I2C4SEL_MASK (3 << RCC_CCIPR2_I2C4SEL_SHIFT)
+# define RCC_CCIPR2_I2C4SEL_PCLK (0 << RCC_CCIPR2_I2C4SEL_SHIFT)
+# define RCC_CCIPR2_I2C4SEL_SYSCLK (1 << RCC_CCIPR2_I2C4SEL_SHIFT)
+# define RCC_CCIPR2_I2C4SEL_HSI (2 << RCC_CCIPR2_I2C4SEL_SHIFT)
+
+#endif /* CONFIG_STM32L4_STM32L476XX || CONFIG_STM32L4_STM32L486XX || CONFIG_STM32L4_STM32L496XX */
+#endif /* __ARCH_ARM_SRC_STM32L4_CHIP_STM32L4X6XX_RCC_H */
diff --git a/arch/arm/src/stm32l4/stm32l4_i2c.c b/arch/arm/src/stm32l4/stm32l4_i2c.c
index 3468af22be..9be4419de4 100644
--- a/arch/arm/src/stm32l4/stm32l4_i2c.c
+++ b/arch/arm/src/stm32l4/stm32l4_i2c.c
@@ -96,7 +96,8 @@
/* At least one I2C peripheral must be enabled */
-#if defined(CONFIG_STM32L4_I2C1) || defined(CONFIG_STM32L4_I2C2) || defined(CONFIG_STM32L4_I2C3)
+#if defined(CONFIG_STM32L4_I2C1) || defined(CONFIG_STM32L4_I2C2) || \
+ defined(CONFIG_STM32L4_I2C3) || defined(CONFIG_STM32L4_I2C4)
/************************************************************************************
* Pre-processor Definitions
@@ -214,7 +215,6 @@ struct stm32l4_i2c_config_s
uint32_t scl_pin; /* GPIO configuration for SCL as SCL */
uint32_t sda_pin; /* GPIO configuration for SDA as SDA */
#ifndef CONFIG_I2C_POLLED
- int (*isr)(int, void *, void *); /* Interrupt handler */
uint32_t ev_irq; /* Event IRQ */
uint32_t er_irq; /* Error IRQ */
#endif
@@ -289,17 +289,9 @@ static inline void stm32l4_i2c_sendstart(FAR struct stm32l4_i2c_priv_s *priv);
static inline void stm32l4_i2c_clrstart(FAR struct stm32l4_i2c_priv_s *priv);
static inline void stm32l4_i2c_sendstop(FAR struct stm32l4_i2c_priv_s *priv);
static inline uint32_t stm32l4_i2c_getstatus(FAR struct stm32l4_i2c_priv_s *priv);
-static int stm32l4_i2c_isr(struct stm32l4_i2c_priv_s * priv);
+static int stm32l4_i2c_isr_process(struct stm32l4_i2c_priv_s *priv);
#ifndef CONFIG_I2C_POLLED
-#ifdef CONFIG_STM32L4_I2C1
-static int stm32l4_i2c1_isr(int irq, void *context, FAR void *arg);
-#endif
-#ifdef CONFIG_STM32L4_I2C2
-static int stm32l4_i2c2_isr(int irq, void *context, FAR void *arg);
-#endif
-#ifdef CONFIG_STM32L4_I2C3
-static int stm32l4_i2c3_isr(int irq, void *context, FAR void *arg);
-#endif
+static int stm32l4_i2c_isr(int irq, void *context, FAR void *arg);
#endif
static int stm32l4_i2c_init(FAR struct stm32l4_i2c_priv_s *priv);
static int stm32l4_i2c_deinit(FAR struct stm32l4_i2c_priv_s *priv);
@@ -332,7 +324,6 @@ static const struct stm32l4_i2c_config_s stm32l4_i2c1_config =
.scl_pin = GPIO_I2C1_SCL,
.sda_pin = GPIO_I2C1_SDA,
#ifndef CONFIG_I2C_POLLED
- .isr = stm32l4_i2c1_isr,
.ev_irq = STM32L4_IRQ_I2C1EV,
.er_irq = STM32L4_IRQ_I2C1ER
#endif
@@ -362,7 +353,6 @@ static const struct stm32l4_i2c_config_s stm32l4_i2c2_config =
.scl_pin = GPIO_I2C2_SCL,
.sda_pin = GPIO_I2C2_SDA,
#ifndef CONFIG_I2C_POLLED
- .isr = stm32l4_i2c2_isr,
.ev_irq = STM32L4_IRQ_I2C2EV,
.er_irq = STM32L4_IRQ_I2C2ER
#endif
@@ -392,7 +382,6 @@ static const struct stm32l4_i2c_config_s stm32l4_i2c3_config =
.scl_pin = GPIO_I2C3_SCL,
.sda_pin = GPIO_I2C3_SDA,
#ifndef CONFIG_I2C_POLLED
- .isr = stm32l4_i2c3_isr,
.ev_irq = STM32L4_IRQ_I2C3EV,
.er_irq = STM32L4_IRQ_I2C3ER
#endif
@@ -413,6 +402,35 @@ struct stm32l4_i2c_priv_s stm32l4_i2c3_priv =
};
#endif
+#ifdef CONFIG_STM32L4_I2C4
+static const struct stm32l4_i2c_config_s stm32l4_i2c4_config =
+{
+ .base = STM32L4_I2C4_BASE,
+ .clk_bit = RCC_APB1ENR2_I2C4EN,
+ .reset_bit = RCC_APB1RSTR2_I2C4RST,
+ .scl_pin = GPIO_I2C4_SCL,
+ .sda_pin = GPIO_I2C4_SDA,
+#ifndef CONFIG_I2C_POLLED
+ .ev_irq = STM32L4_IRQ_I2C4EV,
+ .er_irq = STM32L4_IRQ_I2C4ER
+#endif
+};
+
+struct stm32l4_i2c_priv_s stm32l4_i2c4_priv =
+{
+ .ops = &stm32l4_i2c_ops,
+ .config = &stm32l4_i2c4_config,
+ .refs = 0,
+ .intstate = INTSTATE_IDLE,
+ .msgc = 0,
+ .msgv = NULL,
+ .ptr = NULL,
+ .dcnt = 0,
+ .flags = 0,
+ .status = 0
+};
+#endif
+
/************************************************************************************
* Private Functions
************************************************************************************/
@@ -656,7 +674,7 @@ static inline int stm32l4_i2c_sem_waitdone(FAR struct stm32l4_i2c_priv_s *priv)
* reports that it is done.
*/
- stm32l4_i2c_isr(priv);
+ stm32l4_i2c_isr_process(priv);
}
/* Loop until the transfer is complete. */
@@ -1265,7 +1283,7 @@ static inline uint32_t stm32l4_i2c_getstatus(FAR struct stm32l4_i2c_priv_s *priv
}
/************************************************************************************
- * Name: stm32l4_i2c_isr
+ * Name: stm32l4_i2c_isr_startmessage
*
* Description:
* Common logic when a message is started. Just adds the even to the trace buffer
@@ -1298,14 +1316,14 @@ static inline void stm32l4_i2c_clearinterrupts(struct stm32l4_i2c_priv_s *priv)
}
/************************************************************************************
- * Name: stm32l4_i2c_isr
+ * Name: stm32l4_i2c_isr_process
*
* Description:
- * Common Interrupt Service Routine
+ * I2C processing logic common to polled and non-polled operation.
*
************************************************************************************/
-static int stm32l4_i2c_isr(struct stm32l4_i2c_priv_s *priv)
+static int stm32l4_i2c_isr_process(struct stm32l4_i2c_priv_s *priv)
{
uint32_t status = stm32l4_i2c_getstatus(priv);
@@ -1507,56 +1525,23 @@ static int stm32l4_i2c_isr(struct stm32l4_i2c_priv_s *priv)
}
/************************************************************************************
- * Name: stm32l4_i2c1_isr
+ * Name: stm32l4_i2c_isr
*
* Description:
- * I2C1 interrupt service routine
- *
- ************************************************************************************/
-
-#ifndef CONFIG_I2C_POLLED
-#ifdef CONFIG_STM32L4_I2C1
-static int stm32l4_i2c1_isr(int irq, void *context, FAR void *arg)
-{
- return stm32l4_i2c_isr(&stm32l4_i2c1_priv);
-}
-#endif
-
-/************************************************************************************
- * Name: stm32l4_i2c2_isr
- *
- * Description:
- * I2C2 interrupt service routine
+ * I2C interrupt service routine
*
************************************************************************************/
#ifdef CONFIG_STM32L4_I2C2
-static int stm32l4_i2c2_isr(int irq, void *context, FAR void *arg)
+static int stm32l4_i2c_isr(int irq, void *context, FAR void *arg)
{
- return stm32l4_i2c_isr(&stm32l4_i2c2_priv);
+ struct stm32l4_i2c_priv_s *priv = (struct stm32l4_i2c_priv_s *priv)arg;
+
+ DEBUGASSERT(priv != NULL);
+ return stm32l4_i2c_isr_process(priv);
}
#endif
-/************************************************************************************
- * Name: stm32l4_i2c3_isr
- *
- * Description:
- * I2C2 interrupt service routine
- *
- ************************************************************************************/
-
-#ifdef CONFIG_STM32L4_I2C3
-static int stm32l4_i2c3_isr(int irq, void *context, FAR void *arg)
-{
- return stm32l4_i2c_isr(&stm32l4_i2c3_priv);
-}
-#endif
-#endif
-
-/************************************************************************************
- * Private Initialization and Deinitialization
- ************************************************************************************/
-
/************************************************************************************
* Name: stm32l4_i2c_init
*
@@ -1591,8 +1576,8 @@ static int stm32l4_i2c_init(FAR struct stm32l4_i2c_priv_s *priv)
/* Attach ISRs */
#ifndef CONFIG_I2C_POLLED
- irq_attach(priv->config->ev_irq, priv->config->isr, NULL);
- irq_attach(priv->config->er_irq, priv->config->isr, NULL);
+ irq_attach(priv->config->ev_irq, stm32l4_i2c_isr, priv);
+ irq_attach(priv->config->er_irq, stm32l4_i2c_isr, priv);
up_enable_irq(priv->config->ev_irq);
up_enable_irq(priv->config->er_irq);
#endif
@@ -2009,6 +1994,11 @@ FAR struct i2c_master_s *stm32l4_i2cbus_initialize(int port)
case 3:
priv = (struct stm32l4_i2c_priv_s *)&stm32l4_i2c3_priv;
break;
+#endif
+#ifdef CONFIG_STM32L4_I2C4
+ case 4:
+ priv = (struct stm32l4_i2c_priv_s *)&stm32l4_i2c4_priv;
+ break;
#endif
default:
return NULL;
@@ -2072,5 +2062,5 @@ int stm32l4_i2cbus_uninitialize(FAR struct i2c_master_s * dev)
return OK;
}
-#endif /* CONFIG_STM32L4_I2C1 || CONFIG_STM32L4_I2C2 || CONFIG_STM32L4_I2C3 */
+#endif /* CONFIG_STM32L4_I2C1 || CONFIG_STM32L4_I2C2 || CONFIG_STM32L4_I2C3 || CONFIG_STM32L4_I2C4 */
diff --git a/arch/arm/src/stm32l4/stm32l4_rcc.h b/arch/arm/src/stm32l4/stm32l4_rcc.h
index 33549648c2..6c77771ec6 100644
--- a/arch/arm/src/stm32l4/stm32l4_rcc.h
+++ b/arch/arm/src/stm32l4/stm32l4_rcc.h
@@ -33,8 +33,8 @@
*
************************************************************************************/
-#ifndef __ARCH_ARM_SRC_STM32L4_STM32L4_RRC_H
-#define __ARCH_ARM_SRC_STM32L4_STM32L4_RRC_H
+#ifndef __ARCH_ARM_SRC_STM32L4_STM32L4_RCC_H
+#define __ARCH_ARM_SRC_STM32L4_STM32L4_RCC_H
/************************************************************************************
* Included Files
@@ -187,11 +187,7 @@ void stm32l4_clockenable(void);
* Name: stm32l4_rcc_enablelse
*
* Description:
- * Enable the External Low-Speed (LSE) Oscillator and, if the RTC is
- * configured, setup the LSE as the RTC clock source, and enable the RTC.
- *
- * For the STM32L15X family, this will also select the LSE as the clock source of
- * the LCD.
+ * Enable the External Low-Speed (LSE) Oscillator.
*
* Input Parameters:
* None
diff --git a/arch/arm/src/stm32l4/stm32l4_spi.h b/arch/arm/src/stm32l4/stm32l4_spi.h
index 242a81f184..223cfb2b3d 100644
--- a/arch/arm/src/stm32l4/stm32l4_spi.h
+++ b/arch/arm/src/stm32l4/stm32l4_spi.h
@@ -64,8 +64,7 @@ extern "C"
* Public Data
************************************************************************************/
-struct spi_dev_s;
-enum spi_dev_e;
+struct spi_dev_s;
/************************************************************************************
* Public Functions
@@ -117,21 +116,21 @@ FAR struct spi_dev_s *stm32l4_spibus_initialize(int bus);
************************************************************************************/
#ifdef CONFIG_STM32L4_SPI1
-void stm32l4_spi1select(FAR struct spi_dev_s *dev, enum spi_dev_e devid, bool selected);
-uint8_t stm32l4_spi1status(FAR struct spi_dev_s *dev, enum spi_dev_e devid);
-int stm32l4_spi1cmddata(FAR struct spi_dev_s *dev, enum spi_dev_e devid, bool cmd);
+void stm32l4_spi1select(FAR struct spi_dev_s *dev, uint32_t devid, bool selected);
+uint8_t stm32l4_spi1status(FAR struct spi_dev_s *dev, uint32_t devid);
+int stm32l4_spi1cmddata(FAR struct spi_dev_s *dev, uint32_t devid, bool cmd);
#endif
#ifdef CONFIG_STM32L4_SPI2
-void stm32l4_spi2select(FAR struct spi_dev_s *dev, enum spi_dev_e devid, bool selected);
-uint8_t stm32l4_spi2status(FAR struct spi_dev_s *dev, enum spi_dev_e devid);
-int stm32l4_spi2cmddata(FAR struct spi_dev_s *dev, enum spi_dev_e devid, bool cmd);
+void stm32l4_spi2select(FAR struct spi_dev_s *dev, uint32_t devid, bool selected);
+uint8_t stm32l4_spi2status(FAR struct spi_dev_s *dev, uint32_t devid);
+int stm32l4_spi2cmddata(FAR struct spi_dev_s *dev, uint32_t devid, bool cmd);
#endif
#ifdef CONFIG_STM32L4_SPI3
-void stm32l4_spi3select(FAR struct spi_dev_s *dev, enum spi_dev_e devid, bool selected);
-uint8_t stm32l4_spi3status(FAR struct spi_dev_s *dev, enum spi_dev_e devid);
-int stm32l4_spi3cmddata(FAR struct spi_dev_s *dev, enum spi_dev_e devid, bool cmd);
+void stm32l4_spi3select(FAR struct spi_dev_s *dev, uint32_t devid, bool selected);
+uint8_t stm32l4_spi3status(FAR struct spi_dev_s *dev, uint32_t devid);
+int stm32l4_spi3cmddata(FAR struct spi_dev_s *dev, uint32_t devid, bool cmd);
#endif
/************************************************************************************
diff --git a/arch/arm/src/stm32l4/stm32l4x6xx_rcc.c b/arch/arm/src/stm32l4/stm32l4x6xx_rcc.c
index 8f6aa209b0..c043c100fa 100644
--- a/arch/arm/src/stm32l4/stm32l4x6xx_rcc.c
+++ b/arch/arm/src/stm32l4/stm32l4x6xx_rcc.c
@@ -159,6 +159,12 @@ static inline void rcc_enableahb1(void)
regval |= RCC_AHB1ENR_TSCEN;
#endif
+#ifdef CONFIG_STM32L4_DMA2D
+ /* DMA2D clock enable */
+
+ regval |= RCC_AHB1ENR_DMA2DEN;
+#endif
+
putreg32(regval, STM32L4_RCC_AHB1ENR); /* Enable peripherals */
}
@@ -220,12 +226,24 @@ static inline void rcc_enableahb2(void)
regval |= RCC_AHB2ENR_ADCEN;
#endif
+#ifdef CONFIG_STM32L4_DCMI
+ /* Digital Camera interfaces clock enable */
+
+ regval |= RCC_AHB2ENR_DCMIEN;
+#endif
+
#ifdef CONFIG_STM32L4_AES
/* Cryptographic modules clock enable */
regval |= RCC_AHB2ENR_AESEN;
#endif
+#ifdef CONFIG_STM32L4_HASH
+ /* HASH module clock enable */
+
+ regval |= RCC_AHB2ENR_HASHEN;
+#endif
+
#ifdef CONFIG_STM32L4_RNG
/* Random number generator clock enable */
@@ -389,6 +407,12 @@ static inline void rcc_enableapb1(void)
regval |= RCC_APB1ENR1_CAN1EN;
#endif
+#ifdef CONFIG_STM32L4_CAN2
+ /* CAN 2 clock enable */
+
+ regval |= RCC_APB1ENR1_CAN2EN;
+#endif
+
/* Power interface clock enable. The PWR block is always enabled so that
* we can set the internal voltage regulator as required.
*/
@@ -425,6 +449,12 @@ static inline void rcc_enableapb1(void)
regval |= RCC_APB1ENR2_LPUART1EN;
#endif
+#ifdef CONFIG_STM32L4_I2C4
+ /* I2C4 clock enable */
+
+ regval |= RCC_APB1ENR2_I2C4EN;
+#endif
+
#ifdef CONFIG_STM32L4_SWPMI
/* Single-wire protocol master clock enable */
@@ -889,7 +919,7 @@ static void stm32l4_stdclockconfig(void)
#endif
/****************************************************************************
- * Name: rcc_enableperiphals
+ * Name: rcc_enableperipherals
****************************************************************************/
static inline void rcc_enableperipherals(void)
diff --git a/arch/arm/src/tiva/tiva_ssi.h b/arch/arm/src/tiva/tiva_ssi.h
index 6ef306cefc..d0976c2aee 100644
--- a/arch/arm/src/tiva/tiva_ssi.h
+++ b/arch/arm/src/tiva/tiva_ssi.h
@@ -108,11 +108,10 @@ FAR struct spi_dev_s *tiva_ssibus_initialize(int port);
****************************************************************************/
struct spi_dev_s;
-enum spi_dev_e;
-void tiva_ssiselect(FAR struct spi_dev_s *dev, enum spi_dev_e devid, bool selected);
-uint8_t tiva_ssistatus(FAR struct spi_dev_s *dev, enum spi_dev_e devid);
+void tiva_ssiselect(FAR struct spi_dev_s *dev, uint32_t devid, bool selected);
+uint8_t tiva_ssistatus(FAR struct spi_dev_s *dev, uint32_t devid);
#ifdef CONFIG_SPI_CMDDATA
-int tiva_ssicmddata(FAR struct spi_dev_s *dev, enum spi_dev_e devid, bool cmd);
+int tiva_ssicmddata(FAR struct spi_dev_s *dev, uint32_t devid, bool cmd);
#endif
#if defined(__cplusplus)
diff --git a/arch/arm/src/xmc4/xmc4_spi.h b/arch/arm/src/xmc4/xmc4_spi.h
index 0ac514c5ce..5113665eda 100644
--- a/arch/arm/src/xmc4/xmc4_spi.h
+++ b/arch/arm/src/xmc4/xmc4_spi.h
@@ -63,8 +63,7 @@ extern "C"
* Public Data
************************************************************************************/
-struct spi_dev_s;
-enum spi_dev_e;
+struct spi_dev_s;
/****************************************************************************
* Public Function Prototypes
@@ -115,24 +114,24 @@ FAR struct spi_dev_s *xmc4_spibus_initialize(int bus);
************************************************************************************/
#ifdef CONFIG_XMC4_SPI0
-void xmc4_spi0select(FAR struct spi_dev_s *dev, enum spi_dev_e devid, bool selected);
-uint8_t xmc4_spi0status(FAR struct spi_dev_s *dev, enum spi_dev_e devid);
+void xmc4_spi0select(FAR struct spi_dev_s *dev, uint32_t devid, bool selected);
+uint8_t xmc4_spi0status(FAR struct spi_dev_s *dev, uint32_t devid);
#ifdef CONFIG_SPI_CMDDATA
-int xmc4_spi0cmddata(FAR struct spi_dev_s *dev, enum spi_dev_e devid, bool cmd);
+int xmc4_spi0cmddata(FAR struct spi_dev_s *dev, uint32_t devid, bool cmd);
#endif
#endif
#ifdef CONFIG_XMC4_SPI1
-void xmc4_spi1select(FAR struct spi_dev_s *dev, enum spi_dev_e devid, bool selected);
-uint8_t xmc4_spi1status(FAR struct spi_dev_s *dev, enum spi_dev_e devid);
+void xmc4_spi1select(FAR struct spi_dev_s *dev, uint32_t devid, bool selected);
+uint8_t xmc4_spi1status(FAR struct spi_dev_s *dev, uint32_t devid);
#ifdef CONFIG_SPI_CMDDATA
-int xmc4_spi1cmddata(FAR struct spi_dev_s *dev, enum spi_dev_e devid, bool cmd);
+int xmc4_spi1cmddata(FAR struct spi_dev_s *dev, uint32_t devid, bool cmd);
#endif
#endif
#ifdef CONFIG_XMC4_SPI2
-void xmc4_spi2select(FAR struct spi_dev_s *dev, enum spi_dev_e devid, bool selected);
-uint8_t xmc4_spi2status(FAR struct spi_dev_s *dev, enum spi_dev_e devid);
+void xmc4_spi2select(FAR struct spi_dev_s *dev, uint32_t devid, bool selected);
+uint8_t xmc4_spi2status(FAR struct spi_dev_s *dev, uint32_t devid);
#ifdef CONFIG_SPI_CMDDATA
-int xmc4_spi2cmddata(FAR struct spi_dev_s *dev, enum spi_dev_e devid, bool cmd);
+int xmc4_spi2cmddata(FAR struct spi_dev_s *dev, uint32_t devid, bool cmd);
#endif
#endif
diff --git a/arch/avr/src/avr/avr.h b/arch/avr/src/avr/avr.h
index b1b37befe6..0326d6d848 100644
--- a/arch/avr/src/avr/avr.h
+++ b/arch/avr/src/avr/avr.h
@@ -95,6 +95,8 @@ extern uint16_t g_idle_topstack;
#ifndef __ASSEMBLY__
+struct spi_dev_s; /* Forward references */
+
/************************************************************************************
* Name: up_copystate
*
@@ -150,9 +152,6 @@ uint8_t *up_doirq(uint8_t irq, uint8_t *regs);
*
****************************************************************************/
-struct spi_dev_s; /* Forward references */
-enum spi_dev_e; /* Forward references */
-
FAR struct spi_dev_s *avr_spibus_initialize(int port);
/************************************************************************************
@@ -183,10 +182,10 @@ FAR struct spi_dev_s *avr_spibus_initialize(int port);
************************************************************************************/
#ifdef CONFIG_AVR_SPI
-void avr_spiselect(FAR struct spi_dev_s *dev, enum spi_dev_e devid, bool selected);
-uint8_t avr_spistatus(FAR struct spi_dev_s *dev, enum spi_dev_e devid);
+void avr_spiselect(FAR struct spi_dev_s *dev, uint32_t devid, bool selected);
+uint8_t avr_spistatus(FAR struct spi_dev_s *dev, uint32_t devid);
#ifdef CONFIG_SPI_CMDDATA
-int avr_spicmddata(FAR struct spi_dev_s *dev, enum spi_dev_e devid, bool cmd);
+int avr_spicmddata(FAR struct spi_dev_s *dev, uint32_t devid, bool cmd);
#endif
#endif
diff --git a/arch/hc/src/m9s12/m9s12.h b/arch/hc/src/m9s12/m9s12.h
index 50e3a14abe..53da6a7726 100644
--- a/arch/hc/src/m9s12/m9s12.h
+++ b/arch/hc/src/m9s12/m9s12.h
@@ -338,8 +338,6 @@ int hcs12_ethinitialize(int intf);
****************************************************************************/
struct spi_dev_s; /* Forward reference */
-enum spi_dev_e; /* Forward reference */
-
FAR struct spi_dev_s *hcs12_spibus_initialize(int port);
/************************************************************************************
@@ -367,8 +365,8 @@ FAR struct spi_dev_s *hcs12_spibus_initialize(int port);
*
************************************************************************************/
-void hcs12_spiselect(FAR struct spi_dev_s *dev, enum spi_dev_e devid, bool selected);
-uint8_t hcs12_spistatus(FAR struct spi_dev_s *dev, enum spi_dev_e devid);
+void hcs12_spiselect(FAR struct spi_dev_s *dev, uint32_t devid, bool selected);
+uint8_t hcs12_spistatus(FAR struct spi_dev_s *dev, uint32_t devid);
#undef EXTERN
#if defined(__cplusplus)
diff --git a/arch/mips/src/pic32mx/pic32mx.h b/arch/mips/src/pic32mx/pic32mx.h
index a2de82ed5a..480ff80fb8 100644
--- a/arch/mips/src/pic32mx/pic32mx.h
+++ b/arch/mips/src/pic32mx/pic32mx.h
@@ -400,8 +400,6 @@ void pic32mx_dumpgpio(uint32_t pinset, const char *msg);
****************************************************************************/
struct spi_dev_s; /* Forward reference */
-enum spi_dev_e; /* Forward reference */
-
FAR struct spi_dev_s *pic32mx_spibus_initialize(int port);
/************************************************************************************
@@ -433,38 +431,38 @@ FAR struct spi_dev_s *pic32mx_spibus_initialize(int port);
************************************************************************************/
#ifdef CONFIG_PIC32MX_SPI1
-void pic32mx_spi1select(FAR struct spi_dev_s *dev, enum spi_dev_e devid,
+void pic32mx_spi1select(FAR struct spi_dev_s *dev, uint32_t devid,
bool selected);
-uint8_t pic32mx_spi1status(FAR struct spi_dev_s *dev, enum spi_dev_e devid);
+uint8_t pic32mx_spi1status(FAR struct spi_dev_s *dev, uint32_t devid);
#ifdef CONFIG_SPI_CMDDATA
-int pic32mx_spi1cmddata(FAR struct spi_dev_s *dev, enum spi_dev_e devid, bool cmd);
+int pic32mx_spi1cmddata(FAR struct spi_dev_s *dev, uint32_t devid, bool cmd);
#endif
#endif
#ifdef CONFIG_PIC32MX_SPI2
-void pic32mx_spi2select(FAR struct spi_dev_s *dev, enum spi_dev_e devid,
+void pic32mx_spi2select(FAR struct spi_dev_s *dev, uint32_t devid,
bool selected);
-uint8_t pic32mx_spi2status(FAR struct spi_dev_s *dev, enum spi_dev_e devid);
+uint8_t pic32mx_spi2status(FAR struct spi_dev_s *dev, uint32_t devid);
#ifdef CONFIG_SPI_CMDDATA
-int pic32mx_spi2cmddata(FAR struct spi_dev_s *dev, enum spi_dev_e devid, bool cmd);
+int pic32mx_spi2cmddata(FAR struct spi_dev_s *dev, uint32_t devid, bool cmd);
#endif
#endif
#ifdef CONFIG_PIC32MX_SPI3
-void pic32mx_spi3select(FAR struct spi_dev_s *dev, enum spi_dev_e devid,
+void pic32mx_spi3select(FAR struct spi_dev_s *dev, uint32_t devid,
bool selected);
-uint8_t pic32mx_spi3status(FAR struct spi_dev_s *dev, enum spi_dev_e devid);
+uint8_t pic32mx_spi3status(FAR struct spi_dev_s *dev, uint32_t devid);
#ifdef CONFIG_SPI_CMDDATA
-int pic32mx_spi3cmddata(FAR struct spi_dev_s *dev, enum spi_dev_e devid, bool cmd);
+int pic32mx_spi3cmddata(FAR struct spi_dev_s *dev, uint32_t devid, bool cmd);
#endif
#endif
#ifdef CONFIG_PIC32MX_SPI3
-void pic32mx_spi3select(FAR struct spi_dev_s *dev, enum spi_dev_e devid,
+void pic32mx_spi3select(FAR struct spi_dev_s *dev, uint32_t devid,
bool selected);
-uint8_t pic32mx_spi3status(FAR struct spi_dev_s *dev, enum spi_dev_e devid);
+uint8_t pic32mx_spi3status(FAR struct spi_dev_s *dev, uint32_t devid);
#ifdef CONFIG_SPI_CMDDATA
-int pic32mx_spi3cmddata(FAR struct spi_dev_s *dev, enum spi_dev_e devid, bool cmd);
+int pic32mx_spi3cmddata(FAR struct spi_dev_s *dev, uint32_t devid, bool cmd);
#endif
#endif
diff --git a/arch/mips/src/pic32mz/pic32mz-spi.h b/arch/mips/src/pic32mz/pic32mz-spi.h
index f908f63b7c..ce4d772e0a 100644
--- a/arch/mips/src/pic32mz/pic32mz-spi.h
+++ b/arch/mips/src/pic32mz/pic32mz-spi.h
@@ -71,7 +71,6 @@ extern "C"
************************************************************************************/
struct spi_dev_s; /* Forward reference */
-enum spi_dev_e; /* Forward reference */
/****************************************************************************
* Name: pic32mz_spibus_initialize
@@ -118,56 +117,56 @@ FAR struct spi_dev_s *pic32mz_spibus_initialize(int port);
************************************************************************************/
#ifdef CONFIG_PIC32MZ_SPI1
-void pic32mz_spi1select(FAR struct spi_dev_s *dev, enum spi_dev_e devid,
+void pic32mz_spi1select(FAR struct spi_dev_s *dev, uint32_t devid,
bool selected);
-uint8_t pic32mz_spi1status(FAR struct spi_dev_s *dev, enum spi_dev_e devid);
+uint8_t pic32mz_spi1status(FAR struct spi_dev_s *dev, uint32_t devid);
#ifdef CONFIG_SPI_CMDDATA
-int pic32mz_spi1cmddata(FAR struct spi_dev_s *dev, enum spi_dev_e devid, bool cmd);
+int pic32mz_spi1cmddata(FAR struct spi_dev_s *dev, uint32_t devid, bool cmd);
#endif
#endif
#ifdef CONFIG_PIC32MZ_SPI2
-void pic32mz_spi2select(FAR struct spi_dev_s *dev, enum spi_dev_e devid,
+void pic32mz_spi2select(FAR struct spi_dev_s *dev, uint32_t devid,
bool selected);
-uint8_t pic32mz_spi2status(FAR struct spi_dev_s *dev, enum spi_dev_e devid);
+uint8_t pic32mz_spi2status(FAR struct spi_dev_s *dev, uint32_t devid);
#ifdef CONFIG_SPI_CMDDATA
-int pic32mz_spi2cmddata(FAR struct spi_dev_s *dev, enum spi_dev_e devid, bool cmd);
+int pic32mz_spi2cmddata(FAR struct spi_dev_s *dev, uint32_t devid, bool cmd);
#endif
#endif
#ifdef CONFIG_PIC32MZ_SPI3
-void pic32mz_spi3select(FAR struct spi_dev_s *dev, enum spi_dev_e devid,
+void pic32mz_spi3select(FAR struct spi_dev_s *dev, uint32_t devid,
bool selected);
-uint8_t pic32mz_spi3status(FAR struct spi_dev_s *dev, enum spi_dev_e devid);
+uint8_t pic32mz_spi3status(FAR struct spi_dev_s *dev, uint32_t devid);
#ifdef CONFIG_SPI_CMDDATA
-int pic32mz_spi3cmddata(FAR struct spi_dev_s *dev, enum spi_dev_e devid, bool cmd);
+int pic32mz_spi3cmddata(FAR struct spi_dev_s *dev, uint32_t devid, bool cmd);
#endif
#endif
#ifdef CONFIG_PIC32MZ_SPI4
-void pic32mz_spi4select(FAR struct spi_dev_s *dev, enum spi_dev_e devid,
+void pic32mz_spi4select(FAR struct spi_dev_s *dev, uint32_t devid,
bool selected);
-uint8_t pic32mz_spi4status(FAR struct spi_dev_s *dev, enum spi_dev_e devid);
+uint8_t pic32mz_spi4status(FAR struct spi_dev_s *dev, uint32_t devid);
#ifdef CONFIG_SPI_CMDDATA
-int pic32mz_spi4cmddata(FAR struct spi_dev_s *dev, enum spi_dev_e devid, bool cmd);
+int pic32mz_spi4cmddata(FAR struct spi_dev_s *dev, uint32_t devid, bool cmd);
#endif
#endif
#ifdef CONFIG_PIC32MZ_SPI5
-void pic32mz_spi5select(FAR struct spi_dev_s *dev, enum spi_dev_e devid,
+void pic32mz_spi5select(FAR struct spi_dev_s *dev, uint32_t devid,
bool selected);
-uint8_t pic32mz_spi5status(FAR struct spi_dev_s *dev, enum spi_dev_e devid);
+uint8_t pic32mz_spi5status(FAR struct spi_dev_s *dev, uint32_t devid);
#ifdef CONFIG_SPI_CMDDATA
-int pic32mz_spi5cmddata(FAR struct spi_dev_s *dev, enum spi_dev_e devid, bool cmd);
+int pic32mz_spi5cmddata(FAR struct spi_dev_s *dev, uint32_t devid, bool cmd);
#endif
#endif
#ifdef CONFIG_PIC32MZ_SPI6
-void pic32mz_spi6select(FAR struct spi_dev_s *dev, enum spi_dev_e devid,
+void pic32mz_spi6select(FAR struct spi_dev_s *dev, uint32_t devid,
bool selected);
-uint8_t pic32mz_spi6status(FAR struct spi_dev_s *dev, enum spi_dev_e devid);
+uint8_t pic32mz_spi6status(FAR struct spi_dev_s *dev, uint32_t devid);
#ifdef CONFIG_SPI_CMDDATA
-int pic32mz_spi6cmddata(FAR struct spi_dev_s *dev, enum spi_dev_e devid, bool cmd);
+int pic32mz_spi6cmddata(FAR struct spi_dev_s *dev, uint32_t devid, bool cmd);
#endif
#endif
diff --git a/arch/sim/src/up_spiflash.c b/arch/sim/src/up_spiflash.c
index ad36789069..677bdafd96 100644
--- a/arch/sim/src/up_spiflash.c
+++ b/arch/sim/src/up_spiflash.c
@@ -200,11 +200,11 @@ static void spiflash_setbits(FAR struct spi_dev_s *dev, int nbits);
static uint16_t spiflash_send(FAR struct spi_dev_s *dev, uint16_t wd);
static void spiflash_exchange(FAR struct spi_dev_s *dev, FAR const void *txbuffer,
FAR void *rxbuffer, size_t nwords);
-static void spiflash_select(FAR struct spi_dev_s *dev, enum spi_dev_e devid,
+static void spiflash_select(FAR struct spi_dev_s *dev, uint32_t devid,
bool selected);
-static uint8_t spiflash_status(FAR struct spi_dev_s *dev, enum spi_dev_e devid);
+static uint8_t spiflash_status(FAR struct spi_dev_s *dev, uint32_t devid);
#ifdef CONFIG_SPI_CMDDATA
-static int spiflash_cmddata(FAR struct spi_dev_s *dev, enum spi_dev_e devid, bool cmd);
+static int spiflash_cmddata(FAR struct spi_dev_s *dev, uint32_t devid, bool cmd);
#endif
#ifndef CONFIG_SPI_EXCHANGE
static void spiflash_sndblock(FAR struct spi_dev_s *dev, FAR const void *txbuffer,
@@ -357,12 +357,12 @@ static int spiflash_lock(FAR struct spi_dev_s *dev, bool lock)
*
************************************************************************************/
-static void spiflash_select(FAR struct spi_dev_s *dev, enum spi_dev_e devid,
+static void spiflash_select(FAR struct spi_dev_s *dev, uint32_t devid,
bool selected)
{
FAR struct sim_spiflashdev_s *priv = (FAR struct sim_spiflashdev_s *)dev;
- if (devid == SPIDEV_FLASH)
+ if (devid == SPIDEV_FLASH(0))
{
priv->selected = selected;
@@ -392,7 +392,7 @@ static void spiflash_select(FAR struct spi_dev_s *dev, enum spi_dev_e devid,
************************************************************************************/
#ifdef CONFIG_SPI_CMDDATA
-static int spiflash_cmddata(FAR struct spi_dev_s *dev, enum spi_dev_e devid, bool cmd)
+static int spiflash_cmddata(FAR struct spi_dev_s *dev, uint32_t devid, bool cmd)
{
return 0;
}
@@ -467,7 +467,7 @@ static void spiflash_setbits(FAR struct spi_dev_s *dev, int nbits)
*
************************************************************************************/
-static uint8_t spiflash_status(FAR struct spi_dev_s *dev, enum spi_dev_e devid)
+static uint8_t spiflash_status(FAR struct spi_dev_s *dev, uint32_t devid)
{
return 0;
}
diff --git a/arch/x86/src/qemu/qemu.h b/arch/x86/src/qemu/qemu.h
index a42fd0a328..561c68da44 100644
--- a/arch/x86/src/qemu/qemu.h
+++ b/arch/x86/src/qemu/qemu.h
@@ -83,6 +83,8 @@ extern "C"
* Public Function Prototypes
************************************************************************************/
+struct spi_dev_s; /* Forward reference */
+
/************************************************************************************
* Name: i486_clockconfig
*
@@ -207,9 +209,6 @@ int i486_dumpgpio(uint16_t pinset, const char *msg);
*
****************************************************************************/
-struct spi_dev_s; /* Forward reference */
-enum spi_dev_e; /* Forward reference */
-
FAR struct spi_dev_s *i486_spibus_initialize(int port);
/************************************************************************************
@@ -241,14 +240,11 @@ FAR struct spi_dev_s *i486_spibus_initialize(int port);
*
************************************************************************************/
-struct spi_dev_s;
-enum spi_dev_e;
-
#ifdef CONFIG_I486_SPI
-void i486_spiselect(FAR struct spi_dev_s *dev, enum spi_dev_e devid, bool selected);
-uint8_t i486_spistatus(FAR struct spi_dev_s *dev, enum spi_dev_e devid);
+void i486_spiselect(FAR struct spi_dev_s *dev, uint32_t devid, bool selected);
+uint8_t i486_spistatus(FAR struct spi_dev_s *dev, uint32_t devid);
#ifdef CONFIG_SPI_CMDDATA
-int i486_spicmddata(FAR struct spi_dev_s *dev, enum spi_dev_e devid, bool cmd);
+int i486_spicmddata(FAR struct spi_dev_s *dev, uint32_t devid, bool cmd);
#endif
#endif
@@ -268,7 +264,6 @@ int i486_spicmddata(FAR struct spi_dev_s *dev, enum spi_dev_e devid, bool cmd);
*
****************************************************************************/
-struct spi_dev_s;
#ifdef CONFIG_I486_SPI
void spi_flush(FAR struct spi_dev_s *dev);
#endif
diff --git a/arch/z16/src/z16f/chip.h b/arch/z16/src/z16f/chip.h
index 9d4942f7b9..b395c6e3b5 100644
--- a/arch/z16/src/z16f/chip.h
+++ b/arch/z16/src/z16f/chip.h
@@ -677,7 +677,6 @@ void z16f_reset(void);
#ifdef CONFIG_Z16F_ESPI
struct spi_dev_s; /* Forward reference */
-enum spi_dev_e; /* Forward reference */
/* Initialize the selected SPI port */
@@ -685,16 +684,16 @@ FAR struct spi_dev_s *z16_spibus_initialize(int port);
/* Select an SPI device (see include/nuttx/spi/spi.h) */
-void z16f_espi_select(FAR struct spi_dev_s *dev, enum spi_dev_e devid, bool selected);
+void z16f_espi_select(FAR struct spi_dev_s *dev, uint32_t devid, bool selected);
/* Provide SPI device status (see include/nuttx/spi/spi.h) */
-uint8_t z16f_espi_status(FAR struct spi_dev_s *dev, enum spi_dev_e devid);
+uint8_t z16f_espi_status(FAR struct spi_dev_s *dev, uint32_t devid);
/* Select CMD/DATA options (often used with LCD devices) */
#ifdef CONFIG_SPI_CMDDATA
-int z16f_espi_cmddata(FAR struct spi_dev_s *dev, enum spi_dev_e devid, bool cmd);
+int z16f_espi_cmddata(FAR struct spi_dev_s *dev, uint32_t devid, bool cmd);
#endif
#endif
diff --git a/arch/z80/src/ez80/ez80f91_spi.h b/arch/z80/src/ez80/ez80f91_spi.h
index 36c0016f48..fe7c34bb7e 100644
--- a/arch/z80/src/ez80/ez80f91_spi.h
+++ b/arch/z80/src/ez80/ez80f91_spi.h
@@ -145,9 +145,9 @@ FAR struct spi_dev_s *ez80_spibus_initialize(int port);
*
************************************************************************************/
-void ez80_spiselect(FAR struct spi_dev_s *dev, enum spi_dev_e devid, bool selected);
-uint8_t ez80_spistatus(FAR struct spi_dev_s *dev, enum spi_dev_e devid);
-int ez80_spicmddata(FAR struct spi_dev_s *dev, enum spi_dev_e devid, bool cmd);
+void ez80_spiselect(FAR struct spi_dev_s *dev, uint32_t devid, bool selected);
+uint8_t ez80_spistatus(FAR struct spi_dev_s *dev, uint32_t devid);
+int ez80_spicmddata(FAR struct spi_dev_s *dev, uint32_t devid, bool cmd);
#undef EXTERN
#ifdef __cplusplus
diff --git a/binfmt/libelf/libelf_symbols.c b/binfmt/libelf/libelf_symbols.c
index ba67034e54..b93bdfdb3a 100644
--- a/binfmt/libelf/libelf_symbols.c
+++ b/binfmt/libelf/libelf_symbols.c
@@ -126,7 +126,7 @@ static int elf_symname(FAR struct elf_loadinfo_s *loadinfo,
/* Read that number of bytes into the array */
buffer = &loadinfo->iobuffer[bytesread];
- ret = elf_read(loadinfo, buffer, readlen, offset);
+ ret = elf_read(loadinfo, buffer, readlen, offset + bytesread);
if (ret < 0)
{
berr("elf_read failed: %d\n", ret);
diff --git a/configs/arduino-due/src/sam_mmcsd.c b/configs/arduino-due/src/sam_mmcsd.c
index b7556ea082..e6d461d58f 100644
--- a/configs/arduino-due/src/sam_mmcsd.c
+++ b/configs/arduino-due/src/sam_mmcsd.c
@@ -109,11 +109,11 @@
* Private Function Prototypes
****************************************************************************/
-static void spi_select(FAR struct spi_bitbang_s *priv, enum spi_dev_e devid,
+static void spi_select(FAR struct spi_bitbang_s *priv, uint32_t devid,
bool selected);
-static uint8_t spi_status(FAR struct spi_bitbang_s *priv, enum spi_dev_e devid);
+static uint8_t spi_status(FAR struct spi_bitbang_s *priv, uint32_t devid);
#ifdef CONFIG_SPI_CMDDATA
-static int spi_cmddata(FAR struct spi_bitbang_s *priv, enum spi_dev_e devid,
+static int spi_cmddata(FAR struct spi_bitbang_s *priv, uint32_t devid,
bool cmd);
#endif
@@ -142,10 +142,10 @@ static int spi_cmddata(FAR struct spi_bitbang_s *priv, enum spi_dev_e devid,
*
****************************************************************************/
-static void spi_select(FAR struct spi_bitbang_s *priv, enum spi_dev_e devid,
+static void spi_select(FAR struct spi_bitbang_s *priv, uint32_t devid,
bool selected)
{
- if (devid == SPIDEV_MMCSD)
+ if (devid == SPIDEV_MMCSD(0))
{
if (selected)
{
@@ -173,9 +173,9 @@ static void spi_select(FAR struct spi_bitbang_s *priv, enum spi_dev_e devid,
*
****************************************************************************/
-static uint8_t spi_status(FAR struct spi_bitbang_s *priv, enum spi_dev_e devid)
+static uint8_t spi_status(FAR struct spi_bitbang_s *priv, uint32_t devid)
{
- if (devid == SPIDEV_MMCSD)
+ if (devid == SPIDEV_MMCSD(0))
{
return SPI_STATUS_PRESENT;
}
@@ -200,7 +200,7 @@ static uint8_t spi_status(FAR struct spi_bitbang_s *priv, enum spi_dev_e devid)
****************************************************************************/
#ifdef CONFIG_SPI_CMDDATA
-static int spi_cmddata(FAR struct spi_bitbang_s *priv, enum spi_dev_e devid,
+static int spi_cmddata(FAR struct spi_bitbang_s *priv, uint32_t devid,
bool cmd)
{
return OK;
diff --git a/configs/arduino-due/src/sam_touchscreen.c b/configs/arduino-due/src/sam_touchscreen.c
index b93aa11f68..4e78c9376a 100644
--- a/configs/arduino-due/src/sam_touchscreen.c
+++ b/configs/arduino-due/src/sam_touchscreen.c
@@ -121,11 +121,11 @@
****************************************************************************/
/* Lower-half SPI */
-static void spi_select(FAR struct spi_bitbang_s *priv, enum spi_dev_e devid,
+static void spi_select(FAR struct spi_bitbang_s *priv, uint32_t devid,
bool selected);
-static uint8_t spi_status(FAR struct spi_bitbang_s *priv, enum spi_dev_e devid);
+static uint8_t spi_status(FAR struct spi_bitbang_s *priv, uint32_t devid);
#ifdef CONFIG_SPI_CMDDATA
-static int spi_cmddata(FAR struct spi_bitbang_s *priv, enum spi_dev_e devid,
+static int spi_cmddata(FAR struct spi_bitbang_s *priv, uint32_t devid,
bool cmd);
#endif
@@ -198,7 +198,7 @@ static struct ads7843e_config_s g_tscinfo =
*
****************************************************************************/
-static void spi_select(FAR struct spi_bitbang_s *priv, enum spi_dev_e devid,
+static void spi_select(FAR struct spi_bitbang_s *priv, uint32_t devid,
bool selected)
{
/* The touchscreen controller is always selected */
@@ -219,7 +219,7 @@ static void spi_select(FAR struct spi_bitbang_s *priv, enum spi_dev_e devid,
*
****************************************************************************/
-static uint8_t spi_status(FAR struct spi_bitbang_s *priv, enum spi_dev_e devid)
+static uint8_t spi_status(FAR struct spi_bitbang_s *priv, uint32_t devid)
{
return 0;
}
@@ -241,7 +241,7 @@ static uint8_t spi_status(FAR struct spi_bitbang_s *priv, enum spi_dev_e devid)
****************************************************************************/
#ifdef CONFIG_SPI_CMDDATA
-static int spi_cmddata(FAR struct spi_bitbang_s *priv, enum spi_dev_e devid,
+static int spi_cmddata(FAR struct spi_bitbang_s *priv, uint32_t devid,
bool cmd)
{
return OK;
diff --git a/configs/clicker2-stm32/src/stm32_spi.c b/configs/clicker2-stm32/src/stm32_spi.c
index 9780fcdb42..84e0538ab6 100644
--- a/configs/clicker2-stm32/src/stm32_spi.c
+++ b/configs/clicker2-stm32/src/stm32_spi.c
@@ -107,39 +107,39 @@ void weak_function stm32_spidev_initialize(void)
****************************************************************************/
#ifdef CONFIG_STM32_SPI1
-void stm32_spi1select(FAR struct spi_dev_s *dev, enum spi_dev_e devid, bool selected)
+void stm32_spi1select(FAR struct spi_dev_s *dev, uint32_t devid, bool selected)
{
spiinfo("devid: %d CS: %s\n", (int)devid, selected ? "assert" : "de-assert");
}
-uint8_t stm32_spi1status(FAR struct spi_dev_s *dev, enum spi_dev_e devid)
+uint8_t stm32_spi1status(FAR struct spi_dev_s *dev, uint32_t devid)
{
return 0;
}
#endif
#ifdef CONFIG_STM32_SPI2
-void stm32_spi2select(FAR struct spi_dev_s *dev, enum spi_dev_e devid, bool selected)
+void stm32_spi2select(FAR struct spi_dev_s *dev, uint32_t devid, bool selected)
{
spiinfo("devid: %d CS: %s\n", (int)devid, selected ? "assert" : "de-assert");
/* To be provided */
}
-uint8_t stm32_spi2status(FAR struct spi_dev_s *dev, enum spi_dev_e devid)
+uint8_t stm32_spi2status(FAR struct spi_dev_s *dev, uint32_t devid)
{
return 0;
}
#endif
#ifdef CONFIG_STM32_SPI3
-void stm32_spi3select(FAR struct spi_dev_s *dev, enum spi_dev_e devid, bool selected)
+void stm32_spi3select(FAR struct spi_dev_s *dev, uint32_t devid, bool selected)
{
spiinfo("devid: %d CS: %s\n", (int)devid, selected ? "assert" : "de-assert");
switch(devid)
{
#ifdef CONFIG_IEEE802154_MRF24J40
- case SPIDEV_IEEE802154:
+ case SPIDEV_IEEE802154(0):
/* Set the GPIO low to select and high to de-select */
stm32_gpiowrite(GPIO_MB1_CS, !selected);
break;
@@ -149,7 +149,7 @@ void stm32_spi3select(FAR struct spi_dev_s *dev, enum spi_dev_e devid, bool sele
}
}
-uint8_t stm32_spi3status(FAR struct spi_dev_s *dev, enum spi_dev_e devid)
+uint8_t stm32_spi3status(FAR struct spi_dev_s *dev, uint32_t devid)
{
return 0;
}
@@ -180,14 +180,14 @@ uint8_t stm32_spi3status(FAR struct spi_dev_s *dev, enum spi_dev_e devid)
#ifdef CONFIG_SPI_CMDDATA
#ifdef CONFIG_STM32_SPI1
-int stm32_spi1cmddata(FAR struct spi_dev_s *dev, enum spi_dev_e devid, bool cmd)
+int stm32_spi1cmddata(FAR struct spi_dev_s *dev, uint32_t devid, bool cmd)
{
return -ENODEV;
}
#endif
#ifdef CONFIG_STM32_SPI2
-int stm32_spi2cmddata(FAR struct spi_dev_s *dev, enum spi_dev_e devid, bool cmd)
+int stm32_spi2cmddata(FAR struct spi_dev_s *dev, uint32_t devid, bool cmd)
{
/* To be provided */
@@ -196,7 +196,7 @@ int stm32_spi2cmddata(FAR struct spi_dev_s *dev, enum spi_dev_e devid, bool cmd)
#endif
#ifdef CONFIG_STM32_SPI3
-int stm32_spi3cmddata(FAR struct spi_dev_s *dev, enum spi_dev_e devid, bool cmd)
+int stm32_spi3cmddata(FAR struct spi_dev_s *dev, uint32_t devid, bool cmd)
{
/* To be provided */
diff --git a/configs/cloudctrl/src/stm32_spi.c b/configs/cloudctrl/src/stm32_spi.c
index 13054c3165..4ba4e9560a 100644
--- a/configs/cloudctrl/src/stm32_spi.c
+++ b/configs/cloudctrl/src/stm32_spi.c
@@ -113,13 +113,13 @@ void weak_function stm32_spidev_initialize(void)
****************************************************************************/
#ifdef CONFIG_STM32_SPI1
-void stm32_spi1select(FAR struct spi_dev_s *dev, enum spi_dev_e devid, bool selected)
+void stm32_spi1select(FAR struct spi_dev_s *dev, uint32_t devid, bool selected)
{
spiinfo("devid: %d CS: %s\n", (int)devid, selected ? "assert" : "de-assert");
/* SPI1 connects to the SD CARD and to the SPI FLASH */
- if (devid == SPIDEV_FLASH)
+ if (devid == SPIDEV_FLASH(0))
{
/* Set the GPIO low to select and high to de-select */
@@ -127,7 +127,7 @@ void stm32_spi1select(FAR struct spi_dev_s *dev, enum spi_dev_e devid, bool sele
}
}
-uint8_t stm32_spi1status(FAR struct spi_dev_s *dev, enum spi_dev_e devid)
+uint8_t stm32_spi1status(FAR struct spi_dev_s *dev, uint32_t devid)
{
return SPI_STATUS_PRESENT;
@@ -135,13 +135,13 @@ uint8_t stm32_spi1status(FAR struct spi_dev_s *dev, enum spi_dev_e devid)
#endif
#ifdef CONFIG_STM32_SPI3
-void stm32_spi3select(FAR struct spi_dev_s *dev, enum spi_dev_e devid, bool selected)
+void stm32_spi3select(FAR struct spi_dev_s *dev, uint32_t devid, bool selected)
{
spiinfo("devid: %d CS: %s\n", (int)devid, selected ? "assert" : "de-assert");
}
-uint8_t stm32_spi3status(FAR struct spi_dev_s *dev, enum spi_dev_e devid)
+uint8_t stm32_spi3status(FAR struct spi_dev_s *dev, uint32_t devid)
{
return 0;
}
diff --git a/configs/demo9s12ne64/src/m9s12_spi.c b/configs/demo9s12ne64/src/m9s12_spi.c
index e296ee5595..a869975170 100644
--- a/configs/demo9s12ne64/src/m9s12_spi.c
+++ b/configs/demo9s12ne64/src/m9s12_spi.c
@@ -91,11 +91,11 @@ void weak_function hcs12_spidev_initialize(void)
*
****************************************************************************/
-void hcs12_spiselect(FAR struct spi_dev_s *dev, enum spi_dev_e devid, bool selected)
+void hcs12_spiselect(FAR struct spi_dev_s *dev, uint32_t devid, bool selected)
{
}
-uint8_t hcs12_spistatus(FAR struct spi_dev_s *dev, enum spi_dev_e devid)
+uint8_t hcs12_spistatus(FAR struct spi_dev_s *dev, uint32_t devid)
{
return SPI_STATUS_PRESENT;
}
diff --git a/configs/dk-tm4c129x/src/tm4c_ssi.c b/configs/dk-tm4c129x/src/tm4c_ssi.c
index 8e142bfe32..fcaef493e8 100644
--- a/configs/dk-tm4c129x/src/tm4c_ssi.c
+++ b/configs/dk-tm4c129x/src/tm4c_ssi.c
@@ -102,14 +102,14 @@ void weak_function tm4c_ssidev_initialize(void)
*
****************************************************************************/
-void tiva_ssiselect(FAR struct spi_dev_s *dev, enum spi_dev_e devid, bool selected)
+void tiva_ssiselect(FAR struct spi_dev_s *dev, uint32_t devid, bool selected)
{
spiinfo("devid: %d CS: %s\n", (int)devid, selected ? "assert" : "de-assert");
ssi_dumpgpio("tiva_ssiselect() Entry");
ssi_dumpgpio("tiva_ssiselect() Exit");
}
-uint8_t tiva_ssistatus(FAR struct spi_dev_s *dev, enum spi_dev_e devid)
+uint8_t tiva_ssistatus(FAR struct spi_dev_s *dev, uint32_t devid)
{
spiinfo("Returning SPI_STATUS_PRESENT\n");
return SPI_STATUS_PRESENT;
diff --git a/configs/ea3131/src/lpc31_spi.c b/configs/ea3131/src/lpc31_spi.c
index 74914bdce6..b476b11ea9 100644
--- a/configs/ea3131/src/lpc31_spi.c
+++ b/configs/ea3131/src/lpc31_spi.c
@@ -99,13 +99,13 @@ void weak_function lpc31_spidev_intialize(void)
*
************************************************************************************/
-void lpc31_spiselect(FAR struct spi_dev_s *dev, enum spi_dev_e devid, bool selected)
+void lpc31_spiselect(FAR struct spi_dev_s *dev, uint32_t devid, bool selected)
{
spiinfo("devid: %d CS: %s\n", (int)devid, selected ? "assert" : "de-assert");
#warning "Missing logic"
}
-uint8_t lpc31_spistatus(FAR struct spi_dev_s *dev, enum spi_dev_e devid)
+uint8_t lpc31_spistatus(FAR struct spi_dev_s *dev, uint32_t devid)
{
return SPI_STATUS_PRESENT;
}
diff --git a/configs/ea3152/src/lpc31_spi.c b/configs/ea3152/src/lpc31_spi.c
index 0995794a0f..02bf6a71fc 100644
--- a/configs/ea3152/src/lpc31_spi.c
+++ b/configs/ea3152/src/lpc31_spi.c
@@ -99,13 +99,13 @@ void weak_function lpc31_spidev_intialize(void)
*
************************************************************************************/
-void lpc31_spiselect(FAR struct spi_dev_s *dev, enum spi_dev_e devid, bool selected)
+void lpc31_spiselect(FAR struct spi_dev_s *dev, uint32_t devid, bool selected)
{
spiinfo("devid: %d CS: %s\n", (int)devid, selected ? "assert" : "de-assert");
#warning "Missing logic"
}
-uint8_t lpc31_spistatus(FAR struct spi_dev_s *dev, enum spi_dev_e devid)
+uint8_t lpc31_spistatus(FAR struct spi_dev_s *dev, uint32_t devid)
{
return SPI_STATUS_PRESENT;
}
diff --git a/configs/eagle100/src/lm_ssi.c b/configs/eagle100/src/lm_ssi.c
index 7befb1f87d..a65fe7c085 100644
--- a/configs/eagle100/src/lm_ssi.c
+++ b/configs/eagle100/src/lm_ssi.c
@@ -107,10 +107,10 @@ void weak_function lm_ssidev_initialize(void)
*
****************************************************************************/
-void tiva_ssiselect(FAR struct spi_dev_s *dev, enum spi_dev_e devid, bool selected)
+void tiva_ssiselect(FAR struct spi_dev_s *dev, uint32_t devid, bool selected)
{
spiinfo("devid: %d CS: %s\n", (int)devid, selected ? "assert" : "de-assert");
- if (devid == SPIDEV_MMCSD)
+ if (devid == SPIDEV_MMCSD(0))
{
/* Assert the CS pin to the card */
@@ -120,7 +120,7 @@ void tiva_ssiselect(FAR struct spi_dev_s *dev, enum spi_dev_e devid, bool select
}
}
-uint8_t tiva_ssistatus(FAR struct spi_dev_s *dev, enum spi_dev_e devid)
+uint8_t tiva_ssistatus(FAR struct spi_dev_s *dev, uint32_t devid)
{
spiinfo("Returning SPI_STATUS_PRESENT\n");
return SPI_STATUS_PRESENT;
diff --git a/configs/ekk-lm3s9b96/src/lm_ssi.c b/configs/ekk-lm3s9b96/src/lm_ssi.c
index 911e923e84..cb9ee6e245 100644
--- a/configs/ekk-lm3s9b96/src/lm_ssi.c
+++ b/configs/ekk-lm3s9b96/src/lm_ssi.c
@@ -107,18 +107,18 @@ void weak_function lm_ssidev_initialize(void)
*
****************************************************************************/
-void tiva_ssiselect(FAR struct spi_dev_s *dev, enum spi_dev_e devid, bool selected)
+void tiva_ssiselect(FAR struct spi_dev_s *dev, uint32_t devid, bool selected)
{
spiinfo("devid: %d CS: %s\n", (int)devid, selected ? "assert" : "de-assert");
ssi_dumpgpio("tiva_ssiselect() Entry");
- if (devid == SPIDEV_MMCSD)
+ if (devid == SPIDEV_MMCSD(0))
{
/* Assert the CS pin to the card */
tiva_gpiowrite(SDCCS_GPIO, !selected);
}
#ifdef CONFIG_NX_LCDDRIVER
- else if (devid == SPIDEV_DISPLAY)
+ else if (devid == SPIDEV_DISPLAY(0))
{
/* Assert the CS pin to the display */
@@ -128,7 +128,7 @@ void tiva_ssiselect(FAR struct spi_dev_s *dev, enum spi_dev_e devid, bool select
ssi_dumpgpio("tiva_ssiselect() Exit");
}
-uint8_t tiva_ssistatus(FAR struct spi_dev_s *dev, enum spi_dev_e devid)
+uint8_t tiva_ssistatus(FAR struct spi_dev_s *dev, uint32_t devid)
{
spiinfo("Returning SPI_STATUS_PRESENT\n");
return SPI_STATUS_PRESENT;
diff --git a/configs/fire-stm32v2/src/stm32_spi.c b/configs/fire-stm32v2/src/stm32_spi.c
index 8d28ceb07a..a6b86ea92a 100644
--- a/configs/fire-stm32v2/src/stm32_spi.c
+++ b/configs/fire-stm32v2/src/stm32_spi.c
@@ -131,7 +131,7 @@ void weak_function stm32_spidev_initialize(void)
****************************************************************************/
#ifdef CONFIG_STM32_SPI1
-void stm32_spi1select(FAR struct spi_dev_s *dev, enum spi_dev_e devid, bool selected)
+void stm32_spi1select(FAR struct spi_dev_s *dev, uint32_t devid, bool selected)
{
spiinfo("devid: %d CS: %s\n", (int)devid, selected ? "assert" : "de-assert");
@@ -145,14 +145,14 @@ void stm32_spi1select(FAR struct spi_dev_s *dev, enum spi_dev_e devid, bool sele
else
#endif
#ifdef CONFIG_ENC28J60
- if (devid == SPIDEV_ETHERNET)
+ if (devid == SPIDEV_ETHERNET(0))
{
/* Set the GPIO low to select and high to de-select */
stm32_gpiowrite(GPIO_ENC28J60_CS, !selected);
}
#else
- if (devid == SPIDEV_FLASH)
+ if (devid == SPIDEV_FLASH(0))
{
/* Set the GPIO low to select and high to de-select */
@@ -161,14 +161,14 @@ void stm32_spi1select(FAR struct spi_dev_s *dev, enum spi_dev_e devid, bool sele
#endif
}
-uint8_t stm32_spi1status(FAR struct spi_dev_s *dev, enum spi_dev_e devid)
+uint8_t stm32_spi1status(FAR struct spi_dev_s *dev, uint32_t devid)
{
return SPI_STATUS_PRESENT;
}
#endif
#ifdef CONFIG_STM32_SPI2
-void stm32_spi2select(FAR struct spi_dev_s *dev, enum spi_dev_e devid, bool selected)
+void stm32_spi2select(FAR struct spi_dev_s *dev, uint32_t devid, bool selected)
{
spiinfo("devid: %d CS: %s\n", (int)devid, selected ? "assert" : "de-assert");
@@ -180,7 +180,7 @@ void stm32_spi2select(FAR struct spi_dev_s *dev, enum spi_dev_e devid, bool sele
}
}
-uint8_t stm32_spi2status(FAR struct spi_dev_s *dev, enum spi_dev_e devid)
+uint8_t stm32_spi2status(FAR struct spi_dev_s *dev, uint32_t devid)
{
return SPI_STATUS_PRESENT;
}
diff --git a/configs/freedom-k64f/src/k64_spi.c b/configs/freedom-k64f/src/k64_spi.c
index cae8680979..3fff145575 100644
--- a/configs/freedom-k64f/src/k64_spi.c
+++ b/configs/freedom-k64f/src/k64_spi.c
@@ -100,13 +100,13 @@ void weak_function k64_spidev_initialize(void)
************************************************************************************/
#ifdef CONFIG_KINETIS_SPI0
-void kinetis_spi0select(FAR struct spi_dev_s *dev, enum spi_dev_e devid, bool selected)
+void kinetis_spi0select(FAR struct spi_dev_s *dev, uint32_t devid, bool selected)
{
spiinfo("devid: %d CS: %s\n", (int)devid, selected ? "assert" : "de-assert");
# warning "Missing logic"
}
-uint8_t kinetis_spi0status(FAR struct spi_dev_s *dev, enum spi_dev_e devid)
+uint8_t kinetis_spi0status(FAR struct spi_dev_s *dev, uint32_t devid)
{
# warning "Missing logic"
return SPI_STATUS_PRESENT;
@@ -114,13 +114,13 @@ uint8_t kinetis_spi0status(FAR struct spi_dev_s *dev, enum spi_dev_e devid)
#endif
#ifdef CONFIG_KINETIS_SPI1
-void kinetis_spi1select(FAR struct spi_dev_s *dev, enum spi_dev_e devid, bool selected)
+void kinetis_spi1select(FAR struct spi_dev_s *dev, uint32_t devid, bool selected)
{
spiinfo("devid: %d CS: %s\n", (int)devid, selected ? "assert" : "de-assert");
# warning "Missing logic"
}
-uint8_t kinetis_spi1status(FAR struct spi_dev_s *dev, enum spi_dev_e devid)
+uint8_t kinetis_spi1status(FAR struct spi_dev_s *dev, uint32_t devid)
{
# warning "Missing logic"
return SPI_STATUS_PRESENT;
@@ -128,13 +128,13 @@ uint8_t kinetis_spi1status(FAR struct spi_dev_s *dev, enum spi_dev_e devid)
#endif
#ifdef CONFIG_KINETIS_SPI2
-void kinetis_spi2select(FAR struct spi_dev_s *dev, enum spi_dev_e devid, bool selected)
+void kinetis_spi2select(FAR struct spi_dev_s *dev, uint32_t devid, bool selected)
{
spiinfo("devid: %d CS: %s\n", (int)devid, selected ? "assert" : "de-assert");
# warning "Missing logic"
}
-uint8_t kinetis_spi2status(FAR struct spi_dev_s *dev, enum spi_dev_e devid)
+uint8_t kinetis_spi2status(FAR struct spi_dev_s *dev, uint32_t devid)
{
# warning "Missing logic"
return SPI_STATUS_PRESENT;
diff --git a/configs/freedom-k66f/src/k66_spi.c b/configs/freedom-k66f/src/k66_spi.c
index dca7c44a25..ce0c6eb78d 100644
--- a/configs/freedom-k66f/src/k66_spi.c
+++ b/configs/freedom-k66f/src/k66_spi.c
@@ -101,13 +101,13 @@ void weak_function k66_spidev_initialize(void)
************************************************************************************/
#ifdef CONFIG_KINETIS_SPI0
-void kinetis_spi0select(FAR struct spi_dev_s *dev, enum spi_dev_e devid, bool selected)
+void kinetis_spi0select(FAR struct spi_dev_s *dev, uint32_t devid, bool selected)
{
spiinfo("devid: %d CS: %s\n", (int)devid, selected ? "assert" : "de-assert");
# warning "Missing logic"
}
-uint8_t kinetis_spi0status(FAR struct spi_dev_s *dev, enum spi_dev_e devid)
+uint8_t kinetis_spi0status(FAR struct spi_dev_s *dev, uint32_t devid)
{
# warning "Missing logic"
return SPI_STATUS_PRESENT;
@@ -115,13 +115,13 @@ uint8_t kinetis_spi0status(FAR struct spi_dev_s *dev, enum spi_dev_e devid)
#endif
#ifdef CONFIG_KINETIS_SPI1
-void kinetis_spi1select(FAR struct spi_dev_s *dev, enum spi_dev_e devid, bool selected)
+void kinetis_spi1select(FAR struct spi_dev_s *dev, uint32_t devid, bool selected)
{
spiinfo("devid: %d CS: %s\n", (int)devid, selected ? "assert" : "de-assert");
# warning "Missing logic"
}
-uint8_t kinetis_spi1status(FAR struct spi_dev_s *dev, enum spi_dev_e devid)
+uint8_t kinetis_spi1status(FAR struct spi_dev_s *dev, uint32_t devid)
{
# warning "Missing logic"
return SPI_STATUS_PRESENT;
@@ -129,13 +129,13 @@ uint8_t kinetis_spi1status(FAR struct spi_dev_s *dev, enum spi_dev_e devid)
#endif
#ifdef CONFIG_KINETIS_SPI2
-void kinetis_spi2select(FAR struct spi_dev_s *dev, enum spi_dev_e devid, bool selected)
+void kinetis_spi2select(FAR struct spi_dev_s *dev, uint32_t devid, bool selected)
{
spiinfo("devid: %d CS: %s\n", (int)devid, selected ? "assert" : "de-assert");
# warning "Missing logic"
}
-uint8_t kinetis_spi2status(FAR struct spi_dev_s *dev, enum spi_dev_e devid)
+uint8_t kinetis_spi2status(FAR struct spi_dev_s *dev, uint32_t devid)
{
# warning "Missing logic"
return SPI_STATUS_PRESENT;
diff --git a/configs/freedom-kl25z/src/kl_spi.c b/configs/freedom-kl25z/src/kl_spi.c
index 5c41ae348c..e952963d1b 100644
--- a/configs/freedom-kl25z/src/kl_spi.c
+++ b/configs/freedom-kl25z/src/kl_spi.c
@@ -139,14 +139,14 @@ void weak_function kl_spidev_initialize(void)
****************************************************************************/
#ifdef CONFIG_KL_SPI0
-void kl_spi0select(FAR struct spi_dev_s *dev, enum spi_dev_e devid,
+void kl_spi0select(FAR struct spi_dev_s *dev, uint32_t devid,
bool selected)
{
spiinfo("devid: %d CS: %s\n",
(int)devid, selected ? "assert" : "de-assert");
#ifdef CONFIG_ADXL345_SPI
- if (devid == SPIDEV_ACCELEROMETER)
+ if (devid == SPIDEV_ACCELEROMETER(0))
{
/* Active low */
@@ -155,7 +155,7 @@ void kl_spi0select(FAR struct spi_dev_s *dev, enum spi_dev_e devid,
#endif
#if defined(CONFIG_WL_CC3000)
- if (devid == SPIDEV_WIRELESS)
+ if (devid == SPIDEV_WIRELESS(0))
{
kl_gpiowrite(GPIO_WIFI_CS, !selected);
}
@@ -165,7 +165,7 @@ void kl_spi0select(FAR struct spi_dev_s *dev, enum spi_dev_e devid,
#endif
#ifdef CONFIG_KL_SPI1
-void kl_spi1select(FAR struct spi_dev_s *dev, enum spi_dev_e devid,
+void kl_spi1select(FAR struct spi_dev_s *dev, uint32_t devid,
bool selected)
{
spiinfo("devid: %d CS: %s\n",
@@ -188,14 +188,14 @@ void kl_spi1select(FAR struct spi_dev_s *dev, enum spi_dev_e devid,
****************************************************************************/
#ifdef CONFIG_KL_SPI0
-uint8_t kl_spi0status(FAR struct spi_dev_s *dev, enum spi_dev_e devid)
+uint8_t kl_spi0status(FAR struct spi_dev_s *dev, uint32_t devid)
{
return 0;
}
#endif
#ifdef CONFIG_KL_SPI1
-uint8_t kl_spi1status(FAR struct spi_dev_s *dev, enum spi_dev_e devid)
+uint8_t kl_spi1status(FAR struct spi_dev_s *dev, uint32_t devid)
{
return 0;
}
@@ -220,14 +220,14 @@ uint8_t kl_spi1status(FAR struct spi_dev_s *dev, enum spi_dev_e devid)
#ifdef CONFIG_SPI_CMDDATA
#ifdef CONFIG_KL_SPI0
-int kl_spi0cmddata(FAR struct spi_dev_s *dev, enum spi_dev_e devid, bool cmd)
+int kl_spi0cmddata(FAR struct spi_dev_s *dev, uint32_t devid, bool cmd)
{
return 0;
}
#endif
#ifdef CONFIG_KL_SPI1
-int kl_spi1cmddata(FAR struct spi_dev_s *dev, enum spi_dev_e devid, bool cmd)
+int kl_spi1cmddata(FAR struct spi_dev_s *dev, uint32_t devid, bool cmd)
{
return 0;
}
diff --git a/configs/freedom-kl26z/src/kl_spi.c b/configs/freedom-kl26z/src/kl_spi.c
index 9b3cd6ff24..4c94db9fa3 100644
--- a/configs/freedom-kl26z/src/kl_spi.c
+++ b/configs/freedom-kl26z/src/kl_spi.c
@@ -130,7 +130,7 @@ void weak_function kl_spidev_initialize(void)
****************************************************************************/
#ifdef CONFIG_KL_SPI0
-void kl_spi0select(FAR struct spi_dev_s *dev, enum spi_dev_e devid,
+void kl_spi0select(FAR struct spi_dev_s *dev, uint32_t devid,
bool selected)
{
spiinfo("devid: %d CS: %s\n",
@@ -139,7 +139,7 @@ void kl_spi0select(FAR struct spi_dev_s *dev, enum spi_dev_e devid,
#endif
#ifdef CONFIG_KL_SPI1
-void kl_spi1select(FAR struct spi_dev_s *dev, enum spi_dev_e devid,
+void kl_spi1select(FAR struct spi_dev_s *dev, uint32_t devid,
bool selected)
{
spiinfo("devid: %d CS: %s\n",
@@ -162,14 +162,14 @@ void kl_spi1select(FAR struct spi_dev_s *dev, enum spi_dev_e devid,
****************************************************************************/
#ifdef CONFIG_KL_SPI0
-uint8_t kl_spi0status(FAR struct spi_dev_s *dev, enum spi_dev_e devid)
+uint8_t kl_spi0status(FAR struct spi_dev_s *dev, uint32_t devid)
{
return 0;
}
#endif
#ifdef CONFIG_KL_SPI1
-uint8_t kl_spi1status(FAR struct spi_dev_s *dev, enum spi_dev_e devid)
+uint8_t kl_spi1status(FAR struct spi_dev_s *dev, uint32_t devid)
{
return 0;
}
@@ -194,14 +194,14 @@ uint8_t kl_spi1status(FAR struct spi_dev_s *dev, enum spi_dev_e devid)
#ifdef CONFIG_SPI_CMDDATA
#ifdef CONFIG_KL_SPI0
-int kl_spi0cmddata(FAR struct spi_dev_s *dev, enum spi_dev_e devid, bool cmd)
+int kl_spi0cmddata(FAR struct spi_dev_s *dev, uint32_t devid, bool cmd)
{
return 0;
}
#endif
#ifdef CONFIG_KL_SPI1
-int kl_spi1cmddata(FAR struct spi_dev_s *dev, enum spi_dev_e devid, bool cmd)
+int kl_spi1cmddata(FAR struct spi_dev_s *dev, uint32_t devid, bool cmd)
{
return 0;
}
diff --git a/configs/hymini-stm32v/src/stm32_spi.c b/configs/hymini-stm32v/src/stm32_spi.c
index 25f18c961e..568cdb2494 100644
--- a/configs/hymini-stm32v/src/stm32_spi.c
+++ b/configs/hymini-stm32v/src/stm32_spi.c
@@ -107,11 +107,11 @@ void stm32_spidev_initialize(void)
****************************************************************************/
#ifdef CONFIG_STM32_SPI1
-void stm32_spi1select(FAR struct spi_dev_s *dev, enum spi_dev_e devid, bool selected)
+void stm32_spi1select(FAR struct spi_dev_s *dev, uint32_t devid, bool selected)
{
spiinfo("devid: %d CS: %s\n", (int)devid, selected ? "assert" : "de-assert");
- if (devid == SPIDEV_TOUCHSCREEN)
+ if (devid == SPIDEV_TOUCHSCREEN(0))
{
/* Set the GPIO low to select and high to de-select */
@@ -119,31 +119,31 @@ void stm32_spi1select(FAR struct spi_dev_s *dev, enum spi_dev_e devid, bool sele
}
}
-uint8_t stm32_spi1status(FAR struct spi_dev_s *dev, enum spi_dev_e devid)
+uint8_t stm32_spi1status(FAR struct spi_dev_s *dev, uint32_t devid)
{
return SPI_STATUS_PRESENT;
}
#endif
#ifdef CONFIG_STM32_SPI2
-void stm32_spi2select(FAR struct spi_dev_s *dev, enum spi_dev_e devid, bool selected)
+void stm32_spi2select(FAR struct spi_dev_s *dev, uint32_t devid, bool selected)
{
spiinfo("devid: %d CS: %s\n", (int)devid, selected ? "assert" : "de-assert");
}
-uint8_t stm32_spi2status(FAR struct spi_dev_s *dev, enum spi_dev_e devid)
+uint8_t stm32_spi2status(FAR struct spi_dev_s *dev, uint32_t devid)
{
return SPI_STATUS_PRESENT;
}
#endif
#ifdef CONFIG_STM32_SPI3
-void stm32_spi3select(FAR struct spi_dev_s *dev, enum spi_dev_e devid, bool selected)
+void stm32_spi3select(FAR struct spi_dev_s *dev, uint32_t devid, bool selected)
{
spiinfo("devid: %d CS: %s\n", (int)devid, selected ? "assert" : "de-assert");
}
-uint8_t stm32_spi3status(FAR struct spi_dev_s *dev, enum spi_dev_e devid)
+uint8_t stm32_spi3status(FAR struct spi_dev_s *dev, uint32_t devid)
{
return SPI_STATUS_PRESENT;
}
diff --git a/configs/kwikstik-k40/src/k40_spi.c b/configs/kwikstik-k40/src/k40_spi.c
index 43bb8db955..f9b554944b 100644
--- a/configs/kwikstik-k40/src/k40_spi.c
+++ b/configs/kwikstik-k40/src/k40_spi.c
@@ -97,13 +97,13 @@ void weak_function kinetis_spidev_initialize(void)
****************************************************************************/
#ifdef CONFIG_KINETIS_SPI0
-void kinetis_spi0select(FAR struct spi_dev_s *dev, enum spi_dev_e devid, bool selected)
+void kinetis_spi0select(FAR struct spi_dev_s *dev, uint32_t devid, bool selected)
{
spiinfo("devid: %d CS: %s\n", (int)devid, selected ? "assert" : "de-assert");
# warning "Missing logic"
}
-uint8_t kinetis_spi0status(FAR struct spi_dev_s *dev, enum spi_dev_e devid)
+uint8_t kinetis_spi0status(FAR struct spi_dev_s *dev, uint32_t devid)
{
# warning "Missing logic"
return SPI_STATUS_PRESENT;
@@ -111,13 +111,13 @@ uint8_t kinetis_spi0status(FAR struct spi_dev_s *dev, enum spi_dev_e devid)
#endif
#ifdef CONFIG_KINETIS_SPI1
-void kinetis_spi1select(FAR struct spi_dev_s *dev, enum spi_dev_e devid, bool selected)
+void kinetis_spi1select(FAR struct spi_dev_s *dev, uint32_t devid, bool selected)
{
spiinfo("devid: %d CS: %s\n", (int)devid, selected ? "assert" : "de-assert");
# warning "Missing logic"
}
-uint8_t kinetis_spi1status(FAR struct spi_dev_s *dev, enum spi_dev_e devid)
+uint8_t kinetis_spi1status(FAR struct spi_dev_s *dev, uint32_t devid)
{
# warning "Missing logic"
return SPI_STATUS_PRESENT;
@@ -125,13 +125,13 @@ uint8_t kinetis_spi1status(FAR struct spi_dev_s *dev, enum spi_dev_e devid)
#endif
#ifdef CONFIG_KINETIS_SPI2
-void kinetis_spi2select(FAR struct spi_dev_s *dev, enum spi_dev_e devid, bool selected)
+void kinetis_spi2select(FAR struct spi_dev_s *dev, uint32_t devid, bool selected)
{
spiinfo("devid: %d CS: %s\n", (int)devid, selected ? "assert" : "de-assert");
# warning "Missing logic"
}
-uint8_t kinetis_spi2status(FAR struct spi_dev_s *dev, enum spi_dev_e devid)
+uint8_t kinetis_spi2status(FAR struct spi_dev_s *dev, uint32_t devid)
{
# warning "Missing logic"
return SPI_STATUS_PRESENT;
diff --git a/configs/lm3s6432-s2e/src/lm_ssi.c b/configs/lm3s6432-s2e/src/lm_ssi.c
index 5c0e771a54..7b185642fc 100644
--- a/configs/lm3s6432-s2e/src/lm_ssi.c
+++ b/configs/lm3s6432-s2e/src/lm_ssi.c
@@ -105,12 +105,12 @@ void weak_function lm_ssidev_initialize(void)
*
****************************************************************************/
-void tiva_ssiselect(FAR struct spi_dev_s *dev, enum spi_dev_e devid, bool selected)
+void tiva_ssiselect(FAR struct spi_dev_s *dev, uint32_t devid, bool selected)
{
spiinfo("devid: %d CS: %s\n", (int)devid, selected ? "assert" : "de-assert");
ssi_dumpgpio("tiva_ssiselect() Entry");
- if (devid == SPIDEV_MMCSD)
+ if (devid == SPIDEV_MMCSD(0))
{
/* Assert the CS pin to the card */
@@ -120,7 +120,7 @@ void tiva_ssiselect(FAR struct spi_dev_s *dev, enum spi_dev_e devid, bool select
ssi_dumpgpio("tiva_ssiselect() Exit");
}
-uint8_t tiva_ssistatus(FAR struct spi_dev_s *dev, enum spi_dev_e devid)
+uint8_t tiva_ssistatus(FAR struct spi_dev_s *dev, uint32_t devid)
{
spiinfo("Returning SPI_STATUS_PRESENT\n");
return SPI_STATUS_PRESENT;
diff --git a/configs/lm3s6965-ek/src/lm_oled.c b/configs/lm3s6965-ek/src/lm_oled.c
index 2d72db7c1e..93705b76cd 100644
--- a/configs/lm3s6965-ek/src/lm_oled.c
+++ b/configs/lm3s6965-ek/src/lm_oled.c
@@ -162,9 +162,9 @@ FAR struct lcd_dev_s *board_graphics_setup(unsigned int devno)
*
****************************************************************************/
-int tiva_ssicmddata(FAR struct spi_dev_s *dev, enum spi_dev_e devid, bool cmd)
+int tiva_ssicmddata(FAR struct spi_dev_s *dev, uint32_t devid, bool cmd)
{
- if (devid == SPIDEV_DISPLAY)
+ if (devid == SPIDEV_DISPLAY(0))
{
/* Set GPIO to 1 for data, 0 for command */
diff --git a/configs/lm3s6965-ek/src/lm_ssi.c b/configs/lm3s6965-ek/src/lm_ssi.c
index 8cdf0b0122..980796f4a2 100644
--- a/configs/lm3s6965-ek/src/lm_ssi.c
+++ b/configs/lm3s6965-ek/src/lm_ssi.c
@@ -110,19 +110,19 @@ void weak_function lm_ssidev_initialize(void)
*
****************************************************************************/
-void tiva_ssiselect(FAR struct spi_dev_s *dev, enum spi_dev_e devid, bool selected)
+void tiva_ssiselect(FAR struct spi_dev_s *dev, uint32_t devid, bool selected)
{
spiinfo("devid: %d CS: %s\n", (int)devid, selected ? "assert" : "de-assert");
ssi_dumpgpio("tiva_ssiselect() Entry");
- if (devid == SPIDEV_MMCSD)
+ if (devid == SPIDEV_MMCSD(0))
{
/* Assert the CS pin to the card */
tiva_gpiowrite(SDCCS_GPIO, !selected);
}
#ifdef CONFIG_NX_LCDDRIVER
- else if (devid == SPIDEV_DISPLAY)
+ else if (devid == SPIDEV_DISPLAY(0))
{
/* Assert the CS pin to the display */
@@ -132,7 +132,7 @@ void tiva_ssiselect(FAR struct spi_dev_s *dev, enum spi_dev_e devid, bool select
ssi_dumpgpio("tiva_ssiselect() Exit");
}
-uint8_t tiva_ssistatus(FAR struct spi_dev_s *dev, enum spi_dev_e devid)
+uint8_t tiva_ssistatus(FAR struct spi_dev_s *dev, uint32_t devid)
{
spiinfo("Returning SPI_STATUS_PRESENT\n");
return SPI_STATUS_PRESENT;
diff --git a/configs/lm3s8962-ek/src/lm_oled.c b/configs/lm3s8962-ek/src/lm_oled.c
index 6e557a1220..cffc1e8a3c 100644
--- a/configs/lm3s8962-ek/src/lm_oled.c
+++ b/configs/lm3s8962-ek/src/lm_oled.c
@@ -160,9 +160,9 @@ FAR struct lcd_dev_s *board_graphics_setup(unsigned int devno)
*
****************************************************************************/
-int tiva_ssicmddata(FAR struct spi_dev_s *dev, enum spi_dev_e devid, bool cmd)
+int tiva_ssicmddata(FAR struct spi_dev_s *dev, uint32_t devid, bool cmd)
{
- if (devid == SPIDEV_DISPLAY)
+ if (devid == SPIDEV_DISPLAY(0))
{
/* Set GPIO to 1 for data, 0 for command */
diff --git a/configs/lm3s8962-ek/src/lm_ssi.c b/configs/lm3s8962-ek/src/lm_ssi.c
index 2347895503..3834ce5d78 100644
--- a/configs/lm3s8962-ek/src/lm_ssi.c
+++ b/configs/lm3s8962-ek/src/lm_ssi.c
@@ -110,19 +110,19 @@ void weak_function lm_ssidev_initialize(void)
*
****************************************************************************/
-void tiva_ssiselect(FAR struct spi_dev_s *dev, enum spi_dev_e devid, bool selected)
+void tiva_ssiselect(FAR struct spi_dev_s *dev, uint32_t devid, bool selected)
{
spiinfo("devid: %d CS: %s\n", (int)devid, selected ? "assert" : "de-assert");
ssi_dumpgpio("tiva_ssiselect() Entry");
- if (devid == SPIDEV_MMCSD)
+ if (devid == SPIDEV_MMCSD(0))
{
/* Assert the CS pin to the card */
tiva_gpiowrite(SDCCS_GPIO, !selected);
}
#ifdef CONFIG_NX_LCDDRIVER
- else if (devid == SPIDEV_DISPLAY)
+ else if (devid == SPIDEV_DISPLAY(0))
{
/* Assert the CS pin to the display */
@@ -132,7 +132,7 @@ void tiva_ssiselect(FAR struct spi_dev_s *dev, enum spi_dev_e devid, bool select
ssi_dumpgpio("tiva_ssiselect() Exit");
}
-uint8_t tiva_ssistatus(FAR struct spi_dev_s *dev, enum spi_dev_e devid)
+uint8_t tiva_ssistatus(FAR struct spi_dev_s *dev, uint32_t devid)
{
spiinfo("Returning SPI_STATUS_PRESENT\n");
return SPI_STATUS_PRESENT;
diff --git a/configs/lm4f120-launchpad/src/lm4f_ssi.c b/configs/lm4f120-launchpad/src/lm4f_ssi.c
index 2e8d3e49b5..d80b669db4 100644
--- a/configs/lm4f120-launchpad/src/lm4f_ssi.c
+++ b/configs/lm4f120-launchpad/src/lm4f_ssi.c
@@ -103,14 +103,14 @@ void weak_function lm4f_spidev_initialize(void)
*
****************************************************************************/
-void tiva_ssiselect(FAR struct spi_dev_s *dev, enum spi_dev_e devid, bool selected)
+void tiva_ssiselect(FAR struct spi_dev_s *dev, uint32_t devid, bool selected)
{
spiinfo("devid: %d CS: %s\n", (int)devid, selected ? "assert" : "de-assert");
ssi_dumpgpio("tiva_ssiselect() Entry");
ssi_dumpgpio("tiva_ssiselect() Exit");
}
-uint8_t tiva_ssistatus(FAR struct spi_dev_s *dev, enum spi_dev_e devid)
+uint8_t tiva_ssistatus(FAR struct spi_dev_s *dev, uint32_t devid)
{
spiinfo("Returning SPI_STATUS_PRESENT\n");
return SPI_STATUS_PRESENT;
diff --git a/configs/lpcxpresso-lpc1115/src/lpc11_ssp.c b/configs/lpcxpresso-lpc1115/src/lpc11_ssp.c
index 0d7be5f71e..a0ae6871f1 100644
--- a/configs/lpcxpresso-lpc1115/src/lpc11_ssp.c
+++ b/configs/lpcxpresso-lpc1115/src/lpc11_ssp.c
@@ -130,7 +130,7 @@ void weak_function lpcxpresso_sspdev_initialize(void)
************************************************************************************/
#ifdef CONFIG_LPC17_SSP0
-void lpc11_ssp0select(FAR struct spi_dev_s *dev, enum spi_dev_e devid, bool selected)
+void lpc11_ssp0select(FAR struct spi_dev_s *dev, uint32_t devid, bool selected)
{
spiinfo("devid: %d CS: %s\n", (int)devid, selected ? "assert" : "de-assert");
ssp_dumpgpio("lpc11_ssp0select() Entry");
@@ -140,7 +140,7 @@ void lpc11_ssp0select(FAR struct spi_dev_s *dev, enum spi_dev_e devid, bool sel
ssp_dumpgpio("lpc11_ssp0select() Exit");
}
-uint8_t lpc11_ssp0status(FAR struct spi_dev_s *dev, enum spi_dev_e devid)
+uint8_t lpc11_ssp0status(FAR struct spi_dev_s *dev, uint32_t devid)
{
spiinfo("Returning SPI_STATUS_PRESENT\n");
return SPI_STATUS_PRESENT;
@@ -148,19 +148,19 @@ uint8_t lpc11_ssp0status(FAR struct spi_dev_s *dev, enum spi_dev_e devid)
#endif
#ifdef CONFIG_LPC17_SSP1
-void lpc11_ssp1select(FAR struct spi_dev_s *dev, enum spi_dev_e devid, bool selected)
+void lpc11_ssp1select(FAR struct spi_dev_s *dev, uint32_t devid, bool selected)
{
spiinfo("devid: %d CS: %s\n", (int)devid, selected ? "assert" : "de-assert");
ssp_dumpgpio("lpc11_ssp1select() Entry");
- if (devid == SPIDEV_MMCSD)
+ if (devid == SPIDEV_MMCSD(0))
{
/* Assert/de-assert the CS pin to the card */
(void)lpc11_gpiowrite(LPCXPRESSO_SD_CS, !selected);
}
#ifdef CONFIG_NX_LCDDRIVER
- else if (devid == SPIDEV_DISPLAY)
+ else if (devid == SPIDEV_DISPLAY(0))
{
/* Assert the CS pin to the OLED display */
@@ -170,9 +170,9 @@ void lpc11_ssp1select(FAR struct spi_dev_s *dev, enum spi_dev_e devid, bool sel
ssp_dumpgpio("lpc11_ssp1select() Exit");
}
-uint8_t lpc11_ssp1status(FAR struct spi_dev_s *dev, enum spi_dev_e devid)
+uint8_t lpc11_ssp1status(FAR struct spi_dev_s *dev, uint32_t devid)
{
- if (devid == SPIDEV_MMCSD)
+ if (devid == SPIDEV_MMCSD(0))
{
/* Read the state of the card-detect bit */
diff --git a/configs/lpcxpresso-lpc1768/src/lpc17_oled.c b/configs/lpcxpresso-lpc1768/src/lpc17_oled.c
index 063af42b2d..62050a2297 100644
--- a/configs/lpcxpresso-lpc1768/src/lpc17_oled.c
+++ b/configs/lpcxpresso-lpc1768/src/lpc17_oled.c
@@ -159,9 +159,9 @@ FAR struct lcd_dev_s *board_graphics_setup(unsigned int devno)
*
****************************************************************************/
-int lpc17_ssp1cmddata(FAR struct spi_dev_s *dev, enum spi_dev_e devid, bool cmd)
+int lpc17_ssp1cmddata(FAR struct spi_dev_s *dev, uint32_t devid, bool cmd)
{
- if (devid == SPIDEV_DISPLAY)
+ if (devid == SPIDEV_DISPLAY(0))
{
/* Set GPIO to 1 for data, 0 for command */
diff --git a/configs/lpcxpresso-lpc1768/src/lpc17_ssp.c b/configs/lpcxpresso-lpc1768/src/lpc17_ssp.c
index c56ab46939..4aace2c26c 100644
--- a/configs/lpcxpresso-lpc1768/src/lpc17_ssp.c
+++ b/configs/lpcxpresso-lpc1768/src/lpc17_ssp.c
@@ -130,7 +130,7 @@ void weak_function lpcxpresso_sspdev_initialize(void)
************************************************************************************/
#ifdef CONFIG_LPC17_SSP0
-void lpc17_ssp0select(FAR struct spi_dev_s *dev, enum spi_dev_e devid, bool selected)
+void lpc17_ssp0select(FAR struct spi_dev_s *dev, uint32_t devid, bool selected)
{
spiinfo("devid: %d CS: %s\n", (int)devid, selected ? "assert" : "de-assert");
ssp_dumpgpio("lpc17_ssp0select() Entry");
@@ -140,7 +140,7 @@ void lpc17_ssp0select(FAR struct spi_dev_s *dev, enum spi_dev_e devid, bool sel
ssp_dumpgpio("lpc17_ssp0select() Exit");
}
-uint8_t lpc17_ssp0status(FAR struct spi_dev_s *dev, enum spi_dev_e devid)
+uint8_t lpc17_ssp0status(FAR struct spi_dev_s *dev, uint32_t devid)
{
spiinfo("Returning SPI_STATUS_PRESENT\n");
return SPI_STATUS_PRESENT;
@@ -148,19 +148,19 @@ uint8_t lpc17_ssp0status(FAR struct spi_dev_s *dev, enum spi_dev_e devid)
#endif
#ifdef CONFIG_LPC17_SSP1
-void lpc17_ssp1select(FAR struct spi_dev_s *dev, enum spi_dev_e devid, bool selected)
+void lpc17_ssp1select(FAR struct spi_dev_s *dev, uint32_t devid, bool selected)
{
spiinfo("devid: %d CS: %s\n", (int)devid, selected ? "assert" : "de-assert");
ssp_dumpgpio("lpc17_ssp1select() Entry");
- if (devid == SPIDEV_MMCSD)
+ if (devid == SPIDEV_MMCSD(0))
{
/* Assert/de-assert the CS pin to the card */
(void)lpc17_gpiowrite(LPCXPRESSO_SD_CS, !selected);
}
#ifdef CONFIG_NX_LCDDRIVER
- else if (devid == SPIDEV_DISPLAY)
+ else if (devid == SPIDEV_DISPLAY(0))
{
/* Assert the CS pin to the OLED display */
@@ -170,9 +170,9 @@ void lpc17_ssp1select(FAR struct spi_dev_s *dev, enum spi_dev_e devid, bool sel
ssp_dumpgpio("lpc17_ssp1select() Exit");
}
-uint8_t lpc17_ssp1status(FAR struct spi_dev_s *dev, enum spi_dev_e devid)
+uint8_t lpc17_ssp1status(FAR struct spi_dev_s *dev, uint32_t devid)
{
- if (devid == SPIDEV_MMCSD)
+ if (devid == SPIDEV_MMCSD(0))
{
/* Read the state of the card-detect bit */
diff --git a/configs/maple/src/stm32_spi.c b/configs/maple/src/stm32_spi.c
index 95040a67bf..b13125d8c4 100644
--- a/configs/maple/src/stm32_spi.c
+++ b/configs/maple/src/stm32_spi.c
@@ -104,42 +104,42 @@ void weak_function stm32_spidev_initialize(void)
****************************************************************************/
#ifdef CONFIG_STM32_SPI1
-void stm32_spi1select(FAR struct spi_dev_s *dev, enum spi_dev_e devid,
+void stm32_spi1select(FAR struct spi_dev_s *dev, uint32_t devid,
bool selected)
{
spiinfo("devid: %d CS: %s\n", (int)devid, selected ? "assert" : "de-assert");
# if defined(CONFIG_LCD_SHARP_MEMLCD)
- if (devid == SPIDEV_DISPLAY)
+ if (devid == SPIDEV_DISPLAY(0))
{
stm32_gpiowrite(GPIO_MEMLCD_CS, selected);
}
# endif
}
-uint8_t stm32_spi1status(FAR struct spi_dev_s *dev, enum spi_dev_e devid)
+uint8_t stm32_spi1status(FAR struct spi_dev_s *dev, uint32_t devid)
{
return 0;
}
-int stm32_spi1cmddata(FAR struct spi_dev_s *dev, enum spi_dev_e devid, bool cmd)
+int stm32_spi1cmddata(FAR struct spi_dev_s *dev, uint32_t devid, bool cmd)
{
return -ENODEV;
}
#endif
#ifdef CONFIG_STM32_SPI2
-void stm32_spi2select(FAR struct spi_dev_s *dev, enum spi_dev_e devid,
+void stm32_spi2select(FAR struct spi_dev_s *dev, uint32_t devid,
bool selected)
{
}
-uint8_t stm32_spi2status(FAR struct spi_dev_s *dev, enum spi_dev_e devid)
+uint8_t stm32_spi2status(FAR struct spi_dev_s *dev, uint32_t devid)
{
return 0;
}
-int stm32_spi1cmddata(FAR struct spi_dev_s *dev, enum spi_dev_e devid, bool cmd)
+int stm32_spi1cmddata(FAR struct spi_dev_s *dev, uint32_t devid, bool cmd)
{
return -ENODEV;
}
diff --git a/configs/mcu123-lpc214x/src/lpc2148_spi1.c b/configs/mcu123-lpc214x/src/lpc2148_spi1.c
index 72f4b12ccb..bb9315dc2f 100644
--- a/configs/mcu123-lpc214x/src/lpc2148_spi1.c
+++ b/configs/mcu123-lpc214x/src/lpc2148_spi1.c
@@ -108,11 +108,11 @@
****************************************************************************/
static int spi_lock(FAR struct spi_dev_s *dev, bool lock);
-static void spi_select(FAR struct spi_dev_s *dev, enum spi_dev_e devid, bool selected);
+static void spi_select(FAR struct spi_dev_s *dev, uint32_t 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);
+static uint8_t spi_status(FAR struct spi_dev_s *dev, uint32_t devid);
#ifdef CONFIG_SPI_CMDDATA
-static int spi_cmddata(FAR struct spi_dev_s *dev, enum spi_dev_e devid, bool cmd);
+static int spi_cmddata(FAR struct spi_dev_s *dev, uint32_t devid, bool cmd);
#endif
static uint16_t spi_send(FAR struct spi_dev_s *dev, uint16_t ch);
static void spi_sndblock(FAR struct spi_dev_s *dev, FAR const void *buffer, size_t nwords);
@@ -210,7 +210,7 @@ static int spi_lock(FAR struct spi_dev_s *dev, bool lock)
*
****************************************************************************/
-static void spi_select(FAR struct spi_dev_s *dev, enum spi_dev_e devid, bool selected)
+static void spi_select(FAR struct spi_dev_s *dev, uint32_t devid, bool selected)
{
uint32_t bit = 1 << 20;
@@ -301,7 +301,7 @@ 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)
+static uint8_t spi_status(FAR struct spi_dev_s *dev, uint32_t devid)
{
/* I don't think there is anyway to determine these things on the mcu123.com
* board.
@@ -336,7 +336,7 @@ static uint8_t spi_status(FAR struct spi_dev_s *dev, enum spi_dev_e devid)
****************************************************************************/
#ifdef CONFIG_SPI_CMDDATA
-static int spi_cmddata(FAR struct spi_dev_s *dev, enum spi_dev_e devid, bool cmd)
+static int spi_cmddata(FAR struct spi_dev_s *dev, uint32_t devid, bool cmd)
{
# error "spi_cmddata not implemented"
return -ENOSYS;
diff --git a/configs/mikroe-stm32f4/src/stm32_spi.c b/configs/mikroe-stm32f4/src/stm32_spi.c
index 3831378ece..05bb88a21a 100644
--- a/configs/mikroe-stm32f4/src/stm32_spi.c
+++ b/configs/mikroe-stm32f4/src/stm32_spi.c
@@ -121,17 +121,17 @@ void weak_function stm32_spidev_initialize(void)
****************************************************************************/
#ifdef CONFIG_STM32_SPI3
-void stm32_spi3select(FAR struct spi_dev_s *dev, enum spi_dev_e devid, bool selected)
+void stm32_spi3select(FAR struct spi_dev_s *dev, uint32_t devid, bool selected)
{
spiinfo("devid: %d CS: %s\n", (int)devid, selected ? "assert" : "de-assert");
#if defined(CONFIG_VS1053)
- if (devid == SPIDEV_AUDIO_DATA)
+ if (devid == SPIDEV_AUDIO_DATA(0))
{
stm32_gpiowrite(GPIO_CS_MP3_DATA, !selected);
}
- else if (devid == SPIDEV_AUDIO_CTRL)
+ else if (devid == SPIDEV_AUDIO_CTRL(0))
{
stm32_gpiowrite(GPIO_CS_MP3_CMD, !selected);
}
@@ -139,7 +139,7 @@ void stm32_spi3select(FAR struct spi_dev_s *dev, enum spi_dev_e devid, bool sele
#endif
#if defined(CONFIG_MMCSD)
- if (devid == SPIDEV_MMCSD)
+ if (devid == SPIDEV_MMCSD(0))
{
stm32_gpiowrite(GPIO_CS_MMCSD, !selected);
}
@@ -147,7 +147,7 @@ void stm32_spi3select(FAR struct spi_dev_s *dev, enum spi_dev_e devid, bool sele
#endif
#if defined(CONFIG_MTD_M25P)
- if (devid == SPIDEV_FLASH)
+ if (devid == SPIDEV_FLASH(0))
{
stm32_gpiowrite(GPIO_CS_FLASH, !selected);
}
@@ -156,18 +156,18 @@ void stm32_spi3select(FAR struct spi_dev_s *dev, enum spi_dev_e devid, bool sele
/* Must be the expansion header device */
- if (devid == SPIDEV_EXPANDER)
+ if (devid == SPIDEV_EXPANDER(0))
{
stm32_gpiowrite(GPIO_CS_EXP_SPI3, !selected);
}
}
-uint8_t stm32_spi3status(FAR struct spi_dev_s *dev, enum spi_dev_e devid)
+uint8_t stm32_spi3status(FAR struct spi_dev_s *dev, uint32_t devid)
{
uint8_t ret = 0;
#if defined(CONFIG_MMCSD)
- if (devid == SPIDEV_MMCSD)
+ if (devid == SPIDEV_MMCSD(0))
{
/* A low value indicates the card is present */
@@ -183,24 +183,24 @@ uint8_t stm32_spi3status(FAR struct spi_dev_s *dev, enum spi_dev_e devid)
#endif
#ifdef CONFIG_STM32_SPI2
-void stm32_spi2select(FAR struct spi_dev_s *dev, enum spi_dev_e devid, bool selected)
+void stm32_spi2select(FAR struct spi_dev_s *dev, uint32_t devid, bool selected)
{
spiinfo("devid: %d CS: %s\n", (int)devid, selected ? "assert" : "de-assert");
}
-uint8_t stm32_spi2status(FAR struct spi_dev_s *dev, enum spi_dev_e devid)
+uint8_t stm32_spi2status(FAR struct spi_dev_s *dev, uint32_t devid)
{
return 0;
}
#endif
#ifdef CONFIG_STM32_SPI1
-void stm32_spi1select(FAR struct spi_dev_s *dev, enum spi_dev_e devid, bool selected)
+void stm32_spi1select(FAR struct spi_dev_s *dev, uint32_t devid, bool selected)
{
spiinfo("devid: %d CS: %s\n", (int)devid, selected ? "assert" : "de-assert");
}
-uint8_t stm32_spi1status(FAR struct spi_dev_s *dev, enum spi_dev_e devid)
+uint8_t stm32_spi1status(FAR struct spi_dev_s *dev, uint32_t devid)
{
return 0;
}
@@ -231,21 +231,21 @@ uint8_t stm32_spi1status(FAR struct spi_dev_s *dev, enum spi_dev_e devid)
#ifdef CONFIG_SPI_CMDDATA
#ifdef CONFIG_STM32_SPI1
-int stm32_spi1cmddata(FAR struct spi_dev_s *dev, enum spi_dev_e devid, bool cmd)
+int stm32_spi1cmddata(FAR struct spi_dev_s *dev, uint32_t devid, bool cmd)
{
return -ENODEV;
}
#endif
#ifdef CONFIG_STM32_SPI2
-int stm32_spi2cmddata(FAR struct spi_dev_s *dev, enum spi_dev_e devid, bool cmd)
+int stm32_spi2cmddata(FAR struct spi_dev_s *dev, uint32_t devid, bool cmd)
{
return OK;
}
#endif
#ifdef CONFIG_STM32_SPI3
-int stm32_spi3cmddata(FAR struct spi_dev_s *dev, enum spi_dev_e devid, bool cmd)
+int stm32_spi3cmddata(FAR struct spi_dev_s *dev, uint32_t devid, bool cmd)
{
return OK;
}
diff --git a/configs/mirtoo/src/pic32_spi2.c b/configs/mirtoo/src/pic32_spi2.c
index 3c1d513b83..2b74f7957b 100644
--- a/configs/mirtoo/src/pic32_spi2.c
+++ b/configs/mirtoo/src/pic32_spi2.c
@@ -154,29 +154,28 @@ void weak_function pic32mx_spi2initialize(void)
************************************************************************************/
struct spi_dev_s;
-enum spi_dev_e;
-void pic32mx_spi2select(FAR struct spi_dev_s *dev, enum spi_dev_e devid, bool selected)
+void pic32mx_spi2select(FAR struct spi_dev_s *dev, uint32_t devid, bool selected)
{
spiinfo("devid: %d CS: %s\n", (int)devid, selected ? "assert" : "de-assert");
- if (devid == SPIDEV_FLASH)
+ if (devid == SPIDEV_FLASH(0))
{
pic32mx_gpiowrite(GPIO_SST25VF032B_CS, !selected);
}
- else if (devid == SPIDEV_MUX)
+ else if (devid == SPIDEV_MUX(0))
{
pic32mx_gpiowrite(GPIO_PGA117_CS, !selected);
}
}
-uint8_t pic32mx_spi2status(FAR struct spi_dev_s *dev, enum spi_dev_e devid)
+uint8_t pic32mx_spi2status(FAR struct spi_dev_s *dev, uint32_t devid)
{
return 0;
}
#ifdef CONFIG_SPI_CMDDATA
-int pic32mx_spi2cmddata(FAR struct spi_dev_s *dev, enum spi_dev_e devid, bool cmd)
+int pic32mx_spi2cmddata(FAR struct spi_dev_s *dev, uint32_t devid, bool cmd)
{
return 0;
}
diff --git a/configs/ne64badge/src/m9s12_spi.c b/configs/ne64badge/src/m9s12_spi.c
index 1539d0ca47..760ebf4c1d 100644
--- a/configs/ne64badge/src/m9s12_spi.c
+++ b/configs/ne64badge/src/m9s12_spi.c
@@ -91,11 +91,11 @@ void weak_function hcs12_spidev_initialize(void)
*
****************************************************************************/
-void hcs12_spiselect(FAR struct spi_dev_s *dev, enum spi_dev_e devid, bool selected)
+void hcs12_spiselect(FAR struct spi_dev_s *dev, uint32_t devid, bool selected)
{
}
-uint8_t hcs12_spistatus(FAR struct spi_dev_s *dev, enum spi_dev_e devid)
+uint8_t hcs12_spistatus(FAR struct spi_dev_s *dev, uint32_t devid)
{
return SPI_STATUS_PRESENT;
}
diff --git a/configs/nucleo-144/src/stm32_spi.c b/configs/nucleo-144/src/stm32_spi.c
index 61dab7a51e..5e24455c26 100644
--- a/configs/nucleo-144/src/stm32_spi.c
+++ b/configs/nucleo-144/src/stm32_spi.c
@@ -213,39 +213,39 @@ void weak_function stm32_spidev_initialize(void)
****************************************************************************/
#ifdef CONFIG_STM32F7_SPI1
-void stm32_spi1select(FAR struct spi_dev_s *dev, enum spi_dev_e devid, bool selected)
+void stm32_spi1select(FAR struct spi_dev_s *dev, uint32_t devid, bool selected)
{
spiinfo("devid: %d CS: %s\n", (int)devid, selected ? "assert" : "de-assert");
stm32_gpiowrite(g_spigpio[devid], !selected);
}
-uint8_t stm32_spi1status(FAR struct spi_dev_s *dev, enum spi_dev_e devid)
+uint8_t stm32_spi1status(FAR struct spi_dev_s *dev, uint32_t devid)
{
return 0;
}
#endif
#ifdef CONFIG_STM32F7_SPI2
-void stm32_spi2select(FAR struct spi_dev_s *dev, enum spi_dev_e devid, bool selected)
+void stm32_spi2select(FAR struct spi_dev_s *dev, uint32_t devid, bool selected)
{
spiinfo("devid: %d CS: %s\n", (int)devid, selected ? "assert" : "de-assert");
stm32_gpiowrite(g_spigpio[devid], !selected);
}
-uint8_t stm32_spi2status(FAR struct spi_dev_s *dev, enum spi_dev_e devid)
+uint8_t stm32_spi2status(FAR struct spi_dev_s *dev, uint32_t devid)
{
return 0;
}
#endif
#ifdef CONFIG_STM32F7_SPI3
-void stm32_spi3select(FAR struct spi_dev_s *dev, enum spi_dev_e devid, bool selected)
+void stm32_spi3select(FAR struct spi_dev_s *dev, uint32_t devid, bool selected)
{
spiinfo("devid: %d CS: %s\n", (int)devid, selected ? "assert" : "de-assert");
stm32_gpiowrite(g_spigpio[devid], !selected);
}
-uint8_t stm32_spi3status(FAR struct spi_dev_s *dev, enum spi_dev_e devid)
+uint8_t stm32_spi3status(FAR struct spi_dev_s *dev, uint32_t devid)
{
return 0;
}
@@ -256,13 +256,13 @@ uint8_t stm32_spi3status(FAR struct spi_dev_s *dev, enum spi_dev_e devid)
# error "NUCLEO_SPI_BUS4_CSn Are not defined"
# endif
-void stm32_spi4select(FAR struct spi_dev_s *dev, enum spi_dev_e devid, bool selected)
+void stm32_spi4select(FAR struct spi_dev_s *dev, uint32_t devid, bool selected)
{
spiinfo("devid: %d CS: %s\n", (int)devid, selected ? "assert" : "de-assert");
stm32_gpiowrite(g_spigpio[devid], !selected);
}
-uint8_t stm32_spi4status(FAR struct spi_dev_s *dev, enum spi_dev_e devid)
+uint8_t stm32_spi4status(FAR struct spi_dev_s *dev, uint32_t devid)
{
return 0;
}
@@ -273,13 +273,13 @@ uint8_t stm32_spi4status(FAR struct spi_dev_s *dev, enum spi_dev_e devid)
# error "NUCLEO_SPI_BUS4_CSn Are not defined"
# endif
-void stm32_spi5select(FAR struct spi_dev_s *dev, enum spi_dev_e devid, bool selected)
+void stm32_spi5select(FAR struct spi_dev_s *dev, uint32_t devid, bool selected)
{
spiinfo("devid: %d CS: %s\n", (int)devid, selected ? "assert" : "de-assert");
stm32_gpiowrite(g_spigpio[devid], !selected);
}
-uint8_t stm32_spi5status(FAR struct spi_dev_s *dev, enum spi_dev_e devid)
+uint8_t stm32_spi5status(FAR struct spi_dev_s *dev, uint32_t devid)
{
return 0;
}
@@ -289,13 +289,13 @@ uint8_t stm32_spi5status(FAR struct spi_dev_s *dev, enum spi_dev_e devid)
# ifndef NUCLEO_SPI_BUS6_CS
# error "NUCLEO_SPI_BUS4_CSn Are not defined"
# endif
-void stm32_spi5select(FAR struct spi_dev_s *dev, enum spi_dev_e devid, bool selected)
+void stm32_spi5select(FAR struct spi_dev_s *dev, uint32_t devid, bool selected)
{
spiinfo("devid: %d CS: %s\n", (int)devid, selected ? "assert" : "de-assert");
stm32_gpiowrite(g_spigpio[devid], !selected);
}
-uint8_t stm32_spi5status(FAR struct spi_dev_s *dev, enum spi_dev_e devid)
+uint8_t stm32_spi5status(FAR struct spi_dev_s *dev, uint32_t devid)
{
return 0;
}
@@ -326,43 +326,44 @@ uint8_t stm32_spi5status(FAR struct spi_dev_s *dev, enum spi_dev_e devid)
#ifdef CONFIG_SPI_CMDDATA
#ifdef CONFIG_STM32F7_SPI1
-int stm32_spi1cmddata(FAR struct spi_dev_s *dev, enum spi_dev_e devid, bool cmd)
+int stm32_spi1cmddata(FAR struct spi_dev_s *dev, uint32_t devid, bool cmd)
{
return -ENODEV;
}
#endif
#ifdef CONFIG_STM32F7_SPI2
-int stm32_spi2cmddata(FAR struct spi_dev_s *dev, enum spi_dev_e devid, bool cmd)
+int stm32_spi2cmddata(FAR struct spi_dev_s *dev, uint32_t devid, bool cmd)
{
return -ENODEV;
}
#endif
#ifdef CONFIG_STM32F7_SPI3
-int stm32_spi3cmddata(FAR struct spi_dev_s *dev, enum spi_dev_e devid, bool cmd)
+int stm32_spi3cmddata(FAR struct spi_dev_s *dev, uint32_t devid, bool cmd)
{
return -ENODEV;
}
#endif
#ifdef CONFIG_STM32F7_SPI4
-int stm32_spi4cmddata(FAR struct spi_dev_s *dev, enum spi_dev_e devid, bool cmd)
+int stm32_spi4cmddata(FAR struct spi_dev_s *dev, uint32_t devid, bool cmd)
{
return -ENODEV;
}
#endif
#ifdef CONFIG_STM32F7_SPI5
-int stm32_spi5cmddata(FAR struct spi_dev_s *dev, enum spi_dev_e devid, bool cmd)
+int stm32_spi5cmddata(FAR struct spi_dev_s *dev, uint32_t devid, bool cmd)
{
return -ENODEV;
}
#endif
#ifdef CONFIG_STM32F7_SPI6
-int stm32_spi5cmddata(FAR struct spi_dev_s *dev, enum spi_dev_e devid, bool cmd)
+int stm32_spi5cmddata(FAR struct spi_dev_s *dev, uint32_t devid, bool cmd)
{
+:qa
return -ENODEV;
}
#endif
diff --git a/configs/nucleo-f072rb/README.txt b/configs/nucleo-f072rb/README.txt
index 3f4eecaabf..de1713e5ab 100644
--- a/configs/nucleo-f072rb/README.txt
+++ b/configs/nucleo-f072rb/README.txt
@@ -8,12 +8,42 @@ Nucleo-F072RB README
Contents
========
+ - Status
- Nucleo-64 Boards
- LEDs
- Buttons
- Serial Console
- Configurations
+Status
+======
+ 2017-04-27: There are many problems. On start up, I have to reset
+ several times before I get NSH prompt (or parts of it). Apparently the
+ STM32 is either hanging (perhaps in clockconfig()) or perhaps it has
+ taken a hard fault before it is able to generate debug output?
+
+ There are many hardfaults during initial serial output. This change
+ seems to eliminate those hardfaults:
+
+ @@ -2163,7 +2163,7 @@ static void stm32f0serial_txint(FAR struct uart_dev_s *dev, bool enable)
+ * interrupts disabled (note this may recurse).
+ */
+
+ - uart_xmitchars(dev);
+ +// uart_xmitchars(dev);
+ #endif
+ }
+ else
+
+ Which implies that the hardfaults are due to runaway recursion in the
+ serial driver? This suggest some error in either determining when there
+ is TX data available or in disabling TX interrupts.
+
+ But this not a solution. Even without the hard faults, it may hang
+ attempting to output the NSH greeting and prompt or hang unable to
+ receive input. These symptoms suggest some issue with TX and RX
+ interrupt handling.
+
Nucleo-64 Boards
================
diff --git a/configs/nucleo-f303re/src/stm32_spi.c b/configs/nucleo-f303re/src/stm32_spi.c
index 6251ede1da..6e706a8509 100644
--- a/configs/nucleo-f303re/src/stm32_spi.c
+++ b/configs/nucleo-f303re/src/stm32_spi.c
@@ -103,46 +103,46 @@ void weak_function stm32_spidev_initialize(void)
****************************************************************************/
#ifdef CONFIG_STM32_SPI1
-void stm32_spi1select(FAR struct spi_dev_s *dev, enum spi_dev_e devid,
+void stm32_spi1select(FAR struct spi_dev_s *dev, uint32_t devid,
bool selected)
{
spiinfo("devid: %d CS: %s\n", (int)devid, selected ? "assert" : "de-assert");
#if defined(CONFIG_LCD_SSD1351)
- if (devid == SPIDEV_DISPLAY)
+ if (devid == SPIDEV_DISPLAY(0))
{
stm32_gpiowrite(GPIO_OLED_CS, !selected);
}
#endif
}
-uint8_t stm32_spi1status(FAR struct spi_dev_s *dev, enum spi_dev_e devid)
+uint8_t stm32_spi1status(FAR struct spi_dev_s *dev, uint32_t devid)
{
return 0;
}
#endif
#ifdef CONFIG_STM32_SPI2
-void stm32_spi2select(FAR struct spi_dev_s *dev, enum spi_dev_e devid,
+void stm32_spi2select(FAR struct spi_dev_s *dev, uint32_t devid,
bool selected)
{
spiinfo("devid: %d CS: %s\n", (int)devid, selected ? "assert" : "de-assert");
}
-uint8_t stm32_spi2status(FAR struct spi_dev_s *dev, enum spi_dev_e devid)
+uint8_t stm32_spi2status(FAR struct spi_dev_s *dev, uint32_t devid)
{
return 0;
}
#endif
#ifdef CONFIG_STM32_SPI3
-void stm32_spi3select(FAR struct spi_dev_s *dev, enum spi_dev_e devid,
+void stm32_spi3select(FAR struct spi_dev_s *dev, uint32_t devid,
bool selected)
{
spiinfo("devid: %d CS: %s\n", (int)devid, selected ? "assert" : "de-assert");
}
-uint8_t stm32_spi3status(FAR struct spi_dev_s *dev, enum spi_dev_e devid)
+uint8_t stm32_spi3status(FAR struct spi_dev_s *dev, uint32_t devid)
{
return 0;
}
@@ -172,11 +172,11 @@ uint8_t stm32_spi3status(FAR struct spi_dev_s *dev, enum spi_dev_e devid)
#ifdef CONFIG_SPI_CMDDATA
#ifdef CONFIG_STM32_SPI1
-int stm32_spi1cmddata(FAR struct spi_dev_s *dev, enum spi_dev_e devid,
+int stm32_spi1cmddata(FAR struct spi_dev_s *dev, uint32_t devid,
bool cmd)
{
#ifdef CONFIG_LCD_SSD1351
- if (devid == SPIDEV_DISPLAY)
+ if (devid == SPIDEV_DISPLAY(0))
{
(void)stm32_gpiowrite(GPIO_OLED_DC, !cmd);
return OK;
@@ -188,7 +188,7 @@ int stm32_spi1cmddata(FAR struct spi_dev_s *dev, enum spi_dev_e devid,
#endif
#ifdef CONFIG_STM32_SPI2
-int stm32_spi2cmddata(FAR struct spi_dev_s *dev, enum spi_dev_e devid,
+int stm32_spi2cmddata(FAR struct spi_dev_s *dev, uint32_t devid,
bool cmd)
{
return -ENODEV;
@@ -196,7 +196,7 @@ int stm32_spi2cmddata(FAR struct spi_dev_s *dev, enum spi_dev_e devid,
#endif
#ifdef CONFIG_STM32_SPI3
-int stm32_spi3cmddata(FAR struct spi_dev_s *dev, enum spi_dev_e devid,
+int stm32_spi3cmddata(FAR struct spi_dev_s *dev, uint32_t devid,
bool cmd)
{
return -ENODEV;
diff --git a/configs/nucleo-f4x1re/src/stm32_spi.c b/configs/nucleo-f4x1re/src/stm32_spi.c
index 82026a0d26..cdcb582fd5 100644
--- a/configs/nucleo-f4x1re/src/stm32_spi.c
+++ b/configs/nucleo-f4x1re/src/stm32_spi.c
@@ -141,57 +141,57 @@ void weak_function stm32_spidev_initialize(void)
****************************************************************************/
#ifdef CONFIG_STM32_SPI1
-void stm32_spi1select(FAR struct spi_dev_s *dev, enum spi_dev_e devid, bool selected)
+void stm32_spi1select(FAR struct spi_dev_s *dev, uint32_t devid, bool selected)
{
spiinfo("devid: %d CS: %s\n", (int)devid, selected ? "assert" : "de-assert");
#ifdef CONFIG_WL_CC3000
- if (devid == SPIDEV_WIRELESS)
+ if (devid == SPIDEV_WIRELESS(0))
{
stm32_gpiowrite(GPIO_SPI_CS_WIFI, !selected);
}
else
#endif
#ifdef HAVE_MMCSD
- if (devid == SPIDEV_MMCSD)
+ if (devid == SPIDEV_MMCSD(0))
{
stm32_gpiowrite(GPIO_SPI_CS_SD_CARD, !selected);
}
#endif
}
-uint8_t stm32_spi1status(FAR struct spi_dev_s *dev, enum spi_dev_e devid)
+uint8_t stm32_spi1status(FAR struct spi_dev_s *dev, uint32_t devid)
{
return 0;
}
#endif
#ifdef CONFIG_STM32_SPI2
-void stm32_spi2select(FAR struct spi_dev_s *dev, enum spi_dev_e devid, bool selected)
+void stm32_spi2select(FAR struct spi_dev_s *dev, uint32_t devid, bool selected)
{
spiinfo("devid: %d CS: %s\n", (int)devid, selected ? "assert" : "de-assert");
#ifdef CONFIG_WL_CC3000
- if (devid == SPIDEV_WIRELESS)
+ if (devid == SPIDEV_WIRELESS(0))
{
stm32_gpiowrite(GPIO_WIFI_CS, !selected);
}
#endif
}
-uint8_t stm32_spi2status(FAR struct spi_dev_s *dev, enum spi_dev_e devid)
+uint8_t stm32_spi2status(FAR struct spi_dev_s *dev, uint32_t devid)
{
return 0;
}
#endif
#ifdef CONFIG_STM32_SPI3
-void stm32_spi3select(FAR struct spi_dev_s *dev, enum spi_dev_e devid, bool selected)
+void stm32_spi3select(FAR struct spi_dev_s *dev, uint32_t devid, bool selected)
spiinfo("devid: %d CS: %s\n", (int)devid, selected ? "assert" : "de-assert");
}
-uint8_t stm32_spi3status(FAR struct spi_dev_s *dev, enum spi_dev_e devid)
+uint8_t stm32_spi3status(FAR struct spi_dev_s *dev, uint32_t devid)
{
return 0;
}
@@ -222,21 +222,21 @@ uint8_t stm32_spi3status(FAR struct spi_dev_s *dev, enum spi_dev_e devid)
#ifdef CONFIG_SPI_CMDDATA
#ifdef CONFIG_STM32_SPI1
-int stm32_spi1cmddata(FAR struct spi_dev_s *dev, enum spi_dev_e devid, bool cmd)
+int stm32_spi1cmddata(FAR struct spi_dev_s *dev, uint32_t devid, bool cmd)
{
return OK;
}
#endif
#ifdef CONFIG_STM32_SPI2
-int stm32_spi2cmddata(FAR struct spi_dev_s *dev, enum spi_dev_e devid, bool cmd)
+int stm32_spi2cmddata(FAR struct spi_dev_s *dev, uint32_t devid, bool cmd)
{
return OK;
}
#endif
#ifdef CONFIG_STM32_SPI3
-int stm32_spi3cmddata(FAR struct spi_dev_s *dev, enum spi_dev_e devid, bool cmd)
+int stm32_spi3cmddata(FAR struct spi_dev_s *dev, uint32_t devid, bool cmd)
{
return OK;
}
diff --git a/configs/nucleo-f4x1re/src/stm32_wireless.c b/configs/nucleo-f4x1re/src/stm32_wireless.c
index c5012f0438..b868cad46c 100644
--- a/configs/nucleo-f4x1re/src/stm32_wireless.c
+++ b/configs/nucleo-f4x1re/src/stm32_wireless.c
@@ -47,7 +47,6 @@
#include
#include
-#include
#include
#include
diff --git a/configs/nucleo-l476rg/src/stm32_cc3000.c b/configs/nucleo-l476rg/src/stm32_cc3000.c
index d1c94b338e..ac935e929f 100644
--- a/configs/nucleo-l476rg/src/stm32_cc3000.c
+++ b/configs/nucleo-l476rg/src/stm32_cc3000.c
@@ -47,7 +47,6 @@
#include
#include
-#include
#include
#include
diff --git a/configs/nucleo-l476rg/src/stm32_spi.c b/configs/nucleo-l476rg/src/stm32_spi.c
index 71d65d8a10..6e45b6f76c 100644
--- a/configs/nucleo-l476rg/src/stm32_spi.c
+++ b/configs/nucleo-l476rg/src/stm32_spi.c
@@ -141,57 +141,57 @@ void weak_function stm32l4_spiinitialize(void)
****************************************************************************/
#ifdef CONFIG_STM32L4_SPI1
-void stm32l4_spi1select(FAR struct spi_dev_s *dev, enum spi_dev_e devid, bool selected)
+void stm32l4_spi1select(FAR struct spi_dev_s *dev, uint32_t devid, bool selected)
{
spiinfo("devid: %d CS: %s\n", (int)devid, selected ? "assert" : "de-assert");
#ifdef CONFIG_WL_CC3000
- if (devid == SPIDEV_WIRELESS)
+ if (devid == SPIDEV_WIRELESS(0))
{
stm32l4_gpiowrite(GPIO_SPI_CS_WIFI, !selected);
}
else
#endif
#ifdef HAVE_MMCSD
- if (devid == SPIDEV_MMCSD)
+ if (devid == SPIDEV_MMCSD(0))
{
stm32l4_gpiowrite(GPIO_SPI_CS_SD_CARD, !selected);
}
#endif
}
-uint8_t stm32l4_spi1status(FAR struct spi_dev_s *dev, enum spi_dev_e devid)
+uint8_t stm32l4_spi1status(FAR struct spi_dev_s *dev, uint32_t devid)
{
return 0;
}
#endif
#ifdef CONFIG_STM32L4_SPI2
-void stm32l4_spi2select(FAR struct spi_dev_s *dev, enum spi_dev_e devid, bool selected)
+void stm32l4_spi2select(FAR struct spi_dev_s *dev, uint32_t devid, bool selected)
{
spiinfo("devid: %d CS: %s\n", (int)devid, selected ? "assert" : "de-assert");
#ifdef CONFIG_WL_CC3000
- if (devid == SPIDEV_WIRELESS)
+ if (devid == SPIDEV_WIRELESS(0))
{
stm32l4_gpiowrite(GPIO_WIFI_CS, !selected);
}
#endif
}
-uint8_t stm32l4_spi2status(FAR struct spi_dev_s *dev, enum spi_dev_e devid)
+uint8_t stm32l4_spi2status(FAR struct spi_dev_s *dev, uint32_t devid)
{
return 0;
}
#endif
#ifdef CONFIG_STM32L4_SPI3
-void stm32l4_spi3select(FAR struct spi_dev_s *dev, enum spi_dev_e devid, bool selected)
+void stm32l4_spi3select(FAR struct spi_dev_s *dev, uint32_t devid, bool selected)
spiinfo("devid: %d CS: %s\n", (int)devid, selected ? "assert" : "de-assert");
}
-uint8_t stm32l4_spi3status(FAR struct spi_dev_s *dev, enum spi_dev_e devid)
+uint8_t stm32l4_spi3status(FAR struct spi_dev_s *dev, uint32_t devid)
{
return 0;
}
@@ -222,21 +222,21 @@ uint8_t stm32l4_spi3status(FAR struct spi_dev_s *dev, enum spi_dev_e devid)
#ifdef CONFIG_SPI_CMDDATA
#ifdef CONFIG_STM32L4_SPI1
-int stm32l4_spi1cmddata(FAR struct spi_dev_s *dev, enum spi_dev_e devid, bool cmd)
+int stm32l4_spi1cmddata(FAR struct spi_dev_s *dev, uint32_t devid, bool cmd)
{
return OK;
}
#endif
#ifdef CONFIG_STM32L4_SPI2
-int stm32l4_spi2cmddata(FAR struct spi_dev_s *dev, enum spi_dev_e devid, bool cmd)
+int stm32l4_spi2cmddata(FAR struct spi_dev_s *dev, uint32_t devid, bool cmd)
{
return OK;
}
#endif
#ifdef CONFIG_STM32L4_SPI3
-int stm32l4_spi3cmddata(FAR struct spi_dev_s *dev, enum spi_dev_e devid, bool cmd)
+int stm32l4_spi3cmddata(FAR struct spi_dev_s *dev, uint32_t devid, bool cmd)
{
return OK;
}
diff --git a/configs/olimex-lpc-h3131/src/lpc31_spi.c b/configs/olimex-lpc-h3131/src/lpc31_spi.c
index c9e9c6eec5..d9b08ed3bd 100644
--- a/configs/olimex-lpc-h3131/src/lpc31_spi.c
+++ b/configs/olimex-lpc-h3131/src/lpc31_spi.c
@@ -99,13 +99,13 @@ void weak_function lpc31_spidev_intialize(void)
*
************************************************************************************/
-void lpc31_spiselect(FAR struct spi_dev_s *dev, enum spi_dev_e devid, bool selected)
+void lpc31_spiselect(FAR struct spi_dev_s *dev, uint32_t devid, bool selected)
{
spiinfo("devid: %d CS: %s\n", (int)devid, selected ? "assert" : "de-assert");
#warning "Missing logic"
}
-uint8_t lpc31_spistatus(FAR struct spi_dev_s *dev, enum spi_dev_e devid)
+uint8_t lpc31_spistatus(FAR struct spi_dev_s *dev, uint32_t devid)
{
return SPI_STATUS_PRESENT;
}
diff --git a/configs/olimex-lpc1766stk/src/lpc17_ssp.c b/configs/olimex-lpc1766stk/src/lpc17_ssp.c
index 7317a014b0..5ef529f2a7 100644
--- a/configs/olimex-lpc1766stk/src/lpc17_ssp.c
+++ b/configs/olimex-lpc1766stk/src/lpc17_ssp.c
@@ -263,10 +263,10 @@ void weak_function lpc1766stk_sspdev_initialize(void)
************************************************************************************/
#ifdef CONFIG_LPC17_SSP0
-void lpc17_ssp0select(FAR struct spi_dev_s *dev, enum spi_dev_e devid, bool selected)
+void lpc17_ssp0select(FAR struct spi_dev_s *dev, uint32_t devid, bool selected)
{
spiinfo("devid: %d CS: %s\n", (int)devid, selected ? "assert" : "de-assert");
- if (devid == SPIDEV_DISPLAY)
+ if (devid == SPIDEV_DISPLAY(0))
{
/* Assert/de-assert the CS pin to the card */
@@ -276,7 +276,7 @@ void lpc17_ssp0select(FAR struct spi_dev_s *dev, enum spi_dev_e devid, bool sel
}
}
-uint8_t lpc17_ssp0status(FAR struct spi_dev_s *dev, enum spi_dev_e devid)
+uint8_t lpc17_ssp0status(FAR struct spi_dev_s *dev, uint32_t devid)
{
spiinfo("Returning nothing\n");
return 0;
@@ -284,10 +284,10 @@ uint8_t lpc17_ssp0status(FAR struct spi_dev_s *dev, enum spi_dev_e devid)
#endif
#ifdef CONFIG_LPC17_SSP1
-void lpc17_ssp1select(FAR struct spi_dev_s *dev, enum spi_dev_e devid, bool selected)
+void lpc17_ssp1select(FAR struct spi_dev_s *dev, uint32_t devid, bool selected)
{
spiinfo("devid: %d CS: %s\n", (int)devid, selected ? "assert" : "de-assert");
- if (devid == SPIDEV_MMCSD)
+ if (devid == SPIDEV_MMCSD(0))
{
/* Assert/de-assert the CS pin to the card */
@@ -297,7 +297,7 @@ void lpc17_ssp1select(FAR struct spi_dev_s *dev, enum spi_dev_e devid, bool sel
}
}
-uint8_t lpc17_ssp1status(FAR struct spi_dev_s *dev, enum spi_dev_e devid)
+uint8_t lpc17_ssp1status(FAR struct spi_dev_s *dev, uint32_t devid)
{
spiinfo("Returning SPI_STATUS_PRESENT\n");
return SPI_STATUS_PRESENT;
diff --git a/configs/olimex-stm32-p107/src/stm32_spi.c b/configs/olimex-stm32-p107/src/stm32_spi.c
index 9a454cfcfa..aa143b0888 100644
--- a/configs/olimex-stm32-p107/src/stm32_spi.c
+++ b/configs/olimex-stm32-p107/src/stm32_spi.c
@@ -108,11 +108,11 @@ void weak_function stm32_spidev_initialize(void)
****************************************************************************/
#ifdef CONFIG_STM32_SPI3
-void stm32_spi3select(FAR struct spi_dev_s *dev, enum spi_dev_e devid, bool selected)
+void stm32_spi3select(FAR struct spi_dev_s *dev, uint32_t devid, bool selected)
{
spiinfo("devid: %d CS: %s\n", (int)devid, selected ? "assert" : "de-assert");
- if (devid == SPIDEV_ETHERNET)
+ if (devid == SPIDEV_ETHERNET(0))
{
/* Set the GPIO low to select and high to de-select */
@@ -120,7 +120,7 @@ void stm32_spi3select(FAR struct spi_dev_s *dev, enum spi_dev_e devid, bool sele
}
}
-uint8_t stm32_spi3status(FAR struct spi_dev_s *dev, enum spi_dev_e devid)
+uint8_t stm32_spi3status(FAR struct spi_dev_s *dev, uint32_t devid)
{
return SPI_STATUS_PRESENT;
}
diff --git a/configs/olimex-strp711/src/str71_spi.c b/configs/olimex-strp711/src/str71_spi.c
index f14df15033..e4d27894ee 100644
--- a/configs/olimex-strp711/src/str71_spi.c
+++ b/configs/olimex-strp711/src/str71_spi.c
@@ -400,11 +400,11 @@ static inline void spi_drain(FAR struct str71x_spidev_s *priv);
/* SPI methods */
static int spi_lock(FAR struct spi_dev_s *dev, bool lock);
-static void spi_select(FAR struct spi_dev_s *dev, enum spi_dev_e devid, bool selected);
+static void spi_select(FAR struct spi_dev_s *dev, uint32_t 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);
+static uint8_t spi_status(FAR struct spi_dev_s *dev, uint32_t devid);
#ifdef CONFIG_SPI_CMDDATA
-static int spi_cmddata(FAR struct spi_dev_s *dev, enum spi_dev_e devid, bool cmd);
+static int spi_cmddata(FAR struct spi_dev_s *dev, uint32_t devid, bool cmd);
#endif
static uint16_t spi_send(FAR struct spi_dev_s *dev, uint16_t wd);
static void spi_sndblock(FAR struct spi_dev_s *dev, FAR const void *buffer, size_t buflen);
@@ -608,7 +608,7 @@ static int spi_lock(FAR struct spi_dev_s *dev, bool lock)
*
****************************************************************************/
-static void spi_select(FAR struct spi_dev_s *dev, enum spi_dev_e devid, bool selected)
+static void spi_select(FAR struct spi_dev_s *dev, uint32_t devid, bool selected)
{
FAR struct str71x_spidev_s *priv = (FAR struct str71x_spidev_s *)dev;
uint16_t reg16;
@@ -713,7 +713,7 @@ 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)
+static uint8_t spi_status(FAR struct spi_dev_s *dev, uint32_t devid)
{
uint8_t ret = 0;
uint16_t reg16 = getreg16(STR71X_GPIO1_PD);
@@ -756,7 +756,7 @@ static uint8_t spi_status(FAR struct spi_dev_s *dev, enum spi_dev_e devid)
****************************************************************************/
#ifdef CONFIG_SPI_CMDDATA
-static int spi_cmddata(FAR struct spi_dev_s *dev, enum spi_dev_e devid, bool cmd)
+static int spi_cmddata(FAR struct spi_dev_s *dev, uint32_t devid, bool cmd)
{
# error "spi_cmddata not implemented"
return -ENOSYS;
diff --git a/configs/olimexino-stm32/src/stm32_spi.c b/configs/olimexino-stm32/src/stm32_spi.c
index 249a3b39d8..dd8fe9588c 100644
--- a/configs/olimexino-stm32/src/stm32_spi.c
+++ b/configs/olimexino-stm32/src/stm32_spi.c
@@ -107,34 +107,34 @@ void weak_function stm32_spidev_initialize(void)
****************************************************************************/
#ifdef CONFIG_STM32_SPI1
-void stm32_spi1select(FAR struct spi_dev_s *dev, enum spi_dev_e devid, bool selected)
+void stm32_spi1select(FAR struct spi_dev_s *dev, uint32_t devid, bool selected)
{
spiinfo("devid: %d CS: %s\n", (int)devid, selected ? "assert" : "de-assert");
- if (devid == SPIDEV_USER)
+ if (devid == SPIDEV_USER(0))
{
stm32_gpiowrite(USER_CSn, !selected);
}
}
-uint8_t stm32_spi1status(FAR struct spi_dev_s *dev, enum spi_dev_e devid)
+uint8_t stm32_spi1status(FAR struct spi_dev_s *dev, uint32_t devid)
{
return 0;
}
#endif
#ifdef CONFIG_STM32_SPI2
-void stm32_spi2select(FAR struct spi_dev_s *dev, enum spi_dev_e devid, bool selected)
+void stm32_spi2select(FAR struct spi_dev_s *dev, uint32_t devid, bool selected)
{
spiinfo("devid: %d CS: %s\n", (int)devid, selected ? "assert" : "de-assert");
#if defined(CONFIG_MMCSD)
- if (devid == SPIDEV_MMCSD)
+ if (devid == SPIDEV_MMCSD(0))
{
stm32_gpiowrite(MMCSD_CSn, !selected);
}
#endif
}
-uint8_t stm32_spi2status(FAR struct spi_dev_s *dev, enum spi_dev_e devid)
+uint8_t stm32_spi2status(FAR struct spi_dev_s *dev, uint32_t devid)
{
/* No switch on SD card socket so assume it is here */
@@ -143,12 +143,12 @@ uint8_t stm32_spi2status(FAR struct spi_dev_s *dev, enum spi_dev_e devid)
#endif
#ifdef CONFIG_STM32_SPI3
-void stm32_spi3select(FAR struct spi_dev_s *dev, enum spi_dev_e devid, bool selected)
+void stm32_spi3select(FAR struct spi_dev_s *dev, uint32_t devid, bool selected)
{
spiinfo("devid: %d CS: %s\n", (int)devid, selected ? "assert" : "de-assert");
}
-uint8_t stm32_spi3status(FAR struct spi_dev_s *dev, enum spi_dev_e devid)
+uint8_t stm32_spi3status(FAR struct spi_dev_s *dev, uint32_t devid)
{
return 0;
}
@@ -179,21 +179,21 @@ uint8_t stm32_spi3status(FAR struct spi_dev_s *dev, enum spi_dev_e devid)
#ifdef CONFIG_SPI_CMDDATA
#ifdef CONFIG_STM32_SPI1
-int stm32_spi1cmddata(FAR struct spi_dev_s *dev, enum spi_dev_e devid, bool cmd)
+int stm32_spi1cmddata(FAR struct spi_dev_s *dev, uint32_t devid, bool cmd)
{
return OK;
}
#endif
#ifdef CONFIG_STM32_SPI2
-int stm32_spi2cmddata(FAR struct spi_dev_s *dev, enum spi_dev_e devid, bool cmd)
+int stm32_spi2cmddata(FAR struct spi_dev_s *dev, uint32_t devid, bool cmd)
{
return OK;
}
#endif
#ifdef CONFIG_STM32_SPI3
-int stm32_spi3cmddata(FAR struct spi_dev_s *dev, enum spi_dev_e devid, bool cmd)
+int stm32_spi3cmddata(FAR struct spi_dev_s *dev, uint32_t devid, bool cmd)
{
return -ENODEV;
}
diff --git a/configs/open1788/src/lpc17_ssp.c b/configs/open1788/src/lpc17_ssp.c
index 600b04474d..e904144f24 100644
--- a/configs/open1788/src/lpc17_ssp.c
+++ b/configs/open1788/src/lpc17_ssp.c
@@ -130,12 +130,12 @@ void weak_function open1788_sspdev_initialize(void)
************************************************************************************/
#ifdef CONFIG_LPC17_SSP0
-void lpc17_ssp0select(FAR struct spi_dev_s *dev, enum spi_dev_e devid, bool selected)
+void lpc17_ssp0select(FAR struct spi_dev_s *dev, uint32_t devid, bool selected)
{
spiinfo("devid: %d CS: %s\n", (int)devid, selected ? "assert" : "de-assert");
}
-uint8_t lpc17_ssp0status(FAR struct spi_dev_s *dev, enum spi_dev_e devid)
+uint8_t lpc17_ssp0status(FAR struct spi_dev_s *dev, uint32_t devid)
{
spiinfo("Returning nothing\n");
return 0;
@@ -143,10 +143,10 @@ uint8_t lpc17_ssp0status(FAR struct spi_dev_s *dev, enum spi_dev_e devid)
#endif
#ifdef CONFIG_LPC17_SSP1
-void lpc17_ssp1select(FAR struct spi_dev_s *dev, enum spi_dev_e devid, bool selected)
+void lpc17_ssp1select(FAR struct spi_dev_s *dev, uint32_t devid, bool selected)
{
spiinfo("devid: %d CS: %s\n", (int)devid, selected ? "assert" : "de-assert");
- if (devid == SPIDEV_TOUCHSCREEN)
+ if (devid == SPIDEV_TOUCHSCREEN(0))
{
/* Assert/de-assert the CS pin to the touchscreen */
@@ -156,7 +156,7 @@ void lpc17_ssp1select(FAR struct spi_dev_s *dev, enum spi_dev_e devid, bool sel
}
}
-uint8_t lpc17_ssp1status(FAR struct spi_dev_s *dev, enum spi_dev_e devid)
+uint8_t lpc17_ssp1status(FAR struct spi_dev_s *dev, uint32_t devid)
{
spiinfo("Returning nothing\n");
return 0;
@@ -164,12 +164,12 @@ uint8_t lpc17_ssp1status(FAR struct spi_dev_s *dev, enum spi_dev_e devid)
#endif
#ifdef CONFIG_LPC17_SSP2
-void lpc17_ssp2select(FAR struct spi_dev_s *dev, enum spi_dev_e devid, bool selected)
+void lpc17_ssp2select(FAR struct spi_dev_s *dev, uint32_t devid, bool selected)
{
spiinfo("devid: %d CS: %s\n", (int)devid, selected ? "assert" : "de-assert");
}
-uint8_t lpc17_ssp2status(FAR struct spi_dev_s *dev, enum spi_dev_e devid)
+uint8_t lpc17_ssp2status(FAR struct spi_dev_s *dev, uint32_t devid)
{
spiinfo("Returning nothing\n");
return 0;
diff --git a/configs/pic32mx-starterkit/src/pic32mx_spi.c b/configs/pic32mx-starterkit/src/pic32mx_spi.c
index 4c0e2d2261..9f8d2262ba 100644
--- a/configs/pic32mx-starterkit/src/pic32mx_spi.c
+++ b/configs/pic32mx-starterkit/src/pic32mx_spi.c
@@ -102,23 +102,22 @@ void weak_function pic32mx_spidev_initialize(void)
************************************************************************************/
struct spi_dev_s;
-enum spi_dev_e;
#ifdef CONFIG_PIC32MX_SPI1
-void pic32mx_spi1select(FAR struct spi_dev_s *dev, enum spi_dev_e devid, bool selected)
+void pic32mx_spi1select(FAR struct spi_dev_s *dev, uint32_t devid, bool selected)
{
spiinfo("devid: %d CS: %s\n", (int)devid, selected ? "assert" : "de-assert");
#warning "Missing logic"
}
-uint8_t pic32mx_spi1status(FAR struct spi_dev_s *dev, enum spi_dev_e devid)
+uint8_t pic32mx_spi1status(FAR struct spi_dev_s *dev, uint32_t devid)
{
spiinfo("Returning nothing\n");
#warning "Missing logic"
return 0;
}
#ifdef CONFIG_SPI_CMDDATA
-int pic32mx_spi1cmddata(FAR struct spi_dev_s *dev, enum spi_dev_e devid, bool cmd)
+int pic32mx_spi1cmddata(FAR struct spi_dev_s *dev, uint32_t devid, bool cmd)
{
#warning "Missing logic"
return 0;
@@ -127,20 +126,20 @@ int pic32mx_spi1cmddata(FAR struct spi_dev_s *dev, enum spi_dev_e devid, bool cm
#endif
#ifdef CONFIG_PIC32MX_SPI1
-void pic32mx_spi1select(FAR struct spi_dev_s *dev, enum spi_dev_e devid, bool selected)
+void pic32mx_spi1select(FAR struct spi_dev_s *dev, uint32_t devid, bool selected)
{
spiinfo("devid: %d CS: %s\n", (int)devid, selected ? "assert" : "de-assert");
#warning "Missing logic"
}
-uint8_t pic32mx_spi1status(FAR struct spi_dev_s *dev, enum spi_dev_e devid)
+uint8_t pic32mx_spi1status(FAR struct spi_dev_s *dev, uint32_t devid)
{
spiinfo("Returning nothing\n");
#warning "Missing logic"
return 0;
}
#ifdef CONFIG_SPI_CMDDATA
-int pic32mx_spi1cmddata(FAR struct spi_dev_s *dev, enum spi_dev_e devid, bool cmd)
+int pic32mx_spi1cmddata(FAR struct spi_dev_s *dev, uint32_t devid, bool cmd)
{
#warning "Missing logic"
return 0;
@@ -149,20 +148,20 @@ int pic32mx_spi1cmddata(FAR struct spi_dev_s *dev, enum spi_dev_e devid, bool cm
#endif
#ifdef CONFIG_PIC32MX_SPI3
-void pic32mx_spi3select(FAR struct spi_dev_s *dev, enum spi_dev_e devid, bool selected)
+void pic32mx_spi3select(FAR struct spi_dev_s *dev, uint32_t devid, bool selected)
{
spiinfo("devid: %d CS: %s\n", (int)devid, selected ? "assert" : "de-assert");
#warning "Missing logic"
}
-uint8_t pic32mx_spi3status(FAR struct spi_dev_s *dev, enum spi_dev_e devid)
+uint8_t pic32mx_spi3status(FAR struct spi_dev_s *dev, uint32_t devid)
{
spiinfo("Returning nothing\n");
#warning "Missing logic"
return 0;
}
#ifdef CONFIG_SPI_CMDDATA
-int pic32mx_spi3cmddata(FAR struct spi_dev_s *dev, enum spi_dev_e devid, bool cmd)
+int pic32mx_spi3cmddata(FAR struct spi_dev_s *dev, uint32_t devid, bool cmd)
{
#warning "Missing logic"
return 0;
@@ -171,20 +170,20 @@ int pic32mx_spi3cmddata(FAR struct spi_dev_s *dev, enum spi_dev_e devid, bool cm
#endif
#ifdef CONFIG_PIC32MX_SPI4
-void pic32mx_spi4select(FAR struct spi_dev_s *dev, enum spi_dev_e devid, bool selected)
+void pic32mx_spi4select(FAR struct spi_dev_s *dev, uint32_t devid, bool selected)
{
spiinfo("devid: %d CS: %s\n", (int)devid, selected ? "assert" : "de-assert");
#warning "Missing logic"
}
-uint8_t pic32mx_spi4status(FAR struct spi_dev_s *dev, enum spi_dev_e devid)
+uint8_t pic32mx_spi4status(FAR struct spi_dev_s *dev, uint32_t devid)
{
spiinfo("Returning nothing\n");
#warning "Missing logic"
return 0;
}
#ifdef CONFIG_SPI_CMDDATA
-int pic32mx_spi4cmddata(FAR struct spi_dev_s *dev, enum spi_dev_e devid, bool cmd)
+int pic32mx_spi4cmddata(FAR struct spi_dev_s *dev, uint32_t devid, bool cmd)
{
#warning "Missing logic"
return 0;
diff --git a/configs/pic32mx7mmb/src/pic32_spi.c b/configs/pic32mx7mmb/src/pic32_spi.c
index 3cce76d53e..e12795b5f5 100644
--- a/configs/pic32mx7mmb/src/pic32_spi.c
+++ b/configs/pic32mx7mmb/src/pic32_spi.c
@@ -128,26 +128,25 @@ void weak_function pic32mx_spidev_initialize(void)
************************************************************************************/
struct spi_dev_s;
-enum spi_dev_e;
#ifdef CONFIG_PIC32MX_SPI1
-void pic32mx_spi1select(FAR struct spi_dev_s *dev, enum spi_dev_e devid, bool selected)
+void pic32mx_spi1select(FAR struct spi_dev_s *dev, uint32_t devid, bool selected)
{
spiinfo("devid: %d CS: %s\n", (int)devid, selected ? "assert" : "de-assert");
- if (devid == SPIDEV_MMCSD)
+ if (devid == SPIDEV_MMCSD(0))
{
pic32mx_gpiowrite(GPIO_SD_CS, !selected);
}
}
-uint8_t pic32mx_spi1status(FAR struct spi_dev_s *dev, enum spi_dev_e devid)
+uint8_t pic32mx_spi1status(FAR struct spi_dev_s *dev, uint32_t devid)
{
uint8_t ret = 0;
/* Card detect active low. */
- if (devid == SPIDEV_MMCSD)
+ if (devid == SPIDEV_MMCSD(0))
{
if (!pic32mx_gpioread(GPIO_SD_CD))
{
@@ -166,7 +165,7 @@ uint8_t pic32mx_spi1status(FAR struct spi_dev_s *dev, enum spi_dev_e devid)
return ret;
}
#ifdef CONFIG_SPI_CMDDATA
-int pic32mx_spi1cmddata(FAR struct spi_dev_s *dev, enum spi_dev_e devid, bool cmd)
+int pic32mx_spi1cmddata(FAR struct spi_dev_s *dev, uint32_t devid, bool cmd)
{
#warning "Missing logic"
return 0;
@@ -175,13 +174,13 @@ int pic32mx_spi1cmddata(FAR struct spi_dev_s *dev, enum spi_dev_e devid, bool cm
#endif
#ifdef CONFIG_PIC32MX_SPI2
-void pic31mx_spi2select(FAR struct spi_dev_s *dev, enum spi_dev_e devid, bool selected)
+void pic31mx_spi2select(FAR struct spi_dev_s *dev, uint32_t devid, bool selected)
{
spiinfo("devid: %d CS: %s\n", (int)devid, selected ? "assert" : "de-assert");
#warning "Missing logic"
}
-uint8_t pic31mx_spi2status(FAR struct spi_dev_s *dev, enum spi_dev_e devid)
+uint8_t pic31mx_spi2status(FAR struct spi_dev_s *dev, uint32_t devid)
{
spiinfo("Returning nothing\n");
#warning "Missing logic"
@@ -189,7 +188,7 @@ uint8_t pic31mx_spi2status(FAR struct spi_dev_s *dev, enum spi_dev_e devid)
}
#ifdef CONFIG_SPI_CMDDATA
-int pic31mx_spi2cmddata(FAR struct spi_dev_s *dev, enum spi_dev_e devid, bool cmd)
+int pic31mx_spi2cmddata(FAR struct spi_dev_s *dev, uint32_t devid, bool cmd)
{
#warning "Missing logic"
return 0;
@@ -198,13 +197,13 @@ int pic31mx_spi2cmddata(FAR struct spi_dev_s *dev, enum spi_dev_e devid, bool cm
#endif
#ifdef CONFIG_PIC32MX_SPI3
-void pic32mx_spi3select(FAR struct spi_dev_s *dev, enum spi_dev_e devid, bool selected)
+void pic32mx_spi3select(FAR struct spi_dev_s *dev, uint32_t devid, bool selected)
{
spiinfo("devid: %d CS: %s\n", (int)devid, selected ? "assert" : "de-assert");
#warning "Missing logic"
}
-uint8_t pic32mx_spi3status(FAR struct spi_dev_s *dev, enum spi_dev_e devid)
+uint8_t pic32mx_spi3status(FAR struct spi_dev_s *dev, uint32_t devid)
{
spiinfo("Returning nothing\n");
#warning "Missing logic"
@@ -212,7 +211,7 @@ uint8_t pic32mx_spi3status(FAR struct spi_dev_s *dev, enum spi_dev_e devid)
}
#ifdef CONFIG_SPI_CMDDATA
-int pic32mx_spi3cmddata(FAR struct spi_dev_s *dev, enum spi_dev_e devid, bool cmd)
+int pic32mx_spi3cmddata(FAR struct spi_dev_s *dev, uint32_t devid, bool cmd)
{
#warning "Missing logic"
return 0;
@@ -221,13 +220,13 @@ int pic32mx_spi3cmddata(FAR struct spi_dev_s *dev, enum spi_dev_e devid, bool cm
#endif
#ifdef CONFIG_PIC32MX_SPI4
-void pic32mx_spi4select(FAR struct spi_dev_s *dev, enum spi_dev_e devid, bool selected)
+void pic32mx_spi4select(FAR struct spi_dev_s *dev, uint32_t devid, bool selected)
{
spiinfo("devid: %d CS: %s\n", (int)devid, selected ? "assert" : "de-assert");
#warning "Missing logic"
}
-uint8_t pic32mx_spi4status(FAR struct spi_dev_s *dev, enum spi_dev_e devid)
+uint8_t pic32mx_spi4status(FAR struct spi_dev_s *dev, uint32_t devid)
{
spiinfo("Returning nothing\n");
#warning "Missing logic"
@@ -235,7 +234,7 @@ uint8_t pic32mx_spi4status(FAR struct spi_dev_s *dev, enum spi_dev_e devid)
}
#ifdef CONFIG_SPI_CMDDATA
-int pic32mx_spi4cmddata(FAR struct spi_dev_s *dev, enum spi_dev_e devid, bool cmd)
+int pic32mx_spi4cmddata(FAR struct spi_dev_s *dev, uint32_t devid, bool cmd)
{
#warning "Missing logic"
return 0;
diff --git a/configs/pic32mz-starterkit/src/pic32mz_spi.c b/configs/pic32mz-starterkit/src/pic32mz_spi.c
index f5093f9e6d..1de5d9ac9d 100644
--- a/configs/pic32mz-starterkit/src/pic32mz_spi.c
+++ b/configs/pic32mz-starterkit/src/pic32mz_spi.c
@@ -100,23 +100,22 @@ void weak_function pic32mz_spidev_initialize(void)
************************************************************************************/
struct spi_dev_s;
-enum spi_dev_e;
#ifdef CONFIG_PIC32MZ_SPI1
-void pic32mz_spi1select(FAR struct spi_dev_s *dev, enum spi_dev_e devid, bool selected)
+void pic32mz_spi1select(FAR struct spi_dev_s *dev, uint32_t devid, bool selected)
{
spiinfo("devid: %d CS: %s\n", (int)devid, selected ? "assert" : "de-assert");
#warning "Missing logic"
}
-uint8_t pic32mz_spi1status(FAR struct spi_dev_s *dev, enum spi_dev_e devid)
+uint8_t pic32mz_spi1status(FAR struct spi_dev_s *dev, uint32_t devid)
{
spiinfo("Returning nothing\n");
#warning "Missing logic"
return 0;
}
#ifdef CONFIG_SPI_CMDDATA
-int pic32mz_spi1cmddata(FAR struct spi_dev_s *dev, enum spi_dev_e devid, bool cmd)
+int pic32mz_spi1cmddata(FAR struct spi_dev_s *dev, uint32_t devid, bool cmd)
{
#warning "Missing logic"
return 0;
@@ -125,20 +124,20 @@ int pic32mz_spi1cmddata(FAR struct spi_dev_s *dev, enum spi_dev_e devid, bool cm
#endif
#ifdef CONFIG_PIC32MZ_SPI2
-void pic32mz_spi2select(FAR struct spi_dev_s *dev, enum spi_dev_e devid, bool selected)
+void pic32mz_spi2select(FAR struct spi_dev_s *dev, uint32_t devid, bool selected)
{
spiinfo("devid: %d CS: %s\n", (int)devid, selected ? "assert" : "de-assert");
#warning "Missing logic"
}
-uint8_t pic32mz_spi2status(FAR struct spi_dev_s *dev, enum spi_dev_e devid)
+uint8_t pic32mz_spi2status(FAR struct spi_dev_s *dev, uint32_t devid)
{
spiinfo("Returning nothing\n");
#warning "Missing logic"
return 0;
}
#ifdef CONFIG_SPI_CMDDATA
-int pic32mz_spi2cmddata(FAR struct spi_dev_s *dev, enum spi_dev_e devid, bool cmd)
+int pic32mz_spi2cmddata(FAR struct spi_dev_s *dev, uint32_t devid, bool cmd)
{
#warning "Missing logic"
return 0;
@@ -147,20 +146,20 @@ int pic32mz_spi2cmddata(FAR struct spi_dev_s *dev, enum spi_dev_e devid, bool cm
#endif
#ifdef CONFIG_PIC32MZ_SPI3
-void pic32mz_spi3select(FAR struct spi_dev_s *dev, enum spi_dev_e devid, bool selected)
+void pic32mz_spi3select(FAR struct spi_dev_s *dev, uint32_t devid, bool selected)
{
spiinfo("devid: %d CS: %s\n", (int)devid, selected ? "assert" : "de-assert");
#warning "Missing logic"
}
-uint8_t pic32mz_spi3status(FAR struct spi_dev_s *dev, enum spi_dev_e devid)
+uint8_t pic32mz_spi3status(FAR struct spi_dev_s *dev, uint32_t devid)
{
spiinfo("Returning nothing\n");
#warning "Missing logic"
return 0;
}
#ifdef CONFIG_SPI_CMDDATA
-int pic32mz_spi3cmddata(FAR struct spi_dev_s *dev, enum spi_dev_e devid, bool cmd)
+int pic32mz_spi3cmddata(FAR struct spi_dev_s *dev, uint32_t devid, bool cmd)
{
#warning "Missing logic"
return 0;
@@ -169,20 +168,20 @@ int pic32mz_spi3cmddata(FAR struct spi_dev_s *dev, enum spi_dev_e devid, bool cm
#endif
#ifdef CONFIG_PIC32MZ_SPI4
-void pic32mz_spi4select(FAR struct spi_dev_s *dev, enum spi_dev_e devid, bool selected)
+void pic32mz_spi4select(FAR struct spi_dev_s *dev, uint32_t devid, bool selected)
{
spiinfo("devid: %d CS: %s\n", (int)devid, selected ? "assert" : "de-assert");
#warning "Missing logic"
}
-uint8_t pic32mz_spi4status(FAR struct spi_dev_s *dev, enum spi_dev_e devid)
+uint8_t pic32mz_spi4status(FAR struct spi_dev_s *dev, uint32_t devid)
{
spiinfo("Returning nothing\n");
#warning "Missing logic"
return 0;
}
#ifdef CONFIG_SPI_CMDDATA
-int pic32mz_spi4cmddata(FAR struct spi_dev_s *dev, enum spi_dev_e devid, bool cmd)
+int pic32mz_spi4cmddata(FAR struct spi_dev_s *dev, uint32_t devid, bool cmd)
{
#warning "Missing logic"
return 0;
@@ -191,20 +190,20 @@ int pic32mz_spi4cmddata(FAR struct spi_dev_s *dev, enum spi_dev_e devid, bool cm
#endif
#ifdef CONFIG_PIC32MZ_SPI5
-void pic32mz_spi5select(FAR struct spi_dev_s *dev, enum spi_dev_e devid, bool selected)
+void pic32mz_spi5select(FAR struct spi_dev_s *dev, uint32_t devid, bool selected)
{
spiinfo("devid: %d CS: %s\n", (int)devid, selected ? "assert" : "de-assert");
#warning "Missing logic"
}
-uint8_t pic32mz_spi5status(FAR struct spi_dev_s *dev, enum spi_dev_e devid)
+uint8_t pic32mz_spi5status(FAR struct spi_dev_s *dev, uint32_t devid)
{
spiinfo("Returning nothing\n");
#warning "Missing logic"
return 0;
}
#ifdef CONFIG_SPI_CMDDATA
-int pic32mz_spi5cmddata(FAR struct spi_dev_s *dev, enum spi_dev_e devid, bool cmd)
+int pic32mz_spi5cmddata(FAR struct spi_dev_s *dev, uint32_t devid, bool cmd)
{
#warning "Missing logic"
return 0;
@@ -213,20 +212,20 @@ int pic32mz_spi5cmddata(FAR struct spi_dev_s *dev, enum spi_dev_e devid, bool cm
#endif
#ifdef CONFIG_PIC32MZ_SPI6
-void pic32mz_spi6select(FAR struct spi_dev_s *dev, enum spi_dev_e devid, bool selected)
+void pic32mz_spi6select(FAR struct spi_dev_s *dev, uint32_t devid, bool selected)
{
spiinfo("devid: %d CS: %s\n", (int)devid, selected ? "assert" : "de-assert");
#warning "Missing logic"
}
-uint8_t pic32mz_spi6status(FAR struct spi_dev_s *dev, enum spi_dev_e devid)
+uint8_t pic32mz_spi6status(FAR struct spi_dev_s *dev, uint32_t devid)
{
spiinfo("Returning nothing\n");
#warning "Missing logic"
return 0;
}
#ifdef CONFIG_SPI_CMDDATA
-int pic32mz_spi6cmddata(FAR struct spi_dev_s *dev, enum spi_dev_e devid, bool cmd)
+int pic32mz_spi6cmddata(FAR struct spi_dev_s *dev, uint32_t devid, bool cmd)
{
#warning "Missing logic"
return 0;
diff --git a/configs/sam3u-ek/src/sam_spi.c b/configs/sam3u-ek/src/sam_spi.c
index 6921548360..a6a08e7090 100644
--- a/configs/sam3u-ek/src/sam_spi.c
+++ b/configs/sam3u-ek/src/sam_spi.c
@@ -138,7 +138,7 @@ void weak_function sam_spidev_initialize(void)
*
****************************************************************************/
-void sam_spi0select(enum spi_dev_e devid, bool selected)
+void sam_spi0select(uint32_t devid, bool selected)
{
/* The touchscreen chip select is implemented as a GPIO OUTPUT that must
* be controlled by this function. This is because the ADS7843E driver
@@ -149,7 +149,7 @@ void sam_spi0select(enum spi_dev_e devid, bool selected)
*/
#if defined(CONFIG_INPUT) && defined(CONFIG_INPUT_ADS7843E)
- if (devid == SPIDEV_TOUCHSCREEN)
+ if (devid == SPIDEV_TOUCHSCREEN(0))
{
sam_gpiowrite(GPIO_TSC_NPCS2, !selected);
}
@@ -170,7 +170,7 @@ void sam_spi0select(enum spi_dev_e devid, bool selected)
*
****************************************************************************/
-uint8_t sam_spi0status(FAR struct spi_dev_s *dev, enum spi_dev_e devid)
+uint8_t sam_spi0status(FAR struct spi_dev_s *dev, uint32_t devid)
{
return 0;
}
diff --git a/configs/sam4e-ek/src/sam_spi.c b/configs/sam4e-ek/src/sam_spi.c
index a26a95c17d..340210ec8c 100644
--- a/configs/sam4e-ek/src/sam_spi.c
+++ b/configs/sam4e-ek/src/sam_spi.c
@@ -140,7 +140,7 @@ void weak_function sam_spidev_initialize(void)
*
****************************************************************************/
-void sam_spi0select(enum spi_dev_e devid, bool selected)
+void sam_spi0select(uint32_t devid, bool selected)
{
switch (devid)
{
@@ -153,7 +153,7 @@ void sam_spi0select(enum spi_dev_e devid, bool selected)
* manually and hold it low throughout the SPI transfer.
*/
- case SPIDEV_TOUCHSCREEN:
+ case SPIDEV_TOUCHSCREEN(0):
sam_gpiowrite(GPIO_TSC_CS, !selected);
break;
#endif
@@ -161,7 +161,7 @@ void sam_spi0select(enum spi_dev_e devid, bool selected)
#if defined(CONFIG_MTD_AT25)
/* The AT25 Serial FLASH connects using NPCS3 (PA5). */
- case SPIDEV_FLASH:
+ case SPIDEV_FLASH(0):
sam_gpiowrite(GPIO_FLASH_CS, !selected);
break;
#endif
@@ -185,7 +185,7 @@ void sam_spi0select(enum spi_dev_e devid, bool selected)
*
****************************************************************************/
-uint8_t sam_spi0status(FAR struct spi_dev_s *dev, enum spi_dev_e devid)
+uint8_t sam_spi0status(FAR struct spi_dev_s *dev, uint32_t devid)
{
return 0;
}
diff --git a/configs/sam4l-xplained/src/sam_spi.c b/configs/sam4l-xplained/src/sam_spi.c
index 47e7741e50..a6eeee18a2 100644
--- a/configs/sam4l-xplained/src/sam_spi.c
+++ b/configs/sam4l-xplained/src/sam_spi.c
@@ -140,12 +140,12 @@ void weak_function sam_spidev_initialize(void)
*
****************************************************************************/
-void sam_spi0select(enum spi_dev_e devid, bool selected)
+void sam_spi0select(uint32_t devid, bool selected)
{
#ifdef CONFIG_SAM4L_XPLAINED_IOMODULE
/* Select/de-select the SD card */
- if (devid == SPIDEV_MMCSD)
+ if (devid == SPIDEV_MMCSD(0))
{
/* Active low */
@@ -160,7 +160,7 @@ void sam_spi0select(enum spi_dev_e devid, bool selected)
#ifdef CONFIG_SAM4L_XPLAINED_OLED1MODULE
/* Select/de-select the OLED */
- if (devid == SPIDEV_DISPLAY)
+ if (devid == SPIDEV_DISPLAY(0))
{
/* Active low */
@@ -183,14 +183,14 @@ void sam_spi0select(enum spi_dev_e devid, bool selected)
*
****************************************************************************/
-uint8_t sam_spi0status(FAR struct spi_dev_s *dev, enum spi_dev_e devid)
+uint8_t sam_spi0status(FAR struct spi_dev_s *dev, uint32_t devid)
{
uint8_t ret = 0;
#ifdef CONFIG_SAM4L_XPLAINED_IOMODULE
/* Check if an SD card is present in the microSD slot */
- if (devid == SPIDEV_MMCSD)
+ if (devid == SPIDEV_MMCSD(0))
{
/* Active low */
@@ -231,10 +231,10 @@ uint8_t sam_spi0status(FAR struct spi_dev_s *dev, enum spi_dev_e devid)
****************************************************************************/
#ifdef CONFIG_SPI_CMDDATA
-int sam_spic0mddata(FAR struct spi_dev_s *dev, enum spi_dev_e devid, bool cmd)
+int sam_spic0mddata(FAR struct spi_dev_s *dev, uint32_t devid, bool cmd)
{
#ifdef CONFIG_SAM4L_XPLAINED_OLED1MODULE
- if (devid == SPIDEV_DISPLAY)
+ if (devid == SPIDEV_DISPLAY(0))
{
/* This is the Data/Command control pad which determines whether the
* data bits are data or a command.
diff --git a/configs/sama5d3-xplained/src/sam_spi.c b/configs/sama5d3-xplained/src/sam_spi.c
index 9c42a10d65..a4e1b3d95d 100644
--- a/configs/sama5d3-xplained/src/sam_spi.c
+++ b/configs/sama5d3-xplained/src/sam_spi.c
@@ -140,12 +140,12 @@ void weak_function sam_spidev_initialize(void)
****************************************************************************/
#ifdef CONFIG_SAMA5_SPI0
-void sam_spi0select(enum spi_dev_e devid, bool selected)
+void sam_spi0select(uint32_t devid, bool selected)
{
#ifdef CONFIG_MTD_AT25
/* The AT25 serial FLASH connects using NPCS0 */
- if (devid == SPIDEV_FLASH)
+ if (devid == SPIDEV_FLASH(0))
{
sam_piowrite(PIO_AT25_NPCS0, !selected);
}
@@ -154,7 +154,7 @@ void sam_spi0select(enum spi_dev_e devid, bool selected)
#endif
#ifdef CONFIG_SAMA5_SPI1
-void sam_spi1select(enum spi_dev_e devid, bool selected)
+void sam_spi1select(uint32_t devid, bool selected)
{
}
#endif
@@ -174,14 +174,14 @@ void sam_spi1select(enum spi_dev_e devid, bool selected)
****************************************************************************/
#ifdef CONFIG_SAMA5_SPI0
-uint8_t sam_spi0status(FAR struct spi_dev_s *dev, enum spi_dev_e devid)
+uint8_t sam_spi0status(FAR struct spi_dev_s *dev, uint32_t devid)
{
return 0;
}
#endif
#ifdef CONFIG_SAMA5_SPI0
-uint8_t sam_spi1status(FAR struct spi_dev_s *dev, enum spi_dev_e devid)
+uint8_t sam_spi1status(FAR struct spi_dev_s *dev, uint32_t devid)
{
return 0;
}
diff --git a/configs/sama5d3x-ek/src/sam_spi.c b/configs/sama5d3x-ek/src/sam_spi.c
index f2932e5fb8..c9827f9a77 100644
--- a/configs/sama5d3x-ek/src/sam_spi.c
+++ b/configs/sama5d3x-ek/src/sam_spi.c
@@ -140,12 +140,12 @@ void weak_function sam_spidev_initialize(void)
****************************************************************************/
#ifdef CONFIG_SAMA5_SPI0
-void sam_spi0select(enum spi_dev_e devid, bool selected)
+void sam_spi0select(uint32_t devid, bool selected)
{
#ifdef CONFIG_MTD_AT25
/* The AT25 serial FLASH connects using NPCS0 */
- if (devid == SPIDEV_FLASH)
+ if (devid == SPIDEV_FLASH(0))
{
sam_piowrite(PIO_AT25_NPCS0, !selected);
}
@@ -154,7 +154,7 @@ void sam_spi0select(enum spi_dev_e devid, bool selected)
#endif
#ifdef CONFIG_SAMA5_SPI1
-void sam_spi1select(enum spi_dev_e devid, bool selected)
+void sam_spi1select(uint32_t devid, bool selected)
{
}
#endif
@@ -174,14 +174,14 @@ void sam_spi1select(enum spi_dev_e devid, bool selected)
****************************************************************************/
#ifdef CONFIG_SAMA5_SPI0
-uint8_t sam_spi0status(FAR struct spi_dev_s *dev, enum spi_dev_e devid)
+uint8_t sam_spi0status(FAR struct spi_dev_s *dev, uint32_t devid)
{
return 0;
}
#endif
#ifdef CONFIG_SAMA5_SPI0
-uint8_t sam_spi1status(FAR struct spi_dev_s *dev, enum spi_dev_e devid)
+uint8_t sam_spi1status(FAR struct spi_dev_s *dev, uint32_t devid)
{
return 0;
}
diff --git a/configs/sama5d4-ek/src/sam_spi.c b/configs/sama5d4-ek/src/sam_spi.c
index 4b24a4b1ce..7534e373b1 100644
--- a/configs/sama5d4-ek/src/sam_spi.c
+++ b/configs/sama5d4-ek/src/sam_spi.c
@@ -140,12 +140,12 @@ void weak_function sam_spidev_initialize(void)
****************************************************************************/
#ifdef CONFIG_SAMA5_SPI0
-void sam_spi0select(enum spi_dev_e devid, bool selected)
+void sam_spi0select(uint32_t devid, bool selected)
{
#ifdef CONFIG_MTD_AT25
/* The AT25 serial FLASH connects using NPCS0 */
- if (devid == SPIDEV_FLASH)
+ if (devid == SPIDEV_FLASH(0))
{
sam_piowrite(PIO_AT25_NPCS0, !selected);
}
@@ -154,7 +154,7 @@ void sam_spi0select(enum spi_dev_e devid, bool selected)
#endif
#ifdef CONFIG_SAMA5_SPI1
-void sam_spi1select(enum spi_dev_e devid, bool selected)
+void sam_spi1select(uint32_t devid, bool selected)
{
}
#endif
@@ -174,14 +174,14 @@ void sam_spi1select(enum spi_dev_e devid, bool selected)
****************************************************************************/
#ifdef CONFIG_SAMA5_SPI0
-uint8_t sam_spi0status(FAR struct spi_dev_s *dev, enum spi_dev_e devid)
+uint8_t sam_spi0status(FAR struct spi_dev_s *dev, uint32_t devid)
{
return 0;
}
#endif
#ifdef CONFIG_SAMA5_SPI0
-uint8_t sam_spi1status(FAR struct spi_dev_s *dev, enum spi_dev_e devid)
+uint8_t sam_spi1status(FAR struct spi_dev_s *dev, uint32_t devid)
{
return 0;
}
diff --git a/configs/samd20-xplained/src/sam_spi.c b/configs/samd20-xplained/src/sam_spi.c
index 3ec3469adb..2367243fe5 100644
--- a/configs/samd20-xplained/src/sam_spi.c
+++ b/configs/samd20-xplained/src/sam_spi.c
@@ -148,13 +148,13 @@ void weak_function sam_spidev_initialize(void)
****************************************************************************/
#ifdef SAMDL_HAVE_SPI0
-void sam_spi0select(FAR struct spi_dev_s *dev, enum spi_dev_e devid,
+void sam_spi0select(FAR struct spi_dev_s *dev, uint32_t devid,
bool selected)
{
#ifdef CONFIG_SAMD20_XPLAINED_IOMODULE_EXT1
/* Select/de-select the SD card */
- if (devid == SPIDEV_MMCSD)
+ if (devid == SPIDEV_MMCSD(0))
{
/* Active low */
@@ -165,7 +165,7 @@ void sam_spi0select(FAR struct spi_dev_s *dev, enum spi_dev_e devid,
#ifdef CONFIG_SAMD20_XPLAINED_OLED1MODULE_EXT1
/* Select/de-select the OLED */
- if (devid == SPIDEV_DISPLAY)
+ if (devid == SPIDEV_DISPLAY(0))
{
/* Active low */
@@ -176,13 +176,13 @@ void sam_spi0select(FAR struct spi_dev_s *dev, enum spi_dev_e devid,
#endif
#ifdef SAMDL_HAVE_SPI1
-void sam_spi1select(FAR struct spi_dev_s *dev, enum spi_dev_e devid,
+void sam_spi1select(FAR struct spi_dev_s *dev, uint32_t devid,
bool selected)
{
#ifdef CONFIG_SAMD20_XPLAINED_IOMODULE_EXT2
/* Select/de-select the SD card */
- if (devid == SPIDEV_MMCSD)
+ if (devid == SPIDEV_MMCSD(0))
{
/* Active low */
@@ -193,7 +193,7 @@ void sam_spi1select(FAR struct spi_dev_s *dev, enum spi_dev_e devid,
#ifdef CONFIG_SAMD20_XPLAINED_OLED1MODULE_EXT2
/* Select/de-select the OLED */
- if (devid == SPIDEV_DISPLAY)
+ if (devid == SPIDEV_DISPLAY(0))
{
/* Active low */
@@ -204,28 +204,28 @@ void sam_spi1select(FAR struct spi_dev_s *dev, enum spi_dev_e devid,
#endif
#ifdef SAMDL_HAVE_SPI2
-void sam_spi2select(FAR struct spi_dev_s *dev, enum spi_dev_e devid,
+void sam_spi2select(FAR struct spi_dev_s *dev, uint32_t devid,
bool selected)
{
}
#endif
#ifdef SAMDL_HAVE_SPI3
-void sam_spi3select(FAR struct spi_dev_s *dev, enum spi_dev_e devid,
+void sam_spi3select(FAR struct spi_dev_s *dev, uint32_t devid,
bool selected)
{
}
#endif
#ifdef SAMDL_HAVE_SPI4
-void sam_spi4select(FAR struct spi_dev_s *dev, enum spi_dev_e devid,
+void sam_spi4select(FAR struct spi_dev_s *dev, uint32_t devid,
bool selected)
{
}
#endif
#ifdef SAMDL_HAVE_SPI5
-void sam_spi5select(FAR struct spi_dev_s *dev, enum spi_dev_e devid,
+void sam_spi5select(FAR struct spi_dev_s *dev, uint32_t devid,
bool selected)
{
}
@@ -247,14 +247,14 @@ void sam_spi5select(FAR struct spi_dev_s *dev, enum spi_dev_e devid,
****************************************************************************/
#ifdef SAMDL_HAVE_SPI0
-uint8_t sam_spi0status(FAR struct spi_dev_s *dev, enum spi_dev_e devid)
+uint8_t sam_spi0status(FAR struct spi_dev_s *dev, uint32_t devid)
{
uint8_t ret = 0;
#ifdef CONFIG_SAMD20_XPLAINED_IOMODULE_EXT1
/* Check if an SD card is present in the microSD slot */
- if (devid == SPIDEV_MMCSD)
+ if (devid == SPIDEV_MMCSD(0))
{
/* Active low */
@@ -270,14 +270,14 @@ uint8_t sam_spi0status(FAR struct spi_dev_s *dev, enum spi_dev_e devid)
#endif
#ifdef SAMDL_HAVE_SPI1
-uint8_t sam_spi1status(FAR struct spi_dev_s *dev, enum spi_dev_e devid)
+uint8_t sam_spi1status(FAR struct spi_dev_s *dev, uint32_t devid)
{
uint8_t ret = 0;
#ifdef CONFIG_SAMD20_XPLAINED_IOMODULE_EXT2
/* Check if an SD card is present in the microSD slot */
- if (devid == SPIDEV_MMCSD)
+ if (devid == SPIDEV_MMCSD(0))
{
/* Active low */
@@ -293,28 +293,28 @@ uint8_t sam_spi1status(FAR struct spi_dev_s *dev, enum spi_dev_e devid)
#endif
#ifdef SAMDL_HAVE_SPI2
-uint8_t sam_spi2status(FAR struct spi_dev_s *dev, enum spi_dev_e devid)
+uint8_t sam_spi2status(FAR struct spi_dev_s *dev, uint32_t devid)
{
return 0;
}
#endif
#ifdef SAMDL_HAVE_SPI3
-uint8_t sam_spi3status(FAR struct spi_dev_s *dev, enum spi_dev_e devid)
+uint8_t sam_spi3status(FAR struct spi_dev_s *dev, uint32_t devid)
{
return 0;
}
#endif
#ifdef SAMDL_HAVE_SPI4
-uint8_t sam_spi4status(FAR struct spi_dev_s *dev, enum spi_dev_e devid)
+uint8_t sam_spi4status(FAR struct spi_dev_s *dev, uint32_t devid)
{
return 0;
}
#endif
#ifdef SAMDL_HAVE_SPI5
-uint8_t sam_spi5status(FAR struct spi_dev_s *dev, enum spi_dev_e devid)
+uint8_t sam_spi5status(FAR struct spi_dev_s *dev, uint32_t devid)
{
uint8_t ret = 0;
return ret;
@@ -347,10 +347,10 @@ uint8_t sam_spi5status(FAR struct spi_dev_s *dev, enum spi_dev_e devid)
#ifdef CONFIG_SPI_CMDDATA
#ifdef SAMDL_HAVE_SPI0
-int sam_spi0cmddata(FAR struct spi_dev_s *dev, enum spi_dev_e devid, bool cmd)
+int sam_spi0cmddata(FAR struct spi_dev_s *dev, uint32_t devid, bool cmd)
{
#ifdef CONFIG_SAMD20_XPLAINED_OLED1MODULE_EXT1
- if (devid == SPIDEV_DISPLAY)
+ if (devid == SPIDEV_DISPLAY(0))
{
/* This is the Data/Command control pad which determines whether the
* data bits are data or a command.
@@ -368,10 +368,10 @@ int sam_spi0cmddata(FAR struct spi_dev_s *dev, enum spi_dev_e devid, bool cmd)
#endif
#ifdef SAMDL_HAVE_SPI1
-int sam_spi1cmddata(FAR struct spi_dev_s *dev, enum spi_dev_e devid, bool cmd)
+int sam_spi1cmddata(FAR struct spi_dev_s *dev, uint32_t devid, bool cmd)
{
#ifdef CONFIG_SAMD20_XPLAINED_OLED1MODULE_EXT2
- if (devid == SPIDEV_DISPLAY)
+ if (devid == SPIDEV_DISPLAY(0))
{
/* This is the Data/Command control pad which determines whether the
* data bits are data or a command.
@@ -389,28 +389,28 @@ int sam_spi1cmddata(FAR struct spi_dev_s *dev, enum spi_dev_e devid, bool cmd)
#endif
#ifdef SAMDL_HAVE_SPI2
-int sam_spi2cmddata(FAR struct spi_dev_s *dev, enum spi_dev_e devid, bool cmd)
+int sam_spi2cmddata(FAR struct spi_dev_s *dev, uint32_t devid, bool cmd)
{
return OK;
}
#endif
#ifdef SAMDL_HAVE_SPI3
-int sam_spi3cmddata(FAR struct spi_dev_s *dev, enum spi_dev_e devid, bool cmd)
+int sam_spi3cmddata(FAR struct spi_dev_s *dev, uint32_t devid, bool cmd)
{
return OK;
}
#endif
#ifdef SAMDL_HAVE_SPI4
-int sam_spi4cmddata(FAR struct spi_dev_s *dev, enum spi_dev_e devid, bool cmd)
+int sam_spi4cmddata(FAR struct spi_dev_s *dev, uint32_t devid, bool cmd)
{
return OK;
}
#endif
#ifdef SAMDL_HAVE_SPI5
-int sam_spi5cmddata(FAR struct spi_dev_s *dev, enum spi_dev_e devid, bool cmd)
+int sam_spi5cmddata(FAR struct spi_dev_s *dev, uint32_t devid, bool cmd)
{
return OK;
}
diff --git a/configs/samd21-xplained/src/sam_spi.c b/configs/samd21-xplained/src/sam_spi.c
index eaf17020ec..32dbdb62bb 100644
--- a/configs/samd21-xplained/src/sam_spi.c
+++ b/configs/samd21-xplained/src/sam_spi.c
@@ -148,13 +148,13 @@ void weak_function sam_spidev_initialize(void)
****************************************************************************/
#ifdef SAMDL_HAVE_SPI0
-void sam_spi0select(FAR struct spi_dev_s *dev, enum spi_dev_e devid,
+void sam_spi0select(FAR struct spi_dev_s *dev, uint32_t devid,
bool selected)
{
#ifdef CONFIG_SAMD21_XPLAINED_IOMODULE_EXT1
/* Select/de-select the SD card */
- if (devid == SPIDEV_MMCSD)
+ if (devid == SPIDEV_MMCSD(0))
{
/* Active low */
@@ -165,7 +165,7 @@ void sam_spi0select(FAR struct spi_dev_s *dev, enum spi_dev_e devid,
#ifdef CONFIG_SAMD21_XPLAINED_OLED1MODULE_EXT1
/* Select/de-select the OLED */
- if (devid == SPIDEV_DISPLAY)
+ if (devid == SPIDEV_DISPLAY(0))
{
/* Active low */
@@ -176,13 +176,13 @@ void sam_spi0select(FAR struct spi_dev_s *dev, enum spi_dev_e devid,
#endif
#ifdef SAMDL_HAVE_SPI1
-void sam_spi1select(FAR struct spi_dev_s *dev, enum spi_dev_e devid,
+void sam_spi1select(FAR struct spi_dev_s *dev, uint32_t devid,
bool selected)
{
#ifdef CONFIG_SAMD21_XPLAINED_IOMODULE_EXT2
/* Select/de-select the SD card */
- if (devid == SPIDEV_MMCSD)
+ if (devid == SPIDEV_MMCSD(0))
{
/* Active low */
@@ -193,7 +193,7 @@ void sam_spi1select(FAR struct spi_dev_s *dev, enum spi_dev_e devid,
#ifdef CONFIG_SAMD21_XPLAINED_OLED1MODULE_EXT2
/* Select/de-select the OLED */
- if (devid == SPIDEV_DISPLAY)
+ if (devid == SPIDEV_DISPLAY(0))
{
/* Active low */
@@ -204,28 +204,28 @@ void sam_spi1select(FAR struct spi_dev_s *dev, enum spi_dev_e devid,
#endif
#ifdef SAMDL_HAVE_SPI2
-void sam_spi2select(FAR struct spi_dev_s *dev, enum spi_dev_e devid,
+void sam_spi2select(FAR struct spi_dev_s *dev, uint32_t devid,
bool selected)
{
}
#endif
#ifdef SAMDL_HAVE_SPI3
-void sam_spi3select(FAR struct spi_dev_s *dev, enum spi_dev_e devid,
+void sam_spi3select(FAR struct spi_dev_s *dev, uint32_t devid,
bool selected)
{
}
#endif
#ifdef SAMDL_HAVE_SPI4
-void sam_spi4select(FAR struct spi_dev_s *dev, enum spi_dev_e devid,
+void sam_spi4select(FAR struct spi_dev_s *dev, uint32_t devid,
bool selected)
{
}
#endif
#ifdef SAMDL_HAVE_SPI5
-void sam_spi5select(FAR struct spi_dev_s *dev, enum spi_dev_e devid,
+void sam_spi5select(FAR struct spi_dev_s *dev, uint32_t devid,
bool selected)
{
}
@@ -247,14 +247,14 @@ void sam_spi5select(FAR struct spi_dev_s *dev, enum spi_dev_e devid,
****************************************************************************/
#ifdef SAMDL_HAVE_SPI0
-uint8_t sam_spi0status(FAR struct spi_dev_s *dev, enum spi_dev_e devid)
+uint8_t sam_spi0status(FAR struct spi_dev_s *dev, uint32_t devid)
{
uint8_t ret = 0;
#ifdef CONFIG_SAMD21_XPLAINED_IOMODULE_EXT1
/* Check if an SD card is present in the microSD slot */
- if (devid == SPIDEV_MMCSD)
+ if (devid == SPIDEV_MMCSD(0))
{
/* Active low */
@@ -270,14 +270,14 @@ uint8_t sam_spi0status(FAR struct spi_dev_s *dev, enum spi_dev_e devid)
#endif
#ifdef SAMDL_HAVE_SPI1
-uint8_t sam_spi1status(FAR struct spi_dev_s *dev, enum spi_dev_e devid)
+uint8_t sam_spi1status(FAR struct spi_dev_s *dev, uint32_t devid)
{
uint8_t ret = 0;
#ifdef CONFIG_SAMD21_XPLAINED_IOMODULE_EXT2
/* Check if an SD card is present in the microSD slot */
- if (devid == SPIDEV_MMCSD)
+ if (devid == SPIDEV_MMCSD(0))
{
/* Active low */
@@ -293,28 +293,28 @@ uint8_t sam_spi1status(FAR struct spi_dev_s *dev, enum spi_dev_e devid)
#endif
#ifdef SAMDL_HAVE_SPI2
-uint8_t sam_spi2status(FAR struct spi_dev_s *dev, enum spi_dev_e devid)
+uint8_t sam_spi2status(FAR struct spi_dev_s *dev, uint32_t devid)
{
return 0;
}
#endif
#ifdef SAMDL_HAVE_SPI3
-uint8_t sam_spi3status(FAR struct spi_dev_s *dev, enum spi_dev_e devid)
+uint8_t sam_spi3status(FAR struct spi_dev_s *dev, uint32_t devid)
{
return 0;
}
#endif
#ifdef SAMDL_HAVE_SPI4
-uint8_t sam_spi4status(FAR struct spi_dev_s *dev, enum spi_dev_e devid)
+uint8_t sam_spi4status(FAR struct spi_dev_s *dev, uint32_t devid)
{
return 0;
}
#endif
#ifdef SAMDL_HAVE_SPI5
-uint8_t sam_spi5status(FAR struct spi_dev_s *dev, enum spi_dev_e devid)
+uint8_t sam_spi5status(FAR struct spi_dev_s *dev, uint32_t devid)
{
uint8_t ret = 0;
return ret;
@@ -347,10 +347,10 @@ uint8_t sam_spi5status(FAR struct spi_dev_s *dev, enum spi_dev_e devid)
#ifdef CONFIG_SPI_CMDDATA
#ifdef SAMDL_HAVE_SPI0
-int sam_spi0cmddata(FAR struct spi_dev_s *dev, enum spi_dev_e devid, bool cmd)
+int sam_spi0cmddata(FAR struct spi_dev_s *dev, uint32_t devid, bool cmd)
{
#ifdef CONFIG_SAMD21_XPLAINED_OLED1MODULE_EXT1
- if (devid == SPIDEV_DISPLAY)
+ if (devid == SPIDEV_DISPLAY(0))
{
/* This is the Data/Command control pad which determines whether the
* data bits are data or a command.
@@ -368,10 +368,10 @@ int sam_spi0cmddata(FAR struct spi_dev_s *dev, enum spi_dev_e devid, bool cmd)
#endif
#ifdef SAMDL_HAVE_SPI1
-int sam_spi1cmddata(FAR struct spi_dev_s *dev, enum spi_dev_e devid, bool cmd)
+int sam_spi1cmddata(FAR struct spi_dev_s *dev, uint32_t devid, bool cmd)
{
#ifdef CONFIG_SAMD21_XPLAINED_OLED1MODULE_EXT2
- if (devid == SPIDEV_DISPLAY)
+ if (devid == SPIDEV_DISPLAY(0))
{
/* This is the Data/Command control pad which determines whether the
* data bits are data or a command.
@@ -389,28 +389,28 @@ int sam_spi1cmddata(FAR struct spi_dev_s *dev, enum spi_dev_e devid, bool cmd)
#endif
#ifdef SAMDL_HAVE_SPI2
-int sam_spi2cmddata(FAR struct spi_dev_s *dev, enum spi_dev_e devid, bool cmd)
+int sam_spi2cmddata(FAR struct spi_dev_s *dev, uint32_t devid, bool cmd)
{
return OK;
}
#endif
#ifdef SAMDL_HAVE_SPI3
-int sam_spi3cmddata(FAR struct spi_dev_s *dev, enum spi_dev_e devid, bool cmd)
+int sam_spi3cmddata(FAR struct spi_dev_s *dev, uint32_t devid, bool cmd)
{
return OK;
}
#endif
#ifdef SAMDL_HAVE_SPI4
-int sam_spi4cmddata(FAR struct spi_dev_s *dev, enum spi_dev_e devid, bool cmd)
+int sam_spi4cmddata(FAR struct spi_dev_s *dev, uint32_t devid, bool cmd)
{
return OK;
}
#endif
#ifdef SAMDL_HAVE_SPI5
-int sam_spi5cmddata(FAR struct spi_dev_s *dev, enum spi_dev_e devid, bool cmd)
+int sam_spi5cmddata(FAR struct spi_dev_s *dev, uint32_t devid, bool cmd)
{
return OK;
}
diff --git a/configs/same70-xplained/src/sam_spi.c b/configs/same70-xplained/src/sam_spi.c
index c21979060b..e50136df93 100644
--- a/configs/same70-xplained/src/sam_spi.c
+++ b/configs/same70-xplained/src/sam_spi.c
@@ -141,13 +141,13 @@ void sam_spidev_initialize(void)
****************************************************************************/
#ifdef CONFIG_SAMV7_SPI0_MASTER
-void sam_spi0select(enum spi_dev_e devid, bool selected)
+void sam_spi0select(uint32_t devid, bool selected)
{
}
#endif
#ifdef CONFIG_SAMV7_SPI1_MASTER
-void sam_spi1select(enum spi_dev_e devid, bool selected)
+void sam_spi1select(uint32_t devid, bool selected)
{
}
#endif
@@ -167,14 +167,14 @@ void sam_spi1select(enum spi_dev_e devid, bool selected)
****************************************************************************/
#ifdef CONFIG_SAMV7_SPI0_MASTER
-uint8_t sam_spi0status(FAR struct spi_dev_s *dev, enum spi_dev_e devid)
+uint8_t sam_spi0status(FAR struct spi_dev_s *dev, uint32_t devid)
{
return 0;
}
#endif
#ifdef CONFIG_SAMV7_SPI1_MASTER
-uint8_t sam_spi1status(FAR struct spi_dev_s *dev, enum spi_dev_e devid)
+uint8_t sam_spi1status(FAR struct spi_dev_s *dev, uint32_t devid)
{
return 0;
}
diff --git a/configs/saml21-xplained/src/sam_spi.c b/configs/saml21-xplained/src/sam_spi.c
index ae1238eb2d..576444508d 100644
--- a/configs/saml21-xplained/src/sam_spi.c
+++ b/configs/saml21-xplained/src/sam_spi.c
@@ -148,13 +148,13 @@ void weak_function sam_spidev_initialize(void)
****************************************************************************/
#ifdef SAMDL_HAVE_SPI0
-void sam_spi0select(FAR struct spi_dev_s *dev, enum spi_dev_e devid,
+void sam_spi0select(FAR struct spi_dev_s *dev, uint32_t devid,
bool selected)
{
#ifdef CONFIG_SAML21_XPLAINED_IOMODULE_EXT1
/* Select/de-select the SD card */
- if (devid == SPIDEV_MMCSD)
+ if (devid == SPIDEV_MMCSD(0))
{
/* Active low */
@@ -165,7 +165,7 @@ void sam_spi0select(FAR struct spi_dev_s *dev, enum spi_dev_e devid,
#ifdef CONFIG_SAML21_XPLAINED_OLED1MODULE_EXT1
/* Select/de-select the OLED */
- if (devid == SPIDEV_DISPLAY)
+ if (devid == SPIDEV_DISPLAY(0))
{
/* Active low */
@@ -176,13 +176,13 @@ void sam_spi0select(FAR struct spi_dev_s *dev, enum spi_dev_e devid,
#endif
#ifdef SAMDL_HAVE_SPI1
-void sam_spi1select(FAR struct spi_dev_s *dev, enum spi_dev_e devid,
+void sam_spi1select(FAR struct spi_dev_s *dev, uint32_t devid,
bool selected)
{
#ifdef CONFIG_SAML21_XPLAINED_IOMODULE_EXT2
/* Select/de-select the SD card */
- if (devid == SPIDEV_MMCSD)
+ if (devid == SPIDEV_MMCSD(0))
{
/* Active low */
@@ -193,7 +193,7 @@ void sam_spi1select(FAR struct spi_dev_s *dev, enum spi_dev_e devid,
#ifdef CONFIG_SAML21_XPLAINED_OLED1MODULE_EXT2
/* Select/de-select the OLED */
- if (devid == SPIDEV_DISPLAY)
+ if (devid == SPIDEV_DISPLAY(0))
{
/* Active low */
@@ -204,28 +204,28 @@ void sam_spi1select(FAR struct spi_dev_s *dev, enum spi_dev_e devid,
#endif
#ifdef SAMDL_HAVE_SPI2
-void sam_spi2select(FAR struct spi_dev_s *dev, enum spi_dev_e devid,
+void sam_spi2select(FAR struct spi_dev_s *dev, uint32_t devid,
bool selected)
{
}
#endif
#ifdef SAMDL_HAVE_SPI3
-void sam_spi3select(FAR struct spi_dev_s *dev, enum spi_dev_e devid,
+void sam_spi3select(FAR struct spi_dev_s *dev, uint32_t devid,
bool selected)
{
}
#endif
#ifdef SAMDL_HAVE_SPI4
-void sam_spi4select(FAR struct spi_dev_s *dev, enum spi_dev_e devid,
+void sam_spi4select(FAR struct spi_dev_s *dev, uint32_t devid,
bool selected)
{
}
#endif
#ifdef SAMDL_HAVE_SPI5
-void sam_spi5select(FAR struct spi_dev_s *dev, enum spi_dev_e devid,
+void sam_spi5select(FAR struct spi_dev_s *dev, uint32_t devid,
bool selected)
{
}
@@ -247,14 +247,14 @@ void sam_spi5select(FAR struct spi_dev_s *dev, enum spi_dev_e devid,
****************************************************************************/
#ifdef SAMDL_HAVE_SPI0
-uint8_t sam_spi0status(FAR struct spi_dev_s *dev, enum spi_dev_e devid)
+uint8_t sam_spi0status(FAR struct spi_dev_s *dev, uint32_t devid)
{
uint8_t ret = 0;
#ifdef CONFIG_SAML21_XPLAINED_IOMODULE_EXT1
/* Check if an SD card is present in the microSD slot */
- if (devid == SPIDEV_MMCSD)
+ if (devid == SPIDEV_MMCSD(0))
{
/* Active low */
@@ -270,14 +270,14 @@ uint8_t sam_spi0status(FAR struct spi_dev_s *dev, enum spi_dev_e devid)
#endif
#ifdef SAMDL_HAVE_SPI1
-uint8_t sam_spi1status(FAR struct spi_dev_s *dev, enum spi_dev_e devid)
+uint8_t sam_spi1status(FAR struct spi_dev_s *dev, uint32_t devid)
{
uint8_t ret = 0;
#ifdef CONFIG_SAML21_XPLAINED_IOMODULE_EXT2
/* Check if an SD card is present in the microSD slot */
- if (devid == SPIDEV_MMCSD)
+ if (devid == SPIDEV_MMCSD(0))
{
/* Active low */
@@ -293,28 +293,28 @@ uint8_t sam_spi1status(FAR struct spi_dev_s *dev, enum spi_dev_e devid)
#endif
#ifdef SAMDL_HAVE_SPI2
-uint8_t sam_spi2status(FAR struct spi_dev_s *dev, enum spi_dev_e devid)
+uint8_t sam_spi2status(FAR struct spi_dev_s *dev, uint32_t devid)
{
return 0;
}
#endif
#ifdef SAMDL_HAVE_SPI3
-uint8_t sam_spi3status(FAR struct spi_dev_s *dev, enum spi_dev_e devid)
+uint8_t sam_spi3status(FAR struct spi_dev_s *dev, uint32_t devid)
{
return 0;
}
#endif
#ifdef SAMDL_HAVE_SPI4
-uint8_t sam_spi4status(FAR struct spi_dev_s *dev, enum spi_dev_e devid)
+uint8_t sam_spi4status(FAR struct spi_dev_s *dev, uint32_t devid)
{
return 0;
}
#endif
#ifdef SAMDL_HAVE_SPI5
-uint8_t sam_spi5status(FAR struct spi_dev_s *dev, enum spi_dev_e devid)
+uint8_t sam_spi5status(FAR struct spi_dev_s *dev, uint32_t devid)
{
uint8_t ret = 0;
return ret;
@@ -347,10 +347,10 @@ uint8_t sam_spi5status(FAR struct spi_dev_s *dev, enum spi_dev_e devid)
#ifdef CONFIG_SPI_CMDDATA
#ifdef SAMDL_HAVE_SPI0
-int sam_spi0cmddata(FAR struct spi_dev_s *dev, enum spi_dev_e devid, bool cmd)
+int sam_spi0cmddata(FAR struct spi_dev_s *dev, uint32_t devid, bool cmd)
{
#ifdef CONFIG_SAML21_XPLAINED_OLED1MODULE_EXT1
- if (devid == SPIDEV_DISPLAY)
+ if (devid == SPIDEV_DISPLAY(0))
{
/* This is the Data/Command control pad which determines whether the
* data bits are data or a command.
@@ -368,10 +368,10 @@ int sam_spi0cmddata(FAR struct spi_dev_s *dev, enum spi_dev_e devid, bool cmd)
#endif
#ifdef SAMDL_HAVE_SPI1
-int sam_spi1cmddata(FAR struct spi_dev_s *dev, enum spi_dev_e devid, bool cmd)
+int sam_spi1cmddata(FAR struct spi_dev_s *dev, uint32_t devid, bool cmd)
{
#ifdef CONFIG_SAML21_XPLAINED_OLED1MODULE_EXT2
- if (devid == SPIDEV_DISPLAY)
+ if (devid == SPIDEV_DISPLAY(0))
{
/* This is the Data/Command control pad which determines whether the
* data bits are data or a command.
@@ -389,28 +389,28 @@ int sam_spi1cmddata(FAR struct spi_dev_s *dev, enum spi_dev_e devid, bool cmd)
#endif
#ifdef SAMDL_HAVE_SPI2
-int sam_spi2cmddata(FAR struct spi_dev_s *dev, enum spi_dev_e devid, bool cmd)
+int sam_spi2cmddata(FAR struct spi_dev_s *dev, uint32_t devid, bool cmd)
{
return OK;
}
#endif
#ifdef SAMDL_HAVE_SPI3
-int sam_spi3cmddata(FAR struct spi_dev_s *dev, enum spi_dev_e devid, bool cmd)
+int sam_spi3cmddata(FAR struct spi_dev_s *dev, uint32_t devid, bool cmd)
{
return OK;
}
#endif
#ifdef SAMDL_HAVE_SPI4
-int sam_spi4cmddata(FAR struct spi_dev_s *dev, enum spi_dev_e devid, bool cmd)
+int sam_spi4cmddata(FAR struct spi_dev_s *dev, uint32_t devid, bool cmd)
{
return OK;
}
#endif
#ifdef SAMDL_HAVE_SPI5
-int sam_spi5cmddata(FAR struct spi_dev_s *dev, enum spi_dev_e devid, bool cmd)
+int sam_spi5cmddata(FAR struct spi_dev_s *dev, uint32_t devid, bool cmd)
{
return OK;
}
diff --git a/configs/samv71-xult/src/sam_spi.c b/configs/samv71-xult/src/sam_spi.c
index 58a4d30e24..eb39246e70 100644
--- a/configs/samv71-xult/src/sam_spi.c
+++ b/configs/samv71-xult/src/sam_spi.c
@@ -141,13 +141,13 @@ void sam_spidev_initialize(void)
****************************************************************************/
#ifdef CONFIG_SAMV7_SPI0_MASTER
-void sam_spi0select(enum spi_dev_e devid, bool selected)
+void sam_spi0select(uint32_t devid, bool selected)
{
}
#endif
#ifdef CONFIG_SAMV7_SPI1_MASTER
-void sam_spi1select(enum spi_dev_e devid, bool selected)
+void sam_spi1select(uint32_t devid, bool selected)
{
}
#endif
@@ -167,14 +167,14 @@ void sam_spi1select(enum spi_dev_e devid, bool selected)
****************************************************************************/
#ifdef CONFIG_SAMV7_SPI0_MASTER
-uint8_t sam_spi0status(FAR struct spi_dev_s *dev, enum spi_dev_e devid)
+uint8_t sam_spi0status(FAR struct spi_dev_s *dev, uint32_t devid)
{
return 0;
}
#endif
#ifdef CONFIG_SAMV7_SPI1_MASTER
-uint8_t sam_spi1status(FAR struct spi_dev_s *dev, enum spi_dev_e devid)
+uint8_t sam_spi1status(FAR struct spi_dev_s *dev, uint32_t devid)
{
return 0;
}
diff --git a/configs/shenzhou/src/stm32_spi.c b/configs/shenzhou/src/stm32_spi.c
index 1f6a45ed81..6aeee5018b 100644
--- a/configs/shenzhou/src/stm32_spi.c
+++ b/configs/shenzhou/src/stm32_spi.c
@@ -117,19 +117,19 @@ void weak_function stm32_spidev_initialize(void)
****************************************************************************/
#ifdef CONFIG_STM32_SPI1
-void stm32_spi1select(FAR struct spi_dev_s *dev, enum spi_dev_e devid, bool selected)
+void stm32_spi1select(FAR struct spi_dev_s *dev, uint32_t devid, bool selected)
{
spiinfo("devid: %d CS: %s\n", (int)devid, selected ? "assert" : "de-assert");
/* SPI1 connects to the SD CARD and to the SPI FLASH */
- if (devid == SPIDEV_MMCSD)
+ if (devid == SPIDEV_MMCSD(0))
{
/* Set the GPIO low to select and high to de-select */
stm32_gpiowrite(GPIO_SD_CS, !selected);
}
- else if (devid == SPIDEV_FLASH)
+ else if (devid == SPIDEV_FLASH(0))
{
/* Set the GPIO low to select and high to de-select */
@@ -137,7 +137,7 @@ void stm32_spi1select(FAR struct spi_dev_s *dev, enum spi_dev_e devid, bool sele
}
}
-uint8_t stm32_spi1status(FAR struct spi_dev_s *dev, enum spi_dev_e devid)
+uint8_t stm32_spi1status(FAR struct spi_dev_s *dev, uint32_t devid)
{
/* The card detect pin is pulled up so that we detect the presence of a card
* by see a low value on the input pin.
@@ -153,7 +153,7 @@ uint8_t stm32_spi1status(FAR struct spi_dev_s *dev, enum spi_dev_e devid)
#endif
#ifdef CONFIG_STM32_SPI3
-void stm32_spi3select(FAR struct spi_dev_s *dev, enum spi_dev_e devid, bool selected)
+void stm32_spi3select(FAR struct spi_dev_s *dev, uint32_t devid, bool selected)
{
spiinfo("devid: %d CS: %s\n", (int)devid, selected ? "assert" : "de-assert");
@@ -161,25 +161,25 @@ void stm32_spi3select(FAR struct spi_dev_s *dev, enum spi_dev_e devid, bool sele
* wireless module.
*/
- if (devid == SPIDEV_TOUCHSCREEN)
+ if (devid == SPIDEV_TOUCHSCREEN(0))
{
/* Set the GPIO low to select and high to de-select */
stm32_gpiowrite(GPIO_TP_CS, !selected);
}
- else if (devid == SPIDEV_MMCSD)
+ else if (devid == SPIDEV_MMCSD(0))
{
/* Set the GPIO low to select and high to de-select */
stm32_gpiowrite(GPIO_LCDDF_CS, !selected);
}
- else if (devid == SPIDEV_FLASH)
+ else if (devid == SPIDEV_FLASH(0))
{
/* Set the GPIO low to select and high to de-select */
stm32_gpiowrite(GPIO_LCDSD_CS, !selected);
}
- else if (devid == SPIDEV_WIRELESS)
+ else if (devid == SPIDEV_WIRELESS(0))
{
/* Set the GPIO low to select and high to de-select */
@@ -187,7 +187,7 @@ void stm32_spi3select(FAR struct spi_dev_s *dev, enum spi_dev_e devid, bool sele
}
}
-uint8_t stm32_spi3status(FAR struct spi_dev_s *dev, enum spi_dev_e devid)
+uint8_t stm32_spi3status(FAR struct spi_dev_s *dev, uint32_t devid)
{
return 0;
}
diff --git a/configs/spark/src/stm32_cc3000.c b/configs/spark/src/stm32_cc3000.c
index 7f384213e4..92d255d6d9 100644
--- a/configs/spark/src/stm32_cc3000.c
+++ b/configs/spark/src/stm32_cc3000.c
@@ -47,7 +47,6 @@
#include
#include
-#include
#include
#include
diff --git a/configs/spark/src/stm32_spi.c b/configs/spark/src/stm32_spi.c
index f631052d31..8002196d86 100644
--- a/configs/spark/src/stm32_spi.c
+++ b/configs/spark/src/stm32_spi.c
@@ -116,25 +116,25 @@ void weak_function stm32_spidev_initialize(void)
****************************************************************************/
#ifdef CONFIG_STM32_SPI1
-void stm32_spi1select(FAR struct spi_dev_s *dev, enum spi_dev_e devid, bool selected)
+void stm32_spi1select(FAR struct spi_dev_s *dev, uint32_t devid, bool selected)
{
spiinfo("devid: %d CS: %s\n", (int)devid, selected ? "assert" : "de-assert");
}
-uint8_t stm32_spi1status(FAR struct spi_dev_s *dev, enum spi_dev_e devid)
+uint8_t stm32_spi1status(FAR struct spi_dev_s *dev, uint32_t devid)
{
return 0;
}
#endif
#ifdef CONFIG_STM32_SPI2
-void stm32_spi2select(FAR struct spi_dev_s *dev, enum spi_dev_e devid, bool selected)
+void stm32_spi2select(FAR struct spi_dev_s *dev, uint32_t devid, bool selected)
{
spiinfo("devid: %d CS: %s\n", (int)devid, selected ? "assert" : "de-assert");
#if defined(CONFIG_MTD_SST25)
- if (devid == SPIDEV_FLASH)
+ if (devid == SPIDEV_FLASH(0))
{
stm32_gpiowrite(GPIO_MEM_CS, !selected);
}
@@ -144,27 +144,27 @@ void stm32_spi2select(FAR struct spi_dev_s *dev, enum spi_dev_e devid, bool sele
#endif
#if defined(CONFIG_WL_CC3000)
- if (devid == SPIDEV_WIRELESS)
+ if (devid == SPIDEV_WIRELESS(0))
{
stm32_gpiowrite(GPIO_WIFI_CS, !selected);
}
#endif
}
-uint8_t stm32_spi2status(FAR struct spi_dev_s *dev, enum spi_dev_e devid)
+uint8_t stm32_spi2status(FAR struct spi_dev_s *dev, uint32_t devid)
{
return 0;
}
#endif
#ifdef CONFIG_STM32_SPI3
-void stm32_spi3select(FAR struct spi_dev_s *dev, enum spi_dev_e devid, bool selected)
+void stm32_spi3select(FAR struct spi_dev_s *dev, uint32_t devid, bool selected)
spiinfo("devid: %d CS: %s\n", (int)devid, selected ? "assert" : "de-assert");
}
-uint8_t stm32_spi3status(FAR struct spi_dev_s *dev, enum spi_dev_e devid)
+uint8_t stm32_spi3status(FAR struct spi_dev_s *dev, uint32_t devid)
{
return 0;
}
@@ -195,21 +195,21 @@ uint8_t stm32_spi3status(FAR struct spi_dev_s *dev, enum spi_dev_e devid)
#ifdef CONFIG_SPI_CMDDATA
#ifdef CONFIG_STM32_SPI1
-int stm32_spi1cmddata(FAR struct spi_dev_s *dev, enum spi_dev_e devid, bool cmd)
+int stm32_spi1cmddata(FAR struct spi_dev_s *dev, uint32_t devid, bool cmd)
{
return -ENODEV;
}
#endif
#ifdef CONFIG_STM32_SPI2
-int stm32_spi2cmddata(FAR struct spi_dev_s *dev, enum spi_dev_e devid, bool cmd)
+int stm32_spi2cmddata(FAR struct spi_dev_s *dev, uint32_t devid, bool cmd)
{
return OK;
}
#endif
#ifdef CONFIG_STM32_SPI3
-int stm32_spi3cmddata(FAR struct spi_dev_s *dev, enum spi_dev_e devid, bool cmd)
+int stm32_spi3cmddata(FAR struct spi_dev_s *dev, uint32_t devid, bool cmd)
{
return OK;
}
diff --git a/configs/stm3210e-eval/src/stm32_spi.c b/configs/stm3210e-eval/src/stm32_spi.c
index 4df6531cef..05c0bdc292 100644
--- a/configs/stm3210e-eval/src/stm32_spi.c
+++ b/configs/stm3210e-eval/src/stm32_spi.c
@@ -106,11 +106,11 @@ void weak_function stm32_spidev_initialize(void)
****************************************************************************/
#ifdef CONFIG_STM32_SPI1
-void stm32_spi1select(FAR struct spi_dev_s *dev, enum spi_dev_e devid, bool selected)
+void stm32_spi1select(FAR struct spi_dev_s *dev, uint32_t devid, bool selected)
{
spiinfo("devid: %d CS: %s\n", (int)devid, selected ? "assert" : "de-assert");
- if (devid == SPIDEV_FLASH)
+ if (devid == SPIDEV_FLASH(0))
{
/* Set the GPIO low to select and high to de-select */
@@ -118,31 +118,31 @@ void stm32_spi1select(FAR struct spi_dev_s *dev, enum spi_dev_e devid, bool sele
}
}
-uint8_t stm32_spi1status(FAR struct spi_dev_s *dev, enum spi_dev_e devid)
+uint8_t stm32_spi1status(FAR struct spi_dev_s *dev, uint32_t devid)
{
return SPI_STATUS_PRESENT;
}
#endif
#ifdef CONFIG_STM32_SPI2
-void stm32_spi2select(FAR struct spi_dev_s *dev, enum spi_dev_e devid, bool selected)
+void stm32_spi2select(FAR struct spi_dev_s *dev, uint32_t devid, bool selected)
{
spiinfo("devid: %d CS: %s\n", (int)devid, selected ? "assert" : "de-assert");
}
-uint8_t stm32_spi2status(FAR struct spi_dev_s *dev, enum spi_dev_e devid)
+uint8_t stm32_spi2status(FAR struct spi_dev_s *dev, uint32_t devid)
{
return SPI_STATUS_PRESENT;
}
#endif
#ifdef CONFIG_STM32_SPI3
-void stm32_spi3select(FAR struct spi_dev_s *dev, enum spi_dev_e devid, bool selected)
+void stm32_spi3select(FAR struct spi_dev_s *dev, uint32_t devid, bool selected)
{
spiinfo("devid: %d CS: %s\n", (int)devid, selected ? "assert" : "de-assert");
}
-uint8_t stm32_spi3status(FAR struct spi_dev_s *dev, enum spi_dev_e devid)
+uint8_t stm32_spi3status(FAR struct spi_dev_s *dev, uint32_t devid)
{
return SPI_STATUS_PRESENT;
}
diff --git a/configs/stm3220g-eval/src/stm32_spi.c b/configs/stm3220g-eval/src/stm32_spi.c
index 9e171b9bfa..1e806fb2bc 100644
--- a/configs/stm3220g-eval/src/stm32_spi.c
+++ b/configs/stm3220g-eval/src/stm32_spi.c
@@ -96,36 +96,36 @@ void weak_function stm32_spidev_initialize(void)
****************************************************************************/
#ifdef CONFIG_STM32_SPI1
-void stm32_spi1select(FAR struct spi_dev_s *dev, enum spi_dev_e devid, bool selected)
+void stm32_spi1select(FAR struct spi_dev_s *dev, uint32_t devid, bool selected)
{
spiinfo("devid: %d CS: %s\n", (int)devid, selected ? "assert" : "de-assert");
}
-uint8_t stm32_spi1status(FAR struct spi_dev_s *dev, enum spi_dev_e devid)
+uint8_t stm32_spi1status(FAR struct spi_dev_s *dev, uint32_t devid)
{
return SPI_STATUS_PRESENT;
}
#endif
#ifdef CONFIG_STM32_SPI2
-void stm32_spi2select(FAR struct spi_dev_s *dev, enum spi_dev_e devid, bool selected)
+void stm32_spi2select(FAR struct spi_dev_s *dev, uint32_t devid, bool selected)
{
spiinfo("devid: %d CS: %s\n", (int)devid, selected ? "assert" : "de-assert");
}
-uint8_t stm32_spi2status(FAR struct spi_dev_s *dev, enum spi_dev_e devid)
+uint8_t stm32_spi2status(FAR struct spi_dev_s *dev, uint32_t devid)
{
return SPI_STATUS_PRESENT;
}
#endif
#ifdef CONFIG_STM32_SPI3
-void stm32_spi3select(FAR struct spi_dev_s *dev, enum spi_dev_e devid, bool selected)
+void stm32_spi3select(FAR struct spi_dev_s *dev, uint32_t devid, bool selected)
{
spiinfo("devid: %d CS: %s\n", (int)devid, selected ? "assert" : "de-assert");
}
-uint8_t stm32_spi3status(FAR struct spi_dev_s *dev, enum spi_dev_e devid)
+uint8_t stm32_spi3status(FAR struct spi_dev_s *dev, uint32_t devid)
{
return SPI_STATUS_PRESENT;
}
diff --git a/configs/stm3240g-eval/src/stm32_spi.c b/configs/stm3240g-eval/src/stm32_spi.c
index 45b7f894e1..a429ad5322 100644
--- a/configs/stm3240g-eval/src/stm32_spi.c
+++ b/configs/stm3240g-eval/src/stm32_spi.c
@@ -96,36 +96,36 @@ void weak_function stm32_spidev_initialize(void)
****************************************************************************/
#ifdef CONFIG_STM32_SPI1
-void stm32_spi1select(FAR struct spi_dev_s *dev, enum spi_dev_e devid, bool selected)
+void stm32_spi1select(FAR struct spi_dev_s *dev, uint32_t devid, bool selected)
{
spiinfo("devid: %d CS: %s\n", (int)devid, selected ? "assert" : "de-assert");
}
-uint8_t stm32_spi1status(FAR struct spi_dev_s *dev, enum spi_dev_e devid)
+uint8_t stm32_spi1status(FAR struct spi_dev_s *dev, uint32_t devid)
{
return SPI_STATUS_PRESENT;
}
#endif
#ifdef CONFIG_STM32_SPI2
-void stm32_spi2select(FAR struct spi_dev_s *dev, enum spi_dev_e devid, bool selected)
+void stm32_spi2select(FAR struct spi_dev_s *dev, uint32_t devid, bool selected)
{
spiinfo("devid: %d CS: %s\n", (int)devid, selected ? "assert" : "de-assert");
}
-uint8_t stm32_spi2status(FAR struct spi_dev_s *dev, enum spi_dev_e devid)
+uint8_t stm32_spi2status(FAR struct spi_dev_s *dev, uint32_t devid)
{
return SPI_STATUS_PRESENT;
}
#endif
#ifdef CONFIG_STM32_SPI3
-void stm32_spi3select(FAR struct spi_dev_s *dev, enum spi_dev_e devid, bool selected)
+void stm32_spi3select(FAR struct spi_dev_s *dev, uint32_t devid, bool selected)
{
spiinfo("devid: %d CS: %s\n", (int)devid, selected ? "assert" : "de-assert");
}
-uint8_t stm32_spi3status(FAR struct spi_dev_s *dev, enum spi_dev_e devid)
+uint8_t stm32_spi3status(FAR struct spi_dev_s *dev, uint32_t devid)
{
return SPI_STATUS_PRESENT;
}
diff --git a/configs/stm32_tiny/src/stm32_spi.c b/configs/stm32_tiny/src/stm32_spi.c
index ac4e3eb68e..abaac37b9e 100644
--- a/configs/stm32_tiny/src/stm32_spi.c
+++ b/configs/stm32_tiny/src/stm32_spi.c
@@ -109,23 +109,23 @@ void stm32_spidev_initialize(void)
****************************************************************************/
#ifdef CONFIG_STM32_SPI1
-void stm32_spi1select(FAR struct spi_dev_s *dev, enum spi_dev_e devid, bool selected)
+void stm32_spi1select(FAR struct spi_dev_s *dev, uint32_t devid, bool selected)
{
}
-uint8_t stm32_spi1status(FAR struct spi_dev_s *dev, enum spi_dev_e devid)
+uint8_t stm32_spi1status(FAR struct spi_dev_s *dev, uint32_t devid)
{
return 0;
}
#endif
#ifdef CONFIG_STM32_SPI2
-void stm32_spi2select(FAR struct spi_dev_s *dev, enum spi_dev_e devid, bool selected)
+void stm32_spi2select(FAR struct spi_dev_s *dev, uint32_t devid, bool selected)
{
switch(devid)
{
#ifdef CONFIG_WL_NRF24L01
- case SPIDEV_WIRELESS:
+ case SPIDEV_WIRELESS(0):
spiinfo("nRF24L01 device %s\n", selected ? "asserted" : "de-asserted");
/* Set the GPIO low to select and high to de-select */
@@ -138,13 +138,13 @@ void stm32_spi2select(FAR struct spi_dev_s *dev, enum spi_dev_e devid, bool sele
}
}
-uint8_t stm32_spi2status(FAR struct spi_dev_s *dev, enum spi_dev_e devid)
+uint8_t stm32_spi2status(FAR struct spi_dev_s *dev, uint32_t devid)
{
uint8_t status = 0;
switch(devid)
{
#ifdef CONFIG_WL_NRF24L01
- case SPIDEV_WIRELESS:
+ case SPIDEV_WIRELESS(0):
status |= SPI_STATUS_PRESENT;
break;
#endif
diff --git a/configs/stm32butterfly2/src/stm32_spi.c b/configs/stm32butterfly2/src/stm32_spi.c
index fa2fd2e762..f6817f57b0 100644
--- a/configs/stm32butterfly2/src/stm32_spi.c
+++ b/configs/stm32butterfly2/src/stm32_spi.c
@@ -73,12 +73,12 @@ void stm32_spidev_initialize(void)
* Function asserts given devid based on select
****************************************************************************/
-void stm32_spi1select(struct spi_dev_s *dev, enum spi_dev_e devid,
+void stm32_spi1select(struct spi_dev_s *dev, uint32_t devid,
bool select)
{
spiinfo("INFO: Selecting spi dev: %d, state: %d\n", devid, select);
- if (devid == SPIDEV_MMCSD)
+ if (devid == SPIDEV_MMCSD(0))
{
stm32_gpiowrite(GPIO_SD_CS, !select);
}
@@ -91,11 +91,11 @@ void stm32_spi1select(struct spi_dev_s *dev, enum spi_dev_e devid,
* Return status of devid
****************************************************************************/
-uint8_t stm32_spi1status(struct spi_dev_s *dev, enum spi_dev_e devid)
+uint8_t stm32_spi1status(struct spi_dev_s *dev, uint32_t devid)
{
spiinfo("INFO: Requesting info from spi dev: %d\n", devid);
- if (devid == SPIDEV_MMCSD)
+ if (devid == SPIDEV_MMCSD(0))
{
if (stm32_gpioread(GPIO_SD_CD) == 0)
{
diff --git a/configs/stm32f103-minimum/src/Makefile b/configs/stm32f103-minimum/src/Makefile
index 75b6cb2953..8402e553ea 100644
--- a/configs/stm32f103-minimum/src/Makefile
+++ b/configs/stm32f103-minimum/src/Makefile
@@ -86,7 +86,7 @@ CSRCS += stm32_veml6070.c
endif
ifeq ($(CONFIG_WL_NRF24L01),y)
-CSRCS += stm32_cc3000.c
+CSRCS += stm32_nrf24l01.c
endif
ifeq ($(CONFIG_USBDEV),y)
diff --git a/configs/stm32f103-minimum/src/stm32_cc3000.c b/configs/stm32f103-minimum/src/stm32_nrf24l01.c
similarity index 95%
rename from configs/stm32f103-minimum/src/stm32_cc3000.c
rename to configs/stm32f103-minimum/src/stm32_nrf24l01.c
index 23b1144ef5..6edecba0e0 100644
--- a/configs/stm32f103-minimum/src/stm32_cc3000.c
+++ b/configs/stm32f103-minimum/src/stm32_nrf24l01.c
@@ -1,5 +1,5 @@
/************************************************************************************
- * configs/stm32f103-minimum//src/stm32_cc3000.c
+ * configs/stm32f103-minimum//src/stm32_nrf24l01.c
*
* Copyright (C) 2017 Gregory Nutt. All rights reserved.
* Author: Laurent Latil
@@ -82,7 +82,7 @@ static FAR void *g_arg;
static int stm32tiny_wl_irq_attach(xcpt_t isr, FAR void *arg)
{
- winfo("Attach IRQ\n");
+ wlinfo("Attach IRQ\n");
g_isr = isr;
g_arg = arg;
(void)stm32_gpiosetevent(GPIO_NRF24L01_IRQ, false, true, false, g_isr, g_arg);
@@ -91,7 +91,7 @@ static int stm32tiny_wl_irq_attach(xcpt_t isr, FAR void *arg)
static void stm32tiny_wl_chip_enable(bool enable)
{
- winfo("CE:%d\n", enable);
+ wlinfo("CE:%d\n", enable);
stm32_gpiowrite(GPIO_NRF24L01_CE, enable);
}
@@ -132,14 +132,14 @@ void stm32_wlinitialize(void)
spidev = stm32_spibus_initialize(1);
if (!spidev)
{
- werr("ERROR: Failed to initialize SPI bus\n");
+ wlerr("ERROR: Failed to initialize SPI bus\n");
return;
}
result = nrf24l01_register(spidev, &nrf_cfg);
if (result != OK)
{
- werr("ERROR: Failed to register initialize SPI bus\n");
+ wlerr("ERROR: Failed to register initialize SPI bus\n");
return;
}
}
diff --git a/configs/stm32f103-minimum/src/stm32_spi.c b/configs/stm32f103-minimum/src/stm32_spi.c
index 2d24b7aa3d..0ba7df49d3 100644
--- a/configs/stm32f103-minimum/src/stm32_spi.c
+++ b/configs/stm32f103-minimum/src/stm32_spi.c
@@ -117,51 +117,51 @@ void stm32_spidev_initialize(void)
****************************************************************************/
#ifdef CONFIG_STM32_SPI1
-void stm32_spi1select(FAR struct spi_dev_s *dev, enum spi_dev_e devid,
+void stm32_spi1select(FAR struct spi_dev_s *dev, uint32_t devid,
bool selected)
{
#if defined(CONFIG_CL_MFRC522)
- if (devid == SPIDEV_WIRELESS)
+ if (devid == SPIDEV_WIRELESS(0))
{
stm32_gpiowrite(GPIO_CS_MFRC522, !selected);
}
#endif
#ifdef CONFIG_LCD_ST7567
- if (devid == SPIDEV_DISPLAY)
+ if (devid == SPIDEV_DISPLAY(0))
{
stm32_gpiowrite(GPIO_CS_MFRC522, !selected);
}
#endif
#ifdef CONFIG_WL_NRF24L01
- if (devid == SPIDEV_WIRELESS)
+ if (devid == SPIDEV_WIRELESS(0))
{
stm32_gpiowrite(GPIO_NRF24L01_CS, !selected);
}
#endif
#ifdef CONFIG_MMCSD_SPI
- if (devid == SPIDEV_MMCSD)
+ if (devid == SPIDEV_MMCSD(0))
{
stm32_gpiowrite(GPIO_SDCARD_CS, !selected);
}
#endif
}
-uint8_t stm32_spi1status(FAR struct spi_dev_s *dev, enum spi_dev_e devid)
+uint8_t stm32_spi1status(FAR struct spi_dev_s *dev, uint32_t devid)
{
uint8_t status = 0;
#ifdef CONFIG_WL_NRF24L01
- if (devid == SPIDEV_WIRELESS)
+ if (devid == SPIDEV_WIRELESS(0))
{
status |= SPI_STATUS_PRESENT;
}
#endif
#ifdef CONFIG_MMCSD_SPI
- if (devid == SPIDEV_MMCSD)
+ if (devid == SPIDEV_MMCSD(0))
{
status |= SPI_STATUS_PRESENT;
}
@@ -172,12 +172,12 @@ uint8_t stm32_spi1status(FAR struct spi_dev_s *dev, enum spi_dev_e devid)
#endif
#ifdef CONFIG_STM32_SPI2
-void stm32_spi2select(FAR struct spi_dev_s *dev, enum spi_dev_e devid,
+void stm32_spi2select(FAR struct spi_dev_s *dev, uint32_t devid,
bool selected)
{
}
-uint8_t stm32_spi2status(FAR struct spi_dev_s *dev, enum spi_dev_e devid)
+uint8_t stm32_spi2status(FAR struct spi_dev_s *dev, uint32_t devid)
{
return 0;
}
@@ -209,11 +209,11 @@ uint8_t stm32_spi2status(FAR struct spi_dev_s *dev, enum spi_dev_e devid)
#ifdef CONFIG_SPI_CMDDATA
#ifdef CONFIG_STM32_SPI1
-int stm32_spi1cmddata(FAR struct spi_dev_s *dev, enum spi_dev_e devid,
+int stm32_spi1cmddata(FAR struct spi_dev_s *dev, uint32_t devid,
bool cmd)
{
#ifdef CONFIG_LCD_ST7567
- if (devid == SPIDEV_DISPLAY)
+ if (devid == SPIDEV_DISPLAY(0))
{
/* This is the Data/Command control pad which determines whether the
* data bits are data or a command.
diff --git a/configs/stm32f3discovery/src/stm32_spi.c b/configs/stm32f3discovery/src/stm32_spi.c
index 712db25d2d..c9edb6052e 100644
--- a/configs/stm32f3discovery/src/stm32_spi.c
+++ b/configs/stm32f3discovery/src/stm32_spi.c
@@ -101,38 +101,38 @@ void weak_function stm32_spidev_initialize(void)
****************************************************************************/
#ifdef CONFIG_STM32_SPI1
-void stm32_spi1select(FAR struct spi_dev_s *dev, enum spi_dev_e devid, bool selected)
+void stm32_spi1select(FAR struct spi_dev_s *dev, uint32_t devid, bool selected)
{
spiinfo("devid: %d CS: %s\n", (int)devid, selected ? "assert" : "de-assert");
stm32_gpiowrite(GPIO_MEMS_CS, !selected);
}
-uint8_t stm32_spi1status(FAR struct spi_dev_s *dev, enum spi_dev_e devid)
+uint8_t stm32_spi1status(FAR struct spi_dev_s *dev, uint32_t devid)
{
return 0;
}
#endif
#ifdef CONFIG_STM32_SPI2
-void stm32_spi2select(FAR struct spi_dev_s *dev, enum spi_dev_e devid, bool selected)
+void stm32_spi2select(FAR struct spi_dev_s *dev, uint32_t devid, bool selected)
{
spiinfo("devid: %d CS: %s\n", (int)devid, selected ? "assert" : "de-assert");
}
-uint8_t stm32_spi2status(FAR struct spi_dev_s *dev, enum spi_dev_e devid)
+uint8_t stm32_spi2status(FAR struct spi_dev_s *dev, uint32_t devid)
{
return 0;
}
#endif
#ifdef CONFIG_STM32_SPI3
-void stm32_spi3select(FAR struct spi_dev_s *dev, enum spi_dev_e devid, bool selected)
+void stm32_spi3select(FAR struct spi_dev_s *dev, uint32_t devid, bool selected)
{
spiinfo("devid: %d CS: %s\n", (int)devid, selected ? "assert" : "de-assert");
}
-uint8_t stm32_spi3status(FAR struct spi_dev_s *dev, enum spi_dev_e devid)
+uint8_t stm32_spi3status(FAR struct spi_dev_s *dev, uint32_t devid)
{
return 0;
}
@@ -163,21 +163,21 @@ uint8_t stm32_spi3status(FAR struct spi_dev_s *dev, enum spi_dev_e devid)
#ifdef CONFIG_SPI_CMDDATA
#ifdef CONFIG_STM32_SPI1
-int stm32_spi1cmddata(FAR struct spi_dev_s *dev, enum spi_dev_e devid, bool cmd)
+int stm32_spi1cmddata(FAR struct spi_dev_s *dev, uint32_t devid, bool cmd)
{
return -ENODEV;
}
#endif
#ifdef CONFIG_STM32_SPI2
-int stm32_spi2cmddata(FAR struct spi_dev_s *dev, enum spi_dev_e devid, bool cmd)
+int stm32_spi2cmddata(FAR struct spi_dev_s *dev, uint32_t devid, bool cmd)
{
return -ENODEV;
}
#endif
#ifdef CONFIG_STM32_SPI3
-int stm32_spi3cmddata(FAR struct spi_dev_s *dev, enum spi_dev_e devid, bool cmd)
+int stm32_spi3cmddata(FAR struct spi_dev_s *dev, uint32_t devid, bool cmd)
{
return -ENODEV;
}
diff --git a/configs/stm32f429i-disco/src/stm32_ili93414ws.c b/configs/stm32f429i-disco/src/stm32_ili93414ws.c
index 7948c03595..53cf63327e 100644
--- a/configs/stm32f429i-disco/src/stm32_ili93414ws.c
+++ b/configs/stm32f429i-disco/src/stm32_ili93414ws.c
@@ -855,7 +855,7 @@ static inline void stm32_ili93414ws_cmddata(
{
FAR struct ili93414ws_lcd_s *priv = (FAR struct ili93414ws_lcd_s *)lcd;
- SPI_CMDDATA(priv->spi, SPIDEV_DISPLAY, cmd);
+ SPI_CMDDATA(priv->spi, SPIDEV_DISPLAY(0), cmd);
}
#else
static inline void stm32_ili93414ws_cmddata(
@@ -912,7 +912,7 @@ static void stm32_ili93414ws_select(FAR struct ili9341_lcd_s *lcd)
*/
SPI_LOCK(priv->spi, true);
- SPI_SELECT(priv->spi, SPIDEV_DISPLAY, true);
+ SPI_SELECT(priv->spi, SPIDEV_DISPLAY(0), true);
/* Configure spi and disable */
@@ -971,7 +971,7 @@ static void stm32_ili93414ws_deselect(FAR struct ili9341_lcd_s *lcd)
/* de-select ili9341 and relinquish the spi bus. */
- SPI_SELECT(priv->spi, SPIDEV_DISPLAY, false);
+ SPI_SELECT(priv->spi, SPIDEV_DISPLAY(0), false);
SPI_LOCK(priv->spi, false);
}
#else
diff --git a/configs/stm32f429i-disco/src/stm32_l3gd20.c b/configs/stm32f429i-disco/src/stm32_l3gd20.c
index 4cdc0a896e..7a8c449c62 100644
--- a/configs/stm32f429i-disco/src/stm32_l3gd20.c
+++ b/configs/stm32f429i-disco/src/stm32_l3gd20.c
@@ -71,7 +71,7 @@ static struct l3gd20_config_s g_l3gd20_config =
{
.attach = l3gd20_attach,
.irq = L3GD20_IRQ,
- .spi_devid = SPIDEV_ACCELEROMETER
+ .spi_devid = SPIDEV_ACCELEROMETER(0)
};
/****************************************************************************
diff --git a/configs/stm32f429i-disco/src/stm32_spi.c b/configs/stm32f429i-disco/src/stm32_spi.c
index 69d2de2997..16a23cc564 100644
--- a/configs/stm32f429i-disco/src/stm32_spi.c
+++ b/configs/stm32f429i-disco/src/stm32_spi.c
@@ -115,65 +115,65 @@ void weak_function stm32_spidev_initialize(void)
****************************************************************************/
#ifdef CONFIG_STM32_SPI1
-void stm32_spi1select(FAR struct spi_dev_s *dev, enum spi_dev_e devid, bool selected)
+void stm32_spi1select(FAR struct spi_dev_s *dev, uint32_t devid, bool selected)
{
spiinfo("devid: %d CS: %s\n", (int)devid, selected ? "assert" : "de-assert");
}
-uint8_t stm32_spi1status(FAR struct spi_dev_s *dev, enum spi_dev_e devid)
+uint8_t stm32_spi1status(FAR struct spi_dev_s *dev, uint32_t devid)
{
return 0;
}
#endif
#ifdef CONFIG_STM32_SPI2
-void stm32_spi2select(FAR struct spi_dev_s *dev, enum spi_dev_e devid, bool selected)
+void stm32_spi2select(FAR struct spi_dev_s *dev, uint32_t devid, bool selected)
{
spiinfo("devid: %d CS: %s\n", (int)devid, selected ? "assert" : "de-assert");
}
-uint8_t stm32_spi2status(FAR struct spi_dev_s *dev, enum spi_dev_e devid)
+uint8_t stm32_spi2status(FAR struct spi_dev_s *dev, uint32_t devid)
{
return 0;
}
#endif
#ifdef CONFIG_STM32_SPI3
-void stm32_spi3select(FAR struct spi_dev_s *dev, enum spi_dev_e devid, bool selected)
+void stm32_spi3select(FAR struct spi_dev_s *dev, uint32_t devid, bool selected)
{
spiinfo("devid: %d CS: %s\n", (int)devid, selected ? "assert" : "de-assert");
}
-uint8_t stm32_spi3status(FAR struct spi_dev_s *dev, enum spi_dev_e devid)
+uint8_t stm32_spi3status(FAR struct spi_dev_s *dev, uint32_t devid)
{
return 0;
}
#endif
#ifdef CONFIG_STM32_SPI4
-void stm32_spi4select(FAR struct spi_dev_s *dev, enum spi_dev_e devid, bool selected)
+void stm32_spi4select(FAR struct spi_dev_s *dev, uint32_t devid, bool selected)
{
#if defined(CONFIG_MTD_SST25XX)
- if (devid == SPIDEV_FLASH)
+ if (devid == SPIDEV_FLASH(0))
{
stm32_gpiowrite(GPIO_CS_SST25, !selected);
}
#endif
}
-uint8_t stm32_spi4status(FAR struct spi_dev_s *dev, enum spi_dev_e devid)
+uint8_t stm32_spi4status(FAR struct spi_dev_s *dev, uint32_t devid)
{
return 0;
}
#endif
#ifdef CONFIG_STM32_SPI5
-void stm32_spi5select(FAR struct spi_dev_s *dev, enum spi_dev_e devid, bool selected)
+void stm32_spi5select(FAR struct spi_dev_s *dev, uint32_t devid, bool selected)
{
spiinfo("devid: %d CS: %s\n", (int)devid, selected ? "assert" : "de-assert");
#if defined(CONFIG_STM32F429I_DISCO_ILI9341)
- if (devid == SPIDEV_DISPLAY)
+ if (devid == SPIDEV_DISPLAY(0))
{
stm32_gpiowrite(GPIO_CS_LCD, !selected);
}
@@ -185,7 +185,7 @@ void stm32_spi5select(FAR struct spi_dev_s *dev, enum spi_dev_e devid, bool sele
}
}
-uint8_t stm32_spi5status(FAR struct spi_dev_s *dev, enum spi_dev_e devid)
+uint8_t stm32_spi5status(FAR struct spi_dev_s *dev, uint32_t devid)
{
return 0;
}
@@ -216,38 +216,38 @@ uint8_t stm32_spi5status(FAR struct spi_dev_s *dev, enum spi_dev_e devid)
#ifdef CONFIG_SPI_CMDDATA
#ifdef CONFIG_STM32_SPI1
-int stm32_spi1cmddata(FAR struct spi_dev_s *dev, enum spi_dev_e devid, bool cmd)
+int stm32_spi1cmddata(FAR struct spi_dev_s *dev, uint32_t devid, bool cmd)
{
return -ENODEV;
}
#endif
#ifdef CONFIG_STM32_SPI2
-int stm32_spi2cmddata(FAR struct spi_dev_s *dev, enum spi_dev_e devid, bool cmd)
+int stm32_spi2cmddata(FAR struct spi_dev_s *dev, uint32_t devid, bool cmd)
{
return -ENODEV;
}
#endif
#ifdef CONFIG_STM32_SPI3
-int stm32_spi3cmddata(FAR struct spi_dev_s *dev, enum spi_dev_e devid, bool cmd)
+int stm32_spi3cmddata(FAR struct spi_dev_s *dev, uint32_t devid, bool cmd)
{
return -ENODEV;
}
#endif
#ifdef CONFIG_STM32_SPI4
-int stm32_spi4cmddata(FAR struct spi_dev_s *dev, enum spi_dev_e devid, bool cmd)
+int stm32_spi4cmddata(FAR struct spi_dev_s *dev, uint32_t devid, bool cmd)
{
return -ENODEV;
}
#endif
#ifdef CONFIG_STM32_SPI5
-int stm32_spi5cmddata(FAR struct spi_dev_s *dev, enum spi_dev_e devid, bool cmd)
+int stm32_spi5cmddata(FAR struct spi_dev_s *dev, uint32_t devid, bool cmd)
{
#if defined(CONFIG_STM32F429I_DISCO_ILI9341)
- if (devid == SPIDEV_DISPLAY)
+ if (devid == SPIDEV_DISPLAY(0))
{
/* This is the Data/Command control pad which determines whether the
* data bits are data or a command.
diff --git a/configs/stm32f4discovery/src/stm32_spi.c b/configs/stm32f4discovery/src/stm32_spi.c
index c6d7506fc1..c343520e88 100644
--- a/configs/stm32f4discovery/src/stm32_spi.c
+++ b/configs/stm32f4discovery/src/stm32_spi.c
@@ -116,13 +116,13 @@ void weak_function stm32_spidev_initialize(void)
****************************************************************************/
#ifdef CONFIG_STM32_SPI1
-void stm32_spi1select(FAR struct spi_dev_s *dev, enum spi_dev_e devid, bool selected)
+void stm32_spi1select(FAR struct spi_dev_s *dev, uint32_t devid, bool selected)
{
spiinfo("devid: %d CS: %s\n", (int)devid, selected ? "assert" : "de-assert");
#if defined(CONFIG_LCD_UG2864AMBAG01) || defined(CONFIG_LCD_UG2864HSWEG01) || \
defined(CONFIG_LCD_SSD1351)
- if (devid == SPIDEV_DISPLAY)
+ if (devid == SPIDEV_DISPLAY(0))
{
stm32_gpiowrite(GPIO_OLED_CS, !selected);
}
@@ -133,44 +133,44 @@ void stm32_spi1select(FAR struct spi_dev_s *dev, enum spi_dev_e devid, bool sele
}
}
-uint8_t stm32_spi1status(FAR struct spi_dev_s *dev, enum spi_dev_e devid)
+uint8_t stm32_spi1status(FAR struct spi_dev_s *dev, uint32_t devid)
{
return 0;
}
#endif
#ifdef CONFIG_STM32_SPI2
-void stm32_spi2select(FAR struct spi_dev_s *dev, enum spi_dev_e devid, bool selected)
+void stm32_spi2select(FAR struct spi_dev_s *dev, uint32_t devid, bool selected)
{
spiinfo("devid: %d CS: %s\n", (int)devid, selected ? "assert" : "de-assert");
#if defined(CONFIG_MAX31855)
- if (devid == SPIDEV_TEMPERATURE)
+ if (devid == SPIDEV_TEMPERATURE(0))
{
stm32_gpiowrite(GPIO_MAX31855_CS, !selected);
}
#endif
#if defined(CONFIG_MAX6675)
- if (devid == SPIDEV_TEMPERATURE)
+ if (devid == SPIDEV_TEMPERATURE(0))
{
stm32_gpiowrite(GPIO_MAX6675_CS, !selected);
}
#endif
}
-uint8_t stm32_spi2status(FAR struct spi_dev_s *dev, enum spi_dev_e devid)
+uint8_t stm32_spi2status(FAR struct spi_dev_s *dev, uint32_t devid)
{
return 0;
}
#endif
#ifdef CONFIG_STM32_SPI3
-void stm32_spi3select(FAR struct spi_dev_s *dev, enum spi_dev_e devid, bool selected)
+void stm32_spi3select(FAR struct spi_dev_s *dev, uint32_t devid, bool selected)
{
spiinfo("devid: %d CS: %s\n", (int)devid, selected ? "assert" : "de-assert");
}
-uint8_t stm32_spi3status(FAR struct spi_dev_s *dev, enum spi_dev_e devid)
+uint8_t stm32_spi3status(FAR struct spi_dev_s *dev, uint32_t devid)
{
return 0;
}
@@ -201,11 +201,11 @@ uint8_t stm32_spi3status(FAR struct spi_dev_s *dev, enum spi_dev_e devid)
#ifdef CONFIG_SPI_CMDDATA
#ifdef CONFIG_STM32_SPI1
-int stm32_spi1cmddata(FAR struct spi_dev_s *dev, enum spi_dev_e devid, bool cmd)
+int stm32_spi1cmddata(FAR struct spi_dev_s *dev, uint32_t devid, bool cmd)
{
#if defined(CONFIG_LCD_UG2864AMBAG01) || defined(CONFIG_LCD_UG2864HSWEG01) || \
defined(CONFIG_LCD_SSD1351)
- if (devid == SPIDEV_DISPLAY)
+ if (devid == SPIDEV_DISPLAY(0))
{
/* "This is the Data/Command control pad which determines whether the
* data bits are data or a command.
@@ -230,14 +230,14 @@ int stm32_spi1cmddata(FAR struct spi_dev_s *dev, enum spi_dev_e devid, bool cmd)
#endif
#ifdef CONFIG_STM32_SPI2
-int stm32_spi2cmddata(FAR struct spi_dev_s *dev, enum spi_dev_e devid, bool cmd)
+int stm32_spi2cmddata(FAR struct spi_dev_s *dev, uint32_t devid, bool cmd)
{
return -ENODEV;
}
#endif
#ifdef CONFIG_STM32_SPI3
-int stm32_spi3cmddata(FAR struct spi_dev_s *dev, enum spi_dev_e devid, bool cmd)
+int stm32_spi3cmddata(FAR struct spi_dev_s *dev, uint32_t devid, bool cmd)
{
return -ENODEV;
}
diff --git a/configs/stm32f746-ws/src/stm32_spi.c b/configs/stm32f746-ws/src/stm32_spi.c
index 517ea3761b..196b8c1e24 100644
--- a/configs/stm32f746-ws/src/stm32_spi.c
+++ b/configs/stm32f746-ws/src/stm32_spi.c
@@ -99,72 +99,72 @@ void weak_function stm32_spidev_initialize(void)
****************************************************************************/
#ifdef CONFIG_STM32F7_SPI1
-void stm32_spi1select(FAR struct spi_dev_s *dev, enum spi_dev_e devid, bool selected)
+void stm32_spi1select(FAR struct spi_dev_s *dev, uint32_t devid, bool selected)
{
spiinfo("devid: %d CS: %s\n", (int)devid, selected ? "assert" : "de-assert");
}
-uint8_t stm32_spi1status(FAR struct spi_dev_s *dev, enum spi_dev_e devid)
+uint8_t stm32_spi1status(FAR struct spi_dev_s *dev, uint32_t devid)
{
return 0;
}
#endif
#ifdef CONFIG_STM32F7_SPI2
-void stm32_spi2select(FAR struct spi_dev_s *dev, enum spi_dev_e devid, bool selected)
+void stm32_spi2select(FAR struct spi_dev_s *dev, uint32_t devid, bool selected)
{
spiinfo("devid: %d CS: %s\n", (int)devid, selected ? "assert" : "de-assert");
}
-uint8_t stm32_spi2status(FAR struct spi_dev_s *dev, enum spi_dev_e devid)
+uint8_t stm32_spi2status(FAR struct spi_dev_s *dev, uint32_t devid)
{
return 0;
}
#endif
#ifdef CONFIG_STM32F7_SPI3
-void stm32_spi3select(FAR struct spi_dev_s *dev, enum spi_dev_e devid, bool selected)
+void stm32_spi3select(FAR struct spi_dev_s *dev, uint32_t devid, bool selected)
{
spiinfo("devid: %d CS: %s\n", (int)devid, selected ? "assert" : "de-assert");
}
-uint8_t stm32_spi3status(FAR struct spi_dev_s *dev, enum spi_dev_e devid)
+uint8_t stm32_spi3status(FAR struct spi_dev_s *dev, uint32_t devid)
{
return 0;
}
#endif
#ifdef CONFIG_STM32F7_SPI4
-void stm32_spi4select(FAR struct spi_dev_s *dev, enum spi_dev_e devid, bool selected)
+void stm32_spi4select(FAR struct spi_dev_s *dev, uint32_t devid, bool selected)
{
spiinfo("devid: %d CS: %s\n", (int)devid, selected ? "assert" : "de-assert");
}
-uint8_t stm32_spi4status(FAR struct spi_dev_s *dev, enum spi_dev_e devid)
+uint8_t stm32_spi4status(FAR struct spi_dev_s *dev, uint32_t devid)
{
return 0;
}
#endif
#ifdef CONFIG_STM32F7_SPI5
-void stm32_spi5select(FAR struct spi_dev_s *dev, enum spi_dev_e devid, bool selected)
+void stm32_spi5select(FAR struct spi_dev_s *dev, uint32_t devid, bool selected)
{
spiinfo("devid: %d CS: %s\n", (int)devid, selected ? "assert" : "de-assert");
}
-uint8_t stm32_spi5status(FAR struct spi_dev_s *dev, enum spi_dev_e devid)
+uint8_t stm32_spi5status(FAR struct spi_dev_s *dev, uint32_t devid)
{
return 0;
}
#endif
#ifdef CONFIG_STM32F7_SPI6
-void stm32_spi6select(FAR struct spi_dev_s *dev, enum spi_dev_e devid, bool selected)
+void stm32_spi6select(FAR struct spi_dev_s *dev, uint32_t devid, bool selected)
{
spiinfo("devid: %d CS: %s\n", (int)devid, selected ? "assert" : "de-assert");
}
-uint8_t stm32_spi6status(FAR struct spi_dev_s *dev, enum spi_dev_e devid)
+uint8_t stm32_spi6status(FAR struct spi_dev_s *dev, uint32_t devid)
{
return 0;
}
@@ -195,42 +195,42 @@ uint8_t stm32_spi6status(FAR struct spi_dev_s *dev, enum spi_dev_e devid)
#ifdef CONFIG_SPI_CMDDATA
#ifdef CONFIG_STM32F7_SPI1
-int stm32_spi1cmddata(FAR struct spi_dev_s *dev, enum spi_dev_e devid, bool cmd)
+int stm32_spi1cmddata(FAR struct spi_dev_s *dev, uint32_t devid, bool cmd)
{
return -ENODEV;
}
#endif
#ifdef CONFIG_STM32F7_SPI2
-int stm32_spi2cmddata(FAR struct spi_dev_s *dev, enum spi_dev_e devid, bool cmd)
+int stm32_spi2cmddata(FAR struct spi_dev_s *dev, uint32_t devid, bool cmd)
{
return -ENODEV;
}
#endif
#ifdef CONFIG_STM32F7_SPI3
-int stm32_spi3cmddata(FAR struct spi_dev_s *dev, enum spi_dev_e devid, bool cmd)
+int stm32_spi3cmddata(FAR struct spi_dev_s *dev, uint32_t devid, bool cmd)
{
return -ENODEV;
}
#endif
#ifdef CONFIG_STM32F7_SPI4
-int stm32_spi4cmddata(FAR struct spi_dev_s *dev, enum spi_dev_e devid, bool cmd)
+int stm32_spi4cmddata(FAR struct spi_dev_s *dev, uint32_t devid, bool cmd)
{
return -ENODEV;
}
#endif
#ifdef CONFIG_STM32F7_SPI5
-int stm32_spi5cmddata(FAR struct spi_dev_s *dev, enum spi_dev_e devid, bool cmd)
+int stm32_spi5cmddata(FAR struct spi_dev_s *dev, uint32_t devid, bool cmd)
{
return -ENODEV;
}
#endif
#ifdef CONFIG_STM32F7_SPI6
-int stm32_spi6cmddata(FAR struct spi_dev_s *dev, enum spi_dev_e devid, bool cmd)
+int stm32_spi6cmddata(FAR struct spi_dev_s *dev, uint32_t devid, bool cmd)
{
return -ENODEV;
}
diff --git a/configs/stm32f746g-disco/src/stm32_spi.c b/configs/stm32f746g-disco/src/stm32_spi.c
index c2bea9894d..1b8035af68 100644
--- a/configs/stm32f746g-disco/src/stm32_spi.c
+++ b/configs/stm32f746g-disco/src/stm32_spi.c
@@ -99,60 +99,60 @@ void weak_function stm32_spidev_initialize(void)
****************************************************************************/
#ifdef CONFIG_STM32F7_SPI1
-void stm32_spi1select(FAR struct spi_dev_s *dev, enum spi_dev_e devid, bool selected)
+void stm32_spi1select(FAR struct spi_dev_s *dev, uint32_t devid, bool selected)
{
spiinfo("devid: %d CS: %s\n", (int)devid, selected ? "assert" : "de-assert");
}
-uint8_t stm32_spi1status(FAR struct spi_dev_s *dev, enum spi_dev_e devid)
+uint8_t stm32_spi1status(FAR struct spi_dev_s *dev, uint32_t devid)
{
return 0;
}
#endif
#ifdef CONFIG_STM32F7_SPI2
-void stm32_spi2select(FAR struct spi_dev_s *dev, enum spi_dev_e devid, bool selected)
+void stm32_spi2select(FAR struct spi_dev_s *dev, uint32_t devid, bool selected)
{
spiinfo("devid: %d CS: %s\n", (int)devid, selected ? "assert" : "de-assert");
}
-uint8_t stm32_spi2status(FAR struct spi_dev_s *dev, enum spi_dev_e devid)
+uint8_t stm32_spi2status(FAR struct spi_dev_s *dev, uint32_t devid)
{
return 0;
}
#endif
#ifdef CONFIG_STM32F7_SPI3
-void stm32_spi3select(FAR struct spi_dev_s *dev, enum spi_dev_e devid, bool selected)
+void stm32_spi3select(FAR struct spi_dev_s *dev, uint32_t devid, bool selected)
{
spiinfo("devid: %d CS: %s\n", (int)devid, selected ? "assert" : "de-assert");
}
-uint8_t stm32_spi3status(FAR struct spi_dev_s *dev, enum spi_dev_e devid)
+uint8_t stm32_spi3status(FAR struct spi_dev_s *dev, uint32_t devid)
{
return 0;
}
#endif
#ifdef CONFIG_STM32F7_SPI4
-void stm32_spi4select(FAR struct spi_dev_s *dev, enum spi_dev_e devid, bool selected)
+void stm32_spi4select(FAR struct spi_dev_s *dev, uint32_t devid, bool selected)
{
spiinfo("devid: %d CS: %s\n", (int)devid, selected ? "assert" : "de-assert");
}
-uint8_t stm32_spi4status(FAR struct spi_dev_s *dev, enum spi_dev_e devid)
+uint8_t stm32_spi4status(FAR struct spi_dev_s *dev, uint32_t devid)
{
return 0;
}
#endif
#ifdef CONFIG_STM32F7_SPI5
-void stm32_spi5select(FAR struct spi_dev_s *dev, enum spi_dev_e devid, bool selected)
+void stm32_spi5select(FAR struct spi_dev_s *dev, uint32_t devid, bool selected)
{
spiinfo("devid: %d CS: %s\n", (int)devid, selected ? "assert" : "de-assert");
}
-uint8_t stm32_spi5status(FAR struct spi_dev_s *dev, enum spi_dev_e devid)
+uint8_t stm32_spi5status(FAR struct spi_dev_s *dev, uint32_t devid)
{
return 0;
}
@@ -183,35 +183,35 @@ uint8_t stm32_spi5status(FAR struct spi_dev_s *dev, enum spi_dev_e devid)
#ifdef CONFIG_SPI_CMDDATA
#ifdef CONFIG_STM32F7_SPI1
-int stm32_spi1cmddata(FAR struct spi_dev_s *dev, enum spi_dev_e devid, bool cmd)
+int stm32_spi1cmddata(FAR struct spi_dev_s *dev, uint32_t devid, bool cmd)
{
return -ENODEV;
}
#endif
#ifdef CONFIG_STM32F7_SPI2
-int stm32_spi2cmddata(FAR struct spi_dev_s *dev, enum spi_dev_e devid, bool cmd)
+int stm32_spi2cmddata(FAR struct spi_dev_s *dev, uint32_t devid, bool cmd)
{
return -ENODEV;
}
#endif
#ifdef CONFIG_STM32F7_SPI3
-int stm32_spi3cmddata(FAR struct spi_dev_s *dev, enum spi_dev_e devid, bool cmd)
+int stm32_spi3cmddata(FAR struct spi_dev_s *dev, uint32_t devid, bool cmd)
{
return -ENODEV;
}
#endif
#ifdef CONFIG_STM32F7_SPI4
-int stm32_spi4cmddata(FAR struct spi_dev_s *dev, enum spi_dev_e devid, bool cmd)
+int stm32_spi4cmddata(FAR struct spi_dev_s *dev, uint32_t devid, bool cmd)
{
return -ENODEV;
}
#endif
#ifdef CONFIG_STM32F7_SPI5
-int stm32_spi5cmddata(FAR struct spi_dev_s *dev, enum spi_dev_e devid, bool cmd)
+int stm32_spi5cmddata(FAR struct spi_dev_s *dev, uint32_t devid, bool cmd)
{
return -ENODEV;
}
diff --git a/configs/stm32l476-mdk/src/stm32_spi.c b/configs/stm32l476-mdk/src/stm32_spi.c
index 8b1cb7a8a6..ae13e9e59d 100644
--- a/configs/stm32l476-mdk/src/stm32_spi.c
+++ b/configs/stm32l476-mdk/src/stm32_spi.c
@@ -126,36 +126,36 @@ void weak_function stm32_spiinitialize(void)
****************************************************************************/
#ifdef CONFIG_STM32_SPI1
-void stm32_spi1select(FAR struct spi_dev_s *dev, enum spi_dev_e devid, bool selected)
+void stm32_spi1select(FAR struct spi_dev_s *dev, uint32_t devid, bool selected)
{
spiinfo("devid: %d CS: %s\n", (int)devid, selected ? "assert" : "de-assert");
}
-uint8_t stm32_spi1status(FAR struct spi_dev_s *dev, enum spi_dev_e devid)
+uint8_t stm32_spi1status(FAR struct spi_dev_s *dev, uint32_t devid)
{
return 0;
}
#endif
#ifdef CONFIG_STM32_SPI2
-void stm32_spi2select(FAR struct spi_dev_s *dev, enum spi_dev_e devid, bool selected)
+void stm32_spi2select(FAR struct spi_dev_s *dev, uint32_t devid, bool selected)
{
spiinfo("devid: %d CS: %s\n", (int)devid, selected ? "assert" : "de-assert");
}
-uint8_t stm32_spi2status(FAR struct spi_dev_s *dev, enum spi_dev_e devid)
+uint8_t stm32_spi2status(FAR struct spi_dev_s *dev, uint32_t devid)
{
return 0;
}
#endif
#ifdef CONFIG_STM32_SPI3
-void stm32_spi3select(FAR struct spi_dev_s *dev, enum spi_dev_e devid, bool selected)
+void stm32_spi3select(FAR struct spi_dev_s *dev, uint32_t devid, bool selected)
spiinfo("devid: %d CS: %s\n", (int)devid, selected ? "assert" : "de-assert");
}
-uint8_t stm32_spi3status(FAR struct spi_dev_s *dev, enum spi_dev_e devid)
+uint8_t stm32_spi3status(FAR struct spi_dev_s *dev, uint32_t devid)
{
return 0;
}
@@ -186,21 +186,21 @@ uint8_t stm32_spi3status(FAR struct spi_dev_s *dev, enum spi_dev_e devid)
#ifdef CONFIG_SPI_CMDDATA
#ifdef CONFIG_STM32_SPI1
-int stm32_spi1cmddata(FAR struct spi_dev_s *dev, enum spi_dev_e devid, bool cmd)
+int stm32_spi1cmddata(FAR struct spi_dev_s *dev, uint32_t devid, bool cmd)
{
return OK;
}
#endif
#ifdef CONFIG_STM32_SPI2
-int stm32_spi2cmddata(FAR struct spi_dev_s *dev, enum spi_dev_e devid, bool cmd)
+int stm32_spi2cmddata(FAR struct spi_dev_s *dev, uint32_t devid, bool cmd)
{
return OK;
}
#endif
#ifdef CONFIG_STM32_SPI3
-int stm32_spi3cmddata(FAR struct spi_dev_s *dev, enum spi_dev_e devid, bool cmd)
+int stm32_spi3cmddata(FAR struct spi_dev_s *dev, uint32_t devid, bool cmd)
{
return OK;
}
diff --git a/configs/stm32l476vg-disco/src/stm32_spi.c b/configs/stm32l476vg-disco/src/stm32_spi.c
index 3b8420c62a..32e813b639 100644
--- a/configs/stm32l476vg-disco/src/stm32_spi.c
+++ b/configs/stm32l476vg-disco/src/stm32_spi.c
@@ -143,57 +143,57 @@ void weak_function stm32_spiinitialize(void)
****************************************************************************/
#ifdef CONFIG_STM32_SPI1
-void stm32_spi1select(FAR struct spi_dev_s *dev, enum spi_dev_e devid, bool selected)
+void stm32_spi1select(FAR struct spi_dev_s *dev, uint32_t devid, bool selected)
{
spiinfo("devid: %d CS: %s\n", (int)devid, selected ? "assert" : "de-assert");
#ifdef CONFIG_WL_CC3000
- if (devid == SPIDEV_WIRELESS)
+ if (devid == SPIDEV_WIRELESS(0))
{
stm32_gpiowrite(GPIO_SPI_CS_WIFI, !selected);
}
else
#endif
#ifdef HAVE_MMCSD
- if (devid == SPIDEV_MMCSD)
+ if (devid == SPIDEV_MMCSD(0))
{
stm32_gpiowrite(GPIO_SPI_CS_SD_CARD, !selected);
}
#endif
}
-uint8_t stm32_spi1status(FAR struct spi_dev_s *dev, enum spi_dev_e devid)
+uint8_t stm32_spi1status(FAR struct spi_dev_s *dev, uint32_t devid)
{
return 0;
}
#endif
#ifdef CONFIG_STM32_SPI2
-void stm32_spi2select(FAR struct spi_dev_s *dev, enum spi_dev_e devid, bool selected)
+void stm32_spi2select(FAR struct spi_dev_s *dev, uint32_t devid, bool selected)
{
spiinfo("devid: %d CS: %s\n", (int)devid, selected ? "assert" : "de-assert");
#ifdef CONFIG_WL_CC3000
- if (devid == SPIDEV_WIRELESS)
+ if (devid == SPIDEV_WIRELESS(0))
{
stm32_gpiowrite(GPIO_WIFI_CS, !selected);
}
#endif
}
-uint8_t stm32_spi2status(FAR struct spi_dev_s *dev, enum spi_dev_e devid)
+uint8_t stm32_spi2status(FAR struct spi_dev_s *dev, uint32_t devid)
{
return 0;
}
#endif
#ifdef CONFIG_STM32_SPI3
-void stm32_spi3select(FAR struct spi_dev_s *dev, enum spi_dev_e devid, bool selected)
+void stm32_spi3select(FAR struct spi_dev_s *dev, uint32_t devid, bool selected)
spiinfo("devid: %d CS: %s\n", (int)devid, selected ? "assert" : "de-assert");
}
-uint8_t stm32_spi3status(FAR struct spi_dev_s *dev, enum spi_dev_e devid)
+uint8_t stm32_spi3status(FAR struct spi_dev_s *dev, uint32_t devid)
{
return 0;
}
@@ -224,21 +224,21 @@ uint8_t stm32_spi3status(FAR struct spi_dev_s *dev, enum spi_dev_e devid)
#ifdef CONFIG_SPI_CMDDATA
#ifdef CONFIG_STM32_SPI1
-int stm32_spi1cmddata(FAR struct spi_dev_s *dev, enum spi_dev_e devid, bool cmd)
+int stm32_spi1cmddata(FAR struct spi_dev_s *dev, uint32_t devid, bool cmd)
{
return OK;
}
#endif
#ifdef CONFIG_STM32_SPI2
-int stm32_spi2cmddata(FAR struct spi_dev_s *dev, enum spi_dev_e devid, bool cmd)
+int stm32_spi2cmddata(FAR struct spi_dev_s *dev, uint32_t devid, bool cmd)
{
return OK;
}
#endif
#ifdef CONFIG_STM32_SPI3
-int stm32_spi3cmddata(FAR struct spi_dev_s *dev, enum spi_dev_e devid, bool cmd)
+int stm32_spi3cmddata(FAR struct spi_dev_s *dev, uint32_t devid, bool cmd)
{
return OK;
}
diff --git a/configs/stm32ldiscovery/src/stm32_spi.c b/configs/stm32ldiscovery/src/stm32_spi.c
index d923a8b2c9..5b385f1b4d 100644
--- a/configs/stm32ldiscovery/src/stm32_spi.c
+++ b/configs/stm32ldiscovery/src/stm32_spi.c
@@ -102,38 +102,38 @@ void weak_function stm32_spidev_initialize(void)
****************************************************************************/
#ifdef CONFIG_STM32_SPI1
-void stm32_spi1select(FAR struct spi_dev_s *dev, enum spi_dev_e devid, bool selected)
+void stm32_spi1select(FAR struct spi_dev_s *dev, uint32_t devid, bool selected)
{
spiinfo("devid: %d CS: %s\n", (int)devid, selected ? "assert" : "de-assert");
stm32_gpiowrite(GPIO_MEMS_CS, !selected);
}
-uint8_t stm32_spi1status(FAR struct spi_dev_s *dev, enum spi_dev_e devid)
+uint8_t stm32_spi1status(FAR struct spi_dev_s *dev, uint32_t devid)
{
return 0;
}
#endif
#ifdef CONFIG_STM32_SPI2
-void stm32_spi2select(FAR struct spi_dev_s *dev, enum spi_dev_e devid, bool selected)
+void stm32_spi2select(FAR struct spi_dev_s *dev, uint32_t devid, bool selected)
{
spiinfo("devid: %d CS: %s\n", (int)devid, selected ? "assert" : "de-assert");
}
-uint8_t stm32_spi2status(FAR struct spi_dev_s *dev, enum spi_dev_e devid)
+uint8_t stm32_spi2status(FAR struct spi_dev_s *dev, uint32_t devid)
{
return 0;
}
#endif
#ifdef CONFIG_STM32_SPI3
-void stm32_spi3select(FAR struct spi_dev_s *dev, enum spi_dev_e devid, bool selected)
+void stm32_spi3select(FAR struct spi_dev_s *dev, uint32_t devid, bool selected)
{
spiinfo("devid: %d CS: %s\n", (int)devid, selected ? "assert" : "de-assert");
}
-uint8_t stm32_spi3status(FAR struct spi_dev_s *dev, enum spi_dev_e devid)
+uint8_t stm32_spi3status(FAR struct spi_dev_s *dev, uint32_t devid)
{
return 0;
}
@@ -164,21 +164,21 @@ uint8_t stm32_spi3status(FAR struct spi_dev_s *dev, enum spi_dev_e devid)
#ifdef CONFIG_SPI_CMDDATA
#ifdef CONFIG_STM32_SPI1
-int stm32_spi1cmddata(FAR struct spi_dev_s *dev, enum spi_dev_e devid, bool cmd)
+int stm32_spi1cmddata(FAR struct spi_dev_s *dev, uint32_t devid, bool cmd)
{
return -ENODEV;
}
#endif
#ifdef CONFIG_STM32_SPI2
-int stm32_spi2cmddata(FAR struct spi_dev_s *dev, enum spi_dev_e devid, bool cmd)
+int stm32_spi2cmddata(FAR struct spi_dev_s *dev, uint32_t devid, bool cmd)
{
return -ENODEV;
}
#endif
#ifdef CONFIG_STM32_SPI3
-int stm32_spi3cmddata(FAR struct spi_dev_s *dev, enum spi_dev_e devid, bool cmd)
+int stm32_spi3cmddata(FAR struct spi_dev_s *dev, uint32_t devid, bool cmd)
{
return -ENODEV;
}
diff --git a/configs/sure-pic32mx/src/pic32mx_spi.c b/configs/sure-pic32mx/src/pic32mx_spi.c
index 74671256ba..587efd958e 100644
--- a/configs/sure-pic32mx/src/pic32mx_spi.c
+++ b/configs/sure-pic32mx/src/pic32mx_spi.c
@@ -174,28 +174,28 @@ void weak_function pic32mx_spidev_initialize(void)
************************************************************************************/
#ifdef CONFIG_PIC32MX_SPI2
-void pic32mx_spi2select(FAR struct spi_dev_s *dev, enum spi_dev_e devid, bool selected)
+void pic32mx_spi2select(FAR struct spi_dev_s *dev, uint32_t devid, bool selected)
{
spiinfo("devid: %d CS: %s\n", (int)devid, selected ? "assert" : "de-assert");
/* The SD card chip select is pulled high and active low */
#ifdef PIC32_HAVE_SD
- if (devid == SPIDEV_MMCSD)
+ if (devid == SPIDEV_MMCSD(0))
{
pic32mx_gpiowrite(GPIO_SD_CS, !selected);
}
#endif
#ifdef PIC32_HAVE_SOIC
- if (devid == SPIDEV_FLASH)
+ if (devid == SPIDEV_FLASH(0))
{
pic32mx_gpiowrite(GPIO_SOIC_CS, !selected);
}
#endif
}
-uint8_t pic32mx_spi2status(FAR struct spi_dev_s *dev, enum spi_dev_e devid)
+uint8_t pic32mx_spi2status(FAR struct spi_dev_s *dev, uint32_t devid)
{
uint8_t ret = 0;
@@ -204,7 +204,7 @@ uint8_t pic32mx_spi2status(FAR struct spi_dev_s *dev, enum spi_dev_e devid)
*/
#ifdef PIC32_HAVE_SD
- if (devid == SPIDEV_MMCSD)
+ if (devid == SPIDEV_MMCSD(0))
{
if (!pic32mx_gpioread(GPIO_SD_CD))
{
@@ -223,7 +223,7 @@ uint8_t pic32mx_spi2status(FAR struct spi_dev_s *dev, enum spi_dev_e devid)
#endif
#ifdef PIC32_HAVE_SOIC
- if (devid == SPIDEV_FLASH)
+ if (devid == SPIDEV_FLASH(0))
{
ret = SPI_STATUS_PRESENT;
diff --git a/configs/teensy-2.0/src/at90usb_spi.c b/configs/teensy-2.0/src/at90usb_spi.c
index 6c55945b3d..db301389b9 100644
--- a/configs/teensy-2.0/src/at90usb_spi.c
+++ b/configs/teensy-2.0/src/at90usb_spi.c
@@ -136,7 +136,7 @@ void weak_function at90usb_spidev_initialize(void)
*
************************************************************************************/
-void avr_spiselect(FAR struct spi_dev_s *dev, enum spi_dev_e devid, bool selected)
+void avr_spiselect(FAR struct spi_dev_s *dev, uint32_t devid, bool selected)
{
spiinfo("devid: %d CS: %s\n", (int)devid, selected ? "assert" : "de-assert");
@@ -152,7 +152,7 @@ void avr_spiselect(FAR struct spi_dev_s *dev, enum spi_dev_e devid, bool select
}
}
-uint8_t avr_spistatus(FAR struct spi_dev_s *dev, enum spi_dev_e devid)
+uint8_t avr_spistatus(FAR struct spi_dev_s *dev, uint32_t devid)
{
uint8_t ret = 0;
uint8_t regval = PINB;
diff --git a/configs/teensy-3.x/src/k20_spi.c b/configs/teensy-3.x/src/k20_spi.c
index 3bcef38e55..b06603564a 100644
--- a/configs/teensy-3.x/src/k20_spi.c
+++ b/configs/teensy-3.x/src/k20_spi.c
@@ -97,13 +97,13 @@ void weak_function kinetis_spidev_initialize(void)
************************************************************************************/
#ifdef CONFIG_KINETIS_SPI0
-void kinetis_spi0select(FAR struct spi_dev_s *dev, enum spi_dev_e devid, bool selected)
+void kinetis_spi0select(FAR struct spi_dev_s *dev, uint32_t devid, bool selected)
{
spiinfo("devid: %d CS: %s\n", (int)devid, selected ? "assert" : "de-assert");
# warning "Missing logic"
}
-uint8_t kinetis_spi0status(FAR struct spi_dev_s *dev, enum spi_dev_e devid)
+uint8_t kinetis_spi0status(FAR struct spi_dev_s *dev, uint32_t devid)
{
# warning "Missing logic"
return SPI_STATUS_PRESENT;
@@ -111,13 +111,13 @@ uint8_t kinetis_spi0status(FAR struct spi_dev_s *dev, enum spi_dev_e devid)
#endif
#ifdef CONFIG_KINETIS_SPI1
-void kinetis_spi1select(FAR struct spi_dev_s *dev, enum spi_dev_e devid, bool selected)
+void kinetis_spi1select(FAR struct spi_dev_s *dev, uint32_t devid, bool selected)
{
spiinfo("devid: %d CS: %s\n", (int)devid, selected ? "assert" : "de-assert");
# warning "Missing logic"
}
-uint8_t kinetis_spi1status(FAR struct spi_dev_s *dev, enum spi_dev_e devid)
+uint8_t kinetis_spi1status(FAR struct spi_dev_s *dev, uint32_t devid)
{
# warning "Missing logic"
return SPI_STATUS_PRESENT;
@@ -125,13 +125,13 @@ uint8_t kinetis_spi1status(FAR struct spi_dev_s *dev, enum spi_dev_e devid)
#endif
#ifdef CONFIG_KINETIS_SPI2
-void kinetis_spi2select(FAR struct spi_dev_s *dev, enum spi_dev_e devid, bool selected)
+void kinetis_spi2select(FAR struct spi_dev_s *dev, uint32_t devid, bool selected)
{
spiinfo("devid: %d CS: %s\n", (int)devid, selected ? "assert" : "de-assert");
# warning "Missing logic"
}
-uint8_t kinetis_spi2status(FAR struct spi_dev_s *dev, enum spi_dev_e devid)
+uint8_t kinetis_spi2status(FAR struct spi_dev_s *dev, uint32_t devid)
{
# warning "Missing logic"
return SPI_STATUS_PRESENT;
diff --git a/configs/teensy-lc/src/kl_spi.c b/configs/teensy-lc/src/kl_spi.c
index b4d36cb755..efd1c96ce3 100644
--- a/configs/teensy-lc/src/kl_spi.c
+++ b/configs/teensy-lc/src/kl_spi.c
@@ -130,7 +130,7 @@ void weak_function kl_spidev_initialize(void)
****************************************************************************/
#ifdef CONFIG_KL_SPI0
-void kl_spi0select(FAR struct spi_dev_s *dev, enum spi_dev_e devid,
+void kl_spi0select(FAR struct spi_dev_s *dev, uint32_t devid,
bool selected)
{
spiinfo("devid: %d CS: %s\n",
@@ -139,7 +139,7 @@ void kl_spi0select(FAR struct spi_dev_s *dev, enum spi_dev_e devid,
#endif
#ifdef CONFIG_KL_SPI1
-void kl_spi1select(FAR struct spi_dev_s *dev, enum spi_dev_e devid,
+void kl_spi1select(FAR struct spi_dev_s *dev, uint32_t devid,
bool selected)
{
spiinfo("devid: %d CS: %s\n",
@@ -162,14 +162,14 @@ void kl_spi1select(FAR struct spi_dev_s *dev, enum spi_dev_e devid,
****************************************************************************/
#ifdef CONFIG_KL_SPI0
-uint8_t kl_spi0status(FAR struct spi_dev_s *dev, enum spi_dev_e devid)
+uint8_t kl_spi0status(FAR struct spi_dev_s *dev, uint32_t devid)
{
return 0;
}
#endif
#ifdef CONFIG_KL_SPI1
-uint8_t kl_spi1status(FAR struct spi_dev_s *dev, enum spi_dev_e devid)
+uint8_t kl_spi1status(FAR struct spi_dev_s *dev, uint32_t devid)
{
return 0;
}
@@ -194,14 +194,14 @@ uint8_t kl_spi1status(FAR struct spi_dev_s *dev, enum spi_dev_e devid)
#ifdef CONFIG_SPI_CMDDATA
#ifdef CONFIG_KL_SPI0
-int kl_spi0cmddata(FAR struct spi_dev_s *dev, enum spi_dev_e devid, bool cmd)
+int kl_spi0cmddata(FAR struct spi_dev_s *dev, uint32_t devid, bool cmd)
{
return 0;
}
#endif
#ifdef CONFIG_KL_SPI1
-int kl_spi1cmddata(FAR struct spi_dev_s *dev, enum spi_dev_e devid, bool cmd)
+int kl_spi1cmddata(FAR struct spi_dev_s *dev, uint32_t devid, bool cmd)
{
return 0;
}
diff --git a/configs/tm4c123g-launchpad/src/tm4c_ssi.c b/configs/tm4c123g-launchpad/src/tm4c_ssi.c
index ce8ce7021c..3cdf0e3699 100644
--- a/configs/tm4c123g-launchpad/src/tm4c_ssi.c
+++ b/configs/tm4c123g-launchpad/src/tm4c_ssi.c
@@ -100,14 +100,14 @@ void weak_function tm4c_ssidev_initialize(void)
*
****************************************************************************/
-void tiva_ssiselect(FAR struct spi_dev_s *dev, enum spi_dev_e devid, bool selected)
+void tiva_ssiselect(FAR struct spi_dev_s *dev, uint32_t devid, bool selected)
{
spiinfo("devid: %d CS: %s\n", (int)devid, selected ? "assert" : "de-assert");
ssi_dumpgpio("tiva_ssiselect() Entry");
ssi_dumpgpio("tiva_ssiselect() Exit");
}
-uint8_t tiva_ssistatus(FAR struct spi_dev_s *dev, enum spi_dev_e devid)
+uint8_t tiva_ssistatus(FAR struct spi_dev_s *dev, uint32_t devid)
{
spiinfo("Returning SPI_STATUS_PRESENT\n");
return SPI_STATUS_PRESENT;
diff --git a/configs/twr-k60n512/src/k60_spi.c b/configs/twr-k60n512/src/k60_spi.c
index 92e3649000..cdbc1a034a 100644
--- a/configs/twr-k60n512/src/k60_spi.c
+++ b/configs/twr-k60n512/src/k60_spi.c
@@ -97,13 +97,13 @@ void weak_function kinetis_spidev_initialize(void)
****************************************************************************/
#ifdef CONFIG_KINETIS_SPI0
-void kinetis_spi0select(FAR struct spi_dev_s *dev, enum spi_dev_e devid, bool selected)
+void kinetis_spi0select(FAR struct spi_dev_s *dev, uint32_t devid, bool selected)
{
spiinfo("devid: %d CS: %s\n", (int)devid, selected ? "assert" : "de-assert");
# warning "Missing logic"
}
-uint8_t kinetis_spi0status(FAR struct spi_dev_s *dev, enum spi_dev_e devid)
+uint8_t kinetis_spi0status(FAR struct spi_dev_s *dev, uint32_t devid)
{
# warning "Missing logic"
return SPI_STATUS_PRESENT;
@@ -111,13 +111,13 @@ uint8_t kinetis_spi0status(FAR struct spi_dev_s *dev, enum spi_dev_e devid)
#endif
#ifdef CONFIG_KINETIS_SPI1
-void kinetis_spi1select(FAR struct spi_dev_s *dev, enum spi_dev_e devid, bool selected)
+void kinetis_spi1select(FAR struct spi_dev_s *dev, uint32_t devid, bool selected)
{
spiinfo("devid: %d CS: %s\n", (int)devid, selected ? "assert" : "de-assert");
# warning "Missing logic"
}
-uint8_t kinetis_spi1status(FAR struct spi_dev_s *dev, enum spi_dev_e devid)
+uint8_t kinetis_spi1status(FAR struct spi_dev_s *dev, uint32_t devid)
{
# warning "Missing logic"
return SPI_STATUS_PRESENT;
@@ -125,13 +125,13 @@ uint8_t kinetis_spi1status(FAR struct spi_dev_s *dev, enum spi_dev_e devid)
#endif
#ifdef CONFIG_KINETIS_SPI2
-void kinetis_spi2select(FAR struct spi_dev_s *dev, enum spi_dev_e devid, bool selected)
+void kinetis_spi2select(FAR struct spi_dev_s *dev, uint32_t devid, bool selected)
{
spiinfo("devid: %d CS: %s\n", (int)devid, selected ? "assert" : "de-assert");
# warning "Missing logic"
}
-uint8_t kinetis_spi2status(FAR struct spi_dev_s *dev, enum spi_dev_e devid)
+uint8_t kinetis_spi2status(FAR struct spi_dev_s *dev, uint32_t devid)
{
# warning "Missing logic"
return SPI_STATUS_PRESENT;
diff --git a/configs/u-blox-c027/src/lpc17_ssp.c b/configs/u-blox-c027/src/lpc17_ssp.c
index 7090bcbb31..1b4ce631c8 100644
--- a/configs/u-blox-c027/src/lpc17_ssp.c
+++ b/configs/u-blox-c027/src/lpc17_ssp.c
@@ -120,7 +120,7 @@ void weak_function c027_sspdev_initialize(void)
************************************************************************************/
#ifdef CONFIG_LPC17_SSP0
-void lpc17_ssp0select(FAR struct spi_dev_s *dev, enum spi_dev_e devid, bool selected)
+void lpc17_ssp0select(FAR struct spi_dev_s *dev, uint32_t devid, bool selected)
{
spiinfo("devid: %d CS: %s\n", (int)devid, selected ? "assert" : "de-assert");
ssp_dumpgpio("lpc17_ssp0select() Entry");
@@ -130,7 +130,7 @@ void lpc17_ssp0select(FAR struct spi_dev_s *dev, enum spi_dev_e devid, bool sel
ssp_dumpgpio("lpc17_ssp0select() Exit");
}
-uint8_t lpc17_ssp0status(FAR struct spi_dev_s *dev, enum spi_dev_e devid)
+uint8_t lpc17_ssp0status(FAR struct spi_dev_s *dev, uint32_t devid)
{
spiinfo("Returning SPI_STATUS_PRESENT\n");
return SPI_STATUS_PRESENT;
@@ -138,19 +138,19 @@ uint8_t lpc17_ssp0status(FAR struct spi_dev_s *dev, enum spi_dev_e devid)
#endif
#ifdef CONFIG_LPC17_SSP1
-void lpc17_ssp1select(FAR struct spi_dev_s *dev, enum spi_dev_e devid, bool selected)
+void lpc17_ssp1select(FAR struct spi_dev_s *dev, uint32_t devid, bool selected)
{
spiinfo("devid: %d CS: %s\n", (int)devid, selected ? "assert" : "de-assert");
ssp_dumpgpio("lpc17_ssp1select() Entry");
- if (devid == SPIDEV_MMCSD)
+ if (devid == SPIDEV_MMCSD(0))
{
/* Assert/de-assert the CS pin to the card */
(void)lpc17_gpiowrite(C027_SD_CS, !selected);
}
#ifdef CONFIG_NX_LCDDRIVER
- else if (devid == SPIDEV_DISPLAY)
+ else if (devid == SPIDEV_DISPLAY(0))
{
/* Assert the CS pin to the OLED display */
@@ -160,9 +160,9 @@ void lpc17_ssp1select(FAR struct spi_dev_s *dev, enum spi_dev_e devid, bool sel
ssp_dumpgpio("lpc17_ssp1select() Exit");
}
-uint8_t lpc17_ssp1status(FAR struct spi_dev_s *dev, enum spi_dev_e devid)
+uint8_t lpc17_ssp1status(FAR struct spi_dev_s *dev, uint32_t devid)
{
- if (devid == SPIDEV_MMCSD)
+ if (devid == SPIDEV_MMCSD(0))
{
/* Read the state of the card-detect bit */
diff --git a/configs/viewtool-stm32f107/src/stm32_spi.c b/configs/viewtool-stm32f107/src/stm32_spi.c
index 3e8996f3af..aa1516e32b 100644
--- a/configs/viewtool-stm32f107/src/stm32_spi.c
+++ b/configs/viewtool-stm32f107/src/stm32_spi.c
@@ -113,45 +113,45 @@ void weak_function stm32_spidev_initialize(void)
****************************************************************************/
#ifdef CONFIG_STM32_SPI1
-void stm32_spi1select(FAR struct spi_dev_s *dev, enum spi_dev_e devid, bool selected)
+void stm32_spi1select(FAR struct spi_dev_s *dev, uint32_t devid, bool selected)
{
spiinfo("devid: %d CS: %s\n", (int)devid, selected ? "assert" : "de-assert");
}
-uint8_t stm32_spi1status(FAR struct spi_dev_s *dev, enum spi_dev_e devid)
+uint8_t stm32_spi1status(FAR struct spi_dev_s *dev, uint32_t devid)
{
return 0;
}
#endif
#ifdef CONFIG_STM32_SPI2
-void stm32_spi2select(FAR struct spi_dev_s *dev, enum spi_dev_e devid, bool selected)
+void stm32_spi2select(FAR struct spi_dev_s *dev, uint32_t devid, bool selected)
{
spiinfo("devid: %d CS: %s\n", (int)devid, selected ? "assert" : "de-assert");
#ifdef CONFIG_INPUT_ADS7843E
/* Select/de-select the touchscreen */
- if (devid == SPIDEV_TOUCHSCREEN)
+ if (devid == SPIDEV_TOUCHSCREEN(0))
{
stm32_gpiowrite(GPIO_LCDTP_CS, !selected);
}
#endif
}
-uint8_t stm32_spi2status(FAR struct spi_dev_s *dev, enum spi_dev_e devid)
+uint8_t stm32_spi2status(FAR struct spi_dev_s *dev, uint32_t devid)
{
return 0;
}
#endif
#ifdef CONFIG_STM32_SPI3
-void stm32_spi3select(FAR struct spi_dev_s *dev, enum spi_dev_e devid, bool selected)
+void stm32_spi3select(FAR struct spi_dev_s *dev, uint32_t devid, bool selected)
{
spiinfo("devid: %d CS: %s\n", (int)devid, selected ? "assert" : "de-assert");
}
-uint8_t stm32_spi3status(FAR struct spi_dev_s *dev, enum spi_dev_e devid)
+uint8_t stm32_spi3status(FAR struct spi_dev_s *dev, uint32_t devid)
{
return 0;
}
diff --git a/configs/zkit-arm-1769/src/lpc17_lcd.c b/configs/zkit-arm-1769/src/lpc17_lcd.c
index f029773169..a998c7e4fb 100644
--- a/configs/zkit-arm-1769/src/lpc17_lcd.c
+++ b/configs/zkit-arm-1769/src/lpc17_lcd.c
@@ -156,9 +156,9 @@ void board_lcd_uninitialize(void)
*
****************************************************************************/
-int lpc17_ssp0cmddata(FAR struct spi_dev_s *dev, enum spi_dev_e devid, bool cmd)
+int lpc17_ssp0cmddata(FAR struct spi_dev_s *dev, uint32_t devid, bool cmd)
{
- if (devid == SPIDEV_DISPLAY)
+ if (devid == SPIDEV_DISPLAY(0))
{
/* Set GPIO to 1 for data, 0 for command */
diff --git a/configs/zkit-arm-1769/src/lpc17_spi.c b/configs/zkit-arm-1769/src/lpc17_spi.c
index 4418cb5bdf..ec6d2773f4 100644
--- a/configs/zkit-arm-1769/src/lpc17_spi.c
+++ b/configs/zkit-arm-1769/src/lpc17_spi.c
@@ -123,12 +123,12 @@ void weak_function zkit_spidev_initialize(void)
*
************************************************************************************/
-void lpc17_spiselect(FAR struct spi_dev_s *dev, enum spi_dev_e devid, bool selected)
+void lpc17_spiselect(FAR struct spi_dev_s *dev, uint32_t devid, bool selected)
{
spiinfo("devid: %d CS: %s\n", (int)devid, selected ? "assert" : "de-assert");
spi_dumpgpio("lpc17_spiselect() Entry");
- if (devid == SPIDEV_MMCSD)
+ if (devid == SPIDEV_MMCSD(0))
{
/* Assert/de-assert the CS pin to the card */
@@ -138,9 +138,9 @@ void lpc17_spiselect(FAR struct spi_dev_s *dev, enum spi_dev_e devid, bool sele
spi_dumpgpio("lpc17_spiselect() Exit");
}
-uint8_t lpc17_spistatus(FAR struct spi_dev_s *dev, enum spi_dev_e devid)
+uint8_t lpc17_spistatus(FAR struct spi_dev_s *dev, uint32_t devid)
{
- if (devid == SPIDEV_MMCSD)
+ if (devid == SPIDEV_MMCSD(0))
{
/* Read the state of the card-detect bit */
@@ -163,7 +163,7 @@ uint8_t lpc17_spistatus(FAR struct spi_dev_s *dev, enum spi_dev_e devid)
*
****************************************************************************/
-int lpc17_spicmddata(FAR struct spi_dev_s *dev, enum spi_dev_e devid, bool cmd)
+int lpc17_spicmddata(FAR struct spi_dev_s *dev, uint32_t devid, bool cmd)
{
return OK;
}
diff --git a/configs/zkit-arm-1769/src/lpc17_ssp.c b/configs/zkit-arm-1769/src/lpc17_ssp.c
index 09cf3833c8..b34e102d43 100644
--- a/configs/zkit-arm-1769/src/lpc17_ssp.c
+++ b/configs/zkit-arm-1769/src/lpc17_ssp.c
@@ -126,7 +126,7 @@ void weak_function zkit_sspdev_initialize(void)
************************************************************************************/
#ifdef CONFIG_LPC17_SSP1
-void lpc17_ssp1select(FAR struct spi_dev_s *dev, enum spi_dev_e devid, bool selected)
+void lpc17_ssp1select(FAR struct spi_dev_s *dev, uint32_t devid, bool selected)
{
spiinfo("devid: %d CS: %s\n", (int)devid, selected ? "assert" : "de-assert");
ssp_dumpgpio("lpc17_ssp1select() Entry");
@@ -136,7 +136,7 @@ void lpc17_ssp1select(FAR struct spi_dev_s *dev, enum spi_dev_e devid, bool sel
ssp_dumpgpio("lpc17_ssp1select() Exit");
}
-uint8_t lpc17_ssp1status(FAR struct spi_dev_s *dev, enum spi_dev_e devid)
+uint8_t lpc17_ssp1status(FAR struct spi_dev_s *dev, uint32_t devid)
{
spiinfo("Returning SPI_STATUS_PRESENT\n");
return SPI_STATUS_PRESENT;
@@ -151,7 +151,7 @@ uint8_t lpc17_ssp1status(FAR struct spi_dev_s *dev, enum spi_dev_e devid)
#ifdef CONFIG_SPI_CMDDATA
int weak_function lpc17_ssp1cmddata(FAR struct spi_dev_s *dev,
- enum spi_dev_e devid, bool cmd)
+ uint32_t devid, bool cmd)
{
return OK;
}
@@ -160,13 +160,13 @@ int weak_function lpc17_ssp1cmddata(FAR struct spi_dev_s *dev,
#endif /* CONFIG_LPC17_SSP1 */
#ifdef CONFIG_LPC17_SSP0
-void lpc17_ssp0select(FAR struct spi_dev_s *dev, enum spi_dev_e devid, bool selected)
+void lpc17_ssp0select(FAR struct spi_dev_s *dev, uint32_t devid, bool selected)
{
spiinfo("devid: %d CS: %s\n", (int)devid, selected ? "assert" : "de-assert");
ssp_dumpgpio("lpc17_ssp0select() Entry");
#ifdef CONFIG_NX_LCDDRIVER
- if (devid == SPIDEV_DISPLAY)
+ if (devid == SPIDEV_DISPLAY(0))
{
/* Assert the CS pin to the OLED display */
@@ -177,9 +177,9 @@ void lpc17_ssp0select(FAR struct spi_dev_s *dev, enum spi_dev_e devid, bool sel
ssp_dumpgpio("lpc17_ssp0select() Exit");
}
-uint8_t lpc17_ssp0status(FAR struct spi_dev_s *dev, enum spi_dev_e devid)
+uint8_t lpc17_ssp0status(FAR struct spi_dev_s *dev, uint32_t devid)
{
- if (devid == SPIDEV_DISPLAY)
+ if (devid == SPIDEV_DISPLAY(0))
{
spiinfo("Returning SPI_STATUS_PRESENT\n");
return SPI_STATUS_PRESENT;
diff --git a/configs/zp214xpa/src/lpc2148_spi1.c b/configs/zp214xpa/src/lpc2148_spi1.c
index 72110a423a..1396d9b1f7 100644
--- a/configs/zp214xpa/src/lpc2148_spi1.c
+++ b/configs/zp214xpa/src/lpc2148_spi1.c
@@ -111,11 +111,11 @@
****************************************************************************/
static int spi_lock(FAR struct spi_dev_s *dev, bool lock);
-static void spi_select(FAR struct spi_dev_s *dev, enum spi_dev_e devid, bool selected);
+static void spi_select(FAR struct spi_dev_s *dev, uint32_t 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);
+static uint8_t spi_status(FAR struct spi_dev_s *dev, uint32_t devid);
#ifdef CONFIG_SPI_CMDDATA
-static int spi_cmddata(FAR struct spi_dev_s *dev, enum spi_dev_e devid, bool cmd);
+static int spi_cmddata(FAR struct spi_dev_s *dev, uint32_t devid, bool cmd);
#endif
static uint16_t spi_send(FAR struct spi_dev_s *dev, uint16_t ch);
static void spi_sndblock(FAR struct spi_dev_s *dev, FAR const void *buffer, size_t nwords);
@@ -213,14 +213,14 @@ static int spi_lock(FAR struct spi_dev_s *dev, bool lock)
*
****************************************************************************/
-static void spi_select(FAR struct spi_dev_s *dev, enum spi_dev_e devid, bool selected)
+static void spi_select(FAR struct spi_dev_s *dev, uint32_t devid, bool selected)
{
#ifdef CONFIG_DEBUG_SPI_INFO
uint32_t regval;
#endif
uint32_t bit = 1 << 20;
- /* We do not bother to check if devid == SPIDEV_DISPLAY because that is the
+ /* We do not bother to check if devid == SPIDEV_DISPLAY(0) because that is the
* only thing on the bus.
*/
@@ -315,7 +315,7 @@ 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)
+static uint8_t spi_status(FAR struct spi_dev_s *dev, uint32_t devid)
{
spiinfo("Return 0\n");
return 0;
@@ -346,14 +346,14 @@ static uint8_t spi_status(FAR struct spi_dev_s *dev, enum spi_dev_e devid)
****************************************************************************/
#ifdef CONFIG_SPI_CMDDATA
-static int spi_cmddata(FAR struct spi_dev_s *dev, enum spi_dev_e devid, bool cmd)
+static int spi_cmddata(FAR struct spi_dev_s *dev, uint32_t devid, bool cmd)
{
#ifdef CONFIG_DEBUG_SPI_INFO
uint32_t regval;
#endif
uint32_t bit = 1 << 23;
- /* We do not bother to check if devid == SPIDEV_DISPLAY because that is the
+ /* We do not bother to check if devid == SPIDEV_DISPLAY(0) because that is the
* only thing on the bus.
*/
diff --git a/drivers/analog/Kconfig b/drivers/analog/Kconfig
index c1c7dce031..6727f67c47 100644
--- a/drivers/analog/Kconfig
+++ b/drivers/analog/Kconfig
@@ -116,7 +116,7 @@ config PGA11X_MULTIPLE
Can be defined to support multiple PGA11X devices on board with separate
chip selects (not daisy chained). Each device will require a customized
SPI interface to distinguish them when SPI_SELECT is called with
- devid=SPIDEV_MUX.
+ devid=SPIDEV_MUX(n).
endif # if ADC_PGA11X
endif # ADC
diff --git a/drivers/analog/pga11x.c b/drivers/analog/pga11x.c
index de86444b38..c8adf31494 100644
--- a/drivers/analog/pga11x.c
+++ b/drivers/analog/pga11x.c
@@ -278,9 +278,9 @@ static void pga11x_write(FAR struct spi_dev_s *spi, uint16_t cmd)
/* Lock, select, send the 16-bit command, de-select, and un-lock. */
pga11x_lock(spi);
- SPI_SELECT(spi, SPIDEV_MUX, true);
+ SPI_SELECT(spi, SPIDEV_MUX(0), true);
pga11x_send16(spi, cmd);
- SPI_SELECT(spi, SPIDEV_MUX, false);
+ SPI_SELECT(spi, SPIDEV_MUX(0), false);
pga11x_unlock(spi);
}
#else
@@ -293,10 +293,10 @@ static void pga11x_write(FAR struct spi_dev_s *spi, uint16_t u1cmd, uint16_t u2c
*/
pga11x_lock(spi);
- SPI_SELECT(spi, SPIDEV_MUX, true);
+ SPI_SELECT(spi, SPIDEV_MUX(0), true);
pga11x_send16(spi, u2cmd);
pga11x_send16(spi, u1cmd);
- SPI_SELECT(spi, SPIDEV_MUX, false);
+ SPI_SELECT(spi, SPIDEV_MUX(0), false);
pga11x_unlock(spi);
}
#endif
@@ -491,17 +491,17 @@ int pga11x_read(PGA11X_HANDLE handle, FAR struct pga11x_settings_s *settings)
* for the part.
*/
- SPI_SELECT(spi, SPIDEV_MUX, true);
+ SPI_SELECT(spi, SPIDEV_MUX(0), true);
pga11x_send16(spi, PGA11X_CMD_READ);
pga11x_send16(spi, PGA11X_DCCMD_READ);
- SPI_SELECT(spi, SPIDEV_MUX, false);
+ SPI_SELECT(spi, SPIDEV_MUX(0), false);
/* Re-select, get the returned values, de-select, and unlock */
- SPI_SELECT(spi, SPIDEV_MUX, true);
+ SPI_SELECT(spi, SPIDEV_MUX(0), true);
u2value = pga11x_recv16(spi);
u1value = pga11x_recv16(spi);
- SPI_SELECT(spi, SPIDEV_MUX, false);
+ SPI_SELECT(spi, SPIDEV_MUX(0), false);
pga11x_unlock(spi);
/* Decode the returned value */
@@ -528,15 +528,15 @@ int pga11x_read(PGA11X_HANDLE handle, FAR struct pga11x_settings_s *settings)
* it is shown in the timing diagrams for the part.
*/
- SPI_SELECT(spi, SPIDEV_MUX, true);
+ SPI_SELECT(spi, SPIDEV_MUX(0), true);
pga11x_send16(spi, PGA11X_CMD_READ);
- SPI_SELECT(spi, SPIDEV_MUX, false);
+ SPI_SELECT(spi, SPIDEV_MUX(0), false);
/* Re-select, get the returned value, de-select, and unlock */
- SPI_SELECT(spi, SPIDEV_MUX, true);
+ SPI_SELECT(spi, SPIDEV_MUX(0), true);
value = pga11x_recv16(spi);
- SPI_SELECT(spi, SPIDEV_MUX, false);
+ SPI_SELECT(spi, SPIDEV_MUX(0), false);
pga11x_unlock(spi);
/* Decode the returned value */
diff --git a/drivers/audio/vs1053.c b/drivers/audio/vs1053.c
index 3582bf98e1..9c41e9fd78 100644
--- a/drivers/audio/vs1053.c
+++ b/drivers/audio/vs1053.c
@@ -292,7 +292,7 @@ static uint16_t vs1053_readreg(FAR struct vs1053_struct_s *dev, uint8_t reg)
/* Select the AUDIO_CTRL device on the SPI bus */
- SPI_SELECT(spi, SPIDEV_AUDIO_CTRL, true);
+ SPI_SELECT(spi, SPIDEV_AUDIO_CTRL(0), true);
/* Send the WRITE command followed by the address */
@@ -306,7 +306,7 @@ static uint16_t vs1053_readreg(FAR struct vs1053_struct_s *dev, uint8_t reg)
/* Deselect the CODEC */
- SPI_SELECT(spi, SPIDEV_AUDIO_CTRL, false);
+ SPI_SELECT(spi, SPIDEV_AUDIO_CTRL(0), false);
return ret;
}
@@ -324,7 +324,7 @@ static void vs1053_writereg(FAR struct vs1053_struct_s *dev, uint8_t reg, uint16
audinfo("Write Reg %d = 0x%0X\n", reg, val);
- SPI_SELECT(spi, SPIDEV_AUDIO_CTRL, true);
+ SPI_SELECT(spi, SPIDEV_AUDIO_CTRL(0), true);
/* Send the WRITE command followed by the address */
@@ -338,7 +338,7 @@ static void vs1053_writereg(FAR struct vs1053_struct_s *dev, uint8_t reg, uint16
/* Deselect the CODEC */
- SPI_SELECT(spi, SPIDEV_AUDIO_CTRL, false);
+ SPI_SELECT(spi, SPIDEV_AUDIO_CTRL(0), false);
/* Short delay after a write for VS1053 processing time */
@@ -955,7 +955,7 @@ static void vs1053_feeddata(FAR struct vs1053_struct_s *dev)
*/
vs1053_spi_lock(spi, VS1053_DATA_FREQ); /* Lock the SPI bus */
- SPI_SELECT(spi, SPIDEV_AUDIO_DATA, true); /* Select the VS1053 data bus */
+ SPI_SELECT(spi, SPIDEV_AUDIO_DATA(0), true); /* Select the VS1053 data bus */
/* Local stack copy of our active buffer */
@@ -970,7 +970,7 @@ static void vs1053_feeddata(FAR struct vs1053_struct_s *dev)
}
else if (!dev->endmode)
{
- SPI_SELECT(spi, SPIDEV_AUDIO_DATA, false);
+ SPI_SELECT(spi, SPIDEV_AUDIO_DATA(0), false);
vs1053_spi_unlock(spi);
return;
}
@@ -1194,7 +1194,7 @@ static void vs1053_feeddata(FAR struct vs1053_struct_s *dev)
/* Deselect the SPI bus and unlock it */
err_out:
- SPI_SELECT(spi, SPIDEV_AUDIO_DATA, false);
+ SPI_SELECT(spi, SPIDEV_AUDIO_DATA(0), false);
vs1053_spi_unlock(spi);
}
diff --git a/drivers/contactless/mfrc522.c b/drivers/contactless/mfrc522.c
index 804ea0fa4b..bf87bc31de 100644
--- a/drivers/contactless/mfrc522.c
+++ b/drivers/contactless/mfrc522.c
@@ -173,12 +173,12 @@ static inline void mfrc522_configspi(FAR struct spi_dev_s *spi)
static inline void mfrc522_select(struct mfrc522_dev_s *dev)
{
- SPI_SELECT(dev->spi, SPIDEV_CONTACTLESS, true);
+ SPI_SELECT(dev->spi, SPIDEV_CONTACTLESS(0), true);
}
static inline void mfrc522_deselect(struct mfrc522_dev_s *dev)
{
- SPI_SELECT(dev->spi, SPIDEV_CONTACTLESS, false);
+ SPI_SELECT(dev->spi, SPIDEV_CONTACTLESS(0), false);
}
/****************************************************************************
diff --git a/drivers/contactless/pn532.c b/drivers/contactless/pn532.c
index a7b2113181..974173350c 100644
--- a/drivers/contactless/pn532.c
+++ b/drivers/contactless/pn532.c
@@ -201,7 +201,7 @@ static inline void pn532_select(struct pn532_dev_s *dev)
}
else
{
- SPI_SELECT(dev->spi, SPIDEV_CONTACTLESS, true);
+ SPI_SELECT(dev->spi, SPIDEV_CONTACTLESS(0), true);
}
}
@@ -213,7 +213,7 @@ static inline void pn532_deselect(struct pn532_dev_s *dev)
}
else
{
- SPI_SELECT(dev->spi, SPIDEV_CONTACTLESS, false);
+ SPI_SELECT(dev->spi, SPIDEV_CONTACTLESS(0), false);
}
}
diff --git a/drivers/eeprom/spi_xx25xx.c b/drivers/eeprom/spi_xx25xx.c
index 437dfbea85..5fb5a37fdd 100644
--- a/drivers/eeprom/spi_xx25xx.c
+++ b/drivers/eeprom/spi_xx25xx.c
@@ -358,7 +358,7 @@ static void ee25xx_waitwritecomplete(struct ee25xx_dev_s *priv)
{
/* Select this FLASH part */
- SPI_SELECT(priv->spi, SPIDEV_EEPROM, true);
+ SPI_SELECT(priv->spi, SPIDEV_EEPROM(0), true);
/* Send "Read Status Register (RDSR)" command */
@@ -372,7 +372,7 @@ static void ee25xx_waitwritecomplete(struct ee25xx_dev_s *priv)
/* Deselect the FLASH */
- SPI_SELECT(priv->spi, SPIDEV_EEPROM, false);
+ SPI_SELECT(priv->spi, SPIDEV_EEPROM(0), false);
/* Given that writing could take up to a few milliseconds,
* the following short delay in the "busy" case will allow
@@ -401,11 +401,11 @@ static void ee25xx_waitwritecomplete(struct ee25xx_dev_s *priv)
static void ee25xx_writeenable(FAR struct spi_dev_s *spi, int enable)
{
ee25xx_lock(spi);
- SPI_SELECT(spi, SPIDEV_EEPROM, true);
+ SPI_SELECT(spi, SPIDEV_EEPROM(0), true);
SPI_SEND(spi, enable ? EE25XX_CMD_WREN : EE25XX_CMD_WRDIS);
- SPI_SELECT(spi, SPIDEV_EEPROM, false);
+ SPI_SELECT(spi, SPIDEV_EEPROM(0), false);
ee25xx_unlock(spi);
}
@@ -420,12 +420,12 @@ static void ee25xx_writepage(FAR struct ee25xx_dev_s *eedev, uint32_t devaddr,
FAR const char *data, size_t len)
{
ee25xx_lock(eedev->spi);
- SPI_SELECT(eedev->spi, SPIDEV_EEPROM, true);
+ SPI_SELECT(eedev->spi, SPIDEV_EEPROM(0), true);
ee25xx_sendcmd(eedev->spi, EE25XX_CMD_WRITE, eedev->addrlen, devaddr);
SPI_SNDBLOCK(eedev->spi, data, len);
- SPI_SELECT(eedev->spi, SPIDEV_EEPROM, false);
+ SPI_SELECT(eedev->spi, SPIDEV_EEPROM(0), false);
ee25xx_unlock(eedev->spi);
}
@@ -625,7 +625,7 @@ static ssize_t ee25xx_read(FAR struct file *filep, FAR char *buffer,
}
ee25xx_lock(eedev->spi);
- SPI_SELECT(eedev->spi, SPIDEV_EEPROM, true);
+ SPI_SELECT(eedev->spi, SPIDEV_EEPROM(0), true);
/* STM32F4Disco: There is a 25 us delay here */
@@ -637,7 +637,7 @@ static ssize_t ee25xx_read(FAR struct file *filep, FAR char *buffer,
/* STM32F4Disco: There is a 20 us delay here */
- SPI_SELECT(eedev->spi, SPIDEV_EEPROM, false);
+ SPI_SELECT(eedev->spi, SPIDEV_EEPROM(0), false);
ee25xx_unlock(eedev->spi);
/* Update the file position */
diff --git a/drivers/input/ads7843e.c b/drivers/input/ads7843e.c
index 820cb873f2..5b8dc4f542 100644
--- a/drivers/input/ads7843e.c
+++ b/drivers/input/ads7843e.c
@@ -189,12 +189,12 @@ static void ads7843e_lock(FAR struct spi_dev_s *spi)
* unlocked)
*/
- SPI_SELECT(spi, SPIDEV_TOUCHSCREEN, true);
+ SPI_SELECT(spi, SPIDEV_TOUCHSCREEN(0), true);
SPI_SETMODE(spi, CONFIG_ADS7843E_SPIMODE);
SPI_SETBITS(spi, 8);
(void)SPI_HWFEATURES(spi, 0);
(void)SPI_SETFREQUENCY(spi, CONFIG_ADS7843E_FREQUENCY);
- SPI_SELECT(spi, SPIDEV_TOUCHSCREEN, false);
+ SPI_SELECT(spi, SPIDEV_TOUCHSCREEN(0), false);
}
/****************************************************************************
@@ -263,7 +263,7 @@ static uint16_t ads7843e_sendcmd(FAR struct ads7843e_dev_s *priv, uint8_t cmd)
/* Select the ADS7843E */
- SPI_SELECT(priv->spi, SPIDEV_TOUCHSCREEN, true);
+ SPI_SELECT(priv->spi, SPIDEV_TOUCHSCREEN(0), true);
/* Send the command */
@@ -276,7 +276,7 @@ static uint16_t ads7843e_sendcmd(FAR struct ads7843e_dev_s *priv, uint8_t cmd)
/* Read the 12-bit data (LS 4 bits will be padded with zero) */
SPI_RECVBLOCK(priv->spi, buffer, 2);
- SPI_SELECT(priv->spi, SPIDEV_TOUCHSCREEN, false);
+ SPI_SELECT(priv->spi, SPIDEV_TOUCHSCREEN(0), false);
result = ((uint16_t)buffer[0] << 8) | (uint16_t)buffer[1];
result = result >> 4;
diff --git a/drivers/input/max11802.c b/drivers/input/max11802.c
index c3cd4c09f3..e190b5bc2e 100644
--- a/drivers/input/max11802.c
+++ b/drivers/input/max11802.c
@@ -231,7 +231,7 @@ static uint16_t max11802_sendcmd(FAR struct max11802_dev_s *priv,
/* Select the MAX11802 */
- SPI_SELECT(priv->spi, SPIDEV_TOUCHSCREEN, true);
+ SPI_SELECT(priv->spi, SPIDEV_TOUCHSCREEN(0), true);
/* Send the command */
@@ -240,7 +240,7 @@ static uint16_t max11802_sendcmd(FAR struct max11802_dev_s *priv,
/* Read the data */
SPI_RECVBLOCK(priv->spi, buffer, 2);
- SPI_SELECT(priv->spi, SPIDEV_TOUCHSCREEN, false);
+ SPI_SELECT(priv->spi, SPIDEV_TOUCHSCREEN(0), false);
result = ((uint16_t)buffer[0] << 8) | (uint16_t)buffer[1];
*tags = result & 0xF;
@@ -1225,32 +1225,32 @@ int max11802_register(FAR struct spi_dev_s *spi,
/* Configure MAX11802 registers */
- SPI_SELECT(priv->spi, SPIDEV_TOUCHSCREEN, true);
+ SPI_SELECT(priv->spi, SPIDEV_TOUCHSCREEN(0), true);
(void)SPI_SEND(priv->spi, MAX11802_CMD_MODE_WR);
(void)SPI_SEND(priv->spi, MAX11802_MODE);
- SPI_SELECT(priv->spi, SPIDEV_TOUCHSCREEN, false);
+ SPI_SELECT(priv->spi, SPIDEV_TOUCHSCREEN(0), false);
- SPI_SELECT(priv->spi, SPIDEV_TOUCHSCREEN, true);
+ SPI_SELECT(priv->spi, SPIDEV_TOUCHSCREEN(0), true);
(void)SPI_SEND(priv->spi, MAX11802_CMD_AVG_WR);
(void)SPI_SEND(priv->spi, MAX11802_AVG);
- SPI_SELECT(priv->spi, SPIDEV_TOUCHSCREEN, false);
+ SPI_SELECT(priv->spi, SPIDEV_TOUCHSCREEN(0), false);
- SPI_SELECT(priv->spi, SPIDEV_TOUCHSCREEN, true);
+ SPI_SELECT(priv->spi, SPIDEV_TOUCHSCREEN(0), true);
(void)SPI_SEND(priv->spi, MAX11802_CMD_TIMING_WR);
(void)SPI_SEND(priv->spi, MAX11802_TIMING);
- SPI_SELECT(priv->spi, SPIDEV_TOUCHSCREEN, false);
+ SPI_SELECT(priv->spi, SPIDEV_TOUCHSCREEN(0), false);
- SPI_SELECT(priv->spi, SPIDEV_TOUCHSCREEN, true);
+ SPI_SELECT(priv->spi, SPIDEV_TOUCHSCREEN(0), true);
(void)SPI_SEND(priv->spi, MAX11802_CMD_DELAY_WR);
(void)SPI_SEND(priv->spi, MAX11802_DELAY);
- SPI_SELECT(priv->spi, SPIDEV_TOUCHSCREEN, false);
+ SPI_SELECT(priv->spi, SPIDEV_TOUCHSCREEN(0), false);
/* Test that the device access was successful. */
- SPI_SELECT(priv->spi, SPIDEV_TOUCHSCREEN, true);
+ SPI_SELECT(priv->spi, SPIDEV_TOUCHSCREEN(0), true);
(void)SPI_SEND(priv->spi, MAX11802_CMD_MODE_RD);
ret = SPI_SEND(priv->spi, 0);
- SPI_SELECT(priv->spi, SPIDEV_TOUCHSCREEN, false);
+ SPI_SELECT(priv->spi, SPIDEV_TOUCHSCREEN(0), false);
/* Unlock the bus */
diff --git a/drivers/lcd/memlcd.c b/drivers/lcd/memlcd.c
index a7b192acae..7cd379ca5b 100644
--- a/drivers/lcd/memlcd.c
+++ b/drivers/lcd/memlcd.c
@@ -285,7 +285,7 @@ static void memlcd_select(FAR struct spi_dev_s *spi)
*/
SPI_LOCK(spi, true);
- SPI_SELECT(spi, SPIDEV_DISPLAY, true);
+ SPI_SELECT(spi, SPIDEV_DISPLAY(0), true);
/* Now make sure that the SPI bus is configured for the memlcd (it
* might have gotten configured for a different device while unlocked)
@@ -327,7 +327,7 @@ static void memlcd_deselect(FAR struct spi_dev_s *spi)
{
/* De-select memlcd and relinquish the spi bus. */
- SPI_SELECT(spi, SPIDEV_DISPLAY, false);
+ SPI_SELECT(spi, SPIDEV_DISPLAY(0), false);
SPI_LOCK(spi, false);
}
diff --git a/drivers/lcd/nokia6100.c b/drivers/lcd/nokia6100.c
index b67af2bada..cc28e027f7 100644
--- a/drivers/lcd/nokia6100.c
+++ b/drivers/lcd/nokia6100.c
@@ -661,7 +661,7 @@ static void nokia_select(FAR struct spi_dev_s *spi)
lcdinfo("SELECTED\n");
SPI_LOCK(spi, true);
- SPI_SELECT(spi, SPIDEV_DISPLAY, true);
+ SPI_SELECT(spi, SPIDEV_DISPLAY(0), true);
/* Now make sure that the SPI bus is configured for the Nokia 6100 (it
* might have gotten configured for a different device while unlocked)
@@ -695,7 +695,7 @@ static void nokia_deselect(FAR struct spi_dev_s *spi)
lcdinfo("DE-SELECTED\n");
- SPI_SELECT(spi, SPIDEV_DISPLAY, false);
+ SPI_SELECT(spi, SPIDEV_DISPLAY(0), false);
SPI_LOCK(spi, false);
}
diff --git a/drivers/lcd/p14201.c b/drivers/lcd/p14201.c
index 147e6414ed..4461502c4f 100644
--- a/drivers/lcd/p14201.c
+++ b/drivers/lcd/p14201.c
@@ -449,7 +449,7 @@ static void rit_select(FAR struct spi_dev_s *spi)
*/
SPI_LOCK(spi, true);
- SPI_SELECT(spi, SPIDEV_DISPLAY, true);
+ SPI_SELECT(spi, SPIDEV_DISPLAY(0), true);
/* Now make sure that the SPI bus is configured for the P14201 (it
* might have gotten configured for a different device while unlocked)
@@ -483,7 +483,7 @@ static void rit_deselect(FAR struct spi_dev_s *spi)
{
/* De-select P14201 chip and relinquish the SPI bus. */
- SPI_SELECT(spi, SPIDEV_DISPLAY, false);
+ SPI_SELECT(spi, SPIDEV_DISPLAY(0), false);
SPI_LOCK(spi, false);
}
@@ -518,7 +518,7 @@ static void rit_sndbytes(FAR struct rit_dev_s *priv, FAR const uint8_t *buffer,
/* Clear/set the D/Cn bit to enable command or data mode */
- (void)SPI_CMDDATA(spi, SPIDEV_DISPLAY, cmd);
+ (void)SPI_CMDDATA(spi, SPIDEV_DISPLAY(0), cmd);
/* Loop until the entire command/data block is transferred */
diff --git a/drivers/lcd/ssd1306_spi.c b/drivers/lcd/ssd1306_spi.c
index 9a547b8a16..e7a59b7cbf 100644
--- a/drivers/lcd/ssd1306_spi.c
+++ b/drivers/lcd/ssd1306_spi.c
@@ -130,7 +130,7 @@ void ssd1306_select(FAR struct ssd1306_dev_s *priv, bool cs)
/* Select/deselect SPI device */
- SPI_SELECT(priv->spi, SPIDEV_DISPLAY, cs);
+ SPI_SELECT(priv->spi, SPIDEV_DISPLAY(0), cs);
/* If we are deselecting the device */
@@ -154,6 +154,6 @@ void ssd1306_cmddata(FAR struct ssd1306_dev_s *priv, bool cmd)
{
/* Select command transfer */
- SPI_CMDDATA(priv->spi, SPIDEV_DISPLAY, cmd);
+ SPI_CMDDATA(priv->spi, SPIDEV_DISPLAY(0), cmd);
}
#endif /* CONFIG_LCD_SSD1306 && CONFIG_LCD_SSD1306_SPI */
diff --git a/drivers/lcd/ssd1351.c b/drivers/lcd/ssd1351.c
index f88c85ff85..791040eee5 100644
--- a/drivers/lcd/ssd1351.c
+++ b/drivers/lcd/ssd1351.c
@@ -502,7 +502,7 @@ static void ssd1351_select(FAR struct ssd1351_dev_s *priv)
ginfo("SELECTED\n");
SPI_LOCK(spi, true);
- SPI_SELECT(spi, SPIDEV_DISPLAY, true);
+ SPI_SELECT(spi, SPIDEV_DISPLAY(0), true);
/* Now make sure that the SPI bus is configured for this device (it might
* have gotten configured for a different device while unlocked)
@@ -532,7 +532,7 @@ static void ssd1351_deselect(FAR struct ssd1351_dev_s *priv)
ginfo("DE-SELECTED\n");
- SPI_SELECT(spi, SPIDEV_DISPLAY, false);
+ SPI_SELECT(spi, SPIDEV_DISPLAY(0), false);
SPI_LOCK(spi, false);
}
#endif
@@ -648,7 +648,7 @@ static void ssd1351_write(FAR struct ssd1351_dev_s *priv, uint8_t cmd,
/* Select command transfer */
- (void)SPI_CMDDATA(spi, SPIDEV_DISPLAY, true);
+ (void)SPI_CMDDATA(spi, SPIDEV_DISPLAY(0), true);
/* Send the command */
@@ -660,7 +660,7 @@ static void ssd1351_write(FAR struct ssd1351_dev_s *priv, uint8_t cmd,
{
/* Yes, select data transfer */
- (void)SPI_CMDDATA(spi, SPIDEV_DISPLAY, false);
+ (void)SPI_CMDDATA(spi, SPIDEV_DISPLAY(0), false);
/* Transfer all of the data */
diff --git a/drivers/lcd/st7567.c b/drivers/lcd/st7567.c
index c95ffaa8a3..5de10bb7c3 100644
--- a/drivers/lcd/st7567.c
+++ b/drivers/lcd/st7567.c
@@ -365,7 +365,7 @@ static void st7567_select(FAR struct spi_dev_s *spi)
*/
SPI_LOCK(spi, true);
- SPI_SELECT(spi, SPIDEV_DISPLAY, true);
+ SPI_SELECT(spi, SPIDEV_DISPLAY(0), true);
/* Now make sure that the SPI bus is configured for the ST7567 (it
* might have gotten configured for a different device while unlocked)
@@ -399,7 +399,7 @@ static void st7567_deselect(FAR struct spi_dev_s *spi)
{
/* De-select ST7567 chip and relinquish the SPI bus. */
- SPI_SELECT(spi, SPIDEV_DISPLAY, false);
+ SPI_SELECT(spi, SPIDEV_DISPLAY(0), false);
SPI_LOCK(spi, false);
}
@@ -530,7 +530,7 @@ static int st7567_putrun(fb_coord_t row, fb_coord_t col, FAR const uint8_t *buff
/* Select command transfer */
- SPI_CMDDATA(priv->spi, SPIDEV_DISPLAY, true);
+ SPI_CMDDATA(priv->spi, SPIDEV_DISPLAY(0), true);
/* Set the starting position for the run */
@@ -540,7 +540,7 @@ static int st7567_putrun(fb_coord_t row, fb_coord_t col, FAR const uint8_t *buff
/* Select data transfer */
- SPI_CMDDATA(priv->spi, SPIDEV_DISPLAY, false);
+ SPI_CMDDATA(priv->spi, SPIDEV_DISPLAY(0), false);
/* Then transfer all of the data */
@@ -812,7 +812,7 @@ static int st7567_setcontrast(struct lcd_dev_s *dev, unsigned int contrast)
/* Select command transfer */
- SPI_CMDDATA(priv->spi, SPIDEV_DISPLAY, true);
+ SPI_CMDDATA(priv->spi, SPIDEV_DISPLAY(0), true);
/* Set the contrast */
@@ -854,7 +854,7 @@ static inline void up_clear(FAR struct st7567_dev_s *priv)
{
/* Select command transfer */
- SPI_CMDDATA(spi, SPIDEV_DISPLAY, true);
+ SPI_CMDDATA(spi, SPIDEV_DISPLAY(0), true);
/* Set the starting position for the run */
@@ -864,7 +864,7 @@ static inline void up_clear(FAR struct st7567_dev_s *priv)
/* Select data transfer */
- SPI_CMDDATA(spi, SPIDEV_DISPLAY, false);
+ SPI_CMDDATA(spi, SPIDEV_DISPLAY(0), false);
/* Then transfer all 96 columns of data */
@@ -924,7 +924,7 @@ FAR struct lcd_dev_s *st7567_initialize(FAR struct spi_dev_s *spi, unsigned int
/* Select command transfer */
- SPI_CMDDATA(spi, SPIDEV_DISPLAY, true);
+ SPI_CMDDATA(spi, SPIDEV_DISPLAY(0), true);
/* Set the starting position for the run */
diff --git a/drivers/lcd/ug-2864ambag01.c b/drivers/lcd/ug-2864ambag01.c
index ea6175a856..1e6484f256 100644
--- a/drivers/lcd/ug-2864ambag01.c
+++ b/drivers/lcd/ug-2864ambag01.c
@@ -622,11 +622,11 @@ static int ug2864ambag01_putrun(fb_coord_t row, fb_coord_t col, FAR const uint8_
/* Lock and select device */
ug2864ambag01_lock(priv->spi);
- SPI_SELECT(priv->spi, SPIDEV_DISPLAY, true);
+ SPI_SELECT(priv->spi, SPIDEV_DISPLAY(0), true);
/* Select command transfer */
- SPI_CMDDATA(priv->spi, SPIDEV_DISPLAY, true);
+ SPI_CMDDATA(priv->spi, SPIDEV_DISPLAY(0), true);
/* Set the starting position for the run */
/* Set the column address to the XOFFSET value */
@@ -640,7 +640,7 @@ static int ug2864ambag01_putrun(fb_coord_t row, fb_coord_t col, FAR const uint8_
/* Select data transfer */
- SPI_CMDDATA(priv->spi, SPIDEV_DISPLAY, false);
+ SPI_CMDDATA(priv->spi, SPIDEV_DISPLAY(0), false);
/* Then transfer all of the data */
@@ -648,7 +648,7 @@ static int ug2864ambag01_putrun(fb_coord_t row, fb_coord_t col, FAR const uint8_
/* De-select and unlock the device */
- SPI_SELECT(priv->spi, SPIDEV_DISPLAY, false);
+ SPI_SELECT(priv->spi, SPIDEV_DISPLAY(0), false);
ug2864ambag01_unlock(priv->spi);
return OK;
}
@@ -892,7 +892,7 @@ static int ug2864ambag01_setpower(struct lcd_dev_s *dev, int power)
/* Lock and select device */
ug2864ambag01_lock(priv->spi);
- SPI_SELECT(priv->spi, SPIDEV_DISPLAY, true);
+ SPI_SELECT(priv->spi, SPIDEV_DISPLAY(0), true);
if (power <= 0)
{
@@ -911,7 +911,7 @@ static int ug2864ambag01_setpower(struct lcd_dev_s *dev, int power)
/* De-select and unlock the device */
- SPI_SELECT(priv->spi, SPIDEV_DISPLAY, false);
+ SPI_SELECT(priv->spi, SPIDEV_DISPLAY(0), false);
ug2864ambag01_unlock(priv->spi);
return OK;
}
@@ -971,11 +971,11 @@ static int ug2864ambag01_setcontrast(struct lcd_dev_s *dev, unsigned int contras
/* Lock and select device */
ug2864ambag01_lock(priv->spi);
- SPI_SELECT(priv->spi, SPIDEV_DISPLAY, true);
+ SPI_SELECT(priv->spi, SPIDEV_DISPLAY(0), true);
/* Select command transfer */
- SPI_CMDDATA(priv->spi, SPIDEV_DISPLAY, true);
+ SPI_CMDDATA(priv->spi, SPIDEV_DISPLAY(0), true);
/* Set the contrast */
@@ -985,7 +985,7 @@ static int ug2864ambag01_setcontrast(struct lcd_dev_s *dev, unsigned int contras
/* De-select and unlock the device */
- SPI_SELECT(priv->spi, SPIDEV_DISPLAY, false);
+ SPI_SELECT(priv->spi, SPIDEV_DISPLAY(0), false);
ug2864ambag01_unlock(priv->spi);
return OK;
}
@@ -1029,11 +1029,11 @@ FAR struct lcd_dev_s *ug2864ambag01_initialize(FAR struct spi_dev_s *spi, unsign
/* Lock and select device */
ug2864ambag01_lock(priv->spi);
- SPI_SELECT(spi, SPIDEV_DISPLAY, true);
+ SPI_SELECT(spi, SPIDEV_DISPLAY(0), true);
/* Select command transfer */
- SPI_CMDDATA(spi, SPIDEV_DISPLAY, true);
+ SPI_CMDDATA(spi, SPIDEV_DISPLAY(0), true);
/* Configure the device */
@@ -1064,7 +1064,7 @@ FAR struct lcd_dev_s *ug2864ambag01_initialize(FAR struct spi_dev_s *spi, unsign
/* De-select and unlock the device */
- SPI_SELECT(spi, SPIDEV_DISPLAY, false);
+ SPI_SELECT(spi, SPIDEV_DISPLAY(0), false);
ug2864ambag01_unlock(priv->spi);
/* Clear the display */
@@ -1112,7 +1112,7 @@ void ug2864ambag01_fill(FAR struct lcd_dev_s *dev, uint8_t color)
/* Lock and select device */
ug2864ambag01_lock(priv->spi);
- SPI_SELECT(priv->spi, SPIDEV_DISPLAY, true);
+ SPI_SELECT(priv->spi, SPIDEV_DISPLAY(0), true);
/* Visit each page */
@@ -1120,7 +1120,7 @@ void ug2864ambag01_fill(FAR struct lcd_dev_s *dev, uint8_t color)
{
/* Select command transfer */
- SPI_CMDDATA(priv->spi, SPIDEV_DISPLAY, true);
+ SPI_CMDDATA(priv->spi, SPIDEV_DISPLAY(0), true);
/* Set the column address to the XOFFSET value */
@@ -1133,7 +1133,7 @@ void ug2864ambag01_fill(FAR struct lcd_dev_s *dev, uint8_t color)
/* Select data transfer */
- SPI_CMDDATA(priv->spi, SPIDEV_DISPLAY, false);
+ SPI_CMDDATA(priv->spi, SPIDEV_DISPLAY(0), false);
/* Transfer one page of the selected color */
@@ -1143,7 +1143,7 @@ void ug2864ambag01_fill(FAR struct lcd_dev_s *dev, uint8_t color)
/* De-select and unlock the device */
- SPI_SELECT(priv->spi, SPIDEV_DISPLAY, false);
+ SPI_SELECT(priv->spi, SPIDEV_DISPLAY(0), false);
ug2864ambag01_unlock(priv->spi);
}
diff --git a/drivers/lcd/ug-9664hswag01.c b/drivers/lcd/ug-9664hswag01.c
index f56c8f7cd1..96d09aea99 100644
--- a/drivers/lcd/ug-9664hswag01.c
+++ b/drivers/lcd/ug-9664hswag01.c
@@ -399,7 +399,7 @@ static void ug_select(FAR struct spi_dev_s *spi)
*/
SPI_LOCK(spi, true);
- SPI_SELECT(spi, SPIDEV_DISPLAY, true);
+ SPI_SELECT(spi, SPIDEV_DISPLAY(0), true);
/* Now make sure that the SPI bus is configured for the UG-9664HSWAG01 (it
* might have gotten configured for a different device while unlocked)
@@ -433,7 +433,7 @@ static void ug_deselect(FAR struct spi_dev_s *spi)
{
/* De-select UG-9664HSWAG01 chip and relinquish the SPI bus. */
- SPI_SELECT(spi, SPIDEV_DISPLAY, false);
+ SPI_SELECT(spi, SPIDEV_DISPLAY(0), false);
SPI_LOCK(spi, false);
}
@@ -614,7 +614,7 @@ static int ug_putrun(fb_coord_t row, fb_coord_t col, FAR const uint8_t *buffer,
/* Select command transfer */
- SPI_CMDDATA(priv->spi, SPIDEV_DISPLAY, true);
+ SPI_CMDDATA(priv->spi, SPIDEV_DISPLAY(0), true);
/* Set the starting position for the run */
@@ -624,7 +624,7 @@ static int ug_putrun(fb_coord_t row, fb_coord_t col, FAR const uint8_t *buffer,
/* Select data transfer */
- SPI_CMDDATA(priv->spi, SPIDEV_DISPLAY, false);
+ SPI_CMDDATA(priv->spi, SPIDEV_DISPLAY(0), false);
/* Then transfer all of the data */
@@ -943,7 +943,7 @@ static int ug_setcontrast(struct lcd_dev_s *dev, unsigned int contrast)
/* Select command transfer */
- SPI_CMDDATA(priv->spi, SPIDEV_DISPLAY, true);
+ SPI_CMDDATA(priv->spi, SPIDEV_DISPLAY(0), true);
/* Set the contrast */
@@ -985,7 +985,7 @@ static inline void up_clear(FAR struct ug_dev_s *priv)
{
/* Select command transfer */
- SPI_CMDDATA(spi, SPIDEV_DISPLAY, true);
+ SPI_CMDDATA(spi, SPIDEV_DISPLAY(0), true);
/* Set the starting position for the run */
@@ -995,7 +995,7 @@ static inline void up_clear(FAR struct ug_dev_s *priv)
/* Select data transfer */
- SPI_CMDDATA(spi, SPIDEV_DISPLAY, false);
+ SPI_CMDDATA(spi, SPIDEV_DISPLAY(0), false);
/* Then transfer all 96 columns of data */
@@ -1055,7 +1055,7 @@ FAR struct lcd_dev_s *ug_initialize(FAR struct spi_dev_s *spi, unsigned int devn
/* Select command transfer */
- SPI_CMDDATA(spi, SPIDEV_DISPLAY, true);
+ SPI_CMDDATA(spi, SPIDEV_DISPLAY(0), true);
/* Configure the device */
diff --git a/drivers/mmcsd/mmcsd_spi.c b/drivers/mmcsd/mmcsd_spi.c
index 2a4cdee73d..7bf4ecdee1 100644
--- a/drivers/mmcsd/mmcsd_spi.c
+++ b/drivers/mmcsd/mmcsd_spi.c
@@ -842,7 +842,7 @@ static void mmcsd_checkwrprotect(FAR struct mmcsd_slot_s *slot, uint8_t *csd)
* reports temporary write protect.
*/
- if ((SPI_STATUS(spi, SPIDEV_MMCSD) & SPI_STATUS_WRPROTECTED) != 0 ||
+ if ((SPI_STATUS(spi, SPIDEV_MMCSD(0)) & SPI_STATUS_WRPROTECTED) != 0 ||
MMCSD_CSD_PERMWRITEPROTECT(csd) ||
MMCSD_CSD_TMPWRITEPROTECT(csd))
{
@@ -1056,7 +1056,7 @@ static int mmcsd_open(FAR struct inode *inode)
ret = -ENODEV;
mmcsd_semtake(slot);
- if ((SPI_STATUS(spi, SPIDEV_MMCSD) & SPI_STATUS_PRESENT) != 0)
+ if ((SPI_STATUS(spi, SPIDEV_MMCSD(0)) & SPI_STATUS_PRESENT) != 0)
{
/* Yes.. a card is present. Has it been initialized? */
@@ -1074,9 +1074,9 @@ static int mmcsd_open(FAR struct inode *inode)
/* Make sure that the card is ready */
- SPI_SELECT(spi, SPIDEV_MMCSD, true);
+ SPI_SELECT(spi, SPIDEV_MMCSD(0), true);
ret = mmcsd_waitready(slot);
- SPI_SELECT(spi, SPIDEV_MMCSD, false);
+ SPI_SELECT(spi, SPIDEV_MMCSD(0), false);
}
errout_with_sem:
@@ -1177,7 +1177,7 @@ static ssize_t mmcsd_read(FAR struct inode *inode, unsigned char *buffer,
/* Select the slave */
mmcsd_semtake(slot);
- SPI_SELECT(spi, SPIDEV_MMCSD, true);
+ SPI_SELECT(spi, SPIDEV_MMCSD(0), true);
/* Single or multiple block read? */
@@ -1235,7 +1235,7 @@ static ssize_t mmcsd_read(FAR struct inode *inode, unsigned char *buffer,
/* On success, return the number of sectors transfer */
- SPI_SELECT(spi, SPIDEV_MMCSD, false);
+ SPI_SELECT(spi, SPIDEV_MMCSD(0), false);
SPI_SEND(spi, 0xff);
mmcsd_semgive(slot);
@@ -1244,7 +1244,7 @@ static ssize_t mmcsd_read(FAR struct inode *inode, unsigned char *buffer,
return nsectors;
errout_with_eio:
- SPI_SELECT(spi, SPIDEV_MMCSD, false);
+ SPI_SELECT(spi, SPIDEV_MMCSD(0), false);
mmcsd_semgive(slot);
return -EIO;
}
@@ -1341,7 +1341,7 @@ static ssize_t mmcsd_write(FAR struct inode *inode, const unsigned char *buffer,
/* Select the slave */
mmcsd_semtake(slot);
- SPI_SELECT(spi, SPIDEV_MMCSD, true);
+ SPI_SELECT(spi, SPIDEV_MMCSD(0), true);
/* Single or multiple block transfer? */
@@ -1422,7 +1422,7 @@ static ssize_t mmcsd_write(FAR struct inode *inode, const unsigned char *buffer,
/* Wait until the card is no longer busy */
(void)mmcsd_waitready(slot);
- SPI_SELECT(spi, SPIDEV_MMCSD, false);
+ SPI_SELECT(spi, SPIDEV_MMCSD(0), false);
SPI_SEND(spi, 0xff);
mmcsd_semgive(slot);
@@ -1431,7 +1431,7 @@ static ssize_t mmcsd_write(FAR struct inode *inode, const unsigned char *buffer,
return nsectors;
errout_with_sem:
- SPI_SELECT(spi, SPIDEV_MMCSD, false);
+ SPI_SELECT(spi, SPIDEV_MMCSD(0), false);
mmcsd_semgive(slot);
return -EIO;
}
@@ -1482,9 +1482,9 @@ static int mmcsd_geometry(FAR struct inode *inode, struct geometry *geometry)
/* Re-sample the CSD */
mmcsd_semtake(slot);
- SPI_SELECT(spi, SPIDEV_MMCSD, true);
+ SPI_SELECT(spi, SPIDEV_MMCSD(0), true);
ret = mmcsd_getcsd(slot, csd);
- SPI_SELECT(spi, SPIDEV_MMCSD, false);
+ SPI_SELECT(spi, SPIDEV_MMCSD(0), false);
if (ret < 0)
{
@@ -1564,7 +1564,7 @@ static int mmcsd_mediainitialize(FAR struct mmcsd_slot_s *slot)
* interface
*/
- if ((SPI_STATUS(spi, SPIDEV_MMCSD) & SPI_STATUS_PRESENT) == 0)
+ if ((SPI_STATUS(spi, SPIDEV_MMCSD(0)) & SPI_STATUS_PRESENT) == 0)
{
fwarn("WARNING: No card present\n");
slot->state |= MMCSD_SLOTSTATUS_NODISK;
@@ -1602,7 +1602,7 @@ static int mmcsd_mediainitialize(FAR struct mmcsd_slot_s *slot)
*/
finfo("Send CMD0\n");
- SPI_SELECT(spi, SPIDEV_MMCSD, true);
+ SPI_SELECT(spi, SPIDEV_MMCSD(0), true);
result = mmcsd_sendcmd(slot, &g_cmd0, 0);
if (result == MMCSD_SPIR1_IDLESTATE)
{
@@ -1614,7 +1614,7 @@ static int mmcsd_mediainitialize(FAR struct mmcsd_slot_s *slot)
/* De-select card and try again */
- SPI_SELECT(spi, SPIDEV_MMCSD, false);
+ SPI_SELECT(spi, SPIDEV_MMCSD(0), false);
}
/* Verify that we exit the above loop with the card reporting IDLE state */
@@ -1622,7 +1622,7 @@ static int mmcsd_mediainitialize(FAR struct mmcsd_slot_s *slot)
if (result != MMCSD_SPIR1_IDLESTATE)
{
ferr("ERROR: Send CMD0 failed: R1=%02x\n", result);
- SPI_SELECT(spi, SPIDEV_MMCSD, false);
+ SPI_SELECT(spi, SPIDEV_MMCSD(0), false);
mmcsd_semgive(slot);
return -EIO;
}
@@ -1749,7 +1749,7 @@ static int mmcsd_mediainitialize(FAR struct mmcsd_slot_s *slot)
if (elapsed >= MMCSD_DELAY_1SEC)
{
ferr("ERROR: Failed to exit IDLE state\n");
- SPI_SELECT(spi, SPIDEV_MMCSD, false);
+ SPI_SELECT(spi, SPIDEV_MMCSD(0), false);
mmcsd_semgive(slot);
return -EIO;
}
@@ -1758,7 +1758,7 @@ static int mmcsd_mediainitialize(FAR struct mmcsd_slot_s *slot)
if (slot->type == MMCSD_CARDTYPE_UNKNOWN)
{
ferr("ERROR: Failed to identify card\n");
- SPI_SELECT(spi, SPIDEV_MMCSD, false);
+ SPI_SELECT(spi, SPIDEV_MMCSD(0), false);
mmcsd_semgive(slot);
return -EIO;
}
@@ -1770,7 +1770,7 @@ static int mmcsd_mediainitialize(FAR struct mmcsd_slot_s *slot)
if (result != OK)
{
ferr("ERROR: mmcsd_getcsd(CMD9) failed: %d\n", result);
- SPI_SELECT(spi, SPIDEV_MMCSD, false);
+ SPI_SELECT(spi, SPIDEV_MMCSD(0), false);
mmcsd_semgive(slot);
return -EIO;
}
@@ -1814,7 +1814,7 @@ static int mmcsd_mediainitialize(FAR struct mmcsd_slot_s *slot)
#endif
slot->state &= ~MMCSD_SLOTSTATUS_NOTREADY;
- SPI_SELECT(spi, SPIDEV_MMCSD, false);
+ SPI_SELECT(spi, SPIDEV_MMCSD(0), false);
return OK;
}
@@ -1853,7 +1853,7 @@ static void mmcsd_mediachanged(void *arg)
slot->state &= ~(MMCSD_SLOTSTATUS_NODISK | MMCSD_SLOTSTATUS_NOTREADY |
MMCSD_SLOTSTATUS_MEDIACHGD);
- if ((SPI_STATUS(spi, SPIDEV_MMCSD) & SPI_STATUS_PRESENT) == 0)
+ if ((SPI_STATUS(spi, SPIDEV_MMCSD(0)) & SPI_STATUS_PRESENT) == 0)
{
/* Media is not present */
diff --git a/drivers/mtd/at24xx.c b/drivers/mtd/at24xx.c
index 936008a567..b9076c0846 100644
--- a/drivers/mtd/at24xx.c
+++ b/drivers/mtd/at24xx.c
@@ -641,7 +641,7 @@ FAR struct mtd_dev_s *at24c_initialize(FAR struct i2c_master_s *dev)
/* Allocate a state structure (we allocate the structure instead of using
* a fixed, static allocation so that we can handle multiple FLASH devices.
* The current implementation would handle only one FLASH part per I2C
- * device (only because of the SPIDEV_FLASH definition) and so would have
+ * device (only because of the SPIDEV_FLASH(0) definition) and so would have
* to be extended to handle multiple FLASH parts on the same I2C bus.
*/
diff --git a/drivers/mtd/at25.c b/drivers/mtd/at25.c
index 777ff3877f..c499ca2a55 100644
--- a/drivers/mtd/at25.c
+++ b/drivers/mtd/at25.c
@@ -218,7 +218,7 @@ static inline int at25_readid(struct at25_dev_s *priv)
/* Lock the SPI bus, configure the bus, and select this FLASH part. */
at25_lock(priv->dev);
- SPI_SELECT(priv->dev, SPIDEV_FLASH, true);
+ SPI_SELECT(priv->dev, SPIDEV_FLASH(0), true);
/* Send the "Read ID (RDID)" command and read the first three ID bytes */
@@ -228,7 +228,7 @@ static inline int at25_readid(struct at25_dev_s *priv)
/* Deselect the FLASH and unlock the bus */
- SPI_SELECT(priv->dev, SPIDEV_FLASH, false);
+ SPI_SELECT(priv->dev, SPIDEV_FLASH(0), false);
at25_unlock(priv->dev);
finfo("manufacturer: %02x memory: %02x\n",
@@ -262,7 +262,7 @@ static void at25_waitwritecomplete(struct at25_dev_s *priv)
{
/* Select this FLASH part */
- SPI_SELECT(priv->dev, SPIDEV_FLASH, true);
+ SPI_SELECT(priv->dev, SPIDEV_FLASH(0), true);
/* Send "Read Status Register (RDSR)" command */
@@ -274,7 +274,7 @@ static void at25_waitwritecomplete(struct at25_dev_s *priv)
/* Deselect the FLASH */
- SPI_SELECT(priv->dev, SPIDEV_FLASH, false);
+ SPI_SELECT(priv->dev, SPIDEV_FLASH(0), false);
/* Given that writing could take up to few tens of milliseconds, and erasing
* could take more. The following short delay in the "busy" case will allow
@@ -304,9 +304,9 @@ static void at25_waitwritecomplete(struct at25_dev_s *priv)
static void at25_writeenable(struct at25_dev_s *priv)
{
- SPI_SELECT(priv->dev, SPIDEV_FLASH, true);
+ SPI_SELECT(priv->dev, SPIDEV_FLASH(0), true);
(void)SPI_SEND(priv->dev, AT25_WREN);
- SPI_SELECT(priv->dev, SPIDEV_FLASH, false);
+ SPI_SELECT(priv->dev, SPIDEV_FLASH(0), false);
finfo("Enabled\n");
}
@@ -334,7 +334,7 @@ static inline void at25_sectorerase(struct at25_dev_s *priv, off_t sector)
/* Select this FLASH part */
- SPI_SELECT(priv->dev, SPIDEV_FLASH, true);
+ SPI_SELECT(priv->dev, SPIDEV_FLASH(0), true);
/* Send the "Sector Erase (SE)" instruction */
@@ -351,7 +351,7 @@ static inline void at25_sectorerase(struct at25_dev_s *priv, off_t sector)
/* Deselect the FLASH */
- SPI_SELECT(priv->dev, SPIDEV_FLASH, false);
+ SPI_SELECT(priv->dev, SPIDEV_FLASH(0), false);
finfo("Erased\n");
}
@@ -377,7 +377,7 @@ static inline int at25_bulkerase(struct at25_dev_s *priv)
/* Select this FLASH part */
- SPI_SELECT(priv->dev, SPIDEV_FLASH, true);
+ SPI_SELECT(priv->dev, SPIDEV_FLASH(0), true);
/* Send the "Bulk Erase (BE)" instruction */
@@ -385,7 +385,7 @@ static inline int at25_bulkerase(struct at25_dev_s *priv)
/* Deselect the FLASH */
- SPI_SELECT(priv->dev, SPIDEV_FLASH, false);
+ SPI_SELECT(priv->dev, SPIDEV_FLASH(0), false);
finfo("Return: OK\n");
return OK;
}
@@ -415,7 +415,7 @@ static inline void at25_pagewrite(struct at25_dev_s *priv, FAR const uint8_t *bu
/* Select this FLASH part */
- SPI_SELECT(priv->dev, SPIDEV_FLASH, true);
+ SPI_SELECT(priv->dev, SPIDEV_FLASH(0), true);
/* Send "Page Program (PP)" command */
@@ -433,7 +433,7 @@ static inline void at25_pagewrite(struct at25_dev_s *priv, FAR const uint8_t *bu
/* Deselect the FLASH: Chip Select high */
- SPI_SELECT(priv->dev, SPIDEV_FLASH, false);
+ SPI_SELECT(priv->dev, SPIDEV_FLASH(0), false);
finfo("Written\n");
}
@@ -535,7 +535,7 @@ static ssize_t at25_read(FAR struct mtd_dev_s *dev, off_t offset, size_t nbytes,
/* Lock the SPI bus and select this FLASH part */
at25_lock(priv->dev);
- SPI_SELECT(priv->dev, SPIDEV_FLASH, true);
+ SPI_SELECT(priv->dev, SPIDEV_FLASH(0), true);
/* Send "Read from Memory " instruction */
@@ -553,7 +553,7 @@ static ssize_t at25_read(FAR struct mtd_dev_s *dev, off_t offset, size_t nbytes,
/* Deselect the FLASH and unlock the SPI bus */
- SPI_SELECT(priv->dev, SPIDEV_FLASH, false);
+ SPI_SELECT(priv->dev, SPIDEV_FLASH(0), false);
at25_unlock(priv->dev);
finfo("return nbytes: %d\n", (int)nbytes);
@@ -642,7 +642,7 @@ FAR struct mtd_dev_s *at25_initialize(FAR struct spi_dev_s *dev)
/* Allocate a state structure (we allocate the structure instead of using
* a fixed, static allocation so that we can handle multiple FLASH devices.
* The current implementation would handle only one FLASH part per SPI
- * device (only because of the SPIDEV_FLASH definition) and so would have
+ * device (only because of the SPIDEV_FLASH(0) definition) and so would have
* to be extended to handle multiple FLASH parts on the same SPI bus.
*/
@@ -662,7 +662,7 @@ FAR struct mtd_dev_s *at25_initialize(FAR struct spi_dev_s *dev)
/* Deselect the FLASH */
- SPI_SELECT(dev, SPIDEV_FLASH, false);
+ SPI_SELECT(dev, SPIDEV_FLASH(0), false);
/* Identify the FLASH chip and get its capacity */
@@ -680,10 +680,10 @@ FAR struct mtd_dev_s *at25_initialize(FAR struct spi_dev_s *dev)
/* Unprotect all sectors */
at25_writeenable(priv);
- SPI_SELECT(priv->dev, SPIDEV_FLASH, true);
+ SPI_SELECT(priv->dev, SPIDEV_FLASH(0), true);
(void)SPI_SEND(priv->dev, AT25_WRSR);
(void)SPI_SEND(priv->dev, AT25_SR_UNPROT);
- SPI_SELECT(priv->dev, SPIDEV_FLASH, false);
+ SPI_SELECT(priv->dev, SPIDEV_FLASH(0), false);
}
}
diff --git a/drivers/mtd/at45db.c b/drivers/mtd/at45db.c
index 4219c0d3b9..7f4a3f8bb9 100644
--- a/drivers/mtd/at45db.c
+++ b/drivers/mtd/at45db.c
@@ -312,9 +312,9 @@ static inline void at45db_unlock(FAR struct at45db_dev_s *priv)
#ifdef CONFIG_AT45DB_PWRSAVE
static void at45db_pwrdown(FAR struct at45db_dev_s *priv)
{
- SPI_SELECT(priv->spi, SPIDEV_FLASH, true);
+ SPI_SELECT(priv->spi, SPIDEV_FLASH(0), true);
SPI_SEND(priv->spi, AT45DB_PWRDOWN);
- SPI_SELECT(priv->spi, SPIDEV_FLASH, false);
+ SPI_SELECT(priv->spi, SPIDEV_FLASH(0), false);
}
#endif
@@ -325,9 +325,9 @@ static void at45db_pwrdown(FAR struct at45db_dev_s *priv)
#ifdef CONFIG_AT45DB_PWRSAVE
static void at45db_resume(FAR struct at45db_dev_s *priv)
{
- SPI_SELECT(priv->spi, SPIDEV_FLASH, true);
+ SPI_SELECT(priv->spi, SPIDEV_FLASH(0), true);
SPI_SEND(priv->spi, AT45DB_RESUME);
- SPI_SELECT(priv->spi, SPIDEV_FLASH, false);
+ SPI_SELECT(priv->spi, SPIDEV_FLASH(0), false);
up_udelay(50);
}
#endif
@@ -347,7 +347,7 @@ static inline int at45db_rdid(FAR struct at45db_dev_s *priv)
* locked the bus for exclusive access)
*/
- SPI_SELECT(priv->spi, SPIDEV_FLASH, true);
+ SPI_SELECT(priv->spi, SPIDEV_FLASH(0), true);
/* Send the " Manufacturer and Device ID Read" command and read the next three
* ID bytes from the FLASH.
@@ -358,7 +358,7 @@ static inline int at45db_rdid(FAR struct at45db_dev_s *priv)
/* Deselect the FLASH */
- SPI_SELECT(priv->spi, SPIDEV_FLASH, false);
+ SPI_SELECT(priv->spi, SPIDEV_FLASH(0), false);
finfo("manufacturer: %02x devid1: %02x devid2: %02x\n",
devid[0], devid[1], devid[2]);
@@ -438,10 +438,10 @@ static inline uint8_t at45db_rdsr(FAR struct at45db_dev_s *priv)
{
uint8_t retval;
- SPI_SELECT(priv->spi, SPIDEV_FLASH, true);
+ SPI_SELECT(priv->spi, SPIDEV_FLASH(0), true);
SPI_SEND(priv->spi, AT45DB_RDSR);
retval = SPI_SEND(priv->spi, 0xff);
- SPI_SELECT(priv->spi, SPIDEV_FLASH, false);
+ SPI_SELECT(priv->spi, SPIDEV_FLASH(0), false);
return retval;
}
@@ -503,9 +503,9 @@ static inline void at45db_pgerase(FAR struct at45db_dev_s *priv, off_t sector)
/* Erase the page */
- SPI_SELECT(priv->spi, SPIDEV_FLASH, true);
+ SPI_SELECT(priv->spi, SPIDEV_FLASH(0), true);
SPI_SNDBLOCK(priv->spi, erasecmd, 4);
- SPI_SELECT(priv->spi, SPIDEV_FLASH, false);
+ SPI_SELECT(priv->spi, SPIDEV_FLASH(0), false);
/* Wait for any erase to complete if we are not trying to improve write
* performance. (see comments above).
@@ -545,9 +545,9 @@ static inline int at32db_chiperase(FAR struct at45db_dev_s *priv)
* down...
*/
- SPI_SELECT(priv->spi, SPIDEV_FLASH, true);
+ SPI_SELECT(priv->spi, SPIDEV_FLASH(0), true);
SPI_SNDBLOCK(priv->spi, g_chiperase, CHIP_ERASE_SIZE);
- SPI_SELECT(priv->spi, SPIDEV_FLASH, false);
+ SPI_SELECT(priv->spi, SPIDEV_FLASH(0), false);
/* Wait for any erase to complete if we are not trying to improve write
* performance. (see comments above).
@@ -589,10 +589,10 @@ static inline void at45db_pgwrite(FAR struct at45db_dev_s *priv,
at45db_waitbusy(priv);
#endif
- SPI_SELECT(priv->spi, SPIDEV_FLASH, true);
+ SPI_SELECT(priv->spi, SPIDEV_FLASH(0), true);
SPI_SNDBLOCK(priv->spi, wrcmd, 4);
SPI_SNDBLOCK(priv->spi, buffer, 1 << priv->pageshift);
- SPI_SELECT(priv->spi, SPIDEV_FLASH, false);
+ SPI_SELECT(priv->spi, SPIDEV_FLASH(0), false);
/* Wait for any erase to complete if we are not trying to improve write
* performance. (see comments above).
@@ -733,10 +733,10 @@ static ssize_t at45db_read(FAR struct mtd_dev_s *mtd, off_t offset, size_t nbyte
/* Perform the read */
- SPI_SELECT(priv->spi, SPIDEV_FLASH, true);
+ SPI_SELECT(priv->spi, SPIDEV_FLASH(0), true);
SPI_SNDBLOCK(priv->spi, rdcmd, 5);
SPI_RECVBLOCK(priv->spi, buffer, nbytes);
- SPI_SELECT(priv->spi, SPIDEV_FLASH, false);
+ SPI_SELECT(priv->spi, SPIDEV_FLASH(0), false);
at45db_pwrdown(priv);
at45db_unlock(priv);
@@ -835,7 +835,7 @@ FAR struct mtd_dev_s *at45db_initialize(FAR struct spi_dev_s *spi)
/* Allocate a state structure (we allocate the structure instead of using a fixed,
* static allocation so that we can handle multiple FLASH devices. The current
* implementation would handle only one FLASH part per SPI device (only because
- * of the SPIDEV_FLASH definition) and so would have to be extended to handle
+ * of the SPIDEV_FLASH(0) definition) and so would have to be extended to handle
* multiple FLASH parts on the same SPI bus.
*/
@@ -855,7 +855,7 @@ FAR struct mtd_dev_s *at45db_initialize(FAR struct spi_dev_s *spi)
/* Deselect the FLASH */
- SPI_SELECT(spi, SPIDEV_FLASH, false);
+ SPI_SELECT(spi, SPIDEV_FLASH(0), false);
/* Lock and configure the SPI bus. */
@@ -889,9 +889,9 @@ FAR struct mtd_dev_s *at45db_initialize(FAR struct spi_dev_s *spi)
fwarn("WARNING: Reprogramming page size\n");
- SPI_SELECT(priv->spi, SPIDEV_FLASH, true);
+ SPI_SELECT(priv->spi, SPIDEV_FLASH(0), true);
SPI_SNDBLOCK(priv->spi, g_binpgsize, BINPGSIZE_SIZE);
- SPI_SELECT(priv->spi, SPIDEV_FLASH, false);
+ SPI_SELECT(priv->spi, SPIDEV_FLASH(0), false);
goto errout;
}
diff --git a/drivers/mtd/is25xp.c b/drivers/mtd/is25xp.c
index 55b677b38a..3ce5e3f0ce 100644
--- a/drivers/mtd/is25xp.c
+++ b/drivers/mtd/is25xp.c
@@ -253,7 +253,7 @@ static inline int is25xp_readid(struct is25xp_dev_s *priv)
/* Lock the SPI bus, configure the bus, and select this FLASH part. */
is25xp_lock(priv->dev);
- SPI_SELECT(priv->dev, SPIDEV_FLASH, true);
+ SPI_SELECT(priv->dev, SPIDEV_FLASH(0), true);
/* Send the "Read ID (RDID)" command and read the first three ID bytes */
@@ -264,7 +264,7 @@ static inline int is25xp_readid(struct is25xp_dev_s *priv)
/* Deselect the FLASH and unlock the bus */
- SPI_SELECT(priv->dev, SPIDEV_FLASH, false);
+ SPI_SELECT(priv->dev, SPIDEV_FLASH(0), false);
is25xp_unlock(priv->dev);
finfo("manufacturer: %02x memory: %02x capacity: %02x\n",
@@ -324,7 +324,7 @@ static void is25xp_waitwritecomplete(struct is25xp_dev_s *priv)
/* Select this FLASH part */
- SPI_SELECT(priv->dev, SPIDEV_FLASH, true);
+ SPI_SELECT(priv->dev, SPIDEV_FLASH(0), true);
/* Send "Read Status Register (RDSR)" command */
@@ -342,7 +342,7 @@ static void is25xp_waitwritecomplete(struct is25xp_dev_s *priv)
/* Deselect the FLASH */
- SPI_SELECT(priv->dev, SPIDEV_FLASH, false);
+ SPI_SELECT(priv->dev, SPIDEV_FLASH(0), false);
#else
@@ -352,7 +352,7 @@ static void is25xp_waitwritecomplete(struct is25xp_dev_s *priv)
{
/* Select this FLASH part */
- SPI_SELECT(priv->dev, SPIDEV_FLASH, true);
+ SPI_SELECT(priv->dev, SPIDEV_FLASH(0), true);
/* Send "Read Status Register (RDSR)" command */
@@ -364,7 +364,7 @@ static void is25xp_waitwritecomplete(struct is25xp_dev_s *priv)
/* Deselect the FLASH */
- SPI_SELECT(priv->dev, SPIDEV_FLASH, false);
+ SPI_SELECT(priv->dev, SPIDEV_FLASH(0), false);
/* Given that writing could take up to few tens of milliseconds, and erasing
* could take more. The following short delay in the "busy" case will allow
@@ -394,7 +394,7 @@ static void is25xp_writeenable(struct is25xp_dev_s *priv)
{
/* Select this FLASH part */
- SPI_SELECT(priv->dev, SPIDEV_FLASH, true);
+ SPI_SELECT(priv->dev, SPIDEV_FLASH(0), true);
/* Send "Write Enable (WREN)" command */
@@ -402,7 +402,7 @@ static void is25xp_writeenable(struct is25xp_dev_s *priv)
/* Deselect the FLASH */
- SPI_SELECT(priv->dev, SPIDEV_FLASH, false);
+ SPI_SELECT(priv->dev, SPIDEV_FLASH(0), false);
finfo("Enabled\n");
}
@@ -418,14 +418,14 @@ static void is25xp_unprotect(struct is25xp_dev_s *priv)
/* Send "Write status (WRSR)" */
- SPI_SELECT(priv->dev, SPIDEV_FLASH, true);
+ SPI_SELECT(priv->dev, SPIDEV_FLASH(0), true);
SPI_SEND(priv->dev, IS25_WRSR);
/* Followed by the new status value */
SPI_SEND(priv->dev, 0);
- SPI_SELECT(priv->dev, SPIDEV_FLASH, false);
+ SPI_SELECT(priv->dev, SPIDEV_FLASH(0), false);
}
/************************************************************************************
@@ -454,7 +454,7 @@ static void is25xp_sectorerase(struct is25xp_dev_s *priv, off_t sector, uint8_t
/* Select this FLASH part */
- SPI_SELECT(priv->dev, SPIDEV_FLASH, true);
+ SPI_SELECT(priv->dev, SPIDEV_FLASH(0), true);
/* Send the "Sector Erase (SE)" or Sub-Sector Erase (SSE) instruction
* that was passed in as the erase type.
@@ -474,7 +474,7 @@ static void is25xp_sectorerase(struct is25xp_dev_s *priv, off_t sector, uint8_t
/* Deselect the FLASH */
- SPI_SELECT(priv->dev, SPIDEV_FLASH, false);
+ SPI_SELECT(priv->dev, SPIDEV_FLASH(0), false);
finfo("Erased\n");
}
@@ -500,7 +500,7 @@ static inline int is25xp_bulkerase(struct is25xp_dev_s *priv)
/* Select this FLASH part */
- SPI_SELECT(priv->dev, SPIDEV_FLASH, true);
+ SPI_SELECT(priv->dev, SPIDEV_FLASH(0), true);
/* Send the "Chip Erase (CER)" instruction */
@@ -508,7 +508,7 @@ static inline int is25xp_bulkerase(struct is25xp_dev_s *priv)
/* Deselect the FLASH */
- SPI_SELECT(priv->dev, SPIDEV_FLASH, false);
+ SPI_SELECT(priv->dev, SPIDEV_FLASH(0), false);
is25xp_waitwritecomplete(priv);
finfo("Return: OK\n");
@@ -540,7 +540,7 @@ static inline void is25xp_pagewrite(struct is25xp_dev_s *priv, FAR const uint8_t
/* Select this FLASH part */
- SPI_SELECT(priv->dev, SPIDEV_FLASH, true);
+ SPI_SELECT(priv->dev, SPIDEV_FLASH(0), true);
/* Send "Page Program (PP)" command */
@@ -559,7 +559,7 @@ static inline void is25xp_pagewrite(struct is25xp_dev_s *priv, FAR const uint8_t
/* Deselect the FLASH: Chip Select high */
- SPI_SELECT(priv->dev, SPIDEV_FLASH, false);
+ SPI_SELECT(priv->dev, SPIDEV_FLASH(0), false);
finfo("Written\n");
}
@@ -587,7 +587,7 @@ static inline void is25xp_bytewrite(struct is25xp_dev_s *priv, FAR const uint8_t
/* Select this FLASH part */
- SPI_SELECT(priv->dev, SPIDEV_FLASH, true);
+ SPI_SELECT(priv->dev, SPIDEV_FLASH(0), true);
/* Send "Page Program (PP)" command */
@@ -606,7 +606,7 @@ static inline void is25xp_bytewrite(struct is25xp_dev_s *priv, FAR const uint8_t
/* Deselect the FLASH: Chip Select high */
- SPI_SELECT(priv->dev, SPIDEV_FLASH, false);
+ SPI_SELECT(priv->dev, SPIDEV_FLASH(0), false);
finfo("Written\n");
}
#endif
@@ -762,7 +762,7 @@ static ssize_t is25xp_read(FAR struct mtd_dev_s *dev, off_t offset, size_t nbyte
/* Lock the SPI bus and select this FLASH part */
is25xp_lock(priv->dev);
- SPI_SELECT(priv->dev, SPIDEV_FLASH, true);
+ SPI_SELECT(priv->dev, SPIDEV_FLASH(0), true);
/* Send "Read from Memory " instruction */
@@ -780,7 +780,7 @@ static ssize_t is25xp_read(FAR struct mtd_dev_s *dev, off_t offset, size_t nbyte
/* Deselect the FLASH and unlock the SPI bus */
- SPI_SELECT(priv->dev, SPIDEV_FLASH, false);
+ SPI_SELECT(priv->dev, SPIDEV_FLASH(0), false);
is25xp_unlock(priv->dev);
finfo("return nbytes: %d\n", (int)nbytes);
return nbytes;
@@ -943,7 +943,7 @@ FAR struct mtd_dev_s *is25xp_initialize(FAR struct spi_dev_s *dev)
/* Allocate a state structure (we allocate the structure instead of using
* a fixed, static allocation so that we can handle multiple FLASH devices.
* The current implementation would handle only one FLASH part per SPI
- * device (only because of the SPIDEV_FLASH definition) and so would have
+ * device (only because of the SPIDEV_FLASH(0) definition) and so would have
* to be extended to handle multiple FLASH parts on the same SPI bus.
*/
@@ -967,7 +967,7 @@ FAR struct mtd_dev_s *is25xp_initialize(FAR struct spi_dev_s *dev)
/* Deselect the FLASH */
- SPI_SELECT(dev, SPIDEV_FLASH, false);
+ SPI_SELECT(dev, SPIDEV_FLASH(0), false);
/* Identify the FLASH chip and get its capacity */
diff --git a/drivers/mtd/m25px.c b/drivers/mtd/m25px.c
index 4402995afb..2ce37d2e38 100644
--- a/drivers/mtd/m25px.c
+++ b/drivers/mtd/m25px.c
@@ -317,7 +317,7 @@ static inline int m25p_readid(struct m25p_dev_s *priv)
/* Lock the SPI bus, configure the bus, and select this FLASH part. */
m25p_lock(priv->dev);
- SPI_SELECT(priv->dev, SPIDEV_FLASH, true);
+ SPI_SELECT(priv->dev, SPIDEV_FLASH(0), true);
/* Send the "Read ID (RDID)" command and read the first three ID bytes */
@@ -328,7 +328,7 @@ static inline int m25p_readid(struct m25p_dev_s *priv)
/* Deselect the FLASH and unlock the bus */
- SPI_SELECT(priv->dev, SPIDEV_FLASH, false);
+ SPI_SELECT(priv->dev, SPIDEV_FLASH(0), false);
m25p_unlock(priv->dev);
finfo("manufacturer: %02x memory: %02x capacity: %02x\n",
@@ -432,7 +432,7 @@ static void m25p_waitwritecomplete(struct m25p_dev_s *priv)
{
/* Select this FLASH part */
- SPI_SELECT(priv->dev, SPIDEV_FLASH, true);
+ SPI_SELECT(priv->dev, SPIDEV_FLASH(0), true);
/* Send "Read Status Register (RDSR)" command */
@@ -444,7 +444,7 @@ static void m25p_waitwritecomplete(struct m25p_dev_s *priv)
/* Deselect the FLASH */
- SPI_SELECT(priv->dev, SPIDEV_FLASH, false);
+ SPI_SELECT(priv->dev, SPIDEV_FLASH(0), false);
/* Given that writing could take up to few tens of milliseconds, and erasing
* could take more. The following short delay in the "busy" case will allow
@@ -471,7 +471,7 @@ static void m25p_writeenable(struct m25p_dev_s *priv)
{
/* Select this FLASH part */
- SPI_SELECT(priv->dev, SPIDEV_FLASH, true);
+ SPI_SELECT(priv->dev, SPIDEV_FLASH(0), true);
/* Send "Write Enable (WREN)" command */
@@ -479,7 +479,7 @@ static void m25p_writeenable(struct m25p_dev_s *priv)
/* Deselect the FLASH */
- SPI_SELECT(priv->dev, SPIDEV_FLASH, false);
+ SPI_SELECT(priv->dev, SPIDEV_FLASH(0), false);
finfo("Enabled\n");
}
@@ -518,7 +518,7 @@ static void m25p_sectorerase(struct m25p_dev_s *priv, off_t sector, uint8_t type
/* Select this FLASH part */
- SPI_SELECT(priv->dev, SPIDEV_FLASH, true);
+ SPI_SELECT(priv->dev, SPIDEV_FLASH(0), true);
/* Send the "Sector Erase (SE)" or Sub-Sector Erase (SSE) instruction
* that was passed in as the erase type.
@@ -537,7 +537,7 @@ static void m25p_sectorerase(struct m25p_dev_s *priv, off_t sector, uint8_t type
/* Deselect the FLASH */
- SPI_SELECT(priv->dev, SPIDEV_FLASH, false);
+ SPI_SELECT(priv->dev, SPIDEV_FLASH(0), false);
finfo("Erased\n");
}
@@ -563,7 +563,7 @@ static inline int m25p_bulkerase(struct m25p_dev_s *priv)
/* Select this FLASH part */
- SPI_SELECT(priv->dev, SPIDEV_FLASH, true);
+ SPI_SELECT(priv->dev, SPIDEV_FLASH(0), true);
/* Send the "Bulk Erase (BE)" instruction */
@@ -571,7 +571,7 @@ static inline int m25p_bulkerase(struct m25p_dev_s *priv)
/* Deselect the FLASH */
- SPI_SELECT(priv->dev, SPIDEV_FLASH, false);
+ SPI_SELECT(priv->dev, SPIDEV_FLASH(0), false);
finfo("Return: OK\n");
return OK;
}
@@ -601,7 +601,7 @@ static inline void m25p_pagewrite(struct m25p_dev_s *priv, FAR const uint8_t *bu
/* Select this FLASH part */
- SPI_SELECT(priv->dev, SPIDEV_FLASH, true);
+ SPI_SELECT(priv->dev, SPIDEV_FLASH(0), true);
/* Send "Page Program (PP)" command */
@@ -619,7 +619,7 @@ static inline void m25p_pagewrite(struct m25p_dev_s *priv, FAR const uint8_t *bu
/* Deselect the FLASH: Chip Select high */
- SPI_SELECT(priv->dev, SPIDEV_FLASH, false);
+ SPI_SELECT(priv->dev, SPIDEV_FLASH(0), false);
finfo("Written\n");
}
@@ -647,7 +647,7 @@ static inline void m25p_bytewrite(struct m25p_dev_s *priv, FAR const uint8_t *bu
/* Select this FLASH part */
- SPI_SELECT(priv->dev, SPIDEV_FLASH, true);
+ SPI_SELECT(priv->dev, SPIDEV_FLASH(0), true);
/* Send "Page Program (PP)" command */
@@ -665,7 +665,7 @@ static inline void m25p_bytewrite(struct m25p_dev_s *priv, FAR const uint8_t *bu
/* Deselect the FLASH: Chip Select high */
- SPI_SELECT(priv->dev, SPIDEV_FLASH, false);
+ SPI_SELECT(priv->dev, SPIDEV_FLASH(0), false);
finfo("Written\n");
}
#endif
@@ -809,7 +809,7 @@ static ssize_t m25p_read(FAR struct mtd_dev_s *dev, off_t offset, size_t nbytes,
/* Lock the SPI bus and select this FLASH part */
m25p_lock(priv->dev);
- SPI_SELECT(priv->dev, SPIDEV_FLASH, true);
+ SPI_SELECT(priv->dev, SPIDEV_FLASH(0), true);
/* Send "Read from Memory " instruction */
@@ -827,7 +827,7 @@ static ssize_t m25p_read(FAR struct mtd_dev_s *dev, off_t offset, size_t nbytes,
/* Deselect the FLASH and unlock the SPI bus */
- SPI_SELECT(priv->dev, SPIDEV_FLASH, false);
+ SPI_SELECT(priv->dev, SPIDEV_FLASH(0), false);
m25p_unlock(priv->dev);
finfo("return nbytes: %d\n", (int)nbytes);
return nbytes;
@@ -999,7 +999,7 @@ FAR struct mtd_dev_s *m25p_initialize(FAR struct spi_dev_s *dev)
/* Allocate a state structure (we allocate the structure instead of using
* a fixed, static allocation so that we can handle multiple FLASH devices.
* The current implementation would handle only one FLASH part per SPI
- * device (only because of the SPIDEV_FLASH definition) and so would have
+ * device (only because of the SPIDEV_FLASH(0) definition) and so would have
* to be extended to handle multiple FLASH parts on the same SPI bus.
*/
@@ -1022,7 +1022,7 @@ FAR struct mtd_dev_s *m25p_initialize(FAR struct spi_dev_s *dev)
/* Deselect the FLASH */
- SPI_SELECT(dev, SPIDEV_FLASH, false);
+ SPI_SELECT(dev, SPIDEV_FLASH(0), false);
/* Identify the FLASH chip and get its capacity */
diff --git a/drivers/mtd/mtd_rwbuffer.c b/drivers/mtd/mtd_rwbuffer.c
index 8d2ffc2d47..b775b67cfd 100644
--- a/drivers/mtd/mtd_rwbuffer.c
+++ b/drivers/mtd/mtd_rwbuffer.c
@@ -352,7 +352,7 @@ FAR struct mtd_dev_s *mtd_rwb_initialize(FAR struct mtd_dev_s *mtd)
/* Allocate a state structure (we allocate the structure instead of using
* a fixed, static allocation so that we can handle multiple FLASH devices.
* The current implementation would handle only one FLASH part per SPI
- * device (only because of the SPIDEV_FLASH definition) and so would have
+ * device (only because of the SPIDEV_FLASH(0) definition) and so would have
* to be extended to handle multiple FLASH parts on the same SPI bus.
*/
diff --git a/drivers/mtd/mx25lx.c b/drivers/mtd/mx25lx.c
index 47c447cf1b..ae4833691d 100644
--- a/drivers/mtd/mx25lx.c
+++ b/drivers/mtd/mx25lx.c
@@ -314,7 +314,7 @@ static inline int mx25l_readid(FAR struct mx25l_dev_s *priv)
/* Lock the SPI bus, configure the bus, and select this FLASH part. */
mx25l_lock(priv->dev);
- SPI_SELECT(priv->dev, SPIDEV_FLASH, true);
+ SPI_SELECT(priv->dev, SPIDEV_FLASH(0), true);
/* Send the "Read ID (RDID)" command and read the first three ID bytes */
@@ -325,7 +325,7 @@ static inline int mx25l_readid(FAR struct mx25l_dev_s *priv)
/* Deselect the FLASH and unlock the bus */
- SPI_SELECT(priv->dev, SPIDEV_FLASH, false);
+ SPI_SELECT(priv->dev, SPIDEV_FLASH(0), false);
mx25l_unlock(priv->dev);
mxlinfo("manufacturer: %02x memory: %02x capacity: %02x\n",
@@ -374,7 +374,7 @@ static void mx25l_waitwritecomplete(FAR struct mx25l_dev_s *priv)
{
/* Select this FLASH part */
- SPI_SELECT(priv->dev, SPIDEV_FLASH, true);
+ SPI_SELECT(priv->dev, SPIDEV_FLASH(0), true);
/* Send "Read Status Register (RDSR)" command */
@@ -386,7 +386,7 @@ static void mx25l_waitwritecomplete(FAR struct mx25l_dev_s *priv)
/* Deselect the FLASH */
- SPI_SELECT(priv->dev, SPIDEV_FLASH, false);
+ SPI_SELECT(priv->dev, SPIDEV_FLASH(0), false);
/* Given that writing could take up to few tens of milliseconds, and erasing
* could take more. The following short delay in the "busy" case will allow
@@ -413,7 +413,7 @@ static void mx25l_writeenable(FAR struct mx25l_dev_s *priv)
{
/* Select this FLASH part */
- SPI_SELECT(priv->dev, SPIDEV_FLASH, true);
+ SPI_SELECT(priv->dev, SPIDEV_FLASH(0), true);
/* Send "Write Enable (WREN)" command */
@@ -421,7 +421,7 @@ static void mx25l_writeenable(FAR struct mx25l_dev_s *priv)
/* Deselect the FLASH */
- SPI_SELECT(priv->dev, SPIDEV_FLASH, false);
+ SPI_SELECT(priv->dev, SPIDEV_FLASH(0), false);
mxlinfo("Enabled\n");
}
@@ -434,7 +434,7 @@ static void mx25l_writedisable(FAR struct mx25l_dev_s *priv)
{
/* Select this FLASH part */
- SPI_SELECT(priv->dev, SPIDEV_FLASH, true);
+ SPI_SELECT(priv->dev, SPIDEV_FLASH(0), true);
/* Send "Write Disable (WRDI)" command */
@@ -442,7 +442,7 @@ static void mx25l_writedisable(FAR struct mx25l_dev_s *priv)
/* Deselect the FLASH */
- SPI_SELECT(priv->dev, SPIDEV_FLASH, false);
+ SPI_SELECT(priv->dev, SPIDEV_FLASH(0), false);
mxlinfo("Disabled\n");
}
@@ -465,7 +465,7 @@ static void mx25l_sectorerase(FAR struct mx25l_dev_s *priv, off_t sector)
/* Select this FLASH part */
- SPI_SELECT(priv->dev, SPIDEV_FLASH, true);
+ SPI_SELECT(priv->dev, SPIDEV_FLASH(0), true);
/* Send the "Sector Erase (SE)" or "Block Erase (BE)" instruction
* that was passed in as the erase type.
@@ -484,7 +484,7 @@ static void mx25l_sectorerase(FAR struct mx25l_dev_s *priv, off_t sector)
/* Deselect the FLASH */
- SPI_SELECT(priv->dev, SPIDEV_FLASH, false);
+ SPI_SELECT(priv->dev, SPIDEV_FLASH(0), false);
mx25l_waitwritecomplete(priv);
@@ -505,7 +505,7 @@ static inline int mx25l_chiperase(FAR struct mx25l_dev_s *priv)
/* Select this FLASH part */
- SPI_SELECT(priv->dev, SPIDEV_FLASH, true);
+ SPI_SELECT(priv->dev, SPIDEV_FLASH(0), true);
/* Send the "Chip Erase (CE)" instruction */
@@ -513,7 +513,7 @@ static inline int mx25l_chiperase(FAR struct mx25l_dev_s *priv)
/* Deselect the FLASH */
- SPI_SELECT(priv->dev, SPIDEV_FLASH, false);
+ SPI_SELECT(priv->dev, SPIDEV_FLASH(0), false);
mx25l_waitwritecomplete(priv);
@@ -540,7 +540,7 @@ static void mx25l_byteread(FAR struct mx25l_dev_s *priv, FAR uint8_t *buffer,
/* Select this FLASH part */
- SPI_SELECT(priv->dev, SPIDEV_FLASH, true);
+ SPI_SELECT(priv->dev, SPIDEV_FLASH(0), true);
/* Send "Read from Memory " instruction */
@@ -562,7 +562,7 @@ static void mx25l_byteread(FAR struct mx25l_dev_s *priv, FAR uint8_t *buffer,
/* Deselect the FLASH */
- SPI_SELECT(priv->dev, SPIDEV_FLASH, false);
+ SPI_SELECT(priv->dev, SPIDEV_FLASH(0), false);
}
/************************************************************************************
@@ -583,7 +583,7 @@ static inline void mx25l_pagewrite(FAR struct mx25l_dev_s *priv,
/* Select this FLASH part */
- SPI_SELECT(priv->dev, SPIDEV_FLASH, true);
+ SPI_SELECT(priv->dev, SPIDEV_FLASH(0), true);
/* Send the "Page Program (MX25L_PP)" Command */
@@ -601,7 +601,7 @@ static inline void mx25l_pagewrite(FAR struct mx25l_dev_s *priv,
/* Deselect the FLASH and setup for the next pass through the loop */
- SPI_SELECT(priv->dev, SPIDEV_FLASH, false);
+ SPI_SELECT(priv->dev, SPIDEV_FLASH(0), false);
/* Wait for any preceding write or erase operation to complete. */
@@ -988,7 +988,7 @@ FAR struct mtd_dev_s *mx25l_initialize_spi(FAR struct spi_dev_s *dev)
/* Allocate a state structure (we allocate the structure instead of using
* a fixed, static allocation so that we can handle multiple FLASH devices.
* The current implementation would handle only one FLASH part per SPI
- * device (only because of the SPIDEV_FLASH definition) and so would have
+ * device (only because of the SPIDEV_FLASH(0) definition) and so would have
* to be extended to handle multiple FLASH parts on the same SPI bus.
*/
@@ -1008,7 +1008,7 @@ FAR struct mtd_dev_s *mx25l_initialize_spi(FAR struct spi_dev_s *dev)
/* Deselect the FLASH */
- SPI_SELECT(dev, SPIDEV_FLASH, false);
+ SPI_SELECT(dev, SPIDEV_FLASH(0), false);
/* Identify the FLASH chip and get its capacity */
diff --git a/drivers/mtd/n25qxxx.c b/drivers/mtd/n25qxxx.c
index e5272f47ed..3ed07ac808 100644
--- a/drivers/mtd/n25qxxx.c
+++ b/drivers/mtd/n25qxxx.c
@@ -1406,7 +1406,7 @@ FAR struct mtd_dev_s *n25qxxx_initialize(FAR struct qspi_dev_s *qspi, bool unpro
/* Allocate a state structure (we allocate the structure instead of using
* a fixed, static allocation so that we can handle multiple FLASH devices.
* The current implementation would handle only one FLASH part per QuadSPI
- * device (only because of the QSPIDEV_FLASH definition) and so would have
+ * device (only because of the QSPIDEV_FLASH(0) definition) and so would have
* to be extended to handle multiple FLASH parts on the same QuadSPI bus.
*/
diff --git a/drivers/mtd/ramtron.c b/drivers/mtd/ramtron.c
index 236084fb79..ee07d18e07 100644
--- a/drivers/mtd/ramtron.c
+++ b/drivers/mtd/ramtron.c
@@ -381,7 +381,7 @@ static inline int ramtron_readid(struct ramtron_dev_s *priv)
/* Lock the SPI bus, configure the bus, and select this FLASH part. */
ramtron_lock(priv);
- SPI_SELECT(priv->dev, SPIDEV_FLASH, true);
+ SPI_SELECT(priv->dev, SPIDEV_FLASH(0), true);
/* Send the "Read ID (RDID)" command */
@@ -411,7 +411,7 @@ static inline int ramtron_readid(struct ramtron_dev_s *priv)
/* Deselect the FLASH and unlock the bus */
- SPI_SELECT(priv->dev, SPIDEV_FLASH, false);
+ SPI_SELECT(priv->dev, SPIDEV_FLASH(0), false);
ramtron_unlock(priv->dev);
/* Select part from the part list */
@@ -452,7 +452,7 @@ static int ramtron_waitwritecomplete(struct ramtron_dev_s *priv)
/* Select this FLASH part */
- SPI_SELECT(priv->dev, SPIDEV_FLASH, true);
+ SPI_SELECT(priv->dev, SPIDEV_FLASH(0), true);
/* Send "Read Status Register (RDSR)" command */
@@ -475,7 +475,7 @@ static int ramtron_waitwritecomplete(struct ramtron_dev_s *priv)
/* Deselect the FLASH */
- SPI_SELECT(priv->dev, SPIDEV_FLASH, false);
+ SPI_SELECT(priv->dev, SPIDEV_FLASH(0), false);
if (retries > 0)
{
@@ -499,7 +499,7 @@ static void ramtron_writeenable(struct ramtron_dev_s *priv)
{
/* Select this FLASH part */
- SPI_SELECT(priv->dev, SPIDEV_FLASH, true);
+ SPI_SELECT(priv->dev, SPIDEV_FLASH(0), true);
/* Send "Write Enable (WREN)" command */
@@ -507,7 +507,7 @@ static void ramtron_writeenable(struct ramtron_dev_s *priv)
/* Deselect the FLASH */
- SPI_SELECT(priv->dev, SPIDEV_FLASH, false);
+ SPI_SELECT(priv->dev, SPIDEV_FLASH(0), false);
finfo("Enabled\n");
}
@@ -555,7 +555,7 @@ static inline int ramtron_pagewrite(struct ramtron_dev_s *priv, FAR const uint8_
/* Select this FLASH part */
- SPI_SELECT(priv->dev, SPIDEV_FLASH, true);
+ SPI_SELECT(priv->dev, SPIDEV_FLASH(0), true);
/* Send "Page Program (PP)" command */
@@ -571,7 +571,7 @@ static inline int ramtron_pagewrite(struct ramtron_dev_s *priv, FAR const uint8_
/* Deselect the FLASH: Chip Select high */
- SPI_SELECT(priv->dev, SPIDEV_FLASH, false);
+ SPI_SELECT(priv->dev, SPIDEV_FLASH(0), false);
finfo("Written\n");
#ifdef CONFIG_RAMTRON_WRITEWAIT
@@ -676,7 +676,7 @@ static ssize_t ramtron_read(FAR struct mtd_dev_s *dev, off_t offset, size_t nbyt
/* Lock the SPI bus and select this FLASH part */
ramtron_lock(priv);
- SPI_SELECT(priv->dev, SPIDEV_FLASH, true);
+ SPI_SELECT(priv->dev, SPIDEV_FLASH(0), true);
/* Send "Read from Memory " instruction */
@@ -709,7 +709,7 @@ static ssize_t ramtron_read(FAR struct mtd_dev_s *dev, off_t offset, size_t nbyt
/* Deselect the FLASH and unlock the SPI bus */
- SPI_SELECT(priv->dev, SPIDEV_FLASH, false);
+ SPI_SELECT(priv->dev, SPIDEV_FLASH(0), false);
ramtron_unlock(priv->dev);
finfo("return nbytes: %d\n", (int)nbytes);
@@ -805,7 +805,7 @@ FAR struct mtd_dev_s *ramtron_initialize(FAR struct spi_dev_s *dev)
/* Allocate a state structure (we allocate the structure instead of using
* a fixed, static allocation so that we can handle multiple FLASH devices.
* The current implementation would handle only one FLASH part per SPI
- * device (only because of the SPIDEV_FLASH definition) and so would have
+ * device (only because of the SPIDEV_FLASH(0) definition) and so would have
* to be extended to handle multiple FLASH parts on the same SPI bus.
*/
@@ -825,7 +825,7 @@ FAR struct mtd_dev_s *ramtron_initialize(FAR struct spi_dev_s *dev)
/* Deselect the FLASH */
- SPI_SELECT(dev, SPIDEV_FLASH, false);
+ SPI_SELECT(dev, SPIDEV_FLASH(0), false);
/* Identify the FLASH chip and get its capacity */
diff --git a/drivers/mtd/s25fl1.c b/drivers/mtd/s25fl1.c
index 33a2589638..f513b68363 100644
--- a/drivers/mtd/s25fl1.c
+++ b/drivers/mtd/s25fl1.c
@@ -1453,7 +1453,7 @@ FAR struct mtd_dev_s *s25fl1_initialize(FAR struct qspi_dev_s *qspi, bool unprot
/* Allocate a state structure (we allocate the structure instead of using
* a fixed, static allocation so that we can handle multiple FLASH devices.
* The current implementation would handle only one FLASH part per QuadSPI
- * device (only because of the QSPIDEV_FLASH definition) and so would have
+ * device (only because of the QSPIDEV_FLASH(0) definition) and so would have
* to be extended to handle multiple FLASH parts on the same QuadSPI bus.
*/
diff --git a/drivers/mtd/sector512.c b/drivers/mtd/sector512.c
index 56e07c8c6a..5e0100183a 100644
--- a/drivers/mtd/sector512.c
+++ b/drivers/mtd/sector512.c
@@ -599,7 +599,7 @@ FAR struct mtd_dev_s *s512_initialize(FAR struct mtd_dev_s *mtd)
/* Allocate a state structure (we allocate the structure instead of using
* a fixed, static allocation so that we can handle multiple FLASH devices.
* The current implementation would handle only one FLASH part per SPI
- * device (only because of the SPIDEV_FLASH definition) and so would have
+ * device (only because of the SPIDEV_FLASH(0) definition) and so would have
* to be extended to handle multiple FLASH parts on the same SPI bus.
*/
diff --git a/drivers/mtd/sst25.c b/drivers/mtd/sst25.c
index 9c84c7fba9..7e4b3435e8 100644
--- a/drivers/mtd/sst25.c
+++ b/drivers/mtd/sst25.c
@@ -314,7 +314,7 @@ static inline int sst25_readid(struct sst25_dev_s *priv)
/* Lock the SPI bus, configure the bus, and select this FLASH part. */
sst25_lock(priv->dev);
- SPI_SELECT(priv->dev, SPIDEV_FLASH, true);
+ SPI_SELECT(priv->dev, SPIDEV_FLASH(0), true);
/* Send the "Read ID (RDID)" command and read the first three ID bytes */
@@ -325,7 +325,7 @@ static inline int sst25_readid(struct sst25_dev_s *priv)
/* Deselect the FLASH and unlock the bus */
- SPI_SELECT(priv->dev, SPIDEV_FLASH, false);
+ SPI_SELECT(priv->dev, SPIDEV_FLASH(0), false);
sst25_unlock(priv->dev);
finfo("manufacturer: %02x memory: %02x capacity: %02x\n",
@@ -376,7 +376,7 @@ static void sst25_unprotect(struct sst25_dev_s *priv)
/* Send "Write enable status (WRSR)" */
- SPI_SELECT(priv->dev, SPIDEV_FLASH, true);
+ SPI_SELECT(priv->dev, SPIDEV_FLASH(0), true);
SPI_SEND(priv->dev, SST25_WRSR);
@@ -384,7 +384,7 @@ static void sst25_unprotect(struct sst25_dev_s *priv)
SPI_SEND(priv->dev, 0);
- SPI_SELECT(priv->dev, SPIDEV_FLASH, false);
+ SPI_SELECT(priv->dev, SPIDEV_FLASH(0), false);
}
#endif
@@ -402,7 +402,7 @@ static uint8_t sst25_waitwritecomplete(struct sst25_dev_s *priv)
{
/* Select this FLASH part */
- SPI_SELECT(priv->dev, SPIDEV_FLASH, true);
+ SPI_SELECT(priv->dev, SPIDEV_FLASH(0), true);
/* Send "Read Status Register (RDSR)" command */
@@ -414,7 +414,7 @@ static uint8_t sst25_waitwritecomplete(struct sst25_dev_s *priv)
/* Deselect the FLASH */
- SPI_SELECT(priv->dev, SPIDEV_FLASH, false);
+ SPI_SELECT(priv->dev, SPIDEV_FLASH(0), false);
/* Given that writing could take up to few tens of milliseconds, and erasing
* could take more. The following short delay in the "busy" case will allow
@@ -443,7 +443,7 @@ static inline void sst25_cmd(struct sst25_dev_s *priv, uint8_t cmd)
{
/* Select this FLASH part */
- SPI_SELECT(priv->dev, SPIDEV_FLASH, true);
+ SPI_SELECT(priv->dev, SPIDEV_FLASH(0), true);
/* Send command */
@@ -451,7 +451,7 @@ static inline void sst25_cmd(struct sst25_dev_s *priv, uint8_t cmd)
/* Deselect the FLASH */
- SPI_SELECT(priv->dev, SPIDEV_FLASH, false);
+ SPI_SELECT(priv->dev, SPIDEV_FLASH(0), false);
}
/************************************************************************************
@@ -498,7 +498,7 @@ static void sst25_sectorerase(struct sst25_dev_s *priv, off_t sector)
/* Select this FLASH part */
- SPI_SELECT(priv->dev, SPIDEV_FLASH, true);
+ SPI_SELECT(priv->dev, SPIDEV_FLASH(0), true);
/* Send the "Sector Erase (SE)" instruction */
@@ -514,7 +514,7 @@ static void sst25_sectorerase(struct sst25_dev_s *priv, off_t sector)
/* Deselect the FLASH */
- SPI_SELECT(priv->dev, SPIDEV_FLASH, false);
+ SPI_SELECT(priv->dev, SPIDEV_FLASH(0), false);
}
/************************************************************************************
@@ -560,7 +560,7 @@ static void sst25_byteread(FAR struct sst25_dev_s *priv, FAR uint8_t *buffer,
/* Select this FLASH part */
- SPI_SELECT(priv->dev, SPIDEV_FLASH, true);
+ SPI_SELECT(priv->dev, SPIDEV_FLASH(0), true);
/* Send "Read from Memory " instruction */
@@ -588,7 +588,7 @@ static void sst25_byteread(FAR struct sst25_dev_s *priv, FAR uint8_t *buffer,
/* Deselect the FLASH */
- SPI_SELECT(priv->dev, SPIDEV_FLASH, false);
+ SPI_SELECT(priv->dev, SPIDEV_FLASH(0), false);
}
/************************************************************************************
@@ -623,7 +623,7 @@ static void sst25_bytewrite(struct sst25_dev_s *priv, FAR const uint8_t *buffer,
/* Select this FLASH part */
- SPI_SELECT(priv->dev, SPIDEV_FLASH, true);
+ SPI_SELECT(priv->dev, SPIDEV_FLASH(0), true);
/* Send "Byte Program (BP)" command */
@@ -641,7 +641,7 @@ static void sst25_bytewrite(struct sst25_dev_s *priv, FAR const uint8_t *buffer,
/* Deselect the FLASH and setup for the next pass through the loop */
- SPI_SELECT(priv->dev, SPIDEV_FLASH, false);
+ SPI_SELECT(priv->dev, SPIDEV_FLASH(0), false);
}
/* Advance to the next byte */
@@ -704,7 +704,7 @@ static void sst25_wordwrite(struct sst25_dev_s *priv, FAR const uint8_t *buffer,
/* Select this FLASH part */
- SPI_SELECT(priv->dev, SPIDEV_FLASH, true);
+ SPI_SELECT(priv->dev, SPIDEV_FLASH(0), true);
/* Send "Auto Address Increment (AAI)" command */
@@ -722,7 +722,7 @@ static void sst25_wordwrite(struct sst25_dev_s *priv, FAR const uint8_t *buffer,
/* Deselect the FLASH: Chip Select high */
- SPI_SELECT(priv->dev, SPIDEV_FLASH, false);
+ SPI_SELECT(priv->dev, SPIDEV_FLASH(0), false);
/* Wait for the preceding write to complete. */
@@ -749,7 +749,7 @@ static void sst25_wordwrite(struct sst25_dev_s *priv, FAR const uint8_t *buffer,
/* Select this FLASH part */
- SPI_SELECT(priv->dev, SPIDEV_FLASH, true);
+ SPI_SELECT(priv->dev, SPIDEV_FLASH(0), true);
/* Send "Auto Address Increment (AAI)" command with no address */
@@ -761,7 +761,7 @@ static void sst25_wordwrite(struct sst25_dev_s *priv, FAR const uint8_t *buffer,
/* Deselect the FLASH: Chip Select high */
- SPI_SELECT(priv->dev, SPIDEV_FLASH, false);
+ SPI_SELECT(priv->dev, SPIDEV_FLASH(0), false);
/* Wait for the preceding write to complete. */
@@ -1177,7 +1177,7 @@ FAR struct mtd_dev_s *sst25_initialize(FAR struct spi_dev_s *dev)
/* Allocate a state structure (we allocate the structure instead of using
* a fixed, static allocation so that we can handle multiple FLASH devices.
* The current implementation would handle only one FLASH part per SPI
- * device (only because of the SPIDEV_FLASH definition) and so would have
+ * device (only because of the SPIDEV_FLASH(0) definition) and so would have
* to be extended to handle multiple FLASH parts on the same SPI bus.
*/
@@ -1197,7 +1197,7 @@ FAR struct mtd_dev_s *sst25_initialize(FAR struct spi_dev_s *dev)
/* Deselect the FLASH */
- SPI_SELECT(dev, SPIDEV_FLASH, false);
+ SPI_SELECT(dev, SPIDEV_FLASH(0), false);
/* Identify the FLASH chip and get its capacity */
diff --git a/drivers/mtd/sst25xx.c b/drivers/mtd/sst25xx.c
index 9f883483af..93aca1a383 100644
--- a/drivers/mtd/sst25xx.c
+++ b/drivers/mtd/sst25xx.c
@@ -264,19 +264,19 @@ static inline int sst25xx_readid(struct sst25xx_dev_s *priv)
/* Lock the SPI bus, configure the bus, and select this FLASH part. */
sst25xx_lock(priv->dev);
- SPI_SELECT(priv->dev, SPIDEV_FLASH, true);
+ SPI_SELECT(priv->dev, SPIDEV_FLASH(0), true);
/* Send the "Read ID (RDID)" command and read the first three ID bytes */
(void)SPI_SEND(priv->dev, SST25_RDID);
- SPI_SELECT(priv->dev, SPIDEV_FLASH, true);
+ SPI_SELECT(priv->dev, SPIDEV_FLASH(0), true);
manufacturer = SPI_SEND(priv->dev, SST25_DUMMY);
memory = SPI_SEND(priv->dev, SST25_DUMMY);
capacity = SPI_SEND(priv->dev, SST25_DUMMY);
/* Deselect the FLASH and unlock the bus */
- SPI_SELECT(priv->dev, SPIDEV_FLASH, false);
+ SPI_SELECT(priv->dev, SPIDEV_FLASH(0), false);
sst25xx_unlock(priv->dev);
finfo("manufacturer: %02x memory: %02x capacity: %02x\n",
@@ -326,7 +326,7 @@ static void sst25xx_waitwritecomplete(struct sst25xx_dev_s *priv)
{
/* Select this FLASH part */
- SPI_SELECT(priv->dev, SPIDEV_FLASH, true);
+ SPI_SELECT(priv->dev, SPIDEV_FLASH(0), true);
/* Send "Read Status Register (RDSR)" command */
@@ -338,7 +338,7 @@ static void sst25xx_waitwritecomplete(struct sst25xx_dev_s *priv)
/* Deselect the FLASH */
- SPI_SELECT(priv->dev, SPIDEV_FLASH, false);
+ SPI_SELECT(priv->dev, SPIDEV_FLASH(0), false);
/* Given that writing could take up to few tens of milliseconds, and erasing
* could take more. The following short delay in the "busy" case will allow
@@ -367,7 +367,7 @@ static void sst25xx_writeenable(struct sst25xx_dev_s *priv)
{
/* Select this FLASH part */
- SPI_SELECT(priv->dev, SPIDEV_FLASH, true);
+ SPI_SELECT(priv->dev, SPIDEV_FLASH(0), true);
/* Send "Write Enable (WREN)" command */
@@ -375,7 +375,7 @@ static void sst25xx_writeenable(struct sst25xx_dev_s *priv)
/* Deselect the FLASH */
- SPI_SELECT(priv->dev, SPIDEV_FLASH, false);
+ SPI_SELECT(priv->dev, SPIDEV_FLASH(0), false);
finfo("Enabled\n");
}
@@ -387,23 +387,23 @@ static void sst25xx_unprotect(struct sst25xx_dev_s *priv)
{
/* Send "Write enable status (EWSR)" */
- SPI_SELECT(priv->dev, SPIDEV_FLASH, true);
+ SPI_SELECT(priv->dev, SPIDEV_FLASH(0), true);
(void)SPI_SEND(priv->dev, SST25_EWSR);
/* Deselect the FLASH */
- SPI_SELECT(priv->dev, SPIDEV_FLASH, false);
+ SPI_SELECT(priv->dev, SPIDEV_FLASH(0), false);
/* Send "Write status (WRSR)" */
- SPI_SELECT(priv->dev, SPIDEV_FLASH, true);
+ SPI_SELECT(priv->dev, SPIDEV_FLASH(0), true);
SPI_SEND(priv->dev, SST25_WRSR);
/* Followed by the new status value */
SPI_SEND(priv->dev, 0);
- SPI_SELECT(priv->dev, SPIDEV_FLASH, false);
+ SPI_SELECT(priv->dev, SPIDEV_FLASH(0), false);
}
/************************************************************************************
@@ -432,7 +432,7 @@ static void sst25xx_sectorerase(struct sst25xx_dev_s *priv, off_t sector, uint8_
/* Select this FLASH part */
- SPI_SELECT(priv->dev, SPIDEV_FLASH, true);
+ SPI_SELECT(priv->dev, SPIDEV_FLASH(0), true);
/* Send the "Sector Erase (SE)" or Sub-Sector Erase (SSE) instruction
* that was passed in as the erase type.
@@ -452,7 +452,7 @@ static void sst25xx_sectorerase(struct sst25xx_dev_s *priv, off_t sector, uint8_
/* Deselect the FLASH */
- SPI_SELECT(priv->dev, SPIDEV_FLASH, false);
+ SPI_SELECT(priv->dev, SPIDEV_FLASH(0), false);
finfo("Erased\n");
}
@@ -478,7 +478,7 @@ static inline int sst25xx_bulkerase(struct sst25xx_dev_s *priv)
/* Select this FLASH part */
- SPI_SELECT(priv->dev, SPIDEV_FLASH, true);
+ SPI_SELECT(priv->dev, SPIDEV_FLASH(0), true);
/* Send the "Bulk Erase (BE)" instruction */
@@ -486,7 +486,7 @@ static inline int sst25xx_bulkerase(struct sst25xx_dev_s *priv)
/* Deselect the FLASH */
- SPI_SELECT(priv->dev, SPIDEV_FLASH, false);
+ SPI_SELECT(priv->dev, SPIDEV_FLASH(0), false);
sst25xx_waitwritecomplete(priv);
finfo("Return: OK\n");
@@ -518,7 +518,7 @@ static inline void sst25xx_pagewrite(struct sst25xx_dev_s *priv, FAR const uint8
/* Select this FLASH part */
- SPI_SELECT(priv->dev, SPIDEV_FLASH, true);
+ SPI_SELECT(priv->dev, SPIDEV_FLASH(0), true);
/* Send "Page Program (PP)" command */
@@ -537,7 +537,7 @@ static inline void sst25xx_pagewrite(struct sst25xx_dev_s *priv, FAR const uint8
/* Deselect the FLASH: Chip Select high */
- SPI_SELECT(priv->dev, SPIDEV_FLASH, false);
+ SPI_SELECT(priv->dev, SPIDEV_FLASH(0), false);
finfo("Written\n");
}
@@ -565,7 +565,7 @@ static inline void sst25xx_bytewrite(struct sst25xx_dev_s *priv, FAR const uint8
/* Select this FLASH part */
- SPI_SELECT(priv->dev, SPIDEV_FLASH, true);
+ SPI_SELECT(priv->dev, SPIDEV_FLASH(0), true);
/* Send "Page Program (PP)" command */
@@ -584,7 +584,7 @@ static inline void sst25xx_bytewrite(struct sst25xx_dev_s *priv, FAR const uint8
/* Deselect the FLASH: Chip Select high */
- SPI_SELECT(priv->dev, SPIDEV_FLASH, false);
+ SPI_SELECT(priv->dev, SPIDEV_FLASH(0), false);
finfo("Written\n");
}
#endif
@@ -740,7 +740,7 @@ static ssize_t sst25xx_read(FAR struct mtd_dev_s *dev, off_t offset, size_t nbyt
/* Lock the SPI bus and select this FLASH part */
sst25xx_lock(priv->dev);
- SPI_SELECT(priv->dev, SPIDEV_FLASH, true);
+ SPI_SELECT(priv->dev, SPIDEV_FLASH(0), true);
/* Send "Read from Memory " instruction */
@@ -758,7 +758,7 @@ static ssize_t sst25xx_read(FAR struct mtd_dev_s *dev, off_t offset, size_t nbyt
/* Deselect the FLASH and unlock the SPI bus */
- SPI_SELECT(priv->dev, SPIDEV_FLASH, false);
+ SPI_SELECT(priv->dev, SPIDEV_FLASH(0), false);
sst25xx_unlock(priv->dev);
finfo("return nbytes: %d\n", (int)nbytes);
return nbytes;
@@ -921,7 +921,7 @@ FAR struct mtd_dev_s *sst25xx_initialize(FAR struct spi_dev_s *dev)
/* Allocate a state structure (we allocate the structure instead of using
* a fixed, static allocation so that we can handle multiple FLASH devices.
* The current implementation would handle only one FLASH part per SPI
- * device (only because of the SPIDEV_FLASH definition) and so would have
+ * device (only because of the SPIDEV_FLASH(0) definition) and so would have
* to be extended to handle multiple FLASH parts on the same SPI bus.
*/
@@ -945,7 +945,7 @@ FAR struct mtd_dev_s *sst25xx_initialize(FAR struct spi_dev_s *dev)
/* Deselect the FLASH */
- SPI_SELECT(dev, SPIDEV_FLASH, false);
+ SPI_SELECT(dev, SPIDEV_FLASH(0), false);
/* Identify the FLASH chip and get its capacity */
diff --git a/drivers/mtd/sst26.c b/drivers/mtd/sst26.c
index 2654a857e8..d2702001c3 100644
--- a/drivers/mtd/sst26.c
+++ b/drivers/mtd/sst26.c
@@ -323,7 +323,7 @@ static inline int sst26_readid(struct sst26_dev_s *priv)
/* Lock the SPI bus, configure the bus, and select this FLASH part. */
sst26_lock(priv->dev);
- SPI_SELECT(priv->dev, SPIDEV_FLASH, true);
+ SPI_SELECT(priv->dev, SPIDEV_FLASH(0), true);
/* Send the "Read ID (RDID)" command and read the first three ID bytes */
@@ -334,7 +334,7 @@ static inline int sst26_readid(struct sst26_dev_s *priv)
/* Deselect the FLASH and unlock the bus */
- SPI_SELECT(priv->dev, SPIDEV_FLASH, false);
+ SPI_SELECT(priv->dev, SPIDEV_FLASH(0), false);
sst26_unlock(priv->dev);
sstinfo("manufacturer: %02x memory: %02x capacity: %02x\n",
@@ -385,7 +385,7 @@ static void sst26_waitwritecomplete(struct sst26_dev_s *priv)
{
/* Select this FLASH part */
- SPI_SELECT(priv->dev, SPIDEV_FLASH, true);
+ SPI_SELECT(priv->dev, SPIDEV_FLASH(0), true);
/* Send "Read Status Register (RDSR)" command */
@@ -397,7 +397,7 @@ static void sst26_waitwritecomplete(struct sst26_dev_s *priv)
/* Deselect the FLASH */
- SPI_SELECT(priv->dev, SPIDEV_FLASH, false);
+ SPI_SELECT(priv->dev, SPIDEV_FLASH(0), false);
/* Given that writing could take up to few tens of milliseconds, and erasing
* could take more. The following short delay in the "busy" case will allow
@@ -426,7 +426,7 @@ static void sst26_globalunlock(struct sst26_dev_s *priv)
{
/* Select this FLASH part */
- SPI_SELECT(priv->dev, SPIDEV_FLASH, true);
+ SPI_SELECT(priv->dev, SPIDEV_FLASH(0), true);
/* Send "Global Unlock (ULBPR)" command */
@@ -434,7 +434,7 @@ static void sst26_globalunlock(struct sst26_dev_s *priv)
/* Deselect the FLASH */
- SPI_SELECT(priv->dev, SPIDEV_FLASH, false);
+ SPI_SELECT(priv->dev, SPIDEV_FLASH(0), false);
sstinfo("Device unlocked.\n");
}
@@ -447,7 +447,7 @@ static void sst26_writeenable(struct sst26_dev_s *priv)
{
/* Select this FLASH part */
- SPI_SELECT(priv->dev, SPIDEV_FLASH, true);
+ SPI_SELECT(priv->dev, SPIDEV_FLASH(0), true);
/* Send "Write Enable (WREN)" command */
@@ -455,7 +455,7 @@ static void sst26_writeenable(struct sst26_dev_s *priv)
/* Deselect the FLASH */
- SPI_SELECT(priv->dev, SPIDEV_FLASH, false);
+ SPI_SELECT(priv->dev, SPIDEV_FLASH(0), false);
sstinfo("Enabled\n");
}
@@ -468,7 +468,7 @@ static void sst26_writedisable(struct sst26_dev_s *priv)
{
/* Select this FLASH part */
- SPI_SELECT(priv->dev, SPIDEV_FLASH, true);
+ SPI_SELECT(priv->dev, SPIDEV_FLASH(0), true);
/* Send "Write Disable (WRDI)" command */
@@ -476,7 +476,7 @@ static void sst26_writedisable(struct sst26_dev_s *priv)
/* Deselect the FLASH */
- SPI_SELECT(priv->dev, SPIDEV_FLASH, false);
+ SPI_SELECT(priv->dev, SPIDEV_FLASH(0), false);
sstinfo("Disabled\n");
}
@@ -499,7 +499,7 @@ static void sst26_sectorerase(struct sst26_dev_s *priv, off_t sector, uint8_t ty
/* Select this FLASH part */
- SPI_SELECT(priv->dev, SPIDEV_FLASH, true);
+ SPI_SELECT(priv->dev, SPIDEV_FLASH(0), true);
/* Send the "Sector Erase (SE)" or "Block Erase (BE)" instruction
* that was passed in as the erase type.
@@ -518,7 +518,7 @@ static void sst26_sectorerase(struct sst26_dev_s *priv, off_t sector, uint8_t ty
/* Deselect the FLASH */
- SPI_SELECT(priv->dev, SPIDEV_FLASH, false);
+ SPI_SELECT(priv->dev, SPIDEV_FLASH(0), false);
sst26_waitwritecomplete(priv);
@@ -539,7 +539,7 @@ static inline int sst26_chiperase(struct sst26_dev_s *priv)
/* Select this FLASH part */
- SPI_SELECT(priv->dev, SPIDEV_FLASH, true);
+ SPI_SELECT(priv->dev, SPIDEV_FLASH(0), true);
/* Send the "Chip Erase (CE)" instruction */
@@ -547,7 +547,7 @@ static inline int sst26_chiperase(struct sst26_dev_s *priv)
/* Deselect the FLASH */
- SPI_SELECT(priv->dev, SPIDEV_FLASH, false);
+ SPI_SELECT(priv->dev, SPIDEV_FLASH(0), false);
sst26_waitwritecomplete(priv);
@@ -572,7 +572,7 @@ static inline void sst26_pagewrite(struct sst26_dev_s *priv,
/* Select this FLASH part */
- SPI_SELECT(priv->dev, SPIDEV_FLASH, true);
+ SPI_SELECT(priv->dev, SPIDEV_FLASH(0), true);
/* Send "Page Program (PP)" command */
@@ -590,7 +590,7 @@ static inline void sst26_pagewrite(struct sst26_dev_s *priv,
/* Deselect the FLASH: Chip Select high */
- SPI_SELECT(priv->dev, SPIDEV_FLASH, false);
+ SPI_SELECT(priv->dev, SPIDEV_FLASH(0), false);
sst26_waitwritecomplete(priv);
@@ -614,7 +614,7 @@ static inline void sst26_bytewrite(struct sst26_dev_s *priv,
/* Select this FLASH part */
- SPI_SELECT(priv->dev, SPIDEV_FLASH, true);
+ SPI_SELECT(priv->dev, SPIDEV_FLASH(0), true);
/* Send "Page Program (PP)" command */
@@ -633,7 +633,7 @@ static inline void sst26_bytewrite(struct sst26_dev_s *priv,
/* Deselect the FLASH: Chip Select high */
- SPI_SELECT(priv->dev, SPIDEV_FLASH, false);
+ SPI_SELECT(priv->dev, SPIDEV_FLASH(0), false);
sst26_waitwritecomplete(priv);
@@ -737,7 +737,7 @@ static ssize_t sst26_read(FAR struct mtd_dev_s *dev, off_t offset, size_t nbytes
/* Lock the SPI bus and select this FLASH part */
sst26_lock(priv->dev);
- SPI_SELECT(priv->dev, SPIDEV_FLASH, true);
+ SPI_SELECT(priv->dev, SPIDEV_FLASH(0), true);
/* Send "Read from Memory " instruction */
@@ -759,7 +759,7 @@ static ssize_t sst26_read(FAR struct mtd_dev_s *dev, off_t offset, size_t nbytes
/* Deselect the FLASH and unlock the SPI bus */
- SPI_SELECT(priv->dev, SPIDEV_FLASH, false);
+ SPI_SELECT(priv->dev, SPIDEV_FLASH(0), false);
sst26_unlock(priv->dev);
sstinfo("return nbytes: %d\n", (int)nbytes);
return nbytes;
@@ -922,7 +922,7 @@ FAR struct mtd_dev_s *sst26_initialize_spi(FAR struct spi_dev_s *dev)
/* Allocate a state structure (we allocate the structure instead of using
* a fixed, static allocation so that we can handle multiple FLASH devices.
* The current implementation would handle only one FLASH part per SPI
- * device (only because of the SPIDEV_FLASH definition) and so would have
+ * device (only because of the SPIDEV_FLASH(0) definition) and so would have
* to be extended to handle multiple FLASH parts on the same SPI bus.
*/
@@ -945,7 +945,7 @@ FAR struct mtd_dev_s *sst26_initialize_spi(FAR struct spi_dev_s *dev)
/* Deselect the FLASH */
- SPI_SELECT(dev, SPIDEV_FLASH, false);
+ SPI_SELECT(dev, SPIDEV_FLASH(0), false);
/* Identify the FLASH chip and get its capacity */
diff --git a/drivers/mtd/w25.c b/drivers/mtd/w25.c
index 279525e1fc..79ac0a5a66 100644
--- a/drivers/mtd/w25.c
+++ b/drivers/mtd/w25.c
@@ -338,7 +338,7 @@ static inline int w25_readid(struct w25_dev_s *priv)
/* Lock the SPI bus, configure the bus, and select this FLASH part. */
w25_lock(priv->spi);
- SPI_SELECT(priv->spi, SPIDEV_FLASH, true);
+ SPI_SELECT(priv->spi, SPIDEV_FLASH(0), true);
/* Send the "Read ID (RDID)" command and read the first three ID bytes */
@@ -349,7 +349,7 @@ static inline int w25_readid(struct w25_dev_s *priv)
/* Deselect the FLASH and unlock the bus */
- SPI_SELECT(priv->spi, SPIDEV_FLASH, false);
+ SPI_SELECT(priv->spi, SPIDEV_FLASH(0), false);
w25_unlock(priv->spi);
finfo("manufacturer: %02x memory: %02x capacity: %02x\n",
@@ -440,7 +440,7 @@ static void w25_unprotect(FAR struct w25_dev_s *priv)
{
/* Select this FLASH part */
- SPI_SELECT(priv->spi, SPIDEV_FLASH, true);
+ SPI_SELECT(priv->spi, SPIDEV_FLASH(0), true);
/* Send "Write enable (WREN)" */
@@ -450,8 +450,8 @@ static void w25_unprotect(FAR struct w25_dev_s *priv)
* the SST25 timing diagrams from which this code was leveraged.)
*/
- SPI_SELECT(priv->spi, SPIDEV_FLASH, false);
- SPI_SELECT(priv->spi, SPIDEV_FLASH, true);
+ SPI_SELECT(priv->spi, SPIDEV_FLASH(0), false);
+ SPI_SELECT(priv->spi, SPIDEV_FLASH(0), true);
/* Send "Write enable status (EWSR)" */
@@ -478,7 +478,7 @@ static uint8_t w25_waitwritecomplete(struct w25_dev_s *priv)
{
/* Select this FLASH part */
- SPI_SELECT(priv->spi, SPIDEV_FLASH, true);
+ SPI_SELECT(priv->spi, SPIDEV_FLASH(0), true);
/* Send "Read Status Register (RDSR)" command */
@@ -490,7 +490,7 @@ static uint8_t w25_waitwritecomplete(struct w25_dev_s *priv)
/* Deselect the FLASH */
- SPI_SELECT(priv->spi, SPIDEV_FLASH, false);
+ SPI_SELECT(priv->spi, SPIDEV_FLASH(0), false);
/* Given that writing could take up to few tens of milliseconds, and erasing
* could take more. The following short delay in the "busy" case will allow
@@ -519,7 +519,7 @@ static inline void w25_wren(struct w25_dev_s *priv)
{
/* Select this FLASH part */
- SPI_SELECT(priv->spi, SPIDEV_FLASH, true);
+ SPI_SELECT(priv->spi, SPIDEV_FLASH(0), true);
/* Send "Write Enable (WREN)" command */
@@ -527,7 +527,7 @@ static inline void w25_wren(struct w25_dev_s *priv)
/* Deselect the FLASH */
- SPI_SELECT(priv->spi, SPIDEV_FLASH, false);
+ SPI_SELECT(priv->spi, SPIDEV_FLASH(0), false);
}
/************************************************************************************
@@ -538,7 +538,7 @@ static inline void w25_wrdi(struct w25_dev_s *priv)
{
/* Select this FLASH part */
- SPI_SELECT(priv->spi, SPIDEV_FLASH, true);
+ SPI_SELECT(priv->spi, SPIDEV_FLASH(0), true);
/* Send "Write Disable (WRDI)" command */
@@ -546,7 +546,7 @@ static inline void w25_wrdi(struct w25_dev_s *priv)
/* Deselect the FLASH */
- SPI_SELECT(priv->spi, SPIDEV_FLASH, false);
+ SPI_SELECT(priv->spi, SPIDEV_FLASH(0), false);
}
/************************************************************************************
@@ -569,7 +569,7 @@ static void w25_sectorerase(struct w25_dev_s *priv, off_t sector)
/* Select this FLASH part */
- SPI_SELECT(priv->spi, SPIDEV_FLASH, true);
+ SPI_SELECT(priv->spi, SPIDEV_FLASH(0), true);
/* Send the "Sector Erase (SE)" instruction */
@@ -585,7 +585,7 @@ static void w25_sectorerase(struct w25_dev_s *priv, off_t sector)
/* Deselect the FLASH */
- SPI_SELECT(priv->spi, SPIDEV_FLASH, false);
+ SPI_SELECT(priv->spi, SPIDEV_FLASH(0), false);
}
/************************************************************************************
@@ -606,7 +606,7 @@ static inline int w25_chiperase(struct w25_dev_s *priv)
/* Select this FLASH part */
- SPI_SELECT(priv->spi, SPIDEV_FLASH, true);
+ SPI_SELECT(priv->spi, SPIDEV_FLASH(0), true);
/* Send the "Chip Erase (CE)" instruction */
@@ -614,7 +614,7 @@ static inline int w25_chiperase(struct w25_dev_s *priv)
/* Deselect the FLASH */
- SPI_SELECT(priv->spi, SPIDEV_FLASH, false);
+ SPI_SELECT(priv->spi, SPIDEV_FLASH(0), false);
finfo("Return: OK\n");
return OK;
}
@@ -641,7 +641,7 @@ static void w25_byteread(FAR struct w25_dev_s *priv, FAR uint8_t *buffer,
/* Select this FLASH part */
- SPI_SELECT(priv->spi, SPIDEV_FLASH, true);
+ SPI_SELECT(priv->spi, SPIDEV_FLASH(0), true);
/* Send "Read from Memory " instruction */
@@ -669,7 +669,7 @@ static void w25_byteread(FAR struct w25_dev_s *priv, FAR uint8_t *buffer,
/* Deselect the FLASH */
- SPI_SELECT(priv->spi, SPIDEV_FLASH, false);
+ SPI_SELECT(priv->spi, SPIDEV_FLASH(0), false);
}
/************************************************************************************
@@ -699,7 +699,7 @@ static void w25_pagewrite(struct w25_dev_s *priv, FAR const uint8_t *buffer,
/* Select this FLASH part */
- SPI_SELECT(priv->spi, SPIDEV_FLASH, true);
+ SPI_SELECT(priv->spi, SPIDEV_FLASH(0), true);
/* Send the "Page Program (W25_PP)" Command */
@@ -717,7 +717,7 @@ static void w25_pagewrite(struct w25_dev_s *priv, FAR const uint8_t *buffer,
/* Deselect the FLASH and setup for the next pass through the loop */
- SPI_SELECT(priv->spi, SPIDEV_FLASH, false);
+ SPI_SELECT(priv->spi, SPIDEV_FLASH(0), false);
/* Update addresses */
@@ -755,7 +755,7 @@ static inline void w25_bytewrite(struct w25_dev_s *priv, FAR const uint8_t *buff
/* Select this FLASH part */
- SPI_SELECT(priv->spi, SPIDEV_FLASH, true);
+ SPI_SELECT(priv->spi, SPIDEV_FLASH(0), true);
/* Send "Page Program (PP)" command */
@@ -773,7 +773,7 @@ static inline void w25_bytewrite(struct w25_dev_s *priv, FAR const uint8_t *buff
/* Deselect the FLASH: Chip Select high */
- SPI_SELECT(priv->spi, SPIDEV_FLASH, false);
+ SPI_SELECT(priv->spi, SPIDEV_FLASH(0), false);
finfo("Written\n");
}
#endif /* defined(CONFIG_MTD_BYTE_WRITE) && !defined(CONFIG_W25_READONLY) */
@@ -1224,7 +1224,7 @@ FAR struct mtd_dev_s *w25_initialize(FAR struct spi_dev_s *spi)
/* Allocate a state structure (we allocate the structure instead of using
* a fixed, static allocation so that we can handle multiple FLASH devices.
* The current implementation would handle only one FLASH part per SPI
- * device (only because of the SPIDEV_FLASH definition) and so would have
+ * device (only because of the SPIDEV_FLASH(0) definition) and so would have
* to be extended to handle multiple FLASH parts on the same SPI bus.
*/
@@ -1247,7 +1247,7 @@ FAR struct mtd_dev_s *w25_initialize(FAR struct spi_dev_s *spi)
/* Deselect the FLASH */
- SPI_SELECT(spi, SPIDEV_FLASH, false);
+ SPI_SELECT(spi, SPIDEV_FLASH(0), false);
/* Identify the FLASH chip and get its capacity */
diff --git a/drivers/net/enc28j60.c b/drivers/net/enc28j60.c
index 90aa996c0b..a719f43d7a 100644
--- a/drivers/net/enc28j60.c
+++ b/drivers/net/enc28j60.c
@@ -466,7 +466,7 @@ static uint8_t enc_rdgreg2(FAR struct enc_driver_s *priv, uint8_t cmd)
/* Select ENC28J60 chip */
- SPI_SELECT(priv->spi, SPIDEV_ETHERNET, true);
+ SPI_SELECT(priv->spi, SPIDEV_ETHERNET(0), true);
/* Send the read command and collect the data. The sequence requires
* 16-clocks: 8 to clock out the cmd + 8 to clock in the data.
@@ -477,7 +477,7 @@ static uint8_t enc_rdgreg2(FAR struct enc_driver_s *priv, uint8_t cmd)
/* De-select ENC28J60 chip */
- SPI_SELECT(priv->spi, SPIDEV_ETHERNET, false);
+ SPI_SELECT(priv->spi, SPIDEV_ETHERNET(0), false);
enc_rddump(cmd, rddata);
return rddata;
@@ -509,7 +509,7 @@ static void enc_wrgreg2(FAR struct enc_driver_s *priv, uint8_t cmd,
/* Select ENC28J60 chip */
- SPI_SELECT(priv->spi, SPIDEV_ETHERNET, true);
+ SPI_SELECT(priv->spi, SPIDEV_ETHERNET(0), true);
/* Send the write command and data. The sequence requires 16-clocks:
* 8 to clock out the cmd + 8 to clock out the data.
@@ -520,7 +520,7 @@ static void enc_wrgreg2(FAR struct enc_driver_s *priv, uint8_t cmd,
/* De-select ENC28J60 chip. */
- SPI_SELECT(priv->spi, SPIDEV_ETHERNET, false);
+ SPI_SELECT(priv->spi, SPIDEV_ETHERNET(0), false);
enc_wrdump(cmd, wrdata);
}
@@ -553,7 +553,7 @@ static inline void enc_src(FAR struct enc_driver_s *priv)
/* Select ENC28J60 chip */
- SPI_SELECT(priv->spi, SPIDEV_ETHERNET, true);
+ SPI_SELECT(priv->spi, SPIDEV_ETHERNET(0), true);
/* Send the system reset command. */
@@ -574,7 +574,7 @@ static inline void enc_src(FAR struct enc_driver_s *priv)
/* De-select ENC28J60 chip. */
- SPI_SELECT(priv->spi, SPIDEV_ETHERNET, false);
+ SPI_SELECT(priv->spi, SPIDEV_ETHERNET(0), false);
enc_cmddump(ENC_SRC);
}
@@ -650,7 +650,7 @@ static uint8_t enc_rdbreg(FAR struct enc_driver_s *priv, uint8_t ctrlreg)
/* Re-select ENC28J60 chip */
- SPI_SELECT(priv->spi, SPIDEV_ETHERNET, true);
+ SPI_SELECT(priv->spi, SPIDEV_ETHERNET(0), true);
/* Send the RCR command and collect the data. How we collect the data
* depends on if this is a PHY/CAN or not. The normal sequence requires
@@ -671,7 +671,7 @@ static uint8_t enc_rdbreg(FAR struct enc_driver_s *priv, uint8_t ctrlreg)
/* De-select ENC28J60 chip */
- SPI_SELECT(priv->spi, SPIDEV_ETHERNET, false);
+ SPI_SELECT(priv->spi, SPIDEV_ETHERNET(0), false);
enc_rddump(ENC_RCR | GETADDR(ctrlreg), rddata);
return rddata;
}
@@ -707,7 +707,7 @@ static void enc_wrbreg(FAR struct enc_driver_s *priv, uint8_t ctrlreg,
/* Re-select ENC28J60 chip */
- SPI_SELECT(priv->spi, SPIDEV_ETHERNET, true);
+ SPI_SELECT(priv->spi, SPIDEV_ETHERNET(0), true);
/* Send the WCR command and data. The sequence requires 16-clocks:
* 8 to clock out the cmd + 8 to clock out the data.
@@ -718,7 +718,7 @@ static void enc_wrbreg(FAR struct enc_driver_s *priv, uint8_t ctrlreg,
/* De-select ENC28J60 chip. */
- SPI_SELECT(priv->spi, SPIDEV_ETHERNET, false);
+ SPI_SELECT(priv->spi, SPIDEV_ETHERNET(0), false);
enc_wrdump(ENC_WCR | GETADDR(ctrlreg), wrdata);
}
@@ -861,7 +861,7 @@ static void enc_rdbuffer(FAR struct enc_driver_s *priv, FAR uint8_t *buffer,
/* Select ENC28J60 chip */
- SPI_SELECT(priv->spi, SPIDEV_ETHERNET, true);
+ SPI_SELECT(priv->spi, SPIDEV_ETHERNET(0), true);
/* Send the read buffer memory command (ignoring the response) */
@@ -873,7 +873,7 @@ static void enc_rdbuffer(FAR struct enc_driver_s *priv, FAR uint8_t *buffer,
/* De-select ENC28J60 chip. */
- SPI_SELECT(priv->spi, SPIDEV_ETHERNET, false);
+ SPI_SELECT(priv->spi, SPIDEV_ETHERNET(0), false);
enc_bmdump(ENC_WBM, buffer, buflen);
}
@@ -906,7 +906,7 @@ static inline void enc_wrbuffer(FAR struct enc_driver_s *priv,
* "The WBM command is started by lowering the CS pin. ..."
*/
- SPI_SELECT(priv->spi, SPIDEV_ETHERNET, true);
+ SPI_SELECT(priv->spi, SPIDEV_ETHERNET(0), true);
/* Send the write buffer memory command (ignoring the response)
*
@@ -956,7 +956,7 @@ static inline void enc_wrbuffer(FAR struct enc_driver_s *priv,
* "The WBM command is terminated by bringing up the CS pin. ..."
*/
- SPI_SELECT(priv->spi, SPIDEV_ETHERNET, false);
+ SPI_SELECT(priv->spi, SPIDEV_ETHERNET(0), false);
enc_bmdump(ENC_WBM, buffer, buflen+1);
}
diff --git a/drivers/net/encx24j600.c b/drivers/net/encx24j600.c
index be66e56da5..719661a9ac 100644
--- a/drivers/net/encx24j600.c
+++ b/drivers/net/encx24j600.c
@@ -458,7 +458,7 @@ static void enc_cmd(FAR struct enc_driver_s *priv, uint8_t cmd, uint16_t arg)
/* Select ENCX24J600 chip */
- SPI_SELECT(priv->spi, SPIDEV_ETHERNET, true);
+ SPI_SELECT(priv->spi, SPIDEV_ETHERNET(0), true);
(void)SPI_SEND(priv->spi, cmd); /* Clock out the command */
(void)SPI_SEND(priv->spi, arg & 0xff); /* Clock out the low byte */
@@ -466,7 +466,7 @@ static void enc_cmd(FAR struct enc_driver_s *priv, uint8_t cmd, uint16_t arg)
/* De-select ENCX24J600 chip. */
- SPI_SELECT(priv->spi, SPIDEV_ETHERNET, false);
+ SPI_SELECT(priv->spi, SPIDEV_ETHERNET(0), false);
enc_wrdump(cmd, arg);
}
@@ -492,7 +492,7 @@ static inline void enc_setethrst(FAR struct enc_driver_s *priv)
/* Select ENCX24J600 chip */
- SPI_SELECT(priv->spi, SPIDEV_ETHERNET, true);
+ SPI_SELECT(priv->spi, SPIDEV_ETHERNET(0), true);
/* Send the system reset command. */
@@ -502,7 +502,7 @@ static inline void enc_setethrst(FAR struct enc_driver_s *priv)
/* De-select ENCX24J600 chip. */
- SPI_SELECT(priv->spi, SPIDEV_ETHERNET, false);
+ SPI_SELECT(priv->spi, SPIDEV_ETHERNET(0), false);
enc_cmddump(ENC_SETETHRST);
}
@@ -570,7 +570,7 @@ static uint16_t enc_rdreg(FAR struct enc_driver_s *priv, uint16_t ctrlreg)
DEBUGASSERT(priv && priv->spi);
DEBUGASSERT((ctrlreg & 0xe0) == 0); /* banked regeitsers only */
- SPI_SELECT(priv->spi, SPIDEV_ETHERNET, true);
+ SPI_SELECT(priv->spi, SPIDEV_ETHERNET(0), true);
enc_setbank(priv, GETBANK(ctrlreg));
@@ -580,7 +580,7 @@ static uint16_t enc_rdreg(FAR struct enc_driver_s *priv, uint16_t ctrlreg)
rddata |= SPI_SEND(priv->spi, 0) << 8; /* Clock in the high byte */
- SPI_SELECT(priv->spi, SPIDEV_ETHERNET, false);
+ SPI_SELECT(priv->spi, SPIDEV_ETHERNET(0), false);
enc_rddump(GETADDR(ctrlreg), rddata);
return rddata;
@@ -610,7 +610,7 @@ static void enc_wrreg(FAR struct enc_driver_s *priv, uint16_t ctrlreg,
DEBUGASSERT(priv && priv->spi);
DEBUGASSERT((ctrlreg & 0xe0) == 0); /* banked regeitsers only */
- SPI_SELECT(priv->spi, SPIDEV_ETHERNET, true);
+ SPI_SELECT(priv->spi, SPIDEV_ETHERNET(0), true);
enc_setbank(priv, GETBANK(ctrlreg));
@@ -618,7 +618,7 @@ static void enc_wrreg(FAR struct enc_driver_s *priv, uint16_t ctrlreg,
SPI_SEND(priv->spi, wrdata & 0xff); /* Clock out the low byte */
SPI_SEND(priv->spi, wrdata >> 8); /* Clock out the high byte */
- SPI_SELECT(priv->spi, SPIDEV_ETHERNET, false);
+ SPI_SELECT(priv->spi, SPIDEV_ETHERNET(0), false);
enc_wrdump(GETADDR(ctrlreg), wrdata);
}
@@ -688,7 +688,7 @@ static void enc_bfs(FAR struct enc_driver_s *priv, uint16_t ctrlreg,
/* Select ENCX24J600 chip */
- SPI_SELECT(priv->spi, SPIDEV_ETHERNET, true);
+ SPI_SELECT(priv->spi, SPIDEV_ETHERNET(0), true);
/* Set the bank */
@@ -704,7 +704,7 @@ static void enc_bfs(FAR struct enc_driver_s *priv, uint16_t ctrlreg,
/* De-select ENCX24J600 chip. */
- SPI_SELECT(priv->spi, SPIDEV_ETHERNET, false);
+ SPI_SELECT(priv->spi, SPIDEV_ETHERNET(0), false);
enc_bfsdump(GETADDR(ctrlreg), bits);
}
@@ -733,7 +733,7 @@ static void enc_bfc(FAR struct enc_driver_s *priv, uint16_t ctrlreg,
/* Select ENCX24J600 chip */
- SPI_SELECT(priv->spi, SPIDEV_ETHERNET, true);
+ SPI_SELECT(priv->spi, SPIDEV_ETHERNET(0), true);
/* Set the bank */
@@ -749,7 +749,7 @@ static void enc_bfc(FAR struct enc_driver_s *priv, uint16_t ctrlreg,
/* De-select ENCX24J600 chip. */
- SPI_SELECT(priv->spi, SPIDEV_ETHERNET, false);
+ SPI_SELECT(priv->spi, SPIDEV_ETHERNET(0), false);
enc_bfcdump(GETADDR(ctrlreg), bits);
}
@@ -851,7 +851,7 @@ static void enc_rdbuffer(FAR struct enc_driver_s *priv, FAR uint8_t *buffer,
/* Select ENCX24J600 chip */
- SPI_SELECT(priv->spi, SPIDEV_ETHERNET, true);
+ SPI_SELECT(priv->spi, SPIDEV_ETHERNET(0), true);
/* Send the read buffer memory command (ignoring the response) */
@@ -863,7 +863,7 @@ static void enc_rdbuffer(FAR struct enc_driver_s *priv, FAR uint8_t *buffer,
/* De-select ENCX24J600 chip. */
- SPI_SELECT(priv->spi, SPIDEV_ETHERNET, false);
+ SPI_SELECT(priv->spi, SPIDEV_ETHERNET(0), false);
enc_bmdump(ENC_RRXDATA, buffer, buflen);
}
@@ -891,12 +891,12 @@ static inline void enc_wrbuffer(FAR struct enc_driver_s *priv,
{
DEBUGASSERT(priv && priv->spi);
- SPI_SELECT(priv->spi, SPIDEV_ETHERNET, true);
+ SPI_SELECT(priv->spi, SPIDEV_ETHERNET(0), true);
SPI_SEND(priv->spi, ENC_WGPDATA);
SPI_SNDBLOCK(priv->spi, buffer, buflen);
- SPI_SELECT(priv->spi, SPIDEV_ETHERNET, false);
+ SPI_SELECT(priv->spi, SPIDEV_ETHERNET(0), false);
enc_bmdump(ENC_WGPDATA, buffer, buflen);
}
diff --git a/drivers/sensors/adxl345_spi.c b/drivers/sensors/adxl345_spi.c
index a2d524bf50..f235a1b750 100644
--- a/drivers/sensors/adxl345_spi.c
+++ b/drivers/sensors/adxl345_spi.c
@@ -97,7 +97,7 @@ uint8_t adxl345_getreg8(FAR struct adxl345_dev_s *priv, uint8_t regaddr)
/* Select the ADXL345 */
- SPI_SELECT(priv->spi, SPIDEV_ACCELEROMETER, true);
+ SPI_SELECT(priv->spi, SPIDEV_ACCELEROMETER(0), true);
/* Send register to read and get the next byte */
@@ -106,7 +106,7 @@ uint8_t adxl345_getreg8(FAR struct adxl345_dev_s *priv, uint8_t regaddr)
/* Deselect the ADXL345 */
- SPI_SELECT(priv->spi, SPIDEV_ACCELEROMETER, false);
+ SPI_SELECT(priv->spi, SPIDEV_ACCELEROMETER(0), false);
/* Unlock bus */
@@ -140,7 +140,7 @@ void adxl345_putreg8(FAR struct adxl345_dev_s *priv, uint8_t regaddr,
/* Select the ADXL345 */
- SPI_SELECT(priv->spi, SPIDEV_ACCELEROMETER, true);
+ SPI_SELECT(priv->spi, SPIDEV_ACCELEROMETER(0), true);
/* Send register address and set the value */
@@ -149,7 +149,7 @@ void adxl345_putreg8(FAR struct adxl345_dev_s *priv, uint8_t regaddr,
/* Deselect the ADXL345 */
- SPI_SELECT(priv->spi, SPIDEV_ACCELEROMETER, false);
+ SPI_SELECT(priv->spi, SPIDEV_ACCELEROMETER(0), false);
/* Unlock bus */
@@ -175,7 +175,7 @@ uint16_t adxl345_getreg16(FAR struct adxl345_dev_s *priv, uint8_t regaddr)
/* Select the ADXL345 */
- SPI_SELECT(priv->spi, SPIDEV_ACCELEROMETER, true);
+ SPI_SELECT(priv->spi, SPIDEV_ACCELEROMETER(0), true);
/* Send register to read and get the next 2 bytes */
@@ -184,7 +184,7 @@ uint16_t adxl345_getreg16(FAR struct adxl345_dev_s *priv, uint8_t regaddr)
/* Deselect the ADXL345 */
- SPI_SELECT(priv->spi, SPIDEV_ACCELEROMETER, false);
+ SPI_SELECT(priv->spi, SPIDEV_ACCELEROMETER(0), false);
/* Unlock bus */
diff --git a/drivers/sensors/max31855.c b/drivers/sensors/max31855.c
index 97b56f42ec..b4668088dc 100644
--- a/drivers/sensors/max31855.c
+++ b/drivers/sensors/max31855.c
@@ -203,7 +203,7 @@ static ssize_t max31855_read(FAR struct file *filep, FAR char *buffer, size_t bu
/* Enable MAX31855's chip select */
max31855_lock(priv->spi);
- SPI_SELECT(priv->spi, SPIDEV_TEMPERATURE, true);
+ SPI_SELECT(priv->spi, SPIDEV_TEMPERATURE(0), true);
/* Read temperature */
@@ -211,7 +211,7 @@ static ssize_t max31855_read(FAR struct file *filep, FAR char *buffer, size_t bu
/* Disable MAX31855's chip select */
- SPI_SELECT(priv->spi, SPIDEV_TEMPERATURE, false);
+ SPI_SELECT(priv->spi, SPIDEV_TEMPERATURE(0), false);
max31855_unlock(priv->spi);
regval = (regmsb & 0xFF000000) >> 24;
diff --git a/drivers/sensors/max6675.c b/drivers/sensors/max6675.c
index 71a0e2d142..3d273df20f 100644
--- a/drivers/sensors/max6675.c
+++ b/drivers/sensors/max6675.c
@@ -199,7 +199,7 @@ static ssize_t max6675_read(FAR struct file *filep, FAR char *buffer, size_t buf
/* Enable MAX6675's chip select */
max6675_lock(priv->spi);
- SPI_SELECT(priv->spi, SPIDEV_TEMPERATURE, true);
+ SPI_SELECT(priv->spi, SPIDEV_TEMPERATURE(0), true);
/* Read temperature */
@@ -207,7 +207,7 @@ static ssize_t max6675_read(FAR struct file *filep, FAR char *buffer, size_t buf
/* Disable MAX6675's chip select */
- SPI_SELECT(priv->spi, SPIDEV_TEMPERATURE, false);
+ SPI_SELECT(priv->spi, SPIDEV_TEMPERATURE(0), false);
max6675_unlock(priv->spi);
regval = (regmsb & 0xFF00) >> 8;
diff --git a/drivers/sensors/mpl115a.c b/drivers/sensors/mpl115a.c
index c23df63eaf..4107e8986a 100644
--- a/drivers/sensors/mpl115a.c
+++ b/drivers/sensors/mpl115a.c
@@ -142,7 +142,7 @@ static uint8_t mpl115a_getreg8(FAR struct mpl115a_dev_s *priv, uint8_t regaddr)
/* Select the MPL115A */
- SPI_SELECT(priv->spi, SPIDEV_BAROMETER, true);
+ SPI_SELECT(priv->spi, SPIDEV_BAROMETER(0), true);
/* Send register to read and get the next byte */
@@ -151,7 +151,7 @@ static uint8_t mpl115a_getreg8(FAR struct mpl115a_dev_s *priv, uint8_t regaddr)
/* Deselect the MPL115A */
- SPI_SELECT(priv->spi, SPIDEV_BAROMETER, false);
+ SPI_SELECT(priv->spi, SPIDEV_BAROMETER(0), false);
/* Unlock bus */
diff --git a/drivers/sensors/xen1210.c b/drivers/sensors/xen1210.c
index a14350921c..0603b4486f 100644
--- a/drivers/sensors/xen1210.c
+++ b/drivers/sensors/xen1210.c
@@ -419,7 +419,7 @@ void xen1210_getdata(FAR struct xen1210_dev_s *priv)
/* Select the XEN1210 */
- SPI_SELECT(priv->spi, SPIDEV_ACCELEROMETER, true);
+ SPI_SELECT(priv->spi, SPIDEV_ACCELEROMETER(0), true);
/* Read three times 3 bytes = 24 bits * 3 */
@@ -434,7 +434,7 @@ void xen1210_getdata(FAR struct xen1210_dev_s *priv)
/* Deselect the XEN1210 */
- SPI_SELECT(priv->spi, SPIDEV_ACCELEROMETER, false);
+ SPI_SELECT(priv->spi, SPIDEV_ACCELEROMETER(0), false);
/* Unlock bus */
@@ -472,7 +472,7 @@ void xen1210_putdata(FAR struct xen1210_dev_s *priv, uint32_t regval)
/* Select the XEN1210 */
- SPI_SELECT(priv->spi, SPIDEV_ACCELEROMETER, true);
+ SPI_SELECT(priv->spi, SPIDEV_ACCELEROMETER(0), true);
/* We need to write to 3 sensors in the daisy-chain */
/* Write three times 3 bytes */
@@ -483,7 +483,7 @@ void xen1210_putdata(FAR struct xen1210_dev_s *priv, uint32_t regval)
/* Deselect the XEN1210 */
- SPI_SELECT(priv->spi, SPIDEV_ACCELEROMETER, false);
+ SPI_SELECT(priv->spi, SPIDEV_ACCELEROMETER(0), false);
/* Unlock bus */
diff --git a/drivers/spi/spi_bitbang.c b/drivers/spi/spi_bitbang.c
index e20a28b212..0e502f6c37 100644
--- a/drivers/spi/spi_bitbang.c
+++ b/drivers/spi/spi_bitbang.c
@@ -86,7 +86,7 @@
/* SPI methods */
static int spi_lock(FAR struct spi_dev_s *dev, bool lock);
-static void spi_select(FAR struct spi_dev_s *dev, enum spi_dev_e devid,
+static void spi_select(FAR struct spi_dev_s *dev, uint32_t devid,
bool selected);
static uint32_t spi_setfrequency(FAR struct spi_dev_s *dev,
uint32_t frequency);
@@ -103,9 +103,9 @@ static void spi_sndblock(FAR struct spi_dev_s *dev,
static void spi_recvblock(FAR struct spi_dev_s *dev, FAR void *buffer,
size_t nwords);
#endif
-static uint8_t spi_status(FAR struct spi_dev_s *dev, enum spi_dev_e devid);
+static uint8_t spi_status(FAR struct spi_dev_s *dev, uint32_t devid);
#ifdef CONFIG_SPI_CMDDATA
-static int spi_cmddata(FAR struct spi_dev_s *dev, enum spi_dev_e devid,
+static int spi_cmddata(FAR struct spi_dev_s *dev, uint32_t devid,
bool cmd);
#endif
@@ -206,7 +206,7 @@ static int spi_lock(FAR struct spi_dev_s *dev, bool lock)
*
****************************************************************************/
-static void spi_select(FAR struct spi_dev_s *dev, enum spi_dev_e devid,
+static void spi_select(FAR struct spi_dev_s *dev, uint32_t devid,
bool selected)
{
FAR struct spi_bitbang_s *priv = (FAR struct spi_bitbang_s *)dev;
@@ -481,7 +481,7 @@ static void spi_recvblock(FAR struct spi_dev_s *dev, FAR void *buffer, size_t nw
*
****************************************************************************/
-static uint8_t spi_status(FAR struct spi_dev_s *dev, enum spi_dev_e devid)
+static uint8_t spi_status(FAR struct spi_dev_s *dev, uint32_t devid)
{
FAR struct spi_bitbang_s *priv = (FAR struct spi_bitbang_s *)dev;
DEBUGASSERT(priv && priv->low && priv->low->status);
@@ -506,7 +506,7 @@ static uint8_t spi_status(FAR struct spi_dev_s *dev, enum spi_dev_e devid)
****************************************************************************/
#ifdef CONFIG_SPI_CMDDATA
-static int spi_cmddata(FAR struct spi_dev_s *dev, enum spi_dev_e devid,
+static int spi_cmddata(FAR struct spi_dev_s *dev, uint32_t devid,
bool cmd)
{
FAR struct spi_bitbang_s *priv = (FAR struct spi_bitbang_s *)dev;
diff --git a/drivers/wireless/cc1101.c b/drivers/wireless/cc1101.c
index e9ce3805c5..33112b42a5 100644
--- a/drivers/wireless/cc1101.c
+++ b/drivers/wireless/cc1101.c
@@ -312,7 +312,7 @@ static volatile int cc1101_interrupt = 0;
void cc1101_access_begin(FAR struct cc1101_dev_s *dev)
{
(void)SPI_LOCK(dev->spi, true);
- SPI_SELECT(dev->spi, SPIDEV_WIRELESS, true);
+ SPI_SELECT(dev->spi, SPIDEV_WIRELESS(0), true);
SPI_SETMODE(dev->spi, SPIDEV_MODE0); /* CPOL=0, CPHA=0 */
SPI_SETBITS(dev->spi, 8);
(void)SPI_HWFEATURES(dev->spi, 0);
@@ -320,7 +320,7 @@ void cc1101_access_begin(FAR struct cc1101_dev_s *dev)
void cc1101_access_end(FAR struct cc1101_dev_s *dev)
{
- SPI_SELECT(dev->spi, SPIDEV_WIRELESS, false);
+ SPI_SELECT(dev->spi, SPIDEV_WIRELESS(0), false);
(void)SPI_LOCK(dev->spi, false);
}
diff --git a/drivers/wireless/cc3000/cc3000.c b/drivers/wireless/cc3000/cc3000.c
index dfb312fb68..4e72232dd1 100644
--- a/drivers/wireless/cc3000/cc3000.c
+++ b/drivers/wireless/cc3000/cc3000.c
@@ -73,7 +73,7 @@
#include
#include
-#include
+#include
#include
#include
#include
@@ -289,7 +289,7 @@ static void cc3000_lock_and_select(FAR struct spi_dev_s *spi)
*/
cc3000_configspi(spi);
- SPI_SELECT(spi, SPIDEV_WIRELESS, true);
+ SPI_SELECT(spi, SPIDEV_WIRELESS(0), true);
}
/****************************************************************************
@@ -313,7 +313,7 @@ static void cc3000_deselect_and_unlock(FAR struct spi_dev_s *spi)
{
/* De select */
- SPI_SELECT(spi, SPIDEV_WIRELESS, false);
+ SPI_SELECT(spi, SPIDEV_WIRELESS(0), false);
/* Relinquish the SPI bus. */
diff --git a/drivers/wireless/cc3000/cc3000.h b/drivers/wireless/cc3000/cc3000.h
index ddcd4f5163..d969a1e5f6 100644
--- a/drivers/wireless/cc3000/cc3000.h
+++ b/drivers/wireless/cc3000/cc3000.h
@@ -53,9 +53,10 @@
#include
#include
#include
+
#include
#include
-#include
+#include
#include
#include
diff --git a/drivers/wireless/ieee802154/mrf24j40.c b/drivers/wireless/ieee802154/mrf24j40.c
index 938a4f1acc..41558b9dfa 100644
--- a/drivers/wireless/ieee802154/mrf24j40.c
+++ b/drivers/wireless/ieee802154/mrf24j40.c
@@ -255,9 +255,9 @@ static void mrf24j40_setreg(FAR struct spi_dev_s *spi, uint32_t addr, uint8_t va
buf[len++] = val;
mrf24j40_lock(spi);
- SPI_SELECT(spi, SPIDEV_IEEE802154, true);
+ SPI_SELECT(spi, SPIDEV_IEEE802154(0), true);
SPI_SNDBLOCK(spi, buf, len);
- SPI_SELECT(spi, SPIDEV_IEEE802154, false);
+ SPI_SELECT(spi, SPIDEV_IEEE802154(0), false);
mrf24j40_unlock(spi);
}
@@ -299,9 +299,9 @@ static uint8_t mrf24j40_getreg(FAR struct spi_dev_s *spi, uint32_t addr)
buf[len++] = 0xFF; /* dummy */
mrf24j40_lock (spi);
- SPI_SELECT (spi, SPIDEV_IEEE802154, true);
+ SPI_SELECT (spi, SPIDEV_IEEE802154(0), true);
SPI_EXCHANGE (spi, buf, rx, len);
- SPI_SELECT (spi, SPIDEV_IEEE802154, false);
+ SPI_SELECT (spi, SPIDEV_IEEE802154(0), false);
mrf24j40_unlock(spi);
/*winfo("r[%04X]=%02X\n", addr, rx[len-1]);*/
diff --git a/drivers/wireless/nrf24l01.c b/drivers/wireless/nrf24l01.c
index 8bfc725c3b..463857e2ef 100644
--- a/drivers/wireless/nrf24l01.c
+++ b/drivers/wireless/nrf24l01.c
@@ -281,12 +281,12 @@ static void nrf24l01_lock(FAR struct spi_dev_s *spi)
* unlocked)
*/
- SPI_SELECT(spi, SPIDEV_WIRELESS, true);
+ SPI_SELECT(spi, SPIDEV_WIRELESS(0), true);
SPI_SETMODE(spi, SPIDEV_MODE0);
SPI_SETBITS(spi, 8);
(void)SPI_HWFEATURES(spi, 0);
(void)SPI_SETFREQUENCY(spi, NRF24L01_SPIFREQ);
- SPI_SELECT(spi, SPIDEV_WIRELESS, false);
+ SPI_SELECT(spi, SPIDEV_WIRELESS(0), false);
}
/****************************************************************************
@@ -333,12 +333,12 @@ static inline void nrf24l01_configspi(FAR struct spi_dev_s *spi)
{
/* Configure SPI for the NRF24L01 module. */
- SPI_SELECT(spi, SPIDEV_WIRELESS, true); /* Useful ? */
+ SPI_SELECT(spi, SPIDEV_WIRELESS(0), true); /* Useful ? */
SPI_SETMODE(spi, SPIDEV_MODE0);
SPI_SETBITS(spi, 8);
(void)SPI_HWFEATURES(spi, 0);
(void)SPI_SETFREQUENCY(spi, NRF24L01_SPIFREQ);
- SPI_SELECT(spi, SPIDEV_WIRELESS, false);
+ SPI_SELECT(spi, SPIDEV_WIRELESS(0), false);
}
/****************************************************************************
@@ -347,7 +347,7 @@ static inline void nrf24l01_configspi(FAR struct spi_dev_s *spi)
static inline void nrf24l01_select(struct nrf24l01_dev_s * dev)
{
- SPI_SELECT(dev->spi, SPIDEV_WIRELESS, true);
+ SPI_SELECT(dev->spi, SPIDEV_WIRELESS(0), true);
}
/****************************************************************************
@@ -356,7 +356,7 @@ static inline void nrf24l01_select(struct nrf24l01_dev_s * dev)
static inline void nrf24l01_deselect(struct nrf24l01_dev_s * dev)
{
- SPI_SELECT(dev->spi, SPIDEV_WIRELESS, false);
+ SPI_SELECT(dev->spi, SPIDEV_WIRELESS(0), false);
}
/****************************************************************************
diff --git a/drivers/wireless/nrf24l01.h b/drivers/wireless/nrf24l01.h
index caaf67f566..108591feea 100644
--- a/drivers/wireless/nrf24l01.h
+++ b/drivers/wireless/nrf24l01.h
@@ -43,7 +43,6 @@
#include
#include
#include
-#include
#include
#include
diff --git a/fs/vfs/fs_poll.c b/fs/vfs/fs_poll.c
index 168c393dd0..55160d7faa 100644
--- a/fs/vfs/fs_poll.c
+++ b/fs/vfs/fs_poll.c
@@ -388,6 +388,25 @@ int poll(FAR struct pollfd *fds, nfds_t nfds, int timeout)
}
else if (timeout > 0)
{
+ systime_t ticks;
+
+ /* "Implementations may place limitations on the granularity of
+ * timeout intervals. If the requested timeout interval requires
+ * a finer granularity than the implementation supports, the
+ * actual timeout interval will be rounded up to the next
+ * supported value." -- opengroup.org
+ *
+ * Round timeout up to next full tick.
+ */
+
+#if (MSEC_PER_TICK * USEC_PER_MSEC) != USEC_PER_TICK && \
+ defined(CONFIG_HAVE_LONG_LONG)
+ ticks = ((unsigned long long)timeout * USEC_PER_MSEC) + (USEC_PER_TICK - 1) /
+ USEC_PER_TICK;
+#else
+ ticks = ((unsigned int)timeout + (MSEC_PER_TICK - 1)) / MSEC_PER_TICK;
+#endif
+
/* Either wait for either a poll event(s), for a signal to occur,
* or for the specified timeout to elapse with no event.
*
@@ -396,7 +415,7 @@ int poll(FAR struct pollfd *fds, nfds_t nfds, int timeout)
* immediately.
*/
- ret = sem_tickwait(&sem, clock_systimer(), MSEC2TICK(timeout));
+ ret = sem_tickwait(&sem, clock_systimer(), ticks);
if (ret < 0)
{
if (ret == -ETIMEDOUT)
diff --git a/include/nuttx/analog/pga11x.h b/include/nuttx/analog/pga11x.h
index e4e2ebbc92..575689d22d 100644
--- a/include/nuttx/analog/pga11x.h
+++ b/include/nuttx/analog/pga11x.h
@@ -70,7 +70,7 @@
* CONFIG_PGA11X_MULTIPLE
* Can be defined to support multiple PGA11X devices on board. Each
* device will require a customized SPI interface to distinguish them
- * When SPI_SELECT is called with devid=SPIDEV_MUX.
+ * When SPI_SELECT is called with devid=SPIDEV_MUX(n).
*
* Other settings that effect the driver:
* CONFIG_DEBUG_SPI_ERR/WARN/INFO -- This will enable debug output from
diff --git a/include/nuttx/contactless/pn532.h b/include/nuttx/contactless/pn532.h
index c4bf82d8b2..145ee721b1 100644
--- a/include/nuttx/contactless/pn532.h
+++ b/include/nuttx/contactless/pn532.h
@@ -72,7 +72,7 @@ struct pn532_config_s
{
int (*reset)(uint8_t enable);
- /* External CS, if NULL then SPIDEV_WIRELESS CS is used */
+ /* External CS, if NULL then SPIDEV_WIRELESS(n) CS is used */
int (*select)(struct pn532_dev_s *dev, bool sel);
int (*irqattach)(void* dev, xcpt_t isr);
diff --git a/include/nuttx/fs/ioctl.h b/include/nuttx/fs/ioctl.h
index ce31d599ce..674eafc1d7 100644
--- a/include/nuttx/fs/ioctl.h
+++ b/include/nuttx/fs/ioctl.h
@@ -68,25 +68,26 @@
#define _QEIOCBASE (0x0f00) /* Quadrature encoder ioctl commands */
#define _AUDIOIOCBASE (0x1000) /* Audio ioctl commands */
#define _SLCDIOCBASE (0x1100) /* Segment LCD ioctl commands */
-#define _WLIOCBASE (0x1200) /* Wireless modules ioctl commands */
-#define _CFGDIOCBASE (0x1300) /* Config Data device (app config) ioctl commands */
-#define _TCIOCBASE (0x1400) /* Timer ioctl commands */
-#define _DJOYBASE (0x1500) /* Discrete joystick ioctl commands */
-#define _AJOYBASE (0x1600) /* Analog joystick ioctl commands */
-#define _PIPEBASE (0x1700) /* FIFO/pipe ioctl commands */
-#define _RTCBASE (0x1800) /* RTC ioctl commands */
-#define _RELAYBASE (0x1900) /* Relay devices ioctl commands */
-#define _CANBASE (0x1a00) /* CAN ioctl commands */
-#define _BTNBASE (0x1b00) /* Button ioctl commands */
-#define _ULEDBASE (0x1c00) /* User LED ioctl commands */
-#define _ZCBASE (0x1d00) /* Zero Cross ioctl commands */
-#define _LOOPBASE (0x1e00) /* Loop device commands */
-#define _MODEMBASE (0x1f00) /* Modem ioctl commands */
-#define _I2CBASE (0x2000) /* I2C driver commands */
-#define _SPIBASE (0x2100) /* SPI driver commands */
-#define _GPIOBASE (0x2200) /* GPIO driver commands */
-#define _CLIOCBASE (0x2300) /* Contactless modules ioctl commands */
-#define _USBCBASE (0x2400) /* USB-C controller ioctl commands */
+#define _WLIOCBASE (0x1200) /* Wireless modules ioctl network commands */
+#define _WLCIOCBASE (0x1300) /* Wireless modules ioctl character driver commands */
+#define _CFGDIOCBASE (0x1400) /* Config Data device (app config) ioctl commands */
+#define _TCIOCBASE (0x1500) /* Timer ioctl commands */
+#define _DJOYBASE (0x1600) /* Discrete joystick ioctl commands */
+#define _AJOYBASE (0x1700) /* Analog joystick ioctl commands */
+#define _PIPEBASE (0x1800) /* FIFO/pipe ioctl commands */
+#define _RTCBASE (0x1900) /* RTC ioctl commands */
+#define _RELAYBASE (0x1a00) /* Relay devices ioctl commands */
+#define _CANBASE (0x1b00) /* CAN ioctl commands */
+#define _BTNBASE (0x1c00) /* Button ioctl commands */
+#define _ULEDBASE (0x1d00) /* User LED ioctl commands */
+#define _ZCBASE (0x1e00) /* Zero Cross ioctl commands */
+#define _LOOPBASE (0x1f00) /* Loop device commands */
+#define _MODEMBASE (0x2000) /* Modem ioctl commands */
+#define _I2CBASE (0x2100) /* I2C driver commands */
+#define _SPIBASE (0x2200) /* SPI driver commands */
+#define _GPIOBASE (0x2300) /* GPIO driver commands */
+#define _CLIOCBASE (0x2400) /* Contactless modules ioctl commands */
+#define _USBCBASE (0x2500) /* USB-C controller ioctl commands */
/* boardctl() commands share the same number space */
@@ -294,12 +295,18 @@
#define _SLCDIOCVALID(c) (_IOC_TYPE(c)==_SLCDIOCBASE)
#define _SLCDIOC(nr) _IOC(_SLCDIOCBASE,nr)
-/* Wireless driver ioctl definitions ****************************************/
+/* Wireless driver networki ioctl definitions *******************************/
/* (see nuttx/include/wireless/wireless.h */
#define _WLIOCVALID(c) (_IOC_TYPE(c)==_WLIOCBASE)
#define _WLIOC(nr) _IOC(_WLIOCBASE,nr)
+/* Wireless driver character driver ioctl definitions ***********************/
+/* (see nuttx/include/wireless/ioctl.h */
+
+#define _WLCIOCVALID(c) (_IOC_TYPE(c)==_WLCIOCBASE)
+#define _WLCIOC(nr) _IOC(_WLCIOCBASE,nr)
+
/* Application Config Data driver ioctl definitions *************************/
/* (see nuttx/include/configdata.h */
diff --git a/include/nuttx/spi/spi.h b/include/nuttx/spi/spi.h
index 2a48bc92e3..ffff5e2911 100644
--- a/include/nuttx/spi/spi.h
+++ b/include/nuttx/spi/spi.h
@@ -420,6 +420,43 @@
#define SPI_REGISTERCALLBACK(d,c,a) \
((d)->ops->registercallback ? (d)->ops->registercallback(d,c,a) : -ENOSYS)
+/* SPI Device Macros ********************************************************/
+
+/* This builds a SPI devid from its type and index */
+
+#define SPIDEV_ID(type,index) ((((uint32_t)(type) & 0xffff) << 16) | \
+ ((uint32_t)(index) & 0xffff))
+
+/* This retrieves the fields from a SPI devid */
+
+#define SPIDEVID_TYPE (devid) (((uint32_t)(devid) >> 16) & 0xffff)
+#define SPIDEVID_INDEX(devid) ((uint32_t)(devid) & 0xffff)
+
+/* These are replacement definitions for the currently used SPI device indexes.
+ * The argument, n, is the instance number. This should be zero is there is
+ * only one instance of the SPI device on the bus.
+ */
+
+#define SPIDEV_NONE(n) SPIDEV_ID(SPIDEVTYPE_NONE, (n))
+#define SPIDEV_MMCSD(n) SPIDEV_ID(SPIDEVTYPE_MMCSD, (n))
+#define SPIDEV_FLASH(n) SPIDEV_ID(SPIDEVTYPE_FLASH, (n))
+#define SPIDEV_ETHERNET(n) SPIDEV_ID(SPIDEVTYPE_ETHERNET, (n))
+#define SPIDEV_DISPLAY(n) SPIDEV_ID(SPIDEVTYPE_DISPLAY, (n))
+#define SPIDEV_CAMERA(n) SPIDEV_ID(SPIDEVTYPE_CAMERA, (n))
+#define SPIDEV_WIRELESS(n) SPIDEV_ID(SPIDEVTYPE_WIRELESS, (n))
+#define SPIDEV_TOUCHSCREEN(n) SPIDEV_ID(SPIDEVTYPE_TOUCHSCREEN, (n))
+#define SPIDEV_EXPANDER(n) SPIDEV_ID(SPIDEVTYPE_EXPANDER, (n))
+#define SPIDEV_MUX(n) SPIDEV_ID(SPIDEVTYPE_MUX, (n))
+#define SPIDEV_AUDIO_DATA(n) SPIDEV_ID(SPIDEVTYPE_AUDIO_DATA, (n))
+#define SPIDEV_AUDIO_CTRL(n) SPIDEV_ID(SPIDEVTYPE_AUDIO_CTRL, (n))
+#define SPIDEV_EEPROM(n) SPIDEV_ID(SPIDEVTYPE_EEPROM, (n))
+#define SPIDEV_ACCELEROMETER(n) SPIDEV_ID(SPIDEVTYPE_ACCELEROMETER, (n))
+#define SPIDEV_BAROMETER(n) SPIDEV_ID(SPIDEVTYPE_BAROMETER, (n))
+#define SPIDEV_TEMPERATURE(n) SPIDEV_ID(SPIDEVTYPE_TEMPERATURE, (n))
+#define SPIDEV_IEEE802154(n) SPIDEV_ID(SPIDEVTYPE_IEEE802154, (n))
+#define SPIDEV_CONTACTLESS(n) SPIDEV_ID(SPIDEVTYPE_CONTACTLESS, (n))
+#define SPIDEV_USER(n) SPIDEV_ID(SPIDEVTYPE_USER, (n))
+
/****************************************************************************
* Public Types
****************************************************************************/
@@ -428,31 +465,32 @@
typedef void (*spi_mediachange_t)(FAR void *arg);
-/* If the board supports multiple SPI devices, this enumeration identifies
- * which is selected or de-selected.
+/* If the board supports multiple SPI devices types, this enumeration
+ * identifies which is selected or de-selected.
+ * There may be more than one instance of each type on a bus, see below.
*/
-enum spi_dev_e
+enum spi_devtype_e
{
- SPIDEV_NONE = 0, /* Not a valid value */
- SPIDEV_MMCSD, /* Select SPI MMC/SD device */
- SPIDEV_FLASH, /* Select SPI FLASH device */
- SPIDEV_ETHERNET, /* Select SPI Ethernet device */
- SPIDEV_DISPLAY, /* Select SPI LCD/OLED display device */
- SPIDEV_CAMERA, /* Select SPI imaging device */
- SPIDEV_WIRELESS, /* Select SPI Wireless device */
- SPIDEV_TOUCHSCREEN, /* Select SPI touchscreen device */
- SPIDEV_EXPANDER, /* Select SPI I/O expander device */
- SPIDEV_MUX, /* Select SPI multiplexer device */
- SPIDEV_AUDIO_DATA, /* Select SPI audio codec device data port */
- SPIDEV_AUDIO_CTRL, /* Select SPI audio codec device control port */
- SPIDEV_EEPROM, /* Select SPI EEPROM device */
- SPIDEV_ACCELEROMETER, /* Select SPI Accelerometer device */
- SPIDEV_BAROMETER, /* Select SPI Pressure/Barometer device */
- SPIDEV_TEMPERATURE, /* Select SPI Temperature sensor device */
- SPIDEV_IEEE802154, /* Select SPI IEEE 802.15.4 wireless device */
- SPIDEV_CONTACTLESS, /* Select SPI Contactless device */
- SPIDEV_USER /* Board-specific values start here */
+ SPIDEVTYPE_NONE = 0, /* Not a valid value */
+ SPIDEVTYPE_MMCSD, /* Select SPI MMC/SD device */
+ SPIDEVTYPE_FLASH, /* Select SPI FLASH device */
+ SPIDEVTYPE_ETHERNET, /* Select SPI Ethernet device */
+ SPIDEVTYPE_DISPLAY, /* Select SPI LCD/OLED display device */
+ SPIDEVTYPE_CAMERA, /* Select SPI imaging device */
+ SPIDEVTYPE_WIRELESS, /* Select SPI Wireless device */
+ SPIDEVTYPE_TOUCHSCREEN, /* Select SPI touchscreen device */
+ SPIDEVTYPE_EXPANDER, /* Select SPI I/O expander device */
+ SPIDEVTYPE_MUX, /* Select SPI multiplexer device */
+ SPIDEVTYPE_AUDIO_DATA, /* Select SPI audio codec device data port */
+ SPIDEVTYPE_AUDIO_CTRL, /* Select SPI audio codec device control port */
+ SPIDEVTYPE_EEPROM, /* Select SPI EEPROM device */
+ SPIDEVTYPE_ACCELEROMETER, /* Select SPI Accelerometer device */
+ SPIDEVTYPE_BAROMETER, /* Select SPI Pressure/Barometer device */
+ SPIDEVTYPE_TEMPERATURE, /* Select SPI Temperature sensor device */
+ SPIDEVTYPE_IEEE802154, /* Select SPI IEEE 802.15.4 wireless device */
+ SPIDEVTYPE_CONTACTLESS, /* Select SPI Contactless device */
+ SPIDEVTYPE_USER /* Board-specific values start here */
};
/* Certain SPI devices may required different clocking modes */
@@ -477,7 +515,7 @@ struct spi_dev_s;
struct spi_ops_s
{
CODE int (*lock)(FAR struct spi_dev_s *dev, bool lock);
- CODE void (*select)(FAR struct spi_dev_s *dev, enum spi_dev_e devid,
+ CODE void (*select)(FAR struct spi_dev_s *dev, uint32_t devid,
bool selected);
CODE uint32_t (*setfrequency)(FAR struct spi_dev_s *dev, uint32_t frequency);
#ifdef CONFIG_SPI_CS_DELAY_CONTROL
@@ -490,9 +528,9 @@ struct spi_ops_s
CODE int (*hwfeatures)(FAR struct spi_dev_s *dev,
spi_hwfeatures_t features);
#endif
- CODE uint8_t (*status)(FAR struct spi_dev_s *dev, enum spi_dev_e devid);
+ CODE uint8_t (*status)(FAR struct spi_dev_s *dev, uint32_t devid);
#ifdef CONFIG_SPI_CMDDATA
- CODE int (*cmddata)(FAR struct spi_dev_s *dev, enum spi_dev_e devid,
+ CODE int (*cmddata)(FAR struct spi_dev_s *dev, uint32_t devid,
bool cmd);
#endif
CODE uint16_t (*send)(FAR struct spi_dev_s *dev, uint16_t wd);
diff --git a/include/nuttx/spi/spi_bitbang.c b/include/nuttx/spi/spi_bitbang.c
index 86b340bcdc..ad490b4b67 100644
--- a/include/nuttx/spi/spi_bitbang.c
+++ b/include/nuttx/spi/spi_bitbang.c
@@ -70,7 +70,7 @@
static void spi_delay(uint32_t holdtime);
static void spi_select(FAR struct spi_bitbang_s *priv,
- enum spi_dev_e devid, bool selected);
+ uint32_t devid, bool selected);
static uint32_t spi_setfrequency(FAR struct spi_bitbang_s *priv,
uint32_t frequency);
static void spi_setmode(FAR struct spi_bitbang_s *priv,
@@ -90,10 +90,10 @@ static uint16_t spi_bitexchange3(uint16_t dataout, uint32_t holdtime);
static uint16_t spi_exchange(FAR struct spi_bitbang_s *priv,
uint16_t dataout);
static uint8_t spi_status(FAR struct spi_bitbang_s *priv,
- enum spi_dev_e devid);
+ uint32_t devid);
#ifdef CONFIG_SPI_CMDDATA
static int spi_cmddata(FAR struct spi_bitbang_s *priv,
- enum spi_dev_e devid, bool cmd);
+ uint32_t devid, bool cmd);
#endif
/****************************************************************************
diff --git a/include/nuttx/spi/spi_bitbang.h b/include/nuttx/spi/spi_bitbang.h
index f5058be9d3..9f3a010671 100644
--- a/include/nuttx/spi/spi_bitbang.h
+++ b/include/nuttx/spi/spi_bitbang.h
@@ -63,7 +63,7 @@ struct spi_bitbang_ops_s
{
/* Platform specific chip select logic */
- void (*select)(FAR struct spi_bitbang_s *priv, enum spi_dev_e devid,
+ void (*select)(FAR struct spi_bitbang_s *priv, uint32_t devid,
bool selected);
/* Platform-specific, SPI frequency function */
@@ -81,12 +81,12 @@ struct spi_bitbang_ops_s
/* Platform-specific word exchange function */
- uint8_t (*status)(FAR struct spi_bitbang_s *priv, enum spi_dev_e devid);
+ uint8_t (*status)(FAR struct spi_bitbang_s *priv, uint32_t devid);
#ifdef CONFIG_SPI_CMDDATA
/* Platform-specific CMD/DATA function */
- int (*cmddata)(FAR struct spi_bitbang_s *priv, enum spi_dev_e devid,
+ int (*cmddata)(FAR struct spi_bitbang_s *priv, uint32_t devid,
bool cmd);
#endif
};
diff --git a/include/nuttx/spi/spi_transfer.h b/include/nuttx/spi/spi_transfer.h
index ef31e84265..071f5c1134 100644
--- a/include/nuttx/spi/spi_transfer.h
+++ b/include/nuttx/spi/spi_transfer.h
@@ -109,7 +109,7 @@ struct spi_sequence_s
{
/* Properties that are fixed throughout the transfer */
- uint8_t dev; /* See enum spi_dev_e */
+ uint32_t dev; /* See enum spi_devtype_e */
uint8_t mode; /* See enum spi_mode_e */
uint8_t nbits; /* Number of bits */
uint8_t ntrans; /* Number of transactions */
diff --git a/include/nuttx/wireless/cc3000.h b/include/nuttx/wireless/cc3000.h
index 6aa234ed56..0350578b39 100644
--- a/include/nuttx/wireless/cc3000.h
+++ b/include/nuttx/wireless/cc3000.h
@@ -50,7 +50,7 @@
#include
#include
-#include
+#include
/****************************************************************************
* Pre-processor Definitions
@@ -67,13 +67,13 @@
/* IOCTL commands */
-#define CC3000IOC_GETQUESEMID _WLIOC(CC3000_FIRST+0) /* arg: Address of int for number*/
-#define CC3000IOC_ADDSOCKET _WLIOC(CC3000_FIRST+1) /* arg: Address of int for result*/
-#define CC3000IOC_REMOVESOCKET _WLIOC(CC3000_FIRST+2) /* arg: Address of int for result*/
-#define CC3000IOC_SELECTDATA _WLIOC(CC3000_FIRST+3) /* arg: Address of int for result*/
-#define CC3000IOC_SELECTACCEPT _WLIOC(CC3000_FIRST+4) /* arg: Address of struct cc3000_acceptcfg_s */
-#define CC3000IOC_SETRX_SIZE _WLIOC(CC3000_FIRST+5) /* arg: Address of int for new size */
-#define CC3000IOC_REMOTECLOSEDSOCKET _WLIOC(CC3000_FIRST+6) /* arg: Address of int for result*/
+#define CC3000IOC_GETQUESEMID _WLCIOC(CC3000_FIRST+0) /* arg: Address of int for number*/
+#define CC3000IOC_ADDSOCKET _WLCIOC(CC3000_FIRST+1) /* arg: Address of int for result*/
+#define CC3000IOC_REMOVESOCKET _WLCIOC(CC3000_FIRST+2) /* arg: Address of int for result*/
+#define CC3000IOC_SELECTDATA _WLCIOC(CC3000_FIRST+3) /* arg: Address of int for result*/
+#define CC3000IOC_SELECTACCEPT _WLCIOC(CC3000_FIRST+4) /* arg: Address of struct cc3000_acceptcfg_s */
+#define CC3000IOC_SETRX_SIZE _WLCIOC(CC3000_FIRST+5) /* arg: Address of int for new size */
+#define CC3000IOC_REMOTECLOSEDSOCKET _WLCIOC(CC3000_FIRST+6) /* arg: Address of int for result*/
/****************************************************************************
* Public Types
diff --git a/include/nuttx/wireless/cc3000/include/cc3000_upif.h b/include/nuttx/wireless/cc3000/include/cc3000_upif.h
index e24d572b00..e44a2cf45c 100644
--- a/include/nuttx/wireless/cc3000/include/cc3000_upif.h
+++ b/include/nuttx/wireless/cc3000/include/cc3000_upif.h
@@ -54,7 +54,6 @@
#include
#include
#include
-#include
#if defined(CONFIG_DRIVERS_WIRELESS) && defined(CONFIG_WL_CC3000)
diff --git a/include/nuttx/wireless/ioctl.h b/include/nuttx/wireless/ioctl.h
new file mode 100644
index 0000000000..1d9c38dd8d
--- /dev/null
+++ b/include/nuttx/wireless/ioctl.h
@@ -0,0 +1,109 @@
+/************************************************************************************
+ * include/nuttx/wireless/ioctl.h
+ * Wireless character driver IOCTL commands
+ *
+ * Copyright (C) 2011-2013, 2017 Gregory Nutt. All rights reserved.
+ * Author: Laurent Latil
+ * Gregory Nutt
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in
+ * the documentation and/or other materials provided with the
+ * distribution.
+ * 3. Neither the name NuttX nor the names of its contributors may be
+ * used to endorse or promote products derived from this software
+ * without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+ * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+ * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+ * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+ * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+ * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+ * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ *
+ ************************************************************************************/
+
+/* This file includes common definitions to be used in all wireless character drivers
+ * (when applicable).
+ */
+
+#ifndef __INCLUDE_NUTTX_WIRELESS_IOCTL_H
+#define __INCLUDE_NUTTX_WIRELESS_IOCTL_H
+
+/************************************************************************************
+ * Included Files
+ ************************************************************************************/
+
+#include
+#include
+
+#ifdef CONFIG_DRIVERS_WIRELESS
+
+/************************************************************************************
+ * Pre-processor Definitions
+ ************************************************************************************/
+
+/* Character Driver IOCTL commands *************************************************/
+/* Non-compatible, NuttX only IOCTL definitions for use with low-level wireless
+ * drivers that are accessed via a character device. Use of these IOCTL commands
+ * requires a file descriptor created by the open() interface.
+ */
+
+#define WLIOC_SETRADIOFREQ _WLCIOC(0x0001) /* arg: Pointer to uint32_t, frequency
+ * value (in Mhz) */
+#define WLIOC_GETRADIOFREQ _WLCIOC(0x0002) /* arg: Pointer to uint32_t, frequency
+ * value (in Mhz) */
+#define WLIOC_SETADDR _WLCIOC(0x0003) /* arg: Pointer to address value, format
+ * of the address is driver specific */
+#define WLIOC_GETADDR _WLCIOC(0x0004) /* arg: Pointer to address value, format
+ * of the address is driver specific */
+#define WLIOC_SETTXPOWER _WLCIOC(0x0005) /* arg: Pointer to int32_t, output power
+ * (in dBm) */
+#define WLIOC_GETTXPOWER _WLCIOC(0x0006) /* arg: Pointer to int32_t, output power
+ * (in dBm) */
+
+/* Device-specific IOCTL commands **************************************************/
+
+#define WL_FIRST 0x0001 /* First common command */
+#define WL_NCMDS 0x0006 /* Number of common commands */
+
+/* User defined ioctl commands are also supported. These will be forwarded
+ * by the upper-half QE driver to the lower-half QE driver via the ioctl()
+ * method fo the QE lower-half interface. However, the lower-half driver
+ * must reserve a block of commands as follows in order prevent IOCTL
+ * command numbers from overlapping.
+ */
+
+/* See include/nuttx/wireless/cc3000.h */
+
+#define CC3000_FIRST (WL_FIRST + WL_NCMDS)
+#define CC3000_NCMDS 7
+
+/* See include/nuttx/wireless/nrf24l01.h */
+
+#define NRF24L01_FIRST (CC3000_FIRST + CC3000_NCMDS)
+#define NRF24L01_NCMDS 14
+
+/* See include/nuttx/wireless/ieee802154/ieee802154_ioctl.h */
+
+#define IEEE802154_FIRST (NRF24L01_FIRST + NRF24L01_NCMDS)
+#define IEEE802154_NCMDS 2
+
+/************************************************************************************
+ * Public Types
+ ************************************************************************************/
+
+#endif /* CONFIG_DRIVERS_WIRELESS */
+#endif /* __INCLUDE_NUTTX_WIRELESS_IOCTL_H */
diff --git a/include/nuttx/wireless/nrf24l01.h b/include/nuttx/wireless/nrf24l01.h
index 610b3c3682..123eb93503 100644
--- a/include/nuttx/wireless/nrf24l01.h
+++ b/include/nuttx/wireless/nrf24l01.h
@@ -43,7 +43,7 @@
#include
#include
#include
-#include
+#include
#include
#include
@@ -66,20 +66,20 @@
/* IOCTL commands */
-#define NRF24L01IOC_SETRETRCFG _WLIOC(NRF24L01_FIRST+0) /* arg: Pointer to nrf24l01_retrcfg_t structure */
-#define NRF24L01IOC_GETRETRCFG _WLIOC(NRF24L01_FIRST+1) /* arg: Pointer to nrf24l01_retrcfg_t structure */
-#define NRF24L01IOC_SETPIPESCFG _WLIOC(NRF24L01_FIRST+2) /* arg: Pointer to an array of nrf24l01_pipecfg_t pointers */
-#define NRF24L01IOC_GETPIPESCFG _WLIOC(NRF24L01_FIRST+3) /* arg: Pointer to an array of nrf24l01_pipecfg_t pointers */
-#define NRF24L01IOC_SETPIPESENABLED _WLIOC(NRF24L01_FIRST+4) /* arg: Pointer to a uint8_t value, bit field of enabled / disabled pipes */
-#define NRF24L01IOC_GETPIPESENABLED _WLIOC(NRF24L01_FIRST+5) /* arg: Pointer to a uint8_t value, bit field of enabled / disabled pipes */
-#define NRF24L01IOC_SETDATARATE _WLIOC(NRF24L01_FIRST+6) /* arg: Pointer to a nrf24l01_datarate_t value */
-#define NRF24L01IOC_GETDATARATE _WLIOC(NRF24L01_FIRST+7) /* arg: Pointer to a nrf24l01_datarate_t value */
-#define NRF24L01IOC_SETADDRWIDTH _WLIOC(NRF24L01_FIRST+8) /* arg: Pointer to an uint32_t value, width of the address */
-#define NRF24L01IOC_GETADDRWIDTH _WLIOC(NRF24L01_FIRST+9) /* arg: Pointer to an uint32_t value, width of the address */
-#define NRF24L01IOC_SETSTATE _WLIOC(NRF24L01_FIRST+10) /* arg: Pointer to a nrf24l01_state_t value */
-#define NRF24L01IOC_GETSTATE _WLIOC(NRF24L01_FIRST+11) /* arg: Pointer to a nrf24l01_state_t value */
-#define NRF24L01IOC_GETLASTXMITCOUNT _WLIOC(NRF24L01_FIRST+12) /* arg: Pointer to an uint32_t value, retransmission count of the last send operation (NRF24L01_XMIT_MAXRT if no ACK received)*/
-#define NRF24L01IOC_GETLASTPIPENO _WLIOC(NRF24L01_FIRST+13) /* arg: Pointer to an uint32_t value, pipe # of the last received packet */
+#define NRF24L01IOC_SETRETRCFG _WLCIOC(NRF24L01_FIRST+0) /* arg: Pointer to nrf24l01_retrcfg_t structure */
+#define NRF24L01IOC_GETRETRCFG _WLCIOC(NRF24L01_FIRST+1) /* arg: Pointer to nrf24l01_retrcfg_t structure */
+#define NRF24L01IOC_SETPIPESCFG _WLCIOC(NRF24L01_FIRST+2) /* arg: Pointer to an array of nrf24l01_pipecfg_t pointers */
+#define NRF24L01IOC_GETPIPESCFG _WLCIOC(NRF24L01_FIRST+3) /* arg: Pointer to an array of nrf24l01_pipecfg_t pointers */
+#define NRF24L01IOC_SETPIPESENABLED _WLCIOC(NRF24L01_FIRST+4) /* arg: Pointer to a uint8_t value, bit field of enabled / disabled pipes */
+#define NRF24L01IOC_GETPIPESENABLED _WLCIOC(NRF24L01_FIRST+5) /* arg: Pointer to a uint8_t value, bit field of enabled / disabled pipes */
+#define NRF24L01IOC_SETDATARATE _WLCIOC(NRF24L01_FIRST+6) /* arg: Pointer to a nrf24l01_datarate_t value */
+#define NRF24L01IOC_GETDATARATE _WLCIOC(NRF24L01_FIRST+7) /* arg: Pointer to a nrf24l01_datarate_t value */
+#define NRF24L01IOC_SETADDRWIDTH _WLCIOC(NRF24L01_FIRST+8) /* arg: Pointer to an uint32_t value, width of the address */
+#define NRF24L01IOC_GETADDRWIDTH _WLCIOC(NRF24L01_FIRST+9) /* arg: Pointer to an uint32_t value, width of the address */
+#define NRF24L01IOC_SETSTATE _WLCIOC(NRF24L01_FIRST+10) /* arg: Pointer to a nrf24l01_state_t value */
+#define NRF24L01IOC_GETSTATE _WLCIOC(NRF24L01_FIRST+11) /* arg: Pointer to a nrf24l01_state_t value */
+#define NRF24L01IOC_GETLASTXMITCOUNT _WLCIOC(NRF24L01_FIRST+12) /* arg: Pointer to an uint32_t value, retransmission count of the last send operation (NRF24L01_XMIT_MAXRT if no ACK received)*/
+#define NRF24L01IOC_GETLASTPIPENO _WLCIOC(NRF24L01_FIRST+13) /* arg: Pointer to an uint32_t value, pipe # of the last received packet */
/* Aliased name for these commands */
diff --git a/include/nuttx/wireless/wireless.h b/include/nuttx/wireless/wireless.h
index a09c2bb148..a07a4cbf70 100644
--- a/include/nuttx/wireless/wireless.h
+++ b/include/nuttx/wireless/wireless.h
@@ -1,8 +1,9 @@
/************************************************************************************
* include/nuttx/wireless/wireless.h
+ * Wireless network IOCTL commands
*
* Copyright (C) 2011-2013, 2017 Gregory Nutt. All rights reserved.
- * Author: Laurent Latil
+ * Author: Gregory Nutt
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
@@ -33,7 +34,7 @@
*
************************************************************************************/
-/* This file includes common definitions to be used in all wireless drivers
+/* This file includes common definitions to be used in all wireless network drivers
* (when applicable).
*/
@@ -153,49 +154,11 @@
#define SIOCSIWPMKSA _WLIOC(0x0032) /* PMKSA cache operation */
-#define WL_FIRSTCHAR 0x0033
-#define WL_NNETCMDS 0x0032
+/* Device-specific network IOCTL commands ******************************************/
-/* Character Driver IOCTL commands *************************************************/
-/* Non-compatible, NuttX only IOCTL definitions for use with low-level wireless
- * drivers that are accessed via a character device. Use of these IOCTL commands
- * requires a file descriptor created by the open() interface.
- */
-
-#define WLIOC_SETRADIOFREQ _WLIOC(0x0033) /* arg: Pointer to uint32_t, frequency
- * value (in Mhz) */
-#define WLIOC_GETRADIOFREQ _WLIOC(0x0034) /* arg: Pointer to uint32_t, frequency
- * value (in Mhz) */
-#define WLIOC_SETADDR _WLIOC(0x0035) /* arg: Pointer to address value, format
- * of the address is driver specific */
-#define WLIOC_GETADDR _WLIOC(0x0036) /* arg: Pointer to address value, format
- * of the address is driver specific */
-#define WLIOC_SETTXPOWER _WLIOC(0x0037) /* arg: Pointer to int32_t, output power
- * (in dBm) */
-#define WLIOC_GETTXPOWER _WLIOC(0x0038) /* arg: Pointer to int32_t, output power
- * (in dBm) */
-
-/* Device-specific IOCTL commands **************************************************/
-
-#define WL_FIRST 0x0001 /* First common command */
-#define WL_NCMDS 0x0038 /* Number of common commands */
-
-/* User defined ioctl commands are also supported. These will be forwarded
- * by the upper-half QE driver to the lower-half QE driver via the ioctl()
- * method fo the QE lower-half interface. However, the lower-half driver
- * must reserve a block of commands as follows in order prevent IOCTL
- * command numbers from overlapping.
- */
-
-/* See include/nuttx/wireless/cc3000.h */
-
-#define CC3000_FIRST (WL_FIRST + WL_NCMDS)
-#define CC3000_NCMDS 7
-
-/* See include/nuttx/wireless/nrf24l01.h */
-
-#define NRF24L01_FIRST (CC3000_FIRST + CC3000_NCMDS)
-#define NRF24L01_NCMDS 14
+#define WL_NETFIRST 0x0001 /* First network command */
+#define WL_NNETCMDS 0x0032 /* Number of network commands */
+#define WL_USERFIRST (WL_NETFIRST + WL_NNETCMDS)
/* Other Common Wireless Definitions ***********************************************/
diff --git a/include/sys/ioctl.h b/include/sys/ioctl.h
index 985ca1357b..acbcc1d3e6 100644
--- a/include/sys/ioctl.h
+++ b/include/sys/ioctl.h
@@ -45,11 +45,25 @@
#include
#include
-/* Include network ioctls info */
+#if CONFIG_NSOCKET_DESCRIPTORS > 0
+#ifdef CONFIG_NET
+/* Include network IOCTL definitions */
-#if defined(CONFIG_NET) && CONFIG_NSOCKET_DESCRIPTORS > 0
-# include
+# include
+
+#ifdef CONFIG_NETDEV_WIRELESS_IOCTL
+/* Include wireless network IOCTL definitions */
+
+# include
#endif
+#endif /* CONFIG_NET */
+
+#ifdef CONFIG_DRIVERS_WIRELESS
+/* Include wireless character driver IOCTL definitions */
+
+# include
+#endif
+#endif /* CONFIG_NSOCKET_DESCRIPTORS > 0 */
/****************************************************************************
* Pre-processor Definitions
diff --git a/net/sixlowpan/README.txt b/net/sixlowpan/README.txt
index ca8a513d6a..5b6b4e298d 100644
--- a/net/sixlowpan/README.txt
+++ b/net/sixlowpan/README.txt
@@ -49,7 +49,7 @@ The length of the fragment header length is four bytes for the first header
(FRAG1) and five bytes for all subsequent headers (FRAGN). For example,
this is a HC1 compressed first frame of a packet
- 41 88 01 cefa 3412 cdab ### 9-byte MAC header
+ 41 88 2a cefa 3412 cdab ### 9-byte MAC header
c50e 000b ### 4-byte FRAG1 header
42 ### SIXLOWPAN_DISPATCH_HC1
fb ### RIME_HC1_HC_UDP_HC1_ENCODING
@@ -66,7 +66,7 @@ this is a HC1 compressed first frame of a packet
This is the second frame of the same transfer:
- 41 88 01 cefa 3412 cdab ### 9-byte MAC header
+ 41 88 2b cefa 3412 cdab ### 9-byte MAC header
e50e 000b 0d ### 5 byte FRAGN header
42 ### SIXLOWPAN_DISPATCH_HC1
fb ### RIME_HC1_HC_UDP_HC1_ENCODING
diff --git a/net/sixlowpan/sixlowpan_framelist.c b/net/sixlowpan/sixlowpan_framelist.c
index c9985872ba..9f7a68a1f7 100644
--- a/net/sixlowpan/sixlowpan_framelist.c
+++ b/net/sixlowpan/sixlowpan_framelist.c
@@ -281,7 +281,7 @@ int sixlowpan_queue_frames(FAR struct ieee802154_driver_s *ieee,
ninfo("Sending packet length %d\n", buflen);
- /* Set the source and destinatino address */
+ /* Set the source and destination address */
rimeaddr_copy(&g_pktaddrs[PACKETBUF_ADDR_SENDER],
&ieee->i_dev.d_mac.ieee802154);
@@ -348,7 +348,9 @@ int sixlowpan_queue_frames(FAR struct ieee802154_driver_s *ieee,
ninfo("Sending fragmented packet length %d\n", buflen);
/* Create 1st Fragment */
- /* Add the frame header using the pre-allocated IOB. */
+ /* Add the frame header using the pre-allocated IOB using the DSN
+ * selected by sixlowpan_send_hdrlen().
+ */
verify = sixlowpan_framecreate(ieee, iob, ieee->i_panid);
DEBUGASSERT(verify == framer_hdrlen);
@@ -434,11 +436,17 @@ int sixlowpan_queue_frames(FAR struct ieee802154_driver_s *ieee,
iob->io_pktlen = 0;
fptr = iob->io_data;
- /* Copy the frame header at the beginning of the frame. */
+ /* Add a new frame header to the IOB (same as the first but with a
+ * different DSN).
+ */
- memcpy(fptr, frame1, framer_hdrlen);
+ g_pktattrs[PACKETBUF_ATTR_MAC_SEQNO] = 0;
- /* Move HC1/HC06/IPv6 header the frame header from first
+ verify = sixlowpan_framecreate(ieee, iob, ieee->i_panid);
+ DEBUGASSERT(verify == framer_hdrlen);
+ UNUSED(verify);
+
+ /* Copy the HC1/HC06/IPv6 header the frame header from first
* frame, into the correct location after the FRAGN header
* of subsequent frames.
*/
diff --git a/net/sixlowpan/sixlowpan_framer.c b/net/sixlowpan/sixlowpan_framer.c
index 13aa9fecd3..da52303c6c 100644
--- a/net/sixlowpan/sixlowpan_framer.c
+++ b/net/sixlowpan/sixlowpan_framer.c
@@ -322,12 +322,12 @@ static void sixlowpan_setup_params(FAR struct ieee802154_driver_s *ieee,
if (g_pktattrs[PACKETBUF_ATTR_MAC_SEQNO] != 0)
{
- params->seq = g_pktattrs[PACKETBUF_ATTR_MAC_SEQNO];
+ params->seq = g_pktattrs[PACKETBUF_ATTR_MAC_SEQNO] & 0xff;
}
else
{
params->seq = ieee->i_dsn++;
- g_pktattrs[PACKETBUF_ATTR_MAC_SEQNO] = params->seq;
+ g_pktattrs[PACKETBUF_ATTR_MAC_SEQNO] = params->seq | 0x100;
}
/* Complete the addressing fields. */
diff --git a/net/socket/net_clone.c b/net/socket/net_clone.c
index a08c236329..d720eb8731 100644
--- a/net/socket/net_clone.c
+++ b/net/socket/net_clone.c
@@ -50,6 +50,8 @@
#include "tcp/tcp.h"
#include "udp/udp.h"
+#include "pkt/pkt.h"
+#include "local/local.h"
#include "socket/socket.h"
#include "usrsock/usrsock.h"
@@ -97,6 +99,24 @@ int net_clone(FAR struct socket *psock1, FAR struct socket *psock2)
DEBUGASSERT(psock2->s_conn);
psock2->s_crefs = 1; /* One reference on the new socket itself */
+#ifdef CONFIG_NET_LOCAL
+ if (psock2->s_domain == PF_LOCAL)
+ {
+ FAR struct local_conn_s *conn = psock2->s_conn;
+ DEBUGASSERT(conn->lc_crefs > 0 && conn->lc_crefs < 255);
+ conn->lc_crefs++;
+ }
+ else
+#endif
+#ifdef CONFIG_NET_PKT
+ if (psock2->s_type == SOCK_RAW)
+ {
+ FAR struct pkt_conn_s *conn = psock2->s_conn;
+ DEBUGASSERT(conn->crefs > 0 && conn->crefs < 255);
+ conn->crefs++;
+ }
+ else
+#endif
#ifdef NET_TCP_HAVE_STACK
if (psock2->s_type == SOCK_STREAM)
{
diff --git a/wireless/ieee802154/mac802154_loopback.c b/wireless/ieee802154/mac802154_loopback.c
index af1320fccf..f914b5db1a 100644
--- a/wireless/ieee802154/mac802154_loopback.c
+++ b/wireless/ieee802154/mac802154_loopback.c
@@ -618,6 +618,10 @@ int ieee8021514_loopback(void)
priv->lo_polldog = wd_create(); /* Create periodic poll timer */
+ /* Initialize the DSN to a "random" value */
+
+ priv->lo_ieee.i_dsn = 42;
+
/* Register the loopabck device with the OS so that socket IOCTLs can b
* performed.
*/