requires some wait cycles
All checks were successful
EIVE/eive-obsw/pipeline/pr-v2.1.0-dev This commit looks good

This commit is contained in:
Robin Müller 2023-05-12 12:37:25 +02:00
parent 699fc9a861
commit 2b999e7fa7
Signed by: muellerr
GPG Key ID: A649FB78196E3849
3 changed files with 41 additions and 32 deletions

View File

@ -152,32 +152,45 @@ ReturnValue_t PlocMPSoCHandler::executeAction(ActionId_t actionId, MessageQueueI
} }
void PlocMPSoCHandler::doStartUp() { void PlocMPSoCHandler::doStartUp() {
if (startupState == StartupState::IDLE) {
startupState = StartupState::HW_INIT;
}
if (startupState == StartupState::HW_INIT) {
#ifdef XIPHOS_Q7S #ifdef XIPHOS_Q7S
#if not OBSW_MPSOC_JTAG_BOOT == 1 #if not OBSW_MPSOC_JTAG_BOOT == 1
switch (powerState) { switch (powerState) {
case PowerState::OFF: case PowerState::OFF:
commandActionHelper.commandAction(supervisorHandler, supv::START_MPSOC); commandActionHelper.commandAction(supervisorHandler, supv::START_MPSOC);
powerState = PowerState::BOOTING; powerState = PowerState::BOOTING;
break; return;
case PowerState::ON: case PowerState::ON:
hkReport.setReportingEnabled(true); uartIsolatorSwitch.pullHigh();
setMode(_MODE_TO_ON); startupState = StartupState::WAIT_CYCLES;
uartIsolatorSwitch.pullHigh(); break;
break; default:
default: return;
break; }
}
#else #else
powerState = PowerState::ON; uartIsolatorSwitch.pullHigh();
hkReport.setReportingEnabled(true); startupState = StartupState::WAIT_CYCLE;
setMode(_MODE_TO_ON);
uartIsolatorSwitch.pullHigh();
#endif /* not MSPOC_JTAG_BOOT == 1 */ #endif /* not MSPOC_JTAG_BOOT == 1 */
#else #else
powerState = PowerState::ON; startupState = StartupState::WAIT_CYCLES;
hkReport.setReportingEnabled(true); powerState = PowerState::ON;
setMode(_MODE_TO_ON);
#endif /* XIPHOS_Q7S */ #endif /* XIPHOS_Q7S */
}
if (startupState == StartupState::WAIT_CYCLES) {
waitCycles++;
if (waitCycles == 2) {
startupState = StartupState::DONE;
waitCycles = 0;
}
}
if (startupState == StartupState::DONE) {
setMode(_MODE_TO_ON);
hkReport.setReportingEnabled(true);
startupState = StartupState::IDLE;
}
} }
void PlocMPSoCHandler::doShutDown() { void PlocMPSoCHandler::doShutDown() {
@ -205,11 +218,12 @@ void PlocMPSoCHandler::doShutDown() {
powerState = PowerState::OFF; powerState = PowerState::OFF;
#endif #endif
#endif #endif
startupState = StartupState::IDLE;
} }
ReturnValue_t PlocMPSoCHandler::buildNormalDeviceCommand(DeviceCommandId_t* id) { ReturnValue_t PlocMPSoCHandler::buildNormalDeviceCommand(DeviceCommandId_t* id) {
if(getPendingCommand() == DeviceHandlerIF::NO_COMMAND_ID) { // testCycles ++;
if (getPendingCommand() == DeviceHandlerIF::NO_COMMAND_ID) {
*id = mpsoc::TC_GET_HK_REPORT; *id = mpsoc::TC_GET_HK_REPORT;
return buildCommandFromCommand(*id, nullptr, 0); return buildCommandFromCommand(*id, nullptr, 0);
} }
@ -336,7 +350,6 @@ void PlocMPSoCHandler::fillCommandAndReplyMap() {
ReturnValue_t PlocMPSoCHandler::scanForReply(const uint8_t* start, size_t remainingSize, ReturnValue_t PlocMPSoCHandler::scanForReply(const uint8_t* start, size_t remainingSize,
DeviceCommandId_t* foundId, size_t* foundLen) { DeviceCommandId_t* foundId, size_t* foundLen) {
ReturnValue_t result = returnvalue::OK; ReturnValue_t result = returnvalue::OK;
sif::debug << "remaining size: " << remainingSize << std::endl;
SpacePacketReader spacePacket; SpacePacketReader spacePacket;
spacePacket.setReadOnlyData(start, remainingSize); spacePacket.setReadOnlyData(start, remainingSize);
@ -351,7 +364,7 @@ ReturnValue_t PlocMPSoCHandler::scanForReply(const uint8_t* start, size_t remain
switch (apid) { switch (apid) {
case (mpsoc::apid::ACK_SUCCESS): case (mpsoc::apid::ACK_SUCCESS):
sif::debug << "recv ack success" << std::endl; sif::debug << "recv ack success" << std::endl;
*foundLen = mpsoc::SIZE_ACK_REPORT; *foundLen = mpsoc::SIZE_ACK_REPORT;
*foundId = mpsoc::ACK_REPORT; *foundId = mpsoc::ACK_REPORT;
break; break;
@ -369,14 +382,12 @@ ReturnValue_t PlocMPSoCHandler::scanForReply(const uint8_t* start, size_t remain
*foundId = mpsoc::TM_CAM_CMD_RPT; *foundId = mpsoc::TM_CAM_CMD_RPT;
break; break;
case (mpsoc::apid::TM_HK_GET_REPORT): { case (mpsoc::apid::TM_HK_GET_REPORT): {
sif::debug << "recv hk report" << std::endl;
*foundLen = spacePacket.getFullPacketLen(); *foundLen = spacePacket.getFullPacketLen();
foundPacketLen = *foundLen; foundPacketLen = *foundLen;
*foundId = mpsoc::TM_GET_HK_REPORT; *foundId = mpsoc::TM_GET_HK_REPORT;
break; break;
} }
case (mpsoc::apid::EXE_SUCCESS): case (mpsoc::apid::EXE_SUCCESS):
sif::debug << "recv exe success" << std::endl;
*foundLen = mpsoc::SIZE_EXE_REPORT; *foundLen = mpsoc::SIZE_EXE_REPORT;
*foundId = mpsoc::EXE_REPORT; *foundId = mpsoc::EXE_REPORT;
break; break;
@ -434,9 +445,7 @@ ReturnValue_t PlocMPSoCHandler::interpretDeviceReply(DeviceCommandId_t id, const
return result; return result;
} }
void PlocMPSoCHandler::setNormalDatapoolEntriesInvalid() { void PlocMPSoCHandler::setNormalDatapoolEntriesInvalid() { hkReport.setValidity(false, true); }
hkReport.setValidity(false, true);
}
uint32_t PlocMPSoCHandler::getTransitionDelayMs(Mode_t modeFrom, Mode_t modeTo) { return 5000; } uint32_t PlocMPSoCHandler::getTransitionDelayMs(Mode_t modeFrom, Mode_t modeTo) { return 5000; }
@ -1151,7 +1160,6 @@ size_t PlocMPSoCHandler::getNextReplyLength(DeviceCommandId_t commandId) {
replyLen = mpsoc::SP_MAX_SIZE; replyLen = mpsoc::SP_MAX_SIZE;
break; break;
default: { default: {
sif::debug << "reply length " << iter->second.replyLen << std::endl;
replyLen = iter->second.replyLen; replyLen = iter->second.replyLen;
break; break;
} }

View File

@ -183,7 +183,9 @@ class PlocMPSoCHandler : public DeviceHandlerBase, public CommandsActionsIF {
size_t foundPacketLen = 0; size_t foundPacketLen = 0;
TelemetryBuffer tmBuffer; TelemetryBuffer tmBuffer;
uint32_t waitCycles = 0;
enum class StartupState { IDLE, HW_INIT, WAIT_CYCLES, DONE } startupState;
enum class PowerState { OFF, BOOTING, SHUTDOWN, ON }; enum class PowerState { OFF, BOOTING, SHUTDOWN, ON };
PowerState powerState = PowerState::OFF; PowerState powerState = PowerState::OFF;

View File

@ -882,8 +882,7 @@ class HkReport : public StaticLocalDataSet<36> {
lp_var_t<uint16_t>(sid.objectId, mpsoc::poolid::SEM_UNCORRECTABLE_ERRS, this); lp_var_t<uint16_t>(sid.objectId, mpsoc::poolid::SEM_UNCORRECTABLE_ERRS, this);
lp_var_t<uint16_t> semCorrectableErrs = lp_var_t<uint16_t> semCorrectableErrs =
lp_var_t<uint16_t>(sid.objectId, mpsoc::poolid::SEM_CORRECTABLE_ERRS, this); lp_var_t<uint16_t>(sid.objectId, mpsoc::poolid::SEM_CORRECTABLE_ERRS, this);
lp_var_t<uint8_t> semStatus = lp_var_t<uint8_t> semStatus = lp_var_t<uint8_t>(sid.objectId, mpsoc::poolid::SEM_STATUS, this);
lp_var_t<uint8_t>(sid.objectId, mpsoc::poolid::SEM_CORRECTABLE_ERRS, this);
lp_var_t<uint8_t> rebootMpsocRequired = lp_var_t<uint8_t> rebootMpsocRequired =
lp_var_t<uint8_t>(sid.objectId, mpsoc::poolid::REBOOT_MPSOC_REQUIRED, this); lp_var_t<uint8_t>(sid.objectId, mpsoc::poolid::REBOOT_MPSOC_REQUIRED, this);
}; };