re-enable wipe cmd
All checks were successful
EIVE/eive-obsw/pipeline/pr-develop This commit looks good
All checks were successful
EIVE/eive-obsw/pipeline/pr-develop This commit looks good
This commit is contained in:
@ -1116,6 +1116,56 @@ class WriteMemory : public TcBase {
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
* @brief This class packages the space packet to wipe or dump parts of the MRAM.
|
||||
*/
|
||||
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, Apid::DATA_LOGGER) { setLenFromPayloadLen(6); }
|
||||
|
||||
ReturnValue_t buildPacket(uint32_t start, uint32_t stop, MramAction action) {
|
||||
if (action == MramAction::WIPE) {
|
||||
setServiceId(static_cast<uint8_t>(tc::DataLoggerServiceId::WIPE_MRAM));
|
||||
} else if (action == MramAction::DUMP) {
|
||||
setServiceId(static_cast<uint8_t>(tc::DataLoggerServiceId::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<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);
|
||||
std::memcpy(payloadStart, concatBuffer, sizeof(concatBuffer));
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
* @brief This class can be used to package erase memory command
|
||||
*/
|
||||
@ -1931,56 +1981,6 @@ class EnableNvms : public TcBase {
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
* @brief This class packages the space packet to wipe or dump parts of the MRAM.
|
||||
*/
|
||||
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, Apid::DATA_LOGGER) { setLenFromPayloadLen(6); }
|
||||
|
||||
ReturnValue_t buildPacket(uint32_t start, uint32_t stop, MramAction action) {
|
||||
if (action == MramAction::WIPE) {
|
||||
setServiceId(static_cast<uint8_t>(tc::DataLoggerServiceId::WIPE_MRAM));
|
||||
} else if (action == MramAction::DUMP) {
|
||||
setServiceId(static_cast<uint8_t>(tc::DataLoggerServiceId::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<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);
|
||||
std::memcpy(payloadStart, concatBuffer, sizeof(concatBuffer));
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
* @brief This class creates the space packet to enable the auto TM generation
|
||||
*/
|
||||
|
Reference in New Issue
Block a user