PLOC SUPV Update to newer firmware #316

Merged
muellerr merged 99 commits from mueller/tas_ploc_supv_update into develop 2022-11-18 14:27:13 +01:00
5 changed files with 53 additions and 72 deletions
Showing only changes of commit 95a3ea1d23 - Show all commits

View File

@ -355,11 +355,11 @@ enum PoolIds : lp_id_t {
ADC_ENG_15 ADC_ENG_15
}; };
struct SupvTcParams : public ploc::SpTcParams { struct TcParams : public ploc::SpTcParams {
public: 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) {} : ploc::SpTcParams(creator, buf, maxSize) {}
void setLenFromPayloadLen(size_t payloadLen) { 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: 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) { : ploc::SpTcBase(params, apid, seqCount), serviceId(serviceId) {
if (setup() == OK) { if (setup() == OK and params.buf != nullptr) {
params.buf + supv::PAYLOAD_OFFSET = serviceId; params.buf[supv::PAYLOAD_OFFSET] = serviceId;
} }
} }
@ -391,11 +391,13 @@ class SupvTcBase : public ploc::SpTcBase {
} }
}; };
class NoPayloadPacket : public SupvTcBase { class NoPayloadPacket : public TcBase {
public: public:
NoPayloadPacket(SupvTcParams params, uint16_t apid, uint8_t serviceId, uint16_t seqCount) NoPayloadPacket(TcParams params, uint16_t apid, uint8_t serviceId)
: SupvTcBase(params, apid, serviceId, seqCount) {} : 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 buildPacket() {
ReturnValue_t result = checkSizeAndSerializeHeader(); ReturnValue_t result = checkSizeAndSerializeHeader();
if (result != OK) { if (result != OK) {
@ -406,33 +408,6 @@ class NoPayloadPacket : public SupvTcBase {
private: 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 * @brief This class can be used to generate the space packet selecting the boot image of

View File

@ -221,17 +221,17 @@ ReturnValue_t PlocSupervisorHandler::buildCommandFromCommand(DeviceCommandId_t d
spParams.buf = commandBuffer; spParams.buf = commandBuffer;
switch (deviceCommand) { switch (deviceCommand) {
case GET_HK_REPORT: { case GET_HK_REPORT: {
prepareEmptyCmd(APID_GET_HK_REPORT); prepareEmptyCmd(APID_HK, static_cast<uint8_t>(HkServiceIds::GET_REPORT));
result = returnvalue::OK; result = returnvalue::OK;
break; break;
} }
case START_MPSOC: { case START_MPSOC: {
prepareEmptyCmd(APID_START_MPSOC); prepareEmptyCmd(APID_BOOT_MAN, static_cast<uint8_t>(BootManServiceIds::START_MPSOC));
result = returnvalue::OK; result = returnvalue::OK;
break; break;
} }
case SHUTDOWN_MPSOC: { case SHUTDOWN_MPSOC: {
prepareEmptyCmd(APID_SHUTWOWN_MPSOC); prepareEmptyCmd(APID_BOOT_MAN, static_cast<uint8_t>(BootManServiceIds::SHUTDOWN_MPSOC));
result = returnvalue::OK; result = returnvalue::OK;
break; break;
} }
@ -241,7 +241,7 @@ ReturnValue_t PlocSupervisorHandler::buildCommandFromCommand(DeviceCommandId_t d
break; break;
} }
case RESET_MPSOC: { case RESET_MPSOC: {
prepareEmptyCmd(APID_RESET_MPSOC); prepareEmptyCmd(APID_BOOT_MAN, static_cast<uint8_t>(BootManServiceIds::RESET_MPSOC));
result = returnvalue::OK; result = returnvalue::OK;
break; break;
} }
@ -265,7 +265,8 @@ ReturnValue_t PlocSupervisorHandler::buildCommandFromCommand(DeviceCommandId_t d
break; break;
} }
case GET_BOOT_STATUS_REPORT: { 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; result = returnvalue::OK;
break; break;
} }
@ -297,20 +298,22 @@ ReturnValue_t PlocSupervisorHandler::buildCommandFromCommand(DeviceCommandId_t d
break; break;
} }
case GET_LATCHUP_STATUS_REPORT: { case GET_LATCHUP_STATUS_REPORT: {
prepareEmptyCmd(APID_GET_LATCHUP_STATUS_REPORT); prepareEmptyCmd(APID_LATCHUP_MON,
result = returnvalue::OK; static_cast<uint8_t>(LatchupMonServiceIds::GET_STATUS_REPORT));
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);
result = returnvalue::OK; result = returnvalue::OK;
break; 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: { case RUN_AUTO_EM_TESTS: {
result = prepareRunAutoEmTest(commandData); result = prepareRunAutoEmTest(commandData);
break; break;
@ -333,11 +336,11 @@ ReturnValue_t PlocSupervisorHandler::buildCommandFromCommand(DeviceCommandId_t d
result = returnvalue::OK; result = returnvalue::OK;
break; break;
} }
case RESTART_SUPERVISOR: { // case RESTART_SUPERVISOR: {
prepareEmptyCmd(APID_RESTART_SUPERVISOR); // prepareEmptyCmd(APID_RESTART_SUPERVISOR);
result = returnvalue::OK; // result = returnvalue::OK;
break; // break;
} // }
case FACTORY_RESET_CLEAR_ALL: { case FACTORY_RESET_CLEAR_ALL: {
FactoryReset packet(spParams); FactoryReset packet(spParams);
result = packet.buildPacket(FactoryReset::Op::CLEAR_ALL); result = packet.buildPacket(FactoryReset::Op::CLEAR_ALL);
@ -365,18 +368,19 @@ ReturnValue_t PlocSupervisorHandler::buildCommandFromCommand(DeviceCommandId_t d
finishTcPrep(packet.getFullPacketLen()); finishTcPrep(packet.getFullPacketLen());
break; break;
} }
case START_MPSOC_QUIET: { // Removed command
prepareEmptyCmd(APID_START_MPSOC_QUIET); // case START_MPSOC_QUIET: {
result = returnvalue::OK; // prepareEmptyCmd(APID_START_MPSOC_QUIET);
break; // result = returnvalue::OK;
} // break;
// }
case SET_SHUTDOWN_TIMEOUT: { case SET_SHUTDOWN_TIMEOUT: {
prepareSetShutdownTimeoutCmd(commandData); prepareSetShutdownTimeoutCmd(commandData);
result = returnvalue::OK; result = returnvalue::OK;
break; break;
} }
case FACTORY_FLASH: { case FACTORY_FLASH: {
prepareEmptyCmd(APID_FACTORY_FLASH); prepareEmptyCmd(APID_BOOT_MAN, static_cast<uint8_t>(BootManServiceIds::FACTORY_FLASH));
result = returnvalue::OK; result = returnvalue::OK;
break; break;
} }
@ -430,7 +434,7 @@ ReturnValue_t PlocSupervisorHandler::buildCommandFromCommand(DeviceCommandId_t d
break; break;
} }
case RESET_PL: { case RESET_PL: {
prepareEmptyCmd(APID_RESET_PL); prepareEmptyCmd(APID_BOOT_MAN, static_cast<uint8_t>(BootManServiceIds::RESET_PL));
result = returnvalue::OK; result = returnvalue::OK;
break; break;
} }
@ -1414,8 +1418,8 @@ void PlocSupervisorHandler::handleDeviceTM(const uint8_t* data, size_t dataSize,
} }
} }
ReturnValue_t PlocSupervisorHandler::prepareEmptyCmd(uint16_t apid) { ReturnValue_t PlocSupervisorHandler::prepareEmptyCmd(uint16_t apid, uint8_t serviceId) {
supv::ApidOnlyPacket packet(spParams, apid); supv::NoPayloadPacket packet(spParams, apid, serviceId);
ReturnValue_t result = packet.buildPacket(); ReturnValue_t result = packet.buildPacket();
if (result != returnvalue::OK) { if (result != returnvalue::OK) {
return result; return result;

View File

@ -102,7 +102,7 @@ class PlocSupervisorHandler : public DeviceHandlerBase {
uint8_t commandBuffer[supv::MAX_COMMAND_SIZE]; uint8_t commandBuffer[supv::MAX_COMMAND_SIZE];
SpacePacketCreator creator; 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 * 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 * @brief This function prepares a space packet which does not transport any data in the
* packet data field apart from the crc. * 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. * @brief This function initializes the space packet to select the boot image of the MPSoC.

View File

@ -24,6 +24,7 @@
#include "mission/utility/Timestamp.h" #include "mission/utility/Timestamp.h"
using namespace returnvalue; using namespace returnvalue;
using namespace supv;
PlocSupvHelper::PlocSupvHelper(object_id_t objectId) PlocSupvHelper::PlocSupvHelper(object_id_t objectId)
: SystemObject(objectId), : SystemObject(objectId),
@ -498,7 +499,8 @@ ReturnValue_t PlocSupvHelper::selectMemory() {
ReturnValue_t PlocSupvHelper::prepareUpdate() { ReturnValue_t PlocSupvHelper::prepareUpdate() {
ReturnValue_t result = returnvalue::OK; ReturnValue_t result = returnvalue::OK;
resetSpParams(); 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(); result = packet.buildPacket();
if (result != returnvalue::OK) { if (result != returnvalue::OK) {
return result; return result;

View File

@ -238,7 +238,7 @@ class PlocSupvHelper : public DeviceCommunicationIF,
uint8_t commandBuffer[supv::MAX_COMMAND_SIZE]{}; uint8_t commandBuffer[supv::MAX_COMMAND_SIZE]{};
SpacePacketCreator creator; SpacePacketCreator creator;
ploc::SpTcParams spParams = ploc::SpTcParams(creator); supv::TcParams spParams = supv::TcParams(creator);
std::array<uint8_t, supv::MAX_COMMAND_SIZE> tmBuf{}; std::array<uint8_t, supv::MAX_COMMAND_SIZE> tmBuf{};