SPI code made more readable.
git-svn-id: svn://svn.code.sf.net/p/chibios/svn/trunk@7767 35acf78f-673a-0410-8e92-d51de3d6d3f4
This commit is contained in:
parent
cc7f8758b0
commit
19d593770f
|
@ -212,20 +212,6 @@ typedef enum {
|
|||
* @{
|
||||
*/
|
||||
#if (SPI_USE_WAIT == TRUE) || defined(__DOXYGEN__)
|
||||
/**
|
||||
* @brief Waits for operation completion.
|
||||
* @details This function waits for the driver to complete the current
|
||||
* operation.
|
||||
* @pre An operation must be running while the function is invoked.
|
||||
* @note No more than one thread can wait on a SPI driver using
|
||||
* this function.
|
||||
*
|
||||
* @param[in] spip pointer to the @p SPIDriver object
|
||||
*
|
||||
* @notapi
|
||||
*/
|
||||
#define _spi_wait_s(spip) (void) osalThreadSuspendS(&(spip)->thread)
|
||||
|
||||
/**
|
||||
* @brief Wakes up the waiting thread.
|
||||
*
|
||||
|
@ -239,7 +225,6 @@ typedef enum {
|
|||
osalSysUnlockFromISR(); \
|
||||
}
|
||||
#else /* !SPI_USE_WAIT */
|
||||
#define _spi_wait_s(spip)
|
||||
#define _spi_wakeup_isr(spip)
|
||||
#endif /* !SPI_USE_WAIT */
|
||||
|
||||
|
|
|
@ -285,7 +285,7 @@ void spiIgnore(SPIDriver *spip, size_t n) {
|
|||
osalDbgAssert(spip->state == SPI_READY, "not ready");
|
||||
osalDbgAssert(spip->config->end_cb == NULL, "has callback");
|
||||
spiStartIgnoreI(spip, n);
|
||||
_spi_wait_s(spip);
|
||||
(void) osalThreadSuspendS(&spip->thread);
|
||||
osalSysUnlock();
|
||||
}
|
||||
|
||||
|
@ -317,7 +317,7 @@ void spiExchange(SPIDriver *spip, size_t n,
|
|||
osalDbgAssert(spip->state == SPI_READY, "not ready");
|
||||
osalDbgAssert(spip->config->end_cb == NULL, "has callback");
|
||||
spiStartExchangeI(spip, n, txbuf, rxbuf);
|
||||
_spi_wait_s(spip);
|
||||
(void) osalThreadSuspendS(&spip->thread);
|
||||
osalSysUnlock();
|
||||
}
|
||||
|
||||
|
@ -345,7 +345,7 @@ void spiSend(SPIDriver *spip, size_t n, const void *txbuf) {
|
|||
osalDbgAssert(spip->state == SPI_READY, "not ready");
|
||||
osalDbgAssert(spip->config->end_cb == NULL, "has callback");
|
||||
spiStartSendI(spip, n, txbuf);
|
||||
_spi_wait_s(spip);
|
||||
(void) osalThreadSuspendS(&spip->thread);
|
||||
osalSysUnlock();
|
||||
}
|
||||
|
||||
|
@ -373,7 +373,7 @@ void spiReceive(SPIDriver *spip, size_t n, void *rxbuf) {
|
|||
osalDbgAssert(spip->state == SPI_READY, "not ready");
|
||||
osalDbgAssert(spip->config->end_cb == NULL, "has callback");
|
||||
spiStartReceiveI(spip, n, rxbuf);
|
||||
_spi_wait_s(spip);
|
||||
(void) osalThreadSuspendS(&spip->thread);
|
||||
osalSysUnlock();
|
||||
}
|
||||
#endif /* SPI_USE_WAIT == TRUE */
|
||||
|
|
Loading…
Reference in New Issue