feat:add erpc uart
This commit is contained in:
parent
47e248c3ef
commit
590191d7e3
63
.config
63
.config
@ -106,7 +106,7 @@
|
|||||||
# end of rt_strnlen options
|
# end of rt_strnlen options
|
||||||
# end of klibc options
|
# end of klibc options
|
||||||
|
|
||||||
CONFIG_RT_NAME_MAX=12
|
CONFIG_RT_NAME_MAX=20
|
||||||
# CONFIG_RT_USING_ARCH_DATA_TYPE is not set
|
# CONFIG_RT_USING_ARCH_DATA_TYPE is not set
|
||||||
# CONFIG_RT_USING_NANO is not set
|
# CONFIG_RT_USING_NANO is not set
|
||||||
# CONFIG_RT_USING_SMART is not set
|
# CONFIG_RT_USING_SMART is not set
|
||||||
@ -125,7 +125,7 @@ CONFIG_RT_HOOK_USING_FUNC_PTR=y
|
|||||||
# CONFIG_RT_USING_HOOKLIST is not set
|
# CONFIG_RT_USING_HOOKLIST is not set
|
||||||
CONFIG_RT_USING_IDLE_HOOK=y
|
CONFIG_RT_USING_IDLE_HOOK=y
|
||||||
CONFIG_RT_IDLE_HOOK_LIST_SIZE=4
|
CONFIG_RT_IDLE_HOOK_LIST_SIZE=4
|
||||||
CONFIG_IDLE_THREAD_STACK_SIZE=256
|
CONFIG_IDLE_THREAD_STACK_SIZE=512
|
||||||
# CONFIG_RT_USING_TIMER_SOFT is not set
|
# CONFIG_RT_USING_TIMER_SOFT is not set
|
||||||
# CONFIG_RT_USING_CPU_USAGE_TRACER is not set
|
# CONFIG_RT_USING_CPU_USAGE_TRACER is not set
|
||||||
|
|
||||||
@ -236,7 +236,7 @@ CONFIG_RT_USING_SERIAL=y
|
|||||||
CONFIG_RT_USING_SERIAL_V1=y
|
CONFIG_RT_USING_SERIAL_V1=y
|
||||||
# CONFIG_RT_USING_SERIAL_V2 is not set
|
# CONFIG_RT_USING_SERIAL_V2 is not set
|
||||||
CONFIG_RT_SERIAL_USING_DMA=y
|
CONFIG_RT_SERIAL_USING_DMA=y
|
||||||
CONFIG_RT_SERIAL_RB_BUFSZ=64
|
CONFIG_RT_SERIAL_RB_BUFSZ=128
|
||||||
# CONFIG_RT_USING_SERIAL_BYPASS is not set
|
# CONFIG_RT_USING_SERIAL_BYPASS is not set
|
||||||
# CONFIG_RT_USING_CAN is not set
|
# CONFIG_RT_USING_CAN is not set
|
||||||
# CONFIG_RT_USING_CPUTIME is not set
|
# CONFIG_RT_USING_CPUTIME is not set
|
||||||
@ -256,7 +256,13 @@ CONFIG_RT_SERIAL_RB_BUFSZ=64
|
|||||||
# CONFIG_RT_USING_PM is not set
|
# CONFIG_RT_USING_PM is not set
|
||||||
# CONFIG_RT_USING_RTC is not set
|
# CONFIG_RT_USING_RTC is not set
|
||||||
# CONFIG_RT_USING_SDIO is not set
|
# CONFIG_RT_USING_SDIO is not set
|
||||||
# CONFIG_RT_USING_SPI is not set
|
CONFIG_RT_USING_SPI=y
|
||||||
|
# CONFIG_RT_USING_SOFT_SPI is not set
|
||||||
|
# CONFIG_RT_USING_QSPI is not set
|
||||||
|
# CONFIG_RT_USING_SPI_MSD is not set
|
||||||
|
# CONFIG_RT_USING_SFUD is not set
|
||||||
|
# CONFIG_RT_USING_ENC28J60 is not set
|
||||||
|
# CONFIG_RT_USING_SPI_WIFI is not set
|
||||||
# CONFIG_RT_USING_WDT is not set
|
# CONFIG_RT_USING_WDT is not set
|
||||||
# CONFIG_RT_USING_AUDIO is not set
|
# CONFIG_RT_USING_AUDIO is not set
|
||||||
# CONFIG_RT_USING_SENSOR is not set
|
# CONFIG_RT_USING_SENSOR is not set
|
||||||
@ -267,7 +273,7 @@ CONFIG_RT_SERIAL_RB_BUFSZ=64
|
|||||||
# CONFIG_RT_USING_BLK is not set
|
# CONFIG_RT_USING_BLK is not set
|
||||||
# CONFIG_RT_USING_VIRTIO is not set
|
# CONFIG_RT_USING_VIRTIO is not set
|
||||||
CONFIG_RT_USING_PIN=y
|
CONFIG_RT_USING_PIN=y
|
||||||
# CONFIG_RT_USING_KTIME is not set
|
CONFIG_RT_USING_KTIME=y
|
||||||
# CONFIG_RT_USING_HWTIMER is not set
|
# CONFIG_RT_USING_HWTIMER is not set
|
||||||
# CONFIG_RT_USING_CHERRYUSB is not set
|
# CONFIG_RT_USING_CHERRYUSB is not set
|
||||||
# end of Device Drivers
|
# end of Device Drivers
|
||||||
@ -295,10 +301,11 @@ CONFIG_RT_LIBC_TZ_DEFAULT_SEC=0
|
|||||||
# POSIX (Portable Operating System Interface) layer
|
# POSIX (Portable Operating System Interface) layer
|
||||||
#
|
#
|
||||||
# CONFIG_RT_USING_POSIX_FS is not set
|
# CONFIG_RT_USING_POSIX_FS is not set
|
||||||
# CONFIG_RT_USING_POSIX_DELAY is not set
|
CONFIG_RT_USING_POSIX_DELAY=y
|
||||||
# CONFIG_RT_USING_POSIX_CLOCK is not set
|
CONFIG_RT_USING_POSIX_CLOCK=y
|
||||||
# CONFIG_RT_USING_POSIX_TIMER is not set
|
# CONFIG_RT_USING_POSIX_TIMER is not set
|
||||||
# CONFIG_RT_USING_PTHREADS is not set
|
CONFIG_RT_USING_PTHREADS=y
|
||||||
|
CONFIG_PTHREAD_NUM_MAX=8
|
||||||
# CONFIG_RT_USING_MODULE is not set
|
# CONFIG_RT_USING_MODULE is not set
|
||||||
|
|
||||||
#
|
#
|
||||||
@ -314,7 +321,10 @@ CONFIG_RT_LIBC_TZ_DEFAULT_SEC=0
|
|||||||
# end of Interprocess Communication (IPC)
|
# end of Interprocess Communication (IPC)
|
||||||
# end of POSIX (Portable Operating System Interface) layer
|
# end of POSIX (Portable Operating System Interface) layer
|
||||||
|
|
||||||
# CONFIG_RT_USING_CPLUSPLUS is not set
|
CONFIG_RT_USING_CPLUSPLUS=y
|
||||||
|
# CONFIG_RT_USING_CPLUSPLUS11 is not set
|
||||||
|
# CONFIG_RT_USING_CPP_WRAPPER is not set
|
||||||
|
# CONFIG_RT_USING_CPP_EXCEPTIONS is not set
|
||||||
# end of C/C++ and POSIX layer
|
# end of C/C++ and POSIX layer
|
||||||
|
|
||||||
#
|
#
|
||||||
@ -886,6 +896,7 @@ CONFIG_PKG_STM32H7_CMSIS_DRIVER_VER="latest"
|
|||||||
#
|
#
|
||||||
# CONFIG_PKG_USING_GD32_ARM_CMSIS_DRIVER is not set
|
# CONFIG_PKG_USING_GD32_ARM_CMSIS_DRIVER is not set
|
||||||
# CONFIG_PKG_USING_GD32_ARM_SERIES_DRIVER is not set
|
# CONFIG_PKG_USING_GD32_ARM_SERIES_DRIVER is not set
|
||||||
|
# CONFIG_PKG_USING_GD32_RISCV_SERIES_DRIVER is not set
|
||||||
# end of GD32 Drivers
|
# end of GD32 Drivers
|
||||||
|
|
||||||
#
|
#
|
||||||
@ -938,6 +949,7 @@ CONFIG_PKG_STM32H7_CMSIS_DRIVER_VER="latest"
|
|||||||
# CONFIG_PKG_USING_RT3020 is not set
|
# CONFIG_PKG_USING_RT3020 is not set
|
||||||
# CONFIG_PKG_USING_MLX90632 is not set
|
# CONFIG_PKG_USING_MLX90632 is not set
|
||||||
# CONFIG_PKG_USING_MLX90382 is not set
|
# CONFIG_PKG_USING_MLX90382 is not set
|
||||||
|
# CONFIG_PKG_USING_MLX90384 is not set
|
||||||
# CONFIG_PKG_USING_MLX90393 is not set
|
# CONFIG_PKG_USING_MLX90393 is not set
|
||||||
# CONFIG_PKG_USING_MLX90392 is not set
|
# CONFIG_PKG_USING_MLX90392 is not set
|
||||||
# CONFIG_PKG_USING_MLX90394 is not set
|
# CONFIG_PKG_USING_MLX90394 is not set
|
||||||
@ -1066,6 +1078,7 @@ CONFIG_PKG_STM32H7_CMSIS_DRIVER_VER="latest"
|
|||||||
# CONFIG_PKG_USING_IC74HC165 is not set
|
# CONFIG_PKG_USING_IC74HC165 is not set
|
||||||
# CONFIG_PKG_USING_IST8310 is not set
|
# CONFIG_PKG_USING_IST8310 is not set
|
||||||
# CONFIG_PKG_USING_ST7789_SPI is not set
|
# CONFIG_PKG_USING_ST7789_SPI is not set
|
||||||
|
# CONFIG_PKG_USING_ISOTP_C is not set
|
||||||
# CONFIG_PKG_USING_SPI_TOOLS is not set
|
# CONFIG_PKG_USING_SPI_TOOLS is not set
|
||||||
# end of peripheral libraries and drivers
|
# end of peripheral libraries and drivers
|
||||||
|
|
||||||
@ -1428,8 +1441,26 @@ CONFIG_BSP_USING_GPIO=y
|
|||||||
CONFIG_BSP_USING_UART=y
|
CONFIG_BSP_USING_UART=y
|
||||||
CONFIG_BSP_STM32_UART_V1_TX_TIMEOUT=2000
|
CONFIG_BSP_STM32_UART_V1_TX_TIMEOUT=2000
|
||||||
CONFIG_BSP_USING_UART1=y
|
CONFIG_BSP_USING_UART1=y
|
||||||
|
# CONFIG_BSP_UART1_RX_USING_DMA is not set
|
||||||
|
# CONFIG_BSP_UART1_TX_USING_DMA is not set
|
||||||
|
CONFIG_BSP_USING_UART2=y
|
||||||
|
# CONFIG_BSP_UART2_RX_USING_DMA is not set
|
||||||
|
# CONFIG_BSP_UART2_TX_USING_DMA is not set
|
||||||
|
CONFIG_BSP_UART2_RX_BUFSIZE=1024
|
||||||
|
CONFIG_BSP_UART2_TX_BUFSIZE=0
|
||||||
|
CONFIG_BSP_USING_UART3=y
|
||||||
|
# CONFIG_BSP_UART3_RX_USING_DMA is not set
|
||||||
|
# CONFIG_BSP_UART3_TX_USING_DMA is not set
|
||||||
|
CONFIG_BSP_UART3_RX_BUFSIZE=256
|
||||||
|
CONFIG_BSP_UART3_TX_BUFSIZE=0
|
||||||
# CONFIG_BSP_USING_PWM is not set
|
# CONFIG_BSP_USING_PWM is not set
|
||||||
# CONFIG_BSP_USING_QSPI is not set
|
# CONFIG_BSP_USING_QSPI is not set
|
||||||
|
CONFIG_BSP_USING_SPI=y
|
||||||
|
# CONFIG_BSP_USING_SPI1 is not set
|
||||||
|
CONFIG_BSP_USING_SPI5=y
|
||||||
|
CONFIG_BSP_SPI5_TX_USING_DMA=y
|
||||||
|
# CONFIG_BSP_SPI5_RX_USING_DMA is not set
|
||||||
|
# CONFIG_BSP_USING_SPI6 is not set
|
||||||
# CONFIG_BSP_USING_CRC is not set
|
# CONFIG_BSP_USING_CRC is not set
|
||||||
# CONFIG_BSP_USING_RNG is not set
|
# CONFIG_BSP_USING_RNG is not set
|
||||||
# CONFIG_BSP_USING_UDID is not set
|
# CONFIG_BSP_USING_UDID is not set
|
||||||
@ -1439,3 +1470,17 @@ CONFIG_BSP_USING_UART1=y
|
|||||||
# Board extended module Drivers
|
# Board extended module Drivers
|
||||||
#
|
#
|
||||||
# end of Hardware Drivers Config
|
# end of Hardware Drivers Config
|
||||||
|
|
||||||
|
#
|
||||||
|
# Third Packages Drivers
|
||||||
|
#
|
||||||
|
CONFIG_BSP_USING_ERPC=y
|
||||||
|
CONFIG_ERPC_USING_RTT=y
|
||||||
|
CONFIG_ERPC_MODE=y
|
||||||
|
CONFIG_ERPC_MODE_SERVER=y
|
||||||
|
CONFIG_ERPC_MODE_CLIENT=y
|
||||||
|
CONFIG_ERPC_TRANSPORTS=y
|
||||||
|
# CONFIG_ERPC_TRANSPORTS_SPI is not set
|
||||||
|
CONFIG_ERPC_TRANSPORTS_UART=y
|
||||||
|
# CONFIG_ERPC_TRANSPORTS_TCP is not set
|
||||||
|
# end of Third Packages Drivers
|
||||||
|
|||||||
136
CMakeLists.txt
136
CMakeLists.txt
@ -13,7 +13,7 @@ SET(CMAKE_ASM_FLAGS " -c -mcpu=cortex-m7 -mthumb -mfpu=fpv5-d16 -mfloat-abi=hard
|
|||||||
SET(CMAKE_C_COMPILER_WORKS TRUE)
|
SET(CMAKE_C_COMPILER_WORKS TRUE)
|
||||||
|
|
||||||
SET(CMAKE_CXX_COMPILER "C:/tool/rtthread/env-windows/tools/bin/../../tools/gnu_gcc/arm_gcc/mingw/bin/arm-none-eabi-g++.exe")
|
SET(CMAKE_CXX_COMPILER "C:/tool/rtthread/env-windows/tools/bin/../../tools/gnu_gcc/arm_gcc/mingw/bin/arm-none-eabi-g++.exe")
|
||||||
SET(CMAKE_CXX_FLAGS " -mcpu=cortex-m7 -mthumb -mfpu=fpv5-d16 -mfloat-abi=hard -ffunction-sections -fdata-sections -Dgcc -O0 -gdwarf-2 -g")
|
SET(CMAKE_CXX_FLAGS " -mcpu=cortex-m7 -mthumb -mfpu=fpv5-d16 -mfloat-abi=hard -ffunction-sections -fdata-sections -Dgcc -O0 -gdwarf-2 -g -fno-exceptions -fno-rtti -ffunction-sections -fdata-sections -Wl,--gc-sections")
|
||||||
SET(CMAKE_CXX_COMPILER_WORKS TRUE)
|
SET(CMAKE_CXX_COMPILER_WORKS TRUE)
|
||||||
|
|
||||||
SET(CMAKE_OBJCOPY "C:/tool/rtthread/env-windows/tools/bin/../../tools/gnu_gcc/arm_gcc/mingw/bin/arm-none-eabi-objcopy.exe")
|
SET(CMAKE_OBJCOPY "C:/tool/rtthread/env-windows/tools/bin/../../tools/gnu_gcc/arm_gcc/mingw/bin/arm-none-eabi-objcopy.exe")
|
||||||
@ -29,22 +29,39 @@ PROJECT(rtthread C CXX ASM)
|
|||||||
INCLUDE_DIRECTORIES(
|
INCLUDE_DIRECTORIES(
|
||||||
.
|
.
|
||||||
applications
|
applications
|
||||||
|
applications/erpc
|
||||||
|
applications/erpc/service
|
||||||
|
applications/erpc/client
|
||||||
|
applications/erpc/proto/generated
|
||||||
board
|
board
|
||||||
board/CubeMX_Config/Inc
|
board/CubeMX_Config/Inc
|
||||||
libraries/HAL_Drivers/CMSIS/Include
|
libraries/HAL_Drivers/CMSIS/Include
|
||||||
|
packages/erpc-1.14.0/erpc_c
|
||||||
|
packages/erpc-1.14.0/erpc_c/config
|
||||||
|
packages/erpc-1.14.0/erpc_c/infra
|
||||||
|
packages/erpc-1.14.0/erpc_c/port
|
||||||
|
packages/erpc-1.14.0/erpc_c/setup
|
||||||
|
packages/erpc-1.14.0/erpc_c/transports
|
||||||
rt-thread/include
|
rt-thread/include
|
||||||
rt-thread/libcpu/arm/common
|
rt-thread/libcpu/arm/common
|
||||||
rt-thread/libcpu/arm/cortex-m7
|
rt-thread/libcpu/arm/cortex-m7
|
||||||
rt-thread/components/drivers/include
|
rt-thread/components/drivers/include
|
||||||
|
rt-thread/components/drivers/ktime
|
||||||
|
rt-thread/components/drivers/ktime/inc
|
||||||
rt-thread/components/drivers/phy
|
rt-thread/components/drivers/phy
|
||||||
rt-thread/components/drivers/smp_call
|
rt-thread/components/drivers/smp_call
|
||||||
|
rt-thread/components/drivers/spi
|
||||||
rt-thread/components/finsh
|
rt-thread/components/finsh
|
||||||
rt-thread/components/libc/compilers/common/include
|
rt-thread/components/libc/compilers/common/include
|
||||||
rt-thread/components/libc/compilers/newlib
|
rt-thread/components/libc/compilers/newlib
|
||||||
|
rt-thread/components/libc/cplusplus
|
||||||
|
rt-thread/components/libc/posix/delay
|
||||||
rt-thread/components/libc/posix/io/epoll
|
rt-thread/components/libc/posix/io/epoll
|
||||||
rt-thread/components/libc/posix/io/eventfd
|
rt-thread/components/libc/posix/io/eventfd
|
||||||
rt-thread/components/libc/posix/io/poll
|
rt-thread/components/libc/posix/io/poll
|
||||||
rt-thread/components/libc/posix/ipc
|
rt-thread/components/libc/posix/ipc
|
||||||
|
rt-thread/components/libc/posix/pthreads
|
||||||
|
rt-thread/components/libc/posix/tls
|
||||||
rt-thread/components/net/utest
|
rt-thread/components/net/utest
|
||||||
libraries/STM32H7xx_HAL/STM32H7xx_HAL_Driver/Inc
|
libraries/STM32H7xx_HAL/STM32H7xx_HAL_Driver/Inc
|
||||||
libraries/STM32H7xx_HAL/CMSIS/Device/ST/STM32H7xx/Include
|
libraries/STM32H7xx_HAL/CMSIS/Device/ST/STM32H7xx/Include
|
||||||
@ -64,6 +81,15 @@ ADD_DEFINITIONS(
|
|||||||
)
|
)
|
||||||
|
|
||||||
# Library source files
|
# Library source files
|
||||||
|
SET(RT_APP_ERPC_SOURCES
|
||||||
|
applications/erpc/client/src/erpc_client_main.cpp
|
||||||
|
applications/erpc/proto/generated/head_service_server.cpp
|
||||||
|
applications/erpc/proto/generated/head_service_client.cpp
|
||||||
|
applications/erpc/service/src/head_service_impl.cpp
|
||||||
|
applications/erpc/service/src/erpc_server_main.cpp
|
||||||
|
applications/erpc/proto/generated/head_service_interface.cpp
|
||||||
|
)
|
||||||
|
|
||||||
SET(RT_APPLICATIONS_SOURCES
|
SET(RT_APPLICATIONS_SOURCES
|
||||||
applications/servo.c
|
applications/servo.c
|
||||||
applications/main.c
|
applications/main.c
|
||||||
@ -79,6 +105,11 @@ SET(RT_COMPILER_SOURCES
|
|||||||
rt-thread/components/libc/compilers/newlib/syscalls.c
|
rt-thread/components/libc/compilers/newlib/syscalls.c
|
||||||
)
|
)
|
||||||
|
|
||||||
|
SET(RT_CPP_SOURCES
|
||||||
|
rt-thread/components/libc/cplusplus/cxx_crt_init.c
|
||||||
|
rt-thread/components/libc/cplusplus/cxx_crt.cpp
|
||||||
|
)
|
||||||
|
|
||||||
SET(RT_DEVICEDRIVERS_SOURCES
|
SET(RT_DEVICEDRIVERS_SOURCES
|
||||||
rt-thread/components/drivers/core/device.c
|
rt-thread/components/drivers/core/device.c
|
||||||
rt-thread/components/drivers/ipc/completion_comm.c
|
rt-thread/components/drivers/ipc/completion_comm.c
|
||||||
@ -92,6 +123,8 @@ SET(RT_DEVICEDRIVERS_SOURCES
|
|||||||
rt-thread/components/drivers/ipc/workqueue.c
|
rt-thread/components/drivers/ipc/workqueue.c
|
||||||
rt-thread/components/drivers/pin/dev_pin.c
|
rt-thread/components/drivers/pin/dev_pin.c
|
||||||
rt-thread/components/drivers/serial/dev_serial.c
|
rt-thread/components/drivers/serial/dev_serial.c
|
||||||
|
rt-thread/components/drivers/spi/dev_spi.c
|
||||||
|
rt-thread/components/drivers/spi/dev_spi_core.c
|
||||||
)
|
)
|
||||||
|
|
||||||
SET(RT_DRIVERS_SOURCES
|
SET(RT_DRIVERS_SOURCES
|
||||||
@ -100,15 +133,39 @@ SET(RT_DRIVERS_SOURCES
|
|||||||
board/ports/qspi_flash_init.c
|
board/ports/qspi_flash_init.c
|
||||||
libraries/STM32H7xx_HAL/CMSIS/Device/ST/STM32H7xx/Source/Templates/gcc/startup_stm32h750xx.s
|
libraries/STM32H7xx_HAL/CMSIS/Device/ST/STM32H7xx/Source/Templates/gcc/startup_stm32h750xx.s
|
||||||
libraries/HAL_Drivers/drivers/drv_gpio.c
|
libraries/HAL_Drivers/drivers/drv_gpio.c
|
||||||
|
libraries/HAL_Drivers/drivers/drv_spi.c
|
||||||
libraries/HAL_Drivers/drivers/drv_usart.c
|
libraries/HAL_Drivers/drivers/drv_usart.c
|
||||||
libraries/HAL_Drivers/drv_common.c
|
libraries/HAL_Drivers/drv_common.c
|
||||||
)
|
)
|
||||||
|
|
||||||
|
SET(RT_ERPC_SOURCES
|
||||||
|
packages/erpc-1.14.0/erpc_c/setup/erpc_client_setup.cpp
|
||||||
|
packages/erpc-1.14.0/erpc_c/infra/erpc_pre_post_action.cpp
|
||||||
|
packages/erpc-1.14.0/erpc_c/infra/erpc_crc16.cpp
|
||||||
|
packages/erpc-1.14.0/erpc_c/infra/erpc_server.cpp
|
||||||
|
packages/erpc-1.14.0/erpc_c/infra/erpc_message_buffer.cpp
|
||||||
|
packages/erpc-1.14.0/erpc_c/setup/erpc_arbitrated_client_setup.cpp
|
||||||
|
packages/erpc-1.14.0/erpc_c/infra/erpc_transport_arbitrator.cpp
|
||||||
|
packages/erpc-1.14.0/erpc_c/setup/erpc_server_setup.cpp
|
||||||
|
packages/erpc-1.14.0/erpc_c/infra/erpc_message_loggers.cpp
|
||||||
|
packages/erpc-1.14.0/erpc_c/setup/erpc_setup_mbf_static.cpp
|
||||||
|
packages/erpc-1.14.0/erpc_c/infra/erpc_basic_codec.cpp
|
||||||
|
packages/erpc-1.14.0/erpc_c/infra/erpc_arbitrated_client_manager.cpp
|
||||||
|
packages/erpc-1.14.0/erpc_c/setup/erpc_setup_uart_cmsis.cpp
|
||||||
|
packages/erpc-1.14.0/erpc_c/setup/erpc_setup_mbf_dynamic.cpp
|
||||||
|
packages/erpc-1.14.0/erpc_c/transports/erpc_uart_cmsis_transport.cpp
|
||||||
|
packages/erpc-1.14.0/erpc_c/port/erpc_threading_pthreads.cpp
|
||||||
|
packages/erpc-1.14.0/erpc_c/infra/erpc_simple_server.cpp
|
||||||
|
packages/erpc-1.14.0/erpc_c/transports/erpc_inter_thread_buffer_transport.cpp
|
||||||
|
packages/erpc-1.14.0/erpc_c/infra/erpc_framed_transport.cpp
|
||||||
|
packages/erpc-1.14.0/erpc_c/infra/erpc_client_manager.cpp
|
||||||
|
)
|
||||||
|
|
||||||
SET(RT_FINSH_SOURCES
|
SET(RT_FINSH_SOURCES
|
||||||
rt-thread/components/finsh/msh.c
|
|
||||||
rt-thread/components/finsh/cmd.c
|
|
||||||
rt-thread/components/finsh/msh_parse.c
|
|
||||||
rt-thread/components/finsh/shell.c
|
rt-thread/components/finsh/shell.c
|
||||||
|
rt-thread/components/finsh/cmd.c
|
||||||
|
rt-thread/components/finsh/msh.c
|
||||||
|
rt-thread/components/finsh/msh_parse.c
|
||||||
)
|
)
|
||||||
|
|
||||||
SET(RT_KERNEL_SOURCES
|
SET(RT_KERNEL_SOURCES
|
||||||
@ -130,11 +187,17 @@ SET(RT_KERNEL_SOURCES
|
|||||||
)
|
)
|
||||||
|
|
||||||
SET(RT_KLIBC_SOURCES
|
SET(RT_KLIBC_SOURCES
|
||||||
rt-thread/src/klibc/rt_vsscanf.c
|
|
||||||
rt-thread/src/klibc/rt_vsnprintf_tiny.c
|
|
||||||
rt-thread/src/klibc/kerrno.c
|
rt-thread/src/klibc/kerrno.c
|
||||||
rt-thread/src/klibc/kstring.c
|
rt-thread/src/klibc/rt_vsnprintf_tiny.c
|
||||||
|
rt-thread/src/klibc/rt_vsscanf.c
|
||||||
rt-thread/src/klibc/kstdio.c
|
rt-thread/src/klibc/kstdio.c
|
||||||
|
rt-thread/src/klibc/kstring.c
|
||||||
|
)
|
||||||
|
|
||||||
|
SET(RT_KTIME_SOURCES
|
||||||
|
rt-thread/components/drivers/ktime/src/cputimer.c
|
||||||
|
rt-thread/components/drivers/ktime/src/hrtimer.c
|
||||||
|
rt-thread/components/drivers/ktime/src/boottime.c
|
||||||
)
|
)
|
||||||
|
|
||||||
SET(RT_LIBCPU_SOURCES
|
SET(RT_LIBCPU_SOURCES
|
||||||
@ -147,31 +210,44 @@ SET(RT_LIBCPU_SOURCES
|
|||||||
)
|
)
|
||||||
|
|
||||||
SET(RT_LIBRARIES_SOURCES
|
SET(RT_LIBRARIES_SOURCES
|
||||||
libraries/STM32H7xx_HAL/STM32H7xx_HAL_Driver/Src/stm32h7xx_hal_sram.c
|
|
||||||
libraries/STM32H7xx_HAL/STM32H7xx_HAL_Driver/Src/stm32h7xx_hal_cryp_ex.c
|
|
||||||
libraries/STM32H7xx_HAL/STM32H7xx_HAL_Driver/Src/stm32h7xx_hal_uart_ex.c
|
|
||||||
libraries/STM32H7xx_HAL/STM32H7xx_HAL_Driver/Src/stm32h7xx_hal_usart.c
|
|
||||||
libraries/STM32H7xx_HAL/STM32H7xx_HAL_Driver/Src/stm32h7xx_hal_cryp.c
|
|
||||||
libraries/STM32H7xx_HAL/STM32H7xx_HAL_Driver/Src/stm32h7xx_hal_rcc_ex.c
|
|
||||||
libraries/STM32H7xx_HAL/STM32H7xx_HAL_Driver/Src/stm32h7xx_hal_rng.c
|
|
||||||
libraries/STM32H7xx_HAL/STM32H7xx_HAL_Driver/Src/stm32h7xx_hal_pwr.c
|
|
||||||
libraries/STM32H7xx_HAL/STM32H7xx_HAL_Driver/Src/stm32h7xx_hal_pwr_ex.c
|
|
||||||
libraries/STM32H7xx_HAL/STM32H7xx_HAL_Driver/Src/stm32h7xx_hal.c
|
libraries/STM32H7xx_HAL/STM32H7xx_HAL_Driver/Src/stm32h7xx_hal.c
|
||||||
libraries/STM32H7xx_HAL/STM32H7xx_HAL_Driver/Src/stm32h7xx_hal_crc_ex.c
|
|
||||||
libraries/STM32H7xx_HAL/STM32H7xx_HAL_Driver/Src/stm32h7xx_hal_rcc.c
|
|
||||||
libraries/STM32H7xx_HAL/STM32H7xx_HAL_Driver/Src/stm32h7xx_hal_dma_ex.c
|
|
||||||
libraries/STM32H7xx_HAL/STM32H7xx_HAL_Driver/Src/stm32h7xx_hal_cortex.c
|
|
||||||
libraries/STM32H7xx_HAL/STM32H7xx_HAL_Driver/Src/stm32h7xx_hal_comp.c
|
|
||||||
libraries/STM32H7xx_HAL/STM32H7xx_HAL_Driver/Src/stm32h7xx_hal_cec.c
|
|
||||||
libraries/STM32H7xx_HAL/STM32H7xx_HAL_Driver/Src/stm32h7xx_hal_gpio.c
|
libraries/STM32H7xx_HAL/STM32H7xx_HAL_Driver/Src/stm32h7xx_hal_gpio.c
|
||||||
libraries/STM32H7xx_HAL/CMSIS/Device/ST/STM32H7xx/Source/Templates/system_stm32h7xx.c
|
|
||||||
libraries/STM32H7xx_HAL/STM32H7xx_HAL_Driver/Src/stm32h7xx_hal_uart.c
|
|
||||||
libraries/STM32H7xx_HAL/STM32H7xx_HAL_Driver/Src/stm32h7xx_hal_dma.c
|
libraries/STM32H7xx_HAL/STM32H7xx_HAL_Driver/Src/stm32h7xx_hal_dma.c
|
||||||
libraries/STM32H7xx_HAL/STM32H7xx_HAL_Driver/Src/stm32h7xx_hal_crc.c
|
libraries/STM32H7xx_HAL/STM32H7xx_HAL_Driver/Src/stm32h7xx_hal_cortex.c
|
||||||
|
libraries/STM32H7xx_HAL/STM32H7xx_HAL_Driver/Src/stm32h7xx_hal_sram.c
|
||||||
|
libraries/STM32H7xx_HAL/STM32H7xx_HAL_Driver/Src/stm32h7xx_hal_rng.c
|
||||||
|
libraries/STM32H7xx_HAL/STM32H7xx_HAL_Driver/Src/stm32h7xx_hal_spi.c
|
||||||
|
libraries/STM32H7xx_HAL/STM32H7xx_HAL_Driver/Src/stm32h7xx_hal_crc_ex.c
|
||||||
|
libraries/STM32H7xx_HAL/STM32H7xx_HAL_Driver/Src/stm32h7xx_hal_comp.c
|
||||||
|
libraries/STM32H7xx_HAL/STM32H7xx_HAL_Driver/Src/stm32h7xx_hal_cryp.c
|
||||||
|
libraries/STM32H7xx_HAL/STM32H7xx_HAL_Driver/Src/stm32h7xx_hal_qspi.c
|
||||||
|
libraries/STM32H7xx_HAL/STM32H7xx_HAL_Driver/Src/stm32h7xx_hal_cryp_ex.c
|
||||||
libraries/STM32H7xx_HAL/STM32H7xx_HAL_Driver/Src/stm32h7xx_hal_mdma.c
|
libraries/STM32H7xx_HAL/STM32H7xx_HAL_Driver/Src/stm32h7xx_hal_mdma.c
|
||||||
|
libraries/STM32H7xx_HAL/CMSIS/Device/ST/STM32H7xx/Source/Templates/system_stm32h7xx.c
|
||||||
|
libraries/STM32H7xx_HAL/STM32H7xx_HAL_Driver/Src/stm32h7xx_hal_rcc.c
|
||||||
|
libraries/STM32H7xx_HAL/STM32H7xx_HAL_Driver/Src/stm32h7xx_hal_pwr_ex.c
|
||||||
|
libraries/STM32H7xx_HAL/STM32H7xx_HAL_Driver/Src/stm32h7xx_hal_cec.c
|
||||||
|
libraries/STM32H7xx_HAL/STM32H7xx_HAL_Driver/Src/stm32h7xx_hal_uart_ex.c
|
||||||
|
libraries/STM32H7xx_HAL/STM32H7xx_HAL_Driver/Src/stm32h7xx_hal_crc.c
|
||||||
|
libraries/STM32H7xx_HAL/STM32H7xx_HAL_Driver/Src/stm32h7xx_hal_dma_ex.c
|
||||||
|
libraries/STM32H7xx_HAL/STM32H7xx_HAL_Driver/Src/stm32h7xx_hal_pwr.c
|
||||||
|
libraries/STM32H7xx_HAL/STM32H7xx_HAL_Driver/Src/stm32h7xx_hal_rcc_ex.c
|
||||||
|
libraries/STM32H7xx_HAL/STM32H7xx_HAL_Driver/Src/stm32h7xx_hal_uart.c
|
||||||
|
libraries/STM32H7xx_HAL/STM32H7xx_HAL_Driver/Src/stm32h7xx_hal_usart.c
|
||||||
)
|
)
|
||||||
|
|
||||||
SET(RT_POSIX_SOURCES
|
SET(RT_POSIX_SOURCES
|
||||||
|
rt-thread/components/libc/posix/delay/delay.c
|
||||||
|
rt-thread/components/libc/posix/pthreads/pthread.c
|
||||||
|
rt-thread/components/libc/posix/pthreads/pthread_attr.c
|
||||||
|
rt-thread/components/libc/posix/pthreads/pthread_barrier.c
|
||||||
|
rt-thread/components/libc/posix/pthreads/pthread_cond.c
|
||||||
|
rt-thread/components/libc/posix/pthreads/pthread_mutex.c
|
||||||
|
rt-thread/components/libc/posix/pthreads/pthread_rwlock.c
|
||||||
|
rt-thread/components/libc/posix/pthreads/pthread_spin.c
|
||||||
|
rt-thread/components/libc/posix/pthreads/pthread_tls.c
|
||||||
|
rt-thread/components/libc/posix/pthreads/sched.c
|
||||||
|
rt-thread/components/libc/posix/tls/emutls.c
|
||||||
)
|
)
|
||||||
|
|
||||||
SET(RT_UTC_UTEST_SOURCES
|
SET(RT_UTC_UTEST_SOURCES
|
||||||
@ -197,17 +273,21 @@ SET(RT_COMPILER_LIBS
|
|||||||
)
|
)
|
||||||
|
|
||||||
# Libraries
|
# Libraries
|
||||||
|
ADD_LIBRARY(rtt_app_erpc OBJECT ${RT_APP_ERPC_SOURCES})
|
||||||
ADD_LIBRARY(rtt_Compiler OBJECT ${RT_COMPILER_SOURCES})
|
ADD_LIBRARY(rtt_Compiler OBJECT ${RT_COMPILER_SOURCES})
|
||||||
|
ADD_LIBRARY(rtt_CPP OBJECT ${RT_CPP_SOURCES})
|
||||||
ADD_LIBRARY(rtt_DeviceDrivers OBJECT ${RT_DEVICEDRIVERS_SOURCES})
|
ADD_LIBRARY(rtt_DeviceDrivers OBJECT ${RT_DEVICEDRIVERS_SOURCES})
|
||||||
ADD_LIBRARY(rtt_Drivers OBJECT ${RT_DRIVERS_SOURCES})
|
ADD_LIBRARY(rtt_Drivers OBJECT ${RT_DRIVERS_SOURCES})
|
||||||
|
ADD_LIBRARY(rtt_erpc OBJECT ${RT_ERPC_SOURCES})
|
||||||
ADD_LIBRARY(rtt_Finsh OBJECT ${RT_FINSH_SOURCES})
|
ADD_LIBRARY(rtt_Finsh OBJECT ${RT_FINSH_SOURCES})
|
||||||
ADD_LIBRARY(rtt_Kernel OBJECT ${RT_KERNEL_SOURCES})
|
ADD_LIBRARY(rtt_Kernel OBJECT ${RT_KERNEL_SOURCES})
|
||||||
ADD_LIBRARY(rtt_klibc OBJECT ${RT_KLIBC_SOURCES})
|
ADD_LIBRARY(rtt_klibc OBJECT ${RT_KLIBC_SOURCES})
|
||||||
|
ADD_LIBRARY(rtt_ktime OBJECT ${RT_KTIME_SOURCES})
|
||||||
ADD_LIBRARY(rtt_libcpu OBJECT ${RT_LIBCPU_SOURCES})
|
ADD_LIBRARY(rtt_libcpu OBJECT ${RT_LIBCPU_SOURCES})
|
||||||
ADD_LIBRARY(rtt_Libraries OBJECT ${RT_LIBRARIES_SOURCES})
|
ADD_LIBRARY(rtt_Libraries OBJECT ${RT_LIBRARIES_SOURCES})
|
||||||
|
ADD_LIBRARY(rtt_POSIX OBJECT ${RT_POSIX_SOURCES})
|
||||||
|
|
||||||
# Interface libraries
|
# Interface libraries
|
||||||
ADD_LIBRARY(rtt_POSIX INTERFACE)
|
|
||||||
ADD_LIBRARY(rtt_utc_UTest INTERFACE)
|
ADD_LIBRARY(rtt_utc_UTest INTERFACE)
|
||||||
ADD_LIBRARY(rtt_utestcases INTERFACE)
|
ADD_LIBRARY(rtt_utestcases INTERFACE)
|
||||||
|
|
||||||
@ -220,12 +300,16 @@ TARGET_LINK_LIBRARIES(rtt_Compiler INTERFACE ${RT_COMPILER_LIBS})
|
|||||||
|
|
||||||
ADD_EXECUTABLE(${CMAKE_PROJECT_NAME}.elf ${RT_APPLICATIONS_SOURCES})
|
ADD_EXECUTABLE(${CMAKE_PROJECT_NAME}.elf ${RT_APPLICATIONS_SOURCES})
|
||||||
TARGET_LINK_LIBRARIES(${CMAKE_PROJECT_NAME}.elf
|
TARGET_LINK_LIBRARIES(${CMAKE_PROJECT_NAME}.elf
|
||||||
|
rtt_app_erpc
|
||||||
rtt_Compiler
|
rtt_Compiler
|
||||||
|
rtt_CPP
|
||||||
rtt_DeviceDrivers
|
rtt_DeviceDrivers
|
||||||
rtt_Drivers
|
rtt_Drivers
|
||||||
|
rtt_erpc
|
||||||
rtt_Finsh
|
rtt_Finsh
|
||||||
rtt_Kernel
|
rtt_Kernel
|
||||||
rtt_klibc
|
rtt_klibc
|
||||||
|
rtt_ktime
|
||||||
rtt_libcpu
|
rtt_libcpu
|
||||||
rtt_Libraries
|
rtt_Libraries
|
||||||
rtt_POSIX
|
rtt_POSIX
|
||||||
|
|||||||
2
Kconfig
2
Kconfig
@ -13,3 +13,5 @@ rsource "libraries/Kconfig"
|
|||||||
if !RT_USING_NANO
|
if !RT_USING_NANO
|
||||||
rsource "board/Kconfig"
|
rsource "board/Kconfig"
|
||||||
endif
|
endif
|
||||||
|
|
||||||
|
rsource "packages/Kconfig"
|
||||||
|
|||||||
49
applications/erpc/SConscript
Normal file
49
applications/erpc/SConscript
Normal file
@ -0,0 +1,49 @@
|
|||||||
|
import os
|
||||||
|
from building import *
|
||||||
|
|
||||||
|
cwd = GetCurrentDir()
|
||||||
|
|
||||||
|
def p(*args):
|
||||||
|
return os.path.join(cwd, *args)
|
||||||
|
|
||||||
|
src = []
|
||||||
|
|
||||||
|
# server 侧业务代码
|
||||||
|
if GetDepend(['ERPC_MODE_SERVER']):
|
||||||
|
src += Glob(p('service/src', '*.c'))
|
||||||
|
src += Glob(p('service/src', '*.cpp'))
|
||||||
|
|
||||||
|
# client 侧业务代码
|
||||||
|
if GetDepend(['ERPC_MODE_CLIENT']):
|
||||||
|
src += Glob(p('client/src', '*.c'))
|
||||||
|
src += Glob(p('client/src', '*.cpp'))
|
||||||
|
|
||||||
|
# 生成的 proto(C++版)
|
||||||
|
gen_dir = p('proto', 'generated')
|
||||||
|
|
||||||
|
# interface 建议始终编译(两端都可能需要)
|
||||||
|
src += [p('proto', 'generated', 'head_service_interface.cpp')]
|
||||||
|
|
||||||
|
if GetDepend(['ERPC_MODE_SERVER']):
|
||||||
|
src += [p('proto', 'generated', 'head_service_server.cpp')]
|
||||||
|
|
||||||
|
if GetDepend(['ERPC_MODE_CLIENT']):
|
||||||
|
src += [p('proto', 'generated', 'head_service_client.cpp')]
|
||||||
|
|
||||||
|
CPPPATH = [
|
||||||
|
cwd,
|
||||||
|
p('service'),
|
||||||
|
p('client'),
|
||||||
|
gen_dir,
|
||||||
|
]
|
||||||
|
|
||||||
|
# depend 用于“组依赖”,空列表即可
|
||||||
|
group = DefineGroup(
|
||||||
|
'app_erpc',
|
||||||
|
src,
|
||||||
|
depend=[],
|
||||||
|
CPPPATH=CPPPATH,
|
||||||
|
CPPDEFINES=[],
|
||||||
|
)
|
||||||
|
|
||||||
|
Return('group')
|
||||||
96
applications/erpc/client/src/erpc_client_main.cpp
Normal file
96
applications/erpc/client/src/erpc_client_main.cpp
Normal file
@ -0,0 +1,96 @@
|
|||||||
|
//
|
||||||
|
// Created by Administrator on 2025/12/24.
|
||||||
|
//
|
||||||
|
|
||||||
|
#include <rtthread.h>
|
||||||
|
#include <rtdevice.h>
|
||||||
|
|
||||||
|
#include "erpc_transport_setup.h"
|
||||||
|
#include "erpc_mbf_setup.h"
|
||||||
|
#include "erpc_client_setup.h"
|
||||||
|
|
||||||
|
// generated (C++ stub)
|
||||||
|
#include "erpc/proto/generated/head_service_client.hpp"
|
||||||
|
#include "head_service_common.hpp" // 若有用到类型
|
||||||
|
|
||||||
|
#ifndef ERPC_UART_NAME
|
||||||
|
#define ERPC_UART_NAME "uart3"
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifndef ERPC_UART_BAUD
|
||||||
|
#define ERPC_UART_BAUD (115200)
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifndef ERPC_CLIENT_STACK
|
||||||
|
#define ERPC_CLIENT_STACK (4096)
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifndef ERPC_CLIENT_PRIO
|
||||||
|
#define ERPC_CLIENT_PRIO (20)
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifndef ERPC_CLIENT_TICK
|
||||||
|
#define ERPC_CLIENT_TICK (10)
|
||||||
|
#endif
|
||||||
|
|
||||||
|
static void erpc_client_entry(void *parameter)
|
||||||
|
{
|
||||||
|
(void)parameter;
|
||||||
|
|
||||||
|
rt_kprintf("[erpc] client init on %s, %d\r\n", ERPC_UART_NAME, ERPC_UART_BAUD);
|
||||||
|
|
||||||
|
erpc_transport_t transport = erpc_transport_cmsis_uart_init(ERPC_UART_NAME);
|
||||||
|
if (!transport)
|
||||||
|
{
|
||||||
|
rt_kprintf("[erpc] transport init failed!\r\n");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
erpc_mbf_t mbf = erpc_mbf_dynamic_init();
|
||||||
|
if (!mbf)
|
||||||
|
{
|
||||||
|
rt_kprintf("[erpc] mbf init failed!\r\n");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
// 注意:这通常返回的就是 ClientManager*(用 void* 包了一层)
|
||||||
|
erpc_client_t client = erpc_client_init(transport, mbf);
|
||||||
|
if (!client)
|
||||||
|
{
|
||||||
|
rt_kprintf("[erpc] client init failed!\r\n");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
auto *mgr = reinterpret_cast<erpc::ClientManager *>(client);
|
||||||
|
erpcShim::demo_client stub(mgr);
|
||||||
|
|
||||||
|
while (1)
|
||||||
|
{
|
||||||
|
|
||||||
|
int32_t r = stub.add(7, 8);
|
||||||
|
rt_kprintf("[erpc] add(1,2)=%d\r\n", (int)r);
|
||||||
|
rt_thread_mdelay(1000);
|
||||||
|
}
|
||||||
|
|
||||||
|
// 如果你未来要退出线程:
|
||||||
|
// erpc_client_deinit(client);
|
||||||
|
}
|
||||||
|
|
||||||
|
extern "C" int erpc_client_start(void)
|
||||||
|
{
|
||||||
|
rt_thread_t tid = rt_thread_create("erpc_cli",
|
||||||
|
erpc_client_entry,
|
||||||
|
RT_NULL,
|
||||||
|
ERPC_CLIENT_STACK,
|
||||||
|
ERPC_CLIENT_PRIO,
|
||||||
|
ERPC_CLIENT_TICK);
|
||||||
|
if (!tid)
|
||||||
|
{
|
||||||
|
rt_kprintf("[erpc] create client thread failed!\r\n");
|
||||||
|
return -RT_ERROR;
|
||||||
|
}
|
||||||
|
rt_thread_startup(tid);
|
||||||
|
return RT_EOK;
|
||||||
|
}
|
||||||
|
|
||||||
|
INIT_APP_EXPORT(erpc_client_start);
|
||||||
53
applications/erpc/proto/generated/c_head_service_client.cpp
Normal file
53
applications/erpc/proto/generated/c_head_service_client.cpp
Normal file
@ -0,0 +1,53 @@
|
|||||||
|
/*
|
||||||
|
* Generated by erpcgen 1.14.0 on Wed Dec 24 14:07:39 2025.
|
||||||
|
*
|
||||||
|
* AUTOGENERATED - DO NOT EDIT
|
||||||
|
*/
|
||||||
|
|
||||||
|
|
||||||
|
#include "c_head_service_client.h"
|
||||||
|
#include "head_service_client.hpp"
|
||||||
|
#include "erpc_manually_constructed.hpp"
|
||||||
|
|
||||||
|
using namespace erpc;
|
||||||
|
using namespace std;
|
||||||
|
using namespace erpcShim;
|
||||||
|
|
||||||
|
|
||||||
|
#if ERPC_ALLOCATION_POLICY == ERPC_ALLOCATION_POLICY_DYNAMIC
|
||||||
|
demo_client *s_demo_client = nullptr;
|
||||||
|
#else
|
||||||
|
ERPC_MANUALLY_CONSTRUCTED_STATIC(demo_client, s_demo_client);
|
||||||
|
#endif
|
||||||
|
|
||||||
|
int32_t add(int32_t a, int32_t b)
|
||||||
|
{
|
||||||
|
int32_t result;
|
||||||
|
result = s_demo_client->add(a, b);
|
||||||
|
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
void initdemo_client(erpc_client_t client)
|
||||||
|
{
|
||||||
|
#if ERPC_ALLOCATION_POLICY == ERPC_ALLOCATION_POLICY_DYNAMIC
|
||||||
|
erpc_assert(s_demo_client == nullptr);
|
||||||
|
s_demo_client = new demo_client(reinterpret_cast<ClientManager *>(client));
|
||||||
|
#else
|
||||||
|
erpc_assert(!s_demo_client.isUsed());
|
||||||
|
s_demo_client.construct(reinterpret_cast<ClientManager *>(client));
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
|
||||||
|
void deinitdemo_client(void)
|
||||||
|
{
|
||||||
|
#if ERPC_ALLOCATION_POLICY == ERPC_ALLOCATION_POLICY_DYNAMIC
|
||||||
|
if (s_demo_client != nullptr)
|
||||||
|
{
|
||||||
|
delete s_demo_client;
|
||||||
|
s_demo_client = nullptr;
|
||||||
|
}
|
||||||
|
#else
|
||||||
|
s_demo_client.destroy();
|
||||||
|
#endif
|
||||||
|
}
|
||||||
45
applications/erpc/proto/generated/c_head_service_client.h
Normal file
45
applications/erpc/proto/generated/c_head_service_client.h
Normal file
@ -0,0 +1,45 @@
|
|||||||
|
/*
|
||||||
|
* Generated by erpcgen 1.14.0 on Wed Dec 24 14:07:39 2025.
|
||||||
|
*
|
||||||
|
* AUTOGENERATED - DO NOT EDIT
|
||||||
|
*/
|
||||||
|
|
||||||
|
|
||||||
|
#if !defined(_c_head_service_client_h_)
|
||||||
|
#define _c_head_service_client_h_
|
||||||
|
|
||||||
|
#include "head_service_common.h"
|
||||||
|
#include "erpc_client_manager.h"
|
||||||
|
|
||||||
|
#if defined(__cplusplus)
|
||||||
|
extern "C"
|
||||||
|
{
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#if !defined(ERPC_FUNCTIONS_DEFINITIONS)
|
||||||
|
#define ERPC_FUNCTIONS_DEFINITIONS
|
||||||
|
|
||||||
|
|
||||||
|
/*! @brief demo identifiers */
|
||||||
|
enum _demo_ids
|
||||||
|
{
|
||||||
|
kdemo_service_id = 1,
|
||||||
|
kdemo_add_id = 1,
|
||||||
|
};
|
||||||
|
|
||||||
|
//! @name demo
|
||||||
|
//@{
|
||||||
|
int32_t add(int32_t a, int32_t b);
|
||||||
|
//@}
|
||||||
|
|
||||||
|
#endif // ERPC_FUNCTIONS_DEFINITIONS
|
||||||
|
|
||||||
|
void initdemo_client(erpc_client_t client);
|
||||||
|
|
||||||
|
void deinitdemo_client(void);
|
||||||
|
|
||||||
|
#if defined(__cplusplus)
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#endif // _c_head_service_client_h_
|
||||||
73
applications/erpc/proto/generated/c_head_service_server.cpp
Normal file
73
applications/erpc/proto/generated/c_head_service_server.cpp
Normal file
@ -0,0 +1,73 @@
|
|||||||
|
/*
|
||||||
|
* Generated by erpcgen 1.14.0 on Wed Dec 24 14:07:39 2025.
|
||||||
|
*
|
||||||
|
* AUTOGENERATED - DO NOT EDIT
|
||||||
|
*/
|
||||||
|
|
||||||
|
|
||||||
|
#include <new>
|
||||||
|
#include "c_head_service_server.h"
|
||||||
|
#include "head_service_server.hpp"
|
||||||
|
#include "erpc_manually_constructed.hpp"
|
||||||
|
|
||||||
|
using namespace erpc;
|
||||||
|
using namespace std;
|
||||||
|
using namespace erpcShim;
|
||||||
|
|
||||||
|
|
||||||
|
class demo_server: public demo_interface
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
virtual ~demo_server() {};
|
||||||
|
|
||||||
|
|
||||||
|
int32_t add(int32_t a, int32_t b)
|
||||||
|
{
|
||||||
|
int32_t result;
|
||||||
|
result = ::add(a, b);
|
||||||
|
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
ERPC_MANUALLY_CONSTRUCTED_STATIC(demo_service, s_demo_service);
|
||||||
|
ERPC_MANUALLY_CONSTRUCTED_STATIC(demo_server, s_demo_server);
|
||||||
|
|
||||||
|
erpc_service_t create_demo_service(void)
|
||||||
|
{
|
||||||
|
erpc_service_t service;
|
||||||
|
|
||||||
|
#if ERPC_ALLOCATION_POLICY == ERPC_ALLOCATION_POLICY_DYNAMIC
|
||||||
|
service = new (nothrow) demo_service(new (nothrow)demo_server());
|
||||||
|
#else
|
||||||
|
if (s_demo_service.isUsed())
|
||||||
|
{
|
||||||
|
service = NULL;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
s_demo_server.construct();
|
||||||
|
s_demo_service.construct(s_demo_server.get());
|
||||||
|
service = s_demo_service.get();
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
|
return service;
|
||||||
|
}
|
||||||
|
|
||||||
|
void destroy_demo_service(erpc_service_t service)
|
||||||
|
{
|
||||||
|
#if ERPC_ALLOCATION_POLICY == ERPC_ALLOCATION_POLICY_DYNAMIC
|
||||||
|
if (service)
|
||||||
|
{
|
||||||
|
delete (demo_server *)(((demo_service *)service)->getHandler());
|
||||||
|
delete (demo_service *)service;
|
||||||
|
}
|
||||||
|
#else
|
||||||
|
(void)service;
|
||||||
|
erpc_assert(service == s_demo_service.get());
|
||||||
|
s_demo_service.destroy();
|
||||||
|
s_demo_server.destroy();
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
|
||||||
50
applications/erpc/proto/generated/c_head_service_server.h
Normal file
50
applications/erpc/proto/generated/c_head_service_server.h
Normal file
@ -0,0 +1,50 @@
|
|||||||
|
/*
|
||||||
|
* Generated by erpcgen 1.14.0 on Wed Dec 24 14:07:39 2025.
|
||||||
|
*
|
||||||
|
* AUTOGENERATED - DO NOT EDIT
|
||||||
|
*/
|
||||||
|
|
||||||
|
|
||||||
|
#if !defined(_c_head_service_server_h_)
|
||||||
|
#define _c_head_service_server_h_
|
||||||
|
|
||||||
|
#include "head_service_common.h"
|
||||||
|
|
||||||
|
#if defined(__cplusplus)
|
||||||
|
extern "C"
|
||||||
|
{
|
||||||
|
#endif
|
||||||
|
|
||||||
|
typedef void * erpc_service_t;
|
||||||
|
|
||||||
|
#if !defined(ERPC_FUNCTIONS_DEFINITIONS)
|
||||||
|
#define ERPC_FUNCTIONS_DEFINITIONS
|
||||||
|
|
||||||
|
|
||||||
|
/*! @brief demo identifiers */
|
||||||
|
enum _demo_ids
|
||||||
|
{
|
||||||
|
kdemo_service_id = 1,
|
||||||
|
kdemo_add_id = 1,
|
||||||
|
};
|
||||||
|
|
||||||
|
//! @name demo
|
||||||
|
//@{
|
||||||
|
int32_t add(int32_t a, int32_t b);
|
||||||
|
//@}
|
||||||
|
|
||||||
|
|
||||||
|
#endif // ERPC_FUNCTIONS_DEFINITIONS
|
||||||
|
|
||||||
|
/*! @brief Return demo_service service object. */
|
||||||
|
erpc_service_t create_demo_service(void);
|
||||||
|
|
||||||
|
/*! @brief Destroy demo_service service object. */
|
||||||
|
void destroy_demo_service(erpc_service_t service);
|
||||||
|
|
||||||
|
|
||||||
|
#if defined(__cplusplus)
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#endif // _c_head_service_server_h_
|
||||||
97
applications/erpc/proto/generated/head_service_client.cpp
Normal file
97
applications/erpc/proto/generated/head_service_client.cpp
Normal file
@ -0,0 +1,97 @@
|
|||||||
|
/*
|
||||||
|
* Generated by erpcgen 1.14.0 on Wed Dec 24 14:07:39 2025.
|
||||||
|
*
|
||||||
|
* AUTOGENERATED - DO NOT EDIT
|
||||||
|
*/
|
||||||
|
|
||||||
|
|
||||||
|
#if ERPC_ALLOCATION_POLICY == ERPC_ALLOCATION_POLICY_DYNAMIC
|
||||||
|
#include "erpc_port.h"
|
||||||
|
#endif
|
||||||
|
#include "erpc_codec.hpp"
|
||||||
|
#include "head_service_client.hpp"
|
||||||
|
#include "erpc_manually_constructed.hpp"
|
||||||
|
|
||||||
|
#if 11400 != ERPC_VERSION_NUMBER
|
||||||
|
#error "The generated shim code version is different to the rest of eRPC code."
|
||||||
|
#endif
|
||||||
|
|
||||||
|
using namespace erpc;
|
||||||
|
using namespace std;
|
||||||
|
using namespace erpcShim;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
demo_client::demo_client(ClientManager *manager)
|
||||||
|
:m_clientManager(manager)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
demo_client::~demo_client()
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
// demo interface add function client shim.
|
||||||
|
int32_t demo_client::add(int32_t a, int32_t b)
|
||||||
|
{
|
||||||
|
erpc_status_t err = kErpcStatus_Success;
|
||||||
|
|
||||||
|
int32_t result;
|
||||||
|
|
||||||
|
#if ERPC_PRE_POST_ACTION
|
||||||
|
pre_post_action_cb preCB = m_clientManager->getPreCB();
|
||||||
|
if (preCB)
|
||||||
|
{
|
||||||
|
preCB();
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
|
// Get a new request.
|
||||||
|
RequestContext request = m_clientManager->createRequest(false);
|
||||||
|
|
||||||
|
// Encode the request.
|
||||||
|
Codec * codec = request.getCodec();
|
||||||
|
|
||||||
|
if (codec == NULL)
|
||||||
|
{
|
||||||
|
err = kErpcStatus_MemoryError;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
codec->startWriteMessage(message_type_t::kInvocationMessage, m_serviceId, m_addId, request.getSequence());
|
||||||
|
|
||||||
|
codec->write(a);
|
||||||
|
|
||||||
|
codec->write(b);
|
||||||
|
|
||||||
|
// Send message to server
|
||||||
|
// Codec status is checked inside this function.
|
||||||
|
m_clientManager->performRequest(request);
|
||||||
|
|
||||||
|
codec->read(result);
|
||||||
|
|
||||||
|
err = codec->getStatus();
|
||||||
|
}
|
||||||
|
|
||||||
|
// Dispose of the request.
|
||||||
|
m_clientManager->releaseRequest(request);
|
||||||
|
|
||||||
|
// Invoke error handler callback function
|
||||||
|
m_clientManager->callErrorHandler(err, m_addId);
|
||||||
|
|
||||||
|
#if ERPC_PRE_POST_ACTION
|
||||||
|
pre_post_action_cb postCB = m_clientManager->getPostCB();
|
||||||
|
if (postCB)
|
||||||
|
{
|
||||||
|
postCB();
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
|
|
||||||
|
if (err != kErpcStatus_Success)
|
||||||
|
{
|
||||||
|
result = -1;
|
||||||
|
}
|
||||||
|
|
||||||
|
return result;
|
||||||
|
}
|
||||||
34
applications/erpc/proto/generated/head_service_client.hpp
Normal file
34
applications/erpc/proto/generated/head_service_client.hpp
Normal file
@ -0,0 +1,34 @@
|
|||||||
|
/*
|
||||||
|
* Generated by erpcgen 1.14.0 on Wed Dec 24 14:07:39 2025.
|
||||||
|
*
|
||||||
|
* AUTOGENERATED - DO NOT EDIT
|
||||||
|
*/
|
||||||
|
|
||||||
|
|
||||||
|
#if !defined(_head_service_client_hpp_)
|
||||||
|
#define _head_service_client_hpp_
|
||||||
|
|
||||||
|
#include "head_service_interface.hpp"
|
||||||
|
|
||||||
|
#include "erpc_client_manager.h"
|
||||||
|
|
||||||
|
namespace erpcShim
|
||||||
|
{
|
||||||
|
|
||||||
|
class demo_client: public demo_interface
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
demo_client(erpc::ClientManager *manager);
|
||||||
|
|
||||||
|
virtual ~demo_client();
|
||||||
|
|
||||||
|
virtual int32_t add(int32_t a, int32_t b);
|
||||||
|
|
||||||
|
protected:
|
||||||
|
erpc::ClientManager *m_clientManager;
|
||||||
|
};
|
||||||
|
|
||||||
|
} // erpcShim
|
||||||
|
|
||||||
|
|
||||||
|
#endif // _head_service_client_hpp_
|
||||||
36
applications/erpc/proto/generated/head_service_common.h
Normal file
36
applications/erpc/proto/generated/head_service_common.h
Normal file
@ -0,0 +1,36 @@
|
|||||||
|
/*
|
||||||
|
* Generated by erpcgen 1.14.0 on Wed Dec 24 14:07:39 2025.
|
||||||
|
*
|
||||||
|
* AUTOGENERATED - DO NOT EDIT
|
||||||
|
*/
|
||||||
|
|
||||||
|
|
||||||
|
#if !defined(_head_service_common_h_)
|
||||||
|
#define _head_service_common_h_
|
||||||
|
|
||||||
|
|
||||||
|
#if defined(__cplusplus)
|
||||||
|
extern "C"
|
||||||
|
{
|
||||||
|
#endif
|
||||||
|
#include <stdbool.h>
|
||||||
|
#include <stddef.h>
|
||||||
|
#include <stdint.h>
|
||||||
|
|
||||||
|
#include "erpc_version.h"
|
||||||
|
|
||||||
|
#if 11400 != ERPC_VERSION_NUMBER
|
||||||
|
#error "The generated shim code version is different to the rest of eRPC code."
|
||||||
|
#endif
|
||||||
|
|
||||||
|
|
||||||
|
#if !defined(ERPC_TYPE_DEFINITIONS_ERPCSHIM)
|
||||||
|
#define ERPC_TYPE_DEFINITIONS_ERPCSHIM
|
||||||
|
|
||||||
|
#endif // ERPC_TYPE_DEFINITIONS_ERPCSHIM
|
||||||
|
|
||||||
|
#if defined(__cplusplus)
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#endif // _head_service_common_h_
|
||||||
28
applications/erpc/proto/generated/head_service_common.hpp
Normal file
28
applications/erpc/proto/generated/head_service_common.hpp
Normal file
@ -0,0 +1,28 @@
|
|||||||
|
/*
|
||||||
|
* Generated by erpcgen 1.14.0 on Wed Dec 24 14:07:39 2025.
|
||||||
|
*
|
||||||
|
* AUTOGENERATED - DO NOT EDIT
|
||||||
|
*/
|
||||||
|
|
||||||
|
|
||||||
|
#if !defined(_head_service_common_hpp_)
|
||||||
|
#define _head_service_common_hpp_
|
||||||
|
|
||||||
|
|
||||||
|
#include <cstddef>
|
||||||
|
#include <cstdint>
|
||||||
|
|
||||||
|
#include "erpc_version.h"
|
||||||
|
|
||||||
|
#if 11400 != ERPC_VERSION_NUMBER
|
||||||
|
#error "The generated shim code version is different to the rest of eRPC code."
|
||||||
|
#endif
|
||||||
|
|
||||||
|
|
||||||
|
#if !defined(ERPC_TYPE_DEFINITIONS_ERPCSHIM)
|
||||||
|
#define ERPC_TYPE_DEFINITIONS_ERPCSHIM
|
||||||
|
|
||||||
|
#endif // ERPC_TYPE_DEFINITIONS_ERPCSHIM
|
||||||
|
|
||||||
|
|
||||||
|
#endif // _head_service_common_hpp_
|
||||||
20
applications/erpc/proto/generated/head_service_interface.cpp
Normal file
20
applications/erpc/proto/generated/head_service_interface.cpp
Normal file
@ -0,0 +1,20 @@
|
|||||||
|
/*
|
||||||
|
* Generated by erpcgen 1.14.0 on Wed Dec 24 14:07:39 2025.
|
||||||
|
*
|
||||||
|
* AUTOGENERATED - DO NOT EDIT
|
||||||
|
*/
|
||||||
|
|
||||||
|
|
||||||
|
#include "head_service_interface.hpp"
|
||||||
|
|
||||||
|
#if 11400 != ERPC_VERSION_NUMBER
|
||||||
|
#error "The generated shim code version is different to the rest of eRPC code."
|
||||||
|
#endif
|
||||||
|
|
||||||
|
|
||||||
|
using namespace std;
|
||||||
|
using namespace erpcShim;
|
||||||
|
|
||||||
|
demo_interface::~demo_interface(void)
|
||||||
|
{
|
||||||
|
}
|
||||||
32
applications/erpc/proto/generated/head_service_interface.hpp
Normal file
32
applications/erpc/proto/generated/head_service_interface.hpp
Normal file
@ -0,0 +1,32 @@
|
|||||||
|
/*
|
||||||
|
* Generated by erpcgen 1.14.0 on Wed Dec 24 14:07:39 2025.
|
||||||
|
*
|
||||||
|
* AUTOGENERATED - DO NOT EDIT
|
||||||
|
*/
|
||||||
|
|
||||||
|
|
||||||
|
#if !defined(_head_service_interface_hpp_)
|
||||||
|
#define _head_service_interface_hpp_
|
||||||
|
|
||||||
|
#include "head_service_common.hpp"
|
||||||
|
|
||||||
|
namespace erpcShim
|
||||||
|
{
|
||||||
|
|
||||||
|
|
||||||
|
// Abstract base class for demo
|
||||||
|
class demo_interface
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
static const uint8_t m_serviceId = 1;
|
||||||
|
static const uint8_t m_addId = 1;
|
||||||
|
|
||||||
|
virtual ~demo_interface(void);
|
||||||
|
|
||||||
|
virtual int32_t add(int32_t a, int32_t b) = 0;
|
||||||
|
private:
|
||||||
|
};
|
||||||
|
} // erpcShim
|
||||||
|
|
||||||
|
|
||||||
|
#endif // _head_service_interface_hpp_
|
||||||
112
applications/erpc/proto/generated/head_service_server.cpp
Normal file
112
applications/erpc/proto/generated/head_service_server.cpp
Normal file
@ -0,0 +1,112 @@
|
|||||||
|
/*
|
||||||
|
* Generated by erpcgen 1.14.0 on Wed Dec 24 14:07:39 2025.
|
||||||
|
*
|
||||||
|
* AUTOGENERATED - DO NOT EDIT
|
||||||
|
*/
|
||||||
|
|
||||||
|
|
||||||
|
#include "head_service_server.hpp"
|
||||||
|
#if ERPC_ALLOCATION_POLICY == ERPC_ALLOCATION_POLICY_DYNAMIC
|
||||||
|
#include <new>
|
||||||
|
#include "erpc_port.h"
|
||||||
|
#endif
|
||||||
|
#include "erpc_manually_constructed.hpp"
|
||||||
|
|
||||||
|
#if 11400 != ERPC_VERSION_NUMBER
|
||||||
|
#error "The generated shim code version is different to the rest of eRPC code."
|
||||||
|
#endif
|
||||||
|
|
||||||
|
using namespace erpc;
|
||||||
|
using namespace std;
|
||||||
|
using namespace erpcShim;
|
||||||
|
|
||||||
|
#if ERPC_NESTED_CALLS_DETECTION
|
||||||
|
extern bool nestingDetection;
|
||||||
|
#endif
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
demo_service::demo_service(demo_interface *_demo_interface)
|
||||||
|
: erpc::Service(demo_interface::m_serviceId)
|
||||||
|
, m_handler(_demo_interface)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
demo_service::~demo_service()
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
// return service interface handler.
|
||||||
|
demo_interface* demo_service::getHandler(void)
|
||||||
|
{
|
||||||
|
return m_handler;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Call the correct server shim based on method unique ID.
|
||||||
|
erpc_status_t demo_service::handleInvocation(uint32_t methodId, uint32_t sequence, Codec * codec, MessageBufferFactory *messageFactory, Transport * transport)
|
||||||
|
{
|
||||||
|
erpc_status_t erpcStatus;
|
||||||
|
switch (methodId)
|
||||||
|
{
|
||||||
|
case demo_interface::m_addId:
|
||||||
|
{
|
||||||
|
erpcStatus = add_shim(codec, messageFactory, transport, sequence);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
default:
|
||||||
|
{
|
||||||
|
erpcStatus = kErpcStatus_InvalidArgument;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return erpcStatus;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Server shim for add of demo interface.
|
||||||
|
erpc_status_t demo_service::add_shim(Codec * codec, MessageBufferFactory *messageFactory, Transport * transport, uint32_t sequence)
|
||||||
|
{
|
||||||
|
erpc_status_t err = kErpcStatus_Success;
|
||||||
|
|
||||||
|
int32_t a;
|
||||||
|
int32_t b;
|
||||||
|
int32_t result;
|
||||||
|
|
||||||
|
// startReadMessage() was already called before this shim was invoked.
|
||||||
|
|
||||||
|
codec->read(a);
|
||||||
|
|
||||||
|
codec->read(b);
|
||||||
|
|
||||||
|
err = codec->getStatus();
|
||||||
|
if (err == kErpcStatus_Success)
|
||||||
|
{
|
||||||
|
// Invoke the actual served function.
|
||||||
|
#if ERPC_NESTED_CALLS_DETECTION
|
||||||
|
nestingDetection = true;
|
||||||
|
#endif
|
||||||
|
result = m_handler->add(a, b);
|
||||||
|
#if ERPC_NESTED_CALLS_DETECTION
|
||||||
|
nestingDetection = false;
|
||||||
|
#endif
|
||||||
|
|
||||||
|
// preparing MessageBuffer for serializing data
|
||||||
|
err = messageFactory->prepareServerBufferForSend(codec->getBufferRef(), transport->reserveHeaderSize());
|
||||||
|
}
|
||||||
|
|
||||||
|
if (err == kErpcStatus_Success)
|
||||||
|
{
|
||||||
|
// preparing codec for serializing data
|
||||||
|
codec->reset(transport->reserveHeaderSize());
|
||||||
|
|
||||||
|
// Build response message.
|
||||||
|
codec->startWriteMessage(message_type_t::kReplyMessage, demo_interface::m_serviceId, demo_interface::m_addId, sequence);
|
||||||
|
|
||||||
|
codec->write(result);
|
||||||
|
|
||||||
|
err = codec->getStatus();
|
||||||
|
}
|
||||||
|
|
||||||
|
return err;
|
||||||
|
}
|
||||||
49
applications/erpc/proto/generated/head_service_server.hpp
Normal file
49
applications/erpc/proto/generated/head_service_server.hpp
Normal file
@ -0,0 +1,49 @@
|
|||||||
|
/*
|
||||||
|
* Generated by erpcgen 1.14.0 on Wed Dec 24 14:07:39 2025.
|
||||||
|
*
|
||||||
|
* AUTOGENERATED - DO NOT EDIT
|
||||||
|
*/
|
||||||
|
|
||||||
|
|
||||||
|
#if !defined(_head_service_server_hpp_)
|
||||||
|
#define _head_service_server_hpp_
|
||||||
|
|
||||||
|
#include "head_service_interface.hpp"
|
||||||
|
|
||||||
|
#include "erpc_server.hpp"
|
||||||
|
#include "erpc_codec.hpp"
|
||||||
|
|
||||||
|
#if 11400 != ERPC_VERSION_NUMBER
|
||||||
|
#error "The generated shim code version is different to the rest of eRPC code."
|
||||||
|
#endif
|
||||||
|
|
||||||
|
|
||||||
|
namespace erpcShim
|
||||||
|
{
|
||||||
|
|
||||||
|
/*!
|
||||||
|
* @brief Service subclass for demo.
|
||||||
|
*/
|
||||||
|
class demo_service : public erpc::Service
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
demo_service(demo_interface *_demo_interface);
|
||||||
|
|
||||||
|
virtual ~demo_service();
|
||||||
|
|
||||||
|
/*! @brief return service interface handler. */
|
||||||
|
demo_interface* getHandler(void);
|
||||||
|
|
||||||
|
/*! @brief Call the correct server shim based on method unique ID. */
|
||||||
|
virtual erpc_status_t handleInvocation(uint32_t methodId, uint32_t sequence, erpc::Codec * codec, erpc::MessageBufferFactory *messageFactory, erpc::Transport * transport);
|
||||||
|
|
||||||
|
private:
|
||||||
|
demo_interface *m_handler;
|
||||||
|
/*! @brief Server shim for add of demo interface. */
|
||||||
|
erpc_status_t add_shim(erpc::Codec * codec, erpc::MessageBufferFactory *messageFactory, erpc::Transport * transport, uint32_t sequence);
|
||||||
|
};
|
||||||
|
|
||||||
|
} // erpcShim
|
||||||
|
|
||||||
|
|
||||||
|
#endif // _head_service_server_hpp_
|
||||||
3
applications/erpc/proto/head_service.erpc
Normal file
3
applications/erpc/proto/head_service.erpc
Normal file
@ -0,0 +1,3 @@
|
|||||||
|
interface demo {
|
||||||
|
add(int32 a, int32 b) -> int32
|
||||||
|
};
|
||||||
24
applications/erpc/service/include/head_service_impl.h
Normal file
24
applications/erpc/service/include/head_service_impl.h
Normal file
@ -0,0 +1,24 @@
|
|||||||
|
//
|
||||||
|
// Created by Administrator on 2025/12/24.
|
||||||
|
//
|
||||||
|
|
||||||
|
#ifndef RTTHREAD_HEAD_SERVICE_IMPL_H
|
||||||
|
#define RTTHREAD_HEAD_SERVICE_IMPL_H
|
||||||
|
|
||||||
|
|
||||||
|
#include <stdint.h>
|
||||||
|
#include "erpc/proto/generated/head_service_interface.hpp"
|
||||||
|
|
||||||
|
|
||||||
|
class HeadServiceImpl : public erpcShim::demo_interface
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
HeadServiceImpl() = default;
|
||||||
|
virtual ~HeadServiceImpl() = default;
|
||||||
|
|
||||||
|
// 实现你 .erpc 里定义的方法(这里只举例 add)
|
||||||
|
int32_t add(int32_t a, int32_t b) override;
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
#endif //RTTHREAD_HEAD_SERVICE_IMPL_H
|
||||||
106
applications/erpc/service/src/erpc_server_main.cpp
Normal file
106
applications/erpc/service/src/erpc_server_main.cpp
Normal file
@ -0,0 +1,106 @@
|
|||||||
|
//
|
||||||
|
// Created by Administrator on 2025/12/24.
|
||||||
|
//
|
||||||
|
|
||||||
|
#include <rtthread.h>
|
||||||
|
#include <rtdevice.h>
|
||||||
|
|
||||||
|
// eRPC setup
|
||||||
|
#include "erpc_server_setup.h"
|
||||||
|
#include "erpc_transport_setup.h"
|
||||||
|
#include "erpc_mbf_setup.h"
|
||||||
|
|
||||||
|
|
||||||
|
#include "erpc/proto/generated/head_service_server.hpp"
|
||||||
|
#include "erpc/proto/generated/head_service_interface.hpp"
|
||||||
|
|
||||||
|
#include "erpc/service/include/head_service_impl.h"
|
||||||
|
|
||||||
|
// ====== 可按需修改的参数 ======
|
||||||
|
#ifndef ERPC_UART_NAME
|
||||||
|
#define ERPC_UART_NAME "uart2"
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifndef ERPC_UART_BAUD
|
||||||
|
#define ERPC_UART_BAUD (115200)
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifndef ERPC_THREAD_STACK
|
||||||
|
#define ERPC_THREAD_STACK (8192)
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifndef ERPC_THREAD_PRIO
|
||||||
|
#define ERPC_THREAD_PRIO (20)
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifndef ERPC_THREAD_TICK
|
||||||
|
#define ERPC_THREAD_TICK (10)
|
||||||
|
#endif
|
||||||
|
|
||||||
|
static void erpc_server_entry(void *parameter)
|
||||||
|
{
|
||||||
|
(void)parameter;
|
||||||
|
|
||||||
|
rt_kprintf("[erpc] server init on %s, %d\r\n", ERPC_UART_NAME, ERPC_UART_BAUD);
|
||||||
|
|
||||||
|
// 1) transport
|
||||||
|
erpc_transport_t transport = erpc_transport_cmsis_uart_init(ERPC_UART_NAME);
|
||||||
|
if (!transport)
|
||||||
|
{
|
||||||
|
rt_kprintf("[erpc] transport init failed!\r\n");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
// 2) message buffer factory
|
||||||
|
erpc_mbf_t mbf = erpc_mbf_dynamic_init();
|
||||||
|
if (!mbf)
|
||||||
|
{
|
||||||
|
rt_kprintf("[erpc] mbf init failed!\r\n");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
// 3) init server(注意:返回 server 句柄)
|
||||||
|
erpc_server_t server = erpc_server_init(transport, mbf);
|
||||||
|
if (!server)
|
||||||
|
{
|
||||||
|
rt_kprintf("[erpc] server init failed!\r\n");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
// 4) register service(你生成的是 demo_service + demo_interface)
|
||||||
|
static HeadServiceImpl impl; // 必须继承 erpcShim::demo_interface
|
||||||
|
static erpcShim::demo_service service(&impl); // 生成的 service wrapper
|
||||||
|
|
||||||
|
erpc_add_service_to_server(server, &service);
|
||||||
|
|
||||||
|
rt_kprintf("[erpc] server run\r\n");
|
||||||
|
erpc_server_run(server);
|
||||||
|
while (true){
|
||||||
|
erpc_status_t tcp_status = erpc_server_poll(server);
|
||||||
|
if (tcp_status != kErpcStatus_Success)
|
||||||
|
{
|
||||||
|
// erpc_error_handler(tcp_status,0);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
extern "C" int erpc_server_start(void)
|
||||||
|
{
|
||||||
|
rt_thread_t tid = rt_thread_create("erpc_srv",
|
||||||
|
erpc_server_entry,
|
||||||
|
RT_NULL,
|
||||||
|
ERPC_THREAD_STACK,
|
||||||
|
ERPC_THREAD_PRIO,
|
||||||
|
ERPC_THREAD_TICK);
|
||||||
|
if (!tid)
|
||||||
|
{
|
||||||
|
rt_kprintf("[erpc] create thread failed!\r\n");
|
||||||
|
return -RT_ERROR;
|
||||||
|
}
|
||||||
|
|
||||||
|
rt_thread_startup(tid);
|
||||||
|
return RT_EOK;
|
||||||
|
}
|
||||||
|
|
||||||
|
// 让系统启动后自动拉起(如果你希望手动启动,就把这一行注释掉)
|
||||||
|
INIT_APP_EXPORT(erpc_server_start);
|
||||||
13
applications/erpc/service/src/head_service_impl.cpp
Normal file
13
applications/erpc/service/src/head_service_impl.cpp
Normal file
@ -0,0 +1,13 @@
|
|||||||
|
//
|
||||||
|
// Created by Administrator on 2025/12/24.
|
||||||
|
//
|
||||||
|
|
||||||
|
#include "../include/head_service_impl.h"
|
||||||
|
#include <rtthread.h>
|
||||||
|
|
||||||
|
|
||||||
|
int32_t HeadServiceImpl::add(int32_t a, int32_t b)
|
||||||
|
{
|
||||||
|
rt_kprintf("[erpc] add(%d, %d)\r\n", (int)a, (int)b);
|
||||||
|
return a + b;
|
||||||
|
}
|
||||||
File diff suppressed because one or more lines are too long
@ -14,33 +14,42 @@ Mcu.CPN=STM32H750XBH6
|
|||||||
Mcu.Family=STM32H7
|
Mcu.Family=STM32H7
|
||||||
Mcu.IP0=CORTEX_M7
|
Mcu.IP0=CORTEX_M7
|
||||||
Mcu.IP1=DEBUG
|
Mcu.IP1=DEBUG
|
||||||
|
Mcu.IP10=USART3
|
||||||
Mcu.IP2=MEMORYMAP
|
Mcu.IP2=MEMORYMAP
|
||||||
Mcu.IP3=NVIC
|
Mcu.IP3=NVIC
|
||||||
Mcu.IP4=QUADSPI
|
Mcu.IP4=QUADSPI
|
||||||
Mcu.IP5=RCC
|
Mcu.IP5=RCC
|
||||||
Mcu.IP6=SYS
|
Mcu.IP6=SPI5
|
||||||
Mcu.IP7=USART1
|
Mcu.IP7=SYS
|
||||||
Mcu.IPNb=8
|
Mcu.IP8=USART1
|
||||||
|
Mcu.IP9=USART2
|
||||||
|
Mcu.IPNb=11
|
||||||
Mcu.Name=STM32H750XBHx
|
Mcu.Name=STM32H750XBHx
|
||||||
Mcu.Package=TFBGA240
|
Mcu.Package=TFBGA240
|
||||||
Mcu.Pin0=PA14 (JTCK/SWCLK)
|
Mcu.Pin0=PD5
|
||||||
Mcu.Pin1=PC15-OSC32_OUT (OSC32_OUT)
|
Mcu.Pin1=PD6
|
||||||
Mcu.Pin10=PF7
|
Mcu.Pin10=PH0-OSC_IN (PH0)
|
||||||
Mcu.Pin11=PF8
|
Mcu.Pin11=PK0
|
||||||
Mcu.Pin12=PF10
|
Mcu.Pin12=PF6
|
||||||
Mcu.Pin13=PF9
|
Mcu.Pin13=PF7
|
||||||
Mcu.Pin14=PE9
|
Mcu.Pin14=PF8
|
||||||
Mcu.Pin15=VP_SYS_VS_Systick
|
Mcu.Pin15=PF10
|
||||||
Mcu.Pin16=VP_MEMORYMAP_VS_MEMORYMAP
|
Mcu.Pin16=PF9
|
||||||
Mcu.Pin2=PC14-OSC32_IN (OSC32_IN)
|
Mcu.Pin17=PJ10
|
||||||
Mcu.Pin3=PA13 (JTMS/SWDIO)
|
Mcu.Pin18=PE9
|
||||||
Mcu.Pin4=PA10
|
Mcu.Pin19=PD9
|
||||||
Mcu.Pin5=PA9
|
Mcu.Pin2=PA14 (JTCK/SWCLK)
|
||||||
Mcu.Pin6=PG6
|
Mcu.Pin20=PD8
|
||||||
Mcu.Pin7=PH1-OSC_OUT (PH1)
|
Mcu.Pin21=VP_SYS_VS_Systick
|
||||||
Mcu.Pin8=PH0-OSC_IN (PH0)
|
Mcu.Pin22=VP_MEMORYMAP_VS_MEMORYMAP
|
||||||
Mcu.Pin9=PF6
|
Mcu.Pin3=PC15-OSC32_OUT (OSC32_OUT)
|
||||||
Mcu.PinsNb=17
|
Mcu.Pin4=PC14-OSC32_IN (OSC32_IN)
|
||||||
|
Mcu.Pin5=PA13 (JTMS/SWDIO)
|
||||||
|
Mcu.Pin6=PA10
|
||||||
|
Mcu.Pin7=PA9
|
||||||
|
Mcu.Pin8=PG6
|
||||||
|
Mcu.Pin9=PH1-OSC_OUT (PH1)
|
||||||
|
Mcu.PinsNb=23
|
||||||
Mcu.ThirdPartyNb=0
|
Mcu.ThirdPartyNb=0
|
||||||
Mcu.UserConstants=
|
Mcu.UserConstants=
|
||||||
Mcu.UserName=STM32H750XBHx
|
Mcu.UserName=STM32H750XBHx
|
||||||
@ -71,6 +80,16 @@ PC14-OSC32_IN\ (OSC32_IN).Mode=LSE-External-Oscillator
|
|||||||
PC14-OSC32_IN\ (OSC32_IN).Signal=RCC_OSC32_IN
|
PC14-OSC32_IN\ (OSC32_IN).Signal=RCC_OSC32_IN
|
||||||
PC15-OSC32_OUT\ (OSC32_OUT).Mode=LSE-External-Oscillator
|
PC15-OSC32_OUT\ (OSC32_OUT).Mode=LSE-External-Oscillator
|
||||||
PC15-OSC32_OUT\ (OSC32_OUT).Signal=RCC_OSC32_OUT
|
PC15-OSC32_OUT\ (OSC32_OUT).Signal=RCC_OSC32_OUT
|
||||||
|
PD5.Mode=Asynchronous
|
||||||
|
PD5.Signal=USART2_TX
|
||||||
|
PD6.Mode=Asynchronous
|
||||||
|
PD6.Signal=USART2_RX
|
||||||
|
PD8.Locked=true
|
||||||
|
PD8.Mode=Asynchronous
|
||||||
|
PD8.Signal=USART3_TX
|
||||||
|
PD9.Locked=true
|
||||||
|
PD9.Mode=Asynchronous
|
||||||
|
PD9.Signal=USART3_RX
|
||||||
PE9.Locked=true
|
PE9.Locked=true
|
||||||
PE9.Signal=S_TIM1_CH1
|
PE9.Signal=S_TIM1_CH1
|
||||||
PF10.Mode=Single Bank 1
|
PF10.Mode=Single Bank 1
|
||||||
@ -93,6 +112,10 @@ PH0-OSC_IN\ (PH0).Mode=HSE-External-Oscillator
|
|||||||
PH0-OSC_IN\ (PH0).Signal=RCC_OSC_IN
|
PH0-OSC_IN\ (PH0).Signal=RCC_OSC_IN
|
||||||
PH1-OSC_OUT\ (PH1).Mode=HSE-External-Oscillator
|
PH1-OSC_OUT\ (PH1).Mode=HSE-External-Oscillator
|
||||||
PH1-OSC_OUT\ (PH1).Signal=RCC_OSC_OUT
|
PH1-OSC_OUT\ (PH1).Signal=RCC_OSC_OUT
|
||||||
|
PJ10.Mode=TX_Only_Simplex_Unidirect_Master
|
||||||
|
PJ10.Signal=SPI5_MOSI
|
||||||
|
PK0.Mode=TX_Only_Simplex_Unidirect_Master
|
||||||
|
PK0.Signal=SPI5_SCK
|
||||||
PinOutPanel.CurrentBGAView=Top
|
PinOutPanel.CurrentBGAView=Top
|
||||||
PinOutPanel.RotationAngle=0
|
PinOutPanel.RotationAngle=0
|
||||||
ProjectManager.AskForMigrate=true
|
ProjectManager.AskForMigrate=true
|
||||||
@ -127,7 +150,7 @@ ProjectManager.ToolChainLocation=
|
|||||||
ProjectManager.UAScriptAfterPath=
|
ProjectManager.UAScriptAfterPath=
|
||||||
ProjectManager.UAScriptBeforePath=
|
ProjectManager.UAScriptBeforePath=
|
||||||
ProjectManager.UnderRoot=false
|
ProjectManager.UnderRoot=false
|
||||||
ProjectManager.functionlistsort=1-SystemClock_Config-RCC-false-HAL-false,2-MX_GPIO_Init-GPIO-false-HAL-true,3-MX_USART1_UART_Init-USART1-false-HAL-true,4-MX_QUADSPI_Init-QUADSPI-false-HAL-true,0-MX_CORTEX_M7_Init-CORTEX_M7-false-HAL-true
|
ProjectManager.functionlistsort=1-SystemClock_Config-RCC-false-HAL-false,2-MX_GPIO_Init-GPIO-false-HAL-true,3-MX_USART1_UART_Init-USART1-false-HAL-true,4-MX_QUADSPI_Init-QUADSPI-false-HAL-true,5-MX_SPI5_Init-SPI5-false-HAL-true,6-MX_USART2_UART_Init-USART2-false-HAL-true,7-MX_USART3_UART_Init-USART3-false-HAL-true,0-MX_CORTEX_M7_Init-CORTEX_M7-false-HAL-true
|
||||||
QUADSPI.ChipSelectHighTime=QSPI_CS_HIGH_TIME_5_CYCLE
|
QUADSPI.ChipSelectHighTime=QSPI_CS_HIGH_TIME_5_CYCLE
|
||||||
QUADSPI.ClockPrescaler=5
|
QUADSPI.ClockPrescaler=5
|
||||||
QUADSPI.FifoThreshold=4
|
QUADSPI.FifoThreshold=4
|
||||||
@ -213,8 +236,17 @@ RCC.VCOInput2Freq_Value=2000000
|
|||||||
RCC.VCOInput3Freq_Value=2000000
|
RCC.VCOInput3Freq_Value=2000000
|
||||||
SH.S_TIM1_CH1.0=TIM1_CH1
|
SH.S_TIM1_CH1.0=TIM1_CH1
|
||||||
SH.S_TIM1_CH1.ConfNb=1
|
SH.S_TIM1_CH1.ConfNb=1
|
||||||
|
SPI5.CalculateBaudRate=60.0 MBits/s
|
||||||
|
SPI5.Direction=SPI_DIRECTION_2LINES_TXONLY
|
||||||
|
SPI5.IPParameters=VirtualType,Mode,Direction,CalculateBaudRate
|
||||||
|
SPI5.Mode=SPI_MODE_MASTER
|
||||||
|
SPI5.VirtualType=VM_MASTER
|
||||||
USART1.IPParameters=VirtualMode-Asynchronous
|
USART1.IPParameters=VirtualMode-Asynchronous
|
||||||
USART1.VirtualMode-Asynchronous=VM_ASYNC
|
USART1.VirtualMode-Asynchronous=VM_ASYNC
|
||||||
|
USART2.IPParameters=VirtualMode-Asynchronous
|
||||||
|
USART2.VirtualMode-Asynchronous=VM_ASYNC
|
||||||
|
USART3.IPParameters=VirtualMode-Asynchronous
|
||||||
|
USART3.VirtualMode-Asynchronous=VM_ASYNC
|
||||||
VP_MEMORYMAP_VS_MEMORYMAP.Mode=CurAppReg
|
VP_MEMORYMAP_VS_MEMORYMAP.Mode=CurAppReg
|
||||||
VP_MEMORYMAP_VS_MEMORYMAP.Signal=MEMORYMAP_VS_MEMORYMAP
|
VP_MEMORYMAP_VS_MEMORYMAP.Signal=MEMORYMAP_VS_MEMORYMAP
|
||||||
VP_SYS_VS_Systick.Mode=SysTick
|
VP_SYS_VS_Systick.Mode=SysTick
|
||||||
|
|||||||
File diff suppressed because it is too large
Load Diff
@ -0,0 +1,99 @@
|
|||||||
|
/**
|
||||||
|
******************************************************************************
|
||||||
|
* @file stm32h7xx_hal_spi_ex.h
|
||||||
|
* @author MCD Application Team
|
||||||
|
* @brief Header file of SPI HAL Extended module.
|
||||||
|
******************************************************************************
|
||||||
|
* @attention
|
||||||
|
*
|
||||||
|
* Copyright (c) 2017 STMicroelectronics.
|
||||||
|
* All rights reserved.
|
||||||
|
*
|
||||||
|
* This software is licensed under terms that can be found in the LICENSE file
|
||||||
|
* in the root directory of this software component.
|
||||||
|
* If no LICENSE file comes with this software, it is provided AS-IS.
|
||||||
|
*
|
||||||
|
******************************************************************************
|
||||||
|
*/
|
||||||
|
|
||||||
|
/* Define to prevent recursive inclusion -------------------------------------*/
|
||||||
|
#ifndef STM32H7xx_HAL_SPI_EX_H
|
||||||
|
#define STM32H7xx_HAL_SPI_EX_H
|
||||||
|
|
||||||
|
#ifdef __cplusplus
|
||||||
|
extern "C" {
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/* Includes ------------------------------------------------------------------*/
|
||||||
|
#include "stm32h7xx_hal_def.h"
|
||||||
|
|
||||||
|
/** @addtogroup STM32H7xx_HAL_Driver
|
||||||
|
* @{
|
||||||
|
*/
|
||||||
|
|
||||||
|
/** @addtogroup SPIEx
|
||||||
|
* @{
|
||||||
|
*/
|
||||||
|
|
||||||
|
/* Exported types ------------------------------------------------------------*/
|
||||||
|
/** @defgroup SPIEx_Exported_Types SPIEx Exported Types
|
||||||
|
* @{
|
||||||
|
*/
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @}
|
||||||
|
*/
|
||||||
|
|
||||||
|
/* Exported constants --------------------------------------------------------*/
|
||||||
|
/** @defgroup SPIEx_Exported_Constants SPIEx Exported Constants
|
||||||
|
* @{
|
||||||
|
*/
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @}
|
||||||
|
*/
|
||||||
|
|
||||||
|
/* Exported macros -----------------------------------------------------------*/
|
||||||
|
/** @defgroup SPIEx_Exported_Macros SPIEx Extended Exported Macros
|
||||||
|
* @{
|
||||||
|
*/
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @}
|
||||||
|
*/
|
||||||
|
|
||||||
|
/* Exported functions --------------------------------------------------------*/
|
||||||
|
/** @addtogroup SPIEx_Exported_Functions
|
||||||
|
* @{
|
||||||
|
*/
|
||||||
|
|
||||||
|
/* Initialization and de-initialization functions ****************************/
|
||||||
|
/* IO operation functions *****************************************************/
|
||||||
|
/** @addtogroup SPIEx_Exported_Functions_Group1
|
||||||
|
* @{
|
||||||
|
*/
|
||||||
|
HAL_StatusTypeDef HAL_SPIEx_FlushRxFifo(const SPI_HandleTypeDef *hspi);
|
||||||
|
HAL_StatusTypeDef HAL_SPIEx_EnableLockConfiguration(SPI_HandleTypeDef *hspi);
|
||||||
|
HAL_StatusTypeDef HAL_SPIEx_ConfigureUnderrun(SPI_HandleTypeDef *hspi, uint32_t UnderrunDetection,
|
||||||
|
uint32_t UnderrunBehaviour);
|
||||||
|
/**
|
||||||
|
* @}
|
||||||
|
*/
|
||||||
|
/**
|
||||||
|
* @}
|
||||||
|
*/
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @}
|
||||||
|
*/
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @}
|
||||||
|
*/
|
||||||
|
|
||||||
|
|
||||||
|
#ifdef __cplusplus
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#endif /* STM32H7xx_HAL_SPI_EX_H */
|
||||||
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
@ -0,0 +1,226 @@
|
|||||||
|
/**
|
||||||
|
******************************************************************************
|
||||||
|
* @file stm32h7xx_hal_spi_ex.c
|
||||||
|
* @author MCD Application Team
|
||||||
|
* @brief Extended SPI HAL module driver.
|
||||||
|
* This file provides firmware functions to manage the following
|
||||||
|
* SPI peripheral extended functionalities :
|
||||||
|
* + IO operation functions
|
||||||
|
* + Peripheral Control functions
|
||||||
|
*
|
||||||
|
******************************************************************************
|
||||||
|
* @attention
|
||||||
|
*
|
||||||
|
* Copyright (c) 2017 STMicroelectronics.
|
||||||
|
* All rights reserved.
|
||||||
|
*
|
||||||
|
* This software is licensed under terms that can be found in the LICENSE file
|
||||||
|
* in the root directory of this software component.
|
||||||
|
* If no LICENSE file comes with this software, it is provided AS-IS.
|
||||||
|
*
|
||||||
|
******************************************************************************
|
||||||
|
*/
|
||||||
|
|
||||||
|
/* Includes ------------------------------------------------------------------*/
|
||||||
|
#include "stm32h7xx_hal.h"
|
||||||
|
|
||||||
|
/** @addtogroup STM32H7xx_HAL_Driver
|
||||||
|
* @{
|
||||||
|
*/
|
||||||
|
|
||||||
|
/** @defgroup SPIEx SPIEx
|
||||||
|
* @brief SPI Extended HAL module driver
|
||||||
|
* @{
|
||||||
|
*/
|
||||||
|
#ifdef HAL_SPI_MODULE_ENABLED
|
||||||
|
|
||||||
|
/* Private typedef -----------------------------------------------------------*/
|
||||||
|
/* Private defines -----------------------------------------------------------*/
|
||||||
|
/* Private macros ------------------------------------------------------------*/
|
||||||
|
/* Private variables ---------------------------------------------------------*/
|
||||||
|
/* Private function prototypes -----------------------------------------------*/
|
||||||
|
/* Exported functions --------------------------------------------------------*/
|
||||||
|
|
||||||
|
/** @defgroup SPIEx_Exported_Functions SPIEx Exported Functions
|
||||||
|
* @{
|
||||||
|
*/
|
||||||
|
|
||||||
|
/** @defgroup SPIEx_Exported_Functions_Group1 IO operation functions
|
||||||
|
* @brief Data transfers functions
|
||||||
|
*
|
||||||
|
@verbatim
|
||||||
|
==============================================================================
|
||||||
|
##### IO operation functions #####
|
||||||
|
===============================================================================
|
||||||
|
[..]
|
||||||
|
This subsection provides a set of extended functions to manage the SPI
|
||||||
|
data transfers.
|
||||||
|
|
||||||
|
(#) SPIEx function:
|
||||||
|
(++) HAL_SPIEx_FlushRxFifo()
|
||||||
|
(++) HAL_SPIEx_EnableLockConfiguration()
|
||||||
|
(++) HAL_SPIEx_ConfigureUnderrun()
|
||||||
|
|
||||||
|
@endverbatim
|
||||||
|
* @{
|
||||||
|
*/
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Flush the RX fifo.
|
||||||
|
* @param hspi: pointer to a SPI_HandleTypeDef structure that contains
|
||||||
|
* the configuration information for the specified SPI module.
|
||||||
|
* @retval HAL status
|
||||||
|
*/
|
||||||
|
HAL_StatusTypeDef HAL_SPIEx_FlushRxFifo(const SPI_HandleTypeDef *hspi)
|
||||||
|
{
|
||||||
|
uint8_t count = 0;
|
||||||
|
uint32_t itflag = hspi->Instance->SR;
|
||||||
|
__IO uint32_t tmpreg;
|
||||||
|
|
||||||
|
while (((hspi->Instance->SR & SPI_FLAG_FRLVL) != SPI_RX_FIFO_0PACKET) || ((itflag & SPI_FLAG_RXWNE) != 0UL))
|
||||||
|
{
|
||||||
|
count += (uint8_t)4UL;
|
||||||
|
tmpreg = hspi->Instance->RXDR;
|
||||||
|
UNUSED(tmpreg); /* To avoid GCC warning */
|
||||||
|
|
||||||
|
if (IS_SPI_HIGHEND_INSTANCE(hspi->Instance))
|
||||||
|
{
|
||||||
|
if (count > SPI_HIGHEND_FIFO_SIZE)
|
||||||
|
{
|
||||||
|
return HAL_TIMEOUT;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
if (count > SPI_LOWEND_FIFO_SIZE)
|
||||||
|
{
|
||||||
|
return HAL_TIMEOUT;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return HAL_OK;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Enable the Lock for the AF configuration of associated IOs
|
||||||
|
* and write protect the Content of Configuration register 2
|
||||||
|
* when SPI is enabled
|
||||||
|
* @param hspi: pointer to a SPI_HandleTypeDef structure that contains
|
||||||
|
* the configuration information for SPI module.
|
||||||
|
* @retval None
|
||||||
|
*/
|
||||||
|
HAL_StatusTypeDef HAL_SPIEx_EnableLockConfiguration(SPI_HandleTypeDef *hspi)
|
||||||
|
{
|
||||||
|
HAL_StatusTypeDef errorcode = HAL_OK;
|
||||||
|
|
||||||
|
/* Process Locked */
|
||||||
|
__HAL_LOCK(hspi);
|
||||||
|
|
||||||
|
if (hspi->State != HAL_SPI_STATE_READY)
|
||||||
|
{
|
||||||
|
errorcode = HAL_BUSY;
|
||||||
|
hspi->State = HAL_SPI_STATE_READY;
|
||||||
|
/* Process Unlocked */
|
||||||
|
__HAL_UNLOCK(hspi);
|
||||||
|
return errorcode;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Check if the SPI is disabled to edit IOLOCK bit */
|
||||||
|
if ((hspi->Instance->CR1 & SPI_CR1_SPE) != SPI_CR1_SPE)
|
||||||
|
{
|
||||||
|
SET_BIT(hspi->Instance->CR1, SPI_CR1_IOLOCK);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
/* Disable SPI peripheral */
|
||||||
|
__HAL_SPI_DISABLE(hspi);
|
||||||
|
|
||||||
|
SET_BIT(hspi->Instance->CR1, SPI_CR1_IOLOCK);
|
||||||
|
|
||||||
|
/* Enable SPI peripheral */
|
||||||
|
__HAL_SPI_ENABLE(hspi);
|
||||||
|
}
|
||||||
|
|
||||||
|
hspi->State = HAL_SPI_STATE_READY;
|
||||||
|
/* Process Unlocked */
|
||||||
|
__HAL_UNLOCK(hspi);
|
||||||
|
return errorcode;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Configure the UNDERRUN condition and behavior of slave transmitter.
|
||||||
|
* @param hspi: pointer to a SPI_HandleTypeDef structure that contains
|
||||||
|
* the configuration information for SPI module.
|
||||||
|
* @param UnderrunDetection : Detection of underrun condition at slave transmitter
|
||||||
|
* This parameter can be a value of @ref SPI_Underrun_Detection.
|
||||||
|
* @param UnderrunBehaviour : Behavior of slave transmitter at underrun condition
|
||||||
|
* This parameter can be a value of @ref SPI_Underrun_Behaviour.
|
||||||
|
* @retval None
|
||||||
|
*/
|
||||||
|
HAL_StatusTypeDef HAL_SPIEx_ConfigureUnderrun(SPI_HandleTypeDef *hspi, uint32_t UnderrunDetection,
|
||||||
|
uint32_t UnderrunBehaviour)
|
||||||
|
{
|
||||||
|
HAL_StatusTypeDef errorcode = HAL_OK;
|
||||||
|
|
||||||
|
/* Process Locked */
|
||||||
|
__HAL_LOCK(hspi);
|
||||||
|
|
||||||
|
/* Check State and Insure that Underrun configuration is managed only by Salve */
|
||||||
|
if ((hspi->State != HAL_SPI_STATE_READY) || (hspi->Init.Mode != SPI_MODE_SLAVE))
|
||||||
|
{
|
||||||
|
errorcode = HAL_BUSY;
|
||||||
|
hspi->State = HAL_SPI_STATE_READY;
|
||||||
|
/* Process Unlocked */
|
||||||
|
__HAL_UNLOCK(hspi);
|
||||||
|
return errorcode;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Check the parameters */
|
||||||
|
assert_param(IS_SPI_UNDERRUN_DETECTION(UnderrunDetection));
|
||||||
|
assert_param(IS_SPI_UNDERRUN_BEHAVIOUR(UnderrunBehaviour));
|
||||||
|
|
||||||
|
/* Check if the SPI is disabled to edit CFG1 register */
|
||||||
|
if ((hspi->Instance->CR1 & SPI_CR1_SPE) != SPI_CR1_SPE)
|
||||||
|
{
|
||||||
|
/* Configure Underrun fields */
|
||||||
|
MODIFY_REG(hspi->Instance->CFG1, SPI_CFG1_UDRDET, UnderrunDetection);
|
||||||
|
MODIFY_REG(hspi->Instance->CFG1, SPI_CFG1_UDRCFG, UnderrunBehaviour);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
/* Disable SPI peripheral */
|
||||||
|
__HAL_SPI_DISABLE(hspi);
|
||||||
|
|
||||||
|
/* Configure Underrun fields */
|
||||||
|
MODIFY_REG(hspi->Instance->CFG1, SPI_CFG1_UDRDET, UnderrunDetection);
|
||||||
|
MODIFY_REG(hspi->Instance->CFG1, SPI_CFG1_UDRCFG, UnderrunBehaviour);
|
||||||
|
|
||||||
|
/* Enable SPI peripheral */
|
||||||
|
__HAL_SPI_ENABLE(hspi);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
hspi->State = HAL_SPI_STATE_READY;
|
||||||
|
/* Process Unlocked */
|
||||||
|
__HAL_UNLOCK(hspi);
|
||||||
|
return errorcode;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @}
|
||||||
|
*/
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @}
|
||||||
|
*/
|
||||||
|
|
||||||
|
#endif /* HAL_SPI_MODULE_ENABLED */
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @}
|
||||||
|
*/
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @}
|
||||||
|
*/
|
||||||
@ -72,7 +72,7 @@
|
|||||||
/* #define HAL_SD_MODULE_ENABLED */
|
/* #define HAL_SD_MODULE_ENABLED */
|
||||||
/* #define HAL_MMC_MODULE_ENABLED */
|
/* #define HAL_MMC_MODULE_ENABLED */
|
||||||
/* #define HAL_SPDIFRX_MODULE_ENABLED */
|
/* #define HAL_SPDIFRX_MODULE_ENABLED */
|
||||||
/* #define HAL_SPI_MODULE_ENABLED */
|
#define HAL_SPI_MODULE_ENABLED
|
||||||
/* #define HAL_SWPMI_MODULE_ENABLED */
|
/* #define HAL_SWPMI_MODULE_ENABLED */
|
||||||
/* #define HAL_TIM_MODULE_ENABLED */
|
/* #define HAL_TIM_MODULE_ENABLED */
|
||||||
#define HAL_UART_MODULE_ENABLED
|
#define HAL_UART_MODULE_ENABLED
|
||||||
|
|||||||
@ -43,7 +43,11 @@
|
|||||||
|
|
||||||
QSPI_HandleTypeDef hqspi;
|
QSPI_HandleTypeDef hqspi;
|
||||||
|
|
||||||
|
SPI_HandleTypeDef hspi5;
|
||||||
|
|
||||||
UART_HandleTypeDef huart1;
|
UART_HandleTypeDef huart1;
|
||||||
|
UART_HandleTypeDef huart2;
|
||||||
|
UART_HandleTypeDef huart3;
|
||||||
|
|
||||||
/* USER CODE BEGIN PV */
|
/* USER CODE BEGIN PV */
|
||||||
|
|
||||||
@ -55,6 +59,9 @@ static void MPU_Config(void);
|
|||||||
static void MX_GPIO_Init(void);
|
static void MX_GPIO_Init(void);
|
||||||
static void MX_USART1_UART_Init(void);
|
static void MX_USART1_UART_Init(void);
|
||||||
static void MX_QUADSPI_Init(void);
|
static void MX_QUADSPI_Init(void);
|
||||||
|
static void MX_SPI5_Init(void);
|
||||||
|
static void MX_USART2_UART_Init(void);
|
||||||
|
static void MX_USART3_UART_Init(void);
|
||||||
/* USER CODE BEGIN PFP */
|
/* USER CODE BEGIN PFP */
|
||||||
|
|
||||||
/* USER CODE END PFP */
|
/* USER CODE END PFP */
|
||||||
@ -98,6 +105,9 @@ int main(void)
|
|||||||
MX_GPIO_Init();
|
MX_GPIO_Init();
|
||||||
MX_USART1_UART_Init();
|
MX_USART1_UART_Init();
|
||||||
MX_QUADSPI_Init();
|
MX_QUADSPI_Init();
|
||||||
|
MX_SPI5_Init();
|
||||||
|
MX_USART2_UART_Init();
|
||||||
|
MX_USART3_UART_Init();
|
||||||
/* USER CODE BEGIN 2 */
|
/* USER CODE BEGIN 2 */
|
||||||
|
|
||||||
/* USER CODE END 2 */
|
/* USER CODE END 2 */
|
||||||
@ -207,6 +217,54 @@ static void MX_QUADSPI_Init(void)
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief SPI5 Initialization Function
|
||||||
|
* @param None
|
||||||
|
* @retval None
|
||||||
|
*/
|
||||||
|
static void MX_SPI5_Init(void)
|
||||||
|
{
|
||||||
|
|
||||||
|
/* USER CODE BEGIN SPI5_Init 0 */
|
||||||
|
|
||||||
|
/* USER CODE END SPI5_Init 0 */
|
||||||
|
|
||||||
|
/* USER CODE BEGIN SPI5_Init 1 */
|
||||||
|
|
||||||
|
/* USER CODE END SPI5_Init 1 */
|
||||||
|
/* SPI5 parameter configuration*/
|
||||||
|
hspi5.Instance = SPI5;
|
||||||
|
hspi5.Init.Mode = SPI_MODE_MASTER;
|
||||||
|
hspi5.Init.Direction = SPI_DIRECTION_2LINES_TXONLY;
|
||||||
|
hspi5.Init.DataSize = SPI_DATASIZE_4BIT;
|
||||||
|
hspi5.Init.CLKPolarity = SPI_POLARITY_LOW;
|
||||||
|
hspi5.Init.CLKPhase = SPI_PHASE_1EDGE;
|
||||||
|
hspi5.Init.NSS = SPI_NSS_SOFT;
|
||||||
|
hspi5.Init.BaudRatePrescaler = SPI_BAUDRATEPRESCALER_2;
|
||||||
|
hspi5.Init.FirstBit = SPI_FIRSTBIT_MSB;
|
||||||
|
hspi5.Init.TIMode = SPI_TIMODE_DISABLE;
|
||||||
|
hspi5.Init.CRCCalculation = SPI_CRCCALCULATION_DISABLE;
|
||||||
|
hspi5.Init.CRCPolynomial = 0x0;
|
||||||
|
hspi5.Init.NSSPMode = SPI_NSS_PULSE_ENABLE;
|
||||||
|
hspi5.Init.NSSPolarity = SPI_NSS_POLARITY_LOW;
|
||||||
|
hspi5.Init.FifoThreshold = SPI_FIFO_THRESHOLD_01DATA;
|
||||||
|
hspi5.Init.TxCRCInitializationPattern = SPI_CRC_INITIALIZATION_ALL_ZERO_PATTERN;
|
||||||
|
hspi5.Init.RxCRCInitializationPattern = SPI_CRC_INITIALIZATION_ALL_ZERO_PATTERN;
|
||||||
|
hspi5.Init.MasterSSIdleness = SPI_MASTER_SS_IDLENESS_00CYCLE;
|
||||||
|
hspi5.Init.MasterInterDataIdleness = SPI_MASTER_INTERDATA_IDLENESS_00CYCLE;
|
||||||
|
hspi5.Init.MasterReceiverAutoSusp = SPI_MASTER_RX_AUTOSUSP_DISABLE;
|
||||||
|
hspi5.Init.MasterKeepIOState = SPI_MASTER_KEEP_IO_STATE_DISABLE;
|
||||||
|
hspi5.Init.IOSwap = SPI_IO_SWAP_DISABLE;
|
||||||
|
if (HAL_SPI_Init(&hspi5) != HAL_OK)
|
||||||
|
{
|
||||||
|
Error_Handler();
|
||||||
|
}
|
||||||
|
/* USER CODE BEGIN SPI5_Init 2 */
|
||||||
|
|
||||||
|
/* USER CODE END SPI5_Init 2 */
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief USART1 Initialization Function
|
* @brief USART1 Initialization Function
|
||||||
* @param None
|
* @param None
|
||||||
@ -255,6 +313,102 @@ static void MX_USART1_UART_Init(void)
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief USART2 Initialization Function
|
||||||
|
* @param None
|
||||||
|
* @retval None
|
||||||
|
*/
|
||||||
|
static void MX_USART2_UART_Init(void)
|
||||||
|
{
|
||||||
|
|
||||||
|
/* USER CODE BEGIN USART2_Init 0 */
|
||||||
|
|
||||||
|
/* USER CODE END USART2_Init 0 */
|
||||||
|
|
||||||
|
/* USER CODE BEGIN USART2_Init 1 */
|
||||||
|
|
||||||
|
/* USER CODE END USART2_Init 1 */
|
||||||
|
huart2.Instance = USART2;
|
||||||
|
huart2.Init.BaudRate = 115200;
|
||||||
|
huart2.Init.WordLength = UART_WORDLENGTH_8B;
|
||||||
|
huart2.Init.StopBits = UART_STOPBITS_1;
|
||||||
|
huart2.Init.Parity = UART_PARITY_NONE;
|
||||||
|
huart2.Init.Mode = UART_MODE_TX_RX;
|
||||||
|
huart2.Init.HwFlowCtl = UART_HWCONTROL_NONE;
|
||||||
|
huart2.Init.OverSampling = UART_OVERSAMPLING_16;
|
||||||
|
huart2.Init.OneBitSampling = UART_ONE_BIT_SAMPLE_DISABLE;
|
||||||
|
huart2.Init.ClockPrescaler = UART_PRESCALER_DIV1;
|
||||||
|
huart2.AdvancedInit.AdvFeatureInit = UART_ADVFEATURE_NO_INIT;
|
||||||
|
if (HAL_UART_Init(&huart2) != HAL_OK)
|
||||||
|
{
|
||||||
|
Error_Handler();
|
||||||
|
}
|
||||||
|
if (HAL_UARTEx_SetTxFifoThreshold(&huart2, UART_TXFIFO_THRESHOLD_1_8) != HAL_OK)
|
||||||
|
{
|
||||||
|
Error_Handler();
|
||||||
|
}
|
||||||
|
if (HAL_UARTEx_SetRxFifoThreshold(&huart2, UART_RXFIFO_THRESHOLD_1_8) != HAL_OK)
|
||||||
|
{
|
||||||
|
Error_Handler();
|
||||||
|
}
|
||||||
|
if (HAL_UARTEx_DisableFifoMode(&huart2) != HAL_OK)
|
||||||
|
{
|
||||||
|
Error_Handler();
|
||||||
|
}
|
||||||
|
/* USER CODE BEGIN USART2_Init 2 */
|
||||||
|
|
||||||
|
/* USER CODE END USART2_Init 2 */
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief USART3 Initialization Function
|
||||||
|
* @param None
|
||||||
|
* @retval None
|
||||||
|
*/
|
||||||
|
static void MX_USART3_UART_Init(void)
|
||||||
|
{
|
||||||
|
|
||||||
|
/* USER CODE BEGIN USART3_Init 0 */
|
||||||
|
|
||||||
|
/* USER CODE END USART3_Init 0 */
|
||||||
|
|
||||||
|
/* USER CODE BEGIN USART3_Init 1 */
|
||||||
|
|
||||||
|
/* USER CODE END USART3_Init 1 */
|
||||||
|
huart3.Instance = USART3;
|
||||||
|
huart3.Init.BaudRate = 115200;
|
||||||
|
huart3.Init.WordLength = UART_WORDLENGTH_8B;
|
||||||
|
huart3.Init.StopBits = UART_STOPBITS_1;
|
||||||
|
huart3.Init.Parity = UART_PARITY_NONE;
|
||||||
|
huart3.Init.Mode = UART_MODE_TX_RX;
|
||||||
|
huart3.Init.HwFlowCtl = UART_HWCONTROL_NONE;
|
||||||
|
huart3.Init.OverSampling = UART_OVERSAMPLING_16;
|
||||||
|
huart3.Init.OneBitSampling = UART_ONE_BIT_SAMPLE_DISABLE;
|
||||||
|
huart3.Init.ClockPrescaler = UART_PRESCALER_DIV1;
|
||||||
|
huart3.AdvancedInit.AdvFeatureInit = UART_ADVFEATURE_NO_INIT;
|
||||||
|
if (HAL_UART_Init(&huart3) != HAL_OK)
|
||||||
|
{
|
||||||
|
Error_Handler();
|
||||||
|
}
|
||||||
|
if (HAL_UARTEx_SetTxFifoThreshold(&huart3, UART_TXFIFO_THRESHOLD_1_8) != HAL_OK)
|
||||||
|
{
|
||||||
|
Error_Handler();
|
||||||
|
}
|
||||||
|
if (HAL_UARTEx_SetRxFifoThreshold(&huart3, UART_RXFIFO_THRESHOLD_1_8) != HAL_OK)
|
||||||
|
{
|
||||||
|
Error_Handler();
|
||||||
|
}
|
||||||
|
if (HAL_UARTEx_DisableFifoMode(&huart3) != HAL_OK)
|
||||||
|
{
|
||||||
|
Error_Handler();
|
||||||
|
}
|
||||||
|
/* USER CODE BEGIN USART3_Init 2 */
|
||||||
|
|
||||||
|
/* USER CODE END USART3_Init 2 */
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief GPIO Initialization Function
|
* @brief GPIO Initialization Function
|
||||||
* @param None
|
* @param None
|
||||||
@ -268,11 +422,14 @@ static void MX_GPIO_Init(void)
|
|||||||
/* USER CODE END MX_GPIO_Init_1 */
|
/* USER CODE END MX_GPIO_Init_1 */
|
||||||
|
|
||||||
/* GPIO Ports Clock Enable */
|
/* GPIO Ports Clock Enable */
|
||||||
|
__HAL_RCC_GPIOD_CLK_ENABLE();
|
||||||
__HAL_RCC_GPIOA_CLK_ENABLE();
|
__HAL_RCC_GPIOA_CLK_ENABLE();
|
||||||
__HAL_RCC_GPIOC_CLK_ENABLE();
|
__HAL_RCC_GPIOC_CLK_ENABLE();
|
||||||
__HAL_RCC_GPIOG_CLK_ENABLE();
|
__HAL_RCC_GPIOG_CLK_ENABLE();
|
||||||
__HAL_RCC_GPIOH_CLK_ENABLE();
|
__HAL_RCC_GPIOH_CLK_ENABLE();
|
||||||
|
__HAL_RCC_GPIOK_CLK_ENABLE();
|
||||||
__HAL_RCC_GPIOF_CLK_ENABLE();
|
__HAL_RCC_GPIOF_CLK_ENABLE();
|
||||||
|
__HAL_RCC_GPIOJ_CLK_ENABLE();
|
||||||
__HAL_RCC_GPIOE_CLK_ENABLE();
|
__HAL_RCC_GPIOE_CLK_ENABLE();
|
||||||
|
|
||||||
/*Configure GPIO pin : PE9 */
|
/*Configure GPIO pin : PE9 */
|
||||||
|
|||||||
@ -179,6 +179,93 @@ void HAL_QSPI_MspDeInit(QSPI_HandleTypeDef* hqspi)
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief SPI MSP Initialization
|
||||||
|
* This function configures the hardware resources used in this example
|
||||||
|
* @param hspi: SPI handle pointer
|
||||||
|
* @retval None
|
||||||
|
*/
|
||||||
|
void HAL_SPI_MspInit(SPI_HandleTypeDef* hspi)
|
||||||
|
{
|
||||||
|
GPIO_InitTypeDef GPIO_InitStruct = {0};
|
||||||
|
RCC_PeriphCLKInitTypeDef PeriphClkInitStruct = {0};
|
||||||
|
if(hspi->Instance==SPI5)
|
||||||
|
{
|
||||||
|
/* USER CODE BEGIN SPI5_MspInit 0 */
|
||||||
|
|
||||||
|
/* USER CODE END SPI5_MspInit 0 */
|
||||||
|
|
||||||
|
/** Initializes the peripherals clock
|
||||||
|
*/
|
||||||
|
PeriphClkInitStruct.PeriphClockSelection = RCC_PERIPHCLK_SPI5;
|
||||||
|
PeriphClkInitStruct.Spi45ClockSelection = RCC_SPI45CLKSOURCE_D2PCLK1;
|
||||||
|
if (HAL_RCCEx_PeriphCLKConfig(&PeriphClkInitStruct) != HAL_OK)
|
||||||
|
{
|
||||||
|
Error_Handler();
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Peripheral clock enable */
|
||||||
|
__HAL_RCC_SPI5_CLK_ENABLE();
|
||||||
|
|
||||||
|
__HAL_RCC_GPIOK_CLK_ENABLE();
|
||||||
|
__HAL_RCC_GPIOJ_CLK_ENABLE();
|
||||||
|
/**SPI5 GPIO Configuration
|
||||||
|
PK0 ------> SPI5_SCK
|
||||||
|
PJ10 ------> SPI5_MOSI
|
||||||
|
*/
|
||||||
|
GPIO_InitStruct.Pin = GPIO_PIN_0;
|
||||||
|
GPIO_InitStruct.Mode = GPIO_MODE_AF_PP;
|
||||||
|
GPIO_InitStruct.Pull = GPIO_NOPULL;
|
||||||
|
GPIO_InitStruct.Speed = GPIO_SPEED_FREQ_LOW;
|
||||||
|
GPIO_InitStruct.Alternate = GPIO_AF5_SPI5;
|
||||||
|
HAL_GPIO_Init(GPIOK, &GPIO_InitStruct);
|
||||||
|
|
||||||
|
GPIO_InitStruct.Pin = GPIO_PIN_10;
|
||||||
|
GPIO_InitStruct.Mode = GPIO_MODE_AF_PP;
|
||||||
|
GPIO_InitStruct.Pull = GPIO_NOPULL;
|
||||||
|
GPIO_InitStruct.Speed = GPIO_SPEED_FREQ_LOW;
|
||||||
|
GPIO_InitStruct.Alternate = GPIO_AF5_SPI5;
|
||||||
|
HAL_GPIO_Init(GPIOJ, &GPIO_InitStruct);
|
||||||
|
|
||||||
|
/* USER CODE BEGIN SPI5_MspInit 1 */
|
||||||
|
|
||||||
|
/* USER CODE END SPI5_MspInit 1 */
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief SPI MSP De-Initialization
|
||||||
|
* This function freeze the hardware resources used in this example
|
||||||
|
* @param hspi: SPI handle pointer
|
||||||
|
* @retval None
|
||||||
|
*/
|
||||||
|
void HAL_SPI_MspDeInit(SPI_HandleTypeDef* hspi)
|
||||||
|
{
|
||||||
|
if(hspi->Instance==SPI5)
|
||||||
|
{
|
||||||
|
/* USER CODE BEGIN SPI5_MspDeInit 0 */
|
||||||
|
|
||||||
|
/* USER CODE END SPI5_MspDeInit 0 */
|
||||||
|
/* Peripheral clock disable */
|
||||||
|
__HAL_RCC_SPI5_CLK_DISABLE();
|
||||||
|
|
||||||
|
/**SPI5 GPIO Configuration
|
||||||
|
PK0 ------> SPI5_SCK
|
||||||
|
PJ10 ------> SPI5_MOSI
|
||||||
|
*/
|
||||||
|
HAL_GPIO_DeInit(GPIOK, GPIO_PIN_0);
|
||||||
|
|
||||||
|
HAL_GPIO_DeInit(GPIOJ, GPIO_PIN_10);
|
||||||
|
|
||||||
|
/* USER CODE BEGIN SPI5_MspDeInit 1 */
|
||||||
|
|
||||||
|
/* USER CODE END SPI5_MspDeInit 1 */
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief UART MSP Initialization
|
* @brief UART MSP Initialization
|
||||||
* This function configures the hardware resources used in this example
|
* This function configures the hardware resources used in this example
|
||||||
@ -222,7 +309,74 @@ void HAL_UART_MspInit(UART_HandleTypeDef* huart)
|
|||||||
/* USER CODE BEGIN USART1_MspInit 1 */
|
/* USER CODE BEGIN USART1_MspInit 1 */
|
||||||
|
|
||||||
/* USER CODE END USART1_MspInit 1 */
|
/* USER CODE END USART1_MspInit 1 */
|
||||||
|
}
|
||||||
|
else if(huart->Instance==USART2)
|
||||||
|
{
|
||||||
|
/* USER CODE BEGIN USART2_MspInit 0 */
|
||||||
|
|
||||||
|
/* USER CODE END USART2_MspInit 0 */
|
||||||
|
|
||||||
|
/** Initializes the peripherals clock
|
||||||
|
*/
|
||||||
|
PeriphClkInitStruct.PeriphClockSelection = RCC_PERIPHCLK_USART2;
|
||||||
|
PeriphClkInitStruct.Usart234578ClockSelection = RCC_USART234578CLKSOURCE_D2PCLK1;
|
||||||
|
if (HAL_RCCEx_PeriphCLKConfig(&PeriphClkInitStruct) != HAL_OK)
|
||||||
|
{
|
||||||
|
Error_Handler();
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Peripheral clock enable */
|
||||||
|
__HAL_RCC_USART2_CLK_ENABLE();
|
||||||
|
|
||||||
|
__HAL_RCC_GPIOD_CLK_ENABLE();
|
||||||
|
/**USART2 GPIO Configuration
|
||||||
|
PD5 ------> USART2_TX
|
||||||
|
PD6 ------> USART2_RX
|
||||||
|
*/
|
||||||
|
GPIO_InitStruct.Pin = GPIO_PIN_5|GPIO_PIN_6;
|
||||||
|
GPIO_InitStruct.Mode = GPIO_MODE_AF_PP;
|
||||||
|
GPIO_InitStruct.Pull = GPIO_NOPULL;
|
||||||
|
GPIO_InitStruct.Speed = GPIO_SPEED_FREQ_LOW;
|
||||||
|
GPIO_InitStruct.Alternate = GPIO_AF7_USART2;
|
||||||
|
HAL_GPIO_Init(GPIOD, &GPIO_InitStruct);
|
||||||
|
|
||||||
|
/* USER CODE BEGIN USART2_MspInit 1 */
|
||||||
|
|
||||||
|
/* USER CODE END USART2_MspInit 1 */
|
||||||
|
}
|
||||||
|
else if(huart->Instance==USART3)
|
||||||
|
{
|
||||||
|
/* USER CODE BEGIN USART3_MspInit 0 */
|
||||||
|
|
||||||
|
/* USER CODE END USART3_MspInit 0 */
|
||||||
|
|
||||||
|
/** Initializes the peripherals clock
|
||||||
|
*/
|
||||||
|
PeriphClkInitStruct.PeriphClockSelection = RCC_PERIPHCLK_USART3;
|
||||||
|
PeriphClkInitStruct.Usart234578ClockSelection = RCC_USART234578CLKSOURCE_D2PCLK1;
|
||||||
|
if (HAL_RCCEx_PeriphCLKConfig(&PeriphClkInitStruct) != HAL_OK)
|
||||||
|
{
|
||||||
|
Error_Handler();
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Peripheral clock enable */
|
||||||
|
__HAL_RCC_USART3_CLK_ENABLE();
|
||||||
|
|
||||||
|
__HAL_RCC_GPIOD_CLK_ENABLE();
|
||||||
|
/**USART3 GPIO Configuration
|
||||||
|
PD9 ------> USART3_RX
|
||||||
|
PD8 ------> USART3_TX
|
||||||
|
*/
|
||||||
|
GPIO_InitStruct.Pin = GPIO_PIN_9|GPIO_PIN_8;
|
||||||
|
GPIO_InitStruct.Mode = GPIO_MODE_AF_PP;
|
||||||
|
GPIO_InitStruct.Pull = GPIO_NOPULL;
|
||||||
|
GPIO_InitStruct.Speed = GPIO_SPEED_FREQ_LOW;
|
||||||
|
GPIO_InitStruct.Alternate = GPIO_AF7_USART3;
|
||||||
|
HAL_GPIO_Init(GPIOD, &GPIO_InitStruct);
|
||||||
|
|
||||||
|
/* USER CODE BEGIN USART3_MspInit 1 */
|
||||||
|
|
||||||
|
/* USER CODE END USART3_MspInit 1 */
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
@ -253,6 +407,42 @@ void HAL_UART_MspDeInit(UART_HandleTypeDef* huart)
|
|||||||
|
|
||||||
/* USER CODE END USART1_MspDeInit 1 */
|
/* USER CODE END USART1_MspDeInit 1 */
|
||||||
}
|
}
|
||||||
|
else if(huart->Instance==USART2)
|
||||||
|
{
|
||||||
|
/* USER CODE BEGIN USART2_MspDeInit 0 */
|
||||||
|
|
||||||
|
/* USER CODE END USART2_MspDeInit 0 */
|
||||||
|
/* Peripheral clock disable */
|
||||||
|
__HAL_RCC_USART2_CLK_DISABLE();
|
||||||
|
|
||||||
|
/**USART2 GPIO Configuration
|
||||||
|
PD5 ------> USART2_TX
|
||||||
|
PD6 ------> USART2_RX
|
||||||
|
*/
|
||||||
|
HAL_GPIO_DeInit(GPIOD, GPIO_PIN_5|GPIO_PIN_6);
|
||||||
|
|
||||||
|
/* USER CODE BEGIN USART2_MspDeInit 1 */
|
||||||
|
|
||||||
|
/* USER CODE END USART2_MspDeInit 1 */
|
||||||
|
}
|
||||||
|
else if(huart->Instance==USART3)
|
||||||
|
{
|
||||||
|
/* USER CODE BEGIN USART3_MspDeInit 0 */
|
||||||
|
|
||||||
|
/* USER CODE END USART3_MspDeInit 0 */
|
||||||
|
/* Peripheral clock disable */
|
||||||
|
__HAL_RCC_USART3_CLK_DISABLE();
|
||||||
|
|
||||||
|
/**USART3 GPIO Configuration
|
||||||
|
PD9 ------> USART3_RX
|
||||||
|
PD8 ------> USART3_TX
|
||||||
|
*/
|
||||||
|
HAL_GPIO_DeInit(GPIOD, GPIO_PIN_9|GPIO_PIN_8);
|
||||||
|
|
||||||
|
/* USER CODE BEGIN USART3_MspDeInit 1 */
|
||||||
|
|
||||||
|
/* USER CODE END USART3_MspDeInit 1 */
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -49,6 +49,8 @@ set(STM32_Drivers_Src
|
|||||||
${CMAKE_CURRENT_SOURCE_DIR}/../../Drivers/STM32H7xx_HAL_Driver/Src/stm32h7xx_hal_exti.c
|
${CMAKE_CURRENT_SOURCE_DIR}/../../Drivers/STM32H7xx_HAL_Driver/Src/stm32h7xx_hal_exti.c
|
||||||
${CMAKE_CURRENT_SOURCE_DIR}/../../Drivers/STM32H7xx_HAL_Driver/Src/stm32h7xx_hal_qspi.c
|
${CMAKE_CURRENT_SOURCE_DIR}/../../Drivers/STM32H7xx_HAL_Driver/Src/stm32h7xx_hal_qspi.c
|
||||||
${CMAKE_CURRENT_SOURCE_DIR}/../../Drivers/STM32H7xx_HAL_Driver/Src/stm32h7xx_ll_delayblock.c
|
${CMAKE_CURRENT_SOURCE_DIR}/../../Drivers/STM32H7xx_HAL_Driver/Src/stm32h7xx_ll_delayblock.c
|
||||||
|
${CMAKE_CURRENT_SOURCE_DIR}/../../Drivers/STM32H7xx_HAL_Driver/Src/stm32h7xx_hal_spi.c
|
||||||
|
${CMAKE_CURRENT_SOURCE_DIR}/../../Drivers/STM32H7xx_HAL_Driver/Src/stm32h7xx_hal_spi_ex.c
|
||||||
${CMAKE_CURRENT_SOURCE_DIR}/../../Drivers/STM32H7xx_HAL_Driver/Src/stm32h7xx_hal_tim.c
|
${CMAKE_CURRENT_SOURCE_DIR}/../../Drivers/STM32H7xx_HAL_Driver/Src/stm32h7xx_hal_tim.c
|
||||||
${CMAKE_CURRENT_SOURCE_DIR}/../../Drivers/STM32H7xx_HAL_Driver/Src/stm32h7xx_hal_tim_ex.c
|
${CMAKE_CURRENT_SOURCE_DIR}/../../Drivers/STM32H7xx_HAL_Driver/Src/stm32h7xx_hal_tim_ex.c
|
||||||
${CMAKE_CURRENT_SOURCE_DIR}/../../Drivers/STM32H7xx_HAL_Driver/Src/stm32h7xx_hal_uart.c
|
${CMAKE_CURRENT_SOURCE_DIR}/../../Drivers/STM32H7xx_HAL_Driver/Src/stm32h7xx_hal_uart.c
|
||||||
|
|||||||
170
board/Kconfig
170
board/Kconfig
@ -9,13 +9,7 @@ config SOC_STM32H750XB
|
|||||||
|
|
||||||
menu "Onboard Peripheral Drivers"
|
menu "Onboard Peripheral Drivers"
|
||||||
|
|
||||||
# config BSP_USING_QSPI_FLASH
|
|
||||||
# bool "Enable QSPI FLASH (w25q64 qspi)"
|
|
||||||
# select BSP_USING_QSPI
|
|
||||||
# select FAL_USING_SFUD_PORT
|
|
||||||
# select RT_USING_SFUD
|
|
||||||
# select RT_SFUD_USING_QSPI
|
|
||||||
# default n
|
|
||||||
|
|
||||||
config BSP_USING_QSPI_FLASH
|
config BSP_USING_QSPI_FLASH
|
||||||
bool "Enable QSPI FLASH (w25q64 qspi)"
|
bool "Enable QSPI FLASH (w25q64 qspi)"
|
||||||
@ -40,6 +34,22 @@ menu "On-chip Peripheral Drivers"
|
|||||||
select RT_USING_PIN
|
select RT_USING_PIN
|
||||||
default y
|
default y
|
||||||
|
|
||||||
|
# menuconfig BSP_USING_UART
|
||||||
|
# bool "Enable UART"
|
||||||
|
# default y
|
||||||
|
# select RT_USING_SERIAL
|
||||||
|
# if BSP_USING_UART
|
||||||
|
# config BSP_STM32_UART_V1_TX_TIMEOUT
|
||||||
|
# int "UART TX timeout"
|
||||||
|
# default 2000
|
||||||
|
# depends on RT_USING_SERIAL_V1
|
||||||
|
#
|
||||||
|
# config BSP_USING_UART1
|
||||||
|
# bool "Enable UART1"
|
||||||
|
# default y
|
||||||
|
#
|
||||||
|
# endif
|
||||||
|
|
||||||
menuconfig BSP_USING_UART
|
menuconfig BSP_USING_UART
|
||||||
bool "Enable UART"
|
bool "Enable UART"
|
||||||
default y
|
default y
|
||||||
@ -47,13 +57,106 @@ menu "On-chip Peripheral Drivers"
|
|||||||
if BSP_USING_UART
|
if BSP_USING_UART
|
||||||
config BSP_STM32_UART_V1_TX_TIMEOUT
|
config BSP_STM32_UART_V1_TX_TIMEOUT
|
||||||
int "UART TX timeout"
|
int "UART TX timeout"
|
||||||
default 2000
|
default 6000
|
||||||
depends on RT_USING_SERIAL_V1
|
depends on RT_USING_SERIAL_V1
|
||||||
|
|
||||||
config BSP_USING_UART1
|
menuconfig BSP_USING_UART1
|
||||||
bool "Enable UART1"
|
bool "Enable UART1"
|
||||||
default y
|
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
|
||||||
|
|
||||||
|
config BSP_UART1_DMA_PING_BUFSIZE
|
||||||
|
int "Set UART1 RX DMA ping-pong buffer size"
|
||||||
|
range 32 65535
|
||||||
|
depends on RT_USING_SERIAL_V2 && BSP_UART1_RX_USING_DMA
|
||||||
|
default 64
|
||||||
|
endif
|
||||||
|
|
||||||
|
menuconfig BSP_USING_UART2
|
||||||
|
bool "Enable UART2"
|
||||||
|
default y
|
||||||
|
if BSP_USING_UART2
|
||||||
|
config BSP_UART2_RX_USING_DMA
|
||||||
|
bool "Enable UART2 RX DMA"
|
||||||
|
select RT_SERIAL_USING_DMA
|
||||||
|
default n
|
||||||
|
|
||||||
|
config BSP_UART2_TX_USING_DMA
|
||||||
|
bool "Enable UART2 TX DMA"
|
||||||
|
select RT_SERIAL_USING_DMA
|
||||||
|
default n
|
||||||
|
|
||||||
|
config BSP_UART2_RX_BUFSIZE
|
||||||
|
int "Set UART2 RX buffer size"
|
||||||
|
range 64 65535
|
||||||
|
depends on BSP_USING_UART2
|
||||||
|
default 256
|
||||||
|
|
||||||
|
config BSP_UART2_TX_BUFSIZE
|
||||||
|
int "Set UART2 TX buffer size"
|
||||||
|
range 0 65535
|
||||||
|
depends on BSP_USING_UART2
|
||||||
|
default 0
|
||||||
|
|
||||||
|
config BSP_UART2_DMA_PING_BUFSIZE
|
||||||
|
int "Set UART2 RX DMA ping-pong buffer size"
|
||||||
|
range 32 65535
|
||||||
|
depends on RT_USING_SERIAL_V2 && BSP_UART2_RX_USING_DMA
|
||||||
|
default 64
|
||||||
|
endif
|
||||||
|
menuconfig BSP_USING_UART3
|
||||||
|
bool "Enable UART3"
|
||||||
|
default y
|
||||||
|
if BSP_USING_UART3
|
||||||
|
config BSP_UART3_RX_USING_DMA
|
||||||
|
bool "Enable UART3 RX DMA"
|
||||||
|
select RT_SERIAL_USING_DMA
|
||||||
|
default n
|
||||||
|
|
||||||
|
config BSP_UART3_TX_USING_DMA
|
||||||
|
bool "Enable UART3 TX DMA"
|
||||||
|
select RT_SERIAL_USING_DMA
|
||||||
|
default n
|
||||||
|
|
||||||
|
config BSP_UART3_RX_BUFSIZE
|
||||||
|
int "Set UART3 RX buffer size"
|
||||||
|
range 64 65535
|
||||||
|
depends on BSP_USING_UART3
|
||||||
|
default 256
|
||||||
|
|
||||||
|
config BSP_UART3_TX_BUFSIZE
|
||||||
|
int "Set UART3 TX buffer size"
|
||||||
|
range 0 65535
|
||||||
|
depends on BSP_USING_UART3
|
||||||
|
default 0
|
||||||
|
|
||||||
|
config BSP_UART3_DMA_PING_BUFSIZE
|
||||||
|
int "Set UART3 RX DMA ping-pong buffer size"
|
||||||
|
range 32 65535
|
||||||
|
depends on RT_USING_SERIAL_V2 && BSP_UART3_RX_USING_DMA
|
||||||
|
default 64
|
||||||
|
endif
|
||||||
endif
|
endif
|
||||||
menuconfig BSP_USING_PWM
|
menuconfig BSP_USING_PWM
|
||||||
bool "Enable pwm"
|
bool "Enable pwm"
|
||||||
@ -75,7 +178,54 @@ menu "On-chip Peripheral Drivers"
|
|||||||
select RT_USING_QSPI
|
select RT_USING_QSPI
|
||||||
select RT_USING_SPI
|
select RT_USING_SPI
|
||||||
default n
|
default n
|
||||||
|
menuconfig BSP_USING_SPI
|
||||||
|
bool "Enable SPI BUS"
|
||||||
|
default n
|
||||||
|
select RT_USING_SPI
|
||||||
|
if BSP_USING_SPI
|
||||||
|
|
||||||
|
config BSP_USING_SPI1
|
||||||
|
bool "Enable SPI1 BUS"
|
||||||
|
default n
|
||||||
|
|
||||||
|
config BSP_SPI1_TX_USING_DMA
|
||||||
|
bool "Enable SPI1 TX DMA"
|
||||||
|
depends on BSP_USING_SPI1
|
||||||
|
default n
|
||||||
|
|
||||||
|
config BSP_SPI1_RX_USING_DMA
|
||||||
|
bool "Enable SPI1 RX DMA"
|
||||||
|
depends on BSP_USING_SPI1
|
||||||
|
default n
|
||||||
|
|
||||||
|
config BSP_USING_SPI5
|
||||||
|
bool "Enable SPI5 BUS"
|
||||||
|
default n
|
||||||
|
|
||||||
|
config BSP_SPI5_TX_USING_DMA
|
||||||
|
bool "Enable SPI5 TX DMA"
|
||||||
|
depends on BSP_USING_SPI5
|
||||||
|
default n
|
||||||
|
|
||||||
|
config BSP_SPI5_RX_USING_DMA
|
||||||
|
bool "Enable SPI5 RX DMA"
|
||||||
|
depends on BSP_USING_SPI5
|
||||||
|
default n
|
||||||
|
|
||||||
|
config BSP_USING_SPI6
|
||||||
|
bool "Enable SPI6 BUS"
|
||||||
|
default n
|
||||||
|
|
||||||
|
config BSP_SPI6_TX_USING_DMA
|
||||||
|
bool "Enable SPI6 TX DMA"
|
||||||
|
depends on BSP_USING_SPI6
|
||||||
|
default n
|
||||||
|
|
||||||
|
config BSP_SPI6_RX_USING_DMA
|
||||||
|
bool "Enable SPI6 RX DMA"
|
||||||
|
depends on BSP_USING_SPI6
|
||||||
|
default n
|
||||||
|
endif
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
33
rtconfig.h
33
rtconfig.h
@ -61,7 +61,7 @@
|
|||||||
|
|
||||||
/* end of rt_strnlen options */
|
/* end of rt_strnlen options */
|
||||||
/* end of klibc options */
|
/* end of klibc options */
|
||||||
#define RT_NAME_MAX 12
|
#define RT_NAME_MAX 20
|
||||||
#define RT_CPUS_NR 1
|
#define RT_CPUS_NR 1
|
||||||
#define RT_ALIGN_SIZE 8
|
#define RT_ALIGN_SIZE 8
|
||||||
#define RT_THREAD_PRIORITY_32
|
#define RT_THREAD_PRIORITY_32
|
||||||
@ -72,7 +72,7 @@
|
|||||||
#define RT_HOOK_USING_FUNC_PTR
|
#define RT_HOOK_USING_FUNC_PTR
|
||||||
#define RT_USING_IDLE_HOOK
|
#define RT_USING_IDLE_HOOK
|
||||||
#define RT_IDLE_HOOK_LIST_SIZE 4
|
#define RT_IDLE_HOOK_LIST_SIZE 4
|
||||||
#define IDLE_THREAD_STACK_SIZE 256
|
#define IDLE_THREAD_STACK_SIZE 512
|
||||||
|
|
||||||
/* kservice options */
|
/* kservice options */
|
||||||
|
|
||||||
@ -142,8 +142,10 @@
|
|||||||
#define RT_USING_SERIAL
|
#define RT_USING_SERIAL
|
||||||
#define RT_USING_SERIAL_V1
|
#define RT_USING_SERIAL_V1
|
||||||
#define RT_SERIAL_USING_DMA
|
#define RT_SERIAL_USING_DMA
|
||||||
#define RT_SERIAL_RB_BUFSZ 64
|
#define RT_SERIAL_RB_BUFSZ 128
|
||||||
|
#define RT_USING_SPI
|
||||||
#define RT_USING_PIN
|
#define RT_USING_PIN
|
||||||
|
#define RT_USING_KTIME
|
||||||
/* end of Device Drivers */
|
/* end of Device Drivers */
|
||||||
|
|
||||||
/* C/C++ and POSIX layer */
|
/* C/C++ and POSIX layer */
|
||||||
@ -161,6 +163,10 @@
|
|||||||
|
|
||||||
/* POSIX (Portable Operating System Interface) layer */
|
/* POSIX (Portable Operating System Interface) layer */
|
||||||
|
|
||||||
|
#define RT_USING_POSIX_DELAY
|
||||||
|
#define RT_USING_POSIX_CLOCK
|
||||||
|
#define RT_USING_PTHREADS
|
||||||
|
#define PTHREAD_NUM_MAX 8
|
||||||
|
|
||||||
/* Interprocess Communication (IPC) */
|
/* Interprocess Communication (IPC) */
|
||||||
|
|
||||||
@ -169,6 +175,7 @@
|
|||||||
|
|
||||||
/* end of Interprocess Communication (IPC) */
|
/* end of Interprocess Communication (IPC) */
|
||||||
/* end of POSIX (Portable Operating System Interface) layer */
|
/* end of POSIX (Portable Operating System Interface) layer */
|
||||||
|
#define RT_USING_CPLUSPLUS
|
||||||
/* end of C/C++ and POSIX layer */
|
/* end of C/C++ and POSIX layer */
|
||||||
|
|
||||||
/* Network */
|
/* Network */
|
||||||
@ -415,10 +422,30 @@
|
|||||||
#define BSP_USING_UART
|
#define BSP_USING_UART
|
||||||
#define BSP_STM32_UART_V1_TX_TIMEOUT 2000
|
#define BSP_STM32_UART_V1_TX_TIMEOUT 2000
|
||||||
#define BSP_USING_UART1
|
#define BSP_USING_UART1
|
||||||
|
#define BSP_USING_UART2
|
||||||
|
#define BSP_UART2_RX_BUFSIZE 1024
|
||||||
|
#define BSP_UART2_TX_BUFSIZE 0
|
||||||
|
#define BSP_USING_UART3
|
||||||
|
#define BSP_UART3_RX_BUFSIZE 256
|
||||||
|
#define BSP_UART3_TX_BUFSIZE 0
|
||||||
|
#define BSP_USING_SPI
|
||||||
|
#define BSP_USING_SPI5
|
||||||
|
#define BSP_SPI5_TX_USING_DMA
|
||||||
/* end of On-chip Peripheral Drivers */
|
/* end of On-chip Peripheral Drivers */
|
||||||
|
|
||||||
/* Board extended module Drivers */
|
/* Board extended module Drivers */
|
||||||
|
|
||||||
/* end of Hardware Drivers Config */
|
/* end of Hardware Drivers Config */
|
||||||
|
|
||||||
|
/* Third Packages Drivers */
|
||||||
|
|
||||||
|
#define BSP_USING_ERPC
|
||||||
|
#define ERPC_USING_RTT
|
||||||
|
#define ERPC_MODE
|
||||||
|
#define ERPC_MODE_SERVER
|
||||||
|
#define ERPC_MODE_CLIENT
|
||||||
|
#define ERPC_TRANSPORTS
|
||||||
|
#define ERPC_TRANSPORTS_UART
|
||||||
|
/* end of Third Packages Drivers */
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user