aboutsummaryrefslogtreecommitdiffstats
path: root/os
diff options
context:
space:
mode:
authorgdisirio <gdisirio@35acf78f-673a-0410-8e92-d51de3d6d3f4>2010-07-26 09:01:47 +0000
committergdisirio <gdisirio@35acf78f-673a-0410-8e92-d51de3d6d3f4>2010-07-26 09:01:47 +0000
commitd7e91ec7012e4165f8127edaa8512469cdc6b583 (patch)
treee9e26c22a3f2a8612a79ecf19c538c2341f71544 /os
parent131b177925913634bd96e02e7a9f7d529a122df0 (diff)
downloadChibiOS-d7e91ec7012e4165f8127edaa8512469cdc6b583.tar.gz
ChibiOS-d7e91ec7012e4165f8127edaa8512469cdc6b583.tar.bz2
ChibiOS-d7e91ec7012e4165f8127edaa8512469cdc6b583.zip
git-svn-id: svn://svn.code.sf.net/p/chibios/svn/trunk@2089 35acf78f-673a-0410-8e92-d51de3d6d3f4
Diffstat (limited to 'os')
-rw-r--r--os/hal/hal.mk1
-rw-r--r--os/hal/include/hal.h1
-rw-r--r--os/hal/include/uart.h17
-rw-r--r--os/hal/platforms/STM32/platform.mk1
-rw-r--r--os/hal/src/uart.c4
-rw-r--r--os/hal/templates/uart_lld.h5
6 files changed, 25 insertions, 4 deletions
diff --git a/os/hal/hal.mk b/os/hal/hal.mk
index 5d78dccc7..fc6a1ff40 100644
--- a/os/hal/hal.mk
+++ b/os/hal/hal.mk
@@ -8,6 +8,7 @@ HALSRC = ${CHIBIOS}/os/hal/src/hal.c \
${CHIBIOS}/os/hal/src/pwm.c \
${CHIBIOS}/os/hal/src/serial.c \
${CHIBIOS}/os/hal/src/spi.c \
+ ${CHIBIOS}/os/hal/src/uart.c \
${CHIBIOS}/os/hal/src/mmc_spi.c
# Required include directories
diff --git a/os/hal/include/hal.h b/os/hal/include/hal.h
index b9431c165..dc2eb33a0 100644
--- a/os/hal/include/hal.h
+++ b/os/hal/include/hal.h
@@ -40,6 +40,7 @@
#include "pwm.h"
#include "serial.h"
#include "spi.h"
+#include "uart.h"
#include "mmc_spi.h"
/*===========================================================================*/
diff --git a/os/hal/include/uart.h b/os/hal/include/uart.h
index 72273b2a7..245bd1939 100644
--- a/os/hal/include/uart.h
+++ b/os/hal/include/uart.h
@@ -34,6 +34,19 @@
/* Driver constants. */
/*===========================================================================*/
+/** @brief No pending conditions.*/
+#define UART_NO_ERROR 0
+/** @brief Parity error happened.*/
+#define UART_PARITY_ERROR 4
+/** @brief Framing error happened.*/
+#define UART_FRAMING_ERROR 8
+/** @brief Overflow happened.*/
+#define UART_OVERRUN_ERROR 16
+/** @brief Noise on the line.*/
+#define UART_NOISE_ERROR 32
+/** @brief Break detected.*/
+#define UART_BREAK_DETECTED 64
+
/*===========================================================================*/
/* Driver pre-compile time settings. */
/*===========================================================================*/
@@ -89,8 +102,8 @@ typedef enum {
typedef enum {
UART_RX_IDLE = 0, /**< @brief Not receiving. */
UART_RX_ACTIVE = 1, /**< @brief Receiving. */
- UART_TX_ERROR = 2, /**< @brief Receive error. */
- UART_TX_COMPLETE = 3 /**< @brief Buffer complete. */
+ UART_RX_ERROR = 2, /**< @brief Receive error. */
+ UART_RX_COMPLETE = 3 /**< @brief Buffer complete. */
} uartrxstate_t;
#include "uart_lld.h"
diff --git a/os/hal/platforms/STM32/platform.mk b/os/hal/platforms/STM32/platform.mk
index eea814567..35e732116 100644
--- a/os/hal/platforms/STM32/platform.mk
+++ b/os/hal/platforms/STM32/platform.mk
@@ -6,6 +6,7 @@ PLATFORMSRC = ${CHIBIOS}/os/hal/platforms/STM32/hal_lld.c \
${CHIBIOS}/os/hal/platforms/STM32/pwm_lld.c \
${CHIBIOS}/os/hal/platforms/STM32/serial_lld.c \
${CHIBIOS}/os/hal/platforms/STM32/spi_lld.c \
+ ${CHIBIOS}/os/hal/platforms/STM32/uart_lld.c \
${CHIBIOS}/os/hal/platforms/STM32/stm32_dma.c
# Required include directories
diff --git a/os/hal/src/uart.c b/os/hal/src/uart.c
index 281d6ad78..9c200763f 100644
--- a/os/hal/src/uart.c
+++ b/os/hal/src/uart.c
@@ -222,7 +222,7 @@ void uartStartReceive(UARTDriver *uartp, size_t n, void *rxbuf) {
"uartStartReceive(), #1",
"not active");
- uart_lld_start_receive(uartp, n, txbuf);
+ uart_lld_start_receive(uartp, n, rxbuf);
uartp->ud_rxstate = UART_RX_ACTIVE;
chSysUnlock();
}
@@ -247,7 +247,7 @@ void uartStartReceiveI(UARTDriver *uartp, size_t n, void *rxbuf) {
"uartStartReceiveI(), #1",
"not active");
- uart_lld_start_receive(uartp, n, txbuf);
+ uart_lld_start_receive(uartp, n, rxbuf);
uartp->ud_rxstate = UART_RX_ACTIVE;
}
diff --git a/os/hal/templates/uart_lld.h b/os/hal/templates/uart_lld.h
index adc824bd0..2d5c576b3 100644
--- a/os/hal/templates/uart_lld.h
+++ b/os/hal/templates/uart_lld.h
@@ -47,6 +47,11 @@
/*===========================================================================*/
/**
+ * @brief UART driver condition flags type.
+ */
+typedef uint32_t uartflags_t;
+
+/**
* @brief Driver configuration structure.
* @note It could be empty on some architectures.
*/