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 <cameledyang@pm.me>
This commit is contained in:
parent
b863420013
commit
3b72a9b2bd
1 changed files with 7 additions and 1 deletions
|
@ -8,6 +8,12 @@
|
||||||
#include <errno.h>
|
#include <errno.h>
|
||||||
#include <drivers/pinctrl.h>
|
#include <drivers/pinctrl.h>
|
||||||
#include <drivers/uart.h>
|
#include <drivers/uart.h>
|
||||||
|
#include <soc.h>
|
||||||
|
|
||||||
|
/* Unify GD32 HAL USART status register name to USART_STAT */
|
||||||
|
#ifndef USART_STAT
|
||||||
|
#define USART_STAT USART_STAT0
|
||||||
|
#endif
|
||||||
|
|
||||||
struct gd32_usart_config {
|
struct gd32_usart_config {
|
||||||
uint32_t reg;
|
uint32_t reg;
|
||||||
|
@ -120,7 +126,7 @@ static void usart_gd32_poll_out(const struct device *dev, unsigned char c)
|
||||||
static int usart_gd32_err_check(const struct device *dev)
|
static int usart_gd32_err_check(const struct device *dev)
|
||||||
{
|
{
|
||||||
const struct gd32_usart_config *const cfg = dev->config;
|
const struct gd32_usart_config *const cfg = dev->config;
|
||||||
uint32_t status = USART_STAT0(cfg->reg);
|
uint32_t status = USART_STAT(cfg->reg);
|
||||||
int errors = 0;
|
int errors = 0;
|
||||||
|
|
||||||
if (status & USART_FLAG_ORERR) {
|
if (status & USART_FLAG_ORERR) {
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue