fixed merge conflicts
This commit is contained in:
commit
9236486a0f
8
.clang-format
Normal file
8
.clang-format
Normal file
@ -0,0 +1,8 @@
|
|||||||
|
---
|
||||||
|
BasedOnStyle: Google
|
||||||
|
IndentWidth: 2
|
||||||
|
---
|
||||||
|
Language: Cpp
|
||||||
|
ColumnLimit: 100
|
||||||
|
ReflowComments: true
|
||||||
|
---
|
3
.gitignore
vendored
3
.gitignore
vendored
@ -8,6 +8,9 @@
|
|||||||
!misc/eclipse/**/.cproject
|
!misc/eclipse/**/.cproject
|
||||||
!misc/eclipse/**/.project
|
!misc/eclipse/**/.project
|
||||||
|
|
||||||
|
#vscode
|
||||||
|
/.vscode
|
||||||
|
|
||||||
# Python
|
# Python
|
||||||
__pycache__
|
__pycache__
|
||||||
.idea
|
.idea
|
||||||
|
306
CMakeLists.txt
306
CMakeLists.txt
@ -13,40 +13,39 @@ cmake_minimum_required(VERSION 3.13)
|
|||||||
|
|
||||||
set(CMAKE_SCRIPT_PATH "${CMAKE_CURRENT_SOURCE_DIR}/cmake")
|
set(CMAKE_SCRIPT_PATH "${CMAKE_CURRENT_SOURCE_DIR}/cmake")
|
||||||
|
|
||||||
if(TGT_BSP MATCHES "arm/q7s")
|
|
||||||
option(EIVE_BUILD_WATCHDOG "Compile the OBSW watchdog insted" OFF)
|
|
||||||
option(BUILD_Q7S_SIMPLE_MODE OFF "Simple mode with a minimal main function")
|
|
||||||
endif()
|
|
||||||
|
|
||||||
option(EIVE_BUILD_UNITTESTS "Build Catch2 unittests" OFF)
|
|
||||||
option(EIVE_ADD_ETL_LIB "Add ETL library" ON)
|
option(EIVE_ADD_ETL_LIB "Add ETL library" ON)
|
||||||
option(EIVE_ADD_JSON_LIB "Add JSON library" ON)
|
option(EIVE_ADD_JSON_LIB "Add JSON library" ON)
|
||||||
|
|
||||||
option(EIVE_SYSROOT_MAGIC "Perform sysroot magic which might not be necessary" OFF)
|
option(EIVE_SYSROOT_MAGIC "Perform sysroot magic which might not be necessary" OFF)
|
||||||
|
option(EIVE_CREATE_UNIQUE_OBSW_BIN "Append username to generated binary name" ON)
|
||||||
|
|
||||||
|
set(OBSW_ADD_STAR_TRACKER 0)
|
||||||
|
set(OBSW_DEBUG_STARTRACKER 0)
|
||||||
|
|
||||||
if(NOT FSFW_OSAL)
|
if(NOT FSFW_OSAL)
|
||||||
set(FSFW_OSAL host CACHE STRING "OS for the FSFW.")
|
set(FSFW_OSAL linux CACHE STRING "OS for the FSFW.")
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
if(TGT_BSP MATCHES "arm/raspberrypi" OR TGT_BSP MATCHES "arm/beagleboneblack")
|
if(TGT_BSP)
|
||||||
|
if(TGT_BSP MATCHES "arm/raspberrypi" OR TGT_BSP MATCHES "arm/beagleboneblack")
|
||||||
option(LINUX_CROSS_COMPILE ON)
|
option(LINUX_CROSS_COMPILE ON)
|
||||||
|
option(EIVE_BUILD_GPSD_GPS_HANDLER "Build GPSD dependent GPS Handler" OFF)
|
||||||
|
elseif(TGT_BSP MATCHES "arm/q7s")
|
||||||
|
option(EIVE_BUILD_GPSD_GPS_HANDLER "Build GPSD dependent GPS Handler" ON)
|
||||||
|
endif()
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
# Perform steps like loading toolchain files where applicable.
|
# Perform steps like loading toolchain files where applicable.
|
||||||
include(${CMAKE_SCRIPT_PATH}/PreProjectConfig.cmake)
|
include(${CMAKE_SCRIPT_PATH}/PreProjectConfig.cmake)
|
||||||
pre_project_config()
|
pre_project_config()
|
||||||
|
|
||||||
if(EIVE_BUILD_WATCHDOG)
|
# Check whether the user has already installed Catch2 first. This has to come before
|
||||||
set(PROJECT_NAME_TO_SET eive-watchdog)
|
# the project call. We could also exlcude doing this when the Q7S primary OBSW is built..
|
||||||
elseif(EIVE_BUILD_UNITTESTS)
|
find_package(Catch2 3 CONFIG QUIET)
|
||||||
set(PROJECT_NAME_TO_SET eive-unittest)
|
|
||||||
elseif(TGT_BSP MATCHES "arm/q7s")
|
|
||||||
set(PROJECT_NAME_TO_SET eive-obsw-$ENV{USERNAME})
|
|
||||||
else()
|
|
||||||
set(PROJECT_NAME_TO_SET eive-obsw)
|
|
||||||
endif()
|
|
||||||
|
|
||||||
# Project Name
|
# Project Name
|
||||||
project(${PROJECT_NAME_TO_SET} ASM C CXX)
|
project(eive-obsw)
|
||||||
|
|
||||||
################################################################################
|
################################################################################
|
||||||
# Pre-Sources preparation
|
# Pre-Sources preparation
|
||||||
@ -57,8 +56,12 @@ set(CMAKE_CXX_STANDARD 17)
|
|||||||
set(CMAKE_CXX_STANDARD_REQUIRED True)
|
set(CMAKE_CXX_STANDARD_REQUIRED True)
|
||||||
|
|
||||||
# Set names and variables
|
# Set names and variables
|
||||||
set(TARGET_NAME ${CMAKE_PROJECT_NAME})
|
set(OBSW_NAME ${CMAKE_PROJECT_NAME})
|
||||||
|
set(WATCHDOG_NAME eive-watchdog)
|
||||||
|
set(SIMPLE_OBSW_NAME eive-simple)
|
||||||
|
set(UNITTEST_NAME eive-unittest)
|
||||||
set(LIB_FSFW_NAME fsfw)
|
set(LIB_FSFW_NAME fsfw)
|
||||||
|
set(LIB_EIVE_MISSION eive-mission)
|
||||||
set(LIB_ETL_NAME etl)
|
set(LIB_ETL_NAME etl)
|
||||||
set(LIB_CSP_NAME libcsp)
|
set(LIB_CSP_NAME libcsp)
|
||||||
set(LIB_LWGPS_NAME lwgps)
|
set(LIB_LWGPS_NAME lwgps)
|
||||||
@ -66,12 +69,12 @@ set(LIB_ARCSEC wire)
|
|||||||
set(THIRD_PARTY_FOLDER thirdparty)
|
set(THIRD_PARTY_FOLDER thirdparty)
|
||||||
set(LIB_CXX_FS -lstdc++fs)
|
set(LIB_CXX_FS -lstdc++fs)
|
||||||
set(LIB_CATCH2 Catch2)
|
set(LIB_CATCH2 Catch2)
|
||||||
|
set(LIB_GPS gps)
|
||||||
set(LIB_JSON_NAME nlohmann_json::nlohmann_json)
|
set(LIB_JSON_NAME nlohmann_json::nlohmann_json)
|
||||||
|
|
||||||
# Set path names
|
# Set path names
|
||||||
set(FSFW_PATH fsfw)
|
set(FSFW_PATH fsfw)
|
||||||
set(MISSION_PATH mission)
|
set(TEST_PATH test)
|
||||||
set(TEST_PATH test/testtasks)
|
|
||||||
set(UNITTEST_PATH unittest)
|
set(UNITTEST_PATH unittest)
|
||||||
set(LINUX_PATH linux)
|
set(LINUX_PATH linux)
|
||||||
set(COMMON_PATH common)
|
set(COMMON_PATH common)
|
||||||
@ -79,6 +82,7 @@ set(WATCHDOG_PATH watchdog)
|
|||||||
set(COMMON_CONFIG_PATH ${COMMON_PATH}/config)
|
set(COMMON_CONFIG_PATH ${COMMON_PATH}/config)
|
||||||
set(UNITTEST_CFG_PATH ${UNITTEST_PATH}/testcfg)
|
set(UNITTEST_CFG_PATH ${UNITTEST_PATH}/testcfg)
|
||||||
|
|
||||||
|
set(LIB_EIVE_MISSION_PATH mission)
|
||||||
set(LIB_CSP_PATH ${THIRD_PARTY_FOLDER}/libcsp)
|
set(LIB_CSP_PATH ${THIRD_PARTY_FOLDER}/libcsp)
|
||||||
set(LIB_ETL_PATH ${THIRD_PARTY_FOLDER}/etl)
|
set(LIB_ETL_PATH ${THIRD_PARTY_FOLDER}/etl)
|
||||||
set(LIB_CATCH2_PATH ${THIRD_PARTY_FOLDER}/Catch2)
|
set(LIB_CATCH2_PATH ${THIRD_PARTY_FOLDER}/Catch2)
|
||||||
@ -89,13 +93,6 @@ set(LIB_JSON_PATH ${THIRD_PARTY_FOLDER}/json)
|
|||||||
set(FSFW_WARNING_SHADOW_LOCAL_GCC OFF)
|
set(FSFW_WARNING_SHADOW_LOCAL_GCC OFF)
|
||||||
set(EIVE_ADD_LINUX_FILES False)
|
set(EIVE_ADD_LINUX_FILES False)
|
||||||
|
|
||||||
if(EIVE_BUILD_UNITTESTS)
|
|
||||||
endif()
|
|
||||||
|
|
||||||
if(FSFW_ADD_UNITTESTS)
|
|
||||||
set(CATCH2_TARGET Catch2)
|
|
||||||
endif()
|
|
||||||
|
|
||||||
# Analyse different OS and architecture/target options, determine BSP_PATH,
|
# Analyse different OS and architecture/target options, determine BSP_PATH,
|
||||||
# display information about compiler etc.
|
# display information about compiler etc.
|
||||||
include (${CMAKE_SCRIPT_PATH}/HardwareOsPreConfig.cmake)
|
include (${CMAKE_SCRIPT_PATH}/HardwareOsPreConfig.cmake)
|
||||||
@ -103,7 +100,8 @@ pre_source_hw_os_config()
|
|||||||
|
|
||||||
if(TGT_BSP)
|
if(TGT_BSP)
|
||||||
if(TGT_BSP MATCHES "arm/q7s" OR TGT_BSP MATCHES "arm/raspberrypi"
|
if(TGT_BSP MATCHES "arm/q7s" OR TGT_BSP MATCHES "arm/raspberrypi"
|
||||||
OR TGT_BSP MATCHES "arm/beagleboneblack"
|
OR TGT_BSP MATCHES "arm/beagleboneblack" OR TGT_BSP MATCHES "arm/egse"
|
||||||
|
OR TGT_BSP MATCHES "arm/te0720-1cfa"
|
||||||
)
|
)
|
||||||
set(FSFW_CONFIG_PATH "linux/fsfwconfig")
|
set(FSFW_CONFIG_PATH "linux/fsfwconfig")
|
||||||
if(NOT BUILD_Q7S_SIMPLE_MODE)
|
if(NOT BUILD_Q7S_SIMPLE_MODE)
|
||||||
@ -113,12 +111,20 @@ if(TGT_BSP)
|
|||||||
endif()
|
endif()
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
if(TGT_BSP MATCHES "arm/raspberrypi")
|
if(TGT_BSP MATCHES "arm/raspberrypi" )
|
||||||
# Used by configure file
|
# Used by configure file
|
||||||
set(RASPBERRY_PI ON)
|
set(RASPBERRY_PI ON)
|
||||||
set(FSFW_HAL_ADD_RASPBERRY_PI ON)
|
set(FSFW_HAL_ADD_RASPBERRY_PI ON)
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
|
if(TGT_BSP MATCHES "arm/egse")
|
||||||
|
# Used by configure file
|
||||||
|
set(EGSE ON)
|
||||||
|
set(FSFW_HAL_LINUX_ADD_LIBGPIOD OFF)
|
||||||
|
set(OBSW_ADD_STAR_TRACKER 1)
|
||||||
|
set(OBSW_DEBUG_STARTRACKER 1)
|
||||||
|
endif()
|
||||||
|
|
||||||
if(TGT_BSP MATCHES "arm/beagleboneblack")
|
if(TGT_BSP MATCHES "arm/beagleboneblack")
|
||||||
# Used by configure file
|
# Used by configure file
|
||||||
set(BEAGLEBONEBLACK ON)
|
set(BEAGLEBONEBLACK ON)
|
||||||
@ -128,29 +134,28 @@ if(TGT_BSP)
|
|||||||
# Used by configure file
|
# Used by configure file
|
||||||
set(XIPHOS_Q7S ON)
|
set(XIPHOS_Q7S ON)
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
|
if(TGT_BSP MATCHES "arm/te0720-1cfa")
|
||||||
|
set(TE0720_1CFA ON)
|
||||||
|
endif()
|
||||||
else()
|
else()
|
||||||
# Required by FSFW library
|
# Required by FSFW library
|
||||||
set(FSFW_CONFIG_PATH "${BSP_PATH}/fsfwconfig")
|
set(FSFW_CONFIG_PATH "${BSP_PATH}/fsfwconfig")
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
if(EIVE_BUILD_UNITTESTS)
|
|
||||||
# configure_file(${UNITTEST_CFG_PATH}/TestsConfig.h.in TestsConfig.h)
|
|
||||||
# set(FSFW_CONFIG_PATH ${UNITTEST_CFG_PATH})
|
|
||||||
endif()
|
|
||||||
|
|
||||||
# Configuration files
|
# Configuration files
|
||||||
if(NOT EIVE_BUILD_WATCHDOG)
|
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)
|
configure_file(${FSFW_CONFIG_PATH}/OBSWConfig.h.in OBSWConfig.h)
|
||||||
configure_file(${FSFW_CONFIG_PATH}/OBSWConfig.h.in OBSWConfig.h)
|
if(TGT_BSP MATCHES "arm/q7s")
|
||||||
if(TGT_BSP MATCHES "arm/q7s")
|
|
||||||
configure_file(${BSP_PATH}/boardconfig/q7sConfig.h.in q7sConfig.h)
|
configure_file(${BSP_PATH}/boardconfig/q7sConfig.h.in q7sConfig.h)
|
||||||
elseif(TGT_BSP MATCHES "arm/raspberrypi")
|
elseif(TGT_BSP MATCHES "arm/raspberrypi" OR TGT_BSP MATCHES "arm/egse")
|
||||||
configure_file(${BSP_PATH}/boardconfig/rpiConfig.h.in rpiConfig.h)
|
configure_file(${BSP_PATH}/boardconfig/rpiConfig.h.in rpiConfig.h)
|
||||||
endif()
|
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
configure_file(${WATCHDOG_PATH}/watchdogConf.h.in watchdogConf.h)
|
configure_file(${WATCHDOG_PATH}/watchdogConf.h.in watchdogConf.h)
|
||||||
|
|
||||||
# Set common config path for FSFW
|
# Set common config path for FSFW
|
||||||
@ -163,8 +168,95 @@ set(FSFW_ADDITIONAL_INC_PATHS
|
|||||||
# Executable and Sources
|
# Executable and Sources
|
||||||
################################################################################
|
################################################################################
|
||||||
|
|
||||||
# Add executable
|
#global compiler options need to be set before adding executables
|
||||||
add_executable(${TARGET_NAME})
|
if(CMAKE_CXX_COMPILER_ID STREQUAL "GNU")
|
||||||
|
add_compile_options(
|
||||||
|
"-Wall"
|
||||||
|
"-Wextra"
|
||||||
|
"-Wimplicit-fallthrough=1"
|
||||||
|
"-Wno-unused-parameter"
|
||||||
|
"-Wno-psabi"
|
||||||
|
"-Wduplicated-cond" # check for duplicate conditions
|
||||||
|
"-Wduplicated-branches" # check for duplicate branches
|
||||||
|
"-Wlogical-op" # Search for bitwise operations instead of logical
|
||||||
|
"-Wnull-dereference" # Search for NULL dereference
|
||||||
|
"-Wundef" # Warn if undefind marcos are used
|
||||||
|
"-Wformat=2" # Format string problem detection
|
||||||
|
"-Wformat-overflow=2" # Formatting issues in printf
|
||||||
|
"-Wformat-truncation=2" # Formatting issues in printf
|
||||||
|
"-Wformat-security" # Search for dangerous printf operations
|
||||||
|
"-Wstrict-overflow=3" # Warn if integer overflows might happen
|
||||||
|
"-Warray-bounds=2" # Some array bounds violations will be found
|
||||||
|
"-Wshift-overflow=2" # Search for bit left shift overflows (<c++14)
|
||||||
|
"-Wcast-qual" # Warn if the constness is cast away
|
||||||
|
"-Wstringop-overflow=4"
|
||||||
|
# -Wstack-protector # Emits a few false positives for low level access
|
||||||
|
# -Wconversion # Creates many false positives
|
||||||
|
# -Warith-conversion # Use with Wconversion to find more implicit conversions
|
||||||
|
# -fanalyzer # Should be used to look through problems
|
||||||
|
)
|
||||||
|
# Remove unused sections.
|
||||||
|
add_compile_options(
|
||||||
|
"-ffunction-sections"
|
||||||
|
"-fdata-sections"
|
||||||
|
)
|
||||||
|
|
||||||
|
# Removed unused sections.
|
||||||
|
add_link_options(
|
||||||
|
"-Wl,--gc-sections"
|
||||||
|
)
|
||||||
|
|
||||||
|
elseif(CMAKE_CXX_COMPILER_ID STREQUAL "MSVC")
|
||||||
|
set(COMPILER_FLAGS "/permissive-")
|
||||||
|
endif()
|
||||||
|
|
||||||
|
if (NOT(TGT_BSP MATCHES "arm/te0720-1cfa") AND NOT(TGT_BSP MATCHES "arm/q7s"))
|
||||||
|
# Not installed, so use FetchContent to download and provide Catch2
|
||||||
|
if(NOT Catch2_FOUND)
|
||||||
|
message(STATUS "Did not find a valid Catch2 installation. Using FetchContent to install it")
|
||||||
|
include(FetchContent)
|
||||||
|
|
||||||
|
FetchContent_Declare(
|
||||||
|
Catch2
|
||||||
|
GIT_REPOSITORY https://github.com/catchorg/Catch2.git
|
||||||
|
GIT_TAG v3.0.0-preview4
|
||||||
|
)
|
||||||
|
|
||||||
|
FetchContent_MakeAvailable(Catch2)
|
||||||
|
#fixes regression -preview4, to be confirmed in later releases
|
||||||
|
set_target_properties(Catch2 PROPERTIES DEBUG_POSTFIX "")
|
||||||
|
set_target_properties(Catch2 PROPERTIES EXCLUDE_FROM_ALL "true")
|
||||||
|
set_target_properties(Catch2WithMain PROPERTIES EXCLUDE_FROM_ALL "true")
|
||||||
|
endif()
|
||||||
|
endif()
|
||||||
|
|
||||||
|
|
||||||
|
add_library(${LIB_EIVE_MISSION})
|
||||||
|
|
||||||
|
|
||||||
|
# Add main executable
|
||||||
|
add_executable(${OBSW_NAME})
|
||||||
|
if(EIVE_CREATE_UNIQUE_OBSW_BIN)
|
||||||
|
set(OBSW_BIN_NAME ${CMAKE_PROJECT_NAME}-$ENV{USERNAME})
|
||||||
|
else()
|
||||||
|
set(OBSW_BIN_NAME ${CMAKE_PROJECT_NAME})
|
||||||
|
endif()
|
||||||
|
set_target_properties(${OBSW_NAME} PROPERTIES OUTPUT_NAME ${OBSW_BIN_NAME})
|
||||||
|
|
||||||
|
#watchdog
|
||||||
|
add_executable(${WATCHDOG_NAME} EXCLUDE_FROM_ALL)
|
||||||
|
add_subdirectory(${WATCHDOG_PATH})
|
||||||
|
target_link_libraries(${WATCHDOG_NAME} PUBLIC
|
||||||
|
${LIB_CXX_FS}
|
||||||
|
)
|
||||||
|
target_include_directories(${WATCHDOG_NAME} PUBLIC
|
||||||
|
${CMAKE_BINARY_DIR}
|
||||||
|
)
|
||||||
|
|
||||||
|
#unittests
|
||||||
|
add_executable(${UNITTEST_NAME} EXCLUDE_FROM_ALL)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
if(EIVE_ADD_ETL_LIB)
|
if(EIVE_ADD_ETL_LIB)
|
||||||
add_subdirectory(${LIB_ETL_PATH})
|
add_subdirectory(${LIB_ETL_PATH})
|
||||||
@ -174,135 +266,108 @@ if(EIVE_ADD_JSON_LIB)
|
|||||||
add_subdirectory(${LIB_JSON_PATH})
|
add_subdirectory(${LIB_JSON_PATH})
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
if(NOT EIVE_BUILD_WATCHDOG)
|
|
||||||
if(NOT EIVE_BUILD_UNITTESTS)
|
|
||||||
if(EIVE_ADD_LINUX_FILES)
|
if(EIVE_ADD_LINUX_FILES)
|
||||||
add_subdirectory(${LIB_ARCSEC_PATH})
|
add_subdirectory(${LIB_ARCSEC_PATH})
|
||||||
add_subdirectory(${LINUX_PATH})
|
add_subdirectory(${LINUX_PATH})
|
||||||
endif()
|
endif()
|
||||||
add_subdirectory(${BSP_PATH})
|
add_subdirectory(${BSP_PATH})
|
||||||
if(ADD_CSP_LIB)
|
if(ADD_CSP_LIB)
|
||||||
add_subdirectory(${LIB_CSP_PATH})
|
add_subdirectory(${LIB_CSP_PATH})
|
||||||
endif()
|
|
||||||
endif()
|
|
||||||
add_subdirectory(${COMMON_PATH})
|
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
if((NOT BUILD_Q7S_SIMPLE_MODE) AND (NOT EIVE_BUILD_WATCHDOG))
|
|
||||||
add_subdirectory(${LIB_LWGPS_PATH})
|
|
||||||
add_subdirectory(${FSFW_PATH})
|
|
||||||
add_subdirectory(${MISSION_PATH})
|
|
||||||
add_subdirectory(${TEST_PATH})
|
|
||||||
endif()
|
|
||||||
|
|
||||||
if(EIVE_BUILD_UNITTESTS)
|
add_subdirectory(${COMMON_PATH})
|
||||||
# add_subdirectory(${LIB_CATCH2_PATH})
|
|
||||||
add_subdirectory(${UNITTEST_PATH})
|
|
||||||
endif()
|
|
||||||
|
add_subdirectory(${LIB_LWGPS_PATH})
|
||||||
|
add_subdirectory(${FSFW_PATH})
|
||||||
|
add_subdirectory(${LIB_EIVE_MISSION_PATH})
|
||||||
|
add_subdirectory(${TEST_PATH})
|
||||||
|
|
||||||
|
|
||||||
|
add_subdirectory(${UNITTEST_PATH})
|
||||||
|
|
||||||
if(EIVE_BUILD_WATCHDOG)
|
|
||||||
add_subdirectory(${WATCHDOG_PATH})
|
|
||||||
endif()
|
|
||||||
|
|
||||||
################################################################################
|
################################################################################
|
||||||
# Post-Sources preparation
|
# Post-Sources preparation
|
||||||
################################################################################
|
################################################################################
|
||||||
|
|
||||||
set_property(CACHE FSFW_OSAL PROPERTY STRINGS host linux)
|
|
||||||
|
|
||||||
if((NOT BUILD_Q7S_SIMPLE_MODE) AND (NOT EIVE_BUILD_WATCHDOG))
|
|
||||||
# Add libraries for all sources.
|
# Add libraries
|
||||||
target_link_libraries(${TARGET_NAME} PRIVATE
|
target_link_libraries(${LIB_EIVE_MISSION} PUBLIC
|
||||||
${LIB_FSFW_NAME}
|
${LIB_FSFW_NAME}
|
||||||
${LIB_OS_NAME}
|
|
||||||
${LIB_LWGPS_NAME}
|
${LIB_LWGPS_NAME}
|
||||||
)
|
${LIB_OS_NAME}
|
||||||
|
)
|
||||||
|
|
||||||
if(TGT_BSP MATCHES "arm/q7s")
|
target_link_libraries(${OBSW_NAME} PRIVATE
|
||||||
target_link_libraries(${TARGET_NAME} PRIVATE
|
${LIB_EIVE_MISSION}
|
||||||
|
)
|
||||||
|
|
||||||
|
if(TGT_BSP MATCHES "arm/q7s")
|
||||||
|
target_link_libraries(${LIB_EIVE_MISSION} PUBLIC
|
||||||
|
${LIB_ARCSEC}
|
||||||
|
${LIB_GPS}
|
||||||
|
)
|
||||||
|
endif()
|
||||||
|
|
||||||
|
target_link_libraries(${UNITTEST_NAME} PRIVATE
|
||||||
|
Catch2
|
||||||
|
${LIB_EIVE_MISSION}
|
||||||
|
)
|
||||||
|
|
||||||
|
if(TGT_BSP MATCHES "arm/egse")
|
||||||
|
target_link_libraries(${OBSW_NAME} PRIVATE
|
||||||
${LIB_ARCSEC}
|
${LIB_ARCSEC}
|
||||||
)
|
)
|
||||||
endif()
|
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
|
if(ADD_CSP_LIB)
|
||||||
if(NOT EIVE_BUILD_WATCHDOG)
|
target_link_libraries(${OBSW_NAME} PRIVATE
|
||||||
if(ADD_CSP_LIB)
|
|
||||||
target_link_libraries(${TARGET_NAME} PRIVATE
|
|
||||||
${LIB_CSP_NAME}
|
${LIB_CSP_NAME}
|
||||||
)
|
)
|
||||||
endif()
|
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
|
|
||||||
if(EIVE_ADD_ETL_LIB)
|
if(EIVE_ADD_ETL_LIB)
|
||||||
target_link_libraries(${TARGET_NAME} PRIVATE
|
target_link_libraries(${LIB_EIVE_MISSION} PUBLIC
|
||||||
${LIB_ETL_NAME}
|
${LIB_ETL_NAME}
|
||||||
)
|
)
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
if(EIVE_ADD_JSON_LIB)
|
if(EIVE_ADD_JSON_LIB)
|
||||||
target_link_libraries(${TARGET_NAME} PRIVATE
|
target_link_libraries(${LIB_EIVE_MISSION} PUBLIC
|
||||||
${LIB_JSON_NAME}
|
${LIB_JSON_NAME}
|
||||||
)
|
)
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
if(EIVE_BUILD_UNITTESTS)
|
target_link_libraries(${LIB_EIVE_MISSION} PUBLIC
|
||||||
target_link_libraries(${TARGET_NAME} PRIVATE
|
|
||||||
${CATCH2_TARGET}
|
|
||||||
)
|
|
||||||
endif()
|
|
||||||
|
|
||||||
target_link_libraries(${TARGET_NAME} PRIVATE
|
|
||||||
${LIB_CXX_FS}
|
${LIB_CXX_FS}
|
||||||
)
|
)
|
||||||
|
|
||||||
# Add include paths for all sources.
|
# Add include paths for all sources.
|
||||||
target_include_directories(${TARGET_NAME} PRIVATE
|
target_include_directories(${LIB_EIVE_MISSION} PUBLIC
|
||||||
${CMAKE_CURRENT_SOURCE_DIR}
|
${CMAKE_CURRENT_SOURCE_DIR}
|
||||||
${FSFW_CONFIG_PATH}
|
${FSFW_CONFIG_PATH}
|
||||||
${CMAKE_CURRENT_BINARY_DIR}
|
${CMAKE_CURRENT_BINARY_DIR}
|
||||||
${LIB_ARCSEC_PATH}
|
${LIB_ARCSEC_PATH}
|
||||||
)
|
)
|
||||||
|
|
||||||
if(TGT_BSP MATCHES "arm/q7s")
|
if(TGT_BSP MATCHES "arm/q7s" OR TGT_BSP MATCHES "arm/egse")
|
||||||
target_include_directories(${TARGET_NAME} PRIVATE
|
target_include_directories(${LIB_EIVE_MISSION} PUBLIC
|
||||||
${ARCSEC_LIB_PATH}
|
${ARCSEC_LIB_PATH}
|
||||||
)
|
)
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
if(CMAKE_CXX_COMPILER_ID STREQUAL "GNU")
|
|
||||||
set(WARNING_FLAGS
|
|
||||||
-Wall
|
|
||||||
-Wextra
|
|
||||||
-Wimplicit-fallthrough=1
|
|
||||||
-Wno-unused-parameter
|
|
||||||
-Wno-psabi
|
|
||||||
)
|
|
||||||
|
|
||||||
# Remove unused sections.
|
|
||||||
target_compile_options(${TARGET_NAME} PRIVATE
|
|
||||||
"-ffunction-sections"
|
|
||||||
"-fdata-sections"
|
|
||||||
)
|
|
||||||
|
|
||||||
# Removed unused sections.
|
|
||||||
target_link_options(${TARGET_NAME} PRIVATE
|
|
||||||
"-Wl,--gc-sections"
|
|
||||||
)
|
|
||||||
|
|
||||||
elseif(CMAKE_CXX_COMPILER_ID STREQUAL "MSVC")
|
|
||||||
set(COMPILER_FLAGS "/permissive-")
|
|
||||||
endif()
|
|
||||||
|
|
||||||
if(CMAKE_VERBOSE)
|
if(CMAKE_VERBOSE)
|
||||||
message(STATUS "Warning flags: ${WARNING_FLAGS}")
|
message(STATUS "Warning flags: ${WARNING_FLAGS}")
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
|
|
||||||
# Compile options for all sources.
|
|
||||||
target_compile_options(${TARGET_NAME} PRIVATE
|
|
||||||
${WARNING_FLAGS}
|
|
||||||
)
|
|
||||||
|
|
||||||
if(${CMAKE_CROSSCOMPILING})
|
if(${CMAKE_CROSSCOMPILING})
|
||||||
include (${CMAKE_SCRIPT_PATH}/HardwareOsPostConfig.cmake)
|
include (${CMAKE_SCRIPT_PATH}/HardwareOsPostConfig.cmake)
|
||||||
@ -334,11 +399,12 @@ string(CONCAT POST_BUILD_COMMENT
|
|||||||
)
|
)
|
||||||
|
|
||||||
add_custom_command(
|
add_custom_command(
|
||||||
TARGET ${TARGET_NAME}
|
TARGET ${OBSW_NAME}
|
||||||
POST_BUILD
|
POST_BUILD
|
||||||
COMMAND ${CMAKE_SIZE} ${TARGET_NAME}${FILE_SUFFIX}
|
COMMAND ${CMAKE_SIZE} ${OBSW_BIN_NAME}${FILE_SUFFIX}
|
||||||
COMMENT ${POST_BUILD_COMMENT}
|
COMMENT ${POST_BUILD_COMMENT}
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
include (${CMAKE_SCRIPT_PATH}/BuildType.cmake)
|
include (${CMAKE_SCRIPT_PATH}/BuildType.cmake)
|
||||||
set_build_type()
|
set_build_type()
|
||||||
|
3
Justfile
3
Justfile
@ -5,5 +5,8 @@ default: q7s-debug-make
|
|||||||
q7s-debug-make:
|
q7s-debug-make:
|
||||||
{{python_script}} -o linux -g make -b debug -t "arm/q7s" -l build-Debug-Q7S
|
{{python_script}} -o linux -g make -b debug -t "arm/q7s" -l build-Debug-Q7S
|
||||||
|
|
||||||
|
q7s-release-make:
|
||||||
|
{{python_script}} -o linux -g make -b release -t "arm/q7s" -l build-Release-Q7S
|
||||||
|
|
||||||
q7s-debug-ninja:
|
q7s-debug-ninja:
|
||||||
{{python_script}} -o linux -g ninja -b debug -t "arm/q7s" -l build-Debug-Q7S
|
{{python_script}} -o linux -g ninja -b debug -t "arm/q7s" -l build-Debug-Q7S
|
||||||
|
135
README.md
135
README.md
@ -19,7 +19,10 @@
|
|||||||
12. [Static Code Analysis](#static-code-analysis)
|
12. [Static Code Analysis](#static-code-analysis)
|
||||||
13. [Eclipse](#eclipse)
|
13. [Eclipse](#eclipse)
|
||||||
14. [Running the OBSW on a Raspberry Pi](#rpi)
|
14. [Running the OBSW on a Raspberry Pi](#rpi)
|
||||||
15. [FSFW](#fsfw)
|
15. [Running OBSW on EGSE](#egse)
|
||||||
|
16. [Manually preparing sysroots to compile gpsd](#gpsd)
|
||||||
|
17. [FSFW](#fsfw)
|
||||||
|
18. [Coding Style](#coding-style)
|
||||||
|
|
||||||
# <a id="general"></a> General information
|
# <a id="general"></a> General information
|
||||||
|
|
||||||
@ -37,7 +40,7 @@ Target systems:
|
|||||||
relevant pages. The most recent datasheet can be found
|
relevant pages. The most recent datasheet can be found
|
||||||
[here](https://trac2.xiphos.ca/manual/wiki/Q7RevB/UserManual).
|
[here](https://trac2.xiphos.ca/manual/wiki/Q7RevB/UserManual).
|
||||||
* Linux OS built with Yocto 2.5
|
* Linux OS built with Yocto 2.5
|
||||||
* Linux Kernel https://github.com/XiphosSystemsCorp/linux-xlnx.git . EIVE version can be found
|
* [Linux Kernel](https://github.com/XiphosSystemsCorp/linux-xlnx.git) . EIVE version can be found
|
||||||
[here](https://github.com/spacefisch/linux-xlnx) . Pre-compiled files can be
|
[here](https://github.com/spacefisch/linux-xlnx) . Pre-compiled files can be
|
||||||
found [here](https://eive-cloud.irs.uni-stuttgart.de/index.php/apps/files/?dir=/EIVE_IRS/Software/q7s-linux-components&fileid=777299).
|
found [here](https://eive-cloud.irs.uni-stuttgart.de/index.php/apps/files/?dir=/EIVE_IRS/Software/q7s-linux-components&fileid=777299).
|
||||||
* Q7S base project can be found [here](https://egit.irs.uni-stuttgart.de/eive/q7s-base)
|
* Q7S base project can be found [here](https://egit.irs.uni-stuttgart.de/eive/q7s-base)
|
||||||
@ -104,7 +107,7 @@ When using Windows, run theses steps in MSYS2.
|
|||||||
|
|
||||||
```sh
|
```sh
|
||||||
mkdir build-Debug-Q7S && cd build-Debug-Q7S
|
mkdir build-Debug-Q7S && cd build-Debug-Q7S
|
||||||
cmake -DTGT_BSP="arm/q7s" -DCMAKE_BUILD_TYPE=Debug -DOS_FSFW=linux ..
|
cmake -DTGT_BSP="arm/q7s" -DCMAKE_BUILD_TYPE=Debug ..
|
||||||
cmake --build . -j
|
cmake --build . -j
|
||||||
```
|
```
|
||||||
|
|
||||||
@ -119,8 +122,7 @@ When using Windows, run theses steps in MSYS2.
|
|||||||
This will invoke a Python script which in turn invokes CMake with the correct
|
This will invoke a Python script which in turn invokes CMake with the correct
|
||||||
arguments to configure CMake for Q7S cross-compilation.
|
arguments to configure CMake for Q7S cross-compilation.
|
||||||
|
|
||||||
You can build the hosted variant of the OBSW by replacing `-DOS_FSFW=linux` with
|
There are also different values for `-DTGT_BSP` to build for the Raspberry Pi
|
||||||
`-DOS_FSFW=host`. There are also different values for `-DTGT_BSP` to build for the Raspberry Pi
|
|
||||||
or the Beagle Bone Black: `arm/raspberrypi` and `arm/beagleboneblack`.
|
or the Beagle Bone Black: `arm/raspberrypi` and `arm/beagleboneblack`.
|
||||||
|
|
||||||
5. Build the software with
|
5. Build the software with
|
||||||
@ -159,38 +161,45 @@ automatically.
|
|||||||
|
|
||||||
### Q7S OBSW
|
### Q7S OBSW
|
||||||
|
|
||||||
|
The EIVE OBSW is the default target if no target is specified.
|
||||||
|
|
||||||
```sh
|
```sh
|
||||||
mkdir build-Debug-Q7S && cd build-Debug-Q7S
|
mkdir build-Debug-Q7S && cd build-Debug-Q7S
|
||||||
cmake -DTGT_BSP=arm/q7s -DFSFW_OSAL=linux -DCMAKE_BUILD_TYPE=Debug ..
|
cmake -DTGT_BSP=arm/q7s -DCMAKE_BUILD_TYPE=Debug ..
|
||||||
cmake --build . -j
|
cmake --build . -j
|
||||||
```
|
```
|
||||||
|
|
||||||
### Q7S Watchdog
|
### Q7S Watchdog
|
||||||
|
|
||||||
|
To build the EIVE watchdog, the corresponding target must be specified in the build command.
|
||||||
|
The configure steps do not need to be repeated if the folder has already been configured.
|
||||||
|
|
||||||
```sh
|
```sh
|
||||||
mkdir build-Debug-Q7S && cd build-Debug-Q7S
|
mkdir build-Debug-Watchdog && cd build-Debug-Watchdog
|
||||||
cmake -DTGT_BSP=arm/q7s -DFSFW_OSAL=linux -DEIVE_BUILD_WATCHDOG=ON -DCMAKE_BUILD_TYPE=Debug ..
|
cmake -DTGT_BSP=arm/q7s -DCMAKE_BUILD_TYPE=Debug ..
|
||||||
cmake --build . -j
|
cmake --build . --target eive-watchdog -j
|
||||||
```
|
```
|
||||||
|
|
||||||
### Hosted
|
### Hosted
|
||||||
|
|
||||||
You can also replace `linux` by `host` for this command to build on Windows or for generic OSes
|
You can also use the FSFW OSAL `host` to build on Windows or for generic OSes.
|
||||||
|
Note: Currently this is not supported.
|
||||||
|
|
||||||
```sh
|
```sh
|
||||||
mkdir build-Debug-Host && cd build-Debug-Host
|
mkdir build-Debug-Host && cd build-Debug-Host
|
||||||
cmake -DFSFW_OSAL=linux -DCMAKE_BUILD_TYPE=Debug ..
|
cmake -DFSFW_OSAL=host -DCMAKE_BUILD_TYPE=Debug ..
|
||||||
cmake --build . -j
|
cmake --build . -j
|
||||||
```
|
```
|
||||||
|
|
||||||
### Unittests
|
### Unittests
|
||||||
|
|
||||||
You can also replace `linux` by `host` for this command to build on Windows
|
To build the unittests, the corresponding target must be specified in the build command.
|
||||||
|
The configure steps do not need to be repeated if the folder has already been configured.
|
||||||
|
|
||||||
```sh
|
```sh
|
||||||
mkdir build-Debug-Unittest && cd build-Debug-Unittest
|
mkdir build-Debug-Unittest && cd build-Debug-Unittest
|
||||||
cmake -DFSFW_OSAL=linux -DEIVE_BUILD_UNITTESTS=ON ..
|
cmake ..
|
||||||
cmake --build . -j
|
cmake --build . --target eive-unittests -j
|
||||||
```
|
```
|
||||||
|
|
||||||
## Connect to EIVE flatsat
|
## Connect to EIVE flatsat
|
||||||
@ -376,20 +385,7 @@ more recent disitributions anymore.
|
|||||||
## <a id="arm-toolchain"></a> Installing toolchain without Vivado
|
## <a id="arm-toolchain"></a> Installing toolchain without Vivado
|
||||||
|
|
||||||
You can download the toolchains for Windows and Linux
|
You can download the toolchains for Windows and Linux
|
||||||
[from the EIVE cloud](https://eive-cloud.irs.uni-stuttgart.de/index.php/apps/files?dir=/EIVE_IRS/Software/tools&fileid=831898).
|
[from the EIVE cloud](https://eive-cloud.irs.uni-stuttgart.de/index.php/apps/files/?dir=/EIVE_IRS/Software/tools).
|
||||||
|
|
||||||
If `wget` is available (e.g. MinGW64), you can use the following command to download the
|
|
||||||
toolchain for Windows
|
|
||||||
|
|
||||||
```sh
|
|
||||||
wget https://eive-cloud.irs.uni-stuttgart.de/index.php/s/rfoaistRd67yBbH/download/gcc-arm-linux-gnueabi-win.zip
|
|
||||||
```
|
|
||||||
|
|
||||||
or the following command for Linux (could be useful for CI/CD)
|
|
||||||
|
|
||||||
```sh
|
|
||||||
wget https://eive-cloud.irs.uni-stuttgart.de/index.php/s/MRaeA2XnMXpZ5Pp/download/gcc-arm-8.3-2019.03-x86_64-arm-linux-gnueabihf.tar.xz
|
|
||||||
```
|
|
||||||
|
|
||||||
## Installing CMake and MSYS2 on Windows
|
## Installing CMake and MSYS2 on Windows
|
||||||
|
|
||||||
@ -433,12 +429,24 @@ Beagle Bone Black for download here
|
|||||||
Download it and unzip it somewhere in the Xilinx installation folder.
|
Download it and unzip it somewhere in the Xilinx installation folder.
|
||||||
You can use the following command if `wget` can be used or for CI/CD:
|
You can use the following command if `wget` can be used or for CI/CD:
|
||||||
|
|
||||||
```
|
```sh
|
||||||
wget https://eive-cloud.irs.uni-stuttgart.de/index.php/s/agnJGYeRf6fw2ci/download/cortexa9hf-neon-xiphos-linux-gnueabi.tar.gz
|
wget https://eive-cloud.irs.uni-stuttgart.de/index.php/s/SyXpdBBQX32xPgE/download/cortexa9hf-neon-xiphos-linux-gnueabi.tar.gz
|
||||||
```
|
```
|
||||||
|
|
||||||
Then, create a new environmental variables `Q7S_SYSROOT` and set it to the local system root path.
|
Then, create a new environmental variables `Q7S_SYSROOT` and set it to the local system root path.
|
||||||
|
|
||||||
|
### Updating system root for CI
|
||||||
|
|
||||||
|
If the system root is updated, it needs to be manually updated on the buggy file server.
|
||||||
|
If access on `buggy.irs.uni-stuttgart.de` is possible with `ssh` and the rootfs in the cloud
|
||||||
|
[was updated](https://eive-cloud.irs.uni-stuttgart.de/index.php/apps/files/?dir=/EIVE_IRS/Software/rootfs&fileid=831849)
|
||||||
|
as well, you can update the rootfs like this:
|
||||||
|
|
||||||
|
```sh
|
||||||
|
cd /var/www/eive/tools
|
||||||
|
wget https://eive-cloud.irs.uni-stuttgart.de/index.php/s/SyXpdBBQX32xPgE/download/cortexa9hf-neon-xiphos-linux-gnueabi.tar.gz
|
||||||
|
```
|
||||||
|
|
||||||
## Setting up UNIX environment for real-time functionalities
|
## Setting up UNIX environment for real-time functionalities
|
||||||
|
|
||||||
Please note that on most UNIX environments (e.g. Ubuntu), the real time functionalities
|
Please note that on most UNIX environments (e.g. Ubuntu), the real time functionalities
|
||||||
@ -1045,26 +1053,7 @@ cat file.bin | hexdump -v -n X
|
|||||||
|
|
||||||
## Preparation of a fresh rootfs and SD card
|
## Preparation of a fresh rootfs and SD card
|
||||||
|
|
||||||
This section summarizes important changes between a fresh rootfs and the current
|
See [q7s-package repository README](https://egit.irs.uni-stuttgart.de/eive/q7s-package)
|
||||||
EIVE implementation
|
|
||||||
|
|
||||||
### rootfs
|
|
||||||
|
|
||||||
- Mount point `/mnt/sd0` created for SD card 0. Created with `mkdir`
|
|
||||||
- Mount point `/mnt/sd1` created for SD card 1. Created with `mkdir`
|
|
||||||
- Folder `scripts` in `/home/root` folder.
|
|
||||||
- `scripts` folder currently contains a few shell helper scripts
|
|
||||||
- Folder `profile.d` in `/etc` folder which contains the `path-set.sh` script
|
|
||||||
which is sourced at software startup
|
|
||||||
- Library `libwire.so` in `/usr/lib` folder
|
|
||||||
|
|
||||||
### SD Cards
|
|
||||||
|
|
||||||
- Folder `bin` for binaries, for example the OBSW
|
|
||||||
- Folder `misc` for miscellaneous files. Contains `ls` for directory listings
|
|
||||||
- Folder `tc` for telecommands
|
|
||||||
- Folder `tm` for telemetry
|
|
||||||
- Folder `xdi` for XDI components (e.g. for firmware or device tree updates)
|
|
||||||
|
|
||||||
# <a id="static-code-analysis"></a> Running cppcheck on the Software
|
# <a id="static-code-analysis"></a> Running cppcheck on the Software
|
||||||
|
|
||||||
@ -1112,7 +1101,7 @@ The [TCF agent](https://wiki.eclipse.org/TCF) can be used to perform remote debu
|
|||||||
1. Install the TCF agent plugin in Eclipse from
|
1. Install the TCF agent plugin in Eclipse from
|
||||||
the [releases](https://www.eclipse.org/tcf/downloads.php). Go to
|
the [releases](https://www.eclipse.org/tcf/downloads.php). Go to
|
||||||
Help → Install New Software and use the download page, for
|
Help → Install New Software and use the download page, for
|
||||||
example https://download.eclipse.org/tools/tcf/releases/1.6/1.6.2/ to search for the plugin and install it.
|
example https://download.eclipse.org/tools/tcf/releases/1.7/1.7.0/ to search for the plugin and install it. You can find the newest version [here](https://www.eclipse.org/tcf/downloads.php)
|
||||||
|
|
||||||
2. Go to Window → Perspective → Open Perspective and open the **Target Explorer Perspective**.
|
2. Go to Window → Perspective → Open Perspective and open the **Target Explorer Perspective**.
|
||||||
Here, the Q7S should show up if the local port forwarding was set up as explained previously.
|
Here, the Q7S should show up if the local port forwarding was set up as explained previously.
|
||||||
@ -1151,6 +1140,38 @@ sudo apt-get install gpiod libgpiod-dev
|
|||||||
|
|
||||||
to install the required GPIO libraries before cloning the system root folder.
|
to install the required GPIO libraries before cloning the system root folder.
|
||||||
|
|
||||||
|
# <a id="egse"></a> Running OBSW on EGSE
|
||||||
|
The EGSE is a test system from arcsec build arround a raspberry pi 4 to test the star tracker. The IP address of the EGSE (raspberry pi) is 192.168.18.31. An ssh session can be opened with
|
||||||
|
````
|
||||||
|
ssh pi@192.168.18.31
|
||||||
|
````
|
||||||
|
Password: raspberry
|
||||||
|
|
||||||
|
To run the obsw perform the following steps:
|
||||||
|
1. Build the cmake EGSE Configuration
|
||||||
|
* the sysroots for the EGSE can be found [here](https://eive-cloud.irs.uni-stuttgart.de/index.php/apps/files/?dir=/EIVE_IRS/Software/egse&fileid=1190471)
|
||||||
|
* toolchain for linux host can be downloaded from [here](https://github.com/Pro/raspi-toolchain)
|
||||||
|
* toolchain for windows host from [here](https://gnutoolchains.com/raspberry/) (the raspios-buster-armhf toolchain is the right one for the EGSE)
|
||||||
|
2. Disable the ser2net systemd service on the EGSE
|
||||||
|
````sh
|
||||||
|
$ sudo systemctl stop ser2net.service
|
||||||
|
````
|
||||||
|
3. Power on the star tracker by running
|
||||||
|
````sh
|
||||||
|
$ ~/powerctrl/enable0.sh`
|
||||||
|
````
|
||||||
|
4. Run portforwarding script for tmtc tcp connection and tcf agent on host PC
|
||||||
|
````sh
|
||||||
|
$ ./scripts/egse-port.sh
|
||||||
|
````
|
||||||
|
5. The star tracker can be powered off by running
|
||||||
|
````sh
|
||||||
|
$ ~/powerctrl/disable0.sh
|
||||||
|
````
|
||||||
|
|
||||||
|
# <a id="gpsd"></a> Manually preparing sysroots to compile gpsd
|
||||||
|
Copy all header files from [here](https://eive-cloud.irs.uni-stuttgart.de/index.php/apps/files/?dir=/EIVE_IRS/Software/gpsd&fileid=1189985) to the /usr/include directory and all static libraries to /usr/lib.
|
||||||
|
|
||||||
# <a id="fsfw"></a> Flight Software Framework (FSFW)
|
# <a id="fsfw"></a> Flight Software Framework (FSFW)
|
||||||
|
|
||||||
An EIVE fork of the FSFW is submodules into this repository.
|
An EIVE fork of the FSFW is submodules into this repository.
|
||||||
@ -1170,3 +1191,15 @@ git merge upstream/master
|
|||||||
|
|
||||||
Alternatively, changes from other upstreams (forks) and branches can be merged like that
|
Alternatively, changes from other upstreams (forks) and branches can be merged like that
|
||||||
in the same way.
|
in the same way.
|
||||||
|
|
||||||
|
# <a id="coding-style"></a> Coding Style
|
||||||
|
* the formatting is based on the clang-format tools
|
||||||
|
## Setting up eclipse auto-fromatter with clang-format
|
||||||
|
1. Help → Install New Software → Add
|
||||||
|
2. In location insert the link http://www.cppstyle.com/luna
|
||||||
|
3. The software package CppStyle should now be available for installation
|
||||||
|
4. On windows download the clang-formatting tools from https://llvm.org/builds/. On linux clang-format can be installed with the package manager.
|
||||||
|
5. Navigate to Preferences → C/C++ → CppStyle
|
||||||
|
6. Insert the path to the clang-format executable
|
||||||
|
7. Under C/C++ → Code Style → Formatter, change the formatter to CppStyle (clang-format)
|
||||||
|
8. Code can now be formatted with the clang tool by using the key combination Ctrl + Shift + f
|
||||||
|
5
SDK.log
Normal file
5
SDK.log
Normal file
@ -0,0 +1,5 @@
|
|||||||
|
10:00:08 INFO : Registering command handlers for SDK TCF services
|
||||||
|
10:00:10 INFO : Launching XSCT server: xsct.bat -interactive C:\Users\EIVE_Reinraumrechner\eive-software\eive-obsw\temp_xsdb_launch_script.tcl
|
||||||
|
10:00:16 INFO : XSCT server has started successfully.
|
||||||
|
10:00:22 INFO : Successfully done setting XSCT server connection channel
|
||||||
|
10:00:22 INFO : Successfully done setting SDK workspace
|
32
archive/gpio/GpioCookie.cpp
Normal file
32
archive/gpio/GpioCookie.cpp
Normal file
@ -0,0 +1,32 @@
|
|||||||
|
#include "GpioCookie.h"
|
||||||
|
|
||||||
|
#include <fsfw/serviceinterface/ServiceInterface.h>
|
||||||
|
|
||||||
|
GpioCookie::GpioCookie() {}
|
||||||
|
|
||||||
|
ReturnValue_t GpioCookie::addGpio(gpioId_t gpioId, GpioBase* gpioConfig) {
|
||||||
|
if (gpioConfig == nullptr) {
|
||||||
|
sif::debug << "GpioCookie::addGpio: gpioConfig is nullpointer" << std::endl;
|
||||||
|
return HasReturnvaluesIF::RETURN_FAILED;
|
||||||
|
}
|
||||||
|
auto gpioMapIter = gpioMap.find(gpioId);
|
||||||
|
if (gpioMapIter == gpioMap.end()) {
|
||||||
|
auto statusPair = gpioMap.emplace(gpioId, gpioConfig);
|
||||||
|
if (statusPair.second == false) {
|
||||||
|
#if FSFW_VERBOSE_LEVEL >= 1
|
||||||
|
sif::error << "GpioCookie::addGpio: Failed to add GPIO " << gpioId << " to GPIO map"
|
||||||
|
<< std::endl;
|
||||||
|
#endif
|
||||||
|
return HasReturnvaluesIF::RETURN_FAILED;
|
||||||
|
}
|
||||||
|
return HasReturnvaluesIF::RETURN_OK;
|
||||||
|
}
|
||||||
|
#if FSFW_VERBOSE_LEVEL >= 1
|
||||||
|
sif::error << "GpioCookie::addGpio: GPIO already exists in GPIO map " << std::endl;
|
||||||
|
#endif
|
||||||
|
return HasReturnvaluesIF::RETURN_FAILED;
|
||||||
|
}
|
||||||
|
|
||||||
|
GpioMap GpioCookie::getGpioMap() const { return gpioMap; }
|
||||||
|
|
||||||
|
GpioCookie::~GpioCookie() {}
|
@ -1,11 +1,12 @@
|
|||||||
#ifndef LINUX_GPIO_GPIOCOOKIE_H_
|
#ifndef LINUX_GPIO_GPIOCOOKIE_H_
|
||||||
#define LINUX_GPIO_GPIOCOOKIE_H_
|
#define LINUX_GPIO_GPIOCOOKIE_H_
|
||||||
|
|
||||||
#include "GpioIF.h"
|
|
||||||
#include "gpioDefinitions.h"
|
|
||||||
#include <fsfw/devicehandlers/CookieIF.h>
|
#include <fsfw/devicehandlers/CookieIF.h>
|
||||||
#include <fsfw/returnvalues/HasReturnvaluesIF.h>
|
#include <fsfw/returnvalues/HasReturnvaluesIF.h>
|
||||||
|
|
||||||
|
#include "GpioIF.h"
|
||||||
|
#include "gpioDefinitions.h"
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Cookie for the GpioIF. Allows the GpioIF to determine which
|
* @brief Cookie for the GpioIF. Allows the GpioIF to determine which
|
||||||
* GPIOs to initialize and whether they should be configured as in- or
|
* GPIOs to initialize and whether they should be configured as in- or
|
||||||
@ -16,9 +17,8 @@
|
|||||||
*
|
*
|
||||||
* @author J. Meier
|
* @author J. Meier
|
||||||
*/
|
*/
|
||||||
class GpioCookie: public CookieIF {
|
class GpioCookie : public CookieIF {
|
||||||
public:
|
public:
|
||||||
|
|
||||||
GpioCookie();
|
GpioCookie();
|
||||||
|
|
||||||
virtual ~GpioCookie();
|
virtual ~GpioCookie();
|
||||||
@ -29,7 +29,7 @@ public:
|
|||||||
*/
|
*/
|
||||||
GpioMap getGpioMap() const;
|
GpioMap getGpioMap() const;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
/**
|
/**
|
||||||
* Returns a copy of the internal GPIO map.
|
* Returns a copy of the internal GPIO map.
|
||||||
*/
|
*/
|
54
archive/gpio/GpioIF.h
Normal file
54
archive/gpio/GpioIF.h
Normal file
@ -0,0 +1,54 @@
|
|||||||
|
#ifndef LINUX_GPIO_GPIOIF_H_
|
||||||
|
#define LINUX_GPIO_GPIOIF_H_
|
||||||
|
|
||||||
|
#include <fsfw/devicehandlers/CookieIF.h>
|
||||||
|
#include <fsfw/returnvalues/HasReturnvaluesIF.h>
|
||||||
|
|
||||||
|
#include "gpioDefinitions.h"
|
||||||
|
|
||||||
|
class GpioCookie;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief This class defines the interface for objects requiring the control
|
||||||
|
* over GPIOs.
|
||||||
|
* @author J. Meier
|
||||||
|
*/
|
||||||
|
class GpioIF : public HasReturnvaluesIF {
|
||||||
|
public:
|
||||||
|
virtual ~GpioIF(){};
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Called by the GPIO using object.
|
||||||
|
* @param cookie Cookie specifying informations of the GPIOs required
|
||||||
|
* by a object.
|
||||||
|
*/
|
||||||
|
virtual ReturnValue_t addGpios(GpioCookie* cookie) = 0;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief By implementing this function a child must provide the
|
||||||
|
* functionality to pull a certain GPIO to high logic level.
|
||||||
|
*
|
||||||
|
* @param gpioId A unique number which specifies the GPIO to drive.
|
||||||
|
* @return Returns RETURN_OK for success. This should never return RETURN_FAILED.
|
||||||
|
*/
|
||||||
|
virtual ReturnValue_t pullHigh(gpioId_t gpioId) = 0;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief By implementing this function a child must provide the
|
||||||
|
* functionality to pull a certain GPIO to low logic level.
|
||||||
|
*
|
||||||
|
* @param gpioId A unique number which specifies the GPIO to drive.
|
||||||
|
*/
|
||||||
|
virtual ReturnValue_t pullLow(gpioId_t gpioId) = 0;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief This function requires a child to implement the functionality to read the state of
|
||||||
|
* an ouput or input gpio.
|
||||||
|
*
|
||||||
|
* @param gpioId A unique number which specifies the GPIO to read.
|
||||||
|
* @param gpioState State of GPIO will be written to this pointer.
|
||||||
|
*/
|
||||||
|
virtual ReturnValue_t readGpio(gpioId_t gpioId, int* gpioState) = 0;
|
||||||
|
};
|
||||||
|
|
||||||
|
#endif /* LINUX_GPIO_GPIOIF_H_ */
|
295
archive/gpio/LinuxLibgpioIF.cpp
Normal file
295
archive/gpio/LinuxLibgpioIF.cpp
Normal file
@ -0,0 +1,295 @@
|
|||||||
|
#include "LinuxLibgpioIF.h"
|
||||||
|
|
||||||
|
#include <fsfw/serviceinterface/ServiceInterface.h>
|
||||||
|
#include <gpiod.h>
|
||||||
|
#include <linux/gpio/gpioDefinitions.h>
|
||||||
|
#include <unistd.h>
|
||||||
|
|
||||||
|
#include <utility>
|
||||||
|
|
||||||
|
#include "GpioCookie.h"
|
||||||
|
|
||||||
|
LinuxLibgpioIF::LinuxLibgpioIF(object_id_t objectId) : SystemObject(objectId) {
|
||||||
|
struct gpiod_chip* chip = gpiod_chip_open_by_label("/amba_pl/gpio@42030000");
|
||||||
|
|
||||||
|
sif::debug << chip->name << std::endl;
|
||||||
|
}
|
||||||
|
|
||||||
|
LinuxLibgpioIF::~LinuxLibgpioIF() {}
|
||||||
|
|
||||||
|
ReturnValue_t LinuxLibgpioIF::addGpios(GpioCookie* gpioCookie) {
|
||||||
|
ReturnValue_t result;
|
||||||
|
if (gpioCookie == nullptr) {
|
||||||
|
sif::error << "LinuxLibgpioIF::initialize: Invalid cookie" << std::endl;
|
||||||
|
return RETURN_FAILED;
|
||||||
|
}
|
||||||
|
|
||||||
|
GpioMap mapToAdd = gpioCookie->getGpioMap();
|
||||||
|
|
||||||
|
/* Check whether this ID already exists in the map and remove duplicates */
|
||||||
|
result = checkForConflicts(mapToAdd);
|
||||||
|
if (result != RETURN_OK) {
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
result = configureGpios(mapToAdd);
|
||||||
|
if (result != RETURN_OK) {
|
||||||
|
return RETURN_FAILED;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Register new GPIOs in gpioMap */
|
||||||
|
gpioMap.insert(mapToAdd.begin(), mapToAdd.end());
|
||||||
|
|
||||||
|
return RETURN_OK;
|
||||||
|
}
|
||||||
|
|
||||||
|
ReturnValue_t LinuxLibgpioIF::configureGpios(GpioMap& mapToAdd) {
|
||||||
|
for (auto& gpioConfig : mapToAdd) {
|
||||||
|
switch (gpioConfig.second->gpioType) {
|
||||||
|
case (gpio::GpioTypes::NONE): {
|
||||||
|
return GPIO_INVALID_INSTANCE;
|
||||||
|
}
|
||||||
|
case (gpio::GpioTypes::GPIOD_REGULAR): {
|
||||||
|
GpiodRegular* regularGpio = dynamic_cast<GpiodRegular*>(gpioConfig.second);
|
||||||
|
if (regularGpio == nullptr) {
|
||||||
|
return GPIO_INVALID_INSTANCE;
|
||||||
|
}
|
||||||
|
configureRegularGpio(gpioConfig.first, regularGpio);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
case (gpio::GpioTypes::CALLBACK): {
|
||||||
|
auto gpioCallback = dynamic_cast<GpioCallback*>(gpioConfig.second);
|
||||||
|
if (gpioCallback->callback == nullptr) {
|
||||||
|
return GPIO_INVALID_INSTANCE;
|
||||||
|
}
|
||||||
|
gpioCallback->callback(gpioConfig.first, gpio::GpioOperation::WRITE,
|
||||||
|
gpioCallback->initValue, gpioCallback->callbackArgs);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return RETURN_OK;
|
||||||
|
}
|
||||||
|
|
||||||
|
ReturnValue_t LinuxLibgpioIF::configureRegularGpio(gpioId_t gpioId, GpiodRegular* regularGpio) {
|
||||||
|
std::string chipname;
|
||||||
|
unsigned int lineNum;
|
||||||
|
struct gpiod_chip* chip;
|
||||||
|
gpio::Direction direction;
|
||||||
|
std::string consumer;
|
||||||
|
struct gpiod_line* lineHandle;
|
||||||
|
int result = 0;
|
||||||
|
|
||||||
|
chipname = regularGpio->chipname;
|
||||||
|
chip = gpiod_chip_open_by_name(chipname.c_str());
|
||||||
|
if (!chip) {
|
||||||
|
sif::error << "LinuxLibgpioIF::configureGpios: Failed to open chip " << chipname
|
||||||
|
<< ". Gpio ID: " << gpioId << std::endl;
|
||||||
|
return RETURN_FAILED;
|
||||||
|
}
|
||||||
|
|
||||||
|
lineNum = regularGpio->lineNum;
|
||||||
|
lineHandle = gpiod_chip_get_line(chip, lineNum);
|
||||||
|
if (!lineHandle) {
|
||||||
|
sif::error << "LinuxLibgpioIF::configureGpios: Failed to open line for GPIO with id " << gpioId
|
||||||
|
<< std::endl;
|
||||||
|
gpiod_chip_close(chip);
|
||||||
|
return RETURN_FAILED;
|
||||||
|
}
|
||||||
|
|
||||||
|
direction = regularGpio->direction;
|
||||||
|
consumer = regularGpio->consumer;
|
||||||
|
/* Configure direction and add a description to the GPIO */
|
||||||
|
switch (direction) {
|
||||||
|
case (gpio::OUT): {
|
||||||
|
result = gpiod_line_request_output(lineHandle, consumer.c_str(), regularGpio->initValue);
|
||||||
|
if (result < 0) {
|
||||||
|
sif::error << "LinuxLibgpioIF::configureGpios: Failed to request line " << lineNum
|
||||||
|
<< " from GPIO instance with ID: " << gpioId << std::endl;
|
||||||
|
gpiod_line_release(lineHandle);
|
||||||
|
return RETURN_FAILED;
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
case (gpio::IN): {
|
||||||
|
result = gpiod_line_request_input(lineHandle, consumer.c_str());
|
||||||
|
if (result < 0) {
|
||||||
|
sif::error << "LinuxLibgpioIF::configureGpios: Failed to request line " << lineNum
|
||||||
|
<< " from GPIO instance with ID: " << gpioId << std::endl;
|
||||||
|
gpiod_line_release(lineHandle);
|
||||||
|
return RETURN_FAILED;
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
default: {
|
||||||
|
sif::error << "LinuxLibgpioIF::configureGpios: Invalid direction specified" << std::endl;
|
||||||
|
return GPIO_INVALID_INSTANCE;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
* Write line handle to GPIO configuration instance so it can later be used to set or
|
||||||
|
* read states of GPIOs.
|
||||||
|
*/
|
||||||
|
regularGpio->lineHandle = lineHandle;
|
||||||
|
return RETURN_OK;
|
||||||
|
}
|
||||||
|
|
||||||
|
ReturnValue_t LinuxLibgpioIF::pullHigh(gpioId_t gpioId) {
|
||||||
|
gpioMapIter = gpioMap.find(gpioId);
|
||||||
|
if (gpioMapIter == gpioMap.end()) {
|
||||||
|
sif::warning << "LinuxLibgpioIF::driveGpio: Unknown GPIOD ID " << gpioId << std::endl;
|
||||||
|
return UNKNOWN_GPIO_ID;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (gpioMapIter->second->gpioType == gpio::GpioTypes::GPIOD_REGULAR) {
|
||||||
|
return driveGpio(gpioId, dynamic_cast<GpiodRegular*>(gpioMapIter->second), 1);
|
||||||
|
} else {
|
||||||
|
auto gpioCallback = dynamic_cast<GpioCallback*>(gpioMapIter->second);
|
||||||
|
if (gpioCallback->callback == nullptr) {
|
||||||
|
return GPIO_INVALID_INSTANCE;
|
||||||
|
}
|
||||||
|
gpioCallback->callback(gpioMapIter->first, gpio::GpioOperation::WRITE, 1,
|
||||||
|
gpioCallback->callbackArgs);
|
||||||
|
}
|
||||||
|
return GPIO_TYPE_FAILURE;
|
||||||
|
}
|
||||||
|
|
||||||
|
ReturnValue_t LinuxLibgpioIF::pullLow(gpioId_t gpioId) {
|
||||||
|
gpioMapIter = gpioMap.find(gpioId);
|
||||||
|
if (gpioMapIter == gpioMap.end()) {
|
||||||
|
sif::warning << "LinuxLibgpioIF::driveGpio: Unknown GPIOD ID " << gpioId << std::endl;
|
||||||
|
return UNKNOWN_GPIO_ID;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (gpioMapIter->second->gpioType == gpio::GpioTypes::GPIOD_REGULAR) {
|
||||||
|
return driveGpio(gpioId, dynamic_cast<GpiodRegular*>(gpioMapIter->second), 0);
|
||||||
|
} else {
|
||||||
|
auto gpioCallback = dynamic_cast<GpioCallback*>(gpioMapIter->second);
|
||||||
|
if (gpioCallback->callback == nullptr) {
|
||||||
|
return GPIO_INVALID_INSTANCE;
|
||||||
|
}
|
||||||
|
gpioCallback->callback(gpioMapIter->first, gpio::GpioOperation::WRITE, 0,
|
||||||
|
gpioCallback->callbackArgs);
|
||||||
|
}
|
||||||
|
return GPIO_TYPE_FAILURE;
|
||||||
|
}
|
||||||
|
|
||||||
|
ReturnValue_t LinuxLibgpioIF::driveGpio(gpioId_t gpioId, GpiodRegular* regularGpio,
|
||||||
|
unsigned int logicLevel) {
|
||||||
|
if (regularGpio == nullptr) {
|
||||||
|
return GPIO_TYPE_FAILURE;
|
||||||
|
}
|
||||||
|
|
||||||
|
int result = gpiod_line_set_value(regularGpio->lineHandle, logicLevel);
|
||||||
|
if (result < 0) {
|
||||||
|
sif::warning << "LinuxLibgpioIF::driveGpio: Failed to pull GPIO with ID " << gpioId
|
||||||
|
<< " to logic level " << logicLevel << std::endl;
|
||||||
|
return DRIVE_GPIO_FAILURE;
|
||||||
|
}
|
||||||
|
|
||||||
|
return RETURN_OK;
|
||||||
|
}
|
||||||
|
|
||||||
|
ReturnValue_t LinuxLibgpioIF::readGpio(gpioId_t gpioId, int* gpioState) {
|
||||||
|
gpioMapIter = gpioMap.find(gpioId);
|
||||||
|
if (gpioMapIter == gpioMap.end()) {
|
||||||
|
sif::warning << "LinuxLibgpioIF::readGpio: Unknown GPIOD ID " << gpioId << std::endl;
|
||||||
|
return UNKNOWN_GPIO_ID;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (gpioMapIter->second->gpioType == gpio::GpioTypes::GPIOD_REGULAR) {
|
||||||
|
GpiodRegular* regularGpio = dynamic_cast<GpiodRegular*>(gpioMapIter->second);
|
||||||
|
if (regularGpio == nullptr) {
|
||||||
|
return GPIO_TYPE_FAILURE;
|
||||||
|
}
|
||||||
|
*gpioState = gpiod_line_get_value(regularGpio->lineHandle);
|
||||||
|
} else {
|
||||||
|
}
|
||||||
|
|
||||||
|
return RETURN_OK;
|
||||||
|
}
|
||||||
|
|
||||||
|
ReturnValue_t LinuxLibgpioIF::checkForConflicts(GpioMap& mapToAdd) {
|
||||||
|
ReturnValue_t status = HasReturnvaluesIF::RETURN_OK;
|
||||||
|
ReturnValue_t result = HasReturnvaluesIF::RETURN_OK;
|
||||||
|
for (auto& gpioConfig : mapToAdd) {
|
||||||
|
switch (gpioConfig.second->gpioType) {
|
||||||
|
case (gpio::GpioTypes::GPIOD_REGULAR): {
|
||||||
|
auto regularGpio = dynamic_cast<GpiodRegular*>(gpioConfig.second);
|
||||||
|
if (regularGpio == nullptr) {
|
||||||
|
return GPIO_TYPE_FAILURE;
|
||||||
|
}
|
||||||
|
/* Check for conflicts and remove duplicates if necessary */
|
||||||
|
result = checkForConflictsRegularGpio(gpioConfig.first, regularGpio, mapToAdd);
|
||||||
|
if (result != HasReturnvaluesIF::RETURN_OK) {
|
||||||
|
status = result;
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
case (gpio::GpioTypes::CALLBACK): {
|
||||||
|
auto callbackGpio = dynamic_cast<GpioCallback*>(gpioConfig.second);
|
||||||
|
if (callbackGpio == nullptr) {
|
||||||
|
return GPIO_TYPE_FAILURE;
|
||||||
|
}
|
||||||
|
/* Check for conflicts and remove duplicates if necessary */
|
||||||
|
result = checkForConflictsCallbackGpio(gpioConfig.first, callbackGpio, mapToAdd);
|
||||||
|
if (result != HasReturnvaluesIF::RETURN_OK) {
|
||||||
|
status = result;
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
default: {
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return status;
|
||||||
|
}
|
||||||
|
|
||||||
|
ReturnValue_t LinuxLibgpioIF::checkForConflictsRegularGpio(gpioId_t gpioIdToCheck,
|
||||||
|
GpiodRegular* gpioToCheck,
|
||||||
|
GpioMap& mapToAdd) {
|
||||||
|
/* Cross check with private map */
|
||||||
|
gpioMapIter = gpioMap.find(gpioIdToCheck);
|
||||||
|
if (gpioMapIter != gpioMap.end()) {
|
||||||
|
if (gpioMapIter->second->gpioType != gpio::GpioTypes::GPIOD_REGULAR) {
|
||||||
|
sif::warning << "LinuxLibgpioIF::checkForConflicts: ID already exists for different "
|
||||||
|
"GPIO type"
|
||||||
|
<< gpioIdToCheck << ". Removing duplicate." << std::endl;
|
||||||
|
mapToAdd.erase(gpioIdToCheck);
|
||||||
|
return HasReturnvaluesIF::RETURN_OK;
|
||||||
|
}
|
||||||
|
auto ownRegularGpio = dynamic_cast<GpiodRegular*>(gpioMapIter->second);
|
||||||
|
if (ownRegularGpio == nullptr) {
|
||||||
|
return GPIO_TYPE_FAILURE;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Remove element from map to add because a entry for this GPIO
|
||||||
|
already exists */
|
||||||
|
sif::warning << "LinuxLibgpioIF::checkForConflictsRegularGpio: Duplicate GPIO definition"
|
||||||
|
<< " detected. Duplicate will be removed from map to add." << std::endl;
|
||||||
|
mapToAdd.erase(gpioIdToCheck);
|
||||||
|
}
|
||||||
|
return HasReturnvaluesIF::RETURN_OK;
|
||||||
|
}
|
||||||
|
|
||||||
|
ReturnValue_t LinuxLibgpioIF::checkForConflictsCallbackGpio(gpioId_t gpioIdToCheck,
|
||||||
|
GpioCallback* callbackGpio,
|
||||||
|
GpioMap& mapToAdd) {
|
||||||
|
/* Cross check with private map */
|
||||||
|
gpioMapIter = gpioMap.find(gpioIdToCheck);
|
||||||
|
if (gpioMapIter != gpioMap.end()) {
|
||||||
|
if (gpioMapIter->second->gpioType != gpio::GpioTypes::CALLBACK) {
|
||||||
|
sif::warning << "LinuxLibgpioIF::checkForConflicts: ID already exists for different "
|
||||||
|
"GPIO type"
|
||||||
|
<< gpioIdToCheck << ". Removing duplicate." << std::endl;
|
||||||
|
mapToAdd.erase(gpioIdToCheck);
|
||||||
|
return HasReturnvaluesIF::RETURN_OK;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Remove element from map to add because a entry for this GPIO
|
||||||
|
already exists */
|
||||||
|
sif::warning << "LinuxLibgpioIF::checkForConflictsRegularGpio: Duplicate GPIO definition"
|
||||||
|
<< " detected. Duplicate will be removed from map to add." << std::endl;
|
||||||
|
mapToAdd.erase(gpioIdToCheck);
|
||||||
|
}
|
||||||
|
return HasReturnvaluesIF::RETURN_OK;
|
||||||
|
}
|
75
archive/gpio/LinuxLibgpioIF.h
Normal file
75
archive/gpio/LinuxLibgpioIF.h
Normal file
@ -0,0 +1,75 @@
|
|||||||
|
#ifndef LINUX_GPIO_LINUXLIBGPIOIF_H_
|
||||||
|
#define LINUX_GPIO_LINUXLIBGPIOIF_H_
|
||||||
|
|
||||||
|
#include <fsfw/objectmanager/SystemObject.h>
|
||||||
|
#include <fsfwconfig/returnvalues/classIds.h>
|
||||||
|
#include <linux/gpio/GpioIF.h>
|
||||||
|
|
||||||
|
class GpioCookie;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief This class implements the GpioIF for a linux based system. The
|
||||||
|
* implementation is based on the libgpiod lib which requires linux 4.8
|
||||||
|
* or higher.
|
||||||
|
* @note The Petalinux SDK from Xilinx supports libgpiod since Petalinux
|
||||||
|
* 2019.1.
|
||||||
|
*/
|
||||||
|
class LinuxLibgpioIF : public GpioIF, public SystemObject {
|
||||||
|
public:
|
||||||
|
static const uint8_t gpioRetvalId = CLASS_ID::LINUX_LIBGPIO_IF;
|
||||||
|
|
||||||
|
static constexpr ReturnValue_t UNKNOWN_GPIO_ID =
|
||||||
|
HasReturnvaluesIF::makeReturnCode(gpioRetvalId, 1);
|
||||||
|
static constexpr ReturnValue_t DRIVE_GPIO_FAILURE =
|
||||||
|
HasReturnvaluesIF::makeReturnCode(gpioRetvalId, 2);
|
||||||
|
static constexpr ReturnValue_t GPIO_TYPE_FAILURE =
|
||||||
|
HasReturnvaluesIF::makeReturnCode(gpioRetvalId, 3);
|
||||||
|
static constexpr ReturnValue_t GPIO_INVALID_INSTANCE =
|
||||||
|
HasReturnvaluesIF::makeReturnCode(gpioRetvalId, 4);
|
||||||
|
|
||||||
|
LinuxLibgpioIF(object_id_t objectId);
|
||||||
|
virtual ~LinuxLibgpioIF();
|
||||||
|
|
||||||
|
ReturnValue_t addGpios(GpioCookie* gpioCookie) override;
|
||||||
|
ReturnValue_t pullHigh(gpioId_t gpioId) override;
|
||||||
|
ReturnValue_t pullLow(gpioId_t gpioId) override;
|
||||||
|
ReturnValue_t readGpio(gpioId_t gpioId, int* gpioState) override;
|
||||||
|
|
||||||
|
private:
|
||||||
|
/* Holds the information and configuration of all used GPIOs */
|
||||||
|
GpioMap gpioMap;
|
||||||
|
GpioMapIter gpioMapIter;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief This functions drives line of a GPIO specified by the GPIO ID.
|
||||||
|
*
|
||||||
|
* @param gpioId The GPIO ID of the GPIO to drive.
|
||||||
|
* @param logiclevel The logic level to set. O or 1.
|
||||||
|
*/
|
||||||
|
ReturnValue_t driveGpio(gpioId_t gpioId, GpiodRegularBase& regularGpio, unsigned int logiclevel);
|
||||||
|
|
||||||
|
ReturnValue_t configureRegularGpio(gpioId_t gpioId, GpiodRegularBase& regularGpio);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief This function checks if GPIOs are already registered and whether
|
||||||
|
* there exists a conflict in the GPIO configuration. E.g. the
|
||||||
|
* direction.
|
||||||
|
*
|
||||||
|
* @param mapToAdd The GPIOs which shall be added to the gpioMap.
|
||||||
|
*
|
||||||
|
* @return RETURN_OK if successful, otherwise RETURN_FAILED
|
||||||
|
*/
|
||||||
|
ReturnValue_t checkForConflicts(GpioMap& mapToAdd);
|
||||||
|
|
||||||
|
ReturnValue_t checkForConflictsRegularGpio(gpioId_t gpiodId, GpiodRegular* regularGpio,
|
||||||
|
GpioMap& mapToAdd);
|
||||||
|
ReturnValue_t checkForConflictsCallbackGpio(gpioId_t gpiodId, GpioCallback* regularGpio,
|
||||||
|
GpioMap& mapToAdd);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Performs the initial configuration of all GPIOs specified in the GpioMap mapToAdd.
|
||||||
|
*/
|
||||||
|
ReturnValue_t configureGpios(GpioMap& mapToAdd);
|
||||||
|
};
|
||||||
|
|
||||||
|
#endif /* LINUX_GPIO_LINUXLIBGPIOIF_H_ */
|
83
archive/gpio/gpioDefinitions.h
Normal file
83
archive/gpio/gpioDefinitions.h
Normal file
@ -0,0 +1,83 @@
|
|||||||
|
#ifndef LINUX_GPIO_GPIODEFINITIONS_H_
|
||||||
|
#define LINUX_GPIO_GPIODEFINITIONS_H_
|
||||||
|
|
||||||
|
#include <string>
|
||||||
|
#include <unordered_map>
|
||||||
|
|
||||||
|
using gpioId_t = uint16_t;
|
||||||
|
|
||||||
|
namespace gpio {
|
||||||
|
|
||||||
|
enum class Levels : uint8_t { LOW = 0, HIGH = 1 };
|
||||||
|
|
||||||
|
enum class Direction : uint8_t { IN = 0, OUT = 1 };
|
||||||
|
|
||||||
|
enum class GpioOperation { READ, WRITE };
|
||||||
|
|
||||||
|
enum class GpioTypes { NONE, GPIOD_REGULAR, CALLBACK };
|
||||||
|
|
||||||
|
static constexpr gpioId_t NO_GPIO = -1;
|
||||||
|
} // namespace gpio
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Struct containing information about the GPIO to use. This is
|
||||||
|
* required by the libgpiod to access and drive a GPIO.
|
||||||
|
* @param chipname String of the chipname specifying the group which contains the GPIO to
|
||||||
|
* access. E.g. gpiochip0. To detect names of GPIO groups run gpiodetect on
|
||||||
|
* the linux command line.
|
||||||
|
* @param lineNum The offset of the GPIO within the GPIO group.
|
||||||
|
* @param consumer Name of the consumer. Simply a description of the GPIO configuration.
|
||||||
|
* @param direction Specifies whether the GPIO should be used as in- or output.
|
||||||
|
* @param initValue Defines the initial state of the GPIO when configured as output.
|
||||||
|
* Only required for output GPIOs.
|
||||||
|
* @param lineHandle The handle returned by gpiod_chip_get_line will be later written to this
|
||||||
|
* pointer.
|
||||||
|
*/
|
||||||
|
class GpioBase {
|
||||||
|
public:
|
||||||
|
GpioBase() = default;
|
||||||
|
|
||||||
|
GpioBase(gpio::GpioTypes gpioType, std::string consumer, gpio::Direction direction, int initValue)
|
||||||
|
: gpioType(gpioType), consumer(consumer), direction(direction), initValue(initValue) {}
|
||||||
|
|
||||||
|
virtual ~GpioBase(){};
|
||||||
|
|
||||||
|
/* Can be used to cast GpioBase to a concrete child implementation */
|
||||||
|
gpio::GpioTypes gpioType = gpio::GpioTypes::NONE;
|
||||||
|
std::string consumer;
|
||||||
|
gpio::Direction direction = gpio::Direction::IN;
|
||||||
|
int initValue = 0;
|
||||||
|
};
|
||||||
|
|
||||||
|
class GpiodRegular : public GpioBase {
|
||||||
|
public:
|
||||||
|
GpiodRegular()
|
||||||
|
: GpioBase(gpio::GpioTypes::GPIOD_REGULAR, std::string(), gpio::Direction::IN, 0){};
|
||||||
|
|
||||||
|
GpiodRegular(std::string chipname_, int lineNum_, std::string consumer_,
|
||||||
|
gpio::Direction direction_, int initValue_)
|
||||||
|
: GpioBase(gpio::GpioTypes::GPIOD_REGULAR, consumer_, direction_, initValue_),
|
||||||
|
chipname(chipname_),
|
||||||
|
lineNum(lineNum_) {}
|
||||||
|
std::string chipname;
|
||||||
|
int lineNum = 0;
|
||||||
|
struct gpiod_line* lineHandle = nullptr;
|
||||||
|
};
|
||||||
|
|
||||||
|
class GpioCallback : public GpioBase {
|
||||||
|
public:
|
||||||
|
GpioCallback(std::string consumer, gpio::Direction direction_, int initValue_,
|
||||||
|
void (*callback)(gpioId_t gpioId, gpio::GpioOperation gpioOp, int value, void* args),
|
||||||
|
void* callbackArgs)
|
||||||
|
: GpioBase(gpio::GpioTypes::CALLBACK, consumer, direction_, initValue_),
|
||||||
|
callback(callback),
|
||||||
|
callbackArgs(callbackArgs) {}
|
||||||
|
|
||||||
|
void (*callback)(gpioId_t gpioId, gpio::GpioOperation gpioOp, int value, void* args) = nullptr;
|
||||||
|
void* callbackArgs = nullptr;
|
||||||
|
};
|
||||||
|
|
||||||
|
using GpioMap = std::unordered_map<gpioId_t, GpioBase*>;
|
||||||
|
using GpioMapIter = GpioMap::iterator;
|
||||||
|
|
||||||
|
#endif /* LINUX_GPIO_GPIODEFINITIONS_H_ */
|
128
archive/tmtc/CCSDSIPCoreBridge.cpp
Normal file
128
archive/tmtc/CCSDSIPCoreBridge.cpp
Normal file
@ -0,0 +1,128 @@
|
|||||||
|
#include <fcntl.h>
|
||||||
|
#include <linux/obc/Ptme.h>
|
||||||
|
#include <sys/mman.h>
|
||||||
|
|
||||||
|
CCSDSIPCoreBridge::CCSDSIPCoreBridge(object_id_t objectId, object_id_t tcDestination,
|
||||||
|
object_id_t tmStoreId, object_id_t tcStoreId,
|
||||||
|
LinuxLibgpioIF* gpioComIF, std::string uioPtme,
|
||||||
|
gpioId_t papbBusyId, gpioId_t papbEmptyId)
|
||||||
|
: TmTcBridge(objectId, tcDestination, tmStoreId, tcStoreId),
|
||||||
|
gpioComIF(gpioComIF),
|
||||||
|
uioPtme(uioPtme),
|
||||||
|
papbBusyId(papbBusyId),
|
||||||
|
papbEmptyId(papbEmptyId) {}
|
||||||
|
|
||||||
|
CCSDSIPCoreBridge::~CCSDSIPCoreBridge() {}
|
||||||
|
|
||||||
|
ReturnValue_t CCSDSIPCoreBridge::initialize() {
|
||||||
|
ReturnValue_t result = TmTcBridge::initialize();
|
||||||
|
|
||||||
|
fd = open("/dev/uio0", O_RDWR);
|
||||||
|
if (fd < 1) {
|
||||||
|
sif::debug << "CCSDSIPCoreBridge::initialize: Invalid UIO device file" << std::endl;
|
||||||
|
return RETURN_FAILED;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Map uio device in virtual address space
|
||||||
|
* PROT_WRITE: Map uio device in writable only mode
|
||||||
|
*/
|
||||||
|
ptmeBaseAddress =
|
||||||
|
static_cast<uint32_t*>(mmap(NULL, MAP_SIZE, PROT_READ | PROT_WRITE, MAP_SHARED, fd, 0));
|
||||||
|
|
||||||
|
if (ptmeBaseAddress == MAP_FAILED) {
|
||||||
|
sif::error << "CCSDSIPCoreBridge::initialize: Failed to map uio address" << std::endl;
|
||||||
|
return RETURN_FAILED;
|
||||||
|
}
|
||||||
|
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
ReturnValue_t CCSDSIPCoreBridge::handleTm() {
|
||||||
|
#if OBSW_TEST_CCSDS_PTME == 1
|
||||||
|
return sendTestFrame();
|
||||||
|
#else
|
||||||
|
return TmTcBridge::handleTm();
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
|
||||||
|
ReturnValue_t CCSDSIPCoreBridge::sendTm(const uint8_t* data, size_t dataLen) {
|
||||||
|
if (pollPapbBusySignal() == RETURN_OK) {
|
||||||
|
startPacketTransfer();
|
||||||
|
}
|
||||||
|
|
||||||
|
for (size_t idx = 0; idx < dataLen; idx++) {
|
||||||
|
if (pollPapbBusySignal() == RETURN_OK) {
|
||||||
|
*(ptmeBaseAddress + PTME_DATA_REG_OFFSET) = static_cast<uint32_t>(*(data + idx));
|
||||||
|
} else {
|
||||||
|
sif::debug << "CCSDSIPCoreBridge::sendTm: Only written " << idx - 1 << " of " << dataLen
|
||||||
|
<< " data" << std::endl;
|
||||||
|
return RETURN_FAILED;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (pollPapbBusySignal() == RETURN_OK) {
|
||||||
|
endPacketTransfer();
|
||||||
|
}
|
||||||
|
return RETURN_OK;
|
||||||
|
}
|
||||||
|
|
||||||
|
void CCSDSIPCoreBridge::startPacketTransfer() { *ptmeBaseAddress = PTME_CONFIG_START; }
|
||||||
|
|
||||||
|
void CCSDSIPCoreBridge::endPacketTransfer() { *ptmeBaseAddress = PTME_CONFIG_END; }
|
||||||
|
|
||||||
|
ReturnValue_t CCSDSIPCoreBridge::pollPapbBusySignal() {
|
||||||
|
int papbBusyState = 0;
|
||||||
|
ReturnValue_t result = RETURN_OK;
|
||||||
|
|
||||||
|
/** Check if PAPB interface is ready to receive data */
|
||||||
|
result = gpioComIF->readGpio(papbBusyId, &papbBusyState);
|
||||||
|
if (result != RETURN_OK) {
|
||||||
|
sif::debug << "CCSDSIPCoreBridge::pollPapbBusySignal: Failed to read papb busy signal"
|
||||||
|
<< std::endl;
|
||||||
|
return RETURN_FAILED;
|
||||||
|
}
|
||||||
|
if (!papbBusyState) {
|
||||||
|
sif::debug << "CCSDSIPCoreBridge::pollPapbBusySignal: PAPB busy" << std::endl;
|
||||||
|
return PAPB_BUSY;
|
||||||
|
}
|
||||||
|
|
||||||
|
return RETURN_OK;
|
||||||
|
}
|
||||||
|
|
||||||
|
void CCSDSIPCoreBridge::isPtmeBufferEmpty() {
|
||||||
|
ReturnValue_t result = RETURN_OK;
|
||||||
|
int papbEmptyState = 1;
|
||||||
|
|
||||||
|
result = gpioComIF->readGpio(papbEmptyId, &papbEmptyState);
|
||||||
|
|
||||||
|
if (result != RETURN_OK) {
|
||||||
|
sif::debug << "CCSDSIPCoreBridge::isPtmeBufferEmpty: Failed to read papb empty signal"
|
||||||
|
<< std::endl;
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (papbEmptyState == 1) {
|
||||||
|
sif::debug << "CCSDSIPCoreBridge::isPtmeBufferEmpty: Buffer is empty" << std::endl;
|
||||||
|
} else {
|
||||||
|
sif::debug << "CCSDSIPCoreBridge::isPtmeBufferEmpty: Buffer is not empty" << std::endl;
|
||||||
|
}
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
ReturnValue_t CCSDSIPCoreBridge::sendTestFrame() {
|
||||||
|
/** Size of one complete transfer frame data field amounts to 1105 bytes */
|
||||||
|
uint8_t testPacket[1105];
|
||||||
|
|
||||||
|
/** Fill one test packet */
|
||||||
|
for (int idx = 0; idx < 1105; idx++) {
|
||||||
|
testPacket[idx] = static_cast<uint8_t>(idx & 0xFF);
|
||||||
|
}
|
||||||
|
|
||||||
|
ReturnValue_t result = sendTm(testPacket, 1105);
|
||||||
|
if (result != RETURN_OK) {
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
return RETURN_OK;
|
||||||
|
}
|
129
archive/tmtc/CCSDSIPCoreBridge.h
Normal file
129
archive/tmtc/CCSDSIPCoreBridge.h
Normal file
@ -0,0 +1,129 @@
|
|||||||
|
#ifndef MISSION_OBC_CCSDSIPCOREBRIDGE_H_
|
||||||
|
#define MISSION_OBC_CCSDSIPCOREBRIDGE_H_
|
||||||
|
|
||||||
|
#include <fsfw/tmtcservices/TmTcBridge.h>
|
||||||
|
#include <fsfw_hal/common/gpio/gpioDefinitions.h>
|
||||||
|
#include <fsfw_hal/linux/gpio/LinuxLibgpioIF.h>
|
||||||
|
|
||||||
|
#include <cstring>
|
||||||
|
|
||||||
|
#include "OBSWConfig.h"
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief This class handles the interfacing to the telemetry (PTME) and telecommand (PDEC) IP
|
||||||
|
* cores responsible for the CCSDS encoding and decoding. The IP cores are implemented
|
||||||
|
* on the programmable logic and are accessible through the linux UIO driver.
|
||||||
|
*/
|
||||||
|
class CCSDSIPCoreBridge : public TmTcBridge {
|
||||||
|
public:
|
||||||
|
/**
|
||||||
|
* @brief Constructor
|
||||||
|
*
|
||||||
|
* @param objectId
|
||||||
|
* @param tcDestination
|
||||||
|
* @param tmStoreId
|
||||||
|
* @param tcStoreId
|
||||||
|
* @param uioPtme Name of the uio device file which provides access to the PTME IP Core.
|
||||||
|
* @param papbBusyId The ID of the GPIO which is connected to the PAPBBusy_N signal of the
|
||||||
|
* PTME IP Core. A low logic level indicates the PTME is not ready to
|
||||||
|
* receive more data.
|
||||||
|
* @param papbEmptyId The ID of the GPIO which is connected to the PAPBEmpty signal of the
|
||||||
|
* PTME IP Core. The signal is high when there are no packets in the
|
||||||
|
* external buffer memory (BRAM).
|
||||||
|
*/
|
||||||
|
CCSDSIPCoreBridge(object_id_t objectId, object_id_t tcDestination, object_id_t tmStoreId,
|
||||||
|
object_id_t tcStoreId, LinuxLibgpioIF* gpioComIF, std::string uioPtme,
|
||||||
|
gpioId_t papbBusyId, gpioId_t papbEmptyId);
|
||||||
|
virtual ~CCSDSIPCoreBridge();
|
||||||
|
|
||||||
|
ReturnValue_t initialize() override;
|
||||||
|
|
||||||
|
protected:
|
||||||
|
/**
|
||||||
|
* Overwriting this function to provide the capability of testing the PTME IP Core
|
||||||
|
* implementation.
|
||||||
|
*/
|
||||||
|
virtual ReturnValue_t handleTm() override;
|
||||||
|
|
||||||
|
virtual ReturnValue_t sendTm(const uint8_t* data, size_t dataLen) override;
|
||||||
|
|
||||||
|
private:
|
||||||
|
static const uint8_t INTERFACE_ID = CLASS_ID::CCSDS_IP_CORE_BRIDGE;
|
||||||
|
|
||||||
|
static const ReturnValue_t PAPB_BUSY = MAKE_RETURN_CODE(0xA0);
|
||||||
|
|
||||||
|
/** Size of mapped address space. 4k (minimal size of pl device) */
|
||||||
|
// static const int MAP_SIZE = 0xFA0;
|
||||||
|
static const int MAP_SIZE = 0x1000;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Configuration bits:
|
||||||
|
* bit[1:0]: Size of data (1,2,3 or 4 bytes). 1 Byte <=> b00
|
||||||
|
* bit[2]: Set this bit to 1 to abort a transfered packet
|
||||||
|
* bit[3]: Signals to PTME the start of a new telemetry packet
|
||||||
|
*/
|
||||||
|
static const uint32_t PTME_CONFIG_START = 0x8;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Writing this word to the ptme base address signals to the PTME that a complete tm packet has
|
||||||
|
* been transferred.
|
||||||
|
*/
|
||||||
|
static const uint32_t PTME_CONFIG_END = 0x0;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Writing to this offset within the PTME memory space will insert data for encoding to the
|
||||||
|
* PTME IP core.
|
||||||
|
* The address offset is 0x400 (= 4 * 256)
|
||||||
|
*/
|
||||||
|
static const int PTME_DATA_REG_OFFSET = 256;
|
||||||
|
|
||||||
|
LinuxLibgpioIF* gpioComIF = nullptr;
|
||||||
|
|
||||||
|
/** The uio device file related to the PTME IP Core */
|
||||||
|
std::string uioPtme;
|
||||||
|
|
||||||
|
/** Pulled to low when PTME not ready to receive data */
|
||||||
|
gpioId_t papbBusyId = gpio::NO_GPIO;
|
||||||
|
|
||||||
|
/** High when externally buffer memory of PTME is empty */
|
||||||
|
gpioId_t papbEmptyId = gpio::NO_GPIO;
|
||||||
|
|
||||||
|
/** The file descriptor of the UIO driver */
|
||||||
|
int fd;
|
||||||
|
|
||||||
|
uint32_t* ptmeBaseAddress = nullptr;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief This function sends the config byte to the PTME IP Core to initiate a packet
|
||||||
|
* transfer.
|
||||||
|
*/
|
||||||
|
void startPacketTransfer();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief This function sends the config byte to the PTME IP Core to signal the end of a
|
||||||
|
* packet transfer.
|
||||||
|
*/
|
||||||
|
void endPacketTransfer();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief This function reads the papb busy signal indicating whether the PAPB interface is
|
||||||
|
* ready to receive more data or not. PAPB is ready when PAPB_Busy_N == '1'.
|
||||||
|
*
|
||||||
|
* @return RETURN_OK when ready to receive data else PAPB_BUSY.
|
||||||
|
*/
|
||||||
|
ReturnValue_t pollPapbBusySignal();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief This function can be used for debugging to check wheter there are packets in
|
||||||
|
* the packet buffer of the PTME or not.
|
||||||
|
*/
|
||||||
|
void isPtmeBufferEmpty();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief This function sends a complete telemetry transfer frame data field (1105 bytes)
|
||||||
|
* to the input of the PTME IP Core. Can be used to test the implementation.
|
||||||
|
*/
|
||||||
|
ReturnValue_t sendTestFrame();
|
||||||
|
};
|
||||||
|
|
||||||
|
#endif /* MISSION_OBC_CCSDSIPCOREBRIDGE_H_ */
|
@ -2,7 +2,9 @@ FROM ubuntu:focal
|
|||||||
|
|
||||||
RUN apt-get update
|
RUN apt-get update
|
||||||
RUN apt-get --yes upgrade
|
RUN apt-get --yes upgrade
|
||||||
RUN apt-get --yes install cmake libgpiod-dev xz-utils nano curl
|
#tzdata is a dependency, won't install otherwise
|
||||||
|
ARG DEBIAN_FRONTEND=noninteractive
|
||||||
|
RUN apt-get --yes install cmake libgpiod-dev xz-utils nano curl git gcc g++ lcov valgrind libgps-dev
|
||||||
|
|
||||||
# Q7S root filesystem, required for cross-compilation.
|
# Q7S root filesystem, required for cross-compilation.
|
||||||
RUN mkdir -p /usr/rootfs; \
|
RUN mkdir -p /usr/rootfs; \
|
||||||
@ -14,6 +16,5 @@ RUN mkdir -p /usr/tools; \
|
|||||||
curl https://buggy.irs.uni-stuttgart.de/eive/tools/gcc-arm-8.3-2019.03-x86_64-arm-linux-gnueabihf.tar.gz \
|
curl https://buggy.irs.uni-stuttgart.de/eive/tools/gcc-arm-8.3-2019.03-x86_64-arm-linux-gnueabihf.tar.gz \
|
||||||
| tar -xz -C /usr/tools
|
| tar -xz -C /usr/tools
|
||||||
|
|
||||||
|
ENV ZYNQ_7020_SYSROOT="/usr/rootfs/cortexa9hf-neon-xiphos-linux-gnueabi"
|
||||||
ENV Q7S_SYSROOT="/usr/rootfs/cortexa9hf-neon-xiphos-linux-gnueabi"
|
|
||||||
ENV PATH=$PATH:"/usr/tools/gcc-arm-8.3-2019.03-x86_64-arm-linux-gnueabihf/bin"
|
ENV PATH=$PATH:"/usr/tools/gcc-arm-8.3-2019.03-x86_64-arm-linux-gnueabihf/bin"
|
54
automation/Jenkinsfile
vendored
54
automation/Jenkinsfile
vendored
@ -1,48 +1,36 @@
|
|||||||
pipeline {
|
pipeline {
|
||||||
agent any
|
environment {
|
||||||
|
BUILDDIR_Q7 = 'build_q7'
|
||||||
|
BUILDDIR_LINUX = 'build_linux'
|
||||||
|
}
|
||||||
|
agent {
|
||||||
|
docker {
|
||||||
|
image 'eive-obsw-ci:d3'
|
||||||
|
args '--sysctl fs.mqueue.msg_max=100'
|
||||||
|
}
|
||||||
|
}
|
||||||
stages {
|
stages {
|
||||||
stage('Build Container') {
|
|
||||||
when {
|
|
||||||
changeset "automation/Dockerfile-q7s"
|
|
||||||
branch 'develop'
|
|
||||||
}
|
|
||||||
steps {
|
|
||||||
sh 'docker build -t eive-fsw-build-q7s:gcc8 - < automation/Dockerfile-q7s'
|
|
||||||
|
|
||||||
}
|
|
||||||
}
|
|
||||||
stage('Clean') {
|
stage('Clean') {
|
||||||
when {
|
|
||||||
anyOf {
|
|
||||||
changelog 'cleanCI'
|
|
||||||
changeset '*.cmake'
|
|
||||||
changeset 'CMakeLists.txt'
|
|
||||||
}
|
|
||||||
}
|
|
||||||
steps {
|
steps {
|
||||||
sh 'rm -rf build-q7s-debug'
|
sh 'rm -rf $BUILDDIR_Q7'
|
||||||
|
sh 'rm -rf $BUILDDIR_LINUX'
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
stage('Build Q7S') {
|
stage('Build Q7S') {
|
||||||
agent {
|
|
||||||
docker {
|
|
||||||
image 'eive-fsw-build-q7s:gcc8'
|
|
||||||
reuseNode true
|
|
||||||
}
|
|
||||||
}
|
|
||||||
steps {
|
steps {
|
||||||
dir('build-q7s-debug') {
|
dir(BUILDDIR_Q7) {
|
||||||
sh 'cmake -DTGT_BSP="arm/q7s" -DCMAKE_BUILD_TYPE=Debug -DFSFW_OSAL=linux ..'
|
sh 'cmake -DTGT_BSP="arm/q7s" -DCMAKE_BUILD_TYPE=Debug ..'
|
||||||
sh 'cmake --build . -j'
|
sh 'cmake --build . -j4'
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
stage('Deploy') {
|
stage('Unittests') {
|
||||||
when {
|
|
||||||
tag 'v*.*.*'
|
|
||||||
}
|
|
||||||
steps {
|
steps {
|
||||||
sh 'echo Deploying'
|
dir(BUILDDIR_LINUX) {
|
||||||
|
sh 'cmake ..'
|
||||||
|
sh 'cmake --build . -t eive-unittest -j4'
|
||||||
|
sh './eive-unittest'
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
7
bsp_egse/CMakeLists.txt
Normal file
7
bsp_egse/CMakeLists.txt
Normal file
@ -0,0 +1,7 @@
|
|||||||
|
target_sources(${OBSW_NAME} PUBLIC
|
||||||
|
InitMission.cpp
|
||||||
|
main.cpp
|
||||||
|
ObjectFactory.cpp
|
||||||
|
)
|
||||||
|
|
||||||
|
add_subdirectory(boardconfig)
|
192
bsp_egse/InitMission.cpp
Normal file
192
bsp_egse/InitMission.cpp
Normal file
@ -0,0 +1,192 @@
|
|||||||
|
#include "InitMission.h"
|
||||||
|
|
||||||
|
#include <fsfw/objectmanager/ObjectManager.h>
|
||||||
|
#include <fsfw/objectmanager/ObjectManagerIF.h>
|
||||||
|
#include <fsfw/returnvalues/HasReturnvaluesIF.h>
|
||||||
|
#include <fsfw/serviceinterface/ServiceInterface.h>
|
||||||
|
#include <fsfw/tasks/FixedTimeslotTaskIF.h>
|
||||||
|
#include <fsfw/tasks/PeriodicTaskIF.h>
|
||||||
|
#include <fsfw/tasks/TaskFactory.h>
|
||||||
|
#include <mission/utility/InitMission.h>
|
||||||
|
|
||||||
|
#include <iostream>
|
||||||
|
|
||||||
|
#include "OBSWConfig.h"
|
||||||
|
#include "ObjectFactory.h"
|
||||||
|
#include "objects/systemObjectList.h"
|
||||||
|
#include "pollingsequence/pollingSequenceFactory.h"
|
||||||
|
|
||||||
|
ServiceInterfaceStream sif::debug("DEBUG");
|
||||||
|
ServiceInterfaceStream sif::info("INFO");
|
||||||
|
ServiceInterfaceStream sif::warning("WARNING");
|
||||||
|
ServiceInterfaceStream sif::error("ERROR");
|
||||||
|
|
||||||
|
ObjectManagerIF* objectManager = nullptr;
|
||||||
|
|
||||||
|
void initmission::initMission() {
|
||||||
|
sif::info << "Make sure the systemd service ser2net on the egse has been stopped "
|
||||||
|
<< "(alias stop-ser2net)" << std::endl;
|
||||||
|
sif::info << "Make sure the power lines of the star tracker have been enabled "
|
||||||
|
<< "(alias enable-startracker)" << std::endl;
|
||||||
|
sif::info << "Building global objects.." << std::endl;
|
||||||
|
/* Instantiate global object manager and also create all objects */
|
||||||
|
ObjectManager::instance()->setObjectFactoryFunction(ObjectFactory::produce, nullptr);
|
||||||
|
sif::info << "Initializing all objects.." << std::endl;
|
||||||
|
ObjectManager::instance()->initialize();
|
||||||
|
|
||||||
|
/* This function creates and starts all tasks */
|
||||||
|
initTasks();
|
||||||
|
}
|
||||||
|
|
||||||
|
void initmission::initTasks() {
|
||||||
|
TaskFactory* factory = TaskFactory::instance();
|
||||||
|
ReturnValue_t result = HasReturnvaluesIF::RETURN_OK;
|
||||||
|
if (factory == nullptr) {
|
||||||
|
/* Should never happen ! */
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
#if OBSW_PRINT_MISSED_DEADLINES == 1
|
||||||
|
void (*missedDeadlineFunc)(void) = TaskFactory::printMissedDeadline;
|
||||||
|
#else
|
||||||
|
void (*missedDeadlineFunc)(void) = nullptr;
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/* TMTC Distribution */
|
||||||
|
PeriodicTaskIF* tmtcDistributor = factory->createPeriodicTask(
|
||||||
|
"DIST", 40, PeriodicTaskIF::MINIMUM_STACK_SIZE, 0.2, missedDeadlineFunc);
|
||||||
|
result = tmtcDistributor->addComponent(objects::CCSDS_PACKET_DISTRIBUTOR);
|
||||||
|
if (result != HasReturnvaluesIF::RETURN_OK) {
|
||||||
|
sif::error << "Object add component failed" << std::endl;
|
||||||
|
}
|
||||||
|
result = tmtcDistributor->addComponent(objects::PUS_PACKET_DISTRIBUTOR);
|
||||||
|
if (result != HasReturnvaluesIF::RETURN_OK) {
|
||||||
|
sif::error << "Object add component failed" << std::endl;
|
||||||
|
}
|
||||||
|
result = tmtcDistributor->addComponent(objects::TM_FUNNEL);
|
||||||
|
if (result != HasReturnvaluesIF::RETURN_OK) {
|
||||||
|
sif::error << "Object add component failed" << std::endl;
|
||||||
|
}
|
||||||
|
|
||||||
|
PeriodicTaskIF* tmtcBridgeTask = factory->createPeriodicTask(
|
||||||
|
"TMTC_BRIDGE", 50, PeriodicTaskIF::MINIMUM_STACK_SIZE, 0.2, missedDeadlineFunc);
|
||||||
|
result = tmtcBridgeTask->addComponent(objects::TMTC_BRIDGE);
|
||||||
|
if (result != HasReturnvaluesIF::RETURN_OK) {
|
||||||
|
sif::error << "Add component TMTC Bridge failed" << std::endl;
|
||||||
|
}
|
||||||
|
PeriodicTaskIF* tmtcPollingTask = factory->createPeriodicTask(
|
||||||
|
"TMTC_POLLING", 80, PeriodicTaskIF::MINIMUM_STACK_SIZE, 2.0, missedDeadlineFunc);
|
||||||
|
result = tmtcPollingTask->addComponent(objects::TMTC_POLLING_TASK);
|
||||||
|
if (result != HasReturnvaluesIF::RETURN_OK) {
|
||||||
|
sif::error << "Add component TMTC Polling failed" << std::endl;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* PUS Services */
|
||||||
|
std::vector<PeriodicTaskIF*> pusTasks;
|
||||||
|
createPusTasks(*factory, missedDeadlineFunc, pusTasks);
|
||||||
|
|
||||||
|
std::vector<PeriodicTaskIF*> pstTasks;
|
||||||
|
FixedTimeslotTaskIF* pst = factory->createFixedTimeslotTask(
|
||||||
|
"STAR_TRACKER_PST", 70, PeriodicTaskIF::MINIMUM_STACK_SIZE * 4, 0.5, missedDeadlineFunc);
|
||||||
|
result = pst::pstUart(pst);
|
||||||
|
if (result != HasReturnvaluesIF::RETURN_OK) {
|
||||||
|
sif::error << "InitMission::initTasks: Creating PST failed!" << std::endl;
|
||||||
|
}
|
||||||
|
pstTasks.push_back(pst);
|
||||||
|
|
||||||
|
PeriodicTaskIF* strHelperTask = factory->createPeriodicTask(
|
||||||
|
"STR_HELPER", 20, PeriodicTaskIF::MINIMUM_STACK_SIZE, 0.2, missedDeadlineFunc);
|
||||||
|
result = strHelperTask->addComponent(objects::STR_HELPER);
|
||||||
|
if (result != HasReturnvaluesIF::RETURN_OK) {
|
||||||
|
initmission::printAddObjectError("STR_HELPER", objects::STR_HELPER);
|
||||||
|
}
|
||||||
|
pstTasks.push_back(strHelperTask);
|
||||||
|
|
||||||
|
auto taskStarter = [](std::vector<PeriodicTaskIF*>& taskVector, std::string name) {
|
||||||
|
for (const auto& task : taskVector) {
|
||||||
|
if (task != nullptr) {
|
||||||
|
task->startTask();
|
||||||
|
} else {
|
||||||
|
sif::error << "Task in vector " << name << " is invalid!" << std::endl;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
sif::info << "Starting tasks.." << std::endl;
|
||||||
|
tmtcDistributor->startTask();
|
||||||
|
tmtcBridgeTask->startTask();
|
||||||
|
tmtcPollingTask->startTask();
|
||||||
|
|
||||||
|
taskStarter(pstTasks, "PST Tasks");
|
||||||
|
taskStarter(pusTasks, "PUS Tasks");
|
||||||
|
|
||||||
|
sif::info << "Tasks started.." << std::endl;
|
||||||
|
}
|
||||||
|
|
||||||
|
void initmission::createPusTasks(TaskFactory& factory,
|
||||||
|
TaskDeadlineMissedFunction missedDeadlineFunc,
|
||||||
|
std::vector<PeriodicTaskIF*>& taskVec) {
|
||||||
|
ReturnValue_t result = HasReturnvaluesIF::RETURN_OK;
|
||||||
|
PeriodicTaskIF* pusVerification = factory.createPeriodicTask(
|
||||||
|
"PUS_VERIF", 40, PeriodicTaskIF::MINIMUM_STACK_SIZE, 0.200, missedDeadlineFunc);
|
||||||
|
result = pusVerification->addComponent(objects::PUS_SERVICE_1_VERIFICATION);
|
||||||
|
if (result != HasReturnvaluesIF::RETURN_OK) {
|
||||||
|
sif::error << "Object add component failed" << std::endl;
|
||||||
|
}
|
||||||
|
taskVec.push_back(pusVerification);
|
||||||
|
|
||||||
|
PeriodicTaskIF* pusEvents = factory.createPeriodicTask(
|
||||||
|
"PUS_EVENTS", 60, PeriodicTaskIF::MINIMUM_STACK_SIZE, 0.200, missedDeadlineFunc);
|
||||||
|
result = pusEvents->addComponent(objects::PUS_SERVICE_5_EVENT_REPORTING);
|
||||||
|
if (result != HasReturnvaluesIF::RETURN_OK) {
|
||||||
|
initmission::printAddObjectError("PUS_EVENTS", objects::PUS_SERVICE_5_EVENT_REPORTING);
|
||||||
|
}
|
||||||
|
result = pusEvents->addComponent(objects::EVENT_MANAGER);
|
||||||
|
if (result != HasReturnvaluesIF::RETURN_OK) {
|
||||||
|
initmission::printAddObjectError("PUS_MGMT", objects::EVENT_MANAGER);
|
||||||
|
}
|
||||||
|
taskVec.push_back(pusEvents);
|
||||||
|
|
||||||
|
PeriodicTaskIF* pusHighPrio = factory.createPeriodicTask(
|
||||||
|
"PUS_HIGH_PRIO", 50, PeriodicTaskIF::MINIMUM_STACK_SIZE, 0.200, missedDeadlineFunc);
|
||||||
|
result = pusHighPrio->addComponent(objects::PUS_SERVICE_2_DEVICE_ACCESS);
|
||||||
|
if (result != HasReturnvaluesIF::RETURN_OK) {
|
||||||
|
initmission::printAddObjectError("PUS2", objects::PUS_SERVICE_2_DEVICE_ACCESS);
|
||||||
|
}
|
||||||
|
result = pusHighPrio->addComponent(objects::PUS_SERVICE_9_TIME_MGMT);
|
||||||
|
if (result != HasReturnvaluesIF::RETURN_OK) {
|
||||||
|
initmission::printAddObjectError("PUS9", objects::PUS_SERVICE_9_TIME_MGMT);
|
||||||
|
}
|
||||||
|
taskVec.push_back(pusHighPrio);
|
||||||
|
|
||||||
|
PeriodicTaskIF* pusMedPrio = factory.createPeriodicTask(
|
||||||
|
"PUS_MED_PRIO", 40, PeriodicTaskIF::MINIMUM_STACK_SIZE, 0.8, missedDeadlineFunc);
|
||||||
|
result = pusMedPrio->addComponent(objects::PUS_SERVICE_8_FUNCTION_MGMT);
|
||||||
|
if (result != HasReturnvaluesIF::RETURN_OK) {
|
||||||
|
initmission::printAddObjectError("PUS8", objects::PUS_SERVICE_8_FUNCTION_MGMT);
|
||||||
|
}
|
||||||
|
result = pusMedPrio->addComponent(objects::PUS_SERVICE_200_MODE_MGMT);
|
||||||
|
if (result != HasReturnvaluesIF::RETURN_OK) {
|
||||||
|
initmission::printAddObjectError("PUS200", objects::PUS_SERVICE_200_MODE_MGMT);
|
||||||
|
}
|
||||||
|
result = pusMedPrio->addComponent(objects::PUS_SERVICE_20_PARAMETERS);
|
||||||
|
if (result != HasReturnvaluesIF::RETURN_OK) {
|
||||||
|
initmission::printAddObjectError("PUS20", objects::PUS_SERVICE_20_PARAMETERS);
|
||||||
|
}
|
||||||
|
result = pusMedPrio->addComponent(objects::PUS_SERVICE_3_HOUSEKEEPING);
|
||||||
|
if (result != HasReturnvaluesIF::RETURN_OK) {
|
||||||
|
initmission::printAddObjectError("PUS3", objects::PUS_SERVICE_3_HOUSEKEEPING);
|
||||||
|
}
|
||||||
|
taskVec.push_back(pusMedPrio);
|
||||||
|
|
||||||
|
PeriodicTaskIF* pusLowPrio = factory.createPeriodicTask(
|
||||||
|
"PUS_LOW_PRIO", 30, PeriodicTaskIF::MINIMUM_STACK_SIZE, 1.6, missedDeadlineFunc);
|
||||||
|
result = pusLowPrio->addComponent(objects::PUS_SERVICE_17_TEST);
|
||||||
|
if (result != HasReturnvaluesIF::RETURN_OK) {
|
||||||
|
initmission::printAddObjectError("PUS17", objects::PUS_SERVICE_17_TEST);
|
||||||
|
}
|
||||||
|
result = pusLowPrio->addComponent(objects::INTERNAL_ERROR_REPORTER);
|
||||||
|
if (result != HasReturnvaluesIF::RETURN_OK) {
|
||||||
|
initmission::printAddObjectError("INT_ERR_RPRT", objects::INTERNAL_ERROR_REPORTER);
|
||||||
|
}
|
||||||
|
taskVec.push_back(pusLowPrio);
|
||||||
|
}
|
21
bsp_egse/InitMission.h
Normal file
21
bsp_egse/InitMission.h
Normal file
@ -0,0 +1,21 @@
|
|||||||
|
#ifndef BSP_LINUX_INITMISSION_H_
|
||||||
|
#define BSP_LINUX_INITMISSION_H_
|
||||||
|
|
||||||
|
#include <vector>
|
||||||
|
|
||||||
|
#include "fsfw/tasks/Typedef.h"
|
||||||
|
|
||||||
|
class PeriodicTaskIF;
|
||||||
|
class TaskFactory;
|
||||||
|
|
||||||
|
namespace initmission {
|
||||||
|
void initMission();
|
||||||
|
void initTasks();
|
||||||
|
|
||||||
|
void createPstTasks(TaskFactory& factory, TaskDeadlineMissedFunction missedDeadlineFunc,
|
||||||
|
std::vector<PeriodicTaskIF*>& taskVec);
|
||||||
|
void createPusTasks(TaskFactory& factory, TaskDeadlineMissedFunction missedDeadlineFunc,
|
||||||
|
std::vector<PeriodicTaskIF*>& taskVec);
|
||||||
|
}; // namespace initmission
|
||||||
|
|
||||||
|
#endif /* BSP_LINUX_INITMISSION_H_ */
|
48
bsp_egse/ObjectFactory.cpp
Normal file
48
bsp_egse/ObjectFactory.cpp
Normal file
@ -0,0 +1,48 @@
|
|||||||
|
#include "ObjectFactory.h"
|
||||||
|
|
||||||
|
#include <devConf.h>
|
||||||
|
#include <fsfw_hal/linux/uart/UartComIF.h>
|
||||||
|
#include <fsfw_hal/linux/uart/UartCookie.h>
|
||||||
|
|
||||||
|
#include "OBSWConfig.h"
|
||||||
|
#include "busConf.h"
|
||||||
|
#include "fsfw/datapoollocal/LocalDataPoolManager.h"
|
||||||
|
#include "fsfw/tmtcpacket/pus/tm.h"
|
||||||
|
#include "fsfw/tmtcservices/CommandingServiceBase.h"
|
||||||
|
#include "fsfw/tmtcservices/PusServiceBase.h"
|
||||||
|
#include "linux/devices/devicedefinitions/StarTrackerDefinitions.h"
|
||||||
|
#include "linux/devices/startracker/StarTrackerHandler.h"
|
||||||
|
#include "mission/core/GenericFactory.h"
|
||||||
|
#include "mission/utility/TmFunnel.h"
|
||||||
|
#include "objects/systemObjectList.h"
|
||||||
|
#include "tmtc/apid.h"
|
||||||
|
#include "tmtc/pusIds.h"
|
||||||
|
|
||||||
|
void Factory::setStaticFrameworkObjectIds() {
|
||||||
|
PusServiceBase::packetSource = objects::PUS_PACKET_DISTRIBUTOR;
|
||||||
|
PusServiceBase::packetDestination = objects::TM_FUNNEL;
|
||||||
|
|
||||||
|
CommandingServiceBase::defaultPacketSource = objects::PUS_PACKET_DISTRIBUTOR;
|
||||||
|
CommandingServiceBase::defaultPacketDestination = objects::TM_FUNNEL;
|
||||||
|
|
||||||
|
TmFunnel::downlinkDestination = objects::TMTC_BRIDGE;
|
||||||
|
TmFunnel::storageDestination = objects::NO_OBJECT;
|
||||||
|
|
||||||
|
VerificationReporter::messageReceiver = objects::PUS_SERVICE_1_VERIFICATION;
|
||||||
|
TmPacketBase::timeStamperId = objects::TIME_STAMPER;
|
||||||
|
}
|
||||||
|
|
||||||
|
void ObjectFactory::produce(void* args) {
|
||||||
|
Factory::setStaticFrameworkObjectIds();
|
||||||
|
ObjectFactory::produceGenericObjects();
|
||||||
|
|
||||||
|
UartCookie* starTrackerCookie =
|
||||||
|
new UartCookie(objects::STAR_TRACKER, egse::STAR_TRACKER_UART, UartModes::NON_CANONICAL,
|
||||||
|
uart::STAR_TRACKER_BAUD, startracker::MAX_FRAME_SIZE * 2 + 2);
|
||||||
|
new UartComIF(objects::UART_COM_IF);
|
||||||
|
starTrackerCookie->setNoFixedSizeReply();
|
||||||
|
StrHelper* strHelper = new StrHelper(objects::STR_HELPER);
|
||||||
|
StarTrackerHandler* starTrackerHandler = new StarTrackerHandler(
|
||||||
|
objects::STAR_TRACKER, objects::UART_COM_IF, starTrackerCookie, strHelper);
|
||||||
|
starTrackerHandler->setStartUpImmediately();
|
||||||
|
}
|
8
bsp_egse/ObjectFactory.h
Normal file
8
bsp_egse/ObjectFactory.h
Normal file
@ -0,0 +1,8 @@
|
|||||||
|
#ifndef BSP_LINUX_OBJECTFACTORY_H_
|
||||||
|
#define BSP_LINUX_OBJECTFACTORY_H_
|
||||||
|
|
||||||
|
namespace ObjectFactory {
|
||||||
|
void produce(void* args);
|
||||||
|
}; // namespace ObjectFactory
|
||||||
|
|
||||||
|
#endif /* BSP_LINUX_OBJECTFACTORY_H_ */
|
7
bsp_egse/boardconfig/CMakeLists.txt
Normal file
7
bsp_egse/boardconfig/CMakeLists.txt
Normal file
@ -0,0 +1,7 @@
|
|||||||
|
target_sources(${OBSW_NAME} PRIVATE
|
||||||
|
print.c
|
||||||
|
)
|
||||||
|
|
||||||
|
target_include_directories(${OBSW_NAME} PUBLIC
|
||||||
|
${CMAKE_CURRENT_SOURCE_DIR}
|
||||||
|
)
|
8
bsp_egse/boardconfig/busConf.h
Normal file
8
bsp_egse/boardconfig/busConf.h
Normal file
@ -0,0 +1,8 @@
|
|||||||
|
#ifndef BSP_EGSE_BOARDCONFIG_BUSCONF_H_
|
||||||
|
#define BSP_EGSE_BOARDCONFIG_BUSCONF_H_
|
||||||
|
|
||||||
|
namespace egse {
|
||||||
|
static constexpr char STAR_TRACKER_UART[] = "/dev/serial0";
|
||||||
|
}
|
||||||
|
|
||||||
|
#endif /* BSP_EGSE_BOARDCONFIG_BUSCONF_H_ */
|
38
bsp_egse/boardconfig/etl_profile.h
Normal file
38
bsp_egse/boardconfig/etl_profile.h
Normal file
@ -0,0 +1,38 @@
|
|||||||
|
///\file
|
||||||
|
|
||||||
|
/******************************************************************************
|
||||||
|
The MIT License(MIT)
|
||||||
|
|
||||||
|
Embedded Template Library.
|
||||||
|
https://github.com/ETLCPP/etl
|
||||||
|
https://www.etlcpp.com
|
||||||
|
|
||||||
|
Copyright(c) 2019 jwellbelove
|
||||||
|
|
||||||
|
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||||
|
of this software and associated documentation files(the "Software"), to deal
|
||||||
|
in the Software without restriction, including without limitation the rights
|
||||||
|
to use, copy, modify, merge, publish, distribute, sublicense, and / or sell
|
||||||
|
copies of the Software, and to permit persons to whom the Software is
|
||||||
|
furnished to do so, subject to the following conditions :
|
||||||
|
|
||||||
|
The above copyright notice and this permission notice shall be included in all
|
||||||
|
copies or substantial portions of the Software.
|
||||||
|
|
||||||
|
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||||
|
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||||
|
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.IN NO EVENT SHALL THE
|
||||||
|
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||||
|
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||||
|
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||||
|
SOFTWARE.
|
||||||
|
******************************************************************************/
|
||||||
|
#ifndef __ETL_PROFILE_H__
|
||||||
|
#define __ETL_PROFILE_H__
|
||||||
|
|
||||||
|
#define ETL_CHECK_PUSH_POP
|
||||||
|
|
||||||
|
#define ETL_CPP11_SUPPORTED 1
|
||||||
|
#define ETL_NO_NULLPTR_SUPPORT 0
|
||||||
|
|
||||||
|
#endif
|
15
bsp_egse/boardconfig/gcov.h
Normal file
15
bsp_egse/boardconfig/gcov.h
Normal file
@ -0,0 +1,15 @@
|
|||||||
|
#ifndef LINUX_GCOV_H_
|
||||||
|
#define LINUX_GCOV_H_
|
||||||
|
#include <fsfw/serviceinterface/ServiceInterfaceStream.h>
|
||||||
|
|
||||||
|
#ifdef GCOV
|
||||||
|
extern "C" void __gcov_flush();
|
||||||
|
#else
|
||||||
|
void __gcov_flush() {
|
||||||
|
sif::info << "GCC GCOV: Please supply GCOV=1 in Makefile if "
|
||||||
|
"coverage information is desired.\n"
|
||||||
|
<< std::flush;
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#endif /* LINUX_GCOV_H_ */
|
10
bsp_egse/boardconfig/print.c
Normal file
10
bsp_egse/boardconfig/print.c
Normal file
@ -0,0 +1,10 @@
|
|||||||
|
#include <bsp_egse/boardconfig/print.h>
|
||||||
|
#include <stdio.h>
|
||||||
|
|
||||||
|
void printChar(const char* character, bool errStream) {
|
||||||
|
if (errStream) {
|
||||||
|
putc(*character, stderr);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
putc(*character, stdout);
|
||||||
|
}
|
8
bsp_egse/boardconfig/print.h
Normal file
8
bsp_egse/boardconfig/print.h
Normal file
@ -0,0 +1,8 @@
|
|||||||
|
#ifndef HOSTED_BOARDCONFIG_PRINT_H_
|
||||||
|
#define HOSTED_BOARDCONFIG_PRINT_H_
|
||||||
|
|
||||||
|
#include <stdbool.h>
|
||||||
|
|
||||||
|
void printChar(const char* character, bool errStream);
|
||||||
|
|
||||||
|
#endif /* HOSTED_BOARDCONFIG_PRINT_H_ */
|
6
bsp_egse/boardconfig/rpiConfig.h.in
Normal file
6
bsp_egse/boardconfig/rpiConfig.h.in
Normal file
@ -0,0 +1,6 @@
|
|||||||
|
#ifndef BSP_RPI_BOARDCONFIG_RPI_CONFIG_H_
|
||||||
|
#define BSP_RPI_BOARDCONFIG_RPI_CONFIG_H_
|
||||||
|
|
||||||
|
#include <cstdint>
|
||||||
|
|
||||||
|
#endif /* BSP_RPI_BOARDCONFIG_RPI_CONFIG_H_ */
|
28
bsp_egse/main.cpp
Normal file
28
bsp_egse/main.cpp
Normal file
@ -0,0 +1,28 @@
|
|||||||
|
#include <iostream>
|
||||||
|
|
||||||
|
#include "InitMission.h"
|
||||||
|
#include "OBSWConfig.h"
|
||||||
|
#include "OBSWVersion.h"
|
||||||
|
#include "fsfw/tasks/TaskFactory.h"
|
||||||
|
#include "fsfw/version.h"
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief This is the main program entry point for the egse (raspberry pi 4)
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
int main(void) {
|
||||||
|
std::cout << "-- EIVE OBSW --" << std::endl;
|
||||||
|
std::cout << "-- Compiled for EGSE from Arcsec"
|
||||||
|
<< " --" << std::endl;
|
||||||
|
std::cout << "-- OBSW " << SW_NAME << " v" << SW_VERSION << "." << SW_SUBVERSION << "."
|
||||||
|
<< SW_REVISION << ", FSFW v" << FSFW_VERSION << "." << FSFW_SUBVERSION << FSFW_REVISION
|
||||||
|
<< "--" << std::endl;
|
||||||
|
std::cout << "-- " << __DATE__ << " " << __TIME__ << " --" << std::endl;
|
||||||
|
|
||||||
|
initmission::initMission();
|
||||||
|
|
||||||
|
for (;;) {
|
||||||
|
/* Suspend main thread by sleeping it. */
|
||||||
|
TaskFactory::delayTask(5000);
|
||||||
|
}
|
||||||
|
}
|
@ -1,4 +1,4 @@
|
|||||||
target_sources(${TARGET_NAME} PUBLIC
|
target_sources(${OBSW_NAME} PUBLIC
|
||||||
InitMission.cpp
|
InitMission.cpp
|
||||||
main.cpp
|
main.cpp
|
||||||
ObjectFactory.cpp
|
ObjectFactory.cpp
|
||||||
|
@ -1,20 +1,19 @@
|
|||||||
#include "InitMission.h"
|
#include "InitMission.h"
|
||||||
#include "ObjectFactory.h"
|
|
||||||
|
|
||||||
#include <OBSWConfig.h>
|
#include <OBSWConfig.h>
|
||||||
|
#include <fsfw/objectmanager/ObjectManager.h>
|
||||||
#include <fsfw/objectmanager/ObjectManagerIF.h>
|
#include <fsfw/objectmanager/ObjectManagerIF.h>
|
||||||
#include <fsfw/returnvalues/HasReturnvaluesIF.h>
|
#include <fsfw/returnvalues/HasReturnvaluesIF.h>
|
||||||
#include <fsfw/serviceinterface/ServiceInterfaceStream.h>
|
#include <fsfw/serviceinterface/ServiceInterfaceStream.h>
|
||||||
#include <fsfw/objectmanager/ObjectManager.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 <mission/utility/InitMission.h>
|
#include <mission/utility/InitMission.h>
|
||||||
|
|
||||||
#include <iostream>
|
#include <iostream>
|
||||||
|
|
||||||
|
#include "ObjectFactory.h"
|
||||||
|
|
||||||
#ifdef LINUX
|
#ifdef LINUX
|
||||||
ServiceInterfaceStream sif::debug("DEBUG");
|
ServiceInterfaceStream sif::debug("DEBUG");
|
||||||
ServiceInterfaceStream sif::info("INFO");
|
ServiceInterfaceStream sif::info("INFO");
|
||||||
@ -27,7 +26,7 @@ ServiceInterfaceStream sif::warning("WARNING", true);
|
|||||||
ServiceInterfaceStream sif::error("ERROR", true, false, true);
|
ServiceInterfaceStream sif::error("ERROR", true, false, true);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
ObjectManagerIF *objectManager = nullptr;
|
ObjectManagerIF* objectManager = nullptr;
|
||||||
|
|
||||||
void initmission::initMission() {
|
void initmission::initMission() {
|
||||||
sif::info << "Building global objects.." << std::endl;
|
sif::info << "Building global objects.." << std::endl;
|
||||||
@ -42,30 +41,29 @@ void initmission::initMission() {
|
|||||||
|
|
||||||
void initmission::initTasks() {
|
void initmission::initTasks() {
|
||||||
TaskFactory* factory = TaskFactory::instance();
|
TaskFactory* factory = TaskFactory::instance();
|
||||||
if(factory == nullptr) {
|
if (factory == nullptr) {
|
||||||
/* Should never happen ! */
|
/* Should never happen ! */
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
#if OBSW_PRINT_MISSED_DEADLINES == 1
|
#if OBSW_PRINT_MISSED_DEADLINES == 1
|
||||||
void (*missedDeadlineFunc) (void) = TaskFactory::printMissedDeadline;
|
void (*missedDeadlineFunc)(void) = TaskFactory::printMissedDeadline;
|
||||||
#else
|
#else
|
||||||
void (*missedDeadlineFunc) (void) = nullptr;
|
void (*missedDeadlineFunc)(void) = nullptr;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/* TMTC Distribution */
|
/* TMTC Distribution */
|
||||||
PeriodicTaskIF* tmTcDistributor = factory->createPeriodicTask(
|
PeriodicTaskIF* tmTcDistributor = factory->createPeriodicTask(
|
||||||
"DIST", 40, PeriodicTaskIF::MINIMUM_STACK_SIZE, 0.2, missedDeadlineFunc);
|
"DIST", 40, PeriodicTaskIF::MINIMUM_STACK_SIZE, 0.2, missedDeadlineFunc);
|
||||||
ReturnValue_t result = tmTcDistributor->addComponent(
|
ReturnValue_t result = tmTcDistributor->addComponent(objects::CCSDS_PACKET_DISTRIBUTOR);
|
||||||
objects::CCSDS_PACKET_DISTRIBUTOR);
|
if (result != HasReturnvaluesIF::RETURN_OK) {
|
||||||
if(result != HasReturnvaluesIF::RETURN_OK){
|
|
||||||
sif::error << "Object add component failed" << std::endl;
|
sif::error << "Object add component failed" << std::endl;
|
||||||
}
|
}
|
||||||
result = tmTcDistributor->addComponent(objects::PUS_PACKET_DISTRIBUTOR);
|
result = tmTcDistributor->addComponent(objects::PUS_PACKET_DISTRIBUTOR);
|
||||||
if(result != HasReturnvaluesIF::RETURN_OK){
|
if (result != HasReturnvaluesIF::RETURN_OK) {
|
||||||
sif::error << "Object add component failed" << std::endl;
|
sif::error << "Object add component failed" << std::endl;
|
||||||
}
|
}
|
||||||
result = tmTcDistributor->addComponent(objects::TM_FUNNEL);
|
result = tmTcDistributor->addComponent(objects::TM_FUNNEL);
|
||||||
if(result != HasReturnvaluesIF::RETURN_OK) {
|
if (result != HasReturnvaluesIF::RETURN_OK) {
|
||||||
sif::error << "Object add component failed" << std::endl;
|
sif::error << "Object add component failed" << std::endl;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -73,13 +71,13 @@ void initmission::initTasks() {
|
|||||||
PeriodicTaskIF* tmtcBridgeTask = factory->createPeriodicTask(
|
PeriodicTaskIF* tmtcBridgeTask = factory->createPeriodicTask(
|
||||||
"TMTC_UNIX_BRIDGE", 50, PeriodicTaskIF::MINIMUM_STACK_SIZE, 0.2, missedDeadlineFunc);
|
"TMTC_UNIX_BRIDGE", 50, PeriodicTaskIF::MINIMUM_STACK_SIZE, 0.2, missedDeadlineFunc);
|
||||||
result = tmtcBridgeTask->addComponent(objects::TMTC_BRIDGE);
|
result = tmtcBridgeTask->addComponent(objects::TMTC_BRIDGE);
|
||||||
if(result != HasReturnvaluesIF::RETURN_OK) {
|
if (result != HasReturnvaluesIF::RETURN_OK) {
|
||||||
sif::error << "Add component UDP Unix Bridge failed" << std::endl;
|
sif::error << "Add component UDP Unix Bridge failed" << std::endl;
|
||||||
}
|
}
|
||||||
PeriodicTaskIF* tmtcPollingTask = factory->createPeriodicTask(
|
PeriodicTaskIF* tmtcPollingTask = factory->createPeriodicTask(
|
||||||
"UDP_POLLING", 80, PeriodicTaskIF::MINIMUM_STACK_SIZE, 2.0, missedDeadlineFunc);
|
"UDP_POLLING", 80, PeriodicTaskIF::MINIMUM_STACK_SIZE, 2.0, missedDeadlineFunc);
|
||||||
result = tmtcPollingTask->addComponent(objects::TMTC_POLLING_TASK);
|
result = tmtcPollingTask->addComponent(objects::TMTC_POLLING_TASK);
|
||||||
if(result != HasReturnvaluesIF::RETURN_OK) {
|
if (result != HasReturnvaluesIF::RETURN_OK) {
|
||||||
sif::error << "Add component UDP Polling failed" << std::endl;
|
sif::error << "Add component UDP Polling failed" << std::endl;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -87,47 +85,47 @@ void initmission::initTasks() {
|
|||||||
PeriodicTaskIF* pusVerification = factory->createPeriodicTask(
|
PeriodicTaskIF* pusVerification = factory->createPeriodicTask(
|
||||||
"PUS_VERIF", 40, PeriodicTaskIF::MINIMUM_STACK_SIZE, 0.200, missedDeadlineFunc);
|
"PUS_VERIF", 40, PeriodicTaskIF::MINIMUM_STACK_SIZE, 0.200, missedDeadlineFunc);
|
||||||
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) {
|
||||||
sif::error << "Object add component failed" << std::endl;
|
sif::error << "Object add component failed" << std::endl;
|
||||||
}
|
}
|
||||||
|
|
||||||
PeriodicTaskIF* pusEvents = factory->createPeriodicTask(
|
PeriodicTaskIF* pusEvents = factory->createPeriodicTask(
|
||||||
"PUS_EVENTS", 60, PeriodicTaskIF::MINIMUM_STACK_SIZE, 0.200, missedDeadlineFunc);
|
"PUS_EVENTS", 60, PeriodicTaskIF::MINIMUM_STACK_SIZE, 0.200, missedDeadlineFunc);
|
||||||
result = pusVerification->addComponent(objects::PUS_SERVICE_5_EVENT_REPORTING);
|
result = pusVerification->addComponent(objects::PUS_SERVICE_5_EVENT_REPORTING);
|
||||||
if(result != HasReturnvaluesIF::RETURN_OK){
|
if (result != HasReturnvaluesIF::RETURN_OK) {
|
||||||
initmission::printAddObjectError("PUS5", objects::PUS_SERVICE_5_EVENT_REPORTING);
|
initmission::printAddObjectError("PUS5", objects::PUS_SERVICE_5_EVENT_REPORTING);
|
||||||
}
|
}
|
||||||
|
|
||||||
PeriodicTaskIF* pusHighPrio = factory->createPeriodicTask(
|
PeriodicTaskIF* pusHighPrio = factory->createPeriodicTask(
|
||||||
"PUS_HIGH_PRIO", 50, PeriodicTaskIF::MINIMUM_STACK_SIZE, 0.200, missedDeadlineFunc);
|
"PUS_HIGH_PRIO", 50, PeriodicTaskIF::MINIMUM_STACK_SIZE, 0.200, missedDeadlineFunc);
|
||||||
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) {
|
||||||
initmission::printAddObjectError("PUS2", objects::PUS_SERVICE_2_DEVICE_ACCESS);
|
initmission::printAddObjectError("PUS2", objects::PUS_SERVICE_2_DEVICE_ACCESS);
|
||||||
}
|
}
|
||||||
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) {
|
||||||
initmission::printAddObjectError("PUS9", objects::PUS_SERVICE_9_TIME_MGMT);
|
initmission::printAddObjectError("PUS9", objects::PUS_SERVICE_9_TIME_MGMT);
|
||||||
}
|
}
|
||||||
|
|
||||||
PeriodicTaskIF* pusMedPrio = factory->createPeriodicTask(
|
PeriodicTaskIF* pusMedPrio = factory->createPeriodicTask(
|
||||||
"PUS_MED_PRIO", 40, PeriodicTaskIF::MINIMUM_STACK_SIZE, 0.8, missedDeadlineFunc);
|
"PUS_MED_PRIO", 40, PeriodicTaskIF::MINIMUM_STACK_SIZE, 0.8, missedDeadlineFunc);
|
||||||
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) {
|
||||||
initmission::printAddObjectError("PUS8", objects::PUS_SERVICE_8_FUNCTION_MGMT);
|
initmission::printAddObjectError("PUS8", 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) {
|
||||||
initmission::printAddObjectError("PUS200", objects::PUS_SERVICE_200_MODE_MGMT);
|
initmission::printAddObjectError("PUS200", objects::PUS_SERVICE_200_MODE_MGMT);
|
||||||
}
|
}
|
||||||
result = pusMedPrio->addComponent(objects::PUS_SERVICE_20_PARAMETERS);
|
result = pusMedPrio->addComponent(objects::PUS_SERVICE_20_PARAMETERS);
|
||||||
if(result != HasReturnvaluesIF::RETURN_OK) {
|
if (result != HasReturnvaluesIF::RETURN_OK) {
|
||||||
initmission::printAddObjectError("PUS20", objects::PUS_SERVICE_20_PARAMETERS);
|
initmission::printAddObjectError("PUS20", objects::PUS_SERVICE_20_PARAMETERS);
|
||||||
}
|
}
|
||||||
|
|
||||||
PeriodicTaskIF* pusLowPrio = factory->createPeriodicTask(
|
PeriodicTaskIF* pusLowPrio = factory->createPeriodicTask(
|
||||||
"PUS_LOW_PRIO", 30, PeriodicTaskIF::MINIMUM_STACK_SIZE, 1.6, missedDeadlineFunc);
|
"PUS_LOW_PRIO", 30, PeriodicTaskIF::MINIMUM_STACK_SIZE, 1.6, missedDeadlineFunc);
|
||||||
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) {
|
||||||
initmission::printAddObjectError("PUS17", objects::PUS_SERVICE_17_TEST);
|
initmission::printAddObjectError("PUS17", objects::PUS_SERVICE_17_TEST);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -135,7 +133,7 @@ void initmission::initTasks() {
|
|||||||
"TEST_TASK", 40, PeriodicTaskIF::MINIMUM_STACK_SIZE, 2.0, missedDeadlineFunc);
|
"TEST_TASK", 40, PeriodicTaskIF::MINIMUM_STACK_SIZE, 2.0, missedDeadlineFunc);
|
||||||
#if OBSW_ADD_TEST_CODE == 1
|
#if OBSW_ADD_TEST_CODE == 1
|
||||||
result = testTask->addComponent(objects::TEST_TASK);
|
result = testTask->addComponent(objects::TEST_TASK);
|
||||||
if(result != HasReturnvaluesIF::RETURN_OK) {
|
if (result != HasReturnvaluesIF::RETURN_OK) {
|
||||||
initmission::printAddObjectError("TEST_TASK", objects::TEST_TASK);
|
initmission::printAddObjectError("TEST_TASK", objects::TEST_TASK);
|
||||||
}
|
}
|
||||||
#endif /* OBSW_ADD_TEST_CODE == 1 */
|
#endif /* OBSW_ADD_TEST_CODE == 1 */
|
||||||
|
@ -4,6 +4,6 @@
|
|||||||
namespace initmission {
|
namespace initmission {
|
||||||
void initMission();
|
void initMission();
|
||||||
void initTasks();
|
void initTasks();
|
||||||
};
|
}; // namespace initmission
|
||||||
|
|
||||||
#endif /* BSP_LINUX_INITMISSION_H_ */
|
#endif /* BSP_LINUX_INITMISSION_H_ */
|
||||||
|
@ -1,14 +1,14 @@
|
|||||||
#include "ObjectFactory.h"
|
#include "ObjectFactory.h"
|
||||||
#include "OBSWConfig.h"
|
|
||||||
|
#include <fsfw/tmtcservices/CommandingServiceBase.h>
|
||||||
|
#include <fsfw/tmtcservices/PusServiceBase.h>
|
||||||
|
#include <mission/core/GenericFactory.h>
|
||||||
|
#include <mission/utility/TmFunnel.h>
|
||||||
#include <objects/systemObjectList.h>
|
#include <objects/systemObjectList.h>
|
||||||
#include <tmtc/apid.h>
|
#include <tmtc/apid.h>
|
||||||
#include <tmtc/pusIds.h>
|
#include <tmtc/pusIds.h>
|
||||||
|
|
||||||
#include <fsfw/tmtcservices/CommandingServiceBase.h>
|
#include "OBSWConfig.h"
|
||||||
#include <fsfw/tmtcservices/PusServiceBase.h>
|
|
||||||
|
|
||||||
#include <mission/core/GenericFactory.h>
|
|
||||||
#include <mission/utility/TmFunnel.h>
|
|
||||||
|
|
||||||
#if OBSW_USE_TMTC_TCP_BRIDGE == 0
|
#if OBSW_USE_TMTC_TCP_BRIDGE == 0
|
||||||
#include "fsfw/osal/common/UdpTcPollingTask.h"
|
#include "fsfw/osal/common/UdpTcPollingTask.h"
|
||||||
@ -20,12 +20,11 @@
|
|||||||
|
|
||||||
#include <fsfw/tmtcpacket/pus/tm.h>
|
#include <fsfw/tmtcpacket/pus/tm.h>
|
||||||
|
|
||||||
|
|
||||||
#if OBSW_ADD_TEST_CODE == 1
|
#if OBSW_ADD_TEST_CODE == 1
|
||||||
#include <test/testtasks/TestTask.h>
|
#include <test/testtasks/TestTask.h>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
void Factory::setStaticFrameworkObjectIds(){
|
void Factory::setStaticFrameworkObjectIds() {
|
||||||
PusServiceBase::packetSource = objects::PUS_PACKET_DISTRIBUTOR;
|
PusServiceBase::packetSource = objects::PUS_PACKET_DISTRIBUTOR;
|
||||||
PusServiceBase::packetDestination = objects::TM_FUNNEL;
|
PusServiceBase::packetDestination = objects::TM_FUNNEL;
|
||||||
|
|
||||||
@ -40,7 +39,7 @@ void Factory::setStaticFrameworkObjectIds(){
|
|||||||
TmPacketBase::timeStamperId = objects::TIME_STAMPER;
|
TmPacketBase::timeStamperId = objects::TIME_STAMPER;
|
||||||
}
|
}
|
||||||
|
|
||||||
void ObjectFactory::produce(void* args){
|
void ObjectFactory::produce(void* args) {
|
||||||
Factory::setStaticFrameworkObjectIds();
|
Factory::setStaticFrameworkObjectIds();
|
||||||
ObjectFactory::produceGenericObjects();
|
ObjectFactory::produceGenericObjects();
|
||||||
|
|
||||||
|
@ -1,10 +1,9 @@
|
|||||||
#ifndef BSP_LINUX_OBJECTFACTORY_H_
|
#ifndef BSP_LINUX_OBJECTFACTORY_H_
|
||||||
#define BSP_LINUX_OBJECTFACTORY_H_
|
#define BSP_LINUX_OBJECTFACTORY_H_
|
||||||
|
|
||||||
|
|
||||||
namespace ObjectFactory {
|
namespace ObjectFactory {
|
||||||
void setStatics();
|
void setStatics();
|
||||||
void produce(void* args);
|
void produce(void* args);
|
||||||
};
|
}; // namespace ObjectFactory
|
||||||
|
|
||||||
#endif /* BSP_LINUX_OBJECTFACTORY_H_ */
|
#endif /* BSP_LINUX_OBJECTFACTORY_H_ */
|
||||||
|
@ -1,8 +1,8 @@
|
|||||||
target_sources(${TARGET_NAME} PRIVATE
|
target_sources(${OBSW_NAME} PRIVATE
|
||||||
print.c
|
print.c
|
||||||
)
|
)
|
||||||
|
|
||||||
target_include_directories(${TARGET_NAME} PUBLIC
|
target_include_directories(${OBSW_NAME} PUBLIC
|
||||||
${CMAKE_CURRENT_SOURCE_DIR}
|
${CMAKE_CURRENT_SOURCE_DIR}
|
||||||
)
|
)
|
||||||
|
|
||||||
|
@ -7,7 +7,8 @@ extern "C" void __gcov_flush();
|
|||||||
#else
|
#else
|
||||||
void __gcov_flush() {
|
void __gcov_flush() {
|
||||||
sif::info << "GCC GCOV: Please supply GCOV=1 in Makefile if "
|
sif::info << "GCC GCOV: Please supply GCOV=1 in Makefile if "
|
||||||
"coverage information is desired.\n" << std::flush;
|
"coverage information is desired.\n"
|
||||||
|
<< std::flush;
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
@ -3,13 +3,9 @@
|
|||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
|
|
||||||
void printChar(const char* character, bool errStream) {
|
void printChar(const char* character, bool errStream) {
|
||||||
if(errStream) {
|
if (errStream) {
|
||||||
putc(*character, stderr);
|
putc(*character, stderr);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
putc(*character, stdout);
|
putc(*character, stdout);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@ -1,32 +1,31 @@
|
|||||||
#include "ArduinoComIF.h"
|
#include "ArduinoComIF.h"
|
||||||
#include "ArduinoCookie.h"
|
|
||||||
|
|
||||||
#include <fsfw/globalfunctions/DleEncoder.h>
|
|
||||||
#include <fsfw/globalfunctions/CRC.h>
|
#include <fsfw/globalfunctions/CRC.h>
|
||||||
|
#include <fsfw/globalfunctions/DleEncoder.h>
|
||||||
#include <fsfw/serviceinterface/ServiceInterfaceStream.h>
|
#include <fsfw/serviceinterface/ServiceInterfaceStream.h>
|
||||||
|
|
||||||
|
#include "ArduinoCookie.h"
|
||||||
|
|
||||||
// This only works on Linux
|
// This only works on Linux
|
||||||
#ifdef LINUX
|
#ifdef LINUX
|
||||||
#include <termios.h>
|
|
||||||
#include <fcntl.h>
|
#include <fcntl.h>
|
||||||
|
#include <termios.h>
|
||||||
#include <unistd.h>
|
#include <unistd.h>
|
||||||
#elif WIN32
|
#elif WIN32
|
||||||
#include <windows.h>
|
|
||||||
#include <strsafe.h>
|
#include <strsafe.h>
|
||||||
|
#include <windows.h>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#include <cstring>
|
#include <cstring>
|
||||||
|
|
||||||
ArduinoComIF::ArduinoComIF(object_id_t setObjectId, bool promptComIF,
|
ArduinoComIF::ArduinoComIF(object_id_t setObjectId, bool promptComIF, const char *serialDevice)
|
||||||
const char *serialDevice):
|
: rxBuffer(MAX_PACKET_SIZE * MAX_NUMBER_OF_SPI_DEVICES * 10, true), SystemObject(setObjectId) {
|
||||||
rxBuffer(MAX_PACKET_SIZE * MAX_NUMBER_OF_SPI_DEVICES*10, true),
|
|
||||||
SystemObject(setObjectId) {
|
|
||||||
#ifdef LINUX
|
#ifdef LINUX
|
||||||
initialized = false;
|
initialized = false;
|
||||||
serialPort = ::open("/dev/ttyUSB0", O_RDWR);
|
serialPort = ::open("/dev/ttyUSB0", O_RDWR);
|
||||||
|
|
||||||
if (serialPort < 0) {
|
if (serialPort < 0) {
|
||||||
//configuration error
|
// configuration error
|
||||||
printf("Error %i from open: %s\n", errno, strerror(errno));
|
printf("Error %i from open: %s\n", errno, strerror(errno));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -44,73 +43,64 @@ ArduinoComIF::ArduinoComIF(object_id_t setObjectId, bool promptComIF,
|
|||||||
tty.c_cflag &= ~CSTOPB; // Clear stop field, only one stop bit used in communication
|
tty.c_cflag &= ~CSTOPB; // Clear stop field, only one stop bit used in communication
|
||||||
tty.c_cflag |= CS8; // 8 bits per byte
|
tty.c_cflag |= CS8; // 8 bits per byte
|
||||||
tty.c_cflag &= ~CRTSCTS; // Disable RTS/CTS hardware flow control
|
tty.c_cflag &= ~CRTSCTS; // Disable RTS/CTS hardware flow control
|
||||||
tty.c_lflag &= ~ICANON; //Disable Canonical Mode
|
tty.c_lflag &= ~ICANON; // Disable Canonical Mode
|
||||||
tty.c_oflag &= ~OPOST; // Prevent special interpretation of output bytes (e.g. newline chars)
|
tty.c_oflag &= ~OPOST; // Prevent special interpretation of output bytes (e.g. newline chars)
|
||||||
tty.c_oflag &= ~ONLCR; // Prevent conversion of newline to carriage return/line feed
|
tty.c_oflag &= ~ONLCR; // Prevent conversion of newline to carriage return/line feed
|
||||||
tty.c_cc[VTIME] = 0; // Non Blocking
|
tty.c_cc[VTIME] = 0; // Non Blocking
|
||||||
tty.c_cc[VMIN] = 0;
|
tty.c_cc[VMIN] = 0;
|
||||||
|
|
||||||
cfsetispeed(&tty, B9600); //Baudrate
|
cfsetispeed(&tty, B9600); // Baudrate
|
||||||
|
|
||||||
if (tcsetattr(serialPort, TCSANOW, &tty) != 0) {
|
if (tcsetattr(serialPort, TCSANOW, &tty) != 0) {
|
||||||
//printf("Error %i from tcsetattr: %s\n", errno, strerror(errno));
|
// printf("Error %i from tcsetattr: %s\n", errno, strerror(errno));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
initialized = true;
|
initialized = true;
|
||||||
#elif WIN32
|
#elif WIN32
|
||||||
DCB serialParams = { 0 };
|
DCB serialParams = {0};
|
||||||
|
|
||||||
// we need to ask the COM port from the user.
|
// we need to ask the COM port from the user.
|
||||||
if(promptComIF) {
|
if (promptComIF) {
|
||||||
sif::info << "Please enter the COM port (c to cancel): " << std::flush;
|
sif::info << "Please enter the COM port (c to cancel): " << std::flush;
|
||||||
std::string comPort;
|
std::string comPort;
|
||||||
while(hCom == INVALID_HANDLE_VALUE) {
|
while (hCom == INVALID_HANDLE_VALUE) {
|
||||||
|
|
||||||
std::getline(std::cin, comPort);
|
std::getline(std::cin, comPort);
|
||||||
if(comPort[0] == 'c') {
|
if (comPort[0] == 'c') {
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
const TCHAR *pcCommPort = comPort.c_str();
|
const TCHAR *pcCommPort = comPort.c_str();
|
||||||
hCom = CreateFileA(pcCommPort, //port name
|
hCom = CreateFileA(pcCommPort, // port name
|
||||||
GENERIC_READ | GENERIC_WRITE, //Read/Write
|
GENERIC_READ | GENERIC_WRITE, // Read/Write
|
||||||
0, // No Sharing
|
0, // No Sharing
|
||||||
NULL, // No Security
|
NULL, // No Security
|
||||||
OPEN_EXISTING,// Open existing port only
|
OPEN_EXISTING, // Open existing port only
|
||||||
0, // Non Overlapped I/O
|
0, // Non Overlapped I/O
|
||||||
NULL); // Null for Comm Devices
|
NULL); // Null for Comm Devices
|
||||||
|
|
||||||
if (hCom == INVALID_HANDLE_VALUE)
|
if (hCom == INVALID_HANDLE_VALUE) {
|
||||||
{
|
if (GetLastError() == 2) {
|
||||||
if(GetLastError() == 2) {
|
|
||||||
sif::error << "COM Port does not found!" << std::endl;
|
sif::error << "COM Port does not found!" << std::endl;
|
||||||
}
|
} else {
|
||||||
else {
|
|
||||||
TCHAR err[128];
|
TCHAR err[128];
|
||||||
FormatMessage(FORMAT_MESSAGE_FROM_SYSTEM, NULL,
|
FormatMessage(FORMAT_MESSAGE_FROM_SYSTEM, NULL, GetLastError(),
|
||||||
GetLastError(),
|
MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT), err, sizeof(err), NULL);
|
||||||
MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT),
|
|
||||||
err, sizeof(err), NULL);
|
|
||||||
// Handle the error.
|
// Handle the error.
|
||||||
sif::info << "CreateFileA Error code: " << GetLastError()
|
sif::info << "CreateFileA Error code: " << GetLastError() << std::endl;
|
||||||
<< std::endl;
|
|
||||||
sif::error << err << std::flush;
|
sif::error << err << std::flush;
|
||||||
}
|
}
|
||||||
sif::info << "Please enter a valid COM port: " << std::flush;
|
sif::info << "Please enter a valid COM port: " << std::flush;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
serialParams.DCBlength = sizeof(serialParams);
|
serialParams.DCBlength = sizeof(serialParams);
|
||||||
if(baudRate == 9600) {
|
if (baudRate == 9600) {
|
||||||
serialParams.BaudRate = CBR_9600;
|
serialParams.BaudRate = CBR_9600;
|
||||||
}
|
}
|
||||||
if(baudRate == 115200) {
|
if (baudRate == 115200) {
|
||||||
serialParams.BaudRate = CBR_115200;
|
serialParams.BaudRate = CBR_115200;
|
||||||
}
|
} else {
|
||||||
else {
|
|
||||||
serialParams.BaudRate = baudRate;
|
serialParams.BaudRate = baudRate;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -119,7 +109,7 @@ ArduinoComIF::ArduinoComIF(object_id_t setObjectId, bool promptComIF,
|
|||||||
serialParams.StopBits = ONESTOPBIT;
|
serialParams.StopBits = ONESTOPBIT;
|
||||||
SetCommState(hCom, &serialParams);
|
SetCommState(hCom, &serialParams);
|
||||||
|
|
||||||
COMMTIMEOUTS timeout = { 0 };
|
COMMTIMEOUTS timeout = {0};
|
||||||
// This will set the read operation to be blocking until data is received
|
// This will set the read operation to be blocking until data is received
|
||||||
// and then read continuously until there is a gap of one millisecond.
|
// and then read continuously until there is a gap of one millisecond.
|
||||||
timeout.ReadIntervalTimeout = 1;
|
timeout.ReadIntervalTimeout = 1;
|
||||||
@ -139,36 +129,29 @@ ArduinoComIF::~ArduinoComIF() {
|
|||||||
CloseHandle(hCom);
|
CloseHandle(hCom);
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
ReturnValue_t ArduinoComIF::initializeInterface(CookieIF * cookie) {
|
ReturnValue_t ArduinoComIF::initializeInterface(CookieIF *cookie) {
|
||||||
return HasReturnvaluesIF::RETURN_OK;
|
return HasReturnvaluesIF::RETURN_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
ReturnValue_t ArduinoComIF::sendMessage(CookieIF *cookie, const uint8_t *data,
|
ReturnValue_t ArduinoComIF::sendMessage(CookieIF *cookie, const uint8_t *data, size_t len) {
|
||||||
size_t len) {
|
ArduinoCookie *arduinoCookie = dynamic_cast<ArduinoCookie *>(cookie);
|
||||||
ArduinoCookie *arduinoCookie = dynamic_cast<ArduinoCookie*>(cookie);
|
|
||||||
if (arduinoCookie == nullptr) {
|
if (arduinoCookie == nullptr) {
|
||||||
return INVALID_COOKIE_TYPE;
|
return INVALID_COOKIE_TYPE;
|
||||||
}
|
}
|
||||||
|
|
||||||
return sendMessage(arduinoCookie->command, arduinoCookie->address, data,
|
return sendMessage(arduinoCookie->command, arduinoCookie->address, data, len);
|
||||||
len);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
ReturnValue_t ArduinoComIF::getSendSuccess(CookieIF *cookie) {
|
ReturnValue_t ArduinoComIF::getSendSuccess(CookieIF *cookie) { return RETURN_OK; }
|
||||||
|
|
||||||
|
ReturnValue_t ArduinoComIF::requestReceiveMessage(CookieIF *cookie, size_t requestLen) {
|
||||||
return RETURN_OK;
|
return RETURN_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
ReturnValue_t ArduinoComIF::requestReceiveMessage(CookieIF *cookie,
|
ReturnValue_t ArduinoComIF::readReceivedMessage(CookieIF *cookie, uint8_t **buffer, size_t *size) {
|
||||||
size_t requestLen) {
|
|
||||||
return RETURN_OK;
|
|
||||||
}
|
|
||||||
|
|
||||||
ReturnValue_t ArduinoComIF::readReceivedMessage(CookieIF *cookie,
|
|
||||||
uint8_t **buffer, size_t *size) {
|
|
||||||
|
|
||||||
handleSerialPortRx();
|
handleSerialPortRx();
|
||||||
|
|
||||||
ArduinoCookie *arduinoCookie = dynamic_cast<ArduinoCookie*>(cookie);
|
ArduinoCookie *arduinoCookie = dynamic_cast<ArduinoCookie *>(cookie);
|
||||||
if (arduinoCookie == nullptr) {
|
if (arduinoCookie == nullptr) {
|
||||||
return INVALID_COOKIE_TYPE;
|
return INVALID_COOKIE_TYPE;
|
||||||
}
|
}
|
||||||
@ -178,13 +161,13 @@ ReturnValue_t ArduinoComIF::readReceivedMessage(CookieIF *cookie,
|
|||||||
return HasReturnvaluesIF::RETURN_OK;
|
return HasReturnvaluesIF::RETURN_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
ReturnValue_t ArduinoComIF::sendMessage(uint8_t command,
|
ReturnValue_t ArduinoComIF::sendMessage(uint8_t command, uint8_t address, const uint8_t *data,
|
||||||
uint8_t address, const uint8_t *data, size_t dataLen) {
|
size_t dataLen) {
|
||||||
if (dataLen > UINT16_MAX) {
|
if (dataLen > UINT16_MAX) {
|
||||||
return TOO_MUCH_DATA;
|
return TOO_MUCH_DATA;
|
||||||
}
|
}
|
||||||
|
|
||||||
//being conservative here
|
// being conservative here
|
||||||
uint8_t sendBuffer[(dataLen + 6) * 2 + 2];
|
uint8_t sendBuffer[(dataLen + 6) * 2 + 2];
|
||||||
|
|
||||||
sendBuffer[0] = DleEncoder::STX_CHAR;
|
sendBuffer[0] = DleEncoder::STX_CHAR;
|
||||||
@ -193,61 +176,59 @@ ReturnValue_t ArduinoComIF::sendMessage(uint8_t command,
|
|||||||
size_t remainingLen = sizeof(sendBuffer) - 1;
|
size_t remainingLen = sizeof(sendBuffer) - 1;
|
||||||
size_t encodedLen = 0;
|
size_t encodedLen = 0;
|
||||||
|
|
||||||
ReturnValue_t result = DleEncoder::encode(&command, 1, currentPosition,
|
ReturnValue_t result =
|
||||||
remainingLen, &encodedLen, false);
|
DleEncoder::encode(&command, 1, currentPosition, remainingLen, &encodedLen, false);
|
||||||
if (result != RETURN_OK) {
|
if (result != RETURN_OK) {
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
currentPosition += encodedLen;
|
currentPosition += encodedLen;
|
||||||
remainingLen -= encodedLen; //DleEncoder will never return encodedLen > remainingLen
|
remainingLen -= encodedLen; // DleEncoder will never return encodedLen > remainingLen
|
||||||
|
|
||||||
result = DleEncoder::encode(&address, 1, currentPosition, remainingLen,
|
result = DleEncoder::encode(&address, 1, currentPosition, remainingLen, &encodedLen, false);
|
||||||
&encodedLen, false);
|
|
||||||
if (result != RETURN_OK) {
|
if (result != RETURN_OK) {
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
currentPosition += encodedLen;
|
currentPosition += encodedLen;
|
||||||
remainingLen -= encodedLen; //DleEncoder will never return encodedLen > remainingLen
|
remainingLen -= encodedLen; // DleEncoder will never return encodedLen > remainingLen
|
||||||
|
|
||||||
uint8_t temporaryBuffer[2];
|
uint8_t temporaryBuffer[2];
|
||||||
|
|
||||||
//note to Lukas: yes we _could_ use Serialize here, but for 16 bit it is a bit too much...
|
// note to Lukas: yes we _could_ use Serialize here, but for 16 bit it is a bit too much...
|
||||||
temporaryBuffer[0] = dataLen >> 8; //we checked dataLen above
|
temporaryBuffer[0] = dataLen >> 8; // we checked dataLen above
|
||||||
temporaryBuffer[1] = dataLen;
|
temporaryBuffer[1] = dataLen;
|
||||||
|
|
||||||
result = DleEncoder::encode(temporaryBuffer, 2, currentPosition,
|
result =
|
||||||
remainingLen, &encodedLen, false);
|
DleEncoder::encode(temporaryBuffer, 2, currentPosition, remainingLen, &encodedLen, false);
|
||||||
if (result != RETURN_OK) {
|
if (result != RETURN_OK) {
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
currentPosition += encodedLen;
|
currentPosition += encodedLen;
|
||||||
remainingLen -= encodedLen; //DleEncoder will never return encodedLen > remainingLen
|
remainingLen -= encodedLen; // DleEncoder will never return encodedLen > remainingLen
|
||||||
|
|
||||||
//encoding the actual data
|
// encoding the actual data
|
||||||
result = DleEncoder::encode(data, dataLen, currentPosition, remainingLen,
|
result = DleEncoder::encode(data, dataLen, currentPosition, remainingLen, &encodedLen, false);
|
||||||
&encodedLen, false);
|
|
||||||
if (result != RETURN_OK) {
|
if (result != RETURN_OK) {
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
currentPosition += encodedLen;
|
currentPosition += encodedLen;
|
||||||
remainingLen -= encodedLen; //DleEncoder will never return encodedLen > remainingLen
|
remainingLen -= encodedLen; // DleEncoder will never return encodedLen > remainingLen
|
||||||
|
|
||||||
uint16_t crc = CRC::crc16ccitt(&command, 1);
|
uint16_t crc = CRC::crc16ccitt(&command, 1);
|
||||||
crc = CRC::crc16ccitt(&address, 1, crc);
|
crc = CRC::crc16ccitt(&address, 1, crc);
|
||||||
//fortunately the length is still there
|
// fortunately the length is still there
|
||||||
crc = CRC::crc16ccitt(temporaryBuffer, 2, crc);
|
crc = CRC::crc16ccitt(temporaryBuffer, 2, crc);
|
||||||
crc = CRC::crc16ccitt(data, dataLen, crc);
|
crc = CRC::crc16ccitt(data, dataLen, crc);
|
||||||
|
|
||||||
temporaryBuffer[0] = crc >> 8;
|
temporaryBuffer[0] = crc >> 8;
|
||||||
temporaryBuffer[1] = crc;
|
temporaryBuffer[1] = crc;
|
||||||
|
|
||||||
result = DleEncoder::encode(temporaryBuffer, 2, currentPosition,
|
result =
|
||||||
remainingLen, &encodedLen, false);
|
DleEncoder::encode(temporaryBuffer, 2, currentPosition, remainingLen, &encodedLen, false);
|
||||||
if (result != RETURN_OK) {
|
if (result != RETURN_OK) {
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
currentPosition += encodedLen;
|
currentPosition += encodedLen;
|
||||||
remainingLen -= encodedLen; //DleEncoder will never return encodedLen > remainingLen
|
remainingLen -= encodedLen; // DleEncoder will never return encodedLen > remainingLen
|
||||||
|
|
||||||
if (remainingLen > 0) {
|
if (remainingLen > 0) {
|
||||||
*currentPosition = DleEncoder::ETX_CHAR;
|
*currentPosition = DleEncoder::ETX_CHAR;
|
||||||
@ -259,12 +240,12 @@ ReturnValue_t ArduinoComIF::sendMessage(uint8_t command,
|
|||||||
#ifdef LINUX
|
#ifdef LINUX
|
||||||
ssize_t writtenlen = ::write(serialPort, sendBuffer, encodedLen);
|
ssize_t writtenlen = ::write(serialPort, sendBuffer, encodedLen);
|
||||||
if (writtenlen < 0) {
|
if (writtenlen < 0) {
|
||||||
//we could try to find out what happened...
|
// we could try to find out what happened...
|
||||||
return RETURN_FAILED;
|
return RETURN_FAILED;
|
||||||
}
|
}
|
||||||
if (writtenlen != encodedLen) {
|
if (writtenlen != encodedLen) {
|
||||||
//the OS failed us, we do not try to block until everything is written, as
|
// the OS failed us, we do not try to block until everything is written, as
|
||||||
//we can not block the whole system here
|
// we can not block the whole system here
|
||||||
return RETURN_FAILED;
|
return RETURN_FAILED;
|
||||||
}
|
}
|
||||||
return RETURN_OK;
|
return RETURN_OK;
|
||||||
@ -279,8 +260,7 @@ void ArduinoComIF::handleSerialPortRx() {
|
|||||||
|
|
||||||
uint8_t dataFromSerial[availableSpace];
|
uint8_t dataFromSerial[availableSpace];
|
||||||
|
|
||||||
ssize_t bytesRead = read(serialPort, dataFromSerial,
|
ssize_t bytesRead = read(serialPort, dataFromSerial, sizeof(dataFromSerial));
|
||||||
sizeof(dataFromSerial));
|
|
||||||
|
|
||||||
if (bytesRead < 0) {
|
if (bytesRead < 0) {
|
||||||
return;
|
return;
|
||||||
@ -292,18 +272,17 @@ void ArduinoComIF::handleSerialPortRx() {
|
|||||||
|
|
||||||
uint32_t dataLenReceivedSoFar = 0;
|
uint32_t dataLenReceivedSoFar = 0;
|
||||||
|
|
||||||
rxBuffer.readData(dataReceivedSoFar, sizeof(dataReceivedSoFar), true,
|
rxBuffer.readData(dataReceivedSoFar, sizeof(dataReceivedSoFar), true, &dataLenReceivedSoFar);
|
||||||
&dataLenReceivedSoFar);
|
|
||||||
|
|
||||||
//look for STX
|
// look for STX
|
||||||
size_t firstSTXinRawData = 0;
|
size_t firstSTXinRawData = 0;
|
||||||
while ((firstSTXinRawData < dataLenReceivedSoFar)
|
while ((firstSTXinRawData < dataLenReceivedSoFar) &&
|
||||||
&& (dataReceivedSoFar[firstSTXinRawData] != DleEncoder::STX_CHAR)) {
|
(dataReceivedSoFar[firstSTXinRawData] != DleEncoder::STX_CHAR)) {
|
||||||
firstSTXinRawData++;
|
firstSTXinRawData++;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (dataReceivedSoFar[firstSTXinRawData] != DleEncoder::STX_CHAR) {
|
if (dataReceivedSoFar[firstSTXinRawData] != DleEncoder::STX_CHAR) {
|
||||||
//there is no STX in our data, throw it away...
|
// there is no STX in our data, throw it away...
|
||||||
rxBuffer.deleteData(dataLenReceivedSoFar);
|
rxBuffer.deleteData(dataLenReceivedSoFar);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -313,10 +292,9 @@ void ArduinoComIF::handleSerialPortRx() {
|
|||||||
|
|
||||||
size_t readSize = 0;
|
size_t readSize = 0;
|
||||||
|
|
||||||
ReturnValue_t result = DleEncoder::decode(
|
ReturnValue_t result = DleEncoder::decode(dataReceivedSoFar + firstSTXinRawData,
|
||||||
dataReceivedSoFar + firstSTXinRawData,
|
dataLenReceivedSoFar - firstSTXinRawData, &readSize,
|
||||||
dataLenReceivedSoFar - firstSTXinRawData, &readSize, packet,
|
packet, sizeof(packet), &packetLen);
|
||||||
sizeof(packet), &packetLen);
|
|
||||||
|
|
||||||
size_t toDelete = firstSTXinRawData;
|
size_t toDelete = firstSTXinRawData;
|
||||||
if (result == HasReturnvaluesIF::RETURN_OK) {
|
if (result == HasReturnvaluesIF::RETURN_OK) {
|
||||||
@ -327,20 +305,18 @@ void ArduinoComIF::handleSerialPortRx() {
|
|||||||
toDelete += readSize;
|
toDelete += readSize;
|
||||||
}
|
}
|
||||||
|
|
||||||
//remove Data which was processed
|
// remove Data which was processed
|
||||||
rxBuffer.deleteData(toDelete);
|
rxBuffer.deleteData(toDelete);
|
||||||
#elif WIN32
|
#elif WIN32
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
void ArduinoComIF::setBaudrate(uint32_t baudRate) {
|
void ArduinoComIF::setBaudrate(uint32_t baudRate) { this->baudRate = baudRate; }
|
||||||
this->baudRate = baudRate;
|
|
||||||
}
|
|
||||||
|
|
||||||
void ArduinoComIF::handlePacket(uint8_t *packet, size_t packetLen) {
|
void ArduinoComIF::handlePacket(uint8_t *packet, size_t packetLen) {
|
||||||
uint16_t crc = CRC::crc16ccitt(packet, packetLen);
|
uint16_t crc = CRC::crc16ccitt(packet, packetLen);
|
||||||
if (crc != 0) {
|
if (crc != 0) {
|
||||||
//CRC error
|
// CRC error
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -350,26 +326,25 @@ void ArduinoComIF::handlePacket(uint8_t *packet, size_t packetLen) {
|
|||||||
uint16_t size = (packet[2] << 8) + packet[3];
|
uint16_t size = (packet[2] << 8) + packet[3];
|
||||||
|
|
||||||
if (size != packetLen - 6) {
|
if (size != packetLen - 6) {
|
||||||
//Invalid Length
|
// Invalid Length
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
switch (command) {
|
switch (command) {
|
||||||
case ArduinoCookie::SPI: {
|
case ArduinoCookie::SPI: {
|
||||||
//ArduinoCookie **itsComplicated;
|
// ArduinoCookie **itsComplicated;
|
||||||
auto findIter = spiMap.find(address);
|
auto findIter = spiMap.find(address);
|
||||||
if (findIter == spiMap.end()) {
|
if (findIter == spiMap.end()) {
|
||||||
//we do no know this address
|
// we do no know this address
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
ArduinoCookie& cookie = findIter->second;
|
ArduinoCookie &cookie = findIter->second;
|
||||||
if (packetLen > cookie.maxReplySize + 6) {
|
if (packetLen > cookie.maxReplySize + 6) {
|
||||||
packetLen = cookie.maxReplySize + 6;
|
packetLen = cookie.maxReplySize + 6;
|
||||||
}
|
}
|
||||||
std::memcpy(cookie.replyBuffer.data(), packet + 4, packetLen - 6);
|
std::memcpy(cookie.replyBuffer.data(), packet + 4, packetLen - 6);
|
||||||
cookie.receivedDataLen = packetLen - 6;
|
cookie.receivedDataLen = packetLen - 6;
|
||||||
}
|
} break;
|
||||||
break;
|
|
||||||
default:
|
default:
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -4,8 +4,8 @@
|
|||||||
#include <fsfw/container/FixedMap.h>
|
#include <fsfw/container/FixedMap.h>
|
||||||
#include <fsfw/container/SimpleRingBuffer.h>
|
#include <fsfw/container/SimpleRingBuffer.h>
|
||||||
#include <fsfw/devicehandlers/DeviceCommunicationIF.h>
|
#include <fsfw/devicehandlers/DeviceCommunicationIF.h>
|
||||||
#include <fsfw/returnvalues/HasReturnvaluesIF.h>
|
|
||||||
#include <fsfw/objectmanager/SystemObject.h>
|
#include <fsfw/objectmanager/SystemObject.h>
|
||||||
|
#include <fsfw/returnvalues/HasReturnvaluesIF.h>
|
||||||
|
|
||||||
#include <cstdint>
|
#include <cstdint>
|
||||||
#include <map>
|
#include <map>
|
||||||
@ -14,12 +14,11 @@
|
|||||||
#include <windows.h>
|
#include <windows.h>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
//Forward declaration, so users don't peek
|
// Forward declaration, so users don't peek
|
||||||
class ArduinoCookie;
|
class ArduinoCookie;
|
||||||
|
|
||||||
class ArduinoComIF: public SystemObject,
|
class ArduinoComIF : public SystemObject, public DeviceCommunicationIF {
|
||||||
public DeviceCommunicationIF {
|
public:
|
||||||
public:
|
|
||||||
static const uint8_t MAX_NUMBER_OF_SPI_DEVICES = 8;
|
static const uint8_t MAX_NUMBER_OF_SPI_DEVICES = 8;
|
||||||
static const uint8_t MAX_PACKET_SIZE = 64;
|
static const uint8_t MAX_PACKET_SIZE = 64;
|
||||||
|
|
||||||
@ -33,16 +32,15 @@ public:
|
|||||||
virtual ~ArduinoComIF();
|
virtual ~ArduinoComIF();
|
||||||
|
|
||||||
/** DeviceCommunicationIF overrides */
|
/** DeviceCommunicationIF overrides */
|
||||||
virtual ReturnValue_t initializeInterface(CookieIF * cookie) override;
|
virtual ReturnValue_t initializeInterface(CookieIF *cookie) override;
|
||||||
virtual ReturnValue_t sendMessage(CookieIF *cookie,
|
virtual ReturnValue_t sendMessage(CookieIF *cookie, const uint8_t *sendData,
|
||||||
const uint8_t * sendData, size_t sendLen) override;
|
size_t sendLen) override;
|
||||||
virtual ReturnValue_t getSendSuccess(CookieIF *cookie) override;
|
virtual ReturnValue_t getSendSuccess(CookieIF *cookie) override;
|
||||||
virtual ReturnValue_t requestReceiveMessage(CookieIF *cookie,
|
virtual ReturnValue_t requestReceiveMessage(CookieIF *cookie, size_t requestLen) override;
|
||||||
size_t requestLen) override;
|
virtual ReturnValue_t readReceivedMessage(CookieIF *cookie, uint8_t **buffer,
|
||||||
virtual ReturnValue_t readReceivedMessage(CookieIF *cookie,
|
size_t *size) override;
|
||||||
uint8_t **buffer, size_t *size) override;
|
|
||||||
|
|
||||||
private:
|
private:
|
||||||
#ifdef LINUX
|
#ifdef LINUX
|
||||||
#elif WIN32
|
#elif WIN32
|
||||||
HANDLE hCom = INVALID_HANDLE_VALUE;
|
HANDLE hCom = INVALID_HANDLE_VALUE;
|
||||||
@ -54,13 +52,12 @@ private:
|
|||||||
// Default baud rate is 9600 for now.
|
// Default baud rate is 9600 for now.
|
||||||
uint32_t baudRate = 9600;
|
uint32_t baudRate = 9600;
|
||||||
|
|
||||||
//used to know where to put the data if a reply is received
|
// used to know where to put the data if a reply is received
|
||||||
std::map<uint8_t, ArduinoCookie> spiMap;
|
std::map<uint8_t, ArduinoCookie> spiMap;
|
||||||
|
|
||||||
SimpleRingBuffer rxBuffer;
|
SimpleRingBuffer rxBuffer;
|
||||||
|
|
||||||
ReturnValue_t sendMessage(uint8_t command, uint8_t address,
|
ReturnValue_t sendMessage(uint8_t command, uint8_t address, const uint8_t *data, size_t dataLen);
|
||||||
const uint8_t *data, size_t dataLen);
|
|
||||||
void handleSerialPortRx();
|
void handleSerialPortRx();
|
||||||
|
|
||||||
void handlePacket(uint8_t *packet, size_t packetLen);
|
void handlePacket(uint8_t *packet, size_t packetLen);
|
||||||
|
@ -1,8 +1,8 @@
|
|||||||
#include <bsp_hosted/comIF/ArduinoCookie.h>
|
#include <bsp_hosted/comIF/ArduinoCookie.h>
|
||||||
|
|
||||||
ArduinoCookie::ArduinoCookie(Protocol_t protocol, uint8_t address,
|
ArduinoCookie::ArduinoCookie(Protocol_t protocol, uint8_t address, const size_t maxReplySize)
|
||||||
const size_t maxReplySize) :
|
: protocol(protocol),
|
||||||
protocol(protocol), command(protocol), address(address),
|
command(protocol),
|
||||||
maxReplySize(maxReplySize), replyBuffer(maxReplySize) {
|
address(address),
|
||||||
}
|
maxReplySize(maxReplySize),
|
||||||
|
replyBuffer(maxReplySize) {}
|
||||||
|
@ -2,18 +2,14 @@
|
|||||||
#define MISSION_ARDUINO_ARDUINOCOOKIE_H_
|
#define MISSION_ARDUINO_ARDUINOCOOKIE_H_
|
||||||
|
|
||||||
#include <fsfw/devicehandlers/CookieIF.h>
|
#include <fsfw/devicehandlers/CookieIF.h>
|
||||||
|
|
||||||
#include <vector>
|
#include <vector>
|
||||||
|
|
||||||
class ArduinoCookie: public CookieIF {
|
class ArduinoCookie : public CookieIF {
|
||||||
public:
|
public:
|
||||||
enum Protocol_t: uint8_t {
|
enum Protocol_t : uint8_t { INVALID, SPI, I2C };
|
||||||
INVALID,
|
|
||||||
SPI,
|
|
||||||
I2C
|
|
||||||
};
|
|
||||||
|
|
||||||
ArduinoCookie(Protocol_t protocol, uint8_t address,
|
ArduinoCookie(Protocol_t protocol, uint8_t address, const size_t maxReplySize);
|
||||||
const size_t maxReplySize);
|
|
||||||
|
|
||||||
Protocol_t protocol;
|
Protocol_t protocol;
|
||||||
uint8_t command;
|
uint8_t command;
|
||||||
@ -21,7 +17,6 @@ public:
|
|||||||
std::vector<uint8_t> replyBuffer;
|
std::vector<uint8_t> replyBuffer;
|
||||||
size_t receivedDataLen = 0;
|
size_t receivedDataLen = 0;
|
||||||
size_t maxReplySize;
|
size_t maxReplySize;
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif /* MISSION_ARDUINO_ARDUINOCOOKIE_H_ */
|
#endif /* MISSION_ARDUINO_ARDUINOCOOKIE_H_ */
|
||||||
|
@ -1,21 +1,27 @@
|
|||||||
target_sources(${TARGET_NAME} PRIVATE
|
target_sources(${OBSW_NAME} PRIVATE
|
||||||
ipc/MissionMessageTypes.cpp
|
ipc/MissionMessageTypes.cpp
|
||||||
)
|
)
|
||||||
|
|
||||||
target_include_directories(${TARGET_NAME} PUBLIC
|
target_include_directories(${OBSW_NAME} PUBLIC
|
||||||
${CMAKE_CURRENT_SOURCE_DIR}
|
${CMAKE_CURRENT_SOURCE_DIR}
|
||||||
)
|
)
|
||||||
|
|
||||||
# If a special translation file for object IDs exists, compile it.
|
# If a special translation file for object IDs exists, compile it.
|
||||||
if(EXISTS "${CMAKE_CURRENT_SOURCE_DIR}/objects/translateObjects.cpp")
|
if(EXISTS "${CMAKE_CURRENT_SOURCE_DIR}/objects/translateObjects.cpp")
|
||||||
target_sources(${TARGET_NAME} PRIVATE
|
target_sources(${OBSW_NAME} PRIVATE
|
||||||
|
objects/translateObjects.cpp
|
||||||
|
)
|
||||||
|
target_sources(${UNITTEST_NAME} PRIVATE
|
||||||
objects/translateObjects.cpp
|
objects/translateObjects.cpp
|
||||||
)
|
)
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
# If a special translation file for events exists, compile it.
|
# If a special translation file for events exists, compile it.
|
||||||
if(EXISTS "${CMAKE_CURRENT_SOURCE_DIR}/objects/translateObjects.cpp")
|
if(EXISTS "${CMAKE_CURRENT_SOURCE_DIR}/objects/translateObjects.cpp")
|
||||||
target_sources(${TARGET_NAME} PRIVATE
|
target_sources(${OBSW_NAME} PRIVATE
|
||||||
|
events/translateEvents.cpp
|
||||||
|
)
|
||||||
|
target_sources(${UNITTEST_NAME} PRIVATE
|
||||||
events/translateEvents.cpp
|
events/translateEvents.cpp
|
||||||
)
|
)
|
||||||
endif()
|
endif()
|
||||||
|
@ -1,57 +0,0 @@
|
|||||||
#ifndef FSFWCONFIG_DEVICES_GPIOIDS_H_
|
|
||||||
#define FSFWCONFIG_DEVICES_GPIOIDS_H_
|
|
||||||
|
|
||||||
namespace gpioIds {
|
|
||||||
enum gpioId_t {
|
|
||||||
HEATER_0,
|
|
||||||
HEATER_1,
|
|
||||||
HEATER_2,
|
|
||||||
HEATER_3,
|
|
||||||
HEATER_4,
|
|
||||||
HEATER_5,
|
|
||||||
HEATER_6,
|
|
||||||
HEATER_7,
|
|
||||||
DEPLSA1,
|
|
||||||
DEPLSA2,
|
|
||||||
|
|
||||||
MGM_0_LIS3_CS,
|
|
||||||
MGM_1_RM3100_CS,
|
|
||||||
GYRO_0_ADIS_CS,
|
|
||||||
GYRO_1_L3G_CS,
|
|
||||||
GYRO_2_L3G_CS,
|
|
||||||
MGM_2_LIS3_CS,
|
|
||||||
MGM_3_RM3100_CS,
|
|
||||||
|
|
||||||
TEST_ID_0,
|
|
||||||
TEST_ID_1,
|
|
||||||
|
|
||||||
RTD_IC_3,
|
|
||||||
RTD_IC_4,
|
|
||||||
RTD_IC_5,
|
|
||||||
RTD_IC_6,
|
|
||||||
RTD_IC_7,
|
|
||||||
RTD_IC_8,
|
|
||||||
RTD_IC_9,
|
|
||||||
RTD_IC_10,
|
|
||||||
RTD_IC_11,
|
|
||||||
RTD_IC_12,
|
|
||||||
RTD_IC_13,
|
|
||||||
RTD_IC_14,
|
|
||||||
RTD_IC_15,
|
|
||||||
RTD_IC_16,
|
|
||||||
RTD_IC_17,
|
|
||||||
RTD_IC_18,
|
|
||||||
|
|
||||||
SPI_MUX_BIT_1,
|
|
||||||
SPI_MUX_BIT_2,
|
|
||||||
SPI_MUX_BIT_3,
|
|
||||||
SPI_MUX_BIT_4,
|
|
||||||
SPI_MUX_BIT_5,
|
|
||||||
SPI_MUX_BIT_6
|
|
||||||
};
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
#endif /* FSFWCONFIG_DEVICES_GPIOIDS_H_ */
|
|
@ -1,58 +0,0 @@
|
|||||||
#ifndef FSFWCONFIG_DEVICES_POWERSWITCHERLIST_H_
|
|
||||||
#define FSFWCONFIG_DEVICES_POWERSWITCHERLIST_H_
|
|
||||||
|
|
||||||
#include <OBSWConfig.h>
|
|
||||||
|
|
||||||
namespace pcduSwitches {
|
|
||||||
/* Switches are uint8_t datatype and go from 0 to 255 */
|
|
||||||
enum SwitcherList {
|
|
||||||
Q7S,
|
|
||||||
PAYLOAD_PCDU_CH1,
|
|
||||||
RW,
|
|
||||||
TCS_BOARD_8V_HEATER_IN,
|
|
||||||
SUS_REDUNDANT,
|
|
||||||
DEPLOYMENT_MECHANISM,
|
|
||||||
PAYLOAD_PCDU_CH6,
|
|
||||||
ACS_BOARD_SIDE_B,
|
|
||||||
PAYLOAD_CAMERA,
|
|
||||||
TCS_BOARD_3V3,
|
|
||||||
SYRLINKS,
|
|
||||||
STAR_TRACKER,
|
|
||||||
MGT,
|
|
||||||
SUS_NOMINAL,
|
|
||||||
SOLAR_CELL_EXP,
|
|
||||||
PLOC,
|
|
||||||
ACS_BOARD_SIDE_A,
|
|
||||||
NUMBER_OF_SWITCHES
|
|
||||||
};
|
|
||||||
|
|
||||||
static const uint8_t ON = 1;
|
|
||||||
static const uint8_t OFF = 0;
|
|
||||||
|
|
||||||
/* Output states after reboot of the PDUs */
|
|
||||||
static const uint8_t INIT_STATE_Q7S = ON;
|
|
||||||
static const uint8_t INIT_STATE_PAYLOAD_PCDU_CH1 = OFF;
|
|
||||||
static const uint8_t INIT_STATE_RW = OFF;
|
|
||||||
#if BOARD_TE0720 == 1
|
|
||||||
/* Because the TE0720 is not connected to the PCDU, this switch is always on */
|
|
||||||
static const uint8_t INIT_STATE_TCS_BOARD_8V_HEATER_IN = ON;
|
|
||||||
#else
|
|
||||||
static const uint8_t INIT_STATE_TCS_BOARD_8V_HEATER_IN = OFF;
|
|
||||||
#endif
|
|
||||||
static const uint8_t INIT_STATE_SUS_REDUNDANT = OFF;
|
|
||||||
static const uint8_t INIT_STATE_DEPLOYMENT_MECHANISM = OFF;
|
|
||||||
static const uint8_t INIT_STATE_PAYLOAD_PCDU_CH6 = OFF;
|
|
||||||
static const uint8_t INIT_STATE_ACS_BOARD_SIDE_B = OFF;
|
|
||||||
static const uint8_t INIT_STATE_PAYLOAD_CAMERA = OFF;
|
|
||||||
static const uint8_t INIT_STATE_TCS_BOARD_3V3 = OFF;
|
|
||||||
static const uint8_t INIT_STATE_SYRLINKS = OFF;
|
|
||||||
static const uint8_t INIT_STATE_STAR_TRACKER = OFF;
|
|
||||||
static const uint8_t INIT_STATE_MGT = OFF;
|
|
||||||
static const uint8_t INIT_STATE_SUS_NOMINAL = OFF;
|
|
||||||
static const uint8_t INIT_STATE_SOLAR_CELL_EXP = OFF;
|
|
||||||
static const uint8_t INIT_STATE_PLOC = OFF;
|
|
||||||
static const uint8_t INIT_STATE_ACS_BOARD_SIDE_A = OFF;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
#endif /* FSFWCONFIG_DEVICES_POWERSWITCHERLIST_H_ */
|
|
@ -2,6 +2,7 @@
|
|||||||
#define CONFIG_EVENTS_SUBSYSTEMIDRANGES_H_
|
#define CONFIG_EVENTS_SUBSYSTEMIDRANGES_H_
|
||||||
|
|
||||||
#include <common/config/commonSubsystemIds.h>
|
#include <common/config/commonSubsystemIds.h>
|
||||||
|
|
||||||
#include <cstdint>
|
#include <cstdint>
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -9,9 +10,7 @@
|
|||||||
* Numbers 0-80 are reserved for FSFW Subsystem IDs (framework/events/)
|
* Numbers 0-80 are reserved for FSFW Subsystem IDs (framework/events/)
|
||||||
*/
|
*/
|
||||||
namespace SUBSYSTEM_ID {
|
namespace SUBSYSTEM_ID {
|
||||||
enum: uint8_t {
|
enum : uint8_t { SUBSYSTEM_ID_START = COMMON_SUBSYSTEM_ID_END };
|
||||||
SUBSYSTEM_ID_START = COMMON_SUBSYSTEM_ID_END
|
|
||||||
};
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif /* CONFIG_EVENTS_SUBSYSTEMIDRANGES_H_ */
|
#endif /* CONFIG_EVENTS_SUBSYSTEMIDRANGES_H_ */
|
||||||
|
@ -89,173 +89,173 @@ const char *ACK_FAILURE_STRING = "ACK_FAILURE";
|
|||||||
const char *EXE_FAILURE_STRING = "EXE_FAILURE";
|
const char *EXE_FAILURE_STRING = "EXE_FAILURE";
|
||||||
const char *CRC_FAILURE_EVENT_STRING = "CRC_FAILURE_EVENT";
|
const char *CRC_FAILURE_EVENT_STRING = "CRC_FAILURE_EVENT";
|
||||||
|
|
||||||
const char * translateEvents(Event event) {
|
const char *translateEvents(Event event) {
|
||||||
switch( (event & 0xffff) ) {
|
switch ((event & 0xffff)) {
|
||||||
case(2200):
|
case (2200):
|
||||||
return STORE_SEND_WRITE_FAILED_STRING;
|
return STORE_SEND_WRITE_FAILED_STRING;
|
||||||
case(2201):
|
case (2201):
|
||||||
return STORE_WRITE_FAILED_STRING;
|
return STORE_WRITE_FAILED_STRING;
|
||||||
case(2202):
|
case (2202):
|
||||||
return STORE_SEND_READ_FAILED_STRING;
|
return STORE_SEND_READ_FAILED_STRING;
|
||||||
case(2203):
|
case (2203):
|
||||||
return STORE_READ_FAILED_STRING;
|
return STORE_READ_FAILED_STRING;
|
||||||
case(2204):
|
case (2204):
|
||||||
return UNEXPECTED_MSG_STRING;
|
return UNEXPECTED_MSG_STRING;
|
||||||
case(2205):
|
case (2205):
|
||||||
return STORING_FAILED_STRING;
|
return STORING_FAILED_STRING;
|
||||||
case(2206):
|
case (2206):
|
||||||
return TM_DUMP_FAILED_STRING;
|
return TM_DUMP_FAILED_STRING;
|
||||||
case(2207):
|
case (2207):
|
||||||
return STORE_INIT_FAILED_STRING;
|
return STORE_INIT_FAILED_STRING;
|
||||||
case(2208):
|
case (2208):
|
||||||
return STORE_INIT_EMPTY_STRING;
|
return STORE_INIT_EMPTY_STRING;
|
||||||
case(2209):
|
case (2209):
|
||||||
return STORE_CONTENT_CORRUPTED_STRING;
|
return STORE_CONTENT_CORRUPTED_STRING;
|
||||||
case(2210):
|
case (2210):
|
||||||
return STORE_INITIALIZE_STRING;
|
return STORE_INITIALIZE_STRING;
|
||||||
case(2211):
|
case (2211):
|
||||||
return INIT_DONE_STRING;
|
return INIT_DONE_STRING;
|
||||||
case(2212):
|
case (2212):
|
||||||
return DUMP_FINISHED_STRING;
|
return DUMP_FINISHED_STRING;
|
||||||
case(2213):
|
case (2213):
|
||||||
return DELETION_FINISHED_STRING;
|
return DELETION_FINISHED_STRING;
|
||||||
case(2214):
|
case (2214):
|
||||||
return DELETION_FAILED_STRING;
|
return DELETION_FAILED_STRING;
|
||||||
case(2215):
|
case (2215):
|
||||||
return AUTO_CATALOGS_SENDING_FAILED_STRING;
|
return AUTO_CATALOGS_SENDING_FAILED_STRING;
|
||||||
case(2600):
|
case (2600):
|
||||||
return GET_DATA_FAILED_STRING;
|
return GET_DATA_FAILED_STRING;
|
||||||
case(2601):
|
case (2601):
|
||||||
return STORE_DATA_FAILED_STRING;
|
return STORE_DATA_FAILED_STRING;
|
||||||
case(2800):
|
case (2800):
|
||||||
return DEVICE_BUILDING_COMMAND_FAILED_STRING;
|
return DEVICE_BUILDING_COMMAND_FAILED_STRING;
|
||||||
case(2801):
|
case (2801):
|
||||||
return DEVICE_SENDING_COMMAND_FAILED_STRING;
|
return DEVICE_SENDING_COMMAND_FAILED_STRING;
|
||||||
case(2802):
|
case (2802):
|
||||||
return DEVICE_REQUESTING_REPLY_FAILED_STRING;
|
return DEVICE_REQUESTING_REPLY_FAILED_STRING;
|
||||||
case(2803):
|
case (2803):
|
||||||
return DEVICE_READING_REPLY_FAILED_STRING;
|
return DEVICE_READING_REPLY_FAILED_STRING;
|
||||||
case(2804):
|
case (2804):
|
||||||
return DEVICE_INTERPRETING_REPLY_FAILED_STRING;
|
return DEVICE_INTERPRETING_REPLY_FAILED_STRING;
|
||||||
case(2805):
|
case (2805):
|
||||||
return DEVICE_MISSED_REPLY_STRING;
|
return DEVICE_MISSED_REPLY_STRING;
|
||||||
case(2806):
|
case (2806):
|
||||||
return DEVICE_UNKNOWN_REPLY_STRING;
|
return DEVICE_UNKNOWN_REPLY_STRING;
|
||||||
case(2807):
|
case (2807):
|
||||||
return DEVICE_UNREQUESTED_REPLY_STRING;
|
return DEVICE_UNREQUESTED_REPLY_STRING;
|
||||||
case(2808):
|
case (2808):
|
||||||
return INVALID_DEVICE_COMMAND_STRING;
|
return INVALID_DEVICE_COMMAND_STRING;
|
||||||
case(2809):
|
case (2809):
|
||||||
return MONITORING_LIMIT_EXCEEDED_STRING;
|
return MONITORING_LIMIT_EXCEEDED_STRING;
|
||||||
case(2810):
|
case (2810):
|
||||||
return MONITORING_AMBIGUOUS_STRING;
|
return MONITORING_AMBIGUOUS_STRING;
|
||||||
case(4201):
|
case (4201):
|
||||||
return FUSE_CURRENT_HIGH_STRING;
|
return FUSE_CURRENT_HIGH_STRING;
|
||||||
case(4202):
|
case (4202):
|
||||||
return FUSE_WENT_OFF_STRING;
|
return FUSE_WENT_OFF_STRING;
|
||||||
case(4204):
|
case (4204):
|
||||||
return POWER_ABOVE_HIGH_LIMIT_STRING;
|
return POWER_ABOVE_HIGH_LIMIT_STRING;
|
||||||
case(4205):
|
case (4205):
|
||||||
return POWER_BELOW_LOW_LIMIT_STRING;
|
return POWER_BELOW_LOW_LIMIT_STRING;
|
||||||
case(4300):
|
case (4300):
|
||||||
return SWITCH_WENT_OFF_STRING;
|
return SWITCH_WENT_OFF_STRING;
|
||||||
case(5000):
|
case (5000):
|
||||||
return HEATER_ON_STRING;
|
return HEATER_ON_STRING;
|
||||||
case(5001):
|
case (5001):
|
||||||
return HEATER_OFF_STRING;
|
return HEATER_OFF_STRING;
|
||||||
case(5002):
|
case (5002):
|
||||||
return HEATER_TIMEOUT_STRING;
|
return HEATER_TIMEOUT_STRING;
|
||||||
case(5003):
|
case (5003):
|
||||||
return HEATER_STAYED_ON_STRING;
|
return HEATER_STAYED_ON_STRING;
|
||||||
case(5004):
|
case (5004):
|
||||||
return HEATER_STAYED_OFF_STRING;
|
return HEATER_STAYED_OFF_STRING;
|
||||||
case(5200):
|
case (5200):
|
||||||
return TEMP_SENSOR_HIGH_STRING;
|
return TEMP_SENSOR_HIGH_STRING;
|
||||||
case(5201):
|
case (5201):
|
||||||
return TEMP_SENSOR_LOW_STRING;
|
return TEMP_SENSOR_LOW_STRING;
|
||||||
case(5202):
|
case (5202):
|
||||||
return TEMP_SENSOR_GRADIENT_STRING;
|
return TEMP_SENSOR_GRADIENT_STRING;
|
||||||
case(5901):
|
case (5901):
|
||||||
return COMPONENT_TEMP_LOW_STRING;
|
return COMPONENT_TEMP_LOW_STRING;
|
||||||
case(5902):
|
case (5902):
|
||||||
return COMPONENT_TEMP_HIGH_STRING;
|
return COMPONENT_TEMP_HIGH_STRING;
|
||||||
case(5903):
|
case (5903):
|
||||||
return COMPONENT_TEMP_OOL_LOW_STRING;
|
return COMPONENT_TEMP_OOL_LOW_STRING;
|
||||||
case(5904):
|
case (5904):
|
||||||
return COMPONENT_TEMP_OOL_HIGH_STRING;
|
return COMPONENT_TEMP_OOL_HIGH_STRING;
|
||||||
case(5905):
|
case (5905):
|
||||||
return TEMP_NOT_IN_OP_RANGE_STRING;
|
return TEMP_NOT_IN_OP_RANGE_STRING;
|
||||||
case(7101):
|
case (7101):
|
||||||
return FDIR_CHANGED_STATE_STRING;
|
return FDIR_CHANGED_STATE_STRING;
|
||||||
case(7102):
|
case (7102):
|
||||||
return FDIR_STARTS_RECOVERY_STRING;
|
return FDIR_STARTS_RECOVERY_STRING;
|
||||||
case(7103):
|
case (7103):
|
||||||
return FDIR_TURNS_OFF_DEVICE_STRING;
|
return FDIR_TURNS_OFF_DEVICE_STRING;
|
||||||
case(7201):
|
case (7201):
|
||||||
return MONITOR_CHANGED_STATE_STRING;
|
return MONITOR_CHANGED_STATE_STRING;
|
||||||
case(7202):
|
case (7202):
|
||||||
return VALUE_BELOW_LOW_LIMIT_STRING;
|
return VALUE_BELOW_LOW_LIMIT_STRING;
|
||||||
case(7203):
|
case (7203):
|
||||||
return VALUE_ABOVE_HIGH_LIMIT_STRING;
|
return VALUE_ABOVE_HIGH_LIMIT_STRING;
|
||||||
case(7204):
|
case (7204):
|
||||||
return VALUE_OUT_OF_RANGE_STRING;
|
return VALUE_OUT_OF_RANGE_STRING;
|
||||||
case(7301):
|
case (7301):
|
||||||
return SWITCHING_TM_FAILED_STRING;
|
return SWITCHING_TM_FAILED_STRING;
|
||||||
case(7400):
|
case (7400):
|
||||||
return CHANGING_MODE_STRING;
|
return CHANGING_MODE_STRING;
|
||||||
case(7401):
|
case (7401):
|
||||||
return MODE_INFO_STRING;
|
return MODE_INFO_STRING;
|
||||||
case(7402):
|
case (7402):
|
||||||
return FALLBACK_FAILED_STRING;
|
return FALLBACK_FAILED_STRING;
|
||||||
case(7403):
|
case (7403):
|
||||||
return MODE_TRANSITION_FAILED_STRING;
|
return MODE_TRANSITION_FAILED_STRING;
|
||||||
case(7404):
|
case (7404):
|
||||||
return CANT_KEEP_MODE_STRING;
|
return CANT_KEEP_MODE_STRING;
|
||||||
case(7405):
|
case (7405):
|
||||||
return OBJECT_IN_INVALID_MODE_STRING;
|
return OBJECT_IN_INVALID_MODE_STRING;
|
||||||
case(7406):
|
case (7406):
|
||||||
return FORCING_MODE_STRING;
|
return FORCING_MODE_STRING;
|
||||||
case(7407):
|
case (7407):
|
||||||
return MODE_CMD_REJECTED_STRING;
|
return MODE_CMD_REJECTED_STRING;
|
||||||
case(7506):
|
case (7506):
|
||||||
return HEALTH_INFO_STRING;
|
return HEALTH_INFO_STRING;
|
||||||
case(7507):
|
case (7507):
|
||||||
return CHILD_CHANGED_HEALTH_STRING;
|
return CHILD_CHANGED_HEALTH_STRING;
|
||||||
case(7508):
|
case (7508):
|
||||||
return CHILD_PROBLEMS_STRING;
|
return CHILD_PROBLEMS_STRING;
|
||||||
case(7509):
|
case (7509):
|
||||||
return OVERWRITING_HEALTH_STRING;
|
return OVERWRITING_HEALTH_STRING;
|
||||||
case(7510):
|
case (7510):
|
||||||
return TRYING_RECOVERY_STRING;
|
return TRYING_RECOVERY_STRING;
|
||||||
case(7511):
|
case (7511):
|
||||||
return RECOVERY_STEP_STRING;
|
return RECOVERY_STEP_STRING;
|
||||||
case(7512):
|
case (7512):
|
||||||
return RECOVERY_DONE_STRING;
|
return RECOVERY_DONE_STRING;
|
||||||
case(7900):
|
case (7900):
|
||||||
return RF_AVAILABLE_STRING;
|
return RF_AVAILABLE_STRING;
|
||||||
case(7901):
|
case (7901):
|
||||||
return RF_LOST_STRING;
|
return RF_LOST_STRING;
|
||||||
case(7902):
|
case (7902):
|
||||||
return BIT_LOCK_STRING;
|
return BIT_LOCK_STRING;
|
||||||
case(7903):
|
case (7903):
|
||||||
return BIT_LOCK_LOST_STRING;
|
return BIT_LOCK_LOST_STRING;
|
||||||
case(7905):
|
case (7905):
|
||||||
return FRAME_PROCESSING_FAILED_STRING;
|
return FRAME_PROCESSING_FAILED_STRING;
|
||||||
case(8900):
|
case (8900):
|
||||||
return CLOCK_SET_STRING;
|
return CLOCK_SET_STRING;
|
||||||
case(8901):
|
case (8901):
|
||||||
return CLOCK_SET_FAILURE_STRING;
|
return CLOCK_SET_FAILURE_STRING;
|
||||||
case(9700):
|
case (9700):
|
||||||
return TEST_STRING;
|
return TEST_STRING;
|
||||||
case(10600):
|
case (10600):
|
||||||
return CHANGE_OF_SETUP_PARAMETER_STRING;
|
return CHANGE_OF_SETUP_PARAMETER_STRING;
|
||||||
case(11101):
|
case (11101):
|
||||||
return MEMORY_READ_RPT_CRC_FAILURE_STRING;
|
return MEMORY_READ_RPT_CRC_FAILURE_STRING;
|
||||||
case(11102):
|
case (11102):
|
||||||
return ACK_FAILURE_STRING;
|
return ACK_FAILURE_STRING;
|
||||||
case(11103):
|
case (11103):
|
||||||
return EXE_FAILURE_STRING;
|
return EXE_FAILURE_STRING;
|
||||||
case(11104):
|
case (11104):
|
||||||
return CRC_FAILURE_EVENT_STRING;
|
return CRC_FAILURE_EVENT_STRING;
|
||||||
default:
|
default:
|
||||||
return "UNKNOWN_EVENT";
|
return "UNKNOWN_EVENT";
|
||||||
|
@ -3,6 +3,6 @@
|
|||||||
|
|
||||||
#include <fsfw/events/Event.h>
|
#include <fsfw/events/Event.h>
|
||||||
|
|
||||||
const char * translateEvents(Event event);
|
const char* translateEvents(Event event);
|
||||||
|
|
||||||
#endif /* FSFWCONFIG_EVENTS_TRANSLATEEVENTS_H_ */
|
#endif /* FSFWCONFIG_EVENTS_TRANSLATEEVENTS_H_ */
|
||||||
|
@ -1,11 +1,10 @@
|
|||||||
#include "MissionMessageTypes.h"
|
#include "MissionMessageTypes.h"
|
||||||
|
|
||||||
#include <fsfw/ipc/CommandMessage.h>
|
#include <fsfw/ipc/CommandMessage.h>
|
||||||
|
|
||||||
void messagetypes::clearMissionMessage(CommandMessage* message) {
|
void messagetypes::clearMissionMessage(CommandMessage* message) {
|
||||||
switch(message->getMessageType()) {
|
switch (message->getMessageType()) {
|
||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -17,6 +17,6 @@ enum MESSAGE_TYPE {
|
|||||||
};
|
};
|
||||||
|
|
||||||
void clearMissionMessage(CommandMessage* message);
|
void clearMissionMessage(CommandMessage* message);
|
||||||
}
|
} // namespace messagetypes
|
||||||
|
|
||||||
#endif /* CONFIG_IPC_MISSIONMESSAGETYPES_H_ */
|
#endif /* CONFIG_IPC_MISSIONMESSAGETYPES_H_ */
|
||||||
|
@ -1,12 +1,13 @@
|
|||||||
#ifndef HOSTED_CONFIG_OBJECTS_SYSTEMOBJECTLIST_H_
|
#ifndef HOSTED_CONFIG_OBJECTS_SYSTEMOBJECTLIST_H_
|
||||||
#define HOSTED_CONFIG_OBJECTS_SYSTEMOBJECTLIST_H_
|
#define HOSTED_CONFIG_OBJECTS_SYSTEMOBJECTLIST_H_
|
||||||
|
|
||||||
#include <cstdint>
|
|
||||||
#include <commonObjects.h>
|
#include <commonObjects.h>
|
||||||
|
|
||||||
|
#include <cstdint>
|
||||||
|
|
||||||
// The objects will be instantiated in the ID order
|
// The objects will be instantiated in the ID order
|
||||||
namespace objects {
|
namespace objects {
|
||||||
enum sourceObjects: uint32_t {
|
enum sourceObjects : uint32_t {
|
||||||
|
|
||||||
PUS_SERVICE_3 = 0x51000300,
|
PUS_SERVICE_3 = 0x51000300,
|
||||||
PUS_SERVICE_5 = 0x51000400,
|
PUS_SERVICE_5 = 0x51000400,
|
||||||
@ -25,7 +26,7 @@ namespace objects {
|
|||||||
|
|
||||||
/* 0x49 ('I') for Communication Interfaces **/
|
/* 0x49 ('I') for Communication Interfaces **/
|
||||||
ARDUINO_COM_IF = 0x49000001
|
ARDUINO_COM_IF = 0x49000001
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif /* BSP_CONFIG_OBJECTS_SYSTEMOBJECTLIST_H_ */
|
#endif /* BSP_CONFIG_OBJECTS_SYSTEMOBJECTLIST_H_ */
|
||||||
|
@ -38,8 +38,8 @@ const char *FSFW_OBJECTS_END_STRING = "FSFW_OBJECTS_END";
|
|||||||
const char *DUMMY_INTERFACE_STRING = "DUMMY_INTERFACE";
|
const char *DUMMY_INTERFACE_STRING = "DUMMY_INTERFACE";
|
||||||
const char *NO_OBJECT_STRING = "NO_OBJECT";
|
const char *NO_OBJECT_STRING = "NO_OBJECT";
|
||||||
|
|
||||||
const char* translateObject(object_id_t object) {
|
const char *translateObject(object_id_t object) {
|
||||||
switch( (object & 0xFFFFFFFF) ) {
|
switch ((object & 0xFFFFFFFF)) {
|
||||||
case 0x42694269:
|
case 0x42694269:
|
||||||
return TEST_TASK_STRING;
|
return TEST_TASK_STRING;
|
||||||
case 0x4400AFFE:
|
case 0x4400AFFE:
|
||||||
|
@ -1,9 +1,10 @@
|
|||||||
#ifndef CONFIG_RETURNVALUES_CLASSIDS_H_
|
#ifndef CONFIG_RETURNVALUES_CLASSIDS_H_
|
||||||
#define CONFIG_RETURNVALUES_CLASSIDS_H_
|
#define CONFIG_RETURNVALUES_CLASSIDS_H_
|
||||||
|
|
||||||
#include "commonClassIds.h"
|
|
||||||
#include <fsfw/returnvalues/FwClassIds.h>
|
#include <fsfw/returnvalues/FwClassIds.h>
|
||||||
|
|
||||||
|
#include "commonClassIds.h"
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Source IDs starts at 73 for now
|
* Source IDs starts at 73 for now
|
||||||
* Framework IDs for ReturnValues run from 0 to 56
|
* Framework IDs for ReturnValues run from 0 to 56
|
||||||
@ -15,5 +16,4 @@ enum {
|
|||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
#endif /* CONFIG_RETURNVALUES_CLASSIDS_H_ */
|
#endif /* CONFIG_RETURNVALUES_CLASSIDS_H_ */
|
||||||
|
@ -12,8 +12,7 @@
|
|||||||
* APID is a 11 bit number
|
* APID is a 11 bit number
|
||||||
*/
|
*/
|
||||||
namespace apid {
|
namespace apid {
|
||||||
static const uint16_t EIVE_OBSW = 0x65;
|
static const uint16_t EIVE_OBSW = 0x65;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
#endif /* FSFWCONFIG_TMTC_APID_H_ */
|
#endif /* FSFWCONFIG_TMTC_APID_H_ */
|
||||||
|
@ -2,7 +2,7 @@
|
|||||||
#define CONFIG_TMTC_PUSIDS_HPP_
|
#define CONFIG_TMTC_PUSIDS_HPP_
|
||||||
|
|
||||||
namespace pus {
|
namespace pus {
|
||||||
enum Ids{
|
enum Ids {
|
||||||
PUS_SERVICE_1 = 1,
|
PUS_SERVICE_1 = 1,
|
||||||
PUS_SERVICE_2 = 2,
|
PUS_SERVICE_2 = 2,
|
||||||
PUS_SERVICE_3 = 3,
|
PUS_SERVICE_3 = 3,
|
||||||
|
@ -1,10 +1,9 @@
|
|||||||
|
#include <iostream>
|
||||||
|
|
||||||
#include "InitMission.h"
|
#include "InitMission.h"
|
||||||
#include "OBSWVersion.h"
|
#include "OBSWVersion.h"
|
||||||
|
|
||||||
#include "fsfw/FSFWVersion.h"
|
#include "fsfw/FSFWVersion.h"
|
||||||
#include "fsfw/tasks/TaskFactory.h"
|
#include "fsfw/tasks/TaskFactory.h"
|
||||||
|
|
||||||
#include <iostream>
|
|
||||||
#ifdef WIN32
|
#ifdef WIN32
|
||||||
static const char* COMPILE_PRINTOUT = "Windows";
|
static const char* COMPILE_PRINTOUT = "Windows";
|
||||||
#elif LINUX
|
#elif LINUX
|
||||||
@ -17,21 +16,18 @@ static const char* COMPILE_PRINTOUT = "unknown OS";
|
|||||||
* Linux and Windows.
|
* Linux and Windows.
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
int main(void)
|
int main(void) {
|
||||||
{
|
|
||||||
std::cout << "-- EIVE OBSW --" << std::endl;
|
std::cout << "-- EIVE OBSW --" << std::endl;
|
||||||
std::cout << "-- Compiled for " << COMPILE_PRINTOUT << " --" << std::endl;
|
std::cout << "-- Compiled for " << COMPILE_PRINTOUT << " --" << std::endl;
|
||||||
std::cout << "-- OBSW " << SW_NAME << " v" << SW_VERSION << "." << SW_SUBVERSION <<
|
std::cout << "-- OBSW " << SW_NAME << " v" << SW_VERSION << "." << SW_SUBVERSION << "."
|
||||||
"." << SW_REVISION << ", FSFW v" << FSFW_VERSION << "." << FSFW_SUBVERSION << "." <<
|
<< SW_REVISION << ", FSFW v" << FSFW_VERSION << "." << FSFW_SUBVERSION << "."
|
||||||
FSFW_REVISION << "--" << std::endl;
|
<< FSFW_REVISION << "--" << std::endl;
|
||||||
std::cout << "-- " << __DATE__ << " " << __TIME__ << " --" << std::endl;
|
std::cout << "-- " << __DATE__ << " " << __TIME__ << " --" << std::endl;
|
||||||
|
|
||||||
initmission::initMission();
|
initmission::initMission();
|
||||||
|
|
||||||
for(;;) {
|
for (;;) {
|
||||||
// suspend main thread by sleeping it.
|
// suspend main thread by sleeping it.
|
||||||
TaskFactory::delayTask(5000);
|
TaskFactory::delayTask(5000);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
target_sources(${TARGET_NAME} PUBLIC
|
target_sources(${OBSW_NAME} PUBLIC
|
||||||
InitMission.cpp
|
InitMission.cpp
|
||||||
main.cpp
|
main.cpp
|
||||||
ObjectFactory.cpp
|
ObjectFactory.cpp
|
||||||
|
@ -1,27 +1,27 @@
|
|||||||
#include "InitMission.h"
|
#include "InitMission.h"
|
||||||
#include "ObjectFactory.h"
|
|
||||||
|
|
||||||
#include "objects/systemObjectList.h"
|
#include <fsfw/objectmanager/ObjectManager.h>
|
||||||
#include "OBSWConfig.h"
|
|
||||||
#include "pollingsequence/pollingSequenceFactory.h"
|
|
||||||
|
|
||||||
#include <mission/utility/InitMission.h>
|
|
||||||
#include <fsfw/objectmanager/ObjectManagerIF.h>
|
#include <fsfw/objectmanager/ObjectManagerIF.h>
|
||||||
#include <fsfw/returnvalues/HasReturnvaluesIF.h>
|
#include <fsfw/returnvalues/HasReturnvaluesIF.h>
|
||||||
#include <fsfw/serviceinterface/ServiceInterface.h>
|
#include <fsfw/serviceinterface/ServiceInterface.h>
|
||||||
#include <fsfw/objectmanager/ObjectManager.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 <mission/utility/InitMission.h>
|
||||||
|
|
||||||
#include <iostream>
|
#include <iostream>
|
||||||
|
|
||||||
|
#include "OBSWConfig.h"
|
||||||
|
#include "ObjectFactory.h"
|
||||||
|
#include "objects/systemObjectList.h"
|
||||||
|
#include "pollingsequence/pollingSequenceFactory.h"
|
||||||
|
|
||||||
ServiceInterfaceStream sif::debug("DEBUG");
|
ServiceInterfaceStream sif::debug("DEBUG");
|
||||||
ServiceInterfaceStream sif::info("INFO");
|
ServiceInterfaceStream sif::info("INFO");
|
||||||
ServiceInterfaceStream sif::warning("WARNING");
|
ServiceInterfaceStream sif::warning("WARNING");
|
||||||
ServiceInterfaceStream sif::error("ERROR");
|
ServiceInterfaceStream sif::error("ERROR");
|
||||||
|
|
||||||
ObjectManagerIF *objectManager = nullptr;
|
ObjectManagerIF* objectManager = nullptr;
|
||||||
|
|
||||||
void initmission::initMission() {
|
void initmission::initMission() {
|
||||||
sif::info << "Building global objects.." << std::endl;
|
sif::info << "Building global objects.." << std::endl;
|
||||||
@ -37,45 +37,44 @@ void initmission::initMission() {
|
|||||||
void initmission::initTasks() {
|
void initmission::initTasks() {
|
||||||
TaskFactory* factory = TaskFactory::instance();
|
TaskFactory* factory = TaskFactory::instance();
|
||||||
ReturnValue_t result = HasReturnvaluesIF::RETURN_OK;
|
ReturnValue_t result = HasReturnvaluesIF::RETURN_OK;
|
||||||
if(factory == nullptr) {
|
if (factory == nullptr) {
|
||||||
/* Should never happen ! */
|
/* Should never happen ! */
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
#if OBSW_PRINT_MISSED_DEADLINES == 1
|
#if OBSW_PRINT_MISSED_DEADLINES == 1
|
||||||
void (*missedDeadlineFunc) (void) = TaskFactory::printMissedDeadline;
|
void (*missedDeadlineFunc)(void) = TaskFactory::printMissedDeadline;
|
||||||
#else
|
#else
|
||||||
void (*missedDeadlineFunc) (void) = nullptr;
|
void (*missedDeadlineFunc)(void) = nullptr;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
||||||
/* TMTC Distribution */
|
/* TMTC Distribution */
|
||||||
PeriodicTaskIF* tmTcDistributor = factory->createPeriodicTask(
|
PeriodicTaskIF* tmTcDistributor = factory->createPeriodicTask(
|
||||||
"DIST", 40, PeriodicTaskIF::MINIMUM_STACK_SIZE, 0.2, missedDeadlineFunc);
|
"DIST", 40, PeriodicTaskIF::MINIMUM_STACK_SIZE, 0.2, missedDeadlineFunc);
|
||||||
result = tmTcDistributor->addComponent(objects::CCSDS_PACKET_DISTRIBUTOR);
|
result = tmTcDistributor->addComponent(objects::CCSDS_PACKET_DISTRIBUTOR);
|
||||||
if(result != HasReturnvaluesIF::RETURN_OK){
|
if (result != HasReturnvaluesIF::RETURN_OK) {
|
||||||
sif::error << "Object add component failed" << std::endl;
|
sif::error << "Object add component failed" << std::endl;
|
||||||
}
|
}
|
||||||
result = tmTcDistributor->addComponent(objects::PUS_PACKET_DISTRIBUTOR);
|
result = tmTcDistributor->addComponent(objects::PUS_PACKET_DISTRIBUTOR);
|
||||||
if(result != HasReturnvaluesIF::RETURN_OK){
|
if (result != HasReturnvaluesIF::RETURN_OK) {
|
||||||
sif::error << "Object add component failed" << std::endl;
|
sif::error << "Object add component failed" << std::endl;
|
||||||
}
|
}
|
||||||
result = tmTcDistributor->addComponent(objects::TM_FUNNEL);
|
result = tmTcDistributor->addComponent(objects::TM_FUNNEL);
|
||||||
if(result != HasReturnvaluesIF::RETURN_OK) {
|
if (result != HasReturnvaluesIF::RETURN_OK) {
|
||||||
sif::error << "Object add component failed" << std::endl;
|
sif::error << "Object add component failed" << std::endl;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* UDP bridge */
|
/* UDP bridge */
|
||||||
PeriodicTaskIF* udpBridgeTask = factory->createPeriodicTask(
|
PeriodicTaskIF* tmtcBridgeTask = factory->createPeriodicTask(
|
||||||
"UDP_UNIX_BRIDGE", 50, PeriodicTaskIF::MINIMUM_STACK_SIZE, 0.2, missedDeadlineFunc);
|
"TMTC_BRIDGE", 50, PeriodicTaskIF::MINIMUM_STACK_SIZE, 0.2, missedDeadlineFunc);
|
||||||
result = udpBridgeTask->addComponent(objects::TMTC_BRIDGE);
|
result = tmtcBridgeTask->addComponent(objects::TMTC_BRIDGE);
|
||||||
if(result != HasReturnvaluesIF::RETURN_OK) {
|
if (result != HasReturnvaluesIF::RETURN_OK) {
|
||||||
sif::error << "Add component UDP Unix Bridge failed" << std::endl;
|
sif::error << "Add component TMTC Bridge failed" << std::endl;
|
||||||
}
|
}
|
||||||
PeriodicTaskIF* udpPollingTask = factory->createPeriodicTask(
|
PeriodicTaskIF* tmtcPollingTask = factory->createPeriodicTask(
|
||||||
"UDP_POLLING", 80, PeriodicTaskIF::MINIMUM_STACK_SIZE, 2.0, missedDeadlineFunc);
|
"TMTC_POLLING", 80, PeriodicTaskIF::MINIMUM_STACK_SIZE, 2.0, missedDeadlineFunc);
|
||||||
result = udpPollingTask->addComponent(objects::TMTC_POLLING_TASK);
|
result = tmtcPollingTask->addComponent(objects::TMTC_POLLING_TASK);
|
||||||
if(result != HasReturnvaluesIF::RETURN_OK) {
|
if (result != HasReturnvaluesIF::RETURN_OK) {
|
||||||
sif::error << "Add component UDP Polling failed" << std::endl;
|
sif::error << "Add component TMTC Polling failed" << std::endl;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* PUS Services */
|
/* PUS Services */
|
||||||
@ -90,11 +89,10 @@ void initmission::initTasks() {
|
|||||||
#endif /* OBSW_ADD_TEST_CODE == 1 */
|
#endif /* OBSW_ADD_TEST_CODE == 1 */
|
||||||
|
|
||||||
auto taskStarter = [](std::vector<PeriodicTaskIF*>& taskVector, std::string name) {
|
auto taskStarter = [](std::vector<PeriodicTaskIF*>& taskVector, std::string name) {
|
||||||
for(const auto& task: taskVector) {
|
for (const auto& task : taskVector) {
|
||||||
if(task != nullptr) {
|
if (task != nullptr) {
|
||||||
task->startTask();
|
task->startTask();
|
||||||
}
|
} else {
|
||||||
else {
|
|
||||||
sif::error << "Task in vector " << name << " is invalid!" << std::endl;
|
sif::error << "Task in vector " << name << " is invalid!" << std::endl;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -102,8 +100,8 @@ void initmission::initTasks() {
|
|||||||
|
|
||||||
sif::info << "Starting tasks.." << std::endl;
|
sif::info << "Starting tasks.." << std::endl;
|
||||||
tmTcDistributor->startTask();
|
tmTcDistributor->startTask();
|
||||||
udpBridgeTask->startTask();
|
tmtcBridgeTask->startTask();
|
||||||
udpPollingTask->startTask();
|
tmtcPollingTask->startTask();
|
||||||
|
|
||||||
taskStarter(pusTasks, "PUS Tasks");
|
taskStarter(pusTasks, "PUS Tasks");
|
||||||
#if OBSW_ADD_TEST_CODE == 1
|
#if OBSW_ADD_TEST_CODE == 1
|
||||||
@ -112,7 +110,7 @@ void initmission::initTasks() {
|
|||||||
taskStarter(pstTasks, "PST Tasks");
|
taskStarter(pstTasks, "PST Tasks");
|
||||||
|
|
||||||
#if OBSW_ADD_TEST_PST == 1
|
#if OBSW_ADD_TEST_PST == 1
|
||||||
if(startTestPst) {
|
if (startTestPst) {
|
||||||
pstTestTask->startTask();
|
pstTestTask->startTask();
|
||||||
}
|
}
|
||||||
#endif /* RPI_TEST_ACS_BOARD == 1 */
|
#endif /* RPI_TEST_ACS_BOARD == 1 */
|
||||||
@ -120,12 +118,13 @@ void initmission::initTasks() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void initmission::createPusTasks(TaskFactory& factory,
|
void initmission::createPusTasks(TaskFactory& factory,
|
||||||
TaskDeadlineMissedFunction missedDeadlineFunc, std::vector<PeriodicTaskIF*>& taskVec) {
|
TaskDeadlineMissedFunction missedDeadlineFunc,
|
||||||
|
std::vector<PeriodicTaskIF*>& taskVec) {
|
||||||
ReturnValue_t result = HasReturnvaluesIF::RETURN_OK;
|
ReturnValue_t result = HasReturnvaluesIF::RETURN_OK;
|
||||||
PeriodicTaskIF* pusVerification = factory.createPeriodicTask(
|
PeriodicTaskIF* pusVerification = factory.createPeriodicTask(
|
||||||
"PUS_VERIF", 40, PeriodicTaskIF::MINIMUM_STACK_SIZE, 0.200, missedDeadlineFunc);
|
"PUS_VERIF", 40, PeriodicTaskIF::MINIMUM_STACK_SIZE, 0.200, missedDeadlineFunc);
|
||||||
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) {
|
||||||
sif::error << "Object add component failed" << std::endl;
|
sif::error << "Object add component failed" << std::endl;
|
||||||
}
|
}
|
||||||
taskVec.push_back(pusVerification);
|
taskVec.push_back(pusVerification);
|
||||||
@ -133,11 +132,11 @@ void initmission::createPusTasks(TaskFactory& factory,
|
|||||||
PeriodicTaskIF* pusEvents = factory.createPeriodicTask(
|
PeriodicTaskIF* pusEvents = factory.createPeriodicTask(
|
||||||
"PUS_EVENTS", 60, PeriodicTaskIF::MINIMUM_STACK_SIZE, 0.200, missedDeadlineFunc);
|
"PUS_EVENTS", 60, PeriodicTaskIF::MINIMUM_STACK_SIZE, 0.200, missedDeadlineFunc);
|
||||||
result = pusEvents->addComponent(objects::PUS_SERVICE_5_EVENT_REPORTING);
|
result = pusEvents->addComponent(objects::PUS_SERVICE_5_EVENT_REPORTING);
|
||||||
if(result != HasReturnvaluesIF::RETURN_OK) {
|
if (result != HasReturnvaluesIF::RETURN_OK) {
|
||||||
initmission::printAddObjectError("PUS_EVENTS", objects::PUS_SERVICE_5_EVENT_REPORTING);
|
initmission::printAddObjectError("PUS_EVENTS", objects::PUS_SERVICE_5_EVENT_REPORTING);
|
||||||
}
|
}
|
||||||
result = pusEvents->addComponent(objects::EVENT_MANAGER);
|
result = pusEvents->addComponent(objects::EVENT_MANAGER);
|
||||||
if(result != HasReturnvaluesIF::RETURN_OK) {
|
if (result != HasReturnvaluesIF::RETURN_OK) {
|
||||||
initmission::printAddObjectError("PUS_MGMT", objects::EVENT_MANAGER);
|
initmission::printAddObjectError("PUS_MGMT", objects::EVENT_MANAGER);
|
||||||
}
|
}
|
||||||
taskVec.push_back(pusEvents);
|
taskVec.push_back(pusEvents);
|
||||||
@ -145,11 +144,11 @@ void initmission::createPusTasks(TaskFactory& factory,
|
|||||||
PeriodicTaskIF* pusHighPrio = factory.createPeriodicTask(
|
PeriodicTaskIF* pusHighPrio = factory.createPeriodicTask(
|
||||||
"PUS_HIGH_PRIO", 50, PeriodicTaskIF::MINIMUM_STACK_SIZE, 0.200, missedDeadlineFunc);
|
"PUS_HIGH_PRIO", 50, PeriodicTaskIF::MINIMUM_STACK_SIZE, 0.200, missedDeadlineFunc);
|
||||||
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) {
|
||||||
initmission::printAddObjectError("PUS2", objects::PUS_SERVICE_2_DEVICE_ACCESS);
|
initmission::printAddObjectError("PUS2", objects::PUS_SERVICE_2_DEVICE_ACCESS);
|
||||||
}
|
}
|
||||||
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) {
|
||||||
initmission::printAddObjectError("PUS9", objects::PUS_SERVICE_9_TIME_MGMT);
|
initmission::printAddObjectError("PUS9", objects::PUS_SERVICE_9_TIME_MGMT);
|
||||||
}
|
}
|
||||||
taskVec.push_back(pusHighPrio);
|
taskVec.push_back(pusHighPrio);
|
||||||
@ -157,19 +156,19 @@ void initmission::createPusTasks(TaskFactory& factory,
|
|||||||
PeriodicTaskIF* pusMedPrio = factory.createPeriodicTask(
|
PeriodicTaskIF* pusMedPrio = factory.createPeriodicTask(
|
||||||
"PUS_MED_PRIO", 40, PeriodicTaskIF::MINIMUM_STACK_SIZE, 0.8, missedDeadlineFunc);
|
"PUS_MED_PRIO", 40, PeriodicTaskIF::MINIMUM_STACK_SIZE, 0.8, missedDeadlineFunc);
|
||||||
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) {
|
||||||
initmission::printAddObjectError("PUS8", objects::PUS_SERVICE_8_FUNCTION_MGMT);
|
initmission::printAddObjectError("PUS8", 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) {
|
||||||
initmission::printAddObjectError("PUS200", objects::PUS_SERVICE_200_MODE_MGMT);
|
initmission::printAddObjectError("PUS200", objects::PUS_SERVICE_200_MODE_MGMT);
|
||||||
}
|
}
|
||||||
result = pusMedPrio->addComponent(objects::PUS_SERVICE_20_PARAMETERS);
|
result = pusMedPrio->addComponent(objects::PUS_SERVICE_20_PARAMETERS);
|
||||||
if(result != HasReturnvaluesIF::RETURN_OK) {
|
if (result != HasReturnvaluesIF::RETURN_OK) {
|
||||||
initmission::printAddObjectError("PUS20", objects::PUS_SERVICE_20_PARAMETERS);
|
initmission::printAddObjectError("PUS20", objects::PUS_SERVICE_20_PARAMETERS);
|
||||||
}
|
}
|
||||||
result = pusMedPrio->addComponent(objects::PUS_SERVICE_3_HOUSEKEEPING);
|
result = pusMedPrio->addComponent(objects::PUS_SERVICE_3_HOUSEKEEPING);
|
||||||
if(result != HasReturnvaluesIF::RETURN_OK) {
|
if (result != HasReturnvaluesIF::RETURN_OK) {
|
||||||
initmission::printAddObjectError("PUS3", objects::PUS_SERVICE_3_HOUSEKEEPING);
|
initmission::printAddObjectError("PUS3", objects::PUS_SERVICE_3_HOUSEKEEPING);
|
||||||
}
|
}
|
||||||
taskVec.push_back(pusMedPrio);
|
taskVec.push_back(pusMedPrio);
|
||||||
@ -177,24 +176,23 @@ void initmission::createPusTasks(TaskFactory& factory,
|
|||||||
PeriodicTaskIF* pusLowPrio = factory.createPeriodicTask(
|
PeriodicTaskIF* pusLowPrio = factory.createPeriodicTask(
|
||||||
"PUS_LOW_PRIO", 30, PeriodicTaskIF::MINIMUM_STACK_SIZE, 1.6, missedDeadlineFunc);
|
"PUS_LOW_PRIO", 30, PeriodicTaskIF::MINIMUM_STACK_SIZE, 1.6, missedDeadlineFunc);
|
||||||
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) {
|
||||||
initmission::printAddObjectError("PUS17", objects::PUS_SERVICE_17_TEST);
|
initmission::printAddObjectError("PUS17", objects::PUS_SERVICE_17_TEST);
|
||||||
}
|
}
|
||||||
result = pusLowPrio->addComponent(objects::INTERNAL_ERROR_REPORTER);
|
result = pusLowPrio->addComponent(objects::INTERNAL_ERROR_REPORTER);
|
||||||
if(result != HasReturnvaluesIF::RETURN_OK) {
|
if (result != HasReturnvaluesIF::RETURN_OK) {
|
||||||
initmission::printAddObjectError("INT_ERR_RPRT",
|
initmission::printAddObjectError("INT_ERR_RPRT", objects::INTERNAL_ERROR_REPORTER);
|
||||||
objects::INTERNAL_ERROR_REPORTER);
|
|
||||||
}
|
}
|
||||||
taskVec.push_back(pusLowPrio);
|
taskVec.push_back(pusLowPrio);
|
||||||
}
|
}
|
||||||
|
|
||||||
void initmission::createPstTasks(TaskFactory& factory,
|
void initmission::createPstTasks(TaskFactory& factory,
|
||||||
TaskDeadlineMissedFunction missedDeadlineFunc, std::vector<PeriodicTaskIF*> &taskVec) {
|
TaskDeadlineMissedFunction missedDeadlineFunc,
|
||||||
|
std::vector<PeriodicTaskIF*>& taskVec) {
|
||||||
ReturnValue_t result = HasReturnvaluesIF::RETURN_OK;
|
ReturnValue_t result = HasReturnvaluesIF::RETURN_OK;
|
||||||
#if OBSW_ADD_SPI_TEST_CODE == 0
|
#if OBSW_ADD_SPI_TEST_CODE == 0
|
||||||
FixedTimeslotTaskIF* spiPst = factory.createFixedTimeslotTask(
|
FixedTimeslotTaskIF* spiPst = factory.createFixedTimeslotTask(
|
||||||
"SPI_PST", 70, PeriodicTaskIF::MINIMUM_STACK_SIZE * 4, 3.0,
|
"SPI_PST", 70, PeriodicTaskIF::MINIMUM_STACK_SIZE * 4, 3.0, missedDeadlineFunc);
|
||||||
missedDeadlineFunc);
|
|
||||||
result = pst::pstSpi(spiPst);
|
result = pst::pstSpi(spiPst);
|
||||||
if (result != HasReturnvaluesIF::RETURN_OK) {
|
if (result != HasReturnvaluesIF::RETURN_OK) {
|
||||||
sif::error << "InitMission::initTasks: Creating PST failed!" << std::endl;
|
sif::error << "InitMission::initTasks: Creating PST failed!" << std::endl;
|
||||||
@ -205,43 +203,43 @@ void initmission::createPstTasks(TaskFactory& factory,
|
|||||||
|
|
||||||
void initmission::createTestTasks(TaskFactory& factory,
|
void initmission::createTestTasks(TaskFactory& factory,
|
||||||
TaskDeadlineMissedFunction missedDeadlineFunc,
|
TaskDeadlineMissedFunction missedDeadlineFunc,
|
||||||
std::vector<PeriodicTaskIF*> &taskVec) {
|
std::vector<PeriodicTaskIF*>& taskVec) {
|
||||||
ReturnValue_t result = HasReturnvaluesIF::RETURN_OK;
|
ReturnValue_t result = HasReturnvaluesIF::RETURN_OK;
|
||||||
PeriodicTaskIF* testTask = factory.createPeriodicTask(
|
PeriodicTaskIF* testTask = factory.createPeriodicTask(
|
||||||
"TEST_TASK", 40, PeriodicTaskIF::MINIMUM_STACK_SIZE, 2.0, missedDeadlineFunc);
|
"TEST_TASK", 40, PeriodicTaskIF::MINIMUM_STACK_SIZE, 2.0, missedDeadlineFunc);
|
||||||
result = testTask->addComponent(objects::TEST_TASK);
|
result = testTask->addComponent(objects::TEST_TASK);
|
||||||
if(result != HasReturnvaluesIF::RETURN_OK) {
|
if (result != HasReturnvaluesIF::RETURN_OK) {
|
||||||
initmission::printAddObjectError("TEST_TASK", objects::TEST_TASK);
|
initmission::printAddObjectError("TEST_TASK", objects::TEST_TASK);
|
||||||
}
|
}
|
||||||
#if RPI_ADD_SPI_TEST == 1
|
#if OBSW_ADD_SPI_TEST_CODE == 1
|
||||||
result = testTask->addComponent(objects::SPI_TEST);
|
result = testTask->addComponent(objects::SPI_TEST);
|
||||||
if(result != HasReturnvaluesIF::RETURN_OK) {
|
if (result != HasReturnvaluesIF::RETURN_OK) {
|
||||||
initmission::printAddObjectError("SPI_TEST", objects::SPI_TEST);
|
initmission::printAddObjectError("SPI_TEST", objects::SPI_TEST);
|
||||||
}
|
}
|
||||||
#endif /* RPI_ADD_SPI_TEST == 1 */
|
#endif /* RPI_ADD_SPI_TEST == 1 */
|
||||||
#if RPI_ADD_GPIO_TEST == 1
|
#if RPI_ADD_GPIO_TEST == 1
|
||||||
result = testTask->addComponent(objects::LIBGPIOD_TEST);
|
result = testTask->addComponent(objects::LIBGPIOD_TEST);
|
||||||
if(result != HasReturnvaluesIF::RETURN_OK) {
|
if (result != HasReturnvaluesIF::RETURN_OK) {
|
||||||
initmission::printAddObjectError("GPIOD_TEST", objects::LIBGPIOD_TEST);
|
initmission::printAddObjectError("GPIOD_TEST", objects::LIBGPIOD_TEST);
|
||||||
}
|
}
|
||||||
#endif /* RPI_ADD_GPIO_TEST == 1 */
|
#endif /* RPI_ADD_GPIO_TEST == 1 */
|
||||||
#if RPI_ADD_UART_TEST == 1
|
#if OBSW_ADD_UART_TEST_CODE == 1
|
||||||
result = testTask->addComponent(objects::UART_TEST);
|
result = testTask->addComponent(objects::UART_TEST);
|
||||||
if(result != HasReturnvaluesIF::RETURN_OK) {
|
if (result != HasReturnvaluesIF::RETURN_OK) {
|
||||||
initmission::printAddObjectError("UART_TEST", objects::UART_TEST);
|
initmission::printAddObjectError("UART_TEST", objects::UART_TEST);
|
||||||
}
|
}
|
||||||
#endif /* RPI_ADD_GPIO_TEST == 1 */
|
#endif /* RPI_ADD_GPIO_TEST == 1 */
|
||||||
|
taskVec.push_back(testTask);
|
||||||
|
|
||||||
bool startTestPst = true;
|
bool startTestPst = true;
|
||||||
static_cast<void>(startTestPst);
|
static_cast<void>(startTestPst);
|
||||||
#if OBSW_ADD_TEST_PST == 1
|
#if OBSW_ADD_TEST_PST == 1
|
||||||
FixedTimeslotTaskIF* pstTestTask = factory->createFixedTimeslotTask("TEST_PST", 50,
|
FixedTimeslotTaskIF* pstTestTask = factory->createFixedTimeslotTask(
|
||||||
PeriodicTaskIF::MINIMUM_STACK_SIZE * 2, 2.0, missedDeadlineFunc);
|
"TEST_PST", 50, PeriodicTaskIF::MINIMUM_STACK_SIZE * 2, 2.0, missedDeadlineFunc);
|
||||||
result = pst::pstTest(pstTestTask);
|
result = pst::pstTest(pstTestTask);
|
||||||
if(result != HasReturnvaluesIF::RETURN_OK) {
|
if (result != HasReturnvaluesIF::RETURN_OK) {
|
||||||
sif::info << "initmission::initTasks: ACS PST empty or invalid" << std::endl;
|
sif::info << "initmission::initTasks: ACS PST empty or invalid" << std::endl;
|
||||||
startTestPst = false;
|
startTestPst = false;
|
||||||
}
|
}
|
||||||
#endif /* RPI_TEST_ACS_BOARD == 1 */
|
#endif /* RPI_TEST_ACS_BOARD == 1 */
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -1,9 +1,10 @@
|
|||||||
#ifndef BSP_LINUX_INITMISSION_H_
|
#ifndef BSP_LINUX_INITMISSION_H_
|
||||||
#define BSP_LINUX_INITMISSION_H_
|
#define BSP_LINUX_INITMISSION_H_
|
||||||
|
|
||||||
#include "fsfw/tasks/Typedef.h"
|
|
||||||
#include <vector>
|
#include <vector>
|
||||||
|
|
||||||
|
#include "fsfw/tasks/Typedef.h"
|
||||||
|
|
||||||
class PeriodicTaskIF;
|
class PeriodicTaskIF;
|
||||||
class TaskFactory;
|
class TaskFactory;
|
||||||
|
|
||||||
@ -11,14 +12,12 @@ namespace initmission {
|
|||||||
void initMission();
|
void initMission();
|
||||||
void initTasks();
|
void initTasks();
|
||||||
|
|
||||||
void createPstTasks(TaskFactory& factory,
|
void createPstTasks(TaskFactory& factory, TaskDeadlineMissedFunction missedDeadlineFunc,
|
||||||
TaskDeadlineMissedFunction missedDeadlineFunc,
|
std::vector<PeriodicTaskIF*>& taskVec);
|
||||||
std::vector<PeriodicTaskIF*> &taskVec);
|
void createTestTasks(TaskFactory& factory, TaskDeadlineMissedFunction missedDeadlineFunc,
|
||||||
void createTestTasks(TaskFactory& factory,
|
std::vector<PeriodicTaskIF*>& taskVec);
|
||||||
TaskDeadlineMissedFunction missedDeadlineFunc,
|
|
||||||
std::vector<PeriodicTaskIF*> &taskVec);
|
|
||||||
void createPusTasks(TaskFactory& factory, TaskDeadlineMissedFunction missedDeadlineFunc,
|
void createPusTasks(TaskFactory& factory, TaskDeadlineMissedFunction missedDeadlineFunc,
|
||||||
std::vector<PeriodicTaskIF*>& taskVec);
|
std::vector<PeriodicTaskIF*>& taskVec);
|
||||||
};
|
}; // namespace initmission
|
||||||
|
|
||||||
#endif /* BSP_LINUX_INITMISSION_H_ */
|
#endif /* BSP_LINUX_INITMISSION_H_ */
|
||||||
|
@ -1,47 +1,46 @@
|
|||||||
#include <devConf.h>
|
|
||||||
#include "ObjectFactory.h"
|
#include "ObjectFactory.h"
|
||||||
|
|
||||||
#include "objects/systemObjectList.h"
|
#include "OBSWConfig.h"
|
||||||
|
#include "devConf.h"
|
||||||
#include "devices/addresses.h"
|
#include "devices/addresses.h"
|
||||||
#include "devices/gpioIds.h"
|
#include "devices/gpioIds.h"
|
||||||
#include "OBSWConfig.h"
|
#include "fsfw/datapoollocal/LocalDataPoolManager.h"
|
||||||
#include "tmtc/apid.h"
|
#include "fsfw/tasks/TaskFactory.h"
|
||||||
#include "tmtc/pusIds.h"
|
#include "fsfw/tmtcpacket/pus/tm.h"
|
||||||
|
#include "fsfw/tmtcservices/CommandingServiceBase.h"
|
||||||
|
#include "fsfw/tmtcservices/PusServiceBase.h"
|
||||||
#include "linux/boardtest/LibgpiodTest.h"
|
#include "linux/boardtest/LibgpiodTest.h"
|
||||||
#include "linux/boardtest/SpiTestClass.h"
|
#include "linux/boardtest/SpiTestClass.h"
|
||||||
#include "linux/boardtest/UartTestClass.h"
|
#include "linux/boardtest/UartTestClass.h"
|
||||||
|
|
||||||
#include "mission/core/GenericFactory.h"
|
#include "mission/core/GenericFactory.h"
|
||||||
|
#include "mission/devices/GPSHyperionHandler.h"
|
||||||
|
#include "mission/devices/GyroADIS1650XHandler.h"
|
||||||
#include "mission/utility/TmFunnel.h"
|
#include "mission/utility/TmFunnel.h"
|
||||||
#include <mission/devices/GPSHyperionHandler.h>
|
#include "objects/systemObjectList.h"
|
||||||
#include "mission/devices/GyroADIS16507Handler.h"
|
#include "tmtc/apid.h"
|
||||||
|
#include "tmtc/pusIds.h"
|
||||||
#include "fsfw/datapoollocal/LocalDataPoolManager.h"
|
|
||||||
#include "fsfw/tmtcservices/CommandingServiceBase.h"
|
|
||||||
#include "fsfw/tmtcservices/PusServiceBase.h"
|
|
||||||
#include "fsfw/tmtcpacket/pus/tm.h"
|
|
||||||
#include "fsfw/tasks/TaskFactory.h"
|
|
||||||
|
|
||||||
/* UDP server includes */
|
/* UDP server includes */
|
||||||
#if OBSW_USE_TMTC_TCP_BRIDGE == 1
|
#if OBSW_USE_TMTC_TCP_BRIDGE == 1
|
||||||
#include <fsfw/src/fsfw/osal/common/TcpTmTcBridge.h>
|
#include <fsfw/src/fsfw/osal/common/TcpTmTcBridge.h>
|
||||||
#include <fsfw/src/fsfw/osal/common/TcpTmTcServer.h>
|
#include <fsfw/src/fsfw/osal/common/TcpTmTcServer.h>
|
||||||
#else
|
#else
|
||||||
#include "fsfw/osal/common/UdpTmTcBridge.h"
|
|
||||||
#include "fsfw/osal/common/UdpTcPollingTask.h"
|
#include "fsfw/osal/common/UdpTcPollingTask.h"
|
||||||
|
#include "fsfw/osal/common/UdpTmTcBridge.h"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#include "fsfw_hal/devicehandlers/MgmLIS3MDLHandler.h"
|
|
||||||
#include "fsfw_hal/devicehandlers/MgmRM3100Handler.h"
|
|
||||||
#include "fsfw_hal/devicehandlers/GyroL3GD20Handler.h"
|
|
||||||
#include "fsfw_hal/linux/gpio/LinuxLibgpioIF.h"
|
|
||||||
#include "fsfw_hal/linux/rpi/GpioRPi.h"
|
|
||||||
#include "fsfw_hal/common/gpio/GpioCookie.h"
|
|
||||||
#include "fsfw_hal/linux/spi/SpiCookie.h"
|
|
||||||
#include "fsfw_hal/linux/spi/SpiComIF.h"
|
|
||||||
#include <fsfw_hal/linux/uart/UartComIF.h>
|
#include <fsfw_hal/linux/uart/UartComIF.h>
|
||||||
#include <fsfw_hal/linux/uart/UartCookie.h>
|
#include <fsfw_hal/linux/uart/UartCookie.h>
|
||||||
|
|
||||||
|
#include "fsfw_hal/common/gpio/GpioCookie.h"
|
||||||
|
#include "fsfw_hal/devicehandlers/GyroL3GD20Handler.h"
|
||||||
|
#include "fsfw_hal/devicehandlers/MgmLIS3MDLHandler.h"
|
||||||
|
#include "fsfw_hal/devicehandlers/MgmRM3100Handler.h"
|
||||||
|
#include "fsfw_hal/linux/gpio/LinuxLibgpioIF.h"
|
||||||
|
#include "fsfw_hal/linux/rpi/GpioRPi.h"
|
||||||
|
#include "fsfw_hal/linux/spi/SpiComIF.h"
|
||||||
|
#include "fsfw_hal/linux/spi/SpiCookie.h"
|
||||||
|
|
||||||
void Factory::setStaticFrameworkObjectIds() {
|
void Factory::setStaticFrameworkObjectIds() {
|
||||||
PusServiceBase::packetSource = objects::PUS_PACKET_DISTRIBUTOR;
|
PusServiceBase::packetSource = objects::PUS_PACKET_DISTRIBUTOR;
|
||||||
PusServiceBase::packetDestination = objects::TM_FUNNEL;
|
PusServiceBase::packetDestination = objects::TM_FUNNEL;
|
||||||
@ -57,22 +56,10 @@ void Factory::setStaticFrameworkObjectIds() {
|
|||||||
TmPacketBase::timeStamperId = objects::TIME_STAMPER;
|
TmPacketBase::timeStamperId = objects::TIME_STAMPER;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void ObjectFactory::produce(void* args) {
|
||||||
|
|
||||||
void ObjectFactory::produce(void* args){
|
|
||||||
Factory::setStaticFrameworkObjectIds();
|
Factory::setStaticFrameworkObjectIds();
|
||||||
ObjectFactory::produceGenericObjects();
|
ObjectFactory::produceGenericObjects();
|
||||||
|
|
||||||
#if OBSW_USE_TMTC_TCP_BRIDGE == 1
|
|
||||||
auto tmtcBridge = new TcpTmTcBridge(objects::TMTC_BRIDGE, objects::CCSDS_PACKET_DISTRIBUTOR);
|
|
||||||
tmtcBridge->setMaxNumberOfPacketsStored(50);
|
|
||||||
new TcpTmTcServer(objects::TMTC_POLLING_TASK, objects::TMTC_BRIDGE);
|
|
||||||
#else
|
|
||||||
auto tmtcBridge = new UdpTmTcBridge(objects::TMTC_BRIDGE, objects::CCSDS_PACKET_DISTRIBUTOR);
|
|
||||||
tmtcBridge->setMaxNumberOfPacketsStored(50);
|
|
||||||
new UdpTcPollingTask(objects::TMTC_POLLING_TASK, objects::TMTC_BRIDGE);
|
|
||||||
#endif
|
|
||||||
|
|
||||||
GpioIF* gpioIF = new LinuxLibgpioIF(objects::GPIO_IF);
|
GpioIF* gpioIF = new LinuxLibgpioIF(objects::GPIO_IF);
|
||||||
GpioCookie* gpioCookie = nullptr;
|
GpioCookie* gpioCookie = nullptr;
|
||||||
static_cast<void>(gpioCookie);
|
static_cast<void>(gpioCookie);
|
||||||
@ -84,91 +71,99 @@ void ObjectFactory::produce(void* args){
|
|||||||
static_cast<void>(spiCookie);
|
static_cast<void>(spiCookie);
|
||||||
|
|
||||||
#if OBSW_ADD_ACS_BOARD == 1
|
#if OBSW_ADD_ACS_BOARD == 1
|
||||||
if(gpioCookie == nullptr) {
|
if (gpioCookie == nullptr) {
|
||||||
gpioCookie = new GpioCookie();
|
gpioCookie = new GpioCookie();
|
||||||
}
|
}
|
||||||
// TODO: Missing pin for Gyro 2
|
// TODO: Missing pin for Gyro 2
|
||||||
gpio::createRpiGpioConfig(gpioCookie, gpioIds::MGM_0_LIS3_CS, gpio::MGM_0_BCM_PIN,
|
gpio::createRpiGpioConfig(gpioCookie, gpioIds::MGM_0_LIS3_CS, gpio::MGM_0_BCM_PIN, "MGM_0_LIS3",
|
||||||
"MGM_0_LIS3", gpio::Direction::OUT, 1);
|
gpio::Direction::OUT, 1);
|
||||||
gpio::createRpiGpioConfig(gpioCookie, gpioIds::MGM_1_RM3100_CS, gpio::MGM_1_BCM_PIN,
|
gpio::createRpiGpioConfig(gpioCookie, gpioIds::MGM_1_RM3100_CS, gpio::MGM_1_BCM_PIN,
|
||||||
"MGM_1_RM3100", gpio::Direction::OUT, 1);
|
"MGM_1_RM3100", gpio::Direction::OUT, 1);
|
||||||
gpio::createRpiGpioConfig(gpioCookie, gpioIds::MGM_2_LIS3_CS, gpio::MGM_2_BCM_PIN,
|
gpio::createRpiGpioConfig(gpioCookie, gpioIds::MGM_2_LIS3_CS, gpio::MGM_2_BCM_PIN, "MGM_2_LIS3",
|
||||||
"MGM_2_LIS3", gpio::Direction::OUT, 1);
|
gpio::Direction::OUT, 1);
|
||||||
gpio::createRpiGpioConfig(gpioCookie, gpioIds::MGM_3_RM3100_CS, gpio::MGM_3_BCM_PIN,
|
gpio::createRpiGpioConfig(gpioCookie, gpioIds::MGM_3_RM3100_CS, gpio::MGM_3_BCM_PIN,
|
||||||
"MGM_3_RM3100", gpio::Direction::OUT, 1);
|
"MGM_3_RM3100", gpio::Direction::OUT, 1);
|
||||||
gpio::createRpiGpioConfig(gpioCookie, gpioIds::GYRO_0_ADIS_CS, gpio::GYRO_0_BCM_PIN,
|
gpio::createRpiGpioConfig(gpioCookie, gpioIds::GYRO_0_ADIS_CS, gpio::GYRO_0_BCM_PIN,
|
||||||
"GYRO_0_ADIS", gpio::Direction::OUT, 1);
|
"GYRO_0_ADIS", gpio::Direction::OUT, 1);
|
||||||
gpio::createRpiGpioConfig(gpioCookie, gpioIds::GYRO_1_L3G_CS, gpio::GYRO_1_BCM_PIN,
|
gpio::createRpiGpioConfig(gpioCookie, gpioIds::GYRO_1_L3G_CS, gpio::GYRO_1_BCM_PIN, "GYRO_1_L3G",
|
||||||
"GYRO_1_L3G", gpio::Direction::OUT, 1);
|
gpio::Direction::OUT, 1);
|
||||||
gpio::createRpiGpioConfig(gpioCookie, gpioIds::GYRO_2_ADIS_CS, gpio::GYRO_2_BCM_PIN,
|
gpio::createRpiGpioConfig(gpioCookie, gpioIds::GYRO_2_ADIS_CS, gpio::GYRO_2_BCM_PIN,
|
||||||
"GYRO_2_ADIS", gpio::Direction::OUT, 1);
|
"GYRO_2_ADIS", gpio::Direction::OUT, 1);
|
||||||
gpio::createRpiGpioConfig(gpioCookie, gpioIds::GYRO_3_L3G_CS, gpio::GYRO_3_BCM_PIN,
|
gpio::createRpiGpioConfig(gpioCookie, gpioIds::GYRO_3_L3G_CS, gpio::GYRO_3_BCM_PIN, "GYRO_3_L3G",
|
||||||
"GYRO_3_L3G", gpio::Direction::OUT, 1);
|
gpio::Direction::OUT, 1);
|
||||||
gpioIF->addGpios(gpioCookie);
|
gpioIF->addGpios(gpioCookie);
|
||||||
|
|
||||||
spiDev = "/dev/spidev0.1";
|
spiDev = "/dev/spidev0.1";
|
||||||
spiCookie = new SpiCookie(addresses::MGM_0_LIS3, gpioIds::MGM_0_LIS3_CS, spiDev,
|
spiCookie =
|
||||||
|
new SpiCookie(addresses::MGM_0_LIS3, gpioIds::MGM_0_LIS3_CS, spiDev,
|
||||||
MGMLIS3MDL::MAX_BUFFER_SIZE, spi::DEFAULT_LIS3_MODE, spi::DEFAULT_LIS3_SPEED);
|
MGMLIS3MDL::MAX_BUFFER_SIZE, spi::DEFAULT_LIS3_MODE, spi::DEFAULT_LIS3_SPEED);
|
||||||
auto mgmLis3Handler = new MgmLIS3MDLHandler(objects::MGM_0_LIS3_HANDLER,
|
auto mgmLis3Handler =
|
||||||
objects::SPI_COM_IF, spiCookie, 0);
|
new MgmLIS3MDLHandler(objects::MGM_0_LIS3_HANDLER, objects::SPI_COM_IF, spiCookie, 0);
|
||||||
mgmLis3Handler->setStartUpImmediately();
|
mgmLis3Handler->setStartUpImmediately();
|
||||||
#if FSFW_HAL_LIS3MDL_MGM_DEBUG == 1
|
#if FSFW_HAL_LIS3MDL_MGM_DEBUG == 1
|
||||||
mgmLis3Handler->setToGoToNormalMode(true);
|
mgmLis3Handler->setToGoToNormalMode(true);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
spiCookie = new SpiCookie(addresses::MGM_1_RM3100, gpioIds::MGM_1_RM3100_CS, spiDev,
|
spiCookie =
|
||||||
|
new SpiCookie(addresses::MGM_1_RM3100, gpioIds::MGM_1_RM3100_CS, spiDev,
|
||||||
RM3100::MAX_BUFFER_SIZE, spi::DEFAULT_RM3100_MODE, spi::DEFAULT_RM3100_SPEED);
|
RM3100::MAX_BUFFER_SIZE, spi::DEFAULT_RM3100_MODE, spi::DEFAULT_RM3100_SPEED);
|
||||||
auto mgmRm3100Handler = new MgmRM3100Handler(objects::MGM_1_RM3100_HANDLER,
|
auto mgmRm3100Handler =
|
||||||
objects::SPI_COM_IF, spiCookie, 0);
|
new MgmRM3100Handler(objects::MGM_1_RM3100_HANDLER, objects::SPI_COM_IF, spiCookie, 0);
|
||||||
mgmRm3100Handler->setStartUpImmediately();
|
mgmRm3100Handler->setStartUpImmediately();
|
||||||
#if FSFW_HAL_RM3100_MGM_DEBUG == 1
|
#if FSFW_HAL_RM3100_MGM_DEBUG == 1
|
||||||
mgmRm3100Handler->setToGoToNormalMode(true);
|
mgmRm3100Handler->setToGoToNormalMode(true);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
spiCookie = new SpiCookie(addresses::MGM_2_LIS3, gpioIds::MGM_2_LIS3_CS, spiDev,
|
spiCookie =
|
||||||
|
new SpiCookie(addresses::MGM_2_LIS3, gpioIds::MGM_2_LIS3_CS, spiDev,
|
||||||
MGMLIS3MDL::MAX_BUFFER_SIZE, spi::DEFAULT_LIS3_MODE, spi::DEFAULT_LIS3_SPEED);
|
MGMLIS3MDL::MAX_BUFFER_SIZE, spi::DEFAULT_LIS3_MODE, spi::DEFAULT_LIS3_SPEED);
|
||||||
mgmLis3Handler = new MgmLIS3MDLHandler(objects::MGM_2_LIS3_HANDLER,
|
mgmLis3Handler =
|
||||||
objects::SPI_COM_IF, spiCookie, 0);
|
new MgmLIS3MDLHandler(objects::MGM_2_LIS3_HANDLER, objects::SPI_COM_IF, spiCookie, 0);
|
||||||
mgmLis3Handler->setStartUpImmediately();
|
mgmLis3Handler->setStartUpImmediately();
|
||||||
#if FSFW_HAL_LIS3MDL_MGM_DEBUG == 1
|
#if FSFW_HAL_LIS3MDL_MGM_DEBUG == 1
|
||||||
mgmLis3Handler->setToGoToNormalMode(true);
|
mgmLis3Handler->setToGoToNormalMode(true);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
spiCookie = new SpiCookie(addresses::MGM_3_RM3100, gpioIds::MGM_3_RM3100_CS, spiDev,
|
spiCookie =
|
||||||
|
new SpiCookie(addresses::MGM_3_RM3100, gpioIds::MGM_3_RM3100_CS, spiDev,
|
||||||
RM3100::MAX_BUFFER_SIZE, spi::DEFAULT_RM3100_MODE, spi::DEFAULT_RM3100_SPEED);
|
RM3100::MAX_BUFFER_SIZE, spi::DEFAULT_RM3100_MODE, spi::DEFAULT_RM3100_SPEED);
|
||||||
mgmRm3100Handler = new MgmRM3100Handler(objects::MGM_3_RM3100_HANDLER,
|
mgmRm3100Handler =
|
||||||
objects::SPI_COM_IF, spiCookie, 0);
|
new MgmRM3100Handler(objects::MGM_3_RM3100_HANDLER, objects::SPI_COM_IF, spiCookie, 0);
|
||||||
mgmRm3100Handler->setStartUpImmediately();
|
mgmRm3100Handler->setStartUpImmediately();
|
||||||
#if FSFW_HAL_RM3100_MGM_DEBUG == 1
|
#if FSFW_HAL_RM3100_MGM_DEBUG == 1
|
||||||
mgmRm3100Handler->setToGoToNormalMode(true);
|
mgmRm3100Handler->setToGoToNormalMode(true);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
spiCookie = new SpiCookie(addresses::GYRO_0_ADIS, gpioIds::GYRO_0_ADIS_CS, spiDev,
|
spiCookie =
|
||||||
|
new SpiCookie(addresses::GYRO_0_ADIS, gpioIds::GYRO_0_ADIS_CS, spiDev,
|
||||||
ADIS16507::MAXIMUM_REPLY_SIZE, spi::DEFAULT_L3G_MODE, spi::DEFAULT_L3G_SPEED);
|
ADIS16507::MAXIMUM_REPLY_SIZE, spi::DEFAULT_L3G_MODE, spi::DEFAULT_L3G_SPEED);
|
||||||
auto adisHandler = new GyroADIS16507Handler(objects::GYRO_0_ADIS_HANDLER, objects::SPI_COM_IF,
|
auto adisHandler =
|
||||||
spiCookie);
|
new GyroADIS16507Handler(objects::GYRO_0_ADIS_HANDLER, objects::SPI_COM_IF, spiCookie);
|
||||||
adisHandler->setStartUpImmediately();
|
adisHandler->setStartUpImmediately();
|
||||||
spiCookie = new SpiCookie(addresses::GYRO_1_L3G, gpioIds::GYRO_1_L3G_CS, spiDev,
|
spiCookie =
|
||||||
L3GD20H::MAX_BUFFER_SIZE, spi::DEFAULT_L3G_MODE, spi::DEFAULT_L3G_SPEED);
|
new SpiCookie(addresses::GYRO_1_L3G, gpioIds::GYRO_1_L3G_CS, spiDev, L3GD20H::MAX_BUFFER_SIZE,
|
||||||
auto gyroL3gHandler = new GyroHandlerL3GD20H(objects::GYRO_1_L3G_HANDLER, objects::SPI_COM_IF,
|
spi::DEFAULT_L3G_MODE, spi::DEFAULT_L3G_SPEED);
|
||||||
spiCookie, 0);
|
auto gyroL3gHandler =
|
||||||
|
new GyroHandlerL3GD20H(objects::GYRO_1_L3G_HANDLER, objects::SPI_COM_IF, spiCookie, 0);
|
||||||
gyroL3gHandler->setStartUpImmediately();
|
gyroL3gHandler->setStartUpImmediately();
|
||||||
#if FSFW_HAL_L3GD20_GYRO_DEBUG== 1
|
#if FSFW_HAL_L3GD20_GYRO_DEBUG == 1
|
||||||
gyroL3gHandler->setToGoToNormalMode(true);
|
gyroL3gHandler->setToGoToNormalMode(true);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
spiCookie = new SpiCookie(addresses::GYRO_2_ADIS, gpioIds::GYRO_2_ADIS_CS, spiDev,
|
spiCookie =
|
||||||
|
new SpiCookie(addresses::GYRO_2_ADIS, gpioIds::GYRO_2_ADIS_CS, spiDev,
|
||||||
ADIS16507::MAXIMUM_REPLY_SIZE, spi::DEFAULT_L3G_MODE, spi::DEFAULT_L3G_SPEED);
|
ADIS16507::MAXIMUM_REPLY_SIZE, spi::DEFAULT_L3G_MODE, spi::DEFAULT_L3G_SPEED);
|
||||||
adisHandler = new GyroADIS16507Handler(objects::GYRO_2_ADIS_HANDLER, objects::SPI_COM_IF,
|
adisHandler =
|
||||||
spiCookie);
|
new GyroADIS16507Handler(objects::GYRO_2_ADIS_HANDLER, objects::SPI_COM_IF, spiCookie);
|
||||||
adisHandler->setStartUpImmediately();
|
adisHandler->setStartUpImmediately();
|
||||||
|
|
||||||
spiCookie = new SpiCookie(addresses::GYRO_3_L3G, gpioIds::GYRO_3_L3G_CS, spiDev,
|
spiCookie =
|
||||||
L3GD20H::MAX_BUFFER_SIZE, spi::DEFAULT_L3G_MODE, spi::DEFAULT_L3G_SPEED);
|
new SpiCookie(addresses::GYRO_3_L3G, gpioIds::GYRO_3_L3G_CS, spiDev, L3GD20H::MAX_BUFFER_SIZE,
|
||||||
gyroL3gHandler = new GyroHandlerL3GD20H(objects::GYRO_3_L3G_HANDLER, objects::SPI_COM_IF,
|
spi::DEFAULT_L3G_MODE, spi::DEFAULT_L3G_SPEED);
|
||||||
spiCookie, 0);
|
gyroL3gHandler =
|
||||||
|
new GyroHandlerL3GD20H(objects::GYRO_3_L3G_HANDLER, objects::SPI_COM_IF, spiCookie, 0);
|
||||||
gyroL3gHandler->setStartUpImmediately();
|
gyroL3gHandler->setStartUpImmediately();
|
||||||
#if FSFW_HAL_L3GD20_GYRO_DEBUG== 1
|
#if FSFW_HAL_L3GD20_GYRO_DEBUG == 1
|
||||||
gyroL3gHandler->setToGoToNormalMode(true);
|
gyroL3gHandler->setToGoToNormalMode(true);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
@ -180,14 +175,13 @@ void ObjectFactory::produce(void* args){
|
|||||||
}
|
}
|
||||||
|
|
||||||
void ObjectFactory::createTestTasks() {
|
void ObjectFactory::createTestTasks() {
|
||||||
|
|
||||||
new TestTask(objects::TEST_TASK);
|
new TestTask(objects::TEST_TASK);
|
||||||
|
|
||||||
#if RPI_ADD_SPI_TEST == 1
|
#if OBSW_ADD_SPI_TEST_CODE == 1
|
||||||
new SpiTestClass(objects::SPI_TEST, gpioIF);
|
new SpiTestClass(objects::SPI_TEST, gpioIF);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if RPI_ADD_UART_TEST == 1
|
#if OBSW_ADD_UART_TEST_CODE == 1
|
||||||
new UartTestClass(objects::UART_TEST);
|
new UartTestClass(objects::UART_TEST);
|
||||||
#else
|
#else
|
||||||
new UartComIF(objects::UART_COM_IF);
|
new UartComIF(objects::UART_COM_IF);
|
||||||
@ -208,7 +202,7 @@ void ObjectFactory::createTestTasks() {
|
|||||||
#endif /* RPI_LOOPBACK_TEST_GPIO == 1 */
|
#endif /* RPI_LOOPBACK_TEST_GPIO == 1 */
|
||||||
|
|
||||||
#if RPI_TEST_ADIS16507 == 1
|
#if RPI_TEST_ADIS16507 == 1
|
||||||
if(gpioCookie == nullptr) {
|
if (gpioCookie == nullptr) {
|
||||||
gpioCookie = new GpioCookie();
|
gpioCookie = new GpioCookie();
|
||||||
}
|
}
|
||||||
gpio::createRpiGpioConfig(gpioCookie, gpioIds::GYRO_0_ADIS_CS, gpio::GYRO_0_BCM_PIN,
|
gpio::createRpiGpioConfig(gpioCookie, gpioIds::GYRO_0_ADIS_CS, gpio::GYRO_0_BCM_PIN,
|
||||||
@ -217,20 +211,20 @@ void ObjectFactory::createTestTasks() {
|
|||||||
|
|
||||||
spiDev = "/dev/spidev0.1";
|
spiDev = "/dev/spidev0.1";
|
||||||
spiCookie = new SpiCookie(addresses::GYRO_0_ADIS, gpioIds::GYRO_0_ADIS_CS, spiDev,
|
spiCookie = new SpiCookie(addresses::GYRO_0_ADIS, gpioIds::GYRO_0_ADIS_CS, spiDev,
|
||||||
ADIS16507::MAXIMUM_REPLY_SIZE, spi::DEFAULT_ADIS16507_MODE, spi::DEFAULT_ADIS16507_SPEED,
|
ADIS16507::MAXIMUM_REPLY_SIZE, spi::DEFAULT_ADIS16507_MODE,
|
||||||
nullptr, nullptr);
|
spi::DEFAULT_ADIS16507_SPEED, nullptr, nullptr);
|
||||||
auto adisGyroHandler = new GyroADIS16507Handler(objects::GYRO_0_ADIS_HANDLER, objects::SPI_COM_IF, spiCookie);
|
auto adisGyroHandler =
|
||||||
|
new GyroADIS16507Handler(objects::GYRO_0_ADIS_HANDLER, objects::SPI_COM_IF, spiCookie);
|
||||||
adisGyroHandler->setStartUpImmediately();
|
adisGyroHandler->setStartUpImmediately();
|
||||||
#endif /* RPI_TEST_ADIS16507 == 1 */
|
#endif /* RPI_TEST_ADIS16507 == 1 */
|
||||||
|
|
||||||
#if RPI_TEST_GPS_HANDLER == 1
|
#if RPI_TEST_GPS_HANDLER == 1
|
||||||
UartCookie* uartCookie = new UartCookie(objects::GPS0_HANDLER, "/dev/serial0",
|
UartCookie* uartCookie =
|
||||||
UartModes::CANONICAL, 9600, 1024);
|
new UartCookie(objects::GPS0_HANDLER, "/dev/serial0", UartModes::CANONICAL, 9600, 1024);
|
||||||
uartCookie->setToFlushInput(true);
|
uartCookie->setToFlushInput(true);
|
||||||
uartCookie->setReadCycles(6);
|
uartCookie->setReadCycles(6);
|
||||||
GPSHyperionHandler* gpsHandler = new GPSHyperionHandler(objects::GPS0_HANDLER,
|
GPSHyperionHandler* gpsHandler =
|
||||||
objects::UART_COM_IF, uartCookie, false);
|
new GPSHyperionHandler(objects::GPS0_HANDLER, objects::UART_COM_IF, uartCookie, false);
|
||||||
gpsHandler->setStartUpImmediately();
|
gpsHandler->setStartUpImmediately();
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -1,12 +1,11 @@
|
|||||||
#ifndef BSP_LINUX_OBJECTFACTORY_H_
|
#ifndef BSP_LINUX_OBJECTFACTORY_H_
|
||||||
#define BSP_LINUX_OBJECTFACTORY_H_
|
#define BSP_LINUX_OBJECTFACTORY_H_
|
||||||
|
|
||||||
|
|
||||||
namespace ObjectFactory {
|
namespace ObjectFactory {
|
||||||
void setStatics();
|
void setStatics();
|
||||||
void produce(void* args);
|
void produce(void* args);
|
||||||
|
|
||||||
void createTestTasks();
|
void createTestTasks();
|
||||||
};
|
}; // namespace ObjectFactory
|
||||||
|
|
||||||
#endif /* BSP_LINUX_OBJECTFACTORY_H_ */
|
#endif /* BSP_LINUX_OBJECTFACTORY_H_ */
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
target_sources(${TARGET_NAME} PRIVATE
|
target_sources(${OBSW_NAME} PRIVATE
|
||||||
print.c
|
print.c
|
||||||
)
|
)
|
||||||
|
|
||||||
target_include_directories(${TARGET_NAME} PUBLIC
|
target_include_directories(${OBSW_NAME} PUBLIC
|
||||||
${CMAKE_CURRENT_SOURCE_DIR}
|
${CMAKE_CURRENT_SOURCE_DIR}
|
||||||
)
|
)
|
||||||
|
@ -7,7 +7,8 @@ extern "C" void __gcov_flush();
|
|||||||
#else
|
#else
|
||||||
void __gcov_flush() {
|
void __gcov_flush() {
|
||||||
sif::info << "GCC GCOV: Please supply GCOV=1 in Makefile if "
|
sif::info << "GCC GCOV: Please supply GCOV=1 in Makefile if "
|
||||||
"coverage information is desired.\n" << std::flush;
|
"coverage information is desired.\n"
|
||||||
|
<< std::flush;
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
@ -1,14 +1,10 @@
|
|||||||
#include <bsp_q7s/boardconfig/print.h>
|
#include <bsp_linux_board/boardconfig/print.h>
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
|
|
||||||
void printChar(const char* character, bool errStream) {
|
void printChar(const char* character, bool errStream) {
|
||||||
if(errStream) {
|
if (errStream) {
|
||||||
putc(*character, stderr);
|
putc(*character, stderr);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
putc(*character, stdout);
|
putc(*character, stdout);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
target_sources(${TARGET_NAME} PRIVATE
|
target_sources(${OBSW_NAME} PRIVATE
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
|
@ -1,11 +1,10 @@
|
|||||||
|
#include <iostream>
|
||||||
|
|
||||||
#include "InitMission.h"
|
#include "InitMission.h"
|
||||||
#include "OBSWConfig.h"
|
#include "OBSWConfig.h"
|
||||||
#include "OBSWVersion.h"
|
#include "OBSWVersion.h"
|
||||||
|
|
||||||
#include "fsfw/FSFWVersion.h"
|
|
||||||
#include "fsfw/tasks/TaskFactory.h"
|
#include "fsfw/tasks/TaskFactory.h"
|
||||||
|
#include "fsfw/version.h"
|
||||||
#include <iostream>
|
|
||||||
|
|
||||||
#ifdef RASPBERRY_PI
|
#ifdef RASPBERRY_PI
|
||||||
static const char* const BOARD_NAME = "Raspberry Pi";
|
static const char* const BOARD_NAME = "Raspberry Pi";
|
||||||
@ -19,21 +18,17 @@ static const char* const BOARD_NAME = "Unknown Board";
|
|||||||
* @brief This is the main program and entry point for the Raspberry Pi.
|
* @brief This is the main program and entry point for the Raspberry Pi.
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
int main(void)
|
int main(void) {
|
||||||
{
|
|
||||||
std::cout << "-- EIVE OBSW --" << std::endl;
|
std::cout << "-- EIVE OBSW --" << std::endl;
|
||||||
std::cout << "-- Compiled for Linux board " << BOARD_NAME << " --" << std::endl;
|
std::cout << "-- Compiled for Linux board " << BOARD_NAME << " --" << std::endl;
|
||||||
std::cout << "-- OBSW " << SW_NAME << " v" << SW_VERSION << "." << SW_SUBVERSION <<
|
std::cout << "-- OBSW " << SW_NAME << " v" << SW_VERSION << "." << SW_SUBVERSION << "."
|
||||||
"." << SW_REVISION << ", FSFW v" << FSFW_VERSION << "." << FSFW_SUBVERSION <<
|
<< SW_REVISION << ", FSFW v" << fsfw::FSFW_VERSION << "--" << std::endl;
|
||||||
FSFW_REVISION << "--" << std::endl;
|
|
||||||
std::cout << "-- " << __DATE__ << " " << __TIME__ << " --" << std::endl;
|
std::cout << "-- " << __DATE__ << " " << __TIME__ << " --" << std::endl;
|
||||||
|
|
||||||
initmission::initMission();
|
initmission::initMission();
|
||||||
|
|
||||||
for(;;) {
|
for (;;) {
|
||||||
/* Suspend main thread by sleeping it. */
|
/* Suspend main thread by sleeping it. */
|
||||||
TaskFactory::delayTask(5000);
|
TaskFactory::delayTask(5000);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -1,17 +1,25 @@
|
|||||||
target_sources(${TARGET_NAME} PUBLIC
|
#simple mode
|
||||||
|
add_executable(${SIMPLE_OBSW_NAME} EXCLUDE_FROM_ALL)
|
||||||
|
target_compile_definitions(${SIMPLE_OBSW_NAME} PRIVATE "Q7S_SIMPLE_MODE")
|
||||||
|
target_sources(${SIMPLE_OBSW_NAME} PUBLIC
|
||||||
|
main.cpp
|
||||||
|
)
|
||||||
|
#I think this is unintentional? (produces linker errors for stuff in /linux)
|
||||||
|
target_link_libraries(${SIMPLE_OBSW_NAME} PUBLIC
|
||||||
|
${LIB_FSFW_NAME}
|
||||||
|
)
|
||||||
|
target_compile_definitions(${SIMPLE_OBSW_NAME} PRIVATE "Q7S_SIMPLE_MODE")
|
||||||
|
add_subdirectory(simple)
|
||||||
|
|
||||||
|
target_sources(${OBSW_NAME} PUBLIC
|
||||||
main.cpp
|
main.cpp
|
||||||
)
|
)
|
||||||
|
|
||||||
add_subdirectory(boardtest)
|
add_subdirectory(boardtest)
|
||||||
|
|
||||||
if(Q7S_SIMPLE_MODE)
|
add_subdirectory(boardconfig)
|
||||||
add_subdirectory(simple)
|
add_subdirectory(comIF)
|
||||||
else()
|
add_subdirectory(core)
|
||||||
add_subdirectory(boardconfig)
|
add_subdirectory(memory)
|
||||||
add_subdirectory(comIF)
|
add_subdirectory(callbacks)
|
||||||
add_subdirectory(gpio)
|
add_subdirectory(xadc)
|
||||||
add_subdirectory(core)
|
|
||||||
add_subdirectory(memory)
|
|
||||||
add_subdirectory(callbacks)
|
|
||||||
add_subdirectory(devices)
|
|
||||||
endif()
|
|
||||||
|
@ -1,7 +1,12 @@
|
|||||||
target_sources(${TARGET_NAME} PRIVATE
|
target_sources(${OBSW_NAME} PRIVATE
|
||||||
print.c
|
print.c
|
||||||
)
|
)
|
||||||
|
|
||||||
target_include_directories(${TARGET_NAME} PUBLIC
|
target_sources(${SIMPLE_OBSW_NAME} PRIVATE
|
||||||
|
print.c
|
||||||
|
)
|
||||||
|
|
||||||
|
|
||||||
|
target_include_directories(${OBSW_NAME} PUBLIC
|
||||||
${CMAKE_CURRENT_SOURCE_DIR}
|
${CMAKE_CURRENT_SOURCE_DIR}
|
||||||
)
|
)
|
||||||
|
@ -3,74 +3,101 @@
|
|||||||
|
|
||||||
namespace q7s {
|
namespace q7s {
|
||||||
|
|
||||||
static constexpr char SPI_DEFAULT_DEV[] = "/dev/spidev2.0";
|
static constexpr char SPI_DEFAULT_DEV[] = "/dev/spi-main";
|
||||||
static constexpr char SPI_RW_DEV[] = "/dev/spidev3.0";
|
static constexpr char SPI_RW_DEV[] = "/dev/spi-rw";
|
||||||
|
|
||||||
static constexpr char I2C_DEFAULT_DEV[] = "/dev/i2c-1";
|
static constexpr char I2C_DEFAULT_DEV[] = "/dev/i2c-eive";
|
||||||
|
|
||||||
static constexpr char UART_GNSS_DEV[] = "/dev/ttyUL0";
|
static constexpr char UART_GNSS_DEV[] = "/dev/ul-gps";
|
||||||
static constexpr char UART_PLOC_MPSOC_DEV[] = "/dev/ttyUL2";
|
static constexpr char UART_PLOC_MPSOC_DEV[] = "/dev/ul-plmpsoc";
|
||||||
static constexpr char UART_PLOC_SUPERVSIOR_DEV[] = "/dev/ttyUL3";
|
static constexpr char UART_PLOC_SUPERVSIOR_DEV[] = "/dev/ul-plsv";
|
||||||
static constexpr char UART_SYRLINKS_DEV[] = "/dev/ttyUL4";
|
static constexpr char UART_SYRLINKS_DEV[] = "/dev/ul-syrlinks";
|
||||||
static constexpr char UART_STAR_TRACKER_DEV[] = "/dev/ttyUL7";
|
static constexpr char UART_STAR_TRACKER_DEV[] = "/dev/ul-str";
|
||||||
|
|
||||||
static constexpr char UIO_PDEC_REGISTERS[] = "/dev/uio0";
|
static constexpr char UIO_PDEC_REGISTERS[] = "/dev/uio0";
|
||||||
static constexpr char UIO_PDEC_CONFIG_MEMORY[] = "/dev/uio2";
|
static constexpr char UIO_PDEC_CONFIG_MEMORY[] = "/dev/uio2";
|
||||||
static constexpr char UIO_PDEC_RAM[] = "/dev/uio3";
|
static constexpr char UIO_PDEC_RAM[] = "/dev/uio3";
|
||||||
|
static constexpr char UIO_PTME[] = "/dev/uio1";
|
||||||
|
static constexpr int MAP_ID_PTME_CONFIG = 3;
|
||||||
|
|
||||||
|
namespace uiomapids {
|
||||||
|
static const int PTME_VC0 = 0;
|
||||||
|
static const int PTME_VC1 = 1;
|
||||||
|
static const int PTME_VC2 = 2;
|
||||||
|
static const int PTME_VC3 = 3;
|
||||||
|
static const int PTME_CONFIG = 4;
|
||||||
|
} // namespace uiomapids
|
||||||
|
|
||||||
namespace gpioNames {
|
namespace gpioNames {
|
||||||
static constexpr char GYRO_0_ADIS_CS[] = "gyro_0_adis_chip_select";
|
|
||||||
static constexpr char GYRO_1_L3G_CS[] = "gyro_1_l3g_chip_select";
|
static constexpr char GYRO_0_ADIS_CS[] = "gyro_0_adis_chip_select";
|
||||||
static constexpr char GYRO_2_ADIS_CS[] = "gyro_2_adis_chip_select";
|
static constexpr char GYRO_1_L3G_CS[] = "gyro_1_l3g_chip_select";
|
||||||
static constexpr char GYRO_3_L3G_CS[] = "gyro_3_l3g_chip_select";
|
static constexpr char GYRO_2_ADIS_CS[] = "gyro_2_adis_chip_select";
|
||||||
static constexpr char MGM_0_CS[] = "mgm_0_lis3_chip_select";
|
static constexpr char GYRO_3_L3G_CS[] = "gyro_3_l3g_chip_select";
|
||||||
static constexpr char MGM_1_CS[] = "mgm_1_rm3100_chip_select";
|
static constexpr char MGM_0_CS[] = "mgm_0_lis3_chip_select";
|
||||||
static constexpr char MGM_2_CS[] = "mgm_2_lis3_chip_select";
|
static constexpr char MGM_1_CS[] = "mgm_1_rm3100_chip_select";
|
||||||
static constexpr char MGM_3_CS[] = "mgm_3_rm3100_chip_select";
|
static constexpr char MGM_2_CS[] = "mgm_2_lis3_chip_select";
|
||||||
static constexpr char RESET_GNSS_0[] = "reset_gnss_0";
|
static constexpr char MGM_3_CS[] = "mgm_3_rm3100_chip_select";
|
||||||
static constexpr char RESET_GNSS_1[] = "reset_gnss_1";
|
static constexpr char RESET_GNSS_0[] = "reset_gnss_0";
|
||||||
static constexpr char GNSS_0_ENABLE[] = "enable_gnss_0";
|
static constexpr char RESET_GNSS_1[] = "reset_gnss_1";
|
||||||
static constexpr char GNSS_1_ENABLE[] = "enable_gnss_1";
|
static constexpr char GNSS_0_ENABLE[] = "enable_gnss_0";
|
||||||
static constexpr char GYRO_0_ENABLE[] = "enable_gyro_0";
|
static constexpr char GNSS_1_ENABLE[] = "enable_gnss_1";
|
||||||
static constexpr char GYRO_2_ENABLE[] = "enable_gyro_2";
|
static constexpr char GYRO_0_ENABLE[] = "enable_gyro_0";
|
||||||
static constexpr char HEATER_0[] = "heater0";
|
static constexpr char GYRO_2_ENABLE[] = "enable_gyro_2";
|
||||||
static constexpr char HEATER_1[] = "heater1";
|
static constexpr char GNSS_SELECT[] = "gnss_mux_select";
|
||||||
static constexpr char HEATER_2[] = "heater2";
|
static constexpr char GNSS_MUX_SELECT[] = "gnss_mux_select";
|
||||||
static constexpr char HEATER_3[] = "heater3";
|
|
||||||
static constexpr char HEATER_4[] = "heater4";
|
static constexpr char HEATER_0[] = "heater0";
|
||||||
static constexpr char HEATER_5[] = "heater5";
|
static constexpr char HEATER_1[] = "heater1";
|
||||||
static constexpr char HEATER_6[] = "heater6";
|
static constexpr char HEATER_2[] = "heater2";
|
||||||
static constexpr char HEATER_7[] = "heater7";
|
static constexpr char HEATER_3[] = "heater3";
|
||||||
static constexpr char SA_DPL_PIN_0[] = "sa_dpl_0";
|
static constexpr char HEATER_4[] = "heater4";
|
||||||
static constexpr char SA_DPL_PIN_1[] = "sa_dpl_1";
|
static constexpr char HEATER_5[] = "heater5";
|
||||||
static constexpr char SPI_MUX_BIT_1_PIN[] = "spi_mux_bit_1";
|
static constexpr char HEATER_6[] = "heater6";
|
||||||
static constexpr char SPI_MUX_BIT_2_PIN[] = "spi_mux_bit_2";
|
static constexpr char HEATER_7[] = "heater7";
|
||||||
static constexpr char SPI_MUX_BIT_3_PIN[] = "spi_mux_bit_3";
|
static constexpr char SA_DPL_PIN_0[] = "sa_dpl_0";
|
||||||
static constexpr char SPI_MUX_BIT_4_PIN[] = "spi_mux_bit_4";
|
static constexpr char SA_DPL_PIN_1[] = "sa_dpl_1";
|
||||||
static constexpr char SPI_MUX_BIT_5_PIN[] = "spi_mux_bit_5";
|
static constexpr char SPI_MUX_BIT_0_PIN[] = "spi_mux_bit_0";
|
||||||
static constexpr char SPI_MUX_BIT_6_PIN[] = "spi_mux_bit_6";
|
static constexpr char SPI_MUX_BIT_1_PIN[] = "spi_mux_bit_1";
|
||||||
static constexpr char EN_RW_CS[] = "en_rw_cs";
|
static constexpr char SPI_MUX_BIT_2_PIN[] = "spi_mux_bit_2";
|
||||||
static constexpr char EN_RW_1[] = "enable_rw_1";
|
static constexpr char SPI_MUX_BIT_3_PIN[] = "spi_mux_bit_3";
|
||||||
static constexpr char EN_RW_2[] = "enable_rw_2";
|
static constexpr char SPI_MUX_BIT_4_PIN[] = "spi_mux_bit_4";
|
||||||
static constexpr char EN_RW_3[] = "enable_rw_3";
|
static constexpr char SPI_MUX_BIT_5_PIN[] = "spi_mux_bit_5";
|
||||||
static constexpr char EN_RW_4[] = "enable_rw_4";
|
static constexpr char EN_RW_CS[] = "en_rw_cs";
|
||||||
static constexpr char GNSS_MUX_SELECT[] = "gnss_mux_select";
|
static constexpr char EN_RW_1[] = "enable_rw_1";
|
||||||
static constexpr char RAD_SENSOR_CHIP_SELECT[] = "rad_sensor_chip_select";
|
static constexpr char EN_RW_2[] = "enable_rw_2";
|
||||||
static constexpr char PAPB_BUSY_SIGNAL_VC0[] = "papb_busy_signal_vc0";
|
static constexpr char EN_RW_3[] = "enable_rw_3";
|
||||||
static constexpr char PAPB_EMPTY_SIGNAL_VC0[] = "papb_empty_signal_vc0";
|
static constexpr char EN_RW_4[] = "enable_rw_4";
|
||||||
static constexpr char PAPB_BUSY_SIGNAL_VC1[] = "papb_busy_signal_vc1";
|
|
||||||
static constexpr char PAPB_EMPTY_SIGNAL_VC1[] = "papb_empty_signal_vc1";
|
static constexpr char RAD_SENSOR_CHIP_SELECT[] = "rad_sensor_chip_select";
|
||||||
static constexpr char PAPB_BUSY_SIGNAL_VC2[] = "papb_busy_signal_vc2";
|
static constexpr char ENABLE_RADFET[] = "enable_radfet";
|
||||||
static constexpr char PAPB_EMPTY_SIGNAL_VC2[] = "papb_empty_signal_vc2";
|
static constexpr char PAPB_BUSY_SIGNAL_VC0[] = "papb_busy_signal_vc0";
|
||||||
static constexpr char PAPB_BUSY_SIGNAL_VC3[] = "papb_busy_signal_vc3";
|
static constexpr char PAPB_EMPTY_SIGNAL_VC0[] = "papb_empty_signal_vc0";
|
||||||
static constexpr char PAPB_EMPTY_SIGNAL_VC3[] = "papb_empty_signal_vc3";
|
static constexpr char PAPB_BUSY_SIGNAL_VC1[] = "papb_busy_signal_vc1";
|
||||||
static constexpr char RS485_EN_TX_CLOCK[] = "tx_clock_enable_ltc2872";
|
static constexpr char PAPB_EMPTY_SIGNAL_VC1[] = "papb_empty_signal_vc1";
|
||||||
static constexpr char RS485_EN_TX_DATA[] = "tx_data_enable_ltc2872";
|
static constexpr char PAPB_BUSY_SIGNAL_VC2[] = "papb_busy_signal_vc2";
|
||||||
static constexpr char RS485_EN_RX_CLOCK[] = "rx_clock_enable_ltc2872";
|
static constexpr char PAPB_EMPTY_SIGNAL_VC2[] = "papb_empty_signal_vc2";
|
||||||
static constexpr char RS485_EN_RX_DATA[] = "rx_data_enable_ltc2872";
|
static constexpr char PAPB_BUSY_SIGNAL_VC3[] = "papb_busy_signal_vc3";
|
||||||
static constexpr char PDEC_RESET[] = "pdec_reset";
|
static constexpr char PAPB_EMPTY_SIGNAL_VC3[] = "papb_empty_signal_vc3";
|
||||||
static constexpr char BIT_RATE_SEL[] = "bit_rate_sel";
|
static constexpr char RS485_EN_TX_CLOCK[] = "tx_clock_enable_ltc2872";
|
||||||
}
|
static constexpr char RS485_EN_TX_DATA[] = "tx_data_enable_ltc2872";
|
||||||
}
|
static constexpr char RS485_EN_RX_CLOCK[] = "rx_clock_enable_ltc2872";
|
||||||
|
static constexpr char RS485_EN_RX_DATA[] = "rx_data_enable_ltc2872";
|
||||||
|
static constexpr char PDEC_RESET[] = "pdec_reset";
|
||||||
|
|
||||||
|
static constexpr char PL_PCDU_ENABLE_VBAT0[] = "enable_plpcdu_vbat0";
|
||||||
|
static constexpr char PL_PCDU_ENABLE_VBAT1[] = "enable_plpcdu_vbat1";
|
||||||
|
static constexpr char PL_PCDU_ENABLE_DRO[] = "enable_plpcdu_dro";
|
||||||
|
static constexpr char PL_PCDU_ENABLE_X8[] = "enable_plpcdu_x8";
|
||||||
|
static constexpr char PL_PCDU_ENABLE_TX[] = "enable_plpcdu_tx";
|
||||||
|
static constexpr char PL_PCDU_ENABLE_HPA[] = "enable_plpcdu_hpa";
|
||||||
|
static constexpr char PL_PCDU_ENABLE_MPA[] = "enable_plpcdu_mpa";
|
||||||
|
static constexpr char PL_PCDU_ADC_CS[] = "plpcdu_adc_chip_select";
|
||||||
|
|
||||||
|
static constexpr char ENABLE_SUPV_UART[] = "enable_supv_uart";
|
||||||
|
static constexpr char ENABLE_MPSOC_UART[] = "enable_mpsoc_uart";
|
||||||
|
|
||||||
|
} // namespace gpioNames
|
||||||
|
} // namespace q7s
|
||||||
|
|
||||||
#endif /* BSP_Q7S_BOARDCONFIG_BUSCONF_H_ */
|
#endif /* BSP_Q7S_BOARDCONFIG_BUSCONF_H_ */
|
||||||
|
@ -7,7 +7,8 @@ extern "C" void __gcov_flush();
|
|||||||
#else
|
#else
|
||||||
void __gcov_flush() {
|
void __gcov_flush() {
|
||||||
sif::info << "GCC GCOV: Please supply GCOV=1 in Makefile if "
|
sif::info << "GCC GCOV: Please supply GCOV=1 in Makefile if "
|
||||||
"coverage information is desired.\n" << std::flush;
|
"coverage information is desired.\n"
|
||||||
|
<< std::flush;
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
@ -2,13 +2,9 @@
|
|||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
|
|
||||||
void printChar(const char* character, bool errStream) {
|
void printChar(const char* character, bool errStream) {
|
||||||
if(errStream) {
|
if (errStream) {
|
||||||
putc(*character, stderr);
|
putc(*character, stderr);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
putc(*character, stdout);
|
putc(*character, stdout);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@ -3,8 +3,6 @@
|
|||||||
|
|
||||||
#include <cstdint>
|
#include <cstdint>
|
||||||
|
|
||||||
#cmakedefine01 Q7S_SIMPLE_MODE
|
|
||||||
|
|
||||||
/*******************************************************************/
|
/*******************************************************************/
|
||||||
/** All of the following flags should be enabled for mission code */
|
/** All of the following flags should be enabled for mission code */
|
||||||
/*******************************************************************/
|
/*******************************************************************/
|
||||||
@ -31,6 +29,10 @@
|
|||||||
|
|
||||||
#define Q7S_SIMPLE_ADD_FILE_SYSTEM_TEST 0
|
#define Q7S_SIMPLE_ADD_FILE_SYSTEM_TEST 0
|
||||||
|
|
||||||
|
#ifndef Q7S_SIMPLE_MODE
|
||||||
|
#define Q7S_SIMPLE_MODE 0
|
||||||
|
#endif
|
||||||
|
|
||||||
namespace config {
|
namespace config {
|
||||||
|
|
||||||
static const uint32_t SD_CARD_ACCESS_MUTEX_TIMEOUT = 50;
|
static const uint32_t SD_CARD_ACCESS_MUTEX_TIMEOUT = 50;
|
||||||
|
@ -1,8 +1,10 @@
|
|||||||
target_sources(${TARGET_NAME} PRIVATE
|
target_sources(${OBSW_NAME} PRIVATE
|
||||||
FileSystemTest.cpp
|
FileSystemTest.cpp
|
||||||
Q7STestTask.cpp
|
Q7STestTask.cpp
|
||||||
)
|
)
|
||||||
|
|
||||||
|
if(EIVE_BUILD_Q7S_SIMPLE_MODE)
|
||||||
|
target_sources(${SIMPLE_OBSW_NAME} PRIVATE
|
||||||
|
FileSystemTest.cpp
|
||||||
|
)
|
||||||
|
endif()
|
@ -1,26 +1,23 @@
|
|||||||
#include "FileSystemTest.h"
|
#include "FileSystemTest.h"
|
||||||
|
|
||||||
|
#include <cstdlib>
|
||||||
|
#include <iostream>
|
||||||
|
|
||||||
#include "fsfw/timemanager/Stopwatch.h"
|
#include "fsfw/timemanager/Stopwatch.h"
|
||||||
|
|
||||||
#include <iostream>
|
enum SdCard { SDC0, SDC1 };
|
||||||
#include <cstdlib>
|
|
||||||
|
|
||||||
enum SdCard {
|
|
||||||
SDC0,
|
|
||||||
SDC1
|
|
||||||
};
|
|
||||||
|
|
||||||
FileSystemTest::FileSystemTest() {
|
FileSystemTest::FileSystemTest() {
|
||||||
using namespace std;
|
using namespace std;
|
||||||
SdCard sdCard = SdCard::SDC0;
|
SdCard sdCard = SdCard::SDC0;
|
||||||
cout << "SD Card Test for SD card " << static_cast<int>(sdCard) << std::endl;
|
cout << "SD Card Test for SD card " << static_cast<int>(sdCard) << std::endl;
|
||||||
//Stopwatch stopwatch;
|
// Stopwatch stopwatch;
|
||||||
std::system("q7hw sd info all > /tmp/sd_status.txt");
|
std::system("q7hw sd info all > /tmp/sd_status.txt");
|
||||||
//stopwatch.stop(true);
|
// stopwatch.stop(true);
|
||||||
std::system("q7hw sd set 0 on > /tmp/sd_set.txt");
|
std::system("q7hw sd set 0 on > /tmp/sd_set.txt");
|
||||||
//stopwatch.stop(true);
|
// stopwatch.stop(true);
|
||||||
std::system("q7hw sd set 0 off > /tmp/sd_set.txt");
|
std::system("q7hw sd set 0 off > /tmp/sd_set.txt");
|
||||||
//stopwatch.stop(true);
|
// stopwatch.stop(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
FileSystemTest::~FileSystemTest() {
|
FileSystemTest::~FileSystemTest() {}
|
||||||
}
|
|
||||||
|
@ -2,12 +2,11 @@
|
|||||||
#define BSP_Q7S_BOARDTEST_FILESYSTEMTEST_H_
|
#define BSP_Q7S_BOARDTEST_FILESYSTEMTEST_H_
|
||||||
|
|
||||||
class FileSystemTest {
|
class FileSystemTest {
|
||||||
public:
|
public:
|
||||||
FileSystemTest();
|
FileSystemTest();
|
||||||
virtual~ FileSystemTest();
|
virtual ~FileSystemTest();
|
||||||
private:
|
|
||||||
|
private:
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
#endif /* BSP_Q7S_BOARDTEST_FILESYSTEMTEST_H_ */
|
#endif /* BSP_Q7S_BOARDTEST_FILESYSTEMTEST_H_ */
|
||||||
|
@ -1,41 +1,62 @@
|
|||||||
|
#include "Q7STestTask.h"
|
||||||
|
|
||||||
#include <bsp_q7s/core/CoreController.h>
|
#include <bsp_q7s/core/CoreController.h>
|
||||||
#include <bsp_q7s/memory/FileSystemHandler.h>
|
#include <bsp_q7s/memory/FileSystemHandler.h>
|
||||||
|
#include <bsp_q7s/xadc/Xadc.h>
|
||||||
#include <fsfw/objectmanager/ObjectManager.h>
|
#include <fsfw/objectmanager/ObjectManager.h>
|
||||||
#include "Q7STestTask.h"
|
#include <gps.h>
|
||||||
|
#include <libgpsmm.h>
|
||||||
|
|
||||||
|
#include <cstdio>
|
||||||
|
#include <ctime>
|
||||||
|
#include <fstream>
|
||||||
|
#include <iomanip>
|
||||||
|
#include <iostream>
|
||||||
|
#include <nlohmann/json.hpp>
|
||||||
|
|
||||||
#include "bsp_q7s/memory/SdCardManager.h"
|
#include "bsp_q7s/memory/SdCardManager.h"
|
||||||
#include "bsp_q7s/memory/scratchApi.h"
|
#include "bsp_q7s/memory/scratchApi.h"
|
||||||
|
|
||||||
#include "fsfw/timemanager/Stopwatch.h"
|
|
||||||
#include "fsfw/tasks/TaskFactory.h"
|
#include "fsfw/tasks/TaskFactory.h"
|
||||||
|
#include "fsfw/timemanager/Stopwatch.h"
|
||||||
#include "test/DummyParameter.h"
|
#include "test/DummyParameter.h"
|
||||||
|
|
||||||
#include <nlohmann/json.hpp>
|
Q7STestTask::Q7STestTask(object_id_t objectId) : TestTask(objectId) {
|
||||||
|
doTestSdCard = false;
|
||||||
#include <iostream>
|
doTestScratchApi = false;
|
||||||
#include <fstream>
|
doTestGps = false;
|
||||||
#include <cstdio>
|
doTestXadc = true;
|
||||||
|
|
||||||
Q7STestTask::Q7STestTask(object_id_t objectId): TestTask(objectId) {
|
|
||||||
}
|
}
|
||||||
|
|
||||||
ReturnValue_t Q7STestTask::performOneShotAction() {
|
ReturnValue_t Q7STestTask::performOneShotAction() {
|
||||||
//testSdCard();
|
if (doTestSdCard) {
|
||||||
//testScratchApi();
|
testSdCard();
|
||||||
//testJsonLibDirect();
|
}
|
||||||
//testDummyParams();
|
if (doTestScratchApi) {
|
||||||
//testProtHandler();
|
testScratchApi();
|
||||||
|
}
|
||||||
|
// testJsonLibDirect();
|
||||||
|
// testDummyParams();
|
||||||
|
// testProtHandler();
|
||||||
FsOpCodes opCode = FsOpCodes::APPEND_TO_FILE;
|
FsOpCodes opCode = FsOpCodes::APPEND_TO_FILE;
|
||||||
testFileSystemHandlerDirect(opCode);
|
testFileSystemHandlerDirect(opCode);
|
||||||
return TestTask::performOneShotAction();
|
return TestTask::performOneShotAction();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
ReturnValue_t Q7STestTask::performPeriodicAction() {
|
||||||
|
if (doTestGps) {
|
||||||
|
testGpsDaemon();
|
||||||
|
}
|
||||||
|
if (doTestXadc) {
|
||||||
|
xadcTest();
|
||||||
|
}
|
||||||
|
return TestTask::performPeriodicAction();
|
||||||
|
}
|
||||||
|
|
||||||
void Q7STestTask::testSdCard() {
|
void Q7STestTask::testSdCard() {
|
||||||
using namespace std;
|
using namespace std;
|
||||||
Stopwatch stopwatch;
|
Stopwatch stopwatch;
|
||||||
int result = std::system("q7hw sd info all > /tmp/sd_status.txt");
|
int result = std::system("q7hw sd info all > /tmp/sd_status.txt");
|
||||||
if(result != 0) {
|
if (result != 0) {
|
||||||
sif::debug << "system call failed with " << result << endl;
|
sif::debug << "system call failed with " << result << endl;
|
||||||
}
|
}
|
||||||
ifstream sdStatus("/tmp/sd_status.txt");
|
ifstream sdStatus("/tmp/sd_status.txt");
|
||||||
@ -44,11 +65,10 @@ void Q7STestTask::testSdCard() {
|
|||||||
while (std::getline(sdStatus, line)) {
|
while (std::getline(sdStatus, line)) {
|
||||||
std::istringstream iss(line);
|
std::istringstream iss(line);
|
||||||
string word;
|
string word;
|
||||||
while(iss >> word) {
|
while (iss >> word) {
|
||||||
if(word == "on") {
|
if (word == "on") {
|
||||||
sif::info << "SD card " << static_cast<int>(idx) << " is on" << endl;
|
sif::info << "SD card " << static_cast<int>(idx) << " is on" << endl;
|
||||||
}
|
} else if (word == "off") {
|
||||||
else if(word == "off") {
|
|
||||||
sif::info << "SD card " << static_cast<int>(idx) << " is off" << endl;
|
sif::info << "SD card " << static_cast<int>(idx) << " is off" << endl;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -69,23 +89,23 @@ void Q7STestTask::fileTests() {
|
|||||||
|
|
||||||
void Q7STestTask::testScratchApi() {
|
void Q7STestTask::testScratchApi() {
|
||||||
ReturnValue_t result = scratch::writeNumber("TEST", 1);
|
ReturnValue_t result = scratch::writeNumber("TEST", 1);
|
||||||
if(result != HasReturnvaluesIF::RETURN_OK) {
|
if (result != HasReturnvaluesIF::RETURN_OK) {
|
||||||
sif::debug << "Q7STestTask::scratchApiTest: Writing number failed" << std::endl;
|
sif::debug << "Q7STestTask::scratchApiTest: Writing number failed" << std::endl;
|
||||||
}
|
}
|
||||||
int number = 0;
|
int number = 0;
|
||||||
result = scratch::readNumber("TEST", number);
|
result = scratch::readNumber("TEST", number);
|
||||||
sif::info << "Q7STestTask::testScratchApi: Value for key \"TEST\": " << number << std::endl;
|
sif::info << "Q7STestTask::testScratchApi: Value for key \"TEST\": " << number << std::endl;
|
||||||
if(result != HasReturnvaluesIF::RETURN_OK) {
|
if (result != HasReturnvaluesIF::RETURN_OK) {
|
||||||
sif::debug << "Q7STestTask::scratchApiTest: Reading number failed" << std::endl;
|
sif::debug << "Q7STestTask::scratchApiTest: Reading number failed" << std::endl;
|
||||||
}
|
}
|
||||||
|
|
||||||
result = scratch::writeString("TEST2", "halloWelt");
|
result = scratch::writeString("TEST2", "halloWelt");
|
||||||
if(result != HasReturnvaluesIF::RETURN_OK) {
|
if (result != HasReturnvaluesIF::RETURN_OK) {
|
||||||
sif::debug << "Q7STestTask::scratchApiTest: Writing string failed" << std::endl;
|
sif::debug << "Q7STestTask::scratchApiTest: Writing string failed" << std::endl;
|
||||||
}
|
}
|
||||||
std::string string;
|
std::string string;
|
||||||
result = scratch::readString("TEST2", string);
|
result = scratch::readString("TEST2", string);
|
||||||
if(result != HasReturnvaluesIF::RETURN_OK) {
|
if (result != HasReturnvaluesIF::RETURN_OK) {
|
||||||
sif::debug << "Q7STestTask::scratchApiTest: Reading number failed" << std::endl;
|
sif::debug << "Q7STestTask::scratchApiTest: Reading number failed" << std::endl;
|
||||||
}
|
}
|
||||||
sif::info << "Q7STestTask::testScratchApi: Value for key \"TEST2\": " << string << std::endl;
|
sif::info << "Q7STestTask::testScratchApi: Value for key \"TEST2\": " << string << std::endl;
|
||||||
@ -112,13 +132,12 @@ void Q7STestTask::testDummyParams() {
|
|||||||
DummyParameter param(mntPrefix, "dummy_json.txt");
|
DummyParameter param(mntPrefix, "dummy_json.txt");
|
||||||
param.printKeys();
|
param.printKeys();
|
||||||
param.print();
|
param.print();
|
||||||
if(not param.getJsonFileExists()) {
|
if (not param.getJsonFileExists()) {
|
||||||
param.writeJsonFile();
|
param.writeJsonFile();
|
||||||
}
|
}
|
||||||
|
|
||||||
ReturnValue_t result = param.readJsonFile();
|
ReturnValue_t result = param.readJsonFile();
|
||||||
if(result != HasReturnvaluesIF::RETURN_OK) {
|
if (result != HasReturnvaluesIF::RETURN_OK) {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
param.setValue(DummyParameter::DUMMY_KEY_PARAM_1, 3);
|
param.setValue(DummyParameter::DUMMY_KEY_PARAM_1, 3);
|
||||||
@ -128,13 +147,13 @@ void Q7STestTask::testDummyParams() {
|
|||||||
param.print();
|
param.print();
|
||||||
|
|
||||||
int test = 0;
|
int test = 0;
|
||||||
result = param.getValue<int>(DummyParameter::DUMMY_KEY_PARAM_1, &test);
|
result = param.getValue<int>(DummyParameter::DUMMY_KEY_PARAM_1, test);
|
||||||
if (result != HasReturnvaluesIF::RETURN_OK) {
|
if (result != HasReturnvaluesIF::RETURN_OK) {
|
||||||
sif::warning << "Q7STestTask::testDummyParams: Key " << DummyParameter::DUMMY_KEY_PARAM_1
|
sif::warning << "Q7STestTask::testDummyParams: Key " << DummyParameter::DUMMY_KEY_PARAM_1
|
||||||
<< " does not exist" << std::endl;
|
<< " does not exist" << std::endl;
|
||||||
}
|
}
|
||||||
std::string test2;
|
std::string test2;
|
||||||
result = param.getValue<std::string>(DummyParameter::DUMMY_KEY_PARAM_2, &test2);
|
result = param.getValue<std::string>(DummyParameter::DUMMY_KEY_PARAM_2, test2);
|
||||||
if (result != HasReturnvaluesIF::RETURN_OK) {
|
if (result != HasReturnvaluesIF::RETURN_OK) {
|
||||||
sif::warning << "Q7STestTask::testDummyParams: Key " << DummyParameter::DUMMY_KEY_PARAM_1
|
sif::warning << "Q7STestTask::testDummyParams: Key " << DummyParameter::DUMMY_KEY_PARAM_1
|
||||||
<< " does not exist" << std::endl;
|
<< " does not exist" << std::endl;
|
||||||
@ -145,9 +164,9 @@ void Q7STestTask::testDummyParams() {
|
|||||||
|
|
||||||
ReturnValue_t Q7STestTask::initialize() {
|
ReturnValue_t Q7STestTask::initialize() {
|
||||||
coreController = ObjectManager::instance()->get<CoreController>(objects::CORE_CONTROLLER);
|
coreController = ObjectManager::instance()->get<CoreController>(objects::CORE_CONTROLLER);
|
||||||
if(coreController == nullptr) {
|
if (coreController == nullptr) {
|
||||||
sif::warning << "Q7STestTask::initialize: Could not retrieve CORE_CONTROLLER object" <<
|
sif::warning << "Q7STestTask::initialize: Could not retrieve CORE_CONTROLLER object"
|
||||||
std::endl;
|
<< std::endl;
|
||||||
}
|
}
|
||||||
return TestTask::initialize();
|
return TestTask::initialize();
|
||||||
}
|
}
|
||||||
@ -156,78 +175,92 @@ void Q7STestTask::testProtHandler() {
|
|||||||
bool opPerformed = false;
|
bool opPerformed = false;
|
||||||
ReturnValue_t result = HasReturnvaluesIF::RETURN_OK;
|
ReturnValue_t result = HasReturnvaluesIF::RETURN_OK;
|
||||||
// If any chips are unlocked, lock them here
|
// If any chips are unlocked, lock them here
|
||||||
result = coreController->setBootCopyProtection(
|
result = coreController->setBootCopyProtection(xsc::Chip::ALL_CHIP, xsc::Copy::ALL_COPY, true,
|
||||||
CoreController::Chip::ALL_CHIP, CoreController::Copy::ALL_COPY, true,
|
|
||||||
opPerformed, true);
|
opPerformed, true);
|
||||||
if(result != HasReturnvaluesIF::RETURN_OK) {
|
if (result != HasReturnvaluesIF::RETURN_OK) {
|
||||||
sif::warning << "Q7STestTask::testProtHandler: Op failed" << std::endl;
|
sif::warning << "Q7STestTask::testProtHandler: Op failed" << std::endl;
|
||||||
}
|
}
|
||||||
|
|
||||||
// unlock own copy
|
// unlock own copy
|
||||||
result = coreController->setBootCopyProtection(
|
result = coreController->setBootCopyProtection(xsc::Chip::SELF_CHIP, xsc::Copy::SELF_COPY, false,
|
||||||
CoreController::Chip::SELF_CHIP, CoreController::Copy::SELF_COPY, false,
|
|
||||||
opPerformed, true);
|
opPerformed, true);
|
||||||
if(result != HasReturnvaluesIF::RETURN_OK) {
|
if (result != HasReturnvaluesIF::RETURN_OK) {
|
||||||
sif::warning << "Q7STestTask::testProtHandler: Op failed" << std::endl;
|
sif::warning << "Q7STestTask::testProtHandler: Op failed" << std::endl;
|
||||||
}
|
}
|
||||||
if(not opPerformed) {
|
if (not opPerformed) {
|
||||||
sif::warning << "Q7STestTask::testProtHandler: No op performed" << std::endl;
|
sif::warning << "Q7STestTask::testProtHandler: No op performed" << std::endl;
|
||||||
}
|
}
|
||||||
int retval = std::system("print-chip-prot-status.sh");
|
int retval = std::system("print-chip-prot-status.sh");
|
||||||
if(retval != 0) {
|
if (retval != 0) {
|
||||||
utility::handleSystemError(retval, "Q7STestTask::testProtHandler");
|
utility::handleSystemError(retval, "Q7STestTask::testProtHandler");
|
||||||
}
|
}
|
||||||
|
|
||||||
// lock own copy
|
// lock own copy
|
||||||
result = coreController->setBootCopyProtection(
|
result = coreController->setBootCopyProtection(xsc::Chip::SELF_CHIP, xsc::Copy::SELF_COPY, true,
|
||||||
CoreController::Chip::SELF_CHIP, CoreController::Copy::SELF_COPY, true,
|
|
||||||
opPerformed, true);
|
opPerformed, true);
|
||||||
if(result != HasReturnvaluesIF::RETURN_OK) {
|
if (result != HasReturnvaluesIF::RETURN_OK) {
|
||||||
sif::warning << "Q7STestTask::testProtHandler: Op failed" << std::endl;
|
sif::warning << "Q7STestTask::testProtHandler: Op failed" << std::endl;
|
||||||
}
|
}
|
||||||
if(not opPerformed) {
|
if (not opPerformed) {
|
||||||
sif::warning << "Q7STestTask::testProtHandler: No op performed" << std::endl;
|
sif::warning << "Q7STestTask::testProtHandler: No op performed" << std::endl;
|
||||||
}
|
}
|
||||||
retval = std::system("print-chip-prot-status.sh");
|
retval = std::system("print-chip-prot-status.sh");
|
||||||
if(retval != 0) {
|
if (retval != 0) {
|
||||||
utility::handleSystemError(retval, "Q7STestTask::testProtHandler");
|
utility::handleSystemError(retval, "Q7STestTask::testProtHandler");
|
||||||
}
|
}
|
||||||
|
|
||||||
// unlock specific copy
|
// unlock specific copy
|
||||||
result = coreController->setBootCopyProtection(
|
result = coreController->setBootCopyProtection(xsc::Chip::CHIP_1, xsc::Copy::COPY_1, false,
|
||||||
CoreController::Chip::CHIP_1, CoreController::Copy::COPY_1, false,
|
|
||||||
opPerformed, true);
|
opPerformed, true);
|
||||||
if(result != HasReturnvaluesIF::RETURN_OK) {
|
if (result != HasReturnvaluesIF::RETURN_OK) {
|
||||||
sif::warning << "Q7STestTask::testProtHandler: Op failed" << std::endl;
|
sif::warning << "Q7STestTask::testProtHandler: Op failed" << std::endl;
|
||||||
}
|
}
|
||||||
if(not opPerformed) {
|
if (not opPerformed) {
|
||||||
sif::warning << "Q7STestTask::testProtHandler: No op performed" << std::endl;
|
sif::warning << "Q7STestTask::testProtHandler: No op performed" << std::endl;
|
||||||
}
|
}
|
||||||
retval = std::system("print-chip-prot-status.sh");
|
retval = std::system("print-chip-prot-status.sh");
|
||||||
if(retval != 0) {
|
if (retval != 0) {
|
||||||
utility::handleSystemError(retval, "Q7STestTask::testProtHandler");
|
utility::handleSystemError(retval, "Q7STestTask::testProtHandler");
|
||||||
}
|
}
|
||||||
|
|
||||||
// lock specific copy
|
// lock specific copy
|
||||||
result = coreController->setBootCopyProtection(
|
result = coreController->setBootCopyProtection(xsc::Chip::CHIP_1, xsc::Copy::COPY_1, true,
|
||||||
CoreController::Chip::CHIP_1, CoreController::Copy::COPY_1, true,
|
|
||||||
opPerformed, true);
|
opPerformed, true);
|
||||||
if(result != HasReturnvaluesIF::RETURN_OK) {
|
if (result != HasReturnvaluesIF::RETURN_OK) {
|
||||||
sif::warning << "Q7STestTask::testProtHandler: Op failed" << std::endl;
|
sif::warning << "Q7STestTask::testProtHandler: Op failed" << std::endl;
|
||||||
}
|
}
|
||||||
if(not opPerformed) {
|
if (not opPerformed) {
|
||||||
sif::warning << "Q7STestTask::testProtHandler: No op performed" << std::endl;
|
sif::warning << "Q7STestTask::testProtHandler: No op performed" << std::endl;
|
||||||
}
|
}
|
||||||
retval = std::system("print-chip-prot-status.sh");
|
retval = std::system("print-chip-prot-status.sh");
|
||||||
if(retval != 0) {
|
if (retval != 0) {
|
||||||
utility::handleSystemError(retval, "Q7STestTask::testProtHandler");
|
utility::handleSystemError(retval, "Q7STestTask::testProtHandler");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void Q7STestTask::testGpsDaemon() {
|
||||||
|
gpsmm gpsmm(GPSD_SHARED_MEMORY, 0);
|
||||||
|
gps_data_t* gps;
|
||||||
|
gps = gpsmm.read();
|
||||||
|
if (gps == nullptr) {
|
||||||
|
sif::warning << "Q7STestTask: Reading GPS data failed" << std::endl;
|
||||||
|
}
|
||||||
|
sif::info << "-- Q7STestTask: GPS shared memory read test --" << std::endl;
|
||||||
|
time_t timeRaw = gps->fix.time.tv_sec;
|
||||||
|
std::tm* time = gmtime(&timeRaw);
|
||||||
|
sif::info << "Time: " << std::put_time(time, "%c %Z") << std::endl;
|
||||||
|
sif::info << "Visible satellites: " << gps->satellites_visible << std::endl;
|
||||||
|
sif::info << "Satellites used: " << gps->satellites_used << std::endl;
|
||||||
|
sif::info << "Fix (0:Not Seen|1:No Fix|2:2D|3:3D): " << gps->fix.mode << std::endl;
|
||||||
|
sif::info << "Latitude: " << gps->fix.latitude << std::endl;
|
||||||
|
sif::info << "Longitude: " << gps->fix.longitude << std::endl;
|
||||||
|
sif::info << "Altitude(MSL): " << gps->fix.altMSL << std::endl;
|
||||||
|
sif::info << "Speed(m/s): " << gps->fix.speed << std::endl;
|
||||||
|
}
|
||||||
|
|
||||||
void Q7STestTask::testFileSystemHandlerDirect(FsOpCodes opCode) {
|
void Q7STestTask::testFileSystemHandlerDirect(FsOpCodes opCode) {
|
||||||
auto fsHandler = ObjectManager::instance()->
|
auto fsHandler = ObjectManager::instance()->get<FileSystemHandler>(objects::FILE_SYSTEM_HANDLER);
|
||||||
get<FileSystemHandler>(objects::FILE_SYSTEM_HANDLER);
|
if (fsHandler == nullptr) {
|
||||||
if(fsHandler == nullptr) {
|
|
||||||
sif::warning << "Q7STestTask::testFileSystemHandlerDirect: No FS handler running.."
|
sif::warning << "Q7STestTask::testFileSystemHandlerDirect: No FS handler running.."
|
||||||
<< std::endl;
|
<< std::endl;
|
||||||
}
|
}
|
||||||
@ -236,28 +269,27 @@ void Q7STestTask::testFileSystemHandlerDirect(FsOpCodes opCode) {
|
|||||||
|
|
||||||
// Lambda for common code
|
// Lambda for common code
|
||||||
auto createNonEmptyTmpDir = [&]() {
|
auto createNonEmptyTmpDir = [&]() {
|
||||||
if(not std::filesystem::exists("/tmp/test")) {
|
if (not std::filesystem::exists("/tmp/test")) {
|
||||||
result = fsHandler->createDirectory("/tmp", "test", false, &cfg);
|
result = fsHandler->createDirectory("/tmp", "test", false, &cfg);
|
||||||
if(result != HasReturnvaluesIF::RETURN_OK) {
|
if (result != HasReturnvaluesIF::RETURN_OK) {
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// Creating sample files
|
// Creating sample files
|
||||||
sif::info << "Creating sample files in directory" << std::endl;
|
sif::info << "Creating sample files in directory" << std::endl;
|
||||||
result = fsHandler->createFile("/tmp/test", "test1.txt", nullptr, 0, &cfg);
|
result = fsHandler->createFile("/tmp/test", "test1.txt", nullptr, 0, &cfg);
|
||||||
if(result != HasReturnvaluesIF::RETURN_OK) {
|
if (result != HasReturnvaluesIF::RETURN_OK) {
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
result = fsHandler->createFile("/tmp/test", "test2.txt", nullptr, 0, &cfg);
|
result = fsHandler->createFile("/tmp/test", "test2.txt", nullptr, 0, &cfg);
|
||||||
if(result != HasReturnvaluesIF::RETURN_OK) {
|
if (result != HasReturnvaluesIF::RETURN_OK) {
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
return result;
|
return result;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
switch (opCode) {
|
||||||
switch(opCode) {
|
case (FsOpCodes::CREATE_EMPTY_FILE_IN_TMP): {
|
||||||
case(FsOpCodes::CREATE_EMPTY_FILE_IN_TMP): {
|
|
||||||
// No mount prefix, cause file is created in tmp
|
// No mount prefix, cause file is created in tmp
|
||||||
cfg.useMountPrefix = false;
|
cfg.useMountPrefix = false;
|
||||||
sif::info << "Creating empty file in /tmp folder" << std::endl;
|
sif::info << "Creating empty file in /tmp folder" << std::endl;
|
||||||
@ -265,89 +297,83 @@ void Q7STestTask::testFileSystemHandlerDirect(FsOpCodes opCode) {
|
|||||||
fsHandler->createFile("/tmp/", "test.txt", nullptr, 0, &cfg);
|
fsHandler->createFile("/tmp/", "test.txt", nullptr, 0, &cfg);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case(FsOpCodes::REMOVE_TMP_FILE): {
|
case (FsOpCodes::REMOVE_TMP_FILE): {
|
||||||
sif::info << "Deleting /tmp/test.txt sample file" << std::endl;
|
sif::info << "Deleting /tmp/test.txt sample file" << std::endl;
|
||||||
// No mount prefix, cause file is created in tmp
|
// No mount prefix, cause file is created in tmp
|
||||||
cfg.useMountPrefix = false;
|
cfg.useMountPrefix = false;
|
||||||
if(not std::filesystem::exists("/tmp/test.txt")) {
|
if (not std::filesystem::exists("/tmp/test.txt")) {
|
||||||
// Creating sample file
|
// Creating sample file
|
||||||
sif::info << "Creating sample file /tmp/test.txt to delete" << std::endl;
|
sif::info << "Creating sample file /tmp/test.txt to delete" << std::endl;
|
||||||
fsHandler->createFile("/tmp/", "test.txt", nullptr, 0, &cfg);
|
fsHandler->createFile("/tmp/", "test.txt", nullptr, 0, &cfg);
|
||||||
}
|
}
|
||||||
result = fsHandler->removeFile("/tmp", "test.txt", &cfg);
|
result = fsHandler->removeFile("/tmp", "test.txt", &cfg);
|
||||||
if(result == HasReturnvaluesIF::RETURN_OK) {
|
if (result == HasReturnvaluesIF::RETURN_OK) {
|
||||||
sif::info << "File removed successfully" << std::endl;
|
sif::info << "File removed successfully" << std::endl;
|
||||||
}
|
} else {
|
||||||
else {
|
|
||||||
sif::warning << "File removal failed!" << std::endl;
|
sif::warning << "File removal failed!" << std::endl;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case(FsOpCodes::CREATE_DIR_IN_TMP): {
|
case (FsOpCodes::CREATE_DIR_IN_TMP): {
|
||||||
// No mount prefix, cause file is created in tmp
|
// No mount prefix, cause file is created in tmp
|
||||||
cfg.useMountPrefix = false;
|
cfg.useMountPrefix = false;
|
||||||
sif::info << "Creating empty file in /tmp folder" << std::endl;
|
sif::info << "Creating empty file in /tmp folder" << std::endl;
|
||||||
// Do not delete file, user can check existence in shell
|
// Do not delete file, user can check existence in shell
|
||||||
ReturnValue_t result = fsHandler->createDirectory("/tmp/", "test", false, &cfg);
|
ReturnValue_t result = fsHandler->createDirectory("/tmp/", "test", false, &cfg);
|
||||||
if(result == HasReturnvaluesIF::RETURN_OK) {
|
if (result == HasReturnvaluesIF::RETURN_OK) {
|
||||||
sif::info << "Directory created successfully" << std::endl;
|
sif::info << "Directory created successfully" << std::endl;
|
||||||
}
|
} else {
|
||||||
else {
|
|
||||||
sif::warning << "Directory creation failed!" << std::endl;
|
sif::warning << "Directory creation failed!" << std::endl;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case(FsOpCodes::REMOVE_EMPTY_DIR_IN_TMP): {
|
case (FsOpCodes::REMOVE_EMPTY_DIR_IN_TMP): {
|
||||||
// No mount prefix, cause file is created in tmp
|
// No mount prefix, cause file is created in tmp
|
||||||
cfg.useMountPrefix = false;
|
cfg.useMountPrefix = false;
|
||||||
if(not std::filesystem::exists("/tmp/test")) {
|
if (not std::filesystem::exists("/tmp/test")) {
|
||||||
result = fsHandler->createDirectory("/tmp", "test", false, &cfg);
|
result = fsHandler->createDirectory("/tmp", "test", false, &cfg);
|
||||||
}
|
} else {
|
||||||
else {
|
|
||||||
// Delete any leftover files to regular dir removal works
|
// Delete any leftover files to regular dir removal works
|
||||||
std::remove("/tmp/test/*");
|
std::remove("/tmp/test/*");
|
||||||
}
|
}
|
||||||
result = fsHandler->removeDirectory("/tmp/", "test", false, &cfg);
|
result = fsHandler->removeDirectory("/tmp/", "test", false, &cfg);
|
||||||
if(result == HasReturnvaluesIF::RETURN_OK) {
|
if (result == HasReturnvaluesIF::RETURN_OK) {
|
||||||
sif::info << "Directory removed successfully" << std::endl;
|
sif::info << "Directory removed successfully" << std::endl;
|
||||||
}
|
} else {
|
||||||
else {
|
|
||||||
sif::warning << "Directory removal failed!" << std::endl;
|
sif::warning << "Directory removal failed!" << std::endl;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case(FsOpCodes::REMOVE_FILLED_DIR_IN_TMP): {
|
case (FsOpCodes::REMOVE_FILLED_DIR_IN_TMP): {
|
||||||
result = createNonEmptyTmpDir();
|
result = createNonEmptyTmpDir();
|
||||||
if(result != HasReturnvaluesIF::RETURN_OK) {
|
if (result != HasReturnvaluesIF::RETURN_OK) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
result = fsHandler->removeDirectory("/tmp/", "test", true, &cfg);
|
result = fsHandler->removeDirectory("/tmp/", "test", true, &cfg);
|
||||||
if(result == HasReturnvaluesIF::RETURN_OK) {
|
if (result == HasReturnvaluesIF::RETURN_OK) {
|
||||||
sif::info << "Directory removed recursively successfully" << std::endl;
|
sif::info << "Directory removed recursively successfully" << std::endl;
|
||||||
}
|
} else {
|
||||||
else {
|
|
||||||
sif::warning << "Recursive directory removal failed!" << std::endl;
|
sif::warning << "Recursive directory removal failed!" << std::endl;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case(FsOpCodes::ATTEMPT_DIR_REMOVAL_NON_EMPTY): {
|
case (FsOpCodes::ATTEMPT_DIR_REMOVAL_NON_EMPTY): {
|
||||||
result = createNonEmptyTmpDir();
|
result = createNonEmptyTmpDir();
|
||||||
if(result != HasReturnvaluesIF::RETURN_OK) {
|
if (result != HasReturnvaluesIF::RETURN_OK) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
result = fsHandler->removeDirectory("/tmp/", "test", false, &cfg);
|
result = fsHandler->removeDirectory("/tmp/", "test", false, &cfg);
|
||||||
if(result != HasReturnvaluesIF::RETURN_OK) {
|
if (result != HasReturnvaluesIF::RETURN_OK) {
|
||||||
sif::info << "Directory removal attempt failed as expected" << std::endl;
|
sif::info << "Directory removal attempt failed as expected" << std::endl;
|
||||||
}
|
} else {
|
||||||
else {
|
|
||||||
sif::warning << "Directory removal worked when it should not have!" << std::endl;
|
sif::warning << "Directory removal worked when it should not have!" << std::endl;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case(FsOpCodes::RENAME_FILE): {
|
case (FsOpCodes::RENAME_FILE): {
|
||||||
// No mount prefix, cause file is created in tmp
|
// No mount prefix, cause file is created in tmp
|
||||||
cfg.useMountPrefix = false;
|
cfg.useMountPrefix = false;
|
||||||
if(std::filesystem::exists("/tmp/test.txt")) {
|
if (std::filesystem::exists("/tmp/test.txt")) {
|
||||||
fsHandler->removeDirectory("/tmp/", "test", false, &cfg);
|
fsHandler->removeDirectory("/tmp/", "test", false, &cfg);
|
||||||
}
|
}
|
||||||
sif::info << "Creating empty file /tmp/test.txt and rename to /tmp/test2.txt" << std::endl;
|
sif::info << "Creating empty file /tmp/test.txt and rename to /tmp/test2.txt" << std::endl;
|
||||||
@ -356,21 +382,71 @@ void Q7STestTask::testFileSystemHandlerDirect(FsOpCodes opCode) {
|
|||||||
fsHandler->renameFile("/tmp/", "test.txt", "test2.txt", &cfg);
|
fsHandler->renameFile("/tmp/", "test.txt", "test2.txt", &cfg);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case(FsOpCodes::APPEND_TO_FILE): {
|
case (FsOpCodes::APPEND_TO_FILE): {
|
||||||
// No mount prefix, cause file is created in tmp
|
// No mount prefix, cause file is created in tmp
|
||||||
cfg.useMountPrefix = false;
|
cfg.useMountPrefix = false;
|
||||||
if(std::filesystem::exists("/tmp/test.txt")) {
|
if (std::filesystem::exists("/tmp/test.txt")) {
|
||||||
fsHandler->removeDirectory("/tmp/", "test", false, &cfg);
|
fsHandler->removeDirectory("/tmp/", "test", false, &cfg);
|
||||||
}
|
}
|
||||||
if(std::filesystem::exists("/tmp/test.txt")) {
|
if (std::filesystem::exists("/tmp/test.txt")) {
|
||||||
fsHandler->removeDirectory("/tmp/", "test", false, &cfg);
|
fsHandler->removeDirectory("/tmp/", "test", false, &cfg);
|
||||||
}
|
}
|
||||||
sif::info << "Creating empty file /tmp/test.txt and adding content" << std::endl;
|
sif::info << "Creating empty file /tmp/test.txt and adding content" << std::endl;
|
||||||
std::string content = "Hello World\n";
|
std::string content = "Hello World\n";
|
||||||
// Do not delete file, user can check existence in shell
|
// Do not delete file, user can check existence in shell
|
||||||
fsHandler->createFile("/tmp/", "test.txt", nullptr, 0, &cfg);
|
fsHandler->createFile("/tmp/", "test.txt", nullptr, 0, &cfg);
|
||||||
fsHandler->appendToFile("/tmp/", "test.txt", reinterpret_cast<const uint8_t*>(
|
fsHandler->appendToFile("/tmp/", "test.txt", reinterpret_cast<const uint8_t*>(content.data()),
|
||||||
content.data()), content.size(), 0, &cfg);
|
content.size(), 0, &cfg);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void Q7STestTask::xadcTest() {
|
||||||
|
ReturnValue_t result = RETURN_OK;
|
||||||
|
float temperature = 0;
|
||||||
|
float vccPint = 0;
|
||||||
|
float vccPaux = 0;
|
||||||
|
float vccInt = 0;
|
||||||
|
float vccAux = 0;
|
||||||
|
float vccBram = 0;
|
||||||
|
float vccOddr = 0;
|
||||||
|
float vrefp = 0;
|
||||||
|
float vrefn = 0;
|
||||||
|
Xadc xadc;
|
||||||
|
result = xadc.getTemperature(temperature);
|
||||||
|
if (result == HasReturnvaluesIF::RETURN_OK) {
|
||||||
|
sif::info << "Q7STestTask::xadcTest: Chip Temperature: " << temperature << " °C" << std::endl;
|
||||||
|
}
|
||||||
|
result = xadc.getVccPint(vccPint);
|
||||||
|
if (result == HasReturnvaluesIF::RETURN_OK) {
|
||||||
|
sif::info << "Q7STestTask::xadcTest: VCC PS internal: " << vccPint << " mV" << std::endl;
|
||||||
|
}
|
||||||
|
result = xadc.getVccPaux(vccPaux);
|
||||||
|
if (result == HasReturnvaluesIF::RETURN_OK) {
|
||||||
|
sif::info << "Q7STestTask::xadcTest: VCC PS auxilliary: " << vccPaux << " mV" << std::endl;
|
||||||
|
}
|
||||||
|
result = xadc.getVccInt(vccInt);
|
||||||
|
if (result == HasReturnvaluesIF::RETURN_OK) {
|
||||||
|
sif::info << "Q7STestTask::xadcTest: VCC PL internal: " << vccInt << " mV" << std::endl;
|
||||||
|
}
|
||||||
|
result = xadc.getVccAux(vccAux);
|
||||||
|
if (result == HasReturnvaluesIF::RETURN_OK) {
|
||||||
|
sif::info << "Q7STestTask::xadcTest: VCC PL auxilliary: " << vccAux << " mV" << std::endl;
|
||||||
|
}
|
||||||
|
result = xadc.getVccBram(vccBram);
|
||||||
|
if (result == HasReturnvaluesIF::RETURN_OK) {
|
||||||
|
sif::info << "Q7STestTask::xadcTest: VCC BRAM: " << vccBram << " mV" << std::endl;
|
||||||
|
}
|
||||||
|
result = xadc.getVccOddr(vccOddr);
|
||||||
|
if (result == HasReturnvaluesIF::RETURN_OK) {
|
||||||
|
sif::info << "Q7STestTask::xadcTest: VCC PS I/O DDR : " << vccOddr << " mV" << std::endl;
|
||||||
|
}
|
||||||
|
result = xadc.getVrefp(vrefp);
|
||||||
|
if (result == HasReturnvaluesIF::RETURN_OK) {
|
||||||
|
sif::info << "Q7STestTask::xadcTest: Vrefp : " << vrefp << " mV" << std::endl;
|
||||||
|
}
|
||||||
|
result = xadc.getVrefn(vrefn);
|
||||||
|
if (result == HasReturnvaluesIF::RETURN_OK) {
|
||||||
|
sif::info << "Q7STestTask::xadcTest: Vrefn : " << vrefn << " mV" << std::endl;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
@ -3,17 +3,29 @@
|
|||||||
|
|
||||||
#include "test/testtasks/TestTask.h"
|
#include "test/testtasks/TestTask.h"
|
||||||
|
|
||||||
class Q7STestTask: public TestTask {
|
class CoreController;
|
||||||
public:
|
|
||||||
|
class Q7STestTask : public TestTask {
|
||||||
|
public:
|
||||||
Q7STestTask(object_id_t objectId);
|
Q7STestTask(object_id_t objectId);
|
||||||
|
|
||||||
ReturnValue_t initialize() override;
|
ReturnValue_t initialize() override;
|
||||||
private:
|
|
||||||
|
private:
|
||||||
|
bool doTestSdCard = false;
|
||||||
|
bool doTestScratchApi = false;
|
||||||
|
bool doTestGps = false;
|
||||||
|
bool doTestXadc = false;
|
||||||
|
|
||||||
CoreController* coreController = nullptr;
|
CoreController* coreController = nullptr;
|
||||||
ReturnValue_t performOneShotAction() override;
|
ReturnValue_t performOneShotAction() override;
|
||||||
|
ReturnValue_t performPeriodicAction() override;
|
||||||
|
|
||||||
|
void testGpsDaemon();
|
||||||
|
|
||||||
void testSdCard();
|
void testSdCard();
|
||||||
void fileTests();
|
void fileTests();
|
||||||
|
void xadcTest();
|
||||||
|
|
||||||
void testScratchApi();
|
void testScratchApi();
|
||||||
void testJsonLibDirect();
|
void testJsonLibDirect();
|
||||||
@ -33,5 +45,4 @@ private:
|
|||||||
void testFileSystemHandlerDirect(FsOpCodes opCode);
|
void testFileSystemHandlerDirect(FsOpCodes opCode);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
#endif /* BSP_Q7S_BOARDTEST_Q7STESTTASK_H_ */
|
#endif /* BSP_Q7S_BOARDTEST_Q7STESTTASK_H_ */
|
||||||
|
@ -1,4 +1,6 @@
|
|||||||
target_sources(${TARGET_NAME} PRIVATE
|
target_sources(${OBSW_NAME} PRIVATE
|
||||||
rwSpiCallback.cpp
|
rwSpiCallback.cpp
|
||||||
gnssCallback.cpp
|
gnssCallback.cpp
|
||||||
|
pcduSwitchCb.cpp
|
||||||
|
gpioCallbacks.cpp
|
||||||
)
|
)
|
||||||
|
@ -1,22 +1,21 @@
|
|||||||
#include "gnssCallback.h"
|
#include "gnssCallback.h"
|
||||||
#include "devices/gpioIds.h"
|
|
||||||
|
|
||||||
|
#include "devices/gpioIds.h"
|
||||||
#include "fsfw/tasks/TaskFactory.h"
|
#include "fsfw/tasks/TaskFactory.h"
|
||||||
|
|
||||||
ReturnValue_t gps::triggerGpioResetPin(void *args) {
|
ReturnValue_t gps::triggerGpioResetPin(void* args) {
|
||||||
ResetArgs* resetArgs = reinterpret_cast<ResetArgs*>(args);
|
ResetArgs* resetArgs = reinterpret_cast<ResetArgs*>(args);
|
||||||
if(args == nullptr) {
|
if (args == nullptr) {
|
||||||
return HasReturnvaluesIF::RETURN_FAILED;
|
return HasReturnvaluesIF::RETURN_FAILED;
|
||||||
}
|
}
|
||||||
if (resetArgs->gpioComIF == nullptr) {
|
if (resetArgs->gpioComIF == nullptr) {
|
||||||
return HasReturnvaluesIF::RETURN_FAILED;
|
return HasReturnvaluesIF::RETURN_FAILED;
|
||||||
}
|
}
|
||||||
gpioId_t gpioId;
|
gpioId_t gpioId;
|
||||||
if(resetArgs->gnss1) {
|
if (resetArgs->gnss1) {
|
||||||
gpioId = gpioIds::GNSS_1_NRESET;
|
gpioId = gpioIds::GNSS_1_NRESET;
|
||||||
|
|
||||||
}
|
} else {
|
||||||
else {
|
|
||||||
gpioId = gpioIds::GNSS_0_NRESET;
|
gpioId = gpioIds::GNSS_0_NRESET;
|
||||||
}
|
}
|
||||||
resetArgs->gpioComIF->pullLow(gpioId);
|
resetArgs->gpioComIF->pullLow(gpioId);
|
||||||
|
@ -1,8 +1,8 @@
|
|||||||
#ifndef BSP_Q7S_CALLBACKS_GNSSCALLBACK_H_
|
#ifndef BSP_Q7S_CALLBACKS_GNSSCALLBACK_H_
|
||||||
#define BSP_Q7S_CALLBACKS_GNSSCALLBACK_H_
|
#define BSP_Q7S_CALLBACKS_GNSSCALLBACK_H_
|
||||||
|
|
||||||
#include "fsfw_hal/linux/gpio/LinuxLibgpioIF.h"
|
|
||||||
#include "fsfw/returnvalues/HasReturnvaluesIF.h"
|
#include "fsfw/returnvalues/HasReturnvaluesIF.h"
|
||||||
|
#include "fsfw_hal/linux/gpio/LinuxLibgpioIF.h"
|
||||||
|
|
||||||
struct ResetArgs {
|
struct ResetArgs {
|
||||||
bool gnss1 = false;
|
bool gnss1 = false;
|
||||||
|
487
bsp_q7s/callbacks/gpioCallbacks.cpp
Normal file
487
bsp_q7s/callbacks/gpioCallbacks.cpp
Normal file
@ -0,0 +1,487 @@
|
|||||||
|
#include "gpioCallbacks.h"
|
||||||
|
|
||||||
|
#include <devices/gpioIds.h>
|
||||||
|
#include <fsfw/serviceinterface/ServiceInterface.h>
|
||||||
|
#include <fsfw_hal/common/gpio/GpioCookie.h>
|
||||||
|
#include <fsfw_hal/linux/gpio/LinuxLibgpioIF.h>
|
||||||
|
|
||||||
|
#include "busConf.h"
|
||||||
|
|
||||||
|
namespace gpioCallbacks {
|
||||||
|
|
||||||
|
GpioIF* gpioComInterface;
|
||||||
|
|
||||||
|
void initSpiCsDecoder(GpioIF* gpioComIF) {
|
||||||
|
using namespace gpio;
|
||||||
|
ReturnValue_t result;
|
||||||
|
|
||||||
|
if (gpioComIF == nullptr) {
|
||||||
|
sif::debug << "initSpiCsDecoder: Invalid gpioComIF" << std::endl;
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
gpioComInterface = gpioComIF;
|
||||||
|
|
||||||
|
GpioCookie* spiMuxGpios = new GpioCookie;
|
||||||
|
|
||||||
|
GpiodRegularByLineName* spiMuxBit = nullptr;
|
||||||
|
/** Setting mux bit 1 to low will disable IC21 on the interface board */
|
||||||
|
spiMuxBit = new GpiodRegularByLineName(q7s::gpioNames::SPI_MUX_BIT_0_PIN, "SPI Mux Bit 1",
|
||||||
|
Direction::OUT, Levels::HIGH);
|
||||||
|
spiMuxGpios->addGpio(gpioIds::SPI_MUX_BIT_0, spiMuxBit);
|
||||||
|
/** Setting mux bit 2 to low disables IC1 on the TCS board */
|
||||||
|
spiMuxBit = new GpiodRegularByLineName(q7s::gpioNames::SPI_MUX_BIT_1_PIN, "SPI Mux Bit 2",
|
||||||
|
Direction::OUT, Levels::HIGH);
|
||||||
|
spiMuxGpios->addGpio(gpioIds::SPI_MUX_BIT_1, spiMuxBit);
|
||||||
|
/** Setting mux bit 3 to low disables IC2 on the TCS board and IC22 on the interface board */
|
||||||
|
spiMuxBit = new GpiodRegularByLineName(q7s::gpioNames::SPI_MUX_BIT_2_PIN, "SPI Mux Bit 3",
|
||||||
|
Direction::OUT, Levels::LOW);
|
||||||
|
spiMuxGpios->addGpio(gpioIds::SPI_MUX_BIT_2, spiMuxBit);
|
||||||
|
|
||||||
|
/** The following gpios can take arbitrary initial values */
|
||||||
|
spiMuxBit = new GpiodRegularByLineName(q7s::gpioNames::SPI_MUX_BIT_3_PIN, "SPI Mux Bit 4",
|
||||||
|
Direction::OUT, Levels::LOW);
|
||||||
|
spiMuxGpios->addGpio(gpioIds::SPI_MUX_BIT_3, spiMuxBit);
|
||||||
|
spiMuxBit = new GpiodRegularByLineName(q7s::gpioNames::SPI_MUX_BIT_4_PIN, "SPI Mux Bit 5",
|
||||||
|
Direction::OUT, Levels::LOW);
|
||||||
|
spiMuxGpios->addGpio(gpioIds::SPI_MUX_BIT_4, spiMuxBit);
|
||||||
|
spiMuxBit = new GpiodRegularByLineName(q7s::gpioNames::SPI_MUX_BIT_5_PIN, "SPI Mux Bit 6",
|
||||||
|
Direction::OUT, Levels::LOW);
|
||||||
|
spiMuxGpios->addGpio(gpioIds::SPI_MUX_BIT_5, spiMuxBit);
|
||||||
|
GpiodRegularByLineName* enRwDecoder = new GpiodRegularByLineName(
|
||||||
|
q7s::gpioNames::EN_RW_CS, "EN_RW_CS", Direction::OUT, Levels::HIGH);
|
||||||
|
spiMuxGpios->addGpio(gpioIds::EN_RW_CS, enRwDecoder);
|
||||||
|
|
||||||
|
result = gpioComInterface->addGpios(spiMuxGpios);
|
||||||
|
if (result != HasReturnvaluesIF::RETURN_OK) {
|
||||||
|
sif::error << "initSpiCsDecoder: Failed to add mux bit gpios to gpioComIF" << std::endl;
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void spiCsDecoderCallback(gpioId_t gpioId, gpio::GpioOperation gpioOp, gpio::Levels value,
|
||||||
|
void* args) {
|
||||||
|
using namespace gpio;
|
||||||
|
if (gpioComInterface == nullptr) {
|
||||||
|
sif::debug << "spiCsDecoderCallback: No gpioComIF specified. Call initSpiCsDecoder "
|
||||||
|
<< "to specify gpioComIF" << std::endl;
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Reading is not supported by the callback function */
|
||||||
|
if (gpioOp == gpio::GpioOperation::READ) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (value == Levels::HIGH) {
|
||||||
|
switch (gpioId) {
|
||||||
|
case (gpioIds::RTD_IC_3): {
|
||||||
|
disableDecoderTcsIc1();
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
case (gpioIds::RTD_IC_4): {
|
||||||
|
disableDecoderTcsIc1();
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
case (gpioIds::RTD_IC_5): {
|
||||||
|
disableDecoderTcsIc1();
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
case (gpioIds::RTD_IC_6): {
|
||||||
|
disableDecoderTcsIc1();
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
case (gpioIds::RTD_IC_7): {
|
||||||
|
disableDecoderTcsIc1();
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
case (gpioIds::RTD_IC_8): {
|
||||||
|
disableDecoderTcsIc1();
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
case (gpioIds::RTD_IC_9): {
|
||||||
|
disableDecoderTcsIc1();
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
case (gpioIds::RTD_IC_10): {
|
||||||
|
disableDecoderTcsIc1();
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
case (gpioIds::RTD_IC_11): {
|
||||||
|
disableDecoderTcsIc2();
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
case (gpioIds::RTD_IC_12): {
|
||||||
|
disableDecoderTcsIc2();
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
case (gpioIds::RTD_IC_13): {
|
||||||
|
disableDecoderTcsIc2();
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
case (gpioIds::RTD_IC_14): {
|
||||||
|
disableDecoderTcsIc2();
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
case (gpioIds::RTD_IC_15): {
|
||||||
|
disableDecoderTcsIc2();
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
case (gpioIds::RTD_IC_16): {
|
||||||
|
disableDecoderTcsIc2();
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
case (gpioIds::RTD_IC_17): {
|
||||||
|
disableDecoderTcsIc2();
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
case (gpioIds::RTD_IC_18): {
|
||||||
|
disableDecoderTcsIc2();
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
case (gpioIds::CS_SUS_0): {
|
||||||
|
disableDecoderInterfaceBoardIc1();
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
case (gpioIds::CS_SUS_1): {
|
||||||
|
disableDecoderInterfaceBoardIc1();
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
case (gpioIds::CS_SUS_2): {
|
||||||
|
disableDecoderInterfaceBoardIc1();
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
case (gpioIds::CS_SUS_3): {
|
||||||
|
disableDecoderInterfaceBoardIc1();
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
case (gpioIds::CS_SUS_4): {
|
||||||
|
disableDecoderInterfaceBoardIc1();
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
case (gpioIds::CS_SUS_5): {
|
||||||
|
disableDecoderInterfaceBoardIc1();
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
case (gpioIds::CS_SUS_6): {
|
||||||
|
disableDecoderInterfaceBoardIc2();
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
case (gpioIds::CS_SUS_7): {
|
||||||
|
disableDecoderInterfaceBoardIc2();
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
case (gpioIds::CS_SUS_8): {
|
||||||
|
disableDecoderInterfaceBoardIc2();
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
case (gpioIds::CS_SUS_9): {
|
||||||
|
disableDecoderInterfaceBoardIc2();
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
case (gpioIds::CS_SUS_10): {
|
||||||
|
disableDecoderInterfaceBoardIc2();
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
case (gpioIds::CS_SUS_11): {
|
||||||
|
disableDecoderInterfaceBoardIc2();
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
case (gpioIds::CS_RW1): {
|
||||||
|
disableRwDecoder();
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
case (gpioIds::CS_RW2): {
|
||||||
|
disableRwDecoder();
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
case (gpioIds::CS_RW3): {
|
||||||
|
disableRwDecoder();
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
case (gpioIds::CS_RW4): {
|
||||||
|
disableRwDecoder();
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
default:
|
||||||
|
sif::debug << "spiCsDecoderCallback: Invalid gpio id " << gpioId << std::endl;
|
||||||
|
}
|
||||||
|
} else if (value == Levels::LOW) {
|
||||||
|
switch (gpioId) {
|
||||||
|
case (gpioIds::RTD_IC_3): {
|
||||||
|
selectY7();
|
||||||
|
enableDecoderTcsIc1();
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
case (gpioIds::RTD_IC_4): {
|
||||||
|
selectY6();
|
||||||
|
enableDecoderTcsIc1();
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
case (gpioIds::RTD_IC_5): {
|
||||||
|
selectY5();
|
||||||
|
enableDecoderTcsIc1();
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
case (gpioIds::RTD_IC_6): {
|
||||||
|
selectY4();
|
||||||
|
enableDecoderTcsIc1();
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
case (gpioIds::RTD_IC_7): {
|
||||||
|
selectY3();
|
||||||
|
enableDecoderTcsIc1();
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
case (gpioIds::RTD_IC_8): {
|
||||||
|
selectY2();
|
||||||
|
enableDecoderTcsIc1();
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
case (gpioIds::RTD_IC_9): {
|
||||||
|
selectY1();
|
||||||
|
enableDecoderTcsIc1();
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
case (gpioIds::RTD_IC_10): {
|
||||||
|
selectY0();
|
||||||
|
enableDecoderTcsIc1();
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
case (gpioIds::RTD_IC_11): {
|
||||||
|
selectY7();
|
||||||
|
enableDecoderTcsIc2();
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
case (gpioIds::RTD_IC_12): {
|
||||||
|
selectY6();
|
||||||
|
enableDecoderTcsIc2();
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
case (gpioIds::RTD_IC_13): {
|
||||||
|
selectY5();
|
||||||
|
enableDecoderTcsIc2();
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
case (gpioIds::RTD_IC_14): {
|
||||||
|
selectY4();
|
||||||
|
enableDecoderTcsIc2();
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
case (gpioIds::RTD_IC_15): {
|
||||||
|
selectY3();
|
||||||
|
enableDecoderTcsIc2();
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
case (gpioIds::RTD_IC_16): {
|
||||||
|
selectY2();
|
||||||
|
enableDecoderTcsIc2();
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
case (gpioIds::RTD_IC_17): {
|
||||||
|
selectY1();
|
||||||
|
enableDecoderTcsIc2();
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
case (gpioIds::RTD_IC_18): {
|
||||||
|
selectY0();
|
||||||
|
enableDecoderTcsIc2();
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
case (gpioIds::CS_SUS_0): {
|
||||||
|
selectY0();
|
||||||
|
enableDecoderInterfaceBoardIc1();
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
case (gpioIds::CS_SUS_1): {
|
||||||
|
selectY1();
|
||||||
|
enableDecoderInterfaceBoardIc1();
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
case (gpioIds::CS_SUS_2): {
|
||||||
|
selectY2();
|
||||||
|
enableDecoderInterfaceBoardIc1();
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
case (gpioIds::CS_SUS_3): {
|
||||||
|
selectY3();
|
||||||
|
enableDecoderInterfaceBoardIc1();
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
case (gpioIds::CS_SUS_4): {
|
||||||
|
selectY4();
|
||||||
|
enableDecoderInterfaceBoardIc1();
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
case (gpioIds::CS_SUS_5): {
|
||||||
|
selectY5();
|
||||||
|
enableDecoderInterfaceBoardIc1();
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
case (gpioIds::CS_SUS_6): {
|
||||||
|
selectY0();
|
||||||
|
enableDecoderInterfaceBoardIc2();
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
case (gpioIds::CS_SUS_7): {
|
||||||
|
selectY1();
|
||||||
|
enableDecoderInterfaceBoardIc2();
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
case (gpioIds::CS_SUS_8): {
|
||||||
|
selectY2();
|
||||||
|
enableDecoderInterfaceBoardIc2();
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
case (gpioIds::CS_SUS_9): {
|
||||||
|
selectY3();
|
||||||
|
enableDecoderInterfaceBoardIc2();
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
case (gpioIds::CS_SUS_10): {
|
||||||
|
selectY4();
|
||||||
|
enableDecoderInterfaceBoardIc2();
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
case (gpioIds::CS_SUS_11): {
|
||||||
|
selectY5();
|
||||||
|
enableDecoderInterfaceBoardIc2();
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
case (gpioIds::CS_RW1): {
|
||||||
|
selectY0();
|
||||||
|
enableRwDecoder();
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
case (gpioIds::CS_RW2): {
|
||||||
|
selectY1();
|
||||||
|
enableRwDecoder();
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
case (gpioIds::CS_RW3): {
|
||||||
|
selectY2();
|
||||||
|
enableRwDecoder();
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
case (gpioIds::CS_RW4): {
|
||||||
|
selectY3();
|
||||||
|
enableRwDecoder();
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
default:
|
||||||
|
sif::debug << "spiCsDecoderCallback: Invalid gpio id " << gpioId << std::endl;
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
sif::debug << "spiCsDecoderCallback: Invalid value. Must be 0 or 1" << std::endl;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void enableDecoderTcsIc1() {
|
||||||
|
gpioComInterface->pullLow(gpioIds::SPI_MUX_BIT_0);
|
||||||
|
gpioComInterface->pullHigh(gpioIds::SPI_MUX_BIT_1);
|
||||||
|
gpioComInterface->pullLow(gpioIds::SPI_MUX_BIT_2);
|
||||||
|
}
|
||||||
|
|
||||||
|
void enableDecoderTcsIc2() {
|
||||||
|
gpioComInterface->pullHigh(gpioIds::SPI_MUX_BIT_2);
|
||||||
|
gpioComInterface->pullLow(gpioIds::SPI_MUX_BIT_0);
|
||||||
|
gpioComInterface->pullHigh(gpioIds::SPI_MUX_BIT_1);
|
||||||
|
}
|
||||||
|
|
||||||
|
void enableDecoderInterfaceBoardIc1() {
|
||||||
|
gpioComInterface->pullHigh(gpioIds::SPI_MUX_BIT_0);
|
||||||
|
gpioComInterface->pullLow(gpioIds::SPI_MUX_BIT_1);
|
||||||
|
gpioComInterface->pullLow(gpioIds::SPI_MUX_BIT_2);
|
||||||
|
}
|
||||||
|
|
||||||
|
void enableDecoderInterfaceBoardIc2() {
|
||||||
|
gpioComInterface->pullHigh(gpioIds::SPI_MUX_BIT_0);
|
||||||
|
gpioComInterface->pullLow(gpioIds::SPI_MUX_BIT_1);
|
||||||
|
gpioComInterface->pullHigh(gpioIds::SPI_MUX_BIT_2);
|
||||||
|
}
|
||||||
|
|
||||||
|
void disableDecoderTcsIc1() {
|
||||||
|
gpioComInterface->pullHigh(gpioIds::SPI_MUX_BIT_0);
|
||||||
|
gpioComInterface->pullHigh(gpioIds::SPI_MUX_BIT_1);
|
||||||
|
gpioComInterface->pullLow(gpioIds::SPI_MUX_BIT_2);
|
||||||
|
}
|
||||||
|
|
||||||
|
void disableDecoderTcsIc2() {
|
||||||
|
// DO NOT CHANGE THE ORDER HERE
|
||||||
|
gpioComInterface->pullHigh(gpioIds::SPI_MUX_BIT_0);
|
||||||
|
gpioComInterface->pullLow(gpioIds::SPI_MUX_BIT_2);
|
||||||
|
gpioComInterface->pullHigh(gpioIds::SPI_MUX_BIT_1);
|
||||||
|
}
|
||||||
|
|
||||||
|
void disableDecoderInterfaceBoardIc1() {
|
||||||
|
gpioComInterface->pullHigh(gpioIds::SPI_MUX_BIT_0);
|
||||||
|
gpioComInterface->pullHigh(gpioIds::SPI_MUX_BIT_1);
|
||||||
|
gpioComInterface->pullLow(gpioIds::SPI_MUX_BIT_2);
|
||||||
|
}
|
||||||
|
|
||||||
|
void disableDecoderInterfaceBoardIc2() {
|
||||||
|
gpioComInterface->pullHigh(gpioIds::SPI_MUX_BIT_0);
|
||||||
|
gpioComInterface->pullHigh(gpioIds::SPI_MUX_BIT_1);
|
||||||
|
gpioComInterface->pullLow(gpioIds::SPI_MUX_BIT_2);
|
||||||
|
}
|
||||||
|
|
||||||
|
void enableRwDecoder() { gpioComInterface->pullHigh(gpioIds::EN_RW_CS); }
|
||||||
|
|
||||||
|
void disableRwDecoder() { gpioComInterface->pullLow(gpioIds::EN_RW_CS); }
|
||||||
|
|
||||||
|
void selectY0() {
|
||||||
|
gpioComInterface->pullLow(gpioIds::SPI_MUX_BIT_3);
|
||||||
|
gpioComInterface->pullLow(gpioIds::SPI_MUX_BIT_4);
|
||||||
|
gpioComInterface->pullLow(gpioIds::SPI_MUX_BIT_5);
|
||||||
|
}
|
||||||
|
|
||||||
|
void selectY1() {
|
||||||
|
gpioComInterface->pullHigh(gpioIds::SPI_MUX_BIT_3);
|
||||||
|
gpioComInterface->pullLow(gpioIds::SPI_MUX_BIT_4);
|
||||||
|
gpioComInterface->pullLow(gpioIds::SPI_MUX_BIT_5);
|
||||||
|
}
|
||||||
|
|
||||||
|
void selectY2() {
|
||||||
|
gpioComInterface->pullLow(gpioIds::SPI_MUX_BIT_3);
|
||||||
|
gpioComInterface->pullHigh(gpioIds::SPI_MUX_BIT_4);
|
||||||
|
gpioComInterface->pullLow(gpioIds::SPI_MUX_BIT_5);
|
||||||
|
}
|
||||||
|
|
||||||
|
void selectY3() {
|
||||||
|
gpioComInterface->pullHigh(gpioIds::SPI_MUX_BIT_3);
|
||||||
|
gpioComInterface->pullHigh(gpioIds::SPI_MUX_BIT_4);
|
||||||
|
gpioComInterface->pullLow(gpioIds::SPI_MUX_BIT_5);
|
||||||
|
}
|
||||||
|
|
||||||
|
void selectY4() {
|
||||||
|
gpioComInterface->pullLow(gpioIds::SPI_MUX_BIT_3);
|
||||||
|
gpioComInterface->pullLow(gpioIds::SPI_MUX_BIT_4);
|
||||||
|
gpioComInterface->pullHigh(gpioIds::SPI_MUX_BIT_5);
|
||||||
|
}
|
||||||
|
|
||||||
|
void selectY5() {
|
||||||
|
gpioComInterface->pullHigh(gpioIds::SPI_MUX_BIT_3);
|
||||||
|
gpioComInterface->pullLow(gpioIds::SPI_MUX_BIT_4);
|
||||||
|
gpioComInterface->pullHigh(gpioIds::SPI_MUX_BIT_5);
|
||||||
|
}
|
||||||
|
|
||||||
|
void selectY6() {
|
||||||
|
gpioComInterface->pullLow(gpioIds::SPI_MUX_BIT_3);
|
||||||
|
gpioComInterface->pullHigh(gpioIds::SPI_MUX_BIT_4);
|
||||||
|
gpioComInterface->pullHigh(gpioIds::SPI_MUX_BIT_5);
|
||||||
|
}
|
||||||
|
|
||||||
|
void selectY7() {
|
||||||
|
gpioComInterface->pullHigh(gpioIds::SPI_MUX_BIT_3);
|
||||||
|
gpioComInterface->pullHigh(gpioIds::SPI_MUX_BIT_4);
|
||||||
|
gpioComInterface->pullHigh(gpioIds::SPI_MUX_BIT_5);
|
||||||
|
}
|
||||||
|
|
||||||
|
void disableAllDecoder() {
|
||||||
|
gpioComInterface->pullLow(gpioIds::SPI_MUX_BIT_2);
|
||||||
|
gpioComInterface->pullLow(gpioIds::SPI_MUX_BIT_0);
|
||||||
|
gpioComInterface->pullLow(gpioIds::SPI_MUX_BIT_1);
|
||||||
|
gpioComInterface->pullLow(gpioIds::EN_RW_CS);
|
||||||
|
}
|
||||||
|
|
||||||
|
} // namespace gpioCallbacks
|
73
bsp_q7s/callbacks/gpioCallbacks.h
Normal file
73
bsp_q7s/callbacks/gpioCallbacks.h
Normal file
@ -0,0 +1,73 @@
|
|||||||
|
#ifndef LINUX_GPIO_GPIOCALLBACKS_H_
|
||||||
|
#define LINUX_GPIO_GPIOCALLBACKS_H_
|
||||||
|
|
||||||
|
#include <fsfw_hal/common/gpio/GpioIF.h>
|
||||||
|
#include <fsfw_hal/common/gpio/gpioDefinitions.h>
|
||||||
|
|
||||||
|
namespace gpioCallbacks {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief This function initializes the GPIOs used to control the SN74LVC138APWR decoders on
|
||||||
|
* the TCS Board and the interface board.
|
||||||
|
*/
|
||||||
|
void initSpiCsDecoder(GpioIF* gpioComIF);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief This function implements the decoding to multiply gpios by using the decoder
|
||||||
|
* chips SN74LVC138APWR on the TCS board and the interface board.
|
||||||
|
*/
|
||||||
|
void spiCsDecoderCallback(gpioId_t gpioId, gpio::GpioOperation gpioOp, gpio::Levels value,
|
||||||
|
void* args);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief This function sets mux bits 1-3 to a state which will only enable the decoder
|
||||||
|
* on the TCS board which is named to IC1 in the schematic.
|
||||||
|
*/
|
||||||
|
void enableDecoderTcsIc1();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief This function sets mux bits 1-3 to a state which will only enable the decoder
|
||||||
|
* on the TCS board which is named to IC2 in the schematic.
|
||||||
|
*/
|
||||||
|
void enableDecoderTcsIc2();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief This function sets mux bits 1-3 to a state which will only enable the decoder
|
||||||
|
* on the inteface board board which is named to IC21 in the schematic.
|
||||||
|
*/
|
||||||
|
void enableDecoderInterfaceBoardIc1();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief This function sets mux bits 1-3 to a state which will only enable the decoder
|
||||||
|
* on the inteface board board which is named to IC22 in the schematic.
|
||||||
|
*/
|
||||||
|
void enableDecoderInterfaceBoardIc2();
|
||||||
|
|
||||||
|
void disableDecoderTcsIc1();
|
||||||
|
void disableDecoderTcsIc2();
|
||||||
|
void disableDecoderInterfaceBoardIc1();
|
||||||
|
void disableDecoderInterfaceBoardIc2();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Enables the reaction wheel chip select decoder (IC3).
|
||||||
|
*/
|
||||||
|
void enableRwDecoder();
|
||||||
|
void disableRwDecoder();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief This function disables all decoder.
|
||||||
|
*/
|
||||||
|
void disableAllDecoder();
|
||||||
|
|
||||||
|
/** The following functions enable the appropriate channel of the currently enabled decoder */
|
||||||
|
void selectY0();
|
||||||
|
void selectY1();
|
||||||
|
void selectY2();
|
||||||
|
void selectY3();
|
||||||
|
void selectY4();
|
||||||
|
void selectY5();
|
||||||
|
void selectY6();
|
||||||
|
void selectY7();
|
||||||
|
} // namespace gpioCallbacks
|
||||||
|
|
||||||
|
#endif /* LINUX_GPIO_GPIOCALLBACKS_H_ */
|
32
bsp_q7s/callbacks/pcduSwitchCb.cpp
Normal file
32
bsp_q7s/callbacks/pcduSwitchCb.cpp
Normal file
@ -0,0 +1,32 @@
|
|||||||
|
#include "pcduSwitchCb.h"
|
||||||
|
|
||||||
|
#include <fsfw_hal/linux/gpio/LinuxLibgpioIF.h>
|
||||||
|
|
||||||
|
#include "devices/gpioIds.h"
|
||||||
|
|
||||||
|
void pcdu::switchCallback(GOMSPACE::Pdu pdu, uint8_t channel, bool state, void* args) {
|
||||||
|
LinuxLibgpioIF* gpioComIF = reinterpret_cast<LinuxLibgpioIF*>(args);
|
||||||
|
if (gpioComIF == nullptr) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
if (pdu == GOMSPACE::Pdu::PDU1) {
|
||||||
|
PDU1::SwitchChannels typedChannel = static_cast<PDU1::SwitchChannels>(channel);
|
||||||
|
if (typedChannel == PDU1::SwitchChannels::ACS_A_SIDE) {
|
||||||
|
if (state) {
|
||||||
|
gpioComIF->pullHigh(gpioIds::GNSS_0_NRESET);
|
||||||
|
} else {
|
||||||
|
gpioComIF->pullLow(gpioIds::GNSS_0_NRESET);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
} else if (pdu == GOMSPACE::Pdu::PDU2) {
|
||||||
|
PDU2::SwitchChannels typedChannel = static_cast<PDU2::SwitchChannels>(channel);
|
||||||
|
if (typedChannel == PDU2::SwitchChannels::ACS_B_SIDE) {
|
||||||
|
if (state) {
|
||||||
|
gpioComIF->pullHigh(gpioIds::GNSS_1_NRESET);
|
||||||
|
} else {
|
||||||
|
gpioComIF->pullLow(gpioIds::GNSS_1_NRESET);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
14
bsp_q7s/callbacks/pcduSwitchCb.h
Normal file
14
bsp_q7s/callbacks/pcduSwitchCb.h
Normal file
@ -0,0 +1,14 @@
|
|||||||
|
#ifndef BSP_Q7S_CALLBACKS_PCDUSWITCHCB_H_
|
||||||
|
#define BSP_Q7S_CALLBACKS_PCDUSWITCHCB_H_
|
||||||
|
|
||||||
|
#include <cstdint>
|
||||||
|
|
||||||
|
#include "mission/devices/devicedefinitions/GomspaceDefinitions.h"
|
||||||
|
|
||||||
|
namespace pcdu {
|
||||||
|
|
||||||
|
void switchCallback(GOMSPACE::Pdu pdu, uint8_t channel, bool state, void* args);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
#endif /* BSP_Q7S_CALLBACKS_PCDUSWITCHCB_H_ */
|
@ -1,22 +1,20 @@
|
|||||||
#include "rwSpiCallback.h"
|
#include "rwSpiCallback.h"
|
||||||
#include "devices/gpioIds.h"
|
|
||||||
#include "mission/devices/RwHandler.h"
|
|
||||||
|
|
||||||
#include "fsfw_hal/linux/spi/SpiCookie.h"
|
#include "devices/gpioIds.h"
|
||||||
#include "fsfw_hal/linux/UnixFileGuard.h"
|
|
||||||
#include "fsfw/serviceinterface/ServiceInterface.h"
|
#include "fsfw/serviceinterface/ServiceInterface.h"
|
||||||
|
#include "fsfw_hal/linux/UnixFileGuard.h"
|
||||||
|
#include "fsfw_hal/linux/spi/SpiCookie.h"
|
||||||
|
#include "mission/devices/RwHandler.h"
|
||||||
|
|
||||||
namespace rwSpiCallback {
|
namespace rwSpiCallback {
|
||||||
|
|
||||||
ReturnValue_t spiCallback(SpiComIF* comIf, SpiCookie *cookie, const uint8_t *sendData,
|
ReturnValue_t spiCallback(SpiComIF* comIf, SpiCookie* cookie, const uint8_t* sendData,
|
||||||
size_t sendLen, void* args) {
|
size_t sendLen, void* args) {
|
||||||
|
|
||||||
ReturnValue_t result = HasReturnvaluesIF::RETURN_OK;
|
ReturnValue_t result = HasReturnvaluesIF::RETURN_OK;
|
||||||
|
|
||||||
RwHandler* handler = reinterpret_cast<RwHandler*>(args);
|
RwHandler* handler = reinterpret_cast<RwHandler*>(args);
|
||||||
if(handler == nullptr) {
|
if (handler == nullptr) {
|
||||||
sif::error << "rwSpiCallback::spiCallback: Pointer to handler is invalid"
|
sif::error << "rwSpiCallback::spiCallback: Pointer to handler is invalid" << std::endl;
|
||||||
<< std::endl;
|
|
||||||
return HasReturnvaluesIF::RETURN_FAILED;
|
return HasReturnvaluesIF::RETURN_FAILED;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -28,7 +26,7 @@ ReturnValue_t spiCallback(SpiComIF* comIf, SpiCookie *cookie, const uint8_t *sen
|
|||||||
MutexIF::TimeoutType timeoutType = MutexIF::TimeoutType::WAITING;
|
MutexIF::TimeoutType timeoutType = MutexIF::TimeoutType::WAITING;
|
||||||
uint32_t timeoutMs = 0;
|
uint32_t timeoutMs = 0;
|
||||||
MutexIF* mutex = comIf->getMutex(&timeoutType, &timeoutMs);
|
MutexIF* mutex = comIf->getMutex(&timeoutType, &timeoutMs);
|
||||||
if(mutex == nullptr or gpioIF == nullptr) {
|
if (mutex == nullptr or gpioIF == nullptr) {
|
||||||
sif::debug << "rwSpiCallback::spiCallback: Mutex or GPIO interface invalid" << std::endl;
|
sif::debug << "rwSpiCallback::spiCallback: Mutex or GPIO interface invalid" << std::endl;
|
||||||
return HasReturnvaluesIF::RETURN_FAILED;
|
return HasReturnvaluesIF::RETURN_FAILED;
|
||||||
}
|
}
|
||||||
@ -36,7 +34,7 @@ ReturnValue_t spiCallback(SpiComIF* comIf, SpiCookie *cookie, const uint8_t *sen
|
|||||||
int fileDescriptor = 0;
|
int fileDescriptor = 0;
|
||||||
std::string device = cookie->getSpiDevice();
|
std::string device = cookie->getSpiDevice();
|
||||||
UnixFileGuard fileHelper(device, &fileDescriptor, O_RDWR, "rwSpiCallback::spiCallback");
|
UnixFileGuard fileHelper(device, &fileDescriptor, O_RDWR, "rwSpiCallback::spiCallback");
|
||||||
if(fileHelper.getOpenResult() != HasReturnvaluesIF::RETURN_OK) {
|
if (fileHelper.getOpenResult() != HasReturnvaluesIF::RETURN_OK) {
|
||||||
sif::error << "rwSpiCallback::spiCallback: Failed to open device file" << std::endl;
|
sif::error << "rwSpiCallback::spiCallback: Failed to open device file" << std::endl;
|
||||||
return SpiComIF::OPENING_FILE_FAILED;
|
return SpiComIF::OPENING_FILE_FAILED;
|
||||||
}
|
}
|
||||||
@ -56,8 +54,8 @@ ReturnValue_t spiCallback(SpiComIF* comIf, SpiCookie *cookie, const uint8_t *sen
|
|||||||
writeSize = 1;
|
writeSize = 1;
|
||||||
|
|
||||||
// Pull SPI CS low. For now, no support for active high given
|
// Pull SPI CS low. For now, no support for active high given
|
||||||
if(gpioId != gpio::NO_GPIO) {
|
if (gpioId != gpio::NO_GPIO) {
|
||||||
if(gpioIF->pullLow(gpioId) != HasReturnvaluesIF::RETURN_OK) {
|
if (gpioIF->pullLow(gpioId) != HasReturnvaluesIF::RETURN_OK) {
|
||||||
sif::error << "rwSpiCallback::spiCallback: Failed to pull chip select low" << std::endl;
|
sif::error << "rwSpiCallback::spiCallback: Failed to pull chip select low" << std::endl;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -70,8 +68,8 @@ ReturnValue_t spiCallback(SpiComIF* comIf, SpiCookie *cookie, const uint8_t *sen
|
|||||||
|
|
||||||
/** Encoding and sending command */
|
/** Encoding and sending command */
|
||||||
size_t idx = 0;
|
size_t idx = 0;
|
||||||
while(idx < sendLen) {
|
while (idx < sendLen) {
|
||||||
switch(*(sendData + idx)) {
|
switch (*(sendData + idx)) {
|
||||||
case 0x7E:
|
case 0x7E:
|
||||||
writeBuffer[0] = 0x7D;
|
writeBuffer[0] = 0x7D;
|
||||||
writeBuffer[1] = 0x5E;
|
writeBuffer[1] = 0x5E;
|
||||||
@ -107,7 +105,7 @@ ReturnValue_t spiCallback(SpiComIF* comIf, SpiCookie *cookie, const uint8_t *sen
|
|||||||
|
|
||||||
uint8_t* rxBuf = nullptr;
|
uint8_t* rxBuf = nullptr;
|
||||||
result = comIf->getReadBuffer(cookie->getSpiAddress(), &rxBuf);
|
result = comIf->getReadBuffer(cookie->getSpiAddress(), &rxBuf);
|
||||||
if(result != HasReturnvaluesIF::RETURN_OK) {
|
if (result != HasReturnvaluesIF::RETURN_OK) {
|
||||||
closeSpi(gpioId, gpioIF, mutex);
|
closeSpi(gpioId, gpioIF, mutex);
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
@ -123,13 +121,13 @@ ReturnValue_t spiCallback(SpiComIF* comIf, SpiCookie *cookie, const uint8_t *sen
|
|||||||
*/
|
*/
|
||||||
uint8_t byteRead = 0;
|
uint8_t byteRead = 0;
|
||||||
for (int idx = 0; idx < 10; idx++) {
|
for (int idx = 0; idx < 10; idx++) {
|
||||||
if(read(fileDescriptor, &byteRead, 1) != 1) {
|
if (read(fileDescriptor, &byteRead, 1) != 1) {
|
||||||
sif::error << "rwSpiCallback::spiCallback: Read failed" << std::endl;
|
sif::error << "rwSpiCallback::spiCallback: Read failed" << std::endl;
|
||||||
closeSpi(gpioId, gpioIF, mutex);
|
closeSpi(gpioId, gpioIF, mutex);
|
||||||
return RwHandler::SPI_READ_FAILURE;
|
return RwHandler::SPI_READ_FAILURE;
|
||||||
}
|
}
|
||||||
if(idx == 0) {
|
if (idx == 0) {
|
||||||
if(byteRead != FLAG_BYTE) {
|
if (byteRead != FLAG_BYTE) {
|
||||||
sif::error << "Invalid data, expected start marker" << std::endl;
|
sif::error << "Invalid data, expected start marker" << std::endl;
|
||||||
closeSpi(gpioId, gpioIF, mutex);
|
closeSpi(gpioId, gpioIF, mutex);
|
||||||
return RwHandler::NO_START_MARKER;
|
return RwHandler::NO_START_MARKER;
|
||||||
@ -152,12 +150,11 @@ ReturnValue_t spiCallback(SpiComIF* comIf, SpiCookie *cookie, const uint8_t *sen
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
size_t decodedFrameLen = 0;
|
size_t decodedFrameLen = 0;
|
||||||
while(decodedFrameLen < replyBufferSize) {
|
while (decodedFrameLen < replyBufferSize) {
|
||||||
|
|
||||||
/** First byte already read in */
|
/** First byte already read in */
|
||||||
if (decodedFrameLen != 0) {
|
if (decodedFrameLen != 0) {
|
||||||
byteRead = 0;
|
byteRead = 0;
|
||||||
if(read(fileDescriptor, &byteRead, 1) != 1) {
|
if (read(fileDescriptor, &byteRead, 1) != 1) {
|
||||||
sif::error << "rwSpiCallback::spiCallback: Read failed" << std::endl;
|
sif::error << "rwSpiCallback::spiCallback: Read failed" << std::endl;
|
||||||
result = RwHandler::SPI_READ_FAILURE;
|
result = RwHandler::SPI_READ_FAILURE;
|
||||||
break;
|
break;
|
||||||
@ -167,9 +164,8 @@ ReturnValue_t spiCallback(SpiComIF* comIf, SpiCookie *cookie, const uint8_t *sen
|
|||||||
if (byteRead == FLAG_BYTE) {
|
if (byteRead == FLAG_BYTE) {
|
||||||
/** Reached end of frame */
|
/** Reached end of frame */
|
||||||
break;
|
break;
|
||||||
}
|
} else if (byteRead == 0x7D) {
|
||||||
else if (byteRead == 0x7D) {
|
if (read(fileDescriptor, &byteRead, 1) != 1) {
|
||||||
if(read(fileDescriptor, &byteRead, 1) != 1) {
|
|
||||||
sif::error << "rwSpiCallback::spiCallback: Read failed" << std::endl;
|
sif::error << "rwSpiCallback::spiCallback: Read failed" << std::endl;
|
||||||
result = RwHandler::SPI_READ_FAILURE;
|
result = RwHandler::SPI_READ_FAILURE;
|
||||||
break;
|
break;
|
||||||
@ -178,22 +174,20 @@ ReturnValue_t spiCallback(SpiComIF* comIf, SpiCookie *cookie, const uint8_t *sen
|
|||||||
*(rxBuf + decodedFrameLen) = 0x7E;
|
*(rxBuf + decodedFrameLen) = 0x7E;
|
||||||
decodedFrameLen++;
|
decodedFrameLen++;
|
||||||
continue;
|
continue;
|
||||||
}
|
} else if (byteRead == 0x5D) {
|
||||||
else if (byteRead == 0x5D) {
|
|
||||||
*(rxBuf + decodedFrameLen) = 0x7D;
|
*(rxBuf + decodedFrameLen) = 0x7D;
|
||||||
decodedFrameLen++;
|
decodedFrameLen++;
|
||||||
continue;
|
continue;
|
||||||
}
|
} else {
|
||||||
else {
|
|
||||||
sif::error << "rwSpiCallback::spiCallback: Invalid substitute" << std::endl;
|
sif::error << "rwSpiCallback::spiCallback: Invalid substitute" << std::endl;
|
||||||
closeSpi(gpioId, gpioIF, mutex);
|
closeSpi(gpioId, gpioIF, mutex);
|
||||||
result = RwHandler::INVALID_SUBSTITUTE;
|
result = RwHandler::INVALID_SUBSTITUTE;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
} else {
|
||||||
else {
|
|
||||||
*(rxBuf + decodedFrameLen) = byteRead;
|
*(rxBuf + decodedFrameLen) = byteRead;
|
||||||
decodedFrameLen++;
|
decodedFrameLen++;
|
||||||
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -202,7 +196,7 @@ ReturnValue_t spiCallback(SpiComIF* comIf, SpiCookie *cookie, const uint8_t *sen
|
|||||||
* Otherwise there might be something wrong.
|
* Otherwise there might be something wrong.
|
||||||
*/
|
*/
|
||||||
if (decodedFrameLen == replyBufferSize) {
|
if (decodedFrameLen == replyBufferSize) {
|
||||||
if(read(fileDescriptor, &byteRead, 1) != 1) {
|
if (read(fileDescriptor, &byteRead, 1) != 1) {
|
||||||
sif::error << "rwSpiCallback::spiCallback: Failed to read last byte" << std::endl;
|
sif::error << "rwSpiCallback::spiCallback: Failed to read last byte" << std::endl;
|
||||||
result = RwHandler::SPI_READ_FAILURE;
|
result = RwHandler::SPI_READ_FAILURE;
|
||||||
break;
|
break;
|
||||||
@ -224,14 +218,15 @@ ReturnValue_t spiCallback(SpiComIF* comIf, SpiCookie *cookie, const uint8_t *sen
|
|||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
void closeSpi (gpioId_t gpioId, GpioIF* gpioIF, MutexIF* mutex) {
|
void closeSpi(gpioId_t gpioId, GpioIF* gpioIF, MutexIF* mutex) {
|
||||||
if(gpioId != gpio::NO_GPIO) {
|
if (gpioId != gpio::NO_GPIO) {
|
||||||
if (gpioIF->pullHigh(gpioId) != HasReturnvaluesIF::RETURN_OK) {
|
if (gpioIF->pullHigh(gpioId) != HasReturnvaluesIF::RETURN_OK) {
|
||||||
sif::error << "closeSpi: Failed to pull chip select high" << std::endl;
|
sif::error << "closeSpi: Failed to pull chip select high" << std::endl;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if(mutex->unlockMutex() != HasReturnvaluesIF::RETURN_OK) {
|
if (mutex->unlockMutex() != HasReturnvaluesIF::RETURN_OK) {
|
||||||
sif::error << "rwSpiCallback::closeSpi: Failed to unlock mutex" << std::endl;;
|
sif::error << "rwSpiCallback::closeSpi: Failed to unlock mutex" << std::endl;
|
||||||
|
;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
} // namespace rwSpiCallback
|
||||||
|
@ -2,9 +2,8 @@
|
|||||||
#define BSP_Q7S_RW_SPI_CALLBACK_H_
|
#define BSP_Q7S_RW_SPI_CALLBACK_H_
|
||||||
|
|
||||||
#include "fsfw/returnvalues/HasReturnvaluesIF.h"
|
#include "fsfw/returnvalues/HasReturnvaluesIF.h"
|
||||||
#include "fsfw_hal/linux/spi/SpiComIF.h"
|
|
||||||
#include "fsfw_hal/common/gpio/GpioCookie.h"
|
#include "fsfw_hal/common/gpio/GpioCookie.h"
|
||||||
|
#include "fsfw_hal/linux/spi/SpiComIF.h"
|
||||||
|
|
||||||
namespace rwSpiCallback {
|
namespace rwSpiCallback {
|
||||||
|
|
||||||
@ -31,7 +30,7 @@ static constexpr uint8_t FLAG_BYTE = 0x7E;
|
|||||||
* To switch between the to SPI peripherals, an EMIO is used which will also be controlled
|
* To switch between the to SPI peripherals, an EMIO is used which will also be controlled
|
||||||
* by this function.
|
* by this function.
|
||||||
*/
|
*/
|
||||||
ReturnValue_t spiCallback(SpiComIF* comIf, SpiCookie *cookie, const uint8_t *sendData,
|
ReturnValue_t spiCallback(SpiComIF* comIf, SpiCookie* cookie, const uint8_t* sendData,
|
||||||
size_t sendLen, void* args);
|
size_t sendLen, void* args);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -43,5 +42,5 @@ ReturnValue_t spiCallback(SpiComIF* comIf, SpiCookie *cookie, const uint8_t *sen
|
|||||||
*/
|
*/
|
||||||
void closeSpi(gpioId_t gpioId, GpioIF* gpioIF, MutexIF* mutex);
|
void closeSpi(gpioId_t gpioId, GpioIF* gpioIF, MutexIF* mutex);
|
||||||
|
|
||||||
}
|
} // namespace rwSpiCallback
|
||||||
#endif /* BSP_Q7S_RW_SPI_CALLBACK_H_ */
|
#endif /* BSP_Q7S_RW_SPI_CALLBACK_H_ */
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
target_sources(${TARGET_NAME} PRIVATE
|
target_sources(${OBSW_NAME} PRIVATE
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
|
@ -1,6 +1,10 @@
|
|||||||
target_sources(${TARGET_NAME} PRIVATE
|
target_sources(${OBSW_NAME} PRIVATE
|
||||||
CoreController.cpp
|
CoreController.cpp
|
||||||
obsw.cpp
|
obsw.cpp
|
||||||
InitMission.cpp
|
InitMission.cpp
|
||||||
ObjectFactory.cpp
|
ObjectFactory.cpp
|
||||||
)
|
)
|
||||||
|
|
||||||
|
target_sources(${SIMPLE_OBSW_NAME} PRIVATE
|
||||||
|
InitMission.cpp
|
||||||
|
)
|
||||||
|
File diff suppressed because it is too large
Load Diff
@ -2,59 +2,96 @@
|
|||||||
#define BSP_Q7S_CORE_CORECONTROLLER_H_
|
#define BSP_Q7S_CORE_CORECONTROLLER_H_
|
||||||
|
|
||||||
#include <fsfw/globalfunctions/PeriodicOperationDivider.h>
|
#include <fsfw/globalfunctions/PeriodicOperationDivider.h>
|
||||||
#include "fsfw/controller/ExtendedControllerBase.h"
|
#include <libxiphos.h>
|
||||||
|
|
||||||
|
#include <cstddef>
|
||||||
|
|
||||||
|
#include "CoreDefinitions.h"
|
||||||
#include "bsp_q7s/memory/SdCardManager.h"
|
#include "bsp_q7s/memory/SdCardManager.h"
|
||||||
|
|
||||||
#include "events/subsystemIdRanges.h"
|
#include "events/subsystemIdRanges.h"
|
||||||
|
#include "fsfw/controller/ExtendedControllerBase.h"
|
||||||
|
|
||||||
class Timer;
|
class Timer;
|
||||||
class SdCardManager;
|
class SdCardManager;
|
||||||
|
|
||||||
class CoreController: public ExtendedControllerBase {
|
namespace xsc {
|
||||||
public:
|
|
||||||
enum Chip: uint8_t {
|
|
||||||
CHIP_0,
|
|
||||||
CHIP_1,
|
|
||||||
NO_CHIP,
|
|
||||||
SELF_CHIP,
|
|
||||||
ALL_CHIP
|
|
||||||
};
|
|
||||||
|
|
||||||
enum Copy: uint8_t {
|
enum Chip : int { CHIP_0, CHIP_1, NO_CHIP, SELF_CHIP, ALL_CHIP };
|
||||||
COPY_0,
|
enum Copy : int { COPY_0, COPY_1, NO_COPY, SELF_COPY, ALL_COPY };
|
||||||
COPY_1,
|
|
||||||
NO_COPY,
|
} // namespace xsc
|
||||||
SELF_COPY,
|
|
||||||
ALL_COPY
|
struct RebootFile {
|
||||||
};
|
static constexpr uint8_t DEFAULT_MAX_BOOT_CNT = 10;
|
||||||
|
|
||||||
|
bool enabled = true;
|
||||||
|
size_t maxCount = DEFAULT_MAX_BOOT_CNT;
|
||||||
|
uint32_t img00Cnt = 0;
|
||||||
|
uint32_t img01Cnt = 0;
|
||||||
|
uint32_t img10Cnt = 0;
|
||||||
|
uint32_t img11Cnt = 0;
|
||||||
|
bool img00Lock = false;
|
||||||
|
bool img01Lock = false;
|
||||||
|
bool img10Lock = false;
|
||||||
|
bool img11Lock = false;
|
||||||
|
uint32_t* relevantBootCnt = &img00Cnt;
|
||||||
|
bool bootFlag = false;
|
||||||
|
xsc::Chip lastChip = xsc::Chip::CHIP_0;
|
||||||
|
xsc::Copy lastCopy = xsc::Copy::COPY_0;
|
||||||
|
xsc::Chip mechanismNextChip = xsc::Chip::NO_CHIP;
|
||||||
|
xsc::Copy mechanismNextCopy = xsc::Copy::NO_COPY;
|
||||||
|
};
|
||||||
|
|
||||||
|
class CoreController : public ExtendedControllerBase {
|
||||||
|
public:
|
||||||
|
static xsc::Chip CURRENT_CHIP;
|
||||||
|
static xsc::Copy CURRENT_COPY;
|
||||||
|
|
||||||
static constexpr char CHIP_PROT_SCRIPT[] = "/home/root/scripts/get-chip-prot-status.sh";
|
static constexpr char CHIP_PROT_SCRIPT[] = "/home/root/scripts/get-chip-prot-status.sh";
|
||||||
static constexpr char CHIP_STATE_FILE[] = "/tmp/chip_prot_status.txt";
|
static constexpr char CHIP_STATE_FILE[] = "/tmp/chip_prot_status.txt";
|
||||||
static constexpr char CURR_COPY_FILE[] = "/tmp/curr_copy.txt";
|
static constexpr char CURR_COPY_FILE[] = "/tmp/curr_copy.txt";
|
||||||
static constexpr char VERSION_FILE[] = "/conf/sd_status";
|
static constexpr char CONF_FOLDER[] = "conf";
|
||||||
|
static constexpr char VERSION_FILE_NAME[] = "version.txt";
|
||||||
|
static constexpr char REBOOT_FILE_NAME[] = "reboot.txt";
|
||||||
|
const std::string VERSION_FILE =
|
||||||
|
"/" + std::string(CONF_FOLDER) + "/" + std::string(VERSION_FILE_NAME);
|
||||||
|
const std::string REBOOT_FILE =
|
||||||
|
"/" + std::string(CONF_FOLDER) + "/" + std::string(REBOOT_FILE_NAME);
|
||||||
|
|
||||||
static constexpr ActionId_t LIST_DIRECTORY_INTO_FILE = 0;
|
static constexpr ActionId_t LIST_DIRECTORY_INTO_FILE = 0;
|
||||||
|
static constexpr ActionId_t SWITCH_REBOOT_FILE_HANDLING = 5;
|
||||||
|
static constexpr ActionId_t RESET_REBOOT_COUNTERS = 6;
|
||||||
|
static constexpr ActionId_t SWITCH_IMG_LOCK = 7;
|
||||||
|
static constexpr ActionId_t SET_MAX_REBOOT_CNT = 8;
|
||||||
|
|
||||||
static constexpr ActionId_t REBOOT_OBC = 32;
|
static constexpr ActionId_t REBOOT_OBC = 32;
|
||||||
static constexpr ActionId_t MOUNT_OTHER_COPY = 33;
|
static constexpr ActionId_t MOUNT_OTHER_COPY = 33;
|
||||||
|
|
||||||
|
|
||||||
static constexpr uint8_t SUBSYSTEM_ID = SUBSYSTEM_ID::CORE;
|
static constexpr uint8_t SUBSYSTEM_ID = SUBSYSTEM_ID::CORE;
|
||||||
|
|
||||||
static constexpr Event ALLOC_FAILURE = event::makeEvent(SUBSYSTEM_ID, 0, severity::MEDIUM);
|
static constexpr Event ALLOC_FAILURE = event::makeEvent(SUBSYSTEM_ID, 0, severity::MEDIUM);
|
||||||
|
//! [EXPORT] : [COMMENT] Software reboot occured. Can also be a systemd reboot.
|
||||||
|
//! P1: Current Chip, P2: Current Copy
|
||||||
|
static constexpr Event REBOOT_SW = event::makeEvent(SUBSYSTEM_ID, 1, severity::MEDIUM);
|
||||||
|
//! [EXPORT] : [COMMENT] The reboot mechanism was triggered.
|
||||||
|
//! P1: First 16 bits: Last Chip, Last 16 bits: Last Copy,
|
||||||
|
//! P2: Each byte is the respective reboot count for the slots
|
||||||
|
static constexpr Event REBOOT_MECHANISM_TRIGGERED =
|
||||||
|
event::makeEvent(SUBSYSTEM_ID, 2, severity::MEDIUM);
|
||||||
|
//! Trying to find a way how to determine that the reboot came from ProASIC3 or PCDU..
|
||||||
|
static constexpr Event REBOOT_HW = event::makeEvent(SUBSYSTEM_ID, 3, severity::MEDIUM);
|
||||||
|
|
||||||
CoreController(object_id_t objectId);
|
CoreController(object_id_t objectId);
|
||||||
virtual~ CoreController();
|
virtual ~CoreController();
|
||||||
|
|
||||||
ReturnValue_t initialize() override;
|
ReturnValue_t initialize() override;
|
||||||
|
|
||||||
ReturnValue_t initializeAfterTaskCreation() override;
|
ReturnValue_t initializeAfterTaskCreation() override;
|
||||||
|
|
||||||
ReturnValue_t executeAction(ActionId_t actionId,
|
ReturnValue_t executeAction(ActionId_t actionId, MessageQueueId_t commandedBy,
|
||||||
MessageQueueId_t commandedBy, const uint8_t *data, size_t size) override;
|
const uint8_t* data, size_t size) override;
|
||||||
|
|
||||||
ReturnValue_t handleCommandMessage(CommandMessage *message) override;
|
ReturnValue_t handleCommandMessage(CommandMessage* message) override;
|
||||||
void performControlOperation() override;
|
void performControlOperation() override;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -63,7 +100,7 @@ public:
|
|||||||
*/
|
*/
|
||||||
static ReturnValue_t generateChipStateFile();
|
static ReturnValue_t generateChipStateFile();
|
||||||
static ReturnValue_t incrementAllocationFailureCount();
|
static ReturnValue_t incrementAllocationFailureCount();
|
||||||
static void getCurrentBootCopy(Chip& chip, Copy& copy);
|
static void getCurrentBootCopy(xsc::Chip& chip, xsc::Copy& copy);
|
||||||
|
|
||||||
ReturnValue_t updateProtInfo(bool regenerateChipStateFile = true);
|
ReturnValue_t updateProtInfo(bool regenerateChipStateFile = true);
|
||||||
|
|
||||||
@ -78,15 +115,14 @@ public:
|
|||||||
* @param updateProtFile Specify whether the protection info file is updated
|
* @param updateProtFile Specify whether the protection info file is updated
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
ReturnValue_t setBootCopyProtection(Chip targetChip, Copy targetCopy,
|
ReturnValue_t setBootCopyProtection(xsc::Chip targetChip, xsc::Copy targetCopy, bool protect,
|
||||||
bool protect, bool& protOperationPerformed, bool updateProtFile = true);
|
bool& protOperationPerformed, bool updateProtFile = true);
|
||||||
|
|
||||||
bool sdInitFinished() const;
|
bool sdInitFinished() const;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
static Chip CURRENT_CHIP;
|
static constexpr MutexIF::TimeoutType TIMEOUT_TYPE = MutexIF::TimeoutType::WAITING;
|
||||||
static Copy CURRENT_COPY;
|
static constexpr uint32_t MUTEX_TIMEOUT = 20;
|
||||||
|
|
||||||
// Designated value for rechecking FIFO open
|
// Designated value for rechecking FIFO open
|
||||||
static constexpr int RETRY_FIFO_OPEN = -2;
|
static constexpr int RETRY_FIFO_OPEN = -2;
|
||||||
int watchdogFifoFd = 0;
|
int watchdogFifoFd = 0;
|
||||||
@ -135,8 +171,9 @@ private:
|
|||||||
sd::SdState currentlyCommandedState = sd::SdState::OFF;
|
sd::SdState currentlyCommandedState = sd::SdState::OFF;
|
||||||
sd::SdCard commandedCard = sd::SdCard::NONE;
|
sd::SdCard commandedCard = sd::SdCard::NONE;
|
||||||
sd::SdState commandedState = sd::SdState::OFF;
|
sd::SdState commandedState = sd::SdState::OFF;
|
||||||
};
|
} sdInfo;
|
||||||
SdInfo sdInfo;
|
RebootFile rebootFile = {};
|
||||||
|
bool doPerformMountedSdCardOps = true;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Index 0: Chip 0 Copy 0
|
* Index 0: Chip 0 Copy 0
|
||||||
@ -147,12 +184,13 @@ private:
|
|||||||
std::array<bool, 4> protArray;
|
std::array<bool, 4> protArray;
|
||||||
PeriodicOperationDivider opDivider;
|
PeriodicOperationDivider opDivider;
|
||||||
|
|
||||||
|
core::HkSet hkSet;
|
||||||
|
|
||||||
ReturnValue_t initializeLocalDataPool(localpool::DataPool& localDataPoolMap,
|
ReturnValue_t initializeLocalDataPool(localpool::DataPool& localDataPoolMap,
|
||||||
LocalDataPoolManager& poolManager) override;
|
LocalDataPoolManager& poolManager) override;
|
||||||
LocalPoolDataSetBase* getDataSetHandle(sid_t sid) override;
|
LocalPoolDataSetBase* getDataSetHandle(sid_t sid) override;
|
||||||
ReturnValue_t checkModeCommand(Mode_t mode, Submode_t submode,
|
ReturnValue_t checkModeCommand(Mode_t mode, Submode_t submode, uint32_t* msToReachTheMode);
|
||||||
uint32_t *msToReachTheMode);
|
void performMountedSdCardOperations();
|
||||||
|
|
||||||
ReturnValue_t initVersionFile();
|
ReturnValue_t initVersionFile();
|
||||||
ReturnValue_t initBootCopy();
|
ReturnValue_t initBootCopy();
|
||||||
ReturnValue_t initWatchdogFifo();
|
ReturnValue_t initWatchdogFifo();
|
||||||
@ -164,21 +202,30 @@ private:
|
|||||||
ReturnValue_t sdCardSetup(sd::SdCard sdCard, sd::SdState targetState, std::string sdChar,
|
ReturnValue_t sdCardSetup(sd::SdCard sdCard, sd::SdState targetState, std::string sdChar,
|
||||||
bool printOutput = true);
|
bool printOutput = true);
|
||||||
ReturnValue_t sdColdRedundantBlockingInit();
|
ReturnValue_t sdColdRedundantBlockingInit();
|
||||||
|
|
||||||
void currentStateSetter(sd::SdCard sdCard, sd::SdState newState);
|
void currentStateSetter(sd::SdCard sdCard, sd::SdState newState);
|
||||||
void determinePreferredSdCard();
|
void determinePreferredSdCard();
|
||||||
void executeNextExternalSdCommand();
|
void executeNextExternalSdCommand();
|
||||||
void checkExternalSdCommandStatus();
|
void checkExternalSdCommandStatus();
|
||||||
|
void performRebootFileHandling(bool recreateFile);
|
||||||
|
|
||||||
ReturnValue_t actionListDirectoryIntoFile(ActionId_t actionId, MessageQueueId_t commandedBy,
|
ReturnValue_t actionListDirectoryIntoFile(ActionId_t actionId, MessageQueueId_t commandedBy,
|
||||||
const uint8_t *data, size_t size);
|
const uint8_t* data, size_t size);
|
||||||
ReturnValue_t actionPerformReboot(const uint8_t *data, size_t size);
|
ReturnValue_t actionPerformReboot(const uint8_t* data, size_t size);
|
||||||
|
|
||||||
void performWatchdogControlOperation();
|
void performWatchdogControlOperation();
|
||||||
|
|
||||||
ReturnValue_t handleProtInfoUpdateLine(std::string nextLine);
|
ReturnValue_t handleProtInfoUpdateLine(std::string nextLine);
|
||||||
int handleBootCopyProtAtIndex(Chip targetChip, Copy targetCopy, bool protect,
|
int handleBootCopyProtAtIndex(xsc::Chip targetChip, xsc::Copy targetCopy, bool protect,
|
||||||
bool &protOperationPerformed, bool selfChip, bool selfCopy, bool allChips,
|
bool& protOperationPerformed, bool selfChip, bool selfCopy,
|
||||||
bool allCopies, uint8_t arrIdx);
|
bool allChips, bool allCopies, uint8_t arrIdx);
|
||||||
|
void determineAndExecuteReboot(RebootFile& rf, bool& needsReboot, xsc::Chip& tgtChip,
|
||||||
|
xsc::Copy& tgtCopy);
|
||||||
|
void resetRebootCount(xsc::Chip tgtChip, xsc::Copy tgtCopy);
|
||||||
|
void setRebootMechanismLock(bool lock, xsc::Chip tgtChip, xsc::Copy tgtCopy);
|
||||||
|
bool parseRebootFile(std::string path, RebootFile& file);
|
||||||
|
void rewriteRebootFile(RebootFile file);
|
||||||
|
void readHkData();
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif /* BSP_Q7S_CORE_CORECONTROLLER_H_ */
|
#endif /* BSP_Q7S_CORE_CORECONTROLLER_H_ */
|
||||||
|
39
bsp_q7s/core/CoreDefinitions.h
Normal file
39
bsp_q7s/core/CoreDefinitions.h
Normal file
@ -0,0 +1,39 @@
|
|||||||
|
#ifndef BSP_Q7S_CORE_COREDEFINITIONS_H_
|
||||||
|
#define BSP_Q7S_CORE_COREDEFINITIONS_H_
|
||||||
|
|
||||||
|
#include <fsfw/datapoollocal/StaticLocalDataSet.h>
|
||||||
|
|
||||||
|
namespace core {
|
||||||
|
|
||||||
|
static const uint8_t HK_SET_ENTRIES = 3;
|
||||||
|
static const uint32_t HK_SET_ID = 5;
|
||||||
|
|
||||||
|
enum PoolIds { TEMPERATURE, PS_VOLTAGE, PL_VOLTAGE };
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Set storing OBC internal housekeeping data
|
||||||
|
*/
|
||||||
|
class HkSet : public StaticLocalDataSet<HK_SET_ENTRIES> {
|
||||||
|
public:
|
||||||
|
HkSet(HasLocalDataPoolIF* owner) : StaticLocalDataSet(owner, HK_SET_ID) {}
|
||||||
|
|
||||||
|
HkSet(object_id_t objectId) : StaticLocalDataSet(sid_t(objectId, HK_SET_ID)) {}
|
||||||
|
|
||||||
|
// On-chip temperature
|
||||||
|
lp_var_t<float> temperature = lp_var_t<float>(sid.objectId, PoolIds::TEMPERATURE, this);
|
||||||
|
// Processing system VCC
|
||||||
|
lp_var_t<float> psVoltage = lp_var_t<float>(sid.objectId, PoolIds::PS_VOLTAGE, this);
|
||||||
|
// Programmable logic VCC
|
||||||
|
lp_var_t<float> plVoltage = lp_var_t<float>(sid.objectId, PoolIds::PL_VOLTAGE, this);
|
||||||
|
|
||||||
|
void printSet() {
|
||||||
|
sif::info << "HkSet::printSet: On-chip temperature: " << this->temperature << " °C"
|
||||||
|
<< std::endl;
|
||||||
|
sif::info << "HkSet::printSet: PS voltage: " << this->psVoltage << " mV" << std::endl;
|
||||||
|
sif::info << "HkSet::printSet: PL voltage: " << this->plVoltage << " mV" << std::endl;
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
} // namespace core
|
||||||
|
|
||||||
|
#endif /* BSP_Q7S_CORE_COREDEFINITIONS_H_ */
|
@ -1,22 +1,21 @@
|
|||||||
#include "InitMission.h"
|
#include "InitMission.h"
|
||||||
#include "ObjectFactory.h"
|
|
||||||
#include "OBSWConfig.h"
|
|
||||||
#include "pollingsequence/pollingSequenceFactory.h"
|
|
||||||
|
|
||||||
#include "mission/utility/InitMission.h"
|
|
||||||
|
|
||||||
#include "fsfw/platform.h"
|
|
||||||
#include "fsfw/objectmanager/ObjectManagerIF.h"
|
|
||||||
#include "fsfw/returnvalues/HasReturnvaluesIF.h"
|
|
||||||
#include "fsfw/serviceinterface/ServiceInterfaceStream.h"
|
|
||||||
#include "fsfw/objectmanager/ObjectManager.h"
|
|
||||||
#include "fsfw/tasks/FixedTimeslotTaskIF.h"
|
|
||||||
#include "fsfw/tasks/PeriodicTaskIF.h"
|
|
||||||
#include "fsfw/tasks/TaskFactory.h"
|
|
||||||
|
|
||||||
#include <iostream>
|
#include <iostream>
|
||||||
#include <vector>
|
#include <vector>
|
||||||
|
|
||||||
|
#include "OBSWConfig.h"
|
||||||
|
#include "ObjectFactory.h"
|
||||||
|
#include "fsfw/objectmanager/ObjectManager.h"
|
||||||
|
#include "fsfw/objectmanager/ObjectManagerIF.h"
|
||||||
|
#include "fsfw/platform.h"
|
||||||
|
#include "fsfw/returnvalues/HasReturnvaluesIF.h"
|
||||||
|
#include "fsfw/serviceinterface/ServiceInterfaceStream.h"
|
||||||
|
#include "fsfw/tasks/FixedTimeslotTaskIF.h"
|
||||||
|
#include "fsfw/tasks/PeriodicTaskIF.h"
|
||||||
|
#include "fsfw/tasks/TaskFactory.h"
|
||||||
|
#include "mission/utility/InitMission.h"
|
||||||
|
#include "pollingsequence/pollingSequenceFactory.h"
|
||||||
|
|
||||||
/* This is configured for linux without CR */
|
/* This is configured for linux without CR */
|
||||||
#ifdef PLATFORM_UNIX
|
#ifdef PLATFORM_UNIX
|
||||||
ServiceInterfaceStream sif::debug("DEBUG");
|
ServiceInterfaceStream sif::debug("DEBUG");
|
||||||
@ -30,10 +29,9 @@ ServiceInterfaceStream sif::warning("WARNING", true);
|
|||||||
ServiceInterfaceStream sif::error("ERROR", true, false, true);
|
ServiceInterfaceStream sif::error("ERROR", true, false, true);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
ObjectManagerIF *objectManager = nullptr;
|
ObjectManagerIF* objectManager = nullptr;
|
||||||
|
|
||||||
void initmission::initMission() {
|
void initmission::initMission() {
|
||||||
|
|
||||||
sif::info << "Building global objects.." << std::endl;
|
sif::info << "Building global objects.." << std::endl;
|
||||||
/* Instantiate global object manager and also create all objects */
|
/* Instantiate global object manager and also create all objects */
|
||||||
ObjectManager::instance()->setObjectFactoryFunction(ObjectFactory::produce, nullptr);
|
ObjectManager::instance()->setObjectFactoryFunction(ObjectFactory::produce, nullptr);
|
||||||
@ -47,38 +45,36 @@ void initmission::initMission() {
|
|||||||
void initmission::initTasks() {
|
void initmission::initTasks() {
|
||||||
TaskFactory* factory = TaskFactory::instance();
|
TaskFactory* factory = TaskFactory::instance();
|
||||||
ReturnValue_t result = HasReturnvaluesIF::RETURN_OK;
|
ReturnValue_t result = HasReturnvaluesIF::RETURN_OK;
|
||||||
if(factory == nullptr) {
|
if (factory == nullptr) {
|
||||||
/* Should never happen ! */
|
/* Should never happen ! */
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
#if OBSW_PRINT_MISSED_DEADLINES == 1
|
#if OBSW_PRINT_MISSED_DEADLINES == 1
|
||||||
void (*missedDeadlineFunc) (void) = TaskFactory::printMissedDeadline;
|
void (*missedDeadlineFunc)(void) = TaskFactory::printMissedDeadline;
|
||||||
#else
|
#else
|
||||||
void (*missedDeadlineFunc) (void) = nullptr;
|
void (*missedDeadlineFunc)(void) = nullptr;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if BOARD_TE0720 == 0
|
|
||||||
PeriodicTaskIF* coreController = factory->createPeriodicTask(
|
PeriodicTaskIF* coreController = factory->createPeriodicTask(
|
||||||
"CORE_CTRL", 60, PeriodicTaskIF::MINIMUM_STACK_SIZE, 0.4, missedDeadlineFunc);
|
"CORE_CTRL", 60, PeriodicTaskIF::MINIMUM_STACK_SIZE, 0.4, missedDeadlineFunc);
|
||||||
result = coreController->addComponent(objects::CORE_CONTROLLER);
|
result = coreController->addComponent(objects::CORE_CONTROLLER);
|
||||||
if(result != HasReturnvaluesIF::RETURN_OK) {
|
if (result != HasReturnvaluesIF::RETURN_OK) {
|
||||||
initmission::printAddObjectError("CORE_CTRL", objects::CORE_CONTROLLER);
|
initmission::printAddObjectError("CORE_CTRL", objects::CORE_CONTROLLER);
|
||||||
}
|
}
|
||||||
#endif
|
|
||||||
|
|
||||||
/* TMTC Distribution */
|
/* TMTC Distribution */
|
||||||
PeriodicTaskIF* tmTcDistributor = factory->createPeriodicTask(
|
PeriodicTaskIF* tmTcDistributor = factory->createPeriodicTask(
|
||||||
"DIST", 40, PeriodicTaskIF::MINIMUM_STACK_SIZE, 0.2, missedDeadlineFunc);
|
"DIST", 40, PeriodicTaskIF::MINIMUM_STACK_SIZE, 0.2, missedDeadlineFunc);
|
||||||
result = tmTcDistributor->addComponent(objects::CCSDS_PACKET_DISTRIBUTOR);
|
result = tmTcDistributor->addComponent(objects::CCSDS_PACKET_DISTRIBUTOR);
|
||||||
if(result != HasReturnvaluesIF::RETURN_OK) {
|
if (result != HasReturnvaluesIF::RETURN_OK) {
|
||||||
initmission::printAddObjectError("CCSDS_DISTRIB", objects::CCSDS_PACKET_DISTRIBUTOR);
|
initmission::printAddObjectError("CCSDS_DISTRIB", objects::CCSDS_PACKET_DISTRIBUTOR);
|
||||||
}
|
}
|
||||||
result = tmTcDistributor->addComponent(objects::PUS_PACKET_DISTRIBUTOR);
|
result = tmTcDistributor->addComponent(objects::PUS_PACKET_DISTRIBUTOR);
|
||||||
if(result != HasReturnvaluesIF::RETURN_OK) {
|
if (result != HasReturnvaluesIF::RETURN_OK) {
|
||||||
initmission::printAddObjectError("PUS_PACKET_DISTRIB", objects::PUS_PACKET_DISTRIBUTOR);
|
initmission::printAddObjectError("PUS_PACKET_DISTRIB", objects::PUS_PACKET_DISTRIBUTOR);
|
||||||
}
|
}
|
||||||
result = tmTcDistributor->addComponent(objects::TM_FUNNEL);
|
result = tmTcDistributor->addComponent(objects::TM_FUNNEL);
|
||||||
if(result != HasReturnvaluesIF::RETURN_OK) {
|
if (result != HasReturnvaluesIF::RETURN_OK) {
|
||||||
initmission::printAddObjectError("TM_FUNNEL", objects::TM_FUNNEL);
|
initmission::printAddObjectError("TM_FUNNEL", objects::TM_FUNNEL);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -87,13 +83,13 @@ void initmission::initTasks() {
|
|||||||
PeriodicTaskIF* tmtcBridgeTask = factory->createPeriodicTask(
|
PeriodicTaskIF* tmtcBridgeTask = factory->createPeriodicTask(
|
||||||
"TCPIP_TMTC_BRIDGE", 50, PeriodicTaskIF::MINIMUM_STACK_SIZE, 0.2, missedDeadlineFunc);
|
"TCPIP_TMTC_BRIDGE", 50, PeriodicTaskIF::MINIMUM_STACK_SIZE, 0.2, missedDeadlineFunc);
|
||||||
result = tmtcBridgeTask->addComponent(objects::TMTC_BRIDGE);
|
result = tmtcBridgeTask->addComponent(objects::TMTC_BRIDGE);
|
||||||
if(result != HasReturnvaluesIF::RETURN_OK) {
|
if (result != HasReturnvaluesIF::RETURN_OK) {
|
||||||
initmission::printAddObjectError("UDP_BRIDGE", objects::TMTC_BRIDGE);
|
initmission::printAddObjectError("TMTC_BRIDGE", objects::TMTC_BRIDGE);
|
||||||
}
|
}
|
||||||
PeriodicTaskIF* tmtcPollingTask = factory->createPeriodicTask(
|
PeriodicTaskIF* tmtcPollingTask = factory->createPeriodicTask(
|
||||||
"TMTC_POLLING", 80, PeriodicTaskIF::MINIMUM_STACK_SIZE, 2.0, missedDeadlineFunc);
|
"TMTC_POLLING", 80, PeriodicTaskIF::MINIMUM_STACK_SIZE, 2.0, missedDeadlineFunc);
|
||||||
result = tmtcPollingTask->addComponent(objects::TMTC_POLLING_TASK);
|
result = tmtcPollingTask->addComponent(objects::TMTC_POLLING_TASK);
|
||||||
if(result != HasReturnvaluesIF::RETURN_OK) {
|
if (result != HasReturnvaluesIF::RETURN_OK) {
|
||||||
initmission::printAddObjectError("UDP_POLLING", objects::TMTC_POLLING_TASK);
|
initmission::printAddObjectError("UDP_POLLING", objects::TMTC_POLLING_TASK);
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
@ -102,7 +98,7 @@ void initmission::initTasks() {
|
|||||||
PeriodicTaskIF* ccsdsHandlerTask = factory->createPeriodicTask(
|
PeriodicTaskIF* ccsdsHandlerTask = factory->createPeriodicTask(
|
||||||
"CCSDS_HANDLER", 50, PeriodicTaskIF::MINIMUM_STACK_SIZE, 2.0, missedDeadlineFunc);
|
"CCSDS_HANDLER", 50, PeriodicTaskIF::MINIMUM_STACK_SIZE, 2.0, missedDeadlineFunc);
|
||||||
result = ccsdsHandlerTask->addComponent(objects::CCSDS_HANDLER);
|
result = ccsdsHandlerTask->addComponent(objects::CCSDS_HANDLER);
|
||||||
if(result != HasReturnvaluesIF::RETURN_OK) {
|
if (result != HasReturnvaluesIF::RETURN_OK) {
|
||||||
initmission::printAddObjectError("CCSDS Handler", objects::CCSDS_HANDLER);
|
initmission::printAddObjectError("CCSDS Handler", objects::CCSDS_HANDLER);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -112,37 +108,68 @@ void initmission::initTasks() {
|
|||||||
PeriodicTaskIF* pdecHandlerTask = factory->createPeriodicTask(
|
PeriodicTaskIF* pdecHandlerTask = factory->createPeriodicTask(
|
||||||
"PDEC_HANDLER", 50, PeriodicTaskIF::MINIMUM_STACK_SIZE, 1.0, missedDeadlineFunc);
|
"PDEC_HANDLER", 50, PeriodicTaskIF::MINIMUM_STACK_SIZE, 1.0, missedDeadlineFunc);
|
||||||
result = pdecHandlerTask->addComponent(objects::PDEC_HANDLER);
|
result = pdecHandlerTask->addComponent(objects::PDEC_HANDLER);
|
||||||
if(result != HasReturnvaluesIF::RETURN_OK) {
|
if (result != HasReturnvaluesIF::RETURN_OK) {
|
||||||
initmission::printAddObjectError("PDEC Handler", objects::PDEC_HANDLER);
|
initmission::printAddObjectError("PDEC Handler", objects::PDEC_HANDLER);
|
||||||
}
|
}
|
||||||
#endif /* OBSW_USE_CCSDS_IP_CORE == 1 */
|
#endif /* OBSW_USE_CCSDS_IP_CORE == 1 */
|
||||||
|
|
||||||
# if BOARD_TE0720 == 0
|
#if OBSW_ADD_ACS_HANDLERS == 1
|
||||||
|
PeriodicTaskIF* acsTask = factory->createPeriodicTask(
|
||||||
|
"ACS_CTRL", 45, PeriodicTaskIF::MINIMUM_STACK_SIZE * 2, 0.4, missedDeadlineFunc);
|
||||||
|
result = acsTask->addComponent(objects::GPS_CONTROLLER);
|
||||||
|
if (result != HasReturnvaluesIF::RETURN_OK) {
|
||||||
|
initmission::printAddObjectError("GPS_CTRL", objects::GPS_CONTROLLER);
|
||||||
|
}
|
||||||
|
|
||||||
|
#endif /* OBSW_ADD_ACS_HANDLERS */
|
||||||
|
|
||||||
|
PeriodicTaskIF* sysTask = factory->createPeriodicTask(
|
||||||
|
"SYS_TASK", 40, PeriodicTaskIF::MINIMUM_STACK_SIZE * 2, 0.4, missedDeadlineFunc);
|
||||||
|
result = sysTask->addComponent(objects::ACS_BOARD_ASS);
|
||||||
|
if (result != HasReturnvaluesIF::RETURN_OK) {
|
||||||
|
initmission::printAddObjectError("ACS_ASS", objects::ACS_BOARD_ASS);
|
||||||
|
}
|
||||||
|
result = sysTask->addComponent(objects::SUS_BOARD_ASS);
|
||||||
|
if (result != HasReturnvaluesIF::RETURN_OK) {
|
||||||
|
initmission::printAddObjectError("SUS_ASS", objects::SUS_BOARD_ASS);
|
||||||
|
}
|
||||||
|
result = sysTask->addComponent(objects::TCS_BOARD_ASS);
|
||||||
|
if (result != HasReturnvaluesIF::RETURN_OK) {
|
||||||
|
initmission::printAddObjectError("TCS_BOARD_ASS", objects::TCS_BOARD_ASS);
|
||||||
|
}
|
||||||
|
|
||||||
// FS task, task interval does not matter because it runs in permanent loop, priority low
|
// FS task, task interval does not matter because it runs in permanent loop, priority low
|
||||||
// because it is a non-essential background task
|
// because it is a non-essential background task
|
||||||
PeriodicTaskIF* fsTask = factory->createPeriodicTask(
|
PeriodicTaskIF* fsTask = factory->createPeriodicTask(
|
||||||
"FILE_SYSTEM_TASK", 25, PeriodicTaskIF::MINIMUM_STACK_SIZE, 0.4, missedDeadlineFunc);
|
"FILE_SYSTEM_TASK", 25, PeriodicTaskIF::MINIMUM_STACK_SIZE, 0.4, missedDeadlineFunc);
|
||||||
result = fsTask->addComponent(objects::FILE_SYSTEM_HANDLER);
|
result = fsTask->addComponent(objects::FILE_SYSTEM_HANDLER);
|
||||||
if(result != HasReturnvaluesIF::RETURN_OK) {
|
if (result != HasReturnvaluesIF::RETURN_OK) {
|
||||||
initmission::printAddObjectError("FILE_SYSTEM_TASK", objects::FILE_SYSTEM_HANDLER);
|
initmission::printAddObjectError("FILE_SYSTEM_TASK", objects::FILE_SYSTEM_HANDLER);
|
||||||
}
|
}
|
||||||
|
|
||||||
#if OBSW_ADD_STAR_TRACKER == 1
|
#if OBSW_ADD_STAR_TRACKER == 1
|
||||||
PeriodicTaskIF* strImgLoaderTask = factory->createPeriodicTask(
|
PeriodicTaskIF* strHelperTask = factory->createPeriodicTask(
|
||||||
"FILE_SYSTEM_TASK", 20, PeriodicTaskIF::MINIMUM_STACK_SIZE, 0.2, missedDeadlineFunc);
|
"STR_HELPER", 20, PeriodicTaskIF::MINIMUM_STACK_SIZE, 0.2, missedDeadlineFunc);
|
||||||
result = strImgLoaderTask->addComponent(objects::STR_HELPER);
|
result = strHelperTask->addComponent(objects::STR_HELPER);
|
||||||
if(result != HasReturnvaluesIF::RETURN_OK) {
|
if (result != HasReturnvaluesIF::RETURN_OK) {
|
||||||
initmission::printAddObjectError("FILE_SYSTEM_TASK", objects::STR_HELPER);
|
initmission::printAddObjectError("STR_HELPER", objects::STR_HELPER);
|
||||||
}
|
}
|
||||||
#endif /* OBSW_ADD_STAR_TRACKER == 1 */
|
#endif /* OBSW_ADD_STAR_TRACKER == 1 */
|
||||||
|
|
||||||
#endif /* BOARD_TE0720 */
|
#if OBSW_ADD_PLOC_MPSOC == 1
|
||||||
|
PeriodicTaskIF* mpsocHelperTask = factory->createPeriodicTask(
|
||||||
|
"PLOC_MPSOC_HELPER", 20, PeriodicTaskIF::MINIMUM_STACK_SIZE, 0.2, missedDeadlineFunc);
|
||||||
|
result = mpsocHelperTask->addComponent(objects::PLOC_MPSOC_HELPER);
|
||||||
|
if (result != HasReturnvaluesIF::RETURN_OK) {
|
||||||
|
initmission::printAddObjectError("PLOC_MPSOC_HELPER", objects::PLOC_MPSOC_HELPER);
|
||||||
|
}
|
||||||
|
#endif /* OBSW_ADD_PLOC_MPSOC */
|
||||||
|
|
||||||
#if OBSW_TEST_CCSDS_BRIDGE == 1
|
#if OBSW_TEST_CCSDS_BRIDGE == 1
|
||||||
PeriodicTaskIF* ptmeTestTask = factory->createPeriodicTask(
|
PeriodicTaskIF* ptmeTestTask = factory->createPeriodicTask(
|
||||||
"PTME_TEST", 80, PeriodicTaskIF::MINIMUM_STACK_SIZE, 2.0, missedDeadlineFunc);
|
"PTME_TEST", 80, PeriodicTaskIF::MINIMUM_STACK_SIZE, 2.0, missedDeadlineFunc);
|
||||||
result = ptmeTestTask->addComponent(objects::CCSDS_IP_CORE_BRIDGE);
|
result = ptmeTestTask->addComponent(objects::CCSDS_IP_CORE_BRIDGE);
|
||||||
if(result != HasReturnvaluesIF::RETURN_OK) {
|
if (result != HasReturnvaluesIF::RETURN_OK) {
|
||||||
initmission::printAddObjectError("PTME_TEST", objects::CCSDS_IP_CORE_BRIDGE);
|
initmission::printAddObjectError("PTME_TEST", objects::CCSDS_IP_CORE_BRIDGE);
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
@ -158,11 +185,10 @@ void initmission::initTasks() {
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
auto taskStarter = [](std::vector<PeriodicTaskIF*>& taskVector, std::string name) {
|
auto taskStarter = [](std::vector<PeriodicTaskIF*>& taskVector, std::string name) {
|
||||||
for(const auto& task: taskVector) {
|
for (const auto& task : taskVector) {
|
||||||
if(task != nullptr) {
|
if (task != nullptr) {
|
||||||
task->startTask();
|
task->startTask();
|
||||||
}
|
} else {
|
||||||
else {
|
|
||||||
sif::error << "Task in vector " << name << " is invalid!" << std::endl;
|
sif::error << "Task in vector " << name << " is invalid!" << std::endl;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -181,9 +207,7 @@ void initmission::initTasks() {
|
|||||||
pdecHandlerTask->startTask();
|
pdecHandlerTask->startTask();
|
||||||
#endif /* OBSW_USE_CCSDS_IP_CORE == 1 */
|
#endif /* OBSW_USE_CCSDS_IP_CORE == 1 */
|
||||||
|
|
||||||
#if BOARD_TE0720 == 0
|
|
||||||
coreController->startTask();
|
coreController->startTask();
|
||||||
#endif
|
|
||||||
|
|
||||||
taskStarter(pstTasks, "PST task vector");
|
taskStarter(pstTasks, "PST task vector");
|
||||||
taskStarter(pusTasks, "PUS task vector");
|
taskStarter(pusTasks, "PUS task vector");
|
||||||
@ -195,32 +219,35 @@ void initmission::initTasks() {
|
|||||||
ptmeTestTask->startTask();
|
ptmeTestTask->startTask();
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if BOARD_TE0720 == 0
|
|
||||||
fsTask->startTask();
|
fsTask->startTask();
|
||||||
#if OBSW_ADD_STAR_TRACKER == 1
|
#if OBSW_ADD_STAR_TRACKER == 1
|
||||||
strImgLoaderTask->startTask();
|
strHelperTask->startTask();
|
||||||
#endif /* OBSW_ADD_STAR_TRACKER == 1 */
|
#endif /* OBSW_ADD_STAR_TRACKER == 1 */
|
||||||
|
|
||||||
|
#if OBSW_ADD_ACS_HANDLERS == 1
|
||||||
|
acsTask->startTask();
|
||||||
#endif
|
#endif
|
||||||
|
sysTask->startTask();
|
||||||
|
|
||||||
sif::info << "Tasks started.." << std::endl;
|
sif::info << "Tasks started.." << std::endl;
|
||||||
}
|
}
|
||||||
|
|
||||||
void initmission::createPstTasks(TaskFactory& factory,
|
void initmission::createPstTasks(TaskFactory& factory,
|
||||||
TaskDeadlineMissedFunction missedDeadlineFunc, std::vector<PeriodicTaskIF*> &taskVec) {
|
TaskDeadlineMissedFunction missedDeadlineFunc,
|
||||||
|
std::vector<PeriodicTaskIF*>& taskVec) {
|
||||||
ReturnValue_t result = HasReturnvaluesIF::RETURN_OK;
|
ReturnValue_t result = HasReturnvaluesIF::RETURN_OK;
|
||||||
#if BOARD_TE0720 == 0
|
|
||||||
/* Polling Sequence Table Default */
|
/* Polling Sequence Table Default */
|
||||||
#if OBSW_ADD_SPI_TEST_CODE == 0
|
#if OBSW_ADD_SPI_TEST_CODE == 0
|
||||||
FixedTimeslotTaskIF* spiPst = factory.createFixedTimeslotTask(
|
FixedTimeslotTaskIF* spiPst = factory.createFixedTimeslotTask(
|
||||||
"PST_TASK_DEFAULT", 70, PeriodicTaskIF::MINIMUM_STACK_SIZE * 4, 0.5,
|
"PST_TASK_DEFAULT", 70, PeriodicTaskIF::MINIMUM_STACK_SIZE * 4, 0.5, missedDeadlineFunc);
|
||||||
missedDeadlineFunc);
|
|
||||||
result = pst::pstSpi(spiPst);
|
result = pst::pstSpi(spiPst);
|
||||||
if (result != HasReturnvaluesIF::RETURN_OK) {
|
if (result != HasReturnvaluesIF::RETURN_OK) {
|
||||||
if(result != FixedTimeslotTaskIF::SLOT_LIST_EMPTY) {
|
if (result == FixedTimeslotTaskIF::SLOT_LIST_EMPTY) {
|
||||||
sif::error << "InitMission::initTasks: Creating PST failed!" << std::endl;
|
sif::warning << "InitMission::initTasks: SPI PST is empty" << std::endl;
|
||||||
|
} else {
|
||||||
|
sif::error << "InitMission::initTasks: Creating SPI PST failed!" << std::endl;
|
||||||
}
|
}
|
||||||
}
|
} else {
|
||||||
else {
|
|
||||||
taskVec.push_back(spiPst);
|
taskVec.push_back(spiPst);
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
@ -229,50 +256,62 @@ void initmission::createPstTasks(TaskFactory& factory,
|
|||||||
"UART_PST", 70, PeriodicTaskIF::MINIMUM_STACK_SIZE * 4, 0.2, missedDeadlineFunc);
|
"UART_PST", 70, PeriodicTaskIF::MINIMUM_STACK_SIZE * 4, 0.2, missedDeadlineFunc);
|
||||||
result = pst::pstUart(uartPst);
|
result = pst::pstUart(uartPst);
|
||||||
if (result != HasReturnvaluesIF::RETURN_OK) {
|
if (result != HasReturnvaluesIF::RETURN_OK) {
|
||||||
sif::error << "InitMission::initTasks: Creating PST failed!" << std::endl;
|
if (result == FixedTimeslotTaskIF::SLOT_LIST_EMPTY) {
|
||||||
|
sif::warning << "InitMission::initTasks: UART PST is empty" << std::endl;
|
||||||
|
} else {
|
||||||
|
sif::error << "InitMission::initTasks: Creating UART PST failed!" << std::endl;
|
||||||
}
|
}
|
||||||
|
} else {
|
||||||
taskVec.push_back(uartPst);
|
taskVec.push_back(uartPst);
|
||||||
|
}
|
||||||
|
|
||||||
FixedTimeslotTaskIF* gpioPst = factory.createFixedTimeslotTask(
|
FixedTimeslotTaskIF* gpioPst = factory.createFixedTimeslotTask(
|
||||||
"GPIO_PST", 70, PeriodicTaskIF::MINIMUM_STACK_SIZE * 4, 0.2, missedDeadlineFunc);
|
"GPIO_PST", 70, PeriodicTaskIF::MINIMUM_STACK_SIZE * 4, 0.2, missedDeadlineFunc);
|
||||||
result = pst::pstGpio(gpioPst);
|
result = pst::pstGpio(gpioPst);
|
||||||
if (result != HasReturnvaluesIF::RETURN_OK) {
|
if (result != HasReturnvaluesIF::RETURN_OK) {
|
||||||
sif::error << "InitMission::initTasks: Creating PST failed!" << std::endl;
|
if (result == FixedTimeslotTaskIF::SLOT_LIST_EMPTY) {
|
||||||
|
sif::warning << "InitMission::initTasks: GPIO PST is empty" << std::endl;
|
||||||
|
} else {
|
||||||
|
sif::error << "InitMission::initTasks: Creating GPIO PST failed!" << std::endl;
|
||||||
}
|
}
|
||||||
|
} else {
|
||||||
taskVec.push_back(gpioPst);
|
taskVec.push_back(gpioPst);
|
||||||
|
}
|
||||||
|
#if OBSW_ADD_I2C_TEST_CODE == 0
|
||||||
FixedTimeslotTaskIF* i2cPst = factory.createFixedTimeslotTask(
|
FixedTimeslotTaskIF* i2cPst = factory.createFixedTimeslotTask(
|
||||||
"I2C_PST", 70, PeriodicTaskIF::MINIMUM_STACK_SIZE * 4, 0.2, missedDeadlineFunc);
|
"I2C_PST", 70, PeriodicTaskIF::MINIMUM_STACK_SIZE * 4, 0.2, missedDeadlineFunc);
|
||||||
result = pst::pstI2c(i2cPst);
|
result = pst::pstI2c(i2cPst);
|
||||||
if (result != HasReturnvaluesIF::RETURN_OK) {
|
if (result != HasReturnvaluesIF::RETURN_OK) {
|
||||||
sif::error << "InitMission::initTasks: Creating PST failed!" << std::endl;
|
if (result == FixedTimeslotTaskIF::SLOT_LIST_EMPTY) {
|
||||||
|
sif::warning << "InitMission::initTasks: I2C PST is empty" << std::endl;
|
||||||
|
} else {
|
||||||
|
sif::error << "InitMission::initTasks: Creating I2C PST failed!" << std::endl;
|
||||||
}
|
}
|
||||||
|
} else {
|
||||||
|
taskVec.push_back(i2cPst);
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
FixedTimeslotTaskIF* gomSpacePstTask = factory.createFixedTimeslotTask(
|
FixedTimeslotTaskIF* gomSpacePstTask = factory.createFixedTimeslotTask(
|
||||||
"GS_PST_TASK", 70, PeriodicTaskIF::MINIMUM_STACK_SIZE * 4, 1.0, missedDeadlineFunc);
|
"GS_PST_TASK", 70, PeriodicTaskIF::MINIMUM_STACK_SIZE * 4, 1.0, missedDeadlineFunc);
|
||||||
result = pst::pstGompaceCan(gomSpacePstTask);
|
result = pst::pstGompaceCan(gomSpacePstTask);
|
||||||
if(result != HasReturnvaluesIF::RETURN_OK) {
|
if (result != HasReturnvaluesIF::RETURN_OK) {
|
||||||
|
if (result != FixedTimeslotTaskIF::SLOT_LIST_EMPTY) {
|
||||||
sif::error << "InitMission::initTasks: GomSpace PST initialization failed!" << std::endl;
|
sif::error << "InitMission::initTasks: GomSpace PST initialization failed!" << std::endl;
|
||||||
}
|
}
|
||||||
taskVec.push_back(gomSpacePstTask);
|
|
||||||
#else /* BOARD_TE7020 == 0 */
|
|
||||||
FixedTimeslotTaskIF * pollingSequenceTaskTE0720 = factory.createFixedTimeslotTask(
|
|
||||||
"PST_TASK_TE0720", 30, PeriodicTaskIF::MINIMUM_STACK_SIZE * 8, 3.0,
|
|
||||||
missedDeadlineFunc);
|
|
||||||
result = pst::pollingSequenceTE0720(pollingSequenceTaskTE0720);
|
|
||||||
if (result != HasReturnvaluesIF::RETURN_OK) {
|
|
||||||
sif::error << "InitMission::initTasks: Creating TE0720 PST failed!" << std::endl;
|
|
||||||
}
|
}
|
||||||
taskVec.push_back(pollingSequenceTaskTE0720);
|
taskVec.push_back(gomSpacePstTask);
|
||||||
#endif /* BOARD_TE7020 == 1 */
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void initmission::createPusTasks(TaskFactory &factory,
|
void initmission::createPusTasks(TaskFactory& factory,
|
||||||
TaskDeadlineMissedFunction missedDeadlineFunc, std::vector<PeriodicTaskIF*> &taskVec) {
|
TaskDeadlineMissedFunction missedDeadlineFunc,
|
||||||
|
std::vector<PeriodicTaskIF*>& taskVec) {
|
||||||
ReturnValue_t result = HasReturnvaluesIF::RETURN_OK;
|
ReturnValue_t result = HasReturnvaluesIF::RETURN_OK;
|
||||||
/* PUS Services */
|
/* PUS Services */
|
||||||
PeriodicTaskIF* pusVerification = factory.createPeriodicTask(
|
PeriodicTaskIF* pusVerification = factory.createPeriodicTask(
|
||||||
"PUS_VERIF", 40, PeriodicTaskIF::MINIMUM_STACK_SIZE, 0.200, missedDeadlineFunc);
|
"PUS_VERIF", 40, PeriodicTaskIF::MINIMUM_STACK_SIZE, 0.200, missedDeadlineFunc);
|
||||||
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) {
|
||||||
initmission::printAddObjectError("PUS_VERIF", objects::PUS_SERVICE_1_VERIFICATION);
|
initmission::printAddObjectError("PUS_VERIF", objects::PUS_SERVICE_1_VERIFICATION);
|
||||||
}
|
}
|
||||||
taskVec.push_back(pusVerification);
|
taskVec.push_back(pusVerification);
|
||||||
@ -280,11 +319,11 @@ void initmission::createPusTasks(TaskFactory &factory,
|
|||||||
PeriodicTaskIF* pusEvents = factory.createPeriodicTask(
|
PeriodicTaskIF* pusEvents = factory.createPeriodicTask(
|
||||||
"PUS_EVENTS", 60, PeriodicTaskIF::MINIMUM_STACK_SIZE, 0.200, missedDeadlineFunc);
|
"PUS_EVENTS", 60, PeriodicTaskIF::MINIMUM_STACK_SIZE, 0.200, missedDeadlineFunc);
|
||||||
result = pusEvents->addComponent(objects::PUS_SERVICE_5_EVENT_REPORTING);
|
result = pusEvents->addComponent(objects::PUS_SERVICE_5_EVENT_REPORTING);
|
||||||
if(result != HasReturnvaluesIF::RETURN_OK) {
|
if (result != HasReturnvaluesIF::RETURN_OK) {
|
||||||
initmission::printAddObjectError("PUS_EVENTS", objects::PUS_SERVICE_5_EVENT_REPORTING);
|
initmission::printAddObjectError("PUS_EVENTS", objects::PUS_SERVICE_5_EVENT_REPORTING);
|
||||||
}
|
}
|
||||||
result = pusEvents->addComponent(objects::EVENT_MANAGER);
|
result = pusEvents->addComponent(objects::EVENT_MANAGER);
|
||||||
if(result != HasReturnvaluesIF::RETURN_OK) {
|
if (result != HasReturnvaluesIF::RETURN_OK) {
|
||||||
initmission::printAddObjectError("PUS_MGMT", objects::EVENT_MANAGER);
|
initmission::printAddObjectError("PUS_MGMT", objects::EVENT_MANAGER);
|
||||||
}
|
}
|
||||||
taskVec.push_back(pusEvents);
|
taskVec.push_back(pusEvents);
|
||||||
@ -292,11 +331,11 @@ void initmission::createPusTasks(TaskFactory &factory,
|
|||||||
PeriodicTaskIF* pusHighPrio = factory.createPeriodicTask(
|
PeriodicTaskIF* pusHighPrio = factory.createPeriodicTask(
|
||||||
"PUS_HIGH_PRIO", 50, PeriodicTaskIF::MINIMUM_STACK_SIZE, 0.200, missedDeadlineFunc);
|
"PUS_HIGH_PRIO", 50, PeriodicTaskIF::MINIMUM_STACK_SIZE, 0.200, missedDeadlineFunc);
|
||||||
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) {
|
||||||
initmission::printAddObjectError("PUS_2", objects::PUS_SERVICE_2_DEVICE_ACCESS);
|
initmission::printAddObjectError("PUS_2", objects::PUS_SERVICE_2_DEVICE_ACCESS);
|
||||||
}
|
}
|
||||||
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) {
|
||||||
initmission::printAddObjectError("PUS_9", objects::PUS_SERVICE_9_TIME_MGMT);
|
initmission::printAddObjectError("PUS_9", objects::PUS_SERVICE_9_TIME_MGMT);
|
||||||
}
|
}
|
||||||
taskVec.push_back(pusHighPrio);
|
taskVec.push_back(pusHighPrio);
|
||||||
@ -304,19 +343,19 @@ void initmission::createPusTasks(TaskFactory &factory,
|
|||||||
PeriodicTaskIF* pusMedPrio = factory.createPeriodicTask(
|
PeriodicTaskIF* pusMedPrio = factory.createPeriodicTask(
|
||||||
"PUS_MED_PRIO", 40, PeriodicTaskIF::MINIMUM_STACK_SIZE, 0.8, missedDeadlineFunc);
|
"PUS_MED_PRIO", 40, PeriodicTaskIF::MINIMUM_STACK_SIZE, 0.8, missedDeadlineFunc);
|
||||||
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) {
|
||||||
initmission::printAddObjectError("PUS_8", objects::PUS_SERVICE_8_FUNCTION_MGMT);
|
initmission::printAddObjectError("PUS_8", objects::PUS_SERVICE_8_FUNCTION_MGMT);
|
||||||
}
|
}
|
||||||
result = pusMedPrio->addComponent(objects::PUS_SERVICE_3_HOUSEKEEPING);
|
result = pusMedPrio->addComponent(objects::PUS_SERVICE_3_HOUSEKEEPING);
|
||||||
if(result!=HasReturnvaluesIF::RETURN_OK){
|
if (result != HasReturnvaluesIF::RETURN_OK) {
|
||||||
sif::error << "Object add component failed" << std::endl;
|
sif::error << "Object add component failed" << std::endl;
|
||||||
}
|
}
|
||||||
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) {
|
||||||
initmission::printAddObjectError("PUS_200", objects::PUS_SERVICE_200_MODE_MGMT);
|
initmission::printAddObjectError("PUS_200", objects::PUS_SERVICE_200_MODE_MGMT);
|
||||||
}
|
}
|
||||||
result = pusMedPrio->addComponent(objects::PUS_SERVICE_20_PARAMETERS);
|
result = pusMedPrio->addComponent(objects::PUS_SERVICE_20_PARAMETERS);
|
||||||
if(result != HasReturnvaluesIF::RETURN_OK) {
|
if (result != HasReturnvaluesIF::RETURN_OK) {
|
||||||
initmission::printAddObjectError("PUS_20", objects::PUS_SERVICE_20_PARAMETERS);
|
initmission::printAddObjectError("PUS_20", objects::PUS_SERVICE_20_PARAMETERS);
|
||||||
}
|
}
|
||||||
taskVec.push_back(pusMedPrio);
|
taskVec.push_back(pusMedPrio);
|
||||||
@ -324,41 +363,73 @@ void initmission::createPusTasks(TaskFactory &factory,
|
|||||||
PeriodicTaskIF* pusLowPrio = factory.createPeriodicTask(
|
PeriodicTaskIF* pusLowPrio = factory.createPeriodicTask(
|
||||||
"PUS_LOW_PRIO", 30, PeriodicTaskIF::MINIMUM_STACK_SIZE, 1.6, missedDeadlineFunc);
|
"PUS_LOW_PRIO", 30, PeriodicTaskIF::MINIMUM_STACK_SIZE, 1.6, missedDeadlineFunc);
|
||||||
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) {
|
||||||
initmission::printAddObjectError("PUS_17", objects::PUS_SERVICE_17_TEST);
|
initmission::printAddObjectError("PUS_17", objects::PUS_SERVICE_17_TEST);
|
||||||
}
|
}
|
||||||
result = pusLowPrio->addComponent(objects::INTERNAL_ERROR_REPORTER);
|
result = pusLowPrio->addComponent(objects::INTERNAL_ERROR_REPORTER);
|
||||||
if(result != HasReturnvaluesIF::RETURN_OK) {
|
if (result != HasReturnvaluesIF::RETURN_OK) {
|
||||||
initmission::printAddObjectError("ERROR_REPORTER", objects::INTERNAL_ERROR_REPORTER);
|
initmission::printAddObjectError("ERROR_REPORTER", objects::INTERNAL_ERROR_REPORTER);
|
||||||
}
|
}
|
||||||
taskVec.push_back(pusLowPrio);
|
taskVec.push_back(pusLowPrio);
|
||||||
}
|
}
|
||||||
|
|
||||||
void initmission::createTestTasks(TaskFactory& factory, TaskDeadlineMissedFunction missedDeadlineFunc,
|
void initmission::createTestTasks(TaskFactory& factory,
|
||||||
|
TaskDeadlineMissedFunction missedDeadlineFunc,
|
||||||
std::vector<PeriodicTaskIF*>& taskVec) {
|
std::vector<PeriodicTaskIF*>& taskVec) {
|
||||||
#if OBSW_ADD_TEST_TASK == 1 || OBSW_ADD_SPI_TEST_CODE == 1 || (BOARD_TE0720 == 1 && OBSW_TEST_LIBGPIOD == 1)
|
#if OBSW_ADD_TEST_TASK == 1 && OBSW_ADD_TEST_CODE == 1
|
||||||
ReturnValue_t result = HasReturnvaluesIF::RETURN_OK;
|
ReturnValue_t result = HasReturnvaluesIF::RETURN_OK;
|
||||||
#endif
|
static_cast<void>(result); // supress warning in case it is not used
|
||||||
|
|
||||||
PeriodicTaskIF* testTask = factory.createPeriodicTask(
|
PeriodicTaskIF* testTask = factory.createPeriodicTask(
|
||||||
"TEST_TASK", 60, PeriodicTaskIF::MINIMUM_STACK_SIZE, 1, missedDeadlineFunc);
|
"TEST_TASK", 60, PeriodicTaskIF::MINIMUM_STACK_SIZE, 1, missedDeadlineFunc);
|
||||||
#if OBSW_ADD_TEST_TASK == 1
|
|
||||||
result = testTask->addComponent(objects::TEST_TASK);
|
result = testTask->addComponent(objects::TEST_TASK);
|
||||||
if(result != HasReturnvaluesIF::RETURN_OK) {
|
if (result != HasReturnvaluesIF::RETURN_OK) {
|
||||||
initmission::printAddObjectError("TEST_TASK", objects::TEST_TASK);
|
initmission::printAddObjectError("TEST_TASK", objects::TEST_TASK);
|
||||||
}
|
}
|
||||||
#endif /* OBSW_ADD_TEST_TASK == 1 */
|
|
||||||
|
|
||||||
#if OBSW_ADD_SPI_TEST_CODE == 1
|
#if OBSW_ADD_SPI_TEST_CODE == 1
|
||||||
result = testTask->addComponent(objects::SPI_TEST);
|
result = testTask->addComponent(objects::SPI_TEST);
|
||||||
if(result != HasReturnvaluesIF::RETURN_OK) {
|
if (result != HasReturnvaluesIF::RETURN_OK) {
|
||||||
initmission::printAddObjectError("SPI_TEST", objects::SPI_TEST);
|
initmission::printAddObjectError("SPI_TEST", objects::SPI_TEST);
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
#if BOARD_TE0720 == 1 && OBSW_TEST_LIBGPIOD == 1
|
#if OBSW_ADD_I2C_TEST_CODE == 1
|
||||||
result = testTask->addComponent(objects::LIBGPIOD_TEST);
|
result = testTask->addComponent(objects::I2C_TEST);
|
||||||
if(result != HasReturnvaluesIF::RETURN_OK) {
|
if (result != HasReturnvaluesIF::RETURN_OK) {
|
||||||
initmission::printAddObjectError("GPIOD_TEST", objects::LIBGPIOD_TEST);
|
initmission::printAddObjectError("I2C_TEST", objects::I2C_TEST);
|
||||||
}
|
}
|
||||||
#endif /* BOARD_TE0720 == 1 && OBSW_TEST_LIBGPIOD == 1 */
|
#endif
|
||||||
|
#if OBSW_ADD_UART_TEST_CODE == 1
|
||||||
|
result = testTask->addComponent(objects::UART_TEST);
|
||||||
|
if (result != HasReturnvaluesIF::RETURN_OK) {
|
||||||
|
initmission::printAddObjectError("UART_TEST", objects::UART_TEST);
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
taskVec.push_back(testTask);
|
taskVec.push_back(testTask);
|
||||||
|
|
||||||
|
#endif // OBSW_ADD_TEST_TASK == 1 && OBSW_ADD_TEST_CODE == 1
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
▄ ▄
|
||||||
|
▌▒█ ▄▀▒▌
|
||||||
|
▌▒▒█ ▄▀▒▒▒▐
|
||||||
|
▐▄▀▒▒▀▀▀▀▄▄▄▀▒▒▒▒▒▐
|
||||||
|
▄▄▀▒░▒▒▒▒▒▒▒▒▒█▒▒▄█▒▐
|
||||||
|
▄▀▒▒▒░░░▒▒▒░░░▒▒▒▀██▀▒▌
|
||||||
|
▐▒▒▒▄▄▒▒▒▒░░░▒▒▒▒▒▒▒▀▄▒▒▌
|
||||||
|
▌░░▌█▀▒▒▒▒▒▄▀█▄▒▒▒▒▒▒▒█▒▐
|
||||||
|
▐░░░▒▒▒▒▒▒▒▒▌██▀▒▒░░░▒▒▒▀▄▌
|
||||||
|
▌░▒▄██▄▒▒▒▒▒▒▒▒▒░░░░░░▒▒▒▒▌
|
||||||
|
▌▒▀▐▄█▄█▌▄░▀▒▒░░░░░░░░░░▒▒▒▐
|
||||||
|
▐▒▒▐▀▐▀▒░▄▄▒▄▒▒▒▒▒▒░▒░▒░▒▒▒▒▌
|
||||||
|
▐▒▒▒▀▀▄▄▒▒▒▄▒▒▒▒▒▒▒▒░▒░▒░▒▒▐
|
||||||
|
▌▒▒▒▒▒▒▀▀▀▒▒▒▒▒▒░▒░▒░▒░▒▒▒▌
|
||||||
|
▐▒▒▒▒▒▒▒▒▒▒▒▒▒▒░▒░▒░▒▒▄▒▒▐
|
||||||
|
▀▄▒▒▒▒▒▒▒▒▒▒▒░▒░▒░▒▄▒▒▒▒▌
|
||||||
|
▀▄▒▒▒▒▒▒▒▒▒▒▄▄▄▀▒▒▒▒▄▀
|
||||||
|
▀▄▄▄▄▄▄▀▀▀▒▒▒▒▒▄▄▀
|
||||||
|
▒▒▒▒▒▒▒▒▒▒▀▀
|
||||||
|
**/
|
||||||
|
@ -1,9 +1,10 @@
|
|||||||
#ifndef BSP_Q7S_INITMISSION_H_
|
#ifndef BSP_Q7S_INITMISSION_H_
|
||||||
#define BSP_Q7S_INITMISSION_H_
|
#define BSP_Q7S_INITMISSION_H_
|
||||||
|
|
||||||
#include "fsfw/tasks/Typedef.h"
|
|
||||||
#include <vector>
|
#include <vector>
|
||||||
|
|
||||||
|
#include "fsfw/tasks/Typedef.h"
|
||||||
|
|
||||||
class PeriodicTaskIF;
|
class PeriodicTaskIF;
|
||||||
class TaskFactory;
|
class TaskFactory;
|
||||||
|
|
||||||
@ -17,6 +18,6 @@ void createPusTasks(TaskFactory& factory, TaskDeadlineMissedFunction missedDeadl
|
|||||||
std::vector<PeriodicTaskIF*>& taskVec);
|
std::vector<PeriodicTaskIF*>& taskVec);
|
||||||
void createTestTasks(TaskFactory& factory, TaskDeadlineMissedFunction missedDeadlineFunc,
|
void createTestTasks(TaskFactory& factory, TaskDeadlineMissedFunction missedDeadlineFunc,
|
||||||
std::vector<PeriodicTaskIF*>& taskVec);
|
std::vector<PeriodicTaskIF*>& taskVec);
|
||||||
};
|
}; // namespace initmission
|
||||||
|
|
||||||
#endif /* BSP_Q7S_INITMISSION_H_ */
|
#endif /* BSP_Q7S_INITMISSION_H_ */
|
||||||
|
File diff suppressed because it is too large
Load Diff
@ -4,6 +4,8 @@
|
|||||||
class LinuxLibgpioIF;
|
class LinuxLibgpioIF;
|
||||||
class UartComIF;
|
class UartComIF;
|
||||||
class SpiComIF;
|
class SpiComIF;
|
||||||
|
class I2cComIF;
|
||||||
|
class PowerSwitchIF;
|
||||||
|
|
||||||
namespace ObjectFactory {
|
namespace ObjectFactory {
|
||||||
|
|
||||||
@ -11,20 +13,24 @@ void setStatics();
|
|||||||
void produce(void* args);
|
void produce(void* args);
|
||||||
|
|
||||||
void createCommunicationInterfaces(LinuxLibgpioIF** gpioComIF, UartComIF** uartComIF,
|
void createCommunicationInterfaces(LinuxLibgpioIF** gpioComIF, UartComIF** uartComIF,
|
||||||
SpiComIF** spiComIF);
|
SpiComIF** spiComIF, I2cComIF** i2cComIF);
|
||||||
|
void createPcduComponents(LinuxLibgpioIF* gpioComIF, PowerSwitchIF** pwrSwitcher);
|
||||||
|
void createPlPcduComponents(LinuxLibgpioIF* gpioComIF, SpiComIF* spiComIF);
|
||||||
void createTmpComponents();
|
void createTmpComponents();
|
||||||
void createPcduComponents();
|
|
||||||
void createRadSensorComponent(LinuxLibgpioIF* gpioComIF);
|
void createRadSensorComponent(LinuxLibgpioIF* gpioComIF);
|
||||||
void createSunSensorComponents(LinuxLibgpioIF* gpioComIF, SpiComIF* spiComIF);
|
void createSunSensorComponents(LinuxLibgpioIF* gpioComIF, SpiComIF* spiComIF,
|
||||||
void createAcsBoardComponents(LinuxLibgpioIF* gpioComIF, UartComIF* uartComIF);
|
PowerSwitchIF* pwrSwitcher);
|
||||||
|
void createAcsBoardComponents(LinuxLibgpioIF* gpioComIF, UartComIF* uartComIF,
|
||||||
|
PowerSwitchIF* pwrSwitcher);
|
||||||
void createHeaterComponents();
|
void createHeaterComponents();
|
||||||
void createSolarArrayDeploymentComponents();
|
void createSolarArrayDeploymentComponents();
|
||||||
void createSyrlinksComponents();
|
void createSyrlinksComponents();
|
||||||
void createRtdComponents(LinuxLibgpioIF* gpioComIF);
|
void createRtdComponents(LinuxLibgpioIF* gpioComIF, PowerSwitchIF* pwrSwitcher);
|
||||||
|
void createPayloadComponents(LinuxLibgpioIF* gpioComIF);
|
||||||
void createReactionWheelComponents(LinuxLibgpioIF* gpioComIF);
|
void createReactionWheelComponents(LinuxLibgpioIF* gpioComIF);
|
||||||
void createCcsdsComponents(LinuxLibgpioIF *gpioComIF);
|
void createCcsdsComponents(LinuxLibgpioIF* gpioComIF);
|
||||||
void createTestComponents(LinuxLibgpioIF* gpioComIF);
|
void createTestComponents(LinuxLibgpioIF* gpioComIF);
|
||||||
|
|
||||||
};
|
}; // namespace ObjectFactory
|
||||||
|
|
||||||
#endif /* BSP_Q7S_OBJECTFACTORY_H_ */
|
#endif /* BSP_Q7S_OBJECTFACTORY_H_ */
|
||||||
|
@ -1,8 +1,5 @@
|
|||||||
#include "ParameterHandler.h"
|
#include "ParameterHandler.h"
|
||||||
|
|
||||||
ParameterHandler::ParameterHandler(std::string mountPrefix): mountPrefix(mountPrefix) {
|
ParameterHandler::ParameterHandler(std::string mountPrefix) : mountPrefix(mountPrefix) {}
|
||||||
}
|
|
||||||
|
|
||||||
void ParameterHandler::setMountPrefix(std::string prefix) {
|
void ParameterHandler::setMountPrefix(std::string prefix) { mountPrefix = prefix; }
|
||||||
mountPrefix = prefix;
|
|
||||||
}
|
|
||||||
|
@ -4,19 +4,17 @@
|
|||||||
#include <nlohmann/json.hpp>
|
#include <nlohmann/json.hpp>
|
||||||
#include <string>
|
#include <string>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
class ParameterHandler {
|
class ParameterHandler {
|
||||||
public:
|
public:
|
||||||
ParameterHandler(std::string mountPrefix);
|
ParameterHandler(std::string mountPrefix);
|
||||||
|
|
||||||
void setMountPrefix(std::string prefix);
|
void setMountPrefix(std::string prefix);
|
||||||
|
|
||||||
void setUpDummyParameter();
|
void setUpDummyParameter();
|
||||||
private:
|
|
||||||
|
private:
|
||||||
std::string mountPrefix;
|
std::string mountPrefix;
|
||||||
DummyParameter dummyParam;
|
DummyParameter dummyParam;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
#endif /* BSP_Q7S_CORE_PARAMETERHANDLER_H_ */
|
#endif /* BSP_Q7S_CORE_PARAMETERHANDLER_H_ */
|
||||||
|
@ -1,41 +1,43 @@
|
|||||||
#include "obsw.h"
|
#include "obsw.h"
|
||||||
#include "OBSWVersion.h"
|
|
||||||
#include "OBSWConfig.h"
|
|
||||||
#include "InitMission.h"
|
|
||||||
#include "watchdogConf.h"
|
|
||||||
|
|
||||||
#include "fsfw/tasks/TaskFactory.h"
|
|
||||||
#include "fsfw/FSFWVersion.h"
|
|
||||||
|
|
||||||
#include <iostream>
|
|
||||||
#include <filesystem>
|
#include <filesystem>
|
||||||
|
#include <iostream>
|
||||||
|
|
||||||
|
#include "InitMission.h"
|
||||||
|
#include "OBSWConfig.h"
|
||||||
|
#include "OBSWVersion.h"
|
||||||
|
#include "fsfw/tasks/TaskFactory.h"
|
||||||
|
#include "fsfw/version.h"
|
||||||
|
#include "watchdogConf.h"
|
||||||
|
|
||||||
static int OBSW_ALREADY_RUNNING = -2;
|
static int OBSW_ALREADY_RUNNING = -2;
|
||||||
|
|
||||||
int obsw::obsw() {
|
int obsw::obsw() {
|
||||||
|
using namespace fsfw;
|
||||||
std::cout << "-- EIVE OBSW --" << std::endl;
|
std::cout << "-- EIVE OBSW --" << std::endl;
|
||||||
#if BOARD_TE0720 == 0
|
#ifdef TE0720_1CFA
|
||||||
std::cout << "-- Compiled for Linux (Xiphos Q7S) --" << std::endl;
|
std::cout << "-- Compiled for Linux (Xiphos Q7S) --" << std::endl;
|
||||||
#else
|
#else
|
||||||
std::cout << "-- Compiled for Linux (TE0720) --" << std::endl;
|
std::cout << "-- Compiled for Linux (TE0720) --" << std::endl;
|
||||||
#endif
|
#endif
|
||||||
std::cout << "-- OBSW v" << SW_VERSION << "." << SW_SUBVERSION <<
|
std::cout << "-- OBSW v" << SW_VERSION << "." << SW_SUBVERSION << "." << SW_REVISION << ", FSFW v"
|
||||||
"." << SW_REVISION << ", FSFW v" << FSFW_VERSION << "." << FSFW_SUBVERSION << "." <<
|
<< FSFW_VERSION << "--" << std::endl;
|
||||||
FSFW_REVISION << "--" << std::endl;
|
|
||||||
std::cout << "-- " << __DATE__ << " " << __TIME__ << " --" << std::endl;
|
std::cout << "-- " << __DATE__ << " " << __TIME__ << " --" << std::endl;
|
||||||
|
|
||||||
#if Q7S_CHECK_FOR_ALREADY_RUNNING_IMG == 1
|
#if Q7S_CHECK_FOR_ALREADY_RUNNING_IMG == 1
|
||||||
// Check special file here. This file is created or deleted by the eive-watchdog application
|
// Check special file here. This file is created or deleted by the eive-watchdog application
|
||||||
// or systemd service!
|
// or systemd service!
|
||||||
if(std::filesystem::exists(watchdog::RUNNING_FILE_NAME)) {
|
if (std::filesystem::exists(watchdog::RUNNING_FILE_NAME)) {
|
||||||
sif::warning << "File " << watchdog::RUNNING_FILE_NAME << " exists so the software might "
|
sif::warning << "File " << watchdog::RUNNING_FILE_NAME
|
||||||
"already be running. Aborting.." << std::endl;
|
<< " exists so the software might "
|
||||||
|
"already be running. Check if obsw systemd service has been stopped."
|
||||||
|
<< std::endl;
|
||||||
return OBSW_ALREADY_RUNNING;
|
return OBSW_ALREADY_RUNNING;
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
initmission::initMission();
|
initmission::initMission();
|
||||||
|
|
||||||
for(;;) {
|
for (;;) {
|
||||||
/* Suspend main thread by sleeping it. */
|
/* Suspend main thread by sleeping it. */
|
||||||
TaskFactory::delayTask(5000);
|
TaskFactory::delayTask(5000);
|
||||||
}
|
}
|
||||||
|
@ -1,7 +0,0 @@
|
|||||||
target_sources(${TARGET_NAME} PRIVATE
|
|
||||||
PlocSupervisorHandler.cpp
|
|
||||||
PlocUpdater.cpp
|
|
||||||
PlocMemoryDumper.cpp
|
|
||||||
)
|
|
||||||
|
|
||||||
add_subdirectory(startracker)
|
|
@ -1,206 +0,0 @@
|
|||||||
#include <fsfw/src/fsfw/serialize/SerializeAdapter.h>
|
|
||||||
#include "fsfw/ipc/QueueFactory.h"
|
|
||||||
#include "PlocMemoryDumper.h"
|
|
||||||
|
|
||||||
#include <fstream>
|
|
||||||
#include <filesystem>
|
|
||||||
#include <string>
|
|
||||||
|
|
||||||
PlocMemoryDumper::PlocMemoryDumper(object_id_t objectId) :
|
|
||||||
SystemObject(objectId), commandActionHelper(this), actionHelper(this, nullptr) {
|
|
||||||
commandQueue = QueueFactory::instance()->createMessageQueue(QUEUE_SIZE);
|
|
||||||
}
|
|
||||||
|
|
||||||
PlocMemoryDumper::~PlocMemoryDumper() {
|
|
||||||
}
|
|
||||||
|
|
||||||
ReturnValue_t PlocMemoryDumper::initialize() {
|
|
||||||
|
|
||||||
ReturnValue_t result = SystemObject::initialize();
|
|
||||||
if (result != HasReturnvaluesIF::RETURN_OK) {
|
|
||||||
return result;
|
|
||||||
}
|
|
||||||
result = commandActionHelper.initialize();
|
|
||||||
if (result != HasReturnvaluesIF::RETURN_OK) {
|
|
||||||
return result;
|
|
||||||
}
|
|
||||||
result = actionHelper.initialize(commandQueue);
|
|
||||||
if (result != HasReturnvaluesIF::RETURN_OK) {
|
|
||||||
return result;
|
|
||||||
}
|
|
||||||
|
|
||||||
return HasReturnvaluesIF::RETURN_OK;
|
|
||||||
}
|
|
||||||
|
|
||||||
ReturnValue_t PlocMemoryDumper::performOperation(uint8_t operationCode) {
|
|
||||||
readCommandQueue();
|
|
||||||
doStateMachine();
|
|
||||||
return HasReturnvaluesIF::RETURN_OK;
|
|
||||||
}
|
|
||||||
|
|
||||||
ReturnValue_t PlocMemoryDumper::executeAction(ActionId_t actionId,
|
|
||||||
MessageQueueId_t commandedBy, const uint8_t* data, size_t size) {
|
|
||||||
|
|
||||||
if (state != State::IDLE) {
|
|
||||||
return IS_BUSY;
|
|
||||||
}
|
|
||||||
|
|
||||||
switch (actionId) {
|
|
||||||
case DUMP_MRAM: {
|
|
||||||
size_t deserializeSize = sizeof(mram.startAddress) + sizeof(mram.endAddress);
|
|
||||||
SerializeAdapter::deSerialize(&mram.startAddress, &data, &deserializeSize,
|
|
||||||
SerializeIF::Endianness::BIG);
|
|
||||||
SerializeAdapter::deSerialize(&mram.endAddress, &data, &deserializeSize,
|
|
||||||
SerializeIF::Endianness::BIG);
|
|
||||||
if (mram.endAddress > MAX_MRAM_ADDRESS) {
|
|
||||||
return MRAM_ADDRESS_TOO_HIGH;
|
|
||||||
}
|
|
||||||
if (mram.endAddress <= mram.startAddress) {
|
|
||||||
return MRAM_INVALID_ADDRESS_COMBINATION;
|
|
||||||
}
|
|
||||||
state = State::COMMAND_FIRST_MRAM_DUMP;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
default: {
|
|
||||||
sif::warning << "PlocMemoryDumper::executeAction: Received command with invalid action id"
|
|
||||||
<< std::endl;
|
|
||||||
return INVALID_ACTION_ID;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return EXECUTION_FINISHED;
|
|
||||||
}
|
|
||||||
|
|
||||||
MessageQueueId_t PlocMemoryDumper::getCommandQueue() const {
|
|
||||||
return commandQueue->getId();
|
|
||||||
}
|
|
||||||
|
|
||||||
MessageQueueIF* PlocMemoryDumper::getCommandQueuePtr() {
|
|
||||||
return commandQueue;
|
|
||||||
}
|
|
||||||
|
|
||||||
void PlocMemoryDumper::readCommandQueue() {
|
|
||||||
CommandMessage message;
|
|
||||||
ReturnValue_t result;
|
|
||||||
|
|
||||||
for (result = commandQueue->receiveMessage(&message); result == HasReturnvaluesIF::RETURN_OK;
|
|
||||||
result = commandQueue->receiveMessage(&message)) {
|
|
||||||
if (result != RETURN_OK) {
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
result = actionHelper.handleActionMessage(&message);
|
|
||||||
if (result == HasReturnvaluesIF::RETURN_OK) {
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
|
|
||||||
result = commandActionHelper.handleReply(&message);
|
|
||||||
if (result == HasReturnvaluesIF::RETURN_OK) {
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
|
|
||||||
sif::debug << "PlocMemoryDumper::readCommandQueue: Received message with invalid format"
|
|
||||||
<< std::endl;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
void PlocMemoryDumper::doStateMachine() {
|
|
||||||
switch (state) {
|
|
||||||
case State::IDLE:
|
|
||||||
break;
|
|
||||||
case State::COMMAND_FIRST_MRAM_DUMP:
|
|
||||||
commandNextMramDump(PLOC_SPV::FIRST_MRAM_DUMP);
|
|
||||||
break;
|
|
||||||
case State::COMMAND_CONSECUTIVE_MRAM_DUMP:
|
|
||||||
commandNextMramDump(PLOC_SPV::CONSECUTIVE_MRAM_DUMP);
|
|
||||||
break;
|
|
||||||
case State::EXECUTING_MRAM_DUMP:
|
|
||||||
break;
|
|
||||||
default:
|
|
||||||
sif::debug << "PlocMemoryDumper::doStateMachine: Invalid state" << std::endl;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
void PlocMemoryDumper::stepSuccessfulReceived(ActionId_t actionId,
|
|
||||||
uint8_t step) {
|
|
||||||
}
|
|
||||||
|
|
||||||
void PlocMemoryDumper::stepFailedReceived(ActionId_t actionId, uint8_t step,
|
|
||||||
ReturnValue_t returnCode) {
|
|
||||||
}
|
|
||||||
|
|
||||||
void PlocMemoryDumper::dataReceived(ActionId_t actionId, const uint8_t* data, uint32_t size) {
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
void PlocMemoryDumper::completionSuccessfulReceived(ActionId_t actionId) {
|
|
||||||
switch (pendingCommand) {
|
|
||||||
case (PLOC_SPV::FIRST_MRAM_DUMP):
|
|
||||||
case (PLOC_SPV::CONSECUTIVE_MRAM_DUMP):
|
|
||||||
if (mram.endAddress == mram.startAddress) {
|
|
||||||
triggerEvent(MRAM_DUMP_FINISHED);
|
|
||||||
state = State::IDLE;
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
state = State::COMMAND_CONSECUTIVE_MRAM_DUMP;
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
default:
|
|
||||||
sif::debug << "PlocMemoryDumper::completionSuccessfulReceived: Invalid pending command"
|
|
||||||
<< std::endl;
|
|
||||||
state = State::IDLE;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
void PlocMemoryDumper::completionFailedReceived(ActionId_t actionId,
|
|
||||||
ReturnValue_t returnCode) {
|
|
||||||
switch(pendingCommand) {
|
|
||||||
case(PLOC_SPV::FIRST_MRAM_DUMP):
|
|
||||||
case(PLOC_SPV::CONSECUTIVE_MRAM_DUMP):
|
|
||||||
triggerEvent(MRAM_DUMP_FAILED, mram.lastStartAddress);
|
|
||||||
break;
|
|
||||||
default:
|
|
||||||
sif::debug << "PlocMemoryDumper::completionFailedReceived: Invalid pending command "
|
|
||||||
<< std::endl;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
state = State::IDLE;
|
|
||||||
}
|
|
||||||
|
|
||||||
void PlocMemoryDumper::commandNextMramDump(ActionId_t dumpCommand) {
|
|
||||||
ReturnValue_t result = RETURN_OK;
|
|
||||||
|
|
||||||
uint32_t tempStartAddress = 0;
|
|
||||||
uint32_t tempEndAddress = 0;
|
|
||||||
|
|
||||||
if (mram.endAddress - mram.startAddress > MAX_MRAM_DUMP_SIZE) {
|
|
||||||
tempStartAddress = mram.startAddress;
|
|
||||||
tempEndAddress = mram.startAddress + MAX_MRAM_DUMP_SIZE;
|
|
||||||
mram.startAddress += MAX_MRAM_DUMP_SIZE;
|
|
||||||
mram.lastStartAddress = tempStartAddress;
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
tempStartAddress = mram.startAddress;
|
|
||||||
tempEndAddress = mram.endAddress;
|
|
||||||
mram.startAddress = mram.endAddress;
|
|
||||||
}
|
|
||||||
|
|
||||||
MemoryParams params(tempStartAddress, tempEndAddress);
|
|
||||||
|
|
||||||
result = commandActionHelper.commandAction(objects::PLOC_SUPERVISOR_HANDLER,
|
|
||||||
dumpCommand, ¶ms);
|
|
||||||
if (result != RETURN_OK) {
|
|
||||||
sif::warning << "PlocMemoryDumper::commandNextMramDump: Failed to send mram dump command "
|
|
||||||
<< "with start address " << tempStartAddress << " and end address "
|
|
||||||
<< tempEndAddress << std::endl;
|
|
||||||
triggerEvent(SEND_MRAM_DUMP_FAILED, result, tempStartAddress);
|
|
||||||
state = State::IDLE;
|
|
||||||
pendingCommand = NONE;
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
state = State::EXECUTING_MRAM_DUMP;
|
|
||||||
pendingCommand = dumpCommand;
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue
Block a user