diff --git a/libcpu/arm/lm3s/serial.c b/libcpu/arm/lm3s/serial.c index 79cb0ff4b4bab25786638afddba78e304dbf5f2c..4dd2bf306d5d63b8290a1ed5c060ddc4a7175d1c 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); - + SysCtlPeripheralEnable(SYSCTL_PERIPH_UART0); + SysCtlPeripheralEnable(SYSCTL_PERIPH_GPIOA); + /* set UART0 pinmux */ - GPIOPinTypeUART(GPIO_PORTA_BASE, GPIO_PIN_0 | GPIO_PIN_1); + 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;