wipe mram command
This commit is contained in:
@ -1049,6 +1049,108 @@ private:
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
* @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* data_field_ptr = this->localData.fields.buffer;
|
||||
SerializeAdapter::serialize<uint8_t>(&test, &data_field_ptr, &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 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
|
||||
*/
|
||||
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* data_field_ptr = this->localData.fields.buffer;
|
||||
std::memcpy(data_field_ptr, 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 dataset stores the boot status report of the supervisor.
|
||||
*/
|
||||
|
Reference in New Issue
Block a user