summaryrefslogtreecommitdiff
path: root/bsp/lpc43xx
diff options
context:
space:
mode:
authorbernard <[email protected]>2014-07-18 06:45:54 +0800
committerbernard <[email protected]>2014-07-18 06:45:54 +0800
commitc45f5a249089e1e453f358bcab052ddce8a8dff7 (patch)
treec5f7b1a6e234759648eca0456039a930a5435134 /bsp/lpc43xx
parentfc6747ef6c665195cf3b8fc1c40e93da60872519 (diff)
[Drivers] re-write serial framework.
Diffstat (limited to 'bsp/lpc43xx')
-rw-r--r--bsp/lpc43xx/drivers/drv_uart.c14
1 files changed, 6 insertions, 8 deletions
diff --git a/bsp/lpc43xx/drivers/drv_uart.c b/bsp/lpc43xx/drivers/drv_uart.c
index 867ee32bd5..58a385b8b1 100644
--- a/bsp/lpc43xx/drivers/drv_uart.c
+++ b/bsp/lpc43xx/drivers/drv_uart.c
@@ -97,7 +97,6 @@ static const struct rt_uart_ops lpc_uart_ops =
#if defined(RT_USING_UART0)
/* UART0 device driver structure */
-struct serial_ringbuffer uart0_int_rx;
struct lpc_uart uart0 =
{
LPC_USART0,
@@ -136,7 +135,7 @@ void UART0_IRQHandler(void)
/* read the data to buffer */
while (uart->USART->LSR & UART_LSR_RDR)
{
- rt_hw_serial_isr(&serial0);
+ rt_hw_serial_isr(&serial0, RT_SERIAL_EVENT_RX_IND);
}
break;
@@ -150,7 +149,6 @@ void UART0_IRQHandler(void)
#endif
#if defined(RT_USING_UART2)
/* UART2 device driver structure */
-struct serial_ringbuffer uart2_int_rx;
struct lpc_uart uart2 =
{
LPC_USART2,
@@ -189,7 +187,7 @@ void UART2_IRQHandler(void)
/* read the data to buffer */
while (uart->USART->LSR & UART_LSR_RDR)
{
- rt_hw_serial_isr(&serial0);
+ rt_hw_serial_isr(&serial0, RT_SERIAL_EVENT_RX_IND);
}
break;
@@ -214,9 +212,9 @@ void rt_hw_uart_init(void)
config.parity = PARITY_NONE;
config.stop_bits = STOP_BITS_1;
config.invert = NRZ_NORMAL;
+ config.bufsz = RT_SERIAL_RB_BUFSZ;
serial0.ops = &lpc_uart_ops;
- serial0.int_rx = &uart0_int_rx;
serial0.config = config;
/* Enable GPIO register interface clock */
@@ -256,7 +254,7 @@ void rt_hw_uart_init(void)
/* register UART1 device */
rt_hw_serial_register(&serial0, "uart0",
- RT_DEVICE_FLAG_RDWR | RT_DEVICE_FLAG_INT_RX | RT_DEVICE_FLAG_STREAM,
+ RT_DEVICE_FLAG_RDWR | RT_DEVICE_FLAG_INT_RX,
uart);
#endif
#ifdef RT_USING_UART2
@@ -267,9 +265,9 @@ void rt_hw_uart_init(void)
config.parity = PARITY_NONE;
config.stop_bits = STOP_BITS_1;
config.invert = NRZ_NORMAL;
+ config.bufsz = RT_SERIAL_RB_BUFSZ;
serial2.ops = &lpc_uart_ops;
- serial2.int_rx = &uart2_int_rx;
serial2.config = config;
/* Enable GPIO register interface clock */
@@ -309,7 +307,7 @@ void rt_hw_uart_init(void)
/* register UART1 device */
rt_hw_serial_register(&serial2, "uart2",
- RT_DEVICE_FLAG_RDWR | RT_DEVICE_FLAG_INT_RX | RT_DEVICE_FLAG_STREAM,
+ RT_DEVICE_FLAG_RDWR | RT_DEVICE_FLAG_INT_RX,
uart);
#endif
}