aboutsummaryrefslogtreecommitdiffstats
path: root/os/hal
diff options
context:
space:
mode:
Diffstat (limited to 'os/hal')
-rw-r--r--os/hal/include/hal_uart.h7
-rw-r--r--os/hal/src/hal_uart.c16
2 files changed, 15 insertions, 8 deletions
diff --git a/os/hal/include/hal_uart.h b/os/hal/include/hal_uart.h
index 9e5d2a373..a07464993 100644
--- a/os/hal/include/hal_uart.h
+++ b/os/hal/include/hal_uart.h
@@ -43,6 +43,13 @@
#define UART_BREAK_DETECTED 64 /**< @brief Break detected. */
/** @} */
+/**
+ * @name UART error conditions
+ * @{
+ */
+#define UART_ERR_NOT_ACTIVE (size_t)-1
+/** @} */
+
/*===========================================================================*/
/* Driver pre-compile time settings. */
/*===========================================================================*/
diff --git a/os/hal/src/hal_uart.c b/os/hal/src/hal_uart.c
index dd9f4a6d2..2d6a4c408 100644
--- a/os/hal/src/hal_uart.c
+++ b/os/hal/src/hal_uart.c
@@ -188,7 +188,7 @@ void uartStartSendI(UARTDriver *uartp, size_t n, const void *txbuf) {
*
* @return The number of data frames not transmitted by the
* stopped transmit operation.
- * @retval 0 There was no transmit operation in progress.
+ * @retval UART_ERR_NOT_ACTIVE if there was no transmit operation in progress.
*
* @api
*/
@@ -205,7 +205,7 @@ size_t uartStopSend(UARTDriver *uartp) {
uartp->txstate = UART_TX_IDLE;
}
else {
- n = 0;
+ n = UART_ERR_NOT_ACTIVE;
}
osalSysUnlock();
@@ -221,7 +221,7 @@ size_t uartStopSend(UARTDriver *uartp) {
*
* @return The number of data frames not transmitted by the
* stopped transmit operation.
- * @retval 0 There was no transmit operation in progress.
+ * @retval UART_ERR_NOT_ACTIVE if there was no transmit operation in progress.
*
* @iclass
*/
@@ -236,7 +236,7 @@ size_t uartStopSendI(UARTDriver *uartp) {
uartp->txstate = UART_TX_IDLE;
return n;
}
- return 0;
+ return UART_ERR_NOT_ACTIVE;
}
/**
@@ -294,7 +294,7 @@ void uartStartReceiveI(UARTDriver *uartp, size_t n, void *rxbuf) {
*
* @return The number of data frames not received by the
* stopped receive operation.
- * @retval 0 There was no receive operation in progress.
+ * @retval UART_ERR_NOT_ACTIVE if there was no receive operation in progress.
*
* @api
*/
@@ -311,7 +311,7 @@ size_t uartStopReceive(UARTDriver *uartp) {
uartp->rxstate = UART_RX_IDLE;
}
else {
- n = 0;
+ n = UART_ERR_NOT_ACTIVE;
}
osalSysUnlock();
@@ -327,7 +327,7 @@ size_t uartStopReceive(UARTDriver *uartp) {
*
* @return The number of data frames not received by the
* stopped receive operation.
- * @retval 0 There was no receive operation in progress.
+ * @retval UART_ERR_NOT_ACTIVE if there was no receive operation in progress.
*
* @iclass
*/
@@ -342,7 +342,7 @@ size_t uartStopReceiveI(UARTDriver *uartp) {
uartp->rxstate = UART_RX_IDLE;
return n;
}
- return 0;
+ return UART_ERR_NOT_ACTIVE;
}
#if (UART_USE_WAIT == TRUE) || defined(__DOXYGEN__)