PLOC SUPV Update to newer firmware #316

Merged
muellerr merged 99 commits from mueller/tas_ploc_supv_update into develop 2022-11-18 14:27:13 +01:00
2 changed files with 49 additions and 66 deletions
Showing only changes of commit 54523b25d1 - Show all commits

View File

@ -21,54 +21,55 @@ static const uint8_t INTERFACE_ID = CLASS_ID::SUPV_RETURN_VALUES_IF;
//! [EXPORT] : [COMMENT] Space Packet received from PLOC supervisor has invalid CRC
static const ReturnValue_t CRC_FAILURE = MAKE_RETURN_CODE(0xA0);
static constexpr ReturnValue_t INVALID_SERVICE_ID = MAKE_RETURN_CODE(0xA1);
//! [EXPORT] : [COMMENT] Received ACK failure reply from PLOC supervisor
static const ReturnValue_t RECEIVED_ACK_FAILURE = MAKE_RETURN_CODE(0xA1);
static const ReturnValue_t RECEIVED_ACK_FAILURE = MAKE_RETURN_CODE(0xA2);
//! [EXPORT] : [COMMENT] Received execution failure reply from PLOC supervisor
static const ReturnValue_t RECEIVED_EXE_FAILURE = MAKE_RETURN_CODE(0xA2);
static const ReturnValue_t RECEIVED_EXE_FAILURE = MAKE_RETURN_CODE(0xA3);
//! [EXPORT] : [COMMENT] Received space packet with invalid APID from PLOC supervisor
static const ReturnValue_t INVALID_APID = MAKE_RETURN_CODE(0xA3);
static const ReturnValue_t INVALID_APID = MAKE_RETURN_CODE(0xA4);
//! [EXPORT] : [COMMENT] Failed to read current system time
static const ReturnValue_t GET_TIME_FAILURE = MAKE_RETURN_CODE(0xA4);
static const ReturnValue_t GET_TIME_FAILURE = MAKE_RETURN_CODE(0xA5);
//! [EXPORT] : [COMMENT] Received command with invalid watchdog parameter. Valid watchdogs are 0
//! for PS, 1 for PL and 2 for INT
static const ReturnValue_t INVALID_WATCHDOG = MAKE_RETURN_CODE(0xA5);
static const ReturnValue_t INVALID_WATCHDOG = MAKE_RETURN_CODE(0xA6);
//! [EXPORT] : [COMMENT] Received watchdog timeout config command with invalid timeout. Valid
//! timeouts must be in the range between 1000 and 360000 ms.
static const ReturnValue_t INVALID_WATCHDOG_TIMEOUT = MAKE_RETURN_CODE(0xA6);
static const ReturnValue_t INVALID_WATCHDOG_TIMEOUT = MAKE_RETURN_CODE(0xA7);
//! [EXPORT] : [COMMENT] Received latchup config command with invalid latchup ID
static const ReturnValue_t INVALID_LATCHUP_ID = MAKE_RETURN_CODE(0xA7);
static const ReturnValue_t INVALID_LATCHUP_ID = MAKE_RETURN_CODE(0xA8);
//! [EXPORT] : [COMMENT] Received set adc sweep period command with invalid sweep period. Must be
//! larger than 21.
static const ReturnValue_t SWEEP_PERIOD_TOO_SMALL = MAKE_RETURN_CODE(0xA8);
static const ReturnValue_t SWEEP_PERIOD_TOO_SMALL = MAKE_RETURN_CODE(0xA9);
//! [EXPORT] : [COMMENT] Receive auto EM test command with invalid test param. Valid params are 1
//! and 2.
static const ReturnValue_t INVALID_TEST_PARAM = MAKE_RETURN_CODE(0xA9);
static const ReturnValue_t INVALID_TEST_PARAM = MAKE_RETURN_CODE(0xAA);
//! [EXPORT] : [COMMENT] Returned when scanning for MRAM dump packets failed.
static const ReturnValue_t MRAM_PACKET_PARSING_FAILURE = MAKE_RETURN_CODE(0xAA);
static const ReturnValue_t MRAM_PACKET_PARSING_FAILURE = MAKE_RETURN_CODE(0xAB);
//! [EXPORT] : [COMMENT] Returned when the start and stop addresses of the MRAM dump or MRAM wipe
//! commands are invalid (e.g. start address bigger than stop address)
static const ReturnValue_t INVALID_MRAM_ADDRESSES = MAKE_RETURN_CODE(0xAB);
static const ReturnValue_t INVALID_MRAM_ADDRESSES = MAKE_RETURN_CODE(0xAC);
//! [EXPORT] : [COMMENT] Expect reception of an MRAM dump packet but received space packet with
//! other apid.
static const ReturnValue_t NO_MRAM_PACKET = MAKE_RETURN_CODE(0xAC);
static const ReturnValue_t NO_MRAM_PACKET = MAKE_RETURN_CODE(0xAD);
//! [EXPORT] : [COMMENT] Path to PLOC directory on SD card does not exist
static const ReturnValue_t PATH_DOES_NOT_EXIST = MAKE_RETURN_CODE(0xAD);
static const ReturnValue_t PATH_DOES_NOT_EXIST = MAKE_RETURN_CODE(0xAE);
//! [EXPORT] : [COMMENT] MRAM dump file does not exists. The file should actually already have
//! been created with the reception of the first dump packet.
static const ReturnValue_t MRAM_FILE_NOT_EXISTS = MAKE_RETURN_CODE(0xAE);
static constexpr ReturnValue_t INVALID_REPLY_LENGTH = MAKE_RETURN_CODE(0xAF);
static const ReturnValue_t MRAM_FILE_NOT_EXISTS = MAKE_RETURN_CODE(0xAF);
static constexpr ReturnValue_t INVALID_REPLY_LENGTH = MAKE_RETURN_CODE(0xB0);
//! [EXPORT] : [COMMENT] Received action command has invalid length
static const ReturnValue_t INVALID_LENGTH = MAKE_RETURN_CODE(0xB0);
static const ReturnValue_t INVALID_LENGTH = MAKE_RETURN_CODE(0xB1);
//! [EXPORT] : [COMMENT] Filename too long
static const ReturnValue_t FILENAME_TOO_LONG = MAKE_RETURN_CODE(0xB1);
static const ReturnValue_t FILENAME_TOO_LONG = MAKE_RETURN_CODE(0xB2);
//! [EXPORT] : [COMMENT] Received update status report with invalid packet length field
static const ReturnValue_t UPDATE_STATUS_REPORT_INVALID_LENGTH = MAKE_RETURN_CODE(0xB2);
static const ReturnValue_t UPDATE_STATUS_REPORT_INVALID_LENGTH = MAKE_RETURN_CODE(0xB3);
//! [EXPORT] : [COMMENT] Update status report does not contain expected CRC. There might be a bit
//! flip in the update memory region.
static const ReturnValue_t UPDATE_CRC_FAILURE = MAKE_RETURN_CODE(0xB3);
static const ReturnValue_t UPDATE_CRC_FAILURE = MAKE_RETURN_CODE(0xB4);
//! [EXPORT] : [COMMENT] Supervisor helper task ist currently executing a command (wait until
//! helper tas has finished or interrupt by sending the terminate command)
static const ReturnValue_t SUPV_HELPER_EXECUTING = MAKE_RETURN_CODE(0xB4);
static const ReturnValue_t SUPV_HELPER_EXECUTING = MAKE_RETURN_CODE(0xB5);
static constexpr ReturnValue_t BUF_TOO_SMALL = MAKE_RETURN_CODE(0xC0);
static constexpr ReturnValue_t NO_REPLY_TIMEOUT = MAKE_RETURN_CODE(0xC1);
@ -1165,8 +1166,6 @@ class VerificationReport {
uint32_t getStatusCode() const { return statusCode; }
virtual ReturnValue_t checkApid() { return returnvalue::FAILED; }
protected:
TmBase& readerBase;
uint8_t refApid = 0;
@ -1183,7 +1182,7 @@ class AcknowledgmentReport : public VerificationReport {
virtual ReturnValue_t parse() override {
if (readerBase.getServiceId() != static_cast<uint8_t>(tm::TmtcId::ACK) and
readerBase.getServiceId() != static_cast<uint8_t>(tm::TmtcId::NAK)) {
return returnvalue::FAILED;
return result::INVALID_SERVICE_ID;
}
return VerificationReport::parse();
}

View File

@ -924,54 +924,38 @@ ReturnValue_t PlocSupervisorHandler::handleAckReport(const uint8_t* data) {
ReturnValue_t result = returnvalue::OK;
tmReader.setData(data, SIZE_ACK_REPORT);
if(tmReader.checkCrc() != returnvalue::OK) {
sif::error << "PlocSupervisorHandler::handleAckReport: CRC failure" << std::endl;
nextReplyId = supv::NONE;
replyRawReplyIfnotWiretapped(data, supv::SIZE_ACK_REPORT);
triggerEvent(SUPV_CRC_FAILURE_EVENT);
sendFailureReport(supv::ACK_REPORT, result::CRC_FAILURE);
disableAllReplies();
return returnvalue::OK;
if (tmReader.checkCrc() != returnvalue::OK) {
sif::error << "PlocSupervisorHandler::handleAckReport: CRC failure" << std::endl;
nextReplyId = supv::NONE;
replyRawReplyIfnotWiretapped(data, supv::SIZE_ACK_REPORT);
triggerEvent(SUPV_CRC_FAILURE_EVENT);
sendFailureReport(supv::ACK_REPORT, result::CRC_FAILURE);
disableAllReplies();
return returnvalue::OK;
}
AcknowledgmentReport ack(tmReader);
result = ack.parse();
if (result != returnvalue::OK) {
return result;
nextReplyId = supv::NONE;
replyRawReplyIfnotWiretapped(data, supv::SIZE_ACK_REPORT);
triggerEvent(SUPV_CRC_FAILURE_EVENT);
sendFailureReport(supv::ACK_REPORT, result);
disableAllReplies();
return result;
}
if (tmReader.getServiceId() == static_cast<uint8_t>(supv::tm::TmtcId::NAK)) {
DeviceCommandId_t commandId = getPendingCommand();
if (commandId != DeviceHandlerIF::NO_COMMAND_ID) {
triggerEvent(SUPV_ACK_FAILURE, commandId, static_cast<uint32_t>(ack.getStatusCode()));
}
printAckFailureInfo(ack.getStatusCode(), commandId);
sendFailureReport(supv::ACK_REPORT, result::RECEIVED_ACK_FAILURE);
disableAllReplies();
nextReplyId = supv::NONE;
result = IGNORE_REPLY_DATA;
} else if (tmReader.getServiceId() == static_cast<uint8_t>(supv::tm::TmtcId::ACK)) {
setNextReplyId();
}
// TODO: Fix
// result = ack.checkApid();
//
// switch (result) {
// case SupvReturnValuesIF::RECEIVED_ACK_FAILURE: {
// DeviceCommandId_t commandId = getPendingCommand();
// if (commandId != DeviceHandlerIF::NO_COMMAND_ID) {
// triggerEvent(SUPV_ACK_FAILURE, commandId, static_cast<uint32_t>(ack.getStatusCode()));
// }
// printAckFailureInfo(ack.getStatusCode(), commandId);
// sendFailureReport(supv::ACK_REPORT, SupvReturnValuesIF::RECEIVED_ACK_FAILURE);
// disableAllReplies();
// nextReplyId = supv::NONE;
// result = IGNORE_REPLY_DATA;
// break;
// }
// case returnvalue::OK: {
// setNextReplyId();
// break;
// }
// case SupvReturnValuesIF::INVALID_APID:
// sif::warning << "PlocSupervisorHandler::handleAckReport: Invalid APID in Ack report"
// << std::endl;
// sendFailureReport(supv::ACK_REPORT, result);
// disableAllReplies();
// nextReplyId = supv::NONE;
// result = IGNORE_REPLY_DATA;
// break;
// default: {
// sif::error << "PlocSupervisorHandler::handleAckReport: APID parsing failed" << std::endl;
// result = returnvalue::FAILED;
// break;
// }
// }
return result;
}