Merge branch 'ploc_mpsoc_update_2' into ploc_mpsoc_dir_content_report_2
All checks were successful
EIVE/eive-obsw/pipeline/pr-v2.1.0-dev This commit looks good

This commit is contained in:
2023-05-12 13:31:13 +02:00
7 changed files with 59 additions and 33 deletions

View File

@ -152,32 +152,47 @@ 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_CYCLES;
#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 */
}
// 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 >= 10) {
startupState = StartupState::DONE;
waitCycles = 0;
}
}
if (startupState == StartupState::DONE) {
setMode(_MODE_TO_ON);
hkReport.setReportingEnabled(true);
startupState = StartupState::IDLE;
}
}
void PlocMPSoCHandler::doShutDown() {
@ -205,12 +220,13 @@ void PlocMPSoCHandler::doShutDown() {
powerState = PowerState::OFF;
#endif
#endif
startupState = StartupState::IDLE;
}
ReturnValue_t PlocMPSoCHandler::buildNormalDeviceCommand(DeviceCommandId_t* id) {
if(getPendingCommand() == DeviceHandlerIF::NO_COMMAND_ID) {
if (not normalCmdPending) {
*id = mpsoc::TC_GET_HK_REPORT;
normalCmdPending = true;
return buildCommandFromCommand(*id, nullptr, 0);
}
return NOTHING_TO_SEND;
@ -342,7 +358,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);
@ -362,7 +377,6 @@ 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;
*foundLen = mpsoc::SIZE_ACK_REPORT;
*foundId = mpsoc::ACK_REPORT;
break;
@ -386,7 +400,6 @@ ReturnValue_t PlocMPSoCHandler::scanForReply(const uint8_t* start, size_t remain
break;
}
case (mpsoc::apid::EXE_SUCCESS):
sif::debug << "recv exe success" << std::endl;
*foundLen = mpsoc::SIZE_EXE_REPORT;
*foundId = mpsoc::EXE_REPORT;
break;
@ -461,13 +474,14 @@ void PlocMPSoCHandler::setNormalDatapoolEntriesInvalid() {
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 10000; }
ReturnValue_t PlocMPSoCHandler::initializeLocalDataPool(localpool::DataPool& localDataPoolMap,
LocalDataPoolManager& poolManager) {
localDataPoolMap.emplace(mpsoc::poolid::STATUS, &peStatus);
localDataPoolMap.emplace(mpsoc::poolid::MODE, &peMode);
localDataPoolMap.emplace(mpsoc::poolid::DOWNLINK_PWR_ON, &peDownlinkPwrOn);
localDataPoolMap.emplace(mpsoc::poolid::DOWNLINK_REPLY_ACTIIVE, &peDownlinkReplyActive);
localDataPoolMap.emplace(mpsoc::poolid::DOWNLINK_JESD_SYNC_STATUS, &peDownlinkJesdSyncStatus);
localDataPoolMap.emplace(mpsoc::poolid::DOWNLINK_DAC_STATUS, &peDownlinkDacStatus);
localDataPoolMap.emplace(mpsoc::poolid::CAM_STATUS, &peCameraStatus);
@ -485,6 +499,7 @@ ReturnValue_t PlocMPSoCHandler::initializeLocalDataPool(localpool::DataPool& loc
localDataPoolMap.emplace(mpsoc::poolid::SYSMON_MB3V3, &peSysmonMb3V3);
localDataPoolMap.emplace(mpsoc::poolid::SYSMON_MB1V8, &peSysmonMb1V8);
localDataPoolMap.emplace(mpsoc::poolid::SYSMON_VCC12V, &peSysmonVcc12V);
localDataPoolMap.emplace(mpsoc::poolid::SYSMON_VCC5V, &peSysmonVcc5V);
localDataPoolMap.emplace(mpsoc::poolid::SYSMON_VCC3V3, &peSysmonVcc3V3);
localDataPoolMap.emplace(mpsoc::poolid::SYSMON_VCC3V3VA, &peSysmonVcc3V3VA);
localDataPoolMap.emplace(mpsoc::poolid::SYSMON_VCC2V5DDR, &peSysmonVcc2V5DDR);
@ -786,9 +801,15 @@ ReturnValue_t PlocMPSoCHandler::handleExecutionReport(const uint8_t* data) {
switch (apid) {
case (mpsoc::apid::EXE_SUCCESS): {
if (normalCmdPending) {
normalCmdPending = false;
}
break;
}
case (mpsoc::apid::EXE_FAILURE): {
if (normalCmdPending) {
normalCmdPending = false;
}
// TODO: Interpretation of status field in execution report
sif::warning << "PlocMPSoCHandler::handleExecutionReport: Received execution failure report"
<< std::endl;
@ -1190,7 +1211,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;
}