Merge remote-tracking branch 'origin/master' into ieee802154
This commit is contained in:
commit
f826877c61
@ -491,15 +491,15 @@ static void spi_select(FAR struct spi_dev_s *dev, uint32_t devid, bool selected)
|
|||||||
* be in board specific code..... */
|
* be in board specific code..... */
|
||||||
switch (devid)
|
switch (devid)
|
||||||
{
|
{
|
||||||
case SPIDEV_FLASH:
|
case SPIDEV_FLASH(0):
|
||||||
slave = 0;
|
slave = 0;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case SPIDEV_MMCSD:
|
case SPIDEV_MMCSD(0):
|
||||||
slave = 1;
|
slave = 1;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case SPIDEV_ETHERNET:
|
case SPIDEV_ETHERNET(0):
|
||||||
slave = 2;
|
slave = 2;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
@ -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;
|
FAR struct sim_spiflashdev_s *priv = (FAR struct sim_spiflashdev_s *)dev;
|
||||||
|
|
||||||
if (devid == SPIDEV_FLASH)
|
if (devid == SPIDEV_FLASH(0))
|
||||||
{
|
{
|
||||||
priv->selected = selected;
|
priv->selected = selected;
|
||||||
|
|
||||||
|
@ -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,
|
static void spi_select(FAR struct spi_bitbang_s *priv, uint32_t devid,
|
||||||
bool selected)
|
bool selected)
|
||||||
{
|
{
|
||||||
if (devid == SPIDEV_MMCSD)
|
if (devid == SPIDEV_MMCSD(0))
|
||||||
{
|
{
|
||||||
if (selected)
|
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)
|
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;
|
return SPI_STATUS_PRESENT;
|
||||||
}
|
}
|
||||||
|
@ -139,7 +139,7 @@ void stm32_spi3select(FAR struct spi_dev_s *dev, uint32_t devid, bool selected)
|
|||||||
switch(devid)
|
switch(devid)
|
||||||
{
|
{
|
||||||
#ifdef CONFIG_IEEE802154_MRF24J40
|
#ifdef CONFIG_IEEE802154_MRF24J40
|
||||||
case SPIDEV_IEEE802154:
|
case SPIDEV_IEEE802154(0):
|
||||||
/* Set the GPIO low to select and high to de-select */
|
/* Set the GPIO low to select and high to de-select */
|
||||||
stm32_gpiowrite(GPIO_MB1_CS, !selected);
|
stm32_gpiowrite(GPIO_MB1_CS, !selected);
|
||||||
break;
|
break;
|
||||||
|
@ -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 */
|
/* 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 */
|
/* Set the GPIO low to select and high to de-select */
|
||||||
|
|
||||||
|
@ -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)
|
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");
|
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 */
|
/* Assert the CS pin to the card */
|
||||||
|
|
||||||
|
@ -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");
|
spiinfo("devid: %d CS: %s\n", (int)devid, selected ? "assert" : "de-assert");
|
||||||
ssi_dumpgpio("tiva_ssiselect() Entry");
|
ssi_dumpgpio("tiva_ssiselect() Entry");
|
||||||
if (devid == SPIDEV_MMCSD)
|
if (devid == SPIDEV_MMCSD(0))
|
||||||
{
|
{
|
||||||
/* Assert the CS pin to the card */
|
/* Assert the CS pin to the card */
|
||||||
|
|
||||||
tiva_gpiowrite(SDCCS_GPIO, !selected);
|
tiva_gpiowrite(SDCCS_GPIO, !selected);
|
||||||
}
|
}
|
||||||
#ifdef CONFIG_NX_LCDDRIVER
|
#ifdef CONFIG_NX_LCDDRIVER
|
||||||
else if (devid == SPIDEV_DISPLAY)
|
else if (devid == SPIDEV_DISPLAY(0))
|
||||||
{
|
{
|
||||||
/* Assert the CS pin to the display */
|
/* Assert the CS pin to the display */
|
||||||
|
|
||||||
|
@ -145,14 +145,14 @@ void stm32_spi1select(FAR struct spi_dev_s *dev, uint32_t devid, bool selected)
|
|||||||
else
|
else
|
||||||
#endif
|
#endif
|
||||||
#ifdef CONFIG_ENC28J60
|
#ifdef CONFIG_ENC28J60
|
||||||
if (devid == SPIDEV_ETHERNET)
|
if (devid == SPIDEV_ETHERNET(0))
|
||||||
{
|
{
|
||||||
/* Set the GPIO low to select and high to de-select */
|
/* Set the GPIO low to select and high to de-select */
|
||||||
|
|
||||||
stm32_gpiowrite(GPIO_ENC28J60_CS, !selected);
|
stm32_gpiowrite(GPIO_ENC28J60_CS, !selected);
|
||||||
}
|
}
|
||||||
#else
|
#else
|
||||||
if (devid == SPIDEV_FLASH)
|
if (devid == SPIDEV_FLASH(0))
|
||||||
{
|
{
|
||||||
/* Set the GPIO low to select and high to de-select */
|
/* Set the GPIO low to select and high to de-select */
|
||||||
|
|
||||||
|
@ -146,7 +146,7 @@ void kl_spi0select(FAR struct spi_dev_s *dev, uint32_t devid,
|
|||||||
(int)devid, selected ? "assert" : "de-assert");
|
(int)devid, selected ? "assert" : "de-assert");
|
||||||
|
|
||||||
#ifdef CONFIG_ADXL345_SPI
|
#ifdef CONFIG_ADXL345_SPI
|
||||||
if (devid == SPIDEV_ACCELEROMETER)
|
if (devid == SPIDEV_ACCELEROMETER(0))
|
||||||
{
|
{
|
||||||
/* Active low */
|
/* Active low */
|
||||||
|
|
||||||
@ -155,7 +155,7 @@ void kl_spi0select(FAR struct spi_dev_s *dev, uint32_t devid,
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if defined(CONFIG_WL_CC3000)
|
#if defined(CONFIG_WL_CC3000)
|
||||||
if (devid == SPIDEV_WIRELESS)
|
if (devid == SPIDEV_WIRELESS(0))
|
||||||
{
|
{
|
||||||
kl_gpiowrite(GPIO_WIFI_CS, !selected);
|
kl_gpiowrite(GPIO_WIFI_CS, !selected);
|
||||||
}
|
}
|
||||||
|
@ -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");
|
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 */
|
/* Set the GPIO low to select and high to de-select */
|
||||||
|
|
||||||
|
@ -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");
|
spiinfo("devid: %d CS: %s\n", (int)devid, selected ? "assert" : "de-assert");
|
||||||
ssi_dumpgpio("tiva_ssiselect() Entry");
|
ssi_dumpgpio("tiva_ssiselect() Entry");
|
||||||
|
|
||||||
if (devid == SPIDEV_MMCSD)
|
if (devid == SPIDEV_MMCSD(0))
|
||||||
{
|
{
|
||||||
/* Assert the CS pin to the card */
|
/* Assert the CS pin to the card */
|
||||||
|
|
||||||
|
@ -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)
|
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 */
|
/* Set GPIO to 1 for data, 0 for command */
|
||||||
|
|
||||||
|
@ -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");
|
spiinfo("devid: %d CS: %s\n", (int)devid, selected ? "assert" : "de-assert");
|
||||||
ssi_dumpgpio("tiva_ssiselect() Entry");
|
ssi_dumpgpio("tiva_ssiselect() Entry");
|
||||||
|
|
||||||
if (devid == SPIDEV_MMCSD)
|
if (devid == SPIDEV_MMCSD(0))
|
||||||
{
|
{
|
||||||
/* Assert the CS pin to the card */
|
/* Assert the CS pin to the card */
|
||||||
|
|
||||||
tiva_gpiowrite(SDCCS_GPIO, !selected);
|
tiva_gpiowrite(SDCCS_GPIO, !selected);
|
||||||
}
|
}
|
||||||
#ifdef CONFIG_NX_LCDDRIVER
|
#ifdef CONFIG_NX_LCDDRIVER
|
||||||
else if (devid == SPIDEV_DISPLAY)
|
else if (devid == SPIDEV_DISPLAY(0))
|
||||||
{
|
{
|
||||||
/* Assert the CS pin to the display */
|
/* Assert the CS pin to the display */
|
||||||
|
|
||||||
|
@ -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)
|
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 */
|
/* Set GPIO to 1 for data, 0 for command */
|
||||||
|
|
||||||
|
@ -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");
|
spiinfo("devid: %d CS: %s\n", (int)devid, selected ? "assert" : "de-assert");
|
||||||
ssi_dumpgpio("tiva_ssiselect() Entry");
|
ssi_dumpgpio("tiva_ssiselect() Entry");
|
||||||
|
|
||||||
if (devid == SPIDEV_MMCSD)
|
if (devid == SPIDEV_MMCSD(0))
|
||||||
{
|
{
|
||||||
/* Assert the CS pin to the card */
|
/* Assert the CS pin to the card */
|
||||||
|
|
||||||
tiva_gpiowrite(SDCCS_GPIO, !selected);
|
tiva_gpiowrite(SDCCS_GPIO, !selected);
|
||||||
}
|
}
|
||||||
#ifdef CONFIG_NX_LCDDRIVER
|
#ifdef CONFIG_NX_LCDDRIVER
|
||||||
else if (devid == SPIDEV_DISPLAY)
|
else if (devid == SPIDEV_DISPLAY(0))
|
||||||
{
|
{
|
||||||
/* Assert the CS pin to the display */
|
/* Assert the CS pin to the display */
|
||||||
|
|
||||||
|
@ -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");
|
spiinfo("devid: %d CS: %s\n", (int)devid, selected ? "assert" : "de-assert");
|
||||||
ssp_dumpgpio("lpc11_ssp1select() Entry");
|
ssp_dumpgpio("lpc11_ssp1select() Entry");
|
||||||
|
|
||||||
if (devid == SPIDEV_MMCSD)
|
if (devid == SPIDEV_MMCSD(0))
|
||||||
{
|
{
|
||||||
/* Assert/de-assert the CS pin to the card */
|
/* Assert/de-assert the CS pin to the card */
|
||||||
|
|
||||||
(void)lpc11_gpiowrite(LPCXPRESSO_SD_CS, !selected);
|
(void)lpc11_gpiowrite(LPCXPRESSO_SD_CS, !selected);
|
||||||
}
|
}
|
||||||
#ifdef CONFIG_NX_LCDDRIVER
|
#ifdef CONFIG_NX_LCDDRIVER
|
||||||
else if (devid == SPIDEV_DISPLAY)
|
else if (devid == SPIDEV_DISPLAY(0))
|
||||||
{
|
{
|
||||||
/* Assert the CS pin to the OLED display */
|
/* 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)
|
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 */
|
/* Read the state of the card-detect bit */
|
||||||
|
|
||||||
|
@ -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)
|
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 */
|
/* Set GPIO to 1 for data, 0 for command */
|
||||||
|
|
||||||
|
@ -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");
|
spiinfo("devid: %d CS: %s\n", (int)devid, selected ? "assert" : "de-assert");
|
||||||
ssp_dumpgpio("lpc17_ssp1select() Entry");
|
ssp_dumpgpio("lpc17_ssp1select() Entry");
|
||||||
|
|
||||||
if (devid == SPIDEV_MMCSD)
|
if (devid == SPIDEV_MMCSD(0))
|
||||||
{
|
{
|
||||||
/* Assert/de-assert the CS pin to the card */
|
/* Assert/de-assert the CS pin to the card */
|
||||||
|
|
||||||
(void)lpc17_gpiowrite(LPCXPRESSO_SD_CS, !selected);
|
(void)lpc17_gpiowrite(LPCXPRESSO_SD_CS, !selected);
|
||||||
}
|
}
|
||||||
#ifdef CONFIG_NX_LCDDRIVER
|
#ifdef CONFIG_NX_LCDDRIVER
|
||||||
else if (devid == SPIDEV_DISPLAY)
|
else if (devid == SPIDEV_DISPLAY(0))
|
||||||
{
|
{
|
||||||
/* Assert the CS pin to the OLED display */
|
/* 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)
|
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 */
|
/* Read the state of the card-detect bit */
|
||||||
|
|
||||||
|
@ -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");
|
spiinfo("devid: %d CS: %s\n", (int)devid, selected ? "assert" : "de-assert");
|
||||||
|
|
||||||
# if defined(CONFIG_LCD_SHARP_MEMLCD)
|
# if defined(CONFIG_LCD_SHARP_MEMLCD)
|
||||||
if (devid == SPIDEV_DISPLAY)
|
if (devid == SPIDEV_DISPLAY(0))
|
||||||
{
|
{
|
||||||
stm32_gpiowrite(GPIO_MEMLCD_CS, selected);
|
stm32_gpiowrite(GPIO_MEMLCD_CS, selected);
|
||||||
}
|
}
|
||||||
|
@ -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");
|
spiinfo("devid: %d CS: %s\n", (int)devid, selected ? "assert" : "de-assert");
|
||||||
|
|
||||||
#if defined(CONFIG_VS1053)
|
#if defined(CONFIG_VS1053)
|
||||||
if (devid == SPIDEV_AUDIO_DATA)
|
if (devid == SPIDEV_AUDIO_DATA(0))
|
||||||
{
|
{
|
||||||
stm32_gpiowrite(GPIO_CS_MP3_DATA, !selected);
|
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);
|
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
|
#endif
|
||||||
|
|
||||||
#if defined(CONFIG_MMCSD)
|
#if defined(CONFIG_MMCSD)
|
||||||
if (devid == SPIDEV_MMCSD)
|
if (devid == SPIDEV_MMCSD(0))
|
||||||
{
|
{
|
||||||
stm32_gpiowrite(GPIO_CS_MMCSD, !selected);
|
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
|
#endif
|
||||||
|
|
||||||
#if defined(CONFIG_MTD_M25P)
|
#if defined(CONFIG_MTD_M25P)
|
||||||
if (devid == SPIDEV_FLASH)
|
if (devid == SPIDEV_FLASH(0))
|
||||||
{
|
{
|
||||||
stm32_gpiowrite(GPIO_CS_FLASH, !selected);
|
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 */
|
/* Must be the expansion header device */
|
||||||
|
|
||||||
if (devid == SPIDEV_EXPANDER)
|
if (devid == SPIDEV_EXPANDER(0))
|
||||||
{
|
{
|
||||||
stm32_gpiowrite(GPIO_CS_EXP_SPI3, !selected);
|
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;
|
uint8_t ret = 0;
|
||||||
|
|
||||||
#if defined(CONFIG_MMCSD)
|
#if defined(CONFIG_MMCSD)
|
||||||
if (devid == SPIDEV_MMCSD)
|
if (devid == SPIDEV_MMCSD(0))
|
||||||
{
|
{
|
||||||
/* A low value indicates the card is present */
|
/* A low value indicates the card is present */
|
||||||
|
|
||||||
|
@ -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");
|
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);
|
pic32mx_gpiowrite(GPIO_SST25VF032B_CS, !selected);
|
||||||
}
|
}
|
||||||
else if (devid == SPIDEV_MUX)
|
else if (devid == SPIDEV_MUX(0))
|
||||||
{
|
{
|
||||||
pic32mx_gpiowrite(GPIO_PGA117_CS, !selected);
|
pic32mx_gpiowrite(GPIO_PGA117_CS, !selected);
|
||||||
}
|
}
|
||||||
|
@ -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");
|
spiinfo("devid: %d CS: %s\n", (int)devid, selected ? "assert" : "de-assert");
|
||||||
|
|
||||||
#if defined(CONFIG_LCD_SSD1351)
|
#if defined(CONFIG_LCD_SSD1351)
|
||||||
if (devid == SPIDEV_DISPLAY)
|
if (devid == SPIDEV_DISPLAY(0))
|
||||||
{
|
{
|
||||||
stm32_gpiowrite(GPIO_OLED_CS, !selected);
|
stm32_gpiowrite(GPIO_OLED_CS, !selected);
|
||||||
}
|
}
|
||||||
@ -176,7 +176,7 @@ int stm32_spi1cmddata(FAR struct spi_dev_s *dev, uint32_t devid,
|
|||||||
bool cmd)
|
bool cmd)
|
||||||
{
|
{
|
||||||
#ifdef CONFIG_LCD_SSD1351
|
#ifdef CONFIG_LCD_SSD1351
|
||||||
if (devid == SPIDEV_DISPLAY)
|
if (devid == SPIDEV_DISPLAY(0))
|
||||||
{
|
{
|
||||||
(void)stm32_gpiowrite(GPIO_OLED_DC, !cmd);
|
(void)stm32_gpiowrite(GPIO_OLED_DC, !cmd);
|
||||||
return OK;
|
return OK;
|
||||||
|
@ -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");
|
spiinfo("devid: %d CS: %s\n", (int)devid, selected ? "assert" : "de-assert");
|
||||||
|
|
||||||
#ifdef CONFIG_WL_CC3000
|
#ifdef CONFIG_WL_CC3000
|
||||||
if (devid == SPIDEV_WIRELESS)
|
if (devid == SPIDEV_WIRELESS(0))
|
||||||
{
|
{
|
||||||
stm32_gpiowrite(GPIO_SPI_CS_WIFI, !selected);
|
stm32_gpiowrite(GPIO_SPI_CS_WIFI, !selected);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
#endif
|
#endif
|
||||||
#ifdef HAVE_MMCSD
|
#ifdef HAVE_MMCSD
|
||||||
if (devid == SPIDEV_MMCSD)
|
if (devid == SPIDEV_MMCSD(0))
|
||||||
{
|
{
|
||||||
stm32_gpiowrite(GPIO_SPI_CS_SD_CARD, !selected);
|
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");
|
spiinfo("devid: %d CS: %s\n", (int)devid, selected ? "assert" : "de-assert");
|
||||||
|
|
||||||
#ifdef CONFIG_WL_CC3000
|
#ifdef CONFIG_WL_CC3000
|
||||||
if (devid == SPIDEV_WIRELESS)
|
if (devid == SPIDEV_WIRELESS(0))
|
||||||
{
|
{
|
||||||
stm32_gpiowrite(GPIO_WIFI_CS, !selected);
|
stm32_gpiowrite(GPIO_WIFI_CS, !selected);
|
||||||
}
|
}
|
||||||
|
@ -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");
|
spiinfo("devid: %d CS: %s\n", (int)devid, selected ? "assert" : "de-assert");
|
||||||
|
|
||||||
#ifdef CONFIG_WL_CC3000
|
#ifdef CONFIG_WL_CC3000
|
||||||
if (devid == SPIDEV_WIRELESS)
|
if (devid == SPIDEV_WIRELESS(0))
|
||||||
{
|
{
|
||||||
stm32l4_gpiowrite(GPIO_SPI_CS_WIFI, !selected);
|
stm32l4_gpiowrite(GPIO_SPI_CS_WIFI, !selected);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
#endif
|
#endif
|
||||||
#ifdef HAVE_MMCSD
|
#ifdef HAVE_MMCSD
|
||||||
if (devid == SPIDEV_MMCSD)
|
if (devid == SPIDEV_MMCSD(0))
|
||||||
{
|
{
|
||||||
stm32l4_gpiowrite(GPIO_SPI_CS_SD_CARD, !selected);
|
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");
|
spiinfo("devid: %d CS: %s\n", (int)devid, selected ? "assert" : "de-assert");
|
||||||
|
|
||||||
#ifdef CONFIG_WL_CC3000
|
#ifdef CONFIG_WL_CC3000
|
||||||
if (devid == SPIDEV_WIRELESS)
|
if (devid == SPIDEV_WIRELESS(0))
|
||||||
{
|
{
|
||||||
stm32l4_gpiowrite(GPIO_WIFI_CS, !selected);
|
stm32l4_gpiowrite(GPIO_WIFI_CS, !selected);
|
||||||
}
|
}
|
||||||
|
@ -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)
|
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");
|
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 */
|
/* 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)
|
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");
|
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 */
|
/* Assert/de-assert the CS pin to the card */
|
||||||
|
|
||||||
|
@ -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");
|
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 */
|
/* Set the GPIO low to select and high to de-select */
|
||||||
|
|
||||||
|
@ -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)
|
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");
|
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);
|
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");
|
spiinfo("devid: %d CS: %s\n", (int)devid, selected ? "assert" : "de-assert");
|
||||||
#if defined(CONFIG_MMCSD)
|
#if defined(CONFIG_MMCSD)
|
||||||
if (devid == SPIDEV_MMCSD)
|
if (devid == SPIDEV_MMCSD(0))
|
||||||
{
|
{
|
||||||
stm32_gpiowrite(MMCSD_CSn, !selected);
|
stm32_gpiowrite(MMCSD_CSn, !selected);
|
||||||
}
|
}
|
||||||
|
@ -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)
|
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");
|
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 */
|
/* Assert/de-assert the CS pin to the touchscreen */
|
||||||
|
|
||||||
|
@ -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");
|
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);
|
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. */
|
/* Card detect active low. */
|
||||||
|
|
||||||
if (devid == SPIDEV_MMCSD)
|
if (devid == SPIDEV_MMCSD(0))
|
||||||
{
|
{
|
||||||
if (!pic32mx_gpioread(GPIO_SD_CD))
|
if (!pic32mx_gpioread(GPIO_SD_CD))
|
||||||
{
|
{
|
||||||
|
@ -149,7 +149,7 @@ void sam_spi0select(uint32_t devid, bool selected)
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
#if defined(CONFIG_INPUT) && defined(CONFIG_INPUT_ADS7843E)
|
#if defined(CONFIG_INPUT) && defined(CONFIG_INPUT_ADS7843E)
|
||||||
if (devid == SPIDEV_TOUCHSCREEN)
|
if (devid == SPIDEV_TOUCHSCREEN(0))
|
||||||
{
|
{
|
||||||
sam_gpiowrite(GPIO_TSC_NPCS2, !selected);
|
sam_gpiowrite(GPIO_TSC_NPCS2, !selected);
|
||||||
}
|
}
|
||||||
|
@ -153,7 +153,7 @@ void sam_spi0select(uint32_t devid, bool selected)
|
|||||||
* manually and hold it low throughout the SPI transfer.
|
* manually and hold it low throughout the SPI transfer.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
case SPIDEV_TOUCHSCREEN:
|
case SPIDEV_TOUCHSCREEN(0):
|
||||||
sam_gpiowrite(GPIO_TSC_CS, !selected);
|
sam_gpiowrite(GPIO_TSC_CS, !selected);
|
||||||
break;
|
break;
|
||||||
#endif
|
#endif
|
||||||
@ -161,7 +161,7 @@ void sam_spi0select(uint32_t devid, bool selected)
|
|||||||
#if defined(CONFIG_MTD_AT25)
|
#if defined(CONFIG_MTD_AT25)
|
||||||
/* The AT25 Serial FLASH connects using NPCS3 (PA5). */
|
/* The AT25 Serial FLASH connects using NPCS3 (PA5). */
|
||||||
|
|
||||||
case SPIDEV_FLASH:
|
case SPIDEV_FLASH(0):
|
||||||
sam_gpiowrite(GPIO_FLASH_CS, !selected);
|
sam_gpiowrite(GPIO_FLASH_CS, !selected);
|
||||||
break;
|
break;
|
||||||
#endif
|
#endif
|
||||||
|
@ -145,7 +145,7 @@ void sam_spi0select(uint32_t devid, bool selected)
|
|||||||
#ifdef CONFIG_SAM4L_XPLAINED_IOMODULE
|
#ifdef CONFIG_SAM4L_XPLAINED_IOMODULE
|
||||||
/* Select/de-select the SD card */
|
/* Select/de-select the SD card */
|
||||||
|
|
||||||
if (devid == SPIDEV_MMCSD)
|
if (devid == SPIDEV_MMCSD(0))
|
||||||
{
|
{
|
||||||
/* Active low */
|
/* Active low */
|
||||||
|
|
||||||
@ -160,7 +160,7 @@ void sam_spi0select(uint32_t devid, bool selected)
|
|||||||
#ifdef CONFIG_SAM4L_XPLAINED_OLED1MODULE
|
#ifdef CONFIG_SAM4L_XPLAINED_OLED1MODULE
|
||||||
/* Select/de-select the OLED */
|
/* Select/de-select the OLED */
|
||||||
|
|
||||||
if (devid == SPIDEV_DISPLAY)
|
if (devid == SPIDEV_DISPLAY(0))
|
||||||
{
|
{
|
||||||
/* Active low */
|
/* Active low */
|
||||||
|
|
||||||
@ -190,7 +190,7 @@ uint8_t sam_spi0status(FAR struct spi_dev_s *dev, uint32_t devid)
|
|||||||
#ifdef CONFIG_SAM4L_XPLAINED_IOMODULE
|
#ifdef CONFIG_SAM4L_XPLAINED_IOMODULE
|
||||||
/* Check if an SD card is present in the microSD slot */
|
/* Check if an SD card is present in the microSD slot */
|
||||||
|
|
||||||
if (devid == SPIDEV_MMCSD)
|
if (devid == SPIDEV_MMCSD(0))
|
||||||
{
|
{
|
||||||
/* Active low */
|
/* 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)
|
int sam_spic0mddata(FAR struct spi_dev_s *dev, uint32_t devid, bool cmd)
|
||||||
{
|
{
|
||||||
#ifdef CONFIG_SAM4L_XPLAINED_OLED1MODULE
|
#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
|
/* This is the Data/Command control pad which determines whether the
|
||||||
* data bits are data or a command.
|
* data bits are data or a command.
|
||||||
|
@ -145,7 +145,7 @@ void sam_spi0select(uint32_t devid, bool selected)
|
|||||||
#ifdef CONFIG_MTD_AT25
|
#ifdef CONFIG_MTD_AT25
|
||||||
/* The AT25 serial FLASH connects using NPCS0 */
|
/* The AT25 serial FLASH connects using NPCS0 */
|
||||||
|
|
||||||
if (devid == SPIDEV_FLASH)
|
if (devid == SPIDEV_FLASH(0))
|
||||||
{
|
{
|
||||||
sam_piowrite(PIO_AT25_NPCS0, !selected);
|
sam_piowrite(PIO_AT25_NPCS0, !selected);
|
||||||
}
|
}
|
||||||
|
@ -145,7 +145,7 @@ void sam_spi0select(uint32_t devid, bool selected)
|
|||||||
#ifdef CONFIG_MTD_AT25
|
#ifdef CONFIG_MTD_AT25
|
||||||
/* The AT25 serial FLASH connects using NPCS0 */
|
/* The AT25 serial FLASH connects using NPCS0 */
|
||||||
|
|
||||||
if (devid == SPIDEV_FLASH)
|
if (devid == SPIDEV_FLASH(0))
|
||||||
{
|
{
|
||||||
sam_piowrite(PIO_AT25_NPCS0, !selected);
|
sam_piowrite(PIO_AT25_NPCS0, !selected);
|
||||||
}
|
}
|
||||||
|
@ -145,7 +145,7 @@ void sam_spi0select(uint32_t devid, bool selected)
|
|||||||
#ifdef CONFIG_MTD_AT25
|
#ifdef CONFIG_MTD_AT25
|
||||||
/* The AT25 serial FLASH connects using NPCS0 */
|
/* The AT25 serial FLASH connects using NPCS0 */
|
||||||
|
|
||||||
if (devid == SPIDEV_FLASH)
|
if (devid == SPIDEV_FLASH(0))
|
||||||
{
|
{
|
||||||
sam_piowrite(PIO_AT25_NPCS0, !selected);
|
sam_piowrite(PIO_AT25_NPCS0, !selected);
|
||||||
}
|
}
|
||||||
|
@ -154,7 +154,7 @@ void sam_spi0select(FAR struct spi_dev_s *dev, uint32_t devid,
|
|||||||
#ifdef CONFIG_SAMD20_XPLAINED_IOMODULE_EXT1
|
#ifdef CONFIG_SAMD20_XPLAINED_IOMODULE_EXT1
|
||||||
/* Select/de-select the SD card */
|
/* Select/de-select the SD card */
|
||||||
|
|
||||||
if (devid == SPIDEV_MMCSD)
|
if (devid == SPIDEV_MMCSD(0))
|
||||||
{
|
{
|
||||||
/* Active low */
|
/* Active low */
|
||||||
|
|
||||||
@ -165,7 +165,7 @@ void sam_spi0select(FAR struct spi_dev_s *dev, uint32_t devid,
|
|||||||
#ifdef CONFIG_SAMD20_XPLAINED_OLED1MODULE_EXT1
|
#ifdef CONFIG_SAMD20_XPLAINED_OLED1MODULE_EXT1
|
||||||
/* Select/de-select the OLED */
|
/* Select/de-select the OLED */
|
||||||
|
|
||||||
if (devid == SPIDEV_DISPLAY)
|
if (devid == SPIDEV_DISPLAY(0))
|
||||||
{
|
{
|
||||||
/* Active low */
|
/* Active low */
|
||||||
|
|
||||||
@ -182,7 +182,7 @@ void sam_spi1select(FAR struct spi_dev_s *dev, uint32_t devid,
|
|||||||
#ifdef CONFIG_SAMD20_XPLAINED_IOMODULE_EXT2
|
#ifdef CONFIG_SAMD20_XPLAINED_IOMODULE_EXT2
|
||||||
/* Select/de-select the SD card */
|
/* Select/de-select the SD card */
|
||||||
|
|
||||||
if (devid == SPIDEV_MMCSD)
|
if (devid == SPIDEV_MMCSD(0))
|
||||||
{
|
{
|
||||||
/* Active low */
|
/* Active low */
|
||||||
|
|
||||||
@ -193,7 +193,7 @@ void sam_spi1select(FAR struct spi_dev_s *dev, uint32_t devid,
|
|||||||
#ifdef CONFIG_SAMD20_XPLAINED_OLED1MODULE_EXT2
|
#ifdef CONFIG_SAMD20_XPLAINED_OLED1MODULE_EXT2
|
||||||
/* Select/de-select the OLED */
|
/* Select/de-select the OLED */
|
||||||
|
|
||||||
if (devid == SPIDEV_DISPLAY)
|
if (devid == SPIDEV_DISPLAY(0))
|
||||||
{
|
{
|
||||||
/* Active low */
|
/* 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
|
#ifdef CONFIG_SAMD20_XPLAINED_IOMODULE_EXT1
|
||||||
/* Check if an SD card is present in the microSD slot */
|
/* Check if an SD card is present in the microSD slot */
|
||||||
|
|
||||||
if (devid == SPIDEV_MMCSD)
|
if (devid == SPIDEV_MMCSD(0))
|
||||||
{
|
{
|
||||||
/* Active low */
|
/* 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
|
#ifdef CONFIG_SAMD20_XPLAINED_IOMODULE_EXT2
|
||||||
/* Check if an SD card is present in the microSD slot */
|
/* Check if an SD card is present in the microSD slot */
|
||||||
|
|
||||||
if (devid == SPIDEV_MMCSD)
|
if (devid == SPIDEV_MMCSD(0))
|
||||||
{
|
{
|
||||||
/* Active low */
|
/* 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)
|
int sam_spi0cmddata(FAR struct spi_dev_s *dev, uint32_t devid, bool cmd)
|
||||||
{
|
{
|
||||||
#ifdef CONFIG_SAMD20_XPLAINED_OLED1MODULE_EXT1
|
#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
|
/* This is the Data/Command control pad which determines whether the
|
||||||
* data bits are data or a command.
|
* 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)
|
int sam_spi1cmddata(FAR struct spi_dev_s *dev, uint32_t devid, bool cmd)
|
||||||
{
|
{
|
||||||
#ifdef CONFIG_SAMD20_XPLAINED_OLED1MODULE_EXT2
|
#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
|
/* This is the Data/Command control pad which determines whether the
|
||||||
* data bits are data or a command.
|
* data bits are data or a command.
|
||||||
|
@ -154,7 +154,7 @@ void sam_spi0select(FAR struct spi_dev_s *dev, uint32_t devid,
|
|||||||
#ifdef CONFIG_SAMD21_XPLAINED_IOMODULE_EXT1
|
#ifdef CONFIG_SAMD21_XPLAINED_IOMODULE_EXT1
|
||||||
/* Select/de-select the SD card */
|
/* Select/de-select the SD card */
|
||||||
|
|
||||||
if (devid == SPIDEV_MMCSD)
|
if (devid == SPIDEV_MMCSD(0))
|
||||||
{
|
{
|
||||||
/* Active low */
|
/* Active low */
|
||||||
|
|
||||||
@ -165,7 +165,7 @@ void sam_spi0select(FAR struct spi_dev_s *dev, uint32_t devid,
|
|||||||
#ifdef CONFIG_SAMD21_XPLAINED_OLED1MODULE_EXT1
|
#ifdef CONFIG_SAMD21_XPLAINED_OLED1MODULE_EXT1
|
||||||
/* Select/de-select the OLED */
|
/* Select/de-select the OLED */
|
||||||
|
|
||||||
if (devid == SPIDEV_DISPLAY)
|
if (devid == SPIDEV_DISPLAY(0))
|
||||||
{
|
{
|
||||||
/* Active low */
|
/* Active low */
|
||||||
|
|
||||||
@ -182,7 +182,7 @@ void sam_spi1select(FAR struct spi_dev_s *dev, uint32_t devid,
|
|||||||
#ifdef CONFIG_SAMD21_XPLAINED_IOMODULE_EXT2
|
#ifdef CONFIG_SAMD21_XPLAINED_IOMODULE_EXT2
|
||||||
/* Select/de-select the SD card */
|
/* Select/de-select the SD card */
|
||||||
|
|
||||||
if (devid == SPIDEV_MMCSD)
|
if (devid == SPIDEV_MMCSD(0))
|
||||||
{
|
{
|
||||||
/* Active low */
|
/* Active low */
|
||||||
|
|
||||||
@ -193,7 +193,7 @@ void sam_spi1select(FAR struct spi_dev_s *dev, uint32_t devid,
|
|||||||
#ifdef CONFIG_SAMD21_XPLAINED_OLED1MODULE_EXT2
|
#ifdef CONFIG_SAMD21_XPLAINED_OLED1MODULE_EXT2
|
||||||
/* Select/de-select the OLED */
|
/* Select/de-select the OLED */
|
||||||
|
|
||||||
if (devid == SPIDEV_DISPLAY)
|
if (devid == SPIDEV_DISPLAY(0))
|
||||||
{
|
{
|
||||||
/* Active low */
|
/* 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
|
#ifdef CONFIG_SAMD21_XPLAINED_IOMODULE_EXT1
|
||||||
/* Check if an SD card is present in the microSD slot */
|
/* Check if an SD card is present in the microSD slot */
|
||||||
|
|
||||||
if (devid == SPIDEV_MMCSD)
|
if (devid == SPIDEV_MMCSD(0))
|
||||||
{
|
{
|
||||||
/* Active low */
|
/* 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
|
#ifdef CONFIG_SAMD21_XPLAINED_IOMODULE_EXT2
|
||||||
/* Check if an SD card is present in the microSD slot */
|
/* Check if an SD card is present in the microSD slot */
|
||||||
|
|
||||||
if (devid == SPIDEV_MMCSD)
|
if (devid == SPIDEV_MMCSD(0))
|
||||||
{
|
{
|
||||||
/* Active low */
|
/* 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)
|
int sam_spi0cmddata(FAR struct spi_dev_s *dev, uint32_t devid, bool cmd)
|
||||||
{
|
{
|
||||||
#ifdef CONFIG_SAMD21_XPLAINED_OLED1MODULE_EXT1
|
#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
|
/* This is the Data/Command control pad which determines whether the
|
||||||
* data bits are data or a command.
|
* 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)
|
int sam_spi1cmddata(FAR struct spi_dev_s *dev, uint32_t devid, bool cmd)
|
||||||
{
|
{
|
||||||
#ifdef CONFIG_SAMD21_XPLAINED_OLED1MODULE_EXT2
|
#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
|
/* This is the Data/Command control pad which determines whether the
|
||||||
* data bits are data or a command.
|
* data bits are data or a command.
|
||||||
|
@ -154,7 +154,7 @@ void sam_spi0select(FAR struct spi_dev_s *dev, uint32_t devid,
|
|||||||
#ifdef CONFIG_SAML21_XPLAINED_IOMODULE_EXT1
|
#ifdef CONFIG_SAML21_XPLAINED_IOMODULE_EXT1
|
||||||
/* Select/de-select the SD card */
|
/* Select/de-select the SD card */
|
||||||
|
|
||||||
if (devid == SPIDEV_MMCSD)
|
if (devid == SPIDEV_MMCSD(0))
|
||||||
{
|
{
|
||||||
/* Active low */
|
/* Active low */
|
||||||
|
|
||||||
@ -165,7 +165,7 @@ void sam_spi0select(FAR struct spi_dev_s *dev, uint32_t devid,
|
|||||||
#ifdef CONFIG_SAML21_XPLAINED_OLED1MODULE_EXT1
|
#ifdef CONFIG_SAML21_XPLAINED_OLED1MODULE_EXT1
|
||||||
/* Select/de-select the OLED */
|
/* Select/de-select the OLED */
|
||||||
|
|
||||||
if (devid == SPIDEV_DISPLAY)
|
if (devid == SPIDEV_DISPLAY(0))
|
||||||
{
|
{
|
||||||
/* Active low */
|
/* Active low */
|
||||||
|
|
||||||
@ -182,7 +182,7 @@ void sam_spi1select(FAR struct spi_dev_s *dev, uint32_t devid,
|
|||||||
#ifdef CONFIG_SAML21_XPLAINED_IOMODULE_EXT2
|
#ifdef CONFIG_SAML21_XPLAINED_IOMODULE_EXT2
|
||||||
/* Select/de-select the SD card */
|
/* Select/de-select the SD card */
|
||||||
|
|
||||||
if (devid == SPIDEV_MMCSD)
|
if (devid == SPIDEV_MMCSD(0))
|
||||||
{
|
{
|
||||||
/* Active low */
|
/* Active low */
|
||||||
|
|
||||||
@ -193,7 +193,7 @@ void sam_spi1select(FAR struct spi_dev_s *dev, uint32_t devid,
|
|||||||
#ifdef CONFIG_SAML21_XPLAINED_OLED1MODULE_EXT2
|
#ifdef CONFIG_SAML21_XPLAINED_OLED1MODULE_EXT2
|
||||||
/* Select/de-select the OLED */
|
/* Select/de-select the OLED */
|
||||||
|
|
||||||
if (devid == SPIDEV_DISPLAY)
|
if (devid == SPIDEV_DISPLAY(0))
|
||||||
{
|
{
|
||||||
/* Active low */
|
/* 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
|
#ifdef CONFIG_SAML21_XPLAINED_IOMODULE_EXT1
|
||||||
/* Check if an SD card is present in the microSD slot */
|
/* Check if an SD card is present in the microSD slot */
|
||||||
|
|
||||||
if (devid == SPIDEV_MMCSD)
|
if (devid == SPIDEV_MMCSD(0))
|
||||||
{
|
{
|
||||||
/* Active low */
|
/* 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
|
#ifdef CONFIG_SAML21_XPLAINED_IOMODULE_EXT2
|
||||||
/* Check if an SD card is present in the microSD slot */
|
/* Check if an SD card is present in the microSD slot */
|
||||||
|
|
||||||
if (devid == SPIDEV_MMCSD)
|
if (devid == SPIDEV_MMCSD(0))
|
||||||
{
|
{
|
||||||
/* Active low */
|
/* 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)
|
int sam_spi0cmddata(FAR struct spi_dev_s *dev, uint32_t devid, bool cmd)
|
||||||
{
|
{
|
||||||
#ifdef CONFIG_SAML21_XPLAINED_OLED1MODULE_EXT1
|
#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
|
/* This is the Data/Command control pad which determines whether the
|
||||||
* data bits are data or a command.
|
* 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)
|
int sam_spi1cmddata(FAR struct spi_dev_s *dev, uint32_t devid, bool cmd)
|
||||||
{
|
{
|
||||||
#ifdef CONFIG_SAML21_XPLAINED_OLED1MODULE_EXT2
|
#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
|
/* This is the Data/Command control pad which determines whether the
|
||||||
* data bits are data or a command.
|
* data bits are data or a command.
|
||||||
|
@ -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 */
|
/* 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 */
|
/* Set the GPIO low to select and high to de-select */
|
||||||
|
|
||||||
stm32_gpiowrite(GPIO_SD_CS, !selected);
|
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 */
|
/* 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.
|
* wireless module.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
if (devid == SPIDEV_TOUCHSCREEN)
|
if (devid == SPIDEV_TOUCHSCREEN(0))
|
||||||
{
|
{
|
||||||
/* Set the GPIO low to select and high to de-select */
|
/* Set the GPIO low to select and high to de-select */
|
||||||
|
|
||||||
stm32_gpiowrite(GPIO_TP_CS, !selected);
|
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 */
|
/* Set the GPIO low to select and high to de-select */
|
||||||
|
|
||||||
stm32_gpiowrite(GPIO_LCDDF_CS, !selected);
|
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 */
|
/* Set the GPIO low to select and high to de-select */
|
||||||
|
|
||||||
stm32_gpiowrite(GPIO_LCDSD_CS, !selected);
|
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 */
|
/* Set the GPIO low to select and high to de-select */
|
||||||
|
|
||||||
|
@ -134,7 +134,7 @@ void stm32_spi2select(FAR struct spi_dev_s *dev, uint32_t devid, bool selected)
|
|||||||
|
|
||||||
#if defined(CONFIG_MTD_SST25)
|
#if defined(CONFIG_MTD_SST25)
|
||||||
|
|
||||||
if (devid == SPIDEV_FLASH)
|
if (devid == SPIDEV_FLASH(0))
|
||||||
{
|
{
|
||||||
stm32_gpiowrite(GPIO_MEM_CS, !selected);
|
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
|
#endif
|
||||||
|
|
||||||
#if defined(CONFIG_WL_CC3000)
|
#if defined(CONFIG_WL_CC3000)
|
||||||
if (devid == SPIDEV_WIRELESS)
|
if (devid == SPIDEV_WIRELESS(0))
|
||||||
{
|
{
|
||||||
stm32_gpiowrite(GPIO_WIFI_CS, !selected);
|
stm32_gpiowrite(GPIO_WIFI_CS, !selected);
|
||||||
}
|
}
|
||||||
|
@ -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");
|
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 */
|
/* Set the GPIO low to select and high to de-select */
|
||||||
|
|
||||||
|
@ -125,7 +125,7 @@ void stm32_spi2select(FAR struct spi_dev_s *dev, uint32_t devid, bool selected)
|
|||||||
switch(devid)
|
switch(devid)
|
||||||
{
|
{
|
||||||
#ifdef CONFIG_WL_NRF24L01
|
#ifdef CONFIG_WL_NRF24L01
|
||||||
case SPIDEV_WIRELESS:
|
case SPIDEV_WIRELESS(0):
|
||||||
spiinfo("nRF24L01 device %s\n", selected ? "asserted" : "de-asserted");
|
spiinfo("nRF24L01 device %s\n", selected ? "asserted" : "de-asserted");
|
||||||
|
|
||||||
/* Set the GPIO low to select and high to de-select */
|
/* 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)
|
switch(devid)
|
||||||
{
|
{
|
||||||
#ifdef CONFIG_WL_NRF24L01
|
#ifdef CONFIG_WL_NRF24L01
|
||||||
case SPIDEV_WIRELESS:
|
case SPIDEV_WIRELESS(0):
|
||||||
status |= SPI_STATUS_PRESENT;
|
status |= SPI_STATUS_PRESENT;
|
||||||
break;
|
break;
|
||||||
#endif
|
#endif
|
||||||
|
@ -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);
|
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);
|
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);
|
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)
|
if (stm32_gpioread(GPIO_SD_CD) == 0)
|
||||||
{
|
{
|
||||||
|
@ -121,28 +121,28 @@ void stm32_spi1select(FAR struct spi_dev_s *dev, uint32_t devid,
|
|||||||
bool selected)
|
bool selected)
|
||||||
{
|
{
|
||||||
#if defined(CONFIG_CL_MFRC522)
|
#if defined(CONFIG_CL_MFRC522)
|
||||||
if (devid == SPIDEV_WIRELESS)
|
if (devid == SPIDEV_WIRELESS(0))
|
||||||
{
|
{
|
||||||
stm32_gpiowrite(GPIO_CS_MFRC522, !selected);
|
stm32_gpiowrite(GPIO_CS_MFRC522, !selected);
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef CONFIG_LCD_ST7567
|
#ifdef CONFIG_LCD_ST7567
|
||||||
if (devid == SPIDEV_DISPLAY)
|
if (devid == SPIDEV_DISPLAY(0))
|
||||||
{
|
{
|
||||||
stm32_gpiowrite(GPIO_CS_MFRC522, !selected);
|
stm32_gpiowrite(GPIO_CS_MFRC522, !selected);
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef CONFIG_WL_NRF24L01
|
#ifdef CONFIG_WL_NRF24L01
|
||||||
if (devid == SPIDEV_WIRELESS)
|
if (devid == SPIDEV_WIRELESS(0))
|
||||||
{
|
{
|
||||||
stm32_gpiowrite(GPIO_NRF24L01_CS, !selected);
|
stm32_gpiowrite(GPIO_NRF24L01_CS, !selected);
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef CONFIG_MMCSD_SPI
|
#ifdef CONFIG_MMCSD_SPI
|
||||||
if (devid == SPIDEV_MMCSD)
|
if (devid == SPIDEV_MMCSD(0))
|
||||||
{
|
{
|
||||||
stm32_gpiowrite(GPIO_SDCARD_CS, !selected);
|
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;
|
uint8_t status = 0;
|
||||||
|
|
||||||
#ifdef CONFIG_WL_NRF24L01
|
#ifdef CONFIG_WL_NRF24L01
|
||||||
if (devid == SPIDEV_WIRELESS)
|
if (devid == SPIDEV_WIRELESS(0))
|
||||||
{
|
{
|
||||||
status |= SPI_STATUS_PRESENT;
|
status |= SPI_STATUS_PRESENT;
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef CONFIG_MMCSD_SPI
|
#ifdef CONFIG_MMCSD_SPI
|
||||||
if (devid == SPIDEV_MMCSD)
|
if (devid == SPIDEV_MMCSD(0))
|
||||||
{
|
{
|
||||||
status |= SPI_STATUS_PRESENT;
|
status |= SPI_STATUS_PRESENT;
|
||||||
}
|
}
|
||||||
@ -213,7 +213,7 @@ int stm32_spi1cmddata(FAR struct spi_dev_s *dev, uint32_t devid,
|
|||||||
bool cmd)
|
bool cmd)
|
||||||
{
|
{
|
||||||
#ifdef CONFIG_LCD_ST7567
|
#ifdef CONFIG_LCD_ST7567
|
||||||
if (devid == SPIDEV_DISPLAY)
|
if (devid == SPIDEV_DISPLAY(0))
|
||||||
{
|
{
|
||||||
/* This is the Data/Command control pad which determines whether the
|
/* This is the Data/Command control pad which determines whether the
|
||||||
* data bits are data or a command.
|
* data bits are data or a command.
|
||||||
|
@ -855,7 +855,7 @@ static inline void stm32_ili93414ws_cmddata(
|
|||||||
{
|
{
|
||||||
FAR struct ili93414ws_lcd_s *priv = (FAR struct ili93414ws_lcd_s *)lcd;
|
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
|
#else
|
||||||
static inline void stm32_ili93414ws_cmddata(
|
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_LOCK(priv->spi, true);
|
||||||
SPI_SELECT(priv->spi, SPIDEV_DISPLAY, true);
|
SPI_SELECT(priv->spi, SPIDEV_DISPLAY(0), true);
|
||||||
|
|
||||||
/* Configure spi and disable */
|
/* 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. */
|
/* 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);
|
SPI_LOCK(priv->spi, false);
|
||||||
}
|
}
|
||||||
#else
|
#else
|
||||||
|
@ -71,7 +71,7 @@ static struct l3gd20_config_s g_l3gd20_config =
|
|||||||
{
|
{
|
||||||
.attach = l3gd20_attach,
|
.attach = l3gd20_attach,
|
||||||
.irq = L3GD20_IRQ,
|
.irq = L3GD20_IRQ,
|
||||||
.spi_devid = SPIDEV_ACCELEROMETER
|
.spi_devid = SPIDEV_ACCELEROMETER(0)
|
||||||
};
|
};
|
||||||
|
|
||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
|
@ -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)
|
void stm32_spi4select(FAR struct spi_dev_s *dev, uint32_t devid, bool selected)
|
||||||
{
|
{
|
||||||
#if defined(CONFIG_MTD_SST25XX)
|
#if defined(CONFIG_MTD_SST25XX)
|
||||||
if (devid == SPIDEV_FLASH)
|
if (devid == SPIDEV_FLASH(0))
|
||||||
{
|
{
|
||||||
stm32_gpiowrite(GPIO_CS_SST25, !selected);
|
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");
|
spiinfo("devid: %d CS: %s\n", (int)devid, selected ? "assert" : "de-assert");
|
||||||
|
|
||||||
#if defined(CONFIG_STM32F429I_DISCO_ILI9341)
|
#if defined(CONFIG_STM32F429I_DISCO_ILI9341)
|
||||||
if (devid == SPIDEV_DISPLAY)
|
if (devid == SPIDEV_DISPLAY(0))
|
||||||
{
|
{
|
||||||
stm32_gpiowrite(GPIO_CS_LCD, !selected);
|
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)
|
int stm32_spi5cmddata(FAR struct spi_dev_s *dev, uint32_t devid, bool cmd)
|
||||||
{
|
{
|
||||||
#if defined(CONFIG_STM32F429I_DISCO_ILI9341)
|
#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
|
/* This is the Data/Command control pad which determines whether the
|
||||||
* data bits are data or a command.
|
* data bits are data or a command.
|
||||||
|
@ -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) || \
|
#if defined(CONFIG_LCD_UG2864AMBAG01) || defined(CONFIG_LCD_UG2864HSWEG01) || \
|
||||||
defined(CONFIG_LCD_SSD1351)
|
defined(CONFIG_LCD_SSD1351)
|
||||||
if (devid == SPIDEV_DISPLAY)
|
if (devid == SPIDEV_DISPLAY(0))
|
||||||
{
|
{
|
||||||
stm32_gpiowrite(GPIO_OLED_CS, !selected);
|
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");
|
spiinfo("devid: %d CS: %s\n", (int)devid, selected ? "assert" : "de-assert");
|
||||||
|
|
||||||
#if defined(CONFIG_MAX31855)
|
#if defined(CONFIG_MAX31855)
|
||||||
if (devid == SPIDEV_TEMPERATURE)
|
if (devid == SPIDEV_TEMPERATURE(0))
|
||||||
{
|
{
|
||||||
stm32_gpiowrite(GPIO_MAX31855_CS, !selected);
|
stm32_gpiowrite(GPIO_MAX31855_CS, !selected);
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
#if defined(CONFIG_MAX6675)
|
#if defined(CONFIG_MAX6675)
|
||||||
if (devid == SPIDEV_TEMPERATURE)
|
if (devid == SPIDEV_TEMPERATURE(0))
|
||||||
{
|
{
|
||||||
stm32_gpiowrite(GPIO_MAX6675_CS, !selected);
|
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) || \
|
#if defined(CONFIG_LCD_UG2864AMBAG01) || defined(CONFIG_LCD_UG2864HSWEG01) || \
|
||||||
defined(CONFIG_LCD_SSD1351)
|
defined(CONFIG_LCD_SSD1351)
|
||||||
if (devid == SPIDEV_DISPLAY)
|
if (devid == SPIDEV_DISPLAY(0))
|
||||||
{
|
{
|
||||||
/* "This is the Data/Command control pad which determines whether the
|
/* "This is the Data/Command control pad which determines whether the
|
||||||
* data bits are data or a command.
|
* data bits are data or a command.
|
||||||
|
@ -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");
|
spiinfo("devid: %d CS: %s\n", (int)devid, selected ? "assert" : "de-assert");
|
||||||
|
|
||||||
#ifdef CONFIG_WL_CC3000
|
#ifdef CONFIG_WL_CC3000
|
||||||
if (devid == SPIDEV_WIRELESS)
|
if (devid == SPIDEV_WIRELESS(0))
|
||||||
{
|
{
|
||||||
stm32_gpiowrite(GPIO_SPI_CS_WIFI, !selected);
|
stm32_gpiowrite(GPIO_SPI_CS_WIFI, !selected);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
#endif
|
#endif
|
||||||
#ifdef HAVE_MMCSD
|
#ifdef HAVE_MMCSD
|
||||||
if (devid == SPIDEV_MMCSD)
|
if (devid == SPIDEV_MMCSD(0))
|
||||||
{
|
{
|
||||||
stm32_gpiowrite(GPIO_SPI_CS_SD_CARD, !selected);
|
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");
|
spiinfo("devid: %d CS: %s\n", (int)devid, selected ? "assert" : "de-assert");
|
||||||
|
|
||||||
#ifdef CONFIG_WL_CC3000
|
#ifdef CONFIG_WL_CC3000
|
||||||
if (devid == SPIDEV_WIRELESS)
|
if (devid == SPIDEV_WIRELESS(0))
|
||||||
{
|
{
|
||||||
stm32_gpiowrite(GPIO_WIFI_CS, !selected);
|
stm32_gpiowrite(GPIO_WIFI_CS, !selected);
|
||||||
}
|
}
|
||||||
|
@ -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 */
|
/* The SD card chip select is pulled high and active low */
|
||||||
|
|
||||||
#ifdef PIC32_HAVE_SD
|
#ifdef PIC32_HAVE_SD
|
||||||
if (devid == SPIDEV_MMCSD)
|
if (devid == SPIDEV_MMCSD(0))
|
||||||
{
|
{
|
||||||
pic32mx_gpiowrite(GPIO_SD_CS, !selected);
|
pic32mx_gpiowrite(GPIO_SD_CS, !selected);
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef PIC32_HAVE_SOIC
|
#ifdef PIC32_HAVE_SOIC
|
||||||
if (devid == SPIDEV_FLASH)
|
if (devid == SPIDEV_FLASH(0))
|
||||||
{
|
{
|
||||||
pic32mx_gpiowrite(GPIO_SOIC_CS, !selected);
|
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
|
#ifdef PIC32_HAVE_SD
|
||||||
if (devid == SPIDEV_MMCSD)
|
if (devid == SPIDEV_MMCSD(0))
|
||||||
{
|
{
|
||||||
if (!pic32mx_gpioread(GPIO_SD_CD))
|
if (!pic32mx_gpioread(GPIO_SD_CD))
|
||||||
{
|
{
|
||||||
@ -223,7 +223,7 @@ uint8_t pic32mx_spi2status(FAR struct spi_dev_s *dev, uint32_t devid)
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef PIC32_HAVE_SOIC
|
#ifdef PIC32_HAVE_SOIC
|
||||||
if (devid == SPIDEV_FLASH)
|
if (devid == SPIDEV_FLASH(0))
|
||||||
{
|
{
|
||||||
ret = SPI_STATUS_PRESENT;
|
ret = SPI_STATUS_PRESENT;
|
||||||
|
|
||||||
|
@ -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");
|
spiinfo("devid: %d CS: %s\n", (int)devid, selected ? "assert" : "de-assert");
|
||||||
ssp_dumpgpio("lpc17_ssp1select() Entry");
|
ssp_dumpgpio("lpc17_ssp1select() Entry");
|
||||||
|
|
||||||
if (devid == SPIDEV_MMCSD)
|
if (devid == SPIDEV_MMCSD(0))
|
||||||
{
|
{
|
||||||
/* Assert/de-assert the CS pin to the card */
|
/* Assert/de-assert the CS pin to the card */
|
||||||
|
|
||||||
(void)lpc17_gpiowrite(C027_SD_CS, !selected);
|
(void)lpc17_gpiowrite(C027_SD_CS, !selected);
|
||||||
}
|
}
|
||||||
#ifdef CONFIG_NX_LCDDRIVER
|
#ifdef CONFIG_NX_LCDDRIVER
|
||||||
else if (devid == SPIDEV_DISPLAY)
|
else if (devid == SPIDEV_DISPLAY(0))
|
||||||
{
|
{
|
||||||
/* Assert the CS pin to the OLED display */
|
/* 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)
|
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 */
|
/* Read the state of the card-detect bit */
|
||||||
|
|
||||||
|
@ -132,7 +132,7 @@ void stm32_spi2select(FAR struct spi_dev_s *dev, uint32_t devid, bool selected)
|
|||||||
#ifdef CONFIG_INPUT_ADS7843E
|
#ifdef CONFIG_INPUT_ADS7843E
|
||||||
/* Select/de-select the touchscreen */
|
/* Select/de-select the touchscreen */
|
||||||
|
|
||||||
if (devid == SPIDEV_TOUCHSCREEN)
|
if (devid == SPIDEV_TOUCHSCREEN(0))
|
||||||
{
|
{
|
||||||
stm32_gpiowrite(GPIO_LCDTP_CS, !selected);
|
stm32_gpiowrite(GPIO_LCDTP_CS, !selected);
|
||||||
}
|
}
|
||||||
|
@ -158,7 +158,7 @@ void board_lcd_uninitialize(void)
|
|||||||
|
|
||||||
int lpc17_ssp0cmddata(FAR struct spi_dev_s *dev, uint32_t devid, bool cmd)
|
int lpc17_ssp0cmddata(FAR struct spi_dev_s *dev, uint32_t devid, bool cmd)
|
||||||
{
|
{
|
||||||
if (devid == SPIDEV_DISPLAY)
|
if (devid == SPIDEV_DISPLAY(0))
|
||||||
{
|
{
|
||||||
/* Set GPIO to 1 for data, 0 for command */
|
/* Set GPIO to 1 for data, 0 for command */
|
||||||
|
|
||||||
|
@ -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");
|
spiinfo("devid: %d CS: %s\n", (int)devid, selected ? "assert" : "de-assert");
|
||||||
spi_dumpgpio("lpc17_spiselect() Entry");
|
spi_dumpgpio("lpc17_spiselect() Entry");
|
||||||
|
|
||||||
if (devid == SPIDEV_MMCSD)
|
if (devid == SPIDEV_MMCSD(0))
|
||||||
{
|
{
|
||||||
/* Assert/de-assert the CS pin to the card */
|
/* 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)
|
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 */
|
/* Read the state of the card-detect bit */
|
||||||
|
|
||||||
|
@ -166,7 +166,7 @@ void lpc17_ssp0select(FAR struct spi_dev_s *dev, uint32_t devid, bool selected)
|
|||||||
ssp_dumpgpio("lpc17_ssp0select() Entry");
|
ssp_dumpgpio("lpc17_ssp0select() Entry");
|
||||||
|
|
||||||
#ifdef CONFIG_NX_LCDDRIVER
|
#ifdef CONFIG_NX_LCDDRIVER
|
||||||
if (devid == SPIDEV_DISPLAY)
|
if (devid == SPIDEV_DISPLAY(0))
|
||||||
{
|
{
|
||||||
/* Assert the CS pin to the OLED display */
|
/* 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)
|
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");
|
spiinfo("Returning SPI_STATUS_PRESENT\n");
|
||||||
return SPI_STATUS_PRESENT;
|
return SPI_STATUS_PRESENT;
|
||||||
|
@ -220,7 +220,7 @@ static void spi_select(FAR struct spi_dev_s *dev, uint32_t devid, bool selected)
|
|||||||
#endif
|
#endif
|
||||||
uint32_t bit = 1 << 20;
|
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.
|
* 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
|
#endif
|
||||||
uint32_t bit = 1 << 23;
|
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.
|
* only thing on the bus.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
@ -116,7 +116,7 @@ config PGA11X_MULTIPLE
|
|||||||
Can be defined to support multiple PGA11X devices on board with separate
|
Can be defined to support multiple PGA11X devices on board with separate
|
||||||
chip selects (not daisy chained). Each device will require a customized
|
chip selects (not daisy chained). Each device will require a customized
|
||||||
SPI interface to distinguish them when SPI_SELECT is called with
|
SPI interface to distinguish them when SPI_SELECT is called with
|
||||||
devid=SPIDEV_MUX.
|
devid=SPIDEV_MUX(n).
|
||||||
|
|
||||||
endif # if ADC_PGA11X
|
endif # if ADC_PGA11X
|
||||||
endif # ADC
|
endif # ADC
|
||||||
|
@ -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. */
|
/* Lock, select, send the 16-bit command, de-select, and un-lock. */
|
||||||
|
|
||||||
pga11x_lock(spi);
|
pga11x_lock(spi);
|
||||||
SPI_SELECT(spi, SPIDEV_MUX, true);
|
SPI_SELECT(spi, SPIDEV_MUX(0), true);
|
||||||
pga11x_send16(spi, cmd);
|
pga11x_send16(spi, cmd);
|
||||||
SPI_SELECT(spi, SPIDEV_MUX, false);
|
SPI_SELECT(spi, SPIDEV_MUX(0), false);
|
||||||
pga11x_unlock(spi);
|
pga11x_unlock(spi);
|
||||||
}
|
}
|
||||||
#else
|
#else
|
||||||
@ -293,10 +293,10 @@ static void pga11x_write(FAR struct spi_dev_s *spi, uint16_t u1cmd, uint16_t u2c
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
pga11x_lock(spi);
|
pga11x_lock(spi);
|
||||||
SPI_SELECT(spi, SPIDEV_MUX, true);
|
SPI_SELECT(spi, SPIDEV_MUX(0), true);
|
||||||
pga11x_send16(spi, u2cmd);
|
pga11x_send16(spi, u2cmd);
|
||||||
pga11x_send16(spi, u1cmd);
|
pga11x_send16(spi, u1cmd);
|
||||||
SPI_SELECT(spi, SPIDEV_MUX, false);
|
SPI_SELECT(spi, SPIDEV_MUX(0), false);
|
||||||
pga11x_unlock(spi);
|
pga11x_unlock(spi);
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
@ -491,17 +491,17 @@ int pga11x_read(PGA11X_HANDLE handle, FAR struct pga11x_settings_s *settings)
|
|||||||
* for the part.
|
* 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_CMD_READ);
|
||||||
pga11x_send16(spi, PGA11X_DCCMD_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 */
|
/* 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);
|
u2value = pga11x_recv16(spi);
|
||||||
u1value = pga11x_recv16(spi);
|
u1value = pga11x_recv16(spi);
|
||||||
SPI_SELECT(spi, SPIDEV_MUX, false);
|
SPI_SELECT(spi, SPIDEV_MUX(0), false);
|
||||||
pga11x_unlock(spi);
|
pga11x_unlock(spi);
|
||||||
|
|
||||||
/* Decode the returned value */
|
/* 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.
|
* 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);
|
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 */
|
/* 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);
|
value = pga11x_recv16(spi);
|
||||||
SPI_SELECT(spi, SPIDEV_MUX, false);
|
SPI_SELECT(spi, SPIDEV_MUX(0), false);
|
||||||
pga11x_unlock(spi);
|
pga11x_unlock(spi);
|
||||||
|
|
||||||
/* Decode the returned value */
|
/* Decode the returned value */
|
||||||
|
@ -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 */
|
/* 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 */
|
/* 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 */
|
/* Deselect the CODEC */
|
||||||
|
|
||||||
SPI_SELECT(spi, SPIDEV_AUDIO_CTRL, false);
|
SPI_SELECT(spi, SPIDEV_AUDIO_CTRL(0), false);
|
||||||
|
|
||||||
return ret;
|
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);
|
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 */
|
/* 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 */
|
/* 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 */
|
/* 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 */
|
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 */
|
/* 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)
|
else if (!dev->endmode)
|
||||||
{
|
{
|
||||||
SPI_SELECT(spi, SPIDEV_AUDIO_DATA, false);
|
SPI_SELECT(spi, SPIDEV_AUDIO_DATA(0), false);
|
||||||
vs1053_spi_unlock(spi);
|
vs1053_spi_unlock(spi);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -1194,7 +1194,7 @@ static void vs1053_feeddata(FAR struct vs1053_struct_s *dev)
|
|||||||
|
|
||||||
/* Deselect the SPI bus and unlock it */
|
/* Deselect the SPI bus and unlock it */
|
||||||
err_out:
|
err_out:
|
||||||
SPI_SELECT(spi, SPIDEV_AUDIO_DATA, false);
|
SPI_SELECT(spi, SPIDEV_AUDIO_DATA(0), false);
|
||||||
vs1053_spi_unlock(spi);
|
vs1053_spi_unlock(spi);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -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)
|
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)
|
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);
|
||||||
}
|
}
|
||||||
|
|
||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
|
@ -201,7 +201,7 @@ static inline void pn532_select(struct pn532_dev_s *dev)
|
|||||||
}
|
}
|
||||||
else
|
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
|
else
|
||||||
{
|
{
|
||||||
SPI_SELECT(dev->spi, SPIDEV_CONTACTLESS, false);
|
SPI_SELECT(dev->spi, SPIDEV_CONTACTLESS(0), false);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -358,7 +358,7 @@ static void ee25xx_waitwritecomplete(struct ee25xx_dev_s *priv)
|
|||||||
{
|
{
|
||||||
/* Select this FLASH part */
|
/* 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 */
|
/* Send "Read Status Register (RDSR)" command */
|
||||||
|
|
||||||
@ -372,7 +372,7 @@ static void ee25xx_waitwritecomplete(struct ee25xx_dev_s *priv)
|
|||||||
|
|
||||||
/* Deselect the FLASH */
|
/* 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,
|
/* Given that writing could take up to a few milliseconds,
|
||||||
* the following short delay in the "busy" case will allow
|
* 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)
|
static void ee25xx_writeenable(FAR struct spi_dev_s *spi, int enable)
|
||||||
{
|
{
|
||||||
ee25xx_lock(spi);
|
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_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);
|
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)
|
FAR const char *data, size_t len)
|
||||||
{
|
{
|
||||||
ee25xx_lock(eedev->spi);
|
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);
|
ee25xx_sendcmd(eedev->spi, EE25XX_CMD_WRITE, eedev->addrlen, devaddr);
|
||||||
SPI_SNDBLOCK(eedev->spi, data, len);
|
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);
|
ee25xx_unlock(eedev->spi);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -625,7 +625,7 @@ static ssize_t ee25xx_read(FAR struct file *filep, FAR char *buffer,
|
|||||||
}
|
}
|
||||||
|
|
||||||
ee25xx_lock(eedev->spi);
|
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 */
|
/* 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 */
|
/* 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);
|
ee25xx_unlock(eedev->spi);
|
||||||
|
|
||||||
/* Update the file position */
|
/* Update the file position */
|
||||||
|
@ -189,12 +189,12 @@ static void ads7843e_lock(FAR struct spi_dev_s *spi)
|
|||||||
* unlocked)
|
* unlocked)
|
||||||
*/
|
*/
|
||||||
|
|
||||||
SPI_SELECT(spi, SPIDEV_TOUCHSCREEN, true);
|
SPI_SELECT(spi, SPIDEV_TOUCHSCREEN(0), true);
|
||||||
SPI_SETMODE(spi, CONFIG_ADS7843E_SPIMODE);
|
SPI_SETMODE(spi, CONFIG_ADS7843E_SPIMODE);
|
||||||
SPI_SETBITS(spi, 8);
|
SPI_SETBITS(spi, 8);
|
||||||
(void)SPI_HWFEATURES(spi, 0);
|
(void)SPI_HWFEATURES(spi, 0);
|
||||||
(void)SPI_SETFREQUENCY(spi, CONFIG_ADS7843E_FREQUENCY);
|
(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 */
|
/* Select the ADS7843E */
|
||||||
|
|
||||||
SPI_SELECT(priv->spi, SPIDEV_TOUCHSCREEN, true);
|
SPI_SELECT(priv->spi, SPIDEV_TOUCHSCREEN(0), true);
|
||||||
|
|
||||||
/* Send the command */
|
/* 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) */
|
/* Read the 12-bit data (LS 4 bits will be padded with zero) */
|
||||||
|
|
||||||
SPI_RECVBLOCK(priv->spi, buffer, 2);
|
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 = ((uint16_t)buffer[0] << 8) | (uint16_t)buffer[1];
|
||||||
result = result >> 4;
|
result = result >> 4;
|
||||||
|
@ -231,7 +231,7 @@ static uint16_t max11802_sendcmd(FAR struct max11802_dev_s *priv,
|
|||||||
|
|
||||||
/* Select the MAX11802 */
|
/* Select the MAX11802 */
|
||||||
|
|
||||||
SPI_SELECT(priv->spi, SPIDEV_TOUCHSCREEN, true);
|
SPI_SELECT(priv->spi, SPIDEV_TOUCHSCREEN(0), true);
|
||||||
|
|
||||||
/* Send the command */
|
/* Send the command */
|
||||||
|
|
||||||
@ -240,7 +240,7 @@ static uint16_t max11802_sendcmd(FAR struct max11802_dev_s *priv,
|
|||||||
/* Read the data */
|
/* Read the data */
|
||||||
|
|
||||||
SPI_RECVBLOCK(priv->spi, buffer, 2);
|
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 = ((uint16_t)buffer[0] << 8) | (uint16_t)buffer[1];
|
||||||
*tags = result & 0xF;
|
*tags = result & 0xF;
|
||||||
@ -1225,32 +1225,32 @@ int max11802_register(FAR struct spi_dev_s *spi,
|
|||||||
|
|
||||||
/* Configure MAX11802 registers */
|
/* 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_CMD_MODE_WR);
|
||||||
(void)SPI_SEND(priv->spi, MAX11802_MODE);
|
(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_CMD_AVG_WR);
|
||||||
(void)SPI_SEND(priv->spi, MAX11802_AVG);
|
(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_CMD_TIMING_WR);
|
||||||
(void)SPI_SEND(priv->spi, MAX11802_TIMING);
|
(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_CMD_DELAY_WR);
|
||||||
(void)SPI_SEND(priv->spi, MAX11802_DELAY);
|
(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. */
|
/* 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);
|
(void)SPI_SEND(priv->spi, MAX11802_CMD_MODE_RD);
|
||||||
ret = SPI_SEND(priv->spi, 0);
|
ret = SPI_SEND(priv->spi, 0);
|
||||||
SPI_SELECT(priv->spi, SPIDEV_TOUCHSCREEN, false);
|
SPI_SELECT(priv->spi, SPIDEV_TOUCHSCREEN(0), false);
|
||||||
|
|
||||||
/* Unlock the bus */
|
/* Unlock the bus */
|
||||||
|
|
||||||
|
@ -285,7 +285,7 @@ static void memlcd_select(FAR struct spi_dev_s *spi)
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
SPI_LOCK(spi, true);
|
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
|
/* Now make sure that the SPI bus is configured for the memlcd (it
|
||||||
* might have gotten configured for a different device while unlocked)
|
* 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. */
|
/* 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);
|
SPI_LOCK(spi, false);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -661,7 +661,7 @@ static void nokia_select(FAR struct spi_dev_s *spi)
|
|||||||
lcdinfo("SELECTED\n");
|
lcdinfo("SELECTED\n");
|
||||||
|
|
||||||
SPI_LOCK(spi, true);
|
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
|
/* Now make sure that the SPI bus is configured for the Nokia 6100 (it
|
||||||
* might have gotten configured for a different device while unlocked)
|
* 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");
|
lcdinfo("DE-SELECTED\n");
|
||||||
|
|
||||||
SPI_SELECT(spi, SPIDEV_DISPLAY, false);
|
SPI_SELECT(spi, SPIDEV_DISPLAY(0), false);
|
||||||
SPI_LOCK(spi, false);
|
SPI_LOCK(spi, false);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -449,7 +449,7 @@ static void rit_select(FAR struct spi_dev_s *spi)
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
SPI_LOCK(spi, true);
|
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
|
/* Now make sure that the SPI bus is configured for the P14201 (it
|
||||||
* might have gotten configured for a different device while unlocked)
|
* 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. */
|
/* 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);
|
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 */
|
/* 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 */
|
/* Loop until the entire command/data block is transferred */
|
||||||
|
|
||||||
|
@ -130,7 +130,7 @@ void ssd1306_select(FAR struct ssd1306_dev_s *priv, bool cs)
|
|||||||
|
|
||||||
/* Select/deselect SPI device */
|
/* 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 */
|
/* If we are deselecting the device */
|
||||||
|
|
||||||
@ -154,6 +154,6 @@ void ssd1306_cmddata(FAR struct ssd1306_dev_s *priv, bool cmd)
|
|||||||
{
|
{
|
||||||
/* Select command transfer */
|
/* 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 */
|
#endif /* CONFIG_LCD_SSD1306 && CONFIG_LCD_SSD1306_SPI */
|
||||||
|
@ -502,7 +502,7 @@ static void ssd1351_select(FAR struct ssd1351_dev_s *priv)
|
|||||||
ginfo("SELECTED\n");
|
ginfo("SELECTED\n");
|
||||||
|
|
||||||
SPI_LOCK(spi, true);
|
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
|
/* Now make sure that the SPI bus is configured for this device (it might
|
||||||
* have gotten configured for a different device while unlocked)
|
* 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");
|
ginfo("DE-SELECTED\n");
|
||||||
|
|
||||||
SPI_SELECT(spi, SPIDEV_DISPLAY, false);
|
SPI_SELECT(spi, SPIDEV_DISPLAY(0), false);
|
||||||
SPI_LOCK(spi, false);
|
SPI_LOCK(spi, false);
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
@ -648,7 +648,7 @@ static void ssd1351_write(FAR struct ssd1351_dev_s *priv, uint8_t cmd,
|
|||||||
|
|
||||||
/* Select command transfer */
|
/* Select command transfer */
|
||||||
|
|
||||||
(void)SPI_CMDDATA(spi, SPIDEV_DISPLAY, true);
|
(void)SPI_CMDDATA(spi, SPIDEV_DISPLAY(0), true);
|
||||||
|
|
||||||
/* Send the command */
|
/* Send the command */
|
||||||
|
|
||||||
@ -660,7 +660,7 @@ static void ssd1351_write(FAR struct ssd1351_dev_s *priv, uint8_t cmd,
|
|||||||
{
|
{
|
||||||
/* Yes, select data transfer */
|
/* Yes, select data transfer */
|
||||||
|
|
||||||
(void)SPI_CMDDATA(spi, SPIDEV_DISPLAY, false);
|
(void)SPI_CMDDATA(spi, SPIDEV_DISPLAY(0), false);
|
||||||
|
|
||||||
/* Transfer all of the data */
|
/* Transfer all of the data */
|
||||||
|
|
||||||
|
@ -365,7 +365,7 @@ static void st7567_select(FAR struct spi_dev_s *spi)
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
SPI_LOCK(spi, true);
|
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
|
/* Now make sure that the SPI bus is configured for the ST7567 (it
|
||||||
* might have gotten configured for a different device while unlocked)
|
* 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. */
|
/* 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);
|
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 */
|
/* 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 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 */
|
/* Select data transfer */
|
||||||
|
|
||||||
SPI_CMDDATA(priv->spi, SPIDEV_DISPLAY, false);
|
SPI_CMDDATA(priv->spi, SPIDEV_DISPLAY(0), false);
|
||||||
|
|
||||||
/* Then transfer all of the data */
|
/* 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 */
|
/* Select command transfer */
|
||||||
|
|
||||||
SPI_CMDDATA(priv->spi, SPIDEV_DISPLAY, true);
|
SPI_CMDDATA(priv->spi, SPIDEV_DISPLAY(0), true);
|
||||||
|
|
||||||
/* Set the contrast */
|
/* Set the contrast */
|
||||||
|
|
||||||
@ -854,7 +854,7 @@ static inline void up_clear(FAR struct st7567_dev_s *priv)
|
|||||||
{
|
{
|
||||||
/* Select command transfer */
|
/* Select command transfer */
|
||||||
|
|
||||||
SPI_CMDDATA(spi, SPIDEV_DISPLAY, true);
|
SPI_CMDDATA(spi, SPIDEV_DISPLAY(0), true);
|
||||||
|
|
||||||
/* Set the starting position for the run */
|
/* 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 */
|
/* Select data transfer */
|
||||||
|
|
||||||
SPI_CMDDATA(spi, SPIDEV_DISPLAY, false);
|
SPI_CMDDATA(spi, SPIDEV_DISPLAY(0), false);
|
||||||
|
|
||||||
/* Then transfer all 96 columns of data */
|
/* 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 */
|
/* Select command transfer */
|
||||||
|
|
||||||
SPI_CMDDATA(spi, SPIDEV_DISPLAY, true);
|
SPI_CMDDATA(spi, SPIDEV_DISPLAY(0), true);
|
||||||
|
|
||||||
/* Set the starting position for the run */
|
/* Set the starting position for the run */
|
||||||
|
|
||||||
|
@ -622,11 +622,11 @@ static int ug2864ambag01_putrun(fb_coord_t row, fb_coord_t col, FAR const uint8_
|
|||||||
/* Lock and select device */
|
/* Lock and select device */
|
||||||
|
|
||||||
ug2864ambag01_lock(priv->spi);
|
ug2864ambag01_lock(priv->spi);
|
||||||
SPI_SELECT(priv->spi, SPIDEV_DISPLAY, true);
|
SPI_SELECT(priv->spi, SPIDEV_DISPLAY(0), true);
|
||||||
|
|
||||||
/* Select command transfer */
|
/* 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 starting position for the run */
|
||||||
/* Set the column address to the XOFFSET value */
|
/* 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 */
|
/* Select data transfer */
|
||||||
|
|
||||||
SPI_CMDDATA(priv->spi, SPIDEV_DISPLAY, false);
|
SPI_CMDDATA(priv->spi, SPIDEV_DISPLAY(0), false);
|
||||||
|
|
||||||
/* Then transfer all of the data */
|
/* 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 */
|
/* 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);
|
ug2864ambag01_unlock(priv->spi);
|
||||||
return OK;
|
return OK;
|
||||||
}
|
}
|
||||||
@ -892,7 +892,7 @@ static int ug2864ambag01_setpower(struct lcd_dev_s *dev, int power)
|
|||||||
/* Lock and select device */
|
/* Lock and select device */
|
||||||
|
|
||||||
ug2864ambag01_lock(priv->spi);
|
ug2864ambag01_lock(priv->spi);
|
||||||
SPI_SELECT(priv->spi, SPIDEV_DISPLAY, true);
|
SPI_SELECT(priv->spi, SPIDEV_DISPLAY(0), true);
|
||||||
|
|
||||||
if (power <= 0)
|
if (power <= 0)
|
||||||
{
|
{
|
||||||
@ -911,7 +911,7 @@ static int ug2864ambag01_setpower(struct lcd_dev_s *dev, int power)
|
|||||||
|
|
||||||
/* De-select and unlock the device */
|
/* 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);
|
ug2864ambag01_unlock(priv->spi);
|
||||||
return OK;
|
return OK;
|
||||||
}
|
}
|
||||||
@ -971,11 +971,11 @@ static int ug2864ambag01_setcontrast(struct lcd_dev_s *dev, unsigned int contras
|
|||||||
/* Lock and select device */
|
/* Lock and select device */
|
||||||
|
|
||||||
ug2864ambag01_lock(priv->spi);
|
ug2864ambag01_lock(priv->spi);
|
||||||
SPI_SELECT(priv->spi, SPIDEV_DISPLAY, true);
|
SPI_SELECT(priv->spi, SPIDEV_DISPLAY(0), true);
|
||||||
|
|
||||||
/* Select command transfer */
|
/* Select command transfer */
|
||||||
|
|
||||||
SPI_CMDDATA(priv->spi, SPIDEV_DISPLAY, true);
|
SPI_CMDDATA(priv->spi, SPIDEV_DISPLAY(0), true);
|
||||||
|
|
||||||
/* Set the contrast */
|
/* 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 */
|
/* 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);
|
ug2864ambag01_unlock(priv->spi);
|
||||||
return OK;
|
return OK;
|
||||||
}
|
}
|
||||||
@ -1029,11 +1029,11 @@ FAR struct lcd_dev_s *ug2864ambag01_initialize(FAR struct spi_dev_s *spi, unsign
|
|||||||
/* Lock and select device */
|
/* Lock and select device */
|
||||||
|
|
||||||
ug2864ambag01_lock(priv->spi);
|
ug2864ambag01_lock(priv->spi);
|
||||||
SPI_SELECT(spi, SPIDEV_DISPLAY, true);
|
SPI_SELECT(spi, SPIDEV_DISPLAY(0), true);
|
||||||
|
|
||||||
/* Select command transfer */
|
/* Select command transfer */
|
||||||
|
|
||||||
SPI_CMDDATA(spi, SPIDEV_DISPLAY, true);
|
SPI_CMDDATA(spi, SPIDEV_DISPLAY(0), true);
|
||||||
|
|
||||||
/* Configure the device */
|
/* 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 */
|
/* De-select and unlock the device */
|
||||||
|
|
||||||
SPI_SELECT(spi, SPIDEV_DISPLAY, false);
|
SPI_SELECT(spi, SPIDEV_DISPLAY(0), false);
|
||||||
ug2864ambag01_unlock(priv->spi);
|
ug2864ambag01_unlock(priv->spi);
|
||||||
|
|
||||||
/* Clear the display */
|
/* Clear the display */
|
||||||
@ -1112,7 +1112,7 @@ void ug2864ambag01_fill(FAR struct lcd_dev_s *dev, uint8_t color)
|
|||||||
/* Lock and select device */
|
/* Lock and select device */
|
||||||
|
|
||||||
ug2864ambag01_lock(priv->spi);
|
ug2864ambag01_lock(priv->spi);
|
||||||
SPI_SELECT(priv->spi, SPIDEV_DISPLAY, true);
|
SPI_SELECT(priv->spi, SPIDEV_DISPLAY(0), true);
|
||||||
|
|
||||||
/* Visit each page */
|
/* Visit each page */
|
||||||
|
|
||||||
@ -1120,7 +1120,7 @@ void ug2864ambag01_fill(FAR struct lcd_dev_s *dev, uint8_t color)
|
|||||||
{
|
{
|
||||||
/* Select command transfer */
|
/* 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 */
|
/* 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 */
|
/* 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 */
|
/* 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 */
|
/* 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);
|
ug2864ambag01_unlock(priv->spi);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -399,7 +399,7 @@ static void ug_select(FAR struct spi_dev_s *spi)
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
SPI_LOCK(spi, true);
|
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
|
/* Now make sure that the SPI bus is configured for the UG-9664HSWAG01 (it
|
||||||
* might have gotten configured for a different device while unlocked)
|
* 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. */
|
/* 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);
|
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 */
|
/* 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 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 */
|
/* Select data transfer */
|
||||||
|
|
||||||
SPI_CMDDATA(priv->spi, SPIDEV_DISPLAY, false);
|
SPI_CMDDATA(priv->spi, SPIDEV_DISPLAY(0), false);
|
||||||
|
|
||||||
/* Then transfer all of the data */
|
/* 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 */
|
/* Select command transfer */
|
||||||
|
|
||||||
SPI_CMDDATA(priv->spi, SPIDEV_DISPLAY, true);
|
SPI_CMDDATA(priv->spi, SPIDEV_DISPLAY(0), true);
|
||||||
|
|
||||||
/* Set the contrast */
|
/* Set the contrast */
|
||||||
|
|
||||||
@ -985,7 +985,7 @@ static inline void up_clear(FAR struct ug_dev_s *priv)
|
|||||||
{
|
{
|
||||||
/* Select command transfer */
|
/* Select command transfer */
|
||||||
|
|
||||||
SPI_CMDDATA(spi, SPIDEV_DISPLAY, true);
|
SPI_CMDDATA(spi, SPIDEV_DISPLAY(0), true);
|
||||||
|
|
||||||
/* Set the starting position for the run */
|
/* 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 */
|
/* Select data transfer */
|
||||||
|
|
||||||
SPI_CMDDATA(spi, SPIDEV_DISPLAY, false);
|
SPI_CMDDATA(spi, SPIDEV_DISPLAY(0), false);
|
||||||
|
|
||||||
/* Then transfer all 96 columns of data */
|
/* 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 */
|
/* Select command transfer */
|
||||||
|
|
||||||
SPI_CMDDATA(spi, SPIDEV_DISPLAY, true);
|
SPI_CMDDATA(spi, SPIDEV_DISPLAY(0), true);
|
||||||
|
|
||||||
/* Configure the device */
|
/* Configure the device */
|
||||||
|
|
||||||
|
@ -842,7 +842,7 @@ static void mmcsd_checkwrprotect(FAR struct mmcsd_slot_s *slot, uint8_t *csd)
|
|||||||
* reports temporary write protect.
|
* 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_PERMWRITEPROTECT(csd) ||
|
||||||
MMCSD_CSD_TMPWRITEPROTECT(csd))
|
MMCSD_CSD_TMPWRITEPROTECT(csd))
|
||||||
{
|
{
|
||||||
@ -1056,7 +1056,7 @@ static int mmcsd_open(FAR struct inode *inode)
|
|||||||
|
|
||||||
ret = -ENODEV;
|
ret = -ENODEV;
|
||||||
mmcsd_semtake(slot);
|
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? */
|
/* 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 */
|
/* Make sure that the card is ready */
|
||||||
|
|
||||||
SPI_SELECT(spi, SPIDEV_MMCSD, true);
|
SPI_SELECT(spi, SPIDEV_MMCSD(0), true);
|
||||||
ret = mmcsd_waitready(slot);
|
ret = mmcsd_waitready(slot);
|
||||||
SPI_SELECT(spi, SPIDEV_MMCSD, false);
|
SPI_SELECT(spi, SPIDEV_MMCSD(0), false);
|
||||||
}
|
}
|
||||||
|
|
||||||
errout_with_sem:
|
errout_with_sem:
|
||||||
@ -1177,7 +1177,7 @@ static ssize_t mmcsd_read(FAR struct inode *inode, unsigned char *buffer,
|
|||||||
/* Select the slave */
|
/* Select the slave */
|
||||||
|
|
||||||
mmcsd_semtake(slot);
|
mmcsd_semtake(slot);
|
||||||
SPI_SELECT(spi, SPIDEV_MMCSD, true);
|
SPI_SELECT(spi, SPIDEV_MMCSD(0), true);
|
||||||
|
|
||||||
/* Single or multiple block read? */
|
/* 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 */
|
/* 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);
|
SPI_SEND(spi, 0xff);
|
||||||
mmcsd_semgive(slot);
|
mmcsd_semgive(slot);
|
||||||
|
|
||||||
@ -1244,7 +1244,7 @@ static ssize_t mmcsd_read(FAR struct inode *inode, unsigned char *buffer,
|
|||||||
return nsectors;
|
return nsectors;
|
||||||
|
|
||||||
errout_with_eio:
|
errout_with_eio:
|
||||||
SPI_SELECT(spi, SPIDEV_MMCSD, false);
|
SPI_SELECT(spi, SPIDEV_MMCSD(0), false);
|
||||||
mmcsd_semgive(slot);
|
mmcsd_semgive(slot);
|
||||||
return -EIO;
|
return -EIO;
|
||||||
}
|
}
|
||||||
@ -1341,7 +1341,7 @@ static ssize_t mmcsd_write(FAR struct inode *inode, const unsigned char *buffer,
|
|||||||
/* Select the slave */
|
/* Select the slave */
|
||||||
|
|
||||||
mmcsd_semtake(slot);
|
mmcsd_semtake(slot);
|
||||||
SPI_SELECT(spi, SPIDEV_MMCSD, true);
|
SPI_SELECT(spi, SPIDEV_MMCSD(0), true);
|
||||||
|
|
||||||
/* Single or multiple block transfer? */
|
/* 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 */
|
/* Wait until the card is no longer busy */
|
||||||
|
|
||||||
(void)mmcsd_waitready(slot);
|
(void)mmcsd_waitready(slot);
|
||||||
SPI_SELECT(spi, SPIDEV_MMCSD, false);
|
SPI_SELECT(spi, SPIDEV_MMCSD(0), false);
|
||||||
SPI_SEND(spi, 0xff);
|
SPI_SEND(spi, 0xff);
|
||||||
mmcsd_semgive(slot);
|
mmcsd_semgive(slot);
|
||||||
|
|
||||||
@ -1431,7 +1431,7 @@ static ssize_t mmcsd_write(FAR struct inode *inode, const unsigned char *buffer,
|
|||||||
return nsectors;
|
return nsectors;
|
||||||
|
|
||||||
errout_with_sem:
|
errout_with_sem:
|
||||||
SPI_SELECT(spi, SPIDEV_MMCSD, false);
|
SPI_SELECT(spi, SPIDEV_MMCSD(0), false);
|
||||||
mmcsd_semgive(slot);
|
mmcsd_semgive(slot);
|
||||||
return -EIO;
|
return -EIO;
|
||||||
}
|
}
|
||||||
@ -1482,9 +1482,9 @@ static int mmcsd_geometry(FAR struct inode *inode, struct geometry *geometry)
|
|||||||
/* Re-sample the CSD */
|
/* Re-sample the CSD */
|
||||||
|
|
||||||
mmcsd_semtake(slot);
|
mmcsd_semtake(slot);
|
||||||
SPI_SELECT(spi, SPIDEV_MMCSD, true);
|
SPI_SELECT(spi, SPIDEV_MMCSD(0), true);
|
||||||
ret = mmcsd_getcsd(slot, csd);
|
ret = mmcsd_getcsd(slot, csd);
|
||||||
SPI_SELECT(spi, SPIDEV_MMCSD, false);
|
SPI_SELECT(spi, SPIDEV_MMCSD(0), false);
|
||||||
|
|
||||||
if (ret < 0)
|
if (ret < 0)
|
||||||
{
|
{
|
||||||
@ -1564,7 +1564,7 @@ static int mmcsd_mediainitialize(FAR struct mmcsd_slot_s *slot)
|
|||||||
* interface
|
* 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");
|
fwarn("WARNING: No card present\n");
|
||||||
slot->state |= MMCSD_SLOTSTATUS_NODISK;
|
slot->state |= MMCSD_SLOTSTATUS_NODISK;
|
||||||
@ -1602,7 +1602,7 @@ static int mmcsd_mediainitialize(FAR struct mmcsd_slot_s *slot)
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
finfo("Send CMD0\n");
|
finfo("Send CMD0\n");
|
||||||
SPI_SELECT(spi, SPIDEV_MMCSD, true);
|
SPI_SELECT(spi, SPIDEV_MMCSD(0), true);
|
||||||
result = mmcsd_sendcmd(slot, &g_cmd0, 0);
|
result = mmcsd_sendcmd(slot, &g_cmd0, 0);
|
||||||
if (result == MMCSD_SPIR1_IDLESTATE)
|
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 */
|
/* 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 */
|
/* 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)
|
if (result != MMCSD_SPIR1_IDLESTATE)
|
||||||
{
|
{
|
||||||
ferr("ERROR: Send CMD0 failed: R1=%02x\n", result);
|
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);
|
mmcsd_semgive(slot);
|
||||||
return -EIO;
|
return -EIO;
|
||||||
}
|
}
|
||||||
@ -1749,7 +1749,7 @@ static int mmcsd_mediainitialize(FAR struct mmcsd_slot_s *slot)
|
|||||||
if (elapsed >= MMCSD_DELAY_1SEC)
|
if (elapsed >= MMCSD_DELAY_1SEC)
|
||||||
{
|
{
|
||||||
ferr("ERROR: Failed to exit IDLE state\n");
|
ferr("ERROR: Failed to exit IDLE state\n");
|
||||||
SPI_SELECT(spi, SPIDEV_MMCSD, false);
|
SPI_SELECT(spi, SPIDEV_MMCSD(0), false);
|
||||||
mmcsd_semgive(slot);
|
mmcsd_semgive(slot);
|
||||||
return -EIO;
|
return -EIO;
|
||||||
}
|
}
|
||||||
@ -1758,7 +1758,7 @@ static int mmcsd_mediainitialize(FAR struct mmcsd_slot_s *slot)
|
|||||||
if (slot->type == MMCSD_CARDTYPE_UNKNOWN)
|
if (slot->type == MMCSD_CARDTYPE_UNKNOWN)
|
||||||
{
|
{
|
||||||
ferr("ERROR: Failed to identify card\n");
|
ferr("ERROR: Failed to identify card\n");
|
||||||
SPI_SELECT(spi, SPIDEV_MMCSD, false);
|
SPI_SELECT(spi, SPIDEV_MMCSD(0), false);
|
||||||
mmcsd_semgive(slot);
|
mmcsd_semgive(slot);
|
||||||
return -EIO;
|
return -EIO;
|
||||||
}
|
}
|
||||||
@ -1770,7 +1770,7 @@ static int mmcsd_mediainitialize(FAR struct mmcsd_slot_s *slot)
|
|||||||
if (result != OK)
|
if (result != OK)
|
||||||
{
|
{
|
||||||
ferr("ERROR: mmcsd_getcsd(CMD9) failed: %d\n", result);
|
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);
|
mmcsd_semgive(slot);
|
||||||
return -EIO;
|
return -EIO;
|
||||||
}
|
}
|
||||||
@ -1814,7 +1814,7 @@ static int mmcsd_mediainitialize(FAR struct mmcsd_slot_s *slot)
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
slot->state &= ~MMCSD_SLOTSTATUS_NOTREADY;
|
slot->state &= ~MMCSD_SLOTSTATUS_NOTREADY;
|
||||||
SPI_SELECT(spi, SPIDEV_MMCSD, false);
|
SPI_SELECT(spi, SPIDEV_MMCSD(0), false);
|
||||||
return OK;
|
return OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1853,7 +1853,7 @@ static void mmcsd_mediachanged(void *arg)
|
|||||||
slot->state &= ~(MMCSD_SLOTSTATUS_NODISK | MMCSD_SLOTSTATUS_NOTREADY |
|
slot->state &= ~(MMCSD_SLOTSTATUS_NODISK | MMCSD_SLOTSTATUS_NOTREADY |
|
||||||
MMCSD_SLOTSTATUS_MEDIACHGD);
|
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 */
|
/* Media is not present */
|
||||||
|
|
||||||
|
@ -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
|
/* Allocate a state structure (we allocate the structure instead of using
|
||||||
* a fixed, static allocation so that we can handle multiple FLASH devices.
|
* a fixed, static allocation so that we can handle multiple FLASH devices.
|
||||||
* The current implementation would handle only one FLASH part per I2C
|
* 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.
|
* to be extended to handle multiple FLASH parts on the same I2C bus.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
@ -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. */
|
/* Lock the SPI bus, configure the bus, and select this FLASH part. */
|
||||||
|
|
||||||
at25_lock(priv->dev);
|
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 */
|
/* 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 */
|
/* 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);
|
at25_unlock(priv->dev);
|
||||||
|
|
||||||
finfo("manufacturer: %02x memory: %02x\n",
|
finfo("manufacturer: %02x memory: %02x\n",
|
||||||
@ -262,7 +262,7 @@ static void at25_waitwritecomplete(struct at25_dev_s *priv)
|
|||||||
{
|
{
|
||||||
/* Select this FLASH part */
|
/* 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 */
|
/* Send "Read Status Register (RDSR)" command */
|
||||||
|
|
||||||
@ -274,7 +274,7 @@ static void at25_waitwritecomplete(struct at25_dev_s *priv)
|
|||||||
|
|
||||||
/* Deselect the FLASH */
|
/* 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
|
/* 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
|
* 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)
|
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);
|
(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");
|
finfo("Enabled\n");
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -334,7 +334,7 @@ static inline void at25_sectorerase(struct at25_dev_s *priv, off_t sector)
|
|||||||
|
|
||||||
/* Select this FLASH part */
|
/* 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 */
|
/* 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 */
|
/* Deselect the FLASH */
|
||||||
|
|
||||||
SPI_SELECT(priv->dev, SPIDEV_FLASH, false);
|
SPI_SELECT(priv->dev, SPIDEV_FLASH(0), false);
|
||||||
finfo("Erased\n");
|
finfo("Erased\n");
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -377,7 +377,7 @@ static inline int at25_bulkerase(struct at25_dev_s *priv)
|
|||||||
|
|
||||||
/* Select this FLASH part */
|
/* 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 */
|
/* Send the "Bulk Erase (BE)" instruction */
|
||||||
|
|
||||||
@ -385,7 +385,7 @@ static inline int at25_bulkerase(struct at25_dev_s *priv)
|
|||||||
|
|
||||||
/* Deselect the FLASH */
|
/* Deselect the FLASH */
|
||||||
|
|
||||||
SPI_SELECT(priv->dev, SPIDEV_FLASH, false);
|
SPI_SELECT(priv->dev, SPIDEV_FLASH(0), false);
|
||||||
finfo("Return: OK\n");
|
finfo("Return: OK\n");
|
||||||
return OK;
|
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 */
|
/* Select this FLASH part */
|
||||||
|
|
||||||
SPI_SELECT(priv->dev, SPIDEV_FLASH, true);
|
SPI_SELECT(priv->dev, SPIDEV_FLASH(0), true);
|
||||||
|
|
||||||
/* Send "Page Program (PP)" command */
|
/* 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 */
|
/* Deselect the FLASH: Chip Select high */
|
||||||
|
|
||||||
SPI_SELECT(priv->dev, SPIDEV_FLASH, false);
|
SPI_SELECT(priv->dev, SPIDEV_FLASH(0), false);
|
||||||
finfo("Written\n");
|
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 */
|
/* Lock the SPI bus and select this FLASH part */
|
||||||
|
|
||||||
at25_lock(priv->dev);
|
at25_lock(priv->dev);
|
||||||
SPI_SELECT(priv->dev, SPIDEV_FLASH, true);
|
SPI_SELECT(priv->dev, SPIDEV_FLASH(0), true);
|
||||||
|
|
||||||
/* Send "Read from Memory " instruction */
|
/* 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 */
|
/* 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);
|
at25_unlock(priv->dev);
|
||||||
|
|
||||||
finfo("return nbytes: %d\n", (int)nbytes);
|
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
|
/* Allocate a state structure (we allocate the structure instead of using
|
||||||
* a fixed, static allocation so that we can handle multiple FLASH devices.
|
* a fixed, static allocation so that we can handle multiple FLASH devices.
|
||||||
* The current implementation would handle only one FLASH part per SPI
|
* 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.
|
* 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 */
|
/* Deselect the FLASH */
|
||||||
|
|
||||||
SPI_SELECT(dev, SPIDEV_FLASH, false);
|
SPI_SELECT(dev, SPIDEV_FLASH(0), false);
|
||||||
|
|
||||||
/* Identify the FLASH chip and get its capacity */
|
/* 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 */
|
/* Unprotect all sectors */
|
||||||
|
|
||||||
at25_writeenable(priv);
|
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_WRSR);
|
||||||
(void)SPI_SEND(priv->dev, AT25_SR_UNPROT);
|
(void)SPI_SEND(priv->dev, AT25_SR_UNPROT);
|
||||||
SPI_SELECT(priv->dev, SPIDEV_FLASH, false);
|
SPI_SELECT(priv->dev, SPIDEV_FLASH(0), false);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -312,9 +312,9 @@ static inline void at45db_unlock(FAR struct at45db_dev_s *priv)
|
|||||||
#ifdef CONFIG_AT45DB_PWRSAVE
|
#ifdef CONFIG_AT45DB_PWRSAVE
|
||||||
static void at45db_pwrdown(FAR struct at45db_dev_s *priv)
|
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_SEND(priv->spi, AT45DB_PWRDOWN);
|
||||||
SPI_SELECT(priv->spi, SPIDEV_FLASH, false);
|
SPI_SELECT(priv->spi, SPIDEV_FLASH(0), false);
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
@ -325,9 +325,9 @@ static void at45db_pwrdown(FAR struct at45db_dev_s *priv)
|
|||||||
#ifdef CONFIG_AT45DB_PWRSAVE
|
#ifdef CONFIG_AT45DB_PWRSAVE
|
||||||
static void at45db_resume(FAR struct at45db_dev_s *priv)
|
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_SEND(priv->spi, AT45DB_RESUME);
|
||||||
SPI_SELECT(priv->spi, SPIDEV_FLASH, false);
|
SPI_SELECT(priv->spi, SPIDEV_FLASH(0), false);
|
||||||
up_udelay(50);
|
up_udelay(50);
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
@ -347,7 +347,7 @@ static inline int at45db_rdid(FAR struct at45db_dev_s *priv)
|
|||||||
* locked the bus for exclusive access)
|
* 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
|
/* Send the " Manufacturer and Device ID Read" command and read the next three
|
||||||
* ID bytes from the FLASH.
|
* ID bytes from the FLASH.
|
||||||
@ -358,7 +358,7 @@ static inline int at45db_rdid(FAR struct at45db_dev_s *priv)
|
|||||||
|
|
||||||
/* Deselect the FLASH */
|
/* 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",
|
finfo("manufacturer: %02x devid1: %02x devid2: %02x\n",
|
||||||
devid[0], devid[1], devid[2]);
|
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;
|
uint8_t retval;
|
||||||
|
|
||||||
SPI_SELECT(priv->spi, SPIDEV_FLASH, true);
|
SPI_SELECT(priv->spi, SPIDEV_FLASH(0), true);
|
||||||
SPI_SEND(priv->spi, AT45DB_RDSR);
|
SPI_SEND(priv->spi, AT45DB_RDSR);
|
||||||
retval = SPI_SEND(priv->spi, 0xff);
|
retval = SPI_SEND(priv->spi, 0xff);
|
||||||
SPI_SELECT(priv->spi, SPIDEV_FLASH, false);
|
SPI_SELECT(priv->spi, SPIDEV_FLASH(0), false);
|
||||||
return retval;
|
return retval;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -503,9 +503,9 @@ static inline void at45db_pgerase(FAR struct at45db_dev_s *priv, off_t sector)
|
|||||||
|
|
||||||
/* Erase the page */
|
/* 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_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
|
/* Wait for any erase to complete if we are not trying to improve write
|
||||||
* performance. (see comments above).
|
* performance. (see comments above).
|
||||||
@ -545,9 +545,9 @@ static inline int at32db_chiperase(FAR struct at45db_dev_s *priv)
|
|||||||
* down...
|
* 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_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
|
/* Wait for any erase to complete if we are not trying to improve write
|
||||||
* performance. (see comments above).
|
* performance. (see comments above).
|
||||||
@ -589,10 +589,10 @@ static inline void at45db_pgwrite(FAR struct at45db_dev_s *priv,
|
|||||||
at45db_waitbusy(priv);
|
at45db_waitbusy(priv);
|
||||||
#endif
|
#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, wrcmd, 4);
|
||||||
SPI_SNDBLOCK(priv->spi, buffer, 1 << priv->pageshift);
|
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
|
/* Wait for any erase to complete if we are not trying to improve write
|
||||||
* performance. (see comments above).
|
* 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 */
|
/* 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_SNDBLOCK(priv->spi, rdcmd, 5);
|
||||||
SPI_RECVBLOCK(priv->spi, buffer, nbytes);
|
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_pwrdown(priv);
|
||||||
at45db_unlock(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,
|
/* 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
|
* static allocation so that we can handle multiple FLASH devices. The current
|
||||||
* implementation would handle only one FLASH part per SPI device (only because
|
* 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.
|
* 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 */
|
/* Deselect the FLASH */
|
||||||
|
|
||||||
SPI_SELECT(spi, SPIDEV_FLASH, false);
|
SPI_SELECT(spi, SPIDEV_FLASH(0), false);
|
||||||
|
|
||||||
/* Lock and configure the SPI bus. */
|
/* 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");
|
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_SNDBLOCK(priv->spi, g_binpgsize, BINPGSIZE_SIZE);
|
||||||
SPI_SELECT(priv->spi, SPIDEV_FLASH, false);
|
SPI_SELECT(priv->spi, SPIDEV_FLASH(0), false);
|
||||||
goto errout;
|
goto errout;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -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. */
|
/* Lock the SPI bus, configure the bus, and select this FLASH part. */
|
||||||
|
|
||||||
is25xp_lock(priv->dev);
|
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 */
|
/* 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 */
|
/* 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);
|
is25xp_unlock(priv->dev);
|
||||||
|
|
||||||
finfo("manufacturer: %02x memory: %02x capacity: %02x\n",
|
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 */
|
/* 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 */
|
/* Send "Read Status Register (RDSR)" command */
|
||||||
|
|
||||||
@ -342,7 +342,7 @@ static void is25xp_waitwritecomplete(struct is25xp_dev_s *priv)
|
|||||||
|
|
||||||
/* Deselect the FLASH */
|
/* Deselect the FLASH */
|
||||||
|
|
||||||
SPI_SELECT(priv->dev, SPIDEV_FLASH, false);
|
SPI_SELECT(priv->dev, SPIDEV_FLASH(0), false);
|
||||||
|
|
||||||
#else
|
#else
|
||||||
|
|
||||||
@ -352,7 +352,7 @@ static void is25xp_waitwritecomplete(struct is25xp_dev_s *priv)
|
|||||||
{
|
{
|
||||||
/* Select this FLASH part */
|
/* 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 */
|
/* Send "Read Status Register (RDSR)" command */
|
||||||
|
|
||||||
@ -364,7 +364,7 @@ static void is25xp_waitwritecomplete(struct is25xp_dev_s *priv)
|
|||||||
|
|
||||||
/* Deselect the FLASH */
|
/* 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
|
/* 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
|
* 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 */
|
/* Select this FLASH part */
|
||||||
|
|
||||||
SPI_SELECT(priv->dev, SPIDEV_FLASH, true);
|
SPI_SELECT(priv->dev, SPIDEV_FLASH(0), true);
|
||||||
|
|
||||||
/* Send "Write Enable (WREN)" command */
|
/* Send "Write Enable (WREN)" command */
|
||||||
|
|
||||||
@ -402,7 +402,7 @@ static void is25xp_writeenable(struct is25xp_dev_s *priv)
|
|||||||
|
|
||||||
/* Deselect the FLASH */
|
/* Deselect the FLASH */
|
||||||
|
|
||||||
SPI_SELECT(priv->dev, SPIDEV_FLASH, false);
|
SPI_SELECT(priv->dev, SPIDEV_FLASH(0), false);
|
||||||
finfo("Enabled\n");
|
finfo("Enabled\n");
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -418,14 +418,14 @@ static void is25xp_unprotect(struct is25xp_dev_s *priv)
|
|||||||
|
|
||||||
/* Send "Write status (WRSR)" */
|
/* 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);
|
SPI_SEND(priv->dev, IS25_WRSR);
|
||||||
|
|
||||||
/* Followed by the new status value */
|
/* Followed by the new status value */
|
||||||
|
|
||||||
SPI_SEND(priv->dev, 0);
|
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 */
|
/* 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
|
/* Send the "Sector Erase (SE)" or Sub-Sector Erase (SSE) instruction
|
||||||
* that was passed in as the erase type.
|
* 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 */
|
/* Deselect the FLASH */
|
||||||
|
|
||||||
SPI_SELECT(priv->dev, SPIDEV_FLASH, false);
|
SPI_SELECT(priv->dev, SPIDEV_FLASH(0), false);
|
||||||
finfo("Erased\n");
|
finfo("Erased\n");
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -500,7 +500,7 @@ static inline int is25xp_bulkerase(struct is25xp_dev_s *priv)
|
|||||||
|
|
||||||
/* Select this FLASH part */
|
/* 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 */
|
/* Send the "Chip Erase (CER)" instruction */
|
||||||
|
|
||||||
@ -508,7 +508,7 @@ static inline int is25xp_bulkerase(struct is25xp_dev_s *priv)
|
|||||||
|
|
||||||
/* Deselect the FLASH */
|
/* Deselect the FLASH */
|
||||||
|
|
||||||
SPI_SELECT(priv->dev, SPIDEV_FLASH, false);
|
SPI_SELECT(priv->dev, SPIDEV_FLASH(0), false);
|
||||||
is25xp_waitwritecomplete(priv);
|
is25xp_waitwritecomplete(priv);
|
||||||
|
|
||||||
finfo("Return: OK\n");
|
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 */
|
/* Select this FLASH part */
|
||||||
|
|
||||||
SPI_SELECT(priv->dev, SPIDEV_FLASH, true);
|
SPI_SELECT(priv->dev, SPIDEV_FLASH(0), true);
|
||||||
|
|
||||||
/* Send "Page Program (PP)" command */
|
/* 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 */
|
/* Deselect the FLASH: Chip Select high */
|
||||||
|
|
||||||
SPI_SELECT(priv->dev, SPIDEV_FLASH, false);
|
SPI_SELECT(priv->dev, SPIDEV_FLASH(0), false);
|
||||||
finfo("Written\n");
|
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 */
|
/* Select this FLASH part */
|
||||||
|
|
||||||
SPI_SELECT(priv->dev, SPIDEV_FLASH, true);
|
SPI_SELECT(priv->dev, SPIDEV_FLASH(0), true);
|
||||||
|
|
||||||
/* Send "Page Program (PP)" command */
|
/* 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 */
|
/* Deselect the FLASH: Chip Select high */
|
||||||
|
|
||||||
SPI_SELECT(priv->dev, SPIDEV_FLASH, false);
|
SPI_SELECT(priv->dev, SPIDEV_FLASH(0), false);
|
||||||
finfo("Written\n");
|
finfo("Written\n");
|
||||||
}
|
}
|
||||||
#endif
|
#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 */
|
/* Lock the SPI bus and select this FLASH part */
|
||||||
|
|
||||||
is25xp_lock(priv->dev);
|
is25xp_lock(priv->dev);
|
||||||
SPI_SELECT(priv->dev, SPIDEV_FLASH, true);
|
SPI_SELECT(priv->dev, SPIDEV_FLASH(0), true);
|
||||||
|
|
||||||
/* Send "Read from Memory " instruction */
|
/* 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 */
|
/* 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);
|
is25xp_unlock(priv->dev);
|
||||||
finfo("return nbytes: %d\n", (int)nbytes);
|
finfo("return nbytes: %d\n", (int)nbytes);
|
||||||
return 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
|
/* Allocate a state structure (we allocate the structure instead of using
|
||||||
* a fixed, static allocation so that we can handle multiple FLASH devices.
|
* a fixed, static allocation so that we can handle multiple FLASH devices.
|
||||||
* The current implementation would handle only one FLASH part per SPI
|
* 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.
|
* 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 */
|
/* Deselect the FLASH */
|
||||||
|
|
||||||
SPI_SELECT(dev, SPIDEV_FLASH, false);
|
SPI_SELECT(dev, SPIDEV_FLASH(0), false);
|
||||||
|
|
||||||
/* Identify the FLASH chip and get its capacity */
|
/* Identify the FLASH chip and get its capacity */
|
||||||
|
|
||||||
|
@ -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. */
|
/* Lock the SPI bus, configure the bus, and select this FLASH part. */
|
||||||
|
|
||||||
m25p_lock(priv->dev);
|
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 */
|
/* 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 */
|
/* 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);
|
m25p_unlock(priv->dev);
|
||||||
|
|
||||||
finfo("manufacturer: %02x memory: %02x capacity: %02x\n",
|
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 */
|
/* 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 */
|
/* Send "Read Status Register (RDSR)" command */
|
||||||
|
|
||||||
@ -444,7 +444,7 @@ static void m25p_waitwritecomplete(struct m25p_dev_s *priv)
|
|||||||
|
|
||||||
/* Deselect the FLASH */
|
/* 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
|
/* 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
|
* 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 */
|
/* Select this FLASH part */
|
||||||
|
|
||||||
SPI_SELECT(priv->dev, SPIDEV_FLASH, true);
|
SPI_SELECT(priv->dev, SPIDEV_FLASH(0), true);
|
||||||
|
|
||||||
/* Send "Write Enable (WREN)" command */
|
/* Send "Write Enable (WREN)" command */
|
||||||
|
|
||||||
@ -479,7 +479,7 @@ static void m25p_writeenable(struct m25p_dev_s *priv)
|
|||||||
|
|
||||||
/* Deselect the FLASH */
|
/* Deselect the FLASH */
|
||||||
|
|
||||||
SPI_SELECT(priv->dev, SPIDEV_FLASH, false);
|
SPI_SELECT(priv->dev, SPIDEV_FLASH(0), false);
|
||||||
finfo("Enabled\n");
|
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 */
|
/* 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
|
/* Send the "Sector Erase (SE)" or Sub-Sector Erase (SSE) instruction
|
||||||
* that was passed in as the erase type.
|
* 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 */
|
/* Deselect the FLASH */
|
||||||
|
|
||||||
SPI_SELECT(priv->dev, SPIDEV_FLASH, false);
|
SPI_SELECT(priv->dev, SPIDEV_FLASH(0), false);
|
||||||
finfo("Erased\n");
|
finfo("Erased\n");
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -563,7 +563,7 @@ static inline int m25p_bulkerase(struct m25p_dev_s *priv)
|
|||||||
|
|
||||||
/* Select this FLASH part */
|
/* 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 */
|
/* Send the "Bulk Erase (BE)" instruction */
|
||||||
|
|
||||||
@ -571,7 +571,7 @@ static inline int m25p_bulkerase(struct m25p_dev_s *priv)
|
|||||||
|
|
||||||
/* Deselect the FLASH */
|
/* Deselect the FLASH */
|
||||||
|
|
||||||
SPI_SELECT(priv->dev, SPIDEV_FLASH, false);
|
SPI_SELECT(priv->dev, SPIDEV_FLASH(0), false);
|
||||||
finfo("Return: OK\n");
|
finfo("Return: OK\n");
|
||||||
return OK;
|
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 */
|
/* Select this FLASH part */
|
||||||
|
|
||||||
SPI_SELECT(priv->dev, SPIDEV_FLASH, true);
|
SPI_SELECT(priv->dev, SPIDEV_FLASH(0), true);
|
||||||
|
|
||||||
/* Send "Page Program (PP)" command */
|
/* 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 */
|
/* Deselect the FLASH: Chip Select high */
|
||||||
|
|
||||||
SPI_SELECT(priv->dev, SPIDEV_FLASH, false);
|
SPI_SELECT(priv->dev, SPIDEV_FLASH(0), false);
|
||||||
finfo("Written\n");
|
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 */
|
/* Select this FLASH part */
|
||||||
|
|
||||||
SPI_SELECT(priv->dev, SPIDEV_FLASH, true);
|
SPI_SELECT(priv->dev, SPIDEV_FLASH(0), true);
|
||||||
|
|
||||||
/* Send "Page Program (PP)" command */
|
/* 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 */
|
/* Deselect the FLASH: Chip Select high */
|
||||||
|
|
||||||
SPI_SELECT(priv->dev, SPIDEV_FLASH, false);
|
SPI_SELECT(priv->dev, SPIDEV_FLASH(0), false);
|
||||||
finfo("Written\n");
|
finfo("Written\n");
|
||||||
}
|
}
|
||||||
#endif
|
#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 */
|
/* Lock the SPI bus and select this FLASH part */
|
||||||
|
|
||||||
m25p_lock(priv->dev);
|
m25p_lock(priv->dev);
|
||||||
SPI_SELECT(priv->dev, SPIDEV_FLASH, true);
|
SPI_SELECT(priv->dev, SPIDEV_FLASH(0), true);
|
||||||
|
|
||||||
/* Send "Read from Memory " instruction */
|
/* 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 */
|
/* 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);
|
m25p_unlock(priv->dev);
|
||||||
finfo("return nbytes: %d\n", (int)nbytes);
|
finfo("return nbytes: %d\n", (int)nbytes);
|
||||||
return 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
|
/* Allocate a state structure (we allocate the structure instead of using
|
||||||
* a fixed, static allocation so that we can handle multiple FLASH devices.
|
* a fixed, static allocation so that we can handle multiple FLASH devices.
|
||||||
* The current implementation would handle only one FLASH part per SPI
|
* 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.
|
* 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 */
|
/* Deselect the FLASH */
|
||||||
|
|
||||||
SPI_SELECT(dev, SPIDEV_FLASH, false);
|
SPI_SELECT(dev, SPIDEV_FLASH(0), false);
|
||||||
|
|
||||||
/* Identify the FLASH chip and get its capacity */
|
/* Identify the FLASH chip and get its capacity */
|
||||||
|
|
||||||
|
@ -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
|
/* Allocate a state structure (we allocate the structure instead of using
|
||||||
* a fixed, static allocation so that we can handle multiple FLASH devices.
|
* a fixed, static allocation so that we can handle multiple FLASH devices.
|
||||||
* The current implementation would handle only one FLASH part per SPI
|
* 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.
|
* to be extended to handle multiple FLASH parts on the same SPI bus.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
@ -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. */
|
/* Lock the SPI bus, configure the bus, and select this FLASH part. */
|
||||||
|
|
||||||
mx25l_lock(priv->dev);
|
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 */
|
/* 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 */
|
/* 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);
|
mx25l_unlock(priv->dev);
|
||||||
|
|
||||||
mxlinfo("manufacturer: %02x memory: %02x capacity: %02x\n",
|
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 */
|
/* 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 */
|
/* Send "Read Status Register (RDSR)" command */
|
||||||
|
|
||||||
@ -386,7 +386,7 @@ static void mx25l_waitwritecomplete(FAR struct mx25l_dev_s *priv)
|
|||||||
|
|
||||||
/* Deselect the FLASH */
|
/* 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
|
/* 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
|
* 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 */
|
/* Select this FLASH part */
|
||||||
|
|
||||||
SPI_SELECT(priv->dev, SPIDEV_FLASH, true);
|
SPI_SELECT(priv->dev, SPIDEV_FLASH(0), true);
|
||||||
|
|
||||||
/* Send "Write Enable (WREN)" command */
|
/* Send "Write Enable (WREN)" command */
|
||||||
|
|
||||||
@ -421,7 +421,7 @@ static void mx25l_writeenable(FAR struct mx25l_dev_s *priv)
|
|||||||
|
|
||||||
/* Deselect the FLASH */
|
/* Deselect the FLASH */
|
||||||
|
|
||||||
SPI_SELECT(priv->dev, SPIDEV_FLASH, false);
|
SPI_SELECT(priv->dev, SPIDEV_FLASH(0), false);
|
||||||
|
|
||||||
mxlinfo("Enabled\n");
|
mxlinfo("Enabled\n");
|
||||||
}
|
}
|
||||||
@ -434,7 +434,7 @@ static void mx25l_writedisable(FAR struct mx25l_dev_s *priv)
|
|||||||
{
|
{
|
||||||
/* Select this FLASH part */
|
/* Select this FLASH part */
|
||||||
|
|
||||||
SPI_SELECT(priv->dev, SPIDEV_FLASH, true);
|
SPI_SELECT(priv->dev, SPIDEV_FLASH(0), true);
|
||||||
|
|
||||||
/* Send "Write Disable (WRDI)" command */
|
/* Send "Write Disable (WRDI)" command */
|
||||||
|
|
||||||
@ -442,7 +442,7 @@ static void mx25l_writedisable(FAR struct mx25l_dev_s *priv)
|
|||||||
|
|
||||||
/* Deselect the FLASH */
|
/* Deselect the FLASH */
|
||||||
|
|
||||||
SPI_SELECT(priv->dev, SPIDEV_FLASH, false);
|
SPI_SELECT(priv->dev, SPIDEV_FLASH(0), false);
|
||||||
|
|
||||||
mxlinfo("Disabled\n");
|
mxlinfo("Disabled\n");
|
||||||
}
|
}
|
||||||
@ -465,7 +465,7 @@ static void mx25l_sectorerase(FAR struct mx25l_dev_s *priv, off_t sector)
|
|||||||
|
|
||||||
/* Select this FLASH part */
|
/* 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
|
/* Send the "Sector Erase (SE)" or "Block Erase (BE)" instruction
|
||||||
* that was passed in as the erase type.
|
* 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 */
|
/* Deselect the FLASH */
|
||||||
|
|
||||||
SPI_SELECT(priv->dev, SPIDEV_FLASH, false);
|
SPI_SELECT(priv->dev, SPIDEV_FLASH(0), false);
|
||||||
|
|
||||||
mx25l_waitwritecomplete(priv);
|
mx25l_waitwritecomplete(priv);
|
||||||
|
|
||||||
@ -505,7 +505,7 @@ static inline int mx25l_chiperase(FAR struct mx25l_dev_s *priv)
|
|||||||
|
|
||||||
/* Select this FLASH part */
|
/* 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 */
|
/* Send the "Chip Erase (CE)" instruction */
|
||||||
|
|
||||||
@ -513,7 +513,7 @@ static inline int mx25l_chiperase(FAR struct mx25l_dev_s *priv)
|
|||||||
|
|
||||||
/* Deselect the FLASH */
|
/* Deselect the FLASH */
|
||||||
|
|
||||||
SPI_SELECT(priv->dev, SPIDEV_FLASH, false);
|
SPI_SELECT(priv->dev, SPIDEV_FLASH(0), false);
|
||||||
|
|
||||||
mx25l_waitwritecomplete(priv);
|
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 */
|
/* Select this FLASH part */
|
||||||
|
|
||||||
SPI_SELECT(priv->dev, SPIDEV_FLASH, true);
|
SPI_SELECT(priv->dev, SPIDEV_FLASH(0), true);
|
||||||
|
|
||||||
/* Send "Read from Memory " instruction */
|
/* 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 */
|
/* 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 */
|
/* 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 */
|
/* 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 */
|
/* 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. */
|
/* 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
|
/* Allocate a state structure (we allocate the structure instead of using
|
||||||
* a fixed, static allocation so that we can handle multiple FLASH devices.
|
* a fixed, static allocation so that we can handle multiple FLASH devices.
|
||||||
* The current implementation would handle only one FLASH part per SPI
|
* 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.
|
* 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 */
|
/* Deselect the FLASH */
|
||||||
|
|
||||||
SPI_SELECT(dev, SPIDEV_FLASH, false);
|
SPI_SELECT(dev, SPIDEV_FLASH(0), false);
|
||||||
|
|
||||||
/* Identify the FLASH chip and get its capacity */
|
/* Identify the FLASH chip and get its capacity */
|
||||||
|
|
||||||
|
@ -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
|
/* Allocate a state structure (we allocate the structure instead of using
|
||||||
* a fixed, static allocation so that we can handle multiple FLASH devices.
|
* a fixed, static allocation so that we can handle multiple FLASH devices.
|
||||||
* The current implementation would handle only one FLASH part per QuadSPI
|
* 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.
|
* to be extended to handle multiple FLASH parts on the same QuadSPI bus.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
@ -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. */
|
/* Lock the SPI bus, configure the bus, and select this FLASH part. */
|
||||||
|
|
||||||
ramtron_lock(priv);
|
ramtron_lock(priv);
|
||||||
SPI_SELECT(priv->dev, SPIDEV_FLASH, true);
|
SPI_SELECT(priv->dev, SPIDEV_FLASH(0), true);
|
||||||
|
|
||||||
/* Send the "Read ID (RDID)" command */
|
/* 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 */
|
/* 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);
|
ramtron_unlock(priv->dev);
|
||||||
|
|
||||||
/* Select part from the part list */
|
/* Select part from the part list */
|
||||||
@ -452,7 +452,7 @@ static int ramtron_waitwritecomplete(struct ramtron_dev_s *priv)
|
|||||||
|
|
||||||
/* Select this FLASH part */
|
/* 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 */
|
/* Send "Read Status Register (RDSR)" command */
|
||||||
|
|
||||||
@ -475,7 +475,7 @@ static int ramtron_waitwritecomplete(struct ramtron_dev_s *priv)
|
|||||||
|
|
||||||
/* Deselect the FLASH */
|
/* Deselect the FLASH */
|
||||||
|
|
||||||
SPI_SELECT(priv->dev, SPIDEV_FLASH, false);
|
SPI_SELECT(priv->dev, SPIDEV_FLASH(0), false);
|
||||||
|
|
||||||
if (retries > 0)
|
if (retries > 0)
|
||||||
{
|
{
|
||||||
@ -499,7 +499,7 @@ static void ramtron_writeenable(struct ramtron_dev_s *priv)
|
|||||||
{
|
{
|
||||||
/* Select this FLASH part */
|
/* Select this FLASH part */
|
||||||
|
|
||||||
SPI_SELECT(priv->dev, SPIDEV_FLASH, true);
|
SPI_SELECT(priv->dev, SPIDEV_FLASH(0), true);
|
||||||
|
|
||||||
/* Send "Write Enable (WREN)" command */
|
/* Send "Write Enable (WREN)" command */
|
||||||
|
|
||||||
@ -507,7 +507,7 @@ static void ramtron_writeenable(struct ramtron_dev_s *priv)
|
|||||||
|
|
||||||
/* Deselect the FLASH */
|
/* Deselect the FLASH */
|
||||||
|
|
||||||
SPI_SELECT(priv->dev, SPIDEV_FLASH, false);
|
SPI_SELECT(priv->dev, SPIDEV_FLASH(0), false);
|
||||||
finfo("Enabled\n");
|
finfo("Enabled\n");
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -555,7 +555,7 @@ static inline int ramtron_pagewrite(struct ramtron_dev_s *priv, FAR const uint8_
|
|||||||
|
|
||||||
/* Select this FLASH part */
|
/* Select this FLASH part */
|
||||||
|
|
||||||
SPI_SELECT(priv->dev, SPIDEV_FLASH, true);
|
SPI_SELECT(priv->dev, SPIDEV_FLASH(0), true);
|
||||||
|
|
||||||
/* Send "Page Program (PP)" command */
|
/* 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 */
|
/* Deselect the FLASH: Chip Select high */
|
||||||
|
|
||||||
SPI_SELECT(priv->dev, SPIDEV_FLASH, false);
|
SPI_SELECT(priv->dev, SPIDEV_FLASH(0), false);
|
||||||
finfo("Written\n");
|
finfo("Written\n");
|
||||||
|
|
||||||
#ifdef CONFIG_RAMTRON_WRITEWAIT
|
#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 */
|
/* Lock the SPI bus and select this FLASH part */
|
||||||
|
|
||||||
ramtron_lock(priv);
|
ramtron_lock(priv);
|
||||||
SPI_SELECT(priv->dev, SPIDEV_FLASH, true);
|
SPI_SELECT(priv->dev, SPIDEV_FLASH(0), true);
|
||||||
|
|
||||||
/* Send "Read from Memory " instruction */
|
/* 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 */
|
/* 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);
|
ramtron_unlock(priv->dev);
|
||||||
|
|
||||||
finfo("return nbytes: %d\n", (int)nbytes);
|
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
|
/* Allocate a state structure (we allocate the structure instead of using
|
||||||
* a fixed, static allocation so that we can handle multiple FLASH devices.
|
* a fixed, static allocation so that we can handle multiple FLASH devices.
|
||||||
* The current implementation would handle only one FLASH part per SPI
|
* 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.
|
* 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 */
|
/* Deselect the FLASH */
|
||||||
|
|
||||||
SPI_SELECT(dev, SPIDEV_FLASH, false);
|
SPI_SELECT(dev, SPIDEV_FLASH(0), false);
|
||||||
|
|
||||||
/* Identify the FLASH chip and get its capacity */
|
/* Identify the FLASH chip and get its capacity */
|
||||||
|
|
||||||
|
@ -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
|
/* Allocate a state structure (we allocate the structure instead of using
|
||||||
* a fixed, static allocation so that we can handle multiple FLASH devices.
|
* a fixed, static allocation so that we can handle multiple FLASH devices.
|
||||||
* The current implementation would handle only one FLASH part per QuadSPI
|
* 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.
|
* to be extended to handle multiple FLASH parts on the same QuadSPI bus.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
@ -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
|
/* Allocate a state structure (we allocate the structure instead of using
|
||||||
* a fixed, static allocation so that we can handle multiple FLASH devices.
|
* a fixed, static allocation so that we can handle multiple FLASH devices.
|
||||||
* The current implementation would handle only one FLASH part per SPI
|
* 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.
|
* to be extended to handle multiple FLASH parts on the same SPI bus.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
@ -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. */
|
/* Lock the SPI bus, configure the bus, and select this FLASH part. */
|
||||||
|
|
||||||
sst25_lock(priv->dev);
|
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 */
|
/* 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 */
|
/* 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);
|
sst25_unlock(priv->dev);
|
||||||
|
|
||||||
finfo("manufacturer: %02x memory: %02x capacity: %02x\n",
|
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)" */
|
/* 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);
|
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_SEND(priv->dev, 0);
|
||||||
|
|
||||||
SPI_SELECT(priv->dev, SPIDEV_FLASH, false);
|
SPI_SELECT(priv->dev, SPIDEV_FLASH(0), false);
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
@ -402,7 +402,7 @@ static uint8_t sst25_waitwritecomplete(struct sst25_dev_s *priv)
|
|||||||
{
|
{
|
||||||
/* Select this FLASH part */
|
/* 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 */
|
/* Send "Read Status Register (RDSR)" command */
|
||||||
|
|
||||||
@ -414,7 +414,7 @@ static uint8_t sst25_waitwritecomplete(struct sst25_dev_s *priv)
|
|||||||
|
|
||||||
/* Deselect the FLASH */
|
/* 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
|
/* 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
|
* 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 */
|
/* Select this FLASH part */
|
||||||
|
|
||||||
SPI_SELECT(priv->dev, SPIDEV_FLASH, true);
|
SPI_SELECT(priv->dev, SPIDEV_FLASH(0), true);
|
||||||
|
|
||||||
/* Send command */
|
/* Send command */
|
||||||
|
|
||||||
@ -451,7 +451,7 @@ static inline void sst25_cmd(struct sst25_dev_s *priv, uint8_t cmd)
|
|||||||
|
|
||||||
/* Deselect the FLASH */
|
/* 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 */
|
/* 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 */
|
/* 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 */
|
/* 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 */
|
/* Select this FLASH part */
|
||||||
|
|
||||||
SPI_SELECT(priv->dev, SPIDEV_FLASH, true);
|
SPI_SELECT(priv->dev, SPIDEV_FLASH(0), true);
|
||||||
|
|
||||||
/* Send "Read from Memory " instruction */
|
/* 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 */
|
/* 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 */
|
/* Select this FLASH part */
|
||||||
|
|
||||||
SPI_SELECT(priv->dev, SPIDEV_FLASH, true);
|
SPI_SELECT(priv->dev, SPIDEV_FLASH(0), true);
|
||||||
|
|
||||||
/* Send "Byte Program (BP)" command */
|
/* 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 */
|
/* 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 */
|
/* 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 */
|
/* 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 */
|
/* 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 */
|
/* 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. */
|
/* 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 */
|
/* 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 */
|
/* 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 */
|
/* 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. */
|
/* 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
|
/* Allocate a state structure (we allocate the structure instead of using
|
||||||
* a fixed, static allocation so that we can handle multiple FLASH devices.
|
* a fixed, static allocation so that we can handle multiple FLASH devices.
|
||||||
* The current implementation would handle only one FLASH part per SPI
|
* 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.
|
* 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 */
|
/* Deselect the FLASH */
|
||||||
|
|
||||||
SPI_SELECT(dev, SPIDEV_FLASH, false);
|
SPI_SELECT(dev, SPIDEV_FLASH(0), false);
|
||||||
|
|
||||||
/* Identify the FLASH chip and get its capacity */
|
/* Identify the FLASH chip and get its capacity */
|
||||||
|
|
||||||
|
@ -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. */
|
/* Lock the SPI bus, configure the bus, and select this FLASH part. */
|
||||||
|
|
||||||
sst25xx_lock(priv->dev);
|
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 */
|
/* Send the "Read ID (RDID)" command and read the first three ID bytes */
|
||||||
|
|
||||||
(void)SPI_SEND(priv->dev, SST25_RDID);
|
(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);
|
manufacturer = SPI_SEND(priv->dev, SST25_DUMMY);
|
||||||
memory = SPI_SEND(priv->dev, SST25_DUMMY);
|
memory = SPI_SEND(priv->dev, SST25_DUMMY);
|
||||||
capacity = SPI_SEND(priv->dev, SST25_DUMMY);
|
capacity = SPI_SEND(priv->dev, SST25_DUMMY);
|
||||||
|
|
||||||
/* Deselect the FLASH and unlock the bus */
|
/* 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);
|
sst25xx_unlock(priv->dev);
|
||||||
|
|
||||||
finfo("manufacturer: %02x memory: %02x capacity: %02x\n",
|
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 */
|
/* 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 */
|
/* Send "Read Status Register (RDSR)" command */
|
||||||
|
|
||||||
@ -338,7 +338,7 @@ static void sst25xx_waitwritecomplete(struct sst25xx_dev_s *priv)
|
|||||||
|
|
||||||
/* Deselect the FLASH */
|
/* 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
|
/* 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
|
* 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 */
|
/* Select this FLASH part */
|
||||||
|
|
||||||
SPI_SELECT(priv->dev, SPIDEV_FLASH, true);
|
SPI_SELECT(priv->dev, SPIDEV_FLASH(0), true);
|
||||||
|
|
||||||
/* Send "Write Enable (WREN)" command */
|
/* Send "Write Enable (WREN)" command */
|
||||||
|
|
||||||
@ -375,7 +375,7 @@ static void sst25xx_writeenable(struct sst25xx_dev_s *priv)
|
|||||||
|
|
||||||
/* Deselect the FLASH */
|
/* Deselect the FLASH */
|
||||||
|
|
||||||
SPI_SELECT(priv->dev, SPIDEV_FLASH, false);
|
SPI_SELECT(priv->dev, SPIDEV_FLASH(0), false);
|
||||||
finfo("Enabled\n");
|
finfo("Enabled\n");
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -387,23 +387,23 @@ static void sst25xx_unprotect(struct sst25xx_dev_s *priv)
|
|||||||
{
|
{
|
||||||
/* Send "Write enable status (EWSR)" */
|
/* 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);
|
(void)SPI_SEND(priv->dev, SST25_EWSR);
|
||||||
|
|
||||||
/* Deselect the FLASH */
|
/* Deselect the FLASH */
|
||||||
|
|
||||||
SPI_SELECT(priv->dev, SPIDEV_FLASH, false);
|
SPI_SELECT(priv->dev, SPIDEV_FLASH(0), false);
|
||||||
|
|
||||||
/* Send "Write status (WRSR)" */
|
/* 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);
|
SPI_SEND(priv->dev, SST25_WRSR);
|
||||||
|
|
||||||
/* Followed by the new status value */
|
/* Followed by the new status value */
|
||||||
|
|
||||||
SPI_SEND(priv->dev, 0);
|
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 */
|
/* 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
|
/* Send the "Sector Erase (SE)" or Sub-Sector Erase (SSE) instruction
|
||||||
* that was passed in as the erase type.
|
* 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 */
|
/* Deselect the FLASH */
|
||||||
|
|
||||||
SPI_SELECT(priv->dev, SPIDEV_FLASH, false);
|
SPI_SELECT(priv->dev, SPIDEV_FLASH(0), false);
|
||||||
finfo("Erased\n");
|
finfo("Erased\n");
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -478,7 +478,7 @@ static inline int sst25xx_bulkerase(struct sst25xx_dev_s *priv)
|
|||||||
|
|
||||||
/* Select this FLASH part */
|
/* 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 */
|
/* Send the "Bulk Erase (BE)" instruction */
|
||||||
|
|
||||||
@ -486,7 +486,7 @@ static inline int sst25xx_bulkerase(struct sst25xx_dev_s *priv)
|
|||||||
|
|
||||||
/* Deselect the FLASH */
|
/* Deselect the FLASH */
|
||||||
|
|
||||||
SPI_SELECT(priv->dev, SPIDEV_FLASH, false);
|
SPI_SELECT(priv->dev, SPIDEV_FLASH(0), false);
|
||||||
sst25xx_waitwritecomplete(priv);
|
sst25xx_waitwritecomplete(priv);
|
||||||
|
|
||||||
finfo("Return: OK\n");
|
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 */
|
/* Select this FLASH part */
|
||||||
|
|
||||||
SPI_SELECT(priv->dev, SPIDEV_FLASH, true);
|
SPI_SELECT(priv->dev, SPIDEV_FLASH(0), true);
|
||||||
|
|
||||||
/* Send "Page Program (PP)" command */
|
/* 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 */
|
/* Deselect the FLASH: Chip Select high */
|
||||||
|
|
||||||
SPI_SELECT(priv->dev, SPIDEV_FLASH, false);
|
SPI_SELECT(priv->dev, SPIDEV_FLASH(0), false);
|
||||||
finfo("Written\n");
|
finfo("Written\n");
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -565,7 +565,7 @@ static inline void sst25xx_bytewrite(struct sst25xx_dev_s *priv, FAR const uint8
|
|||||||
|
|
||||||
/* Select this FLASH part */
|
/* Select this FLASH part */
|
||||||
|
|
||||||
SPI_SELECT(priv->dev, SPIDEV_FLASH, true);
|
SPI_SELECT(priv->dev, SPIDEV_FLASH(0), true);
|
||||||
|
|
||||||
/* Send "Page Program (PP)" command */
|
/* 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 */
|
/* Deselect the FLASH: Chip Select high */
|
||||||
|
|
||||||
SPI_SELECT(priv->dev, SPIDEV_FLASH, false);
|
SPI_SELECT(priv->dev, SPIDEV_FLASH(0), false);
|
||||||
finfo("Written\n");
|
finfo("Written\n");
|
||||||
}
|
}
|
||||||
#endif
|
#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 */
|
/* Lock the SPI bus and select this FLASH part */
|
||||||
|
|
||||||
sst25xx_lock(priv->dev);
|
sst25xx_lock(priv->dev);
|
||||||
SPI_SELECT(priv->dev, SPIDEV_FLASH, true);
|
SPI_SELECT(priv->dev, SPIDEV_FLASH(0), true);
|
||||||
|
|
||||||
/* Send "Read from Memory " instruction */
|
/* 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 */
|
/* 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);
|
sst25xx_unlock(priv->dev);
|
||||||
finfo("return nbytes: %d\n", (int)nbytes);
|
finfo("return nbytes: %d\n", (int)nbytes);
|
||||||
return 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
|
/* Allocate a state structure (we allocate the structure instead of using
|
||||||
* a fixed, static allocation so that we can handle multiple FLASH devices.
|
* a fixed, static allocation so that we can handle multiple FLASH devices.
|
||||||
* The current implementation would handle only one FLASH part per SPI
|
* 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.
|
* 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 */
|
/* Deselect the FLASH */
|
||||||
|
|
||||||
SPI_SELECT(dev, SPIDEV_FLASH, false);
|
SPI_SELECT(dev, SPIDEV_FLASH(0), false);
|
||||||
|
|
||||||
/* Identify the FLASH chip and get its capacity */
|
/* Identify the FLASH chip and get its capacity */
|
||||||
|
|
||||||
|
@ -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. */
|
/* Lock the SPI bus, configure the bus, and select this FLASH part. */
|
||||||
|
|
||||||
sst26_lock(priv->dev);
|
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 */
|
/* 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 */
|
/* 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);
|
sst26_unlock(priv->dev);
|
||||||
|
|
||||||
sstinfo("manufacturer: %02x memory: %02x capacity: %02x\n",
|
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 */
|
/* 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 */
|
/* Send "Read Status Register (RDSR)" command */
|
||||||
|
|
||||||
@ -397,7 +397,7 @@ static void sst26_waitwritecomplete(struct sst26_dev_s *priv)
|
|||||||
|
|
||||||
/* Deselect the FLASH */
|
/* 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
|
/* 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
|
* 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 */
|
/* Select this FLASH part */
|
||||||
|
|
||||||
SPI_SELECT(priv->dev, SPIDEV_FLASH, true);
|
SPI_SELECT(priv->dev, SPIDEV_FLASH(0), true);
|
||||||
|
|
||||||
/* Send "Global Unlock (ULBPR)" command */
|
/* Send "Global Unlock (ULBPR)" command */
|
||||||
|
|
||||||
@ -434,7 +434,7 @@ static void sst26_globalunlock(struct sst26_dev_s *priv)
|
|||||||
|
|
||||||
/* Deselect the FLASH */
|
/* Deselect the FLASH */
|
||||||
|
|
||||||
SPI_SELECT(priv->dev, SPIDEV_FLASH, false);
|
SPI_SELECT(priv->dev, SPIDEV_FLASH(0), false);
|
||||||
|
|
||||||
sstinfo("Device unlocked.\n");
|
sstinfo("Device unlocked.\n");
|
||||||
}
|
}
|
||||||
@ -447,7 +447,7 @@ static void sst26_writeenable(struct sst26_dev_s *priv)
|
|||||||
{
|
{
|
||||||
/* Select this FLASH part */
|
/* Select this FLASH part */
|
||||||
|
|
||||||
SPI_SELECT(priv->dev, SPIDEV_FLASH, true);
|
SPI_SELECT(priv->dev, SPIDEV_FLASH(0), true);
|
||||||
|
|
||||||
/* Send "Write Enable (WREN)" command */
|
/* Send "Write Enable (WREN)" command */
|
||||||
|
|
||||||
@ -455,7 +455,7 @@ static void sst26_writeenable(struct sst26_dev_s *priv)
|
|||||||
|
|
||||||
/* Deselect the FLASH */
|
/* Deselect the FLASH */
|
||||||
|
|
||||||
SPI_SELECT(priv->dev, SPIDEV_FLASH, false);
|
SPI_SELECT(priv->dev, SPIDEV_FLASH(0), false);
|
||||||
|
|
||||||
sstinfo("Enabled\n");
|
sstinfo("Enabled\n");
|
||||||
}
|
}
|
||||||
@ -468,7 +468,7 @@ static void sst26_writedisable(struct sst26_dev_s *priv)
|
|||||||
{
|
{
|
||||||
/* Select this FLASH part */
|
/* Select this FLASH part */
|
||||||
|
|
||||||
SPI_SELECT(priv->dev, SPIDEV_FLASH, true);
|
SPI_SELECT(priv->dev, SPIDEV_FLASH(0), true);
|
||||||
|
|
||||||
/* Send "Write Disable (WRDI)" command */
|
/* Send "Write Disable (WRDI)" command */
|
||||||
|
|
||||||
@ -476,7 +476,7 @@ static void sst26_writedisable(struct sst26_dev_s *priv)
|
|||||||
|
|
||||||
/* Deselect the FLASH */
|
/* Deselect the FLASH */
|
||||||
|
|
||||||
SPI_SELECT(priv->dev, SPIDEV_FLASH, false);
|
SPI_SELECT(priv->dev, SPIDEV_FLASH(0), false);
|
||||||
|
|
||||||
sstinfo("Disabled\n");
|
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 */
|
/* 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
|
/* Send the "Sector Erase (SE)" or "Block Erase (BE)" instruction
|
||||||
* that was passed in as the erase type.
|
* 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 */
|
/* Deselect the FLASH */
|
||||||
|
|
||||||
SPI_SELECT(priv->dev, SPIDEV_FLASH, false);
|
SPI_SELECT(priv->dev, SPIDEV_FLASH(0), false);
|
||||||
|
|
||||||
sst26_waitwritecomplete(priv);
|
sst26_waitwritecomplete(priv);
|
||||||
|
|
||||||
@ -539,7 +539,7 @@ static inline int sst26_chiperase(struct sst26_dev_s *priv)
|
|||||||
|
|
||||||
/* Select this FLASH part */
|
/* 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 */
|
/* Send the "Chip Erase (CE)" instruction */
|
||||||
|
|
||||||
@ -547,7 +547,7 @@ static inline int sst26_chiperase(struct sst26_dev_s *priv)
|
|||||||
|
|
||||||
/* Deselect the FLASH */
|
/* Deselect the FLASH */
|
||||||
|
|
||||||
SPI_SELECT(priv->dev, SPIDEV_FLASH, false);
|
SPI_SELECT(priv->dev, SPIDEV_FLASH(0), false);
|
||||||
|
|
||||||
sst26_waitwritecomplete(priv);
|
sst26_waitwritecomplete(priv);
|
||||||
|
|
||||||
@ -572,7 +572,7 @@ static inline void sst26_pagewrite(struct sst26_dev_s *priv,
|
|||||||
|
|
||||||
/* Select this FLASH part */
|
/* Select this FLASH part */
|
||||||
|
|
||||||
SPI_SELECT(priv->dev, SPIDEV_FLASH, true);
|
SPI_SELECT(priv->dev, SPIDEV_FLASH(0), true);
|
||||||
|
|
||||||
/* Send "Page Program (PP)" command */
|
/* 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 */
|
/* Deselect the FLASH: Chip Select high */
|
||||||
|
|
||||||
SPI_SELECT(priv->dev, SPIDEV_FLASH, false);
|
SPI_SELECT(priv->dev, SPIDEV_FLASH(0), false);
|
||||||
|
|
||||||
sst26_waitwritecomplete(priv);
|
sst26_waitwritecomplete(priv);
|
||||||
|
|
||||||
@ -614,7 +614,7 @@ static inline void sst26_bytewrite(struct sst26_dev_s *priv,
|
|||||||
|
|
||||||
/* Select this FLASH part */
|
/* Select this FLASH part */
|
||||||
|
|
||||||
SPI_SELECT(priv->dev, SPIDEV_FLASH, true);
|
SPI_SELECT(priv->dev, SPIDEV_FLASH(0), true);
|
||||||
|
|
||||||
/* Send "Page Program (PP)" command */
|
/* 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 */
|
/* Deselect the FLASH: Chip Select high */
|
||||||
|
|
||||||
SPI_SELECT(priv->dev, SPIDEV_FLASH, false);
|
SPI_SELECT(priv->dev, SPIDEV_FLASH(0), false);
|
||||||
|
|
||||||
sst26_waitwritecomplete(priv);
|
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 */
|
/* Lock the SPI bus and select this FLASH part */
|
||||||
|
|
||||||
sst26_lock(priv->dev);
|
sst26_lock(priv->dev);
|
||||||
SPI_SELECT(priv->dev, SPIDEV_FLASH, true);
|
SPI_SELECT(priv->dev, SPIDEV_FLASH(0), true);
|
||||||
|
|
||||||
/* Send "Read from Memory " instruction */
|
/* 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 */
|
/* 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);
|
sst26_unlock(priv->dev);
|
||||||
sstinfo("return nbytes: %d\n", (int)nbytes);
|
sstinfo("return nbytes: %d\n", (int)nbytes);
|
||||||
return 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
|
/* Allocate a state structure (we allocate the structure instead of using
|
||||||
* a fixed, static allocation so that we can handle multiple FLASH devices.
|
* a fixed, static allocation so that we can handle multiple FLASH devices.
|
||||||
* The current implementation would handle only one FLASH part per SPI
|
* 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.
|
* 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 */
|
/* Deselect the FLASH */
|
||||||
|
|
||||||
SPI_SELECT(dev, SPIDEV_FLASH, false);
|
SPI_SELECT(dev, SPIDEV_FLASH(0), false);
|
||||||
|
|
||||||
/* Identify the FLASH chip and get its capacity */
|
/* Identify the FLASH chip and get its capacity */
|
||||||
|
|
||||||
|
@ -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. */
|
/* Lock the SPI bus, configure the bus, and select this FLASH part. */
|
||||||
|
|
||||||
w25_lock(priv->spi);
|
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 */
|
/* 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 */
|
/* 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);
|
w25_unlock(priv->spi);
|
||||||
|
|
||||||
finfo("manufacturer: %02x memory: %02x capacity: %02x\n",
|
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 */
|
/* Select this FLASH part */
|
||||||
|
|
||||||
SPI_SELECT(priv->spi, SPIDEV_FLASH, true);
|
SPI_SELECT(priv->spi, SPIDEV_FLASH(0), true);
|
||||||
|
|
||||||
/* Send "Write enable (WREN)" */
|
/* 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.)
|
* the SST25 timing diagrams from which this code was leveraged.)
|
||||||
*/
|
*/
|
||||||
|
|
||||||
SPI_SELECT(priv->spi, SPIDEV_FLASH, false);
|
SPI_SELECT(priv->spi, SPIDEV_FLASH(0), false);
|
||||||
SPI_SELECT(priv->spi, SPIDEV_FLASH, true);
|
SPI_SELECT(priv->spi, SPIDEV_FLASH(0), true);
|
||||||
|
|
||||||
/* Send "Write enable status (EWSR)" */
|
/* Send "Write enable status (EWSR)" */
|
||||||
|
|
||||||
@ -478,7 +478,7 @@ static uint8_t w25_waitwritecomplete(struct w25_dev_s *priv)
|
|||||||
{
|
{
|
||||||
/* Select this FLASH part */
|
/* 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 */
|
/* Send "Read Status Register (RDSR)" command */
|
||||||
|
|
||||||
@ -490,7 +490,7 @@ static uint8_t w25_waitwritecomplete(struct w25_dev_s *priv)
|
|||||||
|
|
||||||
/* Deselect the FLASH */
|
/* 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
|
/* 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
|
* 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 */
|
/* Select this FLASH part */
|
||||||
|
|
||||||
SPI_SELECT(priv->spi, SPIDEV_FLASH, true);
|
SPI_SELECT(priv->spi, SPIDEV_FLASH(0), true);
|
||||||
|
|
||||||
/* Send "Write Enable (WREN)" command */
|
/* Send "Write Enable (WREN)" command */
|
||||||
|
|
||||||
@ -527,7 +527,7 @@ static inline void w25_wren(struct w25_dev_s *priv)
|
|||||||
|
|
||||||
/* Deselect the FLASH */
|
/* 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 */
|
/* Select this FLASH part */
|
||||||
|
|
||||||
SPI_SELECT(priv->spi, SPIDEV_FLASH, true);
|
SPI_SELECT(priv->spi, SPIDEV_FLASH(0), true);
|
||||||
|
|
||||||
/* Send "Write Disable (WRDI)" command */
|
/* Send "Write Disable (WRDI)" command */
|
||||||
|
|
||||||
@ -546,7 +546,7 @@ static inline void w25_wrdi(struct w25_dev_s *priv)
|
|||||||
|
|
||||||
/* Deselect the FLASH */
|
/* 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 */
|
/* 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 */
|
/* 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 */
|
/* 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 */
|
/* 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 */
|
/* Send the "Chip Erase (CE)" instruction */
|
||||||
|
|
||||||
@ -614,7 +614,7 @@ static inline int w25_chiperase(struct w25_dev_s *priv)
|
|||||||
|
|
||||||
/* Deselect the FLASH */
|
/* Deselect the FLASH */
|
||||||
|
|
||||||
SPI_SELECT(priv->spi, SPIDEV_FLASH, false);
|
SPI_SELECT(priv->spi, SPIDEV_FLASH(0), false);
|
||||||
finfo("Return: OK\n");
|
finfo("Return: OK\n");
|
||||||
return OK;
|
return OK;
|
||||||
}
|
}
|
||||||
@ -641,7 +641,7 @@ static void w25_byteread(FAR struct w25_dev_s *priv, FAR uint8_t *buffer,
|
|||||||
|
|
||||||
/* Select this FLASH part */
|
/* Select this FLASH part */
|
||||||
|
|
||||||
SPI_SELECT(priv->spi, SPIDEV_FLASH, true);
|
SPI_SELECT(priv->spi, SPIDEV_FLASH(0), true);
|
||||||
|
|
||||||
/* Send "Read from Memory " instruction */
|
/* 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 */
|
/* 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 */
|
/* 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 */
|
/* 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 */
|
/* 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 */
|
/* 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 */
|
/* Select this FLASH part */
|
||||||
|
|
||||||
SPI_SELECT(priv->spi, SPIDEV_FLASH, true);
|
SPI_SELECT(priv->spi, SPIDEV_FLASH(0), true);
|
||||||
|
|
||||||
/* Send "Page Program (PP)" command */
|
/* 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 */
|
/* Deselect the FLASH: Chip Select high */
|
||||||
|
|
||||||
SPI_SELECT(priv->spi, SPIDEV_FLASH, false);
|
SPI_SELECT(priv->spi, SPIDEV_FLASH(0), false);
|
||||||
finfo("Written\n");
|
finfo("Written\n");
|
||||||
}
|
}
|
||||||
#endif /* defined(CONFIG_MTD_BYTE_WRITE) && !defined(CONFIG_W25_READONLY) */
|
#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
|
/* Allocate a state structure (we allocate the structure instead of using
|
||||||
* a fixed, static allocation so that we can handle multiple FLASH devices.
|
* a fixed, static allocation so that we can handle multiple FLASH devices.
|
||||||
* The current implementation would handle only one FLASH part per SPI
|
* 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.
|
* 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 */
|
/* Deselect the FLASH */
|
||||||
|
|
||||||
SPI_SELECT(spi, SPIDEV_FLASH, false);
|
SPI_SELECT(spi, SPIDEV_FLASH(0), false);
|
||||||
|
|
||||||
/* Identify the FLASH chip and get its capacity */
|
/* Identify the FLASH chip and get its capacity */
|
||||||
|
|
||||||
|
@ -466,7 +466,7 @@ static uint8_t enc_rdgreg2(FAR struct enc_driver_s *priv, uint8_t cmd)
|
|||||||
|
|
||||||
/* Select ENC28J60 chip */
|
/* 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
|
/* 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.
|
* 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 */
|
/* De-select ENC28J60 chip */
|
||||||
|
|
||||||
SPI_SELECT(priv->spi, SPIDEV_ETHERNET, false);
|
SPI_SELECT(priv->spi, SPIDEV_ETHERNET(0), false);
|
||||||
|
|
||||||
enc_rddump(cmd, rddata);
|
enc_rddump(cmd, rddata);
|
||||||
return rddata;
|
return rddata;
|
||||||
@ -509,7 +509,7 @@ static void enc_wrgreg2(FAR struct enc_driver_s *priv, uint8_t cmd,
|
|||||||
|
|
||||||
/* Select ENC28J60 chip */
|
/* 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:
|
/* Send the write command and data. The sequence requires 16-clocks:
|
||||||
* 8 to clock out the cmd + 8 to clock out the data.
|
* 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. */
|
/* De-select ENC28J60 chip. */
|
||||||
|
|
||||||
SPI_SELECT(priv->spi, SPIDEV_ETHERNET, false);
|
SPI_SELECT(priv->spi, SPIDEV_ETHERNET(0), false);
|
||||||
enc_wrdump(cmd, wrdata);
|
enc_wrdump(cmd, wrdata);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -553,7 +553,7 @@ static inline void enc_src(FAR struct enc_driver_s *priv)
|
|||||||
|
|
||||||
/* Select ENC28J60 chip */
|
/* Select ENC28J60 chip */
|
||||||
|
|
||||||
SPI_SELECT(priv->spi, SPIDEV_ETHERNET, true);
|
SPI_SELECT(priv->spi, SPIDEV_ETHERNET(0), true);
|
||||||
|
|
||||||
/* Send the system reset command. */
|
/* Send the system reset command. */
|
||||||
|
|
||||||
@ -574,7 +574,7 @@ static inline void enc_src(FAR struct enc_driver_s *priv)
|
|||||||
|
|
||||||
/* De-select ENC28J60 chip. */
|
/* De-select ENC28J60 chip. */
|
||||||
|
|
||||||
SPI_SELECT(priv->spi, SPIDEV_ETHERNET, false);
|
SPI_SELECT(priv->spi, SPIDEV_ETHERNET(0), false);
|
||||||
enc_cmddump(ENC_SRC);
|
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 */
|
/* 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
|
/* 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
|
* 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 */
|
/* 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);
|
enc_rddump(ENC_RCR | GETADDR(ctrlreg), rddata);
|
||||||
return rddata;
|
return rddata;
|
||||||
}
|
}
|
||||||
@ -707,7 +707,7 @@ static void enc_wrbreg(FAR struct enc_driver_s *priv, uint8_t ctrlreg,
|
|||||||
|
|
||||||
/* Re-select ENC28J60 chip */
|
/* 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:
|
/* Send the WCR command and data. The sequence requires 16-clocks:
|
||||||
* 8 to clock out the cmd + 8 to clock out the data.
|
* 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. */
|
/* 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);
|
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 */
|
/* 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) */
|
/* 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. */
|
/* 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);
|
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. ..."
|
* "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)
|
/* 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. ..."
|
* "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);
|
enc_bmdump(ENC_WBM, buffer, buflen+1);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -458,7 +458,7 @@ static void enc_cmd(FAR struct enc_driver_s *priv, uint8_t cmd, uint16_t arg)
|
|||||||
|
|
||||||
/* Select ENCX24J600 chip */
|
/* 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, cmd); /* Clock out the command */
|
||||||
(void)SPI_SEND(priv->spi, arg & 0xff); /* Clock out the low byte */
|
(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. */
|
/* De-select ENCX24J600 chip. */
|
||||||
|
|
||||||
SPI_SELECT(priv->spi, SPIDEV_ETHERNET, false);
|
SPI_SELECT(priv->spi, SPIDEV_ETHERNET(0), false);
|
||||||
enc_wrdump(cmd, arg);
|
enc_wrdump(cmd, arg);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -492,7 +492,7 @@ static inline void enc_setethrst(FAR struct enc_driver_s *priv)
|
|||||||
|
|
||||||
/* Select ENCX24J600 chip */
|
/* Select ENCX24J600 chip */
|
||||||
|
|
||||||
SPI_SELECT(priv->spi, SPIDEV_ETHERNET, true);
|
SPI_SELECT(priv->spi, SPIDEV_ETHERNET(0), true);
|
||||||
|
|
||||||
/* Send the system reset command. */
|
/* Send the system reset command. */
|
||||||
|
|
||||||
@ -502,7 +502,7 @@ static inline void enc_setethrst(FAR struct enc_driver_s *priv)
|
|||||||
|
|
||||||
/* De-select ENCX24J600 chip. */
|
/* De-select ENCX24J600 chip. */
|
||||||
|
|
||||||
SPI_SELECT(priv->spi, SPIDEV_ETHERNET, false);
|
SPI_SELECT(priv->spi, SPIDEV_ETHERNET(0), false);
|
||||||
enc_cmddump(ENC_SETETHRST);
|
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(priv && priv->spi);
|
||||||
DEBUGASSERT((ctrlreg & 0xe0) == 0); /* banked regeitsers only */
|
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));
|
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 */
|
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);
|
enc_rddump(GETADDR(ctrlreg), rddata);
|
||||||
|
|
||||||
return 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(priv && priv->spi);
|
||||||
DEBUGASSERT((ctrlreg & 0xe0) == 0); /* banked regeitsers only */
|
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));
|
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 & 0xff); /* Clock out the low byte */
|
||||||
SPI_SEND(priv->spi, wrdata >> 8); /* Clock out the high 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);
|
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 */
|
/* Select ENCX24J600 chip */
|
||||||
|
|
||||||
SPI_SELECT(priv->spi, SPIDEV_ETHERNET, true);
|
SPI_SELECT(priv->spi, SPIDEV_ETHERNET(0), true);
|
||||||
|
|
||||||
/* Set the bank */
|
/* Set the bank */
|
||||||
|
|
||||||
@ -704,7 +704,7 @@ static void enc_bfs(FAR struct enc_driver_s *priv, uint16_t ctrlreg,
|
|||||||
|
|
||||||
/* De-select ENCX24J600 chip. */
|
/* De-select ENCX24J600 chip. */
|
||||||
|
|
||||||
SPI_SELECT(priv->spi, SPIDEV_ETHERNET, false);
|
SPI_SELECT(priv->spi, SPIDEV_ETHERNET(0), false);
|
||||||
enc_bfsdump(GETADDR(ctrlreg), bits);
|
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 */
|
/* Select ENCX24J600 chip */
|
||||||
|
|
||||||
SPI_SELECT(priv->spi, SPIDEV_ETHERNET, true);
|
SPI_SELECT(priv->spi, SPIDEV_ETHERNET(0), true);
|
||||||
|
|
||||||
/* Set the bank */
|
/* Set the bank */
|
||||||
|
|
||||||
@ -749,7 +749,7 @@ static void enc_bfc(FAR struct enc_driver_s *priv, uint16_t ctrlreg,
|
|||||||
|
|
||||||
/* De-select ENCX24J600 chip. */
|
/* De-select ENCX24J600 chip. */
|
||||||
|
|
||||||
SPI_SELECT(priv->spi, SPIDEV_ETHERNET, false);
|
SPI_SELECT(priv->spi, SPIDEV_ETHERNET(0), false);
|
||||||
enc_bfcdump(GETADDR(ctrlreg), bits);
|
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 */
|
/* 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) */
|
/* 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. */
|
/* 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);
|
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);
|
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_SEND(priv->spi, ENC_WGPDATA);
|
||||||
SPI_SNDBLOCK(priv->spi, buffer, buflen);
|
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);
|
enc_bmdump(ENC_WGPDATA, buffer, buflen);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -97,7 +97,7 @@ uint8_t adxl345_getreg8(FAR struct adxl345_dev_s *priv, uint8_t regaddr)
|
|||||||
|
|
||||||
/* Select the ADXL345 */
|
/* 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 */
|
/* 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 */
|
/* Deselect the ADXL345 */
|
||||||
|
|
||||||
SPI_SELECT(priv->spi, SPIDEV_ACCELEROMETER, false);
|
SPI_SELECT(priv->spi, SPIDEV_ACCELEROMETER(0), false);
|
||||||
|
|
||||||
/* Unlock bus */
|
/* Unlock bus */
|
||||||
|
|
||||||
@ -140,7 +140,7 @@ void adxl345_putreg8(FAR struct adxl345_dev_s *priv, uint8_t regaddr,
|
|||||||
|
|
||||||
/* Select the ADXL345 */
|
/* 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 */
|
/* 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 */
|
/* Deselect the ADXL345 */
|
||||||
|
|
||||||
SPI_SELECT(priv->spi, SPIDEV_ACCELEROMETER, false);
|
SPI_SELECT(priv->spi, SPIDEV_ACCELEROMETER(0), false);
|
||||||
|
|
||||||
/* Unlock bus */
|
/* Unlock bus */
|
||||||
|
|
||||||
@ -175,7 +175,7 @@ uint16_t adxl345_getreg16(FAR struct adxl345_dev_s *priv, uint8_t regaddr)
|
|||||||
|
|
||||||
/* Select the ADXL345 */
|
/* 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 */
|
/* 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 */
|
/* Deselect the ADXL345 */
|
||||||
|
|
||||||
SPI_SELECT(priv->spi, SPIDEV_ACCELEROMETER, false);
|
SPI_SELECT(priv->spi, SPIDEV_ACCELEROMETER(0), false);
|
||||||
|
|
||||||
/* Unlock bus */
|
/* Unlock bus */
|
||||||
|
|
||||||
|
@ -203,7 +203,7 @@ static ssize_t max31855_read(FAR struct file *filep, FAR char *buffer, size_t bu
|
|||||||
/* Enable MAX31855's chip select */
|
/* Enable MAX31855's chip select */
|
||||||
|
|
||||||
max31855_lock(priv->spi);
|
max31855_lock(priv->spi);
|
||||||
SPI_SELECT(priv->spi, SPIDEV_TEMPERATURE, true);
|
SPI_SELECT(priv->spi, SPIDEV_TEMPERATURE(0), true);
|
||||||
|
|
||||||
/* Read temperature */
|
/* 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 */
|
/* Disable MAX31855's chip select */
|
||||||
|
|
||||||
SPI_SELECT(priv->spi, SPIDEV_TEMPERATURE, false);
|
SPI_SELECT(priv->spi, SPIDEV_TEMPERATURE(0), false);
|
||||||
max31855_unlock(priv->spi);
|
max31855_unlock(priv->spi);
|
||||||
|
|
||||||
regval = (regmsb & 0xFF000000) >> 24;
|
regval = (regmsb & 0xFF000000) >> 24;
|
||||||
|
@ -199,7 +199,7 @@ static ssize_t max6675_read(FAR struct file *filep, FAR char *buffer, size_t buf
|
|||||||
/* Enable MAX6675's chip select */
|
/* Enable MAX6675's chip select */
|
||||||
|
|
||||||
max6675_lock(priv->spi);
|
max6675_lock(priv->spi);
|
||||||
SPI_SELECT(priv->spi, SPIDEV_TEMPERATURE, true);
|
SPI_SELECT(priv->spi, SPIDEV_TEMPERATURE(0), true);
|
||||||
|
|
||||||
/* Read temperature */
|
/* 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 */
|
/* Disable MAX6675's chip select */
|
||||||
|
|
||||||
SPI_SELECT(priv->spi, SPIDEV_TEMPERATURE, false);
|
SPI_SELECT(priv->spi, SPIDEV_TEMPERATURE(0), false);
|
||||||
max6675_unlock(priv->spi);
|
max6675_unlock(priv->spi);
|
||||||
|
|
||||||
regval = (regmsb & 0xFF00) >> 8;
|
regval = (regmsb & 0xFF00) >> 8;
|
||||||
|
@ -142,7 +142,7 @@ static uint8_t mpl115a_getreg8(FAR struct mpl115a_dev_s *priv, uint8_t regaddr)
|
|||||||
|
|
||||||
/* Select the MPL115A */
|
/* 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 */
|
/* 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 */
|
/* Deselect the MPL115A */
|
||||||
|
|
||||||
SPI_SELECT(priv->spi, SPIDEV_BAROMETER, false);
|
SPI_SELECT(priv->spi, SPIDEV_BAROMETER(0), false);
|
||||||
|
|
||||||
/* Unlock bus */
|
/* Unlock bus */
|
||||||
|
|
||||||
|
@ -419,7 +419,7 @@ void xen1210_getdata(FAR struct xen1210_dev_s *priv)
|
|||||||
|
|
||||||
/* Select the XEN1210 */
|
/* 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 */
|
/* Read three times 3 bytes = 24 bits * 3 */
|
||||||
|
|
||||||
@ -434,7 +434,7 @@ void xen1210_getdata(FAR struct xen1210_dev_s *priv)
|
|||||||
|
|
||||||
/* Deselect the XEN1210 */
|
/* Deselect the XEN1210 */
|
||||||
|
|
||||||
SPI_SELECT(priv->spi, SPIDEV_ACCELEROMETER, false);
|
SPI_SELECT(priv->spi, SPIDEV_ACCELEROMETER(0), false);
|
||||||
|
|
||||||
/* Unlock bus */
|
/* Unlock bus */
|
||||||
|
|
||||||
@ -472,7 +472,7 @@ void xen1210_putdata(FAR struct xen1210_dev_s *priv, uint32_t regval)
|
|||||||
|
|
||||||
/* Select the XEN1210 */
|
/* 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 */
|
/* We need to write to 3 sensors in the daisy-chain */
|
||||||
/* Write three times 3 bytes */
|
/* Write three times 3 bytes */
|
||||||
@ -483,7 +483,7 @@ void xen1210_putdata(FAR struct xen1210_dev_s *priv, uint32_t regval)
|
|||||||
|
|
||||||
/* Deselect the XEN1210 */
|
/* Deselect the XEN1210 */
|
||||||
|
|
||||||
SPI_SELECT(priv->spi, SPIDEV_ACCELEROMETER, false);
|
SPI_SELECT(priv->spi, SPIDEV_ACCELEROMETER(0), false);
|
||||||
|
|
||||||
/* Unlock bus */
|
/* Unlock bus */
|
||||||
|
|
||||||
|
@ -312,7 +312,7 @@ static volatile int cc1101_interrupt = 0;
|
|||||||
void cc1101_access_begin(FAR struct cc1101_dev_s *dev)
|
void cc1101_access_begin(FAR struct cc1101_dev_s *dev)
|
||||||
{
|
{
|
||||||
(void)SPI_LOCK(dev->spi, true);
|
(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_SETMODE(dev->spi, SPIDEV_MODE0); /* CPOL=0, CPHA=0 */
|
||||||
SPI_SETBITS(dev->spi, 8);
|
SPI_SETBITS(dev->spi, 8);
|
||||||
(void)SPI_HWFEATURES(dev->spi, 0);
|
(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)
|
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);
|
(void)SPI_LOCK(dev->spi, false);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -289,7 +289,7 @@ static void cc3000_lock_and_select(FAR struct spi_dev_s *spi)
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
cc3000_configspi(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 */
|
/* De select */
|
||||||
|
|
||||||
SPI_SELECT(spi, SPIDEV_WIRELESS, false);
|
SPI_SELECT(spi, SPIDEV_WIRELESS(0), false);
|
||||||
|
|
||||||
/* Relinquish the SPI bus. */
|
/* Relinquish the SPI bus. */
|
||||||
|
|
||||||
|
@ -513,9 +513,9 @@ static void mrf24j40_setreg(FAR struct spi_dev_s *spi, uint32_t addr,
|
|||||||
buf[len++] = val;
|
buf[len++] = val;
|
||||||
|
|
||||||
mrf24j40_spi_lock(spi);
|
mrf24j40_spi_lock(spi);
|
||||||
SPI_SELECT(spi, SPIDEV_IEEE802154, true);
|
SPI_SELECT(spi, SPIDEV_IEEE802154(0), true);
|
||||||
SPI_SNDBLOCK(spi, buf, len);
|
SPI_SNDBLOCK(spi, buf, len);
|
||||||
SPI_SELECT(spi, SPIDEV_IEEE802154, false);
|
SPI_SELECT(spi, SPIDEV_IEEE802154(0), false);
|
||||||
mrf24j40_spi_unlock(spi);
|
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 */
|
buf[len++] = 0xFF; /* dummy */
|
||||||
|
|
||||||
mrf24j40_spi_lock (spi);
|
mrf24j40_spi_lock (spi);
|
||||||
SPI_SELECT (spi, SPIDEV_IEEE802154, true);
|
SPI_SELECT (spi, SPIDEV_IEEE802154(0), true);
|
||||||
SPI_EXCHANGE (spi, buf, rx, len);
|
SPI_EXCHANGE (spi, buf, rx, len);
|
||||||
SPI_SELECT (spi, SPIDEV_IEEE802154, false);
|
SPI_SELECT (spi, SPIDEV_IEEE802154(0), false);
|
||||||
mrf24j40_spi_unlock(spi);
|
mrf24j40_spi_unlock(spi);
|
||||||
|
|
||||||
/* wlinfo("r[%04X]=%02X\n", addr, rx[len - 1]); */
|
/* wlinfo("r[%04X]=%02X\n", addr, rx[len - 1]); */
|
||||||
|
@ -281,12 +281,12 @@ static void nrf24l01_lock(FAR struct spi_dev_s *spi)
|
|||||||
* unlocked)
|
* unlocked)
|
||||||
*/
|
*/
|
||||||
|
|
||||||
SPI_SELECT(spi, SPIDEV_WIRELESS, true);
|
SPI_SELECT(spi, SPIDEV_WIRELESS(0), true);
|
||||||
SPI_SETMODE(spi, SPIDEV_MODE0);
|
SPI_SETMODE(spi, SPIDEV_MODE0);
|
||||||
SPI_SETBITS(spi, 8);
|
SPI_SETBITS(spi, 8);
|
||||||
(void)SPI_HWFEATURES(spi, 0);
|
(void)SPI_HWFEATURES(spi, 0);
|
||||||
(void)SPI_SETFREQUENCY(spi, NRF24L01_SPIFREQ);
|
(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. */
|
/* 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_SETMODE(spi, SPIDEV_MODE0);
|
||||||
SPI_SETBITS(spi, 8);
|
SPI_SETBITS(spi, 8);
|
||||||
(void)SPI_HWFEATURES(spi, 0);
|
(void)SPI_HWFEATURES(spi, 0);
|
||||||
(void)SPI_SETFREQUENCY(spi, NRF24L01_SPIFREQ);
|
(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)
|
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)
|
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);
|
||||||
}
|
}
|
||||||
|
|
||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
|
@ -70,7 +70,7 @@
|
|||||||
* CONFIG_PGA11X_MULTIPLE
|
* CONFIG_PGA11X_MULTIPLE
|
||||||
* Can be defined to support multiple PGA11X devices on board. Each
|
* Can be defined to support multiple PGA11X devices on board. Each
|
||||||
* device will require a customized SPI interface to distinguish them
|
* 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:
|
* Other settings that effect the driver:
|
||||||
* CONFIG_DEBUG_SPI_ERR/WARN/INFO -- This will enable debug output from
|
* CONFIG_DEBUG_SPI_ERR/WARN/INFO -- This will enable debug output from
|
||||||
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue
Block a user