[bsp][gd32]Fix the problem that uartv2 does not enable dma compilation error.

This commit is contained in:
Rbb666 2024-09-13 15:31:32 +08:00 committed by Meco Man
parent f2dc4f13cb
commit 49c39d4a8d
2 changed files with 4 additions and 7 deletions

View File

@ -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);
@ -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);
@ -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)

View File

@ -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);