From 74377b2650b6d9e3d2d2e4de11ed05a5d8979d00 Mon Sep 17 00:00:00 2001 From: bernard Date: Fri, 18 Jul 2014 07:21:09 +0800 Subject: [PATCH] [Drivers] re-write serial framework. --- bsp/stm32f10x/drivers/usart.c | 14 ++++---------- 1 file changed, 4 insertions(+), 10 deletions(-) diff --git a/bsp/stm32f10x/drivers/usart.c b/bsp/stm32f10x/drivers/usart.c index ae47db3a14..bbaf4ec032 100644 --- a/bsp/stm32f10x/drivers/usart.c +++ b/bsp/stm32f10x/drivers/usart.c @@ -137,7 +137,6 @@ static const struct rt_uart_ops stm32_uart_ops = #if defined(RT_USING_UART1) /* UART1 device driver structure */ -struct serial_ringbuffer uart1_int_rx; struct stm32_uart uart1 = { USART1, @@ -155,7 +154,7 @@ void USART1_IRQHandler(void) rt_interrupt_enter(); if(USART_GetITStatus(uart->uart_device, USART_IT_RXNE) != RESET) { - rt_hw_serial_isr(&serial1); + rt_hw_serial_isr(&serial1, RT_SERIAL_EVENT_RX_IND); /* clear interrupt */ USART_ClearITPendingBit(uart->uart_device, USART_IT_RXNE); } @@ -172,7 +171,6 @@ void USART1_IRQHandler(void) #if defined(RT_USING_UART2) /* UART1 device driver structure */ -struct serial_ringbuffer uart2_int_rx; struct stm32_uart uart2 = { USART2, @@ -190,7 +188,7 @@ void USART2_IRQHandler(void) rt_interrupt_enter(); if(USART_GetITStatus(uart->uart_device, USART_IT_RXNE) != RESET) { - rt_hw_serial_isr(&serial2); + rt_hw_serial_isr(&serial2, RT_SERIAL_EVENT_RX_IND); /* clear interrupt */ USART_ClearITPendingBit(uart->uart_device, USART_IT_RXNE); } @@ -207,7 +205,6 @@ void USART2_IRQHandler(void) #if defined(RT_USING_UART3) /* UART1 device driver structure */ -struct serial_ringbuffer uart3_int_rx; struct stm32_uart uart3 = { USART3, @@ -225,7 +222,7 @@ void USART3_IRQHandler(void) rt_interrupt_enter(); if(USART_GetITStatus(uart->uart_device, USART_IT_RXNE) != RESET) { - rt_hw_serial_isr(&serial3); + rt_hw_serial_isr(&serial3, RT_SERIAL_EVENT_RX_IND); /* clear interrupt */ USART_ClearITPendingBit(uart->uart_device, USART_IT_RXNE); } @@ -329,14 +326,13 @@ void rt_hw_usart_init(void) config.baud_rate = BAUD_RATE_115200; serial1.ops = &stm32_uart_ops; - serial1.int_rx = &uart1_int_rx; serial1.config = config; NVIC_Configuration(&uart1); /* register UART1 device */ rt_hw_serial_register(&serial1, "uart1", - RT_DEVICE_FLAG_RDWR | RT_DEVICE_FLAG_INT_RX | RT_DEVICE_FLAG_STREAM, + RT_DEVICE_FLAG_RDWR | RT_DEVICE_FLAG_INT_RX, uart); #endif /* RT_USING_UART1 */ @@ -345,7 +341,6 @@ void rt_hw_usart_init(void) config.baud_rate = BAUD_RATE_115200; serial2.ops = &stm32_uart_ops; - serial2.int_rx = &uart2_int_rx; serial2.config = config; NVIC_Configuration(&uart2); @@ -362,7 +357,6 @@ void rt_hw_usart_init(void) config.baud_rate = BAUD_RATE_115200; serial3.ops = &stm32_uart_ops; - serial3.int_rx = &uart3_int_rx; serial3.config = config; NVIC_Configuration(&uart3);