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() {
if (startupState == StartupState::IDLE) {
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;
break;
case PowerState::ON:
hkReport.setReportingEnabled(true);
setMode(_MODE_TO_ON);
uartIsolatorSwitch.pullHigh();
break;
default:
break;
}
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
powerState = PowerState::ON;
hkReport.setReportingEnabled(true);
setMode(_MODE_TO_ON);
uartIsolatorSwitch.pullHigh();
uartIsolatorSwitch.pullHigh();
startupState = StartupState::WAIT_CYCLE;
#endif /* not MSPOC_JTAG_BOOT == 1 */
#else
powerState = PowerState::ON;
hkReport.setReportingEnabled(true);
setMode(_MODE_TO_ON);
startupState = StartupState::WAIT_CYCLES;
powerState = PowerState::ON;
#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() {
@ -205,11 +218,12 @@ void PlocMPSoCHandler::doShutDown() {
powerState = PowerState::OFF;
#endif
#endif
startupState = StartupState::IDLE;
}
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;
return buildCommandFromCommand(*id, nullptr, 0);
}
@ -336,7 +350,6 @@ void PlocMPSoCHandler::fillCommandAndReplyMap() {
ReturnValue_t PlocMPSoCHandler::scanForReply(const uint8_t* start, size_t remainingSize,
DeviceCommandId_t* foundId, size_t* foundLen) {
ReturnValue_t result = returnvalue::OK;
sif::debug << "remaining size: " << remainingSize << std::endl;
SpacePacketReader spacePacket;
spacePacket.setReadOnlyData(start, remainingSize);
@ -351,7 +364,7 @@ ReturnValue_t PlocMPSoCHandler::scanForReply(const uint8_t* start, size_t remain
switch (apid) {
case (mpsoc::apid::ACK_SUCCESS):
sif::debug << "recv ack success" << std::endl;
sif::debug << "recv ack success" << std::endl;
*foundLen = mpsoc::SIZE_ACK_REPORT;
*foundId = mpsoc::ACK_REPORT;
break;
@ -369,14 +382,12 @@ ReturnValue_t PlocMPSoCHandler::scanForReply(const uint8_t* start, size_t remain
*foundId = mpsoc::TM_CAM_CMD_RPT;
break;
case (mpsoc::apid::TM_HK_GET_REPORT): {
sif::debug << "recv hk report" << std::endl;
*foundLen = spacePacket.getFullPacketLen();
foundPacketLen = *foundLen;
*foundId = mpsoc::TM_GET_HK_REPORT;
break;
}
case (mpsoc::apid::EXE_SUCCESS):
sif::debug << "recv exe success" << std::endl;
*foundLen = mpsoc::SIZE_EXE_REPORT;
*foundId = mpsoc::EXE_REPORT;
break;
@ -434,9 +445,7 @@ ReturnValue_t PlocMPSoCHandler::interpretDeviceReply(DeviceCommandId_t id, const
return result;
}
void PlocMPSoCHandler::setNormalDatapoolEntriesInvalid() {
hkReport.setValidity(false, true);
}
void PlocMPSoCHandler::setNormalDatapoolEntriesInvalid() { hkReport.setValidity(false, true); }
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;
break;
default: {
sif::debug << "reply length " << iter->second.replyLen << std::endl;
replyLen = iter->second.replyLen;
break;
}

View File

@ -183,7 +183,9 @@ 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;
enum class PowerState { OFF, BOOTING, SHUTDOWN, ON };
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> semCorrectableErrs =
lp_var_t<uint16_t>(sid.objectId, mpsoc::poolid::SEM_CORRECTABLE_ERRS, this);
lp_var_t<uint8_t> semStatus =
lp_var_t<uint8_t>(sid.objectId, mpsoc::poolid::SEM_CORRECTABLE_ERRS, this);
lp_var_t<uint8_t> semStatus = lp_var_t<uint8_t>(sid.objectId, mpsoc::poolid::SEM_STATUS, this);
lp_var_t<uint8_t> rebootMpsocRequired =
lp_var_t<uint8_t>(sid.objectId, mpsoc::poolid::REBOOT_MPSOC_REQUIRED, this);
};