Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
红岛
rt-thread
提交
d94be14d
R
rt-thread
项目概览
红岛
/
rt-thread
与 Fork 源项目一致
Fork自
RT-Thread / rt-thread
通知
1
Star
1
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
1
列表
看板
标记
里程碑
合并请求
0
DevOps
流水线
流水线任务
计划
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
R
rt-thread
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
1
Issue
1
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
DevOps
DevOps
流水线
流水线任务
计划
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
流水线任务
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
提交
d94be14d
编写于
6月 05, 2021
作者:
C
chenjh
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
[serial] 增加serial_v2版本的框架和基于stm32的串口驱动
上级
5c8625c8
变更
13
展开全部
隐藏空白更改
内联
并排
Showing
13 changed file
with
2973 addition
and
44 deletion
+2973
-44
bsp/stm32/libraries/HAL_Drivers/SConscript
bsp/stm32/libraries/HAL_Drivers/SConscript
+4
-1
bsp/stm32/libraries/HAL_Drivers/config/l4/dma_config.h
bsp/stm32/libraries/HAL_Drivers/config/l4/dma_config.h
+11
-0
bsp/stm32/libraries/HAL_Drivers/drv_common.c
bsp/stm32/libraries/HAL_Drivers/drv_common.c
+4
-0
bsp/stm32/libraries/HAL_Drivers/drv_usart_v2.c
bsp/stm32/libraries/HAL_Drivers/drv_usart_v2.c
+1137
-0
bsp/stm32/libraries/HAL_Drivers/drv_usart_v2.h
bsp/stm32/libraries/HAL_Drivers/drv_usart_v2.h
+83
-0
bsp/stm32/stm32l475-atk-pandora/.config
bsp/stm32/stm32l475-atk-pandora/.config
+250
-13
bsp/stm32/stm32l475-atk-pandora/board/Kconfig
bsp/stm32/stm32l475-atk-pandora/board/Kconfig
+49
-13
bsp/stm32/stm32l475-atk-pandora/rtconfig.h
bsp/stm32/stm32l475-atk-pandora/rtconfig.h
+40
-3
components/drivers/Kconfig
components/drivers/Kconfig
+19
-11
components/drivers/include/drivers/serial_v2.h
components/drivers/include/drivers/serial_v2.h
+193
-0
components/drivers/include/rtdevice.h
components/drivers/include/rtdevice.h
+4
-0
components/drivers/serial/SConscript
components/drivers/serial/SConscript
+8
-3
components/drivers/serial/serial_v2.c
components/drivers/serial/serial_v2.c
+1171
-0
未找到文件。
bsp/stm32/libraries/HAL_Drivers/SConscript
浏览文件 @
d94be14d
...
...
@@ -12,7 +12,10 @@ if GetDepend(['RT_USING_PIN']):
src
+=
[
'drv_gpio.c'
]
if
GetDepend
([
'RT_USING_SERIAL'
]):
src
+=
[
'drv_usart.c'
]
if
GetDepend
([
'RT_USING_SERIAL_V2'
]):
src
+=
[
'drv_usart_v2.c'
]
else
:
src
+=
[
'drv_usart.c'
]
if
GetDepend
([
'RT_USING_HWTIMER'
]):
src
+=
[
'drv_hwtimer.c'
]
...
...
bsp/stm32/libraries/HAL_Drivers/config/l4/dma_config.h
浏览文件 @
d94be14d
...
...
@@ -127,6 +127,17 @@ extern "C" {
#endif
/* DMA1 channel7 */
#if defined(BSP_UART2_TX_USING_DMA) && !defined(UART2_TX_DMA_INSTANCE)
#define UART2_DMA_TX_IRQHandler DMA1_Channel7_IRQHandler
#define UART2_TX_DMA_RCC RCC_AHB1ENR_DMA1EN
#define UART2_TX_DMA_INSTANCE DMA1_Channel7
#if defined(DMAMUX1)
/* for L4+ */
#define UART2_TX_DMA_REQUEST DMA_REQUEST_USART2_TX
#else
/* for L4 */
#define UART2_TX_DMA_REQUEST DMA_REQUEST_2
#endif
/* DMAMUX1 */
#define UART2_TX_DMA_IRQ DMA1_Channel7_IRQn
#endif
/* DMA2 channel1 */
#if defined(BSP_UART5_TX_USING_DMA) && !defined(UART5_TX_DMA_INSTANCE)
...
...
bsp/stm32/libraries/HAL_Drivers/drv_common.c
浏览文件 @
d94be14d
...
...
@@ -12,8 +12,12 @@
#include "board.h"
#ifdef RT_USING_SERIAL
#ifdef RT_USING_SERIAL_V2
#include "drv_usart_v2.h"
#else
#include "drv_usart.h"
#endif
#endif
#ifdef RT_USING_FINSH
#include <finsh.h>
...
...
bsp/stm32/libraries/HAL_Drivers/drv_usart_v2.c
0 → 100644
浏览文件 @
d94be14d
此差异已折叠。
点击以展开。
bsp/stm32/libraries/HAL_Drivers/drv_usart_v2.h
0 → 100644
浏览文件 @
d94be14d
/*
* Copyright (c) 2006-2018, RT-Thread Development Team
*
* SPDX-License-Identifier: Apache-2.0
*
* Change Logs:
* Date Author Notes
* 2021-06-01 KyleChan first version
*/
#ifndef __DRV_USART_V2_H__
#define __DRV_USART_V2_H__
#include <rtthread.h>
#include <rtdevice.h>
#include <rthw.h>
#include <drv_common.h>
#include <drv_dma.h>
#include <drv_config.h>
int
rt_hw_usart_init
(
void
);
#if defined(SOC_SERIES_STM32L4) || defined(SOC_SERIES_STM32F7) || defined(SOC_SERIES_STM32F0) \
|| defined(SOC_SERIES_STM32L0) || defined(SOC_SERIES_STM32G0) || defined(SOC_SERIES_STM32H7) \
|| defined(SOC_SERIES_STM32G4)
#define UART_SET_TDR(__HANDLE__, __DATA__) ((__HANDLE__)->Instance->TDR = (__DATA__))
#define UART_GET_RDR(__HANDLE__) ((__HANDLE__)->Instance->RDR & 0xFF)
#else
#define UART_SET_TDR(__HANDLE__, __DATA__) ((__HANDLE__)->Instance->DR = (__DATA__))
#define UART_GET_RDR(__HANDLE__) (return (__HANDLE__)->Instance->DR & 0xFF))
#endif
#if defined(SOC_SERIES_STM32F1) || defined(SOC_SERIES_STM32L4) || defined(SOC_SERIES_STM32F2) \
|| defined(SOC_SERIES_STM32F4) || defined(SOC_SERIES_STM32L0) || defined(SOC_SERIES_STM32G0) \
|| defined(SOC_SERIES_STM32G4) || defined(SOC_SERIES_STM32WB)
#define UART_INSTANCE_CLEAR_FUNCTION __HAL_UART_CLEAR_FLAG
#elif defined(SOC_SERIES_STM32F7) || defined(SOC_SERIES_STM32F0) || defined(SOC_SERIES_STM32H7) \
|| defined(SOC_SERIES_STM32MP1)
#define UART_INSTANCE_CLEAR_FUNCTION __HAL_UART_CLEAR_IT
#endif
#define UART_RX_DMA_IT_IDLE_FLAG 0x00
#define UART_RX_DMA_IT_HT_FLAG 0x01
#define UART_RX_DMA_IT_TC_FLAG 0x02
/* stm32 config class */
struct
stm32_uart_config
{
const
char
*
name
;
USART_TypeDef
*
Instance
;
IRQn_Type
irq_type
;
#ifdef RT_SERIAL_USING_DMA
struct
dma_config
*
dma_rx
;
struct
dma_config
*
dma_tx
;
#endif
};
/* stm32 uart dirver class */
struct
stm32_uart
{
UART_HandleTypeDef
handle
;
struct
stm32_uart_config
*
config
;
#ifdef RT_SERIAL_USING_DMA
struct
{
DMA_HandleTypeDef
handle
;
rt_size_t
remaining_cnt
;
}
dma_rx
;
struct
{
DMA_HandleTypeDef
handle
;
}
dma_tx
;
#endif
rt_uint16_t
uart_dma_flag
;
struct
rt_serial_device
serial
;
};
#endif
/* __DRV_USART_H__ */
bsp/stm32/stm32l475-atk-pandora/.config
浏览文件 @
d94be14d
...
...
@@ -21,6 +21,12 @@ CONFIG_RT_USING_IDLE_HOOK=y
CONFIG_RT_IDLE_HOOK_LIST_SIZE
=
4
CONFIG_IDLE_THREAD_STACK_SIZE
=
256
# CONFIG_RT_USING_TIMER_SOFT is not set
#
# kservice optimization
#
# CONFIG_RT_KSERVICE_USING_STDLIB is not set
# CONFIG_RT_KSERVICE_USING_TINY_SIZE is not set
CONFIG_RT_DEBUG
=
y
CONFIG_RT_DEBUG_COLOR
=
y
# CONFIG_RT_DEBUG_INIT_CONFIG is not set
...
...
@@ -52,6 +58,7 @@ CONFIG_RT_USING_MEMPOOL=y
# CONFIG_RT_USING_NOHEAP is not set
CONFIG_RT_USING_SMALL_MEM
=
y
# CONFIG_RT_USING_SLAB is not set
# CONFIG_RT_USING_USERHEAP is not set
# CONFIG_RT_USING_MEMTRACE is not set
CONFIG_RT_USING_HEAP
=
y
...
...
@@ -64,7 +71,7 @@ CONFIG_RT_USING_DEVICE=y
CONFIG_RT_USING_CONSOLE
=
y
CONFIG_RT_CONSOLEBUF_SIZE
=
256
CONFIG_RT_CONSOLE_DEVICE_NAME
=
"uart1"
CONFIG_RT_VER_NUM
=
0
x4000
2
CONFIG_RT_VER_NUM
=
0
x4000
4
CONFIG_ARCH_ARM
=
y
CONFIG_RT_USING_CPU_FFS
=
y
CONFIG_ARCH_ARM_CORTEX_M
=
y
...
...
@@ -115,14 +122,17 @@ CONFIG_RT_USING_DEVICE_IPC=y
CONFIG_RT_PIPE_BUFSZ
=
512
# CONFIG_RT_USING_SYSTEM_WORKQUEUE is not set
CONFIG_RT_USING_SERIAL
=
y
# CONFIG_RT_USING_SERIAL_V1 is not set
CONFIG_RT_USING_SERIAL_V2
=
y
CONFIG_RT_SERIAL_USING_DMA
=
y
CONFIG_RT_SERIAL_RB_BUFSZ
=
64
# CONFIG_RT_USING_CAN is not set
# CONFIG_RT_USING_HWTIMER is not set
# CONFIG_RT_USING_CPUTIME is not set
# CONFIG_RT_USING_I2C is not set
# CONFIG_RT_USING_PHY is not set
CONFIG_RT_USING_PIN
=
y
# CONFIG_RT_USING_ADC is not set
# CONFIG_RT_USING_DAC is not set
# CONFIG_RT_USING_PWM is not set
# CONFIG_RT_USING_MTD_NOR is not set
# CONFIG_RT_USING_MTD_NAND is not set
...
...
@@ -135,7 +145,7 @@ CONFIG_RT_USING_PIN=y
# CONFIG_RT_USING_SENSOR is not set
# CONFIG_RT_USING_TOUCH is not set
# CONFIG_RT_USING_HWCRYPTO is not set
# CONFIG_RT_USING_ENCODER is not set
# CONFIG_RT_USING_
PULSE_
ENCODER is not set
# CONFIG_RT_USING_INPUT_CAPTURE is not set
# CONFIG_RT_USING_WIFI is not set
...
...
@@ -150,7 +160,7 @@ CONFIG_RT_USING_PIN=y
#
# CONFIG_RT_USING_LIBC is not set
# CONFIG_RT_USING_PTHREADS is not set
CONFIG_RT_LIBC_USING_TIME
=
y
# CONFIG_RT_LIBC_USING_TIME is not set
#
# Network
...
...
@@ -187,8 +197,28 @@ CONFIG_RT_LIBC_USING_TIME=y
# CONFIG_RT_USING_RYM is not set
# CONFIG_RT_USING_ULOG is not set
# CONFIG_RT_USING_UTEST is not set
CONFIG_RT_USING_RT_LINK
=
y
CONFIG_RT_LINK_USING_SF_CRC
=
y
# CONFIG_RT_LINK_USING_HW_CRC is not set
#
# rt-link hardware device configuration
#
CONFIG_RT_LINK_HW_DEVICE_NAME
=
"uart2"
CONFIG_RT_LINK_USING_UART
=
y
#
# rt link debug option
#
# CONFIG_USING_RT_LINK_DEBUG is not set
# CONFIG_USING_RT_LINK_HW_DEBUG is not set
# CONFIG_RT_USING_LWP is not set
#
# RT-Thread Utestcases
#
# CONFIG_RT_USING_UTESTCASES is not set
#
# RT-Thread online packages
#
...
...
@@ -196,10 +226,15 @@ CONFIG_RT_LIBC_USING_TIME=y
#
# IoT - internet of things
#
# CONFIG_PKG_USING_LORAWAN_DRIVER is not set
# CONFIG_PKG_USING_PAHOMQTT is not set
# CONFIG_PKG_USING_UMQTT is not set
# CONFIG_PKG_USING_WEBCLIENT is not set
# CONFIG_PKG_USING_WEBNET is not set
# CONFIG_PKG_USING_MONGOOSE is not set
# CONFIG_PKG_USING_MYMQTT is not set
# CONFIG_PKG_USING_KAWAII_MQTT is not set
# CONFIG_PKG_USING_BC28_MQTT is not set
# CONFIG_PKG_USING_WEBTERMINAL is not set
# CONFIG_PKG_USING_CJSON is not set
# CONFIG_PKG_USING_JSMN is not set
...
...
@@ -226,6 +261,8 @@ CONFIG_RT_LIBC_USING_TIME=y
# CONFIG_PKG_USING_COAP is not set
# CONFIG_PKG_USING_NOPOLL is not set
# CONFIG_PKG_USING_NETUTILS is not set
# CONFIG_PKG_USING_CMUX is not set
# CONFIG_PKG_USING_PPP_DEVICE is not set
# CONFIG_PKG_USING_AT_DEVICE is not set
# CONFIG_PKG_USING_ATSRV_SOCKET is not set
# CONFIG_PKG_USING_WIZNET is not set
...
...
@@ -237,7 +274,10 @@ CONFIG_RT_LIBC_USING_TIME=y
# CONFIG_PKG_USING_GAGENT_CLOUD is not set
# CONFIG_PKG_USING_ALI_IOTKIT is not set
# CONFIG_PKG_USING_AZURE is not set
# CONFIG_PKG_USING_TENCENT_IOTHUB is not set
# CONFIG_PKG_USING_TENCENT_IOT_EXPLORER is not set
# CONFIG_PKG_USING_JIOT-C-SDK is not set
# CONFIG_PKG_USING_UCLOUD_IOT_SDK is not set
# CONFIG_PKG_USING_JOYLINK is not set
# CONFIG_PKG_USING_NIMBLE is not set
# CONFIG_PKG_USING_OTA_DOWNLOADER is not set
# CONFIG_PKG_USING_IPMSG is not set
...
...
@@ -246,8 +286,23 @@ CONFIG_RT_LIBC_USING_TIME=y
# CONFIG_PKG_USING_LIBRWS is not set
# CONFIG_PKG_USING_TCPSERVER is not set
# CONFIG_PKG_USING_PROTOBUF_C is not set
# CONFIG_PKG_USING_ONNX_PARSER is not set
# CONFIG_PKG_USING_ONNX_BACKEND is not set
# CONFIG_PKG_USING_DLT645 is not set
# CONFIG_PKG_USING_QXWZ is not set
# CONFIG_PKG_USING_SMTP_CLIENT is not set
# CONFIG_PKG_USING_ABUP_FOTA is not set
# CONFIG_PKG_USING_LIBCURL2RTT is not set
# CONFIG_PKG_USING_CAPNP is not set
# CONFIG_PKG_USING_RT_CJSON_TOOLS is not set
# CONFIG_PKG_USING_AGILE_TELNET is not set
# CONFIG_PKG_USING_NMEALIB is not set
# CONFIG_PKG_USING_AGILE_JSMN is not set
# CONFIG_PKG_USING_PDULIB is not set
# CONFIG_PKG_USING_BTSTACK is not set
# CONFIG_PKG_USING_LORAWAN_ED_STACK is not set
# CONFIG_PKG_USING_WAYZ_IOTKIT is not set
# CONFIG_PKG_USING_MAVLINK is not set
# CONFIG_PKG_USING_RAPIDJSON is not set
# CONFIG_PKG_USING_BSAL is not set
#
# security packages
...
...
@@ -255,6 +310,8 @@ CONFIG_RT_LIBC_USING_TIME=y
# CONFIG_PKG_USING_MBEDTLS is not set
# CONFIG_PKG_USING_libsodium is not set
# CONFIG_PKG_USING_TINYCRYPT is not set
# CONFIG_PKG_USING_TFM is not set
# CONFIG_PKG_USING_YD_CRYPTO is not set
#
# language packages
...
...
@@ -270,6 +327,10 @@ CONFIG_RT_LIBC_USING_TIME=y
# CONFIG_PKG_USING_MUPDF is not set
# CONFIG_PKG_USING_STEMWIN is not set
# CONFIG_PKG_USING_WAVPLAYER is not set
# CONFIG_PKG_USING_TJPGD is not set
# CONFIG_PKG_USING_HELIX is not set
# CONFIG_PKG_USING_AZUREGUIX is not set
# CONFIG_PKG_USING_TOUCHGFX2RTT is not set
#
# tools packages
...
...
@@ -281,7 +342,31 @@ CONFIG_RT_LIBC_USING_TIME=y
# CONFIG_PKG_USING_RDB is not set
# CONFIG_PKG_USING_QRCODE is not set
# CONFIG_PKG_USING_ULOG_EASYFLASH is not set
# CONFIG_PKG_USING_ULOG_FILE is not set
# CONFIG_PKG_USING_LOGMGR is not set
# CONFIG_PKG_USING_ADBD is not set
# CONFIG_PKG_USING_COREMARK is not set
# CONFIG_PKG_USING_DHRYSTONE is not set
# CONFIG_PKG_USING_MEMORYPERF is not set
# CONFIG_PKG_USING_NR_MICRO_SHELL is not set
# CONFIG_PKG_USING_CHINESE_FONT_LIBRARY is not set
# CONFIG_PKG_USING_LUNAR_CALENDAR is not set
# CONFIG_PKG_USING_BS8116A is not set
# CONFIG_PKG_USING_GPS_RMC is not set
# CONFIG_PKG_USING_URLENCODE is not set
# CONFIG_PKG_USING_UMCN is not set
# CONFIG_PKG_USING_LWRB2RTT is not set
# CONFIG_PKG_USING_CPU_USAGE is not set
# CONFIG_PKG_USING_GBK2UTF8 is not set
# CONFIG_PKG_USING_VCONSOLE is not set
# CONFIG_PKG_USING_KDB is not set
# CONFIG_PKG_USING_WAMR is not set
# CONFIG_PKG_USING_MICRO_XRCE_DDS_CLIENT is not set
# CONFIG_PKG_USING_LWLOG is not set
# CONFIG_PKG_USING_ANV_TRACE is not set
# CONFIG_PKG_USING_ANV_MEMLEAK is not set
# CONFIG_PKG_USING_ANV_TESTSUIT is not set
# CONFIG_PKG_USING_ANV_BENCH is not set
#
# system packages
...
...
@@ -293,14 +378,43 @@ CONFIG_RT_LIBC_USING_TIME=y
# CONFIG_PKG_USING_LWEXT4 is not set
# CONFIG_PKG_USING_PARTITION is not set
# CONFIG_PKG_USING_FAL is not set
# CONFIG_PKG_USING_FLASHDB is not set
# CONFIG_PKG_USING_SQLITE is not set
# CONFIG_PKG_USING_RTI is not set
# CONFIG_PKG_USING_LITTLEVGL2RTT is not set
# CONFIG_PKG_USING_CMSIS is not set
# CONFIG_PKG_USING_DFS_YAFFS is not set
# CONFIG_PKG_USING_LITTLEFS is not set
# CONFIG_PKG_USING_DFS_JFFS2 is not set
# CONFIG_PKG_USING_DFS_UFFS is not set
# CONFIG_PKG_USING_THREAD_POOL is not set
# CONFIG_PKG_USING_ROBOTS is not set
# CONFIG_PKG_USING_EV is not set
# CONFIG_PKG_USING_SYSWATCH is not set
# CONFIG_PKG_USING_SYS_LOAD_MONITOR is not set
# CONFIG_PKG_USING_PLCCORE is not set
# CONFIG_PKG_USING_RAMDISK is not set
# CONFIG_PKG_USING_MININI is not set
# CONFIG_PKG_USING_QBOOT is not set
#
# Micrium: Micrium software products porting for RT-Thread
#
# CONFIG_PKG_USING_UCOSIII_WRAPPER is not set
# CONFIG_PKG_USING_UCOSII_WRAPPER is not set
# CONFIG_PKG_USING_UC_CRC is not set
# CONFIG_PKG_USING_UC_CLK is not set
# CONFIG_PKG_USING_UC_COMMON is not set
# CONFIG_PKG_USING_UC_MODBUS is not set
# CONFIG_PKG_USING_PPOOL is not set
# CONFIG_PKG_USING_OPENAMP is not set
# CONFIG_PKG_USING_RT_KPRINTF_THREADSAFE is not set
# CONFIG_PKG_USING_RT_MEMCPY_CM is not set
# CONFIG_PKG_USING_QFPLIB_M0_FULL is not set
# CONFIG_PKG_USING_QFPLIB_M0_TINY is not set
# CONFIG_PKG_USING_QFPLIB_M3 is not set
# CONFIG_PKG_USING_LPM is not set
# CONFIG_PKG_USING_TLSF is not set
#
# peripheral libraries and drivers
...
...
@@ -308,6 +422,8 @@ CONFIG_RT_LIBC_USING_TIME=y
# CONFIG_PKG_USING_SENSORS_DRIVERS is not set
# CONFIG_PKG_USING_REALTEK_AMEBA is not set
# CONFIG_PKG_USING_SHT2X is not set
# CONFIG_PKG_USING_SHT3X is not set
# CONFIG_PKG_USING_AS7341 is not set
# CONFIG_PKG_USING_STM32_SDIO is not set
# CONFIG_PKG_USING_ICM20608 is not set
# CONFIG_PKG_USING_U8G2 is not set
...
...
@@ -316,10 +432,16 @@ CONFIG_RT_LIBC_USING_TIME=y
# CONFIG_PKG_USING_SX12XX is not set
# CONFIG_PKG_USING_SIGNAL_LED is not set
# CONFIG_PKG_USING_LEDBLINK is not set
# CONFIG_PKG_USING_LITTLED is not set
# CONFIG_PKG_USING_LKDGUI is not set
# CONFIG_PKG_USING_NRF5X_SDK is not set
# CONFIG_PKG_USING_NRFX is not set
# CONFIG_PKG_USING_WM_LIBRARIES is not set
# CONFIG_PKG_USING_KENDRYTE_SDK is not set
# CONFIG_PKG_USING_INFRARED is not set
# CONFIG_PKG_USING_ROSSERIAL is not set
# CONFIG_PKG_USING_AGILE_BUTTON is not set
# CONFIG_PKG_USING_AGILE_LED is not set
# CONFIG_PKG_USING_AT24CXX is not set
# CONFIG_PKG_USING_MOTIONDRIVER2RTT is not set
# CONFIG_PKG_USING_AD7746 is not set
...
...
@@ -327,7 +449,47 @@ CONFIG_RT_LIBC_USING_TIME=y
# CONFIG_PKG_USING_I2C_TOOLS is not set
# CONFIG_PKG_USING_NRF24L01 is not set
# CONFIG_PKG_USING_TOUCH_DRIVERS is not set
# CONFIG_PKG_USING_LCD_DRIVERS is not set
# CONFIG_PKG_USING_MAX17048 is not set
# CONFIG_PKG_USING_RPLIDAR is not set
# CONFIG_PKG_USING_AS608 is not set
# CONFIG_PKG_USING_RC522 is not set
# CONFIG_PKG_USING_WS2812B is not set
# CONFIG_PKG_USING_EMBARC_BSP is not set
# CONFIG_PKG_USING_EXTERN_RTC_DRIVERS is not set
# CONFIG_PKG_USING_MULTI_RTIMER is not set
# CONFIG_PKG_USING_MAX7219 is not set
# CONFIG_PKG_USING_BEEP is not set
# CONFIG_PKG_USING_EASYBLINK is not set
# CONFIG_PKG_USING_PMS_SERIES is not set
# CONFIG_PKG_USING_CAN_YMODEM is not set
# CONFIG_PKG_USING_LORA_RADIO_DRIVER is not set
# CONFIG_PKG_USING_QLED is not set
# CONFIG_PKG_USING_PAJ7620 is not set
# CONFIG_PKG_USING_AGILE_CONSOLE is not set
# CONFIG_PKG_USING_LD3320 is not set
# CONFIG_PKG_USING_WK2124 is not set
# CONFIG_PKG_USING_LY68L6400 is not set
# CONFIG_PKG_USING_DM9051 is not set
# CONFIG_PKG_USING_SSD1306 is not set
# CONFIG_PKG_USING_QKEY is not set
# CONFIG_PKG_USING_RS485 is not set
# CONFIG_PKG_USING_NES is not set
# CONFIG_PKG_USING_VIRTUAL_SENSOR is not set
# CONFIG_PKG_USING_VDEVICE is not set
# CONFIG_PKG_USING_SGM706 is not set
# CONFIG_PKG_USING_RDA58XX is not set
#
# AI packages
#
# CONFIG_PKG_USING_LIBANN is not set
# CONFIG_PKG_USING_NNOM is not set
# CONFIG_PKG_USING_ONNX_BACKEND is not set
# CONFIG_PKG_USING_ONNX_PARSER is not set
# CONFIG_PKG_USING_TENSORFLOWLITEMICRO is not set
# CONFIG_PKG_USING_ELAPACK is not set
# CONFIG_PKG_USING_ULAPACK is not set
# CONFIG_PKG_USING_QUEST is not set
#
# miscellaneous packages
...
...
@@ -337,6 +499,7 @@ CONFIG_RT_LIBC_USING_TIME=y
# CONFIG_PKG_USING_FASTLZ is not set
# CONFIG_PKG_USING_MINILZO is not set
# CONFIG_PKG_USING_QUICKLZ is not set
# CONFIG_PKG_USING_LZMA is not set
# CONFIG_PKG_USING_MULTIBUTTON is not set
# CONFIG_PKG_USING_FLEXIBLE_BUTTON is not set
# CONFIG_PKG_USING_CANFESTIVAL is not set
...
...
@@ -345,6 +508,8 @@ CONFIG_RT_LIBC_USING_TIME=y
# CONFIG_PKG_USING_TINYFRAME is not set
# CONFIG_PKG_USING_KENDRYTE_DEMO is not set
# CONFIG_PKG_USING_DIGITALCTRL is not set
# CONFIG_PKG_USING_UPACKER is not set
# CONFIG_PKG_USING_UPARAM is not set
#
# samples: kernel and components samples
...
...
@@ -355,9 +520,69 @@ CONFIG_RT_LIBC_USING_TIME=y
# CONFIG_PKG_USING_PERIPHERAL_SAMPLES is not set
# CONFIG_PKG_USING_HELLO is not set
# CONFIG_PKG_USING_VI is not set
# CONFIG_PKG_USING_NNOM is not set
# CONFIG_PKG_USING_LIBANN is not set
# CONFIG_PKG_USING_ELAPACK is not set
# CONFIG_PKG_USING_KI is not set
# CONFIG_PKG_USING_ARMv7M_DWT is not set
# CONFIG_PKG_USING_VT100 is not set
# CONFIG_PKG_USING_UKAL is not set
# CONFIG_PKG_USING_CRCLIB is not set
#
# games: games run on RT-Thread console
#
# CONFIG_PKG_USING_THREES is not set
# CONFIG_PKG_USING_2048 is not set
# CONFIG_PKG_USING_SNAKE is not set
# CONFIG_PKG_USING_TETRIS is not set
# CONFIG_PKG_USING_LWGPS is not set
# CONFIG_PKG_USING_STATE_MACHINE is not set
# CONFIG_PKG_USING_MCURSES is not set
# CONFIG_PKG_USING_COWSAY is not set
#
# Privated Packages of RealThread
#
# CONFIG_PKG_USING_CODEC is not set
# CONFIG_PKG_USING_PLAYER is not set
# CONFIG_PKG_USING_MPLAYER is not set
# CONFIG_PKG_USING_PERSIMMON_SRC is not set
# CONFIG_PKG_USING_JS_PERSIMMON is not set
# CONFIG_PKG_USING_JERRYSCRIPT_WIN32 is not set
#
# Network Utilities
#
# CONFIG_PKG_USING_WICED is not set
# CONFIG_PKG_USING_CLOUDSDK is not set
# CONFIG_PKG_USING_POWER_MANAGER is not set
# CONFIG_PKG_USING_RT_OTA is not set
# CONFIG_PKG_USING_RTINSIGHT is not set
# CONFIG_PKG_USING_SMARTCONFIG is not set
# CONFIG_PKG_USING_RTX is not set
# CONFIG_RT_USING_TESTCASE is not set
# CONFIG_PKG_USING_NGHTTP2 is not set
# CONFIG_PKG_USING_AVS is not set
# CONFIG_PKG_USING_ALI_LINKKIT is not set
# CONFIG_PKG_USING_STS is not set
# CONFIG_PKG_USING_DLMS is not set
# CONFIG_PKG_USING_AUDIO_FRAMEWORK is not set
# CONFIG_PKG_USING_ZBAR is not set
# CONFIG_PKG_USING_MCF is not set
# CONFIG_PKG_USING_URPC is not set
# CONFIG_PKG_USING_DCM is not set
# CONFIG_PKG_USING_EMQ is not set
# CONFIG_PKG_USING_CFGM is not set
# CONFIG_PKG_USING_RT_CMSIS_DAP is not set
# CONFIG_PKG_USING_SMODULE is not set
# CONFIG_PKG_USING_SNFD is not set
# CONFIG_PKG_USING_UDBD is not set
# CONFIG_PKG_USING_BENCHMARK is not set
# CONFIG_PKG_USING_UBJSON is not set
# CONFIG_PKG_USING_DATATYPE is not set
# CONFIG_PKG_USING_FASTFS is not set
# CONFIG_PKG_USING_RIL is not set
# CONFIG_PKG_USING_WATCH_DCM_SVC is not set
# CONFIG_PKG_USING_GUI_TEST is not set
# CONFIG_PKG_USING_PMEM is not set
CONFIG_SOC_FAMILY_STM32
=
y
CONFIG_SOC_SERIES_STM32L4
=
y
...
...
@@ -370,12 +595,15 @@ CONFIG_SOC_STM32L475VE=y
# Onboard Peripheral Drivers
#
CONFIG_BSP_USING_STLINK_TO_USART
=
y
# CONFIG_BSP_USING_KEY is not set
# CONFIG_BSP_USING_QSPI_FLASH is not set
# CONFIG_BSP_USING_SPI_LCD is not set
# CONFIG_BSP_USING_SDCARD is not set
# CONFIG_BSP_USING_ICM20608 is not set
# CONFIG_BSP_USING_AHT10 is not set
# CONFIG_BSP_USING_AUDIO is not set
# CONFIG_BSP_USING_USB_AUDIO is not set
# CONFIG_BSP_USING_WIFI is not set
#
# On-chip Peripheral Drivers
...
...
@@ -384,7 +612,14 @@ CONFIG_BSP_USING_GPIO=y
CONFIG_BSP_USING_UART
=
y
CONFIG_BSP_USING_UART1
=
y
# CONFIG_BSP_UART1_RX_USING_DMA is not set
# CONFIG_BSP_USING_UART2 is not set
# CONFIG_BSP_UART1_TX_USING_DMA is not set
CONFIG_BSP_UART1_RX_BUFSIZE
=
256
CONFIG_BSP_UART1_TX_BUFSIZE
=
0
CONFIG_BSP_USING_UART2
=
y
CONFIG_BSP_UART2_RX_USING_DMA
=
y
CONFIG_BSP_UART2_TX_USING_DMA
=
y
CONFIG_BSP_UART2_RX_BUFSIZE
=
256
CONFIG_BSP_UART2_TX_BUFSIZE
=
256
# CONFIG_BSP_USING_ON_CHIP_FLASH is not set
# CONFIG_BSP_USING_SPI is not set
# CONFIG_BSP_USING_QSPI is not set
...
...
@@ -393,9 +628,11 @@ CONFIG_BSP_USING_UART1=y
# CONFIG_BSP_USING_TIM is not set
# CONFIG_BSP_USING_PWM is not set
# CONFIG_BSP_USING_ADC is not set
# CONFIG_BSP_USING_DAC is not set
# CONFIG_BSP_USING_ONCHIP_RTC is not set
# CONFIG_BSP_USING_WDT is not set
# CONFIG_BSP_USING_USBD_FS is not set
# CONFIG_BSP_USING_USBD is not set
# CONFIG_BSP_USING_STM32_SDIO is not set
# CONFIG_BSP_USING_CRC is not set
# CONFIG_BSP_USING_RNG is not set
# CONFIG_BSP_USING_UDID is not set
...
...
bsp/stm32/stm32l475-atk-pandora/board/Kconfig
浏览文件 @
d94be14d
...
...
@@ -152,23 +152,59 @@ menu "On-chip Peripheral Drivers"
default y
select RT_USING_SERIAL
if BSP_USING_UART
config BSP_USING_UART1
bool "Enable UART1"
menu
config BSP_USING_UART1
bool "Enable UART1
(Debugger)
"
default y
if BSP_USING_UART1
config BSP_UART1_RX_USING_DMA
bool "Enable UART1 RX DMA"
depends on BSP_USING_UART1 && RT_SERIAL_USING_DMA
default n
config BSP_UART1_TX_USING_DMA
bool "Enable UART1 TX DMA"
depends on BSP_USING_UART1 && RT_SERIAL_USING_DMA
default n
config BSP_UART1_RX_BUFSIZE
int "Set UART1 RX buffer size"
range 64 65535
depends on RT_USING_SERIAL_V2
default 256
config BSP_UART1_TX_BUFSIZE
int "Set UART1 TX buffer size"
range 0 65535
depends on RT_USING_SERIAL_V2
default 0
endif
config BSP_UART1_RX_USING_DMA
bool "Enable UART1 RX DMA"
depends on BSP_USING_UART1 && RT_SERIAL_USING_DMA
default n
config BSP_USING_UART2
menuconfig BSP_USING_UART2
bool "Enable UART2"
default n
config BSP_UART2_RX_USING_DMA
bool "Enable UART2 RX DMA"
depends on BSP_USING_UART2 && RT_SERIAL_USING_DMA
default n
if BSP_USING_UART2
config BSP_UART2_RX_USING_DMA
bool "Enable UART2 RX DMA"
depends on BSP_USING_UART2 && RT_SERIAL_USING_DMA
default n
config BSP_UART2_TX_USING_DMA
bool "Enable UART2 TX DMA"
depends on BSP_USING_UART2 && RT_SERIAL_USING_DMA
default n
config BSP_UART2_RX_BUFSIZE
int "Set UART2 RX buffer size"
range 64 65535
depends on RT_USING_SERIAL_V2
default 256
config BSP_UART2_TX_BUFSIZE
int "Set UART2 TX buffer size"
range 0 65535
depends on RT_USING_SERIAL_V2
default 256
endif
endif
config BSP_USING_ON_CHIP_FLASH
...
...
bsp/stm32/stm32l475-atk-pandora/rtconfig.h
浏览文件 @
d94be14d
...
...
@@ -16,6 +16,9 @@
#define RT_USING_IDLE_HOOK
#define RT_IDLE_HOOK_LIST_SIZE 4
#define IDLE_THREAD_STACK_SIZE 256
/* kservice optimization */
#define RT_DEBUG
#define RT_DEBUG_COLOR
...
...
@@ -39,7 +42,7 @@
#define RT_USING_CONSOLE
#define RT_CONSOLEBUF_SIZE 256
#define RT_CONSOLE_DEVICE_NAME "uart1"
#define RT_VER_NUM 0x4000
2
#define RT_VER_NUM 0x4000
4
#define ARCH_ARM
#define RT_USING_CPU_FFS
#define ARCH_ARM_CORTEX_M
...
...
@@ -79,8 +82,8 @@
#define RT_USING_DEVICE_IPC
#define RT_PIPE_BUFSZ 512
#define RT_USING_SERIAL
#define RT_USING_SERIAL_V2
#define RT_SERIAL_USING_DMA
#define RT_SERIAL_RB_BUFSZ 64
#define RT_USING_PIN
/* Using USB */
...
...
@@ -88,7 +91,6 @@
/* POSIX layer and C standard library */
#define RT_LIBC_USING_TIME
/* Network */
...
...
@@ -109,6 +111,19 @@
/* Utilities */
#define RT_USING_RT_LINK
#define RT_LINK_USING_SF_CRC
/* rt-link hardware device configuration */
#define RT_LINK_HW_DEVICE_NAME "uart2"
#define RT_LINK_USING_UART
/* rt link debug option */
/* RT-Thread Utestcases */
/* RT-Thread online packages */
...
...
@@ -141,14 +156,29 @@
/* system packages */
/* Micrium: Micrium software products porting for RT-Thread */
/* peripheral libraries and drivers */
/* AI packages */
/* miscellaneous packages */
/* samples: kernel and components samples */
/* games: games run on RT-Thread console */
/* Privated Packages of RealThread */
/* Network Utilities */
#define SOC_FAMILY_STM32
#define SOC_SERIES_STM32L4
...
...
@@ -165,6 +195,13 @@
#define BSP_USING_GPIO
#define BSP_USING_UART
#define BSP_USING_UART1
#define BSP_UART1_RX_BUFSIZE 256
#define BSP_UART1_TX_BUFSIZE 0
#define BSP_USING_UART2
#define BSP_UART2_RX_USING_DMA
#define BSP_UART2_TX_USING_DMA
#define BSP_UART2_RX_BUFSIZE 256
#define BSP_UART2_TX_BUFSIZE 256
/* Board extended module Drivers */
...
...
components/drivers/Kconfig
浏览文件 @
d94be14d
...
...
@@ -24,22 +24,30 @@ if RT_USING_DEVICE_IPC
endif
endif
config RT_USING_SERIAL
bool "U
sing s
erial device drivers"
menu
config RT_USING_SERIAL
bool "U
SING S
erial device drivers"
select RT_USING_DEVICE_IPC
select RT_USING_DEVICE
default y
if RT_USING_SERIAL
config RT_SERIAL_USING_DMA
bool "Enable serial DMA mode"
default y
config RT_SERIAL_RB_BUFSZ
int "Set RX buffer size"
default 64
if RT_USING_SERIAL
choice
prompt "Choice Serial version"
default RT_USING_SERIAL_V1
config RT_USING_SERIAL_V1
bool "RT_USING_SERIAL_V1"
config RT_USING_SERIAL_V2
bool "RT_USING_SERIAL_V2"
endchoice
config RT_SERIAL_USING_DMA
bool "Enable serial DMA mode"
default y
endif
config RT_SERIAL_RB_BUFSZ
int "Set RX buffer size"
depends on !RT_USING_SERIAL_V2
default 64
endif
config RT_USING_CAN
bool "Using CAN device drivers"
...
...
components/drivers/include/drivers/serial_v2.h
0 → 100644
浏览文件 @
d94be14d
/*
* Copyright (c) 2006-2018, RT-Thread Development Team
*
* SPDX-License-Identifier: Apache-2.0
*
* Change Logs:
* Date Author Notes
* 2021-06-01 KyleChan first version
*/
#ifndef __SERIAL_V2_H__
#define __SERIAL_V2_H__
#include <rtthread.h>
#define BAUD_RATE_2400 2400
#define BAUD_RATE_4800 4800
#define BAUD_RATE_9600 9600
#define BAUD_RATE_19200 19200
#define BAUD_RATE_38400 38400
#define BAUD_RATE_57600 57600
#define BAUD_RATE_115200 115200
#define BAUD_RATE_230400 230400
#define BAUD_RATE_460800 460800
#define BAUD_RATE_921600 921600
#define BAUD_RATE_2000000 2000000
#define BAUD_RATE_3000000 3000000
#define DATA_BITS_5 5
#define DATA_BITS_6 6
#define DATA_BITS_7 7
#define DATA_BITS_8 8
#define DATA_BITS_9 9
#define STOP_BITS_1 0
#define STOP_BITS_2 1
#define STOP_BITS_3 2
#define STOP_BITS_4 3
#ifdef _WIN32
#include <windows.h>
#else
#define PARITY_NONE 0
#define PARITY_ODD 1
#define PARITY_EVEN 2
#endif
#define BIT_ORDER_LSB 0
#define BIT_ORDER_MSB 1
#define NRZ_NORMAL 0
/* Non Return to Zero : normal mode */
#define NRZ_INVERTED 1
/* Non Return to Zero : inverted mode */
#define RT_DEVICE_FLAG_RX_BLOCKING 0x1000
#define RT_DEVICE_FLAG_RX_NON_BLOCKING 0x2000
#define RT_DEVICE_FLAG_TX_BLOCKING 0x4000
#define RT_DEVICE_FLAG_TX_NON_BLOCKING 0x8000
#define RT_SERIAL_RX_BLOCKING RT_DEVICE_FLAG_RX_BLOCKING
#define RT_SERIAL_RX_NON_BLOCKING RT_DEVICE_FLAG_RX_NON_BLOCKING
#define RT_SERIAL_TX_BLOCKING RT_DEVICE_FLAG_TX_BLOCKING
#define RT_SERIAL_TX_NON_BLOCKING RT_DEVICE_FLAG_TX_NON_BLOCKING
#define RT_DEVICE_CHECK_OPTMODE 0x20
#define RT_SERIAL_EVENT_RX_IND 0x01
/* Rx indication */
#define RT_SERIAL_EVENT_TX_DONE 0x02
/* Tx complete */
#define RT_SERIAL_EVENT_RX_DMADONE 0x03
/* Rx DMA transfer done */
#define RT_SERIAL_EVENT_TX_DMADONE 0x04
/* Tx DMA transfer done */
#define RT_SERIAL_EVENT_RX_TIMEOUT 0x05
/* Rx timeout */
#define RT_SERIAL_ERR_OVERRUN 0x01
#define RT_SERIAL_ERR_FRAMING 0x02
#define RT_SERIAL_ERR_PARITY 0x03
#define RT_SERIAL_TX_DATAQUEUE_SIZE 2048
#define RT_SERIAL_TX_DATAQUEUE_LWM 30
#define RT_SERIAL_RX_MINBUFSZ 64
#define RT_SERIAL_TX_MINBUFSZ 64
#define RT_SERIAL_TX_BLOCKING_BUFFER 1
#define RT_SERIAL_TX_BLOCKING_NO_BUFFER 0
/* Default config for serial_configure structure */
#define RT_SERIAL_CONFIG_DEFAULT \
{ \
BAUD_RATE_115200,
/* 115200 bits/s */
\
DATA_BITS_8,
/* 8 databits */
\
STOP_BITS_1,
/* 1 stopbit */
\
PARITY_NONE,
/* No parity */
\
BIT_ORDER_LSB,
/* LSB first sent */
\
NRZ_NORMAL,
/* Normal mode */
\
RT_SERIAL_RX_MINBUFSZ,
/* rxBuf size */
\
RT_SERIAL_TX_MINBUFSZ,
/* txBuf size */
\
0 \
}
struct
serial_configure
{
rt_uint32_t
baud_rate
;
rt_uint32_t
data_bits
:
4
;
rt_uint32_t
stop_bits
:
2
;
rt_uint32_t
parity
:
2
;
rt_uint32_t
bit_order
:
1
;
rt_uint32_t
invert
:
1
;
rt_uint32_t
rx_bufsz
:
16
;
rt_uint32_t
tx_bufsz
:
16
;
rt_uint32_t
reserved
:
6
;
};
/*
* Serial FIFO mode
*/
struct
rt_serial_rx_fifo
{
struct
rt_ringbuffer
rb
;
rt_uint16_t
rx_index
;
struct
rt_completion
rx_cpt
;
rt_uint16_t
rx_cpt_index
;
/* software fifo */
rt_uint8_t
buffer
[];
};
struct
rt_serial_tx_fifo
{
struct
rt_ringbuffer
rb
;
rt_size_t
put_size
;
rt_bool_t
activated
;
struct
rt_completion
tx_cpt
;
/* software fifo */
rt_uint8_t
buffer
[];
};
struct
rt_serial_device
{
struct
rt_device
parent
;
const
struct
rt_uart_ops
*
ops
;
struct
serial_configure
config
;
void
*
serial_rx
;
void
*
serial_tx
;
};
/**
* uart operators
*/
struct
rt_uart_ops
{
rt_err_t
(
*
configure
)(
struct
rt_serial_device
*
serial
,
struct
serial_configure
*
cfg
);
rt_err_t
(
*
control
)(
struct
rt_serial_device
*
serial
,
int
cmd
,
void
*
arg
);
int
(
*
putc
)(
struct
rt_serial_device
*
serial
,
char
c
);
int
(
*
getc
)(
struct
rt_serial_device
*
serial
);
rt_size_t
(
*
transmit
)(
struct
rt_serial_device
*
serial
,
rt_uint8_t
*
buf
,
rt_size_t
size
,
rt_uint32_t
tx_flag
);
};
rt_size_t
rt_serial_get_linear_buffer
(
struct
rt_ringbuffer
*
rb
,
rt_uint8_t
**
ptr
);
rt_size_t
rt_serial_update_read_index
(
struct
rt_ringbuffer
*
rb
,
rt_uint16_t
read_index
);
rt_size_t
rt_serial_update_write_index
(
struct
rt_ringbuffer
*
rb
,
rt_uint16_t
write_index
);
void
rt_hw_serial_isr
(
struct
rt_serial_device
*
serial
,
int
event
);
rt_err_t
rt_hw_serial_register
(
struct
rt_serial_device
*
serial
,
const
char
*
name
,
rt_uint32_t
flag
,
void
*
data
);
#endif
components/drivers/include/rtdevice.h
浏览文件 @
d94be14d
...
...
@@ -57,7 +57,11 @@ extern "C" {
#endif
/* RT_USING_USB_HOST */
#ifdef RT_USING_SERIAL
#ifdef RT_USING_SERIAL_V2
#include "drivers/serial_v2.h"
#else
#include "drivers/serial.h"
#endif
#endif
/* RT_USING_SERIAL */
#ifdef RT_USING_I2C
...
...
components/drivers/serial/SConscript
浏览文件 @
d94be14d
from
building
import
*
cwd
=
GetCurrentDir
()
src
=
Glob
(
'*.c'
)
cwd
=
GetCurrentDir
()
CPPPATH
=
[
cwd
+
'/../include'
]
group
=
DefineGroup
(
'DeviceDrivers'
,
src
,
depend
=
[
'RT_USING_SERIAL'
],
CPPPATH
=
CPPPATH
)
if
GetDepend
([
'RT_USING_SERIAL'
]):
if
GetDepend
([
'RT_USING_SERIAL_V2'
]):
src
=
Glob
(
'serial_v2.c'
)
group
=
DefineGroup
(
'DeviceDrivers'
,
src
,
depend
=
[
'RT_USING_SERIAL_V2'
],
CPPPATH
=
CPPPATH
)
else
:
src
=
Glob
(
'serial.c'
)
group
=
DefineGroup
(
'DeviceDrivers'
,
src
,
depend
=
[
'RT_USING_SERIAL'
],
CPPPATH
=
CPPPATH
)
Return
(
'group'
)
components/drivers/serial/serial_v2.c
0 → 100644
浏览文件 @
d94be14d
此差异已折叠。
点击以展开。
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录