continue refactoring
All checks were successful
EIVE/eive-obsw/pipeline/pr-develop This commit looks good

This commit is contained in:
Robin Müller 2022-11-07 17:31:16 +01:00
parent e46bb42266
commit 8dbb3dcd9b
No known key found for this signature in database
GPG Key ID: 11D4952C8CCEF814
3 changed files with 218 additions and 265 deletions

View File

@ -182,7 +182,13 @@ enum class AdcMonServiceIds : uint8_t {
COPY_ADC_DATA_TO_MRAM = 0x05 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 // Right now, none of the commands seem to be implemented, but still
// keep the enum here in case some are added // 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 * @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. * the moving average filter applied to the ADC readings.
*/ */
class SetAdcWindowAndStride : public ploc::SpTcBase { class SetAdcWindowAndStride : public TcBase {
public: public:
/** /**
* @brief Constructor * @brief Constructor
@ -752,11 +758,9 @@ class SetAdcWindowAndStride : public ploc::SpTcBase {
* @param windowSize * @param windowSize
* @param stridingStepSize * @param stridingStepSize
*/ */
SetAdcWindowAndStride(ploc::SpTcParams params) : ploc::SpTcBase(params) { SetAdcWindowAndStride(TcParams params)
spParams.setFullPayloadLen(DATA_FIELD_LENGTH); : TcBase(params, Apids::ADC_MON, static_cast<uint8_t>(AdcMonServiceIds::SET_WINDOW_STRIDE),
// spParams.creator.setApid(APID_SET_ADC_WINDOW_AND_STRIDE); 4) {}
// spParams.creator.setSeqCount(DEFAULT_SEQUENCE_COUNT);
}
ReturnValue_t buildPacket(uint16_t windowSize, uint16_t stridingStepSize) { ReturnValue_t buildPacket(uint16_t windowSize, uint16_t stridingStepSize) {
auto res = checkSizeAndSerializeHeader(); auto res = checkSizeAndSerializeHeader();
@ -768,10 +772,6 @@ class SetAdcWindowAndStride : public ploc::SpTcBase {
} }
private: 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) { void initPacket(uint16_t windowSize, uint16_t stridingStepSize) {
size_t serializedSize = 6; size_t serializedSize = 6;
uint8_t* data = payloadStart; 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. * @brief This class packages the space packet to set the ADC trigger threshold.
*/ */
class SetAdcThreshold : public ploc::SpTcBase { class SetAdcThreshold : public TcBase {
public: public:
/** /**
* @brief Constructor * @brief Constructor
* *
* @param threshold * @param threshold
*/ */
SetAdcThreshold(ploc::SpTcParams params) : ploc::SpTcBase(params) { SetAdcThreshold(TcParams params)
spParams.setFullPayloadLen(DATA_FIELD_LENGTH); : TcBase(params, Apids::ADC_MON, static_cast<uint8_t>(AdcMonServiceIds::SET_ADC_THRESHOLD),
// spParams.creator.setApid(APID_SET_ADC_THRESHOLD); 4) {}
spParams.creator.setSeqCount(DEFAULT_SEQUENCE_COUNT);
}
ReturnValue_t buildPacket(uint32_t threshold) { ReturnValue_t buildPacket(uint32_t threshold) {
auto res = checkSizeAndSerializeHeader(); auto res = checkSizeAndSerializeHeader();
@ -808,11 +806,6 @@ class SetAdcThreshold : public ploc::SpTcBase {
} }
private: 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) { void initPacket(uint32_t threshold) {
size_t serializedSize = 0; size_t serializedSize = 0;
SerializeAdapter::serialize(&threshold, payloadStart, &serializedSize, sizeof(threshold), 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. * @brief This class packages the space packet to run auto EM tests.
*/ */
class RunAutoEmTests : public ploc::SpTcBase { class RunAutoEmTests : public TcBase {
public: public:
/** /**
* @brief Constructor * @brief Constructor
* *
* @param test 1 - complete EM test, 2 - Short test (only memory readback NVM0,1,3) * @param test 1 - complete EM test, 2 - Short test (only memory readback NVM0,1,3)
*/ */
RunAutoEmTests(ploc::SpTcParams params) : ploc::SpTcBase(params) { RunAutoEmTests(TcParams params)
spParams.setFullPayloadLen(DATA_FIELD_LENGTH); : TcBase(params, Apids::TMTC_MAN, static_cast<uint8_t>(TmtcServiceIds::RUN_AUTO_EM_TEST), 1) {
// spParams.creator.setApid(APID_RUN_AUTO_EM_TESTS);
spParams.creator.setSeqCount(DEFAULT_SEQUENCE_COUNT);
} }
ReturnValue_t buildPacket(uint8_t test) { ReturnValue_t buildPacket(uint8_t test) {
@ -846,11 +837,6 @@ class RunAutoEmTests : public ploc::SpTcBase {
} }
private: 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; uint8_t test = 0;
void initPacket(uint8_t test) { payloadStart[0] = test; } 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. * @brief This class packages the space packet to wipe or dump parts of the MRAM.
*/ */
class MramCmd : public ploc::SpTcBase { // class MramCmd : public TcBase {
public: // public:
enum class MramAction { WIPE, DUMP }; // enum class MramAction { WIPE, DUMP };
//
/** // /**
* @brief Constructor // * @brief Constructor
* // *
* @param start Start address of the MRAM section to wipe or dump // * @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 stop End address of the MRAM section to wipe or dump
* @param action Dump or wipe MRAM // * @param action Dump or wipe MRAM
* // *
* @note The content at the stop address is excluded from the dump or wipe operation. // * @note The content at the stop address is excluded from the dump or wipe operation.
*/ // */
MramCmd(ploc::SpTcParams params) : ploc::SpTcBase(params) { // MramCmd(TcParams params)
spParams.setFullPayloadLen(DATA_FIELD_LENGTH); // : TcBase(params, Apids::DATA_LOGGER) {
// spParams.creator.setSeqCount(DEFAULT_SEQUENCE_COUNT); // setLenFromPayloadLen(6);
} // }
//
ReturnValue_t buildPacket(uint32_t start, uint32_t stop, MramAction action) { // ReturnValue_t buildPacket(uint32_t start, uint32_t stop, MramAction action) {
if (action == MramAction::WIPE) { // if (action == MramAction::WIPE) {
// spParams.creator.setApid(APID_WIPE_MRAM); // setServiceId(static_cast<uint8_t>(DataLoggerServiceIds::WIPE_MRAM));
} else if (action == MramAction::DUMP) { // } else if (action == MramAction::DUMP) {
// spParams.creator.setApid(APID_DUMP_MRAM); // setServiceId(static_cast<uint8_t>(DataLoggerServiceIds::DUMP_MRAM));
} else { // } else {
sif::debug << "WipeMram: Invalid action specified"; // sif::debug << "WipeMram: Invalid action specified";
} // }
auto res = checkSizeAndSerializeHeader(); // auto res = checkSizeAndSerializeHeader();
if (res != returnvalue::OK) { // if (res != returnvalue::OK) {
return res; // return res;
} // }
initPacket(start, stop); // initPacket(start, stop);
return calcAndSetCrc(); // return calcAndSetCrc();
} // }
//
private: // private:
static const uint16_t DATA_FIELD_LENGTH = 8; //
// uint32_t start = 0;
static const uint16_t CRC_OFFSET = DATA_FIELD_LENGTH - 2; // uint32_t stop = 0;
//
uint32_t start = 0; // void initPacket(uint32_t start, uint32_t stop) {
uint32_t stop = 0; // uint8_t concatBuffer[6];
// concatBuffer[0] = static_cast<uint8_t>(start >> 16);
void initPacket(uint32_t start, uint32_t stop) { // concatBuffer[1] = static_cast<uint8_t>(start >> 8);
uint8_t concatBuffer[6]; // concatBuffer[2] = static_cast<uint8_t>(start);
concatBuffer[0] = static_cast<uint8_t>(start >> 16); // concatBuffer[3] = static_cast<uint8_t>(stop >> 16);
concatBuffer[1] = static_cast<uint8_t>(start >> 8); // concatBuffer[4] = static_cast<uint8_t>(stop >> 8);
concatBuffer[2] = static_cast<uint8_t>(start); // concatBuffer[5] = static_cast<uint8_t>(stop);
concatBuffer[3] = static_cast<uint8_t>(stop >> 16); // std::memcpy(payloadStart, concatBuffer, sizeof(concatBuffer));
concatBuffer[4] = static_cast<uint8_t>(stop >> 8); // }
concatBuffer[5] = static_cast<uint8_t>(stop); // };
std::memcpy(payloadStart, concatBuffer, sizeof(concatBuffer));
}
};
/** /**
* @brief This class packages the space packet change the state of a GPIO. This command is only * @brief This class packages the space packet change the state of a GPIO. This command is only
* required for ground testing. * required for ground testing.
*/ */
class SetGpio : public ploc::SpTcBase { class SetGpio : public TcBase {
public: public:
/** /**
* @brief Constructor * @brief Constructor
@ -926,11 +909,8 @@ class SetGpio : public ploc::SpTcBase {
* @param pin * @param pin
* @param val * @param val
*/ */
SetGpio(ploc::SpTcParams params) : ploc::SpTcBase(params) { SetGpio(TcParams params)
spParams.setFullPayloadLen(DATA_FIELD_LENGTH); : TcBase(params, Apids::TMTC_MAN, static_cast<uint8_t>(TmtcServiceIds::SET_GPIO), 3) {}
// spParams.creator.setApid(APID_SET_GPIO);
spParams.creator.setSeqCount(DEFAULT_SEQUENCE_COUNT);
}
ReturnValue_t buildPacket(uint8_t port, uint8_t pin, uint8_t val) { ReturnValue_t buildPacket(uint8_t port, uint8_t pin, uint8_t val) {
auto res = checkSizeAndSerializeHeader(); auto res = checkSizeAndSerializeHeader();
@ -942,11 +922,6 @@ class SetGpio : public ploc::SpTcBase {
} }
private: 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 port = 0;
uint8_t pin = 0; uint8_t pin = 0;
uint8_t val = 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 * @brief This class packages the space packet causing the supervisor print the state of a GPIO
* to the debug output. * to the debug output.
*/ */
class ReadGpio : public ploc::SpTcBase { class ReadGpio : public TcBase {
public: public:
/** /**
* @brief Constructor * @brief Constructor
@ -970,11 +945,8 @@ class ReadGpio : public ploc::SpTcBase {
* @param port * @param port
* @param pin * @param pin
*/ */
ReadGpio(ploc::SpTcParams params) : ploc::SpTcBase(params) { ReadGpio(TcParams params)
spParams.setFullPayloadLen(DATA_FIELD_LENGTH); : TcBase(params, Apids::TMTC_MAN, static_cast<uint8_t>(TmtcServiceIds::READ_GPIO), 2) {}
// spParams.creator.setApid(APID_READ_GPIO);
spParams.creator.setSeqCount(DEFAULT_SEQUENCE_COUNT);
}
ReturnValue_t buildPacket(uint8_t port, uint8_t pin) { ReturnValue_t buildPacket(uint8_t port, uint8_t pin) {
auto res = checkSizeAndSerializeHeader(); auto res = checkSizeAndSerializeHeader();
@ -986,11 +958,6 @@ class ReadGpio : public ploc::SpTcBase {
} }
private: 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 port = 0;
uint8_t pin = 0; uint8_t pin = 0;
@ -1008,57 +975,56 @@ class ReadGpio : public ploc::SpTcBase {
* OP = 0x01: Only the mirror entries will be wiped. * OP = 0x01: Only the mirror entries will be wiped.
* OP = 0x02: Only the circular 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<uint8_t>(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: public:
enum class Op { CLEAR_ALL, MIRROR_ENTRIES, CIRCULAR_ENTRIES }; SetShutdownTimeout(TcParams params)
: TcBase(params, Apids::BOOT_MAN, static_cast<uint8_t>(BootManServiceIds::SHUTDOWN_TIMEOUT),
/** 4) {}
* @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);
}
ReturnValue_t buildPacket(uint32_t timeout) { ReturnValue_t buildPacket(uint32_t timeout) {
auto res = checkSizeAndSerializeHeader(); auto res = checkSizeAndSerializeHeader();
@ -1070,10 +1036,6 @@ class SetShutdownTimeout : public ploc::SpTcBase {
} }
private: private:
static const uint16_t PAYLOAD_LEN = 4; // uint32_t timeout
uint32_t timeout = 0;
void initPacket(uint32_t timeout) { void initPacket(uint32_t timeout) {
size_t serLen = 0; size_t serLen = 0;
SerializeAdapter::serialize(&timeout, payloadStart, &serLen, sizeof(timeout), 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. * @brief Command to request CRC over memory region of the supervisor.
*/ */
class CheckMemory : public ploc::SpTcBase { class CheckMemory : public TcBase {
public: public:
/** /**
* @brief Constructor * @brief Constructor
@ -1093,11 +1055,8 @@ class CheckMemory : public ploc::SpTcBase {
* @param startAddress Start address of CRC calculation * @param startAddress Start address of CRC calculation
* @param length Length in bytes of memory region * @param length Length in bytes of memory region
*/ */
CheckMemory(ploc::SpTcParams params) : ploc::SpTcBase(params) { CheckMemory(TcParams params)
spParams.setFullPayloadLen(PAYLOAD_LENGTH + 2); : TcBase(params, Apids::MEM_MAN, static_cast<uint8_t>(MemManServiceIds::CHECK), 10) {}
// spParams.creator.setApid(APID_CHECK_MEMORY);
// spParams.creator.setSeqCount(DEFAULT_SEQUENCE_COUNT);
}
ReturnValue_t buildPacket(uint8_t memoryId, uint32_t startAddress, uint32_t length) { ReturnValue_t buildPacket(uint8_t memoryId, uint32_t startAddress, uint32_t length) {
auto res = checkSizeAndSerializeHeader(); auto res = checkSizeAndSerializeHeader();
@ -1109,8 +1068,6 @@ class CheckMemory : public ploc::SpTcBase {
} }
private: private:
static const uint16_t PAYLOAD_LENGTH = 10; // length without CRC field
uint8_t memoryId = 0; uint8_t memoryId = 0;
uint8_t n = 1; uint8_t n = 1;
uint32_t startAddress = 0; 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. * @brief This class packages the space packet transporting a part of an MPSoC update.
*/ */
class WriteMemory : public ploc::SpTcBase { class WriteMemory : public TcBase {
public: public:
/** /**
* @brief Constructor * @brief Constructor
@ -1141,10 +1098,8 @@ class WriteMemory : public ploc::SpTcBase {
* @param sequenceCount Sequence count (first update packet expects 1 as sequence count) * @param sequenceCount Sequence count (first update packet expects 1 as sequence count)
* @param updateData Pointer to buffer containing update data * @param updateData Pointer to buffer containing update data
*/ */
WriteMemory(ploc::SpTcParams params) : ploc::SpTcBase(params) { WriteMemory(TcParams params)
// spParams.creator.setApid(APID_WRITE_MEMORY); : TcBase(params, Apids::MEM_MAN, static_cast<uint8_t>(MemManServiceIds::WRITE), 1) {}
// spParams.creator.setSeqCount(DEFAULT_SEQUENCE_COUNT);
}
ReturnValue_t buildPacket(ccsds::SequenceFlags seqFlags, uint16_t sequenceCount, uint8_t memoryId, ReturnValue_t buildPacket(ccsds::SequenceFlags seqFlags, uint16_t sequenceCount, uint8_t memoryId,
uint32_t startAddress, uint16_t length, uint8_t* updateData) { uint32_t startAddress, uint16_t length, uint8_t* updateData) {
@ -1173,9 +1128,9 @@ class WriteMemory : public ploc::SpTcBase {
uint8_t* updateData) { uint8_t* updateData) {
uint8_t* data = payloadStart; uint8_t* data = payloadStart;
if (updateDataLen % 2 != 0) { if (updateDataLen % 2 != 0) {
spParams.setFullPayloadLen(META_DATA_LENGTH + updateDataLen + 1 + 2); setLenFromPayloadLen(META_DATA_LENGTH + updateDataLen + 1);
} else { } else {
spParams.setFullPayloadLen(META_DATA_LENGTH + updateDataLen + 2); setLenFromPayloadLen(META_DATA_LENGTH + updateDataLen);
} }
// To avoid crashes in this unexpected case // To avoid crashes in this unexpected case
ReturnValue_t result = checkPayloadLen(); ReturnValue_t result = checkPayloadLen();
@ -1204,13 +1159,11 @@ class WriteMemory : public ploc::SpTcBase {
/** /**
* @brief This class can be used to package erase memory command * @brief This class can be used to package erase memory command
*/ */
class EraseMemory : public ploc::SpTcBase { class EraseMemory : public TcBase {
public: public:
EraseMemory(ploc::SpTcParams params) : ploc::SpTcBase(params) { EraseMemory(TcParams params)
spParams.setFullPayloadLen(PAYLOAD_LENGTH + 2); : TcBase(params, Apids::MEM_MAN, static_cast<uint8_t>(MemManServiceIds::ERASE),
// spParams.creator.setApid(APID_ERASE_MEMORY); PAYLOAD_LENGTH) {}
// spParams.creator.setSeqCount(DEFAULT_SEQUENCE_COUNT);
}
ReturnValue_t buildPacket(uint8_t memoryId, uint32_t startAddress, uint32_t length) { ReturnValue_t buildPacket(uint8_t memoryId, uint32_t startAddress, uint32_t length) {
auto res = checkSizeAndSerializeHeader(); 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 * @brief This class creates the space packet to enable the auto TM generation
*/ */
class EnableAutoTm : public ploc::SpTcBase { class EnableAutoTm : public TcBase {
public: public:
EnableAutoTm(ploc::SpTcParams params) : ploc::SpTcBase(params) { EnableAutoTm(TcParams params) : TcBase(params) {
spParams.setFullPayloadLen(PAYLOAD_LENGTH + 2); spParams.setFullPayloadLen(PAYLOAD_LENGTH + 2);
// spParams.creator.setApid(APID_AUTO_TM); // spParams.creator.setApid(APID_AUTO_TM);
// spParams.creator.setSeqCount(DEFAULT_SEQUENCE_COUNT); // 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 * @brief This class creates the space packet to disable the auto TM generation
*/ */
class DisableAutoTm : public ploc::SpTcBase { class DisableAutoTm : public TcBase {
public: public:
DisableAutoTm(ploc::SpTcParams params) : ploc::SpTcBase(params) { DisableAutoTm(TcParams params) : TcBase(params) {
spParams.setFullPayloadLen(PAYLOAD_LENGTH + 2); spParams.setFullPayloadLen(PAYLOAD_LENGTH + 2);
// spParams.creator.setApid(APID_AUTO_TM); // spParams.creator.setApid(APID_AUTO_TM);
// spParams.creator.setSeqCount(DEFAULT_SEQUENCE_COUNT); // 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 * @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: public:
/** /**
* Subapid * Subapid
@ -1308,7 +1261,7 @@ class RequestLoggingData : public ploc::SpTcBase {
SET_LOGGING_TOPIC = 4 /**< SET_LOGGING_TOPIC */ 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.setFullPayloadLen(PAYLOAD_LENGTH + 2);
// spParams.creator.setApid(APID_REQUEST_LOGGING_DATA); // spParams.creator.setApid(APID_REQUEST_LOGGING_DATA);
// spParams.creator.setSeqCount(DEFAULT_SEQUENCE_COUNT); // spParams.creator.setSeqCount(DEFAULT_SEQUENCE_COUNT);

View File

@ -318,14 +318,14 @@ ReturnValue_t PlocSupervisorHandler::buildCommandFromCommand(DeviceCommandId_t d
result = prepareRunAutoEmTest(commandData); result = prepareRunAutoEmTest(commandData);
break; break;
} }
case WIPE_MRAM: { // case WIPE_MRAM: {
result = prepareWipeMramCmd(commandData); // result = prepareWipeMramCmd(commandData);
break; // break;
} // }
case FIRST_MRAM_DUMP: // case FIRST_MRAM_DUMP:
case CONSECUTIVE_MRAM_DUMP: // case CONSECUTIVE_MRAM_DUMP:
result = prepareDumpMramCmd(commandData); // result = prepareDumpMramCmd(commandData);
break; // break;
case SET_GPIO: { case SET_GPIO: {
prepareSetGpioCmd(commandData); prepareSetGpioCmd(commandData);
result = returnvalue::OK; result = returnvalue::OK;
@ -341,33 +341,33 @@ ReturnValue_t PlocSupervisorHandler::buildCommandFromCommand(DeviceCommandId_t d
// result = returnvalue::OK; // result = returnvalue::OK;
// break; // break;
// } // }
case FACTORY_RESET_CLEAR_ALL: { /* case FACTORY_RESET_CLEAR_ALL: {
FactoryReset packet(spParams); FactoryReset packet(spParams);
result = packet.buildPacket(FactoryReset::Op::CLEAR_ALL); result = packet.buildPacket(FactoryReset::Op::CLEAR_ALL);
if (result != returnvalue::OK) { if (result != returnvalue::OK) {
break; break;
} }
finishTcPrep(packet.getFullPacketLen()); finishTcPrep(packet.getFullPacketLen());
break; break;
} }
case FACTORY_RESET_CLEAR_MIRROR: { case FACTORY_RESET_CLEAR_MIRROR: {
FactoryReset packet(spParams); FactoryReset packet(spParams);
result = packet.buildPacket(FactoryReset::Op::MIRROR_ENTRIES); result = packet.buildPacket(FactoryReset::Op::MIRROR_ENTRIES);
if (result != returnvalue::OK) { if (result != returnvalue::OK) {
break; break;
} }
finishTcPrep(packet.getFullPacketLen()); finishTcPrep(packet.getFullPacketLen());
break; break;
} }
case FACTORY_RESET_CLEAR_CIRCULAR: { case FACTORY_RESET_CLEAR_CIRCULAR: {
FactoryReset packet(spParams); FactoryReset packet(spParams);
result = packet.buildPacket(FactoryReset::Op::CIRCULAR_ENTRIES); result = packet.buildPacket(FactoryReset::Op::CIRCULAR_ENTRIES);
if (result != returnvalue::OK) { if (result != returnvalue::OK) {
break; break;
} }
finishTcPrep(packet.getFullPacketLen()); finishTcPrep(packet.getFullPacketLen());
break; break;
} }*/
// Removed command // Removed command
// case START_MPSOC_QUIET: { // case START_MPSOC_QUIET: {
// prepareEmptyCmd(APID_START_MPSOC_QUIET); // prepareEmptyCmd(APID_START_MPSOC_QUIET);
@ -1594,47 +1594,47 @@ ReturnValue_t PlocSupervisorHandler::prepareRunAutoEmTest(const uint8_t* command
return returnvalue::OK; return returnvalue::OK;
} }
ReturnValue_t PlocSupervisorHandler::prepareWipeMramCmd(const uint8_t* commandData) { // ReturnValue_t PlocSupervisorHandler::prepareWipeMramCmd(const uint8_t* commandData) {
uint32_t start = 0; // uint32_t start = 0;
uint32_t stop = 0; // uint32_t stop = 0;
size_t size = sizeof(start) + sizeof(stop); // size_t size = sizeof(start) + sizeof(stop);
SerializeAdapter::deSerialize(&start, &commandData, &size, SerializeIF::Endianness::BIG); // SerializeAdapter::deSerialize(&start, &commandData, &size, SerializeIF::Endianness::BIG);
SerializeAdapter::deSerialize(&stop, &commandData, &size, SerializeIF::Endianness::BIG); // SerializeAdapter::deSerialize(&stop, &commandData, &size, SerializeIF::Endianness::BIG);
if ((stop - start) <= 0) { // if ((stop - start) <= 0) {
return SupvReturnValuesIF::INVALID_MRAM_ADDRESSES; // return SupvReturnValuesIF::INVALID_MRAM_ADDRESSES;
} // }
supv::MramCmd packet(spParams); // supv::MramCmd packet(spParams);
ReturnValue_t result = packet.buildPacket(start, stop, supv::MramCmd::MramAction::WIPE); // ReturnValue_t result = packet.buildPacket(start, stop, supv::MramCmd::MramAction::WIPE);
if (result != returnvalue::OK) { // if (result != returnvalue::OK) {
return result; // return result;
} // }
finishTcPrep(packet.getFullPacketLen()); // finishTcPrep(packet.getFullPacketLen());
return returnvalue::OK; // return returnvalue::OK;
} // }
ReturnValue_t PlocSupervisorHandler::prepareDumpMramCmd(const uint8_t* commandData) { // ReturnValue_t PlocSupervisorHandler::prepareDumpMramCmd(const uint8_t* commandData) {
uint32_t start = 0; // uint32_t start = 0;
uint32_t stop = 0; // uint32_t stop = 0;
size_t size = sizeof(start) + sizeof(stop); // size_t size = sizeof(start) + sizeof(stop);
SerializeAdapter::deSerialize(&start, &commandData, &size, SerializeIF::Endianness::BIG); // SerializeAdapter::deSerialize(&start, &commandData, &size, SerializeIF::Endianness::BIG);
SerializeAdapter::deSerialize(&stop, &commandData, &size, SerializeIF::Endianness::BIG); // SerializeAdapter::deSerialize(&stop, &commandData, &size, SerializeIF::Endianness::BIG);
if ((stop - start) <= 0) { // if ((stop - start) <= 0) {
return SupvReturnValuesIF::INVALID_MRAM_ADDRESSES; // return SupvReturnValuesIF::INVALID_MRAM_ADDRESSES;
} // }
supv::MramCmd packet(spParams); // supv::MramCmd packet(spParams);
ReturnValue_t result = packet.buildPacket(start, stop, supv::MramCmd::MramAction::DUMP); // ReturnValue_t result = packet.buildPacket(start, stop, supv::MramCmd::MramAction::DUMP);
if (result != returnvalue::OK) { // if (result != returnvalue::OK) {
return result; // return result;
} // }
expectedMramDumpPackets = (stop - start) / supv::MAX_DATA_CAPACITY; // expectedMramDumpPackets = (stop - start) / supv::MAX_DATA_CAPACITY;
if ((stop - start) % supv::MAX_DATA_CAPACITY) { // if ((stop - start) % supv::MAX_DATA_CAPACITY) {
expectedMramDumpPackets++; // expectedMramDumpPackets++;
} // }
receivedMramDumpPackets = 0; // receivedMramDumpPackets = 0;
//
finishTcPrep(packet.getFullPacketLen()); // finishTcPrep(packet.getFullPacketLen());
return returnvalue::OK; // return returnvalue::OK;
} // }
ReturnValue_t PlocSupervisorHandler::prepareSetGpioCmd(const uint8_t* commandData) { ReturnValue_t PlocSupervisorHandler::prepareSetGpioCmd(const uint8_t* commandData) {
uint8_t port = *commandData; uint8_t port = *commandData;

View File

@ -278,8 +278,8 @@ class PlocSupervisorHandler : public DeviceHandlerBase {
ReturnValue_t prepareSetAdcWindowAndStrideCmd(const uint8_t* commandData); ReturnValue_t prepareSetAdcWindowAndStrideCmd(const uint8_t* commandData);
ReturnValue_t prepareSetAdcThresholdCmd(const uint8_t* commandData); ReturnValue_t prepareSetAdcThresholdCmd(const uint8_t* commandData);
ReturnValue_t prepareRunAutoEmTest(const uint8_t* commandData); ReturnValue_t prepareRunAutoEmTest(const uint8_t* commandData);
ReturnValue_t prepareWipeMramCmd(const uint8_t* commandData); // ReturnValue_t prepareWipeMramCmd(const uint8_t* commandData);
ReturnValue_t prepareDumpMramCmd(const uint8_t* commandData); // ReturnValue_t prepareDumpMramCmd(const uint8_t* commandData);
ReturnValue_t prepareSetGpioCmd(const uint8_t* commandData); ReturnValue_t prepareSetGpioCmd(const uint8_t* commandData);
ReturnValue_t prepareReadGpioCmd(const uint8_t* commandData); ReturnValue_t prepareReadGpioCmd(const uint8_t* commandData);
ReturnValue_t prepareLoggingRequest(const uint8_t* commandData, size_t commandDataLen); ReturnValue_t prepareLoggingRequest(const uint8_t* commandData, size_t commandDataLen);