v1.17.0 #327

Merged
muellerr merged 131 commits from develop into main 2022-11-28 18:29:31 +01:00
4 changed files with 75 additions and 75 deletions
Showing only changes of commit 09ccb5ddf7 - Show all commits

View File

@ -1116,6 +1116,56 @@ class WriteMemory : public TcBase {
} }
}; };
/**
* @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, Apid::DATA_LOGGER) { setLenFromPayloadLen(6); }
ReturnValue_t buildPacket(uint32_t start, uint32_t stop, MramAction action) {
if (action == MramAction::WIPE) {
setServiceId(static_cast<uint8_t>(tc::DataLoggerServiceId::WIPE_MRAM));
} else if (action == MramAction::DUMP) {
setServiceId(static_cast<uint8_t>(tc::DataLoggerServiceId::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 can be used to package erase memory command * @brief This class can be used to package erase memory command
*/ */
@ -1931,56 +1981,6 @@ class EnableNvms : public TcBase {
} }
}; };
/**
* @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, Apid::DATA_LOGGER) { setLenFromPayloadLen(6); }
ReturnValue_t buildPacket(uint32_t start, uint32_t stop, MramAction action) {
if (action == MramAction::WIPE) {
setServiceId(static_cast<uint8_t>(tc::DataLoggerServiceId::WIPE_MRAM));
} else if (action == MramAction::DUMP) {
setServiceId(static_cast<uint8_t>(tc::DataLoggerServiceId::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 * @brief This class creates the space packet to enable the auto TM generation
*/ */

View File

@ -417,10 +417,10 @@ ReturnValue_t PlocSupervisorHandler::buildCommandFromCommand(DeviceCommandId_t d
// result = returnvalue::OK; // result = returnvalue::OK;
// break; // break;
// } // }
// case WIPE_MRAM: { case WIPE_MRAM: {
// result = prepareWipeMramCmd(commandData); result = prepareWipeMramCmd(commandData);
// break; break;
// } }
// case FIRST_MRAM_DUMP: // case FIRST_MRAM_DUMP:
// case CONSECUTIVE_MRAM_DUMP: // case CONSECUTIVE_MRAM_DUMP:
// result = prepareDumpMramCmd(commandData); // result = prepareDumpMramCmd(commandData);
@ -562,7 +562,7 @@ ReturnValue_t PlocSupervisorHandler::enableReplyInReplyMap(DeviceCommandMap::ite
case SET_ADC_THRESHOLD: case SET_ADC_THRESHOLD:
// case COPY_ADC_DATA_TO_MRAM: // 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:
@ -1725,6 +1725,24 @@ ReturnValue_t PlocSupervisorHandler::handleMramDumpFile(DeviceCommandId_t id) {
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 result::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;
}
uint16_t PlocSupervisorHandler::readSpacePacketLength(uint8_t* spacePacket) { uint16_t PlocSupervisorHandler::readSpacePacketLength(uint8_t* spacePacket) {
return spacePacket[4] << 8 | spacePacket[5]; return spacePacket[4] << 8 | spacePacket[5];
} }
@ -2013,24 +2031,6 @@ uint32_t PlocSupervisorHandler::getTransitionDelayMs(Mode_t modeFrom, Mode_t mod
// return result; // 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) { // ReturnValue_t PlocSupervisorHandler::prepareDumpMramCmd(const uint8_t* commandData) {
// uint32_t start = 0; // uint32_t start = 0;
// uint32_t stop = 0; // uint32_t stop = 0;

View File

@ -285,7 +285,7 @@ class PlocSupervisorHandler : public DeviceHandlerBase {
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);
// ReturnValue_t prepareWipeMramCmd(const uint8_t* commandData); ReturnValue_t prepareWipeMramCmd(const uint8_t* commandData);
// 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);

View File

@ -417,7 +417,7 @@ ReturnValue_t PlocSupvHelper::writeUpdatePackets() {
return result; return result;
} }
result = handlePacketTransmissionNoReply(packet); result = handlePacketTransmissionNoReply(packet);
//result = encodeAndSendPacket(packet.getFullPacket(), packet.getFullPacketLen()); // result = encodeAndSendPacket(packet.getFullPacket(), packet.getFullPacketLen());
if (result != returnvalue::OK) { if (result != returnvalue::OK) {
triggerEvent(WRITE_MEMORY_FAILED, buildProgParams1(progPercent, update.sequenceCount), triggerEvent(WRITE_MEMORY_FAILED, buildProgParams1(progPercent, update.sequenceCount),
update.bytesWritten); update.bytesWritten);