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 437 additions and 453 deletions
Showing only changes of commit 3b575acd55 - Show all commits

View File

@ -445,45 +445,6 @@ class MPSoCBootSelect : public TcBase {
} }
}; };
/**
* @brief This class creates the command to enable or disable the NVMs connected to the
* supervisor.
*/
// class EnableNvms : public ploc::SpTcBase {
// public:
// /**
// * @brief Constructor
// *
// * @param mem The memory to boot from: NVM0 (0), NVM1 (1)
// * @param bp0 Partition pin 0
// * @param bp1 Partition pin 1
// * @param bp2 Partition pin 2
// */
// EnableNvms(ploc::SpTcParams params) : ploc::SpTcBase(params) {
// spParams.setFullPayloadLen(DATA_FIELD_LENGTH);
// spParams.creator.setApid(APID_ENABLE_NVMS);
// spParams.creator.setSeqCount(DEFAULT_SEQUENCE_COUNT);
// }
//
// ReturnValue_t buildPacket(uint8_t nvm01, uint8_t nvm3) {
// auto res = checkSizeAndSerializeHeader();
// if (res != returnvalue::OK) {
// return res;
// }
// initPacket(nvm01, nvm3);
// return calcAndSetCrc();
// }
//
// private:
// static const uint8_t DATA_FIELD_LENGTH = 4;
// static const uint8_t CRC_OFFSET = 2;
//
// void initPacket(uint8_t nvm01, uint8_t nvm3) {
// payloadStart[0] = nvm01;
// payloadStart[1] = nvm3;
// }
// };
/** /**
* @brief This class generates the space packet to update the time of the PLOC supervisor. * @brief This class generates the space packet to update the time of the PLOC supervisor.
*/ */
@ -715,37 +676,6 @@ class SetAlertlimit : public TcBase {
} }
}; };
/**
* @brief This class packages the space packet to enable or disable ADC channels.
*/
class SetAdcEnabledChannels : public TcBase {
public:
/**
* @brief Constructor
*
* @param ch Defines channels to be enabled or disabled.
*/
SetAdcEnabledChannels(TcParams params)
: TcBase(params, Apids::ADC_MON, static_cast<uint8_t>(AdcMonServiceIds::SET_ENABLED_CHANNELS),
2) {}
ReturnValue_t buildPacket(uint16_t ch) {
auto res = checkSizeAndSerializeHeader();
if (res != returnvalue::OK) {
return res;
}
initPacket(ch);
return calcAndSetCrc();
}
private:
void initPacket(uint16_t ch) {
size_t serializedSize = 0;
SerializeAdapter::serialize(&ch, &payloadStart, &serializedSize, sizeof(ch),
SerializeIF::Endianness::BIG);
}
};
/** /**
* @brief This class packages the space packet to configures the window size and striding step of * @brief This class packages the space packet to configures the window size and striding step of
* the moving average filter applied to the ADC readings. * the moving average filter applied to the ADC readings.
@ -842,60 +772,6 @@ class RunAutoEmTests : public TcBase {
void initPacket(uint8_t test) { payloadStart[0] = test; } void initPacket(uint8_t test) { payloadStart[0] = test; }
}; };
/**
* @brief This class packages the space packet to wipe or dump parts of the MRAM.
*/
// class MramCmd : public TcBase {
// public:
// enum class MramAction { WIPE, DUMP };
//
// /**
// * @brief Constructor
// *
// * @param start Start address of the MRAM section to wipe or dump
// * @param stop End address of the MRAM section to wipe or dump
// * @param action Dump or wipe MRAM
// *
// * @note The content at the stop address is excluded from the dump or wipe operation.
// */
// MramCmd(TcParams params)
// : TcBase(params, Apids::DATA_LOGGER) {
// setLenFromPayloadLen(6);
// }
//
// ReturnValue_t buildPacket(uint32_t start, uint32_t stop, MramAction action) {
// if (action == MramAction::WIPE) {
// setServiceId(static_cast<uint8_t>(DataLoggerServiceIds::WIPE_MRAM));
// } else if (action == MramAction::DUMP) {
// setServiceId(static_cast<uint8_t>(DataLoggerServiceIds::DUMP_MRAM));
// } else {
// sif::debug << "WipeMram: Invalid action specified";
// }
// auto res = checkSizeAndSerializeHeader();
// if (res != returnvalue::OK) {
// return res;
// }
// initPacket(start, stop);
// return calcAndSetCrc();
// }
//
// private:
//
// uint32_t start = 0;
// uint32_t stop = 0;
//
// void initPacket(uint32_t start, uint32_t stop) {
// uint8_t concatBuffer[6];
// concatBuffer[0] = static_cast<uint8_t>(start >> 16);
// concatBuffer[1] = static_cast<uint8_t>(start >> 8);
// concatBuffer[2] = static_cast<uint8_t>(start);
// concatBuffer[3] = static_cast<uint8_t>(stop >> 16);
// concatBuffer[4] = static_cast<uint8_t>(stop >> 8);
// concatBuffer[5] = static_cast<uint8_t>(stop);
// std::memcpy(payloadStart, concatBuffer, sizeof(concatBuffer));
// }
// };
/** /**
* @brief This class packages the space packet change the state of a GPIO. This command is only * @brief This class packages the space packet change the state of a GPIO. This command is only
* required for ground testing. * required for ground testing.
@ -967,59 +843,6 @@ class ReadGpio : public TcBase {
} }
}; };
/**
* @brief This class packages the space packet to perform the factory reset. The op parameter is
* optional.
*
* @details: Without OP: All MRAM entries will be cleared.
* OP = 0x01: Only the mirror entries will be wiped.
* OP = 0x02: Only the circular entries will be wiped.
*/
// class FactoryReset : public TcBase {
// public:
// enum class Op { CLEAR_ALL, MIRROR_ENTRIES, CIRCULAR_ENTRIES };
//
// /**
// * @brief Constructor
// *
// * @param op
// */
// FactoryReset(TcParams params)
// : TcBase(params, Apids::TMTC_MAN, static_cast<uint8_t>(TmtcServiceIds::)) {
// // spParams.creator.setApid(APID_FACTORY_RESET);
// spParams.creator.setSeqCount(DEFAULT_SEQUENCE_COUNT);
// }
//
// ReturnValue_t buildPacket(Op op) {
// auto res = checkSizeAndSerializeHeader();
// if (res != returnvalue::OK) {
// return res;
// }
// initPacket(op);
// return calcAndSetCrc();
// }
//
// private:
// static const uint16_t DEFAULT_SEQUENCE_COUNT = 1;
//
// void initPacket(Op op) {
// size_t packetDataLen = 2;
// switch (op) {
// case Op::MIRROR_ENTRIES:
// payloadStart[0] = 1;
// packetDataLen = 3;
// break;
// case Op::CIRCULAR_ENTRIES:
// payloadStart[0] = 2;
// packetDataLen = 3;
// break;
// default:
// break;
// }
// spParams.setFullPayloadLen(packetDataLen);
// }
// };
class SetShutdownTimeout : public TcBase { class SetShutdownTimeout : public TcBase {
public: public:
SetShutdownTimeout(TcParams params) SetShutdownTimeout(TcParams params)
@ -1068,10 +891,7 @@ class CheckMemory : public TcBase {
} }
private: private:
uint8_t memoryId = 0;
uint8_t n = 1; uint8_t n = 1;
uint32_t startAddress = 0;
uint32_t length = 0;
void initPacket(uint8_t memoryId, uint32_t startAddress, uint32_t length) { void initPacket(uint8_t memoryId, uint32_t startAddress, uint32_t length) {
uint8_t* data = payloadStart; uint8_t* data = payloadStart;
@ -1177,10 +997,7 @@ class EraseMemory : public TcBase {
private: private:
static const uint16_t PAYLOAD_LENGTH = 10; // length without CRC field static const uint16_t PAYLOAD_LENGTH = 10; // length without CRC field
uint8_t memoryId = 0;
uint8_t n = 1; uint8_t n = 1;
uint32_t startAddress = 0;
uint32_t length = 0;
void initPacket(uint8_t memoryId, uint32_t startAddress, uint32_t length) { void initPacket(uint8_t memoryId, uint32_t startAddress, uint32_t length) {
uint8_t* data = payloadStart; uint8_t* data = payloadStart;
@ -1196,97 +1013,6 @@ class EraseMemory : public TcBase {
} }
}; };
/**
* @brief This class creates the space packet to enable the auto TM generation
*/
class EnableAutoTm : public TcBase {
public:
EnableAutoTm(TcParams params) : TcBase(params) {
spParams.setFullPayloadLen(PAYLOAD_LENGTH + 2);
// spParams.creator.setApid(APID_AUTO_TM);
// spParams.creator.setSeqCount(DEFAULT_SEQUENCE_COUNT);
}
ReturnValue_t buildPacket() {
auto res = checkSizeAndSerializeHeader();
if (res != returnvalue::OK) {
return res;
}
payloadStart[0] = ENABLE;
return calcAndSetCrc();
}
private:
static const uint16_t PAYLOAD_LENGTH = 1; // length without CRC field
static const uint8_t ENABLE = 1;
};
/**
* @brief This class creates the space packet to disable the auto TM generation
*/
class DisableAutoTm : public TcBase {
public:
DisableAutoTm(TcParams params) : TcBase(params) {
spParams.setFullPayloadLen(PAYLOAD_LENGTH + 2);
// spParams.creator.setApid(APID_AUTO_TM);
// spParams.creator.setSeqCount(DEFAULT_SEQUENCE_COUNT);
}
ReturnValue_t buildPacket() {
auto res = checkSizeAndSerializeHeader();
if (res != returnvalue::OK) {
return res;
}
payloadStart[0] = DISABLE;
return calcAndSetCrc();
}
private:
static const uint16_t PAYLOAD_LENGTH = 1; // length without CRC field
static const uint8_t DISABLE = 0;
};
/**
* @brief This class creates the space packet to request the logging data from the supervisor
*/
class RequestLoggingData : public TcBase {
public:
/**
* Subapid
*/
enum class Sa : uint8_t {
REQUEST_COUNTERS = 1, /**< REQUEST_COUNTERS */
REQUEST_EVENT_BUFFERS = 2, /**< REQUEST_EVENT_BUFFERS */
CLEAR_COUNTERS = 3, /**< CLEAR_COUNTERS */
SET_LOGGING_TOPIC = 4 /**< SET_LOGGING_TOPIC */
};
RequestLoggingData(TcParams params) : TcBase(params) {
spParams.setFullPayloadLen(PAYLOAD_LENGTH + 2);
// spParams.creator.setApid(APID_REQUEST_LOGGING_DATA);
// spParams.creator.setSeqCount(DEFAULT_SEQUENCE_COUNT);
}
/**
* @param sa
* @param tpc Topic
* @return
*/
ReturnValue_t buildPacket(Sa sa, uint8_t tpc = 0) {
auto res = checkSizeAndSerializeHeader();
if (res != returnvalue::OK) {
return res;
}
payloadStart[0] = static_cast<uint8_t>(sa);
payloadStart[1] = tpc;
return calcAndSetCrc();
}
private:
static const uint16_t PAYLOAD_LENGTH = 2; // length without CRC field
static const uint8_t TPC_OFFSET = 1;
};
class VerificationReport : public ploc::SpTmReader { class VerificationReport : public ploc::SpTmReader {
public: public:
VerificationReport(const uint8_t* buf, size_t maxSize) : ploc::SpTmReader(buf, maxSize) {} VerificationReport(const uint8_t* buf, size_t maxSize) : ploc::SpTmReader(buf, maxSize) {}
@ -1961,6 +1687,262 @@ class AdcReport : public StaticLocalDataSet<ADC_RPT_SET_ENTRIES> {
sif::info << "AdcReport: ADC eng 15: " << this->adcEng15 << std::endl; sif::info << "AdcReport: ADC eng 15: " << this->adcEng15 << std::endl;
} }
}; };
namespace notimpl {
/**
* @brief This class packages the space packet to perform the factory reset. The op parameter is
* optional.
*
* @details: Without OP: All MRAM entries will be cleared.
* OP = 0x01: Only the mirror entries will be wiped.
* OP = 0x02: Only the circular entries will be wiped.
*/
class FactoryReset : public TcBase {
public:
enum class Op { CLEAR_ALL, MIRROR_ENTRIES, CIRCULAR_ENTRIES };
/**
* @brief Constructor
*
* @param op
*/
FactoryReset(TcParams params) : TcBase(params, Apids::TMTC_MAN, 0x11, 1) {}
ReturnValue_t buildPacket(Op op) {
auto res = checkSizeAndSerializeHeader();
if (res != returnvalue::OK) {
return res;
}
initPacket(op);
return calcAndSetCrc();
}
private:
void initPacket(Op op) {
size_t packetDataLen = 2;
switch (op) {
case Op::MIRROR_ENTRIES:
payloadStart[0] = 1;
packetDataLen = 3;
break;
case Op::CIRCULAR_ENTRIES:
payloadStart[0] = 2;
packetDataLen = 3;
break;
default:
break;
}
spParams.setFullPayloadLen(packetDataLen);
}
};
/**
* @brief This class creates the command to enable or disable the NVMs connected to the
* supervisor.
*/
class EnableNvms : public TcBase {
public:
/**
* @brief Constructor
*
* @param mem The memory to boot from: NVM0 (0), NVM1 (1)
* @param bp0 Partition pin 0
* @param bp1 Partition pin 1
* @param bp2 Partition pin 2
*/
EnableNvms(TcParams params) : TcBase(params, Apids::TMTC_MAN, 0x06, 2) {}
ReturnValue_t buildPacket(uint8_t nvm01, uint8_t nvm3) {
auto res = checkSizeAndSerializeHeader();
if (res != returnvalue::OK) {
return res;
}
initPacket(nvm01, nvm3);
return calcAndSetCrc();
}
private:
void initPacket(uint8_t nvm01, uint8_t nvm3) {
payloadStart[0] = nvm01;
payloadStart[1] = nvm3;
}
};
/**
* @brief This class packages the space packet to wipe or dump parts of the MRAM.
*/
class MramCmd : public TcBase {
public:
enum class MramAction { WIPE, DUMP };
/**
* @brief Constructor
*
* @param start Start address of the MRAM section to wipe or dump
* @param stop End address of the MRAM section to wipe or dump
* @param action Dump or wipe MRAM
*
* @note The content at the stop address is excluded from the dump or wipe operation.
*/
MramCmd(TcParams params) : TcBase(params, Apids::DATA_LOGGER) { setLenFromPayloadLen(6); }
ReturnValue_t buildPacket(uint32_t start, uint32_t stop, MramAction action) {
if (action == MramAction::WIPE) {
setServiceId(static_cast<uint8_t>(DataLoggerServiceIds::WIPE_MRAM));
} else if (action == MramAction::DUMP) {
setServiceId(static_cast<uint8_t>(DataLoggerServiceIds::DUMP_MRAM));
} else {
sif::debug << "WipeMram: Invalid action specified";
}
auto res = checkSizeAndSerializeHeader();
if (res != returnvalue::OK) {
return res;
}
initPacket(start, stop);
return calcAndSetCrc();
}
private:
uint32_t start = 0;
uint32_t stop = 0;
void initPacket(uint32_t start, uint32_t stop) {
uint8_t concatBuffer[6];
concatBuffer[0] = static_cast<uint8_t>(start >> 16);
concatBuffer[1] = static_cast<uint8_t>(start >> 8);
concatBuffer[2] = static_cast<uint8_t>(start);
concatBuffer[3] = static_cast<uint8_t>(stop >> 16);
concatBuffer[4] = static_cast<uint8_t>(stop >> 8);
concatBuffer[5] = static_cast<uint8_t>(stop);
std::memcpy(payloadStart, concatBuffer, sizeof(concatBuffer));
}
};
/**
* @brief This class creates the space packet to enable the auto TM generation
*/
class EnableAutoTm : public TcBase {
public:
EnableAutoTm(TcParams params) : TcBase(params) {
spParams.setFullPayloadLen(PAYLOAD_LENGTH + 2);
// spParams.creator.setApid(APID_AUTO_TM);
// spParams.creator.setSeqCount(DEFAULT_SEQUENCE_COUNT);
}
ReturnValue_t buildPacket() {
auto res = checkSizeAndSerializeHeader();
if (res != returnvalue::OK) {
return res;
}
payloadStart[0] = ENABLE;
return calcAndSetCrc();
}
private:
static const uint16_t PAYLOAD_LENGTH = 1; // length without CRC field
static const uint8_t ENABLE = 1;
};
/**
* @brief This class creates the space packet to disable the auto TM generation
*/
class DisableAutoTm : public TcBase {
public:
DisableAutoTm(TcParams params) : TcBase(params) {
spParams.setFullPayloadLen(PAYLOAD_LENGTH + 2);
// spParams.creator.setApid(APID_AUTO_TM);
// spParams.creator.setSeqCount(DEFAULT_SEQUENCE_COUNT);
}
ReturnValue_t buildPacket() {
auto res = checkSizeAndSerializeHeader();
if (res != returnvalue::OK) {
return res;
}
payloadStart[0] = DISABLE;
return calcAndSetCrc();
}
private:
static const uint16_t PAYLOAD_LENGTH = 1; // length without CRC field
static const uint8_t DISABLE = 0;
};
/**
* @brief This class packages the space packet to enable or disable ADC channels.
*/
class SetAdcEnabledChannels : public TcBase {
public:
/**
* @brief Constructor
*
* @param ch Defines channels to be enabled or disabled.
*/
SetAdcEnabledChannels(TcParams params)
: TcBase(params, Apids::ADC_MON, static_cast<uint8_t>(AdcMonServiceIds::SET_ENABLED_CHANNELS),
2) {}
ReturnValue_t buildPacket(uint16_t ch) {
auto res = checkSizeAndSerializeHeader();
if (res != returnvalue::OK) {
return res;
}
initPacket(ch);
return calcAndSetCrc();
}
private:
void initPacket(uint16_t ch) {
size_t serializedSize = 0;
SerializeAdapter::serialize(&ch, &payloadStart, &serializedSize, sizeof(ch),
SerializeIF::Endianness::BIG);
}
};
/**
* @brief This class creates the space packet to request the logging data from the supervisor
*/
class RequestLoggingData : public TcBase {
public:
/**
* Subapid
*/
enum class Sa : uint8_t {
REQUEST_COUNTERS = 1, /**< REQUEST_COUNTERS */
REQUEST_EVENT_BUFFERS = 2, /**< REQUEST_EVENT_BUFFERS */
CLEAR_COUNTERS = 3, /**< CLEAR_COUNTERS */
SET_LOGGING_TOPIC = 4 /**< SET_LOGGING_TOPIC */
};
RequestLoggingData(TcParams params) : TcBase(params) {
spParams.setFullPayloadLen(PAYLOAD_LENGTH + 2);
// spParams.creator.setApid(APID_REQUEST_LOGGING_DATA);
// spParams.creator.setSeqCount(DEFAULT_SEQUENCE_COUNT);
}
/**
* @param sa
* @param tpc Topic
* @return
*/
ReturnValue_t buildPacket(Sa sa, uint8_t tpc = 0) {
auto res = checkSizeAndSerializeHeader();
if (res != returnvalue::OK) {
return res;
}
payloadStart[0] = static_cast<uint8_t>(sa);
payloadStart[1] = tpc;
return calcAndSetCrc();
}
private:
static const uint16_t PAYLOAD_LENGTH = 2; // length without CRC field
static const uint8_t TPC_OFFSET = 1;
};
} // namespace notimpl
} // namespace supv } // namespace supv
#endif /* MISSION_DEVICES_DEVICEDEFINITIONS_PLOCSVPDEFINITIONS_H_ */ #endif /* MISSION_DEVICES_DEVICEDEFINITIONS_PLOCSVPDEFINITIONS_H_ */

View File

@ -282,21 +282,21 @@ ReturnValue_t PlocSupervisorHandler::buildCommandFromCommand(DeviceCommandId_t d
result = prepareSetAlertLimitCmd(commandData); result = prepareSetAlertLimitCmd(commandData);
break; break;
} }
case SET_ADC_ENABLED_CHANNELS: { // case SET_ADC_ENABLED_CHANNELS: {
prepareSetAdcEnabledChannelsCmd(commandData); // prepareSetAdcEnabledChannelsCmd(commandData);
result = returnvalue::OK; // result = returnvalue::OK;
break; // break;
} // }
case SET_ADC_WINDOW_AND_STRIDE: { // case SET_ADC_WINDOW_AND_STRIDE: {
prepareSetAdcWindowAndStrideCmd(commandData); // prepareSetAdcWindowAndStrideCmd(commandData);
result = returnvalue::OK; // result = returnvalue::OK;
break; // break;
} // }
case SET_ADC_THRESHOLD: { // case SET_ADC_THRESHOLD: {
prepareSetAdcThresholdCmd(commandData); // prepareSetAdcThresholdCmd(commandData);
result = returnvalue::OK; // result = returnvalue::OK;
break; // break;
} // }
case GET_LATCHUP_STATUS_REPORT: { case GET_LATCHUP_STATUS_REPORT: {
prepareEmptyCmd(Apids::LATCHUP_MON, prepareEmptyCmd(Apids::LATCHUP_MON,
static_cast<uint8_t>(LatchupMonServiceIds::GET_STATUS_REPORT)); static_cast<uint8_t>(LatchupMonServiceIds::GET_STATUS_REPORT));
@ -384,55 +384,55 @@ ReturnValue_t PlocSupervisorHandler::buildCommandFromCommand(DeviceCommandId_t d
result = returnvalue::OK; result = returnvalue::OK;
break; break;
} }
case ENABLE_AUTO_TM: { // case ENABLE_AUTO_TM: {
EnableAutoTm packet(spParams); // EnableAutoTm packet(spParams);
result = packet.buildPacket(); // result = packet.buildPacket();
if (result != returnvalue::OK) { // if (result != returnvalue::OK) {
break; // break;
} // }
finishTcPrep(packet.getFullPacketLen()); // finishTcPrep(packet.getFullPacketLen());
break; // break;
} // }
case DISABLE_AUTO_TM: { // case DISABLE_AUTO_TM: {
DisableAutoTm packet(spParams); // DisableAutoTm packet(spParams);
result = packet.buildPacket(); // result = packet.buildPacket();
if (result != returnvalue::OK) { // if (result != returnvalue::OK) {
break; // break;
} // }
finishTcPrep(packet.getFullPacketLen()); // finishTcPrep(packet.getFullPacketLen());
break; // break;
} // }
case LOGGING_REQUEST_COUNTERS: { // case LOGGING_REQUEST_COUNTERS: {
RequestLoggingData packet(spParams); // RequestLoggingData packet(spParams);
result = packet.buildPacket(RequestLoggingData::Sa::REQUEST_COUNTERS); // result = packet.buildPacket(RequestLoggingData::Sa::REQUEST_COUNTERS);
if (result != returnvalue::OK) { // if (result != returnvalue::OK) {
break; // break;
} // }
finishTcPrep(packet.getFullPacketLen()); // finishTcPrep(packet.getFullPacketLen());
break; // break;
} // }
case LOGGING_CLEAR_COUNTERS: { // case LOGGING_CLEAR_COUNTERS: {
RequestLoggingData packet(spParams); // RequestLoggingData packet(spParams);
result = packet.buildPacket(RequestLoggingData::Sa::CLEAR_COUNTERS); // result = packet.buildPacket(RequestLoggingData::Sa::CLEAR_COUNTERS);
if (result != returnvalue::OK) { // if (result != returnvalue::OK) {
break; // break;
} // }
finishTcPrep(packet.getFullPacketLen()); // finishTcPrep(packet.getFullPacketLen());
break; // break;
} // }
case LOGGING_SET_TOPIC: { // case LOGGING_SET_TOPIC: {
if (commandData == nullptr or commandDataLen == 0) { // if (commandData == nullptr or commandDataLen == 0) {
return HasActionsIF::INVALID_PARAMETERS; // return HasActionsIF::INVALID_PARAMETERS;
} // }
uint8_t tpc = *(commandData); // uint8_t tpc = *(commandData);
RequestLoggingData packet(spParams); // RequestLoggingData packet(spParams);
result = packet.buildPacket(RequestLoggingData::Sa::SET_LOGGING_TOPIC, tpc); // result = packet.buildPacket(RequestLoggingData::Sa::SET_LOGGING_TOPIC, tpc);
if (result != returnvalue::OK) { // if (result != returnvalue::OK) {
break; // break;
} // }
finishTcPrep(packet.getFullPacketLen()); // finishTcPrep(packet.getFullPacketLen());
break; // break;
} // }
case RESET_PL: { case RESET_PL: {
prepareEmptyCmd(Apids::BOOT_MAN, static_cast<uint8_t>(BootManServiceIds::RESET_PL)); prepareEmptyCmd(Apids::BOOT_MAN, static_cast<uint8_t>(BootManServiceIds::RESET_PL));
result = returnvalue::OK; result = returnvalue::OK;
@ -744,10 +744,10 @@ ReturnValue_t PlocSupervisorHandler::interpretDeviceReply(DeviceCommandId_t id,
result = handleLatchupStatusReport(packet); result = handleLatchupStatusReport(packet);
break; break;
} }
case (LOGGING_REPORT): { // case (LOGGING_REPORT): {
result = handleLoggingReport(packet); // result = handleLoggingReport(packet);
break; // break;
} // }
case (ADC_REPORT): { case (ADC_REPORT): {
result = handleAdcReport(packet); result = handleAdcReport(packet);
break; break;
@ -1248,41 +1248,41 @@ ReturnValue_t PlocSupervisorHandler::handleLatchupStatusReport(const uint8_t* da
return result; return result;
} }
ReturnValue_t PlocSupervisorHandler::handleLoggingReport(const uint8_t* data) { // ReturnValue_t PlocSupervisorHandler::handleLoggingReport(const uint8_t* data) {
ReturnValue_t result = returnvalue::OK; // ReturnValue_t result = returnvalue::OK;
//
result = verifyPacket(data, supv::SIZE_LOGGING_REPORT); // result = verifyPacket(data, supv::SIZE_LOGGING_REPORT);
//
if (result == SupvReturnValuesIF::CRC_FAILURE) { // if (result == SupvReturnValuesIF::CRC_FAILURE) {
sif::warning << "PlocSupervisorHandler::handleLoggingReport: Logging report has " // sif::warning << "PlocSupervisorHandler::handleLoggingReport: Logging report has "
<< "invalid crc" << std::endl; // << "invalid crc" << std::endl;
return result; // return result;
} // }
//
const uint8_t* dataField = data + supv::PAYLOAD_OFFSET + sizeof(supv::RequestLoggingData::Sa); // const uint8_t* dataField = data + supv::PAYLOAD_OFFSET + sizeof(supv::RequestLoggingData::Sa);
result = loggingReport.read(); // result = loggingReport.read();
if (result != returnvalue::OK) { // if (result != returnvalue::OK) {
return result; // return result;
} // }
loggingReport.setValidityBufferGeneration(false); // loggingReport.setValidityBufferGeneration(false);
size_t size = loggingReport.getSerializedSize(); // size_t size = loggingReport.getSerializedSize();
result = loggingReport.deSerialize(&dataField, &size, SerializeIF::Endianness::BIG); // result = loggingReport.deSerialize(&dataField, &size, SerializeIF::Endianness::BIG);
if (result != returnvalue::OK) { // if (result != returnvalue::OK) {
sif::warning << "PlocSupervisorHandler::handleLoggingReport: Deserialization failed" // sif::warning << "PlocSupervisorHandler::handleLoggingReport: Deserialization failed"
<< std::endl; // << std::endl;
} // }
loggingReport.setValidityBufferGeneration(true); // loggingReport.setValidityBufferGeneration(true);
loggingReport.setValidity(true, true); // loggingReport.setValidity(true, true);
result = loggingReport.commit(); // result = loggingReport.commit();
if (result != returnvalue::OK) { // if (result != returnvalue::OK) {
return result; // return result;
} // }
#if OBSW_VERBOSE_LEVEL >= 1 && OBSW_DEBUG_PLOC_SUPERVISOR == 1 //#if OBSW_VERBOSE_LEVEL >= 1 && OBSW_DEBUG_PLOC_SUPERVISOR == 1
loggingReport.printSet(); // loggingReport.printSet();
#endif //#endif
nextReplyId = supv::EXE_REPORT; // nextReplyId = supv::EXE_REPORT;
return result; // return result;
} // }
ReturnValue_t PlocSupervisorHandler::handleAdcReport(const uint8_t* data) { ReturnValue_t PlocSupervisorHandler::handleAdcReport(const uint8_t* data) {
ReturnValue_t result = returnvalue::OK; ReturnValue_t result = returnvalue::OK;
@ -1543,16 +1543,17 @@ ReturnValue_t PlocSupervisorHandler::prepareSetAlertLimitCmd(const uint8_t* comm
return returnvalue::OK; return returnvalue::OK;
} }
ReturnValue_t PlocSupervisorHandler::prepareSetAdcEnabledChannelsCmd(const uint8_t* commandData) { // ReturnValue_t PlocSupervisorHandler::prepareSetAdcEnabledChannelsCmd(const uint8_t* commandData)
uint16_t ch = *(commandData) << 8 | *(commandData + 1); // {
supv::SetAdcEnabledChannels packet(spParams); // uint16_t ch = *(commandData) << 8 | *(commandData + 1);
ReturnValue_t result = packet.buildPacket(ch); // supv::SetAdcEnabledChannels packet(spParams);
if (result != returnvalue::OK) { // ReturnValue_t result = packet.buildPacket(ch);
return result; // if (result != returnvalue::OK) {
} // return result;
finishTcPrep(packet.getFullPacketLen()); // }
return returnvalue::OK; // finishTcPrep(packet.getFullPacketLen());
} // return returnvalue::OK;
// }
ReturnValue_t PlocSupervisorHandler::prepareSetAdcWindowAndStrideCmd(const uint8_t* commandData) { ReturnValue_t PlocSupervisorHandler::prepareSetAdcWindowAndStrideCmd(const uint8_t* commandData) {
uint8_t offset = 0; uint8_t offset = 0;
@ -1687,19 +1688,19 @@ ReturnValue_t PlocSupervisorHandler::prepareSetShutdownTimeoutCmd(const uint8_t*
return returnvalue::OK; return returnvalue::OK;
} }
ReturnValue_t PlocSupervisorHandler::prepareLoggingRequest(const uint8_t* commandData, // ReturnValue_t PlocSupervisorHandler::prepareLoggingRequest(const uint8_t* commandData,
size_t commandDataLen) { // size_t commandDataLen) {
using namespace supv; // using namespace supv;
RequestLoggingData::Sa sa = static_cast<RequestLoggingData::Sa>(*commandData); // RequestLoggingData::Sa sa = static_cast<RequestLoggingData::Sa>(*commandData);
uint8_t tpc = *(commandData + 1); // uint8_t tpc = *(commandData + 1);
RequestLoggingData packet(spParams); // RequestLoggingData packet(spParams);
ReturnValue_t result = packet.buildPacket(sa, tpc); // ReturnValue_t result = packet.buildPacket(sa, tpc);
if (result != returnvalue::OK) { // if (result != returnvalue::OK) {
return result; // return result;
} // }
finishTcPrep(packet.getFullPacketLen()); // finishTcPrep(packet.getFullPacketLen());
return returnvalue::OK; // return returnvalue::OK;
} // }
// ReturnValue_t PlocSupervisorHandler::prepareEnableNvmsCommand(const uint8_t* commandData) { // ReturnValue_t PlocSupervisorHandler::prepareEnableNvmsCommand(const uint8_t* commandData) {
// using namespace supv; // using namespace supv;

View File

@ -211,7 +211,7 @@ class PlocSupervisorHandler : public DeviceHandlerBase {
ReturnValue_t handleBootStatusReport(const uint8_t* data); ReturnValue_t handleBootStatusReport(const uint8_t* data);
ReturnValue_t handleLatchupStatusReport(const uint8_t* data); ReturnValue_t handleLatchupStatusReport(const uint8_t* data);
ReturnValue_t handleLoggingReport(const uint8_t* data); // ReturnValue_t handleLoggingReport(const uint8_t* data);
ReturnValue_t handleAdcReport(const uint8_t* data); ReturnValue_t handleAdcReport(const uint8_t* data);
/** /**
@ -274,7 +274,7 @@ class PlocSupervisorHandler : public DeviceHandlerBase {
ReturnValue_t prepareLatchupConfigCmd(const uint8_t* commandData, ReturnValue_t prepareLatchupConfigCmd(const uint8_t* commandData,
DeviceCommandId_t deviceCommand); DeviceCommandId_t deviceCommand);
ReturnValue_t prepareSetAlertLimitCmd(const uint8_t* commandData); ReturnValue_t prepareSetAlertLimitCmd(const uint8_t* commandData);
ReturnValue_t prepareSetAdcEnabledChannelsCmd(const uint8_t* commandData); // ReturnValue_t prepareSetAdcEnabledChannelsCmd(const uint8_t* commandData);
ReturnValue_t prepareSetAdcWindowAndStrideCmd(const uint8_t* commandData); ReturnValue_t prepareSetAdcWindowAndStrideCmd(const uint8_t* commandData);
ReturnValue_t prepareSetAdcThresholdCmd(const uint8_t* commandData); ReturnValue_t prepareSetAdcThresholdCmd(const uint8_t* commandData);
ReturnValue_t prepareRunAutoEmTest(const uint8_t* commandData); ReturnValue_t prepareRunAutoEmTest(const uint8_t* commandData);
@ -282,8 +282,8 @@ class PlocSupervisorHandler : public DeviceHandlerBase {
// ReturnValue_t prepareDumpMramCmd(const uint8_t* commandData); // ReturnValue_t prepareDumpMramCmd(const uint8_t* commandData);
ReturnValue_t prepareSetGpioCmd(const uint8_t* commandData); ReturnValue_t prepareSetGpioCmd(const uint8_t* commandData);
ReturnValue_t prepareReadGpioCmd(const uint8_t* commandData); ReturnValue_t prepareReadGpioCmd(const uint8_t* commandData);
ReturnValue_t prepareLoggingRequest(const uint8_t* commandData, size_t commandDataLen); // ReturnValue_t prepareLoggingRequest(const uint8_t* commandData, size_t commandDataLen);
// ReturnValue_t prepareEnableNvmsCommand(const uint8_t* commandData); // ReturnValue_t prepareEnableNvmsCommand(const uint8_t* commandData);
/** /**
* @brief Copies the content of a space packet to the command buffer. * @brief Copies the content of a space packet to the command buffer.

View File

@ -428,45 +428,46 @@ uint32_t PlocSupvHelper::buildProgParams1(uint8_t percent, uint16_t seqCount) {
return (static_cast<uint32_t>(percent) << 24) | static_cast<uint32_t>(seqCount); return (static_cast<uint32_t>(percent) << 24) | static_cast<uint32_t>(seqCount);
} }
ReturnValue_t PlocSupvHelper::performEventBufferRequest() { // ReturnValue_t PlocSupvHelper::performEventBufferRequest() {
using namespace supv; // using namespace supv;
ReturnValue_t result = returnvalue::OK; // ReturnValue_t result = returnvalue::OK;
resetSpParams(); // resetSpParams();
RequestLoggingData packet(spParams); // RequestLoggingData packet(spParams);
result = packet.buildPacket(RequestLoggingData::Sa::REQUEST_EVENT_BUFFERS); // result = packet.buildPacket(RequestLoggingData::Sa::REQUEST_EVENT_BUFFERS);
if (result != returnvalue::OK) { // if (result != returnvalue::OK) {
return result; // return result;
} // }
result = sendCommand(packet); // result = sendCommand(packet);
if (result != returnvalue::OK) { // if (result != returnvalue::OK) {
return result; // return result;
} // }
result = handleAck(); // result = handleAck();
if (result != returnvalue::OK) { // if (result != returnvalue::OK) {
return result; // return result;
} // }
result = // result =
handleTmReception(ccsds::HEADER_LEN, tmBuf.data(), supv::recv_timeout::UPDATE_STATUS_REPORT); // handleTmReception(ccsds::HEADER_LEN, tmBuf.data(),
if (result != returnvalue::OK) { // supv::recv_timeout::UPDATE_STATUS_REPORT);
return result; // if (result != returnvalue::OK) {
} // return result;
ploc::SpTmReader spReader(tmBuf.data(), tmBuf.size()); // }
bool exeAlreadyReceived = false; // ploc::SpTmReader spReader(tmBuf.data(), tmBuf.size());
if (spReader.getApid() == supv::APID_EXE_FAILURE) { // bool exeAlreadyReceived = false;
exeAlreadyReceived = true; // if (spReader.getApid() == supv::APID_EXE_FAILURE) {
result = handleRemainingExeReport(spReader); // exeAlreadyReceived = true;
} else if (spReader.getApid() == supv::APID_MRAM_DUMP_TM) { // result = handleRemainingExeReport(spReader);
result = handleEventBufferReception(spReader); // } else if (spReader.getApid() == supv::APID_MRAM_DUMP_TM) {
} // result = handleEventBufferReception(spReader);
// }
if (not exeAlreadyReceived) { //
result = handleExe(); // if (not exeAlreadyReceived) {
if (result != returnvalue::OK) { // result = handleExe();
return result; // if (result != returnvalue::OK) {
} // return result;
} // }
return result; // }
} // return result;
// }
ReturnValue_t PlocSupvHelper::handleRemainingExeReport(ploc::SpTmReader& reader) { ReturnValue_t PlocSupvHelper::handleRemainingExeReport(ploc::SpTmReader& reader) {
size_t remBytes = reader.getPacketDataLen() + 1; size_t remBytes = reader.getPacketDataLen() + 1;
@ -916,15 +917,15 @@ ReturnValue_t PlocSupvHelper::handleRunningLongerRequest() {
break; break;
} }
case Request::REQUEST_EVENT_BUFFER: { case Request::REQUEST_EVENT_BUFFER: {
result = performEventBufferRequest(); // result = performEventBufferRequest();
if (result == returnvalue::OK) { // if (result == returnvalue::OK) {
triggerEvent(SUPV_EVENT_BUFFER_REQUEST_SUCCESSFUL, result); // triggerEvent(SUPV_EVENT_BUFFER_REQUEST_SUCCESSFUL, result);
} else if (result == PROCESS_TERMINATED) { // } else if (result == PROCESS_TERMINATED) {
// Event already triggered // // Event already triggered
break; // break;
} else { // } else {
triggerEvent(SUPV_EVENT_BUFFER_REQUEST_FAILED, result); // triggerEvent(SUPV_EVENT_BUFFER_REQUEST_FAILED, result);
} // }
break; break;
} }
case Request::DEFAULT: { case Request::DEFAULT: {

View File

@ -268,7 +268,7 @@ class PlocSupvHelper : public DeviceCommunicationIF,
ReturnValue_t continueUpdate(); ReturnValue_t continueUpdate();
ReturnValue_t updateOperation(); ReturnValue_t updateOperation();
ReturnValue_t writeUpdatePackets(); ReturnValue_t writeUpdatePackets();
ReturnValue_t performEventBufferRequest(); // ReturnValue_t performEventBufferRequest();
ReturnValue_t handlePacketTransmission(ploc::SpTcBase& packet, ReturnValue_t handlePacketTransmission(ploc::SpTcBase& packet,
uint32_t timeoutExecutionReport = 60000); uint32_t timeoutExecutionReport = 60000);
ReturnValue_t sendCommand(ploc::SpTcBase& packet); ReturnValue_t sendCommand(ploc::SpTcBase& packet);