Compare commits
34 Commits
main
...
mohr/intro
Author | SHA1 | Date | |
---|---|---|---|
45cf31c2b1 | |||
f6f6393c4a | |||
7754d65753 | |||
![]() |
c14b131e6f | ||
de856a514b | |||
acd365e421 | |||
06b6c0838a | |||
3c762e7437 | |||
4a147a442c | |||
fe8036361d | |||
2800484f6b | |||
aaeb101442 | |||
da2acd1fa8 | |||
1f47c970af | |||
dfb800f58a | |||
a93fe8ef8e | |||
35effb9e68 | |||
c0e896b371 | |||
73971ad486 | |||
45e5ea362d | |||
7bcc4b18b7 | |||
a3b5993fdc | |||
eb886dc53c | |||
a91393b4b4 | |||
ef40db7fe4 | |||
60a20acc5b | |||
13cc31dca9 | |||
ad88bfa5b4 | |||
d92b1b170d | |||
24297a6a97 | |||
c8f4f0b03e | |||
eeaef13916 | |||
a2910a401e | |||
cd1200d23d |
@ -15,6 +15,7 @@ set(OBSW_VERSION_REVISION_IF_GIT_FAILS 0)
|
||||
|
||||
# set(CMAKE_VERBOSE TRUE)
|
||||
|
||||
|
||||
option(
|
||||
EIVE_HARDCODED_TOOLCHAIN_FILE
|
||||
"\
|
||||
@ -160,7 +161,7 @@ if(NOT GIT_VER_HANDLING_OK)
|
||||
endif()
|
||||
|
||||
# Set names and variables
|
||||
set(OBSW_NAME ${CMAKE_PROJECT_NAME})
|
||||
set(OBSW_NAME ${PROJECT_NAME})
|
||||
set(WATCHDOG_NAME eive-watchdog)
|
||||
set(SIMPLE_OBSW_NAME eive-simple)
|
||||
set(UNITTEST_NAME eive-unittest)
|
||||
@ -182,7 +183,7 @@ set(FSFW_PATH fsfw)
|
||||
set(TEST_PATH test)
|
||||
set(UNITTEST_PATH unittest)
|
||||
set(LINUX_PATH linux)
|
||||
set(COMMON_PATH common)
|
||||
set(COMMON_PATH ${CMAKE_CURRENT_SOURCE_DIR}/common)
|
||||
set(DUMMY_PATH dummies)
|
||||
set(WATCHDOG_PATH watchdog)
|
||||
set(COMMON_CONFIG_PATH ${COMMON_PATH}/config)
|
||||
@ -205,6 +206,7 @@ pre_source_hw_os_config()
|
||||
|
||||
if(TGT_BSP)
|
||||
set(LIBGPS_VERSION_MAJOR 3)
|
||||
|
||||
# I assume a newer version than 3.17 will be installed on other Linux board
|
||||
# than the Q7S
|
||||
set(LIBGPS_VERSION_MINOR 20)
|
||||
@ -214,7 +216,8 @@ if(TGT_BSP)
|
||||
OR TGT_BSP MATCHES "arm/egse"
|
||||
OR TGT_BSP MATCHES "arm/te0720-1cfa")
|
||||
find_library(${LIB_GPS} gps)
|
||||
set(FSFW_CONFIG_PATH "linux/fsfwconfig")
|
||||
set(FSFW_CONFIG_PATH ${CMAKE_CURRENT_SOURCE_DIR}/linux/fsfwconfig)
|
||||
|
||||
if(NOT BUILD_Q7S_SIMPLE_MODE)
|
||||
set(EIVE_ADD_LINUX_FILES TRUE)
|
||||
set(ADD_CSP_LIB TRUE)
|
||||
@ -271,8 +274,9 @@ endif()
|
||||
configure_file(${WATCHDOG_PATH}/watchdogConf.h.in watchdogConf.h)
|
||||
|
||||
# Set common config path for FSFW
|
||||
set(FSFW_ADDITIONAL_INC_PATHS "${COMMON_PATH}/config"
|
||||
${CMAKE_CURRENT_BINARY_DIR})
|
||||
set(FSFW_ADDITIONAL_INC_PATHS "${COMMON_PATH}"
|
||||
${COMMON_CONFIG_PATH}
|
||||
${CMAKE_CURRENT_BINARY_DIR})
|
||||
|
||||
# ##############################################################################
|
||||
# Executable and Sources
|
||||
@ -320,7 +324,7 @@ add_library(${LIB_DUMMIES})
|
||||
|
||||
# Add main executable
|
||||
add_executable(${OBSW_NAME})
|
||||
set(OBSW_BIN_NAME ${CMAKE_PROJECT_NAME})
|
||||
set(OBSW_BIN_NAME ${PROJECT_NAME})
|
||||
|
||||
set_target_properties(${OBSW_NAME} PROPERTIES OUTPUT_NAME ${OBSW_BIN_NAME})
|
||||
|
||||
@ -356,7 +360,10 @@ if(EIVE_ADD_LINUX_FILES)
|
||||
add_subdirectory(${LIB_ARCSEC_PATH})
|
||||
add_subdirectory(${LINUX_PATH})
|
||||
endif()
|
||||
|
||||
add_subdirectory(${BSP_PATH})
|
||||
|
||||
|
||||
if(ADD_CSP_LIB)
|
||||
add_subdirectory(${LIB_CSP_PATH})
|
||||
endif()
|
||||
|
@ -9,7 +9,7 @@ add_subdirectory(simple)
|
||||
|
||||
target_sources(${OBSW_NAME} PUBLIC main.cpp obsw.cpp)
|
||||
|
||||
add_subdirectory(boardtest)
|
||||
#add_subdirectory(boardtest)
|
||||
|
||||
add_subdirectory(boardconfig)
|
||||
add_subdirectory(comIF)
|
||||
|
@ -1,4 +1,4 @@
|
||||
target_sources(${OBSW_NAME} PRIVATE FileSystemTest.cpp Q7STestTask.cpp)
|
||||
target_sources(${OBSW_NAME} PUBLIC FileSystemTest.cpp Q7STestTask.cpp)
|
||||
|
||||
if(EIVE_BUILD_Q7S_SIMPLE_MODE)
|
||||
target_sources(${SIMPLE_OBSW_NAME} PRIVATE FileSystemTest.cpp)
|
||||
|
@ -4,11 +4,7 @@
|
||||
#include "fsfw/action/HasActionsIF.h"
|
||||
#include "fsfw/tasks/TaskFactory.h"
|
||||
|
||||
ReturnValue_t gps::triggerGpioResetPin(const uint8_t* actionData, size_t len, void* args) {
|
||||
// At least one byte which denotes which GPS to reset is required
|
||||
if (len < 1 or actionData == nullptr) {
|
||||
return HasActionsIF::INVALID_PARAMETERS;
|
||||
}
|
||||
ReturnValue_t gps::triggerGpioResetPin(uint8_t gpsId, void* args) {
|
||||
ResetArgs* resetArgs = reinterpret_cast<ResetArgs*>(args);
|
||||
if (args == nullptr) {
|
||||
return HasReturnvaluesIF::RETURN_FAILED;
|
||||
@ -16,10 +12,8 @@ ReturnValue_t gps::triggerGpioResetPin(const uint8_t* actionData, size_t len, vo
|
||||
if (resetArgs->gpioComIF == nullptr) {
|
||||
return HasReturnvaluesIF::RETURN_FAILED;
|
||||
}
|
||||
gpioId_t gpioId;
|
||||
if (actionData[0] == 0) {
|
||||
gpioId = gpioIds::GNSS_0_NRESET;
|
||||
} else {
|
||||
gpioId_t gpioId = gpioIds::GNSS_0_NRESET;
|
||||
if (gpsId == 1) {
|
||||
gpioId = gpioIds::GNSS_1_NRESET;
|
||||
}
|
||||
resetArgs->gpioComIF->pullLow(gpioId);
|
||||
|
@ -11,7 +11,7 @@ struct ResetArgs {
|
||||
|
||||
namespace gps {
|
||||
|
||||
ReturnValue_t triggerGpioResetPin(const uint8_t* actionData, size_t len, void* args);
|
||||
ReturnValue_t triggerGpioResetPin(uint8_t gpsId, void* args);
|
||||
|
||||
}
|
||||
|
||||
|
87
bsp_q7s/core/CoreActions.h
Normal file
87
bsp_q7s/core/CoreActions.h
Normal file
@ -0,0 +1,87 @@
|
||||
#pragma once
|
||||
|
||||
#include <fsfw/action/MinMaxParameter.h>
|
||||
#include <fsfw/action/TemplateAction.h>
|
||||
#include <fsfw/introspection/Enum.h>
|
||||
|
||||
class CoreController;
|
||||
|
||||
namespace core {
|
||||
|
||||
FSFW_ENUM(ActionId, ActionId_t,
|
||||
((LIST_DIRECTORY_INTO_FILE, 0, "List Directory into file"))(
|
||||
(SWITCH_REBOOT_FILE_HANDLING, 5,
|
||||
"Switch Reboot File Handling"))((RESET_REBOOT_COUNTERS, 6, "Reset Boot Counters"))(
|
||||
(SWITCH_IMG_LOCK, 7, "Switch Image Lock"))((SET_MAX_REBOOT_CNT, 8,
|
||||
"Set maximum reboot Count"))(
|
||||
(XSC_REBOOT_OBC, 32, "Reboot using the xsc_boot_copy command"))(
|
||||
(MOUNT_OTHER_COPY, 33, "Mount Other Copy"))((REBOOT_OBC, 34,
|
||||
"Reboot using the reboot command")))
|
||||
|
||||
FSFW_ENUM(Boolenum, uint8_t, ((NO, 0, "NO"))((YES, 1, "Yes")))
|
||||
|
||||
class ListDirectoryIntoFileAction
|
||||
: public TemplateAction<CoreController, ListDirectoryIntoFileAction, ActionId> {
|
||||
public:
|
||||
ListDirectoryIntoFileAction(CoreController *owner)
|
||||
: TemplateAction(owner, ActionId::LIST_DIRECTORY_INTO_FILE){};
|
||||
};
|
||||
|
||||
class SwitchRebootFileHandlingAction
|
||||
: public TemplateAction<CoreController, SwitchRebootFileHandlingAction, ActionId> {
|
||||
public:
|
||||
SwitchRebootFileHandlingAction(CoreController *owner)
|
||||
: TemplateAction(owner, ActionId::SWITCH_REBOOT_FILE_HANDLING){};
|
||||
|
||||
Parameter<Boolenum> enableRebootFile =
|
||||
Parameter<Boolenum>::createParameter(this, "Enable Reboot File");
|
||||
};
|
||||
|
||||
class ResetRebootCountersAction
|
||||
: public TemplateAction<CoreController, ResetRebootCountersAction, ActionId> {
|
||||
public:
|
||||
FSFW_ENUM(Selection, uint8_t, ((ZERO, "0"))((ONE, "1"))((ALL, "All")))
|
||||
|
||||
ResetRebootCountersAction(CoreController *owner)
|
||||
: TemplateAction(owner, ActionId::RESET_REBOOT_COUNTERS){};
|
||||
|
||||
Parameter<Selection> chip = Parameter<Selection>::createParameter(this, "Chip");
|
||||
Parameter<Selection> copy = Parameter<Selection>::createParameter(this, "Copy");
|
||||
};
|
||||
|
||||
class SwitchImageLockAction
|
||||
: public TemplateAction<CoreController, SwitchImageLockAction, ActionId> {
|
||||
public:
|
||||
FSFW_ENUM(Selection, uint8_t, ((ZERO, "0"))((ONE, "1")))
|
||||
|
||||
SwitchImageLockAction(CoreController *owner) : TemplateAction(owner, ActionId::SWITCH_IMG_LOCK){};
|
||||
|
||||
Parameter<Boolenum> lock = Parameter<Boolenum>::createParameter(this, "Lock Image");
|
||||
Parameter<Selection> chip = Parameter<Selection>::createParameter(this, "Chip");
|
||||
Parameter<Selection> copy = Parameter<Selection>::createParameter(this, "Copy");
|
||||
};
|
||||
|
||||
class SetMaxRebootCntAction
|
||||
: public TemplateAction<CoreController, SetMaxRebootCntAction, ActionId> {
|
||||
public:
|
||||
SetMaxRebootCntAction(CoreController *owner)
|
||||
: TemplateAction(owner, ActionId::SET_MAX_REBOOT_CNT){};
|
||||
|
||||
Parameter<uint8_t> maxCount = Parameter<uint8_t>::createParameter(this, "Count");
|
||||
};
|
||||
|
||||
class XscRebootObcAction : public TemplateAction<CoreController, XscRebootObcAction, ActionId> {
|
||||
public:
|
||||
FSFW_ENUM(Selection, uint8_t, ((ZERO, "0"))((ONE, "1"))((SAME, "Same")))
|
||||
XscRebootObcAction(CoreController *owner) : TemplateAction(owner, ActionId::XSC_REBOOT_OBC){};
|
||||
|
||||
Parameter<Selection> chip = Parameter<Selection>::createParameter(this, "Chip");
|
||||
Parameter<Selection> copy = Parameter<Selection>::createParameter(this, "Copy");
|
||||
};
|
||||
|
||||
class RebootObcAction : public TemplateAction<CoreController, RebootObcAction, ActionId> {
|
||||
public:
|
||||
RebootObcAction(CoreController *owner) : TemplateAction(owner, ActionId::REBOOT_OBC){};
|
||||
};
|
||||
|
||||
} // namespace core
|
@ -163,75 +163,73 @@ ReturnValue_t CoreController::initializeAfterTaskCreation() {
|
||||
return result;
|
||||
}
|
||||
|
||||
ReturnValue_t CoreController::executeAction(ActionId_t actionId, MessageQueueId_t commandedBy,
|
||||
const uint8_t *data, size_t size) {
|
||||
switch (actionId) {
|
||||
case (LIST_DIRECTORY_INTO_FILE): {
|
||||
return actionListDirectoryIntoFile(actionId, commandedBy, data, size);
|
||||
}
|
||||
case (SWITCH_REBOOT_FILE_HANDLING): {
|
||||
if (size < 1) {
|
||||
return HasActionsIF::INVALID_PARAMETERS;
|
||||
}
|
||||
std::string path = sdcMan->getCurrentMountPrefix() + REBOOT_FILE;
|
||||
// Disable the reboot file mechanism
|
||||
parseRebootFile(path, rebootFile);
|
||||
if (data[0] == 0) {
|
||||
rebootFile.enabled = false;
|
||||
rewriteRebootFile(rebootFile);
|
||||
} else if (data[0] == 1) {
|
||||
rebootFile.enabled = true;
|
||||
rewriteRebootFile(rebootFile);
|
||||
} else {
|
||||
return HasActionsIF::INVALID_PARAMETERS;
|
||||
}
|
||||
return HasActionsIF::EXECUTION_FINISHED;
|
||||
}
|
||||
case (RESET_REBOOT_COUNTERS): {
|
||||
if (size == 0) {
|
||||
resetRebootCount(xsc::ALL_CHIP, xsc::ALL_COPY);
|
||||
} else if (size == 2) {
|
||||
if (data[0] > 1 or data[1] > 1) {
|
||||
return HasActionsIF::INVALID_PARAMETERS;
|
||||
}
|
||||
resetRebootCount(static_cast<xsc::Chip>(data[0]), static_cast<xsc::Copy>(data[1]));
|
||||
}
|
||||
return HasActionsIF::EXECUTION_FINISHED;
|
||||
}
|
||||
case (SWITCH_IMG_LOCK): {
|
||||
if (size != 3) {
|
||||
return HasActionsIF::INVALID_PARAMETERS;
|
||||
}
|
||||
if (data[1] > 1 or data[2] > 1) {
|
||||
return HasActionsIF::INVALID_PARAMETERS;
|
||||
}
|
||||
setRebootMechanismLock(data[0], static_cast<xsc::Chip>(data[1]),
|
||||
static_cast<xsc::Copy>(data[2]));
|
||||
return HasActionsIF::EXECUTION_FINISHED;
|
||||
}
|
||||
case (SET_MAX_REBOOT_CNT): {
|
||||
if (size < 1) {
|
||||
return HasActionsIF::INVALID_PARAMETERS;
|
||||
}
|
||||
std::string path = sdcMan->getCurrentMountPrefix() + REBOOT_FILE;
|
||||
// Disable the reboot file mechanism
|
||||
parseRebootFile(path, rebootFile);
|
||||
rebootFile.maxCount = data[0];
|
||||
rewriteRebootFile(rebootFile);
|
||||
return HasActionsIF::EXECUTION_FINISHED;
|
||||
}
|
||||
case (XSC_REBOOT_OBC): {
|
||||
// Warning: This function will never return, because it reboots the system
|
||||
return actionXscReboot(data, size);
|
||||
}
|
||||
case (REBOOT_OBC): {
|
||||
// Warning: This function will never return, because it reboots the system
|
||||
return actionReboot(data, size);
|
||||
}
|
||||
default: {
|
||||
return HasActionsIF::INVALID_ACTION_ID;
|
||||
}
|
||||
ReturnValue_t CoreController::executeAction(Action *action) { return action->handle(); }
|
||||
|
||||
ReturnValue_t CoreController::handleAction(core::SwitchRebootFileHandlingAction *action) {
|
||||
std::string path = sdcMan->getCurrentMountPrefix() + REBOOT_FILE;
|
||||
// Disable the reboot file mechanism
|
||||
parseRebootFile(path, rebootFile);
|
||||
if (action->enableRebootFile.value == core::Boolenum::NO) {
|
||||
rebootFile.enabled = false;
|
||||
rewriteRebootFile(rebootFile);
|
||||
} else {
|
||||
rebootFile.enabled = true;
|
||||
rewriteRebootFile(rebootFile);
|
||||
}
|
||||
return HasActionsIF::EXECUTION_FINISHED;
|
||||
}
|
||||
|
||||
ReturnValue_t CoreController::handleAction(core::ResetRebootCountersAction *action) {
|
||||
xsc::Chip chip = xsc::NO_CHIP;
|
||||
switch (action->chip.value) {
|
||||
case core::ResetRebootCountersAction::Selection::ALL:
|
||||
chip = xsc::ALL_CHIP;
|
||||
break;
|
||||
case core::ResetRebootCountersAction::Selection::ZERO:
|
||||
chip = xsc::CHIP_0;
|
||||
break;
|
||||
case core::ResetRebootCountersAction::Selection::ONE:
|
||||
chip = xsc::CHIP_1;
|
||||
break;
|
||||
}
|
||||
xsc::Copy copy = xsc::NO_COPY;
|
||||
switch (action->copy.value) {
|
||||
case core::ResetRebootCountersAction::Selection::ALL:
|
||||
copy = xsc::ALL_COPY;
|
||||
break;
|
||||
case core::ResetRebootCountersAction::Selection::ZERO:
|
||||
copy = xsc::COPY_0;
|
||||
break;
|
||||
case core::ResetRebootCountersAction::Selection::ONE:
|
||||
copy = xsc::COPY_1;
|
||||
break;
|
||||
}
|
||||
resetRebootCount(chip, copy);
|
||||
|
||||
return HasActionsIF::EXECUTION_FINISHED;
|
||||
}
|
||||
|
||||
ReturnValue_t CoreController::handleAction(core::SwitchImageLockAction *action) {
|
||||
bool lock = action->lock.value == core::Boolenum::YES;
|
||||
xsc::Chip chip = xsc::CHIP_0;
|
||||
if (action->chip.value == core::SwitchImageLockAction::Selection::ONE) {
|
||||
chip = xsc::CHIP_1;
|
||||
}
|
||||
xsc::Copy copy = xsc::COPY_0;
|
||||
if (action->copy.value == core::SwitchImageLockAction::Selection::ONE) {
|
||||
copy = xsc::COPY_0;
|
||||
}
|
||||
setRebootMechanismLock(lock, chip, copy);
|
||||
return HasActionsIF::EXECUTION_FINISHED;
|
||||
}
|
||||
|
||||
ReturnValue_t CoreController::handleAction(core::SetMaxRebootCntAction *action) {
|
||||
std::string path = sdcMan->getCurrentMountPrefix() + REBOOT_FILE;
|
||||
// Disable the reboot file mechanism
|
||||
parseRebootFile(path, rebootFile);
|
||||
rebootFile.maxCount = action->maxCount;
|
||||
rewriteRebootFile(rebootFile);
|
||||
return HasActionsIF::EXECUTION_FINISHED;
|
||||
}
|
||||
|
||||
ReturnValue_t CoreController::checkModeCommand(Mode_t mode, Submode_t submode,
|
||||
@ -748,30 +746,29 @@ ReturnValue_t CoreController::initVersionFile() {
|
||||
return HasReturnvaluesIF::RETURN_OK;
|
||||
}
|
||||
|
||||
ReturnValue_t CoreController::actionListDirectoryIntoFile(ActionId_t actionId,
|
||||
MessageQueueId_t commandedBy,
|
||||
const uint8_t *data, size_t size) {
|
||||
ReturnValue_t CoreController::handleAction(core::ListDirectoryIntoFileAction *action) {
|
||||
// TODO: Packet definition for clean deserialization
|
||||
// 2 bytes for a and R flag, at least 5 bytes for minimum valid path /tmp with
|
||||
// null termination, at least 7 bytes for minimum target file name /tmp/a with
|
||||
// null termination.
|
||||
if (size < 14) {
|
||||
return HasActionsIF::INVALID_PARAMETERS;
|
||||
}
|
||||
// TODO make work again
|
||||
// if (size < 14) {
|
||||
// return HasActionsIF::INVALID_PARAMETERS;
|
||||
// }
|
||||
// We could also make -l optional, but I can't think of a reason why to not use -l..
|
||||
|
||||
// This flag specifies to run ls with -a
|
||||
bool aFlag = data[0];
|
||||
data += 1;
|
||||
// This flag specifies to run ls with -R
|
||||
bool RFlag = data[1];
|
||||
data += 1;
|
||||
bool aFlag = 0; // data[0];
|
||||
// data += 1;
|
||||
// This flag specifies to run ls with -R
|
||||
bool RFlag = 0; // data[1];
|
||||
// data += 1;
|
||||
|
||||
size_t remainingSize = size - 2;
|
||||
size_t remainingSize = 0; // size - 2;
|
||||
// One larger for null termination, which prevents undefined behaviour if the sent
|
||||
// strings are not 0 terminated properly
|
||||
std::vector<uint8_t> repoAndTargetFileBuffer(remainingSize + 1, 0);
|
||||
std::memcpy(repoAndTargetFileBuffer.data(), data, remainingSize);
|
||||
// std::memcpy(repoAndTargetFileBuffer.data(), data, remainingSize);
|
||||
const char *currentCharPtr = reinterpret_cast<const char *>(repoAndTargetFileBuffer.data());
|
||||
// Full target file name
|
||||
std::string repoName(currentCharPtr);
|
||||
@ -798,7 +795,7 @@ ReturnValue_t CoreController::actionListDirectoryIntoFile(ActionId_t actionId,
|
||||
int result = std::system(oss.str().c_str());
|
||||
if (result != 0) {
|
||||
utility::handleSystemError(result, "CoreController::actionListDirectoryIntoFile");
|
||||
actionHelper.finish(false, commandedBy, actionId);
|
||||
actionHelper.finish(false, action->commandedBy, action->getId());
|
||||
}
|
||||
return HasReturnvaluesIF::RETURN_OK;
|
||||
}
|
||||
@ -857,11 +854,16 @@ void CoreController::initPrint() {
|
||||
#endif
|
||||
}
|
||||
|
||||
ReturnValue_t CoreController::actionXscReboot(const uint8_t *data, size_t size) {
|
||||
if (size < 1) {
|
||||
ReturnValue_t CoreController::handleAction(core::XscRebootObcAction *action) {
|
||||
if (action->chip.value == core::XscRebootObcAction::Selection::SAME and
|
||||
not(action->copy.value == core::XscRebootObcAction::Selection::SAME)) {
|
||||
return HasActionsIF::INVALID_PARAMETERS;
|
||||
}
|
||||
bool rebootSameBootCopy = data[0];
|
||||
bool rebootSameBootCopy = false;
|
||||
if (action->chip.value == core::XscRebootObcAction::Selection::SAME and
|
||||
action->copy.value == core::XscRebootObcAction::Selection::SAME) {
|
||||
rebootSameBootCopy = true;
|
||||
}
|
||||
bool protOpPerformed = false;
|
||||
SdCardManager::instance()->setBlocking(true);
|
||||
if (rebootSameBootCopy) {
|
||||
@ -876,19 +878,23 @@ ReturnValue_t CoreController::actionXscReboot(const uint8_t *data, size_t size)
|
||||
}
|
||||
return HasActionsIF::EXECUTION_FINISHED;
|
||||
}
|
||||
if (size < 3 or (data[1] > 1 or data[2] > 1)) {
|
||||
return HasActionsIF::INVALID_PARAMETERS;
|
||||
}
|
||||
#if OBSW_VERBOSE_LEVEL >= 1
|
||||
sif::info << "CoreController::actionPerformReboot: Rebooting on " << static_cast<int>(data[1])
|
||||
<< " " << static_cast<int>(data[2]) << std::endl;
|
||||
sif::info << "CoreController::actionPerformReboot: Rebooting on "
|
||||
<< static_cast<uint8_t>(action->chip.value) << " "
|
||||
<< static_cast<uint8_t>(action->copy.value) << std::endl;
|
||||
#endif
|
||||
|
||||
// Check that the target chip and copy is writeprotected first
|
||||
generateChipStateFile();
|
||||
// If any boot copies are unprotected, protect them here
|
||||
auto tgtChip = static_cast<xsc::Chip>(data[1]);
|
||||
auto tgtCopy = static_cast<xsc::Copy>(data[2]);
|
||||
auto tgtChip = xsc::CHIP_0;
|
||||
if (action->chip.value == core::XscRebootObcAction::Selection::ONE) {
|
||||
tgtChip = xsc::CHIP_1;
|
||||
}
|
||||
auto tgtCopy = xsc::COPY_0;
|
||||
if (action->copy.value == core::XscRebootObcAction::Selection::ONE) {
|
||||
tgtCopy = xsc::COPY_1;
|
||||
}
|
||||
|
||||
// This function can not really fail
|
||||
gracefulShutdownTasks(tgtChip, tgtCopy, protOpPerformed);
|
||||
@ -932,7 +938,7 @@ ReturnValue_t CoreController::actionXscReboot(const uint8_t *data, size_t size)
|
||||
return HasReturnvaluesIF::RETURN_FAILED;
|
||||
}
|
||||
|
||||
ReturnValue_t CoreController::actionReboot(const uint8_t *data, size_t size) {
|
||||
ReturnValue_t CoreController::handleAction(core::RebootObcAction *action) {
|
||||
bool protOpPerformed = false;
|
||||
gracefulShutdownTasks(xsc::Chip::CHIP_0, xsc::Copy::COPY_0, protOpPerformed);
|
||||
std::system("reboot");
|
||||
@ -1692,24 +1698,20 @@ void CoreController::resetRebootCount(xsc::Chip tgtChip, xsc::Copy tgtCopy) {
|
||||
std::string path = currMntPrefix + REBOOT_FILE;
|
||||
// Disable the reboot file mechanism
|
||||
parseRebootFile(path, rebootFile);
|
||||
if (tgtChip == xsc::ALL_CHIP and tgtCopy == xsc::ALL_COPY) {
|
||||
rebootFile.img00Cnt = 0;
|
||||
rebootFile.img01Cnt = 0;
|
||||
rebootFile.img10Cnt = 0;
|
||||
rebootFile.img11Cnt = 0;
|
||||
} else {
|
||||
if (tgtChip == xsc::CHIP_0) {
|
||||
if (tgtCopy == xsc::COPY_0) {
|
||||
rebootFile.img00Cnt = 0;
|
||||
} else {
|
||||
rebootFile.img01Cnt = 0;
|
||||
}
|
||||
} else {
|
||||
if (tgtCopy == xsc::COPY_0) {
|
||||
rebootFile.img10Cnt = 0;
|
||||
} else {
|
||||
rebootFile.img11Cnt = 0;
|
||||
}
|
||||
if (tgtChip == xsc::ALL_CHIP or tgtChip == xsc::CHIP_0) {
|
||||
if (tgtCopy == xsc::ALL_COPY or tgtCopy == xsc::COPY_0) {
|
||||
rebootFile.img00Cnt = 0;
|
||||
}
|
||||
if (tgtCopy == xsc::ALL_COPY or tgtCopy == xsc::COPY_1) {
|
||||
rebootFile.img01Cnt = 0;
|
||||
}
|
||||
}
|
||||
if (tgtChip == xsc::ALL_CHIP or tgtChip == xsc::CHIP_1) {
|
||||
if (tgtCopy == xsc::ALL_COPY or tgtCopy == xsc::COPY_0) {
|
||||
rebootFile.img10Cnt = 0;
|
||||
}
|
||||
if (tgtCopy == xsc::ALL_COPY or tgtCopy == xsc::COPY_1) {
|
||||
rebootFile.img11Cnt = 0;
|
||||
}
|
||||
}
|
||||
rewriteRebootFile(rebootFile);
|
||||
@ -1849,3 +1851,7 @@ bool CoreController::isNumber(const std::string &s) {
|
||||
return !s.empty() && std::find_if(s.begin(), s.end(),
|
||||
[](unsigned char c) { return !std::isdigit(c); }) == s.end();
|
||||
}
|
||||
|
||||
ModeDefinitionHelper CoreController::getModeDefinitionHelper() {
|
||||
return ModeDefinitionHelper::create<ControllerModes, DefaultSubmode>();
|
||||
}
|
@ -6,6 +6,7 @@
|
||||
|
||||
#include <cstddef>
|
||||
|
||||
#include "CoreActions.h"
|
||||
#include "CoreDefinitions.h"
|
||||
#include "bsp_q7s/memory/SdCardManager.h"
|
||||
#include "events/subsystemIdRanges.h"
|
||||
@ -61,18 +62,6 @@ class CoreController : public ExtendedControllerBase {
|
||||
"/" + std::string(CONF_FOLDER) + "/" + std::string(REBOOT_FILE_NAME);
|
||||
const std::string TIME_FILE = "/" + std::string(CONF_FOLDER) + "/" + std::string(TIME_FILE_NAME);
|
||||
|
||||
static constexpr ActionId_t LIST_DIRECTORY_INTO_FILE = 0;
|
||||
static constexpr ActionId_t SWITCH_REBOOT_FILE_HANDLING = 5;
|
||||
static constexpr ActionId_t RESET_REBOOT_COUNTERS = 6;
|
||||
static constexpr ActionId_t SWITCH_IMG_LOCK = 7;
|
||||
static constexpr ActionId_t SET_MAX_REBOOT_CNT = 8;
|
||||
|
||||
//! Reboot using the xsc_boot_copy command
|
||||
static constexpr ActionId_t XSC_REBOOT_OBC = 32;
|
||||
static constexpr ActionId_t MOUNT_OTHER_COPY = 33;
|
||||
//! Reboot using the reboot command
|
||||
static constexpr ActionId_t REBOOT_OBC = 34;
|
||||
|
||||
static constexpr uint8_t SUBSYSTEM_ID = SUBSYSTEM_ID::CORE;
|
||||
|
||||
static constexpr Event ALLOC_FAILURE = event::makeEvent(SUBSYSTEM_ID, 0, severity::MEDIUM);
|
||||
@ -94,8 +83,17 @@ class CoreController : public ExtendedControllerBase {
|
||||
|
||||
ReturnValue_t initializeAfterTaskCreation() override;
|
||||
|
||||
ReturnValue_t executeAction(ActionId_t actionId, MessageQueueId_t commandedBy,
|
||||
const uint8_t* data, size_t size) override;
|
||||
ReturnValue_t executeAction(Action* action) override;
|
||||
|
||||
ReturnValue_t handleAction(core::ListDirectoryIntoFileAction* action);
|
||||
ReturnValue_t handleAction(core::SwitchRebootFileHandlingAction* action);
|
||||
ReturnValue_t handleAction(core::ResetRebootCountersAction* action);
|
||||
ReturnValue_t handleAction(core::SwitchImageLockAction* action);
|
||||
ReturnValue_t handleAction(core::SetMaxRebootCntAction* action);
|
||||
ReturnValue_t handleAction(core::XscRebootObcAction* action);
|
||||
ReturnValue_t handleAction(core::RebootObcAction* action);
|
||||
|
||||
ModeDefinitionHelper getModeDefinitionHelper() override;
|
||||
|
||||
ReturnValue_t handleCommandMessage(CommandMessage* message) override;
|
||||
void performControlOperation() override;
|
||||
@ -197,6 +195,16 @@ class CoreController : public ExtendedControllerBase {
|
||||
|
||||
core::HkSet hkSet;
|
||||
|
||||
core::ListDirectoryIntoFileAction listDirectoryIntoFileAction =
|
||||
core::ListDirectoryIntoFileAction(this);
|
||||
core::SwitchRebootFileHandlingAction switchRebootFileHandlingAction =
|
||||
core::SwitchRebootFileHandlingAction(this);
|
||||
core::ResetRebootCountersAction resetRebootCountersAction = core::ResetRebootCountersAction(this);
|
||||
core::SwitchImageLockAction switchImageLockAction = core::SwitchImageLockAction(this);
|
||||
core::SetMaxRebootCntAction setMaxRebootCntAction = core::SetMaxRebootCntAction(this);
|
||||
core::XscRebootObcAction xscRebootObcAction = core::XscRebootObcAction(this);
|
||||
core::RebootObcAction rebootObcAction = core::RebootObcAction(this);
|
||||
|
||||
ReturnValue_t initializeLocalDataPool(localpool::DataPool& localDataPoolMap,
|
||||
LocalDataPoolManager& poolManager) override;
|
||||
Countdown sdCardCheckCd = Countdown(120000);
|
||||
@ -224,8 +232,6 @@ class CoreController : public ExtendedControllerBase {
|
||||
void checkExternalSdCommandStatus();
|
||||
void performRebootFileHandling(bool recreateFile);
|
||||
|
||||
ReturnValue_t actionListDirectoryIntoFile(ActionId_t actionId, MessageQueueId_t commandedBy,
|
||||
const uint8_t* data, size_t size);
|
||||
ReturnValue_t actionXscReboot(const uint8_t* data, size_t size);
|
||||
ReturnValue_t actionReboot(const uint8_t* data, size_t size);
|
||||
|
||||
|
@ -92,7 +92,7 @@ ReturnValue_t readToFile(std::string name, std::ifstream& file, std::string& fil
|
||||
|
||||
} // End of anonymous namespace
|
||||
|
||||
template <typename T, class = typename std::enable_if<std::is_integral<T>::value>::type>
|
||||
template <typename T, class>
|
||||
inline ReturnValue_t writeNumber(std::string key, T num) noexcept {
|
||||
std::ostringstream oss;
|
||||
oss << "xsc_scratch write " << key << " " << std::to_string(num);
|
||||
@ -104,7 +104,7 @@ inline ReturnValue_t writeNumber(std::string key, T num) noexcept {
|
||||
return HasReturnvaluesIF::RETURN_OK;
|
||||
}
|
||||
|
||||
template <typename T, class = typename std::enable_if<std::is_integral<T>::value>::type>
|
||||
template <typename T, class>
|
||||
inline ReturnValue_t readNumber(std::string key, T& num) noexcept {
|
||||
using namespace std;
|
||||
ifstream file;
|
||||
|
@ -3,83 +3,85 @@
|
||||
|
||||
#include <cstdint>
|
||||
|
||||
#include <fsfw/introspection/ClasslessEnum.h>
|
||||
|
||||
namespace objects {
|
||||
enum commonObjects : uint32_t {
|
||||
FSFW_CLASSLESS_ENUM(commonObjects, uint32_t,
|
||||
/* First Byte 0x50-0x52 reserved for PUS Services **/
|
||||
CCSDS_PACKET_DISTRIBUTOR = 0x50000100,
|
||||
PUS_PACKET_DISTRIBUTOR = 0x50000200,
|
||||
TMTC_BRIDGE = 0x50000300,
|
||||
TMTC_POLLING_TASK = 0x50000400,
|
||||
FILE_SYSTEM_HANDLER = 0x50000500,
|
||||
SDC_MANAGER = 0x50000550,
|
||||
PTME = 0x50000600,
|
||||
PDEC_HANDLER = 0x50000700,
|
||||
CCSDS_HANDLER = 0x50000800,
|
||||
((CCSDS_PACKET_DISTRIBUTOR, 0x50000100, "CCSDS_PACKET_DISTRIBUTOR"))
|
||||
((PUS_PACKET_DISTRIBUTOR, 0x50000200, "PUS_PACKET_DISTRIBUTOR"))
|
||||
((TMTC_BRIDGE, 0x50000300, "TMTC_BRIDGE"))
|
||||
((TMTC_POLLING_TASK, 0x50000400, "TMTC_POLLING_TASK"))
|
||||
((FILE_SYSTEM_HANDLER, 0x50000500, "FILE_SYSTEM_HANDLER"))
|
||||
((SDC_MANAGER, 0x50000550, "SDC_MANAGER"))
|
||||
((PTME, 0x50000600, "PTME"))
|
||||
((PDEC_HANDLER, 0x50000700, "PDEC_HANDLER"))
|
||||
((CCSDS_HANDLER, 0x50000800, "CCSDS_HANDLER"))
|
||||
|
||||
/* 0x43 ('C') for Controllers */
|
||||
THERMAL_CONTROLLER = 0x43400001,
|
||||
ACS_CONTROLLER = 0x43000002,
|
||||
CORE_CONTROLLER = 0x43000003,
|
||||
((THERMAL_CONTROLLER, 0x43400001, "THERMAL_CONTROLLER"))
|
||||
((ACS_CONTROLLER, 0x43000002, "ACS_CONTROLLER"))
|
||||
((CORE_CONTROLLER, 0x43000003, "CORE_CONTROLLER"))
|
||||
|
||||
/* 0x44 ('D') for device handlers */
|
||||
MGM_0_LIS3_HANDLER = 0x44120006,
|
||||
MGM_1_RM3100_HANDLER = 0x44120107,
|
||||
MGM_2_LIS3_HANDLER = 0x44120208,
|
||||
MGM_3_RM3100_HANDLER = 0x44120309,
|
||||
GYRO_0_ADIS_HANDLER = 0x44120010,
|
||||
GYRO_1_L3G_HANDLER = 0x44120111,
|
||||
GYRO_2_ADIS_HANDLER = 0x44120212,
|
||||
GYRO_3_L3G_HANDLER = 0x44120313,
|
||||
RW1 = 0x44120047,
|
||||
RW2 = 0x44120148,
|
||||
RW3 = 0x44120249,
|
||||
RW4 = 0x44120350,
|
||||
STAR_TRACKER = 0x44130001,
|
||||
GPS_CONTROLLER = 0x44130045,
|
||||
((MGM_0_LIS3_HANDLER, 0x44120006, "MGM_0_LIS3_HANDLER"))
|
||||
((MGM_1_RM3100_HANDLER, 0x44120107, "MGM_1_RM3100_HANDLER"))
|
||||
((MGM_2_LIS3_HANDLER, 0x44120208, "MGM_2_LIS3_HANDLER"))
|
||||
((MGM_3_RM3100_HANDLER, 0x44120309, "MGM_3_RM3100_HANDLER"))
|
||||
((GYRO_0_ADIS_HANDLER, 0x44120010, "GYRO_0_ADIS_HANDLER"))
|
||||
((GYRO_1_L3G_HANDLER, 0x44120111, "GYRO_1_L3G_HANDLER"))
|
||||
((GYRO_2_ADIS_HANDLER, 0x44120212, "GYRO_2_ADIS_HANDLER"))
|
||||
((GYRO_3_L3G_HANDLER, 0x44120313, "GYRO_3_L3G_HANDLER"))
|
||||
((RW1, 0x44120047, "RW1"))
|
||||
((RW2, 0x44120148, "RW2"))
|
||||
((RW3, 0x44120249, "RW3"))
|
||||
((RW4, 0x44120350, "RW4"))
|
||||
((STAR_TRACKER, 0x44130001, "STAR_TRACKER"))
|
||||
((GPS_CONTROLLER, 0x44130045, "GPS_CONTROLLER"))
|
||||
|
||||
IMTQ_HANDLER = 0x44140014,
|
||||
TMP1075_HANDLER_1 = 0x44420004,
|
||||
TMP1075_HANDLER_2 = 0x44420005,
|
||||
PCDU_HANDLER = 0x442000A1,
|
||||
P60DOCK_HANDLER = 0x44250000,
|
||||
PDU1_HANDLER = 0x44250001,
|
||||
PDU2_HANDLER = 0x44250002,
|
||||
ACU_HANDLER = 0x44250003,
|
||||
BPX_BATT_HANDLER = 0x44260000,
|
||||
PLPCDU_HANDLER = 0x44300000,
|
||||
RAD_SENSOR = 0x443200A5,
|
||||
PLOC_UPDATER = 0x44330000,
|
||||
PLOC_MEMORY_DUMPER = 0x44330001,
|
||||
STR_HELPER = 0x44330002,
|
||||
PLOC_MPSOC_HELPER = 0x44330003,
|
||||
AXI_PTME_CONFIG = 0x44330004,
|
||||
PTME_CONFIG = 0x44330005,
|
||||
PLOC_MPSOC_HANDLER = 0x44330015,
|
||||
PLOC_SUPERVISOR_HANDLER = 0x44330016,
|
||||
PLOC_SUPERVISOR_HELPER = 0x44330017,
|
||||
SOLAR_ARRAY_DEPL_HANDLER = 0x444100A2,
|
||||
HEATER_HANDLER = 0x444100A4,
|
||||
((IMTQ_HANDLER, 0x44140014, "IMTQ_HANDLER"))
|
||||
((TMP1075_HANDLER_1, 0x44420004, "TMP1075_HANDLER_1"))
|
||||
((TMP1075_HANDLER_2, 0x44420005, "TMP1075_HANDLER_2"))
|
||||
((PCDU_HANDLER, 0x442000A1, "PCDU_HANDLER"))
|
||||
((P60DOCK_HANDLER, 0x44250000, "P60DOCK_HANDLER"))
|
||||
((PDU1_HANDLER, 0x44250001, "PDU1_HANDLER"))
|
||||
((PDU2_HANDLER, 0x44250002, "PDU2_HANDLER"))
|
||||
((ACU_HANDLER, 0x44250003, "ACU_HANDLER"))
|
||||
((BPX_BATT_HANDLER, 0x44260000, "BPX_BATT_HANDLER"))
|
||||
((PLPCDU_HANDLER, 0x44300000, "PLPCDU_HANDLER"))
|
||||
((RAD_SENSOR, 0x443200A5, "RAD_SENSOR"))
|
||||
((PLOC_UPDATER, 0x44330000, "PLOC_UPDATER"))
|
||||
((PLOC_MEMORY_DUMPER, 0x44330001, "PLOC_MEMORY_DUMPER"))
|
||||
((STR_HELPER, 0x44330002, "STR_HELPER"))
|
||||
((PLOC_MPSOC_HELPER, 0x44330003, "PLOC_MPSOC_HELPER"))
|
||||
((AXI_PTME_CONFIG, 0x44330004, "AXI_PTME_CONFIG"))
|
||||
((PTME_CONFIG, 0x44330005, "PTME_CONFIG"))
|
||||
((PLOC_MPSOC_HANDLER, 0x44330015, "PLOC_MPSOC_HANDLER"))
|
||||
((PLOC_SUPERVISOR_HANDLER, 0x44330016, "PLOC_SUPERVISOR_HANDLER"))
|
||||
((PLOC_SUPERVISOR_HELPER, 0x44330017, "PLOC_SUPERVISOR_HELPER"))
|
||||
((SOLAR_ARRAY_DEPL_HANDLER, 0x444100A2, "SOLAR_ARRAY_DEPL_HANDLER"))
|
||||
((HEATER_HANDLER, 0x444100A4, "HEATER_HANDLER"))
|
||||
|
||||
/**
|
||||
* Not yet specified which pt1000 will measure which device/location in the satellite.
|
||||
* Therefore object ids are named according to the IC naming of the RTDs in the schematic.
|
||||
*/
|
||||
RTD_0_IC3_PLOC_HEATSPREADER = 0x44420016,
|
||||
RTD_1_IC4_PLOC_MISSIONBOARD = 0x44420017,
|
||||
RTD_2_IC5_4K_CAMERA = 0x44420018,
|
||||
RTD_3_IC6_DAC_HEATSPREADER = 0x44420019,
|
||||
RTD_4_IC7_STARTRACKER = 0x44420020,
|
||||
RTD_5_IC8_RW1_MX_MY = 0x44420021,
|
||||
RTD_6_IC9_DRO = 0x44420022,
|
||||
RTD_7_IC10_SCEX = 0x44420023,
|
||||
RTD_8_IC11_X8 = 0x44420024,
|
||||
RTD_9_IC12_HPA = 0x44420025,
|
||||
RTD_10_IC13_PL_TX = 0x44420026,
|
||||
RTD_11_IC14_MPA = 0x44420027,
|
||||
RTD_12_IC15_ACU = 0x44420028,
|
||||
RTD_13_IC16_PLPCDU_HEATSPREADER = 0x44420029,
|
||||
RTD_14_IC17_TCS_BOARD = 0x44420030,
|
||||
RTD_15_IC18_IMTQ = 0x44420031,
|
||||
((RTD_0_IC3_PLOC_HEATSPREADER, 0x44420016, "RTD_0_IC3_PLOC_HEATSPREADER"))
|
||||
((RTD_1_IC4_PLOC_MISSIONBOARD, 0x44420017, "RTD_1_IC4_PLOC_MISSIONBOARD"))
|
||||
((RTD_2_IC5_4K_CAMERA, 0x44420018, "RTD_2_IC5_4K_CAMERA"))
|
||||
((RTD_3_IC6_DAC_HEATSPREADER, 0x44420019, "RTD_3_IC6_DAC_HEATSPREADER"))
|
||||
((RTD_4_IC7_STARTRACKER, 0x44420020, "RTD_4_IC7_STARTRACKER"))
|
||||
((RTD_5_IC8_RW1_MX_MY, 0x44420021, "RTD_5_IC8_RW1_MX_MY"))
|
||||
((RTD_6_IC9_DRO, 0x44420022, "RTD_6_IC9_DRO"))
|
||||
((RTD_7_IC10_SCEX, 0x44420023, "RTD_7_IC10_SCEX"))
|
||||
((RTD_8_IC11_X8, 0x44420024, "RTD_8_IC11_X8"))
|
||||
((RTD_9_IC12_HPA, 0x44420025, "RTD_9_IC12_HPA"))
|
||||
((RTD_10_IC13_PL_TX, 0x44420026, "RTD_10_IC13_PL_TX"))
|
||||
((RTD_11_IC14_MPA, 0x44420027, "RTD_11_IC14_MPA"))
|
||||
((RTD_12_IC15_ACU, 0x44420028, "RTD_12_IC15_ACU"))
|
||||
((RTD_13_IC16_PLPCDU_HEATSPREADER, 0x44420029, "RTD_13_IC16_PLPCDU_HEATSPREADER"))
|
||||
((RTD_14_IC17_TCS_BOARD, 0x44420030, "RTD_14_IC17_TCS_BOARD"))
|
||||
((RTD_15_IC18_IMTQ, 0x44420031, "RTD_15_IC18_IMTQ"))
|
||||
|
||||
// Name convention for SUS devices
|
||||
// SUS_<IDX>_<N/R>_LOC_X<F/M/B>Y<F/M/B>Z<F/M/B>_PT_<DIR><F/B>
|
||||
@ -87,42 +89,42 @@ enum commonObjects : uint32_t {
|
||||
// PT: Pointing
|
||||
// N/R: Nominal/Redundant
|
||||
// F/M/B: Forward/Middle/Backwards
|
||||
SUS_0_N_LOC_XFYFZM_PT_XF = 0x44120032,
|
||||
SUS_6_R_LOC_XFYBZM_PT_XF = 0x44120038,
|
||||
((SUS_0_N_LOC_XFYFZM_PT_XF, 0x44120032, "SUS_0_N_LOC_XFYFZM_PT_XF"))
|
||||
((SUS_6_R_LOC_XFYBZM_PT_XF, 0x44120038, "SUS_6_R_LOC_XFYBZM_PT_XF"))
|
||||
|
||||
SUS_1_N_LOC_XBYFZM_PT_XB = 0x44120033,
|
||||
SUS_7_R_LOC_XBYBZM_PT_XB = 0x44120039,
|
||||
((SUS_1_N_LOC_XBYFZM_PT_XB, 0x44120033, "SUS_1_N_LOC_XBYFZM_PT_XB"))
|
||||
((SUS_7_R_LOC_XBYBZM_PT_XB, 0x44120039, "SUS_7_R_LOC_XBYBZM_PT_XB"))
|
||||
|
||||
SUS_2_N_LOC_XFYBZB_PT_YB = 0x44120034,
|
||||
SUS_8_R_LOC_XBYBZB_PT_YB = 0x44120040,
|
||||
((SUS_2_N_LOC_XFYBZB_PT_YB, 0x44120034, "SUS_2_N_LOC_XFYBZB_PT_YB"))
|
||||
((SUS_8_R_LOC_XBYBZB_PT_YB, 0x44120040, "SUS_8_R_LOC_XBYBZB_PT_YB"))
|
||||
|
||||
SUS_3_N_LOC_XFYBZF_PT_YF = 0x44120035,
|
||||
SUS_9_R_LOC_XBYBZB_PT_YF = 0x44120041,
|
||||
((SUS_3_N_LOC_XFYBZF_PT_YF, 0x44120035, "SUS_3_N_LOC_XFYBZF_PT_YF"))
|
||||
((SUS_9_R_LOC_XBYBZB_PT_YF, 0x44120041, "SUS_9_R_LOC_XBYBZB_PT_YF"))
|
||||
|
||||
SUS_4_N_LOC_XMYFZF_PT_ZF = 0x44120036,
|
||||
SUS_10_N_LOC_XMYBZF_PT_ZF = 0x44120042,
|
||||
((SUS_4_N_LOC_XMYFZF_PT_ZF, 0x44120036, "SUS_4_N_LOC_XMYFZF_PT_ZF"))
|
||||
((SUS_10_N_LOC_XMYBZF_PT_ZF, 0x44120042, "SUS_10_N_LOC_XMYBZF_PT_ZF"))
|
||||
|
||||
SUS_5_N_LOC_XFYMZB_PT_ZB = 0x44120037,
|
||||
SUS_11_R_LOC_XBYMZB_PT_ZB = 0x44120043,
|
||||
((SUS_5_N_LOC_XFYMZB_PT_ZB, 0x44120037, "SUS_5_N_LOC_XFYMZB_PT_ZB"))
|
||||
((SUS_11_R_LOC_XBYMZB_PT_ZB, 0x44120043, "SUS_11_R_LOC_XBYMZB_PT_ZB"))
|
||||
|
||||
SYRLINKS_HK_HANDLER = 0x445300A3,
|
||||
((SYRLINKS_HK_HANDLER, 0x445300A3, "SYRLINKS_HK_HANDLER"))
|
||||
|
||||
// 0x60 for other stuff
|
||||
HEATER_0_PLOC_PROC_BRD = 0x60000000,
|
||||
HEATER_1_PCDU_BRD = 0x60000001,
|
||||
HEATER_2_ACS_BRD = 0x60000002,
|
||||
HEATER_3_OBC_BRD = 0x60000003,
|
||||
HEATER_4_CAMERA = 0x60000004,
|
||||
HEATER_5_STR = 0x60000005,
|
||||
HEATER_6_DRO = 0x60000006,
|
||||
HEATER_7_HPA = 0x60000007,
|
||||
((HEATER_0_PLOC_PROC_BRD, 0x60000000, "HEATER_0_PLOC_PROC_BRD"))
|
||||
((HEATER_1_PCDU_BRD, 0x60000001, "HEATER_1_PCDU_BRD"))
|
||||
((HEATER_2_ACS_BRD, 0x60000002, "HEATER_2_ACS_BRD"))
|
||||
((HEATER_3_OBC_BRD, 0x60000003, "HEATER_3_OBC_BRD"))
|
||||
((HEATER_4_CAMERA, 0x60000004, "HEATER_4_CAMERA"))
|
||||
((HEATER_5_STR, 0x60000005, "HEATER_5_STR"))
|
||||
((HEATER_6_DRO, 0x60000006, "HEATER_6_DRO"))
|
||||
((HEATER_7_HPA, 0x60000007, "HEATER_7_HPA"))
|
||||
|
||||
// 0x73 ('s') for assemblies and system/subsystem components
|
||||
ACS_BOARD_ASS = 0x73000001,
|
||||
SUS_BOARD_ASS = 0x73000002,
|
||||
TCS_BOARD_ASS = 0x73000003,
|
||||
RW_ASS = 0x73000004
|
||||
};
|
||||
((ACS_BOARD_ASS, 0x73000001, "ACS_BOARD_ASS"))
|
||||
((SUS_BOARD_ASS, 0x73000002, "SUS_BOARD_ASS"))
|
||||
((TCS_BOARD_ASS, 0x73000003, "TCS_BOARD_ASS"))
|
||||
((RW_ASS, 0x73000004, "RW_ASS"))
|
||||
)
|
||||
}
|
||||
|
||||
#endif /* COMMON_CONFIG_COMMONOBJECTS_H_ */
|
||||
|
2
fsfw
2
fsfw
@ -1 +1 @@
|
||||
Subproject commit d975958120bd151dabdc450a104e9cc8069ff509
|
||||
Subproject commit 383bafe3446a832edc466d850c637ea879fa1934
|
@ -1,7 +1,7 @@
|
||||
add_subdirectory(csp)
|
||||
add_subdirectory(utility)
|
||||
add_subdirectory(callbacks)
|
||||
add_subdirectory(boardtest)
|
||||
#add_subdirectory(boardtest)
|
||||
add_subdirectory(devices)
|
||||
add_subdirectory(fsfwconfig)
|
||||
add_subdirectory(obc)
|
||||
|
@ -53,22 +53,24 @@ ReturnValue_t GPSHyperionLinuxController::checkModeCommand(Mode_t mode, Submode_
|
||||
return HasReturnvaluesIF::RETURN_OK;
|
||||
}
|
||||
|
||||
ReturnValue_t GPSHyperionLinuxController::executeAction(ActionId_t actionId,
|
||||
MessageQueueId_t commandedBy,
|
||||
const uint8_t *data, size_t size) {
|
||||
switch (actionId) {
|
||||
case (GpsHyperion::TRIGGER_RESET_PIN_GNSS): {
|
||||
if (resetCallback != nullptr) {
|
||||
PoolReadGuard pg(&gpsSet);
|
||||
// Set HK entries invalid
|
||||
gpsSet.setValidity(false, true);
|
||||
resetCallback(data, size, resetCallbackArgs);
|
||||
return HasActionsIF::EXECUTION_FINISHED;
|
||||
}
|
||||
return DeviceHandlerIF::COMMAND_NOT_IMPLEMENTED;
|
||||
}
|
||||
ModeDefinitionHelper GPSHyperionLinuxController::getModeDefinitionHelper() {
|
||||
//TODO verify which modes are supported
|
||||
return ModeDefinitionHelper::create<ControllerModes, DefaultSubmode>();
|
||||
}
|
||||
|
||||
ReturnValue_t GPSHyperionLinuxController::executeAction(Action *action) {
|
||||
return action->handle();
|
||||
}
|
||||
|
||||
ReturnValue_t GPSHyperionLinuxController::handleAction(GPSHyperionLinuxAction * action) {
|
||||
if (resetCallback != nullptr) {
|
||||
PoolReadGuard pg(&gpsSet);
|
||||
// Set HK entries invalid
|
||||
gpsSet.setValidity(false, true);
|
||||
resetCallback(static_cast<uint8_t>(action->gpsId.value), resetCallbackArgs);
|
||||
return HasActionsIF::EXECUTION_FINISHED;
|
||||
}
|
||||
return HasReturnvaluesIF::RETURN_OK;
|
||||
return DeviceHandlerIF::COMMAND_NOT_IMPLEMENTED;
|
||||
}
|
||||
|
||||
ReturnValue_t GPSHyperionLinuxController::initializeLocalDataPool(
|
||||
|
@ -2,10 +2,11 @@
|
||||
#define MISSION_DEVICES_GPSHYPERIONHANDLER_H_
|
||||
|
||||
#include "commonSubsystemIds.h"
|
||||
#include "devicedefinitions/GPSHyperionLinuxDefinitions.h"
|
||||
#include "fsfw/FSFW.h"
|
||||
#include "fsfw/controller/ExtendedControllerBase.h"
|
||||
#include "fsfw/devicehandlers/DeviceHandlerBase.h"
|
||||
#include "mission/devices/devicedefinitions/GPSDefinitions.h"
|
||||
|
||||
|
||||
#ifdef FSFW_OSAL_LINUX
|
||||
#include <gps.h>
|
||||
@ -30,7 +31,7 @@ class GPSHyperionLinuxController : public ExtendedControllerBase {
|
||||
bool debugHyperionGps = false);
|
||||
virtual ~GPSHyperionLinuxController();
|
||||
|
||||
using gpioResetFunction_t = ReturnValue_t (*)(const uint8_t* actionData, size_t len, void* args);
|
||||
using gpioResetFunction_t = ReturnValue_t (*)(uint8_t gpsId, void* args);
|
||||
|
||||
void setResetPinTriggerFunction(gpioResetFunction_t resetCallback, void* args);
|
||||
ReturnValue_t handleCommandMessage(CommandMessage* message) override;
|
||||
@ -38,8 +39,9 @@ class GPSHyperionLinuxController : public ExtendedControllerBase {
|
||||
LocalPoolDataSetBase* getDataSetHandle(sid_t sid) override;
|
||||
ReturnValue_t checkModeCommand(Mode_t mode, Submode_t submode,
|
||||
uint32_t* msToReachTheMode) override;
|
||||
ReturnValue_t executeAction(ActionId_t actionId, MessageQueueId_t commandedBy,
|
||||
const uint8_t* data, size_t size) override;
|
||||
ModeDefinitionHelper getModeDefinitionHelper() override;
|
||||
ReturnValue_t executeAction(Action* action) override;
|
||||
ReturnValue_t handleAction(GPSHyperionLinuxAction * action);
|
||||
ReturnValue_t initialize() override;
|
||||
|
||||
protected:
|
||||
@ -65,6 +67,7 @@ class GPSHyperionLinuxController : public ExtendedControllerBase {
|
||||
int32_t noModeSetCntr = 0;
|
||||
uint32_t timeIsConstantCounter = 0;
|
||||
Countdown timeUpdateCd = Countdown(60);
|
||||
GPSHyperionLinuxAction action = GPSHyperionLinuxAction(this);
|
||||
|
||||
void readGpsDataFromGpsd();
|
||||
};
|
||||
|
@ -0,0 +1,23 @@
|
||||
#pragma once
|
||||
|
||||
#include <fsfw/action/MinMaxParameter.h>
|
||||
#include <fsfw/action/TemplateAction.h>
|
||||
#include <fsfw/introspection/Enum.h>
|
||||
|
||||
#include "mission/devices/devicedefinitions/GPSDefinitions.h"
|
||||
|
||||
class GPSHyperionLinuxController;
|
||||
|
||||
FSFW_ENUM(GPSHyperionLinuxCommands, DeviceCommandId_t,
|
||||
((TRIGGER_RESET_PIN_GNSS, GpsHyperion::TRIGGER_RESET_PIN_GNSS, "Trigger Reset Pin")))
|
||||
|
||||
class GPSHyperionLinuxAction
|
||||
: public TemplateAction<GPSHyperionLinuxController, GPSHyperionLinuxAction,
|
||||
GPSHyperionLinuxCommands> {
|
||||
public:
|
||||
FSFW_ENUM(GpsIDs, uint8_t, ((GPS_0, 0, "GPS 0"))((GPS_1, 1, "GPS 1")))
|
||||
GPSHyperionLinuxAction(GPSHyperionLinuxController *owner)
|
||||
: TemplateAction(owner, GPSHyperionLinuxCommands::TRIGGER_RESET_PIN_GNSS){};
|
||||
|
||||
Parameter<GpsIDs> gpsId = Parameter<GpsIDs>::createParameter(this, "GPS ID");
|
||||
};
|
646
linux/devices/devicedefinitions/PlocMPSoCCommonDefinitions.h
Normal file
646
linux/devices/devicedefinitions/PlocMPSoCCommonDefinitions.h
Normal file
@ -0,0 +1,646 @@
|
||||
#ifndef MISSION_DEVICES_DEVICEDEFINITIONS_PLOCMPSOCCOMMONDEFINITIONS_H_
|
||||
#define MISSION_DEVICES_DEVICEDEFINITIONS_PLOCMPSOCCOMMONDEFINITIONS_H_
|
||||
|
||||
#include <fsfw/action/MinMaxParameter.h>
|
||||
#include <fsfw/action/TemplateAction.h>
|
||||
#include <fsfw/introspection/Enum.h>
|
||||
|
||||
#include "MPSoCReturnValuesIF.h"
|
||||
#include "OBSWConfig.h"
|
||||
#include "eive/definitions.h"
|
||||
#include "fsfw/globalfunctions/CRC.h"
|
||||
#include "fsfw/serialize/SerializeAdapter.h"
|
||||
#include "fsfw/tmtcpacket/SpacePacket.h"
|
||||
|
||||
|
||||
namespace mpsoc {
|
||||
|
||||
static const uint16_t SIZE_ACK_REPORT = 14;
|
||||
static const uint16_t SIZE_EXE_REPORT = 14;
|
||||
static const uint16_t SIZE_TM_MEM_READ_REPORT = 18;
|
||||
static const uint16_t SIZE_TM_CAM_CMD_RPT = 18;
|
||||
|
||||
/**
|
||||
* SpacePacket apids of PLOC telecommands and telemetry.
|
||||
*/
|
||||
namespace apid {
|
||||
static const uint16_t TC_REPLAY_START = 0x110;
|
||||
static const uint16_t TC_REPLAY_STOP = 0x111;
|
||||
static const uint16_t TC_REPLAY_WRITE_SEQUENCE = 0x112;
|
||||
static const uint16_t TC_DOWNLINK_PWR_ON = 0x113;
|
||||
static const uint16_t TC_MEM_WRITE = 0x114;
|
||||
static const uint16_t TC_MEM_READ = 0x115;
|
||||
static const uint16_t TC_FLASHWRITE = 0x117;
|
||||
static const uint16_t TC_FLASHFOPEN = 0x119;
|
||||
static const uint16_t TC_FLASHFCLOSE = 0x11A;
|
||||
static const uint16_t TC_FLASHDELETE = 0x11C;
|
||||
static const uint16_t TC_MODE_REPLAY = 0x11F;
|
||||
static const uint16_t TC_MODE_IDLE = 0x11E;
|
||||
static const uint16_t TC_DOWNLINK_PWR_OFF = 0x124;
|
||||
static const uint16_t TC_CAM_CMD_SEND = 0x12C;
|
||||
static const uint16_t TM_MEMORY_READ_REPORT = 0x404;
|
||||
static const uint16_t ACK_SUCCESS = 0x400;
|
||||
static const uint16_t ACK_FAILURE = 0x401;
|
||||
static const uint16_t EXE_SUCCESS = 0x402;
|
||||
static const uint16_t EXE_FAILURE = 0x403;
|
||||
static const uint16_t TM_CAM_CMD_RPT = 0x407;
|
||||
} // namespace apid
|
||||
|
||||
/** Offset from first byte in space packet to first byte of data field */
|
||||
static const uint8_t DATA_FIELD_OFFSET = 6;
|
||||
static const size_t MEM_READ_RPT_LEN_OFFSET = 10;
|
||||
static const char NULL_TERMINATOR = '\0';
|
||||
static const uint8_t MIN_SPACE_PACKET_LENGTH = 7;
|
||||
static const uint8_t SPACE_PACKET_HEADER_SIZE = 6;
|
||||
|
||||
/**
|
||||
* The size of payload data which will be forwarded to the requesting object. e.g. PUS Service
|
||||
* 8.
|
||||
*/
|
||||
static const uint8_t SIZE_MEM_READ_RPT_FIX = 6;
|
||||
|
||||
static const size_t MAX_FILENAME_SIZE = 256;
|
||||
|
||||
/**
|
||||
* PLOC space packet length for fixed size packets. This is the size of the whole packet data
|
||||
* field. For the length field in the space packet this size will be substracted by one.
|
||||
*/
|
||||
static const uint16_t LENGTH_TC_MEM_WRITE = 12;
|
||||
static const uint16_t LENGTH_TC_MEM_READ = 8;
|
||||
|
||||
static const size_t MAX_REPLY_SIZE = SpacePacket::PACKET_MAX_SIZE * 3;
|
||||
static const size_t MAX_COMMAND_SIZE = SpacePacket::PACKET_MAX_SIZE;
|
||||
static const size_t MAX_DATA_SIZE = 1016;
|
||||
|
||||
/**
|
||||