ploc supervisor update available command, wip
This commit is contained in:
@ -110,7 +110,12 @@ ReturnValue_t PlocSupervisorHandler::buildCommandFromCommand(
|
||||
prepareEmptyCmd(PLOC_SPV::APID_GET_BOOT_STATUS_RPT);
|
||||
result = RETURN_OK;
|
||||
break;
|
||||
}
|
||||
}
|
||||
case(PLOC_SPV::UPDATE_AVAILABLE): {
|
||||
prepareUpdateAvailableCmd();
|
||||
result = RETURN_OK;
|
||||
break;
|
||||
}
|
||||
default:
|
||||
sif::debug << "PlocSupervisorHandler::buildCommandFromCommand: Command not implemented"
|
||||
<< std::endl;
|
||||
@ -142,7 +147,9 @@ void PlocSupervisorHandler::fillCommandAndReplyMap() {
|
||||
this->insertInCommandMap(PLOC_SPV::GET_BOOT_STATUS_REPORT);
|
||||
this->insertInReplyMap(PLOC_SPV::ACK_REPORT, 3, nullptr, PLOC_SPV::SIZE_ACK_REPORT);
|
||||
this->insertInReplyMap(PLOC_SPV::EXE_REPORT, 3, nullptr, PLOC_SPV::SIZE_EXE_REPORT);
|
||||
this->insertInReplyMap(PLOC_SPV::HK_REPORT, 3, nullptr, PLOC_SPV::SIZE_HK_REPORT);
|
||||
this->insertInReplyMap(PLOC_SPV::HK_REPORT, 3, &hkset, PLOC_SPV::SIZE_HK_REPORT);
|
||||
this->insertInReplyMap(PLOC_SPV::HK_REPORT, 3, &bootStatusReport,
|
||||
PLOC_SPV::SIZE_BOOT_STATUS_REPORT);
|
||||
}
|
||||
|
||||
ReturnValue_t PlocSupervisorHandler::scanForReply(const uint8_t *start,
|
||||
@ -441,34 +448,42 @@ ReturnValue_t PlocSupervisorHandler::handleBootStatusReport(const uint8_t* data)
|
||||
|
||||
uint16_t offset = PLOC_SPV::DATA_FIELD_OFFSET;
|
||||
bootStatusReport.bootSignal = *(data + offset);
|
||||
offest += 1;
|
||||
offset += 1;
|
||||
bootStatusReport.resetCounter = *(data + offset);
|
||||
offest += 1;
|
||||
offset += 1;
|
||||
bootStatusReport.bootAfterMs = *(data + offset) << 24 | *(data + offset + 1) << 16 |
|
||||
*(data + offset + 2) << 8 | *(data + offset + 3);
|
||||
offest += 4;
|
||||
offset += 4;
|
||||
bootStatusReport.bootTimeoutMs = *(data + offset) << 24 | *(data + offset + 1) << 16 |
|
||||
*(data + offset + 2) << 8 | *(data + offset + 3);
|
||||
offest += 4;
|
||||
offset += 4;
|
||||
bootStatusReport.activeNvm = *(data + offset);
|
||||
offest += 1;
|
||||
offset += 1;
|
||||
bootStatusReport.bp0State = *(data + offset);
|
||||
offest += 1;
|
||||
offset += 1;
|
||||
bootStatusReport.bp1State = *(data + offset);
|
||||
offest += 1;
|
||||
offset += 1;
|
||||
bootStatusReport.bp2State = *(data + offset);
|
||||
|
||||
nextReplyId = PLOC_SPV::EXE_REPORT;
|
||||
|
||||
#if OBSW_VERBOSE_LEVEL >= 1 && PLOC_SUPERVISOR_DEBUG == 1
|
||||
sif::info << "PlocSupervisorHandler::handleBootStatusReport: Boot signal: " << static_cast<unsigned int>(bootStatusReport.bootSignal.value) << std::endl;
|
||||
sif::info << "PlocSupervisorHandler::handleBootStatusReport: Reset counter: " << static_cast<unsigned int>(bootStatusReport.resetCounter.value) << std::endl;
|
||||
sif::info << "PlocSupervisorHandler::handleBootStatusReport: BootAfterMs: " << bootStatusReport.bootAfterMs << " ms" << std::endl;
|
||||
sif::info << "PlocSupervisorHandler::handleBootStatusReport: BootTimeoutMs: " << bootStatusReport.bootTimeoutMs << " ms" << std::endl;
|
||||
sif::info << "PlocSupervisorHandler::handleBootStatusReport: Active NVM: " << static_cast<unsigned int>(bootStatusReport.activeNvm.value) << std::endl;
|
||||
sif::info << "PlocSupervisorHandler::handleBootStatusReport: BP0: " << static_cast<unsigned int>(bootStatusReport.bp0State) << std::endl;
|
||||
sif::info << "PlocSupervisorHandler::handleBootStatusReport: BP1: " << static_cast<unsigned int>(bootStatusReport.bp1State) << std::endl;
|
||||
sif::info << "PlocSupervisorHandler::handleBootStatusReport: BP2: " << static_cast<unsigned int>(bootStatusReport.bp2State) << std::endl;
|
||||
sif::info << "PlocSupervisorHandler::handleBootStatusReport: Boot signal: "
|
||||
<< static_cast<unsigned int>(bootStatusReport.bootSignal.value) << std::endl;
|
||||
sif::info << "PlocSupervisorHandler::handleBootStatusReport: Reset counter: "
|
||||
<< static_cast<unsigned int>(bootStatusReport.resetCounter.value) << std::endl;
|
||||
sif::info << "PlocSupervisorHandler::handleBootStatusReport: BootAfterMs: "
|
||||
<< bootStatusReport.bootAfterMs << " ms" << std::endl;
|
||||
sif::info << "PlocSupervisorHandler::handleBootStatusReport: BootTimeoutMs: "
|
||||
<< bootStatusReport.bootTimeoutMs << " ms" << std::endl;
|
||||
sif::info << "PlocSupervisorHandler::handleBootStatusReport: Active NVM: "
|
||||
<< static_cast<unsigned int>(bootStatusReport.activeNvm.value) << std::endl;
|
||||
sif::info << "PlocSupervisorHandler::handleBootStatusReport: BP0: "
|
||||
<< static_cast<unsigned int>(bootStatusReport.bp0State.value) << std::endl;
|
||||
sif::info << "PlocSupervisorHandler::handleBootStatusReport: BP1: "
|
||||
<< static_cast<unsigned int>(bootStatusReport.bp1State.value) << std::endl;
|
||||
sif::info << "PlocSupervisorHandler::handleBootStatusReport: BP2: "
|
||||
<< static_cast<unsigned int>(bootStatusReport.bp2State.value) << std::endl;
|
||||
#endif
|
||||
|
||||
return result;
|
||||
@ -493,6 +508,16 @@ ReturnValue_t PlocSupervisorHandler::enableReplyInReplyMap(DeviceCommandMap::ite
|
||||
}
|
||||
break;
|
||||
}
|
||||
case PLOC_SPV::GET_BOOT_STATUS_REPORT: {
|
||||
enabledReplies = 3;
|
||||
result = DeviceHandlerBase::enableReplyInReplyMap(command, enabledReplies, true,
|
||||
PLOC_SPV::BOOT_STATUS_REPORT);
|
||||
if (result != RETURN_OK) {
|
||||
sif::debug << "PlocSupervisorHandler::enableReplyInReplyMap: Reply with id "
|
||||
<< PLOC_SPV::BOOT_STATUS_REPORT << " not in replyMap" << std::endl;
|
||||
}
|
||||
break;
|
||||
}
|
||||
case PLOC_SPV::RESTART_MPSOC:
|
||||
case PLOC_SPV::START_MPSOC:
|
||||
case PLOC_SPV::SHUTDOWN_MPSOC:
|
||||
@ -650,6 +675,29 @@ void PlocSupervisorHandler::prepareRestartTriesCmd(const uint8_t * commandData)
|
||||
nextReplyId = PLOC_SPV::ACK_REPORT;
|
||||
}
|
||||
|
||||
void PlocSupervisorHandler::prepareUpdateAvailableCmd(const uint8_t * commandData) {
|
||||
uint8_t offset = 0;
|
||||
uint8_t imageSelect = *(commandData + offset);
|
||||
offset += 1;
|
||||
uint8_t imagePartition = *(commandData + offset);
|
||||
offset += 1;
|
||||
uint32_t imageSize = *(commandData + offset) << 24 | *(commandData + offset + 1) << 16
|
||||
| *(commandData + offset + 2) << 8 | *(commandData + offset + 3);
|
||||
offset += 4;
|
||||
uint32_t imageCrc = *(commandData + offset) << 24 | *(commandData + offset + 1) << 16
|
||||
| *(commandData + offset + 2) << 8 | *(commandData + offset + 3);
|
||||
offset += 4;
|
||||
uint32_t numberOfPackets = *(commandData + offset) << 24 | *(commandData + offset + 1) << 16
|
||||
| *(commandData + offset + 2) << 8 | *(commandData + offset + 3);
|
||||
|
||||
PLOC_SPV::UpdateAvailable packet(imageSelect, imagePartition, imageSize, imageCrc,
|
||||
numberOfPackets);
|
||||
memcpy(commandBuffer, packet.getWholeData(), packet.getFullSize());
|
||||
rawPacket = commandBuffer;
|
||||
rawPacketLen = packet.getFullSize();
|
||||
nextReplyId = PLOC_SPV::ACK_REPORT;
|
||||
}
|
||||
|
||||
void PlocSupervisorHandler::disableAllReplies() {
|
||||
|
||||
DeviceReplyMap::iterator iter;
|
||||
|
Reference in New Issue
Block a user