ploc supervisor watchdog configure timeout command
This commit is contained in:
@ -24,6 +24,7 @@ static const DeviceCommandId_t GET_BOOT_STATUS_REPORT = 11;
|
||||
/** Notifies the supervisor that a new update is available for the MPSoC */
|
||||
static const DeviceCommandId_t UPDATE_AVAILABLE = 12;
|
||||
static const DeviceCommandId_t WATCHDOGS_ENABLE = 13;
|
||||
static const DeviceCommandId_t WATCHDOGS_CONFIG_TIMEOUT = 14;
|
||||
|
||||
/** Reply IDs */
|
||||
static const DeviceCommandId_t ACK_REPORT = 50;
|
||||
@ -492,6 +493,52 @@ private:
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
* @brief This class packages the command to set the timeout of one of the three watchdogs (PS,
|
||||
* PL, INT)
|
||||
*/
|
||||
class WatchdogsConfigTimeout: public SpacePacket {
|
||||
public:
|
||||
|
||||
/**
|
||||
* @brief Constructor
|
||||
*
|
||||
* @param watchdogPs Selects the watchdog to configure (0 - PS, 1 - PL, 2 - INT)
|
||||
* @param timeout The timeout to set
|
||||
*/
|
||||
WatchdogsConfigTimeout(uint8_t watchdog, uint32_t timeout) :
|
||||
SpacePacket(DATA_FIELD_LENGTH - 1, true, APID_WTD_CONFIG_TIMEOUT,
|
||||
DEFAULT_SEQUENCE_COUNT), watchdog(watchdog), timeout(timeout) {
|
||||
initPacket();
|
||||
}
|
||||
|
||||
private:
|
||||
|
||||
static const uint16_t DATA_FIELD_LENGTH = 7;
|
||||
static const uint16_t DEFAULT_SEQUENCE_COUNT = 1;
|
||||
|
||||
static const uint16_t CRC_OFFSET = DATA_FIELD_LENGTH - 2;
|
||||
|
||||
uint8_t watchdog = 0;
|
||||
uint32_t timeout = 0;
|
||||
|
||||
void initPacket() {
|
||||
size_t serializedSize = 0;
|
||||
uint8_t* data_field_ptr = this->localData.fields.buffer;
|
||||
SerializeAdapter::serialize<uint8_t>(&watchdog, &data_field_ptr, &serializedSize,
|
||||
sizeof(watchdog), SerializeIF::Endianness::BIG);
|
||||
serializedSize = 0;
|
||||
SerializeAdapter::serialize<uint32_t>(&timeout, &data_field_ptr, &serializedSize,
|
||||
sizeof(timeout), 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 dataset stores the boot status report of the supervisor.
|
||||
*/
|
||||
|
Reference in New Issue
Block a user