Compare commits
19 Commits
mueller/ma
...
master
Author | SHA1 | Date | |
---|---|---|---|
34640746ae | |||
ff3a95efa6 | |||
eccf453415 | |||
cc138c6886 | |||
58d4ab2c50 | |||
497ff2442a | |||
d03949ee2d | |||
0067c264f8 | |||
4591994f1b | |||
5c1ee23432 | |||
12c5ee0625 | |||
6caf6ea36c | |||
6d20054f26 | |||
b9c1bbd48e | |||
117b9c220f | |||
cfa3e8e80c | |||
bf2bb96e94 | |||
ba13f6e022 | |||
9b986c1400 |
2
.gitignore
vendored
2
.gitignore
vendored
@ -24,7 +24,9 @@ venv
|
|||||||
|
|
||||||
# Build folders
|
# Build folders
|
||||||
/build*
|
/build*
|
||||||
|
/cmake-build*
|
||||||
|
|
||||||
|
# Makefile artifacts
|
||||||
_dep
|
_dep
|
||||||
_obj
|
_obj
|
||||||
_bin
|
_bin
|
||||||
|
@ -0,0 +1,7 @@
|
|||||||
|
<component name="ProjectRunConfigurationManager">
|
||||||
|
<configuration default="false" name="fsfw-example-stm32h7-freertos_always_display_size" type="CMakeRunConfiguration" factoryName="Application" REDIRECT_INPUT="false" ELEVATE="false" USE_EXTERNAL_CONSOLE="false" PASS_PARENT_ENVS_2="true" PROJECT_NAME="fsfw-example-stm32h7-freertos" TARGET_NAME="fsfw-example-stm32h7-freertos_always_display_size" CONFIG_NAME="Debug">
|
||||||
|
<method v="2">
|
||||||
|
<option name="com.jetbrains.cidr.execution.CidrBuildBeforeRunTaskProvider$BuildBeforeRunTask" enabled="true" />
|
||||||
|
</method>
|
||||||
|
</configuration>
|
||||||
|
</component>
|
243
CMakeLists.txt
243
CMakeLists.txt
@ -1,38 +1,48 @@
|
|||||||
################################################################################
|
# ##############################################################################
|
||||||
# CMake support for the Flight Software Framework
|
# CMake support for the Flight Software Framework Author: R. Mueller
|
||||||
# Author: R. Mueller
|
# ##############################################################################
|
||||||
################################################################################
|
|
||||||
|
|
||||||
################################################################################
|
# ##############################################################################
|
||||||
# Pre-Project preparation
|
# Pre-Project preparation
|
||||||
################################################################################
|
# ##############################################################################
|
||||||
cmake_minimum_required(VERSION 3.13)
|
cmake_minimum_required(VERSION 3.13)
|
||||||
|
|
||||||
# set(CMAKE_VERBOSE TRUE)
|
# set(CMAKE_VERBOSE TRUE)
|
||||||
|
|
||||||
set(CMAKE_SCRIPT_PATH "${CMAKE_CURRENT_SOURCE_DIR}/cmake")
|
set(CMAKE_SCRIPT_PATH "${CMAKE_CURRENT_SOURCE_DIR}/cmake")
|
||||||
set(STM32_CMAKE_PATH "${CMAKE_SCRIPT_PATH}/stm32-cmake")
|
set(CMAKE_COMMON_SCRIPT_PATH "${CMAKE_CURRENT_SOURCE_DIR}/example_common/cmake")
|
||||||
|
|
||||||
|
list(APPEND CMAKE_MODULE_PATH ${CMAKE_SCRIPT_PATH})
|
||||||
|
list(APPEND CMAKE_MODULE_PATH ${CMAKE_COMMON_SCRIPT_PATH})
|
||||||
|
|
||||||
|
message(STATUS ${CMAKE_MODULE_PATH})
|
||||||
|
|
||||||
|
set(STM32_CMAKE_PATH "${CMAKE_SCRIPT_PATH}/stm32-cmake")
|
||||||
set(STM32_CUBE_H7_PATH STM32CubeH7)
|
set(STM32_CUBE_H7_PATH STM32CubeH7)
|
||||||
set(STM32_TOOLCHAIN_PATH $ENV{STM32_TOOLCHAIN_PATH})
|
set(STM32_TOOLCHAIN_PATH $ENV{STM32_TOOLCHAIN_PATH})
|
||||||
set(TARGET_TRIPLET "arm-none-eabi")
|
set(TARGET_TRIPLET "arm-none-eabi")
|
||||||
set(FSFW_OSAL freertos CACHE STRING "OS for the FSFW")
|
|
||||||
set(STM32_ADD_NETWORKING_CODE ON)
|
|
||||||
set(FSFW_HAL_ADD_STM32H7 ON)
|
|
||||||
|
|
||||||
# This call has to come before the project call
|
# This call has to come before the project call
|
||||||
set(CMAKE_TOOLCHAIN_FILE ${STM32_CMAKE_PATH}/cmake/stm32_gcc.cmake)
|
set(CMAKE_TOOLCHAIN_FILE ${STM32_CMAKE_PATH}/cmake/stm32_gcc.cmake)
|
||||||
# Project Name
|
# Project Name
|
||||||
project(fsfw-example-stm32h7-freertos ASM C CXX)
|
project(fsfw-example-stm32h7-freertos ASM C CXX)
|
||||||
|
|
||||||
################################################################################
|
set(FSFW_OSAL
|
||||||
|
freertos
|
||||||
|
CACHE STRING "OS for the FSFW")
|
||||||
|
set(STM32_ADD_NETWORKING_CODE ON)
|
||||||
|
set(FSFW_HAL_ADD_STM32H7 ON)
|
||||||
|
|
||||||
|
set(OBSW_MAX_SCHEDULED_TCS 200)
|
||||||
|
|
||||||
|
# ##############################################################################
|
||||||
# Pre-Sources preparation
|
# Pre-Sources preparation
|
||||||
################################################################################
|
# ##############################################################################
|
||||||
|
|
||||||
# Specify the C++ standard
|
# Specify the C++ standard
|
||||||
set(CMAKE_CXX_STANDARD 11)
|
set(CMAKE_CXX_STANDARD 17)
|
||||||
set(CMAKE_CXX_STANDARD_REQUIRED True)
|
set(CMAKE_CXX_STANDARD_REQUIRED True)
|
||||||
|
|
||||||
|
|
||||||
set(FSFW_OSAL "freertos")
|
set(FSFW_OSAL "freertos")
|
||||||
set(TGT_BSP "arm/stm32h743zi-nucleo")
|
set(TGT_BSP "arm/stm32h743zi-nucleo")
|
||||||
set(FREERTOS_NAMESPACE FreeRTOS::STM32::H7::M7)
|
set(FREERTOS_NAMESPACE FreeRTOS::STM32::H7::M7)
|
||||||
@ -52,29 +62,41 @@ set(BSP_NUCLEO_PATH "${BSP_PATH}/NUCLEO-H743ZI")
|
|||||||
set(BSP_NUCLEO_INC_PATH "${BSP_NUCLEO_PATH}/Inc")
|
set(BSP_NUCLEO_INC_PATH "${BSP_NUCLEO_PATH}/Inc")
|
||||||
|
|
||||||
# See stm32-cmake documentation for more information
|
# See stm32-cmake documentation for more information
|
||||||
find_package(CMSIS COMPONENTS STM32H743ZI STM32H7_M7 RTOS REQUIRED)
|
find_package(
|
||||||
find_package(FreeRTOS COMPONENTS STM32H7 ARM_CM7 REQUIRED)
|
CMSIS
|
||||||
find_package(HAL COMPONENTS STM32H7M7 STM32H743ZI RCC GPIO UART TIM CORTEX ETH SPI DMA REQUIRED)
|
COMPONENTS STM32H743ZI STM32H7_M7 RTOS
|
||||||
|
REQUIRED)
|
||||||
|
find_package(
|
||||||
|
FreeRTOS
|
||||||
|
COMPONENTS STM32H7 ARM_CM7
|
||||||
|
REQUIRED)
|
||||||
|
find_package(
|
||||||
|
HAL
|
||||||
|
COMPONENTS STM32H7M7
|
||||||
|
STM32H743ZI
|
||||||
|
RCC
|
||||||
|
GPIO
|
||||||
|
UART
|
||||||
|
TIM
|
||||||
|
CORTEX
|
||||||
|
ETH
|
||||||
|
SPI
|
||||||
|
DMA
|
||||||
|
REQUIRED)
|
||||||
find_package(LwIP REQUIRED)
|
find_package(LwIP REQUIRED)
|
||||||
|
|
||||||
# These need to be set for the FSFW so the sources are compiled with the ABI flags
|
# These need to be set for the FSFW so the sources are compiled with the ABI
|
||||||
# and to compile FreeRTOS first
|
# flags and to compile FreeRTOS first
|
||||||
set(LIB_OS_NAME ${FREERTOS_NAMESPACE}::ARM_CM7)
|
set(LIB_OS_NAME ${FREERTOS_NAMESPACE}::ARM_CM7)
|
||||||
# This target is used because a custom linker script is used
|
# This target is used because a custom linker script is used
|
||||||
set(CMSIS_LINK_TARGET CMSIS::STM32::H743xx::M7)
|
set(CMSIS_LINK_TARGET CMSIS::STM32::H743xx::M7)
|
||||||
set(FSFW_ADDITIONAL_LINK_LIBS ${CMSIS_LINK_TARGET})
|
set(FSFW_ADDITIONAL_LINK_LIBS ${CMSIS_LINK_TARGET})
|
||||||
set(FSFW_HAL_LINK_LIBS
|
set(FSFW_HAL_LINK_LIBS HAL::STM32::H7::M7::CORTEX ${CMSIS_LINK_TARGET}
|
||||||
HAL::STM32::H7::M7::CORTEX
|
${LIB_OS_NAME})
|
||||||
${CMSIS_LINK_TARGET}
|
|
||||||
${LIB_OS_NAME}
|
|
||||||
)
|
|
||||||
set(FSFW_HAL_ADDITIONAL_INC_PATHS ${BSP_NUCLEO_INC_PATH})
|
set(FSFW_HAL_ADDITIONAL_INC_PATHS ${BSP_NUCLEO_INC_PATH})
|
||||||
set(FSFW_ADDITIONAL_INC_PATHS
|
set(FSFW_ADDITIONAL_INC_PATHS
|
||||||
"${COMMON_CONFIG_PATH}"
|
"${COMMON_CONFIG_PATH}" "${CMAKE_CURRENT_BINARY_DIR}"
|
||||||
"${CMAKE_CURRENT_BINARY_DIR}"
|
CACHE STRING "FSFW configuration paths")
|
||||||
CACHE STRING
|
|
||||||
"FSFW configuration paths"
|
|
||||||
)
|
|
||||||
|
|
||||||
configure_file(${COMMON_CONFIG_PATH}/commonConfig.h.in commonConfig.h)
|
configure_file(${COMMON_CONFIG_PATH}/commonConfig.h.in commonConfig.h)
|
||||||
configure_file(${FSFW_CONFIG_PATH}/FSFWConfig.h.in FSFWConfig.h)
|
configure_file(${FSFW_CONFIG_PATH}/FSFWConfig.h.in FSFWConfig.h)
|
||||||
@ -82,25 +104,9 @@ configure_file(${FSFW_CONFIG_PATH}/OBSWConfig.h.in OBSWConfig.h)
|
|||||||
configure_file(${BSP_NUCLEO_PATH}/Inc/FreeRTOSConfig.h.in FreeRTOSConfig.h)
|
configure_file(${BSP_NUCLEO_PATH}/Inc/FreeRTOSConfig.h.in FreeRTOSConfig.h)
|
||||||
configure_file(${BSP_NUCLEO_PATH}/Inc/lwipopts.h.in lwipopts.h)
|
configure_file(${BSP_NUCLEO_PATH}/Inc/lwipopts.h.in lwipopts.h)
|
||||||
|
|
||||||
if(CMAKE_CXX_COMPILER_ID STREQUAL "GNU")
|
# ##############################################################################
|
||||||
set(WARNING_FLAGS
|
|
||||||
-Wall
|
|
||||||
-Wextra
|
|
||||||
-Wimplicit-fallthrough=1
|
|
||||||
-Wno-unused-parameter
|
|
||||||
-Wno-psabi
|
|
||||||
)
|
|
||||||
|
|
||||||
set(FSFW_WARNING_FLAGS ${WARNING_FLAGS})
|
|
||||||
elseif(CMAKE_CXX_COMPILER_ID STREQUAL "MSVC")
|
|
||||||
add_compile_options(/permissive- /d2SSAOptimizer-)
|
|
||||||
# To avoid nameclashes with min and max macro
|
|
||||||
add_compile_definitions(NOMINMAX)
|
|
||||||
endif()
|
|
||||||
|
|
||||||
################################################################################
|
|
||||||
# Executable and Sources
|
# Executable and Sources
|
||||||
################################################################################
|
# ##############################################################################
|
||||||
|
|
||||||
# Add executable
|
# Add executable
|
||||||
add_executable(${TARGET_NAME})
|
add_executable(${TARGET_NAME})
|
||||||
@ -108,94 +114,91 @@ add_executable(${TARGET_NAME})
|
|||||||
# Add subdirectories
|
# Add subdirectories
|
||||||
add_subdirectory(${BSP_PATH})
|
add_subdirectory(${BSP_PATH})
|
||||||
add_subdirectory(${FSFW_PATH})
|
add_subdirectory(${FSFW_PATH})
|
||||||
# add_subdirectory(${LIB_FSFW_HAL_PATH})
|
|
||||||
add_subdirectory(${COMMON_PATH})
|
add_subdirectory(${COMMON_PATH})
|
||||||
|
|
||||||
################################################################################
|
# ##############################################################################
|
||||||
# Post-Sources preparation
|
# Post-Sources preparation
|
||||||
################################################################################
|
# ##############################################################################
|
||||||
|
|
||||||
|
# Check whether the user has already installed ETL first
|
||||||
|
# find_package(etl ${FSFW_ETL_LIB_MAJOR_VERSION} CONFIG QUIET)
|
||||||
|
# Not installed, so use FetchContent to download and provide etl
|
||||||
|
# if(NOT etl_FOUND)
|
||||||
|
# There are issues using find_package. For now, always use FetchContent
|
||||||
|
# See this github issue: https://github.com/ETLCPP/etl/issues/548
|
||||||
|
message(
|
||||||
|
STATUS
|
||||||
|
"No ETL installation was found with find_package. Installing and providing "
|
||||||
|
"etl with FindPackage")
|
||||||
|
include(FetchContent)
|
||||||
|
|
||||||
|
FetchContent_Declare(
|
||||||
|
etl
|
||||||
|
GIT_REPOSITORY https://github.com/ETLCPP/etl
|
||||||
|
GIT_TAG ${FSFW_ETL_LIB_VERSION})
|
||||||
|
|
||||||
|
list(APPEND FSFW_FETCH_CONTENT_TARGETS etl)
|
||||||
|
# endif()
|
||||||
|
|
||||||
|
# The documentation for FetchContent recommends declaring all the dependencies
|
||||||
|
# before making them available. We make all declared dependency available here
|
||||||
|
# after their declaration
|
||||||
|
if(FSFW_FETCH_CONTENT_TARGETS)
|
||||||
|
FetchContent_MakeAvailable(${FSFW_FETCH_CONTENT_TARGETS})
|
||||||
|
endif()
|
||||||
|
|
||||||
# Add libraries for all sources.
|
# Add libraries for all sources.
|
||||||
target_link_libraries(${TARGET_NAME} PRIVATE
|
target_link_libraries(
|
||||||
${LIB_FSFW_NAME}
|
${TARGET_NAME}
|
||||||
# ${LIB_FSFW_HAL_NAME}
|
PRIVATE ${LIB_FSFW_NAME}
|
||||||
${FREERTOS_NAMESPACE}::Heap::4
|
etl::etl
|
||||||
${FREERTOS_NAMESPACE}::ARM_CM7
|
${FREERTOS_NAMESPACE}::Heap::4
|
||||||
HAL::STM32::H7::M7::RCC
|
${FREERTOS_NAMESPACE}::ARM_CM7
|
||||||
HAL::STM32::H7::M7::RCCEx
|
HAL::STM32::H7::M7::RCC
|
||||||
HAL::STM32::H7::M7::GPIO
|
HAL::STM32::H7::M7::RCCEx
|
||||||
HAL::STM32::H7::M7::UART
|
HAL::STM32::H7::M7::GPIO
|
||||||
HAL::STM32::H7::M7::CORTEX
|
HAL::STM32::H7::M7::UART
|
||||||
HAL::STM32::H7::M7::TIM
|
HAL::STM32::H7::M7::CORTEX
|
||||||
HAL::STM32::H7::M7::TIMEx
|
HAL::STM32::H7::M7::TIM
|
||||||
HAL::STM32::H7::M7::ETH
|
HAL::STM32::H7::M7::TIMEx
|
||||||
HAL::STM32::H7::M7::SPI
|
HAL::STM32::H7::M7::ETH
|
||||||
HAL::STM32::H7::M7::DMA
|
HAL::STM32::H7::M7::SPI
|
||||||
${CMSIS_LINK_TARGET}
|
HAL::STM32::H7::M7::DMA
|
||||||
CMSIS::STM32::H7::M7::RTOS
|
${CMSIS_LINK_TARGET}
|
||||||
STM32::NoSys
|
CMSIS::STM32::H7::M7::RTOS
|
||||||
STM32::Nano
|
STM32::NoSys
|
||||||
STM32::Nano::FloatPrint
|
STM32::Nano
|
||||||
STM32::Nano::FloatScan
|
STM32::Nano::FloatPrint
|
||||||
LwIP
|
STM32::Nano::FloatScan
|
||||||
LwIP::IPv4
|
LwIP
|
||||||
LwIP::NETIF
|
LwIP::IPv4
|
||||||
)
|
LwIP::NETIF)
|
||||||
|
|
||||||
|
include(common)
|
||||||
|
get_common_build_flags(${TARGET_NAME})
|
||||||
|
|
||||||
# Add include paths for all sources.
|
# Add include paths for all sources.
|
||||||
target_include_directories(${TARGET_NAME} PRIVATE
|
target_include_directories(
|
||||||
${CMAKE_CURRENT_SOURCE_DIR}
|
${TARGET_NAME} PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}
|
||||||
${CMAKE_CURRENT_BINARY_DIR}
|
${CMAKE_CURRENT_BINARY_DIR} ${FSFW_CONFIG_PATH})
|
||||||
${FSFW_CONFIG_PATH}
|
|
||||||
)
|
|
||||||
|
|
||||||
|
target_compile_options(${TARGET_NAME} PRIVATE ${COMMON_COMPILE_OPTS} ${COMMON_WARNING_FLAGS})
|
||||||
if(CMAKE_CXX_COMPILER_ID STREQUAL "GNU")
|
target_link_options(${TARGET_NAME} PRIVATE ${COMMON_LINK_OPTS})
|
||||||
target_link_options(${TARGET_NAME} PRIVATE
|
|
||||||
"-Wl,-Map=${TARGET_NAME}.map"
|
|
||||||
)
|
|
||||||
|
|
||||||
# Remove unused sections.
|
|
||||||
target_compile_options(${TARGET_NAME} PRIVATE
|
|
||||||
"-ffunction-sections"
|
|
||||||
"-fdata-sections"
|
|
||||||
)
|
|
||||||
|
|
||||||
# Removed unused sections.
|
|
||||||
if(NOT FSFW_OSAL MATCHES rtems)
|
|
||||||
target_link_options(${TARGET_NAME} PRIVATE
|
|
||||||
"-Wl,--gc-sections"
|
|
||||||
)
|
|
||||||
endif()
|
|
||||||
elseif(CMAKE_CXX_COMPILER_ID STREQUAL "MSVC")
|
|
||||||
endif()
|
|
||||||
|
|
||||||
if(CMAKE_VERBOSE)
|
|
||||||
message(STATUS "Warning flags: ${WARNING_FLAGS}")
|
|
||||||
endif()
|
|
||||||
|
|
||||||
|
|
||||||
# Compile options for all sources.
|
|
||||||
target_compile_options(${TARGET_NAME} PRIVATE
|
|
||||||
${WARNING_FLAGS}
|
|
||||||
)
|
|
||||||
|
|
||||||
if(TGT_BSP)
|
if(TGT_BSP)
|
||||||
set(TARGET_STRING "Target BSP: ${TGT_BSP}")
|
set(TARGET_STRING "Target BSP: ${TGT_BSP}")
|
||||||
else()
|
else()
|
||||||
set(TARGET_STRING "Target BSP: Hosted")
|
set(TARGET_STRING "Target BSP: Hosted")
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
string(CONCAT POST_BUILD_COMMENT
|
string(CONCAT POST_BUILD_COMMENT "Build directory: ${CMAKE_BINARY_DIR}\n"
|
||||||
"Build directory: ${CMAKE_BINARY_DIR}\n"
|
"Target OSAL: ${FSFW_OSAL}\n"
|
||||||
"Target OSAL: ${FSFW_OSAL}\n"
|
"Target Build Type: ${CMAKE_BUILD_TYPE}\n" "${TARGET_STRING}")
|
||||||
"Target Build Type: ${CMAKE_BUILD_TYPE}\n"
|
|
||||||
"${TARGET_STRING}"
|
|
||||||
)
|
|
||||||
|
|
||||||
stm32_add_linker_script(${TARGET_NAME} "PRIVATE" "${BSP_NUCLEO_PATH}/STM32H743ZITx_FLASH.ld")
|
stm32_add_linker_script(${TARGET_NAME} "PRIVATE"
|
||||||
|
"${BSP_NUCLEO_PATH}/STM32H743ZITx_FLASH.ld")
|
||||||
|
|
||||||
include (${CMAKE_SCRIPT_PATH}/BuildType.cmake)
|
include(BuildType)
|
||||||
set_build_type()
|
set_build_type()
|
||||||
|
|
||||||
stm32_print_size_of_target(${TARGET_NAME})
|
stm32_print_size_of_target(${TARGET_NAME})
|
||||||
|
213
README.md
213
README.md
@ -1,4 +1,4 @@
|
|||||||
<img align="center" src="https://egit.irs.uni-stuttgart.de/fsfw/fsfw/raw/branch/mueller/master/misc/logo/FSFW_Logo_V3_bw.png" width="50%">
|
<img align="center" src="https://egit.irs.uni-stuttgart.de/fsfw/fsfw/raw/branch/development/misc/logo/FSFW_Logo_V3_bw.png" width="50%">
|
||||||
|
|
||||||
# <a id="top"></a> <a name="linux"></a> FSFW Example Application
|
# <a id="top"></a> <a name="linux"></a> FSFW Example Application
|
||||||
|
|
||||||
@ -48,23 +48,28 @@ This demo can be run on a STM32H743ZI-Nucleo board with the FreeRTOS OSAL.
|
|||||||
|
|
||||||
## General Information
|
## General Information
|
||||||
|
|
||||||
The board is flashed and debugged with OpenOCD and this README specifies on how
|
The board is flashed and debugged with [OpenOCD](https://openocd.org/) and this README specifies on
|
||||||
to make this work with the Eclipse IDE. Other IDEs or the command line can be used as well as long
|
how to make this work with the Eclipse IDE. Other IDEs or the command line can be used as well as
|
||||||
as long as OpenOCD integration is given. The example demo uses newlib nano (glibc).
|
long as long as OpenOCD integration is given. The example demo uses newlib nano (glibc).
|
||||||
Some system calls were overriden so the C and C++ stdio functions work. IO is sent via the HUART3,
|
Some system calls were overriden so the C and C++ `stdio` functions work. IO is sent via the HUART3,
|
||||||
so debug output can be read directly from the USB connection to the board.
|
so debug output can be read directly from the USB connection to the board.
|
||||||
|
|
||||||
## Prerequisite
|
## Prerequisites
|
||||||
|
|
||||||
1. [MinGW64](https://www.msys2.org/) or [Ninja Build](https://ninja-build.org/) installed on Windows.
|
If you have not set up the prerequisites yet, go to the [prerequisites chapter](#prereq) for
|
||||||
Not required on Linux.
|
detailed instructions on how to install these.
|
||||||
2. [GNU ARM Toolchain](https://xpack.github.io/arm-none-eabi-gcc/install/) installed, recommended
|
|
||||||
to add binaries to system path.
|
Here is a brief overview of the required tools to develop software for the STM32H7 microcontroller:
|
||||||
3. Recommended for application code development:
|
|
||||||
|
1. CMake build system generator installed
|
||||||
|
2. Build system like [Ninja Build](https://ninja-build.org/) or [Make](https://www.msys2.org/)
|
||||||
|
installed.
|
||||||
|
3. Bare-Metal ARM toolchain installed
|
||||||
|
4. Recommended for application code development:
|
||||||
[Eclipse for C/C++](https://www.eclipse.org/downloads/packages/) installed with the Eclipse MCU
|
[Eclipse for C/C++](https://www.eclipse.org/downloads/packages/) installed with the Eclipse MCU
|
||||||
plugin
|
plugin
|
||||||
4. [OpenOCD](https://xpack.github.io/openocd/) installed for Eclipse debugging
|
5. [OpenOCD](https://xpack.github.io/openocd/) installed for Eclipse debugging
|
||||||
5. STM32 USB drivers installed, separate steps for
|
6. STM32 USB drivers installed, separate steps for
|
||||||
[Windows](https://www.st.com/en/development-tools/stsw-link009.html) or
|
[Windows](https://www.st.com/en/development-tools/stsw-link009.html) or
|
||||||
[Linux](https://fishpepper.de/2016/09/16/installing-using-st-link-v2-to-flash-stm32-on-linux/)
|
[Linux](https://fishpepper.de/2016/09/16/installing-using-st-link-v2-to-flash-stm32-on-linux/)
|
||||||
|
|
||||||
@ -75,7 +80,7 @@ after installing MSYS2 or inside another Unix shell like `git bash`.
|
|||||||
|
|
||||||
1. Clone this repository
|
1. Clone this repository
|
||||||
```sh
|
```sh
|
||||||
git clone https://egit.irs.uni-stuttgart.de/fsfw/fsfw_example.git
|
git clone https://egit.irs.uni-stuttgart.de/fsfw/fsfw-example-stm32h7-freertos
|
||||||
```
|
```
|
||||||
|
|
||||||
2. Set up submodules
|
2. Set up submodules
|
||||||
@ -88,8 +93,8 @@ after installing MSYS2 or inside another Unix shell like `git bash`.
|
|||||||
Debug build folder.
|
Debug build folder.
|
||||||
|
|
||||||
```sh
|
```sh
|
||||||
mkdir build-Debug
|
mkdir cmake-build-debug
|
||||||
cd build-Debug
|
cd cmake-build-debug
|
||||||
```
|
```
|
||||||
|
|
||||||
4. Ensure that the ARM compiler has been added to the path and can be called from
|
4. Ensure that the ARM compiler has been added to the path and can be called from
|
||||||
@ -131,79 +136,145 @@ after installing MSYS2 or inside another Unix shell like `git bash`.
|
|||||||
The debug output is also sent via the connected USB port and a blink pattern (1 second interval)
|
The debug output is also sent via the connected USB port and a blink pattern (1 second interval)
|
||||||
can be used to verify the software is running properly.
|
can be used to verify the software is running properly.
|
||||||
|
|
||||||
## Setting up the prerequisites
|
## <a id="prereq"></a> Setting up Prerequisites
|
||||||
|
|
||||||
### Windows
|
### CMake
|
||||||
|
|
||||||
It is recommended to install [MSYS2](https://www.msys2.org/) first.
|
**Linux**
|
||||||
Open MinGW64 and run the following commands to update it and install make and cmake
|
|
||||||
(replace x86_64 if compiling on different architecture):
|
|
||||||
|
|
||||||
```sh
|
```sh
|
||||||
pacman -Syu
|
sudo apt-get install cmake
|
||||||
```
|
```
|
||||||
|
|
||||||
```sh
|
**Windows**
|
||||||
pacman -S mingw-w64-x86_64-make mingw-w64-x86_64-cmake
|
|
||||||
```
|
|
||||||
|
|
||||||
Alternatively, you can install [Ninja Build](https://ninja-build.org/), but you need
|
On Windows, you can use `pacman -S mingw-w64-x86_64-cmake`, but you can also install the Windows
|
||||||
to add the folder containing the `ninja.exe` executable to the system path so you
|
CMake via the [installer](https://cmake.org/download/). It is recommended to pick the install
|
||||||
can run `ninja -v` from the command line. If you do this, you can also use
|
option `Add CMake to system PATH for all users` to CMake can be used from the command line.
|
||||||
`git bash` or the Windows command lines with the CMake Ninja generator
|
Please note that you need to add the Windows CMake path to the MinGW64 path manually
|
||||||
to build the software.
|
if you want to use it in CMake.
|
||||||
|
|
||||||
The code needs to be cross-compiled for the ARM target system and we will use the
|
### Cross-Compiler
|
||||||
[GNU ARM Toolchain](https://xpack.github.io/arm-none-eabi-gcc/install/).
|
|
||||||
|
|
||||||
1. Install NodeJS LTS. Add nodejs folder (e.g. "C:\Program Files\nodejs\")
|
The instuctions here specify how to install and use a specific version of the
|
||||||
to system variables. Test by running `npm --version` in command line
|
[xPacks cross-compiler](https://xpack.github.io/arm-none-eabi-gcc/) but you can use any other
|
||||||
2. Install [XPM](https://www.npmjs.com/package/xpm)
|
ARM cross-compiler which can generate bare-metal code, usually denoted by the `arm-none-eabi`
|
||||||
```sh
|
cross-compiler triplet.
|
||||||
npm install --global xpm
|
|
||||||
```
|
|
||||||
|
|
||||||
3. Install gnu-arm Toolchain for Eclipse (version can be specified)
|
|
||||||
```sh
|
|
||||||
xpm install --global @xpack-dev-tools/arm-none-eabi-gcc@latest
|
|
||||||
```
|
|
||||||
|
|
||||||
`xpm` will display where the package was installed. Search in that path for
|
|
||||||
the hidden `.content` folder, which will contain a `bin` folder and store
|
|
||||||
the full path to that `bin` folder for later.
|
|
||||||
|
|
||||||
Install OpenOCD for STM32 debugging
|
|
||||||
```sh
|
|
||||||
xpm install --global @xpack-dev-tools/openocd@latest
|
|
||||||
```
|
|
||||||
|
|
||||||
4. If you want to build from the command line, you need to add the `arm-none-eabi-gcc`
|
|
||||||
binary location in the xPack folder to system variables. You can do this in a Unix
|
|
||||||
shell like `git bash` or `MinGW64` with the following command
|
|
||||||
|
|
||||||
```sh
|
|
||||||
export PATH=$PATH:"<pathToToolchain>"
|
|
||||||
```
|
|
||||||
|
|
||||||
You can also add these lines to a shell script like `path_setter.sh` and then source
|
|
||||||
the script with `. path_setter.sh` to do this conveniently. You can test whether
|
|
||||||
the path was set up properly by running `arm-none-eabi-gcc -v`
|
|
||||||
|
|
||||||
5. Install the [STM32 USB drivers](https://www.st.com/en/development-tools/stsw-link009.html)
|
|
||||||
|
|
||||||
If you don't want to install nodejs you may go with the
|
If you don't want to install nodejs you may go with the
|
||||||
[four-command manual installation](https://xpack.github.io/arm-none-eabi-gcc/install/#manual-install).
|
[four-command manual installation](https://xpack.github.io/arm-none-eabi-gcc/install/#manual-install).
|
||||||
|
|
||||||
### Linux
|
**Windows**
|
||||||
|
|
||||||
Install the [GNU ARM toolchain](https://xpack.github.io/arm-none-eabi-gcc/install/)
|
On Windows, it is recommended to perform the `xpm` and toolchain installation from the Windows
|
||||||
like explained above.
|
command line.The simple way required npm, which can be installed by installing
|
||||||
|
[NodeJS](https://nodejs.org/en/). Make sure `npm` can be run from the command line by adding
|
||||||
|
the folder containing `npm.exe` to the system path and running the following command
|
||||||
|
|
||||||
To install general buildtools for the linux binary, run:
|
|
||||||
```sh
|
```sh
|
||||||
sudo apt-get install build-essential
|
npm install --global xpm@latest
|
||||||
|
xpm install --global @xpack-dev-tools/arm-none-eabi-gcc@11.2.1-1.1.1 --verbose
|
||||||
```
|
```
|
||||||
|
|
||||||
|
On Windows, the toolchain binaries will be located in a folder like this
|
||||||
|
|
||||||
|
```sh
|
||||||
|
C:\Users\<User>\AppData\Roaming\xPacks\@xpack-dev-tools\arm-none-eabi-gcc\<version>\.content\bin
|
||||||
|
```
|
||||||
|
|
||||||
|
You can now run the following commands in the repository root:
|
||||||
|
|
||||||
|
```sh
|
||||||
|
xpm init
|
||||||
|
xpm install @xpack-dev-tools/arm-none-eabi-gcc@11.2.1-1.1.1
|
||||||
|
```
|
||||||
|
|
||||||
|
to create symlinks to the toolchain in `./xpacks/.bin`.
|
||||||
|
You can now set up the environment by using `. load_path.sh` or the following command
|
||||||
|
|
||||||
|
```sh
|
||||||
|
export PATH="$(pwd)/xpacks/.bin":$PATH
|
||||||
|
```
|
||||||
|
|
||||||
|
On Windows, you can use git bash to perform the step above.
|
||||||
|
|
||||||
|
Alternatively, you can use the graphical system environmental variables editor to add the
|
||||||
|
`.bin` path to the system variables permanently or use the appriate command for `CMD` or
|
||||||
|
PowerShell to update the `PATH` variable.
|
||||||
|
|
||||||
|
**Linux**
|
||||||
|
|
||||||
|
Install `npm` and `nodejs` first. Example for Ubuntu according to
|
||||||
|
[this guide](https://linuxize.com/post/how-to-install-node-js-on-ubuntu-20-04/).
|
||||||
|
|
||||||
|
```sh
|
||||||
|
curl -sL https://deb.nodesource.com/setup_14.x | sudo -E bash -
|
||||||
|
sudo apt-get update && sudo apt-get install nodejs
|
||||||
|
```
|
||||||
|
|
||||||
|
Check that `npm` is installed with `npm --version`.
|
||||||
|
Then `xpm` and the cross-compiler are installed.
|
||||||
|
|
||||||
|
```sh
|
||||||
|
sudo npm install --global xpm@latest
|
||||||
|
xpm install --global @xpack-dev-tools/arm-none-eabi-gcc@11.2.1-1.1.1 --verbose
|
||||||
|
```
|
||||||
|
|
||||||
|
You can now run the following commands in the repository root:
|
||||||
|
|
||||||
|
```sh
|
||||||
|
xpm init
|
||||||
|
xpm install @xpack-dev-tools/arm-none-eabi-gcc@11.2.1-1.1.1
|
||||||
|
```
|
||||||
|
|
||||||
|
to create symlinks to the toolchain in `./xpacks/.bin`.
|
||||||
|
You can now set up the environment by using `. load_path.sh` or the following command
|
||||||
|
|
||||||
|
```sh
|
||||||
|
export PATH="$(pwd)/xpacks/.bin":$PATH
|
||||||
|
```
|
||||||
|
|
||||||
|
### Build System
|
||||||
|
|
||||||
|
It is recommended to use `ninja` or `make` as the software build system.
|
||||||
|
|
||||||
|
**Windows**
|
||||||
|
|
||||||
|
It is recommended to use the [Ninja build system](https://ninja-build.org/). Download the ninja
|
||||||
|
executable and place it somewhere.
|
||||||
|
You need to add the folder containing the ninja executable to the system environmental variables
|
||||||
|
so it can be used in the build process. You can test whether `ninja` works by running
|
||||||
|
`ninja --version` in the command line.
|
||||||
|
|
||||||
|
Alternatively or additionally, you can also install `mingw32-make`
|
||||||
|
which comes bundled with [MinGW64](https://www.msys2.org/). Make sure to add the binaries path to
|
||||||
|
the Windows path during installation. Otherwise, you need to add `msys64/mingw64/bin` to the
|
||||||
|
Windows path so you can run installed binaries from the command line.
|
||||||
|
Open the `MinGW64` shell and run the following commands.
|
||||||
|
|
||||||
|
```sh
|
||||||
|
pacman -S mingw-w64-x86_64-toolchain mingw-w64-x86_64-make mingw-w64-x86_64-cmake
|
||||||
|
```
|
||||||
|
|
||||||
|
You can test successfull installation with `mingw32-make -v` from the Windows Command Line.
|
||||||
|
|
||||||
|
**Linux**
|
||||||
|
|
||||||
|
On Linux, `make` is pre-installed and it is recommended to use it directly.
|
||||||
|
You can install `ninja` with
|
||||||
|
|
||||||
|
```sh
|
||||||
|
sudo apt-get install ninja-build
|
||||||
|
```
|
||||||
|
|
||||||
|
### USB Drivers
|
||||||
|
|
||||||
|
**Windows**
|
||||||
|
|
||||||
|
Install the [STM32 USB drivers](https://www.st.com/en/development-tools/stsw-link009.html).
|
||||||
|
|
||||||
|
**Linux**
|
||||||
|
|
||||||
Install the [USB drivers](https://github.com/stlink-org/stlink) on Linux.
|
Install the [USB drivers](https://github.com/stlink-org/stlink) on Linux.
|
||||||
On Ubuntu, you can run the following command to install it:
|
On Ubuntu, you can run the following command to install it:
|
||||||
|
|
||||||
|
@ -1 +1 @@
|
|||||||
Subproject commit 5975bffae9358bc2b2890a35a203d940a395efef
|
Subproject commit b340b13929e36a3427b8d94e8b1006022f82273f
|
@ -1,16 +1,11 @@
|
|||||||
target_sources(${TARGET_NAME} PRIVATE
|
target_sources(${TARGET_NAME} PRIVATE main.cpp)
|
||||||
main.cpp
|
|
||||||
)
|
|
||||||
|
|
||||||
target_compile_options(${TARGET_NAME} PRIVATE
|
target_compile_options(${TARGET_NAME} PRIVATE)
|
||||||
)
|
|
||||||
|
|
||||||
target_link_options(${TARGET_NAME} PRIVATE
|
target_link_options(${TARGET_NAME} PRIVATE)
|
||||||
)
|
|
||||||
|
|
||||||
target_compile_definitions(${TARGET_NAME} PRIVATE
|
target_compile_definitions(${TARGET_NAME}
|
||||||
BOARD_NAME="stm32h743zi-nucleo"
|
PRIVATE BOARD_NAME="stm32h743zi-nucleo")
|
||||||
)
|
|
||||||
|
|
||||||
add_subdirectory(core)
|
add_subdirectory(core)
|
||||||
add_subdirectory(utility)
|
add_subdirectory(utility)
|
||||||
|
@ -1,5 +1,3 @@
|
|||||||
add_subdirectory(Src)
|
add_subdirectory(Src)
|
||||||
|
|
||||||
target_include_directories(${TARGET_NAME} PRIVATE
|
target_include_directories(${TARGET_NAME} PRIVATE Inc)
|
||||||
Inc
|
|
||||||
)
|
|
||||||
|
@ -8,12 +8,12 @@
|
|||||||
#include <lwip/netif.h>
|
#include <lwip/netif.h>
|
||||||
|
|
||||||
/* DHCP process states */
|
/* DHCP process states */
|
||||||
#define DHCP_OFF (uint8_t) 0
|
#define DHCP_OFF (uint8_t)0
|
||||||
#define DHCP_START (uint8_t) 1
|
#define DHCP_START (uint8_t)1
|
||||||
#define DHCP_WAIT_ADDRESS (uint8_t) 2
|
#define DHCP_WAIT_ADDRESS (uint8_t)2
|
||||||
#define DHCP_ADDRESS_ASSIGNED (uint8_t) 3
|
#define DHCP_ADDRESS_ASSIGNED (uint8_t)3
|
||||||
#define DHCP_TIMEOUT (uint8_t) 4
|
#define DHCP_TIMEOUT (uint8_t)4
|
||||||
#define DHCP_LINK_DOWN (uint8_t) 5
|
#define DHCP_LINK_DOWN (uint8_t)5
|
||||||
|
|
||||||
uint8_t get_dhcp_state();
|
uint8_t get_dhcp_state();
|
||||||
void set_dhcp_state(uint8_t new_state);
|
void set_dhcp_state(uint8_t new_state);
|
||||||
|
@ -1,54 +1,54 @@
|
|||||||
/**
|
/**
|
||||||
******************************************************************************
|
******************************************************************************
|
||||||
* @file LwIP/LwIP_UDP_Echo_Client/Inc/app_ethernet.h
|
* @file LwIP/LwIP_UDP_Echo_Client/Inc/app_ethernet.h
|
||||||
* @author MCD Application Team
|
* @author MCD Application Team
|
||||||
* @brief Header for app_ethernet.c module
|
* @brief Header for app_ethernet.c module
|
||||||
******************************************************************************
|
******************************************************************************
|
||||||
* @attention
|
* @attention
|
||||||
*
|
*
|
||||||
* <h2><center>© Copyright (c) 2017 STMicroelectronics International N.V.
|
* <h2><center>© Copyright (c) 2017 STMicroelectronics International N.V.
|
||||||
* All rights reserved.</center></h2>
|
* All rights reserved.</center></h2>
|
||||||
*
|
*
|
||||||
* Redistribution and use in source and binary forms, with or without
|
* Redistribution and use in source and binary forms, with or without
|
||||||
* modification, are permitted, provided that the following conditions are met:
|
* modification, are permitted, provided that the following conditions are met:
|
||||||
*
|
*
|
||||||
* 1. Redistribution of source code must retain the above copyright notice,
|
* 1. Redistribution of source code must retain the above copyright notice,
|
||||||
* this list of conditions and the following disclaimer.
|
* this list of conditions and the following disclaimer.
|
||||||
* 2. Redistributions in binary form must reproduce the above copyright notice,
|
* 2. Redistributions in binary form must reproduce the above copyright notice,
|
||||||
* this list of conditions and the following disclaimer in the documentation
|
* this list of conditions and the following disclaimer in the documentation
|
||||||
* and/or other materials provided with the distribution.
|
* and/or other materials provided with the distribution.
|
||||||
* 3. Neither the name of STMicroelectronics nor the names of other
|
* 3. Neither the name of STMicroelectronics nor the names of other
|
||||||
* contributors to this software may be used to endorse or promote products
|
* contributors to this software may be used to endorse or promote products
|
||||||
* derived from this software without specific written permission.
|
* derived from this software without specific written permission.
|
||||||
* 4. This software, including modifications and/or derivative works of this
|
* 4. This software, including modifications and/or derivative works of this
|
||||||
* software, must execute solely and exclusively on microcontroller or
|
* software, must execute solely and exclusively on microcontroller or
|
||||||
* microprocessor devices manufactured by or for STMicroelectronics.
|
* microprocessor devices manufactured by or for STMicroelectronics.
|
||||||
* 5. Redistribution and use of this software other than as permitted under
|
* 5. Redistribution and use of this software other than as permitted under
|
||||||
* this license is void and will automatically terminate your rights under
|
* this license is void and will automatically terminate your rights under
|
||||||
* this license.
|
* this license.
|
||||||
*
|
*
|
||||||
* THIS SOFTWARE IS PROVIDED BY STMICROELECTRONICS AND CONTRIBUTORS "AS IS"
|
* THIS SOFTWARE IS PROVIDED BY STMICROELECTRONICS AND CONTRIBUTORS "AS IS"
|
||||||
* AND ANY EXPRESS, IMPLIED OR STATUTORY WARRANTIES, INCLUDING, BUT NOT
|
* AND ANY EXPRESS, IMPLIED OR STATUTORY WARRANTIES, INCLUDING, BUT NOT
|
||||||
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS FOR A
|
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS FOR A
|
||||||
* PARTICULAR PURPOSE AND NON-INFRINGEMENT OF THIRD PARTY INTELLECTUAL PROPERTY
|
* PARTICULAR PURPOSE AND NON-INFRINGEMENT OF THIRD PARTY INTELLECTUAL PROPERTY
|
||||||
* RIGHTS ARE DISCLAIMED TO THE FULLEST EXTENT PERMITTED BY LAW. IN NO EVENT
|
* RIGHTS ARE DISCLAIMED TO THE FULLEST EXTENT PERMITTED BY LAW. IN NO EVENT
|
||||||
* SHALL STMICROELECTRONICS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
|
* SHALL STMICROELECTRONICS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
|
||||||
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
||||||
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA,
|
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA,
|
||||||
* OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
|
* OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
|
||||||
* LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
|
* LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
|
||||||
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
|
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
|
||||||
* EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
* EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
*
|
*
|
||||||
******************************************************************************
|
******************************************************************************
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/* Define to prevent recursive inclusion -------------------------------------*/
|
/* Define to prevent recursive inclusion -------------------------------------*/
|
||||||
#ifndef __APP_ETHERNET_H
|
#ifndef __APP_ETHERNET_H
|
||||||
#define __APP_ETHERNET_H
|
#define __APP_ETHERNET_H
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
extern "C" {
|
extern "C" {
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/* Includes ------------------------------------------------------------------*/
|
/* Includes ------------------------------------------------------------------*/
|
||||||
@ -58,13 +58,12 @@
|
|||||||
|
|
||||||
/* Exported constants --------------------------------------------------------*/
|
/* Exported constants --------------------------------------------------------*/
|
||||||
|
|
||||||
|
|
||||||
/* Exported macro ------------------------------------------------------------*/
|
/* Exported macro ------------------------------------------------------------*/
|
||||||
/* Exported functions ------------------------------------------------------- */
|
/* Exported functions ------------------------------------------------------- */
|
||||||
void ethernet_link_status_updated(struct netif *netif);
|
void ethernet_link_status_updated(struct netif *netif);
|
||||||
void ethernet_link_periodic_handle(struct netif *netif);
|
void ethernet_link_periodic_handle(struct netif *netif);
|
||||||
|
|
||||||
void set_lwip_addresses(ip_addr_t* ipaddr, ip_addr_t* netmask, ip_addr_t* gw);
|
void set_lwip_addresses(ip_addr_t *ipaddr, ip_addr_t *netmask, ip_addr_t *gw);
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
}
|
}
|
||||||
@ -72,6 +71,4 @@ void set_lwip_addresses(ip_addr_t* ipaddr, ip_addr_t* netmask, ip_addr_t* gw);
|
|||||||
|
|
||||||
#endif /* __APP_ETHERNET_H */
|
#endif /* __APP_ETHERNET_H */
|
||||||
|
|
||||||
|
|
||||||
/************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/
|
/************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/
|
||||||
|
|
||||||
|
@ -2,9 +2,7 @@
|
|||||||
#define BSP_STM32_BOARDS_NUCLEO_H743ZI_INC_BOARDCONFIG_H_
|
#define BSP_STM32_BOARDS_NUCLEO_H743ZI_INC_BOARDCONFIG_H_
|
||||||
|
|
||||||
//! Timeout when sending debug data via the UART interface in MS
|
//! Timeout when sending debug data via the UART interface in MS
|
||||||
#define DEBUG_UART_MS_TIMEOUT 10
|
#define DEBUG_UART_MS_TIMEOUT 10
|
||||||
#define DEBUG_UART_BAUDRATE 115200
|
#define DEBUG_UART_BAUDRATE 115200
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
#endif /* BSP_STM32_BOARDS_NUCLEO_H743ZI_INC_BOARDCONFIG_H_ */
|
#endif /* BSP_STM32_BOARDS_NUCLEO_H743ZI_INC_BOARDCONFIG_H_ */
|
||||||
|
@ -9,8 +9,8 @@
|
|||||||
extern "C" {
|
extern "C" {
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#include <stdint.h>
|
|
||||||
#include <stdbool.h>
|
#include <stdbool.h>
|
||||||
|
#include <stdint.h>
|
||||||
|
|
||||||
#include <stm32h7xx_hal.h>
|
#include <stm32h7xx_hal.h>
|
||||||
#include <stm32h7xx_hal_gpio.h>
|
#include <stm32h7xx_hal_gpio.h>
|
||||||
|
@ -1,411 +1,408 @@
|
|||||||
/**
|
/**
|
||||||
******************************************************************************
|
******************************************************************************
|
||||||
* @file lan8742.h
|
* @file lan8742.h
|
||||||
* @author MCD Application Team
|
* @author MCD Application Team
|
||||||
* @brief This file contains all the functions prototypes for the
|
* @brief This file contains all the functions prototypes for the
|
||||||
* lan8742.c PHY driver.
|
* lan8742.c PHY driver.
|
||||||
******************************************************************************
|
******************************************************************************
|
||||||
* @attention
|
* @attention
|
||||||
*
|
*
|
||||||
* <h2><center>© Copyright (c) 2017 STMicroelectronics.
|
* <h2><center>© Copyright (c) 2017 STMicroelectronics.
|
||||||
* All rights reserved.</center></h2>
|
* All rights reserved.</center></h2>
|
||||||
*
|
*
|
||||||
* This software component is licensed by ST under BSD 3-Clause license,
|
* This software component is licensed by ST under BSD 3-Clause license,
|
||||||
* the "License"; You may not use this file except in compliance with the
|
* the "License"; You may not use this file except in compliance with the
|
||||||
* License. You may obtain a copy of the License at:
|
* License. You may obtain a copy of the License at:
|
||||||
* opensource.org/licenses/BSD-3-Clause
|
* opensource.org/licenses/BSD-3-Clause
|
||||||
*
|
*
|
||||||
******************************************************************************
|
******************************************************************************
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/* Define to prevent recursive inclusion -------------------------------------*/
|
/* Define to prevent recursive inclusion -------------------------------------*/
|
||||||
#ifndef LAN8742_H
|
#ifndef LAN8742_H
|
||||||
#define LAN8742_H
|
#define LAN8742_H
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
extern "C" {
|
extern "C" {
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/* Includes ------------------------------------------------------------------*/
|
/* Includes ------------------------------------------------------------------*/
|
||||||
#include <stdint.h>
|
#include <stdint.h>
|
||||||
|
|
||||||
/** @addtogroup BSP
|
/** @addtogroup BSP
|
||||||
* @{
|
* @{
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/** @addtogroup Component
|
/** @addtogroup Component
|
||||||
* @{
|
* @{
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/** @defgroup LAN8742
|
/** @defgroup LAN8742
|
||||||
* @{
|
* @{
|
||||||
*/
|
*/
|
||||||
/* Exported constants --------------------------------------------------------*/
|
/* Exported constants --------------------------------------------------------*/
|
||||||
/** @defgroup LAN8742_Exported_Constants LAN8742 Exported Constants
|
/** @defgroup LAN8742_Exported_Constants LAN8742 Exported Constants
|
||||||
* @{
|
* @{
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/** @defgroup LAN8742_Registers_Mapping LAN8742 Registers Mapping
|
/** @defgroup LAN8742_Registers_Mapping LAN8742 Registers Mapping
|
||||||
* @{
|
* @{
|
||||||
*/
|
*/
|
||||||
#define LAN8742_BCR ((uint16_t)0x0000U)
|
#define LAN8742_BCR ((uint16_t)0x0000U)
|
||||||
#define LAN8742_BSR ((uint16_t)0x0001U)
|
#define LAN8742_BSR ((uint16_t)0x0001U)
|
||||||
#define LAN8742_PHYI1R ((uint16_t)0x0002U)
|
#define LAN8742_PHYI1R ((uint16_t)0x0002U)
|
||||||
#define LAN8742_PHYI2R ((uint16_t)0x0003U)
|
#define LAN8742_PHYI2R ((uint16_t)0x0003U)
|
||||||
#define LAN8742_ANAR ((uint16_t)0x0004U)
|
#define LAN8742_ANAR ((uint16_t)0x0004U)
|
||||||
#define LAN8742_ANLPAR ((uint16_t)0x0005U)
|
#define LAN8742_ANLPAR ((uint16_t)0x0005U)
|
||||||
#define LAN8742_ANER ((uint16_t)0x0006U)
|
#define LAN8742_ANER ((uint16_t)0x0006U)
|
||||||
#define LAN8742_ANNPTR ((uint16_t)0x0007U)
|
#define LAN8742_ANNPTR ((uint16_t)0x0007U)
|
||||||
#define LAN8742_ANNPRR ((uint16_t)0x0008U)
|
#define LAN8742_ANNPRR ((uint16_t)0x0008U)
|
||||||
#define LAN8742_MMDACR ((uint16_t)0x000DU)
|
#define LAN8742_MMDACR ((uint16_t)0x000DU)
|
||||||
#define LAN8742_MMDAADR ((uint16_t)0x000EU)
|
#define LAN8742_MMDAADR ((uint16_t)0x000EU)
|
||||||
#define LAN8742_ENCTR ((uint16_t)0x0010U)
|
#define LAN8742_ENCTR ((uint16_t)0x0010U)
|
||||||
#define LAN8742_MCSR ((uint16_t)0x0011U)
|
#define LAN8742_MCSR ((uint16_t)0x0011U)
|
||||||
#define LAN8742_SMR ((uint16_t)0x0012U)
|
#define LAN8742_SMR ((uint16_t)0x0012U)
|
||||||
#define LAN8742_TPDCR ((uint16_t)0x0018U)
|
#define LAN8742_TPDCR ((uint16_t)0x0018U)
|
||||||
#define LAN8742_TCSR ((uint16_t)0x0019U)
|
#define LAN8742_TCSR ((uint16_t)0x0019U)
|
||||||
#define LAN8742_SECR ((uint16_t)0x001AU)
|
#define LAN8742_SECR ((uint16_t)0x001AU)
|
||||||
#define LAN8742_SCSIR ((uint16_t)0x001BU)
|
#define LAN8742_SCSIR ((uint16_t)0x001BU)
|
||||||
#define LAN8742_CLR ((uint16_t)0x001CU)
|
#define LAN8742_CLR ((uint16_t)0x001CU)
|
||||||
#define LAN8742_ISFR ((uint16_t)0x001DU)
|
#define LAN8742_ISFR ((uint16_t)0x001DU)
|
||||||
#define LAN8742_IMR ((uint16_t)0x001EU)
|
#define LAN8742_IMR ((uint16_t)0x001EU)
|
||||||
#define LAN8742_PHYSCSR ((uint16_t)0x001FU)
|
#define LAN8742_PHYSCSR ((uint16_t)0x001FU)
|
||||||
/**
|
/**
|
||||||
* @}
|
* @}
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/** @defgroup LAN8742_BCR_Bit_Definition LAN8742 BCR Bit Definition
|
/** @defgroup LAN8742_BCR_Bit_Definition LAN8742 BCR Bit Definition
|
||||||
* @{
|
* @{
|
||||||
*/
|
*/
|
||||||
#define LAN8742_BCR_SOFT_RESET ((uint16_t)0x8000U)
|
#define LAN8742_BCR_SOFT_RESET ((uint16_t)0x8000U)
|
||||||
#define LAN8742_BCR_LOOPBACK ((uint16_t)0x4000U)
|
#define LAN8742_BCR_LOOPBACK ((uint16_t)0x4000U)
|
||||||
#define LAN8742_BCR_SPEED_SELECT ((uint16_t)0x2000U)
|
#define LAN8742_BCR_SPEED_SELECT ((uint16_t)0x2000U)
|
||||||
#define LAN8742_BCR_AUTONEGO_EN ((uint16_t)0x1000U)
|
#define LAN8742_BCR_AUTONEGO_EN ((uint16_t)0x1000U)
|
||||||
#define LAN8742_BCR_POWER_DOWN ((uint16_t)0x0800U)
|
#define LAN8742_BCR_POWER_DOWN ((uint16_t)0x0800U)
|
||||||
#define LAN8742_BCR_ISOLATE ((uint16_t)0x0400U)
|
#define LAN8742_BCR_ISOLATE ((uint16_t)0x0400U)
|
||||||
#define LAN8742_BCR_RESTART_AUTONEGO ((uint16_t)0x0200U)
|
#define LAN8742_BCR_RESTART_AUTONEGO ((uint16_t)0x0200U)
|
||||||
#define LAN8742_BCR_DUPLEX_MODE ((uint16_t)0x0100U)
|
#define LAN8742_BCR_DUPLEX_MODE ((uint16_t)0x0100U)
|
||||||
/**
|
/**
|
||||||
* @}
|
* @}
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/** @defgroup LAN8742_BSR_Bit_Definition LAN8742 BSR Bit Definition
|
/** @defgroup LAN8742_BSR_Bit_Definition LAN8742 BSR Bit Definition
|
||||||
* @{
|
* @{
|
||||||
*/
|
*/
|
||||||
#define LAN8742_BSR_100BASE_T4 ((uint16_t)0x8000U)
|
#define LAN8742_BSR_100BASE_T4 ((uint16_t)0x8000U)
|
||||||
#define LAN8742_BSR_100BASE_TX_FD ((uint16_t)0x4000U)
|
#define LAN8742_BSR_100BASE_TX_FD ((uint16_t)0x4000U)
|
||||||
#define LAN8742_BSR_100BASE_TX_HD ((uint16_t)0x2000U)
|
#define LAN8742_BSR_100BASE_TX_HD ((uint16_t)0x2000U)
|
||||||
#define LAN8742_BSR_10BASE_T_FD ((uint16_t)0x1000U)
|
#define LAN8742_BSR_10BASE_T_FD ((uint16_t)0x1000U)
|
||||||
#define LAN8742_BSR_10BASE_T_HD ((uint16_t)0x0800U)
|
#define LAN8742_BSR_10BASE_T_HD ((uint16_t)0x0800U)
|
||||||
#define LAN8742_BSR_100BASE_T2_FD ((uint16_t)0x0400U)
|
#define LAN8742_BSR_100BASE_T2_FD ((uint16_t)0x0400U)
|
||||||
#define LAN8742_BSR_100BASE_T2_HD ((uint16_t)0x0200U)
|
#define LAN8742_BSR_100BASE_T2_HD ((uint16_t)0x0200U)
|
||||||
#define LAN8742_BSR_EXTENDED_STATUS ((uint16_t)0x0100U)
|
#define LAN8742_BSR_EXTENDED_STATUS ((uint16_t)0x0100U)
|
||||||
#define LAN8742_BSR_AUTONEGO_CPLT ((uint16_t)0x0020U)
|
#define LAN8742_BSR_AUTONEGO_CPLT ((uint16_t)0x0020U)
|
||||||
#define LAN8742_BSR_REMOTE_FAULT ((uint16_t)0x0010U)
|
#define LAN8742_BSR_REMOTE_FAULT ((uint16_t)0x0010U)
|
||||||
#define LAN8742_BSR_AUTONEGO_ABILITY ((uint16_t)0x0008U)
|
#define LAN8742_BSR_AUTONEGO_ABILITY ((uint16_t)0x0008U)
|
||||||
#define LAN8742_BSR_LINK_STATUS ((uint16_t)0x0004U)
|
#define LAN8742_BSR_LINK_STATUS ((uint16_t)0x0004U)
|
||||||
#define LAN8742_BSR_JABBER_DETECT ((uint16_t)0x0002U)
|
#define LAN8742_BSR_JABBER_DETECT ((uint16_t)0x0002U)
|
||||||
#define LAN8742_BSR_EXTENDED_CAP ((uint16_t)0x0001U)
|
#define LAN8742_BSR_EXTENDED_CAP ((uint16_t)0x0001U)
|
||||||
/**
|
/**
|
||||||
* @}
|
* @}
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/** @defgroup LAN8742_PHYI1R_Bit_Definition LAN8742 PHYI1R Bit Definition
|
/** @defgroup LAN8742_PHYI1R_Bit_Definition LAN8742 PHYI1R Bit Definition
|
||||||
* @{
|
* @{
|
||||||
*/
|
*/
|
||||||
#define LAN8742_PHYI1R_OUI_3_18 ((uint16_t)0xFFFFU)
|
#define LAN8742_PHYI1R_OUI_3_18 ((uint16_t)0xFFFFU)
|
||||||
/**
|
/**
|
||||||
* @}
|
* @}
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/** @defgroup LAN8742_PHYI2R_Bit_Definition LAN8742 PHYI2R Bit Definition
|
/** @defgroup LAN8742_PHYI2R_Bit_Definition LAN8742 PHYI2R Bit Definition
|
||||||
* @{
|
* @{
|
||||||
*/
|
*/
|
||||||
#define LAN8742_PHYI2R_OUI_19_24 ((uint16_t)0xFC00U)
|
#define LAN8742_PHYI2R_OUI_19_24 ((uint16_t)0xFC00U)
|
||||||
#define LAN8742_PHYI2R_MODEL_NBR ((uint16_t)0x03F0U)
|
#define LAN8742_PHYI2R_MODEL_NBR ((uint16_t)0x03F0U)
|
||||||
#define LAN8742_PHYI2R_REVISION_NBR ((uint16_t)0x000FU)
|
#define LAN8742_PHYI2R_REVISION_NBR ((uint16_t)0x000FU)
|
||||||
/**
|
/**
|
||||||
* @}
|
* @}
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/** @defgroup LAN8742_ANAR_Bit_Definition LAN8742 ANAR Bit Definition
|
/** @defgroup LAN8742_ANAR_Bit_Definition LAN8742 ANAR Bit Definition
|
||||||
* @{
|
* @{
|
||||||
*/
|
*/
|
||||||
#define LAN8742_ANAR_NEXT_PAGE ((uint16_t)0x8000U)
|
#define LAN8742_ANAR_NEXT_PAGE ((uint16_t)0x8000U)
|
||||||
#define LAN8742_ANAR_REMOTE_FAULT ((uint16_t)0x2000U)
|
#define LAN8742_ANAR_REMOTE_FAULT ((uint16_t)0x2000U)
|
||||||
#define LAN8742_ANAR_PAUSE_OPERATION ((uint16_t)0x0C00U)
|
#define LAN8742_ANAR_PAUSE_OPERATION ((uint16_t)0x0C00U)
|
||||||
#define LAN8742_ANAR_PO_NOPAUSE ((uint16_t)0x0000U)
|
#define LAN8742_ANAR_PO_NOPAUSE ((uint16_t)0x0000U)
|
||||||
#define LAN8742_ANAR_PO_SYMMETRIC_PAUSE ((uint16_t)0x0400U)
|
#define LAN8742_ANAR_PO_SYMMETRIC_PAUSE ((uint16_t)0x0400U)
|
||||||
#define LAN8742_ANAR_PO_ASYMMETRIC_PAUSE ((uint16_t)0x0800U)
|
#define LAN8742_ANAR_PO_ASYMMETRIC_PAUSE ((uint16_t)0x0800U)
|
||||||
#define LAN8742_ANAR_PO_ADVERTISE_SUPPORT ((uint16_t)0x0C00U)
|
#define LAN8742_ANAR_PO_ADVERTISE_SUPPORT ((uint16_t)0x0C00U)
|
||||||
#define LAN8742_ANAR_100BASE_TX_FD ((uint16_t)0x0100U)
|
#define LAN8742_ANAR_100BASE_TX_FD ((uint16_t)0x0100U)
|
||||||
#define LAN8742_ANAR_100BASE_TX ((uint16_t)0x0080U)
|
#define LAN8742_ANAR_100BASE_TX ((uint16_t)0x0080U)
|
||||||
#define LAN8742_ANAR_10BASE_T_FD ((uint16_t)0x0040U)
|
#define LAN8742_ANAR_10BASE_T_FD ((uint16_t)0x0040U)
|
||||||
#define LAN8742_ANAR_10BASE_T ((uint16_t)0x0020U)
|
#define LAN8742_ANAR_10BASE_T ((uint16_t)0x0020U)
|
||||||
#define LAN8742_ANAR_SELECTOR_FIELD ((uint16_t)0x000FU)
|
#define LAN8742_ANAR_SELECTOR_FIELD ((uint16_t)0x000FU)
|
||||||
/**
|
/**
|
||||||
* @}
|
* @}
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/** @defgroup LAN8742_ANLPAR_Bit_Definition LAN8742 ANLPAR Bit Definition
|
/** @defgroup LAN8742_ANLPAR_Bit_Definition LAN8742 ANLPAR Bit Definition
|
||||||
* @{
|
* @{
|
||||||
*/
|
*/
|
||||||
#define LAN8742_ANLPAR_NEXT_PAGE ((uint16_t)0x8000U)
|
#define LAN8742_ANLPAR_NEXT_PAGE ((uint16_t)0x8000U)
|
||||||
#define LAN8742_ANLPAR_REMOTE_FAULT ((uint16_t)0x2000U)
|
#define LAN8742_ANLPAR_REMOTE_FAULT ((uint16_t)0x2000U)
|
||||||
#define LAN8742_ANLPAR_PAUSE_OPERATION ((uint16_t)0x0C00U)
|
#define LAN8742_ANLPAR_PAUSE_OPERATION ((uint16_t)0x0C00U)
|
||||||
#define LAN8742_ANLPAR_PO_NOPAUSE ((uint16_t)0x0000U)
|
#define LAN8742_ANLPAR_PO_NOPAUSE ((uint16_t)0x0000U)
|
||||||
#define LAN8742_ANLPAR_PO_SYMMETRIC_PAUSE ((uint16_t)0x0400U)
|
#define LAN8742_ANLPAR_PO_SYMMETRIC_PAUSE ((uint16_t)0x0400U)
|
||||||
#define LAN8742_ANLPAR_PO_ASYMMETRIC_PAUSE ((uint16_t)0x0800U)
|
#define LAN8742_ANLPAR_PO_ASYMMETRIC_PAUSE ((uint16_t)0x0800U)
|
||||||
#define LAN8742_ANLPAR_PO_ADVERTISE_SUPPORT ((uint16_t)0x0C00U)
|
#define LAN8742_ANLPAR_PO_ADVERTISE_SUPPORT ((uint16_t)0x0C00U)
|
||||||
#define LAN8742_ANLPAR_100BASE_TX_FD ((uint16_t)0x0100U)
|
#define LAN8742_ANLPAR_100BASE_TX_FD ((uint16_t)0x0100U)
|
||||||
#define LAN8742_ANLPAR_100BASE_TX ((uint16_t)0x0080U)
|
#define LAN8742_ANLPAR_100BASE_TX ((uint16_t)0x0080U)
|
||||||
#define LAN8742_ANLPAR_10BASE_T_FD ((uint16_t)0x0040U)
|
#define LAN8742_ANLPAR_10BASE_T_FD ((uint16_t)0x0040U)
|
||||||
#define LAN8742_ANLPAR_10BASE_T ((uint16_t)0x0020U)
|
#define LAN8742_ANLPAR_10BASE_T ((uint16_t)0x0020U)
|
||||||
#define LAN8742_ANLPAR_SELECTOR_FIELD ((uint16_t)0x000FU)
|
#define LAN8742_ANLPAR_SELECTOR_FIELD ((uint16_t)0x000FU)
|
||||||
/**
|
/**
|
||||||
* @}
|
* @}
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/** @defgroup LAN8742_ANER_Bit_Definition LAN8742 ANER Bit Definition
|
/** @defgroup LAN8742_ANER_Bit_Definition LAN8742 ANER Bit Definition
|
||||||
* @{
|
* @{
|
||||||
*/
|
*/
|
||||||
#define LAN8742_ANER_RX_NP_LOCATION_ABLE ((uint16_t)0x0040U)
|
#define LAN8742_ANER_RX_NP_LOCATION_ABLE ((uint16_t)0x0040U)
|
||||||
#define LAN8742_ANER_RX_NP_STORAGE_LOCATION ((uint16_t)0x0020U)
|
#define LAN8742_ANER_RX_NP_STORAGE_LOCATION ((uint16_t)0x0020U)
|
||||||
#define LAN8742_ANER_PARALLEL_DETECT_FAULT ((uint16_t)0x0010U)
|
#define LAN8742_ANER_PARALLEL_DETECT_FAULT ((uint16_t)0x0010U)
|
||||||
#define LAN8742_ANER_LP_NP_ABLE ((uint16_t)0x0008U)
|
#define LAN8742_ANER_LP_NP_ABLE ((uint16_t)0x0008U)
|
||||||
#define LAN8742_ANER_NP_ABLE ((uint16_t)0x0004U)
|
#define LAN8742_ANER_NP_ABLE ((uint16_t)0x0004U)
|
||||||
#define LAN8742_ANER_PAGE_RECEIVED ((uint16_t)0x0002U)
|
#define LAN8742_ANER_PAGE_RECEIVED ((uint16_t)0x0002U)
|
||||||
#define LAN8742_ANER_LP_AUTONEG_ABLE ((uint16_t)0x0001U)
|
#define LAN8742_ANER_LP_AUTONEG_ABLE ((uint16_t)0x0001U)
|
||||||
/**
|
/**
|
||||||
* @}
|
* @}
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/** @defgroup LAN8742_ANNPTR_Bit_Definition LAN8742 ANNPTR Bit Definition
|
/** @defgroup LAN8742_ANNPTR_Bit_Definition LAN8742 ANNPTR Bit Definition
|
||||||
* @{
|
* @{
|
||||||
*/
|
*/
|
||||||
#define LAN8742_ANNPTR_NEXT_PAGE ((uint16_t)0x8000U)
|
#define LAN8742_ANNPTR_NEXT_PAGE ((uint16_t)0x8000U)
|
||||||
#define LAN8742_ANNPTR_MESSAGE_PAGE ((uint16_t)0x2000U)
|
#define LAN8742_ANNPTR_MESSAGE_PAGE ((uint16_t)0x2000U)
|
||||||
#define LAN8742_ANNPTR_ACK2 ((uint16_t)0x1000U)
|
#define LAN8742_ANNPTR_ACK2 ((uint16_t)0x1000U)
|
||||||
#define LAN8742_ANNPTR_TOGGLE ((uint16_t)0x0800U)
|
#define LAN8742_ANNPTR_TOGGLE ((uint16_t)0x0800U)
|
||||||
#define LAN8742_ANNPTR_MESSAGGE_CODE ((uint16_t)0x07FFU)
|
#define LAN8742_ANNPTR_MESSAGGE_CODE ((uint16_t)0x07FFU)
|
||||||
/**
|
/**
|
||||||
* @}
|
* @}
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/** @defgroup LAN8742_ANNPRR_Bit_Definition LAN8742 ANNPRR Bit Definition
|
/** @defgroup LAN8742_ANNPRR_Bit_Definition LAN8742 ANNPRR Bit Definition
|
||||||
* @{
|
* @{
|
||||||
*/
|
*/
|
||||||
#define LAN8742_ANNPTR_NEXT_PAGE ((uint16_t)0x8000U)
|
#define LAN8742_ANNPTR_NEXT_PAGE ((uint16_t)0x8000U)
|
||||||
#define LAN8742_ANNPRR_ACK ((uint16_t)0x4000U)
|
#define LAN8742_ANNPRR_ACK ((uint16_t)0x4000U)
|
||||||
#define LAN8742_ANNPRR_MESSAGE_PAGE ((uint16_t)0x2000U)
|
#define LAN8742_ANNPRR_MESSAGE_PAGE ((uint16_t)0x2000U)
|
||||||
#define LAN8742_ANNPRR_ACK2 ((uint16_t)0x1000U)
|
#define LAN8742_ANNPRR_ACK2 ((uint16_t)0x1000U)
|
||||||
#define LAN8742_ANNPRR_TOGGLE ((uint16_t)0x0800U)
|
#define LAN8742_ANNPRR_TOGGLE ((uint16_t)0x0800U)
|
||||||
#define LAN8742_ANNPRR_MESSAGGE_CODE ((uint16_t)0x07FFU)
|
#define LAN8742_ANNPRR_MESSAGGE_CODE ((uint16_t)0x07FFU)
|
||||||
/**
|
/**
|
||||||
* @}
|
* @}
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/** @defgroup LAN8742_MMDACR_Bit_Definition LAN8742 MMDACR Bit Definition
|
/** @defgroup LAN8742_MMDACR_Bit_Definition LAN8742 MMDACR Bit Definition
|
||||||
* @{
|
* @{
|
||||||
*/
|
*/
|
||||||
#define LAN8742_MMDACR_MMD_FUNCTION ((uint16_t)0xC000U)
|
#define LAN8742_MMDACR_MMD_FUNCTION ((uint16_t)0xC000U)
|
||||||
#define LAN8742_MMDACR_MMD_FUNCTION_ADDR ((uint16_t)0x0000U)
|
#define LAN8742_MMDACR_MMD_FUNCTION_ADDR ((uint16_t)0x0000U)
|
||||||
#define LAN8742_MMDACR_MMD_FUNCTION_DATA ((uint16_t)0x4000U)
|
#define LAN8742_MMDACR_MMD_FUNCTION_DATA ((uint16_t)0x4000U)
|
||||||
#define LAN8742_MMDACR_MMD_DEV_ADDR ((uint16_t)0x001FU)
|
#define LAN8742_MMDACR_MMD_DEV_ADDR ((uint16_t)0x001FU)
|
||||||
/**
|
/**
|
||||||
* @}
|
* @}
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/** @defgroup LAN8742_ENCTR_Bit_Definition LAN8742 ENCTR Bit Definition
|
/** @defgroup LAN8742_ENCTR_Bit_Definition LAN8742 ENCTR Bit Definition
|
||||||
* @{
|
* @{
|
||||||
*/
|
*/
|
||||||
#define LAN8742_ENCTR_TX_ENABLE ((uint16_t)0x8000U)
|
#define LAN8742_ENCTR_TX_ENABLE ((uint16_t)0x8000U)
|
||||||
#define LAN8742_ENCTR_TX_TIMER ((uint16_t)0x6000U)
|
#define LAN8742_ENCTR_TX_TIMER ((uint16_t)0x6000U)
|
||||||
#define LAN8742_ENCTR_TX_TIMER_1S ((uint16_t)0x0000U)
|
#define LAN8742_ENCTR_TX_TIMER_1S ((uint16_t)0x0000U)
|
||||||
#define LAN8742_ENCTR_TX_TIMER_768MS ((uint16_t)0x2000U)
|
#define LAN8742_ENCTR_TX_TIMER_768MS ((uint16_t)0x2000U)
|
||||||
#define LAN8742_ENCTR_TX_TIMER_512MS ((uint16_t)0x4000U)
|
#define LAN8742_ENCTR_TX_TIMER_512MS ((uint16_t)0x4000U)
|
||||||
#define LAN8742_ENCTR_TX_TIMER_265MS ((uint16_t)0x6000U)
|
#define LAN8742_ENCTR_TX_TIMER_265MS ((uint16_t)0x6000U)
|
||||||
#define LAN8742_ENCTR_RX_ENABLE ((uint16_t)0x1000U)
|
#define LAN8742_ENCTR_RX_ENABLE ((uint16_t)0x1000U)
|
||||||
#define LAN8742_ENCTR_RX_MAX_INTERVAL ((uint16_t)0x0C00U)
|
#define LAN8742_ENCTR_RX_MAX_INTERVAL ((uint16_t)0x0C00U)
|
||||||
#define LAN8742_ENCTR_RX_MAX_INTERVAL_64MS ((uint16_t)0x0000U)
|
#define LAN8742_ENCTR_RX_MAX_INTERVAL_64MS ((uint16_t)0x0000U)
|
||||||
#define LAN8742_ENCTR_RX_MAX_INTERVAL_256MS ((uint16_t)0x0400U)
|
#define LAN8742_ENCTR_RX_MAX_INTERVAL_256MS ((uint16_t)0x0400U)
|
||||||
#define LAN8742_ENCTR_RX_MAX_INTERVAL_512MS ((uint16_t)0x0800U)
|
#define LAN8742_ENCTR_RX_MAX_INTERVAL_512MS ((uint16_t)0x0800U)
|
||||||
#define LAN8742_ENCTR_RX_MAX_INTERVAL_1S ((uint16_t)0x0C00U)
|
#define LAN8742_ENCTR_RX_MAX_INTERVAL_1S ((uint16_t)0x0C00U)
|
||||||
#define LAN8742_ENCTR_EX_CROSS_OVER ((uint16_t)0x0002U)
|
#define LAN8742_ENCTR_EX_CROSS_OVER ((uint16_t)0x0002U)
|
||||||
#define LAN8742_ENCTR_EX_MANUAL_CROSS_OVER ((uint16_t)0x0001U)
|
#define LAN8742_ENCTR_EX_MANUAL_CROSS_OVER ((uint16_t)0x0001U)
|
||||||
/**
|
/**
|
||||||
* @}
|
* @}
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/** @defgroup LAN8742_MCSR_Bit_Definition LAN8742 MCSR Bit Definition
|
/** @defgroup LAN8742_MCSR_Bit_Definition LAN8742 MCSR Bit Definition
|
||||||
* @{
|
* @{
|
||||||
*/
|
*/
|
||||||
#define LAN8742_MCSR_EDPWRDOWN ((uint16_t)0x2000U)
|
#define LAN8742_MCSR_EDPWRDOWN ((uint16_t)0x2000U)
|
||||||
#define LAN8742_MCSR_FARLOOPBACK ((uint16_t)0x0200U)
|
#define LAN8742_MCSR_FARLOOPBACK ((uint16_t)0x0200U)
|
||||||
#define LAN8742_MCSR_ALTINT ((uint16_t)0x0040U)
|
#define LAN8742_MCSR_ALTINT ((uint16_t)0x0040U)
|
||||||
#define LAN8742_MCSR_ENERGYON ((uint16_t)0x0002U)
|
#define LAN8742_MCSR_ENERGYON ((uint16_t)0x0002U)
|
||||||
/**
|
/**
|
||||||
* @}
|
* @}
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/** @defgroup LAN8742_SMR_Bit_Definition LAN8742 SMR Bit Definition
|
/** @defgroup LAN8742_SMR_Bit_Definition LAN8742 SMR Bit Definition
|
||||||
* @{
|
* @{
|
||||||
*/
|
*/
|
||||||
#define LAN8742_SMR_MODE ((uint16_t)0x00E0U)
|
#define LAN8742_SMR_MODE ((uint16_t)0x00E0U)
|
||||||
#define LAN8742_SMR_PHY_ADDR ((uint16_t)0x001FU)
|
#define LAN8742_SMR_PHY_ADDR ((uint16_t)0x001FU)
|
||||||
/**
|
/**
|
||||||
* @}
|
* @}
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/** @defgroup LAN8742_TPDCR_Bit_Definition LAN8742 TPDCR Bit Definition
|
/** @defgroup LAN8742_TPDCR_Bit_Definition LAN8742 TPDCR Bit Definition
|
||||||
* @{
|
* @{
|
||||||
*/
|
*/
|
||||||
#define LAN8742_TPDCR_DELAY_IN ((uint16_t)0x8000U)
|
#define LAN8742_TPDCR_DELAY_IN ((uint16_t)0x8000U)
|
||||||
#define LAN8742_TPDCR_LINE_BREAK_COUNTER ((uint16_t)0x7000U)
|
#define LAN8742_TPDCR_LINE_BREAK_COUNTER ((uint16_t)0x7000U)
|
||||||
#define LAN8742_TPDCR_PATTERN_HIGH ((uint16_t)0x0FC0U)
|
#define LAN8742_TPDCR_PATTERN_HIGH ((uint16_t)0x0FC0U)
|
||||||
#define LAN8742_TPDCR_PATTERN_LOW ((uint16_t)0x003FU)
|
#define LAN8742_TPDCR_PATTERN_LOW ((uint16_t)0x003FU)
|
||||||
/**
|
/**
|
||||||
* @}
|
* @}
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/** @defgroup LAN8742_TCSR_Bit_Definition LAN8742 TCSR Bit Definition
|
/** @defgroup LAN8742_TCSR_Bit_Definition LAN8742 TCSR Bit Definition
|
||||||
* @{
|
* @{
|
||||||
*/
|
*/
|
||||||
#define LAN8742_TCSR_TDR_ENABLE ((uint16_t)0x8000U)
|
#define LAN8742_TCSR_TDR_ENABLE ((uint16_t)0x8000U)
|
||||||
#define LAN8742_TCSR_TDR_AD_FILTER_ENABLE ((uint16_t)0x4000U)
|
#define LAN8742_TCSR_TDR_AD_FILTER_ENABLE ((uint16_t)0x4000U)
|
||||||
#define LAN8742_TCSR_TDR_CH_CABLE_TYPE ((uint16_t)0x0600U)
|
#define LAN8742_TCSR_TDR_CH_CABLE_TYPE ((uint16_t)0x0600U)
|
||||||
#define LAN8742_TCSR_TDR_CH_CABLE_DEFAULT ((uint16_t)0x0000U)
|
#define LAN8742_TCSR_TDR_CH_CABLE_DEFAULT ((uint16_t)0x0000U)
|
||||||
#define LAN8742_TCSR_TDR_CH_CABLE_SHORTED ((uint16_t)0x0200U)
|
#define LAN8742_TCSR_TDR_CH_CABLE_SHORTED ((uint16_t)0x0200U)
|
||||||
#define LAN8742_TCSR_TDR_CH_CABLE_OPEN ((uint16_t)0x0400U)
|
#define LAN8742_TCSR_TDR_CH_CABLE_OPEN ((uint16_t)0x0400U)
|
||||||
#define LAN8742_TCSR_TDR_CH_CABLE_MATCH ((uint16_t)0x0600U)
|
#define LAN8742_TCSR_TDR_CH_CABLE_MATCH ((uint16_t)0x0600U)
|
||||||
#define LAN8742_TCSR_TDR_CH_STATUS ((uint16_t)0x0100U)
|
#define LAN8742_TCSR_TDR_CH_STATUS ((uint16_t)0x0100U)
|
||||||
#define LAN8742_TCSR_TDR_CH_LENGTH ((uint16_t)0x00FFU)
|
#define LAN8742_TCSR_TDR_CH_LENGTH ((uint16_t)0x00FFU)
|
||||||
/**
|
/**
|
||||||
* @}
|
* @}
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/** @defgroup LAN8742_SCSIR_Bit_Definition LAN8742 SCSIR Bit Definition
|
/** @defgroup LAN8742_SCSIR_Bit_Definition LAN8742 SCSIR Bit Definition
|
||||||
* @{
|
* @{
|
||||||
*/
|
*/
|
||||||
#define LAN8742_SCSIR_AUTO_MDIX_ENABLE ((uint16_t)0x8000U)
|
#define LAN8742_SCSIR_AUTO_MDIX_ENABLE ((uint16_t)0x8000U)
|
||||||
#define LAN8742_SCSIR_CHANNEL_SELECT ((uint16_t)0x2000U)
|
#define LAN8742_SCSIR_CHANNEL_SELECT ((uint16_t)0x2000U)
|
||||||
#define LAN8742_SCSIR_SQE_DISABLE ((uint16_t)0x0800U)
|
#define LAN8742_SCSIR_SQE_DISABLE ((uint16_t)0x0800U)
|
||||||
#define LAN8742_SCSIR_XPOLALITY ((uint16_t)0x0010U)
|
#define LAN8742_SCSIR_XPOLALITY ((uint16_t)0x0010U)
|
||||||
/**
|
/**
|
||||||
* @}
|
* @}
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/** @defgroup LAN8742_CLR_Bit_Definition LAN8742 CLR Bit Definition
|
/** @defgroup LAN8742_CLR_Bit_Definition LAN8742 CLR Bit Definition
|
||||||
* @{
|
* @{
|
||||||
*/
|
*/
|
||||||
#define LAN8742_CLR_CABLE_LENGTH ((uint16_t)0xF000U)
|
#define LAN8742_CLR_CABLE_LENGTH ((uint16_t)0xF000U)
|
||||||
/**
|
/**
|
||||||
* @}
|
* @}
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/** @defgroup LAN8742_IMR_ISFR_Bit_Definition LAN8742 IMR ISFR Bit Definition
|
/** @defgroup LAN8742_IMR_ISFR_Bit_Definition LAN8742 IMR ISFR Bit Definition
|
||||||
* @{
|
* @{
|
||||||
*/
|
*/
|
||||||
#define LAN8742_INT_8 ((uint16_t)0x0100U)
|
#define LAN8742_INT_8 ((uint16_t)0x0100U)
|
||||||
#define LAN8742_INT_7 ((uint16_t)0x0080U)
|
#define LAN8742_INT_7 ((uint16_t)0x0080U)
|
||||||
#define LAN8742_INT_6 ((uint16_t)0x0040U)
|
#define LAN8742_INT_6 ((uint16_t)0x0040U)
|
||||||
#define LAN8742_INT_5 ((uint16_t)0x0020U)
|
#define LAN8742_INT_5 ((uint16_t)0x0020U)
|
||||||
#define LAN8742_INT_4 ((uint16_t)0x0010U)
|
#define LAN8742_INT_4 ((uint16_t)0x0010U)
|
||||||
#define LAN8742_INT_3 ((uint16_t)0x0008U)
|
#define LAN8742_INT_3 ((uint16_t)0x0008U)
|
||||||
#define LAN8742_INT_2 ((uint16_t)0x0004U)
|
#define LAN8742_INT_2 ((uint16_t)0x0004U)
|
||||||
#define LAN8742_INT_1 ((uint16_t)0x0002U)
|
#define LAN8742_INT_1 ((uint16_t)0x0002U)
|
||||||
/**
|
/**
|
||||||
* @}
|
* @}
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/** @defgroup LAN8742_PHYSCSR_Bit_Definition LAN8742 PHYSCSR Bit Definition
|
/** @defgroup LAN8742_PHYSCSR_Bit_Definition LAN8742 PHYSCSR Bit Definition
|
||||||
* @{
|
* @{
|
||||||
*/
|
*/
|
||||||
#define LAN8742_PHYSCSR_AUTONEGO_DONE ((uint16_t)0x1000U)
|
#define LAN8742_PHYSCSR_AUTONEGO_DONE ((uint16_t)0x1000U)
|
||||||
#define LAN8742_PHYSCSR_HCDSPEEDMASK ((uint16_t)0x001CU)
|
#define LAN8742_PHYSCSR_HCDSPEEDMASK ((uint16_t)0x001CU)
|
||||||
#define LAN8742_PHYSCSR_10BT_HD ((uint16_t)0x0004U)
|
#define LAN8742_PHYSCSR_10BT_HD ((uint16_t)0x0004U)
|
||||||
#define LAN8742_PHYSCSR_10BT_FD ((uint16_t)0x0014U)
|
#define LAN8742_PHYSCSR_10BT_FD ((uint16_t)0x0014U)
|
||||||
#define LAN8742_PHYSCSR_100BTX_HD ((uint16_t)0x0008U)
|
#define LAN8742_PHYSCSR_100BTX_HD ((uint16_t)0x0008U)
|
||||||
#define LAN8742_PHYSCSR_100BTX_FD ((uint16_t)0x0018U)
|
#define LAN8742_PHYSCSR_100BTX_FD ((uint16_t)0x0018U)
|
||||||
/**
|
/**
|
||||||
* @}
|
* @}
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/** @defgroup LAN8742_Status LAN8742 Status
|
/** @defgroup LAN8742_Status LAN8742 Status
|
||||||
* @{
|
* @{
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#define LAN8742_STATUS_READ_ERROR ((int32_t)-5)
|
#define LAN8742_STATUS_READ_ERROR ((int32_t)-5)
|
||||||
#define LAN8742_STATUS_WRITE_ERROR ((int32_t)-4)
|
#define LAN8742_STATUS_WRITE_ERROR ((int32_t)-4)
|
||||||
#define LAN8742_STATUS_ADDRESS_ERROR ((int32_t)-3)
|
#define LAN8742_STATUS_ADDRESS_ERROR ((int32_t)-3)
|
||||||
#define LAN8742_STATUS_RESET_TIMEOUT ((int32_t)-2)
|
#define LAN8742_STATUS_RESET_TIMEOUT ((int32_t)-2)
|
||||||
#define LAN8742_STATUS_ERROR ((int32_t)-1)
|
#define LAN8742_STATUS_ERROR ((int32_t)-1)
|
||||||
#define LAN8742_STATUS_OK ((int32_t) 0)
|
#define LAN8742_STATUS_OK ((int32_t)0)
|
||||||
#define LAN8742_STATUS_LINK_DOWN ((int32_t) 1)
|
#define LAN8742_STATUS_LINK_DOWN ((int32_t)1)
|
||||||
#define LAN8742_STATUS_100MBITS_FULLDUPLEX ((int32_t) 2)
|
#define LAN8742_STATUS_100MBITS_FULLDUPLEX ((int32_t)2)
|
||||||
#define LAN8742_STATUS_100MBITS_HALFDUPLEX ((int32_t) 3)
|
#define LAN8742_STATUS_100MBITS_HALFDUPLEX ((int32_t)3)
|
||||||
#define LAN8742_STATUS_10MBITS_FULLDUPLEX ((int32_t) 4)
|
#define LAN8742_STATUS_10MBITS_FULLDUPLEX ((int32_t)4)
|
||||||
#define LAN8742_STATUS_10MBITS_HALFDUPLEX ((int32_t) 5)
|
#define LAN8742_STATUS_10MBITS_HALFDUPLEX ((int32_t)5)
|
||||||
#define LAN8742_STATUS_AUTONEGO_NOTDONE ((int32_t) 6)
|
#define LAN8742_STATUS_AUTONEGO_NOTDONE ((int32_t)6)
|
||||||
/**
|
/**
|
||||||
* @}
|
* @}
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/** @defgroup LAN8742_IT_Flags LAN8742 IT Flags
|
/** @defgroup LAN8742_IT_Flags LAN8742 IT Flags
|
||||||
* @{
|
* @{
|
||||||
*/
|
*/
|
||||||
#define LAN8742_WOL_IT LAN8742_INT_8
|
#define LAN8742_WOL_IT LAN8742_INT_8
|
||||||
#define LAN8742_ENERGYON_IT LAN8742_INT_7
|
#define LAN8742_ENERGYON_IT LAN8742_INT_7
|
||||||
#define LAN8742_AUTONEGO_COMPLETE_IT LAN8742_INT_6
|
#define LAN8742_AUTONEGO_COMPLETE_IT LAN8742_INT_6
|
||||||
#define LAN8742_REMOTE_FAULT_IT LAN8742_INT_5
|
#define LAN8742_REMOTE_FAULT_IT LAN8742_INT_5
|
||||||
#define LAN8742_LINK_DOWN_IT LAN8742_INT_4
|
#define LAN8742_LINK_DOWN_IT LAN8742_INT_4
|
||||||
#define LAN8742_AUTONEGO_LP_ACK_IT LAN8742_INT_3
|
#define LAN8742_AUTONEGO_LP_ACK_IT LAN8742_INT_3
|
||||||
#define LAN8742_PARALLEL_DETECTION_FAULT_IT LAN8742_INT_2
|
#define LAN8742_PARALLEL_DETECTION_FAULT_IT LAN8742_INT_2
|
||||||
#define LAN8742_AUTONEGO_PAGE_RECEIVED_IT LAN8742_INT_1
|
#define LAN8742_AUTONEGO_PAGE_RECEIVED_IT LAN8742_INT_1
|
||||||
/**
|
/**
|
||||||
* @}
|
* @}
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @}
|
* @}
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/* Exported types ------------------------------------------------------------*/
|
/* Exported types ------------------------------------------------------------*/
|
||||||
/** @defgroup LAN8742_Exported_Types LAN8742 Exported Types
|
/** @defgroup LAN8742_Exported_Types LAN8742 Exported Types
|
||||||
* @{
|
* @{
|
||||||
*/
|
*/
|
||||||
typedef int32_t (*lan8742_Init_Func) (void);
|
typedef int32_t (*lan8742_Init_Func)(void);
|
||||||
typedef int32_t (*lan8742_DeInit_Func) (void);
|
typedef int32_t (*lan8742_DeInit_Func)(void);
|
||||||
typedef int32_t (*lan8742_ReadReg_Func) (uint32_t, uint32_t, uint32_t *);
|
typedef int32_t (*lan8742_ReadReg_Func)(uint32_t, uint32_t, uint32_t *);
|
||||||
typedef int32_t (*lan8742_WriteReg_Func) (uint32_t, uint32_t, uint32_t);
|
typedef int32_t (*lan8742_WriteReg_Func)(uint32_t, uint32_t, uint32_t);
|
||||||
typedef int32_t (*lan8742_GetTick_Func) (void);
|
typedef int32_t (*lan8742_GetTick_Func)(void);
|
||||||
|
|
||||||
typedef struct
|
typedef struct {
|
||||||
{
|
lan8742_Init_Func Init;
|
||||||
lan8742_Init_Func Init;
|
lan8742_DeInit_Func DeInit;
|
||||||
lan8742_DeInit_Func DeInit;
|
lan8742_WriteReg_Func WriteReg;
|
||||||
lan8742_WriteReg_Func WriteReg;
|
lan8742_ReadReg_Func ReadReg;
|
||||||
lan8742_ReadReg_Func ReadReg;
|
lan8742_GetTick_Func GetTick;
|
||||||
lan8742_GetTick_Func GetTick;
|
|
||||||
} lan8742_IOCtx_t;
|
} lan8742_IOCtx_t;
|
||||||
|
|
||||||
|
typedef struct {
|
||||||
typedef struct
|
uint32_t DevAddr;
|
||||||
{
|
uint32_t Is_Initialized;
|
||||||
uint32_t DevAddr;
|
lan8742_IOCtx_t IO;
|
||||||
uint32_t Is_Initialized;
|
void *pData;
|
||||||
lan8742_IOCtx_t IO;
|
} lan8742_Object_t;
|
||||||
void *pData;
|
|
||||||
}lan8742_Object_t;
|
|
||||||
/**
|
/**
|
||||||
* @}
|
* @}
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/* Exported macro ------------------------------------------------------------*/
|
/* Exported macro ------------------------------------------------------------*/
|
||||||
/* Exported functions --------------------------------------------------------*/
|
/* Exported functions --------------------------------------------------------*/
|
||||||
/** @defgroup LAN8742_Exported_Functions LAN8742 Exported Functions
|
/** @defgroup LAN8742_Exported_Functions LAN8742 Exported Functions
|
||||||
* @{
|
* @{
|
||||||
*/
|
*/
|
||||||
int32_t LAN8742_RegisterBusIO(lan8742_Object_t *pObj, lan8742_IOCtx_t *ioctx);
|
int32_t LAN8742_RegisterBusIO(lan8742_Object_t *pObj, lan8742_IOCtx_t *ioctx);
|
||||||
int32_t LAN8742_Init(lan8742_Object_t *pObj);
|
int32_t LAN8742_Init(lan8742_Object_t *pObj);
|
||||||
int32_t LAN8742_DeInit(lan8742_Object_t *pObj);
|
int32_t LAN8742_DeInit(lan8742_Object_t *pObj);
|
||||||
@ -421,28 +418,27 @@ int32_t LAN8742_DisableIT(lan8742_Object_t *pObj, uint32_t Interrupt);
|
|||||||
int32_t LAN8742_ClearIT(lan8742_Object_t *pObj, uint32_t Interrupt);
|
int32_t LAN8742_ClearIT(lan8742_Object_t *pObj, uint32_t Interrupt);
|
||||||
int32_t LAN8742_GetITStatus(lan8742_Object_t *pObj, uint32_t Interrupt);
|
int32_t LAN8742_GetITStatus(lan8742_Object_t *pObj, uint32_t Interrupt);
|
||||||
/**
|
/**
|
||||||
* @}
|
* @}
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
#endif /* LAN8742_H */
|
#endif /* LAN8742_H */
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @}
|
||||||
|
*/
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @}
|
* @}
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @}
|
* @}
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @}
|
* @}
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/**
|
|
||||||
* @}
|
|
||||||
*/
|
|
||||||
/************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/
|
/************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/
|
||||||
|
@ -98,7 +98,7 @@ a lot of data that needs to be copied, this should be set high. */
|
|||||||
#define PBUF_POOL_SIZE 4
|
#define PBUF_POOL_SIZE 4
|
||||||
|
|
||||||
/* PBUF_POOL_BUFSIZE: the size of each pbuf in the pbuf pool. */
|
/* PBUF_POOL_BUFSIZE: the size of each pbuf in the pbuf pool. */
|
||||||
#define PBUF_POOL_BUFSIZE 1528
|
#define PBUF_POOL_BUFSIZE 1536
|
||||||
|
|
||||||
/* LWIP_SUPPORT_CUSTOM_PBUF == 1: to pass directly MAC Rx buffers to the stack
|
/* LWIP_SUPPORT_CUSTOM_PBUF == 1: to pass directly MAC Rx buffers to the stack
|
||||||
no copy is needed */
|
no copy is needed */
|
||||||
@ -232,12 +232,12 @@ The STM32H7xx allows computing and verifying the IP, UDP, TCP and ICMP checksums
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
#define TCPIP_THREAD_NAME "TCP/IP"
|
#define TCPIP_THREAD_NAME "TCP/IP"
|
||||||
#define TCPIP_THREAD_STACKSIZE 1000
|
#define TCPIP_THREAD_STACKSIZE 2048
|
||||||
#define TCPIP_MBOX_SIZE 6
|
#define TCPIP_MBOX_SIZE 6
|
||||||
#define DEFAULT_UDP_RECVMBOX_SIZE 6
|
#define DEFAULT_UDP_RECVMBOX_SIZE 6
|
||||||
#define DEFAULT_TCP_RECVMBOX_SIZE 6
|
#define DEFAULT_TCP_RECVMBOX_SIZE 6
|
||||||
#define DEFAULT_ACCEPTMBOX_SIZE 6
|
#define DEFAULT_ACCEPTMBOX_SIZE 6
|
||||||
#define DEFAULT_THREAD_STACKSIZE 500
|
#define DEFAULT_THREAD_STACKSIZE 1024
|
||||||
#define TCPIP_THREAD_PRIO osPriorityHigh
|
#define TCPIP_THREAD_PRIO osPriorityHigh
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
@ -58,33 +58,34 @@ extern "C" {
|
|||||||
/* Exported constants --------------------------------------------------------*/
|
/* Exported constants --------------------------------------------------------*/
|
||||||
|
|
||||||
/* UDP local connection port */
|
/* UDP local connection port */
|
||||||
#define UDP_SERVER_PORT 7
|
#define UDP_SERVER_PORT 7
|
||||||
/* UDP remote connection port */
|
/* UDP remote connection port */
|
||||||
#define UDP_CLIENT_PORT 2008
|
#define UDP_CLIENT_PORT 2008
|
||||||
|
|
||||||
/*Static DEST IP ADDRESS: DEST_IP_ADDR0.DEST_IP_ADDR1.DEST_IP_ADDR2.DEST_IP_ADDR3 */
|
/*Static DEST IP ADDRESS:
|
||||||
#define DEST_IP_ADDR0 ((uint8_t)169U)
|
* DEST_IP_ADDR0.DEST_IP_ADDR1.DEST_IP_ADDR2.DEST_IP_ADDR3 */
|
||||||
#define DEST_IP_ADDR1 ((uint8_t)254U)
|
#define DEST_IP_ADDR0 ((uint8_t)169U)
|
||||||
#define DEST_IP_ADDR2 ((uint8_t)39U)
|
#define DEST_IP_ADDR1 ((uint8_t)254U)
|
||||||
#define DEST_IP_ADDR3 ((uint8_t)2U)
|
#define DEST_IP_ADDR2 ((uint8_t)39U)
|
||||||
|
#define DEST_IP_ADDR3 ((uint8_t)2U)
|
||||||
|
|
||||||
/*Static IP ADDRESS*/
|
/*Static IP ADDRESS*/
|
||||||
#define IP_ADDR0 169
|
#define IP_ADDR0 169
|
||||||
#define IP_ADDR1 254
|
#define IP_ADDR1 254
|
||||||
#define IP_ADDR2 1
|
#define IP_ADDR2 1
|
||||||
#define IP_ADDR3 38
|
#define IP_ADDR3 38
|
||||||
|
|
||||||
/*NETMASK*/
|
/*NETMASK*/
|
||||||
#define NETMASK_ADDR0 255
|
#define NETMASK_ADDR0 255
|
||||||
#define NETMASK_ADDR1 255
|
#define NETMASK_ADDR1 255
|
||||||
#define NETMASK_ADDR2 0
|
#define NETMASK_ADDR2 0
|
||||||
#define NETMASK_ADDR3 0
|
#define NETMASK_ADDR3 0
|
||||||
|
|
||||||
/*Gateway Address*/
|
/*Gateway Address*/
|
||||||
#define GW_ADDR0 192
|
#define GW_ADDR0 192
|
||||||
#define GW_ADDR1 168
|
#define GW_ADDR1 168
|
||||||
#define GW_ADDR2 178
|
#define GW_ADDR2 178
|
||||||
#define GW_ADDR3 1
|
#define GW_ADDR3 1
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
}
|
}
|
||||||
@ -92,5 +93,4 @@ extern "C" {
|
|||||||
|
|
||||||
#endif /* __MAIN_H */
|
#endif /* __MAIN_H */
|
||||||
|
|
||||||
|
|
||||||
/************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/
|
/************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/
|
||||||
|
@ -1,30 +1,30 @@
|
|||||||
/**
|
/**
|
||||||
******************************************************************************
|
******************************************************************************
|
||||||
* @file stm32h7xx_hal_conf_template.h
|
* @file stm32h7xx_hal_conf_template.h
|
||||||
* @author MCD Application Team
|
* @author MCD Application Team
|
||||||
* @brief HAL configuration template file.
|
* @brief HAL configuration template file.
|
||||||
* This file should be copied to the application folder and renamed
|
* This file should be copied to the application folder and renamed
|
||||||
* to stm32h7xx_hal_conf.h.
|
* to stm32h7xx_hal_conf.h.
|
||||||
******************************************************************************
|
******************************************************************************
|
||||||
* @attention
|
* @attention
|
||||||
*
|
*
|
||||||
* <h2><center>© Copyright (c) 2017 STMicroelectronics.
|
* <h2><center>© Copyright (c) 2017 STMicroelectronics.
|
||||||
* All rights reserved.</center></h2>
|
* All rights reserved.</center></h2>
|
||||||
*
|
*
|
||||||
* This software component is licensed by ST under BSD 3-Clause license,
|
* This software component is licensed by ST under BSD 3-Clause license,
|
||||||
* the "License"; You may not use this file except in compliance with the
|
* the "License"; You may not use this file except in compliance with the
|
||||||
* License. You may obtain a copy of the License at:
|
* License. You may obtain a copy of the License at:
|
||||||
* opensource.org/licenses/BSD-3-Clause
|
* opensource.org/licenses/BSD-3-Clause
|
||||||
*
|
*
|
||||||
******************************************************************************
|
******************************************************************************
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/* Define to prevent recursive inclusion -------------------------------------*/
|
/* Define to prevent recursive inclusion -------------------------------------*/
|
||||||
#ifndef __STM32H7xx_HAL_CONF_H
|
#ifndef __STM32H7xx_HAL_CONF_H
|
||||||
#define __STM32H7xx_HAL_CONF_H
|
#define __STM32H7xx_HAL_CONF_H
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
extern "C" {
|
extern "C" {
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/* Exported types ------------------------------------------------------------*/
|
/* Exported types ------------------------------------------------------------*/
|
||||||
@ -32,8 +32,8 @@
|
|||||||
|
|
||||||
/* ########################## Module Selection ############################## */
|
/* ########################## Module Selection ############################## */
|
||||||
/**
|
/**
|
||||||
* @brief This is the list of modules to be used in the HAL driver
|
* @brief This is the list of modules to be used in the HAL driver
|
||||||
*/
|
*/
|
||||||
#define HAL_MODULE_ENABLED
|
#define HAL_MODULE_ENABLED
|
||||||
#define HAL_ADC_MODULE_ENABLED
|
#define HAL_ADC_MODULE_ENABLED
|
||||||
#define HAL_CEC_MODULE_ENABLED
|
#define HAL_CEC_MODULE_ENABLED
|
||||||
@ -89,221 +89,230 @@
|
|||||||
#define HAL_USART_MODULE_ENABLED
|
#define HAL_USART_MODULE_ENABLED
|
||||||
#define HAL_WWDG_MODULE_ENABLED
|
#define HAL_WWDG_MODULE_ENABLED
|
||||||
|
|
||||||
/* ########################## Oscillator Values adaptation ####################*/
|
/* ########################## Oscillator Values adaptation
|
||||||
|
* ####################*/
|
||||||
/**
|
/**
|
||||||
* @brief Adjust the value of External High Speed oscillator (HSE) used in your application.
|
* @brief Adjust the value of External High Speed oscillator (HSE) used in your
|
||||||
* This value is used by the RCC HAL module to compute the system frequency
|
* application. This value is used by the RCC HAL module to compute the system
|
||||||
* (when HSE is used as system clock source, directly or through the PLL).
|
* frequency (when HSE is used as system clock source, directly or through the
|
||||||
*/
|
* PLL).
|
||||||
#if !defined (HSE_VALUE)
|
*/
|
||||||
#define HSE_VALUE ((uint32_t)8000000) /*!< Value of the External oscillator in Hz */
|
#if !defined(HSE_VALUE)
|
||||||
#endif /* HSE_VALUE */
|
#define HSE_VALUE \
|
||||||
|
((uint32_t)8000000) /*!< Value of the External oscillator in Hz */
|
||||||
|
#endif /* HSE_VALUE */
|
||||||
|
|
||||||
#if !defined (HSE_STARTUP_TIMEOUT)
|
#if !defined(HSE_STARTUP_TIMEOUT)
|
||||||
#define HSE_STARTUP_TIMEOUT ((uint32_t)5000) /*!< Time out for HSE start up, in ms */
|
#define HSE_STARTUP_TIMEOUT \
|
||||||
#endif /* HSE_STARTUP_TIMEOUT */
|
((uint32_t)5000) /*!< Time out for HSE start up, in ms */
|
||||||
|
#endif /* HSE_STARTUP_TIMEOUT */
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Internal oscillator (CSI) default value.
|
* @brief Internal oscillator (CSI) default value.
|
||||||
* This value is the default CSI value after Reset.
|
* This value is the default CSI value after Reset.
|
||||||
*/
|
*/
|
||||||
#if !defined (CSI_VALUE)
|
#if !defined(CSI_VALUE)
|
||||||
#define CSI_VALUE ((uint32_t)4000000) /*!< Value of the Internal oscillator in Hz*/
|
#define CSI_VALUE \
|
||||||
#endif /* CSI_VALUE */
|
((uint32_t)4000000) /*!< Value of the Internal oscillator in Hz*/
|
||||||
|
#endif /* CSI_VALUE */
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Internal High Speed oscillator (HSI) value.
|
* @brief Internal High Speed oscillator (HSI) value.
|
||||||
* This value is used by the RCC HAL module to compute the system frequency
|
* This value is used by the RCC HAL module to compute the system
|
||||||
* (when HSI is used as system clock source, directly or through the PLL).
|
* frequency (when HSI is used as system clock source, directly or through the
|
||||||
*/
|
* PLL).
|
||||||
#if !defined (HSI_VALUE)
|
*/
|
||||||
#define HSI_VALUE ((uint32_t)64000000) /*!< Value of the Internal oscillator in Hz*/
|
#if !defined(HSI_VALUE)
|
||||||
#endif /* HSI_VALUE */
|
#define HSI_VALUE \
|
||||||
|
((uint32_t)64000000) /*!< Value of the Internal oscillator in Hz*/
|
||||||
|
#endif /* HSI_VALUE */
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief External Low Speed oscillator (LSE) value.
|
* @brief External Low Speed oscillator (LSE) value.
|
||||||
* This value is used by the UART, RTC HAL module to compute the system frequency
|
* This value is used by the UART, RTC HAL module to compute the system
|
||||||
*/
|
* frequency
|
||||||
#if !defined (LSE_VALUE)
|
*/
|
||||||
#define LSE_VALUE ((uint32_t)32768) /*!< Value of the External oscillator in Hz*/
|
#if !defined(LSE_VALUE)
|
||||||
#endif /* LSE_VALUE */
|
#define LSE_VALUE \
|
||||||
|
((uint32_t)32768) /*!< Value of the External oscillator in Hz*/
|
||||||
|
#endif /* LSE_VALUE */
|
||||||
|
|
||||||
|
#if !defined(LSE_STARTUP_TIMEOUT)
|
||||||
|
#define LSE_STARTUP_TIMEOUT \
|
||||||
|
((uint32_t)5000) /*!< Time out for LSE start up, in ms */
|
||||||
|
#endif /* LSE_STARTUP_TIMEOUT */
|
||||||
|
|
||||||
#if !defined (LSE_STARTUP_TIMEOUT)
|
#if !defined(LSI_VALUE)
|
||||||
#define LSE_STARTUP_TIMEOUT ((uint32_t)5000) /*!< Time out for LSE start up, in ms */
|
#define LSI_VALUE ((uint32_t)32000) /*!< LSI Typical Value in Hz*/
|
||||||
#endif /* LSE_STARTUP_TIMEOUT */
|
#endif /* LSI_VALUE */ /*!< Value of the Internal Low Speed oscillator in Hz \
|
||||||
|
The real value may vary depending on the variations \
|
||||||
#if !defined (LSI_VALUE)
|
in voltage and temperature.*/
|
||||||
#define LSI_VALUE ((uint32_t)32000) /*!< LSI Typical Value in Hz*/
|
|
||||||
#endif /* LSI_VALUE */ /*!< Value of the Internal Low Speed oscillator in Hz
|
|
||||||
The real value may vary depending on the variations
|
|
||||||
in voltage and temperature.*/
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief External clock source for I2S peripheral
|
* @brief External clock source for I2S peripheral
|
||||||
* This value is used by the I2S HAL module to compute the I2S clock source
|
* This value is used by the I2S HAL module to compute the I2S clock
|
||||||
* frequency, this source is inserted directly through I2S_CKIN pad.
|
* source frequency, this source is inserted directly through I2S_CKIN pad.
|
||||||
*/
|
*/
|
||||||
#if !defined (EXTERNAL_CLOCK_VALUE)
|
#if !defined(EXTERNAL_CLOCK_VALUE)
|
||||||
#define EXTERNAL_CLOCK_VALUE 12288000U /*!< Value of the External clock in Hz*/
|
#define EXTERNAL_CLOCK_VALUE 12288000U /*!< Value of the External clock in \
|
||||||
#endif /* EXTERNAL_CLOCK_VALUE */
|
Hz*/
|
||||||
|
#endif /* EXTERNAL_CLOCK_VALUE */
|
||||||
|
|
||||||
/* Tip: To avoid modifying this file each time you need to use different HSE,
|
/* Tip: To avoid modifying this file each time you need to use different HSE,
|
||||||
=== you can define the HSE value in your toolchain compiler preprocessor. */
|
=== you can define the HSE value in your toolchain compiler preprocessor. */
|
||||||
|
|
||||||
/* ########################### System Configuration ######################### */
|
/* ########################### System Configuration ######################### */
|
||||||
/**
|
/**
|
||||||
* @brief This is the HAL system configuration section
|
* @brief This is the HAL system configuration section
|
||||||
*/
|
*/
|
||||||
#define VDD_VALUE ((uint32_t)3300) /*!< Value of VDD in mv */
|
#define VDD_VALUE ((uint32_t)3300) /*!< Value of VDD in mv */
|
||||||
#define TICK_INT_PRIORITY ((uint32_t)0x0F) /*!< tick interrupt priority */
|
#define TICK_INT_PRIORITY ((uint32_t)0x0F) /*!< tick interrupt priority */
|
||||||
#define USE_RTOS 0
|
#define USE_RTOS 0
|
||||||
/* #define USE_SD_TRANSCEIVER 1U */ /*!< use uSD Transceiver */
|
/* #define USE_SD_TRANSCEIVER 1U */ /*!< use uSD Transceiver */
|
||||||
#define USE_SPI_CRC 1U /*!< use CRC in SPI */
|
#define USE_SPI_CRC 1U /*!< use CRC in SPI */
|
||||||
|
|
||||||
/* ########################### Ethernet Configuration ######################### */
|
/* ########################### Ethernet Configuration #########################
|
||||||
#define ETH_TX_DESC_CNT 4 /* number of Ethernet Tx DMA descriptors */
|
*/
|
||||||
#define ETH_RX_DESC_CNT 4 /* number of Ethernet Rx DMA descriptors */
|
#define ETH_TX_DESC_CNT 4 /* number of Ethernet Tx DMA descriptors */
|
||||||
|
#define ETH_RX_DESC_CNT 4 /* number of Ethernet Rx DMA descriptors */
|
||||||
|
|
||||||
#define ETH_MAC_ADDR0 ((uint8_t)0x02)
|
#define ETH_MAC_ADDR0 ((uint8_t)0x02)
|
||||||
#define ETH_MAC_ADDR1 ((uint8_t)0x00)
|
#define ETH_MAC_ADDR1 ((uint8_t)0x00)
|
||||||
#define ETH_MAC_ADDR2 ((uint8_t)0x00)
|
#define ETH_MAC_ADDR2 ((uint8_t)0x00)
|
||||||
#define ETH_MAC_ADDR3 ((uint8_t)0x00)
|
#define ETH_MAC_ADDR3 ((uint8_t)0x00)
|
||||||
#define ETH_MAC_ADDR4 ((uint8_t)0x00)
|
#define ETH_MAC_ADDR4 ((uint8_t)0x00)
|
||||||
#define ETH_MAC_ADDR5 ((uint8_t)0x00)
|
#define ETH_MAC_ADDR5 ((uint8_t)0x00)
|
||||||
|
|
||||||
/* ########################## Assert Selection ############################## */
|
/* ########################## Assert Selection ############################## */
|
||||||
/**
|
/**
|
||||||
* @brief Uncomment the line below to expanse the "assert_param" macro in the
|
* @brief Uncomment the line below to expanse the "assert_param" macro in the
|
||||||
* HAL drivers code
|
* HAL drivers code
|
||||||
*/
|
*/
|
||||||
/* #define USE_FULL_ASSERT 1 */
|
/* #define USE_FULL_ASSERT 1 */
|
||||||
|
|
||||||
|
|
||||||
/* Includes ------------------------------------------------------------------*/
|
/* Includes ------------------------------------------------------------------*/
|
||||||
/**
|
/**
|
||||||
* @brief Include module's header file
|
* @brief Include module's header file
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#ifdef HAL_RCC_MODULE_ENABLED
|
#ifdef HAL_RCC_MODULE_ENABLED
|
||||||
#include "stm32h7xx_hal_rcc.h"
|
#include "stm32h7xx_hal_rcc.h"
|
||||||
#endif /* HAL_RCC_MODULE_ENABLED */
|
#endif /* HAL_RCC_MODULE_ENABLED */
|
||||||
|
|
||||||
#ifdef HAL_GPIO_MODULE_ENABLED
|
#ifdef HAL_GPIO_MODULE_ENABLED
|
||||||
#include "stm32h7xx_hal_gpio.h"
|
#include "stm32h7xx_hal_gpio.h"
|
||||||
#endif /* HAL_GPIO_MODULE_ENABLED */
|
#endif /* HAL_GPIO_MODULE_ENABLED */
|
||||||
|
|
||||||
#ifdef HAL_DMA_MODULE_ENABLED
|
#ifdef HAL_DMA_MODULE_ENABLED
|
||||||
#include "stm32h7xx_hal_dma.h"
|
#include "stm32h7xx_hal_dma.h"
|
||||||
#endif /* HAL_DMA_MODULE_ENABLED */
|
#endif /* HAL_DMA_MODULE_ENABLED */
|
||||||
|
|
||||||
#ifdef HAL_MDMA_MODULE_ENABLED
|
#ifdef HAL_MDMA_MODULE_ENABLED
|
||||||
#include "stm32h7xx_hal_mdma.h"
|
#include "stm32h7xx_hal_mdma.h"
|
||||||
#endif /* HAL_MDMA_MODULE_ENABLED */
|
#endif /* HAL_MDMA_MODULE_ENABLED */
|
||||||
|
|
||||||
#ifdef HAL_HASH_MODULE_ENABLED
|
#ifdef HAL_HASH_MODULE_ENABLED
|
||||||
#include "stm32h7xx_hal_hash.h"
|
#include "stm32h7xx_hal_hash.h"
|
||||||
#endif /* HAL_HASH_MODULE_ENABLED */
|
#endif /* HAL_HASH_MODULE_ENABLED */
|
||||||
|
|
||||||
#ifdef HAL_DCMI_MODULE_ENABLED
|
#ifdef HAL_DCMI_MODULE_ENABLED
|
||||||
#include "stm32h7xx_hal_dcmi.h"
|
#include "stm32h7xx_hal_dcmi.h"
|
||||||
#endif /* HAL_DCMI_MODULE_ENABLED */
|
#endif /* HAL_DCMI_MODULE_ENABLED */
|
||||||
|
|
||||||
#ifdef HAL_DMA2D_MODULE_ENABLED
|
#ifdef HAL_DMA2D_MODULE_ENABLED
|
||||||
#include "stm32h7xx_hal_dma2d.h"
|
#include "stm32h7xx_hal_dma2d.h"
|
||||||
#endif /* HAL_DMA2D_MODULE_ENABLED */
|
#endif /* HAL_DMA2D_MODULE_ENABLED */
|
||||||
|
|
||||||
#ifdef HAL_DFSDM_MODULE_ENABLED
|
#ifdef HAL_DFSDM_MODULE_ENABLED
|
||||||
#include "stm32h7xx_hal_dfsdm.h"
|
#include "stm32h7xx_hal_dfsdm.h"
|
||||||
#endif /* HAL_DFSDM_MODULE_ENABLED */
|
#endif /* HAL_DFSDM_MODULE_ENABLED */
|
||||||
|
|
||||||
#ifdef HAL_ETH_MODULE_ENABLED
|
#ifdef HAL_ETH_MODULE_ENABLED
|
||||||
#include "stm32h7xx_hal_eth.h"
|
#include "stm32h7xx_hal_eth.h"
|
||||||
#endif /* HAL_ETH_MODULE_ENABLED */
|
#endif /* HAL_ETH_MODULE_ENABLED */
|
||||||
|
|
||||||
#ifdef HAL_EXTI_MODULE_ENABLED
|
#ifdef HAL_EXTI_MODULE_ENABLED
|
||||||
#include "stm32h7xx_hal_exti.h"
|
#include "stm32h7xx_hal_exti.h"
|
||||||
#endif /* HAL_EXTI_MODULE_ENABLED */
|
#endif /* HAL_EXTI_MODULE_ENABLED */
|
||||||
|
|
||||||
#ifdef HAL_CORTEX_MODULE_ENABLED
|
#ifdef HAL_CORTEX_MODULE_ENABLED
|
||||||
#include "stm32h7xx_hal_cortex.h"
|
#include "stm32h7xx_hal_cortex.h"
|
||||||
#endif /* HAL_CORTEX_MODULE_ENABLED */
|
#endif /* HAL_CORTEX_MODULE_ENABLED */
|
||||||
|
|
||||||
#ifdef HAL_ADC_MODULE_ENABLED
|
#ifdef HAL_ADC_MODULE_ENABLED
|
||||||
#include "stm32h7xx_hal_adc.h"
|
#include "stm32h7xx_hal_adc.h"
|
||||||
#endif /* HAL_ADC_MODULE_ENABLED */
|
#endif /* HAL_ADC_MODULE_ENABLED */
|
||||||
|
|
||||||
#ifdef HAL_FDCAN_MODULE_ENABLED
|
#ifdef HAL_FDCAN_MODULE_ENABLED
|
||||||
#include "stm32h7xx_hal_fdcan.h"
|
#include "stm32h7xx_hal_fdcan.h"
|
||||||
#endif /* HAL_FDCAN_MODULE_ENABLED */
|
#endif /* HAL_FDCAN_MODULE_ENABLED */
|
||||||
|
|
||||||
#ifdef HAL_CEC_MODULE_ENABLED
|
#ifdef HAL_CEC_MODULE_ENABLED
|
||||||
#include "stm32h7xx_hal_cec.h"
|
#include "stm32h7xx_hal_cec.h"
|
||||||
#endif /* HAL_CEC_MODULE_ENABLED */
|
#endif /* HAL_CEC_MODULE_ENABLED */
|
||||||
|
|
||||||
#ifdef HAL_COMP_MODULE_ENABLED
|
#ifdef HAL_COMP_MODULE_ENABLED
|
||||||
#include "stm32h7xx_hal_comp.h"
|
#include "stm32h7xx_hal_comp.h"
|
||||||
#endif /* HAL_COMP_MODULE_ENABLED */
|
#endif /* HAL_COMP_MODULE_ENABLED */
|
||||||
|
|
||||||
#ifdef HAL_CRC_MODULE_ENABLED
|
#ifdef HAL_CRC_MODULE_ENABLED
|
||||||
#include "stm32h7xx_hal_crc.h"
|
#include "stm32h7xx_hal_crc.h"
|
||||||
#endif /* HAL_CRC_MODULE_ENABLED */
|
#endif /* HAL_CRC_MODULE_ENABLED */
|
||||||
|
|
||||||
#ifdef HAL_CRYP_MODULE_ENABLED
|
#ifdef HAL_CRYP_MODULE_ENABLED
|
||||||
#include "stm32h7xx_hal_cryp.h"
|
#include "stm32h7xx_hal_cryp.h"
|
||||||
#endif /* HAL_CRYP_MODULE_ENABLED */
|
#endif /* HAL_CRYP_MODULE_ENABLED */
|
||||||
|
|
||||||
#ifdef HAL_DAC_MODULE_ENABLED
|
#ifdef HAL_DAC_MODULE_ENABLED
|
||||||
#include "stm32h7xx_hal_dac.h"
|
#include "stm32h7xx_hal_dac.h"
|
||||||
#endif /* HAL_DAC_MODULE_ENABLED */
|
#endif /* HAL_DAC_MODULE_ENABLED */
|
||||||
|
|
||||||
#ifdef HAL_FLASH_MODULE_ENABLED
|
#ifdef HAL_FLASH_MODULE_ENABLED
|
||||||
#include "stm32h7xx_hal_flash.h"
|
#include "stm32h7xx_hal_flash.h"
|
||||||
#endif /* HAL_FLASH_MODULE_ENABLED */
|
#endif /* HAL_FLASH_MODULE_ENABLED */
|
||||||
|
|
||||||
#ifdef HAL_HRTIM_MODULE_ENABLED
|
#ifdef HAL_HRTIM_MODULE_ENABLED
|
||||||
#include "stm32h7xx_hal_hrtim.h"
|
#include "stm32h7xx_hal_hrtim.h"
|
||||||
#endif /* HAL_HRTIM_MODULE_ENABLED */
|
#endif /* HAL_HRTIM_MODULE_ENABLED */
|
||||||
|
|
||||||
#ifdef HAL_HSEM_MODULE_ENABLED
|
#ifdef HAL_HSEM_MODULE_ENABLED
|
||||||
#include "stm32h7xx_hal_hsem.h"
|
#include "stm32h7xx_hal_hsem.h"
|
||||||
#endif /* HAL_HSEM_MODULE_ENABLED */
|
#endif /* HAL_HSEM_MODULE_ENABLED */
|
||||||
|
|
||||||
#ifdef HAL_SRAM_MODULE_ENABLED
|
#ifdef HAL_SRAM_MODULE_ENABLED
|
||||||
#include "stm32h7xx_hal_sram.h"
|
#include "stm32h7xx_hal_sram.h"
|
||||||
#endif /* HAL_SRAM_MODULE_ENABLED */
|
#endif /* HAL_SRAM_MODULE_ENABLED */
|
||||||
|
|
||||||
#ifdef HAL_NOR_MODULE_ENABLED
|
#ifdef HAL_NOR_MODULE_ENABLED
|
||||||
#include "stm32h7xx_hal_nor.h"
|
#include "stm32h7xx_hal_nor.h"
|
||||||
#endif /* HAL_NOR_MODULE_ENABLED */
|
#endif /* HAL_NOR_MODULE_ENABLED */
|
||||||
|
|
||||||
#ifdef HAL_NAND_MODULE_ENABLED
|
#ifdef HAL_NAND_MODULE_ENABLED
|
||||||
#include "stm32h7xx_hal_nand.h"
|
#include "stm32h7xx_hal_nand.h"
|
||||||
#endif /* HAL_NAND_MODULE_ENABLED */
|
#endif /* HAL_NAND_MODULE_ENABLED */
|
||||||
|
|
||||||
#ifdef HAL_I2C_MODULE_ENABLED
|
#ifdef HAL_I2C_MODULE_ENABLED
|
||||||
#include "stm32h7xx_hal_i2c.h"
|
#include "stm32h7xx_hal_i2c.h"
|
||||||
#endif /* HAL_I2C_MODULE_ENABLED */
|
#endif /* HAL_I2C_MODULE_ENABLED */
|
||||||
|
|
||||||
#ifdef HAL_I2S_MODULE_ENABLED
|
#ifdef HAL_I2S_MODULE_ENABLED
|
||||||
#include "stm32h7xx_hal_i2s.h"
|
#include "stm32h7xx_hal_i2s.h"
|
||||||
#endif /* HAL_I2S_MODULE_ENABLED */
|
#endif /* HAL_I2S_MODULE_ENABLED */
|
||||||
|
|
||||||
#ifdef HAL_IWDG_MODULE_ENABLED
|
#ifdef HAL_IWDG_MODULE_ENABLED
|
||||||
#include "stm32h7xx_hal_iwdg.h"
|
#include "stm32h7xx_hal_iwdg.h"
|
||||||
#endif /* HAL_IWDG_MODULE_ENABLED */
|
#endif /* HAL_IWDG_MODULE_ENABLED */
|
||||||
|
|
||||||
#ifdef HAL_JPEG_MODULE_ENABLED
|
#ifdef HAL_JPEG_MODULE_ENABLED
|
||||||
#include "stm32h7xx_hal_jpeg.h"
|
#include "stm32h7xx_hal_jpeg.h"
|
||||||
#endif /* HAL_JPEG_MODULE_ENABLED */
|
#endif /* HAL_JPEG_MODULE_ENABLED */
|
||||||
|
|
||||||
#ifdef HAL_MDIOS_MODULE_ENABLED
|
#ifdef HAL_MDIOS_MODULE_ENABLED
|
||||||
#include "stm32h7xx_hal_mdios.h"
|
#include "stm32h7xx_hal_mdios.h"
|
||||||
#endif /* HAL_MDIOS_MODULE_ENABLED */
|
#endif /* HAL_MDIOS_MODULE_ENABLED */
|
||||||
|
|
||||||
|
|
||||||
#ifdef HAL_MMC_MODULE_ENABLED
|
#ifdef HAL_MMC_MODULE_ENABLED
|
||||||
#include "stm32h7xx_hal_mmc.h"
|
#include "stm32h7xx_hal_mmc.h"
|
||||||
#endif /* HAL_MMC_MODULE_ENABLED */
|
#endif /* HAL_MMC_MODULE_ENABLED */
|
||||||
|
|
||||||
#ifdef HAL_LPTIM_MODULE_ENABLED
|
#ifdef HAL_LPTIM_MODULE_ENABLED
|
||||||
@ -319,100 +328,101 @@
|
|||||||
#endif /* HAL_OPAMP_MODULE_ENABLED */
|
#endif /* HAL_OPAMP_MODULE_ENABLED */
|
||||||
|
|
||||||
#ifdef HAL_PWR_MODULE_ENABLED
|
#ifdef HAL_PWR_MODULE_ENABLED
|
||||||
#include "stm32h7xx_hal_pwr.h"
|
#include "stm32h7xx_hal_pwr.h"
|
||||||
#endif /* HAL_PWR_MODULE_ENABLED */
|
#endif /* HAL_PWR_MODULE_ENABLED */
|
||||||
|
|
||||||
#ifdef HAL_QSPI_MODULE_ENABLED
|
#ifdef HAL_QSPI_MODULE_ENABLED
|
||||||
#include "stm32h7xx_hal_qspi.h"
|
#include "stm32h7xx_hal_qspi.h"
|
||||||
#endif /* HAL_QSPI_MODULE_ENABLED */
|
#endif /* HAL_QSPI_MODULE_ENABLED */
|
||||||
|
|
||||||
#ifdef HAL_RAMECC_MODULE_ENABLED
|
#ifdef HAL_RAMECC_MODULE_ENABLED
|
||||||
#include "stm32h7xx_hal_ramecc.h"
|
#include "stm32h7xx_hal_ramecc.h"
|
||||||
#endif /* HAL_HCD_MODULE_ENABLED */
|
#endif /* HAL_HCD_MODULE_ENABLED */
|
||||||
|
|
||||||
#ifdef HAL_RNG_MODULE_ENABLED
|
#ifdef HAL_RNG_MODULE_ENABLED
|
||||||
#include "stm32h7xx_hal_rng.h"
|
#include "stm32h7xx_hal_rng.h"
|
||||||
#endif /* HAL_RNG_MODULE_ENABLED */
|
#endif /* HAL_RNG_MODULE_ENABLED */
|
||||||
|
|
||||||
#ifdef HAL_RTC_MODULE_ENABLED
|
#ifdef HAL_RTC_MODULE_ENABLED
|
||||||
#include "stm32h7xx_hal_rtc.h"
|
#include "stm32h7xx_hal_rtc.h"
|
||||||
#endif /* HAL_RTC_MODULE_ENABLED */
|
#endif /* HAL_RTC_MODULE_ENABLED */
|
||||||
|
|
||||||
#ifdef HAL_SAI_MODULE_ENABLED
|
#ifdef HAL_SAI_MODULE_ENABLED
|
||||||
#include "stm32h7xx_hal_sai.h"
|
#include "stm32h7xx_hal_sai.h"
|
||||||
#endif /* HAL_SAI_MODULE_ENABLED */
|
#endif /* HAL_SAI_MODULE_ENABLED */
|
||||||
|
|
||||||
#ifdef HAL_SD_MODULE_ENABLED
|
#ifdef HAL_SD_MODULE_ENABLED
|
||||||
#include "stm32h7xx_hal_sd.h"
|
#include "stm32h7xx_hal_sd.h"
|
||||||
#endif /* HAL_SD_MODULE_ENABLED */
|
#endif /* HAL_SD_MODULE_ENABLED */
|
||||||
|
|
||||||
#ifdef HAL_SDRAM_MODULE_ENABLED
|
#ifdef HAL_SDRAM_MODULE_ENABLED
|
||||||
#include "stm32h7xx_hal_sdram.h"
|
#include "stm32h7xx_hal_sdram.h"
|
||||||
#endif /* HAL_SDRAM_MODULE_ENABLED */
|
#endif /* HAL_SDRAM_MODULE_ENABLED */
|
||||||
|
|
||||||
#ifdef HAL_SPI_MODULE_ENABLED
|
#ifdef HAL_SPI_MODULE_ENABLED
|
||||||
#include "stm32h7xx_hal_spi.h"
|
#include "stm32h7xx_hal_spi.h"
|
||||||
#endif /* HAL_SPI_MODULE_ENABLED */
|
#endif /* HAL_SPI_MODULE_ENABLED */
|
||||||
|
|
||||||
#ifdef HAL_SPDIFRX_MODULE_ENABLED
|
#ifdef HAL_SPDIFRX_MODULE_ENABLED
|
||||||
#include "stm32h7xx_hal_spdifrx.h"
|
#include "stm32h7xx_hal_spdifrx.h"
|
||||||
#endif /* HAL_SPDIFRX_MODULE_ENABLED */
|
#endif /* HAL_SPDIFRX_MODULE_ENABLED */
|
||||||
|
|
||||||
#ifdef HAL_SWPMI_MODULE_ENABLED
|
#ifdef HAL_SWPMI_MODULE_ENABLED
|
||||||
#include "stm32h7xx_hal_swpmi.h"
|
#include "stm32h7xx_hal_swpmi.h"
|
||||||
#endif /* HAL_SWPMI_MODULE_ENABLED */
|
#endif /* HAL_SWPMI_MODULE_ENABLED */
|
||||||
|
|
||||||
#ifdef HAL_TIM_MODULE_ENABLED
|
#ifdef HAL_TIM_MODULE_ENABLED
|
||||||
#include "stm32h7xx_hal_tim.h"
|
#include "stm32h7xx_hal_tim.h"
|
||||||
#endif /* HAL_TIM_MODULE_ENABLED */
|
#endif /* HAL_TIM_MODULE_ENABLED */
|
||||||
|
|
||||||
#ifdef HAL_UART_MODULE_ENABLED
|
#ifdef HAL_UART_MODULE_ENABLED
|
||||||
#include "stm32h7xx_hal_uart.h"
|
#include "stm32h7xx_hal_uart.h"
|
||||||
#endif /* HAL_UART_MODULE_ENABLED */
|
#endif /* HAL_UART_MODULE_ENABLED */
|
||||||
|
|
||||||
#ifdef HAL_USART_MODULE_ENABLED
|
#ifdef HAL_USART_MODULE_ENABLED
|
||||||
#include "stm32h7xx_hal_usart.h"
|
#include "stm32h7xx_hal_usart.h"
|
||||||
#endif /* HAL_USART_MODULE_ENABLED */
|
#endif /* HAL_USART_MODULE_ENABLED */
|
||||||
|
|
||||||
#ifdef HAL_IRDA_MODULE_ENABLED
|
#ifdef HAL_IRDA_MODULE_ENABLED
|
||||||
#include "stm32h7xx_hal_irda.h"
|
#include "stm32h7xx_hal_irda.h"
|
||||||
#endif /* HAL_IRDA_MODULE_ENABLED */
|
#endif /* HAL_IRDA_MODULE_ENABLED */
|
||||||
|
|
||||||
#ifdef HAL_SMARTCARD_MODULE_ENABLED
|
#ifdef HAL_SMARTCARD_MODULE_ENABLED
|
||||||
#include "stm32h7xx_hal_smartcard.h"
|
#include "stm32h7xx_hal_smartcard.h"
|
||||||
#endif /* HAL_SMARTCARD_MODULE_ENABLED */
|
#endif /* HAL_SMARTCARD_MODULE_ENABLED */
|
||||||
|
|
||||||
#ifdef HAL_SMBUS_MODULE_ENABLED
|
#ifdef HAL_SMBUS_MODULE_ENABLED
|
||||||
#include "stm32h7xx_hal_smbus.h"
|
#include "stm32h7xx_hal_smbus.h"
|
||||||
#endif /* HAL_SMBUS_MODULE_ENABLED */
|
#endif /* HAL_SMBUS_MODULE_ENABLED */
|
||||||
|
|
||||||
#ifdef HAL_WWDG_MODULE_ENABLED
|
#ifdef HAL_WWDG_MODULE_ENABLED
|
||||||
#include "stm32h7xx_hal_wwdg.h"
|
#include "stm32h7xx_hal_wwdg.h"
|
||||||
#endif /* HAL_WWDG_MODULE_ENABLED */
|
#endif /* HAL_WWDG_MODULE_ENABLED */
|
||||||
|
|
||||||
#ifdef HAL_PCD_MODULE_ENABLED
|
#ifdef HAL_PCD_MODULE_ENABLED
|
||||||
#include "stm32h7xx_hal_pcd.h"
|
#include "stm32h7xx_hal_pcd.h"
|
||||||
#endif /* HAL_PCD_MODULE_ENABLED */
|
#endif /* HAL_PCD_MODULE_ENABLED */
|
||||||
|
|
||||||
#ifdef HAL_HCD_MODULE_ENABLED
|
#ifdef HAL_HCD_MODULE_ENABLED
|
||||||
#include "stm32h7xx_hal_hcd.h"
|
#include "stm32h7xx_hal_hcd.h"
|
||||||
#endif /* HAL_HCD_MODULE_ENABLED */
|
#endif /* HAL_HCD_MODULE_ENABLED */
|
||||||
|
|
||||||
/* Exported macro ------------------------------------------------------------*/
|
/* Exported macro ------------------------------------------------------------*/
|
||||||
#ifdef USE_FULL_ASSERT
|
#ifdef USE_FULL_ASSERT
|
||||||
/**
|
/**
|
||||||
* @brief The assert_param macro is used for function's parameters check.
|
* @brief The assert_param macro is used for function's parameters check.
|
||||||
* @param expr: If expr is false, it calls assert_failed function
|
* @param expr: If expr is false, it calls assert_failed function
|
||||||
* which reports the name of the source file and the source
|
* which reports the name of the source file and the source
|
||||||
* line number of the call that failed.
|
* line number of the call that failed.
|
||||||
* If expr is true, it returns no value.
|
* If expr is true, it returns no value.
|
||||||
* @retval None
|
* @retval None
|
||||||
*/
|
*/
|
||||||
#define assert_param(expr) ((expr) ? (void)0U : assert_failed((uint8_t *)__FILE__, __LINE__))
|
#define assert_param(expr) \
|
||||||
|
((expr) ? (void)0U : assert_failed((uint8_t *)__FILE__, __LINE__))
|
||||||
/* Exported functions ------------------------------------------------------- */
|
/* Exported functions ------------------------------------------------------- */
|
||||||
void assert_failed(uint8_t* file, uint32_t line);
|
void assert_failed(uint8_t *file, uint32_t line);
|
||||||
#else
|
#else
|
||||||
#define assert_param(expr) ((void)0U)
|
#define assert_param(expr) ((void)0U)
|
||||||
#endif /* USE_FULL_ASSERT */
|
#endif /* USE_FULL_ASSERT */
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
@ -421,5 +431,4 @@
|
|||||||
|
|
||||||
#endif /* __STM32H7xx_HAL_CONF_H */
|
#endif /* __STM32H7xx_HAL_CONF_H */
|
||||||
|
|
||||||
|
|
||||||
/************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/
|
/************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/
|
||||||
|
@ -1,28 +1,28 @@
|
|||||||
/**
|
/**
|
||||||
******************************************************************************
|
******************************************************************************
|
||||||
* @file Templates/Inc/stm32h7xx_it.h
|
* @file Templates/Inc/stm32h7xx_it.h
|
||||||
* @author MCD Application Team
|
* @author MCD Application Team
|
||||||
* @brief This file contains the headers of the interrupt handlers.
|
* @brief This file contains the headers of the interrupt handlers.
|
||||||
******************************************************************************
|
******************************************************************************
|
||||||
* @attention
|
* @attention
|
||||||
*
|
*
|
||||||
* <h2><center>© Copyright (c) 2017 STMicroelectronics.
|
* <h2><center>© Copyright (c) 2017 STMicroelectronics.
|
||||||
* All rights reserved.</center></h2>
|
* All rights reserved.</center></h2>
|
||||||
*
|
*
|
||||||
* This software component is licensed by ST under BSD 3-Clause license,
|
* This software component is licensed by ST under BSD 3-Clause license,
|
||||||
* the "License"; You may not use this file except in compliance with the
|
* the "License"; You may not use this file except in compliance with the
|
||||||
* License. You may obtain a copy of the License at:
|
* License. You may obtain a copy of the License at:
|
||||||
* opensource.org/licenses/BSD-3-Clause
|
* opensource.org/licenses/BSD-3-Clause
|
||||||
*
|
*
|
||||||
******************************************************************************
|
******************************************************************************
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/* Define to prevent recursive inclusion -------------------------------------*/
|
/* Define to prevent recursive inclusion -------------------------------------*/
|
||||||
#ifndef __STM32H7xx_IT_H
|
#ifndef __STM32H7xx_IT_H
|
||||||
#define __STM32H7xx_IT_H
|
#define __STM32H7xx_IT_H
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
extern "C" {
|
extern "C" {
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/* Includes ------------------------------------------------------------------*/
|
/* Includes ------------------------------------------------------------------*/
|
||||||
|
@ -1,30 +1,34 @@
|
|||||||
/**
|
/**
|
||||||
******************************************************************************
|
******************************************************************************
|
||||||
* @file stm32h7xx_nucleo.h
|
* @file stm32h7xx_nucleo.h
|
||||||
* @author MCD Application Team
|
* @author MCD Application Team
|
||||||
* @brief This file contains definitions for:
|
* @brief This file contains definitions for:
|
||||||
* - LEDs and push-button available on STM32H7xx-Nucleo Kit
|
* - LEDs and push-button available on STM32H7xx-Nucleo Kit
|
||||||
* from STMicroelectronics
|
* from STMicroelectronics
|
||||||
******************************************************************************
|
******************************************************************************
|
||||||
* @attention
|
* @attention
|
||||||
*
|
*
|
||||||
* <h2><center>© Copyright (c) 2019 STMicroelectronics.
|
* <h2><center>© Copyright (c) 2019 STMicroelectronics.
|
||||||
* All rights reserved.</center></h2>
|
* All rights reserved.</center></h2>
|
||||||
*
|
*
|
||||||
* This software component is licensed by ST under BSD 3-Clause license,
|
* This software component is licensed by ST under BSD 3-Clause license,
|
||||||
* the "License"; You may not use this file except in compliance with the
|
* the "License"; You may not use this file except in compliance with the
|
||||||
* License. You may obtain a copy of the License at:
|
* License. You may obtain a copy of the License at:
|
||||||
* opensource.org/licenses/BSD-3-Clause
|
* opensource.org/licenses/BSD-3-Clause
|
||||||
*
|
*
|
||||||
******************************************************************************
|
******************************************************************************
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
#ifndef USE_HAL_UART_REGISTER_CALLBACKS
|
||||||
|
#define USE_HAL_UART_REGISTER_CALLBACKS 1
|
||||||
|
#endif
|
||||||
|
|
||||||
/* Define to prevent recursive inclusion -------------------------------------*/
|
/* Define to prevent recursive inclusion -------------------------------------*/
|
||||||
#ifndef STM32H7XX_NUCLEO_H
|
#ifndef STM32H7XX_NUCLEO_H
|
||||||
#define STM32H7XX_NUCLEO_H
|
#define STM32H7XX_NUCLEO_H
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
extern "C" {
|
extern "C" {
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/* Includes ------------------------------------------------------------------*/
|
/* Includes ------------------------------------------------------------------*/
|
||||||
@ -32,48 +36,51 @@
|
|||||||
#include "stm32h7xx_nucleo_errno.h"
|
#include "stm32h7xx_nucleo_errno.h"
|
||||||
|
|
||||||
#if (USE_BSP_COM_FEATURE > 0)
|
#if (USE_BSP_COM_FEATURE > 0)
|
||||||
#if (USE_COM_LOG > 0)
|
#if (USE_COM_LOG > 0)
|
||||||
#ifndef __GNUC__
|
#ifndef __GNUC__
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#endif
|
#endif
|
||||||
#endif
|
#endif
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/** @addtogroup BSP
|
/** @addtogroup BSP
|
||||||
* @{
|
* @{
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/** @defgroup STM32H7XX_NUCLEO STM32H7XX_NUCLEO
|
/** @defgroup STM32H7XX_NUCLEO STM32H7XX_NUCLEO
|
||||||
* @{
|
* @{
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/** @defgroup STM32H7XX_NUCLEO_LOW_LEVEL LOW LEVEL
|
/** @defgroup STM32H7XX_NUCLEO_LOW_LEVEL LOW LEVEL
|
||||||
* @{
|
* @{
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Define for STM32H7XX_NUCLEO board
|
* @brief Define for STM32H7XX_NUCLEO board
|
||||||
*/
|
*/
|
||||||
#if !defined (USE_STM32H7XX_NUCLEO)
|
#if !defined(USE_STM32H7XX_NUCLEO)
|
||||||
#define USE_STM32H7XX_NUCLEO
|
#define USE_STM32H7XX_NUCLEO
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if !defined (USE_NUCLEO_144)
|
#if !defined(USE_NUCLEO_144)
|
||||||
#error "Board Pin number not defined!! Add USE_NUCLEO_144 define within stm32h7xx_nucleo_conf.h file"
|
#error \
|
||||||
|
"Board Pin number not defined!! Add USE_NUCLEO_144 define within stm32h7xx_nucleo_conf.h file"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if !defined (USE_NUCLEO_H745ZI_Q) && !defined (USE_NUCLEO_H743ZI) && !defined (USE_NUCLEO_H743ZI2) &&\
|
#if !defined(USE_NUCLEO_H745ZI_Q) && !defined(USE_NUCLEO_H743ZI) && \
|
||||||
!defined (USE_NUCLEO_H7A3ZI_Q) && !defined (USE_NUCLEO_H723ZG)
|
!defined(USE_NUCLEO_H743ZI2) && !defined(USE_NUCLEO_H7A3ZI_Q) && \
|
||||||
#error "Board Part number not defined!! Add one of the following define within stm32h7xx_nucleo_conf.h file:\
|
!defined(USE_NUCLEO_H723ZG)
|
||||||
|
#error \
|
||||||
|
"Board Part number not defined!! Add one of the following define within stm32h7xx_nucleo_conf.h file:\
|
||||||
USE_NUCLEO_H745ZI_Q, USE_NUCLEO_H743ZI, USE_NUCLEO_H743ZI2, USE_NUCLEO_H7A3ZI_Q, USE_NUCLEO_H723ZG"
|
USE_NUCLEO_H745ZI_Q, USE_NUCLEO_H743ZI, USE_NUCLEO_H743ZI2, USE_NUCLEO_H7A3ZI_Q, USE_NUCLEO_H723ZG"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/** @defgroup STM32H7XX_NUCLEO_LOW_LEVEL_Exported_Types LOW LEVEL Exported Types
|
/** @defgroup STM32H7XX_NUCLEO_LOW_LEVEL_Exported_Types LOW LEVEL Exported Types
|
||||||
* @{
|
* @{
|
||||||
*/
|
*/
|
||||||
#if defined (USE_NUCLEO_H745ZI_Q) || defined (USE_NUCLEO_H743ZI2) || defined (USE_NUCLEO_H7A3ZI_Q) || defined (USE_NUCLEO_H723ZG)
|
#if defined(USE_NUCLEO_H745ZI_Q) || defined(USE_NUCLEO_H743ZI2) || \
|
||||||
typedef enum
|
defined(USE_NUCLEO_H7A3ZI_Q) || defined(USE_NUCLEO_H723ZG)
|
||||||
{
|
typedef enum {
|
||||||
LED1 = 0,
|
LED1 = 0,
|
||||||
LED_GREEN = LED1,
|
LED_GREEN = LED1,
|
||||||
LED2 = 1,
|
LED2 = 1,
|
||||||
@ -81,10 +88,9 @@ typedef enum
|
|||||||
LED3 = 2,
|
LED3 = 2,
|
||||||
LED_RED = LED3,
|
LED_RED = LED3,
|
||||||
LEDn
|
LEDn
|
||||||
}Led_TypeDef;
|
} Led_TypeDef;
|
||||||
#else /* USE_NUCLEO_H743ZI */
|
#else /* USE_NUCLEO_H743ZI */
|
||||||
typedef enum
|
typedef enum {
|
||||||
{
|
|
||||||
LED1 = 0,
|
LED1 = 0,
|
||||||
LED_GREEN = LED1,
|
LED_GREEN = LED1,
|
||||||
LED2 = 1,
|
LED2 = 1,
|
||||||
@ -92,242 +98,230 @@ typedef enum
|
|||||||
LED3 = 2,
|
LED3 = 2,
|
||||||
LED_RED = LED3,
|
LED_RED = LED3,
|
||||||
LEDn
|
LEDn
|
||||||
}Led_TypeDef;
|
} Led_TypeDef;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
typedef enum
|
typedef enum { BUTTON_USER = 0U, BUTTONn } Button_TypeDef;
|
||||||
{
|
|
||||||
BUTTON_USER = 0U,
|
|
||||||
BUTTONn
|
|
||||||
}Button_TypeDef;
|
|
||||||
|
|
||||||
typedef enum
|
typedef enum { BUTTON_MODE_GPIO = 0, BUTTON_MODE_EXTI = 1 } ButtonMode_TypeDef;
|
||||||
{
|
|
||||||
BUTTON_MODE_GPIO = 0,
|
|
||||||
BUTTON_MODE_EXTI = 1
|
|
||||||
}ButtonMode_TypeDef;
|
|
||||||
|
|
||||||
#if (USE_BSP_COM_FEATURE > 0)
|
#if (USE_BSP_COM_FEATURE > 0)
|
||||||
typedef enum
|
typedef enum { COM1 = 0U, COMn } COM_TypeDef;
|
||||||
{
|
|
||||||
COM1 = 0U,
|
|
||||||
COMn
|
|
||||||
}COM_TypeDef;
|
|
||||||
|
|
||||||
typedef enum
|
typedef enum {
|
||||||
{
|
COM_STOPBITS_1 = UART_STOPBITS_1,
|
||||||
COM_STOPBITS_1 = UART_STOPBITS_1,
|
COM_STOPBITS_2 = UART_STOPBITS_2,
|
||||||
COM_STOPBITS_2 = UART_STOPBITS_2,
|
} COM_StopBitsTypeDef;
|
||||||
}COM_StopBitsTypeDef;
|
|
||||||
|
|
||||||
typedef enum
|
typedef enum {
|
||||||
{
|
COM_PARITY_NONE = UART_PARITY_NONE,
|
||||||
COM_PARITY_NONE = UART_PARITY_NONE,
|
COM_PARITY_EVEN = UART_PARITY_EVEN,
|
||||||
COM_PARITY_EVEN = UART_PARITY_EVEN,
|
COM_PARITY_ODD = UART_PARITY_ODD,
|
||||||
COM_PARITY_ODD = UART_PARITY_ODD,
|
} COM_ParityTypeDef;
|
||||||
}COM_ParityTypeDef;
|
|
||||||
|
|
||||||
typedef enum
|
typedef enum {
|
||||||
{
|
COM_HWCONTROL_NONE = UART_HWCONTROL_NONE,
|
||||||
COM_HWCONTROL_NONE = UART_HWCONTROL_NONE,
|
COM_HWCONTROL_RTS = UART_HWCONTROL_RTS,
|
||||||
COM_HWCONTROL_RTS = UART_HWCONTROL_RTS,
|
COM_HWCONTROL_CTS = UART_HWCONTROL_CTS,
|
||||||
COM_HWCONTROL_CTS = UART_HWCONTROL_CTS,
|
COM_HWCONTROL_RTS_CTS = UART_HWCONTROL_RTS_CTS,
|
||||||
COM_HWCONTROL_RTS_CTS = UART_HWCONTROL_RTS_CTS,
|
} COM_HwFlowCtlTypeDef;
|
||||||
}COM_HwFlowCtlTypeDef;
|
|
||||||
|
|
||||||
typedef enum
|
typedef enum {
|
||||||
{
|
|
||||||
COM_WORDLENGTH_7B = UART_WORDLENGTH_7B,
|
COM_WORDLENGTH_7B = UART_WORDLENGTH_7B,
|
||||||
COM_WORDLENGTH_8B = UART_WORDLENGTH_8B,
|
COM_WORDLENGTH_8B = UART_WORDLENGTH_8B,
|
||||||
COM_WORDLENGTH_9B = UART_WORDLENGTH_9B,
|
COM_WORDLENGTH_9B = UART_WORDLENGTH_9B,
|
||||||
}COM_WordLengthTypeDef;
|
} COM_WordLengthTypeDef;
|
||||||
|
|
||||||
typedef struct
|
typedef struct {
|
||||||
{
|
uint32_t BaudRate;
|
||||||
uint32_t BaudRate;
|
COM_WordLengthTypeDef WordLength;
|
||||||
COM_WordLengthTypeDef WordLength;
|
COM_StopBitsTypeDef StopBits;
|
||||||
COM_StopBitsTypeDef StopBits;
|
COM_ParityTypeDef Parity;
|
||||||
COM_ParityTypeDef Parity;
|
COM_HwFlowCtlTypeDef HwFlowCtl;
|
||||||
COM_HwFlowCtlTypeDef HwFlowCtl;
|
} COM_InitTypeDef;
|
||||||
}COM_InitTypeDef;
|
|
||||||
|
|
||||||
#if (USE_HAL_UART_REGISTER_CALLBACKS == 1)
|
#if (USE_HAL_UART_REGISTER_CALLBACKS == 1)
|
||||||
typedef struct
|
typedef struct {
|
||||||
{
|
void (*pMspInitCb)(UART_HandleTypeDef *);
|
||||||
void (* pMspInitCb)(UART_HandleTypeDef *);
|
void (*pMspDeInitCb)(UART_HandleTypeDef *);
|
||||||
void (* pMspDeInitCb)(UART_HandleTypeDef *);
|
} BSP_COM_Cb_t;
|
||||||
}BSP_COM_Cb_t;
|
|
||||||
#endif /* (USE_HAL_UART_REGISTER_CALLBACKS == 1) */
|
#endif /* (USE_HAL_UART_REGISTER_CALLBACKS == 1) */
|
||||||
|
|
||||||
#define MX_UART_InitTypeDef COM_InitTypeDef
|
#define MX_UART_InitTypeDef COM_InitTypeDef
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @}
|
* @}
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/** @defgroup STM32H7XX_NUCLEO_LOW_LEVEL_Exported_Constants LOW LEVEL Exported Constants
|
/** @defgroup STM32H7XX_NUCLEO_LOW_LEVEL_Exported_Constants LOW LEVEL Exported
|
||||||
* @{
|
* Constants
|
||||||
*/
|
* @{
|
||||||
|
*/
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief STM32H7XX NUCLEO BSP Driver version number V1.3.0
|
* @brief STM32H7XX NUCLEO BSP Driver version number V1.3.0
|
||||||
*/
|
*/
|
||||||
#define STM32H7XX_NUCLEO_BSP_VERSION_MAIN (0x01U) /*!< [31:24] main version */
|
#define STM32H7XX_NUCLEO_BSP_VERSION_MAIN (0x01U) /*!< [31:24] main version */
|
||||||
#define STM32H7XX_NUCLEO_BSP_VERSION_SUB1 (0x03U) /*!< [23:16] sub1 version */
|
#define STM32H7XX_NUCLEO_BSP_VERSION_SUB1 (0x03U) /*!< [23:16] sub1 version */
|
||||||
#define STM32H7XX_NUCLEO_BSP_VERSION_SUB2 (0x00U) /*!< [15:8] sub2 version */
|
#define STM32H7XX_NUCLEO_BSP_VERSION_SUB2 (0x00U) /*!< [15:8] sub2 version */
|
||||||
#define STM32H7XX_NUCLEO_BSP_VERSION_RC (0x00U) /*!< [7:0] release candidate */
|
#define STM32H7XX_NUCLEO_BSP_VERSION_RC (0x00U) /*!< [7:0] release candidate \
|
||||||
#define STM32H7XX_NUCLEO_BSP_VERSION ((STM32H7XX_NUCLEO_BSP_VERSION_MAIN << 24)\
|
*/
|
||||||
|(STM32H7XX_NUCLEO_BSP_VERSION_SUB1 << 16)\
|
#define STM32H7XX_NUCLEO_BSP_VERSION \
|
||||||
|(STM32H7XX_NUCLEO_BSP_VERSION_SUB2 << 8 )\
|
((STM32H7XX_NUCLEO_BSP_VERSION_MAIN << 24) | \
|
||||||
|(STM32H7XX_NUCLEO_BSP_VERSION_RC))
|
(STM32H7XX_NUCLEO_BSP_VERSION_SUB1 << 16) | \
|
||||||
|
(STM32H7XX_NUCLEO_BSP_VERSION_SUB2 << 8) | \
|
||||||
|
(STM32H7XX_NUCLEO_BSP_VERSION_RC))
|
||||||
|
|
||||||
/** @defgroup STM32H7XX_NUCLEO_LOW_LEVEL_LED LOW LEVEL LED
|
/** @defgroup STM32H7XX_NUCLEO_LOW_LEVEL_LED LOW LEVEL LED
|
||||||
* @{
|
* @{
|
||||||
*/
|
*/
|
||||||
#define LEDn 3U
|
#define LEDn 3U
|
||||||
|
|
||||||
#define LED1_PIN GPIO_PIN_0
|
#define LED1_PIN GPIO_PIN_0
|
||||||
#define LED1_GPIO_PORT GPIOB
|
#define LED1_GPIO_PORT GPIOB
|
||||||
#define LED1_GPIO_CLK_ENABLE() __HAL_RCC_GPIOB_CLK_ENABLE()
|
#define LED1_GPIO_CLK_ENABLE() __HAL_RCC_GPIOB_CLK_ENABLE()
|
||||||
#define LED1_GPIO_CLK_DISABLE() __HAL_RCC_GPIOB_CLK_DISABLE()
|
#define LED1_GPIO_CLK_DISABLE() __HAL_RCC_GPIOB_CLK_DISABLE()
|
||||||
|
|
||||||
#if defined (USE_NUCLEO_H745ZI_Q) || defined (USE_NUCLEO_H743ZI2) || defined (USE_NUCLEO_H7A3ZI_Q) || defined (USE_NUCLEO_H723ZG)
|
#if defined(USE_NUCLEO_H745ZI_Q) || defined(USE_NUCLEO_H743ZI2) || \
|
||||||
#define LED2_PIN GPIO_PIN_1
|
defined(USE_NUCLEO_H7A3ZI_Q) || defined(USE_NUCLEO_H723ZG)
|
||||||
#define LED2_GPIO_PORT GPIOE
|
#define LED2_PIN GPIO_PIN_1
|
||||||
#define LED2_GPIO_CLK_ENABLE() __HAL_RCC_GPIOE_CLK_ENABLE()
|
#define LED2_GPIO_PORT GPIOE
|
||||||
#define LED2_GPIO_CLK_DISABLE() __HAL_RCC_GPIOE_CLK_DISABLE()
|
#define LED2_GPIO_CLK_ENABLE() __HAL_RCC_GPIOE_CLK_ENABLE()
|
||||||
|
#define LED2_GPIO_CLK_DISABLE() __HAL_RCC_GPIOE_CLK_DISABLE()
|
||||||
#else /* USE_NUCLEO_H743ZI */
|
#else /* USE_NUCLEO_H743ZI */
|
||||||
#define LED2_PIN GPIO_PIN_7
|
#define LED2_PIN GPIO_PIN_7
|
||||||
#define LED2_GPIO_PORT GPIOB
|
#define LED2_GPIO_PORT GPIOB
|
||||||
#define LED2_GPIO_CLK_ENABLE() __HAL_RCC_GPIOB_CLK_ENABLE()
|
#define LED2_GPIO_CLK_ENABLE() __HAL_RCC_GPIOB_CLK_ENABLE()
|
||||||
#define LED2_GPIO_CLK_DISABLE() __HAL_RCC_GPIOB_CLK_DISABLE()
|
#define LED2_GPIO_CLK_DISABLE() __HAL_RCC_GPIOB_CLK_DISABLE()
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#define LED3_PIN GPIO_PIN_14
|
#define LED3_PIN GPIO_PIN_14
|
||||||
#define LED3_GPIO_PORT GPIOB
|
#define LED3_GPIO_PORT GPIOB
|
||||||
#define LED3_GPIO_CLK_ENABLE() __HAL_RCC_GPIOB_CLK_ENABLE()
|
#define LED3_GPIO_CLK_ENABLE() __HAL_RCC_GPIOB_CLK_ENABLE()
|
||||||
#define LED3_GPIO_CLK_DISABLE() __HAL_RCC_GPIOB_CLK_DISABLE()
|
#define LED3_GPIO_CLK_DISABLE() __HAL_RCC_GPIOB_CLK_DISABLE()
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @}
|
* @}
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/** @defgroup STM32H7XX_NUCLEO_LOW_LEVEL_BUTTON LOW LEVEL BUTTON
|
/** @defgroup STM32H7XX_NUCLEO_LOW_LEVEL_BUTTON LOW LEVEL BUTTON
|
||||||
* @{
|
* @{
|
||||||
*/
|
*/
|
||||||
/* Button state */
|
/* Button state */
|
||||||
#define BUTTON_RELEASED 0U
|
#define BUTTON_RELEASED 0U
|
||||||
#define BUTTON_PRESSED 1U
|
#define BUTTON_PRESSED 1U
|
||||||
#define BUTTONn 1U
|
#define BUTTONn 1U
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Key push-button
|
* @brief Key push-button
|
||||||
*/
|
*/
|
||||||
#define BUTTON_USER_PIN GPIO_PIN_13
|
#define BUTTON_USER_PIN GPIO_PIN_13
|
||||||
#define BUTTON_USER_GPIO_PORT GPIOC
|
#define BUTTON_USER_GPIO_PORT GPIOC
|
||||||
#define BUTTON_USER_GPIO_CLK_ENABLE() __HAL_RCC_GPIOC_CLK_ENABLE()
|
#define BUTTON_USER_GPIO_CLK_ENABLE() __HAL_RCC_GPIOC_CLK_ENABLE()
|
||||||
#define BUTTON_USER_GPIO_CLK_DISABLE() __HAL_RCC_GPIOC_CLK_DISABLE()
|
#define BUTTON_USER_GPIO_CLK_DISABLE() __HAL_RCC_GPIOC_CLK_DISABLE()
|
||||||
#define BUTTON_USER_EXTI_IRQn EXTI15_10_IRQn
|
#define BUTTON_USER_EXTI_IRQn EXTI15_10_IRQn
|
||||||
#define BUTTON_USER_EXTI_LINE EXTI_LINE_13
|
#define BUTTON_USER_EXTI_LINE EXTI_LINE_13
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @}
|
* @}
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/** @defgroup STM32H7XX_NUCLEO_LOW_LEVEL_COM LOW LEVEL COM
|
/** @defgroup STM32H7XX_NUCLEO_LOW_LEVEL_COM LOW LEVEL COM
|
||||||
* @{
|
* @{
|
||||||
*/
|
*/
|
||||||
/**
|
/**
|
||||||
* @brief Definition for COM port1, connected to USART3
|
* @brief Definition for COM port1, connected to USART3
|
||||||
*/
|
*/
|
||||||
#if (USE_BSP_COM_FEATURE > 0)
|
#if (USE_BSP_COM_FEATURE > 0)
|
||||||
|
|
||||||
#define COMn 1U
|
#define COMn 1U
|
||||||
#define COM1_UART USART3
|
#define COM1_UART USART3
|
||||||
#define COM1_CLK_ENABLE() __HAL_RCC_USART3_CLK_ENABLE()
|
#define COM1_CLK_ENABLE() __HAL_RCC_USART3_CLK_ENABLE()
|
||||||
#define COM1_CLK_DISABLE() __HAL_RCC_USART3_CLK_DISABLE()
|
#define COM1_CLK_DISABLE() __HAL_RCC_USART3_CLK_DISABLE()
|
||||||
|
|
||||||
#define COM1_TX_PIN GPIO_PIN_8
|
#define COM1_TX_PIN GPIO_PIN_8
|
||||||
#define COM1_TX_GPIO_PORT GPIOD
|
#define COM1_TX_GPIO_PORT GPIOD
|
||||||
#define COM1_TX_GPIO_CLK_ENABLE() __HAL_RCC_GPIOD_CLK_ENABLE()
|
#define COM1_TX_GPIO_CLK_ENABLE() __HAL_RCC_GPIOD_CLK_ENABLE()
|
||||||
#define COM1_TX_GPIO_CLK_DISABLE() __HAL_RCC_GPIOD_CLK_DISABLE()
|
#define COM1_TX_GPIO_CLK_DISABLE() __HAL_RCC_GPIOD_CLK_DISABLE()
|
||||||
#define COM1_TX_AF GPIO_AF7_USART3
|
#define COM1_TX_AF GPIO_AF7_USART3
|
||||||
|
|
||||||
#define COM1_RX_PIN GPIO_PIN_9
|
#define COM1_RX_PIN GPIO_PIN_9
|
||||||
#define COM1_RX_GPIO_PORT GPIOD
|
#define COM1_RX_GPIO_PORT GPIOD
|
||||||
#define COM1_RX_GPIO_CLK_ENABLE() __HAL_RCC_GPIOD_CLK_ENABLE()
|
#define COM1_RX_GPIO_CLK_ENABLE() __HAL_RCC_GPIOD_CLK_ENABLE()
|
||||||
#define COM1_RX_GPIO_CLK_DISABLE() __HAL_RCC_GPIOD_CLK_DISABLE()
|
#define COM1_RX_GPIO_CLK_DISABLE() __HAL_RCC_GPIOD_CLK_DISABLE()
|
||||||
#define COM1_RX_AF GPIO_AF7_USART3
|
#define COM1_RX_AF GPIO_AF7_USART3
|
||||||
#define COM_POLL_TIMEOUT 1000
|
#define COM_POLL_TIMEOUT 1000
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @}
|
* @}
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @}
|
* @}
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/** @addtogroup STM32H7XX_NUCLEO_LOW_LEVEL_Exported_Variables
|
/** @addtogroup STM32H7XX_NUCLEO_LOW_LEVEL_Exported_Variables
|
||||||
* @{
|
* @{
|
||||||
*/
|
*/
|
||||||
extern EXTI_HandleTypeDef hpb_exti[];
|
extern EXTI_HandleTypeDef hpb_exti[];
|
||||||
#if (USE_BSP_COM_FEATURE > 0)
|
#if (USE_BSP_COM_FEATURE > 0)
|
||||||
extern UART_HandleTypeDef hcom_uart[];
|
extern UART_HandleTypeDef hcom_uart[];
|
||||||
extern USART_TypeDef* COM_USART[];
|
extern USART_TypeDef *COM_USART[];
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @}
|
* @}
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/** @defgroup STM32H7XX_NUCLEO_LOW_LEVEL_Exported_FunctionsPrototypes LOW LEVEL Exported Functions Prototypes
|
/** @defgroup STM32H7XX_NUCLEO_LOW_LEVEL_Exported_FunctionsPrototypes LOW LEVEL
|
||||||
* @{
|
* Exported Functions Prototypes
|
||||||
*/
|
* @{
|
||||||
int32_t BSP_GetVersion(void);
|
*/
|
||||||
int32_t BSP_LED_Init(Led_TypeDef Led);
|
int32_t BSP_GetVersion(void);
|
||||||
int32_t BSP_LED_DeInit(Led_TypeDef Led);
|
int32_t BSP_LED_Init(Led_TypeDef Led);
|
||||||
int32_t BSP_LED_On(Led_TypeDef Led);
|
int32_t BSP_LED_DeInit(Led_TypeDef Led);
|
||||||
int32_t BSP_LED_Off(Led_TypeDef Led);
|
int32_t BSP_LED_On(Led_TypeDef Led);
|
||||||
int32_t BSP_LED_Toggle(Led_TypeDef Led);
|
int32_t BSP_LED_Off(Led_TypeDef Led);
|
||||||
int32_t BSP_LED_GetState (Led_TypeDef Led);
|
int32_t BSP_LED_Toggle(Led_TypeDef Led);
|
||||||
int32_t BSP_PB_Init(Button_TypeDef Button, ButtonMode_TypeDef ButtonMode);
|
int32_t BSP_LED_GetState(Led_TypeDef Led);
|
||||||
int32_t BSP_PB_DeInit(Button_TypeDef Button);
|
int32_t BSP_PB_Init(Button_TypeDef Button, ButtonMode_TypeDef ButtonMode);
|
||||||
int32_t BSP_PB_GetState(Button_TypeDef Button);
|
int32_t BSP_PB_DeInit(Button_TypeDef Button);
|
||||||
void BSP_PB_IRQHandler(Button_TypeDef Button);
|
int32_t BSP_PB_GetState(Button_TypeDef Button);
|
||||||
void BSP_PB_Callback(Button_TypeDef Button);
|
void BSP_PB_IRQHandler(Button_TypeDef Button);
|
||||||
|
void BSP_PB_Callback(Button_TypeDef Button);
|
||||||
|
|
||||||
#if (USE_BSP_COM_FEATURE > 0)
|
#if (USE_BSP_COM_FEATURE > 0)
|
||||||
int32_t BSP_COM_Init(COM_TypeDef COM, COM_InitTypeDef *COM_Init);
|
int32_t BSP_COM_Init(COM_TypeDef COM, COM_InitTypeDef *COM_Init);
|
||||||
int32_t BSP_COM_DeInit(COM_TypeDef COM);
|
int32_t BSP_COM_DeInit(COM_TypeDef COM);
|
||||||
#if (USE_COM_LOG > 0)
|
#if (USE_COM_LOG > 0)
|
||||||
int32_t BSP_COM_SelectLogPort (COM_TypeDef COM);
|
int32_t BSP_COM_SelectLogPort(COM_TypeDef COM);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if (USE_HAL_UART_REGISTER_CALLBACKS == 1)
|
#if (USE_HAL_UART_REGISTER_CALLBACKS == 1)
|
||||||
int32_t BSP_COM_RegisterDefaultMspCallbacks(COM_TypeDef COM);
|
int32_t BSP_COM_RegisterDefaultMspCallbacks(COM_TypeDef COM);
|
||||||
int32_t BSP_COM_RegisterMspCallbacks(COM_TypeDef COM , BSP_COM_Cb_t *Callback);
|
int32_t BSP_COM_RegisterMspCallbacks(COM_TypeDef COM, BSP_COM_Cb_t *Callback);
|
||||||
#endif /* USE_HAL_UART_REGISTER_CALLBACKS */
|
#endif /* USE_HAL_UART_REGISTER_CALLBACKS */
|
||||||
HAL_StatusTypeDef MX_USART3_Init(UART_HandleTypeDef *huart, MX_UART_InitTypeDef *COM_Init);
|
HAL_StatusTypeDef MX_USART3_Init(UART_HandleTypeDef *huart,
|
||||||
|
MX_UART_InitTypeDef *COM_Init);
|
||||||
#endif /* USE_BSP_COM_FEATURE */
|
#endif /* USE_BSP_COM_FEATURE */
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @}
|
* @}
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @}
|
* @}
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @}
|
* @}
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @}
|
* @}
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
}
|
}
|
||||||
|
@ -1,77 +1,77 @@
|
|||||||
/**
|
/**
|
||||||
******************************************************************************
|
******************************************************************************
|
||||||
* @file stm32h7xx_nucleo_conf.h
|
* @file stm32h7xx_nucleo_conf.h
|
||||||
* @author MCD Application Team
|
* @author MCD Application Team
|
||||||
* @brief STM32H7xx_Nuleo board configuration file.
|
* @brief STM32H7xx_Nuleo board configuration file.
|
||||||
******************************************************************************
|
******************************************************************************
|
||||||
* @attention
|
* @attention
|
||||||
*
|
*
|
||||||
* <h2><center>© Copyright (c) 2019 STMicroelectronics.
|
* <h2><center>© Copyright (c) 2019 STMicroelectronics.
|
||||||
* All rights reserved.</center></h2>
|
* All rights reserved.</center></h2>
|
||||||
*
|
*
|
||||||
* This software component is licensed by ST under BSD 3-Clause license,
|
* This software component is licensed by ST under BSD 3-Clause license,
|
||||||
* the "License"; You may not use this file except in compliance with the
|
* the "License"; You may not use this file except in compliance with the
|
||||||
* License. You may obtain a copy of the License at:
|
* License. You may obtain a copy of the License at:
|
||||||
* opensource.org/licenses/BSD-3-Clause
|
* opensource.org/licenses/BSD-3-Clause
|
||||||
*
|
*
|
||||||
******************************************************************************
|
******************************************************************************
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/* Define to prevent recursive inclusion -------------------------------------*/
|
/* Define to prevent recursive inclusion -------------------------------------*/
|
||||||
#ifndef STM32H7XX_NUCLEO_CONF_H
|
#ifndef STM32H7XX_NUCLEO_CONF_H
|
||||||
#define STM32H7XX_NUCLEO_CONF_H
|
#define STM32H7XX_NUCLEO_CONF_H
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
extern "C" {
|
extern "C" {
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/* Includes ------------------------------------------------------------------*/
|
/* Includes ------------------------------------------------------------------*/
|
||||||
#include "stm32h7xx_hal.h"
|
|
||||||
#include "stm32h743xx.h"
|
#include "stm32h743xx.h"
|
||||||
|
#include "stm32h7xx_hal.h"
|
||||||
|
|
||||||
/** @addtogroup BSP
|
/** @addtogroup BSP
|
||||||
* @{
|
* @{
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/** @addtogroup STM32H7XX_NUCLEO
|
/** @addtogroup STM32H7XX_NUCLEO
|
||||||
* @{
|
* @{
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/** @defgroup STM32H7XX_NUCLEO_CONFIG Config
|
/** @defgroup STM32H7XX_NUCLEO_CONFIG Config
|
||||||
* @{
|
* @{
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/** @defgroup STM32H7XX_NUCLEO_CONFIG_Exported_Constants Exported Constants
|
/** @defgroup STM32H7XX_NUCLEO_CONFIG_Exported_Constants Exported Constants
|
||||||
* @{
|
* @{
|
||||||
*/
|
*/
|
||||||
/* Nucleo pin and part number defines */
|
/* Nucleo pin and part number defines */
|
||||||
#define USE_NUCLEO_144
|
#define USE_NUCLEO_144
|
||||||
#define USE_NUCLEO_H743ZI
|
#define USE_NUCLEO_H743ZI
|
||||||
|
|
||||||
/* COM define */
|
/* COM define */
|
||||||
#define USE_COM_LOG 0U
|
#define USE_COM_LOG 0U
|
||||||
#define USE_BSP_COM_FEATURE 1U
|
#define USE_BSP_COM_FEATURE 1U
|
||||||
|
|
||||||
/* IRQ priorities */
|
/* IRQ priorities */
|
||||||
#define BSP_BUTTON_USER_IT_PRIORITY 15U
|
#define BSP_BUTTON_USER_IT_PRIORITY 15U
|
||||||
|
|
||||||
#define BUS_SPI1_BAUDRATE 18000000
|
#define BUS_SPI1_BAUDRATE 18000000
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @}
|
* @}
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @}
|
* @}
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @}
|
* @}
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @}
|
* @}
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
}
|
}
|
||||||
|
@ -1,43 +1,43 @@
|
|||||||
/**
|
/**
|
||||||
******************************************************************************
|
******************************************************************************
|
||||||
* @file stm32h7xx_nucleo_errno.h
|
* @file stm32h7xx_nucleo_errno.h
|
||||||
* @author MCD Application Team
|
* @author MCD Application Team
|
||||||
* @brief Error Code.
|
* @brief Error Code.
|
||||||
******************************************************************************
|
******************************************************************************
|
||||||
* @attention
|
* @attention
|
||||||
*
|
*
|
||||||
* <h2><center>© Copyright (c) 2019 STMicroelectronics.
|
* <h2><center>© Copyright (c) 2019 STMicroelectronics.
|
||||||
* All rights reserved.</center></h2>
|
* All rights reserved.</center></h2>
|
||||||
*
|
*
|
||||||
* This software component is licensed by ST under BSD 3-Clause license,
|
* This software component is licensed by ST under BSD 3-Clause license,
|
||||||
* the "License"; You may not use this file except in compliance with the
|
* the "License"; You may not use this file except in compliance with the
|
||||||
* License. You may obtain a copy of the License at:
|
* License. You may obtain a copy of the License at:
|
||||||
* opensource.org/licenses/BSD-3-Clause
|
* opensource.org/licenses/BSD-3-Clause
|
||||||
*
|
*
|
||||||
******************************************************************************
|
******************************************************************************
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/* Define to prevent recursive inclusion -------------------------------------*/
|
/* Define to prevent recursive inclusion -------------------------------------*/
|
||||||
#ifndef STM32H7XX_NUCLEO_ERRNO_H
|
#ifndef STM32H7XX_NUCLEO_ERRNO_H
|
||||||
#define STM32H7XX_NUCLEO_ERRNO_H
|
#define STM32H7XX_NUCLEO_ERRNO_H
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
extern "C" {
|
extern "C" {
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/* Common Error codes */
|
/* Common Error codes */
|
||||||
#define BSP_ERROR_NONE 0
|
#define BSP_ERROR_NONE 0
|
||||||
#define BSP_ERROR_NO_INIT -1
|
#define BSP_ERROR_NO_INIT -1
|
||||||
#define BSP_ERROR_WRONG_PARAM -2
|
#define BSP_ERROR_WRONG_PARAM -2
|
||||||
#define BSP_ERROR_BUSY -3
|
#define BSP_ERROR_BUSY -3
|
||||||
#define BSP_ERROR_PERIPH_FAILURE -4
|
#define BSP_ERROR_PERIPH_FAILURE -4
|
||||||
#define BSP_ERROR_COMPONENT_FAILURE -5
|
#define BSP_ERROR_COMPONENT_FAILURE -5
|
||||||
#define BSP_ERROR_UNKNOWN_FAILURE -6
|
#define BSP_ERROR_UNKNOWN_FAILURE -6
|
||||||
#define BSP_ERROR_UNKNOWN_COMPONENT -7
|
#define BSP_ERROR_UNKNOWN_COMPONENT -7
|
||||||
#define BSP_ERROR_BUS_FAILURE -8
|
#define BSP_ERROR_BUS_FAILURE -8
|
||||||
#define BSP_ERROR_CLOCK_FAILURE -9
|
#define BSP_ERROR_CLOCK_FAILURE -9
|
||||||
#define BSP_ERROR_MSP_FAILURE -10
|
#define BSP_ERROR_MSP_FAILURE -10
|
||||||
#define BSP_ERROR_FEATURE_NOT_SUPPORTED -11
|
#define BSP_ERROR_FEATURE_NOT_SUPPORTED -11
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
}
|
}
|
||||||
|
@ -1,9 +1,9 @@
|
|||||||
target_sources(${TARGET_NAME} PRIVATE
|
target_sources(
|
||||||
freertos.c
|
${TARGET_NAME}
|
||||||
hardware_init.cpp
|
PRIVATE freertos.c
|
||||||
stm32h7xx_hal_timebase_tim.c
|
hardware_init.cpp
|
||||||
stm32h7xx_nucleo.c
|
stm32h7xx_hal_timebase_tim.c
|
||||||
lan8742.c
|
stm32h7xx_nucleo.c
|
||||||
stm32h7xx_it.c
|
lan8742.c
|
||||||
syscalls.c
|
stm32h7xx_it.c
|
||||||
)
|
syscalls.c)
|
||||||
|
@ -1,60 +1,58 @@
|
|||||||
/**
|
/**
|
||||||
******************************************************************************
|
******************************************************************************
|
||||||
* File Name : freertos.c
|
* File Name : freertos.c
|
||||||
* Description : Code for freertos applications
|
* Description : Code for freertos applications
|
||||||
******************************************************************************
|
******************************************************************************
|
||||||
* This notice applies to any and all portions of this file
|
* This notice applies to any and all portions of this file
|
||||||
* that are not between comment pairs USER CODE BEGIN and
|
* that are not between comment pairs USER CODE BEGIN and
|
||||||
* USER CODE END. Other portions of this file, whether
|
* USER CODE END. Other portions of this file, whether
|
||||||
* inserted by the user or by software development tools
|
* inserted by the user or by software development tools
|
||||||
* are owned by their respective copyright owners.
|
* are owned by their respective copyright owners.
|
||||||
*
|
*
|
||||||
* Copyright (c) 2018 STMicroelectronics International N.V.
|
* Copyright (c) 2018 STMicroelectronics International N.V.
|
||||||
* All rights reserved.
|
* All rights reserved.
|
||||||
*
|
*
|
||||||
* Redistribution and use in source and binary forms, with or without
|
* Redistribution and use in source and binary forms, with or without
|
||||||
* modification, are permitted, provided that the following conditions are met:
|
* modification, are permitted, provided that the following conditions are met:
|
||||||
*
|
*
|
||||||
* 1. Redistribution of source code must retain the above copyright notice,
|
* 1. Redistribution of source code must retain the above copyright notice,
|
||||||
* this list of conditions and the following disclaimer.
|
* this list of conditions and the following disclaimer.
|
||||||
* 2. Redistributions in binary form must reproduce the above copyright notice,
|
* 2. Redistributions in binary form must reproduce the above copyright notice,
|
||||||
* this list of conditions and the following disclaimer in the documentation
|
* this list of conditions and the following disclaimer in the documentation
|
||||||
* and/or other materials provided with the distribution.
|
* and/or other materials provided with the distribution.
|
||||||
* 3. Neither the name of STMicroelectronics nor the names of other
|
* 3. Neither the name of STMicroelectronics nor the names of other
|
||||||
* contributors to this software may be used to endorse or promote products
|
* contributors to this software may be used to endorse or promote products
|
||||||
* derived from this software without specific written permission.
|
* derived from this software without specific written permission.
|
||||||
* 4. This software, including modifications and/or derivative works of this
|
* 4. This software, including modifications and/or derivative works of this
|
||||||
* software, must execute solely and exclusively on microcontroller or
|
* software, must execute solely and exclusively on microcontroller or
|
||||||
* microprocessor devices manufactured by or for STMicroelectronics.
|
* microprocessor devices manufactured by or for STMicroelectronics.
|
||||||
* 5. Redistribution and use of this software other than as permitted under
|
* 5. Redistribution and use of this software other than as permitted under
|
||||||
* this license is void and will automatically terminate your rights under
|
* this license is void and will automatically terminate your rights under
|
||||||
* this license.
|
* this license.
|
||||||
*
|
*
|
||||||
* THIS SOFTWARE IS PROVIDED BY STMICROELECTRONICS AND CONTRIBUTORS "AS IS"
|
* THIS SOFTWARE IS PROVIDED BY STMICROELECTRONICS AND CONTRIBUTORS "AS IS"
|
||||||
* AND ANY EXPRESS, IMPLIED OR STATUTORY WARRANTIES, INCLUDING, BUT NOT
|
* AND ANY EXPRESS, IMPLIED OR STATUTORY WARRANTIES, INCLUDING, BUT NOT
|
||||||
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS FOR A
|
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS FOR A
|
||||||
* PARTICULAR PURPOSE AND NON-INFRINGEMENT OF THIRD PARTY INTELLECTUAL PROPERTY
|
* PARTICULAR PURPOSE AND NON-INFRINGEMENT OF THIRD PARTY INTELLECTUAL PROPERTY
|
||||||
* RIGHTS ARE DISCLAIMED TO THE FULLEST EXTENT PERMITTED BY LAW. IN NO EVENT
|
* RIGHTS ARE DISCLAIMED TO THE FULLEST EXTENT PERMITTED BY LAW. IN NO EVENT
|
||||||
* SHALL STMICROELECTRONICS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
|
* SHALL STMICROELECTRONICS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
|
||||||
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
||||||
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA,
|
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA,
|
||||||
* OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
|
* OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
|
||||||
* LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
|
* LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
|
||||||
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
|
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
|
||||||
* EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
* EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
*
|
*
|
||||||
******************************************************************************
|
******************************************************************************
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/* Includes ------------------------------------------------------------------*/
|
/* Includes ------------------------------------------------------------------*/
|
||||||
#include "FreeRTOS.h"
|
#include "FreeRTOS.h"
|
||||||
#include "task.h"
|
|
||||||
#include "portmacro.h"
|
#include "portmacro.h"
|
||||||
|
#include "task.h"
|
||||||
|
|
||||||
/* USER CODE BEGIN Includes */
|
/* USER CODE BEGIN Includes */
|
||||||
void vRequestContextSwitchFromISR() {
|
void vRequestContextSwitchFromISR() { portYIELD_FROM_ISR(pdTRUE); }
|
||||||
portYIELD_FROM_ISR(pdTRUE);
|
|
||||||
}
|
|
||||||
|
|
||||||
/* USER CODE END Includes */
|
/* USER CODE END Includes */
|
||||||
|
|
||||||
|
@ -6,23 +6,22 @@
|
|||||||
#include "stm32h7xx_nucleo.h"
|
#include "stm32h7xx_nucleo.h"
|
||||||
|
|
||||||
#if OBSW_ADD_LWIP_COMPONENTS == 1
|
#if OBSW_ADD_LWIP_COMPONENTS == 1
|
||||||
#include <app_ethernet.h>
|
|
||||||
#include "example_common/stm32h7/networking/ethernetif.h"
|
|
||||||
#include "example_common/stm32h7/networking/app_ethernet.h"
|
#include "example_common/stm32h7/networking/app_ethernet.h"
|
||||||
#include <lwip/netif.h>
|
#include "example_common/stm32h7/networking/ethernetif.h"
|
||||||
#include <lwip/init.h>
|
#include <lwip/init.h>
|
||||||
#include <lwip/ip_addr.h>
|
#include <lwip/ip_addr.h>
|
||||||
|
#include <lwip/netif.h>
|
||||||
#include <netif/ethernet.h>
|
#include <netif/ethernet.h>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#include <boardconfig.h>
|
#include <boardconfig.h>
|
||||||
#include <stdio.h>
|
#include <cstdio>
|
||||||
|
|
||||||
/* Forward declarations */
|
/* Forward declarations */
|
||||||
void MPU_Config(void);
|
void MPU_Config();
|
||||||
void SystemClock_Config(void);
|
void SystemClock_Config();
|
||||||
void BSP_Config(void);
|
void BSP_Config();
|
||||||
void CPU_CACHE_Enable(void);
|
void CPU_CACHE_Enable();
|
||||||
void MX_USART3_UART_Init(uint32_t baudRate);
|
void MX_USART3_UART_Init(uint32_t baudRate);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -37,239 +36,235 @@ struct netif gnetif;
|
|||||||
bool debugAvailable = false;
|
bool debugAvailable = false;
|
||||||
|
|
||||||
void performHardwareInit() {
|
void performHardwareInit() {
|
||||||
/* Configure the MPU attributes as Device memory for ETH DMA descriptors */
|
/* Configure the MPU attributes as Device memory for ETH DMA descriptors */
|
||||||
MPU_Config();
|
MPU_Config();
|
||||||
|
|
||||||
/* Enable the CPU Cache */
|
/* Enable the CPU Cache */
|
||||||
CPU_CACHE_Enable();
|
CPU_CACHE_Enable();
|
||||||
|
|
||||||
MX_USART3_UART_Init(DEBUG_UART_BAUDRATE);
|
MX_USART3_UART_Init(DEBUG_UART_BAUDRATE);
|
||||||
|
|
||||||
HAL_StatusTypeDef retval = HAL_Init();
|
HAL_StatusTypeDef retval = HAL_Init();
|
||||||
if(retval != HAL_OK) {
|
if (retval != HAL_OK) {
|
||||||
printf("Error: HAL initialization failed!\n\r");
|
printf("Error: HAL initialization failed!\n\r");
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Configure the system clock to 400 MHz */
|
/* Configure the system clock to 400 MHz */
|
||||||
SystemClock_Config();
|
SystemClock_Config();
|
||||||
|
|
||||||
BSP_Config();
|
BSP_Config();
|
||||||
}
|
}
|
||||||
void MX_USART3_UART_Init(uint32_t baudRate)
|
void MX_USART3_UART_Init(uint32_t baudRate) {
|
||||||
{
|
__HAL_RCC_USART3_CONFIG(RCC_USART3CLKSOURCE_HSI);
|
||||||
__HAL_RCC_USART3_CONFIG(RCC_USART3CLKSOURCE_HSI);
|
__HAL_RCC_GPIOD_CLK_ENABLE();
|
||||||
__HAL_RCC_GPIOD_CLK_ENABLE();
|
__HAL_RCC_USART3_CLK_ENABLE();
|
||||||
__HAL_RCC_USART3_CLK_ENABLE();
|
/*Configure GPIO pins : PD8 PD9 */
|
||||||
/*Configure GPIO pins : PD8 PD9 */
|
gpio_uart_init_struct.Pin = GPIO_PIN_8 | GPIO_PIN_9;
|
||||||
gpio_uart_init_struct.Pin = GPIO_PIN_8|GPIO_PIN_9;
|
gpio_uart_init_struct.Mode = GPIO_MODE_AF_PP;
|
||||||
gpio_uart_init_struct.Mode = GPIO_MODE_AF_PP;
|
gpio_uart_init_struct.Pull = GPIO_NOPULL;
|
||||||
gpio_uart_init_struct.Pull = GPIO_NOPULL;
|
gpio_uart_init_struct.Speed = GPIO_SPEED_FREQ_LOW;
|
||||||
gpio_uart_init_struct.Speed = GPIO_SPEED_FREQ_LOW;
|
gpio_uart_init_struct.Alternate = GPIO_AF7_USART3;
|
||||||
gpio_uart_init_struct.Alternate = GPIO_AF7_USART3;
|
HAL_GPIO_Init(GPIOD, &gpio_uart_init_struct);
|
||||||
HAL_GPIO_Init(GPIOD, &gpio_uart_init_struct);
|
|
||||||
|
|
||||||
int result;
|
int result;
|
||||||
huart3.Instance = USART3;
|
huart3.Instance = USART3;
|
||||||
huart3.Init.BaudRate = baudRate;
|
huart3.Init.BaudRate = baudRate;
|
||||||
huart3.Init.WordLength = UART_WORDLENGTH_8B;
|
huart3.Init.WordLength = UART_WORDLENGTH_8B;
|
||||||
huart3.Init.StopBits = UART_STOPBITS_1;
|
huart3.Init.StopBits = UART_STOPBITS_1;
|
||||||
huart3.Init.Parity = UART_PARITY_NONE;
|
huart3.Init.Parity = UART_PARITY_NONE;
|
||||||
huart3.Init.Mode = UART_MODE_TX_RX;
|
huart3.Init.Mode = UART_MODE_TX_RX;
|
||||||
huart3.Init.HwFlowCtl = UART_HWCONTROL_NONE;
|
huart3.Init.HwFlowCtl = UART_HWCONTROL_NONE;
|
||||||
huart3.Init.OverSampling = UART_OVERSAMPLING_16;
|
huart3.Init.OverSampling = UART_OVERSAMPLING_16;
|
||||||
huart3.Init.OneBitSampling = UART_ONE_BIT_SAMPLE_DISABLE;
|
huart3.Init.OneBitSampling = UART_ONE_BIT_SAMPLE_DISABLE;
|
||||||
huart3.Init.ClockPrescaler = UART_PRESCALER_DIV1;
|
huart3.Init.ClockPrescaler = UART_PRESCALER_DIV1;
|
||||||
//huart3.Init.FIFOMode = UART_FIFOMODE_DISABLE;
|
// huart3.Init.FIFOMode = UART_FIFOMODE_DISABLE;
|
||||||
//huart3.Init.TXFIFOThreshold = UART_TXFIFO_THRESHOLD_1_8;
|
// huart3.Init.TXFIFOThreshold = UART_TXFIFO_THRESHOLD_1_8;
|
||||||
//huart3.Init.RXFIFOThreshold = UART_RXFIFO_THRESHOLD_1_8;
|
// huart3.Init.RXFIFOThreshold = UART_RXFIFO_THRESHOLD_1_8;
|
||||||
huart3.AdvancedInit.AdvFeatureInit = UART_ADVFEATURE_NO_INIT;
|
huart3.AdvancedInit.AdvFeatureInit = UART_ADVFEATURE_NO_INIT;
|
||||||
// we can't do error handling (simple print out first) here because UART3 is our print interface
|
// we can't do error handling (simple print out first) here because UART3 is
|
||||||
result = HAL_UART_Init(&huart3);
|
// our print interface
|
||||||
if(result == HAL_OK) {
|
result = HAL_UART_Init(&huart3);
|
||||||
//print_uart3("\rUART3 configured successfully !\r\n\0");
|
if (result == HAL_OK) {
|
||||||
debugAvailable = true;
|
// print_uart3("\rUART3 configured successfully !\r\n\0");
|
||||||
}
|
debugAvailable = true;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief System Clock Configuration
|
* @brief System Clock Configuration
|
||||||
* The system Clock is configured as follow :
|
* The system Clock is configured as follow :
|
||||||
* System Clock source = PLL (HSE BYPASS)
|
* System Clock source = PLL (HSE BYPASS)
|
||||||
* SYSCLK(Hz) = 400000000 (CPU Clock)
|
* SYSCLK(Hz) = 400000000 (CPU Clock)
|
||||||
* HCLK(Hz) = 200000000 (AXI and AHBs Clock)
|
* HCLK(Hz) = 200000000 (AXI and AHBs Clock)
|
||||||
* AHB Prescaler = 2
|
* AHB Prescaler = 2
|
||||||
* D1 APB3 Prescaler = 2 (APB3 Clock 100MHz)
|
* D1 APB3 Prescaler = 2 (APB3 Clock 100MHz)
|
||||||
* D2 APB1 Prescaler = 2 (APB1 Clock 100MHz)
|
* D2 APB1 Prescaler = 2 (APB1 Clock 100MHz)
|
||||||
* D2 APB2 Prescaler = 2 (APB2 Clock 100MHz)
|
* D2 APB2 Prescaler = 2 (APB2 Clock 100MHz)
|
||||||
* D3 APB4 Prescaler = 2 (APB4 Clock 100MHz)
|
* D3 APB4 Prescaler = 2 (APB4 Clock 100MHz)
|
||||||
* HSE Frequency(Hz) = 8000000
|
* HSE Frequency(Hz) = 8000000
|
||||||
* PLL_M = 4
|
* PLL_M = 4
|
||||||
* PLL_N = 400
|
* PLL_N = 400
|
||||||
* PLL_P = 2
|
* PLL_P = 2
|
||||||
* PLL_Q = 4
|
* PLL_Q = 4
|
||||||
* PLL_R = 2
|
* PLL_R = 2
|
||||||
* VDD(V) = 3.3
|
* VDD(V) = 3.3
|
||||||
* Flash Latency(WS) = 4
|
* Flash Latency(WS) = 4
|
||||||
* @param None
|
* @param None
|
||||||
* @retval None
|
* @retval None
|
||||||
*/
|
*/
|
||||||
void SystemClock_Config(void)
|
void SystemClock_Config() {
|
||||||
{
|
RCC_ClkInitTypeDef RCC_ClkInitStruct;
|
||||||
RCC_ClkInitTypeDef RCC_ClkInitStruct;
|
RCC_OscInitTypeDef RCC_OscInitStruct;
|
||||||
RCC_OscInitTypeDef RCC_OscInitStruct;
|
HAL_StatusTypeDef ret = HAL_OK;
|
||||||
HAL_StatusTypeDef ret = HAL_OK;
|
|
||||||
|
|
||||||
/*!< Supply configuration update enable */
|
/*!< Supply configuration update enable */
|
||||||
MODIFY_REG(PWR->CR3, PWR_CR3_SCUEN, 0); // @suppress("Field cannot be resolved")
|
MODIFY_REG(PWR->CR3, PWR_CR3_SCUEN,
|
||||||
|
0); // @suppress("Field cannot be resolved")
|
||||||
|
|
||||||
/* The voltage scaling allows optimizing the power consumption when the device is
|
/* The voltage scaling allows optimizing the power consumption when the device
|
||||||
clocked below the maximum system frequency, to update the voltage scaling value
|
is clocked below the maximum system frequency, to update the voltage scaling
|
||||||
regarding system frequency refer to product datasheet. */
|
value regarding system frequency refer to product datasheet. */
|
||||||
__HAL_PWR_VOLTAGESCALING_CONFIG(PWR_REGULATOR_VOLTAGE_SCALE1); // @suppress("Field cannot be resolved")
|
__HAL_PWR_VOLTAGESCALING_CONFIG(
|
||||||
|
PWR_REGULATOR_VOLTAGE_SCALE1); // @suppress("Field cannot be resolved")
|
||||||
|
|
||||||
while(!__HAL_PWR_GET_FLAG(PWR_FLAG_VOSRDY)) {} // @suppress("Field cannot be resolved")
|
while (!__HAL_PWR_GET_FLAG(PWR_FLAG_VOSRDY)) {
|
||||||
|
} // @suppress("Field cannot be resolved")
|
||||||
|
|
||||||
/* Enable D2 domain SRAM3 Clock (0x30040000 AXI)*/
|
/* Enable D2 domain SRAM3 Clock (0x30040000 AXI)*/
|
||||||
__HAL_RCC_D2SRAM3_CLK_ENABLE(); // @suppress("Field cannot be resolved")
|
__HAL_RCC_D2SRAM3_CLK_ENABLE(); // @suppress("Field cannot be resolved")
|
||||||
|
|
||||||
/* Enable HSE Oscillator and activate PLL with HSE as source */
|
/* Enable HSE Oscillator and activate PLL with HSE as source */
|
||||||
RCC_OscInitStruct.OscillatorType = RCC_OSCILLATORTYPE_HSE;
|
RCC_OscInitStruct.OscillatorType = RCC_OSCILLATORTYPE_HSE;
|
||||||
RCC_OscInitStruct.HSEState = RCC_HSE_BYPASS;
|
RCC_OscInitStruct.HSEState = RCC_HSE_BYPASS;
|
||||||
RCC_OscInitStruct.HSIState = RCC_HSI_OFF;
|
RCC_OscInitStruct.HSIState = RCC_HSI_OFF;
|
||||||
RCC_OscInitStruct.CSIState = RCC_CSI_OFF;
|
RCC_OscInitStruct.CSIState = RCC_CSI_OFF;
|
||||||
RCC_OscInitStruct.PLL.PLLState = RCC_PLL_ON;
|
RCC_OscInitStruct.PLL.PLLState = RCC_PLL_ON;
|
||||||
RCC_OscInitStruct.PLL.PLLSource = RCC_PLLSOURCE_HSE;
|
RCC_OscInitStruct.PLL.PLLSource = RCC_PLLSOURCE_HSE;
|
||||||
|
|
||||||
RCC_OscInitStruct.PLL.PLLM = 4;
|
RCC_OscInitStruct.PLL.PLLM = 4;
|
||||||
RCC_OscInitStruct.PLL.PLLN = 400;
|
RCC_OscInitStruct.PLL.PLLN = 400;
|
||||||
RCC_OscInitStruct.PLL.PLLP = 2;
|
RCC_OscInitStruct.PLL.PLLP = 2;
|
||||||
RCC_OscInitStruct.PLL.PLLR = 2;
|
RCC_OscInitStruct.PLL.PLLR = 2;
|
||||||
RCC_OscInitStruct.PLL.PLLQ = 4;
|
RCC_OscInitStruct.PLL.PLLQ = 4;
|
||||||
|
|
||||||
RCC_OscInitStruct.PLL.PLLVCOSEL = RCC_PLL1VCOWIDE;
|
RCC_OscInitStruct.PLL.PLLVCOSEL = RCC_PLL1VCOWIDE;
|
||||||
RCC_OscInitStruct.PLL.PLLRGE = RCC_PLL1VCIRANGE_2;
|
RCC_OscInitStruct.PLL.PLLRGE = RCC_PLL1VCIRANGE_2;
|
||||||
ret = HAL_RCC_OscConfig(&RCC_OscInitStruct);
|
ret = HAL_RCC_OscConfig(&RCC_OscInitStruct);
|
||||||
if(ret != HAL_OK)
|
if (ret != HAL_OK) {
|
||||||
{
|
while (1)
|
||||||
while(1);
|
;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Select PLL as system clock source and configure bus clocks dividers */
|
/* Select PLL as system clock source and configure bus clocks dividers */
|
||||||
RCC_ClkInitStruct.ClockType = (RCC_CLOCKTYPE_SYSCLK | RCC_CLOCKTYPE_HCLK |
|
RCC_ClkInitStruct.ClockType =
|
||||||
RCC_CLOCKTYPE_D1PCLK1 | RCC_CLOCKTYPE_PCLK1 | RCC_CLOCKTYPE_PCLK2 |
|
(RCC_CLOCKTYPE_SYSCLK | RCC_CLOCKTYPE_HCLK | RCC_CLOCKTYPE_D1PCLK1 |
|
||||||
RCC_CLOCKTYPE_D3PCLK1);
|
RCC_CLOCKTYPE_PCLK1 | RCC_CLOCKTYPE_PCLK2 | RCC_CLOCKTYPE_D3PCLK1);
|
||||||
|
|
||||||
RCC_ClkInitStruct.SYSCLKSource = RCC_SYSCLKSOURCE_PLLCLK;
|
RCC_ClkInitStruct.SYSCLKSource = RCC_SYSCLKSOURCE_PLLCLK;
|
||||||
RCC_ClkInitStruct.SYSCLKDivider = RCC_SYSCLK_DIV1;
|
RCC_ClkInitStruct.SYSCLKDivider = RCC_SYSCLK_DIV1;
|
||||||
RCC_ClkInitStruct.AHBCLKDivider = RCC_HCLK_DIV2;
|
RCC_ClkInitStruct.AHBCLKDivider = RCC_HCLK_DIV2;
|
||||||
RCC_ClkInitStruct.APB3CLKDivider = RCC_APB3_DIV2;
|
RCC_ClkInitStruct.APB3CLKDivider = RCC_APB3_DIV2;
|
||||||
RCC_ClkInitStruct.APB1CLKDivider = RCC_APB1_DIV2;
|
RCC_ClkInitStruct.APB1CLKDivider = RCC_APB1_DIV2;
|
||||||
RCC_ClkInitStruct.APB2CLKDivider = RCC_APB2_DIV2;
|
RCC_ClkInitStruct.APB2CLKDivider = RCC_APB2_DIV2;
|
||||||
RCC_ClkInitStruct.APB4CLKDivider = RCC_APB4_DIV2;
|
RCC_ClkInitStruct.APB4CLKDivider = RCC_APB4_DIV2;
|
||||||
ret = HAL_RCC_ClockConfig(&RCC_ClkInitStruct, FLASH_LATENCY_4);
|
ret = HAL_RCC_ClockConfig(&RCC_ClkInitStruct, FLASH_LATENCY_4);
|
||||||
if(ret != HAL_OK)
|
if (ret != HAL_OK) {
|
||||||
{
|
while (1)
|
||||||
while(1);
|
;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/*Configure the MPU attributes */
|
/*Configure the MPU attributes */
|
||||||
void MPU_Config(void)
|
void MPU_Config() {
|
||||||
{
|
MPU_Region_InitTypeDef MPU_InitStruct;
|
||||||
MPU_Region_InitTypeDef MPU_InitStruct;
|
|
||||||
|
|
||||||
/* Disable the MPU */
|
/* Disable the MPU */
|
||||||
HAL_MPU_Disable();
|
HAL_MPU_Disable();
|
||||||
|
|
||||||
/* Configure the MPU attributes as Device not cacheable
|
/* Configure the MPU attributes as Device not cacheable
|
||||||
for ETH DMA descriptors */
|
for ETH DMA descriptors */
|
||||||
MPU_InitStruct.Enable = MPU_REGION_ENABLE;
|
MPU_InitStruct.Enable = MPU_REGION_ENABLE;
|
||||||
MPU_InitStruct.BaseAddress = 0x30040000;
|
MPU_InitStruct.BaseAddress = 0x30040000;
|
||||||
MPU_InitStruct.Size = MPU_REGION_SIZE_256B;
|
MPU_InitStruct.Size = MPU_REGION_SIZE_256B;
|
||||||
MPU_InitStruct.AccessPermission = MPU_REGION_FULL_ACCESS;
|
MPU_InitStruct.AccessPermission = MPU_REGION_FULL_ACCESS;
|
||||||
MPU_InitStruct.IsBufferable = MPU_ACCESS_BUFFERABLE;
|
MPU_InitStruct.IsBufferable = MPU_ACCESS_BUFFERABLE;
|
||||||
MPU_InitStruct.IsCacheable = MPU_ACCESS_NOT_CACHEABLE;
|
MPU_InitStruct.IsCacheable = MPU_ACCESS_NOT_CACHEABLE;
|
||||||
MPU_InitStruct.IsShareable = MPU_ACCESS_NOT_SHAREABLE;
|
MPU_InitStruct.IsShareable = MPU_ACCESS_NOT_SHAREABLE;
|
||||||
MPU_InitStruct.Number = MPU_REGION_NUMBER0;
|
MPU_InitStruct.Number = MPU_REGION_NUMBER0;
|
||||||
MPU_InitStruct.TypeExtField = MPU_TEX_LEVEL0;
|
MPU_InitStruct.TypeExtField = MPU_TEX_LEVEL0;
|
||||||
MPU_InitStruct.SubRegionDisable = 0x00;
|
MPU_InitStruct.SubRegionDisable = 0x00;
|
||||||
MPU_InitStruct.DisableExec = MPU_INSTRUCTION_ACCESS_ENABLE;
|
MPU_InitStruct.DisableExec = MPU_INSTRUCTION_ACCESS_ENABLE;
|
||||||
|
|
||||||
HAL_MPU_ConfigRegion(&MPU_InitStruct);
|
HAL_MPU_ConfigRegion(&MPU_InitStruct);
|
||||||
|
|
||||||
/* Configure the MPU attributes as Cacheable write through
|
/* Configure the MPU attributes as Cacheable write through
|
||||||
for LwIP RAM heap which contains the Tx buffers */
|
for LwIP RAM heap which contains the Tx buffers */
|
||||||
MPU_InitStruct.Enable = MPU_REGION_ENABLE;
|
MPU_InitStruct.Enable = MPU_REGION_ENABLE;
|
||||||
MPU_InitStruct.BaseAddress = 0x30044000;
|
MPU_InitStruct.BaseAddress = 0x30044000;
|
||||||
MPU_InitStruct.Size = MPU_REGION_SIZE_16KB;
|
MPU_InitStruct.Size = MPU_REGION_SIZE_16KB;
|
||||||
MPU_InitStruct.AccessPermission = MPU_REGION_FULL_ACCESS;
|
MPU_InitStruct.AccessPermission = MPU_REGION_FULL_ACCESS;
|
||||||
MPU_InitStruct.IsBufferable = MPU_ACCESS_NOT_BUFFERABLE;
|
MPU_InitStruct.IsBufferable = MPU_ACCESS_NOT_BUFFERABLE;
|
||||||
MPU_InitStruct.IsCacheable = MPU_ACCESS_CACHEABLE;
|
MPU_InitStruct.IsCacheable = MPU_ACCESS_CACHEABLE;
|
||||||
MPU_InitStruct.IsShareable = MPU_ACCESS_NOT_SHAREABLE;
|
MPU_InitStruct.IsShareable = MPU_ACCESS_NOT_SHAREABLE;
|
||||||
MPU_InitStruct.Number = MPU_REGION_NUMBER1;
|
MPU_InitStruct.Number = MPU_REGION_NUMBER1;
|
||||||
MPU_InitStruct.TypeExtField = MPU_TEX_LEVEL0;
|
MPU_InitStruct.TypeExtField = MPU_TEX_LEVEL0;
|
||||||
MPU_InitStruct.SubRegionDisable = 0x00;
|
MPU_InitStruct.SubRegionDisable = 0x00;
|
||||||
MPU_InitStruct.DisableExec = MPU_INSTRUCTION_ACCESS_ENABLE;
|
MPU_InitStruct.DisableExec = MPU_INSTRUCTION_ACCESS_ENABLE;
|
||||||
|
|
||||||
HAL_MPU_ConfigRegion(&MPU_InitStruct);
|
HAL_MPU_ConfigRegion(&MPU_InitStruct);
|
||||||
|
|
||||||
/* Enable the MPU */
|
/* Enable the MPU */
|
||||||
HAL_MPU_Enable(MPU_PRIVILEGED_DEFAULT);
|
HAL_MPU_Enable(MPU_PRIVILEGED_DEFAULT);
|
||||||
}
|
}
|
||||||
|
|
||||||
/*CPU L1-Cache enable*/
|
/*CPU L1-Cache enable*/
|
||||||
void CPU_CACHE_Enable(void)
|
void CPU_CACHE_Enable() {
|
||||||
{
|
/* Enable I-Cache */
|
||||||
/* Enable I-Cache */
|
SCB_EnableICache();
|
||||||
SCB_EnableICache();
|
|
||||||
|
|
||||||
/* Enable D-Cache */
|
/* Enable D-Cache */
|
||||||
SCB_EnableDCache();
|
SCB_EnableDCache();
|
||||||
}
|
}
|
||||||
|
|
||||||
void BSP_Config(void)
|
void BSP_Config() {
|
||||||
{
|
BSP_LED_Init(LED1);
|
||||||
BSP_LED_Init(LED1);
|
BSP_LED_Init(LED2);
|
||||||
BSP_LED_Init(LED2);
|
BSP_LED_Init(LED3);
|
||||||
BSP_LED_Init(LED3);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#if OBSW_ADD_LWIP_COMPONENTS == 1
|
#if OBSW_ADD_LWIP_COMPONENTS == 1
|
||||||
|
|
||||||
void Netif_Config(void)
|
void Netif_Config(void) {
|
||||||
{
|
ip_addr_t ipaddr;
|
||||||
ip_addr_t ipaddr;
|
ip_addr_t netmask;
|
||||||
ip_addr_t netmask;
|
ip_addr_t gw;
|
||||||
ip_addr_t gw;
|
|
||||||
#if LWIP_DHCP
|
#if LWIP_DHCP
|
||||||
ip_addr_set_zero_ip4(&ipaddr);
|
ip_addr_set_zero_ip4(&ipaddr);
|
||||||
ip_addr_set_zero_ip4(&netmask);
|
ip_addr_set_zero_ip4(&netmask);
|
||||||
ip_addr_set_zero_ip4(&gw);
|
ip_addr_set_zero_ip4(&gw);
|
||||||
#else
|
#else
|
||||||
|
|
||||||
/* IP address default setting */
|
/* IP address default setting */
|
||||||
set_lwip_addresses(&ipaddr, &netmask, &gw);
|
set_lwip_addresses(&ipaddr, &netmask, &gw);
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/* add the network interface */
|
/* add the network interface */
|
||||||
struct netif* netif_valid = netif_add(&gnetif, (ip4_addr_t*)&ipaddr,
|
struct netif *netif_valid =
|
||||||
(ip4_addr_t*)&netmask, (ip4_addr_t*) &gw, NULL, ðernetif_init,
|
netif_add(&gnetif, (ip4_addr_t *)&ipaddr, (ip4_addr_t *)&netmask,
|
||||||
ðernet_input);
|
(ip4_addr_t *)&gw, nullptr, ðernetif_init, ðernet_input);
|
||||||
if(netif_valid == NULL) {
|
if (netif_valid == nullptr) {
|
||||||
printf("Error: netif initialization failed!\n\r");
|
printf("Error: netif initialization failed!\n\r");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
/* Registers the default network interface */
|
/* Registers the default network interface */
|
||||||
netif_set_default(&gnetif);
|
netif_set_default(&gnetif);
|
||||||
|
|
||||||
networking::ethernetLinkStatusUpdated(&gnetif);
|
networking::ethernetLinkStatusUpdated(&gnetif);
|
||||||
|
|
||||||
#if LWIP_NETIF_LINK_CALLBACK
|
#if LWIP_NETIF_LINK_CALLBACK
|
||||||
netif_set_link_callback(&gnetif, networking::ethernetLinkStatusUpdated);
|
netif_set_link_callback(&gnetif, networking::ethernetLinkStatusUpdated);
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif /* OBSW_ADD_LWIP_COMPONENTS == 1 */
|
#endif /* OBSW_ADD_LWIP_COMPONENTS == 1 */
|
||||||
|
|
||||||
|
@ -1,69 +1,67 @@
|
|||||||
/**
|
/**
|
||||||
******************************************************************************
|
******************************************************************************
|
||||||
* @file lan8742.c
|
* @file lan8742.c
|
||||||
* @author MCD Application Team
|
* @author MCD Application Team
|
||||||
* @brief This file provides a set of functions needed to manage the LAN742
|
* @brief This file provides a set of functions needed to manage the LAN742
|
||||||
* PHY devices.
|
* PHY devices.
|
||||||
******************************************************************************
|
******************************************************************************
|
||||||
* @attention
|
* @attention
|
||||||
*
|
*
|
||||||
* <h2><center>© Copyright (c) 2017 STMicroelectronics.
|
* <h2><center>© Copyright (c) 2017 STMicroelectronics.
|
||||||
* All rights reserved.</center></h2>
|
* All rights reserved.</center></h2>
|
||||||
*
|
*
|
||||||
* This software component is licensed by ST under BSD 3-Clause license,
|
* This software component is licensed by ST under BSD 3-Clause license,
|
||||||
* the "License"; You may not use this file except in compliance with the
|
* the "License"; You may not use this file except in compliance with the
|
||||||
* License. You may obtain a copy of the License at:
|
* License. You may obtain a copy of the License at:
|
||||||
* opensource.org/licenses/BSD-3-Clause
|
* opensource.org/licenses/BSD-3-Clause
|
||||||
*
|
*
|
||||||
******************************************************************************
|
******************************************************************************
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/* Includes ------------------------------------------------------------------*/
|
/* Includes ------------------------------------------------------------------*/
|
||||||
#include "lan8742.h"
|
#include "lan8742.h"
|
||||||
|
|
||||||
/** @addtogroup BSP
|
/** @addtogroup BSP
|
||||||
* @{
|
* @{
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/** @addtogroup Component
|
/** @addtogroup Component
|
||||||
* @{
|
* @{
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/** @defgroup LAN8742 LAN8742
|
/** @defgroup LAN8742 LAN8742
|
||||||
* @{
|
* @{
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/* Private typedef -----------------------------------------------------------*/
|
/* Private typedef -----------------------------------------------------------*/
|
||||||
/* Private define ------------------------------------------------------------*/
|
/* Private define ------------------------------------------------------------*/
|
||||||
/** @defgroup LAN8742_Private_Defines LAN8742 Private Defines
|
/** @defgroup LAN8742_Private_Defines LAN8742 Private Defines
|
||||||
* @{
|
* @{
|
||||||
*/
|
*/
|
||||||
#define LAN8742_SW_RESET_TO ((uint32_t)500U)
|
#define LAN8742_SW_RESET_TO ((uint32_t)500U)
|
||||||
#define LAN8742_INIT_TO ((uint32_t)2000U)
|
#define LAN8742_INIT_TO ((uint32_t)2000U)
|
||||||
#define LAN8742_MAX_DEV_ADDR ((uint32_t)31U)
|
#define LAN8742_MAX_DEV_ADDR ((uint32_t)31U)
|
||||||
/**
|
/**
|
||||||
* @}
|
* @}
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/* Private macro -------------------------------------------------------------*/
|
/* Private macro -------------------------------------------------------------*/
|
||||||
/* Private variables ---------------------------------------------------------*/
|
/* Private variables ---------------------------------------------------------*/
|
||||||
/* Private function prototypes -----------------------------------------------*/
|
/* Private function prototypes -----------------------------------------------*/
|
||||||
/* Private functions ---------------------------------------------------------*/
|
/* Private functions ---------------------------------------------------------*/
|
||||||
/** @defgroup LAN8742_Private_Functions LAN8742 Private Functions
|
/** @defgroup LAN8742_Private_Functions LAN8742 Private Functions
|
||||||
* @{
|
* @{
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Register IO functions to component object
|
* @brief Register IO functions to component object
|
||||||
* @param pObj: device object of LAN8742_Object_t.
|
* @param pObj: device object of LAN8742_Object_t.
|
||||||
* @param ioctx: holds device IO functions.
|
* @param ioctx: holds device IO functions.
|
||||||
* @retval LAN8742_STATUS_OK if OK
|
* @retval LAN8742_STATUS_OK if OK
|
||||||
* LAN8742_STATUS_ERROR if missing mandatory function
|
* LAN8742_STATUS_ERROR if missing mandatory function
|
||||||
*/
|
*/
|
||||||
int32_t LAN8742_RegisterBusIO(lan8742_Object_t *pObj, lan8742_IOCtx_t *ioctx)
|
int32_t LAN8742_RegisterBusIO(lan8742_Object_t *pObj, lan8742_IOCtx_t *ioctx) {
|
||||||
{
|
if (!pObj || !ioctx->ReadReg || !ioctx->WriteReg || !ioctx->GetTick) {
|
||||||
if(!pObj || !ioctx->ReadReg || !ioctx->WriteReg || !ioctx->GetTick)
|
|
||||||
{
|
|
||||||
return LAN8742_STATUS_ERROR;
|
return LAN8742_STATUS_ERROR;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -77,122 +75,98 @@ int32_t LAN8742_RegisterBusIO(lan8742_Object_t *pObj, lan8742_IOCtx_t *ioctx)
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Initialize the lan8742 and configure the needed hardware resources
|
* @brief Initialize the lan8742 and configure the needed hardware resources
|
||||||
* @param pObj: device object LAN8742_Object_t.
|
* @param pObj: device object LAN8742_Object_t.
|
||||||
* @retval LAN8742_STATUS_OK if OK
|
* @retval LAN8742_STATUS_OK if OK
|
||||||
* LAN8742_STATUS_ADDRESS_ERROR if cannot find device address
|
* LAN8742_STATUS_ADDRESS_ERROR if cannot find device address
|
||||||
* LAN8742_STATUS_READ_ERROR if connot read register
|
* LAN8742_STATUS_READ_ERROR if connot read register
|
||||||
* LAN8742_STATUS_WRITE_ERROR if connot write to register
|
* LAN8742_STATUS_WRITE_ERROR if connot write to register
|
||||||
* LAN8742_STATUS_RESET_TIMEOUT if cannot perform a software reset
|
* LAN8742_STATUS_RESET_TIMEOUT if cannot perform a software reset
|
||||||
*/
|
*/
|
||||||
int32_t LAN8742_Init(lan8742_Object_t *pObj)
|
int32_t LAN8742_Init(lan8742_Object_t *pObj) {
|
||||||
{
|
uint32_t tickstart = 0, regvalue = 0, addr = 0;
|
||||||
uint32_t tickstart = 0, regvalue = 0, addr = 0;
|
int32_t status = LAN8742_STATUS_OK;
|
||||||
int32_t status = LAN8742_STATUS_OK;
|
|
||||||
|
|
||||||
if(pObj->Is_Initialized == 0)
|
if (pObj->Is_Initialized == 0) {
|
||||||
{
|
if (pObj->IO.Init != 0) {
|
||||||
if(pObj->IO.Init != 0)
|
/* GPIO and Clocks initialization */
|
||||||
{
|
pObj->IO.Init();
|
||||||
/* GPIO and Clocks initialization */
|
}
|
||||||
pObj->IO.Init();
|
|
||||||
}
|
|
||||||
|
|
||||||
/* for later check */
|
/* for later check */
|
||||||
pObj->DevAddr = LAN8742_MAX_DEV_ADDR + 1;
|
pObj->DevAddr = LAN8742_MAX_DEV_ADDR + 1;
|
||||||
|
|
||||||
/* Get the device address from special mode register */
|
/* Get the device address from special mode register */
|
||||||
for(addr = 0; addr <= LAN8742_MAX_DEV_ADDR; addr ++)
|
for (addr = 0; addr <= LAN8742_MAX_DEV_ADDR; addr++) {
|
||||||
{
|
if (pObj->IO.ReadReg(addr, LAN8742_SMR, ®value) < 0) {
|
||||||
if(pObj->IO.ReadReg(addr, LAN8742_SMR, ®value) < 0)
|
status = LAN8742_STATUS_READ_ERROR;
|
||||||
{
|
/* Can't read from this device address
|
||||||
status = LAN8742_STATUS_READ_ERROR;
|
continue with next address */
|
||||||
/* Can't read from this device address
|
continue;
|
||||||
continue with next address */
|
}
|
||||||
continue;
|
|
||||||
}
|
|
||||||
|
|
||||||
if((regvalue & LAN8742_SMR_PHY_ADDR) == addr)
|
if ((regvalue & LAN8742_SMR_PHY_ADDR) == addr) {
|
||||||
{
|
pObj->DevAddr = addr;
|
||||||
pObj->DevAddr = addr;
|
status = LAN8742_STATUS_OK;
|
||||||
status = LAN8742_STATUS_OK;
|
break;
|
||||||
break;
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
if(pObj->DevAddr > LAN8742_MAX_DEV_ADDR)
|
if (pObj->DevAddr > LAN8742_MAX_DEV_ADDR) {
|
||||||
{
|
status = LAN8742_STATUS_ADDRESS_ERROR;
|
||||||
status = LAN8742_STATUS_ADDRESS_ERROR;
|
}
|
||||||
}
|
|
||||||
|
|
||||||
/* if device address is matched */
|
/* if device address is matched */
|
||||||
if(status == LAN8742_STATUS_OK)
|
if (status == LAN8742_STATUS_OK) {
|
||||||
{
|
/* set a software reset */
|
||||||
/* set a software reset */
|
if (pObj->IO.WriteReg(pObj->DevAddr, LAN8742_BCR,
|
||||||
if(pObj->IO.WriteReg(pObj->DevAddr, LAN8742_BCR, LAN8742_BCR_SOFT_RESET) >= 0)
|
LAN8742_BCR_SOFT_RESET) >= 0) {
|
||||||
{
|
/* get software reset status */
|
||||||
/* get software reset status */
|
if (pObj->IO.ReadReg(pObj->DevAddr, LAN8742_BCR, ®value) >= 0) {
|
||||||
if(pObj->IO.ReadReg(pObj->DevAddr, LAN8742_BCR, ®value) >= 0)
|
tickstart = pObj->IO.GetTick();
|
||||||
{
|
|
||||||
tickstart = pObj->IO.GetTick();
|
|
||||||
|
|
||||||
/* wait until software reset is done or timeout occured */
|
/* wait until software reset is done or timeout occured */
|
||||||
while(regvalue & LAN8742_BCR_SOFT_RESET)
|
while (regvalue & LAN8742_BCR_SOFT_RESET) {
|
||||||
{
|
if ((pObj->IO.GetTick() - tickstart) <= LAN8742_SW_RESET_TO) {
|
||||||
if((pObj->IO.GetTick() - tickstart) <= LAN8742_SW_RESET_TO)
|
if (pObj->IO.ReadReg(pObj->DevAddr, LAN8742_BCR, ®value) < 0) {
|
||||||
{
|
status = LAN8742_STATUS_READ_ERROR;
|
||||||
if(pObj->IO.ReadReg(pObj->DevAddr, LAN8742_BCR, ®value) < 0)
|
break;
|
||||||
{
|
}
|
||||||
status = LAN8742_STATUS_READ_ERROR;
|
} else {
|
||||||
break;
|
status = LAN8742_STATUS_RESET_TIMEOUT;
|
||||||
}
|
break;
|
||||||
}
|
}
|
||||||
else
|
}
|
||||||
{
|
} else {
|
||||||
status = LAN8742_STATUS_RESET_TIMEOUT;
|
status = LAN8742_STATUS_READ_ERROR;
|
||||||
break;
|
}
|
||||||
}
|
} else {
|
||||||
}
|
status = LAN8742_STATUS_WRITE_ERROR;
|
||||||
}
|
}
|
||||||
else
|
}
|
||||||
{
|
}
|
||||||
status = LAN8742_STATUS_READ_ERROR;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
status = LAN8742_STATUS_WRITE_ERROR;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if(status == LAN8742_STATUS_OK)
|
if (status == LAN8742_STATUS_OK) {
|
||||||
{
|
tickstart = pObj->IO.GetTick();
|
||||||
tickstart = pObj->IO.GetTick();
|
|
||||||
|
|
||||||
/* Wait for 2s to perform initialization */
|
/* Wait for 2s to perform initialization */
|
||||||
while((pObj->IO.GetTick() - tickstart) <= LAN8742_INIT_TO)
|
while ((pObj->IO.GetTick() - tickstart) <= LAN8742_INIT_TO) {
|
||||||
{
|
}
|
||||||
}
|
pObj->Is_Initialized = 1;
|
||||||
pObj->Is_Initialized = 1;
|
}
|
||||||
}
|
|
||||||
|
|
||||||
return status;
|
return status;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief De-Initialize the lan8742 and it's hardware resources
|
* @brief De-Initialize the lan8742 and it's hardware resources
|
||||||
* @param pObj: device object LAN8742_Object_t.
|
* @param pObj: device object LAN8742_Object_t.
|
||||||
* @retval None
|
* @retval None
|
||||||
*/
|
*/
|
||||||
int32_t LAN8742_DeInit(lan8742_Object_t *pObj)
|
int32_t LAN8742_DeInit(lan8742_Object_t *pObj) {
|
||||||
{
|
if (pObj->Is_Initialized) {
|
||||||
if(pObj->Is_Initialized)
|
if (pObj->IO.DeInit != 0) {
|
||||||
{
|
if (pObj->IO.DeInit() < 0) {
|
||||||
if(pObj->IO.DeInit != 0)
|
|
||||||
{
|
|
||||||
if(pObj->IO.DeInit() < 0)
|
|
||||||
{
|
|
||||||
return LAN8742_STATUS_ERROR;
|
return LAN8742_STATUS_ERROR;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -204,29 +178,24 @@ int32_t LAN8742_DeInit(lan8742_Object_t *pObj)
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Disable the LAN8742 power down mode.
|
* @brief Disable the LAN8742 power down mode.
|
||||||
* @param pObj: device object LAN8742_Object_t.
|
* @param pObj: device object LAN8742_Object_t.
|
||||||
* @retval LAN8742_STATUS_OK if OK
|
* @retval LAN8742_STATUS_OK if OK
|
||||||
* LAN8742_STATUS_READ_ERROR if connot read register
|
* LAN8742_STATUS_READ_ERROR if connot read register
|
||||||
* LAN8742_STATUS_WRITE_ERROR if connot write to register
|
* LAN8742_STATUS_WRITE_ERROR if connot write to register
|
||||||
*/
|
*/
|
||||||
int32_t LAN8742_DisablePowerDownMode(lan8742_Object_t *pObj)
|
int32_t LAN8742_DisablePowerDownMode(lan8742_Object_t *pObj) {
|
||||||
{
|
|
||||||
uint32_t readval = 0;
|
uint32_t readval = 0;
|
||||||
int32_t status = LAN8742_STATUS_OK;
|
int32_t status = LAN8742_STATUS_OK;
|
||||||
|
|
||||||
if(pObj->IO.ReadReg(pObj->DevAddr, LAN8742_BCR, &readval) >= 0)
|
if (pObj->IO.ReadReg(pObj->DevAddr, LAN8742_BCR, &readval) >= 0) {
|
||||||
{
|
|
||||||
readval &= ~LAN8742_BCR_POWER_DOWN;
|
readval &= ~LAN8742_BCR_POWER_DOWN;
|
||||||
|
|
||||||
/* Apply configuration */
|
/* Apply configuration */
|
||||||
if(pObj->IO.WriteReg(pObj->DevAddr, LAN8742_BCR, readval) < 0)
|
if (pObj->IO.WriteReg(pObj->DevAddr, LAN8742_BCR, readval) < 0) {
|
||||||
{
|
status = LAN8742_STATUS_WRITE_ERROR;
|
||||||
status = LAN8742_STATUS_WRITE_ERROR;
|
|
||||||
}
|
}
|
||||||
}
|
} else {
|
||||||
else
|
|
||||||
{
|
|
||||||
status = LAN8742_STATUS_READ_ERROR;
|
status = LAN8742_STATUS_READ_ERROR;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -234,29 +203,24 @@ int32_t LAN8742_DisablePowerDownMode(lan8742_Object_t *pObj)
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Enable the LAN8742 power down mode.
|
* @brief Enable the LAN8742 power down mode.
|
||||||
* @param pObj: device object LAN8742_Object_t.
|
* @param pObj: device object LAN8742_Object_t.
|
||||||
* @retval LAN8742_STATUS_OK if OK
|
* @retval LAN8742_STATUS_OK if OK
|
||||||
* LAN8742_STATUS_READ_ERROR if connot read register
|
* LAN8742_STATUS_READ_ERROR if connot read register
|
||||||
* LAN8742_STATUS_WRITE_ERROR if connot write to register
|
* LAN8742_STATUS_WRITE_ERROR if connot write to register
|
||||||
*/
|
*/
|
||||||
int32_t LAN8742_EnablePowerDownMode(lan8742_Object_t *pObj)
|
int32_t LAN8742_EnablePowerDownMode(lan8742_Object_t *pObj) {
|
||||||
{
|
|
||||||
uint32_t readval = 0;
|
uint32_t readval = 0;
|
||||||
int32_t status = LAN8742_STATUS_OK;
|
int32_t status = LAN8742_STATUS_OK;
|
||||||
|
|
||||||
if(pObj->IO.ReadReg(pObj->DevAddr, LAN8742_BCR, &readval) >= 0)
|
if (pObj->IO.ReadReg(pObj->DevAddr, LAN8742_BCR, &readval) >= 0) {
|
||||||
{
|
|
||||||
readval |= LAN8742_BCR_POWER_DOWN;
|
readval |= LAN8742_BCR_POWER_DOWN;
|
||||||
|
|
||||||
/* Apply configuration */
|
/* Apply configuration */
|
||||||
if(pObj->IO.WriteReg(pObj->DevAddr, LAN8742_BCR, readval) < 0)
|
if (pObj->IO.WriteReg(pObj->DevAddr, LAN8742_BCR, readval) < 0) {
|
||||||
{
|
status = LAN8742_STATUS_WRITE_ERROR;
|
||||||
status = LAN8742_STATUS_WRITE_ERROR;
|
|
||||||
}
|
}
|
||||||
}
|
} else {
|
||||||
else
|
|
||||||
{
|
|
||||||
status = LAN8742_STATUS_READ_ERROR;
|
status = LAN8742_STATUS_READ_ERROR;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -264,29 +228,24 @@ int32_t LAN8742_EnablePowerDownMode(lan8742_Object_t *pObj)
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Start the auto negotiation process.
|
* @brief Start the auto negotiation process.
|
||||||
* @param pObj: device object LAN8742_Object_t.
|
* @param pObj: device object LAN8742_Object_t.
|
||||||
* @retval LAN8742_STATUS_OK if OK
|
* @retval LAN8742_STATUS_OK if OK
|
||||||
* LAN8742_STATUS_READ_ERROR if connot read register
|
* LAN8742_STATUS_READ_ERROR if connot read register
|
||||||
* LAN8742_STATUS_WRITE_ERROR if connot write to register
|
* LAN8742_STATUS_WRITE_ERROR if connot write to register
|
||||||
*/
|
*/
|
||||||
int32_t LAN8742_StartAutoNego(lan8742_Object_t *pObj)
|
int32_t LAN8742_StartAutoNego(lan8742_Object_t *pObj) {
|
||||||
{
|
|
||||||
uint32_t readval = 0;
|
uint32_t readval = 0;
|
||||||
int32_t status = LAN8742_STATUS_OK;
|
int32_t status = LAN8742_STATUS_OK;
|
||||||
|
|
||||||
if(pObj->IO.ReadReg(pObj->DevAddr, LAN8742_BCR, &readval) >= 0)
|
if (pObj->IO.ReadReg(pObj->DevAddr, LAN8742_BCR, &readval) >= 0) {
|
||||||
{
|
|
||||||
readval |= LAN8742_BCR_AUTONEGO_EN;
|
readval |= LAN8742_BCR_AUTONEGO_EN;
|
||||||
|
|
||||||
/* Apply configuration */
|
/* Apply configuration */
|
||||||
if(pObj->IO.WriteReg(pObj->DevAddr, LAN8742_BCR, readval) < 0)
|
if (pObj->IO.WriteReg(pObj->DevAddr, LAN8742_BCR, readval) < 0) {
|
||||||
{
|
status = LAN8742_STATUS_WRITE_ERROR;
|
||||||
status = LAN8742_STATUS_WRITE_ERROR;
|
|
||||||
}
|
}
|
||||||
}
|
} else {
|
||||||
else
|
|
||||||
{
|
|
||||||
status = LAN8742_STATUS_READ_ERROR;
|
status = LAN8742_STATUS_READ_ERROR;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -294,148 +253,117 @@ int32_t LAN8742_StartAutoNego(lan8742_Object_t *pObj)
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Get the link state of LAN8742 device.
|
* @brief Get the link state of LAN8742 device.
|
||||||
* @param pObj: Pointer to device object.
|
* @param pObj: Pointer to device object.
|
||||||
* @param pLinkState: Pointer to link state
|
* @param pLinkState: Pointer to link state
|
||||||
* @retval LAN8742_STATUS_LINK_DOWN if link is down
|
* @retval LAN8742_STATUS_LINK_DOWN if link is down
|
||||||
* LAN8742_STATUS_AUTONEGO_NOTDONE if Auto nego not completed
|
* LAN8742_STATUS_AUTONEGO_NOTDONE if Auto nego not completed
|
||||||
* LAN8742_STATUS_100MBITS_FULLDUPLEX if 100Mb/s FD
|
* LAN8742_STATUS_100MBITS_FULLDUPLEX if 100Mb/s FD
|
||||||
* LAN8742_STATUS_100MBITS_HALFDUPLEX if 100Mb/s HD
|
* LAN8742_STATUS_100MBITS_HALFDUPLEX if 100Mb/s HD
|
||||||
* LAN8742_STATUS_10MBITS_FULLDUPLEX if 10Mb/s FD
|
* LAN8742_STATUS_10MBITS_FULLDUPLEX if 10Mb/s FD
|
||||||
* LAN8742_STATUS_10MBITS_HALFDUPLEX if 10Mb/s HD
|
* LAN8742_STATUS_10MBITS_HALFDUPLEX if 10Mb/s HD
|
||||||
* LAN8742_STATUS_READ_ERROR if connot read register
|
* LAN8742_STATUS_READ_ERROR if connot read register
|
||||||
* LAN8742_STATUS_WRITE_ERROR if connot write to register
|
* LAN8742_STATUS_WRITE_ERROR if connot write to register
|
||||||
*/
|
*/
|
||||||
int32_t LAN8742_GetLinkState(lan8742_Object_t *pObj)
|
int32_t LAN8742_GetLinkState(lan8742_Object_t *pObj) {
|
||||||
{
|
|
||||||
uint32_t readval = 0;
|
uint32_t readval = 0;
|
||||||
|
|
||||||
/* Read Status register */
|
/* Read Status register */
|
||||||
if(pObj->IO.ReadReg(pObj->DevAddr, LAN8742_BSR, &readval) < 0)
|
if (pObj->IO.ReadReg(pObj->DevAddr, LAN8742_BSR, &readval) < 0) {
|
||||||
{
|
|
||||||
return LAN8742_STATUS_READ_ERROR;
|
return LAN8742_STATUS_READ_ERROR;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Read Status register again */
|
/* Read Status register again */
|
||||||
if(pObj->IO.ReadReg(pObj->DevAddr, LAN8742_BSR, &readval) < 0)
|
if (pObj->IO.ReadReg(pObj->DevAddr, LAN8742_BSR, &readval) < 0) {
|
||||||
{
|
|
||||||
return LAN8742_STATUS_READ_ERROR;
|
return LAN8742_STATUS_READ_ERROR;
|
||||||
}
|
}
|
||||||
|
|
||||||
if((readval & LAN8742_BSR_LINK_STATUS) == 0)
|
if ((readval & LAN8742_BSR_LINK_STATUS) == 0) {
|
||||||
{
|
|
||||||
/* Return Link Down status */
|
/* Return Link Down status */
|
||||||
return LAN8742_STATUS_LINK_DOWN;
|
return LAN8742_STATUS_LINK_DOWN;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Check Auto negotiaition */
|
/* Check Auto negotiaition */
|
||||||
if(pObj->IO.ReadReg(pObj->DevAddr, LAN8742_BCR, &readval) < 0)
|
if (pObj->IO.ReadReg(pObj->DevAddr, LAN8742_BCR, &readval) < 0) {
|
||||||
{
|
|
||||||
return LAN8742_STATUS_READ_ERROR;
|
return LAN8742_STATUS_READ_ERROR;
|
||||||
}
|
}
|
||||||
|
|
||||||
if((readval & LAN8742_BCR_AUTONEGO_EN) != LAN8742_BCR_AUTONEGO_EN)
|
if ((readval & LAN8742_BCR_AUTONEGO_EN) != LAN8742_BCR_AUTONEGO_EN) {
|
||||||
{
|
if (((readval & LAN8742_BCR_SPEED_SELECT) == LAN8742_BCR_SPEED_SELECT) &&
|
||||||
if(((readval & LAN8742_BCR_SPEED_SELECT) == LAN8742_BCR_SPEED_SELECT) && ((readval & LAN8742_BCR_DUPLEX_MODE) == LAN8742_BCR_DUPLEX_MODE))
|
((readval & LAN8742_BCR_DUPLEX_MODE) == LAN8742_BCR_DUPLEX_MODE)) {
|
||||||
{
|
|
||||||
return LAN8742_STATUS_100MBITS_FULLDUPLEX;
|
return LAN8742_STATUS_100MBITS_FULLDUPLEX;
|
||||||
}
|
} else if ((readval & LAN8742_BCR_SPEED_SELECT) ==
|
||||||
else if ((readval & LAN8742_BCR_SPEED_SELECT) == LAN8742_BCR_SPEED_SELECT)
|
LAN8742_BCR_SPEED_SELECT) {
|
||||||
{
|
|
||||||
return LAN8742_STATUS_100MBITS_HALFDUPLEX;
|
return LAN8742_STATUS_100MBITS_HALFDUPLEX;
|
||||||
}
|
} else if ((readval & LAN8742_BCR_DUPLEX_MODE) == LAN8742_BCR_DUPLEX_MODE) {
|
||||||
else if ((readval & LAN8742_BCR_DUPLEX_MODE) == LAN8742_BCR_DUPLEX_MODE)
|
|
||||||
{
|
|
||||||
return LAN8742_STATUS_10MBITS_FULLDUPLEX;
|
return LAN8742_STATUS_10MBITS_FULLDUPLEX;
|
||||||
}
|
} else {
|
||||||
else
|
|
||||||
{
|
|
||||||
return LAN8742_STATUS_10MBITS_HALFDUPLEX;
|
return LAN8742_STATUS_10MBITS_HALFDUPLEX;
|
||||||
}
|
}
|
||||||
}
|
} else /* Auto Nego enabled */
|
||||||
else /* Auto Nego enabled */
|
|
||||||
{
|
{
|
||||||
if(pObj->IO.ReadReg(pObj->DevAddr, LAN8742_PHYSCSR, &readval) < 0)
|
if (pObj->IO.ReadReg(pObj->DevAddr, LAN8742_PHYSCSR, &readval) < 0) {
|
||||||
{
|
|
||||||
return LAN8742_STATUS_READ_ERROR;
|
return LAN8742_STATUS_READ_ERROR;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Check if auto nego not done */
|
/* Check if auto nego not done */
|
||||||
if((readval & LAN8742_PHYSCSR_AUTONEGO_DONE) == 0)
|
if ((readval & LAN8742_PHYSCSR_AUTONEGO_DONE) == 0) {
|
||||||
{
|
|
||||||
return LAN8742_STATUS_AUTONEGO_NOTDONE;
|
return LAN8742_STATUS_AUTONEGO_NOTDONE;
|
||||||
}
|
}
|
||||||
|
|
||||||
if((readval & LAN8742_PHYSCSR_HCDSPEEDMASK) == LAN8742_PHYSCSR_100BTX_FD)
|
if ((readval & LAN8742_PHYSCSR_HCDSPEEDMASK) == LAN8742_PHYSCSR_100BTX_FD) {
|
||||||
{
|
|
||||||
return LAN8742_STATUS_100MBITS_FULLDUPLEX;
|
return LAN8742_STATUS_100MBITS_FULLDUPLEX;
|
||||||
}
|
} else if ((readval & LAN8742_PHYSCSR_HCDSPEEDMASK) ==
|
||||||
else if ((readval & LAN8742_PHYSCSR_HCDSPEEDMASK) == LAN8742_PHYSCSR_100BTX_HD)
|
LAN8742_PHYSCSR_100BTX_HD) {
|
||||||
{
|
|
||||||
return LAN8742_STATUS_100MBITS_HALFDUPLEX;
|
return LAN8742_STATUS_100MBITS_HALFDUPLEX;
|
||||||
}
|
} else if ((readval & LAN8742_PHYSCSR_HCDSPEEDMASK) ==
|
||||||
else if ((readval & LAN8742_PHYSCSR_HCDSPEEDMASK) == LAN8742_PHYSCSR_10BT_FD)
|
LAN8742_PHYSCSR_10BT_FD) {
|
||||||
{
|
|
||||||
return LAN8742_STATUS_10MBITS_FULLDUPLEX;
|
return LAN8742_STATUS_10MBITS_FULLDUPLEX;
|
||||||
}
|
} else {
|
||||||
else
|
|
||||||
{
|
|
||||||
return LAN8742_STATUS_10MBITS_HALFDUPLEX;
|
return LAN8742_STATUS_10MBITS_HALFDUPLEX;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Set the link state of LAN8742 device.
|
* @brief Set the link state of LAN8742 device.
|
||||||
* @param pObj: Pointer to device object.
|
* @param pObj: Pointer to device object.
|
||||||
* @param pLinkState: link state can be one of the following
|
* @param pLinkState: link state can be one of the following
|
||||||
* LAN8742_STATUS_100MBITS_FULLDUPLEX if 100Mb/s FD
|
* LAN8742_STATUS_100MBITS_FULLDUPLEX if 100Mb/s FD
|
||||||
* LAN8742_STATUS_100MBITS_HALFDUPLEX if 100Mb/s HD
|
* LAN8742_STATUS_100MBITS_HALFDUPLEX if 100Mb/s HD
|
||||||
* LAN8742_STATUS_10MBITS_FULLDUPLEX if 10Mb/s FD
|
* LAN8742_STATUS_10MBITS_FULLDUPLEX if 10Mb/s FD
|
||||||
* LAN8742_STATUS_10MBITS_HALFDUPLEX if 10Mb/s HD
|
* LAN8742_STATUS_10MBITS_HALFDUPLEX if 10Mb/s HD
|
||||||
* @retval LAN8742_STATUS_OK if OK
|
* @retval LAN8742_STATUS_OK if OK
|
||||||
* LAN8742_STATUS_ERROR if parameter error
|
* LAN8742_STATUS_ERROR if parameter error
|
||||||
* LAN8742_STATUS_READ_ERROR if connot read register
|
* LAN8742_STATUS_READ_ERROR if connot read register
|
||||||
* LAN8742_STATUS_WRITE_ERROR if connot write to register
|
* LAN8742_STATUS_WRITE_ERROR if connot write to register
|
||||||
*/
|
*/
|
||||||
int32_t LAN8742_SetLinkState(lan8742_Object_t *pObj, uint32_t LinkState)
|
int32_t LAN8742_SetLinkState(lan8742_Object_t *pObj, uint32_t LinkState) {
|
||||||
{
|
|
||||||
uint32_t bcrvalue = 0;
|
uint32_t bcrvalue = 0;
|
||||||
int32_t status = LAN8742_STATUS_OK;
|
int32_t status = LAN8742_STATUS_OK;
|
||||||
|
|
||||||
if(pObj->IO.ReadReg(pObj->DevAddr, LAN8742_BCR, &bcrvalue) >= 0)
|
if (pObj->IO.ReadReg(pObj->DevAddr, LAN8742_BCR, &bcrvalue) >= 0) {
|
||||||
{
|
|
||||||
/* Disable link config (Auto nego, speed and duplex) */
|
/* Disable link config (Auto nego, speed and duplex) */
|
||||||
bcrvalue &= ~(LAN8742_BCR_AUTONEGO_EN | LAN8742_BCR_SPEED_SELECT | LAN8742_BCR_DUPLEX_MODE);
|
bcrvalue &= ~(LAN8742_BCR_AUTONEGO_EN | LAN8742_BCR_SPEED_SELECT |
|
||||||
|
LAN8742_BCR_DUPLEX_MODE);
|
||||||
|
|
||||||
if(LinkState == LAN8742_STATUS_100MBITS_FULLDUPLEX)
|
if (LinkState == LAN8742_STATUS_100MBITS_FULLDUPLEX) {
|
||||||
{
|
|
||||||
bcrvalue |= (LAN8742_BCR_SPEED_SELECT | LAN8742_BCR_DUPLEX_MODE);
|
bcrvalue |= (LAN8742_BCR_SPEED_SELECT | LAN8742_BCR_DUPLEX_MODE);
|
||||||
}
|
} else if (LinkState == LAN8742_STATUS_100MBITS_HALFDUPLEX) {
|
||||||
else if (LinkState == LAN8742_STATUS_100MBITS_HALFDUPLEX)
|
|
||||||
{
|
|
||||||
bcrvalue |= LAN8742_BCR_SPEED_SELECT;
|
bcrvalue |= LAN8742_BCR_SPEED_SELECT;
|
||||||
}
|
} else if (LinkState == LAN8742_STATUS_10MBITS_FULLDUPLEX) {
|
||||||
else if (LinkState == LAN8742_STATUS_10MBITS_FULLDUPLEX)
|
|
||||||
{
|
|
||||||
bcrvalue |= LAN8742_BCR_DUPLEX_MODE;
|
bcrvalue |= LAN8742_BCR_DUPLEX_MODE;
|
||||||
}
|
} else {
|
||||||
else
|
|
||||||
{
|
|
||||||
/* Wrong link status parameter */
|
/* Wrong link status parameter */
|
||||||
status = LAN8742_STATUS_ERROR;
|
status = LAN8742_STATUS_ERROR;
|
||||||
}
|
}
|
||||||
}
|
} else {
|
||||||
else
|
|
||||||
{
|
|
||||||
status = LAN8742_STATUS_READ_ERROR;
|
status = LAN8742_STATUS_READ_ERROR;
|
||||||
}
|
}
|
||||||
|
|
||||||
if(status == LAN8742_STATUS_OK)
|
if (status == LAN8742_STATUS_OK) {
|
||||||
{
|
|
||||||
/* Apply configuration */
|
/* Apply configuration */
|
||||||
if(pObj->IO.WriteReg(pObj->DevAddr, LAN8742_BCR, bcrvalue) < 0)
|
if (pObj->IO.WriteReg(pObj->DevAddr, LAN8742_BCR, bcrvalue) < 0) {
|
||||||
{
|
|
||||||
status = LAN8742_STATUS_WRITE_ERROR;
|
status = LAN8742_STATUS_WRITE_ERROR;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -444,29 +372,24 @@ int32_t LAN8742_SetLinkState(lan8742_Object_t *pObj, uint32_t LinkState)
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Enable loopback mode.
|
* @brief Enable loopback mode.
|
||||||
* @param pObj: Pointer to device object.
|
* @param pObj: Pointer to device object.
|
||||||
* @retval LAN8742_STATUS_OK if OK
|
* @retval LAN8742_STATUS_OK if OK
|
||||||
* LAN8742_STATUS_READ_ERROR if connot read register
|
* LAN8742_STATUS_READ_ERROR if connot read register
|
||||||
* LAN8742_STATUS_WRITE_ERROR if connot write to register
|
* LAN8742_STATUS_WRITE_ERROR if connot write to register
|
||||||
*/
|
*/
|
||||||
int32_t LAN8742_EnableLoopbackMode(lan8742_Object_t *pObj)
|
int32_t LAN8742_EnableLoopbackMode(lan8742_Object_t *pObj) {
|
||||||
{
|
|
||||||
uint32_t readval = 0;
|
uint32_t readval = 0;
|
||||||
int32_t status = LAN8742_STATUS_OK;
|
int32_t status = LAN8742_STATUS_OK;
|
||||||
|
|
||||||
if(pObj->IO.ReadReg(pObj->DevAddr, LAN8742_BCR, &readval) >= 0)
|
if (pObj->IO.ReadReg(pObj->DevAddr, LAN8742_BCR, &readval) >= 0) {
|
||||||
{
|
|
||||||
readval |= LAN8742_BCR_LOOPBACK;
|
readval |= LAN8742_BCR_LOOPBACK;
|
||||||
|
|
||||||
/* Apply configuration */
|
/* Apply configuration */
|
||||||
if(pObj->IO.WriteReg(pObj->DevAddr, LAN8742_BCR, readval) < 0)
|
if (pObj->IO.WriteReg(pObj->DevAddr, LAN8742_BCR, readval) < 0) {
|
||||||
{
|
|
||||||
status = LAN8742_STATUS_WRITE_ERROR;
|
status = LAN8742_STATUS_WRITE_ERROR;
|
||||||
}
|
}
|
||||||
}
|
} else {
|
||||||
else
|
|
||||||
{
|
|
||||||
status = LAN8742_STATUS_READ_ERROR;
|
status = LAN8742_STATUS_READ_ERROR;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -474,29 +397,24 @@ int32_t LAN8742_EnableLoopbackMode(lan8742_Object_t *pObj)
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Disable loopback mode.
|
* @brief Disable loopback mode.
|
||||||
* @param pObj: Pointer to device object.
|
* @param pObj: Pointer to device object.
|
||||||
* @retval LAN8742_STATUS_OK if OK
|
* @retval LAN8742_STATUS_OK if OK
|
||||||
* LAN8742_STATUS_READ_ERROR if connot read register
|
* LAN8742_STATUS_READ_ERROR if connot read register
|
||||||
* LAN8742_STATUS_WRITE_ERROR if connot write to register
|
* LAN8742_STATUS_WRITE_ERROR if connot write to register
|
||||||
*/
|
*/
|
||||||
int32_t LAN8742_DisableLoopbackMode(lan8742_Object_t *pObj)
|
int32_t LAN8742_DisableLoopbackMode(lan8742_Object_t *pObj) {
|
||||||
{
|
|
||||||
uint32_t readval = 0;
|
uint32_t readval = 0;
|
||||||
int32_t status = LAN8742_STATUS_OK;
|
int32_t status = LAN8742_STATUS_OK;
|
||||||
|
|
||||||
if(pObj->IO.ReadReg(pObj->DevAddr, LAN8742_BCR, &readval) >= 0)
|
if (pObj->IO.ReadReg(pObj->DevAddr, LAN8742_BCR, &readval) >= 0) {
|
||||||
{
|
|
||||||
readval &= ~LAN8742_BCR_LOOPBACK;
|
readval &= ~LAN8742_BCR_LOOPBACK;
|
||||||
|
|
||||||
/* Apply configuration */
|
/* Apply configuration */
|
||||||
if(pObj->IO.WriteReg(pObj->DevAddr, LAN8742_BCR, readval) < 0)
|
if (pObj->IO.WriteReg(pObj->DevAddr, LAN8742_BCR, readval) < 0) {
|
||||||
{
|
status = LAN8742_STATUS_WRITE_ERROR;
|
||||||
status = LAN8742_STATUS_WRITE_ERROR;
|
|
||||||
}
|
}
|
||||||
}
|
} else {
|
||||||
else
|
|
||||||
{
|
|
||||||
status = LAN8742_STATUS_READ_ERROR;
|
status = LAN8742_STATUS_READ_ERROR;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -504,39 +422,34 @@ int32_t LAN8742_DisableLoopbackMode(lan8742_Object_t *pObj)
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Enable IT source.
|
* @brief Enable IT source.
|
||||||
* @param pObj: Pointer to device object.
|
* @param pObj: Pointer to device object.
|
||||||
* @param Interrupt: IT source to be enabled
|
* @param Interrupt: IT source to be enabled
|
||||||
* should be a value or a combination of the following:
|
* should be a value or a combination of the following:
|
||||||
* LAN8742_WOL_IT
|
* LAN8742_WOL_IT
|
||||||
* LAN8742_ENERGYON_IT
|
* LAN8742_ENERGYON_IT
|
||||||
* LAN8742_AUTONEGO_COMPLETE_IT
|
* LAN8742_AUTONEGO_COMPLETE_IT
|
||||||
* LAN8742_REMOTE_FAULT_IT
|
* LAN8742_REMOTE_FAULT_IT
|
||||||
* LAN8742_LINK_DOWN_IT
|
* LAN8742_LINK_DOWN_IT
|
||||||
* LAN8742_AUTONEGO_LP_ACK_IT
|
* LAN8742_AUTONEGO_LP_ACK_IT
|
||||||
* LAN8742_PARALLEL_DETECTION_FAULT_IT
|
* LAN8742_PARALLEL_DETECTION_FAULT_IT
|
||||||
* LAN8742_AUTONEGO_PAGE_RECEIVED_IT
|
* LAN8742_AUTONEGO_PAGE_RECEIVED_IT
|
||||||
* @retval LAN8742_STATUS_OK if OK
|
* @retval LAN8742_STATUS_OK if OK
|
||||||
* LAN8742_STATUS_READ_ERROR if connot read register
|
* LAN8742_STATUS_READ_ERROR if connot read register
|
||||||
* LAN8742_STATUS_WRITE_ERROR if connot write to register
|
* LAN8742_STATUS_WRITE_ERROR if connot write to register
|
||||||
*/
|
*/
|
||||||
int32_t LAN8742_EnableIT(lan8742_Object_t *pObj, uint32_t Interrupt)
|
int32_t LAN8742_EnableIT(lan8742_Object_t *pObj, uint32_t Interrupt) {
|
||||||
{
|
|
||||||
uint32_t readval = 0;
|
uint32_t readval = 0;
|
||||||
int32_t status = LAN8742_STATUS_OK;
|
int32_t status = LAN8742_STATUS_OK;
|
||||||
|
|
||||||
if(pObj->IO.ReadReg(pObj->DevAddr, LAN8742_IMR, &readval) >= 0)
|
if (pObj->IO.ReadReg(pObj->DevAddr, LAN8742_IMR, &readval) >= 0) {
|
||||||
{
|
|
||||||
readval |= Interrupt;
|
readval |= Interrupt;
|
||||||
|
|
||||||
/* Apply configuration */
|
/* Apply configuration */
|
||||||
if(pObj->IO.WriteReg(pObj->DevAddr, LAN8742_IMR, readval) < 0)
|
if (pObj->IO.WriteReg(pObj->DevAddr, LAN8742_IMR, readval) < 0) {
|
||||||
{
|
status = LAN8742_STATUS_WRITE_ERROR;
|
||||||
status = LAN8742_STATUS_WRITE_ERROR;
|
|
||||||
}
|
}
|
||||||
}
|
} else {
|
||||||
else
|
|
||||||
{
|
|
||||||
status = LAN8742_STATUS_READ_ERROR;
|
status = LAN8742_STATUS_READ_ERROR;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -544,39 +457,34 @@ int32_t LAN8742_EnableIT(lan8742_Object_t *pObj, uint32_t Interrupt)
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Disable IT source.
|
* @brief Disable IT source.
|
||||||
* @param pObj: Pointer to device object.
|
* @param pObj: Pointer to device object.
|
||||||
* @param Interrupt: IT source to be disabled
|
* @param Interrupt: IT source to be disabled
|
||||||
* should be a value or a combination of the following:
|
* should be a value or a combination of the following:
|
||||||
* LAN8742_WOL_IT
|
* LAN8742_WOL_IT
|
||||||
* LAN8742_ENERGYON_IT
|
* LAN8742_ENERGYON_IT
|
||||||
* LAN8742_AUTONEGO_COMPLETE_IT
|
* LAN8742_AUTONEGO_COMPLETE_IT
|
||||||
* LAN8742_REMOTE_FAULT_IT
|
* LAN8742_REMOTE_FAULT_IT
|
||||||
* LAN8742_LINK_DOWN_IT
|
* LAN8742_LINK_DOWN_IT
|
||||||
* LAN8742_AUTONEGO_LP_ACK_IT
|
* LAN8742_AUTONEGO_LP_ACK_IT
|
||||||
* LAN8742_PARALLEL_DETECTION_FAULT_IT
|
* LAN8742_PARALLEL_DETECTION_FAULT_IT
|
||||||
* LAN8742_AUTONEGO_PAGE_RECEIVED_IT
|
* LAN8742_AUTONEGO_PAGE_RECEIVED_IT
|
||||||
* @retval LAN8742_STATUS_OK if OK
|
* @retval LAN8742_STATUS_OK if OK
|
||||||
* LAN8742_STATUS_READ_ERROR if connot read register
|
* LAN8742_STATUS_READ_ERROR if connot read register
|
||||||
* LAN8742_STATUS_WRITE_ERROR if connot write to register
|
* LAN8742_STATUS_WRITE_ERROR if connot write to register
|
||||||
*/
|
*/
|
||||||
int32_t LAN8742_DisableIT(lan8742_Object_t *pObj, uint32_t Interrupt)
|
int32_t LAN8742_DisableIT(lan8742_Object_t *pObj, uint32_t Interrupt) {
|
||||||
{
|
|
||||||
uint32_t readval = 0;
|
uint32_t readval = 0;
|
||||||
int32_t status = LAN8742_STATUS_OK;
|
int32_t status = LAN8742_STATUS_OK;
|
||||||
|
|
||||||
if(pObj->IO.ReadReg(pObj->DevAddr, LAN8742_IMR, &readval) >= 0)
|
if (pObj->IO.ReadReg(pObj->DevAddr, LAN8742_IMR, &readval) >= 0) {
|
||||||
{
|
|
||||||
readval &= ~Interrupt;
|
readval &= ~Interrupt;
|
||||||
|
|
||||||
/* Apply configuration */
|
/* Apply configuration */
|
||||||
if(pObj->IO.WriteReg(pObj->DevAddr, LAN8742_IMR, readval) < 0)
|
if (pObj->IO.WriteReg(pObj->DevAddr, LAN8742_IMR, readval) < 0) {
|
||||||
{
|
|
||||||
status = LAN8742_STATUS_WRITE_ERROR;
|
status = LAN8742_STATUS_WRITE_ERROR;
|
||||||
}
|
}
|
||||||
}
|
} else {
|
||||||
else
|
|
||||||
{
|
|
||||||
status = LAN8742_STATUS_READ_ERROR;
|
status = LAN8742_STATUS_READ_ERROR;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -584,62 +492,26 @@ int32_t LAN8742_DisableIT(lan8742_Object_t *pObj, uint32_t Interrupt)
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Clear IT flag.
|
* @brief Clear IT flag.
|
||||||
* @param pObj: Pointer to device object.
|
* @param pObj: Pointer to device object.
|
||||||
* @param Interrupt: IT flag to be cleared
|
* @param Interrupt: IT flag to be cleared
|
||||||
* should be a value or a combination of the following:
|
* should be a value or a combination of the following:
|
||||||
* LAN8742_WOL_IT
|
* LAN8742_WOL_IT
|
||||||
* LAN8742_ENERGYON_IT
|
* LAN8742_ENERGYON_IT
|
||||||
* LAN8742_AUTONEGO_COMPLETE_IT
|
* LAN8742_AUTONEGO_COMPLETE_IT
|
||||||
* LAN8742_REMOTE_FAULT_IT
|
* LAN8742_REMOTE_FAULT_IT
|
||||||
* LAN8742_LINK_DOWN_IT
|
* LAN8742_LINK_DOWN_IT
|
||||||
* LAN8742_AUTONEGO_LP_ACK_IT
|
* LAN8742_AUTONEGO_LP_ACK_IT
|
||||||
* LAN8742_PARALLEL_DETECTION_FAULT_IT
|
* LAN8742_PARALLEL_DETECTION_FAULT_IT
|
||||||
* LAN8742_AUTONEGO_PAGE_RECEIVED_IT
|
* LAN8742_AUTONEGO_PAGE_RECEIVED_IT
|
||||||
* @retval LAN8742_STATUS_OK if OK
|
* @retval LAN8742_STATUS_OK if OK
|
||||||
* LAN8742_STATUS_READ_ERROR if connot read register
|
* LAN8742_STATUS_READ_ERROR if connot read register
|
||||||
*/
|
*/
|
||||||
int32_t LAN8742_ClearIT(lan8742_Object_t *pObj, uint32_t Interrupt)
|
int32_t LAN8742_ClearIT(lan8742_Object_t *pObj, uint32_t Interrupt) {
|
||||||
{
|
|
||||||
uint32_t readval = 0;
|
uint32_t readval = 0;
|
||||||
int32_t status = LAN8742_STATUS_OK;
|
int32_t status = LAN8742_STATUS_OK;
|
||||||
|
|
||||||
if(pObj->IO.ReadReg(pObj->DevAddr, LAN8742_ISFR, &readval) < 0)
|
if (pObj->IO.ReadReg(pObj->DevAddr, LAN8742_ISFR, &readval) < 0) {
|
||||||
{
|
|
||||||
status = LAN8742_STATUS_READ_ERROR;
|
|
||||||
}
|
|
||||||
|
|
||||||
return status;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @brief Get IT Flag status.
|
|
||||||
* @param pObj: Pointer to device object.
|
|
||||||
* @param Interrupt: IT Flag to be checked,
|
|
||||||
* should be a value or a combination of the following:
|
|
||||||
* LAN8742_WOL_IT
|
|
||||||
* LAN8742_ENERGYON_IT
|
|
||||||
* LAN8742_AUTONEGO_COMPLETE_IT
|
|
||||||
* LAN8742_REMOTE_FAULT_IT
|
|
||||||
* LAN8742_LINK_DOWN_IT
|
|
||||||
* LAN8742_AUTONEGO_LP_ACK_IT
|
|
||||||
* LAN8742_PARALLEL_DETECTION_FAULT_IT
|
|
||||||
* LAN8742_AUTONEGO_PAGE_RECEIVED_IT
|
|
||||||
* @retval 1 IT flag is SET
|
|
||||||
* 0 IT flag is RESET
|
|
||||||
* LAN8742_STATUS_READ_ERROR if connot read register
|
|
||||||
*/
|
|
||||||
int32_t LAN8742_GetITStatus(lan8742_Object_t *pObj, uint32_t Interrupt)
|
|
||||||
{
|
|
||||||
uint32_t readval = 0;
|
|
||||||
int32_t status = 0;
|
|
||||||
|
|
||||||
if(pObj->IO.ReadReg(pObj->DevAddr, LAN8742_ISFR, &readval) >= 0)
|
|
||||||
{
|
|
||||||
status = ((readval & Interrupt) == Interrupt);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
status = LAN8742_STATUS_READ_ERROR;
|
status = LAN8742_STATUS_READ_ERROR;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -647,18 +519,48 @@ int32_t LAN8742_GetITStatus(lan8742_Object_t *pObj, uint32_t Interrupt)
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @}
|
* @brief Get IT Flag status.
|
||||||
*/
|
* @param pObj: Pointer to device object.
|
||||||
|
* @param Interrupt: IT Flag to be checked,
|
||||||
|
* should be a value or a combination of the following:
|
||||||
|
* LAN8742_WOL_IT
|
||||||
|
* LAN8742_ENERGYON_IT
|
||||||
|
* LAN8742_AUTONEGO_COMPLETE_IT
|
||||||
|
* LAN8742_REMOTE_FAULT_IT
|
||||||
|
* LAN8742_LINK_DOWN_IT
|
||||||
|
* LAN8742_AUTONEGO_LP_ACK_IT
|
||||||
|
* LAN8742_PARALLEL_DETECTION_FAULT_IT
|
||||||
|
* LAN8742_AUTONEGO_PAGE_RECEIVED_IT
|
||||||
|
* @retval 1 IT flag is SET
|
||||||
|
* 0 IT flag is RESET
|
||||||
|
* LAN8742_STATUS_READ_ERROR if connot read register
|
||||||
|
*/
|
||||||
|
int32_t LAN8742_GetITStatus(lan8742_Object_t *pObj, uint32_t Interrupt) {
|
||||||
|
uint32_t readval = 0;
|
||||||
|
int32_t status = 0;
|
||||||
|
|
||||||
|
if (pObj->IO.ReadReg(pObj->DevAddr, LAN8742_ISFR, &readval) >= 0) {
|
||||||
|
status = ((readval & Interrupt) == Interrupt);
|
||||||
|
} else {
|
||||||
|
status = LAN8742_STATUS_READ_ERROR;
|
||||||
|
}
|
||||||
|
|
||||||
|
return status;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @}
|
* @}
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @}
|
* @}
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @}
|
* @}
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @}
|
||||||
|
*/
|
||||||
/************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/
|
/************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/
|
||||||
|
@ -1,43 +1,46 @@
|
|||||||
/**
|
/**
|
||||||
******************************************************************************
|
******************************************************************************
|
||||||
* @file stm32h7xx_hal_timebase_tim.c
|
* @file stm32h7xx_hal_timebase_tim.c
|
||||||
* @author MCD Application Team
|
* @author MCD Application Team
|
||||||
* @brief HAL time base based on the hardware TIM.
|
* @brief HAL time base based on the hardware TIM.
|
||||||
*
|
*
|
||||||
* This file overrides the native HAL time base functions (defined as weak)
|
* This file overrides the native HAL time base functions (defined as
|
||||||
* the TIM time base:
|
*weak) the TIM time base:
|
||||||
* + Intializes the TIM peripheral generate a Period elapsed Event each 1ms
|
* + Intializes the TIM peripheral generate a Period elapsed Event
|
||||||
* + HAL_IncTick is called inside HAL_TIM_PeriodElapsedCallback ie each 1ms
|
*each 1ms
|
||||||
*
|
* + HAL_IncTick is called inside HAL_TIM_PeriodElapsedCallback ie
|
||||||
******************************************************************************
|
*each 1ms
|
||||||
* @attention
|
*
|
||||||
*
|
******************************************************************************
|
||||||
* <h2><center>© COPYRIGHT(c) 2017 STMicroelectronics</center></h2>
|
* @attention
|
||||||
*
|
*
|
||||||
* Redistribution and use in source and binary forms, with or without modification,
|
* <h2><center>© COPYRIGHT(c) 2017 STMicroelectronics</center></h2>
|
||||||
* are permitted provided that the following conditions are met:
|
*
|
||||||
* 1. Redistributions of source code must retain the above copyright notice,
|
* Redistribution and use in source and binary forms, with or without
|
||||||
* this list of conditions and the following disclaimer.
|
*modification, are permitted provided that the following conditions are met:
|
||||||
* 2. Redistributions in binary form must reproduce the above copyright notice,
|
* 1. Redistributions of source code must retain the above copyright notice,
|
||||||
* this list of conditions and the following disclaimer in the documentation
|
* this list of conditions and the following disclaimer.
|
||||||
* and/or other materials provided with the distribution.
|
* 2. Redistributions in binary form must reproduce the above copyright
|
||||||
* 3. Neither the name of STMicroelectronics nor the names of its contributors
|
*notice, this list of conditions and the following disclaimer in the
|
||||||
* may be used to endorse or promote products derived from this software
|
*documentation and/or other materials provided with the distribution.
|
||||||
* without specific prior written permission.
|
* 3. Neither the name of STMicroelectronics nor the names of its contributors
|
||||||
*
|
* may be used to endorse or promote products derived from this software
|
||||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
* without specific prior written permission.
|
||||||
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
*
|
||||||
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
||||||
* DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
|
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||||
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||||
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
|
*ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
|
||||||
* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
|
*LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
||||||
* CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
|
*CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
||||||
* OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
*SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
||||||
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
*INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
||||||
*
|
*CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
||||||
******************************************************************************
|
*ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||||
*/
|
*POSSIBILITY OF SUCH DAMAGE.
|
||||||
|
*
|
||||||
|
******************************************************************************
|
||||||
|
*/
|
||||||
|
|
||||||
/* Includes ------------------------------------------------------------------*/
|
/* Includes ------------------------------------------------------------------*/
|
||||||
#include "stm32h7xx_hal.h"
|
#include "stm32h7xx_hal.h"
|
||||||
@ -46,29 +49,29 @@
|
|||||||
/* Private define ------------------------------------------------------------*/
|
/* Private define ------------------------------------------------------------*/
|
||||||
/* Private macro -------------------------------------------------------------*/
|
/* Private macro -------------------------------------------------------------*/
|
||||||
/* Private variables ---------------------------------------------------------*/
|
/* Private variables ---------------------------------------------------------*/
|
||||||
TIM_HandleTypeDef TimHandle;
|
TIM_HandleTypeDef TimHandle;
|
||||||
/* Private function prototypes -----------------------------------------------*/
|
/* Private function prototypes -----------------------------------------------*/
|
||||||
void TIM6_DAC_IRQHandler(void);
|
void TIM6_DAC_IRQHandler(void);
|
||||||
/* Private functions ---------------------------------------------------------*/
|
/* Private functions ---------------------------------------------------------*/
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief This function configures the TIM6 as a time base source.
|
* @brief This function configures the TIM6 as a time base source.
|
||||||
* The time source is configured to have 1ms time base with a dedicated
|
* The time source is configured to have 1ms time base with a dedicated
|
||||||
* Tick interrupt priority.
|
* Tick interrupt priority.
|
||||||
* @note This function is called automatically at the beginning of program after
|
* @note This function is called automatically at the beginning of program
|
||||||
* reset by HAL_Init() or at any time when clock is configured, by HAL_RCC_ClockConfig().
|
* after reset by HAL_Init() or at any time when clock is configured, by
|
||||||
* @param TickPriority: Tick interrupt priority.
|
* HAL_RCC_ClockConfig().
|
||||||
* @retval HAL status
|
* @param TickPriority: Tick interrupt priority.
|
||||||
*/
|
* @retval HAL status
|
||||||
HAL_StatusTypeDef HAL_InitTick (uint32_t TickPriority)
|
*/
|
||||||
{
|
HAL_StatusTypeDef HAL_InitTick(uint32_t TickPriority) {
|
||||||
RCC_ClkInitTypeDef clkconfig;
|
RCC_ClkInitTypeDef clkconfig;
|
||||||
uint32_t uwTimclock, uwAPB1Prescaler = 0U;
|
uint32_t uwTimclock, uwAPB1Prescaler = 0U;
|
||||||
uint32_t uwPrescalerValue = 0U;
|
uint32_t uwPrescalerValue = 0U;
|
||||||
uint32_t pFLatency;
|
uint32_t pFLatency;
|
||||||
|
|
||||||
/*Configure the TIM6 IRQ priority */
|
/*Configure the TIM6 IRQ priority */
|
||||||
HAL_NVIC_SetPriority(TIM6_DAC_IRQn, TickPriority ,0U);
|
HAL_NVIC_SetPriority(TIM6_DAC_IRQn, TickPriority, 0U);
|
||||||
|
|
||||||
/* Enable the TIM6 global Interrupt */
|
/* Enable the TIM6 global Interrupt */
|
||||||
HAL_NVIC_EnableIRQ(TIM6_DAC_IRQn);
|
HAL_NVIC_EnableIRQ(TIM6_DAC_IRQn);
|
||||||
@ -83,17 +86,14 @@ HAL_StatusTypeDef HAL_InitTick (uint32_t TickPriority)
|
|||||||
uwAPB1Prescaler = clkconfig.APB1CLKDivider;
|
uwAPB1Prescaler = clkconfig.APB1CLKDivider;
|
||||||
|
|
||||||
/* Compute TIM6 clock */
|
/* Compute TIM6 clock */
|
||||||
if (uwAPB1Prescaler == RCC_HCLK_DIV1)
|
if (uwAPB1Prescaler == RCC_HCLK_DIV1) {
|
||||||
{
|
|
||||||
uwTimclock = HAL_RCC_GetPCLK1Freq();
|
uwTimclock = HAL_RCC_GetPCLK1Freq();
|
||||||
}
|
} else {
|
||||||
else
|
uwTimclock = 2 * HAL_RCC_GetPCLK1Freq();
|
||||||
{
|
|
||||||
uwTimclock = 2*HAL_RCC_GetPCLK1Freq();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Compute the prescaler value to have TIM6 counter clock equal to 1MHz */
|
/* Compute the prescaler value to have TIM6 counter clock equal to 1MHz */
|
||||||
uwPrescalerValue = (uint32_t) ((uwTimclock / 1000000U) - 1U);
|
uwPrescalerValue = (uint32_t)((uwTimclock / 1000000U) - 1U);
|
||||||
|
|
||||||
/* Initialize TIM6 */
|
/* Initialize TIM6 */
|
||||||
TimHandle.Instance = TIM6;
|
TimHandle.Instance = TIM6;
|
||||||
@ -108,8 +108,7 @@ HAL_StatusTypeDef HAL_InitTick (uint32_t TickPriority)
|
|||||||
TimHandle.Init.Prescaler = uwPrescalerValue;
|
TimHandle.Init.Prescaler = uwPrescalerValue;
|
||||||
TimHandle.Init.ClockDivision = 0;
|
TimHandle.Init.ClockDivision = 0;
|
||||||
TimHandle.Init.CounterMode = TIM_COUNTERMODE_UP;
|
TimHandle.Init.CounterMode = TIM_COUNTERMODE_UP;
|
||||||
if(HAL_TIM_Base_Init(&TimHandle) == HAL_OK)
|
if (HAL_TIM_Base_Init(&TimHandle) == HAL_OK) {
|
||||||
{
|
|
||||||
/* Start the TIM time Base generation in interrupt mode */
|
/* Start the TIM time Base generation in interrupt mode */
|
||||||
return HAL_TIM_Base_Start_IT(&TimHandle);
|
return HAL_TIM_Base_Start_IT(&TimHandle);
|
||||||
}
|
}
|
||||||
@ -119,50 +118,42 @@ HAL_StatusTypeDef HAL_InitTick (uint32_t TickPriority)
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Suspend Tick increment.
|
* @brief Suspend Tick increment.
|
||||||
* @note Disable the tick increment by disabling TIM6 update interrupt.
|
* @note Disable the tick increment by disabling TIM6 update interrupt.
|
||||||
* @param None
|
* @param None
|
||||||
* @retval None
|
* @retval None
|
||||||
*/
|
*/
|
||||||
void HAL_SuspendTick(void)
|
void HAL_SuspendTick(void) {
|
||||||
{
|
|
||||||
/* Disable TIM6 update Interrupt */
|
/* Disable TIM6 update Interrupt */
|
||||||
__HAL_TIM_DISABLE_IT(&TimHandle, TIM_IT_UPDATE);
|
__HAL_TIM_DISABLE_IT(&TimHandle, TIM_IT_UPDATE);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Resume Tick increment.
|
* @brief Resume Tick increment.
|
||||||
* @note Enable the tick increment by Enabling TIM6 update interrupt.
|
* @note Enable the tick increment by Enabling TIM6 update interrupt.
|
||||||
* @param None
|
* @param None
|
||||||
* @retval None
|
* @retval None
|
||||||
*/
|
*/
|
||||||
void HAL_ResumeTick(void)
|
void HAL_ResumeTick(void) {
|
||||||
{
|
|
||||||
/* Enable TIM6 Update interrupt */
|
/* Enable TIM6 Update interrupt */
|
||||||
__HAL_TIM_ENABLE_IT(&TimHandle, TIM_IT_UPDATE);
|
__HAL_TIM_ENABLE_IT(&TimHandle, TIM_IT_UPDATE);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Period elapsed callback in non blocking mode
|
* @brief Period elapsed callback in non blocking mode
|
||||||
* @note This function is called when TIM6 interrupt took place, inside
|
* @note This function is called when TIM6 interrupt took place, inside
|
||||||
* HAL_TIM_IRQHandler(). It makes a direct call to HAL_IncTick() to increment
|
* HAL_TIM_IRQHandler(). It makes a direct call to HAL_IncTick() to increment
|
||||||
* a global variable "uwTick" used as application time base.
|
* a global variable "uwTick" used as application time base.
|
||||||
* @param htim : TIM handle
|
* @param htim : TIM handle
|
||||||
* @retval None
|
* @retval None
|
||||||
*/
|
*/
|
||||||
void HAL_TIM_PeriodElapsedCallback(TIM_HandleTypeDef *htim)
|
void HAL_TIM_PeriodElapsedCallback(TIM_HandleTypeDef *htim) { HAL_IncTick(); }
|
||||||
{
|
|
||||||
HAL_IncTick();
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief This function handles TIM interrupt request.
|
* @brief This function handles TIM interrupt request.
|
||||||
* @param None
|
* @param None
|
||||||
* @retval None
|
* @retval None
|
||||||
*/
|
*/
|
||||||
void TIM6_DAC_IRQHandler(void)
|
void TIM6_DAC_IRQHandler(void) { HAL_TIM_IRQHandler(&TimHandle); }
|
||||||
{
|
|
||||||
HAL_TIM_IRQHandler(&TimHandle);
|
|
||||||
}
|
|
||||||
|
|
||||||
/************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/
|
/************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/
|
||||||
|
@ -1,41 +1,42 @@
|
|||||||
/**
|
/**
|
||||||
******************************************************************************
|
******************************************************************************
|
||||||
* @file LwIP/LwIP_HTTP_Server_Netconn_RTOS/Src/stm32h7xx_it.c
|
* @file LwIP/LwIP_HTTP_Server_Netconn_RTOS/Src/stm32h7xx_it.c
|
||||||
* @author MCD Application Team
|
* @author MCD Application Team
|
||||||
* @brief Main Interrupt Service Routines.
|
* @brief Main Interrupt Service Routines.
|
||||||
******************************************************************************
|
******************************************************************************
|
||||||
* @attention
|
* @attention
|
||||||
*
|
*
|
||||||
* <h2><center>© COPYRIGHT(c) 2017 STMicroelectronics</center></h2>
|
* <h2><center>© COPYRIGHT(c) 2017 STMicroelectronics</center></h2>
|
||||||
*
|
*
|
||||||
* Redistribution and use in source and binary forms, with or without modification,
|
* Redistribution and use in source and binary forms, with or without
|
||||||
* are permitted provided that the following conditions are met:
|
*modification, are permitted provided that the following conditions are met:
|
||||||
* 1. Redistributions of source code must retain the above copyright notice,
|
* 1. Redistributions of source code must retain the above copyright notice,
|
||||||
* this list of conditions and the following disclaimer.
|
* this list of conditions and the following disclaimer.
|
||||||
* 2. Redistributions in binary form must reproduce the above copyright notice,
|
* 2. Redistributions in binary form must reproduce the above copyright
|
||||||
* this list of conditions and the following disclaimer in the documentation
|
*notice, this list of conditions and the following disclaimer in the
|
||||||
* and/or other materials provided with the distribution.
|
*documentation and/or other materials provided with the distribution.
|
||||||
* 3. Neither the name of STMicroelectronics nor the names of its contributors
|
* 3. Neither the name of STMicroelectronics nor the names of its contributors
|
||||||
* may be used to endorse or promote products derived from this software
|
* may be used to endorse or promote products derived from this software
|
||||||
* without specific prior written permission.
|
* without specific prior written permission.
|
||||||
*
|
*
|
||||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
||||||
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||||
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||||
* DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
|
*ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
|
||||||
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
*LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
||||||
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
|
*CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
||||||
* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
|
*SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
||||||
* CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
|
*INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
||||||
* OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
*CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
||||||
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
*ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||||
*
|
*POSSIBILITY OF SUCH DAMAGE.
|
||||||
******************************************************************************
|
*
|
||||||
*/
|
******************************************************************************
|
||||||
|
*/
|
||||||
|
|
||||||
/* Includes ------------------------------------------------------------------*/
|
/* Includes ------------------------------------------------------------------*/
|
||||||
#include "OBSWConfig.h"
|
|
||||||
#include "stm32h7xx_it.h"
|
#include "stm32h7xx_it.h"
|
||||||
|
#include "OBSWConfig.h"
|
||||||
|
|
||||||
#include "cmsis_os.h"
|
#include "cmsis_os.h"
|
||||||
#include "main.h"
|
#include "main.h"
|
||||||
@ -57,86 +58,69 @@ void ETH_IRQHandler(void);
|
|||||||
/******************************************************************************/
|
/******************************************************************************/
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief This function handles NMI exception.
|
* @brief This function handles NMI exception.
|
||||||
* @param None
|
* @param None
|
||||||
* @retval None
|
* @retval None
|
||||||
*/
|
*/
|
||||||
void NMI_Handler(void)
|
void NMI_Handler(void) {}
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief This function handles Hard Fault exception.
|
* @brief This function handles Hard Fault exception.
|
||||||
* @param None
|
* @param None
|
||||||
* @retval None
|
* @retval None
|
||||||
*/
|
*/
|
||||||
void HardFault_Handler(void)
|
void HardFault_Handler(void) {
|
||||||
{
|
|
||||||
/* Go to infinite loop when Hard Fault exception occurs */
|
/* Go to infinite loop when Hard Fault exception occurs */
|
||||||
while (1)
|
while (1) {
|
||||||
{
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief This function handles Memory Manage exception.
|
* @brief This function handles Memory Manage exception.
|
||||||
* @param None
|
* @param None
|
||||||
* @retval None
|
* @retval None
|
||||||
*/
|
*/
|
||||||
void MemManage_Handler(void)
|
void MemManage_Handler(void) {
|
||||||
{
|
|
||||||
/* Go to infinite loop when Memory Manage exception occurs */
|
/* Go to infinite loop when Memory Manage exception occurs */
|
||||||
while (1)
|
while (1) {
|
||||||
{
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief This function handles Bus Fault exception.
|
* @brief This function handles Bus Fault exception.
|
||||||
* @param None
|
* @param None
|
||||||
* @retval None
|
* @retval None
|
||||||
*/
|
*/
|
||||||
void BusFault_Handler(void)
|
void BusFault_Handler(void) {
|
||||||
{
|
|
||||||
/* Go to infinite loop when Bus Fault exception occurs */
|
/* Go to infinite loop when Bus Fault exception occurs */
|
||||||
while (1)
|
while (1) {
|
||||||
{
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief This function handles Usage Fault exception.
|
* @brief This function handles Usage Fault exception.
|
||||||
* @param None
|
* @param None
|
||||||
* @retval None
|
* @retval None
|
||||||
*/
|
*/
|
||||||
void UsageFault_Handler(void)
|
void UsageFault_Handler(void) {
|
||||||
{
|
|
||||||
/* Go to infinite loop when Usage Fault exception occurs */
|
/* Go to infinite loop when Usage Fault exception occurs */
|
||||||
while (1)
|
while (1) {
|
||||||
{
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief This function handles Debug Monitor exception.
|
||||||
|
* @param None
|
||||||
|
* @retval None
|
||||||
|
*/
|
||||||
|
void DebugMon_Handler(void) {}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief This function handles Debug Monitor exception.
|
* @brief This function handles SysTick Handler.
|
||||||
* @param None
|
* @param None
|
||||||
* @retval None
|
* @retval None
|
||||||
*/
|
*/
|
||||||
void DebugMon_Handler(void)
|
void SysTick_Handler(void) { osSystickHandler(); }
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @brief This function handles SysTick Handler.
|
|
||||||
* @param None
|
|
||||||
* @retval None
|
|
||||||
*/
|
|
||||||
void SysTick_Handler(void)
|
|
||||||
{
|
|
||||||
osSystickHandler();
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/******************************************************************************/
|
/******************************************************************************/
|
||||||
/* STM32H7xx Peripherals Interrupt Handlers */
|
/* STM32H7xx Peripherals Interrupt Handlers */
|
||||||
@ -145,24 +129,22 @@ void SysTick_Handler(void)
|
|||||||
/* file (startup_stm32h7xx.s). */
|
/* file (startup_stm32h7xx.s). */
|
||||||
/******************************************************************************/
|
/******************************************************************************/
|
||||||
/**
|
/**
|
||||||
* @brief This function handles Ethernet interrupt request.
|
* @brief This function handles Ethernet interrupt request.
|
||||||
* @param None
|
* @param None
|
||||||
* @retval None
|
* @retval None
|
||||||
*/
|
*/
|
||||||
void ETH_IRQHandler(void)
|
void ETH_IRQHandler(void) {
|
||||||
{
|
|
||||||
#if OBSW_ADD_LWIP_COMPONENTS == 1
|
#if OBSW_ADD_LWIP_COMPONENTS == 1
|
||||||
HAL_ETH_IRQHandler(&EthHandle);
|
HAL_ETH_IRQHandler(&EthHandle);
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @}
|
||||||
|
*/
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @}
|
* @}
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/**
|
|
||||||
* @}
|
|
||||||
*/
|
|
||||||
|
|
||||||
/************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/
|
/************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/
|
||||||
|
@ -1,160 +1,149 @@
|
|||||||
/**
|
/**
|
||||||
******************************************************************************
|
******************************************************************************
|
||||||
* @file stm32h7xx_nucleo.c
|
* @file stm32h7xx_nucleo.c
|
||||||
* @author MCD Application Team
|
* @author MCD Application Team
|
||||||
* @brief This file provides set of firmware functions to manage:
|
* @brief This file provides set of firmware functions to manage:
|
||||||
* - LEDs and push-button available on STM32H7xx-Nucleo Kit
|
* - LEDs and push-button available on STM32H7xx-Nucleo Kit
|
||||||
* from STMicroelectronics
|
* from STMicroelectronics
|
||||||
******************************************************************************
|
******************************************************************************
|
||||||
* @attention
|
* @attention
|
||||||
*
|
*
|
||||||
* <h2><center>© Copyright (c) 2018 STMicroelectronics.
|
* <h2><center>© Copyright (c) 2018 STMicroelectronics.
|
||||||
* All rights reserved.</center></h2>
|
* All rights reserved.</center></h2>
|
||||||
*
|
*
|
||||||
* This software component is licensed by ST under BSD 3-Clause license,
|
* This software component is licensed by ST under BSD 3-Clause license,
|
||||||
* the "License"; You may not use this file except in compliance with the
|
* the "License"; You may not use this file except in compliance with the
|
||||||
* License. You may obtain a copy of the License at:
|
* License. You may obtain a copy of the License at:
|
||||||
* opensource.org/licenses/BSD-3-Clause
|
* opensource.org/licenses/BSD-3-Clause
|
||||||
*
|
*
|
||||||
******************************************************************************
|
******************************************************************************
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/* Includes ------------------------------------------------------------------*/
|
/* Includes ------------------------------------------------------------------*/
|
||||||
#include "stm32h7xx_nucleo.h"
|
#include "stm32h7xx_nucleo.h"
|
||||||
|
|
||||||
/** @addtogroup BSP
|
/** @addtogroup BSP
|
||||||
* @{
|
* @{
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/** @addtogroup STM32H7XX_NUCLEO
|
/** @addtogroup STM32H7XX_NUCLEO
|
||||||
* @{
|
* @{
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/** @addtogroup STM32H7XX_NUCLEO_LOW_LEVEL
|
/** @addtogroup STM32H7XX_NUCLEO_LOW_LEVEL
|
||||||
* @brief This file provides set of firmware functions to manage Leds and push-button
|
* @brief This file provides set of firmware functions to manage Leds and
|
||||||
* available on STM32H7xx-Nucleo Kit from STMicroelectronics.
|
* push-button available on STM32H7xx-Nucleo Kit from STMicroelectronics.
|
||||||
* @{
|
* @{
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/** @defgroup STM32H7XX_NUCLEO_LOW_LEVEL_Private_Defines LOW LEVEL Private Defines
|
/** @defgroup STM32H7XX_NUCLEO_LOW_LEVEL_Private_Defines LOW LEVEL Private
|
||||||
* @{
|
* Defines
|
||||||
*/
|
* @{
|
||||||
|
*/
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @}
|
* @}
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/** @defgroup STM32H7XX_NUCLEO_LOW_LEVEL_Private_TypesDefinitions LOW LEVEL Private Typedef
|
/** @defgroup STM32H7XX_NUCLEO_LOW_LEVEL_Private_TypesDefinitions LOW LEVEL
|
||||||
* @{
|
* Private Typedef
|
||||||
*/
|
* @{
|
||||||
typedef void (* BSP_EXTI_LineCallback) (void);
|
*/
|
||||||
|
typedef void (*BSP_EXTI_LineCallback)(void);
|
||||||
/**
|
/**
|
||||||
* @}
|
* @}
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/** @defgroup STM32H7XX_NUCLEO_LOW_LEVEL_Exported_Variables LOW LEVEL Exported Variables
|
/** @defgroup STM32H7XX_NUCLEO_LOW_LEVEL_Exported_Variables LOW LEVEL Exported
|
||||||
* @{
|
* Variables
|
||||||
*/
|
* @{
|
||||||
|
*/
|
||||||
EXTI_HandleTypeDef hpb_exti[BUTTONn];
|
EXTI_HandleTypeDef hpb_exti[BUTTONn];
|
||||||
#if (USE_BSP_COM_FEATURE > 0)
|
#if (USE_BSP_COM_FEATURE > 0)
|
||||||
UART_HandleTypeDef hcom_uart[COMn];
|
UART_HandleTypeDef hcom_uart[COMn];
|
||||||
USART_TypeDef* COM_USART[COMn] = {COM1_UART};
|
USART_TypeDef *COM_USART[COMn] = {COM1_UART};
|
||||||
#endif
|
#endif
|
||||||
/**
|
/**
|
||||||
* @}
|
* @}
|
||||||
*/
|
*/
|
||||||
/** @defgroup STM32H7XX_NUCLEO_LOW_LEVEL_Private_Variables LOW LEVEL Private Variables
|
/** @defgroup STM32H7XX_NUCLEO_LOW_LEVEL_Private_Variables LOW LEVEL Private
|
||||||
* @{
|
* Variables
|
||||||
*/
|
* @{
|
||||||
static GPIO_TypeDef* LED_PORT[LEDn] = {LED1_GPIO_PORT,
|
*/
|
||||||
LED2_GPIO_PORT,
|
static GPIO_TypeDef *LED_PORT[LEDn] = {LED1_GPIO_PORT, LED2_GPIO_PORT,
|
||||||
LED3_GPIO_PORT};
|
LED3_GPIO_PORT};
|
||||||
|
|
||||||
static const uint16_t LED_PIN[LEDn] = {LED1_PIN,
|
static const uint16_t LED_PIN[LEDn] = {LED1_PIN, LED2_PIN, LED3_PIN};
|
||||||
LED2_PIN,
|
|
||||||
LED3_PIN};
|
|
||||||
|
|
||||||
static GPIO_TypeDef* BUTTON_PORT[BUTTONn] = {BUTTON_USER_GPIO_PORT};
|
static GPIO_TypeDef *BUTTON_PORT[BUTTONn] = {BUTTON_USER_GPIO_PORT};
|
||||||
static const uint16_t BUTTON_PIN[BUTTONn] = {BUTTON_USER_PIN};
|
static const uint16_t BUTTON_PIN[BUTTONn] = {BUTTON_USER_PIN};
|
||||||
static const IRQn_Type BUTTON_IRQn[BUTTONn] = {BUTTON_USER_EXTI_IRQn};
|
static const IRQn_Type BUTTON_IRQn[BUTTONn] = {BUTTON_USER_EXTI_IRQn};
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
#if (USE_BSP_COM_FEATURE > 0)
|
#if (USE_BSP_COM_FEATURE > 0)
|
||||||
#if (USE_COM_LOG > 0)
|
#if (USE_COM_LOG > 0)
|
||||||
static COM_TypeDef COM_ActiveLogPort = COM1;
|
static COM_TypeDef COM_ActiveLogPort = COM1;
|
||||||
#endif
|
#endif
|
||||||
#if (USE_HAL_UART_REGISTER_CALLBACKS == 1)
|
#if (USE_HAL_UART_REGISTER_CALLBACKS == 1)
|
||||||
static uint32_t IsComMspCbValid[COMn] = {0};
|
static uint32_t IsComMspCbValid[COMn] = {0};
|
||||||
#endif
|
#endif
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @}
|
* @}
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/** @defgroup STM32H7XX_NUCLEO_LOW_LEVEL_Private_FunctionPrototypes LOW LEVEL Private functions Prototypes
|
/** @defgroup STM32H7XX_NUCLEO_LOW_LEVEL_Private_FunctionPrototypes LOW LEVEL
|
||||||
* @{
|
* Private functions Prototypes
|
||||||
*/
|
* @{
|
||||||
|
*/
|
||||||
static void BUTTON_USER_EXTI_Callback(void);
|
static void BUTTON_USER_EXTI_Callback(void);
|
||||||
#if (USE_BSP_COM_FEATURE > 0)
|
#if (USE_BSP_COM_FEATURE > 0)
|
||||||
static void COM1_MspInit(UART_HandleTypeDef *huart);
|
static void COM1_MspInit(UART_HandleTypeDef *huart);
|
||||||
static void COM1_MspDeInit(UART_HandleTypeDef *huart);
|
static void COM1_MspDeInit(UART_HandleTypeDef *huart);
|
||||||
#endif
|
#endif
|
||||||
/**
|
/**
|
||||||
* @}
|
* @}
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/** @defgroup STM32H7XX_NUCLEO_LOW_LEVEL_Exported_Functions LOW LEVEL Exported Functions
|
/** @defgroup STM32H7XX_NUCLEO_LOW_LEVEL_Exported_Functions LOW LEVEL Exported
|
||||||
* @{
|
* Functions
|
||||||
*/
|
* @{
|
||||||
|
*/
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief This method returns the STM32H7XX NUCLEO BSP Driver revision
|
* @brief This method returns the STM32H7XX NUCLEO BSP Driver revision
|
||||||
* @retval version: 0xXYZR (8bits for each decimal, R for RC)
|
* @retval version: 0xXYZR (8bits for each decimal, R for RC)
|
||||||
*/
|
*/
|
||||||
int32_t BSP_GetVersion(void)
|
int32_t BSP_GetVersion(void) { return (int32_t)STM32H7XX_NUCLEO_BSP_VERSION; }
|
||||||
{
|
|
||||||
return (int32_t)STM32H7XX_NUCLEO_BSP_VERSION;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Configures LED GPIO.
|
* @brief Configures LED GPIO.
|
||||||
* @param Led Specifies the Led to be configured.
|
* @param Led Specifies the Led to be configured.
|
||||||
* This parameter can be one of following parameters:
|
* This parameter can be one of following parameters:
|
||||||
* @arg LED1
|
* @arg LED1
|
||||||
* @arg LED2
|
* @arg LED2
|
||||||
* @arg LED3
|
* @arg LED3
|
||||||
* @retval BSP status
|
* @retval BSP status
|
||||||
*/
|
*/
|
||||||
int32_t BSP_LED_Init(Led_TypeDef Led)
|
int32_t BSP_LED_Init(Led_TypeDef Led) {
|
||||||
{
|
|
||||||
int32_t ret = BSP_ERROR_NONE;
|
int32_t ret = BSP_ERROR_NONE;
|
||||||
GPIO_InitTypeDef gpio_init_structure;
|
GPIO_InitTypeDef gpio_init_structure;
|
||||||
|
|
||||||
if((Led != LED1) && (Led != LED2) && (Led != LED3))
|
if ((Led != LED1) && (Led != LED2) && (Led != LED3)) {
|
||||||
{
|
|
||||||
ret = BSP_ERROR_WRONG_PARAM;
|
ret = BSP_ERROR_WRONG_PARAM;
|
||||||
}
|
} else {
|
||||||
else
|
|
||||||
{
|
|
||||||
/* Enable the GPIO LED Clock */
|
/* Enable the GPIO LED Clock */
|
||||||
if(Led == LED1)
|
if (Led == LED1) {
|
||||||
{
|
|
||||||
LED1_GPIO_CLK_ENABLE();
|
LED1_GPIO_CLK_ENABLE();
|
||||||
}
|
} else if (Led == LED2) {
|
||||||
else if(Led == LED2)
|
|
||||||
{
|
|
||||||
LED2_GPIO_CLK_ENABLE();
|
LED2_GPIO_CLK_ENABLE();
|
||||||
}
|
} else {
|
||||||
else
|
|
||||||
{
|
|
||||||
LED3_GPIO_CLK_ENABLE();
|
LED3_GPIO_CLK_ENABLE();
|
||||||
}
|
}
|
||||||
/* Configure the GPIO_LED pin */
|
/* Configure the GPIO_LED pin */
|
||||||
gpio_init_structure.Pin = LED_PIN[Led];
|
gpio_init_structure.Pin = LED_PIN[Led];
|
||||||
gpio_init_structure.Mode = GPIO_MODE_OUTPUT_PP;
|
gpio_init_structure.Mode = GPIO_MODE_OUTPUT_PP;
|
||||||
gpio_init_structure.Pull = GPIO_NOPULL;
|
gpio_init_structure.Pull = GPIO_NOPULL;
|
||||||
gpio_init_structure.Speed = GPIO_SPEED_FREQ_VERY_HIGH;
|
gpio_init_structure.Speed = GPIO_SPEED_FREQ_VERY_HIGH;
|
||||||
|
|
||||||
HAL_GPIO_Init(LED_PORT[Led], &gpio_init_structure);
|
HAL_GPIO_Init(LED_PORT[Led], &gpio_init_structure);
|
||||||
@ -165,26 +154,22 @@ int32_t BSP_LED_Init(Led_TypeDef Led)
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief DeInit LEDs.
|
* @brief DeInit LEDs.
|
||||||
* @param Led LED to be de-init.
|
* @param Led LED to be de-init.
|
||||||
* This parameter can be one of the following values:
|
* This parameter can be one of the following values:
|
||||||
* @arg LED1
|
* @arg LED1
|
||||||
* @arg LED2
|
* @arg LED2
|
||||||
* @arg LED3
|
* @arg LED3
|
||||||
* @note Led DeInit does not disable the GPIO clock nor disable the Mfx
|
* @note Led DeInit does not disable the GPIO clock nor disable the Mfx
|
||||||
* @retval BSP status
|
* @retval BSP status
|
||||||
*/
|
*/
|
||||||
int32_t BSP_LED_DeInit(Led_TypeDef Led)
|
int32_t BSP_LED_DeInit(Led_TypeDef Led) {
|
||||||
{
|
|
||||||
int32_t ret = BSP_ERROR_NONE;
|
int32_t ret = BSP_ERROR_NONE;
|
||||||
GPIO_InitTypeDef gpio_init_structure;
|
GPIO_InitTypeDef gpio_init_structure;
|
||||||
|
|
||||||
if((Led != LED1) && (Led != LED2) && (Led != LED3))
|
if ((Led != LED1) && (Led != LED2) && (Led != LED3)) {
|
||||||
{
|
|
||||||
ret = BSP_ERROR_WRONG_PARAM;
|
ret = BSP_ERROR_WRONG_PARAM;
|
||||||
}
|
} else {
|
||||||
else
|
|
||||||
{
|
|
||||||
/* Turn off LED */
|
/* Turn off LED */
|
||||||
HAL_GPIO_WritePin(LED_PORT[Led], LED_PIN[Led], GPIO_PIN_RESET);
|
HAL_GPIO_WritePin(LED_PORT[Led], LED_PIN[Led], GPIO_PIN_RESET);
|
||||||
/* DeInit the GPIO_LED pin */
|
/* DeInit the GPIO_LED pin */
|
||||||
@ -196,24 +181,20 @@ int32_t BSP_LED_DeInit(Led_TypeDef Led)
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Turns selected LED On.
|
* @brief Turns selected LED On.
|
||||||
* @param Led Specifies the Led to be set on.
|
* @param Led Specifies the Led to be set on.
|
||||||
* This parameter can be one of following parameters:
|
* This parameter can be one of following parameters:
|
||||||
* @arg LED1
|
* @arg LED1
|
||||||
* @arg LED2
|
* @arg LED2
|
||||||
* @arg LED3
|
* @arg LED3
|
||||||
* @retval BSP status
|
* @retval BSP status
|
||||||
*/
|
*/
|
||||||
int32_t BSP_LED_On(Led_TypeDef Led)
|
int32_t BSP_LED_On(Led_TypeDef Led) {
|
||||||
{
|
|
||||||
int32_t ret = BSP_ERROR_NONE;
|
int32_t ret = BSP_ERROR_NONE;
|
||||||
|
|
||||||
if((Led != LED1) && (Led != LED2) && (Led != LED3))
|
if ((Led != LED1) && (Led != LED2) && (Led != LED3)) {
|
||||||
{
|
|
||||||
ret = BSP_ERROR_WRONG_PARAM;
|
ret = BSP_ERROR_WRONG_PARAM;
|
||||||
}
|
} else {
|
||||||
else
|
|
||||||
{
|
|
||||||
HAL_GPIO_WritePin(LED_PORT[Led], LED_PIN[Led], GPIO_PIN_SET);
|
HAL_GPIO_WritePin(LED_PORT[Led], LED_PIN[Led], GPIO_PIN_SET);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -221,24 +202,20 @@ int32_t BSP_LED_On(Led_TypeDef Led)
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Turns selected LED Off.
|
* @brief Turns selected LED Off.
|
||||||
* @param Led: Specifies the Led to be set off.
|
* @param Led: Specifies the Led to be set off.
|
||||||
* This parameter can be one of following parameters:
|
* This parameter can be one of following parameters:
|
||||||
* @arg LED1
|
* @arg LED1
|
||||||
* @arg LED2
|
* @arg LED2
|
||||||
* @arg LED3
|
* @arg LED3
|
||||||
* @retval BSP status
|
* @retval BSP status
|
||||||
*/
|
*/
|
||||||
int32_t BSP_LED_Off(Led_TypeDef Led)
|
int32_t BSP_LED_Off(Led_TypeDef Led) {
|
||||||
{
|
|
||||||
int32_t ret = BSP_ERROR_NONE;
|
int32_t ret = BSP_ERROR_NONE;
|
||||||
|
|
||||||
if((Led != LED1) && (Led != LED2) && (Led != LED3))
|
if ((Led != LED1) && (Led != LED2) && (Led != LED3)) {
|
||||||
{
|
|
||||||
ret = BSP_ERROR_WRONG_PARAM;
|
ret = BSP_ERROR_WRONG_PARAM;
|
||||||
}
|
} else {
|
||||||
else
|
|
||||||
{
|
|
||||||
HAL_GPIO_WritePin(LED_PORT[Led], LED_PIN[Led], GPIO_PIN_RESET);
|
HAL_GPIO_WritePin(LED_PORT[Led], LED_PIN[Led], GPIO_PIN_RESET);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -246,24 +223,20 @@ int32_t BSP_LED_Off(Led_TypeDef Led)
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Toggles the selected LED.
|
* @brief Toggles the selected LED.
|
||||||
* @param Led Specifies the Led to be toggled.
|
* @param Led Specifies the Led to be toggled.
|
||||||
* This parameter can be one of following parameters:
|
* This parameter can be one of following parameters:
|
||||||
* @arg LED1
|
* @arg LED1
|
||||||
* @arg LED2
|
* @arg LED2
|
||||||
* @arg LED3
|
* @arg LED3
|
||||||
* @retval BSP status
|
* @retval BSP status
|
||||||
*/
|
*/
|
||||||
int32_t BSP_LED_Toggle(Led_TypeDef Led)
|
int32_t BSP_LED_Toggle(Led_TypeDef Led) {
|
||||||
{
|
|
||||||
int32_t ret = BSP_ERROR_NONE;
|
int32_t ret = BSP_ERROR_NONE;
|
||||||
|
|
||||||
if((Led != LED1) && (Led != LED2) && (Led != LED3))
|
if ((Led != LED1) && (Led != LED2) && (Led != LED3)) {
|
||||||
{
|
|
||||||
ret = BSP_ERROR_WRONG_PARAM;
|
ret = BSP_ERROR_WRONG_PARAM;
|
||||||
}
|
} else {
|
||||||
else
|
|
||||||
{
|
|
||||||
HAL_GPIO_TogglePin(LED_PORT[Led], LED_PIN[Led]);
|
HAL_GPIO_TogglePin(LED_PORT[Led], LED_PIN[Led]);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -271,62 +244,56 @@ int32_t BSP_LED_Toggle(Led_TypeDef Led)
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Get the state of the selected LED.
|
* @brief Get the state of the selected LED.
|
||||||
* @param Led LED to get its state
|
* @param Led LED to get its state
|
||||||
* This parameter can be one of following parameters:
|
* This parameter can be one of following parameters:
|
||||||
* @arg LED1
|
* @arg LED1
|
||||||
* @arg LED2
|
* @arg LED2
|
||||||
* @arg LED3
|
* @arg LED3
|
||||||
* @retval LED status
|
* @retval LED status
|
||||||
*/
|
*/
|
||||||
int32_t BSP_LED_GetState (Led_TypeDef Led)
|
int32_t BSP_LED_GetState(Led_TypeDef Led) {
|
||||||
{
|
|
||||||
int32_t ret;
|
int32_t ret;
|
||||||
|
|
||||||
if((Led != LED1) && (Led != LED2) && (Led != LED3))
|
if ((Led != LED1) && (Led != LED2) && (Led != LED3)) {
|
||||||
{
|
|
||||||
ret = BSP_ERROR_WRONG_PARAM;
|
ret = BSP_ERROR_WRONG_PARAM;
|
||||||
}
|
} else {
|
||||||
else
|
ret = (int32_t)HAL_GPIO_ReadPin(LED_PORT[Led], LED_PIN[Led]);
|
||||||
{
|
|
||||||
ret = (int32_t)HAL_GPIO_ReadPin (LED_PORT [Led], LED_PIN [Led]);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Configures button GPIO and EXTI Line.
|
* @brief Configures button GPIO and EXTI Line.
|
||||||
* @param Button Button to be configured
|
* @param Button Button to be configured
|
||||||
* This parameter can be one of the following values:
|
* This parameter can be one of the following values:
|
||||||
* @arg BUTTON_USER: Wakeup Push Button
|
* @arg BUTTON_USER: Wakeup Push Button
|
||||||
* @param ButtonMode Button mode
|
* @param ButtonMode Button mode
|
||||||
* This parameter can be one of the following values:
|
* This parameter can be one of the following values:
|
||||||
* @arg BUTTON_MODE_GPIO: Button will be used as simple IO
|
* @arg BUTTON_MODE_GPIO: Button will be used as simple IO
|
||||||
* @arg BUTTON_MODE_EXTI: Button will be connected to EXTI line
|
* @arg BUTTON_MODE_EXTI: Button will be connected to EXTI line
|
||||||
* with interrupt generation capability
|
* with interrupt generation capability
|
||||||
*/
|
*/
|
||||||
int32_t BSP_PB_Init(Button_TypeDef Button, ButtonMode_TypeDef ButtonMode)
|
int32_t BSP_PB_Init(Button_TypeDef Button, ButtonMode_TypeDef ButtonMode) {
|
||||||
{
|
|
||||||
GPIO_InitTypeDef gpio_init_structure;
|
GPIO_InitTypeDef gpio_init_structure;
|
||||||
static BSP_EXTI_LineCallback ButtonCallback[BUTTONn] = {BUTTON_USER_EXTI_Callback};
|
static BSP_EXTI_LineCallback ButtonCallback[BUTTONn] = {
|
||||||
static uint32_t BSP_BUTTON_PRIO [BUTTONn] = {BSP_BUTTON_USER_IT_PRIORITY};
|
BUTTON_USER_EXTI_Callback};
|
||||||
|
static uint32_t BSP_BUTTON_PRIO[BUTTONn] = {BSP_BUTTON_USER_IT_PRIORITY};
|
||||||
static const uint32_t BUTTON_EXTI_LINE[BUTTONn] = {BUTTON_USER_EXTI_LINE};
|
static const uint32_t BUTTON_EXTI_LINE[BUTTONn] = {BUTTON_USER_EXTI_LINE};
|
||||||
|
|
||||||
/* Enable the BUTTON clock */
|
/* Enable the BUTTON clock */
|
||||||
BUTTON_USER_GPIO_CLK_ENABLE();
|
BUTTON_USER_GPIO_CLK_ENABLE();
|
||||||
|
|
||||||
gpio_init_structure.Pin = BUTTON_PIN [Button];
|
gpio_init_structure.Pin = BUTTON_PIN[Button];
|
||||||
gpio_init_structure.Pull = GPIO_PULLDOWN;
|
gpio_init_structure.Pull = GPIO_PULLDOWN;
|
||||||
gpio_init_structure.Speed = GPIO_SPEED_FREQ_HIGH;
|
gpio_init_structure.Speed = GPIO_SPEED_FREQ_HIGH;
|
||||||
|
|
||||||
if(ButtonMode == BUTTON_MODE_GPIO)
|
if (ButtonMode == BUTTON_MODE_GPIO) {
|
||||||
{
|
|
||||||
/* Configure Button pin as input */
|
/* Configure Button pin as input */
|
||||||
gpio_init_structure.Mode = GPIO_MODE_INPUT;
|
gpio_init_structure.Mode = GPIO_MODE_INPUT;
|
||||||
HAL_GPIO_Init(BUTTON_PORT [Button], &gpio_init_structure);
|
HAL_GPIO_Init(BUTTON_PORT[Button], &gpio_init_structure);
|
||||||
}
|
} else /* (ButtonMode == BUTTON_MODE_EXTI) */
|
||||||
else /* (ButtonMode == BUTTON_MODE_EXTI) */
|
|
||||||
{
|
{
|
||||||
/* Configure Button pin as input with External interrupt */
|
/* Configure Button pin as input with External interrupt */
|
||||||
gpio_init_structure.Mode = GPIO_MODE_IT_RISING;
|
gpio_init_structure.Mode = GPIO_MODE_IT_RISING;
|
||||||
@ -334,7 +301,8 @@ int32_t BSP_PB_Init(Button_TypeDef Button, ButtonMode_TypeDef ButtonMode)
|
|||||||
HAL_GPIO_Init(BUTTON_PORT[Button], &gpio_init_structure);
|
HAL_GPIO_Init(BUTTON_PORT[Button], &gpio_init_structure);
|
||||||
|
|
||||||
(void)HAL_EXTI_GetHandle(&hpb_exti[Button], BUTTON_EXTI_LINE[Button]);
|
(void)HAL_EXTI_GetHandle(&hpb_exti[Button], BUTTON_EXTI_LINE[Button]);
|
||||||
(void)HAL_EXTI_RegisterCallback(&hpb_exti[Button], HAL_EXTI_COMMON_CB_ID, ButtonCallback[Button]);
|
(void)HAL_EXTI_RegisterCallback(&hpb_exti[Button], HAL_EXTI_COMMON_CB_ID,
|
||||||
|
ButtonCallback[Button]);
|
||||||
|
|
||||||
/* Enable and set Button EXTI Interrupt to the lowest priority */
|
/* Enable and set Button EXTI Interrupt to the lowest priority */
|
||||||
HAL_NVIC_SetPriority((BUTTON_IRQn[Button]), BSP_BUTTON_PRIO[Button], 0x00);
|
HAL_NVIC_SetPriority((BUTTON_IRQn[Button]), BSP_BUTTON_PRIO[Button], 0x00);
|
||||||
@ -345,14 +313,13 @@ int32_t BSP_PB_Init(Button_TypeDef Button, ButtonMode_TypeDef ButtonMode)
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Push Button DeInit.
|
* @brief Push Button DeInit.
|
||||||
* @param Button Button to be configured
|
* @param Button Button to be configured
|
||||||
* This parameter can be one of the following values:
|
* This parameter can be one of the following values:
|
||||||
* @arg BUTTON_USER: Wakeup Push Button
|
* @arg BUTTON_USER: Wakeup Push Button
|
||||||
* @note PB DeInit does not disable the GPIO clock
|
* @note PB DeInit does not disable the GPIO clock
|
||||||
*/
|
*/
|
||||||
int32_t BSP_PB_DeInit(Button_TypeDef Button)
|
int32_t BSP_PB_DeInit(Button_TypeDef Button) {
|
||||||
{
|
|
||||||
GPIO_InitTypeDef gpio_init_structure;
|
GPIO_InitTypeDef gpio_init_structure;
|
||||||
|
|
||||||
gpio_init_structure.Pin = BUTTON_PIN[Button];
|
gpio_init_structure.Pin = BUTTON_PIN[Button];
|
||||||
@ -363,34 +330,31 @@ int32_t BSP_PB_DeInit(Button_TypeDef Button)
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Returns the selected button state.
|
* @brief Returns the selected button state.
|
||||||
* @param Button Button to be checked
|
* @param Button Button to be checked
|
||||||
* This parameter can be one of the following values:
|
* This parameter can be one of the following values:
|
||||||
* @arg BUTTON_USER: Wakeup Push Button
|
* @arg BUTTON_USER: Wakeup Push Button
|
||||||
* @retval The Button GPIO pin value (GPIO_PIN_RESET = button pressed)
|
* @retval The Button GPIO pin value (GPIO_PIN_RESET = button pressed)
|
||||||
*/
|
*/
|
||||||
int32_t BSP_PB_GetState(Button_TypeDef Button)
|
int32_t BSP_PB_GetState(Button_TypeDef Button) {
|
||||||
{
|
|
||||||
return (int32_t)HAL_GPIO_ReadPin(BUTTON_PORT[Button], BUTTON_PIN[Button]);
|
return (int32_t)HAL_GPIO_ReadPin(BUTTON_PORT[Button], BUTTON_PIN[Button]);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief BSP Button IRQ handler
|
* @brief BSP Button IRQ handler
|
||||||
* @param Button Can only be BUTTON_USER
|
* @param Button Can only be BUTTON_USER
|
||||||
* @retval None
|
* @retval None
|
||||||
*/
|
*/
|
||||||
void BSP_PB_IRQHandler(Button_TypeDef Button)
|
void BSP_PB_IRQHandler(Button_TypeDef Button) {
|
||||||
{
|
|
||||||
HAL_EXTI_IRQHandler(&hpb_exti[Button]);
|
HAL_EXTI_IRQHandler(&hpb_exti[Button]);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief BSP Push Button callback
|
* @brief BSP Push Button callback
|
||||||
* @param Button Specifies the pin connected EXTI line
|
* @param Button Specifies the pin connected EXTI line
|
||||||
* @retval None
|
* @retval None
|
||||||
*/
|
*/
|
||||||
__weak void BSP_PB_Callback(Button_TypeDef Button)
|
__weak void BSP_PB_Callback(Button_TypeDef Button) {
|
||||||
{
|
|
||||||
/* Prevent unused argument(s) compilation warning */
|
/* Prevent unused argument(s) compilation warning */
|
||||||
UNUSED(Button);
|
UNUSED(Button);
|
||||||
|
|
||||||
@ -400,38 +364,32 @@ __weak void BSP_PB_Callback(Button_TypeDef Button)
|
|||||||
|
|
||||||
#if (USE_BSP_COM_FEATURE > 0)
|
#if (USE_BSP_COM_FEATURE > 0)
|
||||||
/**
|
/**
|
||||||
* @brief Configures COM port.
|
* @brief Configures COM port.
|
||||||
* @param COM COM port to be configured.
|
* @param COM COM port to be configured.
|
||||||
* This parameter can be COM1
|
* This parameter can be COM1
|
||||||
* @param COM_Init Pointer to a UART_HandleTypeDef structure that contains the
|
* @param COM_Init Pointer to a UART_HandleTypeDef structure that contains the
|
||||||
* configuration information for the specified USART peripheral.
|
* configuration information for the specified USART
|
||||||
* @retval BSP error code
|
* peripheral.
|
||||||
*/
|
* @retval BSP error code
|
||||||
int32_t BSP_COM_Init(COM_TypeDef COM, COM_InitTypeDef *COM_Init)
|
*/
|
||||||
{
|
int32_t BSP_COM_Init(COM_TypeDef COM, COM_InitTypeDef *COM_Init) {
|
||||||
int32_t ret = BSP_ERROR_NONE;
|
int32_t ret = BSP_ERROR_NONE;
|
||||||
|
|
||||||
if(COM >= COMn)
|
if (COM >= COMn) {
|
||||||
{
|
|
||||||
ret = BSP_ERROR_WRONG_PARAM;
|
ret = BSP_ERROR_WRONG_PARAM;
|
||||||
}
|
} else {
|
||||||
else
|
|
||||||
{
|
|
||||||
#if (USE_HAL_UART_REGISTER_CALLBACKS == 0)
|
#if (USE_HAL_UART_REGISTER_CALLBACKS == 0)
|
||||||
/* Init the UART Msp */
|
/* Init the UART Msp */
|
||||||
COM1_MspInit(&hcom_uart[COM]);
|
COM1_MspInit(&hcom_uart[COM]);
|
||||||
#else
|
#else
|
||||||
if(IsComMspCbValid[COM] == 0U)
|
if (IsComMspCbValid[COM] == 0U) {
|
||||||
{
|
if (BSP_COM_RegisterDefaultMspCallbacks(COM) != BSP_ERROR_NONE) {
|
||||||
if(BSP_COM_RegisterDefaultMspCallbacks(COM) != BSP_ERROR_NONE)
|
|
||||||
{
|
|
||||||
return BSP_ERROR_MSP_FAILURE;
|
return BSP_ERROR_MSP_FAILURE;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
if(MX_USART3_Init(&hcom_uart[COM], COM_Init) != HAL_OK)
|
if (MX_USART3_Init(&hcom_uart[COM], COM_Init) != HAL_OK) {
|
||||||
{
|
|
||||||
ret = BSP_ERROR_PERIPH_FAILURE;
|
ret = BSP_ERROR_PERIPH_FAILURE;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -440,21 +398,17 @@ int32_t BSP_COM_Init(COM_TypeDef COM, COM_InitTypeDef *COM_Init)
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief DeInit COM port.
|
* @brief DeInit COM port.
|
||||||
* @param COM COM port to be configured.
|
* @param COM COM port to be configured.
|
||||||
* This parameter can be COM1
|
* This parameter can be COM1
|
||||||
* @retval BSP status
|
* @retval BSP status
|
||||||
*/
|
*/
|
||||||
int32_t BSP_COM_DeInit(COM_TypeDef COM)
|
int32_t BSP_COM_DeInit(COM_TypeDef COM) {
|
||||||
{
|
|
||||||
int32_t ret = BSP_ERROR_NONE;
|
int32_t ret = BSP_ERROR_NONE;
|
||||||
|
|
||||||
if(COM >= COMn)
|
if (COM >= COMn) {
|
||||||
{
|
|
||||||
ret = BSP_ERROR_WRONG_PARAM;
|
ret = BSP_ERROR_WRONG_PARAM;
|
||||||
}
|
} else {
|
||||||
else
|
|
||||||
{
|
|
||||||
/* USART configuration */
|
/* USART configuration */
|
||||||
hcom_uart[COM].Instance = COM_USART[COM];
|
hcom_uart[COM].Instance = COM_USART[COM];
|
||||||
|
|
||||||
@ -462,8 +416,7 @@ int32_t BSP_COM_DeInit(COM_TypeDef COM)
|
|||||||
COM1_MspDeInit(&hcom_uart[COM]);
|
COM1_MspDeInit(&hcom_uart[COM]);
|
||||||
#endif /* (USE_HAL_UART_REGISTER_CALLBACKS == 0) */
|
#endif /* (USE_HAL_UART_REGISTER_CALLBACKS == 0) */
|
||||||
|
|
||||||
if(HAL_UART_DeInit(&hcom_uart[COM]) != HAL_OK)
|
if (HAL_UART_DeInit(&hcom_uart[COM]) != HAL_OK) {
|
||||||
{
|
|
||||||
ret = BSP_ERROR_PERIPH_FAILURE;
|
ret = BSP_ERROR_PERIPH_FAILURE;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -472,57 +425,52 @@ int32_t BSP_COM_DeInit(COM_TypeDef COM)
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Configures COM port.
|
* @brief Configures COM port.
|
||||||
* @param huart USART handle
|
* @param huart USART handle
|
||||||
* @param COM_Init Pointer to a UART_HandleTypeDef structure that contains the
|
* @param COM_Init Pointer to a UART_HandleTypeDef structure that contains the
|
||||||
* configuration information for the specified USART peripheral.
|
* configuration information for the specified USART
|
||||||
* @retval HAL error code
|
* peripheral.
|
||||||
*/
|
* @retval HAL error code
|
||||||
__weak HAL_StatusTypeDef MX_USART3_Init(UART_HandleTypeDef *huart, MX_UART_InitTypeDef *COM_Init)
|
*/
|
||||||
{
|
__weak HAL_StatusTypeDef MX_USART3_Init(UART_HandleTypeDef *huart,
|
||||||
|
MX_UART_InitTypeDef *COM_Init) {
|
||||||
/* USART configuration */
|
/* USART configuration */
|
||||||
huart->Instance = COM_USART[COM1];
|
huart->Instance = COM_USART[COM1];
|
||||||
huart->Init.BaudRate = COM_Init->BaudRate;
|
huart->Init.BaudRate = COM_Init->BaudRate;
|
||||||
huart->Init.Mode = UART_MODE_TX_RX;
|
huart->Init.Mode = UART_MODE_TX_RX;
|
||||||
huart->Init.Parity = (uint32_t)COM_Init->Parity;
|
huart->Init.Parity = (uint32_t)COM_Init->Parity;
|
||||||
huart->Init.WordLength = (uint32_t)COM_Init->WordLength;
|
huart->Init.WordLength = (uint32_t)COM_Init->WordLength;
|
||||||
huart->Init.StopBits = (uint32_t)COM_Init->StopBits;
|
huart->Init.StopBits = (uint32_t)COM_Init->StopBits;
|
||||||
huart->Init.HwFlowCtl = (uint32_t)COM_Init->HwFlowCtl;
|
huart->Init.HwFlowCtl = (uint32_t)COM_Init->HwFlowCtl;
|
||||||
huart->Init.OverSampling = UART_OVERSAMPLING_8;
|
huart->Init.OverSampling = UART_OVERSAMPLING_8;
|
||||||
|
|
||||||
return HAL_UART_Init(huart);
|
return HAL_UART_Init(huart);
|
||||||
}
|
}
|
||||||
|
|
||||||
#if (USE_HAL_UART_REGISTER_CALLBACKS == 1)
|
#if (USE_HAL_UART_REGISTER_CALLBACKS == 1)
|
||||||
/**
|
/**
|
||||||
* @brief Register Default COM Msp Callbacks
|
* @brief Register Default COM Msp Callbacks
|
||||||
* @param COM COM port to be configured.
|
* @param COM COM port to be configured.
|
||||||
* This parameter can be COM1
|
* This parameter can be COM1
|
||||||
* @retval BSP status
|
* @retval BSP status
|
||||||
*/
|
*/
|
||||||
int32_t BSP_COM_RegisterDefaultMspCallbacks(COM_TypeDef COM)
|
int32_t BSP_COM_RegisterDefaultMspCallbacks(COM_TypeDef COM) {
|
||||||
{
|
|
||||||
int32_t ret = BSP_ERROR_NONE;
|
int32_t ret = BSP_ERROR_NONE;
|
||||||
|
|
||||||
if(COM >= COMn)
|
if (COM >= COMn) {
|
||||||
{
|
|
||||||
ret = BSP_ERROR_WRONG_PARAM;
|
ret = BSP_ERROR_WRONG_PARAM;
|
||||||
}
|
} else {
|
||||||
else
|
|
||||||
{
|
|
||||||
__HAL_UART_RESET_HANDLE_STATE(&hcom_uart[COM]);
|
__HAL_UART_RESET_HANDLE_STATE(&hcom_uart[COM]);
|
||||||
|
|
||||||
/* Register default MspInit/MspDeInit Callback */
|
/* Register default MspInit/MspDeInit Callback */
|
||||||
if(HAL_UART_RegisterCallback(&hcom_uart[COM], HAL_UART_MSPINIT_CB_ID, COM1_MspInit) != HAL_OK)
|
if (HAL_UART_RegisterCallback(&hcom_uart[COM], HAL_UART_MSPINIT_CB_ID,
|
||||||
{
|
COM1_MspInit) != HAL_OK) {
|
||||||
ret = BSP_ERROR_PERIPH_FAILURE;
|
ret = BSP_ERROR_PERIPH_FAILURE;
|
||||||
}
|
} else if (HAL_UART_RegisterCallback(&hcom_uart[COM],
|
||||||
else if(HAL_UART_RegisterCallback(&hcom_uart[COM], HAL_UART_MSPDEINIT_CB_ID, COM1_MspDeInit) != HAL_OK)
|
HAL_UART_MSPDEINIT_CB_ID,
|
||||||
{
|
COM1_MspDeInit) != HAL_OK) {
|
||||||
ret = BSP_ERROR_PERIPH_FAILURE;
|
ret = BSP_ERROR_PERIPH_FAILURE;
|
||||||
}
|
} else {
|
||||||
else
|
|
||||||
{
|
|
||||||
IsComMspCbValid[COM] = 1U;
|
IsComMspCbValid[COM] = 1U;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -532,35 +480,29 @@ int32_t BSP_COM_RegisterDefaultMspCallbacks(COM_TypeDef COM)
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Register COM Msp Callback registering
|
* @brief Register COM Msp Callback registering
|
||||||
* @param COM COM port to be configured.
|
* @param COM COM port to be configured.
|
||||||
* This parameter can be COM1
|
* This parameter can be COM1
|
||||||
* @param Callbacks pointer to COM1 MspInit/MspDeInit callback functions
|
* @param Callbacks pointer to COM1 MspInit/MspDeInit callback functions
|
||||||
* @retval BSP status
|
* @retval BSP status
|
||||||
*/
|
*/
|
||||||
int32_t BSP_COM_RegisterMspCallbacks(COM_TypeDef COM , BSP_COM_Cb_t *Callback)
|
int32_t BSP_COM_RegisterMspCallbacks(COM_TypeDef COM, BSP_COM_Cb_t *Callback) {
|
||||||
{
|
|
||||||
int32_t ret = BSP_ERROR_NONE;
|
int32_t ret = BSP_ERROR_NONE;
|
||||||
|
|
||||||
if(COM >= COMn)
|
if (COM >= COMn) {
|
||||||
{
|
|
||||||
ret = BSP_ERROR_WRONG_PARAM;
|
ret = BSP_ERROR_WRONG_PARAM;
|
||||||
}
|
} else {
|
||||||
else
|
|
||||||
{
|
|
||||||
__HAL_UART_RESET_HANDLE_STATE(&hcom_uart[COM]);
|
__HAL_UART_RESET_HANDLE_STATE(&hcom_uart[COM]);
|
||||||
|
|
||||||
/* Register MspInit/MspDeInit Callbacks */
|
/* Register MspInit/MspDeInit Callbacks */
|
||||||
if(HAL_UART_RegisterCallback(&hcom_uart[COM], HAL_UART_MSPINIT_CB_ID, Callback->pMspInitCb) != HAL_OK)
|
if (HAL_UART_RegisterCallback(&hcom_uart[COM], HAL_UART_MSPINIT_CB_ID,
|
||||||
{
|
Callback->pMspInitCb) != HAL_OK) {
|
||||||
ret = BSP_ERROR_PERIPH_FAILURE;
|
ret = BSP_ERROR_PERIPH_FAILURE;
|
||||||
}
|
} else if (HAL_UART_RegisterCallback(&hcom_uart[COM],
|
||||||
else if(HAL_UART_RegisterCallback(&hcom_uart[COM], HAL_UART_MSPDEINIT_CB_ID, Callback->pMspDeInitCb) != HAL_OK)
|
HAL_UART_MSPDEINIT_CB_ID,
|
||||||
{
|
Callback->pMspDeInitCb) != HAL_OK) {
|
||||||
ret = BSP_ERROR_PERIPH_FAILURE;
|
ret = BSP_ERROR_PERIPH_FAILURE;
|
||||||
}
|
} else {
|
||||||
else
|
|
||||||
{
|
|
||||||
IsComMspCbValid[COM] = 1U;
|
IsComMspCbValid[COM] = 1U;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -571,59 +513,55 @@ int32_t BSP_COM_RegisterMspCallbacks(COM_TypeDef COM , BSP_COM_Cb_t *Callback)
|
|||||||
|
|
||||||
#if (USE_COM_LOG > 0)
|
#if (USE_COM_LOG > 0)
|
||||||
/**
|
/**
|
||||||
* @brief Select the active COM port.
|
* @brief Select the active COM port.
|
||||||
* @param COM COM port to be activated.
|
* @param COM COM port to be activated.
|
||||||
* This parameter can be COM1
|
* This parameter can be COM1
|
||||||
* @retval BSP status
|
* @retval BSP status
|
||||||
*/
|
*/
|
||||||
int32_t BSP_COM_SelectLogPort(COM_TypeDef COM)
|
int32_t BSP_COM_SelectLogPort(COM_TypeDef COM) {
|
||||||
{
|
if (COM_ActiveLogPort != COM) {
|
||||||
if(COM_ActiveLogPort != COM)
|
|
||||||
{
|
|
||||||
COM_ActiveLogPort = COM;
|
COM_ActiveLogPort = COM;
|
||||||
}
|
}
|
||||||
return BSP_ERROR_NONE;
|
return BSP_ERROR_NONE;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Redirect console output to COM
|
* @brief Redirect console output to COM
|
||||||
*/
|
*/
|
||||||
#ifdef __GNUC__
|
#ifdef __GNUC__
|
||||||
int __io_putchar (int ch)
|
int __io_putchar(int ch)
|
||||||
#else
|
#else
|
||||||
int fputc (int ch, FILE *f)
|
int fputc(int ch, FILE *f)
|
||||||
#endif /* __GNUC__ */
|
#endif /* __GNUC__ */
|
||||||
{
|
{
|
||||||
HAL_UART_Transmit (&hcom_uart [COM_ActiveLogPort], (uint8_t *) &ch, 1, COM_POLL_TIMEOUT);
|
HAL_UART_Transmit(&hcom_uart[COM_ActiveLogPort], (uint8_t *)&ch, 1,
|
||||||
|
COM_POLL_TIMEOUT);
|
||||||
return ch;
|
return ch;
|
||||||
}
|
}
|
||||||
#endif /* USE_COM_LOG */
|
#endif /* USE_COM_LOG */
|
||||||
#endif /* USE_BSP_COM_FEATURE */
|
#endif /* USE_BSP_COM_FEATURE */
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @}
|
* @}
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/** @defgroup STM32H7XX_NUCLEO_LOW_LEVEL_Private_Functions LOW LEVEL Private functions
|
/** @defgroup STM32H7XX_NUCLEO_LOW_LEVEL_Private_Functions LOW LEVEL Private
|
||||||
* @{
|
* functions
|
||||||
*/
|
* @{
|
||||||
|
*/
|
||||||
/**
|
/**
|
||||||
* @brief Key EXTI line detection callbacks.
|
* @brief Key EXTI line detection callbacks.
|
||||||
* @retval BSP status
|
* @retval BSP status
|
||||||
*/
|
*/
|
||||||
static void BUTTON_USER_EXTI_Callback(void)
|
static void BUTTON_USER_EXTI_Callback(void) { BSP_PB_Callback(BUTTON_USER); }
|
||||||
{
|
|
||||||
BSP_PB_Callback(BUTTON_USER);
|
|
||||||
}
|
|
||||||
|
|
||||||
#if (USE_BSP_COM_FEATURE > 0)
|
#if (USE_BSP_COM_FEATURE > 0)
|
||||||
/**
|
/**
|
||||||
* @brief Initializes UART MSP.
|
* @brief Initializes UART MSP.
|
||||||
* @param huart UART handle
|
* @param huart UART handle
|
||||||
* @retval BSP status
|
* @retval BSP status
|
||||||
*/
|
*/
|
||||||
static void COM1_MspInit(UART_HandleTypeDef *huart)
|
static void COM1_MspInit(UART_HandleTypeDef *huart) {
|
||||||
{
|
|
||||||
GPIO_InitTypeDef gpio_init_structure;
|
GPIO_InitTypeDef gpio_init_structure;
|
||||||
|
|
||||||
/* Prevent unused argument(s) compilation warning */
|
/* Prevent unused argument(s) compilation warning */
|
||||||
@ -652,22 +590,21 @@ static void COM1_MspInit(UART_HandleTypeDef *huart)
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Initialize USART3 Msp part
|
* @brief Initialize USART3 Msp part
|
||||||
* @param huart UART handle
|
* @param huart UART handle
|
||||||
* @retval BSP status
|
* @retval BSP status
|
||||||
*/
|
*/
|
||||||
static void COM1_MspDeInit(UART_HandleTypeDef *huart)
|
static void COM1_MspDeInit(UART_HandleTypeDef *huart) {
|
||||||
{
|
GPIO_InitTypeDef gpio_init_structure;
|
||||||
GPIO_InitTypeDef gpio_init_structure;
|
|
||||||
|
|
||||||
/* Prevent unused argument(s) compilation warning */
|
/* Prevent unused argument(s) compilation warning */
|
||||||
UNUSED(huart);
|
UNUSED(huart);
|
||||||
|
|
||||||
/* COM GPIO pin configuration */
|
/* COM GPIO pin configuration */
|
||||||
gpio_init_structure.Pin = COM1_TX_PIN;
|
gpio_init_structure.Pin = COM1_TX_PIN;
|
||||||
HAL_GPIO_DeInit(COM1_TX_GPIO_PORT, gpio_init_structure.Pin);
|
HAL_GPIO_DeInit(COM1_TX_GPIO_PORT, gpio_init_structure.Pin);
|
||||||
|
|
||||||
gpio_init_structure.Pin = COM1_RX_PIN;
|
gpio_init_structure.Pin = COM1_RX_PIN;
|
||||||
HAL_GPIO_DeInit(COM1_RX_GPIO_PORT, gpio_init_structure.Pin);
|
HAL_GPIO_DeInit(COM1_RX_GPIO_PORT, gpio_init_structure.Pin);
|
||||||
|
|
||||||
/* Disable USART clock */
|
/* Disable USART clock */
|
||||||
@ -675,19 +612,19 @@ static void COM1_MspDeInit(UART_HandleTypeDef *huart)
|
|||||||
}
|
}
|
||||||
#endif /* USE_BSP_COM_FEATURE */
|
#endif /* USE_BSP_COM_FEATURE */
|
||||||
/**
|
/**
|
||||||
* @}
|
* @}
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @}
|
* @}
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @}
|
* @}
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @}
|
* @}
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/
|
/************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/
|
||||||
|
@ -4,27 +4,26 @@
|
|||||||
* the debug port.
|
* the debug port.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include <stdlib.h>
|
|
||||||
#include <stdint.h>
|
|
||||||
#include <unistd.h>
|
|
||||||
#include <fcntl.h>
|
|
||||||
#include <errno.h>
|
#include <errno.h>
|
||||||
|
#include <fcntl.h>
|
||||||
|
#include <stdint.h>
|
||||||
|
#include <stdio.h>
|
||||||
|
#include <stdlib.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
#include <sys/stat.h>
|
#include <sys/stat.h>
|
||||||
#include <sys/types.h>
|
#include <sys/types.h>
|
||||||
#include <stdio.h>
|
#include <unistd.h>
|
||||||
|
|
||||||
#include <hardware_init.h>
|
|
||||||
#include <boardconfig.h>
|
#include <boardconfig.h>
|
||||||
|
#include <hardware_init.h>
|
||||||
|
|
||||||
|
#define AUTO_RETURN_AFTER_NEWLINE 1
|
||||||
#define AUTO_RETURN_AFTER_NEWLINE 1
|
|
||||||
|
|
||||||
// _write currently adds \n after \r automatically.
|
// _write currently adds \n after \r automatically.
|
||||||
// If the At91lib\utility\stdio.c printf implementation is not used anymore:
|
// If the At91lib\utility\stdio.c printf implementation is not used anymore:
|
||||||
// remove if there are spurious newlines!
|
// remove if there are spurious newlines!
|
||||||
|
|
||||||
//int _read(int file, void *ptr, size_t len) {
|
// int _read(int file, void *ptr, size_t len) {
|
||||||
// (void)len;
|
// (void)len;
|
||||||
// if(file <= STDERR_FILENO) {
|
// if(file <= STDERR_FILENO) {
|
||||||
// *(char *) ptr = DBGU_GetChar();
|
// *(char *) ptr = DBGU_GetChar();
|
||||||
@ -43,112 +42,105 @@
|
|||||||
// return -1;
|
// return -1;
|
||||||
// }
|
// }
|
||||||
//
|
//
|
||||||
//}
|
// }
|
||||||
|
|
||||||
int _write(int file, const void *ptr, size_t len) {
|
int _write(int file, const void *ptr, size_t len) {
|
||||||
size_t i;
|
size_t i;
|
||||||
|
|
||||||
if(file <= STDERR_FILENO) {
|
if (file <= STDERR_FILENO) {
|
||||||
for(i=0; i<len; i++) {
|
for (i = 0; i < len; i++) {
|
||||||
#if AUTO_RETURN_AFTER_NEWLINE
|
#if AUTO_RETURN_AFTER_NEWLINE
|
||||||
if(((const char *) ptr)[i] == '\n' &&
|
if (((const char *)ptr)[i] == '\n' &&
|
||||||
((const char *) ptr)[i+1] != '\r') {
|
((const char *)ptr)[i + 1] != '\r') {
|
||||||
HAL_UART_Transmit(&huart3, (uint8_t*)"\r", 1 ,
|
HAL_UART_Transmit(&huart3, (uint8_t *)"\r", 1, DEBUG_UART_MS_TIMEOUT);
|
||||||
DEBUG_UART_MS_TIMEOUT);
|
}
|
||||||
}
|
|
||||||
#endif
|
#endif
|
||||||
uint8_t* character = (uint8_t*) ptr;
|
const uint8_t *character = (const uint8_t *)ptr;
|
||||||
HAL_UART_Transmit(&huart3, (uint8_t*) (character + i),
|
HAL_UART_Transmit(&huart3, (const uint8_t *)(character + i), 1,
|
||||||
1 , DEBUG_UART_MS_TIMEOUT);
|
DEBUG_UART_MS_TIMEOUT);
|
||||||
}
|
}
|
||||||
return len;
|
return len;
|
||||||
} else {
|
} else {
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
int _lseek (int file, int ptr, int dir) {
|
int _lseek(int file, int ptr, int dir) {
|
||||||
(void)file;
|
(void)file;
|
||||||
(void)ptr;
|
(void)ptr;
|
||||||
(void)dir;
|
(void)dir;
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
int _close(int file) {
|
int _close(int file) {
|
||||||
(void)file;
|
(void)file;
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
int _open(const char *name, int flags, ...) {
|
int _open(const char *name, int flags, ...) {
|
||||||
(void)name;
|
(void)name;
|
||||||
(void)flags;
|
(void)flags;
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
int _link(const char *oldpath, const char *newpath) {
|
int _link(const char *oldpath, const char *newpath) {
|
||||||
(void)oldpath;
|
(void)oldpath;
|
||||||
(void)newpath;
|
(void)newpath;
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
int _rename(const char *oldpath, const char *newpath) {
|
int _rename(const char *oldpath, const char *newpath) {
|
||||||
(void)oldpath;
|
(void)oldpath;
|
||||||
(void)newpath;
|
(void)newpath;
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
int _unlink(const char *pathname) {
|
int _unlink(const char *pathname) {
|
||||||
(void)pathname;
|
(void)pathname;
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
int fsync(int fd) {
|
int fsync(int fd) {
|
||||||
(void)fd;
|
(void)fd;
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
int _fstat(int fd, struct stat *st) {
|
int _fstat(int fd, struct stat *st) {
|
||||||
(void)fd;
|
(void)fd;
|
||||||
(void)st;
|
(void)st;
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
int _stat(const char *path, struct stat *st) {
|
int _stat(const char *path, struct stat *st) {
|
||||||
(void)path;
|
(void)path;
|
||||||
(void)st;
|
(void)st;
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
int _isatty(int fd) {
|
int _isatty(int fd) {
|
||||||
if(fd <= STDERR_FILENO) {
|
if (fd <= STDERR_FILENO) {
|
||||||
return 1;
|
return 1;
|
||||||
}
|
} else {
|
||||||
else {
|
return 0;
|
||||||
return 0;
|
}
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void exit(int n) {
|
void exit(int n) {
|
||||||
printf("\n\r EXITING WITH CODE: %u \n\r", n);
|
printf("\n\r EXITING WITH CODE: %u \n\r", n);
|
||||||
//restart();
|
// restart();
|
||||||
while(1);
|
while (1)
|
||||||
|
;
|
||||||
}
|
}
|
||||||
|
|
||||||
void _exit(int n) {
|
void _exit(int n) {
|
||||||
printf("\n\r EXITING WITH CODE: %u \n\r", n);
|
printf("\n\r EXITING WITH CODE: %u \n\r", n);
|
||||||
//restart();
|
// restart();
|
||||||
while(1);
|
while (1)
|
||||||
|
;
|
||||||
}
|
}
|
||||||
|
|
||||||
int _kill() {
|
int _kill() { return -1; }
|
||||||
return -1;
|
|
||||||
}
|
|
||||||
|
|
||||||
int _getpid() {
|
int _getpid() { return 1; }
|
||||||
return 1;
|
|
||||||
}
|
|
||||||
|
|
||||||
int _gettimeofday() {
|
int _gettimeofday() { return -1; }
|
||||||
return -1;
|
|
||||||
}
|
|
||||||
|
@ -1,4 +1 @@
|
|||||||
target_sources(${TARGET_NAME} PRIVATE
|
target_sources(${TARGET_NAME} PRIVATE SpiTest.cpp)
|
||||||
SpiTest.cpp
|
|
||||||
)
|
|
||||||
|
|
||||||
|
@ -1,21 +1,23 @@
|
|||||||
#include "SpiTest.h"
|
#include "SpiTest.h"
|
||||||
#include "fsfw_hal/stm32h7/spi/stm32h743zi.h"
|
#include "fsfw_hal/stm32h7/spi/stm32h743zi.h"
|
||||||
|
|
||||||
SpiTest::SpiTest(SpiComIF &spiComIF):
|
SpiTest::SpiTest(SpiComIF &spiComIF)
|
||||||
spiComIF(spiComIF), spiCookie(TEST_ADDRESS, spi::SpiBus::SPI_1,
|
: spiComIF(spiComIF),
|
||||||
spi::TransferModes::POLLING, &mspCfg, 1000000, spi::SpiModes::MODE_0, 32) {
|
spiCookie(TEST_ADDRESS, spi::SpiBus::SPI_1, spi::TransferModes::POLLING,
|
||||||
stm32h7::h743zi::standardPollingCfg(mspCfg);
|
&mspCfg, 1000000, spi::SpiModes::MODE_0, 32) {
|
||||||
spiComIF.initializeInterface(&spiCookie);
|
stm32h7::h743zi::standardPollingCfg(mspCfg);
|
||||||
|
spiComIF.initializeInterface(&spiCookie);
|
||||||
}
|
}
|
||||||
|
|
||||||
ReturnValue_t SpiTest::performOperation(uint8_t opCode) {
|
ReturnValue_t SpiTest::performOperation(uint8_t opCode) {
|
||||||
std::array<uint8_t, 3> dummyData = {0x01, 0x02, 0x03};
|
std::array<uint8_t, 3> dummyData = {0x01, 0x02, 0x03};
|
||||||
ReturnValue_t result = spiComIF.sendMessage(&spiCookie, dummyData.data(), dummyData.size());
|
ReturnValue_t result =
|
||||||
if(result != HasReturnvaluesIF::RETURN_OK) {
|
spiComIF.sendMessage(&spiCookie, dummyData.data(), dummyData.size());
|
||||||
return result;
|
if (result != HasReturnvaluesIF::RETURN_OK) {
|
||||||
}
|
return result;
|
||||||
std::array<uint8_t, 3> recBuf;
|
}
|
||||||
uint8_t* recPtr = recBuf.data();
|
std::array<uint8_t, 3> recBuf{};
|
||||||
size_t readLen = 0;
|
uint8_t *recPtr = recBuf.data();
|
||||||
return spiComIF.readReceivedMessage(&spiCookie, &recPtr, &readLen);
|
size_t readLen = 0;
|
||||||
|
return spiComIF.readReceivedMessage(&spiCookie, &recPtr, &readLen);
|
||||||
}
|
}
|
||||||
|
@ -7,14 +7,15 @@
|
|||||||
|
|
||||||
class SpiTest {
|
class SpiTest {
|
||||||
public:
|
public:
|
||||||
SpiTest(SpiComIF& spiComIF);
|
explicit SpiTest(SpiComIF &spiComIF);
|
||||||
|
|
||||||
|
ReturnValue_t performOperation(uint8_t opCode = 0);
|
||||||
|
|
||||||
ReturnValue_t performOperation(uint8_t opCode = 0);
|
|
||||||
private:
|
private:
|
||||||
static constexpr address_t TEST_ADDRESS = 0x00;
|
static constexpr address_t TEST_ADDRESS = 0x00;
|
||||||
spi::MspPollingConfigStruct mspCfg;
|
spi::MspPollingConfigStruct mspCfg;
|
||||||
SpiComIF& spiComIF;
|
SpiComIF &spiComIF;
|
||||||
SpiCookie spiCookie;
|
SpiCookie spiCookie;
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif /* BSP_STM32H7_FREERTOS_BOARDTEST_SPITEST_H_ */
|
#endif /* BSP_STM32H7_FREERTOS_BOARDTEST_SPITEST_H_ */
|
||||||
|
@ -1,5 +1 @@
|
|||||||
target_sources(${TARGET_NAME} PRIVATE
|
target_sources(${TARGET_NAME} PRIVATE InitMission.cpp ObjectFactory.cpp)
|
||||||
InitMission.cpp
|
|
||||||
ObjectFactory.cpp
|
|
||||||
)
|
|
||||||
|
|
||||||
|
@ -6,232 +6,256 @@
|
|||||||
#include "example/utility/TaskCreation.h"
|
#include "example/utility/TaskCreation.h"
|
||||||
#include "fsfw_tests/integration/assemblies/TestAssembly.h"
|
#include "fsfw_tests/integration/assemblies/TestAssembly.h"
|
||||||
|
|
||||||
|
#include "fsfw/devicehandlers/DeviceHandlerIF.h"
|
||||||
|
#include "fsfw/modes/HasModesIF.h"
|
||||||
|
#include "fsfw/modes/ModeMessage.h"
|
||||||
#include "fsfw/returnvalues/HasReturnvaluesIF.h"
|
#include "fsfw/returnvalues/HasReturnvaluesIF.h"
|
||||||
#include "fsfw/serviceinterface/ServiceInterface.h"
|
#include "fsfw/serviceinterface/ServiceInterface.h"
|
||||||
#include "fsfw/tasks/FixedTimeslotTaskIF.h"
|
#include "fsfw/tasks/FixedTimeslotTaskIF.h"
|
||||||
#include "fsfw/tasks/PeriodicTaskIF.h"
|
#include "fsfw/tasks/PeriodicTaskIF.h"
|
||||||
#include "fsfw/tasks/TaskFactory.h"
|
#include "fsfw/tasks/TaskFactory.h"
|
||||||
#include "fsfw/devicehandlers/DeviceHandlerIF.h"
|
|
||||||
#include "fsfw/modes/HasModesIF.h"
|
|
||||||
#include "fsfw/modes/ModeMessage.h"
|
|
||||||
|
|
||||||
#include "FreeRTOS.h"
|
#include "FreeRTOS.h"
|
||||||
|
|
||||||
|
void assemlyDemo();
|
||||||
|
|
||||||
void InitMission::createTasks() {
|
void InitMission::createTasks() {
|
||||||
TaskFactory* taskFactory = TaskFactory::instance();
|
TaskFactory *taskFactory = TaskFactory::instance();
|
||||||
|
ReturnValue_t result = HasReturnvaluesIF::RETURN_OK;
|
||||||
|
static_cast<void>(taskFactory);
|
||||||
|
static_cast<void>(result);
|
||||||
#if OBSW_ADD_CORE_COMPONENTS == 1
|
#if OBSW_ADD_CORE_COMPONENTS == 1
|
||||||
/* TMTC Distribution */
|
/* TMTC Distribution */
|
||||||
PeriodicTaskIF* distributerTask = taskFactory->createPeriodicTask(
|
PeriodicTaskIF *distributerTask =
|
||||||
"DIST", 5, 1024 * 2, 0.2, nullptr);
|
taskFactory->createPeriodicTask("DIST", 5, 1024 * 2, 0.2, nullptr);
|
||||||
ReturnValue_t result = distributerTask->addComponent(objects::CCSDS_DISTRIBUTOR);
|
result = distributerTask->addComponent(objects::CCSDS_DISTRIBUTOR);
|
||||||
if(result!=HasReturnvaluesIF::RETURN_OK) {
|
if (result != HasReturnvaluesIF::RETURN_OK) {
|
||||||
task::printInitError("CCSDS distributor", objects::CCSDS_DISTRIBUTOR);
|
task::printInitError("CCSDS distributor", objects::CCSDS_DISTRIBUTOR);
|
||||||
}
|
}
|
||||||
result = distributerTask->addComponent(objects::PUS_DISTRIBUTOR);
|
result = distributerTask->addComponent(objects::PUS_DISTRIBUTOR);
|
||||||
if(result!=HasReturnvaluesIF::RETURN_OK){
|
if (result != HasReturnvaluesIF::RETURN_OK) {
|
||||||
task::printInitError("PUS distributor", objects::PUS_DISTRIBUTOR);
|
task::printInitError("PUS distributor", objects::PUS_DISTRIBUTOR);
|
||||||
}
|
}
|
||||||
result = distributerTask->addComponent(objects::TM_FUNNEL);
|
result = distributerTask->addComponent(objects::TM_FUNNEL);
|
||||||
if(result != HasReturnvaluesIF::RETURN_OK) {
|
if (result != HasReturnvaluesIF::RETURN_OK) {
|
||||||
task::printInitError("TM funnel", objects::TM_FUNNEL);
|
task::printInitError("TM funnel", objects::TM_FUNNEL);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* UDP bridge */
|
#if OBSW_ADD_LWIP_COMPONENTS == 1
|
||||||
PeriodicTaskIF* udpBridgeTask = TaskFactory::instance()->createPeriodicTask(
|
/* UDP bridge */
|
||||||
"UDP_UNIX_BRIDGE", 6, 1024 * 2, 0.2, nullptr);
|
PeriodicTaskIF *udpBridgeTask = TaskFactory::instance()->createPeriodicTask(
|
||||||
result = udpBridgeTask->addComponent(objects::UDP_BRIDGE);
|
"UDP_UNIX_BRIDGE", 6, 1024 * 2, 0.2, nullptr);
|
||||||
if(result != HasReturnvaluesIF::RETURN_OK) {
|
result = udpBridgeTask->addComponent(objects::UDP_BRIDGE);
|
||||||
task::printInitError("UDP bridge", objects::UDP_BRIDGE);
|
if (result != HasReturnvaluesIF::RETURN_OK) {
|
||||||
}
|
task::printInitError("UDP bridge", objects::UDP_BRIDGE);
|
||||||
PeriodicTaskIF* udpPollingTask = TaskFactory::instance()->
|
}
|
||||||
createPeriodicTask("UDP_POLLING", 8, 1024, 0.1, nullptr);
|
PeriodicTaskIF *udpPollingTask = TaskFactory::instance()->createPeriodicTask(
|
||||||
result = udpPollingTask->addComponent(objects::UDP_POLLING_TASK);
|
"UDP_POLLING", 8, 1024, 0.1, nullptr);
|
||||||
if(result != HasReturnvaluesIF::RETURN_OK) {
|
result = udpPollingTask->addComponent(objects::UDP_POLLING_TASK);
|
||||||
task::printInitError("UDP polling task", objects::UDP_POLLING_TASK);
|
if (result != HasReturnvaluesIF::RETURN_OK) {
|
||||||
}
|
task::printInitError("UDP polling task", objects::UDP_POLLING_TASK);
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
PeriodicTaskIF* eventManagerTask = TaskFactory::instance()->createPeriodicTask(
|
PeriodicTaskIF *eventManagerTask =
|
||||||
"EVENT_MGMT", 4, 1024 * 2, 0.1, nullptr);
|
TaskFactory::instance()->createPeriodicTask("EVENT_MGMT", 4, 1024 * 2,
|
||||||
result = eventManagerTask->addComponent(objects::EVENT_MANAGER);
|
0.1, nullptr);
|
||||||
if(result!=HasReturnvaluesIF::RETURN_OK) {
|
result = eventManagerTask->addComponent(objects::EVENT_MANAGER);
|
||||||
task::printInitError("Event Manager", objects::EVENT_MANAGER);
|
if (result != HasReturnvaluesIF::RETURN_OK) {
|
||||||
}
|
task::printInitError("Event Manager", objects::EVENT_MANAGER);
|
||||||
|
}
|
||||||
#endif /* OBSW_ADD_CORE_COMPONENTS == 1 */
|
#endif /* OBSW_ADD_CORE_COMPONENTS == 1 */
|
||||||
|
|
||||||
#if OBSW_ADD_PUS_STACK == 1
|
#if OBSW_ADD_PUS_STACK == 1
|
||||||
/* PUS Services */
|
/* PUS Services */
|
||||||
PeriodicTaskIF* pusVerification = TaskFactory::instance()->createPeriodicTask(
|
PeriodicTaskIF *pusVerification = TaskFactory::instance()->createPeriodicTask(
|
||||||
"PUS_VERIF_1", 4, 1024 * 2, 0.2, nullptr);
|
"PUS_VERIF_1", 4, 1024 * 2, 0.2, nullptr);
|
||||||
result = pusVerification->addComponent(objects::PUS_SERVICE_1_VERIFICATION);
|
result = pusVerification->addComponent(objects::PUS_SERVICE_1_VERIFICATION);
|
||||||
if(result != HasReturnvaluesIF::RETURN_OK){
|
if (result != HasReturnvaluesIF::RETURN_OK) {
|
||||||
task::printInitError("PUS 1", objects::PUS_SERVICE_1_VERIFICATION);
|
task::printInitError("PUS 1", objects::PUS_SERVICE_1_VERIFICATION);
|
||||||
}
|
}
|
||||||
|
|
||||||
PeriodicTaskIF* pusHighPrio = TaskFactory::instance()->createPeriodicTask(
|
PeriodicTaskIF *pusHighPrio = TaskFactory::instance()->createPeriodicTask(
|
||||||
"PUS_HIGH_PRIO", 5, 1024 * 2, 0.2, nullptr);
|
"PUS_HIGH_PRIO", 5, 1024 * 2, 0.2, nullptr);
|
||||||
result = pusHighPrio->addComponent(objects::PUS_SERVICE_2_DEVICE_ACCESS);
|
result = pusHighPrio->addComponent(objects::PUS_SERVICE_2_DEVICE_ACCESS);
|
||||||
if(result!=HasReturnvaluesIF::RETURN_OK){
|
if (result != HasReturnvaluesIF::RETURN_OK) {
|
||||||
task::printInitError("PUS 2", objects::PUS_SERVICE_2_DEVICE_ACCESS);
|
task::printInitError("PUS 2", objects::PUS_SERVICE_2_DEVICE_ACCESS);
|
||||||
}
|
}
|
||||||
result = pusHighPrio->addComponent(objects::PUS_SERVICE_5_EVENT_REPORTING);
|
result = pusHighPrio->addComponent(objects::PUS_SERVICE_5_EVENT_REPORTING);
|
||||||
if(result != HasReturnvaluesIF::RETURN_OK){
|
if (result != HasReturnvaluesIF::RETURN_OK) {
|
||||||
task::printInitError("PUS 5", objects::PUS_SERVICE_5_EVENT_REPORTING);
|
task::printInitError("PUS 5", objects::PUS_SERVICE_5_EVENT_REPORTING);
|
||||||
}
|
}
|
||||||
result = pusHighPrio->addComponent(objects::PUS_SERVICE_9_TIME_MGMT);
|
result = pusHighPrio->addComponent(objects::PUS_SERVICE_9_TIME_MGMT);
|
||||||
if(result!=HasReturnvaluesIF::RETURN_OK){
|
if (result != HasReturnvaluesIF::RETURN_OK) {
|
||||||
task::printInitError("PUS 9", objects::PUS_SERVICE_9_TIME_MGMT);
|
task::printInitError("PUS 9", objects::PUS_SERVICE_9_TIME_MGMT);
|
||||||
}
|
}
|
||||||
|
|
||||||
PeriodicTaskIF* pusMedPrio = TaskFactory::instance()->createPeriodicTask(
|
PeriodicTaskIF *pusMedPrio = TaskFactory::instance()->createPeriodicTask(
|
||||||
"PUS_HIGH_PRIO", 4, 1024 * 2, 0.8, nullptr);
|
"PUS_HIGH_PRIO", 4, 1024 * 2, 0.8, nullptr);
|
||||||
result = pusMedPrio->addComponent(objects::PUS_SERVICE_8_FUNCTION_MGMT);
|
result = pusMedPrio->addComponent(objects::PUS_SERVICE_8_FUNCTION_MGMT);
|
||||||
if(result!=HasReturnvaluesIF::RETURN_OK){
|
if (result != HasReturnvaluesIF::RETURN_OK) {
|
||||||
task::printInitError("PUS 8", objects::PUS_SERVICE_8_FUNCTION_MGMT);
|
task::printInitError("PUS 8", objects::PUS_SERVICE_8_FUNCTION_MGMT);
|
||||||
}
|
}
|
||||||
result = pusMedPrio->addComponent(objects::PUS_SERVICE_200_MODE_MGMT);
|
result = pusMedPrio->addComponent(objects::PUS_SERVICE_200_MODE_MGMT);
|
||||||
if(result!=HasReturnvaluesIF::RETURN_OK){
|
if (result != HasReturnvaluesIF::RETURN_OK) {
|
||||||
task::printInitError("PUS 200", objects::PUS_SERVICE_200_MODE_MGMT);
|
task::printInitError("PUS 200", objects::PUS_SERVICE_200_MODE_MGMT);
|
||||||
}
|
}
|
||||||
|
|
||||||
PeriodicTaskIF* pusLowPrio = TaskFactory::instance()->createPeriodicTask(
|
PeriodicTaskIF *pusLowPrio = TaskFactory::instance()->createPeriodicTask(
|
||||||
"PUS_LOW_PRIO", 3, 1024 * 2, 1.6, nullptr);
|
"PUS_LOW_PRIO", 3, 1024 * 2, 1.6, nullptr);
|
||||||
result = pusLowPrio->addComponent(objects::PUS_SERVICE_17_TEST);
|
result = pusLowPrio->addComponent(objects::PUS_SERVICE_17_TEST);
|
||||||
if(result!=HasReturnvaluesIF::RETURN_OK){
|
if (result != HasReturnvaluesIF::RETURN_OK) {
|
||||||
task::printInitError("PUS 17", objects::PUS_SERVICE_17_TEST);
|
task::printInitError("PUS 17", objects::PUS_SERVICE_17_TEST);
|
||||||
}
|
}
|
||||||
#endif /* OBSW_ADD_PUS_STACK == 1 */
|
#endif /* OBSW_ADD_PUS_STACK == 1 */
|
||||||
|
|
||||||
#if OBSW_ADD_TASK_EXAMPLE == 1
|
#if OBSW_ADD_TASK_EXAMPLE == 1
|
||||||
FixedTimeslotTaskIF* timeslotDemoTask = TaskFactory::instance()->createFixedTimeslotTask(
|
FixedTimeslotTaskIF *timeslotDemoTask =
|
||||||
"PST_TASK", 6, 1024 * 2, 0.5, nullptr);
|
TaskFactory::instance()->createFixedTimeslotTask("PST_TASK", 6, 1024 * 2,
|
||||||
result = pst::pollingSequenceExamples(timeslotDemoTask);
|
0.5, nullptr);
|
||||||
if(result != HasReturnvaluesIF::RETURN_OK) {
|
result = pst::pollingSequenceExamples(timeslotDemoTask);
|
||||||
|
if (result != HasReturnvaluesIF::RETURN_OK) {
|
||||||
#if FSFW_CPP_OSTREAM_ENABLED == 1
|
#if FSFW_CPP_OSTREAM_ENABLED == 1
|
||||||
sif::error << "InitMission::createTasks: PST initialization failed!" << std::endl;
|
sif::error << "InitMission::createTasks: PST initialization failed!"
|
||||||
|
<< std::endl;
|
||||||
#else
|
#else
|
||||||
sif::printError( "InitMission::createTasks: PST initialization failed!\n");
|
sif::printError("InitMission::createTasks: PST initialization failed!\n");
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
PeriodicTaskIF* readerTask = TaskFactory::instance()->createPeriodicTask(
|
PeriodicTaskIF *readerTask = TaskFactory::instance()->createPeriodicTask(
|
||||||
"READER_TASK", 3, 1024, 1.0, nullptr);
|
"READER_TASK", 3, 1024, 1.0, nullptr);
|
||||||
result = readerTask->addComponent(objects::TEST_DUMMY_4);
|
result = readerTask->addComponent(objects::TEST_DUMMY_4);
|
||||||
if(result != HasReturnvaluesIF::RETURN_OK) {
|
if (result != HasReturnvaluesIF::RETURN_OK) {
|
||||||
task::printInitError("TEST_DUMMY_4", objects::TEST_DUMMY_4);
|
task::printInitError("TEST_DUMMY_4", objects::TEST_DUMMY_4);
|
||||||
}
|
}
|
||||||
#endif /* OBSW_ADD_TASK_EXAMPLE == 1 */
|
#endif /* OBSW_ADD_TASK_EXAMPLE == 1 */
|
||||||
|
|
||||||
#if OBSW_ADD_DEVICE_HANDLER_DEMO == 1
|
#if OBSW_ADD_DEVICE_HANDLER_DEMO == 1
|
||||||
FixedTimeslotTaskIF* testDevicesTask = TaskFactory::instance()->createFixedTimeslotTask(
|
FixedTimeslotTaskIF *testDevicesTask =
|
||||||
"PST_TEST_TASK", 7, 1024 * 2, 1.0, nullptr);
|
TaskFactory::instance()->createFixedTimeslotTask("PST_TEST_TASK", 7,
|
||||||
result = pst::pollingSequenceDevices(testDevicesTask);
|
1024 * 2, 1.0, nullptr);
|
||||||
if(result != HasReturnvaluesIF::RETURN_OK) {
|
result = pst::pollingSequenceDevices(testDevicesTask);
|
||||||
|
if (result != HasReturnvaluesIF::RETURN_OK) {
|
||||||
#if FSFW_CPP_OSTREAM_ENABLED == 1
|
#if FSFW_CPP_OSTREAM_ENABLED == 1
|
||||||
sif::error << "InitMission::createTasks: Test PST initialization failed!" << std::endl;
|
sif::error << "InitMission::createTasks: Test PST initialization failed!"
|
||||||
|
<< std::endl;
|
||||||
#else
|
#else
|
||||||
sif::printError("InitMission::createTasks: Test PST initialization faiedl!\n");
|
sif::printError(
|
||||||
|
"InitMission::createTasks: Test PST initialization faiedl!\n");
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
PeriodicTaskIF* assemblyTask = taskFactory->createPeriodicTask("ASS_TASK", 3,
|
PeriodicTaskIF *assemblyTask =
|
||||||
1024, 2.0, nullptr);
|
taskFactory->createPeriodicTask("ASS_TASK", 3, 1024, 2.0, nullptr);
|
||||||
if(assemblyTask == nullptr){
|
if (assemblyTask == nullptr) {
|
||||||
task::printInitError("ASS_TASK", objects::TEST_ASSEMBLY);
|
task::printInitError("ASS_TASK", objects::TEST_ASSEMBLY);
|
||||||
}
|
}
|
||||||
result = assemblyTask->addComponent(objects::TEST_ASSEMBLY);
|
result = assemblyTask->addComponent(objects::TEST_ASSEMBLY);
|
||||||
if(result != HasReturnvaluesIF::RETURN_OK) {
|
if (result != HasReturnvaluesIF::RETURN_OK) {
|
||||||
task::printInitError("ASS_TASK", objects::TEST_ASSEMBLY);
|
task::printInitError("ASS_TASK", objects::TEST_ASSEMBLY);
|
||||||
}
|
}
|
||||||
#endif /* OBSW_ADD_DEVICE_HANDLER_DEMO == 1 */
|
#endif /* OBSW_ADD_DEVICE_HANDLER_DEMO == 1 */
|
||||||
|
|
||||||
PeriodicTaskIF* testTask = TaskFactory::instance()->createPeriodicTask(
|
PeriodicTaskIF *testTask = TaskFactory::instance()->createPeriodicTask(
|
||||||
"TEST", 2, 2048, 1.0, nullptr);
|
"TEST", 2, 2048, 1.0, nullptr);
|
||||||
result = testTask->addComponent(objects::TEST_TASK);
|
result = testTask->addComponent(objects::TEST_TASK);
|
||||||
if(result != HasReturnvaluesIF::RETURN_OK) {
|
if (result != HasReturnvaluesIF::RETURN_OK) {
|
||||||
task::printInitError("Test Task", objects::TEST_TASK);
|
task::printInitError("Test Task", objects::TEST_TASK);
|
||||||
}
|
}
|
||||||
|
|
||||||
#if OBSW_PERIPHERAL_PST == 1
|
#if OBSW_PERIPHERAL_PST == 1
|
||||||
FixedTimeslotTaskIF* peripheralPst = TaskFactory::instance()->createFixedTimeslotTask(
|
FixedTimeslotTaskIF *peripheralPst =
|
||||||
"PST_PERIPHERAL_TASK", 9, 1024 * 2, 2.0, nullptr);
|
TaskFactory::instance()->createFixedTimeslotTask("PST_PERIPHERAL_TASK", 9,
|
||||||
result = pst::pstPeripheralsTest(peripheralPst);
|
1024 * 2, 2.0, nullptr);
|
||||||
if(result != HasReturnvaluesIF::RETURN_OK) {
|
result = pst::pstPeripheralsTest(peripheralPst);
|
||||||
|
if (result != HasReturnvaluesIF::RETURN_OK) {
|
||||||
#if FSFW_CPP_OSTREAM_ENABLED == 1
|
#if FSFW_CPP_OSTREAM_ENABLED == 1
|
||||||
sif::error << "InitMission::createTasks: Test PST initialization failed!" << std::endl;
|
sif::error << "InitMission::createTasks: Test PST initialization failed!"
|
||||||
|
<< std::endl;
|
||||||
#else
|
#else
|
||||||
sif::printError("InitMission::createTasks: Test PST initialization faiedl!\n");
|
sif::printError(
|
||||||
|
"InitMission::createTasks: Test PST initialization faiedl!\n");
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if FSFW_CPP_OSTREAM_ENABLED == 1
|
#if FSFW_CPP_OSTREAM_ENABLED == 1
|
||||||
sif::info << "Starting tasks.." << std::endl;
|
sif::info << "Starting tasks.." << std::endl;
|
||||||
#else
|
#else
|
||||||
sif::printInfo("Starting tasks..\n");
|
sif::printInfo("Starting tasks..\n");
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if OBSW_ADD_CORE_COMPONENTS == 1
|
#if OBSW_ADD_CORE_COMPONENTS == 1
|
||||||
distributerTask->startTask();
|
distributerTask->startTask();
|
||||||
eventManagerTask->startTask();
|
eventManagerTask->startTask();
|
||||||
udpBridgeTask->startTask();
|
#if OBSW_ADD_LWIP_COMPONENTS == 1
|
||||||
udpPollingTask->startTask();
|
udpBridgeTask->startTask();
|
||||||
|
udpPollingTask->startTask();
|
||||||
|
#endif
|
||||||
#endif /* OBSW_ADD_CORE_COMPONENTS == 1 */
|
#endif /* OBSW_ADD_CORE_COMPONENTS == 1 */
|
||||||
|
|
||||||
#if OBSW_ADD_PUS_STACK == 1
|
#if OBSW_ADD_PUS_STACK == 1
|
||||||
pusVerification->startTask();
|
pusVerification->startTask();
|
||||||
pusHighPrio->startTask();
|
pusHighPrio->startTask();
|
||||||
pusMedPrio->startTask();
|
pusMedPrio->startTask();
|
||||||
pusLowPrio->startTask();
|
pusLowPrio->startTask();
|
||||||
#endif /* OBSW_ADD_PUS_STACK == 1 */
|
#endif /* OBSW_ADD_PUS_STACK == 1 */
|
||||||
|
|
||||||
#if OBSW_ADD_TASK_EXAMPLE == 1
|
#if OBSW_ADD_TASK_EXAMPLE == 1
|
||||||
timeslotDemoTask->startTask();
|
timeslotDemoTask->startTask();
|
||||||
readerTask->startTask();
|
readerTask->startTask();
|
||||||
#endif /* OBSW_ADD_TASK_EXAMPLE == 1 */
|
#endif /* OBSW_ADD_TASK_EXAMPLE == 1 */
|
||||||
|
|
||||||
#if OBSW_ADD_DEVICE_HANDLER_DEMO == 1
|
#if OBSW_ADD_DEVICE_HANDLER_DEMO == 1
|
||||||
testDevicesTask->startTask();
|
testDevicesTask->startTask();
|
||||||
assemblyTask->startTask();
|
assemblyTask->startTask();
|
||||||
#endif /* OBSW_ADD_DEVICE_HANDLER_DEMO == 1 */
|
#endif /* OBSW_ADD_DEVICE_HANDLER_DEMO == 1 */
|
||||||
|
|
||||||
#if OBSW_PERIPHERAL_PST == 1
|
#if OBSW_PERIPHERAL_PST == 1
|
||||||
peripheralPst->startTask();
|
peripheralPst->startTask();
|
||||||
#endif /* OBSW_PERIPHERAL_PST == 1 */
|
#endif /* OBSW_PERIPHERAL_PST == 1 */
|
||||||
|
|
||||||
testTask->startTask();
|
testTask->startTask();
|
||||||
|
|
||||||
#if FSFW_CPP_OSTREAM_ENABLED == 1
|
#if FSFW_CPP_OSTREAM_ENABLED == 1
|
||||||
sif::info << "Remaining FreeRTOS heap size: " << std::dec << xPortGetFreeHeapSize() <<
|
sif::info << "Remaining FreeRTOS heap size: " << std::dec
|
||||||
" bytes." << std::endl;
|
<< xPortGetFreeHeapSize() << " bytes." << std::endl;
|
||||||
sif::info << "Tasks started.." << std::endl;
|
sif::info << "Tasks started.." << std::endl;
|
||||||
#else
|
#else
|
||||||
sif::printInfo("Remaining FreeRTOS heap size: %lu\n",
|
sif::printInfo("Remaining FreeRTOS heap size: %lu\n",
|
||||||
static_cast<unsigned long>(xPortGetFreeHeapSize()));
|
static_cast<unsigned long>(xPortGetFreeHeapSize()));
|
||||||
sif::printInfo("Tasks started..\n");
|
sif::printInfo("Tasks started..\n");
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if OBSW_ADD_DEVICE_HANDLER_DEMO
|
#if OBSW_ADD_DEVICE_HANDLER_DEMO
|
||||||
HasModesIF* assembly = ObjectManager::instance()->get<HasModesIF>(objects::TEST_ASSEMBLY);
|
auto *assembly = ObjectManager::instance()->get<HasModesIF>(objects::TEST_ASSEMBLY);
|
||||||
if (assembly == nullptr){
|
if (assembly == nullptr) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
#if FSFW_CPP_OSTREAM_ENABLED == 1
|
#if FSFW_CPP_OSTREAM_ENABLED == 1
|
||||||
sif::info << "Waiting 5 Seconds and then command Test Assembly to Normal, Dual" << std::endl;
|
sif::info
|
||||||
|
<< "Waiting 5 Seconds and then command Test Assembly to Normal, Dual"
|
||||||
|
<< std::endl;
|
||||||
#else
|
#else
|
||||||
sif::printInfo("Waiting 5 Seconds and then command Test Assembly to Normal, Dual \n");
|
sif::printInfo(
|
||||||
|
"Waiting 5 Seconds and then command Test Assembly to Normal, Dual \n");
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
TaskFactory::delayTask(5000);
|
TaskFactory::delayTask(5000);
|
||||||
|
|
||||||
|
#endif /* OBSW_ADD_DEVICE_HANDLER_DEMO */
|
||||||
|
}
|
||||||
|
|
||||||
|
void assemblyDemo(HasModesIF* assembly) {
|
||||||
CommandMessage modeMessage;
|
CommandMessage modeMessage;
|
||||||
ModeMessage::setModeMessage(&modeMessage, ModeMessage::CMD_MODE_COMMAND,
|
ModeMessage::setModeMessage(&modeMessage, ModeMessage::CMD_MODE_COMMAND,
|
||||||
DeviceHandlerIF::MODE_NORMAL, TestAssembly::submodes::DUAL);
|
DeviceHandlerIF::MODE_NORMAL,
|
||||||
|
TestAssembly::submodes::DUAL);
|
||||||
#if FSFW_CPP_OSTREAM_ENABLED == 1
|
#if FSFW_CPP_OSTREAM_ENABLED == 1
|
||||||
sif::info << "Commanding Test Assembly to Normal, Dual" << std::endl;
|
sif::info << "Commanding Test Assembly to Normal, Dual" << std::endl;
|
||||||
#else
|
#else
|
||||||
sif::printInfo("Commanding Test Assembly to Normal, Dual \n");
|
sif::printInfo("Commanding Test Assembly to Normal, Dual \n");
|
||||||
#endif
|
#endif
|
||||||
MessageQueueSenderIF::sendMessage(assembly->getCommandQueue(), &modeMessage,
|
MessageQueueSenderIF::sendMessage(assembly->getCommandQueue(), &modeMessage,
|
||||||
MessageQueueIF::NO_QUEUE);
|
MessageQueueIF::NO_QUEUE);
|
||||||
#endif /* OBSW_ADD_DEVICE_HANDLER_DEMO */
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1,101 +1,93 @@
|
|||||||
#include "ObjectFactory.h"
|
#include "ObjectFactory.h"
|
||||||
#include "OBSWConfig.h"
|
#include "OBSWConfig.h"
|
||||||
#include "devices/devAddresses.h"
|
|
||||||
#include "objects/systemObjectList.h"
|
|
||||||
#include "hardware_init.h"
|
#include "hardware_init.h"
|
||||||
|
#include "objects/systemObjectList.h"
|
||||||
|
|
||||||
#include "example/utility/TmFunnel.h"
|
|
||||||
#include "example/core/GenericFactory.h"
|
#include "example/core/GenericFactory.h"
|
||||||
|
|
||||||
#include "example_common/stm32h7/networking/UdpTcLwIpPollingTask.h"
|
|
||||||
#include "example_common/stm32h7/networking/TmTcLwIpUdpBridge.h"
|
|
||||||
#include "example_common/stm32h7/STM32TestTask.h"
|
#include "example_common/stm32h7/STM32TestTask.h"
|
||||||
|
#include "example_common/stm32h7/networking/TmTcLwIpUdpBridge.h"
|
||||||
#include "fsfw/datapoollocal/LocalDataPoolManager.h"
|
#include "example_common/stm32h7/networking/UdpTcLwIpPollingTask.h"
|
||||||
#include "fsfw/monitoring/MonitoringMessageContent.h"
|
|
||||||
#include "fsfw/storagemanager/PoolManager.h"
|
#include "fsfw/storagemanager/PoolManager.h"
|
||||||
#include "fsfw/tmtcpacket/pus/tm.h"
|
|
||||||
#include "fsfw/tmtcservices/CommandingServiceBase.h"
|
|
||||||
#include "fsfw/tmtcservices/PusServiceBase.h"
|
#include "fsfw/tmtcservices/PusServiceBase.h"
|
||||||
|
|
||||||
|
|
||||||
#if OBSW_PERFORM_L3GD20H_TEST == 1
|
#if OBSW_PERFORM_L3GD20H_TEST == 1
|
||||||
#include "fsfw/hal/stm32h7/spi/SpiCookie.h"
|
|
||||||
#include "fsfw/hal/stm32h7/spi/SpiComIF.h"
|
|
||||||
#include "fsfw/hal/devicehandlers/GyroL3GD20Handler.h"
|
#include "fsfw/hal/devicehandlers/GyroL3GD20Handler.h"
|
||||||
#include "fsfw/hal/stm32h7/spi/stm32h743ziSpi.h"
|
#include "fsfw/hal/stm32h7/spi/SpiComIF.h"
|
||||||
|
#include "fsfw/hal/stm32h7/spi/SpiCookie.h"
|
||||||
#include "fsfw/hal/stm32h7/spi/spiCore.h"
|
#include "fsfw/hal/stm32h7/spi/spiCore.h"
|
||||||
DMA_HandleTypeDef* txHandle = nullptr;
|
#include "fsfw/hal/stm32h7/spi/stm32h743ziSpi.h"
|
||||||
DMA_HandleTypeDef* rxHandle = nullptr;
|
DMA_HandleTypeDef *txHandle = nullptr;
|
||||||
|
DMA_HandleTypeDef *rxHandle = nullptr;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
void ObjectFactory::produce(void* args) {
|
void ObjectFactory::produce(void *args) {
|
||||||
/* Located inside GenericFactory source file */
|
/* Located inside GenericFactory source file */
|
||||||
Factory::setStaticFrameworkObjectIds();
|
Factory::setStaticFrameworkObjectIds();
|
||||||
|
|
||||||
#if OBSW_ADD_CORE_COMPONENTS == 1
|
#if OBSW_ADD_CORE_COMPONENTS == 1
|
||||||
{
|
{
|
||||||
LocalPool::LocalPoolConfig poolCfg = {
|
LocalPool::LocalPoolConfig poolCfg = {
|
||||||
{100, 32}, {30, 64}, {10, 128}, {2, 1024}
|
{100, 32}, {30, 64}, {10, 128}, {2, 1024}};
|
||||||
};
|
new PoolManager(objects::TC_STORE, poolCfg);
|
||||||
new PoolManager(objects::TC_STORE, poolCfg);
|
}
|
||||||
}
|
|
||||||
|
|
||||||
{
|
{
|
||||||
LocalPool::LocalPoolConfig poolCfg = {
|
LocalPool::LocalPoolConfig poolCfg = {
|
||||||
{100, 32}, {30, 64}, {10, 128}, {2, 1024}
|
{100, 32}, {30, 64}, {10, 128}, {2, 1024}};
|
||||||
};
|
new PoolManager(objects::TM_STORE, poolCfg);
|
||||||
new PoolManager(objects::TM_STORE, poolCfg);
|
}
|
||||||
}
|
|
||||||
|
|
||||||
{
|
{
|
||||||
LocalPool::LocalPoolConfig poolCfg = {
|
LocalPool::LocalPoolConfig poolCfg = {
|
||||||
{100, 32}, {30, 64}, {10, 128}, {2, 1024}
|
{100, 32}, {30, 64}, {10, 128}, {2, 1024}};
|
||||||
};
|
new PoolManager(objects::IPC_STORE, poolCfg);
|
||||||
new PoolManager(objects::IPC_STORE, poolCfg);
|
}
|
||||||
}
|
|
||||||
|
|
||||||
/* UDP Server */
|
#if OBSW_ADD_LWIP_COMPONENTS == 1
|
||||||
new TmTcLwIpUdpBridge(objects::UDP_BRIDGE,
|
/* UDP Server */
|
||||||
objects::CCSDS_DISTRIBUTOR, objects::TM_STORE, objects::TC_STORE);
|
new TmTcLwIpUdpBridge(objects::UDP_BRIDGE, objects::CCSDS_DISTRIBUTOR,
|
||||||
new UdpTcLwIpPollingTask(objects::UDP_POLLING_TASK, objects::UDP_BRIDGE, &gnetif);
|
objects::TM_STORE, objects::TC_STORE);
|
||||||
|
new UdpTcLwIpPollingTask(objects::UDP_POLLING_TASK, objects::UDP_BRIDGE,
|
||||||
|
&gnetif);
|
||||||
|
#endif
|
||||||
#endif /* OBSW_ADD_CORE_COMPONENTS == 1 */
|
#endif /* OBSW_ADD_CORE_COMPONENTS == 1 */
|
||||||
|
|
||||||
ObjectFactory::produceGenericObjects();
|
ObjectFactory::produceGenericObjects();
|
||||||
|
|
||||||
/* Test Device Handler */
|
/* Test Device Handler */
|
||||||
new STM32TestTask(objects::TEST_TASK, false, true);
|
new STM32TestTask(objects::TEST_TASK, true, true);
|
||||||
|
|
||||||
#if OBSW_PERFORM_L3GD20H_TEST == 1
|
#if OBSW_PERFORM_L3GD20H_TEST == 1
|
||||||
|
spi::MspCfgBase *mspCfg = nullptr;
|
||||||
|
spi::TransferModes transferMode = spi::TransferModes::DMA;
|
||||||
|
if (transferMode == spi::TransferModes::POLLING) {
|
||||||
|
auto typedCfg = new spi::MspPollingConfigStruct();
|
||||||
|
spi::h743zi::standardPollingCfg(*typedCfg);
|
||||||
|
mspCfg = typedCfg;
|
||||||
|
} else if (transferMode == spi::TransferModes::INTERRUPT) {
|
||||||
|
auto typedCfg = new spi::MspIrqConfigStruct();
|
||||||
|
spi::h743zi::standardInterruptCfg(*typedCfg,
|
||||||
|
IrqPriorities::HIGHEST_FREERTOS);
|
||||||
|
mspCfg = typedCfg;
|
||||||
|
} else if (transferMode == spi::TransferModes::DMA) {
|
||||||
|
auto typedCfg = new spi::MspDmaConfigStruct();
|
||||||
|
txHandle = new DMA_HandleTypeDef();
|
||||||
|
rxHandle = new DMA_HandleTypeDef();
|
||||||
|
spi::setDmaHandles(txHandle, rxHandle);
|
||||||
|
spi::h743zi::standardDmaCfg(*typedCfg, IrqPriorities::HIGHEST_FREERTOS,
|
||||||
|
IrqPriorities::HIGHEST_FREERTOS,
|
||||||
|
IrqPriorities::HIGHEST_FREERTOS);
|
||||||
|
mspCfg = typedCfg;
|
||||||
|
}
|
||||||
|
|
||||||
spi::MspCfgBase* mspCfg = nullptr;
|
new SpiComIF(objects::SPI_COM_IF);
|
||||||
spi::TransferModes transferMode = spi::TransferModes::DMA;
|
auto spiCookie = new SpiCookie(devaddress::L3GD20H, spi::SpiBus::SPI_1,
|
||||||
if(transferMode == spi::TransferModes::POLLING) {
|
transferMode, mspCfg, 3900000,
|
||||||
auto typedCfg = new spi::MspPollingConfigStruct();
|
spi::SpiModes::MODE_3, GPIO_PIN_14, GPIOD, 32);
|
||||||
spi::h743zi::standardPollingCfg(*typedCfg);
|
auto gyroDevice = new GyroHandlerL3GD20H(objects::SPI_DEVICE_TEST,
|
||||||
mspCfg = typedCfg;
|
objects::SPI_COM_IF, spiCookie);
|
||||||
}
|
gyroDevice->setStartUpImmediately();
|
||||||
else if(transferMode == spi::TransferModes::INTERRUPT) {
|
gyroDevice->setGoNormalModeAtStartup();
|
||||||
auto typedCfg = new spi::MspIrqConfigStruct();
|
|
||||||
spi::h743zi::standardInterruptCfg(*typedCfg, IrqPriorities::HIGHEST_FREERTOS);
|
|
||||||
mspCfg = typedCfg;
|
|
||||||
}
|
|
||||||
else if(transferMode == spi::TransferModes::DMA) {
|
|
||||||
auto typedCfg = new spi::MspDmaConfigStruct();
|
|
||||||
txHandle = new DMA_HandleTypeDef();
|
|
||||||
rxHandle = new DMA_HandleTypeDef();
|
|
||||||
spi::setDmaHandles(txHandle, rxHandle);
|
|
||||||
spi::h743zi::standardDmaCfg(*typedCfg, IrqPriorities::HIGHEST_FREERTOS,
|
|
||||||
IrqPriorities::HIGHEST_FREERTOS, IrqPriorities::HIGHEST_FREERTOS);
|
|
||||||
mspCfg = typedCfg;
|
|
||||||
}
|
|
||||||
|
|
||||||
new SpiComIF(objects::SPI_COM_IF);
|
|
||||||
auto spiCookie = new SpiCookie(devaddress::L3GD20H, spi::SpiBus::SPI_1, transferMode, mspCfg,
|
|
||||||
3900000, spi::SpiModes::MODE_3, GPIO_PIN_14, GPIOD, 32);
|
|
||||||
auto gyroDevice = new GyroHandlerL3GD20H(objects::SPI_DEVICE_TEST, objects::SPI_COM_IF,
|
|
||||||
spiCookie);
|
|
||||||
gyroDevice->setStartUpImmediately();
|
|
||||||
gyroDevice->setGoNormalModeAtStartup();
|
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
@ -1,10 +1,9 @@
|
|||||||
#ifndef MISSION_CORE_OBJECTFACTORY_H_
|
#ifndef MISSION_CORE_OBJECTFACTORY_H_
|
||||||
#define MISSION_CORE_OBJECTFACTORY_H_
|
#define MISSION_CORE_OBJECTFACTORY_H_
|
||||||
|
|
||||||
|
|
||||||
namespace ObjectFactory {
|
namespace ObjectFactory {
|
||||||
void setStatics();
|
void setStatics();
|
||||||
void produce(void* args);
|
void produce(void *args);
|
||||||
};
|
}; // namespace ObjectFactory
|
||||||
|
|
||||||
#endif /* MISSION_CORE_OBJECTFACTORY_H_ */
|
#endif /* MISSION_CORE_OBJECTFACTORY_H_ */
|
||||||
|
@ -1,11 +1,6 @@
|
|||||||
target_sources(${TARGET_NAME}
|
target_sources(
|
||||||
PRIVATE
|
${TARGET_NAME} PRIVATE ipc/missionMessageTypes.cpp
|
||||||
ipc/missionMessageTypes.cpp
|
pollingsequence/pollingSequenceFactory.cpp)
|
||||||
pollingsequence/pollingSequenceFactory.cpp
|
|
||||||
)
|
|
||||||
|
|
||||||
# Add include paths for the executable
|
# Add include paths for the executable
|
||||||
target_include_directories(${TARGET_NAME}
|
target_include_directories(${TARGET_NAME} PUBLIC ${CMAKE_CURRENT_SOURCE_DIR})
|
||||||
PUBLIC
|
|
||||||
${CMAKE_CURRENT_SOURCE_DIR}
|
|
||||||
)
|
|
||||||
|
@ -4,11 +4,8 @@
|
|||||||
#include <cstdint>
|
#include <cstdint>
|
||||||
|
|
||||||
namespace devaddress {
|
namespace devaddress {
|
||||||
enum devaddress: uint32_t {
|
enum devaddress : uint32_t { L3GD20H = 1 };
|
||||||
L3GD20H = 1
|
|
||||||
};
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
#endif /* BSP_STM32_FREERTOS_FSFWCONFIG_DEVICES_DEVADDRESSES_H_ */
|
#endif /* BSP_STM32_FREERTOS_FSFWCONFIG_DEVICES_DEVADDRESSES_H_ */
|
||||||
|
@ -4,8 +4,7 @@
|
|||||||
#include "commonSubsystemIds.h"
|
#include "commonSubsystemIds.h"
|
||||||
|
|
||||||
namespace SUBSYSTEM_ID {
|
namespace SUBSYSTEM_ID {
|
||||||
enum subsystemId: uint8_t {
|
enum subsystemId : uint8_t {};
|
||||||
};
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif /* FSFWCONFIG_TMTC_SUBSYSTEMIDRANGES_H_ */
|
#endif /* FSFWCONFIG_TMTC_SUBSYSTEMIDRANGES_H_ */
|
||||||
|
@ -2,10 +2,10 @@
|
|||||||
#include <fsfw/ipc/CommandMessage.h>
|
#include <fsfw/ipc/CommandMessage.h>
|
||||||
#include <fsfw/ipc/CommandMessageCleaner.h>
|
#include <fsfw/ipc/CommandMessageCleaner.h>
|
||||||
|
|
||||||
void messagetypes::clearMissionMessage(CommandMessage* message) {
|
void messagetypes::clearMissionMessage(CommandMessage *message) {
|
||||||
switch((message->getMessageType())) {
|
switch ((message->getMessageType())) {
|
||||||
default:
|
default:
|
||||||
message->setCommand(CommandMessage::CMD_NONE);
|
message->setCommand(CommandMessage::CMD_NONE);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -7,13 +7,14 @@ class CommandMessage;
|
|||||||
|
|
||||||
namespace messagetypes {
|
namespace messagetypes {
|
||||||
/* First type must have number MESSAGE_TYPE::FW_MESSAGES_COUNT! */
|
/* First type must have number MESSAGE_TYPE::FW_MESSAGES_COUNT! */
|
||||||
/* Remember to add new message types to the clearMissionMessage function below! */
|
/* Remember to add new message types to the clearMissionMessage function below!
|
||||||
|
*/
|
||||||
enum MISSION_MESSAGE_TYPE {
|
enum MISSION_MESSAGE_TYPE {
|
||||||
COSTUM_MESSAGE = FW_MESSAGES_COUNT,
|
COSTUM_MESSAGE = FW_MESSAGES_COUNT,
|
||||||
};
|
};
|
||||||
|
|
||||||
void clearMissionMessage(CommandMessage* message);
|
void clearMissionMessage(CommandMessage *message);
|
||||||
|
|
||||||
}
|
} // namespace messagetypes
|
||||||
|
|
||||||
#endif /* FSFWCONFIG_IPC_MISSIONMESSAGETYPES_H_ */
|
#endif /* FSFWCONFIG_IPC_MISSIONMESSAGETYPES_H_ */
|
||||||
|
@ -1,19 +1,19 @@
|
|||||||
#ifndef FSFWCONFIG_OBJECTS_SYSTEMOBJECTLIST_H_
|
#ifndef FSFWCONFIG_OBJECTS_SYSTEMOBJECTLIST_H_
|
||||||
#define FSFWCONFIG_OBJECTS_SYSTEMOBJECTLIST_H_
|
#define FSFWCONFIG_OBJECTS_SYSTEMOBJECTLIST_H_
|
||||||
|
|
||||||
#include <commonSystemObjects.h>
|
#include <commonObjects.h>
|
||||||
|
|
||||||
namespace objects {
|
namespace objects {
|
||||||
enum mission_objects {
|
enum mission_objects {
|
||||||
/* 0x62 ('b') Board and mission specific objects */
|
/* 0x62 ('b') Board and mission specific objects */
|
||||||
UDP_BRIDGE = 0x62000300,
|
UDP_BRIDGE = 0x62000300,
|
||||||
UDP_POLLING_TASK = 0x62000400,
|
UDP_POLLING_TASK = 0x62000400,
|
||||||
|
|
||||||
SPI_COM_IF = 0x63001000,
|
SPI_COM_IF = 0x63001000,
|
||||||
SPI_DEVICE_TEST = 0x74001000,
|
SPI_DEVICE_TEST = 0x74001000,
|
||||||
|
|
||||||
/* Generic name for FSFW static ID setter */
|
/* Generic name for FSFW static ID setter */
|
||||||
DOWNLINK_DESTINATION = UDP_BRIDGE
|
DOWNLINK_DESTINATION = UDP_BRIDGE
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -8,26 +8,30 @@
|
|||||||
#include <fsfw/tasks/FixedTimeslotTaskIF.h>
|
#include <fsfw/tasks/FixedTimeslotTaskIF.h>
|
||||||
|
|
||||||
ReturnValue_t pst::pstPeripheralsTest(FixedTimeslotTaskIF *thisSequence) {
|
ReturnValue_t pst::pstPeripheralsTest(FixedTimeslotTaskIF *thisSequence) {
|
||||||
uint32_t length = thisSequence->getPeriodMs();
|
uint32_t length = thisSequence->getPeriodMs();
|
||||||
static_cast<void>(length);
|
static_cast<void>(length);
|
||||||
|
|
||||||
#if OBSW_PERFORM_L3GD20H_TEST == 1
|
#if OBSW_PERFORM_L3GD20H_TEST == 1
|
||||||
thisSequence->addSlot(objects::SPI_DEVICE_TEST, 0, DeviceHandlerIF::PERFORM_OPERATION);
|
thisSequence->addSlot(objects::SPI_DEVICE_TEST, 0,
|
||||||
thisSequence->addSlot(objects::SPI_DEVICE_TEST, 0.3, DeviceHandlerIF::SEND_WRITE);
|
DeviceHandlerIF::PERFORM_OPERATION);
|
||||||
thisSequence->addSlot(objects::SPI_DEVICE_TEST, 0.45 * length,
|
thisSequence->addSlot(objects::SPI_DEVICE_TEST, 0.3,
|
||||||
DeviceHandlerIF::GET_WRITE);
|
DeviceHandlerIF::SEND_WRITE);
|
||||||
thisSequence->addSlot(objects::SPI_DEVICE_TEST, 0.6 * length, DeviceHandlerIF::SEND_READ);
|
thisSequence->addSlot(objects::SPI_DEVICE_TEST, 0.45 * length,
|
||||||
thisSequence->addSlot(objects::SPI_DEVICE_TEST, 0.8 * length, DeviceHandlerIF::GET_READ);
|
DeviceHandlerIF::GET_WRITE);
|
||||||
|
thisSequence->addSlot(objects::SPI_DEVICE_TEST, 0.6 * length,
|
||||||
|
DeviceHandlerIF::SEND_READ);
|
||||||
|
thisSequence->addSlot(objects::SPI_DEVICE_TEST, 0.8 * length,
|
||||||
|
DeviceHandlerIF::GET_READ);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
if (thisSequence->checkSequence() == HasReturnvaluesIF::RETURN_OK) {
|
if (thisSequence->checkSequence() == HasReturnvaluesIF::RETURN_OK) {
|
||||||
return HasReturnvaluesIF::RETURN_OK;
|
return HasReturnvaluesIF::RETURN_OK;
|
||||||
}
|
}
|
||||||
#if FSFW_CPP_OSTREAM_ENABLED == 1
|
#if FSFW_CPP_OSTREAM_ENABLED == 1
|
||||||
sif::error << "pst::pollingSequenceInitFunction: Initialization errors!" << std::endl;
|
sif::error << "pst::pollingSequenceInitFunction: Initialization errors!"
|
||||||
|
<< std::endl;
|
||||||
#else
|
#else
|
||||||
sif::printError("pst::pollingSequenceInitFunction: Initialization errors!\n");
|
sif::printError("pst::pollingSequenceInitFunction: Initialization errors!\n");
|
||||||
#endif
|
#endif
|
||||||
return HasReturnvaluesIF::RETURN_FAILED;
|
return HasReturnvaluesIF::RETURN_FAILED;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -9,7 +9,7 @@ class FixedTimeslotTaskIF;
|
|||||||
namespace pst {
|
namespace pst {
|
||||||
ReturnValue_t pstPeripheralsTest(FixedTimeslotTaskIF *thisSequence);
|
ReturnValue_t pstPeripheralsTest(FixedTimeslotTaskIF *thisSequence);
|
||||||
ReturnValue_t pollingSequenceExamples(FixedTimeslotTaskIF *thisSequence);
|
ReturnValue_t pollingSequenceExamples(FixedTimeslotTaskIF *thisSequence);
|
||||||
ReturnValue_t pollingSequenceDevices(FixedTimeslotTaskIF* thisSequence);
|
ReturnValue_t pollingSequenceDevices(FixedTimeslotTaskIF *thisSequence);
|
||||||
}
|
} // namespace pst
|
||||||
|
|
||||||
#endif /* POLLINGSEQUENCE_POLLINGSEQUENCFACTORY_H_ */
|
#endif /* POLLINGSEQUENCE_POLLINGSEQUENCFACTORY_H_ */
|
||||||
|
@ -4,9 +4,7 @@
|
|||||||
#include <commonConfig.h>
|
#include <commonConfig.h>
|
||||||
|
|
||||||
namespace CLASS_ID {
|
namespace CLASS_ID {
|
||||||
enum classIds: uint8_t {
|
enum classIds : uint8_t {};
|
||||||
};
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
#endif /* FSFWCONFIG_RETURNVALUES_CLASSIDS_H_ */
|
#endif /* FSFWCONFIG_RETURNVALUES_CLASSIDS_H_ */
|
||||||
|
@ -1,8 +1,8 @@
|
|||||||
#ifndef FSFWCONFIG_TMTC_APID_H_
|
#ifndef FSFWCONFIG_TMTC_APID_H_
|
||||||
#define FSFWCONFIG_TMTC_APID_H_
|
#define FSFWCONFIG_TMTC_APID_H_
|
||||||
|
|
||||||
#include <cstdint>
|
|
||||||
#include <commonConfig.h>
|
#include <commonConfig.h>
|
||||||
|
#include <cstdint>
|
||||||
|
|
||||||
namespace apid {
|
namespace apid {
|
||||||
static const uint16_t APID = COMMON_APID;
|
static const uint16_t APID = COMMON_APID;
|
||||||
|
@ -3,5 +3,4 @@
|
|||||||
|
|
||||||
#include <commonConfig.h>
|
#include <commonConfig.h>
|
||||||
|
|
||||||
|
|
||||||
#endif /* FSFWCONFIG_TMTC_PUSIDS_H_ */
|
#endif /* FSFWCONFIG_TMTC_PUSIDS_H_ */
|
||||||
|
@ -1,7 +1,5 @@
|
|||||||
#include "hardware_init.h"
|
|
||||||
#include "boardconfig.h"
|
|
||||||
#include "OBSWVersion.h"
|
|
||||||
#include "OBSWConfig.h"
|
#include "OBSWConfig.h"
|
||||||
|
#include "hardware_init.h"
|
||||||
|
|
||||||
#if OBSW_ADD_LWIP_COMPONENTS == 1
|
#if OBSW_ADD_LWIP_COMPONENTS == 1
|
||||||
#include <lwip/init.h>
|
#include <lwip/init.h>
|
||||||
@ -16,16 +14,14 @@
|
|||||||
#include <fsfw/serviceinterface/ServiceInterface.h>
|
#include <fsfw/serviceinterface/ServiceInterface.h>
|
||||||
#include <fsfw/tasks/TaskFactory.h>
|
#include <fsfw/tasks/TaskFactory.h>
|
||||||
|
|
||||||
#include "FreeRTOS.h"
|
|
||||||
#include "task.h"
|
|
||||||
#include "cmsis_os.h"
|
#include "cmsis_os.h"
|
||||||
|
#include "task.h"
|
||||||
|
|
||||||
#include <cstdio>
|
#include <cstdio>
|
||||||
#if FSFW_CPP_OSTREAM_ENABLED == 1
|
#if FSFW_CPP_OSTREAM_ENABLED == 1
|
||||||
#include <iostream>
|
#include <iostream>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
||||||
#if !defined(BOARD_NAME)
|
#if !defined(BOARD_NAME)
|
||||||
#define BOARD_NAME "unknown board"
|
#define BOARD_NAME "unknown board"
|
||||||
#endif
|
#endif
|
||||||
@ -45,46 +41,44 @@ void initTask(void *parameters);
|
|||||||
* @author R. Mueller, J. Meier
|
* @author R. Mueller, J. Meier
|
||||||
*/
|
*/
|
||||||
int main() {
|
int main() {
|
||||||
performHardwareInit();
|
performHardwareInit();
|
||||||
|
|
||||||
xTaskCreate(initTask, "INIT_TASK", 2048, nullptr, 9, nullptr);
|
xTaskCreate(initTask, "INIT_TASK", 2048, nullptr, 9, nullptr);
|
||||||
|
|
||||||
/* Start scheduler */
|
/* Start scheduler */
|
||||||
osKernelStart();
|
osKernelStart();
|
||||||
|
|
||||||
/* Should not be reached, scheduler should now be running. */
|
/* Should not be reached, scheduler should now be running. */
|
||||||
for(;;) {}
|
for (;;) {}
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
void initTask(void *parameters) {
|
void initTask(void *parameters) {
|
||||||
#if OBSW_ADD_LWIP_COMPONENTS == 1
|
#if OBSW_ADD_LWIP_COMPONENTS == 1
|
||||||
/* Initialize the LwIP stack */
|
/* Initialize the LwIP stack */
|
||||||
lwip_init();
|
lwip_init();
|
||||||
|
|
||||||
/* Configure the Network interface */
|
/* Configure the Network interface */
|
||||||
Netif_Config();
|
Netif_Config();
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
utility::commonInitPrint("FreeRTOS", BOARD_NAME);
|
utility::commonInitPrint("FreeRTOS", BOARD_NAME);
|
||||||
|
|
||||||
#if FSFW_CPP_OSTREAM_ENABLED == 1
|
#if FSFW_CPP_OSTREAM_ENABLED == 1
|
||||||
sif::info << "Creating objects.." << std::endl;
|
sif::info << "Creating objects.." << std::endl;
|
||||||
#else
|
#else
|
||||||
sif::printInfo("Creating objects..\n\r");
|
sif::printInfo("Creating objects..\n\r");
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
ObjectManager* objManager = ObjectManager::instance();
|
ObjectManager *objManager = ObjectManager::instance();
|
||||||
objManager->setObjectFactoryFunction(ObjectFactory::produce, nullptr);
|
objManager->setObjectFactoryFunction(ObjectFactory::produce, nullptr);
|
||||||
objManager->initialize();
|
objManager->initialize();
|
||||||
|
|
||||||
#if FSFW_CPP_OSTREAM_ENABLED == 1
|
#if FSFW_CPP_OSTREAM_ENABLED == 1
|
||||||
sif::info << "Creating tasks.." << std::endl;
|
sif::info << "Creating tasks.." << std::endl;
|
||||||
#else
|
#else
|
||||||
sif::printInfo("Creating tasks..\n\r");
|
sif::printInfo("Creating tasks..\n\r");
|
||||||
#endif
|
#endif
|
||||||
InitMission::createTasks();
|
InitMission::createTasks();
|
||||||
TaskFactory::instance()->deleteTask(nullptr);
|
TaskFactory::deleteTask(nullptr);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1,4 +1 @@
|
|||||||
target_sources(${TARGET_NAME} PRIVATE
|
target_sources(${TARGET_NAME} PRIVATE print.c)
|
||||||
print.c
|
|
||||||
)
|
|
||||||
|
|
||||||
|
@ -1,7 +1,6 @@
|
|||||||
#include <hardware_init.h>
|
|
||||||
#include <boardconfig.h>
|
#include <boardconfig.h>
|
||||||
|
#include <hardware_init.h>
|
||||||
|
|
||||||
void printChar(const char* character) {
|
void printChar(const char *character) {
|
||||||
HAL_UART_Transmit(&huart3, (uint8_t *)character, 1 , DEBUG_UART_MS_TIMEOUT);
|
HAL_UART_Transmit(&huart3, (const uint8_t *)character, 1, DEBUG_UART_MS_TIMEOUT);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1,45 +0,0 @@
|
|||||||
function(set_build_type)
|
|
||||||
|
|
||||||
message(STATUS "Used build generator: ${CMAKE_GENERATOR}")
|
|
||||||
|
|
||||||
# Set a default build type if none was specified
|
|
||||||
set(DEFAULT_BUILD_TYPE "RelWithDebInfo")
|
|
||||||
if(EXISTS "${CMAKE_SOURCE_DIR}/.git")
|
|
||||||
set(DEFAULT_BUILD_TYPE "Debug")
|
|
||||||
endif()
|
|
||||||
|
|
||||||
if(NOT CMAKE_BUILD_TYPE AND NOT CMAKE_CONFIGURATION_TYPES)
|
|
||||||
message(STATUS
|
|
||||||
"Setting build type to '${DEFAULT_BUILD_TYPE}' as none was specified."
|
|
||||||
)
|
|
||||||
set(CMAKE_BUILD_TYPE "${DEFAULT_BUILD_TYPE}" CACHE
|
|
||||||
STRING "Choose the type of build." FORCE
|
|
||||||
)
|
|
||||||
# Set the possible values of build type for cmake-gui
|
|
||||||
set_property(CACHE CMAKE_BUILD_TYPE PROPERTY STRINGS
|
|
||||||
"Debug" "Release" "MinSizeRel" "RelWithDebInfo"
|
|
||||||
)
|
|
||||||
endif()
|
|
||||||
|
|
||||||
if(${CMAKE_BUILD_TYPE} MATCHES "Debug")
|
|
||||||
message(STATUS
|
|
||||||
"Building Debug application with flags: ${CMAKE_C_FLAGS_DEBUG}"
|
|
||||||
)
|
|
||||||
elseif(${CMAKE_BUILD_TYPE} MATCHES "RelWithDebInfo")
|
|
||||||
message(STATUS
|
|
||||||
"Building Release (Debug) application with "
|
|
||||||
"flags: ${CMAKE_C_FLAGS_RELWITHDEBINFO}"
|
|
||||||
)
|
|
||||||
elseif(${CMAKE_BUILD_TYPE} MATCHES "MinSizeRel")
|
|
||||||
message(STATUS
|
|
||||||
"Building Release (Size) application with "
|
|
||||||
"flags: ${CMAKE_C_FLAGS_MINSIZEREL}"
|
|
||||||
)
|
|
||||||
else()
|
|
||||||
message(STATUS
|
|
||||||
"Building Release (Speed) application with "
|
|
||||||
"flags: ${CMAKE_C_FLAGS_RELEASE}"
|
|
||||||
)
|
|
||||||
endif()
|
|
||||||
|
|
||||||
endfunction()
|
|
@ -1,33 +0,0 @@
|
|||||||
#!/bin/sh
|
|
||||||
counter=0
|
|
||||||
cfg_script_name="cmake-build-cfg.py"
|
|
||||||
while [ ${counter} -lt 5 ]
|
|
||||||
do
|
|
||||||
if [ -f ${cfg_script_name} ];then
|
|
||||||
break
|
|
||||||
fi
|
|
||||||
counter=$((counter=counter + 1))
|
|
||||||
cd ..
|
|
||||||
done
|
|
||||||
|
|
||||||
if [ "${counter}" -ge 5 ];then
|
|
||||||
echo "${cfg_script_name} not found in upper directories!"
|
|
||||||
exit 1
|
|
||||||
fi
|
|
||||||
|
|
||||||
build_generator=""
|
|
||||||
os_fsfw="freertos"
|
|
||||||
builddir="build-Debug"
|
|
||||||
if [ "${OS}" = "Windows_NT" ]; then
|
|
||||||
build_generator="MinGW Makefiles"
|
|
||||||
python="py"
|
|
||||||
# Could be other OS but this works for now.
|
|
||||||
else
|
|
||||||
build_generator="Unix Makefiles"
|
|
||||||
python="python3"
|
|
||||||
fi
|
|
||||||
|
|
||||||
echo "Running command (without the leading +):"
|
|
||||||
set -x # Print command
|
|
||||||
${python} ${cfg_script_name} -o "${os_fsfw}" -g "${build_generator}" -b "debug" -l "${builddir}"
|
|
||||||
# set +x
|
|
@ -1,33 +0,0 @@
|
|||||||
#!/bin/sh
|
|
||||||
counter=0
|
|
||||||
cfg_script_name="cmake-build-cfg.py"
|
|
||||||
while [ ${counter} -lt 5 ]
|
|
||||||
do
|
|
||||||
if [ -f ${cfg_script_name} ];then
|
|
||||||
break
|
|
||||||
fi
|
|
||||||
counter=$((counter=counter + 1))
|
|
||||||
cd ..
|
|
||||||
done
|
|
||||||
|
|
||||||
if [ "${counter}" -ge 5 ];then
|
|
||||||
echo "${cfg_script_name} not found in upper directories!"
|
|
||||||
exit 1
|
|
||||||
fi
|
|
||||||
|
|
||||||
build_generator=""
|
|
||||||
os_fsfw="freertos"
|
|
||||||
builddir="build-Release"
|
|
||||||
if [ "${OS}" = "Windows_NT" ]; then
|
|
||||||
build_generator="MinGW Makefiles"
|
|
||||||
python="py"
|
|
||||||
# Could be other OS but this works for now.
|
|
||||||
else
|
|
||||||
build_generator="Unix Makefiles"
|
|
||||||
python="python3"
|
|
||||||
fi
|
|
||||||
|
|
||||||
echo "Running command (without the leading +):"
|
|
||||||
set -x # Print command
|
|
||||||
${python} ${cfg_script_name} -o "${os_fsfw}" -g "${build_generator}" -b "release" -l "${builddir}"
|
|
||||||
# set +x
|
|
@ -1,33 +0,0 @@
|
|||||||
#!/bin/sh
|
|
||||||
counter=0
|
|
||||||
cfg_script_name="cmake-build-cfg.py"
|
|
||||||
while [ ${counter} -lt 5 ]
|
|
||||||
do
|
|
||||||
if [ -f ${cfg_script_name} ];then
|
|
||||||
break
|
|
||||||
fi
|
|
||||||
counter=$((counter=counter + 1))
|
|
||||||
cd ..
|
|
||||||
done
|
|
||||||
|
|
||||||
if [ "${counter}" -ge 5 ];then
|
|
||||||
echo "${cfg_script_name} not found in upper directories!"
|
|
||||||
exit 1
|
|
||||||
fi
|
|
||||||
|
|
||||||
build_generator=""
|
|
||||||
os_fsfw="freertos"
|
|
||||||
builddir="build-Release"
|
|
||||||
if [ "${OS}" = "Windows_NT" ]; then
|
|
||||||
build_generator="MinGW Makefiles"
|
|
||||||
python="py"
|
|
||||||
# Could be other OS but this works for now.
|
|
||||||
else
|
|
||||||
build_generator="Unix Makefiles"
|
|
||||||
python="python3"
|
|
||||||
fi
|
|
||||||
|
|
||||||
echo "Running command (without the leading +):"
|
|
||||||
set -x # Print command
|
|
||||||
${python} ${cfg_script_name} -o "${os_fsfw}" -g "${build_generator}" -b "size" -l "${builddir}"
|
|
||||||
# set +x
|
|
@ -1,32 +0,0 @@
|
|||||||
#!/bin/sh
|
|
||||||
counter=0
|
|
||||||
cfg_script_name="cmake-build-cfg.py"
|
|
||||||
while [ ${counter} -lt 5 ]
|
|
||||||
do
|
|
||||||
if [ -f ${cfg_script_name} ];then
|
|
||||||
break
|
|
||||||
fi
|
|
||||||
counter=$((counter=counter + 1))
|
|
||||||
cd ..
|
|
||||||
done
|
|
||||||
|
|
||||||
if [ "${counter}" -ge 5 ];then
|
|
||||||
echo "${cfg_script_name} not found in upper directories!"
|
|
||||||
exit 1
|
|
||||||
fi
|
|
||||||
|
|
||||||
build_generator=""
|
|
||||||
os_fsfw="freertos"
|
|
||||||
builddir="build-Debug"
|
|
||||||
build_generator="Ninja"
|
|
||||||
if [ "${OS}" = "Windows_NT" ]; then
|
|
||||||
python="py"
|
|
||||||
# Could be other OS but this works for now.
|
|
||||||
else
|
|
||||||
python="python3"
|
|
||||||
fi
|
|
||||||
|
|
||||||
echo "Running command (without the leading +):"
|
|
||||||
set -x # Print command
|
|
||||||
${python} ${cfg_script_name} -o "${os_fsfw}" -g "${build_generator}" -b "debug" -l "${builddir}"
|
|
||||||
# set +x
|
|
42
cmake/scripts/stm32h7-make-debug.sh
Executable file
42
cmake/scripts/stm32h7-make-debug.sh
Executable file
@ -0,0 +1,42 @@
|
|||||||
|
#!/bin/sh
|
||||||
|
counter=0
|
||||||
|
init_dir=$(pwd)
|
||||||
|
cfg_script_name="cmake-build-cfg.py"
|
||||||
|
cfg_script=""
|
||||||
|
if [ ! -z ${REPO_ROOT} ]; then
|
||||||
|
cfg_script=${REPO_ROOT}/cmake/${cfg_script_name}
|
||||||
|
else
|
||||||
|
while [ ${counter} -lt 5 ]
|
||||||
|
do
|
||||||
|
if [ -f ${cfg_script_name} ];then
|
||||||
|
cfg_script=$(pwd)/${cfg_script_name}
|
||||||
|
break
|
||||||
|
fi
|
||||||
|
counter=$((counter=counter + 1))
|
||||||
|
cd ..
|
||||||
|
done
|
||||||
|
|
||||||
|
if [ "${counter}" -ge 5 ];then
|
||||||
|
echo "${cfg_script_name} not found in upper directories!"
|
||||||
|
cd ${init_dir}
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
cd ${init_dir}
|
||||||
|
fi
|
||||||
|
|
||||||
|
build_generator=""
|
||||||
|
os_fsfw="freertos"
|
||||||
|
builddir="cmake-build-debug"
|
||||||
|
if [ "${OS}" = "Windows_NT" ]; then
|
||||||
|
build_generator="MinGW Makefiles"
|
||||||
|
python="py"
|
||||||
|
# Could be other OS but this works for now.
|
||||||
|
else
|
||||||
|
build_generator="Unix Makefiles"
|
||||||
|
python="python3"
|
||||||
|
fi
|
||||||
|
|
||||||
|
echo "Running command (without the leading +):"
|
||||||
|
set -x # Print command
|
||||||
|
${python} ${cfg_script} -o "${os_fsfw}" -g "${build_generator}" -b "debug" -l "${builddir}"
|
||||||
|
# set +x
|
42
cmake/scripts/stm32h7-make-release.sh
Executable file
42
cmake/scripts/stm32h7-make-release.sh
Executable file
@ -0,0 +1,42 @@
|
|||||||
|
#!/bin/sh
|
||||||
|
counter=0
|
||||||
|
init_dir=$(pwd)
|
||||||
|
cfg_script_name="cmake-build-cfg.py"
|
||||||
|
cfg_script=""
|
||||||
|
if [ ! -z ${REPO_ROOT} ]; then
|
||||||
|
cfg_script=${REPO_ROOT}/cmake/${cfg_script_name}
|
||||||
|
else
|
||||||
|
while [ ${counter} -lt 5 ]
|
||||||
|
do
|
||||||
|
if [ -f ${cfg_script_name} ];then
|
||||||
|
cfg_script=$(pwd)/${cfg_script_name}
|
||||||
|
break
|
||||||
|
fi
|
||||||
|
counter=$((counter=counter + 1))
|
||||||
|
cd ..
|
||||||
|
done
|
||||||
|
|
||||||
|
if [ "${counter}" -ge 5 ];then
|
||||||
|
echo "${cfg_script_name} not found in upper directories!"
|
||||||
|
cd ${init_dir}
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
cd ${init_dir}
|
||||||
|
fi
|
||||||
|
|
||||||
|
build_generator=""
|
||||||
|
os_fsfw="freertos"
|
||||||
|
builddir="cmake-build-release"
|
||||||
|
if [ "${OS}" = "Windows_NT" ]; then
|
||||||
|
build_generator="MinGW Makefiles"
|
||||||
|
python="py"
|
||||||
|
# Could be other OS but this works for now.
|
||||||
|
else
|
||||||
|
build_generator="Unix Makefiles"
|
||||||
|
python="python3"
|
||||||
|
fi
|
||||||
|
|
||||||
|
echo "Running command (without the leading +):"
|
||||||
|
set -x # Print command
|
||||||
|
${python} ${cfg_script} -o "${os_fsfw}" -g "${build_generator}" -b "release" -l "${builddir}"
|
||||||
|
# set +x
|
42
cmake/scripts/stm32h7-make-size.sh
Executable file
42
cmake/scripts/stm32h7-make-size.sh
Executable file
@ -0,0 +1,42 @@
|
|||||||
|
#!/bin/sh
|
||||||
|
counter=0
|
||||||
|
init_dir=$(pwd)
|
||||||
|
cfg_script_name="cmake-build-cfg.py"
|
||||||
|
cfg_script=""
|
||||||
|
if [ ! -z ${REPO_ROOT} ]; then
|
||||||
|
cfg_script=${REPO_ROOT}/cmake/${cfg_script_name}
|
||||||
|
else
|
||||||
|
while [ ${counter} -lt 5 ]
|
||||||
|
do
|
||||||
|
if [ -f ${cfg_script_name} ];then
|
||||||
|
cfg_script=$(pwd)/${cfg_script_name}
|
||||||
|
break
|
||||||
|
fi
|
||||||
|
counter=$((counter=counter + 1))
|
||||||
|
cd ..
|
||||||
|
done
|
||||||
|
|
||||||
|
if [ "${counter}" -ge 5 ];then
|
||||||
|
echo "${cfg_script_name} not found in upper directories!"
|
||||||
|
cd ${init_dir}
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
cd ${init_dir}
|
||||||
|
fi
|
||||||
|
|
||||||
|
build_generator=""
|
||||||
|
os_fsfw="freertos"
|
||||||
|
builddir="cmake-build-size"
|
||||||
|
if [ "${OS}" = "Windows_NT" ]; then
|
||||||
|
build_generator="MinGW Makefiles"
|
||||||
|
python="py"
|
||||||
|
# Could be other OS but this works for now.
|
||||||
|
else
|
||||||
|
build_generator="Unix Makefiles"
|
||||||
|
python="python3"
|
||||||
|
fi
|
||||||
|
|
||||||
|
echo "Running command (without the leading +):"
|
||||||
|
set -x # Print command
|
||||||
|
${python} ${cfg_script} -o "${os_fsfw}" -g "${build_generator}" -b "size" -l "${builddir}"
|
||||||
|
# set +x
|
41
cmake/scripts/stm32h7-ninja-debug.sh
Executable file
41
cmake/scripts/stm32h7-ninja-debug.sh
Executable file
@ -0,0 +1,41 @@
|
|||||||
|
#!/bin/sh
|
||||||
|
counter=0
|
||||||
|
init_dir=$(pwd)
|
||||||
|
cfg_script_name="cmake-build-cfg.py"
|
||||||
|
cfg_script=""
|
||||||
|
if [ ! -z ${REPO_ROOT} ]; then
|
||||||
|
cfg_script=${REPO_ROOT}/cmake/${cfg_script_name}
|
||||||
|
else
|
||||||
|
while [ ${counter} -lt 5 ]
|
||||||
|
do
|
||||||
|
if [ -f ${cfg_script_name} ];then
|
||||||
|
cfg_script=$(pwd)/${cfg_script_name}
|
||||||
|
break
|
||||||
|
fi
|
||||||
|
counter=$((counter=counter + 1))
|
||||||
|
cd ..
|
||||||
|
done
|
||||||
|
|
||||||
|
if [ "${counter}" -ge 5 ];then
|
||||||
|
echo "${cfg_script_name} not found in upper directories!"
|
||||||
|
cd ${init_dir}
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
cd ${init_dir}
|
||||||
|
fi
|
||||||
|
|
||||||
|
build_generator=""
|
||||||
|
os_fsfw="freertos"
|
||||||
|
builddir="cmake-build-debug"
|
||||||
|
build_generator="Ninja"
|
||||||
|
if [ "${OS}" = "Windows_NT" ]; then
|
||||||
|
python="py"
|
||||||
|
# Could be other OS but this works for now.
|
||||||
|
else
|
||||||
|
python="python3"
|
||||||
|
fi
|
||||||
|
|
||||||
|
echo "Running command (without the leading +):"
|
||||||
|
set -x # Print command
|
||||||
|
${python} ${cfg_script} -o "${os_fsfw}" -g "${build_generator}" -b "debug" -l "${builddir}"
|
||||||
|
# set +x
|
@ -1 +1 @@
|
|||||||
Subproject commit e3a834d8409c394136af43bdf8c084941ed44b53
|
Subproject commit 5ae35e844c2b223f7bdacdf003f61791174848c6
|
@ -1 +1 @@
|
|||||||
Subproject commit 797801ffde3defc48e5f3f69df31f36e5d3879c5
|
Subproject commit c564fa37fde467a0216c041bb81eeed7343ac505
|
2
fsfw
2
fsfw
@ -1 +1 @@
|
|||||||
Subproject commit 7c2e50b665f515d6234f3d2f070609f8f37efde2
|
Subproject commit 678f8710c6656c70c56f4ea6e0ee6c0195052bff
|
@ -1 +1 @@
|
|||||||
Subproject commit e6f5ff18129984b591a6a286968b1ace42c278b2
|
Subproject commit 6d423f7106e49f93743fb69e9436e1e652f9e001
|
@ -1,2 +1,10 @@
|
|||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
|
if [ ! -d bsp_stm32h7_freertos ]; then
|
||||||
|
echo "This script should be sourced inside the example repository"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
export PATH="$(pwd)/xpacks/.bin":$PATH
|
export PATH="$(pwd)/xpacks/.bin":$PATH
|
||||||
|
export PATH="$(pwd)/cmake/scripts:$PATH"
|
||||||
|
|
||||||
|
export REPO_ROOT="$(pwd)"
|
||||||
|
32
scripts/auto-formatter.sh
Executable file
32
scripts/auto-formatter.sh
Executable file
@ -0,0 +1,32 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
if [[ ! -f README.md ]]; then
|
||||||
|
cd ..
|
||||||
|
fi
|
||||||
|
|
||||||
|
folder_list=(
|
||||||
|
"./bsp_stm32h7_freertos"
|
||||||
|
"./example_common"
|
||||||
|
)
|
||||||
|
|
||||||
|
cmake_fmt="cmake-format"
|
||||||
|
file_selectors="-iname CMakeLists.txt"
|
||||||
|
if command -v ${cmake_fmt} &> /dev/null; then
|
||||||
|
echo "Auto-formatting all CMakeLists.txt files"
|
||||||
|
${cmake_fmt} -i CMakeLists.txt
|
||||||
|
for dir in ${folder_list[@]}; do
|
||||||
|
find ${dir} ${file_selectors} | xargs ${cmake_fmt} -i
|
||||||
|
done
|
||||||
|
else
|
||||||
|
echo "No ${cmake_fmt} tool found, not formatting CMake files"
|
||||||
|
fi
|
||||||
|
|
||||||
|
cpp_format="clang-format"
|
||||||
|
file_selectors="-iname *.h -o -iname *.cpp -o -iname *.c -o -iname *.tpp"
|
||||||
|
if command -v ${cpp_format} &> /dev/null; then
|
||||||
|
for dir in ${folder_list[@]}; do
|
||||||
|
echo "Auto-formatting C/C++ files in ${dir} recursively"
|
||||||
|
find ${dir} ${file_selectors} | xargs ${cpp_format} --style=file -i
|
||||||
|
done
|
||||||
|
else
|
||||||
|
echo "No ${cpp_format} tool found, not formatting C++/C files"
|
||||||
|
fi
|
1
tmtc/.gitignore
vendored
Normal file
1
tmtc/.gitignore
vendored
Normal file
@ -0,0 +1 @@
|
|||||||
|
/tmtc_conf.json
|
24
tmtc/.idea/runConfigurations/tmtccli.xml
Normal file
24
tmtc/.idea/runConfigurations/tmtccli.xml
Normal file
@ -0,0 +1,24 @@
|
|||||||
|
<component name="ProjectRunConfigurationManager">
|
||||||
|
<configuration default="false" name="tmtccli" type="PythonConfigurationType" factoryName="Python" nameIsGenerated="true">
|
||||||
|
<module name="tmtc" />
|
||||||
|
<option name="INTERPRETER_OPTIONS" value="" />
|
||||||
|
<option name="PARENT_ENVS" value="true" />
|
||||||
|
<envs>
|
||||||
|
<env name="PYTHONUNBUFFERED" value="1" />
|
||||||
|
</envs>
|
||||||
|
<option name="SDK_HOME" value="" />
|
||||||
|
<option name="WORKING_DIRECTORY" value="$PROJECT_DIR$" />
|
||||||
|
<option name="IS_MODULE_SDK" value="true" />
|
||||||
|
<option name="ADD_CONTENT_ROOTS" value="true" />
|
||||||
|
<option name="ADD_SOURCE_ROOTS" value="true" />
|
||||||
|
<EXTENSION ID="PythonCoverageRunConfigurationExtension" runner="coverage.py" />
|
||||||
|
<option name="SCRIPT_NAME" value="$PROJECT_DIR$/tmtccli.py" />
|
||||||
|
<option name="PARAMETERS" value="" />
|
||||||
|
<option name="SHOW_COMMAND_LINE" value="false" />
|
||||||
|
<option name="EMULATE_TERMINAL" value="true" />
|
||||||
|
<option name="MODULE_MODE" value="false" />
|
||||||
|
<option name="REDIRECT_INPUT" value="false" />
|
||||||
|
<option name="INPUT_FILE" value="" />
|
||||||
|
<method v="2" />
|
||||||
|
</configuration>
|
||||||
|
</component>
|
@ -1 +1 @@
|
|||||||
Subproject commit 99ca187b50ad9cd6ee1ba4bcbf9db981bed653ae
|
Subproject commit 3cca54f66fe72f292787499e1e9bf2497a2cfdbf
|
11
tmtc/config/hook.py
Normal file
11
tmtc/config/hook.py
Normal file
@ -0,0 +1,11 @@
|
|||||||
|
from common_tmtc.config.hook_implementation import CommonFsfwHookBase
|
||||||
|
from tmtccmd.tc.definitions import TcQueueT
|
||||||
|
|
||||||
|
|
||||||
|
class FsfwHookBase(CommonFsfwHookBase):
|
||||||
|
def pack_service_queue(self, service: int, op_code: str, service_queue: TcQueueT):
|
||||||
|
from common_tmtc.pus_tc.tc_packing import common_service_queue_user
|
||||||
|
|
||||||
|
common_service_queue_user(
|
||||||
|
service=service, op_code=op_code, tc_queue=service_queue
|
||||||
|
)
|
4
tmtc/def_tmtc_conf.json
Normal file
4
tmtc/def_tmtc_conf.json
Normal file
@ -0,0 +1,4 @@
|
|||||||
|
{
|
||||||
|
"com_if": "udp",
|
||||||
|
"tcpip_udp_recv_max_size": 1500
|
||||||
|
}
|
@ -1,56 +0,0 @@
|
|||||||
#!/usr/bin/env python3
|
|
||||||
"""
|
|
||||||
@brief TMTC Commander entry point for command line mode.
|
|
||||||
@details
|
|
||||||
This client was developed by KSat for the SOURCE project to test the on-board software but
|
|
||||||
has evolved into a more generic tool for satellite developers to perform TMTC (Telemetry and Telecommand)
|
|
||||||
handling and testing via different communication interfaces. Currently, only the PUS standard is
|
|
||||||
implemented as a packet standard.
|
|
||||||
|
|
||||||
Run this file with the -h flag to display options.
|
|
||||||
|
|
||||||
@license
|
|
||||||
Copyright 2020 KSat e.V. Stuttgart
|
|
||||||
|
|
||||||
Licensed under the Apache License, Version 2.0 (the "License");
|
|
||||||
you may not use this file except in compliance with the License.
|
|
||||||
You may obtain a copy of the License at
|
|
||||||
|
|
||||||
https://www.apache.org/licenses/LICENSE-2.0
|
|
||||||
|
|
||||||
Unless required by applicable law or agreed to in writing, software
|
|
||||||
distributed under the License is distributed on an "AS IS" BASIS,
|
|
||||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
||||||
See the License for the specific language governing permissions and
|
|
||||||
limitations under the License.
|
|
||||||
|
|
||||||
@author R. Mueller
|
|
||||||
"""
|
|
||||||
import sys
|
|
||||||
|
|
||||||
from common_tmtc.config.hook_implementation import FsfwHookBase
|
|
||||||
from common_tmtc.config.definitions import PUS_APID
|
|
||||||
from common_tmtc.pus_tm.factory_hook import ccsds_tm_handler
|
|
||||||
try:
|
|
||||||
from tmtccmd.runner import run_tmtc_commander, initialize_tmtc_commander, add_ccsds_handler
|
|
||||||
from tmtccmd.ccsds.handler import CcsdsTmHandler
|
|
||||||
except ImportError as error:
|
|
||||||
run_tmtc_commander = None
|
|
||||||
initialize_tmtc_commander = None
|
|
||||||
print(error)
|
|
||||||
print("Python tmtccmd submodule could not be imported")
|
|
||||||
print("Install with \"cd tmtccmd && python3 -m pip install -e .\" for interactive installation")
|
|
||||||
sys.exit(0)
|
|
||||||
|
|
||||||
|
|
||||||
def main():
|
|
||||||
hook_obj = FsfwHookBase()
|
|
||||||
initialize_tmtc_commander(hook_object=hook_obj)
|
|
||||||
ccsds_handler = CcsdsTmHandler()
|
|
||||||
ccsds_handler.add_tm_handler(apid=PUS_APID, pus_tm_handler=ccsds_tm_handler, max_queue_len=50)
|
|
||||||
add_ccsds_handler(ccsds_handler)
|
|
||||||
run_tmtc_commander(use_gui=False, app_name="TMTC Commander FSFW")
|
|
||||||
|
|
||||||
|
|
||||||
if __name__ == "__main__":
|
|
||||||
main()
|
|
@ -1,56 +0,0 @@
|
|||||||
#!/usr/bin/env python3
|
|
||||||
"""
|
|
||||||
@brief TMTC Commander entry point for command line mode.
|
|
||||||
@details
|
|
||||||
This client was developed by KSat for the SOURCE project to test the on-board software but
|
|
||||||
has evolved into a more generic tool for satellite developers to perform TMTC (Telemetry and Telecommand)
|
|
||||||
handling and testing via different communication interfaces. Currently, only the PUS standard is
|
|
||||||
implemented as a packet standard.
|
|
||||||
|
|
||||||
Run this file with the -h flag to display options.
|
|
||||||
|
|
||||||
@license
|
|
||||||
Copyright 2020 KSat e.V. Stuttgart
|
|
||||||
|
|
||||||
Licensed under the Apache License, Version 2.0 (the "License");
|
|
||||||
you may not use this file except in compliance with the License.
|
|
||||||
You may obtain a copy of the License at
|
|
||||||
|
|
||||||
https://www.apache.org/licenses/LICENSE-2.0
|
|
||||||
|
|
||||||
Unless required by applicable law or agreed to in writing, software
|
|
||||||
distributed under the License is distributed on an "AS IS" BASIS,
|
|
||||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
||||||
See the License for the specific language governing permissions and
|
|
||||||
limitations under the License.
|
|
||||||
|
|
||||||
@author R. Mueller
|
|
||||||
"""
|
|
||||||
import sys
|
|
||||||
|
|
||||||
from common_tmtc.config.hook_implementation import FsfwHookBase
|
|
||||||
from common_tmtc.config.definitions import PUS_APID
|
|
||||||
from common_tmtc.pus_tm.factory_hook import ccsds_tm_handler
|
|
||||||
try:
|
|
||||||
from tmtccmd.runner import run_tmtc_commander, initialize_tmtc_commander, add_ccsds_handler
|
|
||||||
from tmtccmd.ccsds.handler import CcsdsTmHandler
|
|
||||||
except ImportError as error:
|
|
||||||
run_tmtc_commander = None
|
|
||||||
initialize_tmtc_commander = None
|
|
||||||
print(error)
|
|
||||||
print("Python tmtccmd submodule could not be imported")
|
|
||||||
print("Install with \"cd tmtccmd && python3 -m pip install -e .\" for interactive installation")
|
|
||||||
sys.exit(0)
|
|
||||||
|
|
||||||
|
|
||||||
def main():
|
|
||||||
hook_obj = FsfwHookBase()
|
|
||||||
initialize_tmtc_commander(hook_object=hook_obj)
|
|
||||||
ccsds_handler = CcsdsTmHandler()
|
|
||||||
ccsds_handler.add_tm_handler(apid=PUS_APID, pus_tm_handler=ccsds_tm_handler, max_queue_len=50)
|
|
||||||
add_ccsds_handler(ccsds_handler)
|
|
||||||
run_tmtc_commander(use_gui=True, app_name="TMTC Commander FSFW")
|
|
||||||
|
|
||||||
|
|
||||||
if __name__ == "__main__":
|
|
||||||
main()
|
|
23
tmtc/tmtccli.py
Executable file
23
tmtc/tmtccli.py
Executable file
@ -0,0 +1,23 @@
|
|||||||
|
#!/usr/bin/env python3
|
||||||
|
"""TMTC commander for FSFW Example"""
|
||||||
|
from common_tmtc.tmtcc import (
|
||||||
|
tmtcc_post_args,
|
||||||
|
tmtcc_pre_args,
|
||||||
|
create_default_args_parser,
|
||||||
|
add_default_tmtccmd_args,
|
||||||
|
parse_default_input_arguments,
|
||||||
|
)
|
||||||
|
from config.hook import FsfwHookBase
|
||||||
|
|
||||||
|
|
||||||
|
def main():
|
||||||
|
tmtcc_pre_args()
|
||||||
|
hook_obj = FsfwHookBase(json_cfg_path="tmtc_conf.json")
|
||||||
|
arg_parser = create_default_args_parser()
|
||||||
|
add_default_tmtccmd_args(arg_parser)
|
||||||
|
args = parse_default_input_arguments(arg_parser, hook_obj)
|
||||||
|
tmtcc_post_args(hook_obj=hook_obj, use_gui=False, args=args)
|
||||||
|
|
||||||
|
|
||||||
|
if __name__ == "__main__":
|
||||||
|
main()
|
@ -1 +1 @@
|
|||||||
Subproject commit 4d71822fa1f1cfc16ccd4d0fb750eb2900a263b2
|
Subproject commit 2354f5d2778c7681ddf6602766dd4e68b943e1c0
|
12
tmtc/tmtcgui.py
Normal file
12
tmtc/tmtcgui.py
Normal file
@ -0,0 +1,12 @@
|
|||||||
|
#!/usr/bin/env python3
|
||||||
|
"""TMTC commander for the FSFW Example"""
|
||||||
|
from common_tmtc.tmtcc import tmtcc_post_args, tmtcc_pre_args
|
||||||
|
|
||||||
|
|
||||||
|
def main():
|
||||||
|
hook_obj = tmtcc_pre_args()
|
||||||
|
tmtcc_post_args(hook_obj=hook_obj, use_gui=True, args=None)
|
||||||
|
|
||||||
|
|
||||||
|
if __name__ == "__main__":
|
||||||
|
main()
|
Loading…
Reference in New Issue
Block a user