ploc memory dumper complete
This commit is contained in:
@ -199,10 +199,10 @@ ReturnValue_t PlocSupervisorHandler::buildCommandFromCommand(
|
||||
result = prepareWipeMramCmd(commandData);
|
||||
break;
|
||||
}
|
||||
case(PLOC_SPV::DUMP_MRAM): {
|
||||
case(PLOC_SPV::FIRST_MRAM_DUMP):
|
||||
case(PLOC_SPV::CONSECUTIVE_MRAM_DUMP):
|
||||
result = prepareDumpMramCmd(commandData);
|
||||
break;
|
||||
}
|
||||
case(PLOC_SPV::PRINT_CPU_STATS): {
|
||||
preparePrintCpuStatsCmd(commandData);
|
||||
result = RETURN_OK;
|
||||
@ -319,7 +319,8 @@ void PlocSupervisorHandler::fillCommandAndReplyMap() {
|
||||
this->insertInCommandMap(PLOC_SPV::FACTORY_RESET_CLEAR_MIRROR);
|
||||
this->insertInCommandMap(PLOC_SPV::FACTORY_RESET_CLEAR_CIRCULAR);
|
||||
this->insertInCommandMap(PLOC_SPV::CAN_LOOPBACK_TEST);
|
||||
this->insertInCommandAndReplyMap(PLOC_SPV::DUMP_MRAM, 3);
|
||||
this->insertInCommandAndReplyMap(PLOC_SPV::FIRST_MRAM_DUMP, 3);
|
||||
this->insertInCommandAndReplyMap(PLOC_SPV::CONSECUTIVE_MRAM_DUMP, 3);
|
||||
this->insertInReplyMap(PLOC_SPV::ACK_REPORT, 3, nullptr, PLOC_SPV::SIZE_ACK_REPORT);
|
||||
this->insertInReplyMap(PLOC_SPV::EXE_REPORT, 3, nullptr, PLOC_SPV::SIZE_EXE_REPORT);
|
||||
this->insertInReplyMap(PLOC_SPV::HK_REPORT, 3, &hkset, PLOC_SPV::SIZE_HK_REPORT);
|
||||
@ -332,8 +333,12 @@ void PlocSupervisorHandler::fillCommandAndReplyMap() {
|
||||
ReturnValue_t PlocSupervisorHandler::scanForReply(const uint8_t *start,
|
||||
size_t remainingSize, DeviceCommandId_t *foundId, size_t *foundLen) {
|
||||
|
||||
if (nextReplyId == PLOC_SPV::DUMP_MRAM) {
|
||||
*foundId = PLOC_SPV::DUMP_MRAM;
|
||||
if (nextReplyId == PLOC_SPV::FIRST_MRAM_DUMP) {
|
||||
*foundId = PLOC_SPV::FIRST_MRAM_DUMP;
|
||||
return parseMramPackets(start, remainingSize, foundLen);
|
||||
}
|
||||
else if (nextReplyId == PLOC_SPV::CONSECUTIVE_MRAM_DUMP) {
|
||||
*foundId = PLOC_SPV::CONSECUTIVE_MRAM_DUMP;
|
||||
return parseMramPackets(start, remainingSize, foundLen);
|
||||
}
|
||||
|
||||
@ -402,10 +407,10 @@ ReturnValue_t PlocSupervisorHandler::interpretDeviceReply(DeviceCommandId_t id,
|
||||
result = handleLatchupStatusReport(packet);
|
||||
break;
|
||||
}
|
||||
case (PLOC_SPV::DUMP_MRAM): {
|
||||
result = handleMramDumpPacket();
|
||||
case (PLOC_SPV::FIRST_MRAM_DUMP):
|
||||
case (PLOC_SPV::CONSECUTIVE_MRAM_DUMP):
|
||||
result = handleMramDumpPacket(id);
|
||||
break;
|
||||
}
|
||||
case (PLOC_SPV::EXE_REPORT): {
|
||||
result = handleExecutionReport(packet);
|
||||
break;
|
||||
@ -511,13 +516,23 @@ ReturnValue_t PlocSupervisorHandler::enableReplyInReplyMap(DeviceCommandMap::ite
|
||||
}
|
||||
break;
|
||||
}
|
||||
case PLOC_SPV::DUMP_MRAM: {
|
||||
case PLOC_SPV::FIRST_MRAM_DUMP: {
|
||||
enabledReplies = 2; // expected replies will be increased in handleMramDumpPacket
|
||||
result = DeviceHandlerBase::enableReplyInReplyMap(command, enabledReplies, true,
|
||||
PLOC_SPV::DUMP_MRAM);
|
||||
PLOC_SPV::FIRST_MRAM_DUMP);
|
||||
if (result != RETURN_OK) {
|
||||
sif::debug << "PlocSupervisorHandler::enableReplyInReplyMap: Reply with id "
|
||||
<< PLOC_SPV::LATCHUP_REPORT << " not in replyMap" << std::endl;
|
||||
<< PLOC_SPV::FIRST_MRAM_DUMP << " not in replyMap" << std::endl;
|
||||
}
|
||||
break;
|
||||
}
|
||||
case PLOC_SPV::CONSECUTIVE_MRAM_DUMP: {
|
||||
enabledReplies = 2; // expected replies will be increased in handleMramDumpPacket
|
||||
result = DeviceHandlerBase::enableReplyInReplyMap(command, enabledReplies, true,
|
||||
PLOC_SPV::CONSECUTIVE_MRAM_DUMP);
|
||||
if (result != RETURN_OK) {
|
||||
sif::debug << "PlocSupervisorHandler::enableReplyInReplyMap: Reply with id "
|
||||
<< PLOC_SPV::CONSECUTIVE_MRAM_DUMP << " not in replyMap" << std::endl;
|
||||
}
|
||||
break;
|
||||
}
|
||||
@ -924,8 +939,11 @@ void PlocSupervisorHandler::setNextReplyId() {
|
||||
case PLOC_SPV::GET_LATCHUP_STATUS_REPORT:
|
||||
nextReplyId = PLOC_SPV::LATCHUP_REPORT;
|
||||
break;
|
||||
case PLOC_SPV::DUMP_MRAM:
|
||||
nextReplyId = PLOC_SPV::DUMP_MRAM;
|
||||
case PLOC_SPV::FIRST_MRAM_DUMP:
|
||||
nextReplyId = PLOC_SPV::FIRST_MRAM_DUMP;
|
||||
break;
|
||||
case PLOC_SPV::CONSECUTIVE_MRAM_DUMP:
|
||||
nextReplyId = PLOC_SPV::CONSECUTIVE_MRAM_DUMP;
|
||||
break;
|
||||
default:
|
||||
/* If no telemetry is expected the next reply is always the execution report */
|
||||
@ -942,7 +960,8 @@ size_t PlocSupervisorHandler::getNextReplyLength(DeviceCommandId_t commandId){
|
||||
return replyLen;
|
||||
}
|
||||
|
||||
if (nextReplyId == PLOC_SPV::DUMP_MRAM) {
|
||||
if (nextReplyId == PLOC_SPV::FIRST_MRAM_DUMP
|
||||
|| nextReplyId == PLOC_SPV::CONSECUTIVE_MRAM_DUMP) {
|
||||
/**
|
||||
* Try to read 20 MRAM packets. If reply is larger, the packets will be read with the
|
||||
* next doSendRead call. The command will be as long active as the packet with the sequence
|
||||
@ -1347,7 +1366,7 @@ ReturnValue_t PlocSupervisorHandler::parseMramPackets(const uint8_t *packet, siz
|
||||
return result;
|
||||
}
|
||||
|
||||
ReturnValue_t PlocSupervisorHandler::handleMramDumpPacket() {
|
||||
ReturnValue_t PlocSupervisorHandler::handleMramDumpPacket(DeviceCommandId_t id) {
|
||||
|
||||
ReturnValue_t result = RETURN_FAILED;
|
||||
|
||||
@ -1359,24 +1378,24 @@ ReturnValue_t PlocSupervisorHandler::handleMramDumpPacket() {
|
||||
sif::warning << "PlocSupervisorHandler::handleMramDumpPacket: CRC failure" << std::endl;
|
||||
return result;
|
||||
}
|
||||
handleMramDumpFile();
|
||||
handleMramDumpFile(id);
|
||||
if (downlinkMramDump == true) {
|
||||
handleDeviceTM(spacePacketBuffer + PLOC_SPV::SPACE_PACKET_HEADER_LENGTH, packetLen - 1,
|
||||
PLOC_SPV::DUMP_MRAM);
|
||||
id);
|
||||
}
|
||||
packetInBuffer = false;
|
||||
receivedMramDumpPackets++;
|
||||
if (expectedMramDumpPackets == receivedMramDumpPackets) {
|
||||
nextReplyId = PLOC_SPV::EXE_REPORT;
|
||||
}
|
||||
increaseExpectedMramReplies();
|
||||
increaseExpectedMramReplies(id);
|
||||
return RETURN_OK;
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
void PlocSupervisorHandler::increaseExpectedMramReplies() {
|
||||
DeviceReplyMap::iterator mramDumpIter = deviceReplyMap.find(PLOC_SPV::DUMP_MRAM);
|
||||
void PlocSupervisorHandler::increaseExpectedMramReplies(DeviceCommandId_t id) {
|
||||
DeviceReplyMap::iterator mramDumpIter = deviceReplyMap.find(id);
|
||||
DeviceReplyMap::iterator exeReportIter = deviceReplyMap.find(PLOC_SPV::EXE_REPORT);
|
||||
if (mramDumpIter == deviceReplyMap.end()) {
|
||||
sif::debug << "PlocSupervisorHandler::increaseExpectedMramReplies: Dump MRAM reply not "
|
||||
@ -1432,15 +1451,17 @@ ReturnValue_t PlocSupervisorHandler::checkMramPacketApid() {
|
||||
return APERIODIC_REPLY;
|
||||
}
|
||||
|
||||
ReturnValue_t PlocSupervisorHandler::handleMramDumpFile() {
|
||||
ReturnValue_t PlocSupervisorHandler::handleMramDumpFile(DeviceCommandId_t id) {
|
||||
ReturnValue_t result = RETURN_OK;
|
||||
uint16_t packetLen = readSpacePacketLength(spacePacketBuffer);
|
||||
uint8_t sequenceFlags = readSequenceFlags(spacePacketBuffer);
|
||||
if (sequenceFlags == static_cast<uint8_t>(PLOC_SPV::SequenceFlags::FIRST_PKT)
|
||||
|| (sequenceFlags == static_cast<uint8_t>(PLOC_SPV::SequenceFlags::STANDALONE_PKT))) {
|
||||
result = createMramDumpFile();
|
||||
if (result != RETURN_OK) {
|
||||
return result;
|
||||
if (id == PLOC_SPV::FIRST_MRAM_DUMP) {
|
||||
if (sequenceFlags == static_cast<uint8_t>(PLOC_SPV::SequenceFlags::FIRST_PKT)
|
||||
|| (sequenceFlags == static_cast<uint8_t>(PLOC_SPV::SequenceFlags::STANDALONE_PKT))) {
|
||||
result = createMramDumpFile();
|
||||
if (result != RETURN_OK) {
|
||||
return result;
|
||||
}
|
||||
}
|
||||
}
|
||||
if (not std::filesystem::exists(activeMramFile)) {
|
||||
|
Reference in New Issue
Block a user