This commit is contained in:
commit
5e7f0e729b
16
CHANGELOG.md
16
CHANGELOG.md
@ -23,10 +23,26 @@ will consitute of a breaking change warranting a new major release:
|
||||
- CFDP source handler, which allow file downlink using the standardized
|
||||
CFDP interface.
|
||||
|
||||
## 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.
|
||||
- Host build fixes
|
||||
|
||||
# [v6.6.0] 2023-09-18
|
||||
|
||||
## Changed
|
||||
|
||||
- Changed the memory initialized for the PDEC Config Memory and the PDEC RAM by using `mmap`
|
||||
directly and ignoring UIO. This makes the OBSW compatible to a device tree update, where those
|
||||
memory segments are marked reserved and are thus not properly accessible through the UIO API
|
||||
anymore. This change should be downwards compatible to older device trees.
|
||||
|
||||
# [v6.5.1] 2023-09-12
|
||||
|
||||
- Bumped `eive-tmtc` to v5.5.0.
|
||||
|
@ -10,8 +10,8 @@
|
||||
cmake_minimum_required(VERSION 3.13)
|
||||
|
||||
set(OBSW_VERSION_MAJOR 6)
|
||||
set(OBSW_VERSION_MINOR 5)
|
||||
set(OBSW_VERSION_REVISION 1)
|
||||
set(OBSW_VERSION_MINOR 6)
|
||||
set(OBSW_VERSION_REVISION 0)
|
||||
|
||||
# set(CMAKE_VERBOSE TRUE)
|
||||
|
||||
|
@ -1,7 +1,7 @@
|
||||
/**
|
||||
* @brief Auto-generated event translation file. Contains 307 translations.
|
||||
* @brief Auto-generated event translation file. Contains 309 translations.
|
||||
* @details
|
||||
* Generated on: 2023-09-12 10:51:47
|
||||
* Generated on: 2023-10-04 09:51:41
|
||||
*/
|
||||
#include "translateEvents.h"
|
||||
|
||||
@ -129,6 +129,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";
|
||||
@ -563,6 +565,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:51:47
|
||||
* Generated on: 2023-10-04 09:51:41
|
||||
*/
|
||||
#include "translateObjects.h"
|
||||
|
||||
|
@ -123,6 +123,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
|
||||
|
|
@ -123,6 +123,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 307 translations.
|
||||
* @brief Auto-generated event translation file. Contains 309 translations.
|
||||
* @details
|
||||
* Generated on: 2023-09-12 10:51:47
|
||||
* Generated on: 2023-10-04 09:51:41
|
||||
*/
|
||||
#include "translateEvents.h"
|
||||
|
||||
@ -129,6 +129,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";
|
||||
@ -563,6 +565,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:51:47
|
||||
* Generated on: 2023-10-04 09:51:41
|
||||
*/
|
||||
#include "translateObjects.h"
|
||||
|
||||
|
@ -1,7 +1,7 @@
|
||||
/**
|
||||
* @brief Auto-generated event translation file. Contains 307 translations.
|
||||
* @brief Auto-generated event translation file. Contains 309 translations.
|
||||
* @details
|
||||
* Generated on: 2023-09-12 10:51:47
|
||||
* Generated on: 2023-10-04 09:51:41
|
||||
*/
|
||||
#include "translateEvents.h"
|
||||
|
||||
@ -129,6 +129,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";
|
||||
@ -563,6 +565,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:51:47
|
||||
* Generated on: 2023-10-04 09:51:41
|
||||
*/
|
||||
#include "translateObjects.h"
|
||||
|
||||
|
@ -53,23 +53,30 @@ ReturnValue_t PdecHandler::initialize() {
|
||||
return ObjectManagerIF::CHILD_INIT_FAILED;
|
||||
}
|
||||
|
||||
ReturnValue_t result = returnvalue::OK;
|
||||
|
||||
UioMapper regMapper(uioNames.registers);
|
||||
result = regMapper.getMappedAdress(®isterBaseAddress, UioMapper::Permissions::READ_WRITE);
|
||||
ReturnValue_t result =
|
||||
regMapper.getMappedAdress(®isterBaseAddress, UioMapper::Permissions::READ_WRITE);
|
||||
if (result != returnvalue::OK) {
|
||||
return ObjectManagerIF::CHILD_INIT_FAILED;
|
||||
}
|
||||
UioMapper configMemMapper(uioNames.configMemory);
|
||||
result = configMemMapper.getMappedAdress(&memoryBaseAddress, UioMapper::Permissions::READ_WRITE);
|
||||
if (result != returnvalue::OK) {
|
||||
|
||||
int fd = 0;
|
||||
if ((fd = open("/dev/mem", O_RDWR | O_SYNC)) == -1) {
|
||||
sif::error << "PdecHandler::initialize: Opening /dev/mem failed" << std::endl;
|
||||
return ObjectManagerIF::CHILD_INIT_FAILED;
|
||||
} else {
|
||||
};
|
||||
memoryBaseAddress = static_cast<uint32_t*>(
|
||||
mmap(0, PDEC_CFG_MEM_SIZE, static_cast<int>(UioMapper::Permissions::READ_WRITE), MAP_SHARED,
|
||||
fd, PDEC_CFG_MEM_PHY_ADDR));
|
||||
if (memoryBaseAddress == nullptr) {
|
||||
return ObjectManagerIF::CHILD_INIT_FAILED;
|
||||
}
|
||||
pdecConfig.setMemoryBaseAddress(memoryBaseAddress);
|
||||
}
|
||||
UioMapper ramMapper(uioNames.ramMemory);
|
||||
result = ramMapper.getMappedAdress(&ramBaseAddress, UioMapper::Permissions::READ_WRITE);
|
||||
if (result != returnvalue::OK) {
|
||||
|
||||
ramBaseAddress = static_cast<uint32_t*>(mmap(0, PDEC_RAM_SIZE,
|
||||
static_cast<int>(UioMapper::Permissions::READ_WRITE),
|
||||
MAP_SHARED, fd, PDEC_RAM_PHY_ADDR));
|
||||
if (ramBaseAddress == nullptr) {
|
||||
return ObjectManagerIF::CHILD_INIT_FAILED;
|
||||
}
|
||||
|
||||
|
@ -51,6 +51,10 @@ class PdecHandler : public SystemObject,
|
||||
public ReceivesParameterMessagesIF {
|
||||
public:
|
||||
static constexpr dur_millis_t IRQ_TIMEOUT_MS = 500;
|
||||
static constexpr uint32_t PDEC_CFG_MEM_SIZE = 0x1000;
|
||||
static constexpr uint32_t PDEC_CFG_MEM_PHY_ADDR = 0x24000000;
|
||||
static constexpr uint32_t PDEC_RAM_SIZE = 0x10000;
|
||||
static constexpr uint32_t PDEC_RAM_PHY_ADDR = 0x26000000;
|
||||
|
||||
enum class Modes { POLLED, IRQ };
|
||||
|
||||
|
@ -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 bf399c3d910a034112121f3bfb08494f40d46bf2
|
||||
Subproject commit 0c4762712b9f568943b77373efb3ca3814f78c52
|
Loading…
Reference in New Issue
Block a user