From 6b77e031dbe34b339951eb7aaa0593607e92e5ff Mon Sep 17 00:00:00 2001 From: "fengzi.rtt" Date: Tue, 5 Jan 2010 05:03:37 +0000 Subject: [PATCH] fix UART ISR function. git-svn-id: https://rt-thread.googlecode.com/svn/trunk@286 bbd45198-f89e-11dd-88c7-29a3b14d5316 --- libcpu/arm/lm3s/serial.c | 40 ++++++++++++++++++++-------------------- 1 file changed, 20 insertions(+), 20 deletions(-) diff --git a/libcpu/arm/lm3s/serial.c b/libcpu/arm/lm3s/serial.c index 79cb0ff4b4..4dd2bf306d 100644 --- a/libcpu/arm/lm3s/serial.c +++ b/libcpu/arm/lm3s/serial.c @@ -15,18 +15,18 @@ #include #include -#include +#include #include -#include -#include -#include -#include -#include +#include +#include +#include +#include +#include #include -#include "board.h" +#include "board.h" -extern void rt_hw_interrupt_thread_switch(void); +extern void rt_hw_interrupt_thread_switch(void); #define RT_UART_RX_BUFFER_SIZE 64 @@ -59,7 +59,7 @@ void rt_hw_uart_isr(struct rt_lm3s_serial* serial) rt_uint32_t status; device = (struct rt_device*)serial; - UARTIntStatus(serial->hw_base, true); + status = UARTIntStatus(serial->hw_base, true); /* clear interrupt status */ UARTIntClear(serial->hw_base, status); @@ -309,20 +309,20 @@ void rt_hw_serial_init(void) serial->baudrate = 115200; rt_memset(serial->rx_buffer, 0, sizeof(serial->rx_buffer)); - serial->read_index = serial->save_index = 0; + serial->read_index = serial->save_index = 0; /* enable UART0 clock */ - SysCtlPeripheralEnable(SYSCTL_PERIPH_UART0); - SysCtlPeripheralEnable(SYSCTL_PERIPH_GPIOA); - - /* set UART0 pinmux */ - GPIOPinTypeUART(GPIO_PORTA_BASE, GPIO_PIN_0 | GPIO_PIN_1); + SysCtlPeripheralEnable(SYSCTL_PERIPH_UART0); + SysCtlPeripheralEnable(SYSCTL_PERIPH_GPIOA); + + /* set UART0 pinmux */ + GPIOPinTypeUART(GPIO_PORTA_BASE, GPIO_PIN_0 | GPIO_PIN_1); + + /* Configure the UART for 115,200, 8-N-1 operation. */ + UARTConfigSetExpClk(UART0_BASE, SysCtlClockGet(), serial->baudrate, + (UART_CONFIG_WLEN_8 | UART_CONFIG_STOP_ONE | + UART_CONFIG_PAR_NONE)); - /* Configure the UART for 115,200, 8-N-1 operation. */ - UARTConfigSetExpClk(UART0_BASE, SysCtlClockGet(), serial->baudrate, - (UART_CONFIG_WLEN_8 | UART_CONFIG_STOP_ONE | - UART_CONFIG_PAR_NONE)); - serial->parent.init = rt_serial_init; serial->parent.open = rt_serial_open; serial->parent.close = rt_serial_close;