From 8dbb3dcd9b9fa08ee2222e0ab8629ae583415f40 Mon Sep 17 00:00:00 2001 From: Robin Mueller Date: Mon, 7 Nov 2022 17:31:16 +0100 Subject: [PATCH] continue refactoring --- .../PlocSupervisorDefinitions.h | 329 ++++++++---------- linux/devices/ploc/PlocSupervisorHandler.cpp | 150 ++++---- linux/devices/ploc/PlocSupervisorHandler.h | 4 +- 3 files changed, 218 insertions(+), 265 deletions(-) diff --git a/linux/devices/devicedefinitions/PlocSupervisorDefinitions.h b/linux/devices/devicedefinitions/PlocSupervisorDefinitions.h index e34f6ab0..128d988c 100644 --- a/linux/devices/devicedefinitions/PlocSupervisorDefinitions.h +++ b/linux/devices/devicedefinitions/PlocSupervisorDefinitions.h @@ -182,7 +182,13 @@ enum class AdcMonServiceIds : uint8_t { COPY_ADC_DATA_TO_MRAM = 0x05 }; -enum class DataLoggerServiceIds : uint8_t { FACTORY_RESET = 0x07 }; +enum class MemManServiceIds : uint8_t { ERASE = 0x01, WRITE = 0x02, CHECK = 0x03 }; + +enum class DataLoggerServiceIds : uint8_t { + WIPE_MRAM = 0x05, + DUMP_MRAM = 0x06, + FACTORY_RESET = 0x07 +}; // Right now, none of the commands seem to be implemented, but still // keep the enum here in case some are added @@ -744,7 +750,7 @@ class SetAdcEnabledChannels : public TcBase { * @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 ploc::SpTcBase { +class SetAdcWindowAndStride : public TcBase { public: /** * @brief Constructor @@ -752,11 +758,9 @@ class SetAdcWindowAndStride : public ploc::SpTcBase { * @param windowSize * @param stridingStepSize */ - SetAdcWindowAndStride(ploc::SpTcParams params) : ploc::SpTcBase(params) { - spParams.setFullPayloadLen(DATA_FIELD_LENGTH); - // spParams.creator.setApid(APID_SET_ADC_WINDOW_AND_STRIDE); - // spParams.creator.setSeqCount(DEFAULT_SEQUENCE_COUNT); - } + SetAdcWindowAndStride(TcParams params) + : TcBase(params, Apids::ADC_MON, static_cast(AdcMonServiceIds::SET_WINDOW_STRIDE), + 4) {} ReturnValue_t buildPacket(uint16_t windowSize, uint16_t stridingStepSize) { auto res = checkSizeAndSerializeHeader(); @@ -768,10 +772,6 @@ class SetAdcWindowAndStride : public ploc::SpTcBase { } private: - static const uint16_t DATA_FIELD_LENGTH = 6; - - static const uint16_t CRC_OFFSET = DATA_FIELD_LENGTH - 2; - void initPacket(uint16_t windowSize, uint16_t stridingStepSize) { size_t serializedSize = 6; uint8_t* data = payloadStart; @@ -785,18 +785,16 @@ class SetAdcWindowAndStride : public ploc::SpTcBase { /** * @brief This class packages the space packet to set the ADC trigger threshold. */ -class SetAdcThreshold : public ploc::SpTcBase { +class SetAdcThreshold : public TcBase { public: /** * @brief Constructor * * @param threshold */ - SetAdcThreshold(ploc::SpTcParams params) : ploc::SpTcBase(params) { - spParams.setFullPayloadLen(DATA_FIELD_LENGTH); - // spParams.creator.setApid(APID_SET_ADC_THRESHOLD); - spParams.creator.setSeqCount(DEFAULT_SEQUENCE_COUNT); - } + SetAdcThreshold(TcParams params) + : TcBase(params, Apids::ADC_MON, static_cast(AdcMonServiceIds::SET_ADC_THRESHOLD), + 4) {} ReturnValue_t buildPacket(uint32_t threshold) { auto res = checkSizeAndSerializeHeader(); @@ -808,11 +806,6 @@ class SetAdcThreshold : public ploc::SpTcBase { } 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; - void initPacket(uint32_t threshold) { size_t serializedSize = 0; SerializeAdapter::serialize(&threshold, payloadStart, &serializedSize, sizeof(threshold), @@ -823,17 +816,15 @@ class SetAdcThreshold : public ploc::SpTcBase { /** * @brief This class packages the space packet to run auto EM tests. */ -class RunAutoEmTests : public ploc::SpTcBase { +class RunAutoEmTests : public TcBase { public: /** * @brief Constructor * * @param test 1 - complete EM test, 2 - Short test (only memory readback NVM0,1,3) */ - RunAutoEmTests(ploc::SpTcParams params) : ploc::SpTcBase(params) { - spParams.setFullPayloadLen(DATA_FIELD_LENGTH); - // spParams.creator.setApid(APID_RUN_AUTO_EM_TESTS); - spParams.creator.setSeqCount(DEFAULT_SEQUENCE_COUNT); + RunAutoEmTests(TcParams params) + : TcBase(params, Apids::TMTC_MAN, static_cast(TmtcServiceIds::RUN_AUTO_EM_TEST), 1) { } ReturnValue_t buildPacket(uint8_t test) { @@ -846,11 +837,6 @@ class RunAutoEmTests : public ploc::SpTcBase { } 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(uint8_t test) { payloadStart[0] = test; } @@ -859,65 +845,62 @@ class RunAutoEmTests : public ploc::SpTcBase { /** * @brief This class packages the space packet to wipe or dump parts of the MRAM. */ -class MramCmd : public ploc::SpTcBase { - 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(ploc::SpTcParams params) : ploc::SpTcBase(params) { - spParams.setFullPayloadLen(DATA_FIELD_LENGTH); - // spParams.creator.setSeqCount(DEFAULT_SEQUENCE_COUNT); - } - - ReturnValue_t buildPacket(uint32_t start, uint32_t stop, MramAction action) { - if (action == MramAction::WIPE) { - // spParams.creator.setApid(APID_WIPE_MRAM); - } else if (action == MramAction::DUMP) { - // spParams.creator.setApid(APID_DUMP_MRAM); - } else { - sif::debug << "WipeMram: Invalid action specified"; - } - auto res = checkSizeAndSerializeHeader(); - if (res != returnvalue::OK) { - return res; - } - initPacket(start, stop); - return calcAndSetCrc(); - } - - private: - static const uint16_t DATA_FIELD_LENGTH = 8; - - static const uint16_t CRC_OFFSET = DATA_FIELD_LENGTH - 2; - - uint32_t start = 0; - uint32_t stop = 0; - - void initPacket(uint32_t start, uint32_t stop) { - uint8_t concatBuffer[6]; - concatBuffer[0] = static_cast(start >> 16); - concatBuffer[1] = static_cast(start >> 8); - concatBuffer[2] = static_cast(start); - concatBuffer[3] = static_cast(stop >> 16); - concatBuffer[4] = static_cast(stop >> 8); - concatBuffer[5] = static_cast(stop); - std::memcpy(payloadStart, concatBuffer, sizeof(concatBuffer)); - } -}; +// class MramCmd : public TcBase { +// 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(TcParams params) +// : TcBase(params, Apids::DATA_LOGGER) { +// setLenFromPayloadLen(6); +// } +// +// ReturnValue_t buildPacket(uint32_t start, uint32_t stop, MramAction action) { +// if (action == MramAction::WIPE) { +// setServiceId(static_cast(DataLoggerServiceIds::WIPE_MRAM)); +// } else if (action == MramAction::DUMP) { +// setServiceId(static_cast(DataLoggerServiceIds::DUMP_MRAM)); +// } else { +// sif::debug << "WipeMram: Invalid action specified"; +// } +// auto res = checkSizeAndSerializeHeader(); +// if (res != returnvalue::OK) { +// return res; +// } +// initPacket(start, stop); +// return calcAndSetCrc(); +// } +// +// private: +// +// uint32_t start = 0; +// uint32_t stop = 0; +// +// void initPacket(uint32_t start, uint32_t stop) { +// uint8_t concatBuffer[6]; +// concatBuffer[0] = static_cast(start >> 16); +// concatBuffer[1] = static_cast(start >> 8); +// concatBuffer[2] = static_cast(start); +// concatBuffer[3] = static_cast(stop >> 16); +// concatBuffer[4] = static_cast(stop >> 8); +// concatBuffer[5] = static_cast(stop); +// std::memcpy(payloadStart, concatBuffer, sizeof(concatBuffer)); +// } +// }; /** * @brief This class packages the space packet change the state of a GPIO. This command is only * required for ground testing. */ -class SetGpio : public ploc::SpTcBase { +class SetGpio : public TcBase { public: /** * @brief Constructor @@ -926,11 +909,8 @@ class SetGpio : public ploc::SpTcBase { * @param pin * @param val */ - SetGpio(ploc::SpTcParams params) : ploc::SpTcBase(params) { - spParams.setFullPayloadLen(DATA_FIELD_LENGTH); - // spParams.creator.setApid(APID_SET_GPIO); - spParams.creator.setSeqCount(DEFAULT_SEQUENCE_COUNT); - } + SetGpio(TcParams params) + : TcBase(params, Apids::TMTC_MAN, static_cast(TmtcServiceIds::SET_GPIO), 3) {} ReturnValue_t buildPacket(uint8_t port, uint8_t pin, uint8_t val) { auto res = checkSizeAndSerializeHeader(); @@ -942,11 +922,6 @@ class SetGpio : public ploc::SpTcBase { } 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; @@ -962,7 +937,7 @@ class SetGpio : public ploc::SpTcBase { * @brief This class packages the space packet causing the supervisor print the state of a GPIO * to the debug output. */ -class ReadGpio : public ploc::SpTcBase { +class ReadGpio : public TcBase { public: /** * @brief Constructor @@ -970,11 +945,8 @@ class ReadGpio : public ploc::SpTcBase { * @param port * @param pin */ - ReadGpio(ploc::SpTcParams params) : ploc::SpTcBase(params) { - spParams.setFullPayloadLen(DATA_FIELD_LENGTH); - // spParams.creator.setApid(APID_READ_GPIO); - spParams.creator.setSeqCount(DEFAULT_SEQUENCE_COUNT); - } + ReadGpio(TcParams params) + : TcBase(params, Apids::TMTC_MAN, static_cast(TmtcServiceIds::READ_GPIO), 2) {} ReturnValue_t buildPacket(uint8_t port, uint8_t pin) { auto res = checkSizeAndSerializeHeader(); @@ -986,11 +958,6 @@ class ReadGpio : public ploc::SpTcBase { } 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; @@ -1008,57 +975,56 @@ class ReadGpio : public ploc::SpTcBase { * OP = 0x01: Only the mirror entries will be wiped. * OP = 0x02: Only the circular entries will be wiped. */ -class FactoryReset : public ploc::SpTcBase { +// class FactoryReset : public TcBase { +// public: +// enum class Op { CLEAR_ALL, MIRROR_ENTRIES, CIRCULAR_ENTRIES }; +// +// /** +// * @brief Constructor +// * +// * @param op +// */ +// FactoryReset(TcParams params) +// : TcBase(params, Apids::TMTC_MAN, static_cast(TmtcServiceIds::)) { +// // spParams.creator.setApid(APID_FACTORY_RESET); +// spParams.creator.setSeqCount(DEFAULT_SEQUENCE_COUNT); +// } +// +// ReturnValue_t buildPacket(Op op) { +// auto res = checkSizeAndSerializeHeader(); +// if (res != returnvalue::OK) { +// return res; +// } +// initPacket(op); +// return calcAndSetCrc(); +// } +// +// private: +// static const uint16_t DEFAULT_SEQUENCE_COUNT = 1; +// +// void initPacket(Op op) { +// size_t packetDataLen = 2; +// switch (op) { +// case Op::MIRROR_ENTRIES: +// payloadStart[0] = 1; +// packetDataLen = 3; +// break; +// case Op::CIRCULAR_ENTRIES: +// payloadStart[0] = 2; +// packetDataLen = 3; +// break; +// default: +// break; +// } +// spParams.setFullPayloadLen(packetDataLen); +// } +// }; + +class SetShutdownTimeout : public TcBase { public: - enum class Op { CLEAR_ALL, MIRROR_ENTRIES, CIRCULAR_ENTRIES }; - - /** - * @brief Constructor - * - * @param op - */ - FactoryReset(ploc::SpTcParams params) : ploc::SpTcBase(params) { - // spParams.creator.setApid(APID_FACTORY_RESET); - spParams.creator.setSeqCount(DEFAULT_SEQUENCE_COUNT); - } - - ReturnValue_t buildPacket(Op op) { - auto res = checkSizeAndSerializeHeader(); - if (res != returnvalue::OK) { - return res; - } - initPacket(op); - return calcAndSetCrc(); - } - - private: - static const uint16_t DEFAULT_SEQUENCE_COUNT = 1; - - void initPacket(Op op) { - size_t packetDataLen = 2; - switch (op) { - case Op::MIRROR_ENTRIES: - payloadStart[0] = 1; - packetDataLen = 3; - break; - case Op::CIRCULAR_ENTRIES: - payloadStart[0] = 2; - packetDataLen = 3; - break; - default: - break; - } - spParams.setFullPayloadLen(packetDataLen); - } -}; - -class SetShutdownTimeout : public ploc::SpTcBase { - public: - SetShutdownTimeout(ploc::SpTcParams params) : ploc::SpTcBase(params) { - spParams.setFullPayloadLen(PAYLOAD_LEN + 2); - // spParams.creator.setApid(APID_SET_SHUTDOWN_TIMEOUT); - // spParams.creator.setSeqCount(DEFAULT_SEQUENCE_COUNT); - } + SetShutdownTimeout(TcParams params) + : TcBase(params, Apids::BOOT_MAN, static_cast(BootManServiceIds::SHUTDOWN_TIMEOUT), + 4) {} ReturnValue_t buildPacket(uint32_t timeout) { auto res = checkSizeAndSerializeHeader(); @@ -1070,10 +1036,6 @@ class SetShutdownTimeout : public ploc::SpTcBase { } private: - static const uint16_t PAYLOAD_LEN = 4; // uint32_t timeout - - uint32_t timeout = 0; - void initPacket(uint32_t timeout) { size_t serLen = 0; SerializeAdapter::serialize(&timeout, payloadStart, &serLen, sizeof(timeout), @@ -1084,7 +1046,7 @@ class SetShutdownTimeout : public ploc::SpTcBase { /** * @brief Command to request CRC over memory region of the supervisor. */ -class CheckMemory : public ploc::SpTcBase { +class CheckMemory : public TcBase { public: /** * @brief Constructor @@ -1093,11 +1055,8 @@ class CheckMemory : public ploc::SpTcBase { * @param startAddress Start address of CRC calculation * @param length Length in bytes of memory region */ - CheckMemory(ploc::SpTcParams params) : ploc::SpTcBase(params) { - spParams.setFullPayloadLen(PAYLOAD_LENGTH + 2); - // spParams.creator.setApid(APID_CHECK_MEMORY); - // spParams.creator.setSeqCount(DEFAULT_SEQUENCE_COUNT); - } + CheckMemory(TcParams params) + : TcBase(params, Apids::MEM_MAN, static_cast(MemManServiceIds::CHECK), 10) {} ReturnValue_t buildPacket(uint8_t memoryId, uint32_t startAddress, uint32_t length) { auto res = checkSizeAndSerializeHeader(); @@ -1109,8 +1068,6 @@ class CheckMemory : public ploc::SpTcBase { } private: - static const uint16_t PAYLOAD_LENGTH = 10; // length without CRC field - uint8_t memoryId = 0; uint8_t n = 1; uint32_t startAddress = 0; @@ -1132,7 +1089,7 @@ class CheckMemory : public ploc::SpTcBase { /** * @brief This class packages the space packet transporting a part of an MPSoC update. */ -class WriteMemory : public ploc::SpTcBase { +class WriteMemory : public TcBase { public: /** * @brief Constructor @@ -1141,10 +1098,8 @@ class WriteMemory : public ploc::SpTcBase { * @param sequenceCount Sequence count (first update packet expects 1 as sequence count) * @param updateData Pointer to buffer containing update data */ - WriteMemory(ploc::SpTcParams params) : ploc::SpTcBase(params) { - // spParams.creator.setApid(APID_WRITE_MEMORY); - // spParams.creator.setSeqCount(DEFAULT_SEQUENCE_COUNT); - } + WriteMemory(TcParams params) + : TcBase(params, Apids::MEM_MAN, static_cast(MemManServiceIds::WRITE), 1) {} ReturnValue_t buildPacket(ccsds::SequenceFlags seqFlags, uint16_t sequenceCount, uint8_t memoryId, uint32_t startAddress, uint16_t length, uint8_t* updateData) { @@ -1173,9 +1128,9 @@ class WriteMemory : public ploc::SpTcBase { uint8_t* updateData) { uint8_t* data = payloadStart; if (updateDataLen % 2 != 0) { - spParams.setFullPayloadLen(META_DATA_LENGTH + updateDataLen + 1 + 2); + setLenFromPayloadLen(META_DATA_LENGTH + updateDataLen + 1); } else { - spParams.setFullPayloadLen(META_DATA_LENGTH + updateDataLen + 2); + setLenFromPayloadLen(META_DATA_LENGTH + updateDataLen); } // To avoid crashes in this unexpected case ReturnValue_t result = checkPayloadLen(); @@ -1204,13 +1159,11 @@ class WriteMemory : public ploc::SpTcBase { /** * @brief This class can be used to package erase memory command */ -class EraseMemory : public ploc::SpTcBase { +class EraseMemory : public TcBase { public: - EraseMemory(ploc::SpTcParams params) : ploc::SpTcBase(params) { - spParams.setFullPayloadLen(PAYLOAD_LENGTH + 2); - // spParams.creator.setApid(APID_ERASE_MEMORY); - // spParams.creator.setSeqCount(DEFAULT_SEQUENCE_COUNT); - } + EraseMemory(TcParams params) + : TcBase(params, Apids::MEM_MAN, static_cast(MemManServiceIds::ERASE), + PAYLOAD_LENGTH) {} ReturnValue_t buildPacket(uint8_t memoryId, uint32_t startAddress, uint32_t length) { auto res = checkSizeAndSerializeHeader(); @@ -1246,9 +1199,9 @@ class EraseMemory : public ploc::SpTcBase { /** * @brief This class creates the space packet to enable the auto TM generation */ -class EnableAutoTm : public ploc::SpTcBase { +class EnableAutoTm : public TcBase { public: - EnableAutoTm(ploc::SpTcParams params) : ploc::SpTcBase(params) { + EnableAutoTm(TcParams params) : TcBase(params) { spParams.setFullPayloadLen(PAYLOAD_LENGTH + 2); // spParams.creator.setApid(APID_AUTO_TM); // spParams.creator.setSeqCount(DEFAULT_SEQUENCE_COUNT); @@ -1271,9 +1224,9 @@ class EnableAutoTm : public ploc::SpTcBase { /** * @brief This class creates the space packet to disable the auto TM generation */ -class DisableAutoTm : public ploc::SpTcBase { +class DisableAutoTm : public TcBase { public: - DisableAutoTm(ploc::SpTcParams params) : ploc::SpTcBase(params) { + DisableAutoTm(TcParams params) : TcBase(params) { spParams.setFullPayloadLen(PAYLOAD_LENGTH + 2); // spParams.creator.setApid(APID_AUTO_TM); // spParams.creator.setSeqCount(DEFAULT_SEQUENCE_COUNT); @@ -1296,7 +1249,7 @@ class DisableAutoTm : public ploc::SpTcBase { /** * @brief This class creates the space packet to request the logging data from the supervisor */ -class RequestLoggingData : public ploc::SpTcBase { +class RequestLoggingData : public TcBase { public: /** * Subapid @@ -1308,7 +1261,7 @@ class RequestLoggingData : public ploc::SpTcBase { SET_LOGGING_TOPIC = 4 /**< SET_LOGGING_TOPIC */ }; - RequestLoggingData(ploc::SpTcParams params) : ploc::SpTcBase(params) { + RequestLoggingData(TcParams params) : TcBase(params) { spParams.setFullPayloadLen(PAYLOAD_LENGTH + 2); // spParams.creator.setApid(APID_REQUEST_LOGGING_DATA); // spParams.creator.setSeqCount(DEFAULT_SEQUENCE_COUNT); diff --git a/linux/devices/ploc/PlocSupervisorHandler.cpp b/linux/devices/ploc/PlocSupervisorHandler.cpp index a5a3b5ef..36898215 100644 --- a/linux/devices/ploc/PlocSupervisorHandler.cpp +++ b/linux/devices/ploc/PlocSupervisorHandler.cpp @@ -318,14 +318,14 @@ ReturnValue_t PlocSupervisorHandler::buildCommandFromCommand(DeviceCommandId_t d result = prepareRunAutoEmTest(commandData); break; } - case WIPE_MRAM: { - result = prepareWipeMramCmd(commandData); - break; - } - case FIRST_MRAM_DUMP: - case CONSECUTIVE_MRAM_DUMP: - result = prepareDumpMramCmd(commandData); - break; + // case WIPE_MRAM: { + // result = prepareWipeMramCmd(commandData); + // break; + // } + // case FIRST_MRAM_DUMP: + // case CONSECUTIVE_MRAM_DUMP: + // result = prepareDumpMramCmd(commandData); + // break; case SET_GPIO: { prepareSetGpioCmd(commandData); result = returnvalue::OK; @@ -341,33 +341,33 @@ ReturnValue_t PlocSupervisorHandler::buildCommandFromCommand(DeviceCommandId_t d // result = returnvalue::OK; // break; // } - case FACTORY_RESET_CLEAR_ALL: { - FactoryReset packet(spParams); - result = packet.buildPacket(FactoryReset::Op::CLEAR_ALL); - if (result != returnvalue::OK) { - break; - } - finishTcPrep(packet.getFullPacketLen()); - break; - } - case FACTORY_RESET_CLEAR_MIRROR: { - FactoryReset packet(spParams); - result = packet.buildPacket(FactoryReset::Op::MIRROR_ENTRIES); - if (result != returnvalue::OK) { - break; - } - finishTcPrep(packet.getFullPacketLen()); - break; - } - case FACTORY_RESET_CLEAR_CIRCULAR: { - FactoryReset packet(spParams); - result = packet.buildPacket(FactoryReset::Op::CIRCULAR_ENTRIES); - if (result != returnvalue::OK) { - break; - } - finishTcPrep(packet.getFullPacketLen()); - break; - } + /* case FACTORY_RESET_CLEAR_ALL: { + FactoryReset packet(spParams); + result = packet.buildPacket(FactoryReset::Op::CLEAR_ALL); + if (result != returnvalue::OK) { + break; + } + finishTcPrep(packet.getFullPacketLen()); + break; + } + case FACTORY_RESET_CLEAR_MIRROR: { + FactoryReset packet(spParams); + result = packet.buildPacket(FactoryReset::Op::MIRROR_ENTRIES); + if (result != returnvalue::OK) { + break; + } + finishTcPrep(packet.getFullPacketLen()); + break; + } + case FACTORY_RESET_CLEAR_CIRCULAR: { + FactoryReset packet(spParams); + result = packet.buildPacket(FactoryReset::Op::CIRCULAR_ENTRIES); + if (result != returnvalue::OK) { + break; + } + finishTcPrep(packet.getFullPacketLen()); + break; + }*/ // Removed command // case START_MPSOC_QUIET: { // prepareEmptyCmd(APID_START_MPSOC_QUIET); @@ -1594,47 +1594,47 @@ ReturnValue_t PlocSupervisorHandler::prepareRunAutoEmTest(const uint8_t* command return returnvalue::OK; } -ReturnValue_t PlocSupervisorHandler::prepareWipeMramCmd(const uint8_t* commandData) { - uint32_t start = 0; - uint32_t stop = 0; - size_t size = sizeof(start) + sizeof(stop); - SerializeAdapter::deSerialize(&start, &commandData, &size, SerializeIF::Endianness::BIG); - SerializeAdapter::deSerialize(&stop, &commandData, &size, SerializeIF::Endianness::BIG); - if ((stop - start) <= 0) { - return SupvReturnValuesIF::INVALID_MRAM_ADDRESSES; - } - supv::MramCmd packet(spParams); - ReturnValue_t result = packet.buildPacket(start, stop, supv::MramCmd::MramAction::WIPE); - if (result != returnvalue::OK) { - return result; - } - finishTcPrep(packet.getFullPacketLen()); - return returnvalue::OK; -} +// ReturnValue_t PlocSupervisorHandler::prepareWipeMramCmd(const uint8_t* commandData) { +// uint32_t start = 0; +// uint32_t stop = 0; +// size_t size = sizeof(start) + sizeof(stop); +// SerializeAdapter::deSerialize(&start, &commandData, &size, SerializeIF::Endianness::BIG); +// SerializeAdapter::deSerialize(&stop, &commandData, &size, SerializeIF::Endianness::BIG); +// if ((stop - start) <= 0) { +// return SupvReturnValuesIF::INVALID_MRAM_ADDRESSES; +// } +// supv::MramCmd packet(spParams); +// ReturnValue_t result = packet.buildPacket(start, stop, supv::MramCmd::MramAction::WIPE); +// if (result != returnvalue::OK) { +// return result; +// } +// finishTcPrep(packet.getFullPacketLen()); +// return returnvalue::OK; +// } -ReturnValue_t PlocSupervisorHandler::prepareDumpMramCmd(const uint8_t* commandData) { - uint32_t start = 0; - uint32_t stop = 0; - size_t size = sizeof(start) + sizeof(stop); - SerializeAdapter::deSerialize(&start, &commandData, &size, SerializeIF::Endianness::BIG); - SerializeAdapter::deSerialize(&stop, &commandData, &size, SerializeIF::Endianness::BIG); - if ((stop - start) <= 0) { - return SupvReturnValuesIF::INVALID_MRAM_ADDRESSES; - } - supv::MramCmd packet(spParams); - ReturnValue_t result = packet.buildPacket(start, stop, supv::MramCmd::MramAction::DUMP); - if (result != returnvalue::OK) { - return result; - } - expectedMramDumpPackets = (stop - start) / supv::MAX_DATA_CAPACITY; - if ((stop - start) % supv::MAX_DATA_CAPACITY) { - expectedMramDumpPackets++; - } - receivedMramDumpPackets = 0; - - finishTcPrep(packet.getFullPacketLen()); - return returnvalue::OK; -} +// ReturnValue_t PlocSupervisorHandler::prepareDumpMramCmd(const uint8_t* commandData) { +// uint32_t start = 0; +// uint32_t stop = 0; +// size_t size = sizeof(start) + sizeof(stop); +// SerializeAdapter::deSerialize(&start, &commandData, &size, SerializeIF::Endianness::BIG); +// SerializeAdapter::deSerialize(&stop, &commandData, &size, SerializeIF::Endianness::BIG); +// if ((stop - start) <= 0) { +// return SupvReturnValuesIF::INVALID_MRAM_ADDRESSES; +// } +// supv::MramCmd packet(spParams); +// ReturnValue_t result = packet.buildPacket(start, stop, supv::MramCmd::MramAction::DUMP); +// if (result != returnvalue::OK) { +// return result; +// } +// expectedMramDumpPackets = (stop - start) / supv::MAX_DATA_CAPACITY; +// if ((stop - start) % supv::MAX_DATA_CAPACITY) { +// expectedMramDumpPackets++; +// } +// receivedMramDumpPackets = 0; +// +// finishTcPrep(packet.getFullPacketLen()); +// return returnvalue::OK; +// } ReturnValue_t PlocSupervisorHandler::prepareSetGpioCmd(const uint8_t* commandData) { uint8_t port = *commandData; diff --git a/linux/devices/ploc/PlocSupervisorHandler.h b/linux/devices/ploc/PlocSupervisorHandler.h index 98cd22e9..08c0e846 100644 --- a/linux/devices/ploc/PlocSupervisorHandler.h +++ b/linux/devices/ploc/PlocSupervisorHandler.h @@ -278,8 +278,8 @@ class PlocSupervisorHandler : public DeviceHandlerBase { ReturnValue_t prepareSetAdcWindowAndStrideCmd(const uint8_t* commandData); ReturnValue_t prepareSetAdcThresholdCmd(const uint8_t* commandData); ReturnValue_t prepareRunAutoEmTest(const uint8_t* commandData); - ReturnValue_t prepareWipeMramCmd(const uint8_t* commandData); - ReturnValue_t prepareDumpMramCmd(const uint8_t* commandData); + // ReturnValue_t prepareWipeMramCmd(const uint8_t* commandData); + // ReturnValue_t prepareDumpMramCmd(const uint8_t* commandData); ReturnValue_t prepareSetGpioCmd(const uint8_t* commandData); ReturnValue_t prepareReadGpioCmd(const uint8_t* commandData); ReturnValue_t prepareLoggingRequest(const uint8_t* commandData, size_t commandDataLen);