diff --git a/os/hal/src/uart.c b/os/hal/src/uart.c index c8734294b..8886d28bd 100644 --- a/os/hal/src/uart.c +++ b/os/hal/src/uart.c @@ -150,8 +150,10 @@ void uartStartSend(UARTDriver *uartp, size_t n, const void *txbuf) { "uartStartSend"); chSysLock(); - chDbgAssert((uartp->state == UART_READY) && (uartp->txstate == UART_TX_IDLE), - "uartStartSend(), #1", "not active"); + chDbgAssert(uartp->state == UART_READY, + "uartStartSend(), #1", "is active"); + chDbgAssert(uartp->txstate != UART_TX_ACTIVE, + "uartStartSend(), #2", "tx active"); uart_lld_start_send(uartp, n, txbuf); uartp->txstate = UART_TX_ACTIVE; @@ -175,9 +177,10 @@ void uartStartSendI(UARTDriver *uartp, size_t n, const void *txbuf) { chDbgCheckClassI(); chDbgCheck((uartp != NULL) && (n > 0) && (txbuf != NULL), "uartStartSendI"); - chDbgAssert((uartp->state == UART_READY) && - (uartp->txstate != UART_TX_ACTIVE), - "uartStartSendI(), #1", "not active"); + chDbgAssert(uartp->state == UART_READY, + "uartStartSendI(), #1", "is active"); + chDbgAssert(uartp->txstate != UART_TX_ACTIVE, + "uartStartSendI(), #2", "tx active"); uart_lld_start_send(uartp, n, txbuf); uartp->txstate = UART_TX_ACTIVE; @@ -257,8 +260,10 @@ void uartStartReceive(UARTDriver *uartp, size_t n, void *rxbuf) { "uartStartReceive"); chSysLock(); - chDbgAssert((uartp->state == UART_READY) && (uartp->rxstate == UART_RX_IDLE), - "uartStartReceive(), #1", "not active"); + chDbgAssert(uartp->state == UART_READY, + "uartStartReceive(), #1", "is active"); + chDbgAssert(uartp->rxstate != UART_RX_ACTIVE, + "uartStartReceive(), #2", "rx active"); uart_lld_start_receive(uartp, n, rxbuf); uartp->rxstate = UART_RX_ACTIVE; @@ -282,8 +287,10 @@ void uartStartReceiveI(UARTDriver *uartp, size_t n, void *rxbuf) { chDbgCheckClassI(); chDbgCheck((uartp != NULL) && (n > 0) && (rxbuf != NULL), "uartStartReceiveI"); - chDbgAssert((uartp->state == UART_READY) && (uartp->rxstate == UART_RX_IDLE), - "uartStartReceiveI(), #1", "not active"); + chDbgAssert(uartp->state == UART_READY, + "uartStartReceiveI(), #1", "is active"); + chDbgAssert(uartp->rxstate != UART_RX_ACTIVE, + "uartStartReceiveI(), #2", "rx active"); uart_lld_start_receive(uartp, n, rxbuf); uartp->rxstate = UART_RX_ACTIVE; diff --git a/readme.txt b/readme.txt index 7f6b89478..7bacc80e8 100644 --- a/readme.txt +++ b/readme.txt @@ -80,6 +80,7 @@ *** 2.4.4 *** - FIX: Fixed state checker error in MSP430 port (bug 3601460). +- FIX: Fixed wrong assertion in UART driver (bug 3600789). - FIX: Fixed small bug in shell argument parsing code in shell_thread (bug 3599328). - FIX: Fixed wrong condition in checksum offload of STM32 MAC driver (bug