nvm enable command

This commit is contained in:
2022-05-05 19:18:39 +02:00
parent 9bd5595999
commit 5911ca79b5
3 changed files with 75 additions and 19 deletions

View File

@ -147,7 +147,7 @@ void PlocSupervisorHandler::doStartUp() {
case StartupState::BOOTING: {
if (bootTimeout.hasTimedOut()) {
uartIsolatorSwitch.pullHigh();
// startupState = StartupState::SET_TIME;
// startupState = StartupState::SET_TIME;
startupState = StartupState::ON;
}
}
@ -377,6 +377,10 @@ ReturnValue_t PlocSupervisorHandler::buildCommandFromCommand(DeviceCommandId_t d
result = RETURN_OK;
break;
}
case ENABLE_NVMS: {
result = prepareEnableNvmsCommand(commandData);
break;
}
default:
sif::debug << "PlocSupervisorHandler::buildCommandFromCommand: Command not implemented"
<< std::endl;
@ -432,6 +436,7 @@ void PlocSupervisorHandler::fillCommandAndReplyMap() {
this->insertInCommandMap(LOGGING_CLEAR_COUNTERS);
this->insertInCommandMap(LOGGING_SET_TOPIC);
this->insertInCommandMap(RESET_PL);
this->insertInCommandMap(ENABLE_NVMS);
this->insertInCommandAndReplyMap(FIRST_MRAM_DUMP, 3);
this->insertInCommandAndReplyMap(CONSECUTIVE_MRAM_DUMP, 3);
this->insertInReplyMap(ACK_REPORT, 3, nullptr, SIZE_ACK_REPORT);
@ -552,6 +557,7 @@ ReturnValue_t PlocSupervisorHandler::enableReplyInReplyMap(DeviceCommandMap::ite
case LOGGING_CLEAR_COUNTERS:
case LOGGING_SET_TOPIC:
case RESET_PL:
case ENABLE_NVMS:
enabledReplies = 2;
break;
default:
@ -878,7 +884,7 @@ ReturnValue_t PlocSupervisorHandler::handleAckReport(const uint8_t* data) {
case SupvReturnValuesIF::RECEIVED_ACK_FAILURE: {
#if OBSW_DEBUG_PLOC_SUPERVISOR == 1
sif::debug << "PlocSupervisorHandler: Received Ack failure report with status code: 0x"
<< std::hex << ack.getStatusCode() << std::endl;
<< std::hex << ack.getStatusCode() << std::endl;
#endif /* OBSW_DEBUG_PLOC_SUPERVISOR == 1 */
DeviceCommandId_t commandId = getPendingCommand();
if (commandId != DeviceHandlerIF::NO_COMMAND_ID) {
@ -1176,7 +1182,7 @@ ReturnValue_t PlocSupervisorHandler::handleLoggingReport(const uint8_t* data) {
if (result == SupvReturnValuesIF::CRC_FAILURE) {
sif::warning << "PlocSupervisorHandler::handleLoggingReport: Logging report has "
<< "invalid crc" << std::endl;
<< "invalid crc" << std::endl;
return result;
}
@ -1533,6 +1539,15 @@ ReturnValue_t PlocSupervisorHandler::prepareLoggingRequest(const uint8_t* comman
return RETURN_OK;
}
ReturnValue_t PlocSupervisorHandler::prepareEnableNvmsCommand(const uint8_t* commandData) {
using namespace supv;
uint8_t nvm01 = *(commandData);
uint8_t nvm3 = *(commandData + 1);
EnableNvms packet(nvm01, nvm3);
packetToOutBuffer(packet.getWholeData(), packet.getFullSize());
return RETURN_OK;
}
void PlocSupervisorHandler::disableAllReplies() {
DeviceReplyMap::iterator iter;
@ -1872,8 +1887,8 @@ void PlocSupervisorHandler::handleExecutionSuccessReport(const uint8_t* data) {
}
uint8_t data[sizeof(gpioState)];
size_t size = 0;
ReturnValue_t result = SerializeAdapter::serialize(
&gpioState, data, &size, sizeof(gpioState), SerializeIF::Endianness::BIG);
ReturnValue_t result = SerializeAdapter::serialize(&gpioState, data, &size, sizeof(gpioState),
SerializeIF::Endianness::BIG);
if (result != RETURN_OK) {
sif::debug << "PlocSupervisorHandler: Failed to deserialize GPIO state" << std::endl;
}