Compare commits

..

34 Commits

Author SHA1 Message Date
45cf31c2b1 new fsfw
Some checks failed
EIVE/eive-obsw/pipeline/head There was a failure building this commit
EIVE/-/pipeline/head Build queued...
2022-09-14 11:30:15 +02:00
f6f6393c4a reverting mib only changes to cmake
Some checks failed
EIVE/eive-obsw/pipeline/head There was a failure building this commit
2022-09-07 12:02:18 +02:00
7754d65753 reverting changes to CMakeList.txt to move back topwards upstream 2022-09-07 11:09:17 +02:00
Uli
c14b131e6f fixed fsfw
Some checks failed
EIVE/eive-obsw/pipeline/head There was a failure building this commit
2022-09-07 10:57:39 +02:00
de856a514b workarounds for MIB build
Some checks failed
EIVE/eive-obsw/pipeline/head There was a failure building this commit
2022-09-06 22:17:54 +02:00
acd365e421 Mode introspection and fixes
Some checks failed
EIVE/eive-obsw/pipeline/head There was a failure building this commit
2022-08-26 16:12:22 +02:00
06b6c0838a compiling both with and without introspection 2022-08-25 16:28:01 +02:00
3c762e7437 switching mission object ids to FSFW_CLASSLESS_ENUM 2022-08-25 15:13:15 +02:00
4a147a442c removing debug code 2022-08-25 14:44:18 +02:00
fe8036361d I knew this was stupid: Revert "changing mission dependend object IDs to FSFW_ENUM"
This reverts commit 2800484f6b.
2022-08-25 14:43:27 +02:00
2800484f6b changing mission dependend object IDs to FSFW_ENUM
Some checks failed
EIVE/eive-obsw/pipeline/head There was a failure building this commit
2022-08-24 22:29:42 +02:00
aaeb101442 mostly done with gomspacehandlers, some todos left
Some checks failed
EIVE/eive-obsw/pipeline/head There was a failure building this commit
2022-08-24 18:13:03 +02:00
da2acd1fa8 continuing on gomspace handlers 2022-08-24 17:19:14 +02:00
1f47c970af working on gomespace handlers
Some checks failed
EIVE/eive-obsw/pipeline/head There was a failure building this commit
2022-08-23 23:34:20 +02:00
dfb800f58a more dirty hacks to check amd64 build. To be cleaned up
Some checks failed
EIVE/eive-obsw/pipeline/head There was a failure building this commit
2022-08-19 14:31:48 +02:00
a93fe8ef8e fixing bug in handlers 2022-08-19 14:31:22 +02:00
35effb9e68 stubs to be able to compile on modern amd64 2022-08-19 14:28:44 +02:00
c0e896b371 working on compiling bsp_q7s on amd64
Some checks failed
EIVE/eive-obsw/pipeline/head There was a failure building this commit
2022-08-18 19:04:49 +02:00
73971ad486 fixes 2022-08-18 16:33:53 +02:00
45e5ea362d Merge branch 'develop' into mohr/introspection
Some checks failed
EIVE/eive-obsw/pipeline/head There was a failure building this commit
2022-08-18 13:15:58 +02:00
7bcc4b18b7 compiles 2022-08-18 10:42:18 +02:00
a3b5993fdc compiles, does not link yet
Some checks failed
EIVE/eive-obsw/pipeline/head There was a failure building this commit
2022-08-17 19:19:49 +02:00
eb886dc53c Ploc Memory Dumper 2022-08-17 19:19:20 +02:00
a91393b4b4 Small fixes 2022-08-17 17:55:21 +02:00
ef40db7fe4 CCSDS Handler 2022-08-17 17:54:59 +02:00
60a20acc5b Core controlle rincomplete, but compiles
Some checks failed
EIVE/eive-obsw/pipeline/head There was a failure building this commit
2022-08-17 11:21:35 +02:00
13cc31dca9 working on core controller
Some checks failed
EIVE/eive-obsw/pipeline/head There was a failure building this commit
2022-08-16 18:31:58 +02:00
ad88bfa5b4 core controller bigWIP
Some checks failed
EIVE/eive-obsw/pipeline/head There was a failure building this commit
2022-07-28 17:16:24 +02:00
d92b1b170d Boilerplate Code to make ploc and star tracker compile 2022-07-27 23:09:05 +02:00
24297a6a97 WIP adapting PlocMpSoCHandler
Some checks failed
EIVE/eive-obsw/pipeline/head There was a failure building this commit
major PITA, but does compile now, will be back with more patience
2022-07-27 22:03:41 +02:00
c8f4f0b03e GPSHyperionController adapted 2022-07-27 22:02:37 +02:00
eeaef13916 PdecHandler adapted 2022-07-26 21:23:41 +02:00
a2910a401e adapted SolarArrayDeploymentHandler 2022-07-26 17:18:35 +02:00
cd1200d23d introspection fsfw, HeaterHandler adapted 2022-07-26 17:18:04 +02:00
839 changed files with 40331 additions and 70464 deletions

11
.gitignore vendored
View File

@ -12,17 +12,8 @@
#vscode #vscode
/.vscode /.vscode
# IntelliJ
/.idea/*
# Python # Python
__pycache__ __pycache__
.idea
# CLion
!/.idea/cmake.xml
generators/*.db generators/*.db
# Clangd LSP
/compile_commands.json
/.cache

12
.gitmodules vendored
View File

@ -10,15 +10,15 @@
[submodule "thirdparty/lwgps"] [submodule "thirdparty/lwgps"]
path = thirdparty/lwgps path = thirdparty/lwgps
url = https://github.com/rmspacefish/lwgps.git url = https://github.com/rmspacefish/lwgps.git
[submodule "generators/fsfwgen"]
path = generators/deps/fsfwgen
url = https://egit.irs.uni-stuttgart.de/fsfw/fsfw-gen.git
[submodule "thirdparty/arcsec_star_tracker"]
path = thirdparty/arcsec_star_tracker
url = https://egit.irs.uni-stuttgart.de/eive/arcsec_star_tracker.git
[submodule "thirdparty/json"] [submodule "thirdparty/json"]
path = thirdparty/json path = thirdparty/json
url = https://github.com/nlohmann/json.git url = https://github.com/nlohmann/json.git
[submodule "thirdparty/rapidcsv"] [submodule "thirdparty/rapidcsv"]
path = thirdparty/rapidcsv path = thirdparty/rapidcsv
url = https://github.com/d99kris/rapidcsv.git url = https://github.com/d99kris/rapidcsv.git
[submodule "thirdparty/gomspace-sw"]
path = thirdparty/gomspace-sw
url = https://egit.irs.uni-stuttgart.de/eive/gomspace-sw.git
[submodule "thirdparty/sagittactl"]
path = thirdparty/sagittactl
url = https://egit.irs.uni-stuttgart.de/eive/sagittactl.git

View File

@ -1,16 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="CMakeSharedSettings">
<configurations>
<configuration PROFILE_NAME="Debug Q7S" ENABLED="true" CONFIG_NAME="Debug" TOOLCHAIN_NAME="Default" GENERATION_OPTIONS="-DTGT_BSP=&quot;arm/q7s&quot;" NO_GENERATOR="true">
<ADDITIONAL_GENERATION_ENVIRONMENT>
<envs>
<env name="ZYNQ_7020_ROOTFS" value="/opt/xiphos/sdk/ark/sysroots/cortexa9hf-neon-xiphos-linux-gnueabi" />
<env name="CROSS_COMPILE" value="/opt/q7s-gcc/gcc-arm-8.3-2019.03-x86_64-arm-linux-gnueabihf/bin/arm-linux-gnueabihf" />
</envs>
</ADDITIONAL_GENERATION_ENVIRONMENT>
</configuration>
<configuration PROFILE_NAME="Debug" ENABLED="true" CONFIG_NAME="Debug" NO_GENERATOR="true" />
</configurations>
</component>
</project>

View File

@ -1,10 +0,0 @@
<component name="ProjectRunConfigurationManager">
<configuration default="false" name="Q7S FM" type="com.jetbrains.cidr.remote.gdbserver.type" factoryName="com.jetbrains.cidr.remote.gdbserver.factory" REDIRECT_INPUT="false" ELEVATE="false" USE_EXTERNAL_CONSOLE="false" PASS_PARENT_ENVS_2="true" PROJECT_NAME="eive-obsw" TARGET_NAME="eive-obsw" CONFIG_NAME="Debug" version="1" RUN_TARGET_PROJECT_NAME="eive-obsw" RUN_TARGET_NAME="eive-obsw">
<custom-gdb-server version="1" gdb-connect="localhost:1234" executable="" warmup-ms="0" download-type="NONE" sshConfigName="Q7S FM" uploadFile="/tmp/eive-obsw" defaultGdbServerArgs=":1234 /tmp/eive-obsw">
<debugger kind="GDB" isBundled="true" />
</custom-gdb-server>
<method v="2">
<option name="CLION.COMPOUND.BUILD" enabled="true" />
</method>
</configuration>
</component>

File diff suppressed because it is too large Load Diff

View File

@ -9,12 +9,13 @@
# ############################################################################## # ##############################################################################
cmake_minimum_required(VERSION 3.13) cmake_minimum_required(VERSION 3.13)
set(OBSW_VERSION_MAJOR 8) set(OBSW_VERSION_MAJOR_IF_GIT_FAILS 0)
set(OBSW_VERSION_MINOR 2) set(OBSW_VERSION_MINOR_IF_GIT_FAILS 0)
set(OBSW_VERSION_REVISION 0) set(OBSW_VERSION_REVISION_IF_GIT_FAILS 0)
# set(CMAKE_VERBOSE TRUE) # set(CMAKE_VERBOSE TRUE)
option( option(
EIVE_HARDCODED_TOOLCHAIN_FILE EIVE_HARDCODED_TOOLCHAIN_FILE
"\ "\
@ -64,36 +65,27 @@ include(EiveHelpers)
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)
set(OBSW_MAX_SCHEDULED_TCS 4000) set(OBSW_MAX_SCHEDULED_TCS 500)
if(EIVE_Q7S_EM) if(EIVE_Q7S_EM)
set(OBSW_Q7S_EM set(OBSW_Q7S_EM
1 1
CACHE STRING "Q7S EM configuration") CACHE STRING "Q7S EM configuration")
set(INIT_VAL 0) set(INIT_VAL 0)
set(OBSW_STAR_TRACKER_GROUND_CONFIG 1)
else() else()
set(OBSW_Q7S_EM set(OBSW_Q7S_EM
0 0
CACHE STRING "Q7S EM configuration") CACHE STRING "Q7S EM configuration")
set(INIT_VAL 1) set(INIT_VAL 1)
set(OBSW_STAR_TRACKER_GROUND_CONFIG 0)
endif() endif()
set(OBSW_ADD_TMTC_TCP_SERVER
${OBSW_Q7S_EM}
CACHE STRING "Add TCP TMTC Server")
set(OBSW_ADD_TMTC_UDP_SERVER
0
CACHE STRING "Add UDP TMTC Server")
set(OBSW_ADD_MGT set(OBSW_ADD_MGT
${INIT_VAL} ${INIT_VAL}
CACHE STRING "Add MGT module") CACHE STRING "Add MGT module")
set(OBSW_ADD_BPX_BATTERY_HANDLER set(OBSW_ADD_BPX_BATTERY_HANDLER
1 ${INIT_VAL}
CACHE STRING "Add BPX battery module") CACHE STRING "Add MGT module")
set(OBSW_ADD_STAR_TRACKER set(OBSW_ADD_STAR_TRACKER
1 ${INIT_VAL}
CACHE STRING "Add Startracker module") CACHE STRING "Add Startracker module")
set(OBSW_ADD_SUN_SENSORS set(OBSW_ADD_SUN_SENSORS
${INIT_VAL} ${INIT_VAL}
@ -101,42 +93,12 @@ set(OBSW_ADD_SUN_SENSORS
set(OBSW_ADD_SUS_BOARD_ASS set(OBSW_ADD_SUS_BOARD_ASS
${INIT_VAL} ${INIT_VAL}
CACHE STRING "Add sun sensor board assembly") CACHE STRING "Add sun sensor board assembly")
set(OBSW_ADD_THERMAL_TEMP_INSERTER
${OBSW_Q7S_EM}
CACHE STRING "Add thermal sensor temperature inserter")
set(OBSW_ADD_ACS_BOARD set(OBSW_ADD_ACS_BOARD
1 ${INIT_VAL}
CACHE STRING "Add ACS board module") CACHE STRING "Add ACS board module")
set(OBSW_ADD_GPS_CTRL set(OBSW_ADD_ACS_HANDLERS
${INIT_VAL} ${INIT_VAL}
CACHE STRING "Add GPS controllers") CACHE STRING "Add ACS handlers")
set(OBSW_ADD_CCSDS_IP_CORES
1
CACHE STRING "Add CCSDS IP cores")
set(OBSW_TM_TO_PTME
1
CACHE STRING "Send telemetry to PTME IP core")
set(OBSW_TC_FROM_PDEC
1
CACHE STRING "Poll telecommand from PDEC IP core")
set(OBSW_ADD_TCS_CTRL
1
CACHE STRING "Add TCS controllers")
set(OBSW_ADD_HEATERS
1
CACHE STRING "Add TCS heaters")
set(OBSW_ADD_PLOC_SUPERVISOR
1
CACHE STRING "Add PLOC supervisor handler")
set(OBSW_ADD_SA_DEPL
${INIT_VAL}
CACHE STRING "Add SA deployment handler")
set(OBSW_ADD_PLOC_MPSOC
1
CACHE STRING "Add MPSoC handler")
set(OBSW_ADD_ACS_CTRL
${INIT_VAL}
CACHE STRING "Add ACS controller")
set(OBSW_ADD_RTD_DEVICES set(OBSW_ADD_RTD_DEVICES
${INIT_VAL} ${INIT_VAL}
CACHE STRING "Add RTD devices") CACHE STRING "Add RTD devices")
@ -144,29 +106,20 @@ set(OBSW_ADD_RAD_SENSORS
${INIT_VAL} ${INIT_VAL}
CACHE STRING "Add Rad Sensor module") CACHE STRING "Add Rad Sensor module")
set(OBSW_ADD_PL_PCDU set(OBSW_ADD_PL_PCDU
1 ${INIT_VAL}
CACHE STRING "Add Payload PCDU modukle") CACHE STRING "Add Payload PCDU modukle")
set(OBSW_ADD_SYRLINKS set(OBSW_ADD_SYRLINKS
1 ${INIT_VAL}
CACHE STRING "Add Syrlinks module") CACHE STRING "Add Syrlinks module")
set(OBSW_ADD_TMP_DEVICES set(OBSW_ADD_TMP_DEVICES
1 ${INIT_VAL}
CACHE STRING "Add TMP devices") CACHE STRING "Add TMP devices")
set(OBSW_ADD_GOMSPACE_PCDU set(OBSW_ADD_GOMSPACE_PCDU
1
CACHE STRING "Add GomSpace PCDU modules")
set(OBSW_ADD_GOMSPACE_ACU
${INIT_VAL} ${INIT_VAL}
CACHE STRING "Add GomSpace ACU submodule") CACHE STRING "Add GomSpace PCDU modules")
set(OBSW_ADD_RW set(OBSW_ADD_RW
${INIT_VAL} ${INIT_VAL}
CACHE STRING "Add RW modules") CACHE STRING "Add RW modules")
set(OBSW_ADD_SCEX_DEVICE
1
CACHE STRING "Add Solar Cell Experiment module")
set(OBSW_SYRLINKS_SIMULATED
0
CACHE STRING "Syrlinks is simulated")
# ############################################################################## # ##############################################################################
# Pre-Sources preparation # Pre-Sources preparation
@ -183,21 +136,32 @@ if(EXISTS ${CMAKE_CURRENT_SOURCE_DIR}/.git)
set(GIT_INFO set(GIT_INFO
${GIT_INFO} ${GIT_INFO}
CACHE STRING "Version information retrieved with git describe") CACHE STRING "Version information retrieved with git describe")
# CMakeLists.txt is now single source of information. list(GET GIT_INFO 1 list(GET GIT_INFO 1 OBSW_VERSION_MAJOR)
# OBSW_VERSION_MAJOR) list(GET GIT_INFO 2 OBSW_VERSION_MINOR) list(GET list(GET GIT_INFO 2 OBSW_VERSION_MINOR)
# GIT_INFO 3 OBSW_VERSION_REVISION) list(GET GIT_INFO 3 OBSW_VERSION_REVISION)
list(LENGTH GIT_INFO LIST_LEN)
if(LIST_LEN GREATER 4)
list(GET GIT_INFO 4 OBSW_VERSION_CST_GIT_SHA1) list(GET GIT_INFO 4 OBSW_VERSION_CST_GIT_SHA1)
if(NOT OBSW_VERSION_MAJOR)
set(OBSW_VERSION_MAJOR ${OBSW_VERSION_MAJOR_IF_GIT_FAILS})
endif()
if(NOT OBSW_VERSION_MINOR)
set(FSFW_SUBVERSION ${OBSW_VERSION_MINOR_IF_GIT_FAILS})
endif()
if(NOT OBSW_VERSION_REVISION)
set(FSFW_REVISION ${OBSW_VERSION_REVISION_IF_GIT_FAILS})
endif() endif()
set(GIT_VER_HANDLING_OK TRUE) set(GIT_VER_HANDLING_OK TRUE)
else() else()
set(GIT_VER_HANDLING_OK FALSE) set(GIT_VER_HANDLING_OK FALSE)
endif() endif()
endif() endif()
if(NOT GIT_VER_HANDLING_OK)
set(OBSW_VERSION_MAJOR ${OBSW_VERSION_MAJOR_IF_GIT_FAILS})
set(OBSW_VERSION_MINOR ${OBSW_VERSION_MINOR_IF_GIT_FAILS})
set(OBSW_VERSION_REVISION ${OBSW_VERSION_REVISION_IF_GIT_FAILS})
endif()
# Set names and variables # Set names and variables
set(OBSW_NAME ${CMAKE_PROJECT_NAME}) set(OBSW_NAME ${PROJECT_NAME})
set(WATCHDOG_NAME eive-watchdog) set(WATCHDOG_NAME eive-watchdog)
set(SIMPLE_OBSW_NAME eive-simple) set(SIMPLE_OBSW_NAME eive-simple)
set(UNITTEST_NAME eive-unittest) set(UNITTEST_NAME eive-unittest)
@ -207,9 +171,6 @@ set(LIB_ETL_TARGET etl::etl)
set(LIB_CSP_NAME libcsp) set(LIB_CSP_NAME libcsp)
set(LIB_LWGPS_NAME lwgps) set(LIB_LWGPS_NAME lwgps)
set(LIB_ARCSEC wire) set(LIB_ARCSEC wire)
set(LIB_GOMSPACE_CLIENTS gs_clients)
set(LIB_GOMSPACE_CSP gs_csp)
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)
@ -222,26 +183,22 @@ set(FSFW_PATH fsfw)
set(TEST_PATH test) set(TEST_PATH test)
set(UNITTEST_PATH unittest) set(UNITTEST_PATH unittest)
set(LINUX_PATH linux) set(LINUX_PATH linux)
set(LIB_GOMSPACE_PATH ${THIRD_PARTY_FOLDER}/gomspace-sw) set(COMMON_PATH ${CMAKE_CURRENT_SOURCE_DIR}/common)
set(COMMON_PATH common)
set(DUMMY_PATH dummies) set(DUMMY_PATH dummies)
set(WATCHDOG_PATH watchdog) 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_EIVE_MISSION_PATH mission)
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)
set(LIB_LWGPS_PATH ${THIRD_PARTY_FOLDER}/lwgps) set(LIB_LWGPS_PATH ${THIRD_PARTY_FOLDER}/lwgps)
set(LIB_ARCSEC_PATH ${THIRD_PARTY_FOLDER}/sagittactl) set(LIB_ARCSEC_PATH ${THIRD_PARTY_FOLDER}/arcsec_star_tracker)
set(LIB_JSON_PATH ${THIRD_PARTY_FOLDER}/json) 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 OFF) set(EIVE_ADD_LINUX_FILES False)
set(FSFW_ADD_TMSTORAGE ON)
set(FSFW_ADD_COORDINATES ON)
set(FSFW_ADD_SGP4_PROPAGATOR ON)
# 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.
@ -249,6 +206,7 @@ pre_source_hw_os_config()
if(TGT_BSP) if(TGT_BSP)
set(LIBGPS_VERSION_MAJOR 3) set(LIBGPS_VERSION_MAJOR 3)
# I assume a newer version than 3.17 will be installed on other Linux board # I assume a newer version than 3.17 will be installed on other Linux board
# than the Q7S # than the Q7S
set(LIBGPS_VERSION_MINOR 20) set(LIBGPS_VERSION_MINOR 20)
@ -258,18 +216,15 @@ if(TGT_BSP)
OR TGT_BSP MATCHES "arm/egse" OR TGT_BSP MATCHES "arm/egse"
OR TGT_BSP MATCHES "arm/te0720-1cfa") OR TGT_BSP MATCHES "arm/te0720-1cfa")
find_library(${LIB_GPS} gps) find_library(${LIB_GPS} gps)
set(FSFW_CONFIG_PATH "linux/fsfwconfig") set(FSFW_CONFIG_PATH ${CMAKE_CURRENT_SOURCE_DIR}/linux/fsfwconfig)
if(NOT BUILD_Q7S_SIMPLE_MODE) if(NOT BUILD_Q7S_SIMPLE_MODE)
set(EIVE_ADD_LINUX_FILES TRUE) set(EIVE_ADD_LINUX_FILES TRUE)
set(EIVE_ADD_LINUX_FSFWCONFIG TRUE) set(ADD_CSP_LIB TRUE)
set(ADD_GOMSPACE_CSP TRUE)
set(ADD_GOMSPACE_CLIENTS TRUE)
set(FSFW_HAL_ADD_LINUX ON) set(FSFW_HAL_ADD_LINUX ON)
set(FSFW_HAL_LINUX_ADD_LIBGPIOD ON) set(FSFW_HAL_LINUX_ADD_LIBGPIOD ON)
set(FSFW_HAL_LINUX_ADD_PERIPHERAL_DRIVERS ON) set(FSFW_HAL_LINUX_ADD_PERIPHERAL_DRIVERS ON)
endif() endif()
elseif(UNIX)
set(EIVE_ADD_LINUX_FILES ON)
endif() endif()
if(TGT_BSP MATCHES "arm/raspberrypi") if(TGT_BSP MATCHES "arm/raspberrypi")
@ -304,21 +259,6 @@ if(TGT_BSP)
else() else()
# Required by FSFW library # Required by FSFW library
set(FSFW_CONFIG_PATH "${BSP_PATH}/fsfwconfig") set(FSFW_CONFIG_PATH "${BSP_PATH}/fsfwconfig")
if(UNIX)
set(EIVE_ADD_LINUX_FILES ON)
endif()
endif()
include(BuildType)
set_build_type()
set(FSFW_DEBUG_INFO 0)
set(OBSW_ENABLE_PERIODIC_HK 1)
set(Q7S_CHECK_FOR_ALREADY_RUNNING_IMG 0)
if(RELEASE_BUILD MATCHES 0)
set(FSFW_DEBUG_INFO 1)
set(OBSW_ENABLE_PERIODIC_HK 0)
set(Q7S_CHECK_FOR_ALREADY_RUNNING_IMG 1)
endif() endif()
# Configuration files # Configuration files
@ -334,7 +274,8 @@ 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
set(FSFW_ADDITIONAL_INC_PATHS "${COMMON_PATH}/config" set(FSFW_ADDITIONAL_INC_PATHS "${COMMON_PATH}"
${COMMON_CONFIG_PATH}
${CMAKE_CURRENT_BINARY_DIR}) ${CMAKE_CURRENT_BINARY_DIR})
# ############################################################################## # ##############################################################################
@ -343,31 +284,12 @@ set(FSFW_ADDITIONAL_INC_PATHS "${COMMON_PATH}/config"
# global compiler options need to be set before adding executables # global compiler options need to be set before adding executables
if(CMAKE_CXX_COMPILER_ID STREQUAL "GNU") if(CMAKE_CXX_COMPILER_ID STREQUAL "GNU")
# Remove unused sections. add_compile_options(
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()
add_library(${LIB_EIVE_MISSION})
add_library(${LIB_DUMMIES})
# Add main executable
add_executable(${OBSW_NAME})
set(OBSW_BIN_NAME ${CMAKE_PROJECT_NAME})
if(CMAKE_CXX_COMPILER_ID STREQUAL "GNU")
set(WARNING_FLAGS
"-Wall" "-Wall"
"-Wextra" "-Wextra"
"-Wimplicit-fallthrough=1" "-Wimplicit-fallthrough=1"
"-Wno-unused-parameter" "-Wno-unused-parameter"
"-Wno-psabi" "-Wno-psabi"
"-Wshadow=local"
"-Wduplicated-cond" # check for duplicate conditions "-Wduplicated-cond" # check for duplicate conditions
"-Wduplicated-branches" # check for duplicate branches "-Wduplicated-branches" # check for duplicate branches
"-Wlogical-op" # Search for bitwise operations instead of logical "-Wlogical-op" # Search for bitwise operations instead of logical
@ -383,15 +305,27 @@ if(CMAKE_CXX_COMPILER_ID STREQUAL "GNU")
"-Wcast-qual" # Warn if the constness is cast away "-Wcast-qual" # Warn if the constness is cast away
"-Wstringop-overflow=4" "-Wstringop-overflow=4"
# -Wstack-protector # Emits a few false positives for low level access # -Wstack-protector # Emits a few false positives for low level access
# -Wconversion # Creates many false positives -Warith-conversion # Use # -Wconversion # Creates many false positives -Warith-conversion # Use with
# with Wconversion to find more implicit conversions -fanalyzer # Should # Wconversion to find more implicit conversions -fanalyzer # Should be used
# be used to look through problems # to look through problems
) )
target_compile_options(${OBSW_NAME} PRIVATE ${WARNING_FLAGS}) # Remove unused sections.
target_compile_options(${LIB_EIVE_MISSION} PRIVATE ${WARNING_FLAGS}) add_compile_options("-ffunction-sections" "-fdata-sections")
target_compile_options(${LIB_DUMMIES} PRIVATE ${WARNING_FLAGS})
# Removed unused sections.
add_link_options("-Wl,--gc-sections")
elseif(CMAKE_CXX_COMPILER_ID STREQUAL "MSVC")
set(COMPILER_FLAGS "/permissive-")
endif() endif()
add_library(${LIB_EIVE_MISSION})
add_library(${LIB_DUMMIES})
# Add main executable
add_executable(${OBSW_NAME})
set(OBSW_BIN_NAME ${PROJECT_NAME})
set_target_properties(${OBSW_NAME} PROPERTIES OUTPUT_NAME ${OBSW_BIN_NAME}) set_target_properties(${OBSW_NAME} PROPERTIES OUTPUT_NAME ${OBSW_BIN_NAME})
# Watchdog # Watchdog
@ -420,19 +354,24 @@ if(EIVE_ADD_JSON_LIB)
add_subdirectory(${LIB_JSON_PATH}) add_subdirectory(${LIB_JSON_PATH})
endif() endif()
add_subdirectory(thirdparty) add_subdirectory(thirdparty/rapidcsv)
if(EIVE_ADD_LINUX_FILES) if(EIVE_ADD_LINUX_FILES)
if(TGT_BSP MATCHES "arm/q7s") add_subdirectory(${LIB_ARCSEC_PATH})
add_subdirectory(${LIB_GOMSPACE_PATH})
endif()
add_subdirectory(${LINUX_PATH}) add_subdirectory(${LINUX_PATH})
endif() endif()
add_subdirectory(${BSP_PATH}) add_subdirectory(${BSP_PATH})
if(ADD_CSP_LIB)
add_subdirectory(${LIB_CSP_PATH})
endif()
add_subdirectory(${COMMON_PATH}) add_subdirectory(${COMMON_PATH})
add_subdirectory(${DUMMY_PATH}) add_subdirectory(${DUMMY_PATH})
add_subdirectory(${LIB_LWGPS_PATH})
add_subdirectory(${FSFW_PATH}) add_subdirectory(${FSFW_PATH})
add_subdirectory(${LIB_EIVE_MISSION_PATH}) add_subdirectory(${LIB_EIVE_MISSION_PATH})
add_subdirectory(${TEST_PATH}) add_subdirectory(${TEST_PATH})
@ -440,19 +379,21 @@ add_subdirectory(${TEST_PATH})
add_subdirectory(${UNITTEST_PATH}) add_subdirectory(${UNITTEST_PATH})
# This should have already been downloaded by the FSFW Still include it to be # This should have already been downloaded by the FSFW Still include it to be
# safe find_package(etl ${FSFW_ETL_LIB_MAJOR_VERSION} CONFIG QUIET) Not # safe
# installed, so use FetchContent to download and provide etl if(NOT etl_FOUND) find_package(etl ${FSFW_ETL_LIB_MAJOR_VERSION} CONFIG QUIET)
message( # Not installed, so use FetchContent to download and provide etl
if(NOT etl_FOUND)
message(
STATUS STATUS
"No ETL installation was found with find_package. Installing and providing " "No ETL installation was found with find_package. Installing and providing "
"etl with FindPackage") "etl with FindPackage")
include(FetchContent) include(FetchContent)
FetchContent_Declare( FetchContent_Declare(
etl etl
GIT_REPOSITORY https://github.com/ETLCPP/etl GIT_REPOSITORY https://github.com/ETLCPP/etl
GIT_TAG ${FSFW_ETL_LIB_VERSION}) GIT_TAG ${FSFW_ETL_LIB_VERSION})
list(APPEND FSFW_FETCH_CONTENT_TARGETS etl) list(APPEND FSFW_FETCH_CONTENT_TARGETS etl)
# endif() endif()
# Use same Catch2 version as framework # Use same Catch2 version as framework
if(NOT (TGT_BSP MATCHES "arm/te0720-1cfa") if(NOT (TGT_BSP MATCHES "arm/te0720-1cfa")
@ -499,17 +440,15 @@ endif()
# ############################################################################## # ##############################################################################
# Add libraries # Add libraries
target_link_libraries(${LIB_EIVE_MISSION} PUBLIC ${LIB_FSFW_NAME} target_link_libraries(${LIB_EIVE_MISSION}
${LIB_OS_NAME}) PUBLIC ${LIB_FSFW_NAME} ${LIB_LWGPS_NAME} ${LIB_OS_NAME})
target_link_libraries(${LIB_DUMMIES} PUBLIC ${LIB_EIVE_MISSION} target_link_libraries(${LIB_DUMMIES} PUBLIC ${LIB_FSFW_NAME} ${LIB_JSON_NAME})
${LIB_FSFW_NAME} ${LIB_JSON_NAME})
target_link_libraries(${OBSW_NAME} PRIVATE ${LIB_EIVE_MISSION} ${LIB_DUMMIES}) target_link_libraries(${OBSW_NAME} PRIVATE ${LIB_EIVE_MISSION} ${LIB_DUMMIES})
if(TGT_BSP MATCHES "arm/q7s") if(TGT_BSP MATCHES "arm/q7s")
target_link_libraries(${LIB_EIVE_MISSION} PUBLIC ${LIB_GPS} ${LIB_ARCSEC} target_link_libraries(${LIB_EIVE_MISSION} PUBLIC ${LIB_GPS} ${LIB_ARCSEC})
${LIB_GOMSPACE_CLIENTS})
endif() endif()
target_link_libraries(${UNITTEST_NAME} PRIVATE Catch2 ${LIB_EIVE_MISSION} target_link_libraries(${UNITTEST_NAME} PRIVATE Catch2 ${LIB_EIVE_MISSION}
@ -519,6 +458,10 @@ if(TGT_BSP MATCHES "arm/egse")
target_link_libraries(${OBSW_NAME} PRIVATE ${LIB_ARCSEC}) target_link_libraries(${OBSW_NAME} PRIVATE ${LIB_ARCSEC})
endif() endif()
if(ADD_CSP_LIB)
target_link_libraries(${OBSW_NAME} PRIVATE ${LIB_CSP_NAME})
endif()
if(EIVE_ADD_ETL_LIB) if(EIVE_ADD_ETL_LIB)
target_link_libraries(${LIB_EIVE_MISSION} PUBLIC ${LIB_ETL_TARGET}) target_link_libraries(${LIB_EIVE_MISSION} PUBLIC ${LIB_ETL_TARGET})
endif() endif()
@ -579,3 +522,6 @@ add_custom_command(
POST_BUILD POST_BUILD
COMMAND ${CMAKE_SIZE} ${OBSW_BIN_NAME}${FILE_SUFFIX} COMMAND ${CMAKE_SIZE} ${OBSW_BIN_NAME}${FILE_SUFFIX}
COMMENT ${POST_BUILD_COMMENT}) COMMENT ${POST_BUILD_COMMENT})
include(BuildType)
set_build_type()

182
README.md
View File

@ -18,7 +18,6 @@
11. [Q7S OBC](#q7s) 11. [Q7S OBC](#q7s)
12. [Static Code Analysis](#static-code-analysis) 12. [Static Code Analysis](#static-code-analysis)
13. [Eclipse](#eclipse) 13. [Eclipse](#eclipse)
14. [CLion](#clion)
14. [Running the OBSW on a Raspberry Pi](#rpi) 14. [Running the OBSW on a Raspberry Pi](#rpi)
15. [Running OBSW on EGSE](#egse) 15. [Running OBSW on EGSE](#egse)
16. [Manually preparing sysroots to compile gpsd](#gpsd) 16. [Manually preparing sysroots to compile gpsd](#gpsd)
@ -96,24 +95,16 @@ When using Windows, run theses steps in MSYS2.
2. Update all the submodules 2. Update all the submodules
```sh ```sh
git submodule update --init git submodule init
git submodule sync
git submodule update
``` ```
3. Create two system variables to pass the system root path and the cross-compiler path to the 3. Ensure that the cross-compiler is working with `arm-linux-gnueabihf-gcc --version` and that
build system. You only need to do this once when setting up the build system.
Example for Unix:
```sh
export CROSS_COMPILE_BIN_PATH=<absolutePathToCrossCompilerBinPath>
export ZYNQ_7020_SYSROOT=<absolutePathToSysroot>
```
4. Ensure that the cross-compiler is working with
`${CROSS_COMPILE_BIN_PATH}/arm-linux-gnueabihf-gcc --version` and that
the sysroot environmental variables have been set like specified in the the sysroot environmental variables have been set like specified in the
[root filesystem chapter](#sysroot). [root filesystem chapter](#sysroot).
5. Run the CMake configuration to create the build system in a `build-Debug-Q7S` folder. 4. Run the CMake configuration to create the build system in a `build-Debug-Q7S` folder.
Add `-G "MinGW Makefiles` in MinGW64 on Windows. Add `-G "MinGW Makefiles` in MinGW64 on Windows.
```sh ```sh
@ -122,7 +113,7 @@ When using Windows, run theses steps in MSYS2.
cmake --build . -j cmake --build . -j
``` ```
Please note that you can also use provided shell scripts to perform these commands. You can also use provided shell scripts to perform these commands.
```sh ```sh
cp scripts/q7s-env.sh .. cp scripts/q7s-env.sh ..
cp scripts/q7s-env-em.sh .. cp scripts/q7s-env-em.sh ..
@ -154,85 +145,13 @@ When using Windows, run theses steps in MSYS2.
There are also different values for `-DTGT_BSP` to build for the Raspberry Pi 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`.
6. Build the software with 5. Build the software with
```sh ```sh
cd cmake-build-debug-q7s cd cmake-build-debug-q7s
cmake --build . -j cmake --build . -j
``` ```
## Preparing and executing an OBSW update
A OBSW update consists of a `xz` compressed file `eive-sw-update.tar.xz`
which contains the following two files:
1. Stripped OBSW binary `eive-obsw-stripped`
2. OBSW version text file with the name `obsw_version.txt`
These files can be created manually:
1. Build the release image inside `cmake-build-release-q7s`
2. Switch into the build directory
3. Run the following command to create the version file
```sh
git describe --tags --always --exclude docker_* > obsw_version.txt
```
You can also use the `create-version-file.sh` helper shell script
located in the `scripts` folder to do this.
4. Set the Q7S user as the file owner for both files
```sh
sudo chown root:root eive-obsw-stripped
sudo chown root:root obsw_version.txt
```
5. Run the following command to create the compressed archive
```sh
tar -cJvf eive-sw-update.tar.xz eive-obsw-stripped obsw_version.txt
```
You can also use the helper script `create-sw-update.sh` inside the build folder
after sourcing the `q7s-env.sh` helper script to perform all steps including
a rebuild.
After creating these files, they need to be transferred onto the Q7S
to either the `/mnt/sd0/bin` or `/mnt/sd1/bin` folder if the OBSW update
is performed from the SD card. It can also be transferred to the `/tmp` folder
to perform the update from a temporary directory, which does not rely on any
of the SD cards being on and mounted. However, all files in the temporary
directory will be deleted if the Linux OS is rebooted for any reason.
After both files are in place (this is checked by the OBSW), the example command
sequence is used by the OBSW to write the OBSW update to the QSPI chip 0 and
slot 0 using SD card 0:
```sh
tar -xJvf eive-update.tar.xz
xsc_mount_copy 0 0
cp eive-obsw-stripped /tmp/mntupdate-xdi-qspi0-nom-rootfs/usr/bin/eive-obsw
cp obsw_update.txt /tmp/mntupdate-xdi-qspi0-nom-rootfs/usr/share/obsw_update.txt
writeprotect 0 0 1
```
Some context information about the used commands:
1. It mounts the target chip and copy combination into the `/tmp` folder
using the `xsc_mount_copy <chip> <copy>` utility. This also unlocks the
writeprotection for the chip. The mount point name inside `/tmp` depends
on which chip and copy is used
- Chip 0 Copy 0: `/tmp/mntupdate-xdi-qspi0-nom-rootfs`
- Chip 0 Copy 1: `/tmp/mntupdate-xdi-qspi0-gold-rootfs`
- Slot 1 Copy 0: `/tmp/mntupdate-xdi-qspi1-nom-rootfs`
- Slot 1 Copy 1: `/tmp/mntupdate-xdi-qspi1-gold-rootfs`
2. Writing the file with a regular `cp <source> <target>` command
3. Enabling the writeprotection using the `writeprotect <chip> <copy> 1` utility.
## Build for the Q7S target root filesystem with `yocto` ## Build for the Q7S target root filesystem with `yocto`
The EIVE root filesystem will contain the EIVE OBSW and the Watchdog component. The EIVE root filesystem will contain the EIVE OBSW and the Watchdog component.
@ -299,7 +218,7 @@ helper scripts as well.
4. Run build command by double clicking the created target or by right clicking 4. Run build command by double clicking the created target or by right clicking
the project folder and selecting Build Project. the project folder and selecting Build Project.
# <a id="host-commands"></a> Useful and Common Commands # <a id="host-commands"></a> Useful and Common Commands (Host)
## Build generation ## Build generation
@ -328,11 +247,14 @@ cmake -DTGT_BSP=arm/q7s -DCMAKE_BUILD_TYPE=Release ..
cmake --build . -j cmake --build . -j
``` ```
### Hosted OBSW ### Q7S Watchdog
The watchdog will be built along side the primary OBSW binary.
### Hosted
You can also use the FSFW OSAL `host` to build on Windows or for generic OSes. You can also use the FSFW OSAL `host` to build on Windows or for generic OSes.
You can use the `clone-submodules-no-privlibs.sh` script to only clone the required (non-private) Note: Currently this is not supported.
submodules required to build the hosted OBSW.
```sh ```sh
mkdir cmake-build-debug && cd cmake-build-debug mkdir cmake-build-debug && cd cmake-build-debug
@ -340,21 +262,6 @@ cmake -DFSFW_OSAL=host -DCMAKE_BUILD_TYPE=Debug ..
cmake --build . -j cmake --build . -j
``` ```
You can also use the `linux` OSAL:
```sh
mkdir cmake-build-debug && cd cmake-build-debug
cmake -DFSFW_OSAL=linux -DCMAKE_BUILD_TYPE=Debug ..
cmake --build . -j
```
Please note that some additional Linux setup might be necessary.
You can find more information in the [Linux section of the FSFW example](https://egit.irs.uni-stuttgart.de/fsfw/fsfw-example-linux-mcu/src/branch/mueller/master/doc/README-linux.md#raising-message-queue-size-limit)
### Q7S Watchdog
The watchdog will be built along side the primary OBSW binary.
### Unittests ### Unittests
To build the unittests, the corresponding target must be specified in the build command. To build the unittests, the corresponding target must be specified in the build command.
@ -964,12 +871,6 @@ used by other software components to read the current chip and copy.
This is a configuration scripts which runs after the Network Time Protocol has run. This script This is a configuration scripts which runs after the Network Time Protocol has run. This script
currently sets the static IP address `192.168.133.10` and starts the `can` interface. currently sets the static IP address `192.168.133.10` and starts the `can` interface.
## Initial boot delay
You can create a file named `boot_delays_secs.txt` inside the home folder to delay the OBSW boot
for 6 seconds if the file is empty of for the number of seconds specified inside the file. This
can be helpful if something inside the OBSW leads to an immediate crash of the OBC.
## PCDU ## PCDU
Connect to serial console of P60 Dock Connect to serial console of P60 Dock
@ -1082,29 +983,6 @@ Get fill count:
xsc_scratch read | wc -c xsc_scratch read | wc -c
``` ```
## Custom device names in Linux with the `udev` module
You can assign custom device names using the Linux `udev` system.
This works by specifying a rules file inside the `/etc/udev/rules.d` folder
which creates a SYMLINK if certain device properties are true.
Each rule is a new line inside a rules file.
For example, the rule
```txt
SUBSYSTEM=="tty", ATTRS{interface}=="Dual RS232-HS", ATTRS{bInterfaceNumber}=="01", SYMLINK+="ploc_supv
```
Will create a symlink `/dev/ploc_supv` if a connected USB device has the
same `interface` and `bInterfaceNumber` properties as shown above.
You can list the properties for a given connected device using `udevadm`.
For example, you can do this for a connected example device `/dev/ttyUSB0`
by using
```txt
udevadm info -a /dev/ttyUSB0
```
## Using `system` when debugging ## Using `system` when debugging
@ -1158,19 +1036,11 @@ cat /proc/tty/driver
## I2C ## I2C
Getting information about some I2C device Getting information about I2C device
````
```sh
ls /sys/class/i2c-dev/i2c-0/device/device/driver ls /sys/class/i2c-dev/i2c-0/device/device/driver
``` ````
This shows the memory mapping of `/dev/i2c-0`. This shows the memory mapping of /dev/i2c-0
You can use the `i2cdetect` utility to scan for I2C devices.
For example, to do this for bus 0 (`/dev/i2c-0`), you can use
```sh
i2cdetect -r -y 0
```
## CAN ## CAN
@ -1246,22 +1116,6 @@ Finally, you can convert the generated `.xml` file to HTML with the following co
cppcheck-htmlreport --file=report.xml --report-dir=cppcheck --source-dir=.. cppcheck-htmlreport --file=report.xml --report-dir=cppcheck --source-dir=..
``` ```
# <a id="CLion"></a> CLion
CLion is the recommended IDE for the development of the hosted version of EIVE.
You can also set up CLion for cross-compilation of the primary OBSW.
There is a shared `.idea/cmake.xml` file to get started with this.
To make cross-compilation work, two special environment variables
need to be set:
- `ZYNQ_7020_ROOTFS` pointing to the root filesystem
- `CROSS_COMPILE` pointing to the the full path of the cross-compiler
without the specific tool suffix. For example, if the the cross-compiler
tools are located at `/opt/q7s-gcc/gcc-arm-8.3-2019.03-x86_64-arm-linux-gnueabihf/bin`,
this variable would be set
to `/opt/q7s-gcc/gcc-arm-8.3-2019.03-x86_64-arm-linux-gnueabihf/bin/arm-linux-gnueabihf`
# <a id="eclipse"></a> Eclipse # <a id="eclipse"></a> Eclipse
When using Eclipse, there are two special build variables in the project properties When using Eclipse, there are two special build variables in the project properties

File diff suppressed because it is too large Load Diff

View File

@ -1,545 +0,0 @@
#include <fsfw/globalfunctions/arrayprinter.h>
#include <fsfw/tasks/TaskFactory.h>
#include <linux/payload/PlocMpsocSpecialComHelperLegacy.h>
#include <unistd.h>
#include <filesystem>
#include <fstream>
#ifdef XIPHOS_Q7S
#include "bsp_q7s/fs/FilesystemHelper.h"
#endif
#include "mission/utility/Timestamp.h"
using namespace ploc;
PlocMpsocSpecialComHelperLegacy::PlocMpsocSpecialComHelperLegacy(object_id_t objectId)
: SystemObject(objectId) {
spParams.buf = commandBuffer;
spParams.maxSize = sizeof(commandBuffer);
}
PlocMpsocSpecialComHelperLegacy::~PlocMpsocSpecialComHelperLegacy() {}
ReturnValue_t PlocMpsocSpecialComHelperLegacy::initialize() {
#ifdef XIPHOS_Q7S
sdcMan = SdCardManager::instance();
if (sdcMan == nullptr) {
sif::warning << "PlocMPSoCHelper::initialize: Invalid SD Card Manager" << std::endl;
return returnvalue::FAILED;
}
#endif
return returnvalue::OK;
}
ReturnValue_t PlocMpsocSpecialComHelperLegacy::performOperation(uint8_t operationCode) {
ReturnValue_t result = returnvalue::OK;
semaphore.acquire();
while (true) {
#if OBSW_THREAD_TRACING == 1
trace::threadTrace(opCounter, "PLOC MPSOC Helper");
#endif
switch (internalState) {
case InternalState::IDLE: {
semaphore.acquire();
break;
}
case InternalState::FLASH_WRITE: {
result = performFlashWrite();
if (result == returnvalue::OK) {
triggerEvent(MPSOC_FLASH_WRITE_SUCCESSFUL, sequenceCount->get());
} else {
triggerEvent(MPSOC_FLASH_WRITE_FAILED, sequenceCount->get());
}
internalState = InternalState::IDLE;
break;
}
case InternalState::FLASH_READ: {
result = performFlashRead();
if (result == returnvalue::OK) {
triggerEvent(MPSOC_FLASH_READ_SUCCESSFUL, sequenceCount->get());
} else {
triggerEvent(MPSOC_FLASH_READ_FAILED, sequenceCount->get());
}
internalState = InternalState::IDLE;
break;
}
default:
sif::debug << "PlocMPSoCHelper::performOperation: Invalid state" << std::endl;
break;
}
}
}
ReturnValue_t PlocMpsocSpecialComHelperLegacy::setComIF(
DeviceCommunicationIF* communicationInterface_) {
uartComIF = dynamic_cast<SerialComIF*>(communicationInterface_);
if (uartComIF == nullptr) {
sif::warning << "PlocMPSoCHelper::initialize: Invalid uart com if" << std::endl;
return returnvalue::FAILED;
}
return returnvalue::OK;
}
void PlocMpsocSpecialComHelperLegacy::setComCookie(CookieIF* comCookie_) { comCookie = comCookie_; }
void PlocMpsocSpecialComHelperLegacy::setSequenceCount(SourceSequenceCounter* sequenceCount_) {
sequenceCount = sequenceCount_;
}
ReturnValue_t PlocMpsocSpecialComHelperLegacy::startFlashWrite(std::string obcFile,
std::string mpsocFile) {
if (internalState != InternalState::IDLE) {
return returnvalue::FAILED;
}
ReturnValue_t result = startFlashReadOrWriteBase(std::move(obcFile), std::move(mpsocFile));
if (result != returnvalue::OK) {
return result;
}
internalState = InternalState::FLASH_WRITE;
return semaphore.release();
}
ReturnValue_t PlocMpsocSpecialComHelperLegacy::startFlashRead(std::string obcFile,
std::string mpsocFile,
size_t readFileSize) {
if (internalState != InternalState::IDLE) {
return returnvalue::FAILED;
}
ReturnValue_t result = startFlashReadOrWriteBase(std::move(obcFile), std::move(mpsocFile));
if (result != returnvalue::OK) {
return result;
}
flashReadAndWrite.totalReadSize = readFileSize;
internalState = InternalState::FLASH_READ;
return semaphore.release();
}
void PlocMpsocSpecialComHelperLegacy::resetHelper() {
spParams.buf = commandBuffer;
terminate = false;
uartComIF->flushUartRxBuffer(comCookie);
}
void PlocMpsocSpecialComHelperLegacy::stopProcess() { terminate = true; }
ReturnValue_t PlocMpsocSpecialComHelperLegacy::performFlashWrite() {
ReturnValue_t result = returnvalue::OK;
std::ifstream file(flashReadAndWrite.obcFile, std::ifstream::binary);
if (file.bad()) {
return returnvalue::FAILED;
}
result = flashfopen(mpsoc::FileAccessModes::WRITE | mpsoc::FileAccessModes::OPEN_ALWAYS);
if (result != returnvalue::OK) {
return result;
}
// Set position of next character to end of file input stream
file.seekg(0, file.end);
// tellg returns position of character in input stream
size_t remainingSize = file.tellg();
size_t dataLength = 0;
size_t bytesRead = 0;
while (remainingSize > 0) {
if (terminate) {
return returnvalue::OK;
}
// The minus 4 is necessary for unknown reasons. Maybe some bug in the ILH software?
if (remainingSize > mpsoc::MAX_FLASH_WRITE_DATA_SIZE - 4) {
dataLength = mpsoc::MAX_FLASH_WRITE_DATA_SIZE - 4;
} else {
dataLength = remainingSize;
}
if (file.bad() or not file.is_open()) {
return FILE_WRITE_ERROR;
}
file.seekg(bytesRead, file.beg);
file.read(reinterpret_cast<char*>(fileBuf.data()), dataLength);
bytesRead += dataLength;
remainingSize -= dataLength;
mpsoc::TcFlashWrite tc(spParams, *sequenceCount);
result = tc.setPayload(fileBuf.data(), dataLength);
if (result != returnvalue::OK) {
return result;
}
result = tc.finishPacket();
if (result != returnvalue::OK) {
return result;
}
(*sequenceCount)++;
result = handlePacketTransmissionNoReply(tc);
if (result != returnvalue::OK) {
return result;
}
}
result = flashfclose();
if (result != returnvalue::OK) {
return result;
}
return result;
}
ReturnValue_t PlocMpsocSpecialComHelperLegacy::performFlashRead() {
std::error_code e;
std::ofstream ofile(flashReadAndWrite.obcFile, std::ios::trunc | std::ios::binary);
if (ofile.bad()) {
return returnvalue::FAILED;
}
ReturnValue_t result = flashfopen(mpsoc::FileAccessModes::READ);
if (result != returnvalue::OK) {
std::filesystem::remove(flashReadAndWrite.obcFile, e);
return result;
}
size_t readSoFar = 0;
size_t nextReadSize = mpsoc::MAX_FLASH_READ_DATA_SIZE;
while (readSoFar < flashReadAndWrite.totalReadSize) {
if (terminate) {
std::filesystem::remove(flashReadAndWrite.obcFile, e);
return returnvalue::OK;
}
nextReadSize = mpsoc::MAX_FLASH_READ_DATA_SIZE;
if (flashReadAndWrite.totalReadSize - readSoFar < mpsoc::MAX_FLASH_READ_DATA_SIZE) {
nextReadSize = flashReadAndWrite.totalReadSize - readSoFar;
}
if (ofile.bad() or not ofile.is_open()) {
std::filesystem::remove(flashReadAndWrite.obcFile, e);
return FILE_READ_ERROR;
}
mpsoc::TcFlashRead flashReadRequest(spParams, *sequenceCount);
result = flashReadRequest.setPayload(nextReadSize);
if (result != returnvalue::OK) {
std::filesystem::remove(flashReadAndWrite.obcFile, e);
return result;
}
result = flashReadRequest.finishPacket();
if (result != returnvalue::OK) {
std::filesystem::remove(flashReadAndWrite.obcFile, e);
return result;
}
(*sequenceCount)++;
result = handlePacketTransmissionFlashRead(flashReadRequest, ofile, nextReadSize);
if (result != returnvalue::OK) {
std::filesystem::remove(flashReadAndWrite.obcFile, e);
return result;
}
readSoFar += nextReadSize;
}
result = flashfclose();
if (result != returnvalue::OK) {
return result;
}
return result;
}
ReturnValue_t PlocMpsocSpecialComHelperLegacy::flashfopen(uint8_t mode) {
spParams.buf = commandBuffer;
mpsoc::FlashFopen flashFopen(spParams, *sequenceCount);
ReturnValue_t result = flashFopen.setPayload(flashReadAndWrite.mpsocFile, mode);
if (result != returnvalue::OK) {
return result;
}
result = flashFopen.finishPacket();
if (result != returnvalue::OK) {
return result;
}
(*sequenceCount)++;
result = handlePacketTransmissionNoReply(flashFopen);
if (result != returnvalue::OK) {
return result;
}
return returnvalue::OK;
}
ReturnValue_t PlocMpsocSpecialComHelperLegacy::flashfclose() {
spParams.buf = commandBuffer;
mpsoc::FlashFclose flashFclose(spParams, *sequenceCount);
ReturnValue_t result = flashFclose.finishPacket();
if (result != returnvalue::OK) {
return result;
}
(*sequenceCount)++;
result = handlePacketTransmissionNoReply(flashFclose);
if (result != returnvalue::OK) {
return result;
}
return result;
}
ReturnValue_t PlocMpsocSpecialComHelperLegacy::handlePacketTransmissionFlashRead(
mpsoc::TcFlashRead& tc, std::ofstream& ofile, size_t expectedReadLen) {
ReturnValue_t result = sendCommand(tc);
if (result != returnvalue::OK) {
return result;
}
result = handleAck();
if (result != returnvalue::OK) {
return result;
}
result = handleTmReception();
if (result != returnvalue::OK) {
return result;
}
// We have the nominal case where the flash read report appears first, or the case where we
// get an EXE failure immediately.
if (spReader.getApid() == mpsoc::apid::TM_FLASH_READ_REPORT) {
result = handleFlashReadReply(ofile, expectedReadLen);
if (result != returnvalue::OK) {
return result;
}
return handleExe();
} else if (spReader.getApid() == mpsoc::apid::EXE_FAILURE) {
handleExeFailure();
} else {
triggerEvent(MPSOC_EXE_INVALID_APID, spReader.getApid(), static_cast<uint32_t>(internalState));
sif::warning << "PLOC MPSoC: Expected execution report "
<< "but received space packet with apid " << std::hex << spReader.getApid()
<< std::endl;
}
return returnvalue::FAILED;
}
ReturnValue_t PlocMpsocSpecialComHelperLegacy::handlePacketTransmissionNoReply(ploc::SpTcBase& tc) {
ReturnValue_t result = sendCommand(tc);
if (result != returnvalue::OK) {
return result;
}
result = handleAck();
if (result != returnvalue::OK) {
return result;
}
return handleExe();
}
ReturnValue_t PlocMpsocSpecialComHelperLegacy::sendCommand(ploc::SpTcBase& tc) {
ReturnValue_t result = returnvalue::OK;
result = uartComIF->sendMessage(comCookie, tc.getFullPacket(), tc.getFullPacketLen());
if (result != returnvalue::OK) {
sif::warning << "PlocMPSoCHelper::sendCommand: Failed to send command" << std::endl;
triggerEvent(MPSOC_SENDING_COMMAND_FAILED, result, static_cast<uint32_t>(internalState));
return result;
}
return result;
}
ReturnValue_t PlocMpsocSpecialComHelperLegacy::handleAck() {
ReturnValue_t result = returnvalue::OK;
result = handleTmReception();
if (result != returnvalue::OK) {
return result;
}
result = checkReceivedTm();
if (result != returnvalue::OK) {
return result;
}
uint16_t apid = spReader.getApid();
if (apid != mpsoc::apid::ACK_SUCCESS) {
handleAckApidFailure(spReader);
return returnvalue::FAILED;
}
return returnvalue::OK;
}
void PlocMpsocSpecialComHelperLegacy::handleAckApidFailure(const ploc::SpTmReader& reader) {
uint16_t apid = reader.getApid();
if (apid == mpsoc::apid::ACK_FAILURE) {
uint16_t status = mpsoc::getStatusFromRawData(reader.getFullData());
sif::warning << "PLOC MPSoC ACK Failure: " << mpsoc::getStatusString(status) << std::endl;
triggerEvent(MPSOC_ACK_FAILURE_REPORT, static_cast<uint32_t>(internalState), status);
} else {
triggerEvent(MPSOC_ACK_INVALID_APID, apid, static_cast<uint32_t>(internalState));
sif::warning << "PlocMPSoCHelper::handleAckApidFailure: Expected acknowledgement report "
<< "but received space packet with apid " << std::hex << apid << std::endl;
}
}
ReturnValue_t PlocMpsocSpecialComHelperLegacy::handleExe() {
ReturnValue_t result = returnvalue::OK;
result = handleTmReception();
if (result != returnvalue::OK) {
return result;
}
result = checkReceivedTm();
if (result != returnvalue::OK) {
return result;
}
uint16_t apid = spReader.getApid();
if (apid == mpsoc::apid::EXE_FAILURE) {
handleExeFailure();
return returnvalue::FAILED;
} else if (apid != mpsoc::apid::EXE_SUCCESS) {
triggerEvent(MPSOC_EXE_INVALID_APID, apid, static_cast<uint32_t>(internalState));
sif::warning << "PLOC MPSoC: Expected execution report "
<< "but received space packet with apid " << std::hex << apid << std::endl;
}
return returnvalue::OK;
}
void PlocMpsocSpecialComHelperLegacy::handleExeFailure() {
uint16_t status = mpsoc::getStatusFromRawData(spReader.getFullData());
sif::warning << "PLOC MPSoC EXE Failure: " << mpsoc::getStatusString(status) << std::endl;
triggerEvent(MPSOC_EXE_FAILURE_REPORT, static_cast<uint32_t>(internalState));
}
ReturnValue_t PlocMpsocSpecialComHelperLegacy::handleTmReception() {
ReturnValue_t result = returnvalue::OK;
tmCountdown.resetTimer();
size_t readBytes = 0;
size_t currentBytes = 0;
uint32_t usleepDelay = 5;
size_t fullPacketLen = 0;
while (true) {
if (tmCountdown.hasTimedOut()) {
triggerEvent(MPSOC_READ_TIMEOUT, tmCountdown.getTimeoutMs());
return returnvalue::FAILED;
}
result = receive(tmBuf.data() + readBytes, 6, &currentBytes);
if (result != returnvalue::OK) {
return result;
}
spReader.setReadOnlyData(tmBuf.data(), tmBuf.size());
fullPacketLen = spReader.getFullPacketLen();
readBytes += currentBytes;
if (readBytes == 6) {
break;
}
usleep(usleepDelay);
if (usleepDelay < 200000) {
usleepDelay *= 4;
}
}
while (true) {
if (tmCountdown.hasTimedOut()) {
triggerEvent(MPSOC_READ_TIMEOUT, tmCountdown.getTimeoutMs());
return returnvalue::FAILED;
}
result = receive(tmBuf.data() + readBytes, fullPacketLen - readBytes, &currentBytes);
readBytes += currentBytes;
if (fullPacketLen == readBytes) {
break;
}
usleep(usleepDelay);
if (usleepDelay < 200000) {
usleepDelay *= 4;
}
}
// arrayprinter::print(tmBuf.data(), readBytes);
return result;
}
ReturnValue_t PlocMpsocSpecialComHelperLegacy::handleFlashReadReply(std::ofstream& ofile,
size_t expectedReadLen) {
ReturnValue_t result = checkReceivedTm();
if (result != returnvalue::OK) {
return result;
}
uint16_t apid = spReader.getApid();
if (apid != mpsoc::apid::TM_FLASH_READ_REPORT) {
triggerEvent(MPSOC_FLASH_READ_PACKET_ERROR, FlashReadErrorType::FLASH_READ_APID_ERROR);
sif::warning << "PLOC MPSoC Flash Read: Unexpected APID" << std::endl;
return result;
}
const uint8_t* packetData = spReader.getPacketData();
size_t deserDummy = spReader.getPacketDataLen() - mpsoc::CRC_SIZE;
uint32_t receivedReadLen = 0;
// I think this is buggy, weird stuff in the short name field.
// std::string receivedShortName = std::string(reinterpret_cast<const char*>(packetData), 12);
// if (receivedShortName != flashReadAndWrite.mpsocFile.substr(0, 11)) {
// sif::warning << "PLOC MPSoC Flash Read: Missmatch between request file name and "
// "received file name"
// << std::endl;
// triggerEvent(MPSOC_FLASH_READ_PACKET_ERROR, FlashReadErrorType::FLASH_READ_FILENAME_ERROR);
// return returnvalue::FAILED;
// }
packetData += 12;
result = SerializeAdapter::deSerialize(&receivedReadLen, &packetData, &deserDummy,
SerializeIF::Endianness::NETWORK);
if (result != returnvalue::OK) {
return result;
}
if (receivedReadLen != expectedReadLen) {
sif::warning << "PLOC MPSoC Flash Read: Missmatch between request read length and "
"received read length"
<< std::endl;
triggerEvent(MPSOC_FLASH_READ_PACKET_ERROR, FlashReadErrorType::FLASH_READ_READLEN_ERROR);
return returnvalue::FAILED;
}
ofile.write(reinterpret_cast<const char*>(packetData), receivedReadLen);
return returnvalue::OK;
}
ReturnValue_t PlocMpsocSpecialComHelperLegacy::fileCheck(std::string obcFile) {
#ifdef XIPHOS_Q7S
ReturnValue_t result = FilesystemHelper::checkPath(obcFile);
if (result != returnvalue::OK) {
return result;
}
#elif defined(TE0720_1CFA)
if (not std::filesystem::exists(obcFile)) {
sif::warning << "PlocMPSoCHelper::startFlashWrite: File " << obcFile << "does not exist"
<< std::endl;
return returnvalue::FAILED;
}
#endif
return returnvalue::OK;
}
ReturnValue_t PlocMpsocSpecialComHelperLegacy::startFlashReadOrWriteBase(std::string obcFile,
std::string mpsocFile) {
ReturnValue_t result = fileCheck(obcFile);
if (result != returnvalue::OK) {
return result;
}
flashReadAndWrite.obcFile = std::move(obcFile);
flashReadAndWrite.mpsocFile = std::move(mpsocFile);
resetHelper();
return returnvalue::OK;
}
ReturnValue_t PlocMpsocSpecialComHelperLegacy::checkReceivedTm() {
ReturnValue_t result = spReader.checkSize();
if (result != returnvalue::OK) {
sif::error << "PLOC MPSoC: Size check on received TM failed" << std::endl;
triggerEvent(MPSOC_TM_SIZE_ERROR);
return result;
}
result = spReader.checkCrc();
if (result != returnvalue::OK) {
sif::warning << "PLOC MPSoC: CRC check failed" << std::endl;
triggerEvent(MPSOC_TM_CRC_MISSMATCH, *sequenceCount);
return result;
}
uint16_t recvSeqCnt = spReader.getSequenceCount();
if (recvSeqCnt != *sequenceCount) {
triggerEvent(MPSOC_HELPER_SEQ_CNT_MISMATCH, *sequenceCount, recvSeqCnt);
*sequenceCount = recvSeqCnt;
}
// This sequence count ping pong does not make any sense but it is how the MPSoC expects it.
(*sequenceCount)++;
return returnvalue::OK;
}
ReturnValue_t PlocMpsocSpecialComHelperLegacy::receive(uint8_t* data, size_t requestBytes,
size_t* readBytes) {
ReturnValue_t result = returnvalue::OK;
uint8_t* buffer = nullptr;
result = uartComIF->requestReceiveMessage(comCookie, requestBytes);
if (result != returnvalue::OK) {
sif::warning << "PlocMPSoCHelper::receive: Failed to request reply" << std::endl;
triggerEvent(MPSOC_HELPER_REQUESTING_REPLY_FAILED, result,
static_cast<uint32_t>(static_cast<uint32_t>(internalState)));
return returnvalue::FAILED;
}
result = uartComIF->readReceivedMessage(comCookie, &buffer, readBytes);
if (result != returnvalue::OK) {
sif::warning << "PlocMPSoCHelper::receive: Failed to read received message" << std::endl;
triggerEvent(MPSOC_HELPER_READING_REPLY_FAILED, result, static_cast<uint32_t>(internalState));
return returnvalue::FAILED;
}
if (*readBytes > 0) {
std::memcpy(data, buffer, *readBytes);
}
return result;
}

View File

@ -1,7 +1,6 @@
pipeline { pipeline {
environment { environment {
BUILDDIR_Q7S = 'build_q7s_fm' BUILDDIR_Q7 = 'build_q7'
BUILDDIR_Q7S_EM = 'build_q7s_em'
BUILDDIR_LINUX = 'build_linux' BUILDDIR_LINUX = 'build_linux'
} }
agent { agent {
@ -13,24 +12,15 @@ pipeline {
stages { stages {
stage('Clean') { stage('Clean') {
steps { steps {
sh 'rm -rf $BUILDDIR_Q7S' sh 'rm -rf $BUILDDIR_Q7'
sh 'rm -rf $BUILDDIR_Q7S_EM'
sh 'rm -rf $BUILDDIR_LINUX' sh 'rm -rf $BUILDDIR_LINUX'
} }
} }
stage('Build Q7S') { stage('Build Q7S') {
steps { steps {
dir(BUILDDIR_Q7S) { dir(BUILDDIR_Q7) {
sh 'cmake -DTGT_BSP="arm/q7s" -DCMAKE_BUILD_TYPE=Debug ..' sh 'cmake -DTGT_BSP="arm/q7s" -DCMAKE_BUILD_TYPE=Debug ..'
sh 'cmake --build . -j8' sh 'cmake --build . -j4'
}
}
}
stage('Build Q7S EM') {
steps {
dir(BUILDDIR_Q7S_EM) {
sh 'cmake -DTGT_BSP="arm/q7s" -DEIVE_Q7S_EM=ON -DCMAKE_BUILD_TYPE=Debug ..'
sh 'cmake --build . -j8'
} }
} }
} }
@ -38,7 +28,7 @@ pipeline {
steps { steps {
dir(BUILDDIR_LINUX) { dir(BUILDDIR_LINUX) {
sh 'cmake ..' sh 'cmake ..'
sh 'cmake --build . -j8' sh 'cmake --build . -j4'
sh './eive-unittest' sh './eive-unittest'
} }
} }

View File

@ -2,7 +2,7 @@
#include <fsfw/objectmanager/ObjectManager.h> #include <fsfw/objectmanager/ObjectManager.h>
#include <fsfw/objectmanager/ObjectManagerIF.h> #include <fsfw/objectmanager/ObjectManagerIF.h>
#include <fsfw/returnvalues/returnvalue.h> #include <fsfw/returnvalues/HasReturnvaluesIF.h>
#include <fsfw/serviceinterface/ServiceInterface.h> #include <fsfw/serviceinterface/ServiceInterface.h>
#include <fsfw/tasks/FixedTimeslotTaskIF.h> #include <fsfw/tasks/FixedTimeslotTaskIF.h>
#include <fsfw/tasks/PeriodicTaskIF.h> #include <fsfw/tasks/PeriodicTaskIF.h>
@ -40,7 +40,7 @@ void initmission::initMission() {
void initmission::initTasks() { void initmission::initTasks() {
TaskFactory* factory = TaskFactory::instance(); TaskFactory* factory = TaskFactory::instance();
ReturnValue_t result = returnvalue::OK; ReturnValue_t result = HasReturnvaluesIF::RETURN_OK;
if (factory == nullptr) { if (factory == nullptr) {
/* Should never happen ! */ /* Should never happen ! */
return; return;
@ -55,28 +55,28 @@ void initmission::initTasks() {
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 != returnvalue::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 != returnvalue::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 != returnvalue::OK) { if (result != HasReturnvaluesIF::RETURN_OK) {
sif::error << "Object add component failed" << std::endl; sif::error << "Object add component failed" << std::endl;
} }
PeriodicTaskIF* tmtcBridgeTask = factory->createPeriodicTask( PeriodicTaskIF* tmtcBridgeTask = factory->createPeriodicTask(
"TMTC_BRIDGE", 50, PeriodicTaskIF::MINIMUM_STACK_SIZE, 0.2, missedDeadlineFunc); "TMTC_BRIDGE", 50, PeriodicTaskIF::MINIMUM_STACK_SIZE, 0.2, missedDeadlineFunc);
result = tmtcBridgeTask->addComponent(objects::TMTC_BRIDGE); result = tmtcBridgeTask->addComponent(objects::TMTC_BRIDGE);
if (result != returnvalue::OK) { if (result != HasReturnvaluesIF::RETURN_OK) {
sif::error << "Add component TMTC Bridge failed" << std::endl; sif::error << "Add component TMTC Bridge failed" << std::endl;
} }
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 != returnvalue::OK) { if (result != HasReturnvaluesIF::RETURN_OK) {
sif::error << "Add component TMTC Polling failed" << std::endl; sif::error << "Add component TMTC Polling failed" << std::endl;
} }
@ -88,7 +88,7 @@ void initmission::initTasks() {
FixedTimeslotTaskIF* pst = factory->createFixedTimeslotTask( FixedTimeslotTaskIF* pst = factory->createFixedTimeslotTask(
"STAR_TRACKER_PST", 70, PeriodicTaskIF::MINIMUM_STACK_SIZE * 4, 0.5, missedDeadlineFunc); "STAR_TRACKER_PST", 70, PeriodicTaskIF::MINIMUM_STACK_SIZE * 4, 0.5, missedDeadlineFunc);
result = pst::pstUart(pst); result = pst::pstUart(pst);
if (result != returnvalue::OK) { if (result != HasReturnvaluesIF::RETURN_OK) {
sif::error << "InitMission::initTasks: Creating PST failed!" << std::endl; sif::error << "InitMission::initTasks: Creating PST failed!" << std::endl;
} }
pstTasks.push_back(pst); pstTasks.push_back(pst);
@ -96,7 +96,7 @@ void initmission::initTasks() {
PeriodicTaskIF* strHelperTask = factory->createPeriodicTask( PeriodicTaskIF* strHelperTask = factory->createPeriodicTask(
"STR_HELPER", 20, PeriodicTaskIF::MINIMUM_STACK_SIZE, 0.2, missedDeadlineFunc); "STR_HELPER", 20, PeriodicTaskIF::MINIMUM_STACK_SIZE, 0.2, missedDeadlineFunc);
result = strHelperTask->addComponent(objects::STR_HELPER); result = strHelperTask->addComponent(objects::STR_HELPER);
if (result != returnvalue::OK) { if (result != HasReturnvaluesIF::RETURN_OK) {
initmission::printAddObjectError("STR_HELPER", objects::STR_HELPER); initmission::printAddObjectError("STR_HELPER", objects::STR_HELPER);
} }
pstTasks.push_back(strHelperTask); pstTasks.push_back(strHelperTask);
@ -125,11 +125,11 @@ void initmission::initTasks() {
void initmission::createPusTasks(TaskFactory& factory, void initmission::createPusTasks(TaskFactory& factory,
TaskDeadlineMissedFunction missedDeadlineFunc, TaskDeadlineMissedFunction missedDeadlineFunc,
std::vector<PeriodicTaskIF*>& taskVec) { std::vector<PeriodicTaskIF*>& taskVec) {
ReturnValue_t result = returnvalue::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 != returnvalue::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);
@ -137,11 +137,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 != returnvalue::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 != returnvalue::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);
@ -149,11 +149,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 != returnvalue::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 != returnvalue::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);
@ -161,19 +161,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 != returnvalue::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 != returnvalue::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 != returnvalue::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 != returnvalue::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);
@ -181,11 +181,11 @@ 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 != returnvalue::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 != returnvalue::OK) { if (result != HasReturnvaluesIF::RETURN_OK) {
initmission::printAddObjectError("INT_ERR_RPRT", objects::INTERNAL_ERROR_REPORTER); initmission::printAddObjectError("INT_ERR_RPRT", objects::INTERNAL_ERROR_REPORTER);
} }
taskVec.push_back(pusLowPrio); taskVec.push_back(pusLowPrio);

View File

@ -1,8 +1,8 @@
#include "ObjectFactory.h" #include "ObjectFactory.h"
#include <devConf.h> #include <devConf.h>
#include <fsfw_hal/linux/serial/SerialComIF.h> #include <fsfw_hal/linux/uart/UartComIF.h>
#include <fsfw_hal/linux/serial/SerialCookie.h> #include <fsfw_hal/linux/uart/UartCookie.h>
#include "OBSWConfig.h" #include "OBSWConfig.h"
#include "busConf.h" #include "busConf.h"
@ -39,7 +39,7 @@ void ObjectFactory::produce(void* args) {
UartCookie* starTrackerCookie = UartCookie* starTrackerCookie =
new UartCookie(objects::STAR_TRACKER, egse::STAR_TRACKER_UART, UartModes::NON_CANONICAL, new UartCookie(objects::STAR_TRACKER, egse::STAR_TRACKER_UART, UartModes::NON_CANONICAL,
uart::STAR_TRACKER_BAUD, startracker::MAX_FRAME_SIZE * 2 + 2); uart::STAR_TRACKER_BAUD, startracker::MAX_FRAME_SIZE * 2 + 2);
newSerialComIF(objects::UART_COM_IF); new UartComIF(objects::UART_COM_IF);
starTrackerCookie->setNoFixedSizeReply(); starTrackerCookie->setNoFixedSizeReply();
StrHelper* strHelper = new StrHelper(objects::STR_HELPER); StrHelper* strHelper = new StrHelper(objects::STR_HELPER);
StarTrackerHandler* starTrackerHandler = new StarTrackerHandler( StarTrackerHandler* starTrackerHandler = new StarTrackerHandler(

View File

@ -1,4 +1,4 @@
target_sources(${OBSW_NAME} PUBLIC scheduling.cpp main.cpp objectFactory.cpp) target_sources(${OBSW_NAME} PUBLIC InitMission.cpp main.cpp ObjectFactory.cpp)
add_subdirectory(fsfwconfig) add_subdirectory(fsfwconfig)
add_subdirectory(boardconfig) add_subdirectory(boardconfig)

View File

@ -14,7 +14,7 @@ RUN set -ex; \
rm -rf build-hosted; \ rm -rf build-hosted; \
mkdir build-hosted; \ mkdir build-hosted; \
cd build-hosted; \ cd build-hosted; \
cmake -DCMAKE_BUILD_TYPE=Release -DOSAL_FSFW=host ..; cmake -DCMAKE_BUILD_TYPE=Release -DOS_FSFW=linux ..;
ENTRYPOINT ["cmake", "--build", "build-hosted"] ENTRYPOINT ["cmake", "--build", "build-hosted"]
CMD ["-j"] CMD ["-j"]

195
bsp_hosted/InitMission.cpp Normal file
View File

@ -0,0 +1,195 @@
#include "InitMission.h"
#include <OBSWConfig.h>
#include <bsp_hosted/fsfwconfig/pollingsequence/DummyPst.h>
#include <fsfw/objectmanager/ObjectManager.h>
#include <fsfw/objectmanager/ObjectManagerIF.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 <iostream>
#include "ObjectFactory.h"
#ifdef LINUX
ServiceInterfaceStream sif::debug("DEBUG");
ServiceInterfaceStream sif::info("INFO");
ServiceInterfaceStream sif::warning("WARNING");
ServiceInterfaceStream sif::error("ERROR", false, false, true);
#else
ServiceInterfaceStream sif::debug("DEBUG", true);
ServiceInterfaceStream sif::info("INFO", true);
ServiceInterfaceStream sif::warning("WARNING", true);
ServiceInterfaceStream sif::error("ERROR", true, false, true);
#endif
ObjectManagerIF* objectManager = nullptr;
void initmission::initMission() {
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();
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);
ReturnValue_t 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;
}
/* UDP bridge */
PeriodicTaskIF* tmtcBridgeTask = factory->createPeriodicTask(
"TMTC_UNIX_BRIDGE", 50, PeriodicTaskIF::MINIMUM_STACK_SIZE, 0.2, missedDeadlineFunc);
result = tmtcBridgeTask->addComponent(objects::TMTC_BRIDGE);
if (result != HasReturnvaluesIF::RETURN_OK) {
sif::error << "Add component UDP Unix Bridge failed" << std::endl;
}
PeriodicTaskIF* tmtcPollingTask = factory->createPeriodicTask(
"UDP_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 UDP Polling failed" << std::endl;
}
/* PUS Services */
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;
}
PeriodicTaskIF* eventHandling = factory->createPeriodicTask(
"EVENTS", 60, PeriodicTaskIF::MINIMUM_STACK_SIZE, 0.200, missedDeadlineFunc);
result = eventHandling->addComponent(objects::EVENT_MANAGER);
if (result != HasReturnvaluesIF::RETURN_OK) {
initmission::printAddObjectError("EVENT_MNGR", objects::EVENT_MANAGER);
}
result = eventHandling->addComponent(objects::PUS_SERVICE_5_EVENT_REPORTING);
if (result != HasReturnvaluesIF::RETURN_OK) {
initmission::printAddObjectError("PUS5", objects::PUS_SERVICE_5_EVENT_REPORTING);
}
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);
}
result = pusHighPrio->addComponent(objects::PUS_SERVICE_3_HOUSEKEEPING);
if (result != HasReturnvaluesIF::RETURN_OK) {
initmission::printAddObjectError("PUS3", objects::PUS_SERVICE_3_HOUSEKEEPING);
}
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);
}
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);
}
PeriodicTaskIF* thermalTask = factory->createPeriodicTask(
"THERMAL_CTL_TASK", 40, PeriodicTaskIF::MINIMUM_STACK_SIZE, 1.0, missedDeadlineFunc);
result = thermalTask->addComponent(objects::RTD_0_IC3_PLOC_HEATSPREADER);
if (result != HasReturnvaluesIF::RETURN_OK) {
initmission::printAddObjectError("RTD_0_dummy", objects::RTD_0_IC3_PLOC_HEATSPREADER);
}
result = thermalTask->addComponent(objects::SUS_0_N_LOC_XFYFZM_PT_XF);
if (result != HasReturnvaluesIF::RETURN_OK) {
initmission::printAddObjectError("SUS_0_dummy", objects::SUS_0_N_LOC_XFYFZM_PT_XF);
}
result = thermalTask->addComponent(objects::CORE_CONTROLLER);
if (result != HasReturnvaluesIF::RETURN_OK) {
initmission::printAddObjectError("Core controller dummy", objects::CORE_CONTROLLER);
}
result = thermalTask->addComponent(objects::THERMAL_CONTROLLER);
if (result != HasReturnvaluesIF::RETURN_OK) {
initmission::printAddObjectError("THERMAL_CONTROLLER", objects::THERMAL_CONTROLLER);
}
FixedTimeslotTaskIF* pstTask = factory->createFixedTimeslotTask(
"DUMMY_PST", 75, PeriodicTaskIF::MINIMUM_STACK_SIZE * 4, 0.5, missedDeadlineFunc);
result = dummy_pst::pst(pstTask);
if (result != HasReturnvaluesIF::RETURN_OK) {
sif::error << "Failed to add dummy pst to fixed timeslot task" << std::endl;
}
#if OBSW_ADD_TEST_CODE == 1
result = testTask->addComponent(objects::TEST_TASK);
if (result != HasReturnvaluesIF::RETURN_OK) {
initmission::printAddObjectError("TEST_TASK", objects::TEST_TASK);
}
#endif /* OBSW_ADD_TEST_CODE == 1 */
sif::info << "Starting tasks.." << std::endl;
tmTcDistributor->startTask();
tmtcBridgeTask->startTask();
tmtcPollingTask->startTask();
pusVerification->startTask();
eventHandling->startTask();
pusHighPrio->startTask();
pusMedPrio->startTask();
pusLowPrio->startTask();
pstTask->startTask();
thermalTask->startTask();
#if OBSW_ADD_TEST_CODE == 1
testTask->startTask();
#endif /* OBSW_ADD_TEST_CODE == 1 */
sif::info << "Tasks started.." << std::endl;
}

9
bsp_hosted/InitMission.h Normal file
View File

@ -0,0 +1,9 @@
#ifndef BSP_LINUX_INITMISSION_H_
#define BSP_LINUX_INITMISSION_H_
namespace initmission {
void initMission();
void initTasks();
}; // namespace initmission
#endif /* BSP_LINUX_INITMISSION_H_ */

View File

@ -7,6 +7,7 @@
#define FSFWCONFIG_OBSWCONFIG_H_ #define FSFWCONFIG_OBSWCONFIG_H_
#include "commonConfig.h" #include "commonConfig.h"
#include "OBSWVersion.h"
/*******************************************************************/ /*******************************************************************/
/** All of the following flags should be enabled for mission code */ /** All of the following flags should be enabled for mission code */
@ -23,7 +24,6 @@
#define OBSW_ADD_GPS_0 0 #define OBSW_ADD_GPS_0 0
#define OBSW_ADD_GPS_1 0 #define OBSW_ADD_GPS_1 0
#define OBSW_ADD_RW 0 #define OBSW_ADD_RW 0
#define OBSW_DEBUG_TMP1075 0
#define OBSW_ADD_BPX_BATTERY_HANDLER 0 #define OBSW_ADD_BPX_BATTERY_HANDLER 0
#define OBSW_ADD_RTD_DEVICES 0 #define OBSW_ADD_RTD_DEVICES 0
#define OBSW_ADD_PL_PCDU 0 #define OBSW_ADD_PL_PCDU 0
@ -48,7 +48,6 @@
#define OBSW_SWITCH_TO_NORMAL_MODE_AFTER_STARTUP 1 #define OBSW_SWITCH_TO_NORMAL_MODE_AFTER_STARTUP 1
#define OBSW_PRINT_MISSED_DEADLINES 1 #define OBSW_PRINT_MISSED_DEADLINES 1
#define OBSW_MPSOC_JTAG_BOOT 0
#define OBSW_SYRLINKS_SIMULATED 1 #define OBSW_SYRLINKS_SIMULATED 1
#define OBSW_ADD_TEST_CODE 0 #define OBSW_ADD_TEST_CODE 0
#define OBSW_ADD_TEST_TASK 0 #define OBSW_ADD_TEST_TASK 0
@ -101,10 +100,6 @@
/*******************************************************************/ /*******************************************************************/
/** CMake Defines */ /** CMake Defines */
/*******************************************************************/ /*******************************************************************/
#define OBSW_ADD_TMTC_UDP_SERVER 0
#define OBSW_ADD_TMTC_TCP_SERVER 1
#cmakedefine EIVE_BUILD_GPSD_GPS_HANDLER #cmakedefine EIVE_BUILD_GPSD_GPS_HANDLER
#cmakedefine LIBGPS_VERSION_MAJOR @LIBGPS_VERSION_MAJOR@ #cmakedefine LIBGPS_VERSION_MAJOR @LIBGPS_VERSION_MAJOR@

View File

@ -0,0 +1,93 @@
#include "ObjectFactory.h"
#include <fsfw/tmtcservices/CommandingServiceBase.h>
#include <fsfw/tmtcservices/PusServiceBase.h>
#include <mission/controller/ThermalController.h>
#include <mission/core/GenericFactory.h>
#include <mission/tmtc/TmFunnel.h>
#include <objects/systemObjectList.h>
#include <tmtc/apid.h>
#include <tmtc/pusIds.h>
#include "OBSWConfig.h"
#include "fsfw_tests/integration/task/TestTask.h"
#if OBSW_USE_TMTC_TCP_BRIDGE == 0
#include "fsfw/osal/common/UdpTcPollingTask.h"
#include "fsfw/osal/common/UdpTmTcBridge.h"
#else
#include "fsfw/osal/common/TcpTmTcBridge.h"
#include "fsfw/osal/common/TcpTmTcServer.h"
#endif
#include <fsfw/tmtcpacket/pus/tm.h>
#if OBSW_ADD_TEST_CODE == 1
#include <test/testtasks/TestTask.h>
#endif
#include <dummies/AcuDummy.h>
#include <dummies/BpxDummy.h>
#include <dummies/ComCookieDummy.h>
#include <dummies/ComIFDummy.h>
#include <dummies/CoreControllerDummy.h>
#include <dummies/GyroAdisDummy.h>
#include <dummies/GyroL3GD20Dummy.h>
#include <dummies/ImtqDummy.h>
#include <dummies/MgmLIS3MDLDummy.h>
#include <dummies/P60DockDummy.h>
#include <dummies/PduDummy.h>
#include <dummies/PlPcduDummy.h>
#include <dummies/RwDummy.h>
#include <dummies/StarTrackerDummy.h>
#include <dummies/SusDummy.h>
#include <dummies/SyrlinksDummy.h>
#include <dummies/TemperatureSensorsDummy.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;
// No storage object for now.
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();
new ComIFDummy(objects::DUMMY_COM_IF);
ComCookieDummy* comCookieDummy = new ComCookieDummy();
new BpxDummy(objects::BPX_BATT_HANDLER, objects::DUMMY_COM_IF, comCookieDummy);
new CoreControllerDummy(objects::CORE_CONTROLLER);
new RwDummy(objects::RW1, objects::DUMMY_COM_IF, comCookieDummy);
new RwDummy(objects::RW2, objects::DUMMY_COM_IF, comCookieDummy);
new RwDummy(objects::RW3, objects::DUMMY_COM_IF, comCookieDummy);
new RwDummy(objects::RW4, objects::DUMMY_COM_IF, comCookieDummy);
new StarTrackerDummy(objects::STAR_TRACKER, objects::DUMMY_COM_IF, comCookieDummy);
new SyrlinksDummy(objects::SYRLINKS_HK_HANDLER, objects::DUMMY_COM_IF, comCookieDummy);
new ImtqDummy(objects::IMTQ_HANDLER, objects::DUMMY_COM_IF, comCookieDummy);
new AcuDummy(objects::ACU_HANDLER, objects::DUMMY_COM_IF, comCookieDummy);
new PduDummy(objects::PDU1_HANDLER, objects::DUMMY_COM_IF, comCookieDummy);
new PduDummy(objects::PDU2_HANDLER, objects::DUMMY_COM_IF, comCookieDummy);
new P60DockDummy(objects::P60DOCK_HANDLER, objects::DUMMY_COM_IF, comCookieDummy);
new GyroAdisDummy(objects::GYRO_0_ADIS_HANDLER, objects::DUMMY_COM_IF, comCookieDummy);
new GyroL3GD20Dummy(objects::GYRO_1_L3G_HANDLER, objects::DUMMY_COM_IF, comCookieDummy);
new GyroAdisDummy(objects::GYRO_2_ADIS_HANDLER, objects::DUMMY_COM_IF, comCookieDummy);
new GyroL3GD20Dummy(objects::GYRO_3_L3G_HANDLER, objects::DUMMY_COM_IF, comCookieDummy);
new MgmLIS3MDLDummy(objects::MGM_0_LIS3_HANDLER, objects::DUMMY_COM_IF, comCookieDummy);
new MgmLIS3MDLDummy(objects::MGM_2_LIS3_HANDLER, objects::DUMMY_COM_IF, comCookieDummy);
new PlPcduDummy(objects::PLPCDU_HANDLER, objects::DUMMY_COM_IF, comCookieDummy);
new TemperatureSensorsDummy();
new SusDummy();
new ThermalController(objects::THERMAL_CONTROLLER, objects::NO_OBJECT);
// new TestTask(objects::TEST_TASK);
}

View File

@ -129,7 +129,9 @@ ArduinoComIF::~ArduinoComIF() {
CloseHandle(hCom); CloseHandle(hCom);
#endif #endif
} }
ReturnValue_t ArduinoComIF::initializeInterface(CookieIF *cookie) { return returnvalue::OK; } ReturnValue_t ArduinoComIF::initializeInterface(CookieIF *cookie) {
return HasReturnvaluesIF::RETURN_OK;
}
ReturnValue_t ArduinoComIF::sendMessage(CookieIF *cookie, const uint8_t *data, size_t len) { ReturnValue_t ArduinoComIF::sendMessage(CookieIF *cookie, const uint8_t *data, size_t len) {
ArduinoCookie *arduinoCookie = dynamic_cast<ArduinoCookie *>(cookie); ArduinoCookie *arduinoCookie = dynamic_cast<ArduinoCookie *>(cookie);
@ -140,10 +142,10 @@ ReturnValue_t ArduinoComIF::sendMessage(CookieIF *cookie, const uint8_t *data, s
return sendMessage(arduinoCookie->command, arduinoCookie->address, data, len); return sendMessage(arduinoCookie->command, arduinoCookie->address, data, len);
} }
ReturnValue_t ArduinoComIF::getSendSuccess(CookieIF *cookie) { return returnvalue::OK; } ReturnValue_t ArduinoComIF::getSendSuccess(CookieIF *cookie) { return RETURN_OK; }
ReturnValue_t ArduinoComIF::requestReceiveMessage(CookieIF *cookie, size_t requestLen) { ReturnValue_t ArduinoComIF::requestReceiveMessage(CookieIF *cookie, size_t requestLen) {
return returnvalue::OK; return RETURN_OK;
} }
ReturnValue_t ArduinoComIF::readReceivedMessage(CookieIF *cookie, uint8_t **buffer, size_t *size) { ReturnValue_t ArduinoComIF::readReceivedMessage(CookieIF *cookie, uint8_t **buffer, size_t *size) {
@ -156,7 +158,7 @@ ReturnValue_t ArduinoComIF::readReceivedMessage(CookieIF *cookie, uint8_t **buff
*buffer = arduinoCookie->replyBuffer.data(); *buffer = arduinoCookie->replyBuffer.data();
*size = arduinoCookie->receivedDataLen; *size = arduinoCookie->receivedDataLen;
return returnvalue::OK; return HasReturnvaluesIF::RETURN_OK;
} }
ReturnValue_t ArduinoComIF::sendMessage(uint8_t command, uint8_t address, const uint8_t *data, ReturnValue_t ArduinoComIF::sendMessage(uint8_t command, uint8_t address, const uint8_t *data,
@ -176,14 +178,14 @@ ReturnValue_t ArduinoComIF::sendMessage(uint8_t command, uint8_t address, const
ReturnValue_t result = ReturnValue_t result =
DleEncoder::encode(&command, 1, currentPosition, remainingLen, &encodedLen, false); DleEncoder::encode(&command, 1, currentPosition, remainingLen, &encodedLen, false);
if (result != returnvalue::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, &encodedLen, false); result = DleEncoder::encode(&address, 1, currentPosition, remainingLen, &encodedLen, false);
if (result != returnvalue::OK) { if (result != RETURN_OK) {
return result; return result;
} }
currentPosition += encodedLen; currentPosition += encodedLen;
@ -197,7 +199,7 @@ ReturnValue_t ArduinoComIF::sendMessage(uint8_t command, uint8_t address, const
result = result =
DleEncoder::encode(temporaryBuffer, 2, currentPosition, remainingLen, &encodedLen, false); DleEncoder::encode(temporaryBuffer, 2, currentPosition, remainingLen, &encodedLen, false);
if (result != returnvalue::OK) { if (result != RETURN_OK) {
return result; return result;
} }
currentPosition += encodedLen; currentPosition += encodedLen;
@ -205,7 +207,7 @@ ReturnValue_t ArduinoComIF::sendMessage(uint8_t command, uint8_t address, const
// encoding the actual data // encoding the actual data
result = DleEncoder::encode(data, dataLen, currentPosition, remainingLen, &encodedLen, false); result = DleEncoder::encode(data, dataLen, currentPosition, remainingLen, &encodedLen, false);
if (result != returnvalue::OK) { if (result != RETURN_OK) {
return result; return result;
} }
currentPosition += encodedLen; currentPosition += encodedLen;
@ -222,7 +224,7 @@ ReturnValue_t ArduinoComIF::sendMessage(uint8_t command, uint8_t address, const
result = result =
DleEncoder::encode(temporaryBuffer, 2, currentPosition, remainingLen, &encodedLen, false); DleEncoder::encode(temporaryBuffer, 2, currentPosition, remainingLen, &encodedLen, false);
if (result != returnvalue::OK) { if (result != RETURN_OK) {
return result; return result;
} }
currentPosition += encodedLen; currentPosition += encodedLen;
@ -239,16 +241,16 @@ ReturnValue_t ArduinoComIF::sendMessage(uint8_t command, uint8_t address, const
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 returnvalue::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 returnvalue::FAILED; return RETURN_FAILED;
} }
return returnvalue::OK; return RETURN_OK;
#elif WIN32 #elif WIN32
return returnvalue::OK; return HasReturnvaluesIF::RETURN_OK;
#endif #endif
} }
@ -295,7 +297,7 @@ void ArduinoComIF::handleSerialPortRx() {
packet, sizeof(packet), &packetLen); packet, sizeof(packet), &packetLen);
size_t toDelete = firstSTXinRawData; size_t toDelete = firstSTXinRawData;
if (result == returnvalue::OK) { if (result == HasReturnvaluesIF::RETURN_OK) {
handlePacket(packet, packetLen); handlePacket(packet, packetLen);
// after handling the packet, we can delete it from the raw stream, // after handling the packet, we can delete it from the raw stream,

View File

@ -5,7 +5,7 @@
#include <fsfw/container/SimpleRingBuffer.h> #include <fsfw/container/SimpleRingBuffer.h>
#include <fsfw/devicehandlers/DeviceCommunicationIF.h> #include <fsfw/devicehandlers/DeviceCommunicationIF.h>
#include <fsfw/objectmanager/SystemObject.h> #include <fsfw/objectmanager/SystemObject.h>
#include <fsfw/returnvalues/returnvalue.h> #include <fsfw/returnvalues/HasReturnvaluesIF.h>
#include <cstdint> #include <cstdint>
#include <map> #include <map>

View File

@ -50,8 +50,6 @@
//! If set to 1 the binary needs "cap_sys_nice=eip" privileges to run //! If set to 1 the binary needs "cap_sys_nice=eip" privileges to run
#define FSFW_USE_REALTIME_FOR_LINUX 0 #define FSFW_USE_REALTIME_FOR_LINUX 0
#define FSFW_UDP_SEND_WIRETAPPING_ENABLED 0
namespace fsfwconfig { namespace fsfwconfig {
//! Default timestamp size. The default timestamp will be an seven byte CDC short timestamp. //! Default timestamp size. The default timestamp will be an seven byte CDC short timestamp.

View File

@ -16,7 +16,7 @@
debugging. */ debugging. */
#define OBSW_VEBOSE_LEVEL 1 #define OBSW_VEBOSE_LEVEL 1
#define OBSW_ADD_CCSDS_IP_CORES 0 #define OBSW_USE_CCSDS_IP_CORE 0
// Set to 1 if all telemetry should be sent to the PTME IP Core // Set to 1 if all telemetry should be sent to the PTME IP Core
#define OBSW_TM_TO_PTME 0 #define OBSW_TM_TO_PTME 0
// Set to 1 if telecommands are received via the PDEC IP Core // Set to 1 if telecommands are received via the PDEC IP Core

View File

@ -1,9 +1,9 @@
#ifndef CONFIG_EVENTS_SUBSYSTEMIDRANGES_H_ #ifndef CONFIG_EVENTS_SUBSYSTEMIDRANGES_H_
#define CONFIG_EVENTS_SUBSYSTEMIDRANGES_H_ #define CONFIG_EVENTS_SUBSYSTEMIDRANGES_H_
#include <cstdint> #include <common/config/commonSubsystemIds.h>
#include "eive/eventSubsystemIds.h" #include <cstdint>
/** /**
* These IDs are part of the ID for an event thrown by a subsystem. * These IDs are part of the ID for an event thrown by a subsystem.

View File

@ -1,7 +1,7 @@
/** /**
* @brief Auto-generated event translation file. Contains 325 translations. * @brief Auto-generated event translation file. Contains 83 translations.
* @details * @details
* Generated on: 2024-05-06 13:47:38 * Generated on: 2021-05-17 19:49:55
*/ */
#include "translateEvents.h" #include "translateEvents.h"
@ -34,12 +34,11 @@ const char *DEVICE_UNREQUESTED_REPLY_STRING = "DEVICE_UNREQUESTED_REPLY";
const char *INVALID_DEVICE_COMMAND_STRING = "INVALID_DEVICE_COMMAND"; const char *INVALID_DEVICE_COMMAND_STRING = "INVALID_DEVICE_COMMAND";
const char *MONITORING_LIMIT_EXCEEDED_STRING = "MONITORING_LIMIT_EXCEEDED"; const char *MONITORING_LIMIT_EXCEEDED_STRING = "MONITORING_LIMIT_EXCEEDED";
const char *MONITORING_AMBIGUOUS_STRING = "MONITORING_AMBIGUOUS"; const char *MONITORING_AMBIGUOUS_STRING = "MONITORING_AMBIGUOUS";
const char *DEVICE_WANTS_HARD_REBOOT_STRING = "DEVICE_WANTS_HARD_REBOOT";
const char *SWITCH_WENT_OFF_STRING = "SWITCH_WENT_OFF";
const char *FUSE_CURRENT_HIGH_STRING = "FUSE_CURRENT_HIGH"; const char *FUSE_CURRENT_HIGH_STRING = "FUSE_CURRENT_HIGH";
const char *FUSE_WENT_OFF_STRING = "FUSE_WENT_OFF"; const char *FUSE_WENT_OFF_STRING = "FUSE_WENT_OFF";
const char *POWER_ABOVE_HIGH_LIMIT_STRING = "POWER_ABOVE_HIGH_LIMIT"; const char *POWER_ABOVE_HIGH_LIMIT_STRING = "POWER_ABOVE_HIGH_LIMIT";
const char *POWER_BELOW_LOW_LIMIT_STRING = "POWER_BELOW_LOW_LIMIT"; const char *POWER_BELOW_LOW_LIMIT_STRING = "POWER_BELOW_LOW_LIMIT";
const char *SWITCH_WENT_OFF_STRING = "SWITCH_WENT_OFF";
const char *HEATER_ON_STRING = "HEATER_ON"; const char *HEATER_ON_STRING = "HEATER_ON";
const char *HEATER_OFF_STRING = "HEATER_OFF"; const char *HEATER_OFF_STRING = "HEATER_OFF";
const char *HEATER_TIMEOUT_STRING = "HEATER_TIMEOUT"; const char *HEATER_TIMEOUT_STRING = "HEATER_TIMEOUT";
@ -60,6 +59,7 @@ const char *MONITOR_CHANGED_STATE_STRING = "MONITOR_CHANGED_STATE";
const char *VALUE_BELOW_LOW_LIMIT_STRING = "VALUE_BELOW_LOW_LIMIT"; const char *VALUE_BELOW_LOW_LIMIT_STRING = "VALUE_BELOW_LOW_LIMIT";
const char *VALUE_ABOVE_HIGH_LIMIT_STRING = "VALUE_ABOVE_HIGH_LIMIT"; const char *VALUE_ABOVE_HIGH_LIMIT_STRING = "VALUE_ABOVE_HIGH_LIMIT";
const char *VALUE_OUT_OF_RANGE_STRING = "VALUE_OUT_OF_RANGE"; const char *VALUE_OUT_OF_RANGE_STRING = "VALUE_OUT_OF_RANGE";
const char *SWITCHING_TM_FAILED_STRING = "SWITCHING_TM_FAILED";
const char *CHANGING_MODE_STRING = "CHANGING_MODE"; const char *CHANGING_MODE_STRING = "CHANGING_MODE";
const char *MODE_INFO_STRING = "MODE_INFO"; const char *MODE_INFO_STRING = "MODE_INFO";
const char *FALLBACK_FAILED_STRING = "FALLBACK_FAILED"; const char *FALLBACK_FAILED_STRING = "FALLBACK_FAILED";
@ -75,264 +75,22 @@ const char *OVERWRITING_HEALTH_STRING = "OVERWRITING_HEALTH";
const char *TRYING_RECOVERY_STRING = "TRYING_RECOVERY"; const char *TRYING_RECOVERY_STRING = "TRYING_RECOVERY";
const char *RECOVERY_STEP_STRING = "RECOVERY_STEP"; const char *RECOVERY_STEP_STRING = "RECOVERY_STEP";
const char *RECOVERY_DONE_STRING = "RECOVERY_DONE"; const char *RECOVERY_DONE_STRING = "RECOVERY_DONE";
const char *HANDLE_PACKET_FAILED_STRING = "HANDLE_PACKET_FAILED";
const char *RF_AVAILABLE_STRING = "RF_AVAILABLE"; const char *RF_AVAILABLE_STRING = "RF_AVAILABLE";
const char *RF_LOST_STRING = "RF_LOST"; const char *RF_LOST_STRING = "RF_LOST";
const char *BIT_LOCK_STRING = "BIT_LOCK"; const char *BIT_LOCK_STRING = "BIT_LOCK";
const char *BIT_LOCK_LOST_STRING = "BIT_LOCK_LOST"; const char *BIT_LOCK_LOST_STRING = "BIT_LOCK_LOST";
const char *FRAME_PROCESSING_FAILED_STRING = "FRAME_PROCESSING_FAILED"; const char *FRAME_PROCESSING_FAILED_STRING = "FRAME_PROCESSING_FAILED";
const char *CLOCK_SET_STRING = "CLOCK_SET"; const char *CLOCK_SET_STRING = "CLOCK_SET";
const char *CLOCK_DUMP_LEGACY_STRING = "CLOCK_DUMP_LEGACY";
const char *CLOCK_SET_FAILURE_STRING = "CLOCK_SET_FAILURE"; const char *CLOCK_SET_FAILURE_STRING = "CLOCK_SET_FAILURE";
const char *CLOCK_DUMP_STRING = "CLOCK_DUMP";
const char *CLOCK_DUMP_BEFORE_SETTING_TIME_STRING = "CLOCK_DUMP_BEFORE_SETTING_TIME";
const char *CLOCK_DUMP_AFTER_SETTING_TIME_STRING = "CLOCK_DUMP_AFTER_SETTING_TIME";
const char *TC_DELETION_FAILED_STRING = "TC_DELETION_FAILED";
const char *TEST_STRING = "TEST"; const char *TEST_STRING = "TEST";
const char *CHANGE_OF_SETUP_PARAMETER_STRING = "CHANGE_OF_SETUP_PARAMETER"; const char *CHANGE_OF_SETUP_PARAMETER_STRING = "CHANGE_OF_SETUP_PARAMETER";
const char *STORE_ERROR_STRING = "STORE_ERROR";
const char *MSG_QUEUE_ERROR_STRING = "MSG_QUEUE_ERROR";
const char *SERIALIZATION_ERROR_STRING = "SERIALIZATION_ERROR";
const char *FILESTORE_ERROR_STRING = "FILESTORE_ERROR";
const char *FILENAME_TOO_LARGE_ERROR_STRING = "FILENAME_TOO_LARGE_ERROR";
const char *HANDLING_CFDP_REQUEST_FAILED_STRING = "HANDLING_CFDP_REQUEST_FAILED";
const char *SAFE_RATE_VIOLATION_STRING = "SAFE_RATE_VIOLATION";
const char *RATE_RECOVERY_STRING = "RATE_RECOVERY";
const char *MULTIPLE_RW_INVALID_STRING = "MULTIPLE_RW_INVALID";
const char *MEKF_INVALID_INFO_STRING = "MEKF_INVALID_INFO";
const char *MEKF_RECOVERY_STRING = "MEKF_RECOVERY";
const char *MEKF_AUTOMATIC_RESET_STRING = "MEKF_AUTOMATIC_RESET";
const char *PTG_CTRL_NO_ATTITUDE_INFORMATION_STRING = "PTG_CTRL_NO_ATTITUDE_INFORMATION";
const char *SAFE_MODE_CONTROLLER_FAILURE_STRING = "SAFE_MODE_CONTROLLER_FAILURE";
const char *TLE_TOO_OLD_STRING = "TLE_TOO_OLD";
const char *TLE_FILE_READ_FAILED_STRING = "TLE_FILE_READ_FAILED";
const char *PTG_RATE_VIOLATION_STRING = "PTG_RATE_VIOLATION";
const char *DETUMBLE_TRANSITION_FAILED_STRING = "DETUMBLE_TRANSITION_FAILED";
const char *SWITCH_CMD_SENT_STRING = "SWITCH_CMD_SENT";
const char *SWITCH_HAS_CHANGED_STRING = "SWITCH_HAS_CHANGED";
const char *SWITCHING_Q7S_DENIED_STRING = "SWITCHING_Q7S_DENIED";
const char *FDIR_REACTION_IGNORED_STRING = "FDIR_REACTION_IGNORED";
const char *DATASET_READ_FAILED_STRING = "DATASET_READ_FAILED";
const char *VOLTAGE_OUT_OF_BOUNDS_STRING = "VOLTAGE_OUT_OF_BOUNDS";
const char *TIMEDELTA_OUT_OF_BOUNDS_STRING = "TIMEDELTA_OUT_OF_BOUNDS";
const char *POWER_LEVEL_LOW_STRING = "POWER_LEVEL_LOW";
const char *POWER_LEVEL_CRITICAL_STRING = "POWER_LEVEL_CRITICAL";
const char *GPIO_PULL_HIGH_FAILED_STRING = "GPIO_PULL_HIGH_FAILED";
const char *GPIO_PULL_LOW_FAILED_STRING = "GPIO_PULL_LOW_FAILED";
const char *HEATER_WENT_ON_STRING = "HEATER_WENT_ON";
const char *HEATER_WENT_OFF_STRING = "HEATER_WENT_OFF";
const char *SWITCH_ALREADY_ON_STRING = "SWITCH_ALREADY_ON";
const char *SWITCH_ALREADY_OFF_STRING = "SWITCH_ALREADY_OFF";
const char *MAIN_SWITCH_TIMEOUT_STRING = "MAIN_SWITCH_TIMEOUT";
const char *FAULTY_HEATER_WAS_ON_STRING = "FAULTY_HEATER_WAS_ON";
const char *BURN_PHASE_START_STRING = "BURN_PHASE_START";
const char *BURN_PHASE_DONE_STRING = "BURN_PHASE_DONE";
const char *MAIN_SWITCH_ON_TIMEOUT_STRING = "MAIN_SWITCH_ON_TIMEOUT";
const char *MAIN_SWITCH_OFF_TIMEOUT_STRING = "MAIN_SWITCH_OFF_TIMEOUT";
const char *DEPL_SA1_GPIO_SWTICH_ON_FAILED_STRING = "DEPL_SA1_GPIO_SWTICH_ON_FAILED";
const char *DEPL_SA2_GPIO_SWTICH_ON_FAILED_STRING = "DEPL_SA2_GPIO_SWTICH_ON_FAILED";
const char *DEPL_SA1_GPIO_SWTICH_OFF_FAILED_STRING = "DEPL_SA1_GPIO_SWTICH_OFF_FAILED";
const char *DEPL_SA2_GPIO_SWTICH_OFF_FAILED_STRING = "DEPL_SA2_GPIO_SWTICH_OFF_FAILED";
const char *AUTONOMOUS_DEPLOYMENT_COMPLETED_STRING = "AUTONOMOUS_DEPLOYMENT_COMPLETED";
const char *MEMORY_READ_RPT_CRC_FAILURE_STRING = "MEMORY_READ_RPT_CRC_FAILURE"; const char *MEMORY_READ_RPT_CRC_FAILURE_STRING = "MEMORY_READ_RPT_CRC_FAILURE";
const char *ACK_FAILURE_STRING = "ACK_FAILURE"; const char *ACK_FAILURE_STRING = "ACK_FAILURE";
const char *EXE_FAILURE_STRING = "EXE_FAILURE"; const char *EXE_FAILURE_STRING = "EXE_FAILURE";
const char *MPSOC_HANDLER_CRC_FAILURE_STRING = "MPSOC_HANDLER_CRC_FAILURE"; const char *CRC_FAILURE_EVENT_STRING = "CRC_FAILURE_EVENT";
const char *MPSOC_HANDLER_SEQUENCE_COUNT_MISMATCH_STRING = "MPSOC_HANDLER_SEQUENCE_COUNT_MISMATCH";
const char *MPSOC_SHUTDOWN_FAILED_STRING = "MPSOC_SHUTDOWN_FAILED";
const char *SUPV_NOT_ON_STRING = "SUPV_NOT_ON";
const char *SUPV_REPLY_TIMEOUT_STRING = "SUPV_REPLY_TIMEOUT";
const char *CAM_MUST_BE_ON_FOR_SNAPSHOT_MODE_STRING = "CAM_MUST_BE_ON_FOR_SNAPSHOT_MODE";
const char *SELF_TEST_I2C_FAILURE_STRING = "SELF_TEST_I2C_FAILURE";
const char *SELF_TEST_SPI_FAILURE_STRING = "SELF_TEST_SPI_FAILURE";
const char *SELF_TEST_ADC_FAILURE_STRING = "SELF_TEST_ADC_FAILURE";
const char *SELF_TEST_PWM_FAILURE_STRING = "SELF_TEST_PWM_FAILURE";
const char *SELF_TEST_TC_FAILURE_STRING = "SELF_TEST_TC_FAILURE";
const char *SELF_TEST_MTM_RANGE_FAILURE_STRING = "SELF_TEST_MTM_RANGE_FAILURE";
const char *SELF_TEST_COIL_CURRENT_FAILURE_STRING = "SELF_TEST_COIL_CURRENT_FAILURE";
const char *INVALID_ERROR_BYTE_STRING = "INVALID_ERROR_BYTE";
const char *ERROR_STATE_STRING = "ERROR_STATE";
const char *RESET_OCCURED_STRING = "RESET_OCCURED";
const char *BOOTING_FIRMWARE_FAILED_EVENT_STRING = "BOOTING_FIRMWARE_FAILED_EVENT";
const char *BOOTING_BOOTLOADER_FAILED_EVENT_STRING = "BOOTING_BOOTLOADER_FAILED_EVENT";
const char *COM_ERROR_REPLY_RECEIVED_STRING = "COM_ERROR_REPLY_RECEIVED";
const char *SUPV_MEMORY_READ_RPT_CRC_FAILURE_STRING = "SUPV_MEMORY_READ_RPT_CRC_FAILURE";
const char *SUPV_UNKNOWN_TM_STRING = "SUPV_UNKNOWN_TM";
const char *SUPV_UNINIMPLEMENTED_TM_STRING = "SUPV_UNINIMPLEMENTED_TM";
const char *SUPV_ACK_FAILURE_STRING = "SUPV_ACK_FAILURE";
const char *SUPV_EXE_FAILURE_STRING = "SUPV_EXE_FAILURE";
const char *SUPV_CRC_FAILURE_EVENT_STRING = "SUPV_CRC_FAILURE_EVENT";
const char *SUPV_HELPER_EXECUTING_STRING = "SUPV_HELPER_EXECUTING";
const char *SUPV_MPSOC_SHUTDOWN_BUILD_FAILED_STRING = "SUPV_MPSOC_SHUTDOWN_BUILD_FAILED";
const char *SUPV_ACK_UNKNOWN_COMMAND_STRING = "SUPV_ACK_UNKNOWN_COMMAND";
const char *SUPV_EXE_ACK_UNKNOWN_COMMAND_STRING = "SUPV_EXE_ACK_UNKNOWN_COMMAND";
const char *SANITIZATION_FAILED_STRING = "SANITIZATION_FAILED";
const char *MOUNTED_SD_CARD_STRING = "MOUNTED_SD_CARD";
const char *SEND_MRAM_DUMP_FAILED_STRING = "SEND_MRAM_DUMP_FAILED";
const char *MRAM_DUMP_FAILED_STRING = "MRAM_DUMP_FAILED";
const char *MRAM_DUMP_FINISHED_STRING = "MRAM_DUMP_FINISHED";
const char *INVALID_TC_FRAME_STRING = "INVALID_TC_FRAME";
const char *INVALID_FAR_STRING = "INVALID_FAR";
const char *CARRIER_LOCK_STRING = "CARRIER_LOCK";
const char *BIT_LOCK_PDEC_STRING = "BIT_LOCK_PDEC";
const char *LOST_CARRIER_LOCK_PDEC_STRING = "LOST_CARRIER_LOCK_PDEC";
const char *LOST_BIT_LOCK_PDEC_STRING = "LOST_BIT_LOCK_PDEC";
const char *TOO_MANY_IRQS_STRING = "TOO_MANY_IRQS";
const char *POLL_SYSCALL_ERROR_PDEC_STRING = "POLL_SYSCALL_ERROR_PDEC";
const char *WRITE_SYSCALL_ERROR_PDEC_STRING = "WRITE_SYSCALL_ERROR_PDEC";
const char *PDEC_TRYING_RESET_WITH_INIT_STRING = "PDEC_TRYING_RESET_WITH_INIT";
const char *PDEC_TRYING_RESET_NO_INIT_STRING = "PDEC_TRYING_RESET_NO_INIT";
const char *PDEC_RESET_FAILED_STRING = "PDEC_RESET_FAILED";
const char *OPEN_IRQ_FILE_FAILED_STRING = "OPEN_IRQ_FILE_FAILED";
const char *PDEC_INIT_FAILED_STRING = "PDEC_INIT_FAILED";
const char *PDEC_CONFIG_CORRUPTED_STRING = "PDEC_CONFIG_CORRUPTED";
const char *IMAGE_UPLOAD_FAILED_STRING = "IMAGE_UPLOAD_FAILED";
const char *IMAGE_DOWNLOAD_FAILED_STRING = "IMAGE_DOWNLOAD_FAILED";
const char *IMAGE_UPLOAD_SUCCESSFUL_STRING = "IMAGE_UPLOAD_SUCCESSFUL";
const char *IMAGE_DOWNLOAD_SUCCESSFUL_STRING = "IMAGE_DOWNLOAD_SUCCESSFUL";
const char *FLASH_WRITE_SUCCESSFUL_STRING = "FLASH_WRITE_SUCCESSFUL";
const char *FLASH_READ_SUCCESSFUL_STRING = "FLASH_READ_SUCCESSFUL";
const char *FLASH_READ_FAILED_STRING = "FLASH_READ_FAILED";
const char *FIRMWARE_UPDATE_SUCCESSFUL_STRING = "FIRMWARE_UPDATE_SUCCESSFUL";
const char *FIRMWARE_UPDATE_FAILED_STRING = "FIRMWARE_UPDATE_FAILED";
const char *STR_HELPER_READING_REPLY_FAILED_STRING = "STR_HELPER_READING_REPLY_FAILED";
const char *STR_HELPER_COM_ERROR_STRING = "STR_HELPER_COM_ERROR";
const char *STR_COM_REPLY_TIMEOUT_STRING = "STR_COM_REPLY_TIMEOUT";
const char *STR_HELPER_DEC_ERROR_STRING = "STR_HELPER_DEC_ERROR";
const char *POSITION_MISMATCH_STRING = "POSITION_MISMATCH";
const char *STR_HELPER_FILE_NOT_EXISTS_STRING = "STR_HELPER_FILE_NOT_EXISTS";
const char *STR_HELPER_SENDING_PACKET_FAILED_STRING = "STR_HELPER_SENDING_PACKET_FAILED";
const char *STR_HELPER_REQUESTING_MSG_FAILED_STRING = "STR_HELPER_REQUESTING_MSG_FAILED";
const char *MPSOC_FLASH_WRITE_FAILED_STRING = "MPSOC_FLASH_WRITE_FAILED";
const char *MPSOC_FLASH_WRITE_SUCCESSFUL_STRING = "MPSOC_FLASH_WRITE_SUCCESSFUL";
const char *MPSOC_SENDING_COMMAND_FAILED_STRING = "MPSOC_SENDING_COMMAND_FAILED";
const char *MPSOC_HELPER_REQUESTING_REPLY_FAILED_STRING = "MPSOC_HELPER_REQUESTING_REPLY_FAILED";
const char *MPSOC_HELPER_READING_REPLY_FAILED_STRING = "MPSOC_HELPER_READING_REPLY_FAILED";
const char *MPSOC_MISSING_ACK_STRING = "MPSOC_MISSING_ACK";
const char *MPSOC_MISSING_EXE_STRING = "MPSOC_MISSING_EXE";
const char *MPSOC_ACK_FAILURE_REPORT_STRING = "MPSOC_ACK_FAILURE_REPORT";
const char *MPSOC_EXE_FAILURE_REPORT_STRING = "MPSOC_EXE_FAILURE_REPORT";
const char *MPSOC_ACK_INVALID_APID_STRING = "MPSOC_ACK_INVALID_APID";
const char *MPSOC_EXE_INVALID_APID_STRING = "MPSOC_EXE_INVALID_APID";
const char *MPSOC_HELPER_SEQ_CNT_MISMATCH_STRING = "MPSOC_HELPER_SEQ_CNT_MISMATCH";
const char *MPSOC_TM_SIZE_ERROR_STRING = "MPSOC_TM_SIZE_ERROR";
const char *MPSOC_TM_CRC_MISSMATCH_STRING = "MPSOC_TM_CRC_MISSMATCH";
const char *MPSOC_FLASH_READ_PACKET_ERROR_STRING = "MPSOC_FLASH_READ_PACKET_ERROR";
const char *MPSOC_FLASH_READ_FAILED_STRING = "MPSOC_FLASH_READ_FAILED";
const char *MPSOC_FLASH_READ_SUCCESSFUL_STRING = "MPSOC_FLASH_READ_SUCCESSFUL";
const char *MPSOC_READ_TIMEOUT_STRING = "MPSOC_READ_TIMEOUT";
const char *TRANSITION_BACK_TO_OFF_STRING = "TRANSITION_BACK_TO_OFF";
const char *NEG_V_OUT_OF_BOUNDS_STRING = "NEG_V_OUT_OF_BOUNDS";
const char *U_DRO_OUT_OF_BOUNDS_STRING = "U_DRO_OUT_OF_BOUNDS";
const char *I_DRO_OUT_OF_BOUNDS_STRING = "I_DRO_OUT_OF_BOUNDS";
const char *U_X8_OUT_OF_BOUNDS_STRING = "U_X8_OUT_OF_BOUNDS";
const char *I_X8_OUT_OF_BOUNDS_STRING = "I_X8_OUT_OF_BOUNDS";
const char *U_TX_OUT_OF_BOUNDS_STRING = "U_TX_OUT_OF_BOUNDS";
const char *I_TX_OUT_OF_BOUNDS_STRING = "I_TX_OUT_OF_BOUNDS";
const char *U_MPA_OUT_OF_BOUNDS_STRING = "U_MPA_OUT_OF_BOUNDS";
const char *I_MPA_OUT_OF_BOUNDS_STRING = "I_MPA_OUT_OF_BOUNDS";
const char *U_HPA_OUT_OF_BOUNDS_STRING = "U_HPA_OUT_OF_BOUNDS";
const char *I_HPA_OUT_OF_BOUNDS_STRING = "I_HPA_OUT_OF_BOUNDS";
const char *TRANSITION_OTHER_SIDE_FAILED_STRING = "TRANSITION_OTHER_SIDE_FAILED";
const char *NOT_ENOUGH_DEVICES_DUAL_MODE_STRING = "NOT_ENOUGH_DEVICES_DUAL_MODE";
const char *POWER_STATE_MACHINE_TIMEOUT_STRING = "POWER_STATE_MACHINE_TIMEOUT";
const char *SIDE_SWITCH_TRANSITION_NOT_ALLOWED_STRING = "SIDE_SWITCH_TRANSITION_NOT_ALLOWED";
const char *DIRECT_TRANSITION_TO_DUAL_OTHER_GPS_FAULTY_STRING = "DIRECT_TRANSITION_TO_DUAL_OTHER_GPS_FAULTY";
const char *TRANSITION_OTHER_SIDE_FAILED_12900_STRING = "TRANSITION_OTHER_SIDE_FAILED_12900";
const char *NOT_ENOUGH_DEVICES_DUAL_MODE_12901_STRING = "NOT_ENOUGH_DEVICES_DUAL_MODE_12901";
const char *POWER_STATE_MACHINE_TIMEOUT_12902_STRING = "POWER_STATE_MACHINE_TIMEOUT_12902";
const char *SIDE_SWITCH_TRANSITION_NOT_ALLOWED_12903_STRING = "SIDE_SWITCH_TRANSITION_NOT_ALLOWED_12903";
const char *CHILDREN_LOST_MODE_STRING = "CHILDREN_LOST_MODE";
const char *GPS_FIX_CHANGE_STRING = "GPS_FIX_CHANGE";
const char *CANT_GET_FIX_STRING = "CANT_GET_FIX";
const char *RESET_FAIL_STRING = "RESET_FAIL";
const char *P60_BOOT_COUNT_STRING = "P60_BOOT_COUNT";
const char *BATT_MODE_STRING = "BATT_MODE";
const char *BATT_MODE_CHANGED_STRING = "BATT_MODE_CHANGED";
const char *SUPV_UPDATE_FAILED_STRING = "SUPV_UPDATE_FAILED";
const char *SUPV_UPDATE_SUCCESSFUL_STRING = "SUPV_UPDATE_SUCCESSFUL";
const char *SUPV_CONTINUE_UPDATE_FAILED_STRING = "SUPV_CONTINUE_UPDATE_FAILED";
const char *SUPV_CONTINUE_UPDATE_SUCCESSFUL_STRING = "SUPV_CONTINUE_UPDATE_SUCCESSFUL";
const char *TERMINATED_UPDATE_PROCEDURE_STRING = "TERMINATED_UPDATE_PROCEDURE";
const char *SUPV_EVENT_BUFFER_REQUEST_SUCCESSFUL_STRING = "SUPV_EVENT_BUFFER_REQUEST_SUCCESSFUL";
const char *SUPV_EVENT_BUFFER_REQUEST_FAILED_STRING = "SUPV_EVENT_BUFFER_REQUEST_FAILED";
const char *SUPV_EVENT_BUFFER_REQUEST_TERMINATED_STRING = "SUPV_EVENT_BUFFER_REQUEST_TERMINATED";
const char *SUPV_MEM_CHECK_OK_STRING = "SUPV_MEM_CHECK_OK";
const char *SUPV_MEM_CHECK_FAIL_STRING = "SUPV_MEM_CHECK_FAIL";
const char *SUPV_SENDING_COMMAND_FAILED_STRING = "SUPV_SENDING_COMMAND_FAILED";
const char *SUPV_HELPER_REQUESTING_REPLY_FAILED_STRING = "SUPV_HELPER_REQUESTING_REPLY_FAILED";
const char *SUPV_HELPER_READING_REPLY_FAILED_STRING = "SUPV_HELPER_READING_REPLY_FAILED";
const char *SUPV_MISSING_ACK_STRING = "SUPV_MISSING_ACK";
const char *SUPV_MISSING_EXE_STRING = "SUPV_MISSING_EXE";
const char *SUPV_ACK_FAILURE_REPORT_STRING = "SUPV_ACK_FAILURE_REPORT";
const char *SUPV_EXE_FAILURE_REPORT_STRING = "SUPV_EXE_FAILURE_REPORT";
const char *SUPV_ACK_INVALID_APID_STRING = "SUPV_ACK_INVALID_APID";
const char *SUPV_EXE_INVALID_APID_STRING = "SUPV_EXE_INVALID_APID";
const char *ACK_RECEPTION_FAILURE_STRING = "ACK_RECEPTION_FAILURE";
const char *EXE_RECEPTION_FAILURE_STRING = "EXE_RECEPTION_FAILURE";
const char *WRITE_MEMORY_FAILED_STRING = "WRITE_MEMORY_FAILED";
const char *SUPV_REPLY_SIZE_MISSMATCH_STRING = "SUPV_REPLY_SIZE_MISSMATCH";
const char *SUPV_REPLY_CRC_MISSMATCH_STRING = "SUPV_REPLY_CRC_MISSMATCH";
const char *SUPV_UPDATE_PROGRESS_STRING = "SUPV_UPDATE_PROGRESS";
const char *HDLC_FRAME_REMOVAL_ERROR_STRING = "HDLC_FRAME_REMOVAL_ERROR";
const char *HDLC_CRC_ERROR_STRING = "HDLC_CRC_ERROR";
const char *TX_ON_STRING = "TX_ON";
const char *TX_OFF_STRING = "TX_OFF";
const char *MISSING_PACKET_STRING = "MISSING_PACKET";
const char *EXPERIMENT_TIMEDOUT_STRING = "EXPERIMENT_TIMEDOUT";
const char *MULTI_PACKET_COMMAND_DONE_STRING = "MULTI_PACKET_COMMAND_DONE";
const char *FS_UNUSABLE_STRING = "FS_UNUSABLE";
const char *SET_CONFIGFILEVALUE_FAILED_STRING = "SET_CONFIGFILEVALUE_FAILED";
const char *GET_CONFIGFILEVALUE_FAILED_STRING = "GET_CONFIGFILEVALUE_FAILED";
const char *INSERT_CONFIGFILEVALUE_FAILED_STRING = "INSERT_CONFIGFILEVALUE_FAILED";
const char *WRITE_CONFIGFILE_FAILED_STRING = "WRITE_CONFIGFILE_FAILED";
const char *READ_CONFIGFILE_FAILED_STRING = "READ_CONFIGFILE_FAILED";
const char *ALLOC_FAILURE_STRING = "ALLOC_FAILURE";
const char *REBOOT_SW_STRING = "REBOOT_SW";
const char *REBOOT_MECHANISM_TRIGGERED_STRING = "REBOOT_MECHANISM_TRIGGERED";
const char *REBOOT_HW_STRING = "REBOOT_HW";
const char *NO_SD_CARD_ACTIVE_STRING = "NO_SD_CARD_ACTIVE";
const char *VERSION_INFO_STRING = "VERSION_INFO";
const char *CURRENT_IMAGE_INFO_STRING = "CURRENT_IMAGE_INFO";
const char *REBOOT_COUNTER_STRING = "REBOOT_COUNTER";
const char *INDIVIDUAL_BOOT_COUNTS_STRING = "INDIVIDUAL_BOOT_COUNTS";
const char *TRYING_I2C_RECOVERY_STRING = "TRYING_I2C_RECOVERY";
const char *I2C_REBOOT_STRING = "I2C_REBOOT";
const char *PDEC_REBOOT_STRING = "PDEC_REBOOT";
const char *FIRMWARE_INFO_STRING = "FIRMWARE_INFO";
const char *ACTIVE_SD_INFO_STRING = "ACTIVE_SD_INFO";
const char *NO_VALID_SENSOR_TEMPERATURE_STRING = "NO_VALID_SENSOR_TEMPERATURE";
const char *NO_HEALTHY_HEATER_AVAILABLE_STRING = "NO_HEALTHY_HEATER_AVAILABLE";
const char *SYRLINKS_OVERHEATING_STRING = "SYRLINKS_OVERHEATING";
const char *OBC_OVERHEATING_STRING = "OBC_OVERHEATING";
const char *CAMERA_OVERHEATING_STRING = "CAMERA_OVERHEATING";
const char *PCDU_SYSTEM_OVERHEATING_STRING = "PCDU_SYSTEM_OVERHEATING";
const char *HEATER_NOT_OFF_FOR_OFF_MODE_STRING = "HEATER_NOT_OFF_FOR_OFF_MODE";
const char *MGT_OVERHEATING_STRING = "MGT_OVERHEATING";
const char *TCS_SWITCHING_HEATER_ON_STRING = "TCS_SWITCHING_HEATER_ON";
const char *TCS_SWITCHING_HEATER_OFF_STRING = "TCS_SWITCHING_HEATER_OFF";
const char *TCS_HEATER_MAX_BURN_TIME_REACHED_STRING = "TCS_HEATER_MAX_BURN_TIME_REACHED";
const char *TX_TIMER_EXPIRED_STRING = "TX_TIMER_EXPIRED";
const char *BIT_LOCK_TX_ON_STRING = "BIT_LOCK_TX_ON";
const char *POSSIBLE_FILE_CORRUPTION_STRING = "POSSIBLE_FILE_CORRUPTION";
const char *FILE_TOO_LARGE_STRING = "FILE_TOO_LARGE";
const char *BUSY_DUMPING_EVENT_STRING = "BUSY_DUMPING_EVENT";
const char *DUMP_OK_STORE_DONE_STRING = "DUMP_OK_STORE_DONE";
const char *DUMP_NOK_STORE_DONE_STRING = "DUMP_NOK_STORE_DONE";
const char *DUMP_MISC_STORE_DONE_STRING = "DUMP_MISC_STORE_DONE";
const char *DUMP_HK_STORE_DONE_STRING = "DUMP_HK_STORE_DONE";
const char *DUMP_CFDP_STORE_DONE_STRING = "DUMP_CFDP_STORE_DONE";
const char *DUMP_OK_CANCELLED_STRING = "DUMP_OK_CANCELLED";
const char *DUMP_NOK_CANCELLED_STRING = "DUMP_NOK_CANCELLED";
const char *DUMP_MISC_CANCELLED_STRING = "DUMP_MISC_CANCELLED";
const char *DUMP_HK_CANCELLED_STRING = "DUMP_HK_CANCELLED";
const char *DUMP_CFDP_CANCELLED_STRING = "DUMP_CFDP_CANCELLED";
const char *TEMPERATURE_ALL_ONES_START_STRING = "TEMPERATURE_ALL_ONES_START";
const char *TEMPERATURE_ALL_ONES_RECOVERY_STRING = "TEMPERATURE_ALL_ONES_RECOVERY";
const char *FAULT_HANDLER_TRIGGERED_STRING = "FAULT_HANDLER_TRIGGERED";
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):
@ -391,18 +149,16 @@ const char *translateEvents(Event event) {
return MONITORING_LIMIT_EXCEEDED_STRING; return MONITORING_LIMIT_EXCEEDED_STRING;
case (2810): case (2810):
return MONITORING_AMBIGUOUS_STRING; return MONITORING_AMBIGUOUS_STRING;
case (2811): case (4201):
return DEVICE_WANTS_HARD_REBOOT_STRING; return FUSE_CURRENT_HIGH_STRING;
case (4202):
return FUSE_WENT_OFF_STRING;
case (4204):
return POWER_ABOVE_HIGH_LIMIT_STRING;
case (4205):
return POWER_BELOW_LOW_LIMIT_STRING;
case (4300): case (4300):
return SWITCH_WENT_OFF_STRING; return SWITCH_WENT_OFF_STRING;
case (4301):
return FUSE_CURRENT_HIGH_STRING;
case (4302):
return FUSE_WENT_OFF_STRING;
case (4304):
return POWER_ABOVE_HIGH_LIMIT_STRING;
case (4305):
return POWER_BELOW_LOW_LIMIT_STRING;
case (5000): case (5000):
return HEATER_ON_STRING; return HEATER_ON_STRING;
case (5001): case (5001):
@ -443,6 +199,8 @@ const char *translateEvents(Event event) {
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):
return SWITCHING_TM_FAILED_STRING;
case (7400): case (7400):
return CHANGING_MODE_STRING; return CHANGING_MODE_STRING;
case (7401): case (7401):
@ -473,8 +231,6 @@ const char *translateEvents(Event event) {
return RECOVERY_STEP_STRING; return RECOVERY_STEP_STRING;
case (7512): case (7512):
return RECOVERY_DONE_STRING; return RECOVERY_DONE_STRING;
case (7600):
return HANDLE_PACKET_FAILED_STRING;
case (7900): case (7900):
return RF_AVAILABLE_STRING; return RF_AVAILABLE_STRING;
case (7901): case (7901):
@ -488,501 +244,19 @@ const char *translateEvents(Event event) {
case (8900): case (8900):
return CLOCK_SET_STRING; return CLOCK_SET_STRING;
case (8901): case (8901):
return CLOCK_DUMP_LEGACY_STRING;
case (8902):
return CLOCK_SET_FAILURE_STRING; return CLOCK_SET_FAILURE_STRING;
case (8903):
return CLOCK_DUMP_STRING;
case (8904):
return CLOCK_DUMP_BEFORE_SETTING_TIME_STRING;
case (8905):
return CLOCK_DUMP_AFTER_SETTING_TIME_STRING;
case (9100):
return TC_DELETION_FAILED_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 (10800): case (11101):
return STORE_ERROR_STRING;
case (10801):
return MSG_QUEUE_ERROR_STRING;
case (10802):
return SERIALIZATION_ERROR_STRING;
case (10803):
return FILESTORE_ERROR_STRING;
case (10804):
return FILENAME_TOO_LARGE_ERROR_STRING;
case (10805):
return HANDLING_CFDP_REQUEST_FAILED_STRING;
case (11200):
return SAFE_RATE_VIOLATION_STRING;
case (11201):
return RATE_RECOVERY_STRING;
case (11202):
return MULTIPLE_RW_INVALID_STRING;
case (11203):
return MEKF_INVALID_INFO_STRING;
case (11204):
return MEKF_RECOVERY_STRING;
case (11205):
return MEKF_AUTOMATIC_RESET_STRING;
case (11206):
return PTG_CTRL_NO_ATTITUDE_INFORMATION_STRING;
case (11207):
return SAFE_MODE_CONTROLLER_FAILURE_STRING;
case (11208):
return TLE_TOO_OLD_STRING;
case (11209):
return TLE_FILE_READ_FAILED_STRING;
case (11210):
return PTG_RATE_VIOLATION_STRING;
case (11211):
return DETUMBLE_TRANSITION_FAILED_STRING;
case (11300):
return SWITCH_CMD_SENT_STRING;
case (11301):
return SWITCH_HAS_CHANGED_STRING;
case (11302):
return SWITCHING_Q7S_DENIED_STRING;
case (11303):
return FDIR_REACTION_IGNORED_STRING;
case (11304):
return DATASET_READ_FAILED_STRING;
case (11305):
return VOLTAGE_OUT_OF_BOUNDS_STRING;
case (11306):
return TIMEDELTA_OUT_OF_BOUNDS_STRING;
case (11307):
return POWER_LEVEL_LOW_STRING;
case (11308):
return POWER_LEVEL_CRITICAL_STRING;
case (11400):
return GPIO_PULL_HIGH_FAILED_STRING;
case (11401):
return GPIO_PULL_LOW_FAILED_STRING;
case (11402):
return HEATER_WENT_ON_STRING;
case (11403):
return HEATER_WENT_OFF_STRING;
case (11404):
return SWITCH_ALREADY_ON_STRING;
case (11405):
return SWITCH_ALREADY_OFF_STRING;
case (11406):
return MAIN_SWITCH_TIMEOUT_STRING;
case (11407):
return FAULTY_HEATER_WAS_ON_STRING;
case (11500):
return BURN_PHASE_START_STRING;
case (11501):
return BURN_PHASE_DONE_STRING;
case (11502):
return MAIN_SWITCH_ON_TIMEOUT_STRING;
case (11503):
return MAIN_SWITCH_OFF_TIMEOUT_STRING;
case (11504):
return DEPL_SA1_GPIO_SWTICH_ON_FAILED_STRING;
case (11505):
return DEPL_SA2_GPIO_SWTICH_ON_FAILED_STRING;
case (11506):
return DEPL_SA1_GPIO_SWTICH_OFF_FAILED_STRING;
case (11507):
return DEPL_SA2_GPIO_SWTICH_OFF_FAILED_STRING;
case (11508):
return AUTONOMOUS_DEPLOYMENT_COMPLETED_STRING;
case (11601):
return MEMORY_READ_RPT_CRC_FAILURE_STRING; return MEMORY_READ_RPT_CRC_FAILURE_STRING;
case (11602): case (11102):
return ACK_FAILURE_STRING; return ACK_FAILURE_STRING;
case (11603): case (11103):
return EXE_FAILURE_STRING; return EXE_FAILURE_STRING;
case (11604): case (11104):
return MPSOC_HANDLER_CRC_FAILURE_STRING; return CRC_FAILURE_EVENT_STRING;
case (11605):
return MPSOC_HANDLER_SEQUENCE_COUNT_MISMATCH_STRING;
case (11606):
return MPSOC_SHUTDOWN_FAILED_STRING;
case (11607):
return SUPV_NOT_ON_STRING;
case (11608):
return SUPV_REPLY_TIMEOUT_STRING;
case (11609):
return CAM_MUST_BE_ON_FOR_SNAPSHOT_MODE_STRING;
case (11701):
return SELF_TEST_I2C_FAILURE_STRING;
case (11702):
return SELF_TEST_SPI_FAILURE_STRING;
case (11703):
return SELF_TEST_ADC_FAILURE_STRING;
case (11704):
return SELF_TEST_PWM_FAILURE_STRING;
case (11705):
return SELF_TEST_TC_FAILURE_STRING;
case (11706):
return SELF_TEST_MTM_RANGE_FAILURE_STRING;
case (11707):
return SELF_TEST_COIL_CURRENT_FAILURE_STRING;
case (11708):
return INVALID_ERROR_BYTE_STRING;
case (11801):
return ERROR_STATE_STRING;
case (11802):
return RESET_OCCURED_STRING;
case (11901):
return BOOTING_FIRMWARE_FAILED_EVENT_STRING;
case (11902):
return BOOTING_BOOTLOADER_FAILED_EVENT_STRING;
case (11903):
return COM_ERROR_REPLY_RECEIVED_STRING;
case (12001):
return SUPV_MEMORY_READ_RPT_CRC_FAILURE_STRING;
case (12002):
return SUPV_UNKNOWN_TM_STRING;
case (12003):
return SUPV_UNINIMPLEMENTED_TM_STRING;
case (12004):
return SUPV_ACK_FAILURE_STRING;
case (12005):
return SUPV_EXE_FAILURE_STRING;
case (12006):
return SUPV_CRC_FAILURE_EVENT_STRING;
case (12007):
return SUPV_HELPER_EXECUTING_STRING;
case (12008):
return SUPV_MPSOC_SHUTDOWN_BUILD_FAILED_STRING;
case (12009):
return SUPV_ACK_UNKNOWN_COMMAND_STRING;
case (12010):
return SUPV_EXE_ACK_UNKNOWN_COMMAND_STRING;
case (12100):
return SANITIZATION_FAILED_STRING;
case (12101):
return MOUNTED_SD_CARD_STRING;
case (12300):
return SEND_MRAM_DUMP_FAILED_STRING;
case (12301):
return MRAM_DUMP_FAILED_STRING;
case (12302):
return MRAM_DUMP_FINISHED_STRING;
case (12401):
return INVALID_TC_FRAME_STRING;
case (12402):
return INVALID_FAR_STRING;
case (12403):
return CARRIER_LOCK_STRING;
case (12404):
return BIT_LOCK_PDEC_STRING;
case (12405):
return LOST_CARRIER_LOCK_PDEC_STRING;
case (12406):
return LOST_BIT_LOCK_PDEC_STRING;
case (12407):
return TOO_MANY_IRQS_STRING;
case (12408):
return POLL_SYSCALL_ERROR_PDEC_STRING;
case (12409):
return WRITE_SYSCALL_ERROR_PDEC_STRING;
case (12410):
return PDEC_TRYING_RESET_WITH_INIT_STRING;
case (12411):
return PDEC_TRYING_RESET_NO_INIT_STRING;
case (12412):
return PDEC_RESET_FAILED_STRING;
case (12413):
return OPEN_IRQ_FILE_FAILED_STRING;
case (12414):
return PDEC_INIT_FAILED_STRING;
case (12415):
return PDEC_CONFIG_CORRUPTED_STRING;
case (12500):
return IMAGE_UPLOAD_FAILED_STRING;
case (12501):
return IMAGE_DOWNLOAD_FAILED_STRING;
case (12502):
return IMAGE_UPLOAD_SUCCESSFUL_STRING;
case (12503):
return IMAGE_DOWNLOAD_SUCCESSFUL_STRING;
case (12504):
return FLASH_WRITE_SUCCESSFUL_STRING;
case (12505):
return FLASH_READ_SUCCESSFUL_STRING;
case (12506):
return FLASH_READ_FAILED_STRING;
case (12507):
return FIRMWARE_UPDATE_SUCCESSFUL_STRING;
case (12508):
return FIRMWARE_UPDATE_FAILED_STRING;
case (12509):
return STR_HELPER_READING_REPLY_FAILED_STRING;
case (12510):
return STR_HELPER_COM_ERROR_STRING;
case (12511):
return STR_COM_REPLY_TIMEOUT_STRING;
case (12513):
return STR_HELPER_DEC_ERROR_STRING;
case (12514):
return POSITION_MISMATCH_STRING;
case (12515):
return STR_HELPER_FILE_NOT_EXISTS_STRING;
case (12516):
return STR_HELPER_SENDING_PACKET_FAILED_STRING;
case (12517):
return STR_HELPER_REQUESTING_MSG_FAILED_STRING;
case (12600):
return MPSOC_FLASH_WRITE_FAILED_STRING;
case (12601):
return MPSOC_FLASH_WRITE_SUCCESSFUL_STRING;
case (12602):
return MPSOC_SENDING_COMMAND_FAILED_STRING;
case (12603):
return MPSOC_HELPER_REQUESTING_REPLY_FAILED_STRING;
case (12604):
return MPSOC_HELPER_READING_REPLY_FAILED_STRING;
case (12605):
return MPSOC_MISSING_ACK_STRING;
case (12606):
return MPSOC_MISSING_EXE_STRING;
case (12607):
return MPSOC_ACK_FAILURE_REPORT_STRING;
case (12608):
return MPSOC_EXE_FAILURE_REPORT_STRING;
case (12609):
return MPSOC_ACK_INVALID_APID_STRING;
case (12610):
return MPSOC_EXE_INVALID_APID_STRING;
case (12611):
return MPSOC_HELPER_SEQ_CNT_MISMATCH_STRING;
case (12612):
return MPSOC_TM_SIZE_ERROR_STRING;
case (12613):
return MPSOC_TM_CRC_MISSMATCH_STRING;
case (12614):
return MPSOC_FLASH_READ_PACKET_ERROR_STRING;
case (12615):
return MPSOC_FLASH_READ_FAILED_STRING;
case (12616):
return MPSOC_FLASH_READ_SUCCESSFUL_STRING;
case (12617):
return MPSOC_READ_TIMEOUT_STRING;
case (12700):
return TRANSITION_BACK_TO_OFF_STRING;
case (12701):
return NEG_V_OUT_OF_BOUNDS_STRING;
case (12702):
return U_DRO_OUT_OF_BOUNDS_STRING;
case (12703):
return I_DRO_OUT_OF_BOUNDS_STRING;
case (12704):
return U_X8_OUT_OF_BOUNDS_STRING;
case (12705):
return I_X8_OUT_OF_BOUNDS_STRING;
case (12706):
return U_TX_OUT_OF_BOUNDS_STRING;
case (12707):
return I_TX_OUT_OF_BOUNDS_STRING;
case (12708):
return U_MPA_OUT_OF_BOUNDS_STRING;
case (12709):
return I_MPA_OUT_OF_BOUNDS_STRING;
case (12710):
return U_HPA_OUT_OF_BOUNDS_STRING;
case (12711):
return I_HPA_OUT_OF_BOUNDS_STRING;
case (12800):
return TRANSITION_OTHER_SIDE_FAILED_STRING;
case (12801):
return NOT_ENOUGH_DEVICES_DUAL_MODE_STRING;
case (12802):
return POWER_STATE_MACHINE_TIMEOUT_STRING;
case (12803):
return SIDE_SWITCH_TRANSITION_NOT_ALLOWED_STRING;
case (12804):
return DIRECT_TRANSITION_TO_DUAL_OTHER_GPS_FAULTY_STRING;
case (12900):
return TRANSITION_OTHER_SIDE_FAILED_12900_STRING;
case (12901):
return NOT_ENOUGH_DEVICES_DUAL_MODE_12901_STRING;
case (12902):
return POWER_STATE_MACHINE_TIMEOUT_12902_STRING;
case (12903):
return SIDE_SWITCH_TRANSITION_NOT_ALLOWED_12903_STRING;
case (13000):
return CHILDREN_LOST_MODE_STRING;
case (13100):
return GPS_FIX_CHANGE_STRING;
case (13101):
return CANT_GET_FIX_STRING;
case (13102):
return RESET_FAIL_STRING;
case (13200):
return P60_BOOT_COUNT_STRING;
case (13201):
return BATT_MODE_STRING;
case (13202):
return BATT_MODE_CHANGED_STRING;
case (13600):
return SUPV_UPDATE_FAILED_STRING;
case (13601):
return SUPV_UPDATE_SUCCESSFUL_STRING;
case (13602):
return SUPV_CONTINUE_UPDATE_FAILED_STRING;
case (13603):
return SUPV_CONTINUE_UPDATE_SUCCESSFUL_STRING;
case (13604):
return TERMINATED_UPDATE_PROCEDURE_STRING;
case (13605):
return SUPV_EVENT_BUFFER_REQUEST_SUCCESSFUL_STRING;
case (13606):
return SUPV_EVENT_BUFFER_REQUEST_FAILED_STRING;
case (13607):
return SUPV_EVENT_BUFFER_REQUEST_TERMINATED_STRING;
case (13608):
return SUPV_MEM_CHECK_OK_STRING;
case (13609):
return SUPV_MEM_CHECK_FAIL_STRING;
case (13616):
return SUPV_SENDING_COMMAND_FAILED_STRING;
case (13617):
return SUPV_HELPER_REQUESTING_REPLY_FAILED_STRING;
case (13618):
return SUPV_HELPER_READING_REPLY_FAILED_STRING;
case (13619):
return SUPV_MISSING_ACK_STRING;
case (13620):
return SUPV_MISSING_EXE_STRING;
case (13621):
return SUPV_ACK_FAILURE_REPORT_STRING;
case (13622):
return SUPV_EXE_FAILURE_REPORT_STRING;
case (13623):
return SUPV_ACK_INVALID_APID_STRING;
case (13624):
return SUPV_EXE_INVALID_APID_STRING;
case (13625):
return ACK_RECEPTION_FAILURE_STRING;
case (13626):
return EXE_RECEPTION_FAILURE_STRING;
case (13627):
return WRITE_MEMORY_FAILED_STRING;
case (13628):
return SUPV_REPLY_SIZE_MISSMATCH_STRING;
case (13629):
return SUPV_REPLY_CRC_MISSMATCH_STRING;
case (13630):
return SUPV_UPDATE_PROGRESS_STRING;
case (13631):
return HDLC_FRAME_REMOVAL_ERROR_STRING;
case (13632):
return HDLC_CRC_ERROR_STRING;
case (13701):
return TX_ON_STRING;
case (13702):
return TX_OFF_STRING;
case (13800):
return MISSING_PACKET_STRING;
case (13801):
return EXPERIMENT_TIMEDOUT_STRING;
case (13802):
return MULTI_PACKET_COMMAND_DONE_STRING;
case (13803):
return FS_UNUSABLE_STRING;
case (13901):
return SET_CONFIGFILEVALUE_FAILED_STRING;
case (13902):
return GET_CONFIGFILEVALUE_FAILED_STRING;
case (13903):
return INSERT_CONFIGFILEVALUE_FAILED_STRING;
case (13904):
return WRITE_CONFIGFILE_FAILED_STRING;
case (13905):
return READ_CONFIGFILE_FAILED_STRING;
case (14000):
return ALLOC_FAILURE_STRING;
case (14001):
return REBOOT_SW_STRING;
case (14002):
return REBOOT_MECHANISM_TRIGGERED_STRING;
case (14003):
return REBOOT_HW_STRING;
case (14004):
return NO_SD_CARD_ACTIVE_STRING;
case (14005):
return VERSION_INFO_STRING;
case (14006):
return CURRENT_IMAGE_INFO_STRING;
case (14007):
return REBOOT_COUNTER_STRING;
case (14008):
return INDIVIDUAL_BOOT_COUNTS_STRING;
case (14010):
return TRYING_I2C_RECOVERY_STRING;
case (14011):
return I2C_REBOOT_STRING;
case (14012):
return PDEC_REBOOT_STRING;
case (14013):
return FIRMWARE_INFO_STRING;
case (14014):
return ACTIVE_SD_INFO_STRING;
case (14100):
return NO_VALID_SENSOR_TEMPERATURE_STRING;
case (14101):
return NO_HEALTHY_HEATER_AVAILABLE_STRING;
case (14102):
return SYRLINKS_OVERHEATING_STRING;
case (14104):
return OBC_OVERHEATING_STRING;
case (14105):
return CAMERA_OVERHEATING_STRING;
case (14106):
return PCDU_SYSTEM_OVERHEATING_STRING;
case (14107):
return HEATER_NOT_OFF_FOR_OFF_MODE_STRING;
case (14108):
return MGT_OVERHEATING_STRING;
case (14109):
return TCS_SWITCHING_HEATER_ON_STRING;
case (14110):
return TCS_SWITCHING_HEATER_OFF_STRING;
case (14111):
return TCS_HEATER_MAX_BURN_TIME_REACHED_STRING;
case (14201):
return TX_TIMER_EXPIRED_STRING;
case (14202):
return BIT_LOCK_TX_ON_STRING;
case (14300):
return POSSIBLE_FILE_CORRUPTION_STRING;
case (14301):
return FILE_TOO_LARGE_STRING;
case (14302):
return BUSY_DUMPING_EVENT_STRING;
case (14305):
return DUMP_OK_STORE_DONE_STRING;
case (14306):
return DUMP_NOK_STORE_DONE_STRING;
case (14307):
return DUMP_MISC_STORE_DONE_STRING;
case (14308):
return DUMP_HK_STORE_DONE_STRING;
case (14309):
return DUMP_CFDP_STORE_DONE_STRING;
case (14310):
return DUMP_OK_CANCELLED_STRING;
case (14311):
return DUMP_NOK_CANCELLED_STRING;
case (14312):
return DUMP_MISC_CANCELLED_STRING;
case (14313):
return DUMP_HK_CANCELLED_STRING;
case (14314):
return DUMP_CFDP_CANCELLED_STRING;
case (14500):
return TEMPERATURE_ALL_ONES_START_STRING;
case (14501):
return TEMPERATURE_ALL_ONES_RECOVERY_STRING;
case (14600):
return FAULT_HANDLER_TRIGGERED_STRING;
default: default:
return "UNKNOWN_EVENT"; return "UNKNOWN_EVENT";
} }

View File

@ -1,8 +1,8 @@
#ifndef FSFWCONFIG_EVENTS_TRANSLATEEVENTS_H_ #ifndef FSFWCONFIG_EVENTS_TRANSLATEEVENTS_H_
#define FSFWCONFIG_EVENTS_TRANSLATEEVENTS_H_ #define FSFWCONFIG_EVENTS_TRANSLATEEVENTS_H_
#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_ */

View File

@ -1,9 +1,9 @@
#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 "eive/objects.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 {
@ -16,6 +16,8 @@ enum sourceObjects : uint32_t {
PUS_SERVICE_23 = 0x51002300, PUS_SERVICE_23 = 0x51002300,
PUS_SERVICE_201 = 0x51020100, PUS_SERVICE_201 = 0x51020100,
TM_FUNNEL = 0x52000002,
/* Test Task */ /* Test Task */
TEST_TASK = 0x42694269, TEST_TASK = 0x42694269,
@ -24,7 +26,7 @@ enum sourceObjects : uint32_t {
/* 0x49 ('I') for Communication Interfaces **/ /* 0x49 ('I') for Communication Interfaces **/
ARDUINO_COM_IF = 0x49000001, ARDUINO_COM_IF = 0x49000001,
DUMMY_COM_IF = 0x49000002, DUMMY_COM_IF = 0x49000002
}; };
} }

View File

@ -1,122 +1,23 @@
/** /**
* @brief Auto-generated object translation file. * @brief Auto-generated object translation file.
* @details * @details
* Contains 176 translations. * Contains 31 translations.
* Generated on: 2024-05-06 13:47:38 * Generated on: 2021-05-17 19:12:49
*/ */
#include "translateObjects.h" #include "translateObjects.h"
#include "systemObjectList.h"
const char *TEST_TASK_STRING = "TEST_TASK"; const char *TEST_TASK_STRING = "TEST_TASK";
const char *ACS_CONTROLLER_STRING = "ACS_CONTROLLER";
const char *CORE_CONTROLLER_STRING = "CORE_CONTROLLER";
const char *POWER_CONTROLLER_STRING = "POWER_CONTROLLER";
const char *GLOBAL_JSON_CFG_STRING = "GLOBAL_JSON_CFG";
const char *XIPHOS_WDT_STRING = "XIPHOS_WDT";
const char *THERMAL_CONTROLLER_STRING = "THERMAL_CONTROLLER";
const char *DUMMY_HANDLER_STRING = "DUMMY_HANDLER"; const char *DUMMY_HANDLER_STRING = "DUMMY_HANDLER";
const char *MGM_0_LIS3_HANDLER_STRING = "MGM_0_LIS3_HANDLER";
const char *GYRO_0_ADIS_HANDLER_STRING = "GYRO_0_ADIS_HANDLER";
const char *SUS_0_N_LOC_XFYFZM_PT_XF_STRING = "SUS_0_N_LOC_XFYFZM_PT_XF";
const char *SUS_1_N_LOC_XBYFZM_PT_XB_STRING = "SUS_1_N_LOC_XBYFZM_PT_XB";
const char *SUS_2_N_LOC_XFYBZB_PT_YB_STRING = "SUS_2_N_LOC_XFYBZB_PT_YB";
const char *SUS_3_N_LOC_XFYBZF_PT_YF_STRING = "SUS_3_N_LOC_XFYBZF_PT_YF";
const char *SUS_4_N_LOC_XMYFZF_PT_ZF_STRING = "SUS_4_N_LOC_XMYFZF_PT_ZF";
const char *SUS_5_N_LOC_XFYMZB_PT_ZB_STRING = "SUS_5_N_LOC_XFYMZB_PT_ZB";
const char *SUS_6_R_LOC_XFYBZM_PT_XF_STRING = "SUS_6_R_LOC_XFYBZM_PT_XF";
const char *SUS_7_R_LOC_XBYBZM_PT_XB_STRING = "SUS_7_R_LOC_XBYBZM_PT_XB";
const char *SUS_8_R_LOC_XBYBZB_PT_YB_STRING = "SUS_8_R_LOC_XBYBZB_PT_YB";
const char *SUS_9_R_LOC_XBYBZB_PT_YF_STRING = "SUS_9_R_LOC_XBYBZB_PT_YF";
const char *SUS_10_N_LOC_XMYBZF_PT_ZF_STRING = "SUS_10_N_LOC_XMYBZF_PT_ZF";
const char *SUS_11_R_LOC_XBYMZB_PT_ZB_STRING = "SUS_11_R_LOC_XBYMZB_PT_ZB";
const char *RW1_STRING = "RW1";
const char *MGM_1_RM3100_HANDLER_STRING = "MGM_1_RM3100_HANDLER";
const char *GYRO_1_L3G_HANDLER_STRING = "GYRO_1_L3G_HANDLER";
const char *RW2_STRING = "RW2";
const char *MGM_2_LIS3_HANDLER_STRING = "MGM_2_LIS3_HANDLER";
const char *GYRO_2_ADIS_HANDLER_STRING = "GYRO_2_ADIS_HANDLER";
const char *RW3_STRING = "RW3";
const char *MGM_3_RM3100_HANDLER_STRING = "MGM_3_RM3100_HANDLER";
const char *GYRO_3_L3G_HANDLER_STRING = "GYRO_3_L3G_HANDLER";
const char *RW4_STRING = "RW4";
const char *STAR_TRACKER_STRING = "STAR_TRACKER";
const char *GPS_CONTROLLER_STRING = "GPS_CONTROLLER";
const char *GPS_0_HEALTH_DEV_STRING = "GPS_0_HEALTH_DEV";
const char *GPS_1_HEALTH_DEV_STRING = "GPS_1_HEALTH_DEV";
const char *IMTQ_POLLING_STRING = "IMTQ_POLLING";
const char *IMTQ_HANDLER_STRING = "IMTQ_HANDLER";
const char *PCDU_HANDLER_STRING = "PCDU_HANDLER";
const char *P60DOCK_HANDLER_STRING = "P60DOCK_HANDLER";
const char *PDU1_HANDLER_STRING = "PDU1_HANDLER";
const char *PDU2_HANDLER_STRING = "PDU2_HANDLER";
const char *ACU_HANDLER_STRING = "ACU_HANDLER";
const char *BPX_BATT_HANDLER_STRING = "BPX_BATT_HANDLER";
const char *PLPCDU_HANDLER_STRING = "PLPCDU_HANDLER";
const char *RAD_SENSOR_STRING = "RAD_SENSOR";
const char *PLOC_UPDATER_STRING = "PLOC_UPDATER";
const char *PLOC_MEMORY_DUMPER_STRING = "PLOC_MEMORY_DUMPER";
const char *STR_COM_IF_STRING = "STR_COM_IF";
const char *PLOC_MPSOC_HELPER_STRING = "PLOC_MPSOC_HELPER";
const char *AXI_PTME_CONFIG_STRING = "AXI_PTME_CONFIG";
const char *PTME_CONFIG_STRING = "PTME_CONFIG";
const char *PTME_VC0_LIVE_TM_STRING = "PTME_VC0_LIVE_TM";
const char *PTME_VC1_LOG_TM_STRING = "PTME_VC1_LOG_TM";
const char *PTME_VC2_HK_TM_STRING = "PTME_VC2_HK_TM";
const char *PTME_VC3_CFDP_TM_STRING = "PTME_VC3_CFDP_TM";
const char *PLOC_MPSOC_HANDLER_STRING = "PLOC_MPSOC_HANDLER";
const char *PLOC_SUPERVISOR_HANDLER_STRING = "PLOC_SUPERVISOR_HANDLER";
const char *PLOC_SUPERVISOR_HELPER_STRING = "PLOC_SUPERVISOR_HELPER";
const char *PLOC_MPSOC_COMMUNICATION_STRING = "PLOC_MPSOC_COMMUNICATION";
const char *SCEX_STRING = "SCEX";
const char *SOLAR_ARRAY_DEPL_HANDLER_STRING = "SOLAR_ARRAY_DEPL_HANDLER";
const char *HEATER_HANDLER_STRING = "HEATER_HANDLER";
const char *TMP1075_HANDLER_TCS_0_STRING = "TMP1075_HANDLER_TCS_0";
const char *TMP1075_HANDLER_TCS_1_STRING = "TMP1075_HANDLER_TCS_1";
const char *TMP1075_HANDLER_PLPCDU_0_STRING = "TMP1075_HANDLER_PLPCDU_0";
const char *TMP1075_HANDLER_PLPCDU_1_STRING = "TMP1075_HANDLER_PLPCDU_1";
const char *TMP1075_HANDLER_IF_BOARD_STRING = "TMP1075_HANDLER_IF_BOARD";
const char *RTD_0_IC3_PLOC_HEATSPREADER_STRING = "RTD_0_IC3_PLOC_HEATSPREADER";
const char *RTD_1_IC4_PLOC_MISSIONBOARD_STRING = "RTD_1_IC4_PLOC_MISSIONBOARD";
const char *RTD_2_IC5_4K_CAMERA_STRING = "RTD_2_IC5_4K_CAMERA";
const char *RTD_3_IC6_DAC_HEATSPREADER_STRING = "RTD_3_IC6_DAC_HEATSPREADER";
const char *RTD_4_IC7_STARTRACKER_STRING = "RTD_4_IC7_STARTRACKER";
const char *RTD_5_IC8_RW1_MX_MY_STRING = "RTD_5_IC8_RW1_MX_MY";
const char *RTD_6_IC9_DRO_STRING = "RTD_6_IC9_DRO";
const char *RTD_7_IC10_SCEX_STRING = "RTD_7_IC10_SCEX";
const char *RTD_8_IC11_X8_STRING = "RTD_8_IC11_X8";
const char *RTD_9_IC12_HPA_STRING = "RTD_9_IC12_HPA";
const char *RTD_10_IC13_PL_TX_STRING = "RTD_10_IC13_PL_TX";
const char *RTD_11_IC14_MPA_STRING = "RTD_11_IC14_MPA";
const char *RTD_12_IC15_ACU_STRING = "RTD_12_IC15_ACU";
const char *RTD_13_IC16_PLPCDU_HEATSPREADER_STRING = "RTD_13_IC16_PLPCDU_HEATSPREADER";
const char *RTD_14_IC17_TCS_BOARD_STRING = "RTD_14_IC17_TCS_BOARD";
const char *RTD_15_IC18_IMTQ_STRING = "RTD_15_IC18_IMTQ";
const char *SYRLINKS_HANDLER_STRING = "SYRLINKS_HANDLER";
const char *SYRLINKS_COM_HANDLER_STRING = "SYRLINKS_COM_HANDLER";
const char *ARDUINO_COM_IF_STRING = "ARDUINO_COM_IF"; const char *ARDUINO_COM_IF_STRING = "ARDUINO_COM_IF";
const char *DUMMY_COM_IF_STRING = "DUMMY_COM_IF";
const char *SCEX_UART_READER_STRING = "SCEX_UART_READER";
const char *UART_COM_IF_STRING = "UART_COM_IF";
const char *ACS_BOARD_POLLING_TASK_STRING = "ACS_BOARD_POLLING_TASK";
const char *RW_POLLING_TASK_STRING = "RW_POLLING_TASK";
const char *SPI_RTD_COM_IF_STRING = "SPI_RTD_COM_IF";
const char *SUS_POLLING_TASK_STRING = "SUS_POLLING_TASK";
const char *CCSDS_PACKET_DISTRIBUTOR_STRING = "CCSDS_PACKET_DISTRIBUTOR";
const char *PUS_PACKET_DISTRIBUTOR_STRING = "PUS_PACKET_DISTRIBUTOR";
const char *TCP_TMTC_SERVER_STRING = "TCP_TMTC_SERVER";
const char *UDP_TMTC_SERVER_STRING = "UDP_TMTC_SERVER";
const char *TCP_TMTC_POLLING_TASK_STRING = "TCP_TMTC_POLLING_TASK";
const char *UDP_TMTC_POLLING_TASK_STRING = "UDP_TMTC_POLLING_TASK";
const char *FILE_SYSTEM_HANDLER_STRING = "FILE_SYSTEM_HANDLER";
const char *SDC_MANAGER_STRING = "SDC_MANAGER";
const char *PTME_STRING = "PTME";
const char *PDEC_HANDLER_STRING = "PDEC_HANDLER";
const char *CCSDS_HANDLER_STRING = "CCSDS_HANDLER";
const char *PUS_SERVICE_3_STRING = "PUS_SERVICE_3"; const char *PUS_SERVICE_3_STRING = "PUS_SERVICE_3";
const char *PUS_SERVICE_5_STRING = "PUS_SERVICE_5"; const char *PUS_SERVICE_5_STRING = "PUS_SERVICE_5";
const char *PUS_SERVICE_6_STRING = "PUS_SERVICE_6"; const char *PUS_SERVICE_6_STRING = "PUS_SERVICE_6";
const char *PUS_SERVICE_8_STRING = "PUS_SERVICE_8"; const char *PUS_SERVICE_8_STRING = "PUS_SERVICE_8";
const char *PUS_SERVICE_23_STRING = "PUS_SERVICE_23"; const char *PUS_SERVICE_23_STRING = "PUS_SERVICE_23";
const char *PUS_SERVICE_201_STRING = "PUS_SERVICE_201"; const char *PUS_SERVICE_201_STRING = "PUS_SERVICE_201";
const char *TM_FUNNEL_STRING = "TM_FUNNEL";
const char *FSFW_OBJECTS_START_STRING = "FSFW_OBJECTS_START"; const char *FSFW_OBJECTS_START_STRING = "FSFW_OBJECTS_START";
const char *PUS_SERVICE_1_VERIFICATION_STRING = "PUS_SERVICE_1_VERIFICATION"; const char *PUS_SERVICE_1_VERIFICATION_STRING = "PUS_SERVICE_1_VERIFICATION";
const char *PUS_SERVICE_2_DEVICE_ACCESS_STRING = "PUS_SERVICE_2_DEVICE_ACCESS"; const char *PUS_SERVICE_2_DEVICE_ACCESS_STRING = "PUS_SERVICE_2_DEVICE_ACCESS";
@ -124,13 +25,9 @@ const char *PUS_SERVICE_3_HOUSEKEEPING_STRING = "PUS_SERVICE_3_HOUSEKEEPING";
const char *PUS_SERVICE_5_EVENT_REPORTING_STRING = "PUS_SERVICE_5_EVENT_REPORTING"; const char *PUS_SERVICE_5_EVENT_REPORTING_STRING = "PUS_SERVICE_5_EVENT_REPORTING";
const char *PUS_SERVICE_8_FUNCTION_MGMT_STRING = "PUS_SERVICE_8_FUNCTION_MGMT"; const char *PUS_SERVICE_8_FUNCTION_MGMT_STRING = "PUS_SERVICE_8_FUNCTION_MGMT";
const char *PUS_SERVICE_9_TIME_MGMT_STRING = "PUS_SERVICE_9_TIME_MGMT"; const char *PUS_SERVICE_9_TIME_MGMT_STRING = "PUS_SERVICE_9_TIME_MGMT";
const char *PUS_SERVICE_11_TC_SCHEDULER_STRING = "PUS_SERVICE_11_TC_SCHEDULER";
const char *PUS_SERVICE_15_TM_STORAGE_STRING = "PUS_SERVICE_15_TM_STORAGE";
const char *PUS_SERVICE_17_TEST_STRING = "PUS_SERVICE_17_TEST"; const char *PUS_SERVICE_17_TEST_STRING = "PUS_SERVICE_17_TEST";
const char *PUS_SERVICE_20_PARAMETERS_STRING = "PUS_SERVICE_20_PARAMETERS"; const char *PUS_SERVICE_20_PARAMETERS_STRING = "PUS_SERVICE_20_PARAMETERS";
const char *PUS_SERVICE_200_MODE_MGMT_STRING = "PUS_SERVICE_200_MODE_MGMT"; const char *PUS_SERVICE_200_MODE_MGMT_STRING = "PUS_SERVICE_200_MODE_MGMT";
const char *PUS_SERVICE_201_HEALTH_STRING = "PUS_SERVICE_201_HEALTH";
const char *CFDP_PACKET_DISTRIBUTOR_STRING = "CFDP_PACKET_DISTRIBUTOR";
const char *HEALTH_TABLE_STRING = "HEALTH_TABLE"; const char *HEALTH_TABLE_STRING = "HEALTH_TABLE";
const char *MODE_STORE_STRING = "MODE_STORE"; const char *MODE_STORE_STRING = "MODE_STORE";
const char *EVENT_MANAGER_STRING = "EVENT_MANAGER"; const char *EVENT_MANAGER_STRING = "EVENT_MANAGER";
@ -139,262 +36,19 @@ const char *TC_STORE_STRING = "TC_STORE";
const char *TM_STORE_STRING = "TM_STORE"; const char *TM_STORE_STRING = "TM_STORE";
const char *IPC_STORE_STRING = "IPC_STORE"; const char *IPC_STORE_STRING = "IPC_STORE";
const char *TIME_STAMPER_STRING = "TIME_STAMPER"; const char *TIME_STAMPER_STRING = "TIME_STAMPER";
const char *VERIFICATION_REPORTER_STRING = "VERIFICATION_REPORTER";
const char *FSFW_OBJECTS_END_STRING = "FSFW_OBJECTS_END"; const char *FSFW_OBJECTS_END_STRING = "FSFW_OBJECTS_END";
const char *HEATER_0_PLOC_PROC_BRD_STRING = "HEATER_0_PLOC_PROC_BRD";
const char *HEATER_1_PCDU_BRD_STRING = "HEATER_1_PCDU_BRD";
const char *HEATER_2_ACS_BRD_STRING = "HEATER_2_ACS_BRD";
const char *HEATER_3_OBC_BRD_STRING = "HEATER_3_OBC_BRD";
const char *HEATER_4_CAMERA_STRING = "HEATER_4_CAMERA";
const char *HEATER_5_STR_STRING = "HEATER_5_STR";
const char *HEATER_6_DRO_STRING = "HEATER_6_DRO";
const char *HEATER_7_SYRLINKS_STRING = "HEATER_7_SYRLINKS";
const char *ACS_BOARD_ASS_STRING = "ACS_BOARD_ASS";
const char *SUS_BOARD_ASS_STRING = "SUS_BOARD_ASS";
const char *TCS_BOARD_ASS_STRING = "TCS_BOARD_ASS";
const char *RW_ASSY_STRING = "RW_ASSY";
const char *CAM_SWITCHER_STRING = "CAM_SWITCHER";
const char *SYRLINKS_ASSY_STRING = "SYRLINKS_ASSY";
const char *IMTQ_ASSY_STRING = "IMTQ_ASSY";
const char *STR_ASSY_STRING = "STR_ASSY";
const char *TM_FUNNEL_STRING = "TM_FUNNEL";
const char *PUS_TM_FUNNEL_STRING = "PUS_TM_FUNNEL";
const char *CFDP_TM_FUNNEL_STRING = "CFDP_TM_FUNNEL";
const char *CFDP_HANDLER_STRING = "CFDP_HANDLER";
const char *CFDP_DISTRIBUTOR_STRING = "CFDP_DISTRIBUTOR";
const char *CFDP_FAULT_HANDLER_STRING = "CFDP_FAULT_HANDLER";
const char *EIVE_SYSTEM_STRING = "EIVE_SYSTEM";
const char *ACS_SUBSYSTEM_STRING = "ACS_SUBSYSTEM";
const char *PL_SUBSYSTEM_STRING = "PL_SUBSYSTEM";
const char *TCS_SUBSYSTEM_STRING = "TCS_SUBSYSTEM";
const char *COM_SUBSYSTEM_STRING = "COM_SUBSYSTEM";
const char *EPS_SUBSYSTEM_STRING = "EPS_SUBSYSTEM";
const char *MISC_TM_STORE_STRING = "MISC_TM_STORE";
const char *OK_TM_STORE_STRING = "OK_TM_STORE";
const char *NOT_OK_TM_STORE_STRING = "NOT_OK_TM_STORE";
const char *HK_TM_STORE_STRING = "HK_TM_STORE";
const char *CFDP_TM_STORE_STRING = "CFDP_TM_STORE";
const char *LIVE_TM_TASK_STRING = "LIVE_TM_TASK";
const char *LOG_STORE_AND_TM_TASK_STRING = "LOG_STORE_AND_TM_TASK";
const char *HK_STORE_AND_TM_TASK_STRING = "HK_STORE_AND_TM_TASK";
const char *CFDP_STORE_AND_TM_TASK_STRING = "CFDP_STORE_AND_TM_TASK";
const char *DOWNLINK_RAM_STORE_STRING = "DOWNLINK_RAM_STORE";
const char *THERMAL_TEMP_INSERTER_STRING = "THERMAL_TEMP_INSERTER";
const char *DUMMY_INTERFACE_STRING = "DUMMY_INTERFACE"; const char *DUMMY_INTERFACE_STRING = "DUMMY_INTERFACE";
const char *THERMAL_CONTROLLER_STRING = "THERMAL_CONTROLLER";
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 0x43000002: case 0x4400AFFE:
return ACS_CONTROLLER_STRING;
case 0x43000003:
return CORE_CONTROLLER_STRING;
case 0x43000004:
return POWER_CONTROLLER_STRING;
case 0x43000006:
return GLOBAL_JSON_CFG_STRING;
case 0x43000007:
return XIPHOS_WDT_STRING;
case 0x43400001:
return THERMAL_CONTROLLER_STRING;
case 0x44000001:
return DUMMY_HANDLER_STRING; return DUMMY_HANDLER_STRING;
case 0x44120006:
return MGM_0_LIS3_HANDLER_STRING;
case 0x44120010:
return GYRO_0_ADIS_HANDLER_STRING;
case 0x44120032:
return SUS_0_N_LOC_XFYFZM_PT_XF_STRING;
case 0x44120033:
return SUS_1_N_LOC_XBYFZM_PT_XB_STRING;
case 0x44120034:
return SUS_2_N_LOC_XFYBZB_PT_YB_STRING;
case 0x44120035:
return SUS_3_N_LOC_XFYBZF_PT_YF_STRING;
case 0x44120036:
return SUS_4_N_LOC_XMYFZF_PT_ZF_STRING;
case 0x44120037:
return SUS_5_N_LOC_XFYMZB_PT_ZB_STRING;
case 0x44120038:
return SUS_6_R_LOC_XFYBZM_PT_XF_STRING;
case 0x44120039:
return SUS_7_R_LOC_XBYBZM_PT_XB_STRING;
case 0x44120040:
return SUS_8_R_LOC_XBYBZB_PT_YB_STRING;
case 0x44120041:
return SUS_9_R_LOC_XBYBZB_PT_YF_STRING;
case 0x44120042:
return SUS_10_N_LOC_XMYBZF_PT_ZF_STRING;
case 0x44120043:
return SUS_11_R_LOC_XBYMZB_PT_ZB_STRING;
case 0x44120047:
return RW1_STRING;
case 0x44120107:
return MGM_1_RM3100_HANDLER_STRING;
case 0x44120111:
return GYRO_1_L3G_HANDLER_STRING;
case 0x44120148:
return RW2_STRING;
case 0x44120208:
return MGM_2_LIS3_HANDLER_STRING;
case 0x44120212:
return GYRO_2_ADIS_HANDLER_STRING;
case 0x44120249:
return RW3_STRING;
case 0x44120309:
return MGM_3_RM3100_HANDLER_STRING;
case 0x44120313:
return GYRO_3_L3G_HANDLER_STRING;
case 0x44120350:
return RW4_STRING;
case 0x44130001:
return STAR_TRACKER_STRING;
case 0x44130045:
return GPS_CONTROLLER_STRING;
case 0x44130046:
return GPS_0_HEALTH_DEV_STRING;
case 0x44130047:
return GPS_1_HEALTH_DEV_STRING;
case 0x44140013:
return IMTQ_POLLING_STRING;
case 0x44140014:
return IMTQ_HANDLER_STRING;
case 0x442000A1:
return PCDU_HANDLER_STRING;
case 0x44250000:
return P60DOCK_HANDLER_STRING;
case 0x44250001:
return PDU1_HANDLER_STRING;
case 0x44250002:
return PDU2_HANDLER_STRING;
case 0x44250003:
return ACU_HANDLER_STRING;
case 0x44260000:
return BPX_BATT_HANDLER_STRING;
case 0x44300000:
return PLPCDU_HANDLER_STRING;
case 0x443200A5:
return RAD_SENSOR_STRING;
case 0x44330000:
return PLOC_UPDATER_STRING;
case 0x44330001:
return PLOC_MEMORY_DUMPER_STRING;
case 0x44330002:
return STR_COM_IF_STRING;
case 0x44330003:
return PLOC_MPSOC_HELPER_STRING;
case 0x44330004:
return AXI_PTME_CONFIG_STRING;
case 0x44330005:
return PTME_CONFIG_STRING;
case 0x44330006:
return PTME_VC0_LIVE_TM_STRING;
case 0x44330007:
return PTME_VC1_LOG_TM_STRING;
case 0x44330008:
return PTME_VC2_HK_TM_STRING;
case 0x44330009:
return PTME_VC3_CFDP_TM_STRING;
case 0x44330015:
return PLOC_MPSOC_HANDLER_STRING;
case 0x44330016:
return PLOC_SUPERVISOR_HANDLER_STRING;
case 0x44330017:
return PLOC_SUPERVISOR_HELPER_STRING;
case 0x44330018:
return PLOC_MPSOC_COMMUNICATION_STRING;
case 0x44330032:
return SCEX_STRING;
case 0x444100A2:
return SOLAR_ARRAY_DEPL_HANDLER_STRING;
case 0x444100A4:
return HEATER_HANDLER_STRING;
case 0x44420004:
return TMP1075_HANDLER_TCS_0_STRING;
case 0x44420005:
return TMP1075_HANDLER_TCS_1_STRING;
case 0x44420006:
return TMP1075_HANDLER_PLPCDU_0_STRING;
case 0x44420007:
return TMP1075_HANDLER_PLPCDU_1_STRING;
case 0x44420008:
return TMP1075_HANDLER_IF_BOARD_STRING;
case 0x44420016:
return RTD_0_IC3_PLOC_HEATSPREADER_STRING;
case 0x44420017:
return RTD_1_IC4_PLOC_MISSIONBOARD_STRING;
case 0x44420018:
return RTD_2_IC5_4K_CAMERA_STRING;
case 0x44420019:
return RTD_3_IC6_DAC_HEATSPREADER_STRING;
case 0x44420020:
return RTD_4_IC7_STARTRACKER_STRING;
case 0x44420021:
return RTD_5_IC8_RW1_MX_MY_STRING;
case 0x44420022:
return RTD_6_IC9_DRO_STRING;
case 0x44420023:
return RTD_7_IC10_SCEX_STRING;
case 0x44420024:
return RTD_8_IC11_X8_STRING;
case 0x44420025:
return RTD_9_IC12_HPA_STRING;
case 0x44420026:
return RTD_10_IC13_PL_TX_STRING;
case 0x44420027:
return RTD_11_IC14_MPA_STRING;
case 0x44420028:
return RTD_12_IC15_ACU_STRING;
case 0x44420029:
return RTD_13_IC16_PLPCDU_HEATSPREADER_STRING;
case 0x44420030:
return RTD_14_IC17_TCS_BOARD_STRING;
case 0x44420031:
return RTD_15_IC18_IMTQ_STRING;
case 0x445300A3:
return SYRLINKS_HANDLER_STRING;
case 0x445300A4:
return SYRLINKS_COM_HANDLER_STRING;
case 0x49000001: case 0x49000001:
return ARDUINO_COM_IF_STRING; return ARDUINO_COM_IF_STRING;
case 0x49000002:
return DUMMY_COM_IF_STRING;
case 0x49010006:
return SCEX_UART_READER_STRING;
case 0x49030003:
return UART_COM_IF_STRING;
case 0x49060004:
return ACS_BOARD_POLLING_TASK_STRING;
case 0x49060005:
return RW_POLLING_TASK_STRING;
case 0x49060006:
return SPI_RTD_COM_IF_STRING;
case 0x49060007:
return SUS_POLLING_TASK_STRING;
case 0x50000100:
return CCSDS_PACKET_DISTRIBUTOR_STRING;
case 0x50000200:
return PUS_PACKET_DISTRIBUTOR_STRING;
case 0x50000300:
return TCP_TMTC_SERVER_STRING;
case 0x50000301:
return UDP_TMTC_SERVER_STRING;
case 0x50000400:
return TCP_TMTC_POLLING_TASK_STRING;
case 0x50000401:
return UDP_TMTC_POLLING_TASK_STRING;
case 0x50000500:
return FILE_SYSTEM_HANDLER_STRING;
case 0x50000550:
return SDC_MANAGER_STRING;
case 0x50000600:
return PTME_STRING;
case 0x50000700:
return PDEC_HANDLER_STRING;
case 0x50000800:
return CCSDS_HANDLER_STRING;
case 0x51000300: case 0x51000300:
return PUS_SERVICE_3_STRING; return PUS_SERVICE_3_STRING;
case 0x51000400: case 0x51000400:
@ -407,6 +61,8 @@ const char *translateObject(object_id_t object) {
return PUS_SERVICE_23_STRING; return PUS_SERVICE_23_STRING;
case 0x51020100: case 0x51020100:
return PUS_SERVICE_201_STRING; return PUS_SERVICE_201_STRING;
case 0x52000002:
return TM_FUNNEL_STRING;
case 0x53000000: case 0x53000000:
return FSFW_OBJECTS_START_STRING; return FSFW_OBJECTS_START_STRING;
case 0x53000001: case 0x53000001:
@ -421,20 +77,12 @@ const char *translateObject(object_id_t object) {
return PUS_SERVICE_8_FUNCTION_MGMT_STRING; return PUS_SERVICE_8_FUNCTION_MGMT_STRING;
case 0x53000009: case 0x53000009:
return PUS_SERVICE_9_TIME_MGMT_STRING; return PUS_SERVICE_9_TIME_MGMT_STRING;
case 0x53000011:
return PUS_SERVICE_11_TC_SCHEDULER_STRING;
case 0x53000015:
return PUS_SERVICE_15_TM_STORAGE_STRING;
case 0x53000017: case 0x53000017:
return PUS_SERVICE_17_TEST_STRING; return PUS_SERVICE_17_TEST_STRING;
case 0x53000020: case 0x53000020:
return PUS_SERVICE_20_PARAMETERS_STRING; return PUS_SERVICE_20_PARAMETERS_STRING;
case 0x53000200: case 0x53000200:
return PUS_SERVICE_200_MODE_MGMT_STRING; return PUS_SERVICE_200_MODE_MGMT_STRING;
case 0x53000201:
return PUS_SERVICE_201_HEALTH_STRING;
case 0x53001000:
return CFDP_PACKET_DISTRIBUTOR_STRING;
case 0x53010000: case 0x53010000:
return HEALTH_TABLE_STRING; return HEALTH_TABLE_STRING;
case 0x53010100: case 0x53010100:
@ -451,90 +99,12 @@ const char *translateObject(object_id_t object) {
return IPC_STORE_STRING; return IPC_STORE_STRING;
case 0x53500010: case 0x53500010:
return TIME_STAMPER_STRING; return TIME_STAMPER_STRING;
case 0x53500020:
return VERIFICATION_REPORTER_STRING;
case 0x53ffffff: case 0x53ffffff:
return FSFW_OBJECTS_END_STRING; return FSFW_OBJECTS_END_STRING;
case 0x60000000:
return HEATER_0_PLOC_PROC_BRD_STRING;
case 0x60000001:
return HEATER_1_PCDU_BRD_STRING;
case 0x60000002:
return HEATER_2_ACS_BRD_STRING;
case 0x60000003:
return HEATER_3_OBC_BRD_STRING;
case 0x60000004:
return HEATER_4_CAMERA_STRING;
case 0x60000005:
return HEATER_5_STR_STRING;
case 0x60000006:
return HEATER_6_DRO_STRING;
case 0x60000007:
return HEATER_7_SYRLINKS_STRING;
case 0x73000001:
return ACS_BOARD_ASS_STRING;
case 0x73000002:
return SUS_BOARD_ASS_STRING;
case 0x73000003:
return TCS_BOARD_ASS_STRING;
case 0x73000004:
return RW_ASSY_STRING;
case 0x73000006:
return CAM_SWITCHER_STRING;
case 0x73000007:
return SYRLINKS_ASSY_STRING;
case 0x73000008:
return IMTQ_ASSY_STRING;
case 0x73000009:
return STR_ASSY_STRING;
case 0x73000100:
return TM_FUNNEL_STRING;
case 0x73000101:
return PUS_TM_FUNNEL_STRING;
case 0x73000102:
return CFDP_TM_FUNNEL_STRING;
case 0x73000205:
return CFDP_HANDLER_STRING;
case 0x73000206:
return CFDP_DISTRIBUTOR_STRING;
case 0x73000207:
return CFDP_FAULT_HANDLER_STRING;
case 0x73010000:
return EIVE_SYSTEM_STRING;
case 0x73010001:
return ACS_SUBSYSTEM_STRING;
case 0x73010002:
return PL_SUBSYSTEM_STRING;
case 0x73010003:
return TCS_SUBSYSTEM_STRING;
case 0x73010004:
return COM_SUBSYSTEM_STRING;
case 0x73010005:
return EPS_SUBSYSTEM_STRING;
case 0x73020001:
return MISC_TM_STORE_STRING;
case 0x73020002:
return OK_TM_STORE_STRING;
case 0x73020003:
return NOT_OK_TM_STORE_STRING;
case 0x73020004:
return HK_TM_STORE_STRING;
case 0x73030000:
return CFDP_TM_STORE_STRING;
case 0x73040000:
return LIVE_TM_TASK_STRING;
case 0x73040001:
return LOG_STORE_AND_TM_TASK_STRING;
case 0x73040002:
return HK_STORE_AND_TM_TASK_STRING;
case 0x73040003:
return CFDP_STORE_AND_TM_TASK_STRING;
case 0x73040004:
return DOWNLINK_RAM_STORE_STRING;
case 0x90000003:
return THERMAL_TEMP_INSERTER_STRING;
case 0xCAFECAFE: case 0xCAFECAFE:
return DUMMY_INTERFACE_STRING; return DUMMY_INTERFACE_STRING;
case objects::THERMAL_CONTROLLER:
return THERMAL_CONTROLLER_STRING;
case 0xFFFFFFFF: case 0xFFFFFFFF:
return NO_OBJECT_STRING; return NO_OBJECT_STRING;
default: default:

View File

@ -3,6 +3,6 @@
#include <fsfw/objectmanager/SystemObjectIF.h> #include <fsfw/objectmanager/SystemObjectIF.h>
const char *translateObject(object_id_t object); const char* translateObject(object_id_t object);
#endif /* FSFWCONFIG_OBJECTS_TRANSLATEOBJECTS_H_ */ #endif /* FSFWCONFIG_OBJECTS_TRANSLATEOBJECTS_H_ */

View File

@ -44,11 +44,12 @@ ReturnValue_t dummy_pst::pst(FixedTimeslotTaskIF *thisSequence) {
thisSequence->addSlot(objects::STAR_TRACKER, length * 0, DeviceHandlerIF::SEND_READ); thisSequence->addSlot(objects::STAR_TRACKER, length * 0, DeviceHandlerIF::SEND_READ);
thisSequence->addSlot(objects::STAR_TRACKER, length * 0, DeviceHandlerIF::GET_READ); thisSequence->addSlot(objects::STAR_TRACKER, length * 0, DeviceHandlerIF::GET_READ);
thisSequence->addSlot(objects::SYRLINKS_HANDLER, length * 0, DeviceHandlerIF::PERFORM_OPERATION); thisSequence->addSlot(objects::SYRLINKS_HK_HANDLER, length * 0,
thisSequence->addSlot(objects::SYRLINKS_HANDLER, length * 0, DeviceHandlerIF::SEND_WRITE); DeviceHandlerIF::PERFORM_OPERATION);
thisSequence->addSlot(objects::SYRLINKS_HANDLER, length * 0, DeviceHandlerIF::GET_WRITE); thisSequence->addSlot(objects::SYRLINKS_HK_HANDLER, length * 0, DeviceHandlerIF::SEND_WRITE);
thisSequence->addSlot(objects::SYRLINKS_HANDLER, length * 0, DeviceHandlerIF::SEND_READ); thisSequence->addSlot(objects::SYRLINKS_HK_HANDLER, length * 0, DeviceHandlerIF::GET_WRITE);
thisSequence->addSlot(objects::SYRLINKS_HANDLER, length * 0, DeviceHandlerIF::GET_READ); thisSequence->addSlot(objects::SYRLINKS_HK_HANDLER, length * 0, DeviceHandlerIF::SEND_READ);
thisSequence->addSlot(objects::SYRLINKS_HK_HANDLER, length * 0, DeviceHandlerIF::GET_READ);
thisSequence->addSlot(objects::IMTQ_HANDLER, length * 0, DeviceHandlerIF::PERFORM_OPERATION); thisSequence->addSlot(objects::IMTQ_HANDLER, length * 0, DeviceHandlerIF::PERFORM_OPERATION);
thisSequence->addSlot(objects::IMTQ_HANDLER, length * 0, DeviceHandlerIF::SEND_WRITE); thisSequence->addSlot(objects::IMTQ_HANDLER, length * 0, DeviceHandlerIF::SEND_WRITE);
@ -128,12 +129,12 @@ ReturnValue_t dummy_pst::pst(FixedTimeslotTaskIF *thisSequence) {
thisSequence->addSlot(objects::PLPCDU_HANDLER, length * 0, DeviceHandlerIF::SEND_READ); thisSequence->addSlot(objects::PLPCDU_HANDLER, length * 0, DeviceHandlerIF::SEND_READ);
thisSequence->addSlot(objects::PLPCDU_HANDLER, length * 0, DeviceHandlerIF::GET_READ); thisSequence->addSlot(objects::PLPCDU_HANDLER, length * 0, DeviceHandlerIF::GET_READ);
if (thisSequence->checkSequence() == returnvalue::OK) { if (thisSequence->checkSequence() == HasReturnvaluesIF::RETURN_OK) {
return returnvalue::OK; return HasReturnvaluesIF::RETURN_OK;
} else { } else {
#if FSFW_CPP_OSTREAM_ENABLED == 1 #if FSFW_CPP_OSTREAM_ENABLED == 1
sif::error << "pst::pollingSequenceInitDefault: Sequence invalid!" << std::endl; sif::error << "pst::pollingSequenceInitDefault: Sequence invalid!" << std::endl;
#endif #endif
return returnvalue::FAILED; return HasReturnvaluesIF::RETURN_FAILED;
} }
} }

View File

@ -1,7 +1,7 @@
#ifndef POLLINGSEQUENCEFACTORY_H_ #ifndef POLLINGSEQUENCEFACTORY_H_
#define POLLINGSEQUENCEFACTORY_H_ #define POLLINGSEQUENCEFACTORY_H_
#include <fsfw/returnvalues/returnvalue.h> #include <fsfw/returnvalues/HasReturnvaluesIF.h>
class FixedTimeslotTaskIF; class FixedTimeslotTaskIF;

View File

@ -3,7 +3,7 @@
#include <fsfw/returnvalues/FwClassIds.h> #include <fsfw/returnvalues/FwClassIds.h>
#include "eive/resultClassIds.h" #include "commonClassIds.h"
/** /**
* Source IDs starts at 73 for now * Source IDs starts at 73 for now
@ -13,7 +13,6 @@
namespace CLASS_ID { namespace CLASS_ID {
enum { enum {
CLASS_ID_START = COMMON_CLASS_ID_END, CLASS_ID_START = COMMON_CLASS_ID_END,
CLASS_ID_END // [EXPORT] : [END]
}; };
} }

View File

@ -2,6 +2,7 @@
#include <iostream> #include <iostream>
#include "InitMission.h"
#include "commonConfig.h" #include "commonConfig.h"
#include "fsfw/FSFWVersion.h" #include "fsfw/FSFWVersion.h"
#include "fsfw/controller/ControllerBase.h" #include "fsfw/controller/ControllerBase.h"
@ -10,7 +11,6 @@
#include "fsfw/modes/ModeMessage.h" #include "fsfw/modes/ModeMessage.h"
#include "fsfw/objectmanager/ObjectManager.h" #include "fsfw/objectmanager/ObjectManager.h"
#include "fsfw/tasks/TaskFactory.h" #include "fsfw/tasks/TaskFactory.h"
#include "scheduling.h"
#ifdef WIN32 #ifdef WIN32
static const char* COMPILE_PRINTOUT = "Windows"; static const char* COMPILE_PRINTOUT = "Windows";
@ -31,11 +31,8 @@ int main(void) {
<< "v" << common::OBSW_VERSION << " | FSFW v" << fsfw::FSFW_VERSION << " --" << "v" << common::OBSW_VERSION << " | FSFW v" << fsfw::FSFW_VERSION << " --"
<< std::endl; << std::endl;
std::cout << "-- " << __DATE__ << " " << __TIME__ << " --" << std::endl; std::cout << "-- " << __DATE__ << " " << __TIME__ << " --" << std::endl;
std::cout << "-- "
<< " BSP HOSTED"
<< " --" << std::endl;
scheduling::initMission(); initmission::initMission();
for (;;) { for (;;) {
// suspend main thread by sleeping it. // suspend main thread by sleeping it.

View File

@ -1,124 +0,0 @@
#include "objectFactory.h"
#include <fsfw/power/DummyPowerSwitcher.h>
#include <fsfw/tmtcservices/CommandingServiceBase.h>
#include <fsfw/tmtcservices/PusServiceBase.h>
#include <mission/controller/ThermalController.h>
#include <mission/genericFactory.h>
#include <mission/tmtc/TmFunnelHandler.h>
#include <objects/systemObjectList.h>
#include "../mission/utility/DummySdCardManager.h"
#include "OBSWConfig.h"
#include "fsfw/platform.h"
#include "fsfw/power/PowerSwitchIF.h"
#include "fsfw_tests/integration/task/TestTask.h"
#if OBSW_ADD_TMTC_UDP_SERVER == 1
#include "fsfw/osal/common/UdpTcPollingTask.h"
#include "fsfw/osal/common/UdpTmTcBridge.h"
#endif
#if OBSW_ADD_TMTC_TCP_SERVER == 1
#include "fsfw/osal/common/TcpTmTcBridge.h"
#include "fsfw/osal/common/TcpTmTcServer.h"
#endif
#if OBSW_ADD_TEST_CODE == 1
#include <test/testtasks/TestTask.h>
#endif
#include <dummies/AcuDummy.h>
#include <dummies/CoreControllerDummy.h>
#include "dummies/helperFactory.h"
#ifdef PLATFORM_UNIX
#include <fsfw_hal/linux/serial/SerialComIF.h>
#include <fsfw_hal/linux/serial/SerialCookie.h>
#include "devices/gpioIds.h"
#include "fsfw_hal/linux/gpio/Gpio.h"
#include "linux/payload/FreshSupvHandler.h"
#include "linux/payload/PlocSupvUartMan.h"
#include "test/gpio/DummyGpioIF.h"
#endif
void Factory::setStaticFrameworkObjectIds() {
PusServiceBase::PUS_DISTRIBUTOR = objects::PUS_PACKET_DISTRIBUTOR;
PusServiceBase::PACKET_DESTINATION = objects::PUS_TM_FUNNEL;
CommandingServiceBase::defaultPacketSource = objects::PUS_PACKET_DISTRIBUTOR;
CommandingServiceBase::defaultPacketDestination = objects::PUS_TM_FUNNEL;
VerificationReporter::DEFAULT_RECEIVER = objects::PUS_SERVICE_1_VERIFICATION;
}
void ObjectFactory::produce(void* args) {
Factory::setStaticFrameworkObjectIds();
PusTmFunnel* pusFunnel;
CfdpTmFunnel* cfdpFunnel;
StorageManagerIF* tmStore;
StorageManagerIF* ipcStore;
PersistentTmStores persistentStores{};
bool enableHkSets = false;
#if OBSW_ENABLE_PERIODIC_HK == 1
enableHkSets = true;
#endif
auto sdcMan = new DummySdCardManager("/tmp");
ObjectFactory::produceGenericObjects(nullptr, &pusFunnel, &cfdpFunnel, *sdcMan, &ipcStore,
&tmStore, persistentStores, 120, enableHkSets, false);
new TmFunnelHandler(objects::LIVE_TM_TASK, *pusFunnel, *cfdpFunnel);
auto* dummyGpioIF = new DummyGpioIF();
auto* dummySwitcher = new DummyPowerSwitcher(objects::PCDU_HANDLER, 18, 0);
std::vector<ReturnValue_t> switcherList;
auto initVal = PowerSwitchIF::SWITCH_OFF;
for (unsigned i = 0; i < 18; i++) {
switcherList.emplace_back(initVal);
}
dummySwitcher->setInitialSwitcherList(switcherList);
#ifdef PLATFORM_UNIX
// Obsolete dev handler..
/*
new SerialComIF(objects::UART_COM_IF);
#if OBSW_ADD_PLOC_MPSOC == 1
std::string mpscoDev = "";
auto mpsocCookie = new UartCookie(objects::PLOC_MPSOC_HANDLER, mpscoDev, uart::PLOC_MPSOC_BAUD,
mpsoc::MAX_REPLY_SIZE, UartModes::NON_CANONICAL);
mpsocCookie->setNoFixedSizeReply();
auto plocMpsocHelper = new PlocMpsocSpecialComHelper(objects::PLOC_MPSOC_HELPER);
new PlocMpsocHandler(objects::PLOC_MPSOC_HANDLER, objects::UART_COM_IF, mpsocCookie,
plocMpsocHelper, Gpio(gpioIds::ENABLE_MPSOC_UART, dummyGpioIF),
objects::PLOC_SUPERVISOR_HANDLER);
#endif // OBSW_ADD_PLOC_MPSOC == 1
*/
#if OBSW_ADD_PLOC_SUPERVISOR == 1
std::string plocSupvString = "/dev/ploc_supv";
auto supervisorCookie =
new SerialCookie(objects::PLOC_SUPERVISOR_HANDLER, plocSupvString, uart::PLOC_SUPV_BAUD,
supv::MAX_PACKET_SIZE * 20, UartModes::NON_CANONICAL);
supervisorCookie->setNoFixedSizeReply();
new PlocSupvUartManager(objects::PLOC_SUPERVISOR_HELPER);
DhbConfig dhbConf(objects::PLOC_SUPERVISOR_HANDLER);
auto* supvHandler =
new FreshSupvHandler(dhbConf, supervisorCookie, Gpio(gpioIds::ENABLE_SUPV_UART, dummyGpioIF),
dummySwitcher, power::PDU1_CH6_PLOC_12V);
#endif /* OBSW_ADD_PLOC_SUPERVISOR == 1 */
#endif
dummy::DummyCfg cfg;
cfg.addPlPcduDummy = true;
cfg.addCamSwitcherDummy = true;
dummy::createDummies(cfg, *dummySwitcher, dummyGpioIF, enableHkSets);
HeaterHandler* heaterHandler = nullptr;
// new ThermalController(objects::THERMAL_CONTROLLER);
ObjectFactory::createGenericHeaterComponents(*dummyGpioIF, *dummySwitcher, heaterHandler);
if (heaterHandler == nullptr) {
sif::error << "HeaterHandler could not be created" << std::endl;
} else {
ObjectFactory::createThermalController(*heaterHandler, true);
}
new TestTask(objects::TEST_TASK);
}

View File

@ -1,280 +0,0 @@
#include "linux/scheduling.h"
#include <bsp_hosted/fsfwconfig/pollingsequence/DummyPst.h>
#include <fsfw/objectmanager/ObjectManager.h>
#include <fsfw/objectmanager/ObjectManagerIF.h>
#include <fsfw/returnvalues/returnvalue.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 <iostream>
#include "OBSWConfig.h"
#include "mission/scheduling.h"
#include "objectFactory.h"
#include "scheduling.h"
#ifdef LINUX
ServiceInterfaceStream sif::debug("DEBUG");
ServiceInterfaceStream sif::info("INFO");
ServiceInterfaceStream sif::warning("WARNING");
ServiceInterfaceStream sif::error("ERROR", false, false, true);
#else
ServiceInterfaceStream sif::debug("DEBUG", true);
ServiceInterfaceStream sif::info("INFO", true);
ServiceInterfaceStream sif::warning("WARNING", true);
ServiceInterfaceStream sif::error("ERROR", true, false, true);
#endif
ObjectManagerIF* objectManager = nullptr;
void scheduling::initMission() {
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 scheduling::initTasks() {
TaskFactory* factory = TaskFactory::instance();
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", 60, PeriodicTaskIF::MINIMUM_STACK_SIZE, 0.2, missedDeadlineFunc);
ReturnValue_t result = tmtcDistributor->addComponent(objects::CCSDS_PACKET_DISTRIBUTOR);
if (result != returnvalue::OK) {
sif::error << "Adding CCSDS distributor failed" << std::endl;
}
result = tmtcDistributor->addComponent(objects::PUS_PACKET_DISTRIBUTOR);
if (result != returnvalue::OK) {
sif::error << "Adding PUS distributor failed" << std::endl;
}
result = tmtcDistributor->addComponent(objects::CFDP_DISTRIBUTOR);
if (result != returnvalue::OK) {
sif::error << "Adding CFDP distributor failed" << std::endl;
}
#if OBSW_ADD_TMTC_UDP_SERVER == 1
result = tmtcDistributor->addComponent(objects::UDP_TMTC_SERVER);
if (result != returnvalue::OK) {
sif::error << "adding UDP server failed" << std::endl;
}
#endif
result = tmtcDistributor->addComponent(objects::TCP_TMTC_SERVER);
if (result != returnvalue::OK) {
sif::error << "adding TCP server failed" << std::endl;
}
#if OBSW_ADD_TMTC_UDP_SERVER == 1
PeriodicTaskIF* udpPollingTask = factory->createPeriodicTask(
"UDP_POLLING", 70, PeriodicTaskIF::MINIMUM_STACK_SIZE, 2.0, missedDeadlineFunc);
result = udpPollingTask->addComponent(objects::UDP_TMTC_POLLING_TASK);
if (result != returnvalue::OK) {
sif::error << "Add component UDP Polling failed" << std::endl;
}
#endif
PeriodicTaskIF* tcpPollingTask = factory->createPeriodicTask(
"TCP_POLLING", 70, PeriodicTaskIF::MINIMUM_STACK_SIZE, 2.0, missedDeadlineFunc);
result = tcpPollingTask->addComponent(objects::TCP_TMTC_POLLING_TASK);
if (result != returnvalue::OK) {
sif::error << "Add component UDP Polling failed" << std::endl;
}
PeriodicTaskIF* liveTmTask = factory->createPeriodicTask(
"LIVE_TM", 55, PeriodicTaskIF::MINIMUM_STACK_SIZE, 0.2, nullptr, &RR_SCHEDULING);
result = liveTmTask->addComponent(objects::LIVE_TM_TASK);
if (result != returnvalue::OK) {
scheduling::printAddObjectError("LIVE_TM", objects::LIVE_TM_TASK);
}
PeriodicTaskIF* pusHighPrio = factory->createPeriodicTask(
"PUS_HIGH_PRIO", 60, PeriodicTaskIF::MINIMUM_STACK_SIZE, 0.200, missedDeadlineFunc);
result = pusHighPrio->addComponent(objects::PUS_SERVICE_1_VERIFICATION);
if (result != returnvalue::OK) {
sif::error << "Object add component failed" << std::endl;
}
result = pusHighPrio->addComponent(objects::EVENT_MANAGER);
if (result != returnvalue::OK) {
scheduling::printAddObjectError("EVENT_MGMT", objects::EVENT_MANAGER);
}
result = pusHighPrio->addComponent(objects::PUS_SERVICE_5_EVENT_REPORTING);
if (result != returnvalue::OK) {
scheduling::printAddObjectError("PUS5", objects::PUS_SERVICE_5_EVENT_REPORTING);
}
result = pusHighPrio->addComponent(objects::PUS_SERVICE_9_TIME_MGMT);
if (result != returnvalue::OK) {
scheduling::printAddObjectError("PUS9", objects::PUS_SERVICE_9_TIME_MGMT);
}
PeriodicTaskIF* pusMedPrio = factory->createPeriodicTask(
"PUS_MED_PRIO", 40, PeriodicTaskIF::MINIMUM_STACK_SIZE, 0.8, missedDeadlineFunc);
result = pusHighPrio->addComponent(objects::PUS_SERVICE_2_DEVICE_ACCESS);
if (result != returnvalue::OK) {
scheduling::printAddObjectError("PUS2", objects::PUS_SERVICE_2_DEVICE_ACCESS);
}
result = pusHighPrio->addComponent(objects::PUS_SERVICE_3_HOUSEKEEPING);
if (result != returnvalue::OK) {
scheduling::printAddObjectError("PUS3", objects::PUS_SERVICE_3_HOUSEKEEPING);
}
result = pusMedPrio->addComponent(objects::PUS_SERVICE_8_FUNCTION_MGMT);
if (result != returnvalue::OK) {
scheduling::printAddObjectError("PUS8", objects::PUS_SERVICE_8_FUNCTION_MGMT);
}
result = pusMedPrio->addComponent(objects::PUS_SERVICE_15_TM_STORAGE);
if (result != returnvalue::OK) {
scheduling::printAddObjectError("PUS15", objects::PUS_SERVICE_15_TM_STORAGE);
}
result = pusMedPrio->addComponent(objects::PUS_SERVICE_200_MODE_MGMT);
if (result != returnvalue::OK) {
scheduling::printAddObjectError("PUS200", objects::PUS_SERVICE_200_MODE_MGMT);
}
result = pusMedPrio->addComponent(objects::PUS_SERVICE_20_PARAMETERS);
if (result != returnvalue::OK) {
scheduling::printAddObjectError("PUS20", objects::PUS_SERVICE_20_PARAMETERS);
}
result = pusMedPrio->addComponent(objects::PUS_SERVICE_17_TEST);
if (result != returnvalue::OK) {
scheduling::printAddObjectError("PUS17", objects::PUS_SERVICE_17_TEST);
}
PeriodicTaskIF* thermalTask = factory->createPeriodicTask(
"THERMAL_CTL_TASK", 40, PeriodicTaskIF::MINIMUM_STACK_SIZE, 1.0, missedDeadlineFunc);
result = thermalTask->addComponent(objects::CORE_CONTROLLER);
if (result != returnvalue::OK) {
scheduling::printAddObjectError("CORE_CTRL", objects::CORE_CONTROLLER);
}
result = thermalTask->addComponent(objects::THERMAL_CONTROLLER);
if (result != returnvalue::OK) {
scheduling::printAddObjectError("THERMAL_CONTROLLER", objects::THERMAL_CONTROLLER);
}
result = thermalTask->addComponent(objects::HEATER_HANDLER);
if (result != returnvalue::OK) {
scheduling::printAddObjectError("HEATER_HANDLER", objects::HEATER_HANDLER);
}
FixedTimeslotTaskIF* pstTask = factory->createFixedTimeslotTask(
"DUMMY_PST", 75, PeriodicTaskIF::MINIMUM_STACK_SIZE * 4, 0.5, missedDeadlineFunc);
result = dummy_pst::pst(pstTask);
if (result != returnvalue::OK) {
sif::error << "Failed to add dummy pst to fixed timeslot task" << std::endl;
}
#if OBSW_ADD_CFDP_COMPONENTS == 1
PeriodicTaskIF* cfdpTask = factory->createPeriodicTask(
"CFDP Handler", 45, PeriodicTaskIF::MINIMUM_STACK_SIZE, 0.4, missedDeadlineFunc);
result = cfdpTask->addComponent(objects::CFDP_HANDLER);
if (result != returnvalue::OK) {
scheduling::printAddObjectError("CFDP Handler", objects::CFDP_HANDLER);
}
#endif
// If those are added at a later stage..
/*
PeriodicTaskIF* logTmTask = factory->createPeriodicTask(
"LOG_PSTORE", 0, PeriodicTaskIF::MINIMUM_STACK_SIZE, 1.0, nullptr);
result = logTmTask->addComponent(objects::LOG_STORE_AND_TM_TASK);
if (result != returnvalue::OK) {
scheduling::printAddObjectError("LOG_STORE_AND_TM", objects::LOG_STORE_AND_TM_TASK);
}
PeriodicTaskIF* hkTmTask =
factory->createPeriodicTask("HK_PSTORE", 0, PeriodicTaskIF::MINIMUM_STACK_SIZE, 1.0, nullptr);
result = hkTmTask->addComponent(objects::HK_STORE_AND_TM_TASK);
if (result != returnvalue::OK) {
scheduling::printAddObjectError("HK_STORE_AND_TM", objects::HK_STORE_AND_TM_TASK);
}
PeriodicTaskIF* cfdpTmTask = factory->createPeriodicTask(
"CFDP_PSTORE", 0, PeriodicTaskIF::MINIMUM_STACK_SIZE, 1.0, nullptr);
result = cfdpTmTask->addComponent(objects::CFDP_STORE_AND_TM_TASK);
if (result != returnvalue::OK) {
scheduling::printAddObjectError("CFDP_STORE_AND_TM", objects::CFDP_STORE_AND_TM_TASK);
}
*/
#if OBSW_ADD_PLOC_SUPERVISOR == 1
PeriodicTaskIF* supvHelperTask = factory->createPeriodicTask(
"PLOC_SUPV_HELPER", 20, PeriodicTaskIF::MINIMUM_STACK_SIZE, 1.0, missedDeadlineFunc);
result = supvHelperTask->addComponent(objects::PLOC_SUPERVISOR_HELPER);
if (result != returnvalue::OK) {
scheduling::printAddObjectError("PLOC_SUPV_HELPER", objects::PLOC_SUPERVISOR_HELPER);
}
#endif /* OBSW_ADD_PLOC_SUPERVISOR */
PeriodicTaskIF* plTask = factory->createPeriodicTask(
"PL_TASK", 25, PeriodicTaskIF::MINIMUM_STACK_SIZE, 1.0, missedDeadlineFunc);
scheduling::addMpsocSupvHandlers(plTask);
#if OBSW_ADD_TEST_CODE == 1
result = testTask->addComponent(objects::TEST_TASK);
if (result != returnvalue::OK) {
scheduling::printAddObjectError("TEST_TASK", objects::TEST_TASK);
}
#endif /* OBSW_ADD_TEST_CODE == 1 */
PeriodicTaskIF* dummyTask = factory->createPeriodicTask(
"DUMMY_TASK", 35, PeriodicTaskIF::MINIMUM_STACK_SIZE, 0.8, missedDeadlineFunc);
dummyTask->addComponent(objects::THERMAL_TEMP_INSERTER);
scheduling::scheduleTmpTempSensors(dummyTask, true);
scheduling::scheduleRtdSensors(dummyTask);
dummyTask->addComponent(objects::SUS_0_N_LOC_XFYFZM_PT_XF);
dummyTask->addComponent(objects::SUS_1_N_LOC_XBYFZM_PT_XB);
dummyTask->addComponent(objects::SUS_2_N_LOC_XFYBZB_PT_YB);
dummyTask->addComponent(objects::SUS_3_N_LOC_XFYBZF_PT_YF);
dummyTask->addComponent(objects::SUS_4_N_LOC_XMYFZF_PT_ZF);
dummyTask->addComponent(objects::SUS_5_N_LOC_XFYMZB_PT_ZB);
dummyTask->addComponent(objects::SUS_6_R_LOC_XFYBZM_PT_XF);
dummyTask->addComponent(objects::SUS_7_R_LOC_XBYBZM_PT_XB);
dummyTask->addComponent(objects::SUS_8_R_LOC_XBYBZB_PT_YB);
dummyTask->addComponent(objects::SUS_9_R_LOC_XBYBZB_PT_YF);
dummyTask->addComponent(objects::SUS_10_N_LOC_XMYBZF_PT_ZF);
dummyTask->addComponent(objects::SUS_11_R_LOC_XBYMZB_PT_ZB);
sif::info << "Starting tasks.." << std::endl;
tmtcDistributor->startTask();
#if OBSW_ADD_TMTC_UDP_SERVER == 1
udpPollingTask->startTask();
#endif
tcpPollingTask->startTask();
liveTmTask->startTask();
pusHighPrio->startTask();
pusMedPrio->startTask();
pstTask->startTask();
thermalTask->startTask();
dummyTask->startTask();
// If those are added at a later stage..
// logTmTask->startTask();
// cfdpTmTask->startTask();
// hkTmTask->startTask();
#if OBSW_ADD_PLOC_SUPERVISOR == 1
supvHelperTask->startTask();
#endif
#if OBSW_ADD_PLOC_SUPERVISOR == 1 || OBSW_ADD_PLOC_MPSOC == 1
plTask->startTask();
#endif
#if OBSW_ADD_CFDP_COMPONENTS == 1
cfdpTask->startTask();
#endif
#if OBSW_ADD_TEST_CODE == 1
testTask->startTask();
#endif /* OBSW_ADD_TEST_CODE == 1 */
sif::info << "Tasks started.." << std::endl;
}

View File

@ -1,6 +0,0 @@
#pragma once
namespace scheduling {
void initMission();
void initTasks();
}; // namespace scheduling

View File

@ -3,4 +3,3 @@ target_sources(${OBSW_NAME} PUBLIC InitMission.cpp main.cpp gpioInit.cpp
add_subdirectory(boardconfig) add_subdirectory(boardconfig)
add_subdirectory(boardtest) add_subdirectory(boardtest)
add_subdirectory(fsfwconfig)

View File

@ -1,14 +1,12 @@
#include "InitMission.h" #include "InitMission.h"
#include <fsfw/devicehandlers/DeviceHandlerIF.h>
#include <fsfw/objectmanager/ObjectManager.h> #include <fsfw/objectmanager/ObjectManager.h>
#include <fsfw/objectmanager/ObjectManagerIF.h> #include <fsfw/objectmanager/ObjectManagerIF.h>
#include <fsfw/returnvalues/returnvalue.h> #include <fsfw/returnvalues/HasReturnvaluesIF.h>
#include <fsfw/serviceinterface/ServiceInterface.h> #include <fsfw/serviceinterface/ServiceInterface.h>
#include <fsfw/tasks/FixedTimeslotTaskIF.h> #include <fsfw/tasks/FixedTimeslotTaskIF.h>
#include <fsfw/tasks/PeriodicTaskIF.h> #include <fsfw/tasks/PeriodicTaskIF.h>
#include <fsfw/tasks/TaskFactory.h> #include <fsfw/tasks/TaskFactory.h>
#include <linux/InitMission.h>
#include <mission/utility/InitMission.h> #include <mission/utility/InitMission.h>
#include <iostream> #include <iostream>
@ -38,7 +36,7 @@ void initmission::initMission() {
void initmission::initTasks() { void initmission::initTasks() {
TaskFactory* factory = TaskFactory::instance(); TaskFactory* factory = TaskFactory::instance();
ReturnValue_t result = returnvalue::OK; ReturnValue_t result = HasReturnvaluesIF::RETURN_OK;
if (factory == nullptr) { if (factory == nullptr) {
/* Should never happen ! */ /* Should never happen ! */
return; return;
@ -53,15 +51,15 @@ void initmission::initTasks() {
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 != returnvalue::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 != returnvalue::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 != returnvalue::OK) { if (result != HasReturnvaluesIF::RETURN_OK) {
sif::error << "Object add component failed" << std::endl; sif::error << "Object add component failed" << std::endl;
} }
@ -69,22 +67,16 @@ void initmission::initTasks() {
PeriodicTaskIF* tmtcBridgeTask = factory->createPeriodicTask( PeriodicTaskIF* tmtcBridgeTask = factory->createPeriodicTask(
"TMTC_BRIDGE", 50, PeriodicTaskIF::MINIMUM_STACK_SIZE, 0.2, missedDeadlineFunc); "TMTC_BRIDGE", 50, PeriodicTaskIF::MINIMUM_STACK_SIZE, 0.2, missedDeadlineFunc);
result = tmtcBridgeTask->addComponent(objects::TMTC_BRIDGE); result = tmtcBridgeTask->addComponent(objects::TMTC_BRIDGE);
if (result != returnvalue::OK) { if (result != HasReturnvaluesIF::RETURN_OK) {
sif::error << "Add component TMTC Bridge failed" << std::endl; sif::error << "Add component TMTC Bridge failed" << std::endl;
} }
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 != returnvalue::OK) { if (result != HasReturnvaluesIF::RETURN_OK) {
sif::error << "Add component TMTC Polling failed" << std::endl; sif::error << "Add component TMTC Polling failed" << std::endl;
} }
#if OBSW_ADD_SCEX_DEVICE == 1
PeriodicTaskIF* scexDevHandler;
PeriodicTaskIF* scexReaderTask;
scheduling::schedulingScex(*factory, scexDevHandler, scexReaderTask);
#endif
/* PUS Services */ /* PUS Services */
std::vector<PeriodicTaskIF*> pusTasks; std::vector<PeriodicTaskIF*> pusTasks;
createPusTasks(*factory, missedDeadlineFunc, pusTasks); createPusTasks(*factory, missedDeadlineFunc, pusTasks);
@ -117,10 +109,6 @@ void initmission::initTasks() {
#endif /* OBSW_ADD_TEST_CODE == 1 */ #endif /* OBSW_ADD_TEST_CODE == 1 */
taskStarter(pstTasks, "PST Tasks"); taskStarter(pstTasks, "PST Tasks");
#if OBSW_ADD_SCEX_DEVICE == 1
scexDevHandler->startTask();
scexReaderTask->startTask();
#endif
#if OBSW_ADD_TEST_PST == 1 #if OBSW_ADD_TEST_PST == 1
if (startTestPst) { if (startTestPst) {
pstTestTask->startTask(); pstTestTask->startTask();
@ -132,11 +120,11 @@ void initmission::initTasks() {
void initmission::createPusTasks(TaskFactory& factory, void initmission::createPusTasks(TaskFactory& factory,
TaskDeadlineMissedFunction missedDeadlineFunc, TaskDeadlineMissedFunction missedDeadlineFunc,
std::vector<PeriodicTaskIF*>& taskVec) { std::vector<PeriodicTaskIF*>& taskVec) {
ReturnValue_t result = returnvalue::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 != returnvalue::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);
@ -144,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 != returnvalue::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 != returnvalue::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);
@ -156,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 != returnvalue::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 != returnvalue::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);
@ -168,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 != returnvalue::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 != returnvalue::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 != returnvalue::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 != returnvalue::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);
@ -188,11 +176,11 @@ 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 != returnvalue::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 != returnvalue::OK) { if (result != HasReturnvaluesIF::RETURN_OK) {
initmission::printAddObjectError("INT_ERR_RPRT", objects::INTERNAL_ERROR_REPORTER); initmission::printAddObjectError("INT_ERR_RPRT", objects::INTERNAL_ERROR_REPORTER);
} }
taskVec.push_back(pusLowPrio); taskVec.push_back(pusLowPrio);
@ -201,55 +189,45 @@ void initmission::createPusTasks(TaskFactory& factory,
void initmission::createPstTasks(TaskFactory& factory, void initmission::createPstTasks(TaskFactory& factory,
TaskDeadlineMissedFunction missedDeadlineFunc, TaskDeadlineMissedFunction missedDeadlineFunc,
std::vector<PeriodicTaskIF*>& taskVec) { std::vector<PeriodicTaskIF*>& taskVec) {
ReturnValue_t result = returnvalue::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, 1.0, missedDeadlineFunc); "SPI_PST", 70, PeriodicTaskIF::MINIMUM_STACK_SIZE * 4, 1.0, missedDeadlineFunc);
result = pst::pstSpi(spiPst); result = pst::pstSpi(spiPst);
if (result != returnvalue::OK) { if (result != HasReturnvaluesIF::RETURN_OK) {
if (result != FixedTimeslotTaskIF::SLOT_LIST_EMPTY) { sif::error << "InitMission::initTasks: Creating PST failed!" << std::endl;
sif::error << "InitMission::createPstTasks: Creating PST failed!" << std::endl;
} }
} else {
taskVec.push_back(spiPst); taskVec.push_back(spiPst);
}
#endif #endif
} }
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 = returnvalue::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 != returnvalue::OK) { if (result != HasReturnvaluesIF::RETURN_OK) {
initmission::printAddObjectError("TEST_TASK", objects::TEST_TASK); initmission::printAddObjectError("TEST_TASK", objects::TEST_TASK);
} }
#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 != returnvalue::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 != returnvalue::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 OBSW_ADD_UART_TEST_CODE == 1 #if OBSW_ADD_UART_TEST_CODE == 1
result = testTask->addComponent(objects::UART_TEST); result = testTask->addComponent(objects::UART_TEST);
if (result != returnvalue::OK) { if (result != HasReturnvaluesIF::RETURN_OK) {
initmission::printAddObjectError("UART_TEST", objects::UART_TEST); initmission::printAddObjectError("UART_TEST", objects::UART_TEST);
} }
PeriodicTaskIF* scexReaderTask = factory.createPeriodicTask(
"SCEX_UART_READER", 20, PeriodicTaskIF::MINIMUM_STACK_SIZE, 2.0, missedDeadlineFunc);
result = scexReaderTask->addComponent(objects::SCEX_UART_READER);
if (result != returnvalue::OK) {
initmission::printAddObjectError("SCEX_UART_READER", objects::SCEX_UART_READER);
}
taskVec.push_back(scexReaderTask);
#endif /* RPI_ADD_GPIO_TEST == 1 */ #endif /* RPI_ADD_GPIO_TEST == 1 */
taskVec.push_back(testTask); taskVec.push_back(testTask);
@ -259,7 +237,7 @@ void initmission::createTestTasks(TaskFactory& factory,
FixedTimeslotTaskIF* pstTestTask = factory->createFixedTimeslotTask( FixedTimeslotTaskIF* pstTestTask = factory->createFixedTimeslotTask(
"TEST_PST", 50, 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 != returnvalue::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;
} }

View File

@ -28,7 +28,6 @@
#define OBSW_ADD_RTD_DEVICES 0 #define OBSW_ADD_RTD_DEVICES 0
#define OBSW_ADD_PL_PCDU 0 #define OBSW_ADD_PL_PCDU 0
#define OBSW_ADD_TMP_DEVICES 0 #define OBSW_ADD_TMP_DEVICES 0
#define OBSW_ADD_SCEX_DEVICE 1
#define OBSW_ADD_RAD_SENSORS 0 #define OBSW_ADD_RAD_SENSORS 0
#define OBSW_ADD_SYRLINKS 0 #define OBSW_ADD_SYRLINKS 0
#define OBSW_STAR_TRACKER_GROUND_CONFIG 1 #define OBSW_STAR_TRACKER_GROUND_CONFIG 1
@ -103,12 +102,6 @@
/*******************************************************************/ /*******************************************************************/
#cmakedefine EIVE_BUILD_GPSD_GPS_HANDLER #cmakedefine EIVE_BUILD_GPSD_GPS_HANDLER
#define OBSW_ADD_CCSDS_IP_CORES 0
// Set to 1 if all telemetry should be sent to the PTME IP Core
#define OBSW_TM_TO_PTME 0
// Set to 1 if telecommands are received via the PDEC IP Core
#define OBSW_TC_FROM_PDEC 0
#cmakedefine LIBGPS_VERSION_MAJOR @LIBGPS_VERSION_MAJOR@ #cmakedefine LIBGPS_VERSION_MAJOR @LIBGPS_VERSION_MAJOR@
#cmakedefine LIBGPS_VERSION_MINOR @LIBGPS_VERSION_MINOR@ #cmakedefine LIBGPS_VERSION_MINOR @LIBGPS_VERSION_MINOR@

View File

@ -1,8 +1,5 @@
#include "ObjectFactory.h" #include "ObjectFactory.h"
#include <bsp_linux_board/RPiSdCardManager.h>
#include <linux/devices/ScexUartReader.h>
#include "OBSWConfig.h" #include "OBSWConfig.h"
#include "devConf.h" #include "devConf.h"
#include "devices/addresses.h" #include "devices/addresses.h"
@ -21,8 +18,9 @@
#include "mission/core/GenericFactory.h" #include "mission/core/GenericFactory.h"
#include "mission/devices/GPSHyperionHandler.h" #include "mission/devices/GPSHyperionHandler.h"
#include "mission/devices/GyroADIS1650XHandler.h" #include "mission/devices/GyroADIS1650XHandler.h"
#include "mission/tmtc/TmFunnel.h" #include "mission/utility/TmFunnel.h"
#include "objects/systemObjectList.h" #include "objects/systemObjectList.h"
#include "tmtc/apid.h"
#include "tmtc/pusIds.h" #include "tmtc/pusIds.h"
/* UDP server includes */ /* UDP server includes */
@ -34,8 +32,8 @@
#include "fsfw/osal/common/UdpTmTcBridge.h" #include "fsfw/osal/common/UdpTmTcBridge.h"
#endif #endif
#include <fsfw_hal/linux/serial/SerialComIF.h> #include <fsfw_hal/linux/uart/UartComIF.h>
#include <fsfw_hal/linux/serial/SerialCookie.h> #include <fsfw_hal/linux/uart/UartCookie.h>
#include "fsfw_hal/common/gpio/GpioCookie.h" #include "fsfw_hal/common/gpio/GpioCookie.h"
#include "fsfw_hal/devicehandlers/GyroL3GD20Handler.h" #include "fsfw_hal/devicehandlers/GyroL3GD20Handler.h"
@ -47,8 +45,8 @@
#include "fsfw_hal/linux/spi/SpiCookie.h" #include "fsfw_hal/linux/spi/SpiCookie.h"
void Factory::setStaticFrameworkObjectIds() { void Factory::setStaticFrameworkObjectIds() {
PusServiceBase::PUS_DISTRIBUTOR = objects::PUS_PACKET_DISTRIBUTOR; PusServiceBase::packetSource = objects::PUS_PACKET_DISTRIBUTOR;
PusServiceBase::PACKET_DESTINATION = objects::TM_FUNNEL; PusServiceBase::packetDestination = objects::TM_FUNNEL;
CommandingServiceBase::defaultPacketSource = objects::PUS_PACKET_DISTRIBUTOR; CommandingServiceBase::defaultPacketSource = objects::PUS_PACKET_DISTRIBUTOR;
CommandingServiceBase::defaultPacketDestination = objects::TM_FUNNEL; CommandingServiceBase::defaultPacketDestination = objects::TM_FUNNEL;
@ -56,6 +54,9 @@ void Factory::setStaticFrameworkObjectIds() {
TmFunnel::downlinkDestination = objects::TMTC_BRIDGE; TmFunnel::downlinkDestination = objects::TMTC_BRIDGE;
// No storage object for now. // No storage object for now.
TmFunnel::storageDestination = objects::NO_OBJECT; TmFunnel::storageDestination = objects::NO_OBJECT;
VerificationReporter::messageReceiver = objects::PUS_SERVICE_1_VERIFICATION;
TmPacketBase::timeStamperId = objects::TIME_STAMPER;
} }
void ObjectFactory::produce(void* args) { void ObjectFactory::produce(void* args) {
@ -75,17 +76,12 @@ void ObjectFactory::produce(void* args) {
createRpiAcsBoard(gpioIF, spiDev); createRpiAcsBoard(gpioIF, spiDev);
#endif #endif
#if OBSW_ADD_SUN_SENSORS == 1 || OBSW_ADD_RTD_DEVICES == 1 #if OBSW_ADD_SUN_SENSORS == 1 || defined(OBSW_ADD_RTD_DEVICES)
#ifdef RASPBERRY_PI #ifdef RASPBERRY_PI
rpi::gpio::initSpiCsDecoder(gpioIF); rpi::gpio::initSpiCsDecoder(gpioIF);
#endif #endif
#endif #endif
#if OBSW_ADD_SCEX_DEVICE == 1
auto* sdcMan = new DummySdCardManager("/tmp");
createScexComponents(uart::DEV, pwrSwitcher, *sdcMan, true, std::nullopt);
#endif
#if OBSW_ADD_SUN_SENSORS == 1 #if OBSW_ADD_SUN_SENSORS == 1
createSunSensorComponents(gpioIF, spiComIF, pwrSwitcher, spi::DEV); createSunSensorComponents(gpioIF, spiComIF, pwrSwitcher, spi::DEV);
#endif #endif
@ -202,7 +198,7 @@ void ObjectFactory::createTestTasks() {
#if OBSW_ADD_UART_TEST_CODE == 1 #if OBSW_ADD_UART_TEST_CODE == 1
new UartTestClass(objects::UART_TEST); new UartTestClass(objects::UART_TEST);
#else #else
newSerialComIF(objects::UART_COM_IF); new UartComIF(objects::UART_COM_IF);
#endif #endif
#if RPI_LOOPBACK_TEST_GPIO == 1 #if RPI_LOOPBACK_TEST_GPIO == 1

View File

@ -13,12 +13,6 @@ static constexpr char DEV[] = "/dev/spidev0.1";
} }
namespace uart {
static constexpr char DEV[] = "/dev/serial0";
}
/* Adapt these values accordingly */ /* Adapt these values accordingly */
namespace gpio { namespace gpio {
static constexpr uint8_t MGM_0_BCM_PIN = 17; static constexpr uint8_t MGM_0_BCM_PIN = 17;

View File

@ -40,14 +40,14 @@ void rpi::gpio::initSpiCsDecoder(GpioIF* gpioComIF) {
for (const auto& info : muxInfo) { for (const auto& info : muxInfo) {
result = createRpiGpioConfig(spiMuxGpios, info.gpioId, info.bcmNum, info.consumer, result = createRpiGpioConfig(spiMuxGpios, info.gpioId, info.bcmNum, info.consumer,
Direction::OUT, Levels::LOW); Direction::OUT, Levels::LOW);
if (result != returnvalue::OK) { if (result != HasReturnvaluesIF::RETURN_OK) {
sif::error << "Creating Raspberry Pi SPI Mux GPIO failed with code " << result << std::endl; sif::error << "Creating Raspberry Pi SPI Mux GPIO failed with code " << result << std::endl;
return; return;
} }
} }
result = gpioComIF->addGpios(spiMuxGpios); result = gpioComIF->addGpios(spiMuxGpios);
if (result != returnvalue::OK) { if (result != HasReturnvaluesIF::RETURN_OK) {
sif::error << "initSpiCsDecoder: Failed to add mux bit gpios to gpioComIF" << std::endl; sif::error << "initSpiCsDecoder: Failed to add mux bit gpios to gpioComIF" << std::endl;
return; return;
} }

View File

@ -7,12 +7,12 @@ target_link_libraries(${SIMPLE_OBSW_NAME} PUBLIC ${LIB_FSFW_NAME})
target_compile_definitions(${SIMPLE_OBSW_NAME} PRIVATE "Q7S_SIMPLE_MODE") target_compile_definitions(${SIMPLE_OBSW_NAME} PRIVATE "Q7S_SIMPLE_MODE")
add_subdirectory(simple) add_subdirectory(simple)
target_sources(${OBSW_NAME} PUBLIC main.cpp obsw.cpp scheduling.cpp target_sources(${OBSW_NAME} PUBLIC main.cpp obsw.cpp)
objectFactory.cpp)
add_subdirectory(boardtest) #add_subdirectory(boardtest)
add_subdirectory(boardconfig) add_subdirectory(boardconfig)
add_subdirectory(comIF)
add_subdirectory(core) add_subdirectory(core)
if(EIVE_Q7S_EM) if(EIVE_Q7S_EM)
@ -24,5 +24,3 @@ endif()
add_subdirectory(memory) add_subdirectory(memory)
add_subdirectory(callbacks) add_subdirectory(callbacks)
add_subdirectory(xadc) add_subdirectory(xadc)
add_subdirectory(fs)
add_subdirectory(acs)

View File

@ -8,75 +8,56 @@
#include "commonConfig.h" #include "commonConfig.h"
#include "q7sConfig.h" #include "q7sConfig.h"
#include "OBSWVersion.h"
/*******************************************************************/ /*******************************************************************/
/** All of the following flags should be enabled for mission code */ /** All of the following flags should be enabled for mission code */
/*******************************************************************/ /*******************************************************************/
// This enables a lot of periodically generated telemetry, so it can make sense to #define OBSW_USE_CCSDS_IP_CORE 1
// disable this for debugging purposes. // Set to 1 if all telemetry should be sent to the PTME IP Core
#define OBSW_ENABLE_PERIODIC_HK @OBSW_ENABLE_PERIODIC_HK@ #define OBSW_TM_TO_PTME 0
// Set to 1 if telecommands are received via the PDEC IP Core
// This switch will cause the SW to command the EIVE system object to safe mode. This will #define OBSW_TC_FROM_PDEC 0
// trigger a lot of events, so it can make sense to disable this for debugging purposes.
#define OBSW_COMMAND_SAFE_MODE_AT_STARTUP 1
#define OBSW_ENABLE_TIMERS 1
#define OBSW_ADD_GOMSPACE_PCDU @OBSW_ADD_GOMSPACE_PCDU@ #define OBSW_ADD_GOMSPACE_PCDU @OBSW_ADD_GOMSPACE_PCDU@
// This define is necessary because the EM setup has the P60 dock module, but no ACU on the P60
// module because it broke.
#define OBSW_ADD_GOMSPACE_ACU @OBSW_ADD_GOMSPACE_ACU@
#define OBSW_ADD_MGT @OBSW_ADD_MGT@ #define OBSW_ADD_MGT @OBSW_ADD_MGT@
#define OBSW_ADD_BPX_BATTERY_HANDLER @OBSW_ADD_BPX_BATTERY_HANDLER@ #define OBSW_ADD_BPX_BATTERY_HANDLER @OBSW_ADD_BPX_BATTERY_HANDLER@
#define OBSW_ADD_STAR_TRACKER @OBSW_ADD_STAR_TRACKER@ #define OBSW_ADD_STAR_TRACKER @OBSW_ADD_STAR_TRACKER@
#define OBSW_ADD_PLOC_SUPERVISOR @OBSW_ADD_PLOC_SUPERVISOR@ #define OBSW_ADD_PLOC_SUPERVISOR 1
#define OBSW_ADD_PLOC_MPSOC @OBSW_ADD_PLOC_MPSOC@ #define OBSW_ADD_PLOC_MPSOC 1
#define OBSW_ADD_SUN_SENSORS @OBSW_ADD_SUN_SENSORS@ #define OBSW_ADD_SUN_SENSORS @OBSW_ADD_SUN_SENSORS@
#define OBSW_ADD_SUS_BOARD_ASS @OBSW_ADD_SUS_BOARD_ASS@ #define OBSW_ADD_SUS_BOARD_ASS @OBSW_ADD_SUS_BOARD_ASS@
#define OBSW_ADD_ACS_BOARD @OBSW_ADD_ACS_BOARD@ #define OBSW_ADD_ACS_BOARD @OBSW_ADD_ACS_BOARD@
#define OBSW_ADD_ACS_CTRL 1 #define OBSW_ADD_ACS_HANDLERS @OBSW_ADD_ACS_HANDLERS@
#define OBSW_ADD_TCS_CTRL 1
#define OBSW_ADD_GPS_CTRL @OBSW_ADD_GPS_CTRL@
#define OBSW_ADD_RW @OBSW_ADD_RW@ #define OBSW_ADD_RW @OBSW_ADD_RW@
#define OBSW_ADD_RTD_DEVICES @OBSW_ADD_RTD_DEVICES@ #define OBSW_ADD_RTD_DEVICES @OBSW_ADD_RTD_DEVICES@
#define OBSW_ADD_SA_DEPL @OBSW_ADD_SA_DEPL@
#define OBSW_ADD_SCEX_DEVICE @OBSW_ADD_SCEX_DEVICE@
#define OBSW_ADD_HEATERS @OBSW_ADD_HEATERS@
#define OBSW_ADD_TMP_DEVICES @OBSW_ADD_TMP_DEVICES@ #define OBSW_ADD_TMP_DEVICES @OBSW_ADD_TMP_DEVICES@
#define OBSW_ADD_RAD_SENSORS @OBSW_ADD_RAD_SENSORS@ #define OBSW_ADD_RAD_SENSORS @OBSW_ADD_RAD_SENSORS@
#define OBSW_ADD_PL_PCDU @OBSW_ADD_PL_PCDU@ #define OBSW_ADD_PL_PCDU @OBSW_ADD_PL_PCDU@
#define OBSW_ADD_SYRLINKS @OBSW_ADD_SYRLINKS@ #define OBSW_ADD_SYRLINKS @OBSW_ADD_SYRLINKS@
#define OBSW_ADD_CCSDS_IP_CORES @OBSW_ADD_CCSDS_IP_CORES@ #define OBSW_ENABLE_SYRLINKS_TRANSMIT_TIMEOUT 0
// Only relevant for EM for TCS tests. #define OBSW_MPSOC_JTAG_BOOT 0
#define OBSW_ADD_THERMAL_TEMP_INSERTER @OBSW_ADD_THERMAL_TEMP_INSERTER@
// Set to 1 if all telemetry should be sent to the PTME IP Core // This is a really tricky switch.. It initializes the PCDU switches to their default states
#define OBSW_TM_TO_PTME @OBSW_TM_TO_PTME@ // at powerup. I think it would be better
// Set to 1 if telecommands are received via the PDEC IP Core // to leave it off for now. It makes testing a lot more difficult and it might mess with
#define OBSW_TC_FROM_PDEC @OBSW_TC_FROM_PDEC@ // something the operators might want to do by giving the software too much intelligence
// at the wrong place. The system component might command all the Switches accordingly anyway
// Configuration parameter which causes the core controller to try to keep at least one SD card #define OBSW_INITIALIZE_SWITCHES 0
// working #define OBSW_ENABLE_PERIODIC_HK 0
#define OBSW_SD_CARD_MUST_BE_ON 1
#define OBSW_ENABLE_TIMERS 1
/*******************************************************************/ /*******************************************************************/
/** All of the following flags should be disabled for mission code */ /** All of the following flags should be disabled for mission code */
/*******************************************************************/ /*******************************************************************/
// Use TCP instead of UDP for the TMTC bridge. This allows using the TMTC client locally
// because UDP packets are not allowed in the VPN
// This will cause the OBSW to initialize the TMTC bridge responsible for exchanging data with the
// CCSDS IP Cores.
#define OBSW_ADD_TMTC_TCP_SERVER @OBSW_ADD_TMTC_TCP_SERVER@
#define OBSW_ADD_TMTC_UDP_SERVER @OBSW_ADD_TMTC_UDP_SERVER@
// Can be used to switch device to NORMAL mode immediately // Can be used to switch device to NORMAL mode immediately
#define OBSW_SWITCH_TO_NORMAL_MODE_AFTER_STARTUP 0 #define OBSW_SWITCH_TO_NORMAL_MODE_AFTER_STARTUP 1
#define OBSW_PRINT_MISSED_DEADLINES 0 #define OBSW_PRINT_MISSED_DEADLINES 1
#define OBSW_MPSOC_JTAG_BOOT 0 #define OBSW_STAR_TRACKER_GROUND_CONFIG 1
#define OBSW_STAR_TRACKER_GROUND_CONFIG @OBSW_STAR_TRACKER_GROUND_CONFIG@ #define OBSW_SYRLINKS_SIMULATED 1
#define OBSW_SYRLINKS_SIMULATED @OBSW_SYRLINKS_SIMULATED@
#define OBSW_ADD_TEST_CODE 0 #define OBSW_ADD_TEST_CODE 0
#define OBSW_ADD_TEST_TASK 0 #define OBSW_ADD_TEST_TASK 0
#define OBSW_ADD_TEST_PST 0 #define OBSW_ADD_TEST_PST 0
@ -115,7 +96,6 @@
#define OBSW_PRINT_CORE_HK 0 #define OBSW_PRINT_CORE_HK 0
#define OBSW_DEBUG_PDU1 0 #define OBSW_DEBUG_PDU1 0
#define OBSW_DEBUG_PDU2 0 #define OBSW_DEBUG_PDU2 0
#define OBSW_DEBUG_TMP1075 0
#define OBSW_DEBUG_GPS 0 #define OBSW_DEBUG_GPS 0
#define OBSW_DEBUG_ACU 0 #define OBSW_DEBUG_ACU 0
#define OBSW_DEBUG_SYRLINKS 0 #define OBSW_DEBUG_SYRLINKS 0
@ -130,12 +110,12 @@
/*******************************************************************/ /*******************************************************************/
/** CMake Defines */ /** CMake Defines */
/*******************************************************************/ /*******************************************************************/
#cmakedefine EIVE_BUILD_GPSD_GPS_HANDLER #cmakedefine EIVE_BUILD_GPSD_GPS_HANDLER
#cmakedefine LIBGPS_VERSION_MAJOR @LIBGPS_VERSION_MAJOR@ #cmakedefine LIBGPS_VERSION_MAJOR @LIBGPS_VERSION_MAJOR@
#cmakedefine LIBGPS_VERSION_MINOR @LIBGPS_VERSION_MINOR@ #cmakedefine LIBGPS_VERSION_MINOR @LIBGPS_VERSION_MINOR@
#ifdef __cplusplus #ifdef __cplusplus
#include "objects/systemObjectList.h" #include "objects/systemObjectList.h"

View File

@ -1 +0,0 @@
# target_sources(${OBSW_NAME} PUBLIC <Source File List>)

View File

@ -1,23 +0,0 @@
#include <optional>
#include "bsp_q7s/fs/SdCardManager.h"
#include "mission/acs/str/strHelpers.h"
class StrConfigPathGetter : public startracker::SdCardConfigPathGetter {
public:
StrConfigPathGetter(SdCardManager& sdcMan) : sdcMan(sdcMan) {}
std::optional<std::string> getCfgPath() override {
if (!sdcMan.isSdCardUsable(std::nullopt)) {
return std::nullopt;
}
if (sdcMan.getActiveSdCard() == sd::SdCard::SLOT_1) {
return std::string("/mnt/sd1/startracker/flight-config.json");
} else {
return std::string("/mnt/sd0/startracker/flight-config.json");
}
}
private:
SdCardManager& sdcMan;
};

View File

@ -3,43 +3,29 @@
namespace q7s { namespace q7s {
static constexpr char SPI_DEFAULT_DEV[] = "/dev/spi_main"; static constexpr char SPI_DEFAULT_DEV[] = "/dev/spi-main";
static constexpr uint32_t SPI_MAIN_BUS_LOCK_TIMEOUT = 50; static constexpr uint32_t SPI_MAIN_BUS_LOCK_TIMEOUT = 50;
static constexpr char SPI_RW_DEV[] = "/dev/spi_rw"; static constexpr char SPI_RW_DEV[] = "/dev/spi-rw";
//! I2C bus using an I2C IP core in the programmable logic (PL) static constexpr char I2C_DEFAULT_DEV[] = "/dev/i2c-eive";
static constexpr char I2C_PL_EIVE[] = "/dev/i2c_pl";
//! I2C bus using the I2C peripheral of the ARM processing system (PS)
static constexpr char I2C_PS_EIVE[] = "/dev/i2c_ps";
//! I2C bus using the first I2C peripheral of the ARM processing system (PS).
//! Named like this because it is used by default for the Q7 devices.
static constexpr char I2C_Q7_EIVE[] = "/dev/i2c_q7";
static constexpr char UART_GNSS_DEV[] = "/dev/gps0"; static constexpr char UART_GNSS_DEV[] = "/dev/gps0";
static constexpr char UART_PLOC_MPSOC_DEV[] = "/dev/ul_plmpsoc"; static constexpr char UART_PLOC_MPSOC_DEV[] = "/dev/ul-plmpsoc";
static constexpr char UART_PLOC_SUPERVISOR_DEV_FALLBACK[] = "/dev/ttyUL4"; static constexpr char UART_PLOC_SUPERVSIOR_DEV[] = "/dev/ul-plsv";
static constexpr char UART_PLOC_SUPERVISOR_DEV[] = "/dev/ploc_supv"; static constexpr char UART_SYRLINKS_DEV[] = "/dev/ul-syrlinks";
static constexpr char UART_SYRLINKS_DEV[] = "/dev/ul_syrlinks"; static constexpr char UART_STAR_TRACKER_DEV[] = "/dev/ul-str";
static constexpr char UART_STAR_TRACKER_DEV[] = "/dev/ul_str";
static constexpr char UART_SCEX_DEV[] = "/dev/scex";
static constexpr char UIO_PDEC_REGISTERS[] = "/dev/uio_pdec_regs"; static constexpr char UIO_PDEC_REGISTERS[] = "/dev/uio0";
static constexpr char UIO_PTME[] = "/dev/uio_ptme"; static constexpr char UIO_PTME[] = "/dev/uio1";
static constexpr char UIO_PDEC_CONFIG_MEMORY[] = "/dev/uio_pdec_cfg_mem"; static constexpr char UIO_PDEC_CONFIG_MEMORY[] = "/dev/uio2";
static constexpr char UIO_SYS_ROM[] = "/dev/uio_sys_rom"; static constexpr char UIO_PDEC_RAM[] = "/dev/uio3";
static constexpr char UIO_PDEC_RAM[] = "/dev/uio_pdec_ram";
static constexpr char UIO_PDEC_IRQ[] = "/dev/uio_pdec_irq";
static constexpr int MAP_ID_PTME_CONFIG = 3; static constexpr int MAP_ID_PTME_CONFIG = 3;
namespace uiomapids { namespace uiomapids {
// Live TM
static const int PTME_VC0 = 0; static const int PTME_VC0 = 0;
// OK/NOK/MISC Store
static const int PTME_VC1 = 1; static const int PTME_VC1 = 1;
// HK store
static const int PTME_VC2 = 2; static const int PTME_VC2 = 2;
// CFDP
static const int PTME_VC3 = 3; static const int PTME_VC3 = 3;
static const int PTME_CONFIG = 4; static const int PTME_CONFIG = 4;
} // namespace uiomapids } // namespace uiomapids
@ -62,7 +48,6 @@ static constexpr char GYRO_0_ENABLE[] = "enable_gyro_0";
static constexpr char GYRO_2_ENABLE[] = "enable_gyro_2"; static constexpr char GYRO_2_ENABLE[] = "enable_gyro_2";
static constexpr char GNSS_SELECT[] = "gnss_mux_select"; static constexpr char GNSS_SELECT[] = "gnss_mux_select";
static constexpr char GNSS_MUX_SELECT[] = "gnss_mux_select"; static constexpr char GNSS_MUX_SELECT[] = "gnss_mux_select";
static constexpr char PL_I2C_ARESETN[] = "pl_i2c_aresetn";
static constexpr char HEATER_0[] = "heater0"; static constexpr char HEATER_0[] = "heater0";
static constexpr char HEATER_1[] = "heater1"; static constexpr char HEATER_1[] = "heater1";
@ -88,14 +73,14 @@ static constexpr char EN_RW_4[] = "enable_rw_4";
static constexpr char RAD_SENSOR_CHIP_SELECT[] = "rad_sensor_chip_select"; static constexpr char RAD_SENSOR_CHIP_SELECT[] = "rad_sensor_chip_select";
static constexpr char ENABLE_RADFET[] = "enable_radfet"; static constexpr char ENABLE_RADFET[] = "enable_radfet";
static constexpr char PAPB_BUSY_SIGNAL_VC0[] = "papb_busy_signal_vc0";
static constexpr char PAPB_EMPTY_SIGNAL_VC0[] = "papb_empty_signal_vc0"; static constexpr char PAPB_EMPTY_SIGNAL_VC0[] = "papb_empty_signal_vc0";
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 PAPB_EMPTY_SIGNAL_VC1[] = "papb_empty_signal_vc1";
static constexpr char PAPB_BUSY_SIGNAL_VC2[] = "papb_busy_signal_vc2";
static constexpr char PAPB_EMPTY_SIGNAL_VC2[] = "papb_empty_signal_vc2"; static constexpr char PAPB_EMPTY_SIGNAL_VC2[] = "papb_empty_signal_vc2";
static constexpr char PAPB_BUSY_SIGNAL_VC3[] = "papb_busy_signal_vc3";
static constexpr char PAPB_EMPTY_SIGNAL_VC3[] = "papb_empty_signal_vc3"; static constexpr char PAPB_EMPTY_SIGNAL_VC3[] = "papb_empty_signal_vc3";
static constexpr char PTME_RESETN[] = "ptme_resetn";
static constexpr char RS485_EN_TX_CLOCK[] = "tx_clock_enable_ltc2872"; 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_TX_DATA[] = "tx_data_enable_ltc2872";
static constexpr char RS485_EN_RX_CLOCK[] = "rx_clock_enable_ltc2872"; static constexpr char RS485_EN_RX_CLOCK[] = "rx_clock_enable_ltc2872";

View File

@ -16,8 +16,18 @@
/** Other flags */ /** Other flags */
/*******************************************************************/ /*******************************************************************/
#define Q7S_SD_NONE 0
#define Q7S_SD_COLD_REDUNDANT 1
#define Q7S_SD_HOT_REDUNDANT 2
// The OBSW will perform different actions to set up the SD cards depending on the flag set here
// Set to Q7S_SD_NONE: Don't do anything
// Set to Q7S_COLD_REDUNDANT: On startup, get the prefered SD card, turn it on and mount it, and
// turn off the second SD card if it is on
// Set to Q7S_HOT_REDUNDANT: On startup, turn on both SD cards and mount them
#define Q7S_SD_CARD_CONFIG Q7S_SD_COLD_REDUNDANT
// Probably better if this is disabled for mission code. Convenient for development // Probably better if this is disabled for mission code. Convenient for development
#define Q7S_CHECK_FOR_ALREADY_RUNNING_IMG @Q7S_CHECK_FOR_ALREADY_RUNNING_IMG@ #define Q7S_CHECK_FOR_ALREADY_RUNNING_IMG 1
#define Q7S_SIMPLE_ADD_FILE_SYSTEM_TEST 0 #define Q7S_SIMPLE_ADD_FILE_SYSTEM_TEST 0

View File

@ -1,4 +1,4 @@
target_sources(${OBSW_NAME} PRIVATE FileSystemTest.cpp Q7STestTask.cpp) target_sources(${OBSW_NAME} PUBLIC FileSystemTest.cpp Q7STestTask.cpp)
if(EIVE_BUILD_Q7S_SIMPLE_MODE) if(EIVE_BUILD_Q7S_SIMPLE_MODE)
target_sources(${SIMPLE_OBSW_NAME} PRIVATE FileSystemTest.cpp) target_sources(${SIMPLE_OBSW_NAME} PRIVATE FileSystemTest.cpp)

View File

@ -1,14 +1,11 @@
#include "Q7STestTask.h" #include "Q7STestTask.h"
#include <bsp_q7s/core/CoreController.h> #include <bsp_q7s/core/CoreController.h>
#include <bsp_q7s/memory/FileSystemHandler.h>
#include <bsp_q7s/xadc/Xadc.h> #include <bsp_q7s/xadc/Xadc.h>
#include <fsfw/globalfunctions/arrayprinter.h>
#include <fsfw/objectmanager/ObjectManager.h> #include <fsfw/objectmanager/ObjectManager.h>
#include <fsfw_hal/host/HostFilesystem.h>
#include <gps.h> #include <gps.h>
#include <libgpsmm.h> #include <libgpsmm.h>
#include <param/param_string.h>
#include <param/rparam_client.h>
#include <cstdio> #include <cstdio>
#include <ctime> #include <ctime>
@ -17,17 +14,12 @@
#include <iostream> #include <iostream>
#include <nlohmann/json.hpp> #include <nlohmann/json.hpp>
#include "OBSWConfig.h" #include "bsp_q7s/memory/SdCardManager.h"
#include "bsp_q7s/fs/SdCardManager.h"
#include "bsp_q7s/fs/helpers.h"
#include "bsp_q7s/memory/scratchApi.h" #include "bsp_q7s/memory/scratchApi.h"
#include "fsfw/tasks/TaskFactory.h" #include "fsfw/tasks/TaskFactory.h"
#include "fsfw/timemanager/Stopwatch.h" #include "fsfw/timemanager/Stopwatch.h"
#include "p60pdu.h"
#include "test/DummyParameter.h" #include "test/DummyParameter.h"
using namespace returnvalue;
Q7STestTask::Q7STestTask(object_id_t objectId) : TestTask(objectId) { Q7STestTask::Q7STestTask(object_id_t objectId) : TestTask(objectId) {
doTestSdCard = false; doTestSdCard = false;
doTestScratchApi = false; doTestScratchApi = false;
@ -43,42 +35,13 @@ ReturnValue_t Q7STestTask::performOneShotAction() {
if (doTestScratchApi) { if (doTestScratchApi) {
testScratchApi(); testScratchApi();
} }
if (DO_TEST_GOMSPACE_API) {
uint8_t p60pdu_node = 3;
uint8_t hk_mem[P60PDU_HK_SIZE];
param_index_t p60pdu_hk{};
p60pdu_hk.physaddr = hk_mem;
if (!p60pdu_get_hk(&p60pdu_hk, p60pdu_node, 1000)) {
printf("Error getting p60pdu hk\n");
} else {
param_list(&p60pdu_hk, 1);
}
}
if (DO_TEST_GOMSPACE_GET_CONFIG) {
uint8_t p60pdu_node = 3;
param_index_t requestStruct{};
requestStruct.table = p60pdu_config;
requestStruct.mem_id = P60PDU_PARAM;
uint8_t hk_mem[P60PDU_PARAM_SIZE];
requestStruct.count = p60pdu_config_count;
requestStruct.size = P60PDU_PARAM_SIZE;
requestStruct.physaddr = hk_mem;
int result = rparam_get_full_table(&requestStruct, p60pdu_node, P60_PORT_RPARAM,
requestStruct.mem_id, 1000);
param_list(&requestStruct, 1);
return (result == 0);
}
// testJsonLibDirect(); // testJsonLibDirect();
// testDummyParams(); // testDummyParams();
if (doTestProtHandler) { if (doTestProtHandler) {
testProtHandler(); testProtHandler();
} }
if (DO_TEST_FS_HANDLER) { FsOpCodes opCode = FsOpCodes::APPEND_TO_FILE;
FsOpCodes opCode = FsOpCodes::CREATE_EMPTY_FILE_IN_TMP;
testFileSystemHandlerDirect(opCode); testFileSystemHandlerDirect(opCode);
}
return TestTask::performOneShotAction(); return TestTask::performOneShotAction();
} }
@ -132,23 +95,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 != returnvalue::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 != returnvalue::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 != returnvalue::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 != returnvalue::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;
@ -180,7 +143,7 @@ void Q7STestTask::testDummyParams() {
} }
ReturnValue_t result = param.readJsonFile(); ReturnValue_t result = param.readJsonFile();
if (result != returnvalue::OK) { if (result != HasReturnvaluesIF::RETURN_OK) {
} }
param.setValue(DummyParameter::DUMMY_KEY_PARAM_1, 3); param.setValue(DummyParameter::DUMMY_KEY_PARAM_1, 3);
@ -191,13 +154,13 @@ void Q7STestTask::testDummyParams() {
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 != returnvalue::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 != returnvalue::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;
} }
@ -216,33 +179,18 @@ ReturnValue_t Q7STestTask::initialize() {
void Q7STestTask::testProtHandler() { void Q7STestTask::testProtHandler() {
bool opPerformed = false; bool opPerformed = false;
ReturnValue_t result = returnvalue::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->setBootCopyProtectionAndUpdateFile(xsc::Chip::CHIP_0, xsc::Copy::COPY_0, result = coreController->setBootCopyProtection(xsc::Chip::ALL_CHIP, xsc::Copy::ALL_COPY, true,
true); opPerformed, true);
if (result != returnvalue::OK) { if (result != HasReturnvaluesIF::RETURN_OK) {
sif::warning << "Q7STestTask::testProtHandler: Op failed" << std::endl;
}
result = coreController->setBootCopyProtectionAndUpdateFile(xsc::Chip::CHIP_0, xsc::Copy::COPY_1,
true);
if (result != returnvalue::OK) {
sif::warning << "Q7STestTask::testProtHandler: Op failed" << std::endl;
}
result = coreController->setBootCopyProtectionAndUpdateFile(xsc::Chip::CHIP_1, xsc::Copy::COPY_0,
true);
if (result != returnvalue::OK) {
sif::warning << "Q7STestTask::testProtHandler: Op failed" << std::endl;
}
result = coreController->setBootCopyProtectionAndUpdateFile(xsc::Chip::CHIP_1, xsc::Copy::COPY_1,
true);
if (result != returnvalue::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->setBootCopyProtectionAndUpdateFile(xsc::Chip::SELF_CHIP, result = coreController->setBootCopyProtection(xsc::Chip::SELF_CHIP, xsc::Copy::SELF_COPY, false,
xsc::Copy::SELF_COPY, false); opPerformed, true);
if (result != returnvalue::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) {
@ -254,9 +202,9 @@ void Q7STestTask::testProtHandler() {
} }
// lock own copy // lock own copy
result = coreController->setBootCopyProtectionAndUpdateFile(xsc::Chip::SELF_CHIP, result = coreController->setBootCopyProtection(xsc::Chip::SELF_CHIP, xsc::Copy::SELF_COPY, true,
xsc::Copy::SELF_COPY, true); opPerformed, true);
if (result != returnvalue::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) {
@ -268,9 +216,9 @@ void Q7STestTask::testProtHandler() {
} }
// unlock specific copy // unlock specific copy
result = coreController->setBootCopyProtectionAndUpdateFile(xsc::Chip::CHIP_1, xsc::Copy::COPY_1, result = coreController->setBootCopyProtection(xsc::Chip::CHIP_1, xsc::Copy::COPY_1, false,
false); opPerformed, true);
if (result != returnvalue::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) {
@ -282,9 +230,9 @@ void Q7STestTask::testProtHandler() {
} }
// lock specific copy // lock specific copy
result = coreController->setBootCopyProtectionAndUpdateFile(xsc::Chip::CHIP_1, xsc::Copy::COPY_1, result = coreController->setBootCopyProtection(xsc::Chip::CHIP_1, xsc::Copy::COPY_1, true,
true); opPerformed, true);
if (result != returnvalue::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) {
@ -387,28 +335,150 @@ void Q7STestTask::testGpsDaemonSocket() {
} }
void Q7STestTask::testFileSystemHandlerDirect(FsOpCodes opCode) { void Q7STestTask::testFileSystemHandlerDirect(FsOpCodes opCode) {
HostFilesystem hostFs; auto fsHandler = ObjectManager::instance()->get<FileSystemHandler>(objects::FILE_SYSTEM_HANDLER);
auto* sdcMan = SdCardManager::instance(); if (fsHandler == nullptr) {
std::string mountPrefix = sdcMan->getCurrentMountPrefix(); sif::warning << "Q7STestTask::testFileSystemHandlerDirect: No FS handler running.."
sif::info << "Current mount prefix: " << mountPrefix << std::endl; << std::endl;
auto prefixedPath = fshelpers::getPrefixedPath(*sdcMan, "conf/test.txt");
sif::info << "Prefixed path: " << prefixedPath << std::endl;
if (opCode == FsOpCodes::CREATE_EMPTY_FILE_IN_TMP) {
FilesystemParams params("/tmp/hello.txt");
auto res = hostFs.createFile(params);
if (res != OK) {
sif::warning << "Creating empty file in /tmp failed" << std::endl;
} }
bool fileExists = std::filesystem::exists("/tmp/hello.txt"); FileSystemHandler::FsCommandCfg cfg = {};
if (not fileExists) { ReturnValue_t result = HasReturnvaluesIF::RETURN_OK;
sif::warning << "File was not created!" << std::endl;
// Lambda for common code
auto createNonEmptyTmpDir = [&]() {
if (not std::filesystem::exists("/tmp/test")) {
result = fsHandler->createDirectory("/tmp", "test", false, &cfg);
if (result != HasReturnvaluesIF::RETURN_OK) {
return result;
}
}
// Creating sample files
sif::info << "Creating sample files in directory" << std::endl;
result = fsHandler->createFile("/tmp/test", "test1.txt", nullptr, 0, &cfg);
if (result != HasReturnvaluesIF::RETURN_OK) {
return result;
}
result = fsHandler->createFile("/tmp/test", "test2.txt", nullptr, 0, &cfg);
if (result != HasReturnvaluesIF::RETURN_OK) {
return result;
}
return result;
};
switch (opCode) {
case (FsOpCodes::CREATE_EMPTY_FILE_IN_TMP): {
// No mount prefix, cause file is created in tmp
cfg.useMountPrefix = false;
sif::info << "Creating empty file in /tmp folder" << std::endl;
// Do not delete file, user can check existence in shell
fsHandler->createFile("/tmp/", "test.txt", nullptr, 0, &cfg);
break;
}
case (FsOpCodes::REMOVE_TMP_FILE): {
sif::info << "Deleting /tmp/test.txt sample file" << std::endl;
// No mount prefix, cause file is created in tmp
cfg.useMountPrefix = false;
if (not std::filesystem::exists("/tmp/test.txt")) {
// Creating sample file
sif::info << "Creating sample file /tmp/test.txt to delete" << std::endl;
fsHandler->createFile("/tmp/", "test.txt", nullptr, 0, &cfg);
}
result = fsHandler->removeFile("/tmp", "test.txt", &cfg);
if (result == HasReturnvaluesIF::RETURN_OK) {
sif::info << "File removed successfully" << std::endl;
} else {
sif::warning << "File removal failed!" << std::endl;
}
break;
}
case (FsOpCodes::CREATE_DIR_IN_TMP): {
// No mount prefix, cause file is created in tmp
cfg.useMountPrefix = false;
sif::info << "Creating empty file in /tmp folder" << std::endl;
// Do not delete file, user can check existence in shell
ReturnValue_t result = fsHandler->createDirectory("/tmp/", "test", false, &cfg);
if (result == HasReturnvaluesIF::RETURN_OK) {
sif::info << "Directory created successfully" << std::endl;
} else {
sif::warning << "Directory creation failed!" << std::endl;
}
break;
}
case (FsOpCodes::REMOVE_EMPTY_DIR_IN_TMP): {
// No mount prefix, cause file is created in tmp
cfg.useMountPrefix = false;
if (not std::filesystem::exists("/tmp/test")) {
result = fsHandler->createDirectory("/tmp", "test", false, &cfg);
} else {
// Delete any leftover files to regular dir removal works
std::remove("/tmp/test/*");
}
result = fsHandler->removeDirectory("/tmp/", "test", false, &cfg);
if (result == HasReturnvaluesIF::RETURN_OK) {
sif::info << "Directory removed successfully" << std::endl;
} else {
sif::warning << "Directory removal failed!" << std::endl;
}
break;
}
case (FsOpCodes::REMOVE_FILLED_DIR_IN_TMP): {
result = createNonEmptyTmpDir();
if (result != HasReturnvaluesIF::RETURN_OK) {
return;
}
result = fsHandler->removeDirectory("/tmp/", "test", true, &cfg);
if (result == HasReturnvaluesIF::RETURN_OK) {
sif::info << "Directory removed recursively successfully" << std::endl;
} else {
sif::warning << "Recursive directory removal failed!" << std::endl;
}
break;
}
case (FsOpCodes::ATTEMPT_DIR_REMOVAL_NON_EMPTY): {
result = createNonEmptyTmpDir();
if (result != HasReturnvaluesIF::RETURN_OK) {
return;
}
result = fsHandler->removeDirectory("/tmp/", "test", false, &cfg);
if (result != HasReturnvaluesIF::RETURN_OK) {
sif::info << "Directory removal attempt failed as expected" << std::endl;
} else {
sif::warning << "Directory removal worked when it should not have!" << std::endl;
}
break;
}
case (FsOpCodes::RENAME_FILE): {
// No mount prefix, cause file is created in tmp
cfg.useMountPrefix = false;
if (std::filesystem::exists("/tmp/test.txt")) {
fsHandler->removeDirectory("/tmp/", "test", false, &cfg);
}
sif::info << "Creating empty file /tmp/test.txt and rename to /tmp/test2.txt" << std::endl;
// Do not delete file, user can check existence in shell
fsHandler->createFile("/tmp/", "test.txt", nullptr, 0, &cfg);
fsHandler->renameFile("/tmp/", "test.txt", "test2.txt", &cfg);
break;
}
case (FsOpCodes::APPEND_TO_FILE): {
// No mount prefix, cause file is created in tmp
cfg.useMountPrefix = false;
if (std::filesystem::exists("/tmp/test.txt")) {
fsHandler->removeDirectory("/tmp/", "test", false, &cfg);
}
if (std::filesystem::exists("/tmp/test.txt")) {
fsHandler->removeDirectory("/tmp/", "test", false, &cfg);
}
sif::info << "Creating empty file /tmp/test.txt and adding content" << std::endl;
std::string content = "Hello World\n";
// Do not delete file, user can check existence in shell
fsHandler->createFile("/tmp/", "test.txt", nullptr, 0, &cfg);
fsHandler->appendToFile("/tmp/", "test.txt", reinterpret_cast<const uint8_t*>(content.data()),
content.size(), 0, &cfg);
} }
hostFs.removeFile("/tmp/hello.txt");
} }
} }
void Q7STestTask::xadcTest() { void Q7STestTask::xadcTest() {
ReturnValue_t result = returnvalue::OK; ReturnValue_t result = RETURN_OK;
float temperature = 0; float temperature = 0;
float vccPint = 0; float vccPint = 0;
float vccPaux = 0; float vccPaux = 0;
@ -420,39 +490,39 @@ void Q7STestTask::xadcTest() {
float vrefn = 0; float vrefn = 0;
Xadc xadc; Xadc xadc;
result = xadc.getTemperature(temperature); result = xadc.getTemperature(temperature);
if (result == returnvalue::OK) { if (result == HasReturnvaluesIF::RETURN_OK) {
sif::info << "Q7STestTask::xadcTest: Chip Temperature: " << temperature << " °C" << std::endl; sif::info << "Q7STestTask::xadcTest: Chip Temperature: " << temperature << " °C" << std::endl;
} }
result = xadc.getVccPint(vccPint); result = xadc.getVccPint(vccPint);
if (result == returnvalue::OK) { if (result == HasReturnvaluesIF::RETURN_OK) {
sif::info << "Q7STestTask::xadcTest: VCC PS internal: " << vccPint << " mV" << std::endl; sif::info << "Q7STestTask::xadcTest: VCC PS internal: " << vccPint << " mV" << std::endl;
} }
result = xadc.getVccPaux(vccPaux); result = xadc.getVccPaux(vccPaux);
if (result == returnvalue::OK) { if (result == HasReturnvaluesIF::RETURN_OK) {
sif::info << "Q7STestTask::xadcTest: VCC PS auxilliary: " << vccPaux << " mV" << std::endl; sif::info << "Q7STestTask::xadcTest: VCC PS auxilliary: " << vccPaux << " mV" << std::endl;
} }
result = xadc.getVccInt(vccInt); result = xadc.getVccInt(vccInt);
if (result == returnvalue::OK) { if (result == HasReturnvaluesIF::RETURN_OK) {
sif::info << "Q7STestTask::xadcTest: VCC PL internal: " << vccInt << " mV" << std::endl; sif::info << "Q7STestTask::xadcTest: VCC PL internal: " << vccInt << " mV" << std::endl;
} }
result = xadc.getVccAux(vccAux); result = xadc.getVccAux(vccAux);
if (result == returnvalue::OK) { if (result == HasReturnvaluesIF::RETURN_OK) {
sif::info << "Q7STestTask::xadcTest: VCC PL auxilliary: " << vccAux << " mV" << std::endl; sif::info << "Q7STestTask::xadcTest: VCC PL auxilliary: " << vccAux << " mV" << std::endl;
} }
result = xadc.getVccBram(vccBram); result = xadc.getVccBram(vccBram);
if (result == returnvalue::OK) { if (result == HasReturnvaluesIF::RETURN_OK) {
sif::info << "Q7STestTask::xadcTest: VCC BRAM: " << vccBram << " mV" << std::endl; sif::info << "Q7STestTask::xadcTest: VCC BRAM: " << vccBram << " mV" << std::endl;
} }
result = xadc.getVccOddr(vccOddr); result = xadc.getVccOddr(vccOddr);
if (result == returnvalue::OK) { if (result == HasReturnvaluesIF::RETURN_OK) {
sif::info << "Q7STestTask::xadcTest: VCC PS I/O DDR : " << vccOddr << " mV" << std::endl; sif::info << "Q7STestTask::xadcTest: VCC PS I/O DDR : " << vccOddr << " mV" << std::endl;
} }
result = xadc.getVrefp(vrefp); result = xadc.getVrefp(vrefp);
if (result == returnvalue::OK) { if (result == HasReturnvaluesIF::RETURN_OK) {
sif::info << "Q7STestTask::xadcTest: Vrefp : " << vrefp << " mV" << std::endl; sif::info << "Q7STestTask::xadcTest: Vrefp : " << vrefp << " mV" << std::endl;
} }
result = xadc.getVrefn(vrefn); result = xadc.getVrefn(vrefn);
if (result == returnvalue::OK) { if (result == HasReturnvaluesIF::RETURN_OK) {
sif::info << "Q7STestTask::xadcTest: Vrefn : " << vrefn << " mV" << std::endl; sif::info << "Q7STestTask::xadcTest: Vrefn : " << vrefn << " mV" << std::endl;
} }
} }

View File

@ -3,7 +3,7 @@
#include <libgpsmm.h> #include <libgpsmm.h>
#include "test/TestTask.h" #include "test/testtasks/TestTask.h"
class CoreController; class CoreController;
@ -16,9 +16,6 @@ class Q7STestTask : public TestTask {
private: private:
bool doTestSdCard = false; bool doTestSdCard = false;
bool doTestScratchApi = false; bool doTestScratchApi = false;
static constexpr bool DO_TEST_GOMSPACE_API = false;
static constexpr bool DO_TEST_GOMSPACE_GET_CONFIG = false;
static constexpr bool DO_TEST_FS_HANDLER = false;
bool doTestGpsShm = false; bool doTestGpsShm = false;
bool doTestGpsSocket = false; bool doTestGpsSocket = false;
bool doTestProtHandler = false; bool doTestProtHandler = false;

View File

@ -4,26 +4,20 @@
#include "fsfw/action/HasActionsIF.h" #include "fsfw/action/HasActionsIF.h"
#include "fsfw/tasks/TaskFactory.h" #include "fsfw/tasks/TaskFactory.h"
ReturnValue_t gps::triggerGpioResetPin(const uint8_t* actionData, size_t len, void* args) { ReturnValue_t gps::triggerGpioResetPin(uint8_t gpsId, void* args) {
// At least one byte which denotes which GPS to reset is required
if (len < 1 or actionData == nullptr) {
return HasActionsIF::INVALID_PARAMETERS;
}
ResetArgs* resetArgs = reinterpret_cast<ResetArgs*>(args); ResetArgs* resetArgs = reinterpret_cast<ResetArgs*>(args);
if (args == nullptr) { if (args == nullptr) {
return returnvalue::FAILED; return HasReturnvaluesIF::RETURN_FAILED;
} }
if (resetArgs->gpioComIF == nullptr) { if (resetArgs->gpioComIF == nullptr) {
return returnvalue::FAILED; return HasReturnvaluesIF::RETURN_FAILED;
} }
gpioId_t gpioId; gpioId_t gpioId = gpioIds::GNSS_0_NRESET;
if (actionData[0] == 0) { if (gpsId == 1) {
gpioId = gpioIds::GNSS_0_NRESET;
} else {
gpioId = gpioIds::GNSS_1_NRESET; gpioId = gpioIds::GNSS_1_NRESET;
} }
resetArgs->gpioComIF->pullLow(gpioId); resetArgs->gpioComIF->pullLow(gpioId);
TaskFactory::delayTask(resetArgs->waitPeriodMs); TaskFactory::delayTask(resetArgs->waitPeriodMs);
resetArgs->gpioComIF->pullHigh(gpioId); resetArgs->gpioComIF->pullHigh(gpioId);
return returnvalue::OK; return HasReturnvaluesIF::RETURN_OK;
} }

View File

@ -1,7 +1,7 @@
#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/returnvalues/returnvalue.h" #include "fsfw/returnvalues/HasReturnvaluesIF.h"
#include "fsfw_hal/linux/gpio/LinuxLibgpioIF.h" #include "fsfw_hal/linux/gpio/LinuxLibgpioIF.h"
struct ResetArgs { struct ResetArgs {
@ -11,7 +11,7 @@ struct ResetArgs {
namespace gps { namespace gps {
ReturnValue_t triggerGpioResetPin(const uint8_t* actionData, size_t len, void* args); ReturnValue_t triggerGpioResetPin(uint8_t gpsId, void* args);
} }

View File

@ -1,10 +1,10 @@
#ifndef BSP_Q7S_CALLBACKS_PCDUSWITCHCB_H_ #ifndef BSP_Q7S_CALLBACKS_PCDUSWITCHCB_H_
#define BSP_Q7S_CALLBACKS_PCDUSWITCHCB_H_ #define BSP_Q7S_CALLBACKS_PCDUSWITCHCB_H_
#include <mission/power/gsDefs.h>
#include <cstdint> #include <cstdint>
#include "mission/devices/devicedefinitions/GomspaceDefinitions.h"
namespace pcdu { namespace pcdu {
void switchCallback(GOMSPACE::Pdu pdu, uint8_t channel, bool state, void* args); void switchCallback(GOMSPACE::Pdu pdu, uint8_t channel, bool state, void* args);

View File

@ -47,7 +47,7 @@ void q7s::gpioCallbacks::initSpiCsDecoder(GpioIF* gpioComIF) {
spiMuxGpios->addGpio(gpioIds::EN_RW_CS, enRwDecoder); spiMuxGpios->addGpio(gpioIds::EN_RW_CS, enRwDecoder);
result = gpioComIF->addGpios(spiMuxGpios); result = gpioComIF->addGpios(spiMuxGpios);
if (result != returnvalue::OK) { if (result != HasReturnvaluesIF::RETURN_OK) {
sif::error << "initSpiCsDecoder: Failed to add SPI MUX bit GPIOs" << std::endl; sif::error << "initSpiCsDecoder: Failed to add SPI MUX bit GPIOs" << std::endl;
return; return;
} }

View File

@ -6,7 +6,7 @@
#include "fsfw/serviceinterface/ServiceInterface.h" #include "fsfw/serviceinterface/ServiceInterface.h"
#include "fsfw_hal/linux/UnixFileGuard.h" #include "fsfw_hal/linux/UnixFileGuard.h"
#include "fsfw_hal/linux/spi/SpiCookie.h" #include "fsfw_hal/linux/spi/SpiCookie.h"
#include "mission/acs/RwHandler.h" #include "mission/devices/RwHandler.h"
namespace rwSpiCallback { namespace rwSpiCallback {
@ -29,32 +29,32 @@ void closeSpi(int fd, gpioId_t gpioId, GpioIF* gpioIF, MutexIF* mutex);
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) {
// Stopwatch watch; // Stopwatch watch;
ReturnValue_t result = returnvalue::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" << std::endl; sif::error << "rwSpiCallback::spiCallback: Pointer to handler is invalid" << std::endl;
return returnvalue::FAILED; return HasReturnvaluesIF::RETURN_FAILED;
} }
uint8_t writeBuffer[2] = {}; uint8_t writeBuffer[2] = {};
uint8_t writeSize = 0; uint8_t writeSize = 0;
gpioId_t gpioId = cookie->getChipSelectPin(); gpioId_t gpioId = cookie->getChipSelectPin();
GpioIF& gpioIF = comIf->getGpioInterface(); GpioIF* gpioIF = comIf->getGpioInterface();
MutexIF::TimeoutType timeoutType = MutexIF::TimeoutType::WAITING; MutexIF::TimeoutType timeoutType = MutexIF::TimeoutType::WAITING;
uint32_t timeoutMs = 0; uint32_t timeoutMs = 0;
MutexIF* mutex = comIf->getCsMutex(); MutexIF* mutex = comIf->getCsMutex();
cookie->getMutexParams(timeoutType, timeoutMs); cookie->getMutexParams(timeoutType, timeoutMs);
if (mutex == 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 returnvalue::FAILED; return HasReturnvaluesIF::RETURN_FAILED;
} }
int fileDescriptor = 0; int fileDescriptor = 0;
const std::string& dev = comIf->getSpiDev(); const std::string& dev = comIf->getSpiDev();
result = openSpi(dev, O_RDWR, &gpioIF, gpioId, mutex, timeoutType, timeoutMs, fileDescriptor); result = openSpi(dev, O_RDWR, gpioIF, gpioId, mutex, timeoutType, timeoutMs, fileDescriptor);
if (result != returnvalue::OK) { if (result != HasReturnvaluesIF::RETURN_OK) {
return result; return result;
} }
@ -75,8 +75,8 @@ ReturnValue_t spiCallback(SpiComIF* comIf, SpiCookie* cookie, const uint8_t* sen
if (write(fileDescriptor, writeBuffer, writeSize) != static_cast<ssize_t>(writeSize)) { if (write(fileDescriptor, writeBuffer, writeSize) != static_cast<ssize_t>(writeSize)) {
sif::error << "rwSpiCallback::spiCallback: Write failed!" << std::endl; sif::error << "rwSpiCallback::spiCallback: Write failed!" << std::endl;
closeSpi(fileDescriptor, gpioId, &gpioIF, mutex); closeSpi(fileDescriptor, gpioId, gpioIF, mutex);
return rws::SPI_WRITE_FAILURE; return RwHandler::SPI_WRITE_FAILURE;
} }
/** Encoding and sending command */ /** Encoding and sending command */
@ -100,8 +100,8 @@ ReturnValue_t spiCallback(SpiComIF* comIf, SpiCookie* cookie, const uint8_t* sen
} }
if (write(fileDescriptor, writeBuffer, writeSize) != static_cast<ssize_t>(writeSize)) { if (write(fileDescriptor, writeBuffer, writeSize) != static_cast<ssize_t>(writeSize)) {
sif::error << "rwSpiCallback::spiCallback: Write failed!" << std::endl; sif::error << "rwSpiCallback::spiCallback: Write failed!" << std::endl;
closeSpi(fileDescriptor, gpioId, &gpioIF, mutex); closeSpi(fileDescriptor, gpioId, gpioIF, mutex);
return rws::SPI_WRITE_FAILURE; return RwHandler::SPI_WRITE_FAILURE;
} }
idx++; idx++;
} }
@ -112,14 +112,14 @@ ReturnValue_t spiCallback(SpiComIF* comIf, SpiCookie* cookie, const uint8_t* sen
if (write(fileDescriptor, writeBuffer, writeSize) != static_cast<ssize_t>(writeSize)) { if (write(fileDescriptor, writeBuffer, writeSize) != static_cast<ssize_t>(writeSize)) {
sif::error << "rwSpiCallback::spiCallback: Write failed!" << std::endl; sif::error << "rwSpiCallback::spiCallback: Write failed!" << std::endl;
closeSpi(fileDescriptor, gpioId, &gpioIF, mutex); closeSpi(fileDescriptor, gpioId, gpioIF, mutex);
return rws::SPI_WRITE_FAILURE; return RwHandler::SPI_WRITE_FAILURE;
} }
uint8_t* rxBuf = nullptr; uint8_t* rxBuf = nullptr;
result = comIf->getReadBuffer(cookie->getSpiAddress(), &rxBuf); result = comIf->getReadBuffer(cookie->getSpiAddress(), &rxBuf);
if (result != returnvalue::OK) { if (result != HasReturnvaluesIF::RETURN_OK) {
closeSpi(fileDescriptor, gpioId, &gpioIF, mutex); closeSpi(fileDescriptor, gpioId, gpioIF, mutex);
return result; return result;
} }
@ -127,10 +127,10 @@ ReturnValue_t spiCallback(SpiComIF* comIf, SpiCookie* cookie, const uint8_t* sen
// There must be a delay of at least 20 ms after sending the command. // There must be a delay of at least 20 ms after sending the command.
// Delay for 70 ms here and release the SPI bus for that duration. // Delay for 70 ms here and release the SPI bus for that duration.
closeSpi(fileDescriptor, gpioId, &gpioIF, mutex); closeSpi(fileDescriptor, gpioId, gpioIF, mutex);
usleep(rws::SPI_REPLY_DELAY); usleep(RwDefinitions::SPI_REPLY_DELAY);
result = openSpi(dev, O_RDWR, &gpioIF, gpioId, mutex, timeoutType, timeoutMs, fileDescriptor); result = openSpi(dev, O_RDWR, gpioIF, gpioId, mutex, timeoutType, timeoutMs, fileDescriptor);
if (result != returnvalue::OK) { if (result != HasReturnvaluesIF::RETURN_OK) {
return result; return result;
} }
@ -139,17 +139,17 @@ ReturnValue_t spiCallback(SpiComIF* comIf, SpiCookie* cookie, const uint8_t* sen
* However, receiving more than 5 empty frames will be interpreted as an error. * However, receiving more than 5 empty frames will be interpreted as an error.
*/ */
uint8_t byteRead = 0; uint8_t byteRead = 0;
for (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(fileDescriptor, gpioId, &gpioIF, mutex); closeSpi(fileDescriptor, gpioId, gpioIF, mutex);
return rws::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(fileDescriptor, gpioId, &gpioIF, mutex); closeSpi(fileDescriptor, gpioId, gpioIF, mutex);
return rws::NO_START_MARKER; return RwHandler::NO_START_MARKER;
} }
} }
@ -159,8 +159,8 @@ ReturnValue_t spiCallback(SpiComIF* comIf, SpiCookie* cookie, const uint8_t* sen
if (idx == 9) { if (idx == 9) {
sif::error << "rwSpiCallback::spiCallback: Empty frame timeout" << std::endl; sif::error << "rwSpiCallback::spiCallback: Empty frame timeout" << std::endl;
closeSpi(fileDescriptor, gpioId, &gpioIF, mutex); closeSpi(fileDescriptor, gpioId, gpioIF, mutex);
return rws::NO_REPLY; return RwHandler::NO_REPLY;
} }
} }
@ -175,7 +175,7 @@ ReturnValue_t spiCallback(SpiComIF* comIf, SpiCookie* cookie, const uint8_t* sen
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 = rws::SPI_READ_FAILURE; result = RwHandler::SPI_READ_FAILURE;
break; break;
} }
} }
@ -186,7 +186,7 @@ ReturnValue_t spiCallback(SpiComIF* comIf, SpiCookie* cookie, const uint8_t* sen
} 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 = rws::SPI_READ_FAILURE; result = RwHandler::SPI_READ_FAILURE;
break; break;
} }
if (byteRead == 0x5E) { if (byteRead == 0x5E) {
@ -199,8 +199,8 @@ ReturnValue_t spiCallback(SpiComIF* comIf, SpiCookie* cookie, const uint8_t* sen
continue; continue;
} else { } else {
sif::error << "rwSpiCallback::spiCallback: Invalid substitute" << std::endl; sif::error << "rwSpiCallback::spiCallback: Invalid substitute" << std::endl;
closeSpi(fileDescriptor, gpioId, &gpioIF, mutex); closeSpi(fileDescriptor, gpioId, gpioIF, mutex);
result = rws::INVALID_SUBSTITUTE; result = RwHandler::INVALID_SUBSTITUTE;
break; break;
} }
} else { } else {
@ -217,23 +217,23 @@ ReturnValue_t spiCallback(SpiComIF* comIf, SpiCookie* cookie, const uint8_t* sen
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 = rws::SPI_READ_FAILURE; result = RwHandler::SPI_READ_FAILURE;
break; break;
} }
if (byteRead != FLAG_BYTE) { if (byteRead != FLAG_BYTE) {
sif::error << "rwSpiCallback::spiCallback: Missing end sign " << static_cast<int>(FLAG_BYTE) sif::error << "rwSpiCallback::spiCallback: Missing end sign " << static_cast<int>(FLAG_BYTE)
<< std::endl; << std::endl;
decodedFrameLen--; decodedFrameLen--;
result = rws::MISSING_END_SIGN; result = RwHandler::MISSING_END_SIGN;
break; break;
} }
} }
result = returnvalue::OK; result = HasReturnvaluesIF::RETURN_OK;
} }
cookie->setTransferSize(decodedFrameLen); cookie->setTransferSize(decodedFrameLen);
closeSpi(fileDescriptor, gpioId, &gpioIF, mutex); closeSpi(fileDescriptor, gpioId, gpioIF, mutex);
return result; return result;
} }
@ -244,7 +244,7 @@ ReturnValue_t openSpi(const std::string& devname, int flags, GpioIF* gpioIF, gpi
MutexIF* mutex, MutexIF::TimeoutType timeoutType, uint32_t timeoutMs, MutexIF* mutex, MutexIF::TimeoutType timeoutType, uint32_t timeoutMs,
int& fd) { int& fd) {
ReturnValue_t result = mutex->lockMutex(timeoutType, timeoutMs); ReturnValue_t result = mutex->lockMutex(timeoutType, timeoutMs);
if (result != returnvalue::OK) { if (result != HasReturnvaluesIF::RETURN_OK) {
sif::debug << "rwSpiCallback::spiCallback: Failed to lock mutex" << std::endl; sif::debug << "rwSpiCallback::spiCallback: Failed to lock mutex" << std::endl;
return result; return result;
} }
@ -252,27 +252,27 @@ ReturnValue_t openSpi(const std::string& devname, int flags, GpioIF* gpioIF, gpi
fd = open(devname.c_str(), flags); fd = open(devname.c_str(), flags);
if (fd < 0) { if (fd < 0) {
sif::error << "rwSpiCallback::spiCallback: Failed to open device file" << std::endl; sif::error << "rwSpiCallback::spiCallback: Failed to open device file" << std::endl;
return spi::OPENING_FILE_FAILED; return SpiComIF::OPENING_FILE_FAILED;
} }
// 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) {
result = gpioIF->pullLow(gpioId); result = gpioIF->pullLow(gpioId);
if (result != returnvalue::OK) { if (result != 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;
return result; return result;
} }
} }
return returnvalue::OK; return HasReturnvaluesIF::RETURN_OK;
} }
void closeSpi(int fd, gpioId_t gpioId, GpioIF* gpioIF, MutexIF* mutex) { void closeSpi(int fd, gpioId_t gpioId, GpioIF* gpioIF, MutexIF* mutex) {
close(fd); close(fd);
if (gpioId != gpio::NO_GPIO) { if (gpioId != gpio::NO_GPIO) {
if (gpioIF->pullHigh(gpioId) != returnvalue::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() != returnvalue::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;
; ;
} }

View File

@ -1,7 +1,7 @@
#ifndef BSP_Q7S_RW_SPI_CALLBACK_H_ #ifndef BSP_Q7S_RW_SPI_CALLBACK_H_
#define BSP_Q7S_RW_SPI_CALLBACK_H_ #define BSP_Q7S_RW_SPI_CALLBACK_H_
#include "fsfw/returnvalues/returnvalue.h" #include "fsfw/returnvalues/HasReturnvaluesIF.h"
#include "fsfw_hal/common/gpio/GpioCookie.h" #include "fsfw_hal/common/gpio/GpioCookie.h"
#include "fsfw_hal/linux/spi/SpiComIF.h" #include "fsfw_hal/linux/spi/SpiComIF.h"

View File

@ -0,0 +1 @@
target_sources(${OBSW_NAME} PRIVATE)

View File

@ -1,2 +1,4 @@
target_sources(${OBSW_NAME} PRIVATE CoreController.cpp WatchdogHandler.cpp target_sources(${OBSW_NAME} PRIVATE CoreController.cpp InitMission.cpp
XiphosWdtHandler.cpp) ObjectFactory.cpp)
target_sources(${SIMPLE_OBSW_NAME} PRIVATE InitMission.cpp)

View File

@ -0,0 +1,87 @@
#pragma once
#include <fsfw/action/MinMaxParameter.h>
#include <fsfw/action/TemplateAction.h>
#include <fsfw/introspection/Enum.h>
class CoreController;
namespace core {
FSFW_ENUM(ActionId, ActionId_t,
((LIST_DIRECTORY_INTO_FILE, 0, "List Directory into file"))(
(SWITCH_REBOOT_FILE_HANDLING, 5,
"Switch Reboot File Handling"))((RESET_REBOOT_COUNTERS, 6, "Reset Boot Counters"))(
(SWITCH_IMG_LOCK, 7, "Switch Image Lock"))((SET_MAX_REBOOT_CNT, 8,
"Set maximum reboot Count"))(
(XSC_REBOOT_OBC, 32, "Reboot using the xsc_boot_copy command"))(
(MOUNT_OTHER_COPY, 33, "Mount Other Copy"))((REBOOT_OBC, 34,
"Reboot using the reboot command")))
FSFW_ENUM(Boolenum, uint8_t, ((NO, 0, "NO"))((YES, 1, "Yes")))
class ListDirectoryIntoFileAction
: public TemplateAction<CoreController, ListDirectoryIntoFileAction, ActionId> {
public:
ListDirectoryIntoFileAction(CoreController *owner)
: TemplateAction(owner, ActionId::LIST_DIRECTORY_INTO_FILE){};
};
class SwitchRebootFileHandlingAction
: public TemplateAction<CoreController, SwitchRebootFileHandlingAction, ActionId> {
public:
SwitchRebootFileHandlingAction(CoreController *owner)
: TemplateAction(owner, ActionId::SWITCH_REBOOT_FILE_HANDLING){};
Parameter<Boolenum> enableRebootFile =
Parameter<Boolenum>::createParameter(this, "Enable Reboot File");
};
class ResetRebootCountersAction
: public TemplateAction<CoreController, ResetRebootCountersAction, ActionId> {
public:
FSFW_ENUM(Selection, uint8_t, ((ZERO, "0"))((ONE, "1"))((ALL, "All")))
ResetRebootCountersAction(CoreController *owner)
: TemplateAction(owner, ActionId::RESET_REBOOT_COUNTERS){};
Parameter<Selection> chip = Parameter<Selection>::createParameter(this, "Chip");
Parameter<Selection> copy = Parameter<Selection>::createParameter(this, "Copy");
};
class SwitchImageLockAction
: public TemplateAction<CoreController, SwitchImageLockAction, ActionId> {
public:
FSFW_ENUM(Selection, uint8_t, ((ZERO, "0"))((ONE, "1")))
SwitchImageLockAction(CoreController *owner) : TemplateAction(owner, ActionId::SWITCH_IMG_LOCK){};
Parameter<Boolenum> lock = Parameter<Boolenum>::createParameter(this, "Lock Image");
Parameter<Selection> chip = Parameter<Selection>::createParameter(this, "Chip");
Parameter<Selection> copy = Parameter<Selection>::createParameter(this, "Copy");
};
class SetMaxRebootCntAction
: public TemplateAction<CoreController, SetMaxRebootCntAction, ActionId> {
public:
SetMaxRebootCntAction(CoreController *owner)
: TemplateAction(owner, ActionId::SET_MAX_REBOOT_CNT){};
Parameter<uint8_t> maxCount = Parameter<uint8_t>::createParameter(this, "Count");
};
class XscRebootObcAction : public TemplateAction<CoreController, XscRebootObcAction, ActionId> {
public:
FSFW_ENUM(Selection, uint8_t, ((ZERO, "0"))((ONE, "1"))((SAME, "Same")))
XscRebootObcAction(CoreController *owner) : TemplateAction(owner, ActionId::XSC_REBOOT_OBC){};
Parameter<Selection> chip = Parameter<Selection>::createParameter(this, "Chip");
Parameter<Selection> copy = Parameter<Selection>::createParameter(this, "Copy");
};
class RebootObcAction : public TemplateAction<CoreController, RebootObcAction, ActionId> {
public:
RebootObcAction(CoreController *owner) : TemplateAction(owner, ActionId::REBOOT_OBC){};
};
} // namespace core

File diff suppressed because it is too large Load Diff

View File

@ -1,30 +1,29 @@
#ifndef BSP_Q7S_CORE_CORECONTROLLER_H_ #ifndef BSP_Q7S_CORE_CORECONTROLLER_H_
#define BSP_Q7S_CORE_CORECONTROLLER_H_ #define BSP_Q7S_CORE_CORECONTROLLER_H_
#include <bsp_q7s/core/defs.h>
#include <fsfw/container/DynamicFIFO.h>
#include <fsfw/container/SimpleRingBuffer.h>
#include <fsfw/globalfunctions/PeriodicOperationDivider.h> #include <fsfw/globalfunctions/PeriodicOperationDivider.h>
#include <fsfw/parameters/ParameterHelper.h>
#include <fsfw/parameters/ReceivesParameterMessagesIF.h>
#include <fsfw_hal/linux/uio/UioMapper.h>
#include <libxiphos.h> #include <libxiphos.h>
#include <linux/acs/GPSDefinitions.h>
#include <mission/utility/trace.h>
#include <atomic>
#include <cstddef> #include <cstddef>
#include "OBSWConfig.h" #include "CoreActions.h"
#include "bsp_q7s/fs/SdCardManager.h" #include "CoreDefinitions.h"
#include "bsp_q7s/memory/SdCardManager.h"
#include "events/subsystemIdRanges.h" #include "events/subsystemIdRanges.h"
#include "fsfw/controller/ExtendedControllerBase.h" #include "fsfw/controller/ExtendedControllerBase.h"
#include "mission/sysDefs.h" #include "mission/devices/devicedefinitions/GPSDefinitions.h"
class Timer; class Timer;
class SdCardManager; class SdCardManager;
struct RebootWatchdogFile { namespace xsc {
enum Chip : int { CHIP_0, CHIP_1, NO_CHIP, SELF_CHIP, ALL_CHIP };
enum Copy : int { COPY_0, COPY_1, NO_COPY, SELF_COPY, ALL_COPY };
} // namespace xsc
struct RebootFile {
static constexpr uint8_t DEFAULT_MAX_BOOT_CNT = 10; static constexpr uint8_t DEFAULT_MAX_BOOT_CNT = 10;
bool enabled = true; bool enabled = true;
@ -45,136 +44,56 @@ struct RebootWatchdogFile {
xsc::Copy mechanismNextCopy = xsc::Copy::NO_COPY; xsc::Copy mechanismNextCopy = xsc::Copy::NO_COPY;
}; };
class RebootWatchdogPacket : public SerialLinkedListAdapter<SerializeIF> { class CoreController : public ExtendedControllerBase {
public: public:
RebootWatchdogPacket(RebootWatchdogFile& rf) {
enabled = rf.enabled;
maxCount = rf.maxCount;
img00Count = rf.img00Cnt;
img01Count = rf.img01Cnt;
img10Count = rf.img10Cnt;
img11Count = rf.img11Cnt;
img00Lock = rf.img00Lock;
img01Lock = rf.img01Lock;
img10Lock = rf.img10Lock;
img11Lock = rf.img11Lock;
lastChip = static_cast<uint8_t>(rf.lastChip);
lastCopy = static_cast<uint8_t>(rf.lastCopy);
nextChip = static_cast<uint8_t>(rf.mechanismNextChip);
nextCopy = static_cast<uint8_t>(rf.mechanismNextCopy);
setLinks();
}
private:
void setLinks() {
setStart(&enabled);
enabled.setNext(&maxCount);
maxCount.setNext(&img00Count);
img00Count.setNext(&img01Count);
img01Count.setNext(&img10Count);
img10Count.setNext(&img11Count);
img11Count.setNext(&img00Lock);
img00Lock.setNext(&img01Lock);
img01Lock.setNext(&img10Lock);
img10Lock.setNext(&img11Lock);
img11Lock.setNext(&lastChip);
lastChip.setNext(&lastCopy);
lastCopy.setNext(&nextChip);
nextChip.setNext(&nextCopy);
setLast(&nextCopy);
}
SerializeElement<uint8_t> enabled = false;
SerializeElement<uint32_t> maxCount = 0;
SerializeElement<uint32_t> img00Count = 0;
SerializeElement<uint32_t> img01Count = 0;
SerializeElement<uint32_t> img10Count = 0;
SerializeElement<uint32_t> img11Count = 0;
SerializeElement<uint8_t> img00Lock = false;
SerializeElement<uint8_t> img01Lock = false;
SerializeElement<uint8_t> img10Lock = false;
SerializeElement<uint8_t> img11Lock = false;
SerializeElement<uint8_t> lastChip = 0;
SerializeElement<uint8_t> lastCopy = 0;
SerializeElement<uint8_t> nextChip = 0;
SerializeElement<uint8_t> nextCopy = 0;
};
struct RebootCountersFile {
// 16 bit values so all boot counters fit into one event.
uint16_t img00Cnt = 0;
uint16_t img01Cnt = 0;
uint16_t img10Cnt = 0;
uint16_t img11Cnt = 0;
};
class RebootCountersPacket : public SerialLinkedListAdapter<SerializeIF> {
RebootCountersPacket(RebootCountersFile& rf) {
img00Count = rf.img00Cnt;
img01Count = rf.img01Cnt;
img10Count = rf.img10Cnt;
img11Count = rf.img11Cnt;
setLinks();
}
private:
void setLinks() {
setStart(&img00Count);
img00Count.setNext(&img01Count);
img01Count.setNext(&img10Count);
img10Count.setNext(&img11Count);
setLast(&img11Count);
}
SerializeElement<uint16_t> img00Count = 0;
SerializeElement<uint16_t> img01Count = 0;
SerializeElement<uint16_t> img10Count = 0;
SerializeElement<uint16_t> img11Count = 0;
};
class CoreController : public ExtendedControllerBase, public ReceivesParameterMessagesIF {
public:
enum ParamId : uint8_t { PREF_SD = 0, NUM_IDS };
static xsc::Chip CURRENT_CHIP; static xsc::Chip CURRENT_CHIP;
static xsc::Copy CURRENT_COPY; static xsc::Copy CURRENT_COPY;
static constexpr char CHIP_PROT_SCRIPT[] = "get-chip-prot-status.sh"; static constexpr char CHIP_PROT_SCRIPT[] = "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 CONF_FOLDER[] = "conf";
static constexpr char VERSION_FILE_NAME[] = "version.txt";
static constexpr char REBOOT_FILE_NAME[] = "reboot.txt";
static constexpr char TIME_FILE_NAME[] = "time.txt";
const std::string VERSION_FILE = const std::string VERSION_FILE =
"/" + std::string(core::CONF_FOLDER) + "/" + std::string(core::VERSION_FILE_NAME); "/" + std::string(CONF_FOLDER) + "/" + std::string(VERSION_FILE_NAME);
const std::string LEGACY_REBOOT_WATCHDOG_FILE = const std::string REBOOT_FILE =
"/" + std::string(core::CONF_FOLDER) + "/" + "/" + std::string(CONF_FOLDER) + "/" + std::string(REBOOT_FILE_NAME);
std::string(core::LEGACY_REBOOT_WATCHDOG_FILE_NAME); const std::string TIME_FILE = "/" + std::string(CONF_FOLDER) + "/" + std::string(TIME_FILE_NAME);
const std::string REBOOT_WATCHDOG_FILE =
"/" + std::string(core::CONF_FOLDER) + "/" + std::string(core::REBOOT_WATCHDOG_FILE_NAME);
const std::string LEAP_SECONDS_FILE =
"/" + std::string(core::CONF_FOLDER) + "/" + std::string(core::LEAP_SECONDS_FILE_NAME);
const std::string BACKUP_TIME_FILE =
"/" + std::string(core::CONF_FOLDER) + "/" + std::string(core::TIME_FILE_NAME);
const std::string REBOOT_COUNTERS_FILE =
"/" + std::string(core::CONF_FOLDER) + "/" + std::string(core::REBOOT_COUNTER_FILE_NAME);
static constexpr char CHIP_0_COPY_0_MOUNT_DIR[] = "/tmp/mntupdate-xdi-qspi0-nom-rootfs"; static constexpr uint8_t SUBSYSTEM_ID = SUBSYSTEM_ID::CORE;
static constexpr char CHIP_0_COPY_1_MOUNT_DIR[] = "/tmp/mntupdate-xdi-qspi0-gold-rootfs";
static constexpr char CHIP_1_COPY_0_MOUNT_DIR[] = "/tmp/mntupdate-xdi-qspi1-nom-rootfs";
static constexpr char CHIP_1_COPY_1_MOUNT_DIR[] = "/tmp/mntupdate-xdi-qspi1-gold-rootfs";
static constexpr char LIST_DIR_DUMP_WORK_FILE[] = "/tmp/dir_listing.tmp";
static constexpr dur_millis_t INIT_SD_CARD_CHECK_TIMEOUT = 5000; static constexpr Event ALLOC_FAILURE = event::makeEvent(SUBSYSTEM_ID, 0, severity::MEDIUM);
static constexpr dur_millis_t DEFAULT_SD_CARD_CHECK_TIMEOUT = 60000; //! [EXPORT] : [COMMENT] Software reboot occurred. 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, bool enableHkSet); 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, MessageQueueId_t commandedBy, ReturnValue_t executeAction(Action* action) override;
const uint8_t* data, size_t size) override;
ReturnValue_t handleAction(core::ListDirectoryIntoFileAction* action);
ReturnValue_t handleAction(core::SwitchRebootFileHandlingAction* action);
ReturnValue_t handleAction(core::ResetRebootCountersAction* action);
ReturnValue_t handleAction(core::SwitchImageLockAction* action);
ReturnValue_t handleAction(core::SetMaxRebootCntAction* action);
ReturnValue_t handleAction(core::XscRebootObcAction* action);
ReturnValue_t handleAction(core::RebootObcAction* action);
ModeDefinitionHelper getModeDefinitionHelper() override;
ReturnValue_t handleCommandMessage(CommandMessage* message) override; ReturnValue_t handleCommandMessage(CommandMessage* message) override;
void performControlOperation() override; void performControlOperation() override;
@ -186,7 +105,6 @@ class CoreController : public ExtendedControllerBase, public ReceivesParameterMe
static ReturnValue_t generateChipStateFile(); static ReturnValue_t generateChipStateFile();
static ReturnValue_t incrementAllocationFailureCount(); static ReturnValue_t incrementAllocationFailureCount();
static void getCurrentBootCopy(xsc::Chip& chip, xsc::Copy& copy); static void getCurrentBootCopy(xsc::Chip& chip, xsc::Copy& copy);
static const char* getXscMountDir(xsc::Chip chip, xsc::Copy copy);
ReturnValue_t updateProtInfo(bool regenerateChipStateFile = true); ReturnValue_t updateProtInfo(bool regenerateChipStateFile = true);
@ -201,24 +119,25 @@ class CoreController : public ExtendedControllerBase, public ReceivesParameterMe
* @param updateProtFile Specify whether the protection info file is updated * @param updateProtFile Specify whether the protection info file is updated
* @return * @return
*/ */
ReturnValue_t setBootCopyProtectionAndUpdateFile(xsc::Chip targetChip, xsc::Copy targetCopy, ReturnValue_t setBootCopyProtection(xsc::Chip targetChip, xsc::Copy targetCopy, bool protect,
bool protect); bool& protOperationPerformed, bool updateProtFile = true);
bool sdInitFinished() const; bool sdInitFinished() const;
private: private:
static constexpr uint32_t BOOT_OFFSET_SECONDS = 15;
static constexpr MutexIF::TimeoutType TIMEOUT_TYPE = MutexIF::TimeoutType::WAITING; static constexpr MutexIF::TimeoutType TIMEOUT_TYPE = MutexIF::TimeoutType::WAITING;
static constexpr uint32_t MUTEX_TIMEOUT = 20; static constexpr uint32_t MUTEX_TIMEOUT = 20;
bool enableHkSet = false; // Designated value for rechecking FIFO open
GpsHyperion::FixMode gpsFix = GpsHyperion::FixMode::NOT_SEEN; static constexpr int RETRY_FIFO_OPEN = -2;
int watchdogFifoFd = 0;
GpsHyperion::FixMode gpsFix = GpsHyperion::FixMode::UNKNOWN;
// States for SD state machine, which is used in non-blocking mode // States for SD state machine, which is used in non-blocking mode
enum class SdStates { enum class SdStates {
NONE, NONE,
START, START,
UPDATE_SD_INFO_START, GET_INFO,
SKIP_TWO_CYCLES_IF_SD_LOCKED, SET_STATE_SELF,
MOUNT_SELF, MOUNT_SELF,
// Determine operations for other SD card, depending on redundancy configuration // Determine operations for other SD card, depending on redundancy configuration
DETERMINE_OTHER, DETERMINE_OTHER,
@ -228,173 +147,109 @@ class CoreController : public ExtendedControllerBase, public ReceivesParameterMe
// Skip period because the shell command used to generate the info file sometimes is // Skip period because the shell command used to generate the info file sometimes is
// missing the last performed operation if executed too early // missing the last performed operation if executed too early
SKIP_CYCLE_BEFORE_INFO_UPDATE, SKIP_CYCLE_BEFORE_INFO_UPDATE,
UPDATE_SD_INFO_END, UPDATE_INFO,
// SD initialization done // SD initialization done
IDLE IDLE,
// Used if SD switches or mount commands are issued via telecommand
SET_STATE_FROM_COMMAND,
}; };
enum class SwUpdateSources { SD_0, SD_1, TMP_DIR };
static constexpr bool BLOCKING_SD_INIT = false; static constexpr bool BLOCKING_SD_INIT = false;
uint32_t* mappedSysRomAddr = nullptr;
SdCardManager* sdcMan = nullptr; SdCardManager* sdcMan = nullptr;
MessageQueueIF* eventQueue = nullptr; MessageQueueIF* eventQueue = nullptr;
uint8_t prefSdRaw = sd::SdCard::SLOT_0; struct SdInfo {
SdStates sdFsmState = SdStates::START; sd::SdCard pref = sd::SdCard::NONE;
SdStates fsmStateAfterDelay = SdStates::IDLE;
enum SdCfgMode { PASSIVE, COLD_REDUNDANT, HOT_REDUNDANT };
struct SdFsmParams {
SdCfgMode cfgMode = SdCfgMode::COLD_REDUNDANT;
sd::SdCard active = sd::SdCard::NONE;
sd::SdCard other = sd::SdCard::NONE; sd::SdCard other = sd::SdCard::NONE;
std::string activeChar = "0"; sd::SdState prefState = sd::SdState::OFF;
std::string otherChar = "1";
sd::SdState activeState = sd::SdState::OFF;
sd::SdState otherState = sd::SdState::OFF; sd::SdState otherState = sd::SdState::OFF;
std::string prefChar = "0";
std::string otherChar = "1";
std::pair<bool, bool> mountSwitch = {true, true}; std::pair<bool, bool> mountSwitch = {true, true};
// This flag denotes that the SD card usage is locked. This is relevant if SD cards go off SdStates state = SdStates::START;
// to leave appliation using the SD cards some time to detect the SD card is not usable anymore. // Used to track whether a command was executed
// This is relevant if the active SD card is being switched. The SD card will also be locked bool commandExecuted = true;
// when going from hot-redundant mode to cold-redundant mode.
bool lockSdCardUsage = false;
bool commandPending = true;
bool initFinished = false; bool initFinished = false;
SdCardManager::SdStatePair currentState; SdCardManager::SdStatePair currentState;
uint16_t cycleCount = 0; uint16_t cycleCount = 0;
uint16_t skippedCyclesCount = 0; // These two flags are related to external commanding
bool commandIssued = false;
bool commandFinished = false;
sd::SdState currentlyCommandedState = sd::SdState::OFF;
sd::SdCard commandedCard = sd::SdCard::NONE;
sd::SdState commandedState = sd::SdState::OFF;
} sdInfo; } sdInfo;
RebootFile rebootFile = {};
struct SdCommanding {
bool cmdPending = false;
MessageQueueId_t commander = MessageQueueIF::NO_QUEUE;
DeviceCommandId_t actionId;
} sdCommandingInfo;
struct DirListingDumpContext {
bool active;
bool firstDump;
size_t dumpedBytes;
size_t totalFileSize;
size_t listingDataOffset;
size_t maxDumpLen;
uint32_t segmentIdx;
MessageQueueId_t commander = MessageQueueIF::NO_QUEUE;
DeviceCommandId_t actionId;
};
std::array<uint8_t, 1024> dirListingBuf{};
DirListingDumpContext dumpContext{};
RebootWatchdogFile rebootWatchdogFile = {};
RebootCountersFile rebootCountersFile = {};
CommandExecutor cmdExecutor;
SimpleRingBuffer cmdReplyBuf;
DynamicFIFO<uint16_t> cmdRepliesSizes;
bool shellCmdIsExecuting = false;
MessageQueueId_t successRecipient = MessageQueueIF::NO_QUEUE;
std::string currMntPrefix; std::string currMntPrefix;
bool timeFileInitDone = false; bool performOneShotSdCardOpsSwitch = true;
bool leapSecondsInitDone = false;
bool performOneShotSdCardOpsSwitch = false;
uint8_t shortSdCardCdCounter = 0;
#if OBSW_THREAD_TRACING == 1
uint32_t opCounter;
#endif
Countdown sdCardCheckCd = Countdown(INIT_SD_CARD_CHECK_TIMEOUT);
/** /**
* First index: Chip. * Index 0: Chip 0 Copy 0
* Second index: Copy. * Index 1: Chip 0 Copy 1
* Index 2: Chip 1 Copy 0
* Index 3: Chip 1 Copy 1
*/ */
bool protArray[2][2]{}; std::array<bool, 4> protArray;
PeriodicOperationDivider opDivider5; PeriodicOperationDivider opDivider5;
PeriodicOperationDivider opDivider10; PeriodicOperationDivider opDivider10;
PoolEntry<float> tempPoolEntry = PoolEntry<float>(0.0);
PoolEntry<float> psVoltageEntry = PoolEntry<float>(0.0);
PoolEntry<float> plVoltageEntry = PoolEntry<float>(0.0);
core::HkSet hkSet; core::HkSet hkSet;
ParameterHelper paramHelper; core::ListDirectoryIntoFileAction listDirectoryIntoFileAction =
core::ListDirectoryIntoFileAction(this);
core::SwitchRebootFileHandlingAction switchRebootFileHandlingAction =
core::SwitchRebootFileHandlingAction(this);
core::ResetRebootCountersAction resetRebootCountersAction = core::ResetRebootCountersAction(this);
core::SwitchImageLockAction switchImageLockAction = core::SwitchImageLockAction(this);
core::SetMaxRebootCntAction setMaxRebootCntAction = core::SetMaxRebootCntAction(this);
core::XscRebootObcAction xscRebootObcAction = core::XscRebootObcAction(this);
core::RebootObcAction rebootObcAction = core::RebootObcAction(this);
#if OBSW_SD_CARD_MUST_BE_ON == 1
bool remountAttemptFlag = true;
#endif
MessageQueueId_t getCommandQueue() const override;
ReturnValue_t getParameter(uint8_t domainId, uint8_t uniqueIdentifier,
ParameterWrapper* parameterWrapper, const ParameterWrapper* newValues,
uint16_t startAtIndex) override;
ReturnValue_t initializeLocalDataPool(localpool::DataPool& localDataPoolMap, ReturnValue_t initializeLocalDataPool(localpool::DataPool& localDataPoolMap,
LocalDataPoolManager& poolManager) override; LocalDataPoolManager& poolManager) override;
Countdown sdCardCheckCd = Countdown(120000);
LocalPoolDataSetBase* getDataSetHandle(sid_t sid) override; LocalPoolDataSetBase* getDataSetHandle(sid_t sid) override;
ReturnValue_t checkModeCommand(Mode_t mode, Submode_t submode, uint32_t* msToReachTheMode); ReturnValue_t checkModeCommand(Mode_t mode, Submode_t submode, uint32_t* msToReachTheMode);
void performMountedSdCardOperations(); void performMountedSdCardOperations();
ReturnValue_t initVersionFile(); ReturnValue_t initVersionFile();
void initLeapSeconds();
ReturnValue_t initLeapSecondsFromFile();
ReturnValue_t initClockFromTimeFile(); ReturnValue_t initClockFromTimeFile();
ReturnValue_t actionUpdateLeapSeconds(const uint8_t* data);
ReturnValue_t writeLeapSecondsToFile(const uint16_t leapSeconds);
ReturnValue_t performSdCardCheck(); ReturnValue_t performSdCardCheck();
ReturnValue_t backupTimeFileHandler(); ReturnValue_t timeFileHandler();
ReturnValue_t initBootCopyFile(); ReturnValue_t initBootCopy();
ReturnValue_t initWatchdogFifo();
ReturnValue_t initSdCardBlocking(); ReturnValue_t initSdCardBlocking();
bool startSdStateMachine(sd::SdCard targetActiveSd, SdCfgMode mode, MessageQueueId_t commander,
DeviceCommandId_t actionId);
void initPrint(); void initPrint();
ReturnValue_t sdStateMachine(); ReturnValue_t sdStateMachine();
void updateInternalSdInfo(); void updateSdInfoOther();
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 executeSwUpdate(SwUpdateSources sourceDir, const uint8_t* data, size_t size);
ReturnValue_t sdColdRedundantBlockingInit(); ReturnValue_t sdColdRedundantBlockingInit();
void currentStateSetter(sd::SdCard sdCard, sd::SdState newState); void currentStateSetter(sd::SdCard sdCard, sd::SdState newState);
void executeNextExternalSdCommand(); void executeNextExternalSdCommand();
void checkExternalSdCommandStatus(); void checkExternalSdCommandStatus();
void performRebootWatchdogHandling(bool recreateFile); void performRebootFileHandling(bool recreateFile);
void performRebootCountersHandling(bool recreateFile);
ReturnValue_t actionListDirectoryIntoFile(ActionId_t actionId, MessageQueueId_t commandedBy,
const uint8_t* data, size_t size);
ReturnValue_t actionListDirectoryDumpDirectly(ActionId_t actionId, MessageQueueId_t commandedBy,
const uint8_t* data, size_t size);
ReturnValue_t performGracefulShutdown(xsc::Chip targetChip, xsc::Copy targetCopy);
ReturnValue_t actionListDirectoryCommonCommandCreator(const uint8_t* data, size_t size,
std::ostringstream& oss);
ReturnValue_t actionXscReboot(const uint8_t* data, size_t size); ReturnValue_t actionXscReboot(const uint8_t* data, size_t size);
ReturnValue_t actionReboot(const uint8_t* data, size_t size); ReturnValue_t actionReboot(const uint8_t* data, size_t size);
ReturnValue_t gracefulShutdownTasks(xsc::Chip chip, xsc::Copy copy, bool& protOpPerformed); ReturnValue_t gracefulShutdownTasks(xsc::Chip chip, xsc::Copy copy, bool& protOpPerformed);
void performWatchdogControlOperation();
ReturnValue_t handleProtInfoUpdateLine(std::string nextLine); ReturnValue_t handleProtInfoUpdateLine(std::string nextLine);
ReturnValue_t handleSwitchingSdCardsOffNonBlocking(); int handleBootCopyProtAtIndex(xsc::Chip targetChip, xsc::Copy targetCopy, bool protect,
bool handleBootCopyProt(xsc::Chip targetChip, xsc::Copy targetCopy, bool protect); bool& protOperationPerformed, bool selfChip, bool selfCopy,
void rebootWatchdogAlgorithm(RebootWatchdogFile& rf, bool& needsReboot, xsc::Chip& tgtChip, bool allChips, bool allCopies, uint8_t arrIdx);
void determineAndExecuteReboot(RebootFile& rf, bool& needsReboot, xsc::Chip& tgtChip,
xsc::Copy& tgtCopy); xsc::Copy& tgtCopy);
void resetRebootWatchdogCounters(xsc::Chip tgtChip, xsc::Copy tgtCopy); void resetRebootCount(xsc::Chip tgtChip, xsc::Copy tgtCopy);
void setRebootMechanismLock(bool lock, xsc::Chip tgtChip, xsc::Copy tgtCopy); void setRebootMechanismLock(bool lock, xsc::Chip tgtChip, xsc::Copy tgtCopy);
bool parseRebootWatchdogFile(std::string path, RebootWatchdogFile& file); bool parseRebootFile(std::string path, RebootFile& file);
bool parseRebootCountersFile(std::string path, RebootCountersFile& file); void rewriteRebootFile(RebootFile file);
void rewriteRebootWatchdogFile(RebootWatchdogFile file);
void rewriteRebootCountersFile(RebootCountersFile file);
void announceBootCounts();
void announceVersionInfo();
void announceCurrentImageInfo();
void announceSdInfo(SdCardManager::SdStatePair sdStates);
void readHkData(); void readHkData();
void dirListingDumpHandler();
bool isNumber(const std::string& s); bool isNumber(const std::string& s);
}; };

View File

@ -1,16 +1,10 @@
#ifndef BSP_Q7S_CORE_DEFS_H_ #ifndef BSP_Q7S_CORE_COREDEFINITIONS_H_
#define BSP_Q7S_CORE_DEFS_H_ #define BSP_Q7S_CORE_COREDEFINITIONS_H_
#include <fsfw/datapoollocal/StaticLocalDataSet.h> #include <fsfw/datapoollocal/StaticLocalDataSet.h>
namespace core { namespace core {
extern uint8_t FW_VERSION_MAJOR;
extern uint8_t FW_VERSION_MINOR;
extern uint8_t FW_VERSION_REVISION;
extern bool FW_VERSION_HAS_SHA;
extern char FW_VERSION_GIT_SHA[4];
static const uint8_t HK_SET_ENTRIES = 3; static const uint8_t HK_SET_ENTRIES = 3;
static const uint32_t HK_SET_ID = 5; static const uint32_t HK_SET_ID = 5;
@ -42,4 +36,4 @@ class HkSet : public StaticLocalDataSet<HK_SET_ENTRIES> {
} // namespace core } // namespace core
#endif /* BSP_Q7S_CORE_DEFS_H_ */ #endif /* BSP_Q7S_CORE_COREDEFINITIONS_H_ */

View File

@ -0,0 +1,536 @@
#include "bsp_q7s/core/InitMission.h"
#include <fsfw/devicehandlers/DeviceCommunicationIF.h>
#include <iostream>
#include <vector>
#include "OBSWConfig.h"
#include "bsp_q7s/core/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/devices/devicedefinitions/Max31865Definitions.h"
#include "mission/utility/InitMission.h"
#include "pollingsequence/pollingSequenceFactory.h"
/* This is configured for linux without CR */
#ifdef PLATFORM_UNIX
ServiceInterfaceStream sif::debug("DEBUG");
ServiceInterfaceStream sif::info("INFO");
ServiceInterfaceStream sif::warning("WARNING");
ServiceInterfaceStream sif::error("ERROR");
#else
ServiceInterfaceStream sif::debug("DEBUG", true);
ServiceInterfaceStream sif::info("INFO", true);
ServiceInterfaceStream sif::warning("WARNING", true);
ServiceInterfaceStream sif::error("ERROR", true, false, true);
#endif
ObjectManagerIF* objectManager = nullptr;
void initmission::initMission() {
sif::info << "Building global objects.." << std::endl;
try {
/* Instantiate global object manager and also create all objects */
ObjectManager::instance()->setObjectFactoryFunction(ObjectFactory::produce, nullptr);
} catch (const std::invalid_argument& e) {
sif::error << "initmission::initMission: Object Construction failed with an "
"invalid argument: "
<< e.what();
std::exit(1);
}
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
PeriodicTaskIF* coreController = factory->createPeriodicTask(
"CORE_CTRL", 60, PeriodicTaskIF::MINIMUM_STACK_SIZE, 0.4, missedDeadlineFunc);
result = coreController->addComponent(objects::CORE_CONTROLLER);
if (result != HasReturnvaluesIF::RETURN_OK) {
initmission::printAddObjectError("CORE_CTRL", objects::CORE_CONTROLLER);
}
/* 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) {
initmission::printAddObjectError("CCSDS_DISTRIB", objects::CCSDS_PACKET_DISTRIBUTOR);
}
result = tmTcDistributor->addComponent(objects::PUS_PACKET_DISTRIBUTOR);
if (result != HasReturnvaluesIF::RETURN_OK) {
initmission::printAddObjectError("PUS_PACKET_DISTRIB", objects::PUS_PACKET_DISTRIBUTOR);
}
result = tmTcDistributor->addComponent(objects::TM_FUNNEL);
if (result != HasReturnvaluesIF::RETURN_OK) {
initmission::printAddObjectError("TM_FUNNEL", objects::TM_FUNNEL);
}
#if OBSW_ADD_TCPIP_BRIDGE == 1
// TMTC bridge
PeriodicTaskIF* tmtcBridgeTask = factory->createPeriodicTask(
"TCPIP_TMTC_BRIDGE", 50, PeriodicTaskIF::MINIMUM_STACK_SIZE, 0.2, missedDeadlineFunc);
result = tmtcBridgeTask->addComponent(objects::TMTC_BRIDGE);
if (result != HasReturnvaluesIF::RETURN_OK) {
initmission::printAddObjectError("TMTC_BRIDGE", objects::TMTC_BRIDGE);
}
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) {
initmission::printAddObjectError("UDP_POLLING", objects::TMTC_POLLING_TASK);
}
#endif
#if OBSW_USE_CCSDS_IP_CORE == 1
PeriodicTaskIF* ccsdsHandlerTask = factory->createPeriodicTask(
"CCSDS_HANDLER", 50, PeriodicTaskIF::MINIMUM_STACK_SIZE, 2.0, missedDeadlineFunc);
result = ccsdsHandlerTask->addComponent(objects::CCSDS_HANDLER);
if (result != HasReturnvaluesIF::RETURN_OK) {
initmission::printAddObjectError("CCSDS Handler", objects::CCSDS_HANDLER);
}
// Minimal distance between two received TCs amounts to 0.6 seconds
// If a command has not been read before the next one arrives, the old command will be
// overwritten by the PDEC.
PeriodicTaskIF* pdecHandlerTask = factory->createPeriodicTask(
"PDEC_HANDLER", 50, PeriodicTaskIF::MINIMUM_STACK_SIZE, 1.0, missedDeadlineFunc);
result = pdecHandlerTask->addComponent(objects::PDEC_HANDLER);
if (result != HasReturnvaluesIF::RETURN_OK) {
initmission::printAddObjectError("PDEC Handler", objects::PDEC_HANDLER);
}
#endif /* OBSW_USE_CCSDS_IP_CORE == 1 */
#if OBSW_ADD_ACS_HANDLERS == 1
PeriodicTaskIF* acsTask = factory->createPeriodicTask(
"ACS_TASK", 50, 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 */
acsTask->addComponent(objects::ACS_CONTROLLER);
if (result != HasReturnvaluesIF::RETURN_OK) {
initmission::printAddObjectError("ACS_CTRL", objects::ACS_CONTROLLER);
}
PeriodicTaskIF* sysTask = factory->createPeriodicTask(
"SYS_TASK", 40, PeriodicTaskIF::MINIMUM_STACK_SIZE * 2, 0.4, missedDeadlineFunc);
static_cast<void>(sysTask);
#if OBSW_ADD_ACS_HANDLERS == 1
result = sysTask->addComponent(objects::ACS_BOARD_ASS);
if (result != HasReturnvaluesIF::RETURN_OK) {
initmission::printAddObjectError("ACS_BOARD_ASS", objects::ACS_BOARD_ASS);
}
#endif /* OBSW_ADD_ACS_HANDLERS */
#if OBSW_ADD_RW == 1
result = sysTask->addComponent(objects::RW_ASS);
if (result != HasReturnvaluesIF::RETURN_OK) {
initmission::printAddObjectError("RW_ASS", objects::RW_ASS);
}
#endif
#if OBSW_ADD_SUS_BOARD_ASS == 1
result = sysTask->addComponent(objects::SUS_BOARD_ASS);
if (result != HasReturnvaluesIF::RETURN_OK) {
initmission::printAddObjectError("SUS_BOARD_ASS", objects::SUS_BOARD_ASS);
}
#endif
#if OBSW_ADD_RTD_DEVICES == 1
PeriodicTaskIF* tcsPollingTask = factory->createPeriodicTask(
"TCS_POLLING_TASK", 70, PeriodicTaskIF::MINIMUM_STACK_SIZE * 2, 0.5, missedDeadlineFunc);
result = tcsPollingTask->addComponent(objects::SPI_RTD_COM_IF);
if (result != HasReturnvaluesIF::RETURN_OK) {
initmission::printAddObjectError("SPI_RTD_POLLING", objects::SPI_RTD_COM_IF);
}
PeriodicTaskIF* tcsTask = factory->createPeriodicTask(
"TCS_TASK", 45, PeriodicTaskIF::MINIMUM_STACK_SIZE, 0.8, missedDeadlineFunc);
std::array<object_id_t, EiveMax31855::NUM_RTDS> rtdIds = {
objects::RTD_0_IC3_PLOC_HEATSPREADER,
objects::RTD_1_IC4_PLOC_MISSIONBOARD,
objects::RTD_2_IC5_4K_CAMERA,
objects::RTD_3_IC6_DAC_HEATSPREADER,
objects::RTD_4_IC7_STARTRACKER,
objects::RTD_5_IC8_RW1_MX_MY,
objects::RTD_6_IC9_DRO,
objects::RTD_7_IC10_SCEX,
objects::RTD_8_IC11_X8,
objects::RTD_9_IC12_HPA,
objects::RTD_10_IC13_PL_TX,
objects::RTD_11_IC14_MPA,
objects::RTD_12_IC15_ACU,
objects::RTD_13_IC16_PLPCDU_HEATSPREADER,
objects::RTD_14_IC17_TCS_BOARD,
objects::RTD_15_IC18_IMTQ,
};
tcsTask->addComponent(objects::TCS_BOARD_ASS);
tcsTask->addComponent(objects::THERMAL_CONTROLLER);
for (const auto& rtd : rtdIds) {
tcsTask->addComponent(rtd, DeviceHandlerIF::PERFORM_OPERATION);
tcsTask->addComponent(rtd, DeviceHandlerIF::SEND_WRITE);
tcsTask->addComponent(rtd, DeviceHandlerIF::GET_WRITE);
tcsTask->addComponent(rtd, DeviceHandlerIF::SEND_READ);
tcsTask->addComponent(rtd, DeviceHandlerIF::GET_READ);
}
#endif /* OBSW_ADD_RTD_DEVICES */
// FS task, task interval does not matter because it runs in permanent loop, priority low
// because it is a non-essential background task
PeriodicTaskIF* fsTask = factory->createPeriodicTask(
"FILE_SYSTEM_TASK", 25, PeriodicTaskIF::MINIMUM_STACK_SIZE, 0.4, missedDeadlineFunc);
result = fsTask->addComponent(objects::FILE_SYSTEM_HANDLER);
if (result != HasReturnvaluesIF::RETURN_OK) {
initmission::printAddObjectError("FILE_SYSTEM_TASK", objects::FILE_SYSTEM_HANDLER);
}
#if OBSW_ADD_STAR_TRACKER == 1
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);
}
#endif /* OBSW_ADD_STAR_TRACKER == 1 */
#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_ADD_PLOC_SUPERVISOR == 1
PeriodicTaskIF* supvHelperTask = factory->createPeriodicTask(
"PLOC_SUPV_HELPER", 10, PeriodicTaskIF::MINIMUM_STACK_SIZE, 1.0, missedDeadlineFunc);
result = supvHelperTask->addComponent(objects::PLOC_SUPERVISOR_HELPER);
if (result != HasReturnvaluesIF::RETURN_OK) {
initmission::printAddObjectError("PLOC_SUPV_HELPER", objects::PLOC_SUPERVISOR_HELPER);
}
#endif /* OBSW_ADD_PLOC_SUPERVISOR */
#if OBSW_TEST_CCSDS_BRIDGE == 1
PeriodicTaskIF* ptmeTestTask = factory->createPeriodicTask(
"PTME_TEST", 80, PeriodicTaskIF::MINIMUM_STACK_SIZE, 2.0, missedDeadlineFunc);
result = ptmeTestTask->addComponent(objects::CCSDS_IP_CORE_BRIDGE);
if (result != HasReturnvaluesIF::RETURN_OK) {
initmission::printAddObjectError("PTME_TEST", objects::CCSDS_IP_CORE_BRIDGE);
}
#endif
std::vector<PeriodicTaskIF*> pusTasks;
createPusTasks(*factory, missedDeadlineFunc, pusTasks);
std::vector<PeriodicTaskIF*> pstTasks;
createPstTasks(*factory, missedDeadlineFunc, pstTasks);
#if OBSW_ADD_TEST_CODE == 1
std::vector<PeriodicTaskIF*> testTasks;
createTestTasks(*factory, missedDeadlineFunc, testTasks);
#endif
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();
#if OBSW_ADD_TCPIP_BRIDGE == 1
tmtcBridgeTask->startTask();
tmtcPollingTask->startTask();
#endif
#if OBSW_USE_CCSDS_IP_CORE == 1
ccsdsHandlerTask->startTask();
pdecHandlerTask->startTask();
#endif /* OBSW_USE_CCSDS_IP_CORE == 1 */
coreController->startTask();
taskStarter(pstTasks, "PST task vector");
taskStarter(pusTasks, "PUS task vector");
#if OBSW_ADD_TEST_CODE == 1
taskStarter(testTasks, "Test task vector");
#endif
#if OBSW_TEST_CCSDS_BRIDGE == 1
ptmeTestTask->startTask();
#endif
fsTask->startTask();
#if OBSW_ADD_STAR_TRACKER == 1
strHelperTask->startTask();
#endif /* OBSW_ADD_STAR_TRACKER == 1 */
#if OBSW_ADD_ACS_HANDLERS == 1
acsTask->startTask();
#endif /* OBSW_ADD_ACS_HANDLERS == 1 */
sysTask->startTask();
#if OBSW_ADD_RTD_DEVICES == 1
tcsPollingTask->startTask();
tcsTask->startTask();
#endif /* OBSW_ADD_RTD_DEVICES == 1 */
#if OBSW_ADD_PLOC_SUPERVISOR == 1
supvHelperTask->startTask();
#endif /* OBSW_ADD_PLOC_SUPERVISOR == 1 */
sif::info << "Tasks started.." << std::endl;
}
void initmission::createPstTasks(TaskFactory& factory,
TaskDeadlineMissedFunction missedDeadlineFunc,
std::vector<PeriodicTaskIF*>& taskVec) {
ReturnValue_t result = HasReturnvaluesIF::RETURN_OK;
/* Polling Sequence Table Default */
#if OBSW_ADD_SPI_TEST_CODE == 0
FixedTimeslotTaskIF* spiPst = factory.createFixedTimeslotTask(
"MAIN_SPI", 75, PeriodicTaskIF::MINIMUM_STACK_SIZE * 4, 0.5, missedDeadlineFunc);
result = pst::pstSpi(spiPst);
if (result != HasReturnvaluesIF::RETURN_OK) {
if (result == FixedTimeslotTaskIF::SLOT_LIST_EMPTY) {
sif::warning << "InitMission::initTasks: SPI PST is empty" << std::endl;
} else {
sif::error << "InitMission::initTasks: Creating SPI PST failed!" << std::endl;
}
} else {
taskVec.push_back(spiPst);
}
#endif
#if OBSW_ADD_RW == 1
FixedTimeslotTaskIF* rwPstTask = factory.createFixedTimeslotTask(
"RW_SPI", 65, PeriodicTaskIF::MINIMUM_STACK_SIZE * 2, 1.0, missedDeadlineFunc);
result = pst::pstSpiRw(rwPstTask);
if (result != HasReturnvaluesIF::RETURN_OK) {
if (result == FixedTimeslotTaskIF::SLOT_LIST_EMPTY) {
sif::warning << "InitMission::initTasks: SPI PST is empty" << std::endl;
} else {
sif::error << "InitMission::initTasks: Creating SPI PST failed!" << std::endl;
}
} else {
taskVec.push_back(rwPstTask);
}
#endif
FixedTimeslotTaskIF* uartPst = factory.createFixedTimeslotTask(
"UART_PST", 65, PeriodicTaskIF::MINIMUM_STACK_SIZE * 4, 0.2, missedDeadlineFunc);
result = pst::pstUart(uartPst);
if (result != HasReturnvaluesIF::RETURN_OK) {
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);
}
FixedTimeslotTaskIF* gpioPst = factory.createFixedTimeslotTask(
"GPIO_PST", 70, PeriodicTaskIF::MINIMUM_STACK_SIZE * 2, 0.2, missedDeadlineFunc);
result = pst::pstGpio(gpioPst);
if (result != HasReturnvaluesIF::RETURN_OK) {
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);
}
#if OBSW_ADD_I2C_TEST_CODE == 0
FixedTimeslotTaskIF* i2cPst = factory.createFixedTimeslotTask(
"I2C_PST", 65, PeriodicTaskIF::MINIMUM_STACK_SIZE * 4, 0.2, missedDeadlineFunc);
result = pst::pstI2c(i2cPst);
if (result != HasReturnvaluesIF::RETURN_OK) {
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
#if OBSW_ADD_GOMSPACE_PCDU == 1
FixedTimeslotTaskIF* gomSpacePstTask = factory.createFixedTimeslotTask(
"GS_PST_TASK", 70, PeriodicTaskIF::MINIMUM_STACK_SIZE * 4, 1.0, missedDeadlineFunc);
result = pst::pstGompaceCan(gomSpacePstTask);
if (result != HasReturnvaluesIF::RETURN_OK) {
if (result != FixedTimeslotTaskIF::SLOT_LIST_EMPTY) {
sif::error << "InitMission::initTasks: GomSpace PST initialization failed!" << std::endl;
}
}
taskVec.push_back(gomSpacePstTask);
#endif
}
void initmission::createPusTasks(TaskFactory& factory,
TaskDeadlineMissedFunction missedDeadlineFunc,
std::vector<PeriodicTaskIF*>& taskVec) {
ReturnValue_t result = HasReturnvaluesIF::RETURN_OK;
/* PUS Services */
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) {
initmission::printAddObjectError("PUS_VERIF", objects::PUS_SERVICE_1_VERIFICATION);
}
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("PUS_2", objects::PUS_SERVICE_2_DEVICE_ACCESS);
}
result = pusHighPrio->addComponent(objects::PUS_SERVICE_9_TIME_MGMT);
if (result != HasReturnvaluesIF::RETURN_OK) {
initmission::printAddObjectError("PUS_9", 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_3_HOUSEKEEPING);
if (result != HasReturnvaluesIF::RETURN_OK) {
initmission::printAddObjectError("PUS_3", objects::PUS_SERVICE_3_HOUSEKEEPING);
}
result = pusMedPrio->addComponent(objects::PUS_SERVICE_8_FUNCTION_MGMT);
if (result != HasReturnvaluesIF::RETURN_OK) {
initmission::printAddObjectError("PUS_8", objects::PUS_SERVICE_8_FUNCTION_MGMT);
}
result = pusMedPrio->addComponent(objects::PUS_SERVICE_11_TC_SCHEDULER);
if (result != HasReturnvaluesIF::RETURN_OK) {
initmission::printAddObjectError("PUS_11", objects::PUS_SERVICE_11_TC_SCHEDULER);
}
result = pusMedPrio->addComponent(objects::PUS_SERVICE_20_PARAMETERS);
if (result != HasReturnvaluesIF::RETURN_OK) {
initmission::printAddObjectError("PUS_20", objects::PUS_SERVICE_20_PARAMETERS);
}
result = pusMedPrio->addComponent(objects::PUS_SERVICE_200_MODE_MGMT);
if (result != HasReturnvaluesIF::RETURN_OK) {
initmission::printAddObjectError("PUS_200", objects::PUS_SERVICE_200_MODE_MGMT);
}
result = pusMedPrio->addComponent(objects::PUS_SERVICE_201_HEALTH);
if (result != HasReturnvaluesIF::RETURN_OK) {
initmission::printAddObjectError("PUS_201", objects::PUS_SERVICE_201_HEALTH);
}
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("PUS_17", objects::PUS_SERVICE_17_TEST);
}
result = pusLowPrio->addComponent(objects::INTERNAL_ERROR_REPORTER);
if (result != HasReturnvaluesIF::RETURN_OK) {
initmission::printAddObjectError("ERROR_REPORTER", objects::INTERNAL_ERROR_REPORTER);
}
taskVec.push_back(pusLowPrio);
}
void initmission::createTestTasks(TaskFactory& factory,
TaskDeadlineMissedFunction missedDeadlineFunc,
std::vector<PeriodicTaskIF*>& taskVec) {
#if OBSW_ADD_TEST_TASK == 1 && OBSW_ADD_TEST_CODE == 1
ReturnValue_t result = HasReturnvaluesIF::RETURN_OK;
static_cast<void>(result); // supress warning in case it is not used
PeriodicTaskIF* testTask = factory.createPeriodicTask(
"TEST_TASK", 60, PeriodicTaskIF::MINIMUM_STACK_SIZE, 1, missedDeadlineFunc);
result = testTask->addComponent(objects::TEST_TASK);
if (result != HasReturnvaluesIF::RETURN_OK) {
initmission::printAddObjectError("TEST_TASK", objects::TEST_TASK);
}
#if OBSW_ADD_SPI_TEST_CODE == 1
result = testTask->addComponent(objects::SPI_TEST);
if (result != HasReturnvaluesIF::RETURN_OK) {
initmission::printAddObjectError("SPI_TEST", objects::SPI_TEST);
}
#endif
#if OBSW_ADD_I2C_TEST_CODE == 1
result = testTask->addComponent(objects::I2C_TEST);
if (result != HasReturnvaluesIF::RETURN_OK) {
initmission::printAddObjectError("I2C_TEST", objects::I2C_TEST);
}
#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);
#endif // OBSW_ADD_TEST_TASK == 1 && OBSW_ADD_TEST_CODE == 1
}
/**
**/

View File

@ -4,23 +4,20 @@
#include <vector> #include <vector>
#include "fsfw/tasks/definitions.h" #include "fsfw/tasks/definitions.h"
#include "mission/pollingSeqTables.h"
using pst::AcsPstCfg;
class PeriodicTaskIF; class PeriodicTaskIF;
class TaskFactory; class TaskFactory;
namespace scheduling { namespace initmission {
void initMission(); void initMission();
void initTasks(); void initTasks();
void createPstTasks(TaskFactory& factory, TaskDeadlineMissedFunction missedDeadlineFunc, void createPstTasks(TaskFactory& factory, TaskDeadlineMissedFunction missedDeadlineFunc,
std::vector<PeriodicTaskIF*>& taskVec, AcsPstCfg cfg); std::vector<PeriodicTaskIF*>& taskVec);
void createPusTasks(TaskFactory& factory, TaskDeadlineMissedFunction missedDeadlineFunc, void createPusTasks(TaskFactory& factory, TaskDeadlineMissedFunction missedDeadlineFunc,
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 scheduling }; // namespace initmission
#endif /* BSP_Q7S_INITMISSION_H_ */ #endif /* BSP_Q7S_INITMISSION_H_ */

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,49 @@
#ifndef BSP_Q7S_OBJECTFACTORY_H_
#define BSP_Q7S_OBJECTFACTORY_H_
#include <fsfw/returnvalues/HasReturnvaluesIF.h>
#include <string>
class LinuxLibgpioIF;
class UartComIF;
class SpiComIF;
class I2cComIF;
class PowerSwitchIF;
class HealthTableIF;
class AcsBoardAssembly;
class GpioIF;
namespace ObjectFactory {
void setStatics();
void produce(void* args);
void createCommunicationInterfaces(LinuxLibgpioIF** gpioComIF, UartComIF** uartComIF,
SpiComIF** spiMainComIF, I2cComIF** i2cComIF,
SpiComIF** spiRwComIF);
void createPcduComponents(LinuxLibgpioIF* gpioComIF, PowerSwitchIF** pwrSwitcher);
void createPlPcduComponents(LinuxLibgpioIF* gpioComIF, SpiComIF* spiComIF,
PowerSwitchIF* pwrSwitcher);
void createTmpComponents();
void createRadSensorComponent(LinuxLibgpioIF* gpioComIF);
void createAcsBoardComponents(LinuxLibgpioIF* gpioComIF, UartComIF* uartComIF,
PowerSwitchIF* pwrSwitcher);
void createHeaterComponents(GpioIF* gpioIF, PowerSwitchIF* pwrSwitcher, HealthTableIF* healthTable);
void createImtqComponents(PowerSwitchIF* pwrSwitcher);
void createBpxBatteryComponent();
void createStrComponents(PowerSwitchIF* pwrSwitcher);
void createSolarArrayDeploymentComponents();
void createSyrlinksComponents(PowerSwitchIF* pwrSwitcher);
void createPayloadComponents(LinuxLibgpioIF* gpioComIF);
void createReactionWheelComponents(LinuxLibgpioIF* gpioComIF, PowerSwitchIF* pwrSwitcher);
void createCcsdsComponents(LinuxLibgpioIF* gpioComIF);
void createMiscComponents();
void createTestComponents(LinuxLibgpioIF* gpioComIF);
void testAcsBrdAss(AcsBoardAssembly* assAss);
}; // namespace ObjectFactory
#endif /* BSP_Q7S_OBJECTFACTORY_H_ */

View File

@ -1,87 +0,0 @@
#include "WatchdogHandler.h"
#include <fcntl.h>
#include <unistd.h>
#include <cerrno>
#include <cstring>
#include <filesystem>
#include "fsfw/serviceinterface.h"
#include "watchdog/definitions.h"
WatchdogHandler::WatchdogHandler() {}
void WatchdogHandler::periodicOperation() {
if (watchdogFifoFd != 0) {
if (watchdogFifoFd == RETRY_FIFO_OPEN) {
// Open FIFO write only and non-blocking
watchdogFifoFd = open(watchdog::FIFO_NAME.c_str(), O_WRONLY | O_NONBLOCK);
if (watchdogFifoFd < 0) {
if (errno == ENXIO) {
watchdogFifoFd = RETRY_FIFO_OPEN;
// No printout for now, would be spam
return;
} else {
sif::error << "Opening pipe " << watchdog::FIFO_NAME << " write-only failed with "
<< errno << ": " << strerror(errno) << std::endl;
return;
}
}
sif::info << "Opened " << watchdog::FIFO_NAME << " successfully" << std::endl;
performStartHandling();
} else if (watchdogFifoFd > 0) {
// Write to OBSW watchdog FIFO here
const char writeChar = watchdog::first::IDLE_CHAR;
ssize_t writtenBytes = write(watchdogFifoFd, &writeChar, 1);
if (writtenBytes < 0) {
sif::error << "Errors writing to watchdog FIFO, code " << errno << ": " << strerror(errno)
<< std::endl;
}
}
}
}
ReturnValue_t WatchdogHandler::initialize(bool enableWatchdogFunction) {
using namespace std::filesystem;
this->enableWatchFunction = enableWatchdogFunction;
std::error_code e;
if (not std::filesystem::exists(watchdog::FIFO_NAME, e)) {
// Still return returnvalue::OK for now
sif::info << "Watchdog FIFO " << watchdog::FIFO_NAME << " does not exist, can't initiate"
<< " watchdog" << std::endl;
return returnvalue::OK;
}
// Open FIFO write only and non-blocking to prevent SW from killing itself.
watchdogFifoFd = open(watchdog::FIFO_NAME.c_str(), O_WRONLY | O_NONBLOCK);
if (watchdogFifoFd < 0) {
if (errno == ENXIO) {
watchdogFifoFd = RETRY_FIFO_OPEN;
sif::info << "eive-watchdog not running. FIFO can not be opened" << std::endl;
} else {
sif::error << "Opening pipe " << watchdog::FIFO_NAME << " write-only failed with " << errno
<< ": " << strerror(errno) << std::endl;
return returnvalue::FAILED;
}
}
return performStartHandling();
}
ReturnValue_t WatchdogHandler::performStartHandling() {
char startBuf[2];
ssize_t writeLen = 1;
startBuf[0] = watchdog::first::START_CHAR;
if (enableWatchFunction) {
writeLen += 1;
startBuf[1] = watchdog::second::WATCH_FLAG;
}
ssize_t writtenBytes = write(watchdogFifoFd, &startBuf, writeLen);
if (writtenBytes < 0) {
sif::error << "WatchdogHandler: Errors writing to watchdog FIFO, code " << errno << ": "
<< strerror(errno) << std::endl;
return returnvalue::FAILED;
} else if (writtenBytes != writeLen) {
sif::warning << "WatchdogHandler: Not all bytes were written, possible error" << std::endl;
}
return returnvalue::OK;
}

View File

@ -1,23 +0,0 @@
#ifndef BSP_Q7S_CORE_WATCHDOGHANDLER_H_
#define BSP_Q7S_CORE_WATCHDOGHANDLER_H_
#include "fsfw/returnvalues/returnvalue.h"
class WatchdogHandler {
public:
WatchdogHandler();
ReturnValue_t initialize(bool enableWatchFunction);
void periodicOperation();
private:
// Designated value for rechecking FIFO open
static constexpr int RETRY_FIFO_OPEN = -2;
int watchdogFifoFd = 0;
bool enableWatchFunction = false;
ReturnValue_t performStartHandling();
};
#endif /* BSP_Q7S_CORE_WATCHDOGHANDLER_H_ */

View File

@ -1,122 +0,0 @@
#include "XiphosWdtHandler.h"
#include "fsfw/ipc/QueueFactory.h"
XiphosWdtHandler::XiphosWdtHandler(object_id_t objectId)
: SystemObject(objectId),
requestQueue(QueueFactory::instance()->createMessageQueue()),
actionHelper(this, requestQueue) {}
ReturnValue_t XiphosWdtHandler::initialize() {
ReturnValue_t result = actionHelper.initialize();
if (result != returnvalue::OK) {
return result;
}
int retval = xsc_watchdog_init(&wdtHandle);
if (retval != 0) {
sif::error << "XiphosWdtHandler: Initiating watchdog failed with code " << retval << ": "
<< strerror(retval) << std::endl;
return ObjectManagerIF::CHILD_INIT_FAILED;
}
if (wdtHandle == nullptr) {
sif::error << "XiphosWdtHandler: WDT handle is nullptr!" << std::endl;
return ObjectManagerIF::CHILD_INIT_FAILED;
}
retval = xsc_watchdog_set_timeout(wdtHandle, timeoutSeconds);
if (retval != 0) {
// This propably means that the default timeout is used. Still continue with task init.
sif::warning << "XiphosWdtHandler: Setting WDT timeout of " << timeoutSeconds
<< " seconds failed with code " << result << ": " << strerror(retval) << std::endl;
}
return enableWdt();
}
ReturnValue_t XiphosWdtHandler::performOperation(uint8_t opCode) {
CommandMessage command;
ReturnValue_t result;
for (result = requestQueue->receiveMessage(&command); result == returnvalue::OK;
result = requestQueue->receiveMessage(&command)) {
result = actionHelper.handleActionMessage(&command);
if (result == returnvalue::OK) {
continue;
}
sif::warning << "Can not handle message with message type " << command.getMessageType()
<< std::endl;
}
if (enabled) {
int retval = xsc_watchdog_keepalive(wdtHandle);
if (retval != 0) {
sif::warning << "XiphosWdtHandler: Feeding WDT failed with code " << retval << ": "
<< strerror(retval) << std::endl;
return returnvalue::FAILED;
}
}
return returnvalue::OK;
}
ReturnValue_t XiphosWdtHandler::executeAction(ActionId_t actionId, MessageQueueId_t commandedBy,
const uint8_t *data, size_t size) {
switch (actionId) {
case (ActionId::ENABLE): {
ReturnValue_t result = enableWdt();
if (result != returnvalue::OK) {
return result;
}
return EXECUTION_FINISHED;
}
case (ActionId::DISABLE): {
ReturnValue_t result = disableWdt();
if (result != returnvalue::OK) {
return result;
}
return EXECUTION_FINISHED;
}
}
return HasActionsIF::INVALID_ACTION_ID;
}
ReturnValue_t XiphosWdtHandler::enableWdt() {
int nowayout = 0;
int status = 0;
int retval = xsc_watchdog_get_status(&nowayout, &status);
// If this fails for whatever reason, just try enabling in any case.
if (retval != 0) {
sif::warning << "XiphosWdtHandler: Getting WDT status failed" << std::endl;
}
// Of course the enable API will fail if the device is already on, just perfect, love me some
// good C API... :)))
if (retval != 0 or status == 0) {
retval = xsc_watchdog_enable(wdtHandle);
if (retval != 0) {
sif::error << "XiphosWdtHandler: Enabling WDT failed with code " << retval << ": "
<< strerror(retval) << std::endl;
return returnvalue::FAILED;
}
}
enabled = true;
return returnvalue::OK;
}
ReturnValue_t XiphosWdtHandler::disableWdt() {
int nowayout = 0;
int status = 0;
int retval = xsc_watchdog_get_status(&nowayout, &status);
// If this fails for whatever reason, just try disabling in any case.
if (retval != 0) {
sif::warning << "XiphosWdtHandler: Getting WDT status failed" << std::endl;
}
// Of course the disable API will fail if the device is already off, just perfect, love me some
// good C API... :)))
if (retval != 0 or status == 1) {
retval = xsc_watchdog_disable(wdtHandle);
if (retval != 0) {
sif::error << "XiphosWdtHandler: Disabling WDT failed with code " << retval << ": "
<< strerror(retval) << std::endl;
return returnvalue::FAILED;
}
}
enabled = false;
return returnvalue::OK;
}
MessageQueueId_t XiphosWdtHandler::getCommandQueue() const { return requestQueue->getId(); }

View File

@ -1,36 +0,0 @@
#ifndef BSP_Q7S_CORE_XIPHOSWDTHANDLER_H_
#define BSP_Q7S_CORE_XIPHOSWDTHANDLER_H_
#include <fsfw/action/HasActionsIF.h>
#include <fsfw/objectmanager/SystemObject.h>
#include <fsfw/tasks/ExecutableObjectIF.h>
#include <libxiphos.h>
class XiphosWdtHandler : public SystemObject, public ExecutableObjectIF, public HasActionsIF {
public:
enum ActionId { ENABLE = 0, DISABLE = 1 };
XiphosWdtHandler(object_id_t objectId);
ReturnValue_t performOperation(uint8_t opCode) override;
ReturnValue_t initialize() override;
ReturnValue_t executeAction(ActionId_t actionId, MessageQueueId_t commandedBy,
const uint8_t* data, size_t size) override;
[[nodiscard]] virtual MessageQueueId_t getCommandQueue() const override;
private:
// Wrappers to ensure idempotency of trash C API.
ReturnValue_t enableWdt();
ReturnValue_t disableWdt();
// Timeout duration range specified by Xiphos: 0.001 seconds to 171 seconds. The libxiphos API
// expects an int, so I guess this translates to 1 to 171 seconds.
// WARNING: DO NOT SET THIS HIGHER THAN 80 SECONDS!
// Possible bug in Xiphos/Xilinx kernel driver for watchdog, related to overflow.
int timeoutSeconds = 80;
bool enabled = false;
struct watchdog_s* wdtHandle = nullptr;
MessageQueueIF* requestQueue = nullptr;
ActionHelper actionHelper;
};
#endif /* BSP_Q7S_CORE_XIPHOSWDTHANDLER_H_ */

View File

@ -1,183 +1,71 @@
#include <bsp_q7s/callbacks/q7sGpioCallbacks.h>
#include <bsp_q7s/core/XiphosWdtHandler.h>
#include <bsp_q7s/objectFactory.h>
#include <dummies/ComCookieDummy.h>
#include <dummies/PcduHandlerDummy.h>
#include <fsfw/health/HealthTableIF.h> #include <fsfw/health/HealthTableIF.h>
#include <fsfw/power/DummyPowerSwitcher.h>
#include <fsfw_hal/common/gpio/GpioCookie.h>
#include <mission/power/gsDefs.h>
#include <mission/system/systemTree.h>
#include <mission/utility/DummySdCardManager.h>
#include "OBSWConfig.h" #include "OBSWConfig.h"
#include "bsp_q7s/core/CoreController.h" #include "bsp_q7s/core/CoreController.h"
#include "bsp_q7s/core/ObjectFactory.h"
#include "busConf.h" #include "busConf.h"
#include "common/config/devices/addresses.h" #include "commonObjects.h"
#include "devConf.h" #include "devConf.h"
#include "dummies/helperFactory.h"
#include "eive/objects.h"
#include "fsfw_hal/linux/gpio/LinuxLibgpioIF.h" #include "fsfw_hal/linux/gpio/LinuxLibgpioIF.h"
#include "linux/ObjectFactory.h" #include "linux/ObjectFactory.h"
#include "linux/callbacks/gpioCallbacks.h" #include "linux/callbacks/gpioCallbacks.h"
#include "mission/genericFactory.h" #include "mission/core/GenericFactory.h"
#include "mission/system/com/comModeTree.h"
void ObjectFactory::produce(void* args) { void ObjectFactory::produce(void* args) {
ObjectFactory::setStatics(); ObjectFactory::setStatics();
HealthTableIF* healthTable = nullptr; HealthTableIF* healthTable = nullptr;
PusTmFunnel* pusFunnel = nullptr; ObjectFactory::produceGenericObjects(&healthTable);
CfdpTmFunnel* cfdpFunnel = nullptr;
StorageManagerIF* ipcStore = nullptr;
StorageManagerIF* tmStore = nullptr;
bool enableHkSets = false;
#if OBSW_ENABLE_PERIODIC_HK == 1
enableHkSets = true;
#endif
PersistentTmStores stores;
readFirmwareVersion();
new XiphosWdtHandler(objects::XIPHOS_WDT);
ObjectFactory::produceGenericObjects(&healthTable, &pusFunnel, &cfdpFunnel,
*SdCardManager::instance(), &ipcStore, &tmStore, stores, 200,
enableHkSets, true);
LinuxLibgpioIF* gpioComIF = nullptr; LinuxLibgpioIF* gpioComIF = nullptr;
SerialComIF* uartComIF = nullptr; UartComIF* uartComIF = nullptr;
SpiComIF* spiMainComIF = nullptr; SpiComIF* spiMainComIF = nullptr;
I2cComIF* i2cComIF = nullptr; I2cComIF* i2cComIF = nullptr;
createCommunicationInterfaces(&gpioComIF, &uartComIF, &spiMainComIF, &i2cComIF);
// Adding GPIOs for chip select decoding and initializing them.
q7s::gpioCallbacks::initSpiCsDecoder(gpioComIF);
gpioCallbacks::disableAllDecoder(gpioComIF);
createPlI2cResetGpio(gpioComIF);
// Hardware is usually not connected to EM, so we need to create dummies which replace lower
// level components.
dummy::DummyCfg dummyCfg;
dummyCfg.addCoreCtrlCfg = false;
dummyCfg.addCamSwitcherDummy = false;
#if OBSW_ADD_SYRLINKS == 1
dummyCfg.addSyrlinksDummies = false;
#endif
#if OBSW_ADD_PLOC_SUPERVISOR == 1 || OBSW_ADD_PLOC_MPSOC == 1
dummyCfg.addPlocDummies = false;
#endif
#if OBSW_ADD_TMP_DEVICES == 1
std::vector<std::pair<object_id_t, address_t>> tmpDevsToAdd = {{
{objects::TMP1075_HANDLER_PLPCDU_0, addresses::TMP1075_PLPCDU_0},
{objects::TMP1075_HANDLER_PLPCDU_1, addresses::TMP1075_PLPCDU_1},
{objects::TMP1075_HANDLER_IF_BOARD, addresses::TMP1075_IF_BOARD},
}};
createTmpComponents(tmpDevsToAdd);
dummy::Tmp1075Cfg tmpCfg{};
tmpCfg.addTcsBrd0 = true;
tmpCfg.addTcsBrd1 = true;
tmpCfg.addPlPcdu0 = false;
tmpCfg.addPlPcdu1 = false;
tmpCfg.addIfBrd = false;
dummyCfg.tmp1075Cfg = tmpCfg;
#endif
#if OBSW_ADD_GOMSPACE_PCDU == 1
dummyCfg.addPowerDummies = false;
// The ACU broke.
dummyCfg.addOnlyAcuDummy = true;
#endif
#if OBSW_ADD_STAR_TRACKER == 1
dummyCfg.addStrDummy = false;
#endif
#if OBSW_ADD_SCEX_DEVICE == 0
dummyCfg.addScexDummy = true;
#endif
#if OBSW_ADD_BPX_BATTERY_HANDLER == 1
dummyCfg.addBpxBattDummy = false;
#endif
#if OBSW_ADD_ACS_BOARD == 1
dummyCfg.addAcsBoardDummies = false;
#endif
#if OBSW_ADD_PL_PCDU == 0
dummyCfg.addPlPcduDummy = true;
#endif
PowerSwitchIF* pwrSwitcher = nullptr; PowerSwitchIF* pwrSwitcher = nullptr;
#if OBSW_ADD_GOMSPACE_PCDU == 0 SpiComIF* spiRwComIF = nullptr;
pwrSwitcher = new PcduHandlerDummy(objects::PCDU_HANDLER); createCommunicationInterfaces(&gpioComIF, &uartComIF, &spiMainComIF, &i2cComIF, &spiRwComIF);
#else createTmpComponents();
createPcduComponents(gpioComIF, &pwrSwitcher, enableHkSets); new CoreController(objects::CORE_CONTROLLER);
#endif
satsystem::EIVE_SYSTEM.setI2cRecoveryParams(pwrSwitcher);
const char* battAndImtqI2cDev = q7s::I2C_PL_EIVE; gpioCallbacks::disableAllDecoder(gpioComIF);
if (core::FW_VERSION_MAJOR >= 4) { createPcduComponents(gpioComIF, &pwrSwitcher);
battAndImtqI2cDev = q7s::I2C_PS_EIVE; createRadSensorComponent(gpioComIF);
} createSunSensorComponents(gpioComIF, spiMainComIF, pwrSwitcher, q7s::SPI_DEFAULT_DEV);
static_cast<void>(battAndImtqI2cDev);
#if OBSW_ADD_BPX_BATTERY_HANDLER == 1
createBpxBatteryComponent(enableHkSets, battAndImtqI2cDev);
#endif
createPowerController(true, enableHkSets);
dummy::createDummies(dummyCfg, *pwrSwitcher, gpioComIF, enableHkSets);
new CoreController(objects::CORE_CONTROLLER, enableHkSets);
auto* stackHandler = new Stack5VHandler(*pwrSwitcher);
static_cast<void>(stackHandler);
// Initialize chip select to avoid SPI bus issues.
createRadSensorChipSelect(gpioComIF);
#if OBSW_ADD_ACS_BOARD == 1 #if OBSW_ADD_ACS_BOARD == 1
createAcsBoardComponents(*spiMainComIF, gpioComIF, uartComIF, *pwrSwitcher, true, createAcsBoardComponents(gpioComIF, uartComIF, pwrSwitcher);
adis1650x::Type::ADIS16507);
#else
// Still add all GPIOs for EM.
GpioCookie* acsBoardGpios = new GpioCookie();
createAcsBoardGpios(*acsBoardGpios);
gpioChecker(gpioComIF->addGpios(acsBoardGpios), "ACS Board");
#endif #endif
createHeaterComponents(gpioComIF, pwrSwitcher, healthTable);
createSolarArrayDeploymentComponents();
createPlPcduComponents(gpioComIF, spiMainComIF, pwrSwitcher);
#if OBSW_ADD_SYRLINKS == 1
#if OBSW_Q7S_EM == 1
createSyrlinksComponents(nullptr);
#else
createSyrlinksComponents(pwrSwitcher);
#endif /* OBSW_Q7S_EM == 1 */
#endif /* OBSW_ADD_SYRLINKS == 1 */
createRtdComponents(q7s::SPI_DEFAULT_DEV, gpioComIF, pwrSwitcher, spiMainComIF);
createPayloadComponents(gpioComIF);
#if OBSW_ADD_MGT == 1 #if OBSW_ADD_MGT == 1
createImtqComponents(pwrSwitcher, enableHkSets, battAndImtqI2cDev); createImtqComponents(pwrSwitcher);
#endif #endif
#if OBSW_ADD_SYRLINKS == 1
createSyrlinksComponents(pwrSwitcher);
#endif /* OBSW_ADD_SYRLINKS == 1 */
#if OBSW_ADD_RW == 1
createReactionWheelComponents(gpioComIF, pwrSwitcher); createReactionWheelComponents(gpioComIF, pwrSwitcher);
#if OBSW_ADD_BPX_BATTERY_HANDLER == 1
createBpxBatteryComponent();
#endif #endif
#if OBSW_ADD_STAR_TRACKER == 1 #if OBSW_ADD_STAR_TRACKER == 1
createStrComponents(pwrSwitcher, *SdCardManager::instance()); createStrComponents(pwrSwitcher);
#endif /* OBSW_ADD_STAR_TRACKER == 1 */ #endif /* OBSW_ADD_STAR_TRACKER == 1 */
#if OBSW_USE_CCSDS_IP_CORE == 1
#if OBSW_ADD_PL_PCDU == 1 createCcsdsComponents(gpioComIF);
createPlPcduComponents(gpioComIF, spiMainComIF, pwrSwitcher, *stackHandler); #endif /* OBSW_USE_CCSDS_IP_CORE == 1 */
#endif
createPayloadComponents(gpioComIF, *pwrSwitcher);
#if OBSW_ADD_CCSDS_IP_CORES == 1
CcsdsIpCoreHandler* ipCoreHandler = nullptr;
CcsdsComponentArgs ccsdsArgs(*gpioComIF, *ipcStore, *tmStore, stores, *pusFunnel, *cfdpFunnel,
&ipCoreHandler, 0, 0);
createCcsdsIpComponentsWrapper(ccsdsArgs);
#endif /* OBSW_ADD_CCSDS_IP_CORES == 1 */
/* Test Task */ /* Test Task */
#if OBSW_ADD_TEST_CODE == 1 #if OBSW_ADD_TEST_CODE == 1
createTestComponents(gpioComIF); createTestComponents(gpioComIF);
#endif /* OBSW_ADD_TEST_CODE == 1 */ #endif /* OBSW_ADD_TEST_CODE == 1 */
#if OBSW_ADD_SCEX_DEVICE == 1
createScexComponents(q7s::UART_SCEX_DEV, pwrSwitcher, *SdCardManager::instance(), false, createMiscComponents();
power::Switches::PDU1_CH5_SOLAR_CELL_EXP_5V);
#endif
createAcsController(true, enableHkSets, *SdCardManager::instance());
HeaterHandler* heaterHandler;
createHeaterComponents(gpioComIF, pwrSwitcher, healthTable, heaterHandler);
createThermalController(*heaterHandler, true);
satsystem::init(true);
} }

View File

@ -1,135 +1,67 @@
#include <bsp_q7s/callbacks/q7sGpioCallbacks.h>
#include <bsp_q7s/core/XiphosWdtHandler.h>
#include <bsp_q7s/objectFactory.h>
#include <devices/gpioIds.h>
#include <fsfw/storagemanager/LocalPool.h>
#include <fsfw/storagemanager/PoolManager.h>
#include <mission/power/gsDefs.h>
#include <mission/system/EiveSystem.h>
#include "OBSWConfig.h" #include "OBSWConfig.h"
#include "bsp_q7s/core/CoreController.h" #include "bsp_q7s/core/CoreController.h"
#include "bsp_q7s/core/ObjectFactory.h"
#include "busConf.h" #include "busConf.h"
#include "commonObjects.h"
#include "devConf.h" #include "devConf.h"
#include "devices/addresses.h"
#include "eive/objects.h"
#include "fsfw_hal/linux/gpio/LinuxLibgpioIF.h" #include "fsfw_hal/linux/gpio/LinuxLibgpioIF.h"
#include "linux/ObjectFactory.h" #include "linux/ObjectFactory.h"
#include "linux/callbacks/gpioCallbacks.h" #include "linux/callbacks/gpioCallbacks.h"
#include "mission/genericFactory.h" #include "mission/core/GenericFactory.h"
#include "mission/system/systemTree.h"
#include "mission/tmtc/tmFilters.h"
void ObjectFactory::produce(void* args) { void ObjectFactory::produce(void* args) {
ObjectFactory::setStatics(); ObjectFactory::setStatics();
HealthTableIF* healthTable = nullptr; HealthTableIF* healthTable = nullptr;
PusTmFunnel* pusFunnel = nullptr; ObjectFactory::produceGenericObjects(&healthTable);
CfdpTmFunnel* cfdpFunnel = nullptr;
StorageManagerIF* ipcStore = nullptr;
StorageManagerIF* tmStore = nullptr;
bool enableHkSets = false;
#if OBSW_ENABLE_PERIODIC_HK == 1
enableHkSets = true;
#endif
PersistentTmStores stores;
readFirmwareVersion();
new XiphosWdtHandler(objects::XIPHOS_WDT);
ObjectFactory::produceGenericObjects(&healthTable, &pusFunnel, &cfdpFunnel,
*SdCardManager::instance(), &ipcStore, &tmStore, stores, 200,
true, true);
LinuxLibgpioIF* gpioComIF = nullptr; LinuxLibgpioIF* gpioComIF = nullptr;
SerialComIF* uartComIF = nullptr; UartComIF* uartComIF = nullptr;
SpiComIF* spiMainComIF = nullptr; SpiComIF* spiMainComIF = nullptr;
I2cComIF* i2cComIF = nullptr; I2cComIF* i2cComIF = nullptr;
PowerSwitchIF* pwrSwitcher = nullptr; PowerSwitchIF* pwrSwitcher = nullptr;
createCommunicationInterfaces(&gpioComIF, &uartComIF, &spiMainComIF, &i2cComIF); SpiComIF* spiRwComIF = nullptr;
/* Adding gpios for chip select decoding to the gpioComIf */ createCommunicationInterfaces(&gpioComIF, &uartComIF, &spiMainComIF, &i2cComIF, &spiRwComIF);
q7s::gpioCallbacks::initSpiCsDecoder(gpioComIF); createTmpComponents();
new CoreController(objects::CORE_CONTROLLER);
gpioCallbacks::disableAllDecoder(gpioComIF); gpioCallbacks::disableAllDecoder(gpioComIF);
createPlI2cResetGpio(gpioComIF); createPcduComponents(gpioComIF, &pwrSwitcher);
createRadSensorComponent(gpioComIF);
new CoreController(objects::CORE_CONTROLLER, enableHkSets); createSunSensorComponents(gpioComIF, spiMainComIF, pwrSwitcher, q7s::SPI_DEFAULT_DEV);
createPcduComponents(gpioComIF, &pwrSwitcher, enableHkSets);
satsystem::EIVE_SYSTEM.setI2cRecoveryParams(pwrSwitcher);
auto* stackHandler = new Stack5VHandler(*pwrSwitcher);
#if OBSW_ADD_RAD_SENSORS == 1
createRadSensorComponent(gpioComIF, *stackHandler);
#endif
#if OBSW_ADD_SUN_SENSORS == 1
createSunSensorComponents(gpioComIF, spiMainComIF, *pwrSwitcher, q7s::SPI_DEFAULT_DEV, true);
#endif
#if OBSW_ADD_ACS_BOARD == 1 #if OBSW_ADD_ACS_BOARD == 1
createAcsBoardComponents(*spiMainComIF, gpioComIF, uartComIF, *pwrSwitcher, true, createAcsBoardComponents(gpioComIF, uartComIF, pwrSwitcher);
adis1650x::Type::ADIS16505);
#endif #endif
HeaterHandler* heaterHandler; createHeaterComponents(gpioComIF, pwrSwitcher, healthTable);
createHeaterComponents(gpioComIF, pwrSwitcher, healthTable, heaterHandler); createSolarArrayDeploymentComponents();
#if OBSW_ADD_TMP_DEVICES == 1 createPlPcduComponents(gpioComIF, spiMainComIF, pwrSwitcher);
std::vector<std::pair<object_id_t, address_t>> tmpDevsToAdd = {{ #if OBSW_ADD_SYRLINKS == 1
{objects::TMP1075_HANDLER_TCS_0, addresses::TMP1075_TCS_0}, createSyrlinksComponents(pwrSwitcher);
{objects::TMP1075_HANDLER_TCS_1, addresses::TMP1075_TCS_1}, #endif /* OBSW_ADD_SYRLINKS == 1 */
{objects::TMP1075_HANDLER_PLPCDU_0, addresses::TMP1075_PLPCDU_0}, createRtdComponents(q7s::SPI_DEFAULT_DEV, gpioComIF, pwrSwitcher, spiMainComIF);
// damaged createPayloadComponents(gpioComIF);
// {objects::TMP1075_HANDLER_PLPCDU_1, addresses::TMP1075_PLPCDU_1},
{objects::TMP1075_HANDLER_IF_BOARD, addresses::TMP1075_IF_BOARD},
}};
createTmpComponents(tmpDevsToAdd);
#endif
createSolarArrayDeploymentComponents(*pwrSwitcher, *gpioComIF);
const char* battAndImtqI2cDev = q7s::I2C_PL_EIVE;
if (core::FW_VERSION_MAJOR >= 4) {
battAndImtqI2cDev = q7s::I2C_PS_EIVE;
}
#if OBSW_ADD_MGT == 1 #if OBSW_ADD_MGT == 1
createImtqComponents(pwrSwitcher, enableHkSets, battAndImtqI2cDev); createImtqComponents(pwrSwitcher);
#endif #endif
createReactionWheelComponents(gpioComIF, pwrSwitcher); createReactionWheelComponents(gpioComIF, pwrSwitcher);
#if OBSW_ADD_BPX_BATTERY_HANDLER == 1 #if OBSW_ADD_BPX_BATTERY_HANDLER == 1
createBpxBatteryComponent(enableHkSets, battAndImtqI2cDev); createBpxBatteryComponent();
#endif #endif
createPowerController(true, enableHkSets);
#if OBSW_ADD_PL_PCDU == 1
createPlPcduComponents(gpioComIF, spiMainComIF, pwrSwitcher, *stackHandler);
#endif
#if OBSW_ADD_SYRLINKS == 1
createSyrlinksComponents(pwrSwitcher);
#endif /* OBSW_ADD_SYRLINKS == 1 */
createRtdComponents(q7s::SPI_DEFAULT_DEV, gpioComIF, pwrSwitcher, spiMainComIF);
createPayloadComponents(gpioComIF, *pwrSwitcher);
#if OBSW_ADD_STAR_TRACKER == 1 #if OBSW_ADD_STAR_TRACKER == 1
createStrComponents(pwrSwitcher, *SdCardManager::instance()); createStrComponents(pwrSwitcher);
#endif /* OBSW_ADD_STAR_TRACKER == 1 */ #endif /* OBSW_ADD_STAR_TRACKER == 1 */
#if OBSW_USE_CCSDS_IP_CORE == 1
#if OBSW_ADD_CCSDS_IP_CORES == 1 createCcsdsComponents(gpioComIF);
CcsdsIpCoreHandler* ipCoreHandler = nullptr; #endif /* OBSW_USE_CCSDS_IP_CORE == 1 */
CcsdsComponentArgs ccsdsArgs(*gpioComIF, *ipcStore, *tmStore, stores, *pusFunnel, *cfdpFunnel,
&ipCoreHandler, 0, 0);
createCcsdsIpComponentsWrapper(ccsdsArgs);
#endif /* OBSW_ADD_CCSDS_IP_CORES == 1 */
#if OBSW_ADD_SCEX_DEVICE == 1
createScexComponents(q7s::UART_SCEX_DEV, pwrSwitcher, *SdCardManager::instance(), false,
power::Switches::PDU1_CH5_SOLAR_CELL_EXP_5V);
#endif
/* Test Task */ /* Test Task */
#if OBSW_ADD_TEST_CODE == 1 #if OBSW_ADD_TEST_CODE == 1
createTestComponents(gpioComIF); createTestComponents(gpioComIF);
#endif /* OBSW_ADD_TEST_CODE == 1 */ #endif /* OBSW_ADD_TEST_CODE == 1 */
createMiscComponents(); createMiscComponents();
createThermalController(*heaterHandler, false); createThermalController();
createAcsController(true, enableHkSets, *SdCardManager::instance()); createAcsController();
satsystem::init(false);
} }

View File

@ -1,2 +0,0 @@
target_sources(${OBSW_NAME} PRIVATE helpers.cpp SdCardManager.cpp
FilesystemHelper.cpp)

View File

@ -1,11 +0,0 @@
#include "helpers.h"
std::filesystem::path fshelpers::getPrefixedPath(SdCardManager &man,
std::filesystem::path pathWihtoutPrefix) {
auto prefix = man.getCurrentMountPrefix();
if (prefix == nullptr) {
return pathWihtoutPrefix;
}
auto resPath = prefix / pathWihtoutPrefix;
return resPath;
}

View File

@ -1,14 +0,0 @@
#ifndef BSP_Q7S_MEMORY_HELPERS_H_
#define BSP_Q7S_MEMORY_HELPERS_H_
#include <filesystem>
#include "SdCardManager.h"
namespace fshelpers {
std::filesystem::path getPrefixedPath(SdCardManager& man, std::filesystem::path pathWihtoutPrefix);
}
#endif /* BSP_Q7S_MEMORY_HELPERS_H_ */

View File

@ -12,10 +12,10 @@
* @brief This is the main program for the target hardware. * @brief This is the main program for the target hardware.
* @return * @return
*/ */
int main(int argc, char* argv[]) { int main(void) {
using namespace std; using namespace std;
#if Q7S_SIMPLE_MODE == 0 #if Q7S_SIMPLE_MODE == 0
return obsw::obsw(argc, argv); return obsw::obsw();
#else #else
return simple::simple(); return simple::simple();
#endif #endif

View File

@ -1 +1,2 @@
target_sources(${OBSW_NAME} PRIVATE scratchApi.cpp LocalParameterHandler.cpp) target_sources(${OBSW_NAME} PRIVATE FileSystemHandler.cpp SdCardManager.cpp
scratchApi.cpp FilesystemHelper.cpp)

View File

@ -0,0 +1,238 @@
#include "FileSystemHandler.h"
#include <cstring>
#include <filesystem>
#include <fstream>
#include "bsp_q7s/core/CoreController.h"
#include "fsfw/ipc/QueueFactory.h"
#include "fsfw/memory/GenericFileSystemMessage.h"
#include "fsfw/tasks/TaskFactory.h"
FileSystemHandler::FileSystemHandler(object_id_t fileSystemHandler)
: SystemObject(fileSystemHandler) {
auto mqArgs = MqArgs(this->getObjectId());
mq = QueueFactory::instance()->createMessageQueue(FS_MAX_QUEUE_SIZE,
MessageQueueMessage::MAX_MESSAGE_SIZE, &mqArgs);
}
FileSystemHandler::~FileSystemHandler() { QueueFactory::instance()->deleteMessageQueue(mq); }
ReturnValue_t FileSystemHandler::performOperation(uint8_t unsignedChar) {
while (true) {
try {
fileSystemHandlerLoop();
} catch (std::bad_alloc& e) {
// Restart OBSW, hints at a memory leak
sif::error << "Allocation error in FileSystemHandler::performOperation" << e.what()
<< std::endl;
// Set up an error file or a special flag in the scratch buffer for these cases
triggerEvent(CoreController::ALLOC_FAILURE, 0, 0);
CoreController::incrementAllocationFailureCount();
}
}
}
void FileSystemHandler::fileSystemHandlerLoop() {
CommandMessage filemsg;
ReturnValue_t result = HasReturnvaluesIF::RETURN_OK;
while (true) {
if (opCounter % 5 == 0) {
if (coreCtrl->sdInitFinished()) {
fileSystemCheckup();
}
}
result = mq->receiveMessage(&filemsg);
if (result == MessageQueueIF::EMPTY) {
break;
} else if (result != HasReturnvaluesIF::RETURN_FAILED) {
sif::warning << "FileSystemHandler::performOperation: Message reception failed!" << std::endl;
break;
}
Command_t command = filemsg.getCommand();
switch (command) {
case (GenericFileSystemMessage::CMD_CREATE_DIRECTORY): {
break;
}
case (GenericFileSystemMessage::CMD_CREATE_FILE): {
break;
}
}
opCounter++;
}
// This task will have a low priority and will run permanently in the background
// so we will just run in a permanent loop here and check file system
// messages permanently
opCounter++;
TaskFactory::instance()->delayTask(1000);
}
void FileSystemHandler::fileSystemCheckup() {
SdCardManager::SdStatePair statusPair;
sdcMan->getSdCardsStatus(statusPair);
sd::SdCard preferredSdCard = sdcMan->getPreferredSdCard();
if ((preferredSdCard == sd::SdCard::SLOT_0) and (statusPair.first == sd::SdState::MOUNTED)) {
currentMountPrefix = SdCardManager::SD_0_MOUNT_POINT;
} else if ((preferredSdCard == sd::SdCard::SLOT_1) and
(statusPair.second == sd::SdState::MOUNTED)) {
currentMountPrefix = SdCardManager::SD_1_MOUNT_POINT;
} else {
std::string sdString;
if (preferredSdCard == sd::SdCard::SLOT_0) {
sdString = "0";
} else {
sdString = "1";
}
sif::warning << "FileSystemHandler::performOperation: "
"Inconsistent state detected"
<< std::endl;
sif::warning << "Preferred SD card is " << sdString
<< " but does not appear to be mounted. Attempting fix.." << std::endl;
// This function will appear to fix the inconsistent state
ReturnValue_t result = sdcMan->sanitizeState(&statusPair, preferredSdCard);
if (result != HasReturnvaluesIF::RETURN_OK) {
// Oh no.
triggerEvent(SdCardManager::SANITIZATION_FAILED, 0, 0);
sif::error << "FileSystemHandler::fileSystemCheckup: Sanitization failed" << std::endl;
}
}
}
MessageQueueId_t FileSystemHandler::getCommandQueue() const { return mq->getId(); }
ReturnValue_t FileSystemHandler::initialize() {
coreCtrl = ObjectManager::instance()->get<CoreController>(objects::CORE_CONTROLLER);
if (coreCtrl == nullptr) {
sif::error << "FileSystemHandler::initialize: Could not retrieve core controller handle"
<< std::endl;
}
sdcMan = SdCardManager::instance();
sd::SdCard preferredSdCard = sdcMan->getPreferredSdCard();
if (preferredSdCard == sd::SdCard::SLOT_0) {
currentMountPrefix = SdCardManager::SD_0_MOUNT_POINT;
} else if (preferredSdCard == sd::SdCard::SLOT_1) {
currentMountPrefix = SdCardManager::SD_1_MOUNT_POINT;
}
return HasReturnvaluesIF::RETURN_OK;
}
ReturnValue_t FileSystemHandler::appendToFile(const char* repositoryPath, const char* filename,
const uint8_t* data, size_t size,
uint16_t packetNumber, FileSystemArgsIF* args) {
auto path = getInitPath(args) / repositoryPath / filename;
if (not std::filesystem::exists(path)) {
return FILE_DOES_NOT_EXIST;
}
std::ofstream file(path, std::ios_base::app | std::ios_base::out);
file.write(reinterpret_cast<const char*>(data), size);
if (not file.good()) {
return GENERIC_FILE_ERROR;
}
return HasReturnvaluesIF::RETURN_OK;
}
ReturnValue_t FileSystemHandler::createFile(const char* repositoryPath, const char* filename,
const uint8_t* data, size_t size,
FileSystemArgsIF* args) {
auto path = getInitPath(args) / filename;
if (std::filesystem::exists(path)) {
return FILE_ALREADY_EXISTS;
}
std::ofstream file(path);
file.write(reinterpret_cast<const char*>(data), size);
if (not file.good()) {
return GENERIC_FILE_ERROR;
}
return HasReturnvaluesIF::RETURN_OK;
}
ReturnValue_t FileSystemHandler::removeFile(const char* repositoryPath, const char* filename,
FileSystemArgsIF* args) {
auto path = getInitPath(args) / repositoryPath / filename;
if (not std::filesystem::exists(path)) {
return FILE_DOES_NOT_EXIST;
}
int result = std::remove(path.c_str());
if (result != 0) {
sif::warning << "FileSystemHandler::deleteFile: Failed with code " << result << std::endl;
return GENERIC_FILE_ERROR;
}
return HasReturnvaluesIF::RETURN_OK;
}
ReturnValue_t FileSystemHandler::createDirectory(const char* repositoryPath, const char* dirname,
bool createParentDirs, FileSystemArgsIF* args) {
auto path = getInitPath(args) / repositoryPath / dirname;
if (std::filesystem::exists(path)) {
return DIRECTORY_ALREADY_EXISTS;
}
if (std::filesystem::create_directory(path)) {
return HasReturnvaluesIF::RETURN_OK;
}
sif::warning << "Creating directory " << path << " failed" << std::endl;
return GENERIC_FILE_ERROR;
}
ReturnValue_t FileSystemHandler::removeDirectory(const char* repositoryPath, const char* dirname,
bool deleteRecurively, FileSystemArgsIF* args) {
auto path = getInitPath(args) / repositoryPath / dirname;
if (not std::filesystem::exists(path)) {
return DIRECTORY_DOES_NOT_EXIST;
}
std::error_code err;
if (not deleteRecurively) {
if (std::filesystem::remove(path, err)) {
return HasReturnvaluesIF::RETURN_OK;
} else {
// Check error code. Most probably denied permissions because folder is not empty
sif::warning << "FileSystemHandler::removeDirectory: Deleting directory failed with "
"code "
<< err.value() << ": " << strerror(err.value()) << std::endl;
if (err.value() == ENOTEMPTY) {
return DIRECTORY_NOT_EMPTY;
} else {
return GENERIC_FILE_ERROR;
}
}
} else {
if (std::filesystem::remove_all(path, err)) {
return HasReturnvaluesIF::RETURN_OK;
} else {
sif::warning << "FileSystemHandler::removeDirectory: Deleting directory failed with "
"code "
<< err.value() << ": " << strerror(err.value()) << std::endl;
// Check error code
if (err.value() == ENOTEMPTY) {
return DIRECTORY_NOT_EMPTY;
} else {
return GENERIC_FILE_ERROR;
}
}
}
return HasReturnvaluesIF::RETURN_OK;
}
ReturnValue_t FileSystemHandler::renameFile(const char* repositoryPath, const char* oldFilename,
const char* newFilename, FileSystemArgsIF* args) {
auto basepath = getInitPath(args) / repositoryPath;
std::filesystem::rename(basepath / oldFilename, basepath / newFilename);
return HasReturnvaluesIF::RETURN_OK;
}
void FileSystemHandler::parseCfg(FsCommandCfg* cfg, bool& useMountPrefix) {
if (cfg != nullptr) {
useMountPrefix = cfg->useMountPrefix;
}
}
std::filesystem::path FileSystemHandler::getInitPath(FileSystemArgsIF* args) {
bool useMountPrefix = true;
parseCfg(reinterpret_cast<FsCommandCfg*>(args), useMountPrefix);
std::string path;
if (useMountPrefix) {
path = currentMountPrefix;
}
return std::filesystem::path(path);
}

View File

@ -0,0 +1,68 @@
#ifndef BSP_Q7S_MEMORY_FILESYSTEMHANDLER_H_
#define BSP_Q7S_MEMORY_FILESYSTEMHANDLER_H_
#include <filesystem>
#include <string>
#include "OBSWConfig.h"
#include "SdCardManager.h"
#include "eive/definitions.h"
#include "fsfw/ipc/MessageQueueIF.h"
#include "fsfw/memory/HasFileSystemIF.h"
#include "fsfw/objectmanager/SystemObject.h"
#include "fsfw/tasks/ExecutableObjectIF.h"
class CoreController;
class FileSystemHandler : public SystemObject, public ExecutableObjectIF, public HasFileSystemIF {
public:
struct FsCommandCfg : public FileSystemArgsIF {
// Can be used to automatically use mount prefix of active SD card.
// Otherwise, the operator has to specify the full path to the mounted SD card as well.
bool useMountPrefix = false;
};
FileSystemHandler(object_id_t fileSystemHandler);
virtual ~FileSystemHandler();
ReturnValue_t performOperation(uint8_t) override;
ReturnValue_t initialize() override;
/**
* Function to get the MessageQueueId_t of the implementing object
* @return MessageQueueId_t of the object
*/
MessageQueueId_t getCommandQueue() const override;
ReturnValue_t appendToFile(const char* repositoryPath, const char* filename, const uint8_t* data,
size_t size, uint16_t packetNumber,
FileSystemArgsIF* args = nullptr) override;
ReturnValue_t createFile(const char* repositoryPath, const char* filename,
const uint8_t* data = nullptr, size_t size = 0,
FileSystemArgsIF* args = nullptr) override;
ReturnValue_t removeFile(const char* repositoryPath, const char* filename,
FileSystemArgsIF* args = nullptr) override;
ReturnValue_t createDirectory(const char* repositoryPath, const char* dirname,
bool createParentDirs, FileSystemArgsIF* args = nullptr) override;
ReturnValue_t removeDirectory(const char* repositoryPath, const char* dirname,
bool deleteRecurively = false,
FileSystemArgsIF* args = nullptr) override;
ReturnValue_t renameFile(const char* repositoryPath, const char* oldFilename,
const char* newFilename, FileSystemArgsIF* args = nullptr) override;
private:
CoreController* coreCtrl = nullptr;
MessageQueueIF* mq = nullptr;
std::string currentMountPrefix = SdCardManager::SD_0_MOUNT_POINT;
static constexpr uint32_t FS_MAX_QUEUE_SIZE = config::OBSW_FILESYSTEM_HANDLER_QUEUE_SIZE;
SdCardManager* sdcMan = nullptr;
uint8_t opCounter = 0;
void fileSystemHandlerLoop();
void fileSystemCheckup();
std::filesystem::path getInitPath(FileSystemArgsIF* args);
void parseCfg(FsCommandCfg* cfg, bool& useMountPrefix);
};
#endif /* BSP_Q7S_MEMORY_FILESYSTEMMANAGER_H_ */

View File

@ -3,9 +3,8 @@
#include <filesystem> #include <filesystem>
#include <fstream> #include <fstream>
#include "SdCardManager.h" #include "bsp_q7s/memory/SdCardManager.h"
#include "eive/definitions.h" #include "fsfw/serviceinterface/ServiceInterfaceStream.h"
#include "fsfw/serviceinterface.h"
FilesystemHelper::FilesystemHelper() {} FilesystemHelper::FilesystemHelper() {}
@ -13,26 +12,27 @@ ReturnValue_t FilesystemHelper::checkPath(std::string path) {
SdCardManager* sdcMan = SdCardManager::instance(); SdCardManager* sdcMan = SdCardManager::instance();
if (sdcMan == nullptr) { if (sdcMan == nullptr) {
sif::warning << "FilesystemHelper::checkPath: Invalid SD card manager" << std::endl; sif::warning << "FilesystemHelper::checkPath: Invalid SD card manager" << std::endl;
return returnvalue::FAILED; return RETURN_FAILED;
} }
if (path.substr(0, sizeof(config::SD_0_MOUNT_POINT)) == std::string(config::SD_0_MOUNT_POINT)) { if (path.substr(0, sizeof(SdCardManager::SD_0_MOUNT_POINT)) ==
if (!sdcMan->isSdCardUsable(sd::SLOT_0)) { std::string(SdCardManager::SD_0_MOUNT_POINT)) {
if (!sdcMan->isSdCardMounted(sd::SLOT_0)) {
sif::warning << "FilesystemHelper::checkPath: SD card 0 not mounted" << std::endl; sif::warning << "FilesystemHelper::checkPath: SD card 0 not mounted" << std::endl;
return SD_NOT_MOUNTED; return SD_NOT_MOUNTED;
} }
} else if (path.substr(0, sizeof(config::SD_1_MOUNT_POINT)) == } else if (path.substr(0, sizeof(SdCardManager::SD_1_MOUNT_POINT)) ==
std::string(config::SD_1_MOUNT_POINT)) { std::string(SdCardManager::SD_1_MOUNT_POINT)) {
if (!sdcMan->isSdCardUsable(sd::SLOT_1)) { if (!sdcMan->isSdCardMounted(sd::SLOT_0)) {
sif::warning << "FilesystemHelper::checkPath: SD card 1 not mounted" << std::endl; sif::warning << "FilesystemHelper::checkPath: SD card 1 not mounted" << std::endl;
return SD_NOT_MOUNTED; return SD_NOT_MOUNTED;
} }
} }
return returnvalue::OK; return RETURN_OK;
} }
ReturnValue_t FilesystemHelper::fileExists(std::string file) { ReturnValue_t FilesystemHelper::fileExists(std::string file) {
if (not std::filesystem::exists(file)) { if (not std::filesystem::exists(file)) {
return FILE_NOT_EXISTS; return FILE_NOT_EXISTS;
} }
return returnvalue::OK; return RETURN_OK;
} }

View File

@ -3,15 +3,15 @@
#include <string> #include <string>
#include "eive/resultClassIds.h" #include "commonClassIds.h"
#include "fsfw/returnvalues/returnvalue.h" #include "fsfw/returnvalues/HasReturnvaluesIF.h"
/** /**
* @brief This class implements often used functions related to the file system management. * @brief This class implements often used functions related to the file system management.
* *
* @author J. Meier * @author J. Meier
*/ */
class FilesystemHelper { class FilesystemHelper : public HasReturnvaluesIF {
public: public:
static const uint8_t INTERFACE_ID = CLASS_ID::FILE_SYSTEM_HELPER; static const uint8_t INTERFACE_ID = CLASS_ID::FILE_SYSTEM_HELPER;
@ -26,7 +26,7 @@ class FilesystemHelper {
* *
* @param path Path to check * @param path Path to check
* *
* @return returnvalue::OK if path points to SD card and the appropriate SD card is mounted or if * @return RETURN_OK if path points to SD card and the appropriate SD card is mounted or if
* path does not point to SD card. * path does not point to SD card.
* Return error code if path points to SD card and the corresponding SD card is not * Return error code if path points to SD card and the corresponding SD card is not
* mounted. * mounted.
@ -38,7 +38,7 @@ class FilesystemHelper {
* *
* @param file File to check * @param file File to check
* *
* @return returnvalue::OK if file exists, otherwise return error code. * @return RETURN_OK if file exists, otherwise return error code.
*/ */
static ReturnValue_t fileExists(std::string file); static ReturnValue_t fileExists(std::string file);

View File

@ -1,41 +0,0 @@
#include "LocalParameterHandler.h"
#include <fsfw/serviceinterface/ServiceInterface.h>
LocalParameterHandler::LocalParameterHandler(std::string sdRelativeName, SdCardMountedIF* sdcMan)
: NVMParameterBase(), sdRelativeName(sdRelativeName), sdcMan(sdcMan) {}
LocalParameterHandler::~LocalParameterHandler() {}
ReturnValue_t LocalParameterHandler::initialize() {
ReturnValue_t result = updateFullName();
if (result != returnvalue::OK) {
return result;
}
result = readJsonFile();
if (result != returnvalue::OK) {
return result;
}
return returnvalue::OK;
}
ReturnValue_t LocalParameterHandler::writeJsonFile() {
ReturnValue_t result = updateFullName();
if (result != returnvalue::OK) {
return result;
}
return NVMParameterBase::writeJsonFile();
}
ReturnValue_t LocalParameterHandler::updateFullName() {
std::string mountPrefix;
auto activeSd = sdcMan->getActiveSdCard();
if (activeSd and sdcMan->isSdCardUsable(activeSd.value())) {
mountPrefix = sdcMan->getCurrentMountPrefix();
} else {
return SD_NOT_READY;
}
std::string fullname = mountPrefix + "/" + sdRelativeName;
NVMParameterBase::setFullName(fullname);
return returnvalue::OK;
}

View File

@ -1,106 +0,0 @@
#ifndef BSP_Q7S_MEMORY_LOCALPARAMETERHANDLER_H_
#define BSP_Q7S_MEMORY_LOCALPARAMETERHANDLER_H_
#include <mission/memory/NvmParameterBase.h>
#include <mission/memory/SdCardMountedIF.h>
#include <string>
/**
* @brief Class to handle persistent parameters
*
*/
class LocalParameterHandler : public NVMParameterBase {
public:
static constexpr uint8_t INTERFACE_ID = CLASS_ID::LOCAL_PARAM_HANDLER;
static constexpr ReturnValue_t SD_NOT_READY = returnvalue::makeCode(INTERFACE_ID, 0);
/**
* @brief Constructor
*
* @param sdRelativeName Absolute name of json file relative to mount
* directory
* of SD card. E.g. conf/example.json
* @param sdcMan Pointer to SD card manager
*/
LocalParameterHandler(std::string sdRelativeName, SdCardMountedIF* sdcMan);
virtual ~LocalParameterHandler();
/**
* @brief Will initialize the local parameter handler
*
* @return OK if successful, otherwise error return value
*/
ReturnValue_t initialize();
/**
* @brief Function to add parameter to json file. If the json file does
* not yet exist it will be created here.
*
* @param key The string to identify the parameter
* @param value The value to set for this parameter
*
* @return OK if successful, otherwise error return value
*
* @details The function will add the parameter only if it is not already
* present in the json file
*/
template <typename T>
ReturnValue_t addParameter(std::string key, T value);
/**
* @brief Function will update a parameter which already exists in the json
* file
*
* @param key The unique string to identify the parameter to update
* @param value The new new value to set
*
* @return OK if successful, otherwise error return value
*/
template <typename T>
ReturnValue_t updateParameter(std::string key, T value);
private:
// Name relative to mount point of SD card where parameters will be stored
std::string sdRelativeName;
SdCardMountedIF* sdcMan;
virtual ReturnValue_t writeJsonFile();
/**
* @brief This function sets the name of the json file dependent on the
* currently active SD card
*
* @return OK if successful, otherwise error return value
*/
ReturnValue_t updateFullName();
};
template <typename T>
inline ReturnValue_t LocalParameterHandler::addParameter(std::string key, T value) {
ReturnValue_t result = insertValue(key, value);
if (result != returnvalue::OK) {
return result;
}
result = writeJsonFile();
if (result != returnvalue::OK) {
return result;
}
return returnvalue::OK;
}
template <typename T>
inline ReturnValue_t LocalParameterHandler::updateParameter(std::string key, T value) {
ReturnValue_t result = setValue(key, value);
if (result != returnvalue::OK) {
return result;
}
result = writeJsonFile();
if (result != returnvalue::OK) {
return result;
}
return returnvalue::OK;
}
#endif /* BSP_Q7S_MEMORY_LOCALPARAMETERHANDLER_H_ */

View File

@ -2,7 +2,6 @@
#include <fsfw/ipc/MutexGuard.h> #include <fsfw/ipc/MutexGuard.h>
#include <fsfw/timemanager/Countdown.h> #include <fsfw/timemanager/Countdown.h>
#include <fsfw/timemanager/Stopwatch.h>
#include <unistd.h> #include <unistd.h>
#include <cstring> #include <cstring>
@ -11,42 +10,41 @@
#include <memory> #include <memory>
#include "OBSWConfig.h" #include "OBSWConfig.h"
#include "bsp_q7s/memory/scratchApi.h" #include "common/config/commonObjects.h"
#include "eive/definitions.h"
#include "eive/objects.h"
#include "fsfw/ipc/MutexFactory.h" #include "fsfw/ipc/MutexFactory.h"
#include "fsfw/serviceinterface/ServiceInterface.h" #include "fsfw/serviceinterface/ServiceInterface.h"
#include "linux/utility/utility.h" #include "linux/utility/utility.h"
#include "scratchApi.h"
SdCardManager* SdCardManager::INSTANCE = nullptr; SdCardManager* SdCardManager::INSTANCE = nullptr;
SdCardManager::SdCardManager() : SystemObject(objects::SDC_MANAGER), cmdExecutor(256) { SdCardManager::SdCardManager() : SystemObject(objects::SDC_MANAGER), cmdExecutor(256) {
sdLock = MutexFactory::instance()->createMutex(); mutex = MutexFactory::instance()->createMutex();
prefLock = MutexFactory::instance()->createMutex(); ReturnValue_t result = mutex->lockMutex();
defaultLock = MutexFactory::instance()->createMutex(); if (result != RETURN_OK) {
MutexGuard mg(prefLock, LOCK_TYPE, OTHER_TIMEOUT, LOCK_CTX);
if (mg.getLockResult() != returnvalue::OK) {
sif::error << "SdCardManager::SdCardManager: Mutex lock failed" << std::endl; sif::error << "SdCardManager::SdCardManager: Mutex lock failed" << std::endl;
} }
uint8_t prefSdRaw = 0; uint8_t prefSdRaw = 0;
ReturnValue_t result = scratch::readNumber(scratch::PREFERED_SDC_KEY, prefSdRaw); result = scratch::readNumber(scratch::PREFERED_SDC_KEY, prefSdRaw);
result = mutex->unlockMutex();
if (result != RETURN_OK) {
sif::error << "SdCardManager::SdCardManager: Mutex unlock failed" << std::endl;
}
if (result != returnvalue::OK) { if (result != HasReturnvaluesIF::RETURN_OK) {
if (result == scratch::KEY_NOT_FOUND) { if (result == scratch::KEY_NOT_FOUND) {
sif::warning << "CoreController::sdCardInit: " sif::warning << "CoreController::sdCardInit: "
"Preferred SD card not set. Setting to 0" "Preferred SD card not set. Setting to 0"
<< std::endl; << std::endl;
scratch::writeNumber(scratch::PREFERED_SDC_KEY, static_cast<uint8_t>(sd::SdCard::SLOT_0)); setPreferredSdCard(sd::SdCard::SLOT_0);
prefSdRaw = sd::SdCard::SLOT_0; sdInfo.pref = sd::SdCard::SLOT_0;
} else { } else {
// Should not happen. // Should not happen.
// TODO: Maybe trigger event? // TODO: Maybe trigger event?
sif::error << "SdCardManager::SdCardManager: Reading preferred SD card from scratch" sif::error << "SdCardManager::SdCardManager: Reading preferred SD card from scratch"
"buffer failed" "buffer failed"
<< std::endl; << std::endl;
prefSdRaw = sd::SdCard::SLOT_0; sdInfo.pref = sd::SdCard::SLOT_0;
} }
} }
sdInfo.pref = static_cast<sd::SdCard>(prefSdRaw); sdInfo.pref = static_cast<sd::SdCard>(prefSdRaw);
@ -67,7 +65,7 @@ SdCardManager* SdCardManager::instance() {
ReturnValue_t SdCardManager::switchOnSdCard(sd::SdCard sdCard, bool doMountSdCard, ReturnValue_t SdCardManager::switchOnSdCard(sd::SdCard sdCard, bool doMountSdCard,
SdStatePair* statusPair) { SdStatePair* statusPair) {
ReturnValue_t result = returnvalue::OK; ReturnValue_t result = HasReturnvaluesIF::RETURN_OK;
if (doMountSdCard) { if (doMountSdCard) {
if (not blocking) { if (not blocking) {
sif::warning << "SdCardManager::switchOnSdCard: Two-step command but manager is" sif::warning << "SdCardManager::switchOnSdCard: Two-step command but manager is"
@ -82,7 +80,7 @@ ReturnValue_t SdCardManager::switchOnSdCard(sd::SdCard sdCard, bool doMountSdCar
sdStatusPtr = std::make_unique<SdStatePair>(); sdStatusPtr = std::make_unique<SdStatePair>();
statusPair = sdStatusPtr.get(); statusPair = sdStatusPtr.get();
result = getSdCardsStatus(*statusPair); result = getSdCardsStatus(*statusPair);
if (result != returnvalue::OK) { if (result != HasReturnvaluesIF::RETURN_OK) {
return result; return result;
} }
} }
@ -91,7 +89,7 @@ ReturnValue_t SdCardManager::switchOnSdCard(sd::SdCard sdCard, bool doMountSdCar
if (sdCard == sd::SdCard::BOTH) { if (sdCard == sd::SdCard::BOTH) {
sif::warning << "SdCardManager::switchOffSdCard: API does not allow sd::SdStatus::BOTH" sif::warning << "SdCardManager::switchOffSdCard: API does not allow sd::SdStatus::BOTH"
<< std::endl; << std::endl;
return returnvalue::FAILED; return HasReturnvaluesIF::RETURN_FAILED;
} }
sd::SdState currentState; sd::SdState currentState;
@ -115,18 +113,23 @@ ReturnValue_t SdCardManager::switchOnSdCard(sd::SdCard sdCard, bool doMountSdCar
} else if (currentState == sd::SdState::OFF) { } else if (currentState == sd::SdState::OFF) {
result = setSdCardState(sdCard, true); result = setSdCardState(sdCard, true);
} else { } else {
result = returnvalue::FAILED; result = HasReturnvaluesIF::RETURN_FAILED;
} }
if (result != returnvalue::OK or not doMountSdCard) { if (result != HasReturnvaluesIF::RETURN_OK or not doMountSdCard) {
return result; return result;
} }
return mountSdCard(sdCard); return mountSdCard(sdCard);
} }
ReturnValue_t SdCardManager::switchOffSdCard(sd::SdCard sdCard, SdStatePair& sdStates, ReturnValue_t SdCardManager::switchOffSdCard(sd::SdCard sdCard, bool doUnmountSdCard,
bool doUnmountSdCard) { SdStatePair* statusPair) {
std::pair<sd::SdState, sd::SdState> active;
ReturnValue_t result = getSdCardsStatus(active);
if (result != HasReturnvaluesIF::RETURN_OK) {
return result;
}
if (doUnmountSdCard) { if (doUnmountSdCard) {
if (not blocking) { if (not blocking) {
sif::warning << "SdCardManager::switchOffSdCard: Two-step command but manager is" sif::warning << "SdCardManager::switchOffSdCard: Two-step command but manager is"
@ -139,21 +142,21 @@ ReturnValue_t SdCardManager::switchOffSdCard(sd::SdCard sdCard, SdStatePair& sdS
if (sdCard == sd::SdCard::BOTH) { if (sdCard == sd::SdCard::BOTH) {
sif::warning << "SdCardManager::switchOffSdCard: API does not allow sd::SdStatus::BOTH" sif::warning << "SdCardManager::switchOffSdCard: API does not allow sd::SdStatus::BOTH"
<< std::endl; << std::endl;
return returnvalue::FAILED; return HasReturnvaluesIF::RETURN_FAILED;
} }
if (sdCard == sd::SdCard::SLOT_0) { if (sdCard == sd::SdCard::SLOT_0) {
if (sdStates.first == sd::SdState::OFF) { if (active.first == sd::SdState::OFF) {
return ALREADY_OFF; return ALREADY_OFF;
} }
} else if (sdCard == sd::SdCard::SLOT_1) { } else if (sdCard == sd::SdCard::SLOT_1) {
if (sdStates.second == sd::SdState::OFF) { if (active.second == sd::SdState::OFF) {
return ALREADY_OFF; return ALREADY_OFF;
} }
} }
if (doUnmountSdCard) { if (doUnmountSdCard) {
ReturnValue_t result = unmountSdCard(sdCard); result = unmountSdCard(sdCard);
if (result != returnvalue::OK) { if (result != HasReturnvaluesIF::RETURN_OK) {
return result; return result;
} }
} }
@ -184,40 +187,54 @@ ReturnValue_t SdCardManager::setSdCardState(sd::SdCard sdCard, bool on) {
command << "q7hw sd set " << sdstring << " " << statestring; command << "q7hw sd set " << sdstring << " " << statestring;
cmdExecutor.load(command.str(), blocking, printCmdOutput); cmdExecutor.load(command.str(), blocking, printCmdOutput);
ReturnValue_t result = cmdExecutor.execute(); ReturnValue_t result = cmdExecutor.execute();
if (result != returnvalue::OK) { if (blocking and result != HasReturnvaluesIF::RETURN_OK) {
utility::handleSystemError(cmdExecutor.getLastError(), "SdCardManager::setSdCardState"); utility::handleSystemError(cmdExecutor.getLastError(), "SdCardManager::setSdCardState");
} }
return result; return result;
} }
ReturnValue_t SdCardManager::getSdCardsStatus(SdStatePair& sdStates) { ReturnValue_t SdCardManager::getSdCardsStatus(SdStatePair& active) {
MutexGuard mg(sdLock, LOCK_TYPE, SD_LOCK_TIMEOUT, LOCK_CTX); using namespace std;
sdStates = this->sdStates; MutexGuard mg(mutex);
return returnvalue::OK; if (not filesystem::exists(SD_STATE_FILE)) {
return STATUS_FILE_NEXISTS;
}
// Now the file should exist in any case. Still check whether it exists.
fstream sdStatus(SD_STATE_FILE);
if (not sdStatus.good()) {
return STATUS_FILE_NEXISTS;
}
string line;
uint8_t idx = 0;
sd::SdCard currentSd = sd::SdCard::SLOT_0;
// Process status file line by line
while (std::getline(sdStatus, line)) {
processSdStatusLine(active, line, idx, currentSd);
}
return HasReturnvaluesIF::RETURN_OK;
} }
ReturnValue_t SdCardManager::mountSdCard(sd::SdCard sdCard) { ReturnValue_t SdCardManager::mountSdCard(sd::SdCard sdCard) {
using namespace std; using namespace std;
if (cmdExecutor.getCurrentState() == CommandExecutor::States::PENDING) { if (cmdExecutor.getCurrentState() == CommandExecutor::States::PENDING) {
sif::warning << "SdCardManager::mountSdCard: Command still pending" << std::endl;
return CommandExecutor::COMMAND_PENDING; return CommandExecutor::COMMAND_PENDING;
} }
if (sdCard == sd::SdCard::BOTH) { if (sdCard == sd::SdCard::BOTH) {
sif::warning << "SdCardManager::mountSdCard: API does not allow sd::SdStatus::BOTH" sif::warning << "SdCardManager::mountSdCard: API does not allow sd::SdStatus::BOTH"
<< std::endl; << std::endl;
return returnvalue::FAILED; return HasReturnvaluesIF::RETURN_FAILED;
} }
string mountDev; string mountDev;
string mountPoint; string mountPoint;
if (sdCard == sd::SdCard::SLOT_0) { if (sdCard == sd::SdCard::SLOT_0) {
mountDev = SD_0_DEV_NAME; mountDev = SD_0_DEV_NAME;
mountPoint = config::SD_0_MOUNT_POINT; mountPoint = SD_0_MOUNT_POINT;
} else if (sdCard == sd::SdCard::SLOT_1) { } else if (sdCard == sd::SdCard::SLOT_1) {
mountDev = SD_1_DEV_NAME; mountDev = SD_1_DEV_NAME;
mountPoint = config::SD_1_MOUNT_POINT; mountPoint = SD_1_MOUNT_POINT;
} }
std::error_code e; if (not filesystem::exists(mountDev)) {
if (not filesystem::exists(mountDev, e)) {
sif::warning << "SdCardManager::mountSdCard: Device file does not exists. Make sure to" sif::warning << "SdCardManager::mountSdCard: Device file does not exists. Make sure to"
" turn on the SD card" " turn on the SD card"
<< std::endl; << std::endl;
@ -230,7 +247,7 @@ ReturnValue_t SdCardManager::mountSdCard(sd::SdCard sdCard) {
string sdMountCommand = "mount " + mountDev + " " + mountPoint; string sdMountCommand = "mount " + mountDev + " " + mountPoint;
cmdExecutor.load(sdMountCommand, blocking, printCmdOutput); cmdExecutor.load(sdMountCommand, blocking, printCmdOutput);
ReturnValue_t result = cmdExecutor.execute(); ReturnValue_t result = cmdExecutor.execute();
if (blocking and result != returnvalue::OK) { if (blocking and result != HasReturnvaluesIF::RETURN_OK) {
utility::handleSystemError(cmdExecutor.getLastError(), "SdCardManager::mountSdCard"); utility::handleSystemError(cmdExecutor.getLastError(), "SdCardManager::mountSdCard");
} }
return result; return result;
@ -244,16 +261,15 @@ ReturnValue_t SdCardManager::unmountSdCard(sd::SdCard sdCard) {
if (sdCard == sd::SdCard::BOTH) { if (sdCard == sd::SdCard::BOTH) {
sif::warning << "SdCardManager::unmountSdCard: API does not allow sd::SdStatus::BOTH" sif::warning << "SdCardManager::unmountSdCard: API does not allow sd::SdStatus::BOTH"
<< std::endl; << std::endl;
return returnvalue::FAILED; return HasReturnvaluesIF::RETURN_FAILED;
} }
string mountPoint; string mountPoint;
if (sdCard == sd::SdCard::SLOT_0) { if (sdCard == sd::SdCard::SLOT_0) {
mountPoint = config::SD_0_MOUNT_POINT; mountPoint = SD_0_MOUNT_POINT;
} else if (sdCard == sd::SdCard::SLOT_1) { } else if (sdCard == sd::SdCard::SLOT_1) {
mountPoint = config::SD_1_MOUNT_POINT; mountPoint = SD_1_MOUNT_POINT;
} }
std::error_code e; if (not filesystem::exists(mountPoint)) {
if (not filesystem::exists(mountPoint, e)) {
sif::error << "SdCardManager::unmountSdCard: Default mount point " << mountPoint sif::error << "SdCardManager::unmountSdCard: Default mount point " << mountPoint
<< "does not exist" << std::endl; << "does not exist" << std::endl;
return UNMOUNT_ERROR; return UNMOUNT_ERROR;
@ -269,7 +285,7 @@ ReturnValue_t SdCardManager::unmountSdCard(sd::SdCard sdCard) {
} }
cmdExecutor.load(sdUnmountCommand, blocking, printCmdOutput); cmdExecutor.load(sdUnmountCommand, blocking, printCmdOutput);
ReturnValue_t result = cmdExecutor.execute(); ReturnValue_t result = cmdExecutor.execute();
if (blocking and result != returnvalue::OK) { if (blocking and result != HasReturnvaluesIF::RETURN_OK) {
utility::handleSystemError(cmdExecutor.getLastError(), "SdCardManager::unmountSdCard"); utility::handleSystemError(cmdExecutor.getLastError(), "SdCardManager::unmountSdCard");
} }
return result; return result;
@ -277,17 +293,23 @@ ReturnValue_t SdCardManager::unmountSdCard(sd::SdCard sdCard) {
ReturnValue_t SdCardManager::sanitizeState(SdStatePair* statusPair, sd::SdCard prefSdCard) { ReturnValue_t SdCardManager::sanitizeState(SdStatePair* statusPair, sd::SdCard prefSdCard) {
std::unique_ptr<SdStatePair> sdStatusPtr; std::unique_ptr<SdStatePair> sdStatusPtr;
ReturnValue_t result = returnvalue::OK; ReturnValue_t result = HasReturnvaluesIF::RETURN_OK;
// Enforce blocking operation for now. Be careful to reset it when returning prematurely! // Enforce blocking operation for now. Be careful to reset it when returning prematurely!
bool resetNonBlockingState = false; bool resetNonBlockingState = false;
if (not this->blocking) { if (not this->blocking) {
blocking = true; blocking = true;
resetNonBlockingState = true; resetNonBlockingState = true;
} }
if (statusPair == nullptr) { if (prefSdCard == sd::SdCard::NONE) {
return returnvalue::FAILED; result = getPreferredSdCard();
if (result != HasReturnvaluesIF::RETURN_OK) {
} }
}
if (statusPair == nullptr) {
sdStatusPtr = std::make_unique<SdStatePair>();
statusPair = sdStatusPtr.get();
getSdCardsStatus(*statusPair); getSdCardsStatus(*statusPair);
}
if (statusPair->first == sd::SdState::ON) { if (statusPair->first == sd::SdState::ON) {
result = mountSdCard(prefSdCard); result = mountSdCard(prefSdCard);
@ -305,7 +327,8 @@ void SdCardManager::resetState() {
currentOp = Operations::IDLE; currentOp = Operations::IDLE;
} }
void SdCardManager::processSdStatusLine(std::string& line, uint8_t& idx, sd::SdCard& currentSd) { void SdCardManager::processSdStatusLine(std::pair<sd::SdState, sd::SdState>& active,
std::string& line, uint8_t& idx, sd::SdCard& currentSd) {
using namespace std; using namespace std;
istringstream iss(line); istringstream iss(line);
string word; string word;
@ -326,26 +349,24 @@ void SdCardManager::processSdStatusLine(std::string& line, uint8_t& idx, sd::SdC
if (word == "on") { if (word == "on") {
if (currentSd == sd::SdCard::SLOT_0) { if (currentSd == sd::SdCard::SLOT_0) {
sdStates.first = sd::SdState::ON; active.first = sd::SdState::ON;
} else { } else {
sdStates.second = sd::SdState::ON; active.second = sd::SdState::ON;
} }
} else if (word == "off") { } else if (word == "off") {
MutexGuard mg(sdLock, LOCK_TYPE, SD_LOCK_TIMEOUT, LOCK_CTX);
if (currentSd == sd::SdCard::SLOT_0) { if (currentSd == sd::SdCard::SLOT_0) {
sdStates.first = sd::SdState::OFF; active.first = sd::SdState::OFF;
} else { } else {
sdStates.second = sd::SdState::OFF; active.second = sd::SdState::OFF;
} }
} }
} }
if (mountLine) { if (mountLine) {
MutexGuard mg(sdLock, LOCK_TYPE, SD_LOCK_TIMEOUT, LOCK_CTX);
if (currentSd == sd::SdCard::SLOT_0) { if (currentSd == sd::SdCard::SLOT_0) {
sdStates.first = sd::SdState::MOUNTED; active.first = sd::SdState::MOUNTED;
} else { } else {
sdStates.second = sd::SdState::MOUNTED; active.second = sd::SdState::MOUNTED;
} }
} }
@ -358,66 +379,46 @@ void SdCardManager::processSdStatusLine(std::string& line, uint8_t& idx, sd::SdC
idx++; idx++;
} }
std::optional<sd::SdCard> SdCardManager::getPreferredSdCard() const { sd::SdCard SdCardManager::getPreferredSdCard() const {
MutexGuard mg(prefLock, LOCK_TYPE, OTHER_TIMEOUT, LOCK_CTX); MutexGuard mg(mutex);
auto res = mg.getLockResult(); auto res = mg.getLockResult();
if (res != returnvalue::OK) { if (res != RETURN_OK) {
sif::error << "SdCardManager::getPreferredSdCard: Lock error" << std::endl; sif::error << "SdCardManager::getPreferredSdCard: Lock error" << std::endl;
} }
return sdInfo.pref; return sdInfo.pref;
} }
ReturnValue_t SdCardManager::setPreferredSdCard(sd::SdCard sdCard) { ReturnValue_t SdCardManager::setPreferredSdCard(sd::SdCard sdCard) {
MutexGuard mg(prefLock, LOCK_TYPE, OTHER_TIMEOUT, LOCK_CTX); MutexGuard mg(mutex);
if (sdCard == sd::SdCard::BOTH) { if (sdCard == sd::SdCard::BOTH) {
return returnvalue::FAILED; return HasReturnvaluesIF::RETURN_FAILED;
} }
sdInfo.pref = sdCard; sdInfo.pref = sdCard;
return scratch::writeNumber(scratch::PREFERED_SDC_KEY, static_cast<uint8_t>(sdCard)); return scratch::writeNumber(scratch::PREFERED_SDC_KEY, static_cast<uint8_t>(sdCard));
} }
ReturnValue_t SdCardManager::updateSdCardStateFile() { ReturnValue_t SdCardManager::updateSdCardStateFile() {
using namespace std;
if (cmdExecutor.getCurrentState() == CommandExecutor::States::PENDING) { if (cmdExecutor.getCurrentState() == CommandExecutor::States::PENDING) {
return CommandExecutor::COMMAND_PENDING; return CommandExecutor::COMMAND_PENDING;
} }
MutexGuard mg(mutex);
// Use q7hw utility and pipe the command output into the state file // Use q7hw utility and pipe the command output into the state file
std::string updateCmd = "q7hw sd info all > " + std::string(SD_STATE_FILE); std::string updateCmd = "q7hw sd info all > " + std::string(SD_STATE_FILE);
cmdExecutor.load(updateCmd, true, printCmdOutput); cmdExecutor.load(updateCmd, blocking, printCmdOutput);
ReturnValue_t result = cmdExecutor.execute(); ReturnValue_t result = cmdExecutor.execute();
if (result != returnvalue::OK) { if (blocking and result != HasReturnvaluesIF::RETURN_OK) {
utility::handleSystemError(cmdExecutor.getLastError(), "SdCardManager::mountSdCard"); utility::handleSystemError(cmdExecutor.getLastError(), "SdCardManager::mountSdCard");
} }
return result;
std::error_code e;
if (not filesystem::exists(SD_STATE_FILE, e)) {
return STATUS_FILE_NEXISTS;
}
// Now the file should exist in any case. Still check whether it exists.
fstream sdStatus(SD_STATE_FILE);
if (not sdStatus.good()) {
return STATUS_FILE_NEXISTS;
}
string line;
uint8_t idx = 0;
sd::SdCard currentSd = sd::SdCard::SLOT_0;
// Process status file line by line
while (std::getline(sdStatus, line)) {
processSdStatusLine(line, idx, currentSd);
}
if (sdStates.first != sd::SdState::MOUNTED && sdStates.second != sd::SdState::MOUNTED) {
sdCardActive = false;
}
return returnvalue::OK;
} }
const char* SdCardManager::getCurrentMountPrefix() const { std::string SdCardManager::getCurrentMountPrefix() const {
MutexGuard mg(defaultLock, LOCK_TYPE, OTHER_TIMEOUT, LOCK_CTX); MutexGuard mg(mutex);
if (currentPrefix.has_value()) { if (sdInfo.active == sd::SdCard::SLOT_0) {
return currentPrefix.value().c_str(); return SD_0_MOUNT_POINT;
} else {
return SD_1_MOUNT_POINT;
} }
return nullptr;
} }
SdCardManager::OpStatus SdCardManager::checkCurrentOp(Operations& currentOp) { SdCardManager::OpStatus SdCardManager::checkCurrentOp(Operations& currentOp) {
@ -447,10 +448,10 @@ SdCardManager::OpStatus SdCardManager::checkCurrentOp(Operations& currentOp) {
case (CommandExecutor::EXECUTION_FINISHED): { case (CommandExecutor::EXECUTION_FINISHED): {
return OpStatus::SUCCESS; return OpStatus::SUCCESS;
} }
case (returnvalue::OK): { case (HasReturnvaluesIF::RETURN_OK): {
return OpStatus::ONGOING; return OpStatus::ONGOING;
} }
case (returnvalue::FAILED): { case (HasReturnvaluesIF::RETURN_FAILED): {
return OpStatus::FAIL; return OpStatus::FAIL;
} }
default: { default: {
@ -464,39 +465,28 @@ void SdCardManager::setBlocking(bool blocking) { this->blocking = blocking; }
void SdCardManager::setPrintCommandOutput(bool print) { this->printCmdOutput = print; } void SdCardManager::setPrintCommandOutput(bool print) { this->printCmdOutput = print; }
bool SdCardManager::isSdCardUsable(std::optional<sd::SdCard> sdCard) { bool SdCardManager::isSdCardMounted(sd::SdCard sdCard) {
{ SdCardManager::SdStatePair active;
MutexGuard mg(defaultLock, LOCK_TYPE, OTHER_TIMEOUT, LOCK_CTX); ReturnValue_t result = this->getSdCardsStatus(active);
if (markedUnusable) {
return false;
}
}
MutexGuard mg(sdLock, LOCK_TYPE, SD_LOCK_TIMEOUT, LOCK_CTX); if (result != HasReturnvaluesIF::RETURN_OK) {
if (not sdCard) { sif::debug << "SdCardManager::isSdCardMounted: Failed to get SD card active state";
if (sdStates.first == sd::MOUNTED or sdStates.second == sd::MOUNTED) {
return true;
}
return false; return false;
} }
if (sdCard == sd::SLOT_0) { if (sdCard == sd::SLOT_0) {
if (sdStates.first == sd::MOUNTED) { if (active.first == sd::MOUNTED) {
return true; return true;
} else { } else {
return false; return false;
} }
} } else if (sdCard == sd::SLOT_1) {
if (sdCard == sd::SLOT_1) { if (active.second == sd::MOUNTED) {
if (sdStates.second == sd::MOUNTED) {
return true; return true;
} else { } else {
return false; return false;
} }
} } else {
if (sdCard == sd::BOTH) { sif::debug << "SdCardManager::isSdCardMounted: Unknown SD card specified" << std::endl;
if (sdStates.first == sd::MOUNTED && sdStates.second == sd::MOUNTED) {
return true;
}
} }
return false; return false;
} }
@ -504,34 +494,41 @@ bool SdCardManager::isSdCardUsable(std::optional<sd::SdCard> sdCard) {
ReturnValue_t SdCardManager::isSdCardMountedReadOnly(sd::SdCard sdcard, bool& readOnly) { ReturnValue_t SdCardManager::isSdCardMountedReadOnly(sd::SdCard sdcard, bool& readOnly) {
std::ostringstream command; std::ostringstream command;
if (sdcard == sd::SdCard::SLOT_0) { if (sdcard == sd::SdCard::SLOT_0) {
command << "grep -q '" << config::SD_0_MOUNT_POINT << " ext4 rw,' /proc/mounts"; command << "grep -q '" << SD_0_MOUNT_POINT << " vfat ro,' /proc/mounts";
} else if (sdcard == sd::SdCard::SLOT_1) {
command << "grep -q '" << config::SD_1_MOUNT_POINT << " ext4 rw,' /proc/mounts";
} else { } else {
return returnvalue::FAILED; command << "grep -q '" << SD_1_MOUNT_POINT << " vfat ro,' /proc/mounts";
} }
ReturnValue_t result = cmdExecutor.load(command.str(), true, false); ReturnValue_t result = cmdExecutor.load(command.str(), true, false);
if (result != returnvalue::OK) { if (result != HasReturnvaluesIF::RETURN_OK) {
return result; return result;
} }
result = cmdExecutor.execute(); result = cmdExecutor.execute();
if (result == returnvalue::OK) { if (result != HasReturnvaluesIF::RETURN_OK) {
int exitStatus = cmdExecutor.getLastError();
if (exitStatus == 1) {
readOnly = false; readOnly = false;
return RETURN_OK;
}
return result; return result;
} }
auto& readVec = cmdExecutor.getReadVector();
size_t readLen = strnlen(readVec.data(), readVec.size());
if (readLen == 0) {
readOnly = false;
}
readOnly = true; readOnly = true;
return returnvalue::OK; return HasReturnvaluesIF::RETURN_OK;
} }
ReturnValue_t SdCardManager::remountReadWrite(sd::SdCard sdcard) { ReturnValue_t SdCardManager::remountReadWrite(sd::SdCard sdcard) {
std::ostringstream command; std::ostringstream command;
if (sdcard == sd::SdCard::SLOT_0) { if (sdcard == sd::SdCard::SLOT_0) {
command << "mount -o remount,rw " << SD_0_DEV_NAME << " " << config::SD_0_MOUNT_POINT; command << "mount -o remount,rw " << SD_0_DEV_NAME << " " << SD_0_MOUNT_POINT;
} else { } else {
command << "mount -o remount,rw " << SD_1_DEV_NAME << " " << config::SD_1_MOUNT_POINT; command << "mount -o remount,rw " << SD_1_DEV_NAME << " " << SD_1_MOUNT_POINT;
} }
ReturnValue_t result = cmdExecutor.load(command.str(), true, false); ReturnValue_t result = cmdExecutor.load(command.str(), true, false);
if (result != returnvalue::OK) { if (result != HasReturnvaluesIF::RETURN_OK) {
return result; return result;
} }
return cmdExecutor.execute(); return cmdExecutor.execute();
@ -545,40 +542,16 @@ ReturnValue_t SdCardManager::performFsck(sd::SdCard sdcard, bool printOutput, in
command << "fsck -y " << SD_1_DEV_NAME; command << "fsck -y " << SD_1_DEV_NAME;
} }
ReturnValue_t result = cmdExecutor.load(command.str(), true, printOutput); ReturnValue_t result = cmdExecutor.load(command.str(), true, printOutput);
if (result != returnvalue::OK) { if (result != HasReturnvaluesIF::RETURN_OK) {
return result; return result;
} }
result = cmdExecutor.execute(); result = cmdExecutor.execute();
if (result != returnvalue::OK) { if (result != HasReturnvaluesIF::RETURN_OK) {
linuxError = cmdExecutor.getLastError(); linuxError = cmdExecutor.getLastError();
} }
return result; return result;
} }
void SdCardManager::setActiveSdCard(sd::SdCard sdCard) { void SdCardManager::setActiveSdCard(sd::SdCard sdCard) { sdInfo.active = sdCard; }
MutexGuard mg(defaultLock, LOCK_TYPE, OTHER_TIMEOUT, LOCK_CTX);
sdInfo.active = sdCard;
if (sdInfo.active == sd::SdCard::SLOT_0) {
currentPrefix = config::SD_0_MOUNT_POINT;
} else {
currentPrefix = config::SD_1_MOUNT_POINT;
}
}
std::optional<sd::SdCard> SdCardManager::getActiveSdCard() const { sd::SdCard SdCardManager::getActiveSdCard() const { return sdInfo.active; }
MutexGuard mg(defaultLock, LOCK_TYPE, OTHER_TIMEOUT, LOCK_CTX);
if (markedUnusable) {
return std::nullopt;
}
return sdInfo.active;
}
void SdCardManager::markUnusable() {
MutexGuard mg(defaultLock, LOCK_TYPE, OTHER_TIMEOUT, LOCK_CTX);
markedUnusable = true;
}
void SdCardManager::markUsable() {
MutexGuard mg(defaultLock, LOCK_TYPE, OTHER_TIMEOUT, LOCK_CTX);
markedUnusable = false;
}

View File

@ -12,7 +12,7 @@
#include "events/subsystemIdRanges.h" #include "events/subsystemIdRanges.h"
#include "fsfw/events/Event.h" #include "fsfw/events/Event.h"
#include "fsfw/returnvalues/returnvalue.h" #include "fsfw/returnvalues/HasReturnvaluesIF.h"
#include "fsfw_hal/linux/CommandExecutor.h" #include "fsfw_hal/linux/CommandExecutor.h"
#include "mission/memory/SdCardMountedIF.h" #include "mission/memory/SdCardMountedIF.h"
#include "mission/memory/definitions.h" #include "mission/memory/definitions.h"
@ -24,8 +24,8 @@ class MutexIF;
* @brief Manages handling of SD cards like switching them on or off or getting the current * @brief Manages handling of SD cards like switching them on or off or getting the current
* state * state
*/ */
class SdCardManager : public SystemObject, public SdCardMountedIF { class SdCardManager : public SystemObject, public HasReturnvaluesIF, public SdCardMountedIF {
friend class CoreController; friend class SdCardAccess;
public: public:
using mountInitCb = ReturnValue_t (*)(void* args); using mountInitCb = ReturnValue_t (*)(void* args);
@ -44,17 +44,22 @@ class SdCardManager : public SystemObject, public SdCardMountedIF {
static constexpr uint8_t INTERFACE_ID = CLASS_ID::SD_CARD_MANAGER; static constexpr uint8_t INTERFACE_ID = CLASS_ID::SD_CARD_MANAGER;
static constexpr ReturnValue_t OP_ONGOING = returnvalue::makeCode(INTERFACE_ID, 0); static constexpr ReturnValue_t OP_ONGOING = HasReturnvaluesIF::makeReturnCode(INTERFACE_ID, 0);
static constexpr ReturnValue_t ALREADY_ON = returnvalue::makeCode(INTERFACE_ID, 1); static constexpr ReturnValue_t ALREADY_ON = HasReturnvaluesIF::makeReturnCode(INTERFACE_ID, 1);
static constexpr ReturnValue_t ALREADY_MOUNTED = returnvalue::makeCode(INTERFACE_ID, 2); static constexpr ReturnValue_t ALREADY_MOUNTED =
static constexpr ReturnValue_t ALREADY_OFF = returnvalue::makeCode(INTERFACE_ID, 3); HasReturnvaluesIF::makeReturnCode(INTERFACE_ID, 2);
static constexpr ReturnValue_t STATUS_FILE_NEXISTS = returnvalue::makeCode(INTERFACE_ID, 10); static constexpr ReturnValue_t ALREADY_OFF = HasReturnvaluesIF::makeReturnCode(INTERFACE_ID, 3);
static constexpr ReturnValue_t STATUS_FILE_NEXISTS =
HasReturnvaluesIF::makeReturnCode(INTERFACE_ID, 10);
static constexpr ReturnValue_t STATUS_FILE_FORMAT_INVALID = static constexpr ReturnValue_t STATUS_FILE_FORMAT_INVALID =
returnvalue::makeCode(INTERFACE_ID, 11); HasReturnvaluesIF::makeReturnCode(INTERFACE_ID, 11);
static constexpr ReturnValue_t MOUNT_ERROR = returnvalue::makeCode(INTERFACE_ID, 12); static constexpr ReturnValue_t MOUNT_ERROR = HasReturnvaluesIF::makeReturnCode(INTERFACE_ID, 12);
static constexpr ReturnValue_t UNMOUNT_ERROR = returnvalue::makeCode(INTERFACE_ID, 13); static constexpr ReturnValue_t UNMOUNT_ERROR =
static constexpr ReturnValue_t SYSTEM_CALL_ERROR = returnvalue::makeCode(INTERFACE_ID, 14); HasReturnvaluesIF::makeReturnCode(INTERFACE_ID, 13);
static constexpr ReturnValue_t POPEN_CALL_ERROR = returnvalue::makeCode(INTERFACE_ID, 15); static constexpr ReturnValue_t SYSTEM_CALL_ERROR =
HasReturnvaluesIF::makeReturnCode(INTERFACE_ID, 14);
static constexpr ReturnValue_t POPEN_CALL_ERROR =
HasReturnvaluesIF::makeReturnCode(INTERFACE_ID, 15);
static constexpr uint8_t SUBSYSTEM_ID = SUBSYSTEM_ID::FILE_SYSTEM; static constexpr uint8_t SUBSYSTEM_ID = SUBSYSTEM_ID::FILE_SYSTEM;
@ -64,7 +69,8 @@ class SdCardManager : public SystemObject, public SdCardMountedIF {
// C++17 does not support constexpr std::string yet // C++17 does not support constexpr std::string yet
static constexpr char SD_0_DEV_NAME[] = "/dev/mmcblk0p1"; static constexpr char SD_0_DEV_NAME[] = "/dev/mmcblk0p1";
static constexpr char SD_1_DEV_NAME[] = "/dev/mmcblk1p1"; static constexpr char SD_1_DEV_NAME[] = "/dev/mmcblk1p1";
static constexpr char SD_0_MOUNT_POINT[] = "/mnt/sd0";
static constexpr char SD_1_MOUNT_POINT[] = "/mnt/sd1";
static constexpr char SD_STATE_FILE[] = "/tmp/sd_status.txt"; static constexpr char SD_STATE_FILE[] = "/tmp/sd_status.txt";
virtual ~SdCardManager(); virtual ~SdCardManager();
@ -91,7 +97,7 @@ class SdCardManager : public SystemObject, public SdCardMountedIF {
* @param sdCard * @param sdCard
* @return * @return
*/ */
std::optional<sd::SdCard> getPreferredSdCard() const override; sd::SdCard getPreferredSdCard() const override;
/** /**
* Switch on the specified SD card. * Switch on the specified SD card.
@ -99,7 +105,7 @@ class SdCardManager : public SystemObject, public SdCardMountedIF {
* @param doMountSdCard Mount the SD card after switching it on, which is necessary * @param doMountSdCard Mount the SD card after switching it on, which is necessary
* to use it * to use it
* @param statusPair If the status pair is already available, it can be passed here * @param statusPair If the status pair is already available, it can be passed here
* @return - returnvalue::OK on success, ALREADY_ON if it is already on, * @return - RETURN_OK on success, ALREADY_ON if it is already on,
* SYSTEM_CALL_ERROR on system error * SYSTEM_CALL_ERROR on system error
*/ */
ReturnValue_t switchOnSdCard(sd::SdCard sdCard, bool doMountSdCard = true, ReturnValue_t switchOnSdCard(sd::SdCard sdCard, bool doMountSdCard = true,
@ -111,10 +117,21 @@ class SdCardManager : public SystemObject, public SdCardMountedIF {
* @param doUnmountSdCard Unmount the SD card before switching the card off, which makes * @param doUnmountSdCard Unmount the SD card before switching the card off, which makes
* the operation safer * the operation safer
* @param statusPair If the status pair is already available, it can be passed here * @param statusPair If the status pair is already available, it can be passed here
* @return - returnvalue::OK on success, ALREADY_ON if it is already on, * @return - RETURN_OK on success, ALREADY_ON if it is already on,
* SYSTEM_CALL_ERROR on system error * SYSTEM_CALL_ERROR on system error
*/ */
ReturnValue_t switchOffSdCard(sd::SdCard sdCard, SdStatePair& sdStates, bool doUnmountSdCard); ReturnValue_t switchOffSdCard(sd::SdCard sdCard, bool doUnmountSdCard = true,
SdStatePair* statusPair = nullptr);
/**
* Update the state file or creates one if it does not exist. You need to call this
* function before calling #sdCardActive
* @return
* - RETURN_OK if the state file was updated successfully
* - CommandExecutor::COMMAND_PENDING: Non-blocking command is pending
* - RETURN_FAILED: blocking command failed
*/
ReturnValue_t updateSdCardStateFile();
/** /**
* Get the state of the SD cards. If the state file does not exist, this function will * Get the state of the SD cards. If the state file does not exist, this function will
@ -122,7 +139,7 @@ class SdCardManager : public SystemObject, public SdCardMountedIF {
* the status of the SD cards and set the field of the provided boolean pair. * the status of the SD cards and set the field of the provided boolean pair.
* @param active Pair of booleans, where the first entry is the state of the first SD card * @param active Pair of booleans, where the first entry is the state of the first SD card
* and the second one the state of the second SD card * and the second one the state of the second SD card
* @return - returnvalue::OK if the state was read successfully * @return - RETURN_OK if the state was read successfully
* - STATUS_FILE_FORMAT_INVALID if there was an issue with the state file. The user * - STATUS_FILE_FORMAT_INVALID if there was an issue with the state file. The user
* should call #updateSdCardStateFile again in that case * should call #updateSdCardStateFile again in that case
* - STATUS_FILE_NEXISTS if the status file does not exist * - STATUS_FILE_NEXISTS if the status file does not exist
@ -147,7 +164,7 @@ class SdCardManager : public SystemObject, public SdCardMountedIF {
* mounted * mounted
* @return * @return
*/ */
std::optional<sd::SdCard> getActiveSdCard() const override; sd::SdCard getActiveSdCard() const override;
/** /**
* Unmount the specified SD card. This is recommended before switching it off. The SD card * Unmount the specified SD card. This is recommended before switching it off. The SD card
@ -176,7 +193,7 @@ class SdCardManager : public SystemObject, public SdCardMountedIF {
* @param prefSdCardPtr * @param prefSdCardPtr
* @return * @return
*/ */
const char* getCurrentMountPrefix() const override; std::string getCurrentMountPrefix() const override;
OpStatus checkCurrentOp(Operations& currentOp); OpStatus checkCurrentOp(Operations& currentOp);
@ -195,7 +212,7 @@ class SdCardManager : public SystemObject, public SdCardMountedIF {
* *
* @return true if mounted, otherwise false * @return true if mounted, otherwise false
*/ */
bool isSdCardUsable(std::optional<sd::SdCard> sdCard) override; bool isSdCardMounted(sd::SdCard sdCard) override;
ReturnValue_t isSdCardMountedReadOnly(sd::SdCard sdcard, bool& readOnly); ReturnValue_t isSdCardMountedReadOnly(sd::SdCard sdcard, bool& readOnly);
@ -203,42 +220,21 @@ class SdCardManager : public SystemObject, public SdCardMountedIF {
ReturnValue_t performFsck(sd::SdCard sdcard, bool printOutput, int& linuxError); ReturnValue_t performFsck(sd::SdCard sdcard, bool printOutput, int& linuxError);
void markUnusable();
void markUsable();
private: private:
CommandExecutor cmdExecutor; CommandExecutor cmdExecutor;
SdStatePair sdStates;
Operations currentOp = Operations::IDLE; Operations currentOp = Operations::IDLE;
bool blocking = false; bool blocking = false;
bool sdCardActive = true;
bool printCmdOutput = true; bool printCmdOutput = true;
bool markedUnusable = false; MutexIF* mutex = nullptr;
MutexIF* sdLock = nullptr;
MutexIF* prefLock = nullptr;
MutexIF* defaultLock = nullptr;
static constexpr MutexIF::TimeoutType LOCK_TYPE = MutexIF::TimeoutType::WAITING;
static constexpr uint32_t SD_LOCK_TIMEOUT = 100;
static constexpr uint32_t OTHER_TIMEOUT = 20;
static constexpr char LOCK_CTX[] = "SdCardManager";
SdCardManager(); SdCardManager();
/**
* Update the state file or creates one if it does not exist. You need to call this
* function before calling #sdCardActive
* @return
* - returnvalue::OK if the state file was updated successfully
* - CommandExecutor::COMMAND_PENDING: Non-blocking command is pending
* - returnvalue::FAILED: blocking command failed
*/
ReturnValue_t updateSdCardStateFile();
ReturnValue_t setSdCardState(sd::SdCard sdCard, bool on); ReturnValue_t setSdCardState(sd::SdCard sdCard, bool on);
void processSdStatusLine(std::string& line, uint8_t& idx, sd::SdCard& currentSd); void processSdStatusLine(SdStatePair& active, std::string& line, uint8_t& idx,
sd::SdCard& currentSd);
std::optional<std::string> currentPrefix; std::string currentPrefix;
static SdCardManager* INSTANCE; static SdCardManager* INSTANCE;
}; };

View File

@ -1,28 +1,28 @@
#include "scratchApi.h" #include "scratchApi.h"
ReturnValue_t scratch::writeString(std::string name, std::string string) { ReturnValue_t scratch::writeString(std::string name, std::string string) {
std::ostringstream oss("xsc_scratch write ", std::ostringstream::ate); std::ostringstream oss;
oss << name << " \"" << string << "\""; oss << "xsc_scratch write " << name << " \"" << string << "\"";
int result = std::system(oss.str().c_str()); int result = std::system(oss.str().c_str());
if (result != 0) { if (result != 0) {
utility::handleSystemError(result, "scratch::writeString"); utility::handleSystemError(result, "scratch::writeString");
return returnvalue::FAILED; return HasReturnvaluesIF::RETURN_FAILED;
} }
return returnvalue::OK; return HasReturnvaluesIF::RETURN_OK;
} }
ReturnValue_t scratch::readString(std::string key, std::string &string) { ReturnValue_t scratch::readString(std::string key, std::string &string) {
std::ifstream file; std::ifstream file;
std::string filename; std::string filename;
ReturnValue_t result = readToFile(key, file, filename); ReturnValue_t result = readToFile(key, file, filename);
if (result != returnvalue::OK) { if (result != HasReturnvaluesIF::RETURN_OK) {
return result; return result;
} }
std::string line; std::string line;
if (not std::getline(file, line)) { if (not std::getline(file, line)) {
std::remove(filename.c_str()); std::remove(filename.c_str());
return returnvalue::FAILED; return HasReturnvaluesIF::RETURN_FAILED;
} }
size_t pos = line.find("="); size_t pos = line.find("=");
@ -35,16 +35,16 @@ ReturnValue_t scratch::readString(std::string key, std::string &string) {
return KEY_NOT_FOUND; return KEY_NOT_FOUND;
} }
string = line.substr(pos + 1); string = line.substr(pos + 1);
return returnvalue::OK; return HasReturnvaluesIF::RETURN_OK;
} }
ReturnValue_t scratch::clearValue(std::string key) { ReturnValue_t scratch::clearValue(std::string key) {
std::ostringstream oss("xsc_scratch clear ", std::ostringstream::ate); std::ostringstream oss;
oss << key; oss << "xsc_scratch clear " << key;
int result = std::system(oss.str().c_str()); int result = std::system(oss.str().c_str());
if (result != 0) { if (result != 0) {
utility::handleSystemError(result, "scratch::clearValue"); utility::handleSystemError(result, "scratch::clearValue");
return returnvalue::FAILED; return HasReturnvaluesIF::RETURN_FAILED;
} }
return returnvalue::OK; return HasReturnvaluesIF::RETURN_OK;
} }

View File

@ -7,7 +7,7 @@
#include <sstream> #include <sstream>
#include <type_traits> #include <type_traits>
#include "fsfw/returnvalues/returnvalue.h" #include "fsfw/returnvalues/HasReturnvaluesIF.h"
#include "fsfw/serviceinterface/ServiceInterface.h" #include "fsfw/serviceinterface/ServiceInterface.h"
#include "linux/utility/utility.h" #include "linux/utility/utility.h"
#include "returnvalues/classIds.h" #include "returnvalues/classIds.h"
@ -21,7 +21,7 @@ static constexpr char PREFERED_SDC_KEY[] = "PREFSD";
static constexpr char ALLOC_FAILURE_COUNT[] = "ALLOCERR"; static constexpr char ALLOC_FAILURE_COUNT[] = "ALLOCERR";
static constexpr uint8_t INTERFACE_ID = CLASS_ID::SCRATCH_BUFFER; static constexpr uint8_t INTERFACE_ID = CLASS_ID::SCRATCH_BUFFER;
static constexpr ReturnValue_t KEY_NOT_FOUND = returnvalue::makeCode(INTERFACE_ID, 0); static constexpr ReturnValue_t KEY_NOT_FOUND = HasReturnvaluesIF::makeReturnCode(INTERFACE_ID, 0);
ReturnValue_t clearValue(std::string key); ReturnValue_t clearValue(std::string key);
@ -83,34 +83,34 @@ ReturnValue_t readToFile(std::string name, std::ifstream& file, std::string& fil
} else { } else {
utility::handleSystemError(result, "scratch::readToFile"); utility::handleSystemError(result, "scratch::readToFile");
std::remove(filename.c_str()); std::remove(filename.c_str());
return returnvalue::FAILED; return HasReturnvaluesIF::RETURN_FAILED;
} }
} }
file.open(filename); file.open(filename);
return returnvalue::OK; return HasReturnvaluesIF::RETURN_OK;
} }
} // End of anonymous namespace } // End of anonymous namespace
template <typename T, class = typename std::enable_if<std::is_integral<T>::value>::type> template <typename T, class>
inline ReturnValue_t writeNumber(std::string key, T num) noexcept { inline ReturnValue_t writeNumber(std::string key, T num) noexcept {
std::ostringstream oss("xsc_scratch write ", std::ostringstream::ate); std::ostringstream oss;
oss << key << " " << std::to_string(num); oss << "xsc_scratch write " << key << " " << std::to_string(num);
int result = std::system(oss.str().c_str()); int result = std::system(oss.str().c_str());
if (result != 0) { if (result != 0) {
utility::handleSystemError(result, "scratch::writeNumber"); utility::handleSystemError(result, "scratch::writeNumber");
return returnvalue::FAILED; return HasReturnvaluesIF::RETURN_FAILED;
} }
return returnvalue::OK; return HasReturnvaluesIF::RETURN_OK;
} }
template <typename T, class = typename std::enable_if<std::is_integral<T>::value>::type> template <typename T, class>
inline ReturnValue_t readNumber(std::string key, T& num) noexcept { inline ReturnValue_t readNumber(std::string key, T& num) noexcept {
using namespace std; using namespace std;
ifstream file; ifstream file;
std::string filename; std::string filename;
ReturnValue_t result = readToFile(key, file, filename); ReturnValue_t result = readToFile(key, file, filename);
if (result != returnvalue::OK) { if (result != HasReturnvaluesIF::RETURN_OK) {
std::remove(filename.c_str()); std::remove(filename.c_str());
return result; return result;
} }
@ -118,7 +118,7 @@ inline ReturnValue_t readNumber(std::string key, T& num) noexcept {
string line; string line;
if (not std::getline(file, line)) { if (not std::getline(file, line)) {
std::remove(filename.c_str()); std::remove(filename.c_str());
return returnvalue::FAILED; return HasReturnvaluesIF::RETURN_FAILED;
} }
size_t pos = line.find("="); size_t pos = line.find("=");
@ -138,7 +138,7 @@ inline ReturnValue_t readNumber(std::string key, T& num) noexcept {
} }
std::remove(filename.c_str()); std::remove(filename.c_str());
return returnvalue::OK; return HasReturnvaluesIF::RETURN_OK;
} }
} // namespace scratch } // namespace scratch

View File

@ -1,97 +0,0 @@
#ifndef BSP_Q7S_OBJECTFACTORY_H_
#define BSP_Q7S_OBJECTFACTORY_H_
#include <fsfw/returnvalues/returnvalue.h>
#include <fsfw_hal/linux/spi/SpiComIF.h>
#include <mission/acs/gyroAdisHelpers.h>
#include <mission/com/CcsdsIpCoreHandler.h>
#include <mission/com/PersistentLogTmStoreTask.h>
#include <mission/genericFactory.h>
#include <mission/system/objects/Stack5VHandler.h>
#include <mission/tcs/HeaterHandler.h>
#include <mission/tmtc/CfdpTmFunnel.h>
#include <mission/tmtc/PusTmFunnel.h>
#include <atomic>
#include <string>
#include "bsp_q7s/fs/SdCardManager.h"
class LinuxLibgpioIF;
class SerialComIF;
class SpiComIF;
class I2cComIF;
class PowerSwitchIF;
class HealthTableIF;
class AcsBoardAssembly;
class GpioIF;
extern std::atomic_bool PTME_LOCKED;
namespace ObjectFactory {
struct CcsdsComponentArgs {
CcsdsComponentArgs(LinuxLibgpioIF& gpioIF, StorageManagerIF& ipcStore, StorageManagerIF& tmStore,
PersistentTmStores& stores, PusTmFunnel& pusFunnel, CfdpTmFunnel& cfdpFunnel,
CcsdsIpCoreHandler** ipCoreHandler, uint32_t pdecCfgMemBaseAddr,
uint32_t pdecRamBaseAddr)
: gpioComIF(gpioIF),
ipcStore(ipcStore),
tmStore(tmStore),
stores(stores),
pusFunnel(pusFunnel),
cfdpFunnel(cfdpFunnel),
ipCoreHandler(ipCoreHandler),
pdecCfgMemBaseAddr(pdecCfgMemBaseAddr),
pdecRamBaseAddr(pdecRamBaseAddr) {}
LinuxLibgpioIF& gpioComIF;
StorageManagerIF& ipcStore;
StorageManagerIF& tmStore;
PersistentTmStores& stores;
PusTmFunnel& pusFunnel;
CfdpTmFunnel& cfdpFunnel;
CcsdsIpCoreHandler** ipCoreHandler;
uint32_t pdecCfgMemBaseAddr;
uint32_t pdecRamBaseAddr;
MessageQueueId_t normalLiveTmDest = MessageQueueIF::NO_QUEUE;
MessageQueueId_t cfdpLiveTmDest = MessageQueueIF::NO_QUEUE;
};
void setStatics();
void produce(void* args);
void createCommunicationInterfaces(LinuxLibgpioIF** gpioComIF, SerialComIF** uartComIF,
SpiComIF** spiMainComIF, I2cComIF** i2cComIF);
void createPcduComponents(LinuxLibgpioIF* gpioComIF, PowerSwitchIF** pwrSwitcher,
bool enableHkSets);
void createPlPcduComponents(LinuxLibgpioIF* gpioComIF, SpiComIF* spiComIF,
PowerSwitchIF* pwrSwitcher, Stack5VHandler& stackHandler);
void createTmpComponents(std::vector<std::pair<object_id_t, address_t>> tmpDevsToAdd);
void createRadSensorChipSelect(LinuxLibgpioIF* gpioIF);
ReturnValue_t createRadSensorComponent(LinuxLibgpioIF* gpioComIF, Stack5VHandler& handler);
void createAcsBoardGpios(GpioCookie& cookie);
void createAcsBoardComponents(SpiComIF& spiComIF, LinuxLibgpioIF* gpioComIF, SerialComIF* uartComIF,
PowerSwitchIF& pwrSwitcher, bool enableHkSets,
adis1650x::Type adisType);
void createHeaterComponents(GpioIF* gpioIF, PowerSwitchIF* pwrSwitcher, HealthTableIF* healthTable,
HeaterHandler*& heaterHandler);
void createImtqComponents(PowerSwitchIF* pwrSwitcher, bool enableHkSets, const char* i2cDev);
void createBpxBatteryComponent(bool enableHkSets, const char* i2cDev);
void createStrComponents(PowerSwitchIF* pwrSwitcher, SdCardManager& sdcMan);
void createSolarArrayDeploymentComponents(PowerSwitchIF& pwrSwitcher, GpioIF& gpioIF);
void createSyrlinksComponents(PowerSwitchIF* pwrSwitcher);
void createPayloadComponents(LinuxLibgpioIF* gpioComIF, PowerSwitchIF& pwrSwitcher);
void createReactionWheelComponents(LinuxLibgpioIF* gpioComIF, PowerSwitchIF* pwrSwitcher);
ReturnValue_t createCcsdsIpComponentsWrapper(CcsdsComponentArgs& args);
ReturnValue_t createCcsdsComponents(CcsdsComponentArgs& args);
ReturnValue_t readFirmwareVersion();
void createMiscComponents();
void createTestComponents(LinuxLibgpioIF* gpioComIF);
void createPlI2cResetGpio(LinuxLibgpioIF* gpioComIF);
void testAcsBrdAss(AcsBoardAssembly* assAss);
}; // namespace ObjectFactory
#endif /* BSP_Q7S_OBJECTFACTORY_H_ */

View File

@ -1,35 +1,23 @@
#include "obsw.h" #include "obsw.h"
#include <pwd.h>
#include <sys/types.h>
#include <unistd.h>
#include <filesystem> #include <filesystem>
#include <fstream>
#include <iostream> #include <iostream>
#include "OBSWConfig.h" #include "OBSWConfig.h"
#include "bsp_q7s/core/WatchdogHandler.h"
#include "commonConfig.h" #include "commonConfig.h"
#include "core/InitMission.h"
#include "fsfw/tasks/TaskFactory.h" #include "fsfw/tasks/TaskFactory.h"
#include "fsfw/version.h" #include "fsfw/version.h"
#include "mission/acs/defs.h"
#include "mission/com/defs.h"
#include "mission/system/systemTree.h"
#include "q7sConfig.h" #include "q7sConfig.h"
#include "scheduling.h"
#include "watchdog/definitions.h" #include "watchdog/definitions.h"
static constexpr int OBSW_ALREADY_RUNNING = -2; static int OBSW_ALREADY_RUNNING = -2;
#if OBSW_Q7S_EM == 0 #if OBSW_Q7S_EM == 0
static const char* DEV_STRING = "Xiphos Q7S FM"; static const char* DEV_STRING = "Xiphos Q7S FM";
#else #else
static const char* DEV_STRING = "Xiphos Q7S EM"; static const char* DEV_STRING = "Xiphos Q7S EM";
#endif #endif
int obsw::obsw() {
WatchdogHandler WATCHDOG_HANDLER;
int obsw::obsw(int argc, char* argv[]) {
using namespace fsfw; using namespace fsfw;
std::cout << "-- EIVE OBSW --" << std::endl; std::cout << "-- EIVE OBSW --" << std::endl;
std::cout << "-- Compiled for Linux (" << DEV_STRING << ") --" << std::endl; std::cout << "-- Compiled for Linux (" << DEV_STRING << ") --" << std::endl;
@ -38,10 +26,9 @@ int obsw::obsw(int argc, char* argv[]) {
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
std::error_code e;
// 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, e)) { if (std::filesystem::exists(watchdog::RUNNING_FILE_NAME)) {
sif::warning << "File " << watchdog::RUNNING_FILE_NAME sif::warning << "File " << watchdog::RUNNING_FILE_NAME
<< " exists so the software might " << " exists so the software might "
"already be running. Check if obsw systemd service has been stopped." "already be running. Check if obsw systemd service has been stopped."
@ -49,103 +36,11 @@ int obsw::obsw(int argc, char* argv[]) {
return OBSW_ALREADY_RUNNING; return OBSW_ALREADY_RUNNING;
} }
#endif #endif
initmission::initMission();
// Delay the boot if applicable.
bootDelayHandling();
bool initWatchFunction = false;
std::string fullExecPath = argv[0];
if (fullExecPath.find("/usr/bin") != std::string::npos) {
initWatchFunction = true;
}
ReturnValue_t result = WATCHDOG_HANDLER.initialize(initWatchFunction);
if (result != returnvalue::OK) {
std::cerr << "Initiating EIVE watchdog handler failed" << std::endl;
}
scheduling::initMission();
// Command the EIVE system to safe mode
#if OBSW_COMMAND_SAFE_MODE_AT_STARTUP == 1
// This ensures that the PCDU switches were updated.
TaskFactory::delayTask(1000);
commandComSubsystemRxOnly();
commandEiveSystemToSafe();
#else
announceAllModes();
#endif
for (;;) { for (;;) {
WATCHDOG_HANDLER.periodicOperation(); /* Suspend main thread by sleeping it. */
TaskFactory::delayTask(2000); TaskFactory::delayTask(5000);
} }
return 0; return 0;
} }
void obsw::bootDelayHandling() {
const char* homedir = nullptr;
homedir = getenv("HOME");
if (homedir == nullptr) {
homedir = getpwuid(getuid())->pw_dir;
}
std::filesystem::path bootDelayFile = std::filesystem::path(homedir) / "boot_delay_secs.txt";
std::error_code e;
// Init delay handling.
if (std::filesystem::exists(bootDelayFile, e)) {
std::ifstream ifile(bootDelayFile);
std::string lineStr;
unsigned int bootDelaySecs = 0;
unsigned int line = 0;
// Try to reas delay seconds from file.
while (std::getline(ifile, lineStr)) {
std::istringstream iss(lineStr);
if (!(iss >> bootDelaySecs)) {
break;
}
line++;
}
if (line == 0) {
// If the file is empty, assume default of 6 seconds
bootDelaySecs = 6;
}
std::cout << "Delaying OBSW start for " << bootDelaySecs << " seconds" << std::endl;
TaskFactory::delayTask(bootDelaySecs * 1000);
}
}
void obsw::commandEiveSystemToSafe() {
auto sysQueueId = satsystem::EIVE_SYSTEM.getCommandQueue();
CommandMessage msg;
ModeMessage::setCmdModeMessage(msg, acs::AcsMode::SAFE, 0);
ReturnValue_t result =
MessageQueueSenderIF::sendMessage(sysQueueId, &msg, MessageQueueIF::NO_QUEUE, false);
if (result != returnvalue::OK) {
sif::error << "obsw: Sending safe mode command to EIVE system failed" << std::endl;
}
}
void obsw::commandComSubsystemRxOnly() {
auto* comSs = ObjectManager::instance()->get<HasModesIF>(objects::COM_SUBSYSTEM);
if (comSs == nullptr) {
sif::error << "obsw: Could not retrieve COM subsystem object" << std::endl;
return;
}
CommandMessage msg;
ModeMessage::setCmdModeMessage(msg, com::RX_ONLY, 0);
ReturnValue_t result = MessageQueueSenderIF::sendMessage(comSs->getCommandQueue(), &msg,
MessageQueueIF::NO_QUEUE, false);
if (result != returnvalue::OK) {
sif::error << "obsw: Sending RX_ONLY mode command to COM subsystem failed" << std::endl;
}
}
void obsw::announceAllModes() {
auto sysQueueId = satsystem::EIVE_SYSTEM.getCommandQueue();
CommandMessage msg;
ModeMessage::setModeAnnounceMessage(msg, true);
ReturnValue_t result =
MessageQueueSenderIF::sendMessage(sysQueueId, &msg, MessageQueueIF::NO_QUEUE, false);
if (result != returnvalue::OK) {
sif::error << "obsw: Sending safe mode command to EIVE system failed" << std::endl;
}
}

View File

@ -3,13 +3,8 @@
namespace obsw { namespace obsw {
int obsw(int argc, char* argv[]); int obsw();
void bootDelayHandling(); };
void commandEiveSystemToSafe();
void commandComSubsystemRxOnly();
void announceAllModes();
}; // namespace obsw
#endif /* BSP_Q7S_CORE_OBSW_H_ */ #endif /* BSP_Q7S_CORE_OBSW_H_ */

View File

@ -1,702 +0,0 @@
#include "scheduling.h"
#include <fsfw/devicehandlers/DeviceCommunicationIF.h>
#include <fsfw/subsystem/Subsystem.h>
#include <linux/scheduling.h>
#include <mission/tcs/Max31865Definitions.h>
#include <iostream>
#include <vector>
#include "OBSWConfig.h"
#include "fsfw/objectmanager/ObjectManager.h"
#include "fsfw/objectmanager/ObjectManagerIF.h"
#include "fsfw/platform.h"
#include "fsfw/returnvalues/returnvalue.h"
#include "fsfw/serviceinterface/ServiceInterfaceStream.h"
#include "fsfw/tasks/FixedTimeslotTaskIF.h"
#include "fsfw/tasks/PeriodicTaskIF.h"
#include "fsfw/tasks/TaskFactory.h"
#include "mission/pollingSeqTables.h"
#include "mission/scheduling.h"
#include "mission/utility/InitMission.h"
#include "objectFactory.h"
#include "q7sConfig.h"
/* This is configured for linux without CR */
#ifdef PLATFORM_UNIX
ServiceInterfaceStream sif::debug("DEBUG");
ServiceInterfaceStream sif::info("INFO");
ServiceInterfaceStream sif::warning("WARNING");
ServiceInterfaceStream sif::error("ERROR");
#else
ServiceInterfaceStream sif::debug("DEBUG", true);
ServiceInterfaceStream sif::info("INFO", true);
ServiceInterfaceStream sif::warning("WARNING", true);
ServiceInterfaceStream sif::error("ERROR", true, false, true);
#endif
ObjectManagerIF* objectManager = nullptr;
void scheduling::initMission() {
sif::info << "Building global objects.." << std::endl;
try {
/* Instantiate global object manager and also create all objects */
ObjectManager::instance()->setObjectFactoryFunction(ObjectFactory::produce, nullptr);
} catch (const std::invalid_argument& e) {
sif::error << "scheduling::initMission: Object Construction failed with an "
"invalid argument: "
<< e.what();
std::exit(1);
}
sif::info << "Initializing all objects.." << std::endl;
ObjectManager::instance()->initialize();
/* This function creates and starts all tasks */
initTasks();
}
void scheduling::initTasks() {
TaskFactory* factory = TaskFactory::instance();
ReturnValue_t result = returnvalue::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
#if OBSW_ADD_SA_DEPL == 1
// Could add this to the core controller but the core controller does so many thing that I would
// prefer to have the solar array deployment in a seprate task.
PeriodicTaskIF* solarArrayDeplTask =
factory->createPeriodicTask("SOLAR_ARRAY_DEPL", 65, PeriodicTaskIF::MINIMUM_STACK_SIZE, 0.4,
missedDeadlineFunc, &RR_SCHEDULING);
result = solarArrayDeplTask->addComponent(objects::SOLAR_ARRAY_DEPL_HANDLER);
if (result != returnvalue::OK) {
scheduling::printAddObjectError("SOLAR_ARRAY_DEPL", objects::SOLAR_ARRAY_DEPL_HANDLER);
}
#endif
// Medium priority, higher than something like payload, but not the highest priority to also
// detect tasks which choke other tasks.
PeriodicTaskIF* xiphosWdtTask =
factory->createPeriodicTask("XIPHOS_WDT", 40, PeriodicTaskIF::MINIMUM_STACK_SIZE, 0.4,
missedDeadlineFunc, &RR_SCHEDULING);
result = xiphosWdtTask->addComponent(objects::XIPHOS_WDT);
if (result != returnvalue::OK) {
scheduling::printAddObjectError("XIPHOS_WDT", objects::XIPHOS_WDT);
}
PeriodicTaskIF* coreCtrlTask = factory->createPeriodicTask(
"CORE_CTRL", 55, PeriodicTaskIF::MINIMUM_STACK_SIZE, 0.4, missedDeadlineFunc, &RR_SCHEDULING);
result = coreCtrlTask->addComponent(objects::CORE_CONTROLLER);
if (result != returnvalue::OK) {
scheduling::printAddObjectError("CORE_CTRL", objects::CORE_CONTROLLER);
}
/* TMTC Distribution */
PeriodicTaskIF* tmTcDistributor = factory->createPeriodicTask(
"TC_DIST", 45, PeriodicTaskIF::MINIMUM_STACK_SIZE, 0.2, missedDeadlineFunc, &RR_SCHEDULING);
#if OBSW_ADD_TCPIP_SERVERS == 1
#if OBSW_ADD_TMTC_UDP_SERVER == 1
result = tmTcDistributor->addComponent(objects::UDP_TMTC_SERVER);
if (result != returnvalue::OK) {
scheduling::printAddObjectError("UDP_TMTC_SERVER", objects::UDP_TMTC_SERVER);
}
#endif
#if OBSW_ADD_TMTC_TCP_SERVER == 1
result = tmTcDistributor->addComponent(objects::TCP_TMTC_SERVER);
if (result != returnvalue::OK) {
scheduling::printAddObjectError("TCP_TMTC_SERVER", objects::TCP_TMTC_SERVER);
}
#endif
#endif
result = tmTcDistributor->addComponent(objects::CCSDS_PACKET_DISTRIBUTOR);
if (result != returnvalue::OK) {
scheduling::printAddObjectError("CCSDS_DISTRIB", objects::CCSDS_PACKET_DISTRIBUTOR);
}
result = tmTcDistributor->addComponent(objects::PUS_PACKET_DISTRIBUTOR);
if (result != returnvalue::OK) {
scheduling::printAddObjectError("PUS_PACKET_DISTRIB", objects::PUS_PACKET_DISTRIBUTOR);
}
result = tmTcDistributor->addComponent(objects::CFDP_DISTRIBUTOR);
if (result != returnvalue::OK) {
scheduling::printAddObjectError("CFDP_DISTRIBUTOR", objects::CFDP_DISTRIBUTOR);
}
#if OBSW_ADD_TCPIP_SERVERS == 1
#if OBSW_ADD_TMTC_UDP_SERVER == 1
PeriodicTaskIF* udpPollingTask = factory->createPeriodicTask(
"UDP_TMTC_POLLING", 0, PeriodicTaskIF::MINIMUM_STACK_SIZE, 2.0, missedDeadlineFunc);
result = udpPollingTask->addComponent(objects::UDP_TMTC_POLLING_TASK);
if (result != returnvalue::OK) {
scheduling::printAddObjectError("UDP_POLLING", objects::UDP_TMTC_POLLING_TASK);
}
#endif
#if OBSW_ADD_TMTC_TCP_SERVER == 1
PeriodicTaskIF* tcpPollingTask = factory->createPeriodicTask(
"TCP_TMTC_POLLING", 0, PeriodicTaskIF::MINIMUM_STACK_SIZE, 2.0, missedDeadlineFunc);
result = tcpPollingTask->addComponent(objects::TCP_TMTC_POLLING_TASK);
if (result != returnvalue::OK) {
scheduling::printAddObjectError("UDP_POLLING", objects::TCP_TMTC_POLLING_TASK);
}
#endif
#endif
PeriodicTaskIF* genericSysTask =
factory->createPeriodicTask("SYSTEM_TASK", 50, PeriodicTaskIF::MINIMUM_STACK_SIZE, 0.5,
missedDeadlineFunc, &RR_SCHEDULING);
result = genericSysTask->addComponent(objects::EIVE_SYSTEM);
if (result != returnvalue::OK) {
scheduling::printAddObjectError("EIVE_SYSTEM", objects::EIVE_SYSTEM);
}
result = genericSysTask->addComponent(objects::COM_SUBSYSTEM);
if (result != returnvalue::OK) {
scheduling::printAddObjectError("COM_SUBSYSTEM", objects::COM_SUBSYSTEM);
}
result = genericSysTask->addComponent(objects::SYRLINKS_ASSY);
if (result != returnvalue::OK) {
scheduling::printAddObjectError("SYRLINKS_ASSY", objects::SYRLINKS_ASSY);
}
result = genericSysTask->addComponent(objects::PL_SUBSYSTEM);
if (result != returnvalue::OK) {
scheduling::printAddObjectError("PL_SUBSYSTEM", objects::PL_SUBSYSTEM);
}
result = genericSysTask->addComponent(objects::EPS_SUBSYSTEM);
if (result != returnvalue::OK) {
scheduling::printAddObjectError("EPS_SUBSYSTEM", objects::EPS_SUBSYSTEM);
}
result = genericSysTask->addComponent(objects::INTERNAL_ERROR_REPORTER);
if (result != returnvalue::OK) {
scheduling::printAddObjectError("ERROR_REPORTER", objects::INTERNAL_ERROR_REPORTER);
}
result = genericSysTask->addComponent(objects::PUS_SERVICE_17_TEST);
if (result != returnvalue::OK) {
scheduling::printAddObjectError("PUS_17", objects::PUS_SERVICE_17_TEST);
}
#if OBSW_ADD_CCSDS_IP_CORES == 1
result = genericSysTask->addComponent(objects::CCSDS_HANDLER);
if (result != returnvalue::OK) {
scheduling::printAddObjectError("CCSDS Handler", objects::CCSDS_HANDLER);
}
// Runs in IRQ mode, frequency does not really matter
PeriodicTaskIF* pdecHandlerTask = factory->createPeriodicTask(
"PDEC_HANDLER", 75, PeriodicTaskIF::MINIMUM_STACK_SIZE, 1.0, nullptr, &RR_SCHEDULING);
result = pdecHandlerTask->addComponent(objects::PDEC_HANDLER);
if (result != returnvalue::OK) {
scheduling::printAddObjectError("PDEC Handler", objects::PDEC_HANDLER);
}
#endif /* OBSW_ADD_CCSDS_IP_CORE == 1 */
// All the TM store tasks run in permanent loops, frequency does not matter
PeriodicTaskIF* liveTmTask = factory->createPeriodicTask(
"LIVE_TM", 55, PeriodicTaskIF::MINIMUM_STACK_SIZE, 1.0, nullptr, &RR_SCHEDULING);
result = liveTmTask->addComponent(objects::LIVE_TM_TASK);
if (result != returnvalue::OK) {
scheduling::printAddObjectError("LIVE_TM", objects::LIVE_TM_TASK);
}
PeriodicTaskIF* logTmTask = factory->createPeriodicTask(
"LOG_PSTORE", 0, PeriodicTaskIF::MINIMUM_STACK_SIZE, 1.0, nullptr);
result = logTmTask->addComponent(objects::LOG_STORE_AND_TM_TASK);
if (result != returnvalue::OK) {
scheduling::printAddObjectError("LOG_STORE_AND_TM", objects::LOG_STORE_AND_TM_TASK);
}
PeriodicTaskIF* hkTmTask =
factory->createPeriodicTask("HK_PSTORE", 0, PeriodicTaskIF::MINIMUM_STACK_SIZE, 1.0, nullptr);
result = hkTmTask->addComponent(objects::HK_STORE_AND_TM_TASK);
if (result != returnvalue::OK) {
scheduling::printAddObjectError("HK_STORE_AND_TM", objects::HK_STORE_AND_TM_TASK);
}
PeriodicTaskIF* cfdpTmTask = factory->createPeriodicTask(
"CFDP_PSTORE", 0, PeriodicTaskIF::MINIMUM_STACK_SIZE, 1.0, nullptr);
result = cfdpTmTask->addComponent(objects::CFDP_STORE_AND_TM_TASK);
if (result != returnvalue::OK) {
scheduling::printAddObjectError("CFDP_STORE_AND_TM", objects::CFDP_STORE_AND_TM_TASK);
}
// TODO: Use user priorities for this task.
#if OBSW_ADD_CFDP_COMPONENTS == 1
PeriodicTaskIF* cfdpTask =
factory->createPeriodicTask("CFDP_HANDLER", 40, PeriodicTaskIF::MINIMUM_STACK_SIZE, 0.4,
missedDeadlineFunc, &RR_SCHEDULING);
result = cfdpTask->addComponent(objects::CFDP_HANDLER);
if (result != returnvalue::OK) {
scheduling::printAddObjectError("CFDP", objects::CFDP_HANDLER);
}
#endif
PeriodicTaskIF* gpsTask =
factory->createPeriodicTask("GPS_TASK", 50, PeriodicTaskIF::MINIMUM_STACK_SIZE * 2, 0.4,
missedDeadlineFunc, &RR_SCHEDULING);
result = gpsTask->addComponent(objects::GPS_CONTROLLER);
if (result != returnvalue::OK) {
scheduling::printAddObjectError("GPS_CTRL", objects::GPS_CONTROLLER);
}
#if OBSW_ADD_ACS_BOARD == 1
PeriodicTaskIF* acsBrdPolling =
factory->createPeriodicTask("ACS_BOARD_POLLING", 85, PeriodicTaskIF::MINIMUM_STACK_SIZE * 2,
0.4, missedDeadlineFunc, &RR_SCHEDULING);
result = acsBrdPolling->addComponent(objects::ACS_BOARD_POLLING_TASK);
if (result != returnvalue::OK) {
scheduling::printAddObjectError("ACS_BOARD_POLLING", objects::ACS_BOARD_POLLING_TASK);
}
#endif
#if OBSW_ADD_RW == 1
PeriodicTaskIF* rwPolling =
factory->createPeriodicTask("RW_POLLING_TASK", 75, PeriodicTaskIF::MINIMUM_STACK_SIZE * 2,
0.4, missedDeadlineFunc, &RR_SCHEDULING);
result = rwPolling->addComponent(objects::RW_POLLING_TASK);
if (result != returnvalue::OK) {
scheduling::printAddObjectError("RW_POLLING_TASK", objects::RW_POLLING_TASK);
}
#endif
#if OBSW_ADD_MGT == 1
PeriodicTaskIF* imtqPolling =
factory->createPeriodicTask("IMTQ_POLLING_TASK", 85, PeriodicTaskIF::MINIMUM_STACK_SIZE * 2,
0.4, missedDeadlineFunc, &RR_SCHEDULING);
result = imtqPolling->addComponent(objects::IMTQ_POLLING);
if (result != returnvalue::OK) {
scheduling::printAddObjectError("IMTQ_POLLING_TASK", objects::IMTQ_POLLING);
}
#endif
#if OBSW_ADD_SUN_SENSORS == 1
PeriodicTaskIF* susPolling =
factory->createPeriodicTask("SUS_POLLING_TASK", 85, PeriodicTaskIF::MINIMUM_STACK_SIZE * 2,
0.4, missedDeadlineFunc, &RR_SCHEDULING);
result = susPolling->addComponent(objects::SUS_POLLING_TASK);
if (result != returnvalue::OK) {
scheduling::printAddObjectError("SUS_POLLING_TASK", objects::SUS_POLLING_TASK);
}
#endif
PeriodicTaskIF* acsSysTask =
factory->createPeriodicTask("ACS_SYS_TASK", 55, PeriodicTaskIF::MINIMUM_STACK_SIZE * 2, 0.4,
missedDeadlineFunc, &RR_SCHEDULING);
result = acsSysTask->addComponent(objects::ACS_SUBSYSTEM);
if (result != returnvalue::OK) {
scheduling::printAddObjectError("ACS_SUBSYSTEM", objects::ACS_SUBSYSTEM);
}
result = acsSysTask->addComponent(objects::IMTQ_ASSY);
if (result != returnvalue::OK) {
scheduling::printAddObjectError("IMTQ_ASSY", objects::IMTQ_ASSY);
}
result = acsSysTask->addComponent(objects::ACS_BOARD_ASS);
if (result != returnvalue::OK) {
scheduling::printAddObjectError("ACS_BOARD_ASS", objects::ACS_BOARD_ASS);
}
result = acsSysTask->addComponent(objects::RW_ASSY);
if (result != returnvalue::OK) {
scheduling::printAddObjectError("RW_ASS", objects::RW_ASSY);
}
result = acsSysTask->addComponent(objects::SUS_BOARD_ASS);
if (result != returnvalue::OK) {
scheduling::printAddObjectError("SUS_BOARD_ASS", objects::SUS_BOARD_ASS);
}
result = acsSysTask->addComponent(objects::STR_ASSY);
if (result != returnvalue::OK) {
scheduling::printAddObjectError("STR_ASSY", objects::STR_ASSY);
}
result = acsSysTask->addComponent(objects::GPS_0_HEALTH_DEV);
if (result != returnvalue::OK) {
scheduling::printAddObjectError("GPS_0_HEALTH_DEV", objects::GPS_0_HEALTH_DEV);
}
result = acsSysTask->addComponent(objects::GPS_1_HEALTH_DEV);
if (result != returnvalue::OK) {
scheduling::printAddObjectError("GPS_1_HEALTH_DEV", objects::GPS_1_HEALTH_DEV);
}
PeriodicTaskIF* tcsSystemTask = factory->createPeriodicTask(
"TCS_TASK", 50, PeriodicTaskIF::MINIMUM_STACK_SIZE, 0.5, missedDeadlineFunc, &RR_SCHEDULING);
#if OBSW_ADD_THERMAL_TEMP_INSERTER == 1
tcsSystemTask->addComponent(objects::THERMAL_TEMP_INSERTER);
#endif
scheduling::scheduleRtdSensors(tcsSystemTask);
result = tcsSystemTask->addComponent(objects::TCS_SUBSYSTEM);
if (result != returnvalue::OK) {
scheduling::printAddObjectError("TCS_SUBSYSTEM", objects::TCS_SUBSYSTEM);
}
result = tcsSystemTask->addComponent(objects::TCS_BOARD_ASS);
if (result != returnvalue::OK) {
scheduling::printAddObjectError("TCS_BOARD_ASS", objects::TCS_BOARD_ASS);
}
#if OBSW_ADD_TCS_CTRL == 1
result = tcsSystemTask->addComponent(objects::THERMAL_CONTROLLER);
if (result != returnvalue::OK) {
scheduling::printAddObjectError("THERMAL_CONTROLLER", objects::THERMAL_CONTROLLER);
}
#endif
result = tcsSystemTask->addComponent(objects::HEATER_HANDLER);
if (result != returnvalue::OK) {
scheduling::printAddObjectError("HEATER_HANDLER", objects::HEATER_HANDLER);
}
result = tcsSystemTask->addComponent(objects::HEATER_HANDLER);
if (result != returnvalue::OK) {
scheduling::printAddObjectError("HEATER_HANDLER", objects::HEATER_HANDLER);
}
#if OBSW_ADD_SYRLINKS == 1
PeriodicTaskIF* syrlinksCom = factory->createPeriodicTask(
"SYRLINKS_COM", 65, PeriodicTaskIF::MINIMUM_STACK_SIZE, 1.0, missedDeadlineFunc);
result = syrlinksCom->addComponent(objects::SYRLINKS_COM_HANDLER);
if (result != returnvalue::OK) {
scheduling::printAddObjectError("SYRLINKS_COM", objects::SYRLINKS_COM_HANDLER);
}
#endif
#if OBSW_ADD_STAR_TRACKER == 1
// Relatively high priority to make sure STR COM works well.
PeriodicTaskIF* strHelperTask =
factory->createPeriodicTask("STR_HELPER", 30, PeriodicTaskIF::MINIMUM_STACK_SIZE, 0.2,
missedDeadlineFunc, &RR_SCHEDULING);
result = strHelperTask->addComponent(objects::STR_COM_IF);
if (result != returnvalue::OK) {
scheduling::printAddObjectError("STR_HELPER", objects::STR_COM_IF);
}
#endif /* OBSW_ADD_STAR_TRACKER == 1 */
#if OBSW_ADD_PLOC_MPSOC == 1
PeriodicTaskIF* mpsocHelperTask = factory->createPeriodicTask(
"PLOC_MPSOC_HELPER", 0, PeriodicTaskIF::MINIMUM_STACK_SIZE, 0.2, missedDeadlineFunc);
result = mpsocHelperTask->addComponent(objects::PLOC_MPSOC_HELPER);
if (result != returnvalue::OK) {
scheduling::printAddObjectError("PLOC_MPSOC_HELPER", objects::PLOC_MPSOC_HELPER);
}
#endif /* OBSW_ADD_PLOC_MPSOC */
// TODO: Use regular scheduler for this task
#if OBSW_ADD_PLOC_SUPERVISOR == 1
PeriodicTaskIF* supvHelperTask = factory->createPeriodicTask(
"PLOC_SUPV_HELPER", 0, PeriodicTaskIF::MINIMUM_STACK_SIZE, 1.0, missedDeadlineFunc);
result = supvHelperTask->addComponent(objects::PLOC_SUPERVISOR_HELPER);
if (result != returnvalue::OK) {
scheduling::printAddObjectError("PLOC_SUPV_HELPER", objects::PLOC_SUPERVISOR_HELPER);
}
#endif /* OBSW_ADD_PLOC_SUPERVISOR */
FixedTimeslotTaskIF* plTask = factory->createFixedTimeslotTask(
"PL_TASK", 25, PeriodicTaskIF::MINIMUM_STACK_SIZE, 0.5, missedDeadlineFunc);
pst::pstPayload(plTask);
#if OBSW_ADD_SCEX_DEVICE == 1
PeriodicTaskIF* scexReaderTask;
scheduling::scheduleScexReader(*factory, scexReaderTask);
#endif
std::vector<PeriodicTaskIF*> pusTasks;
createPusTasks(*factory, missedDeadlineFunc, pusTasks);
std::vector<PeriodicTaskIF*> pstTasks;
AcsPstCfg cfg;
createPstTasks(*factory, missedDeadlineFunc, pstTasks, cfg);
#if OBSW_ADD_TEST_CODE == 1
#if OBSW_TEST_CCSDS_BRIDGE == 1
PeriodicTaskIF* ptmeTestTask = factory->createPeriodicTask(
"PTME_TEST", 80, PeriodicTaskIF::MINIMUM_STACK_SIZE, 2.0, missedDeadlineFunc);
result = ptmeTestTask->addComponent(objects::CCSDS_IP_CORE_BRIDGE);
if (result != returnvalue::OK) {
scheduling::printAddObjectError("PTME_TEST", objects::CCSDS_IP_CORE_BRIDGE);
}
#endif
std::vector<PeriodicTaskIF*> testTasks;
createTestTasks(*factory, missedDeadlineFunc, testTasks);
#endif
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;
xiphosWdtTask->startTask();
tmTcDistributor->startTask();
#if OBSW_ADD_TCPIP_SERVERS == 1
#if OBSW_ADD_TMTC_UDP_SERVER == 1
udpPollingTask->startTask();
#endif
#if OBSW_ADD_TMTC_TCP_SERVER == 1
tcpPollingTask->startTask();
#endif
#endif
genericSysTask->startTask();
#if OBSW_ADD_CCSDS_IP_CORES == 1
pdecHandlerTask->startTask();
#endif /* OBSW_ADD_CCSDS_IP_CORES == 1 */
liveTmTask->startTask();
logTmTask->startTask();
hkTmTask->startTask();
cfdpTmTask->startTask();
coreCtrlTask->startTask();
#if OBSW_ADD_SA_DEPL == 1
solarArrayDeplTask->startTask();
#endif
#if OBSW_ADD_ACS_BOARD == 1
acsBrdPolling->startTask();
#endif
#if OBSW_ADD_SYRLINKS == 1
syrlinksCom->startTask();
#endif
#if OBSW_ADD_MGT == 1
imtqPolling->startTask();
#endif
#if OBSW_ADD_SUN_SENSORS == 1
susPolling->startTask();
#endif
taskStarter(pstTasks, "PST task vector");
taskStarter(pusTasks, "PUS task vector");
#if OBSW_ADD_SCEX_DEVICE == 1
scexReaderTask->startTask();
#endif
#if OBSW_TEST_CCSDS_BRIDGE == 1
ptmeTestTask->startTask();
#endif
#if OBSW_ADD_CFDP_COMPONENTS == 1
cfdpTask->startTask();
#endif
#if OBSW_ADD_STAR_TRACKER == 1
strHelperTask->startTask();
#endif /* OBSW_ADD_STAR_TRACKER == 1 */
#if OBSW_ADD_RW == 1
rwPolling->startTask();
#endif
gpsTask->startTask();
acsSysTask->startTask();
if (not tcsSystemTask->isEmpty()) {
tcsSystemTask->startTask();
}
#if OBSW_ADD_PLOC_SUPERVISOR == 1
supvHelperTask->startTask();
#endif /* OBSW_ADD_PLOC_SUPERVISOR == 1 */
#if OBSW_ADD_PLOC_MPSOC == 1
mpsocHelperTask->startTask();
#endif
plTask->startTask();
#if OBSW_ADD_TEST_CODE == 1
taskStarter(testTasks, "Test task vector");
#endif
sif::info << "Tasks started.." << std::endl;
}
void scheduling::createPstTasks(TaskFactory& factory, TaskDeadlineMissedFunction missedDeadlineFunc,
std::vector<PeriodicTaskIF*>& taskVec, AcsPstCfg cfg) {
ReturnValue_t result = returnvalue::OK;
#ifdef RELEASE_BUILD
static constexpr float acsPstPeriod = 0.4;
#else
static constexpr float acsPstPeriod = 0.4;
#endif
FixedTimeslotTaskIF* acsTcsPst =
factory.createFixedTimeslotTask("ACS_TCS_PST", 85, PeriodicTaskIF::MINIMUM_STACK_SIZE * 2,
acsPstPeriod, missedDeadlineFunc, &RR_SCHEDULING);
result = pst::pstTcsAndAcs(acsTcsPst, cfg);
if (result != returnvalue::OK) {
if (result == FixedTimeslotTaskIF::SLOT_LIST_EMPTY) {
sif::warning << "scheduling::initTasks: ACS PST is empty" << std::endl;
} else {
sif::error << "scheduling::initTasks: Creating ACS PST failed!" << std::endl;
}
} else {
taskVec.push_back(acsTcsPst);
}
/* Polling Sequence Table Default */
#if OBSW_ADD_SPI_TEST_CODE == 0
FixedTimeslotTaskIF* syrlinksPst =
factory.createFixedTimeslotTask("SYRLINKS", 65, PeriodicTaskIF::MINIMUM_STACK_SIZE * 4, 0.5,
missedDeadlineFunc, &RR_SCHEDULING);
result = pst::pstSyrlinks(syrlinksPst);
if (result != returnvalue::OK) {
if (result == FixedTimeslotTaskIF::SLOT_LIST_EMPTY) {
sif::warning << "scheduling::initTasks: SPI PST is empty" << std::endl;
} else {
sif::error << "scheduling::initTasks: Creating SPI PST failed!" << std::endl;
}
} else {
taskVec.push_back(syrlinksPst);
}
#endif
#if OBSW_ADD_I2C_TEST_CODE == 0
FixedTimeslotTaskIF* i2cPst =
factory.createFixedTimeslotTask("I2C_PS_PST", 60, PeriodicTaskIF::MINIMUM_STACK_SIZE * 4, 0.6,
missedDeadlineFunc, &RR_SCHEDULING);
pst::TmpSchedConfig tmpSchedConf;
#if OBSW_Q7S_EM == 1
tmpSchedConf.scheduleTmpDev0 = true;
tmpSchedConf.scheduleTmpDev1 = true;
tmpSchedConf.schedulePlPcduDev0 = true;
tmpSchedConf.schedulePlPcduDev1 = true;
tmpSchedConf.scheduleIfBoardDev = true;
#endif
result = pst::pstI2c(tmpSchedConf, i2cPst);
if (result != returnvalue::OK) {
if (result == FixedTimeslotTaskIF::SLOT_LIST_EMPTY) {
sif::warning << "scheduling::initTasks: I2C PST is empty" << std::endl;
} else {
sif::error << "scheduling::initTasks: Creating I2C PST failed!" << std::endl;
}
} else {
taskVec.push_back(i2cPst);
}
#endif
FixedTimeslotTaskIF* gomSpacePstTask =
factory.createFixedTimeslotTask("GS_PST_TASK", 65, PeriodicTaskIF::MINIMUM_STACK_SIZE * 4,
0.25, missedDeadlineFunc, &RR_SCHEDULING);
result = pst::pstGompaceCan(gomSpacePstTask);
if (result != returnvalue::OK) {
if (result != FixedTimeslotTaskIF::SLOT_LIST_EMPTY) {
sif::error << "scheduling::initTasks: GomSpace PST initialization failed!" << std::endl;
}
}
taskVec.push_back(gomSpacePstTask);
}
void scheduling::createPusTasks(TaskFactory& factory, TaskDeadlineMissedFunction missedDeadlineFunc,
std::vector<PeriodicTaskIF*>& taskVec) {
ReturnValue_t result = returnvalue::OK;
/* PUS Services */
PeriodicTaskIF* pusHighPrio =
factory.createPeriodicTask("PUS_HIGH_PRIO", 60, PeriodicTaskIF::MINIMUM_STACK_SIZE, 0.2,
missedDeadlineFunc, &RR_SCHEDULING);
result = pusHighPrio->addComponent(objects::PUS_SERVICE_1_VERIFICATION);
if (result != returnvalue::OK) {
scheduling::printAddObjectError("PUS_VERIF", objects::PUS_SERVICE_1_VERIFICATION);
}
result = pusHighPrio->addComponent(objects::PUS_SERVICE_5_EVENT_REPORTING);
if (result != returnvalue::OK) {
scheduling::printAddObjectError("PUS_EVENTS", objects::PUS_SERVICE_5_EVENT_REPORTING);
}
result = pusHighPrio->addComponent(objects::EVENT_MANAGER);
if (result != returnvalue::OK) {
scheduling::printAddObjectError("EVENT_MGMT", objects::EVENT_MANAGER);
}
result = pusHighPrio->addComponent(objects::PUS_SERVICE_9_TIME_MGMT);
if (result != returnvalue::OK) {
scheduling::printAddObjectError("PUS_TIME", objects::PUS_SERVICE_9_TIME_MGMT);
}
taskVec.push_back(pusHighPrio);
PeriodicTaskIF* pusMedPrio =
factory.createPeriodicTask("PUS_MED_PRIO", 45, PeriodicTaskIF::MINIMUM_STACK_SIZE, 0.8,
missedDeadlineFunc, &RR_SCHEDULING);
result = pusMedPrio->addComponent(objects::PUS_SERVICE_3_HOUSEKEEPING);
if (result != returnvalue::OK) {
scheduling::printAddObjectError("PUS_3", objects::PUS_SERVICE_3_HOUSEKEEPING);
}
result = pusMedPrio->addComponent(objects::PUS_SERVICE_8_FUNCTION_MGMT);
if (result != returnvalue::OK) {
scheduling::printAddObjectError("PUS_8", objects::PUS_SERVICE_8_FUNCTION_MGMT);
}
result = pusMedPrio->addComponent(objects::PUS_SERVICE_15_TM_STORAGE);
if (result != returnvalue::OK) {
scheduling::printAddObjectError("PUS_15", objects::PUS_SERVICE_15_TM_STORAGE);
}
result = pusMedPrio->addComponent(objects::PUS_SERVICE_11_TC_SCHEDULER);
if (result != returnvalue::OK) {
scheduling::printAddObjectError("PUS_11", objects::PUS_SERVICE_11_TC_SCHEDULER);
}
result = pusMedPrio->addComponent(objects::PUS_SERVICE_20_PARAMETERS);
if (result != returnvalue::OK) {
scheduling::printAddObjectError("PUS_20", objects::PUS_SERVICE_20_PARAMETERS);
}
result = pusMedPrio->addComponent(objects::PUS_SERVICE_200_MODE_MGMT);
if (result != returnvalue::OK) {
scheduling::printAddObjectError("PUS_200", objects::PUS_SERVICE_200_MODE_MGMT);
}
result = pusMedPrio->addComponent(objects::PUS_SERVICE_201_HEALTH);
if (result != returnvalue::OK) {
scheduling::printAddObjectError("PUS_201", objects::PUS_SERVICE_201_HEALTH);
}
result = pusMedPrio->addComponent(objects::PUS_SERVICE_2_DEVICE_ACCESS);
if (result != returnvalue::OK) {
scheduling::printAddObjectError("PUS_2", objects::PUS_SERVICE_2_DEVICE_ACCESS);
}
taskVec.push_back(pusMedPrio);
}
void scheduling::createTestTasks(TaskFactory& factory,
TaskDeadlineMissedFunction missedDeadlineFunc,
std::vector<PeriodicTaskIF*>& taskVec) {
#if OBSW_ADD_TEST_TASK == 1 && OBSW_ADD_TEST_CODE == 1
ReturnValue_t result = returnvalue::OK;
static_cast<void>(result); // supress warning in case it is not used
PeriodicTaskIF* testTask = factory.createPeriodicTask(
"TEST_TASK", 60, PeriodicTaskIF::MINIMUM_STACK_SIZE, 1, missedDeadlineFunc);
result = testTask->addComponent(objects::TEST_TASK);
if (result != returnvalue::OK) {
scheduling::printAddObjectError("TEST_TASK", objects::TEST_TASK);
}
#if OBSW_ADD_SPI_TEST_CODE == 1
result = testTask->addComponent(objects::SPI_TEST);
if (result != returnvalue::OK) {
scheduling::printAddObjectError("SPI_TEST", objects::SPI_TEST);
}
#endif
#if OBSW_ADD_I2C_TEST_CODE == 1
result = testTask->addComponent(objects::I2C_TEST);
if (result != returnvalue::OK) {
scheduling::printAddObjectError("I2C_TEST", objects::I2C_TEST);
}
#endif
#if OBSW_ADD_UART_TEST_CODE == 1
result = testTask->addComponent(objects::UART_TEST);
if (result != returnvalue::OK) {
scheduling::printAddObjectError("UART_TEST", objects::UART_TEST);
}
#endif
taskVec.push_back(testTask);
#endif // OBSW_ADD_TEST_TASK == 1 && OBSW_ADD_TEST_CODE == 1
}
/**
**/

View File

@ -12,20 +12,20 @@ Xadc::Xadc() {}
Xadc::~Xadc() {} Xadc::~Xadc() {}
ReturnValue_t Xadc::getTemperature(float& temperature) { ReturnValue_t Xadc::getTemperature(float& temperature) {
ReturnValue_t result = returnvalue::OK; ReturnValue_t result = HasReturnvaluesIF::RETURN_OK;
int raw = 0; int raw = 0;
int offset = 0; int offset = 0;
float scale = 0; float scale = 0;
result = readValFromFile<int>(xadc::file::tempRaw.c_str(), raw); result = readValFromFile<int>(xadc::file::tempRaw.c_str(), raw);
if (result != returnvalue::OK) { if (result != HasReturnvaluesIF::RETURN_OK) {
return result; return result;
} }
result = readValFromFile<int>(xadc::file::tempOffset.c_str(), offset); result = readValFromFile<int>(xadc::file::tempOffset.c_str(), offset);
if (result != returnvalue::OK) { if (result != HasReturnvaluesIF::RETURN_OK) {
return result; return result;
} }
result = readValFromFile<float>(xadc::file::tempScale.c_str(), scale); result = readValFromFile<float>(xadc::file::tempScale.c_str(), scale);
if (result != returnvalue::OK) { if (result != HasReturnvaluesIF::RETURN_OK) {
return result; return result;
} }
temperature = (raw + offset) * scale / 1000; temperature = (raw + offset) * scale / 1000;
@ -35,84 +35,84 @@ ReturnValue_t Xadc::getTemperature(float& temperature) {
ReturnValue_t Xadc::getVccPint(float& vccPint) { ReturnValue_t Xadc::getVccPint(float& vccPint) {
ReturnValue_t result = ReturnValue_t result =
readVoltageFromSysfs(xadc::file::vccpintRaw, xadc::file::vccpintScale, vccPint); readVoltageFromSysfs(xadc::file::vccpintRaw, xadc::file::vccpintScale, vccPint);
if (result != returnvalue::OK) { if (result != HasReturnvaluesIF::RETURN_OK) {
return result; return result;
} }
return returnvalue::OK; return HasReturnvaluesIF::RETURN_OK;
} }
ReturnValue_t Xadc::getVccPaux(float& vccPaux) { ReturnValue_t Xadc::getVccPaux(float& vccPaux) {
ReturnValue_t result = ReturnValue_t result =
readVoltageFromSysfs(xadc::file::vccpauxRaw, xadc::file::vccpauxScale, vccPaux); readVoltageFromSysfs(xadc::file::vccpauxRaw, xadc::file::vccpauxScale, vccPaux);
if (result != returnvalue::OK) { if (result != HasReturnvaluesIF::RETURN_OK) {
return result; return result;
} }
return returnvalue::OK; return HasReturnvaluesIF::RETURN_OK;
} }
ReturnValue_t Xadc::getVccInt(float& vccInt) { ReturnValue_t Xadc::getVccInt(float& vccInt) {
ReturnValue_t result = ReturnValue_t result =
readVoltageFromSysfs(xadc::file::vccintRaw, xadc::file::vccintScale, vccInt); readVoltageFromSysfs(xadc::file::vccintRaw, xadc::file::vccintScale, vccInt);
if (result != returnvalue::OK) { if (result != HasReturnvaluesIF::RETURN_OK) {
return result; return result;
} }
return returnvalue::OK; return HasReturnvaluesIF::RETURN_OK;
} }
ReturnValue_t Xadc::getVccAux(float& vccAux) { ReturnValue_t Xadc::getVccAux(float& vccAux) {
ReturnValue_t result = ReturnValue_t result =
readVoltageFromSysfs(xadc::file::vccauxRaw, xadc::file::vccauxScale, vccAux); readVoltageFromSysfs(xadc::file::vccauxRaw, xadc::file::vccauxScale, vccAux);
if (result != returnvalue::OK) { if (result != HasReturnvaluesIF::RETURN_OK) {
return result; return result;
} }
return returnvalue::OK; return HasReturnvaluesIF::RETURN_OK;
} }
ReturnValue_t Xadc::getVccBram(float& vccBram) { ReturnValue_t Xadc::getVccBram(float& vccBram) {
ReturnValue_t result = ReturnValue_t result =
readVoltageFromSysfs(xadc::file::vccbramRaw, xadc::file::vccbramScale, vccBram); readVoltageFromSysfs(xadc::file::vccbramRaw, xadc::file::vccbramScale, vccBram);
if (result != returnvalue::OK) { if (result != HasReturnvaluesIF::RETURN_OK) {
return result; return result;
} }
return returnvalue::OK; return HasReturnvaluesIF::RETURN_OK;
} }
ReturnValue_t Xadc::getVccOddr(float& vccOddr) { ReturnValue_t Xadc::getVccOddr(float& vccOddr) {
ReturnValue_t result = ReturnValue_t result =
readVoltageFromSysfs(xadc::file::vccoddrRaw, xadc::file::vccoddrScale, vccOddr); readVoltageFromSysfs(xadc::file::vccoddrRaw, xadc::file::vccoddrScale, vccOddr);
if (result != returnvalue::OK) { if (result != HasReturnvaluesIF::RETURN_OK) {
return result; return result;
} }
return returnvalue::OK; return HasReturnvaluesIF::RETURN_OK;
} }
ReturnValue_t Xadc::getVrefp(float& vrefp) { ReturnValue_t Xadc::getVrefp(float& vrefp) {
ReturnValue_t result = readVoltageFromSysfs(xadc::file::vrefpRaw, xadc::file::vrefpScale, vrefp); ReturnValue_t result = readVoltageFromSysfs(xadc::file::vrefpRaw, xadc::file::vrefpScale, vrefp);
if (result != returnvalue::OK) { if (result != HasReturnvaluesIF::RETURN_OK) {
return result; return result;
} }
return returnvalue::OK; return HasReturnvaluesIF::RETURN_OK;
} }
ReturnValue_t Xadc::getVrefn(float& vrefn) { ReturnValue_t Xadc::getVrefn(float& vrefn) {
ReturnValue_t result = readVoltageFromSysfs(xadc::file::vrefnRaw, xadc::file::vrefnScale, vrefn); ReturnValue_t result = readVoltageFromSysfs(xadc::file::vrefnRaw, xadc::file::vrefnScale, vrefn);
if (result != returnvalue::OK) { if (result != HasReturnvaluesIF::RETURN_OK) {
return result; return result;
} }
return returnvalue::OK; return HasReturnvaluesIF::RETURN_OK;
} }
ReturnValue_t Xadc::readVoltageFromSysfs(std::string rawFile, std::string scaleFile, ReturnValue_t Xadc::readVoltageFromSysfs(std::string rawFile, std::string scaleFile,
float& voltage) { float& voltage) {
ReturnValue_t result = returnvalue::OK; ReturnValue_t result = HasReturnvaluesIF::RETURN_OK;
float raw = 0; float raw = 0;
float scale = 0; float scale = 0;
result = readValFromFile(rawFile.c_str(), raw); result = readValFromFile(rawFile.c_str(), raw);
if (result != returnvalue::OK) { if (result != HasReturnvaluesIF::RETURN_OK) {
return result; return result;
} }
result = readValFromFile(scaleFile.c_str(), scale); result = readValFromFile(scaleFile.c_str(), scale);
if (result != returnvalue::OK) { if (result != HasReturnvaluesIF::RETURN_OK) {
return result; return result;
} }
voltage = calculateVoltage(raw, scale); voltage = calculateVoltage(raw, scale);
@ -127,23 +127,18 @@ ReturnValue_t Xadc::readValFromFile(const char* filename, T& val) {
fp = fopen(filename, "r"); fp = fopen(filename, "r");
if (fp == nullptr) { if (fp == nullptr) {
sif::warning << "Xadc::readValFromFile: Failed to open file " << filename << std::endl; sif::warning << "Xadc::readValFromFile: Failed to open file " << filename << std::endl;
return returnvalue::FAILED; return HasReturnvaluesIF::RETURN_FAILED;
} }
char valstring[MAX_STR_LENGTH]{}; char valstring[MAX_STR_LENGTH] = "";
char* returnVal = fgets(valstring, MAX_STR_LENGTH, fp); char* returnVal = fgets(valstring, MAX_STR_LENGTH, fp);
if (returnVal == nullptr) { if (returnVal == nullptr) {
sif::warning << "Xadc::readValFromFile: Failed to read string from file " << filename sif::warning << "Xadc::readValFromFile: Failed to read string from file " << filename
<< std::endl; << std::endl;
fclose(fp); fclose(fp);
return returnvalue::FAILED; return HasReturnvaluesIF::RETURN_FAILED;
} }
std::istringstream valSstream(valstring); std::istringstream valSstream(valstring);
valSstream >> val; valSstream >> val;
if (valSstream.bad()) {
sif::warning << "Xadc: Conversion of value to target type failed" << std::endl;
fclose(fp); fclose(fp);
return returnvalue::FAILED; return HasReturnvaluesIF::RETURN_OK;
}
fclose(fp);
return returnvalue::OK;
} }

View File

@ -3,7 +3,7 @@
#include <string> #include <string>
#include "fsfw/returnvalues/returnvalue.h" #include "fsfw/returnvalues/HasReturnvaluesIF.h"
namespace xadc { namespace xadc {
using namespace std; using namespace std;

View File

@ -2,7 +2,7 @@
#include <fsfw/objectmanager/ObjectManager.h> #include <fsfw/objectmanager/ObjectManager.h>
#include <fsfw/objectmanager/ObjectManagerIF.h> #include <fsfw/objectmanager/ObjectManagerIF.h>
#include <fsfw/returnvalues/returnvalue.h> #include <fsfw/returnvalues/HasReturnvaluesIF.h>
#include <fsfw/serviceinterface/ServiceInterface.h> #include <fsfw/serviceinterface/ServiceInterface.h>
#include <fsfw/tasks/FixedTimeslotTaskIF.h> #include <fsfw/tasks/FixedTimeslotTaskIF.h>
#include <fsfw/tasks/PeriodicTaskIF.h> #include <fsfw/tasks/PeriodicTaskIF.h>
@ -36,7 +36,7 @@ void initmission::initMission() {
void initmission::initTasks() { void initmission::initTasks() {
TaskFactory* factory = TaskFactory::instance(); TaskFactory* factory = TaskFactory::instance();
ReturnValue_t result = returnvalue::OK; ReturnValue_t result = HasReturnvaluesIF::RETURN_OK;
if (factory == nullptr) { if (factory == nullptr) {
/* Should never happen ! */ /* Should never happen ! */
return; return;
@ -51,28 +51,28 @@ void initmission::initTasks() {
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 != returnvalue::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 != returnvalue::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 != returnvalue::OK) { if (result != HasReturnvaluesIF::RETURN_OK) {
sif::error << "Object add component failed" << std::endl; sif::error << "Object add component failed" << std::endl;
} }
PeriodicTaskIF* tmtcBridgeTask = factory->createPeriodicTask( PeriodicTaskIF* tmtcBridgeTask = factory->createPeriodicTask(
"TMTC_BRIDGE", 50, PeriodicTaskIF::MINIMUM_STACK_SIZE, 0.2, missedDeadlineFunc); "TMTC_BRIDGE", 50, PeriodicTaskIF::MINIMUM_STACK_SIZE, 0.2, missedDeadlineFunc);
result = tmtcBridgeTask->addComponent(objects::TMTC_BRIDGE); result = tmtcBridgeTask->addComponent(objects::TMTC_BRIDGE);
if (result != returnvalue::OK) { if (result != HasReturnvaluesIF::RETURN_OK) {
sif::error << "Add component TMTC Bridge failed" << std::endl; sif::error << "Add component TMTC Bridge failed" << std::endl;
} }
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 != returnvalue::OK) { if (result != HasReturnvaluesIF::RETURN_OK) {
sif::error << "Add component TMTC Polling failed" << std::endl; sif::error << "Add component TMTC Polling failed" << std::endl;
} }
@ -84,7 +84,7 @@ void initmission::initTasks() {
FixedTimeslotTaskIF* pst = factory->createFixedTimeslotTask( FixedTimeslotTaskIF* pst = factory->createFixedTimeslotTask(
"UART_PST", 70, PeriodicTaskIF::MINIMUM_STACK_SIZE * 4, 1.0, missedDeadlineFunc); "UART_PST", 70, PeriodicTaskIF::MINIMUM_STACK_SIZE * 4, 1.0, missedDeadlineFunc);
result = pst::pstUart(pst); result = pst::pstUart(pst);
if (result != returnvalue::OK) { if (result != HasReturnvaluesIF::RETURN_OK) {
sif::error << "InitMission::initTasks: Creating PST failed!" << std::endl; sif::error << "InitMission::initTasks: Creating PST failed!" << std::endl;
} }
pstTasks.push_back(pst); pstTasks.push_back(pst);
@ -93,7 +93,7 @@ void initmission::initTasks() {
PeriodicTaskIF* mpsocHelperTask = factory->createPeriodicTask( PeriodicTaskIF* mpsocHelperTask = factory->createPeriodicTask(
"PLOC_MPSOC_HELPER", 20, PeriodicTaskIF::MINIMUM_STACK_SIZE, 0.2, missedDeadlineFunc); "PLOC_MPSOC_HELPER", 20, PeriodicTaskIF::MINIMUM_STACK_SIZE, 0.2, missedDeadlineFunc);
result = mpsocHelperTask->addComponent(objects::PLOC_MPSOC_HELPER); result = mpsocHelperTask->addComponent(objects::PLOC_MPSOC_HELPER);
if (result != returnvalue::OK) { if (result != HasReturnvaluesIF::RETURN_OK) {
initmission::printAddObjectError("PLOC_MPSOC_HELPER", objects::PLOC_MPSOC_HELPER); initmission::printAddObjectError("PLOC_MPSOC_HELPER", objects::PLOC_MPSOC_HELPER);
} }
#endif /* OBSW_ADD_PLOC_MPSOC == 1*/ #endif /* OBSW_ADD_PLOC_MPSOC == 1*/
@ -102,16 +102,16 @@ void initmission::initTasks() {
PeriodicTaskIF* supvHelperTask = factory->createPeriodicTask( PeriodicTaskIF* supvHelperTask = factory->createPeriodicTask(
"PLOC_SUPV_HELPER", 20, PeriodicTaskIF::MINIMUM_STACK_SIZE, 0.2, missedDeadlineFunc); "PLOC_SUPV_HELPER", 20, PeriodicTaskIF::MINIMUM_STACK_SIZE, 0.2, missedDeadlineFunc);
result = supvHelperTask->addComponent(objects::PLOC_SUPERVISOR_HELPER); result = supvHelperTask->addComponent(objects::PLOC_SUPERVISOR_HELPER);
if (result != returnvalue::OK) { if (result != HasReturnvaluesIF::RETURN_OK) {
initmission::printAddObjectError("PLOC_SUPV_HELPER", objects::PLOC_SUPERVISOR_HELPER); initmission::printAddObjectError("PLOC_SUPV_HELPER", objects::PLOC_SUPERVISOR_HELPER);
} }
#endif /* OBSW_ADD_PLOC_SUPERVISOR == 1 */ #endif /* OBSW_ADD_PLOC_SUPERVISOR == 1 */
#if OBSW_ADD_CCSDS_IP_CORES == 1 #if OBSW_USE_CCSDS_IP_CORE == 1
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 != returnvalue::OK) { if (result != HasReturnvaluesIF::RETURN_OK) {
initmission::printAddObjectError("CCSDS Handler", objects::CCSDS_HANDLER); initmission::printAddObjectError("CCSDS Handler", objects::CCSDS_HANDLER);
} }
@ -121,10 +121,10 @@ 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 != returnvalue::OK) { if (result != HasReturnvaluesIF::RETURN_OK) {
initmission::printAddObjectError("PDEC Handler", objects::PDEC_HANDLER); initmission::printAddObjectError("PDEC Handler", objects::PDEC_HANDLER);
} }
#endif /* OBSW_ADD_CCSDS_IP_CORES == 1 */ #endif /* OBSW_USE_CCSDS_IP_CORE == 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) {
@ -140,10 +140,10 @@ void initmission::initTasks() {
tmtcDistributor->startTask(); tmtcDistributor->startTask();
tmtcBridgeTask->startTask(); tmtcBridgeTask->startTask();
tmtcPollingTask->startTask(); tmtcPollingTask->startTask();
#if OBSW_ADD_CCSDS_IP_CORE == 1 #if OBSW_USE_CCSDS_IP_CORE == 1
pdecHandlerTask->startTask(); pdecHandlerTask->startTask();
ccsdsHandlerTask->startTask(); ccsdsHandlerTask->startTask();
#endif /* #if OBSW_ADD_CCSDS_IP_CORE == 1 */ #endif /* #if OBSW_USE_CCSDS_IP_CORE == 1 */
#if OBSW_ADD_PLOC_SUPERVISOR == 1 #if OBSW_ADD_PLOC_SUPERVISOR == 1
supvHelperTask->startTask(); supvHelperTask->startTask();
#endif /* OBSW_ADD_PLOC_SUPERVISOR == 1 */ #endif /* OBSW_ADD_PLOC_SUPERVISOR == 1 */
@ -160,11 +160,11 @@ void initmission::initTasks() {
void initmission::createPusTasks(TaskFactory& factory, void initmission::createPusTasks(TaskFactory& factory,
TaskDeadlineMissedFunction missedDeadlineFunc, TaskDeadlineMissedFunction missedDeadlineFunc,
std::vector<PeriodicTaskIF*>& taskVec) { std::vector<PeriodicTaskIF*>& taskVec) {
ReturnValue_t result = returnvalue::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 != returnvalue::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);
@ -172,11 +172,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 != returnvalue::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 != returnvalue::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);
@ -184,11 +184,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 != returnvalue::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 != returnvalue::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);
@ -196,19 +196,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 != returnvalue::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 != returnvalue::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 != returnvalue::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 != returnvalue::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);
@ -216,11 +216,11 @@ 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 != returnvalue::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 != returnvalue::OK) { if (result != HasReturnvaluesIF::RETURN_OK) {
initmission::printAddObjectError("INT_ERR_RPRT", objects::INTERNAL_ERROR_REPORTER); initmission::printAddObjectError("INT_ERR_RPRT", objects::INTERNAL_ERROR_REPORTER);
} }
taskVec.push_back(pusLowPrio); taskVec.push_back(pusLowPrio);

View File

@ -13,7 +13,7 @@
/** All of the following flags should be enabled for mission code */ /** All of the following flags should be enabled for mission code */
/*******************************************************************/ /*******************************************************************/
#define OBSW_ADD_CCSDS_IP_CORE 0 #define OBSW_USE_CCSDS_IP_CORE 0
// Set to 1 if all telemetry should be sent to the PTME IP Core // Set to 1 if all telemetry should be sent to the PTME IP Core
#define OBSW_TM_TO_PTME 0 #define OBSW_TM_TO_PTME 0
// Set to 1 if telecommands are received via the PDEC IP Core // Set to 1 if telecommands are received via the PDEC IP Core

View File

@ -12,8 +12,8 @@
#include "fsfw/tmtcservices/PusServiceBase.h" #include "fsfw/tmtcservices/PusServiceBase.h"
#include "fsfw_hal/linux/i2c/I2cComIF.h" #include "fsfw_hal/linux/i2c/I2cComIF.h"
#include "fsfw_hal/linux/i2c/I2cCookie.h" #include "fsfw_hal/linux/i2c/I2cCookie.h"
#include "fsfw_hal/linux/serial/SerialComIF.h" #include "fsfw_hal/linux/uart/UartComIF.h"
#include "fsfw_hal/linux/serial/SerialCookie.h" #include "fsfw_hal/linux/uart/UartCookie.h"
#include "fsfw_hal/common/gpio/GpioCookie.h" #include "fsfw_hal/common/gpio/GpioCookie.h"
#include "linux/ObjectFactory.h" #include "linux/ObjectFactory.h"
#include "linux/devices/ploc/PlocMPSoCHandler.h" #include "linux/devices/ploc/PlocMPSoCHandler.h"
@ -59,7 +59,7 @@ void ObjectFactory::produce(void* args) {
ObjectFactory::produceGenericObjects(); ObjectFactory::produceGenericObjects();
LinuxLibgpioIF* gpioComIF = new LinuxLibgpioIF(objects::GPIO_IF);; LinuxLibgpioIF* gpioComIF = new LinuxLibgpioIF(objects::GPIO_IF);;
newSerialComIF(objects::UART_COM_IF); new UartComIF(objects::UART_COM_IF);
#if OBSW_ADD_PLOC_MPSOC == 1 #if OBSW_ADD_PLOC_MPSOC == 1
UartCookie* mpsocUartCookie = new UartCookie(objects::PLOC_MPSOC_HANDLER, te0720_1cfa::MPSOC_UART, UartCookie* mpsocUartCookie = new UartCookie(objects::PLOC_MPSOC_HANDLER, te0720_1cfa::MPSOC_UART,

View File

@ -1,6 +0,0 @@
#!/bin/bash
root="$(pwd)"
ln -s "$root/hooks" "$root/.git/hooks"
git submodule update --init fsfw thirdparty/rapidcsv thirdparty/lwgps thirdparty/json

View File

@ -21,13 +21,10 @@ if(NOT CMAKE_BUILD_TYPE AND NOT CMAKE_CONFIGURATION_TYPES)
) )
endif() endif()
set(RELEASE_BUILD 1 PARENT_SCOPE)
if(${CMAKE_BUILD_TYPE} MATCHES "Debug") if(${CMAKE_BUILD_TYPE} MATCHES "Debug")
message(STATUS message(STATUS
"Building Debug application with flags: ${CMAKE_C_FLAGS_DEBUG}" "Building Debug application with flags: ${CMAKE_C_FLAGS_DEBUG}"
) )
set(RELEASE_BUILD 0 PARENT_SCOPE)
elseif(${CMAKE_BUILD_TYPE} MATCHES "RelWithDebInfo") elseif(${CMAKE_BUILD_TYPE} MATCHES "RelWithDebInfo")
message(STATUS message(STATUS
"Building Release (Debug) application with " "Building Release (Debug) application with "

View File

@ -4,7 +4,7 @@
# 2. Major version # 2. Major version
# 3. Minor version # 3. Minor version
# 4. Revision # 4. Revision
# 5. (Optional) git SHA hash and commits since tag when applicable # 5. git SHA hash and commits since tag
function(determine_version_with_git) function(determine_version_with_git)
include(GetGitRevisionDescription) include(GetGitRevisionDescription)
git_describe(VERSION ${ARGN}) git_describe(VERSION ${ARGN})
@ -22,9 +22,7 @@ function(determine_version_with_git)
list(APPEND GIT_INFO ${_VERSION_MAJOR}) list(APPEND GIT_INFO ${_VERSION_MAJOR})
list(APPEND GIT_INFO ${_VERSION_MINOR}) list(APPEND GIT_INFO ${_VERSION_MINOR})
list(APPEND GIT_INFO ${_VERSION_PATCH}) list(APPEND GIT_INFO ${_VERSION_PATCH})
if(NOT VERSION_SHA1 STREQUAL VERSION)
list(APPEND GIT_INFO ${VERSION_SHA1}) list(APPEND GIT_INFO ${VERSION_SHA1})
endif()
set(GIT_INFO ${GIT_INFO} PARENT_SCOPE) set(GIT_INFO ${GIT_INFO} PARENT_SCOPE)
message(STATUS "eive | Set git version info into GIT_INFO from the git tag ${VERSION}") message(STATUS "eive | Set git version info into GIT_INFO from the git tag ${VERSION}")
endfunction() endfunction()

Some files were not shown because too many files have changed in this diff Show More