v1.12.0 #269
5
.gitmodules
vendored
5
.gitmodules
vendored
@ -11,7 +11,7 @@
|
|||||||
path = thirdparty/lwgps
|
path = thirdparty/lwgps
|
||||||
url = https://github.com/rmspacefish/lwgps.git
|
url = https://github.com/rmspacefish/lwgps.git
|
||||||
[submodule "generators/fsfwgen"]
|
[submodule "generators/fsfwgen"]
|
||||||
path = generators/fsfwgen
|
path = generators/deps/fsfwgen
|
||||||
url = https://egit.irs.uni-stuttgart.de/fsfw/fsfw-gen.git
|
url = https://egit.irs.uni-stuttgart.de/fsfw/fsfw-gen.git
|
||||||
[submodule "thirdparty/arcsec_star_tracker"]
|
[submodule "thirdparty/arcsec_star_tracker"]
|
||||||
path = thirdparty/arcsec_star_tracker
|
path = thirdparty/arcsec_star_tracker
|
||||||
@ -19,3 +19,6 @@
|
|||||||
[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"]
|
||||||
|
path = thirdparty/rapidcsv
|
||||||
|
url = https://github.com/d99kris/rapidcsv.git
|
||||||
|
56
CHANGELOG.md
56
CHANGELOG.md
@ -10,6 +10,62 @@ list yields a list of all related PRs for each release.
|
|||||||
|
|
||||||
# [unreleased]
|
# [unreleased]
|
||||||
|
|
||||||
|
# [v1.12.0] 04.07.2022
|
||||||
|
|
||||||
|
## Added
|
||||||
|
|
||||||
|
- Dummy components to run OBSW without relying on external hardware
|
||||||
|
PR: https://egit.irs.uni-stuttgart.de/eive/eive-obsw/pulls/266
|
||||||
|
- Basic Thermal Controller
|
||||||
|
PR: https://egit.irs.uni-stuttgart.de/eive/eive-obsw/pulls/266
|
||||||
|
- PUS11 TC scheduler
|
||||||
|
PR: https://egit.irs.uni-stuttgart.de/eive/eive-obsw/pulls/259
|
||||||
|
- Regular reboot command
|
||||||
|
PR: https://egit.irs.uni-stuttgart.de/eive/eive-obsw/pulls/242
|
||||||
|
- Commands for individual RTD devices
|
||||||
|
PR: https://egit.irs.uni-stuttgart.de/eive/eive-tmtc/pulls/84
|
||||||
|
- `RwAssembly` added to system components. Assembly works in principle,
|
||||||
|
issues making 4 consecutives RWs communicate at once..
|
||||||
|
PR: https://egit.irs.uni-stuttgart.de/eive/eive-obsw/pulls/224
|
||||||
|
- Adds a yocto helper script which is able to install the release build binaries
|
||||||
|
(OBSW and Watchdog) into the `q7s-yocto` repository as long as the `q7s-package`
|
||||||
|
or `q7s-yocto` repo was cloned in the same directory the EIVE OBSW repo.
|
||||||
|
This makes updating the root filesystem a lot easier. It also creates and installs a
|
||||||
|
version file.
|
||||||
|
PR: https://egit.irs.uni-stuttgart.de/eive/eive-obsw/pulls/248
|
||||||
|
- Create the generic image by default for the Q7S build. The unique binary with the
|
||||||
|
username appended at the end is created as a side-product now
|
||||||
|
PR: https://egit.irs.uni-stuttgart.de/eive/eive-obsw/pulls/248
|
||||||
|
|
||||||
|
## Fixed
|
||||||
|
|
||||||
|
- `q7s-cp.py` bugfix
|
||||||
|
PR: https://egit.irs.uni-stuttgart.de/eive/eive-obsw/pulls/256
|
||||||
|
- Generator scripts output now produce platform-independent artifacts
|
||||||
|
PR: https://egit.irs.uni-stuttgart.de/eive/eive-obsw/pulls/267
|
||||||
|
|
||||||
|
### Heater
|
||||||
|
|
||||||
|
- Adds `HealthIF` to heaters. Heaters are own system object with queues now which allows to set them faulty.
|
||||||
|
- SW will attempt to shut down heaters which are on but marked faulty
|
||||||
|
- Some simplifications for `HeaterHandler`, use `std::vector` instead of `std::unordered_map` for primary container. Using the heater indexes 0 to 7 allows to use natural array indexing
|
||||||
|
- Some additional input sanity checks in `executeAction`
|
||||||
|
PR: https://egit.irs.uni-stuttgart.de/eive/eive-obsw/pulls/236
|
||||||
|
|
||||||
|
## Changed
|
||||||
|
|
||||||
|
- CCSDS handler improvements
|
||||||
|
PR: https://egit.irs.uni-stuttgart.de/eive/eive-obsw/pulls/268
|
||||||
|
- Build unittest as default side product of hosted builds
|
||||||
|
PR: https://egit.irs.uni-stuttgart.de/eive/eive-obsw/pulls/244
|
||||||
|
- Let CI/CD build host build and run unittest side product in same step
|
||||||
|
- Catch2 pre-installed in CI/CD docker container, Xiphos SDK installed in CI/CD docker
|
||||||
|
PR: https://egit.irs.uni-stuttgart.de/eive/eive-obsw/pulls/247
|
||||||
|
- Sun Sensors have names denoting their location and poiting in the satellite now
|
||||||
|
PR: https://egit.irs.uni-stuttgart.de/eive/eive-obsw/pulls/245
|
||||||
|
- Better RTD names denoting their purpose (and location consequently)
|
||||||
|
PR: https://egit.irs.uni-stuttgart.de/eive/eive-obsw/pulls/246
|
||||||
|
|
||||||
# [v1.11.0]
|
# [v1.11.0]
|
||||||
|
|
||||||
## Fixed
|
## Fixed
|
||||||
|
592
CMakeLists.txt
592
CMakeLists.txt
@ -1,12 +1,12 @@
|
|||||||
################################################################################
|
# ##############################################################################
|
||||||
# CMake support for the EIVE OBSW
|
# CMake support for the EIVE OBSW
|
||||||
#
|
#
|
||||||
# Author: R. Mueller
|
# Author: R. Mueller
|
||||||
################################################################################
|
# ##############################################################################
|
||||||
|
|
||||||
################################################################################
|
# ##############################################################################
|
||||||
# Pre-Project preparation
|
# Pre-Project preparation
|
||||||
################################################################################
|
# ##############################################################################
|
||||||
cmake_minimum_required(VERSION 3.13)
|
cmake_minimum_required(VERSION 3.13)
|
||||||
|
|
||||||
set(OBSW_VERSION_MAJOR_IF_GIT_FAILS 0)
|
set(OBSW_VERSION_MAJOR_IF_GIT_FAILS 0)
|
||||||
@ -15,28 +15,36 @@ set(OBSW_VERSION_REVISION_IF_GIT_FAILS 0)
|
|||||||
|
|
||||||
# set(CMAKE_VERBOSE TRUE)
|
# set(CMAKE_VERBOSE TRUE)
|
||||||
|
|
||||||
option(EIVE_HARDCODED_TOOLCHAIN_FILE "\
|
option(
|
||||||
|
EIVE_HARDCODED_TOOLCHAIN_FILE
|
||||||
|
"\
|
||||||
For Linux Board Target BSPs, a default toolchain file will be set. Should be set to OFF \
|
For Linux Board Target BSPs, a default toolchain file will be set. Should be set to OFF \
|
||||||
if a different toolchain file is set externally" ON
|
if a different toolchain file is set externally"
|
||||||
)
|
ON)
|
||||||
|
|
||||||
if(NOT FSFW_OSAL)
|
if(NOT FSFW_OSAL)
|
||||||
set(FSFW_OSAL linux CACHE STRING "OS for the FSFW.")
|
set(FSFW_OSAL
|
||||||
|
linux
|
||||||
|
CACHE STRING "OS for the FSFW.")
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
if(TGT_BSP)
|
if(TGT_BSP)
|
||||||
if(TGT_BSP MATCHES "arm/q7s" OR TGT_BSP MATCHES "arm/raspberrypi" OR TGT_BSP MATCHES "arm/beagleboneblack")
|
if(TGT_BSP MATCHES "arm/q7s"
|
||||||
option(LINUX_CROSS_COMPILE ON)
|
OR TGT_BSP MATCHES "arm/raspberrypi"
|
||||||
endif()
|
OR TGT_BSP MATCHES "arm/beagleboneblack")
|
||||||
if(TGT_BSP MATCHES "arm/raspberrypi" OR TGT_BSP MATCHES "arm/beagleboneblack")
|
option(LINUX_CROSS_COMPILE ON)
|
||||||
option(EIVE_BUILD_GPSD_GPS_HANDLER "Build GPSD dependent GPS Handler" OFF)
|
endif()
|
||||||
elseif(TGT_BSP MATCHES "arm/q7s")
|
if(TGT_BSP MATCHES "arm/raspberrypi" OR TGT_BSP MATCHES "arm/beagleboneblack")
|
||||||
option(EIVE_Q7S_EM "Build configuration for the EM" OFF)
|
option(EIVE_BUILD_GPSD_GPS_HANDLER "Build GPSD dependent GPS Handler" OFF)
|
||||||
option(EIVE_BUILD_GPSD_GPS_HANDLER "Build GPSD dependent GPS Handler" ON)
|
elseif(TGT_BSP MATCHES "arm/q7s")
|
||||||
endif()
|
option(EIVE_Q7S_EM "Build configuration for the EM" OFF)
|
||||||
option(EIVE_CREATE_UNIQUE_OBSW_BIN "Append username to generated binary name" ON)
|
option(EIVE_BUILD_GPSD_GPS_HANDLER "Build GPSD dependent GPS Handler" ON)
|
||||||
|
endif()
|
||||||
|
option(EIVE_CREATE_UNIQUE_OBSW_BIN "Append username to generated binary name"
|
||||||
|
ON)
|
||||||
else()
|
else()
|
||||||
option(EIVE_CREATE_UNIQUE_OBSW_BIN "Append username to generated binary name" OFF)
|
option(EIVE_CREATE_UNIQUE_OBSW_BIN "Append username to generated binary name"
|
||||||
|
OFF)
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
list(APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/cmake")
|
list(APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/cmake")
|
||||||
@ -56,61 +64,99 @@ 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)
|
||||||
|
|
||||||
if(EIVE_Q7S_EM)
|
set(OBSW_MAX_SCHEDULED_TCS 500)
|
||||||
set(OBSW_Q7S_EM 1 CACHE STRING "Q7S EM configuration")
|
|
||||||
set(INIT_VAL 0)
|
|
||||||
else()
|
|
||||||
set(OBSW_Q7S_EM 0 CACHE STRING "Q7S EM configuration")
|
|
||||||
set(INIT_VAL 1)
|
|
||||||
endif()
|
|
||||||
set(OBSW_ADD_MGT ${INIT_VAL} CACHE STRING "Add MGT module" )
|
|
||||||
set(OBSW_ADD_BPX_BATTERY_HANDLER ${INIT_VAL} CACHE STRING "Add MGT module")
|
|
||||||
set(OBSW_ADD_STAR_TRACKER ${INIT_VAL} CACHE STRING "Add Startracker module")
|
|
||||||
set(OBSW_ADD_SUN_SENSORS ${INIT_VAL} CACHE STRING "Add sun sensor module")
|
|
||||||
set(OBSW_ADD_SUS_BOARD_ASS ${INIT_VAL} CACHE STRING "Add sun sensor board assembly")
|
|
||||||
set(OBSW_ADD_ACS_BOARD ${INIT_VAL} CACHE STRING "Add ACS board module")
|
|
||||||
set(OBSW_ADD_ACS_HANDLERS ${INIT_VAL} CACHE STRING "Add ACS handlers")
|
|
||||||
set(OBSW_ADD_RTD_DEVICES ${INIT_VAL} CACHE STRING "Add RTD devices")
|
|
||||||
set(OBSW_ADD_RAD_SENSORS ${INIT_VAL} CACHE STRING "Add Rad Sensor module")
|
|
||||||
set(OBSW_ADD_PL_PCDU ${INIT_VAL} CACHE STRING "Add Payload PCDU modukle")
|
|
||||||
set(OBSW_ADD_SYRLINKS ${INIT_VAL} CACHE STRING "Add Syrlinks module")
|
|
||||||
set(OBSW_ADD_TMP_DEVICES ${INIT_VAL} CACHE STRING "Add TMP devices")
|
|
||||||
set(OBSW_ADD_GOMSPACE_PCDU ${INIT_VAL} CACHE STRING "Add GomSpace PCDU modules")
|
|
||||||
set(OBSW_ADD_RW ${INIT_VAL} CACHE STRING "Add RW modules")
|
|
||||||
|
|
||||||
################################################################################
|
if(EIVE_Q7S_EM)
|
||||||
|
set(OBSW_Q7S_EM
|
||||||
|
1
|
||||||
|
CACHE STRING "Q7S EM configuration")
|
||||||
|
set(INIT_VAL 0)
|
||||||
|
else()
|
||||||
|
set(OBSW_Q7S_EM
|
||||||
|
0
|
||||||
|
CACHE STRING "Q7S EM configuration")
|
||||||
|
set(INIT_VAL 1)
|
||||||
|
endif()
|
||||||
|
set(OBSW_ADD_MGT
|
||||||
|
${INIT_VAL}
|
||||||
|
CACHE STRING "Add MGT module")
|
||||||
|
set(OBSW_ADD_BPX_BATTERY_HANDLER
|
||||||
|
${INIT_VAL}
|
||||||
|
CACHE STRING "Add MGT module")
|
||||||
|
set(OBSW_ADD_STAR_TRACKER
|
||||||
|
${INIT_VAL}
|
||||||
|
CACHE STRING "Add Startracker module")
|
||||||
|
set(OBSW_ADD_SUN_SENSORS
|
||||||
|
${INIT_VAL}
|
||||||
|
CACHE STRING "Add sun sensor module")
|
||||||
|
set(OBSW_ADD_SUS_BOARD_ASS
|
||||||
|
${INIT_VAL}
|
||||||
|
CACHE STRING "Add sun sensor board assembly")
|
||||||
|
set(OBSW_ADD_ACS_BOARD
|
||||||
|
${INIT_VAL}
|
||||||
|
CACHE STRING "Add ACS board module")
|
||||||
|
set(OBSW_ADD_ACS_HANDLERS
|
||||||
|
${INIT_VAL}
|
||||||
|
CACHE STRING "Add ACS handlers")
|
||||||
|
set(OBSW_ADD_RTD_DEVICES
|
||||||
|
${INIT_VAL}
|
||||||
|
CACHE STRING "Add RTD devices")
|
||||||
|
set(OBSW_ADD_RAD_SENSORS
|
||||||
|
${INIT_VAL}
|
||||||
|
CACHE STRING "Add Rad Sensor module")
|
||||||
|
set(OBSW_ADD_PL_PCDU
|
||||||
|
${INIT_VAL}
|
||||||
|
CACHE STRING "Add Payload PCDU modukle")
|
||||||
|
set(OBSW_ADD_SYRLINKS
|
||||||
|
${INIT_VAL}
|
||||||
|
CACHE STRING "Add Syrlinks module")
|
||||||
|
set(OBSW_ADD_TMP_DEVICES
|
||||||
|
${INIT_VAL}
|
||||||
|
CACHE STRING "Add TMP devices")
|
||||||
|
set(OBSW_ADD_GOMSPACE_PCDU
|
||||||
|
${INIT_VAL}
|
||||||
|
CACHE STRING "Add GomSpace PCDU modules")
|
||||||
|
set(OBSW_ADD_RW
|
||||||
|
${INIT_VAL}
|
||||||
|
CACHE STRING "Add RW modules")
|
||||||
|
|
||||||
|
# ##############################################################################
|
||||||
# Pre-Sources preparation
|
# Pre-Sources preparation
|
||||||
################################################################################
|
# ##############################################################################
|
||||||
|
|
||||||
# Version handling
|
# Version handling
|
||||||
set(GIT_VER_HANDLING_OK FALSE)
|
set(GIT_VER_HANDLING_OK FALSE)
|
||||||
if(EXISTS ${CMAKE_CURRENT_SOURCE_DIR}/.git)
|
if(EXISTS ${CMAKE_CURRENT_SOURCE_DIR}/.git)
|
||||||
determine_version_with_git("--exclude" "docker_*")
|
determine_version_with_git("--exclude" "docker_*")
|
||||||
set(GIT_INFO ${GIT_INFO} CACHE STRING "Version information retrieved with git describe")
|
set(GIT_INFO
|
||||||
if(GIT_INFO)
|
${GIT_INFO}
|
||||||
set(GIT_INFO ${GIT_INFO} CACHE STRING "Version information retrieved with git describe")
|
CACHE STRING "Version information retrieved with git describe")
|
||||||
list(GET GIT_INFO 1 OBSW_VERSION_MAJOR)
|
if(GIT_INFO)
|
||||||
list(GET GIT_INFO 2 OBSW_VERSION_MINOR)
|
set(GIT_INFO
|
||||||
list(GET GIT_INFO 3 OBSW_VERSION_REVISION)
|
${GIT_INFO}
|
||||||
list(GET GIT_INFO 4 OBSW_VERSION_CST_GIT_SHA1)
|
CACHE STRING "Version information retrieved with git describe")
|
||||||
if(NOT OBSW_VERSION_MAJOR)
|
list(GET GIT_INFO 1 OBSW_VERSION_MAJOR)
|
||||||
set(OBSW_VERSION_MAJOR ${OBSW_VERSION_MAJOR_IF_GIT_FAILS})
|
list(GET GIT_INFO 2 OBSW_VERSION_MINOR)
|
||||||
endif()
|
list(GET GIT_INFO 3 OBSW_VERSION_REVISION)
|
||||||
if(NOT OBSW_VERSION_MINOR)
|
list(GET GIT_INFO 4 OBSW_VERSION_CST_GIT_SHA1)
|
||||||
set(FSFW_SUBVERSION ${OBSW_VERSION_MINOR_IF_GIT_FAILS})
|
if(NOT OBSW_VERSION_MAJOR)
|
||||||
endif()
|
set(OBSW_VERSION_MAJOR ${OBSW_VERSION_MAJOR_IF_GIT_FAILS})
|
||||||
if(NOT OBSW_VERSION_REVISION)
|
endif()
|
||||||
set(FSFW_REVISION ${OBSW_VERSION_REVISION_IF_GIT_FAILS})
|
if(NOT OBSW_VERSION_MINOR)
|
||||||
endif()
|
set(FSFW_SUBVERSION ${OBSW_VERSION_MINOR_IF_GIT_FAILS})
|
||||||
set(GIT_VER_HANDLING_OK TRUE)
|
endif()
|
||||||
else()
|
if(NOT OBSW_VERSION_REVISION)
|
||||||
set(GIT_VER_HANDLING_OK FALSE)
|
set(FSFW_REVISION ${OBSW_VERSION_REVISION_IF_GIT_FAILS})
|
||||||
endif()
|
endif()
|
||||||
|
set(GIT_VER_HANDLING_OK TRUE)
|
||||||
|
else()
|
||||||
|
set(GIT_VER_HANDLING_OK FALSE)
|
||||||
|
endif()
|
||||||
endif()
|
endif()
|
||||||
if(NOT GIT_VER_HANDLING_OK)
|
if(NOT GIT_VER_HANDLING_OK)
|
||||||
set(OBSW_VERSION_MAJOR ${OBSW_VERSION_MAJOR_IF_GIT_FAILS})
|
set(OBSW_VERSION_MAJOR ${OBSW_VERSION_MAJOR_IF_GIT_FAILS})
|
||||||
set(OBSW_VERSION_MINOR ${OBSW_VERSION_MINOR_IF_GIT_FAILS})
|
set(OBSW_VERSION_MINOR ${OBSW_VERSION_MINOR_IF_GIT_FAILS})
|
||||||
set(OBSW_VERSION_REVISION ${OBSW_VERSION_REVISION_IF_GIT_FAILS})
|
set(OBSW_VERSION_REVISION ${OBSW_VERSION_REVISION_IF_GIT_FAILS})
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
# Set names and variables
|
# Set names and variables
|
||||||
@ -129,6 +175,7 @@ set(LIB_CXX_FS -lstdc++fs)
|
|||||||
set(LIB_CATCH2 Catch2)
|
set(LIB_CATCH2 Catch2)
|
||||||
set(LIB_GPS gps)
|
set(LIB_GPS gps)
|
||||||
set(LIB_JSON_NAME nlohmann_json::nlohmann_json)
|
set(LIB_JSON_NAME nlohmann_json::nlohmann_json)
|
||||||
|
set(LIB_DUMMIES dummies)
|
||||||
|
|
||||||
# Set path names
|
# Set path names
|
||||||
set(FSFW_PATH fsfw)
|
set(FSFW_PATH fsfw)
|
||||||
@ -136,6 +183,7 @@ set(TEST_PATH test)
|
|||||||
set(UNITTEST_PATH unittest)
|
set(UNITTEST_PATH unittest)
|
||||||
set(LINUX_PATH linux)
|
set(LINUX_PATH linux)
|
||||||
set(COMMON_PATH common)
|
set(COMMON_PATH common)
|
||||||
|
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)
|
||||||
@ -156,167 +204,163 @@ set(EIVE_ADD_LINUX_FILES False)
|
|||||||
pre_source_hw_os_config()
|
pre_source_hw_os_config()
|
||||||
|
|
||||||
if(TGT_BSP)
|
if(TGT_BSP)
|
||||||
|
set(LIBGPS_VERSION_MAJOR 3)
|
||||||
|
# I assume a newer version than 3.17 will be installed on other Linux board
|
||||||
|
# than the Q7S
|
||||||
|
set(LIBGPS_VERSION_MINOR 20)
|
||||||
|
if(TGT_BSP MATCHES "arm/q7s"
|
||||||
|
OR TGT_BSP MATCHES "arm/raspberrypi"
|
||||||
|
OR TGT_BSP MATCHES "arm/beagleboneblack"
|
||||||
|
OR TGT_BSP MATCHES "arm/egse"
|
||||||
|
OR TGT_BSP MATCHES "arm/te0720-1cfa")
|
||||||
|
find_library(${LIB_GPS} gps)
|
||||||
|
set(FSFW_CONFIG_PATH "linux/fsfwconfig")
|
||||||
|
if(NOT BUILD_Q7S_SIMPLE_MODE)
|
||||||
|
set(EIVE_ADD_LINUX_FILES TRUE)
|
||||||
|
set(ADD_CSP_LIB TRUE)
|
||||||
|
set(FSFW_HAL_ADD_LINUX ON)
|
||||||
|
endif()
|
||||||
|
endif()
|
||||||
|
|
||||||
|
if(TGT_BSP MATCHES "arm/raspberrypi")
|
||||||
|
# Used by configure file
|
||||||
|
set(RASPBERRY_PI ON)
|
||||||
|
set(FSFW_HAL_ADD_RASPBERRY_PI ON)
|
||||||
|
endif()
|
||||||
|
|
||||||
|
if(TGT_BSP MATCHES "arm/egse")
|
||||||
|
# Used by configure file
|
||||||
|
set(EGSE ON)
|
||||||
|
set(FSFW_HAL_LINUX_ADD_LIBGPIOD OFF)
|
||||||
|
set(OBSW_ADD_STAR_TRACKER 1)
|
||||||
|
set(OBSW_DEBUG_STARTRACKER 1)
|
||||||
|
endif()
|
||||||
|
|
||||||
|
if(TGT_BSP MATCHES "arm/beagleboneblack")
|
||||||
|
# Used by configure file
|
||||||
|
set(BEAGLEBONEBLACK ON)
|
||||||
|
endif()
|
||||||
|
|
||||||
|
if(TGT_BSP MATCHES "arm/q7s")
|
||||||
|
# Used by configure file
|
||||||
|
set(XIPHOS_Q7S ON)
|
||||||
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 than the Q7S
|
set(LIBGPS_VERSION_MINOR 17)
|
||||||
set(LIBGPS_VERSION_MINOR 20)
|
endif()
|
||||||
if(TGT_BSP MATCHES "arm/q7s" OR TGT_BSP MATCHES "arm/raspberrypi"
|
|
||||||
OR TGT_BSP MATCHES "arm/beagleboneblack" OR TGT_BSP MATCHES "arm/egse"
|
|
||||||
OR TGT_BSP MATCHES "arm/te0720-1cfa"
|
|
||||||
)
|
|
||||||
find_library(${LIB_GPS} gps)
|
|
||||||
set(FSFW_CONFIG_PATH "linux/fsfwconfig")
|
|
||||||
if(NOT BUILD_Q7S_SIMPLE_MODE)
|
|
||||||
set(EIVE_ADD_LINUX_FILES TRUE)
|
|
||||||
set(ADD_CSP_LIB TRUE)
|
|
||||||
set(FSFW_HAL_ADD_LINUX ON)
|
|
||||||
endif()
|
|
||||||
endif()
|
|
||||||
|
|
||||||
if(TGT_BSP MATCHES "arm/raspberrypi" )
|
|
||||||
# Used by configure file
|
|
||||||
set(RASPBERRY_PI ON)
|
|
||||||
set(FSFW_HAL_ADD_RASPBERRY_PI ON)
|
|
||||||
endif()
|
|
||||||
|
|
||||||
if(TGT_BSP MATCHES "arm/egse")
|
if(TGT_BSP MATCHES "arm/te0720-1cfa")
|
||||||
# Used by configure file
|
set(TE0720_1CFA ON)
|
||||||
set(EGSE ON)
|
endif()
|
||||||
set(FSFW_HAL_LINUX_ADD_LIBGPIOD OFF)
|
|
||||||
set(OBSW_ADD_STAR_TRACKER 1)
|
|
||||||
set(OBSW_DEBUG_STARTRACKER 1)
|
|
||||||
endif()
|
|
||||||
|
|
||||||
if(TGT_BSP MATCHES "arm/beagleboneblack")
|
|
||||||
# Used by configure file
|
|
||||||
set(BEAGLEBONEBLACK ON)
|
|
||||||
endif()
|
|
||||||
|
|
||||||
if(TGT_BSP MATCHES "arm/q7s")
|
|
||||||
# Used by configure file
|
|
||||||
set(XIPHOS_Q7S ON)
|
|
||||||
set(LIBGPS_VERSION_MAJOR 3)
|
|
||||||
set(LIBGPS_VERSION_MINOR 17)
|
|
||||||
endif()
|
|
||||||
|
|
||||||
if(TGT_BSP MATCHES "arm/te0720-1cfa")
|
|
||||||
set(TE0720_1CFA ON)
|
|
||||||
endif()
|
|
||||||
else()
|
else()
|
||||||
# Required by FSFW library
|
# Required by FSFW library
|
||||||
set(FSFW_CONFIG_PATH "${BSP_PATH}/fsfwconfig")
|
set(FSFW_CONFIG_PATH "${BSP_PATH}/fsfwconfig")
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
|
|
||||||
# Configuration files
|
# Configuration files
|
||||||
configure_file(${COMMON_CONFIG_PATH}/commonConfig.h.in commonConfig.h)
|
configure_file(${COMMON_CONFIG_PATH}/commonConfig.h.in commonConfig.h)
|
||||||
configure_file(${FSFW_CONFIG_PATH}/FSFWConfig.h.in FSFWConfig.h)
|
configure_file(${FSFW_CONFIG_PATH}/FSFWConfig.h.in FSFWConfig.h)
|
||||||
configure_file(${BSP_PATH}/OBSWConfig.h.in OBSWConfig.h)
|
configure_file(${BSP_PATH}/OBSWConfig.h.in OBSWConfig.h)
|
||||||
if(TGT_BSP MATCHES "arm/q7s")
|
if(TGT_BSP MATCHES "arm/q7s")
|
||||||
configure_file(${BSP_PATH}/boardconfig/q7sConfig.h.in q7sConfig.h)
|
configure_file(${BSP_PATH}/boardconfig/q7sConfig.h.in q7sConfig.h)
|
||||||
elseif(TGT_BSP MATCHES "arm/raspberrypi" OR TGT_BSP MATCHES "arm/egse")
|
elseif(TGT_BSP MATCHES "arm/raspberrypi" OR TGT_BSP MATCHES "arm/egse")
|
||||||
configure_file(${BSP_PATH}/boardconfig/rpiConfig.h.in rpiConfig.h)
|
configure_file(${BSP_PATH}/boardconfig/rpiConfig.h.in rpiConfig.h)
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
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
|
set(FSFW_ADDITIONAL_INC_PATHS "${COMMON_PATH}/config"
|
||||||
"${COMMON_PATH}/config"
|
${CMAKE_CURRENT_BINARY_DIR})
|
||||||
${CMAKE_CURRENT_BINARY_DIR}
|
|
||||||
)
|
|
||||||
|
|
||||||
################################################################################
|
# ##############################################################################
|
||||||
# Executable and Sources
|
# Executable and Sources
|
||||||
################################################################################
|
# ##############################################################################
|
||||||
|
|
||||||
#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")
|
||||||
add_compile_options(
|
add_compile_options(
|
||||||
"-Wall"
|
"-Wall"
|
||||||
"-Wextra"
|
"-Wextra"
|
||||||
"-Wimplicit-fallthrough=1"
|
"-Wimplicit-fallthrough=1"
|
||||||
"-Wno-unused-parameter"
|
"-Wno-unused-parameter"
|
||||||
"-Wno-psabi"
|
"-Wno-psabi"
|
||||||
"-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
|
||||||
"-Wnull-dereference" # Search for NULL dereference
|
"-Wnull-dereference" # Search for NULL dereference
|
||||||
"-Wundef" # Warn if undefind marcos are used
|
"-Wundef" # Warn if undefind marcos are used
|
||||||
"-Wformat=2" # Format string problem detection
|
"-Wformat=2" # Format string problem detection
|
||||||
"-Wformat-overflow=2" # Formatting issues in printf
|
"-Wformat-overflow=2" # Formatting issues in printf
|
||||||
"-Wformat-truncation=2" # Formatting issues in printf
|
"-Wformat-truncation=2" # Formatting issues in printf
|
||||||
"-Wformat-security" # Search for dangerous printf operations
|
"-Wformat-security" # Search for dangerous printf operations
|
||||||
"-Wstrict-overflow=3" # Warn if integer overflows might happen
|
"-Wstrict-overflow=3" # Warn if integer overflows might happen
|
||||||
"-Warray-bounds=2" # Some array bounds violations will be found
|
"-Warray-bounds=2" # Some array bounds violations will be found
|
||||||
"-Wshift-overflow=2" # Search for bit left shift overflows (<c++14)
|
"-Wshift-overflow=2" # Search for bit left shift overflows (<c++14)
|
||||||
"-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
|
# -Wconversion # Creates many false positives -Warith-conversion # Use with
|
||||||
# -Warith-conversion # Use with Wconversion to find more implicit conversions
|
# Wconversion to find more implicit conversions -fanalyzer # Should be used
|
||||||
# -fanalyzer # Should be used to look through problems
|
# to look through problems
|
||||||
)
|
)
|
||||||
# Remove unused sections.
|
# Remove unused sections.
|
||||||
add_compile_options(
|
add_compile_options("-ffunction-sections" "-fdata-sections")
|
||||||
"-ffunction-sections"
|
|
||||||
"-fdata-sections"
|
|
||||||
)
|
|
||||||
|
|
||||||
# Removed unused sections.
|
# Removed unused sections.
|
||||||
add_link_options(
|
add_link_options("-Wl,--gc-sections")
|
||||||
"-Wl,--gc-sections"
|
|
||||||
)
|
|
||||||
|
|
||||||
elseif(CMAKE_CXX_COMPILER_ID STREQUAL "MSVC")
|
elseif(CMAKE_CXX_COMPILER_ID STREQUAL "MSVC")
|
||||||
set(COMPILER_FLAGS "/permissive-")
|
set(COMPILER_FLAGS "/permissive-")
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
add_library(${LIB_EIVE_MISSION})
|
add_library(${LIB_EIVE_MISSION})
|
||||||
|
add_library(${LIB_DUMMIES})
|
||||||
|
|
||||||
# Add main executable
|
# Add main executable
|
||||||
add_executable(${OBSW_NAME})
|
add_executable(${OBSW_NAME})
|
||||||
if(EIVE_CREATE_UNIQUE_OBSW_BIN)
|
set(OBSW_BIN_NAME ${CMAKE_PROJECT_NAME})
|
||||||
set(OBSW_BIN_NAME ${CMAKE_PROJECT_NAME}-$ENV{USERNAME})
|
|
||||||
else()
|
|
||||||
set(OBSW_BIN_NAME ${CMAKE_PROJECT_NAME})
|
|
||||||
endif()
|
|
||||||
set_target_properties(${OBSW_NAME} PROPERTIES OUTPUT_NAME ${OBSW_BIN_NAME})
|
set_target_properties(${OBSW_NAME} PROPERTIES OUTPUT_NAME ${OBSW_BIN_NAME})
|
||||||
|
|
||||||
# Watchdog
|
# Watchdog
|
||||||
if(TGT_BSP MATCHES "arm/q7s")
|
if(TGT_BSP MATCHES "arm/q7s")
|
||||||
add_executable(${WATCHDOG_NAME})
|
add_executable(${WATCHDOG_NAME})
|
||||||
else()
|
else()
|
||||||
add_executable(${WATCHDOG_NAME} EXCLUDE_FROM_ALL)
|
add_executable(${WATCHDOG_NAME} EXCLUDE_FROM_ALL)
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
add_subdirectory(${WATCHDOG_PATH})
|
add_subdirectory(${WATCHDOG_PATH})
|
||||||
target_link_libraries(${WATCHDOG_NAME} PUBLIC
|
target_link_libraries(${WATCHDOG_NAME} PUBLIC ${LIB_CXX_FS})
|
||||||
${LIB_CXX_FS}
|
target_include_directories(${WATCHDOG_NAME} PUBLIC ${CMAKE_BINARY_DIR})
|
||||||
)
|
|
||||||
target_include_directories(${WATCHDOG_NAME} PUBLIC
|
|
||||||
${CMAKE_BINARY_DIR}
|
|
||||||
)
|
|
||||||
|
|
||||||
# unittests
|
# unittests
|
||||||
add_executable(${UNITTEST_NAME} EXCLUDE_FROM_ALL)
|
if(NOT TGT_BSP)
|
||||||
|
add_executable(${UNITTEST_NAME})
|
||||||
|
else()
|
||||||
|
add_executable(${UNITTEST_NAME} EXCLUDE_FROM_ALL)
|
||||||
|
endif()
|
||||||
|
|
||||||
if(EIVE_ADD_ETL_LIB)
|
if(EIVE_ADD_ETL_LIB)
|
||||||
|
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
if(EIVE_ADD_JSON_LIB)
|
if(EIVE_ADD_JSON_LIB)
|
||||||
add_subdirectory(${LIB_JSON_PATH})
|
add_subdirectory(${LIB_JSON_PATH})
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
|
add_subdirectory(thirdparty/rapidcsv)
|
||||||
|
|
||||||
if(EIVE_ADD_LINUX_FILES)
|
if(EIVE_ADD_LINUX_FILES)
|
||||||
add_subdirectory(${LIB_ARCSEC_PATH})
|
add_subdirectory(${LIB_ARCSEC_PATH})
|
||||||
add_subdirectory(${LINUX_PATH})
|
add_subdirectory(${LINUX_PATH})
|
||||||
endif()
|
endif()
|
||||||
add_subdirectory(${BSP_PATH})
|
add_subdirectory(${BSP_PATH})
|
||||||
if(ADD_CSP_LIB)
|
if(ADD_CSP_LIB)
|
||||||
add_subdirectory(${LIB_CSP_PATH})
|
add_subdirectory(${LIB_CSP_PATH})
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
add_subdirectory(${COMMON_PATH})
|
add_subdirectory(${COMMON_PATH})
|
||||||
|
add_subdirectory(${DUMMY_PATH})
|
||||||
|
|
||||||
add_subdirectory(${LIB_LWGPS_PATH})
|
add_subdirectory(${LIB_LWGPS_PATH})
|
||||||
add_subdirectory(${FSFW_PATH})
|
add_subdirectory(${FSFW_PATH})
|
||||||
@ -325,174 +369,150 @@ add_subdirectory(${TEST_PATH})
|
|||||||
|
|
||||||
add_subdirectory(${UNITTEST_PATH})
|
add_subdirectory(${UNITTEST_PATH})
|
||||||
|
|
||||||
# This should have already been downloaded by the FSFW
|
# This should have already been downloaded by the FSFW Still include it to be
|
||||||
# Still include it to be safe
|
# safe
|
||||||
find_package(etl ${FSFW_ETL_LIB_MAJOR_VERSION} CONFIG QUIET)
|
find_package(etl ${FSFW_ETL_LIB_MAJOR_VERSION} CONFIG QUIET)
|
||||||
# Not installed, so use FetchContent to download and provide etl
|
# Not installed, so use FetchContent to download and provide etl
|
||||||
if(NOT etl_FOUND)
|
if(NOT etl_FOUND)
|
||||||
message(STATUS
|
message(
|
||||||
"No ETL installation was found with find_package. Installing and providing "
|
STATUS
|
||||||
"etl with FindPackage"
|
"No ETL installation was found with find_package. Installing and providing "
|
||||||
)
|
"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") AND NOT(TGT_BSP MATCHES "arm/q7s")
|
if(NOT (TGT_BSP MATCHES "arm/te0720-1cfa")
|
||||||
AND NOT (TGT_BSP MATCHES "arm/raspberrypi"))
|
AND NOT (TGT_BSP MATCHES "arm/q7s")
|
||||||
# Check whether the user has already installed Catch2 first
|
AND NOT (TGT_BSP MATCHES "arm/raspberrypi"))
|
||||||
find_package(Catch2 ${FSFW_CATCH2_LIB_MAJOR_VERSION} CONFIG QUIET)
|
# Check whether the user has already installed Catch2 first
|
||||||
# Not installed, so use FetchContent to download and provide Catch2
|
find_package(Catch2 ${FSFW_CATCH2_LIB_MAJOR_VERSION} CONFIG QUIET)
|
||||||
if(NOT Catch2_FOUND)
|
# Not installed, so use FetchContent to download and provide Catch2
|
||||||
message(STATUS "${MSG_PREFIX} Catch2 installation not found. Downloading Catch2 library with FetchContent")
|
if(NOT Catch2_FOUND)
|
||||||
include(FetchContent)
|
message(
|
||||||
|
STATUS
|
||||||
|
"${MSG_PREFIX} Catch2 installation not found. Downloading Catch2 library with FetchContent"
|
||||||
|
)
|
||||||
|
include(FetchContent)
|
||||||
|
|
||||||
FetchContent_Declare(
|
FetchContent_Declare(
|
||||||
Catch2
|
Catch2
|
||||||
GIT_REPOSITORY https://github.com/catchorg/Catch2.git
|
GIT_REPOSITORY https://github.com/catchorg/Catch2.git
|
||||||
GIT_TAG ${FSFW_CATCH2_LIB_VERSION}
|
GIT_TAG ${FSFW_CATCH2_LIB_VERSION})
|
||||||
)
|
|
||||||
|
|
||||||
list(APPEND FSFW_FETCH_CONTENT_TARGETS Catch2)
|
list(APPEND FSFW_FETCH_CONTENT_TARGETS Catch2)
|
||||||
endif()
|
endif()
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
# The documentation for FetchContent recommends declaring all the dependencies
|
# The documentation for FetchContent recommends declaring all the dependencies
|
||||||
# before making them available. We make all declared dependency available here
|
# before making them available. We make all declared dependency available here
|
||||||
# after their declaration
|
# after their declaration
|
||||||
if(FSFW_FETCH_CONTENT_TARGETS)
|
if(FSFW_FETCH_CONTENT_TARGETS)
|
||||||
FetchContent_MakeAvailable(${FSFW_FETCH_CONTENT_TARGETS})
|
FetchContent_MakeAvailable(${FSFW_FETCH_CONTENT_TARGETS})
|
||||||
if(TARGET etl)
|
if(TARGET etl)
|
||||||
add_library(${LIB_ETL_TARGET} ALIAS etl)
|
add_library(${LIB_ETL_TARGET} ALIAS etl)
|
||||||
endif()
|
endif()
|
||||||
if(TARGET Catch2)
|
if(TARGET Catch2)
|
||||||
# Fixes regression -preview4, to be confirmed in later releases
|
# Fixes regression -preview4, to be confirmed in later releases Related
|
||||||
# Related GitHub issue: https://github.com/catchorg/Catch2/issues/2417
|
# GitHub issue: https://github.com/catchorg/Catch2/issues/2417
|
||||||
set_target_properties(Catch2 PROPERTIES DEBUG_POSTFIX "")
|
set_target_properties(Catch2 PROPERTIES DEBUG_POSTFIX "")
|
||||||
set_target_properties(Catch2 PROPERTIES EXCLUDE_FROM_ALL "true")
|
set_target_properties(Catch2 PROPERTIES EXCLUDE_FROM_ALL "true")
|
||||||
set_target_properties(Catch2WithMain PROPERTIES EXCLUDE_FROM_ALL "true")
|
set_target_properties(Catch2WithMain PROPERTIES EXCLUDE_FROM_ALL "true")
|
||||||
endif()
|
endif()
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
################################################################################
|
# ##############################################################################
|
||||||
# Post-Sources preparation
|
# Post-Sources preparation
|
||||||
################################################################################
|
# ##############################################################################
|
||||||
|
|
||||||
# Add libraries
|
# Add libraries
|
||||||
target_link_libraries(${LIB_EIVE_MISSION} PUBLIC
|
target_link_libraries(${LIB_EIVE_MISSION}
|
||||||
${LIB_FSFW_NAME}
|
PUBLIC ${LIB_FSFW_NAME} ${LIB_LWGPS_NAME} ${LIB_OS_NAME})
|
||||||
${LIB_LWGPS_NAME}
|
|
||||||
${LIB_OS_NAME}
|
|
||||||
)
|
|
||||||
|
|
||||||
target_link_libraries(${OBSW_NAME} PRIVATE
|
target_link_libraries(${LIB_DUMMIES} PUBLIC ${LIB_FSFW_NAME} ${LIB_JSON_NAME})
|
||||||
${LIB_EIVE_MISSION}
|
|
||||||
)
|
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
|
target_link_libraries(${LIB_EIVE_MISSION} PUBLIC ${LIB_GPS} ${LIB_ARCSEC})
|
||||||
${LIB_GPS}
|
|
||||||
${LIB_ARCSEC}
|
|
||||||
)
|
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
target_link_libraries(${UNITTEST_NAME} PRIVATE
|
target_link_libraries(${UNITTEST_NAME} PRIVATE Catch2 ${LIB_EIVE_MISSION}
|
||||||
Catch2
|
rapidcsv ${LIB_DUMMIES})
|
||||||
${LIB_EIVE_MISSION}
|
|
||||||
)
|
|
||||||
|
|
||||||
if(TGT_BSP MATCHES "arm/egse")
|
if(TGT_BSP MATCHES "arm/egse")
|
||||||
target_link_libraries(${OBSW_NAME} PRIVATE
|
target_link_libraries(${OBSW_NAME} PRIVATE ${LIB_ARCSEC})
|
||||||
${LIB_ARCSEC}
|
|
||||||
)
|
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
if(ADD_CSP_LIB)
|
if(ADD_CSP_LIB)
|
||||||
target_link_libraries(${OBSW_NAME} PRIVATE
|
target_link_libraries(${OBSW_NAME} PRIVATE ${LIB_CSP_NAME})
|
||||||
${LIB_CSP_NAME}
|
|
||||||
)
|
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
|
|
||||||
if(EIVE_ADD_ETL_LIB)
|
if(EIVE_ADD_ETL_LIB)
|
||||||
target_link_libraries(${LIB_EIVE_MISSION} PUBLIC
|
target_link_libraries(${LIB_EIVE_MISSION} PUBLIC ${LIB_ETL_TARGET})
|
||||||
${LIB_ETL_TARGET}
|
|
||||||
)
|
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
if(EIVE_ADD_JSON_LIB)
|
if(EIVE_ADD_JSON_LIB)
|
||||||
target_link_libraries(${LIB_EIVE_MISSION} PUBLIC
|
target_link_libraries(${LIB_EIVE_MISSION} PUBLIC ${LIB_JSON_NAME})
|
||||||
${LIB_JSON_NAME}
|
|
||||||
)
|
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
target_link_libraries(${LIB_EIVE_MISSION} PUBLIC
|
target_link_libraries(${LIB_EIVE_MISSION} PUBLIC ${LIB_CXX_FS})
|
||||||
${LIB_CXX_FS}
|
|
||||||
)
|
|
||||||
|
|
||||||
# Add include paths for all sources.
|
# Add include paths for all sources.
|
||||||
target_include_directories(${LIB_EIVE_MISSION} PUBLIC
|
target_include_directories(
|
||||||
${CMAKE_CURRENT_SOURCE_DIR}
|
${LIB_EIVE_MISSION} PUBLIC ${CMAKE_CURRENT_SOURCE_DIR} ${FSFW_CONFIG_PATH}
|
||||||
${FSFW_CONFIG_PATH}
|
${CMAKE_CURRENT_BINARY_DIR} ${LIB_ARCSEC_PATH})
|
||||||
${CMAKE_CURRENT_BINARY_DIR}
|
|
||||||
${LIB_ARCSEC_PATH}
|
target_include_directories(
|
||||||
)
|
${LIB_DUMMIES} PUBLIC ${CMAKE_CURRENT_SOURCE_DIR} ${FSFW_CONFIG_PATH}
|
||||||
|
${CMAKE_CURRENT_BINARY_DIR})
|
||||||
|
|
||||||
if(TGT_BSP MATCHES "arm/q7s" OR TGT_BSP MATCHES "arm/egse")
|
if(TGT_BSP MATCHES "arm/q7s" OR TGT_BSP MATCHES "arm/egse")
|
||||||
target_include_directories(${LIB_EIVE_MISSION} PUBLIC
|
target_include_directories(${LIB_EIVE_MISSION} PUBLIC ${ARCSEC_LIB_PATH})
|
||||||
${ARCSEC_LIB_PATH}
|
|
||||||
)
|
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
if(CMAKE_VERBOSE)
|
if(CMAKE_VERBOSE)
|
||||||
message(STATUS "Warning flags: ${WARNING_FLAGS}")
|
message(STATUS "Warning flags: ${WARNING_FLAGS}")
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
if(CMAKE_CROSSCOMPILING)
|
if(CMAKE_CROSSCOMPILING)
|
||||||
include (HardwareOsPostConfig)
|
include(HardwareOsPostConfig)
|
||||||
post_source_hw_os_config()
|
post_source_hw_os_config()
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
if(NOT CMAKE_SIZE)
|
if(NOT CMAKE_SIZE)
|
||||||
set(CMAKE_SIZE size)
|
set(CMAKE_SIZE size)
|
||||||
if(WIN32)
|
if(WIN32)
|
||||||
set(FILE_SUFFIX ".exe")
|
set(FILE_SUFFIX ".exe")
|
||||||
endif()
|
endif()
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
if(EIVE_BUILD_WATCHDOG)
|
if(EIVE_BUILD_WATCHDOG)
|
||||||
set(TARGET_STRING "OBSW Watchdog")
|
set(TARGET_STRING "OBSW Watchdog")
|
||||||
else()
|
else()
|
||||||
if(TGT_BSP)
|
if(TGT_BSP)
|
||||||
set(TARGET_STRING "Target BSP: ${TGT_BSP}")
|
set(TARGET_STRING "Target BSP: ${TGT_BSP}")
|
||||||
else()
|
else()
|
||||||
set(TARGET_STRING "Target BSP: Hosted")
|
set(TARGET_STRING "Target BSP: Hosted")
|
||||||
endif()
|
endif()
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
install(TARGETS ${OBSW_NAME} RUNTIME DESTINATION bin)
|
install(TARGETS ${OBSW_NAME} RUNTIME DESTINATION bin)
|
||||||
|
|
||||||
string(CONCAT POST_BUILD_COMMENT
|
string(CONCAT POST_BUILD_COMMENT "Build directory: ${CMAKE_BINARY_DIR}\n"
|
||||||
"Build directory: ${CMAKE_BINARY_DIR}\n"
|
"Target OSAL: ${FSFW_OSAL}\n"
|
||||||
"Target OSAL: ${FSFW_OSAL}\n"
|
"Target Build Type: ${CMAKE_BUILD_TYPE}\n" "${TARGET_STRING}")
|
||||||
"Target Build Type: ${CMAKE_BUILD_TYPE}\n"
|
|
||||||
"${TARGET_STRING}"
|
|
||||||
)
|
|
||||||
|
|
||||||
add_custom_command(
|
add_custom_command(
|
||||||
TARGET ${OBSW_NAME}
|
TARGET ${OBSW_NAME}
|
||||||
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)
|
include(BuildType)
|
||||||
set_build_type()
|
set_build_type()
|
||||||
|
129
README.md
129
README.md
@ -70,8 +70,9 @@ prerequisites.
|
|||||||
## Building the OBSW and flashing it on the Q7S
|
## Building the OBSW and flashing it on the Q7S
|
||||||
|
|
||||||
1. ARM cross-compiler installed, either as part of [Vivado 2018.2 installation](#vivado) or
|
1. ARM cross-compiler installed, either as part of [Vivado 2018.2 installation](#vivado) or
|
||||||
as a [separate download](#arm-toolchain)
|
as a [separate download](#arm-toolchain). The Xiphos SDK also installs a cross-compiler,
|
||||||
2. [Q7S sysroot](#sysroot) on local development machine
|
but its version is currently too old to compile the OBSW (7.3.0).
|
||||||
|
2. [Q7S sysroot](#sysroot) on local development machine. It is installed by the Xiphos SDK
|
||||||
3. Recommended: Eclipse or [Vivado 2018.2 SDK](#vivado) for OBSW development
|
3. Recommended: Eclipse or [Vivado 2018.2 SDK](#vivado) for OBSW development
|
||||||
3. [TCF agent](https://wiki.eclipse.org/TCF) running on Q7S
|
3. [TCF agent](https://wiki.eclipse.org/TCF) running on Q7S
|
||||||
|
|
||||||
@ -88,7 +89,7 @@ When using Windows, run theses steps in MSYS2.
|
|||||||
1. Clone the repository with
|
1. Clone the repository with
|
||||||
|
|
||||||
```sh
|
```sh
|
||||||
git clone https://egit.irs.uni-stuttgart.de/eive/eive_obsw.git
|
git clone https://egit.irs.uni-stuttgart.de/eive/eive-obsw.git
|
||||||
```
|
```
|
||||||
|
|
||||||
2. Update all the submodules
|
2. Update all the submodules
|
||||||
@ -143,7 +144,7 @@ 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`.
|
||||||
|
|
||||||
5. Build the software with
|
5. Build the software with
|
||||||
|
|
||||||
```sh
|
```sh
|
||||||
@ -151,6 +152,53 @@ When using Windows, run theses steps in MSYS2.
|
|||||||
cmake --build . -j
|
cmake --build . -j
|
||||||
```
|
```
|
||||||
|
|
||||||
|
## Build for the Q7S target root filesystem with `yocto`
|
||||||
|
|
||||||
|
The EIVE root filesystem will contain the EIVE OBSW and the Watchdog component.
|
||||||
|
It is currently generated with `yocto`, but the tool can not compile the primary
|
||||||
|
OBSW due to toolchain version incompatibility. Therefore, the OBSW components
|
||||||
|
are currently compiled using the toolchain specified in this README (e.g. installed by Vivado).
|
||||||
|
|
||||||
|
However, it is still possible to install the two components using yocto. A few helper files were
|
||||||
|
provided to make this process easier. The following steps can be used to install the OBSW
|
||||||
|
components and a version file to the yocto sources for the generation of the complete EIVE root
|
||||||
|
file system image. The steps here are shown for Ubuntu, you can use the according Windows
|
||||||
|
helper scripts as well.
|
||||||
|
|
||||||
|
1. Copy the `q7s-env.sh` script to the same layer as the `eive-obsw`.
|
||||||
|
|
||||||
|
```sh
|
||||||
|
cp scripts/q7s-env.sh ..
|
||||||
|
cd ..
|
||||||
|
./q7s-env.sh
|
||||||
|
q7s-make-release.sh
|
||||||
|
```
|
||||||
|
|
||||||
|
2. Compile the OBSW components in release mode
|
||||||
|
|
||||||
|
```sh
|
||||||
|
cd cmake-build-release-q7s
|
||||||
|
cmake --build . -j
|
||||||
|
```
|
||||||
|
|
||||||
|
3. Make sure the [`q7s-yocto`](https://egit.irs.uni-stuttgart.de/eive/q7s-yocto)
|
||||||
|
repository or the [`q7s-package`](https://egit.irs.uni-stuttgart.de/eive/q7s-package.git)
|
||||||
|
repository and its `q7s-yocto` submodule were cloned in the same directory layer as
|
||||||
|
the `eive-obsw`.
|
||||||
|
|
||||||
|
4. Run the install script to install the files into `q7s-yocto`.
|
||||||
|
|
||||||
|
```sh
|
||||||
|
install-obsw-yocto.sh
|
||||||
|
```
|
||||||
|
|
||||||
|
5. Navigate into the `q7s-yocto` repo and review the changes. You can then add and push those
|
||||||
|
changes.
|
||||||
|
|
||||||
|
6. You can now rebuild the root filesystem with the updated OBSW using `yocto`. This probably needs
|
||||||
|
to be done on another machine or in a VM. The [`q7s-yocto`](https://egit.irs.uni-stuttgart.de/eive/q7s-yocto)
|
||||||
|
repository contains details on how to best do this.
|
||||||
|
|
||||||
## Building in Xilinx SDK 2018.2
|
## Building in Xilinx SDK 2018.2
|
||||||
|
|
||||||
1. Open Xilinx SDK 2018.2
|
1. Open Xilinx SDK 2018.2
|
||||||
@ -326,7 +374,7 @@ If you are comiling for the Raspberry Pi, you have to set the `LINUX_ROOTFS` env
|
|||||||
variable instead. You can find a base root filesystem for the Raspberry Pi
|
variable instead. You can find a base root filesystem for the Raspberry Pi
|
||||||
[here](https://eive-cloud.irs.uni-stuttgart.de/index.php/apps/files/?dir=/EIVE_IRS/Software/rootfs).
|
[here](https://eive-cloud.irs.uni-stuttgart.de/index.php/apps/files/?dir=/EIVE_IRS/Software/rootfs).
|
||||||
|
|
||||||
## <a id="vivado"></a> Installing Vivado the the Xilinx development tools
|
## <a id="vivado"></a> Installing Vivado and the Xilinx development tools
|
||||||
|
|
||||||
It's also possible to perform debugging with a normal Eclipse installation by installing
|
It's also possible to perform debugging with a normal Eclipse installation by installing
|
||||||
the TCF plugin and downloading the cross-compiler as specified in the section below. However,
|
the TCF plugin and downloading the cross-compiler as specified in the section below. However,
|
||||||
@ -342,9 +390,9 @@ installed Vivado with the SDK core tools.
|
|||||||
|
|
||||||
<img src="https://egit.irs.uni-stuttgart.de/eive/eive-obsw/raw/branch/develop/doc/img/vivado-edition.png" width="50%"> <br>
|
<img src="https://egit.irs.uni-stuttgart.de/eive/eive-obsw/raw/branch/develop/doc/img/vivado-edition.png" width="50%"> <br>
|
||||||
|
|
||||||
<img src="https://egit.irs.uni-stuttgart.de/eive/eive-obsw/raw/branch/mueller/master/doc/img/vivado-hl-design.png" width="50%"> <br>
|
<img src="https://egit.irs.uni-stuttgart.de/eive/eive-obsw/raw/branch/develop/doc/img/vivado-hl-design.png" width="50%"> <br>
|
||||||
|
|
||||||
<img src="https://egit.irs.uni-stuttgart.de/eive/eive-obsw/raw/branch/mueller/master/doc/img/xilinx-install.PNG" width="50%"> <br>
|
<img src="https://egit.irs.uni-stuttgart.de/eive/eive-obsw/raw/branch/develop/doc/img/xilinx-install.PNG" width="50%"> <br>
|
||||||
|
|
||||||
* For supported OS refer to https://www.xilinx.com/support/documentation/sw_manuals/xilinx2018_2/ug973-vivado-release-notes-install-license.pdf .
|
* For supported OS refer to https://www.xilinx.com/support/documentation/sw_manuals/xilinx2018_2/ug973-vivado-release-notes-install-license.pdf .
|
||||||
Installation was tested on Windows and Ubuntu 21.04.
|
Installation was tested on Windows and Ubuntu 21.04.
|
||||||
@ -661,35 +709,7 @@ Thus the replies are received with a larger delay compared to a direct TCP conne
|
|||||||
3. Make sure the netmask of the ehternet interface of the workstation matches the netmask of the Q7S
|
3. Make sure the netmask of the ehternet interface of the workstation matches the netmask of the Q7S
|
||||||
* When IP address is set to 192.168.133.10 and the netmask is 255.255.255.0, an example IP address for the workstation
|
* When IP address is set to 192.168.133.10 and the netmask is 255.255.255.0, an example IP address for the workstation
|
||||||
is 192.168.133.2
|
is 192.168.133.2
|
||||||
|
4. Make sure th `tcf-agent` is running by checking `systemctl status tcf-agent`
|
||||||
4. Run tcf-agent on Q7S
|
|
||||||
|
|
||||||
* Tcf-agent is not yet integrated in the rootfs of the Q7S. Therefore build tcf-agent manually
|
|
||||||
|
|
||||||
```sh
|
|
||||||
git clone git://git.eclipse.org/gitroot/tcf/org.eclipse.tcf.agent.git
|
|
||||||
cd org.eclipse.tcf.agent/agent
|
|
||||||
make CC=arm-linux-gnueabihf-gcc LD=arm-linux-gnueabihf-ld MACHINE=arm NO_SSL=1 NO_UUID=1
|
|
||||||
```
|
|
||||||
|
|
||||||
* Transfer executable agent from org.eclipse.tcf.agent/agent/obj/GNU/Linux/arm/Debug to /tmp of Q7S
|
|
||||||
|
|
||||||
```sh
|
|
||||||
cd obj/GNU/Linux/arm/Debug
|
|
||||||
scp agent root@192.168.133.10:/tmp
|
|
||||||
```
|
|
||||||
|
|
||||||
* On Q7S
|
|
||||||
```sh
|
|
||||||
cd /tmp
|
|
||||||
chmod +x agent
|
|
||||||
```
|
|
||||||
|
|
||||||
* Run agent
|
|
||||||
```sh
|
|
||||||
./agent
|
|
||||||
```
|
|
||||||
|
|
||||||
5. In Xilinx SDK 2018.2 right click on project → Debug As → Debug Configurations
|
5. In Xilinx SDK 2018.2 right click on project → Debug As → Debug Configurations
|
||||||
6. Right click Xilinx C/C++ applicaton (System Debugger) → New →
|
6. Right click Xilinx C/C++ applicaton (System Debugger) → New →
|
||||||
7. Set Debug Type to Linux Application Debug and Connectin to Linux Agent
|
7. Set Debug Type to Linux Application Debug and Connectin to Linux Agent
|
||||||
@ -699,8 +719,8 @@ Thus the replies are received with a larger delay compared to a direct TCP conne
|
|||||||
11. Test connection (This ensures the TCF Agent is running on the Q7S)
|
11. Test connection (This ensures the TCF Agent is running on the Q7S)
|
||||||
12. Select Application tab
|
12. Select Application tab
|
||||||
* Project Name: eive_obsw
|
* Project Name: eive_obsw
|
||||||
* Local File Path: Path to eiveobsw-linux.elf (in `_bin\linux\devel`)
|
* Local File Path: Path to OBSW application image with debug symbols (non-stripped)
|
||||||
* Remote File Path: `/tmp/eive_obsw.elf`
|
* Remote File Path: `/tmp/<OBSW NAME>`
|
||||||
|
|
||||||
# <a id="file-transfer"></a> Transfering Files to the Q7S
|
# <a id="file-transfer"></a> Transfering Files to the Q7S
|
||||||
|
|
||||||
@ -726,7 +746,8 @@ From a windows machine files can be copied with putty tools (note: use IPv4 addr
|
|||||||
pscp -scp -P 22 eive@192.168.199.227:</directory-to-example-file/>/example-file </windows-machine-path/>
|
pscp -scp -P 22 eive@192.168.199.227:</directory-to-example-file/>/example-file </windows-machine-path/>
|
||||||
````
|
````
|
||||||
|
|
||||||
More detailed information about the used q7s commands can be found in the Q7S user manual.
|
A helper script named `q7s-cp.py` can be used together with the `q7s-port.sh`
|
||||||
|
script to make this process easier.
|
||||||
|
|
||||||
# <a id="q7s"></a> Q7S OBC
|
# <a id="q7s"></a> Q7S OBC
|
||||||
|
|
||||||
@ -1106,16 +1127,28 @@ Eclipse indexer.
|
|||||||
|
|
||||||
The [TCF agent](https://wiki.eclipse.org/TCF) can be used to perform remote debugging on the Q7S.
|
The [TCF agent](https://wiki.eclipse.org/TCF) can be used to perform remote debugging on the Q7S.
|
||||||
|
|
||||||
1. Install the TCF agent plugin in Eclipse from
|
1. Copy the `.cproject` file and the `.project` file inside the `misc/eclipse` folder into the
|
||||||
|
repo root
|
||||||
|
|
||||||
|
```sh
|
||||||
|
cd eive-obsw
|
||||||
|
cp misc/eclipse/.cproject .
|
||||||
|
cp misc/eclipse/.project .
|
||||||
|
```
|
||||||
|
|
||||||
|
2. Open the repo in Eclipse as a folder.
|
||||||
|
|
||||||
|
3. Install the TCF agent plugin in Eclipse from
|
||||||
the [releases](https://www.eclipse.org/tcf/downloads.php). Go to
|
the [releases](https://www.eclipse.org/tcf/downloads.php). Go to
|
||||||
Help → Install New Software and use the download page, for
|
Help → Install New Software and use the download page, for
|
||||||
example https://download.eclipse.org/tools/tcf/releases/1.7/1.7.0/ to search for the plugin and install it. You can find the newest version [here](https://www.eclipse.org/tcf/downloads.php)
|
example https://download.eclipse.org/tools/tcf/releases/1.7/1.7.0/ to search for the plugin and
|
||||||
|
install it. You can find the newest version [here](https://www.eclipse.org/tcf/downloads.php)
|
||||||
|
|
||||||
2. Go to Window → Perspective → Open Perspective and open the **Target Explorer Perspective**.
|
4. Go to Window → Perspective → Open Perspective and open the **Target Explorer Perspective**.
|
||||||
Here, the Q7S should show up if the local port forwarding was set up as explained previously.
|
Here, the Q7S should show up if the local port forwarding was set up as explained previously.
|
||||||
Please note that you have to connect to `localhost` and port `1534` with port forwaring set up.
|
Please note that you have to connect to `localhost` and port `1534` with port forwaring set up.
|
||||||
|
|
||||||
3. A launch configuration was provided, but it might be necessary to adapt it for your own needs.
|
5. A launch configuration was provided, but it might be necessary to adapt it for your own needs.
|
||||||
Alternatively:
|
Alternatively:
|
||||||
|
|
||||||
- Create a new **TCF Remote Application** by pressing the cogs button at the top or going to
|
- Create a new **TCF Remote Application** by pressing the cogs button at the top or going to
|
||||||
@ -1204,7 +1237,7 @@ in the same way.
|
|||||||
|
|
||||||
* the formatting is based on the clang-format tools
|
* the formatting is based on the clang-format tools
|
||||||
|
|
||||||
## Setting up eclipse auto-fromatter with clang-format
|
## Setting up auto-formatter with clang-format in Xilinx SDK
|
||||||
|
|
||||||
1. Help → Install New Software → Add
|
1. Help → Install New Software → Add
|
||||||
2. In location insert the link http://www.cppstyle.com/luna
|
2. In location insert the link http://www.cppstyle.com/luna
|
||||||
@ -1214,3 +1247,11 @@ in the same way.
|
|||||||
6. Insert the path to the clang-format executable
|
6. Insert the path to the clang-format executable
|
||||||
7. Under C/C++ → Code Style → Formatter, change the formatter to CppStyle (clang-format)
|
7. Under C/C++ → Code Style → Formatter, change the formatter to CppStyle (clang-format)
|
||||||
8. Code can now be formatted with the clang tool by using the key combination Ctrl + Shift + f
|
8. Code can now be formatted with the clang tool by using the key combination Ctrl + Shift + f
|
||||||
|
|
||||||
|
## Setting up auto-fromatter with clang-format in eclipse
|
||||||
|
1. Help → Eclipse market place → Search for "Cppstyle" and install
|
||||||
|
2. On windows download the clang-formatting tools from https://llvm.org/builds/. On linux clang-format can be installed with the package manager.
|
||||||
|
3. Navigate to Preferences → C/C++ → CppStyle
|
||||||
|
4. Insert the path to the clang-format executable
|
||||||
|
5. Under C/C++ → Code Style → Formatter, change the formatter to CppStyle (clang-format)
|
||||||
|
6. Code can now be formatted with the clang tool by using the key combination Ctrl + Shift + f
|
||||||
|
@ -4,17 +4,24 @@ RUN apt-get update
|
|||||||
RUN apt-get --yes upgrade
|
RUN apt-get --yes upgrade
|
||||||
#tzdata is a dependency, won't install otherwise
|
#tzdata is a dependency, won't install otherwise
|
||||||
ARG DEBIAN_FRONTEND=noninteractive
|
ARG DEBIAN_FRONTEND=noninteractive
|
||||||
RUN apt-get --yes install cmake libgpiod-dev xz-utils nano curl git gcc g++ lcov valgrind libgps-dev
|
RUN apt-get --yes install cmake libgpiod-dev xz-utils nano curl git gcc g++ lcov valgrind libgps-dev python3
|
||||||
|
|
||||||
# Q7S root filesystem, required for cross-compilation.
|
ARG XIPHOS_SDK_NAME=sdk-xiphos-eive-v0.2.0
|
||||||
RUN mkdir -p /usr/rootfs; \
|
# Install Xiphos ARK SDK, which also installs Q7S root filesystem, required for cross-compilation.
|
||||||
curl https://buggy.irs.uni-stuttgart.de/eive/tools/eive-compile-rootfs-v0.1.0-7-gae69838.tar.xz \
|
RUN curl https://buggy.irs.uni-stuttgart.de/eive/tools/${XIPHOS_SDK_NAME}.tar | tar -x && \
|
||||||
| tar -xJ -C /usr/rootfs
|
cd ${XIPHOS_SDK_NAME} && \
|
||||||
|
./ark-glibc-x86_64-eive-image-cortexa9hf-neon-toolchain-nodistro.0.sh -y
|
||||||
|
|
||||||
# Cross compiler
|
# Cross compiler
|
||||||
RUN mkdir -p /usr/tools; \
|
RUN mkdir -p /usr/tools; \
|
||||||
curl https://buggy.irs.uni-stuttgart.de/eive/tools/gcc-arm-8.3-2019.03-x86_64-arm-linux-gnueabihf.tar.gz \
|
curl https://buggy.irs.uni-stuttgart.de/eive/tools/gcc-arm-8.3-2019.03-x86_64-arm-linux-gnueabihf.tar.gz \
|
||||||
| tar -xz -C /usr/tools
|
| tar -xz -C /usr/tools
|
||||||
|
|
||||||
ENV ZYNQ_7020_SYSROOT="/usr/rootfs/eive-compile-rootfs"
|
RUN git clone https://github.com/catchorg/Catch2.git && \
|
||||||
|
cd Catch2 && \
|
||||||
|
git checkout v3.0.0-preview5 && \
|
||||||
|
cmake -Bbuild -H. -DBUILD_TESTING=OFF && \
|
||||||
|
cmake --build build/ --target install
|
||||||
|
|
||||||
|
ENV ZYNQ_7020_SYSROOT="/opt/xiphos/sdk/ark/sysroots/cortexa9hf-neon-xiphos-linux-gnueabi"
|
||||||
ENV PATH=$PATH:"/usr/tools/gcc-arm-8.3-2019.03-x86_64-arm-linux-gnueabihf/bin"
|
ENV PATH=$PATH:"/usr/tools/gcc-arm-8.3-2019.03-x86_64-arm-linux-gnueabihf/bin"
|
||||||
|
6
automation/Jenkinsfile
vendored
6
automation/Jenkinsfile
vendored
@ -5,7 +5,7 @@ pipeline {
|
|||||||
}
|
}
|
||||||
agent {
|
agent {
|
||||||
docker {
|
docker {
|
||||||
image 'eive-obsw-ci:d4'
|
image 'eive-obsw-ci:d5'
|
||||||
args '--sysctl fs.mqueue.msg_max=100'
|
args '--sysctl fs.mqueue.msg_max=100'
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -24,11 +24,11 @@ pipeline {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
stage('Unittests') {
|
stage('Build Host and Tests') {
|
||||||
steps {
|
steps {
|
||||||
dir(BUILDDIR_LINUX) {
|
dir(BUILDDIR_LINUX) {
|
||||||
sh 'cmake ..'
|
sh 'cmake ..'
|
||||||
sh 'cmake --build . -t eive-unittest -j4'
|
sh 'cmake --build . -j4'
|
||||||
sh './eive-unittest'
|
sh './eive-unittest'
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,7 +1,3 @@
|
|||||||
target_sources(${OBSW_NAME} PUBLIC
|
target_sources(${OBSW_NAME} PUBLIC InitMission.cpp main.cpp ObjectFactory.cpp)
|
||||||
InitMission.cpp
|
|
||||||
main.cpp
|
|
||||||
ObjectFactory.cpp
|
|
||||||
)
|
|
||||||
|
|
||||||
add_subdirectory(boardconfig)
|
add_subdirectory(boardconfig)
|
||||||
|
@ -1,7 +1,3 @@
|
|||||||
target_sources(${OBSW_NAME} PRIVATE
|
target_sources(${OBSW_NAME} PRIVATE print.c)
|
||||||
print.c
|
|
||||||
)
|
|
||||||
|
|
||||||
target_include_directories(${OBSW_NAME} PUBLIC
|
target_include_directories(${OBSW_NAME} PUBLIC ${CMAKE_CURRENT_SOURCE_DIR})
|
||||||
${CMAKE_CURRENT_SOURCE_DIR}
|
|
||||||
)
|
|
||||||
|
@ -1,8 +1,4 @@
|
|||||||
target_sources(${OBSW_NAME} PUBLIC
|
target_sources(${OBSW_NAME} PUBLIC InitMission.cpp main.cpp ObjectFactory.cpp)
|
||||||
InitMission.cpp
|
|
||||||
main.cpp
|
|
||||||
ObjectFactory.cpp
|
|
||||||
)
|
|
||||||
|
|
||||||
add_subdirectory(fsfwconfig)
|
add_subdirectory(fsfwconfig)
|
||||||
add_subdirectory(boardconfig)
|
add_subdirectory(boardconfig)
|
||||||
|
@ -1,6 +1,7 @@
|
|||||||
#include "InitMission.h"
|
#include "InitMission.h"
|
||||||
|
|
||||||
#include <OBSWConfig.h>
|
#include <OBSWConfig.h>
|
||||||
|
#include <bsp_hosted/fsfwconfig/pollingsequence/DummyPst.h>
|
||||||
#include <fsfw/objectmanager/ObjectManager.h>
|
#include <fsfw/objectmanager/ObjectManager.h>
|
||||||
#include <fsfw/objectmanager/ObjectManagerIF.h>
|
#include <fsfw/objectmanager/ObjectManagerIF.h>
|
||||||
#include <fsfw/returnvalues/HasReturnvaluesIF.h>
|
#include <fsfw/returnvalues/HasReturnvaluesIF.h>
|
||||||
@ -89,9 +90,13 @@ void initmission::initTasks() {
|
|||||||
sif::error << "Object add component failed" << std::endl;
|
sif::error << "Object add component failed" << std::endl;
|
||||||
}
|
}
|
||||||
|
|
||||||
PeriodicTaskIF* pusEvents = factory->createPeriodicTask(
|
PeriodicTaskIF* eventHandling = factory->createPeriodicTask(
|
||||||
"PUS_EVENTS", 60, PeriodicTaskIF::MINIMUM_STACK_SIZE, 0.200, missedDeadlineFunc);
|
"EVENTS", 60, PeriodicTaskIF::MINIMUM_STACK_SIZE, 0.200, missedDeadlineFunc);
|
||||||
result = pusVerification->addComponent(objects::PUS_SERVICE_5_EVENT_REPORTING);
|
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) {
|
if (result != HasReturnvaluesIF::RETURN_OK) {
|
||||||
initmission::printAddObjectError("PUS5", objects::PUS_SERVICE_5_EVENT_REPORTING);
|
initmission::printAddObjectError("PUS5", objects::PUS_SERVICE_5_EVENT_REPORTING);
|
||||||
}
|
}
|
||||||
@ -106,6 +111,10 @@ void initmission::initTasks() {
|
|||||||
if (result != HasReturnvaluesIF::RETURN_OK) {
|
if (result != HasReturnvaluesIF::RETURN_OK) {
|
||||||
initmission::printAddObjectError("PUS9", objects::PUS_SERVICE_9_TIME_MGMT);
|
initmission::printAddObjectError("PUS9", objects::PUS_SERVICE_9_TIME_MGMT);
|
||||||
}
|
}
|
||||||
|
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(
|
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);
|
||||||
@ -129,8 +138,34 @@ void initmission::initTasks() {
|
|||||||
initmission::printAddObjectError("PUS17", objects::PUS_SERVICE_17_TEST);
|
initmission::printAddObjectError("PUS17", objects::PUS_SERVICE_17_TEST);
|
||||||
}
|
}
|
||||||
|
|
||||||
PeriodicTaskIF* testTask = factory->createPeriodicTask(
|
PeriodicTaskIF* thermalTask = factory->createPeriodicTask(
|
||||||
"TEST_TASK", 40, PeriodicTaskIF::MINIMUM_STACK_SIZE, 2.0, missedDeadlineFunc);
|
"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
|
#if OBSW_ADD_TEST_CODE == 1
|
||||||
result = testTask->addComponent(objects::TEST_TASK);
|
result = testTask->addComponent(objects::TEST_TASK);
|
||||||
if (result != HasReturnvaluesIF::RETURN_OK) {
|
if (result != HasReturnvaluesIF::RETURN_OK) {
|
||||||
@ -144,11 +179,14 @@ void initmission::initTasks() {
|
|||||||
tmtcPollingTask->startTask();
|
tmtcPollingTask->startTask();
|
||||||
|
|
||||||
pusVerification->startTask();
|
pusVerification->startTask();
|
||||||
pusEvents->startTask();
|
eventHandling->startTask();
|
||||||
pusHighPrio->startTask();
|
pusHighPrio->startTask();
|
||||||
pusMedPrio->startTask();
|
pusMedPrio->startTask();
|
||||||
pusLowPrio->startTask();
|
pusLowPrio->startTask();
|
||||||
|
|
||||||
|
pstTask->startTask();
|
||||||
|
thermalTask->startTask();
|
||||||
|
|
||||||
#if OBSW_ADD_TEST_CODE == 1
|
#if OBSW_ADD_TEST_CODE == 1
|
||||||
testTask->startTask();
|
testTask->startTask();
|
||||||
#endif /* OBSW_ADD_TEST_CODE == 1 */
|
#endif /* OBSW_ADD_TEST_CODE == 1 */
|
||||||
|
@ -2,14 +2,15 @@
|
|||||||
|
|
||||||
#include <fsfw/tmtcservices/CommandingServiceBase.h>
|
#include <fsfw/tmtcservices/CommandingServiceBase.h>
|
||||||
#include <fsfw/tmtcservices/PusServiceBase.h>
|
#include <fsfw/tmtcservices/PusServiceBase.h>
|
||||||
|
#include <mission/controller/ThermalController.h>
|
||||||
#include <mission/core/GenericFactory.h>
|
#include <mission/core/GenericFactory.h>
|
||||||
#include <mission/utility/TmFunnel.h>
|
#include <mission/tmtc/TmFunnel.h>
|
||||||
#include <objects/systemObjectList.h>
|
#include <objects/systemObjectList.h>
|
||||||
#include <tmtc/apid.h>
|
#include <tmtc/apid.h>
|
||||||
#include <tmtc/pusIds.h>
|
#include <tmtc/pusIds.h>
|
||||||
#include "fsfw_tests/integration/task/TestTask.h"
|
|
||||||
|
|
||||||
#include "OBSWConfig.h"
|
#include "OBSWConfig.h"
|
||||||
|
#include "fsfw_tests/integration/task/TestTask.h"
|
||||||
|
|
||||||
#if OBSW_USE_TMTC_TCP_BRIDGE == 0
|
#if OBSW_USE_TMTC_TCP_BRIDGE == 0
|
||||||
#include "fsfw/osal/common/UdpTcPollingTask.h"
|
#include "fsfw/osal/common/UdpTcPollingTask.h"
|
||||||
@ -25,6 +26,24 @@
|
|||||||
#include <test/testtasks/TestTask.h>
|
#include <test/testtasks/TestTask.h>
|
||||||
#endif
|
#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() {
|
void Factory::setStaticFrameworkObjectIds() {
|
||||||
PusServiceBase::packetSource = objects::PUS_PACKET_DISTRIBUTOR;
|
PusServiceBase::packetSource = objects::PUS_PACKET_DISTRIBUTOR;
|
||||||
PusServiceBase::packetDestination = objects::TM_FUNNEL;
|
PusServiceBase::packetDestination = objects::TM_FUNNEL;
|
||||||
@ -44,5 +63,31 @@ void ObjectFactory::produce(void* args) {
|
|||||||
Factory::setStaticFrameworkObjectIds();
|
Factory::setStaticFrameworkObjectIds();
|
||||||
ObjectFactory::produceGenericObjects();
|
ObjectFactory::produceGenericObjects();
|
||||||
|
|
||||||
new TestTask(objects::TEST_TASK);
|
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);
|
||||||
}
|
}
|
||||||
|
@ -1,10 +1,3 @@
|
|||||||
target_sources(${OBSW_NAME} PRIVATE
|
target_sources(${OBSW_NAME} PRIVATE print.c)
|
||||||
print.c
|
|
||||||
)
|
|
||||||
|
|
||||||
target_include_directories(${OBSW_NAME} PUBLIC
|
|
||||||
${CMAKE_CURRENT_SOURCE_DIR}
|
|
||||||
)
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
target_include_directories(${OBSW_NAME} PUBLIC ${CMAKE_CURRENT_SOURCE_DIR})
|
||||||
|
@ -1,8 +1 @@
|
|||||||
target_sources(${TARGET_NAME} PUBLIC
|
target_sources(${OBSW_NAME} PUBLIC ArduinoComIF.cpp ArduinoCookie.cpp)
|
||||||
ArduinoComIF.cpp
|
|
||||||
ArduinoCookie.cpp
|
|
||||||
)
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@ -1,27 +1,17 @@
|
|||||||
target_sources(${OBSW_NAME} PRIVATE
|
target_sources(${OBSW_NAME} PRIVATE ipc/MissionMessageTypes.cpp)
|
||||||
ipc/MissionMessageTypes.cpp
|
|
||||||
)
|
|
||||||
|
|
||||||
target_include_directories(${OBSW_NAME} PUBLIC
|
target_include_directories(${OBSW_NAME} PUBLIC ${CMAKE_CURRENT_SOURCE_DIR})
|
||||||
${CMAKE_CURRENT_SOURCE_DIR}
|
|
||||||
)
|
|
||||||
|
|
||||||
# If a special translation file for object IDs exists, compile it.
|
# If a special translation file for object IDs exists, compile it.
|
||||||
if(EXISTS "${CMAKE_CURRENT_SOURCE_DIR}/objects/translateObjects.cpp")
|
if(EXISTS "${CMAKE_CURRENT_SOURCE_DIR}/objects/translateObjects.cpp")
|
||||||
target_sources(${OBSW_NAME} PRIVATE
|
target_sources(${OBSW_NAME} PRIVATE objects/translateObjects.cpp)
|
||||||
objects/translateObjects.cpp
|
target_sources(${UNITTEST_NAME} PRIVATE objects/translateObjects.cpp)
|
||||||
)
|
|
||||||
target_sources(${UNITTEST_NAME} PRIVATE
|
|
||||||
objects/translateObjects.cpp
|
|
||||||
)
|
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
# If a special translation file for events exists, compile it.
|
# If a special translation file for events exists, compile it.
|
||||||
if(EXISTS "${CMAKE_CURRENT_SOURCE_DIR}/objects/translateObjects.cpp")
|
if(EXISTS "${CMAKE_CURRENT_SOURCE_DIR}/objects/translateObjects.cpp")
|
||||||
target_sources(${OBSW_NAME} PRIVATE
|
target_sources(${OBSW_NAME} PRIVATE events/translateEvents.cpp)
|
||||||
events/translateEvents.cpp
|
target_sources(${UNITTEST_NAME} PRIVATE events/translateEvents.cpp)
|
||||||
)
|
|
||||||
target_sources(${UNITTEST_NAME} PRIVATE
|
|
||||||
events/translateEvents.cpp
|
|
||||||
)
|
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
|
add_subdirectory(pollingsequence)
|
||||||
|
@ -7,41 +7,41 @@
|
|||||||
//! Used to determine whether C++ ostreams are used which can increase
|
//! Used to determine whether C++ ostreams are used which can increase
|
||||||
//! the binary size significantly. If this is disabled,
|
//! the binary size significantly. If this is disabled,
|
||||||
//! the C stdio functions can be used alternatively
|
//! the C stdio functions can be used alternatively
|
||||||
#define FSFW_CPP_OSTREAM_ENABLED 1
|
#define FSFW_CPP_OSTREAM_ENABLED 1
|
||||||
|
|
||||||
//! More FSFW related printouts depending on level. Useful for development.
|
//! More FSFW related printouts depending on level. Useful for development.
|
||||||
#define FSFW_VERBOSE_LEVEL 1
|
#define FSFW_VERBOSE_LEVEL 1
|
||||||
|
|
||||||
//! Can be used to completely disable printouts, even the C stdio ones.
|
//! Can be used to completely disable printouts, even the C stdio ones.
|
||||||
#if FSFW_CPP_OSTREAM_ENABLED == 0 && FSFW_VERBOSE_LEVEL == 0
|
#if FSFW_CPP_OSTREAM_ENABLED == 0 && FSFW_VERBOSE_LEVEL == 0
|
||||||
#define FSFW_DISABLE_PRINTOUT 0
|
#define FSFW_DISABLE_PRINTOUT 0
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#define FSFW_USE_PUS_C_TELEMETRY 1
|
#define FSFW_USE_PUS_C_TELEMETRY 1
|
||||||
#define FSFW_USE_PUS_C_TELECOMMANDS 1
|
#define FSFW_USE_PUS_C_TELECOMMANDS 1
|
||||||
|
|
||||||
//! Can be used to disable the ANSI color sequences for C stdio.
|
//! Can be used to disable the ANSI color sequences for C stdio.
|
||||||
#define FSFW_COLORED_OUTPUT 1
|
#define FSFW_COLORED_OUTPUT 1
|
||||||
|
|
||||||
//! If FSFW_OBJ_EVENT_TRANSLATION is set to one,
|
//! If FSFW_OBJ_EVENT_TRANSLATION is set to one,
|
||||||
//! additional output which requires the translation files translateObjects
|
//! additional output which requires the translation files translateObjects
|
||||||
//! and translateEvents (and their compiled source files)
|
//! and translateEvents (and their compiled source files)
|
||||||
#define FSFW_OBJ_EVENT_TRANSLATION 1
|
#define FSFW_OBJ_EVENT_TRANSLATION 1
|
||||||
|
|
||||||
#if FSFW_OBJ_EVENT_TRANSLATION == 1
|
#if FSFW_OBJ_EVENT_TRANSLATION == 1
|
||||||
//! Specify whether info events are printed too.
|
//! Specify whether info events are printed too.
|
||||||
#define FSFW_DEBUG_INFO 1
|
#define FSFW_DEBUG_INFO 1
|
||||||
#include "objects/translateObjects.h"
|
|
||||||
#include "events/translateEvents.h"
|
#include "events/translateEvents.h"
|
||||||
|
#include "objects/translateObjects.h"
|
||||||
#else
|
#else
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
//! When using the newlib nano library, C99 support for stdio facilities
|
//! When using the newlib nano library, C99 support for stdio facilities
|
||||||
//! will not be provided. This define should be set to 1 if this is the case.
|
//! will not be provided. This define should be set to 1 if this is the case.
|
||||||
#define FSFW_NO_C99_IO 1
|
#define FSFW_NO_C99_IO 1
|
||||||
|
|
||||||
//! Specify whether a special mode store is used for Subsystem components.
|
//! Specify whether a special mode store is used for Subsystem components.
|
||||||
#define FSFW_USE_MODESTORE 0
|
#define FSFW_USE_MODESTORE 0
|
||||||
|
|
||||||
//! Defines if the real time scheduler for linux should be used.
|
//! Defines if the real time scheduler for linux should be used.
|
||||||
//! If set to 0, this will also disable priority settings for linux
|
//! If set to 0, this will also disable priority settings for linux
|
||||||
@ -58,7 +58,7 @@ static constexpr uint8_t FSFW_MISSION_TIMESTAMP_SIZE = 7;
|
|||||||
//! Configure the allocated pool sizes for the event manager.
|
//! Configure the allocated pool sizes for the event manager.
|
||||||
static constexpr size_t FSFW_EVENTMGMR_MATCHTREE_NODES = 240;
|
static constexpr size_t FSFW_EVENTMGMR_MATCHTREE_NODES = 240;
|
||||||
static constexpr size_t FSFW_EVENTMGMT_EVENTIDMATCHERS = 120;
|
static constexpr size_t FSFW_EVENTMGMT_EVENTIDMATCHERS = 120;
|
||||||
static constexpr size_t FSFW_EVENTMGMR_RANGEMATCHERS = 120;
|
static constexpr size_t FSFW_EVENTMGMR_RANGEMATCHERS = 120;
|
||||||
|
|
||||||
//! Defines the FIFO depth of each commanding service base which
|
//! Defines the FIFO depth of each commanding service base which
|
||||||
//! also determines how many commands a CSB service can handle in one cycle
|
//! also determines how many commands a CSB service can handle in one cycle
|
||||||
@ -70,6 +70,6 @@ static constexpr size_t FSFW_PRINT_BUFFER_SIZE = 124;
|
|||||||
|
|
||||||
static constexpr size_t FSFW_MAX_TM_PACKET_SIZE = 2048;
|
static constexpr size_t FSFW_MAX_TM_PACKET_SIZE = 2048;
|
||||||
|
|
||||||
}
|
} // namespace fsfwconfig
|
||||||
|
|
||||||
#endif /* CONFIG_FSFWCONFIG_H_ */
|
#endif /* CONFIG_FSFWCONFIG_H_ */
|
||||||
|
@ -22,10 +22,11 @@ enum sourceObjects : uint32_t {
|
|||||||
|
|
||||||
TEST_TASK = 0x42694269,
|
TEST_TASK = 0x42694269,
|
||||||
DUMMY_INTERFACE = 0xCAFECAFE,
|
DUMMY_INTERFACE = 0xCAFECAFE,
|
||||||
DUMMY_HANDLER = 0x4400AFFE,
|
DUMMY_HANDLER = 0x44000001,
|
||||||
|
|
||||||
/* 0x49 ('I') for Communication Interfaces **/
|
/* 0x49 ('I') for Communication Interfaces **/
|
||||||
ARDUINO_COM_IF = 0x49000001
|
ARDUINO_COM_IF = 0x49000001,
|
||||||
|
|
||||||
|
DUMMY_COM_IF = 0x49000002
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -6,6 +6,8 @@
|
|||||||
*/
|
*/
|
||||||
#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 *DUMMY_HANDLER_STRING = "DUMMY_HANDLER";
|
const char *DUMMY_HANDLER_STRING = "DUMMY_HANDLER";
|
||||||
const char *ARDUINO_COM_IF_STRING = "ARDUINO_COM_IF";
|
const char *ARDUINO_COM_IF_STRING = "ARDUINO_COM_IF";
|
||||||
@ -36,6 +38,7 @@ const char *IPC_STORE_STRING = "IPC_STORE";
|
|||||||
const char *TIME_STAMPER_STRING = "TIME_STAMPER";
|
const char *TIME_STAMPER_STRING = "TIME_STAMPER";
|
||||||
const char *FSFW_OBJECTS_END_STRING = "FSFW_OBJECTS_END";
|
const char *FSFW_OBJECTS_END_STRING = "FSFW_OBJECTS_END";
|
||||||
const char *DUMMY_INTERFACE_STRING = "DUMMY_INTERFACE";
|
const char *DUMMY_INTERFACE_STRING = "DUMMY_INTERFACE";
|
||||||
|
const char *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) {
|
||||||
@ -100,6 +103,8 @@ const char *translateObject(object_id_t object) {
|
|||||||
return FSFW_OBJECTS_END_STRING;
|
return FSFW_OBJECTS_END_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:
|
||||||
|
1
bsp_hosted/fsfwconfig/pollingsequence/CMakeLists.txt
Normal file
1
bsp_hosted/fsfwconfig/pollingsequence/CMakeLists.txt
Normal file
@ -0,0 +1 @@
|
|||||||
|
target_sources(${OBSW_NAME} PRIVATE DummyPst.cpp)
|
140
bsp_hosted/fsfwconfig/pollingsequence/DummyPst.cpp
Normal file
140
bsp_hosted/fsfwconfig/pollingsequence/DummyPst.cpp
Normal file
@ -0,0 +1,140 @@
|
|||||||
|
#include "DummyPst.h"
|
||||||
|
|
||||||
|
#include <fsfw/devicehandlers/DeviceHandlerIF.h>
|
||||||
|
#include <fsfw/serviceinterface/ServiceInterfaceStream.h>
|
||||||
|
#include <fsfw/tasks/FixedTimeslotTaskIF.h>
|
||||||
|
#include <objects/systemObjectList.h>
|
||||||
|
|
||||||
|
ReturnValue_t dummy_pst::pst(FixedTimeslotTaskIF *thisSequence) {
|
||||||
|
uint32_t length = thisSequence->getPeriodMs();
|
||||||
|
|
||||||
|
thisSequence->addSlot(objects::BPX_BATT_HANDLER, length * 0, DeviceHandlerIF::PERFORM_OPERATION);
|
||||||
|
thisSequence->addSlot(objects::BPX_BATT_HANDLER, length * 0, DeviceHandlerIF::SEND_WRITE);
|
||||||
|
thisSequence->addSlot(objects::BPX_BATT_HANDLER, length * 0, DeviceHandlerIF::GET_WRITE);
|
||||||
|
thisSequence->addSlot(objects::BPX_BATT_HANDLER, length * 0, DeviceHandlerIF::SEND_READ);
|
||||||
|
thisSequence->addSlot(objects::BPX_BATT_HANDLER, length * 0, DeviceHandlerIF::GET_READ);
|
||||||
|
|
||||||
|
thisSequence->addSlot(objects::RW1, length * 0, DeviceHandlerIF::PERFORM_OPERATION);
|
||||||
|
thisSequence->addSlot(objects::RW1, length * 0, DeviceHandlerIF::SEND_WRITE);
|
||||||
|
thisSequence->addSlot(objects::RW1, length * 0, DeviceHandlerIF::GET_WRITE);
|
||||||
|
thisSequence->addSlot(objects::RW1, length * 0, DeviceHandlerIF::SEND_READ);
|
||||||
|
thisSequence->addSlot(objects::RW1, length * 0, DeviceHandlerIF::GET_READ);
|
||||||
|
|
||||||
|
thisSequence->addSlot(objects::RW2, length * 0, DeviceHandlerIF::PERFORM_OPERATION);
|
||||||
|
thisSequence->addSlot(objects::RW2, length * 0, DeviceHandlerIF::SEND_WRITE);
|
||||||
|
thisSequence->addSlot(objects::RW2, length * 0, DeviceHandlerIF::GET_WRITE);
|
||||||
|
thisSequence->addSlot(objects::RW2, length * 0, DeviceHandlerIF::SEND_READ);
|
||||||
|
thisSequence->addSlot(objects::RW2, length * 0, DeviceHandlerIF::GET_READ);
|
||||||
|
|
||||||
|
thisSequence->addSlot(objects::RW3, length * 0, DeviceHandlerIF::PERFORM_OPERATION);
|
||||||
|
thisSequence->addSlot(objects::RW3, length * 0, DeviceHandlerIF::SEND_WRITE);
|
||||||
|
thisSequence->addSlot(objects::RW3, length * 0, DeviceHandlerIF::GET_WRITE);
|
||||||
|
thisSequence->addSlot(objects::RW3, length * 0, DeviceHandlerIF::SEND_READ);
|
||||||
|
thisSequence->addSlot(objects::RW3, length * 0, DeviceHandlerIF::GET_READ);
|
||||||
|
|
||||||
|
thisSequence->addSlot(objects::RW4, length * 0, DeviceHandlerIF::PERFORM_OPERATION);
|
||||||
|
thisSequence->addSlot(objects::RW4, length * 0, DeviceHandlerIF::SEND_WRITE);
|
||||||
|
thisSequence->addSlot(objects::RW4, length * 0, DeviceHandlerIF::GET_WRITE);
|
||||||
|
thisSequence->addSlot(objects::RW4, length * 0, DeviceHandlerIF::SEND_READ);
|
||||||
|
thisSequence->addSlot(objects::RW4, length * 0, DeviceHandlerIF::GET_READ);
|
||||||
|
|
||||||
|
thisSequence->addSlot(objects::STAR_TRACKER, length * 0, DeviceHandlerIF::PERFORM_OPERATION);
|
||||||
|
thisSequence->addSlot(objects::STAR_TRACKER, length * 0, DeviceHandlerIF::SEND_WRITE);
|
||||||
|
thisSequence->addSlot(objects::STAR_TRACKER, length * 0, DeviceHandlerIF::GET_WRITE);
|
||||||
|
thisSequence->addSlot(objects::STAR_TRACKER, length * 0, DeviceHandlerIF::SEND_READ);
|
||||||
|
thisSequence->addSlot(objects::STAR_TRACKER, length * 0, DeviceHandlerIF::GET_READ);
|
||||||
|
|
||||||
|
thisSequence->addSlot(objects::SYRLINKS_HK_HANDLER, length * 0,
|
||||||
|
DeviceHandlerIF::PERFORM_OPERATION);
|
||||||
|
thisSequence->addSlot(objects::SYRLINKS_HK_HANDLER, length * 0, DeviceHandlerIF::SEND_WRITE);
|
||||||
|
thisSequence->addSlot(objects::SYRLINKS_HK_HANDLER, length * 0, DeviceHandlerIF::GET_WRITE);
|
||||||
|
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::SEND_WRITE);
|
||||||
|
thisSequence->addSlot(objects::IMTQ_HANDLER, length * 0, DeviceHandlerIF::GET_WRITE);
|
||||||
|
thisSequence->addSlot(objects::IMTQ_HANDLER, length * 0, DeviceHandlerIF::SEND_READ);
|
||||||
|
thisSequence->addSlot(objects::IMTQ_HANDLER, length * 0, DeviceHandlerIF::GET_READ);
|
||||||
|
|
||||||
|
thisSequence->addSlot(objects::ACU_HANDLER, length * 0, DeviceHandlerIF::PERFORM_OPERATION);
|
||||||
|
thisSequence->addSlot(objects::ACU_HANDLER, length * 0, DeviceHandlerIF::SEND_WRITE);
|
||||||
|
thisSequence->addSlot(objects::ACU_HANDLER, length * 0, DeviceHandlerIF::GET_WRITE);
|
||||||
|
thisSequence->addSlot(objects::ACU_HANDLER, length * 0, DeviceHandlerIF::SEND_READ);
|
||||||
|
thisSequence->addSlot(objects::ACU_HANDLER, length * 0, DeviceHandlerIF::GET_READ);
|
||||||
|
|
||||||
|
thisSequence->addSlot(objects::PDU1_HANDLER, length * 0, DeviceHandlerIF::PERFORM_OPERATION);
|
||||||
|
thisSequence->addSlot(objects::PDU1_HANDLER, length * 0, DeviceHandlerIF::SEND_WRITE);
|
||||||
|
thisSequence->addSlot(objects::PDU1_HANDLER, length * 0, DeviceHandlerIF::GET_WRITE);
|
||||||
|
thisSequence->addSlot(objects::PDU1_HANDLER, length * 0, DeviceHandlerIF::SEND_READ);
|
||||||
|
thisSequence->addSlot(objects::PDU1_HANDLER, length * 0, DeviceHandlerIF::GET_READ);
|
||||||
|
|
||||||
|
thisSequence->addSlot(objects::PDU2_HANDLER, length * 0, DeviceHandlerIF::PERFORM_OPERATION);
|
||||||
|
thisSequence->addSlot(objects::PDU2_HANDLER, length * 0, DeviceHandlerIF::SEND_WRITE);
|
||||||
|
thisSequence->addSlot(objects::PDU2_HANDLER, length * 0, DeviceHandlerIF::GET_WRITE);
|
||||||
|
thisSequence->addSlot(objects::PDU2_HANDLER, length * 0, DeviceHandlerIF::SEND_READ);
|
||||||
|
thisSequence->addSlot(objects::PDU2_HANDLER, length * 0, DeviceHandlerIF::GET_READ);
|
||||||
|
|
||||||
|
thisSequence->addSlot(objects::P60DOCK_HANDLER, length * 0, DeviceHandlerIF::PERFORM_OPERATION);
|
||||||
|
thisSequence->addSlot(objects::P60DOCK_HANDLER, length * 0, DeviceHandlerIF::SEND_WRITE);
|
||||||
|
thisSequence->addSlot(objects::P60DOCK_HANDLER, length * 0, DeviceHandlerIF::GET_WRITE);
|
||||||
|
thisSequence->addSlot(objects::P60DOCK_HANDLER, length * 0, DeviceHandlerIF::SEND_READ);
|
||||||
|
thisSequence->addSlot(objects::P60DOCK_HANDLER, length * 0, DeviceHandlerIF::GET_READ);
|
||||||
|
|
||||||
|
thisSequence->addSlot(objects::GYRO_0_ADIS_HANDLER, length * 0,
|
||||||
|
DeviceHandlerIF::PERFORM_OPERATION);
|
||||||
|
thisSequence->addSlot(objects::GYRO_0_ADIS_HANDLER, length * 0, DeviceHandlerIF::SEND_WRITE);
|
||||||
|
thisSequence->addSlot(objects::GYRO_0_ADIS_HANDLER, length * 0, DeviceHandlerIF::GET_WRITE);
|
||||||
|
thisSequence->addSlot(objects::GYRO_0_ADIS_HANDLER, length * 0, DeviceHandlerIF::SEND_READ);
|
||||||
|
thisSequence->addSlot(objects::GYRO_0_ADIS_HANDLER, length * 0, DeviceHandlerIF::GET_READ);
|
||||||
|
|
||||||
|
thisSequence->addSlot(objects::GYRO_1_L3G_HANDLER, length * 0,
|
||||||
|
DeviceHandlerIF::PERFORM_OPERATION);
|
||||||
|
thisSequence->addSlot(objects::GYRO_1_L3G_HANDLER, length * 0, DeviceHandlerIF::SEND_WRITE);
|
||||||
|
thisSequence->addSlot(objects::GYRO_1_L3G_HANDLER, length * 0, DeviceHandlerIF::GET_WRITE);
|
||||||
|
thisSequence->addSlot(objects::GYRO_1_L3G_HANDLER, length * 0, DeviceHandlerIF::SEND_READ);
|
||||||
|
thisSequence->addSlot(objects::GYRO_1_L3G_HANDLER, length * 0, DeviceHandlerIF::GET_READ);
|
||||||
|
|
||||||
|
thisSequence->addSlot(objects::GYRO_2_ADIS_HANDLER, length * 0,
|
||||||
|
DeviceHandlerIF::PERFORM_OPERATION);
|
||||||
|
thisSequence->addSlot(objects::GYRO_2_ADIS_HANDLER, length * 0, DeviceHandlerIF::SEND_WRITE);
|
||||||
|
thisSequence->addSlot(objects::GYRO_2_ADIS_HANDLER, length * 0, DeviceHandlerIF::GET_WRITE);
|
||||||
|
thisSequence->addSlot(objects::GYRO_2_ADIS_HANDLER, length * 0, DeviceHandlerIF::SEND_READ);
|
||||||
|
thisSequence->addSlot(objects::GYRO_2_ADIS_HANDLER, length * 0, DeviceHandlerIF::GET_READ);
|
||||||
|
|
||||||
|
thisSequence->addSlot(objects::GYRO_3_L3G_HANDLER, length * 0,
|
||||||
|
DeviceHandlerIF::PERFORM_OPERATION);
|
||||||
|
thisSequence->addSlot(objects::GYRO_3_L3G_HANDLER, length * 0, DeviceHandlerIF::SEND_WRITE);
|
||||||
|
thisSequence->addSlot(objects::GYRO_3_L3G_HANDLER, length * 0, DeviceHandlerIF::GET_WRITE);
|
||||||
|
thisSequence->addSlot(objects::GYRO_3_L3G_HANDLER, length * 0, DeviceHandlerIF::SEND_READ);
|
||||||
|
thisSequence->addSlot(objects::GYRO_3_L3G_HANDLER, length * 0, DeviceHandlerIF::GET_READ);
|
||||||
|
|
||||||
|
thisSequence->addSlot(objects::MGM_0_LIS3_HANDLER, length * 0,
|
||||||
|
DeviceHandlerIF::PERFORM_OPERATION);
|
||||||
|
thisSequence->addSlot(objects::MGM_0_LIS3_HANDLER, length * 0, DeviceHandlerIF::SEND_WRITE);
|
||||||
|
thisSequence->addSlot(objects::MGM_0_LIS3_HANDLER, length * 0, DeviceHandlerIF::GET_WRITE);
|
||||||
|
thisSequence->addSlot(objects::MGM_0_LIS3_HANDLER, length * 0, DeviceHandlerIF::SEND_READ);
|
||||||
|
thisSequence->addSlot(objects::MGM_0_LIS3_HANDLER, length * 0, DeviceHandlerIF::GET_READ);
|
||||||
|
|
||||||
|
thisSequence->addSlot(objects::MGM_2_LIS3_HANDLER, length * 0,
|
||||||
|
DeviceHandlerIF::PERFORM_OPERATION);
|
||||||
|
thisSequence->addSlot(objects::MGM_2_LIS3_HANDLER, length * 0, DeviceHandlerIF::SEND_WRITE);
|
||||||
|
thisSequence->addSlot(objects::MGM_2_LIS3_HANDLER, length * 0, DeviceHandlerIF::GET_WRITE);
|
||||||
|
thisSequence->addSlot(objects::MGM_2_LIS3_HANDLER, length * 0, DeviceHandlerIF::SEND_READ);
|
||||||
|
thisSequence->addSlot(objects::MGM_2_LIS3_HANDLER, length * 0, DeviceHandlerIF::GET_READ);
|
||||||
|
|
||||||
|
thisSequence->addSlot(objects::PLPCDU_HANDLER, length * 0, DeviceHandlerIF::PERFORM_OPERATION);
|
||||||
|
thisSequence->addSlot(objects::PLPCDU_HANDLER, length * 0, DeviceHandlerIF::SEND_WRITE);
|
||||||
|
thisSequence->addSlot(objects::PLPCDU_HANDLER, length * 0, DeviceHandlerIF::GET_WRITE);
|
||||||
|
thisSequence->addSlot(objects::PLPCDU_HANDLER, length * 0, DeviceHandlerIF::SEND_READ);
|
||||||
|
thisSequence->addSlot(objects::PLPCDU_HANDLER, length * 0, DeviceHandlerIF::GET_READ);
|
||||||
|
|
||||||
|
if (thisSequence->checkSequence() == HasReturnvaluesIF::RETURN_OK) {
|
||||||
|
return HasReturnvaluesIF::RETURN_OK;
|
||||||
|
} else {
|
||||||
|
#if FSFW_CPP_OSTREAM_ENABLED == 1
|
||||||
|
sif::error << "pst::pollingSequenceInitDefault: Sequence invalid!" << std::endl;
|
||||||
|
#endif
|
||||||
|
return HasReturnvaluesIF::RETURN_FAILED;
|
||||||
|
}
|
||||||
|
}
|
14
bsp_hosted/fsfwconfig/pollingsequence/DummyPst.h
Normal file
14
bsp_hosted/fsfwconfig/pollingsequence/DummyPst.h
Normal file
@ -0,0 +1,14 @@
|
|||||||
|
#ifndef POLLINGSEQUENCEFACTORY_H_
|
||||||
|
#define POLLINGSEQUENCEFACTORY_H_
|
||||||
|
|
||||||
|
#include <fsfw/returnvalues/HasReturnvaluesIF.h>
|
||||||
|
|
||||||
|
class FixedTimeslotTaskIF;
|
||||||
|
|
||||||
|
namespace dummy_pst {
|
||||||
|
|
||||||
|
ReturnValue_t pst(FixedTimeslotTaskIF *thisSequence);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
#endif /* POLLINGSEQUENCEINIT_H_ */
|
@ -1,18 +0,0 @@
|
|||||||
#ifndef FSFWCONFIG_TMTC_APID_H_
|
|
||||||
#define FSFWCONFIG_TMTC_APID_H_
|
|
||||||
|
|
||||||
#include <stdint.h>
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Application Process Definition: entity, uniquely identified by an
|
|
||||||
* application process ID (APID), capable of generating telemetry source
|
|
||||||
* packets and receiving telecommand packets
|
|
||||||
*
|
|
||||||
* SOURCE APID: 0x73 / 115 / s
|
|
||||||
* APID is a 11 bit number
|
|
||||||
*/
|
|
||||||
namespace apid {
|
|
||||||
static const uint16_t EIVE_OBSW = 0x65;
|
|
||||||
}
|
|
||||||
|
|
||||||
#endif /* FSFWCONFIG_TMTC_APID_H_ */
|
|
@ -1,9 +1,17 @@
|
|||||||
|
#include <objects/systemObjectList.h>
|
||||||
|
|
||||||
#include <iostream>
|
#include <iostream>
|
||||||
|
|
||||||
#include "InitMission.h"
|
#include "InitMission.h"
|
||||||
#include "commonConfig.h"
|
#include "commonConfig.h"
|
||||||
#include "fsfw/FSFWVersion.h"
|
#include "fsfw/FSFWVersion.h"
|
||||||
|
#include "fsfw/controller/ControllerBase.h"
|
||||||
|
#include "fsfw/ipc/QueueFactory.h"
|
||||||
|
#include "fsfw/modes/HasModesIF.h"
|
||||||
|
#include "fsfw/modes/ModeMessage.h"
|
||||||
|
#include "fsfw/objectmanager/ObjectManager.h"
|
||||||
#include "fsfw/tasks/TaskFactory.h"
|
#include "fsfw/tasks/TaskFactory.h"
|
||||||
|
|
||||||
#ifdef WIN32
|
#ifdef WIN32
|
||||||
static const char* COMPILE_PRINTOUT = "Windows";
|
static const char* COMPILE_PRINTOUT = "Windows";
|
||||||
#elif LINUX
|
#elif LINUX
|
||||||
|
@ -1,9 +1,5 @@
|
|||||||
target_sources(${OBSW_NAME} PUBLIC
|
target_sources(${OBSW_NAME} PUBLIC InitMission.cpp main.cpp gpioInit.cpp
|
||||||
InitMission.cpp
|
ObjectFactory.cpp)
|
||||||
main.cpp
|
|
||||||
gpioInit.cpp
|
|
||||||
ObjectFactory.cpp
|
|
||||||
)
|
|
||||||
|
|
||||||
add_subdirectory(boardconfig)
|
add_subdirectory(boardconfig)
|
||||||
add_subdirectory(boardtest)
|
add_subdirectory(boardtest)
|
||||||
|
@ -3,7 +3,7 @@
|
|||||||
|
|
||||||
#include <vector>
|
#include <vector>
|
||||||
|
|
||||||
#include "fsfw/tasks/Typedef.h"
|
#include "fsfw/tasks/definitions.h"
|
||||||
|
|
||||||
class PeriodicTaskIF;
|
class PeriodicTaskIF;
|
||||||
class TaskFactory;
|
class TaskFactory;
|
||||||
|
@ -67,7 +67,7 @@ void ObjectFactory::produce(void* args) {
|
|||||||
GpioCookie* gpioCookie = nullptr;
|
GpioCookie* gpioCookie = nullptr;
|
||||||
static_cast<void>(gpioCookie);
|
static_cast<void>(gpioCookie);
|
||||||
|
|
||||||
SpiComIF* spiComIF = new SpiComIF(objects::SPI_COM_IF, gpioIF);
|
SpiComIF* spiComIF = new SpiComIF(objects::SPI_MAIN_COM_IF, spi::DEV, gpioIF);
|
||||||
static_cast<void>(spiComIF);
|
static_cast<void>(spiComIF);
|
||||||
auto pwrSwitcher = new DummyPowerSwitcher(objects::PCDU_HANDLER, 18, 0);
|
auto pwrSwitcher = new DummyPowerSwitcher(objects::PCDU_HANDLER, 18, 0);
|
||||||
static_cast<void>(pwrSwitcher);
|
static_cast<void>(pwrSwitcher);
|
||||||
@ -116,73 +116,72 @@ void ObjectFactory::createRpiAcsBoard(GpioIF* gpioIF, std::string spiDev) {
|
|||||||
gpio::Direction::OUT, gpio::Levels::HIGH);
|
gpio::Direction::OUT, gpio::Levels::HIGH);
|
||||||
gpioIF->addGpios(gpioCookie);
|
gpioIF->addGpios(gpioCookie);
|
||||||
SpiCookie* spiCookie =
|
SpiCookie* spiCookie =
|
||||||
new SpiCookie(addresses::MGM_0_LIS3, gpioIds::MGM_0_LIS3_CS, spiDev,
|
new SpiCookie(addresses::MGM_0_LIS3, gpioIds::MGM_0_LIS3_CS, MGMLIS3MDL::MAX_BUFFER_SIZE,
|
||||||
MGMLIS3MDL::MAX_BUFFER_SIZE, spi::DEFAULT_LIS3_MODE, spi::DEFAULT_LIS3_SPEED);
|
spi::DEFAULT_LIS3_MODE, spi::DEFAULT_LIS3_SPEED);
|
||||||
auto mgmLis3Handler =
|
auto mgmLis3Handler =
|
||||||
new MgmLIS3MDLHandler(objects::MGM_0_LIS3_HANDLER, objects::SPI_COM_IF, spiCookie, 0);
|
new MgmLIS3MDLHandler(objects::MGM_0_LIS3_HANDLER, objects::SPI_MAIN_COM_IF, spiCookie, 0);
|
||||||
mgmLis3Handler->setStartUpImmediately();
|
mgmLis3Handler->setStartUpImmediately();
|
||||||
#if OBSW_TEST_ACS == 1
|
#if OBSW_TEST_ACS == 1
|
||||||
mgmLis3Handler->setToGoToNormalMode(true);
|
mgmLis3Handler->setToGoToNormalMode(true);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
spiCookie =
|
spiCookie =
|
||||||
new SpiCookie(addresses::MGM_1_RM3100, gpioIds::MGM_1_RM3100_CS, spiDev,
|
new SpiCookie(addresses::MGM_1_RM3100, gpioIds::MGM_1_RM3100_CS, RM3100::MAX_BUFFER_SIZE,
|
||||||
RM3100::MAX_BUFFER_SIZE, spi::DEFAULT_RM3100_MODE, spi::DEFAULT_RM3100_SPEED);
|
spi::DEFAULT_RM3100_MODE, spi::DEFAULT_RM3100_SPEED);
|
||||||
auto mgmRm3100Handler =
|
auto mgmRm3100Handler =
|
||||||
new MgmRM3100Handler(objects::MGM_1_RM3100_HANDLER, objects::SPI_COM_IF, spiCookie, 0);
|
new MgmRM3100Handler(objects::MGM_1_RM3100_HANDLER, objects::SPI_MAIN_COM_IF, spiCookie, 0);
|
||||||
mgmRm3100Handler->setStartUpImmediately();
|
mgmRm3100Handler->setStartUpImmediately();
|
||||||
#if OBSW_TEST_ACS == 1
|
#if OBSW_TEST_ACS == 1
|
||||||
mgmRm3100Handler->setToGoToNormalMode(true);
|
mgmRm3100Handler->setToGoToNormalMode(true);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
spiCookie =
|
spiCookie =
|
||||||
new SpiCookie(addresses::MGM_2_LIS3, gpioIds::MGM_2_LIS3_CS, spiDev,
|
new SpiCookie(addresses::MGM_2_LIS3, gpioIds::MGM_2_LIS3_CS, MGMLIS3MDL::MAX_BUFFER_SIZE,
|
||||||
MGMLIS3MDL::MAX_BUFFER_SIZE, spi::DEFAULT_LIS3_MODE, spi::DEFAULT_LIS3_SPEED);
|
spi::DEFAULT_LIS3_MODE, spi::DEFAULT_LIS3_SPEED);
|
||||||
mgmLis3Handler =
|
mgmLis3Handler =
|
||||||
new MgmLIS3MDLHandler(objects::MGM_2_LIS3_HANDLER, objects::SPI_COM_IF, spiCookie, 0);
|
new MgmLIS3MDLHandler(objects::MGM_2_LIS3_HANDLER, objects::SPI_MAIN_COM_IF, spiCookie, 0);
|
||||||
mgmLis3Handler->setStartUpImmediately();
|
mgmLis3Handler->setStartUpImmediately();
|
||||||
#if OBSW_TEST_ACS == 1
|
#if OBSW_TEST_ACS == 1
|
||||||
mgmLis3Handler->setToGoToNormalMode(true);
|
mgmLis3Handler->setToGoToNormalMode(true);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
spiCookie =
|
spiCookie =
|
||||||
new SpiCookie(addresses::MGM_3_RM3100, gpioIds::MGM_3_RM3100_CS, spiDev,
|
new SpiCookie(addresses::MGM_3_RM3100, gpioIds::MGM_3_RM3100_CS, RM3100::MAX_BUFFER_SIZE,
|
||||||
RM3100::MAX_BUFFER_SIZE, spi::DEFAULT_RM3100_MODE, spi::DEFAULT_RM3100_SPEED);
|
spi::DEFAULT_RM3100_MODE, spi::DEFAULT_RM3100_SPEED);
|
||||||
mgmRm3100Handler =
|
mgmRm3100Handler =
|
||||||
new MgmRM3100Handler(objects::MGM_3_RM3100_HANDLER, objects::SPI_COM_IF, spiCookie, 0);
|
new MgmRM3100Handler(objects::MGM_3_RM3100_HANDLER, objects::SPI_MAIN_COM_IF, spiCookie, 0);
|
||||||
mgmRm3100Handler->setStartUpImmediately();
|
mgmRm3100Handler->setStartUpImmediately();
|
||||||
#if OBSW_TEST_ACS == 1
|
#if OBSW_TEST_ACS == 1
|
||||||
mgmRm3100Handler->setToGoToNormalMode(true);
|
mgmRm3100Handler->setToGoToNormalMode(true);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
spiCookie =
|
spiCookie =
|
||||||
new SpiCookie(addresses::GYRO_0_ADIS, gpioIds::GYRO_0_ADIS_CS, spiDev,
|
new SpiCookie(addresses::GYRO_0_ADIS, gpioIds::GYRO_0_ADIS_CS, ADIS1650X::MAXIMUM_REPLY_SIZE,
|
||||||
ADIS1650X::MAXIMUM_REPLY_SIZE, spi::DEFAULT_L3G_MODE, spi::DEFAULT_L3G_SPEED);
|
|
||||||
auto adisHandler = new GyroADIS1650XHandler(objects::GYRO_0_ADIS_HANDLER, objects::SPI_COM_IF,
|
|
||||||
spiCookie, ADIS1650X::Type::ADIS16505);
|
|
||||||
adisHandler->setStartUpImmediately();
|
|
||||||
spiCookie =
|
|
||||||
new SpiCookie(addresses::GYRO_1_L3G, gpioIds::GYRO_1_L3G_CS, spiDev, L3GD20H::MAX_BUFFER_SIZE,
|
|
||||||
spi::DEFAULT_L3G_MODE, spi::DEFAULT_L3G_SPEED);
|
spi::DEFAULT_L3G_MODE, spi::DEFAULT_L3G_SPEED);
|
||||||
|
auto adisHandler =
|
||||||
|
new GyroADIS1650XHandler(objects::GYRO_0_ADIS_HANDLER, objects::SPI_MAIN_COM_IF, spiCookie,
|
||||||
|
ADIS1650X::Type::ADIS16505);
|
||||||
|
adisHandler->setStartUpImmediately();
|
||||||
|
spiCookie = new SpiCookie(addresses::GYRO_1_L3G, gpioIds::GYRO_1_L3G_CS, L3GD20H::MAX_BUFFER_SIZE,
|
||||||
|
spi::DEFAULT_L3G_MODE, spi::DEFAULT_L3G_SPEED);
|
||||||
auto gyroL3gHandler =
|
auto gyroL3gHandler =
|
||||||
new GyroHandlerL3GD20H(objects::GYRO_1_L3G_HANDLER, objects::SPI_COM_IF, spiCookie, 0);
|
new GyroHandlerL3GD20H(objects::GYRO_1_L3G_HANDLER, objects::SPI_MAIN_COM_IF, spiCookie, 0);
|
||||||
gyroL3gHandler->setStartUpImmediately();
|
gyroL3gHandler->setStartUpImmediately();
|
||||||
#if OBSW_TEST_ACS == 1
|
#if OBSW_TEST_ACS == 1
|
||||||
gyroL3gHandler->setToGoToNormalMode(true);
|
gyroL3gHandler->setToGoToNormalMode(true);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
spiCookie =
|
spiCookie =
|
||||||
new SpiCookie(addresses::GYRO_2_ADIS, gpioIds::GYRO_2_ADIS_CS, spiDev,
|
new SpiCookie(addresses::GYRO_2_ADIS, gpioIds::GYRO_2_ADIS_CS, ADIS1650X::MAXIMUM_REPLY_SIZE,
|
||||||
ADIS1650X::MAXIMUM_REPLY_SIZE, spi::DEFAULT_L3G_MODE, spi::DEFAULT_L3G_SPEED);
|
spi::DEFAULT_L3G_MODE, spi::DEFAULT_L3G_SPEED);
|
||||||
adisHandler = new GyroADIS1650XHandler(objects::GYRO_2_ADIS_HANDLER, objects::SPI_COM_IF,
|
adisHandler = new GyroADIS1650XHandler(objects::GYRO_2_ADIS_HANDLER, objects::SPI_MAIN_COM_IF,
|
||||||
spiCookie, ADIS1650X::Type::ADIS16505);
|
spiCookie, ADIS1650X::Type::ADIS16505);
|
||||||
adisHandler->setStartUpImmediately();
|
adisHandler->setStartUpImmediately();
|
||||||
|
|
||||||
spiCookie =
|
spiCookie = new SpiCookie(addresses::GYRO_3_L3G, gpioIds::GYRO_3_L3G_CS, L3GD20H::MAX_BUFFER_SIZE,
|
||||||
new SpiCookie(addresses::GYRO_3_L3G, gpioIds::GYRO_3_L3G_CS, spiDev, L3GD20H::MAX_BUFFER_SIZE,
|
spi::DEFAULT_L3G_MODE, spi::DEFAULT_L3G_SPEED);
|
||||||
spi::DEFAULT_L3G_MODE, spi::DEFAULT_L3G_SPEED);
|
|
||||||
gyroL3gHandler =
|
gyroL3gHandler =
|
||||||
new GyroHandlerL3GD20H(objects::GYRO_3_L3G_HANDLER, objects::SPI_COM_IF, spiCookie, 0);
|
new GyroHandlerL3GD20H(objects::GYRO_3_L3G_HANDLER, objects::SPI_MAIN_COM_IF, spiCookie, 0);
|
||||||
gyroL3gHandler->setStartUpImmediately();
|
gyroL3gHandler->setStartUpImmediately();
|
||||||
#if OBSW_TEST_ACS == 1
|
#if OBSW_TEST_ACS == 1
|
||||||
gyroL3gHandler->setToGoToNormalMode(true);
|
gyroL3gHandler->setToGoToNormalMode(true);
|
||||||
|
@ -1,7 +1,3 @@
|
|||||||
target_sources(${OBSW_NAME} PRIVATE
|
target_sources(${OBSW_NAME} PRIVATE print.c)
|
||||||
print.c
|
|
||||||
)
|
|
||||||
|
|
||||||
target_include_directories(${OBSW_NAME} PUBLIC
|
target_include_directories(${OBSW_NAME} PUBLIC ${CMAKE_CURRENT_SOURCE_DIR})
|
||||||
${CMAKE_CURRENT_SOURCE_DIR}
|
|
||||||
)
|
|
||||||
|
@ -1,6 +1 @@
|
|||||||
target_sources(${OBSW_NAME} PRIVATE
|
target_sources(${OBSW_NAME} PRIVATE)
|
||||||
)
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@ -1,20 +1,13 @@
|
|||||||
#simple mode
|
# simple mode
|
||||||
add_executable(${SIMPLE_OBSW_NAME} EXCLUDE_FROM_ALL)
|
add_executable(${SIMPLE_OBSW_NAME} EXCLUDE_FROM_ALL)
|
||||||
target_compile_definitions(${SIMPLE_OBSW_NAME} PRIVATE "Q7S_SIMPLE_MODE")
|
target_compile_definitions(${SIMPLE_OBSW_NAME} PRIVATE "Q7S_SIMPLE_MODE")
|
||||||
target_sources(${SIMPLE_OBSW_NAME} PUBLIC
|
target_sources(${SIMPLE_OBSW_NAME} PUBLIC main.cpp)
|
||||||
main.cpp
|
# I think this is unintentional? (produces linker errors for stuff in /linux)
|
||||||
)
|
target_link_libraries(${SIMPLE_OBSW_NAME} PUBLIC ${LIB_FSFW_NAME})
|
||||||
#I think this is unintentional? (produces linker errors for stuff in /linux)
|
|
||||||
target_link_libraries(${SIMPLE_OBSW_NAME} PUBLIC
|
|
||||||
${LIB_FSFW_NAME}
|
|
||||||
)
|
|
||||||
target_compile_definitions(${SIMPLE_OBSW_NAME} PRIVATE "Q7S_SIMPLE_MODE")
|
target_compile_definitions(${SIMPLE_OBSW_NAME} PRIVATE "Q7S_SIMPLE_MODE")
|
||||||
add_subdirectory(simple)
|
add_subdirectory(simple)
|
||||||
|
|
||||||
target_sources(${OBSW_NAME} PUBLIC
|
target_sources(${OBSW_NAME} PUBLIC main.cpp obsw.cpp)
|
||||||
main.cpp
|
|
||||||
obsw.cpp
|
|
||||||
)
|
|
||||||
|
|
||||||
add_subdirectory(boardtest)
|
add_subdirectory(boardtest)
|
||||||
|
|
||||||
@ -23,9 +16,9 @@ add_subdirectory(comIF)
|
|||||||
add_subdirectory(core)
|
add_subdirectory(core)
|
||||||
|
|
||||||
if(EIVE_Q7S_EM)
|
if(EIVE_Q7S_EM)
|
||||||
add_subdirectory(em)
|
add_subdirectory(em)
|
||||||
else()
|
else()
|
||||||
add_subdirectory(fm)
|
target_sources(${OBSW_NAME} PUBLIC fmObjectFactory.cpp)
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
add_subdirectory(memory)
|
add_subdirectory(memory)
|
||||||
|
@ -25,8 +25,8 @@
|
|||||||
#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 0
|
#define OBSW_ADD_PLOC_SUPERVISOR 1
|
||||||
#define OBSW_ADD_PLOC_MPSOC 0
|
#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@
|
||||||
@ -38,6 +38,7 @@
|
|||||||
#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_ENABLE_SYRLINKS_TRANSMIT_TIMEOUT 0
|
#define OBSW_ENABLE_SYRLINKS_TRANSMIT_TIMEOUT 0
|
||||||
|
#define OBSW_MPSOC_JTAG_BOOT 0
|
||||||
|
|
||||||
// This is a really tricky switch.. It initializes the PCDU switches to their default states
|
// This is a really tricky switch.. It initializes the PCDU switches to their default states
|
||||||
// at powerup. I think it would be better
|
// at powerup. I think it would be better
|
||||||
|
@ -1,12 +1,5 @@
|
|||||||
target_sources(${OBSW_NAME} PRIVATE
|
target_sources(${OBSW_NAME} PRIVATE print.c)
|
||||||
print.c
|
|
||||||
)
|
|
||||||
|
|
||||||
target_sources(${SIMPLE_OBSW_NAME} PRIVATE
|
target_sources(${SIMPLE_OBSW_NAME} PRIVATE print.c)
|
||||||
print.c
|
|
||||||
)
|
|
||||||
|
|
||||||
|
target_include_directories(${OBSW_NAME} PUBLIC ${CMAKE_CURRENT_SOURCE_DIR})
|
||||||
target_include_directories(${OBSW_NAME} PUBLIC
|
|
||||||
${CMAKE_CURRENT_SOURCE_DIR}
|
|
||||||
)
|
|
||||||
|
@ -4,6 +4,8 @@
|
|||||||
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 char SPI_RW_DEV[] = "/dev/spi-rw";
|
static constexpr char SPI_RW_DEV[] = "/dev/spi-rw";
|
||||||
|
|
||||||
static constexpr char I2C_DEFAULT_DEV[] = "/dev/i2c-eive";
|
static constexpr char I2C_DEFAULT_DEV[] = "/dev/i2c-eive";
|
||||||
@ -15,9 +17,9 @@ 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 UIO_PDEC_REGISTERS[] = "/dev/uio0";
|
static constexpr char UIO_PDEC_REGISTERS[] = "/dev/uio0";
|
||||||
|
static constexpr char UIO_PTME[] = "/dev/uio1";
|
||||||
static constexpr char UIO_PDEC_CONFIG_MEMORY[] = "/dev/uio2";
|
static constexpr char UIO_PDEC_CONFIG_MEMORY[] = "/dev/uio2";
|
||||||
static constexpr char UIO_PDEC_RAM[] = "/dev/uio3";
|
static constexpr char UIO_PDEC_RAM[] = "/dev/uio3";
|
||||||
static constexpr char UIO_PTME[] = "/dev/uio1";
|
|
||||||
static constexpr int MAP_ID_PTME_CONFIG = 3;
|
static constexpr int MAP_ID_PTME_CONFIG = 3;
|
||||||
|
|
||||||
namespace uiomapids {
|
namespace uiomapids {
|
||||||
|
@ -34,5 +34,6 @@ SOFTWARE.
|
|||||||
|
|
||||||
#define ETL_CPP11_SUPPORTED 1
|
#define ETL_CPP11_SUPPORTED 1
|
||||||
#define ETL_NO_NULLPTR_SUPPORT 0
|
#define ETL_NO_NULLPTR_SUPPORT 0
|
||||||
|
#define ETL_HAS_ERROR_ON_STRING_TRUNCATION 1
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
@ -1,10 +1,5 @@
|
|||||||
target_sources(${OBSW_NAME} PRIVATE
|
target_sources(${OBSW_NAME} PRIVATE FileSystemTest.cpp Q7STestTask.cpp)
|
||||||
FileSystemTest.cpp
|
|
||||||
Q7STestTask.cpp
|
|
||||||
)
|
|
||||||
|
|
||||||
if(EIVE_BUILD_Q7S_SIMPLE_MODE)
|
if(EIVE_BUILD_Q7S_SIMPLE_MODE)
|
||||||
target_sources(${SIMPLE_OBSW_NAME} PRIVATE
|
target_sources(${SIMPLE_OBSW_NAME} PRIVATE FileSystemTest.cpp)
|
||||||
FileSystemTest.cpp
|
endif()
|
||||||
)
|
|
||||||
endif()
|
|
||||||
|
@ -156,13 +156,13 @@ void Q7STestTask::testDummyParams() {
|
|||||||
result = param.getValue<int>(DummyParameter::DUMMY_KEY_PARAM_1, test);
|
result = param.getValue<int>(DummyParameter::DUMMY_KEY_PARAM_1, test);
|
||||||
if (result != HasReturnvaluesIF::RETURN_OK) {
|
if (result != HasReturnvaluesIF::RETURN_OK) {
|
||||||
sif::warning << "Q7STestTask::testDummyParams: Key " << DummyParameter::DUMMY_KEY_PARAM_1
|
sif::warning << "Q7STestTask::testDummyParams: Key " << DummyParameter::DUMMY_KEY_PARAM_1
|
||||||
<< " does not exist" << std::endl;
|
<< " does not exist" << std::endl;
|
||||||
}
|
}
|
||||||
std::string test2;
|
std::string test2;
|
||||||
result = param.getValue<std::string>(DummyParameter::DUMMY_KEY_PARAM_2, test2);
|
result = param.getValue<std::string>(DummyParameter::DUMMY_KEY_PARAM_2, test2);
|
||||||
if (result != HasReturnvaluesIF::RETURN_OK) {
|
if (result != HasReturnvaluesIF::RETURN_OK) {
|
||||||
sif::warning << "Q7STestTask::testDummyParams: Key " << DummyParameter::DUMMY_KEY_PARAM_1
|
sif::warning << "Q7STestTask::testDummyParams: Key " << DummyParameter::DUMMY_KEY_PARAM_1
|
||||||
<< " does not exist" << std::endl;
|
<< " does not exist" << std::endl;
|
||||||
}
|
}
|
||||||
sif::info << "Test value (3 expected): " << test << std::endl;
|
sif::info << "Test value (3 expected): " << test << std::endl;
|
||||||
sif::info << "Test value 2 (\"blirb\" expected): " << test2 << std::endl;
|
sif::info << "Test value 2 (\"blirb\" expected): " << test2 << std::endl;
|
||||||
@ -172,7 +172,7 @@ ReturnValue_t Q7STestTask::initialize() {
|
|||||||
coreController = ObjectManager::instance()->get<CoreController>(objects::CORE_CONTROLLER);
|
coreController = ObjectManager::instance()->get<CoreController>(objects::CORE_CONTROLLER);
|
||||||
if (coreController == nullptr) {
|
if (coreController == nullptr) {
|
||||||
sif::warning << "Q7STestTask::initialize: Could not retrieve CORE_CONTROLLER object"
|
sif::warning << "Q7STestTask::initialize: Could not retrieve CORE_CONTROLLER object"
|
||||||
<< std::endl;
|
<< std::endl;
|
||||||
}
|
}
|
||||||
return TestTask::initialize();
|
return TestTask::initialize();
|
||||||
}
|
}
|
||||||
@ -182,14 +182,14 @@ void Q7STestTask::testProtHandler() {
|
|||||||
ReturnValue_t result = HasReturnvaluesIF::RETURN_OK;
|
ReturnValue_t result = HasReturnvaluesIF::RETURN_OK;
|
||||||
// If any chips are unlocked, lock them here
|
// If any chips are unlocked, lock them here
|
||||||
result = coreController->setBootCopyProtection(xsc::Chip::ALL_CHIP, xsc::Copy::ALL_COPY, true,
|
result = coreController->setBootCopyProtection(xsc::Chip::ALL_CHIP, xsc::Copy::ALL_COPY, true,
|
||||||
opPerformed, true);
|
opPerformed, true);
|
||||||
if (result != HasReturnvaluesIF::RETURN_OK) {
|
if (result != HasReturnvaluesIF::RETURN_OK) {
|
||||||
sif::warning << "Q7STestTask::testProtHandler: Op failed" << std::endl;
|
sif::warning << "Q7STestTask::testProtHandler: Op failed" << std::endl;
|
||||||
}
|
}
|
||||||
|
|
||||||
// unlock own copy
|
// unlock own copy
|
||||||
result = coreController->setBootCopyProtection(xsc::Chip::SELF_CHIP, xsc::Copy::SELF_COPY, false,
|
result = coreController->setBootCopyProtection(xsc::Chip::SELF_CHIP, xsc::Copy::SELF_COPY, false,
|
||||||
opPerformed, true);
|
opPerformed, true);
|
||||||
if (result != HasReturnvaluesIF::RETURN_OK) {
|
if (result != HasReturnvaluesIF::RETURN_OK) {
|
||||||
sif::warning << "Q7STestTask::testProtHandler: Op failed" << std::endl;
|
sif::warning << "Q7STestTask::testProtHandler: Op failed" << std::endl;
|
||||||
}
|
}
|
||||||
@ -203,7 +203,7 @@ void Q7STestTask::testProtHandler() {
|
|||||||
|
|
||||||
// lock own copy
|
// lock own copy
|
||||||
result = coreController->setBootCopyProtection(xsc::Chip::SELF_CHIP, xsc::Copy::SELF_COPY, true,
|
result = coreController->setBootCopyProtection(xsc::Chip::SELF_CHIP, xsc::Copy::SELF_COPY, true,
|
||||||
opPerformed, true);
|
opPerformed, true);
|
||||||
if (result != HasReturnvaluesIF::RETURN_OK) {
|
if (result != HasReturnvaluesIF::RETURN_OK) {
|
||||||
sif::warning << "Q7STestTask::testProtHandler: Op failed" << std::endl;
|
sif::warning << "Q7STestTask::testProtHandler: Op failed" << std::endl;
|
||||||
}
|
}
|
||||||
@ -217,7 +217,7 @@ void Q7STestTask::testProtHandler() {
|
|||||||
|
|
||||||
// unlock specific copy
|
// unlock specific copy
|
||||||
result = coreController->setBootCopyProtection(xsc::Chip::CHIP_1, xsc::Copy::COPY_1, false,
|
result = coreController->setBootCopyProtection(xsc::Chip::CHIP_1, xsc::Copy::COPY_1, false,
|
||||||
opPerformed, true);
|
opPerformed, true);
|
||||||
if (result != HasReturnvaluesIF::RETURN_OK) {
|
if (result != HasReturnvaluesIF::RETURN_OK) {
|
||||||
sif::warning << "Q7STestTask::testProtHandler: Op failed" << std::endl;
|
sif::warning << "Q7STestTask::testProtHandler: Op failed" << std::endl;
|
||||||
}
|
}
|
||||||
@ -231,7 +231,7 @@ void Q7STestTask::testProtHandler() {
|
|||||||
|
|
||||||
// lock specific copy
|
// lock specific copy
|
||||||
result = coreController->setBootCopyProtection(xsc::Chip::CHIP_1, xsc::Copy::COPY_1, true,
|
result = coreController->setBootCopyProtection(xsc::Chip::CHIP_1, xsc::Copy::COPY_1, true,
|
||||||
opPerformed, true);
|
opPerformed, true);
|
||||||
if (result != HasReturnvaluesIF::RETURN_OK) {
|
if (result != HasReturnvaluesIF::RETURN_OK) {
|
||||||
sif::warning << "Q7STestTask::testProtHandler: Op failed" << std::endl;
|
sif::warning << "Q7STestTask::testProtHandler: Op failed" << std::endl;
|
||||||
}
|
}
|
||||||
@ -273,7 +273,7 @@ void Q7STestTask::testGpsDaemonShm() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void Q7STestTask::testGpsDaemonSocket() {
|
void Q7STestTask::testGpsDaemonSocket() {
|
||||||
if(gpsmmShmPtr == nullptr) {
|
if (gpsmmShmPtr == nullptr) {
|
||||||
gpsmmShmPtr = new gpsmm("localhost", DEFAULT_GPSD_PORT);
|
gpsmmShmPtr = new gpsmm("localhost", DEFAULT_GPSD_PORT);
|
||||||
}
|
}
|
||||||
// The data from the device will generally be read all at once. Therefore, we
|
// The data from the device will generally be read all at once. Therefore, we
|
||||||
@ -283,7 +283,7 @@ void Q7STestTask::testGpsDaemonSocket() {
|
|||||||
// Opening failed
|
// Opening failed
|
||||||
#if FSFW_VERBOSE_LEVEL >= 1
|
#if FSFW_VERBOSE_LEVEL >= 1
|
||||||
sif::warning << "Q7STestTask::testGpsDaemonSocket: Opening GPSMM failed | "
|
sif::warning << "Q7STestTask::testGpsDaemonSocket: Opening GPSMM failed | "
|
||||||
<< "Error " << errno << " | " << gps_errstr(errno) << std::endl;
|
<< "Error " << errno << " | " << gps_errstr(errno) << std::endl;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
gpsNotOpenSwitch = false;
|
gpsNotOpenSwitch = false;
|
||||||
@ -291,17 +291,16 @@ void Q7STestTask::testGpsDaemonSocket() {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
// Stopwatch watch;
|
// Stopwatch watch;
|
||||||
gps_data_t *gps = nullptr;
|
gps_data_t* gps = nullptr;
|
||||||
gpsmmShmPtr->stream(WATCH_ENABLE | WATCH_JSON);
|
gpsmmShmPtr->stream(WATCH_ENABLE | WATCH_JSON);
|
||||||
if(not gpsmmShmPtr->waiting(50000000)) {
|
if (not gpsmmShmPtr->waiting(50000000)) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
gps = gpsmmShmPtr->read();
|
gps = gpsmmShmPtr->read();
|
||||||
if (gps == nullptr) {
|
if (gps == nullptr) {
|
||||||
if (gpsReadFailedSwitch) {
|
if (gpsReadFailedSwitch) {
|
||||||
gpsReadFailedSwitch = false;
|
gpsReadFailedSwitch = false;
|
||||||
sif::warning << "Q7STestTask::testGpsDaemonSocket: Reading GPS data failed"
|
sif::warning << "Q7STestTask::testGpsDaemonSocket: Reading GPS data failed" << std::endl;
|
||||||
<< std::endl;
|
|
||||||
}
|
}
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -312,8 +311,8 @@ void Q7STestTask::testGpsDaemonSocket() {
|
|||||||
if (noModeSetCntr == 10) {
|
if (noModeSetCntr == 10) {
|
||||||
// TODO: Trigger event here
|
// TODO: Trigger event here
|
||||||
sif::warning << "Q7STestTask::testGpsDaemonSocket: No mode could be "
|
sif::warning << "Q7STestTask::testGpsDaemonSocket: No mode could be "
|
||||||
"read for 10 consecutive reads"
|
"read for 10 consecutive reads"
|
||||||
<< std::endl;
|
<< std::endl;
|
||||||
noModeSetCntr = -1;
|
noModeSetCntr = -1;
|
||||||
}
|
}
|
||||||
return;
|
return;
|
||||||
@ -339,7 +338,7 @@ void Q7STestTask::testFileSystemHandlerDirect(FsOpCodes opCode) {
|
|||||||
auto fsHandler = ObjectManager::instance()->get<FileSystemHandler>(objects::FILE_SYSTEM_HANDLER);
|
auto fsHandler = ObjectManager::instance()->get<FileSystemHandler>(objects::FILE_SYSTEM_HANDLER);
|
||||||
if (fsHandler == nullptr) {
|
if (fsHandler == nullptr) {
|
||||||
sif::warning << "Q7STestTask::testFileSystemHandlerDirect: No FS handler running.."
|
sif::warning << "Q7STestTask::testFileSystemHandlerDirect: No FS handler running.."
|
||||||
<< std::endl;
|
<< std::endl;
|
||||||
}
|
}
|
||||||
FileSystemHandler::FsCommandCfg cfg = {};
|
FileSystemHandler::FsCommandCfg cfg = {};
|
||||||
ReturnValue_t result = HasReturnvaluesIF::RETURN_OK;
|
ReturnValue_t result = HasReturnvaluesIF::RETURN_OK;
|
||||||
@ -366,115 +365,115 @@ void Q7STestTask::testFileSystemHandlerDirect(FsOpCodes opCode) {
|
|||||||
};
|
};
|
||||||
|
|
||||||
switch (opCode) {
|
switch (opCode) {
|
||||||
case (FsOpCodes::CREATE_EMPTY_FILE_IN_TMP): {
|
case (FsOpCodes::CREATE_EMPTY_FILE_IN_TMP): {
|
||||||
// No mount prefix, cause file is created in tmp
|
// No mount prefix, cause file is created in tmp
|
||||||
cfg.useMountPrefix = false;
|
cfg.useMountPrefix = false;
|
||||||
sif::info << "Creating empty file in /tmp folder" << std::endl;
|
sif::info << "Creating empty file in /tmp folder" << std::endl;
|
||||||
// Do not delete file, user can check existence in shell
|
// Do not delete file, user can check existence in shell
|
||||||
fsHandler->createFile("/tmp/", "test.txt", nullptr, 0, &cfg);
|
|
||||||
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);
|
fsHandler->createFile("/tmp/", "test.txt", nullptr, 0, &cfg);
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
result = fsHandler->removeFile("/tmp", "test.txt", &cfg);
|
case (FsOpCodes::REMOVE_TMP_FILE): {
|
||||||
if (result == HasReturnvaluesIF::RETURN_OK) {
|
sif::info << "Deleting /tmp/test.txt sample file" << std::endl;
|
||||||
sif::info << "File removed successfully" << std::endl;
|
// No mount prefix, cause file is created in tmp
|
||||||
} else {
|
cfg.useMountPrefix = false;
|
||||||
sif::warning << "File removal failed!" << std::endl;
|
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;
|
||||||
}
|
}
|
||||||
break;
|
case (FsOpCodes::CREATE_DIR_IN_TMP): {
|
||||||
}
|
// No mount prefix, cause file is created in tmp
|
||||||
case (FsOpCodes::CREATE_DIR_IN_TMP): {
|
cfg.useMountPrefix = false;
|
||||||
// No mount prefix, cause file is created in tmp
|
sif::info << "Creating empty file in /tmp folder" << std::endl;
|
||||||
cfg.useMountPrefix = false;
|
// Do not delete file, user can check existence in shell
|
||||||
sif::info << "Creating empty file in /tmp folder" << std::endl;
|
ReturnValue_t result = fsHandler->createDirectory("/tmp/", "test", false, &cfg);
|
||||||
// Do not delete file, user can check existence in shell
|
if (result == HasReturnvaluesIF::RETURN_OK) {
|
||||||
ReturnValue_t result = fsHandler->createDirectory("/tmp/", "test", false, &cfg);
|
sif::info << "Directory created successfully" << std::endl;
|
||||||
if (result == HasReturnvaluesIF::RETURN_OK) {
|
} else {
|
||||||
sif::info << "Directory created successfully" << std::endl;
|
sif::warning << "Directory creation failed!" << std::endl;
|
||||||
} else {
|
}
|
||||||
sif::warning << "Directory creation failed!" << std::endl;
|
break;
|
||||||
}
|
}
|
||||||
break;
|
case (FsOpCodes::REMOVE_EMPTY_DIR_IN_TMP): {
|
||||||
}
|
// No mount prefix, cause file is created in tmp
|
||||||
case (FsOpCodes::REMOVE_EMPTY_DIR_IN_TMP): {
|
cfg.useMountPrefix = false;
|
||||||
// No mount prefix, cause file is created in tmp
|
if (not std::filesystem::exists("/tmp/test")) {
|
||||||
cfg.useMountPrefix = false;
|
result = fsHandler->createDirectory("/tmp", "test", false, &cfg);
|
||||||
if (not std::filesystem::exists("/tmp/test")) {
|
} else {
|
||||||
result = fsHandler->createDirectory("/tmp", "test", false, &cfg);
|
// Delete any leftover files to regular dir removal works
|
||||||
} else {
|
std::remove("/tmp/test/*");
|
||||||
// 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;
|
||||||
}
|
}
|
||||||
result = fsHandler->removeDirectory("/tmp/", "test", false, &cfg);
|
case (FsOpCodes::REMOVE_FILLED_DIR_IN_TMP): {
|
||||||
if (result == HasReturnvaluesIF::RETURN_OK) {
|
result = createNonEmptyTmpDir();
|
||||||
sif::info << "Directory removed successfully" << std::endl;
|
if (result != HasReturnvaluesIF::RETURN_OK) {
|
||||||
} else {
|
return;
|
||||||
sif::warning << "Directory removal failed!" << std::endl;
|
}
|
||||||
|
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;
|
||||||
}
|
}
|
||||||
break;
|
case (FsOpCodes::ATTEMPT_DIR_REMOVAL_NON_EMPTY): {
|
||||||
}
|
result = createNonEmptyTmpDir();
|
||||||
case (FsOpCodes::REMOVE_FILLED_DIR_IN_TMP): {
|
if (result != HasReturnvaluesIF::RETURN_OK) {
|
||||||
result = createNonEmptyTmpDir();
|
return;
|
||||||
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;
|
||||||
}
|
}
|
||||||
result = fsHandler->removeDirectory("/tmp/", "test", true, &cfg);
|
case (FsOpCodes::RENAME_FILE): {
|
||||||
if (result == HasReturnvaluesIF::RETURN_OK) {
|
// No mount prefix, cause file is created in tmp
|
||||||
sif::info << "Directory removed recursively successfully" << std::endl;
|
cfg.useMountPrefix = false;
|
||||||
} else {
|
if (std::filesystem::exists("/tmp/test.txt")) {
|
||||||
sif::warning << "Recursive directory removal failed!" << std::endl;
|
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;
|
||||||
}
|
}
|
||||||
break;
|
case (FsOpCodes::APPEND_TO_FILE): {
|
||||||
}
|
// No mount prefix, cause file is created in tmp
|
||||||
case (FsOpCodes::ATTEMPT_DIR_REMOVAL_NON_EMPTY): {
|
cfg.useMountPrefix = false;
|
||||||
result = createNonEmptyTmpDir();
|
if (std::filesystem::exists("/tmp/test.txt")) {
|
||||||
if (result != HasReturnvaluesIF::RETURN_OK) {
|
fsHandler->removeDirectory("/tmp/", "test", false, &cfg);
|
||||||
return;
|
}
|
||||||
|
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);
|
||||||
}
|
}
|
||||||
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);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -2,6 +2,7 @@
|
|||||||
#define BSP_Q7S_BOARDTEST_Q7STESTTASK_H_
|
#define BSP_Q7S_BOARDTEST_Q7STESTTASK_H_
|
||||||
|
|
||||||
#include <libgpsmm.h>
|
#include <libgpsmm.h>
|
||||||
|
|
||||||
#include "test/testtasks/TestTask.h"
|
#include "test/testtasks/TestTask.h"
|
||||||
|
|
||||||
class CoreController;
|
class CoreController;
|
||||||
|
@ -1,6 +1,2 @@
|
|||||||
target_sources(${OBSW_NAME} PRIVATE
|
target_sources(${OBSW_NAME} PRIVATE rwSpiCallback.cpp gnssCallback.cpp
|
||||||
rwSpiCallback.cpp
|
pcduSwitchCb.cpp q7sGpioCallbacks.cpp)
|
||||||
gnssCallback.cpp
|
|
||||||
pcduSwitchCb.cpp
|
|
||||||
q7sGpioCallbacks.cpp
|
|
||||||
)
|
|
||||||
|
@ -1,9 +1,14 @@
|
|||||||
#include "gnssCallback.h"
|
#include "gnssCallback.h"
|
||||||
|
|
||||||
#include "devices/gpioIds.h"
|
#include "devices/gpioIds.h"
|
||||||
|
#include "fsfw/action/HasActionsIF.h"
|
||||||
#include "fsfw/tasks/TaskFactory.h"
|
#include "fsfw/tasks/TaskFactory.h"
|
||||||
|
|
||||||
ReturnValue_t gps::triggerGpioResetPin(void* args) {
|
ReturnValue_t gps::triggerGpioResetPin(const uint8_t* actionData, size_t len, 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 HasReturnvaluesIF::RETURN_FAILED;
|
return HasReturnvaluesIF::RETURN_FAILED;
|
||||||
@ -12,11 +17,10 @@ ReturnValue_t gps::triggerGpioResetPin(void* args) {
|
|||||||
return HasReturnvaluesIF::RETURN_FAILED;
|
return HasReturnvaluesIF::RETURN_FAILED;
|
||||||
}
|
}
|
||||||
gpioId_t gpioId;
|
gpioId_t gpioId;
|
||||||
if (resetArgs->gnss1) {
|
if (actionData[0] == 0) {
|
||||||
gpioId = gpioIds::GNSS_1_NRESET;
|
|
||||||
|
|
||||||
} else {
|
|
||||||
gpioId = gpioIds::GNSS_0_NRESET;
|
gpioId = gpioIds::GNSS_0_NRESET;
|
||||||
|
} else {
|
||||||
|
gpioId = gpioIds::GNSS_1_NRESET;
|
||||||
}
|
}
|
||||||
resetArgs->gpioComIF->pullLow(gpioId);
|
resetArgs->gpioComIF->pullLow(gpioId);
|
||||||
TaskFactory::delayTask(resetArgs->waitPeriodMs);
|
TaskFactory::delayTask(resetArgs->waitPeriodMs);
|
||||||
|
@ -5,14 +5,13 @@
|
|||||||
#include "fsfw_hal/linux/gpio/LinuxLibgpioIF.h"
|
#include "fsfw_hal/linux/gpio/LinuxLibgpioIF.h"
|
||||||
|
|
||||||
struct ResetArgs {
|
struct ResetArgs {
|
||||||
bool gnss1 = false;
|
|
||||||
LinuxLibgpioIF* gpioComIF = nullptr;
|
LinuxLibgpioIF* gpioComIF = nullptr;
|
||||||
uint32_t waitPeriodMs = 100;
|
uint32_t waitPeriodMs = 100;
|
||||||
};
|
};
|
||||||
|
|
||||||
namespace gps {
|
namespace gps {
|
||||||
|
|
||||||
ReturnValue_t triggerGpioResetPin(void* args);
|
ReturnValue_t triggerGpioResetPin(const uint8_t* actionData, size_t len, void* args);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -48,7 +48,7 @@ void q7s::gpioCallbacks::initSpiCsDecoder(GpioIF* gpioComIF) {
|
|||||||
|
|
||||||
result = gpioComIF->addGpios(spiMuxGpios);
|
result = gpioComIF->addGpios(spiMuxGpios);
|
||||||
if (result != HasReturnvaluesIF::RETURN_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 SPI MUX bit GPIOs" << std::endl;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,5 +1,7 @@
|
|||||||
#include "rwSpiCallback.h"
|
#include "rwSpiCallback.h"
|
||||||
|
|
||||||
|
#include <fsfw/timemanager/Stopwatch.h>
|
||||||
|
|
||||||
#include "devices/gpioIds.h"
|
#include "devices/gpioIds.h"
|
||||||
#include "fsfw/serviceinterface/ServiceInterface.h"
|
#include "fsfw/serviceinterface/ServiceInterface.h"
|
||||||
#include "fsfw_hal/linux/UnixFileGuard.h"
|
#include "fsfw_hal/linux/UnixFileGuard.h"
|
||||||
@ -8,8 +10,25 @@
|
|||||||
|
|
||||||
namespace rwSpiCallback {
|
namespace rwSpiCallback {
|
||||||
|
|
||||||
|
namespace {
|
||||||
|
static bool MODE_SET = false;
|
||||||
|
|
||||||
|
ReturnValue_t openSpi(const std::string& devname, int flags, GpioIF* gpioIF, gpioId_t gpioId,
|
||||||
|
MutexIF* mutex, MutexIF::TimeoutType timeoutType, uint32_t timeoutMs,
|
||||||
|
int& fd);
|
||||||
|
/**
|
||||||
|
* @brief This function closes a spi session. Pulls the chip select to high an releases the
|
||||||
|
* mutex.
|
||||||
|
* @param gpioId Gpio ID of chip select
|
||||||
|
* @param gpioIF Pointer to gpio interface to drive the chip select
|
||||||
|
* @param mutex The spi mutex
|
||||||
|
*/
|
||||||
|
void closeSpi(int fd, gpioId_t gpioId, GpioIF* gpioIF, MutexIF* mutex);
|
||||||
|
} // namespace
|
||||||
|
|
||||||
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;
|
||||||
ReturnValue_t result = HasReturnvaluesIF::RETURN_OK;
|
ReturnValue_t result = HasReturnvaluesIF::RETURN_OK;
|
||||||
|
|
||||||
RwHandler* handler = reinterpret_cast<RwHandler*>(args);
|
RwHandler* handler = reinterpret_cast<RwHandler*>(args);
|
||||||
@ -18,51 +37,45 @@ ReturnValue_t spiCallback(SpiComIF* comIf, SpiCookie* cookie, const uint8_t* sen
|
|||||||
return HasReturnvaluesIF::RETURN_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->getMutex(&timeoutType, &timeoutMs);
|
MutexIF* mutex = comIf->getCsMutex();
|
||||||
|
cookie->getMutexParams(timeoutType, timeoutMs);
|
||||||
if (mutex == nullptr or gpioIF == nullptr) {
|
if (mutex == nullptr or gpioIF == nullptr) {
|
||||||
sif::debug << "rwSpiCallback::spiCallback: Mutex or GPIO interface invalid" << std::endl;
|
sif::debug << "rwSpiCallback::spiCallback: Mutex or GPIO interface invalid" << std::endl;
|
||||||
return HasReturnvaluesIF::RETURN_FAILED;
|
return HasReturnvaluesIF::RETURN_FAILED;
|
||||||
}
|
}
|
||||||
|
|
||||||
int fileDescriptor = 0;
|
int fileDescriptor = 0;
|
||||||
std::string device = cookie->getSpiDevice();
|
const std::string& dev = comIf->getSpiDev();
|
||||||
UnixFileGuard fileHelper(device, &fileDescriptor, O_RDWR, "rwSpiCallback::spiCallback");
|
result = openSpi(dev, O_RDWR, gpioIF, gpioId, mutex, timeoutType, timeoutMs, fileDescriptor);
|
||||||
if (fileHelper.getOpenResult() != HasReturnvaluesIF::RETURN_OK) {
|
|
||||||
sif::error << "rwSpiCallback::spiCallback: Failed to open device file" << std::endl;
|
|
||||||
return SpiComIF::OPENING_FILE_FAILED;
|
|
||||||
}
|
|
||||||
spi::SpiModes spiMode = spi::SpiModes::MODE_0;
|
|
||||||
uint32_t spiSpeed = 0;
|
|
||||||
cookie->getSpiParameters(spiMode, spiSpeed, nullptr);
|
|
||||||
comIf->setSpiSpeedAndMode(fileDescriptor, spiMode, spiSpeed);
|
|
||||||
|
|
||||||
result = mutex->lockMutex(timeoutType, timeoutMs);
|
|
||||||
if (result != HasReturnvaluesIF::RETURN_OK) {
|
if (result != HasReturnvaluesIF::RETURN_OK) {
|
||||||
sif::debug << "rwSpiCallback::spiCallback: Failed to lock mutex" << std::endl;
|
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
/** Sending frame start sign */
|
spi::SpiModes spiMode = spi::SpiModes::MODE_0;
|
||||||
writeBuffer[0] = 0x7E;
|
uint32_t spiSpeed = 0;
|
||||||
writeSize = 1;
|
cookie->getSpiParameters(spiMode, spiSpeed, nullptr);
|
||||||
|
// We are in protected section, so we can use the static variable here without issues.
|
||||||
// Pull SPI CS low. For now, no support for active high given
|
// We don't need to set the speed because a SPI core is used, but the mode has to be set once
|
||||||
if (gpioId != gpio::NO_GPIO) {
|
// correctly for all RWs
|
||||||
if (gpioIF->pullLow(gpioId) != HasReturnvaluesIF::RETURN_OK) {
|
if (not MODE_SET) {
|
||||||
sif::error << "rwSpiCallback::spiCallback: Failed to pull chip select low" << std::endl;
|
comIf->setSpiSpeedAndMode(fileDescriptor, spiMode, spiSpeed);
|
||||||
}
|
MODE_SET = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/** Sending frame start sign */
|
||||||
|
writeBuffer[0] = FLAG_BYTE;
|
||||||
|
writeSize = 1;
|
||||||
|
|
||||||
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(gpioId, gpioIF, mutex);
|
closeSpi(fileDescriptor, gpioId, gpioIF, mutex);
|
||||||
return RwHandler::SPI_WRITE_FAILURE;
|
return RwHandler::SPI_WRITE_FAILURE;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -87,33 +100,39 @@ 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(gpioId, gpioIF, mutex);
|
closeSpi(fileDescriptor, gpioId, gpioIF, mutex);
|
||||||
return RwHandler::SPI_WRITE_FAILURE;
|
return RwHandler::SPI_WRITE_FAILURE;
|
||||||
}
|
}
|
||||||
idx++;
|
idx++;
|
||||||
}
|
}
|
||||||
|
|
||||||
/** Sending frame end sign */
|
/** Sending frame end sign */
|
||||||
writeBuffer[0] = 0x7E;
|
writeBuffer[0] = FLAG_BYTE;
|
||||||
writeSize = 1;
|
writeSize = 1;
|
||||||
|
|
||||||
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(gpioId, gpioIF, mutex);
|
closeSpi(fileDescriptor, gpioId, gpioIF, mutex);
|
||||||
return RwHandler::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 != HasReturnvaluesIF::RETURN_OK) {
|
if (result != HasReturnvaluesIF::RETURN_OK) {
|
||||||
closeSpi(gpioId, gpioIF, mutex);
|
closeSpi(fileDescriptor, gpioId, gpioIF, mutex);
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
size_t replyBufferSize = cookie->getMaxBufferSize();
|
size_t replyBufferSize = cookie->getMaxBufferSize();
|
||||||
|
|
||||||
/** 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.
|
||||||
|
closeSpi(fileDescriptor, gpioId, gpioIF, mutex);
|
||||||
usleep(RwDefinitions::SPI_REPLY_DELAY);
|
usleep(RwDefinitions::SPI_REPLY_DELAY);
|
||||||
|
result = openSpi(dev, O_RDWR, gpioIF, gpioId, mutex, timeoutType, timeoutMs, fileDescriptor);
|
||||||
|
if (result != HasReturnvaluesIF::RETURN_OK) {
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The reaction wheel responds with empty frames while preparing the reply data.
|
* The reaction wheel responds with empty frames while preparing the reply data.
|
||||||
@ -123,13 +142,13 @@ ReturnValue_t spiCallback(SpiComIF* comIf, SpiCookie* cookie, const uint8_t* sen
|
|||||||
for (int idx = 0; idx < 10; idx++) {
|
for (int idx = 0; idx < 10; idx++) {
|
||||||
if (read(fileDescriptor, &byteRead, 1) != 1) {
|
if (read(fileDescriptor, &byteRead, 1) != 1) {
|
||||||
sif::error << "rwSpiCallback::spiCallback: Read failed" << std::endl;
|
sif::error << "rwSpiCallback::spiCallback: Read failed" << std::endl;
|
||||||
closeSpi(gpioId, gpioIF, mutex);
|
closeSpi(fileDescriptor, gpioId, gpioIF, mutex);
|
||||||
return RwHandler::SPI_READ_FAILURE;
|
return RwHandler::SPI_READ_FAILURE;
|
||||||
}
|
}
|
||||||
if (idx == 0) {
|
if (idx == 0) {
|
||||||
if (byteRead != FLAG_BYTE) {
|
if (byteRead != FLAG_BYTE) {
|
||||||
sif::error << "Invalid data, expected start marker" << std::endl;
|
sif::error << "Invalid data, expected start marker" << std::endl;
|
||||||
closeSpi(gpioId, gpioIF, mutex);
|
closeSpi(fileDescriptor, gpioId, gpioIF, mutex);
|
||||||
return RwHandler::NO_START_MARKER;
|
return RwHandler::NO_START_MARKER;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -140,7 +159,7 @@ 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(gpioId, gpioIF, mutex);
|
closeSpi(fileDescriptor, gpioId, gpioIF, mutex);
|
||||||
return RwHandler::NO_REPLY;
|
return RwHandler::NO_REPLY;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -180,7 +199,7 @@ 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(gpioId, gpioIF, mutex);
|
closeSpi(fileDescriptor, gpioId, gpioIF, mutex);
|
||||||
result = RwHandler::INVALID_SUBSTITUTE;
|
result = RwHandler::INVALID_SUBSTITUTE;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@ -201,8 +220,9 @@ ReturnValue_t spiCallback(SpiComIF* comIf, SpiCookie* cookie, const uint8_t* sen
|
|||||||
result = RwHandler::SPI_READ_FAILURE;
|
result = RwHandler::SPI_READ_FAILURE;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
if (byteRead != 0x7E) {
|
if (byteRead != FLAG_BYTE) {
|
||||||
sif::error << "rwSpiCallback::spiCallback: Missing end sign 0x7E" << std::endl;
|
sif::error << "rwSpiCallback::spiCallback: Missing end sign " << static_cast<int>(FLAG_BYTE)
|
||||||
|
<< std::endl;
|
||||||
decodedFrameLen--;
|
decodedFrameLen--;
|
||||||
result = RwHandler::MISSING_END_SIGN;
|
result = RwHandler::MISSING_END_SIGN;
|
||||||
break;
|
break;
|
||||||
@ -213,12 +233,40 @@ ReturnValue_t spiCallback(SpiComIF* comIf, SpiCookie* cookie, const uint8_t* sen
|
|||||||
|
|
||||||
cookie->setTransferSize(decodedFrameLen);
|
cookie->setTransferSize(decodedFrameLen);
|
||||||
|
|
||||||
closeSpi(gpioId, gpioIF, mutex);
|
closeSpi(fileDescriptor, gpioId, gpioIF, mutex);
|
||||||
|
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
void closeSpi(gpioId_t gpioId, GpioIF* gpioIF, MutexIF* mutex) {
|
namespace {
|
||||||
|
|
||||||
|
ReturnValue_t openSpi(const std::string& devname, int flags, GpioIF* gpioIF, gpioId_t gpioId,
|
||||||
|
MutexIF* mutex, MutexIF::TimeoutType timeoutType, uint32_t timeoutMs,
|
||||||
|
int& fd) {
|
||||||
|
ReturnValue_t result = mutex->lockMutex(timeoutType, timeoutMs);
|
||||||
|
if (result != HasReturnvaluesIF::RETURN_OK) {
|
||||||
|
sif::debug << "rwSpiCallback::spiCallback: Failed to lock mutex" << std::endl;
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
fd = open(devname.c_str(), flags);
|
||||||
|
if (fd < 0) {
|
||||||
|
sif::error << "rwSpiCallback::spiCallback: Failed to open device file" << std::endl;
|
||||||
|
return SpiComIF::OPENING_FILE_FAILED;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Pull SPI CS low. For now, no support for active high given
|
||||||
|
if (gpioId != gpio::NO_GPIO) {
|
||||||
|
result = gpioIF->pullLow(gpioId);
|
||||||
|
if (result != HasReturnvaluesIF::RETURN_OK) {
|
||||||
|
sif::error << "rwSpiCallback::spiCallback: Failed to pull chip select low" << std::endl;
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return HasReturnvaluesIF::RETURN_OK;
|
||||||
|
}
|
||||||
|
void closeSpi(int fd, gpioId_t gpioId, GpioIF* gpioIF, MutexIF* mutex) {
|
||||||
|
close(fd);
|
||||||
if (gpioId != gpio::NO_GPIO) {
|
if (gpioId != gpio::NO_GPIO) {
|
||||||
if (gpioIF->pullHigh(gpioId) != HasReturnvaluesIF::RETURN_OK) {
|
if (gpioIF->pullHigh(gpioId) != HasReturnvaluesIF::RETURN_OK) {
|
||||||
sif::error << "closeSpi: Failed to pull chip select high" << std::endl;
|
sif::error << "closeSpi: Failed to pull chip select high" << std::endl;
|
||||||
@ -229,4 +277,7 @@ void closeSpi(gpioId_t gpioId, GpioIF* gpioIF, MutexIF* mutex) {
|
|||||||
;
|
;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
} // namespace
|
||||||
|
|
||||||
} // namespace rwSpiCallback
|
} // namespace rwSpiCallback
|
||||||
|
@ -33,14 +33,5 @@ static constexpr uint8_t FLAG_BYTE = 0x7E;
|
|||||||
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);
|
||||||
|
|
||||||
/**
|
|
||||||
* @brief This function closes a spi session. Pulls the chip select to high an releases the
|
|
||||||
* mutex.
|
|
||||||
* @param gpioId Gpio ID of chip select
|
|
||||||
* @param gpioIF Pointer to gpio interface to drive the chip select
|
|
||||||
* @param mutex The spi mutex
|
|
||||||
*/
|
|
||||||
void closeSpi(gpioId_t gpioId, GpioIF* gpioIF, MutexIF* mutex);
|
|
||||||
|
|
||||||
} // namespace rwSpiCallback
|
} // namespace rwSpiCallback
|
||||||
#endif /* BSP_Q7S_RW_SPI_CALLBACK_H_ */
|
#endif /* BSP_Q7S_RW_SPI_CALLBACK_H_ */
|
||||||
|
@ -1,6 +1 @@
|
|||||||
target_sources(${OBSW_NAME} PRIVATE
|
target_sources(${OBSW_NAME} PRIVATE)
|
||||||
)
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@ -1,8 +1,4 @@
|
|||||||
target_sources(${OBSW_NAME} PRIVATE
|
target_sources(${OBSW_NAME} PRIVATE CoreController.cpp InitMission.cpp
|
||||||
CoreController.cpp
|
ObjectFactory.cpp)
|
||||||
InitMission.cpp
|
|
||||||
)
|
|
||||||
|
|
||||||
target_sources(${SIMPLE_OBSW_NAME} PRIVATE
|
target_sources(${SIMPLE_OBSW_NAME} PRIVATE InitMission.cpp)
|
||||||
InitMission.cpp
|
|
||||||
)
|
|
||||||
|
@ -56,6 +56,7 @@ CoreController::CoreController(object_id_t objectId)
|
|||||||
} catch (const std::filesystem::filesystem_error &e) {
|
} catch (const std::filesystem::filesystem_error &e) {
|
||||||
sif::error << "CoreController::CoreController: Failed with exception " << e.what() << std::endl;
|
sif::error << "CoreController::CoreController: Failed with exception " << e.what() << std::endl;
|
||||||
}
|
}
|
||||||
|
sdCardCheckCd.timeOut();
|
||||||
eventQueue = QueueFactory::instance()->createMessageQueue(5, EventMessage::MAX_MESSAGE_SIZE);
|
eventQueue = QueueFactory::instance()->createMessageQueue(5, EventMessage::MAX_MESSAGE_SIZE);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -77,6 +78,10 @@ void CoreController::performControlOperation() {
|
|||||||
performWatchdogControlOperation();
|
performWatchdogControlOperation();
|
||||||
sdStateMachine();
|
sdStateMachine();
|
||||||
performMountedSdCardOperations();
|
performMountedSdCardOperations();
|
||||||
|
if (sdCardCheckCd.hasTimedOut()) {
|
||||||
|
performSdCardCheck();
|
||||||
|
sdCardCheckCd.resetTimer();
|
||||||
|
}
|
||||||
readHkData();
|
readHkData();
|
||||||
opDivider5.checkAndIncrement();
|
opDivider5.checkAndIncrement();
|
||||||
opDivider10.checkAndIncrement();
|
opDivider10.checkAndIncrement();
|
||||||
@ -87,6 +92,7 @@ ReturnValue_t CoreController::initializeLocalDataPool(localpool::DataPool &local
|
|||||||
localDataPoolMap.emplace(core::TEMPERATURE, new PoolEntry<float>({0}));
|
localDataPoolMap.emplace(core::TEMPERATURE, new PoolEntry<float>({0}));
|
||||||
localDataPoolMap.emplace(core::PS_VOLTAGE, new PoolEntry<float>({0}));
|
localDataPoolMap.emplace(core::PS_VOLTAGE, new PoolEntry<float>({0}));
|
||||||
localDataPoolMap.emplace(core::PL_VOLTAGE, new PoolEntry<float>({0}));
|
localDataPoolMap.emplace(core::PL_VOLTAGE, new PoolEntry<float>({0}));
|
||||||
|
poolManager.subscribeForPeriodicPacket(hkSet.getSid(), false, 10.0, false);
|
||||||
return HasReturnvaluesIF::RETURN_OK;
|
return HasReturnvaluesIF::RETURN_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -133,6 +139,9 @@ ReturnValue_t CoreController::initialize() {
|
|||||||
|
|
||||||
ReturnValue_t CoreController::initializeAfterTaskCreation() {
|
ReturnValue_t CoreController::initializeAfterTaskCreation() {
|
||||||
ReturnValue_t result = HasReturnvaluesIF::RETURN_OK;
|
ReturnValue_t result = HasReturnvaluesIF::RETURN_OK;
|
||||||
|
sdInfo.pref = sdcMan->getPreferredSdCard();
|
||||||
|
sdcMan->setActiveSdCard(sdInfo.pref);
|
||||||
|
currMntPrefix = sdcMan->getCurrentMountPrefix();
|
||||||
if (BLOCKING_SD_INIT) {
|
if (BLOCKING_SD_INIT) {
|
||||||
ReturnValue_t result = initSdCardBlocking();
|
ReturnValue_t result = initSdCardBlocking();
|
||||||
if (result != HasReturnvaluesIF::RETURN_OK and result != SdCardManager::ALREADY_MOUNTED) {
|
if (result != HasReturnvaluesIF::RETURN_OK and result != SdCardManager::ALREADY_MOUNTED) {
|
||||||
@ -164,7 +173,7 @@ ReturnValue_t CoreController::executeAction(ActionId_t actionId, MessageQueueId_
|
|||||||
if (size < 1) {
|
if (size < 1) {
|
||||||
return HasActionsIF::INVALID_PARAMETERS;
|
return HasActionsIF::INVALID_PARAMETERS;
|
||||||
}
|
}
|
||||||
std::string path = sdcMan->getCurrentMountPrefix(sdInfo.pref) + REBOOT_FILE;
|
std::string path = sdcMan->getCurrentMountPrefix() + REBOOT_FILE;
|
||||||
// Disable the reboot file mechanism
|
// Disable the reboot file mechanism
|
||||||
parseRebootFile(path, rebootFile);
|
parseRebootFile(path, rebootFile);
|
||||||
if (data[0] == 0) {
|
if (data[0] == 0) {
|
||||||
@ -204,15 +213,20 @@ ReturnValue_t CoreController::executeAction(ActionId_t actionId, MessageQueueId_
|
|||||||
if (size < 1) {
|
if (size < 1) {
|
||||||
return HasActionsIF::INVALID_PARAMETERS;
|
return HasActionsIF::INVALID_PARAMETERS;
|
||||||
}
|
}
|
||||||
std::string path = sdcMan->getCurrentMountPrefix(sdInfo.pref) + REBOOT_FILE;
|
std::string path = sdcMan->getCurrentMountPrefix() + REBOOT_FILE;
|
||||||
// Disable the reboot file mechanism
|
// Disable the reboot file mechanism
|
||||||
parseRebootFile(path, rebootFile);
|
parseRebootFile(path, rebootFile);
|
||||||
rebootFile.maxCount = data[0];
|
rebootFile.maxCount = data[0];
|
||||||
rewriteRebootFile(rebootFile);
|
rewriteRebootFile(rebootFile);
|
||||||
return HasActionsIF::EXECUTION_FINISHED;
|
return HasActionsIF::EXECUTION_FINISHED;
|
||||||
}
|
}
|
||||||
|
case (XSC_REBOOT_OBC): {
|
||||||
|
// Warning: This function will never return, because it reboots the system
|
||||||
|
return actionXscReboot(data, size);
|
||||||
|
}
|
||||||
case (REBOOT_OBC): {
|
case (REBOOT_OBC): {
|
||||||
return actionPerformReboot(data, size);
|
// Warning: This function will never return, because it reboots the system
|
||||||
|
return actionReboot(data, size);
|
||||||
}
|
}
|
||||||
default: {
|
default: {
|
||||||
return HasActionsIF::INVALID_ACTION_ID;
|
return HasActionsIF::INVALID_ACTION_ID;
|
||||||
@ -236,13 +250,12 @@ ReturnValue_t CoreController::initSdCardBlocking() {
|
|||||||
return HasReturnvaluesIF::RETURN_OK;
|
return HasReturnvaluesIF::RETURN_OK;
|
||||||
#else
|
#else
|
||||||
|
|
||||||
result = sdcMan->getSdCardActiveStatus(sdInfo.currentState);
|
result = sdcMan->getSdCardsStatus(sdInfo.currentState);
|
||||||
if (result != HasReturnvaluesIF::RETURN_OK) {
|
if (result != HasReturnvaluesIF::RETURN_OK) {
|
||||||
sif::warning << "Getting SD card activity status failed" << std::endl;
|
sif::warning << "Getting SD card activity status failed" << std::endl;
|
||||||
}
|
}
|
||||||
|
|
||||||
#if Q7S_SD_CARD_CONFIG == Q7S_SD_COLD_REDUNDANT
|
#if Q7S_SD_CARD_CONFIG == Q7S_SD_COLD_REDUNDANT
|
||||||
determinePreferredSdCard();
|
|
||||||
updateSdInfoOther();
|
updateSdInfoOther();
|
||||||
sif::info << "Cold redundant SD card configuration, preferred SD card: "
|
sif::info << "Cold redundant SD card configuration, preferred SD card: "
|
||||||
<< static_cast<int>(sdInfo.pref) << std::endl;
|
<< static_cast<int>(sdInfo.pref) << std::endl;
|
||||||
@ -323,8 +336,8 @@ ReturnValue_t CoreController::sdStateMachine() {
|
|||||||
|
|
||||||
if (sdInfo.state == SdStates::SET_STATE_SELF) {
|
if (sdInfo.state == SdStates::SET_STATE_SELF) {
|
||||||
if (not sdInfo.commandExecuted) {
|
if (not sdInfo.commandExecuted) {
|
||||||
result = sdcMan->getSdCardActiveStatus(sdInfo.currentState);
|
result = sdcMan->getSdCardsStatus(sdInfo.currentState);
|
||||||
determinePreferredSdCard();
|
sdInfo.pref = sdcMan->getPreferredSdCard();
|
||||||
updateSdInfoOther();
|
updateSdInfoOther();
|
||||||
if (sdInfo.pref != sd::SdCard::SLOT_0 and sdInfo.pref != sd::SdCard::SLOT_1) {
|
if (sdInfo.pref != sd::SdCard::SLOT_0 and sdInfo.pref != sd::SdCard::SLOT_1) {
|
||||||
sif::warning << "Preferred SD card invalid. Setting to card 0.." << std::endl;
|
sif::warning << "Preferred SD card invalid. Setting to card 0.." << std::endl;
|
||||||
@ -467,7 +480,7 @@ ReturnValue_t CoreController::sdStateMachine() {
|
|||||||
sdInfo.state = SdStates::IDLE;
|
sdInfo.state = SdStates::IDLE;
|
||||||
sdInfo.cycleCount = 0;
|
sdInfo.cycleCount = 0;
|
||||||
sdcMan->setBlocking(false);
|
sdcMan->setBlocking(false);
|
||||||
sdcMan->getSdCardActiveStatus(sdInfo.currentState);
|
sdcMan->getSdCardsStatus(sdInfo.currentState);
|
||||||
if (not sdInfo.initFinished) {
|
if (not sdInfo.initFinished) {
|
||||||
updateSdInfoOther();
|
updateSdInfoOther();
|
||||||
sdInfo.initFinished = true;
|
sdInfo.initFinished = true;
|
||||||
@ -844,25 +857,18 @@ void CoreController::initPrint() {
|
|||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
ReturnValue_t CoreController::actionPerformReboot(const uint8_t *data, size_t size) {
|
ReturnValue_t CoreController::actionXscReboot(const uint8_t *data, size_t size) {
|
||||||
if (size < 1) {
|
if (size < 1) {
|
||||||
return HasActionsIF::INVALID_PARAMETERS;
|
return HasActionsIF::INVALID_PARAMETERS;
|
||||||
}
|
}
|
||||||
bool rebootSameBootCopy = data[0];
|
bool rebootSameBootCopy = data[0];
|
||||||
bool protOpPerformed;
|
bool protOpPerformed = false;
|
||||||
|
SdCardManager::instance()->setBlocking(true);
|
||||||
if (rebootSameBootCopy) {
|
if (rebootSameBootCopy) {
|
||||||
#if OBSW_VERBOSE_LEVEL >= 1
|
#if OBSW_VERBOSE_LEVEL >= 1
|
||||||
sif::info << "CoreController::actionPerformReboot: Rebooting on current image" << std::endl;
|
sif::info << "CoreController::actionPerformReboot: Rebooting on current image" << std::endl;
|
||||||
#endif
|
#endif
|
||||||
// Attempt graceful shutdown by unmounting and switching off SD cards
|
gracefulShutdownTasks(xsc::Chip::SELF_CHIP, xsc::Copy::SELF_COPY, protOpPerformed);
|
||||||
SdCardManager::instance()->switchOffSdCard(sd::SdCard::SLOT_0);
|
|
||||||
SdCardManager::instance()->switchOffSdCard(sd::SdCard::SLOT_1);
|
|
||||||
// If any boot copies are unprotected
|
|
||||||
ReturnValue_t retval = setBootCopyProtection(xsc::Chip::SELF_CHIP, xsc::Copy::SELF_COPY, true,
|
|
||||||
protOpPerformed, false);
|
|
||||||
if (retval == HasReturnvaluesIF::RETURN_OK and protOpPerformed) {
|
|
||||||
sif::info << "Running slot was writeprotected before reboot" << std::endl;
|
|
||||||
}
|
|
||||||
int result = std::system("xsc_boot_copy -r");
|
int result = std::system("xsc_boot_copy -r");
|
||||||
if (result != 0) {
|
if (result != 0) {
|
||||||
utility::handleSystemError(result, "CoreController::executeAction");
|
utility::handleSystemError(result, "CoreController::executeAction");
|
||||||
@ -884,12 +890,8 @@ ReturnValue_t CoreController::actionPerformReboot(const uint8_t *data, size_t si
|
|||||||
auto tgtChip = static_cast<xsc::Chip>(data[1]);
|
auto tgtChip = static_cast<xsc::Chip>(data[1]);
|
||||||
auto tgtCopy = static_cast<xsc::Copy>(data[2]);
|
auto tgtCopy = static_cast<xsc::Copy>(data[2]);
|
||||||
|
|
||||||
ReturnValue_t retval =
|
// This function can not really fail
|
||||||
setBootCopyProtection(static_cast<xsc::Chip>(data[1]), static_cast<xsc::Copy>(data[2]), true,
|
gracefulShutdownTasks(tgtChip, tgtCopy, protOpPerformed);
|
||||||
protOpPerformed, false);
|
|
||||||
if (retval == HasReturnvaluesIF::RETURN_OK and protOpPerformed) {
|
|
||||||
sif::info << "Target slot was writeprotected before reboot" << std::endl;
|
|
||||||
}
|
|
||||||
|
|
||||||
switch (tgtChip) {
|
switch (tgtChip) {
|
||||||
case (xsc::Chip::CHIP_0): {
|
case (xsc::Chip::CHIP_0): {
|
||||||
@ -930,27 +932,32 @@ ReturnValue_t CoreController::actionPerformReboot(const uint8_t *data, size_t si
|
|||||||
return HasReturnvaluesIF::RETURN_FAILED;
|
return HasReturnvaluesIF::RETURN_FAILED;
|
||||||
}
|
}
|
||||||
|
|
||||||
CoreController::~CoreController() {}
|
ReturnValue_t CoreController::actionReboot(const uint8_t *data, size_t size) {
|
||||||
|
bool protOpPerformed = false;
|
||||||
void CoreController::determinePreferredSdCard() {
|
gracefulShutdownTasks(xsc::Chip::CHIP_0, xsc::Copy::COPY_0, protOpPerformed);
|
||||||
if (sdInfo.pref == sd::SdCard::NONE) {
|
std::system("reboot");
|
||||||
ReturnValue_t result = sdcMan->getPreferredSdCard(sdInfo.pref);
|
return RETURN_OK;
|
||||||
if (result != HasReturnvaluesIF::RETURN_OK) {
|
|
||||||
if (result == scratch::KEY_NOT_FOUND) {
|
|
||||||
sif::warning << "CoreController::sdCardInit: "
|
|
||||||
"Preferred SD card not set. Setting to 0"
|
|
||||||
<< std::endl;
|
|
||||||
sdcMan->setPreferredSdCard(sd::SdCard::SLOT_0);
|
|
||||||
sdInfo.pref = sd::SdCard::SLOT_0;
|
|
||||||
} else {
|
|
||||||
sif::warning << "CoreController::sdCardInit: Could not get preferred SD card"
|
|
||||||
"information from the scratch buffer"
|
|
||||||
<< std::endl;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
ReturnValue_t CoreController::gracefulShutdownTasks(xsc::Chip chip, xsc::Copy copy,
|
||||||
|
bool &protOpPerformed) {
|
||||||
|
sdcMan->setBlocking(true);
|
||||||
|
// Attempt graceful shutdown by unmounting and switching off SD cards
|
||||||
|
sdcMan->switchOffSdCard(sd::SdCard::SLOT_0);
|
||||||
|
sdcMan->switchOffSdCard(sd::SdCard::SLOT_1);
|
||||||
|
// If any boot copies are unprotected
|
||||||
|
ReturnValue_t result = setBootCopyProtection(xsc::Chip::SELF_CHIP, xsc::Copy::SELF_COPY, true,
|
||||||
|
protOpPerformed, false);
|
||||||
|
if (result == HasReturnvaluesIF::RETURN_OK and protOpPerformed) {
|
||||||
|
// TODO: Would be nice to notify operator. But we can't use the filesystem anymore
|
||||||
|
// and a reboot is imminent. Use scratch buffer?
|
||||||
|
sif::info << "Running slot was writeprotected before reboot" << std::endl;
|
||||||
|
}
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
CoreController::~CoreController() {}
|
||||||
|
|
||||||
void CoreController::updateSdInfoOther() {
|
void CoreController::updateSdInfoOther() {
|
||||||
if (sdInfo.pref == sd::SdCard::SLOT_0) {
|
if (sdInfo.pref == sd::SdCard::SLOT_0) {
|
||||||
sdInfo.prefChar = "0";
|
sdInfo.prefChar = "0";
|
||||||
@ -1234,24 +1241,73 @@ void CoreController::performWatchdogControlOperation() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void CoreController::performMountedSdCardOperations() {
|
void CoreController::performMountedSdCardOperations() {
|
||||||
currMntPrefix = sdcMan->getCurrentMountPrefix();
|
auto mountedSdCardOp = [&](bool &mntSwitch, sd::SdCard sdCard, std::string mntPoint) {
|
||||||
if (doPerformMountedSdCardOps) {
|
if (mntSwitch) {
|
||||||
bool sdCardMounted = false;
|
bool sdCardMounted = sdcMan->isSdCardMounted(sdCard);
|
||||||
sdCardMounted = sdcMan->isSdCardMounted(sdInfo.pref);
|
if (sdCardMounted and not performOneShotSdCardOpsSwitch) {
|
||||||
if (sdCardMounted) {
|
std::ostringstream path;
|
||||||
std::string path = currMntPrefix + "/" + CONF_FOLDER;
|
path << mntPoint << "/" << CONF_FOLDER;
|
||||||
if (not std::filesystem::exists(path)) {
|
if (not std::filesystem::exists(path.str())) {
|
||||||
std::filesystem::create_directory(path);
|
std::filesystem::create_directory(path.str());
|
||||||
|
}
|
||||||
|
initVersionFile();
|
||||||
|
initClockFromTimeFile();
|
||||||
|
performRebootFileHandling(false);
|
||||||
|
performOneShotSdCardOpsSwitch = true;
|
||||||
}
|
}
|
||||||
initVersionFile();
|
mntSwitch = false;
|
||||||
initClockFromTimeFile();
|
|
||||||
performRebootFileHandling(false);
|
|
||||||
doPerformMountedSdCardOps = false;
|
|
||||||
}
|
}
|
||||||
|
};
|
||||||
|
if (sdInfo.pref == sd::SdCard::SLOT_1) {
|
||||||
|
mountedSdCardOp(sdInfo.mountSwitch.second, sd::SdCard::SLOT_1, SdCardManager::SD_1_MOUNT_POINT);
|
||||||
|
mountedSdCardOp(sdInfo.mountSwitch.first, sd::SdCard::SLOT_0, SdCardManager::SD_0_MOUNT_POINT);
|
||||||
|
} else {
|
||||||
|
mountedSdCardOp(sdInfo.mountSwitch.first, sd::SdCard::SLOT_0, SdCardManager::SD_0_MOUNT_POINT);
|
||||||
|
mountedSdCardOp(sdInfo.mountSwitch.second, sd::SdCard::SLOT_1, SdCardManager::SD_1_MOUNT_POINT);
|
||||||
}
|
}
|
||||||
timeFileHandler();
|
timeFileHandler();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
ReturnValue_t CoreController::performSdCardCheck() {
|
||||||
|
bool mountedReadOnly = false;
|
||||||
|
SdCardManager::SdStatePair active;
|
||||||
|
sdcMan->getSdCardsStatus(active);
|
||||||
|
auto sdCardCheck = [&](sd::SdCard sdCard) {
|
||||||
|
ReturnValue_t result = sdcMan->isSdCardMountedReadOnly(sdCard, mountedReadOnly);
|
||||||
|
if (result != HasReturnvaluesIF::RETURN_OK) {
|
||||||
|
sif::error << "CoreController::performSdCardCheck: Could not check "
|
||||||
|
"read-only mount state"
|
||||||
|
<< std::endl;
|
||||||
|
mountedReadOnly = true;
|
||||||
|
}
|
||||||
|
if (mountedReadOnly) {
|
||||||
|
int linuxErrno = 0;
|
||||||
|
result = sdcMan->performFsck(sdCard, true, linuxErrno);
|
||||||
|
if (result != HasReturnvaluesIF::RETURN_OK) {
|
||||||
|
sif::error << "CoreController::performSdCardCheck: fsck command on SD Card "
|
||||||
|
<< static_cast<uint8_t>(sdCard) << " failed with code " << linuxErrno << " | "
|
||||||
|
<< strerror(linuxErrno);
|
||||||
|
}
|
||||||
|
result = sdcMan->remountReadWrite(sdCard);
|
||||||
|
if (result == HasReturnvaluesIF::RETURN_OK) {
|
||||||
|
sif::warning << "CoreController::performSdCardCheck: Remounted SD Card "
|
||||||
|
<< static_cast<uint8_t>(sdCard) << " read-write";
|
||||||
|
} else {
|
||||||
|
sif::error << "CoreController::performSdCardCheck: Remounting SD Card "
|
||||||
|
<< static_cast<uint8_t>(sdCard) << " read-write failed";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
};
|
||||||
|
if (active.first == sd::SdState::MOUNTED) {
|
||||||
|
sdCardCheck(sd::SdCard::SLOT_0);
|
||||||
|
}
|
||||||
|
if (active.second == sd::SdState::MOUNTED) {
|
||||||
|
sdCardCheck(sd::SdCard::SLOT_1);
|
||||||
|
}
|
||||||
|
|
||||||
|
return RETURN_OK;
|
||||||
|
}
|
||||||
|
|
||||||
void CoreController::performRebootFileHandling(bool recreateFile) {
|
void CoreController::performRebootFileHandling(bool recreateFile) {
|
||||||
using namespace std;
|
using namespace std;
|
||||||
std::string path = currMntPrefix + REBOOT_FILE;
|
std::string path = currMntPrefix + REBOOT_FILE;
|
||||||
@ -1677,7 +1733,7 @@ void CoreController::rewriteRebootFile(RebootFile file) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void CoreController::setRebootMechanismLock(bool lock, xsc::Chip tgtChip, xsc::Copy tgtCopy) {
|
void CoreController::setRebootMechanismLock(bool lock, xsc::Chip tgtChip, xsc::Copy tgtCopy) {
|
||||||
std::string path = sdcMan->getCurrentMountPrefix(sdInfo.pref) + REBOOT_FILE;
|
std::string path = currMntPrefix + REBOOT_FILE;
|
||||||
// Disable the reboot file mechanism
|
// Disable the reboot file mechanism
|
||||||
parseRebootFile(path, rebootFile);
|
parseRebootFile(path, rebootFile);
|
||||||
if (tgtChip == xsc::CHIP_0) {
|
if (tgtChip == xsc::CHIP_0) {
|
||||||
|
@ -67,13 +67,16 @@ class CoreController : public ExtendedControllerBase {
|
|||||||
static constexpr ActionId_t SWITCH_IMG_LOCK = 7;
|
static constexpr ActionId_t SWITCH_IMG_LOCK = 7;
|
||||||
static constexpr ActionId_t SET_MAX_REBOOT_CNT = 8;
|
static constexpr ActionId_t SET_MAX_REBOOT_CNT = 8;
|
||||||
|
|
||||||
static constexpr ActionId_t REBOOT_OBC = 32;
|
//! Reboot using the xsc_boot_copy command
|
||||||
|
static constexpr ActionId_t XSC_REBOOT_OBC = 32;
|
||||||
static constexpr ActionId_t MOUNT_OTHER_COPY = 33;
|
static constexpr ActionId_t MOUNT_OTHER_COPY = 33;
|
||||||
|
//! Reboot using the reboot command
|
||||||
|
static constexpr ActionId_t REBOOT_OBC = 34;
|
||||||
|
|
||||||
static constexpr uint8_t SUBSYSTEM_ID = SUBSYSTEM_ID::CORE;
|
static constexpr uint8_t SUBSYSTEM_ID = SUBSYSTEM_ID::CORE;
|
||||||
|
|
||||||
static constexpr Event ALLOC_FAILURE = event::makeEvent(SUBSYSTEM_ID, 0, severity::MEDIUM);
|
static constexpr Event ALLOC_FAILURE = event::makeEvent(SUBSYSTEM_ID, 0, severity::MEDIUM);
|
||||||
//! [EXPORT] : [COMMENT] Software reboot occured. Can also be a systemd reboot.
|
//! [EXPORT] : [COMMENT] Software reboot occurred. Can also be a systemd reboot.
|
||||||
//! P1: Current Chip, P2: Current Copy
|
//! P1: Current Chip, P2: Current Copy
|
||||||
static constexpr Event REBOOT_SW = event::makeEvent(SUBSYSTEM_ID, 1, severity::MEDIUM);
|
static constexpr Event REBOOT_SW = event::makeEvent(SUBSYSTEM_ID, 1, severity::MEDIUM);
|
||||||
//! [EXPORT] : [COMMENT] The reboot mechanism was triggered.
|
//! [EXPORT] : [COMMENT] The reboot mechanism was triggered.
|
||||||
@ -159,11 +162,12 @@ class CoreController : public ExtendedControllerBase {
|
|||||||
|
|
||||||
struct SdInfo {
|
struct SdInfo {
|
||||||
sd::SdCard pref = sd::SdCard::NONE;
|
sd::SdCard pref = sd::SdCard::NONE;
|
||||||
sd::SdState prefState = sd::SdState::OFF;
|
|
||||||
sd::SdCard other = sd::SdCard::NONE;
|
sd::SdCard other = sd::SdCard::NONE;
|
||||||
|
sd::SdState prefState = sd::SdState::OFF;
|
||||||
sd::SdState otherState = sd::SdState::OFF;
|
sd::SdState otherState = sd::SdState::OFF;
|
||||||
std::string prefChar = "0";
|
std::string prefChar = "0";
|
||||||
std::string otherChar = "1";
|
std::string otherChar = "1";
|
||||||
|
std::pair<bool, bool> mountSwitch = {true, true};
|
||||||
SdStates state = SdStates::START;
|
SdStates state = SdStates::START;
|
||||||
// Used to track whether a command was executed
|
// Used to track whether a command was executed
|
||||||
bool commandExecuted = true;
|
bool commandExecuted = true;
|
||||||
@ -179,7 +183,7 @@ class CoreController : public ExtendedControllerBase {
|
|||||||
} sdInfo;
|
} sdInfo;
|
||||||
RebootFile rebootFile = {};
|
RebootFile rebootFile = {};
|
||||||
std::string currMntPrefix;
|
std::string currMntPrefix;
|
||||||
bool doPerformMountedSdCardOps = true;
|
bool performOneShotSdCardOpsSwitch = true;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Index 0: Chip 0 Copy 0
|
* Index 0: Chip 0 Copy 0
|
||||||
@ -195,12 +199,14 @@ class CoreController : public ExtendedControllerBase {
|
|||||||
|
|
||||||
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();
|
||||||
|
|
||||||
ReturnValue_t initClockFromTimeFile();
|
ReturnValue_t initClockFromTimeFile();
|
||||||
|
ReturnValue_t performSdCardCheck();
|
||||||
ReturnValue_t timeFileHandler();
|
ReturnValue_t timeFileHandler();
|
||||||
ReturnValue_t initBootCopy();
|
ReturnValue_t initBootCopy();
|
||||||
ReturnValue_t initWatchdogFifo();
|
ReturnValue_t initWatchdogFifo();
|
||||||
@ -214,14 +220,16 @@ class CoreController : public ExtendedControllerBase {
|
|||||||
ReturnValue_t sdColdRedundantBlockingInit();
|
ReturnValue_t sdColdRedundantBlockingInit();
|
||||||
|
|
||||||
void currentStateSetter(sd::SdCard sdCard, sd::SdState newState);
|
void currentStateSetter(sd::SdCard sdCard, sd::SdState newState);
|
||||||
void determinePreferredSdCard();
|
|
||||||
void executeNextExternalSdCommand();
|
void executeNextExternalSdCommand();
|
||||||
void checkExternalSdCommandStatus();
|
void checkExternalSdCommandStatus();
|
||||||
void performRebootFileHandling(bool recreateFile);
|
void performRebootFileHandling(bool recreateFile);
|
||||||
|
|
||||||
ReturnValue_t actionListDirectoryIntoFile(ActionId_t actionId, MessageQueueId_t commandedBy,
|
ReturnValue_t actionListDirectoryIntoFile(ActionId_t actionId, MessageQueueId_t commandedBy,
|
||||||
const uint8_t* data, size_t size);
|
const uint8_t* data, size_t size);
|
||||||
ReturnValue_t actionPerformReboot(const uint8_t* data, size_t size);
|
ReturnValue_t actionXscReboot(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);
|
||||||
|
|
||||||
void performWatchdogControlOperation();
|
void performWatchdogControlOperation();
|
||||||
|
|
||||||
|
@ -1,5 +1,7 @@
|
|||||||
#include "bsp_q7s/core/InitMission.h"
|
#include "bsp_q7s/core/InitMission.h"
|
||||||
|
|
||||||
|
#include <fsfw/devicehandlers/DeviceCommunicationIF.h>
|
||||||
|
|
||||||
#include <iostream>
|
#include <iostream>
|
||||||
#include <vector>
|
#include <vector>
|
||||||
|
|
||||||
@ -13,6 +15,7 @@
|
|||||||
#include "fsfw/tasks/FixedTimeslotTaskIF.h"
|
#include "fsfw/tasks/FixedTimeslotTaskIF.h"
|
||||||
#include "fsfw/tasks/PeriodicTaskIF.h"
|
#include "fsfw/tasks/PeriodicTaskIF.h"
|
||||||
#include "fsfw/tasks/TaskFactory.h"
|
#include "fsfw/tasks/TaskFactory.h"
|
||||||
|
#include "mission/devices/devicedefinitions/Max31865Definitions.h"
|
||||||
#include "mission/utility/InitMission.h"
|
#include "mission/utility/InitMission.h"
|
||||||
#include "pollingsequence/pollingSequenceFactory.h"
|
#include "pollingsequence/pollingSequenceFactory.h"
|
||||||
|
|
||||||
@ -33,8 +36,16 @@ ObjectManagerIF* objectManager = nullptr;
|
|||||||
|
|
||||||
void initmission::initMission() {
|
void initmission::initMission() {
|
||||||
sif::info << "Building global objects.." << std::endl;
|
sif::info << "Building global objects.." << std::endl;
|
||||||
/* Instantiate global object manager and also create all objects */
|
try {
|
||||||
ObjectManager::instance()->setObjectFactoryFunction(ObjectFactory::produce, nullptr);
|
/* 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;
|
sif::info << "Initializing all objects.." << std::endl;
|
||||||
ObjectManager::instance()->initialize();
|
ObjectManager::instance()->initialize();
|
||||||
|
|
||||||
@ -115,30 +126,72 @@ void initmission::initTasks() {
|
|||||||
|
|
||||||
#if OBSW_ADD_ACS_HANDLERS == 1
|
#if OBSW_ADD_ACS_HANDLERS == 1
|
||||||
PeriodicTaskIF* acsTask = factory->createPeriodicTask(
|
PeriodicTaskIF* acsTask = factory->createPeriodicTask(
|
||||||
"ACS_CTRL", 45, PeriodicTaskIF::MINIMUM_STACK_SIZE * 2, 0.4, missedDeadlineFunc);
|
"ACS_TASK", 50, PeriodicTaskIF::MINIMUM_STACK_SIZE * 2, 0.4, missedDeadlineFunc);
|
||||||
result = acsTask->addComponent(objects::GPS_CONTROLLER);
|
result = acsTask->addComponent(objects::GPS_CONTROLLER);
|
||||||
if (result != HasReturnvaluesIF::RETURN_OK) {
|
if (result != HasReturnvaluesIF::RETURN_OK) {
|
||||||
initmission::printAddObjectError("GPS_CTRL", objects::GPS_CONTROLLER);
|
initmission::printAddObjectError("GPS_CTRL", objects::GPS_CONTROLLER);
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif /* OBSW_ADD_ACS_HANDLERS */
|
#endif /* OBSW_ADD_ACS_HANDLERS */
|
||||||
|
|
||||||
PeriodicTaskIF* sysTask = factory->createPeriodicTask(
|
PeriodicTaskIF* sysTask = factory->createPeriodicTask(
|
||||||
"SYS_TASK", 40, PeriodicTaskIF::MINIMUM_STACK_SIZE * 2, 0.4, missedDeadlineFunc);
|
"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);
|
result = sysTask->addComponent(objects::ACS_BOARD_ASS);
|
||||||
if (result != HasReturnvaluesIF::RETURN_OK) {
|
if (result != HasReturnvaluesIF::RETURN_OK) {
|
||||||
initmission::printAddObjectError("ACS_BOARD_ASS", objects::ACS_BOARD_ASS);
|
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
|
#if OBSW_ADD_SUS_BOARD_ASS == 1
|
||||||
result = sysTask->addComponent(objects::SUS_BOARD_ASS);
|
result = sysTask->addComponent(objects::SUS_BOARD_ASS);
|
||||||
if (result != HasReturnvaluesIF::RETURN_OK) {
|
if (result != HasReturnvaluesIF::RETURN_OK) {
|
||||||
initmission::printAddObjectError("SUS_BOARD_ASS", objects::SUS_BOARD_ASS);
|
initmission::printAddObjectError("SUS_BOARD_ASS", objects::SUS_BOARD_ASS);
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
result = sysTask->addComponent(objects::TCS_BOARD_ASS);
|
|
||||||
|
#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) {
|
if (result != HasReturnvaluesIF::RETURN_OK) {
|
||||||
initmission::printAddObjectError("TCS_BOARD_ASS", objects::TCS_BOARD_ASS);
|
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
|
// FS task, task interval does not matter because it runs in permanent loop, priority low
|
||||||
// because it is a non-essential background task
|
// because it is a non-essential background task
|
||||||
@ -167,6 +220,15 @@ void initmission::initTasks() {
|
|||||||
}
|
}
|
||||||
#endif /* OBSW_ADD_PLOC_MPSOC */
|
#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
|
#if OBSW_TEST_CCSDS_BRIDGE == 1
|
||||||
PeriodicTaskIF* ptmeTestTask = factory->createPeriodicTask(
|
PeriodicTaskIF* ptmeTestTask = factory->createPeriodicTask(
|
||||||
"PTME_TEST", 80, PeriodicTaskIF::MINIMUM_STACK_SIZE, 2.0, missedDeadlineFunc);
|
"PTME_TEST", 80, PeriodicTaskIF::MINIMUM_STACK_SIZE, 2.0, missedDeadlineFunc);
|
||||||
@ -228,9 +290,15 @@ void initmission::initTasks() {
|
|||||||
|
|
||||||
#if OBSW_ADD_ACS_HANDLERS == 1
|
#if OBSW_ADD_ACS_HANDLERS == 1
|
||||||
acsTask->startTask();
|
acsTask->startTask();
|
||||||
#endif
|
#endif /* OBSW_ADD_ACS_HANDLERS == 1 */
|
||||||
sysTask->startTask();
|
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;
|
sif::info << "Tasks started.." << std::endl;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -241,7 +309,7 @@ void initmission::createPstTasks(TaskFactory& factory,
|
|||||||
/* Polling Sequence Table Default */
|
/* Polling Sequence Table Default */
|
||||||
#if OBSW_ADD_SPI_TEST_CODE == 0
|
#if OBSW_ADD_SPI_TEST_CODE == 0
|
||||||
FixedTimeslotTaskIF* spiPst = factory.createFixedTimeslotTask(
|
FixedTimeslotTaskIF* spiPst = factory.createFixedTimeslotTask(
|
||||||
"PST_TASK_DEFAULT", 70, PeriodicTaskIF::MINIMUM_STACK_SIZE * 4, 0.5, missedDeadlineFunc);
|
"MAIN_SPI", 75, PeriodicTaskIF::MINIMUM_STACK_SIZE * 4, 0.5, missedDeadlineFunc);
|
||||||
result = pst::pstSpi(spiPst);
|
result = pst::pstSpi(spiPst);
|
||||||
if (result != HasReturnvaluesIF::RETURN_OK) {
|
if (result != HasReturnvaluesIF::RETURN_OK) {
|
||||||
if (result == FixedTimeslotTaskIF::SLOT_LIST_EMPTY) {
|
if (result == FixedTimeslotTaskIF::SLOT_LIST_EMPTY) {
|
||||||
@ -254,8 +322,23 @@ void initmission::createPstTasks(TaskFactory& factory,
|
|||||||
}
|
}
|
||||||
#endif
|
#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(
|
FixedTimeslotTaskIF* uartPst = factory.createFixedTimeslotTask(
|
||||||
"UART_PST", 70, PeriodicTaskIF::MINIMUM_STACK_SIZE * 4, 0.2, missedDeadlineFunc);
|
"UART_PST", 65, PeriodicTaskIF::MINIMUM_STACK_SIZE * 4, 0.2, missedDeadlineFunc);
|
||||||
result = pst::pstUart(uartPst);
|
result = pst::pstUart(uartPst);
|
||||||
if (result != HasReturnvaluesIF::RETURN_OK) {
|
if (result != HasReturnvaluesIF::RETURN_OK) {
|
||||||
if (result == FixedTimeslotTaskIF::SLOT_LIST_EMPTY) {
|
if (result == FixedTimeslotTaskIF::SLOT_LIST_EMPTY) {
|
||||||
@ -268,7 +351,7 @@ void initmission::createPstTasks(TaskFactory& factory,
|
|||||||
}
|
}
|
||||||
|
|
||||||
FixedTimeslotTaskIF* gpioPst = factory.createFixedTimeslotTask(
|
FixedTimeslotTaskIF* gpioPst = factory.createFixedTimeslotTask(
|
||||||
"GPIO_PST", 70, PeriodicTaskIF::MINIMUM_STACK_SIZE * 4, 0.2, missedDeadlineFunc);
|
"GPIO_PST", 70, PeriodicTaskIF::MINIMUM_STACK_SIZE * 2, 0.2, missedDeadlineFunc);
|
||||||
result = pst::pstGpio(gpioPst);
|
result = pst::pstGpio(gpioPst);
|
||||||
if (result != HasReturnvaluesIF::RETURN_OK) {
|
if (result != HasReturnvaluesIF::RETURN_OK) {
|
||||||
if (result == FixedTimeslotTaskIF::SLOT_LIST_EMPTY) {
|
if (result == FixedTimeslotTaskIF::SLOT_LIST_EMPTY) {
|
||||||
@ -281,7 +364,7 @@ void initmission::createPstTasks(TaskFactory& factory,
|
|||||||
}
|
}
|
||||||
#if OBSW_ADD_I2C_TEST_CODE == 0
|
#if OBSW_ADD_I2C_TEST_CODE == 0
|
||||||
FixedTimeslotTaskIF* i2cPst = factory.createFixedTimeslotTask(
|
FixedTimeslotTaskIF* i2cPst = factory.createFixedTimeslotTask(
|
||||||
"I2C_PST", 70, PeriodicTaskIF::MINIMUM_STACK_SIZE * 4, 0.2, missedDeadlineFunc);
|
"I2C_PST", 65, PeriodicTaskIF::MINIMUM_STACK_SIZE * 4, 0.2, missedDeadlineFunc);
|
||||||
result = pst::pstI2c(i2cPst);
|
result = pst::pstI2c(i2cPst);
|
||||||
if (result != HasReturnvaluesIF::RETURN_OK) {
|
if (result != HasReturnvaluesIF::RETURN_OK) {
|
||||||
if (result == FixedTimeslotTaskIF::SLOT_LIST_EMPTY) {
|
if (result == FixedTimeslotTaskIF::SLOT_LIST_EMPTY) {
|
||||||
@ -346,21 +429,30 @@ 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_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);
|
result = pusMedPrio->addComponent(objects::PUS_SERVICE_8_FUNCTION_MGMT);
|
||||||
if (result != HasReturnvaluesIF::RETURN_OK) {
|
if (result != HasReturnvaluesIF::RETURN_OK) {
|
||||||
initmission::printAddObjectError("PUS_8", objects::PUS_SERVICE_8_FUNCTION_MGMT);
|
initmission::printAddObjectError("PUS_8", objects::PUS_SERVICE_8_FUNCTION_MGMT);
|
||||||
}
|
}
|
||||||
result = pusMedPrio->addComponent(objects::PUS_SERVICE_3_HOUSEKEEPING);
|
result = pusMedPrio->addComponent(objects::PUS_SERVICE_11_TC_SCHEDULER);
|
||||||
if (result != HasReturnvaluesIF::RETURN_OK) {
|
if (result != HasReturnvaluesIF::RETURN_OK) {
|
||||||
sif::error << "Object add component failed" << std::endl;
|
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);
|
result = pusMedPrio->addComponent(objects::PUS_SERVICE_200_MODE_MGMT);
|
||||||
if (result != HasReturnvaluesIF::RETURN_OK) {
|
if (result != HasReturnvaluesIF::RETURN_OK) {
|
||||||
initmission::printAddObjectError("PUS_200", objects::PUS_SERVICE_200_MODE_MGMT);
|
initmission::printAddObjectError("PUS_200", objects::PUS_SERVICE_200_MODE_MGMT);
|
||||||
}
|
}
|
||||||
result = pusMedPrio->addComponent(objects::PUS_SERVICE_20_PARAMETERS);
|
result = pusMedPrio->addComponent(objects::PUS_SERVICE_201_HEALTH);
|
||||||
if (result != HasReturnvaluesIF::RETURN_OK) {
|
if (result != HasReturnvaluesIF::RETURN_OK) {
|
||||||
initmission::printAddObjectError("PUS_20", objects::PUS_SERVICE_20_PARAMETERS);
|
initmission::printAddObjectError("PUS_201", objects::PUS_SERVICE_201_HEALTH);
|
||||||
}
|
}
|
||||||
taskVec.push_back(pusMedPrio);
|
taskVec.push_back(pusMedPrio);
|
||||||
|
|
||||||
|
@ -3,7 +3,7 @@
|
|||||||
|
|
||||||
#include <vector>
|
#include <vector>
|
||||||
|
|
||||||
#include "fsfw/tasks/Typedef.h"
|
#include "fsfw/tasks/definitions.h"
|
||||||
|
|
||||||
class PeriodicTaskIF;
|
class PeriodicTaskIF;
|
||||||
class TaskFactory;
|
class TaskFactory;
|
||||||
|
@ -1,5 +1,4 @@
|
|||||||
#include <mission/system/fdir/GomspacePowerFdir.h>
|
#include "ObjectFactory.h"
|
||||||
#include <mission/system/fdir/SyrlinksFdir.h>
|
|
||||||
|
|
||||||
#include "OBSWConfig.h"
|
#include "OBSWConfig.h"
|
||||||
#include "bsp_q7s/boardtest/Q7STestTask.h"
|
#include "bsp_q7s/boardtest/Q7STestTask.h"
|
||||||
@ -7,8 +6,6 @@
|
|||||||
#include "bsp_q7s/callbacks/pcduSwitchCb.h"
|
#include "bsp_q7s/callbacks/pcduSwitchCb.h"
|
||||||
#include "bsp_q7s/callbacks/q7sGpioCallbacks.h"
|
#include "bsp_q7s/callbacks/q7sGpioCallbacks.h"
|
||||||
#include "bsp_q7s/callbacks/rwSpiCallback.h"
|
#include "bsp_q7s/callbacks/rwSpiCallback.h"
|
||||||
#include "bsp_q7s/core/CoreController.h"
|
|
||||||
#include "bsp_q7s/core/ObjectFactory.h"
|
|
||||||
#include "bsp_q7s/memory/FileSystemHandler.h"
|
#include "bsp_q7s/memory/FileSystemHandler.h"
|
||||||
#include "busConf.h"
|
#include "busConf.h"
|
||||||
#include "ccsdsConfig.h"
|
#include "ccsdsConfig.h"
|
||||||
@ -31,7 +28,6 @@
|
|||||||
#include "linux/devices/ploc/PlocMPSoCHelper.h"
|
#include "linux/devices/ploc/PlocMPSoCHelper.h"
|
||||||
#include "linux/devices/ploc/PlocMemoryDumper.h"
|
#include "linux/devices/ploc/PlocMemoryDumper.h"
|
||||||
#include "linux/devices/ploc/PlocSupervisorHandler.h"
|
#include "linux/devices/ploc/PlocSupervisorHandler.h"
|
||||||
#include "linux/devices/ploc/PlocUpdater.h"
|
|
||||||
#include "linux/devices/startracker/StarTrackerHandler.h"
|
#include "linux/devices/startracker/StarTrackerHandler.h"
|
||||||
#include "linux/devices/startracker/StrHelper.h"
|
#include "linux/devices/startracker/StrHelper.h"
|
||||||
#include "linux/obc/AxiPtmeConfig.h"
|
#include "linux/obc/AxiPtmeConfig.h"
|
||||||
@ -39,11 +35,12 @@
|
|||||||
#include "linux/obc/PdecHandler.h"
|
#include "linux/obc/PdecHandler.h"
|
||||||
#include "linux/obc/Ptme.h"
|
#include "linux/obc/Ptme.h"
|
||||||
#include "linux/obc/PtmeConfig.h"
|
#include "linux/obc/PtmeConfig.h"
|
||||||
#include "mission/system/SusAssembly.h"
|
#include "mission/system/RwAssembly.h"
|
||||||
#include "mission/system/TcsBoardAssembly.h"
|
|
||||||
#include "mission/system/fdir/AcsBoardFdir.h"
|
#include "mission/system/fdir/AcsBoardFdir.h"
|
||||||
|
#include "mission/system/fdir/GomspacePowerFdir.h"
|
||||||
#include "mission/system/fdir/RtdFdir.h"
|
#include "mission/system/fdir/RtdFdir.h"
|
||||||
#include "mission/system/fdir/SusFdir.h"
|
#include "mission/system/fdir/SusFdir.h"
|
||||||
|
#include "mission/system/fdir/SyrlinksFdir.h"
|
||||||
#include "tmtc/apid.h"
|
#include "tmtc/apid.h"
|
||||||
#include "tmtc/pusIds.h"
|
#include "tmtc/pusIds.h"
|
||||||
#if OBSW_TEST_LIBGPIOD == 1
|
#if OBSW_TEST_LIBGPIOD == 1
|
||||||
@ -82,24 +79,20 @@
|
|||||||
#include "mission/devices/RadiationSensorHandler.h"
|
#include "mission/devices/RadiationSensorHandler.h"
|
||||||
#include "mission/devices/RwHandler.h"
|
#include "mission/devices/RwHandler.h"
|
||||||
#include "mission/devices/SolarArrayDeploymentHandler.h"
|
#include "mission/devices/SolarArrayDeploymentHandler.h"
|
||||||
#include "mission/devices/SusHandler.h"
|
|
||||||
#include "mission/devices/SyrlinksHkHandler.h"
|
#include "mission/devices/SyrlinksHkHandler.h"
|
||||||
#include "mission/devices/Tmp1075Handler.h"
|
#include "mission/devices/Tmp1075Handler.h"
|
||||||
#include "mission/devices/devicedefinitions/GomspaceDefinitions.h"
|
#include "mission/devices/devicedefinitions/GomspaceDefinitions.h"
|
||||||
#include "mission/devices/devicedefinitions/Max31865Definitions.h"
|
#include "mission/devices/devicedefinitions/Max31865Definitions.h"
|
||||||
#include "mission/devices/devicedefinitions/RadSensorDefinitions.h"
|
#include "mission/devices/devicedefinitions/RadSensorDefinitions.h"
|
||||||
#include "mission/devices/devicedefinitions/RwDefinitions.h"
|
#include "mission/devices/devicedefinitions/RwDefinitions.h"
|
||||||
#include "mission/devices/devicedefinitions/SusDefinitions.h"
|
|
||||||
#include "mission/devices/devicedefinitions/SyrlinksDefinitions.h"
|
#include "mission/devices/devicedefinitions/SyrlinksDefinitions.h"
|
||||||
#include "mission/devices/devicedefinitions/payloadPcduDefinitions.h"
|
#include "mission/devices/devicedefinitions/payloadPcduDefinitions.h"
|
||||||
#include "mission/system/AcsBoardAssembly.h"
|
#include "mission/system/AcsBoardAssembly.h"
|
||||||
#include "mission/tmtc/CCSDSHandler.h"
|
#include "mission/tmtc/CCSDSHandler.h"
|
||||||
|
#include "mission/tmtc/TmFunnel.h"
|
||||||
#include "mission/tmtc/VirtualChannel.h"
|
#include "mission/tmtc/VirtualChannel.h"
|
||||||
#include "mission/utility/TmFunnel.h"
|
|
||||||
ResetArgs resetArgsGnss0;
|
|
||||||
ResetArgs resetArgsGnss1;
|
|
||||||
|
|
||||||
void ObjectFactory::setStatics() { Factory::setStaticFrameworkObjectIds(); }
|
ResetArgs RESET_ARGS_GNSS;
|
||||||
|
|
||||||
void Factory::setStaticFrameworkObjectIds() {
|
void Factory::setStaticFrameworkObjectIds() {
|
||||||
PusServiceBase::packetSource = objects::PUS_PACKET_DISTRIBUTOR;
|
PusServiceBase::packetSource = objects::PUS_PACKET_DISTRIBUTOR;
|
||||||
@ -108,8 +101,12 @@ void Factory::setStaticFrameworkObjectIds() {
|
|||||||
CommandingServiceBase::defaultPacketSource = objects::PUS_PACKET_DISTRIBUTOR;
|
CommandingServiceBase::defaultPacketSource = objects::PUS_PACKET_DISTRIBUTOR;
|
||||||
CommandingServiceBase::defaultPacketDestination = objects::TM_FUNNEL;
|
CommandingServiceBase::defaultPacketDestination = objects::TM_FUNNEL;
|
||||||
|
|
||||||
|
#if OBSW_Q7S_EM == 1
|
||||||
|
DeviceHandlerBase::powerSwitcherId = objects::NO_OBJECT;
|
||||||
|
#else
|
||||||
DeviceHandlerBase::powerSwitcherId = objects::PCDU_HANDLER;
|
DeviceHandlerBase::powerSwitcherId = objects::PCDU_HANDLER;
|
||||||
// DeviceHandlerBase::powerSwitcherId = objects::NO_OBJECT;
|
#endif /* OBSW_Q7S_EM == 1 */
|
||||||
|
|
||||||
#if OBSW_TM_TO_PTME == 1
|
#if OBSW_TM_TO_PTME == 1
|
||||||
TmFunnel::downlinkDestination = objects::CCSDS_HANDLER;
|
TmFunnel::downlinkDestination = objects::CCSDS_HANDLER;
|
||||||
#else
|
#else
|
||||||
@ -124,87 +121,7 @@ void Factory::setStaticFrameworkObjectIds() {
|
|||||||
TmPacketBase::timeStamperId = objects::TIME_STAMPER;
|
TmPacketBase::timeStamperId = objects::TIME_STAMPER;
|
||||||
}
|
}
|
||||||
|
|
||||||
void ObjectFactory::produce(void* args) {
|
void ObjectFactory::setStatics() { Factory::setStaticFrameworkObjectIds(); }
|
||||||
ObjectFactory::setStatics();
|
|
||||||
ObjectFactory::produceGenericObjects();
|
|
||||||
|
|
||||||
LinuxLibgpioIF* gpioComIF = nullptr;
|
|
||||||
UartComIF* uartComIF = nullptr;
|
|
||||||
SpiComIF* spiComIF = nullptr;
|
|
||||||
I2cComIF* i2cComIF = nullptr;
|
|
||||||
PowerSwitchIF* pwrSwitcher = nullptr;
|
|
||||||
createCommunicationInterfaces(&gpioComIF, &uartComIF, &spiComIF, &i2cComIF);
|
|
||||||
createTmpComponents();
|
|
||||||
new CoreController(objects::CORE_CONTROLLER);
|
|
||||||
|
|
||||||
gpioCallbacks::disableAllDecoder(gpioComIF);
|
|
||||||
createPcduComponents(gpioComIF, &pwrSwitcher);
|
|
||||||
createRadSensorComponent(gpioComIF);
|
|
||||||
createSunSensorComponents(gpioComIF, spiComIF, pwrSwitcher, q7s::SPI_DEFAULT_DEV);
|
|
||||||
|
|
||||||
#if OBSW_ADD_ACS_BOARD == 1
|
|
||||||
createAcsBoardComponents(gpioComIF, uartComIF, pwrSwitcher);
|
|
||||||
#endif
|
|
||||||
createHeaterComponents();
|
|
||||||
createSolarArrayDeploymentComponents();
|
|
||||||
createPlPcduComponents(gpioComIF, spiComIF, pwrSwitcher);
|
|
||||||
#if OBSW_ADD_SYRLINKS == 1
|
|
||||||
createSyrlinksComponents(pwrSwitcher);
|
|
||||||
#endif /* OBSW_ADD_SYRLINKS == 1 */
|
|
||||||
createRtdComponents(q7s::SPI_DEFAULT_DEV, gpioComIF, pwrSwitcher);
|
|
||||||
createPayloadComponents(gpioComIF);
|
|
||||||
|
|
||||||
#if OBSW_ADD_MGT == 1
|
|
||||||
I2cCookie* imtqI2cCookie =
|
|
||||||
new I2cCookie(addresses::IMTQ, IMTQ::MAX_REPLY_SIZE, q7s::I2C_DEFAULT_DEV);
|
|
||||||
auto imtqHandler = new IMTQHandler(objects::IMTQ_HANDLER, objects::I2C_COM_IF, imtqI2cCookie,
|
|
||||||
pcdu::Switches::PDU1_CH3_MGT_5V);
|
|
||||||
imtqHandler->setPowerSwitcher(pwrSwitcher);
|
|
||||||
static_cast<void>(imtqHandler);
|
|
||||||
#if OBSW_TEST_IMTQ == 1
|
|
||||||
imtqHandler->setStartUpImmediately();
|
|
||||||
imtqHandler->setToGoToNormal(true);
|
|
||||||
#endif
|
|
||||||
#if OBSW_DEBUG_IMTQ == 1
|
|
||||||
imtqHandler->setDebugMode(true);
|
|
||||||
#endif
|
|
||||||
#endif
|
|
||||||
createReactionWheelComponents(gpioComIF);
|
|
||||||
|
|
||||||
#if OBSW_ADD_BPX_BATTERY_HANDLER == 1
|
|
||||||
I2cCookie* bpxI2cCookie = new I2cCookie(addresses::BPX_BATTERY, 100, q7s::I2C_DEFAULT_DEV);
|
|
||||||
BpxBatteryHandler* bpxHandler =
|
|
||||||
new BpxBatteryHandler(objects::BPX_BATT_HANDLER, objects::I2C_COM_IF, bpxI2cCookie);
|
|
||||||
bpxHandler->setStartUpImmediately();
|
|
||||||
bpxHandler->setToGoToNormalMode(true);
|
|
||||||
#if OBSW_DEBUG_BPX_BATT == 1
|
|
||||||
bpxHandler->setDebugMode(true);
|
|
||||||
#endif
|
|
||||||
#endif
|
|
||||||
new FileSystemHandler(objects::FILE_SYSTEM_HANDLER);
|
|
||||||
|
|
||||||
#if OBSW_ADD_STAR_TRACKER == 1
|
|
||||||
UartCookie* starTrackerCookie =
|
|
||||||
new UartCookie(objects::STAR_TRACKER, q7s::UART_STAR_TRACKER_DEV, uart::STAR_TRACKER_BAUD,
|
|
||||||
startracker::MAX_FRAME_SIZE * 2 + 2, UartModes::NON_CANONICAL);
|
|
||||||
starTrackerCookie->setNoFixedSizeReply();
|
|
||||||
StrHelper* strHelper = new StrHelper(objects::STR_HELPER);
|
|
||||||
auto starTracker =
|
|
||||||
new StarTrackerHandler(objects::STAR_TRACKER, objects::UART_COM_IF, starTrackerCookie,
|
|
||||||
strHelper, pcdu::PDU1_CH2_STAR_TRACKER_5V);
|
|
||||||
starTracker->setPowerSwitcher(pwrSwitcher);
|
|
||||||
|
|
||||||
#endif /* OBSW_ADD_STAR_TRACKER == 1 */
|
|
||||||
#if OBSW_USE_CCSDS_IP_CORE == 1
|
|
||||||
createCcsdsComponents(gpioComIF);
|
|
||||||
#endif /* OBSW_USE_CCSDS_IP_CORE == 1 */
|
|
||||||
/* Test Task */
|
|
||||||
#if OBSW_ADD_TEST_CODE == 1
|
|
||||||
createTestComponents(gpioComIF);
|
|
||||||
#endif /* OBSW_ADD_TEST_CODE == 1 */
|
|
||||||
new PlocUpdater(objects::PLOC_UPDATER);
|
|
||||||
new PlocMemoryDumper(objects::PLOC_MEMORY_DUMPER);
|
|
||||||
}
|
|
||||||
|
|
||||||
void ObjectFactory::createTmpComponents() {
|
void ObjectFactory::createTmpComponents() {
|
||||||
I2cCookie* i2cCookieTmp1075tcs1 =
|
I2cCookie* i2cCookieTmp1075tcs1 =
|
||||||
@ -222,8 +139,10 @@ void ObjectFactory::createTmpComponents() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void ObjectFactory::createCommunicationInterfaces(LinuxLibgpioIF** gpioComIF, UartComIF** uartComIF,
|
void ObjectFactory::createCommunicationInterfaces(LinuxLibgpioIF** gpioComIF, UartComIF** uartComIF,
|
||||||
SpiComIF** spiComIF, I2cComIF** i2cComIF) {
|
SpiComIF** spiMainComIF, I2cComIF** i2cComIF,
|
||||||
if (gpioComIF == nullptr or uartComIF == nullptr or spiComIF == nullptr) {
|
SpiComIF** spiRWComIF) {
|
||||||
|
if (gpioComIF == nullptr or uartComIF == nullptr or spiMainComIF == nullptr or
|
||||||
|
spiRWComIF == nullptr) {
|
||||||
sif::error << "ObjectFactory::createCommunicationInterfaces: Invalid passed ComIF pointer"
|
sif::error << "ObjectFactory::createCommunicationInterfaces: Invalid passed ComIF pointer"
|
||||||
<< std::endl;
|
<< std::endl;
|
||||||
}
|
}
|
||||||
@ -233,8 +152,8 @@ void ObjectFactory::createCommunicationInterfaces(LinuxLibgpioIF** gpioComIF, Ua
|
|||||||
new CspComIF(objects::CSP_COM_IF);
|
new CspComIF(objects::CSP_COM_IF);
|
||||||
*i2cComIF = new I2cComIF(objects::I2C_COM_IF);
|
*i2cComIF = new I2cComIF(objects::I2C_COM_IF);
|
||||||
*uartComIF = new UartComIF(objects::UART_COM_IF);
|
*uartComIF = new UartComIF(objects::UART_COM_IF);
|
||||||
*spiComIF = new SpiComIF(objects::SPI_COM_IF, *gpioComIF);
|
*spiMainComIF = new SpiComIF(objects::SPI_MAIN_COM_IF, q7s::SPI_DEFAULT_DEV, *gpioComIF);
|
||||||
|
*spiRWComIF = new SpiComIF(objects::SPI_RW_COM_IF, q7s::SPI_RW_DEV, *gpioComIF);
|
||||||
/* Adding gpios for chip select decoding to the gpioComIf */
|
/* Adding gpios for chip select decoding to the gpioComIf */
|
||||||
q7s::gpioCallbacks::initSpiCsDecoder(*gpioComIF);
|
q7s::gpioCallbacks::initSpiCsDecoder(*gpioComIF);
|
||||||
}
|
}
|
||||||
@ -292,12 +211,13 @@ void ObjectFactory::createRadSensorComponent(LinuxLibgpioIF* gpioComIF) {
|
|||||||
gpio = new GpiodRegularByLineName(q7s::gpioNames::ENABLE_RADFET, consumer.str(), Direction::OUT,
|
gpio = new GpiodRegularByLineName(q7s::gpioNames::ENABLE_RADFET, consumer.str(), Direction::OUT,
|
||||||
Levels::LOW);
|
Levels::LOW);
|
||||||
gpioCookieRadSensor->addGpio(gpioIds::ENABLE_RADFET, gpio);
|
gpioCookieRadSensor->addGpio(gpioIds::ENABLE_RADFET, gpio);
|
||||||
gpioComIF->addGpios(gpioCookieRadSensor);
|
gpioChecker(gpioComIF->addGpios(gpioCookieRadSensor), "RAD sensor");
|
||||||
|
|
||||||
SpiCookie* spiCookieRadSensor = new SpiCookie(
|
SpiCookie* spiCookieRadSensor =
|
||||||
addresses::RAD_SENSOR, gpioIds::CS_RAD_SENSOR, std::string(q7s::SPI_DEFAULT_DEV),
|
new SpiCookie(addresses::RAD_SENSOR, gpioIds::CS_RAD_SENSOR, RAD_SENSOR::READ_SIZE,
|
||||||
RAD_SENSOR::READ_SIZE, spi::DEFAULT_MAX_1227_MODE, spi::DEFAULT_MAX_1227_SPEED);
|
spi::DEFAULT_MAX_1227_MODE, spi::DEFAULT_MAX_1227_SPEED);
|
||||||
auto radSensor = new RadiationSensorHandler(objects::RAD_SENSOR, objects::SPI_COM_IF,
|
spiCookieRadSensor->setMutexParams(MutexIF::TimeoutType::WAITING, spi::RAD_SENSOR_CS_TIMEOUT);
|
||||||
|
auto radSensor = new RadiationSensorHandler(objects::RAD_SENSOR, objects::SPI_MAIN_COM_IF,
|
||||||
spiCookieRadSensor, gpioComIF);
|
spiCookieRadSensor, gpioComIF);
|
||||||
static_cast<void>(radSensor);
|
static_cast<void>(radSensor);
|
||||||
// The radiation sensor ADC is powered by the 5V stack connector which should always be on
|
// The radiation sensor ADC is powered by the 5V stack connector which should always be on
|
||||||
@ -408,16 +328,16 @@ void ObjectFactory::createAcsBoardComponents(LinuxLibgpioIF* gpioComIF, UartComI
|
|||||||
gpio = new GpiodRegularByLineName(q7s::gpioNames::GNSS_SELECT, consumer.str(), Direction::OUT,
|
gpio = new GpiodRegularByLineName(q7s::gpioNames::GNSS_SELECT, consumer.str(), Direction::OUT,
|
||||||
Levels::LOW);
|
Levels::LOW);
|
||||||
gpioCookieAcsBoard->addGpio(gpioIds::GNSS_SELECT, gpio);
|
gpioCookieAcsBoard->addGpio(gpioIds::GNSS_SELECT, gpio);
|
||||||
gpioComIF->addGpios(gpioCookieAcsBoard);
|
gpioChecker(gpioComIF->addGpios(gpioCookieAcsBoard), "ACS Board");
|
||||||
AcsBoardFdir* fdir = nullptr;
|
AcsBoardFdir* fdir = nullptr;
|
||||||
static_cast<void>(fdir);
|
static_cast<void>(fdir);
|
||||||
|
|
||||||
#if OBSW_ADD_ACS_HANDLERS == 1
|
#if OBSW_ADD_ACS_HANDLERS == 1
|
||||||
std::string spiDev = q7s::SPI_DEFAULT_DEV;
|
std::string spiDev = q7s::SPI_DEFAULT_DEV;
|
||||||
SpiCookie* spiCookie =
|
SpiCookie* spiCookie =
|
||||||
new SpiCookie(addresses::MGM_0_LIS3, gpioIds::MGM_0_LIS3_CS, spiDev,
|
new SpiCookie(addresses::MGM_0_LIS3, gpioIds::MGM_0_LIS3_CS, MGMLIS3MDL::MAX_BUFFER_SIZE,
|
||||||
MGMLIS3MDL::MAX_BUFFER_SIZE, spi::DEFAULT_LIS3_MODE, spi::DEFAULT_LIS3_SPEED);
|
spi::DEFAULT_LIS3_MODE, spi::DEFAULT_LIS3_SPEED);
|
||||||
auto mgmLis3Handler = new MgmLIS3MDLHandler(objects::MGM_0_LIS3_HANDLER, objects::SPI_COM_IF,
|
auto mgmLis3Handler = new MgmLIS3MDLHandler(objects::MGM_0_LIS3_HANDLER, objects::SPI_MAIN_COM_IF,
|
||||||
spiCookie, spi::LIS3_TRANSITION_DELAY);
|
spiCookie, spi::LIS3_TRANSITION_DELAY);
|
||||||
fdir = new AcsBoardFdir(objects::MGM_0_LIS3_HANDLER);
|
fdir = new AcsBoardFdir(objects::MGM_0_LIS3_HANDLER);
|
||||||
mgmLis3Handler->setCustomFdir(fdir);
|
mgmLis3Handler->setCustomFdir(fdir);
|
||||||
@ -430,10 +350,11 @@ void ObjectFactory::createAcsBoardComponents(LinuxLibgpioIF* gpioComIF, UartComI
|
|||||||
mgmLis3Handler->enablePeriodicPrintouts(true, 10);
|
mgmLis3Handler->enablePeriodicPrintouts(true, 10);
|
||||||
#endif
|
#endif
|
||||||
spiCookie =
|
spiCookie =
|
||||||
new SpiCookie(addresses::MGM_1_RM3100, gpioIds::MGM_1_RM3100_CS, spiDev,
|
new SpiCookie(addresses::MGM_1_RM3100, gpioIds::MGM_1_RM3100_CS, RM3100::MAX_BUFFER_SIZE,
|
||||||
RM3100::MAX_BUFFER_SIZE, spi::DEFAULT_RM3100_MODE, spi::DEFAULT_RM3100_SPEED);
|
spi::DEFAULT_RM3100_MODE, spi::DEFAULT_RM3100_SPEED);
|
||||||
auto mgmRm3100Handler = new MgmRM3100Handler(objects::MGM_1_RM3100_HANDLER, objects::SPI_COM_IF,
|
auto mgmRm3100Handler =
|
||||||
spiCookie, spi::RM3100_TRANSITION_DELAY);
|
new MgmRM3100Handler(objects::MGM_1_RM3100_HANDLER, objects::SPI_MAIN_COM_IF, spiCookie,
|
||||||
|
spi::RM3100_TRANSITION_DELAY);
|
||||||
fdir = new AcsBoardFdir(objects::MGM_1_RM3100_HANDLER);
|
fdir = new AcsBoardFdir(objects::MGM_1_RM3100_HANDLER);
|
||||||
mgmRm3100Handler->setCustomFdir(fdir);
|
mgmRm3100Handler->setCustomFdir(fdir);
|
||||||
mgmRm3100Handler->setParent(objects::ACS_BOARD_ASS);
|
mgmRm3100Handler->setParent(objects::ACS_BOARD_ASS);
|
||||||
@ -446,9 +367,9 @@ void ObjectFactory::createAcsBoardComponents(LinuxLibgpioIF* gpioComIF, UartComI
|
|||||||
mgmRm3100Handler->enablePeriodicPrintouts(true, 10);
|
mgmRm3100Handler->enablePeriodicPrintouts(true, 10);
|
||||||
#endif
|
#endif
|
||||||
spiCookie =
|
spiCookie =
|
||||||
new SpiCookie(addresses::MGM_2_LIS3, gpioIds::MGM_2_LIS3_CS, spiDev,
|
new SpiCookie(addresses::MGM_2_LIS3, gpioIds::MGM_2_LIS3_CS, MGMLIS3MDL::MAX_BUFFER_SIZE,
|
||||||
MGMLIS3MDL::MAX_BUFFER_SIZE, spi::DEFAULT_LIS3_MODE, spi::DEFAULT_LIS3_SPEED);
|
spi::DEFAULT_LIS3_MODE, spi::DEFAULT_LIS3_SPEED);
|
||||||
mgmLis3Handler = new MgmLIS3MDLHandler(objects::MGM_2_LIS3_HANDLER, objects::SPI_COM_IF,
|
mgmLis3Handler = new MgmLIS3MDLHandler(objects::MGM_2_LIS3_HANDLER, objects::SPI_MAIN_COM_IF,
|
||||||
spiCookie, spi::LIS3_TRANSITION_DELAY);
|
spiCookie, spi::LIS3_TRANSITION_DELAY);
|
||||||
fdir = new AcsBoardFdir(objects::MGM_2_LIS3_HANDLER);
|
fdir = new AcsBoardFdir(objects::MGM_2_LIS3_HANDLER);
|
||||||
mgmLis3Handler->setCustomFdir(fdir);
|
mgmLis3Handler->setCustomFdir(fdir);
|
||||||
@ -462,9 +383,9 @@ void ObjectFactory::createAcsBoardComponents(LinuxLibgpioIF* gpioComIF, UartComI
|
|||||||
mgmLis3Handler->enablePeriodicPrintouts(true, 10);
|
mgmLis3Handler->enablePeriodicPrintouts(true, 10);
|
||||||
#endif
|
#endif
|
||||||
spiCookie =
|
spiCookie =
|
||||||
new SpiCookie(addresses::MGM_3_RM3100, gpioIds::MGM_3_RM3100_CS, spiDev,
|
new SpiCookie(addresses::MGM_3_RM3100, gpioIds::MGM_3_RM3100_CS, RM3100::MAX_BUFFER_SIZE,
|
||||||
RM3100::MAX_BUFFER_SIZE, spi::DEFAULT_RM3100_MODE, spi::DEFAULT_RM3100_SPEED);
|
spi::DEFAULT_RM3100_MODE, spi::DEFAULT_RM3100_SPEED);
|
||||||
mgmRm3100Handler = new MgmRM3100Handler(objects::MGM_3_RM3100_HANDLER, objects::SPI_COM_IF,
|
mgmRm3100Handler = new MgmRM3100Handler(objects::MGM_3_RM3100_HANDLER, objects::SPI_MAIN_COM_IF,
|
||||||
spiCookie, spi::RM3100_TRANSITION_DELAY);
|
spiCookie, spi::RM3100_TRANSITION_DELAY);
|
||||||
fdir = new AcsBoardFdir(objects::MGM_3_RM3100_HANDLER);
|
fdir = new AcsBoardFdir(objects::MGM_3_RM3100_HANDLER);
|
||||||
mgmRm3100Handler->setCustomFdir(fdir);
|
mgmRm3100Handler->setCustomFdir(fdir);
|
||||||
@ -478,11 +399,12 @@ void ObjectFactory::createAcsBoardComponents(LinuxLibgpioIF* gpioComIF, UartComI
|
|||||||
#endif
|
#endif
|
||||||
// Commented until ACS board V2 in in clean room again
|
// Commented until ACS board V2 in in clean room again
|
||||||
// Gyro 0 Side A
|
// Gyro 0 Side A
|
||||||
spiCookie = new SpiCookie(addresses::GYRO_0_ADIS, gpioIds::GYRO_0_ADIS_CS, spiDev,
|
spiCookie =
|
||||||
ADIS1650X::MAXIMUM_REPLY_SIZE, spi::DEFAULT_ADIS16507_MODE,
|
new SpiCookie(addresses::GYRO_0_ADIS, gpioIds::GYRO_0_ADIS_CS, ADIS1650X::MAXIMUM_REPLY_SIZE,
|
||||||
spi::DEFAULT_ADIS16507_SPEED);
|
spi::DEFAULT_ADIS16507_MODE, spi::DEFAULT_ADIS16507_SPEED);
|
||||||
auto adisHandler = new GyroADIS1650XHandler(objects::GYRO_0_ADIS_HANDLER, objects::SPI_COM_IF,
|
auto adisHandler =
|
||||||
spiCookie, ADIS1650X::Type::ADIS16505);
|
new GyroADIS1650XHandler(objects::GYRO_0_ADIS_HANDLER, objects::SPI_MAIN_COM_IF, spiCookie,
|
||||||
|
ADIS1650X::Type::ADIS16505);
|
||||||
fdir = new AcsBoardFdir(objects::GYRO_0_ADIS_HANDLER);
|
fdir = new AcsBoardFdir(objects::GYRO_0_ADIS_HANDLER);
|
||||||
adisHandler->setCustomFdir(fdir);
|
adisHandler->setCustomFdir(fdir);
|
||||||
adisHandler->setParent(objects::ACS_BOARD_ASS);
|
adisHandler->setParent(objects::ACS_BOARD_ASS);
|
||||||
@ -495,11 +417,10 @@ void ObjectFactory::createAcsBoardComponents(LinuxLibgpioIF* gpioComIF, UartComI
|
|||||||
adisHandler->enablePeriodicPrintouts(true, 10);
|
adisHandler->enablePeriodicPrintouts(true, 10);
|
||||||
#endif
|
#endif
|
||||||
// Gyro 1 Side A
|
// Gyro 1 Side A
|
||||||
spiCookie =
|
spiCookie = new SpiCookie(addresses::GYRO_1_L3G, gpioIds::GYRO_1_L3G_CS, L3GD20H::MAX_BUFFER_SIZE,
|
||||||
new SpiCookie(addresses::GYRO_1_L3G, gpioIds::GYRO_1_L3G_CS, spiDev, L3GD20H::MAX_BUFFER_SIZE,
|
spi::DEFAULT_L3G_MODE, spi::DEFAULT_L3G_SPEED);
|
||||||
spi::DEFAULT_L3G_MODE, spi::DEFAULT_L3G_SPEED);
|
auto gyroL3gHandler = new GyroHandlerL3GD20H(
|
||||||
auto gyroL3gHandler = new GyroHandlerL3GD20H(objects::GYRO_1_L3G_HANDLER, objects::SPI_COM_IF,
|
objects::GYRO_1_L3G_HANDLER, objects::SPI_MAIN_COM_IF, spiCookie, spi::L3G_TRANSITION_DELAY);
|
||||||
spiCookie, spi::L3G_TRANSITION_DELAY);
|
|
||||||
fdir = new AcsBoardFdir(objects::GYRO_1_L3G_HANDLER);
|
fdir = new AcsBoardFdir(objects::GYRO_1_L3G_HANDLER);
|
||||||
gyroL3gHandler->setCustomFdir(fdir);
|
gyroL3gHandler->setCustomFdir(fdir);
|
||||||
gyroL3gHandler->setParent(objects::ACS_BOARD_ASS);
|
gyroL3gHandler->setParent(objects::ACS_BOARD_ASS);
|
||||||
@ -512,10 +433,10 @@ void ObjectFactory::createAcsBoardComponents(LinuxLibgpioIF* gpioComIF, UartComI
|
|||||||
gyroL3gHandler->enablePeriodicPrintouts(true, 10);
|
gyroL3gHandler->enablePeriodicPrintouts(true, 10);
|
||||||
#endif
|
#endif
|
||||||
// Gyro 2 Side B
|
// Gyro 2 Side B
|
||||||
spiCookie = new SpiCookie(addresses::GYRO_2_ADIS, gpioIds::GYRO_2_ADIS_CS, spiDev,
|
spiCookie =
|
||||||
ADIS1650X::MAXIMUM_REPLY_SIZE, spi::DEFAULT_ADIS16507_MODE,
|
new SpiCookie(addresses::GYRO_2_ADIS, gpioIds::GYRO_2_ADIS_CS, ADIS1650X::MAXIMUM_REPLY_SIZE,
|
||||||
spi::DEFAULT_ADIS16507_SPEED);
|
spi::DEFAULT_ADIS16507_MODE, spi::DEFAULT_ADIS16507_SPEED);
|
||||||
adisHandler = new GyroADIS1650XHandler(objects::GYRO_2_ADIS_HANDLER, objects::SPI_COM_IF,
|
adisHandler = new GyroADIS1650XHandler(objects::GYRO_2_ADIS_HANDLER, objects::SPI_MAIN_COM_IF,
|
||||||
spiCookie, ADIS1650X::Type::ADIS16505);
|
spiCookie, ADIS1650X::Type::ADIS16505);
|
||||||
fdir = new AcsBoardFdir(objects::GYRO_2_ADIS_HANDLER);
|
fdir = new AcsBoardFdir(objects::GYRO_2_ADIS_HANDLER);
|
||||||
adisHandler->setCustomFdir(fdir);
|
adisHandler->setCustomFdir(fdir);
|
||||||
@ -525,10 +446,9 @@ void ObjectFactory::createAcsBoardComponents(LinuxLibgpioIF* gpioComIF, UartComI
|
|||||||
adisHandler->setToGoToNormalModeImmediately();
|
adisHandler->setToGoToNormalModeImmediately();
|
||||||
#endif
|
#endif
|
||||||
// Gyro 3 Side B
|
// Gyro 3 Side B
|
||||||
spiCookie =
|
spiCookie = new SpiCookie(addresses::GYRO_3_L3G, gpioIds::GYRO_3_L3G_CS, L3GD20H::MAX_BUFFER_SIZE,
|
||||||
new SpiCookie(addresses::GYRO_3_L3G, gpioIds::GYRO_3_L3G_CS, spiDev, L3GD20H::MAX_BUFFER_SIZE,
|
spi::DEFAULT_L3G_MODE, spi::DEFAULT_L3G_SPEED);
|
||||||
spi::DEFAULT_L3G_MODE, spi::DEFAULT_L3G_SPEED);
|
gyroL3gHandler = new GyroHandlerL3GD20H(objects::GYRO_3_L3G_HANDLER, objects::SPI_MAIN_COM_IF,
|
||||||
gyroL3gHandler = new GyroHandlerL3GD20H(objects::GYRO_3_L3G_HANDLER, objects::SPI_COM_IF,
|
|
||||||
spiCookie, spi::L3G_TRANSITION_DELAY);
|
spiCookie, spi::L3G_TRANSITION_DELAY);
|
||||||
fdir = new AcsBoardFdir(objects::GYRO_3_L3G_HANDLER);
|
fdir = new AcsBoardFdir(objects::GYRO_3_L3G_HANDLER);
|
||||||
gyroL3gHandler->setCustomFdir(fdir);
|
gyroL3gHandler->setCustomFdir(fdir);
|
||||||
@ -544,15 +464,11 @@ void ObjectFactory::createAcsBoardComponents(LinuxLibgpioIF* gpioComIF, UartComI
|
|||||||
#if OBSW_DEBUG_GPS == 1
|
#if OBSW_DEBUG_GPS == 1
|
||||||
debugGps = true;
|
debugGps = true;
|
||||||
#endif
|
#endif
|
||||||
resetArgsGnss1.gnss1 = true;
|
RESET_ARGS_GNSS.gpioComIF = gpioComIF;
|
||||||
resetArgsGnss1.gpioComIF = gpioComIF;
|
RESET_ARGS_GNSS.waitPeriodMs = 100;
|
||||||
resetArgsGnss1.waitPeriodMs = 100;
|
auto gpsCtrl =
|
||||||
resetArgsGnss0.gnss1 = false;
|
|
||||||
resetArgsGnss0.gpioComIF = gpioComIF;
|
|
||||||
resetArgsGnss0.waitPeriodMs = 100;
|
|
||||||
auto gpsHandler0 =
|
|
||||||
new GPSHyperionLinuxController(objects::GPS_CONTROLLER, objects::NO_OBJECT, debugGps);
|
new GPSHyperionLinuxController(objects::GPS_CONTROLLER, objects::NO_OBJECT, debugGps);
|
||||||
gpsHandler0->setResetPinTriggerFunction(gps::triggerGpioResetPin, &resetArgsGnss0);
|
gpsCtrl->setResetPinTriggerFunction(gps::triggerGpioResetPin, &RESET_ARGS_GNSS);
|
||||||
|
|
||||||
AcsBoardHelper acsBoardHelper = AcsBoardHelper(
|
AcsBoardHelper acsBoardHelper = AcsBoardHelper(
|
||||||
objects::MGM_0_LIS3_HANDLER, objects::MGM_1_RM3100_HANDLER, objects::MGM_2_LIS3_HANDLER,
|
objects::MGM_0_LIS3_HANDLER, objects::MGM_1_RM3100_HANDLER, objects::MGM_2_LIS3_HANDLER,
|
||||||
@ -562,9 +478,14 @@ void ObjectFactory::createAcsBoardComponents(LinuxLibgpioIF* gpioComIF, UartComI
|
|||||||
acsBoardHelper, gpioComIF);
|
acsBoardHelper, gpioComIF);
|
||||||
static_cast<void>(acsAss);
|
static_cast<void>(acsAss);
|
||||||
#endif /* OBSW_ADD_ACS_HANDLERS == 1 */
|
#endif /* OBSW_ADD_ACS_HANDLERS == 1 */
|
||||||
|
|
||||||
|
#if OBSW_USE_CCSDS_IP_CORE == 1
|
||||||
|
createCcsdsComponents(gpioComIF);
|
||||||
|
#endif /* OBSW_USE_CCSDS_IP_CORE == 1 */
|
||||||
}
|
}
|
||||||
|
|
||||||
void ObjectFactory::createHeaterComponents() {
|
void ObjectFactory::createHeaterComponents(GpioIF* gpioIF, PowerSwitchIF* pwrSwitcher,
|
||||||
|
HealthTableIF* healthTable) {
|
||||||
using namespace gpio;
|
using namespace gpio;
|
||||||
GpioCookie* heaterGpiosCookie = new GpioCookie;
|
GpioCookie* heaterGpiosCookie = new GpioCookie;
|
||||||
GpiodRegularByLineName* gpio = nullptr;
|
GpiodRegularByLineName* gpio = nullptr;
|
||||||
@ -605,8 +526,21 @@ void ObjectFactory::createHeaterComponents() {
|
|||||||
Levels::LOW);
|
Levels::LOW);
|
||||||
heaterGpiosCookie->addGpio(gpioIds::HEATER_7, gpio);
|
heaterGpiosCookie->addGpio(gpioIds::HEATER_7, gpio);
|
||||||
|
|
||||||
new HeaterHandler(objects::HEATER_HANDLER, objects::GPIO_IF, heaterGpiosCookie,
|
gpioIF->addGpios(heaterGpiosCookie);
|
||||||
objects::PCDU_HANDLER, pcdu::Switches::PDU2_CH3_TCS_BOARD_HEATER_IN_8V);
|
|
||||||
|
HeaterHelper helper({{
|
||||||
|
{new HealthDevice(objects::HEATER_0_PLOC_PROC_BRD, MessageQueueIF::NO_QUEUE),
|
||||||
|
gpioIds::HEATER_0},
|
||||||
|
{new HealthDevice(objects::HEATER_1_PCDU_BRD, MessageQueueIF::NO_QUEUE), gpioIds::HEATER_1},
|
||||||
|
{new HealthDevice(objects::HEATER_2_ACS_BRD, MessageQueueIF::NO_QUEUE), gpioIds::HEATER_2},
|
||||||
|
{new HealthDevice(objects::HEATER_3_OBC_BRD, MessageQueueIF::NO_QUEUE), gpioIds::HEATER_3},
|
||||||
|
{new HealthDevice(objects::HEATER_4_CAMERA, MessageQueueIF::NO_QUEUE), gpioIds::HEATER_4},
|
||||||
|
{new HealthDevice(objects::HEATER_5_STR, MessageQueueIF::NO_QUEUE), gpioIds::HEATER_5},
|
||||||
|
{new HealthDevice(objects::HEATER_6_DRO, MessageQueueIF::NO_QUEUE), gpioIds::HEATER_6},
|
||||||
|
{new HealthDevice(objects::HEATER_7_HPA, MessageQueueIF::NO_QUEUE), gpioIds::HEATER_7},
|
||||||
|
}});
|
||||||
|
new HeaterHandler(objects::HEATER_HANDLER, gpioIF, helper, pwrSwitcher,
|
||||||
|
pcdu::Switches::PDU2_CH3_TCS_BOARD_HEATER_IN_8V);
|
||||||
}
|
}
|
||||||
|
|
||||||
void ObjectFactory::createSolarArrayDeploymentComponents() {
|
void ObjectFactory::createSolarArrayDeploymentComponents() {
|
||||||
@ -655,7 +589,7 @@ void ObjectFactory::createPayloadComponents(LinuxLibgpioIF* gpioComIF) {
|
|||||||
consumer.str(), Direction::OUT, Levels::HIGH);
|
consumer.str(), Direction::OUT, Levels::HIGH);
|
||||||
auto mpsocGpioCookie = new GpioCookie;
|
auto mpsocGpioCookie = new GpioCookie;
|
||||||
mpsocGpioCookie->addGpio(gpioIds::ENABLE_MPSOC_UART, gpioConfigMPSoC);
|
mpsocGpioCookie->addGpio(gpioIds::ENABLE_MPSOC_UART, gpioConfigMPSoC);
|
||||||
gpioComIF->addGpios(mpsocGpioCookie);
|
gpioChecker(gpioComIF->addGpios(mpsocGpioCookie), "PLOC MPSoC");
|
||||||
auto mpsocCookie =
|
auto mpsocCookie =
|
||||||
new UartCookie(objects::PLOC_MPSOC_HANDLER, q7s::UART_PLOC_MPSOC_DEV, uart::PLOC_MPSOC_BAUD,
|
new UartCookie(objects::PLOC_MPSOC_HANDLER, q7s::UART_PLOC_MPSOC_DEV, uart::PLOC_MPSOC_BAUD,
|
||||||
mpsoc::MAX_REPLY_SIZE, UartModes::NON_CANONICAL);
|
mpsoc::MAX_REPLY_SIZE, UartModes::NON_CANONICAL);
|
||||||
@ -668,22 +602,24 @@ void ObjectFactory::createPayloadComponents(LinuxLibgpioIF* gpioComIF) {
|
|||||||
#if OBSW_ADD_PLOC_SUPERVISOR == 1
|
#if OBSW_ADD_PLOC_SUPERVISOR == 1
|
||||||
consumer << "0x" << std::hex << objects::PLOC_SUPERVISOR_HANDLER;
|
consumer << "0x" << std::hex << objects::PLOC_SUPERVISOR_HANDLER;
|
||||||
auto gpioConfigSupv = new GpiodRegularByLineName(q7s::gpioNames::ENABLE_SUPV_UART, consumer.str(),
|
auto gpioConfigSupv = new GpiodRegularByLineName(q7s::gpioNames::ENABLE_SUPV_UART, consumer.str(),
|
||||||
Direction::OUT, Levels::HIGH);
|
Direction::OUT, Levels::LOW);
|
||||||
auto supvGpioCookie = new GpioCookie;
|
auto supvGpioCookie = new GpioCookie;
|
||||||
supvGpioCookie->addGpio(gpioIds::ENABLE_SUPV_UART, gpioConfigSupv);
|
supvGpioCookie->addGpio(gpioIds::ENABLE_SUPV_UART, gpioConfigSupv);
|
||||||
gpioComIF->addGpios(supvGpioCookie);
|
gpioComIF->addGpios(supvGpioCookie);
|
||||||
auto supervisorCookie = new UartCookie(objects::PLOC_SUPERVISOR_HANDLER,
|
auto supervisorCookie =
|
||||||
q7s::UART_PLOC_SUPERVSIOR_DEV, uart::PLOC_SUPERVISOR_BAUD,
|
new UartCookie(objects::PLOC_SUPERVISOR_HANDLER, q7s::UART_PLOC_SUPERVSIOR_DEV,
|
||||||
supv::MAX_PACKET_SIZE * 20, UartModes::NON_CANONICAL);
|
uart::PLOC_SUPV_BAUD, supv::MAX_PACKET_SIZE * 20, UartModes::NON_CANONICAL);
|
||||||
supervisorCookie->setNoFixedSizeReply();
|
supervisorCookie->setNoFixedSizeReply();
|
||||||
|
auto supvHelper = new PlocSupvHelper(objects::PLOC_SUPERVISOR_HELPER);
|
||||||
new PlocSupervisorHandler(objects::PLOC_SUPERVISOR_HANDLER, objects::UART_COM_IF,
|
new PlocSupervisorHandler(objects::PLOC_SUPERVISOR_HANDLER, objects::UART_COM_IF,
|
||||||
supervisorCookie, Gpio(gpioIds::ENABLE_SUPV_UART, gpioComIF),
|
supervisorCookie, Gpio(gpioIds::ENABLE_SUPV_UART, gpioComIF),
|
||||||
pcdu::PDU1_CH6_PLOC_12V);
|
pcdu::PDU1_CH6_PLOC_12V, supvHelper);
|
||||||
#endif /* OBSW_ADD_PLOC_SUPERVISOR == 1 */
|
#endif /* OBSW_ADD_PLOC_SUPERVISOR == 1 */
|
||||||
static_cast<void>(consumer);
|
static_cast<void>(consumer);
|
||||||
}
|
}
|
||||||
|
|
||||||
void ObjectFactory::createReactionWheelComponents(LinuxLibgpioIF* gpioComIF) {
|
void ObjectFactory::createReactionWheelComponents(LinuxLibgpioIF* gpioComIF,
|
||||||
|
PowerSwitchIF* pwrSwitcher) {
|
||||||
using namespace gpio;
|
using namespace gpio;
|
||||||
GpioCookie* gpioCookieRw = new GpioCookie;
|
GpioCookie* gpioCookieRw = new GpioCookie;
|
||||||
GpioCallback* csRw1 =
|
GpioCallback* csRw1 =
|
||||||
@ -725,50 +661,38 @@ void ObjectFactory::createReactionWheelComponents(LinuxLibgpioIF* gpioComIF) {
|
|||||||
Levels::LOW);
|
Levels::LOW);
|
||||||
gpioCookieRw->addGpio(gpioIds::EN_RW4, gpio);
|
gpioCookieRw->addGpio(gpioIds::EN_RW4, gpio);
|
||||||
|
|
||||||
gpioComIF->addGpios(gpioCookieRw);
|
gpioChecker(gpioComIF->addGpios(gpioCookieRw), "RWs");
|
||||||
|
|
||||||
#if OBSW_ADD_RW == 1
|
#if OBSW_ADD_RW == 1
|
||||||
auto rw1SpiCookie =
|
std::array<std::pair<address_t, gpioId_t>, 4> rwCookieParams = {
|
||||||
new SpiCookie(addresses::RW1, gpioIds::CS_RW1, q7s::SPI_RW_DEV, RwDefinitions::MAX_REPLY_SIZE,
|
{{addresses::RW1, gpioIds::CS_RW1},
|
||||||
spi::RW_MODE, spi::RW_SPEED, &rwSpiCallback::spiCallback, nullptr);
|
{addresses::RW2, gpioIds::CS_RW2},
|
||||||
auto rw2SpiCookie =
|
{addresses::RW3, gpioIds::CS_RW3},
|
||||||
new SpiCookie(addresses::RW2, gpioIds::CS_RW2, q7s::SPI_RW_DEV, RwDefinitions::MAX_REPLY_SIZE,
|
{addresses::RW4, gpioIds::CS_RW4}}};
|
||||||
spi::RW_MODE, spi::RW_SPEED, &rwSpiCallback::spiCallback, nullptr);
|
std::array<SpiCookie*, 4> rwCookies = {};
|
||||||
auto rw3SpiCookie =
|
std::array<object_id_t, 4> rwIds = {objects::RW1, objects::RW2, objects::RW3, objects::RW4};
|
||||||
new SpiCookie(addresses::RW3, gpioIds::CS_RW3, q7s::SPI_RW_DEV, RwDefinitions::MAX_REPLY_SIZE,
|
std::array<gpioId_t, 4> rwGpioIds = {gpioIds::EN_RW1, gpioIds::EN_RW2, gpioIds::EN_RW3,
|
||||||
spi::RW_MODE, spi::RW_SPEED, &rwSpiCallback::spiCallback, nullptr);
|
gpioIds::EN_RW4};
|
||||||
auto rw4SpiCookie =
|
std::array<RwHandler*, 4> rws = {};
|
||||||
new SpiCookie(addresses::RW4, gpioIds::CS_RW4, q7s::SPI_RW_DEV, RwDefinitions::MAX_REPLY_SIZE,
|
for (uint8_t idx = 0; idx < rwCookies.size(); idx++) {
|
||||||
spi::RW_MODE, spi::RW_SPEED, &rwSpiCallback::spiCallback, nullptr);
|
rwCookies[idx] = new SpiCookie(rwCookieParams[idx].first, rwCookieParams[idx].second,
|
||||||
|
RwDefinitions::MAX_REPLY_SIZE, spi::RW_MODE, spi::RW_SPEED,
|
||||||
|
&rwSpiCallback::spiCallback, nullptr);
|
||||||
|
rws[idx] = new RwHandler(rwIds[idx], objects::SPI_RW_COM_IF, rwCookies[idx], gpioComIF,
|
||||||
|
rwGpioIds[idx]);
|
||||||
|
rwCookies[idx]->setCallbackArgs(rws[idx]);
|
||||||
|
#if OBSW_TEST_RW == 1
|
||||||
|
rws[idx]->setStartUpImmediately();
|
||||||
|
#endif
|
||||||
|
#if OBSW_DEBUG_RW == 1
|
||||||
|
rws[idx]->setDebugMode(true);
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
|
||||||
auto rwHandler1 =
|
RwHelper rwHelper(rwIds);
|
||||||
new RwHandler(objects::RW1, objects::SPI_COM_IF, rw1SpiCookie, gpioComIF, gpioIds::EN_RW1);
|
auto* rwAss = new RwAssembly(objects::RW_ASS, objects::NO_OBJECT, pwrSwitcher,
|
||||||
rw1SpiCookie->setCallbackArgs(rwHandler1);
|
pcdu::Switches::PDU2_CH2_RW_5V, rwHelper);
|
||||||
#if OBSW_DEBUG_RW == 1
|
static_cast<void>(rwAss);
|
||||||
rwHandler1->setStartUpImmediately();
|
|
||||||
rwHandler1->setDebugMode(true);
|
|
||||||
#endif
|
|
||||||
auto rwHandler2 =
|
|
||||||
new RwHandler(objects::RW2, objects::SPI_COM_IF, rw2SpiCookie, gpioComIF, gpioIds::EN_RW2);
|
|
||||||
rw2SpiCookie->setCallbackArgs(rwHandler2);
|
|
||||||
#if OBSW_DEBUG_RW == 1
|
|
||||||
rwHandler2->setStartUpImmediately();
|
|
||||||
rwHandler2->setDebugMode(true);
|
|
||||||
#endif
|
|
||||||
auto rwHandler3 =
|
|
||||||
new RwHandler(objects::RW3, objects::SPI_COM_IF, rw3SpiCookie, gpioComIF, gpioIds::EN_RW3);
|
|
||||||
rw3SpiCookie->setCallbackArgs(rwHandler3);
|
|
||||||
#if OBSW_DEBUG_RW == 1
|
|
||||||
rwHandler3->setStartUpImmediately();
|
|
||||||
rwHandler3->setDebugMode(true);
|
|
||||||
#endif
|
|
||||||
auto rwHandler4 =
|
|
||||||
new RwHandler(objects::RW4, objects::SPI_COM_IF, rw4SpiCookie, gpioComIF, gpioIds::EN_RW4);
|
|
||||||
rw4SpiCookie->setCallbackArgs(rwHandler4);
|
|
||||||
#if OBSW_DEBUG_RW == 1
|
|
||||||
rwHandler4->setStartUpImmediately();
|
|
||||||
rwHandler4->setDebugMode(true);
|
|
||||||
#endif
|
|
||||||
#endif /* OBSW_ADD_RW == 1 */
|
#endif /* OBSW_ADD_RW == 1 */
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -806,9 +730,7 @@ void ObjectFactory::createCcsdsComponents(LinuxLibgpioIF* gpioComIF) {
|
|||||||
consumer.str("PAPB VC 3");
|
consumer.str("PAPB VC 3");
|
||||||
gpio = new GpiodRegularByLineName(q7s::gpioNames::PAPB_EMPTY_SIGNAL_VC3, consumer.str());
|
gpio = new GpiodRegularByLineName(q7s::gpioNames::PAPB_EMPTY_SIGNAL_VC3, consumer.str());
|
||||||
gpioCookiePtmeIp->addGpio(gpioIds::VC3_PAPB_EMPTY, gpio);
|
gpioCookiePtmeIp->addGpio(gpioIds::VC3_PAPB_EMPTY, gpio);
|
||||||
|
gpioChecker(gpioComIF->addGpios(gpioCookiePtmeIp), "PTME PAPB VCs");
|
||||||
gpioComIF->addGpios(gpioCookiePtmeIp);
|
|
||||||
|
|
||||||
// Creating virtual channel interfaces
|
// Creating virtual channel interfaces
|
||||||
VcInterfaceIF* vc0 =
|
VcInterfaceIF* vc0 =
|
||||||
new PapbVcInterface(gpioComIF, gpioIds::VC0_PAPB_BUSY, gpioIds::VC0_PAPB_EMPTY, q7s::UIO_PTME,
|
new PapbVcInterface(gpioComIF, gpioIds::VC0_PAPB_BUSY, gpioIds::VC0_PAPB_EMPTY, q7s::UIO_PTME,
|
||||||
@ -822,14 +744,12 @@ void ObjectFactory::createCcsdsComponents(LinuxLibgpioIF* gpioComIF) {
|
|||||||
VcInterfaceIF* vc3 =
|
VcInterfaceIF* vc3 =
|
||||||
new PapbVcInterface(gpioComIF, gpioIds::VC3_PAPB_BUSY, gpioIds::VC3_PAPB_EMPTY, q7s::UIO_PTME,
|
new PapbVcInterface(gpioComIF, gpioIds::VC3_PAPB_BUSY, gpioIds::VC3_PAPB_EMPTY, q7s::UIO_PTME,
|
||||||
q7s::uiomapids::PTME_VC3);
|
q7s::uiomapids::PTME_VC3);
|
||||||
|
|
||||||
// Creating ptme object and adding virtual channel interfaces
|
// Creating ptme object and adding virtual channel interfaces
|
||||||
Ptme* ptme = new Ptme(objects::PTME);
|
Ptme* ptme = new Ptme(objects::PTME);
|
||||||
ptme->addVcInterface(ccsds::VC0, vc0);
|
ptme->addVcInterface(ccsds::VC0, vc0);
|
||||||
ptme->addVcInterface(ccsds::VC1, vc1);
|
ptme->addVcInterface(ccsds::VC1, vc1);
|
||||||
ptme->addVcInterface(ccsds::VC2, vc2);
|
ptme->addVcInterface(ccsds::VC2, vc2);
|
||||||
ptme->addVcInterface(ccsds::VC3, vc3);
|
ptme->addVcInterface(ccsds::VC3, vc3);
|
||||||
|
|
||||||
AxiPtmeConfig* axiPtmeConfig =
|
AxiPtmeConfig* axiPtmeConfig =
|
||||||
new AxiPtmeConfig(objects::AXI_PTME_CONFIG, q7s::UIO_PTME, q7s::uiomapids::PTME_CONFIG);
|
new AxiPtmeConfig(objects::AXI_PTME_CONFIG, q7s::UIO_PTME, q7s::uiomapids::PTME_CONFIG);
|
||||||
PtmeConfig* ptmeConfig = new PtmeConfig(objects::PTME_CONFIG, axiPtmeConfig);
|
PtmeConfig* ptmeConfig = new PtmeConfig(objects::PTME_CONFIG, axiPtmeConfig);
|
||||||
@ -842,7 +762,6 @@ void ObjectFactory::createCcsdsComponents(LinuxLibgpioIF* gpioComIF) {
|
|||||||
CCSDSHandler* ccsdsHandler = new CCSDSHandler(
|
CCSDSHandler* ccsdsHandler = new CCSDSHandler(
|
||||||
objects::CCSDS_HANDLER, objects::PTME, objects::CCSDS_PACKET_DISTRIBUTOR, ptmeConfig,
|
objects::CCSDS_HANDLER, objects::PTME, objects::CCSDS_PACKET_DISTRIBUTOR, ptmeConfig,
|
||||||
gpioComIF, gpioIds::RS485_EN_TX_CLOCK, gpioIds::RS485_EN_TX_DATA, TRANSMITTER_TIMEOUT);
|
gpioComIF, gpioIds::RS485_EN_TX_CLOCK, gpioIds::RS485_EN_TX_DATA, TRANSMITTER_TIMEOUT);
|
||||||
|
|
||||||
VirtualChannel* vc = nullptr;
|
VirtualChannel* vc = nullptr;
|
||||||
vc = new VirtualChannel(ccsds::VC0, common::VC0_QUEUE_SIZE, objects::CCSDS_HANDLER);
|
vc = new VirtualChannel(ccsds::VC0, common::VC0_QUEUE_SIZE, objects::CCSDS_HANDLER);
|
||||||
ccsdsHandler->addVirtualChannel(ccsds::VC0, vc);
|
ccsdsHandler->addVirtualChannel(ccsds::VC0, vc);
|
||||||
@ -852,7 +771,6 @@ void ObjectFactory::createCcsdsComponents(LinuxLibgpioIF* gpioComIF) {
|
|||||||
ccsdsHandler->addVirtualChannel(ccsds::VC2, vc);
|
ccsdsHandler->addVirtualChannel(ccsds::VC2, vc);
|
||||||
vc = new VirtualChannel(ccsds::VC3, common::VC3_QUEUE_SIZE, objects::CCSDS_HANDLER);
|
vc = new VirtualChannel(ccsds::VC3, common::VC3_QUEUE_SIZE, objects::CCSDS_HANDLER);
|
||||||
ccsdsHandler->addVirtualChannel(ccsds::VC3, vc);
|
ccsdsHandler->addVirtualChannel(ccsds::VC3, vc);
|
||||||
|
|
||||||
GpioCookie* gpioCookiePdec = new GpioCookie;
|
GpioCookie* gpioCookiePdec = new GpioCookie;
|
||||||
consumer.str("");
|
consumer.str("");
|
||||||
consumer << "0x" << std::hex << objects::PDEC_HANDLER;
|
consumer << "0x" << std::hex << objects::PDEC_HANDLER;
|
||||||
@ -860,12 +778,9 @@ void ObjectFactory::createCcsdsComponents(LinuxLibgpioIF* gpioComIF) {
|
|||||||
gpio = new GpiodRegularByLineName(q7s::gpioNames::PDEC_RESET, consumer.str(), Direction::OUT,
|
gpio = new GpiodRegularByLineName(q7s::gpioNames::PDEC_RESET, consumer.str(), Direction::OUT,
|
||||||
Levels::LOW);
|
Levels::LOW);
|
||||||
gpioCookiePdec->addGpio(gpioIds::PDEC_RESET, gpio);
|
gpioCookiePdec->addGpio(gpioIds::PDEC_RESET, gpio);
|
||||||
|
gpioChecker(gpioComIF->addGpios(gpioCookiePdec), "PDEC");
|
||||||
gpioComIF->addGpios(gpioCookiePdec);
|
|
||||||
|
|
||||||
new PdecHandler(objects::PDEC_HANDLER, objects::CCSDS_HANDLER, gpioComIF, gpioIds::PDEC_RESET,
|
new PdecHandler(objects::PDEC_HANDLER, objects::CCSDS_HANDLER, gpioComIF, gpioIds::PDEC_RESET,
|
||||||
q7s::UIO_PDEC_CONFIG_MEMORY, q7s::UIO_PDEC_RAM, q7s::UIO_PDEC_REGISTERS);
|
q7s::UIO_PDEC_CONFIG_MEMORY, q7s::UIO_PDEC_RAM, q7s::UIO_PDEC_REGISTERS);
|
||||||
|
|
||||||
GpioCookie* gpioRS485Chip = new GpioCookie;
|
GpioCookie* gpioRS485Chip = new GpioCookie;
|
||||||
gpio = new GpiodRegularByLineName(q7s::gpioNames::RS485_EN_TX_CLOCK, "RS485 Transceiver",
|
gpio = new GpiodRegularByLineName(q7s::gpioNames::RS485_EN_TX_CLOCK, "RS485 Transceiver",
|
||||||
Direction::OUT, Levels::LOW);
|
Direction::OUT, Levels::LOW);
|
||||||
@ -873,7 +788,6 @@ void ObjectFactory::createCcsdsComponents(LinuxLibgpioIF* gpioComIF) {
|
|||||||
gpio = new GpiodRegularByLineName(q7s::gpioNames::RS485_EN_TX_DATA, "RS485 Transceiver",
|
gpio = new GpiodRegularByLineName(q7s::gpioNames::RS485_EN_TX_DATA, "RS485 Transceiver",
|
||||||
Direction::OUT, Levels::LOW);
|
Direction::OUT, Levels::LOW);
|
||||||
gpioRS485Chip->addGpio(gpioIds::RS485_EN_TX_DATA, gpio);
|
gpioRS485Chip->addGpio(gpioIds::RS485_EN_TX_DATA, gpio);
|
||||||
|
|
||||||
// Default configuration enables RX channels (RXEN = LOW)
|
// Default configuration enables RX channels (RXEN = LOW)
|
||||||
gpio = new GpiodRegularByLineName(q7s::gpioNames::RS485_EN_RX_CLOCK, "RS485 Transceiver",
|
gpio = new GpiodRegularByLineName(q7s::gpioNames::RS485_EN_RX_CLOCK, "RS485 Transceiver",
|
||||||
Direction::OUT, Levels::LOW);
|
Direction::OUT, Levels::LOW);
|
||||||
@ -881,8 +795,7 @@ void ObjectFactory::createCcsdsComponents(LinuxLibgpioIF* gpioComIF) {
|
|||||||
gpio = new GpiodRegularByLineName(q7s::gpioNames::RS485_EN_RX_DATA, "RS485 Transceiver",
|
gpio = new GpiodRegularByLineName(q7s::gpioNames::RS485_EN_RX_DATA, "RS485 Transceiver",
|
||||||
Direction::OUT, Levels::LOW);
|
Direction::OUT, Levels::LOW);
|
||||||
gpioRS485Chip->addGpio(gpioIds::RS485_EN_RX_DATA, gpio);
|
gpioRS485Chip->addGpio(gpioIds::RS485_EN_RX_DATA, gpio);
|
||||||
|
gpioChecker(gpioComIF->addGpios(gpioRS485Chip), "RS485 Transceiver");
|
||||||
gpioComIF->addGpios(gpioRS485Chip);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void ObjectFactory::createPlPcduComponents(LinuxLibgpioIF* gpioComIF, SpiComIF* spiComIF,
|
void ObjectFactory::createPlPcduComponents(LinuxLibgpioIF* gpioComIF, SpiComIF* spiComIF,
|
||||||
@ -927,14 +840,14 @@ void ObjectFactory::createPlPcduComponents(LinuxLibgpioIF* gpioComIF, SpiComIF*
|
|||||||
gpio = new GpiodRegularByLineName(q7s::gpioNames::PL_PCDU_ADC_CS, consumer, Direction::OUT,
|
gpio = new GpiodRegularByLineName(q7s::gpioNames::PL_PCDU_ADC_CS, consumer, Direction::OUT,
|
||||||
gpio::Levels::HIGH);
|
gpio::Levels::HIGH);
|
||||||
plPcduGpios->addGpio(gpioIds::PLPCDU_ADC_CS, gpio);
|
plPcduGpios->addGpio(gpioIds::PLPCDU_ADC_CS, gpio);
|
||||||
gpioComIF->addGpios(plPcduGpios);
|
gpioChecker(gpioComIF->addGpios(plPcduGpios), "PL PCDU");
|
||||||
SpiCookie* spiCookie = new SpiCookie(addresses::PLPCDU_ADC, gpioIds::PLPCDU_ADC_CS,
|
SpiCookie* spiCookie =
|
||||||
q7s::SPI_DEFAULT_DEV, plpcdu::MAX_ADC_REPLY_SIZE,
|
new SpiCookie(addresses::PLPCDU_ADC, gpioIds::PLPCDU_ADC_CS, plpcdu::MAX_ADC_REPLY_SIZE,
|
||||||
spi::DEFAULT_MAX_1227_MODE, spi::PL_PCDU_MAX_1227_SPEED);
|
spi::DEFAULT_MAX_1227_MODE, spi::PL_PCDU_MAX_1227_SPEED);
|
||||||
// Create device handler components
|
// Create device handler components
|
||||||
auto plPcduHandler = new PayloadPcduHandler(
|
auto plPcduHandler = new PayloadPcduHandler(
|
||||||
objects::PLPCDU_HANDLER, objects::SPI_COM_IF, spiCookie, gpioComIF, SdCardManager::instance(),
|
objects::PLPCDU_HANDLER, objects::SPI_MAIN_COM_IF, spiCookie, gpioComIF,
|
||||||
pwrSwitcher, pcdu::Switches::PDU2_CH1_PL_PCDU_BATT_0_14V8,
|
SdCardManager::instance(), pwrSwitcher, pcdu::Switches::PDU2_CH1_PL_PCDU_BATT_0_14V8,
|
||||||
pcdu::Switches::PDU2_CH6_PL_PCDU_BATT_1_14V8, false);
|
pcdu::Switches::PDU2_CH6_PL_PCDU_BATT_1_14V8, false);
|
||||||
spiCookie->setCallbackMode(PayloadPcduHandler::extConvAsTwoCallback, plPcduHandler);
|
spiCookie->setCallbackMode(PayloadPcduHandler::extConvAsTwoCallback, plPcduHandler);
|
||||||
// plPcduHandler->enablePeriodicPrintout(true, 5);
|
// plPcduHandler->enablePeriodicPrintout(true, 5);
|
||||||
@ -961,6 +874,50 @@ void ObjectFactory::createTestComponents(LinuxLibgpioIF* gpioComIF) {
|
|||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void ObjectFactory::createStrComponents(PowerSwitchIF* pwrSwitcher) {
|
||||||
|
UartCookie* starTrackerCookie =
|
||||||
|
new UartCookie(objects::STAR_TRACKER, q7s::UART_STAR_TRACKER_DEV, uart::STAR_TRACKER_BAUD,
|
||||||
|
startracker::MAX_FRAME_SIZE * 2 + 2, UartModes::NON_CANONICAL);
|
||||||
|
starTrackerCookie->setNoFixedSizeReply();
|
||||||
|
StrHelper* strHelper = new StrHelper(objects::STR_HELPER);
|
||||||
|
auto starTracker =
|
||||||
|
new StarTrackerHandler(objects::STAR_TRACKER, objects::UART_COM_IF, starTrackerCookie,
|
||||||
|
strHelper, pcdu::PDU1_CH2_STAR_TRACKER_5V);
|
||||||
|
starTracker->setPowerSwitcher(pwrSwitcher);
|
||||||
|
}
|
||||||
|
|
||||||
|
void ObjectFactory::createImtqComponents(PowerSwitchIF* pwrSwitcher) {
|
||||||
|
I2cCookie* imtqI2cCookie =
|
||||||
|
new I2cCookie(addresses::IMTQ, IMTQ::MAX_REPLY_SIZE, q7s::I2C_DEFAULT_DEV);
|
||||||
|
auto imtqHandler = new IMTQHandler(objects::IMTQ_HANDLER, objects::I2C_COM_IF, imtqI2cCookie,
|
||||||
|
pcdu::Switches::PDU1_CH3_MGT_5V);
|
||||||
|
imtqHandler->setPowerSwitcher(pwrSwitcher);
|
||||||
|
static_cast<void>(imtqHandler);
|
||||||
|
#if OBSW_TEST_IMTQ == 1
|
||||||
|
imtqHandler->setStartUpImmediately();
|
||||||
|
imtqHandler->setToGoToNormal(true);
|
||||||
|
#endif
|
||||||
|
#if OBSW_DEBUG_IMTQ == 1
|
||||||
|
imtqHandler->setDebugMode(true);
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
|
||||||
|
void ObjectFactory::createBpxBatteryComponent() {
|
||||||
|
I2cCookie* bpxI2cCookie = new I2cCookie(addresses::BPX_BATTERY, 100, q7s::I2C_DEFAULT_DEV);
|
||||||
|
BpxBatteryHandler* bpxHandler =
|
||||||
|
new BpxBatteryHandler(objects::BPX_BATT_HANDLER, objects::I2C_COM_IF, bpxI2cCookie);
|
||||||
|
bpxHandler->setStartUpImmediately();
|
||||||
|
bpxHandler->setToGoToNormalMode(true);
|
||||||
|
#if OBSW_DEBUG_BPX_BATT == 1
|
||||||
|
bpxHandler->setDebugMode(true);
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
|
||||||
|
void ObjectFactory::createMiscComponents() {
|
||||||
|
new FileSystemHandler(objects::FILE_SYSTEM_HANDLER);
|
||||||
|
new PlocMemoryDumper(objects::PLOC_MEMORY_DUMPER);
|
||||||
|
}
|
||||||
|
|
||||||
void ObjectFactory::testAcsBrdAss(AcsBoardAssembly* acsAss) {
|
void ObjectFactory::testAcsBrdAss(AcsBoardAssembly* acsAss) {
|
||||||
CommandMessage msg;
|
CommandMessage msg;
|
||||||
ModeMessage::setModeMessage(&msg, ModeMessage::CMD_MODE_COMMAND, DeviceHandlerIF::MODE_NORMAL,
|
ModeMessage::setModeMessage(&msg, ModeMessage::CMD_MODE_COMMAND, DeviceHandlerIF::MODE_NORMAL,
|
@ -1,12 +1,18 @@
|
|||||||
#ifndef BSP_Q7S_OBJECTFACTORY_H_
|
#ifndef BSP_Q7S_OBJECTFACTORY_H_
|
||||||
#define BSP_Q7S_OBJECTFACTORY_H_
|
#define BSP_Q7S_OBJECTFACTORY_H_
|
||||||
|
|
||||||
|
#include <fsfw/returnvalues/HasReturnvaluesIF.h>
|
||||||
|
|
||||||
|
#include <string>
|
||||||
|
|
||||||
class LinuxLibgpioIF;
|
class LinuxLibgpioIF;
|
||||||
class UartComIF;
|
class UartComIF;
|
||||||
class SpiComIF;
|
class SpiComIF;
|
||||||
class I2cComIF;
|
class I2cComIF;
|
||||||
class PowerSwitchIF;
|
class PowerSwitchIF;
|
||||||
|
class HealthTableIF;
|
||||||
class AcsBoardAssembly;
|
class AcsBoardAssembly;
|
||||||
|
class GpioIF;
|
||||||
|
|
||||||
namespace ObjectFactory {
|
namespace ObjectFactory {
|
||||||
|
|
||||||
@ -14,7 +20,8 @@ void setStatics();
|
|||||||
void produce(void* args);
|
void produce(void* args);
|
||||||
|
|
||||||
void createCommunicationInterfaces(LinuxLibgpioIF** gpioComIF, UartComIF** uartComIF,
|
void createCommunicationInterfaces(LinuxLibgpioIF** gpioComIF, UartComIF** uartComIF,
|
||||||
SpiComIF** spiComIF, I2cComIF** i2cComIF);
|
SpiComIF** spiMainComIF, I2cComIF** i2cComIF,
|
||||||
|
SpiComIF** spiRwComIF);
|
||||||
void createPcduComponents(LinuxLibgpioIF* gpioComIF, PowerSwitchIF** pwrSwitcher);
|
void createPcduComponents(LinuxLibgpioIF* gpioComIF, PowerSwitchIF** pwrSwitcher);
|
||||||
void createPlPcduComponents(LinuxLibgpioIF* gpioComIF, SpiComIF* spiComIF,
|
void createPlPcduComponents(LinuxLibgpioIF* gpioComIF, SpiComIF* spiComIF,
|
||||||
PowerSwitchIF* pwrSwitcher);
|
PowerSwitchIF* pwrSwitcher);
|
||||||
@ -22,12 +29,17 @@ void createTmpComponents();
|
|||||||
void createRadSensorComponent(LinuxLibgpioIF* gpioComIF);
|
void createRadSensorComponent(LinuxLibgpioIF* gpioComIF);
|
||||||
void createAcsBoardComponents(LinuxLibgpioIF* gpioComIF, UartComIF* uartComIF,
|
void createAcsBoardComponents(LinuxLibgpioIF* gpioComIF, UartComIF* uartComIF,
|
||||||
PowerSwitchIF* pwrSwitcher);
|
PowerSwitchIF* pwrSwitcher);
|
||||||
void createHeaterComponents();
|
void createHeaterComponents(GpioIF* gpioIF, PowerSwitchIF* pwrSwitcher, HealthTableIF* healthTable);
|
||||||
|
void createImtqComponents(PowerSwitchIF* pwrSwitcher);
|
||||||
|
void createBpxBatteryComponent();
|
||||||
|
void createStrComponents(PowerSwitchIF* pwrSwitcher);
|
||||||
void createSolarArrayDeploymentComponents();
|
void createSolarArrayDeploymentComponents();
|
||||||
void createSyrlinksComponents(PowerSwitchIF* pwrSwitcher);
|
void createSyrlinksComponents(PowerSwitchIF* pwrSwitcher);
|
||||||
void createPayloadComponents(LinuxLibgpioIF* gpioComIF);
|
void createPayloadComponents(LinuxLibgpioIF* gpioComIF);
|
||||||
void createReactionWheelComponents(LinuxLibgpioIF* gpioComIF);
|
void createReactionWheelComponents(LinuxLibgpioIF* gpioComIF, PowerSwitchIF* pwrSwitcher);
|
||||||
void createCcsdsComponents(LinuxLibgpioIF* gpioComIF);
|
void createCcsdsComponents(LinuxLibgpioIF* gpioComIF);
|
||||||
|
void createMiscComponents();
|
||||||
|
|
||||||
void createTestComponents(LinuxLibgpioIF* gpioComIF);
|
void createTestComponents(LinuxLibgpioIF* gpioComIF);
|
||||||
|
|
||||||
void testAcsBrdAss(AcsBoardAssembly* assAss);
|
void testAcsBrdAss(AcsBoardAssembly* assAss);
|
||||||
|
@ -1,3 +1 @@
|
|||||||
target_sources(${OBSW_NAME} PRIVATE
|
target_sources(${OBSW_NAME} PRIVATE emObjectFactory.cpp)
|
||||||
emObjectFactory.cpp
|
|
||||||
)
|
|
||||||
|
@ -1,199 +1,63 @@
|
|||||||
#include <mission/system/fdir/GomspacePowerFdir.h>
|
#include <fsfw/health/HealthTableIF.h>
|
||||||
#include <mission/system/fdir/SyrlinksFdir.h>
|
|
||||||
|
|
||||||
#include "OBSWConfig.h"
|
#include "OBSWConfig.h"
|
||||||
#include "bsp_q7s/boardtest/Q7STestTask.h"
|
|
||||||
#include "bsp_q7s/callbacks/gnssCallback.h"
|
|
||||||
#include "bsp_q7s/callbacks/pcduSwitchCb.h"
|
|
||||||
#include "bsp_q7s/callbacks/q7sGpioCallbacks.h"
|
|
||||||
#include "bsp_q7s/callbacks/rwSpiCallback.h"
|
|
||||||
#include "bsp_q7s/core/CoreController.h"
|
#include "bsp_q7s/core/CoreController.h"
|
||||||
#include "bsp_q7s/core/ObjectFactory.h"
|
#include "bsp_q7s/core/ObjectFactory.h"
|
||||||
#include "bsp_q7s/memory/FileSystemHandler.h"
|
|
||||||
#include "busConf.h"
|
#include "busConf.h"
|
||||||
#include "ccsdsConfig.h"
|
#include "commonObjects.h"
|
||||||
#include "devConf.h"
|
#include "devConf.h"
|
||||||
#include "devices/addresses.h"
|
|
||||||
#include "devices/gpioIds.h"
|
|
||||||
#include "devices/powerSwitcherList.h"
|
|
||||||
#include "fsfw/ipc/QueueFactory.h"
|
|
||||||
#include "linux/ObjectFactory.h"
|
|
||||||
#include "linux/boardtest/I2cTestClass.h"
|
|
||||||
#include "linux/boardtest/SpiTestClass.h"
|
|
||||||
#include "linux/boardtest/UartTestClass.h"
|
|
||||||
#include "linux/callbacks/gpioCallbacks.h"
|
|
||||||
#include "linux/csp/CspComIF.h"
|
|
||||||
#include "linux/csp/CspCookie.h"
|
|
||||||
#include "linux/devices/GPSHyperionLinuxController.h"
|
|
||||||
#include "linux/devices/devicedefinitions/PlocMPSoCDefinitions.h"
|
|
||||||
#include "linux/devices/devicedefinitions/StarTrackerDefinitions.h"
|
|
||||||
#include "linux/devices/ploc/PlocMPSoCHandler.h"
|
|
||||||
#include "linux/devices/ploc/PlocMPSoCHelper.h"
|
|
||||||
#include "linux/devices/ploc/PlocMemoryDumper.h"
|
|
||||||
#include "linux/devices/ploc/PlocSupervisorHandler.h"
|
|
||||||
#include "linux/devices/ploc/PlocUpdater.h"
|
|
||||||
#include "linux/devices/startracker/StarTrackerHandler.h"
|
|
||||||
#include "linux/devices/startracker/StrHelper.h"
|
|
||||||
#include "linux/obc/AxiPtmeConfig.h"
|
|
||||||
#include "linux/obc/PapbVcInterface.h"
|
|
||||||
#include "linux/obc/PdecHandler.h"
|
|
||||||
#include "linux/obc/Ptme.h"
|
|
||||||
#include "linux/obc/PtmeConfig.h"
|
|
||||||
#include "mission/system/SusAssembly.h"
|
|
||||||
#include "mission/system/TcsBoardAssembly.h"
|
|
||||||
#include "mission/system/fdir/AcsBoardFdir.h"
|
|
||||||
#include "mission/system/fdir/RtdFdir.h"
|
|
||||||
#include "mission/system/fdir/SusFdir.h"
|
|
||||||
#include "tmtc/apid.h"
|
|
||||||
#include "tmtc/pusIds.h"
|
|
||||||
#if OBSW_TEST_LIBGPIOD == 1
|
|
||||||
#include "linux/boardtest/LibgpiodTest.h"
|
|
||||||
#endif
|
|
||||||
#include <sstream>
|
|
||||||
|
|
||||||
#include "fsfw/datapoollocal/LocalDataPoolManager.h"
|
|
||||||
#include "fsfw/tmtcpacket/pus/tm.h"
|
|
||||||
#include "fsfw/tmtcservices/CommandingServiceBase.h"
|
|
||||||
#include "fsfw/tmtcservices/PusServiceBase.h"
|
|
||||||
#include "fsfw_hal/common/gpio/GpioCookie.h"
|
|
||||||
#include "fsfw_hal/common/gpio/gpioDefinitions.h"
|
|
||||||
#include "fsfw_hal/devicehandlers/GyroL3GD20Handler.h"
|
|
||||||
#include "fsfw_hal/devicehandlers/MgmLIS3MDLHandler.h"
|
|
||||||
#include "fsfw_hal/devicehandlers/MgmRM3100Handler.h"
|
|
||||||
#include "fsfw_hal/linux/gpio/LinuxLibgpioIF.h"
|
#include "fsfw_hal/linux/gpio/LinuxLibgpioIF.h"
|
||||||
#include "fsfw_hal/linux/i2c/I2cComIF.h"
|
#include "linux/ObjectFactory.h"
|
||||||
#include "fsfw_hal/linux/i2c/I2cCookie.h"
|
#include "linux/callbacks/gpioCallbacks.h"
|
||||||
#include "fsfw_hal/linux/spi/SpiComIF.h"
|
|
||||||
#include "fsfw_hal/linux/spi/SpiCookie.h"
|
|
||||||
#include "fsfw_hal/linux/uart/UartComIF.h"
|
|
||||||
#include "fsfw_hal/linux/uart/UartCookie.h"
|
|
||||||
#include "mission/core/GenericFactory.h"
|
#include "mission/core/GenericFactory.h"
|
||||||
#include "mission/devices/ACUHandler.h"
|
|
||||||
#include "mission/devices/BpxBatteryHandler.h"
|
|
||||||
#include "mission/devices/GyroADIS1650XHandler.h"
|
|
||||||
#include "mission/devices/HeaterHandler.h"
|
|
||||||
#include "mission/devices/IMTQHandler.h"
|
|
||||||
#include "mission/devices/Max31865PT1000Handler.h"
|
|
||||||
#include "mission/devices/P60DockHandler.h"
|
|
||||||
#include "mission/devices/PCDUHandler.h"
|
|
||||||
#include "mission/devices/PDU1Handler.h"
|
|
||||||
#include "mission/devices/PDU2Handler.h"
|
|
||||||
#include "mission/devices/PayloadPcduHandler.h"
|
|
||||||
#include "mission/devices/RadiationSensorHandler.h"
|
|
||||||
#include "mission/devices/RwHandler.h"
|
|
||||||
#include "mission/devices/SolarArrayDeploymentHandler.h"
|
|
||||||
#include "mission/devices/SusHandler.h"
|
|
||||||
#include "mission/devices/SyrlinksHkHandler.h"
|
|
||||||
#include "mission/devices/Tmp1075Handler.h"
|
|
||||||
#include "mission/devices/devicedefinitions/GomspaceDefinitions.h"
|
|
||||||
#include "mission/devices/devicedefinitions/Max31865Definitions.h"
|
|
||||||
#include "mission/devices/devicedefinitions/RadSensorDefinitions.h"
|
|
||||||
#include "mission/devices/devicedefinitions/RwDefinitions.h"
|
|
||||||
#include "mission/devices/devicedefinitions/SusDefinitions.h"
|
|
||||||
#include "mission/devices/devicedefinitions/SyrlinksDefinitions.h"
|
|
||||||
#include "mission/devices/devicedefinitions/payloadPcduDefinitions.h"
|
|
||||||
#include "mission/system/AcsBoardAssembly.h"
|
|
||||||
#include "mission/tmtc/CCSDSHandler.h"
|
|
||||||
#include "mission/tmtc/VirtualChannel.h"
|
|
||||||
#include "mission/utility/TmFunnel.h"
|
|
||||||
ResetArgs resetArgsGnss0;
|
|
||||||
ResetArgs resetArgsGnss1;
|
|
||||||
|
|
||||||
void ObjectFactory::setStatics() { Factory::setStaticFrameworkObjectIds(); }
|
|
||||||
|
|
||||||
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;
|
|
||||||
|
|
||||||
DeviceHandlerBase::powerSwitcherId = objects::PCDU_HANDLER;
|
|
||||||
// DeviceHandlerBase::powerSwitcherId = objects::NO_OBJECT;
|
|
||||||
#if OBSW_TM_TO_PTME == 1
|
|
||||||
TmFunnel::downlinkDestination = objects::CCSDS_HANDLER;
|
|
||||||
#else
|
|
||||||
TmFunnel::downlinkDestination = objects::TMTC_BRIDGE;
|
|
||||||
#endif /* OBSW_TM_TO_PTME == 1 */
|
|
||||||
// No storage object for now.
|
|
||||||
TmFunnel::storageDestination = objects::NO_OBJECT;
|
|
||||||
|
|
||||||
LocalDataPoolManager::defaultHkDestination = objects::PUS_SERVICE_3_HOUSEKEEPING;
|
|
||||||
|
|
||||||
VerificationReporter::messageReceiver = objects::PUS_SERVICE_1_VERIFICATION;
|
|
||||||
TmPacketBase::timeStamperId = objects::TIME_STAMPER;
|
|
||||||
}
|
|
||||||
|
|
||||||
void ObjectFactory::produce(void* args) {
|
void ObjectFactory::produce(void* args) {
|
||||||
ObjectFactory::setStatics();
|
ObjectFactory::setStatics();
|
||||||
ObjectFactory::produceGenericObjects();
|
HealthTableIF* healthTable = nullptr;
|
||||||
|
ObjectFactory::produceGenericObjects(&healthTable);
|
||||||
|
|
||||||
LinuxLibgpioIF* gpioComIF = nullptr;
|
LinuxLibgpioIF* gpioComIF = nullptr;
|
||||||
UartComIF* uartComIF = nullptr;
|
UartComIF* uartComIF = nullptr;
|
||||||
SpiComIF* spiComIF = nullptr;
|
SpiComIF* spiMainComIF = nullptr;
|
||||||
I2cComIF* i2cComIF = nullptr;
|
I2cComIF* i2cComIF = nullptr;
|
||||||
PowerSwitchIF* pwrSwitcher = nullptr;
|
PowerSwitchIF* pwrSwitcher = nullptr;
|
||||||
createCommunicationInterfaces(&gpioComIF, &uartComIF, &spiComIF, &i2cComIF);
|
SpiComIF* spiRwComIF = nullptr;
|
||||||
|
createCommunicationInterfaces(&gpioComIF, &uartComIF, &spiMainComIF, &i2cComIF, &spiRwComIF);
|
||||||
createTmpComponents();
|
createTmpComponents();
|
||||||
new CoreController(objects::CORE_CONTROLLER);
|
new CoreController(objects::CORE_CONTROLLER);
|
||||||
|
|
||||||
gpioCallbacks::disableAllDecoder(gpioComIF);
|
gpioCallbacks::disableAllDecoder(gpioComIF);
|
||||||
createPcduComponents(gpioComIF, &pwrSwitcher);
|
createPcduComponents(gpioComIF, &pwrSwitcher);
|
||||||
createRadSensorComponent(gpioComIF);
|
createRadSensorComponent(gpioComIF);
|
||||||
createSunSensorComponents(gpioComIF, spiComIF, pwrSwitcher, q7s::SPI_DEFAULT_DEV);
|
createSunSensorComponents(gpioComIF, spiMainComIF, pwrSwitcher, q7s::SPI_DEFAULT_DEV);
|
||||||
|
|
||||||
#if OBSW_ADD_ACS_BOARD == 1
|
#if OBSW_ADD_ACS_BOARD == 1
|
||||||
createAcsBoardComponents(gpioComIF, uartComIF, pwrSwitcher);
|
createAcsBoardComponents(gpioComIF, uartComIF, pwrSwitcher);
|
||||||
#endif
|
#endif
|
||||||
createHeaterComponents();
|
createHeaterComponents(gpioComIF, pwrSwitcher, healthTable);
|
||||||
createSolarArrayDeploymentComponents();
|
createSolarArrayDeploymentComponents();
|
||||||
createPlPcduComponents(gpioComIF, spiComIF, pwrSwitcher);
|
createPlPcduComponents(gpioComIF, spiMainComIF, pwrSwitcher);
|
||||||
#if OBSW_ADD_SYRLINKS == 1
|
#if OBSW_ADD_SYRLINKS == 1
|
||||||
|
#if OBSW_Q7S_EM == 1
|
||||||
|
createSyrlinksComponents(nullptr);
|
||||||
|
#else
|
||||||
createSyrlinksComponents(pwrSwitcher);
|
createSyrlinksComponents(pwrSwitcher);
|
||||||
|
#endif /* OBSW_Q7S_EM == 1 */
|
||||||
#endif /* OBSW_ADD_SYRLINKS == 1 */
|
#endif /* OBSW_ADD_SYRLINKS == 1 */
|
||||||
createRtdComponents(q7s::SPI_DEFAULT_DEV, gpioComIF, pwrSwitcher);
|
createRtdComponents(q7s::SPI_DEFAULT_DEV, gpioComIF, pwrSwitcher, spiMainComIF);
|
||||||
createPayloadComponents(gpioComIF);
|
createPayloadComponents(gpioComIF);
|
||||||
|
|
||||||
#if OBSW_ADD_MGT == 1
|
#if OBSW_ADD_MGT == 1
|
||||||
I2cCookie* imtqI2cCookie =
|
createImtqComponents(pwrSwitcher);
|
||||||
new I2cCookie(addresses::IMTQ, IMTQ::MAX_REPLY_SIZE, q7s::I2C_DEFAULT_DEV);
|
|
||||||
auto imtqHandler = new IMTQHandler(objects::IMTQ_HANDLER, objects::I2C_COM_IF, imtqI2cCookie,
|
|
||||||
pcdu::Switches::PDU1_CH3_MGT_5V);
|
|
||||||
imtqHandler->setPowerSwitcher(pwrSwitcher);
|
|
||||||
static_cast<void>(imtqHandler);
|
|
||||||
#if OBSW_TEST_IMTQ == 1
|
|
||||||
imtqHandler->setStartUpImmediately();
|
|
||||||
imtqHandler->setToGoToNormal(true);
|
|
||||||
#endif
|
#endif
|
||||||
#if OBSW_DEBUG_IMTQ == 1
|
createReactionWheelComponents(gpioComIF, pwrSwitcher);
|
||||||
imtqHandler->setDebugMode(true);
|
|
||||||
#endif
|
|
||||||
#endif
|
|
||||||
createReactionWheelComponents(gpioComIF);
|
|
||||||
|
|
||||||
#if OBSW_ADD_BPX_BATTERY_HANDLER == 1
|
#if OBSW_ADD_BPX_BATTERY_HANDLER == 1
|
||||||
I2cCookie* bpxI2cCookie = new I2cCookie(addresses::BPX_BATTERY, 100, q7s::I2C_DEFAULT_DEV);
|
createBpxBatteryComponent();
|
||||||
BpxBatteryHandler* bpxHandler =
|
|
||||||
new BpxBatteryHandler(objects::BPX_BATT_HANDLER, objects::I2C_COM_IF, bpxI2cCookie);
|
|
||||||
bpxHandler->setStartUpImmediately();
|
|
||||||
bpxHandler->setToGoToNormalMode(true);
|
|
||||||
#if OBSW_DEBUG_BPX_BATT == 1
|
|
||||||
bpxHandler->setDebugMode(true);
|
|
||||||
#endif
|
#endif
|
||||||
#endif
|
|
||||||
new FileSystemHandler(objects::FILE_SYSTEM_HANDLER);
|
|
||||||
|
|
||||||
#if OBSW_ADD_STAR_TRACKER == 1
|
#if OBSW_ADD_STAR_TRACKER == 1
|
||||||
UartCookie* starTrackerCookie =
|
createStrComponents(pwrSwitcher);
|
||||||
new UartCookie(objects::STAR_TRACKER, q7s::UART_STAR_TRACKER_DEV, uart::STAR_TRACKER_BAUD,
|
|
||||||
startracker::MAX_FRAME_SIZE * 2 + 2, UartModes::NON_CANONICAL);
|
|
||||||
starTrackerCookie->setNoFixedSizeReply();
|
|
||||||
StrHelper* strHelper = new StrHelper(objects::STR_HELPER);
|
|
||||||
auto starTracker =
|
|
||||||
new StarTrackerHandler(objects::STAR_TRACKER, objects::UART_COM_IF, starTrackerCookie,
|
|
||||||
strHelper, pcdu::PDU1_CH2_STAR_TRACKER_5V);
|
|
||||||
starTracker->setPowerSwitcher(pwrSwitcher);
|
|
||||||
|
|
||||||
#endif /* OBSW_ADD_STAR_TRACKER == 1 */
|
#endif /* OBSW_ADD_STAR_TRACKER == 1 */
|
||||||
#if OBSW_USE_CCSDS_IP_CORE == 1
|
#if OBSW_USE_CCSDS_IP_CORE == 1
|
||||||
createCcsdsComponents(gpioComIF);
|
createCcsdsComponents(gpioComIF);
|
||||||
@ -202,771 +66,6 @@ void ObjectFactory::produce(void* args) {
|
|||||||
#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 */
|
||||||
new PlocUpdater(objects::PLOC_UPDATER);
|
|
||||||
new PlocMemoryDumper(objects::PLOC_MEMORY_DUMPER);
|
createMiscComponents();
|
||||||
}
|
|
||||||
|
|
||||||
void ObjectFactory::createTmpComponents() {
|
|
||||||
I2cCookie* i2cCookieTmp1075tcs1 =
|
|
||||||
new I2cCookie(addresses::TMP1075_TCS_1, TMP1075::MAX_REPLY_LENGTH, q7s::I2C_DEFAULT_DEV);
|
|
||||||
I2cCookie* i2cCookieTmp1075tcs2 =
|
|
||||||
new I2cCookie(addresses::TMP1075_TCS_2, TMP1075::MAX_REPLY_LENGTH, q7s::I2C_DEFAULT_DEV);
|
|
||||||
|
|
||||||
/* Temperature sensors */
|
|
||||||
Tmp1075Handler* tmp1075Handler_1 =
|
|
||||||
new Tmp1075Handler(objects::TMP1075_HANDLER_1, objects::I2C_COM_IF, i2cCookieTmp1075tcs1);
|
|
||||||
(void)tmp1075Handler_1;
|
|
||||||
Tmp1075Handler* tmp1075Handler_2 =
|
|
||||||
new Tmp1075Handler(objects::TMP1075_HANDLER_2, objects::I2C_COM_IF, i2cCookieTmp1075tcs2);
|
|
||||||
(void)tmp1075Handler_2;
|
|
||||||
}
|
|
||||||
|
|
||||||
void ObjectFactory::createCommunicationInterfaces(LinuxLibgpioIF** gpioComIF, UartComIF** uartComIF,
|
|
||||||
SpiComIF** spiComIF, I2cComIF** i2cComIF) {
|
|
||||||
if (gpioComIF == nullptr or uartComIF == nullptr or spiComIF == nullptr) {
|
|
||||||
sif::error << "ObjectFactory::createCommunicationInterfaces: Invalid passed ComIF pointer"
|
|
||||||
<< std::endl;
|
|
||||||
}
|
|
||||||
*gpioComIF = new LinuxLibgpioIF(objects::GPIO_IF);
|
|
||||||
|
|
||||||
/* Communication interfaces */
|
|
||||||
new CspComIF(objects::CSP_COM_IF);
|
|
||||||
*i2cComIF = new I2cComIF(objects::I2C_COM_IF);
|
|
||||||
*uartComIF = new UartComIF(objects::UART_COM_IF);
|
|
||||||
*spiComIF = new SpiComIF(objects::SPI_COM_IF, *gpioComIF);
|
|
||||||
|
|
||||||
/* Adding gpios for chip select decoding to the gpioComIf */
|
|
||||||
q7s::gpioCallbacks::initSpiCsDecoder(*gpioComIF);
|
|
||||||
}
|
|
||||||
|
|
||||||
void ObjectFactory::createPcduComponents(LinuxLibgpioIF* gpioComIF, PowerSwitchIF** pwrSwitcher) {
|
|
||||||
CspCookie* p60DockCspCookie = new CspCookie(P60Dock::MAX_REPLY_LENGTH, addresses::P60DOCK);
|
|
||||||
CspCookie* pdu1CspCookie = new CspCookie(PDU::MAX_REPLY_LENGTH, addresses::PDU1);
|
|
||||||
CspCookie* pdu2CspCookie = new CspCookie(PDU::MAX_REPLY_LENGTH, addresses::PDU2);
|
|
||||||
CspCookie* acuCspCookie = new CspCookie(ACU::MAX_REPLY_LENGTH, addresses::ACU);
|
|
||||||
|
|
||||||
auto p60Fdir = new GomspacePowerFdir(objects::P60DOCK_HANDLER);
|
|
||||||
P60DockHandler* p60dockhandler =
|
|
||||||
new P60DockHandler(objects::P60DOCK_HANDLER, objects::CSP_COM_IF, p60DockCspCookie, p60Fdir);
|
|
||||||
|
|
||||||
auto pdu1Fdir = new GomspacePowerFdir(objects::PDU1_HANDLER);
|
|
||||||
PDU1Handler* pdu1handler =
|
|
||||||
new PDU1Handler(objects::PDU1_HANDLER, objects::CSP_COM_IF, pdu1CspCookie, pdu1Fdir);
|
|
||||||
|
|
||||||
auto pdu2Fdir = new GomspacePowerFdir(objects::PDU2_HANDLER);
|
|
||||||
PDU2Handler* pdu2handler =
|
|
||||||
new PDU2Handler(objects::PDU2_HANDLER, objects::CSP_COM_IF, pdu2CspCookie, pdu2Fdir);
|
|
||||||
|
|
||||||
auto acuFdir = new GomspacePowerFdir(objects::ACU_HANDLER);
|
|
||||||
ACUHandler* acuhandler =
|
|
||||||
new ACUHandler(objects::ACU_HANDLER, objects::CSP_COM_IF, acuCspCookie, acuFdir);
|
|
||||||
auto pcduHandler = new PCDUHandler(objects::PCDU_HANDLER, 50);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Setting PCDU devices to mode normal immediately after start up because PCDU is always
|
|
||||||
* running.
|
|
||||||
*/
|
|
||||||
p60dockhandler->setModeNormal();
|
|
||||||
pdu1handler->setModeNormal();
|
|
||||||
pdu2handler->setModeNormal();
|
|
||||||
acuhandler->setModeNormal();
|
|
||||||
if (pwrSwitcher != nullptr) {
|
|
||||||
*pwrSwitcher = pcduHandler;
|
|
||||||
}
|
|
||||||
#if OBSW_DEBUG_P60DOCK == 1
|
|
||||||
p60dockhandler->setDebugMode(true);
|
|
||||||
#endif
|
|
||||||
#if OBSW_DEBUG_ACU == 1
|
|
||||||
acuhandler->setDebugMode(true);
|
|
||||||
#endif
|
|
||||||
}
|
|
||||||
|
|
||||||
void ObjectFactory::createRadSensorComponent(LinuxLibgpioIF* gpioComIF) {
|
|
||||||
using namespace gpio;
|
|
||||||
GpioCookie* gpioCookieRadSensor = new GpioCookie;
|
|
||||||
std::stringstream consumer;
|
|
||||||
consumer << "0x" << std::hex << objects::RAD_SENSOR;
|
|
||||||
GpiodRegularByLineName* gpio = new GpiodRegularByLineName(
|
|
||||||
q7s::gpioNames::RAD_SENSOR_CHIP_SELECT, consumer.str(), Direction::OUT, Levels::HIGH);
|
|
||||||
gpioCookieRadSensor->addGpio(gpioIds::CS_RAD_SENSOR, gpio);
|
|
||||||
gpio = new GpiodRegularByLineName(q7s::gpioNames::ENABLE_RADFET, consumer.str(), Direction::OUT,
|
|
||||||
Levels::LOW);
|
|
||||||
gpioCookieRadSensor->addGpio(gpioIds::ENABLE_RADFET, gpio);
|
|
||||||
gpioComIF->addGpios(gpioCookieRadSensor);
|
|
||||||
|
|
||||||
SpiCookie* spiCookieRadSensor = new SpiCookie(
|
|
||||||
addresses::RAD_SENSOR, gpioIds::CS_RAD_SENSOR, std::string(q7s::SPI_DEFAULT_DEV),
|
|
||||||
RAD_SENSOR::READ_SIZE, spi::DEFAULT_MAX_1227_MODE, spi::DEFAULT_MAX_1227_SPEED);
|
|
||||||
auto radSensor = new RadiationSensorHandler(objects::RAD_SENSOR, objects::SPI_COM_IF,
|
|
||||||
spiCookieRadSensor, gpioComIF);
|
|
||||||
static_cast<void>(radSensor);
|
|
||||||
// The radiation sensor ADC is powered by the 5V stack connector which should always be on
|
|
||||||
radSensor->setStartUpImmediately();
|
|
||||||
// It's a simple sensor, so just to to normal mode immediately
|
|
||||||
radSensor->setToGoToNormalModeImmediately();
|
|
||||||
#if OBSW_DEBUG_RAD_SENSOR == 1
|
|
||||||
radSensor->enablePeriodicDataPrint(true);
|
|
||||||
#endif
|
|
||||||
}
|
|
||||||
|
|
||||||
void ObjectFactory::createAcsBoardComponents(LinuxLibgpioIF* gpioComIF, UartComIF* uartComIF,
|
|
||||||
PowerSwitchIF* pwrSwitcher) {
|
|
||||||
using namespace gpio;
|
|
||||||
GpioCookie* gpioCookieAcsBoard = new GpioCookie();
|
|
||||||
|
|
||||||
std::stringstream consumer;
|
|
||||||
GpiodRegularByLineName* gpio = nullptr;
|
|
||||||
consumer << "0x" << std::hex << objects::GYRO_0_ADIS_HANDLER;
|
|
||||||
gpio = new GpiodRegularByLineName(q7s::gpioNames::GYRO_0_ADIS_CS, consumer.str(), Direction::OUT,
|
|
||||||
Levels::HIGH);
|
|
||||||
gpioCookieAcsBoard->addGpio(gpioIds::GYRO_0_ADIS_CS, gpio);
|
|
||||||
|
|
||||||
consumer.str("");
|
|
||||||
consumer << "0x" << std::hex << objects::GYRO_1_L3G_HANDLER;
|
|
||||||
gpio = new GpiodRegularByLineName(q7s::gpioNames::GYRO_1_L3G_CS, consumer.str(), Direction::OUT,
|
|
||||||
Levels::HIGH);
|
|
||||||
gpioCookieAcsBoard->addGpio(gpioIds::GYRO_1_L3G_CS, gpio);
|
|
||||||
|
|
||||||
consumer.str("");
|
|
||||||
consumer << "0x" << std::hex << objects::GYRO_2_ADIS_HANDLER;
|
|
||||||
gpio = new GpiodRegularByLineName(q7s::gpioNames::GYRO_2_ADIS_CS, consumer.str(), Direction::OUT,
|
|
||||||
Levels::HIGH);
|
|
||||||
gpioCookieAcsBoard->addGpio(gpioIds::GYRO_2_ADIS_CS, gpio);
|
|
||||||
|
|
||||||
consumer.str("");
|
|
||||||
consumer << "0x" << std::hex << objects::GYRO_3_L3G_HANDLER;
|
|
||||||
gpio = new GpiodRegularByLineName(q7s::gpioNames::GYRO_3_L3G_CS, consumer.str(), Direction::OUT,
|
|
||||||
Levels::HIGH);
|
|
||||||
gpioCookieAcsBoard->addGpio(gpioIds::GYRO_3_L3G_CS, gpio);
|
|
||||||
|
|
||||||
consumer.str("");
|
|
||||||
consumer << "0x" << std::hex << objects::MGM_0_LIS3_HANDLER;
|
|
||||||
gpio = new GpiodRegularByLineName(q7s::gpioNames::MGM_0_CS, consumer.str(), Direction::OUT,
|
|
||||||
Levels::HIGH);
|
|
||||||
gpioCookieAcsBoard->addGpio(gpioIds::MGM_0_LIS3_CS, gpio);
|
|
||||||
|
|
||||||
consumer.str("");
|
|
||||||
consumer << "0x" << std::hex << objects::MGM_1_RM3100_HANDLER;
|
|
||||||
gpio = new GpiodRegularByLineName(q7s::gpioNames::MGM_1_CS, consumer.str(), Direction::OUT,
|
|
||||||
Levels::HIGH);
|
|
||||||
gpioCookieAcsBoard->addGpio(gpioIds::MGM_1_RM3100_CS, gpio);
|
|
||||||
|
|
||||||
consumer.str("");
|
|
||||||
consumer << "0x" << std::hex << objects::MGM_2_LIS3_HANDLER;
|
|
||||||
gpio = new GpiodRegularByLineName(q7s::gpioNames::MGM_2_CS, consumer.str(), Direction::OUT,
|
|
||||||
Levels::HIGH);
|
|
||||||
gpioCookieAcsBoard->addGpio(gpioIds::MGM_2_LIS3_CS, gpio);
|
|
||||||
|
|
||||||
consumer.str("");
|
|
||||||
consumer << "0x" << std::hex << objects::MGM_3_RM3100_HANDLER;
|
|
||||||
gpio = new GpiodRegularByLineName(q7s::gpioNames::MGM_3_CS, consumer.str(), Direction::OUT,
|
|
||||||
Levels::HIGH);
|
|
||||||
gpioCookieAcsBoard->addGpio(gpioIds::MGM_3_RM3100_CS, gpio);
|
|
||||||
|
|
||||||
consumer.str("");
|
|
||||||
consumer << "0x" << std::hex << objects::GPS_CONTROLLER;
|
|
||||||
// GNSS reset pins are active low
|
|
||||||
gpio = new GpiodRegularByLineName(q7s::gpioNames::RESET_GNSS_0, consumer.str(), Direction::OUT,
|
|
||||||
Levels::HIGH);
|
|
||||||
gpioCookieAcsBoard->addGpio(gpioIds::GNSS_0_NRESET, gpio);
|
|
||||||
|
|
||||||
consumer.str("");
|
|
||||||
consumer << "0x" << std::hex << objects::GPS_CONTROLLER;
|
|
||||||
gpio = new GpiodRegularByLineName(q7s::gpioNames::RESET_GNSS_1, consumer.str(), Direction::OUT,
|
|
||||||
Levels::HIGH);
|
|
||||||
gpioCookieAcsBoard->addGpio(gpioIds::GNSS_1_NRESET, gpio);
|
|
||||||
|
|
||||||
consumer.str("");
|
|
||||||
consumer << "0x" << std::hex << objects::GYRO_0_ADIS_HANDLER;
|
|
||||||
// Enable pins must be pulled low for regular operations
|
|
||||||
gpio = new GpiodRegularByLineName(q7s::gpioNames::GYRO_0_ENABLE, consumer.str(), Direction::OUT,
|
|
||||||
Levels::LOW);
|
|
||||||
gpioCookieAcsBoard->addGpio(gpioIds::GYRO_0_ENABLE, gpio);
|
|
||||||
|
|
||||||
consumer.str("");
|
|
||||||
consumer << "0x" << std::hex << objects::GYRO_2_ADIS_HANDLER;
|
|
||||||
gpio = new GpiodRegularByLineName(q7s::gpioNames::GYRO_2_ENABLE, consumer.str(), Direction::OUT,
|
|
||||||
Levels::LOW);
|
|
||||||
gpioCookieAcsBoard->addGpio(gpioIds::GYRO_2_ENABLE, gpio);
|
|
||||||
|
|
||||||
// Enable pins for GNSS
|
|
||||||
consumer.str("");
|
|
||||||
consumer << "0x" << std::hex << objects::GPS_CONTROLLER;
|
|
||||||
gpio = new GpiodRegularByLineName(q7s::gpioNames::GNSS_0_ENABLE, consumer.str(), Direction::OUT,
|
|
||||||
Levels::LOW);
|
|
||||||
gpioCookieAcsBoard->addGpio(gpioIds::GNSS_0_ENABLE, gpio);
|
|
||||||
|
|
||||||
consumer.str("");
|
|
||||||
consumer << "0x" << std::hex << objects::GPS_CONTROLLER;
|
|
||||||
gpio = new GpiodRegularByLineName(q7s::gpioNames::GNSS_1_ENABLE, consumer.str(), Direction::OUT,
|
|
||||||
Levels::LOW);
|
|
||||||
gpioCookieAcsBoard->addGpio(gpioIds::GNSS_1_ENABLE, gpio);
|
|
||||||
|
|
||||||
// Select pin. 0 for GPS side A, 1 for GPS side B
|
|
||||||
consumer.str("");
|
|
||||||
consumer << "0x" << std::hex << objects::GPS_CONTROLLER;
|
|
||||||
gpio = new GpiodRegularByLineName(q7s::gpioNames::GNSS_SELECT, consumer.str(), Direction::OUT,
|
|
||||||
Levels::LOW);
|
|
||||||
gpioCookieAcsBoard->addGpio(gpioIds::GNSS_SELECT, gpio);
|
|
||||||
gpioComIF->addGpios(gpioCookieAcsBoard);
|
|
||||||
AcsBoardFdir* fdir = nullptr;
|
|
||||||
static_cast<void>(fdir);
|
|
||||||
|
|
||||||
#if OBSW_ADD_ACS_HANDLERS == 1
|
|
||||||
std::string spiDev = q7s::SPI_DEFAULT_DEV;
|
|
||||||
SpiCookie* spiCookie =
|
|
||||||
new SpiCookie(addresses::MGM_0_LIS3, gpioIds::MGM_0_LIS3_CS, spiDev,
|
|
||||||
MGMLIS3MDL::MAX_BUFFER_SIZE, spi::DEFAULT_LIS3_MODE, spi::DEFAULT_LIS3_SPEED);
|
|
||||||
auto mgmLis3Handler = new MgmLIS3MDLHandler(objects::MGM_0_LIS3_HANDLER, objects::SPI_COM_IF,
|
|
||||||
spiCookie, spi::LIS3_TRANSITION_DELAY);
|
|
||||||
fdir = new AcsBoardFdir(objects::MGM_0_LIS3_HANDLER);
|
|
||||||
mgmLis3Handler->setCustomFdir(fdir);
|
|
||||||
static_cast<void>(mgmLis3Handler);
|
|
||||||
#if OBSW_TEST_ACS == 1
|
|
||||||
mgmLis3Handler->setStartUpImmediately();
|
|
||||||
mgmLis3Handler->setToGoToNormalMode(true);
|
|
||||||
#endif
|
|
||||||
#if OBSW_DEBUG_ACS == 1
|
|
||||||
mgmLis3Handler->enablePeriodicPrintouts(true, 10);
|
|
||||||
#endif
|
|
||||||
spiCookie =
|
|
||||||
new SpiCookie(addresses::MGM_1_RM3100, gpioIds::MGM_1_RM3100_CS, spiDev,
|
|
||||||
RM3100::MAX_BUFFER_SIZE, spi::DEFAULT_RM3100_MODE, spi::DEFAULT_RM3100_SPEED);
|
|
||||||
auto mgmRm3100Handler = new MgmRM3100Handler(objects::MGM_1_RM3100_HANDLER, objects::SPI_COM_IF,
|
|
||||||
spiCookie, spi::RM3100_TRANSITION_DELAY);
|
|
||||||
fdir = new AcsBoardFdir(objects::MGM_1_RM3100_HANDLER);
|
|
||||||
mgmRm3100Handler->setCustomFdir(fdir);
|
|
||||||
mgmRm3100Handler->setParent(objects::ACS_BOARD_ASS);
|
|
||||||
static_cast<void>(mgmRm3100Handler);
|
|
||||||
#if OBSW_TEST_ACS == 1
|
|
||||||
mgmRm3100Handler->setStartUpImmediately();
|
|
||||||
mgmRm3100Handler->setToGoToNormalMode(true);
|
|
||||||
#endif
|
|
||||||
#if OBSW_DEBUG_ACS == 1
|
|
||||||
mgmRm3100Handler->enablePeriodicPrintouts(true, 10);
|
|
||||||
#endif
|
|
||||||
spiCookie =
|
|
||||||
new SpiCookie(addresses::MGM_2_LIS3, gpioIds::MGM_2_LIS3_CS, spiDev,
|
|
||||||
MGMLIS3MDL::MAX_BUFFER_SIZE, spi::DEFAULT_LIS3_MODE, spi::DEFAULT_LIS3_SPEED);
|
|
||||||
mgmLis3Handler = new MgmLIS3MDLHandler(objects::MGM_2_LIS3_HANDLER, objects::SPI_COM_IF,
|
|
||||||
spiCookie, spi::LIS3_TRANSITION_DELAY);
|
|
||||||
fdir = new AcsBoardFdir(objects::MGM_2_LIS3_HANDLER);
|
|
||||||
mgmLis3Handler->setCustomFdir(fdir);
|
|
||||||
mgmLis3Handler->setParent(objects::ACS_BOARD_ASS);
|
|
||||||
static_cast<void>(mgmLis3Handler);
|
|
||||||
#if OBSW_TEST_ACS == 1
|
|
||||||
mgmLis3Handler->setStartUpImmediately();
|
|
||||||
mgmLis3Handler->setToGoToNormalMode(true);
|
|
||||||
#endif
|
|
||||||
#if OBSW_DEBUG_ACS == 1
|
|
||||||
mgmLis3Handler->enablePeriodicPrintouts(true, 10);
|
|
||||||
#endif
|
|
||||||
spiCookie =
|
|
||||||
new SpiCookie(addresses::MGM_3_RM3100, gpioIds::MGM_3_RM3100_CS, spiDev,
|
|
||||||
RM3100::MAX_BUFFER_SIZE, spi::DEFAULT_RM3100_MODE, spi::DEFAULT_RM3100_SPEED);
|
|
||||||
mgmRm3100Handler = new MgmRM3100Handler(objects::MGM_3_RM3100_HANDLER, objects::SPI_COM_IF,
|
|
||||||
spiCookie, spi::RM3100_TRANSITION_DELAY);
|
|
||||||
fdir = new AcsBoardFdir(objects::MGM_3_RM3100_HANDLER);
|
|
||||||
mgmRm3100Handler->setCustomFdir(fdir);
|
|
||||||
mgmRm3100Handler->setParent(objects::ACS_BOARD_ASS);
|
|
||||||
#if OBSW_TEST_ACS == 1
|
|
||||||
mgmRm3100Handler->setStartUpImmediately();
|
|
||||||
mgmRm3100Handler->setToGoToNormalMode(true);
|
|
||||||
#endif
|
|
||||||
#if OBSW_DEBUG_ACS == 1
|
|
||||||
mgmRm3100Handler->enablePeriodicPrintouts(true, 10);
|
|
||||||
#endif
|
|
||||||
// Commented until ACS board V2 in in clean room again
|
|
||||||
// Gyro 0 Side A
|
|
||||||
spiCookie = new SpiCookie(addresses::GYRO_0_ADIS, gpioIds::GYRO_0_ADIS_CS, spiDev,
|
|
||||||
ADIS1650X::MAXIMUM_REPLY_SIZE, spi::DEFAULT_ADIS16507_MODE,
|
|
||||||
spi::DEFAULT_ADIS16507_SPEED);
|
|
||||||
auto adisHandler = new GyroADIS1650XHandler(objects::GYRO_0_ADIS_HANDLER, objects::SPI_COM_IF,
|
|
||||||
spiCookie, ADIS1650X::Type::ADIS16505);
|
|
||||||
fdir = new AcsBoardFdir(objects::GYRO_0_ADIS_HANDLER);
|
|
||||||
adisHandler->setCustomFdir(fdir);
|
|
||||||
adisHandler->setParent(objects::ACS_BOARD_ASS);
|
|
||||||
static_cast<void>(adisHandler);
|
|
||||||
#if OBSW_TEST_ACS == 1
|
|
||||||
adisHandler->setStartUpImmediately();
|
|
||||||
adisHandler->setToGoToNormalModeImmediately();
|
|
||||||
#endif
|
|
||||||
#if OBSW_DEBUG_ACS == 1
|
|
||||||
adisHandler->enablePeriodicPrintouts(true, 10);
|
|
||||||
#endif
|
|
||||||
// Gyro 1 Side A
|
|
||||||
spiCookie =
|
|
||||||
new SpiCookie(addresses::GYRO_1_L3G, gpioIds::GYRO_1_L3G_CS, spiDev, L3GD20H::MAX_BUFFER_SIZE,
|
|
||||||
spi::DEFAULT_L3G_MODE, spi::DEFAULT_L3G_SPEED);
|
|
||||||
auto gyroL3gHandler = new GyroHandlerL3GD20H(objects::GYRO_1_L3G_HANDLER, objects::SPI_COM_IF,
|
|
||||||
spiCookie, spi::L3G_TRANSITION_DELAY);
|
|
||||||
fdir = new AcsBoardFdir(objects::GYRO_1_L3G_HANDLER);
|
|
||||||
gyroL3gHandler->setCustomFdir(fdir);
|
|
||||||
gyroL3gHandler->setParent(objects::ACS_BOARD_ASS);
|
|
||||||
static_cast<void>(gyroL3gHandler);
|
|
||||||
#if OBSW_TEST_ACS == 1
|
|
||||||
gyroL3gHandler->setStartUpImmediately();
|
|
||||||
gyroL3gHandler->setToGoToNormalMode(true);
|
|
||||||
#endif
|
|
||||||
#if OBSW_DEBUG_ACS == 1
|
|
||||||
gyroL3gHandler->enablePeriodicPrintouts(true, 10);
|
|
||||||
#endif
|
|
||||||
// Gyro 2 Side B
|
|
||||||
spiCookie = new SpiCookie(addresses::GYRO_2_ADIS, gpioIds::GYRO_2_ADIS_CS, spiDev,
|
|
||||||
ADIS1650X::MAXIMUM_REPLY_SIZE, spi::DEFAULT_ADIS16507_MODE,
|
|
||||||
spi::DEFAULT_ADIS16507_SPEED);
|
|
||||||
adisHandler = new GyroADIS1650XHandler(objects::GYRO_2_ADIS_HANDLER, objects::SPI_COM_IF,
|
|
||||||
spiCookie, ADIS1650X::Type::ADIS16505);
|
|
||||||
fdir = new AcsBoardFdir(objects::GYRO_2_ADIS_HANDLER);
|
|
||||||
adisHandler->setCustomFdir(fdir);
|
|
||||||
adisHandler->setParent(objects::ACS_BOARD_ASS);
|
|
||||||
#if OBSW_TEST_ACS == 1
|
|
||||||
adisHandler->setStartUpImmediately();
|
|
||||||
adisHandler->setToGoToNormalModeImmediately();
|
|
||||||
#endif
|
|
||||||
// Gyro 3 Side B
|
|
||||||
spiCookie =
|
|
||||||
new SpiCookie(addresses::GYRO_3_L3G, gpioIds::GYRO_3_L3G_CS, spiDev, L3GD20H::MAX_BUFFER_SIZE,
|
|
||||||
spi::DEFAULT_L3G_MODE, spi::DEFAULT_L3G_SPEED);
|
|
||||||
gyroL3gHandler = new GyroHandlerL3GD20H(objects::GYRO_3_L3G_HANDLER, objects::SPI_COM_IF,
|
|
||||||
spiCookie, spi::L3G_TRANSITION_DELAY);
|
|
||||||
fdir = new AcsBoardFdir(objects::GYRO_3_L3G_HANDLER);
|
|
||||||
gyroL3gHandler->setCustomFdir(fdir);
|
|
||||||
gyroL3gHandler->setParent(objects::ACS_BOARD_ASS);
|
|
||||||
#if OBSW_TEST_ACS == 1
|
|
||||||
gyroL3gHandler->setStartUpImmediately();
|
|
||||||
gyroL3gHandler->setToGoToNormalMode(true);
|
|
||||||
#endif
|
|
||||||
#if OBSW_DEBUG_ACS == 1
|
|
||||||
gyroL3gHandler->enablePeriodicPrintouts(true, 10);
|
|
||||||
#endif
|
|
||||||
bool debugGps = false;
|
|
||||||
#if OBSW_DEBUG_GPS == 1
|
|
||||||
debugGps = true;
|
|
||||||
#endif
|
|
||||||
resetArgsGnss1.gnss1 = true;
|
|
||||||
resetArgsGnss1.gpioComIF = gpioComIF;
|
|
||||||
resetArgsGnss1.waitPeriodMs = 100;
|
|
||||||
resetArgsGnss0.gnss1 = false;
|
|
||||||
resetArgsGnss0.gpioComIF = gpioComIF;
|
|
||||||
resetArgsGnss0.waitPeriodMs = 100;
|
|
||||||
auto gpsHandler0 =
|
|
||||||
new GPSHyperionLinuxController(objects::GPS_CONTROLLER, objects::NO_OBJECT, debugGps);
|
|
||||||
gpsHandler0->setResetPinTriggerFunction(gps::triggerGpioResetPin, &resetArgsGnss0);
|
|
||||||
|
|
||||||
AcsBoardHelper acsBoardHelper = AcsBoardHelper(
|
|
||||||
objects::MGM_0_LIS3_HANDLER, objects::MGM_1_RM3100_HANDLER, objects::MGM_2_LIS3_HANDLER,
|
|
||||||
objects::MGM_3_RM3100_HANDLER, objects::GYRO_0_ADIS_HANDLER, objects::GYRO_1_L3G_HANDLER,
|
|
||||||
objects::GYRO_2_ADIS_HANDLER, objects::GYRO_3_L3G_HANDLER, objects::GPS_CONTROLLER);
|
|
||||||
auto acsAss = new AcsBoardAssembly(objects::ACS_BOARD_ASS, objects::NO_OBJECT, pwrSwitcher,
|
|
||||||
acsBoardHelper, gpioComIF);
|
|
||||||
static_cast<void>(acsAss);
|
|
||||||
#endif /* OBSW_ADD_ACS_HANDLERS == 1 */
|
|
||||||
}
|
|
||||||
|
|
||||||
void ObjectFactory::createHeaterComponents() {
|
|
||||||
using namespace gpio;
|
|
||||||
GpioCookie* heaterGpiosCookie = new GpioCookie;
|
|
||||||
GpiodRegularByLineName* gpio = nullptr;
|
|
||||||
|
|
||||||
std::stringstream consumer;
|
|
||||||
consumer << "0x" << std::hex << objects::HEATER_HANDLER;
|
|
||||||
/* Pin H2-11 on stack connector */
|
|
||||||
gpio = new GpiodRegularByLineName(q7s::gpioNames::HEATER_0, consumer.str(), Direction::OUT,
|
|
||||||
Levels::LOW);
|
|
||||||
heaterGpiosCookie->addGpio(gpioIds::HEATER_0, gpio);
|
|
||||||
/* Pin H2-12 on stack connector */
|
|
||||||
gpio = new GpiodRegularByLineName(q7s::gpioNames::HEATER_1, consumer.str(), Direction::OUT,
|
|
||||||
Levels::LOW);
|
|
||||||
heaterGpiosCookie->addGpio(gpioIds::HEATER_1, gpio);
|
|
||||||
|
|
||||||
/* Pin H2-13 on stack connector */
|
|
||||||
gpio = new GpiodRegularByLineName(q7s::gpioNames::HEATER_2, consumer.str(), Direction::OUT,
|
|
||||||
Levels::LOW);
|
|
||||||
heaterGpiosCookie->addGpio(gpioIds::HEATER_2, gpio);
|
|
||||||
|
|
||||||
gpio = new GpiodRegularByLineName(q7s::gpioNames::HEATER_3, consumer.str(), Direction::OUT,
|
|
||||||
Levels::LOW);
|
|
||||||
heaterGpiosCookie->addGpio(gpioIds::HEATER_3, gpio);
|
|
||||||
|
|
||||||
gpio = new GpiodRegularByLineName(q7s::gpioNames::HEATER_4, consumer.str(), Direction::OUT,
|
|
||||||
Levels::LOW);
|
|
||||||
heaterGpiosCookie->addGpio(gpioIds::HEATER_4, gpio);
|
|
||||||
|
|
||||||
gpio = new GpiodRegularByLineName(q7s::gpioNames::HEATER_5, consumer.str(), Direction::OUT,
|
|
||||||
Levels::LOW);
|
|
||||||
heaterGpiosCookie->addGpio(gpioIds::HEATER_5, gpio);
|
|
||||||
|
|
||||||
gpio = new GpiodRegularByLineName(q7s::gpioNames::HEATER_6, consumer.str(), Direction::OUT,
|
|
||||||
Levels::LOW);
|
|
||||||
heaterGpiosCookie->addGpio(gpioIds::HEATER_6, gpio);
|
|
||||||
|
|
||||||
gpio = new GpiodRegularByLineName(q7s::gpioNames::HEATER_7, consumer.str(), Direction::OUT,
|
|
||||||
Levels::LOW);
|
|
||||||
heaterGpiosCookie->addGpio(gpioIds::HEATER_7, gpio);
|
|
||||||
|
|
||||||
new HeaterHandler(objects::HEATER_HANDLER, objects::GPIO_IF, heaterGpiosCookie,
|
|
||||||
objects::PCDU_HANDLER, pcdu::Switches::PDU2_CH3_TCS_BOARD_HEATER_IN_8V);
|
|
||||||
}
|
|
||||||
|
|
||||||
void ObjectFactory::createSolarArrayDeploymentComponents() {
|
|
||||||
using namespace gpio;
|
|
||||||
GpioCookie* solarArrayDeplCookie = new GpioCookie;
|
|
||||||
GpiodRegularByLineName* gpio = nullptr;
|
|
||||||
|
|
||||||
std::stringstream consumer;
|
|
||||||
consumer << "0x" << std::hex << objects::SOLAR_ARRAY_DEPL_HANDLER;
|
|
||||||
gpio = new GpiodRegularByLineName(q7s::gpioNames::SA_DPL_PIN_0, consumer.str(), Direction::OUT,
|
|
||||||
Levels::LOW);
|
|
||||||
solarArrayDeplCookie->addGpio(gpioIds::DEPLSA1, gpio);
|
|
||||||
gpio = new GpiodRegularByLineName(q7s::gpioNames::SA_DPL_PIN_1, consumer.str(), Direction::OUT,
|
|
||||||
Levels::LOW);
|
|
||||||
solarArrayDeplCookie->addGpio(gpioIds::DEPLSA2, gpio);
|
|
||||||
|
|
||||||
// TODO: Find out burn time. For now set to 1000 ms.
|
|
||||||
new SolarArrayDeploymentHandler(objects::SOLAR_ARRAY_DEPL_HANDLER, objects::GPIO_IF,
|
|
||||||
solarArrayDeplCookie, objects::PCDU_HANDLER,
|
|
||||||
pcdu::Switches::PDU2_CH5_DEPLOYMENT_MECHANISM_8V,
|
|
||||||
gpioIds::DEPLSA1, gpioIds::DEPLSA2, 1000);
|
|
||||||
}
|
|
||||||
|
|
||||||
void ObjectFactory::createSyrlinksComponents(PowerSwitchIF* pwrSwitcher) {
|
|
||||||
UartCookie* syrlinksUartCookie =
|
|
||||||
new UartCookie(objects::SYRLINKS_HK_HANDLER, q7s::UART_SYRLINKS_DEV, uart::SYRLINKS_BAUD,
|
|
||||||
syrlinks::MAX_REPLY_SIZE, UartModes::NON_CANONICAL);
|
|
||||||
syrlinksUartCookie->setParityEven();
|
|
||||||
|
|
||||||
auto syrlinksFdir = new SyrlinksFdir(objects::SYRLINKS_HK_HANDLER);
|
|
||||||
auto syrlinksHandler =
|
|
||||||
new SyrlinksHkHandler(objects::SYRLINKS_HK_HANDLER, objects::UART_COM_IF, syrlinksUartCookie,
|
|
||||||
pcdu::PDU1_CH1_SYRLINKS_12V, syrlinksFdir);
|
|
||||||
syrlinksHandler->setPowerSwitcher(pwrSwitcher);
|
|
||||||
#if OBSW_DEBUG_SYRLINKS == 1
|
|
||||||
syrlinksHandler->setDebugMode(true);
|
|
||||||
#endif
|
|
||||||
}
|
|
||||||
|
|
||||||
void ObjectFactory::createPayloadComponents(LinuxLibgpioIF* gpioComIF) {
|
|
||||||
using namespace gpio;
|
|
||||||
std::stringstream consumer;
|
|
||||||
#if OBSW_ADD_PLOC_MPSOC == 1
|
|
||||||
consumer << "0x" << std::hex << objects::PLOC_MPSOC_HANDLER;
|
|
||||||
auto gpioConfigMPSoC = new GpiodRegularByLineName(q7s::gpioNames::ENABLE_MPSOC_UART,
|
|
||||||
consumer.str(), Direction::OUT, Levels::HIGH);
|
|
||||||
auto mpsocGpioCookie = new GpioCookie;
|
|
||||||
mpsocGpioCookie->addGpio(gpioIds::ENABLE_MPSOC_UART, gpioConfigMPSoC);
|
|
||||||
gpioComIF->addGpios(mpsocGpioCookie);
|
|
||||||
auto mpsocCookie =
|
|
||||||
new UartCookie(objects::PLOC_MPSOC_HANDLER, q7s::UART_PLOC_MPSOC_DEV, uart::PLOC_MPSOC_BAUD,
|
|
||||||
mpsoc::MAX_REPLY_SIZE, UartModes::NON_CANONICAL);
|
|
||||||
mpsocCookie->setNoFixedSizeReply();
|
|
||||||
auto plocMpsocHelper = new PlocMPSoCHelper(objects::PLOC_MPSOC_HELPER);
|
|
||||||
new PlocMPSoCHandler(objects::PLOC_MPSOC_HANDLER, objects::UART_COM_IF, mpsocCookie,
|
|
||||||
plocMpsocHelper, Gpio(gpioIds::ENABLE_MPSOC_UART, gpioComIF),
|
|
||||||
objects::PLOC_SUPERVISOR_HANDLER);
|
|
||||||
#endif /* OBSW_ADD_PLOC_MPSOC == 1 */
|
|
||||||
#if OBSW_ADD_PLOC_SUPERVISOR == 1
|
|
||||||
consumer << "0x" << std::hex << objects::PLOC_SUPERVISOR_HANDLER;
|
|
||||||
auto gpioConfigSupv = new GpiodRegularByLineName(q7s::gpioNames::ENABLE_SUPV_UART, consumer.str(),
|
|
||||||
Direction::OUT, Levels::HIGH);
|
|
||||||
auto supvGpioCookie = new GpioCookie;
|
|
||||||
supvGpioCookie->addGpio(gpioIds::ENABLE_SUPV_UART, gpioConfigSupv);
|
|
||||||
gpioComIF->addGpios(supvGpioCookie);
|
|
||||||
auto supervisorCookie = new UartCookie(objects::PLOC_SUPERVISOR_HANDLER,
|
|
||||||
q7s::UART_PLOC_SUPERVSIOR_DEV, uart::PLOC_SUPERVISOR_BAUD,
|
|
||||||
supv::MAX_PACKET_SIZE * 20, UartModes::NON_CANONICAL);
|
|
||||||
supervisorCookie->setNoFixedSizeReply();
|
|
||||||
new PlocSupervisorHandler(objects::PLOC_SUPERVISOR_HANDLER, objects::UART_COM_IF,
|
|
||||||
supervisorCookie, Gpio(gpioIds::ENABLE_SUPV_UART, gpioComIF),
|
|
||||||
pcdu::PDU1_CH6_PLOC_12V);
|
|
||||||
#endif /* OBSW_ADD_PLOC_SUPERVISOR == 1 */
|
|
||||||
static_cast<void>(consumer);
|
|
||||||
}
|
|
||||||
|
|
||||||
void ObjectFactory::createReactionWheelComponents(LinuxLibgpioIF* gpioComIF) {
|
|
||||||
using namespace gpio;
|
|
||||||
GpioCookie* gpioCookieRw = new GpioCookie;
|
|
||||||
GpioCallback* csRw1 =
|
|
||||||
new GpioCallback("Chip select reaction wheel 1", Direction::OUT, Levels::HIGH,
|
|
||||||
&gpioCallbacks::spiCsDecoderCallback, gpioComIF);
|
|
||||||
gpioCookieRw->addGpio(gpioIds::CS_RW1, csRw1);
|
|
||||||
GpioCallback* csRw2 =
|
|
||||||
new GpioCallback("Chip select reaction wheel 2", Direction::OUT, Levels::HIGH,
|
|
||||||
&gpioCallbacks::spiCsDecoderCallback, gpioComIF);
|
|
||||||
gpioCookieRw->addGpio(gpioIds::CS_RW2, csRw2);
|
|
||||||
GpioCallback* csRw3 =
|
|
||||||
new GpioCallback("Chip select reaction wheel 3", Direction::OUT, Levels::HIGH,
|
|
||||||
&gpioCallbacks::spiCsDecoderCallback, gpioComIF);
|
|
||||||
gpioCookieRw->addGpio(gpioIds::CS_RW3, csRw3);
|
|
||||||
GpioCallback* csRw4 =
|
|
||||||
new GpioCallback("Chip select reaction wheel 4", Direction::OUT, Levels::HIGH,
|
|
||||||
&gpioCallbacks::spiCsDecoderCallback, gpioComIF);
|
|
||||||
gpioCookieRw->addGpio(gpioIds::CS_RW4, csRw4);
|
|
||||||
|
|
||||||
std::stringstream consumer;
|
|
||||||
GpiodRegularByLineName* gpio = nullptr;
|
|
||||||
consumer << "0x" << std::hex << objects::RW1;
|
|
||||||
gpio = new GpiodRegularByLineName(q7s::gpioNames::EN_RW_1, consumer.str(), Direction::OUT,
|
|
||||||
Levels::LOW);
|
|
||||||
gpioCookieRw->addGpio(gpioIds::EN_RW1, gpio);
|
|
||||||
consumer.str("");
|
|
||||||
consumer << "0x" << std::hex << objects::RW2;
|
|
||||||
gpio = new GpiodRegularByLineName(q7s::gpioNames::EN_RW_2, consumer.str(), Direction::OUT,
|
|
||||||
Levels::LOW);
|
|
||||||
gpioCookieRw->addGpio(gpioIds::EN_RW2, gpio);
|
|
||||||
consumer.str("");
|
|
||||||
consumer << "0x" << std::hex << objects::RW3;
|
|
||||||
gpio = new GpiodRegularByLineName(q7s::gpioNames::EN_RW_3, consumer.str(), Direction::OUT,
|
|
||||||
Levels::LOW);
|
|
||||||
gpioCookieRw->addGpio(gpioIds::EN_RW3, gpio);
|
|
||||||
consumer.str("");
|
|
||||||
consumer << "0x" << std::hex << objects::RW4;
|
|
||||||
gpio = new GpiodRegularByLineName(q7s::gpioNames::EN_RW_4, consumer.str(), Direction::OUT,
|
|
||||||
Levels::LOW);
|
|
||||||
gpioCookieRw->addGpio(gpioIds::EN_RW4, gpio);
|
|
||||||
|
|
||||||
gpioComIF->addGpios(gpioCookieRw);
|
|
||||||
|
|
||||||
#if OBSW_ADD_RW == 1
|
|
||||||
auto rw1SpiCookie =
|
|
||||||
new SpiCookie(addresses::RW1, gpioIds::CS_RW1, q7s::SPI_RW_DEV, RwDefinitions::MAX_REPLY_SIZE,
|
|
||||||
spi::RW_MODE, spi::RW_SPEED, &rwSpiCallback::spiCallback, nullptr);
|
|
||||||
auto rw2SpiCookie =
|
|
||||||
new SpiCookie(addresses::RW2, gpioIds::CS_RW2, q7s::SPI_RW_DEV, RwDefinitions::MAX_REPLY_SIZE,
|
|
||||||
spi::RW_MODE, spi::RW_SPEED, &rwSpiCallback::spiCallback, nullptr);
|
|
||||||
auto rw3SpiCookie =
|
|
||||||
new SpiCookie(addresses::RW3, gpioIds::CS_RW3, q7s::SPI_RW_DEV, RwDefinitions::MAX_REPLY_SIZE,
|
|
||||||
spi::RW_MODE, spi::RW_SPEED, &rwSpiCallback::spiCallback, nullptr);
|
|
||||||
auto rw4SpiCookie =
|
|
||||||
new SpiCookie(addresses::RW4, gpioIds::CS_RW4, q7s::SPI_RW_DEV, RwDefinitions::MAX_REPLY_SIZE,
|
|
||||||
spi::RW_MODE, spi::RW_SPEED, &rwSpiCallback::spiCallback, nullptr);
|
|
||||||
|
|
||||||
auto rwHandler1 =
|
|
||||||
new RwHandler(objects::RW1, objects::SPI_COM_IF, rw1SpiCookie, gpioComIF, gpioIds::EN_RW1);
|
|
||||||
rw1SpiCookie->setCallbackArgs(rwHandler1);
|
|
||||||
#if OBSW_DEBUG_RW == 1
|
|
||||||
rwHandler1->setStartUpImmediately();
|
|
||||||
rwHandler1->setDebugMode(true);
|
|
||||||
#endif
|
|
||||||
auto rwHandler2 =
|
|
||||||
new RwHandler(objects::RW2, objects::SPI_COM_IF, rw2SpiCookie, gpioComIF, gpioIds::EN_RW2);
|
|
||||||
rw2SpiCookie->setCallbackArgs(rwHandler2);
|
|
||||||
#if OBSW_DEBUG_RW == 1
|
|
||||||
rwHandler2->setStartUpImmediately();
|
|
||||||
rwHandler2->setDebugMode(true);
|
|
||||||
#endif
|
|
||||||
auto rwHandler3 =
|
|
||||||
new RwHandler(objects::RW3, objects::SPI_COM_IF, rw3SpiCookie, gpioComIF, gpioIds::EN_RW3);
|
|
||||||
rw3SpiCookie->setCallbackArgs(rwHandler3);
|
|
||||||
#if OBSW_DEBUG_RW == 1
|
|
||||||
rwHandler3->setStartUpImmediately();
|
|
||||||
rwHandler3->setDebugMode(true);
|
|
||||||
#endif
|
|
||||||
auto rwHandler4 =
|
|
||||||
new RwHandler(objects::RW4, objects::SPI_COM_IF, rw4SpiCookie, gpioComIF, gpioIds::EN_RW4);
|
|
||||||
rw4SpiCookie->setCallbackArgs(rwHandler4);
|
|
||||||
#if OBSW_DEBUG_RW == 1
|
|
||||||
rwHandler4->setStartUpImmediately();
|
|
||||||
rwHandler4->setDebugMode(true);
|
|
||||||
#endif
|
|
||||||
#endif /* OBSW_ADD_RW == 1 */
|
|
||||||
}
|
|
||||||
|
|
||||||
void ObjectFactory::createCcsdsComponents(LinuxLibgpioIF* gpioComIF) {
|
|
||||||
using namespace gpio;
|
|
||||||
// GPIO definitions of signals connected to the virtual channel interfaces of the PTME IP Core
|
|
||||||
GpioCookie* gpioCookiePtmeIp = new GpioCookie;
|
|
||||||
GpiodRegularByLineName* gpio = nullptr;
|
|
||||||
std::stringstream consumer;
|
|
||||||
consumer.str("PAPB VC0");
|
|
||||||
gpio = new GpiodRegularByLineName(q7s::gpioNames::PAPB_BUSY_SIGNAL_VC0, consumer.str());
|
|
||||||
gpioCookiePtmeIp->addGpio(gpioIds::VC0_PAPB_BUSY, gpio);
|
|
||||||
consumer.str("PAPB VC0");
|
|
||||||
gpio = new GpiodRegularByLineName(q7s::gpioNames::PAPB_EMPTY_SIGNAL_VC0, consumer.str());
|
|
||||||
gpioCookiePtmeIp->addGpio(gpioIds::VC0_PAPB_EMPTY, gpio);
|
|
||||||
consumer.str("PAPB VC 1");
|
|
||||||
gpio = new GpiodRegularByLineName(q7s::gpioNames::PAPB_BUSY_SIGNAL_VC1, consumer.str());
|
|
||||||
gpioCookiePtmeIp->addGpio(gpioIds::VC1_PAPB_BUSY, gpio);
|
|
||||||
consumer.str("");
|
|
||||||
consumer.str("PAPB VC 1");
|
|
||||||
gpioCookiePtmeIp->addGpio(gpioIds::VC1_PAPB_EMPTY, gpio);
|
|
||||||
consumer.str("");
|
|
||||||
consumer.str("PAPB VC 2");
|
|
||||||
gpio = new GpiodRegularByLineName(q7s::gpioNames::PAPB_BUSY_SIGNAL_VC2, consumer.str());
|
|
||||||
gpioCookiePtmeIp->addGpio(gpioIds::VC2_PAPB_BUSY, gpio);
|
|
||||||
consumer.str("");
|
|
||||||
consumer.str("PAPB VC 2");
|
|
||||||
gpio = new GpiodRegularByLineName(q7s::gpioNames::PAPB_EMPTY_SIGNAL_VC2, consumer.str());
|
|
||||||
gpioCookiePtmeIp->addGpio(gpioIds::VC2_PAPB_EMPTY, gpio);
|
|
||||||
consumer.str("");
|
|
||||||
consumer.str("PAPB VC 3");
|
|
||||||
gpio = new GpiodRegularByLineName(q7s::gpioNames::PAPB_BUSY_SIGNAL_VC3, consumer.str());
|
|
||||||
gpioCookiePtmeIp->addGpio(gpioIds::VC3_PAPB_BUSY, gpio);
|
|
||||||
consumer.str("");
|
|
||||||
consumer.str("PAPB VC 3");
|
|
||||||
gpio = new GpiodRegularByLineName(q7s::gpioNames::PAPB_EMPTY_SIGNAL_VC3, consumer.str());
|
|
||||||
gpioCookiePtmeIp->addGpio(gpioIds::VC3_PAPB_EMPTY, gpio);
|
|
||||||
|
|
||||||
gpioComIF->addGpios(gpioCookiePtmeIp);
|
|
||||||
|
|
||||||
// Creating virtual channel interfaces
|
|
||||||
VcInterfaceIF* vc0 =
|
|
||||||
new PapbVcInterface(gpioComIF, gpioIds::VC0_PAPB_BUSY, gpioIds::VC0_PAPB_EMPTY, q7s::UIO_PTME,
|
|
||||||
q7s::uiomapids::PTME_VC0);
|
|
||||||
VcInterfaceIF* vc1 =
|
|
||||||
new PapbVcInterface(gpioComIF, gpioIds::VC1_PAPB_BUSY, gpioIds::VC1_PAPB_EMPTY, q7s::UIO_PTME,
|
|
||||||
q7s::uiomapids::PTME_VC1);
|
|
||||||
VcInterfaceIF* vc2 =
|
|
||||||
new PapbVcInterface(gpioComIF, gpioIds::VC2_PAPB_BUSY, gpioIds::VC2_PAPB_EMPTY, q7s::UIO_PTME,
|
|
||||||
q7s::uiomapids::PTME_VC2);
|
|
||||||
VcInterfaceIF* vc3 =
|
|
||||||
new PapbVcInterface(gpioComIF, gpioIds::VC3_PAPB_BUSY, gpioIds::VC3_PAPB_EMPTY, q7s::UIO_PTME,
|
|
||||||
q7s::uiomapids::PTME_VC3);
|
|
||||||
|
|
||||||
// Creating ptme object and adding virtual channel interfaces
|
|
||||||
Ptme* ptme = new Ptme(objects::PTME);
|
|
||||||
ptme->addVcInterface(ccsds::VC0, vc0);
|
|
||||||
ptme->addVcInterface(ccsds::VC1, vc1);
|
|
||||||
ptme->addVcInterface(ccsds::VC2, vc2);
|
|
||||||
ptme->addVcInterface(ccsds::VC3, vc3);
|
|
||||||
|
|
||||||
AxiPtmeConfig* axiPtmeConfig =
|
|
||||||
new AxiPtmeConfig(objects::AXI_PTME_CONFIG, q7s::UIO_PTME, q7s::uiomapids::PTME_CONFIG);
|
|
||||||
PtmeConfig* ptmeConfig = new PtmeConfig(objects::PTME_CONFIG, axiPtmeConfig);
|
|
||||||
#if OBSW_ENABLE_SYRLINKS_TRANSMIT_TIMEOUT == 1
|
|
||||||
// Set to high value when not sending via syrlinks
|
|
||||||
static const uint32_t TRANSMITTER_TIMEOUT = 86400000; // 1 day
|
|
||||||
#else
|
|
||||||
static const uint32_t TRANSMITTER_TIMEOUT = 900000; // 15 minutes
|
|
||||||
#endif
|
|
||||||
CCSDSHandler* ccsdsHandler = new CCSDSHandler(
|
|
||||||
objects::CCSDS_HANDLER, objects::PTME, objects::CCSDS_PACKET_DISTRIBUTOR, ptmeConfig,
|
|
||||||
gpioComIF, gpioIds::RS485_EN_TX_CLOCK, gpioIds::RS485_EN_TX_DATA, TRANSMITTER_TIMEOUT);
|
|
||||||
|
|
||||||
VirtualChannel* vc = nullptr;
|
|
||||||
vc = new VirtualChannel(ccsds::VC0, common::VC0_QUEUE_SIZE, objects::CCSDS_HANDLER);
|
|
||||||
ccsdsHandler->addVirtualChannel(ccsds::VC0, vc);
|
|
||||||
vc = new VirtualChannel(ccsds::VC1, common::VC1_QUEUE_SIZE, objects::CCSDS_HANDLER);
|
|
||||||
ccsdsHandler->addVirtualChannel(ccsds::VC1, vc);
|
|
||||||
vc = new VirtualChannel(ccsds::VC2, common::VC2_QUEUE_SIZE, objects::CCSDS_HANDLER);
|
|
||||||
ccsdsHandler->addVirtualChannel(ccsds::VC2, vc);
|
|
||||||
vc = new VirtualChannel(ccsds::VC3, common::VC3_QUEUE_SIZE, objects::CCSDS_HANDLER);
|
|
||||||
ccsdsHandler->addVirtualChannel(ccsds::VC3, vc);
|
|
||||||
|
|
||||||
GpioCookie* gpioCookiePdec = new GpioCookie;
|
|
||||||
consumer.str("");
|
|
||||||
consumer << "0x" << std::hex << objects::PDEC_HANDLER;
|
|
||||||
// GPIO also low after linux boot (specified by device-tree)
|
|
||||||
gpio = new GpiodRegularByLineName(q7s::gpioNames::PDEC_RESET, consumer.str(), Direction::OUT,
|
|
||||||
Levels::LOW);
|
|
||||||
gpioCookiePdec->addGpio(gpioIds::PDEC_RESET, gpio);
|
|
||||||
|
|
||||||
gpioComIF->addGpios(gpioCookiePdec);
|
|
||||||
|
|
||||||
new PdecHandler(objects::PDEC_HANDLER, objects::CCSDS_HANDLER, gpioComIF, gpioIds::PDEC_RESET,
|
|
||||||
q7s::UIO_PDEC_CONFIG_MEMORY, q7s::UIO_PDEC_RAM, q7s::UIO_PDEC_REGISTERS);
|
|
||||||
|
|
||||||
GpioCookie* gpioRS485Chip = new GpioCookie;
|
|
||||||
gpio = new GpiodRegularByLineName(q7s::gpioNames::RS485_EN_TX_CLOCK, "RS485 Transceiver",
|
|
||||||
Direction::OUT, Levels::LOW);
|
|
||||||
gpioRS485Chip->addGpio(gpioIds::RS485_EN_TX_CLOCK, gpio);
|
|
||||||
gpio = new GpiodRegularByLineName(q7s::gpioNames::RS485_EN_TX_DATA, "RS485 Transceiver",
|
|
||||||
Direction::OUT, Levels::LOW);
|
|
||||||
gpioRS485Chip->addGpio(gpioIds::RS485_EN_TX_DATA, gpio);
|
|
||||||
|
|
||||||
// Default configuration enables RX channels (RXEN = LOW)
|
|
||||||
gpio = new GpiodRegularByLineName(q7s::gpioNames::RS485_EN_RX_CLOCK, "RS485 Transceiver",
|
|
||||||
Direction::OUT, Levels::LOW);
|
|
||||||
gpioRS485Chip->addGpio(gpioIds::RS485_EN_RX_CLOCK, gpio);
|
|
||||||
gpio = new GpiodRegularByLineName(q7s::gpioNames::RS485_EN_RX_DATA, "RS485 Transceiver",
|
|
||||||
Direction::OUT, Levels::LOW);
|
|
||||||
gpioRS485Chip->addGpio(gpioIds::RS485_EN_RX_DATA, gpio);
|
|
||||||
|
|
||||||
gpioComIF->addGpios(gpioRS485Chip);
|
|
||||||
}
|
|
||||||
|
|
||||||
void ObjectFactory::createPlPcduComponents(LinuxLibgpioIF* gpioComIF, SpiComIF* spiComIF,
|
|
||||||
PowerSwitchIF* pwrSwitcher) {
|
|
||||||
using namespace gpio;
|
|
||||||
// Create all GPIO components first
|
|
||||||
GpioCookie* plPcduGpios = new GpioCookie;
|
|
||||||
GpiodRegularByLineName* gpio = nullptr;
|
|
||||||
std::string consumer;
|
|
||||||
// Switch pins are active high
|
|
||||||
consumer = "PLPCDU_ENB_VBAT_0";
|
|
||||||
gpio = new GpiodRegularByLineName(q7s::gpioNames::PL_PCDU_ENABLE_VBAT0, consumer, Direction::OUT,
|
|
||||||
gpio::Levels::LOW);
|
|
||||||
plPcduGpios->addGpio(gpioIds::PLPCDU_ENB_VBAT0, gpio);
|
|
||||||
consumer = "PLPCDU_ENB_VBAT_1";
|
|
||||||
gpio = new GpiodRegularByLineName(q7s::gpioNames::PL_PCDU_ENABLE_VBAT1, consumer, Direction::OUT,
|
|
||||||
gpio::Levels::LOW);
|
|
||||||
plPcduGpios->addGpio(gpioIds::PLPCDU_ENB_VBAT1, gpio);
|
|
||||||
consumer = "PLPCDU_ENB_DRO";
|
|
||||||
gpio = new GpiodRegularByLineName(q7s::gpioNames::PL_PCDU_ENABLE_DRO, consumer, Direction::OUT,
|
|
||||||
gpio::Levels::LOW);
|
|
||||||
plPcduGpios->addGpio(gpioIds::PLPCDU_ENB_DRO, gpio);
|
|
||||||
consumer = "PLPCDU_ENB_X8";
|
|
||||||
gpio = new GpiodRegularByLineName(q7s::gpioNames::PL_PCDU_ENABLE_X8, consumer, Direction::OUT,
|
|
||||||
gpio::Levels::LOW);
|
|
||||||
plPcduGpios->addGpio(gpioIds::PLPCDU_ENB_X8, gpio);
|
|
||||||
consumer = "PLPCDU_ENB_TX";
|
|
||||||
gpio = new GpiodRegularByLineName(q7s::gpioNames::PL_PCDU_ENABLE_TX, consumer, Direction::OUT,
|
|
||||||
gpio::Levels::LOW);
|
|
||||||
plPcduGpios->addGpio(gpioIds::PLPCDU_ENB_TX, gpio);
|
|
||||||
consumer = "PLPCDU_ENB_MPA";
|
|
||||||
gpio = new GpiodRegularByLineName(q7s::gpioNames::PL_PCDU_ENABLE_MPA, consumer, Direction::OUT,
|
|
||||||
gpio::Levels::LOW);
|
|
||||||
plPcduGpios->addGpio(gpioIds::PLPCDU_ENB_MPA, gpio);
|
|
||||||
consumer = "PLPCDU_ENB_HPA";
|
|
||||||
gpio = new GpiodRegularByLineName(q7s::gpioNames::PL_PCDU_ENABLE_HPA, consumer, Direction::OUT,
|
|
||||||
gpio::Levels::LOW);
|
|
||||||
plPcduGpios->addGpio(gpioIds::PLPCDU_ENB_HPA, gpio);
|
|
||||||
|
|
||||||
// Chip select pin is active low
|
|
||||||
consumer = "PLPCDU_ADC_CS";
|
|
||||||
gpio = new GpiodRegularByLineName(q7s::gpioNames::PL_PCDU_ADC_CS, consumer, Direction::OUT,
|
|
||||||
gpio::Levels::HIGH);
|
|
||||||
plPcduGpios->addGpio(gpioIds::PLPCDU_ADC_CS, gpio);
|
|
||||||
gpioComIF->addGpios(plPcduGpios);
|
|
||||||
SpiCookie* spiCookie = new SpiCookie(addresses::PLPCDU_ADC, gpioIds::PLPCDU_ADC_CS,
|
|
||||||
q7s::SPI_DEFAULT_DEV, plpcdu::MAX_ADC_REPLY_SIZE,
|
|
||||||
spi::DEFAULT_MAX_1227_MODE, spi::PL_PCDU_MAX_1227_SPEED);
|
|
||||||
// Create device handler components
|
|
||||||
auto plPcduHandler = new PayloadPcduHandler(
|
|
||||||
objects::PLPCDU_HANDLER, objects::SPI_COM_IF, spiCookie, gpioComIF, SdCardManager::instance(),
|
|
||||||
pwrSwitcher, pcdu::Switches::PDU2_CH1_PL_PCDU_BATT_0_14V8,
|
|
||||||
pcdu::Switches::PDU2_CH6_PL_PCDU_BATT_1_14V8, false);
|
|
||||||
spiCookie->setCallbackMode(PayloadPcduHandler::extConvAsTwoCallback, plPcduHandler);
|
|
||||||
// plPcduHandler->enablePeriodicPrintout(true, 5);
|
|
||||||
// static_cast<void>(plPcduHandler);
|
|
||||||
#if OBSW_TEST_PL_PCDU == 1
|
|
||||||
plPcduHandler->setStartUpImmediately();
|
|
||||||
#endif
|
|
||||||
#if OBSW_DEBUG_PL_PCDU == 1
|
|
||||||
plPcduHandler->setToGoToNormalModeImmediately(true);
|
|
||||||
plPcduHandler->enablePeriodicPrintout(true, 10);
|
|
||||||
#endif
|
|
||||||
}
|
|
||||||
|
|
||||||
void ObjectFactory::createTestComponents(LinuxLibgpioIF* gpioComIF) {
|
|
||||||
new Q7STestTask(objects::TEST_TASK);
|
|
||||||
#if OBSW_ADD_SPI_TEST_CODE == 1
|
|
||||||
new SpiTestClass(objects::SPI_TEST, gpioComIF);
|
|
||||||
#endif
|
|
||||||
#if OBSW_ADD_I2C_TEST_CODE == 1
|
|
||||||
new I2cTestClass(objects::I2C_TEST, q7s::I2C_DEFAULT_DEV);
|
|
||||||
#endif
|
|
||||||
#if OBSW_ADD_UART_TEST_CODE == 1
|
|
||||||
new UartTestClass(objects::UART_TEST);
|
|
||||||
#endif
|
|
||||||
}
|
|
||||||
|
|
||||||
void ObjectFactory::testAcsBrdAss(AcsBoardAssembly* acsAss) {
|
|
||||||
CommandMessage msg;
|
|
||||||
ModeMessage::setModeMessage(&msg, ModeMessage::CMD_MODE_COMMAND, DeviceHandlerIF::MODE_NORMAL,
|
|
||||||
duallane::A_SIDE);
|
|
||||||
ReturnValue_t result = MessageQueueSenderIF::sendMessage(acsAss->getCommandQueue(), &msg);
|
|
||||||
if (result != HasReturnvaluesIF::RETURN_OK) {
|
|
||||||
sif::warning << "Sending mode command failed" << std::endl;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
@ -1,3 +0,0 @@
|
|||||||
target_sources(${OBSW_NAME} PRIVATE
|
|
||||||
fmObjectFactory.cpp
|
|
||||||
)
|
|
66
bsp_q7s/fmObjectFactory.cpp
Normal file
66
bsp_q7s/fmObjectFactory.cpp
Normal file
@ -0,0 +1,66 @@
|
|||||||
|
#include "OBSWConfig.h"
|
||||||
|
#include "bsp_q7s/core/CoreController.h"
|
||||||
|
#include "bsp_q7s/core/ObjectFactory.h"
|
||||||
|
#include "busConf.h"
|
||||||
|
#include "commonObjects.h"
|
||||||
|
#include "devConf.h"
|
||||||
|
#include "fsfw_hal/linux/gpio/LinuxLibgpioIF.h"
|
||||||
|
#include "linux/ObjectFactory.h"
|
||||||
|
#include "linux/callbacks/gpioCallbacks.h"
|
||||||
|
#include "mission/core/GenericFactory.h"
|
||||||
|
|
||||||
|
void ObjectFactory::produce(void* args) {
|
||||||
|
ObjectFactory::setStatics();
|
||||||
|
HealthTableIF* healthTable = nullptr;
|
||||||
|
ObjectFactory::produceGenericObjects(&healthTable);
|
||||||
|
|
||||||
|
LinuxLibgpioIF* gpioComIF = nullptr;
|
||||||
|
UartComIF* uartComIF = nullptr;
|
||||||
|
SpiComIF* spiMainComIF = nullptr;
|
||||||
|
I2cComIF* i2cComIF = nullptr;
|
||||||
|
PowerSwitchIF* pwrSwitcher = nullptr;
|
||||||
|
SpiComIF* spiRwComIF = nullptr;
|
||||||
|
createCommunicationInterfaces(&gpioComIF, &uartComIF, &spiMainComIF, &i2cComIF, &spiRwComIF);
|
||||||
|
createTmpComponents();
|
||||||
|
new CoreController(objects::CORE_CONTROLLER);
|
||||||
|
|
||||||
|
gpioCallbacks::disableAllDecoder(gpioComIF);
|
||||||
|
createPcduComponents(gpioComIF, &pwrSwitcher);
|
||||||
|
createRadSensorComponent(gpioComIF);
|
||||||
|
createSunSensorComponents(gpioComIF, spiMainComIF, pwrSwitcher, q7s::SPI_DEFAULT_DEV);
|
||||||
|
|
||||||
|
#if OBSW_ADD_ACS_BOARD == 1
|
||||||
|
createAcsBoardComponents(gpioComIF, uartComIF, pwrSwitcher);
|
||||||
|
#endif
|
||||||
|
createHeaterComponents(gpioComIF, pwrSwitcher, healthTable);
|
||||||
|
createSolarArrayDeploymentComponents();
|
||||||
|
createPlPcduComponents(gpioComIF, spiMainComIF, pwrSwitcher);
|
||||||
|
#if OBSW_ADD_SYRLINKS == 1
|
||||||
|
createSyrlinksComponents(pwrSwitcher);
|
||||||
|
#endif /* OBSW_ADD_SYRLINKS == 1 */
|
||||||
|
createRtdComponents(q7s::SPI_DEFAULT_DEV, gpioComIF, pwrSwitcher, spiMainComIF);
|
||||||
|
createPayloadComponents(gpioComIF);
|
||||||
|
|
||||||
|
#if OBSW_ADD_MGT == 1
|
||||||
|
createImtqComponents(pwrSwitcher);
|
||||||
|
#endif
|
||||||
|
createReactionWheelComponents(gpioComIF, pwrSwitcher);
|
||||||
|
|
||||||
|
#if OBSW_ADD_BPX_BATTERY_HANDLER == 1
|
||||||
|
createBpxBatteryComponent();
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#if OBSW_ADD_STAR_TRACKER == 1
|
||||||
|
createStrComponents(pwrSwitcher);
|
||||||
|
#endif /* OBSW_ADD_STAR_TRACKER == 1 */
|
||||||
|
#if OBSW_USE_CCSDS_IP_CORE == 1
|
||||||
|
createCcsdsComponents(gpioComIF);
|
||||||
|
#endif /* OBSW_USE_CCSDS_IP_CORE == 1 */
|
||||||
|
/* Test Task */
|
||||||
|
#if OBSW_ADD_TEST_CODE == 1
|
||||||
|
createTestComponents(gpioComIF);
|
||||||
|
#endif /* OBSW_ADD_TEST_CODE == 1 */
|
||||||
|
|
||||||
|
createMiscComponents();
|
||||||
|
createThermalController();
|
||||||
|
}
|
@ -1,6 +1,2 @@
|
|||||||
target_sources(${OBSW_NAME} PRIVATE
|
target_sources(${OBSW_NAME} PRIVATE FileSystemHandler.cpp SdCardManager.cpp
|
||||||
FileSystemHandler.cpp
|
scratchApi.cpp FilesystemHelper.cpp)
|
||||||
SdCardManager.cpp
|
|
||||||
scratchApi.cpp
|
|
||||||
FilesystemHelper.cpp
|
|
||||||
)
|
|
||||||
|
@ -70,9 +70,8 @@ void FileSystemHandler::fileSystemHandlerLoop() {
|
|||||||
|
|
||||||
void FileSystemHandler::fileSystemCheckup() {
|
void FileSystemHandler::fileSystemCheckup() {
|
||||||
SdCardManager::SdStatePair statusPair;
|
SdCardManager::SdStatePair statusPair;
|
||||||
sdcMan->getSdCardActiveStatus(statusPair);
|
sdcMan->getSdCardsStatus(statusPair);
|
||||||
sd::SdCard preferredSdCard;
|
sd::SdCard preferredSdCard = sdcMan->getPreferredSdCard();
|
||||||
sdcMan->getPreferredSdCard(preferredSdCard);
|
|
||||||
if ((preferredSdCard == sd::SdCard::SLOT_0) and (statusPair.first == sd::SdState::MOUNTED)) {
|
if ((preferredSdCard == sd::SdCard::SLOT_0) and (statusPair.first == sd::SdState::MOUNTED)) {
|
||||||
currentMountPrefix = SdCardManager::SD_0_MOUNT_POINT;
|
currentMountPrefix = SdCardManager::SD_0_MOUNT_POINT;
|
||||||
} else if ((preferredSdCard == sd::SdCard::SLOT_1) and
|
} else if ((preferredSdCard == sd::SdCard::SLOT_1) and
|
||||||
@ -109,11 +108,7 @@ ReturnValue_t FileSystemHandler::initialize() {
|
|||||||
<< std::endl;
|
<< std::endl;
|
||||||
}
|
}
|
||||||
sdcMan = SdCardManager::instance();
|
sdcMan = SdCardManager::instance();
|
||||||
sd::SdCard preferredSdCard;
|
sd::SdCard preferredSdCard = sdcMan->getPreferredSdCard();
|
||||||
ReturnValue_t result = sdcMan->getPreferredSdCard(preferredSdCard);
|
|
||||||
if (result != HasReturnvaluesIF::RETURN_OK) {
|
|
||||||
return result;
|
|
||||||
}
|
|
||||||
if (preferredSdCard == sd::SdCard::SLOT_0) {
|
if (preferredSdCard == sd::SdCard::SLOT_0) {
|
||||||
currentMountPrefix = SdCardManager::SD_0_MOUNT_POINT;
|
currentMountPrefix = SdCardManager::SD_0_MOUNT_POINT;
|
||||||
} else if (preferredSdCard == sd::SdCard::SLOT_1) {
|
} else if (preferredSdCard == sd::SdCard::SLOT_1) {
|
||||||
|
@ -8,8 +8,6 @@
|
|||||||
|
|
||||||
FilesystemHelper::FilesystemHelper() {}
|
FilesystemHelper::FilesystemHelper() {}
|
||||||
|
|
||||||
FilesystemHelper::~FilesystemHelper() {}
|
|
||||||
|
|
||||||
ReturnValue_t FilesystemHelper::checkPath(std::string path) {
|
ReturnValue_t FilesystemHelper::checkPath(std::string path) {
|
||||||
SdCardManager* sdcMan = SdCardManager::instance();
|
SdCardManager* sdcMan = SdCardManager::instance();
|
||||||
if (sdcMan == nullptr) {
|
if (sdcMan == nullptr) {
|
||||||
|
@ -7,7 +7,7 @@
|
|||||||
#include "fsfw/returnvalues/HasReturnvaluesIF.h"
|
#include "fsfw/returnvalues/HasReturnvaluesIF.h"
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief This class implements often used functions concerning the file system management.
|
* @brief This class implements often used functions related to the file system management.
|
||||||
*
|
*
|
||||||
* @author J. Meier
|
* @author J. Meier
|
||||||
*/
|
*/
|
||||||
@ -20,11 +20,8 @@ class FilesystemHelper : public HasReturnvaluesIF {
|
|||||||
//! [EXPORT] : [COMMENT] Specified file does not exist on filesystem
|
//! [EXPORT] : [COMMENT] Specified file does not exist on filesystem
|
||||||
static const ReturnValue_t FILE_NOT_EXISTS = MAKE_RETURN_CODE(0xA1);
|
static const ReturnValue_t FILE_NOT_EXISTS = MAKE_RETURN_CODE(0xA1);
|
||||||
|
|
||||||
FilesystemHelper();
|
|
||||||
virtual ~FilesystemHelper();
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief In case the path points to a directory on the sd card the function checks if the
|
* @brief In case the path points to a directory on the sd card, the function checks if the
|
||||||
* appropriate SD card is mounted.
|
* appropriate SD card is mounted.
|
||||||
*
|
*
|
||||||
* @param path Path to check
|
* @param path Path to check
|
||||||
@ -39,11 +36,14 @@ class FilesystemHelper : public HasReturnvaluesIF {
|
|||||||
/**
|
/**
|
||||||
* @brief Checks if the file exists on the filesystem.
|
* @brief Checks if the file exists on the filesystem.
|
||||||
*
|
*
|
||||||
* param file File to check
|
* @param file File to check
|
||||||
*
|
*
|
||||||
* @return RETURN_OK if fiel 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);
|
||||||
|
|
||||||
|
private:
|
||||||
|
FilesystemHelper();
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif /* BSP_Q7S_MEMORY_FILESYSTEMHELPER_H_ */
|
#endif /* BSP_Q7S_MEMORY_FILESYSTEMHELPER_H_ */
|
||||||
|
@ -16,23 +16,51 @@
|
|||||||
#include "linux/utility/utility.h"
|
#include "linux/utility/utility.h"
|
||||||
#include "scratchApi.h"
|
#include "scratchApi.h"
|
||||||
|
|
||||||
SdCardManager* SdCardManager::factoryInstance = nullptr;
|
SdCardManager* SdCardManager::INSTANCE = nullptr;
|
||||||
|
|
||||||
SdCardManager::SdCardManager() : SystemObject(objects::SDC_MANAGER), cmdExecutor(256) {
|
SdCardManager::SdCardManager() : SystemObject(objects::SDC_MANAGER), cmdExecutor(256) {
|
||||||
mutex = MutexFactory::instance()->createMutex();
|
mutex = MutexFactory::instance()->createMutex();
|
||||||
|
ReturnValue_t result = mutex->lockMutex();
|
||||||
|
if (result != RETURN_OK) {
|
||||||
|
sif::error << "SdCardManager::SdCardManager: Mutex lock failed" << std::endl;
|
||||||
|
}
|
||||||
|
uint8_t prefSdRaw = 0;
|
||||||
|
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 != HasReturnvaluesIF::RETURN_OK) {
|
||||||
|
if (result == scratch::KEY_NOT_FOUND) {
|
||||||
|
sif::warning << "CoreController::sdCardInit: "
|
||||||
|
"Preferred SD card not set. Setting to 0"
|
||||||
|
<< std::endl;
|
||||||
|
setPreferredSdCard(sd::SdCard::SLOT_0);
|
||||||
|
sdInfo.pref = sd::SdCard::SLOT_0;
|
||||||
|
} else {
|
||||||
|
// Should not happen.
|
||||||
|
// TODO: Maybe trigger event?
|
||||||
|
sif::error << "SdCardManager::SdCardManager: Reading preferred SD card from scratch"
|
||||||
|
"buffer failed"
|
||||||
|
<< std::endl;
|
||||||
|
sdInfo.pref = sd::SdCard::SLOT_0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
sdInfo.pref = static_cast<sd::SdCard>(prefSdRaw);
|
||||||
}
|
}
|
||||||
|
|
||||||
SdCardManager::~SdCardManager() {}
|
SdCardManager::~SdCardManager() {}
|
||||||
|
|
||||||
void SdCardManager::create() {
|
void SdCardManager::create() {
|
||||||
if (factoryInstance == nullptr) {
|
if (INSTANCE == nullptr) {
|
||||||
factoryInstance = new SdCardManager();
|
INSTANCE = new SdCardManager();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
SdCardManager* SdCardManager::instance() {
|
SdCardManager* SdCardManager::instance() {
|
||||||
SdCardManager::create();
|
SdCardManager::create();
|
||||||
return SdCardManager::factoryInstance;
|
return SdCardManager::INSTANCE;
|
||||||
}
|
}
|
||||||
|
|
||||||
ReturnValue_t SdCardManager::switchOnSdCard(sd::SdCard sdCard, bool doMountSdCard,
|
ReturnValue_t SdCardManager::switchOnSdCard(sd::SdCard sdCard, bool doMountSdCard,
|
||||||
@ -51,7 +79,7 @@ ReturnValue_t SdCardManager::switchOnSdCard(sd::SdCard sdCard, bool doMountSdCar
|
|||||||
if (statusPair == nullptr) {
|
if (statusPair == nullptr) {
|
||||||
sdStatusPtr = std::make_unique<SdStatePair>();
|
sdStatusPtr = std::make_unique<SdStatePair>();
|
||||||
statusPair = sdStatusPtr.get();
|
statusPair = sdStatusPtr.get();
|
||||||
result = getSdCardActiveStatus(*statusPair);
|
result = getSdCardsStatus(*statusPair);
|
||||||
if (result != HasReturnvaluesIF::RETURN_OK) {
|
if (result != HasReturnvaluesIF::RETURN_OK) {
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
@ -98,7 +126,7 @@ ReturnValue_t SdCardManager::switchOnSdCard(sd::SdCard sdCard, bool doMountSdCar
|
|||||||
ReturnValue_t SdCardManager::switchOffSdCard(sd::SdCard sdCard, bool doUnmountSdCard,
|
ReturnValue_t SdCardManager::switchOffSdCard(sd::SdCard sdCard, bool doUnmountSdCard,
|
||||||
SdStatePair* statusPair) {
|
SdStatePair* statusPair) {
|
||||||
std::pair<sd::SdState, sd::SdState> active;
|
std::pair<sd::SdState, sd::SdState> active;
|
||||||
ReturnValue_t result = getSdCardActiveStatus(active);
|
ReturnValue_t result = getSdCardsStatus(active);
|
||||||
if (result != HasReturnvaluesIF::RETURN_OK) {
|
if (result != HasReturnvaluesIF::RETURN_OK) {
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
@ -165,7 +193,7 @@ ReturnValue_t SdCardManager::setSdCardState(sd::SdCard sdCard, bool on) {
|
|||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
ReturnValue_t SdCardManager::getSdCardActiveStatus(SdStatePair& active) {
|
ReturnValue_t SdCardManager::getSdCardsStatus(SdStatePair& active) {
|
||||||
using namespace std;
|
using namespace std;
|
||||||
MutexGuard mg(mutex);
|
MutexGuard mg(mutex);
|
||||||
if (not filesystem::exists(SD_STATE_FILE)) {
|
if (not filesystem::exists(SD_STATE_FILE)) {
|
||||||
@ -273,14 +301,14 @@ ReturnValue_t SdCardManager::sanitizeState(SdStatePair* statusPair, sd::SdCard p
|
|||||||
resetNonBlockingState = true;
|
resetNonBlockingState = true;
|
||||||
}
|
}
|
||||||
if (prefSdCard == sd::SdCard::NONE) {
|
if (prefSdCard == sd::SdCard::NONE) {
|
||||||
result = getPreferredSdCard(prefSdCard);
|
result = getPreferredSdCard();
|
||||||
if (result != HasReturnvaluesIF::RETURN_OK) {
|
if (result != HasReturnvaluesIF::RETURN_OK) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (statusPair == nullptr) {
|
if (statusPair == nullptr) {
|
||||||
sdStatusPtr = std::make_unique<SdStatePair>();
|
sdStatusPtr = std::make_unique<SdStatePair>();
|
||||||
statusPair = sdStatusPtr.get();
|
statusPair = sdStatusPtr.get();
|
||||||
getSdCardActiveStatus(*statusPair);
|
getSdCardsStatus(*statusPair);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (statusPair->first == sd::SdState::ON) {
|
if (statusPair->first == sd::SdState::ON) {
|
||||||
@ -351,20 +379,21 @@ void SdCardManager::processSdStatusLine(std::pair<sd::SdState, sd::SdState>& act
|
|||||||
idx++;
|
idx++;
|
||||||
}
|
}
|
||||||
|
|
||||||
ReturnValue_t SdCardManager::getPreferredSdCard(sd::SdCard& sdCard) const {
|
sd::SdCard SdCardManager::getPreferredSdCard() const {
|
||||||
uint8_t prefSdCard = 0;
|
MutexGuard mg(mutex);
|
||||||
ReturnValue_t result = scratch::readNumber(scratch::PREFERED_SDC_KEY, prefSdCard);
|
auto res = mg.getLockResult();
|
||||||
if (result != HasReturnvaluesIF::RETURN_OK) {
|
if (res != RETURN_OK) {
|
||||||
return result;
|
sif::error << "SdCardManager::getPreferredSdCard: Lock error" << std::endl;
|
||||||
}
|
}
|
||||||
sdCard = static_cast<sd::SdCard>(prefSdCard);
|
return sdInfo.pref;
|
||||||
return HasReturnvaluesIF::RETURN_OK;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
ReturnValue_t SdCardManager::setPreferredSdCard(sd::SdCard sdCard) {
|
ReturnValue_t SdCardManager::setPreferredSdCard(sd::SdCard sdCard) {
|
||||||
|
MutexGuard mg(mutex);
|
||||||
if (sdCard == sd::SdCard::BOTH) {
|
if (sdCard == sd::SdCard::BOTH) {
|
||||||
return HasReturnvaluesIF::RETURN_FAILED;
|
return HasReturnvaluesIF::RETURN_FAILED;
|
||||||
}
|
}
|
||||||
|
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));
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -383,14 +412,9 @@ ReturnValue_t SdCardManager::updateSdCardStateFile() {
|
|||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
std::string SdCardManager::getCurrentMountPrefix(sd::SdCard prefSdCard) {
|
std::string SdCardManager::getCurrentMountPrefix() const {
|
||||||
if (prefSdCard == sd::SdCard::NONE) {
|
MutexGuard mg(mutex);
|
||||||
ReturnValue_t result = getPreferredSdCard(prefSdCard);
|
if (sdInfo.active == sd::SdCard::SLOT_0) {
|
||||||
if (result != HasReturnvaluesIF::RETURN_OK) {
|
|
||||||
return SD_0_MOUNT_POINT;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (prefSdCard == sd::SdCard::SLOT_0) {
|
|
||||||
return SD_0_MOUNT_POINT;
|
return SD_0_MOUNT_POINT;
|
||||||
} else {
|
} else {
|
||||||
return SD_1_MOUNT_POINT;
|
return SD_1_MOUNT_POINT;
|
||||||
@ -443,7 +467,7 @@ void SdCardManager::setPrintCommandOutput(bool print) { this->printCmdOutput = p
|
|||||||
|
|
||||||
bool SdCardManager::isSdCardMounted(sd::SdCard sdCard) {
|
bool SdCardManager::isSdCardMounted(sd::SdCard sdCard) {
|
||||||
SdCardManager::SdStatePair active;
|
SdCardManager::SdStatePair active;
|
||||||
ReturnValue_t result = this->getSdCardActiveStatus(active);
|
ReturnValue_t result = this->getSdCardsStatus(active);
|
||||||
|
|
||||||
if (result != HasReturnvaluesIF::RETURN_OK) {
|
if (result != HasReturnvaluesIF::RETURN_OK) {
|
||||||
sif::debug << "SdCardManager::isSdCardMounted: Failed to get SD card active state";
|
sif::debug << "SdCardManager::isSdCardMounted: Failed to get SD card active state";
|
||||||
@ -466,3 +490,68 @@ bool SdCardManager::isSdCardMounted(sd::SdCard sdCard) {
|
|||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
ReturnValue_t SdCardManager::isSdCardMountedReadOnly(sd::SdCard sdcard, bool& readOnly) {
|
||||||
|
std::ostringstream command;
|
||||||
|
if (sdcard == sd::SdCard::SLOT_0) {
|
||||||
|
command << "grep -q '" << SD_0_MOUNT_POINT << " vfat ro,' /proc/mounts";
|
||||||
|
} else {
|
||||||
|
command << "grep -q '" << SD_1_MOUNT_POINT << " vfat ro,' /proc/mounts";
|
||||||
|
}
|
||||||
|
ReturnValue_t result = cmdExecutor.load(command.str(), true, false);
|
||||||
|
if (result != HasReturnvaluesIF::RETURN_OK) {
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
result = cmdExecutor.execute();
|
||||||
|
if (result != HasReturnvaluesIF::RETURN_OK) {
|
||||||
|
int exitStatus = cmdExecutor.getLastError();
|
||||||
|
if (exitStatus == 1) {
|
||||||
|
readOnly = false;
|
||||||
|
return RETURN_OK;
|
||||||
|
}
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
auto& readVec = cmdExecutor.getReadVector();
|
||||||
|
size_t readLen = strnlen(readVec.data(), readVec.size());
|
||||||
|
if (readLen == 0) {
|
||||||
|
readOnly = false;
|
||||||
|
}
|
||||||
|
readOnly = true;
|
||||||
|
return HasReturnvaluesIF::RETURN_OK;
|
||||||
|
}
|
||||||
|
|
||||||
|
ReturnValue_t SdCardManager::remountReadWrite(sd::SdCard sdcard) {
|
||||||
|
std::ostringstream command;
|
||||||
|
if (sdcard == sd::SdCard::SLOT_0) {
|
||||||
|
command << "mount -o remount,rw " << SD_0_DEV_NAME << " " << SD_0_MOUNT_POINT;
|
||||||
|
} else {
|
||||||
|
command << "mount -o remount,rw " << SD_1_DEV_NAME << " " << SD_1_MOUNT_POINT;
|
||||||
|
}
|
||||||
|
ReturnValue_t result = cmdExecutor.load(command.str(), true, false);
|
||||||
|
if (result != HasReturnvaluesIF::RETURN_OK) {
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
return cmdExecutor.execute();
|
||||||
|
}
|
||||||
|
|
||||||
|
ReturnValue_t SdCardManager::performFsck(sd::SdCard sdcard, bool printOutput, int& linuxError) {
|
||||||
|
std::ostringstream command;
|
||||||
|
if (sdcard == sd::SdCard::SLOT_0) {
|
||||||
|
command << "fsck -y " << SD_0_DEV_NAME;
|
||||||
|
} else {
|
||||||
|
command << "fsck -y " << SD_1_DEV_NAME;
|
||||||
|
}
|
||||||
|
ReturnValue_t result = cmdExecutor.load(command.str(), true, printOutput);
|
||||||
|
if (result != HasReturnvaluesIF::RETURN_OK) {
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
result = cmdExecutor.execute();
|
||||||
|
if (result != HasReturnvaluesIF::RETURN_OK) {
|
||||||
|
linuxError = cmdExecutor.getLastError();
|
||||||
|
}
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
void SdCardManager::setActiveSdCard(sd::SdCard sdCard) { sdInfo.active = sdCard; }
|
||||||
|
|
||||||
|
sd::SdCard SdCardManager::getActiveSdCard() const { return sdInfo.active; }
|
||||||
|
@ -24,7 +24,7 @@ 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 SdCardAccess;
|
friend class SdCardAccess;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
@ -36,6 +36,12 @@ class SdCardManager : public SystemObject, public SdCardMountedIF {
|
|||||||
|
|
||||||
using SdStatePair = std::pair<sd::SdState, sd::SdState>;
|
using SdStatePair = std::pair<sd::SdState, sd::SdState>;
|
||||||
|
|
||||||
|
struct SdInfo {
|
||||||
|
sd::SdCard pref = sd::SdCard::NONE;
|
||||||
|
sd::SdCard other = sd::SdCard::NONE;
|
||||||
|
sd::SdCard active = sd::SdCard::NONE;
|
||||||
|
} sdInfo;
|
||||||
|
|
||||||
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 = HasReturnvaluesIF::makeReturnCode(INTERFACE_ID, 0);
|
static constexpr ReturnValue_t OP_ONGOING = HasReturnvaluesIF::makeReturnCode(INTERFACE_ID, 0);
|
||||||
@ -91,7 +97,7 @@ class SdCardManager : public SystemObject, public SdCardMountedIF {
|
|||||||
* @param sdCard
|
* @param sdCard
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
ReturnValue_t getPreferredSdCard(sd::SdCard& sdCard) const override;
|
sd::SdCard getPreferredSdCard() const override;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Switch on the specified SD card.
|
* Switch on the specified SD card.
|
||||||
@ -138,7 +144,7 @@ class SdCardManager : public SystemObject, public SdCardMountedIF {
|
|||||||
* 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
|
||||||
*/
|
*/
|
||||||
ReturnValue_t getSdCardActiveStatus(SdStatePair& active);
|
ReturnValue_t getSdCardsStatus(SdStatePair& active);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Mount the specified SD card. This is necessary to use it.
|
* Mount the specified SD card. This is necessary to use it.
|
||||||
@ -146,6 +152,20 @@ class SdCardManager : public SystemObject, public SdCardMountedIF {
|
|||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
ReturnValue_t mountSdCard(sd::SdCard sdCard);
|
ReturnValue_t mountSdCard(sd::SdCard sdCard);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Set the currently active SD card. This does not necessarily mean that the SD card is on or
|
||||||
|
* mounted
|
||||||
|
* @param sdCard
|
||||||
|
*/
|
||||||
|
void setActiveSdCard(sd::SdCard sdCard) override;
|
||||||
|
/**
|
||||||
|
* Get the currently active SD card. This does not necessarily mean that the SD card is on or
|
||||||
|
* mounted
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
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
|
||||||
* can't be used after it has been unmounted.
|
* can't be used after it has been unmounted.
|
||||||
@ -173,7 +193,7 @@ class SdCardManager : public SystemObject, public SdCardMountedIF {
|
|||||||
* @param prefSdCardPtr
|
* @param prefSdCardPtr
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
std::string getCurrentMountPrefix(sd::SdCard prefSdCardPtr = sd::SdCard::NONE) override;
|
std::string getCurrentMountPrefix() const override;
|
||||||
|
|
||||||
OpStatus checkCurrentOp(Operations& currentOp);
|
OpStatus checkCurrentOp(Operations& currentOp);
|
||||||
|
|
||||||
@ -194,6 +214,12 @@ class SdCardManager : public SystemObject, public SdCardMountedIF {
|
|||||||
*/
|
*/
|
||||||
bool isSdCardMounted(sd::SdCard sdCard) override;
|
bool isSdCardMounted(sd::SdCard sdCard) override;
|
||||||
|
|
||||||
|
ReturnValue_t isSdCardMountedReadOnly(sd::SdCard sdcard, bool& readOnly);
|
||||||
|
|
||||||
|
ReturnValue_t remountReadWrite(sd::SdCard sdcard);
|
||||||
|
|
||||||
|
ReturnValue_t performFsck(sd::SdCard sdcard, bool printOutput, int& linuxError);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
CommandExecutor cmdExecutor;
|
CommandExecutor cmdExecutor;
|
||||||
Operations currentOp = Operations::IDLE;
|
Operations currentOp = Operations::IDLE;
|
||||||
@ -210,7 +236,7 @@ class SdCardManager : public SystemObject, public SdCardMountedIF {
|
|||||||
|
|
||||||
std::string currentPrefix;
|
std::string currentPrefix;
|
||||||
|
|
||||||
static SdCardManager* factoryInstance;
|
static SdCardManager* INSTANCE;
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif /* BSP_Q7S_MEMORY_SDCARDACCESSMANAGER_H_ */
|
#endif /* BSP_Q7S_MEMORY_SDCARDACCESSMANAGER_H_ */
|
||||||
|
@ -76,12 +76,12 @@ ReturnValue_t readToFile(std::string name, std::ifstream& file, std::string& fil
|
|||||||
int result = std::system(oss.str().c_str());
|
int result = std::system(oss.str().c_str());
|
||||||
if (result != 0) {
|
if (result != 0) {
|
||||||
if (WEXITSTATUS(result) == 1) {
|
if (WEXITSTATUS(result) == 1) {
|
||||||
sif::warning << "scratch::readNumber: Key " << name << " does not exist" << std::endl;
|
sif::warning << "scratch::readToFile: Key " << name << " does not exist" << std::endl;
|
||||||
// Could not find value
|
// Could not find value
|
||||||
std::remove(filename.c_str());
|
std::remove(filename.c_str());
|
||||||
return KEY_NOT_FOUND;
|
return KEY_NOT_FOUND;
|
||||||
} else {
|
} else {
|
||||||
utility::handleSystemError(result, "scratch::readNumber");
|
utility::handleSystemError(result, "scratch::readToFile");
|
||||||
std::remove(filename.c_str());
|
std::remove(filename.c_str());
|
||||||
return HasReturnvaluesIF::RETURN_FAILED;
|
return HasReturnvaluesIF::RETURN_FAILED;
|
||||||
}
|
}
|
||||||
|
@ -8,14 +8,19 @@
|
|||||||
#include "core/InitMission.h"
|
#include "core/InitMission.h"
|
||||||
#include "fsfw/tasks/TaskFactory.h"
|
#include "fsfw/tasks/TaskFactory.h"
|
||||||
#include "fsfw/version.h"
|
#include "fsfw/version.h"
|
||||||
|
#include "q7sConfig.h"
|
||||||
#include "watchdog/definitions.h"
|
#include "watchdog/definitions.h"
|
||||||
|
|
||||||
static int OBSW_ALREADY_RUNNING = -2;
|
static int OBSW_ALREADY_RUNNING = -2;
|
||||||
|
#if OBSW_Q7S_EM == 0
|
||||||
|
static const char* DEV_STRING = "Xiphos Q7S FM";
|
||||||
|
#else
|
||||||
|
static const char* DEV_STRING = "Xiphos Q7S EM";
|
||||||
|
#endif
|
||||||
int obsw::obsw() {
|
int obsw::obsw() {
|
||||||
using namespace fsfw;
|
using namespace fsfw;
|
||||||
std::cout << "-- EIVE OBSW --" << std::endl;
|
std::cout << "-- EIVE OBSW --" << std::endl;
|
||||||
std::cout << "-- Compiled for Linux (Xiphos Q7S) --" << std::endl;
|
std::cout << "-- Compiled for Linux (" << DEV_STRING << ") --" << std::endl;
|
||||||
std::cout << "-- OBSW v" << common::OBSW_VERSION << " | FSFW v" << fsfw::FSFW_VERSION << " --"
|
std::cout << "-- OBSW 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;
|
||||||
|
@ -1,3 +1 @@
|
|||||||
target_sources(${SIMPLE_OBSW_NAME} PRIVATE
|
target_sources(${SIMPLE_OBSW_NAME} PRIVATE simple.cpp)
|
||||||
simple.cpp
|
|
||||||
)
|
|
||||||
|
@ -1,3 +1 @@
|
|||||||
target_sources(${OBSW_NAME} PRIVATE
|
target_sources(${OBSW_NAME} PRIVATE Xadc.cpp)
|
||||||
Xadc.cpp
|
|
||||||
)
|
|
||||||
|
@ -89,13 +89,42 @@ void initmission::initTasks() {
|
|||||||
}
|
}
|
||||||
pstTasks.push_back(pst);
|
pstTasks.push_back(pst);
|
||||||
|
|
||||||
|
#if OBSW_ADD_PLOC_MPSOC == 1
|
||||||
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 != HasReturnvaluesIF::RETURN_OK) {
|
if (result != HasReturnvaluesIF::RETURN_OK) {
|
||||||
initmission::printAddObjectError("PLOC_MPSOC_HELPER", objects::PLOC_MPSOC_HELPER);
|
initmission::printAddObjectError("PLOC_MPSOC_HELPER", objects::PLOC_MPSOC_HELPER);
|
||||||
}
|
}
|
||||||
pstTasks.push_back(mpsocHelperTask);
|
#endif /* OBSW_ADD_PLOC_MPSOC == 1*/
|
||||||
|
|
||||||
|
#if OBSW_ADD_PLOC_SUPERVISOR == 1
|
||||||
|
PeriodicTaskIF* supvHelperTask = factory->createPeriodicTask(
|
||||||
|
"PLOC_SUPV_HELPER", 20, PeriodicTaskIF::MINIMUM_STACK_SIZE, 0.2, 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 == 1 */
|
||||||
|
|
||||||
|
#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 */
|
||||||
|
|
||||||
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) {
|
||||||
@ -111,6 +140,16 @@ void initmission::initTasks() {
|
|||||||
tmtcDistributor->startTask();
|
tmtcDistributor->startTask();
|
||||||
tmtcBridgeTask->startTask();
|
tmtcBridgeTask->startTask();
|
||||||
tmtcPollingTask->startTask();
|
tmtcPollingTask->startTask();
|
||||||
|
#if OBSW_USE_CCSDS_IP_CORE == 1
|
||||||
|
pdecHandlerTask->startTask();
|
||||||
|
ccsdsHandlerTask->startTask();
|
||||||
|
#endif /* #if OBSW_USE_CCSDS_IP_CORE == 1 */
|
||||||
|
#if OBSW_ADD_PLOC_SUPERVISOR == 1
|
||||||
|
supvHelperTask->startTask();
|
||||||
|
#endif /* OBSW_ADD_PLOC_SUPERVISOR == 1 */
|
||||||
|
#if OBSW_ADD_PLOC_MPSOC == 1
|
||||||
|
mpsocHelperTask->startTask();
|
||||||
|
#endif /* OBSW_ADD_PLOC_MPSOC == 1 */
|
||||||
|
|
||||||
taskStarter(pstTasks, "PST Tasks");
|
taskStarter(pstTasks, "PST Tasks");
|
||||||
taskStarter(pusTasks, "PUS Tasks");
|
taskStarter(pusTasks, "PUS Tasks");
|
||||||
|
@ -3,7 +3,7 @@
|
|||||||
|
|
||||||
#include <vector>
|
#include <vector>
|
||||||
|
|
||||||
#include "fsfw/tasks/Typedef.h"
|
#include "fsfw/tasks/definitions.h"
|
||||||
|
|
||||||
class PeriodicTaskIF;
|
class PeriodicTaskIF;
|
||||||
class TaskFactory;
|
class TaskFactory;
|
||||||
|
@ -37,7 +37,6 @@
|
|||||||
#define OBSW_ENABLE_SYRLINKS_TRANSMIT_TIMEOUT 0
|
#define OBSW_ENABLE_SYRLINKS_TRANSMIT_TIMEOUT 0
|
||||||
#define OBSW_SYRLINKS_SIMULATED 1
|
#define OBSW_SYRLINKS_SIMULATED 1
|
||||||
#define OBSW_STAR_TRACKER_GROUND_CONFIG 1
|
#define OBSW_STAR_TRACKER_GROUND_CONFIG 1
|
||||||
#define OBSW_ENABLE_PERIODIC_HK 0
|
|
||||||
#define OBSW_PRINT_CORE_HK 0
|
#define OBSW_PRINT_CORE_HK 0
|
||||||
#define OBSW_INITIALIZE_SWITCHES 0
|
#define OBSW_INITIALIZE_SWITCHES 0
|
||||||
|
|
||||||
|
@ -1,27 +1,38 @@
|
|||||||
#include "ObjectFactory.h"
|
#include "ObjectFactory.h"
|
||||||
|
|
||||||
#include <devConf.h>
|
|
||||||
#include "fsfw_hal/linux/uart/UartComIF.h"
|
|
||||||
#include "fsfw_hal/linux/i2c/I2cComIF.h"
|
|
||||||
#include "fsfw_hal/linux/uart/UartCookie.h"
|
|
||||||
|
|
||||||
#include "OBSWConfig.h"
|
#include "OBSWConfig.h"
|
||||||
#include "busConf.h"
|
#include "busConf.h"
|
||||||
#include "devConf.h"
|
#include "devConf.h"
|
||||||
|
#include "ccsdsConfig.h"
|
||||||
|
#include "devices/addresses.h"
|
||||||
|
#include "devices/gpioIds.h"
|
||||||
#include "fsfw/datapoollocal/LocalDataPoolManager.h"
|
#include "fsfw/datapoollocal/LocalDataPoolManager.h"
|
||||||
#include "fsfw/tmtcpacket/pus/tm.h"
|
#include "fsfw/tmtcpacket/pus/tm.h"
|
||||||
#include "fsfw/tmtcservices/CommandingServiceBase.h"
|
#include "fsfw/tmtcservices/CommandingServiceBase.h"
|
||||||
#include "fsfw/tmtcservices/PusServiceBase.h"
|
#include "fsfw/tmtcservices/PusServiceBase.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/uart/UartComIF.h"
|
||||||
|
#include "fsfw_hal/linux/uart/UartCookie.h"
|
||||||
|
#include "fsfw_hal/common/gpio/GpioCookie.h"
|
||||||
|
#include "linux/ObjectFactory.h"
|
||||||
#include "linux/devices/ploc/PlocMPSoCHandler.h"
|
#include "linux/devices/ploc/PlocMPSoCHandler.h"
|
||||||
#include "linux/devices/ploc/PlocMPSoCHelper.h"
|
#include "linux/devices/ploc/PlocMPSoCHelper.h"
|
||||||
#include "mission/devices/Tmp1075Handler.h"
|
#include "linux/devices/ploc/PlocMemoryDumper.h"
|
||||||
|
#include "linux/devices/ploc/PlocSupervisorHandler.h"
|
||||||
|
#include "linux/devices/ploc/PlocSupvHelper.h"
|
||||||
|
#include "linux/obc/AxiPtmeConfig.h"
|
||||||
|
#include "linux/obc/PapbVcInterface.h"
|
||||||
|
#include "linux/obc/PdecHandler.h"
|
||||||
|
#include "linux/obc/Ptme.h"
|
||||||
|
#include "linux/obc/PtmeConfig.h"
|
||||||
#include "mission/core/GenericFactory.h"
|
#include "mission/core/GenericFactory.h"
|
||||||
#include "mission/utility/TmFunnel.h"
|
#include "mission/devices/Tmp1075Handler.h"
|
||||||
#include "test/gpio/DummyGpioIF.h"
|
#include "mission/tmtc/TmFunnel.h"
|
||||||
|
#include "mission/tmtc/CCSDSHandler.h"
|
||||||
|
#include "mission/tmtc/VirtualChannel.h"
|
||||||
#include "objects/systemObjectList.h"
|
#include "objects/systemObjectList.h"
|
||||||
#include "devices/addresses.h"
|
#include "test/gpio/DummyGpioIF.h"
|
||||||
#include "devices/gpioIds.h"
|
|
||||||
#include "tmtc/apid.h"
|
#include "tmtc/apid.h"
|
||||||
#include "tmtc/pusIds.h"
|
#include "tmtc/pusIds.h"
|
||||||
|
|
||||||
@ -32,7 +43,11 @@ void Factory::setStaticFrameworkObjectIds() {
|
|||||||
CommandingServiceBase::defaultPacketSource = objects::PUS_PACKET_DISTRIBUTOR;
|
CommandingServiceBase::defaultPacketSource = objects::PUS_PACKET_DISTRIBUTOR;
|
||||||
CommandingServiceBase::defaultPacketDestination = objects::TM_FUNNEL;
|
CommandingServiceBase::defaultPacketDestination = objects::TM_FUNNEL;
|
||||||
|
|
||||||
|
#if OBSW_TM_TO_PTME == 1
|
||||||
|
TmFunnel::downlinkDestination = objects::CCSDS_HANDLER;
|
||||||
|
#else
|
||||||
TmFunnel::downlinkDestination = objects::TMTC_BRIDGE;
|
TmFunnel::downlinkDestination = objects::TMTC_BRIDGE;
|
||||||
|
#endif
|
||||||
TmFunnel::storageDestination = objects::NO_OBJECT;
|
TmFunnel::storageDestination = objects::NO_OBJECT;
|
||||||
|
|
||||||
VerificationReporter::messageReceiver = objects::PUS_SERVICE_1_VERIFICATION;
|
VerificationReporter::messageReceiver = objects::PUS_SERVICE_1_VERIFICATION;
|
||||||
@ -43,12 +58,14 @@ void ObjectFactory::produce(void* args) {
|
|||||||
Factory::setStaticFrameworkObjectIds();
|
Factory::setStaticFrameworkObjectIds();
|
||||||
ObjectFactory::produceGenericObjects();
|
ObjectFactory::produceGenericObjects();
|
||||||
|
|
||||||
|
LinuxLibgpioIF* gpioComIF = new LinuxLibgpioIF(objects::GPIO_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,
|
||||||
uart::PLOC_MPSOC_BAUD, mpsoc::MAX_REPLY_SIZE);
|
uart::PLOC_MPSOC_BAUD, mpsoc::MAX_REPLY_SIZE);
|
||||||
mpsocUartCookie->setNoFixedSizeReply();
|
mpsocUartCookie->setNoFixedSizeReply();
|
||||||
PlocMPSoCHelper* plocMpsocHelper = new PlocMPSoCHelper(objects::PLOC_MPSOC_HELPER);
|
PlocMPSoCHelper* plocMpsocHelper = new PlocMPSoCHelper(objects::PLOC_MPSOC_HELPER);
|
||||||
new UartComIF(objects::UART_COM_IF);
|
|
||||||
auto dummyGpioIF = new DummyGpioIF();
|
auto dummyGpioIF = new DummyGpioIF();
|
||||||
PlocMPSoCHandler* plocMPSoCHandler = new PlocMPSoCHandler(
|
PlocMPSoCHandler* plocMPSoCHandler = new PlocMPSoCHandler(
|
||||||
objects::PLOC_MPSOC_HANDLER, objects::UART_COM_IF, mpsocUartCookie, plocMpsocHelper,
|
objects::PLOC_MPSOC_HANDLER, objects::UART_COM_IF, mpsocUartCookie, plocMpsocHelper,
|
||||||
@ -56,6 +73,21 @@ void ObjectFactory::produce(void* args) {
|
|||||||
plocMPSoCHandler->setStartUpImmediately();
|
plocMPSoCHandler->setStartUpImmediately();
|
||||||
#endif /* OBSW_ADD_PLOC_MPSOC == 1 */
|
#endif /* OBSW_ADD_PLOC_MPSOC == 1 */
|
||||||
|
|
||||||
|
#if OBSW_ADD_PLOC_SUPERVISOR == 1
|
||||||
|
UartCookie* supervisorCookie =
|
||||||
|
new UartCookie(objects::PLOC_SUPERVISOR_HANDLER, std::string("/dev/ttyPS1"),
|
||||||
|
uart::PLOC_SUPV_BAUD, supv::MAX_PACKET_SIZE * 20);
|
||||||
|
supervisorCookie->setNoFixedSizeReply();
|
||||||
|
auto supvGpioIF = new DummyGpioIF();
|
||||||
|
auto supvHelper = new PlocSupvHelper(objects::PLOC_SUPERVISOR_HELPER);
|
||||||
|
new PlocSupervisorHandler(objects::PLOC_SUPERVISOR_HANDLER, objects::UART_COM_IF,
|
||||||
|
supervisorCookie, Gpio(gpioIds::ENABLE_SUPV_UART, supvGpioIF),
|
||||||
|
pcdu::PDU1_CH6_PLOC_12V, supvHelper);
|
||||||
|
|
||||||
|
#endif
|
||||||
|
|
||||||
|
new PlocMemoryDumper(objects::PLOC_MEMORY_DUMPER);
|
||||||
|
|
||||||
#if OBSW_TEST_LIBGPIOD == 1
|
#if OBSW_TEST_LIBGPIOD == 1
|
||||||
#if OBSW_TEST_GPIO_OPEN_BYLABEL == 1
|
#if OBSW_TEST_GPIO_OPEN_BYLABEL == 1
|
||||||
/* Configure MIO0 as input */
|
/* Configure MIO0 as input */
|
||||||
@ -86,21 +118,6 @@ void ObjectFactory::produce(void* args) {
|
|||||||
new SusHandler(objects::SUS_0, objects::SPI_COM_IF, spiCookieSus, gpioComIF, gpioIds::CS_SUS_0);
|
new SusHandler(objects::SUS_0, objects::SPI_COM_IF, spiCookieSus, gpioComIF, gpioIds::CS_SUS_0);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if OBSW_TEST_CCSDS_BRIDGE == 1
|
|
||||||
GpioCookie* gpioCookieCcsdsIp = new GpioCookie;
|
|
||||||
GpiodRegular* papbBusyN =
|
|
||||||
new GpiodRegular(std::string("gpiochip0"), 0, std::string("PAPBBusy_VC0"));
|
|
||||||
gpioCookieCcsdsIp->addGpio(gpioIds::PAPB_BUSY_N, papbBusyN);
|
|
||||||
GpiodRegular* papbEmpty =
|
|
||||||
new GpiodRegular(std::string("gpiochip0"), 1, std::string("PAPBEmpty_VC0"));
|
|
||||||
gpioCookieCcsdsIp->addGpio(gpioIds::PAPB_EMPTY, papbEmpty);
|
|
||||||
gpioComIF->addGpios(gpioCookieCcsdsIp);
|
|
||||||
|
|
||||||
new CCSDSIPCoreBridge(objects::CCSDS_IP_CORE_BRIDGE, objects::CCSDS_PACKET_DISTRIBUTOR,
|
|
||||||
objects::TM_STORE, objects::TC_STORE, gpioComIF, std::string("/dev/uio0"),
|
|
||||||
gpioIds::PAPB_BUSY_N, gpioIds::PAPB_EMPTY);
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#if OBSW_TEST_RAD_SENSOR == 1
|
#if OBSW_TEST_RAD_SENSOR == 1
|
||||||
GpioCookie* gpioCookieRadSensor = new GpioCookie;
|
GpioCookie* gpioCookieRadSensor = new GpioCookie;
|
||||||
GpiodRegular* chipSelectRadSensor = new GpiodRegular(
|
GpiodRegular* chipSelectRadSensor = new GpiodRegular(
|
||||||
@ -124,28 +141,19 @@ void ObjectFactory::produce(void* args) {
|
|||||||
GpioCookie* gpioCookie = new GpioCookie;
|
GpioCookie* gpioCookie = new GpioCookie;
|
||||||
gpioCookie->addGpio(gpioIds::HEATER_0, heaterGpio);
|
gpioCookie->addGpio(gpioIds::HEATER_0, heaterGpio);
|
||||||
new HeaterHandler(objects::HEATER_HANDLER, objects::GPIO_IF, gpioCookie, objects::PCDU_HANDLER,
|
new HeaterHandler(objects::HEATER_HANDLER, objects::GPIO_IF, gpioCookie, objects::PCDU_HANDLER,
|
||||||
pcduSwitches::TCS_BOARD_8V_HEATER_IN);
|
pcdu::TCS_BOARD_8V_HEATER_IN);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if OBSW_ADD_PLOC_SUPERVISOR == 1
|
new I2cComIF(objects::I2C_COM_IF);
|
||||||
/* Configuration for MIO0 on TE0720-03-1CFA */
|
|
||||||
UartCookie* plocSupervisorCookie =
|
|
||||||
new UartCookie(objects::PLOC_SUPERVISOR_HANDLER, std::string("/dev/ttyPS1"),
|
|
||||||
UartModes::NON_CANONICAL, 115200, PLOC_SPV::MAX_PACKET_SIZE * 20);
|
|
||||||
plocSupervisorCookie->setNoFixedSizeReply();
|
|
||||||
PlocSupervisorHandler* plocSupervisor = new PlocSupervisorHandler(
|
|
||||||
objects::PLOC_SUPERVISOR_HANDLER, objects::UART_COM_IF, plocSupervisorCookie);
|
|
||||||
plocSupervisor->setStartUpImmediately();
|
|
||||||
#endif
|
|
||||||
|
|
||||||
new I2cComIF(objects::I2C_COM_IF);
|
I2cCookie* i2cCookieTmp1075tcs1 =
|
||||||
|
new I2cCookie(addresses::TMP1075_TCS_1, TMP1075::MAX_REPLY_LENGTH, std::string("/dev/i2c-0"));
|
||||||
|
I2cCookie* i2cCookieTmp1075tcs2 =
|
||||||
|
new I2cCookie(addresses::TMP1075_TCS_2, TMP1075::MAX_REPLY_LENGTH, std::string("/dev/i2c-0"));
|
||||||
|
|
||||||
I2cCookie* i2cCookieTmp1075tcs1 =
|
/* Temperature sensors */
|
||||||
new I2cCookie(addresses::TMP1075_TCS_1, TMP1075::MAX_REPLY_LENGTH, std::string("/dev/i2c-0"));
|
new Tmp1075Handler(objects::TMP1075_HANDLER_1, objects::I2C_COM_IF, i2cCookieTmp1075tcs1);
|
||||||
I2cCookie* i2cCookieTmp1075tcs2 =
|
new Tmp1075Handler(objects::TMP1075_HANDLER_2, objects::I2C_COM_IF, i2cCookieTmp1075tcs2);
|
||||||
new I2cCookie(addresses::TMP1075_TCS_2, TMP1075::MAX_REPLY_LENGTH, std::string("/dev/i2c-0"));
|
|
||||||
|
|
||||||
/* Temperature sensors */
|
static_cast<void>(gpioComIF);
|
||||||
new Tmp1075Handler(objects::TMP1075_HANDLER_1, objects::I2C_COM_IF, i2cCookieTmp1075tcs1);
|
|
||||||
new Tmp1075Handler(objects::TMP1075_HANDLER_2, objects::I2C_COM_IF, i2cCookieTmp1075tcs2);
|
|
||||||
}
|
}
|
||||||
|
@ -1,7 +1,11 @@
|
|||||||
#ifndef BSP_LINUX_OBJECTFACTORY_H_
|
#ifndef BSP_LINUX_OBJECTFACTORY_H_
|
||||||
#define BSP_LINUX_OBJECTFACTORY_H_
|
#define BSP_LINUX_OBJECTFACTORY_H_
|
||||||
|
|
||||||
|
#include <stdint.h>
|
||||||
|
#include <fsfw_hal/linux/gpio/LinuxLibgpioIF.h>
|
||||||
|
|
||||||
namespace ObjectFactory {
|
namespace ObjectFactory {
|
||||||
|
static const uint32_t TRANSMITTER_TIMEOUT = 86400000; // 1 day
|
||||||
void produce(void* args);
|
void produce(void* args);
|
||||||
}; // namespace ObjectFactory
|
}; // namespace ObjectFactory
|
||||||
|
|
||||||
|
@ -3,9 +3,37 @@
|
|||||||
|
|
||||||
namespace te0720_1cfa {
|
namespace te0720_1cfa {
|
||||||
static constexpr char MPSOC_UART[] = "/dev/ttyPS1";
|
static constexpr char MPSOC_UART[] = "/dev/ttyPS1";
|
||||||
namespace baudrate {
|
|
||||||
|
|
||||||
|
static constexpr char UIO_PDEC_REGISTERS[] = "/dev/uio0";
|
||||||
|
static constexpr char UIO_PTME[] = "/dev/uio1";
|
||||||
|
static constexpr char UIO_PDEC_CONFIG_MEMORY[] = "/dev/uio2";
|
||||||
|
static constexpr char UIO_PDEC_RAM[] = "/dev/uio3";
|
||||||
|
static constexpr int MAP_ID_PTME_CONFIG = 3;
|
||||||
|
|
||||||
|
namespace uiomapids {
|
||||||
|
static const int PTME_VC0 = 0;
|
||||||
|
static const int PTME_VC1 = 1;
|
||||||
|
static const int PTME_VC2 = 2;
|
||||||
|
static const int PTME_VC3 = 3;
|
||||||
|
static const int PTME_CONFIG = 4;
|
||||||
|
} // namespace uiomapids
|
||||||
|
|
||||||
|
namespace gpioNames {
|
||||||
|
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_BUSY_SIGNAL_VC1[] = "papb_busy_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_BUSY_SIGNAL_VC3[] = "papb_busy_signal_vc3";
|
||||||
|
static constexpr char PAPB_EMPTY_SIGNAL_VC3[] = "papb_empty_signal_vc3";
|
||||||
|
static constexpr char RS485_EN_TX_CLOCK[] = "tx_clock_enable_ltc2872";
|
||||||
|
static constexpr char RS485_EN_TX_DATA[] = "tx_data_enable_ltc2872";
|
||||||
|
static constexpr char RS485_EN_RX_CLOCK[] = "rx_clock_enable_ltc2872";
|
||||||
|
static constexpr char RS485_EN_RX_DATA[] = "rx_data_enable_ltc2872";
|
||||||
|
static constexpr char PDEC_RESET[] = "pdec_reset";
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif /* BSP_EGSE_BOARDCONFIG_BUSCONF_H_ */
|
#endif /* BSP_EGSE_BOARDCONFIG_BUSCONF_H_ */
|
||||||
|
@ -33,6 +33,10 @@ add_compile_options(
|
|||||||
set(STRIPPED_OBSW_NAME ${OBSW_BIN_NAME}-stripped)
|
set(STRIPPED_OBSW_NAME ${OBSW_BIN_NAME}-stripped)
|
||||||
set(STRIPPED_WATCHDOG_NAME eive-watchdog-stripped)
|
set(STRIPPED_WATCHDOG_NAME eive-watchdog-stripped)
|
||||||
|
|
||||||
|
if(EIVE_CREATE_UNIQUE_OBSW_BIN)
|
||||||
|
set(UNIQUE_OBSW_BIN_NAME ${OBSW_BIN_NAME}-$ENV{USERNAME})
|
||||||
|
endif()
|
||||||
|
|
||||||
add_custom_command(
|
add_custom_command(
|
||||||
TARGET ${OBSW_NAME}
|
TARGET ${OBSW_NAME}
|
||||||
POST_BUILD
|
POST_BUILD
|
||||||
@ -41,6 +45,16 @@ add_custom_command(
|
|||||||
COMMENT "Generating stripped executable ${STRIPPED_OBSW_NAME}.."
|
COMMENT "Generating stripped executable ${STRIPPED_OBSW_NAME}.."
|
||||||
)
|
)
|
||||||
|
|
||||||
|
if(UNIQUE_OBSW_BIN_NAME)
|
||||||
|
add_custom_command(
|
||||||
|
TARGET ${OBSW_NAME}
|
||||||
|
POST_BUILD
|
||||||
|
COMMAND ${CMAKE_COMMAND} -E copy
|
||||||
|
${CMAKE_CURRENT_BINARY_DIR}/${OBSW_BIN_NAME}
|
||||||
|
${CMAKE_CURRENT_BINARY_DIR}/${UNIQUE_OBSW_BIN_NAME}
|
||||||
|
COMMENT "Generating unique EIVE OBSW binary ${UNIQUE_OBSW_BIN_NAME}")
|
||||||
|
endif()
|
||||||
|
|
||||||
add_custom_command(
|
add_custom_command(
|
||||||
TARGET ${WATCHDOG_NAME}
|
TARGET ${WATCHDOG_NAME}
|
||||||
POST_BUILD
|
POST_BUILD
|
||||||
|
@ -20,7 +20,7 @@ else
|
|||||||
cfg_script_name="${EIVE_OBSW_ROOT}/cmake/scripts/${cfg_script_name}"
|
cfg_script_name="${EIVE_OBSW_ROOT}/cmake/scripts/${cfg_script_name}"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [[ -z "${EIVE_Q7S_EM}" ]]; then
|
if [ ! -z "${EIVE_Q7S_EM}" ]; then
|
||||||
build_defs="EIVE_Q7S_EM=ON"
|
build_defs="EIVE_Q7S_EM=ON"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
@ -20,7 +20,7 @@ else
|
|||||||
cfg_script_name="${EIVE_OBSW_ROOT}/cmake/scripts/${cfg_script_name}"
|
cfg_script_name="${EIVE_OBSW_ROOT}/cmake/scripts/${cfg_script_name}"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [[ -z "${EIVE_Q7S_EM}" ]]; then
|
if [ ! -z "${EIVE_Q7S_EM}" ]; then
|
||||||
build_defs="EIVE_Q7S_EM=ON"
|
build_defs="EIVE_Q7S_EM=ON"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
@ -20,7 +20,7 @@ else
|
|||||||
cfg_script_name="${EIVE_OBSW_ROOT}/cmake/scripts/${cfg_script_name}"
|
cfg_script_name="${EIVE_OBSW_ROOT}/cmake/scripts/${cfg_script_name}"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [[ -z "${EIVE_Q7S_EM}" ]]; then
|
if [ ! -z "${EIVE_Q7S_EM}" ]; then
|
||||||
build_defs="EIVE_Q7S_EM=ON"
|
build_defs="EIVE_Q7S_EM=ON"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
@ -1,7 +1,3 @@
|
|||||||
target_include_directories(${OBSW_NAME} PRIVATE
|
target_include_directories(${OBSW_NAME} PRIVATE ${CMAKE_CURRENT_SOURCE_DIR})
|
||||||
${CMAKE_CURRENT_SOURCE_DIR}
|
|
||||||
)
|
|
||||||
|
|
||||||
target_sources(${OBSW_NAME} PRIVATE
|
target_sources(${OBSW_NAME} PRIVATE commonConfig.cpp)
|
||||||
commonConfig.cpp
|
|
||||||
)
|
|
||||||
|
@ -4,7 +4,7 @@
|
|||||||
const char* const SW_NAME = "eive";
|
const char* const SW_NAME = "eive";
|
||||||
|
|
||||||
#define SW_VERSION 1
|
#define SW_VERSION 1
|
||||||
#define SW_SUBVERSION 10
|
#define SW_SUBVERSION 12
|
||||||
#define SW_REVISION 1
|
#define SW_REVISION 0
|
||||||
|
|
||||||
#endif /* COMMON_CONFIG_OBSWVERSION_H_ */
|
#endif /* COMMON_CONFIG_OBSWVERSION_H_ */
|
||||||
|
@ -2,14 +2,7 @@
|
|||||||
#define COMMON_CONFIG_CCSDSCONFIG_H_
|
#define COMMON_CONFIG_CCSDSCONFIG_H_
|
||||||
|
|
||||||
namespace ccsds {
|
namespace ccsds {
|
||||||
enum {
|
enum { VC0, VC1, VC2, VC3 };
|
||||||
VC0,
|
|
||||||
VC1,
|
|
||||||
VC2,
|
|
||||||
VC3
|
|
||||||
};
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
#endif /* COMMON_CONFIG_CCSDSCONFIG_H_ */
|
#endif /* COMMON_CONFIG_CCSDSCONFIG_H_ */
|
||||||
|
@ -2,37 +2,40 @@
|
|||||||
#define COMMON_CONFIG_COMMONCLASSIDS_H_
|
#define COMMON_CONFIG_COMMONCLASSIDS_H_
|
||||||
|
|
||||||
#include <fsfw/returnvalues/FwClassIds.h>
|
#include <fsfw/returnvalues/FwClassIds.h>
|
||||||
|
|
||||||
#include <cstdint>
|
#include <cstdint>
|
||||||
|
|
||||||
namespace CLASS_ID {
|
namespace CLASS_ID {
|
||||||
enum commonClassIds: uint8_t {
|
enum commonClassIds : uint8_t {
|
||||||
COMMON_CLASS_ID_START = FW_CLASS_ID_COUNT,
|
COMMON_CLASS_ID_START = FW_CLASS_ID_COUNT,
|
||||||
PCDU_HANDLER, //PCDU
|
PCDU_HANDLER, // PCDU
|
||||||
HEATER_HANDLER, //HEATER
|
HEATER_HANDLER, // HEATER
|
||||||
SYRLINKS_HANDLER, //SYRLINKS
|
SYRLINKS_HANDLER, // SYRLINKS
|
||||||
IMTQ_HANDLER, //IMTQ
|
IMTQ_HANDLER, // IMTQ
|
||||||
RW_HANDLER, //RWHA
|
RW_HANDLER, // RWHA
|
||||||
STR_HANDLER, //STRH
|
STR_HANDLER, // STRH
|
||||||
DWLPWRON_CMD, //DWLPWRON
|
DWLPWRON_CMD, // DWLPWRON
|
||||||
MPSOC_TM, //MPTM
|
MPSOC_TM, // MPTM
|
||||||
PLOC_SUPERVISOR_HANDLER, //PLSV
|
PLOC_SUPERVISOR_HANDLER, // PLSV
|
||||||
SUS_HANDLER, //SUSS
|
PLOC_SUPV_HELPER, // PLSPVhLP
|
||||||
CCSDS_IP_CORE_BRIDGE, //IPCI
|
SUS_HANDLER, // SUSS
|
||||||
PTME, //PTME
|
CCSDS_IP_CORE_BRIDGE, // IPCI
|
||||||
PLOC_UPDATER, //PLUD
|
PTME, // PTME
|
||||||
STR_HELPER, //STRHLP
|
PLOC_UPDATER, // PLUD
|
||||||
GOM_SPACE_HANDLER, //GOMS
|
STR_HELPER, // STRHLP
|
||||||
PLOC_MEMORY_DUMPER, //PLMEMDUMP
|
GOM_SPACE_HANDLER, // GOMS
|
||||||
PDEC_HANDLER, //PDEC
|
PLOC_MEMORY_DUMPER, // PLMEMDUMP
|
||||||
CCSDS_HANDLER, //CCSDS
|
PDEC_HANDLER, // PDEC
|
||||||
RATE_SETTER, //RS
|
CCSDS_HANDLER, // CCSDS
|
||||||
ARCSEC_JSON_BASE, //JSONBASE
|
RATE_SETTER, // RS
|
||||||
NVM_PARAM_BASE, //NVMB
|
ARCSEC_JSON_BASE, // JSONBASE
|
||||||
FILE_SYSTEM_HELPER, //FSHLP
|
NVM_PARAM_BASE, // NVMB
|
||||||
PLOC_MPSOC_HELPER, // PLMPHLP
|
FILE_SYSTEM_HELPER, // FSHLP
|
||||||
SA_DEPL_HANDLER, //SADPL
|
PLOC_MPSOC_HELPER, // PLMPHLP
|
||||||
MPSOC_RETURN_VALUES_IF, //MPSOCRTVIF
|
SA_DEPL_HANDLER, // SADPL
|
||||||
COMMON_CLASS_ID_END // [EXPORT] : [END]
|
MPSOC_RETURN_VALUES_IF, // MPSOCRTVIF
|
||||||
|
SUPV_RETURN_VALUES_IF, // SPVRTVIF
|
||||||
|
COMMON_CLASS_ID_END // [EXPORT] : [END]
|
||||||
};
|
};
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -1,6 +1,8 @@
|
|||||||
#include "commonConfig.h"
|
#include "commonConfig.h"
|
||||||
#include "tmtc/apid.h"
|
|
||||||
#include "fsfw/tmtcpacket/SpacePacket.h"
|
|
||||||
|
|
||||||
const Version common::OBSW_VERSION { OBSW_VERSION_MAJOR, OBSW_VERSION_MINOR, OBSW_VERSION_REVISION, OBSW_VERSION_CST_GIT_SHA1 };
|
#include "fsfw/tmtcpacket/SpacePacket.h"
|
||||||
|
#include "tmtc/apid.h"
|
||||||
|
|
||||||
|
const fsfw::Version common::OBSW_VERSION{OBSW_VERSION_MAJOR, OBSW_VERSION_MINOR,
|
||||||
|
OBSW_VERSION_REVISION, OBSW_VERSION_CST_GIT_SHA1};
|
||||||
const uint16_t common::PUS_PACKET_ID = spacepacket::getTcSpacePacketIdFromApid(apid::EIVE_OBSW);
|
const uint16_t common::PUS_PACKET_ID = spacepacket::getTcSpacePacketIdFromApid(apid::EIVE_OBSW);
|
||||||
|
@ -33,7 +33,10 @@ static constexpr uint8_t OBSW_VERSION_REVISION = @OBSW_VERSION_REVISION@;
|
|||||||
// CST: Commits since tag
|
// CST: Commits since tag
|
||||||
static const char OBSW_VERSION_CST_GIT_SHA1[] = "@OBSW_VERSION_CST_GIT_SHA1@";
|
static const char OBSW_VERSION_CST_GIT_SHA1[] = "@OBSW_VERSION_CST_GIT_SHA1@";
|
||||||
|
|
||||||
extern const Version OBSW_VERSION;
|
|
||||||
|
static constexpr uint32_t OBSW_MAX_SCHEDULED_TCS = @OBSW_MAX_SCHEDULED_TCS@;
|
||||||
|
|
||||||
|
extern const fsfw::Version OBSW_VERSION;
|
||||||
|
|
||||||
extern const uint16_t PUS_PACKET_ID;
|
extern const uint16_t PUS_PACKET_ID;
|
||||||
|
|
||||||
|
@ -4,102 +4,125 @@
|
|||||||
#include <cstdint>
|
#include <cstdint>
|
||||||
|
|
||||||
namespace objects {
|
namespace objects {
|
||||||
enum commonObjects: uint32_t {
|
enum commonObjects : uint32_t {
|
||||||
/* First Byte 0x50-0x52 reserved for PUS Services **/
|
/* First Byte 0x50-0x52 reserved for PUS Services **/
|
||||||
CCSDS_PACKET_DISTRIBUTOR = 0x50000100,
|
CCSDS_PACKET_DISTRIBUTOR = 0x50000100,
|
||||||
PUS_PACKET_DISTRIBUTOR = 0x50000200,
|
PUS_PACKET_DISTRIBUTOR = 0x50000200,
|
||||||
TMTC_BRIDGE = 0x50000300,
|
TMTC_BRIDGE = 0x50000300,
|
||||||
TMTC_POLLING_TASK = 0x50000400,
|
TMTC_POLLING_TASK = 0x50000400,
|
||||||
FILE_SYSTEM_HANDLER = 0x50000500,
|
FILE_SYSTEM_HANDLER = 0x50000500,
|
||||||
SDC_MANAGER = 0x50000550,
|
SDC_MANAGER = 0x50000550,
|
||||||
PTME = 0x50000600,
|
PTME = 0x50000600,
|
||||||
PDEC_HANDLER = 0x50000700,
|
PDEC_HANDLER = 0x50000700,
|
||||||
CCSDS_HANDLER = 0x50000800,
|
CCSDS_HANDLER = 0x50000800,
|
||||||
|
|
||||||
/* 0x43 ('C') for Controllers */
|
/* 0x43 ('C') for Controllers */
|
||||||
THERMAL_CONTROLLER = 0x43400001,
|
THERMAL_CONTROLLER = 0x43400001,
|
||||||
ACS_CONTROLLER = 0x43100002,
|
ACS_CONTROLLER = 0x43100002,
|
||||||
CORE_CONTROLLER = 0x43000003,
|
CORE_CONTROLLER = 0x43000003,
|
||||||
|
|
||||||
/* 0x44 ('D') for device handlers */
|
/* 0x44 ('D') for device handlers */
|
||||||
P60DOCK_HANDLER = 0x44250000,
|
MGM_0_LIS3_HANDLER = 0x44120006,
|
||||||
PDU1_HANDLER = 0x44250001,
|
MGM_1_RM3100_HANDLER = 0x44120107,
|
||||||
PDU2_HANDLER = 0x44250002,
|
MGM_2_LIS3_HANDLER = 0x44120208,
|
||||||
ACU_HANDLER = 0x44250003,
|
MGM_3_RM3100_HANDLER = 0x44120309,
|
||||||
BPX_BATT_HANDLER = 0x44260000,
|
GYRO_0_ADIS_HANDLER = 0x44120010,
|
||||||
TMP1075_HANDLER_1 = 0x44420004,
|
GYRO_1_L3G_HANDLER = 0x44120111,
|
||||||
TMP1075_HANDLER_2 = 0x44420005,
|
GYRO_2_ADIS_HANDLER = 0x44120212,
|
||||||
MGM_0_LIS3_HANDLER = 0x44120006,
|
GYRO_3_L3G_HANDLER = 0x44120313,
|
||||||
MGM_1_RM3100_HANDLER = 0x44120107,
|
RW1 = 0x44120047,
|
||||||
MGM_2_LIS3_HANDLER = 0x44120208,
|
RW2 = 0x44120148,
|
||||||
MGM_3_RM3100_HANDLER = 0x44120309,
|
RW3 = 0x44120249,
|
||||||
GYRO_0_ADIS_HANDLER = 0x44120010,
|
RW4 = 0x44120350,
|
||||||
GYRO_1_L3G_HANDLER = 0x44120111,
|
STAR_TRACKER = 0x44130001,
|
||||||
GYRO_2_ADIS_HANDLER = 0x44120212,
|
GPS_CONTROLLER = 0x44130045,
|
||||||
GYRO_3_L3G_HANDLER = 0x44120313,
|
|
||||||
PLPCDU_HANDLER = 0x44300000,
|
|
||||||
|
|
||||||
IMTQ_HANDLER = 0x44140014,
|
IMTQ_HANDLER = 0x44140014,
|
||||||
PLOC_MPSOC_HANDLER = 0x44330015,
|
TMP1075_HANDLER_1 = 0x44420004,
|
||||||
PLOC_SUPERVISOR_HANDLER = 0x44330016,
|
TMP1075_HANDLER_2 = 0x44420005,
|
||||||
PLOC_SUPERVISOR_HELPER = 0x44330017,
|
PCDU_HANDLER = 0x442000A1,
|
||||||
|
P60DOCK_HANDLER = 0x44250000,
|
||||||
|
PDU1_HANDLER = 0x44250001,
|
||||||
|
PDU2_HANDLER = 0x44250002,
|
||||||
|
ACU_HANDLER = 0x44250003,
|
||||||
|
BPX_BATT_HANDLER = 0x44260000,
|
||||||
|
PLPCDU_HANDLER = 0x44300000,
|
||||||
|
RAD_SENSOR = 0x443200A5,
|
||||||
|
PLOC_UPDATER = 0x44330000,
|
||||||
|
PLOC_MEMORY_DUMPER = 0x44330001,
|
||||||
|
STR_HELPER = 0x44330002,
|
||||||
|
PLOC_MPSOC_HELPER = 0x44330003,
|
||||||
|
AXI_PTME_CONFIG = 0x44330004,
|
||||||
|
PTME_CONFIG = 0x44330005,
|
||||||
|
PLOC_MPSOC_HANDLER = 0x44330015,
|
||||||
|
PLOC_SUPERVISOR_HANDLER = 0x44330016,
|
||||||
|
PLOC_SUPERVISOR_HELPER = 0x44330017,
|
||||||
|
SOLAR_ARRAY_DEPL_HANDLER = 0x444100A2,
|
||||||
|
HEATER_HANDLER = 0x444100A4,
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Not yet specified which pt1000 will measure which device/location in the satellite.
|
* Not yet specified which pt1000 will measure which device/location in the satellite.
|
||||||
* Therefore object ids are named according to the IC naming of the RTDs in the schematic.
|
* Therefore object ids are named according to the IC naming of the RTDs in the schematic.
|
||||||
*/
|
*/
|
||||||
RTD_IC_3 = 0x44420016,
|
RTD_0_IC3_PLOC_HEATSPREADER = 0x44420016,
|
||||||
RTD_IC_4 = 0x44420017,
|
RTD_1_IC4_PLOC_MISSIONBOARD = 0x44420017,
|
||||||
RTD_IC_5 = 0x44420018,
|
RTD_2_IC5_4K_CAMERA = 0x44420018,
|
||||||
RTD_IC_6 = 0x44420019,
|
RTD_3_IC6_DAC_HEATSPREADER = 0x44420019,
|
||||||
RTD_IC_7 = 0x44420020,
|
RTD_4_IC7_STARTRACKER = 0x44420020,
|
||||||
RTD_IC_8 = 0x44420021,
|
RTD_5_IC8_RW1_MX_MY = 0x44420021,
|
||||||
RTD_IC_9 = 0x44420022,
|
RTD_6_IC9_DRO = 0x44420022,
|
||||||
RTD_IC_10 = 0x44420023,
|
RTD_7_IC10_SCEX = 0x44420023,
|
||||||
RTD_IC_11 = 0x44420024,
|
RTD_8_IC11_X8 = 0x44420024,
|
||||||
RTD_IC_12 = 0x44420025,
|
RTD_9_IC12_HPA = 0x44420025,
|
||||||
RTD_IC_13 = 0x44420026,
|
RTD_10_IC13_PL_TX = 0x44420026,
|
||||||
RTD_IC_14 = 0x44420027,
|
RTD_11_IC14_MPA = 0x44420027,
|
||||||
RTD_IC_15 = 0x44420028,
|
RTD_12_IC15_ACU = 0x44420028,
|
||||||
RTD_IC_16 = 0x44420029,
|
RTD_13_IC16_PLPCDU_HEATSPREADER = 0x44420029,
|
||||||
RTD_IC_17 = 0x44420030,
|
RTD_14_IC17_TCS_BOARD = 0x44420030,
|
||||||
RTD_IC_18 = 0x44420031,
|
RTD_15_IC18_IMTQ = 0x44420031,
|
||||||
|
|
||||||
SUS_0 = 0x44120032,
|
// Name convention for SUS devices
|
||||||
SUS_1 = 0x44120033,
|
// SUS_<IDX>_<N/R>_LOC_X<F/M/B>Y<F/M/B>Z<F/M/B>_PT_<DIR><F/B>
|
||||||
SUS_2 = 0x44120034,
|
// LOC: Location
|
||||||
SUS_3 = 0x44120035,
|
// PT: Pointing
|
||||||
SUS_4 = 0x44120036,
|
// N/R: Nominal/Redundant
|
||||||
SUS_5 = 0x44120037,
|
// F/M/B: Forward/Middle/Backwards
|
||||||
SUS_6 = 0x44120038,
|
SUS_0_N_LOC_XFYFZM_PT_XF = 0x44120032,
|
||||||
SUS_7 = 0x44120039,
|
SUS_6_R_LOC_XFYBZM_PT_XF = 0x44120038,
|
||||||
SUS_8 = 0x44120040,
|
|
||||||
SUS_9 = 0x44120041,
|
|
||||||
SUS_10 = 0x44120042,
|
|
||||||
SUS_11 = 0x44120043,
|
|
||||||
|
|
||||||
GPS_CONTROLLER = 0x44130045,
|
SUS_1_N_LOC_XBYFZM_PT_XB = 0x44120033,
|
||||||
|
SUS_7_R_LOC_XBYBZM_PT_XB = 0x44120039,
|
||||||
|
|
||||||
RW1 = 0x44120047,
|
SUS_2_N_LOC_XFYBZB_PT_YB = 0x44120034,
|
||||||
RW2 = 0x44120148,
|
SUS_8_R_LOC_XBYBZB_PT_YB = 0x44120040,
|
||||||
RW3 = 0x44120249,
|
|
||||||
RW4 = 0x44120350,
|
|
||||||
|
|
||||||
STAR_TRACKER = 0x44130001,
|
SUS_3_N_LOC_XFYBZF_PT_YF = 0x44120035,
|
||||||
|
SUS_9_R_LOC_XBYBZB_PT_YF = 0x44120041,
|
||||||
|
|
||||||
PLOC_UPDATER = 0x44330000,
|
SUS_4_N_LOC_XMYFZF_PT_ZF = 0x44120036,
|
||||||
PLOC_MEMORY_DUMPER = 0x44330001,
|
SUS_10_N_LOC_XMYBZF_PT_ZF = 0x44120042,
|
||||||
STR_HELPER = 0x44330002,
|
|
||||||
PLOC_MPSOC_HELPER = 0x44330003,
|
|
||||||
AXI_PTME_CONFIG = 44330004,
|
|
||||||
PTME_CONFIG = 44330005,
|
|
||||||
|
|
||||||
// 0x73 ('s') for assemblies and system/subsystem components
|
SUS_5_N_LOC_XFYMZB_PT_ZB = 0x44120037,
|
||||||
ACS_BOARD_ASS = 0x73000001,
|
SUS_11_R_LOC_XBYMZB_PT_ZB = 0x44120043,
|
||||||
SUS_BOARD_ASS = 0x73000002,
|
|
||||||
TCS_BOARD_ASS = 0x73000003
|
SYRLINKS_HK_HANDLER = 0x445300A3,
|
||||||
|
|
||||||
|
// 0x60 for other stuff
|
||||||
|
HEATER_0_PLOC_PROC_BRD = 0x60000000,
|
||||||
|
HEATER_1_PCDU_BRD = 0x60000001,
|
||||||
|
HEATER_2_ACS_BRD = 0x60000002,
|
||||||
|
HEATER_3_OBC_BRD = 0x60000003,
|
||||||
|
HEATER_4_CAMERA = 0x60000004,
|
||||||
|
HEATER_5_STR = 0x60000005,
|
||||||
|
HEATER_6_DRO = 0x60000006,
|
||||||
|
HEATER_7_HPA = 0x60000007,
|
||||||
|
|
||||||
|
// 0x73 ('s') for assemblies and system/subsystem components
|
||||||
|
ACS_BOARD_ASS = 0x73000001,
|
||||||
|
SUS_BOARD_ASS = 0x73000002,
|
||||||
|
TCS_BOARD_ASS = 0x73000003,
|
||||||
|
RW_ASS = 0x73000004
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
#endif /* COMMON_CONFIG_COMMONOBJECTS_H_ */
|
#endif /* COMMON_CONFIG_COMMONOBJECTS_H_ */
|
||||||
|
@ -4,36 +4,36 @@
|
|||||||
#include <fsfw/events/fwSubsystemIdRanges.h>
|
#include <fsfw/events/fwSubsystemIdRanges.h>
|
||||||
|
|
||||||
namespace SUBSYSTEM_ID {
|
namespace SUBSYSTEM_ID {
|
||||||
enum: uint8_t {
|
enum : uint8_t {
|
||||||
COMMON_SUBSYSTEM_ID_START = FW_SUBSYSTEM_ID_RANGE,
|
COMMON_SUBSYSTEM_ID_START = FW_SUBSYSTEM_ID_RANGE,
|
||||||
ACS_SUBSYSTEM = 112,
|
ACS_SUBSYSTEM = 112,
|
||||||
PCDU_HANDLER = 113,
|
PCDU_HANDLER = 113,
|
||||||
HEATER_HANDLER = 114,
|
HEATER_HANDLER = 114,
|
||||||
SA_DEPL_HANDLER = 115,
|
SA_DEPL_HANDLER = 115,
|
||||||
PLOC_MPSOC_HANDLER = 116,
|
PLOC_MPSOC_HANDLER = 116,
|
||||||
IMTQ_HANDLER = 117,
|
IMTQ_HANDLER = 117,
|
||||||
RW_HANDLER = 118,
|
RW_HANDLER = 118,
|
||||||
STR_HANDLER = 119,
|
STR_HANDLER = 119,
|
||||||
PLOC_SUPERVISOR_HANDLER = 120,
|
PLOC_SUPERVISOR_HANDLER = 120,
|
||||||
FILE_SYSTEM = 121,
|
FILE_SYSTEM = 121,
|
||||||
PLOC_UPDATER = 122,
|
PLOC_UPDATER = 122,
|
||||||
PLOC_MEMORY_DUMPER = 123,
|
PLOC_MEMORY_DUMPER = 123,
|
||||||
PDEC_HANDLER = 124,
|
PDEC_HANDLER = 124,
|
||||||
STR_HELPER = 125,
|
STR_HELPER = 125,
|
||||||
PLOC_MPSOC_HELPER = 126,
|
PLOC_MPSOC_HELPER = 126,
|
||||||
PL_PCDU_HANDLER = 127,
|
PL_PCDU_HANDLER = 127,
|
||||||
ACS_BOARD_ASS = 128,
|
ACS_BOARD_ASS = 128,
|
||||||
SUS_BOARD_ASS = 129,
|
SUS_BOARD_ASS = 129,
|
||||||
TCS_BOARD_ASS = 130,
|
TCS_BOARD_ASS = 130,
|
||||||
GPS_HANDLER = 131,
|
GPS_HANDLER = 131,
|
||||||
P60_DOCK_HANDLER = 132,
|
P60_DOCK_HANDLER = 132,
|
||||||
PDU1_HANDLER = 133,
|
PDU1_HANDLER = 133,
|
||||||
PDU2_HANDLER = 134,
|
PDU2_HANDLER = 134,
|
||||||
ACU_HANDLER = 135,
|
ACU_HANDLER = 135,
|
||||||
SYRLINKS = 136,
|
PLOC_SUPV_HELPER = 136,
|
||||||
COMMON_SUBSYSTEM_ID_END
|
SYRLINKS = 137,
|
||||||
|
COMMON_SUBSYSTEM_ID_END
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
#endif /* COMMON_CONFIG_COMMONSUBSYSTEMIDS_H_ */
|
#endif /* COMMON_CONFIG_COMMONSUBSYSTEMIDS_H_ */
|
||||||
|
@ -2,8 +2,10 @@
|
|||||||
#define COMMON_CONFIG_DEVCONF_H_
|
#define COMMON_CONFIG_DEVCONF_H_
|
||||||
|
|
||||||
#include <cstdint>
|
#include <cstdint>
|
||||||
#include <fsfw_hal/linux/spi/spiDefinitions.h>
|
|
||||||
#include <fsfw_hal/linux/uart/UartCookie.h>
|
#include "fsfw/timemanager/clockDefinitions.h"
|
||||||
|
#include "fsfw_hal/linux/spi/spiDefinitions.h"
|
||||||
|
#include "fsfw_hal/linux/uart/UartCookie.h"
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* SPI configuration will be contained here to let the device handlers remain independent
|
* SPI configuration will be contained here to let the device handlers remain independent
|
||||||
@ -31,6 +33,7 @@ static constexpr spi::SpiModes DEFAULT_L3G_MODE = spi::SpiModes::MODE_3;
|
|||||||
static const uint32_t SUS_MAX1227_SPI_FREQ = 976'000;
|
static const uint32_t SUS_MAX1227_SPI_FREQ = 976'000;
|
||||||
static constexpr spi::SpiModes SUS_MAX_1227_MODE = spi::SpiModes::MODE_3;
|
static constexpr spi::SpiModes SUS_MAX_1227_MODE = spi::SpiModes::MODE_3;
|
||||||
|
|
||||||
|
static constexpr dur_millis_t RAD_SENSOR_CS_TIMEOUT = 120;
|
||||||
static constexpr uint32_t DEFAULT_MAX_1227_SPEED = 976'000;
|
static constexpr uint32_t DEFAULT_MAX_1227_SPEED = 976'000;
|
||||||
static constexpr spi::SpiModes DEFAULT_MAX_1227_MODE = spi::SpiModes::MODE_3;
|
static constexpr spi::SpiModes DEFAULT_MAX_1227_MODE = spi::SpiModes::MODE_3;
|
||||||
|
|
||||||
@ -42,10 +45,11 @@ static constexpr spi::SpiModes DEFAULT_ADIS16507_MODE = spi::SpiModes::MODE_3;
|
|||||||
static constexpr uint32_t RW_SPEED = 300'000;
|
static constexpr uint32_t RW_SPEED = 300'000;
|
||||||
static constexpr spi::SpiModes RW_MODE = spi::SpiModes::MODE_0;
|
static constexpr spi::SpiModes RW_MODE = spi::SpiModes::MODE_0;
|
||||||
|
|
||||||
|
static constexpr dur_millis_t RTD_CS_TIMEOUT = 50;
|
||||||
static constexpr uint32_t RTD_SPEED = 2'000'000;
|
static constexpr uint32_t RTD_SPEED = 2'000'000;
|
||||||
static constexpr spi::SpiModes RTD_MODE = spi::SpiModes::MODE_3;
|
static constexpr spi::SpiModes RTD_MODE = spi::SpiModes::MODE_3;
|
||||||
|
|
||||||
}
|
} // namespace spi
|
||||||
|
|
||||||
namespace uart {
|
namespace uart {
|
||||||
|
|
||||||
@ -53,9 +57,9 @@ static constexpr size_t HYPERION_GPS_REPLY_MAX_BUFFER = 1024;
|
|||||||
static constexpr UartBaudRate SYRLINKS_BAUD = UartBaudRate::RATE_38400;
|
static constexpr UartBaudRate SYRLINKS_BAUD = UartBaudRate::RATE_38400;
|
||||||
static constexpr UartBaudRate GNSS_BAUD = UartBaudRate::RATE_9600;
|
static constexpr UartBaudRate GNSS_BAUD = UartBaudRate::RATE_9600;
|
||||||
static constexpr UartBaudRate PLOC_MPSOC_BAUD = UartBaudRate::RATE_115200;
|
static constexpr UartBaudRate PLOC_MPSOC_BAUD = UartBaudRate::RATE_115200;
|
||||||
static constexpr UartBaudRate PLOC_SUPERVISOR_BAUD = UartBaudRate::RATE_115200;
|
static constexpr UartBaudRate PLOC_SUPV_BAUD = UartBaudRate::RATE_115200;
|
||||||
static constexpr UartBaudRate STAR_TRACKER_BAUD = UartBaudRate::RATE_921600;
|
static constexpr UartBaudRate STAR_TRACKER_BAUD = UartBaudRate::RATE_921600;
|
||||||
|
|
||||||
}
|
} // namespace uart
|
||||||
|
|
||||||
#endif /* COMMON_CONFIG_DEVCONF_H_ */
|
#endif /* COMMON_CONFIG_DEVCONF_H_ */
|
||||||
|
@ -3,18 +3,18 @@
|
|||||||
|
|
||||||
#include <cstdint>
|
#include <cstdint>
|
||||||
|
|
||||||
namespace heaterSwitches {
|
namespace heater {
|
||||||
enum switcherList: uint8_t {
|
enum Switchers : uint8_t {
|
||||||
HEATER_0,
|
HEATER_0_OBC_BRD,
|
||||||
HEATER_1,
|
HEATER_1_PLOC_PROC_BRD,
|
||||||
HEATER_2,
|
HEATER_2_ACS_BRD,
|
||||||
HEATER_3,
|
HEATER_3_PCDU_PDU,
|
||||||
HEATER_4,
|
HEATER_4_CAMERA,
|
||||||
HEATER_5,
|
HEATER_5_STR,
|
||||||
HEATER_6,
|
HEATER_6_DRO,
|
||||||
HEATER_7,
|
HEATER_7_HPA,
|
||||||
NUMBER_OF_SWITCHES
|
NUMBER_OF_SWITCHES
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif /* FSFWCONFIG_DEVICES_HEATERSWITCHERLIST_H_ */
|
#endif /* FSFWCONFIG_DEVICES_HEATERSWITCHERLIST_H_ */
|
||||||
|
@ -19,7 +19,6 @@ static constexpr uint8_t LIVE_TM = 0;
|
|||||||
static constexpr uint32_t MAX_PATH_SIZE = 100;
|
static constexpr uint32_t MAX_PATH_SIZE = 100;
|
||||||
static constexpr uint32_t MAX_FILENAME_SIZE = 50;
|
static constexpr uint32_t MAX_FILENAME_SIZE = 50;
|
||||||
|
|
||||||
}
|
} // namespace config
|
||||||
|
|
||||||
|
|
||||||
#endif /* COMMON_CONFIG_DEFINITIONS_H_ */
|
#endif /* COMMON_CONFIG_DEFINITIONS_H_ */
|
||||||
|
@ -12,8 +12,7 @@
|
|||||||
* APID is a 11 bit number
|
* APID is a 11 bit number
|
||||||
*/
|
*/
|
||||||
namespace apid {
|
namespace apid {
|
||||||
static const uint16_t EIVE_OBSW = 0x65;
|
static const uint16_t EIVE_OBSW = 0x65;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
#endif /* FSFWCONFIG_TMTC_APID_H_ */
|
#endif /* FSFWCONFIG_TMTC_APID_H_ */
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
#ifndef CONFIG_TMTC_PUSIDS_HPP_
|
#ifndef COMMON_CONFIG_TMTC_PUSIDS_H_
|
||||||
#define CONFIG_TMTC_PUSIDS_HPP_
|
#define COMMON_CONFIG_TMTC_PUSIDS_H_
|
||||||
|
|
||||||
namespace pus {
|
namespace pus {
|
||||||
enum Ids {
|
enum Ids {
|
||||||
@ -11,6 +11,7 @@ enum Ids {
|
|||||||
PUS_SERVICE_6 = 6,
|
PUS_SERVICE_6 = 6,
|
||||||
PUS_SERVICE_8 = 8,
|
PUS_SERVICE_8 = 8,
|
||||||
PUS_SERVICE_9 = 9,
|
PUS_SERVICE_9 = 9,
|
||||||
|
PUS_SERVICE_11 = 11,
|
||||||
PUS_SERVICE_17 = 17,
|
PUS_SERVICE_17 = 17,
|
||||||
PUS_SERVICE_19 = 19,
|
PUS_SERVICE_19 = 19,
|
||||||
PUS_SERVICE_20 = 20,
|
PUS_SERVICE_20 = 20,
|
||||||
@ -20,4 +21,4 @@ enum Ids {
|
|||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif /* CONFIG_TMTC_PUSIDS_HPP_ */
|
#endif /* COMMON_CONFIG_TMTC_PUSIDS_H_ */
|
42
dummies/AcuDummy.cpp
Normal file
42
dummies/AcuDummy.cpp
Normal file
@ -0,0 +1,42 @@
|
|||||||
|
#include "AcuDummy.h"
|
||||||
|
|
||||||
|
#include <mission/devices/devicedefinitions/GomspaceDefinitions.h>
|
||||||
|
|
||||||
|
AcuDummy::AcuDummy(object_id_t objectId, object_id_t comif, CookieIF *comCookie)
|
||||||
|
: DeviceHandlerBase(objectId, comif, comCookie) {}
|
||||||
|
|
||||||
|
AcuDummy::~AcuDummy() {}
|
||||||
|
|
||||||
|
void AcuDummy::doStartUp() {}
|
||||||
|
|
||||||
|
void AcuDummy::doShutDown() {}
|
||||||
|
|
||||||
|
ReturnValue_t AcuDummy::buildNormalDeviceCommand(DeviceCommandId_t *id) { return NOTHING_TO_SEND; }
|
||||||
|
|
||||||
|
ReturnValue_t AcuDummy::buildTransitionDeviceCommand(DeviceCommandId_t *id) {
|
||||||
|
return NOTHING_TO_SEND;
|
||||||
|
}
|
||||||
|
|
||||||
|
ReturnValue_t AcuDummy::buildCommandFromCommand(DeviceCommandId_t deviceCommand,
|
||||||
|
const uint8_t *commandData, size_t commandDataLen) {
|
||||||
|
return RETURN_OK;
|
||||||
|
}
|
||||||
|
|
||||||
|
ReturnValue_t AcuDummy::scanForReply(const uint8_t *start, size_t len, DeviceCommandId_t *foundId,
|
||||||
|
size_t *foundLen) {
|
||||||
|
return RETURN_OK;
|
||||||
|
}
|
||||||
|
|
||||||
|
ReturnValue_t AcuDummy::interpretDeviceReply(DeviceCommandId_t id, const uint8_t *packet) {
|
||||||
|
return RETURN_OK;
|
||||||
|
}
|
||||||
|
|
||||||
|
void AcuDummy::fillCommandAndReplyMap() {}
|
||||||
|
|
||||||
|
uint32_t AcuDummy::getTransitionDelayMs(Mode_t modeFrom, Mode_t modeTo) { return 500; }
|
||||||
|
|
||||||
|
ReturnValue_t AcuDummy::initializeLocalDataPool(localpool::DataPool &localDataPoolMap,
|
||||||
|
LocalDataPoolManager &poolManager) {
|
||||||
|
localDataPoolMap.emplace(P60System::pool::ACU_TEMPERATURES, new PoolEntry<float>(3));
|
||||||
|
return HasReturnvaluesIF::RETURN_OK;
|
||||||
|
}
|
33
dummies/AcuDummy.h
Normal file
33
dummies/AcuDummy.h
Normal file
@ -0,0 +1,33 @@
|
|||||||
|
#ifndef DUMMIES_ACUDUMMY_H_
|
||||||
|
#define DUMMIES_ACUDUMMY_H_
|
||||||
|
|
||||||
|
#include <fsfw/devicehandlers/DeviceHandlerBase.h>
|
||||||
|
|
||||||
|
class AcuDummy : public DeviceHandlerBase {
|
||||||
|
public:
|
||||||
|
static const DeviceCommandId_t SIMPLE_COMMAND = 1;
|
||||||
|
static const DeviceCommandId_t PERIODIC_REPLY = 2;
|
||||||
|
|
||||||
|
static const uint8_t SIMPLE_COMMAND_DATA = 1;
|
||||||
|
static const uint8_t PERIODIC_REPLY_DATA = 2;
|
||||||
|
|
||||||
|
AcuDummy(object_id_t objectId, object_id_t comif, CookieIF *comCookie);
|
||||||
|
virtual ~AcuDummy();
|
||||||
|
|
||||||
|
protected:
|
||||||
|
void doStartUp() override;
|
||||||
|
void doShutDown() override;
|
||||||
|
ReturnValue_t buildNormalDeviceCommand(DeviceCommandId_t *id) override;
|
||||||
|
ReturnValue_t buildTransitionDeviceCommand(DeviceCommandId_t *id) override;
|
||||||
|
ReturnValue_t buildCommandFromCommand(DeviceCommandId_t deviceCommand, const uint8_t *commandData,
|
||||||
|
size_t commandDataLen) override;
|
||||||
|
ReturnValue_t scanForReply(const uint8_t *start, size_t len, DeviceCommandId_t *foundId,
|
||||||
|
size_t *foundLen) override;
|
||||||
|
ReturnValue_t interpretDeviceReply(DeviceCommandId_t id, const uint8_t *packet) override;
|
||||||
|
void fillCommandAndReplyMap() override;
|
||||||
|
uint32_t getTransitionDelayMs(Mode_t modeFrom, Mode_t modeTo) override;
|
||||||
|
ReturnValue_t initializeLocalDataPool(localpool::DataPool &localDataPoolMap,
|
||||||
|
LocalDataPoolManager &poolManager) override;
|
||||||
|
};
|
||||||
|
|
||||||
|
#endif /* DUMMIES_ACUDUMMY_H_ */
|
55
dummies/BpxDummy.cpp
Normal file
55
dummies/BpxDummy.cpp
Normal file
@ -0,0 +1,55 @@
|
|||||||
|
#include "BpxDummy.h"
|
||||||
|
|
||||||
|
#include <mission/devices/devicedefinitions/BpxBatteryDefinitions.h>
|
||||||
|
|
||||||
|
BpxDummy::BpxDummy(object_id_t objectId, object_id_t comif, CookieIF *comCookie)
|
||||||
|
: DeviceHandlerBase(objectId, comif, comCookie) {}
|
||||||
|
|
||||||
|
BpxDummy::~BpxDummy() {}
|
||||||
|
|
||||||
|
void BpxDummy::doStartUp() {}
|
||||||
|
|
||||||
|
void BpxDummy::doShutDown() {}
|
||||||
|
|
||||||
|
ReturnValue_t BpxDummy::buildNormalDeviceCommand(DeviceCommandId_t *id) { return NOTHING_TO_SEND; }
|
||||||
|
|
||||||
|
ReturnValue_t BpxDummy::buildTransitionDeviceCommand(DeviceCommandId_t *id) {
|
||||||
|
return NOTHING_TO_SEND;
|
||||||
|
}
|
||||||
|
|
||||||
|
ReturnValue_t BpxDummy::buildCommandFromCommand(DeviceCommandId_t deviceCommand,
|
||||||
|
const uint8_t *commandData, size_t commandDataLen) {
|
||||||
|
return RETURN_OK;
|
||||||
|
}
|
||||||
|
|
||||||
|
ReturnValue_t BpxDummy::scanForReply(const uint8_t *start, size_t len, DeviceCommandId_t *foundId,
|
||||||
|
size_t *foundLen) {
|
||||||
|
return RETURN_OK;
|
||||||
|
}
|
||||||
|
|
||||||
|
ReturnValue_t BpxDummy::interpretDeviceReply(DeviceCommandId_t id, const uint8_t *packet) {
|
||||||
|
return RETURN_OK;
|
||||||
|
}
|
||||||
|
|
||||||
|
void BpxDummy::fillCommandAndReplyMap() {}
|
||||||
|
|
||||||
|
uint32_t BpxDummy::getTransitionDelayMs(Mode_t modeFrom, Mode_t modeTo) { return 500; }
|
||||||
|
|
||||||
|
ReturnValue_t BpxDummy::initializeLocalDataPool(localpool::DataPool &localDataPoolMap,
|
||||||
|
LocalDataPoolManager &poolManager) {
|
||||||
|
localDataPoolMap.emplace(BpxBattery::BATT_TEMP_1, &battTemp1);
|
||||||
|
localDataPoolMap.emplace(BpxBattery::BATT_TEMP_2, &battTemp2);
|
||||||
|
localDataPoolMap.emplace(BpxBattery::BATT_TEMP_3, &battTemp3);
|
||||||
|
localDataPoolMap.emplace(BpxBattery::BATT_TEMP_4, &battTemp4);
|
||||||
|
localDataPoolMap.emplace(BpxBattery::CHARGE_CURRENT, &chargeCurrent);
|
||||||
|
localDataPoolMap.emplace(BpxBattery::DISCHARGE_CURRENT, &dischargeCurrent);
|
||||||
|
localDataPoolMap.emplace(BpxBattery::HEATER_CURRENT, &heaterCurrent);
|
||||||
|
localDataPoolMap.emplace(BpxBattery::BATT_VOLTAGE, &battVolt);
|
||||||
|
localDataPoolMap.emplace(BpxBattery::REBOOT_COUNTER, &rebootCounter);
|
||||||
|
localDataPoolMap.emplace(BpxBattery::BOOTCAUSE, &bootCause);
|
||||||
|
|
||||||
|
localDataPoolMap.emplace(BpxBattery::BATTERY_HEATER_MODE, &battheatMode);
|
||||||
|
localDataPoolMap.emplace(BpxBattery::BATTHEAT_LOW_LIMIT, &battheatLow);
|
||||||
|
localDataPoolMap.emplace(BpxBattery::BATTHEAT_HIGH_LIMIT, &battheatHigh);
|
||||||
|
return HasReturnvaluesIF::RETURN_OK;
|
||||||
|
}
|
48
dummies/BpxDummy.h
Normal file
48
dummies/BpxDummy.h
Normal file
@ -0,0 +1,48 @@
|
|||||||
|
#ifndef DUMMIES_BPXDUMMY_H_
|
||||||
|
#define DUMMIES_BPXDUMMY_H_
|
||||||
|
|
||||||
|
#include <fsfw/devicehandlers/DeviceHandlerBase.h>
|
||||||
|
|
||||||
|
class BpxDummy : public DeviceHandlerBase {
|
||||||
|
public:
|
||||||
|
static const DeviceCommandId_t SIMPLE_COMMAND = 1;
|
||||||
|
static const DeviceCommandId_t PERIODIC_REPLY = 2;
|
||||||
|
|
||||||
|
static const uint8_t SIMPLE_COMMAND_DATA = 1;
|
||||||
|
static const uint8_t PERIODIC_REPLY_DATA = 2;
|
||||||
|
|
||||||
|
BpxDummy(object_id_t objectId, object_id_t comif, CookieIF *comCookie);
|
||||||
|
virtual ~BpxDummy();
|
||||||
|
|
||||||
|
protected:
|
||||||
|
void doStartUp() override;
|
||||||
|
void doShutDown() override;
|
||||||
|
ReturnValue_t buildNormalDeviceCommand(DeviceCommandId_t *id) override;
|
||||||
|
ReturnValue_t buildTransitionDeviceCommand(DeviceCommandId_t *id) override;
|
||||||
|
ReturnValue_t buildCommandFromCommand(DeviceCommandId_t deviceCommand, const uint8_t *commandData,
|
||||||
|
size_t commandDataLen) override;
|
||||||
|
ReturnValue_t scanForReply(const uint8_t *start, size_t len, DeviceCommandId_t *foundId,
|
||||||
|
size_t *foundLen) override;
|
||||||
|
ReturnValue_t interpretDeviceReply(DeviceCommandId_t id, const uint8_t *packet) override;
|
||||||
|
void fillCommandAndReplyMap() override;
|
||||||
|
uint32_t getTransitionDelayMs(Mode_t modeFrom, Mode_t modeTo) override;
|
||||||
|
ReturnValue_t initializeLocalDataPool(localpool::DataPool &localDataPoolMap,
|
||||||
|
LocalDataPoolManager &poolManager) override;
|
||||||
|
|
||||||
|
private:
|
||||||
|
PoolEntry<uint16_t> chargeCurrent = PoolEntry<uint16_t>({0});
|
||||||
|
PoolEntry<uint16_t> dischargeCurrent = PoolEntry<uint16_t>({0});
|
||||||
|
PoolEntry<uint16_t> heaterCurrent = PoolEntry<uint16_t>({0});
|
||||||
|
PoolEntry<uint16_t> battVolt = PoolEntry<uint16_t>({0});
|
||||||
|
PoolEntry<int16_t> battTemp1 = PoolEntry<int16_t>({0});
|
||||||
|
PoolEntry<int16_t> battTemp2 = PoolEntry<int16_t>({0});
|
||||||
|
PoolEntry<int16_t> battTemp3 = PoolEntry<int16_t>({0});
|
||||||
|
PoolEntry<int16_t> battTemp4 = PoolEntry<int16_t>({0});
|
||||||
|
PoolEntry<uint32_t> rebootCounter = PoolEntry<uint32_t>({0});
|
||||||
|
PoolEntry<uint8_t> bootCause = PoolEntry<uint8_t>({0});
|
||||||
|
PoolEntry<uint8_t> battheatMode = PoolEntry<uint8_t>({0});
|
||||||
|
PoolEntry<int8_t> battheatLow = PoolEntry<int8_t>({0});
|
||||||
|
PoolEntry<int8_t> battheatHigh = PoolEntry<int8_t>({0});
|
||||||
|
};
|
||||||
|
|
||||||
|
#endif /* DUMMIES_BPXDUMMY_H_ */
|
19
dummies/CMakeLists.txt
Normal file
19
dummies/CMakeLists.txt
Normal file
@ -0,0 +1,19 @@
|
|||||||
|
target_sources(
|
||||||
|
${LIB_DUMMIES}
|
||||||
|
PUBLIC TemperatureSensorsDummy.cpp
|
||||||
|
SusDummy.cpp
|
||||||
|
BpxDummy.cpp
|
||||||
|
ComIFDummy.cpp
|
||||||
|
ComCookieDummy.cpp
|
||||||
|
RwDummy.cpp
|
||||||
|
StarTrackerDummy.cpp
|
||||||
|
SyrlinksDummy.cpp
|
||||||
|
ImtqDummy.cpp
|
||||||
|
AcuDummy.cpp
|
||||||
|
PduDummy.cpp
|
||||||
|
P60DockDummy.cpp
|
||||||
|
GyroAdisDummy.cpp
|
||||||
|
GyroL3GD20Dummy.cpp
|
||||||
|
MgmLIS3MDLDummy.cpp
|
||||||
|
PlPcduDummy.cpp
|
||||||
|
CoreControllerDummy.cpp)
|
5
dummies/ComCookieDummy.cpp
Normal file
5
dummies/ComCookieDummy.cpp
Normal file
@ -0,0 +1,5 @@
|
|||||||
|
#include "ComCookieDummy.h"
|
||||||
|
|
||||||
|
ComCookieDummy::ComCookieDummy() {}
|
||||||
|
|
||||||
|
ComCookieDummy::~ComCookieDummy() {}
|
12
dummies/ComCookieDummy.h
Normal file
12
dummies/ComCookieDummy.h
Normal file
@ -0,0 +1,12 @@
|
|||||||
|
#ifndef TESTS_SRC_FSFW_TESTS_UNIT_DEVICEHANDLER_COMCOOKIEDUMMY_H_
|
||||||
|
#define TESTS_SRC_FSFW_TESTS_UNIT_DEVICEHANDLER_COMCOOKIEDUMMY_H_
|
||||||
|
|
||||||
|
#include "fsfw/devicehandlers/CookieIF.h"
|
||||||
|
|
||||||
|
class ComCookieDummy : public CookieIF {
|
||||||
|
public:
|
||||||
|
ComCookieDummy();
|
||||||
|
virtual ~ComCookieDummy();
|
||||||
|
};
|
||||||
|
|
||||||
|
#endif /* TESTS_SRC_FSFW_TESTS_UNIT_DEVICEHANDLER_COMCOOKIEDUMMY_H_ */
|
21
dummies/ComIFDummy.cpp
Normal file
21
dummies/ComIFDummy.cpp
Normal file
@ -0,0 +1,21 @@
|
|||||||
|
#include "ComIFDummy.h"
|
||||||
|
|
||||||
|
ComIFDummy::ComIFDummy(object_id_t objectId) : SystemObject(objectId) {}
|
||||||
|
|
||||||
|
ComIFDummy::~ComIFDummy() {}
|
||||||
|
|
||||||
|
ReturnValue_t ComIFDummy::initializeInterface(CookieIF *cookie) { return RETURN_OK; }
|
||||||
|
|
||||||
|
ReturnValue_t ComIFDummy::sendMessage(CookieIF *cookie, const uint8_t *sendData, size_t sendLen) {
|
||||||
|
return RETURN_OK;
|
||||||
|
}
|
||||||
|
|
||||||
|
ReturnValue_t ComIFDummy::getSendSuccess(CookieIF *cookie) { return RETURN_OK; }
|
||||||
|
|
||||||
|
ReturnValue_t ComIFDummy::requestReceiveMessage(CookieIF *cookie, size_t requestLen) {
|
||||||
|
return RETURN_OK;
|
||||||
|
}
|
||||||
|
|
||||||
|
ReturnValue_t ComIFDummy::readReceivedMessage(CookieIF *cookie, uint8_t **buffer, size_t *size) {
|
||||||
|
return RETURN_OK;
|
||||||
|
}
|
26
dummies/ComIFDummy.h
Normal file
26
dummies/ComIFDummy.h
Normal file
@ -0,0 +1,26 @@
|
|||||||
|
#ifndef DUMMIES_COMIFDUMMY_H_
|
||||||
|
#define DUMMIES_COMIFDUMMY_H_
|
||||||
|
|
||||||
|
#include <fsfw/devicehandlers/DeviceCommunicationIF.h>
|
||||||
|
#include <fsfw/objectmanager/SystemObject.h>
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief The ComIFMock supports the simulation of various device communication error cases
|
||||||
|
* like incomplete or wrong replies and can be used to test the
|
||||||
|
* DeviceHandlerBase.
|
||||||
|
*/
|
||||||
|
class ComIFDummy : public DeviceCommunicationIF, public SystemObject {
|
||||||
|
public:
|
||||||
|
ComIFDummy(object_id_t objectId);
|
||||||
|
virtual ~ComIFDummy();
|
||||||
|
|
||||||
|
virtual ReturnValue_t initializeInterface(CookieIF *cookie) override;
|
||||||
|
virtual ReturnValue_t sendMessage(CookieIF *cookie, const uint8_t *sendData,
|
||||||
|
size_t sendLen) override;
|
||||||
|
virtual ReturnValue_t getSendSuccess(CookieIF *cookie) override;
|
||||||
|
virtual ReturnValue_t requestReceiveMessage(CookieIF *cookie, size_t requestLen) override;
|
||||||
|
virtual ReturnValue_t readReceivedMessage(CookieIF *cookie, uint8_t **buffer,
|
||||||
|
size_t *size) override;
|
||||||
|
};
|
||||||
|
|
||||||
|
#endif /* DUMMIES_COMIFDUMMY_H_ */
|
55
dummies/CoreControllerDummy.cpp
Normal file
55
dummies/CoreControllerDummy.cpp
Normal file
@ -0,0 +1,55 @@
|
|||||||
|
#include "CoreControllerDummy.h"
|
||||||
|
|
||||||
|
#include <bsp_q7s/core/CoreDefinitions.h>
|
||||||
|
#include <objects/systemObjectList.h>
|
||||||
|
|
||||||
|
#include <cmath>
|
||||||
|
#include <cstdlib>
|
||||||
|
|
||||||
|
CoreControllerDummy::CoreControllerDummy(object_id_t objectId)
|
||||||
|
: ExtendedControllerBase(objectId, objects::NO_OBJECT) {}
|
||||||
|
|
||||||
|
ReturnValue_t CoreControllerDummy::initialize() {
|
||||||
|
static bool done = false;
|
||||||
|
if (not done) {
|
||||||
|
done = true;
|
||||||
|
ReturnValue_t result = ExtendedControllerBase::initialize();
|
||||||
|
if (result != HasReturnvaluesIF::RETURN_OK) {
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return HasReturnvaluesIF::RETURN_OK;
|
||||||
|
}
|
||||||
|
|
||||||
|
ReturnValue_t CoreControllerDummy::handleCommandMessage(CommandMessage* message) {
|
||||||
|
return RETURN_FAILED;
|
||||||
|
}
|
||||||
|
|
||||||
|
void CoreControllerDummy::performControlOperation() { return; }
|
||||||
|
|
||||||
|
ReturnValue_t CoreControllerDummy::initializeLocalDataPool(localpool::DataPool& localDataPoolMap,
|
||||||
|
LocalDataPoolManager& poolManager) {
|
||||||
|
localDataPoolMap.emplace(core::TEMPERATURE, new PoolEntry<float>({0}));
|
||||||
|
localDataPoolMap.emplace(core::PS_VOLTAGE, new PoolEntry<float>({0}));
|
||||||
|
localDataPoolMap.emplace(core::PL_VOLTAGE, new PoolEntry<float>({0}));
|
||||||
|
return HasReturnvaluesIF::RETURN_OK;
|
||||||
|
}
|
||||||
|
|
||||||
|
LocalPoolDataSetBase* CoreControllerDummy::getDataSetHandle(sid_t sid) {
|
||||||
|
switch (sid.ownerSetId) {
|
||||||
|
default:
|
||||||
|
return nullptr;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
ReturnValue_t CoreControllerDummy::checkModeCommand(Mode_t mode, Submode_t submode,
|
||||||
|
uint32_t* msToReachTheMode) {
|
||||||
|
if (submode != SUBMODE_NONE) {
|
||||||
|
return INVALID_SUBMODE;
|
||||||
|
}
|
||||||
|
if ((mode != MODE_OFF) && (mode != MODE_ON) && (mode != MODE_NORMAL)) {
|
||||||
|
return INVALID_MODE;
|
||||||
|
}
|
||||||
|
return RETURN_OK;
|
||||||
|
}
|
21
dummies/CoreControllerDummy.h
Normal file
21
dummies/CoreControllerDummy.h
Normal file
@ -0,0 +1,21 @@
|
|||||||
|
#pragma once
|
||||||
|
|
||||||
|
#include <fsfw/controller/ExtendedControllerBase.h>
|
||||||
|
#include <mission/devices/devicedefinitions/SusDefinitions.h>
|
||||||
|
|
||||||
|
class CoreControllerDummy : public ExtendedControllerBase {
|
||||||
|
public:
|
||||||
|
CoreControllerDummy(object_id_t objectId);
|
||||||
|
|
||||||
|
ReturnValue_t initialize() override;
|
||||||
|
|
||||||
|
protected:
|
||||||
|
virtual ReturnValue_t handleCommandMessage(CommandMessage* message) override;
|
||||||
|
virtual void performControlOperation() override;
|
||||||
|
virtual ReturnValue_t initializeLocalDataPool(localpool::DataPool& localDataPoolMap,
|
||||||
|
LocalDataPoolManager& poolManager) override;
|
||||||
|
virtual LocalPoolDataSetBase* getDataSetHandle(sid_t sid) override;
|
||||||
|
|
||||||
|
virtual ReturnValue_t checkModeCommand(Mode_t mode, Submode_t submode,
|
||||||
|
uint32_t* msToReachTheMode) override;
|
||||||
|
};
|
45
dummies/GyroAdisDummy.cpp
Normal file
45
dummies/GyroAdisDummy.cpp
Normal file
@ -0,0 +1,45 @@
|
|||||||
|
#include "GyroAdisDummy.h"
|
||||||
|
|
||||||
|
#include "mission/devices/devicedefinitions/GyroADIS1650XDefinitions.h"
|
||||||
|
|
||||||
|
GyroAdisDummy::GyroAdisDummy(object_id_t objectId, object_id_t comif, CookieIF *comCookie)
|
||||||
|
: DeviceHandlerBase(objectId, comif, comCookie) {}
|
||||||
|
|
||||||
|
GyroAdisDummy::~GyroAdisDummy() {}
|
||||||
|
|
||||||
|
void GyroAdisDummy::doStartUp() {}
|
||||||
|
|
||||||
|
void GyroAdisDummy::doShutDown() {}
|
||||||
|
|
||||||
|
ReturnValue_t GyroAdisDummy::buildNormalDeviceCommand(DeviceCommandId_t *id) {
|
||||||
|
return NOTHING_TO_SEND;
|
||||||
|
}
|
||||||
|
|
||||||
|
ReturnValue_t GyroAdisDummy::buildTransitionDeviceCommand(DeviceCommandId_t *id) {
|
||||||
|
return NOTHING_TO_SEND;
|
||||||
|
}
|
||||||
|
|
||||||
|
ReturnValue_t GyroAdisDummy::buildCommandFromCommand(DeviceCommandId_t deviceCommand,
|
||||||
|
const uint8_t *commandData,
|
||||||
|
size_t commandDataLen) {
|
||||||
|
return RETURN_OK;
|
||||||
|
}
|
||||||
|
|
||||||
|
ReturnValue_t GyroAdisDummy::scanForReply(const uint8_t *start, size_t len,
|
||||||
|
DeviceCommandId_t *foundId, size_t *foundLen) {
|
||||||
|
return RETURN_OK;
|
||||||
|
}
|
||||||
|
|
||||||
|
ReturnValue_t GyroAdisDummy::interpretDeviceReply(DeviceCommandId_t id, const uint8_t *packet) {
|
||||||
|
return RETURN_OK;
|
||||||
|
}
|
||||||
|
|
||||||
|
void GyroAdisDummy::fillCommandAndReplyMap() {}
|
||||||
|
|
||||||
|
uint32_t GyroAdisDummy::getTransitionDelayMs(Mode_t modeFrom, Mode_t modeTo) { return 500; }
|
||||||
|
|
||||||
|
ReturnValue_t GyroAdisDummy::initializeLocalDataPool(localpool::DataPool &localDataPoolMap,
|
||||||
|
LocalDataPoolManager &poolManager) {
|
||||||
|
localDataPoolMap.emplace(ADIS1650X::TEMPERATURE, new PoolEntry<float>({0.0}));
|
||||||
|
return HasReturnvaluesIF::RETURN_OK;
|
||||||
|
}
|
33
dummies/GyroAdisDummy.h
Normal file
33
dummies/GyroAdisDummy.h
Normal file
@ -0,0 +1,33 @@
|
|||||||
|
#ifndef DUMMIES_GYROADISDUMMY_H_
|
||||||
|
#define DUMMIES_GYROADISDUMMY_H_
|
||||||
|
|
||||||
|
#include <fsfw/devicehandlers/DeviceHandlerBase.h>
|
||||||
|
|
||||||
|
class GyroAdisDummy : public DeviceHandlerBase {
|
||||||
|
public:
|
||||||
|
static const DeviceCommandId_t SIMPLE_COMMAND = 1;
|
||||||
|
static const DeviceCommandId_t PERIODIC_REPLY = 2;
|
||||||
|
|
||||||
|
static const uint8_t SIMPLE_COMMAND_DATA = 1;
|
||||||
|
static const uint8_t PERIODIC_REPLY_DATA = 2;
|
||||||
|
|
||||||
|
GyroAdisDummy(object_id_t objectId, object_id_t comif, CookieIF *comCookie);
|
||||||
|
virtual ~GyroAdisDummy();
|
||||||
|
|
||||||
|
protected:
|
||||||
|
void doStartUp() override;
|
||||||
|
void doShutDown() override;
|
||||||
|
ReturnValue_t buildNormalDeviceCommand(DeviceCommandId_t *id) override;
|
||||||
|
ReturnValue_t buildTransitionDeviceCommand(DeviceCommandId_t *id) override;
|
||||||
|
ReturnValue_t buildCommandFromCommand(DeviceCommandId_t deviceCommand, const uint8_t *commandData,
|
||||||
|
size_t commandDataLen) override;
|
||||||
|
ReturnValue_t scanForReply(const uint8_t *start, size_t len, DeviceCommandId_t *foundId,
|
||||||
|
size_t *foundLen) override;
|
||||||
|
ReturnValue_t interpretDeviceReply(DeviceCommandId_t id, const uint8_t *packet) override;
|
||||||
|
void fillCommandAndReplyMap() override;
|
||||||
|
uint32_t getTransitionDelayMs(Mode_t modeFrom, Mode_t modeTo) override;
|
||||||
|
ReturnValue_t initializeLocalDataPool(localpool::DataPool &localDataPoolMap,
|
||||||
|
LocalDataPoolManager &poolManager) override;
|
||||||
|
};
|
||||||
|
|
||||||
|
#endif /* DUMMIES_GYROADISDUMMY_H_ */
|
48
dummies/GyroL3GD20Dummy.cpp
Normal file
48
dummies/GyroL3GD20Dummy.cpp
Normal file
@ -0,0 +1,48 @@
|
|||||||
|
#include "GyroL3GD20Dummy.h"
|
||||||
|
|
||||||
|
#include "fsfw_hal/devicehandlers/devicedefinitions/GyroL3GD20Definitions.h"
|
||||||
|
|
||||||
|
GyroL3GD20Dummy::GyroL3GD20Dummy(object_id_t objectId, object_id_t comif, CookieIF *comCookie)
|
||||||
|
: DeviceHandlerBase(objectId, comif, comCookie) {}
|
||||||
|
|
||||||
|
GyroL3GD20Dummy::~GyroL3GD20Dummy() {}
|
||||||
|
|
||||||
|
void GyroL3GD20Dummy::doStartUp() {}
|
||||||
|
|
||||||
|
void GyroL3GD20Dummy::doShutDown() {}
|
||||||
|
|
||||||
|
ReturnValue_t GyroL3GD20Dummy::buildNormalDeviceCommand(DeviceCommandId_t *id) {
|
||||||
|
return NOTHING_TO_SEND;
|
||||||
|
}
|
||||||
|
|
||||||
|
ReturnValue_t GyroL3GD20Dummy::buildTransitionDeviceCommand(DeviceCommandId_t *id) {
|
||||||
|
return NOTHING_TO_SEND;
|
||||||
|
}
|
||||||
|
|
||||||
|
ReturnValue_t GyroL3GD20Dummy::buildCommandFromCommand(DeviceCommandId_t deviceCommand,
|
||||||
|
const uint8_t *commandData,
|
||||||
|
size_t commandDataLen) {
|
||||||
|
return RETURN_OK;
|
||||||
|
}
|
||||||
|
|
||||||
|
ReturnValue_t GyroL3GD20Dummy::scanForReply(const uint8_t *start, size_t len,
|
||||||
|
DeviceCommandId_t *foundId, size_t *foundLen) {
|
||||||
|
return RETURN_OK;
|
||||||
|
}
|
||||||
|
|
||||||
|
ReturnValue_t GyroL3GD20Dummy::interpretDeviceReply(DeviceCommandId_t id, const uint8_t *packet) {
|
||||||
|
return RETURN_OK;
|
||||||
|
}
|
||||||
|
|
||||||
|
void GyroL3GD20Dummy::fillCommandAndReplyMap() {}
|
||||||
|
|
||||||
|
uint32_t GyroL3GD20Dummy::getTransitionDelayMs(Mode_t modeFrom, Mode_t modeTo) { return 500; }
|
||||||
|
|
||||||
|
ReturnValue_t GyroL3GD20Dummy::initializeLocalDataPool(localpool::DataPool &localDataPoolMap,
|
||||||
|
LocalDataPoolManager &poolManager) {
|
||||||
|
localDataPoolMap.emplace(L3GD20H::ANG_VELOC_X, new PoolEntry<float>({0.0}));
|
||||||
|
localDataPoolMap.emplace(L3GD20H::ANG_VELOC_Y, new PoolEntry<float>({0.0}));
|
||||||
|
localDataPoolMap.emplace(L3GD20H::ANG_VELOC_Z, new PoolEntry<float>({0.0}));
|
||||||
|
localDataPoolMap.emplace(L3GD20H::TEMPERATURE, new PoolEntry<float>({0.0}));
|
||||||
|
return HasReturnvaluesIF::RETURN_OK;
|
||||||
|
}
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue
Block a user