Add a preliminary definition for an SPI slave interface
This commit is contained in:
parent
567f1f4b1c
commit
b6d6776d02
@ -5,6 +5,23 @@
|
|||||||
|
|
||||||
if SPI
|
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
|
config SPI_OWNBUS
|
||||||
bool "SPI single device"
|
bool "SPI single device"
|
||||||
default n
|
default n
|
||||||
|
@ -271,7 +271,7 @@
|
|||||||
*
|
*
|
||||||
* Input Parameters:
|
* Input Parameters:
|
||||||
* dev - Device-specific state data
|
* 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
|
* 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-
|
* of words. The wordsize is determined by the number of bits-
|
||||||
* per-word selected for the SPI interface. If nbits <= 8, the
|
* per-word selected for the SPI interface. If nbits <= 8, the
|
||||||
@ -298,7 +298,7 @@
|
|||||||
* Input Parameters:
|
* Input Parameters:
|
||||||
* dev - Device-specific state data
|
* dev - Device-specific state data
|
||||||
* txbuffer - A pointer to the buffer of data to be sent
|
* 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.
|
* nwords - the length of data that to be exchanged in units of words.
|
||||||
* The wordsize is determined by the number of bits-per-word
|
* The wordsize is determined by the number of bits-per-word
|
||||||
* selected for the SPI interface. If nbits <= 8, the data is
|
* selected for the SPI interface. If nbits <= 8, the data is
|
||||||
@ -324,7 +324,7 @@
|
|||||||
*
|
*
|
||||||
* Input Parameters:
|
* Input Parameters:
|
||||||
* dev - Device-specific state data
|
* 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
|
* arg - A caller provided value to return with the callback
|
||||||
*
|
*
|
||||||
* Returned Value:
|
* Returned Value:
|
||||||
@ -367,7 +367,7 @@ enum spi_dev_e
|
|||||||
SPIDEV_USER /* Board-specific values start here */
|
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
|
enum spi_mode_e
|
||||||
{
|
{
|
||||||
@ -383,29 +383,31 @@ struct spi_dev_s;
|
|||||||
struct spi_ops_s
|
struct spi_ops_s
|
||||||
{
|
{
|
||||||
#ifndef CONFIG_SPI_OWNBUS
|
#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
|
#endif
|
||||||
void (*select)(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);
|
bool selected);
|
||||||
uint32_t (*setfrequency)(FAR struct spi_dev_s *dev, uint32_t frequency);
|
CODE 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);
|
CODE void (*setmode)(FAR struct spi_dev_s *dev, enum spi_mode_e mode);
|
||||||
void (*setbits)(FAR struct spi_dev_s *dev, int nbits);
|
CODE 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 uint8_t (*status)(FAR struct spi_dev_s *dev, enum spi_dev_e devid);
|
||||||
#ifdef CONFIG_SPI_CMDDATA
|
#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
|
#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
|
#ifdef CONFIG_SPI_EXCHANGE
|
||||||
void (*exchange)(FAR struct spi_dev_s *dev, FAR const void *txbuffer,
|
CODE void (*exchange)(FAR struct spi_dev_s *dev,
|
||||||
FAR void *rxbuffer, size_t nwords);
|
FAR const void *txbuffer, FAR void *rxbuffer,
|
||||||
#else
|
|
||||||
void (*sndblock)(FAR struct spi_dev_s *dev, FAR const void *buffer,
|
|
||||||
size_t nwords);
|
size_t nwords);
|
||||||
void (*recvblock)(FAR struct spi_dev_s *dev, FAR void *buffer,
|
#else
|
||||||
|
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);
|
size_t nwords);
|
||||||
#endif
|
#endif
|
||||||
int (*registercallback)(FAR struct spi_dev_s *dev, spi_mediachange_t callback,
|
CODE int (*registercallback)(FAR struct spi_dev_s *dev,
|
||||||
void *arg);
|
spi_mediachange_t callback, void *arg);
|
||||||
};
|
};
|
||||||
|
|
||||||
/* SPI private data. This structure only defines the initial fields of the
|
/* 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
|
* Another example would be the STM32 families that support both SPI
|
||||||
* blocks as well as USARTs that can be configured to perform the 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).
|
* writing).
|
||||||
*
|
*
|
||||||
* Input Parameter:
|
* Input Parameter:
|
||||||
* Port number (for hardware that has mutiple SPI interfaces)
|
* Port number (for hardware that has multiple SPI interfaces)
|
||||||
*
|
*
|
||||||
* Returned Value:
|
* Returned Value:
|
||||||
* Valid SPI device structure reference on succcess; a NULL on failure
|
* Valid SPI device structure reference on success; a NULL on failure
|
||||||
*
|
*
|
||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user