From 844c70e2e51206ffd54e563cb69eb60c9cccad1f Mon Sep 17 00:00:00 2001 From: gdisirio Date: Sat, 19 Jan 2013 08:01:56 +0000 Subject: [PATCH] Fixed bug 3600789. git-svn-id: svn://svn.code.sf.net/p/chibios/svn/trunk@5080 35acf78f-673a-0410-8e92-d51de3d6d3f4 --- os/hal/src/uart.c | 25 ++++++++++++++++--------- readme.txt | 2 ++ 2 files changed, 18 insertions(+), 9 deletions(-) diff --git a/os/hal/src/uart.c b/os/hal/src/uart.c index 1ab95a8ee..8462aafb1 100644 --- a/os/hal/src/uart.c +++ b/os/hal/src/uart.c @@ -143,8 +143,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; @@ -168,9 +170,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; @@ -250,8 +253,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; @@ -275,8 +280,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 9bd2e2fa1..ac803932a 100644 --- a/readme.txt +++ b/readme.txt @@ -84,6 +84,8 @@ *** 2.5.2 *** - FIX: Fixed state checker error in MSP430 port (bug 3601460)(backported to 2.4.4). +- FIX: Fixed wrong assertion in UART driver (bug 3600789)(backported + to 2.4.4). - FIX: Fixed small bug in shell argument parsing code in shell_thread (bug 3599328)(backported to 2.4.4). - FIX: Fixed wrong condition in checksum offload of STM32 MAC driver (bug