diff --git a/drivers/spi/Kconfig b/drivers/spi/Kconfig index 6bef9b56948..488c08c2513 100644 --- a/drivers/spi/Kconfig +++ b/drivers/spi/Kconfig @@ -5,6 +5,23 @@ if SPI +config SPI_SLAVE + bool "SPI slave" + default n + ---help--- + Enable support for SPI slave features + +if SPI_SLAVE + +config SPI_SLAVE_DMA + bool "SPI slave DMA" + default n + depends on ARCH_DMA && EXPERIMENTAL + ---help--- + Enable support for DMA data transfers (not yet implemented). + +endif + config SPI_OWNBUS bool "SPI single device" default n diff --git a/include/nuttx/spi/spi.h b/include/nuttx/spi/spi.h index 544afaa3ca8..43aa8e277c7 100644 --- a/include/nuttx/spi/spi.h +++ b/include/nuttx/spi/spi.h @@ -271,7 +271,7 @@ * * Input Parameters: * dev - Device-specific state data - * buffer - A pointer to the buffer in which to recieve data + * buffer - A pointer to the buffer in which to receive data * nwords - the length of data that can be received in the buffer in number * of words. The wordsize is determined by the number of bits- * per-word selected for the SPI interface. If nbits <= 8, the @@ -298,7 +298,7 @@ * Input Parameters: * dev - Device-specific state data * txbuffer - A pointer to the buffer of data to be sent - * rxbuffer - A pointer to the buffer in which to recieve data + * rxbuffer - A pointer to the buffer in which to receive data * nwords - the length of data that to be exchanged in units of words. * The wordsize is determined by the number of bits-per-word * selected for the SPI interface. If nbits <= 8, the data is @@ -324,7 +324,7 @@ * * Input Parameters: * dev - Device-specific state data - * callback - The funtion to call on the media change + * callback - The function to call on the media change * arg - A caller provided value to return with the callback * * Returned Value: @@ -367,7 +367,7 @@ enum spi_dev_e SPIDEV_USER /* Board-specific values start here */ }; -/* Certain SPI devices may required differnt clocking modes */ +/* Certain SPI devices may required different clocking modes */ enum spi_mode_e { @@ -383,29 +383,31 @@ struct spi_dev_s; struct spi_ops_s { #ifndef CONFIG_SPI_OWNBUS - int (*lock)(FAR struct spi_dev_s *dev, bool lock); + CODE int (*lock)(FAR struct spi_dev_s *dev, bool lock); #endif - void (*select)(FAR struct spi_dev_s *dev, enum spi_dev_e devid, - bool selected); - uint32_t (*setfrequency)(FAR struct spi_dev_s *dev, uint32_t frequency); - void (*setmode)(FAR struct spi_dev_s *dev, enum spi_mode_e mode); - void (*setbits)(FAR struct spi_dev_s *dev, int nbits); - uint8_t (*status)(FAR struct spi_dev_s *dev, enum spi_dev_e devid); + CODE void (*select)(FAR struct spi_dev_s *dev, enum spi_dev_e devid, + bool selected); + CODE uint32_t (*setfrequency)(FAR struct spi_dev_s *dev, uint32_t frequency); + CODE void (*setmode)(FAR struct spi_dev_s *dev, enum spi_mode_e mode); + CODE void (*setbits)(FAR struct spi_dev_s *dev, int nbits); + CODE uint8_t (*status)(FAR struct spi_dev_s *dev, enum spi_dev_e devid); #ifdef CONFIG_SPI_CMDDATA - int (*cmddata)(FAR struct spi_dev_s *dev, enum spi_dev_e devid, bool cmd); + CODE int (*cmddata)(FAR struct spi_dev_s *dev, enum spi_dev_e devid + bool cmd); #endif - uint16_t (*send)(FAR struct spi_dev_s *dev, uint16_t wd); + CODE uint16_t (*send)(FAR struct spi_dev_s *dev, uint16_t wd); #ifdef CONFIG_SPI_EXCHANGE - void (*exchange)(FAR struct spi_dev_s *dev, FAR const void *txbuffer, - FAR void *rxbuffer, size_t nwords); + CODE void (*exchange)(FAR struct spi_dev_s *dev, + FAR const void *txbuffer, FAR void *rxbuffer, + size_t nwords); #else - void (*sndblock)(FAR struct spi_dev_s *dev, FAR const void *buffer, - size_t nwords); - void (*recvblock)(FAR struct spi_dev_s *dev, FAR void *buffer, - size_t nwords); + CODE void (*sndblock)(FAR struct spi_dev_s *dev, + FAR const void *buffer, size_t nwords); + CODE void (*recvblock)(FAR struct spi_dev_s *dev, FAR void *buffer, + size_t nwords); #endif - int (*registercallback)(FAR struct spi_dev_s *dev, spi_mediachange_t callback, - void *arg); + CODE int (*registercallback)(FAR struct spi_dev_s *dev, + spi_mediachange_t callback, void *arg); }; /* SPI private data. This structure only defines the initial fields of the @@ -454,14 +456,14 @@ extern "C" * * Another example would be the STM32 families that support both SPI * blocks as well as USARTs that can be configured to perform the SPI - * function as well (the STM32 USARTs do not suppor SPI as of this + * function as well (the STM32 USARTs do not support SPI as of this * writing). * * Input Parameter: - * Port number (for hardware that has mutiple SPI interfaces) + * Port number (for hardware that has multiple SPI interfaces) * * Returned Value: - * Valid SPI device structure reference on succcess; a NULL on failure + * Valid SPI device structure reference on success; a NULL on failure * ****************************************************************************/