aboutsummaryrefslogtreecommitdiffstats
path: root/os/hal/include
diff options
context:
space:
mode:
authorUladzimir Pylinski <barthess@yandex.ru>2016-07-20 18:41:06 +0000
committerUladzimir Pylinski <barthess@yandex.ru>2016-07-20 18:41:06 +0000
commit97f803c392a91e48b9b6df1d3048cd8db0a6c7c1 (patch)
tree4471c1f75d604b8c589bc370c759f737ad20f718 /os/hal/include
parent0edf3f363b0e8222477f1bf956a421ab6e7d2cd5 (diff)
downloadChibiOS-97f803c392a91e48b9b6df1d3048cd8db0a6c7c1.tar.gz
ChibiOS-97f803c392a91e48b9b6df1d3048cd8db0a6c7c1.tar.bz2
ChibiOS-97f803c392a91e48b9b6df1d3048cd8db0a6c7c1.zip
[STM32. USARTv2] Added synchronous API support for timeout feature.
git-svn-id: svn://svn.code.sf.net/p/chibios/svn/trunk@9714 35acf78f-673a-0410-8e92-d51de3d6d3f4
Diffstat (limited to 'os/hal/include')
-rw-r--r--os/hal/include/hal_uart.h21
1 files changed, 20 insertions, 1 deletions
diff --git a/os/hal/include/hal_uart.h b/os/hal/include/hal_uart.h
index 01a505c9a..677224541 100644
--- a/os/hal/include/hal_uart.h
+++ b/os/hal/include/hal_uart.h
@@ -185,6 +185,23 @@ typedef enum {
#define _uart_wakeup_rx_error_isr(uartp)
#endif /* !UART_USE_WAIT */
+#if (UART_USE_WAIT == TRUE) || defined(__DOXYGEN__)
+/**
+ * @brief Wakes up the waiting thread in case of RX timeout.
+ *
+ * @param[in] uartp pointer to the @p UARTDriver object
+ *
+ * @notapi
+ */
+#define _uart_wakeup_rx_timeout_isr(uartp) { \
+ osalSysLockFromISR(); \
+ osalThreadResumeI(&(uartp)->threadrx, MSG_TIMEOUT); \
+ osalSysUnlockFromISR(); \
+}
+#else /* !UART_USE_WAIT */
+#define _uart_wakeup_rx_timeout_isr(uartp)
+#endif /* !UART_USE_WAIT */
+
/**
* @brief Common ISR code for early TX.
* @details This code handles the portable part of the ISR code:
@@ -314,8 +331,10 @@ typedef enum {
* @notapi
*/
#define _uart_timeout_isr_code(uartp) { \
- if ((uartp)->config->timeout_cb != NULL) \
+ if ((uartp)->config->timeout_cb != NULL) { \
(uartp)->config->timeout_cb(uartp); \
+ } \
+ _uart_wakeup_rx_timeout_isr(uartp); \
}
/** @} */