event buffer request wip
This commit is contained in:
@ -15,7 +15,6 @@ namespace supv {
|
||||
/** Command IDs */
|
||||
static const DeviceCommandId_t NONE = 0;
|
||||
static const DeviceCommandId_t GET_HK_REPORT = 1;
|
||||
static const DeviceCommandId_t RESTART_MPSOC = 2;
|
||||
static const DeviceCommandId_t START_MPSOC = 3;
|
||||
static const DeviceCommandId_t SHUTDOWN_MPSOC = 4;
|
||||
static const DeviceCommandId_t SEL_MPSOC_BOOT_IMAGE = 5;
|
||||
@ -25,33 +24,23 @@ static const DeviceCommandId_t RESET_MPSOC = 8;
|
||||
static const DeviceCommandId_t SET_TIME_REF = 9;
|
||||
static const DeviceCommandId_t DISABLE_PERIOIC_HK_TRANSMISSION = 10;
|
||||
static const DeviceCommandId_t GET_BOOT_STATUS_REPORT = 11;
|
||||
/** Notifies the supervisor that a new update is available for the MPSoC */
|
||||
static const DeviceCommandId_t WATCHDOGS_ENABLE = 13;
|
||||
static const DeviceCommandId_t WATCHDOGS_CONFIG_TIMEOUT = 14;
|
||||
static const DeviceCommandId_t ENABLE_LATCHUP_ALERT = 15;
|
||||
static const DeviceCommandId_t DISABLE_LATCHUP_ALERT = 16;
|
||||
static const DeviceCommandId_t AUTO_CALIBRATE_ALERT = 17;
|
||||
static const DeviceCommandId_t SET_ALERT_LIMIT = 18;
|
||||
static const DeviceCommandId_t SET_ALERT_IRQ_FILTER = 19;
|
||||
static const DeviceCommandId_t SET_ADC_SWEEP_PERIOD = 20;
|
||||
static const DeviceCommandId_t SET_ADC_ENABLED_CHANNELS = 21;
|
||||
static const DeviceCommandId_t SET_ADC_WINDOW_AND_STRIDE = 22;
|
||||
static const DeviceCommandId_t SET_ADC_THRESHOLD = 23;
|
||||
static const DeviceCommandId_t GET_LATCHUP_STATUS_REPORT = 24;
|
||||
static const DeviceCommandId_t COPY_ADC_DATA_TO_MRAM = 25;
|
||||
static const DeviceCommandId_t ENABLE_NVMS = 26;
|
||||
static const DeviceCommandId_t SELECT_NVM = 27;
|
||||
static const DeviceCommandId_t RUN_AUTO_EM_TESTS = 28;
|
||||
static const DeviceCommandId_t WIPE_MRAM = 29;
|
||||
static const DeviceCommandId_t FIRST_MRAM_DUMP = 30;
|
||||
static const DeviceCommandId_t SET_DBG_VERBOSITY = 31;
|
||||
static const DeviceCommandId_t CAN_LOOPBACK_TEST = 32;
|
||||
static const DeviceCommandId_t PRINT_CPU_STATS = 33;
|
||||
static const DeviceCommandId_t SET_GPIO = 34;
|
||||
static const DeviceCommandId_t READ_GPIO = 35;
|
||||
static const DeviceCommandId_t RESTART_SUPERVISOR = 36;
|
||||
static const DeviceCommandId_t FACTORY_RESET_CLEAR_ALL = 37;
|
||||
static const DeviceCommandId_t REQUEST_LOGGING_DATA = 38;
|
||||
static const DeviceCommandId_t LOGGING_REQUEST_COUNTERS = 38;
|
||||
static const DeviceCommandId_t FACTORY_RESET_CLEAR_MIRROR = 40;
|
||||
static const DeviceCommandId_t FACTORY_RESET_CLEAR_CIRCULAR = 41;
|
||||
static const DeviceCommandId_t CONSECUTIVE_MRAM_DUMP = 43;
|
||||
@ -62,6 +51,11 @@ static const DeviceCommandId_t PERFORM_UPDATE = 48;
|
||||
static const DeviceCommandId_t TERMINATE_SUPV_HELPER = 49;
|
||||
static const DeviceCommandId_t ENABLE_AUTO_TM = 50;
|
||||
static const DeviceCommandId_t DISABLE_AUTO_TM = 51;
|
||||
static const DeviceCommandId_t ENABLE_ADC_MONITOR_TASK = 52;
|
||||
static const DeviceCommandId_t DISABLE_ADC_MONITOR_TASK = 53;
|
||||
static const DeviceCommandId_t LOGGING_REQUEST_EVENT_BUFFERS = 54;
|
||||
static const DeviceCommandId_t LOGGING_CLEAR_COUNTERS = 55;
|
||||
static const DeviceCommandId_t LOGGING_SET_TOPIC = 56;
|
||||
|
||||
/** Reply IDs */
|
||||
static const DeviceCommandId_t ACK_REPORT = 50;
|
||||
@ -69,12 +63,15 @@ static const DeviceCommandId_t EXE_REPORT = 51;
|
||||
static const DeviceCommandId_t HK_REPORT = 52;
|
||||
static const DeviceCommandId_t BOOT_STATUS_REPORT = 53;
|
||||
static const DeviceCommandId_t LATCHUP_REPORT = 54;
|
||||
static const DeviceCommandId_t LOGGING_REPORT = 55;
|
||||
|
||||
// Size of complete space packet (6 byte header + size of data + 2 byte CRC)
|
||||
static const uint16_t SIZE_ACK_REPORT = 14;
|
||||
static const uint16_t SIZE_EXE_REPORT = 14;
|
||||
static const uint16_t SIZE_HK_REPORT = 52;
|
||||
static const uint16_t SIZE_BOOT_STATUS_REPORT = 24;
|
||||
static const uint16_t SIZE_LATCHUP_STATUS_REPORT = 31;
|
||||
static const uint16_t SIZE_LOGGING_REPORT = 44;
|
||||
|
||||
/**
|
||||
* SpacePacket apids of telemetry packets
|
||||
@ -97,7 +94,6 @@ static const uint16_t APID_DATA_LOGGER_DATA = 0x20D;
|
||||
/**
|
||||
* APIDs of telecommand packets
|
||||
*/
|
||||
static const uint16_t APID_RESTART_MPSOC = 0xA0;
|
||||
static const uint16_t APID_START_MPSOC = 0xA1;
|
||||
static const uint16_t APID_SHUTWOWN_MPSOC = 0xA2;
|
||||
static const uint16_t APID_SEL_MPSOC_BOOT_IMAGE = 0xA3;
|
||||
@ -112,29 +108,21 @@ static const uint16_t APID_FACTORY_FLASH = 0xAC;
|
||||
static const uint16_t APID_ERASE_MEMORY = 0xB0;
|
||||
static const uint16_t APID_WRITE_MEMORY = 0xB1;
|
||||
static const uint16_t APID_CHECK_MEMORY = 0xB2;
|
||||
static const uint16_t APID_WTD_ENABLE = 0xC0;
|
||||
static const uint16_t APID_WTD_CONFIG_TIMEOUT = 0xC1;
|
||||
static const uint16_t APID_SET_TIME_REF = 0xC2;
|
||||
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_DISABLE_LATCHUP_ALERT = 0xD1;
|
||||
static const uint16_t APID_AUTO_CALIBRATE_ALERT = 0xD2;
|
||||
static const uint16_t APID_SET_ALERT_LIMIT = 0xD3;
|
||||
static const uint16_t APID_SET_ALERT_IRQ_FILTER = 0xD4;
|
||||
static const uint16_t APID_SET_ADC_SWEEP_PERIOD = 0xD5;
|
||||
static const uint16_t APID_SET_ADC_ENABLED_CHANNELS = 0xD6;
|
||||
static const uint16_t APID_SET_ADC_WINDOW_AND_STRIDE = 0xD7;
|
||||
static const uint16_t APID_SET_ADC_THRESHOLD = 0xD8;
|
||||
static const uint16_t APID_GET_LATCHUP_STATUS_REPORT = 0xD9;
|
||||
static const uint16_t APID_COPY_ADC_DATA_TO_MRAM = 0xDA;
|
||||
static const uint16_t APID_ENABLE_NVMS = 0xF0;
|
||||
static const uint16_t APID_SELECT_NVM = 0xF1;
|
||||
static const uint16_t APID_ADC_MONITOR_TASK = 0xDB;
|
||||
static const uint16_t APID_RUN_AUTO_EM_TESTS = 0xF2;
|
||||
static const uint16_t APID_WIPE_MRAM = 0xF3;
|
||||
static const uint16_t APID_DUMP_MRAM = 0xF4;
|
||||
static const uint16_t APID_SET_DBG_VERBOSITY = 0xF5;
|
||||
static const uint16_t APID_CAN_LOOPBACK_TEST = 0xF6;
|
||||
static const uint16_t APID_PRINT_CPU_STATS = 0xF8;
|
||||
static const uint16_t APID_SET_GPIO = 0xF9;
|
||||
static const uint16_t APID_READ_GPIO = 0xFA;
|
||||
@ -212,15 +200,27 @@ enum PoolIds : lp_id_t {
|
||||
LATCHUP_RPT_TIME_YEAR,
|
||||
LATCHUP_RPT_TIME_MSEC,
|
||||
LATCHUP_RPT_IS_SET,
|
||||
|
||||
SUPERVISOR_REBOOTS,
|
||||
LATCHUP_EVENTS,
|
||||
ADC_TRIGGERS,
|
||||
PS_HEARTBEATS_LOST,
|
||||
PL_HEARTBEATS_LOST,
|
||||
TC_RECEIVED,
|
||||
TM_RECEIVED,
|
||||
SOC_BOOTS,
|
||||
SOC_BOOT_FAILS
|
||||
};
|
||||
|
||||
static const uint8_t HK_SET_ENTRIES = 13;
|
||||
static const uint8_t BOOT_REPORT_SET_ENTRIES = 10;
|
||||
static const uint8_t LATCHUP_RPT_SET_ENTRIES = 16;
|
||||
static const uint8_t LOGGING_RPT_SET_ENTRIES = 9;
|
||||
|
||||
static const uint32_t HK_SET_ID = HK_REPORT;
|
||||
static const uint32_t BOOT_REPORT_SET_ID = BOOT_STATUS_REPORT;
|
||||
static const uint32_t LATCHUP_RPT_ID = LATCHUP_REPORT;
|
||||
static const uint32_t LOGGING_RPT_ID = LOGGING_REQUEST_COUNTERS;
|
||||
|
||||
/**
|
||||
* @brief This class creates a space packet containing only the header data and the CRC.
|
||||
@ -465,101 +465,6 @@ class DisablePeriodicHkTransmission : public SpacePacket {
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
* @brief This class packages the command to enable the watchdogs of the PLOC.
|
||||
*/
|
||||
class WatchdogsEnable : public SpacePacket {
|
||||
public:
|
||||
/**
|
||||
* @brief Constructor
|
||||
*
|
||||
* @param watchdogPs Enables processing system watchdog
|
||||
* @param watchdogPl Enables programmable logic wathdog
|
||||
* @param watchdogInt
|
||||
*/
|
||||
WatchdogsEnable(uint8_t watchdogPs, uint8_t watchdogPl, uint8_t watchdogInt)
|
||||
: SpacePacket(DATA_FIELD_LENGTH - 1, true, APID_WTD_ENABLE, DEFAULT_SEQUENCE_COUNT),
|
||||
watchdogPs(watchdogPs),
|
||||
watchdogPl(watchdogPl),
|
||||
watchdogInt(watchdogInt) {
|
||||
initPacket();
|
||||
}
|
||||
|
||||
private:
|
||||
static const uint16_t DATA_FIELD_LENGTH = 5;
|
||||
static const uint16_t DEFAULT_SEQUENCE_COUNT = 1;
|
||||
|
||||
static const uint16_t CRC_OFFSET = DATA_FIELD_LENGTH - 2;
|
||||
|
||||
uint8_t watchdogPs = 0;
|
||||
uint8_t watchdogPl = 0;
|
||||
uint8_t watchdogInt = 0;
|
||||
|
||||
void initPacket() {
|
||||
size_t serializedSize = 0;
|
||||
uint8_t* dataFieldPtr = this->localData.fields.buffer;
|
||||
SerializeAdapter::serialize<uint8_t>(&watchdogPs, &dataFieldPtr, &serializedSize,
|
||||
sizeof(watchdogPs), SerializeIF::Endianness::BIG);
|
||||
serializedSize = 0;
|
||||
SerializeAdapter::serialize<uint8_t>(&watchdogPl, &dataFieldPtr, &serializedSize,
|
||||
sizeof(watchdogPl), SerializeIF::Endianness::BIG);
|
||||
serializedSize = 0;
|
||||
SerializeAdapter::serialize<uint8_t>(&watchdogInt, &dataFieldPtr, &serializedSize,
|
||||
sizeof(watchdogInt), SerializeIF::Endianness::BIG);
|
||||
serializedSize = 0;
|
||||
uint16_t crc = CRC::crc16ccitt(this->localData.byteStream,
|
||||
sizeof(CCSDSPrimaryHeader) + DATA_FIELD_LENGTH - 2);
|
||||
uint8_t* crcPos = this->localData.fields.buffer + CRC_OFFSET;
|
||||
SerializeAdapter::serialize<uint16_t>(&crc, &crcPos, &serializedSize, sizeof(crc),
|
||||
SerializeIF::Endianness::BIG);
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
* @brief This class packages the command to set the timeout of one of the three watchdogs (PS,
|
||||
* PL, INT)
|
||||
*/
|
||||
class WatchdogsConfigTimeout : public SpacePacket {
|
||||
public:
|
||||
/**
|
||||
* @brief Constructor
|
||||
*
|
||||
* @param watchdogPs Selects the watchdog to configure (0 - PS, 1 - PL, 2 - INT)
|
||||
* @param timeout The timeout to set
|
||||
*/
|
||||
WatchdogsConfigTimeout(uint8_t watchdog, uint32_t timeout)
|
||||
: SpacePacket(DATA_FIELD_LENGTH - 1, true, APID_WTD_CONFIG_TIMEOUT, DEFAULT_SEQUENCE_COUNT),
|
||||
watchdog(watchdog),
|
||||
timeout(timeout) {
|
||||
initPacket();
|
||||
}
|
||||
|
||||
private:
|
||||
static const uint16_t DATA_FIELD_LENGTH = 7;
|
||||
static const uint16_t DEFAULT_SEQUENCE_COUNT = 1;
|
||||
|
||||
static const uint16_t CRC_OFFSET = DATA_FIELD_LENGTH - 2;
|
||||
|
||||
uint8_t watchdog = 0;
|
||||
uint32_t timeout = 0;
|
||||
|
||||
void initPacket() {
|
||||
size_t serializedSize = 0;
|
||||
uint8_t* dataFieldPtr = this->localData.fields.buffer;
|
||||
SerializeAdapter::serialize<uint8_t>(&watchdog, &dataFieldPtr, &serializedSize,
|
||||
sizeof(watchdog), SerializeIF::Endianness::BIG);
|
||||
serializedSize = 0;
|
||||
SerializeAdapter::serialize<uint32_t>(&timeout, &dataFieldPtr, &serializedSize, sizeof(timeout),
|
||||
SerializeIF::Endianness::BIG);
|
||||
serializedSize = 0;
|
||||
uint16_t crc = CRC::crc16ccitt(this->localData.byteStream,
|
||||
sizeof(CCSDSPrimaryHeader) + DATA_FIELD_LENGTH - 2);
|
||||
uint8_t* crcPos = this->localData.fields.buffer + CRC_OFFSET;
|
||||
SerializeAdapter::serialize<uint16_t>(&crc, &crcPos, &serializedSize, sizeof(crc),
|
||||
SerializeIF::Endianness::BIG);
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
* @brief This class packages the command to enable of disable the latchup alert.
|
||||
*
|
||||
@ -595,8 +500,8 @@ class LatchupAlert : public SpacePacket {
|
||||
|
||||
void initPacket() {
|
||||
size_t serializedSize = 0;
|
||||
uint8_t* dataFieldPtr = this->localData.fields.buffer;
|
||||
SerializeAdapter::serialize<uint8_t>(&latchupId, &dataFieldPtr, &serializedSize,
|
||||
uint8_t* data_field_ptr = this->localData.fields.buffer;
|
||||
SerializeAdapter::serialize<uint8_t>(&latchupId, &data_field_ptr, &serializedSize,
|
||||
sizeof(latchupId), SerializeIF::Endianness::BIG);
|
||||
serializedSize = 0;
|
||||
uint16_t crc = CRC::crc16ccitt(this->localData.byteStream,
|
||||
@ -607,51 +512,6 @@ class LatchupAlert : public SpacePacket {
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
* @brief This class packages the command to calibrate a certain latchup alert.
|
||||
*/
|
||||
class AutoCalibrateAlert : public SpacePacket {
|
||||
public:
|
||||
/**
|
||||
* @brief Constructor
|
||||
*
|
||||
* @param latchupId Identifies the latchup alert to calibrate (0 - 0.85V, 1 - 1.8V, 2 - MISC,
|
||||
* 3 - 3.3V, 4 - NVM_4XO, 5 - MISSION, 6 - SAFECOTS)
|
||||
* @param mg
|
||||
*/
|
||||
AutoCalibrateAlert(uint8_t latchupId, uint32_t mg)
|
||||
: SpacePacket(DATA_FIELD_LENGTH - 1, true, APID_AUTO_CALIBRATE_ALERT, DEFAULT_SEQUENCE_COUNT),
|
||||
latchupId(latchupId),
|
||||
mg(mg) {
|
||||
initPacket();
|
||||
}
|
||||
|
||||
private:
|
||||
static const uint16_t DATA_FIELD_LENGTH = 7;
|
||||
static const uint16_t DEFAULT_SEQUENCE_COUNT = 1;
|
||||
|
||||
static const uint16_t CRC_OFFSET = DATA_FIELD_LENGTH - 2;
|
||||
|
||||
uint8_t latchupId = 0;
|
||||
uint32_t mg = 0;
|
||||
|
||||
void initPacket() {
|
||||
size_t serializedSize = 0;
|
||||
uint8_t* dataFieldPtr = this->localData.fields.buffer;
|
||||
SerializeAdapter::serialize<uint8_t>(&latchupId, &dataFieldPtr, &serializedSize,
|
||||
sizeof(latchupId), SerializeIF::Endianness::BIG);
|
||||
serializedSize = 0;
|
||||
SerializeAdapter::serialize<uint32_t>(&mg, &dataFieldPtr, &serializedSize, sizeof(mg),
|
||||
SerializeIF::Endianness::BIG);
|
||||
serializedSize = 0;
|
||||
uint16_t crc = CRC::crc16ccitt(this->localData.byteStream,
|
||||
sizeof(CCSDSPrimaryHeader) + DATA_FIELD_LENGTH - 2);
|
||||
uint8_t* crcPos = this->localData.fields.buffer + CRC_OFFSET;
|
||||
SerializeAdapter::serialize<uint16_t>(&crc, &crcPos, &serializedSize, sizeof(crc),
|
||||
SerializeIF::Endianness::BIG);
|
||||
}
|
||||
};
|
||||
|
||||
class SetAlertlimit : public SpacePacket {
|
||||
public:
|
||||
/**
|
||||
@ -694,91 +554,6 @@ class SetAlertlimit : public SpacePacket {
|
||||
}
|
||||
};
|
||||
|
||||
class SetAlertIrqFilter : public SpacePacket {
|
||||
public:
|
||||
/**
|
||||
* @brief Constructor
|
||||
*
|
||||
* @param latchupId Identifies the latchup alert to calibrate (0 - 0.85V, 1 - 1.8V, 2 - MISC,
|
||||
* 3 - 3.3V, 4 - NVM_4XO, 5 - MISSION, 6 - SAFECOTS)
|
||||
* @param tp
|
||||
* @param div
|
||||
*/
|
||||
SetAlertIrqFilter(uint8_t latchupId, uint8_t tp, uint8_t div)
|
||||
: SpacePacket(DATA_FIELD_LENGTH - 1, true, APID_SET_ALERT_IRQ_FILTER, DEFAULT_SEQUENCE_COUNT),
|
||||
tp(tp),
|
||||
div(div) {
|
||||
initPacket();
|
||||
}
|
||||
|
||||
private:
|
||||
static const uint16_t DATA_FIELD_LENGTH = 5;
|
||||
static const uint16_t DEFAULT_SEQUENCE_COUNT = 1;
|
||||
|
||||
static const uint16_t CRC_OFFSET = DATA_FIELD_LENGTH - 2;
|
||||
|
||||
uint8_t latchupId = 0;
|
||||
uint8_t tp = 0;
|
||||
uint8_t div = 0;
|
||||
|
||||
void initPacket() {
|
||||
size_t serializedSize = 0;
|
||||
uint8_t* dataFieldPtr = this->localData.fields.buffer;
|
||||
SerializeAdapter::serialize<uint8_t>(&latchupId, &dataFieldPtr, &serializedSize,
|
||||
sizeof(latchupId), SerializeIF::Endianness::BIG);
|
||||
serializedSize = 0;
|
||||
SerializeAdapter::serialize<uint8_t>(&tp, &dataFieldPtr, &serializedSize, sizeof(tp),
|
||||
SerializeIF::Endianness::BIG);
|
||||
serializedSize = 0;
|
||||
SerializeAdapter::serialize<uint8_t>(&div, &dataFieldPtr, &serializedSize, sizeof(div),
|
||||
SerializeIF::Endianness::BIG);
|
||||
serializedSize = 0;
|
||||
uint16_t crc = CRC::crc16ccitt(this->localData.byteStream,
|
||||
sizeof(CCSDSPrimaryHeader) + DATA_FIELD_LENGTH - 2);
|
||||
uint8_t* crcPos = this->localData.fields.buffer + CRC_OFFSET;
|
||||
SerializeAdapter::serialize<uint16_t>(&crc, &crcPos, &serializedSize, sizeof(crc),
|
||||
SerializeIF::Endianness::BIG);
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
* @brief This class packages the space packet to set the sweep period of the ADC.
|
||||
*/
|
||||
class SetAdcSweepPeriod : public SpacePacket {
|
||||
public:
|
||||
/**
|
||||
* @brief Constructor
|
||||
*
|
||||
* @param sweepPeriod Sweep period in us. minimum is 21 us
|
||||
*/
|
||||
SetAdcSweepPeriod(uint32_t sweepPeriod)
|
||||
: SpacePacket(DATA_FIELD_LENGTH - 1, true, APID_SET_ADC_SWEEP_PERIOD, DEFAULT_SEQUENCE_COUNT),
|
||||
sweepPeriod(sweepPeriod) {
|
||||
initPacket();
|
||||
}
|
||||
|
||||
private:
|
||||
static const uint16_t DATA_FIELD_LENGTH = 6;
|
||||
static const uint16_t DEFAULT_SEQUENCE_COUNT = 1;
|
||||
|
||||
static const uint16_t CRC_OFFSET = DATA_FIELD_LENGTH - 2;
|
||||
|
||||
uint32_t sweepPeriod = 0;
|
||||
|
||||
void initPacket() {
|
||||
size_t serializedSize = 0;
|
||||
uint8_t* dataFieldPtr = this->localData.fields.buffer;
|
||||
SerializeAdapter::serialize<uint32_t>(&sweepPeriod, &dataFieldPtr, &serializedSize,
|
||||
sizeof(sweepPeriod), SerializeIF::Endianness::BIG);
|
||||
serializedSize = 0;
|
||||
uint16_t crc = CRC::crc16ccitt(this->localData.byteStream,
|
||||
sizeof(CCSDSPrimaryHeader) + DATA_FIELD_LENGTH - 2);
|
||||
uint8_t* crcPos = this->localData.fields.buffer + CRC_OFFSET;
|
||||
SerializeAdapter::serialize<uint16_t>(&crc, &crcPos, &serializedSize, sizeof(crc),
|
||||
SerializeIF::Endianness::BIG);
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
* @brief This class packages the space packet to enable or disable ADC channels.
|
||||
*/
|
||||
@ -902,88 +677,6 @@ class SetAdcThreshold : public SpacePacket {
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
* @brief This class packages the space packet to select between NVM 0 and NVM 1.
|
||||
*/
|
||||
class SelectNvm : public SpacePacket {
|
||||
public:
|
||||
/**
|
||||
* @brief Constructor
|
||||
*
|
||||
* @param mem 0 - select NVM0, 1 - select NVM1.
|
||||
*/
|
||||
SelectNvm(uint8_t mem)
|
||||
: SpacePacket(DATA_FIELD_LENGTH - 1, true, APID_SELECT_NVM, DEFAULT_SEQUENCE_COUNT),
|
||||
mem(mem) {
|
||||
initPacket();
|
||||
}
|
||||
|
||||
private:
|
||||
static const uint16_t DATA_FIELD_LENGTH = 3;
|
||||
static const uint16_t DEFAULT_SEQUENCE_COUNT = 1;
|
||||
|
||||
static const uint16_t CRC_OFFSET = DATA_FIELD_LENGTH - 2;
|
||||
|
||||
uint8_t mem = 0;
|
||||
|
||||
void initPacket() {
|
||||
size_t serializedSize = 0;
|
||||
uint8_t* dataFieldPtr = this->localData.fields.buffer;
|
||||
SerializeAdapter::serialize<uint8_t>(&mem, &dataFieldPtr, &serializedSize, sizeof(mem),
|
||||
SerializeIF::Endianness::BIG);
|
||||
serializedSize = 0;
|
||||
uint16_t crc = CRC::crc16ccitt(this->localData.byteStream,
|
||||
sizeof(CCSDSPrimaryHeader) + DATA_FIELD_LENGTH - 2);
|
||||
uint8_t* crcPos = this->localData.fields.buffer + CRC_OFFSET;
|
||||
SerializeAdapter::serialize<uint16_t>(&crc, &crcPos, &serializedSize, sizeof(crc),
|
||||
SerializeIF::Endianness::BIG);
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
* @brief This class packages the space packet to power the NVMs on or off.
|
||||
*/
|
||||
class EnableNvms : public SpacePacket {
|
||||
public:
|
||||
/**
|
||||
* @brief Constructor
|
||||
*
|
||||
* @param n01 Set to one to power NVM0 and NVM1 on. 0 powers off memory.
|
||||
* @param n3 Set to one to power NVM3 on. 0 powers off the memory.
|
||||
*/
|
||||
EnableNvms(uint8_t n01, uint8_t n3)
|
||||
: SpacePacket(DATA_FIELD_LENGTH - 1, true, APID_ENABLE_NVMS, DEFAULT_SEQUENCE_COUNT),
|
||||
n01(n01),
|
||||
n3(n3) {
|
||||
initPacket();
|
||||
}
|
||||
|
||||
private:
|
||||
static const uint16_t DATA_FIELD_LENGTH = 4;
|
||||
static const uint16_t DEFAULT_SEQUENCE_COUNT = 1;
|
||||
|
||||
static const uint16_t CRC_OFFSET = DATA_FIELD_LENGTH - 2;
|
||||
|
||||
uint8_t n01 = 0;
|
||||
uint8_t n3 = 0;
|
||||
|
||||
void initPacket() {
|
||||
size_t serializedSize = 0;
|
||||
uint8_t* dataFieldPtr = this->localData.fields.buffer;
|
||||
SerializeAdapter::serialize<uint8_t>(&n01, &dataFieldPtr, &serializedSize, sizeof(n01),
|
||||
SerializeIF::Endianness::BIG);
|
||||
serializedSize = 0;
|
||||
SerializeAdapter::serialize<uint8_t>(&n3, &dataFieldPtr, &serializedSize, sizeof(n3),
|
||||
SerializeIF::Endianness::BIG);
|
||||
serializedSize = 0;
|
||||
uint16_t crc = CRC::crc16ccitt(this->localData.byteStream,
|
||||
sizeof(CCSDSPrimaryHeader) + DATA_FIELD_LENGTH - 2);
|
||||
uint8_t* crcPos = this->localData.fields.buffer + CRC_OFFSET;
|
||||
SerializeAdapter::serialize<uint16_t>(&crc, &crcPos, &serializedSize, sizeof(crc),
|
||||
SerializeIF::Endianness::BIG);
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
* @brief This class packages the space packet to run auto EM tests.
|
||||
*/
|
||||
@ -1061,45 +754,6 @@ class PrintCpuStats : public SpacePacket {
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
* @brief This class packages the space packet to set the print verbosity in the supervisor
|
||||
* software.
|
||||
*/
|
||||
class SetDbgVerbosity : public SpacePacket {
|
||||
public:
|
||||
/**
|
||||
* @brief Constructor
|
||||
*
|
||||
* @param vb 0: None, 1: Error, 2: Warn, 3: Info
|
||||
*/
|
||||
SetDbgVerbosity(uint8_t vb)
|
||||
: SpacePacket(DATA_FIELD_LENGTH - 1, true, APID_SET_DBG_VERBOSITY, DEFAULT_SEQUENCE_COUNT),
|
||||
vb(vb) {
|
||||
initPacket();
|
||||
}
|
||||
|
||||
private:
|
||||
static const uint16_t DATA_FIELD_LENGTH = 3;
|
||||
static const uint16_t DEFAULT_SEQUENCE_COUNT = 1;
|
||||
|
||||
static const uint16_t CRC_OFFSET = DATA_FIELD_LENGTH - 2;
|
||||
|
||||
uint8_t vb = 0;
|
||||
|
||||
void initPacket() {
|
||||
size_t serializedSize = 0;
|
||||
uint8_t* dataFieldPtr = this->localData.fields.buffer;
|
||||
SerializeAdapter::serialize<uint8_t>(&vb, &dataFieldPtr, &serializedSize, sizeof(vb),
|
||||
SerializeIF::Endianness::BIG);
|
||||
serializedSize = 0;
|
||||
uint16_t crc = CRC::crc16ccitt(this->localData.byteStream,
|
||||
sizeof(CCSDSPrimaryHeader) + DATA_FIELD_LENGTH - 2);
|
||||
uint8_t* crcPos = this->localData.fields.buffer + CRC_OFFSET;
|
||||
SerializeAdapter::serialize<uint16_t>(&crc, &crcPos, &serializedSize, sizeof(crc),
|
||||
SerializeIF::Endianness::BIG);
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
* @brief This class packages the space packet to wipe or dump parts of the MRAM.
|
||||
*/
|
||||
@ -1537,6 +1191,61 @@ class DisableAutoTm : public SupvTcSpacePacket {
|
||||
static const uint8_t DISABLE = 0;
|
||||
};
|
||||
|
||||
/**
|
||||
* @brief This class creates the space packet to enable the auto TM generation
|
||||
*/
|
||||
class EnableAdcMonitorTask : public SupvTcSpacePacket {
|
||||
public:
|
||||
EnableAdcMonitorTask() : SupvTcSpacePacket(PAYLOAD_LENGTH, APID_ADC_MONITOR_TASK) {
|
||||
*(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 enable the auto TM generation
|
||||
*/
|
||||
class DisableAdcMonitorTask : public SupvTcSpacePacket {
|
||||
public:
|
||||
DisableAdcMonitorTask() : SupvTcSpacePacket(PAYLOAD_LENGTH, APID_ADC_MONITOR_TASK) {
|
||||
*(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 This class creates the space packet to request the logging data from the supervisor
|
||||
*/
|
||||
class RequestLoggingData : public SupvTcSpacePacket {
|
||||
public:
|
||||
|
||||
enum class Sa : uint8_t {
|
||||
REQUEST_COUNTERS = 1,
|
||||
REQUEST_EVENT_BUFFERS = 2,
|
||||
CLEAR_COUNTERS = 3,
|
||||
SET_LOGGING_TOPIC = 4
|
||||
};
|
||||
|
||||
RequestLoggingData(Sa sa, uint8_t tpc = 0)
|
||||
: SupvTcSpacePacket(PAYLOAD_LENGTH, APID_REQUEST_LOGGING_DATA) {
|
||||
*(this->localData.fields.buffer) = static_cast<uint8_t>(sa);
|
||||
*(this->localData.fields.buffer + TPC_OFFSET) = tpc;
|
||||
makeCrc();
|
||||
}
|
||||
|
||||
private:
|
||||
static const uint16_t PAYLOAD_LENGTH = 2; // length without CRC field
|
||||
static const uint8_t TPC_OFFSET = 1;
|
||||
};
|
||||
|
||||
/**
|
||||
* @brief Class for handling tm replies of the supervisor.
|
||||
*/
|
||||
@ -1547,8 +1256,15 @@ class TmPacket : public SpacePacket {
|
||||
*/
|
||||
TmPacket() : SpacePacket(PACKET_MAX_SIZE) {}
|
||||
|
||||
/**
|
||||
* @brief Returns the payload data length (data field length without CRC)
|
||||
*/
|
||||
uint16_t getPayloadDataLength() {
|
||||
this->getPacketDataLength() - 1;
|
||||
}
|
||||
|
||||
ReturnValue_t checkCrc() {
|
||||
uint8_t* crcPtr = this->getPacketData() + this->getPacketDataLength() - 1;
|
||||
uint8_t* crcPtr = this->getPacketData() + this->getPayloadDataLength();
|
||||
uint16_t receivedCrc = *(crcPtr) << 8 | *(crcPtr + 1);
|
||||
uint16_t recalculatedCrc =
|
||||
CRC::crc16ccitt(this->localData.byteStream, this->getFullSize() - CRC_SIZE);
|
||||
@ -1643,6 +1359,42 @@ class LatchupStatusReport : public StaticLocalDataSet<LATCHUP_RPT_SET_ENTRIES> {
|
||||
static const uint8_t IS_SET_BIT_POS = 15;
|
||||
};
|
||||
|
||||
/**
|
||||
* @brief This dataset stores the logging report.
|
||||
*/
|
||||
class LoggingReport : public StaticLocalDataSet<LOGGING_RPT_SET_ENTRIES> {
|
||||
public:
|
||||
LoggingReport(HasLocalDataPoolIF* owner) : StaticLocalDataSet(owner, LOGGING_RPT_ID) {}
|
||||
|
||||
LoggingReport(object_id_t objectId) : StaticLocalDataSet(sid_t(objectId, LOGGING_RPT_ID)) {}
|
||||
|
||||
lp_var_t<uint32_t> supervisorReboots =
|
||||
lp_var_t<uint32_t>(sid.objectId, PoolIds::SUPERVISOR_REBOOTS, this);
|
||||
lp_var_t<uint32_t> latchupEvents =
|
||||
lp_var_t<uint32_t>(sid.objectId, PoolIds::LATCHUP_EVENTS, this);
|
||||
lp_var_t<uint32_t> adcTriggers = lp_var_t<uint32_t>(sid.objectId, PoolIds::ADC_TRIGGERS, this);
|
||||
lp_var_t<uint32_t> psHeartbeatsLost =
|
||||
lp_var_t<uint32_t>(sid.objectId, PoolIds::PS_HEARTBEATS_LOST, this);
|
||||
lp_var_t<uint32_t> plHeartbeatsLost =
|
||||
lp_var_t<uint32_t>(sid.objectId, PoolIds::PL_HEARTBEATS_LOST, this);
|
||||
lp_var_t<uint32_t> tcReceived = lp_var_t<uint32_t>(sid.objectId, PoolIds::TC_RECEIVED, this);
|
||||
lp_var_t<uint32_t> tmReceived = lp_var_t<uint32_t>(sid.objectId, PoolIds::TM_RECEIVED, this);
|
||||
lp_var_t<uint32_t> socBoots = lp_var_t<uint32_t>(sid.objectId, PoolIds::SOC_BOOTS, this);
|
||||
lp_var_t<uint32_t> socBootFails = lp_var_t<uint32_t>(sid.objectId, PoolIds::SOC_BOOT_FAILS, this);
|
||||
|
||||
void printSet() {
|
||||
sif::info << "LoggingReport: Supervisor reboots: " << this->supervisorReboots << std::endl;
|
||||
sif::info << "LoggingReport: Latchup events: " << this->latchupEvents << std::endl;
|
||||
sif::info << "LoggingReport: ADC triggers: " << this->adcTriggers << std::endl;
|
||||
sif::info << "LoggingReport: PS heartbeats lost: " << this->psHeartbeatsLost << std::endl;
|
||||
sif::info << "LoggingReport: PL heartbeats lost: " << this->plHeartbeatsLost << std::endl;
|
||||
sif::info << "LoggingReport: TC received: " << this->tcReceived << std::endl;
|
||||
sif::info << "LoggingReport: TM received: " << this->tmReceived << std::endl;
|
||||
sif::info << "LoggingReport: SoC boots: " << this->socBoots << std::endl;
|
||||
sif::info << "LoggingReport: SoC boot fails: " << this->socBootFails << std::endl;
|
||||
}
|
||||
};
|
||||
|
||||
class UpdateStatusReport : public TmPacket {
|
||||
public:
|
||||
UpdateStatusReport() : TmPacket() {}
|
||||
|
Reference in New Issue
Block a user