implemeted ICD changes

This commit is contained in:
Jakob Meier 2022-04-11 16:52:50 +02:00
parent b440fc3df6
commit 05a85ab8a1
3 changed files with 280 additions and 181 deletions

View File

@ -7,6 +7,7 @@
#include <fsfw/serialize/SerializeAdapter.h> #include <fsfw/serialize/SerializeAdapter.h>
#include <fsfw/timemanager/Clock.h> #include <fsfw/timemanager/Clock.h>
#include <fsfw/tmtcpacket/SpacePacket.h> #include <fsfw/tmtcpacket/SpacePacket.h>
#include "linux/devices/devicedefinitions/SupvReturnValuesIF.h" #include "linux/devices/devicedefinitions/SupvReturnValuesIF.h"
namespace supv { namespace supv {
@ -54,12 +55,13 @@ static const DeviceCommandId_t REQUEST_LOGGING_DATA = 38;
static const DeviceCommandId_t FACTORY_RESET_CLEAR_MIRROR = 40; static const DeviceCommandId_t FACTORY_RESET_CLEAR_MIRROR = 40;
static const DeviceCommandId_t FACTORY_RESET_CLEAR_CIRCULAR = 41; static const DeviceCommandId_t FACTORY_RESET_CLEAR_CIRCULAR = 41;
static const DeviceCommandId_t CONSECUTIVE_MRAM_DUMP = 43; static const DeviceCommandId_t CONSECUTIVE_MRAM_DUMP = 43;
static const DeviceCommandId_t PREPARE_UPDATE = 44;
static const DeviceCommandId_t START_MPSOC_QUIET = 45; static const DeviceCommandId_t START_MPSOC_QUIET = 45;
static const DeviceCommandId_t SET_SHUTDOWN_TIMEOUT = 46; static const DeviceCommandId_t SET_SHUTDOWN_TIMEOUT = 46;
static const DeviceCommandId_t FACTORY_FLASH = 47; static const DeviceCommandId_t FACTORY_FLASH = 47;
static const DeviceCommandId_t PERFORM_UPDATE = 48; static const DeviceCommandId_t PERFORM_UPDATE = 48;
static const DeviceCommandId_t TERMINATE_SUPV_HELPER = 49; static const DeviceCommandId_t TERMINATE_SUPV_HELPER = 49;
static const DeviceCommandId_t ENABLE_AUTO_TM = 50;
static const DeviceCommandId_t DISABLE_AUTO_TM = 51;
/** Reply IDs */ /** Reply IDs */
static const DeviceCommandId_t ACK_REPORT = 50; static const DeviceCommandId_t ACK_REPORT = 50;
@ -70,8 +72,7 @@ static const DeviceCommandId_t LATCHUP_REPORT = 54;
static const uint16_t SIZE_ACK_REPORT = 14; static const uint16_t SIZE_ACK_REPORT = 14;
static const uint16_t SIZE_EXE_REPORT = 14; static const uint16_t SIZE_EXE_REPORT = 14;
// static const uint16_t SIZE_HK_REPORT = 52; static const uint16_t SIZE_HK_REPORT = 52;
static const uint16_t SIZE_HK_REPORT = 56;
static const uint16_t SIZE_BOOT_STATUS_REPORT = 24; static const uint16_t SIZE_BOOT_STATUS_REPORT = 24;
static const uint16_t SIZE_LATCHUP_STATUS_REPORT = 31; static const uint16_t SIZE_LATCHUP_STATUS_REPORT = 31;
@ -115,6 +116,7 @@ static const uint16_t APID_WTD_ENABLE = 0xC0;
static const uint16_t APID_WTD_CONFIG_TIMEOUT = 0xC1; static const uint16_t APID_WTD_CONFIG_TIMEOUT = 0xC1;
static const uint16_t APID_SET_TIME_REF = 0xC2; static const uint16_t APID_SET_TIME_REF = 0xC2;
static const uint16_t APID_DISABLE_HK = 0xC3; static const uint16_t APID_DISABLE_HK = 0xC3;
static const uint16_t APID_AUTO_TM = 0xC5;
static const uint16_t APID_ENABLE_LATCHUP_ALERT = 0xD0; static const uint16_t APID_ENABLE_LATCHUP_ALERT = 0xD0;
static const uint16_t APID_DISABLE_LATCHUP_ALERT = 0xD1; static const uint16_t APID_DISABLE_LATCHUP_ALERT = 0xD1;
static const uint16_t APID_AUTO_CALIBRATE_ALERT = 0xD2; static const uint16_t APID_AUTO_CALIBRATE_ALERT = 0xD2;
@ -173,7 +175,7 @@ enum PoolIds : lp_id_t {
NUM_TMS, NUM_TMS,
TEMP_PS, TEMP_PS,
TEMP_PL, TEMP_PL,
SOC_STATE, HK_SOC_STATE,
NVM0_1_STATE, NVM0_1_STATE,
NVM3_STATE, NVM3_STATE,
MISSION_IO_STATE, MISSION_IO_STATE,
@ -183,8 +185,8 @@ enum PoolIds : lp_id_t {
UPTIME, UPTIME,
CPULOAD, CPULOAD,
AVAILABLEHEAP, AVAILABLEHEAP,
BOOT_SIGNAL, BR_SOC_STATE,
RESET_COUNTER, POWER_CYCLES,
BOOT_AFTER_MS, BOOT_AFTER_MS,
BOOT_TIMEOUT_MS, BOOT_TIMEOUT_MS,
ACTIVE_NVM, ACTIVE_NVM,
@ -209,7 +211,7 @@ enum PoolIds : lp_id_t {
LATCHUP_RPT_TIME_MON, LATCHUP_RPT_TIME_MON,
LATCHUP_RPT_TIME_YEAR, LATCHUP_RPT_TIME_YEAR,
LATCHUP_RPT_TIME_MSEC, LATCHUP_RPT_TIME_MSEC,
LATCHUP_RPT_TIME_USEC, LATCHUP_RPT_IS_SET,
}; };
static const uint8_t HK_SET_ENTRIES = 13; static const uint8_t HK_SET_ENTRIES = 13;
@ -338,8 +340,8 @@ class SetTimeRef : public SpacePacket {
sizeof(time->minute), SerializeIF::Endianness::BIG); sizeof(time->minute), SerializeIF::Endianness::BIG);
uint8_t hour = static_cast<uint8_t>(time->hour); uint8_t hour = static_cast<uint8_t>(time->hour);
serializedSize = 0; serializedSize = 0;
SerializeAdapter::serialize<uint8_t>(&hour, &dataFieldPtr, &serializedSize, SerializeAdapter::serialize<uint8_t>(&hour, &dataFieldPtr, &serializedSize, sizeof(time->hour),
sizeof(time->hour), SerializeIF::Endianness::BIG); SerializeIF::Endianness::BIG);
uint8_t day = static_cast<uint8_t>(time->day); uint8_t day = static_cast<uint8_t>(time->day);
serializedSize = 0; serializedSize = 0;
SerializeAdapter::serialize<uint8_t>(&day, &dataFieldPtr, &serializedSize, sizeof(time->day), SerializeAdapter::serialize<uint8_t>(&day, &dataFieldPtr, &serializedSize, sizeof(time->day),
@ -350,8 +352,8 @@ class SetTimeRef : public SpacePacket {
sizeof(time->month), SerializeIF::Endianness::BIG); sizeof(time->month), SerializeIF::Endianness::BIG);
uint8_t year = static_cast<uint8_t>(time->year - 1900); uint8_t year = static_cast<uint8_t>(time->year - 1900);
serializedSize = 0; serializedSize = 0;
SerializeAdapter::serialize<uint8_t>(&year, &dataFieldPtr, &serializedSize, SerializeAdapter::serialize<uint8_t>(&year, &dataFieldPtr, &serializedSize, sizeof(time->year),
sizeof(time->year), SerializeIF::Endianness::BIG); SerializeIF::Endianness::BIG);
serializedSize = 0; serializedSize = 0;
/* Calculate crc */ /* Calculate crc */
uint16_t crc = CRC::crc16ccitt(this->localData.byteStream, uint16_t crc = CRC::crc16ccitt(this->localData.byteStream,
@ -385,8 +387,8 @@ class SetBootTimeout : public SpacePacket {
void initPacket() { void initPacket() {
size_t serializedSize = 0; size_t serializedSize = 0;
uint8_t* dataFieldPtr = this->localData.fields.buffer; uint8_t* dataFieldPtr = this->localData.fields.buffer;
SerializeAdapter::serialize<uint32_t>(&timeout, &dataFieldPtr, &serializedSize, SerializeAdapter::serialize<uint32_t>(&timeout, &dataFieldPtr, &serializedSize, sizeof(timeout),
sizeof(timeout), SerializeIF::Endianness::BIG); SerializeIF::Endianness::BIG);
/* Calculate crc */ /* Calculate crc */
uint16_t crc = CRC::crc16ccitt(this->localData.byteStream, uint16_t crc = CRC::crc16ccitt(this->localData.byteStream,
sizeof(CCSDSPrimaryHeader) + DATA_FIELD_LENGTH - 2); sizeof(CCSDSPrimaryHeader) + DATA_FIELD_LENGTH - 2);
@ -547,8 +549,8 @@ class WatchdogsConfigTimeout : public SpacePacket {
SerializeAdapter::serialize<uint8_t>(&watchdog, &dataFieldPtr, &serializedSize, SerializeAdapter::serialize<uint8_t>(&watchdog, &dataFieldPtr, &serializedSize,
sizeof(watchdog), SerializeIF::Endianness::BIG); sizeof(watchdog), SerializeIF::Endianness::BIG);
serializedSize = 0; serializedSize = 0;
SerializeAdapter::serialize<uint32_t>(&timeout, &dataFieldPtr, &serializedSize, SerializeAdapter::serialize<uint32_t>(&timeout, &dataFieldPtr, &serializedSize, sizeof(timeout),
sizeof(timeout), SerializeIF::Endianness::BIG); SerializeIF::Endianness::BIG);
serializedSize = 0; serializedSize = 0;
uint16_t crc = CRC::crc16ccitt(this->localData.byteStream, uint16_t crc = CRC::crc16ccitt(this->localData.byteStream,
sizeof(CCSDSPrimaryHeader) + DATA_FIELD_LENGTH - 2); sizeof(CCSDSPrimaryHeader) + DATA_FIELD_LENGTH - 2);
@ -1308,38 +1310,14 @@ class FactoryReset : public SpacePacket {
} }
}; };
class SetShutdownTimeout : public SpacePacket {
public:
SetShutdownTimeout(uint32_t timeout)
: SpacePacket(0, true, APID_SET_SHUTDOWN_TIMEOUT, DEFAULT_SEQUENCE_COUNT), timeout(timeout) {
initPacket();
}
private:
uint16_t PACKET_LEN = 1; // uint32_t timeout + CRC - 1
static const uint16_t DEFAULT_SEQUENCE_COUNT = 1;
uint32_t timeout = 0;
uint8_t crcOffset = 0;
void initPacket() {
uint8_t* dataFieldPtr = this->localData.fields.buffer;
size_t serializedSize = 0;
SerializeAdapter::serialize<uint32_t>(&timeout, dataFieldPtr, &serializedSize,
sizeof(timeout), SerializeIF::Endianness::BIG);
this->setPacketDataLength(PACKET_LEN);
serializedSize = 0;
uint16_t crc =
CRC::crc16ccitt(this->localData.byteStream, sizeof(CCSDSPrimaryHeader) + PACKET_LEN - 1);
uint8_t* crcPos = this->localData.fields.buffer + crcOffset;
SerializeAdapter::serialize<uint16_t>(&crc, &crcPos, &serializedSize, sizeof(crc),
SerializeIF::Endianness::BIG);
}
};
class SupvTcSpacePacket : public SpacePacket { class SupvTcSpacePacket : public SpacePacket {
public: public:
SupvTcSpacePacket(size_t payloadDataLen, uint16_t apid) /**
* @brief Constructor
*
* @param payloadDataLen Length of data field without CRC
*/
SupvTcSpacePacket(uint16_t payloadDataLen, uint16_t apid)
: SpacePacket(payloadDataLen + 1, true, apid, DEFAULT_SEQUENCE_COUNT), : SpacePacket(payloadDataLen + 1, true, apid, DEFAULT_SEQUENCE_COUNT),
payloadDataLen(payloadDataLen) {} payloadDataLen(payloadDataLen) {}
@ -1360,6 +1338,27 @@ class SupvTcSpacePacket : public SpacePacket {
size_t payloadDataLen = 0; size_t payloadDataLen = 0;
}; };
class SetShutdownTimeout : public SupvTcSpacePacket {
public:
SetShutdownTimeout(uint32_t timeout)
: SupvTcSpacePacket(PACKET_LEN, APID_SET_SHUTDOWN_TIMEOUT), timeout(timeout) {
initPacket();
makeCrc();
}
private:
static const uint16_t PACKET_LEN = 4; // uint32_t timeout
uint32_t timeout = 0;
void initPacket() {
uint8_t* dataFieldPtr = this->localData.fields.buffer;
size_t serializedSize = 0;
SerializeAdapter::serialize<uint32_t>(&timeout, dataFieldPtr, &serializedSize, sizeof(timeout),
SerializeIF::Endianness::BIG);
}
};
/** /**
* @brief Command to request CRC over memory region of the supervisor. * @brief Command to request CRC over memory region of the supervisor.
*/ */
@ -1392,8 +1391,8 @@ class CheckMemory : public SupvTcSpacePacket {
void initPacket() { void initPacket() {
size_t serializedSize = 0; size_t serializedSize = 0;
uint8_t* dataFieldPtr = this->localData.fields.buffer; uint8_t* dataFieldPtr = this->localData.fields.buffer;
SerializeAdapter::serialize<uint8_t>(&memoryId, &dataFieldPtr, &serializedSize, sizeof(memoryId), SerializeAdapter::serialize<uint8_t>(&memoryId, &dataFieldPtr, &serializedSize,
SerializeIF::Endianness::BIG); sizeof(memoryId), SerializeIF::Endianness::BIG);
serializedSize = 0; serializedSize = 0;
SerializeAdapter::serialize<uint8_t>(&n, &dataFieldPtr, &serializedSize, sizeof(n), SerializeAdapter::serialize<uint8_t>(&n, &dataFieldPtr, &serializedSize, sizeof(n),
SerializeIF::Endianness::BIG); SerializeIF::Endianness::BIG);
@ -1401,8 +1400,8 @@ class CheckMemory : public SupvTcSpacePacket {
SerializeAdapter::serialize<uint32_t>(&startAddress, &dataFieldPtr, &serializedSize, SerializeAdapter::serialize<uint32_t>(&startAddress, &dataFieldPtr, &serializedSize,
sizeof(startAddress), SerializeIF::Endianness::BIG); sizeof(startAddress), SerializeIF::Endianness::BIG);
serializedSize = 0; serializedSize = 0;
SerializeAdapter::serialize<uint32_t>(&length, &dataFieldPtr, &serializedSize, SerializeAdapter::serialize<uint32_t>(&length, &dataFieldPtr, &serializedSize, sizeof(length),
sizeof(length), SerializeIF::Endianness::BIG); SerializeIF::Endianness::BIG);
} }
}; };
@ -1469,109 +1468,6 @@ class WriteMemory : public SupvTcSpacePacket {
} }
}; };
/**
* @brief This dataset stores the boot status report of the supervisor.
*/
class BootStatusReport : public StaticLocalDataSet<BOOT_REPORT_SET_ENTRIES> {
public:
BootStatusReport(HasLocalDataPoolIF* owner) : StaticLocalDataSet(owner, BOOT_REPORT_SET_ID) {}
BootStatusReport(object_id_t objectId)
: StaticLocalDataSet(sid_t(objectId, BOOT_REPORT_SET_ID)) {}
/** Information about boot status of MPSoC */
lp_var_t<uint8_t> bootSignal = lp_var_t<uint8_t>(sid.objectId, PoolIds::BOOT_SIGNAL, this);
lp_var_t<uint8_t> resetCounter = lp_var_t<uint8_t>(sid.objectId, PoolIds::RESET_COUNTER, this);
/** Time the MPSoC needs for last boot */
lp_var_t<uint32_t> bootAfterMs = lp_var_t<uint32_t>(sid.objectId, PoolIds::BOOT_AFTER_MS, this);
/** The currently set boot timeout */
lp_var_t<uint32_t> bootTimeoutMs =
lp_var_t<uint32_t>(sid.objectId, PoolIds::BOOT_TIMEOUT_MS, this);
lp_var_t<uint8_t> activeNvm = lp_var_t<uint8_t>(sid.objectId, PoolIds::ACTIVE_NVM, this);
/** States of the boot partition pins */
lp_var_t<uint8_t> bp0State = lp_var_t<uint8_t>(sid.objectId, PoolIds::BP0_STATE, this);
lp_var_t<uint8_t> bp1State = lp_var_t<uint8_t>(sid.objectId, PoolIds::BP1_STATE, this);
lp_var_t<uint8_t> bp2State = lp_var_t<uint8_t>(sid.objectId, PoolIds::BP2_STATE, this);
lp_var_t<uint8_t> bootState = lp_var_t<uint8_t>(sid.objectId, PoolIds::BOOT_STATE, this);
lp_var_t<uint8_t> bootCycles = lp_var_t<uint8_t>(sid.objectId, PoolIds::BOOT_CYCLES, this);
};
/**
* @brief This dataset stores the housekeeping data of the supervisor.
*/
class HkSet : public StaticLocalDataSet<HK_SET_ENTRIES> {
public:
HkSet(HasLocalDataPoolIF* owner) : StaticLocalDataSet(owner, HK_SET_ID) {}
HkSet(object_id_t objectId) : StaticLocalDataSet(sid_t(objectId, HK_SET_ID)) {}
lp_var_t<uint32_t> tempPs = lp_var_t<uint32_t>(sid.objectId, PoolIds::TEMP_PS, this);
lp_var_t<uint32_t> tempPl = lp_var_t<uint32_t>(sid.objectId, PoolIds::TEMP_PS, this);
lp_var_t<uint32_t> tempSup = lp_var_t<uint32_t>(sid.objectId, PoolIds::TEMP_SUP, this);
lp_var_t<uint64_t> uptime = lp_var_t<uint64_t>(sid.objectId, PoolIds::UPTIME, this);
lp_var_t<uint32_t> cpuLoad = lp_var_t<uint32_t>(sid.objectId, PoolIds::CPULOAD, this);
lp_var_t<uint32_t> availableHeap = lp_var_t<uint32_t>(sid.objectId, PoolIds::AVAILABLEHEAP, this);
lp_var_t<uint32_t> numTcs = lp_var_t<uint32_t>(sid.objectId, PoolIds::NUM_TCS, this);
lp_var_t<uint32_t> numTms = lp_var_t<uint32_t>(sid.objectId, PoolIds::NUM_TMS, this);
lp_var_t<uint32_t> socState = lp_var_t<uint32_t>(sid.objectId, PoolIds::SOC_STATE, this);
lp_var_t<uint8_t> nvm0_1_state = lp_var_t<uint8_t>(sid.objectId, PoolIds::NVM0_1_STATE, this);
lp_var_t<uint8_t> nvm3_state = lp_var_t<uint8_t>(sid.objectId, PoolIds::NVM3_STATE, this);
lp_var_t<uint8_t> missionIoState =
lp_var_t<uint8_t>(sid.objectId, PoolIds::MISSION_IO_STATE, this);
lp_var_t<uint8_t> fmcState = lp_var_t<uint8_t>(sid.objectId, PoolIds::FMC_STATE, this);
};
/**
* @brief This dataset stores the last requested latchup status report.
*/
class LatchupStatusReport : public StaticLocalDataSet<LATCHUP_RPT_SET_ENTRIES> {
public:
LatchupStatusReport(HasLocalDataPoolIF* owner) : StaticLocalDataSet(owner, LATCHUP_RPT_ID) {}
LatchupStatusReport(object_id_t objectId) : StaticLocalDataSet(sid_t(objectId, LATCHUP_RPT_ID)) {}
lp_var_t<uint8_t> id = lp_var_t<uint8_t>(sid.objectId, PoolIds::LATCHUP_ID, this);
lp_var_t<uint16_t> cnt0 = lp_var_t<uint16_t>(sid.objectId, PoolIds::CNT0, this);
lp_var_t<uint16_t> cnt1 = lp_var_t<uint16_t>(sid.objectId, PoolIds::CNT1, this);
lp_var_t<uint16_t> cnt2 = lp_var_t<uint16_t>(sid.objectId, PoolIds::CNT2, this);
lp_var_t<uint16_t> cnt3 = lp_var_t<uint16_t>(sid.objectId, PoolIds::CNT3, this);
lp_var_t<uint16_t> cnt4 = lp_var_t<uint16_t>(sid.objectId, PoolIds::CNT4, this);
lp_var_t<uint16_t> cnt5 = lp_var_t<uint16_t>(sid.objectId, PoolIds::CNT5, this);
lp_var_t<uint16_t> cnt6 = lp_var_t<uint16_t>(sid.objectId, PoolIds::CNT6, this);
lp_var_t<uint16_t> timeMsec =
lp_var_t<uint16_t>(sid.objectId, PoolIds::LATCHUP_RPT_TIME_MSEC, this);
lp_var_t<uint8_t> timeSec = lp_var_t<uint8_t>(sid.objectId, PoolIds::LATCHUP_RPT_TIME_SEC, this);
lp_var_t<uint8_t> timeMin = lp_var_t<uint8_t>(sid.objectId, PoolIds::LATCHUP_RPT_TIME_MIN, this);
lp_var_t<uint8_t> timeHour =
lp_var_t<uint8_t>(sid.objectId, PoolIds::LATCHUP_RPT_TIME_HOUR, this);
lp_var_t<uint8_t> timeDay = lp_var_t<uint8_t>(sid.objectId, PoolIds::LATCHUP_RPT_TIME_DAY, this);
lp_var_t<uint8_t> timeMon = lp_var_t<uint8_t>(sid.objectId, PoolIds::LATCHUP_RPT_TIME_MON, this);
lp_var_t<uint8_t> timeYear =
lp_var_t<uint8_t>(sid.objectId, PoolIds::LATCHUP_RPT_TIME_YEAR, this);
};
/**
* @brief Class for handling tm replies of the supervisor.
*/
class TmPacket : public SpacePacket {
public:
/**
* @brief Constructor creates idle packet and sets length field to maximum allowed size.
*/
TmPacket() : SpacePacket(PACKET_MAX_SIZE) {}
ReturnValue_t checkCrc() {
uint8_t* crcPtr = this->getPacketData() + this->getPacketDataLength() - 1;
uint16_t receivedCrc = *(crcPtr) << 8 | *(crcPtr + 1);
uint16_t recalculatedCrc =
CRC::crc16ccitt(this->localData.byteStream, this->getFullSize() - CRC_SIZE);
if (recalculatedCrc != receivedCrc) {
return SupvReturnValuesIF::CRC_FAILURE;
}
return HasReturnvaluesIF::RETURN_OK;
}
};
/** /**
* @brief This class can be used to package the update available or update verify command. * @brief This class can be used to package the update available or update verify command.
*/ */
@ -1611,6 +1507,142 @@ class EraseMemory : public SupvTcSpacePacket {
} }
}; };
/**
* @brief This class creates the space packet to enable the auto TM generation
*/
class EnableAutoTm : public SupvTcSpacePacket {
public:
EnableAutoTm() : SupvTcSpacePacket(PAYLOAD_LENGTH, APID_AUTO_TM) {
*(this->localData.fields.buffer) = ENABLE;
makeCrc();
}
private:
static const uint16_t PAYLOAD_LENGTH = 1; // length without CRC field
static const uint8_t ENABLE = 1;
};
/**
* @brief This class creates the space packet to disable the auto TM generation
*/
class DisableAutoTm : public SupvTcSpacePacket {
public:
DisableAutoTm() : SupvTcSpacePacket(PAYLOAD_LENGTH, APID_AUTO_TM) {
*(this->localData.fields.buffer) = DISABLE;
makeCrc();
}
private:
static const uint16_t PAYLOAD_LENGTH = 1; // length without CRC field
static const uint8_t DISABLE = 0;
};
/**
* @brief Class for handling tm replies of the supervisor.
*/
class TmPacket : public SpacePacket {
public:
/**
* @brief Constructor creates idle packet and sets length field to maximum allowed size.
*/
TmPacket() : SpacePacket(PACKET_MAX_SIZE) {}
ReturnValue_t checkCrc() {
uint8_t* crcPtr = this->getPacketData() + this->getPacketDataLength() - 1;
uint16_t receivedCrc = *(crcPtr) << 8 | *(crcPtr + 1);
uint16_t recalculatedCrc =
CRC::crc16ccitt(this->localData.byteStream, this->getFullSize() - CRC_SIZE);
if (recalculatedCrc != receivedCrc) {
return SupvReturnValuesIF::CRC_FAILURE;
}
return HasReturnvaluesIF::RETURN_OK;
}
};
/**
* @brief This dataset stores the boot status report of the supervisor.
*/
class BootStatusReport : public StaticLocalDataSet<BOOT_REPORT_SET_ENTRIES> {
public:
BootStatusReport(HasLocalDataPoolIF* owner) : StaticLocalDataSet(owner, BOOT_REPORT_SET_ID) {}
BootStatusReport(object_id_t objectId)
: StaticLocalDataSet(sid_t(objectId, BOOT_REPORT_SET_ID)) {}
/** Information about boot status of MPSoC */
lp_var_t<uint8_t> socState = lp_var_t<uint8_t>(sid.objectId, PoolIds::BR_SOC_STATE, this);
lp_var_t<uint8_t> powerCycles = lp_var_t<uint8_t>(sid.objectId, PoolIds::POWER_CYCLES, this);
/** Time the MPSoC needs for last boot */
lp_var_t<uint32_t> bootAfterMs = lp_var_t<uint32_t>(sid.objectId, PoolIds::BOOT_AFTER_MS, this);
/** The currently set boot timeout */
lp_var_t<uint32_t> bootTimeoutMs =
lp_var_t<uint32_t>(sid.objectId, PoolIds::BOOT_TIMEOUT_MS, this);
lp_var_t<uint8_t> activeNvm = lp_var_t<uint8_t>(sid.objectId, PoolIds::ACTIVE_NVM, this);
/** States of the boot partition pins */
lp_var_t<uint8_t> bp0State = lp_var_t<uint8_t>(sid.objectId, PoolIds::BP0_STATE, this);
lp_var_t<uint8_t> bp1State = lp_var_t<uint8_t>(sid.objectId, PoolIds::BP1_STATE, this);
lp_var_t<uint8_t> bp2State = lp_var_t<uint8_t>(sid.objectId, PoolIds::BP2_STATE, this);
lp_var_t<uint8_t> bootState = lp_var_t<uint8_t>(sid.objectId, PoolIds::BOOT_STATE, this);
lp_var_t<uint8_t> bootCycles = lp_var_t<uint8_t>(sid.objectId, PoolIds::BOOT_CYCLES, this);
};
/**
* @brief This dataset stores the housekeeping data of the supervisor.
*/
class HkSet : public StaticLocalDataSet<HK_SET_ENTRIES> {
public:
HkSet(HasLocalDataPoolIF* owner) : StaticLocalDataSet(owner, HK_SET_ID) {}
HkSet(object_id_t objectId) : StaticLocalDataSet(sid_t(objectId, HK_SET_ID)) {}
lp_var_t<uint32_t> tempPs = lp_var_t<uint32_t>(sid.objectId, PoolIds::TEMP_PS, this);
lp_var_t<uint32_t> tempPl = lp_var_t<uint32_t>(sid.objectId, PoolIds::TEMP_PS, this);
lp_var_t<uint32_t> tempSup = lp_var_t<uint32_t>(sid.objectId, PoolIds::TEMP_SUP, this);
lp_var_t<uint64_t> uptime = lp_var_t<uint64_t>(sid.objectId, PoolIds::UPTIME, this);
lp_var_t<uint32_t> cpuLoad = lp_var_t<uint32_t>(sid.objectId, PoolIds::CPULOAD, this);
lp_var_t<uint32_t> availableHeap = lp_var_t<uint32_t>(sid.objectId, PoolIds::AVAILABLEHEAP, this);
lp_var_t<uint32_t> numTcs = lp_var_t<uint32_t>(sid.objectId, PoolIds::NUM_TCS, this);
lp_var_t<uint32_t> numTms = lp_var_t<uint32_t>(sid.objectId, PoolIds::NUM_TMS, this);
lp_var_t<uint32_t> socState = lp_var_t<uint32_t>(sid.objectId, PoolIds::HK_SOC_STATE, this);
lp_var_t<uint8_t> nvm0_1_state = lp_var_t<uint8_t>(sid.objectId, PoolIds::NVM0_1_STATE, this);
lp_var_t<uint8_t> nvm3_state = lp_var_t<uint8_t>(sid.objectId, PoolIds::NVM3_STATE, this);
lp_var_t<uint8_t> missionIoState =
lp_var_t<uint8_t>(sid.objectId, PoolIds::MISSION_IO_STATE, this);
lp_var_t<uint8_t> fmcState = lp_var_t<uint8_t>(sid.objectId, PoolIds::FMC_STATE, this);
};
/**
* @brief This dataset stores the last requested latchup status report.
*/
class LatchupStatusReport : public StaticLocalDataSet<LATCHUP_RPT_SET_ENTRIES> {
public:
LatchupStatusReport(HasLocalDataPoolIF* owner) : StaticLocalDataSet(owner, LATCHUP_RPT_ID) {}
LatchupStatusReport(object_id_t objectId) : StaticLocalDataSet(sid_t(objectId, LATCHUP_RPT_ID)) {}
lp_var_t<uint8_t> id = lp_var_t<uint8_t>(sid.objectId, PoolIds::LATCHUP_ID, this);
lp_var_t<uint16_t> cnt0 = lp_var_t<uint16_t>(sid.objectId, PoolIds::CNT0, this);
lp_var_t<uint16_t> cnt1 = lp_var_t<uint16_t>(sid.objectId, PoolIds::CNT1, this);
lp_var_t<uint16_t> cnt2 = lp_var_t<uint16_t>(sid.objectId, PoolIds::CNT2, this);
lp_var_t<uint16_t> cnt3 = lp_var_t<uint16_t>(sid.objectId, PoolIds::CNT3, this);
lp_var_t<uint16_t> cnt4 = lp_var_t<uint16_t>(sid.objectId, PoolIds::CNT4, this);
lp_var_t<uint16_t> cnt5 = lp_var_t<uint16_t>(sid.objectId, PoolIds::CNT5, this);
lp_var_t<uint16_t> cnt6 = lp_var_t<uint16_t>(sid.objectId, PoolIds::CNT6, this);
lp_var_t<uint16_t> timeMsec =
lp_var_t<uint16_t>(sid.objectId, PoolIds::LATCHUP_RPT_TIME_MSEC, this);
lp_var_t<uint8_t> timeSec = lp_var_t<uint8_t>(sid.objectId, PoolIds::LATCHUP_RPT_TIME_SEC, this);
lp_var_t<uint8_t> timeMin = lp_var_t<uint8_t>(sid.objectId, PoolIds::LATCHUP_RPT_TIME_MIN, this);
lp_var_t<uint8_t> timeHour =
lp_var_t<uint8_t>(sid.objectId, PoolIds::LATCHUP_RPT_TIME_HOUR, this);
lp_var_t<uint8_t> timeDay = lp_var_t<uint8_t>(sid.objectId, PoolIds::LATCHUP_RPT_TIME_DAY, this);
lp_var_t<uint8_t> timeMon = lp_var_t<uint8_t>(sid.objectId, PoolIds::LATCHUP_RPT_TIME_MON, this);
lp_var_t<uint8_t> timeYear =
lp_var_t<uint8_t>(sid.objectId, PoolIds::LATCHUP_RPT_TIME_YEAR, this);
lp_var_t<uint8_t> isSet = lp_var_t<uint8_t>(sid.objectId, PoolIds::LATCHUP_RPT_IS_SET, this);
static const uint8_t IS_SET_BIT_POS = 15;
};
class UpdateStatusReport : public TmPacket { class UpdateStatusReport : public TmPacket {
public: public:
UpdateStatusReport() : TmPacket() {} UpdateStatusReport() : TmPacket() {}
@ -1639,19 +1671,15 @@ class UpdateStatusReport : public TmPacket {
} }
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 SupvReturnValuesIF::UPDATE_CRC_FAILURE;
} }
return HasReturnvaluesIF::RETURN_OK; return HasReturnvaluesIF::RETURN_OK;
} }
uint16_t getCrc() const { uint16_t getCrc() const { return crc; }
return crc;
}
uint16_t getNominalSize() const { uint16_t getNominalSize() const { return FULL_SIZE; }
return FULL_SIZE;
}
private: private:
// Nominal size of the space packet // Nominal size of the space packet

