diff options
author | patacongo <patacongo@42af7a65-404d-4744-a932-0658087f49c3> | 2009-04-26 16:06:29 +0000 |
---|---|---|
committer | patacongo <patacongo@42af7a65-404d-4744-a932-0658087f49c3> | 2009-04-26 16:06:29 +0000 |
commit | 6a7a05294f342e9bb647afe629ac0ede7d8ce4bd (patch) | |
tree | 6e89bb567dbb54ec8b0cf20d26b70a85cd2059c0 /nuttx/include | |
parent | 389e6fc77d7c306f280df1b03e74f86579d4b763 (diff) | |
download | px4-nuttx-6a7a05294f342e9bb647afe629ac0ede7d8ce4bd.tar.gz px4-nuttx-6a7a05294f342e9bb647afe629ac0ede7d8ce4bd.tar.bz2 px4-nuttx-6a7a05294f342e9bb647afe629ac0ede7d8ce4bd.zip |
Extend SPI interface for word sizes >8bits
git-svn-id: svn://svn.code.sf.net/p/nuttx/code/trunk@1740 42af7a65-404d-4744-a932-0658087f49c3
Diffstat (limited to 'nuttx/include')
-rw-r--r-- | nuttx/include/nuttx/spi.h | 29 |
1 files changed, 18 insertions, 11 deletions
diff --git a/nuttx/include/nuttx/spi.h b/nuttx/include/nuttx/spi.h index 636c9323f..7e60a53b3 100644 --- a/nuttx/include/nuttx/spi.h +++ b/nuttx/include/nuttx/spi.h @@ -130,21 +130,22 @@ #define SPI_STATUS_WRPROTECTED 0x02 /* Bit 1=1: MMC/SD card write protected */ /**************************************************************************** - * Name: SPI_SNDBYTE + * Name: SPI_SEND * * Description: - * Send one byte on SPI. Required. + * Exchange one word on SPI. Required. * * Input Parameters: * dev - Device-specific state data - * ch - The byte to send + * wd - The word to send. the size of the data is determined by the + * number of bits selected for the SPI interface. * * Returned Value: - * None + * Received value * ****************************************************************************/ -#define SPI_SNDBYTE(d,ch) ((d)->ops->sndbyte(d,ch)) +#define SPI_SEND(d,wd) ((d)->ops->send(d,(uint16)wd)) /**************************************************************************** * Name: SPI_SNDBLOCK @@ -153,9 +154,12 @@ * Send a block of data on SPI. Required. * * Input Parameters: - * dev - Device-specific state data + * dev - Device-specific state data * buffer - A pointer to the buffer of data to be sent - * buflen - the length of data to send from the buffer + * buflen - the length of data to send from 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 data is + * packed into ubytes; if nbits >8, the data is packed into uint16's * * Returned Value: * None @@ -173,7 +177,10 @@ * Input Parameters: * dev - Device-specific state data * buffer - A pointer to the buffer in which to recieve data - * buflen - the length of data that can be received in the buffer + * buflen - 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 data is + * packed into ubytes; if nbits >8, the data is packed into uint16's * * Returned Value: * None @@ -241,9 +248,9 @@ struct spi_ops_s uint32 (*setfrequency)(FAR struct spi_dev_s *dev, uint32 frequency); void (*setmode)(FAR struct spi_dev_s *dev, enum spi_mode_e mode); ubyte (*status)(FAR struct spi_dev_s *dev, enum spi_dev_e devid); - ubyte (*sndbyte)(FAR struct spi_dev_s *dev, ubyte ch); - void (*sndblock)(FAR struct spi_dev_s *dev, FAR const ubyte *buffer, size_t buflen); - void (*recvblock)(FAR struct spi_dev_s *dev, FAR ubyte *buffer, size_t buflen); + uint16 (*send)(FAR struct spi_dev_s *dev, uint16 wd); + void (*sndblock)(FAR struct spi_dev_s *dev, FAR const void *buffer, size_t buflen); + void (*recvblock)(FAR struct spi_dev_s *dev, FAR void *buffer, size_t buflen); int (*registercallback)(FAR struct spi_dev_s *dev, mediachange_t callback, void *arg); }; |