diff options
author | gdisirio <gdisirio@35acf78f-673a-0410-8e92-d51de3d6d3f4> | 2010-10-30 11:18:28 +0000 |
---|---|---|
committer | gdisirio <gdisirio@35acf78f-673a-0410-8e92-d51de3d6d3f4> | 2010-10-30 11:18:28 +0000 |
commit | a884e58e2cea877f804cb643d4d1e0909bd1fa49 (patch) | |
tree | 5a0e292f8b7ae213756e92d4710711fbd57db296 /os/hal/templates | |
parent | 0cef5f4877397e508bdf5706ef8fada52cdb9d49 (diff) | |
download | ChibiOS-a884e58e2cea877f804cb643d4d1e0909bd1fa49.tar.gz ChibiOS-a884e58e2cea877f804cb643d4d1e0909bd1fa49.tar.bz2 ChibiOS-a884e58e2cea877f804cb643d4d1e0909bd1fa49.zip |
Added a polled exchange function to the SPI driver model, implemented on LPCxxxx SPI drivers.
git-svn-id: svn://svn.code.sf.net/p/chibios/svn/trunk@2302 35acf78f-673a-0410-8e92-d51de3d6d3f4
Diffstat (limited to 'os/hal/templates')
-rw-r--r-- | os/hal/templates/halconf.h | 11 | ||||
-rw-r--r-- | os/hal/templates/spi_lld.c | 16 | ||||
-rw-r--r-- | os/hal/templates/spi_lld.h | 1 |
3 files changed, 28 insertions, 0 deletions
diff --git a/os/hal/templates/halconf.h b/os/hal/templates/halconf.h index 20cd4c54e..d5cd47cb5 100644 --- a/os/hal/templates/halconf.h +++ b/os/hal/templates/halconf.h @@ -173,6 +173,17 @@ #define MMC_POLLING_DELAY 10
#endif
+/**
+ * @brief Uses the SPI polled API for small data transfers.
+ * @details Polled transfers usually improve performance because it
+ * saves two context switches and interrupt servicing. Note
+ * that this option has no effect on large transfers which
+ * are always performed using DMAs/IRQs.
+ */
+#if !defined(MMC_USE_SPI_POLLING) || defined(__DOXYGEN__)
+#define MMC_USE_SPI_POLLING TRUE
+#endif
+
/*===========================================================================*/
/* PAL driver related settings. */
/*===========================================================================*/
diff --git a/os/hal/templates/spi_lld.c b/os/hal/templates/spi_lld.c index 1fca51d41..f3053f725 100644 --- a/os/hal/templates/spi_lld.c +++ b/os/hal/templates/spi_lld.c @@ -177,6 +177,22 @@ void spi_lld_receive(SPIDriver *spip, size_t n, void *rxbuf) { }
+/**
+ * @brief Exchanges one frame using a polled wait.
+ * @details This synchronous function exchanges one frame using a polled
+ * synchronization method. This function is useful when exchanging
+ * small amount of data on high speed channels, usually in this
+ * situation is much more efficient just wait for completion using
+ * polling than suspending the thread waiting for an interrupt.
+ *
+ * @param[in] spip pointer to the @p SPIDriver object
+ * @param[in] frame the data frame to send over the SPI bus
+ * @return The received data frame from the SPI bus.
+ */
+uint16_t spi_lld_polled_exchange(SPIDriver *spip, uint16_t frame) {
+
+}
+
#endif /* CH_HAL_USE_SPI */
/** @} */
diff --git a/os/hal/templates/spi_lld.h b/os/hal/templates/spi_lld.h index 7fff799d1..acc6a699f 100644 --- a/os/hal/templates/spi_lld.h +++ b/os/hal/templates/spi_lld.h @@ -132,6 +132,7 @@ extern "C" { const void *txbuf, void *rxbuf);
void spi_lld_send(SPIDriver *spip, size_t n, const void *txbuf);
void spi_lld_receive(SPIDriver *spip, size_t n, void *rxbuf);
+ uint16_t spi_lld_polled_exchange(SPIDriver *spip, uint16_t frame);
#ifdef __cplusplus
}
#endif
|