PLOC SUPV debug mode #815

Merged
muellerr merged 4 commits from ploc-supv-debug-mode into main 2023-10-30 14:57:35 +01:00
3 changed files with 8 additions and 243 deletions
Showing only changes of commit 534ddde9e8 - Show all commits

View File

@ -223,6 +223,7 @@ ReturnValue_t PlocSupervisorHandler::buildCommandFromCommand(DeviceCommandId_t d
break; break;
} }
case RESET_MPSOC: { case RESET_MPSOC: {
sif::info << "PLOC SUPV: Resetting MPSoC" << std::endl;
prepareEmptyCmd(Apid::BOOT_MAN, static_cast<uint8_t>(tc::BootManId::RESET_MPSOC)); prepareEmptyCmd(Apid::BOOT_MAN, static_cast<uint8_t>(tc::BootManId::RESET_MPSOC));
result = returnvalue::OK; result = returnvalue::OK;
break; break;
@ -320,85 +321,6 @@ ReturnValue_t PlocSupervisorHandler::buildCommandFromCommand(DeviceCommandId_t d
result = prepareWipeMramCmd(commandData); result = prepareWipeMramCmd(commandData);
break; break;
} }
// case ENABLE_NVMS: {
// result = prepareEnableNvmsCommand(commandData);
// break;
// }
// case RESTART_SUPERVISOR: {
// prepareEmptyCmd(APID_RESTART_SUPERVISOR);
// result = returnvalue::OK;
// break;
// }
// Removed command
// case START_MPSOC_QUIET: {
// prepareEmptyCmd(APID_START_MPSOC_QUIET);
// 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;
// }
// 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 FIRST_MRAM_DUMP:
// case CONSECUTIVE_MRAM_DUMP:
// result = prepareDumpMramCmd(commandData);
// break;
default: default:
sif::debug << "PlocSupervisorHandler::buildCommandFromCommand: Command not implemented" sif::debug << "PlocSupervisorHandler::buildCommandFromCommand: Command not implemented"
<< std::endl; << std::endl;
@ -550,23 +472,17 @@ ReturnValue_t PlocSupervisorHandler::enableReplyInReplyMap(DeviceCommandMap::ite
case SET_ADC_ENABLED_CHANNELS: case SET_ADC_ENABLED_CHANNELS:
case SET_ADC_WINDOW_AND_STRIDE: case SET_ADC_WINDOW_AND_STRIDE:
case SET_ADC_THRESHOLD: case SET_ADC_THRESHOLD:
// case COPY_ADC_DATA_TO_MRAM:
case RUN_AUTO_EM_TESTS: case RUN_AUTO_EM_TESTS:
case WIPE_MRAM: case WIPE_MRAM:
case SET_GPIO: case SET_GPIO:
case FACTORY_RESET: case FACTORY_RESET:
case READ_GPIO: case READ_GPIO:
// case RESTART_SUPERVISOR:
case DISABLE_PERIOIC_HK_TRANSMISSION: case DISABLE_PERIOIC_HK_TRANSMISSION:
// case START_MPSOC_QUIET:
case SET_SHUTDOWN_TIMEOUT: case SET_SHUTDOWN_TIMEOUT:
case FACTORY_FLASH: case FACTORY_FLASH:
case ENABLE_AUTO_TM: case ENABLE_AUTO_TM:
case DISABLE_AUTO_TM: case DISABLE_AUTO_TM:
// case LOGGING_CLEAR_COUNTERS:
// case LOGGING_SET_TOPIC:
case RESET_PL: case RESET_PL:
// case ENABLE_NVMS:
enabledReplies = 2; enabledReplies = 2;
break; break;
default: default:
@ -598,19 +514,14 @@ ReturnValue_t PlocSupervisorHandler::enableReplyInReplyMap(DeviceCommandMap::ite
ReturnValue_t PlocSupervisorHandler::scanForReply(const uint8_t* start, size_t remainingSize, ReturnValue_t PlocSupervisorHandler::scanForReply(const uint8_t* start, size_t remainingSize,
DeviceCommandId_t* foundId, size_t* foundLen) { DeviceCommandId_t* foundId, size_t* foundLen) {
using namespace supv; using namespace supv;
// TODO: Is this still required?
// if (nextReplyId == FIRST_MRAM_DUMP) {
// *foundId = FIRST_MRAM_DUMP;
// return parseMramPackets(start, remainingSize, foundLen);
// } else if (nextReplyId == CONSECUTIVE_MRAM_DUMP) {
// *foundId = CONSECUTIVE_MRAM_DUMP;
// return parseMramPackets(start, remainingSize, foundLen);
// }
tmReader.setData(start, remainingSize); tmReader.setData(start, remainingSize);
// sif::debug << "PlocSupervisorHandler::scanForReply: Received Packet" << std::endl;
// arrayprinter::print(start, remainingSize);
uint16_t apid = tmReader.getModuleApid(); uint16_t apid = tmReader.getModuleApid();
if(DEBUG_PLOC_SUPV) {
sif::debug << "PlocSupervisorHandler: RECV PACKET Size " << tmReader.getFullPacketLen() << " APID " << tmReader.getApid()
<< " Module APID: " << tmReader.getModuleApid() << std::endl;
arrayprinter::print(start, remainingSize);
}
switch (apid) { switch (apid) {
case (Apid::TMTC_MAN): { case (Apid::TMTC_MAN): {
@ -2006,134 +1917,3 @@ ReturnValue_t PlocSupervisorHandler::checkModeCommand(Mode_t commandedMode,
} }
return DeviceHandlerBase::checkModeCommand(commandedMode, commandedSubmode, msToReachTheMode); return DeviceHandlerBase::checkModeCommand(commandedMode, commandedSubmode, msToReachTheMode);
} }
// ReturnValue_t PlocSupervisorHandler::checkMramPacketApid() {
// uint16_t apid = (spacePacketBuffer[0] << 8 | spacePacketBuffer[1]) & supv::APID_MASK;
// TODO: Fix
// if (apid != supv::APID_MRAM_DUMP_TM) {
// return result::NO_MRAM_PACKET;
// }
// return APERIODIC_REPLY;
//}
// ReturnValue_t PlocSupervisorHandler::parseMramPackets(const uint8_t* packet, size_t
// remainingSize,
// size_t* foundLen) {
// ReturnValue_t result = IGNORE_FULL_PACKET;
// uint16_t packetLen = 0;
// *foundLen = 0;
//
// for (size_t idx = 0; idx < remainingSize; idx++) {
// std::memcpy(spacePacketBuffer + bufferTop, packet + idx, 1);
// bufferTop += 1;
// *foundLen += 1;
// if (bufferTop >= ccsds::HEADER_LEN) {
// packetLen = readSpacePacketLength(spacePacketBuffer);
// }
//
// if (bufferTop == ccsds::HEADER_LEN + packetLen + 1) {
// packetInBuffer = true;
// bufferTop = 0;
// return checkMramPacketApid();
// }
//
// if (bufferTop == supv::MAX_PACKET_SIZE) {
// *foundLen = remainingSize;
// disableAllReplies();
// bufferTop = 0;
// sif::info << "PlocSupervisorHandler::parseMramPackets: Can not find MRAM packet in space "
// "packet buffer"
// << std::endl;
// return result::MRAM_PACKET_PARSING_FAILURE;
// }
// }
//
// return result;
// }
// ReturnValue_t PlocSupervisorHandler::prepareDumpMramCmd(const uint8_t* commandData) {
// uint32_t start = 0;
// uint32_t stop = 0;
// size_t size = sizeof(start) + sizeof(stop);
// SerializeAdapter::deSerialize(&start, &commandData, &size, SerializeIF::Endianness::BIG);
// SerializeAdapter::deSerialize(&stop, &commandData, &size, SerializeIF::Endianness::BIG);
// if ((stop - start) <= 0) {
// return SupvReturnValuesIF::INVALID_MRAM_ADDRESSES;
// }
// supv::MramCmd packet(spParams);
// ReturnValue_t result = packet.buildPacket(start, stop, supv::MramCmd::MramAction::DUMP);
// if (result != returnvalue::OK) {
// return result;
// }
// expectedMramDumpPackets = (stop - start) / supv::MAX_DATA_CAPACITY;
// if ((stop - start) % supv::MAX_DATA_CAPACITY) {
// expectedMramDumpPackets++;
// }
// receivedMramDumpPackets = 0;
//
// 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;
// uint8_t nvm01 = *(commandData);
// uint8_t nvm3 = *(commandData + 1);
// EnableNvms packet(spParams);
// ReturnValue_t result = packet.buildPacket(nvm01, nvm3);
// if (result != returnvalue::OK) {
// return result;
// }
// finishTcPrep(packet.getFullPacketLen());
// return returnvalue::OK;
// }
// 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;
// }

View File

@ -19,6 +19,7 @@
using supv::ExecutionReport; using supv::ExecutionReport;
static constexpr bool DEBUG_PLOC_SUPV = false;
/** /**
* @brief This is the device handler for the supervisor of the PLOC which is programmed by * @brief This is the device handler for the supervisor of the PLOC which is programmed by
* Thales. * Thales.
@ -227,7 +228,6 @@ class PlocSupervisorHandler : public DeviceHandlerBase {
ReturnValue_t handleLatchupStatusReport(const uint8_t* data); ReturnValue_t handleLatchupStatusReport(const uint8_t* data);
void handleBadApidServiceCombination(Event result, unsigned int apid, unsigned int serviceId); void handleBadApidServiceCombination(Event result, unsigned int apid, unsigned int serviceId);
// ReturnValue_t handleLoggingReport(const uint8_t* data);
ReturnValue_t handleAdcReport(const uint8_t* data); ReturnValue_t handleAdcReport(const uint8_t* data);
/** /**
@ -297,11 +297,8 @@ class PlocSupervisorHandler : public DeviceHandlerBase {
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);
ReturnValue_t prepareWipeMramCmd(const uint8_t* commandData); ReturnValue_t prepareWipeMramCmd(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 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.
@ -332,12 +329,6 @@ class PlocSupervisorHandler : public DeviceHandlerBase {
*/ */
void disableExeReportReply(); void disableExeReportReply();
/**
* @brief Function is called in scanForReply and fills the spacePacketBuffer with the read
* data until a full packet has been received.
*/
// ReturnValue_t parseMramPackets(const uint8_t* packet, size_t remainingSize, size_t* foundlen);
/** /**
* @brief This function generates the Service 8 packets for the MRAM dump data. * @brief This function generates the Service 8 packets for the MRAM dump data.
*/ */
@ -350,12 +341,6 @@ class PlocSupervisorHandler : public DeviceHandlerBase {
*/ */
void increaseExpectedMramReplies(DeviceCommandId_t id); void increaseExpectedMramReplies(DeviceCommandId_t id);
/**
* @brief Function checks if the packet written to the space packet buffer is really a
* MRAM dump packet.
*/
// ReturnValue_t checkMramPacketApid();
/** /**
* @brief Writes the data of the MRAM dump to a file. The file will be created when receiving * @brief Writes the data of the MRAM dump to a file. The file will be created when receiving
* the first packet. * the first packet.

2
tmtc

@ -1 +1 @@
Subproject commit 60f7ae5453b387ee5ebcf6a338c34284004dbce7 Subproject commit 84f50bab83db2c783c54dcf63263fdf175445521