Skip to content

Commit 16d8d9f

Browse files
committed
drivers: serial: gd32 usart support GD32F350
GD32 HAL use two USART status register name, USART_STAT and USART_STAT0. This add a redefine to make USART_STAT as defaut name. Signed-off-by: HaiLong Yang <[email protected]>
1 parent dfcbf2d commit 16d8d9f

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

drivers/serial/usart_gd32.c

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,12 @@
88
#include <errno.h>
99
#include <drivers/pinctrl.h>
1010
#include <drivers/uart.h>
11+
#include <soc.h>
12+
13+
/* Unify GD32 HAL USART status register name to USART_STAT */
14+
#ifndef USART_STAT
15+
#define USART_STAT USART_STAT0
16+
#endif
1117

1218
struct gd32_usart_config {
1319
uint32_t reg;
@@ -120,7 +126,7 @@ static void usart_gd32_poll_out(const struct device *dev, unsigned char c)
120126
static int usart_gd32_err_check(const struct device *dev)
121127
{
122128
const struct gd32_usart_config *const cfg = dev->config;
123-
uint32_t status = USART_STAT0(cfg->reg);
129+
uint32_t status = USART_STAT(cfg->reg);
124130
int errors = 0;
125131

126132
if (status & USART_FLAG_ORERR) {

0 commit comments

Comments
 (0)