2022-11-10 22:22:48 +08:00
|
|
|
/*
|
|
|
|
* Copyright (c) 2006-2021, RT-Thread Development Team
|
|
|
|
*
|
|
|
|
* SPDX-License-Identifier: Apache-2.0
|
|
|
|
*
|
|
|
|
* Email: opensource_embedded@phytium.com.cn
|
|
|
|
*
|
|
|
|
* Change Logs:
|
|
|
|
* Date Author Notes
|
|
|
|
* 2022-10-26 huanghe first commit
|
2023-05-11 10:25:21 +08:00
|
|
|
* 2023-04-27 huanghe support RT-Smart
|
2022-11-10 22:22:48 +08:00
|
|
|
*/
|
|
|
|
|
|
|
|
#ifndef __DRV_USART_H__
|
|
|
|
#define __DRV_USART_H__
|
|
|
|
|
|
|
|
#include <rtthread.h>
|
|
|
|
#include "rtdevice.h"
|
2023-11-21 17:42:23 +08:00
|
|
|
|
2022-11-10 22:22:48 +08:00
|
|
|
#include "fpl011.h"
|
|
|
|
#include "fpl011_hw.h"
|
|
|
|
|
|
|
|
#define RTOS_UART_ISR_OEIM_MASK FPL011IMSC_OEIM /* Overrun error interrupt mask. */
|
|
|
|
#define RTOS_UART_ISR_BEIM_MASK FPL011IMSC_BEIM /* Break error interrupt mask */
|
|
|
|
#define RTOS_UART_ISR_PEIM_MASK FPL011IMSC_PEIM /* Parity error interrupt mask. */
|
|
|
|
#define RTOS_UART_ISR_FEIM_MASK FPL011IMSC_FEIM /* Framing error interrupt mask. */
|
|
|
|
#define RTOS_UART_ISR_RTIM_MASK FPL011IMSC_RTIM /* Receive timeout interrupt mask. */
|
|
|
|
#define RTOS_UART_ISR_TXIM_MASK FPL011IMSC_TXIM /* Transmit interrupt mask. */
|
|
|
|
#define RTOS_UART_ISR_RXIM_MASK FPL011IMSC_RXIM /* Receive interrupt mask. */
|
|
|
|
|
|
|
|
typedef struct
|
|
|
|
{
|
|
|
|
u32 uart_instance; /* select uart global object */
|
|
|
|
u32 isr_priority; /* irq Priority */
|
|
|
|
u32 isr_event_mask; /* followed by RTOS_UART_ISR_XX */
|
|
|
|
u32 uart_baudrate;
|
2023-12-08 17:57:55 +08:00
|
|
|
} FtRtthreadUartConfig;
|
2022-11-10 22:22:48 +08:00
|
|
|
|
|
|
|
struct drv_usart
|
|
|
|
{
|
2023-12-08 17:57:55 +08:00
|
|
|
const char *name;
|
2022-11-10 22:22:48 +08:00
|
|
|
FPl011 *handle;
|
2023-12-08 17:57:55 +08:00
|
|
|
FtRtthreadUartConfig config;
|
2022-11-10 22:22:48 +08:00
|
|
|
struct rt_serial_device serial;
|
|
|
|
};
|
|
|
|
|
2023-12-08 17:57:55 +08:00
|
|
|
#endif // !
|