Tweaks for MPSoC startup and shutdown code #796
10
CHANGELOG.md
10
CHANGELOG.md
@ -16,6 +16,16 @@ will consitute of a breaking change warranting a new major release:
|
||||
|
||||
# [unreleased]
|
||||
|
||||
## Changed
|
||||
|
||||
- Changed internals for MPSoC boot process to make the code more understandable and some
|
||||
parameters better configurable. This should not affect the behaviour of the OBSW, but might
|
||||
make it more reliable and fix some corner cases.
|
||||
|
||||
## Fixed
|
||||
|
||||
- Missing `nullptr` checks for PLOC Supervisor handler, which could lead to crashes.
|
||||
|
||||
# [v6.6.0] 2023-09-18
|
||||
|
||||
## Changed
|
||||
|
@ -1,7 +1,7 @@
|
||||
/**
|
||||
* @brief Auto-generated event translation file. Contains 306 translations.
|
||||
* @brief Auto-generated event translation file. Contains 308 translations.
|
||||
* @details
|
||||
* Generated on: 2023-09-12 10:05:17
|
||||
* Generated on: 2023-09-25 17:49:54
|
||||
*/
|
||||
#include "translateEvents.h"
|
||||
|
||||
@ -128,6 +128,8 @@ const char *EXE_FAILURE_STRING = "EXE_FAILURE";
|
||||
const char *MPSOC_HANDLER_CRC_FAILURE_STRING = "MPSOC_HANDLER_CRC_FAILURE";
|
||||
const char *MPSOC_HANDLER_SEQUENCE_COUNT_MISMATCH_STRING = "MPSOC_HANDLER_SEQUENCE_COUNT_MISMATCH";
|
||||
const char *MPSOC_SHUTDOWN_FAILED_STRING = "MPSOC_SHUTDOWN_FAILED";
|
||||
const char *SUPV_NOT_ON_STRING = "SUPV_NOT_ON";
|
||||
const char *SUPV_REPLY_TIMEOUT_STRING = "SUPV_REPLY_TIMEOUT";
|
||||
const char *SELF_TEST_I2C_FAILURE_STRING = "SELF_TEST_I2C_FAILURE";
|
||||
const char *SELF_TEST_SPI_FAILURE_STRING = "SELF_TEST_SPI_FAILURE";
|
||||
const char *SELF_TEST_ADC_FAILURE_STRING = "SELF_TEST_ADC_FAILURE";
|
||||
@ -560,6 +562,10 @@ const char *translateEvents(Event event) {
|
||||
return MPSOC_HANDLER_SEQUENCE_COUNT_MISMATCH_STRING;
|
||||
case (11606):
|
||||
return MPSOC_SHUTDOWN_FAILED_STRING;
|
||||
case (11607):
|
||||
return SUPV_NOT_ON_STRING;
|
||||
case (11608):
|
||||
return SUPV_REPLY_TIMEOUT_STRING;
|
||||
case (11701):
|
||||
return SELF_TEST_I2C_FAILURE_STRING;
|
||||
case (11702):
|
||||
|
@ -2,7 +2,7 @@
|
||||
* @brief Auto-generated object translation file.
|
||||
* @details
|
||||
* Contains 171 translations.
|
||||
* Generated on: 2023-09-12 10:05:17
|
||||
* Generated on: 2023-09-25 17:49:54
|
||||
*/
|
||||
#include "translateObjects.h"
|
||||
|
||||
|
@ -122,6 +122,8 @@ Event ID (dec); Event ID (hex); Name; Severity; Description; File Path
|
||||
11604;0x2d54;MPSOC_HANDLER_CRC_FAILURE;LOW;PLOC reply has invalid crc;linux/payload/PlocMpsocHandler.h
|
||||
11605;0x2d55;MPSOC_HANDLER_SEQUENCE_COUNT_MISMATCH;LOW;Packet sequence count in received space packet does not match expected count P1: Expected sequence count P2: Received sequence count;linux/payload/PlocMpsocHandler.h
|
||||
11606;0x2d56;MPSOC_SHUTDOWN_FAILED;HIGH;Supervisor fails to shutdown MPSoC. Requires to power off the PLOC and thus also to shutdown the supervisor.;linux/payload/PlocMpsocHandler.h
|
||||
11607;0x2d57;SUPV_NOT_ON;LOW;SUPV not on for boot or shutdown process. P1: 0 for OFF transition, 1 for ON transition.;linux/payload/PlocMpsocHandler.h
|
||||
11608;0x2d58;SUPV_REPLY_TIMEOUT;LOW;No description;linux/payload/PlocMpsocHandler.h
|
||||
11701;0x2db5;SELF_TEST_I2C_FAILURE;LOW;Get self test result returns I2C failure P1: Indicates on which axis the failure occurred. 0 -> INIT, 1 -> +X, 2 -> -X, 3 -> +Y, 4 -> -Y, 5 -> +Z, 6 -> -Z, 7 -> FINA;mission/acs/ImtqHandler.h
|
||||
11702;0x2db6;SELF_TEST_SPI_FAILURE;LOW;Get self test result returns SPI failure. This concerns the MTM connectivity. P1: Indicates on which axis the failure occurred. 0 -> INIT, 1 -> +X, 2 -> -X, 3 -> +Y, 4 -> -Y, 5 -> +Z, 6 -> -Z, 7 -> FINA;mission/acs/ImtqHandler.h
|
||||
11703;0x2db7;SELF_TEST_ADC_FAILURE;LOW;Get self test result returns failure in measurement of current and temperature. P1: Indicates on which axis the failure occurred. 0 -> INIT, 1 -> +X, 2 -> -X, 3 -> +Y, 4 -> -Y, 5 -> +Z, 6 -> -Z, 7 -> FINA;mission/acs/ImtqHandler.h
|
||||
|
|
@ -122,6 +122,8 @@ Event ID (dec); Event ID (hex); Name; Severity; Description; File Path
|
||||
11604;0x2d54;MPSOC_HANDLER_CRC_FAILURE;LOW;PLOC reply has invalid crc;linux/payload/PlocMpsocHandler.h
|
||||
11605;0x2d55;MPSOC_HANDLER_SEQUENCE_COUNT_MISMATCH;LOW;Packet sequence count in received space packet does not match expected count P1: Expected sequence count P2: Received sequence count;linux/payload/PlocMpsocHandler.h
|
||||
11606;0x2d56;MPSOC_SHUTDOWN_FAILED;HIGH;Supervisor fails to shutdown MPSoC. Requires to power off the PLOC and thus also to shutdown the supervisor.;linux/payload/PlocMpsocHandler.h
|
||||
11607;0x2d57;SUPV_NOT_ON;LOW;SUPV not on for boot or shutdown process. P1: 0 for OFF transition, 1 for ON transition.;linux/payload/PlocMpsocHandler.h
|
||||
11608;0x2d58;SUPV_REPLY_TIMEOUT;LOW;No description;linux/payload/PlocMpsocHandler.h
|
||||
11701;0x2db5;SELF_TEST_I2C_FAILURE;LOW;Get self test result returns I2C failure P1: Indicates on which axis the failure occurred. 0 -> INIT, 1 -> +X, 2 -> -X, 3 -> +Y, 4 -> -Y, 5 -> +Z, 6 -> -Z, 7 -> FINA;mission/acs/ImtqHandler.h
|
||||
11702;0x2db6;SELF_TEST_SPI_FAILURE;LOW;Get self test result returns SPI failure. This concerns the MTM connectivity. P1: Indicates on which axis the failure occurred. 0 -> INIT, 1 -> +X, 2 -> -X, 3 -> +Y, 4 -> -Y, 5 -> +Z, 6 -> -Z, 7 -> FINA;mission/acs/ImtqHandler.h
|
||||
11703;0x2db7;SELF_TEST_ADC_FAILURE;LOW;Get self test result returns failure in measurement of current and temperature. P1: Indicates on which axis the failure occurred. 0 -> INIT, 1 -> +X, 2 -> -X, 3 -> +Y, 4 -> -Y, 5 -> +Z, 6 -> -Z, 7 -> FINA;mission/acs/ImtqHandler.h
|
||||
|
|
@ -1,7 +1,7 @@
|
||||
/**
|
||||
* @brief Auto-generated event translation file. Contains 306 translations.
|
||||
* @brief Auto-generated event translation file. Contains 308 translations.
|
||||
* @details
|
||||
* Generated on: 2023-09-12 10:05:17
|
||||
* Generated on: 2023-09-25 17:49:54
|
||||
*/
|
||||
#include "translateEvents.h"
|
||||
|
||||
@ -128,6 +128,8 @@ const char *EXE_FAILURE_STRING = "EXE_FAILURE";
|
||||
const char *MPSOC_HANDLER_CRC_FAILURE_STRING = "MPSOC_HANDLER_CRC_FAILURE";
|
||||
const char *MPSOC_HANDLER_SEQUENCE_COUNT_MISMATCH_STRING = "MPSOC_HANDLER_SEQUENCE_COUNT_MISMATCH";
|
||||
const char *MPSOC_SHUTDOWN_FAILED_STRING = "MPSOC_SHUTDOWN_FAILED";
|
||||
const char *SUPV_NOT_ON_STRING = "SUPV_NOT_ON";
|
||||
const char *SUPV_REPLY_TIMEOUT_STRING = "SUPV_REPLY_TIMEOUT";
|
||||
const char *SELF_TEST_I2C_FAILURE_STRING = "SELF_TEST_I2C_FAILURE";
|
||||
const char *SELF_TEST_SPI_FAILURE_STRING = "SELF_TEST_SPI_FAILURE";
|
||||
const char *SELF_TEST_ADC_FAILURE_STRING = "SELF_TEST_ADC_FAILURE";
|
||||
@ -560,6 +562,10 @@ const char *translateEvents(Event event) {
|
||||
return MPSOC_HANDLER_SEQUENCE_COUNT_MISMATCH_STRING;
|
||||
case (11606):
|
||||
return MPSOC_SHUTDOWN_FAILED_STRING;
|
||||
case (11607):
|
||||
return SUPV_NOT_ON_STRING;
|
||||
case (11608):
|
||||
return SUPV_REPLY_TIMEOUT_STRING;
|
||||
case (11701):
|
||||
return SELF_TEST_I2C_FAILURE_STRING;
|
||||
case (11702):
|
||||
|
@ -2,7 +2,7 @@
|
||||
* @brief Auto-generated object translation file.
|
||||
* @details
|
||||
* Contains 175 translations.
|
||||
* Generated on: 2023-09-12 10:05:17
|
||||
* Generated on: 2023-09-25 17:49:54
|
||||
*/
|
||||
#include "translateObjects.h"
|
||||
|
||||
|
@ -1,7 +1,7 @@
|
||||
/**
|
||||
* @brief Auto-generated event translation file. Contains 306 translations.
|
||||
* @brief Auto-generated event translation file. Contains 308 translations.
|
||||
* @details
|
||||
* Generated on: 2023-09-12 10:05:17
|
||||
* Generated on: 2023-09-25 17:49:54
|
||||
*/
|
||||
#include "translateEvents.h"
|
||||
|
||||
@ -128,6 +128,8 @@ const char *EXE_FAILURE_STRING = "EXE_FAILURE";
|
||||
const char *MPSOC_HANDLER_CRC_FAILURE_STRING = "MPSOC_HANDLER_CRC_FAILURE";
|
||||
const char *MPSOC_HANDLER_SEQUENCE_COUNT_MISMATCH_STRING = "MPSOC_HANDLER_SEQUENCE_COUNT_MISMATCH";
|
||||
const char *MPSOC_SHUTDOWN_FAILED_STRING = "MPSOC_SHUTDOWN_FAILED";
|
||||
const char *SUPV_NOT_ON_STRING = "SUPV_NOT_ON";
|
||||
const char *SUPV_REPLY_TIMEOUT_STRING = "SUPV_REPLY_TIMEOUT";
|
||||
const char *SELF_TEST_I2C_FAILURE_STRING = "SELF_TEST_I2C_FAILURE";
|
||||
const char *SELF_TEST_SPI_FAILURE_STRING = "SELF_TEST_SPI_FAILURE";
|
||||
const char *SELF_TEST_ADC_FAILURE_STRING = "SELF_TEST_ADC_FAILURE";
|
||||
@ -560,6 +562,10 @@ const char *translateEvents(Event event) {
|
||||
return MPSOC_HANDLER_SEQUENCE_COUNT_MISMATCH_STRING;
|
||||
case (11606):
|
||||
return MPSOC_SHUTDOWN_FAILED_STRING;
|
||||
case (11607):
|
||||
return SUPV_NOT_ON_STRING;
|
||||
case (11608):
|
||||
return SUPV_REPLY_TIMEOUT_STRING;
|
||||
case (11701):
|
||||
return SELF_TEST_I2C_FAILURE_STRING;
|
||||
case (11702):
|
||||
|
@ -2,7 +2,7 @@
|
||||
* @brief Auto-generated object translation file.
|
||||
* @details
|
||||
* Contains 175 translations.
|
||||
* Generated on: 2023-09-12 10:05:17
|
||||
* Generated on: 2023-09-25 17:49:54
|
||||
*/
|
||||
#include "translateObjects.h"
|
||||
|
||||
|
@ -188,73 +188,28 @@ void PlocMpsocHandler::doStartUp() {
|
||||
startupState = StartupState::HW_INIT;
|
||||
}
|
||||
if (startupState == StartupState::HW_INIT) {
|
||||
#ifdef XIPHOS_Q7S
|
||||
#if not OBSW_MPSOC_JTAG_BOOT == 1
|
||||
switch (powerState) {
|
||||
case PowerState::OFF:
|
||||
commandActionHelper.commandAction(supervisorHandler, supv::START_MPSOC);
|
||||
powerState = PowerState::BOOTING;
|
||||
return;
|
||||
case PowerState::ON:
|
||||
uartIsolatorSwitch.pullHigh();
|
||||
startupState = StartupState::WAIT_CYCLES;
|
||||
break;
|
||||
default:
|
||||
return;
|
||||
}
|
||||
#else
|
||||
uartIsolatorSwitch.pullHigh();
|
||||
startupState = StartupState::WAIT_CYCLES;
|
||||
#endif /* not MSPOC_JTAG_BOOT == 1 */
|
||||
#else
|
||||
startupState = StartupState::WAIT_CYCLES;
|
||||
powerState = PowerState::ON;
|
||||
#endif /* XIPHOS_Q7S */
|
||||
}
|
||||
// Need to wait, MPSoC still not booted properly, requesting HK without these wait cycles does
|
||||
// not work, no replies..
|
||||
if (startupState == StartupState::WAIT_CYCLES) {
|
||||
waitCycles++;
|
||||
if (waitCycles >= 8) {
|
||||
if (handleHwStartup()) {
|
||||
startupState = StartupState::DONE;
|
||||
waitCycles = 0;
|
||||
}
|
||||
}
|
||||
if (startupState == StartupState::DONE) {
|
||||
setMode(_MODE_TO_ON);
|
||||
hkReport.setReportingEnabled(true);
|
||||
powerState = PowerState::IDLE;
|
||||
startupState = StartupState::IDLE;
|
||||
}
|
||||
}
|
||||
|
||||
void PlocMpsocHandler::doShutDown() {
|
||||
#ifdef XIPHOS_Q7S
|
||||
#if not OBSW_MPSOC_JTAG_BOOT == 1
|
||||
if (powerState == PowerState::ON) {
|
||||
uartIsolatorSwitch.pullLow();
|
||||
commandActionHelper.commandAction(supervisorHandler, supv::SHUTDOWN_MPSOC);
|
||||
powerState = PowerState::SHUTDOWN;
|
||||
return;
|
||||
} else if (powerState == PowerState::SHUTDOWN) {
|
||||
// Wait till power state is OFF.
|
||||
return;
|
||||
}
|
||||
#else
|
||||
uartIsolatorSwitch.pullLow();
|
||||
powerState = PowerState::OFF;
|
||||
#endif
|
||||
#endif
|
||||
|
||||
if (specialComHelper != nullptr) {
|
||||
specialComHelper->stopProcess();
|
||||
}
|
||||
if (handleHwShutdown()) {
|
||||
hkReport.setReportingEnabled(false);
|
||||
setMode(_MODE_POWER_DOWN);
|
||||
commandIsPending = false;
|
||||
sequenceCount = 0;
|
||||
specialComHelperExecuting = false;
|
||||
powerState = PowerState::IDLE;
|
||||
startupState = StartupState::IDLE;
|
||||
}
|
||||
}
|
||||
|
||||
ReturnValue_t PlocMpsocHandler::buildNormalDeviceCommand(DeviceCommandId_t* id) {
|
||||
if (not commandIsPending and not specialComHelperExecuting) {
|
||||
@ -1247,15 +1202,11 @@ void PlocMpsocHandler::stepFailedReceived(ActionId_t actionId, uint8_t step,
|
||||
switch (actionId) {
|
||||
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_OFF);
|
||||
break;
|
||||
}
|
||||
case supv::SHUTDOWN_MPSOC: {
|
||||
triggerEvent(MPSOC_SHUTDOWN_FAILED);
|
||||
sif::warning << "PlocMPSoCHandler::stepFailedReceived: Failed to shutdown MPSoC" << std::endl;
|
||||
powerState = PowerState::OFF;
|
||||
break;
|
||||
}
|
||||
default:
|
||||
@ -1263,6 +1214,7 @@ void PlocMpsocHandler::stepFailedReceived(ActionId_t actionId, uint8_t step,
|
||||
<< std::endl;
|
||||
break;
|
||||
}
|
||||
powerState = PowerState::SUPV_FAILED;
|
||||
}
|
||||
|
||||
void PlocMpsocHandler::dataReceived(ActionId_t actionId, const uint8_t* data, uint32_t size) {
|
||||
@ -1270,18 +1222,24 @@ void PlocMpsocHandler::dataReceived(ActionId_t actionId, const uint8_t* data, ui
|
||||
}
|
||||
|
||||
void PlocMpsocHandler::completionSuccessfulReceived(ActionId_t actionId) {
|
||||
if (actionId != supv::EXE_REPORT) {
|
||||
sif::debug << "PlocMPSoCHandler::completionSuccessfulReceived: Did not expect this action "
|
||||
<< "ID" << std::endl;
|
||||
if (actionId == supv::ACK_REPORT) {
|
||||
sif::warning
|
||||
<< "PlocMpsocHandler::completionSuccessfulReceived: Only received ACK report. Consider "
|
||||
"increasing the MPSoC boot timer."
|
||||
<< std::endl;
|
||||
} else if (actionId != supv::EXE_REPORT) {
|
||||
sif::warning << "PlocMpsocHandler::completionSuccessfulReceived: Did not expect the action "
|
||||
<< "ID " << actionId << std::endl;
|
||||
return;
|
||||
}
|
||||
switch (powerState) {
|
||||
case PowerState::BOOTING: {
|
||||
powerState = PowerState::ON;
|
||||
case PowerState::PENDING_STARTUP: {
|
||||
mpsocBootTransitionCd.resetTimer();
|
||||
powerState = PowerState::DONE;
|
||||
break;
|
||||
}
|
||||
case PowerState::SHUTDOWN: {
|
||||
powerState = PowerState::OFF;
|
||||
case PowerState::PENDING_SHUTDOWN: {
|
||||
powerState = PowerState::DONE;
|
||||
break;
|
||||
}
|
||||
default: {
|
||||
@ -1409,36 +1367,117 @@ void PlocMpsocHandler::disableExeReportReply() {
|
||||
info->command->second.expectedReplies = 0;
|
||||
}
|
||||
|
||||
void PlocMpsocHandler::stopSpecialComHelper() {
|
||||
if (specialComHelper != nullptr) {
|
||||
specialComHelper->stopProcess();
|
||||
}
|
||||
specialComHelperExecuting = false;
|
||||
}
|
||||
|
||||
bool PlocMpsocHandler::handleHwStartup() {
|
||||
#if OBSW_MPSOC_JTAG_BOOT == 1
|
||||
uartIsolatorSwitch.pullHigh();
|
||||
startupState = StartupState::WAIT_CYCLES;
|
||||
return true;
|
||||
#endif
|
||||
if (powerState == PowerState::IDLE) {
|
||||
if (supv::SUPV_ON) {
|
||||
commandActionHelper.commandAction(supervisorHandler, supv::START_MPSOC);
|
||||
supvTransitionCd.resetTimer();
|
||||
powerState = PowerState::PENDING_STARTUP;
|
||||
} else {
|
||||
triggerEvent(SUPV_NOT_ON, 1);
|
||||
// Set back to OFF for now, failing the transition.
|
||||
setMode(MODE_OFF);
|
||||
}
|
||||
}
|
||||
if (powerState == PowerState::SUPV_FAILED) {
|
||||
setMode(MODE_OFF);
|
||||
powerState = PowerState::IDLE;
|
||||
return false;
|
||||
}
|
||||
if (powerState == PowerState::PENDING_STARTUP) {
|
||||
if (supvTransitionCd.hasTimedOut()) {
|
||||
// Process with transition nonetheless..
|
||||
triggerEvent(SUPV_REPLY_TIMEOUT);
|
||||
powerState = PowerState::DONE;
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
if (powerState == PowerState::DONE) {
|
||||
if (mpsocBootTransitionCd.hasTimedOut()) {
|
||||
// Wait a bit for the MPSoC to fully boot.
|
||||
uartIsolatorSwitch.pullHigh();
|
||||
powerState = PowerState::IDLE;
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
bool PlocMpsocHandler::handleHwShutdown() {
|
||||
stopSpecialComHelper();
|
||||
uartIsolatorSwitch.pullLow();
|
||||
#if OBSW_MPSOC_JTAG_BOOT == 1
|
||||
powerState = PowerState::DONE;
|
||||
return true;
|
||||
#endif
|
||||
|
||||
if (powerState == PowerState::IDLE) {
|
||||
if (supv::SUPV_ON) {
|
||||
commandActionHelper.commandAction(supervisorHandler, supv::SHUTDOWN_MPSOC);
|
||||
supvTransitionCd.resetTimer();
|
||||
powerState = PowerState::PENDING_SHUTDOWN;
|
||||
} else {
|
||||
triggerEvent(SUPV_NOT_ON, 0);
|
||||
powerState = PowerState::DONE;
|
||||
}
|
||||
}
|
||||
if (powerState == PowerState::PENDING_SHUTDOWN) {
|
||||
if (supvTransitionCd.hasTimedOut()) {
|
||||
powerState = PowerState::DONE;
|
||||
// Process with transition nonetheless..
|
||||
triggerEvent(SUPV_REPLY_TIMEOUT);
|
||||
return true;
|
||||
} else {
|
||||
// Wait till power state is OFF.
|
||||
return false;
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
void PlocMpsocHandler::handleActionCommandFailure(ActionId_t actionId) {
|
||||
switch (actionId) {
|
||||
case supv::ACK_REPORT:
|
||||
case supv::EXE_REPORT:
|
||||
break;
|
||||
default:
|
||||
sif::debug << "PlocMPSoCHandler::handleActionCommandFailure: Did not expect this action ID "
|
||||
<< std::endl;
|
||||
sif::warning << "PlocMPSoCHandler::handleActionCommandFailure: Did not expect the action ID "
|
||||
<< actionId << std::endl;
|
||||
return;
|
||||
}
|
||||
switch (powerState) {
|
||||
case PowerState::BOOTING: {
|
||||
case PowerState::PENDING_STARTUP: {
|
||||
sif::info << "PlocMPSoCHandler::handleActionCommandFailure: MPSoC boot command failed"
|
||||
<< std::endl;
|
||||
// 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: {
|
||||
case PowerState::PENDING_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::OFF;
|
||||
break;
|
||||
}
|
||||
default:
|
||||
break;
|
||||
}
|
||||
powerState = PowerState::SUPV_FAILED;
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -103,11 +103,17 @@ class PlocMpsocHandler : public DeviceHandlerBase, public CommandsActionsIF {
|
||||
//! [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);
|
||||
//! [EXPORT] : [COMMENT] SUPV not on for boot or shutdown process. P1: 0 for OFF transition, 1 for
|
||||
//! ON transition.
|
||||
static constexpr Event SUPV_NOT_ON = event::makeEvent(SUBSYSTEM_ID, 7, severity::LOW);
|
||||
static constexpr Event SUPV_REPLY_TIMEOUT = event::makeEvent(SUBSYSTEM_ID, 8, severity::LOW);
|
||||
|
||||
static const uint16_t APID_MASK = 0x7FF;
|
||||
static const uint16_t PACKET_SEQUENCE_COUNT_MASK = 0x3FFF;
|
||||
|
||||
mpsoc::HkReport hkReport;
|
||||
Countdown mpsocBootTransitionCd = Countdown(6500);
|
||||
Countdown supvTransitionCd = Countdown(3000);
|
||||
|
||||
MessageQueueIF* eventQueue = nullptr;
|
||||
MessageQueueIF* commandActionHelperQueue = nullptr;
|
||||
@ -186,12 +192,11 @@ class PlocMpsocHandler : public DeviceHandlerBase, public CommandsActionsIF {
|
||||
|
||||
size_t foundPacketLen = 0;
|
||||
TelemetryBuffer tmBuffer;
|
||||
uint32_t waitCycles = 0;
|
||||
|
||||
enum class StartupState { IDLE, HW_INIT, WAIT_CYCLES, DONE } startupState = StartupState::IDLE;
|
||||
enum class PowerState { OFF, BOOTING, SHUTDOWN, ON };
|
||||
enum class StartupState { IDLE, HW_INIT, DONE } startupState = StartupState::IDLE;
|
||||
enum class PowerState { IDLE, PENDING_STARTUP, PENDING_SHUTDOWN, SUPV_FAILED, DONE };
|
||||
|
||||
PowerState powerState = PowerState::OFF;
|
||||
PowerState powerState = PowerState::IDLE;
|
||||
|
||||
/**
|
||||
* @brief Handles events received from the PLOC MPSoC helper
|
||||
@ -299,6 +304,9 @@ class PlocMpsocHandler : public DeviceHandlerBase, public CommandsActionsIF {
|
||||
ReturnValue_t prepareTcModeReplay();
|
||||
|
||||
void cmdDoneHandler(bool success, ReturnValue_t result);
|
||||
bool handleHwStartup();
|
||||
bool handleHwShutdown();
|
||||
void stopSpecialComHelper();
|
||||
|
||||
void handleActionCommandFailure(ActionId_t actionId);
|
||||
};
|
||||
|
@ -19,6 +19,8 @@
|
||||
using namespace supv;
|
||||
using namespace returnvalue;
|
||||
|
||||
std::atomic_bool supv::SUPV_ON = false;
|
||||
|
||||
PlocSupervisorHandler::PlocSupervisorHandler(object_id_t objectId, CookieIF* comCookie,
|
||||
Gpio uartIsolatorSwitch, power::Switch_t powerSwitch,
|
||||
PlocSupvUartManager& supvHelper)
|
||||
@ -156,6 +158,7 @@ void PlocSupervisorHandler::doStartUp() {
|
||||
}
|
||||
if (startupState == StartupState::ON) {
|
||||
hkset.setReportingEnabled(true);
|
||||
supv::SUPV_ON = true;
|
||||
setMode(_MODE_TO_ON);
|
||||
}
|
||||
}
|
||||
@ -169,6 +172,7 @@ void PlocSupervisorHandler::doShutDown() {
|
||||
nextReplyId = supv::NONE;
|
||||
uartManager.stop();
|
||||
uartIsolatorSwitch.pullLow();
|
||||
supv::SUPV_ON = false;
|
||||
startupState = StartupState::OFF;
|
||||
}
|
||||
|
||||
@ -202,11 +206,13 @@ ReturnValue_t PlocSupervisorHandler::buildCommandFromCommand(DeviceCommandId_t d
|
||||
break;
|
||||
}
|
||||
case START_MPSOC: {
|
||||
sif::info << "PLOC SUPV: Starting MPSoC" << std::endl;
|
||||
prepareEmptyCmd(Apid::BOOT_MAN, static_cast<uint8_t>(tc::BootManId::START_MPSOC));
|
||||
result = returnvalue::OK;
|
||||
break;
|
||||
}
|
||||
case SHUTDOWN_MPSOC: {
|
||||
sif::info << "PLOC SUPV: Shutting down MPSoC" << std::endl;
|
||||
prepareEmptyCmd(Apid::BOOT_MAN, static_cast<uint8_t>(tc::BootManId::SHUTDOWN_MPSOC));
|
||||
result = returnvalue::OK;
|
||||
break;
|
||||
@ -1527,7 +1533,13 @@ void PlocSupervisorHandler::disableAllReplies() {
|
||||
|
||||
/* Disable ack reply */
|
||||
iter = deviceReplyMap.find(ACK_REPORT);
|
||||
if (iter == deviceReplyMap.end()) {
|
||||
return;
|
||||
}
|
||||
DeviceReplyInfo* info = &(iter->second);
|
||||
if (info == nullptr) {
|
||||
return;
|
||||
}
|
||||
info->delayCycles = 0;
|
||||
info->command = deviceCommandMap.end();
|
||||
|
||||
|
@ -10,12 +10,15 @@
|
||||
#include <fsfw/tmtcpacket/ccsds/SpacePacketReader.h>
|
||||
#include <mission/payload/plocSpBase.h>
|
||||
|
||||
#include <atomic>
|
||||
#include <optional>
|
||||
|
||||
#include "eive/resultClassIds.h"
|
||||
|
||||
namespace supv {
|
||||
|
||||
extern std::atomic_bool SUPV_ON;
|
||||
|
||||
namespace result {
|
||||
static const uint8_t INTERFACE_ID = CLASS_ID::SUPV_RETURN_VALUES_IF;
|
||||
|
||||
|
2
tmtc
2
tmtc
@ -1 +1 @@
|
||||
Subproject commit d23cc6834ad0895c230d2378b0c8d9ba4f374f8d
|
||||
Subproject commit 22a42108b431bafa707de2b3a24cad9de95b70d0
|
Loading…
Reference in New Issue
Block a user