mirror of
https://github.com/apache/nuttx.git
synced 2026-06-06 16:50:55 +08:00
drivers/spi/Kconfig and include/nuttx/spi/spi.h: Extend the HW features supported by SPI. It now supports a deffered DMA trigger hardware configuration. arch/arm/src/stm32/stm32_spi.c: Implements the new deferred DMA trigger feature.
This commit is contained in:
committed by
Gregory Nutt
parent
d2b98cc150
commit
8328539534
@@ -225,6 +225,10 @@
|
||||
* condition. (see spi_exchange)
|
||||
* Bit 4: HWFEAT_LSBFIRST
|
||||
* Data transferred LSB first (default is MSB first)
|
||||
* Bit 5: Turn deferred trigger mode on or off. Primarily used for DMA
|
||||
* mode. If a transfer is deferred then the DMA will not actually
|
||||
* be triggered until a subsequent call to SPI_TRIGGER to set it
|
||||
* off.
|
||||
*/
|
||||
|
||||
# ifdef CONFIG_SPI_CRCGENERATION
|
||||
@@ -243,6 +247,10 @@
|
||||
# define HWFEAT_LSBFIRST (1 << 4)
|
||||
# endif
|
||||
|
||||
# ifdef CONFIG_SPI_TRIGGER
|
||||
# define HWFEAT_TRIGGER (1 << 5)
|
||||
# endif
|
||||
|
||||
#else
|
||||
/* Any attempt to select hardware features with CONFIG_SPI_HWFEATURES
|
||||
* deselected will return an -ENOSYS error.
|
||||
@@ -420,6 +428,25 @@
|
||||
#define SPI_REGISTERCALLBACK(d,c,a) \
|
||||
((d)->ops->registercallback ? (d)->ops->registercallback(d,c,a) : -ENOSYS)
|
||||
|
||||
/****************************************************************************
|
||||
* Name: SPI_TRIGGER
|
||||
*
|
||||
* Description:
|
||||
* Trigger a previously configured DMA transfer.
|
||||
*
|
||||
* Input Parameters:
|
||||
* dev - Device-specific state data
|
||||
*
|
||||
* Returned Value:
|
||||
* OK - Trigger was fired
|
||||
* -ENOSYS - Trigger not fired due to lack of DMA or low level support
|
||||
* -EIO - Trigger not fired because not previously primed
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
# define SPI_TRIGGER(d) \
|
||||
(((d)->ops->trigger) ? ((d)->ops->trigger(d)) : -ENOSYS)
|
||||
|
||||
/* SPI Device Macros ********************************************************/
|
||||
|
||||
/* This builds a SPI devid from its type and index */
|
||||
@@ -549,6 +576,9 @@ struct spi_ops_s
|
||||
FAR const void *buffer, size_t nwords);
|
||||
CODE void (*recvblock)(FAR struct spi_dev_s *dev, FAR void *buffer,
|
||||
size_t nwords);
|
||||
#endif
|
||||
#ifdef CONFIG_SPI_TRIGGER
|
||||
CODE int (*trigger)(FAR struct spi_dev_s *dev);
|
||||
#endif
|
||||
CODE int (*registercallback)(FAR struct spi_dev_s *dev,
|
||||
spi_mediachange_t callback, void *arg);
|
||||
|
||||
Reference in New Issue
Block a user