supervisor added debug TCs
This commit is contained in:
@ -47,9 +47,11 @@ static const DeviceCommandId_t PRINT_CPU_STATS = 33;
|
||||
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 = 37;
|
||||
static const DeviceCommandId_t FACTORY_RESET_CLEAR_ALL = 37;
|
||||
static const DeviceCommandId_t REQUEST_LOGGING_DATA = 38;
|
||||
static const DeviceCommandId_t UPDATE_IMAGE_DATA = 39;
|
||||
static const DeviceCommandId_t FACTORY_RESET_CLEAR_MIRROR = 40;
|
||||
static const DeviceCommandId_t FACTORY_RESET_CLEAR_CIRCULAR = 41;
|
||||
|
||||
/** Reply IDs */
|
||||
static const DeviceCommandId_t ACK_REPORT = 50;
|
||||
@ -1095,6 +1097,89 @@ private:
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
* @brief This class packages the space packet causing the supervisor to print the CPU load to
|
||||
* the debug output.
|
||||
*/
|
||||
class PrintCpuStats: public SpacePacket {
|
||||
public:
|
||||
|
||||
/**
|
||||
* @brief Constructor
|
||||
*
|
||||
* @param en Print is enabled if en != 0
|
||||
*/
|
||||
PrintCpuStats(uint8_t en) :
|
||||
SpacePacket(DATA_FIELD_LENGTH - 1, true, APID_PRINT_CPU_STATS,
|
||||
DEFAULT_SEQUENCE_COUNT), en(en) {
|
||||
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 en = 0;
|
||||
|
||||
void initPacket() {
|
||||
size_t serializedSize = 0;
|
||||
uint8_t* data_field_ptr = this->localData.fields.buffer;
|
||||
SerializeAdapter::serialize<uint8_t>(&en, &data_field_ptr, &serializedSize,
|
||||
sizeof(en), 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 set the print verbosity in the supervisor
|
||||
* software.
|
||||
*/
|
||||
class SetDbgVerbosity: public SpacePacket {
|
||||
public:
|
||||
|
||||
/**
|
||||
* @brief Constructor
|
||||
*
|
||||
* @param vb 0: None, 1: Error, 2: Warn, 3: Info
|
||||
*/
|
||||
SetDbgVerbosity(uint8_t vb) :
|
||||
SpacePacket(DATA_FIELD_LENGTH - 1, true, APID_SET_DBG_VERBOSITY,
|
||||
DEFAULT_SEQUENCE_COUNT), vb(vb) {
|
||||
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 vb = 0;
|
||||
|
||||
void initPacket() {
|
||||
size_t serializedSize = 0;
|
||||
uint8_t* data_field_ptr = this->localData.fields.buffer;
|
||||
SerializeAdapter::serialize<uint8_t>(&vb, &data_field_ptr, &serializedSize,
|
||||
sizeof(vb), 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.
|
||||
*/
|
||||
@ -1159,6 +1244,168 @@ private:
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
* @brief This class packages the space packet change the state of a GPIO. This command is only
|
||||
* required for ground testing.
|
||||
*/
|
||||
class SetGpio: public SpacePacket {
|
||||
public:
|
||||
|
||||
/**
|
||||
* @brief Constructor
|
||||
*
|
||||
* @param port
|
||||
* @param pin
|
||||
* @param val
|
||||
*/
|
||||
SetGpio(uint8_t port, uint8_t pin, uint8_t val) :
|
||||
SpacePacket(DATA_FIELD_LENGTH - 1, true, APID_SET_GPIO,
|
||||
DEFAULT_SEQUENCE_COUNT), port(port), pin(pin), val(val) {
|
||||
initPacket();
|
||||
}
|
||||
|
||||
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;
|
||||
|
||||
void initPacket() {
|
||||
size_t serializedSize = 0;
|
||||
uint8_t* data_field_ptr = this->localData.fields.buffer;
|
||||
SerializeAdapter::serialize<uint8_t>(&port, &data_field_ptr, &serializedSize,
|
||||
sizeof(port), SerializeIF::Endianness::BIG);
|
||||
serializedSize = 0;
|
||||
SerializeAdapter::serialize<uint8_t>(&pin, &data_field_ptr, &serializedSize,
|
||||
sizeof(pin), SerializeIF::Endianness::BIG);
|
||||
serializedSize = 0;
|
||||
SerializeAdapter::serialize<uint8_t>(&val, &data_field_ptr, &serializedSize,
|
||||
sizeof(val), 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 causing the supervisor print the state of a GPIO
|
||||
* to the debug output.
|
||||
*/
|
||||
class ReadGpio: public SpacePacket {
|
||||
public:
|
||||
|
||||
/**
|
||||
* @brief Constructor
|
||||
*
|
||||
* @param port
|
||||
* @param pin
|
||||
*/
|
||||
ReadGpio(uint8_t port, uint8_t pin) :
|
||||
SpacePacket(DATA_FIELD_LENGTH - 1, true, APID_READ_GPIO,
|
||||
DEFAULT_SEQUENCE_COUNT), port(port), pin(pin) {
|
||||
initPacket();
|
||||
}
|
||||
|
||||
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;
|
||||
|
||||
void initPacket() {
|
||||
size_t serializedSize = 0;
|
||||
uint8_t* data_field_ptr = this->localData.fields.buffer;
|
||||
SerializeAdapter::serialize<uint8_t>(&port, &data_field_ptr, &serializedSize,
|
||||
sizeof(port), SerializeIF::Endianness::BIG);
|
||||
serializedSize = 0;
|
||||
SerializeAdapter::serialize<uint8_t>(&pin, &data_field_ptr, &serializedSize,
|
||||
sizeof(pin), 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 perform the factory reset. The op parameter is
|
||||
* optional.
|
||||
*
|
||||
* @details: Without OP: All MRAM entries will be cleared.
|
||||
* OP = 0x01: Only the mirror entries will be wiped.
|
||||
* OP = 0x02: Only the circular entries will be wiped.
|
||||
*/
|
||||
class FactoryReset: public SpacePacket {
|
||||
public:
|
||||
|
||||
enum class Op {
|
||||
CLEAR_ALL,
|
||||
MIRROR_ENTRIES,
|
||||
CIRCULAR_ENTRIES
|
||||
};
|
||||
|
||||
/**
|
||||
* @brief Constructor
|
||||
*
|
||||
* @param op
|
||||
*/
|
||||
FactoryReset(Op op) :
|
||||
SpacePacket(0, true, APID_FACTORY_RESET,
|
||||
DEFAULT_SEQUENCE_COUNT), op(op) {
|
||||
initPacket();
|
||||
}
|
||||
|
||||
private:
|
||||
|
||||
uint16_t packetLen = 1; // only CRC in data field
|
||||
static const uint16_t DEFAULT_SEQUENCE_COUNT = 1;
|
||||
|
||||
uint8_t crcOffset = 0;
|
||||
|
||||
Op op = Op::CLEAR_ALL;
|
||||
|
||||
void initPacket() {
|
||||
|
||||
uint8_t* data_field_ptr = this->localData.fields.buffer;
|
||||
|
||||
switch(op) {
|
||||
case Op::MIRROR_ENTRIES:
|
||||
*data_field_ptr = 1;
|
||||
packetLen = 2;
|
||||
crcOffset = 1;
|
||||
break;
|
||||
case Op::CIRCULAR_ENTRIES:
|
||||
*data_field_ptr = 2;
|
||||
packetLen = 2;
|
||||
crcOffset = 1;
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
this->setPacketDataLength(packetLen);
|
||||
size_t serializedSize = 0;
|
||||
uint16_t crc = CRC::crc16ccitt(this->localData.byteStream,
|
||||
sizeof(CCSDSPrimaryHeader) + packetLen - 1);
|
||||
uint8_t* crcPos = this->localData.fields.buffer + crcOffset;
|
||||
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