add factory reset cmd
All checks were successful
EIVE/eive-obsw/pipeline/pr-develop This commit looks good

This commit is contained in:
2022-11-08 20:37:57 +01:00
parent 52f15906d8
commit d3da5bd2d8
3 changed files with 73 additions and 36 deletions

View File

@ -102,10 +102,8 @@ 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;
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 constexpr DeviceCommandId_t FACTORY_RESET = 39;
static const DeviceCommandId_t CONSECUTIVE_MRAM_DUMP = 43;
static const DeviceCommandId_t START_MPSOC_QUIET = 45;
static const DeviceCommandId_t SET_SHUTDOWN_TIMEOUT = 46;
@ -144,27 +142,6 @@ static const uint16_t SIZE_LATCHUP_STATUS_REPORT = 31;
static const uint16_t SIZE_LOGGING_REPORT = 73;
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
*/
// 2 bits APID SRC, 00 for OBC, 2 bits APID DEST, 01 for SUPV, 7 bits CMD ID -> Mask 0x080
static constexpr uint16_t APID_TC_SUPV_MASK = 0x080;
@ -292,6 +269,21 @@ static constexpr size_t MIN_PAYLOAD_LEN = SECONDARY_HEADER_LEN + CRC_LEN;
static constexpr size_t MIN_TMTC_LEN = ccsds::HEADER_LEN + MIN_PAYLOAD_LEN;
static constexpr size_t PAYLOAD_OFFSET = ccsds::HEADER_LEN + SECONDARY_HEADER_LEN;
enum class FactoryResetSelect : uint8_t {
EVENT_BUF = 0x00,
ADC_BUF = 0x01,
SYS_CFG = 0x02,
DEBUG_CFG = 0x03,
BOOT_MAN_CFG = 0x04,
DATA_LOGGER_CFG = 0x05,
DATA_LOGGER_OP_DATA = 0x06,
LATCHUP_MON_CFG = 0x07,
ADC_MON_CFG = 0x08,
WDOG_MAN_CFG = 0x09,
HK_CFG = 0x0A,
MEM_MAN_CFG = 0xB9
};
struct UpdateParams {
std::string file;
uint8_t memId;
@ -646,6 +638,29 @@ class SetBootTimeout : public TcBase {
}
};
class FactoryReset : public TcBase {
public:
FactoryReset(TcParams params)
: TcBase(params, Apid::DATA_LOGGER,
static_cast<uint8_t>(tc::DataLoggerServiceId::FACTORY_RESET), 0) {}
ReturnValue_t buildPacket(std::optional<uint8_t> op) {
if (op) {
setLenFromPayloadLen(1);
}
auto res = checkSizeAndSerializeHeader();
if (res != returnvalue::OK) {
return res;
}
if (op) {
payloadStart[0] = op.value();
}
return calcAndSetCrc();
}
private:
};
/**
* @brief This class can be used to generate the space packet to set the maximum boot tries.
*/