PLOC SUPV Update to newer firmware #316
@ -10,34 +10,67 @@
|
|||||||
#include <fsfw/tmtcpacket/ccsds/SpacePacketReader.h>
|
#include <fsfw/tmtcpacket/ccsds/SpacePacketReader.h>
|
||||||
#include <linux/devices/devicedefinitions/PlocSupervisorDefinitions.h>
|
#include <linux/devices/devicedefinitions/PlocSupervisorDefinitions.h>
|
||||||
|
|
||||||
#include "linux/devices/devicedefinitions/SupvReturnValuesIF.h"
|
|
||||||
#include "mission/devices/devicedefinitions/SpBase.h"
|
#include "mission/devices/devicedefinitions/SpBase.h"
|
||||||
|
|
||||||
using namespace returnvalue;
|
using namespace returnvalue;
|
||||||
|
|
||||||
namespace supv {
|
namespace supv {
|
||||||
|
|
||||||
static const uint8_t CLASS_ID = CLASS_ID::PLOC_SUPERVISOR_HANDLER;
|
namespace result {
|
||||||
|
static const uint8_t INTERFACE_ID = CLASS_ID::SUPV_RETURN_VALUES_IF;
|
||||||
|
|
||||||
static constexpr ReturnValue_t CRC_MISSMATCH = makeCode(CLASS_ID, 1);
|
//! [EXPORT] : [COMMENT] Space Packet received from PLOC supervisor has invalid CRC
|
||||||
static constexpr ReturnValue_t APID_MISSMATCH = makeCode(CLASS_ID, 2);
|
static const ReturnValue_t CRC_FAILURE = MAKE_RETURN_CODE(0xA0);
|
||||||
static constexpr ReturnValue_t BUF_TOO_SMALL = makeCode(CLASS_ID, 3);
|
//! [EXPORT] : [COMMENT] Received ACK failure reply from PLOC supervisor
|
||||||
|
static const ReturnValue_t RECEIVED_ACK_FAILURE = MAKE_RETURN_CODE(0xA1);
|
||||||
|
//! [EXPORT] : [COMMENT] Received execution failure reply from PLOC supervisor
|
||||||
|
static const ReturnValue_t RECEIVED_EXE_FAILURE = MAKE_RETURN_CODE(0xA2);
|
||||||
|
//! [EXPORT] : [COMMENT] Received space packet with invalid APID from PLOC supervisor
|
||||||
|
static const ReturnValue_t INVALID_APID = MAKE_RETURN_CODE(0xA3);
|
||||||
|
//! [EXPORT] : [COMMENT] Failed to read current system time
|
||||||
|
static const ReturnValue_t GET_TIME_FAILURE = MAKE_RETURN_CODE(0xA4);
|
||||||
|
//! [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);
|
||||||
|
//! [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);
|
||||||
|
//! [EXPORT] : [COMMENT] Received latchup config command with invalid latchup ID
|
||||||
|
static const ReturnValue_t INVALID_LATCHUP_ID = MAKE_RETURN_CODE(0xA7);
|
||||||
|
//! [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);
|
||||||
|
//! [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);
|
||||||
|
//! [EXPORT] : [COMMENT] Returned when scanning for MRAM dump packets failed.
|
||||||
|
static const ReturnValue_t MRAM_PACKET_PARSING_FAILURE = MAKE_RETURN_CODE(0xAA);
|
||||||
|
//! [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);
|
||||||
|
//! [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);
|
||||||
|
//! [EXPORT] : [COMMENT] Path to PLOC directory on SD card does not exist
|
||||||
|
static const ReturnValue_t PATH_DOES_NOT_EXIST = MAKE_RETURN_CODE(0xAD);
|
||||||
|
//! [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);
|
||||||
|
//! [EXPORT] : [COMMENT] Received action command has invalid length
|
||||||
|
static const ReturnValue_t INVALID_LENGTH = MAKE_RETURN_CODE(0xAF);
|
||||||
|
//! [EXPORT] : [COMMENT] Filename too long
|
||||||
|
static const ReturnValue_t FILENAME_TOO_LONG = MAKE_RETURN_CODE(0xB0);
|
||||||
|
//! [EXPORT] : [COMMENT] Received update status report with invalid packet length field
|
||||||
|
static const ReturnValue_t UPDATE_STATUS_REPORT_INVALID_LENGTH = MAKE_RETURN_CODE(0xB1);
|
||||||
|
//! [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(0xB2);
|
||||||
|
//! [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(0xB3);
|
||||||
|
|
||||||
typedef struct {
|
static constexpr ReturnValue_t BUF_TOO_SMALL = MAKE_RETURN_CODE(0xC0);
|
||||||
// The most significant bit of msec value is set to 0x80 to indicate that full
|
}; // namespace result
|
||||||
// time and data information is transmitted, when the time has been synced with
|
|
||||||
// the reference. If the time has not been synced with reference, then the most
|
|
||||||
// significant bit is set to 0x00. Only the most significant bit is used for
|
|
||||||
// this purpose (bit 15 of the field tm_msec)
|
|
||||||
uint16_t tm_msec; // miliseconds 0-999;
|
|
||||||
uint8_t tm_sec; // seconds after the minute, 0 to 60
|
|
||||||
// (0 - 60 allows for the occasional leap second)
|
|
||||||
uint8_t tm_min; // minutes after the hour, 0 to 59
|
|
||||||
uint8_t tm_hour; // hours since midnight, 0 to 23
|
|
||||||
uint8_t tm_mday; // day of the month, 1 to 31
|
|
||||||
uint8_t tm_mon; // months 1 to 12
|
|
||||||
uint8_t tm_year; // years since 1900
|
|
||||||
} tas_time_t;
|
|
||||||
|
|
||||||
static constexpr uint16_t DEFAULT_SEQ_COUNT = 0;
|
static constexpr uint16_t DEFAULT_SEQ_COUNT = 0;
|
||||||
|
|
||||||
@ -1065,15 +1098,15 @@ class VerificationReport {
|
|||||||
|
|
||||||
virtual ReturnValue_t parse() {
|
virtual ReturnValue_t parse() {
|
||||||
if (not readerBase.crcIsOk()) {
|
if (not readerBase.crcIsOk()) {
|
||||||
return CRC_MISSMATCH;
|
return result::CRC_FAILURE;
|
||||||
}
|
}
|
||||||
if (readerBase.getApid() != Apids::TMTC_MAN) {
|
if (readerBase.getApid() != Apids::TMTC_MAN) {
|
||||||
return APID_MISSMATCH;
|
return result::INVALID_APID;
|
||||||
}
|
}
|
||||||
if (readerBase.getBufSize() < MIN_PAYLOAD_LEN + 8) {
|
if (readerBase.getBufSize() < MIN_PAYLOAD_LEN + 8) {
|
||||||
sif::error << "VerificationReport: Invalid verification report, payload too small"
|
sif::error << "VerificationReport: Invalid verification report, payload too small"
|
||||||
<< std::endl;
|
<< std::endl;
|
||||||
return BUF_TOO_SMALL;
|
return result::BUF_TOO_SMALL;
|
||||||
}
|
}
|
||||||
const uint8_t* payloadStart = readerBase.getPayloadStart();
|
const uint8_t* payloadStart = readerBase.getPayloadStart();
|
||||||
size_t remLen = PAYLOAD_LEN;
|
size_t remLen = PAYLOAD_LEN;
|
||||||
@ -1119,7 +1152,7 @@ class VerificationReport {
|
|||||||
|
|
||||||
virtual ReturnValue_t checkApid() { return returnvalue::FAILED; }
|
virtual ReturnValue_t checkApid() { return returnvalue::FAILED; }
|
||||||
|
|
||||||
private:
|
protected:
|
||||||
TmBase& readerBase;
|
TmBase& readerBase;
|
||||||
uint8_t refApid = 0;
|
uint8_t refApid = 0;
|
||||||
uint8_t refServiceId = 0;
|
uint8_t refServiceId = 0;
|
||||||
@ -1209,6 +1242,10 @@ class ExecutionReport : public VerificationReport {
|
|||||||
ExecutionReport(TmBase& readerBase) : VerificationReport(readerBase) {}
|
ExecutionReport(TmBase& readerBase) : VerificationReport(readerBase) {}
|
||||||
|
|
||||||
ReturnValue_t parse() override {
|
ReturnValue_t parse() override {
|
||||||
|
if (readerBase.getServiceId() == static_cast<uint8_t>(tm::TmtcId::EXEC_NAK)) {
|
||||||
|
printStatusInformation();
|
||||||
|
return result::RECEIVED_EXE_FAILURE;
|
||||||
|
}
|
||||||
/* uint16_t apid = this->getApid();
|
/* uint16_t apid = this->getApid();
|
||||||
if (apid == APID_EXE_SUCCESS) {
|
if (apid == APID_EXE_SUCCESS) {
|
||||||
return returnvalue::OK;
|
return returnvalue::OK;
|
||||||
@ -1660,7 +1697,7 @@ class UpdateStatusReport : public ploc::SpTmReader {
|
|||||||
|
|
||||||
ReturnValue_t verifycrc(uint16_t goodCrc) const {
|
ReturnValue_t verifycrc(uint16_t goodCrc) const {
|
||||||
if (crc != goodCrc) {
|
if (crc != goodCrc) {
|
||||||
return SupvReturnValuesIF::UPDATE_CRC_FAILURE;
|
return result::UPDATE_CRC_FAILURE;
|
||||||
}
|
}
|
||||||
return returnvalue::OK;
|
return returnvalue::OK;
|
||||||
}
|
}
|
||||||
@ -1681,7 +1718,7 @@ class UpdateStatusReport : public ploc::SpTmReader {
|
|||||||
|
|
||||||
ReturnValue_t lengthCheck() {
|
ReturnValue_t lengthCheck() {
|
||||||
if (getFullPacketLen() != FULL_SIZE) {
|
if (getFullPacketLen() != FULL_SIZE) {
|
||||||
return SupvReturnValuesIF::UPDATE_STATUS_REPORT_INVALID_LENGTH;
|
return result::UPDATE_STATUS_REPORT_INVALID_LENGTH;
|
||||||
}
|
}
|
||||||
return returnvalue::OK;
|
return returnvalue::OK;
|
||||||
}
|
}
|
||||||
@ -2020,6 +2057,22 @@ class RequestLoggingData : public TcBase {
|
|||||||
static const uint8_t TPC_OFFSET = 1;
|
static const uint8_t TPC_OFFSET = 1;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
typedef struct {
|
||||||
|
// The most significant bit of msec value is set to 0x80 to indicate that full
|
||||||
|
// time and data information is transmitted, when the time has been synced with
|
||||||
|
// the reference. If the time has not been synced with reference, then the most
|
||||||
|
// significant bit is set to 0x00. Only the most significant bit is used for
|
||||||
|
// this purpose (bit 15 of the field tm_msec)
|
||||||
|
uint16_t tm_msec; // miliseconds 0-999;
|
||||||
|
uint8_t tm_sec; // seconds after the minute, 0 to 60
|
||||||
|
// (0 - 60 allows for the occasional leap second)
|
||||||
|
uint8_t tm_min; // minutes after the hour, 0 to 59
|
||||||
|
uint8_t tm_hour; // hours since midnight, 0 to 23
|
||||||
|
uint8_t tm_mday; // day of the month, 1 to 31
|
||||||
|
uint8_t tm_mon; // months 1 to 12
|
||||||
|
uint8_t tm_year; // years since 1900
|
||||||
|
} tas_time_t;
|
||||||
|
|
||||||
} // namespace notimpl
|
} // namespace notimpl
|
||||||
|
|
||||||
} // namespace supv
|
} // namespace supv
|
||||||
|
@ -1,61 +0,0 @@
|
|||||||
#ifndef SUPV_RETURN_VALUES_IF_H_
|
|
||||||
#define SUPV_RETURN_VALUES_IF_H_
|
|
||||||
|
|
||||||
#include "fsfw/returnvalues/returnvalue.h"
|
|
||||||
|
|
||||||
class SupvReturnValuesIF {
|
|
||||||
public:
|
|
||||||
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);
|
|
||||||
//! [EXPORT] : [COMMENT] Received ACK failure reply from PLOC supervisor
|
|
||||||
static const ReturnValue_t RECEIVED_ACK_FAILURE = MAKE_RETURN_CODE(0xA1);
|
|
||||||
//! [EXPORT] : [COMMENT] Received execution failure reply from PLOC supervisor
|
|
||||||
static const ReturnValue_t RECEIVED_EXE_FAILURE = MAKE_RETURN_CODE(0xA2);
|
|
||||||
//! [EXPORT] : [COMMENT] Received space packet with invalid APID from PLOC supervisor
|
|
||||||
static const ReturnValue_t INVALID_APID = MAKE_RETURN_CODE(0xA3);
|
|
||||||
//! [EXPORT] : [COMMENT] Failed to read current system time
|
|
||||||
static const ReturnValue_t GET_TIME_FAILURE = MAKE_RETURN_CODE(0xA4);
|
|
||||||
//! [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);
|
|
||||||
//! [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);
|
|
||||||
//! [EXPORT] : [COMMENT] Received latchup config command with invalid latchup ID
|
|
||||||
static const ReturnValue_t INVALID_LATCHUP_ID = MAKE_RETURN_CODE(0xA7);
|
|
||||||
//! [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);
|
|
||||||
//! [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);
|
|
||||||
//! [EXPORT] : [COMMENT] Returned when scanning for MRAM dump packets failed.
|
|
||||||
static const ReturnValue_t MRAM_PACKET_PARSING_FAILURE = MAKE_RETURN_CODE(0xAA);
|
|
||||||
//! [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);
|
|
||||||
//! [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);
|
|
||||||
//! [EXPORT] : [COMMENT] Path to PLOC directory on SD card does not exist
|
|
||||||
static const ReturnValue_t PATH_DOES_NOT_EXIST = MAKE_RETURN_CODE(0xAD);
|
|
||||||
//! [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);
|
|
||||||
//! [EXPORT] : [COMMENT] Received action command has invalid length
|
|
||||||
static const ReturnValue_t INVALID_LENGTH = MAKE_RETURN_CODE(0xAF);
|
|
||||||
//! [EXPORT] : [COMMENT] Filename too long
|
|
||||||
static const ReturnValue_t FILENAME_TOO_LONG = MAKE_RETURN_CODE(0xB0);
|
|
||||||
//! [EXPORT] : [COMMENT] Received update status report with invalid packet length field
|
|
||||||
static const ReturnValue_t UPDATE_STATUS_REPORT_INVALID_LENGTH = MAKE_RETURN_CODE(0xB1);
|
|
||||||
//! [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(0xB2);
|
|
||||||
//! [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(0xB3);
|
|
||||||
};
|
|
||||||
|
|
||||||
#endif /* SUPV_RETURN_VALUES_IF_H_ */
|
|
@ -14,6 +14,8 @@
|
|||||||
#include "fsfw/ipc/QueueFactory.h"
|
#include "fsfw/ipc/QueueFactory.h"
|
||||||
#include "fsfw/timemanager/Clock.h"
|
#include "fsfw/timemanager/Clock.h"
|
||||||
|
|
||||||
|
using namespace supv;
|
||||||
|
|
||||||
PlocSupervisorHandler::PlocSupervisorHandler(object_id_t objectId, object_id_t uartComIFid,
|
PlocSupervisorHandler::PlocSupervisorHandler(object_id_t objectId, object_id_t uartComIFid,
|
||||||
CookieIF* comCookie, Gpio uartIsolatorSwitch,
|
CookieIF* comCookie, Gpio uartIsolatorSwitch,
|
||||||
power::Switch_t powerSwitch,
|
power::Switch_t powerSwitch,
|
||||||
@ -103,7 +105,7 @@ ReturnValue_t PlocSupervisorHandler::executeAction(ActionId_t actionId,
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (plocSupvHelperExecuting) {
|
if (plocSupvHelperExecuting) {
|
||||||
return SupvReturnValuesIF::SUPV_HELPER_EXECUTING;
|
return result::SUPV_HELPER_EXECUTING;
|
||||||
}
|
}
|
||||||
|
|
||||||
result = acceptExternalDeviceCommands();
|
result = acceptExternalDeviceCommands();
|
||||||
@ -114,7 +116,7 @@ ReturnValue_t PlocSupervisorHandler::executeAction(ActionId_t actionId,
|
|||||||
switch (actionId) {
|
switch (actionId) {
|
||||||
case PERFORM_UPDATE: {
|
case PERFORM_UPDATE: {
|
||||||
if (size > config::MAX_PATH_SIZE + config::MAX_FILENAME_SIZE) {
|
if (size > config::MAX_PATH_SIZE + config::MAX_FILENAME_SIZE) {
|
||||||
return SupvReturnValuesIF::FILENAME_TOO_LONG;
|
return result::FILENAME_TOO_LONG;
|
||||||
}
|
}
|
||||||
UpdateParams params;
|
UpdateParams params;
|
||||||
result = extractUpdateCommand(data, size, params);
|
result = extractUpdateCommand(data, size, params);
|
||||||
@ -148,7 +150,7 @@ ReturnValue_t PlocSupervisorHandler::executeAction(ActionId_t actionId,
|
|||||||
}
|
}
|
||||||
case LOGGING_REQUEST_EVENT_BUFFERS: {
|
case LOGGING_REQUEST_EVENT_BUFFERS: {
|
||||||
if (size > config::MAX_PATH_SIZE) {
|
if (size > config::MAX_PATH_SIZE) {
|
||||||
return SupvReturnValuesIF::FILENAME_TOO_LONG;
|
return result::FILENAME_TOO_LONG;
|
||||||
}
|
}
|
||||||
result = supvHelper->startEventBufferRequest(
|
result = supvHelper->startEventBufferRequest(
|
||||||
std::string(reinterpret_cast<const char*>(data), size));
|
std::string(reinterpret_cast<const char*>(data), size));
|
||||||
@ -704,7 +706,7 @@ ReturnValue_t PlocSupervisorHandler::scanForReply(const uint8_t* start, size_t r
|
|||||||
default: {
|
default: {
|
||||||
sif::debug << "PlocSupervisorHandler::scanForReply: Reply has invalid apid" << std::endl;
|
sif::debug << "PlocSupervisorHandler::scanForReply: Reply has invalid apid" << std::endl;
|
||||||
*foundLen = remainingSize;
|
*foundLen = remainingSize;
|
||||||
return SupvReturnValuesIF::INVALID_APID;
|
return result::INVALID_APID;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -920,7 +922,7 @@ void PlocSupervisorHandler::setExecutionTimeout(DeviceCommandId_t command) {
|
|||||||
|
|
||||||
ReturnValue_t PlocSupervisorHandler::verifyPacket(const uint8_t* start, size_t foundLen) {
|
ReturnValue_t PlocSupervisorHandler::verifyPacket(const uint8_t* start, size_t foundLen) {
|
||||||
if (CRC::crc16ccitt(start, foundLen) != 0) {
|
if (CRC::crc16ccitt(start, foundLen) != 0) {
|
||||||
return SupvReturnValuesIF::CRC_FAILURE;
|
return result::CRC_FAILURE;
|
||||||
}
|
}
|
||||||
return returnvalue::OK;
|
return returnvalue::OK;
|
||||||
}
|
}
|
||||||
@ -1028,7 +1030,7 @@ ReturnValue_t PlocSupervisorHandler::handleHkReport(const uint8_t* data) {
|
|||||||
|
|
||||||
result = verifyPacket(data, supv::SIZE_HK_REPORT);
|
result = verifyPacket(data, supv::SIZE_HK_REPORT);
|
||||||
|
|
||||||
if (result == SupvReturnValuesIF::CRC_FAILURE) {
|
if (result == result::CRC_FAILURE) {
|
||||||
sif::error << "PlocSupervisorHandler::handleHkReport: Hk report has invalid crc" << std::endl;
|
sif::error << "PlocSupervisorHandler::handleHkReport: Hk report has invalid crc" << std::endl;
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
@ -1104,7 +1106,7 @@ ReturnValue_t PlocSupervisorHandler::handleBootStatusReport(const uint8_t* data)
|
|||||||
|
|
||||||
result = verifyPacket(data, supv::SIZE_BOOT_STATUS_REPORT);
|
result = verifyPacket(data, supv::SIZE_BOOT_STATUS_REPORT);
|
||||||
|
|
||||||
if (result == SupvReturnValuesIF::CRC_FAILURE) {
|
if (result == result::CRC_FAILURE) {
|
||||||
sif::error << "PlocSupervisorHandler::handleBootStatusReport: Boot status report has invalid"
|
sif::error << "PlocSupervisorHandler::handleBootStatusReport: Boot status report has invalid"
|
||||||
" crc"
|
" crc"
|
||||||
<< std::endl;
|
<< std::endl;
|
||||||
@ -1170,7 +1172,7 @@ ReturnValue_t PlocSupervisorHandler::handleLatchupStatusReport(const uint8_t* da
|
|||||||
|
|
||||||
result = verifyPacket(data, supv::SIZE_LATCHUP_STATUS_REPORT);
|
result = verifyPacket(data, supv::SIZE_LATCHUP_STATUS_REPORT);
|
||||||
|
|
||||||
if (result == SupvReturnValuesIF::CRC_FAILURE) {
|
if (result == result::CRC_FAILURE) {
|
||||||
sif::error << "PlocSupervisorHandler::handleLatchupStatusReport: Latchup status report has "
|
sif::error << "PlocSupervisorHandler::handleLatchupStatusReport: Latchup status report has "
|
||||||
<< "invalid crc" << std::endl;
|
<< "invalid crc" << std::endl;
|
||||||
return result;
|
return result;
|
||||||
@ -1290,7 +1292,7 @@ ReturnValue_t PlocSupervisorHandler::handleAdcReport(const uint8_t* data) {
|
|||||||
|
|
||||||
result = verifyPacket(data, supv::SIZE_ADC_REPORT);
|
result = verifyPacket(data, supv::SIZE_ADC_REPORT);
|
||||||
|
|
||||||
if (result == SupvReturnValuesIF::CRC_FAILURE) {
|
if (result == result::CRC_FAILURE) {
|
||||||
sif::error << "PlocSupervisorHandler::handleAdcReport: ADC report has "
|
sif::error << "PlocSupervisorHandler::handleAdcReport: ADC report has "
|
||||||
<< "invalid crc" << std::endl;
|
<< "invalid crc" << std::endl;
|
||||||
return result;
|
return result;
|
||||||
@ -1446,7 +1448,7 @@ ReturnValue_t PlocSupervisorHandler::prepareSetTimeRefCmd() {
|
|||||||
if (result != returnvalue::OK) {
|
if (result != returnvalue::OK) {
|
||||||
sif::warning << "PlocSupervisorHandler::prepareSetTimeRefCmd: Failed to get current time"
|
sif::warning << "PlocSupervisorHandler::prepareSetTimeRefCmd: Failed to get current time"
|
||||||
<< std::endl;
|
<< std::endl;
|
||||||
return SupvReturnValuesIF::GET_TIME_FAILURE;
|
return result::GET_TIME_FAILURE;
|
||||||
}
|
}
|
||||||
supv::SetTimeRef packet(spParams);
|
supv::SetTimeRef packet(spParams);
|
||||||
result = packet.buildPacket(&time);
|
result = packet.buildPacket(&time);
|
||||||
@ -1495,7 +1497,7 @@ ReturnValue_t PlocSupervisorHandler::prepareLatchupConfigCmd(const uint8_t* comm
|
|||||||
ReturnValue_t result = returnvalue::OK;
|
ReturnValue_t result = returnvalue::OK;
|
||||||
uint8_t latchupId = *commandData;
|
uint8_t latchupId = *commandData;
|
||||||
if (latchupId > 6) {
|
if (latchupId > 6) {
|
||||||
return SupvReturnValuesIF::INVALID_LATCHUP_ID;
|
return result::INVALID_LATCHUP_ID;
|
||||||
}
|
}
|
||||||
switch (deviceCommand) {
|
switch (deviceCommand) {
|
||||||
case (supv::ENABLE_LATCHUP_ALERT): {
|
case (supv::ENABLE_LATCHUP_ALERT): {
|
||||||
@ -1533,7 +1535,7 @@ ReturnValue_t PlocSupervisorHandler::prepareSetAlertLimitCmd(const uint8_t* comm
|
|||||||
uint32_t dutycycle = *(commandData + offset) << 24 | *(commandData + offset + 1) << 16 |
|
uint32_t dutycycle = *(commandData + offset) << 24 | *(commandData + offset + 1) << 16 |
|
||||||
*(commandData + offset + 2) << 8 | *(commandData + offset + 3);
|
*(commandData + offset + 2) << 8 | *(commandData + offset + 3);
|
||||||
if (latchupId > 6) {
|
if (latchupId > 6) {
|
||||||
return SupvReturnValuesIF::INVALID_LATCHUP_ID;
|
return result::INVALID_LATCHUP_ID;
|
||||||
}
|
}
|
||||||
supv::SetAlertlimit packet(spParams);
|
supv::SetAlertlimit packet(spParams);
|
||||||
ReturnValue_t result = packet.buildPacket(latchupId, dutycycle);
|
ReturnValue_t result = packet.buildPacket(latchupId, dutycycle);
|
||||||
@ -1585,7 +1587,7 @@ ReturnValue_t PlocSupervisorHandler::prepareSetAdcThresholdCmd(const uint8_t* co
|
|||||||
ReturnValue_t PlocSupervisorHandler::prepareRunAutoEmTest(const uint8_t* commandData) {
|
ReturnValue_t PlocSupervisorHandler::prepareRunAutoEmTest(const uint8_t* commandData) {
|
||||||
uint8_t test = *commandData;
|
uint8_t test = *commandData;
|
||||||
if (test != 1 && test != 2) {
|
if (test != 1 && test != 2) {
|
||||||
return SupvReturnValuesIF::INVALID_TEST_PARAM;
|
return result::INVALID_TEST_PARAM;
|
||||||
}
|
}
|
||||||
supv::RunAutoEmTests packet(spParams);
|
supv::RunAutoEmTests packet(spParams);
|
||||||
ReturnValue_t result = packet.buildPacket(test);
|
ReturnValue_t result = packet.buildPacket(test);
|
||||||
@ -1831,7 +1833,7 @@ ReturnValue_t PlocSupervisorHandler::parseMramPackets(const uint8_t* packet, siz
|
|||||||
sif::info << "PlocSupervisorHandler::parseMramPackets: Can not find MRAM packet in space "
|
sif::info << "PlocSupervisorHandler::parseMramPackets: Can not find MRAM packet in space "
|
||||||
"packet buffer"
|
"packet buffer"
|
||||||
<< std::endl;
|
<< std::endl;
|
||||||
return SupvReturnValuesIF::MRAM_PACKET_PARSING_FAILURE;
|
return result::MRAM_PACKET_PARSING_FAILURE;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1917,7 +1919,7 @@ void PlocSupervisorHandler::increaseExpectedMramReplies(DeviceCommandId_t id) {
|
|||||||
ReturnValue_t PlocSupervisorHandler::checkMramPacketApid() {
|
ReturnValue_t PlocSupervisorHandler::checkMramPacketApid() {
|
||||||
uint16_t apid = (spacePacketBuffer[0] << 8 | spacePacketBuffer[1]) & supv::APID_MASK;
|
uint16_t apid = (spacePacketBuffer[0] << 8 | spacePacketBuffer[1]) & supv::APID_MASK;
|
||||||
if (apid != supv::APID_MRAM_DUMP_TM) {
|
if (apid != supv::APID_MRAM_DUMP_TM) {
|
||||||
return SupvReturnValuesIF::NO_MRAM_PACKET;
|
return result::NO_MRAM_PACKET;
|
||||||
}
|
}
|
||||||
return APERIODIC_REPLY;
|
return APERIODIC_REPLY;
|
||||||
}
|
}
|
||||||
@ -1943,7 +1945,7 @@ ReturnValue_t PlocSupervisorHandler::handleMramDumpFile(DeviceCommandId_t id) {
|
|||||||
if (not std::filesystem::exists(activeMramFile)) {
|
if (not std::filesystem::exists(activeMramFile)) {
|
||||||
sif::warning << "PlocSupervisorHandler::handleMramDumpFile: MRAM file does not exist"
|
sif::warning << "PlocSupervisorHandler::handleMramDumpFile: MRAM file does not exist"
|
||||||
<< std::endl;
|
<< std::endl;
|
||||||
return SupvReturnValuesIF::MRAM_FILE_NOT_EXISTS;
|
return result::MRAM_FILE_NOT_EXISTS;
|
||||||
}
|
}
|
||||||
std::ofstream file(activeMramFile, std::ios_base::app | std::ios_base::out);
|
std::ofstream file(activeMramFile, std::ios_base::app | std::ios_base::out);
|
||||||
file.write(reinterpret_cast<const char*>(spacePacketBuffer + ccsds::HEADER_LEN), packetLen - 1);
|
file.write(reinterpret_cast<const char*>(spacePacketBuffer + ccsds::HEADER_LEN), packetLen - 1);
|
||||||
@ -1979,7 +1981,7 @@ ReturnValue_t PlocSupervisorHandler::createMramDumpFile() {
|
|||||||
if (not std::filesystem::exists(std::string(currentMountPrefix + "/" + supervisorFilePath))) {
|
if (not std::filesystem::exists(std::string(currentMountPrefix + "/" + supervisorFilePath))) {
|
||||||
sif::warning << "PlocSupervisorHandler::createMramDumpFile: Supervisor path does not exist"
|
sif::warning << "PlocSupervisorHandler::createMramDumpFile: Supervisor path does not exist"
|
||||||
<< std::endl;
|
<< std::endl;
|
||||||
return SupvReturnValuesIF::PATH_DOES_NOT_EXIST;
|
return result::PATH_DOES_NOT_EXIST;
|
||||||
}
|
}
|
||||||
activeMramFile = currentMountPrefix + "/" + supervisorFilePath + "/" + filename;
|
activeMramFile = currentMountPrefix + "/" + supervisorFilePath + "/" + filename;
|
||||||
// Create new file
|
// Create new file
|
||||||
@ -1995,7 +1997,7 @@ ReturnValue_t PlocSupervisorHandler::getTimeStampString(std::string& timeStamp)
|
|||||||
if (result != returnvalue::OK) {
|
if (result != returnvalue::OK) {
|
||||||
sif::warning << "PlocSupervisorHandler::getTimeStampString: Failed to get current time"
|
sif::warning << "PlocSupervisorHandler::getTimeStampString: Failed to get current time"
|
||||||
<< std::endl;
|
<< std::endl;
|
||||||
return SupvReturnValuesIF::GET_TIME_FAILURE;
|
return result::GET_TIME_FAILURE;
|
||||||
}
|
}
|
||||||
timeStamp = std::to_string(time.year) + "-" + std::to_string(time.month) + "-" +
|
timeStamp = std::to_string(time.year) + "-" + std::to_string(time.month) + "-" +
|
||||||
std::to_string(time.day) + "--" + std::to_string(time.hour) + "-" +
|
std::to_string(time.day) + "--" + std::to_string(time.hour) + "-" +
|
||||||
@ -2010,7 +2012,7 @@ ReturnValue_t PlocSupervisorHandler::extractUpdateCommand(const uint8_t* command
|
|||||||
sizeof(params.startAddr) + sizeof(params.bytesWritten) + sizeof(params.seqCount) +
|
sizeof(params.startAddr) + sizeof(params.bytesWritten) + sizeof(params.seqCount) +
|
||||||
sizeof(uint8_t)) {
|
sizeof(uint8_t)) {
|
||||||
sif::warning << "PlocSupervisorHandler::extractUpdateCommand: Data size too big" << std::endl;
|
sif::warning << "PlocSupervisorHandler::extractUpdateCommand: Data size too big" << std::endl;
|
||||||
return SupvReturnValuesIF::INVALID_LENGTH;
|
return result::INVALID_LENGTH;
|
||||||
}
|
}
|
||||||
ReturnValue_t result = returnvalue::OK;
|
ReturnValue_t result = returnvalue::OK;
|
||||||
result = extractBaseParams(&commandData, size, params);
|
result = extractBaseParams(&commandData, size, params);
|
||||||
@ -2059,7 +2061,7 @@ ReturnValue_t PlocSupervisorHandler::extractBaseParams(const uint8_t** commandDa
|
|||||||
params.file = std::string(reinterpret_cast<const char*>(*commandData));
|
params.file = std::string(reinterpret_cast<const char*>(*commandData));
|
||||||
if (params.file.size() > (config::MAX_FILENAME_SIZE + config::MAX_PATH_SIZE)) {
|
if (params.file.size() > (config::MAX_FILENAME_SIZE + config::MAX_PATH_SIZE)) {
|
||||||
sif::warning << "PlocSupervisorHandler::extractUpdateCommand: Filename too long" << std::endl;
|
sif::warning << "PlocSupervisorHandler::extractUpdateCommand: Filename too long" << std::endl;
|
||||||
return SupvReturnValuesIF::FILENAME_TOO_LONG;
|
return result::FILENAME_TOO_LONG;
|
||||||
}
|
}
|
||||||
*commandData += params.file.size() + SIZE_NULL_TERMINATOR;
|
*commandData += params.file.size() + SIZE_NULL_TERMINATOR;
|
||||||
remSize -= (params.file.size() + SIZE_NULL_TERMINATOR);
|
remSize -= (params.file.size() + SIZE_NULL_TERMINATOR);
|
||||||
@ -2158,7 +2160,7 @@ void PlocSupervisorHandler::handleExecutionFailureReport(uint16_t statusCode) {
|
|||||||
if (commandId != DeviceHandlerIF::NO_COMMAND_ID) {
|
if (commandId != DeviceHandlerIF::NO_COMMAND_ID) {
|
||||||
triggerEvent(SUPV_EXE_FAILURE, commandId, static_cast<uint32_t>(statusCode));
|
triggerEvent(SUPV_EXE_FAILURE, commandId, static_cast<uint32_t>(statusCode));
|
||||||
}
|
}
|
||||||
sendFailureReport(EXE_REPORT, SupvReturnValuesIF::RECEIVED_EXE_FAILURE);
|
sendFailureReport(EXE_REPORT, result::RECEIVED_EXE_FAILURE);
|
||||||
disableExeReportReply();
|
disableExeReportReply();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -12,7 +12,6 @@
|
|||||||
#include "fsfw_hal/linux/gpio/LinuxLibgpioIF.h"
|
#include "fsfw_hal/linux/gpio/LinuxLibgpioIF.h"
|
||||||
#include "fsfw_hal/linux/uart/UartComIF.h"
|
#include "fsfw_hal/linux/uart/UartComIF.h"
|
||||||
#include "linux/devices/devicedefinitions/PlocSupervisorDefinitions.h"
|
#include "linux/devices/devicedefinitions/PlocSupervisorDefinitions.h"
|
||||||
#include "linux/devices/devicedefinitions/SupvReturnValuesIF.h"
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief This is the device handler for the supervisor of the PLOC which is programmed by
|
* @brief This is the device handler for the supervisor of the PLOC which is programmed by
|
||||||
|
Loading…
Reference in New Issue
Block a user