v1.17.0 #327

Merged
muellerr merged 131 commits from develop into main 2022-11-28 18:29:31 +01:00
Showing only changes of commit e2a0db8fcc - Show all commits

View File

@ -262,49 +262,15 @@ ReturnValue_t PlocSupervisorHandler::buildCommandFromCommand(DeviceCommandId_t d
result = prepareSetAlertLimitCmd(commandData); result = prepareSetAlertLimitCmd(commandData);
break; 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: { case GET_LATCHUP_STATUS_REPORT: {
prepareEmptyCmd(Apid::LATCHUP_MON, static_cast<uint8_t>(tc::LatchupMonId::GET_STATUS_REPORT)); prepareEmptyCmd(Apid::LATCHUP_MON, static_cast<uint8_t>(tc::LatchupMonId::GET_STATUS_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;
} }
// case WIPE_MRAM: {
// result = prepareWipeMramCmd(commandData);
// break;
// }
// case FIRST_MRAM_DUMP:
// case CONSECUTIVE_MRAM_DUMP:
// result = prepareDumpMramCmd(commandData);
// break;
case SET_GPIO: { case SET_GPIO: {
prepareSetGpioCmd(commandData); prepareSetGpioCmd(commandData);
result = returnvalue::OK; result = returnvalue::OK;
@ -319,6 +285,25 @@ ReturnValue_t PlocSupervisorHandler::buildCommandFromCommand(DeviceCommandId_t d
result = returnvalue::OK; result = returnvalue::OK;
break; break;
} }
case SET_SHUTDOWN_TIMEOUT: {
prepareSetShutdownTimeoutCmd(commandData);
result = returnvalue::OK;
break;
}
case FACTORY_FLASH: {
prepareEmptyCmd(Apid::BOOT_MAN, static_cast<uint8_t>(tc::BootManId::FACTORY_FLASH));
result = returnvalue::OK;
break;
}
case RESET_PL: {
prepareEmptyCmd(Apid::BOOT_MAN, static_cast<uint8_t>(tc::BootManId::RESET_PL));
result = returnvalue::OK;
break;
}
// case ENABLE_NVMS: {
// result = prepareEnableNvmsCommand(commandData);
// break;
// }
// case RESTART_SUPERVISOR: { // case RESTART_SUPERVISOR: {
// prepareEmptyCmd(APID_RESTART_SUPERVISOR); // prepareEmptyCmd(APID_RESTART_SUPERVISOR);
// result = returnvalue::OK; // result = returnvalue::OK;
@ -357,16 +342,22 @@ ReturnValue_t PlocSupervisorHandler::buildCommandFromCommand(DeviceCommandId_t d
// result = returnvalue::OK; // result = returnvalue::OK;
// break; // break;
// } // }
case SET_SHUTDOWN_TIMEOUT: { // case SET_ADC_ENABLED_CHANNELS: {
prepareSetShutdownTimeoutCmd(commandData);
result = returnvalue::OK; // prepareSetAdcEnabledChannelsCmd(commandData);
break; // result = returnvalue::OK;
} // break;
case FACTORY_FLASH: { // }
prepareEmptyCmd(Apid::BOOT_MAN, static_cast<uint8_t>(tc::BootManId::FACTORY_FLASH)); // case SET_ADC_WINDOW_AND_STRIDE: {
result = returnvalue::OK; // prepareSetAdcWindowAndStrideCmd(commandData);
break; // result = returnvalue::OK;
} // break;
// }
// case SET_ADC_THRESHOLD: {
// prepareSetAdcThresholdCmd(commandData);
// result = returnvalue::OK;
// break;
// }
// case ENABLE_AUTO_TM: { // case ENABLE_AUTO_TM: {
// EnableAutoTm packet(spParams); // EnableAutoTm packet(spParams);
// result = packet.buildPacket(); // result = packet.buildPacket();
@ -416,15 +407,25 @@ ReturnValue_t PlocSupervisorHandler::buildCommandFromCommand(DeviceCommandId_t d
// finishTcPrep(packet.getFullPacketLen()); // finishTcPrep(packet.getFullPacketLen());
// break; // break;
// } // }
case RESET_PL: { // I think this is disabled right now according to the TC excel table
prepareEmptyCmd(Apid::BOOT_MAN, static_cast<uint8_t>(tc::BootManId::RESET_PL)); // case COPY_ADC_DATA_TO_MRAM: {
result = returnvalue::OK; // prepareEmptyCmd(APID_COPY_ADC_DATA_TO_MRAM);
break; // result = returnvalue::OK;
}
// case ENABLE_NVMS: {
// result = prepareEnableNvmsCommand(commandData);
// break; // break;
// } // }
// case REQUEST_ADC_REPORT: {
// prepareEmptyCmd(APID_REQUEST_ADC_REPORT);
// result = returnvalue::OK;
// break;
// }
// case WIPE_MRAM: {
// result = prepareWipeMramCmd(commandData);
// 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;
@ -1503,48 +1504,6 @@ ReturnValue_t PlocSupervisorHandler::prepareRunAutoEmTest(const uint8_t* command
return returnvalue::OK; return returnvalue::OK;
} }
// ReturnValue_t PlocSupervisorHandler::prepareWipeMramCmd(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::WIPE);
// if (result != returnvalue::OK) {
// return result;
// }
// finishTcPrep(packet.getFullPacketLen());
// return returnvalue::OK;
// }
// 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::prepareSetGpioCmd(const uint8_t* commandData) { ReturnValue_t PlocSupervisorHandler::prepareSetGpioCmd(const uint8_t* commandData) {
uint8_t port = *commandData; uint8_t port = *commandData;
uint8_t pin = *(commandData + 1); uint8_t pin = *(commandData + 1);
@ -1611,33 +1570,6 @@ ReturnValue_t PlocSupervisorHandler::prepareSetShutdownTimeoutCmd(const uint8_t*
return returnvalue::OK; 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;
// }
void PlocSupervisorHandler::disableAllReplies() { void PlocSupervisorHandler::disableAllReplies() {
using namespace supv; using namespace supv;
DeviceReplyMap::iterator iter; DeviceReplyMap::iterator iter;
@ -1726,41 +1658,6 @@ void PlocSupervisorHandler::disableExeReportReply() {
info->command->second.expectedReplies = 1; info->command->second.expectedReplies = 1;
} }
// 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::handleMramDumpPacket(DeviceCommandId_t id) { ReturnValue_t PlocSupervisorHandler::handleMramDumpPacket(DeviceCommandId_t id) {
ReturnValue_t result = returnvalue::FAILED; ReturnValue_t result = returnvalue::FAILED;
@ -1837,15 +1734,6 @@ void PlocSupervisorHandler::increaseExpectedMramReplies(DeviceCommandId_t id) {
return; return;
} }
// 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::handleMramDumpFile(DeviceCommandId_t id) { ReturnValue_t PlocSupervisorHandler::handleMramDumpFile(DeviceCommandId_t id) {
#ifdef XIPHOS_Q7S #ifdef XIPHOS_Q7S
if (not sdcMan->getActiveSdCard()) { if (not sdcMan->getActiveSdCard()) {
@ -2118,3 +2006,116 @@ ReturnValue_t PlocSupervisorHandler::getSwitches(const uint8_t** switches,
uint32_t PlocSupervisorHandler::getTransitionDelayMs(Mode_t modeFrom, Mode_t modeTo) { uint32_t PlocSupervisorHandler::getTransitionDelayMs(Mode_t modeFrom, Mode_t modeTo) {
return 7000; return 7000;
} }
// 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::prepareWipeMramCmd(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::WIPE);
// if (result != returnvalue::OK) {
// return result;
// }
// finishTcPrep(packet.getFullPacketLen());
// return returnvalue::OK;
// }
// 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;
// }