Skip to content

Commit

Permalink
[bsp][gd32]Fix the problem that uartv2 does not enable dma compilatio…
Browse files Browse the repository at this point in the history
…n error.
  • Loading branch information
Rbb666 authored and mysterywolf committed Sep 13, 2024
1 parent f2dc4f1 commit 49c39d4
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 7 deletions.
9 changes: 3 additions & 6 deletions bsp/gd32/arm/libraries/gd32_drivers/drv_usart_v2.c
Original file line number Diff line number Diff line change
Expand Up @@ -878,9 +878,8 @@ static void gd32_dma_config (struct rt_serial_device *serial, rt_ubase_t flag)
static rt_err_t gd32_uart_control (struct rt_serial_device *serial, int cmd, void *arg)
{
struct gd32_uart *uart;
#ifdef RT_SERIAL_USING_DMA

rt_ubase_t ctrl_arg = (rt_ubase_t)arg;
#endif

RT_ASSERT(serial != RT_NULL);
uart = rt_container_of(serial, struct gd32_uart, serial);
Expand Down Expand Up @@ -1027,8 +1026,10 @@ static rt_ssize_t gd32_transmit (struct rt_serial_device *serial, rt_uint8_t *bu

if (uart->uart_dma_flag & RT_DEVICE_FLAG_DMA_TX)
{
#ifdef RT_SERIAL_USING_DMA
_uart_dma_transmit(uart, buf, size);
return size;
#endif
}

gd32_uart_control(serial, RT_DEVICE_CTRL_SET_INT, (void *)tx_flag);
Expand All @@ -1041,11 +1042,7 @@ static const struct rt_uart_ops gd32_uart_ops =
.control = gd32_uart_control,
.putc = gd32_uart_putc,
.getc = gd32_uart_getc,
#ifdef RT_SERIAL_USING_DMA
.transmit = gd32_transmit,
#else
.transmit = RT_NULL,
#endif
};

static void gd32_uart_get_config (void)
Expand Down
2 changes: 1 addition & 1 deletion bsp/gd32/arm/libraries/gd32_drivers/drv_usart_v2.h
Original file line number Diff line number Diff line change
Expand Up @@ -52,8 +52,8 @@ struct gd32_uart
rt_size_t last_index;
rt_sem_t sem_ftf;
} dma;
rt_uint16_t uart_dma_flag;
#endif
rt_uint16_t uart_dma_flag;
};

int rt_hw_usart_init(void);
Expand Down

0 comments on commit 49c39d4

Please sign in to comment.