comment out more code which was removed
All checks were successful
EIVE/eive-obsw/pipeline/pr-develop This commit looks good

This commit is contained in:
Robin Müller 2022-11-08 10:10:57 +01:00
parent 8dbb3dcd9b
commit 3b575acd55
No known key found for this signature in database
GPG Key ID: 71B58F8A3CDFA9AC
5 changed files with 437 additions and 453 deletions

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.
*/
@ -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
* 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; }
};
/**
* @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
* 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 {
public:
SetShutdownTimeout(TcParams params)
@ -1068,10 +891,7 @@ class CheckMemory : public TcBase {
}
private:
uint8_t memoryId = 0;
uint8_t n = 1;
uint32_t startAddress = 0;
uint32_t length = 0;
void initPacket(uint8_t memoryId, uint32_t startAddress, uint32_t length) {
uint8_t* data = payloadStart;
@ -1177,10 +997,7 @@ class EraseMemory : public TcBase {
private:
static const uint16_t PAYLOAD_LENGTH = 10; // length without CRC field
uint8_t memoryId = 0;
uint8_t n = 1;
uint32_t startAddress = 0;
uint32_t length = 0;
void initPacket(uint8_t memoryId, uint32_t startAddress, uint32_t length) {
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 {
public:
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;
}
};
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
#endif /* MISSION_DEVICES_DEVICEDEFINITIONS_PLOCSVPDEFINITIONS_H_ */

View File

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

View File

@ -211,7 +211,7 @@ class PlocSupervisorHandler : public DeviceHandlerBase {
ReturnValue_t handleBootStatusReport(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);
/**
@ -274,7 +274,7 @@ class PlocSupervisorHandler : public DeviceHandlerBase {
ReturnValue_t prepareLatchupConfigCmd(const uint8_t* commandData,
DeviceCommandId_t deviceCommand);
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 prepareSetAdcThresholdCmd(const uint8_t* commandData);
ReturnValue_t prepareRunAutoEmTest(const uint8_t* commandData);
@ -282,7 +282,7 @@ class PlocSupervisorHandler : public DeviceHandlerBase {
// ReturnValue_t prepareDumpMramCmd(const uint8_t* commandData);
ReturnValue_t prepareSetGpioCmd(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);
/**

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

View File

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