aboutsummaryrefslogtreecommitdiffstats
path: root/os/hal/src/uart.c
diff options
context:
space:
mode:
authorGiovanni Di Sirio <gdisirio@gmail.com>2015-03-08 21:19:58 +0000
committerGiovanni Di Sirio <gdisirio@gmail.com>2015-03-08 21:19:58 +0000
commitce7f7103df5f634f7b57d90e115c5824adcb68a0 (patch)
tree48064ba690d7002bb8fc7b78f3f9dd76729b785c /os/hal/src/uart.c
parent63bf265ddf9ad40ad981c5a145c601972b91426e (diff)
downloadChibiOS-ce7f7103df5f634f7b57d90e115c5824adcb68a0.tar.gz
ChibiOS-ce7f7103df5f634f7b57d90e115c5824adcb68a0.tar.bz2
ChibiOS-ce7f7103df5f634f7b57d90e115c5824adcb68a0.zip
MISRA fixes for high level HAL.
git-svn-id: svn://svn.code.sf.net/p/chibios/svn/trunk@7738 35acf78f-673a-0410-8e92-d51de3d6d3f4
Diffstat (limited to 'os/hal/src/uart.c')
-rw-r--r--os/hal/src/uart.c20
1 files changed, 12 insertions, 8 deletions
diff --git a/os/hal/src/uart.c b/os/hal/src/uart.c
index d8ef3511b..07d0b276d 100644
--- a/os/hal/src/uart.c
+++ b/os/hal/src/uart.c
@@ -27,7 +27,7 @@
#include "hal.h"
-#if HAL_USE_UART || defined(__DOXYGEN__)
+#if (HAL_USE_UART == TRUE) || defined(__DOXYGEN__)
/*===========================================================================*/
/* Driver local definitions. */
@@ -137,7 +137,7 @@ void uartStop(UARTDriver *uartp) {
*/
void uartStartSend(UARTDriver *uartp, size_t n, const void *txbuf) {
- osalDbgCheck((uartp != NULL) && (n > 0) && (txbuf != NULL));
+ osalDbgCheck((uartp != NULL) && (n > 0U) && (txbuf != NULL));
osalSysLock();
osalDbgAssert(uartp->state == UART_READY, "is active");
@@ -163,7 +163,7 @@ void uartStartSend(UARTDriver *uartp, size_t n, const void *txbuf) {
void uartStartSendI(UARTDriver *uartp, size_t n, const void *txbuf) {
osalDbgCheckClassI();
- osalDbgCheck((uartp != NULL) && (n > 0) && (txbuf != NULL));
+ osalDbgCheck((uartp != NULL) && (n > 0U) && (txbuf != NULL));
osalDbgAssert(uartp->state == UART_READY, "is active");
osalDbgAssert(uartp->txstate != UART_TX_ACTIVE, "tx active");
@@ -195,9 +195,11 @@ size_t uartStopSend(UARTDriver *uartp) {
n = uart_lld_stop_send(uartp);
uartp->txstate = UART_TX_IDLE;
}
- else
+ else {
n = 0;
+ }
osalSysUnlock();
+
return n;
}
@@ -241,7 +243,7 @@ size_t uartStopSendI(UARTDriver *uartp) {
*/
void uartStartReceive(UARTDriver *uartp, size_t n, void *rxbuf) {
- osalDbgCheck((uartp != NULL) && (n > 0) && (rxbuf != NULL));
+ osalDbgCheck((uartp != NULL) && (n > 0U) && (rxbuf != NULL));
osalSysLock();
osalDbgAssert(uartp->state == UART_READY, "is active");
@@ -267,7 +269,7 @@ void uartStartReceive(UARTDriver *uartp, size_t n, void *rxbuf) {
void uartStartReceiveI(UARTDriver *uartp, size_t n, void *rxbuf) {
osalDbgCheckClassI();
- osalDbgCheck((uartp != NULL) && (n > 0) && (rxbuf != NULL));
+ osalDbgCheck((uartp != NULL) && (n > 0U) && (rxbuf != NULL));
osalDbgAssert(uartp->state == UART_READY, "is active");
osalDbgAssert(uartp->rxstate != UART_RX_ACTIVE, "rx active");
@@ -299,9 +301,11 @@ size_t uartStopReceive(UARTDriver *uartp) {
n = uart_lld_stop_receive(uartp);
uartp->rxstate = UART_RX_IDLE;
}
- else
+ else {
n = 0;
+ }
osalSysUnlock();
+
return n;
}
@@ -332,6 +336,6 @@ size_t uartStopReceiveI(UARTDriver *uartp) {
return 0;
}
-#endif /* HAL_USE_UART */
+#endif /* HAL_USE_UART == TRUE */
/** @} */