2022-01-02 09:14:03 +08:00
|
|
|
/*
|
|
|
|
* Copyright (c) 2006-2022, RT-Thread Development Team
|
|
|
|
*
|
|
|
|
* SPDX-License-Identifier: Apache-2.0
|
|
|
|
*
|
|
|
|
* Change Logs:
|
|
|
|
* Date Author Notes
|
2022-06-28 19:43:00 +08:00
|
|
|
* 2022-06-04 BruceOu first implementation
|
2022-01-02 09:14:03 +08:00
|
|
|
*/
|
|
|
|
|
|
|
|
#ifndef __DRV_USART_H__
|
|
|
|
#define __DRV_USART_H__
|
|
|
|
|
|
|
|
#include <rthw.h>
|
|
|
|
#include <rtthread.h>
|
|
|
|
#include <board.h>
|
|
|
|
|
|
|
|
#ifdef __cplusplus
|
|
|
|
extern "C" {
|
|
|
|
#endif
|
|
|
|
|
|
|
|
/* GD32 uart driver */
|
|
|
|
// Todo: compress uart info
|
|
|
|
struct gd32_uart
|
|
|
|
{
|
|
|
|
uint32_t uart_periph; //Todo: 3bits
|
|
|
|
IRQn_Type irqn; //Todo: 7bits
|
|
|
|
rcu_periph_enum per_clk; //Todo: 5bits
|
|
|
|
rcu_periph_enum tx_gpio_clk; //Todo: 5bits
|
|
|
|
rcu_periph_enum rx_gpio_clk; //Todo: 5bits
|
|
|
|
uint32_t tx_port; //Todo: 4bits
|
|
|
|
uint16_t tx_pin; //Todo: 4bits
|
|
|
|
uint32_t rx_port; //Todo: 4bits
|
|
|
|
uint16_t rx_pin; //Todo: 4bits
|
|
|
|
struct rt_serial_device * serial;
|
|
|
|
char *device_name;
|
|
|
|
};
|
|
|
|
|
2022-06-28 19:43:00 +08:00
|
|
|
int rt_hw_usart_init(void);
|
|
|
|
|
2022-01-02 09:14:03 +08:00
|
|
|
#ifdef __cplusplus
|
|
|
|
}
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#endif /* __DRV_USART_H__ */
|