supervisor set time during start up
This commit is contained in:
parent
7a6b45b102
commit
464821cc6f
2
fsfw
2
fsfw
@ -1 +1 @@
|
|||||||
Subproject commit d61fe7db93b37dd6652dbfee5b7c93f400ac5a11
|
Subproject commit 789668ae50a26cda299cfd125011f9fb345824d9
|
@ -1705,6 +1705,14 @@ class BootStatusReport : public StaticLocalDataSet<BOOT_REPORT_SET_ENTRIES> {
|
|||||||
*/
|
*/
|
||||||
class HkSet : public StaticLocalDataSet<HK_SET_ENTRIES> {
|
class HkSet : public StaticLocalDataSet<HK_SET_ENTRIES> {
|
||||||
public:
|
public:
|
||||||
|
|
||||||
|
enum class SocState {
|
||||||
|
OFF = 0,
|
||||||
|
BOOTING = 1,
|
||||||
|
OPERATIONAL = 3,
|
||||||
|
SHUTDOWN = 4
|
||||||
|
};
|
||||||
|
|
||||||
HkSet(HasLocalDataPoolIF* owner) : StaticLocalDataSet(owner, HK_SET_ID) {}
|
HkSet(HasLocalDataPoolIF* owner) : StaticLocalDataSet(owner, HK_SET_ID) {}
|
||||||
|
|
||||||
HkSet(object_id_t objectId) : StaticLocalDataSet(sid_t(objectId, HK_SET_ID)) {}
|
HkSet(object_id_t objectId) : StaticLocalDataSet(sid_t(objectId, HK_SET_ID)) {}
|
||||||
|
@ -333,7 +333,7 @@ ReturnValue_t PlocMPSoCHandler::scanForReply(const uint8_t* start, size_t remain
|
|||||||
sequenceCount++;
|
sequenceCount++;
|
||||||
uint16_t recvSeqCnt = (*(start + 2) << 8 | *(start + 3)) & PACKET_SEQUENCE_COUNT_MASK;
|
uint16_t recvSeqCnt = (*(start + 2) << 8 | *(start + 3)) & PACKET_SEQUENCE_COUNT_MASK;
|
||||||
if (recvSeqCnt != sequenceCount) {
|
if (recvSeqCnt != sequenceCount) {
|
||||||
triggerEvent(MPSOC_HANDLER_SEQ_CNT_MISMATCH, sequenceCount, recvSeqCnt);
|
triggerEvent(MPSOC_HANDLER_SEQUENCE_COUNT_MISMATCH, sequenceCount, recvSeqCnt);
|
||||||
sequenceCount = recvSeqCnt;
|
sequenceCount = recvSeqCnt;
|
||||||
}
|
}
|
||||||
return result;
|
return result;
|
||||||
@ -845,17 +845,19 @@ void PlocMPSoCHandler::stepSuccessfulReceived(ActionId_t actionId, uint8_t step)
|
|||||||
void PlocMPSoCHandler::stepFailedReceived(ActionId_t actionId, uint8_t step,
|
void PlocMPSoCHandler::stepFailedReceived(ActionId_t actionId, uint8_t step,
|
||||||
ReturnValue_t returnCode) {
|
ReturnValue_t returnCode) {
|
||||||
switch (actionId) {
|
switch (actionId) {
|
||||||
case supv::START_MPSOC:
|
case supv::START_MPSOC: {
|
||||||
sif::warning << "PlocMPSoCHandler::stepFailedReceived: Failed to start MPSoC" << std::endl;
|
sif::warning << "PlocMPSoCHandler::stepFailedReceived: Failed to start MPSoC" << std::endl;
|
||||||
|
// This usually happens when the supervisor handler is in off mode
|
||||||
powerState = PowerState::OFF;
|
powerState = PowerState::OFF;
|
||||||
setMode(_MODE_SHUT_DOWN);
|
setMode(MODE_OFF);
|
||||||
break;
|
break;
|
||||||
case supv::SHUTDOWN_MPSOC:
|
}
|
||||||
|
case supv::SHUTDOWN_MPSOC: {
|
||||||
triggerEvent(MPSOC_SHUTDOWN_FAILED);
|
triggerEvent(MPSOC_SHUTDOWN_FAILED);
|
||||||
sif::warning << "PlocMPSoCHandler::stepFailedReceived: Failed to shutdown MPSoC" << std::endl;
|
sif::warning << "PlocMPSoCHandler::stepFailedReceived: Failed to shutdown MPSoC" << std::endl;
|
||||||
// FDIR will intercept event and switch PLOC power off
|
|
||||||
powerState = PowerState::OFF;
|
powerState = PowerState::OFF;
|
||||||
break;
|
break;
|
||||||
|
}
|
||||||
default:
|
default:
|
||||||
sif::debug << "PlocMPSoCHandler::stepFailedReceived: Received unexpected action reply"
|
sif::debug << "PlocMPSoCHandler::stepFailedReceived: Received unexpected action reply"
|
||||||
<< std::endl;
|
<< std::endl;
|
||||||
@ -999,15 +1001,19 @@ void PlocMPSoCHandler::handleActionCommandFailure(ActionId_t actionId) {
|
|||||||
}
|
}
|
||||||
switch (powerState) {
|
switch (powerState) {
|
||||||
case PowerState::BOOTING: {
|
case PowerState::BOOTING: {
|
||||||
sif::warning << "PlocMPSoCHandler::handleActionCommandFailure: Failed to boot MPSoC"
|
sif::info << "PlocMPSoCHandler::handleActionCommandFailure: MPSoC boot command failed"
|
||||||
<< std::endl;
|
<< std::endl;
|
||||||
powerState = PowerState::OFF;
|
// This is commonly the case when the MPSoC is already operational. Thus the power state is
|
||||||
|
// set to on here
|
||||||
|
powerState = PowerState::ON;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case PowerState::SHUTDOWN: {
|
case PowerState::SHUTDOWN: {
|
||||||
|
// FDIR will intercept event and switch PLOC power off
|
||||||
|
triggerEvent(MPSOC_SHUTDOWN_FAILED);
|
||||||
sif::warning << "PlocMPSoCHandler::handleActionCommandFailure: Failed to shutdown MPSoC"
|
sif::warning << "PlocMPSoCHandler::handleActionCommandFailure: Failed to shutdown MPSoC"
|
||||||
<< std::endl;
|
<< std::endl;
|
||||||
powerState = PowerState::ON;
|
powerState = PowerState::OFF;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
default:
|
default:
|
||||||
|
@ -14,6 +14,7 @@
|
|||||||
#include "fsfw_hal/linux/uart/UartComIF.h"
|
#include "fsfw_hal/linux/uart/UartComIF.h"
|
||||||
#include "linux/devices/devicedefinitions/MPSoCReturnValuesIF.h"
|
#include "linux/devices/devicedefinitions/MPSoCReturnValuesIF.h"
|
||||||
#include "linux/devices/devicedefinitions/PlocMPSoCDefinitions.h"
|
#include "linux/devices/devicedefinitions/PlocMPSoCDefinitions.h"
|
||||||
|
#include "linux/devices/devicedefinitions/PlocSupervisorDefinitions.h"
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief This is the device handler for the MPSoC of the payload computer.
|
* @brief This is the device handler for the MPSoC of the payload computer.
|
||||||
@ -95,7 +96,7 @@ class PlocMPSoCHandler : public DeviceHandlerBase, public CommandsActionsIF {
|
|||||||
static const Event MPSOC_HANDLER_CRC_FAILURE = MAKE_EVENT(4, severity::LOW);
|
static const Event MPSOC_HANDLER_CRC_FAILURE = MAKE_EVENT(4, severity::LOW);
|
||||||
//! [EXPORT] : [COMMENT] Packet sequence count in received space packet does not match expected
|
//! [EXPORT] : [COMMENT] Packet sequence count in received space packet does not match expected
|
||||||
//! count P1: Expected sequence count P2: Received sequence count
|
//! count P1: Expected sequence count P2: Received sequence count
|
||||||
static const Event MPSOC_HANDLER_SEQ_CNT_MISMATCH = MAKE_EVENT(5, severity::LOW);
|
static const Event MPSOC_HANDLER_SEQUENCE_COUNT_MISMATCH = MAKE_EVENT(5, severity::LOW);
|
||||||
//! [EXPORT] : [COMMENT] Supervisor fails to shutdown MPSoC. Requires to power off the PLOC and
|
//! [EXPORT] : [COMMENT] Supervisor fails to shutdown MPSoC. Requires to power off the PLOC and
|
||||||
//! thus also to shutdown the supervisor.
|
//! thus also to shutdown the supervisor.
|
||||||
static const Event MPSOC_SHUTDOWN_FAILED = MAKE_EVENT(6, severity::HIGH);
|
static const Event MPSOC_SHUTDOWN_FAILED = MAKE_EVENT(6, severity::HIGH);
|
||||||
|
@ -137,13 +137,37 @@ ReturnValue_t PlocSupervisorHandler::executeAction(ActionId_t actionId,
|
|||||||
}
|
}
|
||||||
|
|
||||||
void PlocSupervisorHandler::doStartUp() {
|
void PlocSupervisorHandler::doStartUp() {
|
||||||
setMode(_MODE_TO_ON);
|
#ifdef XIPHOS_Q7S
|
||||||
|
switch (startupState) {
|
||||||
|
case StartupState::OFF: {
|
||||||
|
bootTimeout.resetTimer();
|
||||||
|
startupState = StartupState::ON;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
case StartupState::BOOTING: {
|
||||||
|
if (bootTimeout.hasTimedOut()) {
|
||||||
uartIsolatorSwitch.pullHigh();
|
uartIsolatorSwitch.pullHigh();
|
||||||
|
startupState = StartupState::SET_TIME;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
case StartupState::SET_TIME_EXECUTING:
|
||||||
|
break;
|
||||||
|
case StartupState::ON: {
|
||||||
|
setMode(_MODE_TO_ON);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
default:
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
#else
|
||||||
|
setMode(_MODE_TO_ON);
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
void PlocSupervisorHandler::doShutDown() {
|
void PlocSupervisorHandler::doShutDown() {
|
||||||
setMode(_MODE_POWER_DOWN);
|
setMode(_MODE_POWER_DOWN);
|
||||||
uartIsolatorSwitch.pullLow();
|
uartIsolatorSwitch.pullLow();
|
||||||
|
startupState = StartupState::OFF;
|
||||||
}
|
}
|
||||||
|
|
||||||
ReturnValue_t PlocSupervisorHandler::buildNormalDeviceCommand(DeviceCommandId_t* id) {
|
ReturnValue_t PlocSupervisorHandler::buildNormalDeviceCommand(DeviceCommandId_t* id) {
|
||||||
@ -151,6 +175,11 @@ ReturnValue_t PlocSupervisorHandler::buildNormalDeviceCommand(DeviceCommandId_t*
|
|||||||
}
|
}
|
||||||
|
|
||||||
ReturnValue_t PlocSupervisorHandler::buildTransitionDeviceCommand(DeviceCommandId_t* id) {
|
ReturnValue_t PlocSupervisorHandler::buildTransitionDeviceCommand(DeviceCommandId_t* id) {
|
||||||
|
if (startupState == StartupState::SET_TIME) {
|
||||||
|
*id = supv::SET_TIME_REF;
|
||||||
|
startupState = StartupState::SET_TIME_EXECUTING;
|
||||||
|
return RETURN_OK;
|
||||||
|
}
|
||||||
return NOTHING_TO_SEND;
|
return NOTHING_TO_SEND;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -161,8 +190,6 @@ ReturnValue_t PlocSupervisorHandler::buildCommandFromCommand(DeviceCommandId_t d
|
|||||||
ReturnValue_t result = RETURN_FAILED;
|
ReturnValue_t result = RETURN_FAILED;
|
||||||
switch (deviceCommand) {
|
switch (deviceCommand) {
|
||||||
case GET_HK_REPORT: {
|
case GET_HK_REPORT: {
|
||||||
sif::warning << "PlocSupervisorHandler::buildCommandFromCommand: Housekeeping report is "
|
|
||||||
<< "faulty. Needs to be fixed in vorago software" << std::endl;
|
|
||||||
prepareEmptyCmd(APID_GET_HK_REPORT);
|
prepareEmptyCmd(APID_GET_HK_REPORT);
|
||||||
result = RETURN_OK;
|
result = RETURN_OK;
|
||||||
break;
|
break;
|
||||||
@ -676,7 +703,9 @@ ReturnValue_t PlocSupervisorHandler::interpretDeviceReply(DeviceCommandId_t id,
|
|||||||
|
|
||||||
void PlocSupervisorHandler::setNormalDatapoolEntriesInvalid() {}
|
void PlocSupervisorHandler::setNormalDatapoolEntriesInvalid() {}
|
||||||
|
|
||||||
uint32_t PlocSupervisorHandler::getTransitionDelayMs(Mode_t modeFrom, Mode_t modeTo) { return 500; }
|
uint32_t PlocSupervisorHandler::getTransitionDelayMs(Mode_t modeFrom, Mode_t modeTo) {
|
||||||
|
return 7000;
|
||||||
|
}
|
||||||
|
|
||||||
ReturnValue_t PlocSupervisorHandler::initializeLocalDataPool(localpool::DataPool& localDataPoolMap,
|
ReturnValue_t PlocSupervisorHandler::initializeLocalDataPool(localpool::DataPool& localDataPoolMap,
|
||||||
LocalDataPoolManager& poolManager) {
|
LocalDataPoolManager& poolManager) {
|
||||||
@ -897,20 +926,12 @@ ReturnValue_t PlocSupervisorHandler::handleExecutionReport(const uint8_t* data)
|
|||||||
|
|
||||||
switch (result) {
|
switch (result) {
|
||||||
case (RETURN_OK): {
|
case (RETURN_OK): {
|
||||||
handleSpecialExecutionReport(data);
|
handleExecutionSuccessReport(data);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case (SupvReturnValuesIF::RECEIVED_EXE_FAILURE): {
|
case (SupvReturnValuesIF::RECEIVED_EXE_FAILURE): {
|
||||||
DeviceCommandId_t commandId = getPendingCommand();
|
handleExecutionFailureReport();
|
||||||
if (commandId != DeviceHandlerIF::NO_COMMAND_ID) {
|
result = RETURN_OK;
|
||||||
triggerEvent(SUPV_EXE_FAILURE, commandId);
|
|
||||||
} else {
|
|
||||||
sif::debug << "PlocSupervisorHandler::handleExecutionReport: Unknown command id"
|
|
||||||
<< std::endl;
|
|
||||||
}
|
|
||||||
sendFailureReport(EXE_REPORT, SupvReturnValuesIF::RECEIVED_EXE_FAILURE);
|
|
||||||
disableExeReportReply();
|
|
||||||
result = IGNORE_REPLY_DATA;
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
default: {
|
default: {
|
||||||
@ -919,9 +940,7 @@ ReturnValue_t PlocSupervisorHandler::handleExecutionReport(const uint8_t* data)
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
nextReplyId = supv::NONE;
|
nextReplyId = supv::NONE;
|
||||||
|
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1567,6 +1586,7 @@ void PlocSupervisorHandler::disableExeReportReply() {
|
|||||||
DeviceReplyInfo* info = &(iter->second);
|
DeviceReplyInfo* info = &(iter->second);
|
||||||
info->delayCycles = 0;
|
info->delayCycles = 0;
|
||||||
info->command = deviceCommandMap.end();
|
info->command = deviceCommandMap.end();
|
||||||
|
info->active = false;
|
||||||
/* Expected replies is set to one here. The value will set to 0 in replyToReply() */
|
/* Expected replies is set to one here. The value will set to 0 in replyToReply() */
|
||||||
info->command->second.expectedReplies = 1;
|
info->command->second.expectedReplies = 1;
|
||||||
}
|
}
|
||||||
@ -1823,7 +1843,7 @@ ReturnValue_t PlocSupervisorHandler::eventSubscription() {
|
|||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
void PlocSupervisorHandler::handleSpecialExecutionReport(const uint8_t* data) {
|
void PlocSupervisorHandler::handleExecutionSuccessReport(const uint8_t* data) {
|
||||||
DeviceCommandId_t commandId = getPendingCommand();
|
DeviceCommandId_t commandId = getPendingCommand();
|
||||||
switch (commandId) {
|
switch (commandId) {
|
||||||
case supv::READ_GPIO: {
|
case supv::READ_GPIO: {
|
||||||
@ -1831,12 +1851,30 @@ void PlocSupervisorHandler::handleSpecialExecutionReport(const uint8_t* data) {
|
|||||||
exe.addWholeData(data, supv::SIZE_EXE_REPORT);
|
exe.addWholeData(data, supv::SIZE_EXE_REPORT);
|
||||||
uint16_t gpioState = exe.getStatusCode();
|
uint16_t gpioState = exe.getStatusCode();
|
||||||
#if OBSW_DEBUG_PLOC_SUPERVISOR == 1
|
#if OBSW_DEBUG_PLOC_SUPERVISOR == 1
|
||||||
sif::info << "PlocsupervisorHandler: Read GPIO TM, State: " << gpioState << std::endl;
|
sif::info << "PlocSupervisorHandler: Read GPIO TM, State: " << gpioState << std::endl;
|
||||||
#endif /* OBSW_DEBUG_PLOC_SUPERVISOR == 1 */
|
#endif /* OBSW_DEBUG_PLOC_SUPERVISOR == 1 */
|
||||||
handleDeviceTM(reinterpret_cast<uint8_t*>(&gpioState), sizeof(gpioState), supv::EXE_REPORT);
|
handleDeviceTM(reinterpret_cast<uint8_t*>(&gpioState), sizeof(gpioState), supv::EXE_REPORT);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
case supv::SET_TIME_REF: {
|
||||||
|
if (startupState == StartupState::SET_TIME_EXECUTING) {
|
||||||
|
startupState = StartupState::ON;
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
}
|
||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void PlocSupervisorHandler::handleExecutionFailureReport() {
|
||||||
|
using namespace supv;
|
||||||
|
DeviceCommandId_t commandId = getPendingCommand();
|
||||||
|
if (commandId != DeviceHandlerIF::NO_COMMAND_ID) {
|
||||||
|
triggerEvent(SUPV_EXE_FAILURE, commandId);
|
||||||
|
} else {
|
||||||
|
sif::debug << "PlocSupervisorHandler::handleExecutionReport: Unknown command id" << std::endl;
|
||||||
|
}
|
||||||
|
sendFailureReport(EXE_REPORT, SupvReturnValuesIF::RECEIVED_EXE_FAILURE);
|
||||||
|
disableExeReportReply();
|
||||||
|
}
|
||||||
|
@ -82,6 +82,17 @@ class PlocSupervisorHandler : public DeviceHandlerBase {
|
|||||||
static const uint32_t EXECUTION_DEFAULT_TIMEOUT = 5000;
|
static const uint32_t EXECUTION_DEFAULT_TIMEOUT = 5000;
|
||||||
// 30 s
|
// 30 s
|
||||||
static const uint32_t MRAM_DUMP_EXECUTION_TIMEOUT = 30000;
|
static const uint32_t MRAM_DUMP_EXECUTION_TIMEOUT = 30000;
|
||||||
|
// 2 s
|
||||||
|
static const uint32_t BOOT_TIMEOUT = 2000;
|
||||||
|
enum class StartupState: uint8_t {
|
||||||
|
OFF,
|
||||||
|
BOOTING,
|
||||||
|
SET_TIME,
|
||||||
|
SET_TIME_EXECUTING,
|
||||||
|
ON
|
||||||
|
};
|
||||||
|
|
||||||
|
StartupState startupState = StartupState::OFF;
|
||||||
|
|
||||||
uint8_t commandBuffer[supv::MAX_COMMAND_SIZE];
|
uint8_t commandBuffer[supv::MAX_COMMAND_SIZE];
|
||||||
|
|
||||||
@ -133,6 +144,8 @@ class PlocSupervisorHandler : public DeviceHandlerBase {
|
|||||||
bool plocSupvHelperExecuting = false;
|
bool plocSupvHelperExecuting = false;
|
||||||
|
|
||||||
Countdown executionTimeout = Countdown(EXECUTION_DEFAULT_TIMEOUT, false);
|
Countdown executionTimeout = Countdown(EXECUTION_DEFAULT_TIMEOUT, false);
|
||||||
|
// Vorago nees some time to boot properly
|
||||||
|
Countdown bootTimeout = Countdown(BOOT_TIMEOUT);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Adjusts the timeout of the execution report dependent on command
|
* @brief Adjusts the timeout of the execution report dependent on command
|
||||||
@ -349,10 +362,8 @@ class PlocSupervisorHandler : public DeviceHandlerBase {
|
|||||||
uint8_t* memoryId, uint32_t* startAddress);
|
uint8_t* memoryId, uint32_t* startAddress);
|
||||||
ReturnValue_t eventSubscription();
|
ReturnValue_t eventSubscription();
|
||||||
|
|
||||||
/**
|
void handleExecutionSuccessReport(const uint8_t* data);
|
||||||
* @brief Handles execution reports which contains additional information in the data field
|
void handleExecutionFailureReport();
|
||||||
*/
|
|
||||||
void handleSpecialExecutionReport(const uint8_t* data);
|
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif /* MISSION_DEVICES_PLOCSUPERVISORHANDLER_H_ */
|
#endif /* MISSION_DEVICES_PLOCSUPERVISORHANDLER_H_ */
|
||||||
|
Loading…
Reference in New Issue
Block a user