From 9d4cb2ea8ddbb78a2047ec9ddf467244a4ee2744 Mon Sep 17 00:00:00 2001 From: Cleanroom Laptop L15 Date: Fri, 29 Apr 2022 13:31:58 +0200 Subject: [PATCH 1/7] xecution status code parsing --- .../devicedefinitions/PlocSupervisorDefinitions.h | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/linux/devices/devicedefinitions/PlocSupervisorDefinitions.h b/linux/devices/devicedefinitions/PlocSupervisorDefinitions.h index 8fc98bc0..c841b22c 100644 --- a/linux/devices/devicedefinitions/PlocSupervisorDefinitions.h +++ b/linux/devices/devicedefinitions/PlocSupervisorDefinitions.h @@ -1595,6 +1595,16 @@ class ExecutionReport : public VerificationReport { << "Supervisor execution report status: MPSoC boot failed" << std::endl; break; } + case StatusCode::SP_NOT_AVAILABLE: { + sif::warning + << "Supervisor execution report status: SP not available" << std::endl; + break; + } + case StatusCode::SP_DATA_INSUFFICIENT: { + sif::warning + << "Supervisor execution report status: SP data insufficient" << std::endl; + break; + } default: sif::warning << "ExecutionReport::printStatusInformation: Invalid status code: 0x" << std::hex << static_cast(statusCode) << std::endl; From 02f352e51faa9165542693c18e9a1645e803aa3a Mon Sep 17 00:00:00 2001 From: Cleanroom Laptop L15 Date: Fri, 29 Apr 2022 18:22:03 +0200 Subject: [PATCH 2/7] tmtc update --- tmtc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tmtc b/tmtc index a457b001..e939f2b9 160000 --- a/tmtc +++ b/tmtc @@ -1 +1 @@ -Subproject commit a457b001a33a2a561250544b3e9950885e1dac2e +Subproject commit e939f2b934b20f273a94a7c4d9665f7568cb9cee From cf20d8e94d12e0a64b2ff1230eedef70b14c6697 Mon Sep 17 00:00:00 2001 From: Cleanroom Laptop L15 Date: Fri, 29 Apr 2022 18:23:31 +0200 Subject: [PATCH 3/7] commented in time file writing again --- bsp_q7s/core/CoreController.cpp | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/bsp_q7s/core/CoreController.cpp b/bsp_q7s/core/CoreController.cpp index 0d166600..208999c2 100644 --- a/bsp_q7s/core/CoreController.cpp +++ b/bsp_q7s/core/CoreController.cpp @@ -1708,11 +1708,11 @@ ReturnValue_t CoreController::timeFileHandler() { } std::string fileName = currMntPrefix + TIME_FILE; std::ofstream timeFile(fileName); -// if (not timeFile.good()) { -// sif::error << "CoreController::timeFileHandler: Error opening time file: " << strerror(errno) -// << std::endl; -// return RETURN_FAILED; -// } + if (not timeFile.good()) { + sif::error << "CoreController::timeFileHandler: Error opening time file: " << strerror(errno) + << std::endl; + return RETURN_FAILED; + } timeFile << "UNIX SECONDS: " << currentTime.tv_sec << std::endl; } return RETURN_OK; From cedc6bec234fca6a82eb55beed47ffe70dd57cac Mon Sep 17 00:00:00 2001 From: Cleanroom Laptop L15 Date: Fri, 29 Apr 2022 22:55:01 +0200 Subject: [PATCH 4/7] gpio state sent with execution report --- bsp_q7s/core/CoreController.cpp | 10 +++++----- .../devicedefinitions/PlocMPSoCDefinitions.h | 3 +++ linux/devices/ploc/PlocMPSoCHandler.cpp | 16 ++++++++++++++++ linux/devices/ploc/PlocSupervisorHandler.cpp | 12 ++++++------ linux/devices/ploc/PlocSupervisorHandler.h | 4 ++-- 5 files changed, 32 insertions(+), 13 deletions(-) diff --git a/bsp_q7s/core/CoreController.cpp b/bsp_q7s/core/CoreController.cpp index 208999c2..0d166600 100644 --- a/bsp_q7s/core/CoreController.cpp +++ b/bsp_q7s/core/CoreController.cpp @@ -1708,11 +1708,11 @@ ReturnValue_t CoreController::timeFileHandler() { } std::string fileName = currMntPrefix + TIME_FILE; std::ofstream timeFile(fileName); - if (not timeFile.good()) { - sif::error << "CoreController::timeFileHandler: Error opening time file: " << strerror(errno) - << std::endl; - return RETURN_FAILED; - } +// if (not timeFile.good()) { +// sif::error << "CoreController::timeFileHandler: Error opening time file: " << strerror(errno) +// << std::endl; +// return RETURN_FAILED; +// } timeFile << "UNIX SECONDS: " << currentTime.tv_sec << std::endl; } return RETURN_OK; diff --git a/linux/devices/devicedefinitions/PlocMPSoCDefinitions.h b/linux/devices/devicedefinitions/PlocMPSoCDefinitions.h index 8b93515d..ee16339d 100644 --- a/linux/devices/devicedefinitions/PlocMPSoCDefinitions.h +++ b/linux/devices/devicedefinitions/PlocMPSoCDefinitions.h @@ -29,6 +29,9 @@ static const DeviceCommandId_t TC_MODE_REPLAY = 16; static const DeviceCommandId_t TC_CAM_CMD_SEND = 17; static const DeviceCommandId_t TC_MODE_IDLE = 18; static const DeviceCommandId_t TM_CAM_CMD_RPT = 19; +static const DeviceCommandId_t SET_UART_TX_TRISTATE = 20; +static const DeviceCommandId_t RELEASE_UART_TX = 21; + // Will reset the sequence count of the OBSW static const DeviceCommandId_t OBSW_RESET_SEQ_COUNT = 50; diff --git a/linux/devices/ploc/PlocMPSoCHandler.cpp b/linux/devices/ploc/PlocMPSoCHandler.cpp index 9ca90bcc..da0b0071 100644 --- a/linux/devices/ploc/PlocMPSoCHandler.cpp +++ b/linux/devices/ploc/PlocMPSoCHandler.cpp @@ -99,6 +99,20 @@ void PlocMPSoCHandler::performOperationHook() { ReturnValue_t PlocMPSoCHandler::executeAction(ActionId_t actionId, MessageQueueId_t commandedBy, const uint8_t* data, size_t size) { ReturnValue_t result = RETURN_OK; + switch(actionId) { + case mpsoc::SET_UART_TX_TRISTATE: { + uartIsolatorSwitch.pullLow(); + return EXECUTION_FINISHED; + break; + } + case mpsoc::RELEASE_UART_TX: { + uartIsolatorSwitch.pullHigh(); + return EXECUTION_FINISHED; + break; + default: + break; + } + } if (plocMPSoCHelperExecuting) { return MPSoCReturnValuesIF::MPSOC_HELPER_EXECUTING; @@ -267,6 +281,8 @@ void PlocMPSoCHandler::fillCommandAndReplyMap() { this->insertInCommandMap(mpsoc::TC_MODE_REPLAY); this->insertInCommandMap(mpsoc::TC_MODE_IDLE); this->insertInCommandMap(mpsoc::TC_CAM_CMD_SEND); + this->insertInCommandMap(mpsoc::RELEASE_UART_TX); + this->insertInCommandMap(mpsoc::SET_UART_TX_TRISTATE); this->insertInReplyMap(mpsoc::ACK_REPORT, 3, nullptr, mpsoc::SIZE_ACK_REPORT); this->insertInReplyMap(mpsoc::EXE_REPORT, 3, nullptr, mpsoc::SIZE_EXE_REPORT); this->insertInReplyMap(mpsoc::TM_MEMORY_READ_REPORT, 2, nullptr, mpsoc::SIZE_TM_MEM_READ_REPORT); diff --git a/linux/devices/ploc/PlocSupervisorHandler.cpp b/linux/devices/ploc/PlocSupervisorHandler.cpp index cc767037..ebebcb44 100644 --- a/linux/devices/ploc/PlocSupervisorHandler.cpp +++ b/linux/devices/ploc/PlocSupervisorHandler.cpp @@ -859,7 +859,6 @@ ReturnValue_t PlocSupervisorHandler::handleAckReport(const uint8_t* data) { } case supv::APID_ACK_SUCCESS: { setNextReplyId(); - handleSpecialAcknowledgments(data); break; } default: { @@ -887,6 +886,7 @@ ReturnValue_t PlocSupervisorHandler::handleExecutionReport(const uint8_t* data) switch (apid) { case (supv::APID_EXE_SUCCESS): { + handleSpecialExecutionReport(data); break; } case (supv::APID_EXE_FAILURE): { @@ -1813,17 +1813,17 @@ ReturnValue_t PlocSupervisorHandler::eventSubscription() { return result; } -void PlocSupervisorHandler::handleSpecialAcknowledgments(const uint8_t* data) { +void PlocSupervisorHandler::handleSpecialExecutionReport(const uint8_t* data) { DeviceCommandId_t commandId = getPendingCommand(); switch(commandId) { case supv::READ_GPIO: { - supv::AcknowledgmentReport ack; - ack.addWholeData(data, supv::SIZE_ACK_REPORT); - uint16_t gpioState = ack.getStatusCode(); + supv::ExecutionReport exe; + exe.addWholeData(data, supv::SIZE_EXE_REPORT); + uint16_t gpioState = exe.getStatusCode(); #if OBSW_DEBUG_PLOC_SUPERVISOR == 1 sif::info << "PlocsupervisorHandler: Read GPIO TM, State: " << gpioState << std::endl; #endif /* OBSW_DEBUG_PLOC_SUPERVISOR == 1 */ - handleDeviceTM(reinterpret_cast(&gpioState), sizeof(gpioState), supv::ACK_REPORT); + handleDeviceTM(reinterpret_cast(&gpioState), sizeof(gpioState), supv::EXE_REPORT); break; } default: diff --git a/linux/devices/ploc/PlocSupervisorHandler.h b/linux/devices/ploc/PlocSupervisorHandler.h index 9fa1bed3..efab17c0 100644 --- a/linux/devices/ploc/PlocSupervisorHandler.h +++ b/linux/devices/ploc/PlocSupervisorHandler.h @@ -351,9 +351,9 @@ class PlocSupervisorHandler : public DeviceHandlerBase { ReturnValue_t eventSubscription(); /** - * @brief Handles acknowledgment reports which contains additional informations in the data field + * @brief Handles execution reports which contains additional information in the data field */ - void handleSpecialAcknowledgments(const uint8_t* data); + void handleSpecialExecutionReport(const uint8_t* data); }; #endif /* MISSION_DEVICES_PLOCSUPERVISORHANDLER_H_ */ From 7afb8e90705d939044a08ed5d5aa184161feaa7f Mon Sep 17 00:00:00 2001 From: Cleanroom Laptop L15 Date: Fri, 29 Apr 2022 23:22:44 +0200 Subject: [PATCH 5/7] execution status codes --- .../PlocSupervisorDefinitions.h | 114 +++++++++++++----- 1 file changed, 87 insertions(+), 27 deletions(-) diff --git a/linux/devices/devicedefinitions/PlocSupervisorDefinitions.h b/linux/devices/devicedefinitions/PlocSupervisorDefinitions.h index c841b22c..23f3f758 100644 --- a/linux/devices/devicedefinitions/PlocSupervisorDefinitions.h +++ b/linux/devices/devicedefinitions/PlocSupervisorDefinitions.h @@ -1304,8 +1304,8 @@ class VerificationReport : public TmPacket { uint16_t refApid = 0; size_t size = 0; uint8_t* refApidPtr = this->getPacketData(); - ReturnValue_t result = SerializeAdapter::deSerialize(&refApid, refApidPtr, &size, - SerializeIF::Endianness::BIG); + ReturnValue_t result = + SerializeAdapter::deSerialize(&refApid, refApidPtr, &size, SerializeIF::Endianness::BIG); if (result != HasReturnvaluesIF::RETURN_OK) { sif::debug << "ExecutionReport: Failed to deserialize reference APID field" << std::endl; return result; @@ -1378,8 +1378,8 @@ class AcknowledgmentReport : public VerificationReport { break; } case StatusCode::DEFAULT_NAK: { - sif::warning << "Supervisor acknowledgment report status: Default code for nak" << - std::endl; + sif::warning << "Supervisor acknowledgment report status: Default code for nak" + << std::endl; break; } case StatusCode::ROUTE_PACKET: { @@ -1456,20 +1456,21 @@ class ExecutionReport : public VerificationReport { MPSOC_BOOT_FAILED = 0x106, SP_NOT_AVAILABLE = 0x200, SP_DATA_INSUFFICIENT = 0x201, - MPSOC_NOT_IN_RESET = 0x202, - FLASH_INIT_FAILED = 0x203, - FLASH_ERASE_FAILED = 0x204, - FLASH_WRITE_FAILED = 0x205, - FLASH_VERIFY_FAILED = 0x206, - CANNOT_ACCESS_TM = 0x207, - CANNOT_SEND_TM = 0x208, + SP_MEMORY_ID_INVALID = 0x202, + MPSOC_NOT_IN_RESET = 0x203, + FLASH_INIT_FAILED = 0x204, + FLASH_ERASE_FAILED = 0x205, + FLASH_WRITE_FAILED = 0x206, + FLASH_VERIFY_FAILED = 0x207, + CANNOT_ACCESS_TM = 0x208, + CANNOT_SEND_TM = 0x209, PG_LOW = 0x300, PG_5V_LOW = 0x301, PG_0V85_LOW = 0x302, PG_1V8_LOW = 0x303, PG_MISC_LOW = 0x304, PG_3V3_LOW = 0x305, - PG__MB_VAIO_LOW = 0x306, + PG_MB_VAIO_LOW = 0x306, PG_MB_MPSOCIO_LOW = 0x307 }; @@ -1581,36 +1582,95 @@ class ExecutionReport : public VerificationReport { break; } case StatusCode::OUT_OF_HEAP_MEMORY: { - sif::warning - << "Supervisor execution report status: Out of heap memory" << std::endl; + sif::warning << "Supervisor execution report status: Out of heap memory" << std::endl; break; } case StatusCode::INVALID_STATE_TRANSITION: { - sif::warning - << "Supervisor execution report status: Invalid state transition" << std::endl; + sif::warning << "Supervisor execution report status: Invalid state transition" << std::endl; break; } case StatusCode::MPSOC_BOOT_FAILED: { - sif::warning - << "Supervisor execution report status: MPSoC boot failed" << std::endl; + sif::warning << "Supervisor execution report status: MPSoC boot failed" << std::endl; break; } case StatusCode::SP_NOT_AVAILABLE: { - sif::warning - << "Supervisor execution report status: SP not available" << std::endl; - break; - } + sif::warning << "Supervisor execution report status: SP not available" << std::endl; + break; + } case StatusCode::SP_DATA_INSUFFICIENT: { - sif::warning - << "Supervisor execution report status: SP data insufficient" << std::endl; - break; - } + sif::warning << "Supervisor execution report status: SP data insufficient" << std::endl; + break; + } + case StatusCode::SP_MEMORY_ID_INVALID: { + sif::warning << "Supervisor execution report status: SP data insufficient" << std::endl; + break; + } + case StatusCode::MPSOC_NOT_IN_RESET: { + sif::warning << "Supervisor execution report status: MPSoC not in reset" << std::endl; + break; + } + case StatusCode::FLASH_INIT_FAILED: { + sif::warning << "Supervisor execution report status: Flash init failed" << std::endl; + break; + } + case StatusCode::FLASH_ERASE_FAILED: { + sif::warning << "Supervisor execution report status: Flash erase failed" << std::endl; + break; + } + case StatusCode::FLASH_WRITE_FAILED: { + sif::warning << "Supervisor execution report status: Flash write failed" << std::endl; + break; + } + case StatusCode::FLASH_VERIFY_FAILED: { + sif::warning << "Supervisor execution report status: Flash verify failed" << std::endl; + break; + } + case StatusCode::CANNOT_ACCESS_TM: { + sif::warning << "Supervisor execution report status: Can not access tm" << std::endl; + break; + } + case StatusCode::CANNOT_SEND_TM: { + sif::warning << "Supervisor execution report status: Can not access tm" << std::endl; + break; + } + case StatusCode::PG_LOW: { + sif::warning << "Supervisor execution report status: PG low" << std::endl; + break; + } + case StatusCode::PG_5V_LOW: { + sif::warning << "Supervisor execution report status: PG 5V low" << std::endl; + break; + } + case StatusCode::PG_0V85_LOW: { + sif::warning << "Supervisor execution report status: PG 0V85 low" << std::endl; + break; + } + case StatusCode::PG_1V8_LOW: { + sif::warning << "Supervisor execution report status: PG 1V8 low" << std::endl; + break; + } + case StatusCode::PG_MISC_LOW: { + sif::warning << "Supervisor execution report status: PG misc low" << std::endl; + break; + } + case StatusCode::PG_3V3_LOW: { + sif::warning << "Supervisor execution report status: PG 3V3 low" << std::endl; + break; + } + case StatusCode::PG_MB_VAIO_LOW: { + sif::warning << "Supervisor execution report status: PG mb vaio low" << std::endl; + break; + } + case StatusCode::PG_MB_MPSOCIO_LOW: { + sif::warning << "Supervisor execution report status: PG mb mpsocio low" << std::endl; + break; + } default: sif::warning << "ExecutionReport::printStatusInformation: Invalid status code: 0x" << std::hex << static_cast(statusCode) << std::endl; break; - } } + } }; /** From 816dc43214da8b4b765c91373f2c1e6973c1d777 Mon Sep 17 00:00:00 2001 From: Cleanroom Laptop L15 Date: Fri, 29 Apr 2022 23:34:28 +0200 Subject: [PATCH 6/7] restructuring execution report handling --- linux/devices/ploc/PlocSupervisorHandler.cpp | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/linux/devices/ploc/PlocSupervisorHandler.cpp b/linux/devices/ploc/PlocSupervisorHandler.cpp index ebebcb44..90b9c14f 100644 --- a/linux/devices/ploc/PlocSupervisorHandler.cpp +++ b/linux/devices/ploc/PlocSupervisorHandler.cpp @@ -827,10 +827,14 @@ ReturnValue_t PlocSupervisorHandler::verifyPacket(const uint8_t* start, size_t f } ReturnValue_t PlocSupervisorHandler::handleAckReport(const uint8_t* data) { - ReturnValue_t result = RETURN_OK; + using namespace supv; + ReturnValue_t result = RETURN_OK; - result = verifyPacket(data, supv::SIZE_ACK_REPORT); - if (result == SupvReturnValuesIF::CRC_FAILURE) { + AcknowledgmentReport ack; + ack.addWholeData(data, SIZE_ACK_REPORT); + + result = ack.checkCrc(); + if (result != RETURN_OK) { sif::error << "PlocSupervisorHandler::handleAckReport: CRC failure" << std::endl; nextReplyId = supv::NONE; replyRawReplyIfnotWiretapped(data, supv::SIZE_ACK_REPORT); @@ -842,7 +846,9 @@ ReturnValue_t PlocSupervisorHandler::handleAckReport(const uint8_t* data) { uint16_t apid = (*(data) << 8 | *(data + 1)) & APID_MASK; - switch (apid) { + result = ack.checkApid(); + + switch (result) { case supv::APID_ACK_FAILURE: { // TODO: Interpretation of status field in acknowledgment report sif::debug << "PlocSupervisorHandler::handleAckReport: Received Ack failure report" From 1635e40c795087a074bbe387397c8df7989e70f9 Mon Sep 17 00:00:00 2001 From: Cleanroom Laptop L15 Date: Fri, 29 Apr 2022 23:36:09 +0200 Subject: [PATCH 7/7] tmtc update --- tmtc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tmtc b/tmtc index e939f2b9..2b8fa356 160000 --- a/tmtc +++ b/tmtc @@ -1 +1 @@ -Subproject commit e939f2b934b20f273a94a7c4d9665f7568cb9cee +Subproject commit 2b8fa356c9f9de5fa4037eb836662f509327138b