From 3f6a534db5f123ee0fc334b6d0583db87edfee85 Mon Sep 17 00:00:00 2001 From: Cleanroom Laptop L15 Date: Wed, 6 Apr 2022 17:27:44 +0200 Subject: [PATCH] fixes identified during tests --- bsp_q7s/main.cpp | 1 + .../PlocSupervisorDefinitions.h | 7 +++-- linux/devices/ploc/PlocSupervisorHandler.cpp | 28 +++++++++++-------- linux/devices/ploc/PlocSupervisorHandler.h | 1 + 4 files changed, 23 insertions(+), 14 deletions(-) diff --git a/bsp_q7s/main.cpp b/bsp_q7s/main.cpp index dfcaebf0..81616954 100644 --- a/bsp_q7s/main.cpp +++ b/bsp_q7s/main.cpp @@ -6,6 +6,7 @@ #include "simple/simple.h" #endif + #include /** diff --git a/linux/devices/devicedefinitions/PlocSupervisorDefinitions.h b/linux/devices/devicedefinitions/PlocSupervisorDefinitions.h index 9aac6b0f..650e8628 100644 --- a/linux/devices/devicedefinitions/PlocSupervisorDefinitions.h +++ b/linux/devices/devicedefinitions/PlocSupervisorDefinitions.h @@ -70,7 +70,8 @@ static const DeviceCommandId_t LATCHUP_REPORT = 54; static const uint16_t SIZE_ACK_REPORT = 14; static const uint16_t SIZE_EXE_REPORT = 14; -static const uint16_t SIZE_HK_REPORT = 52; +//static const uint16_t SIZE_HK_REPORT = 52; +static const uint16_t SIZE_HK_REPORT = 56; static const uint16_t SIZE_BOOT_STATUS_REPORT = 24; static const uint16_t SIZE_LATCHUP_STATUS_REPORT = 31; @@ -212,7 +213,7 @@ enum PoolIds : lp_id_t { }; static const uint8_t HK_SET_ENTRIES = 13; -static const uint8_t BOOT_REPORT_SET_ENTRIES = 8; +static const uint8_t BOOT_REPORT_SET_ENTRIES = 10; static const uint8_t LATCHUP_RPT_SET_ENTRIES = 16; static const uint32_t HK_SET_ID = HK_REPORT; @@ -347,7 +348,7 @@ class SetTimeRef : public SpacePacket { serializedSize = 0; SerializeAdapter::serialize(&month, &data_field_ptr, &serializedSize, sizeof(time->month), SerializeIF::Endianness::BIG); - uint8_t year = static_cast(time->year); + uint8_t year = static_cast(time->year - 1900); serializedSize = 0; SerializeAdapter::serialize(&year, &data_field_ptr, &serializedSize, sizeof(time->year), SerializeIF::Endianness::BIG); diff --git a/linux/devices/ploc/PlocSupervisorHandler.cpp b/linux/devices/ploc/PlocSupervisorHandler.cpp index 88cfb1fb..7174ec89 100644 --- a/linux/devices/ploc/PlocSupervisorHandler.cpp +++ b/linux/devices/ploc/PlocSupervisorHandler.cpp @@ -344,7 +344,7 @@ void PlocSupervisorHandler::fillCommandAndReplyMap() { this->insertInCommandAndReplyMap(supv::FIRST_MRAM_DUMP, 3); this->insertInCommandAndReplyMap(supv::CONSECUTIVE_MRAM_DUMP, 3); this->insertInReplyMap(supv::ACK_REPORT, 3, nullptr, supv::SIZE_ACK_REPORT); - this->insertInReplyMap(supv::EXE_REPORT, 3, nullptr, supv::SIZE_EXE_REPORT); + this->insertInReplyMap(supv::EXE_REPORT, 120, nullptr, supv::SIZE_EXE_REPORT); this->insertInReplyMap(supv::HK_REPORT, 3, &hkset, supv::SIZE_HK_REPORT); this->insertInReplyMap(supv::BOOT_STATUS_REPORT, 3, &bootStatusReport, supv::SIZE_BOOT_STATUS_REPORT); @@ -713,6 +713,8 @@ ReturnValue_t PlocSupervisorHandler::handleExecutionReport(const uint8_t* data) sif::debug << "PlocSupervisorHandler::handleExecutionReport: Unknown command id" << std::endl; } + uint16_t status = *(data + EXE_STATUS_OFFSET) << 8 | *(data + EXE_STATUS_OFFSET + 1); + sif::info << "Execution status: 0x" << std::hex << status << std::endl; sendFailureReport(supv::EXE_REPORT, RECEIVED_EXE_FAILURE); disableExeReportReply(); result = IGNORE_REPLY_DATA; @@ -794,7 +796,7 @@ ReturnValue_t PlocSupervisorHandler::handleHkReport(const uint8_t* data) { << static_cast(hkset.nvm0_1_state.value) << std::endl; sif::info << "PlocSupervisorHandler::handleHkReport: nvm3_state: " << static_cast(hkset.nvm3_state.value) << std::endl; - sif::info << "PlocSupervisorHandler::handleHkReport: missoin_io_state: " + sif::info << "PlocSupervisorHandler::handleHkReport: mission_io_state: " << static_cast(hkset.missionIoState.value) << std::endl; sif::info << "PlocSupervisorHandler::handleHkReport: fmc_state: " << static_cast(hkset.fmcState.value) << std::endl; @@ -849,7 +851,7 @@ ReturnValue_t PlocSupervisorHandler::handleBootStatusReport(const uint8_t* data) sif::info << "PlocSupervisorHandler::handleBootStatusReport: BootAfterMs: " << bootStatusReport.bootAfterMs << " ms" << std::endl; sif::info << "PlocSupervisorHandler::handleBootStatusReport: BootTimeoutMs: " - << bootStatusReport.bootTimeoutMs << " ms" << std::endl; + << std::dec << bootStatusReport.bootTimeoutMs << " ms" << std::endl; sif::info << "PlocSupervisorHandler::handleBootStatusReport: Active NVM: " << static_cast(bootStatusReport.activeNvm.value) << std::endl; sif::info << "PlocSupervisorHandler::handleBootStatusReport: BP0: " @@ -858,6 +860,10 @@ ReturnValue_t PlocSupervisorHandler::handleBootStatusReport(const uint8_t* data) << static_cast(bootStatusReport.bp1State.value) << std::endl; sif::info << "PlocSupervisorHandler::handleBootStatusReport: BP2: " << static_cast(bootStatusReport.bp2State.value) << std::endl; + sif::info << "PlocSupervisorHandler::handleBootStatusReport: Boot state: " + << static_cast(bootStatusReport.bootState.value) << std::endl; + sif::info << "PlocSupervisorHandler::handleBootStatusReport: Boot cycles: " + << static_cast(bootStatusReport.bootCycles.value) << std::endl; #endif return result; @@ -891,7 +897,7 @@ ReturnValue_t PlocSupervisorHandler::handleLatchupStatusReport(const uint8_t* da offset += 2; latchupStatusReport.cnt6 = *(data + offset) << 8 | *(data + offset + 1); offset += 2; - latchupStatusReport.timeMsec = *(data + offset) << 8 | *(data + offset + 1); + latchupStatusReport.timeMsec = (*(data + offset) << 8 | *(data + offset + 1)) & 0x7FFF; offset += 2; latchupStatusReport.timeSec = *(data + offset); offset += 1; @@ -925,19 +931,19 @@ ReturnValue_t PlocSupervisorHandler::handleLatchupStatusReport(const uint8_t* da sif::info << "PlocSupervisorHandler::handleLatchupStatusReport: CNT6: " << latchupStatusReport.cnt6 << std::endl; sif::info << "PlocSupervisorHandler::handleLatchupStatusReport: Sec: " - << latchupStatusReport.timeSec << std::endl; + << static_cast(latchupStatusReport.timeSec.value) << std::endl; sif::info << "PlocSupervisorHandler::handleLatchupStatusReport: Min: " - << latchupStatusReport.timeMin << std::endl; + << static_cast(latchupStatusReport.timeMin.value) << std::endl; sif::info << "PlocSupervisorHandler::handleLatchupStatusReport: Hour: " - << latchupStatusReport.timeHour << std::endl; + << static_cast(latchupStatusReport.timeHour.value) << std::endl; sif::info << "PlocSupervisorHandler::handleLatchupStatusReport: Day: " - << latchupStatusReport.timeDay << std::endl; + << static_cast(latchupStatusReport.timeDay.value) << std::endl; sif::info << "PlocSupervisorHandler::handleLatchupStatusReport: Mon: " - << latchupStatusReport.timeMon << std::endl; + << static_cast(latchupStatusReport.timeMon.value) << std::endl; sif::info << "PlocSupervisorHandler::handleLatchupStatusReport: Year: " - << latchupStatusReport.timeYear << std::endl; + << static_cast(latchupStatusReport.timeYear.value) << std::endl; sif::info << "PlocSupervisorHandler::handleLatchupStatusReport: Msec: " - << latchupStatusReport.timeMsec << std::endl; + << static_cast(latchupStatusReport.timeMsec.value) << std::endl; sif::info << "PlocSupervisorHandler::handleLatchupStatusReport: isSet: 0x" << std::hex << latchupStatusReport.timeMsec << std::dec << std::endl; #endif diff --git a/linux/devices/ploc/PlocSupervisorHandler.h b/linux/devices/ploc/PlocSupervisorHandler.h index 5b5b3478..698b314b 100644 --- a/linux/devices/ploc/PlocSupervisorHandler.h +++ b/linux/devices/ploc/PlocSupervisorHandler.h @@ -104,6 +104,7 @@ class PlocSupervisorHandler : public DeviceHandlerBase { static const uint16_t APID_MASK = 0x7FF; static const uint16_t PACKET_SEQUENCE_COUNT_MASK = 0x3FFF; + static const uint8_t EXE_STATUS_OFFSET = 10; uint8_t commandBuffer[supv::MAX_COMMAND_SIZE];