ploc supervisor update available cmd, wip
This commit is contained in:
parent
0cd814db76
commit
01a02f896f
@ -112,7 +112,7 @@ ReturnValue_t PlocSupervisorHandler::buildCommandFromCommand(
|
||||
break;
|
||||
}
|
||||
case(PLOC_SPV::UPDATE_AVAILABLE): {
|
||||
prepareUpdateAvailableCmd();
|
||||
prepareUpdateAvailableCmd(commandData);
|
||||
result = RETURN_OK;
|
||||
break;
|
||||
}
|
||||
@ -148,7 +148,7 @@ void PlocSupervisorHandler::fillCommandAndReplyMap() {
|
||||
this->insertInReplyMap(PLOC_SPV::ACK_REPORT, 3, nullptr, PLOC_SPV::SIZE_ACK_REPORT);
|
||||
this->insertInReplyMap(PLOC_SPV::EXE_REPORT, 3, nullptr, PLOC_SPV::SIZE_EXE_REPORT);
|
||||
this->insertInReplyMap(PLOC_SPV::HK_REPORT, 3, &hkset, PLOC_SPV::SIZE_HK_REPORT);
|
||||
this->insertInReplyMap(PLOC_SPV::HK_REPORT, 3, &bootStatusReport,
|
||||
this->insertInReplyMap(PLOC_SPV::BOOT_STATUS_REPORT, 3, &bootStatusReport,
|
||||
PLOC_SPV::SIZE_BOOT_STATUS_REPORT);
|
||||
}
|
||||
|
||||
@ -172,6 +172,10 @@ ReturnValue_t PlocSupervisorHandler::scanForReply(const uint8_t *start,
|
||||
*foundLen = PLOC_SPV::SIZE_HK_REPORT;
|
||||
*foundId = PLOC_SPV::HK_REPORT;
|
||||
break;
|
||||
case(PLOC_SPV::APID_BOOT_STATUS_REPORT):
|
||||
*foundLen = PLOC_SPV::SIZE_BOOT_STATUS_REPORT;
|
||||
*foundId = PLOC_SPV::BOOT_STATUS_REPORT;
|
||||
break;
|
||||
case(PLOC_SPV::APID_EXE_SUCCESS):
|
||||
*foundLen = PLOC_SPV::SIZE_EXE_REPORT;
|
||||
*foundId = PLOC_SPV::EXE_REPORT;
|
||||
@ -559,6 +563,9 @@ void PlocSupervisorHandler::setNextReplyId() {
|
||||
case PLOC_SPV::GET_HK_REPORT:
|
||||
nextReplyId = PLOC_SPV::HK_REPORT;
|
||||
break;
|
||||
case PLOC_SPV::GET_BOOT_STATUS_REPORT:
|
||||
nextReplyId = PLOC_SPV::BOOT_STATUS_REPORT;
|
||||
break;
|
||||
default:
|
||||
/* If no telemetry is expected the next reply is always the execution report */
|
||||
nextReplyId = PLOC_SPV::EXE_REPORT;
|
||||
|
@ -194,6 +194,12 @@ private:
|
||||
|
||||
void prepareRestartTriesCmd(const uint8_t * commandData);
|
||||
|
||||
/**
|
||||
* @brief This function fills the command buffer with the packet to notify the supervisor
|
||||
* about the availability of an update for the MPSoC
|
||||
*/
|
||||
void prepareUpdateAvailableCmd(const uint8_t * commandData);
|
||||
|
||||
/**
|
||||
* @brief In case an acknowledgment failure reply has been received this function disables
|
||||
* all previously enabled commands and resets the exepected replies variable of an
|
||||
|
@ -342,6 +342,99 @@ private:
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
* @brief This dataset stores the boot status report of the supervisor.
|
||||
*/
|
||||
class BootStatusReport: public StaticLocalDataSet<BOOT_REPORT_SET_ENTRIES> {
|
||||
public:
|
||||
|
||||
BootStatusReport(HasLocalDataPoolIF* owner) :
|
||||
StaticLocalDataSet(owner, BOOT_REPORT_SET_ID) {
|
||||
}
|
||||
|
||||
BootStatusReport(object_id_t objectId) :
|
||||
StaticLocalDataSet(sid_t(objectId, BOOT_REPORT_SET_ID)) {
|
||||
}
|
||||
|
||||
/** Information about boot status of MPSoC */
|
||||
lp_var_t<uint8_t> bootSignal = lp_var_t<uint8_t>(sid.objectId, PoolIds::BOOT_SIGNAL, this);
|
||||
lp_var_t<uint8_t> resetCounter = lp_var_t<uint8_t>(sid.objectId, PoolIds::RESET_COUNTER, this);
|
||||
/** Time the MPSoC needs for last boot */
|
||||
lp_var_t<uint32_t> bootAfterMs = lp_var_t<uint32_t>(sid.objectId, PoolIds::BOOT_AFTER_MS, this);
|
||||
/** The currently set boot timeout */
|
||||
lp_var_t<uint32_t> bootTimeoutMs = lp_var_t<uint32_t>(sid.objectId, PoolIds::BOOT_TIMEOUT_MS, this);
|
||||
lp_var_t<uint8_t> activeNvm = lp_var_t<uint8_t>(sid.objectId, PoolIds::ACTIVE_NVM, this);
|
||||
/** States of the boot partition pins */
|
||||
lp_var_t<uint8_t> bp0State = lp_var_t<uint8_t>(sid.objectId, PoolIds::BP0_STATE, this);
|
||||
lp_var_t<uint8_t> bp1State = lp_var_t<uint8_t>(sid.objectId, PoolIds::BP1_STATE, this);
|
||||
lp_var_t<uint8_t> bp2State = lp_var_t<uint8_t>(sid.objectId, PoolIds::BP2_STATE, this);
|
||||
};
|
||||
|
||||
/**
|
||||
* @brief This class packages the command to notify the supervisor that a new update for the
|
||||
* MPSoC is available.
|
||||
*/
|
||||
class UpdateAvailable: public SpacePacket {
|
||||
public:
|
||||
|
||||
/**
|
||||
* @brief Constructor
|
||||
*
|
||||
* @param imageSelect
|
||||
* @param imagePartition
|
||||
* @param imageSize
|
||||
* @param imageCrc
|
||||
* @param numberOfPackets
|
||||
*/
|
||||
UpdateAvailable(uint8_t imageSelect, uint8_t imagePartition, uint32_t imageSize,
|
||||
uint32_t imageCrc, uint32_t numberOfPackets) :
|
||||
SpacePacket(DATA_FIELD_LENGTH - 1, true, APID_UPDATE_AVAILABLE,
|
||||
DEFAULT_SEQUENCE_COUNT), imageSelect(imageSelect), imagePartition(
|
||||
imagePartition), imageSize(imageSize), imageCrc(imageCrc), numberOfPackets(
|
||||
numberOfPackets) {
|
||||
initPacket();
|
||||
}
|
||||
|
||||
private:
|
||||
|
||||
static const uint16_t DATA_FIELD_LENGTH = 16;
|
||||
static const uint16_t DEFAULT_SEQUENCE_COUNT = 1;
|
||||
|
||||
static const uint16_t CRC_OFFSET = DATA_FIELD_LENGTH - 2;
|
||||
|
||||
uint8_t imageSelect = 0;
|
||||
uint8_t imagePartition = 0;
|
||||
uint32_t imageSize = 0;
|
||||
uint32_t imageCrc = 0;
|
||||
uint32_t numberOfPackets = 0;
|
||||
|
||||
void initPacket() {
|
||||
size_t serializedSize = 0;
|
||||
uint8_t* data_field_ptr = this->localData.fields.buffer;
|
||||
SerializeAdapter::serialize<uint8_t>(&imageSelect, &data_field_ptr, &serializedSize,
|
||||
sizeof(imageSelect), SerializeIF::Endianness::BIG);
|
||||
serializedSize = 0;
|
||||
SerializeAdapter::serialize<uint8_t>(&imagePartition, &data_field_ptr, &serializedSize,
|
||||
sizeof(imagePartition), SerializeIF::Endianness::BIG);
|
||||
serializedSize = 0;
|
||||
SerializeAdapter::serialize<uint32_t>(&imageSize, &data_field_ptr, &serializedSize,
|
||||
sizeof(imageSize), SerializeIF::Endianness::BIG);
|
||||
serializedSize = 0;
|
||||
SerializeAdapter::serialize<uint32_t>(&imageCrc, &data_field_ptr, &serializedSize,
|
||||
sizeof(imageCrc), SerializeIF::Endianness::BIG);
|
||||
serializedSize = 0;
|
||||
SerializeAdapter::serialize<uint32_t>(&numberOfPackets, &data_field_ptr, &serializedSize,
|
||||
sizeof(numberOfPackets), SerializeIF::Endianness::BIG);
|
||||
serializedSize = 0;
|
||||
uint16_t crc = CRC::crc16ccitt(this->localData.byteStream,
|
||||
sizeof(CCSDSPrimaryHeader) + DATA_FIELD_LENGTH - 2);
|
||||
serializedSize = 0;
|
||||
uint8_t* crcPos = this->localData.fields.buffer + CRC_OFFSET;
|
||||
SerializeAdapter::serialize<uint16_t>(&crc, &crcPos, &serializedSize, sizeof(crc),
|
||||
SerializeIF::Endianness::BIG);
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
* @brief With this class the space packet can be generated to disable to periodic transmission
|
||||
* of housekeeping data. Normally, this will be disabled by default. However, adding this
|
||||
@ -407,95 +500,6 @@ public:
|
||||
this);
|
||||
lp_var_t<uint8_t> fmcState = lp_var_t<uint8_t>(sid.objectId, PoolIds::FMC_STATE, this);
|
||||
};
|
||||
|
||||
/**
|
||||
* @brief This dataset stores the boot status report of the supervisor.
|
||||
*/
|
||||
class BootStatusReport: public StaticLocalDataSet<BOOT_REPORT_SET_ENTRIES> {
|
||||
public:
|
||||
|
||||
BootStatusReport(HasLocalDataPoolIF* owner) :
|
||||
StaticLocalDataSet(owner, BOOT_REPORT_SET_ID) {
|
||||
}
|
||||
|
||||
BootStatusReport(object_id_t objectId) :
|
||||
StaticLocalDataSet(sid_t(objectId, BOOT_REPORT_SET_ID)) {
|
||||
}
|
||||
|
||||
/** Information about boot status of MPSoC */
|
||||
lp_var_t<uint8_t> bootSignal = lp_var_t<uint8_t>(sid.objectId, PoolIds::BOOT_SIGNAL, this);
|
||||
lp_var_t<uint8_t> resetCounter = lp_var_t<uint8_t>(sid.objectId, PoolIds::RESET_COUNTER, this);
|
||||
/** Time the MPSoC needs for last boot */
|
||||
lp_var_t<uint32_t> bootAfterMs = lp_var_t<uint32_t>(sid.objectId, PoolIds::BOOT_AFTER_MS, this);
|
||||
/** The currently set boot timeout */
|
||||
lp_var_t<uint32_t> bootTimeoutMs = lp_var_t<uint32_t>(sid.objectId, PoolIds::BOOT_TIMEOUT_MS, this);
|
||||
lp_var_t<uint8_t> activeNvm = lp_var_t<uint8_t>(sid.objectId, PoolIds::ACTIVE_NVM, this);
|
||||
/** States of the boot partition pins */
|
||||
lp_var_t<uint8_t> bp0State = lp_var_t<uint8_t>(sid.objectId, PoolIds::BP0_STATE, this);
|
||||
lp_var_t<uint8_t> bp1State = lp_var_t<uint8_t>(sid.objectId, PoolIds::BP1_STATE, this);
|
||||
lp_var_t<uint8_t> bp2State = lp_var_t<uint8_t>(sid.objectId, PoolIds::BP2_STATE, this);
|
||||
};
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief This class packages the command to notify the supervisor that a new update for the
|
||||
* MPSoC is available.
|
||||
*/
|
||||
class UpdateAvailable: public SpacePacket {
|
||||
public:
|
||||
|
||||
/**
|
||||
* @brief Constructor
|
||||
*
|
||||
* @param imageSelect
|
||||
* @param imagePartition
|
||||
* @param imageSize
|
||||
* @param imageCrc
|
||||
* @param numberOfPackets
|
||||
*/
|
||||
UpdateAvailable(uint8_t imageSelect, uint8_t imagePartition, uint32_t imageSize,
|
||||
uint32_t imageCrc, uint32_t numberOfPackets) :
|
||||
SpacePacket(DATA_FIELD_LENGTH - 1, true, APID_SEL_MPSOC_BOOT_IMAGE,
|
||||
DEFAULT_SEQUENCE_COUNT), imageSelect(imageSelect), imagePartition(
|
||||
imagePartition), imageSize(imageSize), imageCrc(imageCrc), numberOfPackets(
|
||||
numberOfPackets) {
|
||||
initPacket();
|
||||
}
|
||||
|
||||
private:
|
||||
|
||||
static const uint16_t DATA_FIELD_LENGTH = 16;
|
||||
static const uint16_t DEFAULT_SEQUENCE_COUNT = 1;
|
||||
|
||||
static const uint16_t CRC_OFFSET = DATA_FIELD_LENGTH - 2;
|
||||
|
||||
uint8_t imageSelect = 0;
|
||||
uint8_t imagePartition = 0;
|
||||
uint32_t imageSize = 0;
|
||||
uint32_t imageCrc = 0;
|
||||
uint32_t numberOfPackets = 0;
|
||||
|
||||
void initPacket() {
|
||||
uint8_t offset = 0;
|
||||
uint8_t* data_field_start = this->localData.fields.buffer;
|
||||
std::memcpy(data_field_start + offset, &imageSelect, sizeof(imageSelect));
|
||||
offset += 1;
|
||||
std::memcpy(data_field_start + offset, &imagePartition, sizeof(imagePartition));
|
||||
offset += 1;
|
||||
std::memcpy(data_field_start + offset, &imageSize, sizeof(imageSize));
|
||||
offset += 4;
|
||||
std::memcpy(data_field_start + offset, &imageCrc, sizeof(imageCrc));
|
||||
offset += 4;
|
||||
std::memcpy(data_field_start + offset, &numberOfPackets, sizeof(numberOfPackets));
|
||||
|
||||
uint16_t crc = CRC::crc16ccitt(this->localData.byteStream,
|
||||
sizeof(CCSDSPrimaryHeader) + DATA_FIELD_LENGTH - 2);
|
||||
/* Add crc to packet data field of space packet */
|
||||
size_t serializedSize = 0;
|
||||
uint8_t* crcPos = this->localData.fields.buffer + CRC_OFFSET;
|
||||
SerializeAdapter::serialize<uint16_t>(&crc, &crcPos, &serializedSize, sizeof(crc),
|
||||
SerializeIF::Endianness::BIG);
|
||||
}
|
||||
};
|
||||
|
||||
#endif /* MISSION_DEVICES_DEVICEDEFINITIONS_PLOCSVPDEFINITIONS_H_ */
|
||||
|
Loading…
Reference in New Issue
Block a user