mpsoc shutdown after running update procedure
This commit is contained in:
@ -149,7 +149,8 @@ ReturnValue_t PlocSupvHelper::performUpdate() {
|
||||
return result;
|
||||
}
|
||||
#if OBSW_DEBUG_PLOC_SUPERVISOR == 1
|
||||
ProgressPrinter progressPrinter("Supervisor update", update.length, ProgressPrinter::ONE_PERCENT);
|
||||
ProgressPrinter progressPrinter("Supervisor update", update.length,
|
||||
ProgressPrinter::HALF_PERCENT);
|
||||
#endif /* OBSW_DEBUG_PLOC_SUPERVISOR == 1 */
|
||||
uint8_t tempData[supv::WriteMemory::CHUNK_MAX];
|
||||
std::ifstream file(update.file, std::ifstream::binary);
|
||||
@ -172,9 +173,9 @@ ReturnValue_t PlocSupvHelper::performUpdate() {
|
||||
file.read(reinterpret_cast<char*>(tempData), dataLength);
|
||||
if (!file) {
|
||||
sif::warning << "PlocSupvHelper::performUpdate: Read only " << file.gcount() << " of "
|
||||
<< dataLength << " bytes" << std::endl;
|
||||
<< dataLength << " bytes" << std::endl;
|
||||
sif::info << "PlocSupvHelper::performUpdate: Failed when trying to read byte "
|
||||
<< bytesWritten << std::endl;
|
||||
<< bytesWritten << std::endl;
|
||||
}
|
||||
remainingSize -= dataLength;
|
||||
} else {
|
||||
@ -280,64 +281,48 @@ ReturnValue_t PlocSupvHelper::sendCommand(SpacePacket& packet) {
|
||||
|
||||
ReturnValue_t PlocSupvHelper::handleAck() {
|
||||
ReturnValue_t result = RETURN_OK;
|
||||
supv::TmPacket tmPacket;
|
||||
result = handleTmReception(&tmPacket, supv::SIZE_ACK_REPORT);
|
||||
supv::AcknowledgmentReport ackReport;
|
||||
result = handleTmReception(&ackReport, supv::SIZE_ACK_REPORT);
|
||||
if (result != RETURN_OK) {
|
||||
triggerEvent(ACK_RECEPTION_FAILURE, result, static_cast<uint32_t>(rememberApid));
|
||||
sif::warning << "PlocSupvHelper::handleAck: Error in reception of acknowledgment report"
|
||||
<< std::endl;
|
||||
return result;
|
||||
}
|
||||
uint16_t apid = tmPacket.getAPID();
|
||||
if (apid != supv::APID_ACK_SUCCESS) {
|
||||
handleAckApidFailure(apid);
|
||||
return RETURN_FAILED;
|
||||
result = ackReport.checkApid();
|
||||
if (result != RETURN_OK) {
|
||||
if (result == SupvReturnValuesIF::RECEIVED_ACK_FAILURE) {
|
||||
triggerEvent(SUPV_ACK_FAILURE_REPORT, static_cast<uint32_t>(ackReport.getRefApid()));
|
||||
} else if (result == SupvReturnValuesIF::INVALID_APID) {
|
||||
triggerEvent(SUPV_ACK_INVALID_APID, static_cast<uint32_t>(rememberApid));
|
||||
}
|
||||
return result;
|
||||
}
|
||||
return RETURN_OK;
|
||||
}
|
||||
|
||||
void PlocSupvHelper::handleAckApidFailure(uint16_t apid) {
|
||||
if (apid == supv::APID_ACK_FAILURE) {
|
||||
triggerEvent(SUPV_ACK_FAILURE_REPORT, static_cast<uint32_t>(internalState));
|
||||
sif::warning << "PlocSupvHelper::handleAckApidFailure: Received acknowledgement failure "
|
||||
<< "report" << std::endl;
|
||||
} else {
|
||||
triggerEvent(SUPV_ACK_INVALID_APID, apid, static_cast<uint32_t>(internalState));
|
||||
sif::warning << "PlocSupvHelper::handleAckApidFailure: Expected acknowledgement report "
|
||||
<< "but received space packet with apid " << std::hex << apid << std::endl;
|
||||
}
|
||||
}
|
||||
|
||||
ReturnValue_t PlocSupvHelper::handleExe(uint32_t timeout) {
|
||||
ReturnValue_t result = RETURN_OK;
|
||||
supv::TmPacket tmPacket;
|
||||
result = handleTmReception(&tmPacket, supv::SIZE_EXE_REPORT, timeout);
|
||||
supv::ExecutionReport exeReport;
|
||||
result = handleTmReception(&exeReport, supv::SIZE_EXE_REPORT, timeout);
|
||||
if (result != RETURN_OK) {
|
||||
triggerEvent(EXE_RECEPTION_FAILURE, result, static_cast<uint32_t>(rememberApid));
|
||||
sif::warning << "PlocSupvHelper::handleExe: Error in reception of execution report"
|
||||
<< std::endl;
|
||||
return result;
|
||||
}
|
||||
uint16_t apid = tmPacket.getAPID();
|
||||
if (apid != supv::APID_EXE_SUCCESS) {
|
||||
handleExeApidFailure(apid);
|
||||
return RETURN_FAILED;
|
||||
result = exeReport.checkApid();
|
||||
if (result != RETURN_OK) {
|
||||
if (result == SupvReturnValuesIF::RECEIVED_EXE_FAILURE) {
|
||||
triggerEvent(SUPV_EXE_FAILURE_REPORT, static_cast<uint32_t>(exeReport.getRefApid()));
|
||||
} else if (result == SupvReturnValuesIF::INVALID_APID) {
|
||||
triggerEvent(SUPV_EXE_INVALID_APID, static_cast<uint32_t>(rememberApid));
|
||||
}
|
||||
return result;
|
||||
}
|
||||
return RETURN_OK;
|
||||
}
|
||||
|
||||
void PlocSupvHelper::handleExeApidFailure(uint16_t apid) {
|
||||
if (apid == supv::APID_EXE_FAILURE) {
|
||||
triggerEvent(SUPV_EXE_FAILURE_REPORT, static_cast<uint32_t>(internalState));
|
||||
sif::warning << "PlocSupvHelper::handleExeApidFailure: Received execution failure "
|
||||
<< "report" << std::endl;
|
||||
} else {
|
||||
triggerEvent(SUPV_EXE_INVALID_APID, apid, static_cast<uint32_t>(internalState));
|
||||
sif::warning << "PlocSupvHelper::handleExeApidFailure: Expected execution report "
|
||||
<< "but received space packet with apid " << std::hex << apid << std::endl;
|
||||
}
|
||||
}
|
||||
|
||||
ReturnValue_t PlocSupvHelper::handleTmReception(supv::TmPacket* tmPacket, size_t remainingBytes,
|
||||
uint32_t timeout) {
|
||||
ReturnValue_t result = RETURN_OK;
|
||||
@ -404,7 +389,8 @@ ReturnValue_t PlocSupvHelper::calcImageCrc() {
|
||||
uint16_t remainder = CRC16_INIT;
|
||||
uint8_t input;
|
||||
#if OBSW_DEBUG_PLOC_SUPERVISOR == 1
|
||||
ProgressPrinter progress("Supervisor update crc calculation", update.length);
|
||||
ProgressPrinter progress("Supervisor update crc calculation", update.length,
|
||||
ProgressPrinter::ONE_PERCENT);
|
||||
#endif /* OBSW_DEBUG_PLOC_SUPERVISOR == 1 */
|
||||
uint32_t byteCount = 0;
|
||||
for (byteCount = 0; byteCount < update.length; byteCount++) {
|
||||
@ -442,7 +428,7 @@ ReturnValue_t PlocSupvHelper::handleCheckMemoryCommand() {
|
||||
if (result != RETURN_OK) {
|
||||
return result;
|
||||
}
|
||||
result = handleExe();
|
||||
result = handleExe(CRC_EXECUTION_TIMEOUT);
|
||||
if (result != RETURN_OK) {
|
||||
return result;
|
||||
}
|
||||
|
Reference in New Issue
Block a user