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> {
|
||||
public:
|
||||
|
||||
enum class SocState {
|
||||
OFF = 0,
|
||||
BOOTING = 1,
|
||||
OPERATIONAL = 3,
|
||||
SHUTDOWN = 4
|
||||
};
|
||||
|
||||
HkSet(HasLocalDataPoolIF* owner) : StaticLocalDataSet(owner, 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++;
|
||||
uint16_t recvSeqCnt = (*(start + 2) << 8 | *(start + 3)) & PACKET_SEQUENCE_COUNT_MASK;
|
||||
if (recvSeqCnt != sequenceCount) {
|
||||
triggerEvent(MPSOC_HANDLER_SEQ_CNT_MISMATCH, sequenceCount, recvSeqCnt);
|
||||
triggerEvent(MPSOC_HANDLER_SEQUENCE_COUNT_MISMATCH, sequenceCount, recvSeqCnt);
|
||||
sequenceCount = recvSeqCnt;
|
||||
}
|
||||
return result;
|
||||
@ -845,17 +845,19 @@ void PlocMPSoCHandler::stepSuccessfulReceived(ActionId_t actionId, uint8_t step)
|
||||
void PlocMPSoCHandler::stepFailedReceived(ActionId_t actionId, uint8_t step,
|
||||
ReturnValue_t returnCode) {
|
||||
switch (actionId) {
|
||||
case supv::START_MPSOC:
|
||||
case supv::START_MPSOC: {
|
||||
sif::warning << "PlocMPSoCHandler::stepFailedReceived: Failed to start MPSoC" << std::endl;
|
||||
// This usually happens when the supervisor handler is in off mode
|
||||
powerState = PowerState::OFF;
|
||||
setMode(_MODE_SHUT_DOWN);
|
||||
setMode(MODE_OFF);
|
||||
break;
|
||||
case supv::SHUTDOWN_MPSOC:
|
||||
}
|
||||
case supv::SHUTDOWN_MPSOC: {
|
||||
triggerEvent(MPSOC_SHUTDOWN_FAILED);
|
||||
sif::warning << "PlocMPSoCHandler::stepFailedReceived: Failed to shutdown MPSoC" << std::endl;
|
||||
// FDIR will intercept event and switch PLOC power off
|
||||
powerState = PowerState::OFF;
|
||||
break;
|
||||
}
|
||||
default:
|
||||
sif::debug << "PlocMPSoCHandler::stepFailedReceived: Received unexpected action reply"
|
||||
<< std::endl;
|
||||
@ -999,15 +1001,19 @@ void PlocMPSoCHandler::handleActionCommandFailure(ActionId_t actionId) {
|
||||
}
|
||||
switch (powerState) {
|
||||
case PowerState::BOOTING: {
|
||||
sif::warning << "PlocMPSoCHandler::handleActionCommandFailure: Failed to boot MPSoC"
|
||||
sif::info << "PlocMPSoCHandler::handleActionCommandFailure: MPSoC boot command failed"
|
||||
<< 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;
|
||||
}
|
||||
case PowerState::SHUTDOWN: {
|
||||
// FDIR will intercept event and switch PLOC power off
|
||||
triggerEvent(MPSOC_SHUTDOWN_FAILED);
|
||||
sif::warning << "PlocMPSoCHandler::handleActionCommandFailure: Failed to shutdown MPSoC"
|
||||
<< std::endl;
|
||||
powerState = PowerState::ON;
|
||||
powerState = PowerState::OFF;
|
||||
break;
|
||||
}
|
||||
default:
|
||||
|
@ -14,6 +14,7 @@
|
||||
#include "fsfw_hal/linux/uart/UartComIF.h"
|
||||
#include "linux/devices/devicedefinitions/MPSoCReturnValuesIF.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.
|
||||
@ -95,7 +96,7 @@ class PlocMPSoCHandler : public DeviceHandlerBase, public CommandsActionsIF {
|
||||
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
|
||||
//! 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
|
||||
//! thus also to shutdown the supervisor.
|
||||
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() {
|
||||
#ifdef XIPHOS_Q7S
|
||||
switch (startupState) {
|
||||
case StartupState::OFF: {
|
||||
bootTimeout.resetTimer();
|
||||
startupState = StartupState::ON;
|
||||
break;
|
||||
}
|
||||
case StartupState::BOOTING: {
|
||||
if (bootTimeout.hasTimedOut()) {
|
||||
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);
|
||||
uartIsolatorSwitch.pullHigh();
|
||||
#endif
|
||||
}
|
||||
|
||||
void PlocSupervisorHandler::doShutDown() {
|
||||
setMode(_MODE_POWER_DOWN);
|
||||
uartIsolatorSwitch.pullLow();
|
||||
startupState = StartupState::OFF;
|
||||
}
|
||||
|
||||
ReturnValue_t PlocSupervisorHandler::buildNormalDeviceCommand(DeviceCommandId_t* id) {
|
||||
@ -151,6 +175,11 @@ ReturnValue_t PlocSupervisorHandler::buildNormalDeviceCommand(DeviceCommandId_t*
|
||||
}
|
||||
|
||||
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;
|
||||
}
|
||||
|
||||
@ -161,8 +190,6 @@ ReturnValue_t PlocSupervisorHandler::buildCommandFromCommand(DeviceCommandId_t d
|
||||
ReturnValue_t result = RETURN_FAILED;
|
||||
switch (deviceCommand) {
|
||||
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);
|
||||
result = RETURN_OK;
|
||||
break;
|
||||
@ -676,7 +703,9 @@ ReturnValue_t PlocSupervisorHandler::interpretDeviceReply(DeviceCommandId_t id,
|
||||
|
||||
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,
|
||||
LocalDataPoolManager& poolManager) {
|
||||
@ -897,20 +926,12 @@ ReturnValue_t PlocSupervisorHandler::handleExecutionReport(const uint8_t* data)
|
||||
|
||||
switch (result) {
|
||||
case (RETURN_OK): {
|
||||
handleSpecialExecutionReport(data);
|
||||
handleExecutionSuccessReport(data);
|
||||
break;
|
||||
}
|
||||
case (SupvReturnValuesIF::RECEIVED_EXE_FAILURE): {
|
||||
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();
|
||||
result = IGNORE_REPLY_DATA;
|
||||
handleExecutionFailureReport();
|
||||
result = RETURN_OK;
|
||||
break;
|
||||
}
|
||||
default: {
|
||||
@ -919,9 +940,7 @@ ReturnValue_t PlocSupervisorHandler::handleExecutionReport(const uint8_t* data)
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
nextReplyId = supv::NONE;
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
@ -1567,6 +1586,7 @@ void PlocSupervisorHandler::disableExeReportReply() {
|
||||
DeviceReplyInfo* info = &(iter->second);
|
||||
info->delayCycles = 0;
|
||||
info->command = deviceCommandMap.end();
|
||||
info->active = false;
|
||||
/* Expected replies is set to one here. The value will set to 0 in replyToReply() */
|
||||
info->command->second.expectedReplies = 1;
|
||||
}
|
||||
@ -1823,7 +1843,7 @@ ReturnValue_t PlocSupervisorHandler::eventSubscription() {
|
||||
return result;
|
||||
}
|
||||
|
||||
void PlocSupervisorHandler::handleSpecialExecutionReport(const uint8_t* data) {
|
||||
void PlocSupervisorHandler::handleExecutionSuccessReport(const uint8_t* data) {
|
||||
DeviceCommandId_t commandId = getPendingCommand();
|
||||
switch (commandId) {
|
||||
case supv::READ_GPIO: {
|
||||
@ -1831,12 +1851,30 @@ void PlocSupervisorHandler::handleSpecialExecutionReport(const uint8_t* data) {
|
||||
exe.addWholeData(data, supv::SIZE_EXE_REPORT);
|
||||
uint16_t gpioState = exe.getStatusCode();
|
||||
#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 */
|
||||
handleDeviceTM(reinterpret_cast<uint8_t*>(&gpioState), sizeof(gpioState), supv::EXE_REPORT);
|
||||
break;
|
||||
}
|
||||
case supv::SET_TIME_REF: {
|
||||
if (startupState == StartupState::SET_TIME_EXECUTING) {
|
||||
startupState = StartupState::ON;
|
||||
}
|
||||
break;
|
||||
}
|
||||
default:
|
||||
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;
|
||||
// 30 s
|
||||
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];
|
||||
|
||||
@ -133,6 +144,8 @@ class PlocSupervisorHandler : public DeviceHandlerBase {
|
||||
bool plocSupvHelperExecuting = 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
|
||||
@ -349,10 +362,8 @@ class PlocSupervisorHandler : public DeviceHandlerBase {
|
||||
uint8_t* memoryId, uint32_t* startAddress);
|
||||
ReturnValue_t eventSubscription();
|
||||
|
||||
/**
|
||||
* @brief Handles execution reports which contains additional information in the data field
|
||||
*/
|
||||
void handleSpecialExecutionReport(const uint8_t* data);
|
||||
void handleExecutionSuccessReport(const uint8_t* data);
|
||||
void handleExecutionFailureReport();
|
||||
};
|
||||
|
||||
#endif /* MISSION_DEVICES_PLOCSUPERVISORHANDLER_H_ */
|
||||
|
Loading…
Reference in New Issue
Block a user