View File

@ -0,0 +1,59 @@
#ifndef SUPV_RETURN_VALUES_IF_H_
#define SUPV_RETURN_VALUES_IF_H_
#include "fsfw/returnvalues/HasReturnvaluesIF.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_ */

View File

@ -326,11 +326,6 @@ ReturnValue_t PlocSupervisorHandler::buildCommandFromCommand(DeviceCommandId_t d
result = RETURN_OK; result = RETURN_OK;
break; break;
} }
case (supv::PREPARE_UPDATE): {
prepareEmptyCmd(supv::APID_PREPARE_UPDATE);
result = RETURN_OK;
break;
}
case (supv::START_MPSOC_QUIET): { case (supv::START_MPSOC_QUIET): {
prepareEmptyCmd(supv::APID_START_MPSOC_QUIET); prepareEmptyCmd(supv::APID_START_MPSOC_QUIET);
result = RETURN_OK; result = RETURN_OK;
@ -346,6 +341,18 @@ ReturnValue_t PlocSupervisorHandler::buildCommandFromCommand(DeviceCommandId_t d
result = RETURN_OK; result = RETURN_OK;
break; break;
} }
case (supv::ENABLE_AUTO_TM): {
supv::EnableAutoTm packet;
packetToOutBuffer(packet.getWholeData(), packet.getFullSize());
result = RETURN_OK;
break;
}
case (supv::DISABLE_AUTO_TM): {
supv::DisableAutoTm packet;
packetToOutBuffer(packet.getWholeData(), packet.getFullSize());
result = RETURN_OK;
break;
}
default: default:
sif::debug << "PlocSupervisorHandler::buildCommandFromCommand: Command not implemented" sif::debug << "PlocSupervisorHandler::buildCommandFromCommand: Command not implemented"
<< std::endl; << std::endl;
@ -401,10 +408,11 @@ void PlocSupervisorHandler::fillCommandAndReplyMap() {
this->insertInCommandMap(supv::FACTORY_RESET_CLEAR_MIRROR); this->insertInCommandMap(supv::FACTORY_RESET_CLEAR_MIRROR);
this->insertInCommandMap(supv::FACTORY_RESET_CLEAR_CIRCULAR); this->insertInCommandMap(supv::FACTORY_RESET_CLEAR_CIRCULAR);
this->insertInCommandMap(supv::CAN_LOOPBACK_TEST); this->insertInCommandMap(supv::CAN_LOOPBACK_TEST);
this->insertInCommandMap(supv::PREPARE_UPDATE);
this->insertInCommandMap(supv::START_MPSOC_QUIET); this->insertInCommandMap(supv::START_MPSOC_QUIET);
this->insertInCommandMap(supv::SET_SHUTDOWN_TIMEOUT); this->insertInCommandMap(supv::SET_SHUTDOWN_TIMEOUT);
this->insertInCommandMap(supv::FACTORY_FLASH); this->insertInCommandMap(supv::FACTORY_FLASH);
this->insertInCommandMap(supv::ENABLE_AUTO_TM);
this->insertInCommandMap(supv::DISABLE_AUTO_TM);
this->insertInCommandAndReplyMap(supv::FIRST_MRAM_DUMP, 3); this->insertInCommandAndReplyMap(supv::FIRST_MRAM_DUMP, 3);
this->insertInCommandAndReplyMap(supv::CONSECUTIVE_MRAM_DUMP, 3); this->insertInCommandAndReplyMap(supv::CONSECUTIVE_MRAM_DUMP, 3);
this->insertInReplyMap(supv::ACK_REPORT, 3, nullptr, supv::SIZE_ACK_REPORT); this->insertInReplyMap(supv::ACK_REPORT, 3, nullptr, supv::SIZE_ACK_REPORT);
@ -527,7 +535,7 @@ ReturnValue_t PlocSupervisorHandler::initializeLocalDataPool(localpool::DataPool
localDataPoolMap.emplace(supv::NUM_TMS, new PoolEntry<uint32_t>({0})); localDataPoolMap.emplace(supv::NUM_TMS, new PoolEntry<uint32_t>({0}));
localDataPoolMap.emplace(supv::TEMP_PS, new PoolEntry<uint32_t>({0})); localDataPoolMap.emplace(supv::TEMP_PS, new PoolEntry<uint32_t>({0}));
localDataPoolMap.emplace(supv::TEMP_PL, new PoolEntry<uint32_t>({0})); localDataPoolMap.emplace(supv::TEMP_PL, new PoolEntry<uint32_t>({0}));
localDataPoolMap.emplace(supv::SOC_STATE, new PoolEntry<uint32_t>({0})); localDataPoolMap.emplace(supv::HK_SOC_STATE, new PoolEntry<uint32_t>({0}));
localDataPoolMap.emplace(supv::NVM0_1_STATE, new PoolEntry<uint8_t>({0})); localDataPoolMap.emplace(supv::NVM0_1_STATE, new PoolEntry<uint8_t>({0}));
localDataPoolMap.emplace(supv::NVM3_STATE, new PoolEntry<uint8_t>({0})); localDataPoolMap.emplace(supv::NVM3_STATE, new PoolEntry<uint8_t>({0}));
localDataPoolMap.emplace(supv::MISSION_IO_STATE, new PoolEntry<uint8_t>({0})); localDataPoolMap.emplace(supv::MISSION_IO_STATE, new PoolEntry<uint8_t>({0}));
@ -537,8 +545,8 @@ ReturnValue_t PlocSupervisorHandler::initializeLocalDataPool(localpool::DataPool
localDataPoolMap.emplace(supv::CPULOAD, new PoolEntry<uint32_t>({0})); localDataPoolMap.emplace(supv::CPULOAD, new PoolEntry<uint32_t>({0}));
localDataPoolMap.emplace(supv::AVAILABLEHEAP, new PoolEntry<uint32_t>({0})); localDataPoolMap.emplace(supv::AVAILABLEHEAP, new PoolEntry<uint32_t>({0}));
localDataPoolMap.emplace(supv::BOOT_SIGNAL, new PoolEntry<uint8_t>({0})); localDataPoolMap.emplace(supv::BR_SOC_STATE, new PoolEntry<uint8_t>({0}));
localDataPoolMap.emplace(supv::RESET_COUNTER, new PoolEntry<uint8_t>({0})); localDataPoolMap.emplace(supv::POWER_CYCLES, new PoolEntry<uint8_t>({0}));
localDataPoolMap.emplace(supv::BOOT_AFTER_MS, new PoolEntry<uint32_t>({0})); localDataPoolMap.emplace(supv::BOOT_AFTER_MS, new PoolEntry<uint32_t>({0}));
localDataPoolMap.emplace(supv::BOOT_TIMEOUT_MS, new PoolEntry<uint32_t>({0})); localDataPoolMap.emplace(supv::BOOT_TIMEOUT_MS, new PoolEntry<uint32_t>({0}));
localDataPoolMap.emplace(supv::ACTIVE_NVM, new PoolEntry<uint8_t>({0})); localDataPoolMap.emplace(supv::ACTIVE_NVM, new PoolEntry<uint8_t>({0}));
@ -561,6 +569,7 @@ ReturnValue_t PlocSupervisorHandler::initializeLocalDataPool(localpool::DataPool
localDataPoolMap.emplace(supv::LATCHUP_RPT_TIME_DAY, new PoolEntry<uint8_t>({0})); localDataPoolMap.emplace(supv::LATCHUP_RPT_TIME_DAY, new PoolEntry<uint8_t>({0}));
localDataPoolMap.emplace(supv::LATCHUP_RPT_TIME_MON, new PoolEntry<uint8_t>({0})); localDataPoolMap.emplace(supv::LATCHUP_RPT_TIME_MON, new PoolEntry<uint8_t>({0}));
localDataPoolMap.emplace(supv::LATCHUP_RPT_TIME_YEAR, new PoolEntry<uint8_t>({0})); localDataPoolMap.emplace(supv::LATCHUP_RPT_TIME_YEAR, new PoolEntry<uint8_t>({0}));
localDataPoolMap.emplace(supv::LATCHUP_RPT_IS_SET, new PoolEntry<uint8_t>({0}));
return HasReturnvaluesIF::RETURN_OK; return HasReturnvaluesIF::RETURN_OK;
} }
@ -672,10 +681,11 @@ ReturnValue_t PlocSupervisorHandler::enableReplyInReplyMap(DeviceCommandMap::ite
case supv::FACTORY_RESET_CLEAR_CIRCULAR: case supv::FACTORY_RESET_CLEAR_CIRCULAR:
case supv::REQUEST_LOGGING_DATA: case supv::REQUEST_LOGGING_DATA:
case supv::DISABLE_PERIOIC_HK_TRANSMISSION: case supv::DISABLE_PERIOIC_HK_TRANSMISSION:
case supv::PREPARE_UPDATE:
case supv::START_MPSOC_QUIET: case supv::START_MPSOC_QUIET:
case supv::SET_SHUTDOWN_TIMEOUT: case supv::SET_SHUTDOWN_TIMEOUT:
case supv::FACTORY_FLASH: case supv::FACTORY_FLASH:
case supv::ENABLE_AUTO_TM:
case supv::DISABLE_AUTO_TM:
enabledReplies = 2; enabledReplies = 2;
break; break;
default: default:
@ -893,9 +903,9 @@ ReturnValue_t PlocSupervisorHandler::handleBootStatusReport(const uint8_t* data)
} }
uint16_t offset = supv::DATA_FIELD_OFFSET; uint16_t offset = supv::DATA_FIELD_OFFSET;
bootStatusReport.bootSignal = *(data + offset); bootStatusReport.socState = *(data + offset);
offset += 1; offset += 1;
bootStatusReport.resetCounter = *(data + offset); bootStatusReport.powerCycles = *(data + offset);
offset += 1; offset += 1;
bootStatusReport.bootAfterMs = *(data + offset) << 24 | *(data + offset + 1) << 16 | bootStatusReport.bootAfterMs = *(data + offset) << 24 | *(data + offset + 1) << 16 |
*(data + offset + 2) << 8 | *(data + offset + 3); *(data + offset + 2) << 8 | *(data + offset + 3);
@ -918,10 +928,10 @@ ReturnValue_t PlocSupervisorHandler::handleBootStatusReport(const uint8_t* data)
nextReplyId = supv::EXE_REPORT; nextReplyId = supv::EXE_REPORT;
#if OBSW_VERBOSE_LEVEL >= 1 && OBSW_DEBUG_PLOC_SUPERVISOR == 1 #if OBSW_VERBOSE_LEVEL >= 1 && OBSW_DEBUG_PLOC_SUPERVISOR == 1
sif::info << "PlocSupervisorHandler::handleBootStatusReport: Boot signal: " sif::info << "PlocSupervisorHandler::handleBootStatusReport: SoC State: "
<< static_cast<unsigned int>(bootStatusReport.bootSignal.value) << std::endl; << static_cast<unsigned int>(bootStatusReport.socState.value) << std::endl;
sif::info << "PlocSupervisorHandler::handleBootStatusReport: Reset counter: " sif::info << "PlocSupervisorHandler::handleBootStatusReport: Power Cycles: "
<< static_cast<unsigned int>(bootStatusReport.resetCounter.value) << std::endl; << static_cast<unsigned int>(bootStatusReport.powerCycles.value) << std::endl;
sif::info << "PlocSupervisorHandler::handleBootStatusReport: BootAfterMs: " sif::info << "PlocSupervisorHandler::handleBootStatusReport: BootAfterMs: "
<< bootStatusReport.bootAfterMs << " ms" << std::endl; << bootStatusReport.bootAfterMs << " ms" << std::endl;
sif::info << "PlocSupervisorHandler::handleBootStatusReport: BootTimeoutMs: " << std::dec sif::info << "PlocSupervisorHandler::handleBootStatusReport: BootTimeoutMs: " << std::dec
@ -971,7 +981,9 @@ ReturnValue_t PlocSupervisorHandler::handleLatchupStatusReport(const uint8_t* da
offset += 2; offset += 2;
latchupStatusReport.cnt6 = *(data + offset) << 8 | *(data + offset + 1); latchupStatusReport.cnt6 = *(data + offset) << 8 | *(data + offset + 1);
offset += 2; offset += 2;
latchupStatusReport.timeMsec = (*(data + offset) << 8 | *(data + offset + 1)) & 0x7FFF; uint16_t msec = *(data + offset) << 8 | *(data + offset + 1);
latchupStatusReport.isSet = msec >> supv::LatchupStatusReport::IS_SET_BIT_POS;
latchupStatusReport.timeMsec = msec & (~(1 << latchupStatusReport.IS_SET_BIT_POS));
offset += 2; offset += 2;
latchupStatusReport.timeSec = *(data + offset); latchupStatusReport.timeSec = *(data + offset);
offset += 1; offset += 1;
@ -1018,8 +1030,8 @@ ReturnValue_t PlocSupervisorHandler::handleLatchupStatusReport(const uint8_t* da
<< static_cast<unsigned int>(latchupStatusReport.timeYear.value) << std::endl; << static_cast<unsigned int>(latchupStatusReport.timeYear.value) << std::endl;
sif::info << "PlocSupervisorHandler::handleLatchupStatusReport: Msec: " sif::info << "PlocSupervisorHandler::handleLatchupStatusReport: Msec: "
<< static_cast<unsigned int>(latchupStatusReport.timeMsec.value) << std::endl; << static_cast<unsigned int>(latchupStatusReport.timeMsec.value) << std::endl;
sif::info << "PlocSupervisorHandler::handleLatchupStatusReport: isSet: 0x" << std::hex sif::info << "PlocSupervisorHandler::handleLatchupStatusReport: isSet: "
<< latchupStatusReport.timeMsec << std::dec << std::endl; << static_cast<unsigned int>(latchupStatusReport.isSet.value) << std::endl;
#endif #endif
return result; return result;