1973 lines
73 KiB
C++
1973 lines
73 KiB
C++
#ifndef MISSION_DEVICES_DEVICEDEFINITIONS_PLOCSVPDEFINITIONS_H_
|
|
#define MISSION_DEVICES_DEVICEDEFINITIONS_PLOCSVPDEFINITIONS_H_
|
|
|
|
#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>
|
|
#include <fsfw/tmtcpacket/SpacePacket.h>
|
|
|
|
#include "linux/devices/devicedefinitions/SupvReturnValuesIF.h"
|
|
|
|
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;
|
|
static const DeviceCommandId_t DISABLE_PERIOIC_HK_TRANSMISSION = 10;
|
|
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;
|
|
static const DeviceCommandId_t FIRST_MRAM_DUMP = 30;
|
|
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 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;
|
|
static const DeviceCommandId_t START_MPSOC_QUIET = 45;
|
|
static const DeviceCommandId_t SET_SHUTDOWN_TIMEOUT = 46;
|
|
static const DeviceCommandId_t FACTORY_FLASH = 47;
|
|
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 LOGGING_REQUEST_EVENT_BUFFERS = 54;
|
|
static const DeviceCommandId_t LOGGING_CLEAR_COUNTERS = 55;
|
|
static const DeviceCommandId_t LOGGING_SET_TOPIC = 56;
|
|
static const DeviceCommandId_t REQUEST_ADC_REPORT = 57;
|
|
static const DeviceCommandId_t RESET_PL = 58;
|
|
|
|
/** Reply IDs */
|
|
static const DeviceCommandId_t ACK_REPORT = 50;
|
|
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;
|
|
static const DeviceCommandId_t ADC_REPORT = 56;
|
|
|
|
// 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 = 45;
|
|
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;
|
|
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;
|
|
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;
|
|
static const uint16_t APID_RESET_PL = 0xA7;
|
|
static const uint16_t APID_GET_BOOT_STATUS_RPT = 0xA8;
|
|
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;
|
|
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;
|
|
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_SET_ALERT_LIMIT = 0xD3;
|
|
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;
|
|
static const uint16_t APID_REQUEST_ADC_REPORT = 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_PRINT_CPU_STATS = 0xF8;
|
|
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;
|
|
|
|
static const uint16_t APID_MASK = 0x3FF;
|
|
static const uint16_t SEQUENCE_COUNT_MASK = 0xFFF;
|
|
|
|
/** 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.
|
|
*/
|
|
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;
|
|
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;
|
|
|
|
enum class SequenceFlags : uint8_t {
|
|
CONTINUED_PKT = 0b00,
|
|
FIRST_PKT = 0b01,
|
|
LAST_PKT = 0b10,
|
|
STANDALONE_PKT = 0b11
|
|
};
|
|
|
|
enum PoolIds : lp_id_t {
|
|
NUM_TMS,
|
|
TEMP_PS,
|
|
TEMP_PL,
|
|
HK_SOC_STATE,
|
|
NVM0_1_STATE,
|
|
NVM3_STATE,
|
|
MISSION_IO_STATE,
|
|
FMC_STATE,
|
|
NUM_TCS,
|
|
TEMP_SUP,
|
|
UPTIME,
|
|
CPULOAD,
|
|
AVAILABLEHEAP,
|
|
BR_SOC_STATE,
|
|
POWER_CYCLES,
|
|
BOOT_AFTER_MS,
|
|
BOOT_TIMEOUT_MS,
|
|
ACTIVE_NVM,
|
|
BP0_STATE,
|
|
BP1_STATE,
|
|
BP2_STATE,
|
|
BOOT_STATE,
|
|
BOOT_CYCLES,
|
|
|
|
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,
|
|
LATCHUP_RPT_IS_SET,
|
|
|
|
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,
|
|
|
|
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;
|
|
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 = 16;
|
|
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;
|
|
static const uint32_t LOGGING_RPT_ID = LOGGING_REQUEST_COUNTERS;
|
|
static const uint32_t ADC_REPORT_SET_ID = REQUEST_ADC_REPORT;
|
|
|
|
namespace recv_timeout {
|
|
// Erase memory can require up to 60 seconds for execution
|
|
static const uint32_t ERASE_MEMORY = 60000;
|
|
static const uint32_t UPDATE_STATUS_REPORT = 70000;
|
|
} // namespace recv_timeout
|
|
|
|
/**
|
|
* @brief This class creates a space packet containing only the header data and the CRC.
|
|
*/
|
|
class ApidOnlyPacket : public SpacePacket {
|
|
public:
|
|
/**
|
|
* @brief Constructor
|
|
*
|
|
* @param apid The APID to set in the space packet.
|
|
*
|
|
* @note Sequence count of empty packet is always 1.
|
|
*/
|
|
ApidOnlyPacket(uint16_t apid) : SpacePacket(LENGTH_EMPTY_TC - 1, true, apid, 1) { calcCrc(); }
|
|
|
|
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.
|
|
*/
|
|
class MPSoCBootSelect : 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
|
|
*/
|
|
MPSoCBootSelect(uint8_t mem, uint8_t bp0, uint8_t bp1, uint8_t bp2)
|
|
: 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);
|
|
}
|
|
};
|
|
|
|
/**
|
|
* @brief This class generates the space packet to update the time of the PLOC supervisor.
|
|
*/
|
|
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:
|
|
static const uint16_t DATA_FIELD_LENGTH = 10;
|
|
static const uint16_t DEFAULT_SEQUENCE_COUNT = 1;
|
|
static const uint16_t CRC_OFFSET = DATA_FIELD_LENGTH - 2;
|
|
static const uint16_t SYNC = 0x8000;
|
|
|
|
void initPacket(Clock::TimeOfDay_t* time) {
|
|
size_t serializedSize = 0;
|
|
uint8_t* dataFieldPtr = this->localData.fields.buffer;
|
|
uint16_t milliseconds = static_cast<uint16_t>(time->usecond / 1000) | SYNC;
|
|
SerializeAdapter::serialize<uint16_t>(&milliseconds, &dataFieldPtr, &serializedSize,
|
|
sizeof(milliseconds), SerializeIF::Endianness::BIG);
|
|
uint8_t second = static_cast<uint8_t>(time->second);
|
|
serializedSize = 0;
|
|
SerializeAdapter::serialize<uint8_t>(&second, &dataFieldPtr, &serializedSize,
|
|
sizeof(time->second), SerializeIF::Endianness::BIG);
|
|
uint8_t minute = static_cast<uint8_t>(time->minute);
|
|
serializedSize = 0;
|
|
SerializeAdapter::serialize<uint8_t>(&minute, &dataFieldPtr, &serializedSize,
|
|
sizeof(time->minute), SerializeIF::Endianness::BIG);
|
|
uint8_t hour = static_cast<uint8_t>(time->hour);
|
|
serializedSize = 0;
|
|
SerializeAdapter::serialize<uint8_t>(&hour, &dataFieldPtr, &serializedSize, sizeof(time->hour),
|
|
SerializeIF::Endianness::BIG);
|
|
uint8_t day = static_cast<uint8_t>(time->day);
|
|
serializedSize = 0;
|
|
SerializeAdapter::serialize<uint8_t>(&day, &dataFieldPtr, &serializedSize, sizeof(time->day),
|
|
SerializeIF::Endianness::BIG);
|
|
uint8_t month = static_cast<uint8_t>(time->month);
|
|
serializedSize = 0;
|
|
SerializeAdapter::serialize<uint8_t>(&month, &dataFieldPtr, &serializedSize,
|
|
sizeof(time->month), SerializeIF::Endianness::BIG);
|
|
uint8_t year = static_cast<uint8_t>(time->year - 1900);
|
|
serializedSize = 0;
|
|
SerializeAdapter::serialize<uint8_t>(&year, &dataFieldPtr, &serializedSize, sizeof(time->year),
|
|
SerializeIF::Endianness::BIG);
|
|
serializedSize = 0;
|
|
/* Calculate crc */
|
|
uint16_t crc = CRC::crc16ccitt(this->localData.byteStream,
|
|
sizeof(CCSDSPrimaryHeader) + DATA_FIELD_LENGTH - 2);
|
|
SerializeAdapter::serialize<uint16_t>(&crc, &dataFieldPtr, &serializedSize, sizeof(crc),
|
|
SerializeIF::Endianness::BIG);
|
|
}
|
|
};
|
|
|
|
/**
|
|
* @brief This class can be used to generate the set boot timout command.
|
|
*/
|
|
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;
|
|
uint8_t* dataFieldPtr = this->localData.fields.buffer;
|
|
SerializeAdapter::serialize<uint32_t>(&timeout, &dataFieldPtr, &serializedSize, sizeof(timeout),
|
|
SerializeIF::Endianness::BIG);
|
|
/* 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;
|
|
SerializeAdapter::serialize<uint16_t>(&crc, &dataFieldPtr, &serializedSize, sizeof(crc),
|
|
SerializeIF::Endianness::BIG);
|
|
}
|
|
};
|
|
|
|
/**
|
|
* @brief This class can be used to generate the space packet to set the maximum boot tries.
|
|
*/
|
|
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() {
|
|
uint8_t* dataFieldPtr = this->localData.fields.buffer;
|
|
*dataFieldPtr = restartTries;
|
|
uint16_t crc = CRC::crc16ccitt(this->localData.byteStream,
|
|
sizeof(CCSDSPrimaryHeader) + DATA_FIELD_LENGTH - 2);
|
|
size_t serializedSize = 0;
|
|
uint8_t* crcPtr = dataFieldPtr + 1;
|
|
SerializeAdapter::serialize<uint16_t>(&crc, &crcPtr, &serializedSize, sizeof(crc),
|
|
SerializeIF::Endianness::BIG);
|
|
}
|
|
};
|
|
|
|
/**
|
|
* @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.
|
|
*/
|
|
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() {
|
|
uint8_t* dataFieldPtr = this->localData.fields.buffer;
|
|
*dataFieldPtr = disableHk;
|
|
uint16_t crc = CRC::crc16ccitt(this->localData.byteStream,
|
|
sizeof(CCSDSPrimaryHeader) + DATA_FIELD_LENGTH - 2);
|
|
size_t serializedSize = 0;
|
|
uint8_t* crcPtr = dataFieldPtr + 1;
|
|
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.
|
|
*/
|
|
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;
|
|
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,
|
|
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:
|
|
/**
|
|
* @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;
|
|
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>(&dutycycle, &dataFieldPtr, &serializedSize,
|
|
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.
|
|
*/
|
|
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;
|
|
uint8_t* dataFieldPtr = this->localData.fields.buffer;
|
|
SerializeAdapter::serialize<uint16_t>(&ch, &dataFieldPtr, &serializedSize, sizeof(ch),
|
|
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.
|
|
*/
|
|
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;
|
|
uint8_t* dataFieldPtr = this->localData.fields.buffer;
|
|
SerializeAdapter::serialize<uint16_t>(&windowSize, &dataFieldPtr, &serializedSize,
|
|
sizeof(windowSize), SerializeIF::Endianness::BIG);
|
|
serializedSize = 0;
|
|
SerializeAdapter::serialize<uint16_t>(&stridingStepSize, &dataFieldPtr, &serializedSize,
|
|
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.
|
|
*/
|
|
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;
|
|
uint8_t* dataFieldPtr = this->localData.fields.buffer;
|
|
SerializeAdapter::serialize<uint32_t>(&threshold, &dataFieldPtr, &serializedSize,
|
|
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);
|
|
}
|
|
};
|
|
|
|
/**
|
|
* @brief This class packages the space packet to run auto EM tests.
|
|
*/
|
|
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;
|
|
uint8_t* dataFieldPtr = this->localData.fields.buffer;
|
|
SerializeAdapter::serialize<uint8_t>(&test, &dataFieldPtr, &serializedSize, sizeof(test),
|
|
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 causing the supervisor to print the CPU load to
|
|
* the debug output.
|
|
*/
|
|
class PrintCpuStats : public SpacePacket {
|
|
public:
|
|
/**
|
|
* @brief Constructor
|
|
*
|
|
* @param en Print is enabled if en != 0
|
|
*/
|
|
PrintCpuStats(uint8_t en)
|
|
: SpacePacket(DATA_FIELD_LENGTH - 1, true, APID_PRINT_CPU_STATS, DEFAULT_SEQUENCE_COUNT),
|
|
en(en) {
|
|
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 en = 0;
|
|
|
|
void initPacket() {
|
|
size_t serializedSize = 0;
|
|
uint8_t* dataFieldPtr = this->localData.fields.buffer;
|
|
SerializeAdapter::serialize<uint8_t>(&en, &dataFieldPtr, &serializedSize, sizeof(en),
|
|
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.
|
|
*/
|
|
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);
|
|
uint8_t* dataFieldPtr = this->localData.fields.buffer;
|
|
std::memcpy(dataFieldPtr, concatBuffer, sizeof(concatBuffer));
|
|
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);
|
|
}
|
|
};
|
|
|
|
/**
|
|
* @brief This class packages the space packet change the state of a GPIO. This command is only
|
|
* required for ground testing.
|
|
*/
|
|
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;
|
|
uint8_t* dataFieldPtr = this->localData.fields.buffer;
|
|
SerializeAdapter::serialize<uint8_t>(&port, &dataFieldPtr, &serializedSize, sizeof(port),
|
|
SerializeIF::Endianness::BIG);
|
|
serializedSize = 0;
|
|
SerializeAdapter::serialize<uint8_t>(&pin, &dataFieldPtr, &serializedSize, sizeof(pin),
|
|
SerializeIF::Endianness::BIG);
|
|
serializedSize = 0;
|
|
SerializeAdapter::serialize<uint8_t>(&val, &dataFieldPtr, &serializedSize, sizeof(val),
|
|
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 causing the supervisor print the state of a GPIO
|
|
* to the debug output.
|
|
*/
|
|
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;
|
|
uint8_t* dataFieldPtr = this->localData.fields.buffer;
|
|
SerializeAdapter::serialize<uint8_t>(&port, &dataFieldPtr, &serializedSize, sizeof(port),
|
|
SerializeIF::Endianness::BIG);
|
|
serializedSize = 0;
|
|
SerializeAdapter::serialize<uint8_t>(&pin, &dataFieldPtr, &serializedSize, sizeof(pin),
|
|
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 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.
|
|
*/
|
|
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() {
|
|
uint8_t* dataFieldPtr = this->localData.fields.buffer;
|
|
|
|
switch (op) {
|
|
case Op::MIRROR_ENTRIES:
|
|
*dataFieldPtr = 1;
|
|
packetLen = 2;
|
|
crcOffset = 1;
|
|
break;
|
|
case Op::CIRCULAR_ENTRIES:
|
|
*dataFieldPtr = 2;
|
|
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);
|
|
}
|
|
};
|
|
|
|
class SupvTcSpacePacket : public SpacePacket {
|
|
public:
|
|
/**
|
|
* @brief Constructor
|
|
*
|
|
* @param payloadDataLen Length of data field without CRC
|
|
*/
|
|
SupvTcSpacePacket(uint16_t payloadDataLen, uint16_t apid)
|
|
: SpacePacket(payloadDataLen + 1, true, apid, DEFAULT_SEQUENCE_COUNT),
|
|
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;
|
|
};
|
|
|
|
class SetShutdownTimeout : public SupvTcSpacePacket {
|
|
public:
|
|
SetShutdownTimeout(uint32_t timeout)
|
|
: SupvTcSpacePacket(PACKET_LEN, APID_SET_SHUTDOWN_TIMEOUT), timeout(timeout) {
|
|
initPacket();
|
|
makeCrc();
|
|
}
|
|
|
|
private:
|
|
static const uint16_t PACKET_LEN = 4; // uint32_t timeout
|
|
|
|
uint32_t timeout = 0;
|
|
|
|
void initPacket() {
|
|
uint8_t* dataFieldPtr = this->localData.fields.buffer;
|
|
size_t serializedSize = 0;
|
|
SerializeAdapter::serialize<uint32_t>(&timeout, dataFieldPtr, &serializedSize, sizeof(timeout),
|
|
SerializeIF::Endianness::BIG);
|
|
}
|
|
};
|
|
|
|
/**
|
|
* @brief Command to request CRC over memory region of the supervisor.
|
|
*/
|
|
class CheckMemory : public SupvTcSpacePacket {
|
|
public:
|
|
/**
|
|
* @brief Constructor
|
|
*
|
|
* @param memoryId
|
|
* @param startAddress Start address of CRC calculation
|
|
* @param length Length in bytes of memory region
|
|
*/
|
|
CheckMemory(uint8_t memoryId, uint32_t startAddress, uint32_t length)
|
|
: SupvTcSpacePacket(PAYLOAD_LENGTH, APID_CHECK_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 packages the space packet transporting a part of an MPSoC update.
|
|
*/
|
|
class WriteMemory : public SupvTcSpacePacket {
|
|
public:
|
|
/**
|
|
* @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),
|
|
memoryId(memoryId),
|
|
startAddress(startAddress),
|
|
length(length) {
|
|
if (this->length > CHUNK_MAX) {
|
|
sif::error << "WriteMemory::WriteMemory: Invalid length" << std::endl;
|
|
}
|
|
initPacket(updateData);
|
|
this->setSequenceFlags(static_cast<uint8_t>(seqFlags));
|
|
this->setPacketSequenceCount(sequenceCount);
|
|
makeCrc();
|
|
}
|
|
|
|
// Although the space packet has space left for 1010 bytes of data to supervisor can only process
|
|
// update packets with a maximum of 512 bytes.
|
|
static const uint16_t CHUNK_MAX = 512;
|
|
|
|
private:
|
|
static const uint16_t META_DATA_LENGTH = 8;
|
|
|
|
uint8_t memoryId = 0;
|
|
uint8_t n = 1;
|
|
uint32_t startAddress = 0;
|
|
uint16_t length = 0;
|
|
|
|
void initPacket(uint8_t* updateData) {
|
|
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<uint16_t>(&length, &dataFieldPtr, &serializedSize, sizeof(length),
|
|
SerializeIF::Endianness::BIG);
|
|
std::memcpy(dataFieldPtr, updateData, length);
|
|
if (length % 2 != 0) {
|
|
this->setPacketDataLength(length + sizeof(CCSDSPrimaryHeader) + CRC_SIZE - 1);
|
|
// 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;
|
|
}
|
|
}
|
|
};
|
|
|
|
/**
|
|
* @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;
|
|
};
|
|
|
|
/**
|
|
* @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.
|
|
*/
|
|
class TmPacket : public SpacePacket {
|
|
public:
|
|
/**
|
|
* @brief Constructor creates idle packet and sets length field to maximum allowed size.
|
|
*/
|
|
TmPacket() : SpacePacket(PACKET_MAX_SIZE) {}
|
|
|
|
/**
|
|
* @brief Returns the payload data length (data field length without CRC)
|
|
*/
|
|
uint16_t getPayloadDataLength() { return this->getPacketDataLength() - 1; }
|
|
|
|
ReturnValue_t checkCrc() {
|
|
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);
|
|
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();
|
|
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: {
|
|
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,
|
|
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,
|
|
MPSOC_BOOT_FAILED = 0x106,
|
|
SP_NOT_AVAILABLE = 0x200,
|
|
SP_DATA_INSUFFICIENT = 0x201,
|
|
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,
|
|
PG_LOW = 0x300,
|
|
PG_5V_LOW = 0x301,
|
|
PG_0V85_LOW = 0x302,
|
|
PG_1V8_LOW = 0x303,
|
|
PG_MISC_LOW = 0x304,
|
|
PG_3V3_LOW = 0x305,
|
|
PG_MB_VAIO_LOW = 0x306,
|
|
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;
|
|
}
|
|
case StatusCode::NOTHING_TODO: {
|
|
sif::warning << STATUS_PRINTOUT_PREFIX << "Nothing todo, not an error but a warning"
|
|
<< std::endl;
|
|
break;
|
|
}
|
|
case StatusCode::POWER_FAULT: {
|
|
sif::warning << STATUS_PRINTOUT_PREFIX << "Power fault" << std::endl;
|
|
break;
|
|
}
|
|
case StatusCode::INVALID_LENGTH: {
|
|
sif::warning << STATUS_PRINTOUT_PREFIX << "Invalid length" << std::endl;
|
|
break;
|
|
}
|
|
case StatusCode::OUT_OF_RANGE: {
|
|
sif::warning << STATUS_PRINTOUT_PREFIX << "Out of range, lenght check of parameter failed"
|
|
<< std::endl;
|
|
break;
|
|
}
|
|
case StatusCode::OUT_OF_HEAP_MEMORY: {
|
|
sif::warning << STATUS_PRINTOUT_PREFIX << "Out of heap memory" << std::endl;
|
|
break;
|
|
}
|
|
case StatusCode::INVALID_STATE_TRANSITION: {
|
|
sif::warning << STATUS_PRINTOUT_PREFIX << "Invalid state transition" << std::endl;
|
|
break;
|
|
}
|
|
case StatusCode::MPSOC_BOOT_FAILED: {
|
|
sif::warning << STATUS_PRINTOUT_PREFIX << "MPSoC boot failed" << std::endl;
|
|
break;
|
|
}
|
|
case StatusCode::SP_NOT_AVAILABLE: {
|
|
sif::warning << STATUS_PRINTOUT_PREFIX << "SP not available" << std::endl;
|
|
break;
|
|
}
|
|
case StatusCode::SP_DATA_INSUFFICIENT: {
|
|
sif::warning << STATUS_PRINTOUT_PREFIX << "SP data insufficient" << std::endl;
|
|
break;
|
|
}
|
|
case StatusCode::SP_MEMORY_ID_INVALID: {
|
|
sif::warning << STATUS_PRINTOUT_PREFIX << "SP data insufficient" << std::endl;
|
|
break;
|
|
}
|
|
case StatusCode::MPSOC_NOT_IN_RESET: {
|
|
sif::warning << STATUS_PRINTOUT_PREFIX << "MPSoC not in reset" << std::endl;
|
|
break;
|
|
}
|
|
case StatusCode::FLASH_INIT_FAILED: {
|
|
sif::warning << STATUS_PRINTOUT_PREFIX << "Flash init failed" << std::endl;
|
|
break;
|
|
}
|
|
case StatusCode::FLASH_ERASE_FAILED: {
|
|
sif::warning << STATUS_PRINTOUT_PREFIX << "Flash erase failed" << std::endl;
|
|
break;
|
|
}
|
|
case StatusCode::FLASH_WRITE_FAILED: {
|
|
sif::warning << STATUS_PRINTOUT_PREFIX << "Flash write failed" << std::endl;
|
|
break;
|
|
}
|
|
case StatusCode::FLASH_VERIFY_FAILED: {
|
|
sif::warning << STATUS_PRINTOUT_PREFIX << "Flash verify failed" << std::endl;
|
|
break;
|
|
}
|
|
case StatusCode::CANNOT_ACCESS_TM: {
|
|
sif::warning << STATUS_PRINTOUT_PREFIX << "Can not access tm" << std::endl;
|
|
break;
|
|
}
|
|
case StatusCode::CANNOT_SEND_TM: {
|
|
sif::warning << STATUS_PRINTOUT_PREFIX << "Can not access tm" << std::endl;
|
|
break;
|
|
}
|
|
case StatusCode::PG_LOW: {
|
|
sif::warning << STATUS_PRINTOUT_PREFIX << "PG low" << std::endl;
|
|
break;
|
|
}
|
|
case StatusCode::PG_5V_LOW: {
|
|
sif::warning << STATUS_PRINTOUT_PREFIX << "PG 5V low" << std::endl;
|
|
break;
|
|
}
|
|
case StatusCode::PG_0V85_LOW: {
|
|
sif::warning << STATUS_PRINTOUT_PREFIX << "PG 0V85 low" << std::endl;
|
|
break;
|
|
}
|
|
case StatusCode::PG_1V8_LOW: {
|
|
sif::warning << STATUS_PRINTOUT_PREFIX << "PG 1V8 low" << std::endl;
|
|
break;
|
|
}
|
|
case StatusCode::PG_MISC_LOW: {
|
|
sif::warning << STATUS_PRINTOUT_PREFIX << "PG misc low" << std::endl;
|
|
break;
|
|
}
|
|
case StatusCode::PG_3V3_LOW: {
|
|
sif::warning << STATUS_PRINTOUT_PREFIX << "PG 3V3 low" << std::endl;
|
|
break;
|
|
}
|
|
case StatusCode::PG_MB_VAIO_LOW: {
|
|
sif::warning << STATUS_PRINTOUT_PREFIX << "PG mb vaio low" << std::endl;
|
|
break;
|
|
}
|
|
case StatusCode::PG_MB_MPSOCIO_LOW: {
|
|
sif::warning << STATUS_PRINTOUT_PREFIX << "PG mb mpsocio low" << std::endl;
|
|
break;
|
|
}
|
|
default:
|
|
sif::warning << "ExecutionReport::printStatusInformation: Invalid status code: 0x"
|
|
<< std::hex << static_cast<uint16_t>(statusCode) << std::endl;
|
|
break;
|
|
}
|
|
}
|
|
};
|
|
|
|
/**
|
|
* @brief This dataset stores the boot status report of the supervisor.
|
|
*/
|
|
class BootStatusReport : public StaticLocalDataSet<BOOT_REPORT_SET_ENTRIES> {
|
|
public:
|
|
BootStatusReport(HasLocalDataPoolIF* owner) : StaticLocalDataSet(owner, BOOT_REPORT_SET_ID) {}
|
|
|
|
BootStatusReport(object_id_t objectId)
|
|
: StaticLocalDataSet(sid_t(objectId, BOOT_REPORT_SET_ID)) {}
|
|
|
|
/** Information about boot status of MPSoC */
|
|
lp_var_t<uint8_t> socState = lp_var_t<uint8_t>(sid.objectId, PoolIds::BR_SOC_STATE, this);
|
|
lp_var_t<uint8_t> powerCycles = lp_var_t<uint8_t>(sid.objectId, PoolIds::POWER_CYCLES, this);
|
|
/** Time the MPSoC needs for last boot */
|
|
lp_var_t<uint32_t> bootAfterMs = lp_var_t<uint32_t>(sid.objectId, PoolIds::BOOT_AFTER_MS, this);
|
|
/** The currently set boot timeout */
|
|
lp_var_t<uint32_t> bootTimeoutMs =
|
|
lp_var_t<uint32_t>(sid.objectId, PoolIds::BOOT_TIMEOUT_MS, this);
|
|
lp_var_t<uint8_t> activeNvm = lp_var_t<uint8_t>(sid.objectId, PoolIds::ACTIVE_NVM, this);
|
|
/** States of the boot partition pins */
|
|
lp_var_t<uint8_t> bp0State = lp_var_t<uint8_t>(sid.objectId, PoolIds::BP0_STATE, this);
|
|
lp_var_t<uint8_t> bp1State = lp_var_t<uint8_t>(sid.objectId, PoolIds::BP1_STATE, this);
|
|
lp_var_t<uint8_t> bp2State = lp_var_t<uint8_t>(sid.objectId, PoolIds::BP2_STATE, this);
|
|
lp_var_t<uint8_t> bootState = lp_var_t<uint8_t>(sid.objectId, PoolIds::BOOT_STATE, this);
|
|
lp_var_t<uint8_t> bootCycles = lp_var_t<uint8_t>(sid.objectId, PoolIds::BOOT_CYCLES, this);
|
|
};
|
|
|
|
/**
|
|
* @brief This dataset stores the housekeeping data of the supervisor.
|
|
*/
|
|
class HkSet : public StaticLocalDataSet<HK_SET_ENTRIES> {
|
|
public:
|
|
|
|
enum class SocState {
|
|
OFF = 0,
|
|
BOOTING = 1,
|
|
OPERATIONAL = 3,
|
|
SHUTDOWN = 4
|
|
};
|
|
|
|
HkSet(HasLocalDataPoolIF* owner) : StaticLocalDataSet(owner, HK_SET_ID) {}
|
|
|
|
HkSet(object_id_t objectId) : StaticLocalDataSet(sid_t(objectId, HK_SET_ID)) {}
|
|
|
|
lp_var_t<uint32_t> tempPs = lp_var_t<uint32_t>(sid.objectId, PoolIds::TEMP_PS, this);
|
|
lp_var_t<uint32_t> tempPl = lp_var_t<uint32_t>(sid.objectId, PoolIds::TEMP_PS, this);
|
|
lp_var_t<uint32_t> tempSup = lp_var_t<uint32_t>(sid.objectId, PoolIds::TEMP_SUP, this);
|
|
lp_var_t<uint64_t> uptime = lp_var_t<uint64_t>(sid.objectId, PoolIds::UPTIME, this);
|
|
lp_var_t<uint32_t> cpuLoad = lp_var_t<uint32_t>(sid.objectId, PoolIds::CPULOAD, this);
|
|
lp_var_t<uint32_t> availableHeap = lp_var_t<uint32_t>(sid.objectId, PoolIds::AVAILABLEHEAP, this);
|
|
lp_var_t<uint32_t> numTcs = lp_var_t<uint32_t>(sid.objectId, PoolIds::NUM_TCS, this);
|
|
lp_var_t<uint32_t> numTms = lp_var_t<uint32_t>(sid.objectId, PoolIds::NUM_TMS, this);
|
|
lp_var_t<uint32_t> socState = lp_var_t<uint32_t>(sid.objectId, PoolIds::HK_SOC_STATE, this);
|
|
lp_var_t<uint8_t> nvm0_1_state = lp_var_t<uint8_t>(sid.objectId, PoolIds::NVM0_1_STATE, this);
|
|
lp_var_t<uint8_t> nvm3_state = lp_var_t<uint8_t>(sid.objectId, PoolIds::NVM3_STATE, this);
|
|
lp_var_t<uint8_t> missionIoState =
|
|
lp_var_t<uint8_t>(sid.objectId, PoolIds::MISSION_IO_STATE, this);
|
|
lp_var_t<uint8_t> fmcState = lp_var_t<uint8_t>(sid.objectId, PoolIds::FMC_STATE, this);
|
|
};
|
|
|
|
/**
|
|
* @brief This dataset stores the last requested latchup status report.
|
|
*/
|
|
class LatchupStatusReport : public StaticLocalDataSet<LATCHUP_RPT_SET_ENTRIES> {
|
|
public:
|
|
LatchupStatusReport(HasLocalDataPoolIF* owner) : StaticLocalDataSet(owner, LATCHUP_RPT_ID) {}
|
|
|
|
LatchupStatusReport(object_id_t objectId) : StaticLocalDataSet(sid_t(objectId, LATCHUP_RPT_ID)) {}
|
|
|
|
lp_var_t<uint8_t> id = lp_var_t<uint8_t>(sid.objectId, PoolIds::LATCHUP_ID, this);
|
|
lp_var_t<uint16_t> cnt0 = lp_var_t<uint16_t>(sid.objectId, PoolIds::CNT0, this);
|
|
lp_var_t<uint16_t> cnt1 = lp_var_t<uint16_t>(sid.objectId, PoolIds::CNT1, this);
|
|
lp_var_t<uint16_t> cnt2 = lp_var_t<uint16_t>(sid.objectId, PoolIds::CNT2, this);
|
|
lp_var_t<uint16_t> cnt3 = lp_var_t<uint16_t>(sid.objectId, PoolIds::CNT3, this);
|
|
lp_var_t<uint16_t> cnt4 = lp_var_t<uint16_t>(sid.objectId, PoolIds::CNT4, this);
|
|
lp_var_t<uint16_t> cnt5 = lp_var_t<uint16_t>(sid.objectId, PoolIds::CNT5, this);
|
|
lp_var_t<uint16_t> cnt6 = lp_var_t<uint16_t>(sid.objectId, PoolIds::CNT6, this);
|
|
lp_var_t<uint16_t> timeMsec =
|
|
lp_var_t<uint16_t>(sid.objectId, PoolIds::LATCHUP_RPT_TIME_MSEC, this);
|
|
lp_var_t<uint8_t> timeSec = lp_var_t<uint8_t>(sid.objectId, PoolIds::LATCHUP_RPT_TIME_SEC, this);
|
|
lp_var_t<uint8_t> timeMin = lp_var_t<uint8_t>(sid.objectId, PoolIds::LATCHUP_RPT_TIME_MIN, this);
|
|
lp_var_t<uint8_t> timeHour =
|
|
lp_var_t<uint8_t>(sid.objectId, PoolIds::LATCHUP_RPT_TIME_HOUR, this);
|
|
lp_var_t<uint8_t> timeDay = lp_var_t<uint8_t>(sid.objectId, PoolIds::LATCHUP_RPT_TIME_DAY, this);
|
|
lp_var_t<uint8_t> timeMon = lp_var_t<uint8_t>(sid.objectId, PoolIds::LATCHUP_RPT_TIME_MON, this);
|
|
lp_var_t<uint8_t> timeYear =
|
|
lp_var_t<uint8_t>(sid.objectId, PoolIds::LATCHUP_RPT_TIME_YEAR, this);
|
|
lp_var_t<uint8_t> isSet = lp_var_t<uint8_t>(sid.objectId, PoolIds::LATCHUP_RPT_IS_SET, this);
|
|
|
|
static const uint8_t IS_SET_BIT_POS = 15;
|
|
};
|
|
|
|
/**
|
|
* @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> 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);
|
|
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);
|
|
|
|
void printSet() {
|
|
sif::info << "LoggingReport: Latchup happened count 0: " << this->latchupHappenCnt0
|
|
<< std::endl;
|
|
sif::info << "LoggingReport: Latchup happened count 1: " << this->latchupHappenCnt0
|
|
<< std::endl;
|
|
sif::info << "LoggingReport: Latchup happened count 2: " << this->latchupHappenCnt0
|
|
<< std::endl;
|
|
sif::info << "LoggingReport: Latchup happened count 3: " << this->latchupHappenCnt0
|
|
<< std::endl;
|
|
sif::info << "LoggingReport: Latchup happened count 4: " << this->latchupHappenCnt0
|
|
<< std::endl;
|
|
sif::info << "LoggingReport: Latchup happened count 5: " << this->latchupHappenCnt0
|
|
<< std::endl;
|
|
sif::info << "LoggingReport: Latchup happened count 6: " << this->latchupHappenCnt0
|
|
<< std::endl;
|
|
sif::info << "LoggingReport: ADC deviation triggers count: " << this->latchupHappenCnt0
|
|
<< std::endl;
|
|
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;
|
|
sif::info << "LoggingReport: MPSoC power up: " << this->mpsocPowerup << std::endl;
|
|
sif::info << "LoggingReport: MPSoC updates: " << this->mpsocUpdates << std::endl;
|
|
sif::info << "LoggingReport: Last received TC: " << this->lastRecvdTc << std::endl;
|
|
}
|
|
};
|
|
|
|
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 {
|
|
if (crc != goodCrc) {
|
|
return SupvReturnValuesIF::UPDATE_CRC_FAILURE;
|
|
}
|
|
return HasReturnvaluesIF::RETURN_OK;
|
|
}
|
|
|
|
uint16_t getCrc() const { return crc; }
|
|
|
|
uint16_t getNominalSize() const { return FULL_SIZE; }
|
|
|
|
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;
|
|
}
|
|
};
|
|
|
|
/**
|
|
* @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: " << this->adcRaw0 << std::endl;
|
|
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;
|
|
}
|
|
};
|
|
} // namespace supv
|
|
|
|
#endif /* MISSION_DEVICES_DEVICEDEFINITIONS_PLOCSVPDEFINITIONS_H_ */
|