blob: 7f221a9c1f1b7115d666546f74812199f929f117 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
|
/*
* Copyright (c) 2006-2025, RT-Thread Development Team
*
* SPDX-License-Identifier: Apache-2.0
*
* Change Logs:
* Date Author Notes
* 2024-03-19 Evlers first implementation
*/
#ifndef __DRV_USART_V2_H__
#define __DRV_USART_V2_H__
#include <rthw.h>
#include <rtthread.h>
#include <rtdevice.h>
#include <board.h>
#include "drv_dma.h"
#ifdef __cplusplus
extern "C" {
#endif
/* GD32 uart driver */
struct gd32_uart
{
char *device_name;
uint32_t periph;
IRQn_Type irqn;
rcu_periph_enum per_clk;
rcu_periph_enum tx_gpio_clk;
rcu_periph_enum rx_gpio_clk;
uint32_t tx_port;
#if defined SOC_SERIES_GD32F4xx || defined SOC_SERIES_GD32E23x || defined SOC_SERIES_GD32F5xx
uint16_t tx_af;
#endif
uint16_t tx_pin;
uint32_t rx_port;
#if defined SOC_SERIES_GD32F4xx || defined SOC_SERIES_GD32E23x || defined SOC_SERIES_GD32F5xx
uint16_t rx_af;
#endif
uint16_t rx_pin;
struct rt_serial_device serial;
#ifdef RT_SERIAL_USING_DMA
struct
{
struct dma_config rx;
struct dma_config tx;
rt_size_t last_index;
rt_sem_t sem_ftf;
} dma;
#endif
rt_uint16_t uart_dma_flag;
};
int rt_hw_usart_init(void);
#ifdef __cplusplus
}
#endif
#endif /* __DRV_USART_V2_H__ */
|