补充uart驱动
parent
8440b0bd8e
commit
5268ba70a0
|
@ -2,8 +2,8 @@
|
||||||
* @Description:
|
* @Description:
|
||||||
* @Date: 2022-01-10 17:36:06
|
* @Date: 2022-01-10 17:36:06
|
||||||
* @LastEditors: CK.Zh
|
* @LastEditors: CK.Zh
|
||||||
* @LastEditTime: 2022-01-10 19:53:36
|
* @LastEditTime: 2022-01-10 22:04:13
|
||||||
* @FilePath: /motion_ec_rtt/drivers/drv_usart.c
|
* @FilePath: /motion_ec/drivers/drv_usart.c
|
||||||
*/
|
*/
|
||||||
/*
|
/*
|
||||||
*
|
*
|
||||||
|
@ -23,8 +23,8 @@
|
||||||
#ifdef BSP_USING_UART
|
#ifdef BSP_USING_UART
|
||||||
|
|
||||||
#if !defined(BSP_USING_UART0) && !defined(BSP_USING_UART1) && !defined(BSP_USING_UART2) && \
|
#if !defined(BSP_USING_UART0) && !defined(BSP_USING_UART1) && !defined(BSP_USING_UART2) && \
|
||||||
!defined(BSP_USING_UART3)
|
!defined(BSP_USING_UART3) && !defined(BSP_USING_LPUART0) && !defined(BSP_USING_LPUART1)
|
||||||
#error "Please define at least one BSP_USING_UARTx"
|
#error "Please define at least one BSP_USING_UARTx or BSP_USING_LPUARTx"
|
||||||
/* this driver can be disabled at menuconfig -> RT-Thread Components -> Device Drivers */
|
/* this driver can be disabled at menuconfig -> RT-Thread Components -> Device Drivers */
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
@ -42,6 +42,12 @@ enum
|
||||||
#ifdef BSP_USING_UART3
|
#ifdef BSP_USING_UART3
|
||||||
UART3_INDEX,
|
UART3_INDEX,
|
||||||
#endif
|
#endif
|
||||||
|
#ifdef BSP_USING_LPUART0
|
||||||
|
LPUART0_INDEX,
|
||||||
|
#endif
|
||||||
|
#ifdef BSP_USING_LPUART1
|
||||||
|
LPUART1_INDEX,
|
||||||
|
#endif
|
||||||
};
|
};
|
||||||
|
|
||||||
static struct hc_uart_cfg uart_cfg[] =
|
static struct hc_uart_cfg uart_cfg[] =
|
||||||
|
@ -287,6 +293,33 @@ void Uart3_IRQHandler(void)
|
||||||
}
|
}
|
||||||
#endif /* BSP_USING_UART3 */
|
#endif /* BSP_USING_UART3 */
|
||||||
|
|
||||||
|
#if defined(BSP_USING_LPUART0)
|
||||||
|
void LpUart0_IRQHandler(void)
|
||||||
|
{
|
||||||
|
/* enter interrupt */
|
||||||
|
rt_interrupt_enter();
|
||||||
|
|
||||||
|
rt_hw_uart_isr(&(uart_drv[LPUART0_INDEX].serial_device));
|
||||||
|
|
||||||
|
/* leave interrupt */
|
||||||
|
rt_interrupt_leave();
|
||||||
|
}
|
||||||
|
#endif /* BSP_USING_LPUART0 */
|
||||||
|
|
||||||
|
#if defined(BSP_USING_LPUART1)
|
||||||
|
void LpUart1_IRQHandler(void)
|
||||||
|
{
|
||||||
|
/* enter interrupt */
|
||||||
|
rt_interrupt_enter();
|
||||||
|
|
||||||
|
rt_hw_uart_isr(&(uart_drv[LPUART1_INDEX].serial_device));
|
||||||
|
|
||||||
|
/* leave interrupt */
|
||||||
|
rt_interrupt_leave();
|
||||||
|
}
|
||||||
|
#endif /* BSP_USING_LPUART1 */
|
||||||
|
|
||||||
|
|
||||||
int rt_hw_uart_init(void)
|
int rt_hw_uart_init(void)
|
||||||
{
|
{
|
||||||
struct serial_configure cfg = RT_SERIAL_CONFIG_DEFAULT;
|
struct serial_configure cfg = RT_SERIAL_CONFIG_DEFAULT;
|
||||||
|
|
Loading…
Reference in New Issue