Merge remote-tracking branch 'origin/develop' into irini
Some checks failed
EIVE/eive-obsw/pipeline/pr-develop There was a failure building this commit
Some checks failed
EIVE/eive-obsw/pipeline/pr-develop There was a failure building this commit
This commit is contained in:
commit
aa0da618ca
3
.gitmodules
vendored
3
.gitmodules
vendored
@ -22,3 +22,6 @@
|
|||||||
[submodule "thirdparty/rapidcsv"]
|
[submodule "thirdparty/rapidcsv"]
|
||||||
path = thirdparty/rapidcsv
|
path = thirdparty/rapidcsv
|
||||||
url = https://github.com/d99kris/rapidcsv.git
|
url = https://github.com/d99kris/rapidcsv.git
|
||||||
|
[submodule "thirdparty/gomspace-sw"]
|
||||||
|
path = thirdparty/gomspace-sw
|
||||||
|
url = https://egit.irs.uni-stuttgart.de/eive/gomspace-sw.git
|
||||||
|
@ -12,6 +12,12 @@ list yields a list of all related PRs for each release.
|
|||||||
|
|
||||||
# [v1.14.0]
|
# [v1.14.0]
|
||||||
|
|
||||||
|
- Update for FSFW: `HasReturnvaluesIF` class replaced by namespace `returnvalue`
|
||||||
|
- Add some GomSpace clients as a submodule dependency. Use this dependency to deserialize the
|
||||||
|
GomSpace TM tables
|
||||||
|
- Add API to retrieve GomSpace device parameter tables
|
||||||
|
PR: https://egit.irs.uni-stuttgart.de/eive/eive-obsw/pulls/287
|
||||||
|
|
||||||
# [v1.13.0] 24.08.2022
|
# [v1.13.0] 24.08.2022
|
||||||
|
|
||||||
- Added first version of ACS Controller with gathers MGM data in a set
|
- Added first version of ACS Controller with gathers MGM data in a set
|
||||||
|
@ -173,6 +173,9 @@ set(LIB_ETL_TARGET etl::etl)
|
|||||||
set(LIB_CSP_NAME libcsp)
|
set(LIB_CSP_NAME libcsp)
|
||||||
set(LIB_LWGPS_NAME lwgps)
|
set(LIB_LWGPS_NAME lwgps)
|
||||||
set(LIB_ARCSEC wire)
|
set(LIB_ARCSEC wire)
|
||||||
|
set(LIB_GOMSPACE_CLIENTS gs_clients)
|
||||||
|
set(LIB_GOMSPACE_CSP gs_csp)
|
||||||
|
|
||||||
set(THIRD_PARTY_FOLDER thirdparty)
|
set(THIRD_PARTY_FOLDER thirdparty)
|
||||||
set(LIB_CXX_FS -lstdc++fs)
|
set(LIB_CXX_FS -lstdc++fs)
|
||||||
set(LIB_CATCH2 Catch2)
|
set(LIB_CATCH2 Catch2)
|
||||||
@ -185,6 +188,7 @@ set(FSFW_PATH fsfw)
|
|||||||
set(TEST_PATH test)
|
set(TEST_PATH test)
|
||||||
set(UNITTEST_PATH unittest)
|
set(UNITTEST_PATH unittest)
|
||||||
set(LINUX_PATH linux)
|
set(LINUX_PATH linux)
|
||||||
|
set(LIB_GOMSPACE_PATH ${THIRD_PARTY_FOLDER}/gomspace-sw)
|
||||||
set(COMMON_PATH common)
|
set(COMMON_PATH common)
|
||||||
set(DUMMY_PATH dummies)
|
set(DUMMY_PATH dummies)
|
||||||
set(WATCHDOG_PATH watchdog)
|
set(WATCHDOG_PATH watchdog)
|
||||||
@ -192,7 +196,6 @@ set(COMMON_CONFIG_PATH ${COMMON_PATH}/config)
|
|||||||
set(UNITTEST_CFG_PATH ${UNITTEST_PATH}/testcfg)
|
set(UNITTEST_CFG_PATH ${UNITTEST_PATH}/testcfg)
|
||||||
|
|
||||||
set(LIB_EIVE_MISSION_PATH mission)
|
set(LIB_EIVE_MISSION_PATH mission)
|
||||||
set(LIB_CSP_PATH ${THIRD_PARTY_FOLDER}/libcsp)
|
|
||||||
set(LIB_ETL_PATH ${THIRD_PARTY_FOLDER}/etl)
|
set(LIB_ETL_PATH ${THIRD_PARTY_FOLDER}/etl)
|
||||||
set(LIB_CATCH2_PATH ${THIRD_PARTY_FOLDER}/Catch2)
|
set(LIB_CATCH2_PATH ${THIRD_PARTY_FOLDER}/Catch2)
|
||||||
set(LIB_LWGPS_PATH ${THIRD_PARTY_FOLDER}/lwgps)
|
set(LIB_LWGPS_PATH ${THIRD_PARTY_FOLDER}/lwgps)
|
||||||
@ -220,7 +223,8 @@ if(TGT_BSP)
|
|||||||
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(EIVE_ADD_LINUX_FILES TRUE)
|
||||||
set(ADD_CSP_LIB TRUE)
|
set(ADD_GOMSPACE_CSP TRUE)
|
||||||
|
set(ADD_GOMSPACE_CLIENTS TRUE)
|
||||||
set(FSFW_HAL_ADD_LINUX ON)
|
set(FSFW_HAL_ADD_LINUX ON)
|
||||||
set(FSFW_HAL_LINUX_ADD_LIBGPIOD ON)
|
set(FSFW_HAL_LINUX_ADD_LIBGPIOD ON)
|
||||||
set(FSFW_HAL_LINUX_ADD_PERIPHERAL_DRIVERS ON)
|
set(FSFW_HAL_LINUX_ADD_PERIPHERAL_DRIVERS ON)
|
||||||
@ -283,7 +287,25 @@ set(FSFW_ADDITIONAL_INC_PATHS "${COMMON_PATH}/config"
|
|||||||
|
|
||||||
# global compiler options need to be set before adding executables
|
# global compiler options need to be set before adding executables
|
||||||
if(CMAKE_CXX_COMPILER_ID STREQUAL "GNU")
|
if(CMAKE_CXX_COMPILER_ID STREQUAL "GNU")
|
||||||
add_compile_options(
|
# Remove unused sections.
|
||||||
|
add_compile_options("-ffunction-sections" "-fdata-sections")
|
||||||
|
|
||||||
|
# Removed unused sections.
|
||||||
|
add_link_options("-Wl,--gc-sections")
|
||||||
|
|
||||||
|
elseif(CMAKE_CXX_COMPILER_ID STREQUAL "MSVC")
|
||||||
|
set(COMPILER_FLAGS "/permissive-")
|
||||||
|
endif()
|
||||||
|
|
||||||
|
add_library(${LIB_EIVE_MISSION})
|
||||||
|
add_library(${LIB_DUMMIES})
|
||||||
|
|
||||||
|
# Add main executable
|
||||||
|
add_executable(${OBSW_NAME})
|
||||||
|
set(OBSW_BIN_NAME ${CMAKE_PROJECT_NAME})
|
||||||
|
|
||||||
|
if(CMAKE_CXX_COMPILER_ID STREQUAL "GNU")
|
||||||
|
set(WARNING_FLAGS
|
||||||
"-Wall"
|
"-Wall"
|
||||||
"-Wextra"
|
"-Wextra"
|
||||||
"-Wimplicit-fallthrough=1"
|
"-Wimplicit-fallthrough=1"
|
||||||
@ -304,27 +326,15 @@ if(CMAKE_CXX_COMPILER_ID STREQUAL "GNU")
|
|||||||
"-Wcast-qual" # Warn if the constness is cast away
|
"-Wcast-qual" # Warn if the constness is cast away
|
||||||
"-Wstringop-overflow=4"
|
"-Wstringop-overflow=4"
|
||||||
# -Wstack-protector # Emits a few false positives for low level access
|
# -Wstack-protector # Emits a few false positives for low level access
|
||||||
# -Wconversion # Creates many false positives -Warith-conversion # Use with
|
# -Wconversion # Creates many false positives -Warith-conversion # Use
|
||||||
# Wconversion to find more implicit conversions -fanalyzer # Should be used
|
# with Wconversion to find more implicit conversions -fanalyzer # Should
|
||||||
# to look through problems
|
# be used to look through problems
|
||||||
)
|
)
|
||||||
# Remove unused sections.
|
target_compile_options(${OBSW_NAME} PRIVATE ${WARNING_FLAGS})
|
||||||
add_compile_options("-ffunction-sections" "-fdata-sections")
|
target_compile_options(${LIB_EIVE_MISSION} PRIVATE ${WARNING_FLAGS})
|
||||||
|
target_compile_options(${LIB_DUMMIES} PRIVATE ${WARNING_FLAGS})
|
||||||
# Removed unused sections.
|
|
||||||
add_link_options("-Wl,--gc-sections")
|
|
||||||
|
|
||||||
elseif(CMAKE_CXX_COMPILER_ID STREQUAL "MSVC")
|
|
||||||
set(COMPILER_FLAGS "/permissive-")
|
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
add_library(${LIB_EIVE_MISSION})
|
|
||||||
add_library(${LIB_DUMMIES})
|
|
||||||
|
|
||||||
# Add main executable
|
|
||||||
add_executable(${OBSW_NAME})
|
|
||||||
set(OBSW_BIN_NAME ${CMAKE_PROJECT_NAME})
|
|
||||||
|
|
||||||
set_target_properties(${OBSW_NAME} PROPERTIES OUTPUT_NAME ${OBSW_BIN_NAME})
|
set_target_properties(${OBSW_NAME} PROPERTIES OUTPUT_NAME ${OBSW_BIN_NAME})
|
||||||
|
|
||||||
# Watchdog
|
# Watchdog
|
||||||
@ -360,10 +370,7 @@ if(EIVE_ADD_LINUX_FILES)
|
|||||||
add_subdirectory(${LINUX_PATH})
|
add_subdirectory(${LINUX_PATH})
|
||||||
endif()
|
endif()
|
||||||
add_subdirectory(${BSP_PATH})
|
add_subdirectory(${BSP_PATH})
|
||||||
if(ADD_CSP_LIB)
|
add_subdirectory(${LIB_GOMSPACE_PATH})
|
||||||
add_subdirectory(${LIB_CSP_PATH})
|
|
||||||
endif()
|
|
||||||
|
|
||||||
add_subdirectory(${COMMON_PATH})
|
add_subdirectory(${COMMON_PATH})
|
||||||
add_subdirectory(${DUMMY_PATH})
|
add_subdirectory(${DUMMY_PATH})
|
||||||
|
|
||||||
@ -448,15 +455,15 @@ if(TGT_BSP MATCHES "arm/q7s")
|
|||||||
endif()
|
endif()
|
||||||
|
|
||||||
target_link_libraries(${UNITTEST_NAME} PRIVATE Catch2 ${LIB_EIVE_MISSION}
|
target_link_libraries(${UNITTEST_NAME} PRIVATE Catch2 ${LIB_EIVE_MISSION}
|
||||||
rapidcsv ${LIB_DUMMIES})
|
rapidcsv ${LIB_DUMMIES} ${LIB_GOMSPACE_CLIENTS})
|
||||||
|
|
||||||
if(TGT_BSP MATCHES "arm/egse")
|
if(TGT_BSP MATCHES "arm/egse")
|
||||||
target_link_libraries(${OBSW_NAME} PRIVATE ${LIB_ARCSEC})
|
target_link_libraries(${OBSW_NAME} PRIVATE ${LIB_ARCSEC})
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
if(ADD_CSP_LIB)
|
target_link_libraries(${OBSW_NAME} PRIVATE ${LIB_GOMSPACE_CLIENTS})
|
||||||
target_link_libraries(${OBSW_NAME} PRIVATE ${LIB_CSP_NAME})
|
target_link_libraries(${LIB_EIVE_MISSION} PRIVATE ${LIB_GOMSPACE_CLIENTS})
|
||||||
endif()
|
target_link_libraries(${LIB_DUMMIES} PRIVATE ${LIB_GOMSPACE_CLIENTS})
|
||||||
|
|
||||||
if(EIVE_ADD_ETL_LIB)
|
if(EIVE_ADD_ETL_LIB)
|
||||||
target_link_libraries(${LIB_EIVE_MISSION} PUBLIC ${LIB_ETL_TARGET})
|
target_link_libraries(${LIB_EIVE_MISSION} PUBLIC ${LIB_ETL_TARGET})
|
||||||
|
@ -2,7 +2,7 @@
|
|||||||
|
|
||||||
#include <fsfw/objectmanager/ObjectManager.h>
|
#include <fsfw/objectmanager/ObjectManager.h>
|
||||||
#include <fsfw/objectmanager/ObjectManagerIF.h>
|
#include <fsfw/objectmanager/ObjectManagerIF.h>
|
||||||
#include <fsfw/returnvalues/HasReturnvaluesIF.h>
|
#include <fsfw/returnvalues/returnvalue.h>
|
||||||
#include <fsfw/serviceinterface/ServiceInterface.h>
|
#include <fsfw/serviceinterface/ServiceInterface.h>
|
||||||
#include <fsfw/tasks/FixedTimeslotTaskIF.h>
|
#include <fsfw/tasks/FixedTimeslotTaskIF.h>
|
||||||
#include <fsfw/tasks/PeriodicTaskIF.h>
|
#include <fsfw/tasks/PeriodicTaskIF.h>
|
||||||
@ -40,7 +40,7 @@ void initmission::initMission() {
|
|||||||
|
|
||||||
void initmission::initTasks() {
|
void initmission::initTasks() {
|
||||||
TaskFactory* factory = TaskFactory::instance();
|
TaskFactory* factory = TaskFactory::instance();
|
||||||
ReturnValue_t result = HasReturnvaluesIF::RETURN_OK;
|
ReturnValue_t result = returnvalue::OK;
|
||||||
if (factory == nullptr) {
|
if (factory == nullptr) {
|
||||||
/* Should never happen ! */
|
/* Should never happen ! */
|
||||||
return;
|
return;
|
||||||
@ -55,28 +55,28 @@ void initmission::initTasks() {
|
|||||||
PeriodicTaskIF* tmtcDistributor = factory->createPeriodicTask(
|
PeriodicTaskIF* tmtcDistributor = factory->createPeriodicTask(
|
||||||
"DIST", 40, PeriodicTaskIF::MINIMUM_STACK_SIZE, 0.2, missedDeadlineFunc);
|
"DIST", 40, PeriodicTaskIF::MINIMUM_STACK_SIZE, 0.2, missedDeadlineFunc);
|
||||||
result = tmtcDistributor->addComponent(objects::CCSDS_PACKET_DISTRIBUTOR);
|
result = tmtcDistributor->addComponent(objects::CCSDS_PACKET_DISTRIBUTOR);
|
||||||
if (result != HasReturnvaluesIF::RETURN_OK) {
|
if (result != returnvalue::OK) {
|
||||||
sif::error << "Object add component failed" << std::endl;
|
sif::error << "Object add component failed" << std::endl;
|
||||||
}
|
}
|
||||||
result = tmtcDistributor->addComponent(objects::PUS_PACKET_DISTRIBUTOR);
|
result = tmtcDistributor->addComponent(objects::PUS_PACKET_DISTRIBUTOR);
|
||||||
if (result != HasReturnvaluesIF::RETURN_OK) {
|
if (result != returnvalue::OK) {
|
||||||
sif::error << "Object add component failed" << std::endl;
|
sif::error << "Object add component failed" << std::endl;
|
||||||
}
|
}
|
||||||
result = tmtcDistributor->addComponent(objects::TM_FUNNEL);
|
result = tmtcDistributor->addComponent(objects::TM_FUNNEL);
|
||||||
if (result != HasReturnvaluesIF::RETURN_OK) {
|
if (result != returnvalue::OK) {
|
||||||
sif::error << "Object add component failed" << std::endl;
|
sif::error << "Object add component failed" << std::endl;
|
||||||
}
|
}
|
||||||
|
|
||||||
PeriodicTaskIF* tmtcBridgeTask = factory->createPeriodicTask(
|
PeriodicTaskIF* tmtcBridgeTask = factory->createPeriodicTask(
|
||||||
"TMTC_BRIDGE", 50, PeriodicTaskIF::MINIMUM_STACK_SIZE, 0.2, missedDeadlineFunc);
|
"TMTC_BRIDGE", 50, PeriodicTaskIF::MINIMUM_STACK_SIZE, 0.2, missedDeadlineFunc);
|
||||||
result = tmtcBridgeTask->addComponent(objects::TMTC_BRIDGE);
|
result = tmtcBridgeTask->addComponent(objects::TMTC_BRIDGE);
|
||||||
if (result != HasReturnvaluesIF::RETURN_OK) {
|
if (result != returnvalue::OK) {
|
||||||
sif::error << "Add component TMTC Bridge failed" << std::endl;
|
sif::error << "Add component TMTC Bridge failed" << std::endl;
|
||||||
}
|
}
|
||||||
PeriodicTaskIF* tmtcPollingTask = factory->createPeriodicTask(
|
PeriodicTaskIF* tmtcPollingTask = factory->createPeriodicTask(
|
||||||
"TMTC_POLLING", 80, PeriodicTaskIF::MINIMUM_STACK_SIZE, 2.0, missedDeadlineFunc);
|
"TMTC_POLLING", 80, PeriodicTaskIF::MINIMUM_STACK_SIZE, 2.0, missedDeadlineFunc);
|
||||||
result = tmtcPollingTask->addComponent(objects::TMTC_POLLING_TASK);
|
result = tmtcPollingTask->addComponent(objects::TMTC_POLLING_TASK);
|
||||||
if (result != HasReturnvaluesIF::RETURN_OK) {
|
if (result != returnvalue::OK) {
|
||||||
sif::error << "Add component TMTC Polling failed" << std::endl;
|
sif::error << "Add component TMTC Polling failed" << std::endl;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -88,7 +88,7 @@ void initmission::initTasks() {
|
|||||||
FixedTimeslotTaskIF* pst = factory->createFixedTimeslotTask(
|
FixedTimeslotTaskIF* pst = factory->createFixedTimeslotTask(
|
||||||
"STAR_TRACKER_PST", 70, PeriodicTaskIF::MINIMUM_STACK_SIZE * 4, 0.5, missedDeadlineFunc);
|
"STAR_TRACKER_PST", 70, PeriodicTaskIF::MINIMUM_STACK_SIZE * 4, 0.5, missedDeadlineFunc);
|
||||||
result = pst::pstUart(pst);
|
result = pst::pstUart(pst);
|
||||||
if (result != HasReturnvaluesIF::RETURN_OK) {
|
if (result != returnvalue::OK) {
|
||||||
sif::error << "InitMission::initTasks: Creating PST failed!" << std::endl;
|
sif::error << "InitMission::initTasks: Creating PST failed!" << std::endl;
|
||||||
}
|
}
|
||||||
pstTasks.push_back(pst);
|
pstTasks.push_back(pst);
|
||||||
@ -96,7 +96,7 @@ void initmission::initTasks() {
|
|||||||
PeriodicTaskIF* strHelperTask = factory->createPeriodicTask(
|
PeriodicTaskIF* strHelperTask = factory->createPeriodicTask(
|
||||||
"STR_HELPER", 20, PeriodicTaskIF::MINIMUM_STACK_SIZE, 0.2, missedDeadlineFunc);
|
"STR_HELPER", 20, PeriodicTaskIF::MINIMUM_STACK_SIZE, 0.2, missedDeadlineFunc);
|
||||||
result = strHelperTask->addComponent(objects::STR_HELPER);
|
result = strHelperTask->addComponent(objects::STR_HELPER);
|
||||||
if (result != HasReturnvaluesIF::RETURN_OK) {
|
if (result != returnvalue::OK) {
|
||||||
initmission::printAddObjectError("STR_HELPER", objects::STR_HELPER);
|
initmission::printAddObjectError("STR_HELPER", objects::STR_HELPER);
|
||||||
}
|
}
|
||||||
pstTasks.push_back(strHelperTask);
|
pstTasks.push_back(strHelperTask);
|
||||||
@ -125,11 +125,11 @@ void initmission::initTasks() {
|
|||||||
void initmission::createPusTasks(TaskFactory& factory,
|
void initmission::createPusTasks(TaskFactory& factory,
|
||||||
TaskDeadlineMissedFunction missedDeadlineFunc,
|
TaskDeadlineMissedFunction missedDeadlineFunc,
|
||||||
std::vector<PeriodicTaskIF*>& taskVec) {
|
std::vector<PeriodicTaskIF*>& taskVec) {
|
||||||
ReturnValue_t result = HasReturnvaluesIF::RETURN_OK;
|
ReturnValue_t result = returnvalue::OK;
|
||||||
PeriodicTaskIF* pusVerification = factory.createPeriodicTask(
|
PeriodicTaskIF* pusVerification = factory.createPeriodicTask(
|
||||||
"PUS_VERIF", 40, PeriodicTaskIF::MINIMUM_STACK_SIZE, 0.200, missedDeadlineFunc);
|
"PUS_VERIF", 40, PeriodicTaskIF::MINIMUM_STACK_SIZE, 0.200, missedDeadlineFunc);
|
||||||
result = pusVerification->addComponent(objects::PUS_SERVICE_1_VERIFICATION);
|
result = pusVerification->addComponent(objects::PUS_SERVICE_1_VERIFICATION);
|
||||||
if (result != HasReturnvaluesIF::RETURN_OK) {
|
if (result != returnvalue::OK) {
|
||||||
sif::error << "Object add component failed" << std::endl;
|
sif::error << "Object add component failed" << std::endl;
|
||||||
}
|
}
|
||||||
taskVec.push_back(pusVerification);
|
taskVec.push_back(pusVerification);
|
||||||
@ -137,11 +137,11 @@ void initmission::createPusTasks(TaskFactory& factory,
|
|||||||
PeriodicTaskIF* pusEvents = factory.createPeriodicTask(
|
PeriodicTaskIF* pusEvents = factory.createPeriodicTask(
|
||||||
"PUS_EVENTS", 60, PeriodicTaskIF::MINIMUM_STACK_SIZE, 0.200, missedDeadlineFunc);
|
"PUS_EVENTS", 60, PeriodicTaskIF::MINIMUM_STACK_SIZE, 0.200, missedDeadlineFunc);
|
||||||
result = pusEvents->addComponent(objects::PUS_SERVICE_5_EVENT_REPORTING);
|
result = pusEvents->addComponent(objects::PUS_SERVICE_5_EVENT_REPORTING);
|
||||||
if (result != HasReturnvaluesIF::RETURN_OK) {
|
if (result != returnvalue::OK) {
|
||||||
initmission::printAddObjectError("PUS_EVENTS", objects::PUS_SERVICE_5_EVENT_REPORTING);
|
initmission::printAddObjectError("PUS_EVENTS", objects::PUS_SERVICE_5_EVENT_REPORTING);
|
||||||
}
|
}
|
||||||
result = pusEvents->addComponent(objects::EVENT_MANAGER);
|
result = pusEvents->addComponent(objects::EVENT_MANAGER);
|
||||||
if (result != HasReturnvaluesIF::RETURN_OK) {
|
if (result != returnvalue::OK) {
|
||||||
initmission::printAddObjectError("PUS_MGMT", objects::EVENT_MANAGER);
|
initmission::printAddObjectError("PUS_MGMT", objects::EVENT_MANAGER);
|
||||||
}
|
}
|
||||||
taskVec.push_back(pusEvents);
|
taskVec.push_back(pusEvents);
|
||||||
@ -149,11 +149,11 @@ void initmission::createPusTasks(TaskFactory& factory,
|
|||||||
PeriodicTaskIF* pusHighPrio = factory.createPeriodicTask(
|
PeriodicTaskIF* pusHighPrio = factory.createPeriodicTask(
|
||||||
"PUS_HIGH_PRIO", 50, PeriodicTaskIF::MINIMUM_STACK_SIZE, 0.200, missedDeadlineFunc);
|
"PUS_HIGH_PRIO", 50, PeriodicTaskIF::MINIMUM_STACK_SIZE, 0.200, missedDeadlineFunc);
|
||||||
result = pusHighPrio->addComponent(objects::PUS_SERVICE_2_DEVICE_ACCESS);
|
result = pusHighPrio->addComponent(objects::PUS_SERVICE_2_DEVICE_ACCESS);
|
||||||
if (result != HasReturnvaluesIF::RETURN_OK) {
|
if (result != returnvalue::OK) {
|
||||||
initmission::printAddObjectError("PUS2", objects::PUS_SERVICE_2_DEVICE_ACCESS);
|
initmission::printAddObjectError("PUS2", objects::PUS_SERVICE_2_DEVICE_ACCESS);
|
||||||
}
|
}
|
||||||
result = pusHighPrio->addComponent(objects::PUS_SERVICE_9_TIME_MGMT);
|
result = pusHighPrio->addComponent(objects::PUS_SERVICE_9_TIME_MGMT);
|
||||||
if (result != HasReturnvaluesIF::RETURN_OK) {
|
if (result != returnvalue::OK) {
|
||||||
initmission::printAddObjectError("PUS9", objects::PUS_SERVICE_9_TIME_MGMT);
|
initmission::printAddObjectError("PUS9", objects::PUS_SERVICE_9_TIME_MGMT);
|
||||||
}
|
}
|
||||||
taskVec.push_back(pusHighPrio);
|
taskVec.push_back(pusHighPrio);
|
||||||
@ -161,19 +161,19 @@ void initmission::createPusTasks(TaskFactory& factory,
|
|||||||
PeriodicTaskIF* pusMedPrio = factory.createPeriodicTask(
|
PeriodicTaskIF* pusMedPrio = factory.createPeriodicTask(
|
||||||
"PUS_MED_PRIO", 40, PeriodicTaskIF::MINIMUM_STACK_SIZE, 0.8, missedDeadlineFunc);
|
"PUS_MED_PRIO", 40, PeriodicTaskIF::MINIMUM_STACK_SIZE, 0.8, missedDeadlineFunc);
|
||||||
result = pusMedPrio->addComponent(objects::PUS_SERVICE_8_FUNCTION_MGMT);
|
result = pusMedPrio->addComponent(objects::PUS_SERVICE_8_FUNCTION_MGMT);
|
||||||
if (result != HasReturnvaluesIF::RETURN_OK) {
|
if (result != returnvalue::OK) {
|
||||||
initmission::printAddObjectError("PUS8", objects::PUS_SERVICE_8_FUNCTION_MGMT);
|
initmission::printAddObjectError("PUS8", objects::PUS_SERVICE_8_FUNCTION_MGMT);
|
||||||
}
|
}
|
||||||
result = pusMedPrio->addComponent(objects::PUS_SERVICE_200_MODE_MGMT);
|
result = pusMedPrio->addComponent(objects::PUS_SERVICE_200_MODE_MGMT);
|
||||||
if (result != HasReturnvaluesIF::RETURN_OK) {
|
if (result != returnvalue::OK) {
|
||||||
initmission::printAddObjectError("PUS200", objects::PUS_SERVICE_200_MODE_MGMT);
|
initmission::printAddObjectError("PUS200", objects::PUS_SERVICE_200_MODE_MGMT);
|
||||||
}
|
}
|
||||||
result = pusMedPrio->addComponent(objects::PUS_SERVICE_20_PARAMETERS);
|
result = pusMedPrio->addComponent(objects::PUS_SERVICE_20_PARAMETERS);
|
||||||
if (result != HasReturnvaluesIF::RETURN_OK) {
|
if (result != returnvalue::OK) {
|
||||||
initmission::printAddObjectError("PUS20", objects::PUS_SERVICE_20_PARAMETERS);
|
initmission::printAddObjectError("PUS20", objects::PUS_SERVICE_20_PARAMETERS);
|
||||||
}
|
}
|
||||||
result = pusMedPrio->addComponent(objects::PUS_SERVICE_3_HOUSEKEEPING);
|
result = pusMedPrio->addComponent(objects::PUS_SERVICE_3_HOUSEKEEPING);
|
||||||
if (result != HasReturnvaluesIF::RETURN_OK) {
|
if (result != returnvalue::OK) {
|
||||||
initmission::printAddObjectError("PUS3", objects::PUS_SERVICE_3_HOUSEKEEPING);
|
initmission::printAddObjectError("PUS3", objects::PUS_SERVICE_3_HOUSEKEEPING);
|
||||||
}
|
}
|
||||||
taskVec.push_back(pusMedPrio);
|
taskVec.push_back(pusMedPrio);
|
||||||
@ -181,11 +181,11 @@ void initmission::createPusTasks(TaskFactory& factory,
|
|||||||
PeriodicTaskIF* pusLowPrio = factory.createPeriodicTask(
|
PeriodicTaskIF* pusLowPrio = factory.createPeriodicTask(
|
||||||
"PUS_LOW_PRIO", 30, PeriodicTaskIF::MINIMUM_STACK_SIZE, 1.6, missedDeadlineFunc);
|
"PUS_LOW_PRIO", 30, PeriodicTaskIF::MINIMUM_STACK_SIZE, 1.6, missedDeadlineFunc);
|
||||||
result = pusLowPrio->addComponent(objects::PUS_SERVICE_17_TEST);
|
result = pusLowPrio->addComponent(objects::PUS_SERVICE_17_TEST);
|
||||||
if (result != HasReturnvaluesIF::RETURN_OK) {
|
if (result != returnvalue::OK) {
|
||||||
initmission::printAddObjectError("PUS17", objects::PUS_SERVICE_17_TEST);
|
initmission::printAddObjectError("PUS17", objects::PUS_SERVICE_17_TEST);
|
||||||
}
|
}
|
||||||
result = pusLowPrio->addComponent(objects::INTERNAL_ERROR_REPORTER);
|
result = pusLowPrio->addComponent(objects::INTERNAL_ERROR_REPORTER);
|
||||||
if (result != HasReturnvaluesIF::RETURN_OK) {
|
if (result != returnvalue::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);
|
||||||
|
@ -4,7 +4,7 @@
|
|||||||
#include <bsp_hosted/fsfwconfig/pollingsequence/DummyPst.h>
|
#include <bsp_hosted/fsfwconfig/pollingsequence/DummyPst.h>
|
||||||
#include <fsfw/objectmanager/ObjectManager.h>
|
#include <fsfw/objectmanager/ObjectManager.h>
|
||||||
#include <fsfw/objectmanager/ObjectManagerIF.h>
|
#include <fsfw/objectmanager/ObjectManagerIF.h>
|
||||||
#include <fsfw/returnvalues/HasReturnvaluesIF.h>
|
#include <fsfw/returnvalues/returnvalue.h>
|
||||||
#include <fsfw/serviceinterface/ServiceInterfaceStream.h>
|
#include <fsfw/serviceinterface/ServiceInterfaceStream.h>
|
||||||
#include <fsfw/tasks/FixedTimeslotTaskIF.h>
|
#include <fsfw/tasks/FixedTimeslotTaskIF.h>
|
||||||
#include <fsfw/tasks/PeriodicTaskIF.h>
|
#include <fsfw/tasks/PeriodicTaskIF.h>
|
||||||
@ -56,15 +56,15 @@ void initmission::initTasks() {
|
|||||||
PeriodicTaskIF* tmTcDistributor = factory->createPeriodicTask(
|
PeriodicTaskIF* tmTcDistributor = factory->createPeriodicTask(
|
||||||
"DIST", 40, PeriodicTaskIF::MINIMUM_STACK_SIZE, 0.2, missedDeadlineFunc);
|
"DIST", 40, PeriodicTaskIF::MINIMUM_STACK_SIZE, 0.2, missedDeadlineFunc);
|
||||||
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 != returnvalue::OK) {
|
||||||
sif::error << "Object add component failed" << std::endl;
|
sif::error << "Object add component failed" << std::endl;
|
||||||
}
|
}
|
||||||
result = tmTcDistributor->addComponent(objects::PUS_PACKET_DISTRIBUTOR);
|
result = tmTcDistributor->addComponent(objects::PUS_PACKET_DISTRIBUTOR);
|
||||||
if (result != HasReturnvaluesIF::RETURN_OK) {
|
if (result != returnvalue::OK) {
|
||||||
sif::error << "Object add component failed" << std::endl;
|
sif::error << "Object add component failed" << std::endl;
|
||||||
}
|
}
|
||||||
result = tmTcDistributor->addComponent(objects::TM_FUNNEL);
|
result = tmTcDistributor->addComponent(objects::TM_FUNNEL);
|
||||||
if (result != HasReturnvaluesIF::RETURN_OK) {
|
if (result != returnvalue::OK) {
|
||||||
sif::error << "Object add component failed" << std::endl;
|
sif::error << "Object add component failed" << std::endl;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -72,13 +72,13 @@ void initmission::initTasks() {
|
|||||||
PeriodicTaskIF* tmtcBridgeTask = factory->createPeriodicTask(
|
PeriodicTaskIF* tmtcBridgeTask = factory->createPeriodicTask(
|
||||||
"TMTC_UNIX_BRIDGE", 50, PeriodicTaskIF::MINIMUM_STACK_SIZE, 0.2, missedDeadlineFunc);
|
"TMTC_UNIX_BRIDGE", 50, PeriodicTaskIF::MINIMUM_STACK_SIZE, 0.2, missedDeadlineFunc);
|
||||||
result = tmtcBridgeTask->addComponent(objects::TMTC_BRIDGE);
|
result = tmtcBridgeTask->addComponent(objects::TMTC_BRIDGE);
|
||||||
if (result != HasReturnvaluesIF::RETURN_OK) {
|
if (result != returnvalue::OK) {
|
||||||
sif::error << "Add component UDP Unix Bridge failed" << std::endl;
|
sif::error << "Add component UDP Unix Bridge failed" << std::endl;
|
||||||
}
|
}
|
||||||
PeriodicTaskIF* tmtcPollingTask = factory->createPeriodicTask(
|
PeriodicTaskIF* tmtcPollingTask = factory->createPeriodicTask(
|
||||||
"UDP_POLLING", 80, PeriodicTaskIF::MINIMUM_STACK_SIZE, 2.0, missedDeadlineFunc);
|
"UDP_POLLING", 80, PeriodicTaskIF::MINIMUM_STACK_SIZE, 2.0, missedDeadlineFunc);
|
||||||
result = tmtcPollingTask->addComponent(objects::TMTC_POLLING_TASK);
|
result = tmtcPollingTask->addComponent(objects::TMTC_POLLING_TASK);
|
||||||
if (result != HasReturnvaluesIF::RETURN_OK) {
|
if (result != returnvalue::OK) {
|
||||||
sif::error << "Add component UDP Polling failed" << std::endl;
|
sif::error << "Add component UDP Polling failed" << std::endl;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -86,89 +86,89 @@ void initmission::initTasks() {
|
|||||||
PeriodicTaskIF* pusVerification = factory->createPeriodicTask(
|
PeriodicTaskIF* pusVerification = factory->createPeriodicTask(
|
||||||
"PUS_VERIF", 40, PeriodicTaskIF::MINIMUM_STACK_SIZE, 0.200, missedDeadlineFunc);
|
"PUS_VERIF", 40, PeriodicTaskIF::MINIMUM_STACK_SIZE, 0.200, missedDeadlineFunc);
|
||||||
result = pusVerification->addComponent(objects::PUS_SERVICE_1_VERIFICATION);
|
result = pusVerification->addComponent(objects::PUS_SERVICE_1_VERIFICATION);
|
||||||
if (result != HasReturnvaluesIF::RETURN_OK) {
|
if (result != returnvalue::OK) {
|
||||||
sif::error << "Object add component failed" << std::endl;
|
sif::error << "Object add component failed" << std::endl;
|
||||||
}
|
}
|
||||||
|
|
||||||
PeriodicTaskIF* eventHandling = factory->createPeriodicTask(
|
PeriodicTaskIF* eventHandling = factory->createPeriodicTask(
|
||||||
"EVENTS", 60, PeriodicTaskIF::MINIMUM_STACK_SIZE, 0.200, missedDeadlineFunc);
|
"EVENTS", 60, PeriodicTaskIF::MINIMUM_STACK_SIZE, 0.200, missedDeadlineFunc);
|
||||||
result = eventHandling->addComponent(objects::EVENT_MANAGER);
|
result = eventHandling->addComponent(objects::EVENT_MANAGER);
|
||||||
if (result != HasReturnvaluesIF::RETURN_OK) {
|
if (result != returnvalue::OK) {
|
||||||
initmission::printAddObjectError("EVENT_MNGR", objects::EVENT_MANAGER);
|
initmission::printAddObjectError("EVENT_MNGR", objects::EVENT_MANAGER);
|
||||||
}
|
}
|
||||||
result = eventHandling->addComponent(objects::PUS_SERVICE_5_EVENT_REPORTING);
|
result = eventHandling->addComponent(objects::PUS_SERVICE_5_EVENT_REPORTING);
|
||||||
if (result != HasReturnvaluesIF::RETURN_OK) {
|
if (result != returnvalue::OK) {
|
||||||
initmission::printAddObjectError("PUS5", objects::PUS_SERVICE_5_EVENT_REPORTING);
|
initmission::printAddObjectError("PUS5", objects::PUS_SERVICE_5_EVENT_REPORTING);
|
||||||
}
|
}
|
||||||
|
|
||||||
PeriodicTaskIF* pusHighPrio = factory->createPeriodicTask(
|
PeriodicTaskIF* pusHighPrio = factory->createPeriodicTask(
|
||||||
"PUS_HIGH_PRIO", 50, PeriodicTaskIF::MINIMUM_STACK_SIZE, 0.200, missedDeadlineFunc);
|
"PUS_HIGH_PRIO", 50, PeriodicTaskIF::MINIMUM_STACK_SIZE, 0.200, missedDeadlineFunc);
|
||||||
result = pusHighPrio->addComponent(objects::PUS_SERVICE_2_DEVICE_ACCESS);
|
result = pusHighPrio->addComponent(objects::PUS_SERVICE_2_DEVICE_ACCESS);
|
||||||
if (result != HasReturnvaluesIF::RETURN_OK) {
|
if (result != returnvalue::OK) {
|
||||||
initmission::printAddObjectError("PUS2", objects::PUS_SERVICE_2_DEVICE_ACCESS);
|
initmission::printAddObjectError("PUS2", objects::PUS_SERVICE_2_DEVICE_ACCESS);
|
||||||
}
|
}
|
||||||
result = pusHighPrio->addComponent(objects::PUS_SERVICE_9_TIME_MGMT);
|
result = pusHighPrio->addComponent(objects::PUS_SERVICE_9_TIME_MGMT);
|
||||||
if (result != HasReturnvaluesIF::RETURN_OK) {
|
if (result != returnvalue::OK) {
|
||||||
initmission::printAddObjectError("PUS9", objects::PUS_SERVICE_9_TIME_MGMT);
|
initmission::printAddObjectError("PUS9", objects::PUS_SERVICE_9_TIME_MGMT);
|
||||||
}
|
}
|
||||||
result = pusHighPrio->addComponent(objects::PUS_SERVICE_3_HOUSEKEEPING);
|
result = pusHighPrio->addComponent(objects::PUS_SERVICE_3_HOUSEKEEPING);
|
||||||
if (result != HasReturnvaluesIF::RETURN_OK) {
|
if (result != returnvalue::OK) {
|
||||||
initmission::printAddObjectError("PUS3", objects::PUS_SERVICE_3_HOUSEKEEPING);
|
initmission::printAddObjectError("PUS3", objects::PUS_SERVICE_3_HOUSEKEEPING);
|
||||||
}
|
}
|
||||||
|
|
||||||
PeriodicTaskIF* pusMedPrio = factory->createPeriodicTask(
|
PeriodicTaskIF* pusMedPrio = factory->createPeriodicTask(
|
||||||
"PUS_MED_PRIO", 40, PeriodicTaskIF::MINIMUM_STACK_SIZE, 0.8, missedDeadlineFunc);
|
"PUS_MED_PRIO", 40, PeriodicTaskIF::MINIMUM_STACK_SIZE, 0.8, missedDeadlineFunc);
|
||||||
result = pusMedPrio->addComponent(objects::PUS_SERVICE_8_FUNCTION_MGMT);
|
result = pusMedPrio->addComponent(objects::PUS_SERVICE_8_FUNCTION_MGMT);
|
||||||
if (result != HasReturnvaluesIF::RETURN_OK) {
|
if (result != returnvalue::OK) {
|
||||||
initmission::printAddObjectError("PUS8", objects::PUS_SERVICE_8_FUNCTION_MGMT);
|
initmission::printAddObjectError("PUS8", objects::PUS_SERVICE_8_FUNCTION_MGMT);
|
||||||
}
|
}
|
||||||
result = pusMedPrio->addComponent(objects::PUS_SERVICE_200_MODE_MGMT);
|
result = pusMedPrio->addComponent(objects::PUS_SERVICE_200_MODE_MGMT);
|
||||||
if (result != HasReturnvaluesIF::RETURN_OK) {
|
if (result != returnvalue::OK) {
|
||||||
initmission::printAddObjectError("PUS200", objects::PUS_SERVICE_200_MODE_MGMT);
|
initmission::printAddObjectError("PUS200", objects::PUS_SERVICE_200_MODE_MGMT);
|
||||||
}
|
}
|
||||||
result = pusMedPrio->addComponent(objects::PUS_SERVICE_20_PARAMETERS);
|
result = pusMedPrio->addComponent(objects::PUS_SERVICE_20_PARAMETERS);
|
||||||
if (result != HasReturnvaluesIF::RETURN_OK) {
|
if (result != returnvalue::OK) {
|
||||||
initmission::printAddObjectError("PUS20", objects::PUS_SERVICE_20_PARAMETERS);
|
initmission::printAddObjectError("PUS20", objects::PUS_SERVICE_20_PARAMETERS);
|
||||||
}
|
}
|
||||||
|
|
||||||
PeriodicTaskIF* pusLowPrio = factory->createPeriodicTask(
|
PeriodicTaskIF* pusLowPrio = factory->createPeriodicTask(
|
||||||
"PUS_LOW_PRIO", 30, PeriodicTaskIF::MINIMUM_STACK_SIZE, 1.6, missedDeadlineFunc);
|
"PUS_LOW_PRIO", 30, PeriodicTaskIF::MINIMUM_STACK_SIZE, 1.6, missedDeadlineFunc);
|
||||||
result = pusLowPrio->addComponent(objects::PUS_SERVICE_17_TEST);
|
result = pusLowPrio->addComponent(objects::PUS_SERVICE_17_TEST);
|
||||||
if (result != HasReturnvaluesIF::RETURN_OK) {
|
if (result != returnvalue::OK) {
|
||||||
initmission::printAddObjectError("PUS17", objects::PUS_SERVICE_17_TEST);
|
initmission::printAddObjectError("PUS17", objects::PUS_SERVICE_17_TEST);
|
||||||
}
|
}
|
||||||
|
|
||||||
PeriodicTaskIF* thermalTask = factory->createPeriodicTask(
|
PeriodicTaskIF* thermalTask = factory->createPeriodicTask(
|
||||||
"THERMAL_CTL_TASK", 40, PeriodicTaskIF::MINIMUM_STACK_SIZE, 1.0, missedDeadlineFunc);
|
"THERMAL_CTL_TASK", 40, PeriodicTaskIF::MINIMUM_STACK_SIZE, 1.0, missedDeadlineFunc);
|
||||||
result = thermalTask->addComponent(objects::RTD_0_IC3_PLOC_HEATSPREADER);
|
result = thermalTask->addComponent(objects::RTD_0_IC3_PLOC_HEATSPREADER);
|
||||||
if (result != HasReturnvaluesIF::RETURN_OK) {
|
if (result != returnvalue::OK) {
|
||||||
initmission::printAddObjectError("RTD_0_dummy", objects::RTD_0_IC3_PLOC_HEATSPREADER);
|
initmission::printAddObjectError("RTD_0_dummy", objects::RTD_0_IC3_PLOC_HEATSPREADER);
|
||||||
}
|
}
|
||||||
result = thermalTask->addComponent(objects::SUS_0_N_LOC_XFYFZM_PT_XF);
|
result = thermalTask->addComponent(objects::SUS_0_N_LOC_XFYFZM_PT_XF);
|
||||||
if (result != HasReturnvaluesIF::RETURN_OK) {
|
if (result != returnvalue::OK) {
|
||||||
initmission::printAddObjectError("SUS_0_dummy", objects::SUS_0_N_LOC_XFYFZM_PT_XF);
|
initmission::printAddObjectError("SUS_0_dummy", objects::SUS_0_N_LOC_XFYFZM_PT_XF);
|
||||||
}
|
}
|
||||||
|
|
||||||
result = thermalTask->addComponent(objects::CORE_CONTROLLER);
|
result = thermalTask->addComponent(objects::CORE_CONTROLLER);
|
||||||
if (result != HasReturnvaluesIF::RETURN_OK) {
|
if (result != returnvalue::OK) {
|
||||||
initmission::printAddObjectError("Core controller dummy", objects::CORE_CONTROLLER);
|
initmission::printAddObjectError("Core controller dummy", objects::CORE_CONTROLLER);
|
||||||
}
|
}
|
||||||
|
|
||||||
result = thermalTask->addComponent(objects::THERMAL_CONTROLLER);
|
result = thermalTask->addComponent(objects::THERMAL_CONTROLLER);
|
||||||
if (result != HasReturnvaluesIF::RETURN_OK) {
|
if (result != returnvalue::OK) {
|
||||||
initmission::printAddObjectError("THERMAL_CONTROLLER", objects::THERMAL_CONTROLLER);
|
initmission::printAddObjectError("THERMAL_CONTROLLER", objects::THERMAL_CONTROLLER);
|
||||||
}
|
}
|
||||||
|
|
||||||
FixedTimeslotTaskIF* pstTask = factory->createFixedTimeslotTask(
|
FixedTimeslotTaskIF* pstTask = factory->createFixedTimeslotTask(
|
||||||
"DUMMY_PST", 75, PeriodicTaskIF::MINIMUM_STACK_SIZE * 4, 0.5, missedDeadlineFunc);
|
"DUMMY_PST", 75, PeriodicTaskIF::MINIMUM_STACK_SIZE * 4, 0.5, missedDeadlineFunc);
|
||||||
result = dummy_pst::pst(pstTask);
|
result = dummy_pst::pst(pstTask);
|
||||||
if (result != HasReturnvaluesIF::RETURN_OK) {
|
if (result != returnvalue::OK) {
|
||||||
sif::error << "Failed to add dummy pst to fixed timeslot task" << std::endl;
|
sif::error << "Failed to add dummy pst to fixed timeslot task" << std::endl;
|
||||||
}
|
}
|
||||||
|
|
||||||
#if OBSW_ADD_TEST_CODE == 1
|
#if OBSW_ADD_TEST_CODE == 1
|
||||||
result = testTask->addComponent(objects::TEST_TASK);
|
result = testTask->addComponent(objects::TEST_TASK);
|
||||||
if (result != HasReturnvaluesIF::RETURN_OK) {
|
if (result != returnvalue::OK) {
|
||||||
initmission::printAddObjectError("TEST_TASK", objects::TEST_TASK);
|
initmission::printAddObjectError("TEST_TASK", objects::TEST_TASK);
|
||||||
}
|
}
|
||||||
#endif /* OBSW_ADD_TEST_CODE == 1 */
|
#endif /* OBSW_ADD_TEST_CODE == 1 */
|
||||||
|
@ -129,9 +129,7 @@ ArduinoComIF::~ArduinoComIF() {
|
|||||||
CloseHandle(hCom);
|
CloseHandle(hCom);
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
ReturnValue_t ArduinoComIF::initializeInterface(CookieIF *cookie) {
|
ReturnValue_t ArduinoComIF::initializeInterface(CookieIF *cookie) { return returnvalue::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);
|
||||||
@ -142,10 +140,10 @@ ReturnValue_t ArduinoComIF::sendMessage(CookieIF *cookie, const uint8_t *data, s
|
|||||||
return sendMessage(arduinoCookie->command, arduinoCookie->address, data, len);
|
return sendMessage(arduinoCookie->command, arduinoCookie->address, data, len);
|
||||||
}
|
}
|
||||||
|
|
||||||
ReturnValue_t ArduinoComIF::getSendSuccess(CookieIF *cookie) { return RETURN_OK; }
|
ReturnValue_t ArduinoComIF::getSendSuccess(CookieIF *cookie) { return returnvalue::OK; }
|
||||||
|
|
||||||
ReturnValue_t ArduinoComIF::requestReceiveMessage(CookieIF *cookie, size_t requestLen) {
|
ReturnValue_t ArduinoComIF::requestReceiveMessage(CookieIF *cookie, size_t requestLen) {
|
||||||
return RETURN_OK;
|
return returnvalue::OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
ReturnValue_t ArduinoComIF::readReceivedMessage(CookieIF *cookie, uint8_t **buffer, size_t *size) {
|
ReturnValue_t ArduinoComIF::readReceivedMessage(CookieIF *cookie, uint8_t **buffer, size_t *size) {
|
||||||
@ -158,7 +156,7 @@ ReturnValue_t ArduinoComIF::readReceivedMessage(CookieIF *cookie, uint8_t **buff
|
|||||||
|
|
||||||
*buffer = arduinoCookie->replyBuffer.data();
|
*buffer = arduinoCookie->replyBuffer.data();
|
||||||
*size = arduinoCookie->receivedDataLen;
|
*size = arduinoCookie->receivedDataLen;
|
||||||
return HasReturnvaluesIF::RETURN_OK;
|
return returnvalue::OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
ReturnValue_t ArduinoComIF::sendMessage(uint8_t command, uint8_t address, const uint8_t *data,
|
ReturnValue_t ArduinoComIF::sendMessage(uint8_t command, uint8_t address, const uint8_t *data,
|
||||||
@ -178,14 +176,14 @@ ReturnValue_t ArduinoComIF::sendMessage(uint8_t command, uint8_t address, const
|
|||||||
|
|
||||||
ReturnValue_t result =
|
ReturnValue_t result =
|
||||||
DleEncoder::encode(&command, 1, currentPosition, remainingLen, &encodedLen, false);
|
DleEncoder::encode(&command, 1, currentPosition, remainingLen, &encodedLen, false);
|
||||||
if (result != RETURN_OK) {
|
if (result != returnvalue::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 != returnvalue::OK) {
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
currentPosition += encodedLen;
|
currentPosition += encodedLen;
|
||||||
@ -199,7 +197,7 @@ ReturnValue_t ArduinoComIF::sendMessage(uint8_t command, uint8_t address, const
|
|||||||
|
|
||||||
result =
|
result =
|
||||||
DleEncoder::encode(temporaryBuffer, 2, currentPosition, remainingLen, &encodedLen, false);
|
DleEncoder::encode(temporaryBuffer, 2, currentPosition, remainingLen, &encodedLen, false);
|
||||||
if (result != RETURN_OK) {
|
if (result != returnvalue::OK) {
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
currentPosition += encodedLen;
|
currentPosition += encodedLen;
|
||||||
@ -207,7 +205,7 @@ ReturnValue_t ArduinoComIF::sendMessage(uint8_t command, uint8_t address, const
|
|||||||
|
|
||||||
// encoding the actual data
|
// encoding the actual data
|
||||||
result = DleEncoder::encode(data, dataLen, currentPosition, remainingLen, &encodedLen, false);
|
result = DleEncoder::encode(data, dataLen, currentPosition, remainingLen, &encodedLen, false);
|
||||||
if (result != RETURN_OK) {
|
if (result != returnvalue::OK) {
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
currentPosition += encodedLen;
|
currentPosition += encodedLen;
|
||||||
@ -224,7 +222,7 @@ ReturnValue_t ArduinoComIF::sendMessage(uint8_t command, uint8_t address, const
|
|||||||
|
|
||||||
result =
|
result =
|
||||||
DleEncoder::encode(temporaryBuffer, 2, currentPosition, remainingLen, &encodedLen, false);
|
DleEncoder::encode(temporaryBuffer, 2, currentPosition, remainingLen, &encodedLen, false);
|
||||||
if (result != RETURN_OK) {
|
if (result != returnvalue::OK) {
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
currentPosition += encodedLen;
|
currentPosition += encodedLen;
|
||||||
@ -241,16 +239,16 @@ ReturnValue_t ArduinoComIF::sendMessage(uint8_t command, uint8_t address, const
|
|||||||
ssize_t writtenlen = ::write(serialPort, sendBuffer, encodedLen);
|
ssize_t writtenlen = ::write(serialPort, sendBuffer, encodedLen);
|
||||||
if (writtenlen < 0) {
|
if (writtenlen < 0) {
|
||||||
// we could try to find out what happened...
|
// we could try to find out what happened...
|
||||||
return RETURN_FAILED;
|
return returnvalue::FAILED;
|
||||||
}
|
}
|
||||||
if (writtenlen != encodedLen) {
|
if (writtenlen != encodedLen) {
|
||||||
// the OS failed us, we do not try to block until everything is written, as
|
// the OS failed us, we do not try to block until everything is written, as
|
||||||
// we can not block the whole system here
|
// we can not block the whole system here
|
||||||
return RETURN_FAILED;
|
return returnvalue::FAILED;
|
||||||
}
|
}
|
||||||
return RETURN_OK;
|
return returnvalue::OK;
|
||||||
#elif WIN32
|
#elif WIN32
|
||||||
return HasReturnvaluesIF::RETURN_OK;
|
return returnvalue::OK;
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -297,7 +295,7 @@ void ArduinoComIF::handleSerialPortRx() {
|
|||||||
packet, sizeof(packet), &packetLen);
|
packet, sizeof(packet), &packetLen);
|
||||||
|
|
||||||
size_t toDelete = firstSTXinRawData;
|
size_t toDelete = firstSTXinRawData;
|
||||||
if (result == HasReturnvaluesIF::RETURN_OK) {
|
if (result == returnvalue::OK) {
|
||||||
handlePacket(packet, packetLen);
|
handlePacket(packet, packetLen);
|
||||||
|
|
||||||
// after handling the packet, we can delete it from the raw stream,
|
// after handling the packet, we can delete it from the raw stream,
|
||||||
|
@ -5,7 +5,7 @@
|
|||||||
#include <fsfw/container/SimpleRingBuffer.h>
|
#include <fsfw/container/SimpleRingBuffer.h>
|
||||||
#include <fsfw/devicehandlers/DeviceCommunicationIF.h>
|
#include <fsfw/devicehandlers/DeviceCommunicationIF.h>
|
||||||
#include <fsfw/objectmanager/SystemObject.h>
|
#include <fsfw/objectmanager/SystemObject.h>
|
||||||
#include <fsfw/returnvalues/HasReturnvaluesIF.h>
|
#include <fsfw/returnvalues/returnvalue.h>
|
||||||
|
|
||||||
#include <cstdint>
|
#include <cstdint>
|
||||||
#include <map>
|
#include <map>
|
||||||
|
@ -129,12 +129,12 @@ ReturnValue_t dummy_pst::pst(FixedTimeslotTaskIF *thisSequence) {
|
|||||||
thisSequence->addSlot(objects::PLPCDU_HANDLER, length * 0, DeviceHandlerIF::SEND_READ);
|
thisSequence->addSlot(objects::PLPCDU_HANDLER, length * 0, DeviceHandlerIF::SEND_READ);
|
||||||
thisSequence->addSlot(objects::PLPCDU_HANDLER, length * 0, DeviceHandlerIF::GET_READ);
|
thisSequence->addSlot(objects::PLPCDU_HANDLER, length * 0, DeviceHandlerIF::GET_READ);
|
||||||
|
|
||||||
if (thisSequence->checkSequence() == HasReturnvaluesIF::RETURN_OK) {
|
if (thisSequence->checkSequence() == returnvalue::OK) {
|
||||||
return HasReturnvaluesIF::RETURN_OK;
|
return returnvalue::OK;
|
||||||
} else {
|
} else {
|
||||||
#if FSFW_CPP_OSTREAM_ENABLED == 1
|
#if FSFW_CPP_OSTREAM_ENABLED == 1
|
||||||
sif::error << "pst::pollingSequenceInitDefault: Sequence invalid!" << std::endl;
|
sif::error << "pst::pollingSequenceInitDefault: Sequence invalid!" << std::endl;
|
||||||
#endif
|
#endif
|
||||||
return HasReturnvaluesIF::RETURN_FAILED;
|
return returnvalue::FAILED;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
#ifndef POLLINGSEQUENCEFACTORY_H_
|
#ifndef POLLINGSEQUENCEFACTORY_H_
|
||||||
#define POLLINGSEQUENCEFACTORY_H_
|
#define POLLINGSEQUENCEFACTORY_H_
|
||||||
|
|
||||||
#include <fsfw/returnvalues/HasReturnvaluesIF.h>
|
#include <fsfw/returnvalues/returnvalue.h>
|
||||||
|
|
||||||
class FixedTimeslotTaskIF;
|
class FixedTimeslotTaskIF;
|
||||||
|
|
||||||
|
@ -3,7 +3,7 @@
|
|||||||
#include <fsfw/devicehandlers/DeviceHandlerIF.h>
|
#include <fsfw/devicehandlers/DeviceHandlerIF.h>
|
||||||
#include <fsfw/objectmanager/ObjectManager.h>
|
#include <fsfw/objectmanager/ObjectManager.h>
|
||||||
#include <fsfw/objectmanager/ObjectManagerIF.h>
|
#include <fsfw/objectmanager/ObjectManagerIF.h>
|
||||||
#include <fsfw/returnvalues/HasReturnvaluesIF.h>
|
#include <fsfw/returnvalues/returnvalue.h>
|
||||||
#include <fsfw/serviceinterface/ServiceInterface.h>
|
#include <fsfw/serviceinterface/ServiceInterface.h>
|
||||||
#include <fsfw/tasks/FixedTimeslotTaskIF.h>
|
#include <fsfw/tasks/FixedTimeslotTaskIF.h>
|
||||||
#include <fsfw/tasks/PeriodicTaskIF.h>
|
#include <fsfw/tasks/PeriodicTaskIF.h>
|
||||||
@ -37,7 +37,7 @@ void initmission::initMission() {
|
|||||||
|
|
||||||
void initmission::initTasks() {
|
void initmission::initTasks() {
|
||||||
TaskFactory* factory = TaskFactory::instance();
|
TaskFactory* factory = TaskFactory::instance();
|
||||||
ReturnValue_t result = HasReturnvaluesIF::RETURN_OK;
|
ReturnValue_t result = returnvalue::OK;
|
||||||
if (factory == nullptr) {
|
if (factory == nullptr) {
|
||||||
/* Should never happen ! */
|
/* Should never happen ! */
|
||||||
return;
|
return;
|
||||||
@ -52,15 +52,15 @@ void initmission::initTasks() {
|
|||||||
PeriodicTaskIF* tmTcDistributor = factory->createPeriodicTask(
|
PeriodicTaskIF* tmTcDistributor = factory->createPeriodicTask(
|
||||||
"DIST", 40, PeriodicTaskIF::MINIMUM_STACK_SIZE, 0.2, missedDeadlineFunc);
|
"DIST", 40, PeriodicTaskIF::MINIMUM_STACK_SIZE, 0.2, missedDeadlineFunc);
|
||||||
result = tmTcDistributor->addComponent(objects::CCSDS_PACKET_DISTRIBUTOR);
|
result = tmTcDistributor->addComponent(objects::CCSDS_PACKET_DISTRIBUTOR);
|
||||||
if (result != HasReturnvaluesIF::RETURN_OK) {
|
if (result != returnvalue::OK) {
|
||||||
sif::error << "Object add component failed" << std::endl;
|
sif::error << "Object add component failed" << std::endl;
|
||||||
}
|
}
|
||||||
result = tmTcDistributor->addComponent(objects::PUS_PACKET_DISTRIBUTOR);
|
result = tmTcDistributor->addComponent(objects::PUS_PACKET_DISTRIBUTOR);
|
||||||
if (result != HasReturnvaluesIF::RETURN_OK) {
|
if (result != returnvalue::OK) {
|
||||||
sif::error << "Object add component failed" << std::endl;
|
sif::error << "Object add component failed" << std::endl;
|
||||||
}
|
}
|
||||||
result = tmTcDistributor->addComponent(objects::TM_FUNNEL);
|
result = tmTcDistributor->addComponent(objects::TM_FUNNEL);
|
||||||
if (result != HasReturnvaluesIF::RETURN_OK) {
|
if (result != returnvalue::OK) {
|
||||||
sif::error << "Object add component failed" << std::endl;
|
sif::error << "Object add component failed" << std::endl;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -68,13 +68,13 @@ void initmission::initTasks() {
|
|||||||
PeriodicTaskIF* tmtcBridgeTask = factory->createPeriodicTask(
|
PeriodicTaskIF* tmtcBridgeTask = factory->createPeriodicTask(
|
||||||
"TMTC_BRIDGE", 50, PeriodicTaskIF::MINIMUM_STACK_SIZE, 0.2, missedDeadlineFunc);
|
"TMTC_BRIDGE", 50, PeriodicTaskIF::MINIMUM_STACK_SIZE, 0.2, missedDeadlineFunc);
|
||||||
result = tmtcBridgeTask->addComponent(objects::TMTC_BRIDGE);
|
result = tmtcBridgeTask->addComponent(objects::TMTC_BRIDGE);
|
||||||
if (result != HasReturnvaluesIF::RETURN_OK) {
|
if (result != returnvalue::OK) {
|
||||||
sif::error << "Add component TMTC Bridge failed" << std::endl;
|
sif::error << "Add component TMTC Bridge failed" << std::endl;
|
||||||
}
|
}
|
||||||
PeriodicTaskIF* tmtcPollingTask = factory->createPeriodicTask(
|
PeriodicTaskIF* tmtcPollingTask = factory->createPeriodicTask(
|
||||||
"TMTC_POLLING", 80, PeriodicTaskIF::MINIMUM_STACK_SIZE, 2.0, missedDeadlineFunc);
|
"TMTC_POLLING", 80, PeriodicTaskIF::MINIMUM_STACK_SIZE, 2.0, missedDeadlineFunc);
|
||||||
result = tmtcPollingTask->addComponent(objects::TMTC_POLLING_TASK);
|
result = tmtcPollingTask->addComponent(objects::TMTC_POLLING_TASK);
|
||||||
if (result != HasReturnvaluesIF::RETURN_OK) {
|
if (result != returnvalue::OK) {
|
||||||
sif::error << "Add component TMTC Polling failed" << std::endl;
|
sif::error << "Add component TMTC Polling failed" << std::endl;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -155,11 +155,11 @@ void initmission::initTasks() {
|
|||||||
void initmission::createPusTasks(TaskFactory& factory,
|
void initmission::createPusTasks(TaskFactory& factory,
|
||||||
TaskDeadlineMissedFunction missedDeadlineFunc,
|
TaskDeadlineMissedFunction missedDeadlineFunc,
|
||||||
std::vector<PeriodicTaskIF*>& taskVec) {
|
std::vector<PeriodicTaskIF*>& taskVec) {
|
||||||
ReturnValue_t result = HasReturnvaluesIF::RETURN_OK;
|
ReturnValue_t result = returnvalue::OK;
|
||||||
PeriodicTaskIF* pusVerification = factory.createPeriodicTask(
|
PeriodicTaskIF* pusVerification = factory.createPeriodicTask(
|
||||||
"PUS_VERIF", 40, PeriodicTaskIF::MINIMUM_STACK_SIZE, 0.200, missedDeadlineFunc);
|
"PUS_VERIF", 40, PeriodicTaskIF::MINIMUM_STACK_SIZE, 0.200, missedDeadlineFunc);
|
||||||
result = pusVerification->addComponent(objects::PUS_SERVICE_1_VERIFICATION);
|
result = pusVerification->addComponent(objects::PUS_SERVICE_1_VERIFICATION);
|
||||||
if (result != HasReturnvaluesIF::RETURN_OK) {
|
if (result != returnvalue::OK) {
|
||||||
sif::error << "Object add component failed" << std::endl;
|
sif::error << "Object add component failed" << std::endl;
|
||||||
}
|
}
|
||||||
taskVec.push_back(pusVerification);
|
taskVec.push_back(pusVerification);
|
||||||
@ -167,11 +167,11 @@ void initmission::createPusTasks(TaskFactory& factory,
|
|||||||
PeriodicTaskIF* pusEvents = factory.createPeriodicTask(
|
PeriodicTaskIF* pusEvents = factory.createPeriodicTask(
|
||||||
"PUS_EVENTS", 60, PeriodicTaskIF::MINIMUM_STACK_SIZE, 0.200, missedDeadlineFunc);
|
"PUS_EVENTS", 60, PeriodicTaskIF::MINIMUM_STACK_SIZE, 0.200, missedDeadlineFunc);
|
||||||
result = pusEvents->addComponent(objects::PUS_SERVICE_5_EVENT_REPORTING);
|
result = pusEvents->addComponent(objects::PUS_SERVICE_5_EVENT_REPORTING);
|
||||||
if (result != HasReturnvaluesIF::RETURN_OK) {
|
if (result != returnvalue::OK) {
|
||||||
initmission::printAddObjectError("PUS_EVENTS", objects::PUS_SERVICE_5_EVENT_REPORTING);
|
initmission::printAddObjectError("PUS_EVENTS", objects::PUS_SERVICE_5_EVENT_REPORTING);
|
||||||
}
|
}
|
||||||
result = pusEvents->addComponent(objects::EVENT_MANAGER);
|
result = pusEvents->addComponent(objects::EVENT_MANAGER);
|
||||||
if (result != HasReturnvaluesIF::RETURN_OK) {
|
if (result != returnvalue::OK) {
|
||||||
initmission::printAddObjectError("PUS_MGMT", objects::EVENT_MANAGER);
|
initmission::printAddObjectError("PUS_MGMT", objects::EVENT_MANAGER);
|
||||||
}
|
}
|
||||||
taskVec.push_back(pusEvents);
|
taskVec.push_back(pusEvents);
|
||||||
@ -179,11 +179,11 @@ void initmission::createPusTasks(TaskFactory& factory,
|
|||||||
PeriodicTaskIF* pusHighPrio = factory.createPeriodicTask(
|
PeriodicTaskIF* pusHighPrio = factory.createPeriodicTask(
|
||||||
"PUS_HIGH_PRIO", 50, PeriodicTaskIF::MINIMUM_STACK_SIZE, 0.200, missedDeadlineFunc);
|
"PUS_HIGH_PRIO", 50, PeriodicTaskIF::MINIMUM_STACK_SIZE, 0.200, missedDeadlineFunc);
|
||||||
result = pusHighPrio->addComponent(objects::PUS_SERVICE_2_DEVICE_ACCESS);
|
result = pusHighPrio->addComponent(objects::PUS_SERVICE_2_DEVICE_ACCESS);
|
||||||
if (result != HasReturnvaluesIF::RETURN_OK) {
|
if (result != returnvalue::OK) {
|
||||||
initmission::printAddObjectError("PUS2", objects::PUS_SERVICE_2_DEVICE_ACCESS);
|
initmission::printAddObjectError("PUS2", objects::PUS_SERVICE_2_DEVICE_ACCESS);
|
||||||
}
|
}
|
||||||
result = pusHighPrio->addComponent(objects::PUS_SERVICE_9_TIME_MGMT);
|
result = pusHighPrio->addComponent(objects::PUS_SERVICE_9_TIME_MGMT);
|
||||||
if (result != HasReturnvaluesIF::RETURN_OK) {
|
if (result != returnvalue::OK) {
|
||||||
initmission::printAddObjectError("PUS9", objects::PUS_SERVICE_9_TIME_MGMT);
|
initmission::printAddObjectError("PUS9", objects::PUS_SERVICE_9_TIME_MGMT);
|
||||||
}
|
}
|
||||||
taskVec.push_back(pusHighPrio);
|
taskVec.push_back(pusHighPrio);
|
||||||
@ -191,19 +191,19 @@ void initmission::createPusTasks(TaskFactory& factory,
|
|||||||
PeriodicTaskIF* pusMedPrio = factory.createPeriodicTask(
|
PeriodicTaskIF* pusMedPrio = factory.createPeriodicTask(
|
||||||
"PUS_MED_PRIO", 40, PeriodicTaskIF::MINIMUM_STACK_SIZE, 0.8, missedDeadlineFunc);
|
"PUS_MED_PRIO", 40, PeriodicTaskIF::MINIMUM_STACK_SIZE, 0.8, missedDeadlineFunc);
|
||||||
result = pusMedPrio->addComponent(objects::PUS_SERVICE_8_FUNCTION_MGMT);
|
result = pusMedPrio->addComponent(objects::PUS_SERVICE_8_FUNCTION_MGMT);
|
||||||
if (result != HasReturnvaluesIF::RETURN_OK) {
|
if (result != returnvalue::OK) {
|
||||||
initmission::printAddObjectError("PUS8", objects::PUS_SERVICE_8_FUNCTION_MGMT);
|
initmission::printAddObjectError("PUS8", objects::PUS_SERVICE_8_FUNCTION_MGMT);
|
||||||
}
|
}
|
||||||
result = pusMedPrio->addComponent(objects::PUS_SERVICE_200_MODE_MGMT);
|
result = pusMedPrio->addComponent(objects::PUS_SERVICE_200_MODE_MGMT);
|
||||||
if (result != HasReturnvaluesIF::RETURN_OK) {
|
if (result != returnvalue::OK) {
|
||||||
initmission::printAddObjectError("PUS200", objects::PUS_SERVICE_200_MODE_MGMT);
|
initmission::printAddObjectError("PUS200", objects::PUS_SERVICE_200_MODE_MGMT);
|
||||||
}
|
}
|
||||||
result = pusMedPrio->addComponent(objects::PUS_SERVICE_20_PARAMETERS);
|
result = pusMedPrio->addComponent(objects::PUS_SERVICE_20_PARAMETERS);
|
||||||
if (result != HasReturnvaluesIF::RETURN_OK) {
|
if (result != returnvalue::OK) {
|
||||||
initmission::printAddObjectError("PUS20", objects::PUS_SERVICE_20_PARAMETERS);
|
initmission::printAddObjectError("PUS20", objects::PUS_SERVICE_20_PARAMETERS);
|
||||||
}
|
}
|
||||||
result = pusMedPrio->addComponent(objects::PUS_SERVICE_3_HOUSEKEEPING);
|
result = pusMedPrio->addComponent(objects::PUS_SERVICE_3_HOUSEKEEPING);
|
||||||
if (result != HasReturnvaluesIF::RETURN_OK) {
|
if (result != returnvalue::OK) {
|
||||||
initmission::printAddObjectError("PUS3", objects::PUS_SERVICE_3_HOUSEKEEPING);
|
initmission::printAddObjectError("PUS3", objects::PUS_SERVICE_3_HOUSEKEEPING);
|
||||||
}
|
}
|
||||||
taskVec.push_back(pusMedPrio);
|
taskVec.push_back(pusMedPrio);
|
||||||
@ -211,11 +211,11 @@ void initmission::createPusTasks(TaskFactory& factory,
|
|||||||
PeriodicTaskIF* pusLowPrio = factory.createPeriodicTask(
|
PeriodicTaskIF* pusLowPrio = factory.createPeriodicTask(
|
||||||
"PUS_LOW_PRIO", 30, PeriodicTaskIF::MINIMUM_STACK_SIZE, 1.6, missedDeadlineFunc);
|
"PUS_LOW_PRIO", 30, PeriodicTaskIF::MINIMUM_STACK_SIZE, 1.6, missedDeadlineFunc);
|
||||||
result = pusLowPrio->addComponent(objects::PUS_SERVICE_17_TEST);
|
result = pusLowPrio->addComponent(objects::PUS_SERVICE_17_TEST);
|
||||||
if (result != HasReturnvaluesIF::RETURN_OK) {
|
if (result != returnvalue::OK) {
|
||||||
initmission::printAddObjectError("PUS17", objects::PUS_SERVICE_17_TEST);
|
initmission::printAddObjectError("PUS17", objects::PUS_SERVICE_17_TEST);
|
||||||
}
|
}
|
||||||
result = pusLowPrio->addComponent(objects::INTERNAL_ERROR_REPORTER);
|
result = pusLowPrio->addComponent(objects::INTERNAL_ERROR_REPORTER);
|
||||||
if (result != HasReturnvaluesIF::RETURN_OK) {
|
if (result != returnvalue::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);
|
||||||
@ -224,7 +224,7 @@ void initmission::createPusTasks(TaskFactory& factory,
|
|||||||
void initmission::createPstTasks(TaskFactory& factory,
|
void initmission::createPstTasks(TaskFactory& factory,
|
||||||
TaskDeadlineMissedFunction missedDeadlineFunc,
|
TaskDeadlineMissedFunction missedDeadlineFunc,
|
||||||
std::vector<PeriodicTaskIF*>& taskVec) {
|
std::vector<PeriodicTaskIF*>& taskVec) {
|
||||||
ReturnValue_t result = HasReturnvaluesIF::RETURN_OK;
|
ReturnValue_t result = returnvalue::OK;
|
||||||
#if OBSW_ADD_SPI_TEST_CODE == 0
|
#if OBSW_ADD_SPI_TEST_CODE == 0
|
||||||
FixedTimeslotTaskIF* spiPst = factory.createFixedTimeslotTask(
|
FixedTimeslotTaskIF* spiPst = factory.createFixedTimeslotTask(
|
||||||
"SPI_PST", 70, PeriodicTaskIF::MINIMUM_STACK_SIZE * 4, 1.0, missedDeadlineFunc);
|
"SPI_PST", 70, PeriodicTaskIF::MINIMUM_STACK_SIZE * 4, 1.0, missedDeadlineFunc);
|
||||||
@ -242,28 +242,28 @@ void initmission::createPstTasks(TaskFactory& factory,
|
|||||||
void initmission::createTestTasks(TaskFactory& factory,
|
void initmission::createTestTasks(TaskFactory& factory,
|
||||||
TaskDeadlineMissedFunction missedDeadlineFunc,
|
TaskDeadlineMissedFunction missedDeadlineFunc,
|
||||||
std::vector<PeriodicTaskIF*>& taskVec) {
|
std::vector<PeriodicTaskIF*>& taskVec) {
|
||||||
ReturnValue_t result = HasReturnvaluesIF::RETURN_OK;
|
ReturnValue_t result = returnvalue::OK;
|
||||||
PeriodicTaskIF* testTask = factory.createPeriodicTask(
|
PeriodicTaskIF* testTask = factory.createPeriodicTask(
|
||||||
"TEST_TASK", 40, PeriodicTaskIF::MINIMUM_STACK_SIZE, 2.0, missedDeadlineFunc);
|
"TEST_TASK", 40, PeriodicTaskIF::MINIMUM_STACK_SIZE, 2.0, missedDeadlineFunc);
|
||||||
result = testTask->addComponent(objects::TEST_TASK);
|
result = testTask->addComponent(objects::TEST_TASK);
|
||||||
if (result != HasReturnvaluesIF::RETURN_OK) {
|
if (result != returnvalue::OK) {
|
||||||
initmission::printAddObjectError("TEST_TASK", objects::TEST_TASK);
|
initmission::printAddObjectError("TEST_TASK", objects::TEST_TASK);
|
||||||
}
|
}
|
||||||
#if OBSW_ADD_SPI_TEST_CODE == 1
|
#if OBSW_ADD_SPI_TEST_CODE == 1
|
||||||
result = testTask->addComponent(objects::SPI_TEST);
|
result = testTask->addComponent(objects::SPI_TEST);
|
||||||
if (result != HasReturnvaluesIF::RETURN_OK) {
|
if (result != returnvalue::OK) {
|
||||||
initmission::printAddObjectError("SPI_TEST", objects::SPI_TEST);
|
initmission::printAddObjectError("SPI_TEST", objects::SPI_TEST);
|
||||||
}
|
}
|
||||||
#endif /* RPI_ADD_SPI_TEST == 1 */
|
#endif /* RPI_ADD_SPI_TEST == 1 */
|
||||||
#if RPI_ADD_GPIO_TEST == 1
|
#if RPI_ADD_GPIO_TEST == 1
|
||||||
result = testTask->addComponent(objects::LIBGPIOD_TEST);
|
result = testTask->addComponent(objects::LIBGPIOD_TEST);
|
||||||
if (result != HasReturnvaluesIF::RETURN_OK) {
|
if (result != returnvalue::OK) {
|
||||||
initmission::printAddObjectError("GPIOD_TEST", objects::LIBGPIOD_TEST);
|
initmission::printAddObjectError("GPIOD_TEST", objects::LIBGPIOD_TEST);
|
||||||
}
|
}
|
||||||
#endif /* RPI_ADD_GPIO_TEST == 1 */
|
#endif /* RPI_ADD_GPIO_TEST == 1 */
|
||||||
#if OBSW_ADD_UART_TEST_CODE == 1
|
#if OBSW_ADD_UART_TEST_CODE == 1
|
||||||
result = testTask->addComponent(objects::UART_TEST);
|
result = testTask->addComponent(objects::UART_TEST);
|
||||||
if (result != HasReturnvaluesIF::RETURN_OK) {
|
if (result != returnvalue::OK) {
|
||||||
initmission::printAddObjectError("UART_TEST", objects::UART_TEST);
|
initmission::printAddObjectError("UART_TEST", objects::UART_TEST);
|
||||||
}
|
}
|
||||||
PeriodicTaskIF* scexReaderTask = factory.createPeriodicTask(
|
PeriodicTaskIF* scexReaderTask = factory.createPeriodicTask(
|
||||||
@ -282,7 +282,7 @@ void initmission::createTestTasks(TaskFactory& factory,
|
|||||||
FixedTimeslotTaskIF* pstTestTask = factory->createFixedTimeslotTask(
|
FixedTimeslotTaskIF* pstTestTask = factory->createFixedTimeslotTask(
|
||||||
"TEST_PST", 50, PeriodicTaskIF::MINIMUM_STACK_SIZE * 2, 2.0, missedDeadlineFunc);
|
"TEST_PST", 50, PeriodicTaskIF::MINIMUM_STACK_SIZE * 2, 2.0, missedDeadlineFunc);
|
||||||
result = pst::pstTest(pstTestTask);
|
result = pst::pstTest(pstTestTask);
|
||||||
if (result != HasReturnvaluesIF::RETURN_OK) {
|
if (result != returnvalue::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;
|
||||||
}
|
}
|
||||||
|
@ -40,14 +40,14 @@ void rpi::gpio::initSpiCsDecoder(GpioIF* gpioComIF) {
|
|||||||
for (const auto& info : muxInfo) {
|
for (const auto& info : muxInfo) {
|
||||||
result = createRpiGpioConfig(spiMuxGpios, info.gpioId, info.bcmNum, info.consumer,
|
result = createRpiGpioConfig(spiMuxGpios, info.gpioId, info.bcmNum, info.consumer,
|
||||||
Direction::OUT, Levels::LOW);
|
Direction::OUT, Levels::LOW);
|
||||||
if (result != HasReturnvaluesIF::RETURN_OK) {
|
if (result != returnvalue::OK) {
|
||||||
sif::error << "Creating Raspberry Pi SPI Mux GPIO failed with code " << result << std::endl;
|
sif::error << "Creating Raspberry Pi SPI Mux GPIO failed with code " << result << std::endl;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
result = gpioComIF->addGpios(spiMuxGpios);
|
result = gpioComIF->addGpios(spiMuxGpios);
|
||||||
if (result != HasReturnvaluesIF::RETURN_OK) {
|
if (result != returnvalue::OK) {
|
||||||
sif::error << "initSpiCsDecoder: Failed to add mux bit gpios to gpioComIF" << std::endl;
|
sif::error << "initSpiCsDecoder: Failed to add mux bit gpios to gpioComIF" << std::endl;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -116,7 +116,6 @@
|
|||||||
#cmakedefine LIBGPS_VERSION_MAJOR @LIBGPS_VERSION_MAJOR@
|
#cmakedefine LIBGPS_VERSION_MAJOR @LIBGPS_VERSION_MAJOR@
|
||||||
#cmakedefine LIBGPS_VERSION_MINOR @LIBGPS_VERSION_MINOR@
|
#cmakedefine LIBGPS_VERSION_MINOR @LIBGPS_VERSION_MINOR@
|
||||||
|
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
|
|
||||||
#include "objects/systemObjectList.h"
|
#include "objects/systemObjectList.h"
|
||||||
|
@ -3,9 +3,12 @@
|
|||||||
#include <bsp_q7s/core/CoreController.h>
|
#include <bsp_q7s/core/CoreController.h>
|
||||||
#include <bsp_q7s/memory/FileSystemHandler.h>
|
#include <bsp_q7s/memory/FileSystemHandler.h>
|
||||||
#include <bsp_q7s/xadc/Xadc.h>
|
#include <bsp_q7s/xadc/Xadc.h>
|
||||||
|
#include <fsfw/globalfunctions/arrayprinter.h>
|
||||||
#include <fsfw/objectmanager/ObjectManager.h>
|
#include <fsfw/objectmanager/ObjectManager.h>
|
||||||
#include <gps.h>
|
#include <gps.h>
|
||||||
#include <libgpsmm.h>
|
#include <libgpsmm.h>
|
||||||
|
#include <param/param_string.h>
|
||||||
|
#include <param/rparam_client.h>
|
||||||
|
|
||||||
#include <cstdio>
|
#include <cstdio>
|
||||||
#include <ctime>
|
#include <ctime>
|
||||||
@ -18,6 +21,7 @@
|
|||||||
#include "bsp_q7s/memory/scratchApi.h"
|
#include "bsp_q7s/memory/scratchApi.h"
|
||||||
#include "fsfw/tasks/TaskFactory.h"
|
#include "fsfw/tasks/TaskFactory.h"
|
||||||
#include "fsfw/timemanager/Stopwatch.h"
|
#include "fsfw/timemanager/Stopwatch.h"
|
||||||
|
#include "p60pdu.h"
|
||||||
#include "test/DummyParameter.h"
|
#include "test/DummyParameter.h"
|
||||||
|
|
||||||
Q7STestTask::Q7STestTask(object_id_t objectId) : TestTask(objectId) {
|
Q7STestTask::Q7STestTask(object_id_t objectId) : TestTask(objectId) {
|
||||||
@ -35,6 +39,33 @@ ReturnValue_t Q7STestTask::performOneShotAction() {
|
|||||||
if (doTestScratchApi) {
|
if (doTestScratchApi) {
|
||||||
testScratchApi();
|
testScratchApi();
|
||||||
}
|
}
|
||||||
|
if (DO_TEST_GOMSPACE_API) {
|
||||||
|
uint8_t p60pdu_node = 3;
|
||||||
|
uint8_t hk_mem[P60PDU_HK_SIZE];
|
||||||
|
param_index_t p60pdu_hk{};
|
||||||
|
p60pdu_hk.physaddr = hk_mem;
|
||||||
|
if (!p60pdu_get_hk(&p60pdu_hk, p60pdu_node, 1000)) {
|
||||||
|
printf("Error getting p60pdu hk\n");
|
||||||
|
} else {
|
||||||
|
param_list(&p60pdu_hk, 1);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (DO_TEST_GOMSPACE_GET_CONFIG) {
|
||||||
|
uint8_t p60pdu_node = 3;
|
||||||
|
param_index_t requestStruct{};
|
||||||
|
requestStruct.table = p60pdu_config;
|
||||||
|
requestStruct.mem_id = P60PDU_PARAM;
|
||||||
|
uint8_t hk_mem[P60PDU_PARAM_SIZE];
|
||||||
|
requestStruct.count = p60pdu_config_count;
|
||||||
|
requestStruct.size = P60PDU_PARAM_SIZE;
|
||||||
|
requestStruct.physaddr = hk_mem;
|
||||||
|
int result = rparam_get_full_table(&requestStruct, p60pdu_node, P60_PORT_RPARAM,
|
||||||
|
requestStruct.mem_id, 1000);
|
||||||
|
param_list(&requestStruct, 1);
|
||||||
|
return (result == 0);
|
||||||
|
}
|
||||||
|
|
||||||
// testJsonLibDirect();
|
// testJsonLibDirect();
|
||||||
// testDummyParams();
|
// testDummyParams();
|
||||||
if (doTestProtHandler) {
|
if (doTestProtHandler) {
|
||||||
@ -95,23 +126,23 @@ void Q7STestTask::fileTests() {
|
|||||||
|
|
||||||
void Q7STestTask::testScratchApi() {
|
void Q7STestTask::testScratchApi() {
|
||||||
ReturnValue_t result = scratch::writeNumber("TEST", 1);
|
ReturnValue_t result = scratch::writeNumber("TEST", 1);
|
||||||
if (result != HasReturnvaluesIF::RETURN_OK) {
|
if (result != returnvalue::OK) {
|
||||||
sif::debug << "Q7STestTask::scratchApiTest: Writing number failed" << std::endl;
|
sif::debug << "Q7STestTask::scratchApiTest: Writing number failed" << std::endl;
|
||||||
}
|
}
|
||||||
int number = 0;
|
int number = 0;
|
||||||
result = scratch::readNumber("TEST", number);
|
result = scratch::readNumber("TEST", number);
|
||||||
sif::info << "Q7STestTask::testScratchApi: Value for key \"TEST\": " << number << std::endl;
|
sif::info << "Q7STestTask::testScratchApi: Value for key \"TEST\": " << number << std::endl;
|
||||||
if (result != HasReturnvaluesIF::RETURN_OK) {
|
if (result != returnvalue::OK) {
|
||||||
sif::debug << "Q7STestTask::scratchApiTest: Reading number failed" << std::endl;
|
sif::debug << "Q7STestTask::scratchApiTest: Reading number failed" << std::endl;
|
||||||
}
|
}
|
||||||
|
|
||||||
result = scratch::writeString("TEST2", "halloWelt");
|
result = scratch::writeString("TEST2", "halloWelt");
|
||||||
if (result != HasReturnvaluesIF::RETURN_OK) {
|
if (result != returnvalue::OK) {
|
||||||
sif::debug << "Q7STestTask::scratchApiTest: Writing string failed" << std::endl;
|
sif::debug << "Q7STestTask::scratchApiTest: Writing string failed" << std::endl;
|
||||||
}
|
}
|
||||||
std::string string;
|
std::string string;
|
||||||
result = scratch::readString("TEST2", string);
|
result = scratch::readString("TEST2", string);
|
||||||
if (result != HasReturnvaluesIF::RETURN_OK) {
|
if (result != returnvalue::OK) {
|
||||||
sif::debug << "Q7STestTask::scratchApiTest: Reading number failed" << std::endl;
|
sif::debug << "Q7STestTask::scratchApiTest: Reading number failed" << std::endl;
|
||||||
}
|
}
|
||||||
sif::info << "Q7STestTask::testScratchApi: Value for key \"TEST2\": " << string << std::endl;
|
sif::info << "Q7STestTask::testScratchApi: Value for key \"TEST2\": " << string << std::endl;
|
||||||
@ -143,7 +174,7 @@ void Q7STestTask::testDummyParams() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
ReturnValue_t result = param.readJsonFile();
|
ReturnValue_t result = param.readJsonFile();
|
||||||
if (result != HasReturnvaluesIF::RETURN_OK) {
|
if (result != returnvalue::OK) {
|
||||||
}
|
}
|
||||||
|
|
||||||
param.setValue(DummyParameter::DUMMY_KEY_PARAM_1, 3);
|
param.setValue(DummyParameter::DUMMY_KEY_PARAM_1, 3);
|
||||||
@ -154,13 +185,13 @@ void Q7STestTask::testDummyParams() {
|
|||||||
|
|
||||||
int test = 0;
|
int test = 0;
|
||||||
result = param.getValue<int>(DummyParameter::DUMMY_KEY_PARAM_1, test);
|
result = param.getValue<int>(DummyParameter::DUMMY_KEY_PARAM_1, test);
|
||||||
if (result != HasReturnvaluesIF::RETURN_OK) {
|
if (result != returnvalue::OK) {
|
||||||
sif::warning << "Q7STestTask::testDummyParams: Key " << DummyParameter::DUMMY_KEY_PARAM_1
|
sif::warning << "Q7STestTask::testDummyParams: Key " << DummyParameter::DUMMY_KEY_PARAM_1
|
||||||
<< " does not exist" << std::endl;
|
<< " does not exist" << std::endl;
|
||||||
}
|
}
|
||||||
std::string test2;
|
std::string test2;
|
||||||
result = param.getValue<std::string>(DummyParameter::DUMMY_KEY_PARAM_2, test2);
|
result = param.getValue<std::string>(DummyParameter::DUMMY_KEY_PARAM_2, test2);
|
||||||
if (result != HasReturnvaluesIF::RETURN_OK) {
|
if (result != returnvalue::OK) {
|
||||||
sif::warning << "Q7STestTask::testDummyParams: Key " << DummyParameter::DUMMY_KEY_PARAM_1
|
sif::warning << "Q7STestTask::testDummyParams: Key " << DummyParameter::DUMMY_KEY_PARAM_1
|
||||||
<< " does not exist" << std::endl;
|
<< " does not exist" << std::endl;
|
||||||
}
|
}
|
||||||
@ -179,18 +210,18 @@ ReturnValue_t Q7STestTask::initialize() {
|
|||||||
|
|
||||||
void Q7STestTask::testProtHandler() {
|
void Q7STestTask::testProtHandler() {
|
||||||
bool opPerformed = false;
|
bool opPerformed = false;
|
||||||
ReturnValue_t result = HasReturnvaluesIF::RETURN_OK;
|
ReturnValue_t result = returnvalue::OK;
|
||||||
// If any chips are unlocked, lock them here
|
// If any chips are unlocked, lock them here
|
||||||
result = coreController->setBootCopyProtection(xsc::Chip::ALL_CHIP, xsc::Copy::ALL_COPY, true,
|
result = coreController->setBootCopyProtection(xsc::Chip::ALL_CHIP, xsc::Copy::ALL_COPY, true,
|
||||||
opPerformed, true);
|
opPerformed, true);
|
||||||
if (result != HasReturnvaluesIF::RETURN_OK) {
|
if (result != returnvalue::OK) {
|
||||||
sif::warning << "Q7STestTask::testProtHandler: Op failed" << std::endl;
|
sif::warning << "Q7STestTask::testProtHandler: Op failed" << std::endl;
|
||||||
}
|
}
|
||||||
|
|
||||||
// unlock own copy
|
// unlock own copy
|
||||||
result = coreController->setBootCopyProtection(xsc::Chip::SELF_CHIP, xsc::Copy::SELF_COPY, false,
|
result = coreController->setBootCopyProtection(xsc::Chip::SELF_CHIP, xsc::Copy::SELF_COPY, false,
|
||||||
opPerformed, true);
|
opPerformed, true);
|
||||||
if (result != HasReturnvaluesIF::RETURN_OK) {
|
if (result != returnvalue::OK) {
|
||||||
sif::warning << "Q7STestTask::testProtHandler: Op failed" << std::endl;
|
sif::warning << "Q7STestTask::testProtHandler: Op failed" << std::endl;
|
||||||
}
|
}
|
||||||
if (not opPerformed) {
|
if (not opPerformed) {
|
||||||
@ -204,7 +235,7 @@ void Q7STestTask::testProtHandler() {
|
|||||||
// lock own copy
|
// lock own copy
|
||||||
result = coreController->setBootCopyProtection(xsc::Chip::SELF_CHIP, xsc::Copy::SELF_COPY, true,
|
result = coreController->setBootCopyProtection(xsc::Chip::SELF_CHIP, xsc::Copy::SELF_COPY, true,
|
||||||
opPerformed, true);
|
opPerformed, true);
|
||||||
if (result != HasReturnvaluesIF::RETURN_OK) {
|
if (result != returnvalue::OK) {
|
||||||
sif::warning << "Q7STestTask::testProtHandler: Op failed" << std::endl;
|
sif::warning << "Q7STestTask::testProtHandler: Op failed" << std::endl;
|
||||||
}
|
}
|
||||||
if (not opPerformed) {
|
if (not opPerformed) {
|
||||||
@ -218,7 +249,7 @@ void Q7STestTask::testProtHandler() {
|
|||||||
// unlock specific copy
|
// unlock specific copy
|
||||||
result = coreController->setBootCopyProtection(xsc::Chip::CHIP_1, xsc::Copy::COPY_1, false,
|
result = coreController->setBootCopyProtection(xsc::Chip::CHIP_1, xsc::Copy::COPY_1, false,
|
||||||
opPerformed, true);
|
opPerformed, true);
|
||||||
if (result != HasReturnvaluesIF::RETURN_OK) {
|
if (result != returnvalue::OK) {
|
||||||
sif::warning << "Q7STestTask::testProtHandler: Op failed" << std::endl;
|
sif::warning << "Q7STestTask::testProtHandler: Op failed" << std::endl;
|
||||||
}
|
}
|
||||||
if (not opPerformed) {
|
if (not opPerformed) {
|
||||||
@ -232,7 +263,7 @@ void Q7STestTask::testProtHandler() {
|
|||||||
// lock specific copy
|
// lock specific copy
|
||||||
result = coreController->setBootCopyProtection(xsc::Chip::CHIP_1, xsc::Copy::COPY_1, true,
|
result = coreController->setBootCopyProtection(xsc::Chip::CHIP_1, xsc::Copy::COPY_1, true,
|
||||||
opPerformed, true);
|
opPerformed, true);
|
||||||
if (result != HasReturnvaluesIF::RETURN_OK) {
|
if (result != returnvalue::OK) {
|
||||||
sif::warning << "Q7STestTask::testProtHandler: Op failed" << std::endl;
|
sif::warning << "Q7STestTask::testProtHandler: Op failed" << std::endl;
|
||||||
}
|
}
|
||||||
if (not opPerformed) {
|
if (not opPerformed) {
|
||||||
@ -341,24 +372,24 @@ void Q7STestTask::testFileSystemHandlerDirect(FsOpCodes opCode) {
|
|||||||
<< std::endl;
|
<< std::endl;
|
||||||
}
|
}
|
||||||
FileSystemHandler::FsCommandCfg cfg = {};
|
FileSystemHandler::FsCommandCfg cfg = {};
|
||||||
ReturnValue_t result = HasReturnvaluesIF::RETURN_OK;
|
ReturnValue_t result = returnvalue::OK;
|
||||||
|
|
||||||
// Lambda for common code
|
// Lambda for common code
|
||||||
auto createNonEmptyTmpDir = [&]() {
|
auto createNonEmptyTmpDir = [&]() {
|
||||||
if (not std::filesystem::exists("/tmp/test")) {
|
if (not std::filesystem::exists("/tmp/test")) {
|
||||||
result = fsHandler->createDirectory("/tmp", "test", false, &cfg);
|
result = fsHandler->createDirectory("/tmp", "test", false, &cfg);
|
||||||
if (result != HasReturnvaluesIF::RETURN_OK) {
|
if (result != returnvalue::OK) {
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// Creating sample files
|
// Creating sample files
|
||||||
sif::info << "Creating sample files in directory" << std::endl;
|
sif::info << "Creating sample files in directory" << std::endl;
|
||||||
result = fsHandler->createFile("/tmp/test", "test1.txt", nullptr, 0, &cfg);
|
result = fsHandler->createFile("/tmp/test", "test1.txt", nullptr, 0, &cfg);
|
||||||
if (result != HasReturnvaluesIF::RETURN_OK) {
|
if (result != returnvalue::OK) {
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
result = fsHandler->createFile("/tmp/test", "test2.txt", nullptr, 0, &cfg);
|
result = fsHandler->createFile("/tmp/test", "test2.txt", nullptr, 0, &cfg);
|
||||||
if (result != HasReturnvaluesIF::RETURN_OK) {
|
if (result != returnvalue::OK) {
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
return result;
|
return result;
|
||||||
@ -383,7 +414,7 @@ void Q7STestTask::testFileSystemHandlerDirect(FsOpCodes opCode) {
|
|||||||
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 == returnvalue::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;
|
||||||
@ -396,7 +427,7 @@ void Q7STestTask::testFileSystemHandlerDirect(FsOpCodes opCode) {
|
|||||||
sif::info << "Creating empty file in /tmp folder" << std::endl;
|
sif::info << "Creating empty file in /tmp folder" << std::endl;
|
||||||
// Do not delete file, user can check existence in shell
|
// Do not delete file, user can check existence in shell
|
||||||
ReturnValue_t result = fsHandler->createDirectory("/tmp/", "test", false, &cfg);
|
ReturnValue_t result = fsHandler->createDirectory("/tmp/", "test", false, &cfg);
|
||||||
if (result == HasReturnvaluesIF::RETURN_OK) {
|
if (result == returnvalue::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;
|
||||||
@ -413,7 +444,7 @@ void Q7STestTask::testFileSystemHandlerDirect(FsOpCodes opCode) {
|
|||||||
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 == returnvalue::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;
|
||||||
@ -422,11 +453,11 @@ void Q7STestTask::testFileSystemHandlerDirect(FsOpCodes opCode) {
|
|||||||
}
|
}
|
||||||
case (FsOpCodes::REMOVE_FILLED_DIR_IN_TMP): {
|
case (FsOpCodes::REMOVE_FILLED_DIR_IN_TMP): {
|
||||||
result = createNonEmptyTmpDir();
|
result = createNonEmptyTmpDir();
|
||||||
if (result != HasReturnvaluesIF::RETURN_OK) {
|
if (result != returnvalue::OK) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
result = fsHandler->removeDirectory("/tmp/", "test", true, &cfg);
|
result = fsHandler->removeDirectory("/tmp/", "test", true, &cfg);
|
||||||
if (result == HasReturnvaluesIF::RETURN_OK) {
|
if (result == returnvalue::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;
|
||||||
@ -435,11 +466,11 @@ void Q7STestTask::testFileSystemHandlerDirect(FsOpCodes opCode) {
|
|||||||
}
|
}
|
||||||
case (FsOpCodes::ATTEMPT_DIR_REMOVAL_NON_EMPTY): {
|
case (FsOpCodes::ATTEMPT_DIR_REMOVAL_NON_EMPTY): {
|
||||||
result = createNonEmptyTmpDir();
|
result = createNonEmptyTmpDir();
|
||||||
if (result != HasReturnvaluesIF::RETURN_OK) {
|
if (result != returnvalue::OK) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
result = fsHandler->removeDirectory("/tmp/", "test", false, &cfg);
|
result = fsHandler->removeDirectory("/tmp/", "test", false, &cfg);
|
||||||
if (result != HasReturnvaluesIF::RETURN_OK) {
|
if (result != returnvalue::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;
|
||||||
@ -478,7 +509,7 @@ void Q7STestTask::testFileSystemHandlerDirect(FsOpCodes opCode) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void Q7STestTask::xadcTest() {
|
void Q7STestTask::xadcTest() {
|
||||||
ReturnValue_t result = RETURN_OK;
|
ReturnValue_t result = returnvalue::OK;
|
||||||
float temperature = 0;
|
float temperature = 0;
|
||||||
float vccPint = 0;
|
float vccPint = 0;
|
||||||
float vccPaux = 0;
|
float vccPaux = 0;
|
||||||
@ -490,39 +521,39 @@ void Q7STestTask::xadcTest() {
|
|||||||
float vrefn = 0;
|
float vrefn = 0;
|
||||||
Xadc xadc;
|
Xadc xadc;
|
||||||
result = xadc.getTemperature(temperature);
|
result = xadc.getTemperature(temperature);
|
||||||
if (result == HasReturnvaluesIF::RETURN_OK) {
|
if (result == returnvalue::OK) {
|
||||||
sif::info << "Q7STestTask::xadcTest: Chip Temperature: " << temperature << " °C" << std::endl;
|
sif::info << "Q7STestTask::xadcTest: Chip Temperature: " << temperature << " °C" << std::endl;
|
||||||
}
|
}
|
||||||
result = xadc.getVccPint(vccPint);
|
result = xadc.getVccPint(vccPint);
|
||||||
if (result == HasReturnvaluesIF::RETURN_OK) {
|
if (result == returnvalue::OK) {
|
||||||
sif::info << "Q7STestTask::xadcTest: VCC PS internal: " << vccPint << " mV" << std::endl;
|
sif::info << "Q7STestTask::xadcTest: VCC PS internal: " << vccPint << " mV" << std::endl;
|
||||||
}
|
}
|
||||||
result = xadc.getVccPaux(vccPaux);
|
result = xadc.getVccPaux(vccPaux);
|
||||||
if (result == HasReturnvaluesIF::RETURN_OK) {
|
if (result == returnvalue::OK) {
|
||||||
sif::info << "Q7STestTask::xadcTest: VCC PS auxilliary: " << vccPaux << " mV" << std::endl;
|
sif::info << "Q7STestTask::xadcTest: VCC PS auxilliary: " << vccPaux << " mV" << std::endl;
|
||||||
}
|
}
|
||||||
result = xadc.getVccInt(vccInt);
|
result = xadc.getVccInt(vccInt);
|
||||||
if (result == HasReturnvaluesIF::RETURN_OK) {
|
if (result == returnvalue::OK) {
|
||||||
sif::info << "Q7STestTask::xadcTest: VCC PL internal: " << vccInt << " mV" << std::endl;
|
sif::info << "Q7STestTask::xadcTest: VCC PL internal: " << vccInt << " mV" << std::endl;
|
||||||
}
|
}
|
||||||
result = xadc.getVccAux(vccAux);
|
result = xadc.getVccAux(vccAux);
|
||||||
if (result == HasReturnvaluesIF::RETURN_OK) {
|
if (result == returnvalue::OK) {
|
||||||
sif::info << "Q7STestTask::xadcTest: VCC PL auxilliary: " << vccAux << " mV" << std::endl;
|
sif::info << "Q7STestTask::xadcTest: VCC PL auxilliary: " << vccAux << " mV" << std::endl;
|
||||||
}
|
}
|
||||||
result = xadc.getVccBram(vccBram);
|
result = xadc.getVccBram(vccBram);
|
||||||
if (result == HasReturnvaluesIF::RETURN_OK) {
|
if (result == returnvalue::OK) {
|
||||||
sif::info << "Q7STestTask::xadcTest: VCC BRAM: " << vccBram << " mV" << std::endl;
|
sif::info << "Q7STestTask::xadcTest: VCC BRAM: " << vccBram << " mV" << std::endl;
|
||||||
}
|
}
|
||||||
result = xadc.getVccOddr(vccOddr);
|
result = xadc.getVccOddr(vccOddr);
|
||||||
if (result == HasReturnvaluesIF::RETURN_OK) {
|
if (result == returnvalue::OK) {
|
||||||
sif::info << "Q7STestTask::xadcTest: VCC PS I/O DDR : " << vccOddr << " mV" << std::endl;
|
sif::info << "Q7STestTask::xadcTest: VCC PS I/O DDR : " << vccOddr << " mV" << std::endl;
|
||||||
}
|
}
|
||||||
result = xadc.getVrefp(vrefp);
|
result = xadc.getVrefp(vrefp);
|
||||||
if (result == HasReturnvaluesIF::RETURN_OK) {
|
if (result == returnvalue::OK) {
|
||||||
sif::info << "Q7STestTask::xadcTest: Vrefp : " << vrefp << " mV" << std::endl;
|
sif::info << "Q7STestTask::xadcTest: Vrefp : " << vrefp << " mV" << std::endl;
|
||||||
}
|
}
|
||||||
result = xadc.getVrefn(vrefn);
|
result = xadc.getVrefn(vrefn);
|
||||||
if (result == HasReturnvaluesIF::RETURN_OK) {
|
if (result == returnvalue::OK) {
|
||||||
sif::info << "Q7STestTask::xadcTest: Vrefn : " << vrefn << " mV" << std::endl;
|
sif::info << "Q7STestTask::xadcTest: Vrefn : " << vrefn << " mV" << std::endl;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -16,6 +16,8 @@ class Q7STestTask : public TestTask {
|
|||||||
private:
|
private:
|
||||||
bool doTestSdCard = false;
|
bool doTestSdCard = false;
|
||||||
bool doTestScratchApi = false;
|
bool doTestScratchApi = false;
|
||||||
|
static constexpr bool DO_TEST_GOMSPACE_API = false;
|
||||||
|
static constexpr bool DO_TEST_GOMSPACE_GET_CONFIG = false;
|
||||||
bool doTestGpsShm = false;
|
bool doTestGpsShm = false;
|
||||||
bool doTestGpsSocket = false;
|
bool doTestGpsSocket = false;
|
||||||
bool doTestProtHandler = false;
|
bool doTestProtHandler = false;
|
||||||
|
@ -11,10 +11,10 @@ ReturnValue_t gps::triggerGpioResetPin(const uint8_t* actionData, size_t len, vo
|
|||||||
}
|
}
|
||||||
ResetArgs* resetArgs = reinterpret_cast<ResetArgs*>(args);
|
ResetArgs* resetArgs = reinterpret_cast<ResetArgs*>(args);
|
||||||
if (args == nullptr) {
|
if (args == nullptr) {
|
||||||
return HasReturnvaluesIF::RETURN_FAILED;
|
return returnvalue::FAILED;
|
||||||
}
|
}
|
||||||
if (resetArgs->gpioComIF == nullptr) {
|
if (resetArgs->gpioComIF == nullptr) {
|
||||||
return HasReturnvaluesIF::RETURN_FAILED;
|
return returnvalue::FAILED;
|
||||||
}
|
}
|
||||||
gpioId_t gpioId;
|
gpioId_t gpioId;
|
||||||
if (actionData[0] == 0) {
|
if (actionData[0] == 0) {
|
||||||
@ -25,5 +25,5 @@ ReturnValue_t gps::triggerGpioResetPin(const uint8_t* actionData, size_t len, vo
|
|||||||
resetArgs->gpioComIF->pullLow(gpioId);
|
resetArgs->gpioComIF->pullLow(gpioId);
|
||||||
TaskFactory::delayTask(resetArgs->waitPeriodMs);
|
TaskFactory::delayTask(resetArgs->waitPeriodMs);
|
||||||
resetArgs->gpioComIF->pullHigh(gpioId);
|
resetArgs->gpioComIF->pullHigh(gpioId);
|
||||||
return HasReturnvaluesIF::RETURN_OK;
|
return returnvalue::OK;
|
||||||
}
|
}
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
#ifndef BSP_Q7S_CALLBACKS_GNSSCALLBACK_H_
|
#ifndef BSP_Q7S_CALLBACKS_GNSSCALLBACK_H_
|
||||||
#define BSP_Q7S_CALLBACKS_GNSSCALLBACK_H_
|
#define BSP_Q7S_CALLBACKS_GNSSCALLBACK_H_
|
||||||
|
|
||||||
#include "fsfw/returnvalues/HasReturnvaluesIF.h"
|
#include "fsfw/returnvalues/returnvalue.h"
|
||||||
#include "fsfw_hal/linux/gpio/LinuxLibgpioIF.h"
|
#include "fsfw_hal/linux/gpio/LinuxLibgpioIF.h"
|
||||||
|
|
||||||
struct ResetArgs {
|
struct ResetArgs {
|
||||||
|
@ -47,7 +47,7 @@ void q7s::gpioCallbacks::initSpiCsDecoder(GpioIF* gpioComIF) {
|
|||||||
spiMuxGpios->addGpio(gpioIds::EN_RW_CS, enRwDecoder);
|
spiMuxGpios->addGpio(gpioIds::EN_RW_CS, enRwDecoder);
|
||||||
|
|
||||||
result = gpioComIF->addGpios(spiMuxGpios);
|
result = gpioComIF->addGpios(spiMuxGpios);
|
||||||
if (result != HasReturnvaluesIF::RETURN_OK) {
|
if (result != returnvalue::OK) {
|
||||||
sif::error << "initSpiCsDecoder: Failed to add SPI MUX bit GPIOs" << std::endl;
|
sif::error << "initSpiCsDecoder: Failed to add SPI MUX bit GPIOs" << std::endl;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -29,12 +29,12 @@ void closeSpi(int fd, gpioId_t gpioId, GpioIF* gpioIF, MutexIF* mutex);
|
|||||||
ReturnValue_t spiCallback(SpiComIF* comIf, SpiCookie* cookie, const uint8_t* sendData,
|
ReturnValue_t spiCallback(SpiComIF* comIf, SpiCookie* cookie, const uint8_t* sendData,
|
||||||
size_t sendLen, void* args) {
|
size_t sendLen, void* args) {
|
||||||
// Stopwatch watch;
|
// Stopwatch watch;
|
||||||
ReturnValue_t result = HasReturnvaluesIF::RETURN_OK;
|
ReturnValue_t result = returnvalue::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 returnvalue::FAILED;
|
||||||
}
|
}
|
||||||
|
|
||||||
uint8_t writeBuffer[2] = {};
|
uint8_t writeBuffer[2] = {};
|
||||||
@ -48,13 +48,13 @@ ReturnValue_t spiCallback(SpiComIF* comIf, SpiCookie* cookie, const uint8_t* sen
|
|||||||
cookie->getMutexParams(timeoutType, timeoutMs);
|
cookie->getMutexParams(timeoutType, timeoutMs);
|
||||||
if (mutex == nullptr or gpioIF == nullptr) {
|
if (mutex == nullptr or gpioIF == nullptr) {
|
||||||
sif::debug << "rwSpiCallback::spiCallback: Mutex or GPIO interface invalid" << std::endl;
|
sif::debug << "rwSpiCallback::spiCallback: Mutex or GPIO interface invalid" << std::endl;
|
||||||
return HasReturnvaluesIF::RETURN_FAILED;
|
return returnvalue::FAILED;
|
||||||
}
|
}
|
||||||
|
|
||||||
int fileDescriptor = 0;
|
int fileDescriptor = 0;
|
||||||
const std::string& dev = comIf->getSpiDev();
|
const std::string& dev = comIf->getSpiDev();
|
||||||
result = openSpi(dev, O_RDWR, gpioIF, gpioId, mutex, timeoutType, timeoutMs, fileDescriptor);
|
result = openSpi(dev, O_RDWR, gpioIF, gpioId, mutex, timeoutType, timeoutMs, fileDescriptor);
|
||||||
if (result != HasReturnvaluesIF::RETURN_OK) {
|
if (result != returnvalue::OK) {
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -118,7 +118,7 @@ ReturnValue_t spiCallback(SpiComIF* comIf, SpiCookie* cookie, const uint8_t* sen
|
|||||||
|
|
||||||
uint8_t* rxBuf = nullptr;
|
uint8_t* rxBuf = nullptr;
|
||||||
result = comIf->getReadBuffer(cookie->getSpiAddress(), &rxBuf);
|
result = comIf->getReadBuffer(cookie->getSpiAddress(), &rxBuf);
|
||||||
if (result != HasReturnvaluesIF::RETURN_OK) {
|
if (result != returnvalue::OK) {
|
||||||
closeSpi(fileDescriptor, gpioId, gpioIF, mutex);
|
closeSpi(fileDescriptor, gpioId, gpioIF, mutex);
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
@ -130,7 +130,7 @@ ReturnValue_t spiCallback(SpiComIF* comIf, SpiCookie* cookie, const uint8_t* sen
|
|||||||
closeSpi(fileDescriptor, gpioId, gpioIF, mutex);
|
closeSpi(fileDescriptor, gpioId, gpioIF, mutex);
|
||||||
usleep(RwDefinitions::SPI_REPLY_DELAY);
|
usleep(RwDefinitions::SPI_REPLY_DELAY);
|
||||||
result = openSpi(dev, O_RDWR, gpioIF, gpioId, mutex, timeoutType, timeoutMs, fileDescriptor);
|
result = openSpi(dev, O_RDWR, gpioIF, gpioId, mutex, timeoutType, timeoutMs, fileDescriptor);
|
||||||
if (result != HasReturnvaluesIF::RETURN_OK) {
|
if (result != returnvalue::OK) {
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -228,7 +228,7 @@ ReturnValue_t spiCallback(SpiComIF* comIf, SpiCookie* cookie, const uint8_t* sen
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
result = HasReturnvaluesIF::RETURN_OK;
|
result = returnvalue::OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
cookie->setTransferSize(decodedFrameLen);
|
cookie->setTransferSize(decodedFrameLen);
|
||||||
@ -244,7 +244,7 @@ ReturnValue_t openSpi(const std::string& devname, int flags, GpioIF* gpioIF, gpi
|
|||||||
MutexIF* mutex, MutexIF::TimeoutType timeoutType, uint32_t timeoutMs,
|
MutexIF* mutex, MutexIF::TimeoutType timeoutType, uint32_t timeoutMs,
|
||||||
int& fd) {
|
int& fd) {
|
||||||
ReturnValue_t result = mutex->lockMutex(timeoutType, timeoutMs);
|
ReturnValue_t result = mutex->lockMutex(timeoutType, timeoutMs);
|
||||||
if (result != HasReturnvaluesIF::RETURN_OK) {
|
if (result != returnvalue::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;
|
||||||
}
|
}
|
||||||
@ -258,21 +258,21 @@ ReturnValue_t openSpi(const std::string& devname, int flags, GpioIF* gpioIF, gpi
|
|||||||
// Pull SPI CS low. For now, no support for active high given
|
// Pull SPI CS low. For now, no support for active high given
|
||||||
if (gpioId != gpio::NO_GPIO) {
|
if (gpioId != gpio::NO_GPIO) {
|
||||||
result = gpioIF->pullLow(gpioId);
|
result = gpioIF->pullLow(gpioId);
|
||||||
if (result != HasReturnvaluesIF::RETURN_OK) {
|
if (result != returnvalue::OK) {
|
||||||
sif::error << "rwSpiCallback::spiCallback: Failed to pull chip select low" << std::endl;
|
sif::error << "rwSpiCallback::spiCallback: Failed to pull chip select low" << std::endl;
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return HasReturnvaluesIF::RETURN_OK;
|
return returnvalue::OK;
|
||||||
}
|
}
|
||||||
void closeSpi(int fd, gpioId_t gpioId, GpioIF* gpioIF, MutexIF* mutex) {
|
void closeSpi(int fd, gpioId_t gpioId, GpioIF* gpioIF, MutexIF* mutex) {
|
||||||
close(fd);
|
close(fd);
|
||||||
if (gpioId != gpio::NO_GPIO) {
|
if (gpioId != gpio::NO_GPIO) {
|
||||||
if (gpioIF->pullHigh(gpioId) != HasReturnvaluesIF::RETURN_OK) {
|
if (gpioIF->pullHigh(gpioId) != returnvalue::OK) {
|
||||||
sif::error << "closeSpi: Failed to pull chip select high" << std::endl;
|
sif::error << "closeSpi: Failed to pull chip select high" << std::endl;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (mutex->unlockMutex() != HasReturnvaluesIF::RETURN_OK) {
|
if (mutex->unlockMutex() != returnvalue::OK) {
|
||||||
sif::error << "rwSpiCallback::closeSpi: Failed to unlock mutex" << std::endl;
|
sif::error << "rwSpiCallback::closeSpi: Failed to unlock mutex" << std::endl;
|
||||||
;
|
;
|
||||||
}
|
}
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
#ifndef BSP_Q7S_RW_SPI_CALLBACK_H_
|
#ifndef BSP_Q7S_RW_SPI_CALLBACK_H_
|
||||||
#define BSP_Q7S_RW_SPI_CALLBACK_H_
|
#define BSP_Q7S_RW_SPI_CALLBACK_H_
|
||||||
|
|
||||||
#include "fsfw/returnvalues/HasReturnvaluesIF.h"
|
#include "fsfw/returnvalues/returnvalue.h"
|
||||||
#include "fsfw_hal/common/gpio/GpioCookie.h"
|
#include "fsfw_hal/common/gpio/GpioCookie.h"
|
||||||
#include "fsfw_hal/linux/spi/SpiComIF.h"
|
#include "fsfw_hal/linux/spi/SpiComIF.h"
|
||||||
|
|
||||||
|
@ -33,10 +33,10 @@ CoreController::CoreController(object_id_t objectId)
|
|||||||
opDivider5(5),
|
opDivider5(5),
|
||||||
opDivider10(10),
|
opDivider10(10),
|
||||||
hkSet(this) {
|
hkSet(this) {
|
||||||
ReturnValue_t result = HasReturnvaluesIF::RETURN_OK;
|
ReturnValue_t result = returnvalue::OK;
|
||||||
try {
|
try {
|
||||||
result = initWatchdogFifo();
|
result = initWatchdogFifo();
|
||||||
if (result != HasReturnvaluesIF::RETURN_OK) {
|
if (result != returnvalue::OK) {
|
||||||
sif::warning << "CoreController::CoreController: Watchdog FIFO init failed" << std::endl;
|
sif::warning << "CoreController::CoreController: Watchdog FIFO init failed" << std::endl;
|
||||||
}
|
}
|
||||||
sdcMan = SdCardManager::instance();
|
sdcMan = SdCardManager::instance();
|
||||||
@ -50,7 +50,7 @@ CoreController::CoreController(object_id_t objectId)
|
|||||||
sdStateMachine();
|
sdStateMachine();
|
||||||
|
|
||||||
result = initBootCopy();
|
result = initBootCopy();
|
||||||
if (result != HasReturnvaluesIF::RETURN_OK) {
|
if (result != returnvalue::OK) {
|
||||||
sif::warning << "CoreController::CoreController: Boot copy init" << std::endl;
|
sif::warning << "CoreController::CoreController: Boot copy init" << std::endl;
|
||||||
}
|
}
|
||||||
} catch (const std::filesystem::filesystem_error &e) {
|
} catch (const std::filesystem::filesystem_error &e) {
|
||||||
@ -66,7 +66,7 @@ ReturnValue_t CoreController::handleCommandMessage(CommandMessage *message) {
|
|||||||
|
|
||||||
void CoreController::performControlOperation() {
|
void CoreController::performControlOperation() {
|
||||||
EventMessage event;
|
EventMessage event;
|
||||||
for (ReturnValue_t result = eventQueue->receiveMessage(&event); result == RETURN_OK;
|
for (ReturnValue_t result = eventQueue->receiveMessage(&event); result == returnvalue::OK;
|
||||||
result = eventQueue->receiveMessage(&event)) {
|
result = eventQueue->receiveMessage(&event)) {
|
||||||
switch (event.getEvent()) {
|
switch (event.getEvent()) {
|
||||||
case (GpsHyperion::GPS_FIX_CHANGE): {
|
case (GpsHyperion::GPS_FIX_CHANGE): {
|
||||||
@ -93,7 +93,7 @@ ReturnValue_t CoreController::initializeLocalDataPool(localpool::DataPool &local
|
|||||||
localDataPoolMap.emplace(core::PS_VOLTAGE, new PoolEntry<float>({0}));
|
localDataPoolMap.emplace(core::PS_VOLTAGE, new PoolEntry<float>({0}));
|
||||||
localDataPoolMap.emplace(core::PL_VOLTAGE, new PoolEntry<float>({0}));
|
localDataPoolMap.emplace(core::PL_VOLTAGE, new PoolEntry<float>({0}));
|
||||||
poolManager.subscribeForRegularPeriodicPacket({hkSet.getSid(), false, 10.0});
|
poolManager.subscribeForRegularPeriodicPacket({hkSet.getSid(), false, 10.0});
|
||||||
return HasReturnvaluesIF::RETURN_OK;
|
return returnvalue::OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
LocalPoolDataSetBase *CoreController::getDataSetHandle(sid_t sid) {
|
LocalPoolDataSetBase *CoreController::getDataSetHandle(sid_t sid) {
|
||||||
@ -105,11 +105,11 @@ LocalPoolDataSetBase *CoreController::getDataSetHandle(sid_t sid) {
|
|||||||
|
|
||||||
ReturnValue_t CoreController::initialize() {
|
ReturnValue_t CoreController::initialize() {
|
||||||
ReturnValue_t result = ExtendedControllerBase::initialize();
|
ReturnValue_t result = ExtendedControllerBase::initialize();
|
||||||
if (result != HasReturnvaluesIF::RETURN_OK) {
|
if (result != returnvalue::OK) {
|
||||||
sif::warning << "CoreController::initialize: Base init failed" << std::endl;
|
sif::warning << "CoreController::initialize: Base init failed" << std::endl;
|
||||||
}
|
}
|
||||||
result = scratch::writeNumber(scratch::ALLOC_FAILURE_COUNT, 0);
|
result = scratch::writeNumber(scratch::ALLOC_FAILURE_COUNT, 0);
|
||||||
if (result != HasReturnvaluesIF::RETURN_OK) {
|
if (result != returnvalue::OK) {
|
||||||
sif::warning << "CoreController::initialize: Setting up alloc failure "
|
sif::warning << "CoreController::initialize: Setting up alloc failure "
|
||||||
"count failed"
|
"count failed"
|
||||||
<< std::endl;
|
<< std::endl;
|
||||||
@ -126,31 +126,31 @@ ReturnValue_t CoreController::initialize() {
|
|||||||
<< std::endl;
|
<< std::endl;
|
||||||
}
|
}
|
||||||
result = eventManager->registerListener(eventQueue->getId());
|
result = eventManager->registerListener(eventQueue->getId());
|
||||||
if (result != HasReturnvaluesIF::RETURN_OK) {
|
if (result != returnvalue::OK) {
|
||||||
sif::warning << "CoreController::initialize: Registering as event listener failed" << std::endl;
|
sif::warning << "CoreController::initialize: Registering as event listener failed" << std::endl;
|
||||||
}
|
}
|
||||||
result = eventManager->subscribeToEvent(eventQueue->getId(),
|
result = eventManager->subscribeToEvent(eventQueue->getId(),
|
||||||
event::getEventId(GpsHyperion::GPS_FIX_CHANGE));
|
event::getEventId(GpsHyperion::GPS_FIX_CHANGE));
|
||||||
if (result != HasReturnvaluesIF::RETURN_OK) {
|
if (result != returnvalue::OK) {
|
||||||
sif::warning << "Subscribing for GPS GPS_FIX_CHANGE event failed" << std::endl;
|
sif::warning << "Subscribing for GPS GPS_FIX_CHANGE event failed" << std::endl;
|
||||||
}
|
}
|
||||||
return RETURN_OK;
|
return returnvalue::OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
ReturnValue_t CoreController::initializeAfterTaskCreation() {
|
ReturnValue_t CoreController::initializeAfterTaskCreation() {
|
||||||
ReturnValue_t result = HasReturnvaluesIF::RETURN_OK;
|
ReturnValue_t result = returnvalue::OK;
|
||||||
sdInfo.pref = sdcMan->getPreferredSdCard();
|
sdInfo.pref = sdcMan->getPreferredSdCard();
|
||||||
sdcMan->setActiveSdCard(sdInfo.pref);
|
sdcMan->setActiveSdCard(sdInfo.pref);
|
||||||
currMntPrefix = sdcMan->getCurrentMountPrefix();
|
currMntPrefix = sdcMan->getCurrentMountPrefix();
|
||||||
if (BLOCKING_SD_INIT) {
|
if (BLOCKING_SD_INIT) {
|
||||||
ReturnValue_t result = initSdCardBlocking();
|
ReturnValue_t result = initSdCardBlocking();
|
||||||
if (result != HasReturnvaluesIF::RETURN_OK and result != SdCardManager::ALREADY_MOUNTED) {
|
if (result != returnvalue::OK and result != SdCardManager::ALREADY_MOUNTED) {
|
||||||
sif::warning << "CoreController::CoreController: SD card init failed" << std::endl;
|
sif::warning << "CoreController::CoreController: SD card init failed" << std::endl;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
sdStateMachine();
|
sdStateMachine();
|
||||||
performMountedSdCardOperations();
|
performMountedSdCardOperations();
|
||||||
if (result != HasReturnvaluesIF::RETURN_OK) {
|
if (result != returnvalue::OK) {
|
||||||
sif::warning << "CoreController::initialize: Version initialization failed" << std::endl;
|
sif::warning << "CoreController::initialize: Version initialization failed" << std::endl;
|
||||||
}
|
}
|
||||||
// Add script folder to path
|
// Add script folder to path
|
||||||
@ -236,22 +236,22 @@ ReturnValue_t CoreController::executeAction(ActionId_t actionId, MessageQueueId_
|
|||||||
|
|
||||||
ReturnValue_t CoreController::checkModeCommand(Mode_t mode, Submode_t submode,
|
ReturnValue_t CoreController::checkModeCommand(Mode_t mode, Submode_t submode,
|
||||||
uint32_t *msToReachTheMode) {
|
uint32_t *msToReachTheMode) {
|
||||||
return HasReturnvaluesIF::RETURN_OK;
|
return returnvalue::OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
ReturnValue_t CoreController::initSdCardBlocking() {
|
ReturnValue_t CoreController::initSdCardBlocking() {
|
||||||
// Create update status file
|
// Create update status file
|
||||||
ReturnValue_t result = sdcMan->updateSdCardStateFile();
|
ReturnValue_t result = sdcMan->updateSdCardStateFile();
|
||||||
if (result != HasReturnvaluesIF::RETURN_OK) {
|
if (result != returnvalue::OK) {
|
||||||
sif::warning << "CoreController::initialize: Updating SD card state file failed" << std::endl;
|
sif::warning << "CoreController::initialize: Updating SD card state file failed" << std::endl;
|
||||||
}
|
}
|
||||||
#if Q7S_SD_CARD_CONFIG == Q7S_SD_NONE
|
#if Q7S_SD_CARD_CONFIG == Q7S_SD_NONE
|
||||||
sif::info << "No SD card initialization will be performed" << std::endl;
|
sif::info << "No SD card initialization will be performed" << std::endl;
|
||||||
return HasReturnvaluesIF::RETURN_OK;
|
return returnvalue::OK;
|
||||||
#else
|
#else
|
||||||
|
|
||||||
result = sdcMan->getSdCardsStatus(sdInfo.currentState);
|
result = sdcMan->getSdCardsStatus(sdInfo.currentState);
|
||||||
if (result != HasReturnvaluesIF::RETURN_OK) {
|
if (result != returnvalue::OK) {
|
||||||
sif::warning << "Getting SD card activity status failed" << std::endl;
|
sif::warning << "Getting SD card activity status failed" << std::endl;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -269,14 +269,14 @@ ReturnValue_t CoreController::initSdCardBlocking() {
|
|||||||
sdCardSetup(sd::SdCard::SLOT_1, sd::SdState::MOUNTED, "1", false);
|
sdCardSetup(sd::SdCard::SLOT_1, sd::SdState::MOUNTED, "1", false);
|
||||||
// Update status file
|
// Update status file
|
||||||
sdcMan->updateSdCardStateFile();
|
sdcMan->updateSdCardStateFile();
|
||||||
return HasReturnvaluesIF::RETURN_OK;
|
return returnvalue::OK;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#endif /* Q7S_SD_CARD_CONFIG != Q7S_SD_NONE */
|
#endif /* Q7S_SD_CARD_CONFIG != Q7S_SD_NONE */
|
||||||
}
|
}
|
||||||
|
|
||||||
ReturnValue_t CoreController::sdStateMachine() {
|
ReturnValue_t CoreController::sdStateMachine() {
|
||||||
ReturnValue_t result = HasReturnvaluesIF::RETURN_OK;
|
ReturnValue_t result = returnvalue::OK;
|
||||||
SdCardManager::Operations operation;
|
SdCardManager::Operations operation;
|
||||||
|
|
||||||
if (sdInfo.state == SdStates::IDLE) {
|
if (sdInfo.state == SdStates::IDLE) {
|
||||||
@ -324,7 +324,7 @@ ReturnValue_t CoreController::sdStateMachine() {
|
|||||||
if (not sdInfo.commandExecuted) {
|
if (not sdInfo.commandExecuted) {
|
||||||
// Create update status file
|
// Create update status file
|
||||||
result = sdcMan->updateSdCardStateFile();
|
result = sdcMan->updateSdCardStateFile();
|
||||||
if (result != HasReturnvaluesIF::RETURN_OK) {
|
if (result != returnvalue::OK) {
|
||||||
sif::warning << "CoreController::initialize: Updating SD card state file failed"
|
sif::warning << "CoreController::initialize: Updating SD card state file failed"
|
||||||
<< std::endl;
|
<< std::endl;
|
||||||
}
|
}
|
||||||
@ -343,7 +343,7 @@ ReturnValue_t CoreController::sdStateMachine() {
|
|||||||
sif::warning << "Preferred SD card invalid. Setting to card 0.." << std::endl;
|
sif::warning << "Preferred SD card invalid. Setting to card 0.." << std::endl;
|
||||||
sdInfo.pref = sd::SdCard::SLOT_0;
|
sdInfo.pref = sd::SdCard::SLOT_0;
|
||||||
}
|
}
|
||||||
if (result != HasReturnvaluesIF::RETURN_OK) {
|
if (result != returnvalue::OK) {
|
||||||
sif::warning << "Getting SD card activity status failed" << std::endl;
|
sif::warning << "Getting SD card activity status failed" << std::endl;
|
||||||
}
|
}
|
||||||
#if Q7S_SD_CARD_CONFIG == Q7S_SD_COLD_REDUNDANT
|
#if Q7S_SD_CARD_CONFIG == Q7S_SD_COLD_REDUNDANT
|
||||||
@ -473,7 +473,7 @@ ReturnValue_t CoreController::sdStateMachine() {
|
|||||||
sdcMan->setBlocking(true);
|
sdcMan->setBlocking(true);
|
||||||
// Update status file
|
// Update status file
|
||||||
result = sdcMan->updateSdCardStateFile();
|
result = sdcMan->updateSdCardStateFile();
|
||||||
if (result != HasReturnvaluesIF::RETURN_OK) {
|
if (result != returnvalue::OK) {
|
||||||
sif::warning << "CoreController::initialize: Updating SD card state file failed" << std::endl;
|
sif::warning << "CoreController::initialize: Updating SD card state file failed" << std::endl;
|
||||||
}
|
}
|
||||||
sdInfo.commandExecuted = false;
|
sdInfo.commandExecuted = false;
|
||||||
@ -497,7 +497,7 @@ ReturnValue_t CoreController::sdStateMachine() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
sdInfo.cycleCount++;
|
sdInfo.cycleCount++;
|
||||||
return HasReturnvaluesIF::RETURN_OK;
|
return returnvalue::OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
void CoreController::executeNextExternalSdCommand() {
|
void CoreController::executeNextExternalSdCommand() {
|
||||||
@ -628,28 +628,28 @@ ReturnValue_t CoreController::sdCardSetup(sd::SdCard sdCard, sd::SdState targetS
|
|||||||
} else {
|
} else {
|
||||||
sif::warning << "CoreController::sdCardSetup: Invalid state for this call" << std::endl;
|
sif::warning << "CoreController::sdCardSetup: Invalid state for this call" << std::endl;
|
||||||
}
|
}
|
||||||
return HasReturnvaluesIF::RETURN_OK;
|
return returnvalue::OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
ReturnValue_t CoreController::sdColdRedundantBlockingInit() {
|
ReturnValue_t CoreController::sdColdRedundantBlockingInit() {
|
||||||
ReturnValue_t result = HasReturnvaluesIF::RETURN_OK;
|
ReturnValue_t result = returnvalue::OK;
|
||||||
|
|
||||||
result = sdCardSetup(sdInfo.pref, sd::SdState::MOUNTED, sdInfo.prefChar);
|
result = sdCardSetup(sdInfo.pref, sd::SdState::MOUNTED, sdInfo.prefChar);
|
||||||
if (result != SdCardManager::ALREADY_MOUNTED and result != HasReturnvaluesIF::RETURN_OK) {
|
if (result != SdCardManager::ALREADY_MOUNTED and result != returnvalue::OK) {
|
||||||
sif::warning << "Setting up preferred card " << sdInfo.otherChar
|
sif::warning << "Setting up preferred card " << sdInfo.otherChar
|
||||||
<< " in cold redundant mode failed" << std::endl;
|
<< " in cold redundant mode failed" << std::endl;
|
||||||
// Try other SD card and mark set up operation as failed
|
// Try other SD card and mark set up operation as failed
|
||||||
sdCardSetup(sdInfo.pref, sd::SdState::MOUNTED, sdInfo.prefChar);
|
sdCardSetup(sdInfo.pref, sd::SdState::MOUNTED, sdInfo.prefChar);
|
||||||
result = HasReturnvaluesIF::RETURN_FAILED;
|
result = returnvalue::FAILED;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (result != HasReturnvaluesIF::RETURN_FAILED and sdInfo.otherState != sd::SdState::OFF) {
|
if (result != returnvalue::FAILED and sdInfo.otherState != sd::SdState::OFF) {
|
||||||
sif::info << "Switching off secondary SD card " << sdInfo.otherChar << std::endl;
|
sif::info << "Switching off secondary SD card " << sdInfo.otherChar << std::endl;
|
||||||
// Switch off other SD card in cold redundant mode if setting up preferred one worked
|
// Switch off other SD card in cold redundant mode if setting up preferred one worked
|
||||||
// without issues
|
// without issues
|
||||||
ReturnValue_t result2 =
|
ReturnValue_t result2 =
|
||||||
sdcMan->switchOffSdCard(sdInfo.other, sdInfo.otherState, &sdInfo.currentState);
|
sdcMan->switchOffSdCard(sdInfo.other, sdInfo.otherState, &sdInfo.currentState);
|
||||||
if (result2 != HasReturnvaluesIF::RETURN_OK and result2 != SdCardManager::ALREADY_OFF) {
|
if (result2 != returnvalue::OK and result2 != SdCardManager::ALREADY_OFF) {
|
||||||
sif::warning << "Switching off secondary SD card " << sdInfo.otherChar
|
sif::warning << "Switching off secondary SD card " << sdInfo.otherChar
|
||||||
<< " in cold redundant mode failed" << std::endl;
|
<< " in cold redundant mode failed" << std::endl;
|
||||||
}
|
}
|
||||||
@ -660,7 +660,7 @@ ReturnValue_t CoreController::sdColdRedundantBlockingInit() {
|
|||||||
ReturnValue_t CoreController::incrementAllocationFailureCount() {
|
ReturnValue_t CoreController::incrementAllocationFailureCount() {
|
||||||
uint32_t count = 0;
|
uint32_t count = 0;
|
||||||
ReturnValue_t result = scratch::readNumber(scratch::ALLOC_FAILURE_COUNT, count);
|
ReturnValue_t result = scratch::readNumber(scratch::ALLOC_FAILURE_COUNT, count);
|
||||||
if (result != HasReturnvaluesIF::RETURN_OK) {
|
if (result != returnvalue::OK) {
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
count++;
|
count++;
|
||||||
@ -698,7 +698,7 @@ ReturnValue_t CoreController::initVersionFile() {
|
|||||||
versionFile << fullObswVersionString << std::endl;
|
versionFile << fullObswVersionString << std::endl;
|
||||||
versionFile << fullFsfwVersionString << std::endl;
|
versionFile << fullFsfwVersionString << std::endl;
|
||||||
versionFile << systemString << std::endl;
|
versionFile << systemString << std::endl;
|
||||||
return HasReturnvaluesIF::RETURN_OK;
|
return returnvalue::OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Check whether any version has changed
|
// Check whether any version has changed
|
||||||
@ -745,7 +745,7 @@ ReturnValue_t CoreController::initVersionFile() {
|
|||||||
versionFile << systemString << std::endl;
|
versionFile << systemString << std::endl;
|
||||||
}
|
}
|
||||||
|
|
||||||
return HasReturnvaluesIF::RETURN_OK;
|
return returnvalue::OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
ReturnValue_t CoreController::actionListDirectoryIntoFile(ActionId_t actionId,
|
ReturnValue_t CoreController::actionListDirectoryIntoFile(ActionId_t actionId,
|
||||||
@ -800,7 +800,7 @@ ReturnValue_t CoreController::actionListDirectoryIntoFile(ActionId_t actionId,
|
|||||||
utility::handleSystemError(result, "CoreController::actionListDirectoryIntoFile");
|
utility::handleSystemError(result, "CoreController::actionListDirectoryIntoFile");
|
||||||
actionHelper.finish(false, commandedBy, actionId);
|
actionHelper.finish(false, commandedBy, actionId);
|
||||||
}
|
}
|
||||||
return HasReturnvaluesIF::RETURN_OK;
|
return returnvalue::OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
ReturnValue_t CoreController::initBootCopy() {
|
ReturnValue_t CoreController::initBootCopy() {
|
||||||
@ -815,7 +815,7 @@ ReturnValue_t CoreController::initBootCopy() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
getCurrentBootCopy(CURRENT_CHIP, CURRENT_COPY);
|
getCurrentBootCopy(CURRENT_CHIP, CURRENT_COPY);
|
||||||
return HasReturnvaluesIF::RETURN_OK;
|
return returnvalue::OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
void CoreController::getCurrentBootCopy(xsc::Chip &chip, xsc::Copy ©) {
|
void CoreController::getCurrentBootCopy(xsc::Chip &chip, xsc::Copy ©) {
|
||||||
@ -829,10 +829,10 @@ void CoreController::getCurrentBootCopy(xsc::Chip &chip, xsc::Copy ©) {
|
|||||||
|
|
||||||
ReturnValue_t CoreController::initWatchdogFifo() {
|
ReturnValue_t CoreController::initWatchdogFifo() {
|
||||||
if (not std::filesystem::exists(watchdog::FIFO_NAME)) {
|
if (not std::filesystem::exists(watchdog::FIFO_NAME)) {
|
||||||
// Still return RETURN_OK for now
|
// Still return returnvalue::OK for now
|
||||||
sif::info << "Watchdog FIFO " << watchdog::FIFO_NAME << " does not exist, can't initiate"
|
sif::info << "Watchdog FIFO " << watchdog::FIFO_NAME << " does not exist, can't initiate"
|
||||||
<< " watchdog" << std::endl;
|
<< " watchdog" << std::endl;
|
||||||
return HasReturnvaluesIF::RETURN_OK;
|
return returnvalue::OK;
|
||||||
}
|
}
|
||||||
// Open FIFO write only and non-blocking to prevent SW from killing itself.
|
// Open FIFO write only and non-blocking to prevent SW from killing itself.
|
||||||
watchdogFifoFd = open(watchdog::FIFO_NAME.c_str(), O_WRONLY | O_NONBLOCK);
|
watchdogFifoFd = open(watchdog::FIFO_NAME.c_str(), O_WRONLY | O_NONBLOCK);
|
||||||
@ -843,10 +843,10 @@ ReturnValue_t CoreController::initWatchdogFifo() {
|
|||||||
} else {
|
} else {
|
||||||
sif::error << "Opening pipe " << watchdog::FIFO_NAME << " write-only failed with " << errno
|
sif::error << "Opening pipe " << watchdog::FIFO_NAME << " write-only failed with " << errno
|
||||||
<< ": " << strerror(errno) << std::endl;
|
<< ": " << strerror(errno) << std::endl;
|
||||||
return HasReturnvaluesIF::RETURN_FAILED;
|
return returnvalue::FAILED;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return HasReturnvaluesIF::RETURN_OK;
|
return returnvalue::OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
void CoreController::initPrint() {
|
void CoreController::initPrint() {
|
||||||
@ -872,7 +872,7 @@ ReturnValue_t CoreController::actionXscReboot(const uint8_t *data, size_t size)
|
|||||||
int result = std::system("xsc_boot_copy -r");
|
int result = std::system("xsc_boot_copy -r");
|
||||||
if (result != 0) {
|
if (result != 0) {
|
||||||
utility::handleSystemError(result, "CoreController::executeAction");
|
utility::handleSystemError(result, "CoreController::executeAction");
|
||||||
return HasReturnvaluesIF::RETURN_FAILED;
|
return returnvalue::FAILED;
|
||||||
}
|
}
|
||||||
return HasActionsIF::EXECUTION_FINISHED;
|
return HasActionsIF::EXECUTION_FINISHED;
|
||||||
}
|
}
|
||||||
@ -929,14 +929,14 @@ ReturnValue_t CoreController::actionXscReboot(const uint8_t *data, size_t size)
|
|||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
return HasReturnvaluesIF::RETURN_FAILED;
|
return returnvalue::FAILED;
|
||||||
}
|
}
|
||||||
|
|
||||||
ReturnValue_t CoreController::actionReboot(const uint8_t *data, size_t size) {
|
ReturnValue_t CoreController::actionReboot(const uint8_t *data, size_t size) {
|
||||||
bool protOpPerformed = false;
|
bool protOpPerformed = false;
|
||||||
gracefulShutdownTasks(xsc::Chip::CHIP_0, xsc::Copy::COPY_0, protOpPerformed);
|
gracefulShutdownTasks(xsc::Chip::CHIP_0, xsc::Copy::COPY_0, protOpPerformed);
|
||||||
std::system("reboot");
|
std::system("reboot");
|
||||||
return RETURN_OK;
|
return returnvalue::OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
ReturnValue_t CoreController::gracefulShutdownTasks(xsc::Chip chip, xsc::Copy copy,
|
ReturnValue_t CoreController::gracefulShutdownTasks(xsc::Chip chip, xsc::Copy copy,
|
||||||
@ -948,7 +948,7 @@ ReturnValue_t CoreController::gracefulShutdownTasks(xsc::Chip chip, xsc::Copy co
|
|||||||
// If any boot copies are unprotected
|
// If any boot copies are unprotected
|
||||||
ReturnValue_t result = setBootCopyProtection(xsc::Chip::SELF_CHIP, xsc::Copy::SELF_COPY, true,
|
ReturnValue_t result = setBootCopyProtection(xsc::Chip::SELF_CHIP, xsc::Copy::SELF_COPY, true,
|
||||||
protOpPerformed, false);
|
protOpPerformed, false);
|
||||||
if (result == HasReturnvaluesIF::RETURN_OK and protOpPerformed) {
|
if (result == returnvalue::OK and protOpPerformed) {
|
||||||
// TODO: Would be nice to notify operator. But we can't use the filesystem anymore
|
// TODO: Would be nice to notify operator. But we can't use the filesystem anymore
|
||||||
// and a reboot is imminent. Use scratch buffer?
|
// and a reboot is imminent. Use scratch buffer?
|
||||||
sif::info << "Running slot was writeprotected before reboot" << std::endl;
|
sif::info << "Running slot was writeprotected before reboot" << std::endl;
|
||||||
@ -983,9 +983,9 @@ ReturnValue_t CoreController::generateChipStateFile() {
|
|||||||
int result = std::system(CHIP_PROT_SCRIPT);
|
int result = std::system(CHIP_PROT_SCRIPT);
|
||||||
if (result != 0) {
|
if (result != 0) {
|
||||||
utility::handleSystemError(result, "CoreController::generateChipStateFile");
|
utility::handleSystemError(result, "CoreController::generateChipStateFile");
|
||||||
return HasReturnvaluesIF::RETURN_FAILED;
|
return returnvalue::FAILED;
|
||||||
}
|
}
|
||||||
return HasReturnvaluesIF::RETURN_OK;
|
return returnvalue::OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
ReturnValue_t CoreController::setBootCopyProtection(xsc::Chip targetChip, xsc::Copy targetCopy,
|
ReturnValue_t CoreController::setBootCopyProtection(xsc::Chip targetChip, xsc::Copy targetCopy,
|
||||||
@ -1003,7 +1003,7 @@ ReturnValue_t CoreController::setBootCopyProtection(xsc::Chip targetChip, xsc::C
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case (xsc::Chip::NO_CHIP): {
|
case (xsc::Chip::NO_CHIP): {
|
||||||
return HasReturnvaluesIF::RETURN_OK;
|
return returnvalue::OK;
|
||||||
}
|
}
|
||||||
case (xsc::Chip::SELF_CHIP): {
|
case (xsc::Chip::SELF_CHIP): {
|
||||||
selfChip = true;
|
selfChip = true;
|
||||||
@ -1020,7 +1020,7 @@ ReturnValue_t CoreController::setBootCopyProtection(xsc::Chip targetChip, xsc::C
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case (xsc::Copy::NO_COPY): {
|
case (xsc::Copy::NO_COPY): {
|
||||||
return HasReturnvaluesIF::RETURN_OK;
|
return returnvalue::OK;
|
||||||
}
|
}
|
||||||
case (xsc::Copy::SELF_COPY): {
|
case (xsc::Copy::SELF_COPY): {
|
||||||
selfCopy = true;
|
selfCopy = true;
|
||||||
@ -1042,7 +1042,7 @@ ReturnValue_t CoreController::setBootCopyProtection(xsc::Chip targetChip, xsc::C
|
|||||||
if (protOperationPerformed and updateProtFile) {
|
if (protOperationPerformed and updateProtFile) {
|
||||||
updateProtInfo();
|
updateProtInfo();
|
||||||
}
|
}
|
||||||
return HasReturnvaluesIF::RETURN_OK;
|
return returnvalue::OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
int CoreController::handleBootCopyProtAtIndex(xsc::Chip targetChip, xsc::Copy targetCopy,
|
int CoreController::handleBootCopyProtAtIndex(xsc::Chip targetChip, xsc::Copy targetCopy,
|
||||||
@ -1130,28 +1130,28 @@ int CoreController::handleBootCopyProtAtIndex(xsc::Chip targetChip, xsc::Copy ta
|
|||||||
|
|
||||||
ReturnValue_t CoreController::updateProtInfo(bool regenerateChipStateFile) {
|
ReturnValue_t CoreController::updateProtInfo(bool regenerateChipStateFile) {
|
||||||
using namespace std;
|
using namespace std;
|
||||||
ReturnValue_t result = HasReturnvaluesIF::RETURN_OK;
|
ReturnValue_t result = returnvalue::OK;
|
||||||
if (regenerateChipStateFile) {
|
if (regenerateChipStateFile) {
|
||||||
result = generateChipStateFile();
|
result = generateChipStateFile();
|
||||||
if (result != HasReturnvaluesIF::RETURN_OK) {
|
if (result != returnvalue::OK) {
|
||||||
sif::warning << "CoreController::updateProtInfo: Generating chip state file failed"
|
sif::warning << "CoreController::updateProtInfo: Generating chip state file failed"
|
||||||
<< std::endl;
|
<< std::endl;
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (not filesystem::exists(CHIP_STATE_FILE)) {
|
if (not filesystem::exists(CHIP_STATE_FILE)) {
|
||||||
return HasReturnvaluesIF::RETURN_FAILED;
|
return returnvalue::FAILED;
|
||||||
}
|
}
|
||||||
ifstream chipStateFile(CHIP_STATE_FILE);
|
ifstream chipStateFile(CHIP_STATE_FILE);
|
||||||
if (not chipStateFile.good()) {
|
if (not chipStateFile.good()) {
|
||||||
return HasReturnvaluesIF::RETURN_FAILED;
|
return returnvalue::FAILED;
|
||||||
}
|
}
|
||||||
string nextLine;
|
string nextLine;
|
||||||
uint8_t lineCounter = 0;
|
uint8_t lineCounter = 0;
|
||||||
string word;
|
string word;
|
||||||
while (getline(chipStateFile, nextLine)) {
|
while (getline(chipStateFile, nextLine)) {
|
||||||
ReturnValue_t result = handleProtInfoUpdateLine(nextLine);
|
ReturnValue_t result = handleProtInfoUpdateLine(nextLine);
|
||||||
if (result != HasReturnvaluesIF::RETURN_OK) {
|
if (result != returnvalue::OK) {
|
||||||
sif::warning << "CoreController::updateProtInfo: Protection info update failed!" << std::endl;
|
sif::warning << "CoreController::updateProtInfo: Protection info update failed!" << std::endl;
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
@ -1162,7 +1162,7 @@ ReturnValue_t CoreController::updateProtInfo(bool regenerateChipStateFile) {
|
|||||||
<< std::endl;
|
<< std::endl;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return HasReturnvaluesIF::RETURN_OK;
|
return returnvalue::OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
ReturnValue_t CoreController::handleProtInfoUpdateLine(std::string nextLine) {
|
ReturnValue_t CoreController::handleProtInfoUpdateLine(std::string nextLine) {
|
||||||
@ -1207,7 +1207,7 @@ ReturnValue_t CoreController::handleProtInfoUpdateLine(std::string nextLine) {
|
|||||||
}
|
}
|
||||||
wordIdx++;
|
wordIdx++;
|
||||||
}
|
}
|
||||||
return HasReturnvaluesIF::RETURN_OK;
|
return returnvalue::OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
void CoreController::performWatchdogControlOperation() {
|
void CoreController::performWatchdogControlOperation() {
|
||||||
@ -1274,7 +1274,7 @@ ReturnValue_t CoreController::performSdCardCheck() {
|
|||||||
sdcMan->getSdCardsStatus(active);
|
sdcMan->getSdCardsStatus(active);
|
||||||
auto sdCardCheck = [&](sd::SdCard sdCard) {
|
auto sdCardCheck = [&](sd::SdCard sdCard) {
|
||||||
ReturnValue_t result = sdcMan->isSdCardMountedReadOnly(sdCard, mountedReadOnly);
|
ReturnValue_t result = sdcMan->isSdCardMountedReadOnly(sdCard, mountedReadOnly);
|
||||||
if (result != HasReturnvaluesIF::RETURN_OK) {
|
if (result != returnvalue::OK) {
|
||||||
sif::error << "CoreController::performSdCardCheck: Could not check "
|
sif::error << "CoreController::performSdCardCheck: Could not check "
|
||||||
"read-only mount state"
|
"read-only mount state"
|
||||||
<< std::endl;
|
<< std::endl;
|
||||||
@ -1283,13 +1283,13 @@ ReturnValue_t CoreController::performSdCardCheck() {
|
|||||||
if (mountedReadOnly) {
|
if (mountedReadOnly) {
|
||||||
int linuxErrno = 0;
|
int linuxErrno = 0;
|
||||||
result = sdcMan->performFsck(sdCard, true, linuxErrno);
|
result = sdcMan->performFsck(sdCard, true, linuxErrno);
|
||||||
if (result != HasReturnvaluesIF::RETURN_OK) {
|
if (result != returnvalue::OK) {
|
||||||
sif::error << "CoreController::performSdCardCheck: fsck command on SD Card "
|
sif::error << "CoreController::performSdCardCheck: fsck command on SD Card "
|
||||||
<< static_cast<uint8_t>(sdCard) << " failed with code " << linuxErrno << " | "
|
<< static_cast<uint8_t>(sdCard) << " failed with code " << linuxErrno << " | "
|
||||||
<< strerror(linuxErrno);
|
<< strerror(linuxErrno);
|
||||||
}
|
}
|
||||||
result = sdcMan->remountReadWrite(sdCard);
|
result = sdcMan->remountReadWrite(sdCard);
|
||||||
if (result == HasReturnvaluesIF::RETURN_OK) {
|
if (result == returnvalue::OK) {
|
||||||
sif::warning << "CoreController::performSdCardCheck: Remounted SD Card "
|
sif::warning << "CoreController::performSdCardCheck: Remounted SD Card "
|
||||||
<< static_cast<uint8_t>(sdCard) << " read-write";
|
<< static_cast<uint8_t>(sdCard) << " read-write";
|
||||||
} else {
|
} else {
|
||||||
@ -1305,7 +1305,7 @@ ReturnValue_t CoreController::performSdCardCheck() {
|
|||||||
sdCardCheck(sd::SdCard::SLOT_1);
|
sdCardCheck(sd::SdCard::SLOT_1);
|
||||||
}
|
}
|
||||||
|
|
||||||
return RETURN_OK;
|
return returnvalue::OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
void CoreController::performRebootFileHandling(bool recreateFile) {
|
void CoreController::performRebootFileHandling(bool recreateFile) {
|
||||||
@ -1759,7 +1759,7 @@ ReturnValue_t CoreController::timeFileHandler() {
|
|||||||
// It is assumed that the system time is set from the GPS time
|
// It is assumed that the system time is set from the GPS time
|
||||||
timeval currentTime = {};
|
timeval currentTime = {};
|
||||||
ReturnValue_t result = Clock::getClock_timeval(¤tTime);
|
ReturnValue_t result = Clock::getClock_timeval(¤tTime);
|
||||||
if (result != HasReturnvaluesIF::RETURN_OK) {
|
if (result != returnvalue::OK) {
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
std::string fileName = currMntPrefix + TIME_FILE;
|
std::string fileName = currMntPrefix + TIME_FILE;
|
||||||
@ -1767,11 +1767,11 @@ ReturnValue_t CoreController::timeFileHandler() {
|
|||||||
if (not timeFile.good()) {
|
if (not timeFile.good()) {
|
||||||
sif::error << "CoreController::timeFileHandler: Error opening time file: " << strerror(errno)
|
sif::error << "CoreController::timeFileHandler: Error opening time file: " << strerror(errno)
|
||||||
<< std::endl;
|
<< std::endl;
|
||||||
return RETURN_FAILED;
|
return returnvalue::FAILED;
|
||||||
}
|
}
|
||||||
timeFile << "UNIX SECONDS: " << currentTime.tv_sec << std::endl;
|
timeFile << "UNIX SECONDS: " << currentTime.tv_sec << std::endl;
|
||||||
}
|
}
|
||||||
return RETURN_OK;
|
return returnvalue::OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
ReturnValue_t CoreController::initClockFromTimeFile() {
|
ReturnValue_t CoreController::initClockFromTimeFile() {
|
||||||
@ -1787,18 +1787,18 @@ ReturnValue_t CoreController::initClockFromTimeFile() {
|
|||||||
istringstream iss(nextWord);
|
istringstream iss(nextWord);
|
||||||
iss >> nextWord;
|
iss >> nextWord;
|
||||||
if (iss.bad() or nextWord != "UNIX") {
|
if (iss.bad() or nextWord != "UNIX") {
|
||||||
return RETURN_FAILED;
|
return returnvalue::FAILED;
|
||||||
}
|
}
|
||||||
iss >> nextWord;
|
iss >> nextWord;
|
||||||
if (iss.bad() or nextWord != "SECONDS:") {
|
if (iss.bad() or nextWord != "SECONDS:") {
|
||||||
return RETURN_FAILED;
|
return returnvalue::FAILED;
|
||||||
}
|
}
|
||||||
iss >> nextWord;
|
iss >> nextWord;
|
||||||
timeval currentTime = {};
|
timeval currentTime = {};
|
||||||
char *checkPtr;
|
char *checkPtr;
|
||||||
currentTime.tv_sec = strtol(nextWord.c_str(), &checkPtr, 10);
|
currentTime.tv_sec = strtol(nextWord.c_str(), &checkPtr, 10);
|
||||||
if (iss.bad() or *checkPtr) {
|
if (iss.bad() or *checkPtr) {
|
||||||
return RETURN_FAILED;
|
return returnvalue::FAILED;
|
||||||
}
|
}
|
||||||
#if OBSW_VERBOSE_LEVEL >= 1
|
#if OBSW_VERBOSE_LEVEL >= 1
|
||||||
time_t timeRaw = currentTime.tv_sec;
|
time_t timeRaw = currentTime.tv_sec;
|
||||||
@ -1808,30 +1808,30 @@ ReturnValue_t CoreController::initClockFromTimeFile() {
|
|||||||
#endif
|
#endif
|
||||||
return Clock::setClock(¤tTime);
|
return Clock::setClock(¤tTime);
|
||||||
}
|
}
|
||||||
return RETURN_OK;
|
return returnvalue::OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
void CoreController::readHkData() {
|
void CoreController::readHkData() {
|
||||||
ReturnValue_t result = RETURN_OK;
|
ReturnValue_t result = returnvalue::OK;
|
||||||
result = hkSet.read(TIMEOUT_TYPE, MUTEX_TIMEOUT);
|
result = hkSet.read(TIMEOUT_TYPE, MUTEX_TIMEOUT);
|
||||||
if (result != RETURN_OK) {
|
if (result != returnvalue::OK) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
Xadc xadc;
|
Xadc xadc;
|
||||||
result = xadc.getTemperature(hkSet.temperature.value);
|
result = xadc.getTemperature(hkSet.temperature.value);
|
||||||
if (result != RETURN_OK) {
|
if (result != returnvalue::OK) {
|
||||||
hkSet.temperature.setValid(false);
|
hkSet.temperature.setValid(false);
|
||||||
} else {
|
} else {
|
||||||
hkSet.temperature.setValid(true);
|
hkSet.temperature.setValid(true);
|
||||||
}
|
}
|
||||||
result = xadc.getVccPint(hkSet.psVoltage.value);
|
result = xadc.getVccPint(hkSet.psVoltage.value);
|
||||||
if (result != RETURN_OK) {
|
if (result != returnvalue::OK) {
|
||||||
hkSet.psVoltage.setValid(false);
|
hkSet.psVoltage.setValid(false);
|
||||||
} else {
|
} else {
|
||||||
hkSet.psVoltage.setValid(true);
|
hkSet.psVoltage.setValid(true);
|
||||||
}
|
}
|
||||||
result = xadc.getVccInt(hkSet.plVoltage.value);
|
result = xadc.getVccInt(hkSet.plVoltage.value);
|
||||||
if (result != RETURN_OK) {
|
if (result != returnvalue::OK) {
|
||||||
hkSet.plVoltage.setValid(false);
|
hkSet.plVoltage.setValid(false);
|
||||||
} else {
|
} else {
|
||||||
hkSet.plVoltage.setValid(true);
|
hkSet.plVoltage.setValid(true);
|
||||||
@ -1840,7 +1840,7 @@ void CoreController::readHkData() {
|
|||||||
hkSet.printSet();
|
hkSet.printSet();
|
||||||
#endif /* OBSW_PRINT_CORE_HK == 1 */
|
#endif /* OBSW_PRINT_CORE_HK == 1 */
|
||||||
result = hkSet.commit(TIMEOUT_TYPE, MUTEX_TIMEOUT);
|
result = hkSet.commit(TIMEOUT_TYPE, MUTEX_TIMEOUT);
|
||||||
if (result != RETURN_OK) {
|
if (result != returnvalue::OK) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -10,7 +10,7 @@
|
|||||||
#include "fsfw/objectmanager/ObjectManager.h"
|
#include "fsfw/objectmanager/ObjectManager.h"
|
||||||
#include "fsfw/objectmanager/ObjectManagerIF.h"
|
#include "fsfw/objectmanager/ObjectManagerIF.h"
|
||||||
#include "fsfw/platform.h"
|
#include "fsfw/platform.h"
|
||||||
#include "fsfw/returnvalues/HasReturnvaluesIF.h"
|
#include "fsfw/returnvalues/returnvalue.h"
|
||||||
#include "fsfw/serviceinterface/ServiceInterfaceStream.h"
|
#include "fsfw/serviceinterface/ServiceInterfaceStream.h"
|
||||||
#include "fsfw/tasks/FixedTimeslotTaskIF.h"
|
#include "fsfw/tasks/FixedTimeslotTaskIF.h"
|
||||||
#include "fsfw/tasks/PeriodicTaskIF.h"
|
#include "fsfw/tasks/PeriodicTaskIF.h"
|
||||||
@ -55,7 +55,7 @@ void initmission::initMission() {
|
|||||||
|
|
||||||
void initmission::initTasks() {
|
void initmission::initTasks() {
|
||||||
TaskFactory* factory = TaskFactory::instance();
|
TaskFactory* factory = TaskFactory::instance();
|
||||||
ReturnValue_t result = HasReturnvaluesIF::RETURN_OK;
|
ReturnValue_t result = returnvalue::OK;
|
||||||
if (factory == nullptr) {
|
if (factory == nullptr) {
|
||||||
/* Should never happen ! */
|
/* Should never happen ! */
|
||||||
return;
|
return;
|
||||||
@ -69,7 +69,7 @@ void initmission::initTasks() {
|
|||||||
PeriodicTaskIF* coreController = factory->createPeriodicTask(
|
PeriodicTaskIF* coreController = factory->createPeriodicTask(
|
||||||
"CORE_CTRL", 60, PeriodicTaskIF::MINIMUM_STACK_SIZE, 0.4, missedDeadlineFunc);
|
"CORE_CTRL", 60, PeriodicTaskIF::MINIMUM_STACK_SIZE, 0.4, missedDeadlineFunc);
|
||||||
result = coreController->addComponent(objects::CORE_CONTROLLER);
|
result = coreController->addComponent(objects::CORE_CONTROLLER);
|
||||||
if (result != HasReturnvaluesIF::RETURN_OK) {
|
if (result != returnvalue::OK) {
|
||||||
initmission::printAddObjectError("CORE_CTRL", objects::CORE_CONTROLLER);
|
initmission::printAddObjectError("CORE_CTRL", objects::CORE_CONTROLLER);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -77,15 +77,15 @@ void initmission::initTasks() {
|
|||||||
PeriodicTaskIF* tmTcDistributor = factory->createPeriodicTask(
|
PeriodicTaskIF* tmTcDistributor = factory->createPeriodicTask(
|
||||||
"DIST", 40, PeriodicTaskIF::MINIMUM_STACK_SIZE, 0.2, missedDeadlineFunc);
|
"DIST", 40, PeriodicTaskIF::MINIMUM_STACK_SIZE, 0.2, missedDeadlineFunc);
|
||||||
result = tmTcDistributor->addComponent(objects::CCSDS_PACKET_DISTRIBUTOR);
|
result = tmTcDistributor->addComponent(objects::CCSDS_PACKET_DISTRIBUTOR);
|
||||||
if (result != HasReturnvaluesIF::RETURN_OK) {
|
if (result != returnvalue::OK) {
|
||||||
initmission::printAddObjectError("CCSDS_DISTRIB", objects::CCSDS_PACKET_DISTRIBUTOR);
|
initmission::printAddObjectError("CCSDS_DISTRIB", objects::CCSDS_PACKET_DISTRIBUTOR);
|
||||||
}
|
}
|
||||||
result = tmTcDistributor->addComponent(objects::PUS_PACKET_DISTRIBUTOR);
|
result = tmTcDistributor->addComponent(objects::PUS_PACKET_DISTRIBUTOR);
|
||||||
if (result != HasReturnvaluesIF::RETURN_OK) {
|
if (result != returnvalue::OK) {
|
||||||
initmission::printAddObjectError("PUS_PACKET_DISTRIB", objects::PUS_PACKET_DISTRIBUTOR);
|
initmission::printAddObjectError("PUS_PACKET_DISTRIB", objects::PUS_PACKET_DISTRIBUTOR);
|
||||||
}
|
}
|
||||||
result = tmTcDistributor->addComponent(objects::TM_FUNNEL);
|
result = tmTcDistributor->addComponent(objects::TM_FUNNEL);
|
||||||
if (result != HasReturnvaluesIF::RETURN_OK) {
|
if (result != returnvalue::OK) {
|
||||||
initmission::printAddObjectError("TM_FUNNEL", objects::TM_FUNNEL);
|
initmission::printAddObjectError("TM_FUNNEL", objects::TM_FUNNEL);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -94,13 +94,13 @@ void initmission::initTasks() {
|
|||||||
PeriodicTaskIF* tmtcBridgeTask = factory->createPeriodicTask(
|
PeriodicTaskIF* tmtcBridgeTask = factory->createPeriodicTask(
|
||||||
"TCPIP_TMTC_BRIDGE", 50, PeriodicTaskIF::MINIMUM_STACK_SIZE, 0.2, missedDeadlineFunc);
|
"TCPIP_TMTC_BRIDGE", 50, PeriodicTaskIF::MINIMUM_STACK_SIZE, 0.2, missedDeadlineFunc);
|
||||||
result = tmtcBridgeTask->addComponent(objects::TMTC_BRIDGE);
|
result = tmtcBridgeTask->addComponent(objects::TMTC_BRIDGE);
|
||||||
if (result != HasReturnvaluesIF::RETURN_OK) {
|
if (result != returnvalue::OK) {
|
||||||
initmission::printAddObjectError("TMTC_BRIDGE", objects::TMTC_BRIDGE);
|
initmission::printAddObjectError("TMTC_BRIDGE", objects::TMTC_BRIDGE);
|
||||||
}
|
}
|
||||||
PeriodicTaskIF* tmtcPollingTask = factory->createPeriodicTask(
|
PeriodicTaskIF* tmtcPollingTask = factory->createPeriodicTask(
|
||||||
"TMTC_POLLING", 80, PeriodicTaskIF::MINIMUM_STACK_SIZE, 2.0, missedDeadlineFunc);
|
"TMTC_POLLING", 80, PeriodicTaskIF::MINIMUM_STACK_SIZE, 2.0, missedDeadlineFunc);
|
||||||
result = tmtcPollingTask->addComponent(objects::TMTC_POLLING_TASK);
|
result = tmtcPollingTask->addComponent(objects::TMTC_POLLING_TASK);
|
||||||
if (result != HasReturnvaluesIF::RETURN_OK) {
|
if (result != returnvalue::OK) {
|
||||||
initmission::printAddObjectError("UDP_POLLING", objects::TMTC_POLLING_TASK);
|
initmission::printAddObjectError("UDP_POLLING", objects::TMTC_POLLING_TASK);
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
@ -109,7 +109,7 @@ void initmission::initTasks() {
|
|||||||
PeriodicTaskIF* ccsdsHandlerTask = factory->createPeriodicTask(
|
PeriodicTaskIF* ccsdsHandlerTask = factory->createPeriodicTask(
|
||||||
"CCSDS_HANDLER", 50, PeriodicTaskIF::MINIMUM_STACK_SIZE, 2.0, missedDeadlineFunc);
|
"CCSDS_HANDLER", 50, PeriodicTaskIF::MINIMUM_STACK_SIZE, 2.0, missedDeadlineFunc);
|
||||||
result = ccsdsHandlerTask->addComponent(objects::CCSDS_HANDLER);
|
result = ccsdsHandlerTask->addComponent(objects::CCSDS_HANDLER);
|
||||||
if (result != HasReturnvaluesIF::RETURN_OK) {
|
if (result != returnvalue::OK) {
|
||||||
initmission::printAddObjectError("CCSDS Handler", objects::CCSDS_HANDLER);
|
initmission::printAddObjectError("CCSDS Handler", objects::CCSDS_HANDLER);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -119,7 +119,7 @@ void initmission::initTasks() {
|
|||||||
PeriodicTaskIF* pdecHandlerTask = factory->createPeriodicTask(
|
PeriodicTaskIF* pdecHandlerTask = factory->createPeriodicTask(
|
||||||
"PDEC_HANDLER", 50, PeriodicTaskIF::MINIMUM_STACK_SIZE, 1.0, missedDeadlineFunc);
|
"PDEC_HANDLER", 50, PeriodicTaskIF::MINIMUM_STACK_SIZE, 1.0, missedDeadlineFunc);
|
||||||
result = pdecHandlerTask->addComponent(objects::PDEC_HANDLER);
|
result = pdecHandlerTask->addComponent(objects::PDEC_HANDLER);
|
||||||
if (result != HasReturnvaluesIF::RETURN_OK) {
|
if (result != returnvalue::OK) {
|
||||||
initmission::printAddObjectError("PDEC Handler", objects::PDEC_HANDLER);
|
initmission::printAddObjectError("PDEC Handler", objects::PDEC_HANDLER);
|
||||||
}
|
}
|
||||||
#endif /* OBSW_USE_CCSDS_IP_CORE == 1 */
|
#endif /* OBSW_USE_CCSDS_IP_CORE == 1 */
|
||||||
@ -128,13 +128,13 @@ void initmission::initTasks() {
|
|||||||
PeriodicTaskIF* acsTask = factory->createPeriodicTask(
|
PeriodicTaskIF* acsTask = factory->createPeriodicTask(
|
||||||
"ACS_TASK", 50, PeriodicTaskIF::MINIMUM_STACK_SIZE * 2, 0.4, missedDeadlineFunc);
|
"ACS_TASK", 50, PeriodicTaskIF::MINIMUM_STACK_SIZE * 2, 0.4, missedDeadlineFunc);
|
||||||
result = acsTask->addComponent(objects::GPS_CONTROLLER);
|
result = acsTask->addComponent(objects::GPS_CONTROLLER);
|
||||||
if (result != HasReturnvaluesIF::RETURN_OK) {
|
if (result != returnvalue::OK) {
|
||||||
initmission::printAddObjectError("GPS_CTRL", objects::GPS_CONTROLLER);
|
initmission::printAddObjectError("GPS_CTRL", objects::GPS_CONTROLLER);
|
||||||
}
|
}
|
||||||
#endif /* OBSW_ADD_ACS_HANDLERS */
|
#endif /* OBSW_ADD_ACS_HANDLERS */
|
||||||
|
|
||||||
acsTask->addComponent(objects::ACS_CONTROLLER);
|
acsTask->addComponent(objects::ACS_CONTROLLER);
|
||||||
if (result != HasReturnvaluesIF::RETURN_OK) {
|
if (result != returnvalue::OK) {
|
||||||
initmission::printAddObjectError("ACS_CTRL", objects::ACS_CONTROLLER);
|
initmission::printAddObjectError("ACS_CTRL", objects::ACS_CONTROLLER);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -143,19 +143,19 @@ void initmission::initTasks() {
|
|||||||
static_cast<void>(sysTask);
|
static_cast<void>(sysTask);
|
||||||
#if OBSW_ADD_ACS_HANDLERS == 1
|
#if OBSW_ADD_ACS_HANDLERS == 1
|
||||||
result = sysTask->addComponent(objects::ACS_BOARD_ASS);
|
result = sysTask->addComponent(objects::ACS_BOARD_ASS);
|
||||||
if (result != HasReturnvaluesIF::RETURN_OK) {
|
if (result != returnvalue::OK) {
|
||||||
initmission::printAddObjectError("ACS_BOARD_ASS", objects::ACS_BOARD_ASS);
|
initmission::printAddObjectError("ACS_BOARD_ASS", objects::ACS_BOARD_ASS);
|
||||||
}
|
}
|
||||||
#endif /* OBSW_ADD_ACS_HANDLERS */
|
#endif /* OBSW_ADD_ACS_HANDLERS */
|
||||||
#if OBSW_ADD_RW == 1
|
#if OBSW_ADD_RW == 1
|
||||||
result = sysTask->addComponent(objects::RW_ASS);
|
result = sysTask->addComponent(objects::RW_ASS);
|
||||||
if (result != HasReturnvaluesIF::RETURN_OK) {
|
if (result != returnvalue::OK) {
|
||||||
initmission::printAddObjectError("RW_ASS", objects::RW_ASS);
|
initmission::printAddObjectError("RW_ASS", objects::RW_ASS);
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
#if OBSW_ADD_SUS_BOARD_ASS == 1
|
#if OBSW_ADD_SUS_BOARD_ASS == 1
|
||||||
result = sysTask->addComponent(objects::SUS_BOARD_ASS);
|
result = sysTask->addComponent(objects::SUS_BOARD_ASS);
|
||||||
if (result != HasReturnvaluesIF::RETURN_OK) {
|
if (result != returnvalue::OK) {
|
||||||
initmission::printAddObjectError("SUS_BOARD_ASS", objects::SUS_BOARD_ASS);
|
initmission::printAddObjectError("SUS_BOARD_ASS", objects::SUS_BOARD_ASS);
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
@ -164,7 +164,7 @@ void initmission::initTasks() {
|
|||||||
PeriodicTaskIF* tcsPollingTask = factory->createPeriodicTask(
|
PeriodicTaskIF* tcsPollingTask = factory->createPeriodicTask(
|
||||||
"TCS_POLLING_TASK", 70, PeriodicTaskIF::MINIMUM_STACK_SIZE * 2, 0.5, missedDeadlineFunc);
|
"TCS_POLLING_TASK", 70, PeriodicTaskIF::MINIMUM_STACK_SIZE * 2, 0.5, missedDeadlineFunc);
|
||||||
result = tcsPollingTask->addComponent(objects::SPI_RTD_COM_IF);
|
result = tcsPollingTask->addComponent(objects::SPI_RTD_COM_IF);
|
||||||
if (result != HasReturnvaluesIF::RETURN_OK) {
|
if (result != returnvalue::OK) {
|
||||||
initmission::printAddObjectError("SPI_RTD_POLLING", objects::SPI_RTD_COM_IF);
|
initmission::printAddObjectError("SPI_RTD_POLLING", objects::SPI_RTD_COM_IF);
|
||||||
}
|
}
|
||||||
PeriodicTaskIF* tcsTask = factory->createPeriodicTask(
|
PeriodicTaskIF* tcsTask = factory->createPeriodicTask(
|
||||||
@ -203,7 +203,7 @@ void initmission::initTasks() {
|
|||||||
PeriodicTaskIF* fsTask = factory->createPeriodicTask(
|
PeriodicTaskIF* fsTask = factory->createPeriodicTask(
|
||||||
"FILE_SYSTEM_TASK", 25, PeriodicTaskIF::MINIMUM_STACK_SIZE, 0.4, missedDeadlineFunc);
|
"FILE_SYSTEM_TASK", 25, PeriodicTaskIF::MINIMUM_STACK_SIZE, 0.4, missedDeadlineFunc);
|
||||||
result = fsTask->addComponent(objects::FILE_SYSTEM_HANDLER);
|
result = fsTask->addComponent(objects::FILE_SYSTEM_HANDLER);
|
||||||
if (result != HasReturnvaluesIF::RETURN_OK) {
|
if (result != returnvalue::OK) {
|
||||||
initmission::printAddObjectError("FILE_SYSTEM_TASK", objects::FILE_SYSTEM_HANDLER);
|
initmission::printAddObjectError("FILE_SYSTEM_TASK", objects::FILE_SYSTEM_HANDLER);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -211,7 +211,7 @@ void initmission::initTasks() {
|
|||||||
PeriodicTaskIF* strHelperTask = factory->createPeriodicTask(
|
PeriodicTaskIF* strHelperTask = factory->createPeriodicTask(
|
||||||
"STR_HELPER", 20, PeriodicTaskIF::MINIMUM_STACK_SIZE, 0.2, missedDeadlineFunc);
|
"STR_HELPER", 20, PeriodicTaskIF::MINIMUM_STACK_SIZE, 0.2, missedDeadlineFunc);
|
||||||
result = strHelperTask->addComponent(objects::STR_HELPER);
|
result = strHelperTask->addComponent(objects::STR_HELPER);
|
||||||
if (result != HasReturnvaluesIF::RETURN_OK) {
|
if (result != returnvalue::OK) {
|
||||||
initmission::printAddObjectError("STR_HELPER", objects::STR_HELPER);
|
initmission::printAddObjectError("STR_HELPER", objects::STR_HELPER);
|
||||||
}
|
}
|
||||||
#endif /* OBSW_ADD_STAR_TRACKER == 1 */
|
#endif /* OBSW_ADD_STAR_TRACKER == 1 */
|
||||||
@ -220,7 +220,7 @@ void initmission::initTasks() {
|
|||||||
PeriodicTaskIF* mpsocHelperTask = factory->createPeriodicTask(
|
PeriodicTaskIF* mpsocHelperTask = factory->createPeriodicTask(
|
||||||
"PLOC_MPSOC_HELPER", 20, PeriodicTaskIF::MINIMUM_STACK_SIZE, 0.2, missedDeadlineFunc);
|
"PLOC_MPSOC_HELPER", 20, PeriodicTaskIF::MINIMUM_STACK_SIZE, 0.2, missedDeadlineFunc);
|
||||||
result = mpsocHelperTask->addComponent(objects::PLOC_MPSOC_HELPER);
|
result = mpsocHelperTask->addComponent(objects::PLOC_MPSOC_HELPER);
|
||||||
if (result != HasReturnvaluesIF::RETURN_OK) {
|
if (result != returnvalue::OK) {
|
||||||
initmission::printAddObjectError("PLOC_MPSOC_HELPER", objects::PLOC_MPSOC_HELPER);
|
initmission::printAddObjectError("PLOC_MPSOC_HELPER", objects::PLOC_MPSOC_HELPER);
|
||||||
}
|
}
|
||||||
#endif /* OBSW_ADD_PLOC_MPSOC */
|
#endif /* OBSW_ADD_PLOC_MPSOC */
|
||||||
@ -229,7 +229,7 @@ void initmission::initTasks() {
|
|||||||
PeriodicTaskIF* supvHelperTask = factory->createPeriodicTask(
|
PeriodicTaskIF* supvHelperTask = factory->createPeriodicTask(
|
||||||
"PLOC_SUPV_HELPER", 10, PeriodicTaskIF::MINIMUM_STACK_SIZE, 1.0, missedDeadlineFunc);
|
"PLOC_SUPV_HELPER", 10, PeriodicTaskIF::MINIMUM_STACK_SIZE, 1.0, missedDeadlineFunc);
|
||||||
result = supvHelperTask->addComponent(objects::PLOC_SUPERVISOR_HELPER);
|
result = supvHelperTask->addComponent(objects::PLOC_SUPERVISOR_HELPER);
|
||||||
if (result != HasReturnvaluesIF::RETURN_OK) {
|
if (result != returnvalue::OK) {
|
||||||
initmission::printAddObjectError("PLOC_SUPV_HELPER", objects::PLOC_SUPERVISOR_HELPER);
|
initmission::printAddObjectError("PLOC_SUPV_HELPER", objects::PLOC_SUPERVISOR_HELPER);
|
||||||
}
|
}
|
||||||
#endif /* OBSW_ADD_PLOC_SUPERVISOR */
|
#endif /* OBSW_ADD_PLOC_SUPERVISOR */
|
||||||
@ -238,7 +238,7 @@ void initmission::initTasks() {
|
|||||||
PeriodicTaskIF* ptmeTestTask = factory->createPeriodicTask(
|
PeriodicTaskIF* ptmeTestTask = factory->createPeriodicTask(
|
||||||
"PTME_TEST", 80, PeriodicTaskIF::MINIMUM_STACK_SIZE, 2.0, missedDeadlineFunc);
|
"PTME_TEST", 80, PeriodicTaskIF::MINIMUM_STACK_SIZE, 2.0, missedDeadlineFunc);
|
||||||
result = ptmeTestTask->addComponent(objects::CCSDS_IP_CORE_BRIDGE);
|
result = ptmeTestTask->addComponent(objects::CCSDS_IP_CORE_BRIDGE);
|
||||||
if (result != HasReturnvaluesIF::RETURN_OK) {
|
if (result != returnvalue::OK) {
|
||||||
initmission::printAddObjectError("PTME_TEST", objects::CCSDS_IP_CORE_BRIDGE);
|
initmission::printAddObjectError("PTME_TEST", objects::CCSDS_IP_CORE_BRIDGE);
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
@ -310,13 +310,13 @@ void initmission::initTasks() {
|
|||||||
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 = returnvalue::OK;
|
||||||
/* 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(
|
||||||
"MAIN_SPI", 75, PeriodicTaskIF::MINIMUM_STACK_SIZE * 4, 0.5, missedDeadlineFunc);
|
"MAIN_SPI", 75, PeriodicTaskIF::MINIMUM_STACK_SIZE * 4, 0.5, missedDeadlineFunc);
|
||||||
result = pst::pstSpi(spiPst);
|
result = pst::pstSpi(spiPst);
|
||||||
if (result != HasReturnvaluesIF::RETURN_OK) {
|
if (result != returnvalue::OK) {
|
||||||
if (result == FixedTimeslotTaskIF::SLOT_LIST_EMPTY) {
|
if (result == FixedTimeslotTaskIF::SLOT_LIST_EMPTY) {
|
||||||
sif::warning << "InitMission::initTasks: SPI PST is empty" << std::endl;
|
sif::warning << "InitMission::initTasks: SPI PST is empty" << std::endl;
|
||||||
} else {
|
} else {
|
||||||
@ -331,7 +331,7 @@ void initmission::createPstTasks(TaskFactory& factory,
|
|||||||
FixedTimeslotTaskIF* rwPstTask = factory.createFixedTimeslotTask(
|
FixedTimeslotTaskIF* rwPstTask = factory.createFixedTimeslotTask(
|
||||||
"RW_SPI", 65, PeriodicTaskIF::MINIMUM_STACK_SIZE * 2, 1.0, missedDeadlineFunc);
|
"RW_SPI", 65, PeriodicTaskIF::MINIMUM_STACK_SIZE * 2, 1.0, missedDeadlineFunc);
|
||||||
result = pst::pstSpiRw(rwPstTask);
|
result = pst::pstSpiRw(rwPstTask);
|
||||||
if (result != HasReturnvaluesIF::RETURN_OK) {
|
if (result != returnvalue::OK) {
|
||||||
if (result == FixedTimeslotTaskIF::SLOT_LIST_EMPTY) {
|
if (result == FixedTimeslotTaskIF::SLOT_LIST_EMPTY) {
|
||||||
sif::warning << "InitMission::initTasks: SPI PST is empty" << std::endl;
|
sif::warning << "InitMission::initTasks: SPI PST is empty" << std::endl;
|
||||||
} else {
|
} else {
|
||||||
@ -345,7 +345,7 @@ void initmission::createPstTasks(TaskFactory& factory,
|
|||||||
FixedTimeslotTaskIF* uartPst = factory.createFixedTimeslotTask(
|
FixedTimeslotTaskIF* uartPst = factory.createFixedTimeslotTask(
|
||||||
"UART_PST", 65, PeriodicTaskIF::MINIMUM_STACK_SIZE * 4, 0.2, missedDeadlineFunc);
|
"UART_PST", 65, PeriodicTaskIF::MINIMUM_STACK_SIZE * 4, 0.2, missedDeadlineFunc);
|
||||||
result = pst::pstUart(uartPst);
|
result = pst::pstUart(uartPst);
|
||||||
if (result != HasReturnvaluesIF::RETURN_OK) {
|
if (result != returnvalue::OK) {
|
||||||
if (result == FixedTimeslotTaskIF::SLOT_LIST_EMPTY) {
|
if (result == FixedTimeslotTaskIF::SLOT_LIST_EMPTY) {
|
||||||
sif::warning << "InitMission::initTasks: UART PST is empty" << std::endl;
|
sif::warning << "InitMission::initTasks: UART PST is empty" << std::endl;
|
||||||
} else {
|
} else {
|
||||||
@ -358,7 +358,7 @@ void initmission::createPstTasks(TaskFactory& factory,
|
|||||||
FixedTimeslotTaskIF* gpioPst = factory.createFixedTimeslotTask(
|
FixedTimeslotTaskIF* gpioPst = factory.createFixedTimeslotTask(
|
||||||
"GPIO_PST", 70, PeriodicTaskIF::MINIMUM_STACK_SIZE * 2, 0.2, missedDeadlineFunc);
|
"GPIO_PST", 70, PeriodicTaskIF::MINIMUM_STACK_SIZE * 2, 0.2, missedDeadlineFunc);
|
||||||
result = pst::pstGpio(gpioPst);
|
result = pst::pstGpio(gpioPst);
|
||||||
if (result != HasReturnvaluesIF::RETURN_OK) {
|
if (result != returnvalue::OK) {
|
||||||
if (result == FixedTimeslotTaskIF::SLOT_LIST_EMPTY) {
|
if (result == FixedTimeslotTaskIF::SLOT_LIST_EMPTY) {
|
||||||
sif::warning << "InitMission::initTasks: GPIO PST is empty" << std::endl;
|
sif::warning << "InitMission::initTasks: GPIO PST is empty" << std::endl;
|
||||||
} else {
|
} else {
|
||||||
@ -371,7 +371,7 @@ void initmission::createPstTasks(TaskFactory& factory,
|
|||||||
FixedTimeslotTaskIF* i2cPst = factory.createFixedTimeslotTask(
|
FixedTimeslotTaskIF* i2cPst = factory.createFixedTimeslotTask(
|
||||||
"I2C_PST", 65, PeriodicTaskIF::MINIMUM_STACK_SIZE * 4, 0.2, missedDeadlineFunc);
|
"I2C_PST", 65, PeriodicTaskIF::MINIMUM_STACK_SIZE * 4, 0.2, missedDeadlineFunc);
|
||||||
result = pst::pstI2c(i2cPst);
|
result = pst::pstI2c(i2cPst);
|
||||||
if (result != HasReturnvaluesIF::RETURN_OK) {
|
if (result != returnvalue::OK) {
|
||||||
if (result == FixedTimeslotTaskIF::SLOT_LIST_EMPTY) {
|
if (result == FixedTimeslotTaskIF::SLOT_LIST_EMPTY) {
|
||||||
sif::warning << "InitMission::initTasks: I2C PST is empty" << std::endl;
|
sif::warning << "InitMission::initTasks: I2C PST is empty" << std::endl;
|
||||||
} else {
|
} else {
|
||||||
@ -386,7 +386,7 @@ void initmission::createPstTasks(TaskFactory& factory,
|
|||||||
FixedTimeslotTaskIF* gomSpacePstTask = factory.createFixedTimeslotTask(
|
FixedTimeslotTaskIF* gomSpacePstTask = factory.createFixedTimeslotTask(
|
||||||
"GS_PST_TASK", 70, PeriodicTaskIF::MINIMUM_STACK_SIZE * 4, 1.0, missedDeadlineFunc);
|
"GS_PST_TASK", 70, PeriodicTaskIF::MINIMUM_STACK_SIZE * 4, 1.0, missedDeadlineFunc);
|
||||||
result = pst::pstGompaceCan(gomSpacePstTask);
|
result = pst::pstGompaceCan(gomSpacePstTask);
|
||||||
if (result != HasReturnvaluesIF::RETURN_OK) {
|
if (result != returnvalue::OK) {
|
||||||
if (result != FixedTimeslotTaskIF::SLOT_LIST_EMPTY) {
|
if (result != FixedTimeslotTaskIF::SLOT_LIST_EMPTY) {
|
||||||
sif::error << "InitMission::initTasks: GomSpace PST initialization failed!" << std::endl;
|
sif::error << "InitMission::initTasks: GomSpace PST initialization failed!" << std::endl;
|
||||||
}
|
}
|
||||||
@ -398,12 +398,12 @@ 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 = returnvalue::OK;
|
||||||
/* PUS Services */
|
/* PUS Services */
|
||||||
PeriodicTaskIF* pusVerification = factory.createPeriodicTask(
|
PeriodicTaskIF* pusVerification = factory.createPeriodicTask(
|
||||||
"PUS_VERIF", 40, PeriodicTaskIF::MINIMUM_STACK_SIZE, 0.200, missedDeadlineFunc);
|
"PUS_VERIF", 40, PeriodicTaskIF::MINIMUM_STACK_SIZE, 0.200, missedDeadlineFunc);
|
||||||
result = pusVerification->addComponent(objects::PUS_SERVICE_1_VERIFICATION);
|
result = pusVerification->addComponent(objects::PUS_SERVICE_1_VERIFICATION);
|
||||||
if (result != HasReturnvaluesIF::RETURN_OK) {
|
if (result != returnvalue::OK) {
|
||||||
initmission::printAddObjectError("PUS_VERIF", objects::PUS_SERVICE_1_VERIFICATION);
|
initmission::printAddObjectError("PUS_VERIF", objects::PUS_SERVICE_1_VERIFICATION);
|
||||||
}
|
}
|
||||||
taskVec.push_back(pusVerification);
|
taskVec.push_back(pusVerification);
|
||||||
@ -411,11 +411,11 @@ void initmission::createPusTasks(TaskFactory& factory,
|
|||||||
PeriodicTaskIF* pusEvents = factory.createPeriodicTask(
|
PeriodicTaskIF* pusEvents = factory.createPeriodicTask(
|
||||||
"PUS_EVENTS", 60, PeriodicTaskIF::MINIMUM_STACK_SIZE, 0.200, missedDeadlineFunc);
|
"PUS_EVENTS", 60, PeriodicTaskIF::MINIMUM_STACK_SIZE, 0.200, missedDeadlineFunc);
|
||||||
result = pusEvents->addComponent(objects::PUS_SERVICE_5_EVENT_REPORTING);
|
result = pusEvents->addComponent(objects::PUS_SERVICE_5_EVENT_REPORTING);
|
||||||
if (result != HasReturnvaluesIF::RETURN_OK) {
|
if (result != returnvalue::OK) {
|
||||||
initmission::printAddObjectError("PUS_EVENTS", objects::PUS_SERVICE_5_EVENT_REPORTING);
|
initmission::printAddObjectError("PUS_EVENTS", objects::PUS_SERVICE_5_EVENT_REPORTING);
|
||||||
}
|
}
|
||||||
result = pusEvents->addComponent(objects::EVENT_MANAGER);
|
result = pusEvents->addComponent(objects::EVENT_MANAGER);
|
||||||
if (result != HasReturnvaluesIF::RETURN_OK) {
|
if (result != returnvalue::OK) {
|
||||||
initmission::printAddObjectError("PUS_MGMT", objects::EVENT_MANAGER);
|
initmission::printAddObjectError("PUS_MGMT", objects::EVENT_MANAGER);
|
||||||
}
|
}
|
||||||
taskVec.push_back(pusEvents);
|
taskVec.push_back(pusEvents);
|
||||||
@ -423,11 +423,11 @@ void initmission::createPusTasks(TaskFactory& factory,
|
|||||||
PeriodicTaskIF* pusHighPrio = factory.createPeriodicTask(
|
PeriodicTaskIF* pusHighPrio = factory.createPeriodicTask(
|
||||||
"PUS_HIGH_PRIO", 50, PeriodicTaskIF::MINIMUM_STACK_SIZE, 0.200, missedDeadlineFunc);
|
"PUS_HIGH_PRIO", 50, PeriodicTaskIF::MINIMUM_STACK_SIZE, 0.200, missedDeadlineFunc);
|
||||||
result = pusHighPrio->addComponent(objects::PUS_SERVICE_2_DEVICE_ACCESS);
|
result = pusHighPrio->addComponent(objects::PUS_SERVICE_2_DEVICE_ACCESS);
|
||||||
if (result != HasReturnvaluesIF::RETURN_OK) {
|
if (result != returnvalue::OK) {
|
||||||
initmission::printAddObjectError("PUS_2", objects::PUS_SERVICE_2_DEVICE_ACCESS);
|
initmission::printAddObjectError("PUS_2", objects::PUS_SERVICE_2_DEVICE_ACCESS);
|
||||||
}
|
}
|
||||||
result = pusHighPrio->addComponent(objects::PUS_SERVICE_9_TIME_MGMT);
|
result = pusHighPrio->addComponent(objects::PUS_SERVICE_9_TIME_MGMT);
|
||||||
if (result != HasReturnvaluesIF::RETURN_OK) {
|
if (result != returnvalue::OK) {
|
||||||
initmission::printAddObjectError("PUS_9", objects::PUS_SERVICE_9_TIME_MGMT);
|
initmission::printAddObjectError("PUS_9", objects::PUS_SERVICE_9_TIME_MGMT);
|
||||||
}
|
}
|
||||||
taskVec.push_back(pusHighPrio);
|
taskVec.push_back(pusHighPrio);
|
||||||
@ -436,27 +436,27 @@ void initmission::createPusTasks(TaskFactory& factory,
|
|||||||
"PUS_MED_PRIO", 40, PeriodicTaskIF::MINIMUM_STACK_SIZE, 0.8, missedDeadlineFunc);
|
"PUS_MED_PRIO", 40, PeriodicTaskIF::MINIMUM_STACK_SIZE, 0.8, missedDeadlineFunc);
|
||||||
|
|
||||||
result = pusMedPrio->addComponent(objects::PUS_SERVICE_3_HOUSEKEEPING);
|
result = pusMedPrio->addComponent(objects::PUS_SERVICE_3_HOUSEKEEPING);
|
||||||
if (result != HasReturnvaluesIF::RETURN_OK) {
|
if (result != returnvalue::OK) {
|
||||||
initmission::printAddObjectError("PUS_3", objects::PUS_SERVICE_3_HOUSEKEEPING);
|
initmission::printAddObjectError("PUS_3", objects::PUS_SERVICE_3_HOUSEKEEPING);
|
||||||
}
|
}
|
||||||
result = pusMedPrio->addComponent(objects::PUS_SERVICE_8_FUNCTION_MGMT);
|
result = pusMedPrio->addComponent(objects::PUS_SERVICE_8_FUNCTION_MGMT);
|
||||||
if (result != HasReturnvaluesIF::RETURN_OK) {
|
if (result != returnvalue::OK) {
|
||||||
initmission::printAddObjectError("PUS_8", objects::PUS_SERVICE_8_FUNCTION_MGMT);
|
initmission::printAddObjectError("PUS_8", objects::PUS_SERVICE_8_FUNCTION_MGMT);
|
||||||
}
|
}
|
||||||
result = pusMedPrio->addComponent(objects::PUS_SERVICE_11_TC_SCHEDULER);
|
result = pusMedPrio->addComponent(objects::PUS_SERVICE_11_TC_SCHEDULER);
|
||||||
if (result != HasReturnvaluesIF::RETURN_OK) {
|
if (result != returnvalue::OK) {
|
||||||
initmission::printAddObjectError("PUS_11", objects::PUS_SERVICE_11_TC_SCHEDULER);
|
initmission::printAddObjectError("PUS_11", objects::PUS_SERVICE_11_TC_SCHEDULER);
|
||||||
}
|
}
|
||||||
result = pusMedPrio->addComponent(objects::PUS_SERVICE_20_PARAMETERS);
|
result = pusMedPrio->addComponent(objects::PUS_SERVICE_20_PARAMETERS);
|
||||||
if (result != HasReturnvaluesIF::RETURN_OK) {
|
if (result != returnvalue::OK) {
|
||||||
initmission::printAddObjectError("PUS_20", objects::PUS_SERVICE_20_PARAMETERS);
|
initmission::printAddObjectError("PUS_20", objects::PUS_SERVICE_20_PARAMETERS);
|
||||||
}
|
}
|
||||||
result = pusMedPrio->addComponent(objects::PUS_SERVICE_200_MODE_MGMT);
|
result = pusMedPrio->addComponent(objects::PUS_SERVICE_200_MODE_MGMT);
|
||||||
if (result != HasReturnvaluesIF::RETURN_OK) {
|
if (result != returnvalue::OK) {
|
||||||
initmission::printAddObjectError("PUS_200", objects::PUS_SERVICE_200_MODE_MGMT);
|
initmission::printAddObjectError("PUS_200", objects::PUS_SERVICE_200_MODE_MGMT);
|
||||||
}
|
}
|
||||||
result = pusMedPrio->addComponent(objects::PUS_SERVICE_201_HEALTH);
|
result = pusMedPrio->addComponent(objects::PUS_SERVICE_201_HEALTH);
|
||||||
if (result != HasReturnvaluesIF::RETURN_OK) {
|
if (result != returnvalue::OK) {
|
||||||
initmission::printAddObjectError("PUS_201", objects::PUS_SERVICE_201_HEALTH);
|
initmission::printAddObjectError("PUS_201", objects::PUS_SERVICE_201_HEALTH);
|
||||||
}
|
}
|
||||||
taskVec.push_back(pusMedPrio);
|
taskVec.push_back(pusMedPrio);
|
||||||
@ -464,11 +464,11 @@ void initmission::createPusTasks(TaskFactory& factory,
|
|||||||
PeriodicTaskIF* pusLowPrio = factory.createPeriodicTask(
|
PeriodicTaskIF* pusLowPrio = factory.createPeriodicTask(
|
||||||
"PUS_LOW_PRIO", 30, PeriodicTaskIF::MINIMUM_STACK_SIZE, 1.6, missedDeadlineFunc);
|
"PUS_LOW_PRIO", 30, PeriodicTaskIF::MINIMUM_STACK_SIZE, 1.6, missedDeadlineFunc);
|
||||||
result = pusLowPrio->addComponent(objects::PUS_SERVICE_17_TEST);
|
result = pusLowPrio->addComponent(objects::PUS_SERVICE_17_TEST);
|
||||||
if (result != HasReturnvaluesIF::RETURN_OK) {
|
if (result != returnvalue::OK) {
|
||||||
initmission::printAddObjectError("PUS_17", objects::PUS_SERVICE_17_TEST);
|
initmission::printAddObjectError("PUS_17", objects::PUS_SERVICE_17_TEST);
|
||||||
}
|
}
|
||||||
result = pusLowPrio->addComponent(objects::INTERNAL_ERROR_REPORTER);
|
result = pusLowPrio->addComponent(objects::INTERNAL_ERROR_REPORTER);
|
||||||
if (result != HasReturnvaluesIF::RETURN_OK) {
|
if (result != returnvalue::OK) {
|
||||||
initmission::printAddObjectError("ERROR_REPORTER", objects::INTERNAL_ERROR_REPORTER);
|
initmission::printAddObjectError("ERROR_REPORTER", objects::INTERNAL_ERROR_REPORTER);
|
||||||
}
|
}
|
||||||
taskVec.push_back(pusLowPrio);
|
taskVec.push_back(pusLowPrio);
|
||||||
@ -478,32 +478,32 @@ 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_TEST_CODE == 1
|
||||||
ReturnValue_t result = HasReturnvaluesIF::RETURN_OK;
|
ReturnValue_t result = returnvalue::OK;
|
||||||
static_cast<void>(result); // supress warning in case it is not used
|
static_cast<void>(result); // supress warning in case it is not used
|
||||||
|
|
||||||
PeriodicTaskIF* testTask = factory.createPeriodicTask(
|
PeriodicTaskIF* testTask = factory.createPeriodicTask(
|
||||||
"TEST_TASK", 60, PeriodicTaskIF::MINIMUM_STACK_SIZE, 1, missedDeadlineFunc);
|
"TEST_TASK", 60, PeriodicTaskIF::MINIMUM_STACK_SIZE, 1, missedDeadlineFunc);
|
||||||
|
|
||||||
result = testTask->addComponent(objects::TEST_TASK);
|
result = testTask->addComponent(objects::TEST_TASK);
|
||||||
if (result != HasReturnvaluesIF::RETURN_OK) {
|
if (result != returnvalue::OK) {
|
||||||
initmission::printAddObjectError("TEST_TASK", objects::TEST_TASK);
|
initmission::printAddObjectError("TEST_TASK", objects::TEST_TASK);
|
||||||
}
|
}
|
||||||
|
|
||||||
#if OBSW_ADD_SPI_TEST_CODE == 1
|
#if OBSW_ADD_SPI_TEST_CODE == 1
|
||||||
result = testTask->addComponent(objects::SPI_TEST);
|
result = testTask->addComponent(objects::SPI_TEST);
|
||||||
if (result != HasReturnvaluesIF::RETURN_OK) {
|
if (result != returnvalue::OK) {
|
||||||
initmission::printAddObjectError("SPI_TEST", objects::SPI_TEST);
|
initmission::printAddObjectError("SPI_TEST", objects::SPI_TEST);
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
#if OBSW_ADD_I2C_TEST_CODE == 1
|
#if OBSW_ADD_I2C_TEST_CODE == 1
|
||||||
result = testTask->addComponent(objects::I2C_TEST);
|
result = testTask->addComponent(objects::I2C_TEST);
|
||||||
if (result != HasReturnvaluesIF::RETURN_OK) {
|
if (result != returnvalue::OK) {
|
||||||
initmission::printAddObjectError("I2C_TEST", objects::I2C_TEST);
|
initmission::printAddObjectError("I2C_TEST", objects::I2C_TEST);
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
#if OBSW_ADD_UART_TEST_CODE == 1
|
#if OBSW_ADD_UART_TEST_CODE == 1
|
||||||
result = testTask->addComponent(objects::UART_TEST);
|
result = testTask->addComponent(objects::UART_TEST);
|
||||||
if (result != HasReturnvaluesIF::RETURN_OK) {
|
if (result != returnvalue::OK) {
|
||||||
initmission::printAddObjectError("UART_TEST", objects::UART_TEST);
|
initmission::printAddObjectError("UART_TEST", objects::UART_TEST);
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
@ -20,7 +20,6 @@
|
|||||||
#include "linux/boardtest/UartTestClass.h"
|
#include "linux/boardtest/UartTestClass.h"
|
||||||
#include "linux/callbacks/gpioCallbacks.h"
|
#include "linux/callbacks/gpioCallbacks.h"
|
||||||
#include "linux/csp/CspComIF.h"
|
#include "linux/csp/CspComIF.h"
|
||||||
#include "linux/csp/CspCookie.h"
|
|
||||||
#include "linux/devices/GPSHyperionLinuxController.h"
|
#include "linux/devices/GPSHyperionLinuxController.h"
|
||||||
#include "linux/devices/devicedefinitions/PlocMPSoCDefinitions.h"
|
#include "linux/devices/devicedefinitions/PlocMPSoCDefinitions.h"
|
||||||
#include "linux/devices/devicedefinitions/StarTrackerDefinitions.h"
|
#include "linux/devices/devicedefinitions/StarTrackerDefinitions.h"
|
||||||
@ -35,6 +34,7 @@
|
|||||||
#include "linux/obc/PdecHandler.h"
|
#include "linux/obc/PdecHandler.h"
|
||||||
#include "linux/obc/Ptme.h"
|
#include "linux/obc/Ptme.h"
|
||||||
#include "linux/obc/PtmeConfig.h"
|
#include "linux/obc/PtmeConfig.h"
|
||||||
|
#include "mission/csp/CspCookie.h"
|
||||||
#include "mission/system/RwAssembly.h"
|
#include "mission/system/RwAssembly.h"
|
||||||
#include "mission/system/fdir/AcsBoardFdir.h"
|
#include "mission/system/fdir/AcsBoardFdir.h"
|
||||||
#include "mission/system/fdir/GomspacePowerFdir.h"
|
#include "mission/system/fdir/GomspacePowerFdir.h"
|
||||||
@ -158,10 +158,10 @@ void ObjectFactory::createCommunicationInterfaces(LinuxLibgpioIF** gpioComIF, Ua
|
|||||||
}
|
}
|
||||||
|
|
||||||
void ObjectFactory::createPcduComponents(LinuxLibgpioIF* gpioComIF, PowerSwitchIF** pwrSwitcher) {
|
void ObjectFactory::createPcduComponents(LinuxLibgpioIF* gpioComIF, PowerSwitchIF** pwrSwitcher) {
|
||||||
CspCookie* p60DockCspCookie = new CspCookie(P60Dock::MAX_REPLY_LENGTH, addresses::P60DOCK);
|
CspCookie* p60DockCspCookie = new CspCookie(P60Dock::MAX_REPLY_SIZE, addresses::P60DOCK, 500);
|
||||||
CspCookie* pdu1CspCookie = new CspCookie(PDU::MAX_REPLY_LENGTH, addresses::PDU1);
|
CspCookie* pdu1CspCookie = new CspCookie(PDU::MAX_REPLY_SIZE, addresses::PDU1, 500);
|
||||||
CspCookie* pdu2CspCookie = new CspCookie(PDU::MAX_REPLY_LENGTH, addresses::PDU2);
|
CspCookie* pdu2CspCookie = new CspCookie(PDU::MAX_REPLY_SIZE, addresses::PDU2, 500);
|
||||||
CspCookie* acuCspCookie = new CspCookie(ACU::MAX_REPLY_LENGTH, addresses::ACU);
|
CspCookie* acuCspCookie = new CspCookie(ACU::MAX_REPLY_SIZE, addresses::ACU, 500);
|
||||||
|
|
||||||
auto p60Fdir = new GomspacePowerFdir(objects::P60DOCK_HANDLER);
|
auto p60Fdir = new GomspacePowerFdir(objects::P60DOCK_HANDLER);
|
||||||
P60DockHandler* p60dockhandler =
|
P60DockHandler* p60dockhandler =
|
||||||
@ -918,7 +918,7 @@ void ObjectFactory::testAcsBrdAss(AcsBoardAssembly* acsAss) {
|
|||||||
ModeMessage::setModeMessage(&msg, ModeMessage::CMD_MODE_COMMAND, DeviceHandlerIF::MODE_NORMAL,
|
ModeMessage::setModeMessage(&msg, ModeMessage::CMD_MODE_COMMAND, DeviceHandlerIF::MODE_NORMAL,
|
||||||
duallane::A_SIDE);
|
duallane::A_SIDE);
|
||||||
ReturnValue_t result = MessageQueueSenderIF::sendMessage(acsAss->getCommandQueue(), &msg);
|
ReturnValue_t result = MessageQueueSenderIF::sendMessage(acsAss->getCommandQueue(), &msg);
|
||||||
if (result != HasReturnvaluesIF::RETURN_OK) {
|
if (result != returnvalue::OK) {
|
||||||
sif::warning << "Sending mode command failed" << std::endl;
|
sif::warning << "Sending mode command failed" << std::endl;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
#ifndef BSP_Q7S_OBJECTFACTORY_H_
|
#ifndef BSP_Q7S_OBJECTFACTORY_H_
|
||||||
#define BSP_Q7S_OBJECTFACTORY_H_
|
#define BSP_Q7S_OBJECTFACTORY_H_
|
||||||
|
|
||||||
#include <fsfw/returnvalues/HasReturnvaluesIF.h>
|
#include <fsfw/returnvalues/returnvalue.h>
|
||||||
|
|
||||||
#include <string>
|
#include <string>
|
||||||
|
|
||||||
|
@ -35,7 +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 = returnvalue::OK;
|
||||||
while (true) {
|
while (true) {
|
||||||
if (opCounter % 5 == 0) {
|
if (opCounter % 5 == 0) {
|
||||||
if (coreCtrl->sdInitFinished()) {
|
if (coreCtrl->sdInitFinished()) {
|
||||||
@ -45,7 +45,7 @@ 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) {
|
} else if (result != returnvalue::FAILED) {
|
||||||
sif::warning << "FileSystemHandler::performOperation: Message reception failed!" << std::endl;
|
sif::warning << "FileSystemHandler::performOperation: Message reception failed!" << std::endl;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@ -91,7 +91,7 @@ void FileSystemHandler::fileSystemCheckup() {
|
|||||||
<< " 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 != returnvalue::OK) {
|
||||||
// Oh no.
|
// Oh no.
|
||||||
triggerEvent(SdCardManager::SANITIZATION_FAILED, 0, 0);
|
triggerEvent(SdCardManager::SANITIZATION_FAILED, 0, 0);
|
||||||
sif::error << "FileSystemHandler::fileSystemCheckup: Sanitization failed" << std::endl;
|
sif::error << "FileSystemHandler::fileSystemCheckup: Sanitization failed" << std::endl;
|
||||||
@ -114,7 +114,7 @@ ReturnValue_t FileSystemHandler::initialize() {
|
|||||||
} 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 returnvalue::OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
ReturnValue_t FileSystemHandler::appendToFile(const char* repositoryPath, const char* filename,
|
ReturnValue_t FileSystemHandler::appendToFile(const char* repositoryPath, const char* filename,
|
||||||
@ -129,7 +129,7 @@ ReturnValue_t FileSystemHandler::appendToFile(const char* repositoryPath, const
|
|||||||
if (not file.good()) {
|
if (not file.good()) {
|
||||||
return GENERIC_FILE_ERROR;
|
return GENERIC_FILE_ERROR;
|
||||||
}
|
}
|
||||||
return HasReturnvaluesIF::RETURN_OK;
|
return returnvalue::OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
ReturnValue_t FileSystemHandler::createFile(const char* repositoryPath, const char* filename,
|
ReturnValue_t FileSystemHandler::createFile(const char* repositoryPath, const char* filename,
|
||||||
@ -144,7 +144,7 @@ ReturnValue_t FileSystemHandler::createFile(const char* repositoryPath, const ch
|
|||||||
if (not file.good()) {
|
if (not file.good()) {
|
||||||
return GENERIC_FILE_ERROR;
|
return GENERIC_FILE_ERROR;
|
||||||
}
|
}
|
||||||
return HasReturnvaluesIF::RETURN_OK;
|
return returnvalue::OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
ReturnValue_t FileSystemHandler::removeFile(const char* repositoryPath, const char* filename,
|
ReturnValue_t FileSystemHandler::removeFile(const char* repositoryPath, const char* filename,
|
||||||
@ -158,7 +158,7 @@ ReturnValue_t FileSystemHandler::removeFile(const char* repositoryPath, const ch
|
|||||||
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;
|
||||||
}
|
}
|
||||||
return HasReturnvaluesIF::RETURN_OK;
|
return returnvalue::OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
ReturnValue_t FileSystemHandler::createDirectory(const char* repositoryPath, const char* dirname,
|
ReturnValue_t FileSystemHandler::createDirectory(const char* repositoryPath, const char* dirname,
|
||||||
@ -168,7 +168,7 @@ ReturnValue_t FileSystemHandler::createDirectory(const char* repositoryPath, con
|
|||||||
return DIRECTORY_ALREADY_EXISTS;
|
return DIRECTORY_ALREADY_EXISTS;
|
||||||
}
|
}
|
||||||
if (std::filesystem::create_directory(path)) {
|
if (std::filesystem::create_directory(path)) {
|
||||||
return HasReturnvaluesIF::RETURN_OK;
|
return returnvalue::OK;
|
||||||
}
|
}
|
||||||
sif::warning << "Creating directory " << path << " failed" << std::endl;
|
sif::warning << "Creating directory " << path << " failed" << std::endl;
|
||||||
return GENERIC_FILE_ERROR;
|
return GENERIC_FILE_ERROR;
|
||||||
@ -183,7 +183,7 @@ ReturnValue_t FileSystemHandler::removeDirectory(const char* repositoryPath, con
|
|||||||
std::error_code err;
|
std::error_code err;
|
||||||
if (not deleteRecurively) {
|
if (not deleteRecurively) {
|
||||||
if (std::filesystem::remove(path, err)) {
|
if (std::filesystem::remove(path, err)) {
|
||||||
return HasReturnvaluesIF::RETURN_OK;
|
return returnvalue::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 "
|
||||||
@ -197,7 +197,7 @@ ReturnValue_t FileSystemHandler::removeDirectory(const char* repositoryPath, con
|
|||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
if (std::filesystem::remove_all(path, err)) {
|
if (std::filesystem::remove_all(path, err)) {
|
||||||
return HasReturnvaluesIF::RETURN_OK;
|
return returnvalue::OK;
|
||||||
} else {
|
} else {
|
||||||
sif::warning << "FileSystemHandler::removeDirectory: Deleting directory failed with "
|
sif::warning << "FileSystemHandler::removeDirectory: Deleting directory failed with "
|
||||||
"code "
|
"code "
|
||||||
@ -211,14 +211,14 @@ ReturnValue_t FileSystemHandler::removeDirectory(const char* repositoryPath, con
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return HasReturnvaluesIF::RETURN_OK;
|
return returnvalue::OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
ReturnValue_t FileSystemHandler::renameFile(const char* repositoryPath, const char* oldFilename,
|
ReturnValue_t FileSystemHandler::renameFile(const char* repositoryPath, const char* oldFilename,
|
||||||
const char* newFilename, FileSystemArgsIF* args) {
|
const char* newFilename, FileSystemArgsIF* args) {
|
||||||
auto basepath = getInitPath(args) / repositoryPath;
|
auto basepath = getInitPath(args) / repositoryPath;
|
||||||
std::filesystem::rename(basepath / oldFilename, basepath / newFilename);
|
std::filesystem::rename(basepath / oldFilename, basepath / newFilename);
|
||||||
return HasReturnvaluesIF::RETURN_OK;
|
return returnvalue::OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
void FileSystemHandler::parseCfg(FsCommandCfg* cfg, bool& useMountPrefix) {
|
void FileSystemHandler::parseCfg(FsCommandCfg* cfg, bool& useMountPrefix) {
|
||||||
|
@ -12,7 +12,7 @@ ReturnValue_t FilesystemHelper::checkPath(std::string path) {
|
|||||||
SdCardManager* sdcMan = SdCardManager::instance();
|
SdCardManager* sdcMan = SdCardManager::instance();
|
||||||
if (sdcMan == nullptr) {
|
if (sdcMan == nullptr) {
|
||||||
sif::warning << "FilesystemHelper::checkPath: Invalid SD card manager" << std::endl;
|
sif::warning << "FilesystemHelper::checkPath: Invalid SD card manager" << std::endl;
|
||||||
return RETURN_FAILED;
|
return returnvalue::FAILED;
|
||||||
}
|
}
|
||||||
if (path.substr(0, sizeof(SdCardManager::SD_0_MOUNT_POINT)) ==
|
if (path.substr(0, sizeof(SdCardManager::SD_0_MOUNT_POINT)) ==
|
||||||
std::string(SdCardManager::SD_0_MOUNT_POINT)) {
|
std::string(SdCardManager::SD_0_MOUNT_POINT)) {
|
||||||
@ -27,12 +27,12 @@ ReturnValue_t FilesystemHelper::checkPath(std::string path) {
|
|||||||
return SD_NOT_MOUNTED;
|
return SD_NOT_MOUNTED;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return RETURN_OK;
|
return returnvalue::OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
ReturnValue_t FilesystemHelper::fileExists(std::string file) {
|
ReturnValue_t FilesystemHelper::fileExists(std::string file) {
|
||||||
if (not std::filesystem::exists(file)) {
|
if (not std::filesystem::exists(file)) {
|
||||||
return FILE_NOT_EXISTS;
|
return FILE_NOT_EXISTS;
|
||||||
}
|
}
|
||||||
return RETURN_OK;
|
return returnvalue::OK;
|
||||||
}
|
}
|
||||||
|
@ -4,14 +4,14 @@
|
|||||||
#include <string>
|
#include <string>
|
||||||
|
|
||||||
#include "commonClassIds.h"
|
#include "commonClassIds.h"
|
||||||
#include "fsfw/returnvalues/HasReturnvaluesIF.h"
|
#include "fsfw/returnvalues/returnvalue.h"
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief This class implements often used functions related to the file system management.
|
* @brief This class implements often used functions related to the file system management.
|
||||||
*
|
*
|
||||||
* @author J. Meier
|
* @author J. Meier
|
||||||
*/
|
*/
|
||||||
class FilesystemHelper : public HasReturnvaluesIF {
|
class FilesystemHelper {
|
||||||
public:
|
public:
|
||||||
static const uint8_t INTERFACE_ID = CLASS_ID::FILE_SYSTEM_HELPER;
|
static const uint8_t INTERFACE_ID = CLASS_ID::FILE_SYSTEM_HELPER;
|
||||||
|
|
||||||
@ -26,7 +26,7 @@ class FilesystemHelper : public HasReturnvaluesIF {
|
|||||||
*
|
*
|
||||||
* @param path Path to check
|
* @param path Path to check
|
||||||
*
|
*
|
||||||
* @return RETURN_OK if path points to SD card and the appropriate SD card is mounted or if
|
* @return returnvalue::OK if path points to SD card and the appropriate SD card is mounted or if
|
||||||
* path does not point to SD card.
|
* path does not point to SD card.
|
||||||
* Return error code if path points to SD card and the corresponding SD card is not
|
* Return error code if path points to SD card and the corresponding SD card is not
|
||||||
* mounted.
|
* mounted.
|
||||||
@ -38,7 +38,7 @@ class FilesystemHelper : public HasReturnvaluesIF {
|
|||||||
*
|
*
|
||||||
* @param file File to check
|
* @param file File to check
|
||||||
*
|
*
|
||||||
* @return RETURN_OK if file exists, otherwise return error code.
|
* @return returnvalue::OK if file exists, otherwise return error code.
|
||||||
*/
|
*/
|
||||||
static ReturnValue_t fileExists(std::string file);
|
static ReturnValue_t fileExists(std::string file);
|
||||||
|
|
||||||
|
@ -21,17 +21,17 @@ SdCardManager* SdCardManager::INSTANCE = nullptr;
|
|||||||
SdCardManager::SdCardManager() : SystemObject(objects::SDC_MANAGER), cmdExecutor(256) {
|
SdCardManager::SdCardManager() : SystemObject(objects::SDC_MANAGER), cmdExecutor(256) {
|
||||||
mutex = MutexFactory::instance()->createMutex();
|
mutex = MutexFactory::instance()->createMutex();
|
||||||
ReturnValue_t result = mutex->lockMutex();
|
ReturnValue_t result = mutex->lockMutex();
|
||||||
if (result != RETURN_OK) {
|
if (result != returnvalue::OK) {
|
||||||
sif::error << "SdCardManager::SdCardManager: Mutex lock failed" << std::endl;
|
sif::error << "SdCardManager::SdCardManager: Mutex lock failed" << std::endl;
|
||||||
}
|
}
|
||||||
uint8_t prefSdRaw = 0;
|
uint8_t prefSdRaw = 0;
|
||||||
result = scratch::readNumber(scratch::PREFERED_SDC_KEY, prefSdRaw);
|
result = scratch::readNumber(scratch::PREFERED_SDC_KEY, prefSdRaw);
|
||||||
result = mutex->unlockMutex();
|
result = mutex->unlockMutex();
|
||||||
if (result != RETURN_OK) {
|
if (result != returnvalue::OK) {
|
||||||
sif::error << "SdCardManager::SdCardManager: Mutex unlock failed" << std::endl;
|
sif::error << "SdCardManager::SdCardManager: Mutex unlock failed" << std::endl;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (result != HasReturnvaluesIF::RETURN_OK) {
|
if (result != returnvalue::OK) {
|
||||||
if (result == scratch::KEY_NOT_FOUND) {
|
if (result == scratch::KEY_NOT_FOUND) {
|
||||||
sif::warning << "CoreController::sdCardInit: "
|
sif::warning << "CoreController::sdCardInit: "
|
||||||
"Preferred SD card not set. Setting to 0"
|
"Preferred SD card not set. Setting to 0"
|
||||||
@ -65,7 +65,7 @@ SdCardManager* SdCardManager::instance() {
|
|||||||
|
|
||||||
ReturnValue_t SdCardManager::switchOnSdCard(sd::SdCard sdCard, bool doMountSdCard,
|
ReturnValue_t SdCardManager::switchOnSdCard(sd::SdCard sdCard, bool doMountSdCard,
|
||||||
SdStatePair* statusPair) {
|
SdStatePair* statusPair) {
|
||||||
ReturnValue_t result = HasReturnvaluesIF::RETURN_OK;
|
ReturnValue_t result = returnvalue::OK;
|
||||||
if (doMountSdCard) {
|
if (doMountSdCard) {
|
||||||
if (not blocking) {
|
if (not blocking) {
|
||||||
sif::warning << "SdCardManager::switchOnSdCard: Two-step command but manager is"
|
sif::warning << "SdCardManager::switchOnSdCard: Two-step command but manager is"
|
||||||
@ -80,7 +80,7 @@ ReturnValue_t SdCardManager::switchOnSdCard(sd::SdCard sdCard, bool doMountSdCar
|
|||||||
sdStatusPtr = std::make_unique<SdStatePair>();
|
sdStatusPtr = std::make_unique<SdStatePair>();
|
||||||
statusPair = sdStatusPtr.get();
|
statusPair = sdStatusPtr.get();
|
||||||
result = getSdCardsStatus(*statusPair);
|
result = getSdCardsStatus(*statusPair);
|
||||||
if (result != HasReturnvaluesIF::RETURN_OK) {
|
if (result != returnvalue::OK) {
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -89,7 +89,7 @@ ReturnValue_t SdCardManager::switchOnSdCard(sd::SdCard sdCard, bool doMountSdCar
|
|||||||
if (sdCard == sd::SdCard::BOTH) {
|
if (sdCard == sd::SdCard::BOTH) {
|
||||||
sif::warning << "SdCardManager::switchOffSdCard: API does not allow sd::SdStatus::BOTH"
|
sif::warning << "SdCardManager::switchOffSdCard: API does not allow sd::SdStatus::BOTH"
|
||||||
<< std::endl;
|
<< std::endl;
|
||||||
return HasReturnvaluesIF::RETURN_FAILED;
|
return returnvalue::FAILED;
|
||||||
}
|
}
|
||||||
|
|
||||||
sd::SdState currentState;
|
sd::SdState currentState;
|
||||||
@ -113,10 +113,10 @@ ReturnValue_t SdCardManager::switchOnSdCard(sd::SdCard sdCard, bool doMountSdCar
|
|||||||
} else if (currentState == sd::SdState::OFF) {
|
} else if (currentState == sd::SdState::OFF) {
|
||||||
result = setSdCardState(sdCard, true);
|
result = setSdCardState(sdCard, true);
|
||||||
} else {
|
} else {
|
||||||
result = HasReturnvaluesIF::RETURN_FAILED;
|
result = returnvalue::FAILED;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (result != HasReturnvaluesIF::RETURN_OK or not doMountSdCard) {
|
if (result != returnvalue::OK or not doMountSdCard) {
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -127,7 +127,7 @@ ReturnValue_t SdCardManager::switchOffSdCard(sd::SdCard sdCard, bool doUnmountSd
|
|||||||
SdStatePair* statusPair) {
|
SdStatePair* statusPair) {
|
||||||
std::pair<sd::SdState, sd::SdState> active;
|
std::pair<sd::SdState, sd::SdState> active;
|
||||||
ReturnValue_t result = getSdCardsStatus(active);
|
ReturnValue_t result = getSdCardsStatus(active);
|
||||||
if (result != HasReturnvaluesIF::RETURN_OK) {
|
if (result != returnvalue::OK) {
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
if (doUnmountSdCard) {
|
if (doUnmountSdCard) {
|
||||||
@ -142,7 +142,7 @@ ReturnValue_t SdCardManager::switchOffSdCard(sd::SdCard sdCard, bool doUnmountSd
|
|||||||
if (sdCard == sd::SdCard::BOTH) {
|
if (sdCard == sd::SdCard::BOTH) {
|
||||||
sif::warning << "SdCardManager::switchOffSdCard: API does not allow sd::SdStatus::BOTH"
|
sif::warning << "SdCardManager::switchOffSdCard: API does not allow sd::SdStatus::BOTH"
|
||||||
<< std::endl;
|
<< std::endl;
|
||||||
return HasReturnvaluesIF::RETURN_FAILED;
|
return returnvalue::FAILED;
|
||||||
}
|
}
|
||||||
if (sdCard == sd::SdCard::SLOT_0) {
|
if (sdCard == sd::SdCard::SLOT_0) {
|
||||||
if (active.first == sd::SdState::OFF) {
|
if (active.first == sd::SdState::OFF) {
|
||||||
@ -156,7 +156,7 @@ ReturnValue_t SdCardManager::switchOffSdCard(sd::SdCard sdCard, bool doUnmountSd
|
|||||||
|
|
||||||
if (doUnmountSdCard) {
|
if (doUnmountSdCard) {
|
||||||
result = unmountSdCard(sdCard);
|
result = unmountSdCard(sdCard);
|
||||||
if (result != HasReturnvaluesIF::RETURN_OK) {
|
if (result != returnvalue::OK) {
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -187,7 +187,7 @@ ReturnValue_t SdCardManager::setSdCardState(sd::SdCard sdCard, bool on) {
|
|||||||
command << "q7hw sd set " << sdstring << " " << statestring;
|
command << "q7hw sd set " << sdstring << " " << statestring;
|
||||||
cmdExecutor.load(command.str(), blocking, printCmdOutput);
|
cmdExecutor.load(command.str(), blocking, printCmdOutput);
|
||||||
ReturnValue_t result = cmdExecutor.execute();
|
ReturnValue_t result = cmdExecutor.execute();
|
||||||
if (blocking and result != HasReturnvaluesIF::RETURN_OK) {
|
if (blocking and result != returnvalue::OK) {
|
||||||
utility::handleSystemError(cmdExecutor.getLastError(), "SdCardManager::setSdCardState");
|
utility::handleSystemError(cmdExecutor.getLastError(), "SdCardManager::setSdCardState");
|
||||||
}
|
}
|
||||||
return result;
|
return result;
|
||||||
@ -212,7 +212,7 @@ ReturnValue_t SdCardManager::getSdCardsStatus(SdStatePair& active) {
|
|||||||
while (std::getline(sdStatus, line)) {
|
while (std::getline(sdStatus, line)) {
|
||||||
processSdStatusLine(active, line, idx, currentSd);
|
processSdStatusLine(active, line, idx, currentSd);
|
||||||
}
|
}
|
||||||
return HasReturnvaluesIF::RETURN_OK;
|
return returnvalue::OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
ReturnValue_t SdCardManager::mountSdCard(sd::SdCard sdCard) {
|
ReturnValue_t SdCardManager::mountSdCard(sd::SdCard sdCard) {
|
||||||
@ -223,7 +223,7 @@ ReturnValue_t SdCardManager::mountSdCard(sd::SdCard sdCard) {
|
|||||||
if (sdCard == sd::SdCard::BOTH) {
|
if (sdCard == sd::SdCard::BOTH) {
|
||||||
sif::warning << "SdCardManager::mountSdCard: API does not allow sd::SdStatus::BOTH"
|
sif::warning << "SdCardManager::mountSdCard: API does not allow sd::SdStatus::BOTH"
|
||||||
<< std::endl;
|
<< std::endl;
|
||||||
return HasReturnvaluesIF::RETURN_FAILED;
|
return returnvalue::FAILED;
|
||||||
}
|
}
|
||||||
string mountDev;
|
string mountDev;
|
||||||
string mountPoint;
|
string mountPoint;
|
||||||
@ -247,7 +247,7 @@ ReturnValue_t SdCardManager::mountSdCard(sd::SdCard sdCard) {
|
|||||||
string sdMountCommand = "mount " + mountDev + " " + mountPoint;
|
string sdMountCommand = "mount " + mountDev + " " + mountPoint;
|
||||||
cmdExecutor.load(sdMountCommand, blocking, printCmdOutput);
|
cmdExecutor.load(sdMountCommand, blocking, printCmdOutput);
|
||||||
ReturnValue_t result = cmdExecutor.execute();
|
ReturnValue_t result = cmdExecutor.execute();
|
||||||
if (blocking and result != HasReturnvaluesIF::RETURN_OK) {
|
if (blocking and result != returnvalue::OK) {
|
||||||
utility::handleSystemError(cmdExecutor.getLastError(), "SdCardManager::mountSdCard");
|
utility::handleSystemError(cmdExecutor.getLastError(), "SdCardManager::mountSdCard");
|
||||||
}
|
}
|
||||||
return result;
|
return result;
|
||||||
@ -261,7 +261,7 @@ ReturnValue_t SdCardManager::unmountSdCard(sd::SdCard sdCard) {
|
|||||||
if (sdCard == sd::SdCard::BOTH) {
|
if (sdCard == sd::SdCard::BOTH) {
|
||||||
sif::warning << "SdCardManager::unmountSdCard: API does not allow sd::SdStatus::BOTH"
|
sif::warning << "SdCardManager::unmountSdCard: API does not allow sd::SdStatus::BOTH"
|
||||||
<< std::endl;
|
<< std::endl;
|
||||||
return HasReturnvaluesIF::RETURN_FAILED;
|
return returnvalue::FAILED;
|
||||||
}
|
}
|
||||||
string mountPoint;
|
string mountPoint;
|
||||||
if (sdCard == sd::SdCard::SLOT_0) {
|
if (sdCard == sd::SdCard::SLOT_0) {
|
||||||
@ -285,7 +285,7 @@ ReturnValue_t SdCardManager::unmountSdCard(sd::SdCard sdCard) {
|
|||||||
}
|
}
|
||||||
cmdExecutor.load(sdUnmountCommand, blocking, printCmdOutput);
|
cmdExecutor.load(sdUnmountCommand, blocking, printCmdOutput);
|
||||||
ReturnValue_t result = cmdExecutor.execute();
|
ReturnValue_t result = cmdExecutor.execute();
|
||||||
if (blocking and result != HasReturnvaluesIF::RETURN_OK) {
|
if (blocking and result != returnvalue::OK) {
|
||||||
utility::handleSystemError(cmdExecutor.getLastError(), "SdCardManager::unmountSdCard");
|
utility::handleSystemError(cmdExecutor.getLastError(), "SdCardManager::unmountSdCard");
|
||||||
}
|
}
|
||||||
return result;
|
return result;
|
||||||
@ -293,7 +293,7 @@ ReturnValue_t SdCardManager::unmountSdCard(sd::SdCard sdCard) {
|
|||||||
|
|
||||||
ReturnValue_t SdCardManager::sanitizeState(SdStatePair* statusPair, sd::SdCard prefSdCard) {
|
ReturnValue_t SdCardManager::sanitizeState(SdStatePair* statusPair, sd::SdCard prefSdCard) {
|
||||||
std::unique_ptr<SdStatePair> sdStatusPtr;
|
std::unique_ptr<SdStatePair> sdStatusPtr;
|
||||||
ReturnValue_t result = HasReturnvaluesIF::RETURN_OK;
|
ReturnValue_t result = returnvalue::OK;
|
||||||
// Enforce blocking operation for now. Be careful to reset it when returning prematurely!
|
// Enforce blocking operation for now. Be careful to reset it when returning prematurely!
|
||||||
bool resetNonBlockingState = false;
|
bool resetNonBlockingState = false;
|
||||||
if (not this->blocking) {
|
if (not this->blocking) {
|
||||||
@ -302,7 +302,7 @@ ReturnValue_t SdCardManager::sanitizeState(SdStatePair* statusPair, sd::SdCard p
|
|||||||
}
|
}
|
||||||
if (prefSdCard == sd::SdCard::NONE) {
|
if (prefSdCard == sd::SdCard::NONE) {
|
||||||
result = getPreferredSdCard();
|
result = getPreferredSdCard();
|
||||||
if (result != HasReturnvaluesIF::RETURN_OK) {
|
if (result != returnvalue::OK) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (statusPair == nullptr) {
|
if (statusPair == nullptr) {
|
||||||
@ -382,7 +382,7 @@ void SdCardManager::processSdStatusLine(std::pair<sd::SdState, sd::SdState>& act
|
|||||||
sd::SdCard SdCardManager::getPreferredSdCard() const {
|
sd::SdCard SdCardManager::getPreferredSdCard() const {
|
||||||
MutexGuard mg(mutex);
|
MutexGuard mg(mutex);
|
||||||
auto res = mg.getLockResult();
|
auto res = mg.getLockResult();
|
||||||
if (res != RETURN_OK) {
|
if (res != returnvalue::OK) {
|
||||||
sif::error << "SdCardManager::getPreferredSdCard: Lock error" << std::endl;
|
sif::error << "SdCardManager::getPreferredSdCard: Lock error" << std::endl;
|
||||||
}
|
}
|
||||||
return sdInfo.pref;
|
return sdInfo.pref;
|
||||||
@ -391,7 +391,7 @@ sd::SdCard SdCardManager::getPreferredSdCard() const {
|
|||||||
ReturnValue_t SdCardManager::setPreferredSdCard(sd::SdCard sdCard) {
|
ReturnValue_t SdCardManager::setPreferredSdCard(sd::SdCard sdCard) {
|
||||||
MutexGuard mg(mutex);
|
MutexGuard mg(mutex);
|
||||||
if (sdCard == sd::SdCard::BOTH) {
|
if (sdCard == sd::SdCard::BOTH) {
|
||||||
return HasReturnvaluesIF::RETURN_FAILED;
|
return returnvalue::FAILED;
|
||||||
}
|
}
|
||||||
sdInfo.pref = sdCard;
|
sdInfo.pref = sdCard;
|
||||||
return scratch::writeNumber(scratch::PREFERED_SDC_KEY, static_cast<uint8_t>(sdCard));
|
return scratch::writeNumber(scratch::PREFERED_SDC_KEY, static_cast<uint8_t>(sdCard));
|
||||||
@ -406,7 +406,7 @@ ReturnValue_t SdCardManager::updateSdCardStateFile() {
|
|||||||
std::string updateCmd = "q7hw sd info all > " + std::string(SD_STATE_FILE);
|
std::string updateCmd = "q7hw sd info all > " + std::string(SD_STATE_FILE);
|
||||||
cmdExecutor.load(updateCmd, blocking, printCmdOutput);
|
cmdExecutor.load(updateCmd, blocking, printCmdOutput);
|
||||||
ReturnValue_t result = cmdExecutor.execute();
|
ReturnValue_t result = cmdExecutor.execute();
|
||||||
if (blocking and result != HasReturnvaluesIF::RETURN_OK) {
|
if (blocking and result != returnvalue::OK) {
|
||||||
utility::handleSystemError(cmdExecutor.getLastError(), "SdCardManager::mountSdCard");
|
utility::handleSystemError(cmdExecutor.getLastError(), "SdCardManager::mountSdCard");
|
||||||
}
|
}
|
||||||
return result;
|
return result;
|
||||||
@ -448,10 +448,10 @@ SdCardManager::OpStatus SdCardManager::checkCurrentOp(Operations& currentOp) {
|
|||||||
case (CommandExecutor::EXECUTION_FINISHED): {
|
case (CommandExecutor::EXECUTION_FINISHED): {
|
||||||
return OpStatus::SUCCESS;
|
return OpStatus::SUCCESS;
|
||||||
}
|
}
|
||||||
case (HasReturnvaluesIF::RETURN_OK): {
|
case (returnvalue::OK): {
|
||||||
return OpStatus::ONGOING;
|
return OpStatus::ONGOING;
|
||||||
}
|
}
|
||||||
case (HasReturnvaluesIF::RETURN_FAILED): {
|
case (returnvalue::FAILED): {
|
||||||
return OpStatus::FAIL;
|
return OpStatus::FAIL;
|
||||||
}
|
}
|
||||||
default: {
|
default: {
|
||||||
@ -469,7 +469,7 @@ bool SdCardManager::isSdCardMounted(sd::SdCard sdCard) {
|
|||||||
SdCardManager::SdStatePair active;
|
SdCardManager::SdStatePair active;
|
||||||
ReturnValue_t result = this->getSdCardsStatus(active);
|
ReturnValue_t result = this->getSdCardsStatus(active);
|
||||||
|
|
||||||
if (result != HasReturnvaluesIF::RETURN_OK) {
|
if (result != returnvalue::OK) {
|
||||||
sif::debug << "SdCardManager::isSdCardMounted: Failed to get SD card active state";
|
sif::debug << "SdCardManager::isSdCardMounted: Failed to get SD card active state";
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
@ -499,15 +499,15 @@ ReturnValue_t SdCardManager::isSdCardMountedReadOnly(sd::SdCard sdcard, bool& re
|
|||||||
command << "grep -q '" << SD_1_MOUNT_POINT << " vfat ro,' /proc/mounts";
|
command << "grep -q '" << SD_1_MOUNT_POINT << " vfat ro,' /proc/mounts";
|
||||||
}
|
}
|
||||||
ReturnValue_t result = cmdExecutor.load(command.str(), true, false);
|
ReturnValue_t result = cmdExecutor.load(command.str(), true, false);
|
||||||
if (result != HasReturnvaluesIF::RETURN_OK) {
|
if (result != returnvalue::OK) {
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
result = cmdExecutor.execute();
|
result = cmdExecutor.execute();
|
||||||
if (result != HasReturnvaluesIF::RETURN_OK) {
|
if (result != returnvalue::OK) {
|
||||||
int exitStatus = cmdExecutor.getLastError();
|
int exitStatus = cmdExecutor.getLastError();
|
||||||
if (exitStatus == 1) {
|
if (exitStatus == 1) {
|
||||||
readOnly = false;
|
readOnly = false;
|
||||||
return RETURN_OK;
|
return returnvalue::OK;
|
||||||
}
|
}
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
@ -517,7 +517,7 @@ ReturnValue_t SdCardManager::isSdCardMountedReadOnly(sd::SdCard sdcard, bool& re
|
|||||||
readOnly = false;
|
readOnly = false;
|
||||||
}
|
}
|
||||||
readOnly = true;
|
readOnly = true;
|
||||||
return HasReturnvaluesIF::RETURN_OK;
|
return returnvalue::OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
ReturnValue_t SdCardManager::remountReadWrite(sd::SdCard sdcard) {
|
ReturnValue_t SdCardManager::remountReadWrite(sd::SdCard sdcard) {
|
||||||
@ -528,7 +528,7 @@ ReturnValue_t SdCardManager::remountReadWrite(sd::SdCard sdcard) {
|
|||||||
command << "mount -o remount,rw " << SD_1_DEV_NAME << " " << SD_1_MOUNT_POINT;
|
command << "mount -o remount,rw " << SD_1_DEV_NAME << " " << SD_1_MOUNT_POINT;
|
||||||
}
|
}
|
||||||
ReturnValue_t result = cmdExecutor.load(command.str(), true, false);
|
ReturnValue_t result = cmdExecutor.load(command.str(), true, false);
|
||||||
if (result != HasReturnvaluesIF::RETURN_OK) {
|
if (result != returnvalue::OK) {
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
return cmdExecutor.execute();
|
return cmdExecutor.execute();
|
||||||
@ -542,11 +542,11 @@ ReturnValue_t SdCardManager::performFsck(sd::SdCard sdcard, bool printOutput, in
|
|||||||
command << "fsck -y " << SD_1_DEV_NAME;
|
command << "fsck -y " << SD_1_DEV_NAME;
|
||||||
}
|
}
|
||||||
ReturnValue_t result = cmdExecutor.load(command.str(), true, printOutput);
|
ReturnValue_t result = cmdExecutor.load(command.str(), true, printOutput);
|
||||||
if (result != HasReturnvaluesIF::RETURN_OK) {
|
if (result != returnvalue::OK) {
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
result = cmdExecutor.execute();
|
result = cmdExecutor.execute();
|
||||||
if (result != HasReturnvaluesIF::RETURN_OK) {
|
if (result != returnvalue::OK) {
|
||||||
linuxError = cmdExecutor.getLastError();
|
linuxError = cmdExecutor.getLastError();
|
||||||
}
|
}
|
||||||
return result;
|
return result;
|
||||||
|
@ -12,7 +12,7 @@
|
|||||||
|
|
||||||
#include "events/subsystemIdRanges.h"
|
#include "events/subsystemIdRanges.h"
|
||||||
#include "fsfw/events/Event.h"
|
#include "fsfw/events/Event.h"
|
||||||
#include "fsfw/returnvalues/HasReturnvaluesIF.h"
|
#include "fsfw/returnvalues/returnvalue.h"
|
||||||
#include "fsfw_hal/linux/CommandExecutor.h"
|
#include "fsfw_hal/linux/CommandExecutor.h"
|
||||||
#include "mission/memory/SdCardMountedIF.h"
|
#include "mission/memory/SdCardMountedIF.h"
|
||||||
#include "mission/memory/definitions.h"
|
#include "mission/memory/definitions.h"
|
||||||
@ -24,7 +24,7 @@ class MutexIF;
|
|||||||
* @brief Manages handling of SD cards like switching them on or off or getting the current
|
* @brief Manages handling of SD cards like switching them on or off or getting the current
|
||||||
* state
|
* state
|
||||||
*/
|
*/
|
||||||
class SdCardManager : public SystemObject, public HasReturnvaluesIF, public SdCardMountedIF {
|
class SdCardManager : public SystemObject, public SdCardMountedIF {
|
||||||
friend class SdCardAccess;
|
friend class SdCardAccess;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
@ -44,22 +44,17 @@ class SdCardManager : public SystemObject, public HasReturnvaluesIF, public SdCa
|
|||||||
|
|
||||||
static constexpr uint8_t INTERFACE_ID = CLASS_ID::SD_CARD_MANAGER;
|
static constexpr uint8_t INTERFACE_ID = CLASS_ID::SD_CARD_MANAGER;
|
||||||
|
|
||||||
static constexpr ReturnValue_t OP_ONGOING = HasReturnvaluesIF::makeReturnCode(INTERFACE_ID, 0);
|
static constexpr ReturnValue_t OP_ONGOING = returnvalue::makeCode(INTERFACE_ID, 0);
|
||||||
static constexpr ReturnValue_t ALREADY_ON = HasReturnvaluesIF::makeReturnCode(INTERFACE_ID, 1);
|
static constexpr ReturnValue_t ALREADY_ON = returnvalue::makeCode(INTERFACE_ID, 1);
|
||||||
static constexpr ReturnValue_t ALREADY_MOUNTED =
|
static constexpr ReturnValue_t ALREADY_MOUNTED = returnvalue::makeCode(INTERFACE_ID, 2);
|
||||||
HasReturnvaluesIF::makeReturnCode(INTERFACE_ID, 2);
|
static constexpr ReturnValue_t ALREADY_OFF = returnvalue::makeCode(INTERFACE_ID, 3);
|
||||||
static constexpr ReturnValue_t ALREADY_OFF = HasReturnvaluesIF::makeReturnCode(INTERFACE_ID, 3);
|
static constexpr ReturnValue_t STATUS_FILE_NEXISTS = returnvalue::makeCode(INTERFACE_ID, 10);
|
||||||
static constexpr ReturnValue_t STATUS_FILE_NEXISTS =
|
|
||||||
HasReturnvaluesIF::makeReturnCode(INTERFACE_ID, 10);
|
|
||||||
static constexpr ReturnValue_t STATUS_FILE_FORMAT_INVALID =
|
static constexpr ReturnValue_t STATUS_FILE_FORMAT_INVALID =
|
||||||
HasReturnvaluesIF::makeReturnCode(INTERFACE_ID, 11);
|
returnvalue::makeCode(INTERFACE_ID, 11);
|
||||||
static constexpr ReturnValue_t MOUNT_ERROR = HasReturnvaluesIF::makeReturnCode(INTERFACE_ID, 12);
|
static constexpr ReturnValue_t MOUNT_ERROR = returnvalue::makeCode(INTERFACE_ID, 12);
|
||||||
static constexpr ReturnValue_t UNMOUNT_ERROR =
|
static constexpr ReturnValue_t UNMOUNT_ERROR = returnvalue::makeCode(INTERFACE_ID, 13);
|
||||||
HasReturnvaluesIF::makeReturnCode(INTERFACE_ID, 13);
|
static constexpr ReturnValue_t SYSTEM_CALL_ERROR = returnvalue::makeCode(INTERFACE_ID, 14);
|
||||||
static constexpr ReturnValue_t SYSTEM_CALL_ERROR =
|
static constexpr ReturnValue_t POPEN_CALL_ERROR = returnvalue::makeCode(INTERFACE_ID, 15);
|
||||||
HasReturnvaluesIF::makeReturnCode(INTERFACE_ID, 14);
|
|
||||||
static constexpr ReturnValue_t POPEN_CALL_ERROR =
|
|
||||||
HasReturnvaluesIF::makeReturnCode(INTERFACE_ID, 15);
|
|
||||||
|
|
||||||
static constexpr uint8_t SUBSYSTEM_ID = SUBSYSTEM_ID::FILE_SYSTEM;
|
static constexpr uint8_t SUBSYSTEM_ID = SUBSYSTEM_ID::FILE_SYSTEM;
|
||||||
|
|
||||||
@ -105,7 +100,7 @@ class SdCardManager : public SystemObject, public HasReturnvaluesIF, public SdCa
|
|||||||
* @param doMountSdCard Mount the SD card after switching it on, which is necessary
|
* @param doMountSdCard Mount the SD card after switching it on, which is necessary
|
||||||
* to use it
|
* to use it
|
||||||
* @param statusPair If the status pair is already available, it can be passed here
|
* @param statusPair If the status pair is already available, it can be passed here
|
||||||
* @return - RETURN_OK on success, ALREADY_ON if it is already on,
|
* @return - returnvalue::OK on success, ALREADY_ON if it is already on,
|
||||||
* SYSTEM_CALL_ERROR on system error
|
* SYSTEM_CALL_ERROR on system error
|
||||||
*/
|
*/
|
||||||
ReturnValue_t switchOnSdCard(sd::SdCard sdCard, bool doMountSdCard = true,
|
ReturnValue_t switchOnSdCard(sd::SdCard sdCard, bool doMountSdCard = true,
|
||||||
@ -117,7 +112,7 @@ class SdCardManager : public SystemObject, public HasReturnvaluesIF, public SdCa
|
|||||||
* @param doUnmountSdCard Unmount the SD card before switching the card off, which makes
|
* @param doUnmountSdCard Unmount the SD card before switching the card off, which makes
|
||||||
* the operation safer
|
* the operation safer
|
||||||
* @param statusPair If the status pair is already available, it can be passed here
|
* @param statusPair If the status pair is already available, it can be passed here
|
||||||
* @return - RETURN_OK on success, ALREADY_ON if it is already on,
|
* @return - returnvalue::OK on success, ALREADY_ON if it is already on,
|
||||||
* SYSTEM_CALL_ERROR on system error
|
* SYSTEM_CALL_ERROR on system error
|
||||||
*/
|
*/
|
||||||
ReturnValue_t switchOffSdCard(sd::SdCard sdCard, bool doUnmountSdCard = true,
|
ReturnValue_t switchOffSdCard(sd::SdCard sdCard, bool doUnmountSdCard = true,
|
||||||
@ -127,9 +122,9 @@ class SdCardManager : public SystemObject, public HasReturnvaluesIF, public SdCa
|
|||||||
* Update the state file or creates one if it does not exist. You need to call this
|
* Update the state file or creates one if it does not exist. You need to call this
|
||||||
* function before calling #sdCardActive
|
* function before calling #sdCardActive
|
||||||
* @return
|
* @return
|
||||||
* - RETURN_OK if the state file was updated successfully
|
* - returnvalue::OK if the state file was updated successfully
|
||||||
* - CommandExecutor::COMMAND_PENDING: Non-blocking command is pending
|
* - CommandExecutor::COMMAND_PENDING: Non-blocking command is pending
|
||||||
* - RETURN_FAILED: blocking command failed
|
* - returnvalue::FAILED: blocking command failed
|
||||||
*/
|
*/
|
||||||
ReturnValue_t updateSdCardStateFile();
|
ReturnValue_t updateSdCardStateFile();
|
||||||
|
|
||||||
@ -139,7 +134,7 @@ class SdCardManager : public SystemObject, public HasReturnvaluesIF, public SdCa
|
|||||||
* the status of the SD cards and set the field of the provided boolean pair.
|
* the status of the SD cards and set the field of the provided boolean pair.
|
||||||
* @param active Pair of booleans, where the first entry is the state of the first SD card
|
* @param active Pair of booleans, where the first entry is the state of the first SD card
|
||||||
* and the second one the state of the second SD card
|
* and the second one the state of the second SD card
|
||||||
* @return - RETURN_OK if the state was read successfully
|
* @return - returnvalue::OK if the state was read successfully
|
||||||
* - STATUS_FILE_FORMAT_INVALID if there was an issue with the state file. The user
|
* - STATUS_FILE_FORMAT_INVALID if there was an issue with the state file. The user
|
||||||
* should call #updateSdCardStateFile again in that case
|
* should call #updateSdCardStateFile again in that case
|
||||||
* - STATUS_FILE_NEXISTS if the status file does not exist
|
* - STATUS_FILE_NEXISTS if the status file does not exist
|
||||||
|
@ -6,23 +6,23 @@ ReturnValue_t scratch::writeString(std::string name, std::string string) {
|
|||||||
int result = std::system(oss.str().c_str());
|
int result = std::system(oss.str().c_str());
|
||||||
if (result != 0) {
|
if (result != 0) {
|
||||||
utility::handleSystemError(result, "scratch::writeString");
|
utility::handleSystemError(result, "scratch::writeString");
|
||||||
return HasReturnvaluesIF::RETURN_FAILED;
|
return returnvalue::FAILED;
|
||||||
}
|
}
|
||||||
return HasReturnvaluesIF::RETURN_OK;
|
return returnvalue::OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
ReturnValue_t scratch::readString(std::string key, std::string &string) {
|
ReturnValue_t scratch::readString(std::string key, std::string &string) {
|
||||||
std::ifstream file;
|
std::ifstream file;
|
||||||
std::string filename;
|
std::string filename;
|
||||||
ReturnValue_t result = readToFile(key, file, filename);
|
ReturnValue_t result = readToFile(key, file, filename);
|
||||||
if (result != HasReturnvaluesIF::RETURN_OK) {
|
if (result != returnvalue::OK) {
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
std::string line;
|
std::string line;
|
||||||
if (not std::getline(file, line)) {
|
if (not std::getline(file, line)) {
|
||||||
std::remove(filename.c_str());
|
std::remove(filename.c_str());
|
||||||
return HasReturnvaluesIF::RETURN_FAILED;
|
return returnvalue::FAILED;
|
||||||
}
|
}
|
||||||
|
|
||||||
size_t pos = line.find("=");
|
size_t pos = line.find("=");
|
||||||
@ -35,7 +35,7 @@ ReturnValue_t scratch::readString(std::string key, std::string &string) {
|
|||||||
return KEY_NOT_FOUND;
|
return KEY_NOT_FOUND;
|
||||||
}
|
}
|
||||||
string = line.substr(pos + 1);
|
string = line.substr(pos + 1);
|
||||||
return HasReturnvaluesIF::RETURN_OK;
|
return returnvalue::OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
ReturnValue_t scratch::clearValue(std::string key) {
|
ReturnValue_t scratch::clearValue(std::string key) {
|
||||||
@ -44,7 +44,7 @@ ReturnValue_t scratch::clearValue(std::string key) {
|
|||||||
int result = std::system(oss.str().c_str());
|
int result = std::system(oss.str().c_str());
|
||||||
if (result != 0) {
|
if (result != 0) {
|
||||||
utility::handleSystemError(result, "scratch::clearValue");
|
utility::handleSystemError(result, "scratch::clearValue");
|
||||||
return HasReturnvaluesIF::RETURN_FAILED;
|
return returnvalue::FAILED;
|
||||||
}
|
}
|
||||||
return HasReturnvaluesIF::RETURN_OK;
|
return returnvalue::OK;
|
||||||
}
|
}
|
||||||
|
@ -7,7 +7,7 @@
|
|||||||
#include <sstream>
|
#include <sstream>
|
||||||
#include <type_traits>
|
#include <type_traits>
|
||||||
|
|
||||||
#include "fsfw/returnvalues/HasReturnvaluesIF.h"
|
#include "fsfw/returnvalues/returnvalue.h"
|
||||||
#include "fsfw/serviceinterface/ServiceInterface.h"
|
#include "fsfw/serviceinterface/ServiceInterface.h"
|
||||||
#include "linux/utility/utility.h"
|
#include "linux/utility/utility.h"
|
||||||
#include "returnvalues/classIds.h"
|
#include "returnvalues/classIds.h"
|
||||||
@ -21,7 +21,7 @@ static constexpr char PREFERED_SDC_KEY[] = "PREFSD";
|
|||||||
static constexpr char ALLOC_FAILURE_COUNT[] = "ALLOCERR";
|
static constexpr char ALLOC_FAILURE_COUNT[] = "ALLOCERR";
|
||||||
|
|
||||||
static constexpr uint8_t INTERFACE_ID = CLASS_ID::SCRATCH_BUFFER;
|
static constexpr uint8_t INTERFACE_ID = CLASS_ID::SCRATCH_BUFFER;
|
||||||
static constexpr ReturnValue_t KEY_NOT_FOUND = HasReturnvaluesIF::makeReturnCode(INTERFACE_ID, 0);
|
static constexpr ReturnValue_t KEY_NOT_FOUND = returnvalue::makeCode(INTERFACE_ID, 0);
|
||||||
|
|
||||||
ReturnValue_t clearValue(std::string key);
|
ReturnValue_t clearValue(std::string key);
|
||||||
|
|
||||||
@ -83,11 +83,11 @@ ReturnValue_t readToFile(std::string name, std::ifstream& file, std::string& fil
|
|||||||
} else {
|
} else {
|
||||||
utility::handleSystemError(result, "scratch::readToFile");
|
utility::handleSystemError(result, "scratch::readToFile");
|
||||||
std::remove(filename.c_str());
|
std::remove(filename.c_str());
|
||||||
return HasReturnvaluesIF::RETURN_FAILED;
|
return returnvalue::FAILED;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
file.open(filename);
|
file.open(filename);
|
||||||
return HasReturnvaluesIF::RETURN_OK;
|
return returnvalue::OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
} // End of anonymous namespace
|
} // End of anonymous namespace
|
||||||
@ -99,9 +99,9 @@ inline ReturnValue_t writeNumber(std::string key, T num) noexcept {
|
|||||||
int result = std::system(oss.str().c_str());
|
int result = std::system(oss.str().c_str());
|
||||||
if (result != 0) {
|
if (result != 0) {
|
||||||
utility::handleSystemError(result, "scratch::writeNumber");
|
utility::handleSystemError(result, "scratch::writeNumber");
|
||||||
return HasReturnvaluesIF::RETURN_FAILED;
|
return returnvalue::FAILED;
|
||||||
}
|
}
|
||||||
return HasReturnvaluesIF::RETURN_OK;
|
return returnvalue::OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
template <typename T, class = typename std::enable_if<std::is_integral<T>::value>::type>
|
template <typename T, class = typename std::enable_if<std::is_integral<T>::value>::type>
|
||||||
@ -110,7 +110,7 @@ inline ReturnValue_t readNumber(std::string key, T& num) noexcept {
|
|||||||
ifstream file;
|
ifstream file;
|
||||||
std::string filename;
|
std::string filename;
|
||||||
ReturnValue_t result = readToFile(key, file, filename);
|
ReturnValue_t result = readToFile(key, file, filename);
|
||||||
if (result != HasReturnvaluesIF::RETURN_OK) {
|
if (result != returnvalue::OK) {
|
||||||
std::remove(filename.c_str());
|
std::remove(filename.c_str());
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
@ -118,7 +118,7 @@ inline ReturnValue_t readNumber(std::string key, T& num) noexcept {
|
|||||||
string line;
|
string line;
|
||||||
if (not std::getline(file, line)) {
|
if (not std::getline(file, line)) {
|
||||||
std::remove(filename.c_str());
|
std::remove(filename.c_str());
|
||||||
return HasReturnvaluesIF::RETURN_FAILED;
|
return returnvalue::FAILED;
|
||||||
}
|
}
|
||||||
|
|
||||||
size_t pos = line.find("=");
|
size_t pos = line.find("=");
|
||||||
@ -138,7 +138,7 @@ inline ReturnValue_t readNumber(std::string key, T& num) noexcept {
|
|||||||
}
|
}
|
||||||
|
|
||||||
std::remove(filename.c_str());
|
std::remove(filename.c_str());
|
||||||
return HasReturnvaluesIF::RETURN_OK;
|
return returnvalue::OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
} // namespace scratch
|
} // namespace scratch
|
||||||
|
@ -12,20 +12,20 @@ Xadc::Xadc() {}
|
|||||||
Xadc::~Xadc() {}
|
Xadc::~Xadc() {}
|
||||||
|
|
||||||
ReturnValue_t Xadc::getTemperature(float& temperature) {
|
ReturnValue_t Xadc::getTemperature(float& temperature) {
|
||||||
ReturnValue_t result = HasReturnvaluesIF::RETURN_OK;
|
ReturnValue_t result = returnvalue::OK;
|
||||||
int raw = 0;
|
int raw = 0;
|
||||||
int offset = 0;
|
int offset = 0;
|
||||||
float scale = 0;
|
float scale = 0;
|
||||||
result = readValFromFile<int>(xadc::file::tempRaw.c_str(), raw);
|
result = readValFromFile<int>(xadc::file::tempRaw.c_str(), raw);
|
||||||
if (result != HasReturnvaluesIF::RETURN_OK) {
|
if (result != returnvalue::OK) {
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
result = readValFromFile<int>(xadc::file::tempOffset.c_str(), offset);
|
result = readValFromFile<int>(xadc::file::tempOffset.c_str(), offset);
|
||||||
if (result != HasReturnvaluesIF::RETURN_OK) {
|
if (result != returnvalue::OK) {
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
result = readValFromFile<float>(xadc::file::tempScale.c_str(), scale);
|
result = readValFromFile<float>(xadc::file::tempScale.c_str(), scale);
|
||||||
if (result != HasReturnvaluesIF::RETURN_OK) {
|
if (result != returnvalue::OK) {
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
temperature = (raw + offset) * scale / 1000;
|
temperature = (raw + offset) * scale / 1000;
|
||||||
@ -35,84 +35,84 @@ ReturnValue_t Xadc::getTemperature(float& temperature) {
|
|||||||
ReturnValue_t Xadc::getVccPint(float& vccPint) {
|
ReturnValue_t Xadc::getVccPint(float& vccPint) {
|
||||||
ReturnValue_t result =
|
ReturnValue_t result =
|
||||||
readVoltageFromSysfs(xadc::file::vccpintRaw, xadc::file::vccpintScale, vccPint);
|
readVoltageFromSysfs(xadc::file::vccpintRaw, xadc::file::vccpintScale, vccPint);
|
||||||
if (result != HasReturnvaluesIF::RETURN_OK) {
|
if (result != returnvalue::OK) {
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
return HasReturnvaluesIF::RETURN_OK;
|
return returnvalue::OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
ReturnValue_t Xadc::getVccPaux(float& vccPaux) {
|
ReturnValue_t Xadc::getVccPaux(float& vccPaux) {
|
||||||
ReturnValue_t result =
|
ReturnValue_t result =
|
||||||
readVoltageFromSysfs(xadc::file::vccpauxRaw, xadc::file::vccpauxScale, vccPaux);
|
readVoltageFromSysfs(xadc::file::vccpauxRaw, xadc::file::vccpauxScale, vccPaux);
|
||||||
if (result != HasReturnvaluesIF::RETURN_OK) {
|
if (result != returnvalue::OK) {
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
return HasReturnvaluesIF::RETURN_OK;
|
return returnvalue::OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
ReturnValue_t Xadc::getVccInt(float& vccInt) {
|
ReturnValue_t Xadc::getVccInt(float& vccInt) {
|
||||||
ReturnValue_t result =
|
ReturnValue_t result =
|
||||||
readVoltageFromSysfs(xadc::file::vccintRaw, xadc::file::vccintScale, vccInt);
|
readVoltageFromSysfs(xadc::file::vccintRaw, xadc::file::vccintScale, vccInt);
|
||||||
if (result != HasReturnvaluesIF::RETURN_OK) {
|
if (result != returnvalue::OK) {
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
return HasReturnvaluesIF::RETURN_OK;
|
return returnvalue::OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
ReturnValue_t Xadc::getVccAux(float& vccAux) {
|
ReturnValue_t Xadc::getVccAux(float& vccAux) {
|
||||||
ReturnValue_t result =
|
ReturnValue_t result =
|
||||||
readVoltageFromSysfs(xadc::file::vccauxRaw, xadc::file::vccauxScale, vccAux);
|
readVoltageFromSysfs(xadc::file::vccauxRaw, xadc::file::vccauxScale, vccAux);
|
||||||
if (result != HasReturnvaluesIF::RETURN_OK) {
|
if (result != returnvalue::OK) {
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
return HasReturnvaluesIF::RETURN_OK;
|
return returnvalue::OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
ReturnValue_t Xadc::getVccBram(float& vccBram) {
|
ReturnValue_t Xadc::getVccBram(float& vccBram) {
|
||||||
ReturnValue_t result =
|
ReturnValue_t result =
|
||||||
readVoltageFromSysfs(xadc::file::vccbramRaw, xadc::file::vccbramScale, vccBram);
|
readVoltageFromSysfs(xadc::file::vccbramRaw, xadc::file::vccbramScale, vccBram);
|
||||||
if (result != HasReturnvaluesIF::RETURN_OK) {
|
if (result != returnvalue::OK) {
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
return HasReturnvaluesIF::RETURN_OK;
|
return returnvalue::OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
ReturnValue_t Xadc::getVccOddr(float& vccOddr) {
|
ReturnValue_t Xadc::getVccOddr(float& vccOddr) {
|
||||||
ReturnValue_t result =
|
ReturnValue_t result =
|
||||||
readVoltageFromSysfs(xadc::file::vccoddrRaw, xadc::file::vccoddrScale, vccOddr);
|
readVoltageFromSysfs(xadc::file::vccoddrRaw, xadc::file::vccoddrScale, vccOddr);
|
||||||
if (result != HasReturnvaluesIF::RETURN_OK) {
|
if (result != returnvalue::OK) {
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
return HasReturnvaluesIF::RETURN_OK;
|
return returnvalue::OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
ReturnValue_t Xadc::getVrefp(float& vrefp) {
|
ReturnValue_t Xadc::getVrefp(float& vrefp) {
|
||||||
ReturnValue_t result = readVoltageFromSysfs(xadc::file::vrefpRaw, xadc::file::vrefpScale, vrefp);
|
ReturnValue_t result = readVoltageFromSysfs(xadc::file::vrefpRaw, xadc::file::vrefpScale, vrefp);
|
||||||
if (result != HasReturnvaluesIF::RETURN_OK) {
|
if (result != returnvalue::OK) {
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
return HasReturnvaluesIF::RETURN_OK;
|
return returnvalue::OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
ReturnValue_t Xadc::getVrefn(float& vrefn) {
|
ReturnValue_t Xadc::getVrefn(float& vrefn) {
|
||||||
ReturnValue_t result = readVoltageFromSysfs(xadc::file::vrefnRaw, xadc::file::vrefnScale, vrefn);
|
ReturnValue_t result = readVoltageFromSysfs(xadc::file::vrefnRaw, xadc::file::vrefnScale, vrefn);
|
||||||
if (result != HasReturnvaluesIF::RETURN_OK) {
|
if (result != returnvalue::OK) {
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
return HasReturnvaluesIF::RETURN_OK;
|
return returnvalue::OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
ReturnValue_t Xadc::readVoltageFromSysfs(std::string rawFile, std::string scaleFile,
|
ReturnValue_t Xadc::readVoltageFromSysfs(std::string rawFile, std::string scaleFile,
|
||||||
float& voltage) {
|
float& voltage) {
|
||||||
ReturnValue_t result = HasReturnvaluesIF::RETURN_OK;
|
ReturnValue_t result = returnvalue::OK;
|
||||||
float raw = 0;
|
float raw = 0;
|
||||||
float scale = 0;
|
float scale = 0;
|
||||||
result = readValFromFile(rawFile.c_str(), raw);
|
result = readValFromFile(rawFile.c_str(), raw);
|
||||||
if (result != HasReturnvaluesIF::RETURN_OK) {
|
if (result != returnvalue::OK) {
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
result = readValFromFile(scaleFile.c_str(), scale);
|
result = readValFromFile(scaleFile.c_str(), scale);
|
||||||
if (result != HasReturnvaluesIF::RETURN_OK) {
|
if (result != returnvalue::OK) {
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
voltage = calculateVoltage(raw, scale);
|
voltage = calculateVoltage(raw, scale);
|
||||||
@ -127,7 +127,7 @@ ReturnValue_t Xadc::readValFromFile(const char* filename, T& val) {
|
|||||||
fp = fopen(filename, "r");
|
fp = fopen(filename, "r");
|
||||||
if (fp == nullptr) {
|
if (fp == nullptr) {
|
||||||
sif::warning << "Xadc::readValFromFile: Failed to open file " << filename << std::endl;
|
sif::warning << "Xadc::readValFromFile: Failed to open file " << filename << std::endl;
|
||||||
return HasReturnvaluesIF::RETURN_FAILED;
|
return returnvalue::FAILED;
|
||||||
}
|
}
|
||||||
char valstring[MAX_STR_LENGTH] = "";
|
char valstring[MAX_STR_LENGTH] = "";
|
||||||
char* returnVal = fgets(valstring, MAX_STR_LENGTH, fp);
|
char* returnVal = fgets(valstring, MAX_STR_LENGTH, fp);
|
||||||
@ -135,10 +135,10 @@ ReturnValue_t Xadc::readValFromFile(const char* filename, T& val) {
|
|||||||
sif::warning << "Xadc::readValFromFile: Failed to read string from file " << filename
|
sif::warning << "Xadc::readValFromFile: Failed to read string from file " << filename
|
||||||
<< std::endl;
|
<< std::endl;
|
||||||
fclose(fp);
|
fclose(fp);
|
||||||
return HasReturnvaluesIF::RETURN_FAILED;
|
return returnvalue::FAILED;
|
||||||
}
|
}
|
||||||
std::istringstream valSstream(valstring);
|
std::istringstream valSstream(valstring);
|
||||||
valSstream >> val;
|
valSstream >> val;
|
||||||
fclose(fp);
|
fclose(fp);
|
||||||
return HasReturnvaluesIF::RETURN_OK;
|
return returnvalue::OK;
|
||||||
}
|
}
|
||||||
|
@ -3,7 +3,7 @@
|
|||||||
|
|
||||||
#include <string>
|
#include <string>
|
||||||
|
|
||||||
#include "fsfw/returnvalues/HasReturnvaluesIF.h"
|
#include "fsfw/returnvalues/returnvalue.h"
|
||||||
|
|
||||||
namespace xadc {
|
namespace xadc {
|
||||||
using namespace std;
|
using namespace std;
|
||||||
|
@ -2,7 +2,7 @@
|
|||||||
|
|
||||||
#include <fsfw/objectmanager/ObjectManager.h>
|
#include <fsfw/objectmanager/ObjectManager.h>
|
||||||
#include <fsfw/objectmanager/ObjectManagerIF.h>
|
#include <fsfw/objectmanager/ObjectManagerIF.h>
|
||||||
#include <fsfw/returnvalues/HasReturnvaluesIF.h>
|
#include <fsfw/returnvalues/returnvalue.h>
|
||||||
#include <fsfw/serviceinterface/ServiceInterface.h>
|
#include <fsfw/serviceinterface/ServiceInterface.h>
|
||||||
#include <fsfw/tasks/FixedTimeslotTaskIF.h>
|
#include <fsfw/tasks/FixedTimeslotTaskIF.h>
|
||||||
#include <fsfw/tasks/PeriodicTaskIF.h>
|
#include <fsfw/tasks/PeriodicTaskIF.h>
|
||||||
@ -36,7 +36,7 @@ void initmission::initMission() {
|
|||||||
|
|
||||||
void initmission::initTasks() {
|
void initmission::initTasks() {
|
||||||
TaskFactory* factory = TaskFactory::instance();
|
TaskFactory* factory = TaskFactory::instance();
|
||||||
ReturnValue_t result = HasReturnvaluesIF::RETURN_OK;
|
ReturnValue_t result = returnvalue::OK;
|
||||||
if (factory == nullptr) {
|
if (factory == nullptr) {
|
||||||
/* Should never happen ! */
|
/* Should never happen ! */
|
||||||
return;
|
return;
|
||||||
@ -51,28 +51,28 @@ void initmission::initTasks() {
|
|||||||
PeriodicTaskIF* tmtcDistributor = factory->createPeriodicTask(
|
PeriodicTaskIF* tmtcDistributor = factory->createPeriodicTask(
|
||||||
"DIST", 40, PeriodicTaskIF::MINIMUM_STACK_SIZE, 0.2, missedDeadlineFunc);
|
"DIST", 40, PeriodicTaskIF::MINIMUM_STACK_SIZE, 0.2, missedDeadlineFunc);
|
||||||
result = tmtcDistributor->addComponent(objects::CCSDS_PACKET_DISTRIBUTOR);
|
result = tmtcDistributor->addComponent(objects::CCSDS_PACKET_DISTRIBUTOR);
|
||||||
if (result != HasReturnvaluesIF::RETURN_OK) {
|
if (result != returnvalue::OK) {
|
||||||
sif::error << "Object add component failed" << std::endl;
|
sif::error << "Object add component failed" << std::endl;
|
||||||
}
|
}
|
||||||
result = tmtcDistributor->addComponent(objects::PUS_PACKET_DISTRIBUTOR);
|
result = tmtcDistributor->addComponent(objects::PUS_PACKET_DISTRIBUTOR);
|
||||||
if (result != HasReturnvaluesIF::RETURN_OK) {
|
if (result != returnvalue::OK) {
|
||||||
sif::error << "Object add component failed" << std::endl;
|
sif::error << "Object add component failed" << std::endl;
|
||||||
}
|
}
|
||||||
result = tmtcDistributor->addComponent(objects::TM_FUNNEL);
|
result = tmtcDistributor->addComponent(objects::TM_FUNNEL);
|
||||||
if (result != HasReturnvaluesIF::RETURN_OK) {
|
if (result != returnvalue::OK) {
|
||||||
sif::error << "Object add component failed" << std::endl;
|
sif::error << "Object add component failed" << std::endl;
|
||||||
}
|
}
|
||||||
|
|
||||||
PeriodicTaskIF* tmtcBridgeTask = factory->createPeriodicTask(
|
PeriodicTaskIF* tmtcBridgeTask = factory->createPeriodicTask(
|
||||||
"TMTC_BRIDGE", 50, PeriodicTaskIF::MINIMUM_STACK_SIZE, 0.2, missedDeadlineFunc);
|
"TMTC_BRIDGE", 50, PeriodicTaskIF::MINIMUM_STACK_SIZE, 0.2, missedDeadlineFunc);
|
||||||
result = tmtcBridgeTask->addComponent(objects::TMTC_BRIDGE);
|
result = tmtcBridgeTask->addComponent(objects::TMTC_BRIDGE);
|
||||||
if (result != HasReturnvaluesIF::RETURN_OK) {
|
if (result != returnvalue::OK) {
|
||||||
sif::error << "Add component TMTC Bridge failed" << std::endl;
|
sif::error << "Add component TMTC Bridge failed" << std::endl;
|
||||||
}
|
}
|
||||||
PeriodicTaskIF* tmtcPollingTask = factory->createPeriodicTask(
|
PeriodicTaskIF* tmtcPollingTask = factory->createPeriodicTask(
|
||||||
"TMTC_POLLING", 80, PeriodicTaskIF::MINIMUM_STACK_SIZE, 2.0, missedDeadlineFunc);
|
"TMTC_POLLING", 80, PeriodicTaskIF::MINIMUM_STACK_SIZE, 2.0, missedDeadlineFunc);
|
||||||
result = tmtcPollingTask->addComponent(objects::TMTC_POLLING_TASK);
|
result = tmtcPollingTask->addComponent(objects::TMTC_POLLING_TASK);
|
||||||
if (result != HasReturnvaluesIF::RETURN_OK) {
|
if (result != returnvalue::OK) {
|
||||||
sif::error << "Add component TMTC Polling failed" << std::endl;
|
sif::error << "Add component TMTC Polling failed" << std::endl;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -84,7 +84,7 @@ void initmission::initTasks() {
|
|||||||
FixedTimeslotTaskIF* pst = factory->createFixedTimeslotTask(
|
FixedTimeslotTaskIF* pst = factory->createFixedTimeslotTask(
|
||||||
"UART_PST", 70, PeriodicTaskIF::MINIMUM_STACK_SIZE * 4, 1.0, missedDeadlineFunc);
|
"UART_PST", 70, PeriodicTaskIF::MINIMUM_STACK_SIZE * 4, 1.0, missedDeadlineFunc);
|
||||||
result = pst::pstUart(pst);
|
result = pst::pstUart(pst);
|
||||||
if (result != HasReturnvaluesIF::RETURN_OK) {
|
if (result != returnvalue::OK) {
|
||||||
sif::error << "InitMission::initTasks: Creating PST failed!" << std::endl;
|
sif::error << "InitMission::initTasks: Creating PST failed!" << std::endl;
|
||||||
}
|
}
|
||||||
pstTasks.push_back(pst);
|
pstTasks.push_back(pst);
|
||||||
@ -93,7 +93,7 @@ void initmission::initTasks() {
|
|||||||
PeriodicTaskIF* mpsocHelperTask = factory->createPeriodicTask(
|
PeriodicTaskIF* mpsocHelperTask = factory->createPeriodicTask(
|
||||||
"PLOC_MPSOC_HELPER", 20, PeriodicTaskIF::MINIMUM_STACK_SIZE, 0.2, missedDeadlineFunc);
|
"PLOC_MPSOC_HELPER", 20, PeriodicTaskIF::MINIMUM_STACK_SIZE, 0.2, missedDeadlineFunc);
|
||||||
result = mpsocHelperTask->addComponent(objects::PLOC_MPSOC_HELPER);
|
result = mpsocHelperTask->addComponent(objects::PLOC_MPSOC_HELPER);
|
||||||
if (result != HasReturnvaluesIF::RETURN_OK) {
|
if (result != returnvalue::OK) {
|
||||||
initmission::printAddObjectError("PLOC_MPSOC_HELPER", objects::PLOC_MPSOC_HELPER);
|
initmission::printAddObjectError("PLOC_MPSOC_HELPER", objects::PLOC_MPSOC_HELPER);
|
||||||
}
|
}
|
||||||
#endif /* OBSW_ADD_PLOC_MPSOC == 1*/
|
#endif /* OBSW_ADD_PLOC_MPSOC == 1*/
|
||||||
@ -102,7 +102,7 @@ void initmission::initTasks() {
|
|||||||
PeriodicTaskIF* supvHelperTask = factory->createPeriodicTask(
|
PeriodicTaskIF* supvHelperTask = factory->createPeriodicTask(
|
||||||
"PLOC_SUPV_HELPER", 20, PeriodicTaskIF::MINIMUM_STACK_SIZE, 0.2, missedDeadlineFunc);
|
"PLOC_SUPV_HELPER", 20, PeriodicTaskIF::MINIMUM_STACK_SIZE, 0.2, missedDeadlineFunc);
|
||||||
result = supvHelperTask->addComponent(objects::PLOC_SUPERVISOR_HELPER);
|
result = supvHelperTask->addComponent(objects::PLOC_SUPERVISOR_HELPER);
|
||||||
if (result != HasReturnvaluesIF::RETURN_OK) {
|
if (result != returnvalue::OK) {
|
||||||
initmission::printAddObjectError("PLOC_SUPV_HELPER", objects::PLOC_SUPERVISOR_HELPER);
|
initmission::printAddObjectError("PLOC_SUPV_HELPER", objects::PLOC_SUPERVISOR_HELPER);
|
||||||
}
|
}
|
||||||
#endif /* OBSW_ADD_PLOC_SUPERVISOR == 1 */
|
#endif /* OBSW_ADD_PLOC_SUPERVISOR == 1 */
|
||||||
@ -111,7 +111,7 @@ void initmission::initTasks() {
|
|||||||
PeriodicTaskIF* ccsdsHandlerTask = factory->createPeriodicTask(
|
PeriodicTaskIF* ccsdsHandlerTask = factory->createPeriodicTask(
|
||||||
"CCSDS_HANDLER", 50, PeriodicTaskIF::MINIMUM_STACK_SIZE, 2.0, missedDeadlineFunc);
|
"CCSDS_HANDLER", 50, PeriodicTaskIF::MINIMUM_STACK_SIZE, 2.0, missedDeadlineFunc);
|
||||||
result = ccsdsHandlerTask->addComponent(objects::CCSDS_HANDLER);
|
result = ccsdsHandlerTask->addComponent(objects::CCSDS_HANDLER);
|
||||||
if (result != HasReturnvaluesIF::RETURN_OK) {
|
if (result != returnvalue::OK) {
|
||||||
initmission::printAddObjectError("CCSDS Handler", objects::CCSDS_HANDLER);
|
initmission::printAddObjectError("CCSDS Handler", objects::CCSDS_HANDLER);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -121,7 +121,7 @@ void initmission::initTasks() {
|
|||||||
PeriodicTaskIF* pdecHandlerTask = factory->createPeriodicTask(
|
PeriodicTaskIF* pdecHandlerTask = factory->createPeriodicTask(
|
||||||
"PDEC_HANDLER", 50, PeriodicTaskIF::MINIMUM_STACK_SIZE, 1.0, missedDeadlineFunc);
|
"PDEC_HANDLER", 50, PeriodicTaskIF::MINIMUM_STACK_SIZE, 1.0, missedDeadlineFunc);
|
||||||
result = pdecHandlerTask->addComponent(objects::PDEC_HANDLER);
|
result = pdecHandlerTask->addComponent(objects::PDEC_HANDLER);
|
||||||
if (result != HasReturnvaluesIF::RETURN_OK) {
|
if (result != returnvalue::OK) {
|
||||||
initmission::printAddObjectError("PDEC Handler", objects::PDEC_HANDLER);
|
initmission::printAddObjectError("PDEC Handler", objects::PDEC_HANDLER);
|
||||||
}
|
}
|
||||||
#endif /* OBSW_USE_CCSDS_IP_CORE == 1 */
|
#endif /* OBSW_USE_CCSDS_IP_CORE == 1 */
|
||||||
@ -160,11 +160,11 @@ void initmission::initTasks() {
|
|||||||
void initmission::createPusTasks(TaskFactory& factory,
|
void initmission::createPusTasks(TaskFactory& factory,
|
||||||
TaskDeadlineMissedFunction missedDeadlineFunc,
|
TaskDeadlineMissedFunction missedDeadlineFunc,
|
||||||
std::vector<PeriodicTaskIF*>& taskVec) {
|
std::vector<PeriodicTaskIF*>& taskVec) {
|
||||||
ReturnValue_t result = HasReturnvaluesIF::RETURN_OK;
|
ReturnValue_t result = returnvalue::OK;
|
||||||
PeriodicTaskIF* pusVerification = factory.createPeriodicTask(
|
PeriodicTaskIF* pusVerification = factory.createPeriodicTask(
|
||||||
"PUS_VERIF", 40, PeriodicTaskIF::MINIMUM_STACK_SIZE, 0.200, missedDeadlineFunc);
|
"PUS_VERIF", 40, PeriodicTaskIF::MINIMUM_STACK_SIZE, 0.200, missedDeadlineFunc);
|
||||||
result = pusVerification->addComponent(objects::PUS_SERVICE_1_VERIFICATION);
|
result = pusVerification->addComponent(objects::PUS_SERVICE_1_VERIFICATION);
|
||||||
if (result != HasReturnvaluesIF::RETURN_OK) {
|
if (result != returnvalue::OK) {
|
||||||
sif::error << "Object add component failed" << std::endl;
|
sif::error << "Object add component failed" << std::endl;
|
||||||
}
|
}
|
||||||
taskVec.push_back(pusVerification);
|
taskVec.push_back(pusVerification);
|
||||||
@ -172,11 +172,11 @@ void initmission::createPusTasks(TaskFactory& factory,
|
|||||||
PeriodicTaskIF* pusEvents = factory.createPeriodicTask(
|
PeriodicTaskIF* pusEvents = factory.createPeriodicTask(
|
||||||
"PUS_EVENTS", 60, PeriodicTaskIF::MINIMUM_STACK_SIZE, 0.200, missedDeadlineFunc);
|
"PUS_EVENTS", 60, PeriodicTaskIF::MINIMUM_STACK_SIZE, 0.200, missedDeadlineFunc);
|
||||||
result = pusEvents->addComponent(objects::PUS_SERVICE_5_EVENT_REPORTING);
|
result = pusEvents->addComponent(objects::PUS_SERVICE_5_EVENT_REPORTING);
|
||||||
if (result != HasReturnvaluesIF::RETURN_OK) {
|
if (result != returnvalue::OK) {
|
||||||
initmission::printAddObjectError("PUS_EVENTS", objects::PUS_SERVICE_5_EVENT_REPORTING);
|
initmission::printAddObjectError("PUS_EVENTS", objects::PUS_SERVICE_5_EVENT_REPORTING);
|
||||||
}
|
}
|
||||||
result = pusEvents->addComponent(objects::EVENT_MANAGER);
|
result = pusEvents->addComponent(objects::EVENT_MANAGER);
|
||||||
if (result != HasReturnvaluesIF::RETURN_OK) {
|
if (result != returnvalue::OK) {
|
||||||
initmission::printAddObjectError("PUS_MGMT", objects::EVENT_MANAGER);
|
initmission::printAddObjectError("PUS_MGMT", objects::EVENT_MANAGER);
|
||||||
}
|
}
|
||||||
taskVec.push_back(pusEvents);
|
taskVec.push_back(pusEvents);
|
||||||
@ -184,11 +184,11 @@ void initmission::createPusTasks(TaskFactory& factory,
|
|||||||
PeriodicTaskIF* pusHighPrio = factory.createPeriodicTask(
|
PeriodicTaskIF* pusHighPrio = factory.createPeriodicTask(
|
||||||
"PUS_HIGH_PRIO", 50, PeriodicTaskIF::MINIMUM_STACK_SIZE, 0.200, missedDeadlineFunc);
|
"PUS_HIGH_PRIO", 50, PeriodicTaskIF::MINIMUM_STACK_SIZE, 0.200, missedDeadlineFunc);
|
||||||
result = pusHighPrio->addComponent(objects::PUS_SERVICE_2_DEVICE_ACCESS);
|
result = pusHighPrio->addComponent(objects::PUS_SERVICE_2_DEVICE_ACCESS);
|
||||||
if (result != HasReturnvaluesIF::RETURN_OK) {
|
if (result != returnvalue::OK) {
|
||||||
initmission::printAddObjectError("PUS2", objects::PUS_SERVICE_2_DEVICE_ACCESS);
|
initmission::printAddObjectError("PUS2", objects::PUS_SERVICE_2_DEVICE_ACCESS);
|
||||||
}
|
}
|
||||||
result = pusHighPrio->addComponent(objects::PUS_SERVICE_9_TIME_MGMT);
|
result = pusHighPrio->addComponent(objects::PUS_SERVICE_9_TIME_MGMT);
|
||||||
if (result != HasReturnvaluesIF::RETURN_OK) {
|
if (result != returnvalue::OK) {
|
||||||
initmission::printAddObjectError("PUS9", objects::PUS_SERVICE_9_TIME_MGMT);
|
initmission::printAddObjectError("PUS9", objects::PUS_SERVICE_9_TIME_MGMT);
|
||||||
}
|
}
|
||||||
taskVec.push_back(pusHighPrio);
|
taskVec.push_back(pusHighPrio);
|
||||||
@ -196,19 +196,19 @@ void initmission::createPusTasks(TaskFactory& factory,
|
|||||||
PeriodicTaskIF* pusMedPrio = factory.createPeriodicTask(
|
PeriodicTaskIF* pusMedPrio = factory.createPeriodicTask(
|
||||||
"PUS_MED_PRIO", 40, PeriodicTaskIF::MINIMUM_STACK_SIZE, 0.8, missedDeadlineFunc);
|
"PUS_MED_PRIO", 40, PeriodicTaskIF::MINIMUM_STACK_SIZE, 0.8, missedDeadlineFunc);
|
||||||
result = pusMedPrio->addComponent(objects::PUS_SERVICE_8_FUNCTION_MGMT);
|
result = pusMedPrio->addComponent(objects::PUS_SERVICE_8_FUNCTION_MGMT);
|
||||||
if (result != HasReturnvaluesIF::RETURN_OK) {
|
if (result != returnvalue::OK) {
|
||||||
initmission::printAddObjectError("PUS8", objects::PUS_SERVICE_8_FUNCTION_MGMT);
|
initmission::printAddObjectError("PUS8", objects::PUS_SERVICE_8_FUNCTION_MGMT);
|
||||||
}
|
}
|
||||||
result = pusMedPrio->addComponent(objects::PUS_SERVICE_200_MODE_MGMT);
|
result = pusMedPrio->addComponent(objects::PUS_SERVICE_200_MODE_MGMT);
|
||||||
if (result != HasReturnvaluesIF::RETURN_OK) {
|
if (result != returnvalue::OK) {
|
||||||
initmission::printAddObjectError("PUS200", objects::PUS_SERVICE_200_MODE_MGMT);
|
initmission::printAddObjectError("PUS200", objects::PUS_SERVICE_200_MODE_MGMT);
|
||||||
}
|
}
|
||||||
result = pusMedPrio->addComponent(objects::PUS_SERVICE_20_PARAMETERS);
|
result = pusMedPrio->addComponent(objects::PUS_SERVICE_20_PARAMETERS);
|
||||||
if (result != HasReturnvaluesIF::RETURN_OK) {
|
if (result != returnvalue::OK) {
|
||||||
initmission::printAddObjectError("PUS20", objects::PUS_SERVICE_20_PARAMETERS);
|
initmission::printAddObjectError("PUS20", objects::PUS_SERVICE_20_PARAMETERS);
|
||||||
}
|
}
|
||||||
result = pusMedPrio->addComponent(objects::PUS_SERVICE_3_HOUSEKEEPING);
|
result = pusMedPrio->addComponent(objects::PUS_SERVICE_3_HOUSEKEEPING);
|
||||||
if (result != HasReturnvaluesIF::RETURN_OK) {
|
if (result != returnvalue::OK) {
|
||||||
initmission::printAddObjectError("PUS3", objects::PUS_SERVICE_3_HOUSEKEEPING);
|
initmission::printAddObjectError("PUS3", objects::PUS_SERVICE_3_HOUSEKEEPING);
|
||||||
}
|
}
|
||||||
taskVec.push_back(pusMedPrio);
|
taskVec.push_back(pusMedPrio);
|
||||||
@ -216,11 +216,11 @@ void initmission::createPusTasks(TaskFactory& factory,
|
|||||||
PeriodicTaskIF* pusLowPrio = factory.createPeriodicTask(
|
PeriodicTaskIF* pusLowPrio = factory.createPeriodicTask(
|
||||||
"PUS_LOW_PRIO", 30, PeriodicTaskIF::MINIMUM_STACK_SIZE, 1.6, missedDeadlineFunc);
|
"PUS_LOW_PRIO", 30, PeriodicTaskIF::MINIMUM_STACK_SIZE, 1.6, missedDeadlineFunc);
|
||||||
result = pusLowPrio->addComponent(objects::PUS_SERVICE_17_TEST);
|
result = pusLowPrio->addComponent(objects::PUS_SERVICE_17_TEST);
|
||||||
if (result != HasReturnvaluesIF::RETURN_OK) {
|
if (result != returnvalue::OK) {
|
||||||
initmission::printAddObjectError("PUS17", objects::PUS_SERVICE_17_TEST);
|
initmission::printAddObjectError("PUS17", objects::PUS_SERVICE_17_TEST);
|
||||||
}
|
}
|
||||||
result = pusLowPrio->addComponent(objects::INTERNAL_ERROR_REPORTER);
|
result = pusLowPrio->addComponent(objects::INTERNAL_ERROR_REPORTER);
|
||||||
if (result != HasReturnvaluesIF::RETURN_OK) {
|
if (result != returnvalue::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);
|
||||||
|
@ -19,16 +19,16 @@ ReturnValue_t AcuDummy::buildTransitionDeviceCommand(DeviceCommandId_t *id) {
|
|||||||
|
|
||||||
ReturnValue_t AcuDummy::buildCommandFromCommand(DeviceCommandId_t deviceCommand,
|
ReturnValue_t AcuDummy::buildCommandFromCommand(DeviceCommandId_t deviceCommand,
|
||||||
const uint8_t *commandData, size_t commandDataLen) {
|
const uint8_t *commandData, size_t commandDataLen) {
|
||||||
return RETURN_OK;
|
return returnvalue::OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
ReturnValue_t AcuDummy::scanForReply(const uint8_t *start, size_t len, DeviceCommandId_t *foundId,
|
ReturnValue_t AcuDummy::scanForReply(const uint8_t *start, size_t len, DeviceCommandId_t *foundId,
|
||||||
size_t *foundLen) {
|
size_t *foundLen) {
|
||||||
return RETURN_OK;
|
return returnvalue::OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
ReturnValue_t AcuDummy::interpretDeviceReply(DeviceCommandId_t id, const uint8_t *packet) {
|
ReturnValue_t AcuDummy::interpretDeviceReply(DeviceCommandId_t id, const uint8_t *packet) {
|
||||||
return RETURN_OK;
|
return returnvalue::OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
void AcuDummy::fillCommandAndReplyMap() {}
|
void AcuDummy::fillCommandAndReplyMap() {}
|
||||||
@ -37,6 +37,6 @@ uint32_t AcuDummy::getTransitionDelayMs(Mode_t modeFrom, Mode_t modeTo) { return
|
|||||||
|
|
||||||
ReturnValue_t AcuDummy::initializeLocalDataPool(localpool::DataPool &localDataPoolMap,
|
ReturnValue_t AcuDummy::initializeLocalDataPool(localpool::DataPool &localDataPoolMap,
|
||||||
LocalDataPoolManager &poolManager) {
|
LocalDataPoolManager &poolManager) {
|
||||||
localDataPoolMap.emplace(P60System::pool::ACU_TEMPERATURES, new PoolEntry<float>(3));
|
localDataPoolMap.emplace(ACU::pool::ACU_TEMPERATURES, new PoolEntry<float>(3));
|
||||||
return HasReturnvaluesIF::RETURN_OK;
|
return returnvalue::OK;
|
||||||
}
|
}
|
||||||
|
@ -19,16 +19,16 @@ ReturnValue_t BpxDummy::buildTransitionDeviceCommand(DeviceCommandId_t *id) {
|
|||||||
|
|
||||||
ReturnValue_t BpxDummy::buildCommandFromCommand(DeviceCommandId_t deviceCommand,
|
ReturnValue_t BpxDummy::buildCommandFromCommand(DeviceCommandId_t deviceCommand,
|
||||||
const uint8_t *commandData, size_t commandDataLen) {
|
const uint8_t *commandData, size_t commandDataLen) {
|
||||||
return RETURN_OK;
|
return returnvalue::OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
ReturnValue_t BpxDummy::scanForReply(const uint8_t *start, size_t len, DeviceCommandId_t *foundId,
|
ReturnValue_t BpxDummy::scanForReply(const uint8_t *start, size_t len, DeviceCommandId_t *foundId,
|
||||||
size_t *foundLen) {
|
size_t *foundLen) {
|
||||||
return RETURN_OK;
|
return returnvalue::OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
ReturnValue_t BpxDummy::interpretDeviceReply(DeviceCommandId_t id, const uint8_t *packet) {
|
ReturnValue_t BpxDummy::interpretDeviceReply(DeviceCommandId_t id, const uint8_t *packet) {
|
||||||
return RETURN_OK;
|
return returnvalue::OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
void BpxDummy::fillCommandAndReplyMap() {}
|
void BpxDummy::fillCommandAndReplyMap() {}
|
||||||
@ -51,5 +51,5 @@ ReturnValue_t BpxDummy::initializeLocalDataPool(localpool::DataPool &localDataPo
|
|||||||
localDataPoolMap.emplace(BpxBattery::BATTERY_HEATER_MODE, &battheatMode);
|
localDataPoolMap.emplace(BpxBattery::BATTERY_HEATER_MODE, &battheatMode);
|
||||||
localDataPoolMap.emplace(BpxBattery::BATTHEAT_LOW_LIMIT, &battheatLow);
|
localDataPoolMap.emplace(BpxBattery::BATTHEAT_LOW_LIMIT, &battheatLow);
|
||||||
localDataPoolMap.emplace(BpxBattery::BATTHEAT_HIGH_LIMIT, &battheatHigh);
|
localDataPoolMap.emplace(BpxBattery::BATTHEAT_HIGH_LIMIT, &battheatHigh);
|
||||||
return HasReturnvaluesIF::RETURN_OK;
|
return returnvalue::OK;
|
||||||
}
|
}
|
||||||
|
@ -4,18 +4,18 @@ ComIFDummy::ComIFDummy(object_id_t objectId) : SystemObject(objectId) {}
|
|||||||
|
|
||||||
ComIFDummy::~ComIFDummy() {}
|
ComIFDummy::~ComIFDummy() {}
|
||||||
|
|
||||||
ReturnValue_t ComIFDummy::initializeInterface(CookieIF *cookie) { return RETURN_OK; }
|
ReturnValue_t ComIFDummy::initializeInterface(CookieIF *cookie) { return returnvalue::OK; }
|
||||||
|
|
||||||
ReturnValue_t ComIFDummy::sendMessage(CookieIF *cookie, const uint8_t *sendData, size_t sendLen) {
|
ReturnValue_t ComIFDummy::sendMessage(CookieIF *cookie, const uint8_t *sendData, size_t sendLen) {
|
||||||
return RETURN_OK;
|
return returnvalue::OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
ReturnValue_t ComIFDummy::getSendSuccess(CookieIF *cookie) { return RETURN_OK; }
|
ReturnValue_t ComIFDummy::getSendSuccess(CookieIF *cookie) { return returnvalue::OK; }
|
||||||
|
|
||||||
ReturnValue_t ComIFDummy::requestReceiveMessage(CookieIF *cookie, size_t requestLen) {
|
ReturnValue_t ComIFDummy::requestReceiveMessage(CookieIF *cookie, size_t requestLen) {
|
||||||
return RETURN_OK;
|
return returnvalue::OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
ReturnValue_t ComIFDummy::readReceivedMessage(CookieIF *cookie, uint8_t **buffer, size_t *size) {
|
ReturnValue_t ComIFDummy::readReceivedMessage(CookieIF *cookie, uint8_t **buffer, size_t *size) {
|
||||||
return RETURN_OK;
|
return returnvalue::OK;
|
||||||
}
|
}
|
||||||
|
@ -14,16 +14,16 @@ ReturnValue_t CoreControllerDummy::initialize() {
|
|||||||
if (not done) {
|
if (not done) {
|
||||||
done = true;
|
done = true;
|
||||||
ReturnValue_t result = ExtendedControllerBase::initialize();
|
ReturnValue_t result = ExtendedControllerBase::initialize();
|
||||||
if (result != HasReturnvaluesIF::RETURN_OK) {
|
if (result != returnvalue::OK) {
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return HasReturnvaluesIF::RETURN_OK;
|
return returnvalue::OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
ReturnValue_t CoreControllerDummy::handleCommandMessage(CommandMessage* message) {
|
ReturnValue_t CoreControllerDummy::handleCommandMessage(CommandMessage* message) {
|
||||||
return RETURN_FAILED;
|
return returnvalue::FAILED;
|
||||||
}
|
}
|
||||||
|
|
||||||
void CoreControllerDummy::performControlOperation() { return; }
|
void CoreControllerDummy::performControlOperation() { return; }
|
||||||
@ -33,7 +33,7 @@ ReturnValue_t CoreControllerDummy::initializeLocalDataPool(localpool::DataPool&
|
|||||||
localDataPoolMap.emplace(core::TEMPERATURE, new PoolEntry<float>({0}));
|
localDataPoolMap.emplace(core::TEMPERATURE, new PoolEntry<float>({0}));
|
||||||
localDataPoolMap.emplace(core::PS_VOLTAGE, new PoolEntry<float>({0}));
|
localDataPoolMap.emplace(core::PS_VOLTAGE, new PoolEntry<float>({0}));
|
||||||
localDataPoolMap.emplace(core::PL_VOLTAGE, new PoolEntry<float>({0}));
|
localDataPoolMap.emplace(core::PL_VOLTAGE, new PoolEntry<float>({0}));
|
||||||
return HasReturnvaluesIF::RETURN_OK;
|
return returnvalue::OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
LocalPoolDataSetBase* CoreControllerDummy::getDataSetHandle(sid_t sid) {
|
LocalPoolDataSetBase* CoreControllerDummy::getDataSetHandle(sid_t sid) {
|
||||||
@ -51,5 +51,5 @@ ReturnValue_t CoreControllerDummy::checkModeCommand(Mode_t mode, Submode_t submo
|
|||||||
if ((mode != MODE_OFF) && (mode != MODE_ON) && (mode != MODE_NORMAL)) {
|
if ((mode != MODE_OFF) && (mode != MODE_ON) && (mode != MODE_NORMAL)) {
|
||||||
return INVALID_MODE;
|
return INVALID_MODE;
|
||||||
}
|
}
|
||||||
return RETURN_OK;
|
return returnvalue::OK;
|
||||||
}
|
}
|
||||||
|
@ -22,16 +22,16 @@ ReturnValue_t GyroAdisDummy::buildTransitionDeviceCommand(DeviceCommandId_t *id)
|
|||||||
ReturnValue_t GyroAdisDummy::buildCommandFromCommand(DeviceCommandId_t deviceCommand,
|
ReturnValue_t GyroAdisDummy::buildCommandFromCommand(DeviceCommandId_t deviceCommand,
|
||||||
const uint8_t *commandData,
|
const uint8_t *commandData,
|
||||||
size_t commandDataLen) {
|
size_t commandDataLen) {
|
||||||
return RETURN_OK;
|
return returnvalue::OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
ReturnValue_t GyroAdisDummy::scanForReply(const uint8_t *start, size_t len,
|
ReturnValue_t GyroAdisDummy::scanForReply(const uint8_t *start, size_t len,
|
||||||
DeviceCommandId_t *foundId, size_t *foundLen) {
|
DeviceCommandId_t *foundId, size_t *foundLen) {
|
||||||
return RETURN_OK;
|
return returnvalue::OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
ReturnValue_t GyroAdisDummy::interpretDeviceReply(DeviceCommandId_t id, const uint8_t *packet) {
|
ReturnValue_t GyroAdisDummy::interpretDeviceReply(DeviceCommandId_t id, const uint8_t *packet) {
|
||||||
return RETURN_OK;
|
return returnvalue::OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
void GyroAdisDummy::fillCommandAndReplyMap() {}
|
void GyroAdisDummy::fillCommandAndReplyMap() {}
|
||||||
@ -41,5 +41,5 @@ uint32_t GyroAdisDummy::getTransitionDelayMs(Mode_t modeFrom, Mode_t modeTo) { r
|
|||||||
ReturnValue_t GyroAdisDummy::initializeLocalDataPool(localpool::DataPool &localDataPoolMap,
|
ReturnValue_t GyroAdisDummy::initializeLocalDataPool(localpool::DataPool &localDataPoolMap,
|
||||||
LocalDataPoolManager &poolManager) {
|
LocalDataPoolManager &poolManager) {
|
||||||
localDataPoolMap.emplace(ADIS1650X::TEMPERATURE, new PoolEntry<float>({0.0}));
|
localDataPoolMap.emplace(ADIS1650X::TEMPERATURE, new PoolEntry<float>({0.0}));
|
||||||
return HasReturnvaluesIF::RETURN_OK;
|
return returnvalue::OK;
|
||||||
}
|
}
|
||||||
|
@ -22,16 +22,16 @@ ReturnValue_t GyroL3GD20Dummy::buildTransitionDeviceCommand(DeviceCommandId_t *i
|
|||||||
ReturnValue_t GyroL3GD20Dummy::buildCommandFromCommand(DeviceCommandId_t deviceCommand,
|
ReturnValue_t GyroL3GD20Dummy::buildCommandFromCommand(DeviceCommandId_t deviceCommand,
|
||||||
const uint8_t *commandData,
|
const uint8_t *commandData,
|
||||||
size_t commandDataLen) {
|
size_t commandDataLen) {
|
||||||
return RETURN_OK;
|
return returnvalue::OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
ReturnValue_t GyroL3GD20Dummy::scanForReply(const uint8_t *start, size_t len,
|
ReturnValue_t GyroL3GD20Dummy::scanForReply(const uint8_t *start, size_t len,
|
||||||
DeviceCommandId_t *foundId, size_t *foundLen) {
|
DeviceCommandId_t *foundId, size_t *foundLen) {
|
||||||
return RETURN_OK;
|
return returnvalue::OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
ReturnValue_t GyroL3GD20Dummy::interpretDeviceReply(DeviceCommandId_t id, const uint8_t *packet) {
|
ReturnValue_t GyroL3GD20Dummy::interpretDeviceReply(DeviceCommandId_t id, const uint8_t *packet) {
|
||||||
return RETURN_OK;
|
return returnvalue::OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
void GyroL3GD20Dummy::fillCommandAndReplyMap() {}
|
void GyroL3GD20Dummy::fillCommandAndReplyMap() {}
|
||||||
@ -44,5 +44,5 @@ ReturnValue_t GyroL3GD20Dummy::initializeLocalDataPool(localpool::DataPool &loca
|
|||||||
localDataPoolMap.emplace(L3GD20H::ANG_VELOC_Y, new PoolEntry<float>({0.0}));
|
localDataPoolMap.emplace(L3GD20H::ANG_VELOC_Y, new PoolEntry<float>({0.0}));
|
||||||
localDataPoolMap.emplace(L3GD20H::ANG_VELOC_Z, new PoolEntry<float>({0.0}));
|
localDataPoolMap.emplace(L3GD20H::ANG_VELOC_Z, new PoolEntry<float>({0.0}));
|
||||||
localDataPoolMap.emplace(L3GD20H::TEMPERATURE, new PoolEntry<float>({0.0}));
|
localDataPoolMap.emplace(L3GD20H::TEMPERATURE, new PoolEntry<float>({0.0}));
|
||||||
return HasReturnvaluesIF::RETURN_OK;
|
return returnvalue::OK;
|
||||||
}
|
}
|
||||||
|
@ -20,16 +20,16 @@ ReturnValue_t ImtqDummy::buildTransitionDeviceCommand(DeviceCommandId_t *id) {
|
|||||||
ReturnValue_t ImtqDummy::buildCommandFromCommand(DeviceCommandId_t deviceCommand,
|
ReturnValue_t ImtqDummy::buildCommandFromCommand(DeviceCommandId_t deviceCommand,
|
||||||
const uint8_t *commandData,
|
const uint8_t *commandData,
|
||||||
size_t commandDataLen) {
|
size_t commandDataLen) {
|
||||||
return RETURN_OK;
|
return returnvalue::OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
ReturnValue_t ImtqDummy::scanForReply(const uint8_t *start, size_t len, DeviceCommandId_t *foundId,
|
ReturnValue_t ImtqDummy::scanForReply(const uint8_t *start, size_t len, DeviceCommandId_t *foundId,
|
||||||
size_t *foundLen) {
|
size_t *foundLen) {
|
||||||
return RETURN_OK;
|
return returnvalue::OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
ReturnValue_t ImtqDummy::interpretDeviceReply(DeviceCommandId_t id, const uint8_t *packet) {
|
ReturnValue_t ImtqDummy::interpretDeviceReply(DeviceCommandId_t id, const uint8_t *packet) {
|
||||||
return RETURN_OK;
|
return returnvalue::OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
void ImtqDummy::fillCommandAndReplyMap() {}
|
void ImtqDummy::fillCommandAndReplyMap() {}
|
||||||
@ -39,5 +39,5 @@ uint32_t ImtqDummy::getTransitionDelayMs(Mode_t modeFrom, Mode_t modeTo) { retur
|
|||||||
ReturnValue_t ImtqDummy::initializeLocalDataPool(localpool::DataPool &localDataPoolMap,
|
ReturnValue_t ImtqDummy::initializeLocalDataPool(localpool::DataPool &localDataPoolMap,
|
||||||
LocalDataPoolManager &poolManager) {
|
LocalDataPoolManager &poolManager) {
|
||||||
localDataPoolMap.emplace(IMTQ::MCU_TEMPERATURE, new PoolEntry<int16_t>({0}));
|
localDataPoolMap.emplace(IMTQ::MCU_TEMPERATURE, new PoolEntry<int16_t>({0}));
|
||||||
return HasReturnvaluesIF::RETURN_OK;
|
return returnvalue::OK;
|
||||||
}
|
}
|
||||||
|
@ -22,16 +22,16 @@ ReturnValue_t MgmLIS3MDLDummy::buildTransitionDeviceCommand(DeviceCommandId_t *i
|
|||||||
ReturnValue_t MgmLIS3MDLDummy::buildCommandFromCommand(DeviceCommandId_t deviceCommand,
|
ReturnValue_t MgmLIS3MDLDummy::buildCommandFromCommand(DeviceCommandId_t deviceCommand,
|
||||||
const uint8_t *commandData,
|
const uint8_t *commandData,
|
||||||
size_t commandDataLen) {
|
size_t commandDataLen) {
|
||||||
return RETURN_OK;
|
return returnvalue::OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
ReturnValue_t MgmLIS3MDLDummy::scanForReply(const uint8_t *start, size_t len,
|
ReturnValue_t MgmLIS3MDLDummy::scanForReply(const uint8_t *start, size_t len,
|
||||||
DeviceCommandId_t *foundId, size_t *foundLen) {
|
DeviceCommandId_t *foundId, size_t *foundLen) {
|
||||||
return RETURN_OK;
|
return returnvalue::OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
ReturnValue_t MgmLIS3MDLDummy::interpretDeviceReply(DeviceCommandId_t id, const uint8_t *packet) {
|
ReturnValue_t MgmLIS3MDLDummy::interpretDeviceReply(DeviceCommandId_t id, const uint8_t *packet) {
|
||||||
return RETURN_OK;
|
return returnvalue::OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
void MgmLIS3MDLDummy::fillCommandAndReplyMap() {}
|
void MgmLIS3MDLDummy::fillCommandAndReplyMap() {}
|
||||||
@ -41,5 +41,5 @@ uint32_t MgmLIS3MDLDummy::getTransitionDelayMs(Mode_t modeFrom, Mode_t modeTo) {
|
|||||||
ReturnValue_t MgmLIS3MDLDummy::initializeLocalDataPool(localpool::DataPool &localDataPoolMap,
|
ReturnValue_t MgmLIS3MDLDummy::initializeLocalDataPool(localpool::DataPool &localDataPoolMap,
|
||||||
LocalDataPoolManager &poolManager) {
|
LocalDataPoolManager &poolManager) {
|
||||||
localDataPoolMap.emplace(MGMLIS3MDL::TEMPERATURE_CELCIUS, new PoolEntry<float>({0.0}));
|
localDataPoolMap.emplace(MGMLIS3MDL::TEMPERATURE_CELCIUS, new PoolEntry<float>({0.0}));
|
||||||
return HasReturnvaluesIF::RETURN_OK;
|
return returnvalue::OK;
|
||||||
}
|
}
|
||||||
|
@ -22,16 +22,16 @@ ReturnValue_t P60DockDummy::buildTransitionDeviceCommand(DeviceCommandId_t *id)
|
|||||||
ReturnValue_t P60DockDummy::buildCommandFromCommand(DeviceCommandId_t deviceCommand,
|
ReturnValue_t P60DockDummy::buildCommandFromCommand(DeviceCommandId_t deviceCommand,
|
||||||
const uint8_t *commandData,
|
const uint8_t *commandData,
|
||||||
size_t commandDataLen) {
|
size_t commandDataLen) {
|
||||||
return RETURN_OK;
|
return returnvalue::OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
ReturnValue_t P60DockDummy::scanForReply(const uint8_t *start, size_t len,
|
ReturnValue_t P60DockDummy::scanForReply(const uint8_t *start, size_t len,
|
||||||
DeviceCommandId_t *foundId, size_t *foundLen) {
|
DeviceCommandId_t *foundId, size_t *foundLen) {
|
||||||
return RETURN_OK;
|
return returnvalue::OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
ReturnValue_t P60DockDummy::interpretDeviceReply(DeviceCommandId_t id, const uint8_t *packet) {
|
ReturnValue_t P60DockDummy::interpretDeviceReply(DeviceCommandId_t id, const uint8_t *packet) {
|
||||||
return RETURN_OK;
|
return returnvalue::OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
void P60DockDummy::fillCommandAndReplyMap() {}
|
void P60DockDummy::fillCommandAndReplyMap() {}
|
||||||
@ -40,7 +40,7 @@ uint32_t P60DockDummy::getTransitionDelayMs(Mode_t modeFrom, Mode_t modeTo) { re
|
|||||||
|
|
||||||
ReturnValue_t P60DockDummy::initializeLocalDataPool(localpool::DataPool &localDataPoolMap,
|
ReturnValue_t P60DockDummy::initializeLocalDataPool(localpool::DataPool &localDataPoolMap,
|
||||||
LocalDataPoolManager &poolManager) {
|
LocalDataPoolManager &poolManager) {
|
||||||
localDataPoolMap.emplace(P60System::pool::P60DOCK_TEMPERATURE_1, new PoolEntry<float>({0}));
|
localDataPoolMap.emplace(P60Dock::pool::P60DOCK_TEMPERATURE_1, new PoolEntry<float>({0}));
|
||||||
localDataPoolMap.emplace(P60System::pool::P60DOCK_TEMPERATURE_2, new PoolEntry<float>({0}));
|
localDataPoolMap.emplace(P60Dock::pool::P60DOCK_TEMPERATURE_2, new PoolEntry<float>({0}));
|
||||||
return HasReturnvaluesIF::RETURN_OK;
|
return returnvalue::OK;
|
||||||
}
|
}
|
||||||
|
@ -19,16 +19,16 @@ ReturnValue_t PduDummy::buildTransitionDeviceCommand(DeviceCommandId_t *id) {
|
|||||||
|
|
||||||
ReturnValue_t PduDummy::buildCommandFromCommand(DeviceCommandId_t deviceCommand,
|
ReturnValue_t PduDummy::buildCommandFromCommand(DeviceCommandId_t deviceCommand,
|
||||||
const uint8_t *commandData, size_t commandDataLen) {
|
const uint8_t *commandData, size_t commandDataLen) {
|
||||||
return RETURN_OK;
|
return returnvalue::OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
ReturnValue_t PduDummy::scanForReply(const uint8_t *start, size_t len, DeviceCommandId_t *foundId,
|
ReturnValue_t PduDummy::scanForReply(const uint8_t *start, size_t len, DeviceCommandId_t *foundId,
|
||||||
size_t *foundLen) {
|
size_t *foundLen) {
|
||||||
return RETURN_OK;
|
return returnvalue::OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
ReturnValue_t PduDummy::interpretDeviceReply(DeviceCommandId_t id, const uint8_t *packet) {
|
ReturnValue_t PduDummy::interpretDeviceReply(DeviceCommandId_t id, const uint8_t *packet) {
|
||||||
return RETURN_OK;
|
return returnvalue::OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
void PduDummy::fillCommandAndReplyMap() {}
|
void PduDummy::fillCommandAndReplyMap() {}
|
||||||
@ -37,6 +37,6 @@ uint32_t PduDummy::getTransitionDelayMs(Mode_t modeFrom, Mode_t modeTo) { return
|
|||||||
|
|
||||||
ReturnValue_t PduDummy::initializeLocalDataPool(localpool::DataPool &localDataPoolMap,
|
ReturnValue_t PduDummy::initializeLocalDataPool(localpool::DataPool &localDataPoolMap,
|
||||||
LocalDataPoolManager &poolManager) {
|
LocalDataPoolManager &poolManager) {
|
||||||
localDataPoolMap.emplace(P60System::pool::PDU_TEMPERATURE, new PoolEntry<float>({0}));
|
localDataPoolMap.emplace(PDU::pool::PDU_TEMPERATURE, new PoolEntry<float>({0}));
|
||||||
return HasReturnvaluesIF::RETURN_OK;
|
return returnvalue::OK;
|
||||||
}
|
}
|
||||||
|
@ -22,16 +22,16 @@ ReturnValue_t PlPcduDummy::buildTransitionDeviceCommand(DeviceCommandId_t *id) {
|
|||||||
ReturnValue_t PlPcduDummy::buildCommandFromCommand(DeviceCommandId_t deviceCommand,
|
ReturnValue_t PlPcduDummy::buildCommandFromCommand(DeviceCommandId_t deviceCommand,
|
||||||
const uint8_t *commandData,
|
const uint8_t *commandData,
|
||||||
size_t commandDataLen) {
|
size_t commandDataLen) {
|
||||||
return RETURN_OK;
|
return returnvalue::OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
ReturnValue_t PlPcduDummy::scanForReply(const uint8_t *start, size_t len,
|
ReturnValue_t PlPcduDummy::scanForReply(const uint8_t *start, size_t len,
|
||||||
DeviceCommandId_t *foundId, size_t *foundLen) {
|
DeviceCommandId_t *foundId, size_t *foundLen) {
|
||||||
return RETURN_OK;
|
return returnvalue::OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
ReturnValue_t PlPcduDummy::interpretDeviceReply(DeviceCommandId_t id, const uint8_t *packet) {
|
ReturnValue_t PlPcduDummy::interpretDeviceReply(DeviceCommandId_t id, const uint8_t *packet) {
|
||||||
return RETURN_OK;
|
return returnvalue::OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
void PlPcduDummy::fillCommandAndReplyMap() {}
|
void PlPcduDummy::fillCommandAndReplyMap() {}
|
||||||
@ -41,5 +41,5 @@ uint32_t PlPcduDummy::getTransitionDelayMs(Mode_t modeFrom, Mode_t modeTo) { ret
|
|||||||
ReturnValue_t PlPcduDummy::initializeLocalDataPool(localpool::DataPool &localDataPoolMap,
|
ReturnValue_t PlPcduDummy::initializeLocalDataPool(localpool::DataPool &localDataPoolMap,
|
||||||
LocalDataPoolManager &poolManager) {
|
LocalDataPoolManager &poolManager) {
|
||||||
localDataPoolMap.emplace(plpcdu::PlPcduPoolIds::TEMP, new PoolEntry<float>({0.0}));
|
localDataPoolMap.emplace(plpcdu::PlPcduPoolIds::TEMP, new PoolEntry<float>({0.0}));
|
||||||
return HasReturnvaluesIF::RETURN_OK;
|
return returnvalue::OK;
|
||||||
}
|
}
|
||||||
|
@ -19,16 +19,16 @@ ReturnValue_t RwDummy::buildTransitionDeviceCommand(DeviceCommandId_t *id) {
|
|||||||
|
|
||||||
ReturnValue_t RwDummy::buildCommandFromCommand(DeviceCommandId_t deviceCommand,
|
ReturnValue_t RwDummy::buildCommandFromCommand(DeviceCommandId_t deviceCommand,
|
||||||
const uint8_t *commandData, size_t commandDataLen) {
|
const uint8_t *commandData, size_t commandDataLen) {
|
||||||
return RETURN_OK;
|
return returnvalue::OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
ReturnValue_t RwDummy::scanForReply(const uint8_t *start, size_t len, DeviceCommandId_t *foundId,
|
ReturnValue_t RwDummy::scanForReply(const uint8_t *start, size_t len, DeviceCommandId_t *foundId,
|
||||||
size_t *foundLen) {
|
size_t *foundLen) {
|
||||||
return RETURN_OK;
|
return returnvalue::OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
ReturnValue_t RwDummy::interpretDeviceReply(DeviceCommandId_t id, const uint8_t *packet) {
|
ReturnValue_t RwDummy::interpretDeviceReply(DeviceCommandId_t id, const uint8_t *packet) {
|
||||||
return RETURN_OK;
|
return returnvalue::OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
void RwDummy::fillCommandAndReplyMap() {}
|
void RwDummy::fillCommandAndReplyMap() {}
|
||||||
@ -71,5 +71,5 @@ ReturnValue_t RwDummy::initializeLocalDataPool(localpool::DataPool &localDataPoo
|
|||||||
localDataPoolMap.emplace(RwDefinitions::SPI_BYTES_READ, new PoolEntry<uint32_t>({0}));
|
localDataPoolMap.emplace(RwDefinitions::SPI_BYTES_READ, new PoolEntry<uint32_t>({0}));
|
||||||
localDataPoolMap.emplace(RwDefinitions::SPI_REG_OVERRUN_ERRORS, new PoolEntry<uint32_t>({0}));
|
localDataPoolMap.emplace(RwDefinitions::SPI_REG_OVERRUN_ERRORS, new PoolEntry<uint32_t>({0}));
|
||||||
localDataPoolMap.emplace(RwDefinitions::SPI_TOTAL_ERRORS, new PoolEntry<uint32_t>({0}));
|
localDataPoolMap.emplace(RwDefinitions::SPI_TOTAL_ERRORS, new PoolEntry<uint32_t>({0}));
|
||||||
return HasReturnvaluesIF::RETURN_OK;
|
return returnvalue::OK;
|
||||||
}
|
}
|
||||||
|
@ -22,16 +22,16 @@ ReturnValue_t StarTrackerDummy::buildTransitionDeviceCommand(DeviceCommandId_t *
|
|||||||
ReturnValue_t StarTrackerDummy::buildCommandFromCommand(DeviceCommandId_t deviceCommand,
|
ReturnValue_t StarTrackerDummy::buildCommandFromCommand(DeviceCommandId_t deviceCommand,
|
||||||
const uint8_t *commandData,
|
const uint8_t *commandData,
|
||||||
size_t commandDataLen) {
|
size_t commandDataLen) {
|
||||||
return RETURN_OK;
|
return returnvalue::OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
ReturnValue_t StarTrackerDummy::scanForReply(const uint8_t *start, size_t len,
|
ReturnValue_t StarTrackerDummy::scanForReply(const uint8_t *start, size_t len,
|
||||||
DeviceCommandId_t *foundId, size_t *foundLen) {
|
DeviceCommandId_t *foundId, size_t *foundLen) {
|
||||||
return RETURN_OK;
|
return returnvalue::OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
ReturnValue_t StarTrackerDummy::interpretDeviceReply(DeviceCommandId_t id, const uint8_t *packet) {
|
ReturnValue_t StarTrackerDummy::interpretDeviceReply(DeviceCommandId_t id, const uint8_t *packet) {
|
||||||
return RETURN_OK;
|
return returnvalue::OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
void StarTrackerDummy::fillCommandAndReplyMap() {}
|
void StarTrackerDummy::fillCommandAndReplyMap() {}
|
||||||
@ -41,5 +41,5 @@ uint32_t StarTrackerDummy::getTransitionDelayMs(Mode_t modeFrom, Mode_t modeTo)
|
|||||||
ReturnValue_t StarTrackerDummy::initializeLocalDataPool(localpool::DataPool &localDataPoolMap,
|
ReturnValue_t StarTrackerDummy::initializeLocalDataPool(localpool::DataPool &localDataPoolMap,
|
||||||
LocalDataPoolManager &poolManager) {
|
LocalDataPoolManager &poolManager) {
|
||||||
localDataPoolMap.emplace(startracker::MCU_TEMPERATURE, new PoolEntry<float>({0}));
|
localDataPoolMap.emplace(startracker::MCU_TEMPERATURE, new PoolEntry<float>({0}));
|
||||||
return HasReturnvaluesIF::RETURN_OK;
|
return returnvalue::OK;
|
||||||
}
|
}
|
||||||
|
@ -25,15 +25,17 @@ ReturnValue_t SusDummy::initialize() {
|
|||||||
if (not done) {
|
if (not done) {
|
||||||
done = true;
|
done = true;
|
||||||
ReturnValue_t result = ExtendedControllerBase::initialize();
|
ReturnValue_t result = ExtendedControllerBase::initialize();
|
||||||
if (result != HasReturnvaluesIF::RETURN_OK) {
|
if (result != returnvalue::OK) {
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return HasReturnvaluesIF::RETURN_OK;
|
return returnvalue::OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
ReturnValue_t SusDummy::handleCommandMessage(CommandMessage* message) { return RETURN_FAILED; }
|
ReturnValue_t SusDummy::handleCommandMessage(CommandMessage* message) {
|
||||||
|
return returnvalue::FAILED;
|
||||||
|
}
|
||||||
|
|
||||||
void SusDummy::performControlOperation() {
|
void SusDummy::performControlOperation() {
|
||||||
iteration++;
|
iteration++;
|
||||||
@ -54,7 +56,7 @@ ReturnValue_t SusDummy::initializeLocalDataPool(localpool::DataPool& localDataPo
|
|||||||
localDataPoolMap.emplace(SUS::SusPoolIds::TEMPERATURE_C, new PoolEntry<float>({0}, 1, true));
|
localDataPoolMap.emplace(SUS::SusPoolIds::TEMPERATURE_C, new PoolEntry<float>({0}, 1, true));
|
||||||
localDataPoolMap.emplace(SUS::SusPoolIds::CHANNEL_VEC, new PoolEntry<uint16_t>({0}));
|
localDataPoolMap.emplace(SUS::SusPoolIds::CHANNEL_VEC, new PoolEntry<uint16_t>({0}));
|
||||||
|
|
||||||
return RETURN_OK;
|
return returnvalue::OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
LocalPoolDataSetBase* SusDummy::getDataSetHandle(sid_t sid) {
|
LocalPoolDataSetBase* SusDummy::getDataSetHandle(sid_t sid) {
|
||||||
@ -74,5 +76,5 @@ ReturnValue_t SusDummy::checkModeCommand(Mode_t mode, Submode_t submode,
|
|||||||
if ((mode != MODE_OFF) && (mode != MODE_ON) && (mode != MODE_NORMAL)) {
|
if ((mode != MODE_OFF) && (mode != MODE_ON) && (mode != MODE_NORMAL)) {
|
||||||
return INVALID_MODE;
|
return INVALID_MODE;
|
||||||
}
|
}
|
||||||
return RETURN_OK;
|
return returnvalue::OK;
|
||||||
}
|
}
|
||||||
|
@ -22,16 +22,16 @@ ReturnValue_t SyrlinksDummy::buildTransitionDeviceCommand(DeviceCommandId_t *id)
|
|||||||
ReturnValue_t SyrlinksDummy::buildCommandFromCommand(DeviceCommandId_t deviceCommand,
|
ReturnValue_t SyrlinksDummy::buildCommandFromCommand(DeviceCommandId_t deviceCommand,
|
||||||
const uint8_t *commandData,
|
const uint8_t *commandData,
|
||||||
size_t commandDataLen) {
|
size_t commandDataLen) {
|
||||||
return RETURN_OK;
|
return returnvalue::OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
ReturnValue_t SyrlinksDummy::scanForReply(const uint8_t *start, size_t len,
|
ReturnValue_t SyrlinksDummy::scanForReply(const uint8_t *start, size_t len,
|
||||||
DeviceCommandId_t *foundId, size_t *foundLen) {
|
DeviceCommandId_t *foundId, size_t *foundLen) {
|
||||||
return RETURN_OK;
|
return returnvalue::OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
ReturnValue_t SyrlinksDummy::interpretDeviceReply(DeviceCommandId_t id, const uint8_t *packet) {
|
ReturnValue_t SyrlinksDummy::interpretDeviceReply(DeviceCommandId_t id, const uint8_t *packet) {
|
||||||
return RETURN_OK;
|
return returnvalue::OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
void SyrlinksDummy::fillCommandAndReplyMap() {}
|
void SyrlinksDummy::fillCommandAndReplyMap() {}
|
||||||
@ -42,5 +42,5 @@ ReturnValue_t SyrlinksDummy::initializeLocalDataPool(localpool::DataPool &localD
|
|||||||
LocalDataPoolManager &poolManager) {
|
LocalDataPoolManager &poolManager) {
|
||||||
localDataPoolMap.emplace(syrlinks::TEMP_BASEBAND_BOARD, new PoolEntry<float>({0}));
|
localDataPoolMap.emplace(syrlinks::TEMP_BASEBAND_BOARD, new PoolEntry<float>({0}));
|
||||||
localDataPoolMap.emplace(syrlinks::TEMP_POWER_AMPLIFIER, new PoolEntry<float>({0}));
|
localDataPoolMap.emplace(syrlinks::TEMP_POWER_AMPLIFIER, new PoolEntry<float>({0}));
|
||||||
return HasReturnvaluesIF::RETURN_OK;
|
return returnvalue::OK;
|
||||||
}
|
}
|
||||||
|
@ -32,16 +32,16 @@ ReturnValue_t TemperatureSensorsDummy::initialize() {
|
|||||||
if (not done) {
|
if (not done) {
|
||||||
done = true;
|
done = true;
|
||||||
ReturnValue_t result = ExtendedControllerBase::initialize();
|
ReturnValue_t result = ExtendedControllerBase::initialize();
|
||||||
if (result != HasReturnvaluesIF::RETURN_OK) {
|
if (result != returnvalue::OK) {
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return HasReturnvaluesIF::RETURN_OK;
|
return returnvalue::OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
ReturnValue_t TemperatureSensorsDummy::handleCommandMessage(CommandMessage* message) {
|
ReturnValue_t TemperatureSensorsDummy::handleCommandMessage(CommandMessage* message) {
|
||||||
return RETURN_FAILED;
|
return returnvalue::FAILED;
|
||||||
}
|
}
|
||||||
|
|
||||||
void TemperatureSensorsDummy::performControlOperation() {
|
void TemperatureSensorsDummy::performControlOperation() {
|
||||||
@ -49,7 +49,7 @@ void TemperatureSensorsDummy::performControlOperation() {
|
|||||||
value = sin(iteration / 80. * M_PI) * 10;
|
value = sin(iteration / 80. * M_PI) * 10;
|
||||||
|
|
||||||
ReturnValue_t result = max31865Set.read();
|
ReturnValue_t result = max31865Set.read();
|
||||||
if (result != RETURN_OK) {
|
if (result != returnvalue::OK) {
|
||||||
sif::warning << "Failed to read temperature from MAX31865 dataset" << std::endl;
|
sif::warning << "Failed to read temperature from MAX31865 dataset" << std::endl;
|
||||||
}
|
}
|
||||||
max31865Set.rtdValue = value - 5;
|
max31865Set.rtdValue = value - 5;
|
||||||
@ -73,7 +73,7 @@ ReturnValue_t TemperatureSensorsDummy::initializeLocalDataPool(
|
|||||||
localDataPoolMap.emplace(static_cast<lp_id_t>(MAX31865::PoolIds::FAULT_BYTE),
|
localDataPoolMap.emplace(static_cast<lp_id_t>(MAX31865::PoolIds::FAULT_BYTE),
|
||||||
new PoolEntry<uint8_t>({0}));
|
new PoolEntry<uint8_t>({0}));
|
||||||
|
|
||||||
return RETURN_OK;
|
return returnvalue::OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
LocalPoolDataSetBase* TemperatureSensorsDummy::getDataSetHandle(sid_t sid) {
|
LocalPoolDataSetBase* TemperatureSensorsDummy::getDataSetHandle(sid_t sid) {
|
||||||
@ -94,5 +94,5 @@ ReturnValue_t TemperatureSensorsDummy::checkModeCommand(Mode_t mode, Submode_t s
|
|||||||
if ((mode != MODE_OFF) && (mode != MODE_ON) && (mode != MODE_NORMAL)) {
|
if ((mode != MODE_OFF) && (mode != MODE_ON) && (mode != MODE_NORMAL)) {
|
||||||
return INVALID_MODE;
|
return INVALID_MODE;
|
||||||
}
|
}
|
||||||
return RETURN_OK;
|
return returnvalue::OK;
|
||||||
}
|
}
|
||||||
|
2
fsfw
2
fsfw
@ -1 +1 @@
|
|||||||
Subproject commit 7881f5bab86212035b94f4995551d75e843174b5
|
Subproject commit 9a590a3fcd81ed4dd48de503522b6d71f64205d2
|
@ -1 +1 @@
|
|||||||
Subproject commit e84be4bb1710e90e97f8e501565106b9e63ef56b
|
Subproject commit b1e5a2d40a5f41b9020f2beb0b976035f91c6343
|
@ -340,7 +340,7 @@ void ObjectFactory::createThermalController() {
|
|||||||
void ObjectFactory::createAcsController() { new AcsController(objects::ACS_CONTROLLER); }
|
void ObjectFactory::createAcsController() { new AcsController(objects::ACS_CONTROLLER); }
|
||||||
|
|
||||||
void ObjectFactory::gpioChecker(ReturnValue_t result, std::string output) {
|
void ObjectFactory::gpioChecker(ReturnValue_t result, std::string output) {
|
||||||
if (result != HasReturnvaluesIF::RETURN_OK) {
|
if (result != returnvalue::OK) {
|
||||||
sif::error << "ObjectFactory: Adding GPIOs failed for " << output << std::endl;
|
sif::error << "ObjectFactory: Adding GPIOs failed for " << output << std::endl;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#include <fsfw/returnvalues/HasReturnvaluesIF.h>
|
#include <fsfw/returnvalues/returnvalue.h>
|
||||||
#include <fsfw_hal/linux/gpio/LinuxLibgpioIF.h>
|
#include <fsfw_hal/linux/gpio/LinuxLibgpioIF.h>
|
||||||
|
|
||||||
#include <string>
|
#include <string>
|
||||||
|
@ -17,20 +17,20 @@ ReturnValue_t I2cTestClass::initialize() {
|
|||||||
if (mode == TestModes::BPX_BATTERY) {
|
if (mode == TestModes::BPX_BATTERY) {
|
||||||
battInit();
|
battInit();
|
||||||
}
|
}
|
||||||
return HasReturnvaluesIF::RETURN_OK;
|
return returnvalue::OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
ReturnValue_t I2cTestClass::performPeriodicAction() {
|
ReturnValue_t I2cTestClass::performPeriodicAction() {
|
||||||
if (mode == TestModes::BPX_BATTERY) {
|
if (mode == TestModes::BPX_BATTERY) {
|
||||||
battPeriodic();
|
battPeriodic();
|
||||||
}
|
}
|
||||||
return HasReturnvaluesIF::RETURN_OK;
|
return returnvalue::OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
void I2cTestClass::battInit() {
|
void I2cTestClass::battInit() {
|
||||||
sif::info << "I2cTestClass: BPX Initialization" << std::endl;
|
sif::info << "I2cTestClass: BPX Initialization" << std::endl;
|
||||||
UnixFileGuard fileHelper(i2cdev, &bpxInfo.fd, O_RDWR, "I2cTestClass::sendMessage");
|
UnixFileGuard fileHelper(i2cdev, &bpxInfo.fd, O_RDWR, "I2cTestClass::sendMessage");
|
||||||
if (fileHelper.getOpenResult() != HasReturnvaluesIF::RETURN_OK) {
|
if (fileHelper.getOpenResult() != returnvalue::OK) {
|
||||||
sif::error << "Opening I2C device" << i2cdev << " failed" << std::endl;
|
sif::error << "Opening I2C device" << i2cdev << " failed" << std::endl;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -41,13 +41,13 @@ void I2cTestClass::battInit() {
|
|||||||
cmdBuf[1] = 0x42;
|
cmdBuf[1] = 0x42;
|
||||||
sendLen = 2;
|
sendLen = 2;
|
||||||
ReturnValue_t result = i2cWrite(bpxInfo.fd, cmdBuf.data(), sendLen);
|
ReturnValue_t result = i2cWrite(bpxInfo.fd, cmdBuf.data(), sendLen);
|
||||||
if (result != HasReturnvaluesIF::RETURN_OK) {
|
if (result != returnvalue::OK) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
// Receive back port, error byte and ping reply
|
// Receive back port, error byte and ping reply
|
||||||
recvLen = 3;
|
recvLen = 3;
|
||||||
result = i2cRead(bpxInfo.fd, replyBuf.data(), recvLen);
|
result = i2cRead(bpxInfo.fd, replyBuf.data(), recvLen);
|
||||||
if (result != HasReturnvaluesIF::RETURN_OK) {
|
if (result != returnvalue::OK) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
sif::info << "Ping reply:" << std::endl;
|
sif::info << "Ping reply:" << std::endl;
|
||||||
@ -59,7 +59,7 @@ void I2cTestClass::battInit() {
|
|||||||
|
|
||||||
void I2cTestClass::battPeriodic() {
|
void I2cTestClass::battPeriodic() {
|
||||||
UnixFileGuard fileHelper(i2cdev, &bpxInfo.fd, O_RDWR, "I2cTestClass::sendMessage");
|
UnixFileGuard fileHelper(i2cdev, &bpxInfo.fd, O_RDWR, "I2cTestClass::sendMessage");
|
||||||
if (fileHelper.getOpenResult() != HasReturnvaluesIF::RETURN_OK) {
|
if (fileHelper.getOpenResult() != returnvalue::OK) {
|
||||||
sif::error << "Opening I2C device" << i2cdev << " failed" << std::endl;
|
sif::error << "Opening I2C device" << i2cdev << " failed" << std::endl;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -69,13 +69,13 @@ void I2cTestClass::battPeriodic() {
|
|||||||
cmdBuf[0] = BpxBattery::PORT_GET_HK;
|
cmdBuf[0] = BpxBattery::PORT_GET_HK;
|
||||||
sendLen = 1;
|
sendLen = 1;
|
||||||
ReturnValue_t result = i2cWrite(bpxInfo.fd, cmdBuf.data(), sendLen);
|
ReturnValue_t result = i2cWrite(bpxInfo.fd, cmdBuf.data(), sendLen);
|
||||||
if (result != HasReturnvaluesIF::RETURN_OK) {
|
if (result != returnvalue::OK) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
// Receive back HK set
|
// Receive back HK set
|
||||||
recvLen = 23;
|
recvLen = 23;
|
||||||
result = i2cRead(bpxInfo.fd, replyBuf.data(), recvLen);
|
result = i2cRead(bpxInfo.fd, replyBuf.data(), recvLen);
|
||||||
if (result != HasReturnvaluesIF::RETURN_OK) {
|
if (result != returnvalue::OK) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
sif::info << "HK reply:" << std::endl;
|
sif::info << "HK reply:" << std::endl;
|
||||||
@ -86,16 +86,16 @@ ReturnValue_t I2cTestClass::i2cWrite(int fd, uint8_t* data, size_t len) {
|
|||||||
if (write(fd, data, len) != static_cast<ssize_t>(len)) {
|
if (write(fd, data, len) != static_cast<ssize_t>(len)) {
|
||||||
sif::error << "Failed to write to I2C bus" << std::endl;
|
sif::error << "Failed to write to I2C bus" << std::endl;
|
||||||
sif::error << "Error " << errno << ": " << strerror(errno) << std::endl;
|
sif::error << "Error " << errno << ": " << strerror(errno) << std::endl;
|
||||||
return HasReturnvaluesIF::RETURN_FAILED;
|
return returnvalue::FAILED;
|
||||||
}
|
}
|
||||||
return HasReturnvaluesIF::RETURN_OK;
|
return returnvalue::OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
ReturnValue_t I2cTestClass::i2cRead(int fd, uint8_t* data, size_t len) {
|
ReturnValue_t I2cTestClass::i2cRead(int fd, uint8_t* data, size_t len) {
|
||||||
if (read(fd, data, len) != static_cast<ssize_t>(len)) {
|
if (read(fd, data, len) != static_cast<ssize_t>(len)) {
|
||||||
sif::error << "Failed to read from I2C bus" << std::endl;
|
sif::error << "Failed to read from I2C bus" << std::endl;
|
||||||
sif::error << "Error " << errno << ": " << strerror(errno) << std::endl;
|
sif::error << "Error " << errno << ": " << strerror(errno) << std::endl;
|
||||||
return HasReturnvaluesIF::RETURN_FAILED;
|
return returnvalue::FAILED;
|
||||||
}
|
}
|
||||||
return HasReturnvaluesIF::RETURN_OK;
|
return returnvalue::OK;
|
||||||
}
|
}
|
||||||
|
@ -25,9 +25,9 @@ ReturnValue_t LibgpiodTest::performPeriodicAction() {
|
|||||||
switch (testCase) {
|
switch (testCase) {
|
||||||
case (TestCases::READ): {
|
case (TestCases::READ): {
|
||||||
result = gpioInterface->readGpio(gpioIds::TEST_ID_0, gpioState);
|
result = gpioInterface->readGpio(gpioIds::TEST_ID_0, gpioState);
|
||||||
if (result != RETURN_OK) {
|
if (result != returnvalue::OK) {
|
||||||
sif::warning << "LibgpiodTest::performPeriodicAction: Failed to read gpio " << std::endl;
|
sif::warning << "LibgpiodTest::performPeriodicAction: Failed to read gpio " << std::endl;
|
||||||
return RETURN_FAILED;
|
return returnvalue::FAILED;
|
||||||
} else {
|
} else {
|
||||||
sif::debug << "LibgpiodTest::performPeriodicAction: MIO 0 state = "
|
sif::debug << "LibgpiodTest::performPeriodicAction: MIO 0 state = "
|
||||||
<< static_cast<int>(gpioState) << std::endl;
|
<< static_cast<int>(gpioState) << std::endl;
|
||||||
@ -39,23 +39,23 @@ ReturnValue_t LibgpiodTest::performPeriodicAction() {
|
|||||||
}
|
}
|
||||||
case (TestCases::BLINK): {
|
case (TestCases::BLINK): {
|
||||||
result = gpioInterface->readGpio(gpioIds::TEST_ID_0, gpioState);
|
result = gpioInterface->readGpio(gpioIds::TEST_ID_0, gpioState);
|
||||||
if (result != HasReturnvaluesIF::RETURN_OK) {
|
if (result != returnvalue::OK) {
|
||||||
sif::warning << "LibgpiodTest::performPeriodicAction: Failed to read gpio " << std::endl;
|
sif::warning << "LibgpiodTest::performPeriodicAction: Failed to read gpio " << std::endl;
|
||||||
return RETURN_FAILED;
|
return returnvalue::FAILED;
|
||||||
}
|
}
|
||||||
if (gpioState == gpio::Levels::HIGH) {
|
if (gpioState == gpio::Levels::HIGH) {
|
||||||
result = gpioInterface->pullLow(gpioIds::TEST_ID_0);
|
result = gpioInterface->pullLow(gpioIds::TEST_ID_0);
|
||||||
if (result != HasReturnvaluesIF::RETURN_OK) {
|
if (result != returnvalue::OK) {
|
||||||
sif::warning << "LibgpiodTest::performPeriodicAction: Could not pull GPIO low!"
|
sif::warning << "LibgpiodTest::performPeriodicAction: Could not pull GPIO low!"
|
||||||
<< std::endl;
|
<< std::endl;
|
||||||
return HasReturnvaluesIF::RETURN_FAILED;
|
return returnvalue::FAILED;
|
||||||
}
|
}
|
||||||
} else if (gpioState == gpio::Levels::LOW) {
|
} else if (gpioState == gpio::Levels::LOW) {
|
||||||
result = gpioInterface->pullHigh(gpioIds::TEST_ID_0);
|
result = gpioInterface->pullHigh(gpioIds::TEST_ID_0);
|
||||||
if (result != HasReturnvaluesIF::RETURN_OK) {
|
if (result != returnvalue::OK) {
|
||||||
sif::warning << "LibgpiodTest::performPeriodicAction: Could not pull GPIO high!"
|
sif::warning << "LibgpiodTest::performPeriodicAction: Could not pull GPIO high!"
|
||||||
<< std::endl;
|
<< std::endl;
|
||||||
return HasReturnvaluesIF::RETURN_FAILED;
|
return returnvalue::FAILED;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
sif::warning << "LibgpiodTest::performPeriodicAction: Invalid GPIO state" << std::endl;
|
sif::warning << "LibgpiodTest::performPeriodicAction: Invalid GPIO state" << std::endl;
|
||||||
@ -68,7 +68,7 @@ ReturnValue_t LibgpiodTest::performPeriodicAction() {
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
return RETURN_OK;
|
return returnvalue::OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
ReturnValue_t LibgpiodTest::performOneShotAction() {
|
ReturnValue_t LibgpiodTest::performOneShotAction() {
|
||||||
@ -84,44 +84,44 @@ ReturnValue_t LibgpiodTest::performOneShotAction() {
|
|||||||
}
|
}
|
||||||
case (TestCases::LOOPBACK): {
|
case (TestCases::LOOPBACK): {
|
||||||
result = gpioInterface->pullHigh(gpioIds::TEST_ID_0);
|
result = gpioInterface->pullHigh(gpioIds::TEST_ID_0);
|
||||||
if (result == HasReturnvaluesIF::RETURN_OK) {
|
if (result == returnvalue::OK) {
|
||||||
sif::info << "LibgpiodTest::performOneShotAction: "
|
sif::info << "LibgpiodTest::performOneShotAction: "
|
||||||
"GPIO pulled high successfully for loopback test"
|
"GPIO pulled high successfully for loopback test"
|
||||||
<< std::endl;
|
<< std::endl;
|
||||||
} else {
|
} else {
|
||||||
sif::warning << "LibgpiodTest::performOneShotAction: Could not pull GPIO high!"
|
sif::warning << "LibgpiodTest::performOneShotAction: Could not pull GPIO high!"
|
||||||
<< std::endl;
|
<< std::endl;
|
||||||
return HasReturnvaluesIF::RETURN_OK;
|
return returnvalue::OK;
|
||||||
}
|
}
|
||||||
result = gpioInterface->readGpio(gpioIds::TEST_ID_1, gpioState);
|
result = gpioInterface->readGpio(gpioIds::TEST_ID_1, gpioState);
|
||||||
if (result == HasReturnvaluesIF::RETURN_OK and gpioState == gpio::Levels::HIGH) {
|
if (result == returnvalue::OK and gpioState == gpio::Levels::HIGH) {
|
||||||
sif::info << "LibgpiodTest::performOneShotAction: "
|
sif::info << "LibgpiodTest::performOneShotAction: "
|
||||||
"GPIO state read successfully and is high"
|
"GPIO state read successfully and is high"
|
||||||
<< std::endl;
|
<< std::endl;
|
||||||
} else {
|
} else {
|
||||||
sif::warning << "LibgpiodTest::performOneShotAction: GPIO read and is not high!"
|
sif::warning << "LibgpiodTest::performOneShotAction: GPIO read and is not high!"
|
||||||
<< std::endl;
|
<< std::endl;
|
||||||
return HasReturnvaluesIF::RETURN_OK;
|
return returnvalue::OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
result = gpioInterface->pullLow(gpioIds::TEST_ID_0);
|
result = gpioInterface->pullLow(gpioIds::TEST_ID_0);
|
||||||
if (result == HasReturnvaluesIF::RETURN_OK) {
|
if (result == returnvalue::OK) {
|
||||||
sif::info << "LibgpiodTest::performOneShotAction: "
|
sif::info << "LibgpiodTest::performOneShotAction: "
|
||||||
"GPIO pulled low successfully for loopback test"
|
"GPIO pulled low successfully for loopback test"
|
||||||
<< std::endl;
|
<< std::endl;
|
||||||
}
|
}
|
||||||
result = gpioInterface->readGpio(gpioIds::TEST_ID_1, gpioState);
|
result = gpioInterface->readGpio(gpioIds::TEST_ID_1, gpioState);
|
||||||
if (result == HasReturnvaluesIF::RETURN_OK and gpioState == gpio::Levels::LOW) {
|
if (result == returnvalue::OK and gpioState == gpio::Levels::LOW) {
|
||||||
sif::info << "LibgpiodTest::performOneShotAction: "
|
sif::info << "LibgpiodTest::performOneShotAction: "
|
||||||
"GPIO state read successfully and is low"
|
"GPIO state read successfully and is low"
|
||||||
<< std::endl;
|
<< std::endl;
|
||||||
} else {
|
} else {
|
||||||
sif::warning << "LibgpiodTest::performOneShotAction: GPIO read and is not low!"
|
sif::warning << "LibgpiodTest::performOneShotAction: GPIO read and is not low!"
|
||||||
<< std::endl;
|
<< std::endl;
|
||||||
return HasReturnvaluesIF::RETURN_OK;
|
return returnvalue::OK;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return HasReturnvaluesIF::RETURN_OK;
|
return returnvalue::OK;
|
||||||
}
|
}
|
||||||
|
@ -53,7 +53,7 @@ ReturnValue_t SpiTestClass::performOneShotAction() {
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return HasReturnvaluesIF::RETURN_OK;
|
return returnvalue::OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
ReturnValue_t SpiTestClass::performPeriodicAction() {
|
ReturnValue_t SpiTestClass::performPeriodicAction() {
|
||||||
@ -65,7 +65,7 @@ ReturnValue_t SpiTestClass::performPeriodicAction() {
|
|||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
return HasReturnvaluesIF::RETURN_OK;
|
return returnvalue::OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
void SpiTestClass::performRm3100Test(uint8_t mgmId) {
|
void SpiTestClass::performRm3100Test(uint8_t mgmId) {
|
||||||
@ -532,11 +532,11 @@ void SpiTestClass::max1227PlPcduTest(int fd) {
|
|||||||
adcCfg.vbatSwitch) {
|
adcCfg.vbatSwitch) {
|
||||||
// This enables the ADC
|
// This enables the ADC
|
||||||
ReturnValue_t result = gpioIF->pullHigh(gpioIds::PLPCDU_ENB_VBAT0);
|
ReturnValue_t result = gpioIF->pullHigh(gpioIds::PLPCDU_ENB_VBAT0);
|
||||||
if (result != HasReturnvaluesIF::RETURN_OK) {
|
if (result != returnvalue::OK) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
result = gpioIF->pullHigh(gpioIds::PLPCDU_ENB_VBAT1);
|
result = gpioIF->pullHigh(gpioIds::PLPCDU_ENB_VBAT1);
|
||||||
if (result != HasReturnvaluesIF::RETURN_OK) {
|
if (result != returnvalue::OK) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
adcCfg.vbatSwitch = false;
|
adcCfg.vbatSwitch = false;
|
||||||
@ -878,10 +878,10 @@ uint8_t SpiTestClass::readRegister(int fd, gpioId_t chipSelect, uint8_t reg) {
|
|||||||
|
|
||||||
ReturnValue_t SpiTestClass::transfer(int fd, gpioId_t chipSelect = gpio::NO_GPIO) {
|
ReturnValue_t SpiTestClass::transfer(int fd, gpioId_t chipSelect = gpio::NO_GPIO) {
|
||||||
int retval = 0;
|
int retval = 0;
|
||||||
ReturnValue_t result = HasReturnvaluesIF::RETURN_OK;
|
ReturnValue_t result = returnvalue::OK;
|
||||||
if (chipSelect != gpio::NO_GPIO) {
|
if (chipSelect != gpio::NO_GPIO) {
|
||||||
result = gpioIF->pullLow(chipSelect);
|
result = gpioIF->pullLow(chipSelect);
|
||||||
if (result != HasReturnvaluesIF::RETURN_OK) {
|
if (result != returnvalue::OK) {
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -889,14 +889,14 @@ ReturnValue_t SpiTestClass::transfer(int fd, gpioId_t chipSelect = gpio::NO_GPIO
|
|||||||
retval = ioctl(fd, SPI_IOC_MESSAGE(1), &spiTransferStruct);
|
retval = ioctl(fd, SPI_IOC_MESSAGE(1), &spiTransferStruct);
|
||||||
if (retval < 0) {
|
if (retval < 0) {
|
||||||
utility::handleIoctlError("SpiTestClass::transfer: ioctl failed");
|
utility::handleIoctlError("SpiTestClass::transfer: ioctl failed");
|
||||||
return HasReturnvaluesIF::RETURN_FAILED;
|
return returnvalue::FAILED;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (chipSelect != gpio::NO_GPIO) {
|
if (chipSelect != gpio::NO_GPIO) {
|
||||||
result = gpioIF->pullHigh(chipSelect);
|
result = gpioIF->pullHigh(chipSelect);
|
||||||
if (result != HasReturnvaluesIF::RETURN_OK) {
|
if (result != returnvalue::OK) {
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return HasReturnvaluesIF::RETURN_OK;
|
return returnvalue::OK;
|
||||||
}
|
}
|
||||||
|
@ -47,10 +47,10 @@ ReturnValue_t UartTestClass::initialize() {
|
|||||||
} else if (mode == TestModes::SCEX) {
|
} else if (mode == TestModes::SCEX) {
|
||||||
scexInit();
|
scexInit();
|
||||||
}
|
}
|
||||||
return HasReturnvaluesIF::RETURN_OK;
|
return returnvalue::OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
ReturnValue_t UartTestClass::performOneShotAction() { return HasReturnvaluesIF::RETURN_OK; }
|
ReturnValue_t UartTestClass::performOneShotAction() { return returnvalue::OK; }
|
||||||
|
|
||||||
ReturnValue_t UartTestClass::performPeriodicAction() {
|
ReturnValue_t UartTestClass::performPeriodicAction() {
|
||||||
if (mode == TestModes::GPS) {
|
if (mode == TestModes::GPS) {
|
||||||
@ -58,7 +58,7 @@ ReturnValue_t UartTestClass::performPeriodicAction() {
|
|||||||
} else if (mode == TestModes::SCEX) {
|
} else if (mode == TestModes::SCEX) {
|
||||||
scexPeriodic();
|
scexPeriodic();
|
||||||
}
|
}
|
||||||
return HasReturnvaluesIF::RETURN_OK;
|
return returnvalue::OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
void UartTestClass::gpsInit() {
|
void UartTestClass::gpsInit() {
|
||||||
@ -368,12 +368,17 @@ int UartTestClass::prepareScexCmd(scex::Cmds cmd, bool tempCheck, uint8_t* cmdBu
|
|||||||
cmdBuf[1] = 1;
|
cmdBuf[1] = 1;
|
||||||
cmdBuf[2] = 1;
|
cmdBuf[2] = 1;
|
||||||
uint16_t userDataLen = 0;
|
uint16_t userDataLen = 0;
|
||||||
cmdBuf[3] = (userDataLen >> 8) & 0xff;
|
tmpCmdBuf[3] = (userDataLen >> 8) & 0xff;
|
||||||
cmdBuf[4] = userDataLen & 0xff;
|
tmpCmdBuf[4] = userDataLen & 0xff;
|
||||||
uint16_t crc = CRC::crc16ccitt(cmdBuf, 5);
|
uint16_t crc = CRC::crc16ccitt(tmpCmdBuf.data(), 5);
|
||||||
cmdBuf[5] = (crc >> 8) & 0xff;
|
tmpCmdBuf[5] = (crc >> 8) & 0xff;
|
||||||
cmdBuf[6] = crc & 0xff;
|
tmpCmdBuf[6] = crc & 0xff;
|
||||||
*len = 7;
|
ReturnValue_t result =
|
||||||
|
dleEncoder.encode(tmpCmdBuf.data(), 7, cmdBuf.data(), cmdBuf.size(), &encodedLen, true);
|
||||||
|
if (result != returnvalue::OK) {
|
||||||
|
sif::warning << "UartTestClass::scexInit: Encoding failed" << std::endl;
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1 +1 @@
|
|||||||
target_sources(${OBSW_NAME} PUBLIC CspComIF.cpp CspCookie.cpp)
|
target_sources(${OBSW_NAME} PUBLIC CspComIF.cpp)
|
||||||
|
@ -3,8 +3,16 @@
|
|||||||
#include <csp/drivers/can_socketcan.h>
|
#include <csp/drivers/can_socketcan.h>
|
||||||
#include <fsfw/serialize/SerializeAdapter.h>
|
#include <fsfw/serialize/SerializeAdapter.h>
|
||||||
#include <fsfw/serviceinterface/ServiceInterfaceStream.h>
|
#include <fsfw/serviceinterface/ServiceInterfaceStream.h>
|
||||||
|
#include <mission/devices/devicedefinitions/GomspaceDefinitions.h>
|
||||||
|
#include <p60acu.h>
|
||||||
|
#include <p60dock.h>
|
||||||
|
#include <p60pdu.h>
|
||||||
|
#include <param/param_string.h>
|
||||||
|
#include <param/rparam_client.h>
|
||||||
|
|
||||||
#include "CspCookie.h"
|
#include "mission/csp/CspCookie.h"
|
||||||
|
|
||||||
|
using namespace GOMSPACE;
|
||||||
|
|
||||||
CspComIF::CspComIF(object_id_t objectId) : SystemObject(objectId) {}
|
CspComIF::CspComIF(object_id_t objectId) : SystemObject(objectId) {}
|
||||||
|
|
||||||
@ -31,7 +39,7 @@ ReturnValue_t CspComIF::initializeInterface(CookieIF* cookie) {
|
|||||||
if (csp_init(cspOwnAddress) != CSP_ERR_NONE ||
|
if (csp_init(cspOwnAddress) != CSP_ERR_NONE ||
|
||||||
csp_buffer_init(buf_count, buf_size) != CSP_ERR_NONE) {
|
csp_buffer_init(buf_count, buf_size) != CSP_ERR_NONE) {
|
||||||
sif::error << "Failed to init CSP\r\n" << std::endl;
|
sif::error << "Failed to init CSP\r\n" << std::endl;
|
||||||
return HasReturnvaluesIF::RETURN_FAILED;
|
return returnvalue::FAILED;
|
||||||
}
|
}
|
||||||
|
|
||||||
int promisc = 0; // Set filter mode on
|
int promisc = 0; // Set filter mode on
|
||||||
@ -45,7 +53,7 @@ ReturnValue_t CspComIF::initializeInterface(CookieIF* cookie) {
|
|||||||
int result = csp_rtable_set(address, netmask, csp_if_ptr, mac);
|
int result = csp_rtable_set(address, netmask, csp_if_ptr, mac);
|
||||||
if (result != CSP_ERR_NONE) {
|
if (result != CSP_ERR_NONE) {
|
||||||
sif::error << "Failed to add can interface to router table" << std::endl;
|
sif::error << "Failed to add can interface to router table" << std::endl;
|
||||||
return HasReturnvaluesIF::RETURN_FAILED;
|
return returnvalue::FAILED;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Start the route task */
|
/* Start the route task */
|
||||||
@ -54,7 +62,7 @@ ReturnValue_t CspComIF::initializeInterface(CookieIF* cookie) {
|
|||||||
result = csp_route_start_task(task_stack_size, priority);
|
result = csp_route_start_task(task_stack_size, priority);
|
||||||
if (result != CSP_ERR_NONE) {
|
if (result != CSP_ERR_NONE) {
|
||||||
sif::error << "Failed to start csp route task" << std::endl;
|
sif::error << "Failed to start csp route task" << std::endl;
|
||||||
return HasReturnvaluesIF::RETURN_FAILED;
|
return returnvalue::FAILED;
|
||||||
}
|
}
|
||||||
sif::info << canInterface << " initialized successfully" << std::endl;
|
sif::info << canInterface << " initialized successfully" << std::endl;
|
||||||
}
|
}
|
||||||
@ -63,78 +71,144 @@ ReturnValue_t CspComIF::initializeInterface(CookieIF* cookie) {
|
|||||||
uint16_t maxReplyLength = cspCookie->getMaxReplyLength();
|
uint16_t maxReplyLength = cspCookie->getMaxReplyLength();
|
||||||
if (cspDeviceMap.find(cspAddress) == cspDeviceMap.end()) {
|
if (cspDeviceMap.find(cspAddress) == cspDeviceMap.end()) {
|
||||||
/* Insert device information in CSP map */
|
/* Insert device information in CSP map */
|
||||||
cspDeviceMap.emplace(cspAddress, vectorBuffer(maxReplyLength));
|
cspDeviceMap.emplace(cspAddress, ReplyInfo(maxReplyLength));
|
||||||
}
|
}
|
||||||
|
return returnvalue::OK;
|
||||||
return HasReturnvaluesIF::RETURN_OK;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
ReturnValue_t CspComIF::sendMessage(CookieIF* cookie, const uint8_t* sendData, size_t sendLen) {
|
ReturnValue_t CspComIF::sendMessage(CookieIF* cookie, const uint8_t* sendData, size_t sendLen) {
|
||||||
int result;
|
int result;
|
||||||
if (cookie == NULL) {
|
if (cookie == nullptr) {
|
||||||
return HasReturnvaluesIF::RETURN_FAILED;
|
return returnvalue::FAILED;
|
||||||
}
|
}
|
||||||
CspCookie* cspCookie = dynamic_cast<CspCookie*>(cookie);
|
CspCookie* cspCookie = dynamic_cast<CspCookie*>(cookie);
|
||||||
if (cspCookie == NULL) {
|
if (cspCookie == nullptr) {
|
||||||
return HasReturnvaluesIF::RETURN_FAILED;
|
return returnvalue::FAILED;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Extract csp port and bytes to query from command buffer */
|
|
||||||
uint8_t cspPort;
|
uint8_t cspPort;
|
||||||
uint16_t querySize = 0;
|
uint16_t querySize = 0;
|
||||||
|
if (cspCookie->getRequest() == GOMSPACE::SpecialRequestTypes::DEFAULT_COM_IF) {
|
||||||
|
/* Extract csp port and bytes to query from command buffer */
|
||||||
result = getPortAndQuerySize(&sendData, &sendLen, &cspPort, &querySize);
|
result = getPortAndQuerySize(&sendData, &sendLen, &cspPort, &querySize);
|
||||||
if (result != HasReturnvaluesIF::RETURN_OK) {
|
if (result != returnvalue::OK) {
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
} else {
|
||||||
|
cspPort = cspCookie->getCspPort();
|
||||||
|
querySize = cspCookie->getReplyLen();
|
||||||
|
}
|
||||||
|
if (querySize > cspCookie->getMaxReplyLength()) {
|
||||||
|
sif::error << "Query size " << querySize << " is larger than maximum allowed "
|
||||||
|
<< cspCookie->getMaxReplyLength() << std::endl;
|
||||||
|
return returnvalue::FAILED;
|
||||||
|
}
|
||||||
uint8_t cspAddress = cspCookie->getCspAddress();
|
uint8_t cspAddress = cspCookie->getCspAddress();
|
||||||
|
auto iter = cspDeviceMap.find(cspAddress);
|
||||||
|
if (iter == cspDeviceMap.end()) {
|
||||||
|
return returnvalue::FAILED;
|
||||||
|
}
|
||||||
switch (cspPort) {
|
switch (cspPort) {
|
||||||
case (Ports::CSP_PING): {
|
case (CspPorts::CSP_PING): {
|
||||||
initiatePingRequest(cspAddress, querySize);
|
initiatePingRequest(cspAddress, querySize);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case (Ports::CSP_REBOOT): {
|
case (CspPorts::CSP_REBOOT): {
|
||||||
csp_reboot(cspAddress);
|
csp_reboot(cspAddress);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case (Ports::P60_PORT_GNDWDT_RESET):
|
case (CspPorts::P60_PORT_GNDWDT_RESET_ENUM):
|
||||||
case (Ports::P60_PORT_RPARAM): {
|
case (CspPorts::P60_PORT_RPARAM_ENUM): {
|
||||||
|
if (cspCookie->getRequest() != SpecialRequestTypes::DEFAULT_COM_IF) {
|
||||||
|
param_index_t requestStruct{};
|
||||||
|
requestStruct.physaddr = iter->second.replyBuf.data();
|
||||||
|
auto req = cspCookie->getRequest();
|
||||||
|
if (req == GOMSPACE::SpecialRequestTypes::GET_PDU_HK) {
|
||||||
|
if (!p60pdu_get_hk(&requestStruct, cspAddress, cspCookie->getTimeout())) {
|
||||||
|
return returnvalue::FAILED;
|
||||||
|
}
|
||||||
|
|
||||||
|
} else if (req == GOMSPACE::SpecialRequestTypes::GET_ACU_HK) {
|
||||||
|
if (!p60acu_get_hk(&requestStruct, cspAddress, cspCookie->getTimeout())) {
|
||||||
|
return returnvalue::FAILED;
|
||||||
|
}
|
||||||
|
} else if (req == GOMSPACE::SpecialRequestTypes::GET_P60DOCK_HK) {
|
||||||
|
if (!p60dock_get_hk(&requestStruct, cspAddress, cspCookie->getTimeout())) {
|
||||||
|
return returnvalue::FAILED;
|
||||||
|
}
|
||||||
|
} else if (req == GOMSPACE::SpecialRequestTypes::GET_PDU_CONFIG) {
|
||||||
|
requestStruct.table = p60pdu_config;
|
||||||
|
requestStruct.mem_id = P60PDU_PARAM;
|
||||||
|
requestStruct.count = p60pdu_config_count;
|
||||||
|
requestStruct.size = P60PDU_PARAM_SIZE;
|
||||||
|
int result = rparam_get_full_table(&requestStruct, cspAddress, P60_PORT_RPARAM,
|
||||||
|
requestStruct.mem_id, cspCookie->getTimeout());
|
||||||
|
if (result != 0) {
|
||||||
|
return returnvalue::FAILED;
|
||||||
|
}
|
||||||
|
} else if (req == GOMSPACE::SpecialRequestTypes::GET_ACU_CONFIG) {
|
||||||
|
requestStruct.table = p60acu_config;
|
||||||
|
requestStruct.mem_id = P60ACU_PARAM;
|
||||||
|
requestStruct.count = p60acu_config_count;
|
||||||
|
requestStruct.size = P60ACU_PARAM_SIZE;
|
||||||
|
int result = rparam_get_full_table(&requestStruct, cspAddress, P60_PORT_RPARAM,
|
||||||
|
requestStruct.mem_id, cspCookie->getTimeout());
|
||||||
|
if (result != 0) {
|
||||||
|
return returnvalue::FAILED;
|
||||||
|
}
|
||||||
|
} else if (req == GOMSPACE::SpecialRequestTypes::GET_P60DOCK_CONFIG) {
|
||||||
|
requestStruct.table = p60dock_config;
|
||||||
|
requestStruct.mem_id = P60DOCK_PARAM;
|
||||||
|
requestStruct.count = p60dock_config_count;
|
||||||
|
requestStruct.size = P60DOCK_PARAM_SIZE;
|
||||||
|
int result = rparam_get_full_table(&requestStruct, cspAddress, P60_PORT_RPARAM,
|
||||||
|
requestStruct.mem_id, cspCookie->getTimeout());
|
||||||
|
if (result != 0) {
|
||||||
|
return returnvalue::FAILED;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} else {
|
||||||
/* No CSP fixed port was selected. Send data to the specified port and
|
/* No CSP fixed port was selected. Send data to the specified port and
|
||||||
* wait for querySize number of bytes */
|
* wait for querySize number of bytes */
|
||||||
result = cspTransfer(cspAddress, cspPort, sendData, sendLen, querySize);
|
result = cspTransfer(cspAddress, cspPort, sendData, sendLen, querySize);
|
||||||
if (result != HasReturnvaluesIF::RETURN_OK) {
|
if (result != returnvalue::OK) {
|
||||||
return HasReturnvaluesIF::RETURN_FAILED;
|
return returnvalue::FAILED;
|
||||||
}
|
}
|
||||||
replySize = querySize;
|
}
|
||||||
|
iter->second.replyLen = querySize;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
default:
|
default:
|
||||||
sif::error << "CspComIF: Invalid port specified" << std::endl;
|
sif::error << "CspComIF: Invalid port specified" << std::endl;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
return HasReturnvaluesIF::RETURN_OK;
|
return returnvalue::OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
ReturnValue_t CspComIF::getSendSuccess(CookieIF* cookie) { return HasReturnvaluesIF::RETURN_OK; }
|
ReturnValue_t CspComIF::getSendSuccess(CookieIF* cookie) { return returnvalue::OK; }
|
||||||
|
|
||||||
ReturnValue_t CspComIF::requestReceiveMessage(CookieIF* cookie, size_t requestLen) {
|
ReturnValue_t CspComIF::requestReceiveMessage(CookieIF* cookie, size_t requestLen) {
|
||||||
return HasReturnvaluesIF::RETURN_OK;
|
return returnvalue::OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
ReturnValue_t CspComIF::readReceivedMessage(CookieIF* cookie, uint8_t** buffer, size_t* size) {
|
ReturnValue_t CspComIF::readReceivedMessage(CookieIF* cookie, uint8_t** buffer, size_t* size) {
|
||||||
if (cookie == NULL) {
|
if (cookie == NULL) {
|
||||||
return HasReturnvaluesIF::RETURN_FAILED;
|
return returnvalue::FAILED;
|
||||||
}
|
}
|
||||||
CspCookie* cspCookie = dynamic_cast<CspCookie*>(cookie);
|
CspCookie* cspCookie = dynamic_cast<CspCookie*>(cookie);
|
||||||
if (cspCookie == NULL) {
|
if (cspCookie == NULL) {
|
||||||
return HasReturnvaluesIF::RETURN_FAILED;
|
return returnvalue::FAILED;
|
||||||
}
|
}
|
||||||
|
|
||||||
uint8_t cspAddress = cspCookie->getCspAddress();
|
uint8_t cspAddress = cspCookie->getCspAddress();
|
||||||
|
auto iter = cspDeviceMap.find(cspAddress);
|
||||||
|
if (iter == cspDeviceMap.end()) {
|
||||||
|
return returnvalue::FAILED;
|
||||||
|
}
|
||||||
|
*buffer = iter->second.replyBuf.data();
|
||||||
|
*size = iter->second.replyLen;
|
||||||
|
|
||||||
*buffer = cspDeviceMap[cspAddress].data();
|
return returnvalue::OK;
|
||||||
*size = replySize;
|
|
||||||
|
|
||||||
return HasReturnvaluesIF::RETURN_OK;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
ReturnValue_t CspComIF::cspTransfer(uint8_t cspAddress, uint8_t cspPort, const uint8_t* cmdBuffer,
|
ReturnValue_t CspComIF::cspTransfer(uint8_t cspAddress, uint8_t cspPort, const uint8_t* cmdBuffer,
|
||||||
@ -142,13 +216,13 @@ ReturnValue_t CspComIF::cspTransfer(uint8_t cspAddress, uint8_t cspPort, const u
|
|||||||
uint32_t timeout_ms = 1000;
|
uint32_t timeout_ms = 1000;
|
||||||
uint16_t bytesRead = 0;
|
uint16_t bytesRead = 0;
|
||||||
int32_t expectedSize = static_cast<int32_t>(querySize);
|
int32_t expectedSize = static_cast<int32_t>(querySize);
|
||||||
vectorBufferIter iter = cspDeviceMap.find(cspAddress);
|
auto iter = cspDeviceMap.find(cspAddress);
|
||||||
if (iter == cspDeviceMap.end()) {
|
if (iter == cspDeviceMap.end()) {
|
||||||
sif::error << "CSP device with address " << cspAddress << " no found in"
|
sif::error << "CSP device with address " << cspAddress << " no found in"
|
||||||
<< " device map" << std::endl;
|
<< " device map" << std::endl;
|
||||||
return RETURN_FAILED;
|
return returnvalue::FAILED;
|
||||||
}
|
}
|
||||||
uint8_t* replyBuffer = iter->second.data();
|
uint8_t* replyBuffer = iter->second.replyBuf.data();
|
||||||
|
|
||||||
csp_conn_t* conn = csp_connect(CSP_PRIO_HIGH, cspAddress, cspPort, 0, CSP_O_NONE);
|
csp_conn_t* conn = csp_connect(CSP_PRIO_HIGH, cspAddress, cspPort, 0, CSP_O_NONE);
|
||||||
|
|
||||||
@ -157,7 +231,7 @@ ReturnValue_t CspComIF::cspTransfer(uint8_t cspAddress, uint8_t cspPort, const u
|
|||||||
sif::error << "CspComIF::cspTransfer: Failed to get memory for a csp packet from the csp "
|
sif::error << "CspComIF::cspTransfer: Failed to get memory for a csp packet from the csp "
|
||||||
<< "stack" << std::endl;
|
<< "stack" << std::endl;
|
||||||
csp_close(conn);
|
csp_close(conn);
|
||||||
return RETURN_FAILED;
|
return returnvalue::FAILED;
|
||||||
}
|
}
|
||||||
|
|
||||||
memcpy(commandPacket->data, cmdBuffer, cmdLen);
|
memcpy(commandPacket->data, cmdBuffer, cmdLen);
|
||||||
@ -167,12 +241,12 @@ ReturnValue_t CspComIF::cspTransfer(uint8_t cspAddress, uint8_t cspPort, const u
|
|||||||
csp_buffer_free(commandPacket);
|
csp_buffer_free(commandPacket);
|
||||||
sif::error << "CspComIF::cspTransfer: Failed to send csp packet" << std::endl;
|
sif::error << "CspComIF::cspTransfer: Failed to send csp packet" << std::endl;
|
||||||
csp_close(conn);
|
csp_close(conn);
|
||||||
return RETURN_FAILED;
|
return returnvalue::FAILED;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Return when no reply is expected */
|
/* Return when no reply is expected */
|
||||||
if (expectedSize == 0) {
|
if (expectedSize == 0) {
|
||||||
return RETURN_OK;
|
return returnvalue::OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
csp_packet_t* reply;
|
csp_packet_t* reply;
|
||||||
@ -180,7 +254,7 @@ ReturnValue_t CspComIF::cspTransfer(uint8_t cspAddress, uint8_t cspPort, const u
|
|||||||
if (reply == NULL) {
|
if (reply == NULL) {
|
||||||
sif::error << "CspComIF::cspTransfer: Failed to read csp packet" << std::endl;
|
sif::error << "CspComIF::cspTransfer: Failed to read csp packet" << std::endl;
|
||||||
csp_close(conn);
|
csp_close(conn);
|
||||||
return RETURN_FAILED;
|
return returnvalue::FAILED;
|
||||||
}
|
}
|
||||||
memcpy(replyBuffer, reply->data, reply->length);
|
memcpy(replyBuffer, reply->data, reply->length);
|
||||||
expectedSize = expectedSize - reply->length;
|
expectedSize = expectedSize - reply->length;
|
||||||
@ -191,13 +265,13 @@ ReturnValue_t CspComIF::cspTransfer(uint8_t cspAddress, uint8_t cspPort, const u
|
|||||||
if (reply == NULL) {
|
if (reply == NULL) {
|
||||||
sif::error << "CspComIF::cspTransfer: Failed to read csp packet" << std::endl;
|
sif::error << "CspComIF::cspTransfer: Failed to read csp packet" << std::endl;
|
||||||
csp_close(conn);
|
csp_close(conn);
|
||||||
return RETURN_FAILED;
|
return returnvalue::FAILED;
|
||||||
}
|
}
|
||||||
if ((reply->length + bytesRead) > iter->second.size()) {
|
if ((reply->length + bytesRead) > iter->second.replyBuf.size()) {
|
||||||
sif::error << "CspComIF::cspTransfer: Reply buffer to short" << std::endl;
|
sif::error << "CspComIF::cspTransfer: Reply buffer to short" << std::endl;
|
||||||
csp_buffer_free(reply);
|
csp_buffer_free(reply);
|
||||||
csp_close(conn);
|
csp_close(conn);
|
||||||
return RETURN_FAILED;
|
return returnvalue::FAILED;
|
||||||
}
|
}
|
||||||
memcpy(replyBuffer + bytesRead, reply->data, reply->length);
|
memcpy(replyBuffer + bytesRead, reply->data, reply->length);
|
||||||
expectedSize = expectedSize - reply->length;
|
expectedSize = expectedSize - reply->length;
|
||||||
@ -209,30 +283,30 @@ ReturnValue_t CspComIF::cspTransfer(uint8_t cspAddress, uint8_t cspPort, const u
|
|||||||
sif::error << "CspComIF::cspTransfer: Received more bytes than requested" << std::endl;
|
sif::error << "CspComIF::cspTransfer: Received more bytes than requested" << std::endl;
|
||||||
sif::debug << "CspComIF::cspTransfer: Received bytes: " << bytesRead << std::endl;
|
sif::debug << "CspComIF::cspTransfer: Received bytes: " << bytesRead << std::endl;
|
||||||
csp_close(conn);
|
csp_close(conn);
|
||||||
return RETURN_FAILED;
|
return returnvalue::FAILED;
|
||||||
}
|
}
|
||||||
|
|
||||||
csp_close(conn);
|
csp_close(conn);
|
||||||
|
|
||||||
return HasReturnvaluesIF::RETURN_OK;
|
return returnvalue::OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
ReturnValue_t CspComIF::getPortAndQuerySize(const uint8_t** sendData, size_t* sendLen,
|
ReturnValue_t CspComIF::getPortAndQuerySize(const uint8_t** sendData, size_t* sendLen,
|
||||||
uint8_t* cspPort, uint16_t* querySize) {
|
uint8_t* cspPort, uint16_t* querySize) {
|
||||||
ReturnValue_t result =
|
ReturnValue_t result =
|
||||||
SerializeAdapter::deSerialize(cspPort, sendData, sendLen, SerializeIF::Endianness::BIG);
|
SerializeAdapter::deSerialize(cspPort, sendData, sendLen, SerializeIF::Endianness::BIG);
|
||||||
if (result != HasReturnvaluesIF::RETURN_OK) {
|
if (result != returnvalue::OK) {
|
||||||
sif::error << "CspComIF: Failed to deserialize CSP port from command "
|
sif::error << "CspComIF: Failed to deserialize CSP port from command "
|
||||||
<< "buffer" << std::endl;
|
<< "buffer" << std::endl;
|
||||||
return HasReturnvaluesIF::RETURN_FAILED;
|
return returnvalue::FAILED;
|
||||||
}
|
}
|
||||||
SerializeAdapter::deSerialize(querySize, sendData, sendLen, SerializeIF::Endianness::BIG);
|
SerializeAdapter::deSerialize(querySize, sendData, sendLen, SerializeIF::Endianness::BIG);
|
||||||
if (result != HasReturnvaluesIF::RETURN_OK) {
|
if (result != returnvalue::OK) {
|
||||||
sif::error << "CspComIF: Failed to deserialize querySize from command "
|
sif::error << "CspComIF: Failed to deserialize querySize from command "
|
||||||
<< "buffer" << std::endl;
|
<< "buffer" << std::endl;
|
||||||
return HasReturnvaluesIF::RETURN_FAILED;
|
return returnvalue::FAILED;
|
||||||
}
|
}
|
||||||
return HasReturnvaluesIF::RETURN_OK;
|
return returnvalue::OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
void CspComIF::initiatePingRequest(uint8_t cspAddress, uint16_t querySize) {
|
void CspComIF::initiatePingRequest(uint8_t cspAddress, uint16_t querySize) {
|
||||||
@ -240,8 +314,12 @@ void CspComIF::initiatePingRequest(uint8_t cspAddress, uint16_t querySize) {
|
|||||||
uint32_t replyTime = csp_ping(cspAddress, timeout_ms, querySize, CSP_O_NONE);
|
uint32_t replyTime = csp_ping(cspAddress, timeout_ms, querySize, CSP_O_NONE);
|
||||||
sif::info << "Ping address: " << cspAddress << ", reply after " << replyTime << " ms"
|
sif::info << "Ping address: " << cspAddress << ", reply after " << replyTime << " ms"
|
||||||
<< std::endl;
|
<< std::endl;
|
||||||
|
auto iter = cspDeviceMap.find(cspAddress);
|
||||||
|
if (iter == cspDeviceMap.end()) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
/* Store reply time in reply buffer * */
|
/* Store reply time in reply buffer * */
|
||||||
uint8_t* replyBuffer = cspDeviceMap[cspAddress].data();
|
uint8_t* replyBuffer = iter->second.replyBuf.data();
|
||||||
memcpy(replyBuffer, &replyTime, sizeof(replyTime));
|
memcpy(replyBuffer, &replyTime, sizeof(replyTime));
|
||||||
replySize = sizeof(replyTime);
|
iter->second.replyLen = sizeof(replyTime);
|
||||||
}
|
}
|
||||||
|
@ -4,7 +4,7 @@
|
|||||||
#include <csp/csp.h>
|
#include <csp/csp.h>
|
||||||
#include <fsfw/devicehandlers/DeviceCommunicationIF.h>
|
#include <fsfw/devicehandlers/DeviceCommunicationIF.h>
|
||||||
#include <fsfw/objectmanager/SystemObject.h>
|
#include <fsfw/objectmanager/SystemObject.h>
|
||||||
#include <fsfw/returnvalues/HasReturnvaluesIF.h>
|
#include <fsfw/returnvalues/returnvalue.h>
|
||||||
|
|
||||||
#include <unordered_map>
|
#include <unordered_map>
|
||||||
#include <vector>
|
#include <vector>
|
||||||
@ -42,24 +42,22 @@ class CspComIF : public DeviceCommunicationIF, public SystemObject {
|
|||||||
ReturnValue_t cspTransfer(uint8_t cspAddress, uint8_t cspPort, const uint8_t *cmdBuffer,
|
ReturnValue_t cspTransfer(uint8_t cspAddress, uint8_t cspPort, const uint8_t *cmdBuffer,
|
||||||
int cmdLen, uint16_t querySize);
|
int cmdLen, uint16_t querySize);
|
||||||
|
|
||||||
enum Ports { CSP_PING = 1, CSP_REBOOT = 4, P60_PORT_RPARAM = 7, P60_PORT_GNDWDT_RESET = 9 };
|
|
||||||
|
|
||||||
typedef uint8_t node_t;
|
typedef uint8_t node_t;
|
||||||
using vectorBuffer = std::vector<uint8_t>;
|
struct ReplyInfo {
|
||||||
using VectorBufferMap = std::unordered_map<node_t, vectorBuffer>;
|
ReplyInfo(size_t maxLen) : replyBuf(maxLen){};
|
||||||
using vectorBufferIter = VectorBufferMap::iterator;
|
std::vector<uint8_t> replyBuf;
|
||||||
|
size_t replyLen = 0;
|
||||||
|
};
|
||||||
|
using VectorBufferMap = std::unordered_map<node_t, ReplyInfo>;
|
||||||
|
|
||||||
/* In this map assigns reply buffers to a CSP device */
|
/* In this map assigns reply buffers to a CSP device */
|
||||||
VectorBufferMap cspDeviceMap;
|
VectorBufferMap cspDeviceMap;
|
||||||
|
|
||||||
uint16_t replySize = 0;
|
|
||||||
|
|
||||||
/* This is the CSP address of the OBC. */
|
/* This is the CSP address of the OBC. */
|
||||||
node_t cspOwnAddress = 1;
|
node_t cspOwnAddress = 1;
|
||||||
|
|
||||||
/* Interface struct for csp protocol stack */
|
/* Interface struct for csp protocol stack */
|
||||||
csp_iface_t csp_if;
|
csp_iface_t csp_if;
|
||||||
|
|
||||||
char canInterface[5] = "can0";
|
char canInterface[5] = "can0";
|
||||||
int bitrate = 1000;
|
int bitrate = 1000;
|
||||||
|
|
||||||
|
@ -1,10 +0,0 @@
|
|||||||
#include "CspCookie.h"
|
|
||||||
|
|
||||||
CspCookie::CspCookie(uint16_t maxReplyLength_, uint8_t cspAddress_)
|
|
||||||
: maxReplyLength(maxReplyLength_), cspAddress(cspAddress_) {}
|
|
||||||
|
|
||||||
CspCookie::~CspCookie() {}
|
|
||||||
|
|
||||||
uint16_t CspCookie::getMaxReplyLength() { return maxReplyLength; }
|
|
||||||
|
|
||||||
uint8_t CspCookie::getCspAddress() { return cspAddress; }
|
|
@ -1,26 +0,0 @@
|
|||||||
#ifndef LINUX_CSP_CSPCOOKIE_H_
|
|
||||||
#define LINUX_CSP_CSPCOOKIE_H_
|
|
||||||
|
|
||||||
#include <fsfw/devicehandlers/CookieIF.h>
|
|
||||||
|
|
||||||
#include <cstdint>
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @brief This is the cookie for devices supporting the CSP (CubeSat Space
|
|
||||||
* Protocol).
|
|
||||||
* @author J. Meier
|
|
||||||
*/
|
|
||||||
class CspCookie : public CookieIF {
|
|
||||||
public:
|
|
||||||
CspCookie(uint16_t maxReplyLength_, uint8_t cspAddress_);
|
|
||||||
virtual ~CspCookie();
|
|
||||||
|
|
||||||
uint16_t getMaxReplyLength();
|
|
||||||
uint8_t getCspAddress();
|
|
||||||
|
|
||||||
private:
|
|
||||||
uint16_t maxReplyLength;
|
|
||||||
uint8_t cspAddress;
|
|
||||||
};
|
|
||||||
|
|
||||||
#endif /* LINUX_CSP_CSPCOOKIE_H_ */
|
|
@ -50,7 +50,7 @@ ReturnValue_t GPSHyperionLinuxController::checkModeCommand(Mode_t mode, Submode_
|
|||||||
return HasModesIF::INVALID_MODE;
|
return HasModesIF::INVALID_MODE;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return HasReturnvaluesIF::RETURN_OK;
|
return returnvalue::OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
ReturnValue_t GPSHyperionLinuxController::executeAction(ActionId_t actionId,
|
ReturnValue_t GPSHyperionLinuxController::executeAction(ActionId_t actionId,
|
||||||
@ -68,7 +68,7 @@ ReturnValue_t GPSHyperionLinuxController::executeAction(ActionId_t actionId,
|
|||||||
return DeviceHandlerIF::COMMAND_NOT_IMPLEMENTED;
|
return DeviceHandlerIF::COMMAND_NOT_IMPLEMENTED;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return HasReturnvaluesIF::RETURN_OK;
|
return returnvalue::OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
ReturnValue_t GPSHyperionLinuxController::initializeLocalDataPool(
|
ReturnValue_t GPSHyperionLinuxController::initializeLocalDataPool(
|
||||||
@ -88,7 +88,7 @@ ReturnValue_t GPSHyperionLinuxController::initializeLocalDataPool(
|
|||||||
localDataPoolMap.emplace(GpsHyperion::SATS_IN_VIEW, new PoolEntry<uint8_t>());
|
localDataPoolMap.emplace(GpsHyperion::SATS_IN_VIEW, new PoolEntry<uint8_t>());
|
||||||
localDataPoolMap.emplace(GpsHyperion::FIX_MODE, new PoolEntry<uint8_t>());
|
localDataPoolMap.emplace(GpsHyperion::FIX_MODE, new PoolEntry<uint8_t>());
|
||||||
poolManager.subscribeForRegularPeriodicPacket({gpsSet.getSid(), 30.0});
|
poolManager.subscribeForRegularPeriodicPacket({gpsSet.getSid(), 30.0});
|
||||||
return HasReturnvaluesIF::RETURN_OK;
|
return returnvalue::OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
void GPSHyperionLinuxController::setResetPinTriggerFunction(gpioResetFunction_t resetCallback,
|
void GPSHyperionLinuxController::setResetPinTriggerFunction(gpioResetFunction_t resetCallback,
|
||||||
@ -99,7 +99,7 @@ void GPSHyperionLinuxController::setResetPinTriggerFunction(gpioResetFunction_t
|
|||||||
|
|
||||||
ReturnValue_t GPSHyperionLinuxController::initialize() {
|
ReturnValue_t GPSHyperionLinuxController::initialize() {
|
||||||
ReturnValue_t result = ExtendedControllerBase::initialize();
|
ReturnValue_t result = ExtendedControllerBase::initialize();
|
||||||
if (result != HasReturnvaluesIF::RETURN_OK) {
|
if (result != returnvalue::OK) {
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
auto openError = [&](const char *type, int error) {
|
auto openError = [&](const char *type, int error) {
|
||||||
@ -178,11 +178,11 @@ void GPSHyperionLinuxController::readGpsDataFromGpsd() {
|
|||||||
|
|
||||||
ReturnValue_t GPSHyperionLinuxController::handleGpsRead() {
|
ReturnValue_t GPSHyperionLinuxController::handleGpsRead() {
|
||||||
PoolReadGuard pg(&gpsSet);
|
PoolReadGuard pg(&gpsSet);
|
||||||
if (pg.getReadResult() != HasReturnvaluesIF::RETURN_OK) {
|
if (pg.getReadResult() != returnvalue::OK) {
|
||||||
#if FSFW_VERBOSE_LEVEL >= 1
|
#if FSFW_VERBOSE_LEVEL >= 1
|
||||||
sif::warning << "GPSHyperionHandler::readGpsDataFromGpsd: Reading dataset failed" << std::endl;
|
sif::warning << "GPSHyperionHandler::readGpsDataFromGpsd: Reading dataset failed" << std::endl;
|
||||||
#endif
|
#endif
|
||||||
return RETURN_FAILED;
|
return returnvalue::FAILED;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool validFix = false;
|
bool validFix = false;
|
||||||
@ -311,7 +311,7 @@ ReturnValue_t GPSHyperionLinuxController::handleGpsRead() {
|
|||||||
std::tm tm = *std::gmtime(&t);
|
std::tm tm = *std::gmtime(&t);
|
||||||
std::cout << "C Time: " << std::put_time(&tm, "%c") << std::endl;
|
std::cout << "C Time: " << std::put_time(&tm, "%c") << std::endl;
|
||||||
}
|
}
|
||||||
return RETURN_OK;
|
return returnvalue::OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
@ -24,7 +24,7 @@ Max31865RtdReader::Max31865RtdReader(object_id_t objectId, SpiComIF* lowLevelCom
|
|||||||
|
|
||||||
ReturnValue_t Max31865RtdReader::performOperation(uint8_t operationCode) {
|
ReturnValue_t Max31865RtdReader::performOperation(uint8_t operationCode) {
|
||||||
using namespace MAX31865;
|
using namespace MAX31865;
|
||||||
ReturnValue_t result = RETURN_OK;
|
ReturnValue_t result = returnvalue::OK;
|
||||||
static_cast<void>(result);
|
static_cast<void>(result);
|
||||||
// Stopwatch watch;
|
// Stopwatch watch;
|
||||||
if (periodicInitHandling()) {
|
if (periodicInitHandling()) {
|
||||||
@ -34,12 +34,12 @@ ReturnValue_t Max31865RtdReader::performOperation(uint8_t operationCode) {
|
|||||||
#endif
|
#endif
|
||||||
} else {
|
} else {
|
||||||
// No devices usable (e.g. TCS board off)
|
// No devices usable (e.g. TCS board off)
|
||||||
return RETURN_OK;
|
return returnvalue::OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
#if OBSW_RTD_AUTO_MODE == 0
|
#if OBSW_RTD_AUTO_MODE == 0
|
||||||
result = periodicReadReqHandling();
|
result = periodicReadReqHandling();
|
||||||
if (result != RETURN_OK) {
|
if (result != returnvalue::OK) {
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
// After requesting, 65 milliseconds delay required
|
// After requesting, 65 milliseconds delay required
|
||||||
@ -59,8 +59,8 @@ bool Max31865RtdReader::rtdIsActive(uint8_t idx) {
|
|||||||
bool Max31865RtdReader::periodicInitHandling() {
|
bool Max31865RtdReader::periodicInitHandling() {
|
||||||
using namespace MAX31865;
|
using namespace MAX31865;
|
||||||
MutexGuard mg(readerMutex);
|
MutexGuard mg(readerMutex);
|
||||||
ReturnValue_t result = RETURN_OK;
|
ReturnValue_t result = returnvalue::OK;
|
||||||
if (mg.getLockResult() != RETURN_OK) {
|
if (mg.getLockResult() != returnvalue::OK) {
|
||||||
sif::warning << "Max31865RtdReader::periodicInitHandling: Mutex lock failed" << std::endl;
|
sif::warning << "Max31865RtdReader::periodicInitHandling: Mutex lock failed" << std::endl;
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
@ -71,28 +71,28 @@ bool Max31865RtdReader::periodicInitHandling() {
|
|||||||
}
|
}
|
||||||
if ((rtd->on or rtd->active) and not rtd->configured and rtd->cd.hasTimedOut()) {
|
if ((rtd->on or rtd->active) and not rtd->configured and rtd->cd.hasTimedOut()) {
|
||||||
ManualCsLockWrapper mg(csLock, gpioIF, rtd->spiCookie, csTimeoutType, csTimeoutMs);
|
ManualCsLockWrapper mg(csLock, gpioIF, rtd->spiCookie, csTimeoutType, csTimeoutMs);
|
||||||
if (mg.lockResult != RETURN_OK or mg.gpioResult != RETURN_OK) {
|
if (mg.lockResult != returnvalue::OK or mg.gpioResult != returnvalue::OK) {
|
||||||
sif::error << "Max31865RtdReader::periodicInitHandling: Manual CS lock failed" << std::endl;
|
sif::error << "Max31865RtdReader::periodicInitHandling: Manual CS lock failed" << std::endl;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
result = writeCfgReg(rtd->spiCookie, BASE_CFG);
|
result = writeCfgReg(rtd->spiCookie, BASE_CFG);
|
||||||
if (result != HasReturnvaluesIF::RETURN_OK) {
|
if (result != returnvalue::OK) {
|
||||||
handleSpiError(rtd, result, "writeCfgReg");
|
handleSpiError(rtd, result, "writeCfgReg");
|
||||||
}
|
}
|
||||||
if (rtd->writeLowThreshold) {
|
if (rtd->writeLowThreshold) {
|
||||||
result = writeLowThreshold(rtd->spiCookie, rtd->lowThreshold);
|
result = writeLowThreshold(rtd->spiCookie, rtd->lowThreshold);
|
||||||
if (result != HasReturnvaluesIF::RETURN_OK) {
|
if (result != returnvalue::OK) {
|
||||||
handleSpiError(rtd, result, "writeLowThreshold");
|
handleSpiError(rtd, result, "writeLowThreshold");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (rtd->writeHighThreshold) {
|
if (rtd->writeHighThreshold) {
|
||||||
result = writeHighThreshold(rtd->spiCookie, rtd->highThreshold);
|
result = writeHighThreshold(rtd->spiCookie, rtd->highThreshold);
|
||||||
if (result != HasReturnvaluesIF::RETURN_OK) {
|
if (result != returnvalue::OK) {
|
||||||
handleSpiError(rtd, result, "writeHighThreshold");
|
handleSpiError(rtd, result, "writeHighThreshold");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
result = clearFaultStatus(rtd->spiCookie);
|
result = clearFaultStatus(rtd->spiCookie);
|
||||||
if (result != HasReturnvaluesIF::RETURN_OK) {
|
if (result != returnvalue::OK) {
|
||||||
handleSpiError(rtd, result, "clearFaultStatus");
|
handleSpiError(rtd, result, "clearFaultStatus");
|
||||||
}
|
}
|
||||||
rtd->configured = true;
|
rtd->configured = true;
|
||||||
@ -123,9 +123,9 @@ bool Max31865RtdReader::periodicInitHandling() {
|
|||||||
ReturnValue_t Max31865RtdReader::periodicReadReqHandling() {
|
ReturnValue_t Max31865RtdReader::periodicReadReqHandling() {
|
||||||
using namespace MAX31865;
|
using namespace MAX31865;
|
||||||
MutexGuard mg(readerMutex);
|
MutexGuard mg(readerMutex);
|
||||||
if (mg.getLockResult() != RETURN_OK) {
|
if (mg.getLockResult() != returnvalue::OK) {
|
||||||
sif::warning << "Max31865RtdReader::periodicReadReqHandling: Mutex lock failed" << std::endl;
|
sif::warning << "Max31865RtdReader::periodicReadReqHandling: Mutex lock failed" << std::endl;
|
||||||
return RETURN_FAILED;
|
return returnvalue::FAILED;
|
||||||
}
|
}
|
||||||
// Now request one shot config for all active RTDs
|
// Now request one shot config for all active RTDs
|
||||||
for (auto& rtd : rtds) {
|
for (auto& rtd : rtds) {
|
||||||
@ -134,23 +134,23 @@ ReturnValue_t Max31865RtdReader::periodicReadReqHandling() {
|
|||||||
}
|
}
|
||||||
if (rtdIsActive(rtd->idx)) {
|
if (rtdIsActive(rtd->idx)) {
|
||||||
ReturnValue_t result = writeCfgReg(rtd->spiCookie, BASE_CFG | (1 << CfgBitPos::ONE_SHOT));
|
ReturnValue_t result = writeCfgReg(rtd->spiCookie, BASE_CFG | (1 << CfgBitPos::ONE_SHOT));
|
||||||
if (result != RETURN_OK) {
|
if (result != returnvalue::OK) {
|
||||||
handleSpiError(rtd, result, "writeCfgReg");
|
handleSpiError(rtd, result, "writeCfgReg");
|
||||||
// Release mutex ASAP
|
// Release mutex ASAP
|
||||||
return RETURN_FAILED;
|
return returnvalue::FAILED;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return RETURN_OK;
|
return returnvalue::OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
ReturnValue_t Max31865RtdReader::periodicReadHandling() {
|
ReturnValue_t Max31865RtdReader::periodicReadHandling() {
|
||||||
using namespace MAX31865;
|
using namespace MAX31865;
|
||||||
auto result = RETURN_OK;
|
auto result = returnvalue::OK;
|
||||||
MutexGuard mg(readerMutex);
|
MutexGuard mg(readerMutex);
|
||||||
if (mg.getLockResult() != RETURN_OK) {
|
if (mg.getLockResult() != returnvalue::OK) {
|
||||||
sif::warning << "Max31865RtdReader::periodicReadReqHandling: Mutex lock failed" << std::endl;
|
sif::warning << "Max31865RtdReader::periodicReadReqHandling: Mutex lock failed" << std::endl;
|
||||||
return RETURN_FAILED;
|
return returnvalue::FAILED;
|
||||||
}
|
}
|
||||||
// Now read the RTD values
|
// Now read the RTD values
|
||||||
for (auto& rtd : rtds) {
|
for (auto& rtd : rtds) {
|
||||||
@ -161,9 +161,9 @@ ReturnValue_t Max31865RtdReader::periodicReadHandling() {
|
|||||||
uint16_t rtdVal = 0;
|
uint16_t rtdVal = 0;
|
||||||
bool faultBitSet = false;
|
bool faultBitSet = false;
|
||||||
result = readRtdVal(rtd->spiCookie, rtdVal, faultBitSet);
|
result = readRtdVal(rtd->spiCookie, rtdVal, faultBitSet);
|
||||||
if (result != RETURN_OK) {
|
if (result != returnvalue::OK) {
|
||||||
handleSpiError(rtd, result, "readRtdVal");
|
handleSpiError(rtd, result, "readRtdVal");
|
||||||
return RETURN_FAILED;
|
return returnvalue::FAILED;
|
||||||
}
|
}
|
||||||
if (faultBitSet) {
|
if (faultBitSet) {
|
||||||
rtd->db.faultBitSet = faultBitSet;
|
rtd->db.faultBitSet = faultBitSet;
|
||||||
@ -183,7 +183,7 @@ ReturnValue_t Max31865RtdReader::periodicReadHandling() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
return RETURN_OK;
|
return returnvalue::OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
ReturnValue_t Max31865RtdReader::initializeInterface(CookieIF* cookie) {
|
ReturnValue_t Max31865RtdReader::initializeInterface(CookieIF* cookie) {
|
||||||
@ -192,7 +192,7 @@ ReturnValue_t Max31865RtdReader::initializeInterface(CookieIF* cookie) {
|
|||||||
}
|
}
|
||||||
auto* rtdCookie = dynamic_cast<Max31865ReaderCookie*>(cookie);
|
auto* rtdCookie = dynamic_cast<Max31865ReaderCookie*>(cookie);
|
||||||
ReturnValue_t result = comIF->initializeInterface(rtdCookie->spiCookie);
|
ReturnValue_t result = comIF->initializeInterface(rtdCookie->spiCookie);
|
||||||
if (result != HasReturnvaluesIF::RETURN_OK) {
|
if (result != returnvalue::OK) {
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
if (rtdCookie->idx > EiveMax31855::NUM_RTDS) {
|
if (rtdCookie->idx > EiveMax31855::NUM_RTDS) {
|
||||||
@ -203,28 +203,28 @@ ReturnValue_t Max31865RtdReader::initializeInterface(CookieIF* cookie) {
|
|||||||
if (dbLen == 0) {
|
if (dbLen == 0) {
|
||||||
dbLen = rtdCookie->db.getSerializedSize();
|
dbLen = rtdCookie->db.getSerializedSize();
|
||||||
}
|
}
|
||||||
return RETURN_OK;
|
return returnvalue::OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
ReturnValue_t Max31865RtdReader::sendMessage(CookieIF* cookie, const uint8_t* sendData,
|
ReturnValue_t Max31865RtdReader::sendMessage(CookieIF* cookie, const uint8_t* sendData,
|
||||||
size_t sendLen) {
|
size_t sendLen) {
|
||||||
if (cookie == nullptr) {
|
if (cookie == nullptr) {
|
||||||
return RETURN_FAILED;
|
return returnvalue::FAILED;
|
||||||
}
|
}
|
||||||
// Empty command.. don't fail for now
|
// Empty command.. don't fail for now
|
||||||
if (sendLen < 1) {
|
if (sendLen < 1) {
|
||||||
return RETURN_OK;
|
return returnvalue::OK;
|
||||||
}
|
}
|
||||||
MutexGuard mg(readerMutex);
|
MutexGuard mg(readerMutex);
|
||||||
if (mg.getLockResult() != RETURN_OK) {
|
if (mg.getLockResult() != returnvalue::OK) {
|
||||||
sif::warning << "Max31865RtdReader::sendMessage: Mutex lock failed" << std::endl;
|
sif::warning << "Max31865RtdReader::sendMessage: Mutex lock failed" << std::endl;
|
||||||
return RETURN_FAILED;
|
return returnvalue::FAILED;
|
||||||
}
|
}
|
||||||
auto* rtdCookie = dynamic_cast<Max31865ReaderCookie*>(cookie);
|
auto* rtdCookie = dynamic_cast<Max31865ReaderCookie*>(cookie);
|
||||||
uint8_t cmdRaw = sendData[0];
|
uint8_t cmdRaw = sendData[0];
|
||||||
if (cmdRaw > EiveMax31855::RtdCommands::NUM_CMDS) {
|
if (cmdRaw > EiveMax31855::RtdCommands::NUM_CMDS) {
|
||||||
sif::warning << "Max31865RtdReader::sendMessage: Invalid command" << std::endl;
|
sif::warning << "Max31865RtdReader::sendMessage: Invalid command" << std::endl;
|
||||||
return RETURN_FAILED;
|
return returnvalue::FAILED;
|
||||||
}
|
}
|
||||||
|
|
||||||
auto thresholdHandler = [](Max31865ReaderCookie* rtdCookie, const uint8_t* sendData) {
|
auto thresholdHandler = [](Max31865ReaderCookie* rtdCookie, const uint8_t* sendData) {
|
||||||
@ -275,7 +275,7 @@ ReturnValue_t Max31865RtdReader::sendMessage(CookieIF* cookie, const uint8_t* se
|
|||||||
rtdCookie->highThreshold = (sendData[1] << 8) | sendData[2];
|
rtdCookie->highThreshold = (sendData[1] << 8) | sendData[2];
|
||||||
rtdCookie->writeHighThreshold = true;
|
rtdCookie->writeHighThreshold = true;
|
||||||
} else {
|
} else {
|
||||||
return RETURN_FAILED;
|
return returnvalue::FAILED;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@ -284,7 +284,7 @@ ReturnValue_t Max31865RtdReader::sendMessage(CookieIF* cookie, const uint8_t* se
|
|||||||
rtdCookie->lowThreshold = (sendData[1] << 8) | sendData[2];
|
rtdCookie->lowThreshold = (sendData[1] << 8) | sendData[2];
|
||||||
rtdCookie->writeLowThreshold = true;
|
rtdCookie->writeLowThreshold = true;
|
||||||
} else {
|
} else {
|
||||||
return RETURN_FAILED;
|
return returnvalue::FAILED;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@ -294,34 +294,37 @@ ReturnValue_t Max31865RtdReader::sendMessage(CookieIF* cookie, const uint8_t* se
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return RETURN_OK;
|
return returnvalue::OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
ReturnValue_t Max31865RtdReader::getSendSuccess(CookieIF* cookie) { return RETURN_OK; }
|
ReturnValue_t Max31865RtdReader::getSendSuccess(CookieIF* cookie) { return returnvalue::OK; }
|
||||||
|
|
||||||
ReturnValue_t Max31865RtdReader::requestReceiveMessage(CookieIF* cookie, size_t requestLen) {
|
ReturnValue_t Max31865RtdReader::requestReceiveMessage(CookieIF* cookie, size_t requestLen) {
|
||||||
return RETURN_OK;
|
return returnvalue::OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
ReturnValue_t Max31865RtdReader::readReceivedMessage(CookieIF* cookie, uint8_t** buffer,
|
ReturnValue_t Max31865RtdReader::readReceivedMessage(CookieIF* cookie, uint8_t** buffer,
|
||||||
size_t* size) {
|
size_t* size) {
|
||||||
MutexGuard mg(readerMutex);
|
MutexGuard mg(readerMutex);
|
||||||
if (mg.getLockResult() != RETURN_OK) {
|
if (mg.getLockResult() != returnvalue::OK) {
|
||||||
// TODO: Emit warning
|
// TODO: Emit warning
|
||||||
return RETURN_FAILED;
|
return returnvalue::FAILED;
|
||||||
}
|
}
|
||||||
auto* rtdCookie = dynamic_cast<Max31865ReaderCookie*>(cookie);
|
auto* rtdCookie = dynamic_cast<Max31865ReaderCookie*>(cookie);
|
||||||
|
if(rtdCookie == nullptr) {
|
||||||
|
return returnvalue::FAILED;
|
||||||
|
}
|
||||||
uint8_t* exchangePtr = rtdCookie->exchangeBuf.data();
|
uint8_t* exchangePtr = rtdCookie->exchangeBuf.data();
|
||||||
size_t serLen = 0;
|
size_t serLen = 0;
|
||||||
auto result = rtdCookie->db.serialize(&exchangePtr, &serLen, rtdCookie->exchangeBuf.size(),
|
auto result = rtdCookie->db.serialize(&exchangePtr, &serLen, rtdCookie->exchangeBuf.size(),
|
||||||
SerializeIF::Endianness::MACHINE);
|
SerializeIF::Endianness::MACHINE);
|
||||||
if (result != RETURN_OK) {
|
if (result != returnvalue::OK) {
|
||||||
// TODO: Emit warning
|
// TODO: Emit warning
|
||||||
return RETURN_FAILED;
|
return returnvalue::FAILED;
|
||||||
}
|
}
|
||||||
*buffer = reinterpret_cast<uint8_t*>(rtdCookie->exchangeBuf.data());
|
*buffer = reinterpret_cast<uint8_t*>(rtdCookie->exchangeBuf.data());
|
||||||
*size = serLen;
|
*size = serLen;
|
||||||
return RETURN_OK;
|
return returnvalue::OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
ReturnValue_t Max31865RtdReader::writeCfgReg(SpiCookie* cookie, uint8_t cfg) {
|
ReturnValue_t Max31865RtdReader::writeCfgReg(SpiCookie* cookie, uint8_t cfg) {
|
||||||
@ -345,7 +348,7 @@ ReturnValue_t Max31865RtdReader::clearFaultStatus(SpiCookie* cookie) {
|
|||||||
// Read back the current configuration to avoid overwriting it when clearing te fault status
|
// Read back the current configuration to avoid overwriting it when clearing te fault status
|
||||||
uint8_t currentCfg = 0;
|
uint8_t currentCfg = 0;
|
||||||
auto result = readCfgReg(cookie, currentCfg);
|
auto result = readCfgReg(cookie, currentCfg);
|
||||||
if (result != RETURN_OK) {
|
if (result != returnvalue::OK) {
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
// Clear bytes 5, 3 and 2 which need to be 0
|
// Clear bytes 5, 3 and 2 which need to be 0
|
||||||
@ -358,7 +361,7 @@ ReturnValue_t Max31865RtdReader::readCfgReg(SpiCookie* cookie, uint8_t& cfg) {
|
|||||||
using namespace MAX31865;
|
using namespace MAX31865;
|
||||||
uint8_t* replyPtr = nullptr;
|
uint8_t* replyPtr = nullptr;
|
||||||
auto result = readNFromReg(cookie, CONFIG, 1, &replyPtr);
|
auto result = readNFromReg(cookie, CONFIG, 1, &replyPtr);
|
||||||
if (result == RETURN_OK) {
|
if (result == returnvalue::OK) {
|
||||||
cfg = replyPtr[0];
|
cfg = replyPtr[0];
|
||||||
}
|
}
|
||||||
return result;
|
return result;
|
||||||
@ -380,7 +383,7 @@ ReturnValue_t Max31865RtdReader::readLowThreshold(SpiCookie* cookie, uint16_t& l
|
|||||||
using namespace MAX31865;
|
using namespace MAX31865;
|
||||||
uint8_t* replyPtr = nullptr;
|
uint8_t* replyPtr = nullptr;
|
||||||
auto result = readNFromReg(cookie, LOW_THRESHOLD, 2, &replyPtr);
|
auto result = readNFromReg(cookie, LOW_THRESHOLD, 2, &replyPtr);
|
||||||
if (result == RETURN_OK) {
|
if (result == returnvalue::OK) {
|
||||||
lowThreshold = (replyPtr[0] << 8) | replyPtr[1];
|
lowThreshold = (replyPtr[0] << 8) | replyPtr[1];
|
||||||
}
|
}
|
||||||
return result;
|
return result;
|
||||||
@ -390,7 +393,7 @@ ReturnValue_t Max31865RtdReader::readHighThreshold(SpiCookie* cookie, uint16_t&
|
|||||||
using namespace MAX31865;
|
using namespace MAX31865;
|
||||||
uint8_t* replyPtr = nullptr;
|
uint8_t* replyPtr = nullptr;
|
||||||
auto result = readNFromReg(cookie, HIGH_THRESHOLD, 2, &replyPtr);
|
auto result = readNFromReg(cookie, HIGH_THRESHOLD, 2, &replyPtr);
|
||||||
if (result == RETURN_OK) {
|
if (result == returnvalue::OK) {
|
||||||
highThreshold = (replyPtr[0] << 8) | replyPtr[1];
|
highThreshold = (replyPtr[0] << 8) | replyPtr[1];
|
||||||
}
|
}
|
||||||
return result;
|
return result;
|
||||||
@ -400,7 +403,7 @@ ReturnValue_t Max31865RtdReader::writeNToReg(SpiCookie* cookie, uint8_t reg, siz
|
|||||||
uint8_t** reply) {
|
uint8_t** reply) {
|
||||||
using namespace MAX31865;
|
using namespace MAX31865;
|
||||||
if (n > cmdBuf.size() - 1) {
|
if (n > cmdBuf.size() - 1) {
|
||||||
return HasReturnvaluesIF::RETURN_FAILED;
|
return returnvalue::FAILED;
|
||||||
}
|
}
|
||||||
cmdBuf[0] = reg | WRITE_BIT;
|
cmdBuf[0] = reg | WRITE_BIT;
|
||||||
for (size_t idx = 0; idx < n; idx++) {
|
for (size_t idx = 0; idx < n; idx++) {
|
||||||
@ -413,7 +416,7 @@ ReturnValue_t Max31865RtdReader::readRtdVal(SpiCookie* cookie, uint16_t& val, bo
|
|||||||
using namespace MAX31865;
|
using namespace MAX31865;
|
||||||
uint8_t* replyPtr = nullptr;
|
uint8_t* replyPtr = nullptr;
|
||||||
auto result = readNFromReg(cookie, RTD, 2, &replyPtr);
|
auto result = readNFromReg(cookie, RTD, 2, &replyPtr);
|
||||||
if (result != RETURN_OK) {
|
if (result != returnvalue::OK) {
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
if (replyPtr[1] & 0b0000'0001) {
|
if (replyPtr[1] & 0b0000'0001) {
|
||||||
@ -428,27 +431,27 @@ ReturnValue_t Max31865RtdReader::readNFromReg(SpiCookie* cookie, uint8_t reg, si
|
|||||||
uint8_t** reply) {
|
uint8_t** reply) {
|
||||||
using namespace MAX31865;
|
using namespace MAX31865;
|
||||||
if (n > 4) {
|
if (n > 4) {
|
||||||
return HasReturnvaluesIF::RETURN_FAILED;
|
return returnvalue::FAILED;
|
||||||
}
|
}
|
||||||
// Clear write bit in any case
|
// Clear write bit in any case
|
||||||
reg &= ~WRITE_BIT;
|
reg &= ~WRITE_BIT;
|
||||||
cmdBuf[0] = reg;
|
cmdBuf[0] = reg;
|
||||||
std::memset(cmdBuf.data() + 1, 0, n);
|
std::memset(cmdBuf.data() + 1, 0, n);
|
||||||
ReturnValue_t result = comIF->sendMessage(cookie, cmdBuf.data(), n + 1);
|
ReturnValue_t result = comIF->sendMessage(cookie, cmdBuf.data(), n + 1);
|
||||||
if (result != RETURN_OK) {
|
if (result != returnvalue::OK) {
|
||||||
return RETURN_FAILED;
|
return returnvalue::FAILED;
|
||||||
}
|
}
|
||||||
|
|
||||||
size_t dummyLen = 0;
|
size_t dummyLen = 0;
|
||||||
uint8_t* replyPtr = nullptr;
|
uint8_t* replyPtr = nullptr;
|
||||||
result = comIF->readReceivedMessage(cookie, &replyPtr, &dummyLen);
|
result = comIF->readReceivedMessage(cookie, &replyPtr, &dummyLen);
|
||||||
if (result != RETURN_OK) {
|
if (result != returnvalue::OK) {
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
if (reply != nullptr) {
|
if (reply != nullptr) {
|
||||||
*reply = replyPtr + 1;
|
*reply = replyPtr + 1;
|
||||||
}
|
}
|
||||||
return RETURN_OK;
|
return returnvalue::OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
ReturnValue_t Max31865RtdReader::handleSpiError(Max31865ReaderCookie* cookie, ReturnValue_t result,
|
ReturnValue_t Max31865RtdReader::handleSpiError(Max31865ReaderCookie* cookie, ReturnValue_t result,
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
#ifndef MPSOC_RETURN_VALUES_IF_H_
|
#ifndef MPSOC_RETURN_VALUES_IF_H_
|
||||||
#define MPSOC_RETURN_VALUES_IF_H_
|
#define MPSOC_RETURN_VALUES_IF_H_
|
||||||
|
|
||||||
#include "fsfw/returnvalues/HasReturnvaluesIF.h"
|
#include "fsfw/returnvalues/returnvalue.h"
|
||||||
|
|
||||||
class MPSoCReturnValuesIF {
|
class MPSoCReturnValuesIF {
|
||||||
public:
|
public:
|
||||||
|
@ -164,21 +164,21 @@ class TcBase : public ploc::SpTcBase, public MPSoCReturnValuesIF {
|
|||||||
* @param commandData Pointer to command specific data
|
* @param commandData Pointer to command specific data
|
||||||
* @param commandDataLen Length of command data
|
* @param commandDataLen Length of command data
|
||||||
*
|
*
|
||||||
* @return RETURN_OK if packet creation was successful, otherwise error return value
|
* @return returnvalue::OK if packet creation was successful, otherwise error return value
|
||||||
*/
|
*/
|
||||||
ReturnValue_t buildPacket(const uint8_t* commandData, size_t commandDataLen) {
|
ReturnValue_t buildPacket(const uint8_t* commandData, size_t commandDataLen) {
|
||||||
payloadStart = spParams.buf + ccsds::HEADER_LEN;
|
payloadStart = spParams.buf + ccsds::HEADER_LEN;
|
||||||
ReturnValue_t res;
|
ReturnValue_t res;
|
||||||
if (commandData != nullptr and commandDataLen > 0) {
|
if (commandData != nullptr and commandDataLen > 0) {
|
||||||
res = initPacket(commandData, commandDataLen);
|
res = initPacket(commandData, commandDataLen);
|
||||||
if (res != result::OK) {
|
if (res != returnvalue::OK) {
|
||||||
return res;
|
return res;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
updateSpFields();
|
updateSpFields();
|
||||||
res = checkSizeAndSerializeHeader();
|
res = checkSizeAndSerializeHeader();
|
||||||
if (res != result::OK) {
|
if (res != returnvalue::OK) {
|
||||||
return res;
|
return res;
|
||||||
}
|
}
|
||||||
return calcCrc();
|
return calcCrc();
|
||||||
@ -192,7 +192,7 @@ class TcBase : public ploc::SpTcBase, public MPSoCReturnValuesIF {
|
|||||||
* @param commandDataLen Length of received command data
|
* @param commandDataLen Length of received command data
|
||||||
*/
|
*/
|
||||||
virtual ReturnValue_t initPacket(const uint8_t* commandData, size_t commandDataLen) {
|
virtual ReturnValue_t initPacket(const uint8_t* commandData, size_t commandDataLen) {
|
||||||
return HasReturnvaluesIF::RETURN_OK;
|
return returnvalue::OK;
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -213,9 +213,9 @@ class TcMemRead : public TcBase {
|
|||||||
|
|
||||||
protected:
|
protected:
|
||||||
ReturnValue_t initPacket(const uint8_t* commandData, size_t commandDataLen) override {
|
ReturnValue_t initPacket(const uint8_t* commandData, size_t commandDataLen) override {
|
||||||
ReturnValue_t result = HasReturnvaluesIF::RETURN_OK;
|
ReturnValue_t result = returnvalue::OK;
|
||||||
result = lengthCheck(commandDataLen);
|
result = lengthCheck(commandDataLen);
|
||||||
if (result != HasReturnvaluesIF::RETURN_OK) {
|
if (result != returnvalue::OK) {
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
std::memcpy(payloadStart, commandData, MEM_ADDRESS_SIZE);
|
std::memcpy(payloadStart, commandData, MEM_ADDRESS_SIZE);
|
||||||
@ -224,7 +224,7 @@ class TcMemRead : public TcBase {
|
|||||||
const uint8_t* memLenPtr = commandData + MEM_ADDRESS_SIZE;
|
const uint8_t* memLenPtr = commandData + MEM_ADDRESS_SIZE;
|
||||||
result =
|
result =
|
||||||
SerializeAdapter::deSerialize(&memLen, &memLenPtr, &size, SerializeIF::Endianness::BIG);
|
SerializeAdapter::deSerialize(&memLen, &memLenPtr, &size, SerializeIF::Endianness::BIG);
|
||||||
if (result != HasReturnvaluesIF::RETURN_OK) {
|
if (result != returnvalue::OK) {
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
return result;
|
return result;
|
||||||
@ -239,10 +239,10 @@ class TcMemRead : public TcBase {
|
|||||||
uint16_t memLen = 0;
|
uint16_t memLen = 0;
|
||||||
|
|
||||||
ReturnValue_t lengthCheck(size_t commandDataLen) {
|
ReturnValue_t lengthCheck(size_t commandDataLen) {
|
||||||
if (commandDataLen != COMMAND_LENGTH or checkPayloadLen() != HasReturnvaluesIF::RETURN_OK) {
|
if (commandDataLen != COMMAND_LENGTH or checkPayloadLen() != returnvalue::OK) {
|
||||||
return INVALID_LENGTH;
|
return INVALID_LENGTH;
|
||||||
}
|
}
|
||||||
return HasReturnvaluesIF::RETURN_OK;
|
return returnvalue::OK;
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -260,16 +260,16 @@ class TcMemWrite : public TcBase {
|
|||||||
|
|
||||||
protected:
|
protected:
|
||||||
ReturnValue_t initPacket(const uint8_t* commandData, size_t commandDataLen) override {
|
ReturnValue_t initPacket(const uint8_t* commandData, size_t commandDataLen) override {
|
||||||
ReturnValue_t result = HasReturnvaluesIF::RETURN_OK;
|
ReturnValue_t result = returnvalue::OK;
|
||||||
result = lengthCheck(commandDataLen);
|
result = lengthCheck(commandDataLen);
|
||||||
if (result != HasReturnvaluesIF::RETURN_OK) {
|
if (result != returnvalue::OK) {
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
uint16_t memLen =
|
uint16_t memLen =
|
||||||
*(commandData + MEM_ADDRESS_SIZE) << 8 | *(commandData + MEM_ADDRESS_SIZE + 1);
|
*(commandData + MEM_ADDRESS_SIZE) << 8 | *(commandData + MEM_ADDRESS_SIZE + 1);
|
||||||
spParams.setPayloadLen(MIN_FIXED_PAYLOAD_LENGTH + memLen * 4);
|
spParams.setPayloadLen(MIN_FIXED_PAYLOAD_LENGTH + memLen * 4);
|
||||||
result = checkPayloadLen();
|
result = checkPayloadLen();
|
||||||
if (result != HasReturnvaluesIF::RETURN_OK) {
|
if (result != returnvalue::OK) {
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
std::memcpy(payloadStart, commandData, commandDataLen);
|
std::memcpy(payloadStart, commandData, commandDataLen);
|
||||||
@ -294,7 +294,7 @@ class TcMemWrite : public TcBase {
|
|||||||
<< spParams.maxSize - CRC_SIZE << std::endl;
|
<< spParams.maxSize - CRC_SIZE << std::endl;
|
||||||
return INVALID_LENGTH;
|
return INVALID_LENGTH;
|
||||||
}
|
}
|
||||||
return HasReturnvaluesIF::RETURN_OK;
|
return returnvalue::OK;
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -315,7 +315,7 @@ class FlashFopen : public ploc::SpTcBase {
|
|||||||
size_t nameSize = filename.size();
|
size_t nameSize = filename.size();
|
||||||
spParams.setPayloadLen(nameSize + sizeof(NULL_TERMINATOR) + sizeof(accessMode));
|
spParams.setPayloadLen(nameSize + sizeof(NULL_TERMINATOR) + sizeof(accessMode));
|
||||||
ReturnValue_t result = checkPayloadLen();
|
ReturnValue_t result = checkPayloadLen();
|
||||||
if (result != HasReturnvaluesIF::RETURN_OK) {
|
if (result != returnvalue::OK) {
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
std::memcpy(payloadStart, filename.c_str(), nameSize);
|
std::memcpy(payloadStart, filename.c_str(), nameSize);
|
||||||
@ -341,7 +341,7 @@ class FlashFclose : public ploc::SpTcBase {
|
|||||||
size_t nameSize = filename.size();
|
size_t nameSize = filename.size();
|
||||||
spParams.setPayloadLen(nameSize + sizeof(NULL_TERMINATOR));
|
spParams.setPayloadLen(nameSize + sizeof(NULL_TERMINATOR));
|
||||||
ReturnValue_t result = checkPayloadLen();
|
ReturnValue_t result = checkPayloadLen();
|
||||||
if (result != HasReturnvaluesIF::RETURN_OK) {
|
if (result != returnvalue::OK) {
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
std::memcpy(payloadStart, filename.c_str(), nameSize);
|
std::memcpy(payloadStart, filename.c_str(), nameSize);
|
||||||
@ -359,27 +359,27 @@ class TcFlashWrite : public ploc::SpTcBase {
|
|||||||
: ploc::SpTcBase(params, apid::TC_FLASHWRITE, sequenceCount) {}
|
: ploc::SpTcBase(params, apid::TC_FLASHWRITE, sequenceCount) {}
|
||||||
|
|
||||||
ReturnValue_t buildPacket(const uint8_t* writeData, uint32_t writeLen_) {
|
ReturnValue_t buildPacket(const uint8_t* writeData, uint32_t writeLen_) {
|
||||||
ReturnValue_t result = HasReturnvaluesIF::RETURN_OK;
|
ReturnValue_t result = returnvalue::OK;
|
||||||
writeLen = writeLen_;
|
writeLen = writeLen_;
|
||||||
if (writeLen > MAX_DATA_SIZE) {
|
if (writeLen > MAX_DATA_SIZE) {
|
||||||
sif::debug << "FlashWrite::createPacket: Command data too big" << std::endl;
|
sif::debug << "FlashWrite::createPacket: Command data too big" << std::endl;
|
||||||
return HasReturnvaluesIF::RETURN_FAILED;
|
return returnvalue::FAILED;
|
||||||
}
|
}
|
||||||
spParams.setPayloadLen(static_cast<uint16_t>(writeLen) + 4);
|
spParams.setPayloadLen(static_cast<uint16_t>(writeLen) + 4);
|
||||||
result = checkPayloadLen();
|
result = checkPayloadLen();
|
||||||
if (result != HasReturnvaluesIF::RETURN_OK) {
|
if (result != returnvalue::OK) {
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
size_t serializedSize = ccsds::HEADER_LEN;
|
size_t serializedSize = ccsds::HEADER_LEN;
|
||||||
result = SerializeAdapter::serialize(&writeLen, payloadStart, &serializedSize, spParams.maxSize,
|
result = SerializeAdapter::serialize(&writeLen, payloadStart, &serializedSize, spParams.maxSize,
|
||||||
SerializeIF::Endianness::BIG);
|
SerializeIF::Endianness::BIG);
|
||||||
if (result != HasReturnvaluesIF::RETURN_OK) {
|
if (result != returnvalue::OK) {
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
std::memcpy(payloadStart + sizeof(writeLen), writeData, writeLen);
|
std::memcpy(payloadStart + sizeof(writeLen), writeData, writeLen);
|
||||||
updateSpFields();
|
updateSpFields();
|
||||||
auto res = checkSizeAndSerializeHeader();
|
auto res = checkSizeAndSerializeHeader();
|
||||||
if (res != result::OK) {
|
if (res != returnvalue::OK) {
|
||||||
return res;
|
return res;
|
||||||
}
|
}
|
||||||
return calcCrc();
|
return calcCrc();
|
||||||
@ -401,7 +401,7 @@ class TcFlashDelete : public ploc::SpTcBase {
|
|||||||
size_t nameSize = filename.size();
|
size_t nameSize = filename.size();
|
||||||
spParams.setPayloadLen(nameSize + sizeof(NULL_TERMINATOR));
|
spParams.setPayloadLen(nameSize + sizeof(NULL_TERMINATOR));
|
||||||
auto res = checkPayloadLen();
|
auto res = checkPayloadLen();
|
||||||
if (res != HasReturnvaluesIF::RETURN_OK) {
|
if (res != returnvalue::OK) {
|
||||||
return res;
|
return res;
|
||||||
}
|
}
|
||||||
std::memcpy(payloadStart, filename.c_str(), nameSize);
|
std::memcpy(payloadStart, filename.c_str(), nameSize);
|
||||||
@ -409,7 +409,7 @@ class TcFlashDelete : public ploc::SpTcBase {
|
|||||||
|
|
||||||
updateSpFields();
|
updateSpFields();
|
||||||
res = checkSizeAndSerializeHeader();
|
res = checkSizeAndSerializeHeader();
|
||||||
if (res != result::OK) {
|
if (res != returnvalue::OK) {
|
||||||
return res;
|
return res;
|
||||||
}
|
}
|
||||||
return calcCrc();
|
return calcCrc();
|
||||||
@ -438,14 +438,14 @@ class TcReplayStart : public TcBase {
|
|||||||
|
|
||||||
protected:
|
protected:
|
||||||
ReturnValue_t initPacket(const uint8_t* commandData, size_t commandDataLen) override {
|
ReturnValue_t initPacket(const uint8_t* commandData, size_t commandDataLen) override {
|
||||||
ReturnValue_t result = HasReturnvaluesIF::RETURN_OK;
|
ReturnValue_t result = returnvalue::OK;
|
||||||
spParams.setPayloadLen(commandDataLen);
|
spParams.setPayloadLen(commandDataLen);
|
||||||
result = lengthCheck(commandDataLen);
|
result = lengthCheck(commandDataLen);
|
||||||
if (result != HasReturnvaluesIF::RETURN_OK) {
|
if (result != returnvalue::OK) {
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
result = checkData(*commandData);
|
result = checkData(*commandData);
|
||||||
if (result != HasReturnvaluesIF::RETURN_OK) {
|
if (result != returnvalue::OK) {
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
std::memcpy(payloadStart, commandData, commandDataLen);
|
std::memcpy(payloadStart, commandData, commandDataLen);
|
||||||
@ -458,12 +458,11 @@ class TcReplayStart : public TcBase {
|
|||||||
static const uint8_t ONCE = 1;
|
static const uint8_t ONCE = 1;
|
||||||
|
|
||||||
ReturnValue_t lengthCheck(size_t commandDataLen) {
|
ReturnValue_t lengthCheck(size_t commandDataLen) {
|
||||||
if (commandDataLen != COMMAND_DATA_LENGTH or
|
if (commandDataLen != COMMAND_DATA_LENGTH or checkPayloadLen() != returnvalue::OK) {
|
||||||
checkPayloadLen() != HasReturnvaluesIF::RETURN_OK) {
|
|
||||||
sif::warning << "TcReplayStart: Command has invalid length " << commandDataLen << std::endl;
|
sif::warning << "TcReplayStart: Command has invalid length " << commandDataLen << std::endl;
|
||||||
return INVALID_LENGTH;
|
return INVALID_LENGTH;
|
||||||
}
|
}
|
||||||
return HasReturnvaluesIF::RETURN_OK;
|
return returnvalue::OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
ReturnValue_t checkData(uint8_t replay) {
|
ReturnValue_t checkData(uint8_t replay) {
|
||||||
@ -471,7 +470,7 @@ class TcReplayStart : public TcBase {
|
|||||||
sif::warning << "TcReplayStart::checkData: Invalid replay value" << std::endl;
|
sif::warning << "TcReplayStart::checkData: Invalid replay value" << std::endl;
|
||||||
return INVALID_PARAMETER;
|
return INVALID_PARAMETER;
|
||||||
}
|
}
|
||||||
return HasReturnvaluesIF::RETURN_OK;
|
return returnvalue::OK;
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -488,22 +487,22 @@ class TcDownlinkPwrOn : public TcBase {
|
|||||||
|
|
||||||
protected:
|
protected:
|
||||||
ReturnValue_t initPacket(const uint8_t* commandData, size_t commandDataLen) override {
|
ReturnValue_t initPacket(const uint8_t* commandData, size_t commandDataLen) override {
|
||||||
ReturnValue_t result = HasReturnvaluesIF::RETURN_OK;
|
ReturnValue_t result = returnvalue::OK;
|
||||||
result = lengthCheck(commandDataLen);
|
result = lengthCheck(commandDataLen);
|
||||||
if (result != HasReturnvaluesIF::RETURN_OK) {
|
if (result != returnvalue::OK) {
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
result = modeCheck(*commandData);
|
result = modeCheck(*commandData);
|
||||||
if (result != HasReturnvaluesIF::RETURN_OK) {
|
if (result != returnvalue::OK) {
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
result = laneRateCheck(*(commandData + 1));
|
result = laneRateCheck(*(commandData + 1));
|
||||||
if (result != HasReturnvaluesIF::RETURN_OK) {
|
if (result != returnvalue::OK) {
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
spParams.setPayloadLen(commandDataLen + sizeof(MAX_AMPLITUDE));
|
spParams.setPayloadLen(commandDataLen + sizeof(MAX_AMPLITUDE));
|
||||||
result = checkPayloadLen();
|
result = checkPayloadLen();
|
||||||
if (result != HasReturnvaluesIF::RETURN_OK) {
|
if (result != returnvalue::OK) {
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
std::memcpy(payloadStart, commandData, commandDataLen);
|
std::memcpy(payloadStart, commandData, commandDataLen);
|
||||||
@ -529,7 +528,7 @@ class TcDownlinkPwrOn : public TcBase {
|
|||||||
sif::warning << "TcDownlinkPwrOn: Command has invalid length " << commandDataLen << std::endl;
|
sif::warning << "TcDownlinkPwrOn: Command has invalid length " << commandDataLen << std::endl;
|
||||||
return INVALID_LENGTH;
|
return INVALID_LENGTH;
|
||||||
}
|
}
|
||||||
return HasReturnvaluesIF::RETURN_OK;
|
return returnvalue::OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
ReturnValue_t modeCheck(uint8_t mode) {
|
ReturnValue_t modeCheck(uint8_t mode) {
|
||||||
@ -537,7 +536,7 @@ class TcDownlinkPwrOn : public TcBase {
|
|||||||
sif::warning << "TcDwonlinkPwrOn::modeCheck: Invalid JESD mode" << std::endl;
|
sif::warning << "TcDwonlinkPwrOn::modeCheck: Invalid JESD mode" << std::endl;
|
||||||
return INVALID_MODE;
|
return INVALID_MODE;
|
||||||
}
|
}
|
||||||
return HasReturnvaluesIF::RETURN_OK;
|
return returnvalue::OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
ReturnValue_t laneRateCheck(uint8_t laneRate) {
|
ReturnValue_t laneRateCheck(uint8_t laneRate) {
|
||||||
@ -545,7 +544,7 @@ class TcDownlinkPwrOn : public TcBase {
|
|||||||
sif::warning << "TcReplayStart::laneRateCheck: Invalid lane rate" << std::endl;
|
sif::warning << "TcReplayStart::laneRateCheck: Invalid lane rate" << std::endl;
|
||||||
return INVALID_LANE_RATE;
|
return INVALID_LANE_RATE;
|
||||||
}
|
}
|
||||||
return HasReturnvaluesIF::RETURN_OK;
|
return returnvalue::OK;
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -571,10 +570,10 @@ class TcReplayWriteSeq : public TcBase {
|
|||||||
|
|
||||||
protected:
|
protected:
|
||||||
ReturnValue_t initPacket(const uint8_t* commandData, size_t commandDataLen) override {
|
ReturnValue_t initPacket(const uint8_t* commandData, size_t commandDataLen) override {
|
||||||
ReturnValue_t result = HasReturnvaluesIF::RETURN_OK;
|
ReturnValue_t result = returnvalue::OK;
|
||||||
spParams.setPayloadLen(commandDataLen + sizeof(NULL_TERMINATOR));
|
spParams.setPayloadLen(commandDataLen + sizeof(NULL_TERMINATOR));
|
||||||
result = lengthCheck(commandDataLen);
|
result = lengthCheck(commandDataLen);
|
||||||
if (result != HasReturnvaluesIF::RETURN_OK) {
|
if (result != returnvalue::OK) {
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
std::memcpy(payloadStart, commandData, commandDataLen);
|
std::memcpy(payloadStart, commandData, commandDataLen);
|
||||||
@ -587,12 +586,12 @@ class TcReplayWriteSeq : public TcBase {
|
|||||||
|
|
||||||
ReturnValue_t lengthCheck(size_t commandDataLen) {
|
ReturnValue_t lengthCheck(size_t commandDataLen) {
|
||||||
if (commandDataLen > USE_DECODING_LENGTH + MAX_FILENAME_SIZE or
|
if (commandDataLen > USE_DECODING_LENGTH + MAX_FILENAME_SIZE or
|
||||||
checkPayloadLen() != HasReturnvaluesIF::RETURN_OK) {
|
checkPayloadLen() != returnvalue::OK) {
|
||||||
sif::warning << "TcReplayWriteSeq: Command has invalid length " << commandDataLen
|
sif::warning << "TcReplayWriteSeq: Command has invalid length " << commandDataLen
|
||||||
<< std::endl;
|
<< std::endl;
|
||||||
return INVALID_LENGTH;
|
return INVALID_LENGTH;
|
||||||
}
|
}
|
||||||
return HasReturnvaluesIF::RETURN_OK;
|
return returnvalue::OK;
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -616,7 +615,7 @@ class FlashWritePusCmd : public MPSoCReturnValuesIF {
|
|||||||
if (mpsocFile.size() > MAX_FILENAME_SIZE) {
|
if (mpsocFile.size() > MAX_FILENAME_SIZE) {
|
||||||
return MPSOC_FILENAME_TOO_LONG;
|
return MPSOC_FILENAME_TOO_LONG;
|
||||||
}
|
}
|
||||||
return HasReturnvaluesIF::RETURN_OK;
|
return returnvalue::OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
std::string getObcFile() { return obcFile; }
|
std::string getObcFile() { return obcFile; }
|
||||||
@ -660,7 +659,7 @@ class TcCamcmdSend : public TcBase {
|
|||||||
uint16_t dataLen = static_cast<uint16_t>(commandDataLen + sizeof(CARRIAGE_RETURN));
|
uint16_t dataLen = static_cast<uint16_t>(commandDataLen + sizeof(CARRIAGE_RETURN));
|
||||||
spParams.setPayloadLen(sizeof(dataLen) + commandDataLen + sizeof(CARRIAGE_RETURN));
|
spParams.setPayloadLen(sizeof(dataLen) + commandDataLen + sizeof(CARRIAGE_RETURN));
|
||||||
auto res = checkPayloadLen();
|
auto res = checkPayloadLen();
|
||||||
if (res != HasReturnvaluesIF::RETURN_OK) {
|
if (res != returnvalue::OK) {
|
||||||
return res;
|
return res;
|
||||||
}
|
}
|
||||||
size_t size = ccsds::HEADER_LEN;
|
size_t size = ccsds::HEADER_LEN;
|
||||||
@ -669,7 +668,7 @@ class TcCamcmdSend : public TcBase {
|
|||||||
std::memcpy(payloadStart + sizeof(dataLen), commandData, commandDataLen);
|
std::memcpy(payloadStart + sizeof(dataLen), commandData, commandDataLen);
|
||||||
*(payloadStart + sizeof(dataLen) + commandDataLen) = CARRIAGE_RETURN;
|
*(payloadStart + sizeof(dataLen) + commandDataLen) = CARRIAGE_RETURN;
|
||||||
|
|
||||||
return HasReturnvaluesIF::RETURN_OK;
|
return returnvalue::OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
@ -101,6 +101,9 @@ static const uint16_t APID_DATA_LOGGER_DATA = 0x20D;
|
|||||||
/**
|
/**
|
||||||
* APIDs of telecommand packets
|
* APIDs of telecommand packets
|
||||||
*/
|
*/
|
||||||
|
// 2 bits APID SRC, 00 for OBC, 2 bits APID DEST, 01 for SUPV, 7 bits CMD ID -> Mask 0x080
|
||||||
|
static constexpr uint16_t APID_TC_SUPV_MASK = 0x080;
|
||||||
|
|
||||||
static const uint16_t APID_START_MPSOC = 0xA1;
|
static const uint16_t APID_START_MPSOC = 0xA1;
|
||||||
static const uint16_t APID_SHUTWOWN_MPSOC = 0xA2;
|
static const uint16_t APID_SHUTWOWN_MPSOC = 0xA2;
|
||||||
static const uint16_t APID_SEL_MPSOC_BOOT_IMAGE = 0xA3;
|
static const uint16_t APID_SEL_MPSOC_BOOT_IMAGE = 0xA3;
|
||||||
@ -300,7 +303,7 @@ class ApidOnlyPacket : public ploc::SpTcBase {
|
|||||||
|
|
||||||
ReturnValue_t buildPacket() {
|
ReturnValue_t buildPacket() {
|
||||||
auto res = checkSizeAndSerializeHeader();
|
auto res = checkSizeAndSerializeHeader();
|
||||||
if (res != result::OK) {
|
if (res != returnvalue::OK) {
|
||||||
return res;
|
return res;
|
||||||
}
|
}
|
||||||
return calcCrc();
|
return calcCrc();
|
||||||
@ -336,7 +339,7 @@ class MPSoCBootSelect : public ploc::SpTcBase {
|
|||||||
|
|
||||||
ReturnValue_t buildPacket(uint8_t mem = 0, uint8_t bp0 = 0, uint8_t bp1 = 0, uint8_t bp2 = 0) {
|
ReturnValue_t buildPacket(uint8_t mem = 0, uint8_t bp0 = 0, uint8_t bp1 = 0, uint8_t bp2 = 0) {
|
||||||
auto res = checkSizeAndSerializeHeader();
|
auto res = checkSizeAndSerializeHeader();
|
||||||
if (res != result::OK) {
|
if (res != returnvalue::OK) {
|
||||||
return res;
|
return res;
|
||||||
}
|
}
|
||||||
initPacket(mem, bp0, bp1, bp2);
|
initPacket(mem, bp0, bp1, bp2);
|
||||||
@ -382,7 +385,7 @@ class EnableNvms : public ploc::SpTcBase {
|
|||||||
|
|
||||||
ReturnValue_t buildPacket(uint8_t nvm01, uint8_t nvm3) {
|
ReturnValue_t buildPacket(uint8_t nvm01, uint8_t nvm3) {
|
||||||
auto res = checkSizeAndSerializeHeader();
|
auto res = checkSizeAndSerializeHeader();
|
||||||
if (res != result::OK) {
|
if (res != returnvalue::OK) {
|
||||||
return res;
|
return res;
|
||||||
}
|
}
|
||||||
initPacket(nvm01, nvm3);
|
initPacket(nvm01, nvm3);
|
||||||
@ -412,11 +415,11 @@ class SetTimeRef : public ploc::SpTcBase {
|
|||||||
|
|
||||||
ReturnValue_t buildPacket(Clock::TimeOfDay_t* time) {
|
ReturnValue_t buildPacket(Clock::TimeOfDay_t* time) {
|
||||||
auto res = checkSizeAndSerializeHeader();
|
auto res = checkSizeAndSerializeHeader();
|
||||||
if (res != result::OK) {
|
if (res != returnvalue::OK) {
|
||||||
return res;
|
return res;
|
||||||
}
|
}
|
||||||
res = initPacket(time);
|
res = initPacket(time);
|
||||||
if (res != result::OK) {
|
if (res != returnvalue::OK) {
|
||||||
return res;
|
return res;
|
||||||
}
|
}
|
||||||
return calcCrc();
|
return calcCrc();
|
||||||
@ -434,37 +437,37 @@ class SetTimeRef : public ploc::SpTcBase {
|
|||||||
ReturnValue_t result =
|
ReturnValue_t result =
|
||||||
SerializeAdapter::serialize(&milliseconds, &dataFieldPtr, &serializedSize, spParams.maxSize,
|
SerializeAdapter::serialize(&milliseconds, &dataFieldPtr, &serializedSize, spParams.maxSize,
|
||||||
SerializeIF::Endianness::BIG);
|
SerializeIF::Endianness::BIG);
|
||||||
if (result != HasReturnvaluesIF::RETURN_OK) {
|
if (result != returnvalue::OK) {
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
uint8_t second = static_cast<uint8_t>(time->second);
|
uint8_t second = static_cast<uint8_t>(time->second);
|
||||||
result = SerializeAdapter::serialize(&second, &dataFieldPtr, &serializedSize, spParams.maxSize,
|
result = SerializeAdapter::serialize(&second, &dataFieldPtr, &serializedSize, spParams.maxSize,
|
||||||
SerializeIF::Endianness::BIG);
|
SerializeIF::Endianness::BIG);
|
||||||
if (result != HasReturnvaluesIF::RETURN_OK) {
|
if (result != returnvalue::OK) {
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
uint8_t minute = static_cast<uint8_t>(time->minute);
|
uint8_t minute = static_cast<uint8_t>(time->minute);
|
||||||
result = SerializeAdapter::serialize(&minute, &dataFieldPtr, &serializedSize, spParams.maxSize,
|
result = SerializeAdapter::serialize(&minute, &dataFieldPtr, &serializedSize, spParams.maxSize,
|
||||||
SerializeIF::Endianness::BIG);
|
SerializeIF::Endianness::BIG);
|
||||||
if (result != HasReturnvaluesIF::RETURN_OK) {
|
if (result != returnvalue::OK) {
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
uint8_t hour = static_cast<uint8_t>(time->hour);
|
uint8_t hour = static_cast<uint8_t>(time->hour);
|
||||||
result = SerializeAdapter::serialize(&hour, &dataFieldPtr, &serializedSize, spParams.maxSize,
|
result = SerializeAdapter::serialize(&hour, &dataFieldPtr, &serializedSize, spParams.maxSize,
|
||||||
SerializeIF::Endianness::BIG);
|
SerializeIF::Endianness::BIG);
|
||||||
if (result != HasReturnvaluesIF::RETURN_OK) {
|
if (result != returnvalue::OK) {
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
uint8_t day = static_cast<uint8_t>(time->day);
|
uint8_t day = static_cast<uint8_t>(time->day);
|
||||||
result = SerializeAdapter::serialize(&day, &dataFieldPtr, &serializedSize, spParams.maxSize,
|
result = SerializeAdapter::serialize(&day, &dataFieldPtr, &serializedSize, spParams.maxSize,
|
||||||
SerializeIF::Endianness::BIG);
|
SerializeIF::Endianness::BIG);
|
||||||
if (result != HasReturnvaluesIF::RETURN_OK) {
|
if (result != returnvalue::OK) {
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
uint8_t month = static_cast<uint8_t>(time->month);
|
uint8_t month = static_cast<uint8_t>(time->month);
|
||||||
result = SerializeAdapter::serialize(&month, &dataFieldPtr, &serializedSize, spParams.maxSize,
|
result = SerializeAdapter::serialize(&month, &dataFieldPtr, &serializedSize, spParams.maxSize,
|
||||||
SerializeIF::Endianness::BIG);
|
SerializeIF::Endianness::BIG);
|
||||||
if (result != HasReturnvaluesIF::RETURN_OK) {
|
if (result != returnvalue::OK) {
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
uint8_t year = static_cast<uint8_t>(time->year - 1900);
|
uint8_t year = static_cast<uint8_t>(time->year - 1900);
|
||||||
@ -491,7 +494,7 @@ class SetBootTimeout : public ploc::SpTcBase {
|
|||||||
|
|
||||||
ReturnValue_t buildPacket(uint32_t timeout) {
|
ReturnValue_t buildPacket(uint32_t timeout) {
|
||||||
auto res = checkSizeAndSerializeHeader();
|
auto res = checkSizeAndSerializeHeader();
|
||||||
if (res != result::OK) {
|
if (res != returnvalue::OK) {
|
||||||
return res;
|
return res;
|
||||||
}
|
}
|
||||||
initPacket(timeout);
|
initPacket(timeout);
|
||||||
@ -528,7 +531,7 @@ class SetRestartTries : public ploc::SpTcBase {
|
|||||||
|
|
||||||
ReturnValue_t buildPacket(uint8_t restartTries) {
|
ReturnValue_t buildPacket(uint8_t restartTries) {
|
||||||
auto res = checkSizeAndSerializeHeader();
|
auto res = checkSizeAndSerializeHeader();
|
||||||
if (res != result::OK) {
|
if (res != returnvalue::OK) {
|
||||||
return res;
|
return res;
|
||||||
}
|
}
|
||||||
initPacket(restartTries);
|
initPacket(restartTries);
|
||||||
@ -562,7 +565,7 @@ class DisablePeriodicHkTransmission : public ploc::SpTcBase {
|
|||||||
|
|
||||||
ReturnValue_t buildPacket() {
|
ReturnValue_t buildPacket() {
|
||||||
auto res = checkSizeAndSerializeHeader();
|
auto res = checkSizeAndSerializeHeader();
|
||||||
if (res != result::OK) {
|
if (res != returnvalue::OK) {
|
||||||
return res;
|
return res;
|
||||||
}
|
}
|
||||||
initPacket();
|
initPacket();
|
||||||
@ -602,7 +605,7 @@ class LatchupAlert : public ploc::SpTcBase {
|
|||||||
spParams.creator.setApid(APID_DISABLE_LATCHUP_ALERT);
|
spParams.creator.setApid(APID_DISABLE_LATCHUP_ALERT);
|
||||||
}
|
}
|
||||||
auto res = checkSizeAndSerializeHeader();
|
auto res = checkSizeAndSerializeHeader();
|
||||||
if (res != result::OK) {
|
if (res != returnvalue::OK) {
|
||||||
return res;
|
return res;
|
||||||
}
|
}
|
||||||
initPacket(latchupId);
|
initPacket(latchupId);
|
||||||
@ -636,11 +639,11 @@ class SetAlertlimit : public ploc::SpTcBase {
|
|||||||
|
|
||||||
ReturnValue_t buildPacket(uint8_t latchupId, uint32_t dutycycle) {
|
ReturnValue_t buildPacket(uint8_t latchupId, uint32_t dutycycle) {
|
||||||
auto res = checkSizeAndSerializeHeader();
|
auto res = checkSizeAndSerializeHeader();
|
||||||
if (res != result::OK) {
|
if (res != returnvalue::OK) {
|
||||||
return res;
|
return res;
|
||||||
}
|
}
|
||||||
res = initPacket(latchupId, dutycycle);
|
res = initPacket(latchupId, dutycycle);
|
||||||
if (res != result::OK) {
|
if (res != returnvalue::OK) {
|
||||||
return res;
|
return res;
|
||||||
}
|
}
|
||||||
return calcCrc();
|
return calcCrc();
|
||||||
@ -679,7 +682,7 @@ class SetAdcEnabledChannels : public ploc::SpTcBase {
|
|||||||
|
|
||||||
ReturnValue_t buildPacket(uint16_t ch) {
|
ReturnValue_t buildPacket(uint16_t ch) {
|
||||||
auto res = checkSizeAndSerializeHeader();
|
auto res = checkSizeAndSerializeHeader();
|
||||||
if (res != result::OK) {
|
if (res != returnvalue::OK) {
|
||||||
return res;
|
return res;
|
||||||
}
|
}
|
||||||
initPacket(ch);
|
initPacket(ch);
|
||||||
@ -718,7 +721,7 @@ class SetAdcWindowAndStride : public ploc::SpTcBase {
|
|||||||
|
|
||||||
ReturnValue_t buildPacket(uint16_t windowSize, uint16_t stridingStepSize) {
|
ReturnValue_t buildPacket(uint16_t windowSize, uint16_t stridingStepSize) {
|
||||||
auto res = checkSizeAndSerializeHeader();
|
auto res = checkSizeAndSerializeHeader();
|
||||||
if (res != result::OK) {
|
if (res != returnvalue::OK) {
|
||||||
return res;
|
return res;
|
||||||
}
|
}
|
||||||
initPacket(windowSize, stridingStepSize);
|
initPacket(windowSize, stridingStepSize);
|
||||||
@ -758,7 +761,7 @@ class SetAdcThreshold : public ploc::SpTcBase {
|
|||||||
|
|
||||||
ReturnValue_t buildPacket(uint32_t threshold) {
|
ReturnValue_t buildPacket(uint32_t threshold) {
|
||||||
auto res = checkSizeAndSerializeHeader();
|
auto res = checkSizeAndSerializeHeader();
|
||||||
if (res != result::OK) {
|
if (res != returnvalue::OK) {
|
||||||
return res;
|
return res;
|
||||||
}
|
}
|
||||||
initPacket(threshold);
|
initPacket(threshold);
|
||||||
@ -796,7 +799,7 @@ class RunAutoEmTests : public ploc::SpTcBase {
|
|||||||
|
|
||||||
ReturnValue_t buildPacket(uint8_t test) {
|
ReturnValue_t buildPacket(uint8_t test) {
|
||||||
auto res = checkSizeAndSerializeHeader();
|
auto res = checkSizeAndSerializeHeader();
|
||||||
if (res != result::OK) {
|
if (res != returnvalue::OK) {
|
||||||
return res;
|
return res;
|
||||||
}
|
}
|
||||||
initPacket(test);
|
initPacket(test);
|
||||||
@ -844,7 +847,7 @@ class MramCmd : public ploc::SpTcBase {
|
|||||||
sif::debug << "WipeMram: Invalid action specified";
|
sif::debug << "WipeMram: Invalid action specified";
|
||||||
}
|
}
|
||||||
auto res = checkSizeAndSerializeHeader();
|
auto res = checkSizeAndSerializeHeader();
|
||||||
if (res != result::OK) {
|
if (res != returnvalue::OK) {
|
||||||
return res;
|
return res;
|
||||||
}
|
}
|
||||||
initPacket(start, stop);
|
initPacket(start, stop);
|
||||||
@ -892,7 +895,7 @@ class SetGpio : public ploc::SpTcBase {
|
|||||||
|
|
||||||
ReturnValue_t buildPacket(uint8_t port, uint8_t pin, uint8_t val) {
|
ReturnValue_t buildPacket(uint8_t port, uint8_t pin, uint8_t val) {
|
||||||
auto res = checkSizeAndSerializeHeader();
|
auto res = checkSizeAndSerializeHeader();
|
||||||
if (res != result::OK) {
|
if (res != returnvalue::OK) {
|
||||||
return res;
|
return res;
|
||||||
}
|
}
|
||||||
initPacket(port, pin, val);
|
initPacket(port, pin, val);
|
||||||
@ -936,7 +939,7 @@ class ReadGpio : public ploc::SpTcBase {
|
|||||||
|
|
||||||
ReturnValue_t buildPacket(uint8_t port, uint8_t pin) {
|
ReturnValue_t buildPacket(uint8_t port, uint8_t pin) {
|
||||||
auto res = checkSizeAndSerializeHeader();
|
auto res = checkSizeAndSerializeHeader();
|
||||||
if (res != result::OK) {
|
if (res != returnvalue::OK) {
|
||||||
return res;
|
return res;
|
||||||
}
|
}
|
||||||
initPacket(port, pin);
|
initPacket(port, pin);
|
||||||
@ -982,7 +985,7 @@ class FactoryReset : public ploc::SpTcBase {
|
|||||||
|
|
||||||
ReturnValue_t buildPacket(Op op) {
|
ReturnValue_t buildPacket(Op op) {
|
||||||
auto res = checkSizeAndSerializeHeader();
|
auto res = checkSizeAndSerializeHeader();
|
||||||
if (res != result::OK) {
|
if (res != returnvalue::OK) {
|
||||||
return res;
|
return res;
|
||||||
}
|
}
|
||||||
initPacket(op);
|
initPacket(op);
|
||||||
@ -1020,7 +1023,7 @@ class SetShutdownTimeout : public ploc::SpTcBase {
|
|||||||
|
|
||||||
ReturnValue_t buildPacket(uint32_t timeout) {
|
ReturnValue_t buildPacket(uint32_t timeout) {
|
||||||
auto res = checkSizeAndSerializeHeader();
|
auto res = checkSizeAndSerializeHeader();
|
||||||
if (res != result::OK) {
|
if (res != returnvalue::OK) {
|
||||||
return res;
|
return res;
|
||||||
}
|
}
|
||||||
initPacket(timeout);
|
initPacket(timeout);
|
||||||
@ -1059,7 +1062,7 @@ class CheckMemory : public ploc::SpTcBase {
|
|||||||
|
|
||||||
ReturnValue_t buildPacket(uint8_t memoryId, uint32_t startAddress, uint32_t length) {
|
ReturnValue_t buildPacket(uint8_t memoryId, uint32_t startAddress, uint32_t length) {
|
||||||
auto res = checkSizeAndSerializeHeader();
|
auto res = checkSizeAndSerializeHeader();
|
||||||
if (res != result::OK) {
|
if (res != returnvalue::OK) {
|
||||||
return res;
|
return res;
|
||||||
}
|
}
|
||||||
initPacket(memoryId, startAddress, length);
|
initPacket(memoryId, startAddress, length);
|
||||||
@ -1114,7 +1117,7 @@ class WriteMemory : public ploc::SpTcBase {
|
|||||||
spParams.creator.setSeqCount(sequenceCount);
|
spParams.creator.setSeqCount(sequenceCount);
|
||||||
initPacket(memoryId, startAddress, length, updateData);
|
initPacket(memoryId, startAddress, length, updateData);
|
||||||
auto res = checkSizeAndSerializeHeader();
|
auto res = checkSizeAndSerializeHeader();
|
||||||
if (res != result::OK) {
|
if (res != returnvalue::OK) {
|
||||||
return res;
|
return res;
|
||||||
}
|
}
|
||||||
return calcCrc();
|
return calcCrc();
|
||||||
@ -1137,7 +1140,7 @@ class WriteMemory : public ploc::SpTcBase {
|
|||||||
}
|
}
|
||||||
// To avoid crashes in this unexpected case
|
// To avoid crashes in this unexpected case
|
||||||
ReturnValue_t result = checkPayloadLen();
|
ReturnValue_t result = checkPayloadLen();
|
||||||
if (result != HasReturnvaluesIF::RETURN_OK) {
|
if (result != returnvalue::OK) {
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
size_t serializedSize = 6;
|
size_t serializedSize = 6;
|
||||||
@ -1155,7 +1158,7 @@ class WriteMemory : public ploc::SpTcBase {
|
|||||||
// a value of zero is added here
|
// a value of zero is added here
|
||||||
data[updateDataLen + 1] = 0;
|
data[updateDataLen + 1] = 0;
|
||||||
}
|
}
|
||||||
return HasReturnvaluesIF::RETURN_OK;
|
return returnvalue::OK;
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -1172,7 +1175,7 @@ class EraseMemory : public ploc::SpTcBase {
|
|||||||
|
|
||||||
ReturnValue_t buildPacket(uint8_t memoryId, uint32_t startAddress, uint32_t length) {
|
ReturnValue_t buildPacket(uint8_t memoryId, uint32_t startAddress, uint32_t length) {
|
||||||
auto res = checkSizeAndSerializeHeader();
|
auto res = checkSizeAndSerializeHeader();
|
||||||
if (res != result::OK) {
|
if (res != returnvalue::OK) {
|
||||||
return res;
|
return res;
|
||||||
}
|
}
|
||||||
initPacket(memoryId, startAddress, length);
|
initPacket(memoryId, startAddress, length);
|
||||||
@ -1214,7 +1217,7 @@ class EnableAutoTm : public ploc::SpTcBase {
|
|||||||
|
|
||||||
ReturnValue_t buildPacket() {
|
ReturnValue_t buildPacket() {
|
||||||
auto res = checkSizeAndSerializeHeader();
|
auto res = checkSizeAndSerializeHeader();
|
||||||
if (res != result::OK) {
|
if (res != returnvalue::OK) {
|
||||||
return res;
|
return res;
|
||||||
}
|
}
|
||||||
payloadStart[0] = ENABLE;
|
payloadStart[0] = ENABLE;
|
||||||
@ -1239,7 +1242,7 @@ class DisableAutoTm : public ploc::SpTcBase {
|
|||||||
|
|
||||||
ReturnValue_t buildPacket() {
|
ReturnValue_t buildPacket() {
|
||||||
auto res = checkSizeAndSerializeHeader();
|
auto res = checkSizeAndSerializeHeader();
|
||||||
if (res != result::OK) {
|
if (res != returnvalue::OK) {
|
||||||
return res;
|
return res;
|
||||||
}
|
}
|
||||||
payloadStart[0] = DISABLE;
|
payloadStart[0] = DISABLE;
|
||||||
@ -1279,7 +1282,7 @@ class RequestLoggingData : public ploc::SpTcBase {
|
|||||||
*/
|
*/
|
||||||
ReturnValue_t buildPacket(Sa sa, uint8_t tpc = 0) {
|
ReturnValue_t buildPacket(Sa sa, uint8_t tpc = 0) {
|
||||||
auto res = checkSizeAndSerializeHeader();
|
auto res = checkSizeAndSerializeHeader();
|
||||||
if (res != result::OK) {
|
if (res != returnvalue::OK) {
|
||||||
return res;
|
return res;
|
||||||
}
|
}
|
||||||
payloadStart[0] = static_cast<uint8_t>(sa);
|
payloadStart[0] = static_cast<uint8_t>(sa);
|
||||||
@ -1305,7 +1308,7 @@ class VerificationReport : public ploc::SpTmReader {
|
|||||||
const uint8_t* refApidPtr = this->getPacketData();
|
const uint8_t* refApidPtr = this->getPacketData();
|
||||||
ReturnValue_t result =
|
ReturnValue_t result =
|
||||||
SerializeAdapter::deSerialize(&refApid, refApidPtr, &size, SerializeIF::Endianness::BIG);
|
SerializeAdapter::deSerialize(&refApid, refApidPtr, &size, SerializeIF::Endianness::BIG);
|
||||||
if (result != HasReturnvaluesIF::RETURN_OK) {
|
if (result != returnvalue::OK) {
|
||||||
sif::debug << "ExecutionReport: Failed to deserialize reference APID field" << std::endl;
|
sif::debug << "ExecutionReport: Failed to deserialize reference APID field" << std::endl;
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
@ -1318,14 +1321,14 @@ class VerificationReport : public ploc::SpTmReader {
|
|||||||
const uint8_t* statusCodePtr = this->getPacketData() + OFFSET_STATUS_CODE;
|
const uint8_t* statusCodePtr = this->getPacketData() + OFFSET_STATUS_CODE;
|
||||||
ReturnValue_t result = SerializeAdapter::deSerialize(&statusCode, statusCodePtr, &size,
|
ReturnValue_t result = SerializeAdapter::deSerialize(&statusCode, statusCodePtr, &size,
|
||||||
SerializeIF::Endianness::BIG);
|
SerializeIF::Endianness::BIG);
|
||||||
if (result != HasReturnvaluesIF::RETURN_OK) {
|
if (result != returnvalue::OK) {
|
||||||
sif::debug << "ExecutionReport: Failed to deserialize status code field" << std::endl;
|
sif::debug << "ExecutionReport: Failed to deserialize status code field" << std::endl;
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
return statusCode;
|
return statusCode;
|
||||||
}
|
}
|
||||||
|
|
||||||
virtual ReturnValue_t checkApid() { return HasReturnvaluesIF::RETURN_FAILED; }
|
virtual ReturnValue_t checkApid() { return returnvalue::FAILED; }
|
||||||
|
|
||||||
private:
|
private:
|
||||||
static const uint8_t OFFSET_STATUS_CODE = 4;
|
static const uint8_t OFFSET_STATUS_CODE = 4;
|
||||||
@ -1338,7 +1341,7 @@ class AcknowledgmentReport : public VerificationReport {
|
|||||||
ReturnValue_t checkApid() {
|
ReturnValue_t checkApid() {
|
||||||
uint16_t apid = this->getApid();
|
uint16_t apid = this->getApid();
|
||||||
if (apid == APID_ACK_SUCCESS) {
|
if (apid == APID_ACK_SUCCESS) {
|
||||||
return HasReturnvaluesIF::RETURN_OK;
|
return returnvalue::OK;
|
||||||
} else if (apid == APID_ACK_FAILURE) {
|
} else if (apid == APID_ACK_FAILURE) {
|
||||||
printStatusInformation();
|
printStatusInformation();
|
||||||
return SupvReturnValuesIF::RECEIVED_ACK_FAILURE;
|
return SupvReturnValuesIF::RECEIVED_ACK_FAILURE;
|
||||||
@ -1412,7 +1415,7 @@ class ExecutionReport : public VerificationReport {
|
|||||||
ReturnValue_t checkApid() {
|
ReturnValue_t checkApid() {
|
||||||
uint16_t apid = this->getApid();
|
uint16_t apid = this->getApid();
|
||||||
if (apid == APID_EXE_SUCCESS) {
|
if (apid == APID_EXE_SUCCESS) {
|
||||||
return HasReturnvaluesIF::RETURN_OK;
|
return returnvalue::OK;
|
||||||
} else if (apid == APID_EXE_FAILURE) {
|
} else if (apid == APID_EXE_FAILURE) {
|
||||||
printStatusInformation();
|
printStatusInformation();
|
||||||
return SupvReturnValuesIF::RECEIVED_EXE_FAILURE;
|
return SupvReturnValuesIF::RECEIVED_EXE_FAILURE;
|
||||||
@ -1844,7 +1847,7 @@ class UpdateStatusReport : public ploc::SpTmReader {
|
|||||||
|
|
||||||
ReturnValue_t parseDataField() {
|
ReturnValue_t parseDataField() {
|
||||||
ReturnValue_t result = lengthCheck();
|
ReturnValue_t result = lengthCheck();
|
||||||
if (result != HasReturnvaluesIF::RETURN_OK) {
|
if (result != returnvalue::OK) {
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
const uint8_t* dataFieldPtr = getFullData() + ccsds::HEADER_LEN;
|
const uint8_t* dataFieldPtr = getFullData() + ccsds::HEADER_LEN;
|
||||||
@ -1855,14 +1858,14 @@ class UpdateStatusReport : public ploc::SpTmReader {
|
|||||||
SerializeIF::Endianness::BIG);
|
SerializeIF::Endianness::BIG);
|
||||||
SerializeAdapter::deSerialize(&length, &dataFieldPtr, &size, SerializeIF::Endianness::BIG);
|
SerializeAdapter::deSerialize(&length, &dataFieldPtr, &size, SerializeIF::Endianness::BIG);
|
||||||
SerializeAdapter::deSerialize(&crc, &dataFieldPtr, &size, SerializeIF::Endianness::BIG);
|
SerializeAdapter::deSerialize(&crc, &dataFieldPtr, &size, SerializeIF::Endianness::BIG);
|
||||||
return HasReturnvaluesIF::RETURN_OK;
|
return returnvalue::OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
ReturnValue_t verifycrc(uint16_t goodCrc) const {
|
ReturnValue_t verifycrc(uint16_t goodCrc) const {
|
||||||
if (crc != goodCrc) {
|
if (crc != goodCrc) {
|
||||||
return SupvReturnValuesIF::UPDATE_CRC_FAILURE;
|
return SupvReturnValuesIF::UPDATE_CRC_FAILURE;
|
||||||
}
|
}
|
||||||
return HasReturnvaluesIF::RETURN_OK;
|
return returnvalue::OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
uint16_t getCrc() const { return crc; }
|
uint16_t getCrc() const { return crc; }
|
||||||
@ -1883,7 +1886,7 @@ class UpdateStatusReport : public ploc::SpTmReader {
|
|||||||
if (getFullPacketLen() != FULL_SIZE) {
|
if (getFullPacketLen() != FULL_SIZE) {
|
||||||
return SupvReturnValuesIF::UPDATE_STATUS_REPORT_INVALID_LENGTH;
|
return SupvReturnValuesIF::UPDATE_STATUS_REPORT_INVALID_LENGTH;
|
||||||
}
|
}
|
||||||
return HasReturnvaluesIF::RETURN_OK;
|
return returnvalue::OK;
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -821,27 +821,27 @@ class ChecksumReply {
|
|||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
ChecksumReply(const uint8_t* datafield) {
|
ChecksumReply(const uint8_t* datafield) {
|
||||||
ReturnValue_t result = HasReturnvaluesIF::RETURN_OK;
|
ReturnValue_t result = returnvalue::OK;
|
||||||
region = *(datafield);
|
region = *(datafield);
|
||||||
const uint8_t* addressData = datafield + ADDRESS_OFFSET;
|
const uint8_t* addressData = datafield + ADDRESS_OFFSET;
|
||||||
size_t size = sizeof(address);
|
size_t size = sizeof(address);
|
||||||
result = SerializeAdapter::deSerialize(&address, &addressData, &size,
|
result = SerializeAdapter::deSerialize(&address, &addressData, &size,
|
||||||
SerializeIF::Endianness::LITTLE);
|
SerializeIF::Endianness::LITTLE);
|
||||||
if (result != HasReturnvaluesIF::RETURN_OK) {
|
if (result != returnvalue::OK) {
|
||||||
sif::debug << "ChecksumReply::ChecksumReply: Failed to deserialize address" << std::endl;
|
sif::debug << "ChecksumReply::ChecksumReply: Failed to deserialize address" << std::endl;
|
||||||
}
|
}
|
||||||
const uint8_t* lengthData = datafield + LENGTH_OFFSET;
|
const uint8_t* lengthData = datafield + LENGTH_OFFSET;
|
||||||
size = sizeof(length);
|
size = sizeof(length);
|
||||||
result =
|
result =
|
||||||
SerializeAdapter::deSerialize(&length, &lengthData, &size, SerializeIF::Endianness::LITTLE);
|
SerializeAdapter::deSerialize(&length, &lengthData, &size, SerializeIF::Endianness::LITTLE);
|
||||||
if (result != HasReturnvaluesIF::RETURN_OK) {
|
if (result != returnvalue::OK) {
|
||||||
sif::debug << "ChecksumReply::ChecksumReply: Failed to deserialize length" << std::endl;
|
sif::debug << "ChecksumReply::ChecksumReply: Failed to deserialize length" << std::endl;
|
||||||
}
|
}
|
||||||
const uint8_t* checksumData = datafield + CHECKSUM_OFFSET;
|
const uint8_t* checksumData = datafield + CHECKSUM_OFFSET;
|
||||||
size = sizeof(checksum);
|
size = sizeof(checksum);
|
||||||
result = SerializeAdapter::deSerialize(&checksum, &checksumData, &size,
|
result = SerializeAdapter::deSerialize(&checksum, &checksumData, &size,
|
||||||
SerializeIF::Endianness::LITTLE);
|
SerializeIF::Endianness::LITTLE);
|
||||||
if (result != HasReturnvaluesIF::RETURN_OK) {
|
if (result != returnvalue::OK) {
|
||||||
sif::debug << "ChecksumReply::ChecksumReply: Failed to deserialize checksum" << std::endl;
|
sif::debug << "ChecksumReply::ChecksumReply: Failed to deserialize checksum" << std::endl;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
#ifndef SUPV_RETURN_VALUES_IF_H_
|
#ifndef SUPV_RETURN_VALUES_IF_H_
|
||||||
#define SUPV_RETURN_VALUES_IF_H_
|
#define SUPV_RETURN_VALUES_IF_H_
|
||||||
|
|
||||||
#include "fsfw/returnvalues/HasReturnvaluesIF.h"
|
#include "fsfw/returnvalues/returnvalue.h"
|
||||||
|
|
||||||
class SupvReturnValuesIF {
|
class SupvReturnValuesIF {
|
||||||
public:
|
public:
|
||||||
|
@ -26,9 +26,9 @@ PlocMPSoCHandler::PlocMPSoCHandler(object_id_t objectId, object_id_t uartComIFid
|
|||||||
PlocMPSoCHandler::~PlocMPSoCHandler() {}
|
PlocMPSoCHandler::~PlocMPSoCHandler() {}
|
||||||
|
|
||||||
ReturnValue_t PlocMPSoCHandler::initialize() {
|
ReturnValue_t PlocMPSoCHandler::initialize() {
|
||||||
ReturnValue_t result = RETURN_OK;
|
ReturnValue_t result = returnvalue::OK;
|
||||||
result = DeviceHandlerBase::initialize();
|
result = DeviceHandlerBase::initialize();
|
||||||
if (result != RETURN_OK) {
|
if (result != returnvalue::OK) {
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
uartComIf = dynamic_cast<UartComIF*>(communicationInterface);
|
uartComIf = dynamic_cast<UartComIF*>(communicationInterface);
|
||||||
@ -46,13 +46,13 @@ ReturnValue_t PlocMPSoCHandler::initialize() {
|
|||||||
;
|
;
|
||||||
}
|
}
|
||||||
result = manager->registerListener(eventQueue->getId());
|
result = manager->registerListener(eventQueue->getId());
|
||||||
if (result != RETURN_OK) {
|
if (result != returnvalue::OK) {
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
result = manager->subscribeToEventRange(
|
result = manager->subscribeToEventRange(
|
||||||
eventQueue->getId(), event::getEventId(PlocMPSoCHelper::MPSOC_FLASH_WRITE_FAILED),
|
eventQueue->getId(), event::getEventId(PlocMPSoCHelper::MPSOC_FLASH_WRITE_FAILED),
|
||||||
event::getEventId(PlocMPSoCHelper::MPSOC_FLASH_WRITE_SUCCESSFUL));
|
event::getEventId(PlocMPSoCHelper::MPSOC_FLASH_WRITE_SUCCESSFUL));
|
||||||
if (result != RETURN_OK) {
|
if (result != returnvalue::OK) {
|
||||||
#if FSFW_CPP_OSTREAM_ENABLED == 1
|
#if FSFW_CPP_OSTREAM_ENABLED == 1
|
||||||
sif::warning << "PlocMPSoCHandler::initialize: Failed to subscribe to events from "
|
sif::warning << "PlocMPSoCHandler::initialize: Failed to subscribe to events from "
|
||||||
" ploc mpsoc helper"
|
" ploc mpsoc helper"
|
||||||
@ -62,13 +62,13 @@ ReturnValue_t PlocMPSoCHandler::initialize() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
result = plocMPSoCHelper->setComIF(communicationInterface);
|
result = plocMPSoCHelper->setComIF(communicationInterface);
|
||||||
if (result != RETURN_OK) {
|
if (result != returnvalue::OK) {
|
||||||
return ObjectManagerIF::CHILD_INIT_FAILED;
|
return ObjectManagerIF::CHILD_INIT_FAILED;
|
||||||
}
|
}
|
||||||
plocMPSoCHelper->setComCookie(comCookie);
|
plocMPSoCHelper->setComCookie(comCookie);
|
||||||
plocMPSoCHelper->setSequenceCount(&sequenceCount);
|
plocMPSoCHelper->setSequenceCount(&sequenceCount);
|
||||||
result = commandActionHelper.initialize();
|
result = commandActionHelper.initialize();
|
||||||
if (result != HasReturnvaluesIF::RETURN_OK) {
|
if (result != returnvalue::OK) {
|
||||||
return ObjectManagerIF::CHILD_INIT_FAILED;
|
return ObjectManagerIF::CHILD_INIT_FAILED;
|
||||||
}
|
}
|
||||||
return result;
|
return result;
|
||||||
@ -76,7 +76,7 @@ ReturnValue_t PlocMPSoCHandler::initialize() {
|
|||||||
|
|
||||||
void PlocMPSoCHandler::performOperationHook() {
|
void PlocMPSoCHandler::performOperationHook() {
|
||||||
EventMessage event;
|
EventMessage event;
|
||||||
for (ReturnValue_t result = eventQueue->receiveMessage(&event); result == RETURN_OK;
|
for (ReturnValue_t result = eventQueue->receiveMessage(&event); result == returnvalue::OK;
|
||||||
result = eventQueue->receiveMessage(&event)) {
|
result = eventQueue->receiveMessage(&event)) {
|
||||||
switch (event.getMessageId()) {
|
switch (event.getMessageId()) {
|
||||||
case EventMessage::EVENT_MESSAGE:
|
case EventMessage::EVENT_MESSAGE:
|
||||||
@ -90,9 +90,9 @@ void PlocMPSoCHandler::performOperationHook() {
|
|||||||
}
|
}
|
||||||
CommandMessage message;
|
CommandMessage message;
|
||||||
for (ReturnValue_t result = commandActionHelperQueue->receiveMessage(&message);
|
for (ReturnValue_t result = commandActionHelperQueue->receiveMessage(&message);
|
||||||
result == RETURN_OK; result = commandActionHelperQueue->receiveMessage(&message)) {
|
result == returnvalue::OK; result = commandActionHelperQueue->receiveMessage(&message)) {
|
||||||
result = commandActionHelper.handleReply(&message);
|
result = commandActionHelper.handleReply(&message);
|
||||||
if (result == RETURN_OK) {
|
if (result == returnvalue::OK) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -100,7 +100,7 @@ void PlocMPSoCHandler::performOperationHook() {
|
|||||||
|
|
||||||
ReturnValue_t PlocMPSoCHandler::executeAction(ActionId_t actionId, MessageQueueId_t commandedBy,
|
ReturnValue_t PlocMPSoCHandler::executeAction(ActionId_t actionId, MessageQueueId_t commandedBy,
|
||||||
const uint8_t* data, size_t size) {
|
const uint8_t* data, size_t size) {
|
||||||
ReturnValue_t result = RETURN_OK;
|
ReturnValue_t result = returnvalue::OK;
|
||||||
switch (actionId) {
|
switch (actionId) {
|
||||||
case mpsoc::SET_UART_TX_TRISTATE: {
|
case mpsoc::SET_UART_TX_TRISTATE: {
|
||||||
uartIsolatorSwitch.pullLow();
|
uartIsolatorSwitch.pullLow();
|
||||||
@ -127,12 +127,12 @@ ReturnValue_t PlocMPSoCHandler::executeAction(ActionId_t actionId, MessageQueueI
|
|||||||
}
|
}
|
||||||
mpsoc::FlashWritePusCmd flashWritePusCmd;
|
mpsoc::FlashWritePusCmd flashWritePusCmd;
|
||||||
result = flashWritePusCmd.extractFields(data, size);
|
result = flashWritePusCmd.extractFields(data, size);
|
||||||
if (result != RETURN_OK) {
|
if (result != returnvalue::OK) {
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
result = plocMPSoCHelper->startFlashWrite(flashWritePusCmd.getObcFile(),
|
result = plocMPSoCHelper->startFlashWrite(flashWritePusCmd.getObcFile(),
|
||||||
flashWritePusCmd.getMPSoCFile());
|
flashWritePusCmd.getMPSoCFile());
|
||||||
if (result != RETURN_OK) {
|
if (result != returnvalue::OK) {
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
plocMPSoCHelperExecuting = true;
|
plocMPSoCHelperExecuting = true;
|
||||||
@ -209,7 +209,7 @@ ReturnValue_t PlocMPSoCHandler::buildCommandFromCommand(DeviceCommandId_t device
|
|||||||
const uint8_t* commandData,
|
const uint8_t* commandData,
|
||||||
size_t commandDataLen) {
|
size_t commandDataLen) {
|
||||||
spParams.buf = commandBuffer;
|
spParams.buf = commandBuffer;
|
||||||
ReturnValue_t result = RETURN_OK;
|
ReturnValue_t result = returnvalue::OK;
|
||||||
switch (deviceCommand) {
|
switch (deviceCommand) {
|
||||||
case (mpsoc::TC_MEM_WRITE): {
|
case (mpsoc::TC_MEM_WRITE): {
|
||||||
result = prepareTcMemWrite(commandData, commandDataLen);
|
result = prepareTcMemWrite(commandData, commandDataLen);
|
||||||
@ -262,7 +262,7 @@ ReturnValue_t PlocMPSoCHandler::buildCommandFromCommand(DeviceCommandId_t device
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (result == RETURN_OK) {
|
if (result == returnvalue::OK) {
|
||||||
/**
|
/**
|
||||||
* Flushing the receive buffer to make sure there are no data left from a faulty reply.
|
* Flushing the receive buffer to make sure there are no data left from a faulty reply.
|
||||||
*/
|
*/
|
||||||
@ -294,15 +294,15 @@ void PlocMPSoCHandler::fillCommandAndReplyMap() {
|
|||||||
|
|
||||||
ReturnValue_t PlocMPSoCHandler::scanForReply(const uint8_t* start, size_t remainingSize,
|
ReturnValue_t PlocMPSoCHandler::scanForReply(const uint8_t* start, size_t remainingSize,
|
||||||
DeviceCommandId_t* foundId, size_t* foundLen) {
|
DeviceCommandId_t* foundId, size_t* foundLen) {
|
||||||
ReturnValue_t result = RETURN_OK;
|
ReturnValue_t result = returnvalue::OK;
|
||||||
|
|
||||||
SpacePacketReader spacePacket;
|
SpacePacketReader spacePacket;
|
||||||
spacePacket.setReadOnlyData(start, remainingSize);
|
spacePacket.setReadOnlyData(start, remainingSize);
|
||||||
if (spacePacket.isNull()) {
|
if (spacePacket.isNull()) {
|
||||||
return RETURN_FAILED;
|
return returnvalue::FAILED;
|
||||||
}
|
}
|
||||||
auto res = spacePacket.checkSize();
|
auto res = spacePacket.checkSize();
|
||||||
if (res != RETURN_OK) {
|
if (res != returnvalue::OK) {
|
||||||
return res;
|
return res;
|
||||||
}
|
}
|
||||||
uint16_t apid = spacePacket.getApid();
|
uint16_t apid = spacePacket.getApid();
|
||||||
@ -350,7 +350,7 @@ ReturnValue_t PlocMPSoCHandler::scanForReply(const uint8_t* start, size_t remain
|
|||||||
}
|
}
|
||||||
|
|
||||||
ReturnValue_t PlocMPSoCHandler::interpretDeviceReply(DeviceCommandId_t id, const uint8_t* packet) {
|
ReturnValue_t PlocMPSoCHandler::interpretDeviceReply(DeviceCommandId_t id, const uint8_t* packet) {
|
||||||
ReturnValue_t result = RETURN_OK;
|
ReturnValue_t result = returnvalue::OK;
|
||||||
|
|
||||||
switch (id) {
|
switch (id) {
|
||||||
case mpsoc::ACK_REPORT: {
|
case mpsoc::ACK_REPORT: {
|
||||||
@ -384,7 +384,7 @@ uint32_t PlocMPSoCHandler::getTransitionDelayMs(Mode_t modeFrom, Mode_t modeTo)
|
|||||||
|
|
||||||
ReturnValue_t PlocMPSoCHandler::initializeLocalDataPool(localpool::DataPool& localDataPoolMap,
|
ReturnValue_t PlocMPSoCHandler::initializeLocalDataPool(localpool::DataPool& localDataPoolMap,
|
||||||
LocalDataPoolManager& poolManager) {
|
LocalDataPoolManager& poolManager) {
|
||||||
return HasReturnvaluesIF::RETURN_OK;
|
return returnvalue::OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
void PlocMPSoCHandler::handleEvent(EventMessage* eventMessage) {
|
void PlocMPSoCHandler::handleEvent(EventMessage* eventMessage) {
|
||||||
@ -402,31 +402,31 @@ void PlocMPSoCHandler::handleEvent(EventMessage* eventMessage) {
|
|||||||
|
|
||||||
ReturnValue_t PlocMPSoCHandler::prepareTcMemWrite(const uint8_t* commandData,
|
ReturnValue_t PlocMPSoCHandler::prepareTcMemWrite(const uint8_t* commandData,
|
||||||
size_t commandDataLen) {
|
size_t commandDataLen) {
|
||||||
ReturnValue_t result = RETURN_OK;
|
ReturnValue_t result = returnvalue::OK;
|
||||||
sequenceCount++;
|
sequenceCount++;
|
||||||
mpsoc::TcMemWrite tcMemWrite(spParams, sequenceCount);
|
mpsoc::TcMemWrite tcMemWrite(spParams, sequenceCount);
|
||||||
result = tcMemWrite.buildPacket(commandData, commandDataLen);
|
result = tcMemWrite.buildPacket(commandData, commandDataLen);
|
||||||
if (result != RETURN_OK) {
|
if (result != returnvalue::OK) {
|
||||||
sequenceCount--;
|
sequenceCount--;
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
finishTcPrep(tcMemWrite.getFullPacketLen());
|
finishTcPrep(tcMemWrite.getFullPacketLen());
|
||||||
return RETURN_OK;
|
return returnvalue::OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
ReturnValue_t PlocMPSoCHandler::prepareTcMemRead(const uint8_t* commandData,
|
ReturnValue_t PlocMPSoCHandler::prepareTcMemRead(const uint8_t* commandData,
|
||||||
size_t commandDataLen) {
|
size_t commandDataLen) {
|
||||||
ReturnValue_t result = RETURN_OK;
|
ReturnValue_t result = returnvalue::OK;
|
||||||
sequenceCount++;
|
sequenceCount++;
|
||||||
mpsoc::TcMemRead tcMemRead(spParams, sequenceCount);
|
mpsoc::TcMemRead tcMemRead(spParams, sequenceCount);
|
||||||
result = tcMemRead.buildPacket(commandData, commandDataLen);
|
result = tcMemRead.buildPacket(commandData, commandDataLen);
|
||||||
if (result != RETURN_OK) {
|
if (result != returnvalue::OK) {
|
||||||
sequenceCount--;
|
sequenceCount--;
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
finishTcPrep(tcMemRead.getFullPacketLen());
|
finishTcPrep(tcMemRead.getFullPacketLen());
|
||||||
tmMemReadReport.rememberRequestedSize = tcMemRead.getMemLen() * 4 + TmMemReadReport::FIX_SIZE;
|
tmMemReadReport.rememberRequestedSize = tcMemRead.getMemLen() * 4 + TmMemReadReport::FIX_SIZE;
|
||||||
return RETURN_OK;
|
return returnvalue::OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
ReturnValue_t PlocMPSoCHandler::prepareTcFlashDelete(const uint8_t* commandData,
|
ReturnValue_t PlocMPSoCHandler::prepareTcFlashDelete(const uint8_t* commandData,
|
||||||
@ -434,126 +434,126 @@ ReturnValue_t PlocMPSoCHandler::prepareTcFlashDelete(const uint8_t* commandData,
|
|||||||
if (commandDataLen > config::MAX_PATH_SIZE + config::MAX_FILENAME_SIZE) {
|
if (commandDataLen > config::MAX_PATH_SIZE + config::MAX_FILENAME_SIZE) {
|
||||||
return MPSoCReturnValuesIF::NAME_TOO_LONG;
|
return MPSoCReturnValuesIF::NAME_TOO_LONG;
|
||||||
}
|
}
|
||||||
ReturnValue_t result = RETURN_OK;
|
ReturnValue_t result = returnvalue::OK;
|
||||||
sequenceCount++;
|
sequenceCount++;
|
||||||
mpsoc::TcFlashDelete tcFlashDelete(spParams, sequenceCount);
|
mpsoc::TcFlashDelete tcFlashDelete(spParams, sequenceCount);
|
||||||
result = tcFlashDelete.buildPacket(
|
result = tcFlashDelete.buildPacket(
|
||||||
std::string(reinterpret_cast<const char*>(commandData), commandDataLen));
|
std::string(reinterpret_cast<const char*>(commandData), commandDataLen));
|
||||||
if (result != RETURN_OK) {
|
if (result != returnvalue::OK) {
|
||||||
sequenceCount--;
|
sequenceCount--;
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
finishTcPrep(tcFlashDelete.getFullPacketLen());
|
finishTcPrep(tcFlashDelete.getFullPacketLen());
|
||||||
return RETURN_OK;
|
return returnvalue::OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
ReturnValue_t PlocMPSoCHandler::prepareTcReplayStart(const uint8_t* commandData,
|
ReturnValue_t PlocMPSoCHandler::prepareTcReplayStart(const uint8_t* commandData,
|
||||||
size_t commandDataLen) {
|
size_t commandDataLen) {
|
||||||
ReturnValue_t result = RETURN_OK;
|
ReturnValue_t result = returnvalue::OK;
|
||||||
sequenceCount++;
|
sequenceCount++;
|
||||||
mpsoc::TcReplayStart tcReplayStart(spParams, sequenceCount);
|
mpsoc::TcReplayStart tcReplayStart(spParams, sequenceCount);
|
||||||
result = tcReplayStart.buildPacket(commandData, commandDataLen);
|
result = tcReplayStart.buildPacket(commandData, commandDataLen);
|
||||||
if (result != RETURN_OK) {
|
if (result != returnvalue::OK) {
|
||||||
sequenceCount--;
|
sequenceCount--;
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
finishTcPrep(tcReplayStart.getFullPacketLen());
|
finishTcPrep(tcReplayStart.getFullPacketLen());
|
||||||
return RETURN_OK;
|
return returnvalue::OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
ReturnValue_t PlocMPSoCHandler::prepareTcReplayStop() {
|
ReturnValue_t PlocMPSoCHandler::prepareTcReplayStop() {
|
||||||
ReturnValue_t result = RETURN_OK;
|
ReturnValue_t result = returnvalue::OK;
|
||||||
sequenceCount++;
|
sequenceCount++;
|
||||||
mpsoc::TcReplayStop tcReplayStop(spParams, sequenceCount);
|
mpsoc::TcReplayStop tcReplayStop(spParams, sequenceCount);
|
||||||
result = tcReplayStop.buildPacket();
|
result = tcReplayStop.buildPacket();
|
||||||
if (result != RETURN_OK) {
|
if (result != returnvalue::OK) {
|
||||||
sequenceCount--;
|
sequenceCount--;
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
finishTcPrep(tcReplayStop.getFullPacketLen());
|
finishTcPrep(tcReplayStop.getFullPacketLen());
|
||||||
return RETURN_OK;
|
return returnvalue::OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
ReturnValue_t PlocMPSoCHandler::prepareTcDownlinkPwrOn(const uint8_t* commandData,
|
ReturnValue_t PlocMPSoCHandler::prepareTcDownlinkPwrOn(const uint8_t* commandData,
|
||||||
size_t commandDataLen) {
|
size_t commandDataLen) {
|
||||||
ReturnValue_t result = RETURN_OK;
|
ReturnValue_t result = returnvalue::OK;
|
||||||
sequenceCount++;
|
sequenceCount++;
|
||||||
mpsoc::TcDownlinkPwrOn tcDownlinkPwrOn(spParams, sequenceCount);
|
mpsoc::TcDownlinkPwrOn tcDownlinkPwrOn(spParams, sequenceCount);
|
||||||
result = tcDownlinkPwrOn.buildPacket(commandData, commandDataLen);
|
result = tcDownlinkPwrOn.buildPacket(commandData, commandDataLen);
|
||||||
if (result != RETURN_OK) {
|
if (result != returnvalue::OK) {
|
||||||
sequenceCount--;
|
sequenceCount--;
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
finishTcPrep(tcDownlinkPwrOn.getFullPacketLen());
|
finishTcPrep(tcDownlinkPwrOn.getFullPacketLen());
|
||||||
return RETURN_OK;
|
return returnvalue::OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
ReturnValue_t PlocMPSoCHandler::prepareTcDownlinkPwrOff() {
|
ReturnValue_t PlocMPSoCHandler::prepareTcDownlinkPwrOff() {
|
||||||
ReturnValue_t result = RETURN_OK;
|
ReturnValue_t result = returnvalue::OK;
|
||||||
sequenceCount++;
|
sequenceCount++;
|
||||||
mpsoc::TcDownlinkPwrOff tcDownlinkPwrOff(spParams, sequenceCount);
|
mpsoc::TcDownlinkPwrOff tcDownlinkPwrOff(spParams, sequenceCount);
|
||||||
result = tcDownlinkPwrOff.buildPacket();
|
result = tcDownlinkPwrOff.buildPacket();
|
||||||
if (result != RETURN_OK) {
|
if (result != returnvalue::OK) {
|
||||||
sequenceCount--;
|
sequenceCount--;
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
finishTcPrep(tcDownlinkPwrOff.getFullPacketLen());
|
finishTcPrep(tcDownlinkPwrOff.getFullPacketLen());
|
||||||
return RETURN_OK;
|
return returnvalue::OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
ReturnValue_t PlocMPSoCHandler::prepareTcReplayWriteSequence(const uint8_t* commandData,
|
ReturnValue_t PlocMPSoCHandler::prepareTcReplayWriteSequence(const uint8_t* commandData,
|
||||||
size_t commandDataLen) {
|
size_t commandDataLen) {
|
||||||
ReturnValue_t result = RETURN_OK;
|
ReturnValue_t result = returnvalue::OK;
|
||||||
sequenceCount++;
|
sequenceCount++;
|
||||||
mpsoc::TcReplayWriteSeq tcReplayWriteSeq(spParams, sequenceCount);
|
mpsoc::TcReplayWriteSeq tcReplayWriteSeq(spParams, sequenceCount);
|
||||||
result = tcReplayWriteSeq.buildPacket(commandData, commandDataLen);
|
result = tcReplayWriteSeq.buildPacket(commandData, commandDataLen);
|
||||||
if (result != RETURN_OK) {
|
if (result != returnvalue::OK) {
|
||||||
sequenceCount--;
|
sequenceCount--;
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
finishTcPrep(tcReplayWriteSeq.getFullPacketLen());
|
finishTcPrep(tcReplayWriteSeq.getFullPacketLen());
|
||||||
return RETURN_OK;
|
return returnvalue::OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
ReturnValue_t PlocMPSoCHandler::prepareTcModeReplay() {
|
ReturnValue_t PlocMPSoCHandler::prepareTcModeReplay() {
|
||||||
ReturnValue_t result = RETURN_OK;
|
ReturnValue_t result = returnvalue::OK;
|
||||||
sequenceCount++;
|
sequenceCount++;
|
||||||
mpsoc::TcModeReplay tcModeReplay(spParams, sequenceCount);
|
mpsoc::TcModeReplay tcModeReplay(spParams, sequenceCount);
|
||||||
result = tcModeReplay.buildPacket();
|
result = tcModeReplay.buildPacket();
|
||||||
if (result != RETURN_OK) {
|
if (result != returnvalue::OK) {
|
||||||
sequenceCount--;
|
sequenceCount--;
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
finishTcPrep(tcModeReplay.getFullPacketLen());
|
finishTcPrep(tcModeReplay.getFullPacketLen());
|
||||||
return RETURN_OK;
|
return returnvalue::OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
ReturnValue_t PlocMPSoCHandler::prepareTcModeIdle() {
|
ReturnValue_t PlocMPSoCHandler::prepareTcModeIdle() {
|
||||||
ReturnValue_t result = RETURN_OK;
|
ReturnValue_t result = returnvalue::OK;
|
||||||
sequenceCount++;
|
sequenceCount++;
|
||||||
mpsoc::TcModeIdle tcModeIdle(spParams, sequenceCount);
|
mpsoc::TcModeIdle tcModeIdle(spParams, sequenceCount);
|
||||||
result = tcModeIdle.buildPacket();
|
result = tcModeIdle.buildPacket();
|
||||||
if (result != RETURN_OK) {
|
if (result != returnvalue::OK) {
|
||||||
sequenceCount--;
|
sequenceCount--;
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
finishTcPrep(tcModeIdle.getFullPacketLen());
|
finishTcPrep(tcModeIdle.getFullPacketLen());
|
||||||
return RETURN_OK;
|
return returnvalue::OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
ReturnValue_t PlocMPSoCHandler::prepareTcCamCmdSend(const uint8_t* commandData,
|
ReturnValue_t PlocMPSoCHandler::prepareTcCamCmdSend(const uint8_t* commandData,
|
||||||
size_t commandDataLen) {
|
size_t commandDataLen) {
|
||||||
ReturnValue_t result = RETURN_OK;
|
ReturnValue_t result = returnvalue::OK;
|
||||||
sequenceCount++;
|
sequenceCount++;
|
||||||
mpsoc::TcCamcmdSend tcCamCmdSend(spParams, sequenceCount);
|
mpsoc::TcCamcmdSend tcCamCmdSend(spParams, sequenceCount);
|
||||||
result = tcCamCmdSend.buildPacket(commandData, commandDataLen);
|
result = tcCamCmdSend.buildPacket(commandData, commandDataLen);
|
||||||
if (result != RETURN_OK) {
|
if (result != returnvalue::OK) {
|
||||||
sequenceCount--;
|
sequenceCount--;
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
finishTcPrep(tcCamCmdSend.getFullPacketLen());
|
finishTcPrep(tcCamCmdSend.getFullPacketLen());
|
||||||
nextReplyId = mpsoc::TM_CAM_CMD_RPT;
|
nextReplyId = mpsoc::TM_CAM_CMD_RPT;
|
||||||
return RETURN_OK;
|
return returnvalue::OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
void PlocMPSoCHandler::finishTcPrep(size_t packetLen) {
|
void PlocMPSoCHandler::finishTcPrep(size_t packetLen) {
|
||||||
@ -566,11 +566,11 @@ ReturnValue_t PlocMPSoCHandler::verifyPacket(const uint8_t* start, size_t foundL
|
|||||||
if (CRC::crc16ccitt(start, foundLen) != 0) {
|
if (CRC::crc16ccitt(start, foundLen) != 0) {
|
||||||
return MPSoCReturnValuesIF::CRC_FAILURE;
|
return MPSoCReturnValuesIF::CRC_FAILURE;
|
||||||
}
|
}
|
||||||
return RETURN_OK;
|
return returnvalue::OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
ReturnValue_t PlocMPSoCHandler::handleAckReport(const uint8_t* data) {
|
ReturnValue_t PlocMPSoCHandler::handleAckReport(const uint8_t* data) {
|
||||||
ReturnValue_t result = RETURN_OK;
|
ReturnValue_t result = returnvalue::OK;
|
||||||
|
|
||||||
result = verifyPacket(data, mpsoc::SIZE_ACK_REPORT);
|
result = verifyPacket(data, mpsoc::SIZE_ACK_REPORT);
|
||||||
if (result == MPSoCReturnValuesIF::CRC_FAILURE) {
|
if (result == MPSoCReturnValuesIF::CRC_FAILURE) {
|
||||||
@ -606,7 +606,7 @@ ReturnValue_t PlocMPSoCHandler::handleAckReport(const uint8_t* data) {
|
|||||||
}
|
}
|
||||||
default: {
|
default: {
|
||||||
sif::debug << "PlocMPSoCHandler::handleAckReport: Invalid APID in Ack report" << std::endl;
|
sif::debug << "PlocMPSoCHandler::handleAckReport: Invalid APID in Ack report" << std::endl;
|
||||||
result = RETURN_FAILED;
|
result = returnvalue::FAILED;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -615,7 +615,7 @@ ReturnValue_t PlocMPSoCHandler::handleAckReport(const uint8_t* data) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
ReturnValue_t PlocMPSoCHandler::handleExecutionReport(const uint8_t* data) {
|
ReturnValue_t PlocMPSoCHandler::handleExecutionReport(const uint8_t* data) {
|
||||||
ReturnValue_t result = RETURN_OK;
|
ReturnValue_t result = returnvalue::OK;
|
||||||
|
|
||||||
result = verifyPacket(data, mpsoc::SIZE_EXE_REPORT);
|
result = verifyPacket(data, mpsoc::SIZE_EXE_REPORT);
|
||||||
if (result == MPSoCReturnValuesIF::CRC_FAILURE) {
|
if (result == MPSoCReturnValuesIF::CRC_FAILURE) {
|
||||||
@ -649,7 +649,7 @@ ReturnValue_t PlocMPSoCHandler::handleExecutionReport(const uint8_t* data) {
|
|||||||
}
|
}
|
||||||
default: {
|
default: {
|
||||||
sif::warning << "PlocMPSoCHandler::handleExecutionReport: Unknown APID" << std::endl;
|
sif::warning << "PlocMPSoCHandler::handleExecutionReport: Unknown APID" << std::endl;
|
||||||
result = RETURN_FAILED;
|
result = returnvalue::FAILED;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -658,7 +658,7 @@ ReturnValue_t PlocMPSoCHandler::handleExecutionReport(const uint8_t* data) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
ReturnValue_t PlocMPSoCHandler::handleMemoryReadReport(const uint8_t* data) {
|
ReturnValue_t PlocMPSoCHandler::handleMemoryReadReport(const uint8_t* data) {
|
||||||
ReturnValue_t result = RETURN_OK;
|
ReturnValue_t result = returnvalue::OK;
|
||||||
result = verifyPacket(data, tmMemReadReport.rememberRequestedSize);
|
result = verifyPacket(data, tmMemReadReport.rememberRequestedSize);
|
||||||
if (result == MPSoCReturnValuesIF::CRC_FAILURE) {
|
if (result == MPSoCReturnValuesIF::CRC_FAILURE) {
|
||||||
sif::warning << "PlocMPSoCHandler::handleMemoryReadReport: Memory read report has invalid crc"
|
sif::warning << "PlocMPSoCHandler::handleMemoryReadReport: Memory read report has invalid crc"
|
||||||
@ -674,7 +674,7 @@ ReturnValue_t PlocMPSoCHandler::handleMemoryReadReport(const uint8_t* data) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
ReturnValue_t PlocMPSoCHandler::handleCamCmdRpt(const uint8_t* data) {
|
ReturnValue_t PlocMPSoCHandler::handleCamCmdRpt(const uint8_t* data) {
|
||||||
ReturnValue_t result = RETURN_OK;
|
ReturnValue_t result = returnvalue::OK;
|
||||||
result = verifyPacket(data, tmCamCmdRpt.rememberSpacePacketSize);
|
result = verifyPacket(data, tmCamCmdRpt.rememberSpacePacketSize);
|
||||||
if (result == MPSoCReturnValuesIF::CRC_FAILURE) {
|
if (result == MPSoCReturnValuesIF::CRC_FAILURE) {
|
||||||
sif::warning << "PlocMPSoCHandler::handleCamCmdRpt: CRC failure" << std::endl;
|
sif::warning << "PlocMPSoCHandler::handleCamCmdRpt: CRC failure" << std::endl;
|
||||||
@ -698,7 +698,7 @@ ReturnValue_t PlocMPSoCHandler::handleCamCmdRpt(const uint8_t* data) {
|
|||||||
ReturnValue_t PlocMPSoCHandler::enableReplyInReplyMap(DeviceCommandMap::iterator command,
|
ReturnValue_t PlocMPSoCHandler::enableReplyInReplyMap(DeviceCommandMap::iterator command,
|
||||||
uint8_t expectedReplies, bool useAlternateId,
|
uint8_t expectedReplies, bool useAlternateId,
|
||||||
DeviceCommandId_t alternateReplyID) {
|
DeviceCommandId_t alternateReplyID) {
|
||||||
ReturnValue_t result = RETURN_OK;
|
ReturnValue_t result = returnvalue::OK;
|
||||||
|
|
||||||
uint8_t enabledReplies = 0;
|
uint8_t enabledReplies = 0;
|
||||||
|
|
||||||
@ -718,7 +718,7 @@ ReturnValue_t PlocMPSoCHandler::enableReplyInReplyMap(DeviceCommandMap::iterator
|
|||||||
enabledReplies = 3;
|
enabledReplies = 3;
|
||||||
result = DeviceHandlerBase::enableReplyInReplyMap(command, enabledReplies, true,
|
result = DeviceHandlerBase::enableReplyInReplyMap(command, enabledReplies, true,
|
||||||
mpsoc::TM_MEMORY_READ_REPORT);
|
mpsoc::TM_MEMORY_READ_REPORT);
|
||||||
if (result != RETURN_OK) {
|
if (result != returnvalue::OK) {
|
||||||
sif::debug << "PlocMPSoCHandler::enableReplyInReplyMap: Reply with id "
|
sif::debug << "PlocMPSoCHandler::enableReplyInReplyMap: Reply with id "
|
||||||
<< mpsoc::TM_MEMORY_READ_REPORT << " not in replyMap" << std::endl;
|
<< mpsoc::TM_MEMORY_READ_REPORT << " not in replyMap" << std::endl;
|
||||||
return result;
|
return result;
|
||||||
@ -729,7 +729,7 @@ ReturnValue_t PlocMPSoCHandler::enableReplyInReplyMap(DeviceCommandMap::iterator
|
|||||||
enabledReplies = 3;
|
enabledReplies = 3;
|
||||||
result = DeviceHandlerBase::enableReplyInReplyMap(command, enabledReplies, true,
|
result = DeviceHandlerBase::enableReplyInReplyMap(command, enabledReplies, true,
|
||||||
mpsoc::TM_CAM_CMD_RPT);
|
mpsoc::TM_CAM_CMD_RPT);
|
||||||
if (result != RETURN_OK) {
|
if (result != returnvalue::OK) {
|
||||||
sif::debug << "PlocMPSoCHandler::enableReplyInReplyMap: Reply with id "
|
sif::debug << "PlocMPSoCHandler::enableReplyInReplyMap: Reply with id "
|
||||||
<< mpsoc::TM_CAM_CMD_RPT << " not in replyMap" << std::endl;
|
<< mpsoc::TM_CAM_CMD_RPT << " not in replyMap" << std::endl;
|
||||||
return result;
|
return result;
|
||||||
@ -749,14 +749,14 @@ ReturnValue_t PlocMPSoCHandler::enableReplyInReplyMap(DeviceCommandMap::iterator
|
|||||||
*/
|
*/
|
||||||
result =
|
result =
|
||||||
DeviceHandlerBase::enableReplyInReplyMap(command, enabledReplies, true, mpsoc::ACK_REPORT);
|
DeviceHandlerBase::enableReplyInReplyMap(command, enabledReplies, true, mpsoc::ACK_REPORT);
|
||||||
if (result != RETURN_OK) {
|
if (result != returnvalue::OK) {
|
||||||
sif::debug << "PlocMPSoCHandler::enableReplyInReplyMap: Reply with id " << mpsoc::ACK_REPORT
|
sif::debug << "PlocMPSoCHandler::enableReplyInReplyMap: Reply with id " << mpsoc::ACK_REPORT
|
||||||
<< " not in replyMap" << std::endl;
|
<< " not in replyMap" << std::endl;
|
||||||
}
|
}
|
||||||
|
|
||||||
result =
|
result =
|
||||||
DeviceHandlerBase::enableReplyInReplyMap(command, enabledReplies, true, mpsoc::EXE_REPORT);
|
DeviceHandlerBase::enableReplyInReplyMap(command, enabledReplies, true, mpsoc::EXE_REPORT);
|
||||||
if (result != RETURN_OK) {
|
if (result != returnvalue::OK) {
|
||||||
sif::debug << "PlocMPSoCHandler::enableReplyInReplyMap: Reply with id " << mpsoc::EXE_REPORT
|
sif::debug << "PlocMPSoCHandler::enableReplyInReplyMap: Reply with id " << mpsoc::EXE_REPORT
|
||||||
<< " not in replyMap" << std::endl;
|
<< " not in replyMap" << std::endl;
|
||||||
}
|
}
|
||||||
@ -779,7 +779,7 @@ ReturnValue_t PlocMPSoCHandler::enableReplyInReplyMap(DeviceCommandMap::iterator
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
return RETURN_OK;
|
return returnvalue::OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
void PlocMPSoCHandler::setNextReplyId() {
|
void PlocMPSoCHandler::setNextReplyId() {
|
||||||
@ -833,9 +833,9 @@ size_t PlocMPSoCHandler::getNextReplyLength(DeviceCommandId_t commandId) {
|
|||||||
ReturnValue_t PlocMPSoCHandler::doSendReadHook() {
|
ReturnValue_t PlocMPSoCHandler::doSendReadHook() {
|
||||||
// Prevent DHB from polling UART during commands executed by the mpsoc helper task
|
// Prevent DHB from polling UART during commands executed by the mpsoc helper task
|
||||||
if (plocMPSoCHelperExecuting) {
|
if (plocMPSoCHelperExecuting) {
|
||||||
return RETURN_FAILED;
|
return returnvalue::FAILED;
|
||||||
}
|
}
|
||||||
return RETURN_OK;
|
return returnvalue::OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
MessageQueueIF* PlocMPSoCHandler::getCommandQueuePtr() { return commandActionHelperQueue; }
|
MessageQueueIF* PlocMPSoCHandler::getCommandQueuePtr() { return commandActionHelperQueue; }
|
||||||
@ -896,7 +896,7 @@ void PlocMPSoCHandler::completionFailedReceived(ActionId_t actionId, ReturnValue
|
|||||||
|
|
||||||
void PlocMPSoCHandler::handleDeviceTM(const uint8_t* data, size_t dataSize,
|
void PlocMPSoCHandler::handleDeviceTM(const uint8_t* data, size_t dataSize,
|
||||||
DeviceCommandId_t replyId) {
|
DeviceCommandId_t replyId) {
|
||||||
ReturnValue_t result = RETURN_OK;
|
ReturnValue_t result = returnvalue::OK;
|
||||||
|
|
||||||
if (wiretappingMode == RAW) {
|
if (wiretappingMode == RAW) {
|
||||||
/* Data already sent in doGetRead() */
|
/* Data already sent in doGetRead() */
|
||||||
@ -915,7 +915,7 @@ void PlocMPSoCHandler::handleDeviceTM(const uint8_t* data, size_t dataSize,
|
|||||||
}
|
}
|
||||||
|
|
||||||
result = actionHelper.reportData(queueId, replyId, data, dataSize);
|
result = actionHelper.reportData(queueId, replyId, data, dataSize);
|
||||||
if (result != RETURN_OK) {
|
if (result != returnvalue::OK) {
|
||||||
sif::debug << "PlocMPSoCHandler::handleDeviceTM: Failed to report data" << std::endl;
|
sif::debug << "PlocMPSoCHandler::handleDeviceTM: Failed to report data" << std::endl;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -180,7 +180,7 @@ class PlocMPSoCHandler : public DeviceHandlerBase, public CommandsActionsIF {
|
|||||||
* @param start Pointer to the first byte of the reply.
|
* @param start Pointer to the first byte of the reply.
|
||||||
* @param foundLen Pointer to the length of the whole packet.
|
* @param foundLen Pointer to the length of the whole packet.
|
||||||
*
|
*
|
||||||
* @return RETURN_OK if CRC is ok, otherwise CRC_FAILURE.
|
* @return returnvalue::OK if CRC is ok, otherwise CRC_FAILURE.
|
||||||
*/
|
*/
|
||||||
ReturnValue_t verifyPacket(const uint8_t* start, size_t foundLen);
|
ReturnValue_t verifyPacket(const uint8_t* start, size_t foundLen);
|
||||||
|
|
||||||
@ -189,7 +189,7 @@ class PlocMPSoCHandler : public DeviceHandlerBase, public CommandsActionsIF {
|
|||||||
*
|
*
|
||||||
* @param data Pointer to the data holding the acknowledgment report.
|
* @param data Pointer to the data holding the acknowledgment report.
|
||||||
*
|
*
|
||||||
* @return RETURN_OK if successful, otherwise an error code.
|
* @return returnvalue::OK if successful, otherwise an error code.
|
||||||
*/
|
*/
|
||||||
ReturnValue_t handleAckReport(const uint8_t* data);
|
ReturnValue_t handleAckReport(const uint8_t* data);
|
||||||
|
|
||||||
@ -198,7 +198,7 @@ class PlocMPSoCHandler : public DeviceHandlerBase, public CommandsActionsIF {
|
|||||||
*
|
*
|
||||||
* @param data Pointer to the received data packet.
|
* @param data Pointer to the received data packet.
|
||||||
*
|
*
|
||||||
* @return RETURN_OK if successful, otherwise an error code.
|
* @return returnvalue::OK if successful, otherwise an error code.
|
||||||
*/
|
*/
|
||||||
ReturnValue_t handleExecutionReport(const uint8_t* data);
|
ReturnValue_t handleExecutionReport(const uint8_t* data);
|
||||||
|
|
||||||
@ -207,7 +207,7 @@ class PlocMPSoCHandler : public DeviceHandlerBase, public CommandsActionsIF {
|
|||||||
*
|
*
|
||||||
* @param data Pointer to the data buffer holding the memory read report.
|
* @param data Pointer to the data buffer holding the memory read report.
|
||||||
*
|
*
|
||||||
* @return RETURN_OK if successful, otherwise an error code.
|
* @return returnvalue::OK if successful, otherwise an error code.
|
||||||
*/
|
*/
|
||||||
ReturnValue_t handleMemoryReadReport(const uint8_t* data);
|
ReturnValue_t handleMemoryReadReport(const uint8_t* data);
|
||||||
|
|
||||||
|
@ -24,14 +24,14 @@ ReturnValue_t PlocMPSoCHelper::initialize() {
|
|||||||
sdcMan = SdCardManager::instance();
|
sdcMan = SdCardManager::instance();
|
||||||
if (sdcMan == nullptr) {
|
if (sdcMan == nullptr) {
|
||||||
sif::warning << "PlocMPSoCHelper::initialize: Invalid SD Card Manager" << std::endl;
|
sif::warning << "PlocMPSoCHelper::initialize: Invalid SD Card Manager" << std::endl;
|
||||||
return RETURN_FAILED;
|
return returnvalue::FAILED;
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
return RETURN_OK;
|
return returnvalue::OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
ReturnValue_t PlocMPSoCHelper::performOperation(uint8_t operationCode) {
|
ReturnValue_t PlocMPSoCHelper::performOperation(uint8_t operationCode) {
|
||||||
ReturnValue_t result = RETURN_OK;
|
ReturnValue_t result = returnvalue::OK;
|
||||||
semaphore.acquire();
|
semaphore.acquire();
|
||||||
while (true) {
|
while (true) {
|
||||||
switch (internalState) {
|
switch (internalState) {
|
||||||
@ -41,7 +41,7 @@ ReturnValue_t PlocMPSoCHelper::performOperation(uint8_t operationCode) {
|
|||||||
}
|
}
|
||||||
case InternalState::FLASH_WRITE: {
|
case InternalState::FLASH_WRITE: {
|
||||||
result = performFlashWrite();
|
result = performFlashWrite();
|
||||||
if (result == RETURN_OK) {
|
if (result == returnvalue::OK) {
|
||||||
triggerEvent(MPSOC_FLASH_WRITE_SUCCESSFUL);
|
triggerEvent(MPSOC_FLASH_WRITE_SUCCESSFUL);
|
||||||
} else {
|
} else {
|
||||||
triggerEvent(MPSOC_FLASH_WRITE_FAILED);
|
triggerEvent(MPSOC_FLASH_WRITE_FAILED);
|
||||||
@ -60,9 +60,9 @@ ReturnValue_t PlocMPSoCHelper::setComIF(DeviceCommunicationIF* communicationInte
|
|||||||
uartComIF = dynamic_cast<UartComIF*>(communicationInterface_);
|
uartComIF = dynamic_cast<UartComIF*>(communicationInterface_);
|
||||||
if (uartComIF == nullptr) {
|
if (uartComIF == nullptr) {
|
||||||
sif::warning << "PlocMPSoCHelper::initialize: Invalid uart com if" << std::endl;
|
sif::warning << "PlocMPSoCHelper::initialize: Invalid uart com if" << std::endl;
|
||||||
return RETURN_FAILED;
|
return returnvalue::FAILED;
|
||||||
}
|
}
|
||||||
return RETURN_OK;
|
return returnvalue::OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
void PlocMPSoCHelper::setComCookie(CookieIF* comCookie_) { comCookie = comCookie_; }
|
void PlocMPSoCHelper::setComCookie(CookieIF* comCookie_) { comCookie = comCookie_; }
|
||||||
@ -72,14 +72,14 @@ void PlocMPSoCHelper::setSequenceCount(SourceSequenceCounter* sequenceCount_) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
ReturnValue_t PlocMPSoCHelper::startFlashWrite(std::string obcFile, std::string mpsocFile) {
|
ReturnValue_t PlocMPSoCHelper::startFlashWrite(std::string obcFile, std::string mpsocFile) {
|
||||||
ReturnValue_t result = RETURN_OK;
|
ReturnValue_t result = returnvalue::OK;
|
||||||
#ifdef XIPHOS_Q7S
|
#ifdef XIPHOS_Q7S
|
||||||
result = FilesystemHelper::checkPath(obcFile);
|
result = FilesystemHelper::checkPath(obcFile);
|
||||||
if (result != RETURN_OK) {
|
if (result != returnvalue::OK) {
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
result = FilesystemHelper::fileExists(mpsocFile);
|
result = FilesystemHelper::fileExists(mpsocFile);
|
||||||
if (result != RETURN_OK) {
|
if (result != returnvalue::OK) {
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
@ -87,7 +87,7 @@ ReturnValue_t PlocMPSoCHelper::startFlashWrite(std::string obcFile, std::string
|
|||||||
if (not std::filesystem::exists(obcFile)) {
|
if (not std::filesystem::exists(obcFile)) {
|
||||||
sif::warning << "PlocMPSoCHelper::startFlashWrite: File " << obcFile << "does not exist"
|
sif::warning << "PlocMPSoCHelper::startFlashWrite: File " << obcFile << "does not exist"
|
||||||
<< std::endl;
|
<< std::endl;
|
||||||
return RETURN_FAILED;
|
return returnvalue::FAILED;
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
@ -95,14 +95,14 @@ ReturnValue_t PlocMPSoCHelper::startFlashWrite(std::string obcFile, std::string
|
|||||||
flashWrite.mpsocFile = mpsocFile;
|
flashWrite.mpsocFile = mpsocFile;
|
||||||
internalState = InternalState::FLASH_WRITE;
|
internalState = InternalState::FLASH_WRITE;
|
||||||
result = resetHelper();
|
result = resetHelper();
|
||||||
if (result != RETURN_OK) {
|
if (result != returnvalue::OK) {
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
ReturnValue_t PlocMPSoCHelper::resetHelper() {
|
ReturnValue_t PlocMPSoCHelper::resetHelper() {
|
||||||
ReturnValue_t result = RETURN_OK;
|
ReturnValue_t result = returnvalue::OK;
|
||||||
semaphore.release();
|
semaphore.release();
|
||||||
spParams.buf = commandBuffer;
|
spParams.buf = commandBuffer;
|
||||||
terminate = false;
|
terminate = false;
|
||||||
@ -113,9 +113,9 @@ ReturnValue_t PlocMPSoCHelper::resetHelper() {
|
|||||||
void PlocMPSoCHelper::stopProcess() { terminate = true; }
|
void PlocMPSoCHelper::stopProcess() { terminate = true; }
|
||||||
|
|
||||||
ReturnValue_t PlocMPSoCHelper::performFlashWrite() {
|
ReturnValue_t PlocMPSoCHelper::performFlashWrite() {
|
||||||
ReturnValue_t result = RETURN_OK;
|
ReturnValue_t result = returnvalue::OK;
|
||||||
result = flashfopen();
|
result = flashfopen();
|
||||||
if (result != RETURN_OK) {
|
if (result != returnvalue::OK) {
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
uint8_t tempData[mpsoc::MAX_DATA_SIZE];
|
uint8_t tempData[mpsoc::MAX_DATA_SIZE];
|
||||||
@ -128,7 +128,7 @@ ReturnValue_t PlocMPSoCHelper::performFlashWrite() {
|
|||||||
size_t bytesRead = 0;
|
size_t bytesRead = 0;
|
||||||
while (remainingSize > 0) {
|
while (remainingSize > 0) {
|
||||||
if (terminate) {
|
if (terminate) {
|
||||||
return RETURN_OK;
|
return returnvalue::OK;
|
||||||
}
|
}
|
||||||
if (remainingSize > mpsoc::MAX_DATA_SIZE) {
|
if (remainingSize > mpsoc::MAX_DATA_SIZE) {
|
||||||
dataLength = mpsoc::MAX_DATA_SIZE;
|
dataLength = mpsoc::MAX_DATA_SIZE;
|
||||||
@ -146,74 +146,74 @@ ReturnValue_t PlocMPSoCHelper::performFlashWrite() {
|
|||||||
(*sequenceCount)++;
|
(*sequenceCount)++;
|
||||||
mpsoc::TcFlashWrite tc(spParams, *sequenceCount);
|
mpsoc::TcFlashWrite tc(spParams, *sequenceCount);
|
||||||
result = tc.buildPacket(tempData, dataLength);
|
result = tc.buildPacket(tempData, dataLength);
|
||||||
if (result != RETURN_OK) {
|
if (result != returnvalue::OK) {
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
result = handlePacketTransmission(tc);
|
result = handlePacketTransmission(tc);
|
||||||
if (result != RETURN_OK) {
|
if (result != returnvalue::OK) {
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
result = flashfclose();
|
result = flashfclose();
|
||||||
if (result != RETURN_OK) {
|
if (result != returnvalue::OK) {
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
ReturnValue_t PlocMPSoCHelper::flashfopen() {
|
ReturnValue_t PlocMPSoCHelper::flashfopen() {
|
||||||
ReturnValue_t result = RETURN_OK;
|
ReturnValue_t result = returnvalue::OK;
|
||||||
spParams.buf = commandBuffer;
|
spParams.buf = commandBuffer;
|
||||||
(*sequenceCount)++;
|
(*sequenceCount)++;
|
||||||
mpsoc::FlashFopen flashFopen(spParams, *sequenceCount);
|
mpsoc::FlashFopen flashFopen(spParams, *sequenceCount);
|
||||||
result = flashFopen.createPacket(flashWrite.mpsocFile, mpsoc::FlashFopen::APPEND);
|
result = flashFopen.createPacket(flashWrite.mpsocFile, mpsoc::FlashFopen::APPEND);
|
||||||
if (result != RETURN_OK) {
|
if (result != returnvalue::OK) {
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
result = handlePacketTransmission(flashFopen);
|
result = handlePacketTransmission(flashFopen);
|
||||||
if (result != RETURN_OK) {
|
if (result != returnvalue::OK) {
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
return RETURN_OK;
|
return returnvalue::OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
ReturnValue_t PlocMPSoCHelper::flashfclose() {
|
ReturnValue_t PlocMPSoCHelper::flashfclose() {
|
||||||
ReturnValue_t result = RETURN_OK;
|
ReturnValue_t result = returnvalue::OK;
|
||||||
spParams.buf = commandBuffer;
|
spParams.buf = commandBuffer;
|
||||||
(*sequenceCount)++;
|
(*sequenceCount)++;
|
||||||
mpsoc::FlashFclose flashFclose(spParams, *sequenceCount);
|
mpsoc::FlashFclose flashFclose(spParams, *sequenceCount);
|
||||||
result = flashFclose.createPacket(flashWrite.mpsocFile);
|
result = flashFclose.createPacket(flashWrite.mpsocFile);
|
||||||
if (result != RETURN_OK) {
|
if (result != returnvalue::OK) {
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
result = handlePacketTransmission(flashFclose);
|
result = handlePacketTransmission(flashFclose);
|
||||||
if (result != RETURN_OK) {
|
if (result != returnvalue::OK) {
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
return RETURN_OK;
|
return returnvalue::OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
ReturnValue_t PlocMPSoCHelper::handlePacketTransmission(ploc::SpTcBase& tc) {
|
ReturnValue_t PlocMPSoCHelper::handlePacketTransmission(ploc::SpTcBase& tc) {
|
||||||
ReturnValue_t result = RETURN_OK;
|
ReturnValue_t result = returnvalue::OK;
|
||||||
result = sendCommand(tc);
|
result = sendCommand(tc);
|
||||||
if (result != RETURN_OK) {
|
if (result != returnvalue::OK) {
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
result = handleAck();
|
result = handleAck();
|
||||||
if (result != RETURN_OK) {
|
if (result != returnvalue::OK) {
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
result = handleExe();
|
result = handleExe();
|
||||||
if (result != RETURN_OK) {
|
if (result != returnvalue::OK) {
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
return RETURN_OK;
|
return returnvalue::OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
ReturnValue_t PlocMPSoCHelper::sendCommand(ploc::SpTcBase& tc) {
|
ReturnValue_t PlocMPSoCHelper::sendCommand(ploc::SpTcBase& tc) {
|
||||||
ReturnValue_t result = RETURN_OK;
|
ReturnValue_t result = returnvalue::OK;
|
||||||
result = uartComIF->sendMessage(comCookie, tc.getFullPacket(), tc.getFullPacketLen());
|
result = uartComIF->sendMessage(comCookie, tc.getFullPacket(), tc.getFullPacketLen());
|
||||||
if (result != RETURN_OK) {
|
if (result != returnvalue::OK) {
|
||||||
sif::warning << "PlocMPSoCHelper::sendCommand: Failed to send command" << std::endl;
|
sif::warning << "PlocMPSoCHelper::sendCommand: Failed to send command" << std::endl;
|
||||||
triggerEvent(MPSOC_SENDING_COMMAND_FAILED, result, static_cast<uint32_t>(internalState));
|
triggerEvent(MPSOC_SENDING_COMMAND_FAILED, result, static_cast<uint32_t>(internalState));
|
||||||
return result;
|
return result;
|
||||||
@ -222,22 +222,22 @@ ReturnValue_t PlocMPSoCHelper::sendCommand(ploc::SpTcBase& tc) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
ReturnValue_t PlocMPSoCHelper::handleAck() {
|
ReturnValue_t PlocMPSoCHelper::handleAck() {
|
||||||
ReturnValue_t result = RETURN_OK;
|
ReturnValue_t result = returnvalue::OK;
|
||||||
result = handleTmReception(mpsoc::SIZE_ACK_REPORT);
|
result = handleTmReception(mpsoc::SIZE_ACK_REPORT);
|
||||||
if (result != RETURN_OK) {
|
if (result != returnvalue::OK) {
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
SpTmReader tmPacket(tmBuf.data(), tmBuf.size());
|
SpTmReader tmPacket(tmBuf.data(), tmBuf.size());
|
||||||
result = checkReceivedTm(tmPacket);
|
result = checkReceivedTm(tmPacket);
|
||||||
if (result != RETURN_OK) {
|
if (result != returnvalue::OK) {
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
uint16_t apid = tmPacket.getApid();
|
uint16_t apid = tmPacket.getApid();
|
||||||
if (apid != mpsoc::apid::ACK_SUCCESS) {
|
if (apid != mpsoc::apid::ACK_SUCCESS) {
|
||||||
handleAckApidFailure(apid);
|
handleAckApidFailure(apid);
|
||||||
return RETURN_FAILED;
|
return returnvalue::FAILED;
|
||||||
}
|
}
|
||||||
return RETURN_OK;
|
return returnvalue::OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
void PlocMPSoCHelper::handleAckApidFailure(uint16_t apid) {
|
void PlocMPSoCHelper::handleAckApidFailure(uint16_t apid) {
|
||||||
@ -253,23 +253,23 @@ void PlocMPSoCHelper::handleAckApidFailure(uint16_t apid) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
ReturnValue_t PlocMPSoCHelper::handleExe() {
|
ReturnValue_t PlocMPSoCHelper::handleExe() {
|
||||||
ReturnValue_t result = RETURN_OK;
|
ReturnValue_t result = returnvalue::OK;
|
||||||
|
|
||||||
result = handleTmReception(mpsoc::SIZE_EXE_REPORT);
|
result = handleTmReception(mpsoc::SIZE_EXE_REPORT);
|
||||||
if (result != RETURN_OK) {
|
if (result != returnvalue::OK) {
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
ploc::SpTmReader tmPacket(tmBuf.data(), tmBuf.size());
|
ploc::SpTmReader tmPacket(tmBuf.data(), tmBuf.size());
|
||||||
result = checkReceivedTm(tmPacket);
|
result = checkReceivedTm(tmPacket);
|
||||||
if (result != RETURN_OK) {
|
if (result != returnvalue::OK) {
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
uint16_t apid = tmPacket.getApid();
|
uint16_t apid = tmPacket.getApid();
|
||||||
if (apid != mpsoc::apid::EXE_SUCCESS) {
|
if (apid != mpsoc::apid::EXE_SUCCESS) {
|
||||||
handleExeApidFailure(apid);
|
handleExeApidFailure(apid);
|
||||||
return RETURN_FAILED;
|
return returnvalue::FAILED;
|
||||||
}
|
}
|
||||||
return RETURN_OK;
|
return returnvalue::OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
void PlocMPSoCHelper::handleExeApidFailure(uint16_t apid) {
|
void PlocMPSoCHelper::handleExeApidFailure(uint16_t apid) {
|
||||||
@ -285,12 +285,12 @@ void PlocMPSoCHelper::handleExeApidFailure(uint16_t apid) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
ReturnValue_t PlocMPSoCHelper::handleTmReception(size_t remainingBytes) {
|
ReturnValue_t PlocMPSoCHelper::handleTmReception(size_t remainingBytes) {
|
||||||
ReturnValue_t result = RETURN_OK;
|
ReturnValue_t result = returnvalue::OK;
|
||||||
size_t readBytes = 0;
|
size_t readBytes = 0;
|
||||||
size_t currentBytes = 0;
|
size_t currentBytes = 0;
|
||||||
for (int retries = 0; retries < RETRIES; retries++) {
|
for (int retries = 0; retries < RETRIES; retries++) {
|
||||||
result = receive(tmBuf.data() + readBytes, ¤tBytes, remainingBytes);
|
result = receive(tmBuf.data() + readBytes, ¤tBytes, remainingBytes);
|
||||||
if (result != RETURN_OK) {
|
if (result != returnvalue::OK) {
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
readBytes += currentBytes;
|
readBytes += currentBytes;
|
||||||
@ -302,21 +302,21 @@ ReturnValue_t PlocMPSoCHelper::handleTmReception(size_t remainingBytes) {
|
|||||||
if (remainingBytes != 0) {
|
if (remainingBytes != 0) {
|
||||||
sif::warning << "PlocMPSoCHelper::handleTmReception: Failed to receive reply" << std::endl;
|
sif::warning << "PlocMPSoCHelper::handleTmReception: Failed to receive reply" << std::endl;
|
||||||
triggerEvent(MPSOC_MISSING_EXE, remainingBytes, static_cast<uint32_t>(internalState));
|
triggerEvent(MPSOC_MISSING_EXE, remainingBytes, static_cast<uint32_t>(internalState));
|
||||||
return RETURN_FAILED;
|
return returnvalue::FAILED;
|
||||||
}
|
}
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
ReturnValue_t PlocMPSoCHelper::checkReceivedTm(SpTmReader& reader) {
|
ReturnValue_t PlocMPSoCHelper::checkReceivedTm(SpTmReader& reader) {
|
||||||
ReturnValue_t result = reader.checkSize();
|
ReturnValue_t result = reader.checkSize();
|
||||||
if (result != RETURN_OK) {
|
if (result != returnvalue::OK) {
|
||||||
sif::error << "PlocMPSoCHelper::handleTmReception: Size check on received TM failed"
|
sif::error << "PlocMPSoCHelper::handleTmReception: Size check on received TM failed"
|
||||||
<< std::endl;
|
<< std::endl;
|
||||||
triggerEvent(MPSOC_TM_SIZE_ERROR);
|
triggerEvent(MPSOC_TM_SIZE_ERROR);
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
reader.checkCrc();
|
reader.checkCrc();
|
||||||
if (result != RETURN_OK) {
|
if (result != returnvalue::OK) {
|
||||||
sif::warning << "PlocMPSoCHelper::handleTmReception: CRC check failed" << std::endl;
|
sif::warning << "PlocMPSoCHelper::handleTmReception: CRC check failed" << std::endl;
|
||||||
triggerEvent(MPSOC_TM_CRC_MISSMATCH, *sequenceCount);
|
triggerEvent(MPSOC_TM_CRC_MISSMATCH, *sequenceCount);
|
||||||
return result;
|
return result;
|
||||||
@ -327,24 +327,24 @@ ReturnValue_t PlocMPSoCHelper::checkReceivedTm(SpTmReader& reader) {
|
|||||||
triggerEvent(MPSOC_HELPER_SEQ_CNT_MISMATCH, *sequenceCount, recvSeqCnt);
|
triggerEvent(MPSOC_HELPER_SEQ_CNT_MISMATCH, *sequenceCount, recvSeqCnt);
|
||||||
*sequenceCount = recvSeqCnt;
|
*sequenceCount = recvSeqCnt;
|
||||||
}
|
}
|
||||||
return RETURN_OK;
|
return returnvalue::OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
ReturnValue_t PlocMPSoCHelper::receive(uint8_t* data, size_t* readBytes, size_t requestBytes) {
|
ReturnValue_t PlocMPSoCHelper::receive(uint8_t* data, size_t* readBytes, size_t requestBytes) {
|
||||||
ReturnValue_t result = RETURN_OK;
|
ReturnValue_t result = returnvalue::OK;
|
||||||
uint8_t* buffer = nullptr;
|
uint8_t* buffer = nullptr;
|
||||||
result = uartComIF->requestReceiveMessage(comCookie, requestBytes);
|
result = uartComIF->requestReceiveMessage(comCookie, requestBytes);
|
||||||
if (result != RETURN_OK) {
|
if (result != returnvalue::OK) {
|
||||||
sif::warning << "PlocMPSoCHelper::receive: Failed to request reply" << std::endl;
|
sif::warning << "PlocMPSoCHelper::receive: Failed to request reply" << std::endl;
|
||||||
triggerEvent(MPSOC_HELPER_REQUESTING_REPLY_FAILED, result,
|
triggerEvent(MPSOC_HELPER_REQUESTING_REPLY_FAILED, result,
|
||||||
static_cast<uint32_t>(static_cast<uint32_t>(internalState)));
|
static_cast<uint32_t>(static_cast<uint32_t>(internalState)));
|
||||||
return RETURN_FAILED;
|
return returnvalue::FAILED;
|
||||||
}
|
}
|
||||||
result = uartComIF->readReceivedMessage(comCookie, &buffer, readBytes);
|
result = uartComIF->readReceivedMessage(comCookie, &buffer, readBytes);
|
||||||
if (result != RETURN_OK) {
|
if (result != returnvalue::OK) {
|
||||||
sif::warning << "PlocMPSoCHelper::receive: Failed to read received message" << std::endl;
|
sif::warning << "PlocMPSoCHelper::receive: Failed to read received message" << std::endl;
|
||||||
triggerEvent(MPSOC_HELPER_READING_REPLY_FAILED, result, static_cast<uint32_t>(internalState));
|
triggerEvent(MPSOC_HELPER_READING_REPLY_FAILED, result, static_cast<uint32_t>(internalState));
|
||||||
return RETURN_FAILED;
|
return returnvalue::FAILED;
|
||||||
}
|
}
|
||||||
if (*readBytes > 0) {
|
if (*readBytes > 0) {
|
||||||
std::memcpy(data, buffer, *readBytes);
|
std::memcpy(data, buffer, *readBytes);
|
||||||
|
@ -6,7 +6,7 @@
|
|||||||
#include "fsfw/devicehandlers/CookieIF.h"
|
#include "fsfw/devicehandlers/CookieIF.h"
|
||||||
#include "fsfw/objectmanager/SystemObject.h"
|
#include "fsfw/objectmanager/SystemObject.h"
|
||||||
#include "fsfw/osal/linux/BinarySemaphore.h"
|
#include "fsfw/osal/linux/BinarySemaphore.h"
|
||||||
#include "fsfw/returnvalues/HasReturnvaluesIF.h"
|
#include "fsfw/returnvalues/returnvalue.h"
|
||||||
#include "fsfw/tasks/ExecutableObjectIF.h"
|
#include "fsfw/tasks/ExecutableObjectIF.h"
|
||||||
#include "fsfw/tmtcservices/SourceSequenceCounter.h"
|
#include "fsfw/tmtcservices/SourceSequenceCounter.h"
|
||||||
#include "fsfw_hal/linux/uart/UartComIF.h"
|
#include "fsfw_hal/linux/uart/UartComIF.h"
|
||||||
@ -20,7 +20,7 @@
|
|||||||
* MPSoC and OBC.
|
* MPSoC and OBC.
|
||||||
* @author J. Meier
|
* @author J. Meier
|
||||||
*/
|
*/
|
||||||
class PlocMPSoCHelper : public SystemObject, public ExecutableObjectIF, public HasReturnvaluesIF {
|
class PlocMPSoCHelper : public SystemObject, public ExecutableObjectIF {
|
||||||
public:
|
public:
|
||||||
static const uint8_t SUBSYSTEM_ID = SUBSYSTEM_ID::PLOC_MPSOC_HELPER;
|
static const uint8_t SUBSYSTEM_ID = SUBSYSTEM_ID::PLOC_MPSOC_HELPER;
|
||||||
|
|
||||||
@ -85,7 +85,7 @@ class PlocMPSoCHelper : public SystemObject, public ExecutableObjectIF, public H
|
|||||||
* @param obcFile File where to read from the data
|
* @param obcFile File where to read from the data
|
||||||
* @param mpsocFile The file of the MPSoC where should be written to
|
* @param mpsocFile The file of the MPSoC where should be written to
|
||||||
*
|
*
|
||||||
* @return RETURN_OK if successful, otherwise error return value
|
* @return returnvalue::OK if successful, otherwise error return value
|
||||||
*/
|
*/
|
||||||
ReturnValue_t startFlashWrite(std::string obcFile, std::string mpsocFile);
|
ReturnValue_t startFlashWrite(std::string obcFile, std::string mpsocFile);
|
||||||
|
|
||||||
|
@ -19,25 +19,25 @@ 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 != returnvalue::OK) {
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
result = commandActionHelper.initialize();
|
result = commandActionHelper.initialize();
|
||||||
if (result != HasReturnvaluesIF::RETURN_OK) {
|
if (result != returnvalue::OK) {
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
result = actionHelper.initialize(commandQueue);
|
result = actionHelper.initialize(commandQueue);
|
||||||
if (result != HasReturnvaluesIF::RETURN_OK) {
|
if (result != returnvalue::OK) {
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
return HasReturnvaluesIF::RETURN_OK;
|
return returnvalue::OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
ReturnValue_t PlocMemoryDumper::performOperation(uint8_t operationCode) {
|
ReturnValue_t PlocMemoryDumper::performOperation(uint8_t operationCode) {
|
||||||
readCommandQueue();
|
readCommandQueue();
|
||||||
doStateMachine();
|
doStateMachine();
|
||||||
return HasReturnvaluesIF::RETURN_OK;
|
return returnvalue::OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
ReturnValue_t PlocMemoryDumper::executeAction(ActionId_t actionId, MessageQueueId_t commandedBy,
|
ReturnValue_t PlocMemoryDumper::executeAction(ActionId_t actionId, MessageQueueId_t commandedBy,
|
||||||
@ -78,20 +78,20 @@ MessageQueueIF* PlocMemoryDumper::getCommandQueuePtr() { return commandQueue; }
|
|||||||
|
|
||||||
void PlocMemoryDumper::readCommandQueue() {
|
void PlocMemoryDumper::readCommandQueue() {
|
||||||
CommandMessage message;
|
CommandMessage message;
|
||||||
ReturnValue_t result = RETURN_OK;
|
ReturnValue_t result = returnvalue::OK;
|
||||||
|
|
||||||
for (result = commandQueue->receiveMessage(&message); result == HasReturnvaluesIF::RETURN_OK;
|
for (result = commandQueue->receiveMessage(&message); result == returnvalue::OK;
|
||||||
result = commandQueue->receiveMessage(&message)) {
|
result = commandQueue->receiveMessage(&message)) {
|
||||||
if (result != RETURN_OK) {
|
if (result != returnvalue::OK) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
result = actionHelper.handleActionMessage(&message);
|
result = actionHelper.handleActionMessage(&message);
|
||||||
if (result == HasReturnvaluesIF::RETURN_OK) {
|
if (result == returnvalue::OK) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
result = commandActionHelper.handleReply(&message);
|
result = commandActionHelper.handleReply(&message);
|
||||||
if (result == HasReturnvaluesIF::RETURN_OK) {
|
if (result == returnvalue::OK) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -161,7 +161,7 @@ void PlocMemoryDumper::completionFailedReceived(ActionId_t actionId, ReturnValue
|
|||||||
}
|
}
|
||||||
|
|
||||||
void PlocMemoryDumper::commandNextMramDump(ActionId_t dumpCommand) {
|
void PlocMemoryDumper::commandNextMramDump(ActionId_t dumpCommand) {
|
||||||
ReturnValue_t result = RETURN_OK;
|
ReturnValue_t result = returnvalue::OK;
|
||||||
|
|
||||||
uint32_t tempStartAddress = 0;
|
uint32_t tempStartAddress = 0;
|
||||||
uint32_t tempEndAddress = 0;
|
uint32_t tempEndAddress = 0;
|
||||||
@ -181,7 +181,7 @@ void PlocMemoryDumper::commandNextMramDump(ActionId_t dumpCommand) {
|
|||||||
|
|
||||||
result =
|
result =
|
||||||
commandActionHelper.commandAction(objects::PLOC_SUPERVISOR_HANDLER, dumpCommand, ¶ms);
|
commandActionHelper.commandAction(objects::PLOC_SUPERVISOR_HANDLER, dumpCommand, ¶ms);
|
||||||
if (result != RETURN_OK) {
|
if (result != returnvalue::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 "
|
||||||
<< tempEndAddress << std::endl;
|
<< tempEndAddress << std::endl;
|
||||||
|
@ -11,7 +11,7 @@
|
|||||||
#include "fsfw/action/CommandsActionsIF.h"
|
#include "fsfw/action/CommandsActionsIF.h"
|
||||||
#include "fsfw/action/HasActionsIF.h"
|
#include "fsfw/action/HasActionsIF.h"
|
||||||
#include "fsfw/objectmanager/SystemObject.h"
|
#include "fsfw/objectmanager/SystemObject.h"
|
||||||
#include "fsfw/returnvalues/HasReturnvaluesIF.h"
|
#include "fsfw/returnvalues/returnvalue.h"
|
||||||
#include "fsfw/tasks/ExecutableObjectIF.h"
|
#include "fsfw/tasks/ExecutableObjectIF.h"
|
||||||
#include "linux/fsfwconfig/objects/systemObjectList.h"
|
#include "linux/fsfwconfig/objects/systemObjectList.h"
|
||||||
|
|
||||||
@ -26,7 +26,6 @@
|
|||||||
class PlocMemoryDumper : public SystemObject,
|
class PlocMemoryDumper : public SystemObject,
|
||||||
public HasActionsIF,
|
public HasActionsIF,
|
||||||
public ExecutableObjectIF,
|
public ExecutableObjectIF,
|
||||||
public HasReturnvaluesIF,
|
|
||||||
public CommandsActionsIF {
|
public CommandsActionsIF {
|
||||||
public:
|
public:
|
||||||
static const ActionId_t NONE = 0;
|
static const ActionId_t NONE = 0;
|
||||||
|
File diff suppressed because it is too large
Load Diff
@ -171,7 +171,7 @@ class PlocSupervisorHandler : public DeviceHandlerBase {
|
|||||||
* @param start Pointer to the first byte of the reply.
|
* @param start Pointer to the first byte of the reply.
|
||||||
* @param foundLen Pointer to the length of the whole packet.
|
* @param foundLen Pointer to the length of the whole packet.
|
||||||
*
|
*
|
||||||
* @return RETURN_OK if CRC is ok, otherwise CRC_FAILURE.
|
* @return returnvalue::OK if CRC is ok, otherwise CRC_FAILURE.
|
||||||
*/
|
*/
|
||||||
ReturnValue_t verifyPacket(const uint8_t* start, size_t foundLen);
|
ReturnValue_t verifyPacket(const uint8_t* start, size_t foundLen);
|
||||||
|
|
||||||
@ -180,7 +180,7 @@ class PlocSupervisorHandler : public DeviceHandlerBase {
|
|||||||
*
|
*
|
||||||
* @param data Pointer to the data holding the acknowledgment report.
|
* @param data Pointer to the data holding the acknowledgment report.
|
||||||
*
|
*
|
||||||
* @return RETURN_OK if successful, otherwise an error code.
|
* @return returnvalue::OK if successful, otherwise an error code.
|
||||||
*/
|
*/
|
||||||
ReturnValue_t handleAckReport(const uint8_t* data);
|
ReturnValue_t handleAckReport(const uint8_t* data);
|
||||||
|
|
||||||
@ -189,7 +189,7 @@ class PlocSupervisorHandler : public DeviceHandlerBase {
|
|||||||
*
|
*
|
||||||
* @param data Pointer to the received data packet.
|
* @param data Pointer to the received data packet.
|
||||||
*
|
*
|
||||||
* @return RETURN_OK if successful, otherwise an error code.
|
* @return returnvalue::OK if successful, otherwise an error code.
|
||||||
*/
|
*/
|
||||||
ReturnValue_t handleExecutionReport(const uint8_t* data);
|
ReturnValue_t handleExecutionReport(const uint8_t* data);
|
||||||
|
|
||||||
@ -199,7 +199,7 @@ class PlocSupervisorHandler : public DeviceHandlerBase {
|
|||||||
*
|
*
|
||||||
* @param data Pointer to the data buffer holding the housekeeping read report.
|
* @param data Pointer to the data buffer holding the housekeeping read report.
|
||||||
*
|
*
|
||||||
* @return RETURN_OK if successful, otherwise an error code.
|
* @return returnvalue::OK if successful, otherwise an error code.
|
||||||
*/
|
*/
|
||||||
ReturnValue_t handleHkReport(const uint8_t* data);
|
ReturnValue_t handleHkReport(const uint8_t* data);
|
||||||
|
|
||||||
|
@ -30,14 +30,14 @@ ReturnValue_t PlocSupvHelper::initialize() {
|
|||||||
sdcMan = SdCardManager::instance();
|
sdcMan = SdCardManager::instance();
|
||||||
if (sdcMan == nullptr) {
|
if (sdcMan == nullptr) {
|
||||||
sif::warning << "PlocSupvHelper::initialize: Invalid SD Card Manager" << std::endl;
|
sif::warning << "PlocSupvHelper::initialize: Invalid SD Card Manager" << std::endl;
|
||||||
return RETURN_FAILED;
|
return returnvalue::FAILED;
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
return RETURN_OK;
|
return returnvalue::OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
ReturnValue_t PlocSupvHelper::performOperation(uint8_t operationCode) {
|
ReturnValue_t PlocSupvHelper::performOperation(uint8_t operationCode) {
|
||||||
ReturnValue_t result = RETURN_OK;
|
ReturnValue_t result = returnvalue::OK;
|
||||||
semaphore.acquire();
|
semaphore.acquire();
|
||||||
while (true) {
|
while (true) {
|
||||||
switch (internalState) {
|
switch (internalState) {
|
||||||
@ -47,7 +47,7 @@ ReturnValue_t PlocSupvHelper::performOperation(uint8_t operationCode) {
|
|||||||
}
|
}
|
||||||
case InternalState::UPDATE: {
|
case InternalState::UPDATE: {
|
||||||
result = executeUpdate();
|
result = executeUpdate();
|
||||||
if (result == RETURN_OK) {
|
if (result == returnvalue::OK) {
|
||||||
triggerEvent(SUPV_UPDATE_SUCCESSFUL, result);
|
triggerEvent(SUPV_UPDATE_SUCCESSFUL, result);
|
||||||
} else if (result == PROCESS_TERMINATED) {
|
} else if (result == PROCESS_TERMINATED) {
|
||||||
// Event already triggered
|
// Event already triggered
|
||||||
@ -64,7 +64,7 @@ ReturnValue_t PlocSupvHelper::performOperation(uint8_t operationCode) {
|
|||||||
}
|
}
|
||||||
case InternalState::CONTINUE_UPDATE: {
|
case InternalState::CONTINUE_UPDATE: {
|
||||||
result = continueUpdate();
|
result = continueUpdate();
|
||||||
if (result == RETURN_OK) {
|
if (result == returnvalue::OK) {
|
||||||
triggerEvent(SUPV_CONTINUE_UPDATE_SUCCESSFUL, result);
|
triggerEvent(SUPV_CONTINUE_UPDATE_SUCCESSFUL, result);
|
||||||
} else if (result == PROCESS_TERMINATED) {
|
} else if (result == PROCESS_TERMINATED) {
|
||||||
// Event already triggered
|
// Event already triggered
|
||||||
@ -76,7 +76,7 @@ ReturnValue_t PlocSupvHelper::performOperation(uint8_t operationCode) {
|
|||||||
}
|
}
|
||||||
case InternalState::REQUEST_EVENT_BUFFER: {
|
case InternalState::REQUEST_EVENT_BUFFER: {
|
||||||
result = performEventBufferRequest();
|
result = performEventBufferRequest();
|
||||||
if (result == RETURN_OK) {
|
if (result == returnvalue::OK) {
|
||||||
triggerEvent(SUPV_EVENT_BUFFER_REQUEST_SUCCESSFUL, result);
|
triggerEvent(SUPV_EVENT_BUFFER_REQUEST_SUCCESSFUL, result);
|
||||||
} else if (result == PROCESS_TERMINATED) {
|
} else if (result == PROCESS_TERMINATED) {
|
||||||
// Event already triggered
|
// Event already triggered
|
||||||
@ -97,10 +97,10 @@ ReturnValue_t PlocSupvHelper::performOperation(uint8_t operationCode) {
|
|||||||
ReturnValue_t PlocSupvHelper::setComIF(UartComIF* uartComIF_) {
|
ReturnValue_t PlocSupvHelper::setComIF(UartComIF* uartComIF_) {
|
||||||
if (uartComIF_ == nullptr) {
|
if (uartComIF_ == nullptr) {
|
||||||
sif::warning << "PlocSupvHelper::initialize: Provided invalid uart com if" << std::endl;
|
sif::warning << "PlocSupvHelper::initialize: Provided invalid uart com if" << std::endl;
|
||||||
return RETURN_FAILED;
|
return returnvalue::FAILED;
|
||||||
}
|
}
|
||||||
uartComIF = uartComIF_;
|
uartComIF = uartComIF_;
|
||||||
return RETURN_OK;
|
return returnvalue::OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
void PlocSupvHelper::setComCookie(CookieIF* comCookie_) { comCookie = comCookie_; }
|
void PlocSupvHelper::setComCookie(CookieIF* comCookie_) { comCookie = comCookie_; }
|
||||||
@ -118,16 +118,16 @@ ReturnValue_t PlocSupvHelper::startUpdate(std::string file, uint8_t memoryId,
|
|||||||
}
|
}
|
||||||
|
|
||||||
ReturnValue_t PlocSupvHelper::performUpdate(const supv::UpdateParams& params) {
|
ReturnValue_t PlocSupvHelper::performUpdate(const supv::UpdateParams& params) {
|
||||||
ReturnValue_t result = RETURN_OK;
|
ReturnValue_t result = returnvalue::OK;
|
||||||
#ifdef XIPHOS_Q7S
|
#ifdef XIPHOS_Q7S
|
||||||
result = FilesystemHelper::checkPath(params.file);
|
result = FilesystemHelper::checkPath(params.file);
|
||||||
if (result != RETURN_OK) {
|
if (result != returnvalue::OK) {
|
||||||
sif::warning << "PlocSupvHelper::startUpdate: File " << params.file << " does not exist"
|
sif::warning << "PlocSupvHelper::startUpdate: File " << params.file << " does not exist"
|
||||||
<< std::endl;
|
<< std::endl;
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
result = FilesystemHelper::fileExists(params.file);
|
result = FilesystemHelper::fileExists(params.file);
|
||||||
if (result != RETURN_OK) {
|
if (result != returnvalue::OK) {
|
||||||
sif::warning << "PlocSupvHelper::startUpdate: The file " << params.file << " does not exist"
|
sif::warning << "PlocSupvHelper::startUpdate: The file " << params.file << " does not exist"
|
||||||
<< std::endl;
|
<< std::endl;
|
||||||
return result;
|
return result;
|
||||||
@ -137,7 +137,7 @@ ReturnValue_t PlocSupvHelper::performUpdate(const supv::UpdateParams& params) {
|
|||||||
if (not std::filesystem::exists(file)) {
|
if (not std::filesystem::exists(file)) {
|
||||||
sif::warning << "PlocSupvHelper::startUpdate: The file " << file << " does not exist"
|
sif::warning << "PlocSupvHelper::startUpdate: The file " << file << " does not exist"
|
||||||
<< std::endl;
|
<< std::endl;
|
||||||
return RETURN_FAILED;
|
return returnvalue::FAILED;
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
update.file = params.file;
|
update.file = params.file;
|
||||||
@ -145,7 +145,7 @@ ReturnValue_t PlocSupvHelper::performUpdate(const supv::UpdateParams& params) {
|
|||||||
if (params.bytesWritten > update.fullFileSize) {
|
if (params.bytesWritten > update.fullFileSize) {
|
||||||
sif::warning << "Invalid start bytes counter " << params.bytesWritten
|
sif::warning << "Invalid start bytes counter " << params.bytesWritten
|
||||||
<< ", smaller than full file length" << update.fullFileSize << std::endl;
|
<< ", smaller than full file length" << update.fullFileSize << std::endl;
|
||||||
return HasReturnvaluesIF::RETURN_FAILED;
|
return returnvalue::FAILED;
|
||||||
}
|
}
|
||||||
update.length = update.fullFileSize - params.bytesWritten;
|
update.length = update.fullFileSize - params.bytesWritten;
|
||||||
update.memoryId = params.memId;
|
update.memoryId = params.memId;
|
||||||
@ -178,7 +178,7 @@ ReturnValue_t PlocSupvHelper::performMemCheck(uint8_t memoryId, uint32_t startAd
|
|||||||
internalState = InternalState::CHECK_MEMORY;
|
internalState = InternalState::CHECK_MEMORY;
|
||||||
uartComIF->flushUartTxAndRxBuf(comCookie);
|
uartComIF->flushUartTxAndRxBuf(comCookie);
|
||||||
semaphore.release();
|
semaphore.release();
|
||||||
return HasReturnvaluesIF::RETURN_OK;
|
return returnvalue::OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
void PlocSupvHelper::initiateUpdateContinuation() {
|
void PlocSupvHelper::initiateUpdateContinuation() {
|
||||||
@ -189,7 +189,7 @@ void PlocSupvHelper::initiateUpdateContinuation() {
|
|||||||
ReturnValue_t PlocSupvHelper::startEventbBufferRequest(std::string path) {
|
ReturnValue_t PlocSupvHelper::startEventbBufferRequest(std::string path) {
|
||||||
#ifdef XIPHOS_Q7S
|
#ifdef XIPHOS_Q7S
|
||||||
ReturnValue_t result = FilesystemHelper::checkPath(path);
|
ReturnValue_t result = FilesystemHelper::checkPath(path);
|
||||||
if (result != RETURN_OK) {
|
if (result != returnvalue::OK) {
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
@ -200,7 +200,7 @@ ReturnValue_t PlocSupvHelper::startEventbBufferRequest(std::string path) {
|
|||||||
internalState = InternalState::REQUEST_EVENT_BUFFER;
|
internalState = InternalState::REQUEST_EVENT_BUFFER;
|
||||||
uartComIF->flushUartTxAndRxBuf(comCookie);
|
uartComIF->flushUartTxAndRxBuf(comCookie);
|
||||||
semaphore.release();
|
semaphore.release();
|
||||||
return RETURN_OK;
|
return returnvalue::OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
void PlocSupvHelper::stopProcess() { terminate = true; }
|
void PlocSupvHelper::stopProcess() { terminate = true; }
|
||||||
@ -210,26 +210,26 @@ void PlocSupvHelper::executeFullCheckMemoryCommand() {
|
|||||||
if (update.crcShouldBeChecked) {
|
if (update.crcShouldBeChecked) {
|
||||||
sif::info << "PLOC SUPV Mem Check: Calculating Image CRC" << std::endl;
|
sif::info << "PLOC SUPV Mem Check: Calculating Image CRC" << std::endl;
|
||||||
result = calcImageCrc();
|
result = calcImageCrc();
|
||||||
if (result != RETURN_OK) {
|
if (result != returnvalue::OK) {
|
||||||
triggerEvent(SUPV_MEM_CHECK_FAIL, result);
|
triggerEvent(SUPV_MEM_CHECK_FAIL, result);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
sif::info << "PLOC SUPV Mem Check: Selecting Memory" << std::endl;
|
sif::info << "PLOC SUPV Mem Check: Selecting Memory" << std::endl;
|
||||||
result = selectMemory();
|
result = selectMemory();
|
||||||
if (result != RETURN_OK) {
|
if (result != returnvalue::OK) {
|
||||||
triggerEvent(SUPV_MEM_CHECK_FAIL, result);
|
triggerEvent(SUPV_MEM_CHECK_FAIL, result);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
sif::info << "PLOC SUPV Mem Check: Preparing Update" << std::endl;
|
sif::info << "PLOC SUPV Mem Check: Preparing Update" << std::endl;
|
||||||
result = prepareUpdate();
|
result = prepareUpdate();
|
||||||
if (result != RETURN_OK) {
|
if (result != returnvalue::OK) {
|
||||||
triggerEvent(SUPV_MEM_CHECK_FAIL, result);
|
triggerEvent(SUPV_MEM_CHECK_FAIL, result);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
sif::info << "PLOC SUPV Mem Check: Memory Check" << std::endl;
|
sif::info << "PLOC SUPV Mem Check: Memory Check" << std::endl;
|
||||||
result = handleCheckMemoryCommand();
|
result = handleCheckMemoryCommand();
|
||||||
if (result == HasReturnvaluesIF::RETURN_OK) {
|
if (result == returnvalue::OK) {
|
||||||
triggerEvent(SUPV_MEM_CHECK_OK, result);
|
triggerEvent(SUPV_MEM_CHECK_OK, result);
|
||||||
} else {
|
} else {
|
||||||
triggerEvent(SUPV_MEM_CHECK_FAIL, result);
|
triggerEvent(SUPV_MEM_CHECK_FAIL, result);
|
||||||
@ -237,26 +237,26 @@ void PlocSupvHelper::executeFullCheckMemoryCommand() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
ReturnValue_t PlocSupvHelper::executeUpdate() {
|
ReturnValue_t PlocSupvHelper::executeUpdate() {
|
||||||
ReturnValue_t result = RETURN_OK;
|
ReturnValue_t result = returnvalue::OK;
|
||||||
sif::info << "PLOC SUPV Update MPSoC: Calculating Image CRC" << std::endl;
|
sif::info << "PLOC SUPV Update MPSoC: Calculating Image CRC" << std::endl;
|
||||||
result = calcImageCrc();
|
result = calcImageCrc();
|
||||||
if (result != RETURN_OK) {
|
if (result != returnvalue::OK) {
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
sif::info << "PLOC SUPV Update MPSoC: Selecting Memory" << std::endl;
|
sif::info << "PLOC SUPV Update MPSoC: Selecting Memory" << std::endl;
|
||||||
result = selectMemory();
|
result = selectMemory();
|
||||||
if (result != RETURN_OK) {
|
if (result != returnvalue::OK) {
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
sif::info << "PLOC SUPV Update MPSoC: Preparing Update" << std::endl;
|
sif::info << "PLOC SUPV Update MPSoC: Preparing Update" << std::endl;
|
||||||
result = prepareUpdate();
|
result = prepareUpdate();
|
||||||
if (result != RETURN_OK) {
|
if (result != returnvalue::OK) {
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
if (update.deleteMemory) {
|
if (update.deleteMemory) {
|
||||||
sif::info << "PLOC SUPV Update MPSoC: Erasing Memory" << std::endl;
|
sif::info << "PLOC SUPV Update MPSoC: Erasing Memory" << std::endl;
|
||||||
result = eraseMemory();
|
result = eraseMemory();
|
||||||
if (result != RETURN_OK) {
|
if (result != returnvalue::OK) {
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -265,7 +265,7 @@ ReturnValue_t PlocSupvHelper::executeUpdate() {
|
|||||||
|
|
||||||
ReturnValue_t PlocSupvHelper::continueUpdate() {
|
ReturnValue_t PlocSupvHelper::continueUpdate() {
|
||||||
ReturnValue_t result = prepareUpdate();
|
ReturnValue_t result = prepareUpdate();
|
||||||
if (result != RETURN_OK) {
|
if (result != returnvalue::OK) {
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
return updateOperation();
|
return updateOperation();
|
||||||
@ -274,7 +274,7 @@ ReturnValue_t PlocSupvHelper::continueUpdate() {
|
|||||||
ReturnValue_t PlocSupvHelper::updateOperation() {
|
ReturnValue_t PlocSupvHelper::updateOperation() {
|
||||||
sif::info << "PlocSupvHelper::performUpdate: Writing Update Packets" << std::endl;
|
sif::info << "PlocSupvHelper::performUpdate: Writing Update Packets" << std::endl;
|
||||||
auto result = writeUpdatePackets();
|
auto result = writeUpdatePackets();
|
||||||
if (result != RETURN_OK) {
|
if (result != returnvalue::OK) {
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
sif::info << "PlocSupvHelper::performUpdate: Memory Check" << std::endl;
|
sif::info << "PlocSupvHelper::performUpdate: Memory Check" << std::endl;
|
||||||
@ -282,7 +282,7 @@ ReturnValue_t PlocSupvHelper::updateOperation() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
ReturnValue_t PlocSupvHelper::writeUpdatePackets() {
|
ReturnValue_t PlocSupvHelper::writeUpdatePackets() {
|
||||||
ReturnValue_t result = RETURN_OK;
|
ReturnValue_t result = returnvalue::OK;
|
||||||
#if OBSW_DEBUG_PLOC_SUPERVISOR == 1
|
#if OBSW_DEBUG_PLOC_SUPERVISOR == 1
|
||||||
ProgressPrinter progressPrinter("Supervisor update", update.fullFileSize,
|
ProgressPrinter progressPrinter("Supervisor update", update.fullFileSize,
|
||||||
ProgressPrinter::HALF_PERCENT);
|
ProgressPrinter::HALF_PERCENT);
|
||||||
@ -338,13 +338,13 @@ ReturnValue_t PlocSupvHelper::writeUpdatePackets() {
|
|||||||
supv::WriteMemory packet(spParams);
|
supv::WriteMemory packet(spParams);
|
||||||
result = packet.buildPacket(seqFlags, update.sequenceCount, update.memoryId,
|
result = packet.buildPacket(seqFlags, update.sequenceCount, update.memoryId,
|
||||||
update.startAddress + update.bytesWritten, dataLength, tempData);
|
update.startAddress + update.bytesWritten, dataLength, tempData);
|
||||||
if (result != RETURN_OK) {
|
if (result != returnvalue::OK) {
|
||||||
triggerEvent(WRITE_MEMORY_FAILED, buildProgParams1(progPercent, update.sequenceCount),
|
triggerEvent(WRITE_MEMORY_FAILED, buildProgParams1(progPercent, update.sequenceCount),
|
||||||
update.bytesWritten);
|
update.bytesWritten);
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
result = handlePacketTransmission(packet);
|
result = handlePacketTransmission(packet);
|
||||||
if (result != RETURN_OK) {
|
if (result != returnvalue::OK) {
|
||||||
triggerEvent(WRITE_MEMORY_FAILED, buildProgParams1(progPercent, update.sequenceCount),
|
triggerEvent(WRITE_MEMORY_FAILED, buildProgParams1(progPercent, update.sequenceCount),
|
||||||
update.bytesWritten);
|
update.bytesWritten);
|
||||||
return result;
|
return result;
|
||||||
@ -366,24 +366,24 @@ uint32_t PlocSupvHelper::buildProgParams1(uint8_t percent, uint16_t seqCount) {
|
|||||||
|
|
||||||
ReturnValue_t PlocSupvHelper::performEventBufferRequest() {
|
ReturnValue_t PlocSupvHelper::performEventBufferRequest() {
|
||||||
using namespace supv;
|
using namespace supv;
|
||||||
ReturnValue_t result = RETURN_OK;
|
ReturnValue_t result = returnvalue::OK;
|
||||||
resetSpParams();
|
resetSpParams();
|
||||||
RequestLoggingData packet(spParams);
|
RequestLoggingData packet(spParams);
|
||||||
result = packet.buildPacket(RequestLoggingData::Sa::REQUEST_EVENT_BUFFERS);
|
result = packet.buildPacket(RequestLoggingData::Sa::REQUEST_EVENT_BUFFERS);
|
||||||
if (result != RETURN_OK) {
|
if (result != returnvalue::OK) {
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
result = sendCommand(packet);
|
result = sendCommand(packet);
|
||||||
if (result != RETURN_OK) {
|
if (result != returnvalue::OK) {
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
result = handleAck();
|
result = handleAck();
|
||||||
if (result != RETURN_OK) {
|
if (result != returnvalue::OK) {
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
result =
|
result =
|
||||||
handleTmReception(ccsds::HEADER_LEN, tmBuf.data(), supv::recv_timeout::UPDATE_STATUS_REPORT);
|
handleTmReception(ccsds::HEADER_LEN, tmBuf.data(), supv::recv_timeout::UPDATE_STATUS_REPORT);
|
||||||
if (result != RETURN_OK) {
|
if (result != returnvalue::OK) {
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
ploc::SpTmReader spReader(tmBuf.data(), tmBuf.size());
|
ploc::SpTmReader spReader(tmBuf.data(), tmBuf.size());
|
||||||
@ -397,7 +397,7 @@ ReturnValue_t PlocSupvHelper::performEventBufferRequest() {
|
|||||||
|
|
||||||
if (not exeAlreadyReceived) {
|
if (not exeAlreadyReceived) {
|
||||||
result = handleExe();
|
result = handleExe();
|
||||||
if (result != RETURN_OK) {
|
if (result != returnvalue::OK) {
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -407,85 +407,85 @@ ReturnValue_t PlocSupvHelper::performEventBufferRequest() {
|
|||||||
ReturnValue_t PlocSupvHelper::handleRemainingExeReport(ploc::SpTmReader& reader) {
|
ReturnValue_t PlocSupvHelper::handleRemainingExeReport(ploc::SpTmReader& reader) {
|
||||||
size_t remBytes = reader.getPacketDataLen() + 1;
|
size_t remBytes = reader.getPacketDataLen() + 1;
|
||||||
ReturnValue_t result = handleTmReception(remBytes, tmBuf.data() + ccsds::HEADER_LEN);
|
ReturnValue_t result = handleTmReception(remBytes, tmBuf.data() + ccsds::HEADER_LEN);
|
||||||
if (result != HasReturnvaluesIF::RETURN_OK) {
|
if (result != returnvalue::OK) {
|
||||||
sif::warning << "Reading exe failure report failed" << std::endl;
|
sif::warning << "Reading exe failure report failed" << std::endl;
|
||||||
}
|
}
|
||||||
result = exeReportHandling();
|
result = exeReportHandling();
|
||||||
if (result != HasReturnvaluesIF::RETURN_OK) {
|
if (result != returnvalue::OK) {
|
||||||
sif::warning << "Handling exe report failed" << std::endl;
|
sif::warning << "Handling exe report failed" << std::endl;
|
||||||
}
|
}
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
ReturnValue_t PlocSupvHelper::selectMemory() {
|
ReturnValue_t PlocSupvHelper::selectMemory() {
|
||||||
ReturnValue_t result = RETURN_OK;
|
ReturnValue_t result = returnvalue::OK;
|
||||||
resetSpParams();
|
resetSpParams();
|
||||||
supv::MPSoCBootSelect packet(spParams);
|
supv::MPSoCBootSelect packet(spParams);
|
||||||
result = packet.buildPacket(update.memoryId);
|
result = packet.buildPacket(update.memoryId);
|
||||||
if (result != RETURN_OK) {
|
if (result != returnvalue::OK) {
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
result = handlePacketTransmission(packet);
|
result = handlePacketTransmission(packet);
|
||||||
if (result != RETURN_OK) {
|
if (result != returnvalue::OK) {
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
return RETURN_OK;
|
return returnvalue::OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
ReturnValue_t PlocSupvHelper::prepareUpdate() {
|
ReturnValue_t PlocSupvHelper::prepareUpdate() {
|
||||||
ReturnValue_t result = RETURN_OK;
|
ReturnValue_t result = returnvalue::OK;
|
||||||
resetSpParams();
|
resetSpParams();
|
||||||
supv::ApidOnlyPacket packet(spParams, supv::APID_PREPARE_UPDATE);
|
supv::ApidOnlyPacket packet(spParams, supv::APID_PREPARE_UPDATE);
|
||||||
result = packet.buildPacket();
|
result = packet.buildPacket();
|
||||||
if (result != RETURN_OK) {
|
if (result != returnvalue::OK) {
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
result = handlePacketTransmission(packet, PREPARE_UPDATE_EXECUTION_REPORT);
|
result = handlePacketTransmission(packet, PREPARE_UPDATE_EXECUTION_REPORT);
|
||||||
if (result != RETURN_OK) {
|
if (result != returnvalue::OK) {
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
return RETURN_OK;
|
return returnvalue::OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
ReturnValue_t PlocSupvHelper::eraseMemory() {
|
ReturnValue_t PlocSupvHelper::eraseMemory() {
|
||||||
ReturnValue_t result = RETURN_OK;
|
ReturnValue_t result = returnvalue::OK;
|
||||||
resetSpParams();
|
resetSpParams();
|
||||||
supv::EraseMemory eraseMemory(spParams);
|
supv::EraseMemory eraseMemory(spParams);
|
||||||
result = eraseMemory.buildPacket(update.memoryId, update.startAddress + update.bytesWritten,
|
result = eraseMemory.buildPacket(update.memoryId, update.startAddress + update.bytesWritten,
|
||||||
update.length);
|
update.length);
|
||||||
if (result != RETURN_OK) {
|
if (result != returnvalue::OK) {
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
result = handlePacketTransmission(eraseMemory, supv::recv_timeout::ERASE_MEMORY);
|
result = handlePacketTransmission(eraseMemory, supv::recv_timeout::ERASE_MEMORY);
|
||||||
if (result != RETURN_OK) {
|
if (result != returnvalue::OK) {
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
return RETURN_OK;
|
return returnvalue::OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
ReturnValue_t PlocSupvHelper::handlePacketTransmission(ploc::SpTcBase& packet,
|
ReturnValue_t PlocSupvHelper::handlePacketTransmission(ploc::SpTcBase& packet,
|
||||||
uint32_t timeoutExecutionReport) {
|
uint32_t timeoutExecutionReport) {
|
||||||
ReturnValue_t result = RETURN_OK;
|
ReturnValue_t result = returnvalue::OK;
|
||||||
result = sendCommand(packet);
|
result = sendCommand(packet);
|
||||||
if (result != RETURN_OK) {
|
if (result != returnvalue::OK) {
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
result = handleAck();
|
result = handleAck();
|
||||||
if (result != RETURN_OK) {
|
if (result != returnvalue::OK) {
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
result = handleExe(timeoutExecutionReport);
|
result = handleExe(timeoutExecutionReport);
|
||||||
if (result != RETURN_OK) {
|
if (result != returnvalue::OK) {
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
return RETURN_OK;
|
return returnvalue::OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
ReturnValue_t PlocSupvHelper::sendCommand(ploc::SpTcBase& packet) {
|
ReturnValue_t PlocSupvHelper::sendCommand(ploc::SpTcBase& packet) {
|
||||||
ReturnValue_t result = RETURN_OK;
|
ReturnValue_t result = returnvalue::OK;
|
||||||
rememberApid = packet.getApid();
|
rememberApid = packet.getApid();
|
||||||
result = uartComIF->sendMessage(comCookie, packet.getFullPacket(), packet.getFullPacketLen());
|
result = uartComIF->sendMessage(comCookie, packet.getFullPacket(), packet.getFullPacketLen());
|
||||||
if (result != RETURN_OK) {
|
if (result != returnvalue::OK) {
|
||||||
sif::warning << "PlocSupvHelper::sendCommand: Failed to send command" << std::endl;
|
sif::warning << "PlocSupvHelper::sendCommand: Failed to send command" << std::endl;
|
||||||
triggerEvent(SUPV_SENDING_COMMAND_FAILED, result, static_cast<uint32_t>(internalState));
|
triggerEvent(SUPV_SENDING_COMMAND_FAILED, result, static_cast<uint32_t>(internalState));
|
||||||
return result;
|
return result;
|
||||||
@ -494,10 +494,10 @@ ReturnValue_t PlocSupvHelper::sendCommand(ploc::SpTcBase& packet) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
ReturnValue_t PlocSupvHelper::handleAck() {
|
ReturnValue_t PlocSupvHelper::handleAck() {
|
||||||
ReturnValue_t result = RETURN_OK;
|
ReturnValue_t result = returnvalue::OK;
|
||||||
|
|
||||||
result = handleTmReception(supv::SIZE_ACK_REPORT);
|
result = handleTmReception(supv::SIZE_ACK_REPORT);
|
||||||
if (result != RETURN_OK) {
|
if (result != returnvalue::OK) {
|
||||||
triggerEvent(ACK_RECEPTION_FAILURE, result, static_cast<uint32_t>(rememberApid));
|
triggerEvent(ACK_RECEPTION_FAILURE, result, static_cast<uint32_t>(rememberApid));
|
||||||
sif::warning << "PlocSupvHelper::handleAck: Error in reception of acknowledgment report"
|
sif::warning << "PlocSupvHelper::handleAck: Error in reception of acknowledgment report"
|
||||||
<< std::endl;
|
<< std::endl;
|
||||||
@ -505,11 +505,11 @@ ReturnValue_t PlocSupvHelper::handleAck() {
|
|||||||
}
|
}
|
||||||
supv::AcknowledgmentReport ackReport(tmBuf.data(), tmBuf.size());
|
supv::AcknowledgmentReport ackReport(tmBuf.data(), tmBuf.size());
|
||||||
result = checkReceivedTm(ackReport);
|
result = checkReceivedTm(ackReport);
|
||||||
if (result != RETURN_OK) {
|
if (result != returnvalue::OK) {
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
result = ackReport.checkApid();
|
result = ackReport.checkApid();
|
||||||
if (result != RETURN_OK) {
|
if (result != returnvalue::OK) {
|
||||||
if (result == SupvReturnValuesIF::RECEIVED_ACK_FAILURE) {
|
if (result == SupvReturnValuesIF::RECEIVED_ACK_FAILURE) {
|
||||||
triggerEvent(SUPV_ACK_FAILURE_REPORT, static_cast<uint32_t>(ackReport.getRefApid()));
|
triggerEvent(SUPV_ACK_FAILURE_REPORT, static_cast<uint32_t>(ackReport.getRefApid()));
|
||||||
} else if (result == SupvReturnValuesIF::INVALID_APID) {
|
} else if (result == SupvReturnValuesIF::INVALID_APID) {
|
||||||
@ -517,14 +517,14 @@ ReturnValue_t PlocSupvHelper::handleAck() {
|
|||||||
}
|
}
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
return RETURN_OK;
|
return returnvalue::OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
ReturnValue_t PlocSupvHelper::handleExe(uint32_t timeout) {
|
ReturnValue_t PlocSupvHelper::handleExe(uint32_t timeout) {
|
||||||
ReturnValue_t result = RETURN_OK;
|
ReturnValue_t result = returnvalue::OK;
|
||||||
|
|
||||||
result = handleTmReception(supv::SIZE_EXE_REPORT, tmBuf.data(), timeout);
|
result = handleTmReception(supv::SIZE_EXE_REPORT, tmBuf.data(), timeout);
|
||||||
if (result != RETURN_OK) {
|
if (result != returnvalue::OK) {
|
||||||
triggerEvent(EXE_RECEPTION_FAILURE, result, static_cast<uint32_t>(rememberApid));
|
triggerEvent(EXE_RECEPTION_FAILURE, result, static_cast<uint32_t>(rememberApid));
|
||||||
sif::warning << "PlocSupvHelper::handleExe: Error in reception of execution report"
|
sif::warning << "PlocSupvHelper::handleExe: Error in reception of execution report"
|
||||||
<< std::endl;
|
<< std::endl;
|
||||||
@ -538,11 +538,11 @@ ReturnValue_t PlocSupvHelper::exeReportHandling() {
|
|||||||
supv::ExecutionReport exeReport(tmBuf.data(), tmBuf.size());
|
supv::ExecutionReport exeReport(tmBuf.data(), tmBuf.size());
|
||||||
|
|
||||||
ReturnValue_t result = checkReceivedTm(exeReport);
|
ReturnValue_t result = checkReceivedTm(exeReport);
|
||||||
if (result != RETURN_OK) {
|
if (result != returnvalue::OK) {
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
result = exeReport.checkApid();
|
result = exeReport.checkApid();
|
||||||
if (result != RETURN_OK) {
|
if (result != returnvalue::OK) {
|
||||||
if (result == SupvReturnValuesIF::RECEIVED_EXE_FAILURE) {
|
if (result == SupvReturnValuesIF::RECEIVED_EXE_FAILURE) {
|
||||||
triggerEvent(SUPV_EXE_FAILURE_REPORT, static_cast<uint32_t>(exeReport.getRefApid()));
|
triggerEvent(SUPV_EXE_FAILURE_REPORT, static_cast<uint32_t>(exeReport.getRefApid()));
|
||||||
} else if (result == SupvReturnValuesIF::INVALID_APID) {
|
} else if (result == SupvReturnValuesIF::INVALID_APID) {
|
||||||
@ -555,7 +555,7 @@ ReturnValue_t PlocSupvHelper::exeReportHandling() {
|
|||||||
|
|
||||||
ReturnValue_t PlocSupvHelper::handleTmReception(size_t remainingBytes, uint8_t* readBuf,
|
ReturnValue_t PlocSupvHelper::handleTmReception(size_t remainingBytes, uint8_t* readBuf,
|
||||||
uint32_t timeout) {
|
uint32_t timeout) {
|
||||||
ReturnValue_t result = RETURN_OK;
|
ReturnValue_t result = returnvalue::OK;
|
||||||
size_t readBytes = 0;
|
size_t readBytes = 0;
|
||||||
size_t currentBytes = 0;
|
size_t currentBytes = 0;
|
||||||
Countdown countdown(timeout);
|
Countdown countdown(timeout);
|
||||||
@ -564,7 +564,7 @@ ReturnValue_t PlocSupvHelper::handleTmReception(size_t remainingBytes, uint8_t*
|
|||||||
}
|
}
|
||||||
while (!countdown.hasTimedOut()) {
|
while (!countdown.hasTimedOut()) {
|
||||||
result = receive(readBuf + readBytes, ¤tBytes, remainingBytes);
|
result = receive(readBuf + readBytes, ¤tBytes, remainingBytes);
|
||||||
if (result != RETURN_OK) {
|
if (result != returnvalue::OK) {
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
readBytes += currentBytes;
|
readBytes += currentBytes;
|
||||||
@ -576,19 +576,19 @@ ReturnValue_t PlocSupvHelper::handleTmReception(size_t remainingBytes, uint8_t*
|
|||||||
if (remainingBytes != 0) {
|
if (remainingBytes != 0) {
|
||||||
sif::warning << "PlocSupvHelper::handleTmReception: Failed to read " << std::dec
|
sif::warning << "PlocSupvHelper::handleTmReception: Failed to read " << std::dec
|
||||||
<< remainingBytes << " remaining bytes" << std::endl;
|
<< remainingBytes << " remaining bytes" << std::endl;
|
||||||
return RETURN_FAILED;
|
return returnvalue::FAILED;
|
||||||
}
|
}
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
ReturnValue_t PlocSupvHelper::checkReceivedTm(ploc::SpTmReader& reader) {
|
ReturnValue_t PlocSupvHelper::checkReceivedTm(ploc::SpTmReader& reader) {
|
||||||
ReturnValue_t result = reader.checkSize();
|
ReturnValue_t result = reader.checkSize();
|
||||||
if (result != RETURN_OK) {
|
if (result != returnvalue::OK) {
|
||||||
triggerEvent(SUPV_REPLY_SIZE_MISSMATCH, rememberApid);
|
triggerEvent(SUPV_REPLY_SIZE_MISSMATCH, rememberApid);
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
result = reader.checkCrc();
|
result = reader.checkCrc();
|
||||||
if (result != RETURN_OK) {
|
if (result != returnvalue::OK) {
|
||||||
triggerEvent(SUPV_REPLY_CRC_MISSMATCH, rememberApid);
|
triggerEvent(SUPV_REPLY_CRC_MISSMATCH, rememberApid);
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
@ -596,20 +596,20 @@ ReturnValue_t PlocSupvHelper::checkReceivedTm(ploc::SpTmReader& reader) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
ReturnValue_t PlocSupvHelper::receive(uint8_t* data, size_t* readBytes, size_t requestBytes) {
|
ReturnValue_t PlocSupvHelper::receive(uint8_t* data, size_t* readBytes, size_t requestBytes) {
|
||||||
ReturnValue_t result = RETURN_OK;
|
ReturnValue_t result = returnvalue::OK;
|
||||||
uint8_t* buffer = nullptr;
|
uint8_t* buffer = nullptr;
|
||||||
result = uartComIF->requestReceiveMessage(comCookie, requestBytes);
|
result = uartComIF->requestReceiveMessage(comCookie, requestBytes);
|
||||||
if (result != RETURN_OK) {
|
if (result != returnvalue::OK) {
|
||||||
sif::warning << "PlocSupvHelper::receive: Failed to request reply" << std::endl;
|
sif::warning << "PlocSupvHelper::receive: Failed to request reply" << std::endl;
|
||||||
triggerEvent(SUPV_HELPER_REQUESTING_REPLY_FAILED, result,
|
triggerEvent(SUPV_HELPER_REQUESTING_REPLY_FAILED, result,
|
||||||
static_cast<uint32_t>(static_cast<uint32_t>(internalState)));
|
static_cast<uint32_t>(static_cast<uint32_t>(internalState)));
|
||||||
return RETURN_FAILED;
|
return returnvalue::FAILED;
|
||||||
}
|
}
|
||||||
result = uartComIF->readReceivedMessage(comCookie, &buffer, readBytes);
|
result = uartComIF->readReceivedMessage(comCookie, &buffer, readBytes);
|
||||||
if (result != RETURN_OK) {
|
if (result != returnvalue::OK) {
|
||||||
sif::warning << "PlocSupvHelper::receive: Failed to read received message" << std::endl;
|
sif::warning << "PlocSupvHelper::receive: Failed to read received message" << std::endl;
|
||||||
triggerEvent(SUPV_HELPER_READING_REPLY_FAILED, result, static_cast<uint32_t>(internalState));
|
triggerEvent(SUPV_HELPER_READING_REPLY_FAILED, result, static_cast<uint32_t>(internalState));
|
||||||
return RETURN_FAILED;
|
return returnvalue::FAILED;
|
||||||
}
|
}
|
||||||
if (*readBytes > 0) {
|
if (*readBytes > 0) {
|
||||||
std::memcpy(data, buffer, *readBytes);
|
std::memcpy(data, buffer, *readBytes);
|
||||||
@ -620,13 +620,13 @@ ReturnValue_t PlocSupvHelper::receive(uint8_t* data, size_t* readBytes, size_t r
|
|||||||
}
|
}
|
||||||
|
|
||||||
ReturnValue_t PlocSupvHelper::calcImageCrc() {
|
ReturnValue_t PlocSupvHelper::calcImageCrc() {
|
||||||
ReturnValue_t result = RETURN_OK;
|
ReturnValue_t result = returnvalue::OK;
|
||||||
if (update.fullFileSize == 0) {
|
if (update.fullFileSize == 0) {
|
||||||
return HasReturnvaluesIF::RETURN_FAILED;
|
return returnvalue::FAILED;
|
||||||
}
|
}
|
||||||
#ifdef XIPHOS_Q7S
|
#ifdef XIPHOS_Q7S
|
||||||
result = FilesystemHelper::checkPath(update.file);
|
result = FilesystemHelper::checkPath(update.file);
|
||||||
if (result != RETURN_OK) {
|
if (result != returnvalue::OK) {
|
||||||
sif::warning << "PlocSupvHelper::calcImageCrc: File " << update.file << " does not exist"
|
sif::warning << "PlocSupvHelper::calcImageCrc: File " << update.file << " does not exist"
|
||||||
<< std::endl;
|
<< std::endl;
|
||||||
return result;
|
return result;
|
||||||
@ -666,7 +666,7 @@ ReturnValue_t PlocSupvHelper::calcImageCrc() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
ReturnValue_t PlocSupvHelper::handleCheckMemoryCommand() {
|
ReturnValue_t PlocSupvHelper::handleCheckMemoryCommand() {
|
||||||
ReturnValue_t result = RETURN_OK;
|
ReturnValue_t result = returnvalue::OK;
|
||||||
resetSpParams();
|
resetSpParams();
|
||||||
// Will hold status report for later processing
|
// Will hold status report for later processing
|
||||||
std::array<uint8_t, 32> statusReportBuf{};
|
std::array<uint8_t, 32> statusReportBuf{};
|
||||||
@ -674,15 +674,15 @@ ReturnValue_t PlocSupvHelper::handleCheckMemoryCommand() {
|
|||||||
// Verification of update write procedure
|
// Verification of update write procedure
|
||||||
supv::CheckMemory packet(spParams);
|
supv::CheckMemory packet(spParams);
|
||||||
result = packet.buildPacket(update.memoryId, update.startAddress, update.fullFileSize);
|
result = packet.buildPacket(update.memoryId, update.startAddress, update.fullFileSize);
|
||||||
if (result != RETURN_OK) {
|
if (result != returnvalue::OK) {
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
result = sendCommand(packet);
|
result = sendCommand(packet);
|
||||||
if (result != RETURN_OK) {
|
if (result != returnvalue::OK) {
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
result = handleAck();
|
result = handleAck();
|
||||||
if (result != RETURN_OK) {
|
if (result != returnvalue::OK) {
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -697,14 +697,14 @@ ReturnValue_t PlocSupvHelper::handleCheckMemoryCommand() {
|
|||||||
size_t remBytes = spReader.getPacketDataLen() + 1;
|
size_t remBytes = spReader.getPacketDataLen() + 1;
|
||||||
result = handleTmReception(remBytes, tmBuf.data() + ccsds::HEADER_LEN,
|
result = handleTmReception(remBytes, tmBuf.data() + ccsds::HEADER_LEN,
|
||||||
supv::recv_timeout::UPDATE_STATUS_REPORT);
|
supv::recv_timeout::UPDATE_STATUS_REPORT);
|
||||||
if (result != RETURN_OK) {
|
if (result != returnvalue::OK) {
|
||||||
sif::warning
|
sif::warning
|
||||||
<< "PlocSupvHelper::handleCheckMemoryCommand: Failed to receive update status report"
|
<< "PlocSupvHelper::handleCheckMemoryCommand: Failed to receive update status report"
|
||||||
<< std::endl;
|
<< std::endl;
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
result = updateStatusReport.checkCrc();
|
result = updateStatusReport.checkCrc();
|
||||||
if (result != RETURN_OK) {
|
if (result != returnvalue::OK) {
|
||||||
sif::warning << "PlocSupvHelper::handleCheckMemoryCommand: CRC check failed" << std::endl;
|
sif::warning << "PlocSupvHelper::handleCheckMemoryCommand: CRC check failed" << std::endl;
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
@ -714,7 +714,7 @@ ReturnValue_t PlocSupvHelper::handleCheckMemoryCommand() {
|
|||||||
|
|
||||||
if (not exeAlreadyHandled) {
|
if (not exeAlreadyHandled) {
|
||||||
result = handleExe(CRC_EXECUTION_TIMEOUT);
|
result = handleExe(CRC_EXECUTION_TIMEOUT);
|
||||||
if (result != RETURN_OK) {
|
if (result != returnvalue::OK) {
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -722,12 +722,12 @@ ReturnValue_t PlocSupvHelper::handleCheckMemoryCommand() {
|
|||||||
// Now process the status report
|
// Now process the status report
|
||||||
updateStatusReport.setData(statusReportBuf.data(), statusReportBuf.size());
|
updateStatusReport.setData(statusReportBuf.data(), statusReportBuf.size());
|
||||||
result = updateStatusReport.parseDataField();
|
result = updateStatusReport.parseDataField();
|
||||||
if (result != RETURN_OK) {
|
if (result != returnvalue::OK) {
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
if (update.crcShouldBeChecked) {
|
if (update.crcShouldBeChecked) {
|
||||||
result = updateStatusReport.verifycrc(update.crc);
|
result = updateStatusReport.verifycrc(update.crc);
|
||||||
if (result != RETURN_OK) {
|
if (result != returnvalue::OK) {
|
||||||
sif::warning << "PlocSupvHelper::handleCheckMemoryCommand: CRC failure. Expected CRC 0x"
|
sif::warning << "PlocSupvHelper::handleCheckMemoryCommand: CRC failure. Expected CRC 0x"
|
||||||
<< std::setfill('0') << std::hex << std::setw(4)
|
<< std::setfill('0') << std::hex << std::setw(4)
|
||||||
<< static_cast<uint16_t>(update.crc) << " but received CRC 0x" << std::setw(4)
|
<< static_cast<uint16_t>(update.crc) << " but received CRC 0x" << std::setw(4)
|
||||||
@ -747,7 +747,7 @@ uint32_t PlocSupvHelper::getFileSize(std::string filename) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
ReturnValue_t PlocSupvHelper::handleEventBufferReception(ploc::SpTmReader& reader) {
|
ReturnValue_t PlocSupvHelper::handleEventBufferReception(ploc::SpTmReader& reader) {
|
||||||
ReturnValue_t result = RETURN_OK;
|
ReturnValue_t result = returnvalue::OK;
|
||||||
std::string filename = Filenaming::generateAbsoluteFilename(
|
std::string filename = Filenaming::generateAbsoluteFilename(
|
||||||
eventBufferReq.path, eventBufferReq.filename, timestamping);
|
eventBufferReq.path, eventBufferReq.filename, timestamping);
|
||||||
std::ofstream file(filename, std::ios_base::app | std::ios_base::out);
|
std::ofstream file(filename, std::ios_base::app | std::ios_base::out);
|
||||||
@ -770,14 +770,14 @@ ReturnValue_t PlocSupvHelper::handleEventBufferReception(ploc::SpTmReader& reade
|
|||||||
requestLen -= 6;
|
requestLen -= 6;
|
||||||
}
|
}
|
||||||
result = handleTmReception(requestLen);
|
result = handleTmReception(requestLen);
|
||||||
if (result != RETURN_OK) {
|
if (result != returnvalue::OK) {
|
||||||
sif::debug << "PlocSupvHelper::handleEventBufferReception: Failed while trying to read packet"
|
sif::debug << "PlocSupvHelper::handleEventBufferReception: Failed while trying to read packet"
|
||||||
<< " " << packetsRead + 1 << std::endl;
|
<< " " << packetsRead + 1 << std::endl;
|
||||||
file.close();
|
file.close();
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
ReturnValue_t result = reader.checkCrc();
|
ReturnValue_t result = reader.checkCrc();
|
||||||
if (result != RETURN_OK) {
|
if (result != returnvalue::OK) {
|
||||||
triggerEvent(SUPV_REPLY_CRC_MISSMATCH, rememberApid);
|
triggerEvent(SUPV_REPLY_CRC_MISSMATCH, rememberApid);
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
@ -7,7 +7,7 @@
|
|||||||
#include "fsfw/devicehandlers/CookieIF.h"
|
#include "fsfw/devicehandlers/CookieIF.h"
|
||||||
#include "fsfw/objectmanager/SystemObject.h"
|
#include "fsfw/objectmanager/SystemObject.h"
|
||||||
#include "fsfw/osal/linux/BinarySemaphore.h"
|
#include "fsfw/osal/linux/BinarySemaphore.h"
|
||||||
#include "fsfw/returnvalues/HasReturnvaluesIF.h"
|
#include "fsfw/returnvalues/returnvalue.h"
|
||||||
#include "fsfw/tasks/ExecutableObjectIF.h"
|
#include "fsfw/tasks/ExecutableObjectIF.h"
|
||||||
#include "fsfw_hal/linux/uart/UartComIF.h"
|
#include "fsfw_hal/linux/uart/UartComIF.h"
|
||||||
#include "linux/devices/devicedefinitions/PlocSupervisorDefinitions.h"
|
#include "linux/devices/devicedefinitions/PlocSupervisorDefinitions.h"
|
||||||
@ -21,7 +21,7 @@
|
|||||||
* the supervisor and the OBC.
|
* the supervisor and the OBC.
|
||||||
* @author J. Meier
|
* @author J. Meier
|
||||||
*/
|
*/
|
||||||
class PlocSupvHelper : public SystemObject, public ExecutableObjectIF, public HasReturnvaluesIF {
|
class PlocSupvHelper : public SystemObject, public ExecutableObjectIF {
|
||||||
public:
|
public:
|
||||||
static const uint8_t SUBSYSTEM_ID = SUBSYSTEM_ID::PLOC_SUPV_HELPER;
|
static const uint8_t SUBSYSTEM_ID = SUBSYSTEM_ID::PLOC_SUPV_HELPER;
|
||||||
|
|
||||||
@ -114,7 +114,7 @@ class PlocSupvHelper : public SystemObject, public ExecutableObjectIF, public Ha
|
|||||||
* @param memoryId ID of the memory where to write to
|
* @param memoryId ID of the memory where to write to
|
||||||
* @param startAddress Address where to write data
|
* @param startAddress Address where to write data
|
||||||
*
|
*
|
||||||
* @return RETURN_OK if successful, otherwise error return value
|
* @return returnvalue::OK if successful, otherwise error return value
|
||||||
*/
|
*/
|
||||||
ReturnValue_t performUpdate(const supv::UpdateParams& params);
|
ReturnValue_t performUpdate(const supv::UpdateParams& params);
|
||||||
ReturnValue_t startUpdate(std::string file, uint8_t memoryId, uint32_t startAddress);
|
ReturnValue_t startUpdate(std::string file, uint8_t memoryId, uint32_t startAddress);
|
||||||
|
@ -34,15 +34,15 @@ ReturnValue_t ArcsecDatalinkLayer::decodeFrame(const uint8_t* rawData, size_t ra
|
|||||||
case ARC_DEC_SYNC: {
|
case ARC_DEC_SYNC: {
|
||||||
// Reset length of SLIP struct for next frame
|
// Reset length of SLIP struct for next frame
|
||||||
slipInfo.length = 0;
|
slipInfo.length = 0;
|
||||||
return RETURN_OK;
|
return returnvalue::OK;
|
||||||
}
|
}
|
||||||
default:
|
default:
|
||||||
sif::debug << "ArcsecDatalinkLayer::decodeFrame: Unknown result code" << std::endl;
|
sif::debug << "ArcsecDatalinkLayer::decodeFrame: Unknown result code" << std::endl;
|
||||||
break;
|
break;
|
||||||
return RETURN_FAILED;
|
return returnvalue::FAILED;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return RETURN_FAILED;
|
return returnvalue::FAILED;
|
||||||
}
|
}
|
||||||
|
|
||||||
uint8_t ArcsecDatalinkLayer::getReplyFrameType() { return decodedFrame[0]; }
|
uint8_t ArcsecDatalinkLayer::getReplyFrameType() { return decodedFrame[0]; }
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
#ifndef BSP_Q7S_DEVICES_ARCSECDATALINKLAYER_H_
|
#ifndef BSP_Q7S_DEVICES_ARCSECDATALINKLAYER_H_
|
||||||
#define BSP_Q7S_DEVICES_ARCSECDATALINKLAYER_H_
|
#define BSP_Q7S_DEVICES_ARCSECDATALINKLAYER_H_
|
||||||
|
|
||||||
#include "fsfw/returnvalues/HasReturnvaluesIF.h"
|
#include "fsfw/returnvalues/returnvalue.h"
|
||||||
#include "linux/devices/devicedefinitions/StarTrackerDefinitions.h"
|
#include "linux/devices/devicedefinitions/StarTrackerDefinitions.h"
|
||||||
|
|
||||||
extern "C" {
|
extern "C" {
|
||||||
@ -11,7 +11,7 @@ extern "C" {
|
|||||||
/**
|
/**
|
||||||
* @brief Helper class to handle the datalinklayer of replies from the star tracker of arcsec.
|
* @brief Helper class to handle the datalinklayer of replies from the star tracker of arcsec.
|
||||||
*/
|
*/
|
||||||
class ArcsecDatalinkLayer : public HasReturnvaluesIF {
|
class ArcsecDatalinkLayer {
|
||||||
public:
|
public:
|
||||||
static const uint8_t INTERFACE_ID = CLASS_ID::STR_HANDLER;
|
static const uint8_t INTERFACE_ID = CLASS_ID::STR_HANDLER;
|
||||||
|
|
||||||
|
@ -5,15 +5,15 @@
|
|||||||
ArcsecJsonParamBase::ArcsecJsonParamBase(std::string setName) : setName(setName) {}
|
ArcsecJsonParamBase::ArcsecJsonParamBase(std::string setName) : setName(setName) {}
|
||||||
|
|
||||||
ReturnValue_t ArcsecJsonParamBase::create(std::string fullname, uint8_t* buffer) {
|
ReturnValue_t ArcsecJsonParamBase::create(std::string fullname, uint8_t* buffer) {
|
||||||
ReturnValue_t result = RETURN_OK;
|
ReturnValue_t result = returnvalue::OK;
|
||||||
result = init(fullname);
|
result = init(fullname);
|
||||||
if (result != RETURN_OK) {
|
if (result != returnvalue::OK) {
|
||||||
sif::warning << "ArcsecJsonParamBase::create: Failed to init parameter command for set "
|
sif::warning << "ArcsecJsonParamBase::create: Failed to init parameter command for set "
|
||||||
<< setName << std::endl;
|
<< setName << std::endl;
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
result = createCommand(buffer);
|
result = createCommand(buffer);
|
||||||
if (result != RETURN_OK) {
|
if (result != returnvalue::OK) {
|
||||||
sif::warning << "ArcsecJsonParamBase::create: Failed to create parameter command for set "
|
sif::warning << "ArcsecJsonParamBase::create: Failed to create parameter command for set "
|
||||||
<< setName << std::endl;
|
<< setName << std::endl;
|
||||||
}
|
}
|
||||||
@ -25,7 +25,7 @@ ReturnValue_t ArcsecJsonParamBase::getParam(const std::string name, std::string&
|
|||||||
if ((*it)[arcseckeys::NAME] == name) {
|
if ((*it)[arcseckeys::NAME] == name) {
|
||||||
value = (*it)[arcseckeys::VALUE];
|
value = (*it)[arcseckeys::VALUE];
|
||||||
convertEmpty(value);
|
convertEmpty(value);
|
||||||
return RETURN_OK;
|
return returnvalue::OK;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return PARAM_NOT_EXISTS;
|
return PARAM_NOT_EXISTS;
|
||||||
@ -68,7 +68,7 @@ void ArcsecJsonParamBase::addSetParamHeader(uint8_t* buffer, uint8_t setId) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
ReturnValue_t ArcsecJsonParamBase::init(const std::string filename) {
|
ReturnValue_t ArcsecJsonParamBase::init(const std::string filename) {
|
||||||
ReturnValue_t result = RETURN_OK;
|
ReturnValue_t result = returnvalue::OK;
|
||||||
if (not std::filesystem::exists(filename)) {
|
if (not std::filesystem::exists(filename)) {
|
||||||
sif::warning << "ArcsecJsonParamBase::init: JSON file " << filename << " does not exist"
|
sif::warning << "ArcsecJsonParamBase::init: JSON file " << filename << " does not exist"
|
||||||
<< std::endl;
|
<< std::endl;
|
||||||
@ -76,10 +76,10 @@ ReturnValue_t ArcsecJsonParamBase::init(const std::string filename) {
|
|||||||
}
|
}
|
||||||
createJsonObject(filename);
|
createJsonObject(filename);
|
||||||
result = initSet();
|
result = initSet();
|
||||||
if (result != RETURN_OK) {
|
if (result != returnvalue::OK) {
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
return RETURN_OK;
|
return returnvalue::OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
void ArcsecJsonParamBase::createJsonObject(const std::string fullname) {
|
void ArcsecJsonParamBase::createJsonObject(const std::string fullname) {
|
||||||
@ -94,7 +94,7 @@ ReturnValue_t ArcsecJsonParamBase::initSet() {
|
|||||||
for (json::iterator it = properties.begin(); it != properties.end(); ++it) {
|
for (json::iterator it = properties.begin(); it != properties.end(); ++it) {
|
||||||
if ((*it)["name"] == setName) {
|
if ((*it)["name"] == setName) {
|
||||||
set = (*it)["fields"];
|
set = (*it)["fields"];
|
||||||
return RETURN_OK;
|
return returnvalue::OK;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
sif::warning << "ArcsecJsonParamBase::initSet: Set " << setName << "not present in json file"
|
sif::warning << "ArcsecJsonParamBase::initSet: Set " << setName << "not present in json file"
|
||||||
|
@ -5,7 +5,7 @@
|
|||||||
#include <fstream>
|
#include <fstream>
|
||||||
#include <nlohmann/json.hpp>
|
#include <nlohmann/json.hpp>
|
||||||
|
|
||||||
#include "fsfw/returnvalues/HasReturnvaluesIF.h"
|
#include "fsfw/returnvalues/returnvalue.h"
|
||||||
#include "linux/devices/devicedefinitions/StarTrackerDefinitions.h"
|
#include "linux/devices/devicedefinitions/StarTrackerDefinitions.h"
|
||||||
|
|
||||||
extern "C" {
|
extern "C" {
|
||||||
@ -22,7 +22,7 @@ using json = nlohmann::json;
|
|||||||
*
|
*
|
||||||
* @author J. Meier
|
* @author J. Meier
|
||||||
*/
|
*/
|
||||||
class ArcsecJsonParamBase : public HasReturnvaluesIF {
|
class ArcsecJsonParamBase {
|
||||||
public:
|
public:
|
||||||
static const uint8_t INTERFACE_ID = CLASS_ID::ARCSEC_JSON_BASE;
|
static const uint8_t INTERFACE_ID = CLASS_ID::ARCSEC_JSON_BASE;
|
||||||
//! [EXPORT] : [COMMENT] Specified json file does not exist
|
//! [EXPORT] : [COMMENT] Specified json file does not exist
|
||||||
@ -32,6 +32,7 @@ class ArcsecJsonParamBase : public HasReturnvaluesIF {
|
|||||||
//! [EXPORT] : [COMMENT] Requested parameter does not exist in json file
|
//! [EXPORT] : [COMMENT] Requested parameter does not exist in json file
|
||||||
static const ReturnValue_t PARAM_NOT_EXISTS = MAKE_RETURN_CODE(3);
|
static const ReturnValue_t PARAM_NOT_EXISTS = MAKE_RETURN_CODE(3);
|
||||||
|
|
||||||
|
virtual ~ArcsecJsonParamBase() = default;
|
||||||
/**
|
/**
|
||||||
* @brief Constructor
|
* @brief Constructor
|
||||||
*
|
*
|
||||||
@ -60,7 +61,7 @@ class ArcsecJsonParamBase : public HasReturnvaluesIF {
|
|||||||
* @param name The name of the parameter
|
* @param name The name of the parameter
|
||||||
* @param value The string representation of the read value
|
* @param value The string representation of the read value
|
||||||
*
|
*
|
||||||
* @return RETURN_OK if successful, otherwise PARAM_NOT_EXISTS
|
* @return returnvalue::OK if successful, otherwise PARAM_NOT_EXISTS
|
||||||
*/
|
*/
|
||||||
ReturnValue_t getParam(const std::string name, std::string& value);
|
ReturnValue_t getParam(const std::string name, std::string& value);
|
||||||
|
|
||||||
@ -129,7 +130,7 @@ class ArcsecJsonParamBase : public HasReturnvaluesIF {
|
|||||||
* @param setName The name of the set to work on
|
* @param setName The name of the set to work on
|
||||||
*
|
*
|
||||||
* @param return JSON_FILE_NOT_EXISTS if specified file does not exist, otherwise
|
* @param return JSON_FILE_NOT_EXISTS if specified file does not exist, otherwise
|
||||||
* RETURN_OK
|
* returnvalue::OK
|
||||||
*/
|
*/
|
||||||
ReturnValue_t init(const std::string filename);
|
ReturnValue_t init(const std::string filename);
|
||||||
|
|
||||||
|
@ -53,9 +53,9 @@ StarTrackerHandler::StarTrackerHandler(object_id_t objectId, object_id_t comIF,
|
|||||||
StarTrackerHandler::~StarTrackerHandler() {}
|
StarTrackerHandler::~StarTrackerHandler() {}
|
||||||
|
|
||||||
ReturnValue_t StarTrackerHandler::initialize() {
|
ReturnValue_t StarTrackerHandler::initialize() {
|
||||||
ReturnValue_t result = RETURN_OK;
|
ReturnValue_t result = returnvalue::OK;
|
||||||
result = DeviceHandlerBase::initialize();
|
result = DeviceHandlerBase::initialize();
|
||||||
if (result != RETURN_OK) {
|
if (result != returnvalue::OK) {
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -68,13 +68,13 @@ ReturnValue_t StarTrackerHandler::initialize() {
|
|||||||
;
|
;
|
||||||
}
|
}
|
||||||
result = manager->registerListener(eventQueue->getId());
|
result = manager->registerListener(eventQueue->getId());
|
||||||
if (result != RETURN_OK) {
|
if (result != returnvalue::OK) {
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
result = manager->subscribeToEventRange(eventQueue->getId(),
|
result = manager->subscribeToEventRange(eventQueue->getId(),
|
||||||
event::getEventId(StrHelper::IMAGE_UPLOAD_FAILED),
|
event::getEventId(StrHelper::IMAGE_UPLOAD_FAILED),
|
||||||
event::getEventId(StrHelper::FIRMWARE_UPDATE_FAILED));
|
event::getEventId(StrHelper::FIRMWARE_UPDATE_FAILED));
|
||||||
if (result != RETURN_OK) {
|
if (result != returnvalue::OK) {
|
||||||
#if FSFW_CPP_OSTREAM_ENABLED == 1
|
#if FSFW_CPP_OSTREAM_ENABLED == 1
|
||||||
sif::warning << "StarTrackerHandler::initialize: Failed to subscribe to events from "
|
sif::warning << "StarTrackerHandler::initialize: Failed to subscribe to events from "
|
||||||
" str helper"
|
" str helper"
|
||||||
@ -84,16 +84,16 @@ ReturnValue_t StarTrackerHandler::initialize() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
result = strHelper->setComIF(communicationInterface);
|
result = strHelper->setComIF(communicationInterface);
|
||||||
if (result != RETURN_OK) {
|
if (result != returnvalue::OK) {
|
||||||
return ObjectManagerIF::CHILD_INIT_FAILED;
|
return ObjectManagerIF::CHILD_INIT_FAILED;
|
||||||
}
|
}
|
||||||
strHelper->setComCookie(comCookie);
|
strHelper->setComCookie(comCookie);
|
||||||
return RETURN_OK;
|
return returnvalue::OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
ReturnValue_t StarTrackerHandler::executeAction(ActionId_t actionId, MessageQueueId_t commandedBy,
|
ReturnValue_t StarTrackerHandler::executeAction(ActionId_t actionId, MessageQueueId_t commandedBy,
|
||||||
const uint8_t* data, size_t size) {
|
const uint8_t* data, size_t size) {
|
||||||
ReturnValue_t result = RETURN_OK;
|
ReturnValue_t result = returnvalue::OK;
|
||||||
|
|
||||||
switch (actionId) {
|
switch (actionId) {
|
||||||
case (startracker::STOP_IMAGE_LOADER): {
|
case (startracker::STOP_IMAGE_LOADER): {
|
||||||
@ -122,12 +122,12 @@ ReturnValue_t StarTrackerHandler::executeAction(ActionId_t actionId, MessageQueu
|
|||||||
}
|
}
|
||||||
|
|
||||||
result = checkMode(actionId);
|
result = checkMode(actionId);
|
||||||
if (result != RETURN_OK) {
|
if (result != returnvalue::OK) {
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
result = checkCommand(actionId);
|
result = checkCommand(actionId);
|
||||||
if (result != RETURN_OK) {
|
if (result != returnvalue::OK) {
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -135,14 +135,14 @@ ReturnValue_t StarTrackerHandler::executeAction(ActionId_t actionId, MessageQueu
|
|||||||
switch (actionId) {
|
switch (actionId) {
|
||||||
case (startracker::UPLOAD_IMAGE): {
|
case (startracker::UPLOAD_IMAGE): {
|
||||||
result = DeviceHandlerBase::acceptExternalDeviceCommands();
|
result = DeviceHandlerBase::acceptExternalDeviceCommands();
|
||||||
if (result != RETURN_OK) {
|
if (result != returnvalue::OK) {
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
if (size > MAX_PATH_SIZE + MAX_FILE_NAME) {
|
if (size > MAX_PATH_SIZE + MAX_FILE_NAME) {
|
||||||
return FILE_PATH_TOO_LONG;
|
return FILE_PATH_TOO_LONG;
|
||||||
}
|
}
|
||||||
result = strHelper->startImageUpload(std::string(reinterpret_cast<const char*>(data), size));
|
result = strHelper->startImageUpload(std::string(reinterpret_cast<const char*>(data), size));
|
||||||
if (result != RETURN_OK) {
|
if (result != returnvalue::OK) {
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
strHelperExecuting = true;
|
strHelperExecuting = true;
|
||||||
@ -150,7 +150,7 @@ ReturnValue_t StarTrackerHandler::executeAction(ActionId_t actionId, MessageQueu
|
|||||||
}
|
}
|
||||||
case (startracker::DOWNLOAD_IMAGE): {
|
case (startracker::DOWNLOAD_IMAGE): {
|
||||||
result = DeviceHandlerBase::acceptExternalDeviceCommands();
|
result = DeviceHandlerBase::acceptExternalDeviceCommands();
|
||||||
if (result != RETURN_OK) {
|
if (result != returnvalue::OK) {
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
if (size > MAX_PATH_SIZE) {
|
if (size > MAX_PATH_SIZE) {
|
||||||
@ -158,7 +158,7 @@ ReturnValue_t StarTrackerHandler::executeAction(ActionId_t actionId, MessageQueu
|
|||||||
}
|
}
|
||||||
result =
|
result =
|
||||||
strHelper->startImageDownload(std::string(reinterpret_cast<const char*>(data), size));
|
strHelper->startImageDownload(std::string(reinterpret_cast<const char*>(data), size));
|
||||||
if (result != RETURN_OK) {
|
if (result != returnvalue::OK) {
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
strHelperExecuting = true;
|
strHelperExecuting = true;
|
||||||
@ -166,11 +166,11 @@ ReturnValue_t StarTrackerHandler::executeAction(ActionId_t actionId, MessageQueu
|
|||||||
}
|
}
|
||||||
case (startracker::FLASH_READ): {
|
case (startracker::FLASH_READ): {
|
||||||
result = DeviceHandlerBase::acceptExternalDeviceCommands();
|
result = DeviceHandlerBase::acceptExternalDeviceCommands();
|
||||||
if (result != RETURN_OK) {
|
if (result != returnvalue::OK) {
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
result = executeFlashReadCommand(data, size);
|
result = executeFlashReadCommand(data, size);
|
||||||
if (result != RETURN_OK) {
|
if (result != returnvalue::OK) {
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
strHelperExecuting = true;
|
strHelperExecuting = true;
|
||||||
@ -192,7 +192,7 @@ ReturnValue_t StarTrackerHandler::executeAction(ActionId_t actionId, MessageQueu
|
|||||||
}
|
}
|
||||||
case (startracker::FIRMWARE_UPDATE): {
|
case (startracker::FIRMWARE_UPDATE): {
|
||||||
result = DeviceHandlerBase::acceptExternalDeviceCommands();
|
result = DeviceHandlerBase::acceptExternalDeviceCommands();
|
||||||
if (result != RETURN_OK) {
|
if (result != returnvalue::OK) {
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
if (size > MAX_PATH_SIZE + MAX_FILE_NAME) {
|
if (size > MAX_PATH_SIZE + MAX_FILE_NAME) {
|
||||||
@ -200,7 +200,7 @@ ReturnValue_t StarTrackerHandler::executeAction(ActionId_t actionId, MessageQueu
|
|||||||
}
|
}
|
||||||
result =
|
result =
|
||||||
strHelper->startFirmwareUpdate(std::string(reinterpret_cast<const char*>(data), size));
|
strHelper->startFirmwareUpdate(std::string(reinterpret_cast<const char*>(data), size));
|
||||||
if (result != RETURN_OK) {
|
if (result != returnvalue::OK) {
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
strHelperExecuting = true;
|
strHelperExecuting = true;
|
||||||
@ -214,7 +214,7 @@ ReturnValue_t StarTrackerHandler::executeAction(ActionId_t actionId, MessageQueu
|
|||||||
|
|
||||||
void StarTrackerHandler::performOperationHook() {
|
void StarTrackerHandler::performOperationHook() {
|
||||||
EventMessage event;
|
EventMessage event;
|
||||||
for (ReturnValue_t result = eventQueue->receiveMessage(&event); result == RETURN_OK;
|
for (ReturnValue_t result = eventQueue->receiveMessage(&event); result == returnvalue::OK;
|
||||||
result = eventQueue->receiveMessage(&event)) {
|
result = eventQueue->receiveMessage(&event)) {
|
||||||
switch (event.getMessageId()) {
|
switch (event.getMessageId()) {
|
||||||
case EventMessage::EVENT_MESSAGE:
|
case EventMessage::EVENT_MESSAGE:
|
||||||
@ -385,56 +385,56 @@ ReturnValue_t StarTrackerHandler::buildTransitionDeviceCommand(DeviceCommandId_t
|
|||||||
ReturnValue_t StarTrackerHandler::buildCommandFromCommand(DeviceCommandId_t deviceCommand,
|
ReturnValue_t StarTrackerHandler::buildCommandFromCommand(DeviceCommandId_t deviceCommand,
|
||||||
const uint8_t* commandData,
|
const uint8_t* commandData,
|
||||||
size_t commandDataLen) {
|
size_t commandDataLen) {
|
||||||
ReturnValue_t result = RETURN_OK;
|
ReturnValue_t result = returnvalue::OK;
|
||||||
switch (deviceCommand) {
|
switch (deviceCommand) {
|
||||||
case (startracker::PING_REQUEST): {
|
case (startracker::PING_REQUEST): {
|
||||||
preparePingRequest();
|
preparePingRequest();
|
||||||
return RETURN_OK;
|
return returnvalue::OK;
|
||||||
}
|
}
|
||||||
case (startracker::REQ_TIME): {
|
case (startracker::REQ_TIME): {
|
||||||
prepareTimeRequest();
|
prepareTimeRequest();
|
||||||
return RETURN_OK;
|
return returnvalue::OK;
|
||||||
}
|
}
|
||||||
case (startracker::BOOT): {
|
case (startracker::BOOT): {
|
||||||
prepareBootCommand();
|
prepareBootCommand();
|
||||||
return RETURN_OK;
|
return returnvalue::OK;
|
||||||
}
|
}
|
||||||
case (startracker::REQ_VERSION): {
|
case (startracker::REQ_VERSION): {
|
||||||
prepareVersionRequest();
|
prepareVersionRequest();
|
||||||
return RETURN_OK;
|
return returnvalue::OK;
|
||||||
}
|
}
|
||||||
case (startracker::REQ_INTERFACE): {
|
case (startracker::REQ_INTERFACE): {
|
||||||
prepareInterfaceRequest();
|
prepareInterfaceRequest();
|
||||||
return RETURN_OK;
|
return returnvalue::OK;
|
||||||
}
|
}
|
||||||
case (startracker::REQ_POWER): {
|
case (startracker::REQ_POWER): {
|
||||||
preparePowerRequest();
|
preparePowerRequest();
|
||||||
return RETURN_OK;
|
return returnvalue::OK;
|
||||||
}
|
}
|
||||||
case (startracker::SWITCH_TO_BOOTLOADER_PROGRAM): {
|
case (startracker::SWITCH_TO_BOOTLOADER_PROGRAM): {
|
||||||
prepareSwitchToBootloaderCmd();
|
prepareSwitchToBootloaderCmd();
|
||||||
return RETURN_OK;
|
return returnvalue::OK;
|
||||||
}
|
}
|
||||||
case (startracker::TAKE_IMAGE): {
|
case (startracker::TAKE_IMAGE): {
|
||||||
prepareTakeImageCommand(commandData);
|
prepareTakeImageCommand(commandData);
|
||||||
return RETURN_OK;
|
return returnvalue::OK;
|
||||||
}
|
}
|
||||||
case (startracker::SUBSCRIPTION): {
|
case (startracker::SUBSCRIPTION): {
|
||||||
Subscription subscription;
|
Subscription subscription;
|
||||||
result = prepareParamCommand(commandData, commandDataLen, subscription);
|
result = prepareParamCommand(commandData, commandDataLen, subscription);
|
||||||
return RETURN_OK;
|
return returnvalue::OK;
|
||||||
}
|
}
|
||||||
case (startracker::REQ_SOLUTION): {
|
case (startracker::REQ_SOLUTION): {
|
||||||
prepareSolutionRequest();
|
prepareSolutionRequest();
|
||||||
return RETURN_OK;
|
return returnvalue::OK;
|
||||||
}
|
}
|
||||||
case (startracker::REQ_TEMPERATURE): {
|
case (startracker::REQ_TEMPERATURE): {
|
||||||
prepareTemperatureRequest();
|
prepareTemperatureRequest();
|
||||||
return RETURN_OK;
|
return returnvalue::OK;
|
||||||
}
|
}
|
||||||
case (startracker::REQ_HISTOGRAM): {
|
case (startracker::REQ_HISTOGRAM): {
|
||||||
prepareHistogramRequest();
|
prepareHistogramRequest();
|
||||||
return RETURN_OK;
|
return returnvalue::OK;
|
||||||
}
|
}
|
||||||
case (startracker::LIMITS): {
|
case (startracker::LIMITS): {
|
||||||
Limits limits;
|
Limits limits;
|
||||||
@ -564,7 +564,7 @@ ReturnValue_t StarTrackerHandler::buildCommandFromCommand(DeviceCommandId_t devi
|
|||||||
default:
|
default:
|
||||||
return DeviceHandlerIF::COMMAND_NOT_IMPLEMENTED;
|
return DeviceHandlerIF::COMMAND_NOT_IMPLEMENTED;
|
||||||
}
|
}
|
||||||
return HasReturnvaluesIF::RETURN_FAILED;
|
return returnvalue::FAILED;
|
||||||
}
|
}
|
||||||
|
|
||||||
void StarTrackerHandler::fillCommandAndReplyMap() {
|
void StarTrackerHandler::fillCommandAndReplyMap() {
|
||||||
@ -662,13 +662,13 @@ ReturnValue_t StarTrackerHandler::isModeCombinationValid(Mode_t mode, Submode_t
|
|||||||
case MODE_NORMAL:
|
case MODE_NORMAL:
|
||||||
case MODE_RAW:
|
case MODE_RAW:
|
||||||
if (submode == SUBMODE_NONE) {
|
if (submode == SUBMODE_NONE) {
|
||||||
return RETURN_OK;
|
return returnvalue::OK;
|
||||||
} else {
|
} else {
|
||||||
return INVALID_SUBMODE;
|
return INVALID_SUBMODE;
|
||||||
}
|
}
|
||||||
case MODE_ON:
|
case MODE_ON:
|
||||||
if (submode == SUBMODE_BOOTLOADER || submode == SUBMODE_FIRMWARE) {
|
if (submode == SUBMODE_BOOTLOADER || submode == SUBMODE_FIRMWARE) {
|
||||||
return RETURN_OK;
|
return returnvalue::OK;
|
||||||
} else {
|
} else {
|
||||||
return INVALID_SUBMODE;
|
return INVALID_SUBMODE;
|
||||||
}
|
}
|
||||||
@ -759,7 +759,7 @@ void StarTrackerHandler::bootBootloader() {
|
|||||||
|
|
||||||
ReturnValue_t StarTrackerHandler::scanForReply(const uint8_t* start, size_t remainingSize,
|
ReturnValue_t StarTrackerHandler::scanForReply(const uint8_t* start, size_t remainingSize,
|
||||||
DeviceCommandId_t* foundId, size_t* foundLen) {
|
DeviceCommandId_t* foundId, size_t* foundLen) {
|
||||||
ReturnValue_t result = RETURN_OK;
|
ReturnValue_t result = returnvalue::OK;
|
||||||
size_t bytesLeft = 0;
|
size_t bytesLeft = 0;
|
||||||
|
|
||||||
result = dataLinkLayer.decodeFrame(start, remainingSize, &bytesLeft);
|
result = dataLinkLayer.decodeFrame(start, remainingSize, &bytesLeft);
|
||||||
@ -769,7 +769,7 @@ ReturnValue_t StarTrackerHandler::scanForReply(const uint8_t* start, size_t rema
|
|||||||
// Need a second doSendRead pass to reaa in whole packet
|
// Need a second doSendRead pass to reaa in whole packet
|
||||||
return IGNORE_REPLY_DATA;
|
return IGNORE_REPLY_DATA;
|
||||||
}
|
}
|
||||||
case RETURN_OK: {
|
case returnvalue::OK: {
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
default:
|
default:
|
||||||
@ -801,7 +801,7 @@ ReturnValue_t StarTrackerHandler::scanForReply(const uint8_t* start, size_t rema
|
|||||||
}
|
}
|
||||||
default: {
|
default: {
|
||||||
sif::debug << "StarTrackerHandler::scanForReply: Reply has invalid type id" << std::endl;
|
sif::debug << "StarTrackerHandler::scanForReply: Reply has invalid type id" << std::endl;
|
||||||
result = RETURN_FAILED;
|
result = returnvalue::FAILED;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -812,7 +812,7 @@ ReturnValue_t StarTrackerHandler::scanForReply(const uint8_t* start, size_t rema
|
|||||||
|
|
||||||
ReturnValue_t StarTrackerHandler::interpretDeviceReply(DeviceCommandId_t id,
|
ReturnValue_t StarTrackerHandler::interpretDeviceReply(DeviceCommandId_t id,
|
||||||
const uint8_t* packet) {
|
const uint8_t* packet) {
|
||||||
ReturnValue_t result = RETURN_OK;
|
ReturnValue_t result = returnvalue::OK;
|
||||||
|
|
||||||
switch (id) {
|
switch (id) {
|
||||||
case (startracker::REQ_TIME): {
|
case (startracker::REQ_TIME): {
|
||||||
@ -832,11 +832,11 @@ ReturnValue_t StarTrackerHandler::interpretDeviceReply(DeviceCommandId_t id,
|
|||||||
}
|
}
|
||||||
case (startracker::REQ_VERSION): {
|
case (startracker::REQ_VERSION): {
|
||||||
result = handleTm(versionSet, startracker::VersionSet::SIZE);
|
result = handleTm(versionSet, startracker::VersionSet::SIZE);
|
||||||
if (result != RETURN_OK) {
|
if (result != returnvalue::OK) {
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
result = checkProgram();
|
result = checkProgram();
|
||||||
if (result != RETURN_OK) {
|
if (result != returnvalue::OK) {
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
@ -1209,7 +1209,7 @@ ReturnValue_t StarTrackerHandler::initializeLocalDataPool(localpool::DataPool& l
|
|||||||
localDataPoolMap.emplace(startracker::DEBUG_CAMERA_TEST, new PoolEntry<uint32_t>({0}));
|
localDataPoolMap.emplace(startracker::DEBUG_CAMERA_TEST, new PoolEntry<uint32_t>({0}));
|
||||||
|
|
||||||
localDataPoolMap.emplace(startracker::CHKSUM, new PoolEntry<uint32_t>({0}));
|
localDataPoolMap.emplace(startracker::CHKSUM, new PoolEntry<uint32_t>({0}));
|
||||||
return RETURN_OK;
|
return returnvalue::OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
size_t StarTrackerHandler::getNextReplyLength(DeviceCommandId_t commandId) {
|
size_t StarTrackerHandler::getNextReplyLength(DeviceCommandId_t commandId) {
|
||||||
@ -1219,9 +1219,9 @@ size_t StarTrackerHandler::getNextReplyLength(DeviceCommandId_t commandId) {
|
|||||||
ReturnValue_t StarTrackerHandler::doSendReadHook() {
|
ReturnValue_t StarTrackerHandler::doSendReadHook() {
|
||||||
// Prevent DHB from polling UART during commands executed by the image loader task
|
// Prevent DHB from polling UART during commands executed by the image loader task
|
||||||
if (strHelperExecuting) {
|
if (strHelperExecuting) {
|
||||||
return RETURN_FAILED;
|
return returnvalue::FAILED;
|
||||||
}
|
}
|
||||||
return RETURN_OK;
|
return returnvalue::OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
ReturnValue_t StarTrackerHandler::getSwitches(const uint8_t** switches, uint8_t* numberOfSwitches) {
|
ReturnValue_t StarTrackerHandler::getSwitches(const uint8_t** switches, uint8_t* numberOfSwitches) {
|
||||||
@ -1230,7 +1230,7 @@ ReturnValue_t StarTrackerHandler::getSwitches(const uint8_t** switches, uint8_t*
|
|||||||
}
|
}
|
||||||
*numberOfSwitches = 1;
|
*numberOfSwitches = 1;
|
||||||
*switches = &powerSwitch;
|
*switches = &powerSwitch;
|
||||||
return RETURN_OK;
|
return returnvalue::OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
ReturnValue_t StarTrackerHandler::checkMode(ActionId_t actionId) {
|
ReturnValue_t StarTrackerHandler::checkMode(ActionId_t actionId) {
|
||||||
@ -1244,7 +1244,7 @@ ReturnValue_t StarTrackerHandler::checkMode(ActionId_t actionId) {
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return RETURN_OK;
|
return returnvalue::OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
ReturnValue_t StarTrackerHandler::scanForActionReply(DeviceCommandId_t* foundId) {
|
ReturnValue_t StarTrackerHandler::scanForActionReply(DeviceCommandId_t* foundId) {
|
||||||
@ -1273,9 +1273,9 @@ ReturnValue_t StarTrackerHandler::scanForActionReply(DeviceCommandId_t* foundId)
|
|||||||
default:
|
default:
|
||||||
sif::warning << "StarTrackerHandler::scanForActionReply: Unknown parameter reply id"
|
sif::warning << "StarTrackerHandler::scanForActionReply: Unknown parameter reply id"
|
||||||
<< std::endl;
|
<< std::endl;
|
||||||
return RETURN_FAILED;
|
return returnvalue::FAILED;
|
||||||
}
|
}
|
||||||
return RETURN_OK;
|
return returnvalue::OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
ReturnValue_t StarTrackerHandler::scanForSetParameterReply(DeviceCommandId_t* foundId) {
|
ReturnValue_t StarTrackerHandler::scanForSetParameterReply(DeviceCommandId_t* foundId) {
|
||||||
@ -1340,9 +1340,9 @@ ReturnValue_t StarTrackerHandler::scanForSetParameterReply(DeviceCommandId_t* fo
|
|||||||
default:
|
default:
|
||||||
sif::debug << "StarTrackerHandler::scanForParameterReply: Unknown parameter reply id"
|
sif::debug << "StarTrackerHandler::scanForParameterReply: Unknown parameter reply id"
|
||||||
<< std::endl;
|
<< std::endl;
|
||||||
return RETURN_FAILED;
|
return returnvalue::FAILED;
|
||||||
}
|
}
|
||||||
return RETURN_OK;
|
return returnvalue::OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
ReturnValue_t StarTrackerHandler::scanForGetParameterReply(DeviceCommandId_t* foundId) {
|
ReturnValue_t StarTrackerHandler::scanForGetParameterReply(DeviceCommandId_t* foundId) {
|
||||||
@ -1406,11 +1406,11 @@ ReturnValue_t StarTrackerHandler::scanForGetParameterReply(DeviceCommandId_t* fo
|
|||||||
}
|
}
|
||||||
default: {
|
default: {
|
||||||
sif::warning << "tarTrackerHandler::scanForGetParameterReply: UnkNown ID" << std::endl;
|
sif::warning << "tarTrackerHandler::scanForGetParameterReply: UnkNown ID" << std::endl;
|
||||||
return RETURN_FAILED;
|
return returnvalue::FAILED;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return RETURN_OK;
|
return returnvalue::OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
ReturnValue_t StarTrackerHandler::scanForTmReply(DeviceCommandId_t* foundId) {
|
ReturnValue_t StarTrackerHandler::scanForTmReply(DeviceCommandId_t* foundId) {
|
||||||
@ -1447,11 +1447,11 @@ ReturnValue_t StarTrackerHandler::scanForTmReply(DeviceCommandId_t* foundId) {
|
|||||||
default: {
|
default: {
|
||||||
sif::debug << "StarTrackerHandler::scanForTmReply: Reply contains invalid reply id: "
|
sif::debug << "StarTrackerHandler::scanForTmReply: Reply contains invalid reply id: "
|
||||||
<< static_cast<unsigned int>(*reply) << std::endl;
|
<< static_cast<unsigned int>(*reply) << std::endl;
|
||||||
return RETURN_FAILED;
|
return returnvalue::FAILED;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return RETURN_OK;
|
return returnvalue::OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
void StarTrackerHandler::handleEvent(EventMessage* eventMessage) {
|
void StarTrackerHandler::handleEvent(EventMessage* eventMessage) {
|
||||||
@ -1471,7 +1471,7 @@ void StarTrackerHandler::handleEvent(EventMessage* eventMessage) {
|
|||||||
|
|
||||||
ReturnValue_t StarTrackerHandler::executeFlashReadCommand(const uint8_t* commandData,
|
ReturnValue_t StarTrackerHandler::executeFlashReadCommand(const uint8_t* commandData,
|
||||||
size_t commandDataLen) {
|
size_t commandDataLen) {
|
||||||
ReturnValue_t result = RETURN_OK;
|
ReturnValue_t result = returnvalue::OK;
|
||||||
if (commandDataLen < FlashReadCmd::MIN_LENGTH) {
|
if (commandDataLen < FlashReadCmd::MIN_LENGTH) {
|
||||||
sif::warning << "StarTrackerHandler::executeFlashReadCommand: Command too short" << std::endl;
|
sif::warning << "StarTrackerHandler::executeFlashReadCommand: Command too short" << std::endl;
|
||||||
return COMMAND_TOO_SHORT;
|
return COMMAND_TOO_SHORT;
|
||||||
@ -1481,7 +1481,7 @@ ReturnValue_t StarTrackerHandler::executeFlashReadCommand(const uint8_t* command
|
|||||||
size_t size = sizeof(length);
|
size_t size = sizeof(length);
|
||||||
const uint8_t* lengthPtr = commandData + sizeof(startRegion);
|
const uint8_t* lengthPtr = commandData + sizeof(startRegion);
|
||||||
result = SerializeAdapter::deSerialize(&length, lengthPtr, &size, SerializeIF::Endianness::BIG);
|
result = SerializeAdapter::deSerialize(&length, lengthPtr, &size, SerializeIF::Endianness::BIG);
|
||||||
if (result != RETURN_OK) {
|
if (result != returnvalue::OK) {
|
||||||
sif::debug << "StarTrackerHandler::executeFlashReadCommand: Deserialization of length failed"
|
sif::debug << "StarTrackerHandler::executeFlashReadCommand: Deserialization of length failed"
|
||||||
<< std::endl;
|
<< std::endl;
|
||||||
return result;
|
return result;
|
||||||
@ -1495,7 +1495,7 @@ ReturnValue_t StarTrackerHandler::executeFlashReadCommand(const uint8_t* command
|
|||||||
std::string fullname = std::string(reinterpret_cast<const char*>(filePtr),
|
std::string fullname = std::string(reinterpret_cast<const char*>(filePtr),
|
||||||
commandDataLen - sizeof(startRegion) - sizeof(length));
|
commandDataLen - sizeof(startRegion) - sizeof(length));
|
||||||
result = strHelper->startFlashRead(fullname, startRegion, length);
|
result = strHelper->startFlashRead(fullname, startRegion, length);
|
||||||
if (result != RETURN_OK) {
|
if (result != returnvalue::OK) {
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
return result;
|
return result;
|
||||||
@ -1513,7 +1513,7 @@ void StarTrackerHandler::prepareBootCommand() {
|
|||||||
ReturnValue_t StarTrackerHandler::prepareChecksumCommand(const uint8_t* commandData,
|
ReturnValue_t StarTrackerHandler::prepareChecksumCommand(const uint8_t* commandData,
|
||||||
size_t commandDataLen) {
|
size_t commandDataLen) {
|
||||||
struct ChecksumActionRequest req;
|
struct ChecksumActionRequest req;
|
||||||
ReturnValue_t result = RETURN_OK;
|
ReturnValue_t result = returnvalue::OK;
|
||||||
if (commandDataLen != ChecksumCmd::LENGTH) {
|
if (commandDataLen != ChecksumCmd::LENGTH) {
|
||||||
sif::warning << "StarTrackerHandler::prepareChecksumCommand: Invalid length" << std::endl;
|
sif::warning << "StarTrackerHandler::prepareChecksumCommand: Invalid length" << std::endl;
|
||||||
return INVALID_LENGTH;
|
return INVALID_LENGTH;
|
||||||
@ -1523,7 +1523,7 @@ ReturnValue_t StarTrackerHandler::prepareChecksumCommand(const uint8_t* commandD
|
|||||||
const uint8_t* addressPtr = commandData + ChecksumCmd::ADDRESS_OFFSET;
|
const uint8_t* addressPtr = commandData + ChecksumCmd::ADDRESS_OFFSET;
|
||||||
result =
|
result =
|
||||||
SerializeAdapter::deSerialize(&req.address, addressPtr, &size, SerializeIF::Endianness::BIG);
|
SerializeAdapter::deSerialize(&req.address, addressPtr, &size, SerializeIF::Endianness::BIG);
|
||||||
if (result != RETURN_OK) {
|
if (result != returnvalue::OK) {
|
||||||
sif::debug << "StarTrackerHandler::prepareChecksumCommand: Deserialization of address "
|
sif::debug << "StarTrackerHandler::prepareChecksumCommand: Deserialization of address "
|
||||||
<< "failed" << std::endl;
|
<< "failed" << std::endl;
|
||||||
return result;
|
return result;
|
||||||
@ -1532,7 +1532,7 @@ ReturnValue_t StarTrackerHandler::prepareChecksumCommand(const uint8_t* commandD
|
|||||||
const uint8_t* lengthPtr = commandData + ChecksumCmd::LENGTH_OFFSET;
|
const uint8_t* lengthPtr = commandData + ChecksumCmd::LENGTH_OFFSET;
|
||||||
result =
|
result =
|
||||||
SerializeAdapter::deSerialize(&req.length, lengthPtr, &size, SerializeIF::Endianness::BIG);
|
SerializeAdapter::deSerialize(&req.length, lengthPtr, &size, SerializeIF::Endianness::BIG);
|
||||||
if (result != RETURN_OK) {
|
if (result != returnvalue::OK) {
|
||||||
sif::debug << "StarTrackerHandler::prepareChecksumCommand: Deserialization of length failed"
|
sif::debug << "StarTrackerHandler::prepareChecksumCommand: Deserialization of length failed"
|
||||||
<< std::endl;
|
<< std::endl;
|
||||||
return result;
|
return result;
|
||||||
@ -1635,20 +1635,20 @@ void StarTrackerHandler::prepareHistogramRequest() {
|
|||||||
ReturnValue_t StarTrackerHandler::prepareParamCommand(const uint8_t* commandData,
|
ReturnValue_t StarTrackerHandler::prepareParamCommand(const uint8_t* commandData,
|
||||||
size_t commandDataLen,
|
size_t commandDataLen,
|
||||||
ArcsecJsonParamBase& paramSet) {
|
ArcsecJsonParamBase& paramSet) {
|
||||||
ReturnValue_t result = RETURN_OK;
|
ReturnValue_t result = returnvalue::OK;
|
||||||
if (commandDataLen > MAX_PATH_SIZE) {
|
if (commandDataLen > MAX_PATH_SIZE) {
|
||||||
return FILE_PATH_TOO_LONG;
|
return FILE_PATH_TOO_LONG;
|
||||||
}
|
}
|
||||||
std::string fullName(reinterpret_cast<const char*>(commandData), commandDataLen);
|
std::string fullName(reinterpret_cast<const char*>(commandData), commandDataLen);
|
||||||
|
|
||||||
result = paramSet.create(fullName, commandBuffer);
|
result = paramSet.create(fullName, commandBuffer);
|
||||||
if (result != RETURN_OK) {
|
if (result != returnvalue::OK) {
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
dataLinkLayer.encodeFrame(commandBuffer, paramSet.getSize());
|
dataLinkLayer.encodeFrame(commandBuffer, paramSet.getSize());
|
||||||
rawPacket = dataLinkLayer.getEncodedFrame();
|
rawPacket = dataLinkLayer.getEncodedFrame();
|
||||||
rawPacketLen = dataLinkLayer.getEncodedLength();
|
rawPacketLen = dataLinkLayer.getEncodedLength();
|
||||||
return RETURN_OK;
|
return returnvalue::OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
ReturnValue_t StarTrackerHandler::prepareRequestCameraParams() {
|
ReturnValue_t StarTrackerHandler::prepareRequestCameraParams() {
|
||||||
@ -1657,7 +1657,7 @@ ReturnValue_t StarTrackerHandler::prepareRequestCameraParams() {
|
|||||||
dataLinkLayer.encodeFrame(commandBuffer, length);
|
dataLinkLayer.encodeFrame(commandBuffer, length);
|
||||||
rawPacket = dataLinkLayer.getEncodedFrame();
|
rawPacket = dataLinkLayer.getEncodedFrame();
|
||||||
rawPacketLen = dataLinkLayer.getEncodedLength();
|
rawPacketLen = dataLinkLayer.getEncodedLength();
|
||||||
return RETURN_OK;
|
return returnvalue::OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
ReturnValue_t StarTrackerHandler::prepareRequestLimitsParams() {
|
ReturnValue_t StarTrackerHandler::prepareRequestLimitsParams() {
|
||||||
@ -1666,7 +1666,7 @@ ReturnValue_t StarTrackerHandler::prepareRequestLimitsParams() {
|
|||||||
dataLinkLayer.encodeFrame(commandBuffer, length);
|
dataLinkLayer.encodeFrame(commandBuffer, length);
|
||||||
rawPacket = dataLinkLayer.getEncodedFrame();
|
rawPacket = dataLinkLayer.getEncodedFrame();
|
||||||
rawPacketLen = dataLinkLayer.getEncodedLength();
|
rawPacketLen = dataLinkLayer.getEncodedLength();
|
||||||
return RETURN_OK;
|
return returnvalue::OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
ReturnValue_t StarTrackerHandler::prepareRequestLogLevelParams() {
|
ReturnValue_t StarTrackerHandler::prepareRequestLogLevelParams() {
|
||||||
@ -1675,7 +1675,7 @@ ReturnValue_t StarTrackerHandler::prepareRequestLogLevelParams() {
|
|||||||
dataLinkLayer.encodeFrame(commandBuffer, length);
|
dataLinkLayer.encodeFrame(commandBuffer, length);
|
||||||
rawPacket = dataLinkLayer.getEncodedFrame();
|
rawPacket = dataLinkLayer.getEncodedFrame();
|
||||||
rawPacketLen = dataLinkLayer.getEncodedLength();
|
rawPacketLen = dataLinkLayer.getEncodedLength();
|
||||||
return RETURN_OK;
|
return returnvalue::OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
ReturnValue_t StarTrackerHandler::prepareRequestMountingParams() {
|
ReturnValue_t StarTrackerHandler::prepareRequestMountingParams() {
|
||||||
@ -1684,7 +1684,7 @@ ReturnValue_t StarTrackerHandler::prepareRequestMountingParams() {
|
|||||||
dataLinkLayer.encodeFrame(commandBuffer, length);
|
dataLinkLayer.encodeFrame(commandBuffer, length);
|
||||||
rawPacket = dataLinkLayer.getEncodedFrame();
|
rawPacket = dataLinkLayer.getEncodedFrame();
|
||||||
rawPacketLen = dataLinkLayer.getEncodedLength();
|
rawPacketLen = dataLinkLayer.getEncodedLength();
|
||||||
return RETURN_OK;
|
return returnvalue::OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
ReturnValue_t StarTrackerHandler::prepareRequestImageProcessorParams() {
|
ReturnValue_t StarTrackerHandler::prepareRequestImageProcessorParams() {
|
||||||
@ -1693,7 +1693,7 @@ ReturnValue_t StarTrackerHandler::prepareRequestImageProcessorParams() {
|
|||||||
dataLinkLayer.encodeFrame(commandBuffer, length);
|
dataLinkLayer.encodeFrame(commandBuffer, length);
|
||||||
rawPacket = dataLinkLayer.getEncodedFrame();
|
rawPacket = dataLinkLayer.getEncodedFrame();
|
||||||
rawPacketLen = dataLinkLayer.getEncodedLength();
|
rawPacketLen = dataLinkLayer.getEncodedLength();
|
||||||
return RETURN_OK;
|
return returnvalue::OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
ReturnValue_t StarTrackerHandler::prepareRequestCentroidingParams() {
|
ReturnValue_t StarTrackerHandler::prepareRequestCentroidingParams() {
|
||||||
@ -1702,7 +1702,7 @@ ReturnValue_t StarTrackerHandler::prepareRequestCentroidingParams() {
|
|||||||
dataLinkLayer.encodeFrame(commandBuffer, length);
|
dataLinkLayer.encodeFrame(commandBuffer, length);
|
||||||
rawPacket = dataLinkLayer.getEncodedFrame();
|
rawPacket = dataLinkLayer.getEncodedFrame();
|
||||||
rawPacketLen = dataLinkLayer.getEncodedLength();
|
rawPacketLen = dataLinkLayer.getEncodedLength();
|
||||||
return RETURN_OK;
|
return returnvalue::OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
ReturnValue_t StarTrackerHandler::prepareRequestLisaParams() {
|
ReturnValue_t StarTrackerHandler::prepareRequestLisaParams() {
|
||||||
@ -1711,7 +1711,7 @@ ReturnValue_t StarTrackerHandler::prepareRequestLisaParams() {
|
|||||||
dataLinkLayer.encodeFrame(commandBuffer, length);
|
dataLinkLayer.encodeFrame(commandBuffer, length);
|
||||||
rawPacket = dataLinkLayer.getEncodedFrame();
|
rawPacket = dataLinkLayer.getEncodedFrame();
|
||||||
rawPacketLen = dataLinkLayer.getEncodedLength();
|
rawPacketLen = dataLinkLayer.getEncodedLength();
|
||||||
return RETURN_OK;
|
return returnvalue::OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
ReturnValue_t StarTrackerHandler::prepareRequestMatchingParams() {
|
ReturnValue_t StarTrackerHandler::prepareRequestMatchingParams() {
|
||||||
@ -1720,7 +1720,7 @@ ReturnValue_t StarTrackerHandler::prepareRequestMatchingParams() {
|
|||||||
dataLinkLayer.encodeFrame(commandBuffer, length);
|
dataLinkLayer.encodeFrame(commandBuffer, length);
|
||||||
rawPacket = dataLinkLayer.getEncodedFrame();
|
rawPacket = dataLinkLayer.getEncodedFrame();
|
||||||
rawPacketLen = dataLinkLayer.getEncodedLength();
|
rawPacketLen = dataLinkLayer.getEncodedLength();
|
||||||
return RETURN_OK;
|
return returnvalue::OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
ReturnValue_t StarTrackerHandler::prepareRequestTrackingParams() {
|
ReturnValue_t StarTrackerHandler::prepareRequestTrackingParams() {
|
||||||
@ -1729,7 +1729,7 @@ ReturnValue_t StarTrackerHandler::prepareRequestTrackingParams() {
|
|||||||
dataLinkLayer.encodeFrame(commandBuffer, length);
|
dataLinkLayer.encodeFrame(commandBuffer, length);
|
||||||
rawPacket = dataLinkLayer.getEncodedFrame();
|
rawPacket = dataLinkLayer.getEncodedFrame();
|
||||||
rawPacketLen = dataLinkLayer.getEncodedLength();
|
rawPacketLen = dataLinkLayer.getEncodedLength();
|
||||||
return RETURN_OK;
|
return returnvalue::OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
ReturnValue_t StarTrackerHandler::prepareRequestValidationParams() {
|
ReturnValue_t StarTrackerHandler::prepareRequestValidationParams() {
|
||||||
@ -1738,7 +1738,7 @@ ReturnValue_t StarTrackerHandler::prepareRequestValidationParams() {
|
|||||||
dataLinkLayer.encodeFrame(commandBuffer, length);
|
dataLinkLayer.encodeFrame(commandBuffer, length);
|
||||||
rawPacket = dataLinkLayer.getEncodedFrame();
|
rawPacket = dataLinkLayer.getEncodedFrame();
|
||||||
rawPacketLen = dataLinkLayer.getEncodedLength();
|
rawPacketLen = dataLinkLayer.getEncodedLength();
|
||||||
return RETURN_OK;
|
return returnvalue::OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
ReturnValue_t StarTrackerHandler::prepareRequestAlgoParams() {
|
ReturnValue_t StarTrackerHandler::prepareRequestAlgoParams() {
|
||||||
@ -1747,7 +1747,7 @@ ReturnValue_t StarTrackerHandler::prepareRequestAlgoParams() {
|
|||||||
dataLinkLayer.encodeFrame(commandBuffer, length);
|
dataLinkLayer.encodeFrame(commandBuffer, length);
|
||||||
rawPacket = dataLinkLayer.getEncodedFrame();
|
rawPacket = dataLinkLayer.getEncodedFrame();
|
||||||
rawPacketLen = dataLinkLayer.getEncodedLength();
|
rawPacketLen = dataLinkLayer.getEncodedLength();
|
||||||
return RETURN_OK;
|
return returnvalue::OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
ReturnValue_t StarTrackerHandler::prepareRequestSubscriptionParams() {
|
ReturnValue_t StarTrackerHandler::prepareRequestSubscriptionParams() {
|
||||||
@ -1756,7 +1756,7 @@ ReturnValue_t StarTrackerHandler::prepareRequestSubscriptionParams() {
|
|||||||
dataLinkLayer.encodeFrame(commandBuffer, length);
|
dataLinkLayer.encodeFrame(commandBuffer, length);
|
||||||
rawPacket = dataLinkLayer.getEncodedFrame();
|
rawPacket = dataLinkLayer.getEncodedFrame();
|
||||||
rawPacketLen = dataLinkLayer.getEncodedLength();
|
rawPacketLen = dataLinkLayer.getEncodedLength();
|
||||||
return RETURN_OK;
|
return returnvalue::OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
ReturnValue_t StarTrackerHandler::prepareRequestLogSubscriptionParams() {
|
ReturnValue_t StarTrackerHandler::prepareRequestLogSubscriptionParams() {
|
||||||
@ -1765,7 +1765,7 @@ ReturnValue_t StarTrackerHandler::prepareRequestLogSubscriptionParams() {
|
|||||||
dataLinkLayer.encodeFrame(commandBuffer, length);
|
dataLinkLayer.encodeFrame(commandBuffer, length);
|
||||||
rawPacket = dataLinkLayer.getEncodedFrame();
|
rawPacket = dataLinkLayer.getEncodedFrame();
|
||||||
rawPacketLen = dataLinkLayer.getEncodedLength();
|
rawPacketLen = dataLinkLayer.getEncodedLength();
|
||||||
return RETURN_OK;
|
return returnvalue::OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
ReturnValue_t StarTrackerHandler::prepareRequestDebugCameraParams() {
|
ReturnValue_t StarTrackerHandler::prepareRequestDebugCameraParams() {
|
||||||
@ -1774,7 +1774,7 @@ ReturnValue_t StarTrackerHandler::prepareRequestDebugCameraParams() {
|
|||||||
dataLinkLayer.encodeFrame(commandBuffer, length);
|
dataLinkLayer.encodeFrame(commandBuffer, length);
|
||||||
rawPacket = dataLinkLayer.getEncodedFrame();
|
rawPacket = dataLinkLayer.getEncodedFrame();
|
||||||
rawPacketLen = dataLinkLayer.getEncodedLength();
|
rawPacketLen = dataLinkLayer.getEncodedLength();
|
||||||
return RETURN_OK;
|
return returnvalue::OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
ReturnValue_t StarTrackerHandler::handleSetParamReply() {
|
ReturnValue_t StarTrackerHandler::handleSetParamReply() {
|
||||||
@ -1792,7 +1792,7 @@ ReturnValue_t StarTrackerHandler::handleSetParamReply() {
|
|||||||
if (internalState != InternalState::IDLE) {
|
if (internalState != InternalState::IDLE) {
|
||||||
handleStartup(reply + PARAMETER_ID_OFFSET);
|
handleStartup(reply + PARAMETER_ID_OFFSET);
|
||||||
}
|
}
|
||||||
return RETURN_OK;
|
return returnvalue::OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
ReturnValue_t StarTrackerHandler::handleActionReply() {
|
ReturnValue_t StarTrackerHandler::handleActionReply() {
|
||||||
@ -1805,13 +1805,13 @@ ReturnValue_t StarTrackerHandler::handleActionReply() {
|
|||||||
<< static_cast<unsigned int>(status) << std::endl;
|
<< static_cast<unsigned int>(status) << std::endl;
|
||||||
return ACTION_FAILED;
|
return ACTION_FAILED;
|
||||||
}
|
}
|
||||||
return RETURN_OK;
|
return returnvalue::OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
ReturnValue_t StarTrackerHandler::handleChecksumReply() {
|
ReturnValue_t StarTrackerHandler::handleChecksumReply() {
|
||||||
ReturnValue_t result = RETURN_OK;
|
ReturnValue_t result = returnvalue::OK;
|
||||||
result = handleActionReply();
|
result = handleActionReply();
|
||||||
if (result != RETURN_OK) {
|
if (result != returnvalue::OK) {
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
const uint8_t* replyData = dataLinkLayer.getReply() + ACTION_DATA_OFFSET;
|
const uint8_t* replyData = dataLinkLayer.getReply() + ACTION_DATA_OFFSET;
|
||||||
@ -1834,25 +1834,25 @@ ReturnValue_t StarTrackerHandler::handleChecksumReply() {
|
|||||||
#if OBSW_VERBOSE_LEVEL >= 1 && OBSW_DEBUG_STARTRACKER == 1
|
#if OBSW_VERBOSE_LEVEL >= 1 && OBSW_DEBUG_STARTRACKER == 1
|
||||||
checksumReply.printChecksum();
|
checksumReply.printChecksum();
|
||||||
#endif /* OBSW_VERBOSE_LEVEL >= 1 && OBSW_DEBUG_STARTRACKER == 1 */
|
#endif /* OBSW_VERBOSE_LEVEL >= 1 && OBSW_DEBUG_STARTRACKER == 1 */
|
||||||
return RETURN_OK;
|
return returnvalue::OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
ReturnValue_t StarTrackerHandler::handleParamRequest(LocalPoolDataSetBase& dataset, size_t size) {
|
ReturnValue_t StarTrackerHandler::handleParamRequest(LocalPoolDataSetBase& dataset, size_t size) {
|
||||||
ReturnValue_t result = RETURN_OK;
|
ReturnValue_t result = returnvalue::OK;
|
||||||
result = dataset.read(TIMEOUT_TYPE, MUTEX_TIMEOUT);
|
result = dataset.read(TIMEOUT_TYPE, MUTEX_TIMEOUT);
|
||||||
if (result != RETURN_OK) {
|
if (result != returnvalue::OK) {
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
const uint8_t* reply = dataLinkLayer.getReply() + PARAMS_OFFSET;
|
const uint8_t* reply = dataLinkLayer.getReply() + PARAMS_OFFSET;
|
||||||
dataset.setValidityBufferGeneration(false);
|
dataset.setValidityBufferGeneration(false);
|
||||||
result = dataset.deSerialize(&reply, &size, SerializeIF::Endianness::LITTLE);
|
result = dataset.deSerialize(&reply, &size, SerializeIF::Endianness::LITTLE);
|
||||||
if (result != RETURN_OK) {
|
if (result != returnvalue::OK) {
|
||||||
sif::warning << "StarTrackerHandler::handleParamRequest Deserialization failed" << std::endl;
|
sif::warning << "StarTrackerHandler::handleParamRequest Deserialization failed" << std::endl;
|
||||||
}
|
}
|
||||||
dataset.setValidityBufferGeneration(true);
|
dataset.setValidityBufferGeneration(true);
|
||||||
dataset.setValidity(true, true);
|
dataset.setValidity(true, true);
|
||||||
result = dataset.commit(TIMEOUT_TYPE, MUTEX_TIMEOUT);
|
result = dataset.commit(TIMEOUT_TYPE, MUTEX_TIMEOUT);
|
||||||
if (result != RETURN_OK) {
|
if (result != returnvalue::OK) {
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
#if OBSW_VERBOSE_LEVEL >= 1 && OBSW_DEBUG_STARTRACKER == 1
|
#if OBSW_VERBOSE_LEVEL >= 1 && OBSW_DEBUG_STARTRACKER == 1
|
||||||
@ -1862,7 +1862,7 @@ ReturnValue_t StarTrackerHandler::handleParamRequest(LocalPoolDataSetBase& datas
|
|||||||
}
|
}
|
||||||
|
|
||||||
ReturnValue_t StarTrackerHandler::handlePingReply() {
|
ReturnValue_t StarTrackerHandler::handlePingReply() {
|
||||||
ReturnValue_t result = RETURN_OK;
|
ReturnValue_t result = returnvalue::OK;
|
||||||
uint32_t pingId = 0;
|
uint32_t pingId = 0;
|
||||||
const uint8_t* reply = dataLinkLayer.getReply();
|
const uint8_t* reply = dataLinkLayer.getReply();
|
||||||
uint8_t status = dataLinkLayer.getStatusField();
|
uint8_t status = dataLinkLayer.getStatusField();
|
||||||
@ -1916,11 +1916,11 @@ ReturnValue_t StarTrackerHandler::checkProgram() {
|
|||||||
<< std::endl;
|
<< std::endl;
|
||||||
return INVALID_PROGRAM;
|
return INVALID_PROGRAM;
|
||||||
}
|
}
|
||||||
return RETURN_OK;
|
return returnvalue::OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
ReturnValue_t StarTrackerHandler::handleTm(LocalPoolDataSetBase& dataset, size_t size) {
|
ReturnValue_t StarTrackerHandler::handleTm(LocalPoolDataSetBase& dataset, size_t size) {
|
||||||
ReturnValue_t result = RETURN_OK;
|
ReturnValue_t result = returnvalue::OK;
|
||||||
uint8_t status = *(dataLinkLayer.getReply() + STATUS_OFFSET);
|
uint8_t status = *(dataLinkLayer.getReply() + STATUS_OFFSET);
|
||||||
if (status != startracker::STATUS_OK) {
|
if (status != startracker::STATUS_OK) {
|
||||||
sif::warning << "StarTrackerHandler::handleTm: Reply error: "
|
sif::warning << "StarTrackerHandler::handleTm: Reply error: "
|
||||||
@ -1928,19 +1928,19 @@ ReturnValue_t StarTrackerHandler::handleTm(LocalPoolDataSetBase& dataset, size_t
|
|||||||
return REPLY_ERROR;
|
return REPLY_ERROR;
|
||||||
}
|
}
|
||||||
result = dataset.read(TIMEOUT_TYPE, MUTEX_TIMEOUT);
|
result = dataset.read(TIMEOUT_TYPE, MUTEX_TIMEOUT);
|
||||||
if (result != RETURN_OK) {
|
if (result != returnvalue::OK) {
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
const uint8_t* reply = dataLinkLayer.getReply() + TICKS_OFFSET;
|
const uint8_t* reply = dataLinkLayer.getReply() + TICKS_OFFSET;
|
||||||
dataset.setValidityBufferGeneration(false);
|
dataset.setValidityBufferGeneration(false);
|
||||||
result = dataset.deSerialize(&reply, &size, SerializeIF::Endianness::LITTLE);
|
result = dataset.deSerialize(&reply, &size, SerializeIF::Endianness::LITTLE);
|
||||||
if (result != RETURN_OK) {
|
if (result != returnvalue::OK) {
|
||||||
sif::warning << "StarTrackerHandler::handleTm: Deserialization failed" << std::endl;
|
sif::warning << "StarTrackerHandler::handleTm: Deserialization failed" << std::endl;
|
||||||
}
|
}
|
||||||
dataset.setValidityBufferGeneration(true);
|
dataset.setValidityBufferGeneration(true);
|
||||||
dataset.setValidity(true, true);
|
dataset.setValidity(true, true);
|
||||||
result = dataset.commit(TIMEOUT_TYPE, MUTEX_TIMEOUT);
|
result = dataset.commit(TIMEOUT_TYPE, MUTEX_TIMEOUT);
|
||||||
if (result != RETURN_OK) {
|
if (result != returnvalue::OK) {
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
#if OBSW_VERBOSE_LEVEL >= 1 && OBSW_DEBUG_STARTRACKER == 1
|
#if OBSW_VERBOSE_LEVEL >= 1 && OBSW_DEBUG_STARTRACKER == 1
|
||||||
@ -1950,7 +1950,7 @@ ReturnValue_t StarTrackerHandler::handleTm(LocalPoolDataSetBase& dataset, size_t
|
|||||||
}
|
}
|
||||||
|
|
||||||
ReturnValue_t StarTrackerHandler::handleActionReplySet(LocalPoolDataSetBase& dataset, size_t size) {
|
ReturnValue_t StarTrackerHandler::handleActionReplySet(LocalPoolDataSetBase& dataset, size_t size) {
|
||||||
ReturnValue_t result = RETURN_OK;
|
ReturnValue_t result = returnvalue::OK;
|
||||||
uint8_t status = *(dataLinkLayer.getReply() + STATUS_OFFSET);
|
uint8_t status = *(dataLinkLayer.getReply() + STATUS_OFFSET);
|
||||||
if (status != startracker::STATUS_OK) {
|
if (status != startracker::STATUS_OK) {
|
||||||
sif::warning << "StarTrackerHandler::handleActionReplySet: Reply error: "
|
sif::warning << "StarTrackerHandler::handleActionReplySet: Reply error: "
|
||||||
@ -1958,19 +1958,19 @@ ReturnValue_t StarTrackerHandler::handleActionReplySet(LocalPoolDataSetBase& dat
|
|||||||
return REPLY_ERROR;
|
return REPLY_ERROR;
|
||||||
}
|
}
|
||||||
result = dataset.read(TIMEOUT_TYPE, MUTEX_TIMEOUT);
|
result = dataset.read(TIMEOUT_TYPE, MUTEX_TIMEOUT);
|
||||||
if (result != RETURN_OK) {
|
if (result != returnvalue::OK) {
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
const uint8_t* reply = dataLinkLayer.getReply() + ACTION_DATA_OFFSET;
|
const uint8_t* reply = dataLinkLayer.getReply() + ACTION_DATA_OFFSET;
|
||||||
dataset.setValidityBufferGeneration(false);
|
dataset.setValidityBufferGeneration(false);
|
||||||
result = dataset.deSerialize(&reply, &size, SerializeIF::Endianness::LITTLE);
|
result = dataset.deSerialize(&reply, &size, SerializeIF::Endianness::LITTLE);
|
||||||
if (result != RETURN_OK) {
|
if (result != returnvalue::OK) {
|
||||||
sif::warning << "StarTrackerHandler::handleActionReplySet Deserialization failed" << std::endl;
|
sif::warning << "StarTrackerHandler::handleActionReplySet Deserialization failed" << std::endl;
|
||||||
}
|
}
|
||||||
dataset.setValidityBufferGeneration(true);
|
dataset.setValidityBufferGeneration(true);
|
||||||
dataset.setValidity(true, true);
|
dataset.setValidity(true, true);
|
||||||
result = dataset.commit(TIMEOUT_TYPE, MUTEX_TIMEOUT);
|
result = dataset.commit(TIMEOUT_TYPE, MUTEX_TIMEOUT);
|
||||||
if (result != RETURN_OK) {
|
if (result != returnvalue::OK) {
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
#if OBSW_VERBOSE_LEVEL >= 1 && OBSW_DEBUG_STARTRACKER == 1
|
#if OBSW_VERBOSE_LEVEL >= 1 && OBSW_DEBUG_STARTRACKER == 1
|
||||||
@ -2080,5 +2080,5 @@ ReturnValue_t StarTrackerHandler::checkCommand(ActionId_t actionId) {
|
|||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
return RETURN_OK;
|
return returnvalue::OK;
|
||||||
}
|
}
|
||||||
|
@ -314,7 +314,7 @@ class StarTrackerHandler : public DeviceHandlerBase {
|
|||||||
* @param commandData Pointer to received command data
|
* @param commandData Pointer to received command data
|
||||||
* @param commandDataLen Size of received command data
|
* @param commandDataLen Size of received command data
|
||||||
*
|
*
|
||||||
* @return RETURN_OK if start of execution was successful, otherwise error return value
|
* @return returnvalue::OK if start of execution was successful, otherwise error return value
|
||||||
*/
|
*/
|
||||||
ReturnValue_t executeFlashReadCommand(const uint8_t* commandData, size_t commandDataLen);
|
ReturnValue_t executeFlashReadCommand(const uint8_t* commandData, size_t commandDataLen);
|
||||||
|
|
||||||
@ -385,7 +385,7 @@ class StarTrackerHandler : public DeviceHandlerBase {
|
|||||||
* @param commandDataLen Length of command
|
* @param commandDataLen Length of command
|
||||||
* @param paramSet The object defining the command generation
|
* @param paramSet The object defining the command generation
|
||||||
*
|
*
|
||||||
* @return RETURN_OK if successful, otherwise error return Value
|
* @return returnvalue::OK if successful, otherwise error return Value
|
||||||
*/
|
*/
|
||||||
ReturnValue_t prepareParamCommand(const uint8_t* commandData, size_t commandDataLen,
|
ReturnValue_t prepareParamCommand(const uint8_t* commandData, size_t commandDataLen,
|
||||||
ArcsecJsonParamBase& paramSet);
|
ArcsecJsonParamBase& paramSet);
|
||||||
@ -454,7 +454,7 @@ class StarTrackerHandler : public DeviceHandlerBase {
|
|||||||
* @param dataset Dataset where reply data will be written to
|
* @param dataset Dataset where reply data will be written to
|
||||||
* @param size Size of the dataset
|
* @param size Size of the dataset
|
||||||
*
|
*
|
||||||
* @return RETURN_OK if successful, otherwise error return value
|
* @return returnvalue::OK if successful, otherwise error return value
|
||||||
*/
|
*/
|
||||||
ReturnValue_t handleTm(LocalPoolDataSetBase& dataset, size_t size);
|
ReturnValue_t handleTm(LocalPoolDataSetBase& dataset, size_t size);
|
||||||
|
|
||||||
@ -463,7 +463,7 @@ class StarTrackerHandler : public DeviceHandlerBase {
|
|||||||
*
|
*
|
||||||
* @param actioId Id of received command
|
* @param actioId Id of received command
|
||||||
*
|
*
|
||||||
* @return RETURN_OK if star tracker is in valid mode, otherwise error return value
|
* @return returnvalue::OK if star tracker is in valid mode, otherwise error return value
|
||||||
*/
|
*/
|
||||||
ReturnValue_t checkCommand(ActionId_t actionId);
|
ReturnValue_t checkCommand(ActionId_t actionId);
|
||||||
|
|
||||||
|
File diff suppressed because it is too large
Load Diff
@ -19,14 +19,14 @@ ReturnValue_t StrHelper::initialize() {
|
|||||||
sdcMan = SdCardManager::instance();
|
sdcMan = SdCardManager::instance();
|
||||||
if (sdcMan == nullptr) {
|
if (sdcMan == nullptr) {
|
||||||
sif::warning << "StrHelper::initialize: Invalid SD Card Manager" << std::endl;
|
sif::warning << "StrHelper::initialize: Invalid SD Card Manager" << std::endl;
|
||||||
return RETURN_FAILED;
|
return returnvalue::FAILED;
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
return RETURN_OK;
|
return returnvalue::OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
ReturnValue_t StrHelper::performOperation(uint8_t operationCode) {
|
ReturnValue_t StrHelper::performOperation(uint8_t operationCode) {
|
||||||
ReturnValue_t result = RETURN_OK;
|
ReturnValue_t result = returnvalue::OK;
|
||||||
semaphore.acquire();
|
semaphore.acquire();
|
||||||
while (true) {
|
while (true) {
|
||||||
switch (internalState) {
|
switch (internalState) {
|
||||||
@ -36,7 +36,7 @@ ReturnValue_t StrHelper::performOperation(uint8_t operationCode) {
|
|||||||
}
|
}
|
||||||
case InternalState::UPLOAD_IMAGE: {
|
case InternalState::UPLOAD_IMAGE: {
|
||||||
result = performImageUpload();
|
result = performImageUpload();
|
||||||
if (result == RETURN_OK) {
|
if (result == returnvalue::OK) {
|
||||||
triggerEvent(IMAGE_UPLOAD_SUCCESSFUL);
|
triggerEvent(IMAGE_UPLOAD_SUCCESSFUL);
|
||||||
} else {
|
} else {
|
||||||
triggerEvent(IMAGE_UPLOAD_FAILED);
|
triggerEvent(IMAGE_UPLOAD_FAILED);
|
||||||
@ -46,7 +46,7 @@ ReturnValue_t StrHelper::performOperation(uint8_t operationCode) {
|
|||||||
}
|
}
|
||||||
case InternalState::DOWNLOAD_IMAGE: {
|
case InternalState::DOWNLOAD_IMAGE: {
|
||||||
result = performImageDownload();
|
result = performImageDownload();
|
||||||
if (result == RETURN_OK) {
|
if (result == returnvalue::OK) {
|
||||||
triggerEvent(IMAGE_DOWNLOAD_SUCCESSFUL);
|
triggerEvent(IMAGE_DOWNLOAD_SUCCESSFUL);
|
||||||
} else {
|
} else {
|
||||||
triggerEvent(IMAGE_DOWNLOAD_FAILED);
|
triggerEvent(IMAGE_DOWNLOAD_FAILED);
|
||||||
@ -56,7 +56,7 @@ ReturnValue_t StrHelper::performOperation(uint8_t operationCode) {
|
|||||||
}
|
}
|
||||||
case InternalState::FLASH_READ: {
|
case InternalState::FLASH_READ: {
|
||||||
result = performFlashRead();
|
result = performFlashRead();
|
||||||
if (result == RETURN_OK) {
|
if (result == returnvalue::OK) {
|
||||||
triggerEvent(FLASH_READ_SUCCESSFUL);
|
triggerEvent(FLASH_READ_SUCCESSFUL);
|
||||||
} else {
|
} else {
|
||||||
triggerEvent(FLASH_READ_FAILED);
|
triggerEvent(FLASH_READ_FAILED);
|
||||||
@ -66,7 +66,7 @@ ReturnValue_t StrHelper::performOperation(uint8_t operationCode) {
|
|||||||
}
|
}
|
||||||
case InternalState::FIRMWARE_UPDATE: {
|
case InternalState::FIRMWARE_UPDATE: {
|
||||||
result = performFirmwareUpdate();
|
result = performFirmwareUpdate();
|
||||||
if (result == RETURN_OK) {
|
if (result == returnvalue::OK) {
|
||||||
triggerEvent(FIRMWARE_UPDATE_SUCCESSFUL);
|
triggerEvent(FIRMWARE_UPDATE_SUCCESSFUL);
|
||||||
} else {
|
} else {
|
||||||
triggerEvent(FIRMWARE_UPDATE_FAILED);
|
triggerEvent(FIRMWARE_UPDATE_FAILED);
|
||||||
@ -85,9 +85,9 @@ ReturnValue_t StrHelper::setComIF(DeviceCommunicationIF* communicationInterface_
|
|||||||
uartComIF = dynamic_cast<UartComIF*>(communicationInterface_);
|
uartComIF = dynamic_cast<UartComIF*>(communicationInterface_);
|
||||||
if (uartComIF == nullptr) {
|
if (uartComIF == nullptr) {
|
||||||
sif::warning << "StrHelper::initialize: Invalid uart com if" << std::endl;
|
sif::warning << "StrHelper::initialize: Invalid uart com if" << std::endl;
|
||||||
return RETURN_FAILED;
|
return returnvalue::FAILED;
|
||||||
}
|
}
|
||||||
return RETURN_OK;
|
return returnvalue::OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
void StrHelper::setComCookie(CookieIF* comCookie_) { comCookie = comCookie_; }
|
void StrHelper::setComCookie(CookieIF* comCookie_) { comCookie = comCookie_; }
|
||||||
@ -95,7 +95,7 @@ void StrHelper::setComCookie(CookieIF* comCookie_) { comCookie = comCookie_; }
|
|||||||
ReturnValue_t StrHelper::startImageUpload(std::string fullname) {
|
ReturnValue_t StrHelper::startImageUpload(std::string fullname) {
|
||||||
#ifdef XIPHOS_Q7S
|
#ifdef XIPHOS_Q7S
|
||||||
ReturnValue_t result = checkPath(fullname);
|
ReturnValue_t result = checkPath(fullname);
|
||||||
if (result != RETURN_OK) {
|
if (result != returnvalue::OK) {
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
@ -106,13 +106,13 @@ ReturnValue_t StrHelper::startImageUpload(std::string fullname) {
|
|||||||
internalState = InternalState::UPLOAD_IMAGE;
|
internalState = InternalState::UPLOAD_IMAGE;
|
||||||
semaphore.release();
|
semaphore.release();
|
||||||
terminate = false;
|
terminate = false;
|
||||||
return RETURN_OK;
|
return returnvalue::OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
ReturnValue_t StrHelper::startImageDownload(std::string path) {
|
ReturnValue_t StrHelper::startImageDownload(std::string path) {
|
||||||
#ifdef XIPHOS_Q7S
|
#ifdef XIPHOS_Q7S
|
||||||
ReturnValue_t result = checkPath(path);
|
ReturnValue_t result = checkPath(path);
|
||||||
if (result != RETURN_OK) {
|
if (result != returnvalue::OK) {
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
@ -123,7 +123,7 @@ ReturnValue_t StrHelper::startImageDownload(std::string path) {
|
|||||||
internalState = InternalState::DOWNLOAD_IMAGE;
|
internalState = InternalState::DOWNLOAD_IMAGE;
|
||||||
terminate = false;
|
terminate = false;
|
||||||
semaphore.release();
|
semaphore.release();
|
||||||
return RETURN_OK;
|
return returnvalue::OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
void StrHelper::stopProcess() { terminate = true; }
|
void StrHelper::stopProcess() { terminate = true; }
|
||||||
@ -135,7 +135,7 @@ void StrHelper::setFlashReadFilename(std::string filename) { flashRead.filename
|
|||||||
ReturnValue_t StrHelper::startFirmwareUpdate(std::string fullname) {
|
ReturnValue_t StrHelper::startFirmwareUpdate(std::string fullname) {
|
||||||
#ifdef XIPHOS_Q7S
|
#ifdef XIPHOS_Q7S
|
||||||
ReturnValue_t result = checkPath(fullname);
|
ReturnValue_t result = checkPath(fullname);
|
||||||
if (result != RETURN_OK) {
|
if (result != returnvalue::OK) {
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
@ -148,13 +148,13 @@ ReturnValue_t StrHelper::startFirmwareUpdate(std::string fullname) {
|
|||||||
internalState = InternalState::FIRMWARE_UPDATE;
|
internalState = InternalState::FIRMWARE_UPDATE;
|
||||||
semaphore.release();
|
semaphore.release();
|
||||||
terminate = false;
|
terminate = false;
|
||||||
return RETURN_OK;
|
return returnvalue::OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
ReturnValue_t StrHelper::startFlashRead(std::string path, uint8_t startRegion, uint32_t length) {
|
ReturnValue_t StrHelper::startFlashRead(std::string path, uint8_t startRegion, uint32_t length) {
|
||||||
#ifdef XIPHOS_Q7S
|
#ifdef XIPHOS_Q7S
|
||||||
ReturnValue_t result = checkPath(path);
|
ReturnValue_t result = checkPath(path);
|
||||||
if (result != RETURN_OK) {
|
if (result != returnvalue::OK) {
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
@ -167,7 +167,7 @@ ReturnValue_t StrHelper::startFlashRead(std::string path, uint8_t startRegion, u
|
|||||||
internalState = InternalState::FLASH_READ;
|
internalState = InternalState::FLASH_READ;
|
||||||
semaphore.release();
|
semaphore.release();
|
||||||
terminate = false;
|
terminate = false;
|
||||||
return RETURN_OK;
|
return returnvalue::OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
void StrHelper::disableTimestamping() { timestamping = false; }
|
void StrHelper::disableTimestamping() { timestamping = false; }
|
||||||
@ -192,11 +192,11 @@ ReturnValue_t StrHelper::performImageDownload() {
|
|||||||
while (downloadReq.position < ImageDownload::LAST_POSITION) {
|
while (downloadReq.position < ImageDownload::LAST_POSITION) {
|
||||||
if (terminate) {
|
if (terminate) {
|
||||||
file.close();
|
file.close();
|
||||||
return RETURN_OK;
|
return returnvalue::OK;
|
||||||
}
|
}
|
||||||
arc_pack_download_action_req(&downloadReq, commandBuffer, &size);
|
arc_pack_download_action_req(&downloadReq, commandBuffer, &size);
|
||||||
result = sendAndRead(size, downloadReq.position);
|
result = sendAndRead(size, downloadReq.position);
|
||||||
if (result != RETURN_OK) {
|
if (result != returnvalue::OK) {
|
||||||
if (retries < CONFIG_MAX_DOWNLOAD_RETRIES) {
|
if (retries < CONFIG_MAX_DOWNLOAD_RETRIES) {
|
||||||
uartComIF->flushUartRxBuffer(comCookie);
|
uartComIF->flushUartRxBuffer(comCookie);
|
||||||
retries++;
|
retries++;
|
||||||
@ -206,7 +206,7 @@ ReturnValue_t StrHelper::performImageDownload() {
|
|||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
result = checkActionReply();
|
result = checkActionReply();
|
||||||
if (result != RETURN_OK) {
|
if (result != returnvalue::OK) {
|
||||||
if (retries < CONFIG_MAX_DOWNLOAD_RETRIES) {
|
if (retries < CONFIG_MAX_DOWNLOAD_RETRIES) {
|
||||||
uartComIF->flushUartRxBuffer(comCookie);
|
uartComIF->flushUartRxBuffer(comCookie);
|
||||||
retries++;
|
retries++;
|
||||||
@ -216,7 +216,7 @@ ReturnValue_t StrHelper::performImageDownload() {
|
|||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
result = checkReplyPosition(downloadReq.position);
|
result = checkReplyPosition(downloadReq.position);
|
||||||
if (result != RETURN_OK) {
|
if (result != returnvalue::OK) {
|
||||||
if (retries < CONFIG_MAX_DOWNLOAD_RETRIES) {
|
if (retries < CONFIG_MAX_DOWNLOAD_RETRIES) {
|
||||||
uartComIF->flushUartRxBuffer(comCookie);
|
uartComIF->flushUartRxBuffer(comCookie);
|
||||||
retries++;
|
retries++;
|
||||||
@ -234,11 +234,11 @@ ReturnValue_t StrHelper::performImageDownload() {
|
|||||||
retries = 0;
|
retries = 0;
|
||||||
}
|
}
|
||||||
file.close();
|
file.close();
|
||||||
return RETURN_OK;
|
return returnvalue::OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
ReturnValue_t StrHelper::performImageUpload() {
|
ReturnValue_t StrHelper::performImageUpload() {
|
||||||
ReturnValue_t result = RETURN_OK;
|
ReturnValue_t result = returnvalue::OK;
|
||||||
uint32_t size = 0;
|
uint32_t size = 0;
|
||||||
uint32_t imageSize = 0;
|
uint32_t imageSize = 0;
|
||||||
struct UploadActionRequest uploadReq;
|
struct UploadActionRequest uploadReq;
|
||||||
@ -247,7 +247,7 @@ ReturnValue_t StrHelper::performImageUpload() {
|
|||||||
if (not std::filesystem::exists(uploadImage.uploadFile)) {
|
if (not std::filesystem::exists(uploadImage.uploadFile)) {
|
||||||
triggerEvent(STR_HELPER_FILE_NOT_EXISTS, static_cast<uint32_t>(internalState));
|
triggerEvent(STR_HELPER_FILE_NOT_EXISTS, static_cast<uint32_t>(internalState));
|
||||||
internalState = InternalState::IDLE;
|
internalState = InternalState::IDLE;
|
||||||
return RETURN_FAILED;
|
return returnvalue::FAILED;
|
||||||
}
|
}
|
||||||
std::ifstream file(uploadImage.uploadFile, std::ifstream::binary);
|
std::ifstream file(uploadImage.uploadFile, std::ifstream::binary);
|
||||||
// Set position of next character to end of file input stream
|
// Set position of next character to end of file input stream
|
||||||
@ -260,18 +260,18 @@ ReturnValue_t StrHelper::performImageUpload() {
|
|||||||
while ((uploadReq.position + 1) * SIZE_IMAGE_PART < imageSize) {
|
while ((uploadReq.position + 1) * SIZE_IMAGE_PART < imageSize) {
|
||||||
if (terminate) {
|
if (terminate) {
|
||||||
file.close();
|
file.close();
|
||||||
return RETURN_OK;
|
return returnvalue::OK;
|
||||||
}
|
}
|
||||||
file.seekg(uploadReq.position * SIZE_IMAGE_PART, file.beg);
|
file.seekg(uploadReq.position * SIZE_IMAGE_PART, file.beg);
|
||||||
file.read(reinterpret_cast<char*>(uploadReq.data), SIZE_IMAGE_PART);
|
file.read(reinterpret_cast<char*>(uploadReq.data), SIZE_IMAGE_PART);
|
||||||
arc_pack_upload_action_req(&uploadReq, commandBuffer, &size);
|
arc_pack_upload_action_req(&uploadReq, commandBuffer, &size);
|
||||||
result = sendAndRead(size, uploadReq.position);
|
result = sendAndRead(size, uploadReq.position);
|
||||||
if (result != RETURN_OK) {
|
if (result != returnvalue::OK) {
|
||||||
file.close();
|
file.close();
|
||||||
return RETURN_FAILED;
|
return returnvalue::FAILED;
|
||||||
}
|
}
|
||||||
result = checkActionReply();
|
result = checkActionReply();
|
||||||
if (result != RETURN_OK) {
|
if (result != returnvalue::OK) {
|
||||||
file.close();
|
file.close();
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
@ -288,25 +288,25 @@ ReturnValue_t StrHelper::performImageUpload() {
|
|||||||
uploadReq.position++;
|
uploadReq.position++;
|
||||||
arc_pack_upload_action_req(&uploadReq, commandBuffer, &size);
|
arc_pack_upload_action_req(&uploadReq, commandBuffer, &size);
|
||||||
result = sendAndRead(size, uploadReq.position);
|
result = sendAndRead(size, uploadReq.position);
|
||||||
if (result != RETURN_OK) {
|
if (result != returnvalue::OK) {
|
||||||
return RETURN_FAILED;
|
return returnvalue::FAILED;
|
||||||
}
|
}
|
||||||
result = checkActionReply();
|
result = checkActionReply();
|
||||||
if (result != RETURN_OK) {
|
if (result != returnvalue::OK) {
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
#if OBSW_DEBUG_STARTRACKER == 1
|
#if OBSW_DEBUG_STARTRACKER == 1
|
||||||
progressPrinter.print((uploadReq.position + 1) * SIZE_IMAGE_PART);
|
progressPrinter.print((uploadReq.position + 1) * SIZE_IMAGE_PART);
|
||||||
#endif /* OBSW_DEBUG_STARTRACKER == 1 */
|
#endif /* OBSW_DEBUG_STARTRACKER == 1 */
|
||||||
return RETURN_OK;
|
return returnvalue::OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
ReturnValue_t StrHelper::performFirmwareUpdate() {
|
ReturnValue_t StrHelper::performFirmwareUpdate() {
|
||||||
using namespace startracker;
|
using namespace startracker;
|
||||||
ReturnValue_t result = RETURN_OK;
|
ReturnValue_t result = returnvalue::OK;
|
||||||
result = unlockAndEraseRegions(static_cast<uint32_t>(startracker::FirmwareRegions::FIRST),
|
result = unlockAndEraseRegions(static_cast<uint32_t>(startracker::FirmwareRegions::FIRST),
|
||||||
static_cast<uint32_t>(startracker::FirmwareRegions::LAST));
|
static_cast<uint32_t>(startracker::FirmwareRegions::LAST));
|
||||||
if (result != RETURN_OK) {
|
if (result != returnvalue::OK) {
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
result = performFlashWrite();
|
result = performFlashWrite();
|
||||||
@ -314,7 +314,7 @@ ReturnValue_t StrHelper::performFirmwareUpdate() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
ReturnValue_t StrHelper::performFlashWrite() {
|
ReturnValue_t StrHelper::performFlashWrite() {
|
||||||
ReturnValue_t result = RETURN_OK;
|
ReturnValue_t result = returnvalue::OK;
|
||||||
uint32_t size = 0;
|
uint32_t size = 0;
|
||||||
uint32_t bytesWritten = 0;
|
uint32_t bytesWritten = 0;
|
||||||
uint32_t fileSize = 0;
|
uint32_t fileSize = 0;
|
||||||
@ -322,14 +322,14 @@ ReturnValue_t StrHelper::performFlashWrite() {
|
|||||||
if (not std::filesystem::exists(flashWrite.fullname)) {
|
if (not std::filesystem::exists(flashWrite.fullname)) {
|
||||||
triggerEvent(STR_HELPER_FILE_NOT_EXISTS, static_cast<uint32_t>(internalState));
|
triggerEvent(STR_HELPER_FILE_NOT_EXISTS, static_cast<uint32_t>(internalState));
|
||||||
internalState = InternalState::IDLE;
|
internalState = InternalState::IDLE;
|
||||||
return RETURN_FAILED;
|
return returnvalue::FAILED;
|
||||||
}
|
}
|
||||||
std::ifstream file(flashWrite.fullname, std::ifstream::binary);
|
std::ifstream file(flashWrite.fullname, std::ifstream::binary);
|
||||||
file.seekg(0, file.end);
|
file.seekg(0, file.end);
|
||||||
fileSize = file.tellg();
|
fileSize = file.tellg();
|
||||||
if (fileSize > FLASH_REGION_SIZE * (flashWrite.lastRegion - flashWrite.firstRegion)) {
|
if (fileSize > FLASH_REGION_SIZE * (flashWrite.lastRegion - flashWrite.firstRegion)) {
|
||||||
sif::warning << "StrHelper::performFlashWrite: Invalid file" << std::endl;
|
sif::warning << "StrHelper::performFlashWrite: Invalid file" << std::endl;
|
||||||
return RETURN_FAILED;
|
return returnvalue::FAILED;
|
||||||
}
|
}
|
||||||
#if OBSW_DEBUG_STARTRACKER == 1
|
#if OBSW_DEBUG_STARTRACKER == 1
|
||||||
ProgressPrinter progressPrinter("Flash write", fileSize);
|
ProgressPrinter progressPrinter("Flash write", fileSize);
|
||||||
@ -341,7 +341,7 @@ ReturnValue_t StrHelper::performFlashWrite() {
|
|||||||
for (uint32_t idx = 0; idx < fileChunks; idx++) {
|
for (uint32_t idx = 0; idx < fileChunks; idx++) {
|
||||||
if (terminate) {
|
if (terminate) {
|
||||||
file.close();
|
file.close();
|
||||||
return RETURN_OK;
|
return returnvalue::OK;
|
||||||
}
|
}
|
||||||
file.seekg(idx * CHUNK_SIZE, file.beg);
|
file.seekg(idx * CHUNK_SIZE, file.beg);
|
||||||
file.read(reinterpret_cast<char*>(req.data), CHUNK_SIZE);
|
file.read(reinterpret_cast<char*>(req.data), CHUNK_SIZE);
|
||||||
@ -352,12 +352,12 @@ ReturnValue_t StrHelper::performFlashWrite() {
|
|||||||
req.address = bytesWritten;
|
req.address = bytesWritten;
|
||||||
arc_pack_write_action_req(&req, commandBuffer, &size);
|
arc_pack_write_action_req(&req, commandBuffer, &size);
|
||||||
result = sendAndRead(size, req.address);
|
result = sendAndRead(size, req.address);
|
||||||
if (result != RETURN_OK) {
|
if (result != returnvalue::OK) {
|
||||||
file.close();
|
file.close();
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
result = checkActionReply();
|
result = checkActionReply();
|
||||||
if (result != RETURN_OK) {
|
if (result != returnvalue::OK) {
|
||||||
file.close();
|
file.close();
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
@ -379,17 +379,17 @@ ReturnValue_t StrHelper::performFlashWrite() {
|
|||||||
bytesWritten += remainingBytes;
|
bytesWritten += remainingBytes;
|
||||||
arc_pack_write_action_req(&req, commandBuffer, &size);
|
arc_pack_write_action_req(&req, commandBuffer, &size);
|
||||||
result = sendAndRead(size, req.address);
|
result = sendAndRead(size, req.address);
|
||||||
if (result != RETURN_OK) {
|
if (result != returnvalue::OK) {
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
result = checkActionReply();
|
result = checkActionReply();
|
||||||
if (result != RETURN_OK) {
|
if (result != returnvalue::OK) {
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
#if OBSW_DEBUG_STARTRACKER == 1
|
#if OBSW_DEBUG_STARTRACKER == 1
|
||||||
progressPrinter.print(fileSize);
|
progressPrinter.print(fileSize);
|
||||||
#endif /* OBSW_DEBUG_STARTRACKER == 1 */
|
#endif /* OBSW_DEBUG_STARTRACKER == 1 */
|
||||||
return RETURN_OK;
|
return returnvalue::OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
ReturnValue_t StrHelper::performFlashRead() {
|
ReturnValue_t StrHelper::performFlashRead() {
|
||||||
@ -412,7 +412,7 @@ ReturnValue_t StrHelper::performFlashRead() {
|
|||||||
req.address = 0;
|
req.address = 0;
|
||||||
while (bytesRead < flashRead.size) {
|
while (bytesRead < flashRead.size) {
|
||||||
if (terminate) {
|
if (terminate) {
|
||||||
return RETURN_OK;
|
return returnvalue::OK;
|
||||||
}
|
}
|
||||||
if ((flashRead.size - bytesRead) < CHUNK_SIZE) {
|
if ((flashRead.size - bytesRead) < CHUNK_SIZE) {
|
||||||
req.length = flashRead.size - bytesRead;
|
req.length = flashRead.size - bytesRead;
|
||||||
@ -421,7 +421,7 @@ ReturnValue_t StrHelper::performFlashRead() {
|
|||||||
}
|
}
|
||||||
arc_pack_read_action_req(&req, commandBuffer, &size);
|
arc_pack_read_action_req(&req, commandBuffer, &size);
|
||||||
result = sendAndRead(size, req.address);
|
result = sendAndRead(size, req.address);
|
||||||
if (result != RETURN_OK) {
|
if (result != returnvalue::OK) {
|
||||||
if (retries < CONFIG_MAX_DOWNLOAD_RETRIES) {
|
if (retries < CONFIG_MAX_DOWNLOAD_RETRIES) {
|
||||||
uartComIF->flushUartRxBuffer(comCookie);
|
uartComIF->flushUartRxBuffer(comCookie);
|
||||||
retries++;
|
retries++;
|
||||||
@ -431,7 +431,7 @@ ReturnValue_t StrHelper::performFlashRead() {
|
|||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
result = checkActionReply();
|
result = checkActionReply();
|
||||||
if (result != RETURN_OK) {
|
if (result != returnvalue::OK) {
|
||||||
if (retries < CONFIG_MAX_DOWNLOAD_RETRIES) {
|
if (retries < CONFIG_MAX_DOWNLOAD_RETRIES) {
|
||||||
uartComIF->flushUartRxBuffer(comCookie);
|
uartComIF->flushUartRxBuffer(comCookie);
|
||||||
retries++;
|
retries++;
|
||||||
@ -454,12 +454,12 @@ ReturnValue_t StrHelper::performFlashRead() {
|
|||||||
#endif /* OBSW_DEBUG_STARTRACKER == 1 */
|
#endif /* OBSW_DEBUG_STARTRACKER == 1 */
|
||||||
}
|
}
|
||||||
file.close();
|
file.close();
|
||||||
return RETURN_OK;
|
return returnvalue::OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
ReturnValue_t StrHelper::sendAndRead(size_t size, uint32_t parameter, uint32_t delayMs) {
|
ReturnValue_t StrHelper::sendAndRead(size_t size, uint32_t parameter, uint32_t delayMs) {
|
||||||
ReturnValue_t result = RETURN_OK;
|
ReturnValue_t result = returnvalue::OK;
|
||||||
ReturnValue_t decResult = RETURN_OK;
|
ReturnValue_t decResult = returnvalue::OK;
|
||||||
size_t receivedDataLen = 0;
|
size_t receivedDataLen = 0;
|
||||||
uint8_t* receivedData = nullptr;
|
uint8_t* receivedData = nullptr;
|
||||||
size_t bytesLeft = 0;
|
size_t bytesLeft = 0;
|
||||||
@ -467,10 +467,10 @@ ReturnValue_t StrHelper::sendAndRead(size_t size, uint32_t parameter, uint32_t d
|
|||||||
datalinkLayer.encodeFrame(commandBuffer, size);
|
datalinkLayer.encodeFrame(commandBuffer, size);
|
||||||
result = uartComIF->sendMessage(comCookie, datalinkLayer.getEncodedFrame(),
|
result = uartComIF->sendMessage(comCookie, datalinkLayer.getEncodedFrame(),
|
||||||
datalinkLayer.getEncodedLength());
|
datalinkLayer.getEncodedLength());
|
||||||
if (result != RETURN_OK) {
|
if (result != returnvalue::OK) {
|
||||||
sif::warning << "StrHelper::sendAndRead: Failed to send packet" << std::endl;
|
sif::warning << "StrHelper::sendAndRead: Failed to send packet" << std::endl;
|
||||||
triggerEvent(STR_HELPER_SENDING_PACKET_FAILED, result, parameter);
|
triggerEvent(STR_HELPER_SENDING_PACKET_FAILED, result, parameter);
|
||||||
return RETURN_FAILED;
|
return returnvalue::FAILED;
|
||||||
}
|
}
|
||||||
decResult = ArcsecDatalinkLayer::DEC_IN_PROGRESS;
|
decResult = ArcsecDatalinkLayer::DEC_IN_PROGRESS;
|
||||||
while (decResult == ArcsecDatalinkLayer::DEC_IN_PROGRESS) {
|
while (decResult == ArcsecDatalinkLayer::DEC_IN_PROGRESS) {
|
||||||
@ -479,23 +479,23 @@ ReturnValue_t StrHelper::sendAndRead(size_t size, uint32_t parameter, uint32_t d
|
|||||||
while (delay.isBusy()) {
|
while (delay.isBusy()) {
|
||||||
}
|
}
|
||||||
result = uartComIF->requestReceiveMessage(comCookie, startracker::MAX_FRAME_SIZE * 2 + 2);
|
result = uartComIF->requestReceiveMessage(comCookie, startracker::MAX_FRAME_SIZE * 2 + 2);
|
||||||
if (result != RETURN_OK) {
|
if (result != returnvalue::OK) {
|
||||||
sif::warning << "StrHelper::sendAndRead: Failed to request reply" << std::endl;
|
sif::warning << "StrHelper::sendAndRead: Failed to request reply" << std::endl;
|
||||||
triggerEvent(STR_HELPER_REQUESTING_MSG_FAILED, result, parameter);
|
triggerEvent(STR_HELPER_REQUESTING_MSG_FAILED, result, parameter);
|
||||||
return RETURN_FAILED;
|
return returnvalue::FAILED;
|
||||||
}
|
}
|
||||||
result = uartComIF->readReceivedMessage(comCookie, &receivedData, &receivedDataLen);
|
result = uartComIF->readReceivedMessage(comCookie, &receivedData, &receivedDataLen);
|
||||||
if (result != RETURN_OK) {
|
if (result != returnvalue::OK) {
|
||||||
sif::warning << "StrHelper::sendAndRead: Failed to read received message" << std::endl;
|
sif::warning << "StrHelper::sendAndRead: Failed to read received message" << std::endl;
|
||||||
triggerEvent(STR_HELPER_READING_REPLY_FAILED, result, parameter);
|
triggerEvent(STR_HELPER_READING_REPLY_FAILED, result, parameter);
|
||||||
return RETURN_FAILED;
|
return returnvalue::FAILED;
|
||||||
}
|
}
|
||||||
if (receivedDataLen == 0 && missedReplies < MAX_POLLS) {
|
if (receivedDataLen == 0 && missedReplies < MAX_POLLS) {
|
||||||
missedReplies++;
|
missedReplies++;
|
||||||
continue;
|
continue;
|
||||||
} else if ((receivedDataLen == 0) && (missedReplies >= MAX_POLLS)) {
|
} else if ((receivedDataLen == 0) && (missedReplies >= MAX_POLLS)) {
|
||||||
triggerEvent(STR_HELPER_NO_REPLY, parameter);
|
triggerEvent(STR_HELPER_NO_REPLY, parameter);
|
||||||
return RETURN_FAILED;
|
return returnvalue::FAILED;
|
||||||
} else {
|
} else {
|
||||||
missedReplies = 0;
|
missedReplies = 0;
|
||||||
}
|
}
|
||||||
@ -504,14 +504,14 @@ ReturnValue_t StrHelper::sendAndRead(size_t size, uint32_t parameter, uint32_t d
|
|||||||
// This should never happen
|
// This should never happen
|
||||||
sif::warning << "StrHelper::sendAndRead: Bytes left after decoding" << std::endl;
|
sif::warning << "StrHelper::sendAndRead: Bytes left after decoding" << std::endl;
|
||||||
triggerEvent(STR_HELPER_COM_ERROR, result, parameter);
|
triggerEvent(STR_HELPER_COM_ERROR, result, parameter);
|
||||||
return RETURN_FAILED;
|
return returnvalue::FAILED;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (decResult != RETURN_OK) {
|
if (decResult != returnvalue::OK) {
|
||||||
triggerEvent(STR_HELPER_DEC_ERROR, decResult, parameter);
|
triggerEvent(STR_HELPER_DEC_ERROR, decResult, parameter);
|
||||||
return RETURN_FAILED;
|
return returnvalue::FAILED;
|
||||||
}
|
}
|
||||||
return RETURN_OK;
|
return returnvalue::OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
ReturnValue_t StrHelper::checkActionReply() {
|
ReturnValue_t StrHelper::checkActionReply() {
|
||||||
@ -526,7 +526,7 @@ ReturnValue_t StrHelper::checkActionReply() {
|
|||||||
<< static_cast<unsigned int>(status) << std::endl;
|
<< static_cast<unsigned int>(status) << std::endl;
|
||||||
return STATUS_ERROR;
|
return STATUS_ERROR;
|
||||||
}
|
}
|
||||||
return RETURN_OK;
|
return returnvalue::OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
ReturnValue_t StrHelper::checkReplyPosition(uint32_t expectedPosition) {
|
ReturnValue_t StrHelper::checkReplyPosition(uint32_t expectedPosition) {
|
||||||
@ -534,9 +534,9 @@ ReturnValue_t StrHelper::checkReplyPosition(uint32_t expectedPosition) {
|
|||||||
std::memcpy(&receivedPosition, datalinkLayer.getReply() + POS_OFFSET, sizeof(receivedPosition));
|
std::memcpy(&receivedPosition, datalinkLayer.getReply() + POS_OFFSET, sizeof(receivedPosition));
|
||||||
if (receivedPosition != expectedPosition) {
|
if (receivedPosition != expectedPosition) {
|
||||||
triggerEvent(POSITION_MISMATCH, receivedPosition);
|
triggerEvent(POSITION_MISMATCH, receivedPosition);
|
||||||
return RETURN_FAILED;
|
return returnvalue::FAILED;
|
||||||
}
|
}
|
||||||
return RETURN_OK;
|
return returnvalue::OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef XIPHOS_Q7S
|
#ifdef XIPHOS_Q7S
|
||||||
@ -554,12 +554,12 @@ ReturnValue_t StrHelper::checkPath(std::string name) {
|
|||||||
return SD_NOT_MOUNTED;
|
return SD_NOT_MOUNTED;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return RETURN_OK;
|
return returnvalue::OK;
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
ReturnValue_t StrHelper::unlockAndEraseRegions(uint32_t from, uint32_t to) {
|
ReturnValue_t StrHelper::unlockAndEraseRegions(uint32_t from, uint32_t to) {
|
||||||
ReturnValue_t result = RETURN_OK;
|
ReturnValue_t result = returnvalue::OK;
|
||||||
#if OBSW_DEBUG_STARTRACKER == 1
|
#if OBSW_DEBUG_STARTRACKER == 1
|
||||||
ProgressPrinter progressPrinter("Unlock and erase", to - from);
|
ProgressPrinter progressPrinter("Unlock and erase", to - from);
|
||||||
#endif /* OBSW_DEBUG_STARTRACKER == 1 */
|
#endif /* OBSW_DEBUG_STARTRACKER == 1 */
|
||||||
@ -572,7 +572,7 @@ ReturnValue_t StrHelper::unlockAndEraseRegions(uint32_t from, uint32_t to) {
|
|||||||
arc_pack_unlock_action_req(&unlockReq, commandBuffer, &size);
|
arc_pack_unlock_action_req(&unlockReq, commandBuffer, &size);
|
||||||
sendAndRead(size, unlockReq.region);
|
sendAndRead(size, unlockReq.region);
|
||||||
result = checkActionReply();
|
result = checkActionReply();
|
||||||
if (result != RETURN_OK) {
|
if (result != returnvalue::OK) {
|
||||||
sif::warning << "StrHelper::unlockAndEraseRegions: Failed to unlock region with id "
|
sif::warning << "StrHelper::unlockAndEraseRegions: Failed to unlock region with id "
|
||||||
<< static_cast<unsigned int>(unlockReq.region) << std::endl;
|
<< static_cast<unsigned int>(unlockReq.region) << std::endl;
|
||||||
return result;
|
return result;
|
||||||
@ -580,7 +580,7 @@ ReturnValue_t StrHelper::unlockAndEraseRegions(uint32_t from, uint32_t to) {
|
|||||||
eraseReq.region = idx;
|
eraseReq.region = idx;
|
||||||
arc_pack_erase_action_req(&eraseReq, commandBuffer, &size);
|
arc_pack_erase_action_req(&eraseReq, commandBuffer, &size);
|
||||||
result = sendAndRead(size, eraseReq.region, FLASH_ERASE_DELAY);
|
result = sendAndRead(size, eraseReq.region, FLASH_ERASE_DELAY);
|
||||||
if (result != RETURN_OK) {
|
if (result != returnvalue::OK) {
|
||||||
sif::warning << "StrHelper::unlockAndEraseRegions: Failed to erase region with id "
|
sif::warning << "StrHelper::unlockAndEraseRegions: Failed to erase region with id "
|
||||||
<< static_cast<unsigned int>(eraseReq.region) << std::endl;
|
<< static_cast<unsigned int>(eraseReq.region) << std::endl;
|
||||||
return result;
|
return result;
|
||||||
|
@ -13,7 +13,7 @@
|
|||||||
#include "fsfw/devicehandlers/CookieIF.h"
|
#include "fsfw/devicehandlers/CookieIF.h"
|
||||||
#include "fsfw/objectmanager/SystemObject.h"
|
#include "fsfw/objectmanager/SystemObject.h"
|
||||||
#include "fsfw/osal/linux/BinarySemaphore.h"
|
#include "fsfw/osal/linux/BinarySemaphore.h"
|
||||||
#include "fsfw/returnvalues/HasReturnvaluesIF.h"
|
#include "fsfw/returnvalues/returnvalue.h"
|
||||||
#include "fsfw/tasks/ExecutableObjectIF.h"
|
#include "fsfw/tasks/ExecutableObjectIF.h"
|
||||||
#include "fsfw_hal/linux/uart/UartComIF.h"
|
#include "fsfw_hal/linux/uart/UartComIF.h"
|
||||||
|
|
||||||
@ -27,7 +27,7 @@ extern "C" {
|
|||||||
*
|
*
|
||||||
* @author J. Meier
|
* @author J. Meier
|
||||||
*/
|
*/
|
||||||
class StrHelper : public SystemObject, public ExecutableObjectIF, public HasReturnvaluesIF {
|
class StrHelper : public SystemObject, public ExecutableObjectIF {
|
||||||
public:
|
public:
|
||||||
static const uint8_t SUBSYSTEM_ID = SUBSYSTEM_ID::STR_HELPER;
|
static const uint8_t SUBSYSTEM_ID = SUBSYSTEM_ID::STR_HELPER;
|
||||||
|
|
||||||
@ -270,7 +270,7 @@ class StrHelper : public SystemObject, public ExecutableObjectIF, public HasRetu
|
|||||||
/**
|
/**
|
||||||
* @brief Performs firmware update
|
* @brief Performs firmware update
|
||||||
*
|
*
|
||||||
* @return RETURN_OK if successful, otherwise error return value
|
* @return returnvalue::OK if successful, otherwise error return value
|
||||||
*/
|
*/
|
||||||
ReturnValue_t performFirmwareUpdate();
|
ReturnValue_t performFirmwareUpdate();
|
||||||
|
|
||||||
@ -289,7 +289,7 @@ class StrHelper : public SystemObject, public ExecutableObjectIF, public HasRetu
|
|||||||
*
|
*
|
||||||
* @param ID of first region to write to
|
* @param ID of first region to write to
|
||||||
*
|
*
|
||||||
* @return RETURN_OK if successful, otherwise RETURN_FAILED
|
* @return returnvalue::OK if successful, otherwise returnvalue::FAILED
|
||||||
*/
|
*/
|
||||||
ReturnValue_t performFlashWrite();
|
ReturnValue_t performFlashWrite();
|
||||||
|
|
||||||
@ -307,14 +307,14 @@ class StrHelper : public SystemObject, public ExecutableObjectIF, public HasRetu
|
|||||||
* @param parameter Parameter 2 of trigger event function
|
* @param parameter Parameter 2 of trigger event function
|
||||||
* @param delayMs Delay in milliseconds between send and receive call
|
* @param delayMs Delay in milliseconds between send and receive call
|
||||||
*
|
*
|
||||||
* @return RETURN_OK if successful, otherwise RETURN_FAILED
|
* @return returnvalue::OK if successful, otherwise returnvalue::FAILED
|
||||||
*/
|
*/
|
||||||
ReturnValue_t sendAndRead(size_t size, uint32_t parameter, uint32_t delayMs = 0);
|
ReturnValue_t sendAndRead(size_t size, uint32_t parameter, uint32_t delayMs = 0);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Checks the header (type id and status fields) of the action reply
|
* @brief Checks the header (type id and status fields) of the action reply
|
||||||
*
|
*
|
||||||
* @return RETURN_OK if reply confirms success of packet transfer, otherwise REUTRN_FAILED
|
* @return returnvalue::OK if reply confirms success of packet transfer, otherwise REUTRN_FAILED
|
||||||
*/
|
*/
|
||||||
ReturnValue_t checkActionReply();
|
ReturnValue_t checkActionReply();
|
||||||
|
|
||||||
@ -323,7 +323,8 @@ class StrHelper : public SystemObject, public ExecutableObjectIF, public HasRetu
|
|||||||
*
|
*
|
||||||
* @param expectedPosition Value of expected position
|
* @param expectedPosition Value of expected position
|
||||||
*
|
*
|
||||||
* @return RETURN_OK if received position matches expected position, otherwise RETURN_FAILED
|
* @return returnvalue::OK if received position matches expected position, otherwise
|
||||||
|
* returnvalue::FAILED
|
||||||
*/
|
*/
|
||||||
ReturnValue_t checkReplyPosition(uint32_t expectedPosition);
|
ReturnValue_t checkReplyPosition(uint32_t expectedPosition);
|
||||||
|
|
||||||
@ -331,7 +332,7 @@ class StrHelper : public SystemObject, public ExecutableObjectIF, public HasRetu
|
|||||||
/**
|
/**
|
||||||
* @brief Checks if a path points to an sd card and whether the SD card is monuted.
|
* @brief Checks if a path points to an sd card and whether the SD card is monuted.
|
||||||
*
|
*
|
||||||
* @return SD_NOT_MOUNTED id SD card is not mounted, otherwise RETURN_OK
|
* @return SD_NOT_MOUNTED id SD card is not mounted, otherwise returnvalue::OK
|
||||||
*/
|
*/
|
||||||
ReturnValue_t checkPath(std::string name);
|
ReturnValue_t checkPath(std::string name);
|
||||||
#endif
|
#endif
|
||||||
|
@ -23,12 +23,12 @@ ReturnValue_t pst::pstGpio(FixedTimeslotTaskIF *thisSequence) {
|
|||||||
thisSequence->addSlot(objects::SOLAR_ARRAY_DEPL_HANDLER, length * 0,
|
thisSequence->addSlot(objects::SOLAR_ARRAY_DEPL_HANDLER, length * 0,
|
||||||
DeviceHandlerIF::PERFORM_OPERATION);
|
DeviceHandlerIF::PERFORM_OPERATION);
|
||||||
|
|
||||||
if (thisSequence->checkSequence() == HasReturnvaluesIF::RETURN_OK) {
|
if (thisSequence->checkSequence() == returnvalue::OK) {
|
||||||
return HasReturnvaluesIF::RETURN_OK;
|
return returnvalue::OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
sif::error << "PollingSequence::initialize has errors!" << std::endl;
|
sif::error << "PollingSequence::initialize has errors!" << std::endl;
|
||||||
return HasReturnvaluesIF::RETURN_FAILED;
|
return returnvalue::FAILED;
|
||||||
}
|
}
|
||||||
|
|
||||||
ReturnValue_t pst::pstSpiRw(FixedTimeslotTaskIF *thisSequence) {
|
ReturnValue_t pst::pstSpiRw(FixedTimeslotTaskIF *thisSequence) {
|
||||||
@ -510,13 +510,13 @@ ReturnValue_t pst::pstUart(FixedTimeslotTaskIF *thisSequence) {
|
|||||||
#endif
|
#endif
|
||||||
static_cast<void>(length);
|
static_cast<void>(length);
|
||||||
if (uartPstEmpty) {
|
if (uartPstEmpty) {
|
||||||
return HasReturnvaluesIF::RETURN_OK;
|
return returnvalue::OK;
|
||||||
}
|
}
|
||||||
if (thisSequence->checkSequence() != HasReturnvaluesIF::RETURN_OK) {
|
if (thisSequence->checkSequence() != returnvalue::OK) {
|
||||||
sif::error << "UART PST initialization failed" << std::endl;
|
sif::error << "UART PST initialization failed" << std::endl;
|
||||||
return HasReturnvaluesIF::RETURN_FAILED;
|
return returnvalue::FAILED;
|
||||||
}
|
}
|
||||||
return HasReturnvaluesIF::RETURN_OK;
|
return returnvalue::OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
ReturnValue_t pst::pstGompaceCan(FixedTimeslotTaskIF *thisSequence) {
|
ReturnValue_t pst::pstGompaceCan(FixedTimeslotTaskIF *thisSequence) {
|
||||||
@ -548,12 +548,12 @@ ReturnValue_t pst::pstGompaceCan(FixedTimeslotTaskIF *thisSequence) {
|
|||||||
thisSequence->addSlot(objects::PDU1_HANDLER, length * 0.8, DeviceHandlerIF::GET_READ);
|
thisSequence->addSlot(objects::PDU1_HANDLER, length * 0.8, DeviceHandlerIF::GET_READ);
|
||||||
thisSequence->addSlot(objects::PDU2_HANDLER, length * 0.8, DeviceHandlerIF::GET_READ);
|
thisSequence->addSlot(objects::PDU2_HANDLER, length * 0.8, DeviceHandlerIF::GET_READ);
|
||||||
thisSequence->addSlot(objects::ACU_HANDLER, length * 0.8, DeviceHandlerIF::GET_READ);
|
thisSequence->addSlot(objects::ACU_HANDLER, length * 0.8, DeviceHandlerIF::GET_READ);
|
||||||
if (thisSequence->checkSequence() != HasReturnvaluesIF::RETURN_OK) {
|
if (thisSequence->checkSequence() != returnvalue::OK) {
|
||||||
sif::error << "GomSpace PST initialization failed" << std::endl;
|
sif::error << "GomSpace PST initialization failed" << std::endl;
|
||||||
return HasReturnvaluesIF::RETURN_FAILED;
|
return returnvalue::FAILED;
|
||||||
}
|
}
|
||||||
static_cast<void>(length);
|
static_cast<void>(length);
|
||||||
return HasReturnvaluesIF::RETURN_OK;
|
return returnvalue::OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
ReturnValue_t pst::pstTest(FixedTimeslotTaskIF *thisSequence) {
|
ReturnValue_t pst::pstTest(FixedTimeslotTaskIF *thisSequence) {
|
||||||
@ -583,11 +583,11 @@ ReturnValue_t pst::pstTest(FixedTimeslotTaskIF *thisSequence) {
|
|||||||
#endif
|
#endif
|
||||||
static_cast<void>(length);
|
static_cast<void>(length);
|
||||||
if (not notEmpty) {
|
if (not notEmpty) {
|
||||||
return HasReturnvaluesIF::RETURN_FAILED;
|
return returnvalue::FAILED;
|
||||||
}
|
}
|
||||||
if (thisSequence->checkSequence() != HasReturnvaluesIF::RETURN_OK) {
|
if (thisSequence->checkSequence() != returnvalue::OK) {
|
||||||
sif::error << "Test PST initialization failed" << std::endl;
|
sif::error << "Test PST initialization failed" << std::endl;
|
||||||
return HasReturnvaluesIF::RETURN_FAILED;
|
return returnvalue::FAILED;
|
||||||
}
|
}
|
||||||
return HasReturnvaluesIF::RETURN_OK;
|
return returnvalue::OK;
|
||||||
}
|
}
|
||||||
|
@ -8,7 +8,7 @@
|
|||||||
#include "q7sConfig.h"
|
#include "q7sConfig.h"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#include "fsfw/returnvalues/HasReturnvaluesIF.h"
|
#include "fsfw/returnvalues/returnvalue.h"
|
||||||
|
|
||||||
class FixedTimeslotTaskIF;
|
class FixedTimeslotTaskIF;
|
||||||
|
|
||||||
|
@ -14,106 +14,106 @@ AxiPtmeConfig::AxiPtmeConfig(object_id_t objectId, std::string axiUio, int mapNu
|
|||||||
AxiPtmeConfig::~AxiPtmeConfig() {}
|
AxiPtmeConfig::~AxiPtmeConfig() {}
|
||||||
|
|
||||||
ReturnValue_t AxiPtmeConfig::initialize() {
|
ReturnValue_t AxiPtmeConfig::initialize() {
|
||||||
ReturnValue_t result = HasReturnvaluesIF::RETURN_OK;
|
ReturnValue_t result = returnvalue::OK;
|
||||||
UioMapper uioMapper(axiUio, mapNum);
|
UioMapper uioMapper(axiUio, mapNum);
|
||||||
result = uioMapper.getMappedAdress(&baseAddress, UioMapper::Permissions::READ_WRITE);
|
result = uioMapper.getMappedAdress(&baseAddress, UioMapper::Permissions::READ_WRITE);
|
||||||
if (result != HasReturnvaluesIF::RETURN_OK) {
|
if (result != returnvalue::OK) {
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
return HasReturnvaluesIF::RETURN_OK;
|
return returnvalue::OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
ReturnValue_t AxiPtmeConfig::writeCaduRateReg(uint8_t rateVal) {
|
ReturnValue_t AxiPtmeConfig::writeCaduRateReg(uint8_t rateVal) {
|
||||||
ReturnValue_t result = HasReturnvaluesIF::RETURN_OK;
|
ReturnValue_t result = returnvalue::OK;
|
||||||
result = mutex->lockMutex(timeoutType, mutexTimeout);
|
result = mutex->lockMutex(timeoutType, mutexTimeout);
|
||||||
if (result != HasReturnvaluesIF::RETURN_OK) {
|
if (result != returnvalue::OK) {
|
||||||
sif::warning << "AxiPtmeConfig::writeCaduRateReg: Failed to lock mutex" << std::endl;
|
sif::warning << "AxiPtmeConfig::writeCaduRateReg: Failed to lock mutex" << std::endl;
|
||||||
return HasReturnvaluesIF::RETURN_FAILED;
|
return returnvalue::FAILED;
|
||||||
}
|
}
|
||||||
*(baseAddress + CADU_BITRATE_REG) = static_cast<uint32_t>(rateVal);
|
*(baseAddress + CADU_BITRATE_REG) = static_cast<uint32_t>(rateVal);
|
||||||
result = mutex->unlockMutex();
|
result = mutex->unlockMutex();
|
||||||
if (result != HasReturnvaluesIF::RETURN_OK) {
|
if (result != returnvalue::OK) {
|
||||||
sif::warning << "AxiPtmeConfig::writeCaduRateReg: Failed to unlock mutex" << std::endl;
|
sif::warning << "AxiPtmeConfig::writeCaduRateReg: Failed to unlock mutex" << std::endl;
|
||||||
return HasReturnvaluesIF::RETURN_FAILED;
|
return returnvalue::FAILED;
|
||||||
}
|
}
|
||||||
return HasReturnvaluesIF::RETURN_OK;
|
return returnvalue::OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
ReturnValue_t AxiPtmeConfig::enableTxclockManipulator() {
|
ReturnValue_t AxiPtmeConfig::enableTxclockManipulator() {
|
||||||
ReturnValue_t result = writeBit(COMMON_CONFIG_REG, true, BitPos::EN_TX_CLK_MANIPULATOR);
|
ReturnValue_t result = writeBit(COMMON_CONFIG_REG, true, BitPos::EN_TX_CLK_MANIPULATOR);
|
||||||
if (result != HasReturnvaluesIF::RETURN_OK) {
|
if (result != returnvalue::OK) {
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
return HasReturnvaluesIF::RETURN_OK;
|
return returnvalue::OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
ReturnValue_t AxiPtmeConfig::disableTxclockManipulator() {
|
ReturnValue_t AxiPtmeConfig::disableTxclockManipulator() {
|
||||||
ReturnValue_t result = writeBit(COMMON_CONFIG_REG, false, BitPos::EN_TX_CLK_MANIPULATOR);
|
ReturnValue_t result = writeBit(COMMON_CONFIG_REG, false, BitPos::EN_TX_CLK_MANIPULATOR);
|
||||||
if (result != HasReturnvaluesIF::RETURN_OK) {
|
if (result != returnvalue::OK) {
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
return HasReturnvaluesIF::RETURN_OK;
|
return returnvalue::OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
ReturnValue_t AxiPtmeConfig::enableTxclockInversion() {
|
ReturnValue_t AxiPtmeConfig::enableTxclockInversion() {
|
||||||
ReturnValue_t result = writeBit(COMMON_CONFIG_REG, true, BitPos::INVERT_CLOCK);
|
ReturnValue_t result = writeBit(COMMON_CONFIG_REG, true, BitPos::INVERT_CLOCK);
|
||||||
if (result != HasReturnvaluesIF::RETURN_OK) {
|
if (result != returnvalue::OK) {
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
return HasReturnvaluesIF::RETURN_OK;
|
return returnvalue::OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
ReturnValue_t AxiPtmeConfig::disableTxclockInversion() {
|
ReturnValue_t AxiPtmeConfig::disableTxclockInversion() {
|
||||||
ReturnValue_t result = writeBit(COMMON_CONFIG_REG, false, BitPos::INVERT_CLOCK);
|
ReturnValue_t result = writeBit(COMMON_CONFIG_REG, false, BitPos::INVERT_CLOCK);
|
||||||
if (result != HasReturnvaluesIF::RETURN_OK) {
|
if (result != returnvalue::OK) {
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
return HasReturnvaluesIF::RETURN_OK;
|
return returnvalue::OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
ReturnValue_t AxiPtmeConfig::writeReg(uint32_t regOffset, uint32_t writeVal) {
|
ReturnValue_t AxiPtmeConfig::writeReg(uint32_t regOffset, uint32_t writeVal) {
|
||||||
ReturnValue_t result = HasReturnvaluesIF::RETURN_OK;
|
ReturnValue_t result = returnvalue::OK;
|
||||||
result = mutex->lockMutex(timeoutType, mutexTimeout);
|
result = mutex->lockMutex(timeoutType, mutexTimeout);
|
||||||
if (result != HasReturnvaluesIF::RETURN_OK) {
|
if (result != returnvalue::OK) {
|
||||||
sif::warning << "AxiPtmeConfig::readReg: Failed to lock mutex" << std::endl;
|
sif::warning << "AxiPtmeConfig::readReg: Failed to lock mutex" << std::endl;
|
||||||
return HasReturnvaluesIF::RETURN_FAILED;
|
return returnvalue::FAILED;
|
||||||
}
|
}
|
||||||
*(baseAddress + regOffset / ADRESS_DIVIDER) = writeVal;
|
*(baseAddress + regOffset / ADRESS_DIVIDER) = writeVal;
|
||||||
result = mutex->unlockMutex();
|
result = mutex->unlockMutex();
|
||||||
if (result != HasReturnvaluesIF::RETURN_OK) {
|
if (result != returnvalue::OK) {
|
||||||
sif::warning << "AxiPtmeConfig::readReg: Failed to unlock mutex" << std::endl;
|
sif::warning << "AxiPtmeConfig::readReg: Failed to unlock mutex" << std::endl;
|
||||||
return HasReturnvaluesIF::RETURN_FAILED;
|
return returnvalue::FAILED;
|
||||||
}
|
}
|
||||||
return HasReturnvaluesIF::RETURN_OK;
|
return returnvalue::OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
ReturnValue_t AxiPtmeConfig::readReg(uint32_t regOffset, uint32_t* readVal) {
|
ReturnValue_t AxiPtmeConfig::readReg(uint32_t regOffset, uint32_t* readVal) {
|
||||||
ReturnValue_t result = HasReturnvaluesIF::RETURN_OK;
|
ReturnValue_t result = returnvalue::OK;
|
||||||
result = mutex->lockMutex(timeoutType, mutexTimeout);
|
result = mutex->lockMutex(timeoutType, mutexTimeout);
|
||||||
if (result != HasReturnvaluesIF::RETURN_OK) {
|
if (result != returnvalue::OK) {
|
||||||
sif::warning << "AxiPtmeConfig::readReg: Failed to lock mutex" << std::endl;
|
sif::warning << "AxiPtmeConfig::readReg: Failed to lock mutex" << std::endl;
|
||||||
return HasReturnvaluesIF::RETURN_FAILED;
|
return returnvalue::FAILED;
|
||||||
}
|
}
|
||||||
*readVal = *(baseAddress + regOffset / ADRESS_DIVIDER);
|
*readVal = *(baseAddress + regOffset / ADRESS_DIVIDER);
|
||||||
result = mutex->unlockMutex();
|
result = mutex->unlockMutex();
|
||||||
if (result != HasReturnvaluesIF::RETURN_OK) {
|
if (result != returnvalue::OK) {
|
||||||
sif::warning << "AxiPtmeConfig::readReg: Failed to unlock mutex" << std::endl;
|
sif::warning << "AxiPtmeConfig::readReg: Failed to unlock mutex" << std::endl;
|
||||||
return HasReturnvaluesIF::RETURN_FAILED;
|
return returnvalue::FAILED;
|
||||||
}
|
}
|
||||||
return HasReturnvaluesIF::RETURN_OK;
|
return returnvalue::OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
ReturnValue_t AxiPtmeConfig::writeBit(uint32_t regOffset, bool bitVal, BitPos bitPos) {
|
ReturnValue_t AxiPtmeConfig::writeBit(uint32_t regOffset, bool bitVal, BitPos bitPos) {
|
||||||
uint32_t readVal = 0;
|
uint32_t readVal = 0;
|
||||||
ReturnValue_t result = readReg(regOffset, &readVal);
|
ReturnValue_t result = readReg(regOffset, &readVal);
|
||||||
if (result != HasReturnvaluesIF::RETURN_OK) {
|
if (result != returnvalue::OK) {
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
uint32_t writeVal =
|
uint32_t writeVal =
|
||||||
(readVal & ~(1 << static_cast<uint32_t>(bitPos))) | bitVal << static_cast<uint32_t>(bitPos);
|
(readVal & ~(1 << static_cast<uint32_t>(bitPos))) | bitVal << static_cast<uint32_t>(bitPos);
|
||||||
result = writeReg(regOffset, writeVal);
|
result = writeReg(regOffset, writeVal);
|
||||||
if (result != HasReturnvaluesIF::RETURN_OK) {
|
if (result != returnvalue::OK) {
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
return HasReturnvaluesIF::RETURN_OK;
|
return returnvalue::OK;
|
||||||
}
|
}
|
||||||
|
@ -5,7 +5,7 @@
|
|||||||
|
|
||||||
#include "fsfw/ipc/MutexIF.h"
|
#include "fsfw/ipc/MutexIF.h"
|
||||||
#include "fsfw/objectmanager/SystemObject.h"
|
#include "fsfw/objectmanager/SystemObject.h"
|
||||||
#include "fsfw/returnvalues/HasReturnvaluesIF.h"
|
#include "fsfw/returnvalues/returnvalue.h"
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Class providing low level access to the configuration interface of the PTME.
|
* @brief Class providing low level access to the configuration interface of the PTME.
|
||||||
@ -94,7 +94,7 @@ class AxiPtmeConfig : public SystemObject {
|
|||||||
* @param bitVal The value of the bit to set (1 or 0)
|
* @param bitVal The value of the bit to set (1 or 0)
|
||||||
* @param bitPos The position of the bit within the register to set
|
* @param bitPos The position of the bit within the register to set
|
||||||
*
|
*
|
||||||
* @return RETURN_OK if successful, otherwise RETURN_FAILED
|
* @return returnvalue::OK if successful, otherwise returnvalue::FAILED
|
||||||
*/
|
*/
|
||||||
ReturnValue_t writeBit(uint32_t regOffset, bool bitVal, BitPos bitPos);
|
ReturnValue_t writeBit(uint32_t regOffset, bool bitVal, BitPos bitPos);
|
||||||
};
|
};
|
||||||
|
@ -19,22 +19,22 @@ ReturnValue_t PapbVcInterface::initialize() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
ReturnValue_t PapbVcInterface::write(const uint8_t* data, size_t size) {
|
ReturnValue_t PapbVcInterface::write(const uint8_t* data, size_t size) {
|
||||||
if (pollPapbBusySignal() == RETURN_OK) {
|
if (pollPapbBusySignal() == returnvalue::OK) {
|
||||||
startPacketTransfer();
|
startPacketTransfer();
|
||||||
}
|
}
|
||||||
for (size_t idx = 0; idx < size; idx++) {
|
for (size_t idx = 0; idx < size; idx++) {
|
||||||
if (pollPapbBusySignal() == RETURN_OK) {
|
if (pollPapbBusySignal() == returnvalue::OK) {
|
||||||
*(vcBaseReg + DATA_REG_OFFSET) = static_cast<uint32_t>(*(data + idx));
|
*(vcBaseReg + DATA_REG_OFFSET) = static_cast<uint32_t>(*(data + idx));
|
||||||
} else {
|
} else {
|
||||||
sif::warning << "PapbVcInterface::write: Only written " << idx << " of " << size << " data"
|
sif::warning << "PapbVcInterface::write: Only written " << idx << " of " << size << " data"
|
||||||
<< std::endl;
|
<< std::endl;
|
||||||
return RETURN_FAILED;
|
return returnvalue::FAILED;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (pollPapbBusySignal() == RETURN_OK) {
|
if (pollPapbBusySignal() == returnvalue::OK) {
|
||||||
endPacketTransfer();
|
endPacketTransfer();
|
||||||
}
|
}
|
||||||
return RETURN_OK;
|
return returnvalue::OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
void PapbVcInterface::startPacketTransfer() { *vcBaseReg = CONFIG_START; }
|
void PapbVcInterface::startPacketTransfer() { *vcBaseReg = CONFIG_START; }
|
||||||
@ -43,30 +43,30 @@ void PapbVcInterface::endPacketTransfer() { *vcBaseReg = CONFIG_END; }
|
|||||||
|
|
||||||
ReturnValue_t PapbVcInterface::pollPapbBusySignal() {
|
ReturnValue_t PapbVcInterface::pollPapbBusySignal() {
|
||||||
gpio::Levels papbBusyState = gpio::Levels::LOW;
|
gpio::Levels papbBusyState = gpio::Levels::LOW;
|
||||||
ReturnValue_t result = RETURN_OK;
|
ReturnValue_t result = returnvalue::OK;
|
||||||
|
|
||||||
/** Check if PAPB interface is ready to receive data */
|
/** Check if PAPB interface is ready to receive data */
|
||||||
result = gpioComIF->readGpio(papbBusyId, papbBusyState);
|
result = gpioComIF->readGpio(papbBusyId, papbBusyState);
|
||||||
if (result != RETURN_OK) {
|
if (result != returnvalue::OK) {
|
||||||
sif::warning << "PapbVcInterface::pollPapbBusySignal: Failed to read papb busy signal"
|
sif::warning << "PapbVcInterface::pollPapbBusySignal: Failed to read papb busy signal"
|
||||||
<< std::endl;
|
<< std::endl;
|
||||||
return RETURN_FAILED;
|
return returnvalue::FAILED;
|
||||||
}
|
}
|
||||||
if (papbBusyState == gpio::Levels::LOW) {
|
if (papbBusyState == gpio::Levels::LOW) {
|
||||||
sif::warning << "PapbVcInterface::pollPapbBusySignal: PAPB busy" << std::endl;
|
sif::warning << "PapbVcInterface::pollPapbBusySignal: PAPB busy" << std::endl;
|
||||||
return PAPB_BUSY;
|
return PAPB_BUSY;
|
||||||
}
|
}
|
||||||
|
|
||||||
return RETURN_OK;
|
return returnvalue::OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
void PapbVcInterface::isVcInterfaceBufferEmpty() {
|
void PapbVcInterface::isVcInterfaceBufferEmpty() {
|
||||||
ReturnValue_t result = RETURN_OK;
|
ReturnValue_t result = returnvalue::OK;
|
||||||
gpio::Levels papbEmptyState = gpio::Levels::HIGH;
|
gpio::Levels papbEmptyState = gpio::Levels::HIGH;
|
||||||
|
|
||||||
result = gpioComIF->readGpio(papbEmptyId, papbEmptyState);
|
result = gpioComIF->readGpio(papbEmptyId, papbEmptyState);
|
||||||
|
|
||||||
if (result != RETURN_OK) {
|
if (result != returnvalue::OK) {
|
||||||
sif::warning << "PapbVcInterface::isVcInterfaceBufferEmpty: Failed to read papb empty signal"
|
sif::warning << "PapbVcInterface::isVcInterfaceBufferEmpty: Failed to read papb empty signal"
|
||||||
<< std::endl;
|
<< std::endl;
|
||||||
return;
|
return;
|
||||||
@ -90,9 +90,9 @@ ReturnValue_t PapbVcInterface::sendTestFrame() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
ReturnValue_t result = write(testPacket, 1105);
|
ReturnValue_t result = write(testPacket, 1105);
|
||||||
if (result != RETURN_OK) {
|
if (result != returnvalue::OK) {
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
return RETURN_OK;
|
return returnvalue::OK;
|
||||||
}
|
}
|
||||||
|
@ -5,7 +5,7 @@
|
|||||||
#include <fsfw_hal/linux/gpio/LinuxLibgpioIF.h>
|
#include <fsfw_hal/linux/gpio/LinuxLibgpioIF.h>
|
||||||
|
|
||||||
#include "OBSWConfig.h"
|
#include "OBSWConfig.h"
|
||||||
#include "fsfw/returnvalues/HasReturnvaluesIF.h"
|
#include "fsfw/returnvalues/returnvalue.h"
|
||||||
#include "linux/obc/VcInterfaceIF.h"
|
#include "linux/obc/VcInterfaceIF.h"
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -14,7 +14,7 @@
|
|||||||
*
|
*
|
||||||
* @author J. Meier
|
* @author J. Meier
|
||||||
*/
|
*/
|
||||||
class PapbVcInterface : public VcInterfaceIF, public HasReturnvaluesIF {
|
class PapbVcInterface : public VcInterfaceIF {
|
||||||
public:
|
public:
|
||||||
/**
|
/**
|
||||||
* @brief Constructor
|
* @brief Constructor
|
||||||
@ -93,7 +93,7 @@ class PapbVcInterface : public VcInterfaceIF, public HasReturnvaluesIF {
|
|||||||
* interface is ready to receive more data or not. PAPB is ready when
|
* interface is ready to receive more data or not. PAPB is ready when
|
||||||
* PAPB_Busy_N == '1'.
|
* PAPB_Busy_N == '1'.
|
||||||
*
|
*
|
||||||
* @return RETURN_OK when ready to receive data else PAPB_BUSY.
|
* @return returnvalue::OK when ready to receive data else PAPB_BUSY.
|
||||||
*/
|
*/
|
||||||
ReturnValue_t pollPapbBusySignal();
|
ReturnValue_t pollPapbBusySignal();
|
||||||
|
|
||||||
|
@ -3,7 +3,7 @@
|
|||||||
|
|
||||||
#include <cstring>
|
#include <cstring>
|
||||||
|
|
||||||
#include "fsfw/returnvalues/HasReturnvaluesIF.h"
|
#include "fsfw/returnvalues/returnvalue.h"
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief This class generates the configuration words for the configuration memory of the PDEC
|
* @brief This class generates the configuration words for the configuration memory of the PDEC
|
||||||
|
@ -45,37 +45,37 @@ ReturnValue_t PdecHandler::initialize() {
|
|||||||
return ObjectManagerIF::CHILD_INIT_FAILED;
|
return ObjectManagerIF::CHILD_INIT_FAILED;
|
||||||
}
|
}
|
||||||
|
|
||||||
ReturnValue_t result = RETURN_OK;
|
ReturnValue_t result = returnvalue::OK;
|
||||||
|
|
||||||
UioMapper regMapper(uioRegisters);
|
UioMapper regMapper(uioRegisters);
|
||||||
result = regMapper.getMappedAdress(®isterBaseAddress, UioMapper::Permissions::READ_WRITE);
|
result = regMapper.getMappedAdress(®isterBaseAddress, UioMapper::Permissions::READ_WRITE);
|
||||||
if (result != RETURN_OK) {
|
if (result != returnvalue::OK) {
|
||||||
return ObjectManagerIF::CHILD_INIT_FAILED;
|
return ObjectManagerIF::CHILD_INIT_FAILED;
|
||||||
}
|
}
|
||||||
UioMapper configMemMapper(uioConfigMemory);
|
UioMapper configMemMapper(uioConfigMemory);
|
||||||
result = configMemMapper.getMappedAdress(&memoryBaseAddress, UioMapper::Permissions::READ_WRITE);
|
result = configMemMapper.getMappedAdress(&memoryBaseAddress, UioMapper::Permissions::READ_WRITE);
|
||||||
if (result != RETURN_OK) {
|
if (result != returnvalue::OK) {
|
||||||
return ObjectManagerIF::CHILD_INIT_FAILED;
|
return ObjectManagerIF::CHILD_INIT_FAILED;
|
||||||
}
|
}
|
||||||
UioMapper ramMapper(uioRamMemory);
|
UioMapper ramMapper(uioRamMemory);
|
||||||
result = ramMapper.getMappedAdress(&ramBaseAddress, UioMapper::Permissions::READ_WRITE);
|
result = ramMapper.getMappedAdress(&ramBaseAddress, UioMapper::Permissions::READ_WRITE);
|
||||||
if (result != RETURN_OK) {
|
if (result != returnvalue::OK) {
|
||||||
return ObjectManagerIF::CHILD_INIT_FAILED;
|
return ObjectManagerIF::CHILD_INIT_FAILED;
|
||||||
}
|
}
|
||||||
|
|
||||||
writePdecConfig();
|
writePdecConfig();
|
||||||
|
|
||||||
result = releasePdec();
|
result = releasePdec();
|
||||||
if (result != RETURN_OK) {
|
if (result != returnvalue::OK) {
|
||||||
return ObjectManagerIF::CHILD_INIT_FAILED;
|
return ObjectManagerIF::CHILD_INIT_FAILED;
|
||||||
}
|
}
|
||||||
|
|
||||||
result = actionHelper.initialize(commandQueue);
|
result = actionHelper.initialize(commandQueue);
|
||||||
if (result != RETURN_OK) {
|
if (result != returnvalue::OK) {
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
return RETURN_OK;
|
return returnvalue::OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
MessageQueueId_t PdecHandler::getCommandQueue() const { return commandQueue->getId(); }
|
MessageQueueId_t PdecHandler::getCommandQueue() const { return commandQueue->getId(); }
|
||||||
@ -110,33 +110,33 @@ ReturnValue_t PdecHandler::resetFarStatFlag() {
|
|||||||
sif::warning << "PdecHandler::resetFarStatFlag: FAR register did not match expected value."
|
sif::warning << "PdecHandler::resetFarStatFlag: FAR register did not match expected value."
|
||||||
<< " Read value: 0x" << std::hex << static_cast<unsigned int>(pdecFar)
|
<< " Read value: 0x" << std::hex << static_cast<unsigned int>(pdecFar)
|
||||||
<< std::endl;
|
<< std::endl;
|
||||||
return RETURN_FAILED;
|
return returnvalue::FAILED;
|
||||||
}
|
}
|
||||||
#if OBSW_DEBUG_PDEC_HANDLER == 1
|
#if OBSW_DEBUG_PDEC_HANDLER == 1
|
||||||
sif::debug << "PdecHandler::resetFarStatFlag: read FAR with value: 0x" << std::hex << pdecFar
|
sif::debug << "PdecHandler::resetFarStatFlag: read FAR with value: 0x" << std::hex << pdecFar
|
||||||
<< std::endl;
|
<< std::endl;
|
||||||
#endif /* OBSW_DEBUG_PDEC_HANDLER == 1 */
|
#endif /* OBSW_DEBUG_PDEC_HANDLER == 1 */
|
||||||
return RETURN_OK;
|
return returnvalue::OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
ReturnValue_t PdecHandler::releasePdec() {
|
ReturnValue_t PdecHandler::releasePdec() {
|
||||||
ReturnValue_t result = RETURN_OK;
|
ReturnValue_t result = returnvalue::OK;
|
||||||
result = gpioComIF->pullHigh(pdecReset);
|
result = gpioComIF->pullHigh(pdecReset);
|
||||||
if (result != RETURN_OK) {
|
if (result != returnvalue::OK) {
|
||||||
sif::error << "PdecHandler::releasePdec: Failed to release PDEC reset signal" << std::endl;
|
sif::error << "PdecHandler::releasePdec: Failed to release PDEC reset signal" << std::endl;
|
||||||
}
|
}
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
ReturnValue_t PdecHandler::performOperation(uint8_t operationCode) {
|
ReturnValue_t PdecHandler::performOperation(uint8_t operationCode) {
|
||||||
ReturnValue_t result = RETURN_OK;
|
ReturnValue_t result = returnvalue::OK;
|
||||||
|
|
||||||
readCommandQueue();
|
readCommandQueue();
|
||||||
|
|
||||||
switch (state) {
|
switch (state) {
|
||||||
case State::INIT:
|
case State::INIT:
|
||||||
resetFarStatFlag();
|
resetFarStatFlag();
|
||||||
if (result != RETURN_OK) {
|
if (result != returnvalue::OK) {
|
||||||
// Requires reconfiguration and reinitialization of PDEC
|
// Requires reconfiguration and reinitialization of PDEC
|
||||||
triggerEvent(INVALID_FAR);
|
triggerEvent(INVALID_FAR);
|
||||||
state = State::WAIT_FOR_RECOVERY;
|
state = State::WAIT_FOR_RECOVERY;
|
||||||
@ -157,17 +157,17 @@ ReturnValue_t PdecHandler::performOperation(uint8_t operationCode) {
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
return RETURN_OK;
|
return returnvalue::OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
void PdecHandler::readCommandQueue(void) {
|
void PdecHandler::readCommandQueue(void) {
|
||||||
CommandMessage commandMessage;
|
CommandMessage commandMessage;
|
||||||
ReturnValue_t result = RETURN_FAILED;
|
ReturnValue_t result = returnvalue::FAILED;
|
||||||
|
|
||||||
result = commandQueue->receiveMessage(&commandMessage);
|
result = commandQueue->receiveMessage(&commandMessage);
|
||||||
if (result == RETURN_OK) {
|
if (result == returnvalue::OK) {
|
||||||
result = actionHelper.handleActionMessage(&commandMessage);
|
result = actionHelper.handleActionMessage(&commandMessage);
|
||||||
if (result == RETURN_OK) {
|
if (result == returnvalue::OK) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
CommandMessage reply;
|
CommandMessage reply;
|
||||||
@ -318,11 +318,11 @@ void PdecHandler::handleIReason(uint32_t pdecFar, ReturnValue_t parameter1) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void PdecHandler::handleNewTc() {
|
void PdecHandler::handleNewTc() {
|
||||||
ReturnValue_t result = RETURN_OK;
|
ReturnValue_t result = returnvalue::OK;
|
||||||
|
|
||||||
uint32_t tcLength = 0;
|
uint32_t tcLength = 0;
|
||||||
result = readTc(tcLength);
|
result = readTc(tcLength);
|
||||||
if (result != RETURN_OK) {
|
if (result != returnvalue::OK) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
#if OBSW_DEBUG_PDEC_HANDLER == 1
|
#if OBSW_DEBUG_PDEC_HANDLER == 1
|
||||||
@ -334,7 +334,7 @@ void PdecHandler::handleNewTc() {
|
|||||||
#if OBSW_TC_FROM_PDEC == 1
|
#if OBSW_TC_FROM_PDEC == 1
|
||||||
store_address_t storeId;
|
store_address_t storeId;
|
||||||
result = tcStore->addData(&storeId, tcSegment + 1, tcLength - 1);
|
result = tcStore->addData(&storeId, tcSegment + 1, tcLength - 1);
|
||||||
if (result != RETURN_OK) {
|
if (result != returnvalue::OK) {
|
||||||
sif::warning << "PdecHandler::handleNewTc: Failed to add received space packet to store"
|
sif::warning << "PdecHandler::handleNewTc: Failed to add received space packet to store"
|
||||||
<< std::endl;
|
<< std::endl;
|
||||||
return;
|
return;
|
||||||
@ -343,7 +343,7 @@ void PdecHandler::handleNewTc() {
|
|||||||
TmTcMessage message(storeId);
|
TmTcMessage message(storeId);
|
||||||
|
|
||||||
result = MessageQueueSenderIF::sendMessage(tcDestination->getRequestQueue(), &message);
|
result = MessageQueueSenderIF::sendMessage(tcDestination->getRequestQueue(), &message);
|
||||||
if (result != HasReturnvaluesIF::RETURN_OK) {
|
if (result != returnvalue::OK) {
|
||||||
sif::warning << "PdecHandler::handleNewTc: Failed to send message to TC destination"
|
sif::warning << "PdecHandler::handleNewTc: Failed to send message to TC destination"
|
||||||
<< std::endl;
|
<< std::endl;
|
||||||
tcStore->deleteData(storeId);
|
tcStore->deleteData(storeId);
|
||||||
@ -370,7 +370,7 @@ ReturnValue_t PdecHandler::readTc(uint32_t& tcLength) {
|
|||||||
if (tcLength > MAX_TC_SEGMENT_SIZE) {
|
if (tcLength > MAX_TC_SEGMENT_SIZE) {
|
||||||
sif::warning << "PdecHandler::handleNewTc: Read invalid TC length from PDEC register"
|
sif::warning << "PdecHandler::handleNewTc: Read invalid TC length from PDEC register"
|
||||||
<< std::endl;
|
<< std::endl;
|
||||||
return RETURN_FAILED;
|
return returnvalue::FAILED;
|
||||||
}
|
}
|
||||||
|
|
||||||
uint32_t idx = 0;
|
uint32_t idx = 0;
|
||||||
@ -401,7 +401,7 @@ ReturnValue_t PdecHandler::readTc(uint32_t& tcLength) {
|
|||||||
// Backend buffer is handled back to PDEC3
|
// Backend buffer is handled back to PDEC3
|
||||||
*(registerBaseAddress + PDEC_BFREE_OFFSET) = 0;
|
*(registerBaseAddress + PDEC_BFREE_OFFSET) = 0;
|
||||||
|
|
||||||
return RETURN_OK;
|
return returnvalue::OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
void PdecHandler::printTC(uint32_t tcLength) {
|
void PdecHandler::printTC(uint32_t tcLength) {
|
||||||
|
@ -6,7 +6,7 @@
|
|||||||
#include "fsfw/action/ActionHelper.h"
|
#include "fsfw/action/ActionHelper.h"
|
||||||
#include "fsfw/action/HasActionsIF.h"
|
#include "fsfw/action/HasActionsIF.h"
|
||||||
#include "fsfw/objectmanager/SystemObject.h"
|
#include "fsfw/objectmanager/SystemObject.h"
|
||||||
#include "fsfw/returnvalues/HasReturnvaluesIF.h"
|
#include "fsfw/returnvalues/returnvalue.h"
|
||||||
#include "fsfw/storagemanager/StorageManagerIF.h"
|
#include "fsfw/storagemanager/StorageManagerIF.h"
|
||||||
#include "fsfw/tasks/ExecutableObjectIF.h"
|
#include "fsfw/tasks/ExecutableObjectIF.h"
|
||||||
#include "fsfw/tmtcservices/AcceptsTelecommandsIF.h"
|
#include "fsfw/tmtcservices/AcceptsTelecommandsIF.h"
|
||||||
@ -31,10 +31,7 @@
|
|||||||
*
|
*
|
||||||
* @author J. Meier
|
* @author J. Meier
|
||||||
*/
|
*/
|
||||||
class PdecHandler : public SystemObject,
|
class PdecHandler : public SystemObject, public ExecutableObjectIF, public HasActionsIF {
|
||||||
public ExecutableObjectIF,
|
|
||||||
public HasReturnvaluesIF,
|
|
||||||
public HasActionsIF {
|
|
||||||
public:
|
public:
|
||||||
/**
|
/**
|
||||||
* @brief Constructor
|
* @brief Constructor
|
||||||
|
@ -15,11 +15,11 @@ ReturnValue_t Ptme::initialize() {
|
|||||||
for (iter = vcInterfaceMap.begin(); iter != vcInterfaceMap.end(); iter++) {
|
for (iter = vcInterfaceMap.begin(); iter != vcInterfaceMap.end(); iter++) {
|
||||||
iter->second->initialize();
|
iter->second->initialize();
|
||||||
}
|
}
|
||||||
return RETURN_OK;
|
return returnvalue::OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
ReturnValue_t Ptme::writeToVc(uint8_t vcId, const uint8_t* data, size_t size) {
|
ReturnValue_t Ptme::writeToVc(uint8_t vcId, const uint8_t* data, size_t size) {
|
||||||
ReturnValue_t result = RETURN_OK;
|
ReturnValue_t result = returnvalue::OK;
|
||||||
VcInterfaceMapIter vcInterfaceMapIter = vcInterfaceMap.find(vcId);
|
VcInterfaceMapIter vcInterfaceMapIter = vcInterfaceMap.find(vcId);
|
||||||
if (vcInterfaceMapIter == vcInterfaceMap.end()) {
|
if (vcInterfaceMapIter == vcInterfaceMap.end()) {
|
||||||
sif::warning << "Ptme::writeToVc: No virtual channel interface found for the virtual "
|
sif::warning << "Ptme::writeToVc: No virtual channel interface found for the virtual "
|
||||||
|
@ -8,7 +8,7 @@
|
|||||||
#include <unordered_map>
|
#include <unordered_map>
|
||||||
|
|
||||||
#include "OBSWConfig.h"
|
#include "OBSWConfig.h"
|
||||||
#include "fsfw/returnvalues/HasReturnvaluesIF.h"
|
#include "fsfw/returnvalues/returnvalue.h"
|
||||||
#include "linux/obc/PtmeIF.h"
|
#include "linux/obc/PtmeIF.h"
|
||||||
#include "linux/obc/VcInterfaceIF.h"
|
#include "linux/obc/VcInterfaceIF.h"
|
||||||
|
|
||||||
@ -18,7 +18,7 @@
|
|||||||
* Synchro- nization and channel coding) and CCSDS 132.0-B-2 (TM Space Data Link Protocoll). The IP
|
* Synchro- nization and channel coding) and CCSDS 132.0-B-2 (TM Space Data Link Protocoll). The IP
|
||||||
* cores are implemented on the programmable logic and are accessible through the linux UIO driver.
|
* cores are implemented on the programmable logic and are accessible through the linux UIO driver.
|
||||||
*/
|
*/
|
||||||
class Ptme : public PtmeIF, public SystemObject, public HasReturnvaluesIF {
|
class Ptme : public PtmeIF, public SystemObject {
|
||||||
public:
|
public:
|
||||||
using VcId_t = uint8_t;
|
using VcId_t = uint8_t;
|
||||||
|
|
||||||
|
@ -10,9 +10,9 @@ PtmeConfig::~PtmeConfig() {}
|
|||||||
ReturnValue_t PtmeConfig::initialize() {
|
ReturnValue_t PtmeConfig::initialize() {
|
||||||
if (axiPtmeConfig == nullptr) {
|
if (axiPtmeConfig == nullptr) {
|
||||||
sif::warning << "PtmeConfig::initialize: Invalid AxiPtmeConfig object" << std::endl;
|
sif::warning << "PtmeConfig::initialize: Invalid AxiPtmeConfig object" << std::endl;
|
||||||
return RETURN_FAILED;
|
return returnvalue::FAILED;
|
||||||
}
|
}
|
||||||
return RETURN_OK;
|
return returnvalue::OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
ReturnValue_t PtmeConfig::setRate(uint32_t bitRate) {
|
ReturnValue_t PtmeConfig::setRate(uint32_t bitRate) {
|
||||||
@ -27,20 +27,20 @@ ReturnValue_t PtmeConfig::setRate(uint32_t bitRate) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
ReturnValue_t PtmeConfig::invertTxClock(bool invert) {
|
ReturnValue_t PtmeConfig::invertTxClock(bool invert) {
|
||||||
ReturnValue_t result = RETURN_OK;
|
ReturnValue_t result = returnvalue::OK;
|
||||||
if (invert) {
|
if (invert) {
|
||||||
result = axiPtmeConfig->enableTxclockInversion();
|
result = axiPtmeConfig->enableTxclockInversion();
|
||||||
} else {
|
} else {
|
||||||
result = axiPtmeConfig->disableTxclockInversion();
|
result = axiPtmeConfig->disableTxclockInversion();
|
||||||
}
|
}
|
||||||
if (result != RETURN_OK) {
|
if (result != returnvalue::OK) {
|
||||||
return CLK_INVERSION_FAILED;
|
return CLK_INVERSION_FAILED;
|
||||||
}
|
}
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
ReturnValue_t PtmeConfig::configTxManipulator(bool enable) {
|
ReturnValue_t PtmeConfig::configTxManipulator(bool enable) {
|
||||||
ReturnValue_t result = RETURN_OK;
|
ReturnValue_t result = returnvalue::OK;
|
||||||
if (enable) {
|
if (enable) {
|
||||||
result = axiPtmeConfig->enableTxclockManipulator();
|
result = axiPtmeConfig->enableTxclockManipulator();
|
||||||
} else {
|
} else {
|
||||||
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue
Block a user