[serialX]fix error
This commit is contained in:
parent
ec835e7bf6
commit
080eb7ac58
|
@ -426,10 +426,11 @@ static void stm32_stop_dma_tx(struct rt_serial_device *serial)
|
||||||
RT_ASSERT(serial != RT_NULL);
|
RT_ASSERT(serial != RT_NULL);
|
||||||
|
|
||||||
uart = rt_container_of(serial, struct stm32_uart, serial);
|
uart = rt_container_of(serial, struct stm32_uart, serial);
|
||||||
|
#if 0
|
||||||
if ((uart->dma_tx.handle.Instance->CR & DMA_SxCR_EN) == DMA_SxCR_EN) {
|
if ((uart->dma_tx.handle.Instance->CR & DMA_SxCR_EN) == DMA_SxCR_EN) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
__HAL_DMA_DISABLE(&uart->dma_tx.handle);
|
__HAL_DMA_DISABLE(&uart->dma_tx.handle);
|
||||||
uart->dmaTxing = RT_FALSE;
|
uart->dmaTxing = RT_FALSE;
|
||||||
}
|
}
|
||||||
|
@ -634,7 +635,35 @@ static void stm32_uart_get_dma_config(void)
|
||||||
static struct dma_config uart1_dma_tx = UART1_DMA_TX_CONFIG;
|
static struct dma_config uart1_dma_tx = UART1_DMA_TX_CONFIG;
|
||||||
uart_config[UART1_INDEX].dma_conf_tx = &uart1_dma_tx;
|
uart_config[UART1_INDEX].dma_conf_tx = &uart1_dma_tx;
|
||||||
#endif
|
#endif
|
||||||
|
#endif // BSP_USING_UART1
|
||||||
|
|
||||||
|
#ifdef BSP_USING_UART2
|
||||||
|
uart_obj[UART2_INDEX].uart_dma_flag = 0;
|
||||||
|
#ifdef BSP_UART2_RX_USING_DMA
|
||||||
|
uart_obj[UART2_INDEX].uart_dma_flag |= RT_DEVICE_FLAG_DMA_RX;
|
||||||
|
static struct dma_config uart2_dma_rx = UART2_DMA_RX_CONFIG;
|
||||||
|
uart_config[UART2_INDEX].dma_conf_rx = &uart2_dma_rx;
|
||||||
#endif
|
#endif
|
||||||
|
#ifdef BSP_UART2_TX_USING_DMA
|
||||||
|
uart_obj[UART2_INDEX].uart_dma_flag |= RT_DEVICE_FLAG_DMA_TX;
|
||||||
|
static struct dma_config uart2_dma_tx = UART2_DMA_TX_CONFIG;
|
||||||
|
uart_config[UART2_INDEX].dma_conf_tx = &uart2_dma_tx;
|
||||||
|
#endif
|
||||||
|
#endif // BSP_USING_UART2
|
||||||
|
|
||||||
|
#ifdef BSP_USING_UART3
|
||||||
|
uart_obj[UART3_INDEX].uart_dma_flag = 0;
|
||||||
|
#ifdef BSP_UART3_RX_USING_DMA
|
||||||
|
uart_obj[UART3_INDEX].uart_dma_flag |= RT_DEVICE_FLAG_DMA_RX;
|
||||||
|
static struct dma_config uart3_dma_rx = UART3_DMA_RX_CONFIG;
|
||||||
|
uart_config[UART3_INDEX].dma_conf_rx = &uart3_dma_rx;
|
||||||
|
#endif
|
||||||
|
#ifdef BSP_UART3_TX_USING_DMA
|
||||||
|
uart_obj[UART3_INDEX].uart_dma_flag |= RT_DEVICE_FLAG_DMA_TX;
|
||||||
|
static struct dma_config uart3_dma_tx = UART3_DMA_TX_CONFIG;
|
||||||
|
uart_config[UART3_INDEX].dma_conf_tx = &uart3_dma_tx;
|
||||||
|
#endif
|
||||||
|
#endif // BSP_USING_UART3
|
||||||
}
|
}
|
||||||
|
|
||||||
static void stm32_dma_rx_config(struct rt_serial_device *serial)
|
static void stm32_dma_rx_config(struct rt_serial_device *serial)
|
||||||
|
|
|
@ -0,0 +1,19 @@
|
||||||
|
/*
|
||||||
|
* Copyright (c) 2006-2023, RT-Thread Development Team
|
||||||
|
*
|
||||||
|
* SPDX-License-Identifier: Apache-2.0
|
||||||
|
*
|
||||||
|
* Change Logs:
|
||||||
|
* Date Author Notes
|
||||||
|
* 2024-8-25 Dongly Update from upstreme
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifndef __CLASS_SERIAL_H__
|
||||||
|
#define __CLASS_SERIAL_H__
|
||||||
|
|
||||||
|
#include <rtdef.h>
|
||||||
|
|
||||||
|
/* serialX device*/
|
||||||
|
#define RT_DEVICE_CTRL_TIMEOUT 0x30 /**< timeout for blocking */
|
||||||
|
|
||||||
|
#endif /* __CLASS_SERIAL_H__ */
|
|
@ -88,6 +88,7 @@ extern "C" {
|
||||||
|
|
||||||
#ifdef RT_USING_SERIAL
|
#ifdef RT_USING_SERIAL
|
||||||
#ifdef RT_USING_SERIAL_X
|
#ifdef RT_USING_SERIAL_X
|
||||||
|
#include <drivers/classes/serial.h>
|
||||||
#include "drivers/serialX.h"
|
#include "drivers/serialX.h"
|
||||||
#elif defined RT_USING_SERIAL_V2
|
#elif defined RT_USING_SERIAL_V2
|
||||||
#include "drivers/serial_v2.h"
|
#include "drivers/serial_v2.h"
|
||||||
|
|
|
@ -13,7 +13,7 @@ menuconfig RT_USING_SERIAL
|
||||||
config RT_USING_SERIAL_V2
|
config RT_USING_SERIAL_V2
|
||||||
bool "RT_USING_SERIAL_V2"
|
bool "RT_USING_SERIAL_V2"
|
||||||
config RT_USING_SERIAL_X
|
config RT_USING_SERIAL_X
|
||||||
bool "RT_USING_SERIAL"
|
bool "RT_USING_SERIAL_X"
|
||||||
help
|
help
|
||||||
A serial driver that supporting True NonBlock
|
A serial driver that supporting True NonBlock
|
||||||
endchoice
|
endchoice
|
||||||
|
|
|
@ -3,6 +3,7 @@ from building import *
|
||||||
cwd = GetCurrentDir()
|
cwd = GetCurrentDir()
|
||||||
CPPPATH = [cwd + '/../include']
|
CPPPATH = [cwd + '/../include']
|
||||||
group = []
|
group = []
|
||||||
|
src = []
|
||||||
|
|
||||||
if not GetDepend(['RT_USING_SERIAL']):
|
if not GetDepend(['RT_USING_SERIAL']):
|
||||||
Return('group')
|
Return('group')
|
||||||
|
@ -14,7 +15,6 @@ if GetDepend(['RT_USING_SERIAL_V2']):
|
||||||
src += ['serial_v2.c']
|
src += ['serial_v2.c']
|
||||||
elif GetDepend(['RT_USING_SERIAL_X']):
|
elif GetDepend(['RT_USING_SERIAL_X']):
|
||||||
src += ['serialX.c']
|
src += ['serialX.c']
|
||||||
|
|
||||||
else:
|
else:
|
||||||
src += ['serial.c']
|
src += ['serial.c']
|
||||||
|
|
||||||
|
|
|
@ -11,7 +11,7 @@ RT-Thread 论坛上有几篇介绍和讲解 serialX 的文章,使用 serialX
|
||||||
|
|
||||||
### 串口驱动框架和硬件底层接口功能定义详解
|
### 串口驱动框架和硬件底层接口功能定义详解
|
||||||
|
|
||||||
```
|
```c
|
||||||
struct rt_uart_ops
|
struct rt_uart_ops
|
||||||
{
|
{
|
||||||
// 配置外设寄存器设置默认波特率等;外设时钟配置、引脚功能复用(如果还没配置过);启用外设等等
|
// 配置外设寄存器设置默认波特率等;外设时钟配置、引脚功能复用(如果还没配置过);启用外设等等
|
||||||
|
|
Loading…
Reference in New Issue