ploc supervisor wip
This commit is contained in:
@ -62,12 +62,24 @@ ReturnValue_t PlocSupervisorHandler::buildCommandFromCommand(
|
||||
prepareSelBootImageCmd(commandData);
|
||||
return RETURN_OK;
|
||||
}
|
||||
case(PLOC_SPV::RESET_MPSOC): {
|
||||
prepareEmptyCmd(PLOC_SPV::APID_RESET_MPSOC);
|
||||
return RETURN_OK;
|
||||
}
|
||||
case(PLOC_SPV::SET_TIME_REF): {
|
||||
return prepareSetTimeRefCmd();
|
||||
}
|
||||
case(PLOC_SPV::SET_BOOT_TIMEOUT): {
|
||||
prepareSetBootTimeoutCmd(commandData);
|
||||
return RETURN_OK;
|
||||
}
|
||||
case(PLOC_SPV::SET_MAX_RESTART_TRIES): {
|
||||
prepareRestartTriesCmd(commandData);
|
||||
return RETURN_OK;
|
||||
}
|
||||
case(PLOC_SPV::DISABLE_PERIOIC_HK_TRANSMISSION): {
|
||||
prepareDisableHk();
|
||||
return RETURN_OK;
|
||||
}
|
||||
default:
|
||||
sif::debug << "PlocSupervisorHandler::buildCommandFromCommand: Command not implemented"
|
||||
@ -87,6 +99,7 @@ void PlocSupervisorHandler::fillCommandAndReplyMap() {
|
||||
this->insertInCommandMap(PLOC_SPV::SET_MAX_RESTART_TRIES);
|
||||
this->insertInCommandMap(PLOC_SPV::RESET_MPSOC);
|
||||
this->insertInCommandMap(PLOC_SPV::SET_TIME_REF);
|
||||
this->insertInCommandMap(PLOC_SPV::DISABLE_PERIOIC_HK_TRANSMISSION);
|
||||
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);
|
||||
@ -299,29 +312,12 @@ ReturnValue_t PlocSupervisorHandler::handleHkReport(const uint8_t* data) {
|
||||
}
|
||||
|
||||
uint16_t offset = PLOC_SPV::DATA_FIELD_OFFSET;
|
||||
hkset.numTms = *(data + offset) << 24 | *(data + offset + 1) << 16 | *(data + offset + 2) << 8
|
||||
| *(data + offset + 3);
|
||||
offset += 4;
|
||||
hkset.tempPs = *(data + offset) << 24 | *(data + offset + 1) << 16 | *(data + offset + 2) << 8
|
||||
| *(data + offset + 3);
|
||||
offset += 4;
|
||||
hkset.tempPl = *(data + offset) << 24 | *(data + offset + 1) << 16 | *(data + offset + 2) << 8
|
||||
| *(data + offset + 3);
|
||||
offset += 4;
|
||||
hkset.socState = *(data + offset) << 24 | *(data + offset + 1) << 16 | *(data + offset + 2) << 8
|
||||
| *(data + offset + 3);
|
||||
offset += 4;
|
||||
hkset.nvm0_1_state = *(data + offset);
|
||||
offset += 1;
|
||||
hkset.nvm3_state = *(data + offset);
|
||||
offset += 1;
|
||||
hkset.missionIoState = *(data + offset);
|
||||
offset += 1;
|
||||
hkset.fmcState = *(data + offset);
|
||||
offset += 1;
|
||||
hkset.numTcs = *(data + offset) << 24 | *(data + offset + 1) << 16 | *(data + offset + 2) << 8
|
||||
| *(data + offset + 3);
|
||||
offset += 4;
|
||||
hkset.tempSup = *(data + offset) << 24 | *(data + offset + 1) << 16 | *(data + offset + 2) << 8
|
||||
| *(data + offset + 3);
|
||||
offset += 4;
|
||||
@ -334,13 +330,35 @@ ReturnValue_t PlocSupervisorHandler::handleHkReport(const uint8_t* data) {
|
||||
hkset.availableHeap = *(data + offset) << 24 | *(data + offset + 1) << 16 | *(data + offset + 2) << 8
|
||||
| *(data + offset + 3);
|
||||
offset += 4;
|
||||
hkset.numTcs = *(data + offset) << 24 | *(data + offset + 1) << 16 | *(data + offset + 2) << 8
|
||||
| *(data + offset + 3);
|
||||
offset += 4;
|
||||
hkset.numTms = *(data + offset) << 24 | *(data + offset + 1) << 16 | *(data + offset + 2) << 8
|
||||
| *(data + offset + 3);
|
||||
offset += 4;
|
||||
hkset.socState = *(data + offset) << 24 | *(data + offset + 1) << 16 | *(data + offset + 2) << 8
|
||||
| *(data + offset + 3);
|
||||
offset += 4;
|
||||
hkset.nvm0_1_state = *(data + offset);
|
||||
offset += 1;
|
||||
hkset.nvm3_state = *(data + offset);
|
||||
offset += 1;
|
||||
hkset.missionIoState = *(data + offset);
|
||||
offset += 1;
|
||||
hkset.fmcState = *(data + offset);
|
||||
offset += 1;
|
||||
|
||||
nextReplyId = PLOC_SPV::EXE_REPORT;
|
||||
|
||||
#if OBSW_VERBOSE_LEVEL >= 1 && PLOC_MPSOC_DEBUG == 1
|
||||
sif::info << "PlocSupervisorHandler::handleHkReport: num_tms: " << hkset.numTms << std::endl;
|
||||
#if OBSW_VERBOSE_LEVEL >= 1 && PLOC_SUPERVISOR_DEBUG == 1
|
||||
sif::info << "PlocSupervisorHandler::handleHkReport: temp_ps: " << hkset.tempPs << std::endl;
|
||||
sif::info << "PlocSupervisorHandler::handleHkReport: temp_pl: " << hkset.tempPl << std::endl;
|
||||
sif::info << "PlocSupervisorHandler::handleHkReport: temp_sup: " << hkset.tempSup << std::endl;
|
||||
sif::info << "PlocSupervisorHandler::handleHkReport: uptime: " << hkset.uptime << std::endl;
|
||||
sif::info << "PlocSupervisorHandler::handleHkReport: cpu_load: " << hkset.cpuLoad << std::endl;
|
||||
sif::info << "PlocSupervisorHandler::handleHkReport: available_heap: " << hkset.availableHeap << std::endl;
|
||||
sif::info << "PlocSupervisorHandler::handleHkReport: num_tcs: " << hkset.numTcs << std::endl;
|
||||
sif::info << "PlocSupervisorHandler::handleHkReport: num_tms: " << hkset.numTms << std::endl;
|
||||
sif::info << "PlocSupervisorHandler::handleHkReport: soc_state: " << hkset.socState << std::endl;
|
||||
sif::info << "PlocSupervisorHandler::handleHkReport: nvm0_1_state: "
|
||||
<< static_cast<unsigned int>(hkset.nvm0_1_state.value) << std::endl;
|
||||
@ -350,11 +368,7 @@ ReturnValue_t PlocSupervisorHandler::handleHkReport(const uint8_t* data) {
|
||||
<< static_cast<unsigned int>(hkset.missionIoState.value) << std::endl;
|
||||
sif::info << "PlocSupervisorHandler::handleHkReport: fmc_state: "
|
||||
<< static_cast<unsigned int>(hkset.fmcState.value) << std::endl;
|
||||
sif::info << "PlocSupervisorHandler::handleHkReport: num_tcs: " << hkset.numTcs << std::endl;
|
||||
sif::info << "PlocSupervisorHandler::handleHkReport: temp_sup: " << hkset.tempSup << std::endl;
|
||||
sif::info << "PlocSupervisorHandler::handleHkReport: uptime: " << hkset.uptime << std::endl;
|
||||
sif::info << "PlocSupervisorHandler::handleHkReport: cpu_load: " << hkset.cpuLoad << std::endl;
|
||||
sif::info << "PlocSupervisorHandler::handleHkReport: available_heap: " << hkset.availableHeap << std::endl;
|
||||
|
||||
#endif
|
||||
|
||||
return result;
|
||||
@ -509,6 +523,14 @@ ReturnValue_t PlocSupervisorHandler::prepareSetTimeRefCmd() {
|
||||
return RETURN_OK;
|
||||
}
|
||||
|
||||
void PlocSupervisorHandler::prepareDisableHk() {
|
||||
PLOC_SPV::DisablePeriodicHkTransmission packet;
|
||||
memcpy(commandBuffer, packet.getWholeData(), packet.getFullSize());
|
||||
rawPacket = commandBuffer;
|
||||
rawPacketLen = packet.getFullSize();
|
||||
nextReplyId = PLOC_SPV::ACK_REPORT;
|
||||
}
|
||||
|
||||
void PlocSupervisorHandler::prepareSetBootTimeoutCmd(const uint8_t * commandData) {
|
||||
uint32_t timeout = *(commandData) << 24 | *(commandData + 1) << 16 | *(commandData + 2) << 8
|
||||
| *(commandData + 3);
|
||||
@ -519,6 +541,15 @@ void PlocSupervisorHandler::prepareSetBootTimeoutCmd(const uint8_t * commandData
|
||||
nextReplyId = PLOC_SPV::ACK_REPORT;
|
||||
}
|
||||
|
||||
void PlocSupervisorHandler::prepareRestartTriesCmd(const uint8_t * commandData) {
|
||||
uint8_t restartTries = *(commandData);
|
||||
PLOC_SPV::SetRestartTries packet(restartTries);
|
||||
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