diff --git a/arch/arm/src/lpc31xx/lpc31_spi.c b/arch/arm/src/lpc31xx/lpc31_spi.c index 9f64e5d7726..871eca69da3 100644 --- a/arch/arm/src/lpc31xx/lpc31_spi.c +++ b/arch/arm/src/lpc31xx/lpc31_spi.c @@ -491,15 +491,15 @@ static void spi_select(FAR struct spi_dev_s *dev, uint32_t devid, bool selected) * 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; diff --git a/arch/sim/src/up_spiflash.c b/arch/sim/src/up_spiflash.c index 46b96e22019..677bdafd969 100644 --- a/arch/sim/src/up_spiflash.c +++ b/arch/sim/src/up_spiflash.c @@ -362,7 +362,7 @@ static void spiflash_select(FAR struct spi_dev_s *dev, uint32_t devid, { FAR struct sim_spiflashdev_s *priv = (FAR struct sim_spiflashdev_s *)dev; - if (devid == SPIDEV_FLASH) + if (devid == SPIDEV_FLASH(0)) { priv->selected = selected; diff --git a/configs/arduino-due/src/sam_mmcsd.c b/configs/arduino-due/src/sam_mmcsd.c index bd60005f841..e6d461d58fa 100644 --- a/configs/arduino-due/src/sam_mmcsd.c +++ b/configs/arduino-due/src/sam_mmcsd.c @@ -145,7 +145,7 @@ static int spi_cmddata(FAR struct spi_bitbang_s *priv, uint32_t 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) { @@ -175,7 +175,7 @@ static void spi_select(FAR struct spi_bitbang_s *priv, uint32_t 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; } diff --git a/configs/clicker2-stm32/src/stm32_spi.c b/configs/clicker2-stm32/src/stm32_spi.c index 1939c4c4c43..84e0538ab61 100644 --- a/configs/clicker2-stm32/src/stm32_spi.c +++ b/configs/clicker2-stm32/src/stm32_spi.c @@ -139,7 +139,7 @@ void stm32_spi3select(FAR struct spi_dev_s *dev, uint32_t devid, bool selected) 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; diff --git a/configs/cloudctrl/src/stm32_spi.c b/configs/cloudctrl/src/stm32_spi.c index e64428bc4b6..4ba4e9560ab 100644 --- a/configs/cloudctrl/src/stm32_spi.c +++ b/configs/cloudctrl/src/stm32_spi.c @@ -119,7 +119,7 @@ void stm32_spi1select(FAR struct spi_dev_s *dev, uint32_t devid, bool selected) /* 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 */ diff --git a/configs/eagle100/src/lm_ssi.c b/configs/eagle100/src/lm_ssi.c index b6722c2ba18..a65fe7c0857 100644 --- a/configs/eagle100/src/lm_ssi.c +++ b/configs/eagle100/src/lm_ssi.c @@ -110,7 +110,7 @@ void weak_function lm_ssidev_initialize(void) 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 */ diff --git a/configs/ekk-lm3s9b96/src/lm_ssi.c b/configs/ekk-lm3s9b96/src/lm_ssi.c index 05dbf37b5ed..cb9ee6e245c 100644 --- a/configs/ekk-lm3s9b96/src/lm_ssi.c +++ b/configs/ekk-lm3s9b96/src/lm_ssi.c @@ -111,14 +111,14 @@ 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 */ diff --git a/configs/fire-stm32v2/src/stm32_spi.c b/configs/fire-stm32v2/src/stm32_spi.c index 43ffb030b94..a6b86ea92a6 100644 --- a/configs/fire-stm32v2/src/stm32_spi.c +++ b/configs/fire-stm32v2/src/stm32_spi.c @@ -145,14 +145,14 @@ void stm32_spi1select(FAR struct spi_dev_s *dev, uint32_t devid, bool selected) 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 */ diff --git a/configs/freedom-kl25z/src/kl_spi.c b/configs/freedom-kl25z/src/kl_spi.c index ec26f436cd9..e952963d1be 100644 --- a/configs/freedom-kl25z/src/kl_spi.c +++ b/configs/freedom-kl25z/src/kl_spi.c @@ -146,7 +146,7 @@ void kl_spi0select(FAR struct spi_dev_s *dev, uint32_t devid, (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, uint32_t devid, #endif #if defined(CONFIG_WL_CC3000) - if (devid == SPIDEV_WIRELESS) + if (devid == SPIDEV_WIRELESS(0)) { kl_gpiowrite(GPIO_WIFI_CS, !selected); } diff --git a/configs/hymini-stm32v/src/stm32_spi.c b/configs/hymini-stm32v/src/stm32_spi.c index 3bd5b9a7e54..568cdb24944 100644 --- a/configs/hymini-stm32v/src/stm32_spi.c +++ b/configs/hymini-stm32v/src/stm32_spi.c @@ -111,7 +111,7 @@ 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 */ diff --git a/configs/lm3s6432-s2e/src/lm_ssi.c b/configs/lm3s6432-s2e/src/lm_ssi.c index b9398dc0fe7..7b185642fcb 100644 --- a/configs/lm3s6432-s2e/src/lm_ssi.c +++ b/configs/lm3s6432-s2e/src/lm_ssi.c @@ -110,7 +110,7 @@ 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 */ diff --git a/configs/lm3s6965-ek/src/lm_oled.c b/configs/lm3s6965-ek/src/lm_oled.c index fa02d2b2e88..93705b76cdb 100644 --- a/configs/lm3s6965-ek/src/lm_oled.c +++ b/configs/lm3s6965-ek/src/lm_oled.c @@ -164,7 +164,7 @@ FAR struct lcd_dev_s *board_graphics_setup(unsigned int devno) 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 52955e068da..980796f4a2f 100644 --- a/configs/lm3s6965-ek/src/lm_ssi.c +++ b/configs/lm3s6965-ek/src/lm_ssi.c @@ -115,14 +115,14 @@ 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 */ diff --git a/configs/lm3s8962-ek/src/lm_oled.c b/configs/lm3s8962-ek/src/lm_oled.c index 491ee7c18f5..cffc1e8a3ce 100644 --- a/configs/lm3s8962-ek/src/lm_oled.c +++ b/configs/lm3s8962-ek/src/lm_oled.c @@ -162,7 +162,7 @@ FAR struct lcd_dev_s *board_graphics_setup(unsigned int devno) 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 260127aae0a..3834ce5d788 100644 --- a/configs/lm3s8962-ek/src/lm_ssi.c +++ b/configs/lm3s8962-ek/src/lm_ssi.c @@ -115,14 +115,14 @@ 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 */ diff --git a/configs/lpcxpresso-lpc1115/src/lpc11_ssp.c b/configs/lpcxpresso-lpc1115/src/lpc11_ssp.c index 8803aaba79e..a0ae6871f16 100644 --- a/configs/lpcxpresso-lpc1115/src/lpc11_ssp.c +++ b/configs/lpcxpresso-lpc1115/src/lpc11_ssp.c @@ -153,14 +153,14 @@ 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 */ @@ -172,7 +172,7 @@ 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) { - 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 55280e90911..62050a2297c 100644 --- a/configs/lpcxpresso-lpc1768/src/lpc17_oled.c +++ b/configs/lpcxpresso-lpc1768/src/lpc17_oled.c @@ -161,7 +161,7 @@ FAR struct lcd_dev_s *board_graphics_setup(unsigned int devno) 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 7411c9e16df..4aace2c26cc 100644 --- a/configs/lpcxpresso-lpc1768/src/lpc17_ssp.c +++ b/configs/lpcxpresso-lpc1768/src/lpc17_ssp.c @@ -153,14 +153,14 @@ 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 */ @@ -172,7 +172,7 @@ 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) { - 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 a1c9ac3fcc6..b13125d8c44 100644 --- a/configs/maple/src/stm32_spi.c +++ b/configs/maple/src/stm32_spi.c @@ -110,7 +110,7 @@ void stm32_spi1select(FAR struct spi_dev_s *dev, uint32_t devid, 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); } diff --git a/configs/mikroe-stm32f4/src/stm32_spi.c b/configs/mikroe-stm32f4/src/stm32_spi.c index 987bc2d450c..05bb88a21ad 100644 --- a/configs/mikroe-stm32f4/src/stm32_spi.c +++ b/configs/mikroe-stm32f4/src/stm32_spi.c @@ -127,11 +127,11 @@ 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, uint32_t devid, bool selected) #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, uint32_t devid, bool selected) #endif #if defined(CONFIG_MTD_M25P) - if (devid == SPIDEV_FLASH) + if (devid == SPIDEV_FLASH(0)) { stm32_gpiowrite(GPIO_CS_FLASH, !selected); } @@ -156,7 +156,7 @@ void stm32_spi3select(FAR struct spi_dev_s *dev, uint32_t devid, bool selected) /* Must be the expansion header device */ - if (devid == SPIDEV_EXPANDER) + if (devid == SPIDEV_EXPANDER(0)) { stm32_gpiowrite(GPIO_CS_EXP_SPI3, !selected); } @@ -167,7 +167,7 @@ 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 */ diff --git a/configs/mirtoo/src/pic32_spi2.c b/configs/mirtoo/src/pic32_spi2.c index df7fbd3fe6f..2b74f7957bd 100644 --- a/configs/mirtoo/src/pic32_spi2.c +++ b/configs/mirtoo/src/pic32_spi2.c @@ -159,11 +159,11 @@ void pic32mx_spi2select(FAR struct spi_dev_s *dev, uint32_t devid, bool selecte { 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); } diff --git a/configs/nucleo-f303re/src/stm32_spi.c b/configs/nucleo-f303re/src/stm32_spi.c index 1a7e748a170..6e706a85095 100644 --- a/configs/nucleo-f303re/src/stm32_spi.c +++ b/configs/nucleo-f303re/src/stm32_spi.c @@ -109,7 +109,7 @@ void stm32_spi1select(FAR struct spi_dev_s *dev, uint32_t devid, 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); } @@ -176,7 +176,7 @@ 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; diff --git a/configs/nucleo-f4x1re/src/stm32_spi.c b/configs/nucleo-f4x1re/src/stm32_spi.c index bb560531683..cdcb582fd54 100644 --- a/configs/nucleo-f4x1re/src/stm32_spi.c +++ b/configs/nucleo-f4x1re/src/stm32_spi.c @@ -146,14 +146,14 @@ 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); } @@ -172,7 +172,7 @@ 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); } diff --git a/configs/nucleo-l476rg/src/stm32_spi.c b/configs/nucleo-l476rg/src/stm32_spi.c index dcdda1a7000..6e45b6f76cc 100644 --- a/configs/nucleo-l476rg/src/stm32_spi.c +++ b/configs/nucleo-l476rg/src/stm32_spi.c @@ -146,14 +146,14 @@ 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); } @@ -172,7 +172,7 @@ 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); } diff --git a/configs/olimex-lpc1766stk/src/lpc17_ssp.c b/configs/olimex-lpc1766stk/src/lpc17_ssp.c index ebfa370d122..5ef529f2a7b 100644 --- a/configs/olimex-lpc1766stk/src/lpc17_ssp.c +++ b/configs/olimex-lpc1766stk/src/lpc17_ssp.c @@ -266,7 +266,7 @@ void weak_function lpc1766stk_sspdev_initialize(void) 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 */ @@ -287,7 +287,7 @@ uint8_t lpc17_ssp0status(FAR struct spi_dev_s *dev, uint32_t devid) 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 */ diff --git a/configs/olimex-stm32-p107/src/stm32_spi.c b/configs/olimex-stm32-p107/src/stm32_spi.c index ec1398542eb..aa143b08883 100644 --- a/configs/olimex-stm32-p107/src/stm32_spi.c +++ b/configs/olimex-stm32-p107/src/stm32_spi.c @@ -112,7 +112,7 @@ 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 */ diff --git a/configs/olimexino-stm32/src/stm32_spi.c b/configs/olimexino-stm32/src/stm32_spi.c index 672c104b728..dd8fe9588c5 100644 --- a/configs/olimexino-stm32/src/stm32_spi.c +++ b/configs/olimexino-stm32/src/stm32_spi.c @@ -110,7 +110,7 @@ void weak_function stm32_spidev_initialize(void) 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); } @@ -127,7 +127,7 @@ 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); } diff --git a/configs/open1788/src/lpc17_ssp.c b/configs/open1788/src/lpc17_ssp.c index df354c770f2..e904144f246 100644 --- a/configs/open1788/src/lpc17_ssp.c +++ b/configs/open1788/src/lpc17_ssp.c @@ -146,7 +146,7 @@ uint8_t lpc17_ssp0status(FAR struct spi_dev_s *dev, uint32_t devid) 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 */ diff --git a/configs/pic32mx7mmb/src/pic32_spi.c b/configs/pic32mx7mmb/src/pic32_spi.c index f1d65cb8edf..e12795b5f5d 100644 --- a/configs/pic32mx7mmb/src/pic32_spi.c +++ b/configs/pic32mx7mmb/src/pic32_spi.c @@ -134,7 +134,7 @@ void pic32mx_spi1select(FAR struct spi_dev_s *dev, uint32_t devid, bool selecte { 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); } @@ -146,7 +146,7 @@ uint8_t pic32mx_spi1status(FAR struct spi_dev_s *dev, uint32_t devid) /* Card detect active low. */ - if (devid == SPIDEV_MMCSD) + if (devid == SPIDEV_MMCSD(0)) { if (!pic32mx_gpioread(GPIO_SD_CD)) { diff --git a/configs/sam3u-ek/src/sam_spi.c b/configs/sam3u-ek/src/sam_spi.c index af55cb2884b..a6a08e70905 100644 --- a/configs/sam3u-ek/src/sam_spi.c +++ b/configs/sam3u-ek/src/sam_spi.c @@ -149,7 +149,7 @@ void sam_spi0select(uint32_t 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); } diff --git a/configs/sam4e-ek/src/sam_spi.c b/configs/sam4e-ek/src/sam_spi.c index 90d0e345fcd..340210ec8c9 100644 --- a/configs/sam4e-ek/src/sam_spi.c +++ b/configs/sam4e-ek/src/sam_spi.c @@ -153,7 +153,7 @@ void sam_spi0select(uint32_t 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(uint32_t 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 diff --git a/configs/sam4l-xplained/src/sam_spi.c b/configs/sam4l-xplained/src/sam_spi.c index be44a7f403d..a6eeee18a21 100644 --- a/configs/sam4l-xplained/src/sam_spi.c +++ b/configs/sam4l-xplained/src/sam_spi.c @@ -145,7 +145,7 @@ 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(uint32_t devid, bool selected) #ifdef CONFIG_SAM4L_XPLAINED_OLED1MODULE /* Select/de-select the OLED */ - if (devid == SPIDEV_DISPLAY) + if (devid == SPIDEV_DISPLAY(0)) { /* Active low */ @@ -190,7 +190,7 @@ uint8_t sam_spi0status(FAR struct spi_dev_s *dev, uint32_t devid) #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 */ @@ -234,7 +234,7 @@ uint8_t sam_spi0status(FAR struct spi_dev_s *dev, uint32_t devid) 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 93e965ffd6a..a4e1b3d95da 100644 --- a/configs/sama5d3-xplained/src/sam_spi.c +++ b/configs/sama5d3-xplained/src/sam_spi.c @@ -145,7 +145,7 @@ 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); } diff --git a/configs/sama5d3x-ek/src/sam_spi.c b/configs/sama5d3x-ek/src/sam_spi.c index f4b4c00928a..c9827f9a77d 100644 --- a/configs/sama5d3x-ek/src/sam_spi.c +++ b/configs/sama5d3x-ek/src/sam_spi.c @@ -145,7 +145,7 @@ 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); } diff --git a/configs/sama5d4-ek/src/sam_spi.c b/configs/sama5d4-ek/src/sam_spi.c index 38cb1da36f2..7534e373b1b 100644 --- a/configs/sama5d4-ek/src/sam_spi.c +++ b/configs/sama5d4-ek/src/sam_spi.c @@ -145,7 +145,7 @@ 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); } diff --git a/configs/samd20-xplained/src/sam_spi.c b/configs/samd20-xplained/src/sam_spi.c index 61b254eec6e..2367243fe54 100644 --- a/configs/samd20-xplained/src/sam_spi.c +++ b/configs/samd20-xplained/src/sam_spi.c @@ -154,7 +154,7 @@ void sam_spi0select(FAR struct spi_dev_s *dev, uint32_t devid, #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, uint32_t devid, #ifdef CONFIG_SAMD20_XPLAINED_OLED1MODULE_EXT1 /* Select/de-select the OLED */ - if (devid == SPIDEV_DISPLAY) + if (devid == SPIDEV_DISPLAY(0)) { /* Active low */ @@ -182,7 +182,7 @@ void sam_spi1select(FAR struct spi_dev_s *dev, uint32_t devid, #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, uint32_t devid, #ifdef CONFIG_SAMD20_XPLAINED_OLED1MODULE_EXT2 /* Select/de-select the OLED */ - if (devid == SPIDEV_DISPLAY) + if (devid == SPIDEV_DISPLAY(0)) { /* Active low */ @@ -254,7 +254,7 @@ uint8_t sam_spi0status(FAR struct spi_dev_s *dev, uint32_t devid) #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 */ @@ -277,7 +277,7 @@ uint8_t sam_spi1status(FAR struct spi_dev_s *dev, uint32_t devid) #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 */ @@ -350,7 +350,7 @@ uint8_t sam_spi5status(FAR struct spi_dev_s *dev, uint32_t devid) 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. @@ -371,7 +371,7 @@ int sam_spi0cmddata(FAR struct spi_dev_s *dev, uint32_t 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. diff --git a/configs/samd21-xplained/src/sam_spi.c b/configs/samd21-xplained/src/sam_spi.c index 275b961362e..32dbdb62bba 100644 --- a/configs/samd21-xplained/src/sam_spi.c +++ b/configs/samd21-xplained/src/sam_spi.c @@ -154,7 +154,7 @@ void sam_spi0select(FAR struct spi_dev_s *dev, uint32_t devid, #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, uint32_t devid, #ifdef CONFIG_SAMD21_XPLAINED_OLED1MODULE_EXT1 /* Select/de-select the OLED */ - if (devid == SPIDEV_DISPLAY) + if (devid == SPIDEV_DISPLAY(0)) { /* Active low */ @@ -182,7 +182,7 @@ void sam_spi1select(FAR struct spi_dev_s *dev, uint32_t devid, #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, uint32_t devid, #ifdef CONFIG_SAMD21_XPLAINED_OLED1MODULE_EXT2 /* Select/de-select the OLED */ - if (devid == SPIDEV_DISPLAY) + if (devid == SPIDEV_DISPLAY(0)) { /* Active low */ @@ -254,7 +254,7 @@ uint8_t sam_spi0status(FAR struct spi_dev_s *dev, uint32_t devid) #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 */ @@ -277,7 +277,7 @@ uint8_t sam_spi1status(FAR struct spi_dev_s *dev, uint32_t devid) #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 */ @@ -350,7 +350,7 @@ uint8_t sam_spi5status(FAR struct spi_dev_s *dev, uint32_t devid) 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. @@ -371,7 +371,7 @@ int sam_spi0cmddata(FAR struct spi_dev_s *dev, uint32_t 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. diff --git a/configs/saml21-xplained/src/sam_spi.c b/configs/saml21-xplained/src/sam_spi.c index e4ecafd7bae..576444508d1 100644 --- a/configs/saml21-xplained/src/sam_spi.c +++ b/configs/saml21-xplained/src/sam_spi.c @@ -154,7 +154,7 @@ void sam_spi0select(FAR struct spi_dev_s *dev, uint32_t devid, #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, uint32_t devid, #ifdef CONFIG_SAML21_XPLAINED_OLED1MODULE_EXT1 /* Select/de-select the OLED */ - if (devid == SPIDEV_DISPLAY) + if (devid == SPIDEV_DISPLAY(0)) { /* Active low */ @@ -182,7 +182,7 @@ void sam_spi1select(FAR struct spi_dev_s *dev, uint32_t devid, #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, uint32_t devid, #ifdef CONFIG_SAML21_XPLAINED_OLED1MODULE_EXT2 /* Select/de-select the OLED */ - if (devid == SPIDEV_DISPLAY) + if (devid == SPIDEV_DISPLAY(0)) { /* Active low */ @@ -254,7 +254,7 @@ uint8_t sam_spi0status(FAR struct spi_dev_s *dev, uint32_t devid) #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 */ @@ -277,7 +277,7 @@ uint8_t sam_spi1status(FAR struct spi_dev_s *dev, uint32_t devid) #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 */ @@ -350,7 +350,7 @@ uint8_t sam_spi5status(FAR struct spi_dev_s *dev, uint32_t devid) 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. @@ -371,7 +371,7 @@ int sam_spi0cmddata(FAR struct spi_dev_s *dev, uint32_t 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. diff --git a/configs/shenzhou/src/stm32_spi.c b/configs/shenzhou/src/stm32_spi.c index 70d6753cc7d..6aeee5018ba 100644 --- a/configs/shenzhou/src/stm32_spi.c +++ b/configs/shenzhou/src/stm32_spi.c @@ -123,13 +123,13 @@ void stm32_spi1select(FAR struct spi_dev_s *dev, uint32_t devid, bool selected) /* 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 */ @@ -161,25 +161,25 @@ void stm32_spi3select(FAR struct spi_dev_s *dev, uint32_t devid, bool selected) * 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 */ diff --git a/configs/spark/src/stm32_spi.c b/configs/spark/src/stm32_spi.c index 587ebeb8e38..8002196d860 100644 --- a/configs/spark/src/stm32_spi.c +++ b/configs/spark/src/stm32_spi.c @@ -134,7 +134,7 @@ void stm32_spi2select(FAR struct spi_dev_s *dev, uint32_t devid, bool selected) #if defined(CONFIG_MTD_SST25) - if (devid == SPIDEV_FLASH) + if (devid == SPIDEV_FLASH(0)) { stm32_gpiowrite(GPIO_MEM_CS, !selected); } @@ -144,7 +144,7 @@ void stm32_spi2select(FAR struct spi_dev_s *dev, uint32_t devid, bool selected) #endif #if defined(CONFIG_WL_CC3000) - if (devid == SPIDEV_WIRELESS) + if (devid == SPIDEV_WIRELESS(0)) { stm32_gpiowrite(GPIO_WIFI_CS, !selected); } diff --git a/configs/stm3210e-eval/src/stm32_spi.c b/configs/stm3210e-eval/src/stm32_spi.c index 92d9af18a92..05c0bdc292d 100644 --- a/configs/stm3210e-eval/src/stm32_spi.c +++ b/configs/stm3210e-eval/src/stm32_spi.c @@ -110,7 +110,7 @@ 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 */ diff --git a/configs/stm32_tiny/src/stm32_spi.c b/configs/stm32_tiny/src/stm32_spi.c index 71bb78744cd..abaac37b9e9 100644 --- a/configs/stm32_tiny/src/stm32_spi.c +++ b/configs/stm32_tiny/src/stm32_spi.c @@ -125,7 +125,7 @@ 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 */ @@ -144,7 +144,7 @@ uint8_t stm32_spi2status(FAR struct spi_dev_s *dev, uint32_t devid) 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 2fc35448699..f6817f57b0c 100644 --- a/configs/stm32butterfly2/src/stm32_spi.c +++ b/configs/stm32butterfly2/src/stm32_spi.c @@ -78,7 +78,7 @@ void stm32_spi1select(struct spi_dev_s *dev, uint32_t devid, { 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); } @@ -95,7 +95,7 @@ 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/stm32_spi.c b/configs/stm32f103-minimum/src/stm32_spi.c index 8a4169cc2c3..0ba7df49d32 100644 --- a/configs/stm32f103-minimum/src/stm32_spi.c +++ b/configs/stm32f103-minimum/src/stm32_spi.c @@ -121,28 +121,28 @@ 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); } @@ -154,14 +154,14 @@ 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; } @@ -213,7 +213,7 @@ 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/stm32f429i-disco/src/stm32_ili93414ws.c b/configs/stm32f429i-disco/src/stm32_ili93414ws.c index 7948c035957..53cf63327e6 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 4cdc0a896e0..7a8c449c624 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 14b20b9b3a6..16a23cc5647 100644 --- a/configs/stm32f429i-disco/src/stm32_spi.c +++ b/configs/stm32f429i-disco/src/stm32_spi.c @@ -154,7 +154,7 @@ uint8_t stm32_spi3status(FAR struct spi_dev_s *dev, uint32_t devid) 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); } @@ -173,7 +173,7 @@ 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); } @@ -247,7 +247,7 @@ int stm32_spi4cmddata(FAR struct spi_dev_s *dev, uint32_t 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 77b53a8ac48..c343520e880 100644 --- a/configs/stm32f4discovery/src/stm32_spi.c +++ b/configs/stm32f4discovery/src/stm32_spi.c @@ -122,7 +122,7 @@ void stm32_spi1select(FAR struct spi_dev_s *dev, uint32_t devid, bool selected) #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); } @@ -145,13 +145,13 @@ 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); } @@ -205,7 +205,7 @@ 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. diff --git a/configs/stm32l476vg-disco/src/stm32_spi.c b/configs/stm32l476vg-disco/src/stm32_spi.c index cca4db6f821..32e813b6397 100644 --- a/configs/stm32l476vg-disco/src/stm32_spi.c +++ b/configs/stm32l476vg-disco/src/stm32_spi.c @@ -148,14 +148,14 @@ 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); } @@ -174,7 +174,7 @@ 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); } diff --git a/configs/sure-pic32mx/src/pic32mx_spi.c b/configs/sure-pic32mx/src/pic32mx_spi.c index f0d5ed4575a..587efd958e6 100644 --- a/configs/sure-pic32mx/src/pic32mx_spi.c +++ b/configs/sure-pic32mx/src/pic32mx_spi.c @@ -181,14 +181,14 @@ void pic32mx_spi2select(FAR struct spi_dev_s *dev, uint32_t devid, bool selected /* 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); } @@ -204,7 +204,7 @@ uint8_t pic32mx_spi2status(FAR struct spi_dev_s *dev, uint32_t 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, uint32_t devid) #endif #ifdef PIC32_HAVE_SOIC - if (devid == SPIDEV_FLASH) + if (devid == SPIDEV_FLASH(0)) { ret = SPI_STATUS_PRESENT; diff --git a/configs/u-blox-c027/src/lpc17_ssp.c b/configs/u-blox-c027/src/lpc17_ssp.c index 07533d055ba..1b4ce631c8a 100644 --- a/configs/u-blox-c027/src/lpc17_ssp.c +++ b/configs/u-blox-c027/src/lpc17_ssp.c @@ -143,14 +143,14 @@ 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 */ @@ -162,7 +162,7 @@ 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) { - 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 7e35062acdb..aa1516e32b7 100644 --- a/configs/viewtool-stm32f107/src/stm32_spi.c +++ b/configs/viewtool-stm32f107/src/stm32_spi.c @@ -132,7 +132,7 @@ void stm32_spi2select(FAR struct spi_dev_s *dev, uint32_t devid, bool selected) #ifdef CONFIG_INPUT_ADS7843E /* Select/de-select the touchscreen */ - if (devid == SPIDEV_TOUCHSCREEN) + if (devid == SPIDEV_TOUCHSCREEN(0)) { stm32_gpiowrite(GPIO_LCDTP_CS, !selected); } diff --git a/configs/zkit-arm-1769/src/lpc17_lcd.c b/configs/zkit-arm-1769/src/lpc17_lcd.c index db54027f3d6..a998c7e4fb6 100644 --- a/configs/zkit-arm-1769/src/lpc17_lcd.c +++ b/configs/zkit-arm-1769/src/lpc17_lcd.c @@ -158,7 +158,7 @@ void board_lcd_uninitialize(void) 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 c264ef403c5..ec6d2773f45 100644 --- a/configs/zkit-arm-1769/src/lpc17_spi.c +++ b/configs/zkit-arm-1769/src/lpc17_spi.c @@ -128,7 +128,7 @@ 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 */ @@ -140,7 +140,7 @@ 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) { - if (devid == SPIDEV_MMCSD) + if (devid == SPIDEV_MMCSD(0)) { /* Read the state of the card-detect bit */ diff --git a/configs/zkit-arm-1769/src/lpc17_ssp.c b/configs/zkit-arm-1769/src/lpc17_ssp.c index cc8ece694c7..b34e102d434 100644 --- a/configs/zkit-arm-1769/src/lpc17_ssp.c +++ b/configs/zkit-arm-1769/src/lpc17_ssp.c @@ -166,7 +166,7 @@ void lpc17_ssp0select(FAR struct spi_dev_s *dev, uint32_t devid, bool selected) 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 */ @@ -179,7 +179,7 @@ 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) { - 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 e9e2bc3a146..1396d9b1f75 100644 --- a/configs/zp214xpa/src/lpc2148_spi1.c +++ b/configs/zp214xpa/src/lpc2148_spi1.c @@ -220,7 +220,7 @@ static void spi_select(FAR struct spi_dev_s *dev, uint32_t devid, bool selected) #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. */ @@ -353,7 +353,7 @@ static int spi_cmddata(FAR struct spi_dev_s *dev, uint32_t devid, bool cmd) #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 c1c7dce0316..6727f67c47c 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 de86444b385..c8adf31494d 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 3582bf98e1c..9c41e9fd789 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 804ea0fa4b6..bf87bc31de8 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 a7b21131810..974173350c0 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 437dfbea854..5fb5a37fdd7 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 820cb873f2d..5b8dc4f5423 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 c3cd4c09f36..e190b5bc2e8 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 a7b192acae6..7cd379ca5b0 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 b67af2bada6..cc28e027f74 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 147e6414ed0..4461502c4fb 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 9a547b8a163..e7a59b7cbf5 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 f88c85ff85c..791040eee5d 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 c95ffaa8a30..5de10bb7c3d 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 ea6175a8560..1e6484f2561 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 f56c8f7cd1f..96d09aea999 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 2a4cdee73dd..7bf4ecdee18 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 936008a5672..b9076c08466 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 777ff3877f3..c499ca2a558 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 4219c0d3b9f..7f4a3f8bb91 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 55b677b38a3..3ce5e3f0ce2 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 4402995afbc..2ce37d2e38f 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 8d2ffc2d47e..b775b67cfd0 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 47c447cf1b2..ae4833691d5 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 e5272f47edf..3ed07ac8083 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 236084fb79d..ee07d18e079 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 33a2589638f..f513b683631 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 56e07c8c6a6..5e0100183a9 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 9c84c7fba90..7e4b3435e8a 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 9f883483af7..93aca1a3839 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 2654a857e82..d2702001c33 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 279525e1fc4..79ac0a5a66b 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 90aa996c0bc..a719f43d7af 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 be66e56da5f..719661a9ace 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 a2d524bf50f..f235a1b7507 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 97b56f42ec0..b4668088dc7 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 71a0e2d1420..3d273df20f1 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 c23df63eaf1..4107e8986aa 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 a14350921c8..0603b4486fc 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/wireless/cc1101.c b/drivers/wireless/cc1101.c index e9ce3805c5d..33112b42a56 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 6f335c99fda..4e72232dd1c 100644 --- a/drivers/wireless/cc3000/cc3000.c +++ b/drivers/wireless/cc3000/cc3000.c @@ -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/ieee802154/mrf24j40.c b/drivers/wireless/ieee802154/mrf24j40.c index b819ed7d991..e65e48c108a 100644 --- a/drivers/wireless/ieee802154/mrf24j40.c +++ b/drivers/wireless/ieee802154/mrf24j40.c @@ -513,9 +513,9 @@ static void mrf24j40_setreg(FAR struct spi_dev_s *spi, uint32_t addr, buf[len++] = val; mrf24j40_spi_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_spi_unlock(spi); } @@ -557,9 +557,9 @@ static uint8_t mrf24j40_getreg(FAR struct spi_dev_s *spi, uint32_t addr) buf[len++] = 0xFF; /* dummy */ mrf24j40_spi_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_spi_unlock(spi); /* wlinfo("r[%04X]=%02X\n", addr, rx[len - 1]); */ diff --git a/drivers/wireless/nrf24l01.c b/drivers/wireless/nrf24l01.c index 8bfc725c3b7..463857e2eff 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/include/nuttx/analog/pga11x.h b/include/nuttx/analog/pga11x.h index e4e2ebbc922..575689d22d0 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 c4bf82d8b24..145ee721b13 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/spi/spi.h b/include/nuttx/spi/spi.h index 96868de1559..ffff5e29113 100644 --- a/include/nuttx/spi/spi.h +++ b/include/nuttx/spi/spi.h @@ -433,29 +433,29 @@ #define SPIDEVID_INDEX(devid) ((uint32_t)(devid) & 0xffff) /* These are replacement definitions for the currently used SPI device indexes. - * They are meant as a compatibility measure. it is expected that new drivers - * will use SPIDEV_ID directly. + * 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 SPIDEV_ID(SPIDEVTYPE_NONE, 0) -#define SPIDEV_MMCSD SPIDEV_ID(SPIDEVTYPE_MMCSD, 0) -#define SPIDEV_FLASH SPIDEV_ID(SPIDEVTYPE_FLASH, 0) -#define SPIDEV_ETHERNET SPIDEV_ID(SPIDEVTYPE_ETHERNET, 0) -#define SPIDEV_DISPLAY SPIDEV_ID(SPIDEVTYPE_DISPLAY, 0) -#define SPIDEV_CAMERA SPIDEV_ID(SPIDEVTYPE_CAMERA, 0) -#define SPIDEV_WIRELESS SPIDEV_ID(SPIDEVTYPE_WIRELESS, 0) -#define SPIDEV_TOUCHSCREEN SPIDEV_ID(SPIDEVTYPE_TOUCHSCREEN, 0) -#define SPIDEV_EXPANDER SPIDEV_ID(SPIDEVTYPE_EXPANDER, 0) -#define SPIDEV_MUX SPIDEV_ID(SPIDEVTYPE_MUX, 0) -#define SPIDEV_AUDIO_DATA SPIDEV_ID(SPIDEVTYPE_AUDIO_DATA, 0) -#define SPIDEV_AUDIO_CTRL SPIDEV_ID(SPIDEVTYPE_AUDIO_CTRL, 0) -#define SPIDEV_EEPROM SPIDEV_ID(SPIDEVTYPE_EEPROM, 0) -#define SPIDEV_ACCELEROMETER SPIDEV_ID(SPIDEVTYPE_ACCELEROMETER, 0) -#define SPIDEV_BAROMETER SPIDEV_ID(SPIDEVTYPE_BAROMETER, 0) -#define SPIDEV_TEMPERATURE SPIDEV_ID(SPIDEVTYPE_TEMPERATURE, 0) -#define SPIDEV_IEEE802154 SPIDEV_ID(SPIDEVTYPE_IEEE802154, 0) -#define SPIDEV_CONTACTLESS SPIDEV_ID(SPIDEVTYPE_CONTACTLESS, 0) -#define SPIDEV_USER SPIDEV_ID(SPIDEVTYPE_USER, 0) +#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