Compare commits
1 Commits
Author | SHA1 | Date | |
---|---|---|---|
0a11ca6051 |
@ -1,8 +0,0 @@
|
|||||||
---
|
|
||||||
BasedOnStyle: Google
|
|
||||||
IndentWidth: 2
|
|
||||||
---
|
|
||||||
Language: Cpp
|
|
||||||
ColumnLimit: 100
|
|
||||||
ReflowComments: true
|
|
||||||
---
|
|
3
.gitignore
vendored
3
.gitignore
vendored
@ -8,9 +8,6 @@
|
|||||||
!misc/eclipse/**/.cproject
|
!misc/eclipse/**/.cproject
|
||||||
!misc/eclipse/**/.project
|
!misc/eclipse/**/.project
|
||||||
|
|
||||||
#vscode
|
|
||||||
/.vscode
|
|
||||||
|
|
||||||
# Python
|
# Python
|
||||||
__pycache__
|
__pycache__
|
||||||
.idea
|
.idea
|
||||||
|
342
CMakeLists.txt
342
CMakeLists.txt
@ -13,32 +13,34 @@ cmake_minimum_required(VERSION 3.13)
|
|||||||
|
|
||||||
set(CMAKE_SCRIPT_PATH "${CMAKE_CURRENT_SOURCE_DIR}/cmake")
|
set(CMAKE_SCRIPT_PATH "${CMAKE_CURRENT_SOURCE_DIR}/cmake")
|
||||||
|
|
||||||
|
if(TGT_BSP MATCHES "arm/q7s")
|
||||||
|
option(EIVE_BUILD_WATCHDOG "Compile the OBSW watchdog insted" OFF)
|
||||||
|
option(BUILD_Q7S_SIMPLE_MODE OFF "Simple mode with a minimal main function")
|
||||||
|
endif()
|
||||||
|
|
||||||
option(EIVE_ADD_ETL_LIB "Add ETL library" ON)
|
option(ADD_ETL_LIB "Add ETL library" ON)
|
||||||
option(EIVE_ADD_JSON_LIB "Add JSON library" ON)
|
option(ADD_JSON_LIB "Add JSON library" ON)
|
||||||
|
|
||||||
option(EIVE_SYSROOT_MAGIC "Perform sysroot magic which might not be necessary" OFF)
|
option(EIVE_SYSROOT_MAGIC "Perform sysroot magic which might not be necessary" OFF)
|
||||||
option(EIVE_CREATE_UNIQUE_OBSW_BIN "Append username to generated binary name" ON)
|
|
||||||
|
|
||||||
if(NOT FSFW_OSAL)
|
if(NOT FSFW_OSAL)
|
||||||
set(FSFW_OSAL linux CACHE STRING "OS for the FSFW.")
|
set(FSFW_OSAL host CACHE STRING "OS for the FSFW.")
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
if(TGT_BSP)
|
|
||||||
if(TGT_BSP MATCHES "arm/raspberrypi" OR TGT_BSP MATCHES "arm/beagleboneblack")
|
if(TGT_BSP MATCHES "arm/raspberrypi" OR TGT_BSP MATCHES "arm/beagleboneblack")
|
||||||
option(LINUX_CROSS_COMPILE ON)
|
option(LINUX_CROSS_COMPILE ON)
|
||||||
option(EIVE_BUILD_GPSD_GPS_HANDLER "Build GPSD dependent GPS Handler" OFF)
|
|
||||||
elseif(TGT_BSP MATCHES "arm/q7s")
|
|
||||||
option(EIVE_BUILD_GPSD_GPS_HANDLER "Build GPSD dependent GPS Handler" ON)
|
|
||||||
endif()
|
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
# Perform steps like loading toolchain files where applicable.
|
# Perform steps like loading toolchain files where applicable.
|
||||||
include(${CMAKE_SCRIPT_PATH}/PreProjectConfig.cmake)
|
include(${CMAKE_SCRIPT_PATH}/PreProjectConfig.cmake)
|
||||||
pre_project_config()
|
pre_project_config()
|
||||||
|
|
||||||
|
set(PROJECT_NAME_TO_SET eive-obsw-$ENV{USERNAME})
|
||||||
|
if(EIVE_BUILD_WATCHDOG)
|
||||||
|
set(PROJECT_NAME_TO_SET eive-watchdog)
|
||||||
|
endif()
|
||||||
|
|
||||||
# Project Name
|
# Project Name
|
||||||
project(eive-obsw ASM C CXX)
|
project(${PROJECT_NAME_TO_SET} ASM C CXX)
|
||||||
|
|
||||||
################################################################################
|
################################################################################
|
||||||
# Pre-Sources preparation
|
# Pre-Sources preparation
|
||||||
@ -49,42 +51,34 @@ set(CMAKE_CXX_STANDARD 17)
|
|||||||
set(CMAKE_CXX_STANDARD_REQUIRED True)
|
set(CMAKE_CXX_STANDARD_REQUIRED True)
|
||||||
|
|
||||||
# Set names and variables
|
# Set names and variables
|
||||||
set(OBSW_NAME ${CMAKE_PROJECT_NAME})
|
set(TARGET_NAME ${CMAKE_PROJECT_NAME})
|
||||||
set(WATCHDOG_NAME eive-watchdog)
|
|
||||||
set(SIMPLE_OBSW_NAME eive-simple)
|
|
||||||
set(UNITTEST_NAME eive-unittest)
|
|
||||||
set(LIB_FSFW_NAME fsfw)
|
set(LIB_FSFW_NAME fsfw)
|
||||||
set(LIB_EIVE_MISSION eive-mission)
|
|
||||||
set(LIB_ETL_NAME etl)
|
set(LIB_ETL_NAME etl)
|
||||||
set(LIB_CSP_NAME libcsp)
|
set(LIB_CSP_NAME libcsp)
|
||||||
set(LIB_LWGPS_NAME lwgps)
|
set(LIB_LWGPS_NAME lwgps)
|
||||||
set(LIB_ARCSEC wire)
|
set(LIB_ARCSEC wire)
|
||||||
set(THIRD_PARTY_FOLDER thirdparty)
|
set(THIRD_PARTY_FOLDER thirdparty)
|
||||||
set(LIB_CXX_FS -lstdc++fs)
|
set(LIB_CXX_FS -lstdc++fs)
|
||||||
set(LIB_CATCH2 Catch2)
|
|
||||||
set(LIB_GPS gps)
|
|
||||||
set(LIB_JSON_NAME nlohmann_json::nlohmann_json)
|
set(LIB_JSON_NAME nlohmann_json::nlohmann_json)
|
||||||
|
|
||||||
# Set path names
|
# Set path names
|
||||||
set(FSFW_PATH fsfw)
|
set(FSFW_PATH fsfw)
|
||||||
|
set(MISSION_PATH mission)
|
||||||
set(TEST_PATH test/testtasks)
|
set(TEST_PATH test/testtasks)
|
||||||
set(UNITTEST_PATH unittest)
|
|
||||||
set(LINUX_PATH linux)
|
set(LINUX_PATH linux)
|
||||||
set(COMMON_PATH common)
|
set(COMMON_PATH common)
|
||||||
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(LIB_EIVE_MISSION_PATH mission)
|
set(FSFW_HAL_LIB_PATH fsfw_hal)
|
||||||
set(LIB_CSP_PATH ${THIRD_PARTY_FOLDER}/libcsp)
|
set(CSP_LIB_PATH ${THIRD_PARTY_FOLDER}/libcsp)
|
||||||
set(LIB_ETL_PATH ${THIRD_PARTY_FOLDER}/etl)
|
set(ETL_LIB_PATH ${THIRD_PARTY_FOLDER}/etl)
|
||||||
set(LIB_CATCH2_PATH ${THIRD_PARTY_FOLDER}/Catch2)
|
set(LWGPS_LIB_PATH ${THIRD_PARTY_FOLDER}/lwgps)
|
||||||
set(LIB_LWGPS_PATH ${THIRD_PARTY_FOLDER}/lwgps)
|
set(ARCSEC_LIB_PATH ${THIRD_PARTY_FOLDER}/arcsec_star_tracker)
|
||||||
set(LIB_ARCSEC_PATH ${THIRD_PARTY_FOLDER}/arcsec_star_tracker)
|
|
||||||
set(LIB_JSON_PATH ${THIRD_PARTY_FOLDER}/json)
|
set(LIB_JSON_PATH ${THIRD_PARTY_FOLDER}/json)
|
||||||
|
|
||||||
set(FSFW_WARNING_SHADOW_LOCAL_GCC OFF)
|
set(FSFW_WARNING_SHADOW_LOCAL_GCC OFF)
|
||||||
set(EIVE_ADD_LINUX_FILES False)
|
set(ADD_LINUX_FILES False)
|
||||||
|
|
||||||
# Analyse different OS and architecture/target options, determine BSP_PATH,
|
# Analyse different OS and architecture/target options, determine BSP_PATH,
|
||||||
# display information about compiler etc.
|
# display information about compiler etc.
|
||||||
@ -93,11 +87,11 @@ pre_source_hw_os_config()
|
|||||||
|
|
||||||
if(TGT_BSP)
|
if(TGT_BSP)
|
||||||
if(TGT_BSP MATCHES "arm/q7s" OR TGT_BSP MATCHES "arm/raspberrypi"
|
if(TGT_BSP MATCHES "arm/q7s" OR TGT_BSP MATCHES "arm/raspberrypi"
|
||||||
OR TGT_BSP MATCHES "arm/beagleboneblack" OR TGT_BSP MATCHES "arm/egse"
|
OR TGT_BSP MATCHES "arm/beagleboneblack"
|
||||||
)
|
)
|
||||||
set(FSFW_CONFIG_PATH "linux/fsfwconfig")
|
set(FSFW_CONFIG_PATH "linux/fsfwconfig")
|
||||||
if(NOT BUILD_Q7S_SIMPLE_MODE)
|
if(NOT BUILD_Q7S_SIMPLE_MODE)
|
||||||
set(EIVE_ADD_LINUX_FILES TRUE)
|
set(ADD_LINUX_FILES TRUE)
|
||||||
set(ADD_CSP_LIB TRUE)
|
set(ADD_CSP_LIB TRUE)
|
||||||
set(FSFW_HAL_ADD_LINUX ON)
|
set(FSFW_HAL_ADD_LINUX ON)
|
||||||
endif()
|
endif()
|
||||||
@ -109,12 +103,6 @@ if(TGT_BSP)
|
|||||||
set(FSFW_HAL_ADD_RASPBERRY_PI ON)
|
set(FSFW_HAL_ADD_RASPBERRY_PI ON)
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
if(TGT_BSP MATCHES "arm/egse")
|
|
||||||
# Used by configure file
|
|
||||||
set(EGSE ON)
|
|
||||||
set(FSFW_HAL_LINUX_ADD_LIBGPIOD OFF)
|
|
||||||
endif()
|
|
||||||
|
|
||||||
if(TGT_BSP MATCHES "arm/beagleboneblack")
|
if(TGT_BSP MATCHES "arm/beagleboneblack")
|
||||||
# Used by configure file
|
# Used by configure file
|
||||||
set(BEAGLEBONEBLACK ON)
|
set(BEAGLEBONEBLACK ON)
|
||||||
@ -129,19 +117,17 @@ else()
|
|||||||
set(FSFW_CONFIG_PATH "${BSP_PATH}/fsfwconfig")
|
set(FSFW_CONFIG_PATH "${BSP_PATH}/fsfwconfig")
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
|
|
||||||
# Configuration files
|
# Configuration files
|
||||||
|
if(NOT EIVE_BUILD_WATCHDOG)
|
||||||
configure_file(${COMMON_CONFIG_PATH}/commonConfig.h.in commonConfig.h)
|
configure_file(${COMMON_CONFIG_PATH}/commonConfig.h.in commonConfig.h)
|
||||||
configure_file(${FSFW_CONFIG_PATH}/FSFWConfig.h.in FSFWConfig.h)
|
configure_file(${FSFW_CONFIG_PATH}/FSFWConfig.h.in FSFWConfig.h)
|
||||||
configure_file(${FSFW_CONFIG_PATH}/OBSWConfig.h.in OBSWConfig.h)
|
configure_file(${FSFW_CONFIG_PATH}/OBSWConfig.h.in OBSWConfig.h)
|
||||||
if(TGT_BSP MATCHES "arm/q7s")
|
if(TGT_BSP MATCHES "arm/q7s")
|
||||||
configure_file(${BSP_PATH}/boardconfig/q7sConfig.h.in q7sConfig.h)
|
configure_file(${BSP_PATH}/boardconfig/q7sConfig.h.in q7sConfig.h)
|
||||||
elseif(TGT_BSP MATCHES "arm/raspberrypi" OR TGT_BSP MATCHES "arm/egse")
|
elseif(TGT_BSP MATCHES "arm/raspberrypi")
|
||||||
configure_file(${BSP_PATH}/boardconfig/rpiConfig.h.in rpiConfig.h)
|
configure_file(${BSP_PATH}/boardconfig/rpiConfig.h.in rpiConfig.h)
|
||||||
endif()
|
endif()
|
||||||
|
endif()
|
||||||
|
|
||||||
|
|
||||||
configure_file(${WATCHDOG_PATH}/watchdogConf.h.in watchdogConf.h)
|
configure_file(${WATCHDOG_PATH}/watchdogConf.h.in watchdogConf.h)
|
||||||
|
|
||||||
# Set common config path for FSFW
|
# Set common config path for FSFW
|
||||||
@ -150,30 +136,120 @@ set(FSFW_ADDITIONAL_INC_PATHS
|
|||||||
${CMAKE_CURRENT_BINARY_DIR}
|
${CMAKE_CURRENT_BINARY_DIR}
|
||||||
)
|
)
|
||||||
|
|
||||||
# Check whether the user has already installed Catch2 first
|
|
||||||
find_package(Catch2 3)
|
|
||||||
|
|
||||||
################################################################################
|
################################################################################
|
||||||
# Executable and Sources
|
# Executable and Sources
|
||||||
################################################################################
|
################################################################################
|
||||||
|
|
||||||
#global compiler options need to be set before adding executables
|
# Add executable
|
||||||
if(CMAKE_CXX_COMPILER_ID STREQUAL "GNU")
|
add_executable(${TARGET_NAME})
|
||||||
add_compile_options(
|
|
||||||
"-Wall"
|
if(ADD_ETL_LIB)
|
||||||
"-Wextra"
|
add_subdirectory(${ETL_LIB_PATH})
|
||||||
"-Wimplicit-fallthrough=1"
|
endif()
|
||||||
"-Wno-unused-parameter"
|
|
||||||
"-Wno-psabi"
|
if(ADD_JSON_LIB)
|
||||||
|
add_subdirectory(${LIB_JSON_PATH})
|
||||||
|
endif()
|
||||||
|
|
||||||
|
if(NOT EIVE_BUILD_WATCHDOG)
|
||||||
|
if(ADD_LINUX_FILES)
|
||||||
|
add_subdirectory(${LINUX_PATH})
|
||||||
|
endif()
|
||||||
|
add_subdirectory(${BSP_PATH})
|
||||||
|
add_subdirectory(${COMMON_PATH})
|
||||||
|
if(ADD_CSP_LIB)
|
||||||
|
add_subdirectory(${CSP_LIB_PATH})
|
||||||
|
endif()
|
||||||
|
endif()
|
||||||
|
|
||||||
|
if((NOT BUILD_Q7S_SIMPLE_MODE) AND (NOT EIVE_BUILD_WATCHDOG))
|
||||||
|
add_subdirectory(${LWGPS_LIB_PATH})
|
||||||
|
add_subdirectory(${FSFW_PATH})
|
||||||
|
add_subdirectory(${MISSION_PATH})
|
||||||
|
add_subdirectory(${TEST_PATH})
|
||||||
|
add_subdirectory(${ARCSEC_LIB_PATH})
|
||||||
|
endif()
|
||||||
|
|
||||||
|
if(EIVE_BUILD_WATCHDOG)
|
||||||
|
add_subdirectory(${WATCHDOG_PATH})
|
||||||
|
endif()
|
||||||
|
|
||||||
|
################################################################################
|
||||||
|
# Post-Sources preparation
|
||||||
|
################################################################################
|
||||||
|
|
||||||
|
set_property(CACHE FSFW_OSAL PROPERTY STRINGS host linux)
|
||||||
|
|
||||||
|
if((NOT BUILD_Q7S_SIMPLE_MODE) AND (NOT EIVE_BUILD_WATCHDOG))
|
||||||
|
# Add libraries for all sources.
|
||||||
|
target_link_libraries(${TARGET_NAME} PRIVATE
|
||||||
|
${LIB_FSFW_NAME}
|
||||||
|
${LIB_OS_NAME}
|
||||||
|
${LIB_LWGPS_NAME}
|
||||||
)
|
)
|
||||||
|
|
||||||
|
if(TGT_BSP MATCHES "arm/q7s")
|
||||||
|
target_link_libraries(${TARGET_NAME} PRIVATE
|
||||||
|
${LIB_ARCSEC}
|
||||||
|
)
|
||||||
|
endif()
|
||||||
|
endif()
|
||||||
|
|
||||||
|
if(NOT EIVE_BUILD_WATCHDOG)
|
||||||
|
if(ADD_CSP_LIB)
|
||||||
|
target_link_libraries(${TARGET_NAME} PRIVATE
|
||||||
|
${LIB_CSP_NAME}
|
||||||
|
)
|
||||||
|
endif()
|
||||||
|
endif()
|
||||||
|
|
||||||
|
if(ADD_ETL_LIB)
|
||||||
|
target_link_libraries(${TARGET_NAME} PRIVATE
|
||||||
|
${LIB_ETL_NAME}
|
||||||
|
)
|
||||||
|
endif()
|
||||||
|
|
||||||
|
if(ADD_JSON_LIB)
|
||||||
|
target_link_libraries(${TARGET_NAME} PRIVATE
|
||||||
|
${LIB_JSON_NAME}
|
||||||
|
)
|
||||||
|
endif()
|
||||||
|
|
||||||
|
target_link_libraries(${TARGET_NAME} PRIVATE
|
||||||
|
${LIB_CXX_FS}
|
||||||
|
)
|
||||||
|
|
||||||
|
# Add include paths for all sources.
|
||||||
|
target_include_directories(${TARGET_NAME} PRIVATE
|
||||||
|
${CMAKE_CURRENT_SOURCE_DIR}
|
||||||
|
${FSFW_CONFIG_PATH}
|
||||||
|
${CMAKE_CURRENT_BINARY_DIR}
|
||||||
|
${ARCSEC_LIB_PATH}
|
||||||
|
)
|
||||||
|
|
||||||
|
if(TGT_BSP MATCHES "arm/q7s")
|
||||||
|
target_include_directories(${TARGET_NAME} PRIVATE
|
||||||
|
${ARCSEC_LIB_PATH}
|
||||||
|
)
|
||||||
|
endif()
|
||||||
|
|
||||||
|
if(CMAKE_CXX_COMPILER_ID STREQUAL "GNU")
|
||||||
|
set(WARNING_FLAGS
|
||||||
|
-Wall
|
||||||
|
-Wextra
|
||||||
|
-Wimplicit-fallthrough=1
|
||||||
|
-Wno-unused-parameter
|
||||||
|
-Wno-psabi
|
||||||
|
)
|
||||||
|
|
||||||
# Remove unused sections.
|
# Remove unused sections.
|
||||||
add_compile_options(
|
target_compile_options(${TARGET_NAME} PRIVATE
|
||||||
"-ffunction-sections"
|
"-ffunction-sections"
|
||||||
"-fdata-sections"
|
"-fdata-sections"
|
||||||
)
|
)
|
||||||
|
|
||||||
# Removed unused sections.
|
# Removed unused sections.
|
||||||
add_link_options(
|
target_link_options(${TARGET_NAME} PRIVATE
|
||||||
"-Wl,--gc-sections"
|
"-Wl,--gc-sections"
|
||||||
)
|
)
|
||||||
|
|
||||||
@ -181,162 +257,15 @@ elseif(CMAKE_CXX_COMPILER_ID STREQUAL "MSVC")
|
|||||||
set(COMPILER_FLAGS "/permissive-")
|
set(COMPILER_FLAGS "/permissive-")
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
# Not installed, so use FetchContent to download and provide Catch2
|
|
||||||
if(NOT Catch2_FOUND)
|
|
||||||
include(FetchContent)
|
|
||||||
|
|
||||||
FetchContent_Declare(
|
|
||||||
Catch2
|
|
||||||
GIT_REPOSITORY https://github.com/catchorg/Catch2.git
|
|
||||||
GIT_TAG v3.0.0-preview4
|
|
||||||
)
|
|
||||||
|
|
||||||
FetchContent_MakeAvailable(Catch2)
|
|
||||||
#fixes regression -preview4, to be confirmed in later releases
|
|
||||||
set_target_properties(Catch2 PROPERTIES DEBUG_POSTFIX "")
|
|
||||||
set_target_properties(Catch2 PROPERTIES EXCLUDE_FROM_ALL "true")
|
|
||||||
set_target_properties(Catch2WithMain PROPERTIES EXCLUDE_FROM_ALL "true")
|
|
||||||
endif()
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
add_library(${LIB_EIVE_MISSION})
|
|
||||||
|
|
||||||
|
|
||||||
# Add main executable
|
|
||||||
add_executable(${OBSW_NAME})
|
|
||||||
if(EIVE_CREATE_UNIQUE_OBSW_BIN)
|
|
||||||
set(OBSW_BIN_NAME ${CMAKE_PROJECT_NAME}-$ENV{USERNAME})
|
|
||||||
else()
|
|
||||||
set(OBSW_BIN_NAME ${CMAKE_PROJECT_NAME})
|
|
||||||
endif()
|
|
||||||
set_target_properties(${OBSW_NAME} PROPERTIES OUTPUT_NAME ${OBSW_BIN_NAME})
|
|
||||||
|
|
||||||
#watchdog
|
|
||||||
add_executable(${WATCHDOG_NAME} EXCLUDE_FROM_ALL)
|
|
||||||
add_subdirectory(${WATCHDOG_PATH})
|
|
||||||
target_link_libraries(${WATCHDOG_NAME} PUBLIC
|
|
||||||
${LIB_CXX_FS}
|
|
||||||
)
|
|
||||||
target_include_directories(${WATCHDOG_NAME} PUBLIC
|
|
||||||
${CMAKE_BINARY_DIR}
|
|
||||||
)
|
|
||||||
|
|
||||||
#unittests
|
|
||||||
add_executable(${UNITTEST_NAME} EXCLUDE_FROM_ALL)
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
if(EIVE_ADD_ETL_LIB)
|
|
||||||
add_subdirectory(${LIB_ETL_PATH})
|
|
||||||
endif()
|
|
||||||
|
|
||||||
if(EIVE_ADD_JSON_LIB)
|
|
||||||
add_subdirectory(${LIB_JSON_PATH})
|
|
||||||
endif()
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
if(EIVE_ADD_LINUX_FILES)
|
|
||||||
add_subdirectory(${LIB_ARCSEC_PATH})
|
|
||||||
add_subdirectory(${LINUX_PATH})
|
|
||||||
endif()
|
|
||||||
add_subdirectory(${BSP_PATH})
|
|
||||||
if(ADD_CSP_LIB)
|
|
||||||
add_subdirectory(${LIB_CSP_PATH})
|
|
||||||
endif()
|
|
||||||
|
|
||||||
|
|
||||||
add_subdirectory(${COMMON_PATH})
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
add_subdirectory(${LIB_LWGPS_PATH})
|
|
||||||
add_subdirectory(${FSFW_PATH})
|
|
||||||
add_subdirectory(${LIB_EIVE_MISSION_PATH})
|
|
||||||
add_subdirectory(${TEST_PATH})
|
|
||||||
|
|
||||||
|
|
||||||
add_subdirectory(${UNITTEST_PATH})
|
|
||||||
|
|
||||||
|
|
||||||
################################################################################
|
|
||||||
# Post-Sources preparation
|
|
||||||
################################################################################
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
# Add libraries
|
|
||||||
target_link_libraries(${LIB_EIVE_MISSION} PUBLIC
|
|
||||||
${LIB_FSFW_NAME}
|
|
||||||
${LIB_LWGPS_NAME}
|
|
||||||
${LIB_OS_NAME}
|
|
||||||
)
|
|
||||||
|
|
||||||
target_link_libraries(${OBSW_NAME} PRIVATE
|
|
||||||
${LIB_EIVE_MISSION}
|
|
||||||
)
|
|
||||||
|
|
||||||
if(TGT_BSP MATCHES "arm/q7s")
|
|
||||||
target_link_libraries(${LIB_EIVE_MISSION} PUBLIC
|
|
||||||
${LIB_ARCSEC}
|
|
||||||
${LIB_GPS}
|
|
||||||
)
|
|
||||||
endif()
|
|
||||||
|
|
||||||
target_link_libraries(${UNITTEST_NAME} PRIVATE
|
|
||||||
Catch2
|
|
||||||
${LIB_EIVE_MISSION}
|
|
||||||
)
|
|
||||||
|
|
||||||
if(TGT_BSP MATCHES "arm/egse")
|
|
||||||
target_link_libraries(${OBSW_NAME} PRIVATE
|
|
||||||
${LIB_ARCSEC}
|
|
||||||
)
|
|
||||||
endif()
|
|
||||||
|
|
||||||
if(ADD_CSP_LIB)
|
|
||||||
target_link_libraries(${OBSW_NAME} PRIVATE
|
|
||||||
${LIB_CSP_NAME}
|
|
||||||
)
|
|
||||||
endif()
|
|
||||||
|
|
||||||
|
|
||||||
if(EIVE_ADD_ETL_LIB)
|
|
||||||
target_link_libraries(${LIB_EIVE_MISSION} PUBLIC
|
|
||||||
${LIB_ETL_NAME}
|
|
||||||
)
|
|
||||||
endif()
|
|
||||||
|
|
||||||
if(EIVE_ADD_JSON_LIB)
|
|
||||||
target_link_libraries(${LIB_EIVE_MISSION} PUBLIC
|
|
||||||
${LIB_JSON_NAME}
|
|
||||||
)
|
|
||||||
endif()
|
|
||||||
|
|
||||||
target_link_libraries(${LIB_EIVE_MISSION} PUBLIC
|
|
||||||
${LIB_CXX_FS}
|
|
||||||
)
|
|
||||||
|
|
||||||
# Add include paths for all sources.
|
|
||||||
target_include_directories(${LIB_EIVE_MISSION} PUBLIC
|
|
||||||
${CMAKE_CURRENT_SOURCE_DIR}
|
|
||||||
${FSFW_CONFIG_PATH}
|
|
||||||
${CMAKE_CURRENT_BINARY_DIR}
|
|
||||||
${LIB_ARCSEC_PATH}
|
|
||||||
)
|
|
||||||
|
|
||||||
if(TGT_BSP MATCHES "arm/q7s" OR TGT_BSP MATCHES "arm/egse")
|
|
||||||
target_include_directories(${LIB_EIVE_MISSION} PUBLIC
|
|
||||||
${ARCSEC_LIB_PATH}
|
|
||||||
)
|
|
||||||
endif()
|
|
||||||
|
|
||||||
if(CMAKE_VERBOSE)
|
if(CMAKE_VERBOSE)
|
||||||
message(STATUS "Warning flags: ${WARNING_FLAGS}")
|
message(STATUS "Warning flags: ${WARNING_FLAGS}")
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
|
|
||||||
|
# Compile options for all sources.
|
||||||
|
target_compile_options(${TARGET_NAME} PRIVATE
|
||||||
|
${WARNING_FLAGS}
|
||||||
|
)
|
||||||
|
|
||||||
if(${CMAKE_CROSSCOMPILING})
|
if(${CMAKE_CROSSCOMPILING})
|
||||||
include (${CMAKE_SCRIPT_PATH}/HardwareOsPostConfig.cmake)
|
include (${CMAKE_SCRIPT_PATH}/HardwareOsPostConfig.cmake)
|
||||||
@ -368,12 +297,11 @@ string(CONCAT POST_BUILD_COMMENT
|
|||||||
)
|
)
|
||||||
|
|
||||||
add_custom_command(
|
add_custom_command(
|
||||||
TARGET ${OBSW_NAME}
|
TARGET ${TARGET_NAME}
|
||||||
POST_BUILD
|
POST_BUILD
|
||||||
COMMAND ${CMAKE_SIZE} ${OBSW_BIN_NAME}${FILE_SUFFIX}
|
COMMAND ${CMAKE_SIZE} ${TARGET_NAME}${FILE_SUFFIX}
|
||||||
COMMENT ${POST_BUILD_COMMENT}
|
COMMENT ${POST_BUILD_COMMENT}
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
include (${CMAKE_SCRIPT_PATH}/BuildType.cmake)
|
include (${CMAKE_SCRIPT_PATH}/BuildType.cmake)
|
||||||
set_build_type()
|
set_build_type()
|
||||||
|
12
Justfile
12
Justfile
@ -1,12 +0,0 @@
|
|||||||
python_script := './cmake/scripts/cmake-build-cfg.py'
|
|
||||||
|
|
||||||
default: q7s-debug-make
|
|
||||||
|
|
||||||
q7s-debug-make:
|
|
||||||
{{python_script}} -o linux -g make -b debug -t "arm/q7s" -l build-Debug-Q7S
|
|
||||||
|
|
||||||
q7s-release-make:
|
|
||||||
{{python_script}} -o linux -g make -b release -t "arm/q7s" -l build-Release-Q7S
|
|
||||||
|
|
||||||
q7s-debug-ninja:
|
|
||||||
{{python_script}} -o linux -g ninja -b debug -t "arm/q7s" -l build-Debug-Q7S
|
|
203
README.md
203
README.md
@ -11,18 +11,13 @@
|
|||||||
4. [Useful and Common Host Commands](#host-commands)
|
4. [Useful and Common Host Commands](#host-commands)
|
||||||
5. [Setting up Prerequisites](#set-up-prereq)
|
5. [Setting up Prerequisites](#set-up-prereq)
|
||||||
6. [Remote Debugging](#remote-debugging)
|
6. [Remote Debugging](#remote-debugging)
|
||||||
6. [Remote Reset](#remote-reset)
|
7. [Direct Debugging](#direct-debugging)
|
||||||
8. [TMTC testing](#tmtc-testing)
|
8. [Transfering Files to the Q7S](#file-transfer)
|
||||||
9. [Direct Debugging](#direct-debugging)
|
9. [Q7S OBC](#q7s)
|
||||||
10. [Transfering Files to the Q7S](#file-transfer)
|
10. [Static Code Analysis](#static-code-analysis)
|
||||||
11. [Q7S OBC](#q7s)
|
11. [Eclipse](#eclipse)
|
||||||
12. [Static Code Analysis](#static-code-analysis)
|
12. [Running the OBSW on a Raspberry Pi](#rpi)
|
||||||
13. [Eclipse](#eclipse)
|
13. [FSFW](#fsfw)
|
||||||
14. [Running the OBSW on a Raspberry Pi](#rpi)
|
|
||||||
15. [Running OBSW on EGSE](#egse)
|
|
||||||
16. [Manually preparing sysroots to compile gpsd](#gpsd)
|
|
||||||
17. [FSFW](#fsfw)
|
|
||||||
18. [Coding Style](#coding-style)
|
|
||||||
|
|
||||||
# <a id="general"></a> General information
|
# <a id="general"></a> General information
|
||||||
|
|
||||||
@ -40,7 +35,7 @@ Target systems:
|
|||||||
relevant pages. The most recent datasheet can be found
|
relevant pages. The most recent datasheet can be found
|
||||||
[here](https://trac2.xiphos.ca/manual/wiki/Q7RevB/UserManual).
|
[here](https://trac2.xiphos.ca/manual/wiki/Q7RevB/UserManual).
|
||||||
* Linux OS built with Yocto 2.5
|
* Linux OS built with Yocto 2.5
|
||||||
* [Linux Kernel](https://github.com/XiphosSystemsCorp/linux-xlnx.git) . EIVE version can be found
|
* Linux Kernel https://github.com/XiphosSystemsCorp/linux-xlnx.git . EIVE version can be found
|
||||||
[here](https://github.com/spacefisch/linux-xlnx) . Pre-compiled files can be
|
[here](https://github.com/spacefisch/linux-xlnx) . Pre-compiled files can be
|
||||||
found [here](https://eive-cloud.irs.uni-stuttgart.de/index.php/apps/files/?dir=/EIVE_IRS/Software/q7s-linux-components&fileid=777299).
|
found [here](https://eive-cloud.irs.uni-stuttgart.de/index.php/apps/files/?dir=/EIVE_IRS/Software/q7s-linux-components&fileid=777299).
|
||||||
* Q7S base project can be found [here](https://egit.irs.uni-stuttgart.de/eive/q7s-base)
|
* Q7S base project can be found [here](https://egit.irs.uni-stuttgart.de/eive/q7s-base)
|
||||||
@ -107,7 +102,7 @@ When using Windows, run theses steps in MSYS2.
|
|||||||
|
|
||||||
```sh
|
```sh
|
||||||
mkdir build-Debug-Q7S && cd build-Debug-Q7S
|
mkdir build-Debug-Q7S && cd build-Debug-Q7S
|
||||||
cmake -DTGT_BSP="arm/q7s" -DCMAKE_BUILD_TYPE=Debug ..
|
cmake -DTGT_BSP="arm/q7s" -DCMAKE_BUILD_TYPE=Debug -DOS_FSFW=linux ..
|
||||||
cmake --build . -j
|
cmake --build . -j
|
||||||
```
|
```
|
||||||
|
|
||||||
@ -122,7 +117,8 @@ When using Windows, run theses steps in MSYS2.
|
|||||||
This will invoke a Python script which in turn invokes CMake with the correct
|
This will invoke a Python script which in turn invokes CMake with the correct
|
||||||
arguments to configure CMake for Q7S cross-compilation.
|
arguments to configure CMake for Q7S cross-compilation.
|
||||||
|
|
||||||
There are also different values for `-DTGT_BSP` to build for the Raspberry Pi
|
You can build the hosted variant of the OBSW by replacing `-DOS_FSFW=linux` with
|
||||||
|
`-DOS_FSFW=host`. There are also different values for `-DTGT_BSP` to build for the Raspberry Pi
|
||||||
or the Beagle Bone Black: `arm/raspberrypi` and `arm/beagleboneblack`.
|
or the Beagle Bone Black: `arm/raspberrypi` and `arm/beagleboneblack`.
|
||||||
|
|
||||||
5. Build the software with
|
5. Build the software with
|
||||||
@ -161,47 +157,20 @@ automatically.
|
|||||||
|
|
||||||
### Q7S OBSW
|
### Q7S OBSW
|
||||||
|
|
||||||
The EIVE OBSW is the default target if no target is specified.
|
|
||||||
|
|
||||||
```sh
|
```sh
|
||||||
mkdir build-Debug-Q7S && cd build-Debug-Q7S
|
mkdir build-Debug-Q7S && cd build-Debug-Q7S
|
||||||
cmake -DTGT_BSP=arm/q7s -DCMAKE_BUILD_TYPE=Debug ..
|
cmake -DTGT_BSP=arm/q7s -DFSFW_OSAL=linux -DCMAKE_BUILD_TYPE=Debug ..
|
||||||
cmake --build . -j
|
cmake --build . -j
|
||||||
```
|
```
|
||||||
|
|
||||||
### Q7S Watchdog
|
### Q7S Watchdog
|
||||||
|
|
||||||
To build the EIVE watchdog, the corresponding target must be specified in the build command.
|
|
||||||
The configure steps do not need to be repeated if the folder has already been configured.
|
|
||||||
|
|
||||||
```sh
|
```sh
|
||||||
mkdir build-Debug-Watchdog && cd build-Debug-Watchdog
|
mkdir build-Debug-Q7S && cd build-Debug-Q7S
|
||||||
cmake -DTGT_BSP=arm/q7s -DCMAKE_BUILD_TYPE=Debug ..
|
cmake -DTGT_BSP=arm/q7s -DFSFW_OSAL=linux -DEIVE_BUILD_WATCHDOG=ON -DCMAKE_BUILD_TYPE=Debug ..
|
||||||
cmake --build . --target eive-watchdog -j
|
|
||||||
```
|
|
||||||
|
|
||||||
### Hosted
|
|
||||||
|
|
||||||
You can also use the FSFW OSAL `host` to build on Windows or for generic OSes.
|
|
||||||
Note: Currently this is not supported.
|
|
||||||
|
|
||||||
```sh
|
|
||||||
mkdir build-Debug-Host && cd build-Debug-Host
|
|
||||||
cmake -DFSFW_OSAL=host -DCMAKE_BUILD_TYPE=Debug ..
|
|
||||||
cmake --build . -j
|
cmake --build . -j
|
||||||
```
|
```
|
||||||
|
|
||||||
### Unittests
|
|
||||||
|
|
||||||
To build the unittests, the corresponding target must be specified in the build command.
|
|
||||||
The configure steps do not need to be repeated if the folder has already been configured.
|
|
||||||
|
|
||||||
```sh
|
|
||||||
mkdir build-Debug-Unittest && cd build-Debug-Unittest
|
|
||||||
cmake ..
|
|
||||||
cmake --build . --target eive-unittests -j
|
|
||||||
```
|
|
||||||
|
|
||||||
## Connect to EIVE flatsat
|
## Connect to EIVE flatsat
|
||||||
|
|
||||||
### DNS
|
### DNS
|
||||||
@ -442,24 +411,12 @@ Beagle Bone Black for download here
|
|||||||
Download it and unzip it somewhere in the Xilinx installation folder.
|
Download it and unzip it somewhere in the Xilinx installation folder.
|
||||||
You can use the following command if `wget` can be used or for CI/CD:
|
You can use the following command if `wget` can be used or for CI/CD:
|
||||||
|
|
||||||
```sh
|
```
|
||||||
wget https://eive-cloud.irs.uni-stuttgart.de/index.php/s/SyXpdBBQX32xPgE/download/cortexa9hf-neon-xiphos-linux-gnueabi.tar.gz
|
wget https://eive-cloud.irs.uni-stuttgart.de/index.php/s/agnJGYeRf6fw2ci/download/cortexa9hf-neon-xiphos-linux-gnueabi.tar.gz
|
||||||
```
|
```
|
||||||
|
|
||||||
Then, create a new environmental variables `Q7S_SYSROOT` and set it to the local system root path.
|
Then, create a new environmental variables `Q7S_SYSROOT` and set it to the local system root path.
|
||||||
|
|
||||||
### Updating system root for CI
|
|
||||||
|
|
||||||
If the system root is updated, it needs to be manually updated on the buggy file server.
|
|
||||||
If access on `buggy.irs.uni-stuttgart.de` is possible with `ssh` and the rootfs in the cloud
|
|
||||||
[was updated](https://eive-cloud.irs.uni-stuttgart.de/index.php/apps/files/?dir=/EIVE_IRS/Software/rootfs&fileid=831849)
|
|
||||||
as well, you can update the rootfs like this:
|
|
||||||
|
|
||||||
```sh
|
|
||||||
cd /var/www/eive/tools
|
|
||||||
wget https://eive-cloud.irs.uni-stuttgart.de/index.php/s/SyXpdBBQX32xPgE/download/cortexa9hf-neon-xiphos-linux-gnueabi.tar.gz
|
|
||||||
```
|
|
||||||
|
|
||||||
## Setting up UNIX environment for real-time functionalities
|
## Setting up UNIX environment for real-time functionalities
|
||||||
|
|
||||||
Please note that on most UNIX environments (e.g. Ubuntu), the real time functionalities
|
Please note that on most UNIX environments (e.g. Ubuntu), the real time functionalities
|
||||||
@ -557,10 +514,10 @@ ssh root@192.168.133.10
|
|||||||
```
|
```
|
||||||
|
|
||||||
If this has not been done yet, you can access the serial
|
If this has not been done yet, you can access the serial
|
||||||
console of the Q7S like this
|
console of the Q7S like this to set it
|
||||||
|
|
||||||
```sh
|
```sh
|
||||||
picocom -b 115200 /dev/q7sSerial
|
picocom -b 115200 /dev/ttyUSB0
|
||||||
```
|
```
|
||||||
|
|
||||||
The flatsat has the aliases and shell scripts `q7s_ssh` and `q7s_serial` for this task as well.
|
The flatsat has the aliases and shell scripts `q7s_ssh` and `q7s_serial` for this task as well.
|
||||||
@ -597,63 +554,6 @@ alias or shell script to do this quickly.
|
|||||||
Note: When now setting up a debug session in the Xilinx SDK or Eclipse, the host must be set
|
Note: When now setting up a debug session in the Xilinx SDK or Eclipse, the host must be set
|
||||||
to localhost instead of the IP address of the Q7S.
|
to localhost instead of the IP address of the Q7S.
|
||||||
|
|
||||||
# <a id="remote-reset"></a> Remote Reset
|
|
||||||
1. Launch xilinx hardware server on flatsat with alias
|
|
||||||
````
|
|
||||||
launch-hwserver-xilinx
|
|
||||||
````
|
|
||||||
2. On host PC start xsc
|
|
||||||
3. In xsct console type the follwing command to connect to the hardware server (replace </flatsat-pc-ip-address/> with the IP address of the flatsat PC. Can be found out with ifconfig)
|
|
||||||
````
|
|
||||||
connect -url tcp:</flatsat-pc-ip-address/>:3121
|
|
||||||
````
|
|
||||||
4. The following command will list all available devices
|
|
||||||
````
|
|
||||||
targets
|
|
||||||
````
|
|
||||||
5. Connect to the APU of the Q7S
|
|
||||||
````
|
|
||||||
target </APU-number/>
|
|
||||||
````
|
|
||||||
6. Perform reset
|
|
||||||
````
|
|
||||||
rst
|
|
||||||
````
|
|
||||||
|
|
||||||
# <a id="tmtc-testing"></a> TMTC testing
|
|
||||||
|
|
||||||
The OBSW supports sending PUS TM packets via TCP or the PDEC IP Core which transmits the data as
|
|
||||||
CADU frames. To make the CADU frames receivabel by the
|
|
||||||
[TMTC porgram](https://egit.irs.uni-stuttgart.de/eive/eive-tmtc), a python script is running as
|
|
||||||
`systemd` service named `tmtc_bridge` on the flatsat PC which forwards TCP commands to the TCP
|
|
||||||
server of the OBC and reads CADU frames from a serial interface.
|
|
||||||
|
|
||||||
You can check whether the service is running the following command on the flatsat PC
|
|
||||||
|
|
||||||
```sh
|
|
||||||
systemctl status tmtc_bridge
|
|
||||||
```
|
|
||||||
|
|
||||||
The PUS packets transported with the CADU frames are extracted
|
|
||||||
and forwared to the TMTC program's TCP client. The code of the TMTC bridge can be found
|
|
||||||
[here](https://egit.irs.uni-stuttgart.de/eive/tmtc-bridge). To connect the TMTC program to the
|
|
||||||
TMTC-bridge a port forwarding from a host must be set up with the following command:
|
|
||||||
|
|
||||||
```sh
|
|
||||||
ssh -L 1537:127.0.0.1:7100 eive@2001:7c0:2018:1099:babe:0:e1fe:f1a5 -t bash
|
|
||||||
```
|
|
||||||
|
|
||||||
You can print the output of the `systemd` service with
|
|
||||||
|
|
||||||
```sh
|
|
||||||
journalctl -u tmtc_bridge
|
|
||||||
```
|
|
||||||
|
|
||||||
This can be helpful to determine whether any TCs arrive or TMs are coming back.
|
|
||||||
|
|
||||||
Note: The encoding of the TM packets and conversion of CADU frames takes some time.
|
|
||||||
Thus the replies are received with a larger delay compared to a direct TCP connection.
|
|
||||||
|
|
||||||
# <a id="direct-debugging"></a> Direct Debugging
|
# <a id="direct-debugging"></a> Direct Debugging
|
||||||
|
|
||||||
1. Assign static IP address to Q7S
|
1. Assign static IP address to Q7S
|
||||||
@ -1066,7 +966,26 @@ cat file.bin | hexdump -v -n X
|
|||||||
|
|
||||||
## Preparation of a fresh rootfs and SD card
|
## Preparation of a fresh rootfs and SD card
|
||||||
|
|
||||||
See [q7s-package repository README](https://egit.irs.uni-stuttgart.de/eive/q7s-package)
|
This section summarizes important changes between a fresh rootfs and the current
|
||||||
|
EIVE implementation
|
||||||
|
|
||||||
|
### rootfs
|
||||||
|
|
||||||
|
- Mount point `/mnt/sd0` created for SD card 0. Created with `mkdir`
|
||||||
|
- Mount point `/mnt/sd1` created for SD card 1. Created with `mkdir`
|
||||||
|
- Folder `scripts` in `/home/root` folder.
|
||||||
|
- `scripts` folder currently contains a few shell helper scripts
|
||||||
|
- Folder `profile.d` in `/etc` folder which contains the `path-set.sh` script
|
||||||
|
which is sourced at software startup
|
||||||
|
- Library `libwire.so` in `/usr/lib` folder
|
||||||
|
|
||||||
|
### SD Cards
|
||||||
|
|
||||||
|
- Folder `bin` for binaries, for example the OBSW
|
||||||
|
- Folder `misc` for miscellaneous files. Contains `ls` for directory listings
|
||||||
|
- Folder `tc` for telecommands
|
||||||
|
- Folder `tm` for telemetry
|
||||||
|
- Folder `xdi` for XDI components (e.g. for firmware or device tree updates)
|
||||||
|
|
||||||
# <a id="static-code-analysis"></a> Running cppcheck on the Software
|
# <a id="static-code-analysis"></a> Running cppcheck on the Software
|
||||||
|
|
||||||
@ -1114,7 +1033,7 @@ The [TCF agent](https://wiki.eclipse.org/TCF) can be used to perform remote debu
|
|||||||
1. Install the TCF agent plugin in Eclipse from
|
1. Install the TCF agent plugin in Eclipse from
|
||||||
the [releases](https://www.eclipse.org/tcf/downloads.php). Go to
|
the [releases](https://www.eclipse.org/tcf/downloads.php). Go to
|
||||||
Help → Install New Software and use the download page, for
|
Help → Install New Software and use the download page, for
|
||||||
example https://download.eclipse.org/tools/tcf/releases/1.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.6/1.6.2/ to search for the plugin and install it.
|
||||||
|
|
||||||
2. Go to Window → Perspective → Open Perspective and open the **Target Explorer Perspective**.
|
2. Go to Window → Perspective → Open Perspective and open the **Target Explorer Perspective**.
|
||||||
Here, the Q7S should show up if the local port forwarding was set up as explained previously.
|
Here, the Q7S should show up if the local port forwarding was set up as explained previously.
|
||||||
@ -1153,38 +1072,6 @@ sudo apt-get install gpiod libgpiod-dev
|
|||||||
|
|
||||||
to install the required GPIO libraries before cloning the system root folder.
|
to install the required GPIO libraries before cloning the system root folder.
|
||||||
|
|
||||||
# <a id="egse"></a> Running OBSW on EGSE
|
|
||||||
The EGSE is a test system from arcsec build arround a raspberry pi 4 to test the star tracker. The IP address of the EGSE (raspberry pi) is 192.168.18.31. An ssh session can be opened with
|
|
||||||
````
|
|
||||||
ssh pi@192.168.18.31
|
|
||||||
````
|
|
||||||
Password: raspberry
|
|
||||||
|
|
||||||
To run the obsw perform the following steps:
|
|
||||||
1. Build the cmake EGSE Configuration
|
|
||||||
* the sysroots for the EGSE can be found [here](https://eive-cloud.irs.uni-stuttgart.de/index.php/apps/files/?dir=/EIVE_IRS/Software/egse&fileid=1190471)
|
|
||||||
* toolchain for linux host can be downloaded from [here](https://github.com/Pro/raspi-toolchain)
|
|
||||||
* toolchain for windows host from [here](https://gnutoolchains.com/raspberry/) (the raspios-buster-armhf toolchain is the right one for the EGSE)
|
|
||||||
2. Disable the ser2net systemd service on the EGSE
|
|
||||||
````sh
|
|
||||||
$ sudo systemctl stop ser2net.service
|
|
||||||
````
|
|
||||||
3. Power on the star tracker by running
|
|
||||||
````sh
|
|
||||||
$ ~/powerctrl/enable0.sh`
|
|
||||||
````
|
|
||||||
4. Run portforwarding script for tmtc tcp connection and tcf agent on host PC
|
|
||||||
````sh
|
|
||||||
$ ./scripts/egse-port.sh
|
|
||||||
````
|
|
||||||
5. The star tracker can be powered off by running
|
|
||||||
````sh
|
|
||||||
$ ~/powerctrl/disable0.sh
|
|
||||||
````
|
|
||||||
|
|
||||||
# <a id="gpsd"></a> Manually preparing sysroots to compile gpsd
|
|
||||||
Copy all header files from [here](https://eive-cloud.irs.uni-stuttgart.de/index.php/apps/files/?dir=/EIVE_IRS/Software/gpsd&fileid=1189985) to the /usr/include directory and all static libraries to /usr/lib.
|
|
||||||
|
|
||||||
# <a id="fsfw"></a> Flight Software Framework (FSFW)
|
# <a id="fsfw"></a> Flight Software Framework (FSFW)
|
||||||
|
|
||||||
An EIVE fork of the FSFW is submodules into this repository.
|
An EIVE fork of the FSFW is submodules into this repository.
|
||||||
@ -1204,15 +1091,3 @@ git merge upstream/master
|
|||||||
|
|
||||||
Alternatively, changes from other upstreams (forks) and branches can be merged like that
|
Alternatively, changes from other upstreams (forks) and branches can be merged like that
|
||||||
in the same way.
|
in the same way.
|
||||||
|
|
||||||
# <a id="coding-style"></a> Coding Style
|
|
||||||
* the formatting is based on the clang-format tools
|
|
||||||
## Setting up eclipse auto-fromatter with clang-format
|
|
||||||
1. Help → Install New Software → Add
|
|
||||||
2. In location insert the link http://www.cppstyle.com/luna
|
|
||||||
3. The software package CppStyle should now be available for installation
|
|
||||||
4. On windows download the clang-formatting tools from https://llvm.org/builds/. On linux clang-format can be installed with the package manager.
|
|
||||||
5. Navigate to Preferences → C/C++ → CppStyle
|
|
||||||
6. Insert the path to the clang-format executable
|
|
||||||
7. Under C/C++ → Code Style → Formatter, change the formatter to CppStyle (clang-format)
|
|
||||||
8. Code can now be formatted with the clang tool by using the key combination Ctrl + Shift + f
|
|
||||||
|
@ -2,9 +2,7 @@ FROM ubuntu:focal
|
|||||||
|
|
||||||
RUN apt-get update
|
RUN apt-get update
|
||||||
RUN apt-get --yes upgrade
|
RUN apt-get --yes upgrade
|
||||||
#tzdata is a dependency, won't install otherwise
|
RUN apt-get --yes install cmake libgpiod-dev xz-utils nano curl
|
||||||
ARG DEBIAN_FRONTEND=noninteractive
|
|
||||||
RUN apt-get --yes install cmake libgpiod-dev xz-utils nano curl git gcc g++ lcov valgrind libgps-dev
|
|
||||||
|
|
||||||
# Q7S root filesystem, required for cross-compilation.
|
# Q7S root filesystem, required for cross-compilation.
|
||||||
RUN mkdir -p /usr/rootfs; \
|
RUN mkdir -p /usr/rootfs; \
|
||||||
@ -16,5 +14,6 @@ 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 Q7S_SYSROOT="/usr/rootfs/cortexa9hf-neon-xiphos-linux-gnueabi"
|
ENV Q7S_SYSROOT="/usr/rootfs/cortexa9hf-neon-xiphos-linux-gnueabi"
|
||||||
ENV PATH=$PATH:"/usr/tools/gcc-arm-8.3-2019.03-x86_64-arm-linux-gnueabihf/bin"
|
ENV PATH=$PATH:"/usr/tools/gcc-arm-8.3-2019.03-x86_64-arm-linux-gnueabihf/bin"
|
54
automation/Jenkinsfile
vendored
54
automation/Jenkinsfile
vendored
@ -1,36 +1,48 @@
|
|||||||
pipeline {
|
pipeline {
|
||||||
environment {
|
agent any
|
||||||
BUILDDIR_Q7 = 'build_q7'
|
|
||||||
BUILDDIR_LINUX = 'build_linux'
|
|
||||||
}
|
|
||||||
agent {
|
|
||||||
docker {
|
|
||||||
image 'eive-obsw-ci:d2'
|
|
||||||
args '--sysctl fs.mqueue.msg_max=100'
|
|
||||||
}
|
|
||||||
}
|
|
||||||
stages {
|
stages {
|
||||||
stage('Clean') {
|
stage('Build Container') {
|
||||||
|
when {
|
||||||
|
changeset "automation/Dockerfile-q7s"
|
||||||
|
branch 'develop'
|
||||||
|
}
|
||||||
steps {
|
steps {
|
||||||
sh 'rm -rf $BUILDDIR_Q7'
|
sh 'docker build -t eive-fsw-build-q7s:gcc8 - < automation/Dockerfile-q7s'
|
||||||
sh 'rm -rf $BUILDDIR_LINUX'
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
stage('Clean') {
|
||||||
|
when {
|
||||||
|
anyOf {
|
||||||
|
changelog 'cleanCI'
|
||||||
|
changeset '*.cmake'
|
||||||
|
changeset 'CMakeLists.txt'
|
||||||
|
}
|
||||||
|
}
|
||||||
|
steps {
|
||||||
|
sh 'rm -rf build-q7s-debug'
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
stage('Build Q7S') {
|
stage('Build Q7S') {
|
||||||
|
agent {
|
||||||
|
docker {
|
||||||
|
image 'eive-fsw-build-q7s:gcc8'
|
||||||
|
reuseNode true
|
||||||
|
}
|
||||||
|
}
|
||||||
steps {
|
steps {
|
||||||
dir(BUILDDIR_Q7) {
|
dir('build-q7s-debug') {
|
||||||
sh 'cmake -DTGT_BSP="arm/q7s" -DCMAKE_BUILD_TYPE=Debug ..'
|
sh 'cmake -DTGT_BSP="arm/q7s" -DCMAKE_BUILD_TYPE=Debug -DFSFW_OSAL=linux ..'
|
||||||
sh 'cmake --build . -j'
|
sh 'cmake --build . -j'
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
stage('Unittests') {
|
stage('Deploy') {
|
||||||
|
when {
|
||||||
|
tag 'v*.*.*'
|
||||||
|
}
|
||||||
steps {
|
steps {
|
||||||
dir(BUILDDIR_LINUX) {
|
sh 'echo Deploying'
|
||||||
sh 'cmake ..'
|
|
||||||
sh 'cmake --build . -t eive-unittest -j'
|
|
||||||
sh './eive-unittest'
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,7 +0,0 @@
|
|||||||
target_sources(${OBSW_NAME} PUBLIC
|
|
||||||
InitMission.cpp
|
|
||||||
main.cpp
|
|
||||||
ObjectFactory.cpp
|
|
||||||
)
|
|
||||||
|
|
||||||
add_subdirectory(boardconfig)
|
|
@ -1,192 +0,0 @@
|
|||||||
#include "InitMission.h"
|
|
||||||
|
|
||||||
#include <fsfw/objectmanager/ObjectManager.h>
|
|
||||||
#include <fsfw/objectmanager/ObjectManagerIF.h>
|
|
||||||
#include <fsfw/returnvalues/HasReturnvaluesIF.h>
|
|
||||||
#include <fsfw/serviceinterface/ServiceInterface.h>
|
|
||||||
#include <fsfw/tasks/FixedTimeslotTaskIF.h>
|
|
||||||
#include <fsfw/tasks/PeriodicTaskIF.h>
|
|
||||||
#include <fsfw/tasks/TaskFactory.h>
|
|
||||||
#include <mission/utility/InitMission.h>
|
|
||||||
|
|
||||||
#include <iostream>
|
|
||||||
|
|
||||||
#include "OBSWConfig.h"
|
|
||||||
#include "ObjectFactory.h"
|
|
||||||
#include "objects/systemObjectList.h"
|
|
||||||
#include "pollingsequence/pollingSequenceFactory.h"
|
|
||||||
|
|
||||||
ServiceInterfaceStream sif::debug("DEBUG");
|
|
||||||
ServiceInterfaceStream sif::info("INFO");
|
|
||||||
ServiceInterfaceStream sif::warning("WARNING");
|
|
||||||
ServiceInterfaceStream sif::error("ERROR");
|
|
||||||
|
|
||||||
ObjectManagerIF* objectManager = nullptr;
|
|
||||||
|
|
||||||
void initmission::initMission() {
|
|
||||||
sif::info << "Make sure the systemd service ser2net on the egse has been stopped "
|
|
||||||
<< "(alias stop-ser2net)" << std::endl;
|
|
||||||
sif::info << "Make sure the power lines of the star tracker have been enabled "
|
|
||||||
<< "(alias enable-startracker)" << std::endl;
|
|
||||||
sif::info << "Building global objects.." << std::endl;
|
|
||||||
/* Instantiate global object manager and also create all objects */
|
|
||||||
ObjectManager::instance()->setObjectFactoryFunction(ObjectFactory::produce, nullptr);
|
|
||||||
sif::info << "Initializing all objects.." << std::endl;
|
|
||||||
ObjectManager::instance()->initialize();
|
|
||||||
|
|
||||||
/* This function creates and starts all tasks */
|
|
||||||
initTasks();
|
|
||||||
}
|
|
||||||
|
|
||||||
void initmission::initTasks() {
|
|
||||||
TaskFactory* factory = TaskFactory::instance();
|
|
||||||
ReturnValue_t result = HasReturnvaluesIF::RETURN_OK;
|
|
||||||
if (factory == nullptr) {
|
|
||||||
/* Should never happen ! */
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
#if OBSW_PRINT_MISSED_DEADLINES == 1
|
|
||||||
void (*missedDeadlineFunc)(void) = TaskFactory::printMissedDeadline;
|
|
||||||
#else
|
|
||||||
void (*missedDeadlineFunc)(void) = nullptr;
|
|
||||||
#endif
|
|
||||||
|
|
||||||
/* TMTC Distribution */
|
|
||||||
PeriodicTaskIF* tmtcDistributor = factory->createPeriodicTask(
|
|
||||||
"DIST", 40, PeriodicTaskIF::MINIMUM_STACK_SIZE, 0.2, missedDeadlineFunc);
|
|
||||||
result = tmtcDistributor->addComponent(objects::CCSDS_PACKET_DISTRIBUTOR);
|
|
||||||
if (result != HasReturnvaluesIF::RETURN_OK) {
|
|
||||||
sif::error << "Object add component failed" << std::endl;
|
|
||||||
}
|
|
||||||
result = tmtcDistributor->addComponent(objects::PUS_PACKET_DISTRIBUTOR);
|
|
||||||
if (result != HasReturnvaluesIF::RETURN_OK) {
|
|
||||||
sif::error << "Object add component failed" << std::endl;
|
|
||||||
}
|
|
||||||
result = tmtcDistributor->addComponent(objects::TM_FUNNEL);
|
|
||||||
if (result != HasReturnvaluesIF::RETURN_OK) {
|
|
||||||
sif::error << "Object add component failed" << std::endl;
|
|
||||||
}
|
|
||||||
|
|
||||||
PeriodicTaskIF* tmtcBridgeTask = factory->createPeriodicTask(
|
|
||||||
"TMTC_BRIDGE", 50, PeriodicTaskIF::MINIMUM_STACK_SIZE, 0.2, missedDeadlineFunc);
|
|
||||||
result = tmtcBridgeTask->addComponent(objects::TMTC_BRIDGE);
|
|
||||||
if (result != HasReturnvaluesIF::RETURN_OK) {
|
|
||||||
sif::error << "Add component TMTC Bridge failed" << std::endl;
|
|
||||||
}
|
|
||||||
PeriodicTaskIF* tmtcPollingTask = factory->createPeriodicTask(
|
|
||||||
"TMTC_POLLING", 80, PeriodicTaskIF::MINIMUM_STACK_SIZE, 2.0, missedDeadlineFunc);
|
|
||||||
result = tmtcPollingTask->addComponent(objects::TMTC_POLLING_TASK);
|
|
||||||
if (result != HasReturnvaluesIF::RETURN_OK) {
|
|
||||||
sif::error << "Add component TMTC Polling failed" << std::endl;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* PUS Services */
|
|
||||||
std::vector<PeriodicTaskIF*> pusTasks;
|
|
||||||
createPusTasks(*factory, missedDeadlineFunc, pusTasks);
|
|
||||||
|
|
||||||
std::vector<PeriodicTaskIF*> pstTasks;
|
|
||||||
FixedTimeslotTaskIF* pst = factory->createFixedTimeslotTask(
|
|
||||||
"STAR_TRACKER_PST", 70, PeriodicTaskIF::MINIMUM_STACK_SIZE * 4, 0.5, missedDeadlineFunc);
|
|
||||||
result = pst::pstUart(pst);
|
|
||||||
if (result != HasReturnvaluesIF::RETURN_OK) {
|
|
||||||
sif::error << "InitMission::initTasks: Creating PST failed!" << std::endl;
|
|
||||||
}
|
|
||||||
pstTasks.push_back(pst);
|
|
||||||
|
|
||||||
PeriodicTaskIF* strHelperTask = factory->createPeriodicTask(
|
|
||||||
"STR_HELPER", 20, PeriodicTaskIF::MINIMUM_STACK_SIZE, 0.2, missedDeadlineFunc);
|
|
||||||
result = strHelperTask->addComponent(objects::STR_HELPER);
|
|
||||||
if (result != HasReturnvaluesIF::RETURN_OK) {
|
|
||||||
initmission::printAddObjectError("STR_HELPER", objects::STR_HELPER);
|
|
||||||
}
|
|
||||||
pstTasks.push_back(strHelperTask);
|
|
||||||
|
|
||||||
auto taskStarter = [](std::vector<PeriodicTaskIF*>& taskVector, std::string name) {
|
|
||||||
for (const auto& task : taskVector) {
|
|
||||||
if (task != nullptr) {
|
|
||||||
task->startTask();
|
|
||||||
} else {
|
|
||||||
sif::error << "Task in vector " << name << " is invalid!" << std::endl;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
sif::info << "Starting tasks.." << std::endl;
|
|
||||||
tmtcDistributor->startTask();
|
|
||||||
tmtcBridgeTask->startTask();
|
|
||||||
tmtcPollingTask->startTask();
|
|
||||||
|
|
||||||
taskStarter(pstTasks, "PST Tasks");
|
|
||||||
taskStarter(pusTasks, "PUS Tasks");
|
|
||||||
|
|
||||||
sif::info << "Tasks started.." << std::endl;
|
|
||||||
}
|
|
||||||
|
|
||||||
void initmission::createPusTasks(TaskFactory& factory,
|
|
||||||
TaskDeadlineMissedFunction missedDeadlineFunc,
|
|
||||||
std::vector<PeriodicTaskIF*>& taskVec) {
|
|
||||||
ReturnValue_t result = HasReturnvaluesIF::RETURN_OK;
|
|
||||||
PeriodicTaskIF* pusVerification = factory.createPeriodicTask(
|
|
||||||
"PUS_VERIF", 40, PeriodicTaskIF::MINIMUM_STACK_SIZE, 0.200, missedDeadlineFunc);
|
|
||||||
result = pusVerification->addComponent(objects::PUS_SERVICE_1_VERIFICATION);
|
|
||||||
if (result != HasReturnvaluesIF::RETURN_OK) {
|
|
||||||
sif::error << "Object add component failed" << std::endl;
|
|
||||||
}
|
|
||||||
taskVec.push_back(pusVerification);
|
|
||||||
|
|
||||||
PeriodicTaskIF* pusEvents = factory.createPeriodicTask(
|
|
||||||
"PUS_EVENTS", 60, PeriodicTaskIF::MINIMUM_STACK_SIZE, 0.200, missedDeadlineFunc);
|
|
||||||
result = pusEvents->addComponent(objects::PUS_SERVICE_5_EVENT_REPORTING);
|
|
||||||
if (result != HasReturnvaluesIF::RETURN_OK) {
|
|
||||||
initmission::printAddObjectError("PUS_EVENTS", objects::PUS_SERVICE_5_EVENT_REPORTING);
|
|
||||||
}
|
|
||||||
result = pusEvents->addComponent(objects::EVENT_MANAGER);
|
|
||||||
if (result != HasReturnvaluesIF::RETURN_OK) {
|
|
||||||
initmission::printAddObjectError("PUS_MGMT", objects::EVENT_MANAGER);
|
|
||||||
}
|
|
||||||
taskVec.push_back(pusEvents);
|
|
||||||
|
|
||||||
PeriodicTaskIF* pusHighPrio = factory.createPeriodicTask(
|
|
||||||
"PUS_HIGH_PRIO", 50, PeriodicTaskIF::MINIMUM_STACK_SIZE, 0.200, missedDeadlineFunc);
|
|
||||||
result = pusHighPrio->addComponent(objects::PUS_SERVICE_2_DEVICE_ACCESS);
|
|
||||||
if (result != HasReturnvaluesIF::RETURN_OK) {
|
|
||||||
initmission::printAddObjectError("PUS2", objects::PUS_SERVICE_2_DEVICE_ACCESS);
|
|
||||||
}
|
|
||||||
result = pusHighPrio->addComponent(objects::PUS_SERVICE_9_TIME_MGMT);
|
|
||||||
if (result != HasReturnvaluesIF::RETURN_OK) {
|
|
||||||
initmission::printAddObjectError("PUS9", objects::PUS_SERVICE_9_TIME_MGMT);
|
|
||||||
}
|
|
||||||
taskVec.push_back(pusHighPrio);
|
|
||||||
|
|
||||||
PeriodicTaskIF* pusMedPrio = factory.createPeriodicTask(
|
|
||||||
"PUS_MED_PRIO", 40, PeriodicTaskIF::MINIMUM_STACK_SIZE, 0.8, missedDeadlineFunc);
|
|
||||||
result = pusMedPrio->addComponent(objects::PUS_SERVICE_8_FUNCTION_MGMT);
|
|
||||||
if (result != HasReturnvaluesIF::RETURN_OK) {
|
|
||||||
initmission::printAddObjectError("PUS8", objects::PUS_SERVICE_8_FUNCTION_MGMT);
|
|
||||||
}
|
|
||||||
result = pusMedPrio->addComponent(objects::PUS_SERVICE_200_MODE_MGMT);
|
|
||||||
if (result != HasReturnvaluesIF::RETURN_OK) {
|
|
||||||
initmission::printAddObjectError("PUS200", objects::PUS_SERVICE_200_MODE_MGMT);
|
|
||||||
}
|
|
||||||
result = pusMedPrio->addComponent(objects::PUS_SERVICE_20_PARAMETERS);
|
|
||||||
if (result != HasReturnvaluesIF::RETURN_OK) {
|
|
||||||
initmission::printAddObjectError("PUS20", objects::PUS_SERVICE_20_PARAMETERS);
|
|
||||||
}
|
|
||||||
result = pusMedPrio->addComponent(objects::PUS_SERVICE_3_HOUSEKEEPING);
|
|
||||||
if (result != HasReturnvaluesIF::RETURN_OK) {
|
|
||||||
initmission::printAddObjectError("PUS3", objects::PUS_SERVICE_3_HOUSEKEEPING);
|
|
||||||
}
|
|
||||||
taskVec.push_back(pusMedPrio);
|
|
||||||
|
|
||||||
PeriodicTaskIF* pusLowPrio = factory.createPeriodicTask(
|
|
||||||
"PUS_LOW_PRIO", 30, PeriodicTaskIF::MINIMUM_STACK_SIZE, 1.6, missedDeadlineFunc);
|
|
||||||
result = pusLowPrio->addComponent(objects::PUS_SERVICE_17_TEST);
|
|
||||||
if (result != HasReturnvaluesIF::RETURN_OK) {
|
|
||||||
initmission::printAddObjectError("PUS17", objects::PUS_SERVICE_17_TEST);
|
|
||||||
}
|
|
||||||
result = pusLowPrio->addComponent(objects::INTERNAL_ERROR_REPORTER);
|
|
||||||
if (result != HasReturnvaluesIF::RETURN_OK) {
|
|
||||||
initmission::printAddObjectError("INT_ERR_RPRT", objects::INTERNAL_ERROR_REPORTER);
|
|
||||||
}
|
|
||||||
taskVec.push_back(pusLowPrio);
|
|
||||||
}
|
|
@ -1,21 +0,0 @@
|
|||||||
#ifndef BSP_LINUX_INITMISSION_H_
|
|
||||||
#define BSP_LINUX_INITMISSION_H_
|
|
||||||
|
|
||||||
#include <vector>
|
|
||||||
|
|
||||||
#include "fsfw/tasks/Typedef.h"
|
|
||||||
|
|
||||||
class PeriodicTaskIF;
|
|
||||||
class TaskFactory;
|
|
||||||
|
|
||||||
namespace initmission {
|
|
||||||
void initMission();
|
|
||||||
void initTasks();
|
|
||||||
|
|
||||||
void createPstTasks(TaskFactory& factory, TaskDeadlineMissedFunction missedDeadlineFunc,
|
|
||||||
std::vector<PeriodicTaskIF*>& taskVec);
|
|
||||||
void createPusTasks(TaskFactory& factory, TaskDeadlineMissedFunction missedDeadlineFunc,
|
|
||||||
std::vector<PeriodicTaskIF*>& taskVec);
|
|
||||||
}; // namespace initmission
|
|
||||||
|
|
||||||
#endif /* BSP_LINUX_INITMISSION_H_ */
|
|
@ -1,49 +0,0 @@
|
|||||||
#include "ObjectFactory.h"
|
|
||||||
|
|
||||||
#include <devConf.h>
|
|
||||||
#include <fsfw_hal/linux/uart/UartComIF.h>
|
|
||||||
#include <fsfw_hal/linux/uart/UartCookie.h>
|
|
||||||
#include <mission/devices/GPSHyperionHandler.h>
|
|
||||||
|
|
||||||
#include "OBSWConfig.h"
|
|
||||||
#include "busConf.h"
|
|
||||||
#include "fsfw/datapoollocal/LocalDataPoolManager.h"
|
|
||||||
#include "fsfw/tmtcpacket/pus/tm.h"
|
|
||||||
#include "fsfw/tmtcservices/CommandingServiceBase.h"
|
|
||||||
#include "fsfw/tmtcservices/PusServiceBase.h"
|
|
||||||
#include "linux/devices/devicedefinitions/StarTrackerDefinitions.h"
|
|
||||||
#include "linux/devices/startracker/StarTrackerHandler.h"
|
|
||||||
#include "mission/core/GenericFactory.h"
|
|
||||||
#include "mission/utility/TmFunnel.h"
|
|
||||||
#include "objects/systemObjectList.h"
|
|
||||||
#include "tmtc/apid.h"
|
|
||||||
#include "tmtc/pusIds.h"
|
|
||||||
|
|
||||||
void Factory::setStaticFrameworkObjectIds() {
|
|
||||||
PusServiceBase::packetSource = objects::PUS_PACKET_DISTRIBUTOR;
|
|
||||||
PusServiceBase::packetDestination = objects::TM_FUNNEL;
|
|
||||||
|
|
||||||
CommandingServiceBase::defaultPacketSource = objects::PUS_PACKET_DISTRIBUTOR;
|
|
||||||
CommandingServiceBase::defaultPacketDestination = objects::TM_FUNNEL;
|
|
||||||
|
|
||||||
TmFunnel::downlinkDestination = objects::TMTC_BRIDGE;
|
|
||||||
TmFunnel::storageDestination = objects::NO_OBJECT;
|
|
||||||
|
|
||||||
VerificationReporter::messageReceiver = objects::PUS_SERVICE_1_VERIFICATION;
|
|
||||||
TmPacketBase::timeStamperId = objects::TIME_STAMPER;
|
|
||||||
}
|
|
||||||
|
|
||||||
void ObjectFactory::produce(void* args) {
|
|
||||||
Factory::setStaticFrameworkObjectIds();
|
|
||||||
ObjectFactory::produceGenericObjects();
|
|
||||||
|
|
||||||
UartCookie* starTrackerCookie =
|
|
||||||
new UartCookie(objects::STAR_TRACKER, egse::STAR_TRACKER_UART, UartModes::NON_CANONICAL,
|
|
||||||
uart::STAR_TRACKER_BAUD, startracker::MAX_FRAME_SIZE * 2 + 2);
|
|
||||||
new UartComIF(objects::UART_COM_IF);
|
|
||||||
starTrackerCookie->setNoFixedSizeReply();
|
|
||||||
StrHelper* strHelper = new StrHelper(objects::STR_HELPER);
|
|
||||||
StarTrackerHandler* starTrackerHandler = new StarTrackerHandler(
|
|
||||||
objects::STAR_TRACKER, objects::UART_COM_IF, starTrackerCookie, strHelper);
|
|
||||||
starTrackerHandler->setStartUpImmediately();
|
|
||||||
}
|
|
@ -1,8 +0,0 @@
|
|||||||
#ifndef BSP_LINUX_OBJECTFACTORY_H_
|
|
||||||
#define BSP_LINUX_OBJECTFACTORY_H_
|
|
||||||
|
|
||||||
namespace ObjectFactory {
|
|
||||||
void produce(void* args);
|
|
||||||
}; // namespace ObjectFactory
|
|
||||||
|
|
||||||
#endif /* BSP_LINUX_OBJECTFACTORY_H_ */
|
|
@ -1,7 +0,0 @@
|
|||||||
target_sources(${OBSW_NAME} PRIVATE
|
|
||||||
print.c
|
|
||||||
)
|
|
||||||
|
|
||||||
target_include_directories(${OBSW_NAME} PUBLIC
|
|
||||||
${CMAKE_CURRENT_SOURCE_DIR}
|
|
||||||
)
|
|
@ -1,8 +0,0 @@
|
|||||||
#ifndef BSP_EGSE_BOARDCONFIG_BUSCONF_H_
|
|
||||||
#define BSP_EGSE_BOARDCONFIG_BUSCONF_H_
|
|
||||||
|
|
||||||
namespace egse {
|
|
||||||
static constexpr char STAR_TRACKER_UART[] = "/dev/serial0";
|
|
||||||
}
|
|
||||||
|
|
||||||
#endif /* BSP_EGSE_BOARDCONFIG_BUSCONF_H_ */
|
|
@ -1,38 +0,0 @@
|
|||||||
///\file
|
|
||||||
|
|
||||||
/******************************************************************************
|
|
||||||
The MIT License(MIT)
|
|
||||||
|
|
||||||
Embedded Template Library.
|
|
||||||
https://github.com/ETLCPP/etl
|
|
||||||
https://www.etlcpp.com
|
|
||||||
|
|
||||||
Copyright(c) 2019 jwellbelove
|
|
||||||
|
|
||||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
||||||
of this software and associated documentation files(the "Software"), to deal
|
|
||||||
in the Software without restriction, including without limitation the rights
|
|
||||||
to use, copy, modify, merge, publish, distribute, sublicense, and / or sell
|
|
||||||
copies of the Software, and to permit persons to whom the Software is
|
|
||||||
furnished to do so, subject to the following conditions :
|
|
||||||
|
|
||||||
The above copyright notice and this permission notice shall be included in all
|
|
||||||
copies or substantial portions of the Software.
|
|
||||||
|
|
||||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
||||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
||||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.IN NO EVENT SHALL THE
|
|
||||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
||||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
||||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
||||||
SOFTWARE.
|
|
||||||
******************************************************************************/
|
|
||||||
#ifndef __ETL_PROFILE_H__
|
|
||||||
#define __ETL_PROFILE_H__
|
|
||||||
|
|
||||||
#define ETL_CHECK_PUSH_POP
|
|
||||||
|
|
||||||
#define ETL_CPP11_SUPPORTED 1
|
|
||||||
#define ETL_NO_NULLPTR_SUPPORT 0
|
|
||||||
|
|
||||||
#endif
|
|
@ -1,15 +0,0 @@
|
|||||||
#ifndef LINUX_GCOV_H_
|
|
||||||
#define LINUX_GCOV_H_
|
|
||||||
#include <fsfw/serviceinterface/ServiceInterfaceStream.h>
|
|
||||||
|
|
||||||
#ifdef GCOV
|
|
||||||
extern "C" void __gcov_flush();
|
|
||||||
#else
|
|
||||||
void __gcov_flush() {
|
|
||||||
sif::info << "GCC GCOV: Please supply GCOV=1 in Makefile if "
|
|
||||||
"coverage information is desired.\n"
|
|
||||||
<< std::flush;
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#endif /* LINUX_GCOV_H_ */
|
|
@ -1,10 +0,0 @@
|
|||||||
#include <bsp_egse/boardconfig/print.h>
|
|
||||||
#include <stdio.h>
|
|
||||||
|
|
||||||
void printChar(const char* character, bool errStream) {
|
|
||||||
if (errStream) {
|
|
||||||
putc(*character, stderr);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
putc(*character, stdout);
|
|
||||||
}
|
|
@ -1,8 +0,0 @@
|
|||||||
#ifndef HOSTED_BOARDCONFIG_PRINT_H_
|
|
||||||
#define HOSTED_BOARDCONFIG_PRINT_H_
|
|
||||||
|
|
||||||
#include <stdbool.h>
|
|
||||||
|
|
||||||
void printChar(const char* character, bool errStream);
|
|
||||||
|
|
||||||
#endif /* HOSTED_BOARDCONFIG_PRINT_H_ */
|
|
@ -1,6 +0,0 @@
|
|||||||
#ifndef BSP_RPI_BOARDCONFIG_RPI_CONFIG_H_
|
|
||||||
#define BSP_RPI_BOARDCONFIG_RPI_CONFIG_H_
|
|
||||||
|
|
||||||
#include <cstdint>
|
|
||||||
|
|
||||||
#endif /* BSP_RPI_BOARDCONFIG_RPI_CONFIG_H_ */
|
|
@ -1,28 +0,0 @@
|
|||||||
#include <iostream>
|
|
||||||
|
|
||||||
#include "InitMission.h"
|
|
||||||
#include "OBSWConfig.h"
|
|
||||||
#include "OBSWVersion.h"
|
|
||||||
#include "fsfw/FSFWVersion.h"
|
|
||||||
#include "fsfw/tasks/TaskFactory.h"
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @brief This is the main program entry point for the egse (raspberry pi 4)
|
|
||||||
* @return
|
|
||||||
*/
|
|
||||||
int main(void) {
|
|
||||||
std::cout << "-- EIVE OBSW --" << std::endl;
|
|
||||||
std::cout << "-- Compiled for EGSE from Arcsec"
|
|
||||||
<< " --" << std::endl;
|
|
||||||
std::cout << "-- OBSW " << SW_NAME << " v" << SW_VERSION << "." << SW_SUBVERSION << "."
|
|
||||||
<< SW_REVISION << ", FSFW v" << FSFW_VERSION << "." << FSFW_SUBVERSION << FSFW_REVISION
|
|
||||||
<< "--" << std::endl;
|
|
||||||
std::cout << "-- " << __DATE__ << " " << __TIME__ << " --" << std::endl;
|
|
||||||
|
|
||||||
initmission::initMission();
|
|
||||||
|
|
||||||
for (;;) {
|
|
||||||
/* Suspend main thread by sleeping it. */
|
|
||||||
TaskFactory::delayTask(5000);
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,4 +1,4 @@
|
|||||||
target_sources(${OBSW_NAME} PUBLIC
|
target_sources(${TARGET_NAME} PUBLIC
|
||||||
InitMission.cpp
|
InitMission.cpp
|
||||||
main.cpp
|
main.cpp
|
||||||
ObjectFactory.cpp
|
ObjectFactory.cpp
|
||||||
|
@ -1,19 +1,20 @@
|
|||||||
#include "InitMission.h"
|
#include "InitMission.h"
|
||||||
|
#include "ObjectFactory.h"
|
||||||
|
|
||||||
#include <OBSWConfig.h>
|
#include <OBSWConfig.h>
|
||||||
#include <fsfw/objectmanager/ObjectManager.h>
|
|
||||||
#include <fsfw/objectmanager/ObjectManagerIF.h>
|
#include <fsfw/objectmanager/ObjectManagerIF.h>
|
||||||
#include <fsfw/returnvalues/HasReturnvaluesIF.h>
|
#include <fsfw/returnvalues/HasReturnvaluesIF.h>
|
||||||
#include <fsfw/serviceinterface/ServiceInterfaceStream.h>
|
#include <fsfw/serviceinterface/ServiceInterfaceStream.h>
|
||||||
|
#include <fsfw/objectmanager/ObjectManager.h>
|
||||||
#include <fsfw/tasks/FixedTimeslotTaskIF.h>
|
#include <fsfw/tasks/FixedTimeslotTaskIF.h>
|
||||||
#include <fsfw/tasks/PeriodicTaskIF.h>
|
#include <fsfw/tasks/PeriodicTaskIF.h>
|
||||||
#include <fsfw/tasks/TaskFactory.h>
|
#include <fsfw/tasks/TaskFactory.h>
|
||||||
|
|
||||||
#include <mission/utility/InitMission.h>
|
#include <mission/utility/InitMission.h>
|
||||||
|
|
||||||
#include <iostream>
|
#include <iostream>
|
||||||
|
|
||||||
#include "ObjectFactory.h"
|
|
||||||
|
|
||||||
#ifdef LINUX
|
#ifdef LINUX
|
||||||
ServiceInterfaceStream sif::debug("DEBUG");
|
ServiceInterfaceStream sif::debug("DEBUG");
|
||||||
ServiceInterfaceStream sif::info("INFO");
|
ServiceInterfaceStream sif::info("INFO");
|
||||||
@ -54,7 +55,8 @@ void initmission::initTasks() {
|
|||||||
/* TMTC Distribution */
|
/* TMTC Distribution */
|
||||||
PeriodicTaskIF* tmTcDistributor = factory->createPeriodicTask(
|
PeriodicTaskIF* tmTcDistributor = factory->createPeriodicTask(
|
||||||
"DIST", 40, PeriodicTaskIF::MINIMUM_STACK_SIZE, 0.2, missedDeadlineFunc);
|
"DIST", 40, PeriodicTaskIF::MINIMUM_STACK_SIZE, 0.2, missedDeadlineFunc);
|
||||||
ReturnValue_t result = tmTcDistributor->addComponent(objects::CCSDS_PACKET_DISTRIBUTOR);
|
ReturnValue_t result = tmTcDistributor->addComponent(
|
||||||
|
objects::CCSDS_PACKET_DISTRIBUTOR);
|
||||||
if(result != HasReturnvaluesIF::RETURN_OK){
|
if(result != HasReturnvaluesIF::RETURN_OK){
|
||||||
sif::error << "Object add component failed" << std::endl;
|
sif::error << "Object add component failed" << std::endl;
|
||||||
}
|
}
|
||||||
|
@ -4,6 +4,6 @@
|
|||||||
namespace initmission {
|
namespace initmission {
|
||||||
void initMission();
|
void initMission();
|
||||||
void initTasks();
|
void initTasks();
|
||||||
}; // namespace initmission
|
};
|
||||||
|
|
||||||
#endif /* BSP_LINUX_INITMISSION_H_ */
|
#endif /* BSP_LINUX_INITMISSION_H_ */
|
||||||
|
@ -1,14 +1,14 @@
|
|||||||
#include "ObjectFactory.h"
|
#include "ObjectFactory.h"
|
||||||
|
#include "OBSWConfig.h"
|
||||||
#include <fsfw/tmtcservices/CommandingServiceBase.h>
|
|
||||||
#include <fsfw/tmtcservices/PusServiceBase.h>
|
|
||||||
#include <mission/core/GenericFactory.h>
|
|
||||||
#include <mission/utility/TmFunnel.h>
|
|
||||||
#include <objects/systemObjectList.h>
|
#include <objects/systemObjectList.h>
|
||||||
#include <tmtc/apid.h>
|
#include <tmtc/apid.h>
|
||||||
#include <tmtc/pusIds.h>
|
#include <tmtc/pusIds.h>
|
||||||
|
|
||||||
#include "OBSWConfig.h"
|
#include <fsfw/tmtcservices/CommandingServiceBase.h>
|
||||||
|
#include <fsfw/tmtcservices/PusServiceBase.h>
|
||||||
|
|
||||||
|
#include <mission/core/GenericFactory.h>
|
||||||
|
#include <mission/utility/TmFunnel.h>
|
||||||
|
|
||||||
#if OBSW_USE_TMTC_TCP_BRIDGE == 0
|
#if OBSW_USE_TMTC_TCP_BRIDGE == 0
|
||||||
#include "fsfw/osal/common/UdpTcPollingTask.h"
|
#include "fsfw/osal/common/UdpTcPollingTask.h"
|
||||||
@ -20,6 +20,7 @@
|
|||||||
|
|
||||||
#include <fsfw/tmtcpacket/pus/tm.h>
|
#include <fsfw/tmtcpacket/pus/tm.h>
|
||||||
|
|
||||||
|
|
||||||
#if OBSW_ADD_TEST_CODE == 1
|
#if OBSW_ADD_TEST_CODE == 1
|
||||||
#include <test/testtasks/TestTask.h>
|
#include <test/testtasks/TestTask.h>
|
||||||
#endif
|
#endif
|
||||||
@ -43,5 +44,18 @@ void ObjectFactory::produce(void* args) {
|
|||||||
Factory::setStaticFrameworkObjectIds();
|
Factory::setStaticFrameworkObjectIds();
|
||||||
ObjectFactory::produceGenericObjects();
|
ObjectFactory::produceGenericObjects();
|
||||||
|
|
||||||
|
#if OBSW_USE_TMTC_TCP_BRIDGE == 0
|
||||||
|
sif::info << "Setting up UDP TMTC bridge with listener port " <<
|
||||||
|
UdpTmTcBridge::DEFAULT_SERVER_PORT << std::endl;
|
||||||
|
new UdpTmTcBridge(objects::TMTC_BRIDGE, objects::CCSDS_PACKET_DISTRIBUTOR);
|
||||||
|
new UdpTcPollingTask(objects::TMTC_POLLING_TASK, objects::TMTC_BRIDGE);
|
||||||
|
#else
|
||||||
|
sif::info << "Setting up TCP TMTC bridge with listener port " <<
|
||||||
|
TcpTmTcServer::DEFAULT_SERVER_PORT << std::endl;
|
||||||
|
new TcpTmTcBridge(objects::TMTC_BRIDGE, objects::CCSDS_PACKET_DISTRIBUTOR);
|
||||||
|
new TcpTmTcServer(objects::TMTC_POLLING_TASK, objects::TMTC_BRIDGE);
|
||||||
|
#endif
|
||||||
|
|
||||||
new TestTask(objects::TEST_TASK);
|
new TestTask(objects::TEST_TASK);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -1,9 +1,10 @@
|
|||||||
#ifndef BSP_LINUX_OBJECTFACTORY_H_
|
#ifndef BSP_LINUX_OBJECTFACTORY_H_
|
||||||
#define BSP_LINUX_OBJECTFACTORY_H_
|
#define BSP_LINUX_OBJECTFACTORY_H_
|
||||||
|
|
||||||
|
|
||||||
namespace ObjectFactory {
|
namespace ObjectFactory {
|
||||||
void setStatics();
|
void setStatics();
|
||||||
void produce(void* args);
|
void produce(void* args);
|
||||||
}; // namespace ObjectFactory
|
};
|
||||||
|
|
||||||
#endif /* BSP_LINUX_OBJECTFACTORY_H_ */
|
#endif /* BSP_LINUX_OBJECTFACTORY_H_ */
|
||||||
|
@ -1,8 +1,8 @@
|
|||||||
target_sources(${OBSW_NAME} PRIVATE
|
target_sources(${TARGET_NAME} PRIVATE
|
||||||
print.c
|
print.c
|
||||||
)
|
)
|
||||||
|
|
||||||
target_include_directories(${OBSW_NAME} PUBLIC
|
target_include_directories(${TARGET_NAME} PUBLIC
|
||||||
${CMAKE_CURRENT_SOURCE_DIR}
|
${CMAKE_CURRENT_SOURCE_DIR}
|
||||||
)
|
)
|
||||||
|
|
||||||
|
@ -7,8 +7,7 @@ extern "C" void __gcov_flush();
|
|||||||
#else
|
#else
|
||||||
void __gcov_flush() {
|
void __gcov_flush() {
|
||||||
sif::info << "GCC GCOV: Please supply GCOV=1 in Makefile if "
|
sif::info << "GCC GCOV: Please supply GCOV=1 in Makefile if "
|
||||||
"coverage information is desired.\n"
|
"coverage information is desired.\n" << std::flush;
|
||||||
<< std::flush;
|
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
@ -9,3 +9,7 @@ void printChar(const char* character, bool errStream) {
|
|||||||
}
|
}
|
||||||
putc(*character, stdout);
|
putc(*character, stdout);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@ -1,25 +1,26 @@
|
|||||||
#include "ArduinoComIF.h"
|
#include "ArduinoComIF.h"
|
||||||
|
|
||||||
#include <fsfw/globalfunctions/CRC.h>
|
|
||||||
#include <fsfw/globalfunctions/DleEncoder.h>
|
|
||||||
#include <fsfw/serviceinterface/ServiceInterfaceStream.h>
|
|
||||||
|
|
||||||
#include "ArduinoCookie.h"
|
#include "ArduinoCookie.h"
|
||||||
|
|
||||||
|
#include <fsfw/globalfunctions/DleEncoder.h>
|
||||||
|
#include <fsfw/globalfunctions/CRC.h>
|
||||||
|
#include <fsfw/serviceinterface/ServiceInterfaceStream.h>
|
||||||
|
|
||||||
// This only works on Linux
|
// This only works on Linux
|
||||||
#ifdef LINUX
|
#ifdef LINUX
|
||||||
#include <fcntl.h>
|
|
||||||
#include <termios.h>
|
#include <termios.h>
|
||||||
|
#include <fcntl.h>
|
||||||
#include <unistd.h>
|
#include <unistd.h>
|
||||||
#elif WIN32
|
#elif WIN32
|
||||||
#include <strsafe.h>
|
|
||||||
#include <windows.h>
|
#include <windows.h>
|
||||||
|
#include <strsafe.h>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#include <cstring>
|
#include <cstring>
|
||||||
|
|
||||||
ArduinoComIF::ArduinoComIF(object_id_t setObjectId, bool promptComIF, const char *serialDevice)
|
ArduinoComIF::ArduinoComIF(object_id_t setObjectId, bool promptComIF,
|
||||||
: rxBuffer(MAX_PACKET_SIZE * MAX_NUMBER_OF_SPI_DEVICES * 10, true), SystemObject(setObjectId) {
|
const char *serialDevice):
|
||||||
|
rxBuffer(MAX_PACKET_SIZE * MAX_NUMBER_OF_SPI_DEVICES*10, true),
|
||||||
|
SystemObject(setObjectId) {
|
||||||
#ifdef LINUX
|
#ifdef LINUX
|
||||||
initialized = false;
|
initialized = false;
|
||||||
serialPort = ::open("/dev/ttyUSB0", O_RDWR);
|
serialPort = ::open("/dev/ttyUSB0", O_RDWR);
|
||||||
@ -65,6 +66,7 @@ ArduinoComIF::ArduinoComIF(object_id_t setObjectId, bool promptComIF, const char
|
|||||||
sif::info << "Please enter the COM port (c to cancel): " << std::flush;
|
sif::info << "Please enter the COM port (c to cancel): " << std::flush;
|
||||||
std::string comPort;
|
std::string comPort;
|
||||||
while(hCom == INVALID_HANDLE_VALUE) {
|
while(hCom == INVALID_HANDLE_VALUE) {
|
||||||
|
|
||||||
std::getline(std::cin, comPort);
|
std::getline(std::cin, comPort);
|
||||||
if(comPort[0] == 'c') {
|
if(comPort[0] == 'c') {
|
||||||
break;
|
break;
|
||||||
@ -78,29 +80,37 @@ ArduinoComIF::ArduinoComIF(object_id_t setObjectId, bool promptComIF, const char
|
|||||||
0, // Non Overlapped I/O
|
0, // Non Overlapped I/O
|
||||||
NULL); // Null for Comm Devices
|
NULL); // Null for Comm Devices
|
||||||
|
|
||||||
if (hCom == INVALID_HANDLE_VALUE) {
|
if (hCom == INVALID_HANDLE_VALUE)
|
||||||
|
{
|
||||||
if(GetLastError() == 2) {
|
if(GetLastError() == 2) {
|
||||||
sif::error << "COM Port does not found!" << std::endl;
|
sif::error << "COM Port does not found!" << std::endl;
|
||||||
} else {
|
}
|
||||||
|
else {
|
||||||
TCHAR err[128];
|
TCHAR err[128];
|
||||||
FormatMessage(FORMAT_MESSAGE_FROM_SYSTEM, NULL, GetLastError(),
|
FormatMessage(FORMAT_MESSAGE_FROM_SYSTEM, NULL,
|
||||||
MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT), err, sizeof(err), NULL);
|
GetLastError(),
|
||||||
|
MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT),
|
||||||
|
err, sizeof(err), NULL);
|
||||||
// Handle the error.
|
// Handle the error.
|
||||||
sif::info << "CreateFileA Error code: " << GetLastError() << std::endl;
|
sif::info << "CreateFileA Error code: " << GetLastError()
|
||||||
|
<< std::endl;
|
||||||
sif::error << err << std::flush;
|
sif::error << err << std::flush;
|
||||||
}
|
}
|
||||||
sif::info << "Please enter a valid COM port: " << std::flush;
|
sif::info << "Please enter a valid COM port: " << std::flush;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
serialParams.DCBlength = sizeof(serialParams);
|
serialParams.DCBlength = sizeof(serialParams);
|
||||||
if(baudRate == 9600) {
|
if(baudRate == 9600) {
|
||||||
serialParams.BaudRate = CBR_9600;
|
serialParams.BaudRate = CBR_9600;
|
||||||
}
|
}
|
||||||
if(baudRate == 115200) {
|
if(baudRate == 115200) {
|
||||||
serialParams.BaudRate = CBR_115200;
|
serialParams.BaudRate = CBR_115200;
|
||||||
} else {
|
}
|
||||||
|
else {
|
||||||
serialParams.BaudRate = baudRate;
|
serialParams.BaudRate = baudRate;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -133,22 +143,29 @@ ReturnValue_t ArduinoComIF::initializeInterface(CookieIF *cookie) {
|
|||||||
return HasReturnvaluesIF::RETURN_OK;
|
return HasReturnvaluesIF::RETURN_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
ReturnValue_t ArduinoComIF::sendMessage(CookieIF *cookie, const uint8_t *data, size_t len) {
|
ReturnValue_t ArduinoComIF::sendMessage(CookieIF *cookie, const uint8_t *data,
|
||||||
|
size_t len) {
|
||||||
ArduinoCookie *arduinoCookie = dynamic_cast<ArduinoCookie*>(cookie);
|
ArduinoCookie *arduinoCookie = dynamic_cast<ArduinoCookie*>(cookie);
|
||||||
if (arduinoCookie == nullptr) {
|
if (arduinoCookie == nullptr) {
|
||||||
return INVALID_COOKIE_TYPE;
|
return INVALID_COOKIE_TYPE;
|
||||||
}
|
}
|
||||||
|
|
||||||
return sendMessage(arduinoCookie->command, arduinoCookie->address, data, len);
|
return sendMessage(arduinoCookie->command, arduinoCookie->address, data,
|
||||||
|
len);
|
||||||
}
|
}
|
||||||
|
|
||||||
ReturnValue_t ArduinoComIF::getSendSuccess(CookieIF *cookie) { return RETURN_OK; }
|
ReturnValue_t ArduinoComIF::getSendSuccess(CookieIF *cookie) {
|
||||||
|
|
||||||
ReturnValue_t ArduinoComIF::requestReceiveMessage(CookieIF *cookie, size_t requestLen) {
|
|
||||||
return RETURN_OK;
|
return RETURN_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
ReturnValue_t ArduinoComIF::readReceivedMessage(CookieIF *cookie, uint8_t **buffer, size_t *size) {
|
ReturnValue_t ArduinoComIF::requestReceiveMessage(CookieIF *cookie,
|
||||||
|
size_t requestLen) {
|
||||||
|
return RETURN_OK;
|
||||||
|
}
|
||||||
|
|
||||||
|
ReturnValue_t ArduinoComIF::readReceivedMessage(CookieIF *cookie,
|
||||||
|
uint8_t **buffer, size_t *size) {
|
||||||
|
|
||||||
handleSerialPortRx();
|
handleSerialPortRx();
|
||||||
|
|
||||||
ArduinoCookie *arduinoCookie = dynamic_cast<ArduinoCookie*>(cookie);
|
ArduinoCookie *arduinoCookie = dynamic_cast<ArduinoCookie*>(cookie);
|
||||||
@ -161,8 +178,8 @@ ReturnValue_t ArduinoComIF::readReceivedMessage(CookieIF *cookie, uint8_t **buff
|
|||||||
return HasReturnvaluesIF::RETURN_OK;
|
return HasReturnvaluesIF::RETURN_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
ReturnValue_t ArduinoComIF::sendMessage(uint8_t command, uint8_t address, const uint8_t *data,
|
ReturnValue_t ArduinoComIF::sendMessage(uint8_t command,
|
||||||
size_t dataLen) {
|
uint8_t address, const uint8_t *data, size_t dataLen) {
|
||||||
if (dataLen > UINT16_MAX) {
|
if (dataLen > UINT16_MAX) {
|
||||||
return TOO_MUCH_DATA;
|
return TOO_MUCH_DATA;
|
||||||
}
|
}
|
||||||
@ -176,15 +193,16 @@ ReturnValue_t ArduinoComIF::sendMessage(uint8_t command, uint8_t address, const
|
|||||||
size_t remainingLen = sizeof(sendBuffer) - 1;
|
size_t remainingLen = sizeof(sendBuffer) - 1;
|
||||||
size_t encodedLen = 0;
|
size_t encodedLen = 0;
|
||||||
|
|
||||||
ReturnValue_t result =
|
ReturnValue_t result = DleEncoder::encode(&command, 1, currentPosition,
|
||||||
DleEncoder::encode(&command, 1, currentPosition, remainingLen, &encodedLen, false);
|
remainingLen, &encodedLen, false);
|
||||||
if (result != RETURN_OK) {
|
if (result != RETURN_OK) {
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
currentPosition += encodedLen;
|
currentPosition += encodedLen;
|
||||||
remainingLen -= encodedLen; //DleEncoder will never return encodedLen > remainingLen
|
remainingLen -= encodedLen; //DleEncoder will never return encodedLen > remainingLen
|
||||||
|
|
||||||
result = DleEncoder::encode(&address, 1, currentPosition, remainingLen, &encodedLen, false);
|
result = DleEncoder::encode(&address, 1, currentPosition, remainingLen,
|
||||||
|
&encodedLen, false);
|
||||||
if (result != RETURN_OK) {
|
if (result != RETURN_OK) {
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
@ -197,8 +215,8 @@ ReturnValue_t ArduinoComIF::sendMessage(uint8_t command, uint8_t address, const
|
|||||||
temporaryBuffer[0] = dataLen >> 8; //we checked dataLen above
|
temporaryBuffer[0] = dataLen >> 8; //we checked dataLen above
|
||||||
temporaryBuffer[1] = dataLen;
|
temporaryBuffer[1] = dataLen;
|
||||||
|
|
||||||
result =
|
result = DleEncoder::encode(temporaryBuffer, 2, currentPosition,
|
||||||
DleEncoder::encode(temporaryBuffer, 2, currentPosition, remainingLen, &encodedLen, false);
|
remainingLen, &encodedLen, false);
|
||||||
if (result != RETURN_OK) {
|
if (result != RETURN_OK) {
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
@ -206,7 +224,8 @@ ReturnValue_t ArduinoComIF::sendMessage(uint8_t command, uint8_t address, const
|
|||||||
remainingLen -= encodedLen; //DleEncoder will never return encodedLen > remainingLen
|
remainingLen -= encodedLen; //DleEncoder will never return encodedLen > remainingLen
|
||||||
|
|
||||||
//encoding the actual data
|
//encoding the actual data
|
||||||
result = DleEncoder::encode(data, dataLen, currentPosition, remainingLen, &encodedLen, false);
|
result = DleEncoder::encode(data, dataLen, currentPosition, remainingLen,
|
||||||
|
&encodedLen, false);
|
||||||
if (result != RETURN_OK) {
|
if (result != RETURN_OK) {
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
@ -222,8 +241,8 @@ ReturnValue_t ArduinoComIF::sendMessage(uint8_t command, uint8_t address, const
|
|||||||
temporaryBuffer[0] = crc >> 8;
|
temporaryBuffer[0] = crc >> 8;
|
||||||
temporaryBuffer[1] = crc;
|
temporaryBuffer[1] = crc;
|
||||||
|
|
||||||
result =
|
result = DleEncoder::encode(temporaryBuffer, 2, currentPosition,
|
||||||
DleEncoder::encode(temporaryBuffer, 2, currentPosition, remainingLen, &encodedLen, false);
|
remainingLen, &encodedLen, false);
|
||||||
if (result != RETURN_OK) {
|
if (result != RETURN_OK) {
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
@ -260,7 +279,8 @@ void ArduinoComIF::handleSerialPortRx() {
|
|||||||
|
|
||||||
uint8_t dataFromSerial[availableSpace];
|
uint8_t dataFromSerial[availableSpace];
|
||||||
|
|
||||||
ssize_t bytesRead = read(serialPort, dataFromSerial, sizeof(dataFromSerial));
|
ssize_t bytesRead = read(serialPort, dataFromSerial,
|
||||||
|
sizeof(dataFromSerial));
|
||||||
|
|
||||||
if (bytesRead < 0) {
|
if (bytesRead < 0) {
|
||||||
return;
|
return;
|
||||||
@ -272,12 +292,13 @@ void ArduinoComIF::handleSerialPortRx() {
|
|||||||
|
|
||||||
uint32_t dataLenReceivedSoFar = 0;
|
uint32_t dataLenReceivedSoFar = 0;
|
||||||
|
|
||||||
rxBuffer.readData(dataReceivedSoFar, sizeof(dataReceivedSoFar), true, &dataLenReceivedSoFar);
|
rxBuffer.readData(dataReceivedSoFar, sizeof(dataReceivedSoFar), true,
|
||||||
|
&dataLenReceivedSoFar);
|
||||||
|
|
||||||
//look for STX
|
//look for STX
|
||||||
size_t firstSTXinRawData = 0;
|
size_t firstSTXinRawData = 0;
|
||||||
while ((firstSTXinRawData < dataLenReceivedSoFar) &&
|
while ((firstSTXinRawData < dataLenReceivedSoFar)
|
||||||
(dataReceivedSoFar[firstSTXinRawData] != DleEncoder::STX_CHAR)) {
|
&& (dataReceivedSoFar[firstSTXinRawData] != DleEncoder::STX_CHAR)) {
|
||||||
firstSTXinRawData++;
|
firstSTXinRawData++;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -292,9 +313,10 @@ void ArduinoComIF::handleSerialPortRx() {
|
|||||||
|
|
||||||
size_t readSize = 0;
|
size_t readSize = 0;
|
||||||
|
|
||||||
ReturnValue_t result = DleEncoder::decode(dataReceivedSoFar + firstSTXinRawData,
|
ReturnValue_t result = DleEncoder::decode(
|
||||||
dataLenReceivedSoFar - firstSTXinRawData, &readSize,
|
dataReceivedSoFar + firstSTXinRawData,
|
||||||
packet, sizeof(packet), &packetLen);
|
dataLenReceivedSoFar - firstSTXinRawData, &readSize, packet,
|
||||||
|
sizeof(packet), &packetLen);
|
||||||
|
|
||||||
size_t toDelete = firstSTXinRawData;
|
size_t toDelete = firstSTXinRawData;
|
||||||
if (result == HasReturnvaluesIF::RETURN_OK) {
|
if (result == HasReturnvaluesIF::RETURN_OK) {
|
||||||
@ -311,7 +333,9 @@ void ArduinoComIF::handleSerialPortRx() {
|
|||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
void ArduinoComIF::setBaudrate(uint32_t baudRate) { this->baudRate = baudRate; }
|
void ArduinoComIF::setBaudrate(uint32_t baudRate) {
|
||||||
|
this->baudRate = baudRate;
|
||||||
|
}
|
||||||
|
|
||||||
void ArduinoComIF::handlePacket(uint8_t *packet, size_t packetLen) {
|
void ArduinoComIF::handlePacket(uint8_t *packet, size_t packetLen) {
|
||||||
uint16_t crc = CRC::crc16ccitt(packet, packetLen);
|
uint16_t crc = CRC::crc16ccitt(packet, packetLen);
|
||||||
@ -344,7 +368,8 @@ void ArduinoComIF::handlePacket(uint8_t *packet, size_t packetLen) {
|
|||||||
}
|
}
|
||||||
std::memcpy(cookie.replyBuffer.data(), packet + 4, packetLen - 6);
|
std::memcpy(cookie.replyBuffer.data(), packet + 4, packetLen - 6);
|
||||||
cookie.receivedDataLen = packetLen - 6;
|
cookie.receivedDataLen = packetLen - 6;
|
||||||
} break;
|
}
|
||||||
|
break;
|
||||||
default:
|
default:
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -4,8 +4,8 @@
|
|||||||
#include <fsfw/container/FixedMap.h>
|
#include <fsfw/container/FixedMap.h>
|
||||||
#include <fsfw/container/SimpleRingBuffer.h>
|
#include <fsfw/container/SimpleRingBuffer.h>
|
||||||
#include <fsfw/devicehandlers/DeviceCommunicationIF.h>
|
#include <fsfw/devicehandlers/DeviceCommunicationIF.h>
|
||||||
#include <fsfw/objectmanager/SystemObject.h>
|
|
||||||
#include <fsfw/returnvalues/HasReturnvaluesIF.h>
|
#include <fsfw/returnvalues/HasReturnvaluesIF.h>
|
||||||
|
#include <fsfw/objectmanager/SystemObject.h>
|
||||||
|
|
||||||
#include <cstdint>
|
#include <cstdint>
|
||||||
#include <map>
|
#include <map>
|
||||||
@ -17,7 +17,8 @@
|
|||||||
//Forward declaration, so users don't peek
|
//Forward declaration, so users don't peek
|
||||||
class ArduinoCookie;
|
class ArduinoCookie;
|
||||||
|
|
||||||
class ArduinoComIF : public SystemObject, public DeviceCommunicationIF {
|
class ArduinoComIF: public SystemObject,
|
||||||
|
public DeviceCommunicationIF {
|
||||||
public:
|
public:
|
||||||
static const uint8_t MAX_NUMBER_OF_SPI_DEVICES = 8;
|
static const uint8_t MAX_NUMBER_OF_SPI_DEVICES = 8;
|
||||||
static const uint8_t MAX_PACKET_SIZE = 64;
|
static const uint8_t MAX_PACKET_SIZE = 64;
|
||||||
@ -33,12 +34,13 @@ class ArduinoComIF : public SystemObject, public DeviceCommunicationIF {
|
|||||||
|
|
||||||
/** DeviceCommunicationIF overrides */
|
/** DeviceCommunicationIF overrides */
|
||||||
virtual ReturnValue_t initializeInterface(CookieIF * cookie) override;
|
virtual ReturnValue_t initializeInterface(CookieIF * cookie) override;
|
||||||
virtual ReturnValue_t sendMessage(CookieIF *cookie, const uint8_t *sendData,
|
virtual ReturnValue_t sendMessage(CookieIF *cookie,
|
||||||
size_t sendLen) override;
|
const uint8_t * sendData, size_t sendLen) override;
|
||||||
virtual ReturnValue_t getSendSuccess(CookieIF *cookie) override;
|
virtual ReturnValue_t getSendSuccess(CookieIF *cookie) override;
|
||||||
virtual ReturnValue_t requestReceiveMessage(CookieIF *cookie, size_t requestLen) override;
|
virtual ReturnValue_t requestReceiveMessage(CookieIF *cookie,
|
||||||
virtual ReturnValue_t readReceivedMessage(CookieIF *cookie, uint8_t **buffer,
|
size_t requestLen) override;
|
||||||
size_t *size) override;
|
virtual ReturnValue_t readReceivedMessage(CookieIF *cookie,
|
||||||
|
uint8_t **buffer, size_t *size) override;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
#ifdef LINUX
|
#ifdef LINUX
|
||||||
@ -57,7 +59,8 @@ class ArduinoComIF : public SystemObject, public DeviceCommunicationIF {
|
|||||||
|
|
||||||
SimpleRingBuffer rxBuffer;
|
SimpleRingBuffer rxBuffer;
|
||||||
|
|
||||||
ReturnValue_t sendMessage(uint8_t command, uint8_t address, const uint8_t *data, size_t dataLen);
|
ReturnValue_t sendMessage(uint8_t command, uint8_t address,
|
||||||
|
const uint8_t *data, size_t dataLen);
|
||||||
void handleSerialPortRx();
|
void handleSerialPortRx();
|
||||||
|
|
||||||
void handlePacket(uint8_t *packet, size_t packetLen);
|
void handlePacket(uint8_t *packet, size_t packetLen);
|
||||||
|
@ -1,8 +1,8 @@
|
|||||||
#include <bsp_hosted/comIF/ArduinoCookie.h>
|
#include <bsp_hosted/comIF/ArduinoCookie.h>
|
||||||
|
|
||||||
ArduinoCookie::ArduinoCookie(Protocol_t protocol, uint8_t address, const size_t maxReplySize)
|
ArduinoCookie::ArduinoCookie(Protocol_t protocol, uint8_t address,
|
||||||
: protocol(protocol),
|
const size_t maxReplySize) :
|
||||||
command(protocol),
|
protocol(protocol), command(protocol), address(address),
|
||||||
address(address),
|
maxReplySize(maxReplySize), replyBuffer(maxReplySize) {
|
||||||
maxReplySize(maxReplySize),
|
}
|
||||||
replyBuffer(maxReplySize) {}
|
|
||||||
|
@ -2,14 +2,18 @@
|
|||||||
#define MISSION_ARDUINO_ARDUINOCOOKIE_H_
|
#define MISSION_ARDUINO_ARDUINOCOOKIE_H_
|
||||||
|
|
||||||
#include <fsfw/devicehandlers/CookieIF.h>
|
#include <fsfw/devicehandlers/CookieIF.h>
|
||||||
|
|
||||||
#include <vector>
|
#include <vector>
|
||||||
|
|
||||||
class ArduinoCookie: public CookieIF {
|
class ArduinoCookie: public CookieIF {
|
||||||
public:
|
public:
|
||||||
enum Protocol_t : uint8_t { INVALID, SPI, I2C };
|
enum Protocol_t: uint8_t {
|
||||||
|
INVALID,
|
||||||
|
SPI,
|
||||||
|
I2C
|
||||||
|
};
|
||||||
|
|
||||||
ArduinoCookie(Protocol_t protocol, uint8_t address, const size_t maxReplySize);
|
ArduinoCookie(Protocol_t protocol, uint8_t address,
|
||||||
|
const size_t maxReplySize);
|
||||||
|
|
||||||
Protocol_t protocol;
|
Protocol_t protocol;
|
||||||
uint8_t command;
|
uint8_t command;
|
||||||
@ -17,6 +21,7 @@ class ArduinoCookie : public CookieIF {
|
|||||||
std::vector<uint8_t> replyBuffer;
|
std::vector<uint8_t> replyBuffer;
|
||||||
size_t receivedDataLen = 0;
|
size_t receivedDataLen = 0;
|
||||||
size_t maxReplySize;
|
size_t maxReplySize;
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif /* MISSION_ARDUINO_ARDUINOCOOKIE_H_ */
|
#endif /* MISSION_ARDUINO_ARDUINOCOOKIE_H_ */
|
||||||
|
@ -1,27 +1,21 @@
|
|||||||
target_sources(${OBSW_NAME} PRIVATE
|
target_sources(${TARGET_NAME} PRIVATE
|
||||||
ipc/MissionMessageTypes.cpp
|
ipc/MissionMessageTypes.cpp
|
||||||
)
|
)
|
||||||
|
|
||||||
target_include_directories(${OBSW_NAME} PUBLIC
|
target_include_directories(${TARGET_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(${TARGET_NAME} PRIVATE
|
||||||
objects/translateObjects.cpp
|
|
||||||
)
|
|
||||||
target_sources(${UNITTEST_NAME} PRIVATE
|
|
||||||
objects/translateObjects.cpp
|
objects/translateObjects.cpp
|
||||||
)
|
)
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
# If a special translation file for events exists, compile it.
|
# If a special translation file for events exists, compile it.
|
||||||
if(EXISTS "${CMAKE_CURRENT_SOURCE_DIR}/objects/translateObjects.cpp")
|
if(EXISTS "${CMAKE_CURRENT_SOURCE_DIR}/objects/translateObjects.cpp")
|
||||||
target_sources(${OBSW_NAME} PRIVATE
|
target_sources(${TARGET_NAME} PRIVATE
|
||||||
events/translateEvents.cpp
|
|
||||||
)
|
|
||||||
target_sources(${UNITTEST_NAME} PRIVATE
|
|
||||||
events/translateEvents.cpp
|
events/translateEvents.cpp
|
||||||
)
|
)
|
||||||
endif()
|
endif()
|
||||||
|
@ -14,12 +14,6 @@
|
|||||||
debugging. */
|
debugging. */
|
||||||
#define OBSW_VEBOSE_LEVEL 1
|
#define OBSW_VEBOSE_LEVEL 1
|
||||||
|
|
||||||
#define OBSW_USE_CCSDS_IP_CORE 0
|
|
||||||
// Set to 1 if all telemetry should be sent to the PTME IP Core
|
|
||||||
#define OBSW_TM_TO_PTME 0
|
|
||||||
// Set to 1 if telecommands are received via the PDEC IP Core
|
|
||||||
#define OBSW_TC_FROM_PDEC 0
|
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
|
|
||||||
#include "objects/systemObjectList.h"
|
#include "objects/systemObjectList.h"
|
||||||
|
@ -1,6 +1,8 @@
|
|||||||
#ifndef FSFWCONFIG_DEVICES_GPIOIDS_H_
|
#ifndef FSFWCONFIG_DEVICES_GPIOIDS_H_
|
||||||
#define FSFWCONFIG_DEVICES_GPIOIDS_H_
|
#define FSFWCONFIG_DEVICES_GPIOIDS_H_
|
||||||
|
|
||||||
|
#include <linux/gpio/GpioIF.h>
|
||||||
|
|
||||||
namespace gpioIds {
|
namespace gpioIds {
|
||||||
enum gpioId_t {
|
enum gpioId_t {
|
||||||
HEATER_0,
|
HEATER_0,
|
||||||
@ -25,33 +27,33 @@ enum gpioId_t {
|
|||||||
TEST_ID_0,
|
TEST_ID_0,
|
||||||
TEST_ID_1,
|
TEST_ID_1,
|
||||||
|
|
||||||
RTD_IC_3,
|
RTD_IC3,
|
||||||
RTD_IC_4,
|
RTD_IC4,
|
||||||
RTD_IC_5,
|
RTD_IC5,
|
||||||
RTD_IC_6,
|
RTD_IC6,
|
||||||
RTD_IC_7,
|
RTD_IC7,
|
||||||
RTD_IC_8,
|
RTD_IC8,
|
||||||
RTD_IC_9,
|
RTD_IC9,
|
||||||
RTD_IC_10,
|
RTD_IC10,
|
||||||
RTD_IC_11,
|
RTD_IC11,
|
||||||
RTD_IC_12,
|
RTD_IC12,
|
||||||
RTD_IC_13,
|
RTD_IC13,
|
||||||
RTD_IC_14,
|
RTD_IC14,
|
||||||
RTD_IC_15,
|
RTD_IC15,
|
||||||
RTD_IC_16,
|
RTD_IC16,
|
||||||
RTD_IC_17,
|
RTD_IC17,
|
||||||
RTD_IC_18,
|
RTD_IC18,
|
||||||
|
|
||||||
SPI_MUX_BIT_1,
|
SPI_MUX_BIT_1,
|
||||||
SPI_MUX_BIT_2,
|
SPI_MUX_BIT_2,
|
||||||
SPI_MUX_BIT_3,
|
SPI_MUX_BIT_3,
|
||||||
SPI_MUX_BIT_4,
|
SPI_MUX_BIT_4,
|
||||||
SPI_MUX_BIT_5,
|
SPI_MUX_BIT_5,
|
||||||
SPI_MUX_BIT_6,
|
SPI_MUX_BIT_6
|
||||||
|
|
||||||
CS_RAD_SENSOR,
|
|
||||||
ENABLE_RADFET
|
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
#endif /* FSFWCONFIG_DEVICES_GPIOIDS_H_ */
|
#endif /* FSFWCONFIG_DEVICES_GPIOIDS_H_ */
|
||||||
|
@ -52,6 +52,7 @@ static const uint8_t INIT_STATE_SUS_NOMINAL = OFF;
|
|||||||
static const uint8_t INIT_STATE_SOLAR_CELL_EXP = OFF;
|
static const uint8_t INIT_STATE_SOLAR_CELL_EXP = OFF;
|
||||||
static const uint8_t INIT_STATE_PLOC = OFF;
|
static const uint8_t INIT_STATE_PLOC = OFF;
|
||||||
static const uint8_t INIT_STATE_ACS_BOARD_SIDE_A = OFF;
|
static const uint8_t INIT_STATE_ACS_BOARD_SIDE_A = OFF;
|
||||||
} // namespace pcduSwitches
|
}
|
||||||
|
|
||||||
|
|
||||||
#endif /* FSFWCONFIG_DEVICES_POWERSWITCHERLIST_H_ */
|
#endif /* FSFWCONFIG_DEVICES_POWERSWITCHERLIST_H_ */
|
||||||
|
@ -2,7 +2,6 @@
|
|||||||
#define CONFIG_EVENTS_SUBSYSTEMIDRANGES_H_
|
#define CONFIG_EVENTS_SUBSYSTEMIDRANGES_H_
|
||||||
|
|
||||||
#include <common/config/commonSubsystemIds.h>
|
#include <common/config/commonSubsystemIds.h>
|
||||||
|
|
||||||
#include <cstdint>
|
#include <cstdint>
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -10,7 +9,9 @@
|
|||||||
* Numbers 0-80 are reserved for FSFW Subsystem IDs (framework/events/)
|
* Numbers 0-80 are reserved for FSFW Subsystem IDs (framework/events/)
|
||||||
*/
|
*/
|
||||||
namespace SUBSYSTEM_ID {
|
namespace SUBSYSTEM_ID {
|
||||||
enum : uint8_t { SUBSYSTEM_ID_START = COMMON_SUBSYSTEM_ID_END };
|
enum: uint8_t {
|
||||||
|
SUBSYSTEM_ID_START = COMMON_SUBSYSTEM_ID_END
|
||||||
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif /* CONFIG_EVENTS_SUBSYSTEMIDRANGES_H_ */
|
#endif /* CONFIG_EVENTS_SUBSYSTEMIDRANGES_H_ */
|
||||||
|
7
bsp_hosted/fsfwconfig/fsfwconfig.mk
Normal file
7
bsp_hosted/fsfwconfig/fsfwconfig.mk
Normal file
@ -0,0 +1,7 @@
|
|||||||
|
CXXSRC += $(wildcard $(CURRENTPATH)/cdatapool/*.cpp)
|
||||||
|
CXXSRC += $(wildcard $(CURRENTPATH)/ipc/*.cpp)
|
||||||
|
CXXSRC += $(wildcard $(CURRENTPATH)/objects/*.cpp)
|
||||||
|
CXXSRC += $(wildcard $(CURRENTPATH)/pollingsequence/*.cpp)
|
||||||
|
CXXSRC += $(wildcard $(CURRENTPATH)/events/*.cpp)
|
||||||
|
|
||||||
|
INCLUDES += $(CURRENTPATH)
|
@ -1,5 +1,4 @@
|
|||||||
#include "MissionMessageTypes.h"
|
#include "MissionMessageTypes.h"
|
||||||
|
|
||||||
#include <fsfw/ipc/CommandMessage.h>
|
#include <fsfw/ipc/CommandMessage.h>
|
||||||
|
|
||||||
void messagetypes::clearMissionMessage(CommandMessage* message) {
|
void messagetypes::clearMissionMessage(CommandMessage* message) {
|
||||||
@ -8,3 +7,5 @@ void messagetypes::clearMissionMessage(CommandMessage* message) {
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -17,6 +17,6 @@ enum MESSAGE_TYPE {
|
|||||||
};
|
};
|
||||||
|
|
||||||
void clearMissionMessage(CommandMessage* message);
|
void clearMissionMessage(CommandMessage* message);
|
||||||
} // namespace messagetypes
|
}
|
||||||
|
|
||||||
#endif /* CONFIG_IPC_MISSIONMESSAGETYPES_H_ */
|
#endif /* CONFIG_IPC_MISSIONMESSAGETYPES_H_ */
|
||||||
|
@ -1,9 +1,8 @@
|
|||||||
#ifndef HOSTED_CONFIG_OBJECTS_SYSTEMOBJECTLIST_H_
|
#ifndef HOSTED_CONFIG_OBJECTS_SYSTEMOBJECTLIST_H_
|
||||||
#define HOSTED_CONFIG_OBJECTS_SYSTEMOBJECTLIST_H_
|
#define HOSTED_CONFIG_OBJECTS_SYSTEMOBJECTLIST_H_
|
||||||
|
|
||||||
#include <commonObjects.h>
|
|
||||||
|
|
||||||
#include <cstdint>
|
#include <cstdint>
|
||||||
|
#include <commonObjects.h>
|
||||||
|
|
||||||
// The objects will be instantiated in the ID order
|
// The objects will be instantiated in the ID order
|
||||||
namespace objects {
|
namespace objects {
|
||||||
|
@ -1,9 +1,8 @@
|
|||||||
#ifndef CONFIG_RETURNVALUES_CLASSIDS_H_
|
#ifndef CONFIG_RETURNVALUES_CLASSIDS_H_
|
||||||
#define CONFIG_RETURNVALUES_CLASSIDS_H_
|
#define CONFIG_RETURNVALUES_CLASSIDS_H_
|
||||||
|
|
||||||
#include <fsfw/returnvalues/FwClassIds.h>
|
|
||||||
|
|
||||||
#include "commonClassIds.h"
|
#include "commonClassIds.h"
|
||||||
|
#include <fsfw/returnvalues/FwClassIds.h>
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Source IDs starts at 73 for now
|
* Source IDs starts at 73 for now
|
||||||
@ -16,4 +15,5 @@ enum {
|
|||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
#endif /* CONFIG_RETURNVALUES_CLASSIDS_H_ */
|
#endif /* CONFIG_RETURNVALUES_CLASSIDS_H_ */
|
||||||
|
@ -15,4 +15,5 @@ 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,9 +1,10 @@
|
|||||||
#include <iostream>
|
|
||||||
|
|
||||||
#include "InitMission.h"
|
#include "InitMission.h"
|
||||||
#include "OBSWVersion.h"
|
#include "OBSWVersion.h"
|
||||||
|
|
||||||
#include "fsfw/FSFWVersion.h"
|
#include "fsfw/FSFWVersion.h"
|
||||||
#include "fsfw/tasks/TaskFactory.h"
|
#include "fsfw/tasks/TaskFactory.h"
|
||||||
|
|
||||||
|
#include <iostream>
|
||||||
#ifdef WIN32
|
#ifdef WIN32
|
||||||
static const char* COMPILE_PRINTOUT = "Windows";
|
static const char* COMPILE_PRINTOUT = "Windows";
|
||||||
#elif LINUX
|
#elif LINUX
|
||||||
@ -16,12 +17,13 @@ static const char* COMPILE_PRINTOUT = "unknown OS";
|
|||||||
* Linux and Windows.
|
* Linux and Windows.
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
int main(void) {
|
int main(void)
|
||||||
|
{
|
||||||
std::cout << "-- EIVE OBSW --" << std::endl;
|
std::cout << "-- EIVE OBSW --" << std::endl;
|
||||||
std::cout << "-- Compiled for " << COMPILE_PRINTOUT << " --" << std::endl;
|
std::cout << "-- Compiled for " << COMPILE_PRINTOUT << " --" << std::endl;
|
||||||
std::cout << "-- OBSW " << SW_NAME << " v" << SW_VERSION << "." << SW_SUBVERSION << "."
|
std::cout << "-- OBSW " << SW_NAME << " v" << SW_VERSION << "." << SW_SUBVERSION <<
|
||||||
<< SW_REVISION << ", FSFW v" << FSFW_VERSION << "." << FSFW_SUBVERSION << "."
|
"." << SW_REVISION << ", FSFW v" << FSFW_VERSION << "." << FSFW_SUBVERSION << "." <<
|
||||||
<< FSFW_REVISION << "--" << std::endl;
|
FSFW_REVISION << "--" << std::endl;
|
||||||
std::cout << "-- " << __DATE__ << " " << __TIME__ << " --" << std::endl;
|
std::cout << "-- " << __DATE__ << " " << __TIME__ << " --" << std::endl;
|
||||||
|
|
||||||
initmission::initMission();
|
initmission::initMission();
|
||||||
@ -31,3 +33,5 @@ int main(void) {
|
|||||||
TaskFactory::delayTask(5000);
|
TaskFactory::delayTask(5000);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
target_sources(${OBSW_NAME} PUBLIC
|
target_sources(${TARGET_NAME} PUBLIC
|
||||||
InitMission.cpp
|
InitMission.cpp
|
||||||
main.cpp
|
main.cpp
|
||||||
ObjectFactory.cpp
|
ObjectFactory.cpp
|
||||||
|
@ -1,21 +1,21 @@
|
|||||||
#include "InitMission.h"
|
#include "InitMission.h"
|
||||||
|
#include "ObjectFactory.h"
|
||||||
|
|
||||||
#include <fsfw/objectmanager/ObjectManager.h>
|
#include "objects/systemObjectList.h"
|
||||||
|
#include "OBSWConfig.h"
|
||||||
|
#include "pollingsequence/pollingSequenceFactory.h"
|
||||||
|
|
||||||
|
#include <mission/utility/InitMission.h>
|
||||||
#include <fsfw/objectmanager/ObjectManagerIF.h>
|
#include <fsfw/objectmanager/ObjectManagerIF.h>
|
||||||
#include <fsfw/returnvalues/HasReturnvaluesIF.h>
|
#include <fsfw/returnvalues/HasReturnvaluesIF.h>
|
||||||
#include <fsfw/serviceinterface/ServiceInterface.h>
|
#include <fsfw/serviceinterface/ServiceInterface.h>
|
||||||
|
#include <fsfw/objectmanager/ObjectManager.h>
|
||||||
#include <fsfw/tasks/FixedTimeslotTaskIF.h>
|
#include <fsfw/tasks/FixedTimeslotTaskIF.h>
|
||||||
#include <fsfw/tasks/PeriodicTaskIF.h>
|
#include <fsfw/tasks/PeriodicTaskIF.h>
|
||||||
#include <fsfw/tasks/TaskFactory.h>
|
#include <fsfw/tasks/TaskFactory.h>
|
||||||
#include <mission/utility/InitMission.h>
|
|
||||||
|
|
||||||
#include <iostream>
|
#include <iostream>
|
||||||
|
|
||||||
#include "OBSWConfig.h"
|
|
||||||
#include "ObjectFactory.h"
|
|
||||||
#include "objects/systemObjectList.h"
|
|
||||||
#include "pollingsequence/pollingSequenceFactory.h"
|
|
||||||
|
|
||||||
ServiceInterfaceStream sif::debug("DEBUG");
|
ServiceInterfaceStream sif::debug("DEBUG");
|
||||||
ServiceInterfaceStream sif::info("INFO");
|
ServiceInterfaceStream sif::info("INFO");
|
||||||
ServiceInterfaceStream sif::warning("WARNING");
|
ServiceInterfaceStream sif::warning("WARNING");
|
||||||
@ -47,6 +47,7 @@ void initmission::initTasks() {
|
|||||||
void (*missedDeadlineFunc) (void) = nullptr;
|
void (*missedDeadlineFunc) (void) = nullptr;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
||||||
/* TMTC Distribution */
|
/* TMTC Distribution */
|
||||||
PeriodicTaskIF* tmTcDistributor = factory->createPeriodicTask(
|
PeriodicTaskIF* tmTcDistributor = factory->createPeriodicTask(
|
||||||
"DIST", 40, PeriodicTaskIF::MINIMUM_STACK_SIZE, 0.2, missedDeadlineFunc);
|
"DIST", 40, PeriodicTaskIF::MINIMUM_STACK_SIZE, 0.2, missedDeadlineFunc);
|
||||||
@ -64,17 +65,17 @@ void initmission::initTasks() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* UDP bridge */
|
/* UDP bridge */
|
||||||
PeriodicTaskIF* tmtcBridgeTask = factory->createPeriodicTask(
|
PeriodicTaskIF* udpBridgeTask = factory->createPeriodicTask(
|
||||||
"TMTC_BRIDGE", 50, PeriodicTaskIF::MINIMUM_STACK_SIZE, 0.2, missedDeadlineFunc);
|
"UDP_UNIX_BRIDGE", 50, PeriodicTaskIF::MINIMUM_STACK_SIZE, 0.2, missedDeadlineFunc);
|
||||||
result = tmtcBridgeTask->addComponent(objects::TMTC_BRIDGE);
|
result = udpBridgeTask->addComponent(objects::TMTC_BRIDGE);
|
||||||
if(result != HasReturnvaluesIF::RETURN_OK) {
|
if(result != HasReturnvaluesIF::RETURN_OK) {
|
||||||
sif::error << "Add component TMTC Bridge failed" << std::endl;
|
sif::error << "Add component UDP Unix Bridge failed" << std::endl;
|
||||||
}
|
}
|
||||||
PeriodicTaskIF* tmtcPollingTask = factory->createPeriodicTask(
|
PeriodicTaskIF* udpPollingTask = factory->createPeriodicTask(
|
||||||
"TMTC_POLLING", 80, PeriodicTaskIF::MINIMUM_STACK_SIZE, 2.0, missedDeadlineFunc);
|
"UDP_POLLING", 80, PeriodicTaskIF::MINIMUM_STACK_SIZE, 2.0, missedDeadlineFunc);
|
||||||
result = tmtcPollingTask->addComponent(objects::TMTC_POLLING_TASK);
|
result = udpPollingTask->addComponent(objects::TMTC_POLLING_TASK);
|
||||||
if(result != HasReturnvaluesIF::RETURN_OK) {
|
if(result != HasReturnvaluesIF::RETURN_OK) {
|
||||||
sif::error << "Add component TMTC Polling failed" << std::endl;
|
sif::error << "Add component UDP Polling failed" << std::endl;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* PUS Services */
|
/* PUS Services */
|
||||||
@ -92,7 +93,8 @@ void initmission::initTasks() {
|
|||||||
for(const auto& task: taskVector) {
|
for(const auto& task: taskVector) {
|
||||||
if(task != nullptr) {
|
if(task != nullptr) {
|
||||||
task->startTask();
|
task->startTask();
|
||||||
} else {
|
}
|
||||||
|
else {
|
||||||
sif::error << "Task in vector " << name << " is invalid!" << std::endl;
|
sif::error << "Task in vector " << name << " is invalid!" << std::endl;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -100,8 +102,8 @@ void initmission::initTasks() {
|
|||||||
|
|
||||||
sif::info << "Starting tasks.." << std::endl;
|
sif::info << "Starting tasks.." << std::endl;
|
||||||
tmTcDistributor->startTask();
|
tmTcDistributor->startTask();
|
||||||
tmtcBridgeTask->startTask();
|
udpBridgeTask->startTask();
|
||||||
tmtcPollingTask->startTask();
|
udpPollingTask->startTask();
|
||||||
|
|
||||||
taskStarter(pusTasks, "PUS Tasks");
|
taskStarter(pusTasks, "PUS Tasks");
|
||||||
#if OBSW_ADD_TEST_CODE == 1
|
#if OBSW_ADD_TEST_CODE == 1
|
||||||
@ -118,8 +120,7 @@ void initmission::initTasks() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void initmission::createPusTasks(TaskFactory& factory,
|
void initmission::createPusTasks(TaskFactory& factory,
|
||||||
TaskDeadlineMissedFunction missedDeadlineFunc,
|
TaskDeadlineMissedFunction missedDeadlineFunc, std::vector<PeriodicTaskIF*>& taskVec) {
|
||||||
std::vector<PeriodicTaskIF*>& taskVec) {
|
|
||||||
ReturnValue_t result = HasReturnvaluesIF::RETURN_OK;
|
ReturnValue_t result = HasReturnvaluesIF::RETURN_OK;
|
||||||
PeriodicTaskIF* pusVerification = factory.createPeriodicTask(
|
PeriodicTaskIF* pusVerification = factory.createPeriodicTask(
|
||||||
"PUS_VERIF", 40, PeriodicTaskIF::MINIMUM_STACK_SIZE, 0.200, missedDeadlineFunc);
|
"PUS_VERIF", 40, PeriodicTaskIF::MINIMUM_STACK_SIZE, 0.200, missedDeadlineFunc);
|
||||||
@ -181,18 +182,19 @@ void initmission::createPusTasks(TaskFactory& factory,
|
|||||||
}
|
}
|
||||||
result = pusLowPrio->addComponent(objects::INTERNAL_ERROR_REPORTER);
|
result = pusLowPrio->addComponent(objects::INTERNAL_ERROR_REPORTER);
|
||||||
if(result != HasReturnvaluesIF::RETURN_OK) {
|
if(result != HasReturnvaluesIF::RETURN_OK) {
|
||||||
initmission::printAddObjectError("INT_ERR_RPRT", objects::INTERNAL_ERROR_REPORTER);
|
initmission::printAddObjectError("INT_ERR_RPRT",
|
||||||
|
objects::INTERNAL_ERROR_REPORTER);
|
||||||
}
|
}
|
||||||
taskVec.push_back(pusLowPrio);
|
taskVec.push_back(pusLowPrio);
|
||||||
}
|
}
|
||||||
|
|
||||||
void initmission::createPstTasks(TaskFactory& factory,
|
void initmission::createPstTasks(TaskFactory& factory,
|
||||||
TaskDeadlineMissedFunction missedDeadlineFunc,
|
TaskDeadlineMissedFunction missedDeadlineFunc, std::vector<PeriodicTaskIF*> &taskVec) {
|
||||||
std::vector<PeriodicTaskIF*>& taskVec) {
|
|
||||||
ReturnValue_t result = HasReturnvaluesIF::RETURN_OK;
|
ReturnValue_t result = HasReturnvaluesIF::RETURN_OK;
|
||||||
#if OBSW_ADD_SPI_TEST_CODE == 0
|
#if OBSW_ADD_SPI_TEST_CODE == 0
|
||||||
FixedTimeslotTaskIF* spiPst = factory.createFixedTimeslotTask(
|
FixedTimeslotTaskIF* spiPst = factory.createFixedTimeslotTask(
|
||||||
"SPI_PST", 70, PeriodicTaskIF::MINIMUM_STACK_SIZE * 4, 3.0, missedDeadlineFunc);
|
"SPI_PST", 70, PeriodicTaskIF::MINIMUM_STACK_SIZE * 4, 3.0,
|
||||||
|
missedDeadlineFunc);
|
||||||
result = pst::pstSpi(spiPst);
|
result = pst::pstSpi(spiPst);
|
||||||
if (result != HasReturnvaluesIF::RETURN_OK) {
|
if (result != HasReturnvaluesIF::RETURN_OK) {
|
||||||
sif::error << "InitMission::initTasks: Creating PST failed!" << std::endl;
|
sif::error << "InitMission::initTasks: Creating PST failed!" << std::endl;
|
||||||
@ -211,7 +213,7 @@ void initmission::createTestTasks(TaskFactory& factory,
|
|||||||
if(result != HasReturnvaluesIF::RETURN_OK) {
|
if(result != HasReturnvaluesIF::RETURN_OK) {
|
||||||
initmission::printAddObjectError("TEST_TASK", objects::TEST_TASK);
|
initmission::printAddObjectError("TEST_TASK", objects::TEST_TASK);
|
||||||
}
|
}
|
||||||
#if OBSW_ADD_SPI_TEST_CODE == 1
|
#if RPI_ADD_SPI_TEST == 1
|
||||||
result = testTask->addComponent(objects::SPI_TEST);
|
result = testTask->addComponent(objects::SPI_TEST);
|
||||||
if(result != HasReturnvaluesIF::RETURN_OK) {
|
if(result != HasReturnvaluesIF::RETURN_OK) {
|
||||||
initmission::printAddObjectError("SPI_TEST", objects::SPI_TEST);
|
initmission::printAddObjectError("SPI_TEST", objects::SPI_TEST);
|
||||||
@ -223,23 +225,23 @@ void initmission::createTestTasks(TaskFactory& factory,
|
|||||||
initmission::printAddObjectError("GPIOD_TEST", objects::LIBGPIOD_TEST);
|
initmission::printAddObjectError("GPIOD_TEST", objects::LIBGPIOD_TEST);
|
||||||
}
|
}
|
||||||
#endif /* RPI_ADD_GPIO_TEST == 1 */
|
#endif /* RPI_ADD_GPIO_TEST == 1 */
|
||||||
#if OBSW_ADD_UART_TEST_CODE == 1
|
#if RPI_ADD_UART_TEST == 1
|
||||||
result = testTask->addComponent(objects::UART_TEST);
|
result = testTask->addComponent(objects::UART_TEST);
|
||||||
if(result != HasReturnvaluesIF::RETURN_OK) {
|
if(result != HasReturnvaluesIF::RETURN_OK) {
|
||||||
initmission::printAddObjectError("UART_TEST", objects::UART_TEST);
|
initmission::printAddObjectError("UART_TEST", objects::UART_TEST);
|
||||||
}
|
}
|
||||||
#endif /* RPI_ADD_GPIO_TEST == 1 */
|
#endif /* RPI_ADD_GPIO_TEST == 1 */
|
||||||
taskVec.push_back(testTask);
|
|
||||||
|
|
||||||
bool startTestPst = true;
|
bool startTestPst = true;
|
||||||
static_cast<void>(startTestPst);
|
static_cast<void>(startTestPst);
|
||||||
#if OBSW_ADD_TEST_PST == 1
|
#if OBSW_ADD_TEST_PST == 1
|
||||||
FixedTimeslotTaskIF* pstTestTask = factory->createFixedTimeslotTask(
|
FixedTimeslotTaskIF* pstTestTask = factory->createFixedTimeslotTask("TEST_PST", 50,
|
||||||
"TEST_PST", 50, PeriodicTaskIF::MINIMUM_STACK_SIZE * 2, 2.0, missedDeadlineFunc);
|
PeriodicTaskIF::MINIMUM_STACK_SIZE * 2, 2.0, missedDeadlineFunc);
|
||||||
result = pst::pstTest(pstTestTask);
|
result = pst::pstTest(pstTestTask);
|
||||||
if(result != HasReturnvaluesIF::RETURN_OK) {
|
if(result != HasReturnvaluesIF::RETURN_OK) {
|
||||||
sif::info << "initmission::initTasks: ACS PST empty or invalid" << std::endl;
|
sif::info << "initmission::initTasks: ACS PST empty or invalid" << std::endl;
|
||||||
startTestPst = false;
|
startTestPst = false;
|
||||||
}
|
}
|
||||||
#endif /* RPI_TEST_ACS_BOARD == 1 */
|
#endif /* RPI_TEST_ACS_BOARD == 1 */
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -1,9 +1,8 @@
|
|||||||
#ifndef BSP_LINUX_INITMISSION_H_
|
#ifndef BSP_LINUX_INITMISSION_H_
|
||||||
#define BSP_LINUX_INITMISSION_H_
|
#define BSP_LINUX_INITMISSION_H_
|
||||||
|
|
||||||
#include <vector>
|
|
||||||
|
|
||||||
#include "fsfw/tasks/Typedef.h"
|
#include "fsfw/tasks/Typedef.h"
|
||||||
|
#include <vector>
|
||||||
|
|
||||||
class PeriodicTaskIF;
|
class PeriodicTaskIF;
|
||||||
class TaskFactory;
|
class TaskFactory;
|
||||||
@ -12,12 +11,14 @@ namespace initmission {
|
|||||||
void initMission();
|
void initMission();
|
||||||
void initTasks();
|
void initTasks();
|
||||||
|
|
||||||
void createPstTasks(TaskFactory& factory, TaskDeadlineMissedFunction missedDeadlineFunc,
|
void createPstTasks(TaskFactory& factory,
|
||||||
|
TaskDeadlineMissedFunction missedDeadlineFunc,
|
||||||
std::vector<PeriodicTaskIF*> &taskVec);
|
std::vector<PeriodicTaskIF*> &taskVec);
|
||||||
void createTestTasks(TaskFactory& factory, TaskDeadlineMissedFunction missedDeadlineFunc,
|
void createTestTasks(TaskFactory& factory,
|
||||||
|
TaskDeadlineMissedFunction missedDeadlineFunc,
|
||||||
std::vector<PeriodicTaskIF*> &taskVec);
|
std::vector<PeriodicTaskIF*> &taskVec);
|
||||||
void createPusTasks(TaskFactory& factory, TaskDeadlineMissedFunction missedDeadlineFunc,
|
void createPusTasks(TaskFactory& factory, TaskDeadlineMissedFunction missedDeadlineFunc,
|
||||||
std::vector<PeriodicTaskIF*>& taskVec);
|
std::vector<PeriodicTaskIF*>& taskVec);
|
||||||
}; // namespace initmission
|
};
|
||||||
|
|
||||||
#endif /* BSP_LINUX_INITMISSION_H_ */
|
#endif /* BSP_LINUX_INITMISSION_H_ */
|
||||||
|
@ -1,45 +1,46 @@
|
|||||||
|
#include <devConf.h>
|
||||||
#include "ObjectFactory.h"
|
#include "ObjectFactory.h"
|
||||||
|
|
||||||
#include "OBSWConfig.h"
|
#include "objects/systemObjectList.h"
|
||||||
#include "devConf.h"
|
|
||||||
#include "devices/addresses.h"
|
#include "devices/addresses.h"
|
||||||
#include "devices/gpioIds.h"
|
#include "devices/gpioIds.h"
|
||||||
#include "fsfw/datapoollocal/LocalDataPoolManager.h"
|
#include "OBSWConfig.h"
|
||||||
#include "fsfw/tasks/TaskFactory.h"
|
#include "tmtc/apid.h"
|
||||||
#include "fsfw/tmtcpacket/pus/tm.h"
|
#include "tmtc/pusIds.h"
|
||||||
#include "fsfw/tmtcservices/CommandingServiceBase.h"
|
|
||||||
#include "fsfw/tmtcservices/PusServiceBase.h"
|
|
||||||
#include "linux/boardtest/LibgpiodTest.h"
|
#include "linux/boardtest/LibgpiodTest.h"
|
||||||
#include "linux/boardtest/SpiTestClass.h"
|
#include "linux/boardtest/SpiTestClass.h"
|
||||||
#include "linux/boardtest/UartTestClass.h"
|
#include "linux/boardtest/UartTestClass.h"
|
||||||
|
|
||||||
#include "mission/core/GenericFactory.h"
|
#include "mission/core/GenericFactory.h"
|
||||||
#include "mission/devices/GPSHyperionHandler.h"
|
|
||||||
#include "mission/devices/GyroADIS1650XHandler.h"
|
|
||||||
#include "mission/utility/TmFunnel.h"
|
#include "mission/utility/TmFunnel.h"
|
||||||
#include "objects/systemObjectList.h"
|
#include <mission/devices/GPSHyperionHandler.h>
|
||||||
#include "tmtc/apid.h"
|
#include "mission/devices/GyroADIS16507Handler.h"
|
||||||
#include "tmtc/pusIds.h"
|
|
||||||
|
#include "fsfw/datapoollocal/LocalDataPoolManager.h"
|
||||||
|
#include "fsfw/tmtcservices/CommandingServiceBase.h"
|
||||||
|
#include "fsfw/tmtcservices/PusServiceBase.h"
|
||||||
|
#include "fsfw/tmtcpacket/pus/tm.h"
|
||||||
|
#include "fsfw/tasks/TaskFactory.h"
|
||||||
|
|
||||||
/* UDP server includes */
|
/* UDP server includes */
|
||||||
#if OBSW_USE_TMTC_TCP_BRIDGE == 1
|
#if OBSW_USE_TMTC_TCP_BRIDGE == 1
|
||||||
#include <fsfw/src/fsfw/osal/common/TcpTmTcBridge.h>
|
#include <fsfw/src/fsfw/osal/common/TcpTmTcBridge.h>
|
||||||
#include <fsfw/src/fsfw/osal/common/TcpTmTcServer.h>
|
#include <fsfw/src/fsfw/osal/common/TcpTmTcServer.h>
|
||||||
#else
|
#else
|
||||||
#include "fsfw/osal/common/UdpTcPollingTask.h"
|
|
||||||
#include "fsfw/osal/common/UdpTmTcBridge.h"
|
#include "fsfw/osal/common/UdpTmTcBridge.h"
|
||||||
|
#include "fsfw/osal/common/UdpTcPollingTask.h"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#include <fsfw_hal/linux/uart/UartComIF.h>
|
|
||||||
#include <fsfw_hal/linux/uart/UartCookie.h>
|
|
||||||
|
|
||||||
#include "fsfw_hal/common/gpio/GpioCookie.h"
|
|
||||||
#include "fsfw_hal/devicehandlers/GyroL3GD20Handler.h"
|
|
||||||
#include "fsfw_hal/devicehandlers/MgmLIS3MDLHandler.h"
|
#include "fsfw_hal/devicehandlers/MgmLIS3MDLHandler.h"
|
||||||
#include "fsfw_hal/devicehandlers/MgmRM3100Handler.h"
|
#include "fsfw_hal/devicehandlers/MgmRM3100Handler.h"
|
||||||
|
#include "fsfw_hal/devicehandlers/GyroL3GD20Handler.h"
|
||||||
#include "fsfw_hal/linux/gpio/LinuxLibgpioIF.h"
|
#include "fsfw_hal/linux/gpio/LinuxLibgpioIF.h"
|
||||||
#include "fsfw_hal/linux/rpi/GpioRPi.h"
|
#include "fsfw_hal/linux/rpi/GpioRPi.h"
|
||||||
#include "fsfw_hal/linux/spi/SpiComIF.h"
|
#include "fsfw_hal/common/gpio/GpioCookie.h"
|
||||||
#include "fsfw_hal/linux/spi/SpiCookie.h"
|
#include "fsfw_hal/linux/spi/SpiCookie.h"
|
||||||
|
#include "fsfw_hal/linux/spi/SpiComIF.h"
|
||||||
|
#include <fsfw_hal/linux/uart/UartComIF.h>
|
||||||
|
#include <fsfw_hal/linux/uart/UartCookie.h>
|
||||||
|
|
||||||
void Factory::setStaticFrameworkObjectIds() {
|
void Factory::setStaticFrameworkObjectIds() {
|
||||||
PusServiceBase::packetSource = objects::PUS_PACKET_DISTRIBUTOR;
|
PusServiceBase::packetSource = objects::PUS_PACKET_DISTRIBUTOR;
|
||||||
@ -56,10 +57,22 @@ void Factory::setStaticFrameworkObjectIds() {
|
|||||||
TmPacketBase::timeStamperId = objects::TIME_STAMPER;
|
TmPacketBase::timeStamperId = objects::TIME_STAMPER;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
void ObjectFactory::produce(void* args){
|
void ObjectFactory::produce(void* args){
|
||||||
Factory::setStaticFrameworkObjectIds();
|
Factory::setStaticFrameworkObjectIds();
|
||||||
ObjectFactory::produceGenericObjects();
|
ObjectFactory::produceGenericObjects();
|
||||||
|
|
||||||
|
#if OBSW_USE_TMTC_TCP_BRIDGE == 1
|
||||||
|
auto tmtcBridge = new TcpTmTcBridge(objects::TMTC_BRIDGE, objects::CCSDS_PACKET_DISTRIBUTOR);
|
||||||
|
tmtcBridge->setMaxNumberOfPacketsStored(50);
|
||||||
|
new TcpTmTcServer(objects::TMTC_POLLING_TASK, objects::TMTC_BRIDGE);
|
||||||
|
#else
|
||||||
|
auto tmtcBridge = new UdpTmTcBridge(objects::TMTC_BRIDGE, objects::CCSDS_PACKET_DISTRIBUTOR);
|
||||||
|
tmtcBridge->setMaxNumberOfPacketsStored(50);
|
||||||
|
new UdpTcPollingTask(objects::TMTC_POLLING_TASK, objects::TMTC_BRIDGE);
|
||||||
|
#endif
|
||||||
|
|
||||||
GpioIF* gpioIF = new LinuxLibgpioIF(objects::GPIO_IF);
|
GpioIF* gpioIF = new LinuxLibgpioIF(objects::GPIO_IF);
|
||||||
GpioCookie* gpioCookie = nullptr;
|
GpioCookie* gpioCookie = nullptr;
|
||||||
static_cast<void>(gpioCookie);
|
static_cast<void>(gpioCookie);
|
||||||
@ -75,93 +88,85 @@ void ObjectFactory::produce(void* args) {
|
|||||||
gpioCookie = new GpioCookie();
|
gpioCookie = new GpioCookie();
|
||||||
}
|
}
|
||||||
// TODO: Missing pin for Gyro 2
|
// TODO: Missing pin for Gyro 2
|
||||||
gpio::createRpiGpioConfig(gpioCookie, gpioIds::MGM_0_LIS3_CS, gpio::MGM_0_BCM_PIN, "MGM_0_LIS3",
|
gpio::createRpiGpioConfig(gpioCookie, gpioIds::MGM_0_LIS3_CS, gpio::MGM_0_BCM_PIN,
|
||||||
gpio::Direction::OUT, 1);
|
"MGM_0_LIS3", gpio::Direction::OUT, 1);
|
||||||
gpio::createRpiGpioConfig(gpioCookie, gpioIds::MGM_1_RM3100_CS, gpio::MGM_1_BCM_PIN,
|
gpio::createRpiGpioConfig(gpioCookie, gpioIds::MGM_1_RM3100_CS, gpio::MGM_1_BCM_PIN,
|
||||||
"MGM_1_RM3100", gpio::Direction::OUT, 1);
|
"MGM_1_RM3100", gpio::Direction::OUT, 1);
|
||||||
gpio::createRpiGpioConfig(gpioCookie, gpioIds::MGM_2_LIS3_CS, gpio::MGM_2_BCM_PIN, "MGM_2_LIS3",
|
gpio::createRpiGpioConfig(gpioCookie, gpioIds::MGM_2_LIS3_CS, gpio::MGM_2_BCM_PIN,
|
||||||
gpio::Direction::OUT, 1);
|
"MGM_2_LIS3", gpio::Direction::OUT, 1);
|
||||||
gpio::createRpiGpioConfig(gpioCookie, gpioIds::MGM_3_RM3100_CS, gpio::MGM_3_BCM_PIN,
|
gpio::createRpiGpioConfig(gpioCookie, gpioIds::MGM_3_RM3100_CS, gpio::MGM_3_BCM_PIN,
|
||||||
"MGM_3_RM3100", gpio::Direction::OUT, 1);
|
"MGM_3_RM3100", gpio::Direction::OUT, 1);
|
||||||
gpio::createRpiGpioConfig(gpioCookie, gpioIds::GYRO_0_ADIS_CS, gpio::GYRO_0_BCM_PIN,
|
gpio::createRpiGpioConfig(gpioCookie, gpioIds::GYRO_0_ADIS_CS, gpio::GYRO_0_BCM_PIN,
|
||||||
"GYRO_0_ADIS", gpio::Direction::OUT, 1);
|
"GYRO_0_ADIS", gpio::Direction::OUT, 1);
|
||||||
gpio::createRpiGpioConfig(gpioCookie, gpioIds::GYRO_1_L3G_CS, gpio::GYRO_1_BCM_PIN, "GYRO_1_L3G",
|
gpio::createRpiGpioConfig(gpioCookie, gpioIds::GYRO_1_L3G_CS, gpio::GYRO_1_BCM_PIN,
|
||||||
gpio::Direction::OUT, 1);
|
"GYRO_1_L3G", gpio::Direction::OUT, 1);
|
||||||
gpio::createRpiGpioConfig(gpioCookie, gpioIds::GYRO_2_ADIS_CS, gpio::GYRO_2_BCM_PIN,
|
gpio::createRpiGpioConfig(gpioCookie, gpioIds::GYRO_2_ADIS_CS, gpio::GYRO_2_BCM_PIN,
|
||||||
"GYRO_2_ADIS", gpio::Direction::OUT, 1);
|
"GYRO_2_ADIS", gpio::Direction::OUT, 1);
|
||||||
gpio::createRpiGpioConfig(gpioCookie, gpioIds::GYRO_3_L3G_CS, gpio::GYRO_3_BCM_PIN, "GYRO_3_L3G",
|
gpio::createRpiGpioConfig(gpioCookie, gpioIds::GYRO_3_L3G_CS, gpio::GYRO_3_BCM_PIN,
|
||||||
gpio::Direction::OUT, 1);
|
"GYRO_3_L3G", gpio::Direction::OUT, 1);
|
||||||
gpioIF->addGpios(gpioCookie);
|
gpioIF->addGpios(gpioCookie);
|
||||||
|
|
||||||
spiDev = "/dev/spidev0.1";
|
spiDev = "/dev/spidev0.1";
|
||||||
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, spiDev,
|
|
||||||
MGMLIS3MDL::MAX_BUFFER_SIZE, spi::DEFAULT_LIS3_MODE, spi::DEFAULT_LIS3_SPEED);
|
MGMLIS3MDL::MAX_BUFFER_SIZE, spi::DEFAULT_LIS3_MODE, spi::DEFAULT_LIS3_SPEED);
|
||||||
auto mgmLis3Handler =
|
auto mgmLis3Handler = new MgmLIS3MDLHandler(objects::MGM_0_LIS3_HANDLER,
|
||||||
new MgmLIS3MDLHandler(objects::MGM_0_LIS3_HANDLER, objects::SPI_COM_IF, spiCookie, 0);
|
objects::SPI_COM_IF, spiCookie, 0);
|
||||||
mgmLis3Handler->setStartUpImmediately();
|
mgmLis3Handler->setStartUpImmediately();
|
||||||
#if FSFW_HAL_LIS3MDL_MGM_DEBUG == 1
|
#if FSFW_HAL_LIS3MDL_MGM_DEBUG == 1
|
||||||
mgmLis3Handler->setToGoToNormalMode(true);
|
mgmLis3Handler->setToGoToNormalMode(true);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
spiCookie =
|
spiCookie = new SpiCookie(addresses::MGM_1_RM3100, gpioIds::MGM_1_RM3100_CS, spiDev,
|
||||||
new SpiCookie(addresses::MGM_1_RM3100, gpioIds::MGM_1_RM3100_CS, spiDev,
|
|
||||||
RM3100::MAX_BUFFER_SIZE, spi::DEFAULT_RM3100_MODE, spi::DEFAULT_RM3100_SPEED);
|
RM3100::MAX_BUFFER_SIZE, spi::DEFAULT_RM3100_MODE, spi::DEFAULT_RM3100_SPEED);
|
||||||
auto mgmRm3100Handler =
|
auto mgmRm3100Handler = new MgmRM3100Handler(objects::MGM_1_RM3100_HANDLER,
|
||||||
new MgmRM3100Handler(objects::MGM_1_RM3100_HANDLER, objects::SPI_COM_IF, spiCookie, 0);
|
objects::SPI_COM_IF, spiCookie, 0);
|
||||||
mgmRm3100Handler->setStartUpImmediately();
|
mgmRm3100Handler->setStartUpImmediately();
|
||||||
#if FSFW_HAL_RM3100_MGM_DEBUG == 1
|
#if FSFW_HAL_RM3100_MGM_DEBUG == 1
|
||||||
mgmRm3100Handler->setToGoToNormalMode(true);
|
mgmRm3100Handler->setToGoToNormalMode(true);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
spiCookie =
|
spiCookie = new SpiCookie(addresses::MGM_2_LIS3, gpioIds::MGM_2_LIS3_CS, spiDev,
|
||||||
new SpiCookie(addresses::MGM_2_LIS3, gpioIds::MGM_2_LIS3_CS, spiDev,
|
|
||||||
MGMLIS3MDL::MAX_BUFFER_SIZE, spi::DEFAULT_LIS3_MODE, spi::DEFAULT_LIS3_SPEED);
|
MGMLIS3MDL::MAX_BUFFER_SIZE, spi::DEFAULT_LIS3_MODE, spi::DEFAULT_LIS3_SPEED);
|
||||||
mgmLis3Handler =
|
mgmLis3Handler = new MgmLIS3MDLHandler(objects::MGM_2_LIS3_HANDLER,
|
||||||
new MgmLIS3MDLHandler(objects::MGM_2_LIS3_HANDLER, objects::SPI_COM_IF, spiCookie, 0);
|
objects::SPI_COM_IF, spiCookie, 0);
|
||||||
mgmLis3Handler->setStartUpImmediately();
|
mgmLis3Handler->setStartUpImmediately();
|
||||||
#if FSFW_HAL_LIS3MDL_MGM_DEBUG == 1
|
#if FSFW_HAL_LIS3MDL_MGM_DEBUG == 1
|
||||||
mgmLis3Handler->setToGoToNormalMode(true);
|
mgmLis3Handler->setToGoToNormalMode(true);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
spiCookie =
|
spiCookie = new SpiCookie(addresses::MGM_3_RM3100, gpioIds::MGM_3_RM3100_CS, spiDev,
|
||||||
new SpiCookie(addresses::MGM_3_RM3100, gpioIds::MGM_3_RM3100_CS, spiDev,
|
|
||||||
RM3100::MAX_BUFFER_SIZE, spi::DEFAULT_RM3100_MODE, spi::DEFAULT_RM3100_SPEED);
|
RM3100::MAX_BUFFER_SIZE, spi::DEFAULT_RM3100_MODE, spi::DEFAULT_RM3100_SPEED);
|
||||||
mgmRm3100Handler =
|
mgmRm3100Handler = new MgmRM3100Handler(objects::MGM_3_RM3100_HANDLER,
|
||||||
new MgmRM3100Handler(objects::MGM_3_RM3100_HANDLER, objects::SPI_COM_IF, spiCookie, 0);
|
objects::SPI_COM_IF, spiCookie, 0);
|
||||||
mgmRm3100Handler->setStartUpImmediately();
|
mgmRm3100Handler->setStartUpImmediately();
|
||||||
#if FSFW_HAL_RM3100_MGM_DEBUG == 1
|
#if FSFW_HAL_RM3100_MGM_DEBUG == 1
|
||||||
mgmRm3100Handler->setToGoToNormalMode(true);
|
mgmRm3100Handler->setToGoToNormalMode(true);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
spiCookie =
|
spiCookie = new SpiCookie(addresses::GYRO_0_ADIS, gpioIds::GYRO_0_ADIS_CS, spiDev,
|
||||||
new SpiCookie(addresses::GYRO_0_ADIS, gpioIds::GYRO_0_ADIS_CS, spiDev,
|
|
||||||
ADIS16507::MAXIMUM_REPLY_SIZE, spi::DEFAULT_L3G_MODE, spi::DEFAULT_L3G_SPEED);
|
ADIS16507::MAXIMUM_REPLY_SIZE, spi::DEFAULT_L3G_MODE, spi::DEFAULT_L3G_SPEED);
|
||||||
auto adisHandler =
|
auto adisHandler = new GyroADIS16507Handler(objects::GYRO_0_ADIS_HANDLER, objects::SPI_COM_IF,
|
||||||
new GyroADIS16507Handler(objects::GYRO_0_ADIS_HANDLER, objects::SPI_COM_IF, spiCookie);
|
spiCookie);
|
||||||
adisHandler->setStartUpImmediately();
|
adisHandler->setStartUpImmediately();
|
||||||
spiCookie =
|
spiCookie = new SpiCookie(addresses::GYRO_1_L3G, gpioIds::GYRO_1_L3G_CS, spiDev,
|
||||||
new SpiCookie(addresses::GYRO_1_L3G, gpioIds::GYRO_1_L3G_CS, spiDev, L3GD20H::MAX_BUFFER_SIZE,
|
L3GD20H::MAX_BUFFER_SIZE, spi::DEFAULT_L3G_MODE, spi::DEFAULT_L3G_SPEED);
|
||||||
spi::DEFAULT_L3G_MODE, spi::DEFAULT_L3G_SPEED);
|
auto gyroL3gHandler = new GyroHandlerL3GD20H(objects::GYRO_1_L3G_HANDLER, objects::SPI_COM_IF,
|
||||||
auto gyroL3gHandler =
|
spiCookie, 0);
|
||||||
new GyroHandlerL3GD20H(objects::GYRO_1_L3G_HANDLER, objects::SPI_COM_IF, spiCookie, 0);
|
|
||||||
gyroL3gHandler->setStartUpImmediately();
|
gyroL3gHandler->setStartUpImmediately();
|
||||||
#if FSFW_HAL_L3GD20_GYRO_DEBUG== 1
|
#if FSFW_HAL_L3GD20_GYRO_DEBUG== 1
|
||||||
gyroL3gHandler->setToGoToNormalMode(true);
|
gyroL3gHandler->setToGoToNormalMode(true);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
spiCookie =
|
spiCookie = new SpiCookie(addresses::GYRO_2_ADIS, gpioIds::GYRO_2_ADIS_CS, spiDev,
|
||||||
new SpiCookie(addresses::GYRO_2_ADIS, gpioIds::GYRO_2_ADIS_CS, spiDev,
|
|
||||||
ADIS16507::MAXIMUM_REPLY_SIZE, spi::DEFAULT_L3G_MODE, spi::DEFAULT_L3G_SPEED);
|
ADIS16507::MAXIMUM_REPLY_SIZE, spi::DEFAULT_L3G_MODE, spi::DEFAULT_L3G_SPEED);
|
||||||
adisHandler =
|
adisHandler = new GyroADIS16507Handler(objects::GYRO_2_ADIS_HANDLER, objects::SPI_COM_IF,
|
||||||
new GyroADIS16507Handler(objects::GYRO_2_ADIS_HANDLER, objects::SPI_COM_IF, spiCookie);
|
spiCookie);
|
||||||
adisHandler->setStartUpImmediately();
|
adisHandler->setStartUpImmediately();
|
||||||
|
|
||||||
spiCookie =
|
spiCookie = new SpiCookie(addresses::GYRO_3_L3G, gpioIds::GYRO_3_L3G_CS, spiDev,
|
||||||
new SpiCookie(addresses::GYRO_3_L3G, gpioIds::GYRO_3_L3G_CS, spiDev, L3GD20H::MAX_BUFFER_SIZE,
|
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_COM_IF,
|
||||||
gyroL3gHandler =
|
spiCookie, 0);
|
||||||
new GyroHandlerL3GD20H(objects::GYRO_3_L3G_HANDLER, objects::SPI_COM_IF, spiCookie, 0);
|
|
||||||
gyroL3gHandler->setStartUpImmediately();
|
gyroL3gHandler->setStartUpImmediately();
|
||||||
#if FSFW_HAL_L3GD20_GYRO_DEBUG== 1
|
#if FSFW_HAL_L3GD20_GYRO_DEBUG== 1
|
||||||
gyroL3gHandler->setToGoToNormalMode(true);
|
gyroL3gHandler->setToGoToNormalMode(true);
|
||||||
@ -175,13 +180,14 @@ void ObjectFactory::produce(void* args) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void ObjectFactory::createTestTasks() {
|
void ObjectFactory::createTestTasks() {
|
||||||
|
|
||||||
new TestTask(objects::TEST_TASK);
|
new TestTask(objects::TEST_TASK);
|
||||||
|
|
||||||
#if OBSW_ADD_SPI_TEST_CODE == 1
|
#if RPI_ADD_SPI_TEST == 1
|
||||||
new SpiTestClass(objects::SPI_TEST, gpioIF);
|
new SpiTestClass(objects::SPI_TEST, gpioIF);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if OBSW_ADD_UART_TEST_CODE == 1
|
#if RPI_ADD_UART_TEST == 1
|
||||||
new UartTestClass(objects::UART_TEST);
|
new UartTestClass(objects::UART_TEST);
|
||||||
#else
|
#else
|
||||||
new UartComIF(objects::UART_COM_IF);
|
new UartComIF(objects::UART_COM_IF);
|
||||||
@ -211,20 +217,20 @@ void ObjectFactory::createTestTasks() {
|
|||||||
|
|
||||||
spiDev = "/dev/spidev0.1";
|
spiDev = "/dev/spidev0.1";
|
||||||
spiCookie = new SpiCookie(addresses::GYRO_0_ADIS, gpioIds::GYRO_0_ADIS_CS, spiDev,
|
spiCookie = new SpiCookie(addresses::GYRO_0_ADIS, gpioIds::GYRO_0_ADIS_CS, spiDev,
|
||||||
ADIS16507::MAXIMUM_REPLY_SIZE, spi::DEFAULT_ADIS16507_MODE,
|
ADIS16507::MAXIMUM_REPLY_SIZE, spi::DEFAULT_ADIS16507_MODE, spi::DEFAULT_ADIS16507_SPEED,
|
||||||
spi::DEFAULT_ADIS16507_SPEED, nullptr, nullptr);
|
nullptr, nullptr);
|
||||||
auto adisGyroHandler =
|
auto adisGyroHandler = new GyroADIS16507Handler(objects::GYRO_0_ADIS_HANDLER, objects::SPI_COM_IF, spiCookie);
|
||||||
new GyroADIS16507Handler(objects::GYRO_0_ADIS_HANDLER, objects::SPI_COM_IF, spiCookie);
|
|
||||||
adisGyroHandler->setStartUpImmediately();
|
adisGyroHandler->setStartUpImmediately();
|
||||||
#endif /* RPI_TEST_ADIS16507 == 1 */
|
#endif /* RPI_TEST_ADIS16507 == 1 */
|
||||||
|
|
||||||
#if RPI_TEST_GPS_HANDLER == 1
|
#if RPI_TEST_GPS_HANDLER == 1
|
||||||
UartCookie* uartCookie =
|
UartCookie* uartCookie = new UartCookie(objects::GPS0_HANDLER, "/dev/serial0",
|
||||||
new UartCookie(objects::GPS0_HANDLER, "/dev/serial0", UartModes::CANONICAL, 9600, 1024);
|
UartModes::CANONICAL, 9600, 1024);
|
||||||
uartCookie->setToFlushInput(true);
|
uartCookie->setToFlushInput(true);
|
||||||
uartCookie->setReadCycles(6);
|
uartCookie->setReadCycles(6);
|
||||||
GPSHyperionHandler* gpsHandler =
|
GPSHyperionHandler* gpsHandler = new GPSHyperionHandler(objects::GPS0_HANDLER,
|
||||||
new GPSHyperionHandler(objects::GPS0_HANDLER, objects::UART_COM_IF, uartCookie, false);
|
objects::UART_COM_IF, uartCookie, false);
|
||||||
gpsHandler->setStartUpImmediately();
|
gpsHandler->setStartUpImmediately();
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -1,11 +1,12 @@
|
|||||||
#ifndef BSP_LINUX_OBJECTFACTORY_H_
|
#ifndef BSP_LINUX_OBJECTFACTORY_H_
|
||||||
#define BSP_LINUX_OBJECTFACTORY_H_
|
#define BSP_LINUX_OBJECTFACTORY_H_
|
||||||
|
|
||||||
|
|
||||||
namespace ObjectFactory {
|
namespace ObjectFactory {
|
||||||
void setStatics();
|
void setStatics();
|
||||||
void produce(void* args);
|
void produce(void* args);
|
||||||
|
|
||||||
void createTestTasks();
|
void createTestTasks();
|
||||||
}; // namespace ObjectFactory
|
};
|
||||||
|
|
||||||
#endif /* BSP_LINUX_OBJECTFACTORY_H_ */
|
#endif /* BSP_LINUX_OBJECTFACTORY_H_ */
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
target_sources(${OBSW_NAME} PRIVATE
|
target_sources(${TARGET_NAME} PRIVATE
|
||||||
print.c
|
print.c
|
||||||
)
|
)
|
||||||
|
|
||||||
target_include_directories(${OBSW_NAME} PUBLIC
|
target_include_directories(${TARGET_NAME} PUBLIC
|
||||||
${CMAKE_CURRENT_SOURCE_DIR}
|
${CMAKE_CURRENT_SOURCE_DIR}
|
||||||
)
|
)
|
||||||
|
@ -7,8 +7,7 @@ extern "C" void __gcov_flush();
|
|||||||
#else
|
#else
|
||||||
void __gcov_flush() {
|
void __gcov_flush() {
|
||||||
sif::info << "GCC GCOV: Please supply GCOV=1 in Makefile if "
|
sif::info << "GCC GCOV: Please supply GCOV=1 in Makefile if "
|
||||||
"coverage information is desired.\n"
|
"coverage information is desired.\n" << std::flush;
|
||||||
<< std::flush;
|
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
#include <bsp_linux_board/boardconfig/print.h>
|
#include <bsp_q7s/boardconfig/print.h>
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
|
|
||||||
void printChar(const char* character, bool errStream) {
|
void printChar(const char* character, bool errStream) {
|
||||||
@ -8,3 +8,7 @@ void printChar(const char* character, bool errStream) {
|
|||||||
}
|
}
|
||||||
putc(*character, stdout);
|
putc(*character, stdout);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
target_sources(${OBSW_NAME} PRIVATE
|
target_sources(${TARGET_NAME} PRIVATE
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
|
@ -1,11 +1,12 @@
|
|||||||
#include <iostream>
|
|
||||||
|
|
||||||
#include "InitMission.h"
|
#include "InitMission.h"
|
||||||
#include "OBSWConfig.h"
|
#include "OBSWConfig.h"
|
||||||
#include "OBSWVersion.h"
|
#include "OBSWVersion.h"
|
||||||
|
|
||||||
#include "fsfw/FSFWVersion.h"
|
#include "fsfw/FSFWVersion.h"
|
||||||
#include "fsfw/tasks/TaskFactory.h"
|
#include "fsfw/tasks/TaskFactory.h"
|
||||||
|
|
||||||
|
#include <iostream>
|
||||||
|
|
||||||
#ifdef RASPBERRY_PI
|
#ifdef RASPBERRY_PI
|
||||||
static const char* const BOARD_NAME = "Raspberry Pi";
|
static const char* const BOARD_NAME = "Raspberry Pi";
|
||||||
#elif defined(BEAGLEBONEBLACK)
|
#elif defined(BEAGLEBONEBLACK)
|
||||||
@ -18,12 +19,13 @@ static const char* const BOARD_NAME = "Unknown Board";
|
|||||||
* @brief This is the main program and entry point for the Raspberry Pi.
|
* @brief This is the main program and entry point for the Raspberry Pi.
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
int main(void) {
|
int main(void)
|
||||||
|
{
|
||||||
std::cout << "-- EIVE OBSW --" << std::endl;
|
std::cout << "-- EIVE OBSW --" << std::endl;
|
||||||
std::cout << "-- Compiled for Linux board " << BOARD_NAME << " --" << std::endl;
|
std::cout << "-- Compiled for Linux board " << BOARD_NAME << " --" << std::endl;
|
||||||
std::cout << "-- OBSW " << SW_NAME << " v" << SW_VERSION << "." << SW_SUBVERSION << "."
|
std::cout << "-- OBSW " << SW_NAME << " v" << SW_VERSION << "." << SW_SUBVERSION <<
|
||||||
<< SW_REVISION << ", FSFW v" << FSFW_VERSION << "." << FSFW_SUBVERSION << FSFW_REVISION
|
"." << SW_REVISION << ", FSFW v" << FSFW_VERSION << "." << FSFW_SUBVERSION <<
|
||||||
<< "--" << std::endl;
|
FSFW_REVISION << "--" << std::endl;
|
||||||
std::cout << "-- " << __DATE__ << " " << __TIME__ << " --" << std::endl;
|
std::cout << "-- " << __DATE__ << " " << __TIME__ << " --" << std::endl;
|
||||||
|
|
||||||
initmission::initMission();
|
initmission::initMission();
|
||||||
@ -33,3 +35,5 @@ int main(void) {
|
|||||||
TaskFactory::delayTask(5000);
|
TaskFactory::delayTask(5000);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -1,25 +1,17 @@
|
|||||||
#simple mode
|
target_sources(${TARGET_NAME} PUBLIC
|
||||||
add_executable(${SIMPLE_OBSW_NAME} EXCLUDE_FROM_ALL)
|
|
||||||
target_compile_definitions(${SIMPLE_OBSW_NAME} PRIVATE "Q7S_SIMPLE_MODE")
|
|
||||||
target_sources(${SIMPLE_OBSW_NAME} PUBLIC
|
|
||||||
main.cpp
|
|
||||||
)
|
|
||||||
#I think this is unintentional? (produces linker errors for stuff in /linux)
|
|
||||||
target_link_libraries(${SIMPLE_OBSW_NAME} PUBLIC
|
|
||||||
${LIB_FSFW_NAME}
|
|
||||||
)
|
|
||||||
target_compile_definitions(${SIMPLE_OBSW_NAME} PRIVATE "Q7S_SIMPLE_MODE")
|
|
||||||
add_subdirectory(simple)
|
|
||||||
|
|
||||||
target_sources(${OBSW_NAME} PUBLIC
|
|
||||||
main.cpp
|
main.cpp
|
||||||
)
|
)
|
||||||
|
|
||||||
add_subdirectory(boardtest)
|
add_subdirectory(boardtest)
|
||||||
|
|
||||||
|
if(Q7S_SIMPLE_MODE)
|
||||||
|
add_subdirectory(simple)
|
||||||
|
else()
|
||||||
add_subdirectory(boardconfig)
|
add_subdirectory(boardconfig)
|
||||||
add_subdirectory(comIF)
|
add_subdirectory(comIF)
|
||||||
|
add_subdirectory(gpio)
|
||||||
add_subdirectory(core)
|
add_subdirectory(core)
|
||||||
add_subdirectory(memory)
|
add_subdirectory(memory)
|
||||||
add_subdirectory(callbacks)
|
add_subdirectory(callbacks)
|
||||||
add_subdirectory(devices)
|
add_subdirectory(devices)
|
||||||
|
endif()
|
||||||
|
@ -1,12 +1,7 @@
|
|||||||
target_sources(${OBSW_NAME} PRIVATE
|
target_sources(${TARGET_NAME} PRIVATE
|
||||||
print.c
|
print.c
|
||||||
)
|
)
|
||||||
|
|
||||||
target_sources(${SIMPLE_OBSW_NAME} PRIVATE
|
target_include_directories(${TARGET_NAME} PUBLIC
|
||||||
print.c
|
|
||||||
)
|
|
||||||
|
|
||||||
|
|
||||||
target_include_directories(${OBSW_NAME} PUBLIC
|
|
||||||
${CMAKE_CURRENT_SOURCE_DIR}
|
${CMAKE_CURRENT_SOURCE_DIR}
|
||||||
)
|
)
|
||||||
|
@ -3,98 +3,98 @@
|
|||||||
|
|
||||||
namespace q7s {
|
namespace q7s {
|
||||||
|
|
||||||
static constexpr char SPI_DEFAULT_DEV[] = "/dev/spi-main";
|
static constexpr char SPI_DEFAULT_DEV[] = "/dev/spidev2.0";
|
||||||
static constexpr char SPI_RW_DEV[] = "/dev/spi-rw";
|
static constexpr char SPI_RW_DEV[] = "/dev/spidev3.0";
|
||||||
|
|
||||||
static constexpr char I2C_DEFAULT_DEV[] = "/dev/i2c-eive";
|
static constexpr char I2C_DEFAULT_DEV[] = "/dev/i2c-1";
|
||||||
|
|
||||||
static constexpr char UART_GNSS_DEV[] = "/dev/ul-gps";
|
static constexpr char UART_PLOC_MPSOC_DEV[] = "/dev/ttyUL3";
|
||||||
static constexpr char UART_PLOC_MPSOC_DEV[] = "/dev/ul-plmpsoc";
|
static constexpr char UART_PLOC_SUPERVSIOR_DEV[] = "/dev/ttyUL4";
|
||||||
static constexpr char UART_PLOC_SUPERVSIOR_DEV[] = "/dev/ul-plsv";
|
static constexpr char UART_SYRLINKS_DEV[] = "/dev/ttyUL5";
|
||||||
static constexpr char UART_SYRLINKS_DEV[] = "/dev/ul-syrlinks";
|
static constexpr char UART_STAR_TRACKER_DEV[] = "/dev/ttyUL8";
|
||||||
static constexpr char UART_STAR_TRACKER_DEV[] = "/dev/ul-str";
|
|
||||||
|
|
||||||
static constexpr char UIO_PDEC_REGISTERS[] = "/dev/uio0";
|
static constexpr char UART_GNSS_0_DEV[] = "/dev/ttyUL0";
|
||||||
static constexpr char UIO_PDEC_CONFIG_MEMORY[] = "/dev/uio2";
|
static constexpr char UART_GNSS_1_DEV[] = "/dev/ttyUL2";
|
||||||
static constexpr char UIO_PDEC_RAM[] = "/dev/uio3";
|
|
||||||
static constexpr char UIO_PTME[] = "/dev/uio1";
|
|
||||||
static constexpr int MAP_ID_PTME_CONFIG = 3;
|
|
||||||
|
|
||||||
namespace uiomapids {
|
/**************************************************************/
|
||||||
static const int PTME_VC0 = 0;
|
/** OBC1E */
|
||||||
static const int PTME_VC1 = 1;
|
/**************************************************************/
|
||||||
static const int PTME_VC2 = 2;
|
static constexpr char GPIO_MULTIPURPOSE_1V8_OBC1D[] = "/amba_pl/gpio@42020000";
|
||||||
static const int PTME_VC3 = 3;
|
static const char* const GPIO_GYRO_ADIS_LABEL = GPIO_MULTIPURPOSE_1V8_OBC1D;
|
||||||
static const int PTME_CONFIG = 4;
|
static constexpr uint32_t GPIO_GYRO_0_ADIS_CS = 0; // Package Pin: W20
|
||||||
} // namespace uiomapids
|
static constexpr uint32_t GPIO_GYRO_2_ADIS_CS = 2; // AA22
|
||||||
|
|
||||||
namespace gpioNames {
|
/**************************************************************/
|
||||||
|
/** OBC1F B0 */
|
||||||
|
/**************************************************************/
|
||||||
|
static constexpr char GPIO_FLEX_OBC1F_B0[] = "/amba_pl/gpio@42030000";
|
||||||
|
static constexpr uint32_t GPIO_FLEX_OBC1F_B0_WIDTH = 20;
|
||||||
|
static const char* const GPIO_ACS_BOARD_DEFAULT_LABEL = GPIO_FLEX_OBC1F_B0;
|
||||||
|
static const char* const GPIO_RW_DEFAULT_LABEL = GPIO_FLEX_OBC1F_B0;
|
||||||
|
static const char* const GPIO_RAD_SENSOR_LABEL = GPIO_FLEX_OBC1F_B0;
|
||||||
|
|
||||||
static constexpr char GYRO_0_ADIS_CS[] = "gyro_0_adis_chip_select";
|
|
||||||
static constexpr char GYRO_1_L3G_CS[] = "gyro_1_l3g_chip_select";
|
|
||||||
static constexpr char GYRO_2_ADIS_CS[] = "gyro_2_adis_chip_select";
|
|
||||||
static constexpr char GYRO_3_L3G_CS[] = "gyro_3_l3g_chip_select";
|
|
||||||
static constexpr char MGM_0_CS[] = "mgm_0_lis3_chip_select";
|
|
||||||
static constexpr char MGM_1_CS[] = "mgm_1_rm3100_chip_select";
|
|
||||||
static constexpr char MGM_2_CS[] = "mgm_2_lis3_chip_select";
|
|
||||||
static constexpr char MGM_3_CS[] = "mgm_3_rm3100_chip_select";
|
|
||||||
static constexpr char RESET_GNSS_0[] = "reset_gnss_0";
|
|
||||||
static constexpr char RESET_GNSS_1[] = "reset_gnss_1";
|
|
||||||
static constexpr char GNSS_0_ENABLE[] = "enable_gnss_0";
|
|
||||||
static constexpr char GNSS_1_ENABLE[] = "enable_gnss_1";
|
|
||||||
static constexpr char GYRO_0_ENABLE[] = "enable_gyro_0";
|
|
||||||
static constexpr char GYRO_2_ENABLE[] = "enable_gyro_2";
|
|
||||||
static constexpr char GNSS_SELECT[] = "gnss_mux_select";
|
|
||||||
static constexpr char GNSS_MUX_SELECT[] = "gnss_mux_select";
|
|
||||||
|
|
||||||
static constexpr char HEATER_0[] = "heater0";
|
static constexpr uint32_t GPIO_RW_0_CS = 7; // B20
|
||||||
static constexpr char HEATER_1[] = "heater1";
|
static constexpr uint32_t GPIO_RW_1_CS = 3; // G22
|
||||||
static constexpr char HEATER_2[] = "heater2";
|
static constexpr uint32_t GPIO_RW_2_CS = 11; // E18
|
||||||
static constexpr char HEATER_3[] = "heater3";
|
static constexpr uint32_t GPIO_RW_3_CS = 6; // B19
|
||||||
static constexpr char HEATER_4[] = "heater4";
|
|
||||||
static constexpr char HEATER_5[] = "heater5";
|
|
||||||
static constexpr char HEATER_6[] = "heater6";
|
|
||||||
static constexpr char HEATER_7[] = "heater7";
|
|
||||||
static constexpr char SA_DPL_PIN_0[] = "sa_dpl_0";
|
|
||||||
static constexpr char SA_DPL_PIN_1[] = "sa_dpl_1";
|
|
||||||
static constexpr char SPI_MUX_BIT_0_PIN[] = "spi_mux_bit_0";
|
|
||||||
static constexpr char SPI_MUX_BIT_1_PIN[] = "spi_mux_bit_1";
|
|
||||||
static constexpr char SPI_MUX_BIT_2_PIN[] = "spi_mux_bit_2";
|
|
||||||
static constexpr char SPI_MUX_BIT_3_PIN[] = "spi_mux_bit_3";
|
|
||||||
static constexpr char SPI_MUX_BIT_4_PIN[] = "spi_mux_bit_4";
|
|
||||||
static constexpr char SPI_MUX_BIT_5_PIN[] = "spi_mux_bit_5";
|
|
||||||
static constexpr char EN_RW_CS[] = "en_rw_cs";
|
|
||||||
static constexpr char EN_RW_1[] = "enable_rw_1";
|
|
||||||
static constexpr char EN_RW_2[] = "enable_rw_2";
|
|
||||||
static constexpr char EN_RW_3[] = "enable_rw_3";
|
|
||||||
static constexpr char EN_RW_4[] = "enable_rw_4";
|
|
||||||
|
|
||||||
static constexpr char RAD_SENSOR_CHIP_SELECT[] = "rad_sensor_chip_select";
|
static constexpr uint32_t GPIO_GYRO_1_L3G_CS = 18; // N22
|
||||||
static constexpr char ENABLE_RADFET[] = "enable_radfet";
|
static constexpr uint32_t GPIO_GYRO_3_L3G_CS = 1; // M21
|
||||||
static constexpr char PAPB_BUSY_SIGNAL_VC0[] = "papb_busy_signal_vc0";
|
static constexpr uint32_t GPIO_MGM_0_LIS3_CS = 5; // C18
|
||||||
static constexpr char PAPB_EMPTY_SIGNAL_VC0[] = "papb_empty_signal_vc0";
|
static constexpr uint32_t GPIO_MGM_1_RM3100_CS = 16; // A16
|
||||||
static constexpr char PAPB_BUSY_SIGNAL_VC1[] = "papb_busy_signal_vc1";
|
static constexpr uint32_t GPIO_MGM_3_RM3100_CS = 10; // C17
|
||||||
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";
|
|
||||||
|
|
||||||
static constexpr char PL_PCDU_ENABLE_VBAT0[] = "enable_plpcdu_vbat0";
|
// Active low enable pin (needs to be driven low for regular operations)
|
||||||
static constexpr char PL_PCDU_ENABLE_VBAT1[] = "enable_plpcdu_vbat1";
|
static constexpr uint32_t GPIO_GYRO_0_ENABLE = 2; // H22
|
||||||
static constexpr char PL_PCDU_ENABLE_DRO[] = "enable_plpcdu_dro";
|
|
||||||
static constexpr char PL_PCDU_ENABLE_X8[] = "enable_plpcdu_x8";
|
|
||||||
static constexpr char PL_PCDU_ENABLE_TX[] = "enable_plpcdu_tx";
|
|
||||||
static constexpr char PL_PCDU_ENABLE_HPA[] = "enable_plpcdu_hpa";
|
|
||||||
static constexpr char PL_PCDU_ENABLE_MPA[] = "enable_plpcdu_mpa";
|
|
||||||
static constexpr char PL_PCDU_ADC_CS[] = "plpcdu_adc_chip_select";
|
|
||||||
|
|
||||||
} // namespace gpioNames
|
// Active low reset pin (needs to be driven high for regular operations)
|
||||||
} // namespace q7s
|
static constexpr uint32_t GPIO_RESET_GNSS_0 = 9; // C22
|
||||||
|
static constexpr uint32_t GPIO_RESET_GNSS_1 = 12; // B21
|
||||||
|
|
||||||
|
static constexpr uint32_t GPIO_RAD_SENSOR_CS = 19; // R18
|
||||||
|
|
||||||
|
/**************************************************************/
|
||||||
|
/** OBC1F B1 */
|
||||||
|
/**************************************************************/
|
||||||
|
static constexpr char GPIO_FLEX_OBC1F_B1[] = "/amba_pl/gpio@42030000";
|
||||||
|
// Need to use chip name here for now because the label name is the name for
|
||||||
|
// gpiochip 5 and gpiochip6
|
||||||
|
static constexpr char GPIO_FLEX_OBC1F_B1_CHIP[] = "gpiochip6";
|
||||||
|
static const char* const GPIO_MGM2_LIS3_LABEL = GPIO_FLEX_OBC1F_B1_CHIP;
|
||||||
|
static constexpr uint32_t GPIO_MGM_2_LIS3_CS = 0; // D18
|
||||||
|
|
||||||
|
/**************************************************************/
|
||||||
|
/** OBC1C */
|
||||||
|
/**************************************************************/
|
||||||
|
static constexpr char GPIO_3V3_OBC1C[] = "/amba_pl/gpio@42040000";
|
||||||
|
static const char* const GPIO_HEATER_LABEL = GPIO_3V3_OBC1C;
|
||||||
|
static const char* const GPIO_SOLAR_ARR_DEPL_LABEL = GPIO_3V3_OBC1C;
|
||||||
|
static constexpr uint32_t GPIO_HEATER_0_PIN = 6;
|
||||||
|
static constexpr uint32_t GPIO_HEATER_1_PIN = 12;
|
||||||
|
static constexpr uint32_t GPIO_HEATER_2_PIN = 7;
|
||||||
|
static constexpr uint32_t GPIO_HEATER_3_PIN = 5;
|
||||||
|
static constexpr uint32_t GPIO_HEATER_4_PIN = 3;
|
||||||
|
static constexpr uint32_t GPIO_HEATER_5_PIN = 0;
|
||||||
|
static constexpr uint32_t GPIO_HEATER_6_PIN = 1;
|
||||||
|
static constexpr uint32_t GPIO_HEATER_7_PIN = 11;
|
||||||
|
static constexpr uint32_t GPIO_GYRO_2_ENABLE = 18; // F22
|
||||||
|
|
||||||
|
static constexpr uint32_t GPIO_SOL_DEPL_SA_0_PIN = 4;
|
||||||
|
static constexpr uint32_t GPIO_SOL_DEPL_SA_1_PIN = 2;
|
||||||
|
|
||||||
|
static constexpr char GPIO_RW_SPI_MUX_LABEL[] = "zynq_gpio";
|
||||||
|
// Uses EMIO interface to PL, starts at 54
|
||||||
|
static constexpr uint32_t GPIO_RW_SPI_MUX_CS = 54;
|
||||||
|
|
||||||
|
static constexpr uint32_t SPI_MUX_BIT_1 = 13;
|
||||||
|
static constexpr uint32_t SPI_MUX_BIT_2 = 14;
|
||||||
|
static constexpr uint32_t SPI_MUX_BIT_3 = 15;
|
||||||
|
static constexpr uint32_t SPI_MUX_BIT_4 = 16;
|
||||||
|
static constexpr uint32_t SPI_MUX_BIT_5 = 17;
|
||||||
|
static constexpr uint32_t SPI_MUX_BIT_6 = 9;
|
||||||
|
static constexpr uint32_t EN_RW_CS = 17;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
#endif /* BSP_Q7S_BOARDCONFIG_BUSCONF_H_ */
|
#endif /* BSP_Q7S_BOARDCONFIG_BUSCONF_H_ */
|
||||||
|
@ -7,8 +7,7 @@ extern "C" void __gcov_flush();
|
|||||||
#else
|
#else
|
||||||
void __gcov_flush() {
|
void __gcov_flush() {
|
||||||
sif::info << "GCC GCOV: Please supply GCOV=1 in Makefile if "
|
sif::info << "GCC GCOV: Please supply GCOV=1 in Makefile if "
|
||||||
"coverage information is desired.\n"
|
"coverage information is desired.\n" << std::flush;
|
||||||
<< std::flush;
|
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
@ -8,3 +8,7 @@ void printChar(const char* character, bool errStream) {
|
|||||||
}
|
}
|
||||||
putc(*character, stdout);
|
putc(*character, stdout);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@ -3,6 +3,8 @@
|
|||||||
|
|
||||||
#include <cstdint>
|
#include <cstdint>
|
||||||
|
|
||||||
|
#cmakedefine01 Q7S_SIMPLE_MODE
|
||||||
|
|
||||||
/*******************************************************************/
|
/*******************************************************************/
|
||||||
/** All of the following flags should be enabled for mission code */
|
/** All of the following flags should be enabled for mission code */
|
||||||
/*******************************************************************/
|
/*******************************************************************/
|
||||||
|
@ -1,10 +1,8 @@
|
|||||||
target_sources(${OBSW_NAME} PRIVATE
|
target_sources(${TARGET_NAME} PRIVATE
|
||||||
FileSystemTest.cpp
|
FileSystemTest.cpp
|
||||||
Q7STestTask.cpp
|
Q7STestTask.cpp
|
||||||
)
|
)
|
||||||
|
|
||||||
if(EIVE_BUILD_Q7S_SIMPLE_MODE)
|
|
||||||
target_sources(${SIMPLE_OBSW_NAME} PRIVATE
|
|
||||||
FileSystemTest.cpp
|
|
||||||
)
|
|
||||||
endif()
|
|
||||||
|
@ -1,11 +1,13 @@
|
|||||||
#include "FileSystemTest.h"
|
#include "FileSystemTest.h"
|
||||||
|
|
||||||
#include <cstdlib>
|
|
||||||
#include <iostream>
|
|
||||||
|
|
||||||
#include "fsfw/timemanager/Stopwatch.h"
|
#include "fsfw/timemanager/Stopwatch.h"
|
||||||
|
|
||||||
enum SdCard { SDC0, SDC1 };
|
#include <iostream>
|
||||||
|
#include <cstdlib>
|
||||||
|
|
||||||
|
enum SdCard {
|
||||||
|
SDC0,
|
||||||
|
SDC1
|
||||||
|
};
|
||||||
|
|
||||||
FileSystemTest::FileSystemTest() {
|
FileSystemTest::FileSystemTest() {
|
||||||
using namespace std;
|
using namespace std;
|
||||||
@ -20,4 +22,5 @@ FileSystemTest::FileSystemTest() {
|
|||||||
//stopwatch.stop(true);
|
//stopwatch.stop(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
FileSystemTest::~FileSystemTest() {}
|
FileSystemTest::~FileSystemTest() {
|
||||||
|
}
|
||||||
|
@ -5,8 +5,9 @@ class FileSystemTest {
|
|||||||
public:
|
public:
|
||||||
FileSystemTest();
|
FileSystemTest();
|
||||||
virtual~ FileSystemTest();
|
virtual~ FileSystemTest();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
#endif /* BSP_Q7S_BOARDTEST_FILESYSTEMTEST_H_ */
|
#endif /* BSP_Q7S_BOARDTEST_FILESYSTEMTEST_H_ */
|
||||||
|
@ -1,52 +1,36 @@
|
|||||||
#include "Q7STestTask.h"
|
|
||||||
|
|
||||||
#include <bsp_q7s/core/CoreController.h>
|
#include <bsp_q7s/core/CoreController.h>
|
||||||
#include <bsp_q7s/memory/FileSystemHandler.h>
|
#include <bsp_q7s/memory/FileSystemHandler.h>
|
||||||
#include <fsfw/objectmanager/ObjectManager.h>
|
#include <fsfw/objectmanager/ObjectManager.h>
|
||||||
#include <gps.h>
|
#include "Q7STestTask.h"
|
||||||
#include <libgpsmm.h>
|
|
||||||
|
|
||||||
#include <cstdio>
|
|
||||||
#include <ctime>
|
|
||||||
#include <fstream>
|
|
||||||
#include <iomanip>
|
|
||||||
#include <iostream>
|
|
||||||
#include <nlohmann/json.hpp>
|
|
||||||
|
|
||||||
#include "bsp_q7s/memory/SdCardManager.h"
|
#include "bsp_q7s/memory/SdCardManager.h"
|
||||||
#include "bsp_q7s/memory/scratchApi.h"
|
#include "bsp_q7s/memory/scratchApi.h"
|
||||||
#include "fsfw/tasks/TaskFactory.h"
|
|
||||||
#include "fsfw/timemanager/Stopwatch.h"
|
#include "fsfw/timemanager/Stopwatch.h"
|
||||||
|
#include "fsfw/tasks/TaskFactory.h"
|
||||||
|
|
||||||
#include "test/DummyParameter.h"
|
#include "test/DummyParameter.h"
|
||||||
|
|
||||||
|
#include <nlohmann/json.hpp>
|
||||||
|
|
||||||
|
#include <iostream>
|
||||||
|
#include <fstream>
|
||||||
|
#include <cstdio>
|
||||||
|
|
||||||
Q7STestTask::Q7STestTask(object_id_t objectId): TestTask(objectId) {
|
Q7STestTask::Q7STestTask(object_id_t objectId): TestTask(objectId) {
|
||||||
doTestSdCard = false;
|
|
||||||
doTestScratchApi = false;
|
|
||||||
doTestGps = false;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
ReturnValue_t Q7STestTask::performOneShotAction() {
|
ReturnValue_t Q7STestTask::performOneShotAction() {
|
||||||
if (doTestSdCard) {
|
//testSdCard();
|
||||||
testSdCard();
|
//testScratchApi();
|
||||||
}
|
|
||||||
if (doTestScratchApi) {
|
|
||||||
testScratchApi();
|
|
||||||
}
|
|
||||||
//testJsonLibDirect();
|
//testJsonLibDirect();
|
||||||
//testDummyParams();
|
//testDummyParams();
|
||||||
//testProtHandler();
|
//testProtHandler();
|
||||||
FsOpCodes opCode = FsOpCodes::APPEND_TO_FILE;
|
//FsOpCodes opCode = FsOpCodes::ATTEMPT_DIR_REMOVAL_NON_EMPTY;
|
||||||
testFileSystemHandlerDirect(opCode);
|
//testFileSystemHandlerDirect(opCode);
|
||||||
return TestTask::performOneShotAction();
|
return TestTask::performOneShotAction();
|
||||||
}
|
}
|
||||||
|
|
||||||
ReturnValue_t Q7STestTask::performPeriodicAction() {
|
|
||||||
if (doTestGps) {
|
|
||||||
testGpsDaemon();
|
|
||||||
}
|
|
||||||
return TestTask::performPeriodicAction();
|
|
||||||
}
|
|
||||||
|
|
||||||
void Q7STestTask::testSdCard() {
|
void Q7STestTask::testSdCard() {
|
||||||
using namespace std;
|
using namespace std;
|
||||||
Stopwatch stopwatch;
|
Stopwatch stopwatch;
|
||||||
@ -63,7 +47,8 @@ void Q7STestTask::testSdCard() {
|
|||||||
while(iss >> word) {
|
while(iss >> word) {
|
||||||
if(word == "on") {
|
if(word == "on") {
|
||||||
sif::info << "SD card " << static_cast<int>(idx) << " is on" << endl;
|
sif::info << "SD card " << static_cast<int>(idx) << " is on" << endl;
|
||||||
} else if (word == "off") {
|
}
|
||||||
|
else if(word == "off") {
|
||||||
sif::info << "SD card " << static_cast<int>(idx) << " is off" << endl;
|
sif::info << "SD card " << static_cast<int>(idx) << " is off" << endl;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -133,6 +118,7 @@ void Q7STestTask::testDummyParams() {
|
|||||||
|
|
||||||
ReturnValue_t result = param.readJsonFile();
|
ReturnValue_t result = param.readJsonFile();
|
||||||
if(result != HasReturnvaluesIF::RETURN_OK) {
|
if(result != HasReturnvaluesIF::RETURN_OK) {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
param.setValue(DummyParameter::DUMMY_KEY_PARAM_1, 3);
|
param.setValue(DummyParameter::DUMMY_KEY_PARAM_1, 3);
|
||||||
@ -141,18 +127,8 @@ void Q7STestTask::testDummyParams() {
|
|||||||
param.writeJsonFile();
|
param.writeJsonFile();
|
||||||
param.print();
|
param.print();
|
||||||
|
|
||||||
int test = 0;
|
int test = param.getValue<int>(DummyParameter::DUMMY_KEY_PARAM_1);
|
||||||
result = param.getValue<int>(DummyParameter::DUMMY_KEY_PARAM_1, test);
|
std::string test2 = param.getValue<std::string>(DummyParameter::DUMMY_KEY_PARAM_2);
|
||||||
if (result != HasReturnvaluesIF::RETURN_OK) {
|
|
||||||
sif::warning << "Q7STestTask::testDummyParams: Key " << DummyParameter::DUMMY_KEY_PARAM_1
|
|
||||||
<< " does not exist" << std::endl;
|
|
||||||
}
|
|
||||||
std::string test2;
|
|
||||||
result = param.getValue<std::string>(DummyParameter::DUMMY_KEY_PARAM_2, test2);
|
|
||||||
if (result != HasReturnvaluesIF::RETURN_OK) {
|
|
||||||
sif::warning << "Q7STestTask::testDummyParams: Key " << DummyParameter::DUMMY_KEY_PARAM_1
|
|
||||||
<< " 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;
|
||||||
}
|
}
|
||||||
@ -160,8 +136,8 @@ void Q7STestTask::testDummyParams() {
|
|||||||
ReturnValue_t Q7STestTask::initialize() {
|
ReturnValue_t Q7STestTask::initialize() {
|
||||||
coreController = ObjectManager::instance()->get<CoreController>(objects::CORE_CONTROLLER);
|
coreController = ObjectManager::instance()->get<CoreController>(objects::CORE_CONTROLLER);
|
||||||
if(coreController == nullptr) {
|
if(coreController == nullptr) {
|
||||||
sif::warning << "Q7STestTask::initialize: Could not retrieve CORE_CONTROLLER object"
|
sif::warning << "Q7STestTask::initialize: Could not retrieve CORE_CONTROLLER object" <<
|
||||||
<< std::endl;
|
std::endl;
|
||||||
}
|
}
|
||||||
return TestTask::initialize();
|
return TestTask::initialize();
|
||||||
}
|
}
|
||||||
@ -170,14 +146,16 @@ void Q7STestTask::testProtHandler() {
|
|||||||
bool opPerformed = false;
|
bool opPerformed = false;
|
||||||
ReturnValue_t result = HasReturnvaluesIF::RETURN_OK;
|
ReturnValue_t result = HasReturnvaluesIF::RETURN_OK;
|
||||||
// If any chips are unlocked, lock them here
|
// If any chips are unlocked, lock them here
|
||||||
result = coreController->setBootCopyProtection(xsc::Chip::ALL_CHIP, xsc::Copy::ALL_COPY, true,
|
result = coreController->setBootCopyProtection(
|
||||||
|
CoreController::Chip::ALL_CHIP, CoreController::Copy::ALL_COPY, true,
|
||||||
opPerformed, true);
|
opPerformed, true);
|
||||||
if(result != HasReturnvaluesIF::RETURN_OK) {
|
if(result != HasReturnvaluesIF::RETURN_OK) {
|
||||||
sif::warning << "Q7STestTask::testProtHandler: Op failed" << std::endl;
|
sif::warning << "Q7STestTask::testProtHandler: Op failed" << std::endl;
|
||||||
}
|
}
|
||||||
|
|
||||||
// unlock own copy
|
// unlock own copy
|
||||||
result = coreController->setBootCopyProtection(xsc::Chip::SELF_CHIP, xsc::Copy::SELF_COPY, false,
|
result = coreController->setBootCopyProtection(
|
||||||
|
CoreController::Chip::SELF_CHIP, CoreController::Copy::SELF_COPY, false,
|
||||||
opPerformed, true);
|
opPerformed, true);
|
||||||
if(result != HasReturnvaluesIF::RETURN_OK) {
|
if(result != HasReturnvaluesIF::RETURN_OK) {
|
||||||
sif::warning << "Q7STestTask::testProtHandler: Op failed" << std::endl;
|
sif::warning << "Q7STestTask::testProtHandler: Op failed" << std::endl;
|
||||||
@ -191,7 +169,8 @@ void Q7STestTask::testProtHandler() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// lock own copy
|
// lock own copy
|
||||||
result = coreController->setBootCopyProtection(xsc::Chip::SELF_CHIP, xsc::Copy::SELF_COPY, true,
|
result = coreController->setBootCopyProtection(
|
||||||
|
CoreController::Chip::SELF_CHIP, CoreController::Copy::SELF_COPY, true,
|
||||||
opPerformed, true);
|
opPerformed, true);
|
||||||
if(result != HasReturnvaluesIF::RETURN_OK) {
|
if(result != HasReturnvaluesIF::RETURN_OK) {
|
||||||
sif::warning << "Q7STestTask::testProtHandler: Op failed" << std::endl;
|
sif::warning << "Q7STestTask::testProtHandler: Op failed" << std::endl;
|
||||||
@ -205,7 +184,8 @@ void Q7STestTask::testProtHandler() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// unlock specific copy
|
// unlock specific copy
|
||||||
result = coreController->setBootCopyProtection(xsc::Chip::CHIP_1, xsc::Copy::COPY_1, false,
|
result = coreController->setBootCopyProtection(
|
||||||
|
CoreController::Chip::CHIP_1, CoreController::Copy::COPY_1, false,
|
||||||
opPerformed, true);
|
opPerformed, true);
|
||||||
if(result != HasReturnvaluesIF::RETURN_OK) {
|
if(result != HasReturnvaluesIF::RETURN_OK) {
|
||||||
sif::warning << "Q7STestTask::testProtHandler: Op failed" << std::endl;
|
sif::warning << "Q7STestTask::testProtHandler: Op failed" << std::endl;
|
||||||
@ -219,7 +199,8 @@ void Q7STestTask::testProtHandler() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// lock specific copy
|
// lock specific copy
|
||||||
result = coreController->setBootCopyProtection(xsc::Chip::CHIP_1, xsc::Copy::COPY_1, true,
|
result = coreController->setBootCopyProtection(
|
||||||
|
CoreController::Chip::CHIP_1, CoreController::Copy::COPY_1, true,
|
||||||
opPerformed, true);
|
opPerformed, true);
|
||||||
if(result != HasReturnvaluesIF::RETURN_OK) {
|
if(result != HasReturnvaluesIF::RETURN_OK) {
|
||||||
sif::warning << "Q7STestTask::testProtHandler: Op failed" << std::endl;
|
sif::warning << "Q7STestTask::testProtHandler: Op failed" << std::endl;
|
||||||
@ -233,28 +214,9 @@ void Q7STestTask::testProtHandler() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void Q7STestTask::testGpsDaemon() {
|
|
||||||
gpsmm gpsmm(GPSD_SHARED_MEMORY, 0);
|
|
||||||
gps_data_t* gps;
|
|
||||||
gps = gpsmm.read();
|
|
||||||
if (gps == nullptr) {
|
|
||||||
sif::warning << "Q7STestTask: Reading GPS data failed" << std::endl;
|
|
||||||
}
|
|
||||||
sif::info << "-- Q7STestTask: GPS shared memory read test --" << std::endl;
|
|
||||||
time_t timeRaw = gps->fix.time.tv_sec;
|
|
||||||
std::tm* time = gmtime(&timeRaw);
|
|
||||||
sif::info << "Time: " << std::put_time(time, "%c %Z") << std::endl;
|
|
||||||
sif::info << "Visible satellites: " << gps->satellites_visible << std::endl;
|
|
||||||
sif::info << "Satellites used: " << gps->satellites_used << std::endl;
|
|
||||||
sif::info << "Fix (0:Not Seen|1:No Fix|2:2D|3:3D): " << gps->fix.mode << std::endl;
|
|
||||||
sif::info << "Latitude: " << gps->fix.latitude << std::endl;
|
|
||||||
sif::info << "Longitude: " << gps->fix.longitude << std::endl;
|
|
||||||
sif::info << "Altitude(MSL): " << gps->fix.altMSL << std::endl;
|
|
||||||
sif::info << "Speed(m/s): " << gps->fix.speed << std::endl;
|
|
||||||
}
|
|
||||||
|
|
||||||
void Q7STestTask::testFileSystemHandlerDirect(FsOpCodes opCode) {
|
void Q7STestTask::testFileSystemHandlerDirect(FsOpCodes opCode) {
|
||||||
auto fsHandler = ObjectManager::instance()->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;
|
||||||
@ -265,7 +227,7 @@ void Q7STestTask::testFileSystemHandlerDirect(FsOpCodes opCode) {
|
|||||||
// Lambda for common code
|
// Lambda for common code
|
||||||
auto createNonEmptyTmpDir = [&]() {
|
auto createNonEmptyTmpDir = [&]() {
|
||||||
if(not std::filesystem::exists("/tmp/test")) {
|
if(not std::filesystem::exists("/tmp/test")) {
|
||||||
result = fsHandler->createDirectory("/tmp", "test", false, &cfg);
|
result = fsHandler->createDirectory("/tmp/test", &cfg);
|
||||||
if(result != HasReturnvaluesIF::RETURN_OK) {
|
if(result != HasReturnvaluesIF::RETURN_OK) {
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
@ -283,13 +245,14 @@ void Q7STestTask::testFileSystemHandlerDirect(FsOpCodes opCode) {
|
|||||||
return result;
|
return result;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
switch(opCode) {
|
switch(opCode) {
|
||||||
case(FsOpCodes::CREATE_EMPTY_FILE_IN_TMP): {
|
case(FsOpCodes::CREATE_EMPTY_FILE_IN_TMP): {
|
||||||
// No mount prefix, cause file is created in tmp
|
// No mount prefix, cause file is created in tmp
|
||||||
cfg.useMountPrefix = false;
|
cfg.useMountPrefix = false;
|
||||||
sif::info << "Creating empty file in /tmp folder" << std::endl;
|
sif::info << "Creating empty file in /tmp folder" << std::endl;
|
||||||
// Do not delete file, user can check existence in shell
|
// Do not delete file, user can check existence in shell
|
||||||
fsHandler->createFile("/tmp/", "test.txt", nullptr, 0, &cfg);
|
fsHandler->createFile("/tmp", "test.txt", nullptr, 0, &cfg);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case(FsOpCodes::REMOVE_TMP_FILE): {
|
case(FsOpCodes::REMOVE_TMP_FILE): {
|
||||||
@ -299,12 +262,13 @@ void Q7STestTask::testFileSystemHandlerDirect(FsOpCodes opCode) {
|
|||||||
if(not std::filesystem::exists("/tmp/test.txt")) {
|
if(not std::filesystem::exists("/tmp/test.txt")) {
|
||||||
// Creating sample file
|
// Creating sample file
|
||||||
sif::info << "Creating sample file /tmp/test.txt to delete" << std::endl;
|
sif::info << "Creating sample file /tmp/test.txt to delete" << std::endl;
|
||||||
fsHandler->createFile("/tmp/", "test.txt", nullptr, 0, &cfg);
|
fsHandler->createFile("/tmp", "test.txt", nullptr, 0, &cfg);
|
||||||
}
|
}
|
||||||
result = fsHandler->removeFile("/tmp", "test.txt", &cfg);
|
result = fsHandler->removeFile("/tmp", "test.txt", &cfg);
|
||||||
if(result == HasReturnvaluesIF::RETURN_OK) {
|
if(result == HasReturnvaluesIF::RETURN_OK) {
|
||||||
sif::info << "File removed successfully" << std::endl;
|
sif::info << "File removed successfully" << std::endl;
|
||||||
} else {
|
}
|
||||||
|
else {
|
||||||
sif::warning << "File removal failed!" << std::endl;
|
sif::warning << "File removal failed!" << std::endl;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
@ -314,10 +278,11 @@ void Q7STestTask::testFileSystemHandlerDirect(FsOpCodes opCode) {
|
|||||||
cfg.useMountPrefix = false;
|
cfg.useMountPrefix = false;
|
||||||
sif::info << "Creating empty file in /tmp folder" << std::endl;
|
sif::info << "Creating empty file in /tmp folder" << std::endl;
|
||||||
// Do not delete file, user can check existence in shell
|
// Do not delete file, user can check existence in shell
|
||||||
ReturnValue_t result = fsHandler->createDirectory("/tmp/", "test", false, &cfg);
|
ReturnValue_t result = fsHandler->createDirectory("/tmp/test", &cfg);
|
||||||
if(result == HasReturnvaluesIF::RETURN_OK) {
|
if(result == HasReturnvaluesIF::RETURN_OK) {
|
||||||
sif::info << "Directory created successfully" << std::endl;
|
sif::info << "Directory created successfully" << std::endl;
|
||||||
} else {
|
}
|
||||||
|
else {
|
||||||
sif::warning << "Directory creation failed!" << std::endl;
|
sif::warning << "Directory creation failed!" << std::endl;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
@ -326,15 +291,17 @@ void Q7STestTask::testFileSystemHandlerDirect(FsOpCodes opCode) {
|
|||||||
// No mount prefix, cause file is created in tmp
|
// No mount prefix, cause file is created in tmp
|
||||||
cfg.useMountPrefix = false;
|
cfg.useMountPrefix = false;
|
||||||
if(not std::filesystem::exists("/tmp/test")) {
|
if(not std::filesystem::exists("/tmp/test")) {
|
||||||
result = fsHandler->createDirectory("/tmp", "test", false, &cfg);
|
result = fsHandler->createDirectory("/tmp/test", &cfg);
|
||||||
} else {
|
}
|
||||||
|
else {
|
||||||
// Delete any leftover files to regular dir removal works
|
// Delete any leftover files to regular dir removal works
|
||||||
std::remove("/tmp/test/*");
|
std::remove("/tmp/test/*");
|
||||||
}
|
}
|
||||||
result = fsHandler->removeDirectory("/tmp/", "test", false, &cfg);
|
result = fsHandler->removeDirectory("/tmp/test", false, &cfg);
|
||||||
if(result == HasReturnvaluesIF::RETURN_OK) {
|
if(result == HasReturnvaluesIF::RETURN_OK) {
|
||||||
sif::info << "Directory removed successfully" << std::endl;
|
sif::info << "Directory removed successfully" << std::endl;
|
||||||
} else {
|
}
|
||||||
|
else {
|
||||||
sif::warning << "Directory removal failed!" << std::endl;
|
sif::warning << "Directory removal failed!" << std::endl;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
@ -344,10 +311,11 @@ void Q7STestTask::testFileSystemHandlerDirect(FsOpCodes opCode) {
|
|||||||
if(result != HasReturnvaluesIF::RETURN_OK) {
|
if(result != HasReturnvaluesIF::RETURN_OK) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
result = fsHandler->removeDirectory("/tmp/", "test", true, &cfg);
|
result = fsHandler->removeDirectory("/tmp/test", true, &cfg);
|
||||||
if(result == HasReturnvaluesIF::RETURN_OK) {
|
if(result == HasReturnvaluesIF::RETURN_OK) {
|
||||||
sif::info << "Directory removed recursively successfully" << std::endl;
|
sif::info << "Directory removed recursively successfully" << std::endl;
|
||||||
} else {
|
}
|
||||||
|
else {
|
||||||
sif::warning << "Recursive directory removal failed!" << std::endl;
|
sif::warning << "Recursive directory removal failed!" << std::endl;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
@ -357,41 +325,13 @@ void Q7STestTask::testFileSystemHandlerDirect(FsOpCodes opCode) {
|
|||||||
if(result != HasReturnvaluesIF::RETURN_OK) {
|
if(result != HasReturnvaluesIF::RETURN_OK) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
result = fsHandler->removeDirectory("/tmp/", "test", false, &cfg);
|
result = fsHandler->removeDirectory("/tmp/test", false, &cfg);
|
||||||
if(result != HasReturnvaluesIF::RETURN_OK) {
|
if(result != HasReturnvaluesIF::RETURN_OK) {
|
||||||
sif::info << "Directory removal attempt failed as expected" << std::endl;
|
sif::info << "Directory removal attempt failed as expected" << std::endl;
|
||||||
} else {
|
}
|
||||||
|
else {
|
||||||
sif::warning << "Directory removal worked when it should not have!" << std::endl;
|
sif::warning << "Directory removal worked when it should not have!" << std::endl;
|
||||||
}
|
}
|
||||||
break;
|
|
||||||
}
|
|
||||||
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);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -3,24 +3,14 @@
|
|||||||
|
|
||||||
#include "test/testtasks/TestTask.h"
|
#include "test/testtasks/TestTask.h"
|
||||||
|
|
||||||
class CoreController;
|
|
||||||
|
|
||||||
class Q7STestTask: public TestTask {
|
class Q7STestTask: public TestTask {
|
||||||
public:
|
public:
|
||||||
Q7STestTask(object_id_t objectId);
|
Q7STestTask(object_id_t objectId);
|
||||||
|
|
||||||
ReturnValue_t initialize() override;
|
ReturnValue_t initialize() override;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
bool doTestSdCard = false;
|
|
||||||
bool doTestScratchApi = false;
|
|
||||||
bool doTestGps = false;
|
|
||||||
|
|
||||||
CoreController* coreController = nullptr;
|
CoreController* coreController = nullptr;
|
||||||
ReturnValue_t performOneShotAction() override;
|
ReturnValue_t performOneShotAction() override;
|
||||||
ReturnValue_t performPeriodicAction() override;
|
|
||||||
|
|
||||||
void testGpsDaemon();
|
|
||||||
|
|
||||||
void testSdCard();
|
void testSdCard();
|
||||||
void fileTests();
|
void fileTests();
|
||||||
@ -37,10 +27,9 @@ class Q7STestTask : public TestTask {
|
|||||||
REMOVE_EMPTY_DIR_IN_TMP,
|
REMOVE_EMPTY_DIR_IN_TMP,
|
||||||
ATTEMPT_DIR_REMOVAL_NON_EMPTY,
|
ATTEMPT_DIR_REMOVAL_NON_EMPTY,
|
||||||
REMOVE_FILLED_DIR_IN_TMP,
|
REMOVE_FILLED_DIR_IN_TMP,
|
||||||
RENAME_FILE,
|
|
||||||
APPEND_TO_FILE,
|
|
||||||
};
|
};
|
||||||
void testFileSystemHandlerDirect(FsOpCodes opCode);
|
void testFileSystemHandlerDirect(FsOpCodes opCode);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
#endif /* BSP_Q7S_BOARDTEST_Q7STESTTASK_H_ */
|
#endif /* BSP_Q7S_BOARDTEST_Q7STESTTASK_H_ */
|
||||||
|
@ -1,6 +1,4 @@
|
|||||||
target_sources(${OBSW_NAME} PRIVATE
|
target_sources(${TARGET_NAME} PRIVATE
|
||||||
rwSpiCallback.cpp
|
rwSpiCallback.cpp
|
||||||
gnssCallback.cpp
|
gnssCallback.cpp
|
||||||
pcduSwitchCb.cpp
|
|
||||||
gpioCallbacks.cpp
|
|
||||||
)
|
)
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
#include "gnssCallback.h"
|
#include "gnssCallback.h"
|
||||||
|
|
||||||
#include "devices/gpioIds.h"
|
#include "devices/gpioIds.h"
|
||||||
|
|
||||||
#include "fsfw/tasks/TaskFactory.h"
|
#include "fsfw/tasks/TaskFactory.h"
|
||||||
|
|
||||||
ReturnValue_t gps::triggerGpioResetPin(void *args) {
|
ReturnValue_t gps::triggerGpioResetPin(void *args) {
|
||||||
@ -15,7 +15,8 @@ ReturnValue_t gps::triggerGpioResetPin(void* args) {
|
|||||||
if(resetArgs->gnss1) {
|
if(resetArgs->gnss1) {
|
||||||
gpioId = gpioIds::GNSS_1_NRESET;
|
gpioId = gpioIds::GNSS_1_NRESET;
|
||||||
|
|
||||||
} else {
|
}
|
||||||
|
else {
|
||||||
gpioId = gpioIds::GNSS_0_NRESET;
|
gpioId = gpioIds::GNSS_0_NRESET;
|
||||||
}
|
}
|
||||||
resetArgs->gpioComIF->pullLow(gpioId);
|
resetArgs->gpioComIF->pullLow(gpioId);
|
||||||
|
@ -1,8 +1,8 @@
|
|||||||
#ifndef BSP_Q7S_CALLBACKS_GNSSCALLBACK_H_
|
#ifndef BSP_Q7S_CALLBACKS_GNSSCALLBACK_H_
|
||||||
#define BSP_Q7S_CALLBACKS_GNSSCALLBACK_H_
|
#define BSP_Q7S_CALLBACKS_GNSSCALLBACK_H_
|
||||||
|
|
||||||
#include "fsfw/returnvalues/HasReturnvaluesIF.h"
|
|
||||||
#include "fsfw_hal/linux/gpio/LinuxLibgpioIF.h"
|
#include "fsfw_hal/linux/gpio/LinuxLibgpioIF.h"
|
||||||
|
#include "fsfw/returnvalues/HasReturnvaluesIF.h"
|
||||||
|
|
||||||
struct ResetArgs {
|
struct ResetArgs {
|
||||||
bool gnss1 = false;
|
bool gnss1 = false;
|
||||||
|
@ -1,487 +0,0 @@
|
|||||||
#include "gpioCallbacks.h"
|
|
||||||
|
|
||||||
#include <devices/gpioIds.h>
|
|
||||||
#include <fsfw/serviceinterface/ServiceInterface.h>
|
|
||||||
#include <fsfw_hal/common/gpio/GpioCookie.h>
|
|
||||||
#include <fsfw_hal/linux/gpio/LinuxLibgpioIF.h>
|
|
||||||
|
|
||||||
#include "busConf.h"
|
|
||||||
|
|
||||||
namespace gpioCallbacks {
|
|
||||||
|
|
||||||
GpioIF* gpioComInterface;
|
|
||||||
|
|
||||||
void initSpiCsDecoder(GpioIF* gpioComIF) {
|
|
||||||
using namespace gpio;
|
|
||||||
ReturnValue_t result;
|
|
||||||
|
|
||||||
if (gpioComIF == nullptr) {
|
|
||||||
sif::debug << "initSpiCsDecoder: Invalid gpioComIF" << std::endl;
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
gpioComInterface = gpioComIF;
|
|
||||||
|
|
||||||
GpioCookie* spiMuxGpios = new GpioCookie;
|
|
||||||
|
|
||||||
GpiodRegularByLineName* spiMuxBit = nullptr;
|
|
||||||
/** Setting mux bit 1 to low will disable IC21 on the interface board */
|
|
||||||
spiMuxBit = new GpiodRegularByLineName(q7s::gpioNames::SPI_MUX_BIT_0_PIN, "SPI Mux Bit 1",
|
|
||||||
Direction::OUT, Levels::HIGH);
|
|
||||||
spiMuxGpios->addGpio(gpioIds::SPI_MUX_BIT_0, spiMuxBit);
|
|
||||||
/** Setting mux bit 2 to low disables IC1 on the TCS board */
|
|
||||||
spiMuxBit = new GpiodRegularByLineName(q7s::gpioNames::SPI_MUX_BIT_1_PIN, "SPI Mux Bit 2",
|
|
||||||
Direction::OUT, Levels::HIGH);
|
|
||||||
spiMuxGpios->addGpio(gpioIds::SPI_MUX_BIT_1, spiMuxBit);
|
|
||||||
/** Setting mux bit 3 to low disables IC2 on the TCS board and IC22 on the interface board */
|
|
||||||
spiMuxBit = new GpiodRegularByLineName(q7s::gpioNames::SPI_MUX_BIT_2_PIN, "SPI Mux Bit 3",
|
|
||||||
Direction::OUT, Levels::LOW);
|
|
||||||
spiMuxGpios->addGpio(gpioIds::SPI_MUX_BIT_2, spiMuxBit);
|
|
||||||
|
|
||||||
/** The following gpios can take arbitrary initial values */
|
|
||||||
spiMuxBit = new GpiodRegularByLineName(q7s::gpioNames::SPI_MUX_BIT_3_PIN, "SPI Mux Bit 4",
|
|
||||||
Direction::OUT, Levels::LOW);
|
|
||||||
spiMuxGpios->addGpio(gpioIds::SPI_MUX_BIT_3, spiMuxBit);
|
|
||||||
spiMuxBit = new GpiodRegularByLineName(q7s::gpioNames::SPI_MUX_BIT_4_PIN, "SPI Mux Bit 5",
|
|
||||||
Direction::OUT, Levels::LOW);
|
|
||||||
spiMuxGpios->addGpio(gpioIds::SPI_MUX_BIT_4, spiMuxBit);
|
|
||||||
spiMuxBit = new GpiodRegularByLineName(q7s::gpioNames::SPI_MUX_BIT_5_PIN, "SPI Mux Bit 6",
|
|
||||||
Direction::OUT, Levels::LOW);
|
|
||||||
spiMuxGpios->addGpio(gpioIds::SPI_MUX_BIT_5, spiMuxBit);
|
|
||||||
GpiodRegularByLineName* enRwDecoder = new GpiodRegularByLineName(
|
|
||||||
q7s::gpioNames::EN_RW_CS, "EN_RW_CS", Direction::OUT, Levels::HIGH);
|
|
||||||
spiMuxGpios->addGpio(gpioIds::EN_RW_CS, enRwDecoder);
|
|
||||||
|
|
||||||
result = gpioComInterface->addGpios(spiMuxGpios);
|
|
||||||
if (result != HasReturnvaluesIF::RETURN_OK) {
|
|
||||||
sif::error << "initSpiCsDecoder: Failed to add mux bit gpios to gpioComIF" << std::endl;
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
void spiCsDecoderCallback(gpioId_t gpioId, gpio::GpioOperation gpioOp, gpio::Levels value,
|
|
||||||
void* args) {
|
|
||||||
using namespace gpio;
|
|
||||||
if (gpioComInterface == nullptr) {
|
|
||||||
sif::debug << "spiCsDecoderCallback: No gpioComIF specified. Call initSpiCsDecoder "
|
|
||||||
<< "to specify gpioComIF" << std::endl;
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Reading is not supported by the callback function */
|
|
||||||
if (gpioOp == gpio::GpioOperation::READ) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (value == Levels::HIGH) {
|
|
||||||
switch (gpioId) {
|
|
||||||
case (gpioIds::RTD_IC_3): {
|
|
||||||
disableDecoderTcsIc1();
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
case (gpioIds::RTD_IC_4): {
|
|
||||||
disableDecoderTcsIc1();
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
case (gpioIds::RTD_IC_5): {
|
|
||||||
disableDecoderTcsIc1();
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
case (gpioIds::RTD_IC_6): {
|
|
||||||
disableDecoderTcsIc1();
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
case (gpioIds::RTD_IC_7): {
|
|
||||||
disableDecoderTcsIc1();
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
case (gpioIds::RTD_IC_8): {
|
|
||||||
disableDecoderTcsIc1();
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
case (gpioIds::RTD_IC_9): {
|
|
||||||
disableDecoderTcsIc1();
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
case (gpioIds::RTD_IC_10): {
|
|
||||||
disableDecoderTcsIc1();
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
case (gpioIds::RTD_IC_11): {
|
|
||||||
disableDecoderTcsIc2();
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
case (gpioIds::RTD_IC_12): {
|
|
||||||
disableDecoderTcsIc2();
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
case (gpioIds::RTD_IC_13): {
|
|
||||||
disableDecoderTcsIc2();
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
case (gpioIds::RTD_IC_14): {
|
|
||||||
disableDecoderTcsIc2();
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
case (gpioIds::RTD_IC_15): {
|
|
||||||
disableDecoderTcsIc2();
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
case (gpioIds::RTD_IC_16): {
|
|
||||||
disableDecoderTcsIc2();
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
case (gpioIds::RTD_IC_17): {
|
|
||||||
disableDecoderTcsIc2();
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
case (gpioIds::RTD_IC_18): {
|
|
||||||
disableDecoderTcsIc2();
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
case (gpioIds::CS_SUS_0): {
|
|
||||||
disableDecoderInterfaceBoardIc1();
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
case (gpioIds::CS_SUS_1): {
|
|
||||||
disableDecoderInterfaceBoardIc1();
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
case (gpioIds::CS_SUS_2): {
|
|
||||||
disableDecoderInterfaceBoardIc1();
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
case (gpioIds::CS_SUS_3): {
|
|
||||||
disableDecoderInterfaceBoardIc1();
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
case (gpioIds::CS_SUS_4): {
|
|
||||||
disableDecoderInterfaceBoardIc1();
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
case (gpioIds::CS_SUS_5): {
|
|
||||||
disableDecoderInterfaceBoardIc1();
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
case (gpioIds::CS_SUS_6): {
|
|
||||||
disableDecoderInterfaceBoardIc2();
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
case (gpioIds::CS_SUS_7): {
|
|
||||||
disableDecoderInterfaceBoardIc2();
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
case (gpioIds::CS_SUS_8): {
|
|
||||||
disableDecoderInterfaceBoardIc2();
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
case (gpioIds::CS_SUS_9): {
|
|
||||||
disableDecoderInterfaceBoardIc2();
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
case (gpioIds::CS_SUS_10): {
|
|
||||||
disableDecoderInterfaceBoardIc2();
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
case (gpioIds::CS_SUS_11): {
|
|
||||||
disableDecoderInterfaceBoardIc2();
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
case (gpioIds::CS_RW1): {
|
|
||||||
disableRwDecoder();
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
case (gpioIds::CS_RW2): {
|
|
||||||
disableRwDecoder();
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
case (gpioIds::CS_RW3): {
|
|
||||||
disableRwDecoder();
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
case (gpioIds::CS_RW4): {
|
|
||||||
disableRwDecoder();
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
default:
|
|
||||||
sif::debug << "spiCsDecoderCallback: Invalid gpio id " << gpioId << std::endl;
|
|
||||||
}
|
|
||||||
} else if (value == Levels::LOW) {
|
|
||||||
switch (gpioId) {
|
|
||||||
case (gpioIds::RTD_IC_3): {
|
|
||||||
selectY7();
|
|
||||||
enableDecoderTcsIc1();
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
case (gpioIds::RTD_IC_4): {
|
|
||||||
selectY6();
|
|
||||||
enableDecoderTcsIc1();
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
case (gpioIds::RTD_IC_5): {
|
|
||||||
selectY5();
|
|
||||||
enableDecoderTcsIc1();
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
case (gpioIds::RTD_IC_6): {
|
|
||||||
selectY4();
|
|
||||||
enableDecoderTcsIc1();
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
case (gpioIds::RTD_IC_7): {
|
|
||||||
selectY3();
|
|
||||||
enableDecoderTcsIc1();
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
case (gpioIds::RTD_IC_8): {
|
|
||||||
selectY2();
|
|
||||||
enableDecoderTcsIc1();
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
case (gpioIds::RTD_IC_9): {
|
|
||||||
selectY1();
|
|
||||||
enableDecoderTcsIc1();
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
case (gpioIds::RTD_IC_10): {
|
|
||||||
selectY0();
|
|
||||||
enableDecoderTcsIc1();
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
case (gpioIds::RTD_IC_11): {
|
|
||||||
selectY7();
|
|
||||||
enableDecoderTcsIc2();
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
case (gpioIds::RTD_IC_12): {
|
|
||||||
selectY6();
|
|
||||||
enableDecoderTcsIc2();
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
case (gpioIds::RTD_IC_13): {
|
|
||||||
selectY5();
|
|
||||||
enableDecoderTcsIc2();
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
case (gpioIds::RTD_IC_14): {
|
|
||||||
selectY4();
|
|
||||||
enableDecoderTcsIc2();
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
case (gpioIds::RTD_IC_15): {
|
|
||||||
selectY3();
|
|
||||||
enableDecoderTcsIc2();
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
case (gpioIds::RTD_IC_16): {
|
|
||||||
selectY2();
|
|
||||||
enableDecoderTcsIc2();
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
case (gpioIds::RTD_IC_17): {
|
|
||||||
selectY1();
|
|
||||||
enableDecoderTcsIc2();
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
case (gpioIds::RTD_IC_18): {
|
|
||||||
selectY0();
|
|
||||||
enableDecoderTcsIc2();
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
case (gpioIds::CS_SUS_0): {
|
|
||||||
selectY0();
|
|
||||||
enableDecoderInterfaceBoardIc1();
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
case (gpioIds::CS_SUS_1): {
|
|
||||||
selectY1();
|
|
||||||
enableDecoderInterfaceBoardIc1();
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
case (gpioIds::CS_SUS_2): {
|
|
||||||
selectY2();
|
|
||||||
enableDecoderInterfaceBoardIc1();
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
case (gpioIds::CS_SUS_3): {
|
|
||||||
selectY3();
|
|
||||||
enableDecoderInterfaceBoardIc1();
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
case (gpioIds::CS_SUS_4): {
|
|
||||||
selectY4();
|
|
||||||
enableDecoderInterfaceBoardIc1();
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
case (gpioIds::CS_SUS_5): {
|
|
||||||
selectY5();
|
|
||||||
enableDecoderInterfaceBoardIc1();
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
case (gpioIds::CS_SUS_6): {
|
|
||||||
selectY0();
|
|
||||||
enableDecoderInterfaceBoardIc2();
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
case (gpioIds::CS_SUS_7): {
|
|
||||||
selectY1();
|
|
||||||
enableDecoderInterfaceBoardIc2();
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
case (gpioIds::CS_SUS_8): {
|
|
||||||
selectY2();
|
|
||||||
enableDecoderInterfaceBoardIc2();
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
case (gpioIds::CS_SUS_9): {
|
|
||||||
selectY3();
|
|
||||||
enableDecoderInterfaceBoardIc2();
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
case (gpioIds::CS_SUS_10): {
|
|
||||||
selectY4();
|
|
||||||
enableDecoderInterfaceBoardIc2();
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
case (gpioIds::CS_SUS_11): {
|
|
||||||
selectY5();
|
|
||||||
enableDecoderInterfaceBoardIc2();
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
case (gpioIds::CS_RW1): {
|
|
||||||
selectY0();
|
|
||||||
enableRwDecoder();
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
case (gpioIds::CS_RW2): {
|
|
||||||
selectY1();
|
|
||||||
enableRwDecoder();
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
case (gpioIds::CS_RW3): {
|
|
||||||
selectY2();
|
|
||||||
enableRwDecoder();
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
case (gpioIds::CS_RW4): {
|
|
||||||
selectY3();
|
|
||||||
enableRwDecoder();
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
default:
|
|
||||||
sif::debug << "spiCsDecoderCallback: Invalid gpio id " << gpioId << std::endl;
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
sif::debug << "spiCsDecoderCallback: Invalid value. Must be 0 or 1" << std::endl;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
void enableDecoderTcsIc1() {
|
|
||||||
gpioComInterface->pullLow(gpioIds::SPI_MUX_BIT_0);
|
|
||||||
gpioComInterface->pullHigh(gpioIds::SPI_MUX_BIT_1);
|
|
||||||
gpioComInterface->pullLow(gpioIds::SPI_MUX_BIT_2);
|
|
||||||
}
|
|
||||||
|
|
||||||
void enableDecoderTcsIc2() {
|
|
||||||
gpioComInterface->pullHigh(gpioIds::SPI_MUX_BIT_2);
|
|
||||||
gpioComInterface->pullLow(gpioIds::SPI_MUX_BIT_0);
|
|
||||||
gpioComInterface->pullHigh(gpioIds::SPI_MUX_BIT_1);
|
|
||||||
}
|
|
||||||
|
|
||||||
void enableDecoderInterfaceBoardIc1() {
|
|
||||||
gpioComInterface->pullHigh(gpioIds::SPI_MUX_BIT_0);
|
|
||||||
gpioComInterface->pullLow(gpioIds::SPI_MUX_BIT_1);
|
|
||||||
gpioComInterface->pullLow(gpioIds::SPI_MUX_BIT_2);
|
|
||||||
}
|
|
||||||
|
|
||||||
void enableDecoderInterfaceBoardIc2() {
|
|
||||||
gpioComInterface->pullHigh(gpioIds::SPI_MUX_BIT_0);
|
|
||||||
gpioComInterface->pullLow(gpioIds::SPI_MUX_BIT_1);
|
|
||||||
gpioComInterface->pullHigh(gpioIds::SPI_MUX_BIT_2);
|
|
||||||
}
|
|
||||||
|
|
||||||
void disableDecoderTcsIc1() {
|
|
||||||
gpioComInterface->pullHigh(gpioIds::SPI_MUX_BIT_0);
|
|
||||||
gpioComInterface->pullHigh(gpioIds::SPI_MUX_BIT_1);
|
|
||||||
gpioComInterface->pullLow(gpioIds::SPI_MUX_BIT_2);
|
|
||||||
}
|
|
||||||
|
|
||||||
void disableDecoderTcsIc2() {
|
|
||||||
// DO NOT CHANGE THE ORDER HERE
|
|
||||||
gpioComInterface->pullHigh(gpioIds::SPI_MUX_BIT_0);
|
|
||||||
gpioComInterface->pullLow(gpioIds::SPI_MUX_BIT_2);
|
|
||||||
gpioComInterface->pullHigh(gpioIds::SPI_MUX_BIT_1);
|
|
||||||
}
|
|
||||||
|
|
||||||
void disableDecoderInterfaceBoardIc1() {
|
|
||||||
gpioComInterface->pullHigh(gpioIds::SPI_MUX_BIT_0);
|
|
||||||
gpioComInterface->pullHigh(gpioIds::SPI_MUX_BIT_1);
|
|
||||||
gpioComInterface->pullLow(gpioIds::SPI_MUX_BIT_2);
|
|
||||||
}
|
|
||||||
|
|
||||||
void disableDecoderInterfaceBoardIc2() {
|
|
||||||
gpioComInterface->pullHigh(gpioIds::SPI_MUX_BIT_0);
|
|
||||||
gpioComInterface->pullHigh(gpioIds::SPI_MUX_BIT_1);
|
|
||||||
gpioComInterface->pullLow(gpioIds::SPI_MUX_BIT_2);
|
|
||||||
}
|
|
||||||
|
|
||||||
void enableRwDecoder() { gpioComInterface->pullHigh(gpioIds::EN_RW_CS); }
|
|
||||||
|
|
||||||
void disableRwDecoder() { gpioComInterface->pullLow(gpioIds::EN_RW_CS); }
|
|
||||||
|
|
||||||
void selectY0() {
|
|
||||||
gpioComInterface->pullLow(gpioIds::SPI_MUX_BIT_3);
|
|
||||||
gpioComInterface->pullLow(gpioIds::SPI_MUX_BIT_4);
|
|
||||||
gpioComInterface->pullLow(gpioIds::SPI_MUX_BIT_5);
|
|
||||||
}
|
|
||||||
|
|
||||||
void selectY1() {
|
|
||||||
gpioComInterface->pullHigh(gpioIds::SPI_MUX_BIT_3);
|
|
||||||
gpioComInterface->pullLow(gpioIds::SPI_MUX_BIT_4);
|
|
||||||
gpioComInterface->pullLow(gpioIds::SPI_MUX_BIT_5);
|
|
||||||
}
|
|
||||||
|
|
||||||
void selectY2() {
|
|
||||||
gpioComInterface->pullLow(gpioIds::SPI_MUX_BIT_3);
|
|
||||||
gpioComInterface->pullHigh(gpioIds::SPI_MUX_BIT_4);
|
|
||||||
gpioComInterface->pullLow(gpioIds::SPI_MUX_BIT_5);
|
|
||||||
}
|
|
||||||
|
|
||||||
void selectY3() {
|
|
||||||
gpioComInterface->pullHigh(gpioIds::SPI_MUX_BIT_3);
|
|
||||||
gpioComInterface->pullHigh(gpioIds::SPI_MUX_BIT_4);
|
|
||||||
gpioComInterface->pullLow(gpioIds::SPI_MUX_BIT_5);
|
|
||||||
}
|
|
||||||
|
|
||||||
void selectY4() {
|
|
||||||
gpioComInterface->pullLow(gpioIds::SPI_MUX_BIT_3);
|
|
||||||
gpioComInterface->pullLow(gpioIds::SPI_MUX_BIT_4);
|
|
||||||
gpioComInterface->pullHigh(gpioIds::SPI_MUX_BIT_5);
|
|
||||||
}
|
|
||||||
|
|
||||||
void selectY5() {
|
|
||||||
gpioComInterface->pullHigh(gpioIds::SPI_MUX_BIT_3);
|
|
||||||
gpioComInterface->pullLow(gpioIds::SPI_MUX_BIT_4);
|
|
||||||
gpioComInterface->pullHigh(gpioIds::SPI_MUX_BIT_5);
|
|
||||||
}
|
|
||||||
|
|
||||||
void selectY6() {
|
|
||||||
gpioComInterface->pullLow(gpioIds::SPI_MUX_BIT_3);
|
|
||||||
gpioComInterface->pullHigh(gpioIds::SPI_MUX_BIT_4);
|
|
||||||
gpioComInterface->pullHigh(gpioIds::SPI_MUX_BIT_5);
|
|
||||||
}
|
|
||||||
|
|
||||||
void selectY7() {
|
|
||||||
gpioComInterface->pullHigh(gpioIds::SPI_MUX_BIT_3);
|
|
||||||
gpioComInterface->pullHigh(gpioIds::SPI_MUX_BIT_4);
|
|
||||||
gpioComInterface->pullHigh(gpioIds::SPI_MUX_BIT_5);
|
|
||||||
}
|
|
||||||
|
|
||||||
void disableAllDecoder() {
|
|
||||||
gpioComInterface->pullLow(gpioIds::SPI_MUX_BIT_2);
|
|
||||||
gpioComInterface->pullLow(gpioIds::SPI_MUX_BIT_0);
|
|
||||||
gpioComInterface->pullLow(gpioIds::SPI_MUX_BIT_1);
|
|
||||||
gpioComInterface->pullLow(gpioIds::EN_RW_CS);
|
|
||||||
}
|
|
||||||
|
|
||||||
} // namespace gpioCallbacks
|
|
@ -1,73 +0,0 @@
|
|||||||
#ifndef LINUX_GPIO_GPIOCALLBACKS_H_
|
|
||||||
#define LINUX_GPIO_GPIOCALLBACKS_H_
|
|
||||||
|
|
||||||
#include <fsfw_hal/common/gpio/GpioIF.h>
|
|
||||||
#include <fsfw_hal/common/gpio/gpioDefinitions.h>
|
|
||||||
|
|
||||||
namespace gpioCallbacks {
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @brief This function initializes the GPIOs used to control the SN74LVC138APWR decoders on
|
|
||||||
* the TCS Board and the interface board.
|
|
||||||
*/
|
|
||||||
void initSpiCsDecoder(GpioIF* gpioComIF);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @brief This function implements the decoding to multiply gpios by using the decoder
|
|
||||||
* chips SN74LVC138APWR on the TCS board and the interface board.
|
|
||||||
*/
|
|
||||||
void spiCsDecoderCallback(gpioId_t gpioId, gpio::GpioOperation gpioOp, gpio::Levels value,
|
|
||||||
void* args);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @brief This function sets mux bits 1-3 to a state which will only enable the decoder
|
|
||||||
* on the TCS board which is named to IC1 in the schematic.
|
|
||||||
*/
|
|
||||||
void enableDecoderTcsIc1();
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @brief This function sets mux bits 1-3 to a state which will only enable the decoder
|
|
||||||
* on the TCS board which is named to IC2 in the schematic.
|
|
||||||
*/
|
|
||||||
void enableDecoderTcsIc2();
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @brief This function sets mux bits 1-3 to a state which will only enable the decoder
|
|
||||||
* on the inteface board board which is named to IC21 in the schematic.
|
|
||||||
*/
|
|
||||||
void enableDecoderInterfaceBoardIc1();
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @brief This function sets mux bits 1-3 to a state which will only enable the decoder
|
|
||||||
* on the inteface board board which is named to IC22 in the schematic.
|
|
||||||
*/
|
|
||||||
void enableDecoderInterfaceBoardIc2();
|
|
||||||
|
|
||||||
void disableDecoderTcsIc1();
|
|
||||||
void disableDecoderTcsIc2();
|
|
||||||
void disableDecoderInterfaceBoardIc1();
|
|
||||||
void disableDecoderInterfaceBoardIc2();
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @brief Enables the reaction wheel chip select decoder (IC3).
|
|
||||||
*/
|
|
||||||
void enableRwDecoder();
|
|
||||||
void disableRwDecoder();
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @brief This function disables all decoder.
|
|
||||||
*/
|
|
||||||
void disableAllDecoder();
|
|
||||||
|
|
||||||
/** The following functions enable the appropriate channel of the currently enabled decoder */
|
|
||||||
void selectY0();
|
|
||||||
void selectY1();
|
|
||||||
void selectY2();
|
|
||||||
void selectY3();
|
|
||||||
void selectY4();
|
|
||||||
void selectY5();
|
|
||||||
void selectY6();
|
|
||||||
void selectY7();
|
|
||||||
} // namespace gpioCallbacks
|
|
||||||
|
|
||||||
#endif /* LINUX_GPIO_GPIOCALLBACKS_H_ */
|
|
@ -1,32 +0,0 @@
|
|||||||
#include "pcduSwitchCb.h"
|
|
||||||
|
|
||||||
#include <fsfw_hal/linux/gpio/LinuxLibgpioIF.h>
|
|
||||||
|
|
||||||
#include "devices/gpioIds.h"
|
|
||||||
|
|
||||||
void pcdu::switchCallback(GOMSPACE::Pdu pdu, uint8_t channel, bool state, void* args) {
|
|
||||||
LinuxLibgpioIF* gpioComIF = reinterpret_cast<LinuxLibgpioIF*>(args);
|
|
||||||
if (gpioComIF == nullptr) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
if (pdu == GOMSPACE::Pdu::PDU1) {
|
|
||||||
PDU1::SwitchChannels typedChannel = static_cast<PDU1::SwitchChannels>(channel);
|
|
||||||
if (typedChannel == PDU1::SwitchChannels::ACS_A_SIDE) {
|
|
||||||
if (state) {
|
|
||||||
gpioComIF->pullHigh(gpioIds::GNSS_0_NRESET);
|
|
||||||
} else {
|
|
||||||
gpioComIF->pullLow(gpioIds::GNSS_0_NRESET);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
} else if (pdu == GOMSPACE::Pdu::PDU2) {
|
|
||||||
PDU2::SwitchChannels typedChannel = static_cast<PDU2::SwitchChannels>(channel);
|
|
||||||
if (typedChannel == PDU2::SwitchChannels::ACS_B_SIDE) {
|
|
||||||
if (state) {
|
|
||||||
gpioComIF->pullHigh(gpioIds::GNSS_1_NRESET);
|
|
||||||
} else {
|
|
||||||
gpioComIF->pullLow(gpioIds::GNSS_1_NRESET);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,14 +0,0 @@
|
|||||||
#ifndef BSP_Q7S_CALLBACKS_PCDUSWITCHCB_H_
|
|
||||||
#define BSP_Q7S_CALLBACKS_PCDUSWITCHCB_H_
|
|
||||||
|
|
||||||
#include <cstdint>
|
|
||||||
|
|
||||||
#include "mission/devices/devicedefinitions/GomspaceDefinitions.h"
|
|
||||||
|
|
||||||
namespace pcdu {
|
|
||||||
|
|
||||||
void switchCallback(GOMSPACE::Pdu pdu, uint8_t channel, bool state, void* args);
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
#endif /* BSP_Q7S_CALLBACKS_PCDUSWITCHCB_H_ */
|
|
@ -1,36 +1,28 @@
|
|||||||
#include "rwSpiCallback.h"
|
#include "rwSpiCallback.h"
|
||||||
|
|
||||||
#include "devices/gpioIds.h"
|
#include "devices/gpioIds.h"
|
||||||
#include "fsfw/serviceinterface/ServiceInterface.h"
|
|
||||||
#include "fsfw_hal/linux/UnixFileGuard.h"
|
|
||||||
#include "fsfw_hal/linux/spi/SpiCookie.h"
|
|
||||||
#include "mission/devices/RwHandler.h"
|
#include "mission/devices/RwHandler.h"
|
||||||
|
|
||||||
|
#include "fsfw_hal/linux/spi/SpiCookie.h"
|
||||||
|
#include "fsfw_hal/linux/UnixFileGuard.h"
|
||||||
|
#include "fsfw/serviceinterface/ServiceInterface.h"
|
||||||
|
|
||||||
namespace rwSpiCallback {
|
namespace rwSpiCallback {
|
||||||
|
|
||||||
ReturnValue_t spiCallback(SpiComIF* comIf, SpiCookie *cookie, const uint8_t *sendData,
|
ReturnValue_t spiCallback(SpiComIF* comIf, SpiCookie *cookie, const uint8_t *sendData,
|
||||||
size_t sendLen, void* args) {
|
size_t sendLen, void* args) {
|
||||||
|
|
||||||
ReturnValue_t result = HasReturnvaluesIF::RETURN_OK;
|
ReturnValue_t result = HasReturnvaluesIF::RETURN_OK;
|
||||||
|
|
||||||
RwHandler* handler = reinterpret_cast<RwHandler*>(args);
|
RwHandler* handler = reinterpret_cast<RwHandler*>(args);
|
||||||
if(handler == nullptr) {
|
if(handler == nullptr) {
|
||||||
sif::error << "rwSpiCallback::spiCallback: Pointer to handler is invalid" << std::endl;
|
sif::error << "rwSpiCallback::spiCallback: Pointer to handler is invalid"
|
||||||
|
<< std::endl;
|
||||||
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();
|
|
||||||
GpioIF* gpioIF = comIf->getGpioInterface();
|
|
||||||
MutexIF::TimeoutType timeoutType = MutexIF::TimeoutType::WAITING;
|
|
||||||
uint32_t timeoutMs = 0;
|
|
||||||
MutexIF* mutex = comIf->getMutex(&timeoutType, &timeoutMs);
|
|
||||||
if (mutex == nullptr or gpioIF == nullptr) {
|
|
||||||
sif::debug << "rwSpiCallback::spiCallback: Mutex or GPIO interface invalid" << std::endl;
|
|
||||||
return HasReturnvaluesIF::RETURN_FAILED;
|
|
||||||
}
|
|
||||||
|
|
||||||
int fileDescriptor = 0;
|
int fileDescriptor = 0;
|
||||||
std::string device = cookie->getSpiDevice();
|
std::string device = cookie->getSpiDevice();
|
||||||
UnixFileGuard fileHelper(device, &fileDescriptor, O_RDWR, "rwSpiCallback::spiCallback");
|
UnixFileGuard fileHelper(device, &fileDescriptor, O_RDWR, "rwSpiCallback::spiCallback");
|
||||||
@ -43,12 +35,27 @@ ReturnValue_t spiCallback(SpiComIF* comIf, SpiCookie* cookie, const uint8_t* sen
|
|||||||
cookie->getSpiParameters(spiMode, spiSpeed, nullptr);
|
cookie->getSpiParameters(spiMode, spiSpeed, nullptr);
|
||||||
comIf->setSpiSpeedAndMode(fileDescriptor, spiMode, spiSpeed);
|
comIf->setSpiSpeedAndMode(fileDescriptor, spiMode, spiSpeed);
|
||||||
|
|
||||||
|
gpioId_t gpioId = cookie->getChipSelectPin();
|
||||||
|
GpioIF* gpioIF = comIf->getGpioInterface();
|
||||||
|
MutexIF::TimeoutType timeoutType = MutexIF::TimeoutType::WAITING;
|
||||||
|
uint32_t timeoutMs = 0;
|
||||||
|
MutexIF* mutex = comIf->getMutex(&timeoutType, &timeoutMs);
|
||||||
|
if(mutex == nullptr or gpioIF == nullptr) {
|
||||||
|
sif::debug << "rwSpiCallback::spiCallback: Mutex or GPIO interface invalid" << std::endl;
|
||||||
|
return HasReturnvaluesIF::RETURN_FAILED;
|
||||||
|
}
|
||||||
|
|
||||||
result = mutex->lockMutex(timeoutType, timeoutMs);
|
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;
|
sif::debug << "rwSpiCallback::spiCallback: Failed to lock mutex" << std::endl;
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/** Disconnect PS SPI peripheral and select AXI SPI core */
|
||||||
|
if(gpioIF->pullHigh(gpioIds::SPI_MUX) != HasReturnvaluesIF::RETURN_OK) {
|
||||||
|
sif::error << "rwSpiCallback::spiCallback: Failed to pull spi mux gpio high" << std::endl;
|
||||||
|
}
|
||||||
|
|
||||||
/** Sending frame start sign */
|
/** Sending frame start sign */
|
||||||
writeBuffer[0] = 0x7E;
|
writeBuffer[0] = 0x7E;
|
||||||
writeSize = 1;
|
writeSize = 1;
|
||||||
@ -112,7 +119,7 @@ ReturnValue_t spiCallback(SpiComIF* comIf, SpiCookie* cookie, const uint8_t* sen
|
|||||||
|
|
||||||
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 20 ms after sending the command */
|
||||||
usleep(RwDefinitions::SPI_REPLY_DELAY);
|
usleep(RwDefinitions::SPI_REPLY_DELAY);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -126,15 +133,8 @@ ReturnValue_t spiCallback(SpiComIF* comIf, SpiCookie* cookie, const uint8_t* sen
|
|||||||
closeSpi(gpioId, gpioIF, mutex);
|
closeSpi(gpioId, gpioIF, mutex);
|
||||||
return RwHandler::SPI_READ_FAILURE;
|
return RwHandler::SPI_READ_FAILURE;
|
||||||
}
|
}
|
||||||
if (idx == 0) {
|
|
||||||
if (byteRead != FLAG_BYTE) {
|
|
||||||
sif::error << "Invalid data, expected start marker" << std::endl;
|
|
||||||
closeSpi(gpioId, gpioIF, mutex);
|
|
||||||
return RwHandler::NO_START_MARKER;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (byteRead != FLAG_BYTE) {
|
if (byteRead != 0x7E) {
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -145,12 +145,9 @@ ReturnValue_t spiCallback(SpiComIF* comIf, SpiCookie* cookie, const uint8_t* sen
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#if FSFW_HAL_SPI_WIRETAPPING == 1
|
|
||||||
sif::info << "RW start marker detected" << std::endl;
|
|
||||||
#endif
|
|
||||||
|
|
||||||
size_t decodedFrameLen = 0;
|
size_t decodedFrameLen = 0;
|
||||||
while(decodedFrameLen < replyBufferSize) {
|
while(decodedFrameLen < replyBufferSize) {
|
||||||
|
|
||||||
/** First byte already read in */
|
/** First byte already read in */
|
||||||
if (decodedFrameLen != 0) {
|
if (decodedFrameLen != 0) {
|
||||||
byteRead = 0;
|
byteRead = 0;
|
||||||
@ -161,10 +158,11 @@ ReturnValue_t spiCallback(SpiComIF* comIf, SpiCookie* cookie, const uint8_t* sen
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (byteRead == FLAG_BYTE) {
|
if (byteRead == 0x7E) {
|
||||||
/** Reached end of frame */
|
/** Reached end of frame */
|
||||||
break;
|
break;
|
||||||
} else if (byteRead == 0x7D) {
|
}
|
||||||
|
else if (byteRead == 0x7D) {
|
||||||
if(read(fileDescriptor, &byteRead, 1) != 1) {
|
if(read(fileDescriptor, &byteRead, 1) != 1) {
|
||||||
sif::error << "rwSpiCallback::spiCallback: Read failed" << std::endl;
|
sif::error << "rwSpiCallback::spiCallback: Read failed" << std::endl;
|
||||||
result = RwHandler::SPI_READ_FAILURE;
|
result = RwHandler::SPI_READ_FAILURE;
|
||||||
@ -174,17 +172,20 @@ ReturnValue_t spiCallback(SpiComIF* comIf, SpiCookie* cookie, const uint8_t* sen
|
|||||||
*(rxBuf + decodedFrameLen) = 0x7E;
|
*(rxBuf + decodedFrameLen) = 0x7E;
|
||||||
decodedFrameLen++;
|
decodedFrameLen++;
|
||||||
continue;
|
continue;
|
||||||
} else if (byteRead == 0x5D) {
|
}
|
||||||
|
else if (byteRead == 0x5D) {
|
||||||
*(rxBuf + decodedFrameLen) = 0x7D;
|
*(rxBuf + decodedFrameLen) = 0x7D;
|
||||||
decodedFrameLen++;
|
decodedFrameLen++;
|
||||||
continue;
|
continue;
|
||||||
} else {
|
}
|
||||||
|
else {
|
||||||
sif::error << "rwSpiCallback::spiCallback: Invalid substitute" << std::endl;
|
sif::error << "rwSpiCallback::spiCallback: Invalid substitute" << std::endl;
|
||||||
closeSpi(gpioId, gpioIF, mutex);
|
closeSpi(gpioId, gpioIF, mutex);
|
||||||
result = RwHandler::INVALID_SUBSTITUTE;
|
result = RwHandler::INVALID_SUBSTITUTE;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
} else {
|
}
|
||||||
|
else {
|
||||||
*(rxBuf + decodedFrameLen) = byteRead;
|
*(rxBuf + decodedFrameLen) = byteRead;
|
||||||
decodedFrameLen++;
|
decodedFrameLen++;
|
||||||
continue;
|
continue;
|
||||||
@ -225,8 +226,12 @@ void closeSpi(gpioId_t gpioId, GpioIF* gpioIF, MutexIF* mutex) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
if(mutex->unlockMutex() != HasReturnvaluesIF::RETURN_OK) {
|
if(mutex->unlockMutex() != HasReturnvaluesIF::RETURN_OK) {
|
||||||
sif::error << "rwSpiCallback::closeSpi: Failed to unlock mutex" << std::endl;
|
sif::error << "rwSpiCallback::closeSpi: Failed to unlock mutex" << std::endl;;
|
||||||
;
|
}
|
||||||
|
|
||||||
|
/** Route SPI interface again to PS SPI peripheral */
|
||||||
|
if(gpioIF->pullLow(gpioIds::SPI_MUX) != HasReturnvaluesIF::RETURN_OK) {
|
||||||
|
sif::error << "rwSpiCallback::spiCallback: Failed to pull spi mux gpio low" << std::endl;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} // namespace rwSpiCallback
|
|
||||||
|
@ -2,14 +2,12 @@
|
|||||||
#define BSP_Q7S_RW_SPI_CALLBACK_H_
|
#define BSP_Q7S_RW_SPI_CALLBACK_H_
|
||||||
|
|
||||||
#include "fsfw/returnvalues/HasReturnvaluesIF.h"
|
#include "fsfw/returnvalues/HasReturnvaluesIF.h"
|
||||||
#include "fsfw_hal/common/gpio/GpioCookie.h"
|
|
||||||
#include "fsfw_hal/linux/spi/SpiComIF.h"
|
#include "fsfw_hal/linux/spi/SpiComIF.h"
|
||||||
|
#include "fsfw_hal/common/gpio/GpioCookie.h"
|
||||||
|
|
||||||
|
|
||||||
namespace rwSpiCallback {
|
namespace rwSpiCallback {
|
||||||
|
|
||||||
//! This is the end and start marker of the frame datalinklayer
|
|
||||||
static constexpr uint8_t FLAG_BYTE = 0x7E;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief This is the callback function to send commands to the nano avionics reaction wheels and
|
* @brief This is the callback function to send commands to the nano avionics reaction wheels and
|
||||||
* receive the replies.
|
* receive the replies.
|
||||||
@ -42,5 +40,5 @@ ReturnValue_t spiCallback(SpiComIF* comIf, SpiCookie* cookie, const uint8_t* sen
|
|||||||
*/
|
*/
|
||||||
void closeSpi(gpioId_t gpioId, GpioIF* gpioIF, MutexIF* mutex);
|
void closeSpi(gpioId_t gpioId, GpioIF* gpioIF, MutexIF* mutex);
|
||||||
|
|
||||||
} // namespace rwSpiCallback
|
}
|
||||||
#endif /* BSP_Q7S_RW_SPI_CALLBACK_H_ */
|
#endif /* BSP_Q7S_RW_SPI_CALLBACK_H_ */
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
target_sources(${OBSW_NAME} PRIVATE
|
target_sources(${TARGET_NAME} PRIVATE
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
|
@ -1,10 +1,6 @@
|
|||||||
target_sources(${OBSW_NAME} PRIVATE
|
target_sources(${TARGET_NAME} PRIVATE
|
||||||
CoreController.cpp
|
CoreController.cpp
|
||||||
obsw.cpp
|
obsw.cpp
|
||||||
InitMission.cpp
|
InitMission.cpp
|
||||||
ObjectFactory.cpp
|
ObjectFactory.cpp
|
||||||
)
|
)
|
||||||
|
|
||||||
target_sources(${SIMPLE_OBSW_NAME} PRIVATE
|
|
||||||
InitMission.cpp
|
|
||||||
)
|
|
||||||
|
File diff suppressed because it is too large
Load Diff
@ -2,83 +2,47 @@
|
|||||||
#define BSP_Q7S_CORE_CORECONTROLLER_H_
|
#define BSP_Q7S_CORE_CORECONTROLLER_H_
|
||||||
|
|
||||||
#include <fsfw/globalfunctions/PeriodicOperationDivider.h>
|
#include <fsfw/globalfunctions/PeriodicOperationDivider.h>
|
||||||
#include <libxiphos.h>
|
|
||||||
|
|
||||||
#include <cstddef>
|
|
||||||
|
|
||||||
#include "bsp_q7s/memory/SdCardManager.h"
|
|
||||||
#include "events/subsystemIdRanges.h"
|
|
||||||
#include "fsfw/controller/ExtendedControllerBase.h"
|
#include "fsfw/controller/ExtendedControllerBase.h"
|
||||||
|
#include "bsp_q7s/memory/SdCardManager.h"
|
||||||
|
|
||||||
|
#include "events/subsystemIdRanges.h"
|
||||||
|
|
||||||
|
|
||||||
class Timer;
|
class Timer;
|
||||||
class SdCardManager;
|
class SdCardManager;
|
||||||
|
|
||||||
namespace xsc {
|
|
||||||
|
|
||||||
enum Chip : int { CHIP_0, CHIP_1, NO_CHIP, SELF_CHIP, ALL_CHIP };
|
|
||||||
enum Copy : int { COPY_0, COPY_1, NO_COPY, SELF_COPY, ALL_COPY };
|
|
||||||
|
|
||||||
} // namespace xsc
|
|
||||||
|
|
||||||
struct RebootFile {
|
|
||||||
static constexpr uint8_t DEFAULT_MAX_BOOT_CNT = 10;
|
|
||||||
|
|
||||||
bool enabled = true;
|
|
||||||
size_t maxCount = DEFAULT_MAX_BOOT_CNT;
|
|
||||||
uint32_t img00Cnt = 0;
|
|
||||||
uint32_t img01Cnt = 0;
|
|
||||||
uint32_t img10Cnt = 0;
|
|
||||||
uint32_t img11Cnt = 0;
|
|
||||||
bool img00Lock = false;
|
|
||||||
bool img01Lock = false;
|
|
||||||
bool img10Lock = false;
|
|
||||||
bool img11Lock = false;
|
|
||||||
uint32_t* relevantBootCnt = &img00Cnt;
|
|
||||||
bool bootFlag = false;
|
|
||||||
xsc::Chip lastChip = xsc::Chip::CHIP_0;
|
|
||||||
xsc::Copy lastCopy = xsc::Copy::COPY_0;
|
|
||||||
xsc::Chip mechanismNextChip = xsc::Chip::NO_CHIP;
|
|
||||||
xsc::Copy mechanismNextCopy = xsc::Copy::NO_COPY;
|
|
||||||
};
|
|
||||||
|
|
||||||
class CoreController: public ExtendedControllerBase {
|
class CoreController: public ExtendedControllerBase {
|
||||||
public:
|
public:
|
||||||
static xsc::Chip CURRENT_CHIP;
|
enum Chip: uint8_t {
|
||||||
static xsc::Copy CURRENT_COPY;
|
CHIP_0,
|
||||||
|
CHIP_1,
|
||||||
|
NO_CHIP,
|
||||||
|
SELF_CHIP,
|
||||||
|
ALL_CHIP
|
||||||
|
};
|
||||||
|
|
||||||
|
enum Copy: uint8_t {
|
||||||
|
COPY_0,
|
||||||
|
COPY_1,
|
||||||
|
NO_COPY,
|
||||||
|
SELF_COPY,
|
||||||
|
ALL_COPY
|
||||||
|
};
|
||||||
|
|
||||||
static constexpr char CHIP_PROT_SCRIPT[] = "/home/root/scripts/get-chip-prot-status.sh";
|
static constexpr char CHIP_PROT_SCRIPT[] = "/home/root/scripts/get-chip-prot-status.sh";
|
||||||
static constexpr char CHIP_STATE_FILE[] = "/tmp/chip_prot_status.txt";
|
static constexpr char CHIP_STATE_FILE[] = "/tmp/chip_prot_status.txt";
|
||||||
static constexpr char CURR_COPY_FILE[] = "/tmp/curr_copy.txt";
|
static constexpr char CURR_COPY_FILE[] = "/tmp/curr_copy.txt";
|
||||||
static constexpr char CONF_FOLDER[] = "conf";
|
static constexpr char VERSION_FILE[] = "/conf/sd_status";
|
||||||
static constexpr char VERSION_FILE_NAME[] = "version.txt";
|
|
||||||
static constexpr char REBOOT_FILE_NAME[] = "reboot.txt";
|
|
||||||
const std::string VERSION_FILE =
|
|
||||||
"/" + std::string(CONF_FOLDER) + "/" + std::string(VERSION_FILE_NAME);
|
|
||||||
const std::string REBOOT_FILE =
|
|
||||||
"/" + std::string(CONF_FOLDER) + "/" + std::string(REBOOT_FILE_NAME);
|
|
||||||
|
|
||||||
static constexpr ActionId_t LIST_DIRECTORY_INTO_FILE = 0;
|
static constexpr ActionId_t LIST_DIRECTORY_INTO_FILE = 0;
|
||||||
static constexpr ActionId_t SWITCH_REBOOT_FILE_HANDLING = 5;
|
|
||||||
static constexpr ActionId_t RESET_REBOOT_COUNTERS = 6;
|
|
||||||
static constexpr ActionId_t SWITCH_IMG_LOCK = 7;
|
|
||||||
static constexpr ActionId_t SET_MAX_REBOOT_CNT = 8;
|
|
||||||
|
|
||||||
static constexpr ActionId_t REBOOT_OBC = 32;
|
static constexpr ActionId_t REBOOT_OBC = 32;
|
||||||
static constexpr ActionId_t MOUNT_OTHER_COPY = 33;
|
static constexpr ActionId_t MOUNT_OTHER_COPY = 33;
|
||||||
|
|
||||||
|
|
||||||
static constexpr uint8_t SUBSYSTEM_ID = SUBSYSTEM_ID::CORE;
|
static constexpr uint8_t SUBSYSTEM_ID = SUBSYSTEM_ID::CORE;
|
||||||
|
|
||||||
static constexpr Event ALLOC_FAILURE = event::makeEvent(SUBSYSTEM_ID, 0, severity::MEDIUM);
|
static constexpr Event ALLOC_FAILURE = event::makeEvent(SUBSYSTEM_ID, 0, severity::MEDIUM);
|
||||||
//! [EXPORT] : [COMMENT] Software reboot occured. Can also be a systemd reboot.
|
|
||||||
//! P1: Current Chip, P2: Current Copy
|
|
||||||
static constexpr Event REBOOT_SW = event::makeEvent(SUBSYSTEM_ID, 1, severity::MEDIUM);
|
|
||||||
//! [EXPORT] : [COMMENT] The reboot mechanism was triggered.
|
|
||||||
//! P1: First 16 bits: Last Chip, Last 16 bits: Last Copy,
|
|
||||||
//! P2: Each byte is the respective reboot count for the slots
|
|
||||||
static constexpr Event REBOOT_MECHANISM_TRIGGERED =
|
|
||||||
event::makeEvent(SUBSYSTEM_ID, 2, severity::MEDIUM);
|
|
||||||
//! Trying to find a way how to determine that the reboot came from ProASIC3 or PCDU..
|
|
||||||
static constexpr Event REBOOT_HW = event::makeEvent(SUBSYSTEM_ID, 3, severity::MEDIUM);
|
|
||||||
|
|
||||||
CoreController(object_id_t objectId);
|
CoreController(object_id_t objectId);
|
||||||
virtual~ CoreController();
|
virtual~ CoreController();
|
||||||
@ -87,8 +51,8 @@ class CoreController : public ExtendedControllerBase {
|
|||||||
|
|
||||||
ReturnValue_t initializeAfterTaskCreation() override;
|
ReturnValue_t initializeAfterTaskCreation() override;
|
||||||
|
|
||||||
ReturnValue_t executeAction(ActionId_t actionId, MessageQueueId_t commandedBy,
|
ReturnValue_t executeAction(ActionId_t actionId,
|
||||||
const uint8_t* data, size_t size) override;
|
MessageQueueId_t commandedBy, const uint8_t *data, size_t size) override;
|
||||||
|
|
||||||
ReturnValue_t handleCommandMessage(CommandMessage *message) override;
|
ReturnValue_t handleCommandMessage(CommandMessage *message) override;
|
||||||
void performControlOperation() override;
|
void performControlOperation() override;
|
||||||
@ -99,7 +63,7 @@ class CoreController : public ExtendedControllerBase {
|
|||||||
*/
|
*/
|
||||||
static ReturnValue_t generateChipStateFile();
|
static ReturnValue_t generateChipStateFile();
|
||||||
static ReturnValue_t incrementAllocationFailureCount();
|
static ReturnValue_t incrementAllocationFailureCount();
|
||||||
static void getCurrentBootCopy(xsc::Chip& chip, xsc::Copy& copy);
|
static void getCurrentBootCopy(Chip& chip, Copy& copy);
|
||||||
|
|
||||||
ReturnValue_t updateProtInfo(bool regenerateChipStateFile = true);
|
ReturnValue_t updateProtInfo(bool regenerateChipStateFile = true);
|
||||||
|
|
||||||
@ -114,12 +78,15 @@ class CoreController : public ExtendedControllerBase {
|
|||||||
* @param updateProtFile Specify whether the protection info file is updated
|
* @param updateProtFile Specify whether the protection info file is updated
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
ReturnValue_t setBootCopyProtection(xsc::Chip targetChip, xsc::Copy targetCopy, bool protect,
|
ReturnValue_t setBootCopyProtection(Chip targetChip, Copy targetCopy,
|
||||||
bool& protOperationPerformed, bool updateProtFile = true);
|
bool protect, bool& protOperationPerformed, bool updateProtFile = true);
|
||||||
|
|
||||||
bool sdInitFinished() const;
|
bool sdInitFinished() const;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
static Chip CURRENT_CHIP;
|
||||||
|
static Copy CURRENT_COPY;
|
||||||
|
|
||||||
// Designated value for rechecking FIFO open
|
// Designated value for rechecking FIFO open
|
||||||
static constexpr int RETRY_FIFO_OPEN = -2;
|
static constexpr int RETRY_FIFO_OPEN = -2;
|
||||||
int watchdogFifoFd = 0;
|
int watchdogFifoFd = 0;
|
||||||
@ -168,9 +135,8 @@ class CoreController : public ExtendedControllerBase {
|
|||||||
sd::SdState currentlyCommandedState = sd::SdState::OFF;
|
sd::SdState currentlyCommandedState = sd::SdState::OFF;
|
||||||
sd::SdCard commandedCard = sd::SdCard::NONE;
|
sd::SdCard commandedCard = sd::SdCard::NONE;
|
||||||
sd::SdState commandedState = sd::SdState::OFF;
|
sd::SdState commandedState = sd::SdState::OFF;
|
||||||
} sdInfo;
|
};
|
||||||
RebootFile rebootFile = {};
|
SdInfo sdInfo;
|
||||||
bool doPerformMountedSdCardOps = true;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Index 0: Chip 0 Copy 0
|
* Index 0: Chip 0 Copy 0
|
||||||
@ -184,8 +150,9 @@ class CoreController : public ExtendedControllerBase {
|
|||||||
ReturnValue_t initializeLocalDataPool(localpool::DataPool& localDataPoolMap,
|
ReturnValue_t initializeLocalDataPool(localpool::DataPool& localDataPoolMap,
|
||||||
LocalDataPoolManager& poolManager) override;
|
LocalDataPoolManager& poolManager) override;
|
||||||
LocalPoolDataSetBase* getDataSetHandle(sid_t sid) override;
|
LocalPoolDataSetBase* getDataSetHandle(sid_t sid) override;
|
||||||
ReturnValue_t checkModeCommand(Mode_t mode, Submode_t submode, uint32_t* msToReachTheMode);
|
ReturnValue_t checkModeCommand(Mode_t mode, Submode_t submode,
|
||||||
void performMountedSdCardOperations();
|
uint32_t *msToReachTheMode);
|
||||||
|
|
||||||
ReturnValue_t initVersionFile();
|
ReturnValue_t initVersionFile();
|
||||||
ReturnValue_t initBootCopy();
|
ReturnValue_t initBootCopy();
|
||||||
ReturnValue_t initWatchdogFifo();
|
ReturnValue_t initWatchdogFifo();
|
||||||
@ -197,12 +164,10 @@ class CoreController : public ExtendedControllerBase {
|
|||||||
ReturnValue_t sdCardSetup(sd::SdCard sdCard, sd::SdState targetState, std::string sdChar,
|
ReturnValue_t sdCardSetup(sd::SdCard sdCard, sd::SdState targetState, std::string sdChar,
|
||||||
bool printOutput = true);
|
bool printOutput = true);
|
||||||
ReturnValue_t sdColdRedundantBlockingInit();
|
ReturnValue_t sdColdRedundantBlockingInit();
|
||||||
|
|
||||||
void currentStateSetter(sd::SdCard sdCard, sd::SdState newState);
|
void currentStateSetter(sd::SdCard sdCard, sd::SdState newState);
|
||||||
void determinePreferredSdCard();
|
void determinePreferredSdCard();
|
||||||
void executeNextExternalSdCommand();
|
void executeNextExternalSdCommand();
|
||||||
void checkExternalSdCommandStatus();
|
void checkExternalSdCommandStatus();
|
||||||
void performRebootFileHandling(bool recreateFile);
|
|
||||||
|
|
||||||
ReturnValue_t actionListDirectoryIntoFile(ActionId_t actionId, MessageQueueId_t commandedBy,
|
ReturnValue_t actionListDirectoryIntoFile(ActionId_t actionId, MessageQueueId_t commandedBy,
|
||||||
const uint8_t *data, size_t size);
|
const uint8_t *data, size_t size);
|
||||||
@ -211,15 +176,9 @@ class CoreController : public ExtendedControllerBase {
|
|||||||
void performWatchdogControlOperation();
|
void performWatchdogControlOperation();
|
||||||
|
|
||||||
ReturnValue_t handleProtInfoUpdateLine(std::string nextLine);
|
ReturnValue_t handleProtInfoUpdateLine(std::string nextLine);
|
||||||
int handleBootCopyProtAtIndex(xsc::Chip targetChip, xsc::Copy targetCopy, bool protect,
|
int handleBootCopyProtAtIndex(Chip targetChip, Copy targetCopy, bool protect,
|
||||||
bool& protOperationPerformed, bool selfChip, bool selfCopy,
|
bool &protOperationPerformed, bool selfChip, bool selfCopy, bool allChips,
|
||||||
bool allChips, bool allCopies, uint8_t arrIdx);
|
bool allCopies, uint8_t arrIdx);
|
||||||
void determineAndExecuteReboot(RebootFile& rf, bool& needsReboot, xsc::Chip& tgtChip,
|
|
||||||
xsc::Copy& tgtCopy);
|
|
||||||
void resetRebootCount(xsc::Chip tgtChip, xsc::Copy tgtCopy);
|
|
||||||
void setRebootMechanismLock(bool lock, xsc::Chip tgtChip, xsc::Copy tgtCopy);
|
|
||||||
bool parseRebootFile(std::string path, RebootFile& file);
|
|
||||||
void rewriteRebootFile(RebootFile file);
|
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif /* BSP_Q7S_CORE_CORECONTROLLER_H_ */
|
#endif /* BSP_Q7S_CORE_CORECONTROLLER_H_ */
|
||||||
|
@ -1,27 +1,28 @@
|
|||||||
#include "InitMission.h"
|
#include "InitMission.h"
|
||||||
|
|
||||||
#include <iostream>
|
|
||||||
#include <vector>
|
|
||||||
|
|
||||||
#include "OBSWConfig.h"
|
|
||||||
#include "ObjectFactory.h"
|
#include "ObjectFactory.h"
|
||||||
#include "fsfw/objectmanager/ObjectManager.h"
|
#include "OBSWConfig.h"
|
||||||
#include "fsfw/objectmanager/ObjectManagerIF.h"
|
#include "pollingsequence/pollingSequenceFactory.h"
|
||||||
|
|
||||||
|
#include "mission/utility/InitMission.h"
|
||||||
|
|
||||||
#include "fsfw/platform.h"
|
#include "fsfw/platform.h"
|
||||||
|
#include "fsfw/objectmanager/ObjectManagerIF.h"
|
||||||
#include "fsfw/returnvalues/HasReturnvaluesIF.h"
|
#include "fsfw/returnvalues/HasReturnvaluesIF.h"
|
||||||
#include "fsfw/serviceinterface/ServiceInterfaceStream.h"
|
#include "fsfw/serviceinterface/ServiceInterfaceStream.h"
|
||||||
|
#include "fsfw/objectmanager/ObjectManager.h"
|
||||||
#include "fsfw/tasks/FixedTimeslotTaskIF.h"
|
#include "fsfw/tasks/FixedTimeslotTaskIF.h"
|
||||||
#include "fsfw/tasks/PeriodicTaskIF.h"
|
#include "fsfw/tasks/PeriodicTaskIF.h"
|
||||||
#include "fsfw/tasks/TaskFactory.h"
|
#include "fsfw/tasks/TaskFactory.h"
|
||||||
#include "mission/utility/InitMission.h"
|
|
||||||
#include "pollingsequence/pollingSequenceFactory.h"
|
#include <iostream>
|
||||||
|
#include <vector>
|
||||||
|
|
||||||
/* This is configured for linux without CR */
|
/* This is configured for linux without CR */
|
||||||
#ifdef PLATFORM_UNIX
|
#ifdef PLATFORM_UNIX
|
||||||
ServiceInterfaceStream sif::debug("DEBUG");
|
ServiceInterfaceStream sif::debug("DEBUG");
|
||||||
ServiceInterfaceStream sif::info("INFO");
|
ServiceInterfaceStream sif::info("INFO");
|
||||||
ServiceInterfaceStream sif::warning("WARNING");
|
ServiceInterfaceStream sif::warning("WARNING");
|
||||||
ServiceInterfaceStream sif::error("ERROR");
|
ServiceInterfaceStream sif::error("ERROR", false, false, true);
|
||||||
#else
|
#else
|
||||||
ServiceInterfaceStream sif::debug("DEBUG", true);
|
ServiceInterfaceStream sif::debug("DEBUG", true);
|
||||||
ServiceInterfaceStream sif::info("INFO", true);
|
ServiceInterfaceStream sif::info("INFO", true);
|
||||||
@ -32,6 +33,7 @@ ServiceInterfaceStream sif::error("ERROR", true, false, true);
|
|||||||
ObjectManagerIF *objectManager = nullptr;
|
ObjectManagerIF *objectManager = nullptr;
|
||||||
|
|
||||||
void initmission::initMission() {
|
void initmission::initMission() {
|
||||||
|
|
||||||
sif::info << "Building global objects.." << std::endl;
|
sif::info << "Building global objects.." << std::endl;
|
||||||
/* Instantiate global object manager and also create all objects */
|
/* Instantiate global object manager and also create all objects */
|
||||||
ObjectManager::instance()->setObjectFactoryFunction(ObjectFactory::produce, nullptr);
|
ObjectManager::instance()->setObjectFactoryFunction(ObjectFactory::produce, nullptr);
|
||||||
@ -80,49 +82,19 @@ void initmission::initTasks() {
|
|||||||
initmission::printAddObjectError("TM_FUNNEL", objects::TM_FUNNEL);
|
initmission::printAddObjectError("TM_FUNNEL", objects::TM_FUNNEL);
|
||||||
}
|
}
|
||||||
|
|
||||||
#if OBSW_ADD_TCPIP_BRIDGE == 1
|
/* UDP bridge */
|
||||||
// TMTC bridge
|
|
||||||
PeriodicTaskIF* tmtcBridgeTask = factory->createPeriodicTask(
|
PeriodicTaskIF* tmtcBridgeTask = factory->createPeriodicTask(
|
||||||
"TCPIP_TMTC_BRIDGE", 50, PeriodicTaskIF::MINIMUM_STACK_SIZE, 0.2, missedDeadlineFunc);
|
"UDP_UNIX_BRIDGE", 50, PeriodicTaskIF::MINIMUM_STACK_SIZE, 0.2, missedDeadlineFunc);
|
||||||
result = tmtcBridgeTask->addComponent(objects::TMTC_BRIDGE);
|
result = tmtcBridgeTask->addComponent(objects::TMTC_BRIDGE);
|
||||||
if(result != HasReturnvaluesIF::RETURN_OK) {
|
if(result != HasReturnvaluesIF::RETURN_OK) {
|
||||||
initmission::printAddObjectError("TMTC_BRIDGE", objects::TMTC_BRIDGE);
|
initmission::printAddObjectError("UDP_BRIDGE", objects::TMTC_BRIDGE);
|
||||||
}
|
}
|
||||||
PeriodicTaskIF* tmtcPollingTask = factory->createPeriodicTask(
|
PeriodicTaskIF* tmtcPollingTask = factory->createPeriodicTask(
|
||||||
"TMTC_POLLING", 80, PeriodicTaskIF::MINIMUM_STACK_SIZE, 2.0, missedDeadlineFunc);
|
"UDP_POLLING", 80, PeriodicTaskIF::MINIMUM_STACK_SIZE, 2.0, missedDeadlineFunc);
|
||||||
result = tmtcPollingTask->addComponent(objects::TMTC_POLLING_TASK);
|
result = tmtcPollingTask->addComponent(objects::TMTC_POLLING_TASK);
|
||||||
if(result != HasReturnvaluesIF::RETURN_OK) {
|
if(result != HasReturnvaluesIF::RETURN_OK) {
|
||||||
initmission::printAddObjectError("UDP_POLLING", objects::TMTC_POLLING_TASK);
|
initmission::printAddObjectError("UDP_POLLING", objects::TMTC_POLLING_TASK);
|
||||||
}
|
}
|
||||||
#endif
|
|
||||||
|
|
||||||
#if OBSW_USE_CCSDS_IP_CORE == 1
|
|
||||||
PeriodicTaskIF* ccsdsHandlerTask = factory->createPeriodicTask(
|
|
||||||
"CCSDS_HANDLER", 50, PeriodicTaskIF::MINIMUM_STACK_SIZE, 2.0, missedDeadlineFunc);
|
|
||||||
result = ccsdsHandlerTask->addComponent(objects::CCSDS_HANDLER);
|
|
||||||
if (result != HasReturnvaluesIF::RETURN_OK) {
|
|
||||||
initmission::printAddObjectError("CCSDS Handler", objects::CCSDS_HANDLER);
|
|
||||||
}
|
|
||||||
|
|
||||||
// Minimal distance between two received TCs amounts to 0.6 seconds
|
|
||||||
// If a command has not been read before the next one arrives, the old command will be
|
|
||||||
// overwritten by the PDEC.
|
|
||||||
PeriodicTaskIF* pdecHandlerTask = factory->createPeriodicTask(
|
|
||||||
"PDEC_HANDLER", 50, PeriodicTaskIF::MINIMUM_STACK_SIZE, 1.0, missedDeadlineFunc);
|
|
||||||
result = pdecHandlerTask->addComponent(objects::PDEC_HANDLER);
|
|
||||||
if (result != HasReturnvaluesIF::RETURN_OK) {
|
|
||||||
initmission::printAddObjectError("PDEC Handler", objects::PDEC_HANDLER);
|
|
||||||
}
|
|
||||||
#endif /* OBSW_USE_CCSDS_IP_CORE == 1 */
|
|
||||||
|
|
||||||
#if OBSW_ADD_ACS_HANDLERS == 1
|
|
||||||
PeriodicTaskIF* acsCtrl = factory->createPeriodicTask(
|
|
||||||
"ACS_CTRL", 40, PeriodicTaskIF::MINIMUM_STACK_SIZE * 2, 0.4, missedDeadlineFunc);
|
|
||||||
result = acsCtrl->addComponent(objects::GPS_CONTROLLER);
|
|
||||||
if (result != HasReturnvaluesIF::RETURN_OK) {
|
|
||||||
initmission::printAddObjectError("ACS_CTRL", objects::GPS_CONTROLLER);
|
|
||||||
}
|
|
||||||
#endif /* OBSW_ADD_ACS_HANDLERS */
|
|
||||||
|
|
||||||
# if BOARD_TE0720 == 0
|
# if BOARD_TE0720 == 0
|
||||||
// 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
|
||||||
@ -133,16 +105,6 @@ void initmission::initTasks() {
|
|||||||
if(result != HasReturnvaluesIF::RETURN_OK) {
|
if(result != HasReturnvaluesIF::RETURN_OK) {
|
||||||
initmission::printAddObjectError("FILE_SYSTEM_TASK", objects::FILE_SYSTEM_HANDLER);
|
initmission::printAddObjectError("FILE_SYSTEM_TASK", objects::FILE_SYSTEM_HANDLER);
|
||||||
}
|
}
|
||||||
|
|
||||||
#if OBSW_ADD_STAR_TRACKER == 1
|
|
||||||
PeriodicTaskIF* strHelperTask = factory->createPeriodicTask(
|
|
||||||
"STR_HELPER", 20, PeriodicTaskIF::MINIMUM_STACK_SIZE, 0.2, missedDeadlineFunc);
|
|
||||||
result = strHelperTask->addComponent(objects::STR_HELPER);
|
|
||||||
if (result != HasReturnvaluesIF::RETURN_OK) {
|
|
||||||
initmission::printAddObjectError("STR_HELPER", objects::STR_HELPER);
|
|
||||||
}
|
|
||||||
#endif /* OBSW_ADD_STAR_TRACKER == 1 */
|
|
||||||
|
|
||||||
#endif /* BOARD_TE0720 */
|
#endif /* BOARD_TE0720 */
|
||||||
|
|
||||||
#if OBSW_TEST_CCSDS_BRIDGE == 1
|
#if OBSW_TEST_CCSDS_BRIDGE == 1
|
||||||
@ -168,7 +130,8 @@ void initmission::initTasks() {
|
|||||||
for(const auto& task: taskVector) {
|
for(const auto& task: taskVector) {
|
||||||
if(task != nullptr) {
|
if(task != nullptr) {
|
||||||
task->startTask();
|
task->startTask();
|
||||||
} else {
|
}
|
||||||
|
else {
|
||||||
sif::error << "Task in vector " << name << " is invalid!" << std::endl;
|
sif::error << "Task in vector " << name << " is invalid!" << std::endl;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -176,17 +139,8 @@ void initmission::initTasks() {
|
|||||||
|
|
||||||
sif::info << "Starting tasks.." << std::endl;
|
sif::info << "Starting tasks.." << std::endl;
|
||||||
tmTcDistributor->startTask();
|
tmTcDistributor->startTask();
|
||||||
|
|
||||||
#if OBSW_ADD_TCPIP_BRIDGE == 1
|
|
||||||
tmtcBridgeTask->startTask();
|
tmtcBridgeTask->startTask();
|
||||||
tmtcPollingTask->startTask();
|
tmtcPollingTask->startTask();
|
||||||
#endif
|
|
||||||
|
|
||||||
#if OBSW_USE_CCSDS_IP_CORE == 1
|
|
||||||
ccsdsHandlerTask->startTask();
|
|
||||||
pdecHandlerTask->startTask();
|
|
||||||
#endif /* OBSW_USE_CCSDS_IP_CORE == 1 */
|
|
||||||
|
|
||||||
#if BOARD_TE0720 == 0
|
#if BOARD_TE0720 == 0
|
||||||
coreController->startTask();
|
coreController->startTask();
|
||||||
#endif
|
#endif
|
||||||
@ -203,61 +157,47 @@ void initmission::initTasks() {
|
|||||||
|
|
||||||
#if BOARD_TE0720 == 0
|
#if BOARD_TE0720 == 0
|
||||||
fsTask->startTask();
|
fsTask->startTask();
|
||||||
#if OBSW_ADD_STAR_TRACKER == 1
|
|
||||||
strHelperTask > startTask();
|
|
||||||
#endif /* OBSW_ADD_STAR_TRACKER == 1 */
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#if OBSW_ADD_ACS_HANDLERS == 1
|
|
||||||
acsCtrl->startTask();
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
sif::info << "Tasks started.." << std::endl;
|
sif::info << "Tasks started.." << std::endl;
|
||||||
}
|
}
|
||||||
|
|
||||||
void initmission::createPstTasks(TaskFactory& factory,
|
void initmission::createPstTasks(TaskFactory& factory,
|
||||||
TaskDeadlineMissedFunction missedDeadlineFunc,
|
TaskDeadlineMissedFunction missedDeadlineFunc, std::vector<PeriodicTaskIF*> &taskVec) {
|
||||||
std::vector<PeriodicTaskIF*>& taskVec) {
|
|
||||||
ReturnValue_t result = HasReturnvaluesIF::RETURN_OK;
|
ReturnValue_t result = HasReturnvaluesIF::RETURN_OK;
|
||||||
#if BOARD_TE0720 == 0
|
#if BOARD_TE0720 == 0
|
||||||
/* Polling Sequence Table Default */
|
/* Polling Sequence Table Default */
|
||||||
#if OBSW_ADD_SPI_TEST_CODE == 0
|
#if OBSW_ADD_SPI_TEST_CODE == 0
|
||||||
FixedTimeslotTaskIF* spiPst = factory.createFixedTimeslotTask(
|
FixedTimeslotTaskIF* spiPst = factory.createFixedTimeslotTask(
|
||||||
"PST_TASK_DEFAULT", 70, PeriodicTaskIF::MINIMUM_STACK_SIZE * 4, 0.5, missedDeadlineFunc);
|
"PST_TASK_DEFAULT", 70, PeriodicTaskIF::MINIMUM_STACK_SIZE * 4, 3.0,
|
||||||
|
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) {
|
|
||||||
sif::error << "InitMission::initTasks: Creating PST failed!" << std::endl;
|
sif::error << "InitMission::initTasks: Creating PST failed!" << std::endl;
|
||||||
}
|
}
|
||||||
} else {
|
|
||||||
taskVec.push_back(spiPst);
|
taskVec.push_back(spiPst);
|
||||||
}
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
FixedTimeslotTaskIF* uartPst = factory.createFixedTimeslotTask(
|
FixedTimeslotTaskIF* uartPst = factory.createFixedTimeslotTask(
|
||||||
"UART_PST", 70, PeriodicTaskIF::MINIMUM_STACK_SIZE * 4, 0.2, missedDeadlineFunc);
|
"UART_PST", 70, PeriodicTaskIF::MINIMUM_STACK_SIZE * 4, 3.0, missedDeadlineFunc);
|
||||||
result = pst::pstUart(uartPst);
|
result = pst::pstUart(uartPst);
|
||||||
if (result != HasReturnvaluesIF::RETURN_OK) {
|
if (result != HasReturnvaluesIF::RETURN_OK) {
|
||||||
sif::error << "InitMission::initTasks: Creating PST failed!" << std::endl;
|
sif::error << "InitMission::initTasks: Creating PST failed!" << std::endl;
|
||||||
}
|
}
|
||||||
taskVec.push_back(uartPst);
|
taskVec.push_back(uartPst);
|
||||||
FixedTimeslotTaskIF* gpioPst = factory.createFixedTimeslotTask(
|
FixedTimeslotTaskIF* gpioPst = factory.createFixedTimeslotTask(
|
||||||
"GPIO_PST", 70, PeriodicTaskIF::MINIMUM_STACK_SIZE * 4, 0.2, missedDeadlineFunc);
|
"GPIO_PST", 70, PeriodicTaskIF::MINIMUM_STACK_SIZE * 4, 3.0, missedDeadlineFunc);
|
||||||
result = pst::pstGpio(gpioPst);
|
result = pst::pstGpio(gpioPst);
|
||||||
if (result != HasReturnvaluesIF::RETURN_OK) {
|
if (result != HasReturnvaluesIF::RETURN_OK) {
|
||||||
sif::error << "InitMission::initTasks: Creating PST failed!" << std::endl;
|
sif::error << "InitMission::initTasks: Creating PST failed!" << std::endl;
|
||||||
}
|
}
|
||||||
taskVec.push_back(gpioPst);
|
taskVec.push_back(gpioPst);
|
||||||
|
|
||||||
#if OBSW_ADD_I2C_TEST_CODE == 0
|
|
||||||
FixedTimeslotTaskIF* i2cPst = factory.createFixedTimeslotTask(
|
FixedTimeslotTaskIF* i2cPst = factory.createFixedTimeslotTask(
|
||||||
"I2C_PST", 70, PeriodicTaskIF::MINIMUM_STACK_SIZE * 4, 0.2, missedDeadlineFunc);
|
"I2C_PST", 70, PeriodicTaskIF::MINIMUM_STACK_SIZE * 4, 3.0, missedDeadlineFunc);
|
||||||
result = pst::pstI2c(i2cPst);
|
result = pst::pstI2c(i2cPst);
|
||||||
if (result != HasReturnvaluesIF::RETURN_OK) {
|
if (result != HasReturnvaluesIF::RETURN_OK) {
|
||||||
sif::error << "InitMission::initTasks: Creating PST failed!" << std::endl;
|
sif::error << "InitMission::initTasks: Creating PST failed!" << std::endl;
|
||||||
}
|
}
|
||||||
taskVec.push_back(i2cPst);
|
|
||||||
#endif
|
|
||||||
|
|
||||||
FixedTimeslotTaskIF* gomSpacePstTask = factory.createFixedTimeslotTask(
|
FixedTimeslotTaskIF* gomSpacePstTask = factory.createFixedTimeslotTask(
|
||||||
"GS_PST_TASK", 70, PeriodicTaskIF::MINIMUM_STACK_SIZE * 4, 1.0, missedDeadlineFunc);
|
"GS_PST_TASK", 70, PeriodicTaskIF::MINIMUM_STACK_SIZE * 4, 1.0, missedDeadlineFunc);
|
||||||
@ -268,7 +208,8 @@ void initmission::createPstTasks(TaskFactory& factory,
|
|||||||
taskVec.push_back(gomSpacePstTask);
|
taskVec.push_back(gomSpacePstTask);
|
||||||
#else /* BOARD_TE7020 == 0 */
|
#else /* BOARD_TE7020 == 0 */
|
||||||
FixedTimeslotTaskIF * pollingSequenceTaskTE0720 = factory.createFixedTimeslotTask(
|
FixedTimeslotTaskIF * pollingSequenceTaskTE0720 = factory.createFixedTimeslotTask(
|
||||||
"PST_TASK_TE0720", 30, PeriodicTaskIF::MINIMUM_STACK_SIZE * 8, 3.0, missedDeadlineFunc);
|
"PST_TASK_TE0720", 30, PeriodicTaskIF::MINIMUM_STACK_SIZE * 8, 3.0,
|
||||||
|
missedDeadlineFunc);
|
||||||
result = pst::pollingSequenceTE0720(pollingSequenceTaskTE0720);
|
result = pst::pollingSequenceTE0720(pollingSequenceTaskTE0720);
|
||||||
if (result != HasReturnvaluesIF::RETURN_OK) {
|
if (result != HasReturnvaluesIF::RETURN_OK) {
|
||||||
sif::error << "InitMission::initTasks: Creating TE0720 PST failed!" << std::endl;
|
sif::error << "InitMission::initTasks: Creating TE0720 PST failed!" << std::endl;
|
||||||
@ -278,8 +219,7 @@ void initmission::createPstTasks(TaskFactory& factory,
|
|||||||
}
|
}
|
||||||
|
|
||||||
void initmission::createPusTasks(TaskFactory &factory,
|
void initmission::createPusTasks(TaskFactory &factory,
|
||||||
TaskDeadlineMissedFunction missedDeadlineFunc,
|
TaskDeadlineMissedFunction missedDeadlineFunc, std::vector<PeriodicTaskIF*> &taskVec) {
|
||||||
std::vector<PeriodicTaskIF*>& taskVec) {
|
|
||||||
ReturnValue_t result = HasReturnvaluesIF::RETURN_OK;
|
ReturnValue_t result = HasReturnvaluesIF::RETURN_OK;
|
||||||
/* PUS Services */
|
/* PUS Services */
|
||||||
PeriodicTaskIF* pusVerification = factory.createPeriodicTask(
|
PeriodicTaskIF* pusVerification = factory.createPeriodicTask(
|
||||||
@ -347,20 +287,19 @@ void initmission::createPusTasks(TaskFactory& factory,
|
|||||||
taskVec.push_back(pusLowPrio);
|
taskVec.push_back(pusLowPrio);
|
||||||
}
|
}
|
||||||
|
|
||||||
void initmission::createTestTasks(TaskFactory& factory,
|
void initmission::createTestTasks(TaskFactory& factory, TaskDeadlineMissedFunction missedDeadlineFunc,
|
||||||
TaskDeadlineMissedFunction missedDeadlineFunc,
|
|
||||||
std::vector<PeriodicTaskIF*>& taskVec) {
|
std::vector<PeriodicTaskIF*>& taskVec) {
|
||||||
#if OBSW_ADD_TEST_TASK == 1 && OBSW_ADD_TEST_CODE == 1
|
#if OBSW_ADD_TEST_TASK == 1 || OBSW_ADD_SPI_TEST_CODE == 1 || (BOARD_TE0720 == 1 && OBSW_TEST_LIBGPIOD == 1)
|
||||||
ReturnValue_t result = HasReturnvaluesIF::RETURN_OK;
|
ReturnValue_t result = HasReturnvaluesIF::RETURN_OK;
|
||||||
static_cast<void>(result); // supress warning in case it is not used
|
#endif
|
||||||
|
|
||||||
PeriodicTaskIF* testTask = factory.createPeriodicTask(
|
PeriodicTaskIF* testTask = factory.createPeriodicTask(
|
||||||
"TEST_TASK", 60, PeriodicTaskIF::MINIMUM_STACK_SIZE, 1, missedDeadlineFunc);
|
"TEST_TASK", 60, PeriodicTaskIF::MINIMUM_STACK_SIZE, 1, missedDeadlineFunc);
|
||||||
|
#if OBSW_ADD_TEST_TASK == 1
|
||||||
result = testTask->addComponent(objects::TEST_TASK);
|
result = testTask->addComponent(objects::TEST_TASK);
|
||||||
if(result != HasReturnvaluesIF::RETURN_OK) {
|
if(result != HasReturnvaluesIF::RETURN_OK) {
|
||||||
initmission::printAddObjectError("TEST_TASK", objects::TEST_TASK);
|
initmission::printAddObjectError("TEST_TASK", objects::TEST_TASK);
|
||||||
}
|
}
|
||||||
|
#endif /* OBSW_ADD_TEST_TASK == 1 */
|
||||||
|
|
||||||
#if OBSW_ADD_SPI_TEST_CODE == 1
|
#if OBSW_ADD_SPI_TEST_CODE == 1
|
||||||
result = testTask->addComponent(objects::SPI_TEST);
|
result = testTask->addComponent(objects::SPI_TEST);
|
||||||
@ -368,19 +307,6 @@ void initmission::createTestTasks(TaskFactory& factory,
|
|||||||
initmission::printAddObjectError("SPI_TEST", objects::SPI_TEST);
|
initmission::printAddObjectError("SPI_TEST", objects::SPI_TEST);
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
#if OBSW_ADD_I2C_TEST_CODE == 1
|
|
||||||
result = testTask->addComponent(objects::I2C_TEST);
|
|
||||||
if (result != HasReturnvaluesIF::RETURN_OK) {
|
|
||||||
initmission::printAddObjectError("I2C_TEST", objects::I2C_TEST);
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
#if OBSW_ADD_UART_TEST_CODE == 1
|
|
||||||
result = testTask->addComponent(objects::UART_TEST);
|
|
||||||
if (result != HasReturnvaluesIF::RETURN_OK) {
|
|
||||||
initmission::printAddObjectError("UART_TEST", objects::UART_TEST);
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#if BOARD_TE0720 == 1 && OBSW_TEST_LIBGPIOD == 1
|
#if BOARD_TE0720 == 1 && OBSW_TEST_LIBGPIOD == 1
|
||||||
result = testTask->addComponent(objects::LIBGPIOD_TEST);
|
result = testTask->addComponent(objects::LIBGPIOD_TEST);
|
||||||
if(result != HasReturnvaluesIF::RETURN_OK) {
|
if(result != HasReturnvaluesIF::RETURN_OK) {
|
||||||
@ -388,6 +314,4 @@ void initmission::createTestTasks(TaskFactory& factory,
|
|||||||
}
|
}
|
||||||
#endif /* BOARD_TE0720 == 1 && OBSW_TEST_LIBGPIOD == 1 */
|
#endif /* BOARD_TE0720 == 1 && OBSW_TEST_LIBGPIOD == 1 */
|
||||||
taskVec.push_back(testTask);
|
taskVec.push_back(testTask);
|
||||||
|
|
||||||
#endif // OBSW_ADD_TEST_TASK == 1 && OBSW_ADD_TEST_CODE == 1
|
|
||||||
}
|
}
|
||||||
|
@ -1,9 +1,8 @@
|
|||||||
#ifndef BSP_Q7S_INITMISSION_H_
|
#ifndef BSP_Q7S_INITMISSION_H_
|
||||||
#define BSP_Q7S_INITMISSION_H_
|
#define BSP_Q7S_INITMISSION_H_
|
||||||
|
|
||||||
#include <vector>
|
|
||||||
|
|
||||||
#include "fsfw/tasks/Typedef.h"
|
#include "fsfw/tasks/Typedef.h"
|
||||||
|
#include <vector>
|
||||||
|
|
||||||
class PeriodicTaskIF;
|
class PeriodicTaskIF;
|
||||||
class TaskFactory;
|
class TaskFactory;
|
||||||
@ -18,6 +17,6 @@ void createPusTasks(TaskFactory& factory, TaskDeadlineMissedFunction missedDeadl
|
|||||||
std::vector<PeriodicTaskIF*>& taskVec);
|
std::vector<PeriodicTaskIF*>& taskVec);
|
||||||
void createTestTasks(TaskFactory& factory, TaskDeadlineMissedFunction missedDeadlineFunc,
|
void createTestTasks(TaskFactory& factory, TaskDeadlineMissedFunction missedDeadlineFunc,
|
||||||
std::vector<PeriodicTaskIF*>& taskVec);
|
std::vector<PeriodicTaskIF*>& taskVec);
|
||||||
}; // namespace initmission
|
};
|
||||||
|
|
||||||
#endif /* BSP_Q7S_INITMISSION_H_ */
|
#endif /* BSP_Q7S_INITMISSION_H_ */
|
||||||
|
File diff suppressed because it is too large
Load Diff
@ -4,7 +4,6 @@
|
|||||||
class LinuxLibgpioIF;
|
class LinuxLibgpioIF;
|
||||||
class UartComIF;
|
class UartComIF;
|
||||||
class SpiComIF;
|
class SpiComIF;
|
||||||
class I2cComIF;
|
|
||||||
|
|
||||||
namespace ObjectFactory {
|
namespace ObjectFactory {
|
||||||
|
|
||||||
@ -12,11 +11,9 @@ 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** spiComIF);
|
||||||
|
|
||||||
void createPlPcduComponents(LinuxLibgpioIF* gpioComIF, SpiComIF* spiComIF);
|
|
||||||
void createTmpComponents();
|
void createTmpComponents();
|
||||||
void createPcduComponents(LinuxLibgpioIF* gpioComIF);
|
void createPcduComponents();
|
||||||
void createRadSensorComponent(LinuxLibgpioIF* gpioComIF);
|
void createRadSensorComponent(LinuxLibgpioIF* gpioComIF);
|
||||||
void createSunSensorComponents(LinuxLibgpioIF* gpioComIF, SpiComIF* spiComIF);
|
void createSunSensorComponents(LinuxLibgpioIF* gpioComIF, SpiComIF* spiComIF);
|
||||||
void createAcsBoardComponents(LinuxLibgpioIF* gpioComIF, UartComIF* uartComIF);
|
void createAcsBoardComponents(LinuxLibgpioIF* gpioComIF, UartComIF* uartComIF);
|
||||||
@ -25,9 +22,8 @@ void createSolarArrayDeploymentComponents();
|
|||||||
void createSyrlinksComponents();
|
void createSyrlinksComponents();
|
||||||
void createRtdComponents(LinuxLibgpioIF* gpioComIF);
|
void createRtdComponents(LinuxLibgpioIF* gpioComIF);
|
||||||
void createReactionWheelComponents(LinuxLibgpioIF* gpioComIF);
|
void createReactionWheelComponents(LinuxLibgpioIF* gpioComIF);
|
||||||
void createCcsdsComponents(LinuxLibgpioIF* gpioComIF);
|
|
||||||
void createTestComponents(LinuxLibgpioIF* gpioComIF);
|
void createTestComponents(LinuxLibgpioIF* gpioComIF);
|
||||||
|
|
||||||
}; // namespace ObjectFactory
|
};
|
||||||
|
|
||||||
#endif /* BSP_Q7S_OBJECTFACTORY_H_ */
|
#endif /* BSP_Q7S_OBJECTFACTORY_H_ */
|
||||||
|
@ -1,5 +1,8 @@
|
|||||||
#include "ParameterHandler.h"
|
#include "ParameterHandler.h"
|
||||||
|
|
||||||
ParameterHandler::ParameterHandler(std::string mountPrefix) : mountPrefix(mountPrefix) {}
|
ParameterHandler::ParameterHandler(std::string mountPrefix): mountPrefix(mountPrefix) {
|
||||||
|
}
|
||||||
|
|
||||||
void ParameterHandler::setMountPrefix(std::string prefix) { mountPrefix = prefix; }
|
void ParameterHandler::setMountPrefix(std::string prefix) {
|
||||||
|
mountPrefix = prefix;
|
||||||
|
}
|
||||||
|
@ -4,6 +4,8 @@
|
|||||||
#include <nlohmann/json.hpp>
|
#include <nlohmann/json.hpp>
|
||||||
#include <string>
|
#include <string>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
class ParameterHandler {
|
class ParameterHandler {
|
||||||
public:
|
public:
|
||||||
ParameterHandler(std::string mountPrefix);
|
ParameterHandler(std::string mountPrefix);
|
||||||
@ -11,10 +13,10 @@ class ParameterHandler {
|
|||||||
void setMountPrefix(std::string prefix);
|
void setMountPrefix(std::string prefix);
|
||||||
|
|
||||||
void setUpDummyParameter();
|
void setUpDummyParameter();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
std::string mountPrefix;
|
std::string mountPrefix;
|
||||||
DummyParameter dummyParam;
|
DummyParameter dummyParam;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
#endif /* BSP_Q7S_CORE_PARAMETERHANDLER_H_ */
|
#endif /* BSP_Q7S_CORE_PARAMETERHANDLER_H_ */
|
||||||
|
@ -1,15 +1,15 @@
|
|||||||
#include "obsw.h"
|
#include "obsw.h"
|
||||||
|
|
||||||
#include <filesystem>
|
|
||||||
#include <iostream>
|
|
||||||
|
|
||||||
#include "InitMission.h"
|
|
||||||
#include "OBSWConfig.h"
|
|
||||||
#include "OBSWVersion.h"
|
#include "OBSWVersion.h"
|
||||||
#include "fsfw/FSFWVersion.h"
|
#include "OBSWConfig.h"
|
||||||
#include "fsfw/tasks/TaskFactory.h"
|
#include "InitMission.h"
|
||||||
#include "watchdogConf.h"
|
#include "watchdogConf.h"
|
||||||
|
|
||||||
|
#include "fsfw/tasks/TaskFactory.h"
|
||||||
|
#include "fsfw/FSFWVersion.h"
|
||||||
|
|
||||||
|
#include <iostream>
|
||||||
|
#include <filesystem>
|
||||||
|
|
||||||
static int OBSW_ALREADY_RUNNING = -2;
|
static int OBSW_ALREADY_RUNNING = -2;
|
||||||
|
|
||||||
int obsw::obsw() {
|
int obsw::obsw() {
|
||||||
@ -19,18 +19,17 @@ int obsw::obsw() {
|
|||||||
#else
|
#else
|
||||||
std::cout << "-- Compiled for Linux (TE0720) --" << std::endl;
|
std::cout << "-- Compiled for Linux (TE0720) --" << std::endl;
|
||||||
#endif
|
#endif
|
||||||
std::cout << "-- OBSW v" << SW_VERSION << "." << SW_SUBVERSION << "." << SW_REVISION << ", FSFW v"
|
std::cout << "-- OBSW v" << SW_VERSION << "." << SW_SUBVERSION <<
|
||||||
<< FSFW_VERSION << "." << FSFW_SUBVERSION << "." << FSFW_REVISION << "--" << std::endl;
|
"." << SW_REVISION << ", FSFW v" << FSFW_VERSION << "." << FSFW_SUBVERSION << "." <<
|
||||||
|
FSFW_REVISION << "--" << std::endl;
|
||||||
std::cout << "-- " << __DATE__ << " " << __TIME__ << " --" << std::endl;
|
std::cout << "-- " << __DATE__ << " " << __TIME__ << " --" << std::endl;
|
||||||
|
|
||||||
#if Q7S_CHECK_FOR_ALREADY_RUNNING_IMG == 1
|
#if Q7S_CHECK_FOR_ALREADY_RUNNING_IMG == 1
|
||||||
// Check special file here. This file is created or deleted by the eive-watchdog application
|
// Check special file here. This file is created or deleted by the eive-watchdog application
|
||||||
// or systemd service!
|
// or systemd service!
|
||||||
if(std::filesystem::exists(watchdog::RUNNING_FILE_NAME)) {
|
if(std::filesystem::exists(watchdog::RUNNING_FILE_NAME)) {
|
||||||
sif::warning << "File " << watchdog::RUNNING_FILE_NAME
|
sif::warning << "File " << watchdog::RUNNING_FILE_NAME << " exists so the software might "
|
||||||
<< " exists so the software might "
|
"already be running. Aborting.." << std::endl;
|
||||||
"already be running. Check if obsw systemd service has been stopped."
|
|
||||||
<< std::endl;
|
|
||||||
return OBSW_ALREADY_RUNNING;
|
return OBSW_ALREADY_RUNNING;
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
target_sources(${OBSW_NAME} PRIVATE
|
target_sources(${TARGET_NAME} PRIVATE
|
||||||
PlocSupervisorHandler.cpp
|
PlocSupervisorHandler.cpp
|
||||||
PlocUpdater.cpp
|
PlocUpdater.cpp
|
||||||
PlocMemoryDumper.cpp
|
PlocMemoryDumper.cpp
|
||||||
|
@ -1,23 +1,21 @@
|
|||||||
|
#include <fsfw/src/fsfw/serialize/SerializeAdapter.h>
|
||||||
|
#include "fsfw/ipc/QueueFactory.h"
|
||||||
#include "PlocMemoryDumper.h"
|
#include "PlocMemoryDumper.h"
|
||||||
|
|
||||||
#include <fsfw/src/fsfw/serialize/SerializeAdapter.h>
|
|
||||||
|
|
||||||
#include <filesystem>
|
|
||||||
#include <fstream>
|
#include <fstream>
|
||||||
|
#include <filesystem>
|
||||||
#include <string>
|
#include <string>
|
||||||
|
|
||||||
#include "fsfw/ipc/QueueFactory.h"
|
PlocMemoryDumper::PlocMemoryDumper(object_id_t objectId) :
|
||||||
|
SystemObject(objectId), commandActionHelper(this), actionHelper(this, nullptr) {
|
||||||
PlocMemoryDumper::PlocMemoryDumper(object_id_t objectId)
|
commandQueue = QueueFactory::instance()->createMessageQueue(QUEUE_SIZE);
|
||||||
: SystemObject(objectId), commandActionHelper(this), actionHelper(this, nullptr) {
|
|
||||||
auto mqArgs = MqArgs(this->getObjectId());
|
|
||||||
commandQueue = QueueFactory::instance()->createMessageQueue(
|
|
||||||
QUEUE_SIZE, MessageQueueMessage::MAX_MESSAGE_SIZE, &mqArgs);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
PlocMemoryDumper::~PlocMemoryDumper() {}
|
PlocMemoryDumper::~PlocMemoryDumper() {
|
||||||
|
}
|
||||||
|
|
||||||
ReturnValue_t PlocMemoryDumper::initialize() {
|
ReturnValue_t PlocMemoryDumper::initialize() {
|
||||||
|
|
||||||
ReturnValue_t result = SystemObject::initialize();
|
ReturnValue_t result = SystemObject::initialize();
|
||||||
if (result != HasReturnvaluesIF::RETURN_OK) {
|
if (result != HasReturnvaluesIF::RETURN_OK) {
|
||||||
return result;
|
return result;
|
||||||
@ -40,8 +38,9 @@ ReturnValue_t PlocMemoryDumper::performOperation(uint8_t operationCode) {
|
|||||||
return HasReturnvaluesIF::RETURN_OK;
|
return HasReturnvaluesIF::RETURN_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
ReturnValue_t PlocMemoryDumper::executeAction(ActionId_t actionId, MessageQueueId_t commandedBy,
|
ReturnValue_t PlocMemoryDumper::executeAction(ActionId_t actionId,
|
||||||
const uint8_t* data, size_t size) {
|
MessageQueueId_t commandedBy, const uint8_t* data, size_t size) {
|
||||||
|
|
||||||
if (state != State::IDLE) {
|
if (state != State::IDLE) {
|
||||||
return IS_BUSY;
|
return IS_BUSY;
|
||||||
}
|
}
|
||||||
@ -72,9 +71,13 @@ ReturnValue_t PlocMemoryDumper::executeAction(ActionId_t actionId, MessageQueueI
|
|||||||
return EXECUTION_FINISHED;
|
return EXECUTION_FINISHED;
|
||||||
}
|
}
|
||||||
|
|
||||||
MessageQueueId_t PlocMemoryDumper::getCommandQueue() const { return commandQueue->getId(); }
|
MessageQueueId_t PlocMemoryDumper::getCommandQueue() const {
|
||||||
|
return commandQueue->getId();
|
||||||
|
}
|
||||||
|
|
||||||
MessageQueueIF* PlocMemoryDumper::getCommandQueuePtr() { return commandQueue; }
|
MessageQueueIF* PlocMemoryDumper::getCommandQueuePtr() {
|
||||||
|
return commandQueue;
|
||||||
|
}
|
||||||
|
|
||||||
void PlocMemoryDumper::readCommandQueue() {
|
void PlocMemoryDumper::readCommandQueue() {
|
||||||
CommandMessage message;
|
CommandMessage message;
|
||||||
@ -118,12 +121,17 @@ void PlocMemoryDumper::doStateMachine() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void PlocMemoryDumper::stepSuccessfulReceived(ActionId_t actionId, uint8_t step) {}
|
void PlocMemoryDumper::stepSuccessfulReceived(ActionId_t actionId,
|
||||||
|
uint8_t step) {
|
||||||
|
}
|
||||||
|
|
||||||
void PlocMemoryDumper::stepFailedReceived(ActionId_t actionId, uint8_t step,
|
void PlocMemoryDumper::stepFailedReceived(ActionId_t actionId, uint8_t step,
|
||||||
ReturnValue_t returnCode) {}
|
ReturnValue_t returnCode) {
|
||||||
|
}
|
||||||
|
|
||||||
void PlocMemoryDumper::dataReceived(ActionId_t actionId, const uint8_t* data, uint32_t size) {}
|
void PlocMemoryDumper::dataReceived(ActionId_t actionId, const uint8_t* data, uint32_t size) {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
void PlocMemoryDumper::completionSuccessfulReceived(ActionId_t actionId) {
|
void PlocMemoryDumper::completionSuccessfulReceived(ActionId_t actionId) {
|
||||||
switch (pendingCommand) {
|
switch (pendingCommand) {
|
||||||
@ -132,7 +140,8 @@ void PlocMemoryDumper::completionSuccessfulReceived(ActionId_t actionId) {
|
|||||||
if (mram.endAddress == mram.startAddress) {
|
if (mram.endAddress == mram.startAddress) {
|
||||||
triggerEvent(MRAM_DUMP_FINISHED);
|
triggerEvent(MRAM_DUMP_FINISHED);
|
||||||
state = State::IDLE;
|
state = State::IDLE;
|
||||||
} else {
|
}
|
||||||
|
else {
|
||||||
state = State::COMMAND_CONSECUTIVE_MRAM_DUMP;
|
state = State::COMMAND_CONSECUTIVE_MRAM_DUMP;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
@ -144,7 +153,8 @@ void PlocMemoryDumper::completionSuccessfulReceived(ActionId_t actionId) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void PlocMemoryDumper::completionFailedReceived(ActionId_t actionId, ReturnValue_t returnCode) {
|
void PlocMemoryDumper::completionFailedReceived(ActionId_t actionId,
|
||||||
|
ReturnValue_t returnCode) {
|
||||||
switch(pendingCommand) {
|
switch(pendingCommand) {
|
||||||
case(PLOC_SPV::FIRST_MRAM_DUMP):
|
case(PLOC_SPV::FIRST_MRAM_DUMP):
|
||||||
case(PLOC_SPV::CONSECUTIVE_MRAM_DUMP):
|
case(PLOC_SPV::CONSECUTIVE_MRAM_DUMP):
|
||||||
@ -169,7 +179,8 @@ void PlocMemoryDumper::commandNextMramDump(ActionId_t dumpCommand) {
|
|||||||
tempEndAddress = mram.startAddress + MAX_MRAM_DUMP_SIZE;
|
tempEndAddress = mram.startAddress + MAX_MRAM_DUMP_SIZE;
|
||||||
mram.startAddress += MAX_MRAM_DUMP_SIZE;
|
mram.startAddress += MAX_MRAM_DUMP_SIZE;
|
||||||
mram.lastStartAddress = tempStartAddress;
|
mram.lastStartAddress = tempStartAddress;
|
||||||
} else {
|
}
|
||||||
|
else {
|
||||||
tempStartAddress = mram.startAddress;
|
tempStartAddress = mram.startAddress;
|
||||||
tempEndAddress = mram.endAddress;
|
tempEndAddress = mram.endAddress;
|
||||||
mram.startAddress = mram.endAddress;
|
mram.startAddress = mram.endAddress;
|
||||||
@ -177,8 +188,8 @@ void PlocMemoryDumper::commandNextMramDump(ActionId_t dumpCommand) {
|
|||||||
|
|
||||||
MemoryParams params(tempStartAddress, tempEndAddress);
|
MemoryParams params(tempStartAddress, tempEndAddress);
|
||||||
|
|
||||||
result =
|
result = commandActionHelper.commandAction(objects::PLOC_SUPERVISOR_HANDLER,
|
||||||
commandActionHelper.commandAction(objects::PLOC_SUPERVISOR_HANDLER, dumpCommand, ¶ms);
|
dumpCommand, ¶ms);
|
||||||
if (result != RETURN_OK) {
|
if (result != RETURN_OK) {
|
||||||
sif::warning << "PlocMemoryDumper::commandNextMramDump: Failed to send mram dump command "
|
sif::warning << "PlocMemoryDumper::commandNextMramDump: Failed to send mram dump command "
|
||||||
<< "with start address " << tempStartAddress << " and end address "
|
<< "with start address " << tempStartAddress << " and end address "
|
||||||
@ -192,3 +203,4 @@ void PlocMemoryDumper::commandNextMramDump(ActionId_t dumpCommand) {
|
|||||||
pendingCommand = dumpCommand;
|
pendingCommand = dumpCommand;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -3,18 +3,18 @@
|
|||||||
|
|
||||||
#include <bsp_q7s/devices/devicedefinitions/PlocMemDumpDefinitions.h>
|
#include <bsp_q7s/devices/devicedefinitions/PlocMemDumpDefinitions.h>
|
||||||
#include <bsp_q7s/devices/devicedefinitions/PlocSupervisorDefinitions.h>
|
#include <bsp_q7s/devices/devicedefinitions/PlocSupervisorDefinitions.h>
|
||||||
|
|
||||||
#include "OBSWConfig.h"
|
#include "OBSWConfig.h"
|
||||||
#include "bsp_q7s/memory/SdCardManager.h"
|
|
||||||
#include "fsfw/action/ActionHelper.h"
|
|
||||||
#include "fsfw/action/CommandActionHelper.h"
|
#include "fsfw/action/CommandActionHelper.h"
|
||||||
#include "fsfw/action/CommandsActionsIF.h"
|
#include "fsfw/action/ActionHelper.h"
|
||||||
#include "fsfw/action/HasActionsIF.h"
|
#include "fsfw/action/HasActionsIF.h"
|
||||||
#include "fsfw/objectmanager/SystemObject.h"
|
#include "fsfw/action/CommandsActionsIF.h"
|
||||||
#include "fsfw/returnvalues/HasReturnvaluesIF.h"
|
#include "fsfw/returnvalues/HasReturnvaluesIF.h"
|
||||||
#include "fsfw/tasks/ExecutableObjectIF.h"
|
#include "fsfw/tasks/ExecutableObjectIF.h"
|
||||||
#include "fsfw/tmtcpacket/SpacePacket.h"
|
#include "fsfw/objectmanager/SystemObject.h"
|
||||||
|
#include "bsp_q7s/memory/SdCardManager.h"
|
||||||
#include "linux/fsfwconfig/objects/systemObjectList.h"
|
#include "linux/fsfwconfig/objects/systemObjectList.h"
|
||||||
|
#include "fsfw/tmtcpacket/SpacePacket.h"
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Because the buffer of the linux tty driver is limited to 2 x 65535 bytes, this class is
|
* @brief Because the buffer of the linux tty driver is limited to 2 x 65535 bytes, this class is
|
||||||
@ -30,6 +30,7 @@ class PlocMemoryDumper : public SystemObject,
|
|||||||
public HasReturnvaluesIF,
|
public HasReturnvaluesIF,
|
||||||
public CommandsActionsIF {
|
public CommandsActionsIF {
|
||||||
public:
|
public:
|
||||||
|
|
||||||
static const ActionId_t NONE = 0;
|
static const ActionId_t NONE = 0;
|
||||||
static const ActionId_t DUMP_MRAM = 1;
|
static const ActionId_t DUMP_MRAM = 1;
|
||||||
|
|
||||||
@ -49,12 +50,12 @@ class PlocMemoryDumper : public SystemObject,
|
|||||||
void completionFailedReceived(ActionId_t actionId, ReturnValue_t returnCode) override;
|
void completionFailedReceived(ActionId_t actionId, ReturnValue_t returnCode) override;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
|
||||||
static const uint32_t QUEUE_SIZE = 10;
|
static const uint32_t QUEUE_SIZE = 10;
|
||||||
|
|
||||||
static const uint8_t INTERFACE_ID = CLASS_ID::PLOC_MEMORY_DUMPER;
|
static const uint8_t INTERFACE_ID = CLASS_ID::PLOC_MEMORY_DUMPER;
|
||||||
|
|
||||||
//! [EXPORT] : [COMMENT] The capacity of the MRAM amounts to 512 kB. Thus the maximum address must
|
//! [EXPORT] : [COMMENT] The capacity of the MRAM amounts to 512 kB. Thus the maximum address must not be higher than 0x7d000.
|
||||||
//! not be higher than 0x7d000.
|
|
||||||
static const ReturnValue_t MRAM_ADDRESS_TOO_HIGH = MAKE_RETURN_CODE(0xA0);
|
static const ReturnValue_t MRAM_ADDRESS_TOO_HIGH = MAKE_RETURN_CODE(0xA0);
|
||||||
//! [EXPORT] : [COMMENT] The specified end address is lower than the start address
|
//! [EXPORT] : [COMMENT] The specified end address is lower than the start address
|
||||||
static const ReturnValue_t MRAM_INVALID_ADDRESS_COMBINATION = MAKE_RETURN_CODE(0xA1);
|
static const ReturnValue_t MRAM_INVALID_ADDRESS_COMBINATION = MAKE_RETURN_CODE(0xA1);
|
||||||
|
@ -1,28 +1,26 @@
|
|||||||
#include "PlocSupervisorHandler.h"
|
|
||||||
|
|
||||||
#include <fsfw/datapool/PoolReadGuard.h>
|
|
||||||
#include <fsfw/globalfunctions/CRC.h>
|
|
||||||
#include <fsfw/timemanager/Clock.h>
|
|
||||||
|
|
||||||
#include <filesystem>
|
|
||||||
#include <fstream>
|
|
||||||
#include <sstream>
|
#include <sstream>
|
||||||
#include <string>
|
#include <string>
|
||||||
|
#include <fstream>
|
||||||
|
#include <filesystem>
|
||||||
|
|
||||||
|
#include "PlocSupervisorHandler.h"
|
||||||
#include "OBSWConfig.h"
|
#include "OBSWConfig.h"
|
||||||
|
|
||||||
|
#include <fsfw/globalfunctions/CRC.h>
|
||||||
|
#include <fsfw/datapool/PoolReadGuard.h>
|
||||||
|
#include <fsfw/timemanager/Clock.h>
|
||||||
|
|
||||||
PlocSupervisorHandler::PlocSupervisorHandler(object_id_t objectId, object_id_t uartComIFid,
|
PlocSupervisorHandler::PlocSupervisorHandler(object_id_t objectId, object_id_t uartComIFid,
|
||||||
CookieIF* comCookie)
|
CookieIF * comCookie) :
|
||||||
: DeviceHandlerBase(objectId, uartComIFid, comCookie),
|
DeviceHandlerBase(objectId, uartComIFid, comCookie), hkset(this), bootStatusReport(this), latchupStatusReport(
|
||||||
hkset(this),
|
this) {
|
||||||
bootStatusReport(this),
|
|
||||||
latchupStatusReport(this) {
|
|
||||||
if (comCookie == NULL) {
|
if (comCookie == NULL) {
|
||||||
sif::error << "PlocSupervisorHandler: Invalid com cookie" << std::endl;
|
sif::error << "PlocSupervisorHandler: Invalid com cookie" << std::endl;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
PlocSupervisorHandler::~PlocSupervisorHandler() {}
|
PlocSupervisorHandler::~PlocSupervisorHandler() {
|
||||||
|
}
|
||||||
|
|
||||||
ReturnValue_t PlocSupervisorHandler::initialize() {
|
ReturnValue_t PlocSupervisorHandler::initialize() {
|
||||||
ReturnValue_t result = RETURN_OK;
|
ReturnValue_t result = RETURN_OK;
|
||||||
@ -43,6 +41,7 @@ ReturnValue_t PlocSupervisorHandler::initialize() {
|
|||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void PlocSupervisorHandler::doStartUp(){
|
void PlocSupervisorHandler::doStartUp(){
|
||||||
#if OBSW_SWITCH_TO_NORMAL_MODE_AFTER_STARTUP == 1
|
#if OBSW_SWITCH_TO_NORMAL_MODE_AFTER_STARTUP == 1
|
||||||
setMode(MODE_NORMAL);
|
setMode(MODE_NORMAL);
|
||||||
@ -51,18 +50,22 @@ void PlocSupervisorHandler::doStartUp() {
|
|||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
void PlocSupervisorHandler::doShutDown() { setMode(_MODE_POWER_DOWN); }
|
void PlocSupervisorHandler::doShutDown(){
|
||||||
|
setMode(_MODE_POWER_DOWN);
|
||||||
|
}
|
||||||
|
|
||||||
ReturnValue_t PlocSupervisorHandler::buildNormalDeviceCommand(DeviceCommandId_t* id) {
|
ReturnValue_t PlocSupervisorHandler::buildNormalDeviceCommand(
|
||||||
|
DeviceCommandId_t * id) {
|
||||||
return NOTHING_TO_SEND;
|
return NOTHING_TO_SEND;
|
||||||
}
|
}
|
||||||
|
|
||||||
ReturnValue_t PlocSupervisorHandler::buildTransitionDeviceCommand(DeviceCommandId_t* id) {
|
ReturnValue_t PlocSupervisorHandler::buildTransitionDeviceCommand(
|
||||||
|
DeviceCommandId_t * id){
|
||||||
return NOTHING_TO_SEND;
|
return NOTHING_TO_SEND;
|
||||||
}
|
}
|
||||||
|
|
||||||
ReturnValue_t PlocSupervisorHandler::buildCommandFromCommand(DeviceCommandId_t deviceCommand,
|
ReturnValue_t PlocSupervisorHandler::buildCommandFromCommand(
|
||||||
const uint8_t* commandData,
|
DeviceCommandId_t deviceCommand, const uint8_t * commandData,
|
||||||
size_t commandDataLen) {
|
size_t commandDataLen) {
|
||||||
ReturnValue_t result = RETURN_FAILED;
|
ReturnValue_t result = RETURN_FAILED;
|
||||||
switch(deviceCommand) {
|
switch(deviceCommand) {
|
||||||
@ -327,12 +330,14 @@ void PlocSupervisorHandler::fillCommandAndReplyMap() {
|
|||||||
PLOC_SPV::SIZE_LATCHUP_STATUS_REPORT);
|
PLOC_SPV::SIZE_LATCHUP_STATUS_REPORT);
|
||||||
}
|
}
|
||||||
|
|
||||||
ReturnValue_t PlocSupervisorHandler::scanForReply(const uint8_t* start, size_t remainingSize,
|
ReturnValue_t PlocSupervisorHandler::scanForReply(const uint8_t *start,
|
||||||
DeviceCommandId_t* foundId, size_t* foundLen) {
|
size_t remainingSize, DeviceCommandId_t *foundId, size_t *foundLen) {
|
||||||
|
|
||||||
if (nextReplyId == PLOC_SPV::FIRST_MRAM_DUMP) {
|
if (nextReplyId == PLOC_SPV::FIRST_MRAM_DUMP) {
|
||||||
*foundId = PLOC_SPV::FIRST_MRAM_DUMP;
|
*foundId = PLOC_SPV::FIRST_MRAM_DUMP;
|
||||||
return parseMramPackets(start, remainingSize, foundLen);
|
return parseMramPackets(start, remainingSize, foundLen);
|
||||||
} else if (nextReplyId == PLOC_SPV::CONSECUTIVE_MRAM_DUMP) {
|
}
|
||||||
|
else if (nextReplyId == PLOC_SPV::CONSECUTIVE_MRAM_DUMP) {
|
||||||
*foundId = PLOC_SPV::CONSECUTIVE_MRAM_DUMP;
|
*foundId = PLOC_SPV::CONSECUTIVE_MRAM_DUMP;
|
||||||
return parseMramPackets(start, remainingSize, foundLen);
|
return parseMramPackets(start, remainingSize, foundLen);
|
||||||
}
|
}
|
||||||
@ -382,6 +387,7 @@ ReturnValue_t PlocSupervisorHandler::scanForReply(const uint8_t* start, size_t r
|
|||||||
|
|
||||||
ReturnValue_t PlocSupervisorHandler::interpretDeviceReply(DeviceCommandId_t id,
|
ReturnValue_t PlocSupervisorHandler::interpretDeviceReply(DeviceCommandId_t id,
|
||||||
const uint8_t *packet) {
|
const uint8_t *packet) {
|
||||||
|
|
||||||
ReturnValue_t result = RETURN_OK;
|
ReturnValue_t result = RETURN_OK;
|
||||||
|
|
||||||
switch (id) {
|
switch (id) {
|
||||||
@ -410,8 +416,7 @@ ReturnValue_t PlocSupervisorHandler::interpretDeviceReply(DeviceCommandId_t id,
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
default: {
|
default: {
|
||||||
sif::debug << "PlocSupervisorHandler::interpretDeviceReply: Unknown device reply id"
|
sif::debug << "PlocSupervisorHandler::interpretDeviceReply: Unknown device reply id" << std::endl;
|
||||||
<< std::endl;
|
|
||||||
return DeviceHandlerIF::UNKNOWN_DEVICE_REPLY;
|
return DeviceHandlerIF::UNKNOWN_DEVICE_REPLY;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -419,12 +424,17 @@ ReturnValue_t PlocSupervisorHandler::interpretDeviceReply(DeviceCommandId_t id,
|
|||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
void PlocSupervisorHandler::setNormalDatapoolEntriesInvalid() {}
|
void PlocSupervisorHandler::setNormalDatapoolEntriesInvalid(){
|
||||||
|
|
||||||
uint32_t PlocSupervisorHandler::getTransitionDelayMs(Mode_t modeFrom, Mode_t modeTo) { return 500; }
|
}
|
||||||
|
|
||||||
|
uint32_t PlocSupervisorHandler::getTransitionDelayMs(Mode_t modeFrom, Mode_t modeTo){
|
||||||
|
return 500;
|
||||||
|
}
|
||||||
|
|
||||||
ReturnValue_t PlocSupervisorHandler::initializeLocalDataPool(localpool::DataPool& localDataPoolMap,
|
ReturnValue_t PlocSupervisorHandler::initializeLocalDataPool(localpool::DataPool& localDataPoolMap,
|
||||||
LocalDataPoolManager& poolManager) {
|
LocalDataPoolManager& poolManager) {
|
||||||
|
|
||||||
localDataPoolMap.emplace(PLOC_SPV::NUM_TMS, new PoolEntry<uint32_t>( { 0 }));
|
localDataPoolMap.emplace(PLOC_SPV::NUM_TMS, new PoolEntry<uint32_t>( { 0 }));
|
||||||
localDataPoolMap.emplace(PLOC_SPV::TEMP_PS, new PoolEntry<uint32_t>( { 0 }));
|
localDataPoolMap.emplace(PLOC_SPV::TEMP_PS, new PoolEntry<uint32_t>( { 0 }));
|
||||||
localDataPoolMap.emplace(PLOC_SPV::TEMP_PL, new PoolEntry<uint32_t>( { 0 }));
|
localDataPoolMap.emplace(PLOC_SPV::TEMP_PL, new PoolEntry<uint32_t>( { 0 }));
|
||||||
@ -468,9 +478,9 @@ ReturnValue_t PlocSupervisorHandler::initializeLocalDataPool(localpool::DataPool
|
|||||||
}
|
}
|
||||||
|
|
||||||
ReturnValue_t PlocSupervisorHandler::enableReplyInReplyMap(DeviceCommandMap::iterator command,
|
ReturnValue_t PlocSupervisorHandler::enableReplyInReplyMap(DeviceCommandMap::iterator command,
|
||||||
uint8_t expectedReplies,
|
uint8_t expectedReplies, bool useAlternateId,
|
||||||
bool useAlternateId,
|
|
||||||
DeviceCommandId_t alternateReplyID) {
|
DeviceCommandId_t alternateReplyID) {
|
||||||
|
|
||||||
ReturnValue_t result = RETURN_OK;
|
ReturnValue_t result = RETURN_OK;
|
||||||
|
|
||||||
uint8_t enabledReplies = 0;
|
uint8_t enabledReplies = 0;
|
||||||
@ -575,15 +585,15 @@ ReturnValue_t PlocSupervisorHandler::enableReplyInReplyMap(DeviceCommandMap::ite
|
|||||||
* Every command causes at least one acknowledgment and one execution report. Therefore both
|
* Every command causes at least one acknowledgment and one execution report. Therefore both
|
||||||
* replies will be enabled here.
|
* replies will be enabled here.
|
||||||
*/
|
*/
|
||||||
result =
|
result = DeviceHandlerBase::enableReplyInReplyMap(command, enabledReplies, true,
|
||||||
DeviceHandlerBase::enableReplyInReplyMap(command, enabledReplies, true, PLOC_SPV::ACK_REPORT);
|
PLOC_SPV::ACK_REPORT);
|
||||||
if (result != RETURN_OK) {
|
if (result != RETURN_OK) {
|
||||||
sif::debug << "PlocSupervisorHandler::enableReplyInReplyMap: Reply with id "
|
sif::debug << "PlocSupervisorHandler::enableReplyInReplyMap: Reply with id "
|
||||||
<< PLOC_SPV::ACK_REPORT << " not in replyMap" << std::endl;
|
<< PLOC_SPV::ACK_REPORT << " not in replyMap" << std::endl;
|
||||||
}
|
}
|
||||||
|
|
||||||
result =
|
result = DeviceHandlerBase::enableReplyInReplyMap(command, enabledReplies, true,
|
||||||
DeviceHandlerBase::enableReplyInReplyMap(command, enabledReplies, true, PLOC_SPV::EXE_REPORT);
|
PLOC_SPV::EXE_REPORT);
|
||||||
if (result != RETURN_OK) {
|
if (result != RETURN_OK) {
|
||||||
sif::debug << "PlocSupervisorHandler::enableReplyInReplyMap: Reply with id "
|
sif::debug << "PlocSupervisorHandler::enableReplyInReplyMap: Reply with id "
|
||||||
<< PLOC_SPV::EXE_REPORT << " not in replyMap" << std::endl;
|
<< PLOC_SPV::EXE_REPORT << " not in replyMap" << std::endl;
|
||||||
@ -593,6 +603,7 @@ ReturnValue_t PlocSupervisorHandler::enableReplyInReplyMap(DeviceCommandMap::ite
|
|||||||
}
|
}
|
||||||
|
|
||||||
ReturnValue_t PlocSupervisorHandler::verifyPacket(const uint8_t* start, size_t foundLen) {
|
ReturnValue_t PlocSupervisorHandler::verifyPacket(const uint8_t* start, size_t foundLen) {
|
||||||
|
|
||||||
uint16_t receivedCrc = *(start + foundLen - 2) << 8 | *(start + foundLen - 1);
|
uint16_t receivedCrc = *(start + foundLen - 2) << 8 | *(start + foundLen - 1);
|
||||||
|
|
||||||
uint16_t recalculatedCrc = CRC::crc16ccitt(start, foundLen - 2);
|
uint16_t recalculatedCrc = CRC::crc16ccitt(start, foundLen - 2);
|
||||||
@ -605,6 +616,7 @@ ReturnValue_t PlocSupervisorHandler::verifyPacket(const uint8_t* start, size_t f
|
|||||||
}
|
}
|
||||||
|
|
||||||
ReturnValue_t PlocSupervisorHandler::handleAckReport(const uint8_t* data) {
|
ReturnValue_t PlocSupervisorHandler::handleAckReport(const uint8_t* data) {
|
||||||
|
|
||||||
ReturnValue_t result = RETURN_OK;
|
ReturnValue_t result = RETURN_OK;
|
||||||
|
|
||||||
result = verifyPacket(data, PLOC_SPV::SIZE_ACK_REPORT);
|
result = verifyPacket(data, PLOC_SPV::SIZE_ACK_REPORT);
|
||||||
@ -623,8 +635,7 @@ ReturnValue_t PlocSupervisorHandler::handleAckReport(const uint8_t* data) {
|
|||||||
switch(apid) {
|
switch(apid) {
|
||||||
case PLOC_SPV::APID_ACK_FAILURE: {
|
case PLOC_SPV::APID_ACK_FAILURE: {
|
||||||
//TODO: Interpretation of status field in acknowledgment report
|
//TODO: Interpretation of status field in acknowledgment report
|
||||||
sif::debug << "PlocSupervisorHandler::handleAckReport: Received Ack failure report"
|
sif::debug << "PlocSupervisorHandler::handleAckReport: Received Ack failure report" << std::endl;
|
||||||
<< std::endl;
|
|
||||||
DeviceCommandId_t commandId = getPendingCommand();
|
DeviceCommandId_t commandId = getPendingCommand();
|
||||||
if (commandId != DeviceHandlerIF::NO_COMMAND_ID) {
|
if (commandId != DeviceHandlerIF::NO_COMMAND_ID) {
|
||||||
triggerEvent(SUPV_ACK_FAILURE, commandId);
|
triggerEvent(SUPV_ACK_FAILURE, commandId);
|
||||||
@ -640,8 +651,7 @@ ReturnValue_t PlocSupervisorHandler::handleAckReport(const uint8_t* data) {
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
default: {
|
default: {
|
||||||
sif::debug << "PlocSupervisorHandler::handleAckReport: Invalid APID in Ack report"
|
sif::debug << "PlocSupervisorHandler::handleAckReport: Invalid APID in Ack report" << std::endl;
|
||||||
<< std::endl;
|
|
||||||
result = RETURN_FAILED;
|
result = RETURN_FAILED;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@ -651,6 +661,7 @@ ReturnValue_t PlocSupervisorHandler::handleAckReport(const uint8_t* data) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
ReturnValue_t PlocSupervisorHandler::handleExecutionReport(const uint8_t* data) {
|
ReturnValue_t PlocSupervisorHandler::handleExecutionReport(const uint8_t* data) {
|
||||||
|
|
||||||
ReturnValue_t result = RETURN_OK;
|
ReturnValue_t result = RETURN_OK;
|
||||||
|
|
||||||
result = verifyPacket(data, PLOC_SPV::SIZE_EXE_REPORT);
|
result = verifyPacket(data, PLOC_SPV::SIZE_EXE_REPORT);
|
||||||
@ -668,15 +679,14 @@ ReturnValue_t PlocSupervisorHandler::handleExecutionReport(const uint8_t* data)
|
|||||||
}
|
}
|
||||||
case (PLOC_SPV::APID_EXE_FAILURE): {
|
case (PLOC_SPV::APID_EXE_FAILURE): {
|
||||||
//TODO: Interpretation of status field in execution report
|
//TODO: Interpretation of status field in execution report
|
||||||
sif::error
|
sif::error << "PlocSupervisorHandler::handleExecutionReport: Received execution failure report"
|
||||||
<< "PlocSupervisorHandler::handleExecutionReport: Received execution failure report"
|
|
||||||
<< std::endl;
|
<< std::endl;
|
||||||
DeviceCommandId_t commandId = getPendingCommand();
|
DeviceCommandId_t commandId = getPendingCommand();
|
||||||
if (commandId != DeviceHandlerIF::NO_COMMAND_ID) {
|
if (commandId != DeviceHandlerIF::NO_COMMAND_ID) {
|
||||||
triggerEvent(SUPV_EXE_FAILURE, commandId);
|
triggerEvent(SUPV_EXE_FAILURE, commandId);
|
||||||
} else {
|
}
|
||||||
sif::debug << "PlocSupervisorHandler::handleExecutionReport: Unknown command id"
|
else {
|
||||||
<< std::endl;
|
sif::debug << "PlocSupervisorHandler::handleExecutionReport: Unknown command id" << std::endl;
|
||||||
}
|
}
|
||||||
sendFailureReport(PLOC_SPV::EXE_REPORT, RECEIVED_EXE_FAILURE);
|
sendFailureReport(PLOC_SPV::EXE_REPORT, RECEIVED_EXE_FAILURE);
|
||||||
disableExeReportReply();
|
disableExeReportReply();
|
||||||
@ -696,41 +706,43 @@ ReturnValue_t PlocSupervisorHandler::handleExecutionReport(const uint8_t* data)
|
|||||||
}
|
}
|
||||||
|
|
||||||
ReturnValue_t PlocSupervisorHandler::handleHkReport(const uint8_t* data) {
|
ReturnValue_t PlocSupervisorHandler::handleHkReport(const uint8_t* data) {
|
||||||
|
|
||||||
ReturnValue_t result = RETURN_OK;
|
ReturnValue_t result = RETURN_OK;
|
||||||
|
|
||||||
result = verifyPacket(data, PLOC_SPV::SIZE_HK_REPORT);
|
result = verifyPacket(data, PLOC_SPV::SIZE_HK_REPORT);
|
||||||
|
|
||||||
if(result == CRC_FAILURE) {
|
if(result == CRC_FAILURE) {
|
||||||
sif::error << "PlocSupervisorHandler::handleHkReport: Hk report has invalid crc" << std::endl;
|
sif::error << "PlocSupervisorHandler::handleHkReport: Hk report has invalid crc"
|
||||||
|
<< std::endl;
|
||||||
}
|
}
|
||||||
|
|
||||||
uint16_t offset = PLOC_SPV::DATA_FIELD_OFFSET;
|
uint16_t offset = PLOC_SPV::DATA_FIELD_OFFSET;
|
||||||
hkset.tempPs = *(data + offset) << 24 | *(data + offset + 1) << 16 | *(data + offset + 2) << 8 |
|
hkset.tempPs = *(data + offset) << 24 | *(data + offset + 1) << 16 | *(data + offset + 2) << 8
|
||||||
*(data + offset + 3);
|
| *(data + offset + 3);
|
||||||
offset += 4;
|
offset += 4;
|
||||||
hkset.tempPl = *(data + offset) << 24 | *(data + offset + 1) << 16 | *(data + offset + 2) << 8 |
|
hkset.tempPl = *(data + offset) << 24 | *(data + offset + 1) << 16 | *(data + offset + 2) << 8
|
||||||
*(data + offset + 3);
|
| *(data + offset + 3);
|
||||||
offset += 4;
|
offset += 4;
|
||||||
hkset.tempSup = *(data + offset) << 24 | *(data + offset + 1) << 16 | *(data + offset + 2) << 8 |
|
hkset.tempSup = *(data + offset) << 24 | *(data + offset + 1) << 16 | *(data + offset + 2) << 8
|
||||||
*(data + offset + 3);
|
| *(data + offset + 3);
|
||||||
offset += 4;
|
offset += 4;
|
||||||
hkset.uptime = *(data + offset) << 24 | *(data + offset + 1) << 16 | *(data + offset + 2) << 8 |
|
hkset.uptime = *(data + offset) << 24 | *(data + offset + 1) << 16 | *(data + offset + 2) << 8
|
||||||
*(data + offset + 3);
|
| *(data + offset + 3);
|
||||||
offset += 4;
|
offset += 4;
|
||||||
hkset.cpuLoad = *(data + offset) << 24 | *(data + offset + 1) << 16 | *(data + offset + 2) << 8 |
|
hkset.cpuLoad = *(data + offset) << 24 | *(data + offset + 1) << 16 | *(data + offset + 2) << 8
|
||||||
*(data + offset + 3);
|
| *(data + offset + 3);
|
||||||
offset += 4;
|
offset += 4;
|
||||||
hkset.availableHeap = *(data + offset) << 24 | *(data + offset + 1) << 16 |
|
hkset.availableHeap = *(data + offset) << 24 | *(data + offset + 1) << 16 | *(data + offset + 2) << 8
|
||||||
*(data + offset + 2) << 8 | *(data + offset + 3);
|
| *(data + offset + 3);
|
||||||
offset += 4;
|
offset += 4;
|
||||||
hkset.numTcs = *(data + offset) << 24 | *(data + offset + 1) << 16 | *(data + offset + 2) << 8 |
|
hkset.numTcs = *(data + offset) << 24 | *(data + offset + 1) << 16 | *(data + offset + 2) << 8
|
||||||
*(data + offset + 3);
|
| *(data + offset + 3);
|
||||||
offset += 4;
|
offset += 4;
|
||||||
hkset.numTms = *(data + offset) << 24 | *(data + offset + 1) << 16 | *(data + offset + 2) << 8 |
|
hkset.numTms = *(data + offset) << 24 | *(data + offset + 1) << 16 | *(data + offset + 2) << 8
|
||||||
*(data + offset + 3);
|
| *(data + offset + 3);
|
||||||
offset += 4;
|
offset += 4;
|
||||||
hkset.socState = *(data + offset) << 24 | *(data + offset + 1) << 16 | *(data + offset + 2) << 8 |
|
hkset.socState = *(data + offset) << 24 | *(data + offset + 1) << 16 | *(data + offset + 2) << 8
|
||||||
*(data + offset + 3);
|
| *(data + offset + 3);
|
||||||
offset += 4;
|
offset += 4;
|
||||||
hkset.nvm0_1_state = *(data + offset);
|
hkset.nvm0_1_state = *(data + offset);
|
||||||
offset += 1;
|
offset += 1;
|
||||||
@ -749,8 +761,7 @@ ReturnValue_t PlocSupervisorHandler::handleHkReport(const uint8_t* data) {
|
|||||||
sif::info << "PlocSupervisorHandler::handleHkReport: temp_sup: " << hkset.tempSup << std::endl;
|
sif::info << "PlocSupervisorHandler::handleHkReport: temp_sup: " << hkset.tempSup << std::endl;
|
||||||
sif::info << "PlocSupervisorHandler::handleHkReport: uptime: " << hkset.uptime << std::endl;
|
sif::info << "PlocSupervisorHandler::handleHkReport: uptime: " << hkset.uptime << std::endl;
|
||||||
sif::info << "PlocSupervisorHandler::handleHkReport: cpu_load: " << hkset.cpuLoad << std::endl;
|
sif::info << "PlocSupervisorHandler::handleHkReport: cpu_load: " << hkset.cpuLoad << std::endl;
|
||||||
sif::info << "PlocSupervisorHandler::handleHkReport: available_heap: " << hkset.availableHeap
|
sif::info << "PlocSupervisorHandler::handleHkReport: available_heap: " << hkset.availableHeap << std::endl;
|
||||||
<< std::endl;
|
|
||||||
sif::info << "PlocSupervisorHandler::handleHkReport: num_tcs: " << hkset.numTcs << std::endl;
|
sif::info << "PlocSupervisorHandler::handleHkReport: num_tcs: " << hkset.numTcs << std::endl;
|
||||||
sif::info << "PlocSupervisorHandler::handleHkReport: num_tms: " << hkset.numTms << std::endl;
|
sif::info << "PlocSupervisorHandler::handleHkReport: num_tms: " << hkset.numTms << std::endl;
|
||||||
sif::info << "PlocSupervisorHandler::handleHkReport: soc_state: " << hkset.socState << std::endl;
|
sif::info << "PlocSupervisorHandler::handleHkReport: soc_state: " << hkset.socState << std::endl;
|
||||||
@ -769,14 +780,14 @@ ReturnValue_t PlocSupervisorHandler::handleHkReport(const uint8_t* data) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
ReturnValue_t PlocSupervisorHandler::handleBootStatusReport(const uint8_t* data) {
|
ReturnValue_t PlocSupervisorHandler::handleBootStatusReport(const uint8_t* data) {
|
||||||
|
|
||||||
ReturnValue_t result = RETURN_OK;
|
ReturnValue_t result = RETURN_OK;
|
||||||
|
|
||||||
result = verifyPacket(data, PLOC_SPV::SIZE_BOOT_STATUS_REPORT);
|
result = verifyPacket(data, PLOC_SPV::SIZE_BOOT_STATUS_REPORT);
|
||||||
|
|
||||||
if(result == CRC_FAILURE) {
|
if(result == CRC_FAILURE) {
|
||||||
sif::error << "PlocSupervisorHandler::handleBootStatusReport: Boot status report has invalid"
|
sif::error << "PlocSupervisorHandler::handleBootStatusReport: Boot status report has invalid"
|
||||||
" crc"
|
" crc" << std::endl;
|
||||||
<< std::endl;
|
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -824,6 +835,7 @@ ReturnValue_t PlocSupervisorHandler::handleBootStatusReport(const uint8_t* data)
|
|||||||
}
|
}
|
||||||
|
|
||||||
ReturnValue_t PlocSupervisorHandler::handleLatchupStatusReport(const uint8_t* data) {
|
ReturnValue_t PlocSupervisorHandler::handleLatchupStatusReport(const uint8_t* data) {
|
||||||
|
|
||||||
ReturnValue_t result = RETURN_OK;
|
ReturnValue_t result = RETURN_OK;
|
||||||
|
|
||||||
result = verifyPacket(data, PLOC_SPV::SIZE_LATCHUP_STATUS_REPORT);
|
result = verifyPacket(data, PLOC_SPV::SIZE_LATCHUP_STATUS_REPORT);
|
||||||
@ -909,8 +921,8 @@ ReturnValue_t PlocSupervisorHandler::handleLatchupStatusReport(const uint8_t* da
|
|||||||
<< latchupStatusReport.timeYear << std::endl;
|
<< latchupStatusReport.timeYear << std::endl;
|
||||||
sif::info << "PlocSupervisorHandler::handleLatchupStatusReport: Msec: "
|
sif::info << "PlocSupervisorHandler::handleLatchupStatusReport: Msec: "
|
||||||
<< latchupStatusReport.timeMsec << std::endl;
|
<< latchupStatusReport.timeMsec << std::endl;
|
||||||
sif::info << "PlocSupervisorHandler::handleLatchupStatusReport: isSet: 0x" << std::hex
|
sif::info << "PlocSupervisorHandler::handleLatchupStatusReport: isSet: 0x"
|
||||||
<< latchupStatusReport.timeMsec << std::dec << std::endl;
|
<< std::hex << latchupStatusReport.timeMsec << std::dec << std::endl;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
return result;
|
return result;
|
||||||
@ -941,13 +953,15 @@ void PlocSupervisorHandler::setNextReplyId() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
size_t PlocSupervisorHandler::getNextReplyLength(DeviceCommandId_t commandId){
|
size_t PlocSupervisorHandler::getNextReplyLength(DeviceCommandId_t commandId){
|
||||||
|
|
||||||
size_t replyLen = 0;
|
size_t replyLen = 0;
|
||||||
|
|
||||||
if (nextReplyId == PLOC_SPV::NONE) {
|
if (nextReplyId == PLOC_SPV::NONE) {
|
||||||
return replyLen;
|
return replyLen;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (nextReplyId == PLOC_SPV::FIRST_MRAM_DUMP || nextReplyId == PLOC_SPV::CONSECUTIVE_MRAM_DUMP) {
|
if (nextReplyId == PLOC_SPV::FIRST_MRAM_DUMP
|
||||||
|
|| nextReplyId == PLOC_SPV::CONSECUTIVE_MRAM_DUMP) {
|
||||||
/**
|
/**
|
||||||
* Try to read 20 MRAM packets. If reply is larger, the packets will be read with the
|
* Try to read 20 MRAM packets. If reply is larger, the packets will be read with the
|
||||||
* next doSendRead call. The command will be as long active as the packet with the sequence
|
* next doSendRead call. The command will be as long active as the packet with the sequence
|
||||||
@ -964,7 +978,8 @@ size_t PlocSupervisorHandler::getNextReplyLength(DeviceCommandId_t commandId) {
|
|||||||
return replyLen;
|
return replyLen;
|
||||||
}
|
}
|
||||||
replyLen = iter->second.replyLen;
|
replyLen = iter->second.replyLen;
|
||||||
} else {
|
}
|
||||||
|
else {
|
||||||
sif::debug << "PlocSupervisorHandler::getNextReplyLength: No entry for reply with reply id "
|
sif::debug << "PlocSupervisorHandler::getNextReplyLength: No entry for reply with reply id "
|
||||||
<< std::hex << nextReplyId << " in deviceReplyMap" << std::endl;
|
<< std::hex << nextReplyId << " in deviceReplyMap" << std::endl;
|
||||||
}
|
}
|
||||||
@ -972,8 +987,8 @@ size_t PlocSupervisorHandler::getNextReplyLength(DeviceCommandId_t commandId) {
|
|||||||
return replyLen;
|
return replyLen;
|
||||||
}
|
}
|
||||||
|
|
||||||
void PlocSupervisorHandler::handleDeviceTM(const uint8_t* data, size_t dataSize,
|
void PlocSupervisorHandler::handleDeviceTM(const uint8_t* data, size_t dataSize, DeviceCommandId_t replyId) {
|
||||||
DeviceCommandId_t replyId) {
|
|
||||||
ReturnValue_t result = RETURN_OK;
|
ReturnValue_t result = RETURN_OK;
|
||||||
|
|
||||||
if (wiretappingMode == RAW) {
|
if (wiretappingMode == RAW) {
|
||||||
@ -1028,8 +1043,8 @@ void PlocSupervisorHandler::prepareDisableHk() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void PlocSupervisorHandler::prepareSetBootTimeoutCmd(const uint8_t * commandData) {
|
void PlocSupervisorHandler::prepareSetBootTimeoutCmd(const uint8_t * commandData) {
|
||||||
uint32_t timeout = *(commandData) << 24 | *(commandData + 1) << 16 | *(commandData + 2) << 8 |
|
uint32_t timeout = *(commandData) << 24 | *(commandData + 1) << 16 | *(commandData + 2) << 8
|
||||||
*(commandData + 3);
|
| *(commandData + 3);
|
||||||
PLOC_SPV::SetBootTimeout packet(timeout);
|
PLOC_SPV::SetBootTimeout packet(timeout);
|
||||||
packetToOutBuffer(packet.getWholeData(), packet.getFullSize());
|
packetToOutBuffer(packet.getWholeData(), packet.getFullSize());
|
||||||
}
|
}
|
||||||
@ -1058,8 +1073,8 @@ ReturnValue_t PlocSupervisorHandler::prepareWatchdogsConfigTimeoutCmd(const uint
|
|||||||
if (watchdog > 2) {
|
if (watchdog > 2) {
|
||||||
return INVALID_WATCHDOG;
|
return INVALID_WATCHDOG;
|
||||||
}
|
}
|
||||||
uint32_t timeout = *(commandData + offset) << 24 | *(commandData + offset + 1) << 16 |
|
uint32_t timeout = *(commandData + offset) << 24 | *(commandData + offset + 1) << 16
|
||||||
*(commandData + offset + 2) << 8 | *(commandData + offset + 3);
|
| *(commandData + offset + 2) << 8 | *(commandData + offset + 3);
|
||||||
if (timeout < 1000 || timeout > 360000) {
|
if (timeout < 1000 || timeout > 360000) {
|
||||||
return INVALID_WATCHDOG_TIMEOUT;
|
return INVALID_WATCHDOG_TIMEOUT;
|
||||||
}
|
}
|
||||||
@ -1100,8 +1115,8 @@ ReturnValue_t PlocSupervisorHandler::prepareAutoCalibrateAlertCmd(const uint8_t*
|
|||||||
uint8_t offset = 0;
|
uint8_t offset = 0;
|
||||||
uint8_t latchupId = *commandData;
|
uint8_t latchupId = *commandData;
|
||||||
offset += 1;
|
offset += 1;
|
||||||
uint32_t mg = *(commandData + offset) << 24 | *(commandData + offset + 1) << 16 |
|
uint32_t mg = *(commandData + offset) << 24 | *(commandData + offset + 1) << 16
|
||||||
*(commandData + offset + 2) << 8 | *(commandData + offset + 3);
|
| *(commandData + offset + 2) << 8 | *(commandData + offset + 3);
|
||||||
if (latchupId > 6) {
|
if (latchupId > 6) {
|
||||||
return INVALID_LATCHUP_ID;
|
return INVALID_LATCHUP_ID;
|
||||||
}
|
}
|
||||||
@ -1126,8 +1141,8 @@ ReturnValue_t PlocSupervisorHandler::prepareSetAlertLimitCmd(const uint8_t* comm
|
|||||||
uint8_t offset = 0;
|
uint8_t offset = 0;
|
||||||
uint8_t latchupId = *commandData;
|
uint8_t latchupId = *commandData;
|
||||||
offset += 1;
|
offset += 1;
|
||||||
uint32_t dutycycle = *(commandData + offset) << 24 | *(commandData + offset + 1) << 16 |
|
uint32_t dutycycle = *(commandData + offset) << 24 | *(commandData + offset + 1) << 16
|
||||||
*(commandData + offset + 2) << 8 | *(commandData + offset + 3);
|
| *(commandData + offset + 2) << 8 | *(commandData + offset + 3);
|
||||||
if (latchupId > 6) {
|
if (latchupId > 6) {
|
||||||
return INVALID_LATCHUP_ID;
|
return INVALID_LATCHUP_ID;
|
||||||
}
|
}
|
||||||
@ -1137,8 +1152,8 @@ ReturnValue_t PlocSupervisorHandler::prepareSetAlertLimitCmd(const uint8_t* comm
|
|||||||
}
|
}
|
||||||
|
|
||||||
ReturnValue_t PlocSupervisorHandler::prepareSetAdcSweetPeriodCmd(const uint8_t* commandData) {
|
ReturnValue_t PlocSupervisorHandler::prepareSetAdcSweetPeriodCmd(const uint8_t* commandData) {
|
||||||
uint32_t sweepPeriod = *(commandData) << 24 | *(commandData + 1) << 16 | *(commandData + 2) << 8 |
|
uint32_t sweepPeriod = *(commandData) << 24 | *(commandData + 1) << 16
|
||||||
*(commandData + 3);
|
| *(commandData + 2) << 8 | *(commandData + 3);
|
||||||
if (sweepPeriod < 21) {
|
if (sweepPeriod < 21) {
|
||||||
return SWEEP_PERIOD_TOO_SMALL;
|
return SWEEP_PERIOD_TOO_SMALL;
|
||||||
}
|
}
|
||||||
@ -1163,8 +1178,8 @@ void PlocSupervisorHandler::prepareSetAdcWindowAndStrideCmd(const uint8_t* comma
|
|||||||
}
|
}
|
||||||
|
|
||||||
void PlocSupervisorHandler::prepareSetAdcThresholdCmd(const uint8_t* commandData) {
|
void PlocSupervisorHandler::prepareSetAdcThresholdCmd(const uint8_t* commandData) {
|
||||||
uint32_t threshold = *(commandData) << 24 | *(commandData + 1) << 16 | *(commandData + 2) << 8 |
|
uint32_t threshold = *(commandData) << 24 | *(commandData + 1) << 16 | *(commandData + 2) << 8
|
||||||
*(commandData + 3);
|
| *(commandData + 3);
|
||||||
PLOC_SPV::SetAdcThreshold packet(threshold);
|
PLOC_SPV::SetAdcThreshold packet(threshold);
|
||||||
packetToOutBuffer(packet.getWholeData(), packet.getFullSize());
|
packetToOutBuffer(packet.getWholeData(), packet.getFullSize());
|
||||||
}
|
}
|
||||||
@ -1260,6 +1275,7 @@ void PlocSupervisorHandler::packetToOutBuffer(uint8_t* packetData, size_t fullSi
|
|||||||
}
|
}
|
||||||
|
|
||||||
void PlocSupervisorHandler::disableAllReplies() {
|
void PlocSupervisorHandler::disableAllReplies() {
|
||||||
|
|
||||||
DeviceReplyMap::iterator iter;
|
DeviceReplyMap::iterator iter;
|
||||||
|
|
||||||
/* Disable ack reply */
|
/* Disable ack reply */
|
||||||
@ -1289,6 +1305,7 @@ void PlocSupervisorHandler::disableAllReplies() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void PlocSupervisorHandler::sendFailureReport(DeviceCommandId_t replyId, ReturnValue_t status) {
|
void PlocSupervisorHandler::sendFailureReport(DeviceCommandId_t replyId, ReturnValue_t status) {
|
||||||
|
|
||||||
DeviceReplyIter iter = deviceReplyMap.find(replyId);
|
DeviceReplyIter iter = deviceReplyMap.find(replyId);
|
||||||
|
|
||||||
if (iter == deviceReplyMap.end()) {
|
if (iter == deviceReplyMap.end()) {
|
||||||
@ -1299,8 +1316,7 @@ void PlocSupervisorHandler::sendFailureReport(DeviceCommandId_t replyId, ReturnV
|
|||||||
DeviceCommandInfo* info = &(iter->second.command->second);
|
DeviceCommandInfo* info = &(iter->second.command->second);
|
||||||
|
|
||||||
if (info == nullptr) {
|
if (info == nullptr) {
|
||||||
sif::debug << "PlocSupervisorHandler::sendFailureReport: Reply has no active command"
|
sif::debug << "PlocSupervisorHandler::sendFailureReport: Reply has no active command" << std::endl;
|
||||||
<< std::endl;
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1351,6 +1367,7 @@ ReturnValue_t PlocSupervisorHandler::parseMramPackets(const uint8_t* packet, siz
|
|||||||
}
|
}
|
||||||
|
|
||||||
ReturnValue_t PlocSupervisorHandler::handleMramDumpPacket(DeviceCommandId_t id) {
|
ReturnValue_t PlocSupervisorHandler::handleMramDumpPacket(DeviceCommandId_t id) {
|
||||||
|
|
||||||
ReturnValue_t result = RETURN_FAILED;
|
ReturnValue_t result = RETURN_FAILED;
|
||||||
|
|
||||||
// Prepare packet for downlink
|
// Prepare packet for downlink
|
||||||
@ -1363,7 +1380,8 @@ ReturnValue_t PlocSupervisorHandler::handleMramDumpPacket(DeviceCommandId_t id)
|
|||||||
}
|
}
|
||||||
handleMramDumpFile(id);
|
handleMramDumpFile(id);
|
||||||
if (downlinkMramDump == true) {
|
if (downlinkMramDump == true) {
|
||||||
handleDeviceTM(spacePacketBuffer + PLOC_SPV::SPACE_PACKET_HEADER_LENGTH, packetLen - 1, id);
|
handleDeviceTM(spacePacketBuffer + PLOC_SPV::SPACE_PACKET_HEADER_LENGTH, packetLen - 1,
|
||||||
|
id);
|
||||||
}
|
}
|
||||||
packetInBuffer = false;
|
packetInBuffer = false;
|
||||||
receivedMramDumpPackets++;
|
receivedMramDumpPackets++;
|
||||||
@ -1408,15 +1426,16 @@ void PlocSupervisorHandler::increaseExpectedMramReplies(DeviceCommandId_t id) {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
uint8_t sequenceFlags = spacePacketBuffer[2] >> 6;
|
uint8_t sequenceFlags = spacePacketBuffer[2] >> 6;
|
||||||
if (sequenceFlags != static_cast<uint8_t>(PLOC_SPV::SequenceFlags::LAST_PKT) &&
|
if (sequenceFlags != static_cast<uint8_t>(PLOC_SPV::SequenceFlags::LAST_PKT)
|
||||||
(sequenceFlags != static_cast<uint8_t>(PLOC_SPV::SequenceFlags::STANDALONE_PKT))) {
|
&& (sequenceFlags != static_cast<uint8_t>(PLOC_SPV::SequenceFlags::STANDALONE_PKT))) {
|
||||||
// Command expects at least one MRAM packet more and the execution report
|
// Command expects at least one MRAM packet more and the execution report
|
||||||
info->expectedReplies = 2;
|
info->expectedReplies = 2;
|
||||||
// Wait maximum of 2 cycles for next MRAM packet
|
// Wait maximum of 2 cycles for next MRAM packet
|
||||||
mramReplyInfo->delayCycles = 2;
|
mramReplyInfo->delayCycles = 2;
|
||||||
// Also adapting delay cycles for execution report
|
// Also adapting delay cycles for execution report
|
||||||
exeReplyInfo->delayCycles = 3;
|
exeReplyInfo->delayCycles = 3;
|
||||||
} else {
|
}
|
||||||
|
else {
|
||||||
// Command expects the execution report
|
// Command expects the execution report
|
||||||
info->expectedReplies = 1;
|
info->expectedReplies = 1;
|
||||||
mramReplyInfo->delayCycles = 0;
|
mramReplyInfo->delayCycles = 0;
|
||||||
@ -1437,8 +1456,8 @@ ReturnValue_t PlocSupervisorHandler::handleMramDumpFile(DeviceCommandId_t id) {
|
|||||||
uint16_t packetLen = readSpacePacketLength(spacePacketBuffer);
|
uint16_t packetLen = readSpacePacketLength(spacePacketBuffer);
|
||||||
uint8_t sequenceFlags = readSequenceFlags(spacePacketBuffer);
|
uint8_t sequenceFlags = readSequenceFlags(spacePacketBuffer);
|
||||||
if (id == PLOC_SPV::FIRST_MRAM_DUMP) {
|
if (id == PLOC_SPV::FIRST_MRAM_DUMP) {
|
||||||
if (sequenceFlags == static_cast<uint8_t>(PLOC_SPV::SequenceFlags::FIRST_PKT) ||
|
if (sequenceFlags == static_cast<uint8_t>(PLOC_SPV::SequenceFlags::FIRST_PKT)
|
||||||
(sequenceFlags == static_cast<uint8_t>(PLOC_SPV::SequenceFlags::STANDALONE_PKT))) {
|
|| (sequenceFlags == static_cast<uint8_t>(PLOC_SPV::SequenceFlags::STANDALONE_PKT))) {
|
||||||
result = createMramDumpFile();
|
result = createMramDumpFile();
|
||||||
if (result != RETURN_OK) {
|
if (result != RETURN_OK) {
|
||||||
return result;
|
return result;
|
||||||
@ -1504,8 +1523,8 @@ ReturnValue_t PlocSupervisorHandler::getTimeStampString(std::string& timeStamp)
|
|||||||
<< std::endl;
|
<< std::endl;
|
||||||
return GET_TIME_FAILURE;
|
return GET_TIME_FAILURE;
|
||||||
}
|
}
|
||||||
timeStamp = std::to_string(time.year) + "-" + std::to_string(time.month) + "-" +
|
timeStamp = std::to_string(time.year) + "-" + std::to_string(time.month) + "-"
|
||||||
std::to_string(time.day) + "--" + std::to_string(time.hour) + "-" +
|
+ std::to_string(time.day) + "--" + std::to_string(time.hour) + "-"
|
||||||
std::to_string(time.minute) + "-" + std::to_string(time.second);
|
+ std::to_string(time.minute) + "-" + std::to_string(time.second);
|
||||||
return RETURN_OK;
|
return RETURN_OK;
|
||||||
}
|
}
|
||||||
|
@ -1,12 +1,12 @@
|
|||||||
#ifndef MISSION_DEVICES_PLOCSUPERVISORHANDLER_H_
|
#ifndef MISSION_DEVICES_PLOCSUPERVISORHANDLER_H_
|
||||||
#define MISSION_DEVICES_PLOCSUPERVISORHANDLER_H_
|
#define MISSION_DEVICES_PLOCSUPERVISORHANDLER_H_
|
||||||
|
|
||||||
|
#include "devicedefinitions/PlocSupervisorDefinitions.h"
|
||||||
#include <bsp_q7s/memory/SdCardManager.h>
|
#include <bsp_q7s/memory/SdCardManager.h>
|
||||||
|
|
||||||
#include <fsfw/devicehandlers/DeviceHandlerBase.h>
|
#include <fsfw/devicehandlers/DeviceHandlerBase.h>
|
||||||
#include <fsfw_hal/linux/uart/UartComIF.h>
|
#include <fsfw_hal/linux/uart/UartComIF.h>
|
||||||
|
|
||||||
#include "devicedefinitions/PlocSupervisorDefinitions.h"
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief This is the device handler for the supervisor of the PLOC which is programmed by
|
* @brief This is the device handler for the supervisor of the PLOC which is programmed by
|
||||||
* Thales.
|
* Thales.
|
||||||
@ -21,6 +21,7 @@
|
|||||||
*/
|
*/
|
||||||
class PlocSupervisorHandler: public DeviceHandlerBase {
|
class PlocSupervisorHandler: public DeviceHandlerBase {
|
||||||
public:
|
public:
|
||||||
|
|
||||||
PlocSupervisorHandler(object_id_t objectId, object_id_t uartComIFid, CookieIF * comCookie);
|
PlocSupervisorHandler(object_id_t objectId, object_id_t uartComIFid, CookieIF * comCookie);
|
||||||
virtual ~PlocSupervisorHandler();
|
virtual ~PlocSupervisorHandler();
|
||||||
|
|
||||||
@ -32,11 +33,12 @@ class PlocSupervisorHandler : public DeviceHandlerBase {
|
|||||||
ReturnValue_t buildNormalDeviceCommand(DeviceCommandId_t * id) override;
|
ReturnValue_t buildNormalDeviceCommand(DeviceCommandId_t * id) override;
|
||||||
ReturnValue_t buildTransitionDeviceCommand(DeviceCommandId_t * id) override;
|
ReturnValue_t buildTransitionDeviceCommand(DeviceCommandId_t * id) override;
|
||||||
void fillCommandAndReplyMap() override;
|
void fillCommandAndReplyMap() override;
|
||||||
ReturnValue_t buildCommandFromCommand(DeviceCommandId_t deviceCommand, const uint8_t* commandData,
|
ReturnValue_t buildCommandFromCommand(DeviceCommandId_t deviceCommand,
|
||||||
size_t commandDataLen) override;
|
const uint8_t * commandData,size_t commandDataLen) override;
|
||||||
ReturnValue_t scanForReply(const uint8_t* start, size_t remainingSize, DeviceCommandId_t* foundId,
|
ReturnValue_t scanForReply(const uint8_t *start, size_t remainingSize,
|
||||||
size_t* foundLen) override;
|
DeviceCommandId_t *foundId, size_t *foundLen) override;
|
||||||
ReturnValue_t interpretDeviceReply(DeviceCommandId_t id, const uint8_t* packet) override;
|
ReturnValue_t interpretDeviceReply(DeviceCommandId_t id,
|
||||||
|
const uint8_t *packet) override;
|
||||||
void setNormalDatapoolEntriesInvalid() override;
|
void setNormalDatapoolEntriesInvalid() override;
|
||||||
uint32_t getTransitionDelayMs(Mode_t modeFrom, Mode_t modeTo) override;
|
uint32_t getTransitionDelayMs(Mode_t modeFrom, Mode_t modeTo) override;
|
||||||
ReturnValue_t initializeLocalDataPool(localpool::DataPool& localDataPoolMap,
|
ReturnValue_t initializeLocalDataPool(localpool::DataPool& localDataPoolMap,
|
||||||
@ -47,6 +49,7 @@ class PlocSupervisorHandler : public DeviceHandlerBase {
|
|||||||
size_t getNextReplyLength(DeviceCommandId_t deviceCommand) override;
|
size_t getNextReplyLength(DeviceCommandId_t deviceCommand) override;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
|
||||||
static const uint8_t INTERFACE_ID = CLASS_ID::PLOC_SUPERVISOR_HANDLER;
|
static const uint8_t INTERFACE_ID = CLASS_ID::PLOC_SUPERVISOR_HANDLER;
|
||||||
|
|
||||||
//! [EXPORT] : [COMMENT] Space Packet received from PLOC supervisor has invalid CRC
|
//! [EXPORT] : [COMMENT] Space Packet received from PLOC supervisor has invalid CRC
|
||||||
@ -61,32 +64,25 @@ class PlocSupervisorHandler : public DeviceHandlerBase {
|
|||||||
static const ReturnValue_t GET_TIME_FAILURE = MAKE_RETURN_CODE(0xA4);
|
static const ReturnValue_t GET_TIME_FAILURE = MAKE_RETURN_CODE(0xA4);
|
||||||
//! [EXPORT] : [COMMENT] Invalid communication interface specified
|
//! [EXPORT] : [COMMENT] Invalid communication interface specified
|
||||||
static const ReturnValue_t INVALID_UART_COM_IF = MAKE_RETURN_CODE(0xA5);
|
static const ReturnValue_t INVALID_UART_COM_IF = MAKE_RETURN_CODE(0xA5);
|
||||||
//! [EXPORT] : [COMMENT] Received command with invalid watchdog parameter. Valid watchdogs are 0
|
//! [EXPORT] : [COMMENT] Received command with invalid watchdog parameter. Valid watchdogs are 0 for PS, 1 for PL and 2 for INT
|
||||||
//! for PS, 1 for PL and 2 for INT
|
|
||||||
static const ReturnValue_t INVALID_WATCHDOG = MAKE_RETURN_CODE(0xA6);
|
static const ReturnValue_t INVALID_WATCHDOG = MAKE_RETURN_CODE(0xA6);
|
||||||
//! [EXPORT] : [COMMENT] Received watchdog timeout config command with invalid timeout. Valid
|
//! [EXPORT] : [COMMENT] Received watchdog timeout config command with invalid timeout. Valid timeouts must be in the range between 1000 and 360000 ms.
|
||||||
//! timeouts must be in the range between 1000 and 360000 ms.
|
|
||||||
static const ReturnValue_t INVALID_WATCHDOG_TIMEOUT = MAKE_RETURN_CODE(0xA7);
|
static const ReturnValue_t INVALID_WATCHDOG_TIMEOUT = MAKE_RETURN_CODE(0xA7);
|
||||||
//! [EXPORT] : [COMMENT] Received latchup config command with invalid latchup ID
|
//! [EXPORT] : [COMMENT] Received latchup config command with invalid latchup ID
|
||||||
static const ReturnValue_t INVALID_LATCHUP_ID = MAKE_RETURN_CODE(0xA8);
|
static const ReturnValue_t INVALID_LATCHUP_ID = MAKE_RETURN_CODE(0xA8);
|
||||||
//! [EXPORT] : [COMMENT] Received set adc sweep period command with invalid sweep period. Must be
|
//! [EXPORT] : [COMMENT] Received set adc sweep period command with invalid sweep period. Must be larger than 21.
|
||||||
//! larger than 21.
|
|
||||||
static const ReturnValue_t SWEEP_PERIOD_TOO_SMALL = MAKE_RETURN_CODE(0xA9);
|
static const ReturnValue_t SWEEP_PERIOD_TOO_SMALL = MAKE_RETURN_CODE(0xA9);
|
||||||
//! [EXPORT] : [COMMENT] Receive auto EM test command with invalid test param. Valid params are 1
|
//! [EXPORT] : [COMMENT] Receive auto EM test command with invalid test param. Valid params are 1 and 2.
|
||||||
//! and 2.
|
|
||||||
static const ReturnValue_t INVALID_TEST_PARAM = MAKE_RETURN_CODE(0xAA);
|
static const ReturnValue_t INVALID_TEST_PARAM = MAKE_RETURN_CODE(0xAA);
|
||||||
//! [EXPORT] : [COMMENT] Returned when scanning for MRAM dump packets failed.
|
//! [EXPORT] : [COMMENT] Returned when scanning for MRAM dump packets failed.
|
||||||
static const ReturnValue_t MRAM_PACKET_PARSING_FAILURE = MAKE_RETURN_CODE(0xAB);
|
static const ReturnValue_t MRAM_PACKET_PARSING_FAILURE = MAKE_RETURN_CODE(0xAB);
|
||||||
//! [EXPORT] : [COMMENT] Returned when the start and stop addresses of the MRAM dump or MRAM wipe
|
//! [EXPORT] : [COMMENT] Returned when the start and stop addresses of the MRAM dump or MRAM wipe commands are invalid (e.g. start address bigger than stop address)
|
||||||
//! commands are invalid (e.g. start address bigger than stop address)
|
|
||||||
static const ReturnValue_t INVALID_MRAM_ADDRESSES = MAKE_RETURN_CODE(0xAC);
|
static const ReturnValue_t INVALID_MRAM_ADDRESSES = MAKE_RETURN_CODE(0xAC);
|
||||||
//! [EXPORT] : [COMMENT] Expect reception of an MRAM dump packet but received space packet with
|
//! [EXPORT] : [COMMENT] Expect reception of an MRAM dump packet but received space packet with other apid.
|
||||||
//! other apid.
|
|
||||||
static const ReturnValue_t NO_MRAM_PACKET = MAKE_RETURN_CODE(0xAD);
|
static const ReturnValue_t NO_MRAM_PACKET = MAKE_RETURN_CODE(0xAD);
|
||||||
//! [EXPORT] : [COMMENT] Path to PLOC directory on SD card does not exist
|
//! [EXPORT] : [COMMENT] Path to PLOC directory on SD card does not exist
|
||||||
static const ReturnValue_t PATH_DOES_NOT_EXIST = MAKE_RETURN_CODE(0xAE);
|
static const ReturnValue_t PATH_DOES_NOT_EXIST = MAKE_RETURN_CODE(0xAE);
|
||||||
//! [EXPORT] : [COMMENT] MRAM dump file does not exists. The file should actually already have
|
//! [EXPORT] : [COMMENT] MRAM dump file does not exists. The file should actually already have been created with the reception of the first dump packet.
|
||||||
//! been created with the reception of the first dump packet.
|
|
||||||
static const ReturnValue_t MRAM_FILE_NOT_EXISTS = MAKE_RETURN_CODE(0xAF);
|
static const ReturnValue_t MRAM_FILE_NOT_EXISTS = MAKE_RETURN_CODE(0xAF);
|
||||||
|
|
||||||
static const uint8_t SUBSYSTEM_ID = SUBSYSTEM_ID::PLOC_SUPERVISOR_HANDLER;
|
static const uint8_t SUBSYSTEM_ID = SUBSYSTEM_ID::PLOC_SUPERVISOR_HANDLER;
|
||||||
@ -262,6 +258,7 @@ class PlocSupervisorHandler : public DeviceHandlerBase {
|
|||||||
void prepareSetGpioCmd(const uint8_t* commandData);
|
void prepareSetGpioCmd(const uint8_t* commandData);
|
||||||
void prepareReadGpioCmd(const uint8_t* commandData);
|
void prepareReadGpioCmd(const uint8_t* commandData);
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Copies the content of a space packet to the command buffer.
|
* @brief Copies the content of a space packet to the command buffer.
|
||||||
*/
|
*/
|
||||||
|
@ -1,19 +1,17 @@
|
|||||||
|
#include "fsfw/ipc/QueueFactory.h"
|
||||||
#include "PlocUpdater.h"
|
#include "PlocUpdater.h"
|
||||||
|
|
||||||
#include <filesystem>
|
|
||||||
#include <fstream>
|
#include <fstream>
|
||||||
|
#include <filesystem>
|
||||||
#include <string>
|
#include <string>
|
||||||
|
|
||||||
#include "fsfw/ipc/QueueFactory.h"
|
PlocUpdater::PlocUpdater(object_id_t objectId) :
|
||||||
|
SystemObject(objectId), commandActionHelper(this), actionHelper(this, nullptr) {
|
||||||
PlocUpdater::PlocUpdater(object_id_t objectId)
|
commandQueue = QueueFactory::instance()->createMessageQueue(QUEUE_SIZE);
|
||||||
: SystemObject(objectId), commandActionHelper(this), actionHelper(this, nullptr) {
|
|
||||||
auto mqArgs = MqArgs(this->getObjectId());
|
|
||||||
commandQueue = QueueFactory::instance()->createMessageQueue(
|
|
||||||
QUEUE_SIZE, MessageQueueMessage::MAX_MESSAGE_SIZE, &mqArgs);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
PlocUpdater::~PlocUpdater() {}
|
PlocUpdater::~PlocUpdater() {
|
||||||
|
}
|
||||||
|
|
||||||
ReturnValue_t PlocUpdater::initialize() {
|
ReturnValue_t PlocUpdater::initialize() {
|
||||||
#if BOARD_TE0720 == 0
|
#if BOARD_TE0720 == 0
|
||||||
@ -41,8 +39,8 @@ ReturnValue_t PlocUpdater::performOperation(uint8_t operationCode) {
|
|||||||
return HasReturnvaluesIF::RETURN_OK;
|
return HasReturnvaluesIF::RETURN_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
ReturnValue_t PlocUpdater::executeAction(ActionId_t actionId, MessageQueueId_t commandedBy,
|
ReturnValue_t PlocUpdater::executeAction(ActionId_t actionId,
|
||||||
const uint8_t* data, size_t size) {
|
MessageQueueId_t commandedBy, const uint8_t* data, size_t size) {
|
||||||
ReturnValue_t result = RETURN_FAILED;
|
ReturnValue_t result = RETURN_FAILED;
|
||||||
|
|
||||||
if (state != State::IDLE) {
|
if (state != State::IDLE) {
|
||||||
@ -101,9 +99,13 @@ ReturnValue_t PlocUpdater::executeAction(ActionId_t actionId, MessageQueueId_t c
|
|||||||
return EXECUTION_FINISHED;
|
return EXECUTION_FINISHED;
|
||||||
}
|
}
|
||||||
|
|
||||||
MessageQueueId_t PlocUpdater::getCommandQueue() const { return commandQueue->getId(); }
|
MessageQueueId_t PlocUpdater::getCommandQueue() const {
|
||||||
|
return commandQueue->getId();
|
||||||
|
}
|
||||||
|
|
||||||
MessageQueueIF* PlocUpdater::getCommandQueuePtr() { return commandQueue; }
|
MessageQueueIF* PlocUpdater::getCommandQueuePtr() {
|
||||||
|
return commandQueue;
|
||||||
|
}
|
||||||
|
|
||||||
void PlocUpdater::readCommandQueue() {
|
void PlocUpdater::readCommandQueue() {
|
||||||
CommandMessage message;
|
CommandMessage message;
|
||||||
@ -165,19 +167,19 @@ ReturnValue_t PlocUpdater::getImageLocation(const uint8_t* data, size_t size) {
|
|||||||
|
|
||||||
#if BOARD_TE0720 == 0
|
#if BOARD_TE0720 == 0
|
||||||
// Check if file is stored on SD card and if associated SD card is mounted
|
// Check if file is stored on SD card and if associated SD card is mounted
|
||||||
if (std::string(reinterpret_cast<const char*>(data), SD_PREFIX_LENGTH) ==
|
if (std::string(reinterpret_cast<const char*>(data), SD_PREFIX_LENGTH) == std::string(SdCardManager::SD_0_MOUNT_POINT)) {
|
||||||
std::string(SdCardManager::SD_0_MOUNT_POINT)) {
|
if (!isSdCardMounted(sd::SLOT_0)) {
|
||||||
if (!sdcMan->isSdCardMounted(sd::SLOT_0)) {
|
sif::warning << "PlocUpdater::prepareNvm0AUpdate: SD card 0 not mounted" << std::endl;
|
||||||
sif::warning << "PlocUpdater::getImageLocation: SD card 0 not mounted" << std::endl;
|
|
||||||
return SD_NOT_MOUNTED;
|
return SD_NOT_MOUNTED;
|
||||||
}
|
}
|
||||||
} else if (std::string(reinterpret_cast<const char*>(data), SD_PREFIX_LENGTH) ==
|
}
|
||||||
std::string(SdCardManager::SD_1_MOUNT_POINT)) {
|
else if (std::string(reinterpret_cast<const char*>(data), SD_PREFIX_LENGTH) == std::string(SdCardManager::SD_1_MOUNT_POINT)) {
|
||||||
if (!sdcMan->isSdCardMounted(sd::SLOT_0)) {
|
if (!isSdCardMounted(sd::SLOT_0)) {
|
||||||
sif::warning << "PlocUpdater::getImageLocation: SD card 1 not mounted" << std::endl;
|
sif::warning << "PlocUpdater::prepareNvm0AUpdate: SD card 1 not mounted" << std::endl;
|
||||||
return SD_NOT_MOUNTED;
|
return SD_NOT_MOUNTED;
|
||||||
}
|
}
|
||||||
} else {
|
}
|
||||||
|
else {
|
||||||
//update image not stored on SD card
|
//update image not stored on SD card
|
||||||
}
|
}
|
||||||
#endif /* BOARD_TE0720 == 0 */
|
#endif /* BOARD_TE0720 == 0 */
|
||||||
@ -191,11 +193,48 @@ ReturnValue_t PlocUpdater::getImageLocation(const uint8_t* data, size_t size) {
|
|||||||
return RETURN_OK;
|
return RETURN_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
void PlocUpdater::stepSuccessfulReceived(ActionId_t actionId, uint8_t step) {}
|
#if BOARD_TE0720 == 0
|
||||||
|
bool PlocUpdater::isSdCardMounted(sd::SdCard sdCard) {
|
||||||
|
SdCardManager::SdStatePair active;
|
||||||
|
ReturnValue_t result = sdcMan->getSdCardActiveStatus(active);
|
||||||
|
if (result != RETURN_OK) {
|
||||||
|
sif::debug << "PlocUpdater::isSdCardMounted: Failed to get SD card active state";
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
if (sdCard == sd::SLOT_0) {
|
||||||
|
if (active.first == sd::MOUNTED) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else if (sdCard == sd::SLOT_1) {
|
||||||
|
if (active.second == sd::MOUNTED) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
sif::debug << "PlocUpdater::isSdCardMounted: Unknown SD card specified" << std::endl;
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
#endif /* #if BOARD_TE0720 == 0 */
|
||||||
|
|
||||||
void PlocUpdater::stepFailedReceived(ActionId_t actionId, uint8_t step, ReturnValue_t returnCode) {}
|
void PlocUpdater::stepSuccessfulReceived(ActionId_t actionId,
|
||||||
|
uint8_t step) {
|
||||||
|
}
|
||||||
|
|
||||||
void PlocUpdater::dataReceived(ActionId_t actionId, const uint8_t* data, uint32_t size) {}
|
void PlocUpdater::stepFailedReceived(ActionId_t actionId, uint8_t step,
|
||||||
|
ReturnValue_t returnCode) {
|
||||||
|
}
|
||||||
|
|
||||||
|
void PlocUpdater::dataReceived(ActionId_t actionId, const uint8_t* data, uint32_t size) {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
void PlocUpdater::completionSuccessfulReceived(ActionId_t actionId) {
|
void PlocUpdater::completionSuccessfulReceived(ActionId_t actionId) {
|
||||||
switch (pendingCommand) {
|
switch (pendingCommand) {
|
||||||
@ -206,7 +245,8 @@ void PlocUpdater::completionSuccessfulReceived(ActionId_t actionId) {
|
|||||||
if (remainingPackets == 0) {
|
if (remainingPackets == 0) {
|
||||||
packetsSent = 0; // Reset packets sent variable for next update sequence
|
packetsSent = 0; // Reset packets sent variable for next update sequence
|
||||||
state = State::UPDATE_VERIFY;
|
state = State::UPDATE_VERIFY;
|
||||||
} else {
|
}
|
||||||
|
else {
|
||||||
state = State::UPDATE_TRANSFER;
|
state = State::UPDATE_TRANSFER;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
@ -223,7 +263,8 @@ void PlocUpdater::completionSuccessfulReceived(ActionId_t actionId) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void PlocUpdater::completionFailedReceived(ActionId_t actionId, ReturnValue_t returnCode) {
|
void PlocUpdater::completionFailedReceived(ActionId_t actionId,
|
||||||
|
ReturnValue_t returnCode) {
|
||||||
switch(pendingCommand) {
|
switch(pendingCommand) {
|
||||||
case(PLOC_SPV::UPDATE_AVAILABLE): {
|
case(PLOC_SPV::UPDATE_AVAILABLE): {
|
||||||
triggerEvent(UPDATE_AVAILABLE_FAILED);
|
triggerEvent(UPDATE_AVAILABLE_FAILED);
|
||||||
@ -238,7 +279,8 @@ void PlocUpdater::completionFailedReceived(ActionId_t actionId, ReturnValue_t re
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
default:
|
default:
|
||||||
sif::debug << "PlocUpdater::completionFailedReceived: Invalid pending command " << std::endl;
|
sif::debug << "PlocUpdater::completionFailedReceived: Invalid pending command "
|
||||||
|
<< std::endl;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
state = State::IDLE;
|
state = State::IDLE;
|
||||||
@ -269,12 +311,10 @@ void PlocUpdater::commandUpdateAvailable() {
|
|||||||
calcImageCrc();
|
calcImageCrc();
|
||||||
|
|
||||||
PLOC_SPV::UpdateInfo packet(PLOC_SPV::APID_UPDATE_AVAILABLE, static_cast<uint8_t>(image),
|
PLOC_SPV::UpdateInfo packet(PLOC_SPV::APID_UPDATE_AVAILABLE, static_cast<uint8_t>(image),
|
||||||
static_cast<uint8_t>(partition), imageSize, imageCrc,
|
static_cast<uint8_t>(partition), imageSize, imageCrc, numOfUpdatePackets);
|
||||||
numOfUpdatePackets);
|
|
||||||
|
|
||||||
result = commandActionHelper.commandAction(objects::PLOC_SUPERVISOR_HANDLER,
|
result = commandActionHelper.commandAction(objects::PLOC_SUPERVISOR_HANDLER,
|
||||||
PLOC_SPV::UPDATE_AVAILABLE, packet.getWholeData(),
|
PLOC_SPV::UPDATE_AVAILABLE, packet.getWholeData(), packet.getFullSize());
|
||||||
packet.getFullSize());
|
|
||||||
if (result != RETURN_OK) {
|
if (result != RETURN_OK) {
|
||||||
sif::warning << "PlocUpdater::commandUpdateAvailable: Failed to send update available"
|
sif::warning << "PlocUpdater::commandUpdateAvailable: Failed to send update available"
|
||||||
<< " packet to supervisor handler" << std::endl;
|
<< " packet to supervisor handler" << std::endl;
|
||||||
@ -304,7 +344,8 @@ void PlocUpdater::commandUpdatePacket() {
|
|||||||
|
|
||||||
if (remainingPackets == 1) {
|
if (remainingPackets == 1) {
|
||||||
payloadLength = imageSize - static_cast<uint16_t>(file.tellg());
|
payloadLength = imageSize - static_cast<uint16_t>(file.tellg());
|
||||||
} else {
|
}
|
||||||
|
else {
|
||||||
payloadLength = MAX_SP_DATA;
|
payloadLength = MAX_SP_DATA;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -319,8 +360,7 @@ void PlocUpdater::commandUpdatePacket() {
|
|||||||
packet.makeCrc();
|
packet.makeCrc();
|
||||||
|
|
||||||
result = commandActionHelper.commandAction(objects::PLOC_SUPERVISOR_HANDLER,
|
result = commandActionHelper.commandAction(objects::PLOC_SUPERVISOR_HANDLER,
|
||||||
PLOC_SPV::UPDATE_IMAGE_DATA, packet.getWholeData(),
|
PLOC_SPV::UPDATE_IMAGE_DATA, packet.getWholeData(), packet.getFullSize());
|
||||||
packet.getFullSize());
|
|
||||||
|
|
||||||
if (result != RETURN_OK) {
|
if (result != RETURN_OK) {
|
||||||
sif::warning << "PlocUpdater::commandUpdateAvailable: Failed to send update"
|
sif::warning << "PlocUpdater::commandUpdateAvailable: Failed to send update"
|
||||||
@ -342,12 +382,10 @@ void PlocUpdater::commandUpdateVerify() {
|
|||||||
ReturnValue_t result = RETURN_OK;
|
ReturnValue_t result = RETURN_OK;
|
||||||
|
|
||||||
PLOC_SPV::UpdateInfo packet(PLOC_SPV::APID_UPDATE_VERIFY, static_cast<uint8_t>(image),
|
PLOC_SPV::UpdateInfo packet(PLOC_SPV::APID_UPDATE_VERIFY, static_cast<uint8_t>(image),
|
||||||
static_cast<uint8_t>(partition), imageSize, imageCrc,
|
static_cast<uint8_t>(partition), imageSize, imageCrc, numOfUpdatePackets);
|
||||||
numOfUpdatePackets);
|
|
||||||
|
|
||||||
result =
|
result = commandActionHelper.commandAction(objects::PLOC_SUPERVISOR_HANDLER,
|
||||||
commandActionHelper.commandAction(objects::PLOC_SUPERVISOR_HANDLER, PLOC_SPV::UPDATE_VERIFY,
|
PLOC_SPV::UPDATE_VERIFY, packet.getWholeData(), packet.getFullSize());
|
||||||
packet.getWholeData(), packet.getFullSize());
|
|
||||||
if (result != RETURN_OK) {
|
if (result != RETURN_OK) {
|
||||||
sif::warning << "PlocUpdater::commandUpdateAvailable: Failed to send update available"
|
sif::warning << "PlocUpdater::commandUpdateAvailable: Failed to send update available"
|
||||||
<< " packet to supervisor handler" << std::endl;
|
<< " packet to supervisor handler" << std::endl;
|
||||||
@ -387,9 +425,12 @@ void PlocUpdater::calcImageCrc() {
|
|||||||
void PlocUpdater::adjustSequenceFlags(PLOC_SPV::UpdatePacket& packet) {
|
void PlocUpdater::adjustSequenceFlags(PLOC_SPV::UpdatePacket& packet) {
|
||||||
if (packetsSent == 0) {
|
if (packetsSent == 0) {
|
||||||
packet.setSequenceFlags(static_cast<uint8_t>(PLOC_SPV::SequenceFlags::FIRST_PKT));
|
packet.setSequenceFlags(static_cast<uint8_t>(PLOC_SPV::SequenceFlags::FIRST_PKT));
|
||||||
} else if (remainingPackets == 1) {
|
}
|
||||||
|
else if (remainingPackets == 1) {
|
||||||
packet.setSequenceFlags(static_cast<uint8_t>(PLOC_SPV::SequenceFlags::LAST_PKT));
|
packet.setSequenceFlags(static_cast<uint8_t>(PLOC_SPV::SequenceFlags::LAST_PKT));
|
||||||
} else {
|
}
|
||||||
|
else {
|
||||||
packet.setSequenceFlags(static_cast<uint8_t>(PLOC_SPV::SequenceFlags::CONTINUED_PKT));
|
packet.setSequenceFlags(static_cast<uint8_t>(PLOC_SPV::SequenceFlags::CONTINUED_PKT));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -2,25 +2,27 @@
|
|||||||
#define MISSION_DEVICES_PLOCUPDATER_H_
|
#define MISSION_DEVICES_PLOCUPDATER_H_
|
||||||
|
|
||||||
#include "OBSWConfig.h"
|
#include "OBSWConfig.h"
|
||||||
#include "bsp_q7s/memory/SdCardManager.h"
|
|
||||||
#include "devicedefinitions/PlocSupervisorDefinitions.h"
|
#include "devicedefinitions/PlocSupervisorDefinitions.h"
|
||||||
#include "fsfw/action/ActionHelper.h"
|
|
||||||
#include "fsfw/action/CommandActionHelper.h"
|
#include "fsfw/action/CommandActionHelper.h"
|
||||||
#include "fsfw/action/CommandsActionsIF.h"
|
#include "fsfw/action/ActionHelper.h"
|
||||||
#include "fsfw/action/HasActionsIF.h"
|
#include "fsfw/action/HasActionsIF.h"
|
||||||
#include "fsfw/objectmanager/SystemObject.h"
|
#include "fsfw/action/CommandsActionsIF.h"
|
||||||
#include "fsfw/returnvalues/HasReturnvaluesIF.h"
|
#include "fsfw/returnvalues/HasReturnvaluesIF.h"
|
||||||
#include "fsfw/tasks/ExecutableObjectIF.h"
|
#include "fsfw/tasks/ExecutableObjectIF.h"
|
||||||
#include "fsfw/tmtcpacket/SpacePacket.h"
|
#include "fsfw/objectmanager/SystemObject.h"
|
||||||
|
#include "bsp_q7s/memory/SdCardManager.h"
|
||||||
#include "linux/fsfwconfig/objects/systemObjectList.h"
|
#include "linux/fsfwconfig/objects/systemObjectList.h"
|
||||||
|
#include "fsfw/tmtcpacket/SpacePacket.h"
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief An object of this class can be used to perform the software updates of the PLOC. The
|
* @brief An object of this class can be used to perform the software updates of the PLOC. The
|
||||||
* software update will be read from one of the SD cards, split into multiple space
|
* software update will be read from one of the SD cards, split into multiple space
|
||||||
* packets and sent to the PlocSupervisorHandler.
|
* packets and sent to the PlocSupervisorHandler.
|
||||||
*
|
*
|
||||||
* @details The MPSoC has two boot memories (NVM0 and NVM1) where each stores two images (Partition
|
* @details The MPSoC has two boot memories (NVM0 and NVM1) where each stores two images (Partition A
|
||||||
* A and Partition B)
|
* and Partition B)
|
||||||
*
|
*
|
||||||
* @author J. Meier
|
* @author J. Meier
|
||||||
*/
|
*/
|
||||||
@ -30,6 +32,7 @@ class PlocUpdater : public SystemObject,
|
|||||||
public HasReturnvaluesIF,
|
public HasReturnvaluesIF,
|
||||||
public CommandsActionsIF {
|
public CommandsActionsIF {
|
||||||
public:
|
public:
|
||||||
|
|
||||||
static const ActionId_t UPDATE_A_UBOOT = 0;
|
static const ActionId_t UPDATE_A_UBOOT = 0;
|
||||||
static const ActionId_t UPDATE_A_BITSTREAM = 1;
|
static const ActionId_t UPDATE_A_BITSTREAM = 1;
|
||||||
static const ActionId_t UPDATE_A_LINUX = 2;
|
static const ActionId_t UPDATE_A_LINUX = 2;
|
||||||
@ -55,14 +58,14 @@ class PlocUpdater : public SystemObject,
|
|||||||
void completionFailedReceived(ActionId_t actionId, ReturnValue_t returnCode) override;
|
void completionFailedReceived(ActionId_t actionId, ReturnValue_t returnCode) override;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
|
||||||
static const uint8_t INTERFACE_ID = CLASS_ID::PLOC_UPDATER;
|
static const uint8_t INTERFACE_ID = CLASS_ID::PLOC_UPDATER;
|
||||||
|
|
||||||
//! [EXPORT] : [COMMENT] Updater is already performing an update
|
//! [EXPORT] : [COMMENT] Updater is already performing an update
|
||||||
static const ReturnValue_t UPDATER_BUSY = MAKE_RETURN_CODE(0xA0);
|
static const ReturnValue_t UPDATER_BUSY = MAKE_RETURN_CODE(0xA0);
|
||||||
//! [EXPORT] : [COMMENT] Received update command with invalid path string (too long).
|
//! [EXPORT] : [COMMENT] Received update command with invalid path string (too long).
|
||||||
static const ReturnValue_t NAME_TOO_LONG = MAKE_RETURN_CODE(0xA1);
|
static const ReturnValue_t NAME_TOO_LONG = MAKE_RETURN_CODE(0xA1);
|
||||||
//! [EXPORT] : [COMMENT] Received command to initiate update but SD card with update image not
|
//! [EXPORT] : [COMMENT] Received command to initiate update but SD card with update image not mounted.
|
||||||
//! mounted.
|
|
||||||
static const ReturnValue_t SD_NOT_MOUNTED = MAKE_RETURN_CODE(0xA2);
|
static const ReturnValue_t SD_NOT_MOUNTED = MAKE_RETURN_CODE(0xA2);
|
||||||
//! [EXPORT] : [COMMENT] Update file received with update command does not exist.
|
//! [EXPORT] : [COMMENT] Update file received with update command does not exist.
|
||||||
static const ReturnValue_t FILE_NOT_EXISTS = MAKE_RETURN_CODE(0xA3);
|
static const ReturnValue_t FILE_NOT_EXISTS = MAKE_RETURN_CODE(0xA3);
|
||||||
@ -71,15 +74,13 @@ class PlocUpdater : public SystemObject,
|
|||||||
|
|
||||||
//! [EXPORT] : [COMMENT] Try to read update file but the file does not exist.
|
//! [EXPORT] : [COMMENT] Try to read update file but the file does not exist.
|
||||||
//! P1: Indicates in which state the file read fails
|
//! P1: Indicates in which state the file read fails
|
||||||
//! P2: During the update transfer the second parameter gives information about the number of
|
//! P2: During the update transfer the second parameter gives information about the number of already sent packets
|
||||||
//! already sent packets
|
|
||||||
static const Event UPDATE_FILE_NOT_EXISTS = MAKE_EVENT(0, severity::LOW);
|
static const Event UPDATE_FILE_NOT_EXISTS = MAKE_EVENT(0, severity::LOW);
|
||||||
//! [EXPORT] : [COMMENT] Failed to send command to supervisor handler
|
//! [EXPORT] : [COMMENT] Failed to send command to supervisor handler
|
||||||
//! P1: Return value of CommandActionHelper::commandAction
|
//! P1: Return value of CommandActionHelper::commandAction
|
||||||
//! P2: Action ID of command to send
|
//! P2: Action ID of command to send
|
||||||
static const Event ACTION_COMMANDING_FAILED = MAKE_EVENT(1, severity::LOW);
|
static const Event ACTION_COMMANDING_FAILED = MAKE_EVENT(1, severity::LOW);
|
||||||
//! [EXPORT] : [COMMENT] Supervisor handler replied action message indicating a command execution
|
//! [EXPORT] : [COMMENT] Supervisor handler replied action message indicating a command execution failure of the update available command
|
||||||
//! failure of the update available command
|
|
||||||
static const Event UPDATE_AVAILABLE_FAILED = MAKE_EVENT(2, severity::LOW);
|
static const Event UPDATE_AVAILABLE_FAILED = MAKE_EVENT(2, severity::LOW);
|
||||||
//! [EXPORT] : [COMMENT] Supervisor handler failed to transfer an update space packet.
|
//! [EXPORT] : [COMMENT] Supervisor handler failed to transfer an update space packet.
|
||||||
//! P1: Parameter holds the number of update packets already sent (inclusive the failed packet)
|
//! P1: Parameter holds the number of update packets already sent (inclusive the failed packet)
|
||||||
@ -121,11 +122,21 @@ class PlocUpdater : public SystemObject,
|
|||||||
|
|
||||||
ActionId_t pendingCommand = PLOC_SPV::NONE;
|
ActionId_t pendingCommand = PLOC_SPV::NONE;
|
||||||
|
|
||||||
enum class Image : uint8_t { NONE, A, B };
|
enum class Image: uint8_t {
|
||||||
|
NONE,
|
||||||
|
A,
|
||||||
|
B
|
||||||
|
};
|
||||||
|
|
||||||
Image image = Image::NONE;
|
Image image = Image::NONE;
|
||||||
|
|
||||||
enum class Partition : uint8_t { NONE, UBOOT, BITSTREAM, LINUX_OS, APP_SW };
|
enum class Partition: uint8_t {
|
||||||
|
NONE,
|
||||||
|
UBOOT,
|
||||||
|
BITSTREAM,
|
||||||
|
LINUX_OS,
|
||||||
|
APP_SW
|
||||||
|
};
|
||||||
|
|
||||||
Partition partition = Partition::NONE;
|
Partition partition = Partition::NONE;
|
||||||
|
|
||||||
@ -163,6 +174,13 @@ class PlocUpdater : public SystemObject,
|
|||||||
*/
|
*/
|
||||||
void commandUpdateVerify();
|
void commandUpdateVerify();
|
||||||
|
|
||||||
|
#if BOARD_TE0720 == 0
|
||||||
|
/**
|
||||||
|
* @brief Checks whether the SD card to read from is mounted or not.
|
||||||
|
*/
|
||||||
|
bool isSdCardMounted(sd::SdCard sdCard);
|
||||||
|
#endif
|
||||||
|
|
||||||
void calcImageCrc();
|
void calcImageCrc();
|
||||||
|
|
||||||
void adjustSequenceFlags(PLOC_SPV::UpdatePacket& packet);
|
void adjustSequenceFlags(PLOC_SPV::UpdatePacket& packet);
|
||||||
|
@ -5,17 +5,18 @@
|
|||||||
|
|
||||||
class MemoryParams: public SerialLinkedListAdapter<SerializeIF> {
|
class MemoryParams: public SerialLinkedListAdapter<SerializeIF> {
|
||||||
public:
|
public:
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Constructor
|
* @brief Constructor
|
||||||
* @param startAddress Start of address range to dump
|
* @param startAddress Start of address range to dump
|
||||||
* @param endAddress End of address range to dump
|
* @param endAddress End of address range to dump
|
||||||
*/
|
*/
|
||||||
MemoryParams(uint32_t startAddress, uint32_t endAddress)
|
MemoryParams(uint32_t startAddress, uint32_t endAddress) :
|
||||||
: startAddress(startAddress), endAddress(endAddress) {
|
startAddress(startAddress), endAddress(endAddress) {
|
||||||
setLinks();
|
setLinks();
|
||||||
}
|
}
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
|
||||||
void setLinks() {
|
void setLinks() {
|
||||||
setStart(&startAddress);
|
setStart(&startAddress);
|
||||||
startAddress.setNext(&endAddress);
|
startAddress.setNext(&endAddress);
|
||||||
@ -23,6 +24,10 @@ class MemoryParams : public SerialLinkedListAdapter<SerializeIF> {
|
|||||||
|
|
||||||
SerializeElement<uint32_t> startAddress;
|
SerializeElement<uint32_t> startAddress;
|
||||||
SerializeElement<uint32_t> endAddress;
|
SerializeElement<uint32_t> endAddress;
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
#endif /* BSP_Q7S_DEVICES_DEVICEDEFINITIONS_PLOCMEMDUMPDEFINITIONS_H_ */
|
#endif /* BSP_Q7S_DEVICES_DEVICEDEFINITIONS_PLOCMEMDUMPDEFINITIONS_H_ */
|
||||||
|
File diff suppressed because it is too large
Load Diff
3
bsp_q7s/gpio/CMakeLists.txt
Normal file
3
bsp_q7s/gpio/CMakeLists.txt
Normal file
@ -0,0 +1,3 @@
|
|||||||
|
target_sources(${TARGET_NAME} PRIVATE
|
||||||
|
gpioCallbacks.cpp
|
||||||
|
)
|
340
bsp_q7s/gpio/gpioCallbacks.cpp
Normal file
340
bsp_q7s/gpio/gpioCallbacks.cpp
Normal file
@ -0,0 +1,340 @@
|
|||||||
|
#include "gpioCallbacks.h"
|
||||||
|
#include "busConf.h"
|
||||||
|
#include <devices/gpioIds.h>
|
||||||
|
|
||||||
|
#include <fsfw_hal/linux/gpio/LinuxLibgpioIF.h>
|
||||||
|
#include <fsfw_hal/common/gpio/GpioCookie.h>
|
||||||
|
#include <fsfw/serviceinterface/ServiceInterface.h>
|
||||||
|
|
||||||
|
|
||||||
|
namespace gpioCallbacks {
|
||||||
|
|
||||||
|
GpioIF* gpioComInterface;
|
||||||
|
|
||||||
|
void initSpiCsDecoder(GpioIF* gpioComIF) {
|
||||||
|
|
||||||
|
ReturnValue_t result;
|
||||||
|
|
||||||
|
if (gpioComIF == nullptr) {
|
||||||
|
sif::debug << "initSpiCsDecoder: Invalid gpioComIF" << std::endl;
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
gpioComInterface = gpioComIF;
|
||||||
|
|
||||||
|
GpioCookie* spiMuxGpios = new GpioCookie;
|
||||||
|
|
||||||
|
GpiodRegularByLabel* spiMuxBit = nullptr;
|
||||||
|
/** Setting mux bit 1 to low will disable IC21 on the interface board */
|
||||||
|
spiMuxBit = new GpiodRegularByLabel(q7s::GPIO_3V3_OBC1C, q7s::SPI_MUX_BIT_1,
|
||||||
|
"SPI Mux Bit 1", gpio::OUT, gpio::LOW);
|
||||||
|
spiMuxGpios->addGpio(gpioIds::SPI_MUX_BIT_1, spiMuxBit);
|
||||||
|
/** Setting mux bit 2 to low disables IC1 on the TCS board */
|
||||||
|
spiMuxBit = new GpiodRegularByLabel(q7s::GPIO_3V3_OBC1C, q7s::SPI_MUX_BIT_2,
|
||||||
|
"SPI Mux Bit 2", gpio::OUT, gpio::LOW);
|
||||||
|
spiMuxGpios->addGpio(gpioIds::SPI_MUX_BIT_2, spiMuxBit);
|
||||||
|
/** Setting mux bit 3 to low disables IC2 on the TCS board and IC22 on the interface board */
|
||||||
|
spiMuxBit = new GpiodRegularByLabel(q7s::GPIO_3V3_OBC1C, q7s::SPI_MUX_BIT_3,
|
||||||
|
"SPI Mux Bit 3", gpio::OUT, gpio::LOW);
|
||||||
|
spiMuxGpios->addGpio(gpioIds::SPI_MUX_BIT_3, spiMuxBit);
|
||||||
|
/** The following gpios can take arbitrary initial values */
|
||||||
|
spiMuxBit = new GpiodRegularByLabel(q7s::GPIO_3V3_OBC1C, q7s::SPI_MUX_BIT_4,
|
||||||
|
"SPI Mux Bit 4", gpio::OUT, gpio::LOW);
|
||||||
|
spiMuxGpios->addGpio(gpioIds::SPI_MUX_BIT_4, spiMuxBit);
|
||||||
|
spiMuxBit = new GpiodRegularByLabel(q7s::GPIO_3V3_OBC1C, q7s::SPI_MUX_BIT_5,
|
||||||
|
"SPI Mux Bit 5", gpio::OUT, gpio::LOW);
|
||||||
|
spiMuxGpios->addGpio(gpioIds::SPI_MUX_BIT_5, spiMuxBit);
|
||||||
|
spiMuxBit = new GpiodRegularByLabel(q7s::GPIO_3V3_OBC1C, q7s::SPI_MUX_BIT_6,
|
||||||
|
"SPI Mux Bit 6", gpio::OUT, gpio::LOW);
|
||||||
|
spiMuxGpios->addGpio(gpioIds::SPI_MUX_BIT_6, spiMuxBit);
|
||||||
|
GpiodRegularByLabel* enRwDecoder = new GpiodRegularByLabel(q7s::GPIO_FLEX_OBC1F_B1,
|
||||||
|
q7s::EN_RW_CS, "EN_RW_CS", gpio::OUT, gpio::HIGH);
|
||||||
|
spiMuxGpios->addGpio(gpioIds::EN_RW_CS, enRwDecoder);
|
||||||
|
|
||||||
|
result = gpioComInterface->addGpios(spiMuxGpios);
|
||||||
|
if (result != HasReturnvaluesIF::RETURN_OK) {
|
||||||
|
sif::error << "initSpiCsDecoder: Failed to add mux bit gpios to gpioComIF" << std::endl;
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void spiCsDecoderCallback(gpioId_t gpioId, gpio::GpioOperation gpioOp, int value,
|
||||||
|
void* args) {
|
||||||
|
|
||||||
|
if (gpioComInterface == nullptr) {
|
||||||
|
sif::debug << "spiCsDecoderCallback: No gpioComIF specified. Call initSpiCsDecoder "
|
||||||
|
<< "to specify gpioComIF" << std::endl;
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Reading is not supported by the callback function */
|
||||||
|
if (gpioOp == gpio::GpioOperation::READ) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (value == 1) {
|
||||||
|
disableAllDecoder();
|
||||||
|
}
|
||||||
|
else if (value == 0) {
|
||||||
|
switch (gpioId) {
|
||||||
|
case(gpioIds::RTD_IC3): {
|
||||||
|
enableDecoderTcsIc1();
|
||||||
|
selectY7();
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
case(gpioIds::RTD_IC4): {
|
||||||
|
enableDecoderTcsIc1();
|
||||||
|
selectY6();
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
case(gpioIds::RTD_IC5): {
|
||||||
|
enableDecoderTcsIc1();
|
||||||
|
selectY5();
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
case(gpioIds::RTD_IC6): {
|
||||||
|
enableDecoderTcsIc1();
|
||||||
|
selectY4();
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
case(gpioIds::RTD_IC7): {
|
||||||
|
enableDecoderTcsIc1();
|
||||||
|
selectY3();
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
case(gpioIds::RTD_IC8): {
|
||||||
|
enableDecoderTcsIc1();
|
||||||
|
selectY2();
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
case(gpioIds::RTD_IC9): {
|
||||||
|
enableDecoderTcsIc1();
|
||||||
|
selectY1();
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
case(gpioIds::RTD_IC10): {
|
||||||
|
enableDecoderTcsIc1();
|
||||||
|
selectY0();
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
case(gpioIds::RTD_IC11): {
|
||||||
|
enableDecoderTcsIc2();
|
||||||
|
selectY7();
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
case(gpioIds::RTD_IC12): {
|
||||||
|
enableDecoderTcsIc2();
|
||||||
|
selectY6();
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
case(gpioIds::RTD_IC13): {
|
||||||
|
enableDecoderTcsIc2();
|
||||||
|
selectY5();
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
case(gpioIds::RTD_IC14): {
|
||||||
|
enableDecoderTcsIc2();
|
||||||
|
selectY4();
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
case(gpioIds::RTD_IC15): {
|
||||||
|
enableDecoderTcsIc2();
|
||||||
|
selectY3();
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
case(gpioIds::RTD_IC16): {
|
||||||
|
enableDecoderTcsIc2();
|
||||||
|
selectY2();
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
case(gpioIds::RTD_IC17): {
|
||||||
|
enableDecoderTcsIc2();
|
||||||
|
selectY1();
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
case(gpioIds::RTD_IC18): {
|
||||||
|
enableDecoderTcsIc2();
|
||||||
|
selectY0();
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
case(gpioIds::CS_SUS_1): {
|
||||||
|
enableDecoderInterfaceBoardIc1();
|
||||||
|
selectY0();
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
case(gpioIds::CS_SUS_2): {
|
||||||
|
enableDecoderInterfaceBoardIc1();
|
||||||
|
selectY1();
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
case(gpioIds::CS_SUS_3): {
|
||||||
|
enableDecoderInterfaceBoardIc2();
|
||||||
|
selectY0();
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
case(gpioIds::CS_SUS_4): {
|
||||||
|
enableDecoderInterfaceBoardIc2();
|
||||||
|
selectY1();
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
case(gpioIds::CS_SUS_5): {
|
||||||
|
enableDecoderInterfaceBoardIc2();
|
||||||
|
selectY2();
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
case(gpioIds::CS_SUS_6): {
|
||||||
|
enableDecoderInterfaceBoardIc1();
|
||||||
|
selectY2();
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
case(gpioIds::CS_SUS_7): {
|
||||||
|
enableDecoderInterfaceBoardIc1();
|
||||||
|
selectY3();
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
case(gpioIds::CS_SUS_8): {
|
||||||
|
enableDecoderInterfaceBoardIc2();
|
||||||
|
selectY3();
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
case(gpioIds::CS_SUS_9): {
|
||||||
|
enableDecoderInterfaceBoardIc1();
|
||||||
|
selectY4();
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
case(gpioIds::CS_SUS_10): {
|
||||||
|
enableDecoderInterfaceBoardIc1();
|
||||||
|
selectY5();
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
case(gpioIds::CS_SUS_11): {
|
||||||
|
enableDecoderInterfaceBoardIc2();
|
||||||
|
selectY4();
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
case(gpioIds::CS_SUS_12): {
|
||||||
|
enableDecoderInterfaceBoardIc2();
|
||||||
|
selectY5();
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
case(gpioIds::CS_SUS_13): {
|
||||||
|
enableDecoderInterfaceBoardIc1();
|
||||||
|
selectY6();
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
case(gpioIds::CS_RW1): {
|
||||||
|
enableRwDecoder();
|
||||||
|
selectY0();
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
case(gpioIds::CS_RW2): {
|
||||||
|
enableRwDecoder();
|
||||||
|
selectY1();
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
case(gpioIds::CS_RW3): {
|
||||||
|
enableRwDecoder();
|
||||||
|
selectY2();
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
case(gpioIds::CS_RW4): {
|
||||||
|
enableRwDecoder();
|
||||||
|
selectY3();
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
default:
|
||||||
|
sif::debug << "spiCsDecoderCallback: Invalid gpio id " << gpioId << std::endl;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
sif::debug << "spiCsDecoderCallback: Invalid value. Must be 0 or 1" << std::endl;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void enableDecoderTcsIc1() {
|
||||||
|
gpioComInterface->pullLow(gpioIds::SPI_MUX_BIT_1);
|
||||||
|
gpioComInterface->pullHigh(gpioIds::SPI_MUX_BIT_2);
|
||||||
|
gpioComInterface->pullLow(gpioIds::SPI_MUX_BIT_3);
|
||||||
|
}
|
||||||
|
|
||||||
|
void enableDecoderTcsIc2() {
|
||||||
|
gpioComInterface->pullLow(gpioIds::SPI_MUX_BIT_1);
|
||||||
|
gpioComInterface->pullHigh(gpioIds::SPI_MUX_BIT_2);
|
||||||
|
gpioComInterface->pullHigh(gpioIds::SPI_MUX_BIT_3);
|
||||||
|
}
|
||||||
|
|
||||||
|
void enableDecoderInterfaceBoardIc1() {
|
||||||
|
gpioComInterface->pullHigh(gpioIds::SPI_MUX_BIT_1);
|
||||||
|
gpioComInterface->pullLow(gpioIds::SPI_MUX_BIT_2);
|
||||||
|
gpioComInterface->pullLow(gpioIds::SPI_MUX_BIT_3);
|
||||||
|
}
|
||||||
|
|
||||||
|
void enableDecoderInterfaceBoardIc2() {
|
||||||
|
gpioComInterface->pullHigh(gpioIds::SPI_MUX_BIT_1);
|
||||||
|
gpioComInterface->pullLow(gpioIds::SPI_MUX_BIT_2);
|
||||||
|
gpioComInterface->pullHigh(gpioIds::SPI_MUX_BIT_3);
|
||||||
|
}
|
||||||
|
|
||||||
|
void enableRwDecoder() {
|
||||||
|
gpioComInterface->pullLow(gpioIds::SPI_MUX_BIT_1);
|
||||||
|
gpioComInterface->pullLow(gpioIds::SPI_MUX_BIT_2);
|
||||||
|
gpioComInterface->pullLow(gpioIds::SPI_MUX_BIT_3);
|
||||||
|
gpioComInterface->pullHigh(gpioIds::EN_RW_CS);
|
||||||
|
}
|
||||||
|
|
||||||
|
void selectY0() {
|
||||||
|
gpioComInterface->pullLow(gpioIds::SPI_MUX_BIT_4);
|
||||||
|
gpioComInterface->pullLow(gpioIds::SPI_MUX_BIT_5);
|
||||||
|
gpioComInterface->pullLow(gpioIds::SPI_MUX_BIT_6);
|
||||||
|
}
|
||||||
|
|
||||||
|
void selectY1() {
|
||||||
|
gpioComInterface->pullHigh(gpioIds::SPI_MUX_BIT_4);
|
||||||
|
gpioComInterface->pullLow(gpioIds::SPI_MUX_BIT_5);
|
||||||
|
gpioComInterface->pullLow(gpioIds::SPI_MUX_BIT_6);
|
||||||
|
}
|
||||||
|
|
||||||
|
void selectY2() {
|
||||||
|
gpioComInterface->pullLow(gpioIds::SPI_MUX_BIT_4);
|
||||||
|
gpioComInterface->pullHigh(gpioIds::SPI_MUX_BIT_5);
|
||||||
|
gpioComInterface->pullLow(gpioIds::SPI_MUX_BIT_6);
|
||||||
|
}
|
||||||
|
|
||||||
|
void selectY3() {
|
||||||
|
gpioComInterface->pullHigh(gpioIds::SPI_MUX_BIT_4);
|
||||||
|
gpioComInterface->pullHigh(gpioIds::SPI_MUX_BIT_5);
|
||||||
|
gpioComInterface->pullLow(gpioIds::SPI_MUX_BIT_6);
|
||||||
|
}
|
||||||
|
|
||||||
|
void selectY4() {
|
||||||
|
gpioComInterface->pullLow(gpioIds::SPI_MUX_BIT_4);
|
||||||
|
gpioComInterface->pullLow(gpioIds::SPI_MUX_BIT_5);
|
||||||
|
gpioComInterface->pullHigh(gpioIds::SPI_MUX_BIT_6);
|
||||||
|
}
|
||||||
|
|
||||||
|
void selectY5() {
|
||||||
|
gpioComInterface->pullHigh(gpioIds::SPI_MUX_BIT_4);
|
||||||
|
gpioComInterface->pullLow(gpioIds::SPI_MUX_BIT_5);
|
||||||
|
gpioComInterface->pullHigh(gpioIds::SPI_MUX_BIT_6);
|
||||||
|
}
|
||||||
|
|
||||||
|
void selectY6() {
|
||||||
|
gpioComInterface->pullLow(gpioIds::SPI_MUX_BIT_4);
|
||||||
|
gpioComInterface->pullHigh(gpioIds::SPI_MUX_BIT_5);
|
||||||
|
gpioComInterface->pullHigh(gpioIds::SPI_MUX_BIT_6);
|
||||||
|
}
|
||||||
|
|
||||||
|
void selectY7() {
|
||||||
|
gpioComInterface->pullHigh(gpioIds::SPI_MUX_BIT_4);
|
||||||
|
gpioComInterface->pullHigh(gpioIds::SPI_MUX_BIT_5);
|
||||||
|
gpioComInterface->pullHigh(gpioIds::SPI_MUX_BIT_6);
|
||||||
|
}
|
||||||
|
|
||||||
|
void disableAllDecoder() {
|
||||||
|
gpioComInterface->pullLow(gpioIds::SPI_MUX_BIT_1);
|
||||||
|
gpioComInterface->pullLow(gpioIds::SPI_MUX_BIT_2);
|
||||||
|
gpioComInterface->pullLow(gpioIds::SPI_MUX_BIT_3);
|
||||||
|
gpioComInterface->pullLow(gpioIds::EN_RW_CS);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
67
bsp_q7s/gpio/gpioCallbacks.h
Normal file
67
bsp_q7s/gpio/gpioCallbacks.h
Normal file
@ -0,0 +1,67 @@
|
|||||||
|
#ifndef LINUX_GPIO_GPIOCALLBACKS_H_
|
||||||
|
#define LINUX_GPIO_GPIOCALLBACKS_H_
|
||||||
|
|
||||||
|
#include <fsfw_hal/common/gpio/gpioDefinitions.h>
|
||||||
|
#include <fsfw_hal/common/gpio/GpioIF.h>
|
||||||
|
|
||||||
|
|
||||||
|
namespace gpioCallbacks {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief This function initializes the GPIOs used to control the SN74LVC138APWR decoders on
|
||||||
|
* the TCS Board and the interface board.
|
||||||
|
*/
|
||||||
|
void initSpiCsDecoder(GpioIF* gpioComIF);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief This function implements the decoding to multiply gpios by using the decoder
|
||||||
|
* chips SN74LVC138APWR on the TCS board and the interface board.
|
||||||
|
*/
|
||||||
|
void spiCsDecoderCallback(gpioId_t gpioId, gpio::GpioOperation gpioOp, int value, void* args);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief This function sets mux bits 1-3 to a state which will only enable the decoder
|
||||||
|
* on the TCS board which is named to IC1 in the schematic.
|
||||||
|
*/
|
||||||
|
void enableDecoderTcsIc1();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief This function sets mux bits 1-3 to a state which will only enable the decoder
|
||||||
|
* on the TCS board which is named to IC2 in the schematic.
|
||||||
|
*/
|
||||||
|
void enableDecoderTcsIc2();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief This function sets mux bits 1-3 to a state which will only enable the decoder
|
||||||
|
* on the inteface board board which is named to IC21 in the schematic.
|
||||||
|
*/
|
||||||
|
void enableDecoderInterfaceBoardIc1();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief This function sets mux bits 1-3 to a state which will only enable the decoder
|
||||||
|
* on the inteface board board which is named to IC22 in the schematic.
|
||||||
|
*/
|
||||||
|
void enableDecoderInterfaceBoardIc2();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Enables the reaction wheel chip select decoder (IC3).
|
||||||
|
*/
|
||||||
|
void enableRwDecoder();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief This function disables all decoder.
|
||||||
|
*/
|
||||||
|
void disableAllDecoder();
|
||||||
|
|
||||||
|
/** The following functions enable the appropriate channel of the currently enabled decoder */
|
||||||
|
void selectY0();
|
||||||
|
void selectY1();
|
||||||
|
void selectY2();
|
||||||
|
void selectY3();
|
||||||
|
void selectY4();
|
||||||
|
void selectY5();
|
||||||
|
void selectY6();
|
||||||
|
void selectY7();
|
||||||
|
}
|
||||||
|
|
||||||
|
#endif /* LINUX_GPIO_GPIOCALLBACKS_H_ */
|
@ -12,7 +12,8 @@
|
|||||||
* @brief This is the main program for the target hardware.
|
* @brief This is the main program for the target hardware.
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
int main(void) {
|
int main(void)
|
||||||
|
{
|
||||||
using namespace std;
|
using namespace std;
|
||||||
#if Q7S_SIMPLE_MODE == 0
|
#if Q7S_SIMPLE_MODE == 0
|
||||||
return obsw::obsw();
|
return obsw::obsw();
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
target_sources(${OBSW_NAME} PRIVATE
|
target_sources(${TARGET_NAME} PRIVATE
|
||||||
FileSystemHandler.cpp
|
FileSystemHandler.cpp
|
||||||
SdCardManager.cpp
|
SdCardManager.cpp
|
||||||
scratchApi.cpp
|
scratchApi.cpp
|
||||||
|
@ -1,31 +1,33 @@
|
|||||||
#include "FileSystemHandler.h"
|
#include "FileSystemHandler.h"
|
||||||
|
|
||||||
#include <cstring>
|
|
||||||
#include <filesystem>
|
|
||||||
#include <fstream>
|
|
||||||
|
|
||||||
#include "bsp_q7s/core/CoreController.h"
|
#include "bsp_q7s/core/CoreController.h"
|
||||||
#include "fsfw/ipc/QueueFactory.h"
|
|
||||||
#include "fsfw/memory/GenericFileSystemMessage.h"
|
|
||||||
#include "fsfw/tasks/TaskFactory.h"
|
|
||||||
|
|
||||||
FileSystemHandler::FileSystemHandler(object_id_t fileSystemHandler)
|
#include "fsfw/tasks/TaskFactory.h"
|
||||||
: SystemObject(fileSystemHandler) {
|
#include "fsfw/memory/GenericFileSystemMessage.h"
|
||||||
auto mqArgs = MqArgs(this->getObjectId());
|
#include "fsfw/ipc/QueueFactory.h"
|
||||||
mq = QueueFactory::instance()->createMessageQueue(FS_MAX_QUEUE_SIZE,
|
|
||||||
MessageQueueMessage::MAX_MESSAGE_SIZE, &mqArgs);
|
#include <cstring>
|
||||||
|
#include <fstream>
|
||||||
|
#include <filesystem>
|
||||||
|
|
||||||
|
FileSystemHandler::FileSystemHandler(object_id_t fileSystemHandler):
|
||||||
|
SystemObject(fileSystemHandler) {
|
||||||
|
mq = QueueFactory::instance()->createMessageQueue(FS_MAX_QUEUE_SIZE);
|
||||||
}
|
}
|
||||||
|
|
||||||
FileSystemHandler::~FileSystemHandler() { QueueFactory::instance()->deleteMessageQueue(mq); }
|
FileSystemHandler::~FileSystemHandler() {
|
||||||
|
QueueFactory::instance()->deleteMessageQueue(mq);
|
||||||
|
}
|
||||||
|
|
||||||
ReturnValue_t FileSystemHandler::performOperation(uint8_t unsignedChar) {
|
ReturnValue_t FileSystemHandler::performOperation(uint8_t unsignedChar) {
|
||||||
while(true) {
|
while(true) {
|
||||||
try {
|
try {
|
||||||
fileSystemHandlerLoop();
|
fileSystemHandlerLoop();
|
||||||
} catch (std::bad_alloc& e) {
|
}
|
||||||
|
catch(std::bad_alloc& e) {
|
||||||
// Restart OBSW, hints at a memory leak
|
// Restart OBSW, hints at a memory leak
|
||||||
sif::error << "Allocation error in FileSystemHandler::performOperation" << e.what()
|
sif::error << "Allocation error in FileSystemHandler::performOperation"
|
||||||
<< std::endl;
|
<< e.what() << std::endl;
|
||||||
// Set up an error file or a special flag in the scratch buffer for these cases
|
// Set up an error file or a special flag in the scratch buffer for these cases
|
||||||
triggerEvent(CoreController::ALLOC_FAILURE, 0 , 0);
|
triggerEvent(CoreController::ALLOC_FAILURE, 0 , 0);
|
||||||
CoreController::incrementAllocationFailureCount();
|
CoreController::incrementAllocationFailureCount();
|
||||||
@ -33,6 +35,7 @@ ReturnValue_t FileSystemHandler::performOperation(uint8_t unsignedChar) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void FileSystemHandler::fileSystemHandlerLoop() {
|
void FileSystemHandler::fileSystemHandlerLoop() {
|
||||||
CommandMessage filemsg;
|
CommandMessage filemsg;
|
||||||
ReturnValue_t result = HasReturnvaluesIF::RETURN_OK;
|
ReturnValue_t result = HasReturnvaluesIF::RETURN_OK;
|
||||||
@ -45,8 +48,10 @@ void FileSystemHandler::fileSystemHandlerLoop() {
|
|||||||
result = mq->receiveMessage(&filemsg);
|
result = mq->receiveMessage(&filemsg);
|
||||||
if(result == MessageQueueIF::EMPTY) {
|
if(result == MessageQueueIF::EMPTY) {
|
||||||
break;
|
break;
|
||||||
} else if (result != HasReturnvaluesIF::RETURN_FAILED) {
|
}
|
||||||
sif::warning << "FileSystemHandler::performOperation: Message reception failed!" << std::endl;
|
else if(result != HasReturnvaluesIF::RETURN_FAILED) {
|
||||||
|
sif::warning << "FileSystemHandler::performOperation: Message reception failed!"
|
||||||
|
<< std::endl;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
Command_t command = filemsg.getCommand();
|
Command_t command = filemsg.getCommand();
|
||||||
@ -73,23 +78,26 @@ void FileSystemHandler::fileSystemCheckup() {
|
|||||||
sdcMan->getSdCardActiveStatus(statusPair);
|
sdcMan->getSdCardActiveStatus(statusPair);
|
||||||
sd::SdCard preferredSdCard;
|
sd::SdCard preferredSdCard;
|
||||||
sdcMan->getPreferredSdCard(preferredSdCard);
|
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
|
||||||
(statusPair.second == sd::SdState::MOUNTED)) {
|
(statusPair.second == sd::SdState::MOUNTED)) {
|
||||||
currentMountPrefix = SdCardManager::SD_1_MOUNT_POINT;
|
currentMountPrefix = SdCardManager::SD_1_MOUNT_POINT;
|
||||||
} else {
|
}
|
||||||
|
else {
|
||||||
std::string sdString;
|
std::string sdString;
|
||||||
if(preferredSdCard == sd::SdCard::SLOT_0) {
|
if(preferredSdCard == sd::SdCard::SLOT_0) {
|
||||||
sdString = "0";
|
sdString = "0";
|
||||||
} else {
|
}
|
||||||
|
else {
|
||||||
sdString = "1";
|
sdString = "1";
|
||||||
}
|
}
|
||||||
sif::warning << "FileSystemHandler::performOperation: "
|
sif::warning << "FileSystemHandler::performOperation: "
|
||||||
"Inconsistent state detected"
|
"Inconsistent state detected" << std::endl;
|
||||||
<< std::endl;
|
sif::warning << "Preferred SD card is " << sdString <<
|
||||||
sif::warning << "Preferred SD card is " << sdString
|
" but does not appear to be mounted. Attempting fix.." << std::endl;
|
||||||
<< " but does not appear to be mounted. Attempting fix.." << std::endl;
|
|
||||||
// This function will appear to fix the inconsistent state
|
// This function will appear to fix the inconsistent state
|
||||||
ReturnValue_t result = sdcMan->sanitizeState(&statusPair, preferredSdCard);
|
ReturnValue_t result = sdcMan->sanitizeState(&statusPair, preferredSdCard);
|
||||||
if(result != HasReturnvaluesIF::RETURN_OK) {
|
if(result != HasReturnvaluesIF::RETURN_OK) {
|
||||||
@ -100,13 +108,15 @@ void FileSystemHandler::fileSystemCheckup() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
MessageQueueId_t FileSystemHandler::getCommandQueue() const { return mq->getId(); }
|
MessageQueueId_t FileSystemHandler::getCommandQueue() const {
|
||||||
|
return mq->getId();
|
||||||
|
}
|
||||||
|
|
||||||
ReturnValue_t FileSystemHandler::initialize() {
|
ReturnValue_t FileSystemHandler::initialize() {
|
||||||
coreCtrl = ObjectManager::instance()->get<CoreController>(objects::CORE_CONTROLLER);
|
coreCtrl = ObjectManager::instance()->get<CoreController>(objects::CORE_CONTROLLER);
|
||||||
if(coreCtrl == nullptr) {
|
if(coreCtrl == nullptr) {
|
||||||
sif::error << "FileSystemHandler::initialize: Could not retrieve core controller handle"
|
sif::error << "FileSystemHandler::initialize: Could not retrieve core controller handle" <<
|
||||||
<< std::endl;
|
std::endl;
|
||||||
}
|
}
|
||||||
sdcMan = SdCardManager::instance();
|
sdcMan = SdCardManager::instance();
|
||||||
sd::SdCard preferredSdCard;
|
sd::SdCard preferredSdCard;
|
||||||
@ -116,20 +126,22 @@ ReturnValue_t FileSystemHandler::initialize() {
|
|||||||
}
|
}
|
||||||
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) {
|
||||||
currentMountPrefix = SdCardManager::SD_1_MOUNT_POINT;
|
currentMountPrefix = SdCardManager::SD_1_MOUNT_POINT;
|
||||||
}
|
}
|
||||||
return HasReturnvaluesIF::RETURN_OK;
|
return HasReturnvaluesIF::RETURN_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
ReturnValue_t FileSystemHandler::appendToFile(const char *repositoryPath, const char *filename,
|
ReturnValue_t FileSystemHandler::appendToFile(const char *repositoryPath, const char *filename,
|
||||||
const uint8_t* data, size_t size,
|
const uint8_t *data, size_t size, uint16_t packetNumber, void *args) {
|
||||||
uint16_t packetNumber, FileSystemArgsIF* args) {
|
// A double slash between repo and filename should not be an issue, so add it in any case
|
||||||
auto path = getInitPath(args) / repositoryPath / filename;
|
std::string fullPath = currentMountPrefix + std::string(repositoryPath) + "/" +
|
||||||
if (not std::filesystem::exists(path)) {
|
std::string(filename);
|
||||||
|
if(not std::filesystem::exists(fullPath)) {
|
||||||
return FILE_DOES_NOT_EXIST;
|
return FILE_DOES_NOT_EXIST;
|
||||||
}
|
}
|
||||||
std::ofstream file(path, std::ios_base::app | std::ios_base::out);
|
std::ofstream file(fullPath, std::ios_base::app|std::ios_base::out);
|
||||||
file.write(reinterpret_cast<const char*>(data), size);
|
file.write(reinterpret_cast<const char*>(data), size);
|
||||||
if(not file.good()) {
|
if(not file.good()) {
|
||||||
return GENERIC_FILE_ERROR;
|
return GENERIC_FILE_ERROR;
|
||||||
@ -138,13 +150,20 @@ ReturnValue_t FileSystemHandler::appendToFile(const char* repositoryPath, const
|
|||||||
}
|
}
|
||||||
|
|
||||||
ReturnValue_t FileSystemHandler::createFile(const char *repositoryPath, const char *filename,
|
ReturnValue_t FileSystemHandler::createFile(const char *repositoryPath, const char *filename,
|
||||||
const uint8_t* data, size_t size,
|
const uint8_t *data, size_t size, void *args) {
|
||||||
FileSystemArgsIF* args) {
|
std::string fullPath;
|
||||||
auto path = getInitPath(args) / filename;
|
bool useMountPrefix = true;
|
||||||
if (std::filesystem::exists(path)) {
|
parseCfg(reinterpret_cast<FsCommandCfg*>(args), useMountPrefix);
|
||||||
|
if(useMountPrefix) {
|
||||||
|
fullPath += currentMountPrefix;
|
||||||
|
}
|
||||||
|
|
||||||
|
// A double slash between repo and filename should not be an issue, so add it in any case
|
||||||
|
fullPath += std::string(repositoryPath) + "/" + std::string(filename);
|
||||||
|
if(std::filesystem::exists(fullPath)) {
|
||||||
return FILE_ALREADY_EXISTS;
|
return FILE_ALREADY_EXISTS;
|
||||||
}
|
}
|
||||||
std::ofstream file(path);
|
std::ofstream file(fullPath);
|
||||||
file.write(reinterpret_cast<const char*>(data), size);
|
file.write(reinterpret_cast<const char*>(data), size);
|
||||||
if(not file.good()) {
|
if(not file.good()) {
|
||||||
return GENERIC_FILE_ERROR;
|
return GENERIC_FILE_ERROR;
|
||||||
@ -153,12 +172,20 @@ ReturnValue_t FileSystemHandler::createFile(const char* repositoryPath, const ch
|
|||||||
}
|
}
|
||||||
|
|
||||||
ReturnValue_t FileSystemHandler::removeFile(const char *repositoryPath, const char *filename,
|
ReturnValue_t FileSystemHandler::removeFile(const char *repositoryPath, const char *filename,
|
||||||
FileSystemArgsIF* args) {
|
void *args) {
|
||||||
auto path = getInitPath(args) / repositoryPath / filename;
|
std::string fullPath;
|
||||||
if (not std::filesystem::exists(path)) {
|
bool useMountPrefix = true;
|
||||||
|
parseCfg(reinterpret_cast<FsCommandCfg*>(args), useMountPrefix);
|
||||||
|
if(useMountPrefix) {
|
||||||
|
fullPath += currentMountPrefix;
|
||||||
|
}
|
||||||
|
|
||||||
|
// A double slash between repo and filename should not be an issue, so add it in any case
|
||||||
|
fullPath += std::string(repositoryPath) + "/" + std::string(filename);
|
||||||
|
if(not std::filesystem::exists(fullPath)) {
|
||||||
return FILE_DOES_NOT_EXIST;
|
return FILE_DOES_NOT_EXIST;
|
||||||
}
|
}
|
||||||
int result = std::remove(path.c_str());
|
int result = std::remove(fullPath.c_str());
|
||||||
if(result != 0) {
|
if(result != 0) {
|
||||||
sif::warning << "FileSystemHandler::deleteFile: Failed with code " << result << std::endl;
|
sif::warning << "FileSystemHandler::deleteFile: Failed with code " << result << std::endl;
|
||||||
return GENERIC_FILE_ERROR;
|
return GENERIC_FILE_ERROR;
|
||||||
@ -166,51 +193,68 @@ ReturnValue_t FileSystemHandler::removeFile(const char* repositoryPath, const ch
|
|||||||
return HasReturnvaluesIF::RETURN_OK;
|
return HasReturnvaluesIF::RETURN_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
ReturnValue_t FileSystemHandler::createDirectory(const char* repositoryPath, const char* dirname,
|
ReturnValue_t FileSystemHandler::createDirectory(const char *repositoryPath, void *args) {
|
||||||
bool createParentDirs, FileSystemArgsIF* args) {
|
std::string fullPath;
|
||||||
auto path = getInitPath(args) / repositoryPath / dirname;
|
bool useMountPrefix = true;
|
||||||
if (std::filesystem::exists(path)) {
|
parseCfg(reinterpret_cast<FsCommandCfg*>(args), useMountPrefix);
|
||||||
|
if(useMountPrefix) {
|
||||||
|
fullPath += currentMountPrefix;
|
||||||
|
}
|
||||||
|
|
||||||
|
fullPath += std::string(repositoryPath);
|
||||||
|
if(std::filesystem::exists(fullPath)) {
|
||||||
return DIRECTORY_ALREADY_EXISTS;
|
return DIRECTORY_ALREADY_EXISTS;
|
||||||
}
|
}
|
||||||
if (std::filesystem::create_directory(path)) {
|
if(std::filesystem::create_directory(fullPath)) {
|
||||||
return HasReturnvaluesIF::RETURN_OK;
|
return HasReturnvaluesIF::RETURN_OK;
|
||||||
}
|
}
|
||||||
sif::warning << "Creating directory " << path << " failed" << std::endl;
|
sif::warning << "Creating directory " << fullPath << " failed" << std::endl;
|
||||||
return GENERIC_FILE_ERROR;
|
return GENERIC_FILE_ERROR;
|
||||||
}
|
}
|
||||||
|
|
||||||
ReturnValue_t FileSystemHandler::removeDirectory(const char* repositoryPath, const char* dirname,
|
ReturnValue_t FileSystemHandler::removeDirectory(const char *repositoryPath,
|
||||||
bool deleteRecurively, FileSystemArgsIF* args) {
|
bool deleteRecurively, void *args) {
|
||||||
auto path = getInitPath(args) / repositoryPath / dirname;
|
std::string fullPath;
|
||||||
if (not std::filesystem::exists(path)) {
|
bool useMountPrefix = true;
|
||||||
|
parseCfg(reinterpret_cast<FsCommandCfg*>(args), useMountPrefix);
|
||||||
|
if(useMountPrefix) {
|
||||||
|
fullPath += currentMountPrefix;
|
||||||
|
}
|
||||||
|
|
||||||
|
fullPath += std::string(repositoryPath);
|
||||||
|
if(not std::filesystem::exists(fullPath)) {
|
||||||
return DIRECTORY_DOES_NOT_EXIST;
|
return DIRECTORY_DOES_NOT_EXIST;
|
||||||
}
|
}
|
||||||
std::error_code err;
|
std::error_code err;
|
||||||
if(not deleteRecurively) {
|
if(not deleteRecurively) {
|
||||||
if (std::filesystem::remove(path, err)) {
|
if(std::filesystem::remove(fullPath, err)) {
|
||||||
return HasReturnvaluesIF::RETURN_OK;
|
return HasReturnvaluesIF::RETURN_OK;
|
||||||
} else {
|
}
|
||||||
|
else {
|
||||||
// Check error code. Most probably denied permissions because folder is not empty
|
// Check error code. Most probably denied permissions because folder is not empty
|
||||||
sif::warning << "FileSystemHandler::removeDirectory: Deleting directory failed with "
|
sif::warning << "FileSystemHandler::removeDirectory: Deleting directory failed with "
|
||||||
"code "
|
"code " << err.value() << ": " << strerror(err.value()) << std::endl;
|
||||||
<< err.value() << ": " << strerror(err.value()) << std::endl;
|
|
||||||
if(err.value() == ENOTEMPTY) {
|
if(err.value() == ENOTEMPTY) {
|
||||||
return DIRECTORY_NOT_EMPTY;
|
return DIRECTORY_NOT_EMPTY;
|
||||||
} else {
|
}
|
||||||
|
else {
|
||||||
return GENERIC_FILE_ERROR;
|
return GENERIC_FILE_ERROR;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
} else {
|
}
|
||||||
if (std::filesystem::remove_all(path, err)) {
|
else {
|
||||||
|
if(std::filesystem::remove_all(fullPath, err)) {
|
||||||
return HasReturnvaluesIF::RETURN_OK;
|
return HasReturnvaluesIF::RETURN_OK;
|
||||||
} else {
|
}
|
||||||
|
else {
|
||||||
sif::warning << "FileSystemHandler::removeDirectory: Deleting directory failed with "
|
sif::warning << "FileSystemHandler::removeDirectory: Deleting directory failed with "
|
||||||
"code "
|
"code " << err.value() << ": " << strerror(err.value()) << std::endl;
|
||||||
<< err.value() << ": " << strerror(err.value()) << std::endl;
|
|
||||||
// Check error code
|
// Check error code
|
||||||
if(err.value() == ENOTEMPTY) {
|
if(err.value() == ENOTEMPTY) {
|
||||||
return DIRECTORY_NOT_EMPTY;
|
return DIRECTORY_NOT_EMPTY;
|
||||||
} else {
|
}
|
||||||
|
else {
|
||||||
return GENERIC_FILE_ERROR;
|
return GENERIC_FILE_ERROR;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -219,25 +263,8 @@ ReturnValue_t FileSystemHandler::removeDirectory(const char* repositoryPath, con
|
|||||||
return HasReturnvaluesIF::RETURN_OK;
|
return HasReturnvaluesIF::RETURN_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
ReturnValue_t FileSystemHandler::renameFile(const char* repositoryPath, const char* oldFilename,
|
|
||||||
const char* newFilename, FileSystemArgsIF* args) {
|
|
||||||
auto basepath = getInitPath(args) / repositoryPath;
|
|
||||||
std::filesystem::rename(basepath / oldFilename, basepath / newFilename);
|
|
||||||
return HasReturnvaluesIF::RETURN_OK;
|
|
||||||
}
|
|
||||||
|
|
||||||
void FileSystemHandler::parseCfg(FsCommandCfg *cfg, bool& useMountPrefix) {
|
void FileSystemHandler::parseCfg(FsCommandCfg *cfg, bool& useMountPrefix) {
|
||||||
if(cfg != nullptr) {
|
if(cfg != nullptr) {
|
||||||
useMountPrefix = cfg->useMountPrefix;
|
useMountPrefix = cfg->useMountPrefix;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
std::filesystem::path FileSystemHandler::getInitPath(FileSystemArgsIF* args) {
|
|
||||||
bool useMountPrefix = true;
|
|
||||||
parseCfg(reinterpret_cast<FsCommandCfg*>(args), useMountPrefix);
|
|
||||||
std::string path;
|
|
||||||
if (useMountPrefix) {
|
|
||||||
path = currentMountPrefix;
|
|
||||||
}
|
|
||||||
return std::filesystem::path(path);
|
|
||||||
}
|
|
||||||
|
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user