|
@@ -15,18 +15,18 @@
|
|
|
#include <rthw.h>
|
|
|
#include <rtthread.h>
|
|
|
|
|
|
-#include <inc/hw_types.h>
|
|
|
+#include <inc/hw_types.h>
|
|
|
#include <inc/hw_memmap.h>
|
|
|
-#include <inc/hw_uart.h>
|
|
|
-#include <inc/hw_ints.h>
|
|
|
-#include <driverlib/gpio.h>
|
|
|
-#include <driverlib/sysctl.h>
|
|
|
-#include <driverlib/interrupt.h>
|
|
|
+#include <inc/hw_uart.h>
|
|
|
+#include <inc/hw_ints.h>
|
|
|
+#include <driverlib/gpio.h>
|
|
|
+#include <driverlib/sysctl.h>
|
|
|
+#include <driverlib/interrupt.h>
|
|
|
|
|
|
#include <uart.h>
|
|
|
-#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;
|