continue switch to new packet format

This commit is contained in:
Robin Müller 2022-11-07 11:26:36 +01:00
parent 95a3ea1d23
commit f32f68d0e0
No known key found for this signature in database
GPG Key ID: 11D4952C8CCEF814
2 changed files with 10 additions and 8 deletions

View File

@ -378,6 +378,10 @@ class TcBase : public ploc::SpTcBase {
}
}
void setLenFromPayloadLen(size_t payloadLen) {
spParams.setFullPayloadLen(ccsds::HEADER_LEN + SECONDARY_HEADER_LEN + payloadLen + CRC_LEN);
}
private:
uint8_t serviceId = 0;
@ -387,6 +391,7 @@ class TcBase : public ploc::SpTcBase {
return returnvalue::FAILED;
}
std::memset(spParams.buf + ccsds::HEADER_LEN, 0, TIMESTAMP_LEN);
payloadStart = spParams.buf + SECONDARY_HEADER_LEN;
return returnvalue::OK;
}
};
@ -413,7 +418,7 @@ class NoPayloadPacket : public TcBase {
* @brief This class can be used to generate the space packet selecting the boot image of
* of the MPSoC.
*/
class MPSoCBootSelect : public ploc::SpTcBase {
class MPSoCBootSelect : public TcBase {
public:
static const uint8_t NVM0 = 0;
static const uint8_t NVM1 = 1;
@ -428,8 +433,8 @@ class MPSoCBootSelect : public ploc::SpTcBase {
*
* @note Selection of partitions is currently not supported.
*/
MPSoCBootSelect(ploc::SpTcParams params) : ploc::SpTcBase(params) {
spParams.setFullPayloadLen(DATA_FIELD_LENGTH);
MPSoCBootSelect(TcParams params) : TcBase(params) {
params.setLenFromPayloadLen(4);
spParams.creator.setApid(APID_SEL_MPSOC_BOOT_IMAGE);
spParams.creator.setSeqCount(DEFAULT_SEQUENCE_COUNT);
}
@ -444,16 +449,13 @@ class MPSoCBootSelect : public ploc::SpTcBase {
}
private:
static const uint16_t DATA_FIELD_LENGTH = 6;
static const uint8_t MEM_OFFSET = 0;
static const uint8_t BP0_OFFSET = 1;
static const uint8_t BP1_OFFSET = 2;
static const uint8_t BP2_OFFSET = 3;
static const uint16_t CRC_OFFSET = DATA_FIELD_LENGTH - 2;
void initPacket(uint8_t mem = 0, uint8_t bp0 = 0, uint8_t bp1 = 0, uint8_t bp2 = 0) {
std::memcpy(payloadStart + MEM_OFFSET, &mem, sizeof(mem));
payloadStart[0] = mem;
std::memcpy(payloadStart + BP0_OFFSET, &bp0, sizeof(bp0));
std::memcpy(payloadStart + BP1_OFFSET, &bp1, sizeof(bp1));
std::memcpy(payloadStart + BP2_OFFSET, &bp2, sizeof(bp2));

View File

@ -1431,7 +1431,7 @@ ReturnValue_t PlocSupervisorHandler::prepareEmptyCmd(uint16_t apid, uint8_t serv
ReturnValue_t PlocSupervisorHandler::prepareSelBootImageCmd(const uint8_t* commandData) {
supv::MPSoCBootSelect packet(spParams);
ReturnValue_t result =
packet.buildPacket(*commandData, *(commandData + 1), *(commandData + 2), *(commandData + 3));
packet.buildPacket(commandData[0], commandData[1], commandData[2], commandData[3]);
if (result != returnvalue::OK) {
return result;
}