eive-obsw/linux/devices/devicedefinitions/PlocSupervisorDefinitions.h

1987 lines
74 KiB
C
Raw Normal View History

#ifndef MISSION_DEVICES_DEVICEDEFINITIONS_PLOCSVPDEFINITIONS_H_
#define MISSION_DEVICES_DEVICEDEFINITIONS_PLOCSVPDEFINITIONS_H_
2022-01-17 15:58:27 +01:00
#include <fsfw/datapoollocal/StaticLocalDataSet.h>
#include <fsfw/devicehandlers/DeviceHandlerIF.h>
#include <fsfw/globalfunctions/CRC.h>
#include <fsfw/serialize/SerializeAdapter.h>
#include <fsfw/timemanager/Clock.h>
2022-01-17 15:58:27 +01:00
#include <fsfw/tmtcpacket/SpacePacket.h>
2022-04-11 16:52:50 +02:00
2022-04-10 18:46:39 +02:00
#include "linux/devices/devicedefinitions/SupvReturnValuesIF.h"
2022-03-30 09:19:30 +02:00
namespace supv {
/** Command IDs */
static const DeviceCommandId_t NONE = 0;
static const DeviceCommandId_t GET_HK_REPORT = 1;
static const DeviceCommandId_t START_MPSOC = 3;
static const DeviceCommandId_t SHUTDOWN_MPSOC = 4;
static const DeviceCommandId_t SEL_MPSOC_BOOT_IMAGE = 5;
static const DeviceCommandId_t SET_BOOT_TIMEOUT = 6;
static const DeviceCommandId_t SET_MAX_RESTART_TRIES = 7;
static const DeviceCommandId_t RESET_MPSOC = 8;
static const DeviceCommandId_t SET_TIME_REF = 9;
2021-07-22 08:06:04 +02:00
static const DeviceCommandId_t DISABLE_PERIOIC_HK_TRANSMISSION = 10;
2021-07-24 13:57:05 +02:00
static const DeviceCommandId_t GET_BOOT_STATUS_REPORT = 11;
static const DeviceCommandId_t ENABLE_LATCHUP_ALERT = 15;
static const DeviceCommandId_t DISABLE_LATCHUP_ALERT = 16;
static const DeviceCommandId_t SET_ALERT_LIMIT = 18;
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 RUN_AUTO_EM_TESTS = 28;
static const DeviceCommandId_t WIPE_MRAM = 29;
2021-08-29 07:31:34 +02:00
static const DeviceCommandId_t FIRST_MRAM_DUMP = 30;
static const DeviceCommandId_t SET_GPIO = 34;
static const DeviceCommandId_t READ_GPIO = 35;
static const DeviceCommandId_t RESTART_SUPERVISOR = 36;
2021-08-02 15:28:57 +02:00
static const DeviceCommandId_t FACTORY_RESET_CLEAR_ALL = 37;
2022-04-13 11:56:37 +02:00
static const DeviceCommandId_t LOGGING_REQUEST_COUNTERS = 38;
2021-08-02 15:28:57 +02:00
static const DeviceCommandId_t FACTORY_RESET_CLEAR_MIRROR = 40;
static const DeviceCommandId_t FACTORY_RESET_CLEAR_CIRCULAR = 41;
2021-08-31 11:20:21 +02:00
static const DeviceCommandId_t CONSECUTIVE_MRAM_DUMP = 43;
2022-04-06 07:10:20 +02:00
static const DeviceCommandId_t START_MPSOC_QUIET = 45;
static const DeviceCommandId_t SET_SHUTDOWN_TIMEOUT = 46;
static const DeviceCommandId_t FACTORY_FLASH = 47;
2022-04-10 18:46:39 +02:00
static const DeviceCommandId_t PERFORM_UPDATE = 48;
static const DeviceCommandId_t TERMINATE_SUPV_HELPER = 49;
2022-04-11 16:52:50 +02:00
static const DeviceCommandId_t ENABLE_AUTO_TM = 50;
static const DeviceCommandId_t DISABLE_AUTO_TM = 51;
2022-04-13 11:56:37 +02:00
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;
2022-04-21 16:30:23 +02:00
static const DeviceCommandId_t REQUEST_ADC_REPORT = 57;
2022-04-28 11:27:28 +02:00
static const DeviceCommandId_t RESET_PL = 58;
2022-05-05 19:18:39 +02:00
static const DeviceCommandId_t ENABLE_NVMS = 59;
/** Reply IDs */
2022-05-05 19:18:39 +02:00
static const DeviceCommandId_t ACK_REPORT = 100;
static const DeviceCommandId_t EXE_REPORT = 101;
static const DeviceCommandId_t HK_REPORT = 102;
static const DeviceCommandId_t BOOT_STATUS_REPORT = 103;
static const DeviceCommandId_t LATCHUP_REPORT = 104;
static const DeviceCommandId_t LOGGING_REPORT = 105;
static const DeviceCommandId_t ADC_REPORT = 106;
2022-04-13 11:56:37 +02:00
// 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;
2022-04-11 16:52:50 +02:00
static const uint16_t SIZE_HK_REPORT = 52;
2022-04-06 07:10:20 +02:00
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 = 73;
2022-04-21 16:30:23 +02:00
static const uint16_t SIZE_ADC_REPORT = 72;
/**
* SpacePacket apids of telemetry packets
*/
static const uint16_t APID_ACK_SUCCESS = 0x200;
static const uint16_t APID_ACK_FAILURE = 0x201;
static const uint16_t APID_EXE_SUCCESS = 0x202;
static const uint16_t APID_EXE_FAILURE = 0x203;
static const uint16_t APID_HK_REPORT = 0x204;
static const uint16_t APID_BOOT_STATUS_REPORT = 0x205;
static const uint16_t APID_UPDATE_STATUS_REPORT = 0x206;
2022-04-21 16:30:23 +02:00
static const uint16_t APID_ADC_REPORT = 0x207;
static const uint16_t APID_LATCHUP_STATUS_REPORT = 0x208;
static const uint16_t APID_SOC_SYSMON = 0x209;
2021-07-31 08:32:57 +02:00
static const uint16_t APID_MRAM_DUMP_TM = 0x20A;
static const uint16_t APID_SRAM = 0x20B;
static const uint16_t APID_NOR_DATA = 0x20C;
static const uint16_t APID_DATA_LOGGER_DATA = 0x20D;
/**
* APIDs of telecommand packets
*/
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;
static const uint16_t APID_SET_BOOT_TIMEOUT = 0xA4;
static const uint16_t APID_SET_MAX_RESTART_TRIES = 0xA5;
static const uint16_t APID_RESET_MPSOC = 0xA6;
2022-04-28 11:27:28 +02:00
static const uint16_t APID_RESET_PL = 0xA7;
static const uint16_t APID_GET_BOOT_STATUS_RPT = 0xA8;
2022-04-06 07:10:20 +02:00
static const uint16_t APID_PREPARE_UPDATE = 0xA9;
static const uint16_t APID_START_MPSOC_QUIET = 0xAA;
static const uint16_t APID_SET_SHUTDOWN_TIMEOUT = 0xAB;
static const uint16_t APID_FACTORY_FLASH = 0xAC;
2022-04-10 18:46:39 +02:00
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_SET_TIME_REF = 0xC2;
2021-07-22 08:06:04 +02:00
static const uint16_t APID_DISABLE_HK = 0xC3;
2022-04-11 16:52:50 +02:00
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_SET_ALERT_LIMIT = 0xD3;
2022-04-28 14:29:23 +02:00
static const uint16_t APID_SET_ADC_ENABLED_CHANNELS = 0xE1;
static const uint16_t APID_SET_ADC_WINDOW_AND_STRIDE = 0xE2;
static const uint16_t APID_SET_ADC_THRESHOLD = 0xE3;
static const uint16_t APID_GET_LATCHUP_STATUS_REPORT = 0xD9;
static const uint16_t APID_COPY_ADC_DATA_TO_MRAM = 0xDA;
2022-04-21 16:30:23 +02:00
static const uint16_t APID_REQUEST_ADC_REPORT = 0xDB;
2022-05-05 19:18:39 +02:00
static const uint16_t APID_ENABLE_NVMS = 0xF0;
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_GPIO = 0xF9;
static const uint16_t APID_READ_GPIO = 0xFA;
static const uint16_t APID_RESTART_SUPERVISOR = 0xFB;
static const uint16_t APID_FACTORY_RESET = 0xFC;
static const uint16_t APID_REQUEST_LOGGING_DATA = 0xFD;
static const uint16_t APID_GET_HK_REPORT = 0xC6;
2021-08-01 17:11:32 +02:00
static const uint16_t APID_MASK = 0x3FF;
2021-08-08 15:02:59 +02:00
static const uint16_t SEQUENCE_COUNT_MASK = 0xFFF;
2021-08-01 17:11:32 +02:00
/** Offset from first byte in Space packet to first byte of data field */
static const uint8_t DATA_FIELD_OFFSET = 6;
/**
* Space packet length for fixed size packets. This is the size of the whole packet data
* field. For the length field in the space packet this size will be substracted by one.
*/
2022-01-17 15:58:27 +01:00
static const uint16_t LENGTH_EMPTY_TC = 2; // Only CRC will be transported with the data field
/** This is the maximum length of a space packet as defined by the TAS ICD */
static const size_t MAX_COMMAND_SIZE = 1024;
2021-07-31 08:32:57 +02:00
static const size_t MAX_DATA_CAPACITY = 1016;
/** This is the maximum size of a space packet for the supervisor */
static const size_t MAX_PACKET_SIZE = 1024;
static const uint8_t SPACE_PACKET_HEADER_LENGTH = 6;
2022-01-17 15:58:27 +01:00
enum class SequenceFlags : uint8_t {
CONTINUED_PKT = 0b00,
FIRST_PKT = 0b01,
LAST_PKT = 0b10,
STANDALONE_PKT = 0b11
};
2022-01-17 15:58:27 +01:00
enum PoolIds : lp_id_t {
NUM_TMS,
TEMP_PS,
TEMP_PL,
2022-04-11 16:52:50 +02:00
HK_SOC_STATE,
2022-01-17 15:58:27 +01:00
NVM0_1_STATE,
NVM3_STATE,
MISSION_IO_STATE,
FMC_STATE,
NUM_TCS,
TEMP_SUP,
UPTIME,
CPULOAD,
AVAILABLEHEAP,
2022-04-11 16:52:50 +02:00
BR_SOC_STATE,
POWER_CYCLES,
2022-01-17 15:58:27 +01:00
BOOT_AFTER_MS,
BOOT_TIMEOUT_MS,
ACTIVE_NVM,
BP0_STATE,
BP1_STATE,
BP2_STATE,
2022-04-06 07:10:20 +02:00
BOOT_STATE,
BOOT_CYCLES,
2022-01-17 15:58:27 +01:00
LATCHUP_ID,
CNT0,
CNT1,
CNT2,
CNT3,
CNT4,
CNT5,
CNT6,
LATCHUP_RPT_TIME_SEC,
LATCHUP_RPT_TIME_MIN,
LATCHUP_RPT_TIME_HOUR,
LATCHUP_RPT_TIME_DAY,
LATCHUP_RPT_TIME_MON,
LATCHUP_RPT_TIME_YEAR,
LATCHUP_RPT_TIME_MSEC,
2022-04-11 16:52:50 +02:00
LATCHUP_RPT_IS_SET,
2022-04-13 11:56:37 +02:00
2022-04-22 08:55:57 +02:00
LATCHUP_HAPPENED_CNT_0,
LATCHUP_HAPPENED_CNT_1,
LATCHUP_HAPPENED_CNT_2,
LATCHUP_HAPPENED_CNT_3,
LATCHUP_HAPPENED_CNT_4,
LATCHUP_HAPPENED_CNT_5,
LATCHUP_HAPPENED_CNT_6,
ADC_DEVIATION_TRIGGERS_CNT,
TC_RECEIVED_CNT,
TM_AVAILABLE_CNT,
SUPERVISOR_BOOTS,
MPSOC_BOOTS,
MPSOC_BOOT_FAILED_ATTEMPTS,
MPSOC_POWER_UP,
MPSOC_UPDATES,
LAST_RECVD_TC,
2022-04-21 16:30:23 +02:00
ADC_RAW_0,
ADC_RAW_1,
ADC_RAW_2,
ADC_RAW_3,
ADC_RAW_4,
ADC_RAW_5,
ADC_RAW_6,
ADC_RAW_7,
ADC_RAW_8,
ADC_RAW_9,
ADC_RAW_10,
ADC_RAW_11,
ADC_RAW_12,
ADC_RAW_13,
ADC_RAW_14,
ADC_RAW_15,
ADC_ENG_0,
ADC_ENG_1,
ADC_ENG_2,
ADC_ENG_3,
ADC_ENG_4,
ADC_ENG_5,
ADC_ENG_6,
ADC_ENG_7,
ADC_ENG_8,
ADC_ENG_9,
ADC_ENG_10,
ADC_ENG_11,
ADC_ENG_12,
ADC_ENG_13,
ADC_ENG_14,
ADC_ENG_15
};
static const uint8_t HK_SET_ENTRIES = 13;
2022-04-06 17:27:44 +02:00
static const uint8_t BOOT_REPORT_SET_ENTRIES = 10;
2021-08-20 06:56:29 +02:00
static const uint8_t LATCHUP_RPT_SET_ENTRIES = 16;
2022-04-22 08:55:57 +02:00
static const uint8_t LOGGING_RPT_SET_ENTRIES = 16;
2022-04-21 16:30:23 +02:00
static const uint8_t ADC_RPT_SET_ENTRIES = 32;
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;
2022-05-07 12:01:05 +02:00
static const uint32_t LOGGING_RPT_ID = LOGGING_REPORT;
static const uint32_t ADC_REPORT_SET_ID = ADC_REPORT;
2022-04-19 13:33:37 +02:00
namespace recv_timeout {
// Erase memory can require up to 60 seconds for execution
static const uint32_t ERASE_MEMORY = 60000;
2022-04-27 16:08:17 +02:00
static const uint32_t UPDATE_STATUS_REPORT = 70000;
} // namespace recv_timeout
2022-04-19 13:33:37 +02:00
/**
2022-04-10 18:46:39 +02:00
* @brief This class creates a space packet containing only the header data and the CRC.
*/
2022-04-10 18:46:39 +02:00
class ApidOnlyPacket : public SpacePacket {
2022-01-17 15:58:27 +01:00
public:
/**
* @brief Constructor
*
* @param apid The APID to set in the space packet.
*
* @note Sequence count of empty packet is always 1.
*/
2022-04-10 18:46:39 +02:00
ApidOnlyPacket(uint16_t apid) : SpacePacket(LENGTH_EMPTY_TC - 1, true, apid, 1) { calcCrc(); }
2022-01-17 15:58:27 +01:00
private:
/**
* @brief CRC calculation which involves only the header in an empty packet
*/
void calcCrc() {
/* Calculate crc */
uint16_t crc = CRC::crc16ccitt(this->localData.byteStream, sizeof(CCSDSPrimaryHeader));
/* Add crc to packet data field of space packet */
size_t serializedSize = 0;
uint8_t* crcPos = this->localData.fields.buffer;
SerializeAdapter::serialize<uint16_t>(&crc, &crcPos, &serializedSize, sizeof(crc),
SerializeIF::Endianness::BIG);
}
};
/**
* @brief This class can be used to generate the space packet selecting the boot image of
* of the MPSoC.
*/
2022-01-17 15:58:27 +01:00
class MPSoCBootSelect : public SpacePacket {
public:
2022-05-13 18:37:16 +02:00
static const uint8_t NVM0 = 0;
static const uint8_t NVM1 = 1;
2022-01-17 15:58:27 +01:00
/**
* @brief Constructor
*
* @param mem The memory to boot from: NVM0 (0), NVM1 (1)
* @param bp0 Partition pin 0
* @param bp1 Partition pin 1
* @param bp2 Partition pin 2
*/
2022-05-13 18:37:16 +02:00
MPSoCBootSelect(uint8_t mem = 0, uint8_t bp0 = 0, uint8_t bp1 = 0, uint8_t bp2 = 0)
2022-01-17 15:58:27 +01:00
: SpacePacket(DATA_FIELD_LENGTH - 1, true, APID_SEL_MPSOC_BOOT_IMAGE, DEFAULT_SEQUENCE_COUNT),
mem(mem),
bp0(bp0),
bp1(bp1),
bp2(bp2) {
initPacket();
}
private:
static const uint16_t DATA_FIELD_LENGTH = 6;
static const uint16_t DEFAULT_SEQUENCE_COUNT = 1;
static const uint8_t MEM_OFFSET = 0;
static const uint8_t BP0_OFFSET = 1;
static const uint8_t BP1_OFFSET = 2;
static const uint8_t BP2_OFFSET = 3;
static const uint16_t CRC_OFFSET = DATA_FIELD_LENGTH - 2;
uint8_t mem = 0;
uint8_t bp0 = 0;
uint8_t bp1 = 0;
uint8_t bp2 = 0;
void initPacket() {
uint8_t* data_field_start = this->localData.fields.buffer;
std::memcpy(data_field_start + MEM_OFFSET, &mem, sizeof(mem));
std::memcpy(data_field_start + BP0_OFFSET, &bp0, sizeof(bp0));
std::memcpy(data_field_start + BP1_OFFSET, &bp1, sizeof(bp1));
std::memcpy(data_field_start + BP2_OFFSET, &bp2, sizeof(bp2));
/* Calculate crc */
uint16_t crc = CRC::crc16ccitt(this->localData.byteStream,
sizeof(CCSDSPrimaryHeader) + DATA_FIELD_LENGTH - 2);
/* Add crc to packet data field of space packet */
size_t serializedSize = 0;
uint8_t* crcPos = this->localData.fields.buffer + CRC_OFFSET;
SerializeAdapter::serialize<uint16_t>(&crc, &crcPos, &serializedSize, sizeof(crc),
SerializeIF::Endianness::BIG);
}
};
2022-05-05 19:18:39 +02:00
/**
* @brief This class creates the command to enable or disable the NVMs connected to the
* supervisor.
*/
class EnableNvms : public SpacePacket {
public:
/**
* @brief Constructor
*
* @param mem The memory to boot from: NVM0 (0), NVM1 (1)
* @param bp0 Partition pin 0
* @param bp1 Partition pin 1
* @param bp2 Partition pin 2
*/
EnableNvms(uint8_t nvm01, uint8_t nvm3)
: SpacePacket(DATA_FIELD_LENGTH - 1, true, APID_ENABLE_NVMS, DEFAULT_SEQUENCE_COUNT),
nvm01(nvm01),
nvm3(nvm3) {
initPacket();
}
private:
static const uint16_t DEFAULT_SEQUENCE_COUNT = 1;
static const uint8_t DATA_FIELD_LENGTH = 4;
static const uint8_t CRC_OFFSET = 2;
uint8_t nvm01 = 0;
uint8_t nvm3 = 0;
void initPacket() {
*(this->localData.fields.buffer) = nvm01;
*(this->localData.fields.buffer + 1) = nvm3;
/* Calculate crc */
uint16_t crc = CRC::crc16ccitt(this->localData.byteStream,
sizeof(CCSDSPrimaryHeader) + DATA_FIELD_LENGTH - 2);
/* Add crc to packet data field of space packet */
size_t serializedSize = 0;
uint8_t* crcPos = this->localData.fields.buffer + CRC_OFFSET;
SerializeAdapter::serialize<uint16_t>(&crc, &crcPos, &serializedSize, sizeof(crc),
SerializeIF::Endianness::BIG);
}
};
/**
* @brief This class generates the space packet to update the time of the PLOC supervisor.
*/
2022-01-17 15:58:27 +01:00
class SetTimeRef : public SpacePacket {
public:
SetTimeRef(Clock::TimeOfDay_t* time)
: SpacePacket(DATA_FIELD_LENGTH - 1, true, APID_SET_TIME_REF, DEFAULT_SEQUENCE_COUNT) {
initPacket(time);
}
private:
2022-04-06 07:10:20 +02:00
static const uint16_t DATA_FIELD_LENGTH = 10;
2022-01-17 15:58:27 +01:00
static const uint16_t DEFAULT_SEQUENCE_COUNT = 1;
static const uint16_t CRC_OFFSET = DATA_FIELD_LENGTH - 2;
2022-04-06 07:10:20 +02:00
static const uint16_t SYNC = 0x8000;
2022-01-17 15:58:27 +01:00
void initPacket(Clock::TimeOfDay_t* time) {
size_t serializedSize = 0;
2022-04-10 18:46:39 +02:00
uint8_t* dataFieldPtr = this->localData.fields.buffer;
2022-04-06 07:10:20 +02:00
uint16_t milliseconds = static_cast<uint16_t>(time->usecond / 1000) | SYNC;
2022-04-10 18:46:39 +02:00
SerializeAdapter::serialize<uint16_t>(&milliseconds, &dataFieldPtr, &serializedSize,
2022-04-06 07:10:20 +02:00
sizeof(milliseconds), SerializeIF::Endianness::BIG);
uint8_t second = static_cast<uint8_t>(time->second);
2022-01-17 15:58:27 +01:00
serializedSize = 0;
2022-04-10 18:46:39 +02:00
SerializeAdapter::serialize<uint8_t>(&second, &dataFieldPtr, &serializedSize,
2022-04-06 07:10:20 +02:00
sizeof(time->second), SerializeIF::Endianness::BIG);
uint8_t minute = static_cast<uint8_t>(time->minute);
2022-01-17 15:58:27 +01:00
serializedSize = 0;
2022-04-10 18:46:39 +02:00
SerializeAdapter::serialize<uint8_t>(&minute, &dataFieldPtr, &serializedSize,
2022-04-06 07:10:20 +02:00
sizeof(time->minute), SerializeIF::Endianness::BIG);
uint8_t hour = static_cast<uint8_t>(time->hour);
2022-01-17 15:58:27 +01:00
serializedSize = 0;
2022-04-11 16:52:50 +02:00
SerializeAdapter::serialize<uint8_t>(&hour, &dataFieldPtr, &serializedSize, sizeof(time->hour),
SerializeIF::Endianness::BIG);
2022-04-06 07:10:20 +02:00
uint8_t day = static_cast<uint8_t>(time->day);
2022-01-17 15:58:27 +01:00
serializedSize = 0;
2022-04-10 18:46:39 +02:00
SerializeAdapter::serialize<uint8_t>(&day, &dataFieldPtr, &serializedSize, sizeof(time->day),
2022-04-06 07:10:20 +02:00
SerializeIF::Endianness::BIG);
uint8_t month = static_cast<uint8_t>(time->month);
2022-01-17 15:58:27 +01:00
serializedSize = 0;
2022-04-10 18:46:39 +02:00
SerializeAdapter::serialize<uint8_t>(&month, &dataFieldPtr, &serializedSize,
2022-04-06 07:10:20 +02:00
sizeof(time->month), SerializeIF::Endianness::BIG);
2022-04-06 17:27:44 +02:00
uint8_t year = static_cast<uint8_t>(time->year - 1900);
2022-01-17 15:58:27 +01:00
serializedSize = 0;
2022-04-11 16:52:50 +02:00
SerializeAdapter::serialize<uint8_t>(&year, &dataFieldPtr, &serializedSize, sizeof(time->year),
SerializeIF::Endianness::BIG);
2022-01-17 15:58:27 +01:00
serializedSize = 0;
/* Calculate crc */
uint16_t crc = CRC::crc16ccitt(this->localData.byteStream,
sizeof(CCSDSPrimaryHeader) + DATA_FIELD_LENGTH - 2);
2022-04-10 18:46:39 +02:00
SerializeAdapter::serialize<uint16_t>(&crc, &dataFieldPtr, &serializedSize, sizeof(crc),
2022-01-17 15:58:27 +01:00
SerializeIF::Endianness::BIG);
}
};
/**
* @brief This class can be used to generate the set boot timout command.
*/
2022-01-17 15:58:27 +01:00
class SetBootTimeout : public SpacePacket {
public:
/**
* @brief Constructor
*
* @param timeout The boot timeout in milliseconds.
*/
SetBootTimeout(uint32_t timeout)
: SpacePacket(DATA_FIELD_LENGTH - 1, true, APID_SET_BOOT_TIMEOUT, 1), timeout(timeout) {
initPacket();
}
private:
uint32_t timeout = 0;
/** boot timeout value (uint32_t) and crc (uint16_t) */
static const uint16_t DATA_FIELD_LENGTH = 6;
void initPacket() {
size_t serializedSize = 0;
2022-04-10 18:46:39 +02:00
uint8_t* dataFieldPtr = this->localData.fields.buffer;
2022-04-11 16:52:50 +02:00
SerializeAdapter::serialize<uint32_t>(&timeout, &dataFieldPtr, &serializedSize, sizeof(timeout),
SerializeIF::Endianness::BIG);
2022-01-17 15:58:27 +01:00
/* Calculate crc */
uint16_t crc = CRC::crc16ccitt(this->localData.byteStream,
sizeof(CCSDSPrimaryHeader) + DATA_FIELD_LENGTH - 2);
/* Add crc to packet data field of space packet */
serializedSize = 0;
2022-04-10 18:46:39 +02:00
SerializeAdapter::serialize<uint16_t>(&crc, &dataFieldPtr, &serializedSize, sizeof(crc),
2022-01-17 15:58:27 +01:00
SerializeIF::Endianness::BIG);
}
};
2021-07-22 08:06:04 +02:00
/**
* @brief This class can be used to generate the space packet to set the maximum boot tries.
*/
2022-01-17 15:58:27 +01:00
class SetRestartTries : public SpacePacket {
public:
/**
* @brief Constructor
*
* @param restartTries Maximum restart tries to set.
*/
SetRestartTries(uint8_t restartTries)
: SpacePacket(DATA_FIELD_LENGTH - 1, true, APID_SET_MAX_RESTART_TRIES, 1),
restartTries(restartTries) {
initPacket();
}
private:
uint8_t restartTries = 0;
/** Restart tries value (uint8_t) and crc (uint16_t) */
static const uint16_t DATA_FIELD_LENGTH = 3;
void initPacket() {
2022-04-10 18:46:39 +02:00
uint8_t* dataFieldPtr = this->localData.fields.buffer;
*dataFieldPtr = restartTries;
2022-01-17 15:58:27 +01:00
uint16_t crc = CRC::crc16ccitt(this->localData.byteStream,
sizeof(CCSDSPrimaryHeader) + DATA_FIELD_LENGTH - 2);
size_t serializedSize = 0;
2022-04-10 18:46:39 +02:00
uint8_t* crcPtr = dataFieldPtr + 1;
2022-01-17 15:58:27 +01:00
SerializeAdapter::serialize<uint16_t>(&crc, &crcPtr, &serializedSize, sizeof(crc),
SerializeIF::Endianness::BIG);
}
2021-07-22 08:06:04 +02:00
};
/**
* @brief With this class the space packet can be generated to disable to periodic transmission
* of housekeeping data. Normally, this will be disabled by default. However, adding this
* command can be useful for debugging.
*/
2022-01-17 15:58:27 +01:00
class DisablePeriodicHkTransmission : public SpacePacket {
public:
/**
* @brief Constructor
*/
DisablePeriodicHkTransmission() : SpacePacket(DATA_FIELD_LENGTH - 1, true, APID_DISABLE_HK, 1) {
initPacket();
}
private:
uint8_t disableHk = 0;
/** Restart tries value (uint8_t) and crc (uint16_t) */
static const uint16_t DATA_FIELD_LENGTH = 3;
void initPacket() {
2022-04-10 18:46:39 +02:00
uint8_t* dataFieldPtr = this->localData.fields.buffer;
*dataFieldPtr = disableHk;
2022-01-17 15:58:27 +01:00
uint16_t crc = CRC::crc16ccitt(this->localData.byteStream,
sizeof(CCSDSPrimaryHeader) + DATA_FIELD_LENGTH - 2);
size_t serializedSize = 0;
2022-04-10 18:46:39 +02:00
uint8_t* crcPtr = dataFieldPtr + 1;
2022-01-17 15:58:27 +01:00
SerializeAdapter::serialize<uint16_t>(&crc, &crcPtr, &serializedSize, sizeof(crc),
SerializeIF::Endianness::BIG);
}
};
/**
* @brief This class packages the command to enable of disable the latchup alert.
*
* @details There are 7 different latchup alerts.
*/
2022-01-17 15:58:27 +01:00
class LatchupAlert : public SpacePacket {
public:
/**
* @brief Constructor
*
* @param state true - enable, false - disable
* @param latchupId Identifies the latchup to enable/disable (0 - 0.85V, 1 - 1.8V, 2 - MISC,
* 3 - 3.3V, 4 - NVM_4XO, 5 - MISSION, 6 - SAFECOTS)
*/
LatchupAlert(bool state, uint8_t latchupId)
: SpacePacket(DATA_FIELD_LENGTH - 1, true), latchupId(latchupId) {
if (state) {
this->setAPID(APID_ENABLE_LATCHUP_ALERT);
} else {
this->setAPID(APID_DISABLE_LATCHUP_ALERT);
}
this->setPacketSequenceCount(DEFAULT_SEQUENCE_COUNT);
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 latchupId = 0;
void initPacket() {
size_t serializedSize = 0;
2022-04-13 11:56:37 +02:00
uint8_t* data_field_ptr = this->localData.fields.buffer;
SerializeAdapter::serialize<uint8_t>(&latchupId, &data_field_ptr, &serializedSize,
2022-01-17 15:58:27 +01:00
sizeof(latchupId), 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);
}
};
2022-01-17 15:58:27 +01:00
class SetAlertlimit : 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 dutycycle
*/
SetAlertlimit(uint8_t latchupId, uint32_t dutycycle)
: SpacePacket(DATA_FIELD_LENGTH - 1, true, APID_SET_ALERT_LIMIT, DEFAULT_SEQUENCE_COUNT),
latchupId(latchupId),
dutycycle(dutycycle) {
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 dutycycle = 0;
void initPacket() {
size_t serializedSize = 0;
2022-04-10 18:46:39 +02:00
uint8_t* dataFieldPtr = this->localData.fields.buffer;
SerializeAdapter::serialize<uint8_t>(&latchupId, &dataFieldPtr, &serializedSize,
2022-01-17 15:58:27 +01:00
sizeof(latchupId), SerializeIF::Endianness::BIG);
serializedSize = 0;
2022-04-10 18:46:39 +02:00
SerializeAdapter::serialize<uint32_t>(&dutycycle, &dataFieldPtr, &serializedSize,
2022-01-17 15:58:27 +01:00
sizeof(dutycycle), 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.
*/
2022-01-17 15:58:27 +01:00
class SetAdcEnabledChannels : public SpacePacket {
public:
/**
* @brief Constructor
*
* @param ch Defines channels to be enabled or disabled.
*/
SetAdcEnabledChannels(uint16_t ch)
: SpacePacket(DATA_FIELD_LENGTH - 1, true, APID_SET_ADC_ENABLED_CHANNELS,
DEFAULT_SEQUENCE_COUNT),
ch(ch) {
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;
uint16_t ch = 0;
void initPacket() {
size_t serializedSize = 0;
2022-04-10 18:46:39 +02:00
uint8_t* dataFieldPtr = this->localData.fields.buffer;
SerializeAdapter::serialize<uint16_t>(&ch, &dataFieldPtr, &serializedSize, sizeof(ch),
2022-01-17 15:58:27 +01:00
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 configures the window size and striding step of
* the moving average filter applied to the ADC readings.
*/
2022-01-17 15:58:27 +01:00
class SetAdcWindowAndStride : public SpacePacket {
public:
/**
* @brief Constructor
*
* @param windowSize
* @param stridingStepSize
*/
SetAdcWindowAndStride(uint16_t windowSize, uint16_t stridingStepSize)
: SpacePacket(DATA_FIELD_LENGTH - 1, true, APID_SET_ADC_WINDOW_AND_STRIDE,
DEFAULT_SEQUENCE_COUNT),
windowSize(windowSize),
stridingStepSize(stridingStepSize) {
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;
uint16_t windowSize = 0;
uint16_t stridingStepSize = 0;
void initPacket() {
size_t serializedSize = 0;
2022-04-10 18:46:39 +02:00
uint8_t* dataFieldPtr = this->localData.fields.buffer;
SerializeAdapter::serialize<uint16_t>(&windowSize, &dataFieldPtr, &serializedSize,
2022-01-17 15:58:27 +01:00
sizeof(windowSize), SerializeIF::Endianness::BIG);
serializedSize = 0;
2022-04-10 18:46:39 +02:00
SerializeAdapter::serialize<uint16_t>(&stridingStepSize, &dataFieldPtr, &serializedSize,
2022-01-17 15:58:27 +01:00
sizeof(stridingStepSize), 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 ADC trigger threshold.
*/
2022-01-17 15:58:27 +01:00
class SetAdcThreshold : public SpacePacket {
public:
/**
* @brief Constructor
*
* @param threshold
*/
SetAdcThreshold(uint32_t threshold)
: SpacePacket(DATA_FIELD_LENGTH - 1, true, APID_SET_ADC_THRESHOLD, DEFAULT_SEQUENCE_COUNT),
threshold(threshold) {
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 threshold = 0;
void initPacket() {
size_t serializedSize = 0;
2022-04-10 18:46:39 +02:00
uint8_t* dataFieldPtr = this->localData.fields.buffer;
SerializeAdapter::serialize<uint32_t>(&threshold, &dataFieldPtr, &serializedSize,
2022-01-17 15:58:27 +01:00
sizeof(threshold), 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);
}
2021-07-28 11:55:16 +02:00
};
2021-07-28 19:34:10 +02:00
/**
* @brief This class packages the space packet to run auto EM tests.
*/
2022-01-17 15:58:27 +01:00
class RunAutoEmTests : public SpacePacket {
public:
/**
* @brief Constructor
*
* @param test 1 - complete EM test, 2 - Short test (only memory readback NVM0,1,3)
*/
RunAutoEmTests(uint8_t test)
: SpacePacket(DATA_FIELD_LENGTH - 1, true, APID_RUN_AUTO_EM_TESTS, DEFAULT_SEQUENCE_COUNT),
test(test) {
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 test = 0;
void initPacket() {
size_t serializedSize = 0;
2022-04-10 18:46:39 +02:00
uint8_t* dataFieldPtr = this->localData.fields.buffer;
SerializeAdapter::serialize<uint8_t>(&test, &dataFieldPtr, &serializedSize, sizeof(test),
2022-01-17 15:58:27 +01:00
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);
}
2021-07-28 19:34:10 +02:00
};
/**
* @brief This class packages the space packet to wipe or dump parts of the MRAM.
*/
2022-01-17 15:58:27 +01:00
class MramCmd : public SpacePacket {
public:
enum class MramAction { WIPE, DUMP };
/**
* @brief Constructor
*
* @param start Start address of the MRAM section to wipe or dump
* @param stop End address of the MRAM section to wipe or dump
* @param action Dump or wipe MRAM
*
* @note The content at the stop address is excluded from the dump or wipe operation.
*/
MramCmd(uint32_t start, uint32_t stop, MramAction action)
: SpacePacket(DATA_FIELD_LENGTH - 1, true, APID_IDLE_PACKET, DEFAULT_SEQUENCE_COUNT),
start(start),
stop(stop) {
if (action == MramAction::WIPE) {
this->setAPID(APID_WIPE_MRAM);
} else if (action == MramAction::DUMP) {
this->setAPID(APID_DUMP_MRAM);
} else {
sif::debug << "WipeMram: Invalid action specified";
}
initPacket();
}
private:
static const uint16_t DATA_FIELD_LENGTH = 8;
static const uint16_t DEFAULT_SEQUENCE_COUNT = 1;
static const uint16_t CRC_OFFSET = DATA_FIELD_LENGTH - 2;
uint32_t start = 0;
uint32_t stop = 0;
void initPacket() {
uint8_t concatBuffer[6];
concatBuffer[0] = static_cast<uint8_t>(start >> 16);
concatBuffer[1] = static_cast<uint8_t>(start >> 8);
concatBuffer[2] = static_cast<uint8_t>(start);
concatBuffer[3] = static_cast<uint8_t>(stop >> 16);
concatBuffer[4] = static_cast<uint8_t>(stop >> 8);
concatBuffer[5] = static_cast<uint8_t>(stop);
2022-04-10 18:46:39 +02:00
uint8_t* dataFieldPtr = this->localData.fields.buffer;
std::memcpy(dataFieldPtr, concatBuffer, sizeof(concatBuffer));
2022-01-17 15:58:27 +01:00
size_t 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);
}
};
2021-08-02 15:28:57 +02:00
/**
* @brief This class packages the space packet change the state of a GPIO. This command is only
* required for ground testing.
*/
2022-01-17 15:58:27 +01:00
class SetGpio : public SpacePacket {
public:
/**
* @brief Constructor
*
* @param port
* @param pin
* @param val
*/
SetGpio(uint8_t port, uint8_t pin, uint8_t val)
: SpacePacket(DATA_FIELD_LENGTH - 1, true, APID_SET_GPIO, DEFAULT_SEQUENCE_COUNT),
port(port),
pin(pin),
val(val) {
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 port = 0;
uint8_t pin = 0;
uint8_t val = 0;
void initPacket() {
size_t serializedSize = 0;
2022-04-10 18:46:39 +02:00
uint8_t* dataFieldPtr = this->localData.fields.buffer;
SerializeAdapter::serialize<uint8_t>(&port, &dataFieldPtr, &serializedSize, sizeof(port),
2022-01-17 15:58:27 +01:00
SerializeIF::Endianness::BIG);
serializedSize = 0;
2022-04-10 18:46:39 +02:00
SerializeAdapter::serialize<uint8_t>(&pin, &dataFieldPtr, &serializedSize, sizeof(pin),
2022-01-17 15:58:27 +01:00
SerializeIF::Endianness::BIG);
serializedSize = 0;
2022-04-10 18:46:39 +02:00
SerializeAdapter::serialize<uint8_t>(&val, &dataFieldPtr, &serializedSize, sizeof(val),
2022-01-17 15:58:27 +01:00
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);
}
2021-08-02 15:28:57 +02:00
};
/**
* @brief This class packages the space packet causing the supervisor print the state of a GPIO
* to the debug output.
*/
2022-01-17 15:58:27 +01:00
class ReadGpio : public SpacePacket {
public:
/**
* @brief Constructor
*
* @param port
* @param pin
*/
ReadGpio(uint8_t port, uint8_t pin)
: SpacePacket(DATA_FIELD_LENGTH - 1, true, APID_READ_GPIO, DEFAULT_SEQUENCE_COUNT),
port(port),
pin(pin) {
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 port = 0;
uint8_t pin = 0;
void initPacket() {
size_t serializedSize = 0;
2022-04-10 18:46:39 +02:00
uint8_t* dataFieldPtr = this->localData.fields.buffer;
SerializeAdapter::serialize<uint8_t>(&port, &dataFieldPtr, &serializedSize, sizeof(port),
2022-01-17 15:58:27 +01:00
SerializeIF::Endianness::BIG);
serializedSize = 0;
2022-04-10 18:46:39 +02:00
SerializeAdapter::serialize<uint8_t>(&pin, &dataFieldPtr, &serializedSize, sizeof(pin),
2022-01-17 15:58:27 +01:00
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);
}
2021-08-02 15:28:57 +02:00
};
/**
* @brief This class packages the space packet to perform the factory reset. The op parameter is
* optional.
*
* @details: Without OP: All MRAM entries will be cleared.
* OP = 0x01: Only the mirror entries will be wiped.
* OP = 0x02: Only the circular entries will be wiped.
*/
2022-01-17 15:58:27 +01:00
class FactoryReset : public SpacePacket {
public:
enum class Op { CLEAR_ALL, MIRROR_ENTRIES, CIRCULAR_ENTRIES };
/**
* @brief Constructor
*
* @param op
*/
FactoryReset(Op op) : SpacePacket(0, true, APID_FACTORY_RESET, DEFAULT_SEQUENCE_COUNT), op(op) {
initPacket();
}
private:
uint16_t packetLen = 1; // only CRC in data field
static const uint16_t DEFAULT_SEQUENCE_COUNT = 1;
uint8_t crcOffset = 0;
Op op = Op::CLEAR_ALL;
void initPacket() {
2022-04-10 18:46:39 +02:00
uint8_t* dataFieldPtr = this->localData.fields.buffer;
2022-01-17 15:58:27 +01:00
switch (op) {
case Op::MIRROR_ENTRIES:
2022-04-10 18:46:39 +02:00
*dataFieldPtr = 1;
2022-01-17 15:58:27 +01:00
packetLen = 2;
crcOffset = 1;
break;
case Op::CIRCULAR_ENTRIES:
2022-04-10 18:46:39 +02:00
*dataFieldPtr = 2;
2022-01-17 15:58:27 +01:00
packetLen = 2;
crcOffset = 1;
break;
default:
break;
}
this->setPacketDataLength(packetLen);
size_t serializedSize = 0;
uint16_t crc =
CRC::crc16ccitt(this->localData.byteStream, sizeof(CCSDSPrimaryHeader) + packetLen - 1);
uint8_t* crcPos = this->localData.fields.buffer + crcOffset;
SerializeAdapter::serialize<uint16_t>(&crc, &crcPos, &serializedSize, sizeof(crc),
SerializeIF::Endianness::BIG);
}
2021-08-02 15:28:57 +02:00
};
2021-08-05 16:37:39 +02:00
class SupvTcSpacePacket : public SpacePacket {
2022-01-17 15:58:27 +01:00
public:
2022-04-11 16:52:50 +02:00
/**
* @brief Constructor
*
* @param payloadDataLen Length of data field without CRC
*/
SupvTcSpacePacket(uint16_t payloadDataLen, uint16_t apid)
2022-01-17 15:58:27 +01:00
: SpacePacket(payloadDataLen + 1, true, apid, DEFAULT_SEQUENCE_COUNT),
payloadDataLen(payloadDataLen) {}
void makeCrc() {
size_t serializedSize = 0;
uint16_t crc =
CRC::crc16ccitt(this->localData.byteStream, sizeof(CCSDSPrimaryHeader) + payloadDataLen);
uint8_t* crcPos = this->localData.fields.buffer + payloadDataLen;
SerializeAdapter::serialize<uint16_t>(&crc, &crcPos, &serializedSize, sizeof(crc),
SerializeIF::Endianness::BIG);
}
private:
// The sequence count of most of the TC packets for the supervisor is 1.
static const uint16_t DEFAULT_SEQUENCE_COUNT = 1;
// The size of the payload data (data field without crc size)
size_t payloadDataLen = 0;
2021-08-05 16:37:39 +02:00
};
2022-04-11 16:52:50 +02:00
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);
}
};
2021-08-05 16:37:39 +02:00
/**
2022-04-10 18:46:39 +02:00
* @brief Command to request CRC over memory region of the supervisor.
2021-08-05 16:37:39 +02:00
*/
2022-04-10 18:46:39 +02:00
class CheckMemory : public SupvTcSpacePacket {
2022-01-17 15:58:27 +01:00
public:
/**
* @brief Constructor
*
2022-04-10 18:46:39 +02:00
* @param memoryId
* @param startAddress Start address of CRC calculation
* @param length Length in bytes of memory region
2022-01-17 15:58:27 +01:00
*/
2022-04-10 18:46:39 +02:00
CheckMemory(uint8_t memoryId, uint32_t startAddress, uint32_t length)
: SupvTcSpacePacket(PAYLOAD_LENGTH, APID_CHECK_MEMORY),
memoryId(memoryId),
startAddress(startAddress),
length(length) {
2022-01-17 15:58:27 +01:00
initPacket();
makeCrc();
}
private:
2022-04-10 18:46:39 +02:00
static const uint16_t PAYLOAD_LENGTH = 10; // length without CRC field
2022-01-17 15:58:27 +01:00
2022-04-10 18:46:39 +02:00
uint8_t memoryId = 0;
uint8_t n = 1;
uint32_t startAddress = 0;
uint32_t length = 0;
2022-01-17 15:58:27 +01:00
void initPacket() {
size_t serializedSize = 0;
2022-04-10 18:46:39 +02:00
uint8_t* dataFieldPtr = this->localData.fields.buffer;
2022-04-11 16:52:50 +02:00
SerializeAdapter::serialize<uint8_t>(&memoryId, &dataFieldPtr, &serializedSize,
sizeof(memoryId), SerializeIF::Endianness::BIG);
2022-01-17 15:58:27 +01:00
serializedSize = 0;
2022-04-10 18:46:39 +02:00
SerializeAdapter::serialize<uint8_t>(&n, &dataFieldPtr, &serializedSize, sizeof(n),
SerializeIF::Endianness::BIG);
2022-01-17 15:58:27 +01:00
serializedSize = 0;
2022-04-10 18:46:39 +02:00
SerializeAdapter::serialize<uint32_t>(&startAddress, &dataFieldPtr, &serializedSize,
sizeof(startAddress), SerializeIF::Endianness::BIG);
2022-01-17 15:58:27 +01:00
serializedSize = 0;
2022-04-11 16:52:50 +02:00
SerializeAdapter::serialize<uint32_t>(&length, &dataFieldPtr, &serializedSize, sizeof(length),
SerializeIF::Endianness::BIG);
2022-01-17 15:58:27 +01:00
}
2021-08-05 16:37:39 +02:00
};
/**
* @brief This class packages the space packet transporting a part of an MPSoC update.
*/
2022-04-10 18:46:39 +02:00
class WriteMemory : public SupvTcSpacePacket {
2022-01-17 15:58:27 +01:00
public:
2022-04-10 18:46:39 +02:00
/**
* @brief Constructor
*
* @param seqFlags Sequence flags
* @param sequenceCount Sequence count (first update packet expects 1 as sequence count)
* @param updateData Pointer to buffer containing update data
*/
WriteMemory(SequenceFlags seqFlags, uint16_t sequenceCount, uint8_t memoryId,
uint32_t startAddress, uint16_t length, uint8_t* updateData)
: SupvTcSpacePacket(META_DATA_LENGTH + length, APID_WRITE_MEMORY),
2022-04-06 08:36:34 +02:00
memoryId(memoryId),
startAddress(startAddress),
length(length) {
2022-04-10 18:46:39 +02:00
if (this->length > CHUNK_MAX) {
sif::error << "WriteMemory::WriteMemory: Invalid length" << std::endl;
}
2022-04-06 08:36:34 +02:00
initPacket(updateData);
2022-04-10 18:46:39 +02:00
this->setSequenceFlags(static_cast<uint8_t>(seqFlags));
this->setPacketSequenceCount(sequenceCount);
2022-04-06 08:36:34 +02:00
makeCrc();
}
2021-08-05 16:37:39 +02:00
2022-04-10 18:46:39 +02:00
// Although the space packet has space left for 1010 bytes of data to supervisor can only process
2022-04-24 12:34:08 +02:00
// update packets with a maximum of 512 bytes.
2022-04-10 18:46:39 +02:00
static const uint16_t CHUNK_MAX = 512;
2022-04-06 08:36:34 +02:00
private:
static const uint16_t META_DATA_LENGTH = 8;
2022-04-10 18:46:39 +02:00
uint8_t memoryId = 0;
2022-04-06 08:36:34 +02:00
uint8_t n = 1;
uint32_t startAddress = 0;
uint16_t length = 0;
void initPacket(uint8_t* updateData) {
size_t serializedSize = 0;
2022-04-10 18:46:39 +02:00
uint8_t* dataFieldPtr = this->localData.fields.buffer;
SerializeAdapter::serialize<uint8_t>(&memoryId, &dataFieldPtr, &serializedSize,
2022-04-06 08:36:34 +02:00
sizeof(memoryId), SerializeIF::Endianness::BIG);
serializedSize = 0;
2022-04-10 18:46:39 +02:00
SerializeAdapter::serialize<uint8_t>(&n, &dataFieldPtr, &serializedSize, sizeof(n),
SerializeIF::Endianness::BIG);
2022-04-06 08:36:34 +02:00
serializedSize = 0;
2022-04-10 18:46:39 +02:00
SerializeAdapter::serialize<uint32_t>(&startAddress, &dataFieldPtr, &serializedSize,
2022-04-06 08:36:34 +02:00
sizeof(startAddress), SerializeIF::Endianness::BIG);
serializedSize = 0;
2022-04-10 18:46:39 +02:00
SerializeAdapter::serialize<uint16_t>(&length, &dataFieldPtr, &serializedSize, sizeof(length),
SerializeIF::Endianness::BIG);
std::memcpy(dataFieldPtr, updateData, length);
if (length % 2 != 0) {
2022-04-27 16:08:17 +02:00
this->setPacketDataLength(length + sizeof(CCSDSPrimaryHeader) + CRC_SIZE - 1);
2022-04-10 18:46:39 +02:00
// The data field must be two bytes aligned. Thus, in case the number of bytes to write is odd
// a value of zero is added here
*(dataFieldPtr + length + 1) = 0;
}
2022-04-06 08:36:34 +02:00
}
};
2022-04-11 16:52:50 +02:00
/**
* @brief This class can be used to package the update available or update verify command.
*/
class EraseMemory : public SupvTcSpacePacket {
public:
EraseMemory(uint8_t memoryId, uint32_t startAddress, uint32_t length)
: SupvTcSpacePacket(PAYLOAD_LENGTH, APID_ERASE_MEMORY),
memoryId(memoryId),
startAddress(startAddress),
length(length) {
initPacket();
makeCrc();
}
private:
static const uint16_t PAYLOAD_LENGTH = 10; // length without CRC field
uint8_t memoryId = 0;
uint8_t n = 1;
uint32_t startAddress = 0;
uint32_t length = 0;
void initPacket() {
size_t serializedSize = 0;
uint8_t* dataFieldPtr = this->localData.fields.buffer;
SerializeAdapter::serialize<uint8_t>(&memoryId, &dataFieldPtr, &serializedSize,
sizeof(memoryId), SerializeIF::Endianness::BIG);
serializedSize = 0;
SerializeAdapter::serialize<uint8_t>(&n, &dataFieldPtr, &serializedSize, sizeof(n),
SerializeIF::Endianness::BIG);
serializedSize = 0;
SerializeAdapter::serialize<uint32_t>(&startAddress, &dataFieldPtr, &serializedSize,
sizeof(startAddress), SerializeIF::Endianness::BIG);
serializedSize = 0;
SerializeAdapter::serialize<uint32_t>(&length, &dataFieldPtr, &serializedSize, sizeof(length),
SerializeIF::Endianness::BIG);
}
};
/**
* @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;
};
2022-04-13 11:56:37 +02:00
/**
* @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;
};
2022-04-11 16:52:50 +02:00
/**
* @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) {}
2022-04-13 11:56:37 +02:00
/**
* @brief Returns the payload data length (data field length without CRC)
*/
uint16_t getPayloadDataLength() { return this->getPacketDataLength() - 1; }
2022-04-13 11:56:37 +02:00
2022-04-11 16:52:50 +02:00
ReturnValue_t checkCrc() {
2022-04-13 11:56:37 +02:00
uint8_t* crcPtr = this->getPacketData() + this->getPayloadDataLength();
2022-04-11 16:52:50 +02:00
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;
}
};
class VerificationReport : public TmPacket {
public:
VerificationReport() : TmPacket() {}
/**
* @brief Gets the APID of command which caused the transmission of this verification report.
*/
uint16_t getRefApid() {
uint16_t refApid = 0;
size_t size = 0;
uint8_t* refApidPtr = this->getPacketData();
2022-04-29 23:22:44 +02:00
ReturnValue_t result =
SerializeAdapter::deSerialize(&refApid, refApidPtr, &size, SerializeIF::Endianness::BIG);
if (result != HasReturnvaluesIF::RETURN_OK) {
sif::debug << "ExecutionReport: Failed to deserialize reference APID field" << std::endl;
return result;
}
return refApid;
}
uint16_t getStatusCode() {
uint16_t statusCode = 0;
size_t size = 0;
uint8_t* statusCodePtr = this->getPacketData() + OFFSET_STATUS_CODE;
ReturnValue_t result = SerializeAdapter::deSerialize(&statusCode, statusCodePtr, &size,
SerializeIF::Endianness::BIG);
if (result != HasReturnvaluesIF::RETURN_OK) {
sif::debug << "ExecutionReport: Failed to deserialize status code field" << std::endl;
return result;
}
return statusCode;
}
virtual ReturnValue_t checkApid() { return HasReturnvaluesIF::RETURN_FAILED; }
private:
static const uint8_t OFFSET_STATUS_CODE = 4;
};
class AcknowledgmentReport : public VerificationReport {
public:
AcknowledgmentReport() : VerificationReport() {}
ReturnValue_t checkApid() {
uint16_t apid = this->getAPID();
if (apid == APID_ACK_SUCCESS) {
return HasReturnvaluesIF::RETURN_OK;
} else if (apid == APID_ACK_FAILURE) {
printStatusInformation();
return SupvReturnValuesIF::RECEIVED_ACK_FAILURE;
} else {
sif::warning << "AcknowledgmentReport::checkApid: Invalid apid: 0x" << std::hex << apid
<< std::endl;
return SupvReturnValuesIF::INVALID_APID;
}
}
void printStatusInformation() {
StatusCode statusCode = static_cast<StatusCode>(getStatusCode());
switch (statusCode) {
case StatusCode::OK: {
sif::warning << "Supervisor acknowledgment report status: Ok" << std::endl;
break;
}
case StatusCode::BAD_PARAM: {
sif::warning << "Supervisor acknowledgment report status: Bad param" << std::endl;
break;
}
case StatusCode::TIMEOUT: {
sif::warning << "Supervisor acknowledgment report status: Timeout" << std::endl;
break;
}
case StatusCode::RX_ERROR: {
sif::warning << "Supervisor acknowledgment report status: RX error" << std::endl;
break;
}
case StatusCode::TX_ERROR: {
sif::warning << "Supervisor acknowledgment report status: TX error" << std::endl;
break;
}
case StatusCode::HEADER_EMPTY: {
sif::warning << "Supervisor acknowledgment report status: Header empty" << std::endl;
break;
}
case StatusCode::DEFAULT_NAK: {
2022-04-29 23:22:44 +02:00
sif::warning << "Supervisor acknowledgment report status: Default code for nak"
<< std::endl;
break;
}
case StatusCode::ROUTE_PACKET: {
sif::warning << "Supervisor acknowledgment report status: Route packet error" << std::endl;
break;
}
default:
sif::warning << "AcknowledgmentReport::printStatusInformation: Invalid status code: 0x"
<< std::hex << static_cast<uint16_t>(statusCode) << std::endl;
break;
}
}
private:
enum class StatusCode : uint16_t {
OK = 0x0,
BAD_PARAM = 0x1,
TIMEOUT = 0x2,
RX_ERROR = 0x3,
TX_ERROR = 0x4,
HEADER_EMPTY = 0x5,
DEFAULT_NAK = 0x6,
ROUTE_PACKET = 0x7
};
};
class ExecutionReport : public VerificationReport {
public:
ExecutionReport() : VerificationReport() {}
ReturnValue_t checkApid() {
uint16_t apid = this->getAPID();
if (apid == APID_EXE_SUCCESS) {
return HasReturnvaluesIF::RETURN_OK;
} else if (apid == APID_EXE_FAILURE) {
printStatusInformation();
return SupvReturnValuesIF::RECEIVED_EXE_FAILURE;
} else {
sif::warning << "ExecutionReport::checkApid: Invalid apid: 0x" << std::hex << apid
<< std::endl;
return SupvReturnValuesIF::INVALID_APID;
}
}
private:
static constexpr char STATUS_PRINTOUT_PREFIX[] = "Supervisor execution failure report status: ";
enum class StatusCode : uint16_t {
OK = 0x0,
INIT_ERROR = 0x1,
BAD_PARAM = 0x2,
NOT_INITIALIZED = 0x3,
BAD_PERIPH_ID = 0x4,
TIMEOUT = 0x5,
RX_ERROR = 0x6,
TX_ERROR = 0x7,
BUF_EMPTY = 0x8,
BUF_FULL = 0x9,
NAK = 0xA,
ARB_LOST = 0xB,
BUSY = 0xC,
NOT_IMPLEMENTED = 0xD,
ALIGNEMENT_ERROR = 0xE,
PERIPH_ERR = 0xF,
FAILED_LATCH = 0x10,
GPIO_HIGH = 0x11,
GPIO_LOW = 0x12,
TEST_PASSED = 0x13,
2022-04-29 09:03:13 +02:00
TEST_FAILED = 0x14,
NOTHING_TODO = 0x100,
POWER_FAULT = 0x101,
INVALID_LENGTH = 0x102,
OUT_OF_RANGE = 0x103,
OUT_OF_HEAP_MEMORY = 0x104,
INVALID_STATE_TRANSITION = 0x105,
2022-05-12 10:50:12 +02:00
MPSOC_ALREADY_BOOTING = 0x106,
MPSOC_ALREADY_OPERATIONAL = 0x107,
MPSOC_BOOT_FAILED = 0x108,
2022-04-29 09:03:13 +02:00
SP_NOT_AVAILABLE = 0x200,
SP_DATA_INSUFFICIENT = 0x201,
2022-04-29 23:22:44 +02:00
SP_MEMORY_ID_INVALID = 0x202,
MPSOC_NOT_IN_RESET = 0x203,
FLASH_INIT_FAILED = 0x204,
FLASH_ERASE_FAILED = 0x205,
FLASH_WRITE_FAILED = 0x206,
FLASH_VERIFY_FAILED = 0x207,
CANNOT_ACCESS_TM = 0x208,
CANNOT_SEND_TM = 0x209,
2022-04-29 09:03:13 +02:00
PG_LOW = 0x300,
PG_5V_LOW = 0x301,
PG_0V85_LOW = 0x302,
PG_1V8_LOW = 0x303,
PG_MISC_LOW = 0x304,
PG_3V3_LOW = 0x305,
2022-04-29 23:22:44 +02:00
PG_MB_VAIO_LOW = 0x306,
2022-04-29 09:03:13 +02:00
PG_MB_MPSOCIO_LOW = 0x307
};
void printStatusInformation() {
StatusCode statusCode = static_cast<StatusCode>(getStatusCode());
switch (statusCode) {
case StatusCode::OK: {
sif::warning << STATUS_PRINTOUT_PREFIX << "Ok" << std::endl;
break;
}
case StatusCode::INIT_ERROR: {
sif::warning << STATUS_PRINTOUT_PREFIX << "Init error" << std::endl;
break;
}
case StatusCode::BAD_PARAM: {
sif::warning << STATUS_PRINTOUT_PREFIX << "Bad param" << std::endl;
break;
}
case StatusCode::NOT_INITIALIZED: {
sif::warning << STATUS_PRINTOUT_PREFIX << "Not initialized" << std::endl;
break;
}
case StatusCode::BAD_PERIPH_ID: {
sif::warning << STATUS_PRINTOUT_PREFIX << "Bad periph ID" << std::endl;
break;
}
case StatusCode::TIMEOUT: {
sif::warning << STATUS_PRINTOUT_PREFIX << "Timeout" << std::endl;
break;
}
case StatusCode::RX_ERROR: {
sif::warning << STATUS_PRINTOUT_PREFIX << "RX error" << std::endl;
break;
}
case StatusCode::TX_ERROR: {
sif::warning << STATUS_PRINTOUT_PREFIX << "TX error" << std::endl;
break;
}
case StatusCode::BUF_EMPTY: {
sif::warning << STATUS_PRINTOUT_PREFIX << "Buf empty" << std::endl;
break;
}
case StatusCode::BUF_FULL: {
sif::warning << STATUS_PRINTOUT_PREFIX << "Buf full" << std::endl;
break;
}
case StatusCode::NAK: {
sif::warning << STATUS_PRINTOUT_PREFIX << "Nak, default error code" << std::endl;
break;
}
case StatusCode::ARB_LOST: {
sif::warning << STATUS_PRINTOUT_PREFIX << "Arb lost" << std::endl;
break;
}
case StatusCode::BUSY: {
sif::warning << STATUS_PRINTOUT_PREFIX << "Busy" << std::endl;
break;
}
case StatusCode::NOT_IMPLEMENTED: {
sif::warning << STATUS_PRINTOUT_PREFIX << "Not implemented" << std::endl;
break;
}
case StatusCode::ALIGNEMENT_ERROR: {
sif::warning << STATUS_PRINTOUT_PREFIX << "Alignment error" << std::endl;
break;
}
case StatusCode::PERIPH_ERR: {
sif::warning << STATUS_PRINTOUT_PREFIX << "Periph error" << std::endl;
break;
}
case StatusCode::FAILED_LATCH: {
sif::warning << STATUS_PRINTOUT_PREFIX << "Failed latch" << std::endl;
break;
}
case StatusCode::GPIO_HIGH: {
sif::warning << STATUS_PRINTOUT_PREFIX << "GPIO high" << std::endl;
break;
}
case StatusCode::GPIO_LOW: {
sif::warning << STATUS_PRINTOUT_PREFIX << "GPIO low" << std::endl;
break;
}
case StatusCode::TEST_PASSED: {
sif::warning << STATUS_PRINTOUT_PREFIX << "Test passed" << std::endl;
break;
}
case StatusCode::TEST_FAILED: {
sif::warning << STATUS_PRINTOUT_PREFIX << "Test failed" << std::endl;
break;
}
2022-04-29 09:03:13 +02:00
case StatusCode::NOTHING_TODO: {
2022-04-30 16:21:59 +02:00
sif::warning << STATUS_PRINTOUT_PREFIX << "Nothing todo, not an error but a warning"
<< std::endl;
2022-04-29 09:03:13 +02:00
break;
}
case StatusCode::POWER_FAULT: {
sif::warning << STATUS_PRINTOUT_PREFIX << "Power fault" << std::endl;
2022-04-29 09:03:13 +02:00
break;
}
case StatusCode::INVALID_LENGTH: {
sif::warning << STATUS_PRINTOUT_PREFIX << "Invalid length" << std::endl;
2022-04-29 09:03:13 +02:00
break;
}
case StatusCode::OUT_OF_RANGE: {
2022-04-30 16:21:59 +02:00
sif::warning << STATUS_PRINTOUT_PREFIX << "Out of range, lenght check of parameter failed"
<< std::endl;
2022-04-29 09:03:13 +02:00
break;
}
case StatusCode::OUT_OF_HEAP_MEMORY: {
sif::warning << STATUS_PRINTOUT_PREFIX << "Out of heap memory" << std::endl;
2022-04-29 09:03:13 +02:00
break;
}
case StatusCode::INVALID_STATE_TRANSITION: {
sif::warning << STATUS_PRINTOUT_PREFIX << "Invalid state transition" << std::endl;
2022-04-29 09:03:13 +02:00
break;
}
2022-05-12 10:50:12 +02:00
case StatusCode::MPSOC_ALREADY_BOOTING: {
sif::warning << STATUS_PRINTOUT_PREFIX << "MPSoC already booting" << std::endl;
break;
}
case StatusCode::MPSOC_ALREADY_OPERATIONAL: {
sif::warning << STATUS_PRINTOUT_PREFIX << "MPSoC already operational" << std::endl;
break;
}
2022-04-29 09:03:13 +02:00
case StatusCode::MPSOC_BOOT_FAILED: {
sif::warning << STATUS_PRINTOUT_PREFIX << "MPSoC boot failed" << std::endl;
2022-04-29 09:03:13 +02:00
break;
}
2022-04-29 13:31:58 +02:00
case StatusCode::SP_NOT_AVAILABLE: {
sif::warning << STATUS_PRINTOUT_PREFIX << "SP not available" << std::endl;
2022-04-29 23:22:44 +02:00
break;
}
2022-04-29 13:31:58 +02:00
case StatusCode::SP_DATA_INSUFFICIENT: {
sif::warning << STATUS_PRINTOUT_PREFIX << "SP data insufficient" << std::endl;
2022-04-29 23:22:44 +02:00
break;
}
case StatusCode::SP_MEMORY_ID_INVALID: {
sif::warning << STATUS_PRINTOUT_PREFIX << "SP data insufficient" << std::endl;
2022-04-29 23:22:44 +02:00
break;
}
case StatusCode::MPSOC_NOT_IN_RESET: {
sif::warning << STATUS_PRINTOUT_PREFIX << "MPSoC not in reset" << std::endl;
2022-04-29 23:22:44 +02:00
break;
}
case StatusCode::FLASH_INIT_FAILED: {
sif::warning << STATUS_PRINTOUT_PREFIX << "Flash init failed" << std::endl;
2022-04-29 23:22:44 +02:00
break;
}
case StatusCode::FLASH_ERASE_FAILED: {
sif::warning << STATUS_PRINTOUT_PREFIX << "Flash erase failed" << std::endl;
2022-04-29 23:22:44 +02:00
break;
}
case StatusCode::FLASH_WRITE_FAILED: {
sif::warning << STATUS_PRINTOUT_PREFIX << "Flash write failed" << std::endl;
2022-04-29 23:22:44 +02:00
break;
}
case StatusCode::FLASH_VERIFY_FAILED: {
sif::warning << STATUS_PRINTOUT_PREFIX << "Flash verify failed" << std::endl;
2022-04-29 23:22:44 +02:00
break;
}
case StatusCode::CANNOT_ACCESS_TM: {
sif::warning << STATUS_PRINTOUT_PREFIX << "Can not access tm" << std::endl;
2022-04-29 23:22:44 +02:00
break;
}
case StatusCode::CANNOT_SEND_TM: {
sif::warning << STATUS_PRINTOUT_PREFIX << "Can not access tm" << std::endl;
2022-04-29 23:22:44 +02:00
break;
}
case StatusCode::PG_LOW: {
sif::warning << STATUS_PRINTOUT_PREFIX << "PG low" << std::endl;
2022-04-29 23:22:44 +02:00
break;
}
case StatusCode::PG_5V_LOW: {
sif::warning << STATUS_PRINTOUT_PREFIX << "PG 5V low" << std::endl;
2022-04-29 23:22:44 +02:00
break;
}
case StatusCode::PG_0V85_LOW: {
sif::warning << STATUS_PRINTOUT_PREFIX << "PG 0V85 low" << std::endl;
2022-04-29 23:22:44 +02:00
break;
}
case StatusCode::PG_1V8_LOW: {
sif::warning << STATUS_PRINTOUT_PREFIX << "PG 1V8 low" << std::endl;
2022-04-29 23:22:44 +02:00
break;
}
case StatusCode::PG_MISC_LOW: {
sif::warning << STATUS_PRINTOUT_PREFIX << "PG misc low" << std::endl;
2022-04-29 23:22:44 +02:00
break;
}
case StatusCode::PG_3V3_LOW: {
sif::warning << STATUS_PRINTOUT_PREFIX << "PG 3V3 low" << std::endl;
2022-04-29 23:22:44 +02:00
break;
}
case StatusCode::PG_MB_VAIO_LOW: {
sif::warning << STATUS_PRINTOUT_PREFIX << "PG mb vaio low" << std::endl;
2022-04-29 23:22:44 +02:00
break;
}
case StatusCode::PG_MB_MPSOCIO_LOW: {
sif::warning << STATUS_PRINTOUT_PREFIX << "PG mb mpsocio low" << std::endl;
2022-04-29 23:22:44 +02:00
break;
}
default:
sif::warning << "ExecutionReport::printStatusInformation: Invalid status code: 0x"
<< std::hex << static_cast<uint16_t>(statusCode) << std::endl;
break;
}
2022-04-29 23:22:44 +02:00
}
};
2022-04-10 18:46:39 +02:00
/**
* @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 */
2022-04-11 16:52:50 +02:00
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);
2022-04-10 18:46:39 +02:00
/** 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.
*/
2022-01-17 15:58:27 +01:00
class HkSet : public StaticLocalDataSet<HK_SET_ENTRIES> {
public:
2022-05-05 19:18:39 +02:00
enum class SocState { OFF = 0, BOOTING = 1, OPERATIONAL = 3, SHUTDOWN = 4 };
2022-05-03 14:59:23 +02:00
2022-01-17 15:58:27 +01:00
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);
2022-04-06 07:10:20 +02:00
lp_var_t<uint64_t> uptime = lp_var_t<uint64_t>(sid.objectId, PoolIds::UPTIME, this);
2022-01-17 15:58:27 +01:00
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);
2022-04-11 16:52:50 +02:00
lp_var_t<uint32_t> socState = lp_var_t<uint32_t>(sid.objectId, PoolIds::HK_SOC_STATE, this);
2022-01-17 15:58:27 +01:00
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.
*/
2022-01-17 15:58:27 +01:00
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);
2022-04-06 07:10:20 +02:00
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);
2022-04-11 16:52:50 +02:00
lp_var_t<uint8_t> isSet = lp_var_t<uint8_t>(sid.objectId, PoolIds::LATCHUP_RPT_IS_SET, this);
2022-04-06 08:36:34 +02:00
2022-04-11 16:52:50 +02:00
static const uint8_t IS_SET_BIT_POS = 15;
2022-04-10 18:46:39 +02:00
};
2022-04-13 11:56:37 +02:00
/**
* @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)) {}
2022-04-22 08:55:57 +02:00
lp_var_t<uint32_t> latchupHappenCnt0 =
lp_var_t<uint32_t>(sid.objectId, PoolIds::LATCHUP_HAPPENED_CNT_0, this);
lp_var_t<uint32_t> latchupHappenCnt1 =
lp_var_t<uint32_t>(sid.objectId, PoolIds::LATCHUP_HAPPENED_CNT_1, this);
lp_var_t<uint32_t> latchupHappenCnt2 =
lp_var_t<uint32_t>(sid.objectId, PoolIds::LATCHUP_HAPPENED_CNT_2, this);
lp_var_t<uint32_t> latchupHappenCnt3 =
lp_var_t<uint32_t>(sid.objectId, PoolIds::LATCHUP_HAPPENED_CNT_3, this);
lp_var_t<uint32_t> latchupHappenCnt4 =
lp_var_t<uint32_t>(sid.objectId, PoolIds::LATCHUP_HAPPENED_CNT_4, this);
lp_var_t<uint32_t> latchupHappenCnt5 =
lp_var_t<uint32_t>(sid.objectId, PoolIds::LATCHUP_HAPPENED_CNT_5, this);
lp_var_t<uint32_t> latchupHappenCnt6 =
lp_var_t<uint32_t>(sid.objectId, PoolIds::LATCHUP_HAPPENED_CNT_6, this);
lp_var_t<uint32_t> adcDeviationTriggersCnt =
lp_var_t<uint32_t>(sid.objectId, PoolIds::ADC_DEVIATION_TRIGGERS_CNT, this);
lp_var_t<uint32_t> tcReceivedCnt =
lp_var_t<uint32_t>(sid.objectId, PoolIds::TC_RECEIVED_CNT, this);
lp_var_t<uint32_t> tmAvailableCnt =
lp_var_t<uint32_t>(sid.objectId, PoolIds::TM_AVAILABLE_CNT, this);
lp_var_t<uint32_t> supervisorBoots =
lp_var_t<uint32_t>(sid.objectId, PoolIds::SUPERVISOR_BOOTS, this);
lp_var_t<uint32_t> mpsocBoots = lp_var_t<uint32_t>(sid.objectId, PoolIds::MPSOC_BOOTS, this);
2022-04-22 08:55:57 +02:00
lp_var_t<uint32_t> mpsocBootFailedAttempts =
lp_var_t<uint32_t>(sid.objectId, PoolIds::MPSOC_BOOT_FAILED_ATTEMPTS, this);
lp_var_t<uint32_t> mpsocPowerup = lp_var_t<uint32_t>(sid.objectId, PoolIds::MPSOC_POWER_UP, this);
lp_var_t<uint32_t> mpsocUpdates = lp_var_t<uint32_t>(sid.objectId, PoolIds::MPSOC_UPDATES, this);
lp_var_t<uint32_t> lastRecvdTc = lp_var_t<uint32_t>(sid.objectId, PoolIds::LAST_RECVD_TC, this);
2022-04-13 11:56:37 +02:00
void printSet() {
sif::info << "LoggingReport: Latchup happened count 0: " << this->latchupHappenCnt0
<< std::endl;
sif::info << "LoggingReport: Latchup happened count 1: " << this->latchupHappenCnt1
<< std::endl;
sif::info << "LoggingReport: Latchup happened count 2: " << this->latchupHappenCnt2
<< std::endl;
sif::info << "LoggingReport: Latchup happened count 3: " << this->latchupHappenCnt3
<< std::endl;
sif::info << "LoggingReport: Latchup happened count 4: " << this->latchupHappenCnt4
<< std::endl;
sif::info << "LoggingReport: Latchup happened count 5: " << this->latchupHappenCnt5
<< std::endl;
sif::info << "LoggingReport: Latchup happened count 6: " << this->latchupHappenCnt6
<< std::endl;
sif::info << "LoggingReport: ADC deviation triggers count: " << this->adcDeviationTriggersCnt
<< std::endl;
2022-04-22 08:55:57 +02:00
sif::info << "LoggingReport: TC received count: " << this->tcReceivedCnt << std::endl;
sif::info << "LoggingReport: TM available count: " << this->tmAvailableCnt << std::endl;
sif::info << "LoggingReport: Supervisor boots: " << this->supervisorBoots << std::endl;
sif::info << "LoggingReport: MPSoC boots: " << this->mpsocBoots << std::endl;
sif::info << "LoggingReport: MPSoC boot failed attempts: " << this->mpsocBootFailedAttempts
<< std::endl;
2022-04-22 08:55:57 +02:00
sif::info << "LoggingReport: MPSoC power up: " << this->mpsocPowerup << std::endl;
sif::info << "LoggingReport: MPSoC updates: " << this->mpsocUpdates << std::endl;
sif::info << "LoggingReport: APID of last received TC: 0x" << std::hex << this->lastRecvdTc
<< std::endl;
2022-04-13 11:56:37 +02:00
}
};
2022-04-10 18:46:39 +02:00
class UpdateStatusReport : public TmPacket {
public:
UpdateStatusReport() : TmPacket() {}
ReturnValue_t parseDataField() {
ReturnValue_t result = lengthCheck();
if (result != HasReturnvaluesIF::RETURN_OK) {
return result;
}
uint8_t* dataFieldPtr = this->localData.fields.buffer;
size_t size = sizeof(memoryId);
SerializeAdapter::deSerialize(&memoryId, dataFieldPtr, &size, SerializeIF::Endianness::BIG);
dataFieldPtr += size;
size = sizeof(n);
SerializeAdapter::deSerialize(&n, dataFieldPtr, &size, SerializeIF::Endianness::BIG);
dataFieldPtr += size;
size = sizeof(startAddress);
SerializeAdapter::deSerialize(&startAddress, dataFieldPtr, &size, SerializeIF::Endianness::BIG);
dataFieldPtr += size;
size = sizeof(length);
SerializeAdapter::deSerialize(&length, dataFieldPtr, &size, SerializeIF::Endianness::BIG);
dataFieldPtr += size;
size = sizeof(crc);
SerializeAdapter::deSerialize(&crc, dataFieldPtr, &size, SerializeIF::Endianness::BIG);
return HasReturnvaluesIF::RETURN_OK;
}
ReturnValue_t verifycrc(uint16_t goodCrc) const {
2022-04-11 16:52:50 +02:00
if (crc != goodCrc) {
return SupvReturnValuesIF::UPDATE_CRC_FAILURE;
}
return HasReturnvaluesIF::RETURN_OK;
2022-04-10 18:46:39 +02:00
}
2022-04-11 16:52:50 +02:00
uint16_t getCrc() const { return crc; }
2022-04-10 18:46:39 +02:00
2022-04-11 16:52:50 +02:00
uint16_t getNominalSize() const { return FULL_SIZE; }
2022-04-10 18:46:39 +02:00
private:
// Nominal size of the space packet
static const uint16_t FULL_SIZE = 20; // header, data field and crc
uint8_t memoryId = 0;
uint8_t n = 0;
uint32_t startAddress = 0;
uint32_t length = 0;
uint16_t crc = 0;
ReturnValue_t lengthCheck() {
if (this->getFullSize() != FULL_SIZE) {
return SupvReturnValuesIF::UPDATE_STATUS_REPORT_INVALID_LENGTH;
}
return HasReturnvaluesIF::RETURN_OK;
2022-04-06 08:36:34 +02:00
}
};
2022-04-21 16:30:23 +02:00
/**
* @brief This dataset stores the ADC report.
*/
class AdcReport : public StaticLocalDataSet<ADC_RPT_SET_ENTRIES> {
public:
AdcReport(HasLocalDataPoolIF* owner) : StaticLocalDataSet(owner, ADC_REPORT_SET_ID) {}
AdcReport(object_id_t objectId) : StaticLocalDataSet(sid_t(objectId, ADC_REPORT_SET_ID)) {}
lp_var_t<uint16_t> adcRaw0 = lp_var_t<uint16_t>(sid.objectId, PoolIds::ADC_RAW_0, this);
lp_var_t<uint16_t> adcRaw1 = lp_var_t<uint16_t>(sid.objectId, PoolIds::ADC_RAW_1, this);
lp_var_t<uint16_t> adcRaw2 = lp_var_t<uint16_t>(sid.objectId, PoolIds::ADC_RAW_2, this);
lp_var_t<uint16_t> adcRaw3 = lp_var_t<uint16_t>(sid.objectId, PoolIds::ADC_RAW_3, this);
lp_var_t<uint16_t> adcRaw4 = lp_var_t<uint16_t>(sid.objectId, PoolIds::ADC_RAW_4, this);
lp_var_t<uint16_t> adcRaw5 = lp_var_t<uint16_t>(sid.objectId, PoolIds::ADC_RAW_5, this);
lp_var_t<uint16_t> adcRaw6 = lp_var_t<uint16_t>(sid.objectId, PoolIds::ADC_RAW_6, this);
lp_var_t<uint16_t> adcRaw7 = lp_var_t<uint16_t>(sid.objectId, PoolIds::ADC_RAW_7, this);
lp_var_t<uint16_t> adcRaw8 = lp_var_t<uint16_t>(sid.objectId, PoolIds::ADC_RAW_8, this);
lp_var_t<uint16_t> adcRaw9 = lp_var_t<uint16_t>(sid.objectId, PoolIds::ADC_RAW_9, this);
lp_var_t<uint16_t> adcRaw10 = lp_var_t<uint16_t>(sid.objectId, PoolIds::ADC_RAW_10, this);
lp_var_t<uint16_t> adcRaw11 = lp_var_t<uint16_t>(sid.objectId, PoolIds::ADC_RAW_11, this);
lp_var_t<uint16_t> adcRaw12 = lp_var_t<uint16_t>(sid.objectId, PoolIds::ADC_RAW_12, this);
lp_var_t<uint16_t> adcRaw13 = lp_var_t<uint16_t>(sid.objectId, PoolIds::ADC_RAW_13, this);
lp_var_t<uint16_t> adcRaw14 = lp_var_t<uint16_t>(sid.objectId, PoolIds::ADC_RAW_14, this);
lp_var_t<uint16_t> adcRaw15 = lp_var_t<uint16_t>(sid.objectId, PoolIds::ADC_RAW_15, this);
lp_var_t<uint16_t> adcEng0 = lp_var_t<uint16_t>(sid.objectId, PoolIds::ADC_ENG_0, this);
lp_var_t<uint16_t> adcEng1 = lp_var_t<uint16_t>(sid.objectId, PoolIds::ADC_ENG_1, this);
lp_var_t<uint16_t> adcEng2 = lp_var_t<uint16_t>(sid.objectId, PoolIds::ADC_ENG_2, this);
lp_var_t<uint16_t> adcEng3 = lp_var_t<uint16_t>(sid.objectId, PoolIds::ADC_ENG_3, this);
lp_var_t<uint16_t> adcEng4 = lp_var_t<uint16_t>(sid.objectId, PoolIds::ADC_ENG_4, this);
lp_var_t<uint16_t> adcEng5 = lp_var_t<uint16_t>(sid.objectId, PoolIds::ADC_ENG_5, this);
lp_var_t<uint16_t> adcEng6 = lp_var_t<uint16_t>(sid.objectId, PoolIds::ADC_ENG_6, this);
lp_var_t<uint16_t> adcEng7 = lp_var_t<uint16_t>(sid.objectId, PoolIds::ADC_ENG_7, this);
lp_var_t<uint16_t> adcEng8 = lp_var_t<uint16_t>(sid.objectId, PoolIds::ADC_ENG_8, this);
lp_var_t<uint16_t> adcEng9 = lp_var_t<uint16_t>(sid.objectId, PoolIds::ADC_ENG_9, this);
lp_var_t<uint16_t> adcEng10 = lp_var_t<uint16_t>(sid.objectId, PoolIds::ADC_ENG_10, this);
lp_var_t<uint16_t> adcEng11 = lp_var_t<uint16_t>(sid.objectId, PoolIds::ADC_ENG_11, this);
lp_var_t<uint16_t> adcEng12 = lp_var_t<uint16_t>(sid.objectId, PoolIds::ADC_ENG_12, this);
lp_var_t<uint16_t> adcEng13 = lp_var_t<uint16_t>(sid.objectId, PoolIds::ADC_ENG_13, this);
lp_var_t<uint16_t> adcEng14 = lp_var_t<uint16_t>(sid.objectId, PoolIds::ADC_ENG_14, this);
lp_var_t<uint16_t> adcEng15 = lp_var_t<uint16_t>(sid.objectId, PoolIds::ADC_ENG_15, this);
void printSet() {
sif::info << "---- Adc Report: Raw values ----" << std::endl;
sif::info << "AdcReport: ADC raw 0: " << std::dec << this->adcRaw0 << std::endl;
2022-04-21 16:30:23 +02:00
sif::info << "AdcReport: ADC raw 1: " << this->adcRaw1 << std::endl;
sif::info << "AdcReport: ADC raw 2: " << this->adcRaw2 << std::endl;
sif::info << "AdcReport: ADC raw 3: " << this->adcRaw3 << std::endl;
sif::info << "AdcReport: ADC raw 4: " << this->adcRaw4 << std::endl;
sif::info << "AdcReport: ADC raw 5: " << this->adcRaw5 << std::endl;
sif::info << "AdcReport: ADC raw 6: " << this->adcRaw6 << std::endl;
sif::info << "AdcReport: ADC raw 7: " << this->adcRaw7 << std::endl;
sif::info << "AdcReport: ADC raw 8: " << this->adcRaw8 << std::endl;
sif::info << "AdcReport: ADC raw 9: " << this->adcRaw9 << std::endl;
sif::info << "AdcReport: ADC raw 10: " << this->adcRaw10 << std::endl;
sif::info << "AdcReport: ADC raw 11: " << this->adcRaw11 << std::endl;
sif::info << "AdcReport: ADC raw 12: " << this->adcRaw12 << std::endl;
sif::info << "AdcReport: ADC raw 13: " << this->adcRaw13 << std::endl;
sif::info << "AdcReport: ADC raw 14: " << this->adcRaw14 << std::endl;
sif::info << "AdcReport: ADC raw 15: " << this->adcRaw15 << std::endl;
sif::info << "---- Adc Report: Engineering values ----" << std::endl;
sif::info << "AdcReport: ADC eng 0: " << this->adcEng0 << std::endl;
sif::info << "AdcReport: ADC eng 1: " << this->adcEng1 << std::endl;
sif::info << "AdcReport: ADC eng 2: " << this->adcEng2 << std::endl;
sif::info << "AdcReport: ADC eng 3: " << this->adcEng3 << std::endl;
sif::info << "AdcReport: ADC eng 4: " << this->adcEng4 << std::endl;
sif::info << "AdcReport: ADC eng 5: " << this->adcEng5 << std::endl;
sif::info << "AdcReport: ADC eng 6: " << this->adcEng6 << std::endl;
sif::info << "AdcReport: ADC eng 7: " << this->adcEng7 << std::endl;
sif::info << "AdcReport: ADC eng 8: " << this->adcEng8 << std::endl;
sif::info << "AdcReport: ADC eng 9: " << this->adcEng9 << std::endl;
sif::info << "AdcReport: ADC eng 10: " << this->adcEng10 << std::endl;
sif::info << "AdcReport: ADC eng 11: " << this->adcEng11 << std::endl;
sif::info << "AdcReport: ADC eng 12: " << this->adcEng12 << std::endl;
sif::info << "AdcReport: ADC eng 13: " << this->adcEng13 << std::endl;
sif::info << "AdcReport: ADC eng 14: " << this->adcEng14 << std::endl;
sif::info << "AdcReport: ADC eng 15: " << this->adcEng15 << std::endl;
}
};
2022-04-04 13:40:45 +02:00
} // namespace supv
#endif /* MISSION_DEVICES_DEVICEDEFINITIONS_PLOCSVPDEFINITIONS_H_ */