start using new packet format
This commit is contained in:
parent
23025eec7a
commit
95a3ea1d23
@ -355,11 +355,11 @@ enum PoolIds : lp_id_t {
|
||||
ADC_ENG_15
|
||||
};
|
||||
|
||||
struct SupvTcParams : public ploc::SpTcParams {
|
||||
struct TcParams : public ploc::SpTcParams {
|
||||
public:
|
||||
SupvTcParams(SpacePacketCreator& creator) : ploc::SpTcParams(creator) {}
|
||||
TcParams(SpacePacketCreator& creator) : ploc::SpTcParams(creator) {}
|
||||
|
||||
SupvTcParams(SpacePacketCreator& creator, uint8_t* buf, size_t maxSize)
|
||||
TcParams(SpacePacketCreator& creator, uint8_t* buf, size_t maxSize)
|
||||
: ploc::SpTcParams(creator, buf, maxSize) {}
|
||||
|
||||
void setLenFromPayloadLen(size_t payloadLen) {
|
||||
@ -367,14 +367,14 @@ struct SupvTcParams : public ploc::SpTcParams {
|
||||
}
|
||||
};
|
||||
|
||||
class SupvTcBase : public ploc::SpTcBase {
|
||||
class TcBase : public ploc::SpTcBase {
|
||||
public:
|
||||
SupvTcBase(SupvTcParams params) : ploc::SpTcBase(params) { setup(); }
|
||||
TcBase(TcParams params) : ploc::SpTcBase(params) { setup(); }
|
||||
|
||||
SupvTcBase(SupvTcParams params, uint16_t apid, uint8_t serviceId, uint16_t seqCount)
|
||||
TcBase(TcParams params, uint16_t apid, uint8_t serviceId, uint16_t seqCount)
|
||||
: ploc::SpTcBase(params, apid, seqCount), serviceId(serviceId) {
|
||||
if (setup() == OK) {
|
||||
params.buf + supv::PAYLOAD_OFFSET = serviceId;
|
||||
if (setup() == OK and params.buf != nullptr) {
|
||||
params.buf[supv::PAYLOAD_OFFSET] = serviceId;
|
||||
}
|
||||
}
|
||||
|
||||
@ -391,11 +391,13 @@ class SupvTcBase : public ploc::SpTcBase {
|
||||
}
|
||||
};
|
||||
|
||||
class NoPayloadPacket : public SupvTcBase {
|
||||
class NoPayloadPacket : public TcBase {
|
||||
public:
|
||||
NoPayloadPacket(SupvTcParams params, uint16_t apid, uint8_t serviceId, uint16_t seqCount)
|
||||
: SupvTcBase(params, apid, serviceId, seqCount) {}
|
||||
NoPayloadPacket(TcParams params, uint16_t apid, uint8_t serviceId)
|
||||
: NoPayloadPacket(params, apid, serviceId, 0) {}
|
||||
|
||||
NoPayloadPacket(TcParams params, uint16_t apid, uint8_t serviceId, uint16_t seqId)
|
||||
: TcBase(params, apid, serviceId, seqId) {}
|
||||
ReturnValue_t buildPacket() {
|
||||
ReturnValue_t result = checkSizeAndSerializeHeader();
|
||||
if (result != OK) {
|
||||
@ -406,33 +408,6 @@ class NoPayloadPacket : public SupvTcBase {
|
||||
|
||||
private:
|
||||
};
|
||||
/**
|
||||
* @brief This class creates a space packet containing only the header data and the CRC.
|
||||
*/
|
||||
class ApidOnlyPacket : public ploc::SpTcBase {
|
||||
public:
|
||||
/**
|
||||
* @brief Constructor
|
||||
*
|
||||
* @param apid The APID to set in the space packet.
|
||||
*
|
||||
* @note Sequence count of empty packet is always 1.
|
||||
*/
|
||||
ApidOnlyPacket(ploc::SpTcParams params, uint16_t apid) : ploc::SpTcBase(params) {
|
||||
spParams.setFullPayloadLen(MIN_TC_LEN);
|
||||
spParams.creator.setApid(apid);
|
||||
}
|
||||
|
||||
ReturnValue_t buildPacket() {
|
||||
auto res = checkSizeAndSerializeHeader();
|
||||
if (res != returnvalue::OK) {
|
||||
return res;
|
||||
}
|
||||
return calcAndSetCrc();
|
||||
}
|
||||
|
||||
private:
|
||||
};
|
||||
|
||||
/**
|
||||
* @brief This class can be used to generate the space packet selecting the boot image of
|
||||
|
@ -221,17 +221,17 @@ ReturnValue_t PlocSupervisorHandler::buildCommandFromCommand(DeviceCommandId_t d
|
||||
spParams.buf = commandBuffer;
|
||||
switch (deviceCommand) {
|
||||
case GET_HK_REPORT: {
|
||||
prepareEmptyCmd(APID_GET_HK_REPORT);
|
||||
prepareEmptyCmd(APID_HK, static_cast<uint8_t>(HkServiceIds::GET_REPORT));
|
||||
result = returnvalue::OK;
|
||||
break;
|
||||
}
|
||||
case START_MPSOC: {
|
||||
prepareEmptyCmd(APID_START_MPSOC);
|
||||
prepareEmptyCmd(APID_BOOT_MAN, static_cast<uint8_t>(BootManServiceIds::START_MPSOC));
|
||||
result = returnvalue::OK;
|
||||
break;
|
||||
}
|
||||
case SHUTDOWN_MPSOC: {
|
||||
prepareEmptyCmd(APID_SHUTWOWN_MPSOC);
|
||||
prepareEmptyCmd(APID_BOOT_MAN, static_cast<uint8_t>(BootManServiceIds::SHUTDOWN_MPSOC));
|
||||
result = returnvalue::OK;
|
||||
break;
|
||||
}
|
||||
@ -241,7 +241,7 @@ ReturnValue_t PlocSupervisorHandler::buildCommandFromCommand(DeviceCommandId_t d
|
||||
break;
|
||||
}
|
||||
case RESET_MPSOC: {
|
||||
prepareEmptyCmd(APID_RESET_MPSOC);
|
||||
prepareEmptyCmd(APID_BOOT_MAN, static_cast<uint8_t>(BootManServiceIds::RESET_MPSOC));
|
||||
result = returnvalue::OK;
|
||||
break;
|
||||
}
|
||||
@ -265,7 +265,8 @@ ReturnValue_t PlocSupervisorHandler::buildCommandFromCommand(DeviceCommandId_t d
|
||||
break;
|
||||
}
|
||||
case GET_BOOT_STATUS_REPORT: {
|
||||
prepareEmptyCmd(APID_GET_BOOT_STATUS_RPT);
|
||||
prepareEmptyCmd(APID_BOOT_MAN,
|
||||
static_cast<uint8_t>(BootManServiceIds::GET_BOOT_STATUS_REPORT));
|
||||
result = returnvalue::OK;
|
||||
break;
|
||||
}
|
||||
@ -297,20 +298,22 @@ ReturnValue_t PlocSupervisorHandler::buildCommandFromCommand(DeviceCommandId_t d
|
||||
break;
|
||||
}
|
||||
case GET_LATCHUP_STATUS_REPORT: {
|
||||
prepareEmptyCmd(APID_GET_LATCHUP_STATUS_REPORT);
|
||||
result = returnvalue::OK;
|
||||
break;
|
||||
}
|
||||
case COPY_ADC_DATA_TO_MRAM: {
|
||||
prepareEmptyCmd(APID_COPY_ADC_DATA_TO_MRAM);
|
||||
result = returnvalue::OK;
|
||||
break;
|
||||
}
|
||||
case REQUEST_ADC_REPORT: {
|
||||
prepareEmptyCmd(APID_REQUEST_ADC_REPORT);
|
||||
prepareEmptyCmd(APID_LATCHUP_MON,
|
||||
static_cast<uint8_t>(LatchupMonServiceIds::GET_STATUS_REPORT));
|
||||
result = returnvalue::OK;
|
||||
break;
|
||||
}
|
||||
// I think this is disabled right now according to the TC excel table
|
||||
// case COPY_ADC_DATA_TO_MRAM: {
|
||||
// prepareEmptyCmd(APID_COPY_ADC_DATA_TO_MRAM);
|
||||
// result = returnvalue::OK;
|
||||
// break;
|
||||
// }
|
||||
// case REQUEST_ADC_REPORT: {
|
||||
// prepareEmptyCmd(APID_REQUEST_ADC_REPORT);
|
||||
// result = returnvalue::OK;
|
||||
// break;
|
||||
// }
|
||||
case RUN_AUTO_EM_TESTS: {
|
||||
result = prepareRunAutoEmTest(commandData);
|
||||
break;
|
||||
@ -333,11 +336,11 @@ ReturnValue_t PlocSupervisorHandler::buildCommandFromCommand(DeviceCommandId_t d
|
||||
result = returnvalue::OK;
|
||||
break;
|
||||
}
|
||||
case RESTART_SUPERVISOR: {
|
||||
prepareEmptyCmd(APID_RESTART_SUPERVISOR);
|
||||
result = returnvalue::OK;
|
||||
break;
|
||||
}
|
||||
// case RESTART_SUPERVISOR: {
|
||||
// prepareEmptyCmd(APID_RESTART_SUPERVISOR);
|
||||
// result = returnvalue::OK;
|
||||
// break;
|
||||
// }
|
||||
case FACTORY_RESET_CLEAR_ALL: {
|
||||
FactoryReset packet(spParams);
|
||||
result = packet.buildPacket(FactoryReset::Op::CLEAR_ALL);
|
||||
@ -365,18 +368,19 @@ ReturnValue_t PlocSupervisorHandler::buildCommandFromCommand(DeviceCommandId_t d
|
||||
finishTcPrep(packet.getFullPacketLen());
|
||||
break;
|
||||
}
|
||||
case START_MPSOC_QUIET: {
|
||||
prepareEmptyCmd(APID_START_MPSOC_QUIET);
|
||||
result = returnvalue::OK;
|
||||
break;
|
||||
}
|
||||
// Removed command
|
||||
// case START_MPSOC_QUIET: {
|
||||
// prepareEmptyCmd(APID_START_MPSOC_QUIET);
|
||||
// result = returnvalue::OK;
|
||||
// break;
|
||||
// }
|
||||
case SET_SHUTDOWN_TIMEOUT: {
|
||||
prepareSetShutdownTimeoutCmd(commandData);
|
||||
result = returnvalue::OK;
|
||||
break;
|
||||
}
|
||||
case FACTORY_FLASH: {
|
||||
prepareEmptyCmd(APID_FACTORY_FLASH);
|
||||
prepareEmptyCmd(APID_BOOT_MAN, static_cast<uint8_t>(BootManServiceIds::FACTORY_FLASH));
|
||||
result = returnvalue::OK;
|
||||
break;
|
||||
}
|
||||
@ -430,7 +434,7 @@ ReturnValue_t PlocSupervisorHandler::buildCommandFromCommand(DeviceCommandId_t d
|
||||
break;
|
||||
}
|
||||
case RESET_PL: {
|
||||
prepareEmptyCmd(APID_RESET_PL);
|
||||
prepareEmptyCmd(APID_BOOT_MAN, static_cast<uint8_t>(BootManServiceIds::RESET_PL));
|
||||
result = returnvalue::OK;
|
||||
break;
|
||||
}
|
||||
@ -1414,8 +1418,8 @@ void PlocSupervisorHandler::handleDeviceTM(const uint8_t* data, size_t dataSize,
|
||||
}
|
||||
}
|
||||
|
||||
ReturnValue_t PlocSupervisorHandler::prepareEmptyCmd(uint16_t apid) {
|
||||
supv::ApidOnlyPacket packet(spParams, apid);
|
||||
ReturnValue_t PlocSupervisorHandler::prepareEmptyCmd(uint16_t apid, uint8_t serviceId) {
|
||||
supv::NoPayloadPacket packet(spParams, apid, serviceId);
|
||||
ReturnValue_t result = packet.buildPacket();
|
||||
if (result != returnvalue::OK) {
|
||||
return result;
|
||||
|
@ -102,7 +102,7 @@ class PlocSupervisorHandler : public DeviceHandlerBase {
|
||||
|
||||
uint8_t commandBuffer[supv::MAX_COMMAND_SIZE];
|
||||
SpacePacketCreator creator;
|
||||
ploc::SpTcParams spParams = ploc::SpTcParams(creator);
|
||||
supv::TcParams spParams = supv::TcParams(creator);
|
||||
|
||||
/**
|
||||
* This variable is used to store the id of the next reply to receive. This is necessary
|
||||
@ -236,7 +236,7 @@ class PlocSupervisorHandler : public DeviceHandlerBase {
|
||||
* @brief This function prepares a space packet which does not transport any data in the
|
||||
* packet data field apart from the crc.
|
||||
*/
|
||||
ReturnValue_t prepareEmptyCmd(uint16_t apid);
|
||||
ReturnValue_t prepareEmptyCmd(uint16_t apid, uint8_t serviceId);
|
||||
|
||||
/**
|
||||
* @brief This function initializes the space packet to select the boot image of the MPSoC.
|
||||
|
@ -24,6 +24,7 @@
|
||||
#include "mission/utility/Timestamp.h"
|
||||
|
||||
using namespace returnvalue;
|
||||
using namespace supv;
|
||||
|
||||
PlocSupvHelper::PlocSupvHelper(object_id_t objectId)
|
||||
: SystemObject(objectId),
|
||||
@ -498,7 +499,8 @@ ReturnValue_t PlocSupvHelper::selectMemory() {
|
||||
ReturnValue_t PlocSupvHelper::prepareUpdate() {
|
||||
ReturnValue_t result = returnvalue::OK;
|
||||
resetSpParams();
|
||||
supv::ApidOnlyPacket packet(spParams, supv::APID_PREPARE_UPDATE);
|
||||
supv::NoPayloadPacket packet(spParams, supv::APID_BOOT_MAN,
|
||||
static_cast<uint8_t>(BootManServiceIds::PREPARE_UPDATE));
|
||||
result = packet.buildPacket();
|
||||
if (result != returnvalue::OK) {
|
||||
return result;
|
||||
|
@ -238,7 +238,7 @@ class PlocSupvHelper : public DeviceCommunicationIF,
|
||||
|
||||
uint8_t commandBuffer[supv::MAX_COMMAND_SIZE]{};
|
||||
SpacePacketCreator creator;
|
||||
ploc::SpTcParams spParams = ploc::SpTcParams(creator);
|
||||
supv::TcParams spParams = supv::TcParams(creator);
|
||||
|
||||
std::array<uint8_t, supv::MAX_COMMAND_SIZE> tmBuf{};
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user