mpsoc sending action command during startup to supervisor
All checks were successful
EIVE/eive-obsw/pipeline/head This commit looks good

This commit is contained in:
2022-03-31 11:50:33 +02:00
parent 387595495e
commit e9b2def10e
4 changed files with 86 additions and 33 deletions

View File

@ -87,8 +87,8 @@ void PlocMPSoCHandler::performOperationHook() {
}
}
CommandMessage message;
for (ReturnValue_t result = commandActionHelperQueue->receiveMessage(&event); result == RETURN_OK;
result = commandActionHelperQueue->receiveMessage(&event)) {
for (ReturnValue_t result = commandActionHelperQueue->receiveMessage(&message); result == RETURN_OK;
result = commandActionHelperQueue->receiveMessage(&message)) {
result = commandActionHelper.handleReply(&message);
if (result == RETURN_OK) {
continue;
@ -158,7 +158,6 @@ void PlocMPSoCHandler::doShutDown() {
setMode(_MODE_POWER_DOWN);
break;
default:
sif::debug << "PlocMPSoCHandler::doShutDown: This should never happen" << std::endl;
break;
}
}
@ -168,7 +167,7 @@ ReturnValue_t PlocMPSoCHandler::buildNormalDeviceCommand(DeviceCommandId_t* id)
}
ReturnValue_t PlocMPSoCHandler::buildTransitionDeviceCommand(DeviceCommandId_t* id) {
return HasReturnvaluesIF::RETURN_OK;
return NOTHING_TO_SEND;
}
ReturnValue_t PlocMPSoCHandler::buildCommandFromCommand(DeviceCommandId_t deviceCommand,
@ -313,7 +312,7 @@ ReturnValue_t PlocMPSoCHandler::interpretDeviceReply(DeviceCommandId_t id, const
void PlocMPSoCHandler::setNormalDatapoolEntriesInvalid() {}
uint32_t PlocMPSoCHandler::getTransitionDelayMs(Mode_t modeFrom, Mode_t modeTo) { return 500; }
uint32_t PlocMPSoCHandler::getTransitionDelayMs(Mode_t modeFrom, Mode_t modeTo) { return 5000; }
ReturnValue_t PlocMPSoCHandler::initializeLocalDataPool(localpool::DataPool& localDataPoolMap,
LocalDataPoolManager& poolManager) {
@ -713,8 +712,26 @@ void PlocMPSoCHandler::stepSuccessfulReceived(ActionId_t actionId, uint8_t step)
}
void PlocMPSoCHandler::stepFailedReceived(ActionId_t actionId, uint8_t step,
ReturnValue_t returnCode) {
handleActionCommandFailure(actionId);
ReturnValue_t returnCode) {
switch (actionId) {
case supv::START_MPSOC:
sif::warning << "PlocMPSoCHandler::stepFailedReceived: Failed to start MPSoC"
<< std::endl;
powerState = PowerState::OFF;
break;
case supv::SHUTDOWN_MPSOC:
triggerEvent(MPSOC_SHUTDOWN_FAILED);
sif::warning << "PlocMPSoCHandler::stepFailedReceived: Failed to shutdown MPSoC"
<< std::endl;
// TODO: Setting state to on or off here?
powerState = PowerState::ON;
break;
default:
sif::debug
<< "PlocMPSoCHandler::stepFailedReceived: Received unexpected action reply"
<< std::endl;
break;
}
}
void PlocMPSoCHandler::dataReceived(ActionId_t actionId, const uint8_t* data, uint32_t size) {
@ -722,18 +739,21 @@ void PlocMPSoCHandler::dataReceived(ActionId_t actionId, const uint8_t* data, ui
}
void PlocMPSoCHandler::completionSuccessfulReceived(ActionId_t actionId) {
switch(actionId) {
case supv::START_MPSOC: {
if (actionId != supv::EXE_REPORT) {
sif::debug << "PlocMPSoCHandler::completionSuccessfulReceived: Did not expect this action "
<< "ID" << std::endl;
return;
}
switch(powerState) {
case PowerState::BOOTING: {
powerState = PowerState::ON;
break;
}
case supv::SHUTDOWN_MPSOC: {
case PowerState::SHUTDOWN: {
powerState = PowerState::OFF;
break;
default:
sif::debug
<< "PlocMPSoCHandler::completionSuccessfulReceived: Did not expect this action reply"
<< std::endl;
}
default: {
break;
}
}
@ -798,7 +818,7 @@ void PlocMPSoCHandler::disableAllReplies() {
}
}
/* We must always disable the execution report reply here */
/* We always need to disable the execution report reply here */
disableExeReportReply();
nextReplyId = mpsoc::NONE;
}
@ -840,17 +860,29 @@ uint16_t PlocMPSoCHandler::getStatus(const uint8_t* data) {
void PlocMPSoCHandler::handleActionCommandFailure(ActionId_t actionId) {
switch (actionId) {
case supv::START_MPSOC:
powerState = PowerState::ON;
break;
case supv::SHUTDOWN_MPSOC:
triggerEvent(MPSOC_SHUTDOWN_FAILED);
// TODO: Setting state to on or off here?
powerState = PowerState::OFF;
break;
case supv::ACK_REPORT:
case supv::EXE_REPORT:
break;
default:
sif::debug << "PlocMPSoCHandler::handleActionCommandFailure: Received unexpected action reply"
<< std::endl;
break;
sif::debug << "PlocMPSoCHandler::handleActionCommandFailure: Did not expect this action ID "
<< std::endl;
return;
}
switch(powerState) {
case PowerState::BOOTING: {
sif::warning << "PlocMPSoCHandler::handleActionCommandFailure: Failed to boot MPSoC"
<< std::endl;
powerState = PowerState::OFF;
break;
}
case PowerState::SHUTDOWN: {
sif::warning << "PlocMPSoCHandler::handleActionCommandFailure: Failed to shutdown MPSoC"
<< std::endl;
powerState = PowerState::ON;
break;
}
default:
break;
}
return;
}