From 6a3c599bc49ba4824c6087beba60bf2f29d31113 Mon Sep 17 00:00:00 2001 From: gdisirio Date: Fri, 30 Nov 2012 13:01:06 +0000 Subject: Fixed bug 3589412. git-svn-id: svn://svn.code.sf.net/p/chibios/svn/trunk@4849 35acf78f-673a-0410-8e92-d51de3d6d3f4 --- os/hal/platforms/STM32/USARTv1/uart_lld.c | 2 +- os/hal/platforms/STM32/USARTv2/uart_lld.c | 8 ++++---- os/hal/platforms/STM32/serial_lld.c | 4 ++-- 3 files changed, 7 insertions(+), 7 deletions(-) (limited to 'os') diff --git a/os/hal/platforms/STM32/USARTv1/uart_lld.c b/os/hal/platforms/STM32/USARTv1/uart_lld.c index b64230463..90a59ac95 100644 --- a/os/hal/platforms/STM32/USARTv1/uart_lld.c +++ b/os/hal/platforms/STM32/USARTv1/uart_lld.c @@ -196,10 +196,10 @@ static void usart_start(UARTDriver *uartp) { else cr1 = USART_CR1_UE | USART_CR1_PEIE | USART_CR1_TE | USART_CR1_RE | USART_CR1_TCIE; - u->CR1 = uartp->config->cr1 | cr1; u->CR2 = uartp->config->cr2 | USART_CR2_LBDIE; u->CR3 = uartp->config->cr3 | USART_CR3_DMAT | USART_CR3_DMAR | USART_CR3_EIE; + u->CR1 = uartp->config->cr1 | cr1; /* Starting the receiver idle loop.*/ set_rx_idle_loop(uartp); diff --git a/os/hal/platforms/STM32/USARTv2/uart_lld.c b/os/hal/platforms/STM32/USARTv2/uart_lld.c index 276aa7e8d..e35b386c5 100644 --- a/os/hal/platforms/STM32/USARTv2/uart_lld.c +++ b/os/hal/platforms/STM32/USARTv2/uart_lld.c @@ -93,7 +93,7 @@ UARTDriver UARTD3; * * @return The error flags. */ -static uartflags_t translate_errors(uint16_t isr) { +static uartflags_t translate_errors(uint32_t isr) { uartflags_t sts = 0; if (isr & USART_ISR_ORE) @@ -154,7 +154,7 @@ static void usart_stop(UARTDriver *uartp) { * @param[in] uartp pointer to the @p UARTDriver object */ static void usart_start(UARTDriver *uartp) { - uint16_t cr1; + uint32_t cr1; USART_TypeDef *u = uartp->usart; /* Defensive programming, starting from a clean state.*/ @@ -183,10 +183,10 @@ static void usart_start(UARTDriver *uartp) { else cr1 = USART_CR1_UE | USART_CR1_PEIE | USART_CR1_TE | USART_CR1_RE | USART_CR1_TCIE; - u->CR1 = uartp->config->cr1 | cr1; u->CR2 = uartp->config->cr2 | USART_CR2_LBDIE; u->CR3 = uartp->config->cr3 | USART_CR3_DMAT | USART_CR3_DMAR | USART_CR3_EIE; + u->CR1 = uartp->config->cr1 | cr1; /* Starting the receiver idle loop.*/ set_rx_idle_loop(uartp); @@ -268,7 +268,7 @@ static void uart_lld_serve_tx_end_irq(UARTDriver *uartp, uint32_t flags) { * @param[in] uartp pointer to the @p UARTDriver object */ static void serve_usart_irq(UARTDriver *uartp) { - uint16_t isr; + uint32_t isr; USART_TypeDef *u = uartp->usart; /* Reading and clearing status.*/ diff --git a/os/hal/platforms/STM32/serial_lld.c b/os/hal/platforms/STM32/serial_lld.c index 841b9b386..92ef8c5ef 100644 --- a/os/hal/platforms/STM32/serial_lld.c +++ b/os/hal/platforms/STM32/serial_lld.c @@ -222,11 +222,11 @@ static void usart_init(SerialDriver *sdp, const SerialConfig *config) { u->BRR = STM32_PCLK1 / config->sc_speed; /* Note that some bits are enforced.*/ + u->CR2 = config->sc_cr2 | USART_CR2_LBDIE; + u->CR3 = config->sc_cr3 | USART_CR3_EIE; u->CR1 = config->sc_cr1 | USART_CR1_UE | USART_CR1_PEIE | USART_CR1_RXNEIE | USART_CR1_TE | USART_CR1_RE; - u->CR2 = config->sc_cr2 | USART_CR2_LBDIE; - u->CR3 = config->sc_cr3 | USART_CR3_EIE; u->SR = 0; (void)u->SR; /* SR reset step 1.*/ (void)u->DR; /* SR reset step 2.*/ -- cgit v1.2.3