fix UART ISR function.
git-svn-id: https://rt-thread.googlecode.com/svn/trunk@286 bbd45198-f89e-11dd-88c7-29a3b14d5316
This commit is contained in:
parent
329c44a03f
commit
6b77e031db
|
@ -15,18 +15,18 @@
|
||||||
#include <rthw.h>
|
#include <rthw.h>
|
||||||
#include <rtthread.h>
|
#include <rtthread.h>
|
||||||
|
|
||||||
#include <inc/hw_types.h>
|
#include <inc/hw_types.h>
|
||||||
#include <inc/hw_memmap.h>
|
#include <inc/hw_memmap.h>
|
||||||
#include <inc/hw_uart.h>
|
#include <inc/hw_uart.h>
|
||||||
#include <inc/hw_ints.h>
|
#include <inc/hw_ints.h>
|
||||||
#include <driverlib/gpio.h>
|
#include <driverlib/gpio.h>
|
||||||
#include <driverlib/sysctl.h>
|
#include <driverlib/sysctl.h>
|
||||||
#include <driverlib/interrupt.h>
|
#include <driverlib/interrupt.h>
|
||||||
|
|
||||||
#include <uart.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
|
#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;
|
rt_uint32_t status;
|
||||||
|
|
||||||
device = (struct rt_device*)serial;
|
device = (struct rt_device*)serial;
|
||||||
UARTIntStatus(serial->hw_base, true);
|
status = UARTIntStatus(serial->hw_base, true);
|
||||||
|
|
||||||
/* clear interrupt status */
|
/* clear interrupt status */
|
||||||
UARTIntClear(serial->hw_base, status);
|
UARTIntClear(serial->hw_base, status);
|
||||||
|
@ -309,20 +309,20 @@ void rt_hw_serial_init(void)
|
||||||
serial->baudrate = 115200;
|
serial->baudrate = 115200;
|
||||||
|
|
||||||
rt_memset(serial->rx_buffer, 0, sizeof(serial->rx_buffer));
|
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 */
|
/* enable UART0 clock */
|
||||||
SysCtlPeripheralEnable(SYSCTL_PERIPH_UART0);
|
SysCtlPeripheralEnable(SYSCTL_PERIPH_UART0);
|
||||||
SysCtlPeripheralEnable(SYSCTL_PERIPH_GPIOA);
|
SysCtlPeripheralEnable(SYSCTL_PERIPH_GPIOA);
|
||||||
|
|
||||||
/* set UART0 pinmux */
|
/* 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.init = rt_serial_init;
|
||||||
serial->parent.open = rt_serial_open;
|
serial->parent.open = rt_serial_open;
|
||||||
serial->parent.close = rt_serial_close;
|
serial->parent.close = rt_serial_close;
|
||||||
|
|
Loading…
Reference in New Issue