Char match support in UART driver.

git-svn-id: svn://svn.code.sf.net/p/chibios/svn/trunk@12009 110e8d01-0319-4d1e-a829-52ad28d1bb01
This commit is contained in:
Giovanni Di Sirio 2018-05-06 14:56:30 +00:00
parent a0c253d44d
commit 0c9f553e4f
2 changed files with 40 additions and 0 deletions

View File

@ -185,6 +185,23 @@ typedef enum {
#define _uart_wakeup_rx_error_isr(uartp) #define _uart_wakeup_rx_error_isr(uartp)
#endif /* !UART_USE_WAIT */ #endif /* !UART_USE_WAIT */
#if (UART_USE_WAIT == TRUE) || defined(__DOXYGEN__)
/**
* @brief Wakes up the waiting thread in case of RX character match.
*
* @param[in] uartp pointer to the @p UARTDriver object
*
* @notapi
*/
#define _uart_wakeup_rx_cm_isr(uartp) { \
osalSysLockFromISR(); \
osalThreadResumeI(&(uartp)->threadrx, MSG_TIMEOUT); \
osalSysUnlockFromISR(); \
}
#else /* !UART_USE_WAIT */
#define _uart_wakeup_rx_cm_isr(uartp)
#endif /* !UART_USE_WAIT */
#if (UART_USE_WAIT == TRUE) || defined(__DOXYGEN__) #if (UART_USE_WAIT == TRUE) || defined(__DOXYGEN__)
/** /**
* @brief Wakes up the waiting thread in case of RX timeout. * @brief Wakes up the waiting thread in case of RX timeout.
@ -336,6 +353,27 @@ typedef enum {
_uart_wakeup_rx_timeout_isr(uartp); \ _uart_wakeup_rx_timeout_isr(uartp); \
} }
/**
* @brief Character match ISR code for receiver.
* @details This code handles the portable part of the ISR code:
* - Callback invocation.
* - Waiting thread wakeup, if any.
* - Driver state transitions.
* .
* @note This macro is meant to be used in the low level drivers
* implementation only.
*
* @param[in] uartp pointer to the @p UARTDriver object
*
* @notapi
*/
#define _uart_rx_char_match_isr_code(uartp) { \
if ((uartp)->config->rx_cm_cb != NULL) { \
(uartp)->config->rx_cm_cb(uartp); \
} \
_uart_wakeup_rx_cm_isr(uartp); \
}
/** @} */ /** @} */
/*===========================================================================*/ /*===========================================================================*/

View File

@ -91,6 +91,8 @@
***************************************************************************** *****************************************************************************
*** Next *** *** Next ***
- NEW: Added optional support for character match callback in the UART
high level driver.
- NEW: Change, chMtxGetNextMutexS() renamed to chMtxGetNextMutexX(). - NEW: Change, chMtxGetNextMutexS() renamed to chMtxGetNextMutexX().
- NEW: RT C++ wrapper reworked, now it is mostly inline code, added some new - NEW: RT C++ wrapper reworked, now it is mostly inline code, added some new
wrappers and methods. Added wrappers for more API functions. BaseThreads wrappers and methods. Added wrappers for more API functions. BaseThreads