From 097be17a2900e64021fcbb457c89d6d4756ab697 Mon Sep 17 00:00:00 2001 From: meggert Date: Wed, 19 Apr 2023 15:07:21 +0200 Subject: [PATCH 01/36] added remaining acs modes as system modes --- mission/sysDefs.h | 11 +- mission/system/EiveSystem.cpp | 12 +- mission/system/systemTree.cpp | 254 ++++++++++++++++++++++++++++++---- 3 files changed, 247 insertions(+), 30 deletions(-) diff --git a/mission/sysDefs.h b/mission/sysDefs.h index e8303524..a74cf369 100644 --- a/mission/sysDefs.h +++ b/mission/sysDefs.h @@ -9,8 +9,15 @@ extern std::atomic_uint16_t I2C_FATAL_ERRORS; namespace satsystem { -enum Mode : Mode_t { BOOT = 5, SAFE = acs::AcsMode::SAFE, PTG_IDLE = acs::AcsMode::PTG_IDLE }; - +enum Mode : Mode_t { + BOOT = 5, + SAFE = acs::AcsMode::SAFE, + PTG_IDLE = acs::AcsMode::PTG_IDLE, + PTG_NADIR = acs::AcsMode::PTG_NADIR, + PTG_TARGET = acs::AcsMode::PTG_TARGET, + PTG_TARGET_GS = acs::AcsMode::PTG_TARGET_GS, + PTG_INERTIAL = acs::AcsMode::PTG_INERTIAL, +}; } namespace xsc { diff --git a/mission/system/EiveSystem.cpp b/mission/system/EiveSystem.cpp index 53bf7a32..f17b82cb 100644 --- a/mission/system/EiveSystem.cpp +++ b/mission/system/EiveSystem.cpp @@ -39,18 +39,22 @@ void EiveSystem::announceMode(bool recursive) { modeStr = "POINTING IDLE"; break; } - case (acs::AcsMode::PTG_INERTIAL): { - modeStr = "POINTING INERTIAL"; + case (satsystem::Mode::PTG_NADIR): { + modeStr = "POINTING NADIR"; break; } - case (acs::AcsMode::PTG_TARGET): { + case (satsystem::Mode::PTG_TARGET): { modeStr = "POINTING TARGET"; break; } - case (acs::AcsMode::PTG_TARGET_GS): { + case (satsystem::Mode::PTG_TARGET_GS): { modeStr = "POINTING TARGET GS"; break; } + case (satsystem::Mode::PTG_INERTIAL): { + modeStr = "POINTING INERTIAL"; + break; + } } sif::info << "EIVE system is now in " << modeStr << " mode" << std::endl; return Subsystem::announceMode(recursive); diff --git a/mission/system/systemTree.cpp b/mission/system/systemTree.cpp index 37adbaf5..1b5b6c4b 100644 --- a/mission/system/systemTree.cpp +++ b/mission/system/systemTree.cpp @@ -22,6 +22,10 @@ const auto check = subsystem::checkInsert; void buildBootSequence(Subsystem& ss, ModeListEntry& eh); void buildSafeSequence(Subsystem& ss, ModeListEntry& eh); void buildIdleSequence(Subsystem& ss, ModeListEntry& eh); +void buildPtgNadirSequence(Subsystem& ss, ModeListEntry& eh); +void buildPtgTargetSequence(Subsystem& ss, ModeListEntry& eh); +void buildPtgTargetGsSequence(Subsystem& ss, ModeListEntry& eh); +void buildPtgInertialSequence(Subsystem& ss, ModeListEntry& eh); } // namespace static const auto OFF = HasModesIF::MODE_OFF; @@ -40,6 +44,10 @@ void satsystem::init() { buildBootSequence(EIVE_SYSTEM, entry); buildSafeSequence(EIVE_SYSTEM, entry); buildIdleSequence(EIVE_SYSTEM, entry); + buildPtgNadirSequence(EIVE_SYSTEM, entry); + buildPtgTargetSequence(EIVE_SYSTEM, entry); + buildPtgTargetGsSequence(EIVE_SYSTEM, entry); + buildPtgInertialSequence(EIVE_SYSTEM, entry); EIVE_SYSTEM.setInitialMode(satsystem::Mode::BOOT, 0); } @@ -68,8 +76,89 @@ auto EIVE_TABLE_IDLE_TRANS_0 = auto EIVE_TABLE_IDLE_TRANS_1 = std::make_pair((satsystem::Mode::PTG_IDLE << 24) | 3, FixedArrayList()); +auto EIVE_SEQUENCE_PTG_NADIR = + std::make_pair(satsystem::Mode::PTG_NADIR, FixedArrayList()); +auto EIVE_TABLE_PTG_NADIR_TGT = + std::make_pair((satsystem::Mode::PTG_NADIR << 24) | 1, FixedArrayList()); +auto EIVE_TABLE_PTG_NADIR_TRANS_0 = + std::make_pair((satsystem::Mode::PTG_NADIR << 24) | 2, FixedArrayList()); +auto EIVE_TABLE_PTG_NADIR_TRANS_1 = + std::make_pair((satsystem::Mode::PTG_NADIR << 24) | 3, FixedArrayList()); + +auto EIVE_SEQUENCE_PTG_TARGET = + std::make_pair(satsystem::Mode::PTG_TARGET, FixedArrayList()); +auto EIVE_TABLE_PTG_TARGET_TGT = + std::make_pair((satsystem::Mode::PTG_TARGET << 24) | 1, FixedArrayList()); +auto EIVE_TABLE_PTG_TARGET_TRANS_0 = + std::make_pair((satsystem::Mode::PTG_TARGET << 24) | 2, FixedArrayList()); +auto EIVE_TABLE_PTG_TARGET_TRANS_1 = + std::make_pair((satsystem::Mode::PTG_TARGET << 24) | 3, FixedArrayList()); + +auto EIVE_SEQUENCE_PTG_TARGET_GS = + std::make_pair(satsystem::Mode::PTG_TARGET_GS, FixedArrayList()); +auto EIVE_TABLE_PTG_TARGET_GS_TGT = + std::make_pair((satsystem::Mode::PTG_TARGET_GS << 24) | 1, FixedArrayList()); +auto EIVE_TABLE_PTG_TARGET_GS_TRANS_0 = + std::make_pair((satsystem::Mode::PTG_TARGET_GS << 24) | 2, FixedArrayList()); +auto EIVE_TABLE_PTG_TARGET_GS_TRANS_1 = + std::make_pair((satsystem::Mode::PTG_TARGET_GS << 24) | 3, FixedArrayList()); + +auto EIVE_SEQUENCE_PTG_INERTIAL = + std::make_pair(satsystem::Mode::PTG_INERTIAL, FixedArrayList()); +auto EIVE_TABLE_PTG_INERTIAL_TGT = + std::make_pair((satsystem::Mode::PTG_INERTIAL << 24) | 1, FixedArrayList()); +auto EIVE_TABLE_PTG_INERTIAL_TRANS_0 = + std::make_pair((satsystem::Mode::PTG_INERTIAL << 24) | 2, FixedArrayList()); +auto EIVE_TABLE_PTG_INERTIAL_TRANS_1 = + std::make_pair((satsystem::Mode::PTG_INERTIAL << 24) | 3, FixedArrayList()); + namespace { +void buildBootSequence(Subsystem& ss, ModeListEntry& eh) { + std::string context = "satsystem::buildBootSequence"; + auto ctxc = context.c_str(); + // Insert Helper Table + auto iht = [&](object_id_t obj, Mode_t mode, Submode_t submode, ArrayList& table, + bool allowAllSubmodes = false) { + eh.setObject(obj); + eh.setMode(mode); + eh.setSubmode(submode); + if (allowAllSubmodes) { + eh.allowAllSubmodes(); + } + check(table.insert(eh), ctxc); + }; + // Insert Helper Sequence + auto ihs = [&](ArrayList& sequence, Mode_t tableId, uint32_t waitSeconds, + bool checkSuccess) { + eh.setTableId(tableId); + eh.setWaitSeconds(waitSeconds); + eh.setCheckSuccess(checkSuccess); + check(sequence.insert(eh), ctxc); + }; + + iht(objects::ACS_SUBSYSTEM, acs::AcsMode::OFF, 0, EIVE_TABLE_BOOT_TGT.second, true); + iht(objects::PL_SUBSYSTEM, OFF, 0, EIVE_TABLE_BOOT_TGT.second); + iht(objects::COM_SUBSYSTEM, com::RX_ONLY, 0, EIVE_TABLE_BOOT_TGT.second); + iht(objects::TCS_SUBSYSTEM, OFF, 0, EIVE_TABLE_BOOT_TGT.second); + check(ss.addTable(TableEntry(EIVE_TABLE_BOOT_TGT.first, &EIVE_TABLE_BOOT_TGT.second)), ctxc); + + // Build SAFE transition 0. + iht(objects::TCS_SUBSYSTEM, OFF, 0, EIVE_TABLE_BOOT_TRANS_0.second); + iht(objects::COM_SUBSYSTEM, com::RX_ONLY, 0, EIVE_TABLE_BOOT_TRANS_0.second); + iht(objects::PL_SUBSYSTEM, OFF, 0, EIVE_TABLE_BOOT_TRANS_0.second); + iht(objects::ACS_SUBSYSTEM, acs::AcsMode::OFF, 0, EIVE_TABLE_BOOT_TRANS_0.second, true); + check(ss.addTable(TableEntry(EIVE_TABLE_BOOT_TRANS_0.first, &EIVE_TABLE_BOOT_TRANS_0.second)), + ctxc); + + // Build Safe sequence + ihs(EIVE_SEQUENCE_BOOT.second, EIVE_TABLE_BOOT_TGT.first, 0, false); + ihs(EIVE_SEQUENCE_BOOT.second, EIVE_TABLE_BOOT_TRANS_0.first, 0, false); + check(ss.addSequence(SequenceEntry(EIVE_SEQUENCE_BOOT.first, &EIVE_SEQUENCE_BOOT.second, + EIVE_SEQUENCE_SAFE.first)), + ctxc); +} + void buildSafeSequence(Subsystem& ss, ModeListEntry& eh) { std::string context = "satsystem::buildSafeSequence"; auto ctxc = context.c_str(); @@ -150,18 +239,14 @@ void buildIdleSequence(Subsystem& ss, ModeListEntry& eh) { ctxc); } -void buildBootSequence(Subsystem& ss, ModeListEntry& eh) { - std::string context = "satsystem::buildBootSequence"; +void buildPtgNadirSequence(Subsystem& ss, ModeListEntry& eh) { + std::string context = "satsystem::buildPtgNadirSequence"; auto ctxc = context.c_str(); // Insert Helper Table - auto iht = [&](object_id_t obj, Mode_t mode, Submode_t submode, ArrayList& table, - bool allowAllSubmodes = false) { + auto iht = [&](object_id_t obj, Mode_t mode, Submode_t submode, ArrayList& table) { eh.setObject(obj); eh.setMode(mode); eh.setSubmode(submode); - if (allowAllSubmodes) { - eh.allowAllSubmodes(); - } check(table.insert(eh), ctxc); }; // Insert Helper Sequence @@ -173,25 +258,146 @@ void buildBootSequence(Subsystem& ss, ModeListEntry& eh) { check(sequence.insert(eh), ctxc); }; - iht(objects::ACS_SUBSYSTEM, acs::AcsMode::OFF, 0, EIVE_TABLE_BOOT_TGT.second, true); - iht(objects::PL_SUBSYSTEM, OFF, 0, EIVE_TABLE_BOOT_TGT.second); - iht(objects::COM_SUBSYSTEM, com::RX_ONLY, 0, EIVE_TABLE_BOOT_TGT.second); - iht(objects::TCS_SUBSYSTEM, OFF, 0, EIVE_TABLE_BOOT_TGT.second); - check(ss.addTable(TableEntry(EIVE_TABLE_BOOT_TGT.first, &EIVE_TABLE_BOOT_TGT.second)), ctxc); - - // Build SAFE transition 0. - iht(objects::TCS_SUBSYSTEM, OFF, 0, EIVE_TABLE_BOOT_TRANS_0.second); - iht(objects::COM_SUBSYSTEM, com::RX_ONLY, 0, EIVE_TABLE_BOOT_TRANS_0.second); - iht(objects::PL_SUBSYSTEM, OFF, 0, EIVE_TABLE_BOOT_TRANS_0.second); - iht(objects::ACS_SUBSYSTEM, acs::AcsMode::OFF, 0, EIVE_TABLE_BOOT_TRANS_0.second, true); - check(ss.addTable(TableEntry(EIVE_TABLE_BOOT_TRANS_0.first, &EIVE_TABLE_BOOT_TRANS_0.second)), + iht(objects::ACS_SUBSYSTEM, acs::AcsMode::PTG_NADIR, 0, EIVE_TABLE_PTG_NADIR_TGT.second); + check(ss.addTable(TableEntry(EIVE_TABLE_PTG_NADIR_TGT.first, &EIVE_TABLE_PTG_NADIR_TGT.second)), ctxc); - // Build Safe sequence - ihs(EIVE_SEQUENCE_BOOT.second, EIVE_TABLE_BOOT_TGT.first, 0, false); - ihs(EIVE_SEQUENCE_BOOT.second, EIVE_TABLE_BOOT_TRANS_0.first, 0, false); - check(ss.addSequence(SequenceEntry(EIVE_SEQUENCE_BOOT.first, &EIVE_SEQUENCE_BOOT.second, - EIVE_SEQUENCE_SAFE.first)), + // Build PTG_NADIR transition 0 + iht(objects::TCS_SUBSYSTEM, NML, 0, EIVE_TABLE_PTG_NADIR_TRANS_0.second); + iht(objects::PL_SUBSYSTEM, OFF, 0, EIVE_TABLE_PTG_NADIR_TRANS_0.second); + iht(objects::ACS_SUBSYSTEM, acs::AcsMode::PTG_NADIR, 0, EIVE_TABLE_PTG_NADIR_TRANS_0.second); + check(ss.addTable( + TableEntry(EIVE_TABLE_PTG_NADIR_TRANS_0.first, &EIVE_TABLE_PTG_NADIR_TRANS_0.second)), + ctxc); + + // Build PTG_NADIR sequence + ihs(EIVE_SEQUENCE_PTG_NADIR.second, EIVE_TABLE_PTG_NADIR_TGT.first, 0, false); + ihs(EIVE_SEQUENCE_PTG_NADIR.second, EIVE_TABLE_PTG_NADIR_TRANS_0.first, 0, false); + check(ss.addSequence(SequenceEntry(EIVE_SEQUENCE_PTG_NADIR.first, &EIVE_SEQUENCE_PTG_NADIR.second, + EIVE_SEQUENCE_IDLE.first)), ctxc); } + +void buildPtgTargetSequence(Subsystem& ss, ModeListEntry& eh) { + std::string context = "satsystem::buildPtgTargetSequence"; + auto ctxc = context.c_str(); + // Insert Helper Table + auto iht = [&](object_id_t obj, Mode_t mode, Submode_t submode, ArrayList& table) { + eh.setObject(obj); + eh.setMode(mode); + eh.setSubmode(submode); + check(table.insert(eh), ctxc); + }; + // Insert Helper Sequence + auto ihs = [&](ArrayList& sequence, Mode_t tableId, uint32_t waitSeconds, + bool checkSuccess) { + eh.setTableId(tableId); + eh.setWaitSeconds(waitSeconds); + eh.setCheckSuccess(checkSuccess); + check(sequence.insert(eh), ctxc); + }; + + iht(objects::ACS_SUBSYSTEM, acs::AcsMode::PTG_TARGET, 0, EIVE_TABLE_PTG_TARGET_TGT.second); + check(ss.addTable(TableEntry(EIVE_TABLE_PTG_TARGET_TGT.first, &EIVE_TABLE_PTG_TARGET_TGT.second)), + ctxc); + + // Build PTG_TARGET transition 0 + iht(objects::TCS_SUBSYSTEM, NML, 0, EIVE_TABLE_PTG_TARGET_TRANS_0.second); + iht(objects::PL_SUBSYSTEM, OFF, 0, EIVE_TABLE_PTG_TARGET_TRANS_0.second); + iht(objects::ACS_SUBSYSTEM, acs::AcsMode::PTG_TARGET, 0, EIVE_TABLE_PTG_TARGET_TRANS_0.second); + check(ss.addTable( + TableEntry(EIVE_TABLE_PTG_TARGET_TRANS_0.first, &EIVE_TABLE_PTG_TARGET_TRANS_0.second)), + ctxc); + + // Build PTG_TARGET sequence + ihs(EIVE_SEQUENCE_PTG_TARGET.second, EIVE_TABLE_PTG_TARGET_TGT.first, 0, false); + ihs(EIVE_SEQUENCE_PTG_TARGET.second, EIVE_TABLE_PTG_TARGET_TRANS_0.first, 0, false); + check(ss.addSequence(SequenceEntry(EIVE_SEQUENCE_PTG_TARGET.first, + &EIVE_SEQUENCE_PTG_TARGET.second, EIVE_SEQUENCE_IDLE.first)), + ctxc); +} + +void buildPtgTargetGsSequence(Subsystem& ss, ModeListEntry& eh) { + std::string context = "satsystem::buildPtgTargetGsSequence"; + auto ctxc = context.c_str(); + // Insert Helper Table + auto iht = [&](object_id_t obj, Mode_t mode, Submode_t submode, ArrayList& table) { + eh.setObject(obj); + eh.setMode(mode); + eh.setSubmode(submode); + check(table.insert(eh), ctxc); + }; + // Insert Helper Sequence + auto ihs = [&](ArrayList& sequence, Mode_t tableId, uint32_t waitSeconds, + bool checkSuccess) { + eh.setTableId(tableId); + eh.setWaitSeconds(waitSeconds); + eh.setCheckSuccess(checkSuccess); + check(sequence.insert(eh), ctxc); + }; + + iht(objects::ACS_SUBSYSTEM, acs::AcsMode::PTG_TARGET_GS, 0, EIVE_TABLE_PTG_TARGET_GS_TGT.second); + check(ss.addTable( + TableEntry(EIVE_TABLE_PTG_TARGET_GS_TGT.first, &EIVE_TABLE_PTG_TARGET_GS_TGT.second)), + ctxc); + + // Build PTG_TARGET_GS transition 0 + iht(objects::TCS_SUBSYSTEM, NML, 0, EIVE_TABLE_PTG_TARGET_GS_TRANS_0.second); + iht(objects::PL_SUBSYSTEM, OFF, 0, EIVE_TABLE_PTG_TARGET_GS_TRANS_0.second); + iht(objects::ACS_SUBSYSTEM, acs::AcsMode::PTG_TARGET_GS, 0, + EIVE_TABLE_PTG_TARGET_GS_TRANS_0.second); + check(ss.addTable(TableEntry(EIVE_TABLE_PTG_TARGET_GS_TRANS_0.first, + &EIVE_TABLE_PTG_TARGET_GS_TRANS_0.second)), + ctxc); + + // Build PTG_TARGET_GS sequence + ihs(EIVE_SEQUENCE_PTG_TARGET_GS.second, EIVE_TABLE_PTG_TARGET_GS_TGT.first, 0, false); + ihs(EIVE_SEQUENCE_PTG_TARGET_GS.second, EIVE_TABLE_PTG_TARGET_GS_TRANS_0.first, 0, false); + check( + ss.addSequence(SequenceEntry(EIVE_SEQUENCE_PTG_TARGET_GS.first, + &EIVE_SEQUENCE_PTG_TARGET_GS.second, EIVE_SEQUENCE_IDLE.first)), + ctxc); +} + +void buildPtgInertialSequence(Subsystem& ss, ModeListEntry& eh) { + std::string context = "satsystem::buildPtgInertialSequence"; + auto ctxc = context.c_str(); + // Insert Helper Table + auto iht = [&](object_id_t obj, Mode_t mode, Submode_t submode, ArrayList& table) { + eh.setObject(obj); + eh.setMode(mode); + eh.setSubmode(submode); + check(table.insert(eh), ctxc); + }; + // Insert Helper Sequence + auto ihs = [&](ArrayList& sequence, Mode_t tableId, uint32_t waitSeconds, + bool checkSuccess) { + eh.setTableId(tableId); + eh.setWaitSeconds(waitSeconds); + eh.setCheckSuccess(checkSuccess); + check(sequence.insert(eh), ctxc); + }; + + iht(objects::ACS_SUBSYSTEM, acs::AcsMode::PTG_INERTIAL, 0, EIVE_TABLE_PTG_INERTIAL_TGT.second); + check(ss.addTable( + TableEntry(EIVE_TABLE_PTG_INERTIAL_TGT.first, &EIVE_TABLE_PTG_INERTIAL_TGT.second)), + ctxc); + + // Build PTG_INERTIAL transition 0 + iht(objects::TCS_SUBSYSTEM, NML, 0, EIVE_TABLE_PTG_INERTIAL_TRANS_0.second); + iht(objects::PL_SUBSYSTEM, OFF, 0, EIVE_TABLE_PTG_INERTIAL_TRANS_0.second); + iht(objects::ACS_SUBSYSTEM, acs::AcsMode::PTG_INERTIAL, 0, + EIVE_TABLE_PTG_INERTIAL_TRANS_0.second); + check(ss.addTable(TableEntry(EIVE_TABLE_PTG_INERTIAL_TRANS_0.first, + &EIVE_TABLE_PTG_INERTIAL_TRANS_0.second)), + ctxc); + + // Build PTG_INERTIAL sequence + ihs(EIVE_SEQUENCE_PTG_INERTIAL.second, EIVE_TABLE_PTG_INERTIAL_TGT.first, 0, false); + ihs(EIVE_SEQUENCE_PTG_INERTIAL.second, EIVE_TABLE_PTG_INERTIAL_TRANS_0.first, 0, false); + check(ss.addSequence(SequenceEntry(EIVE_SEQUENCE_PTG_INERTIAL.first, + &EIVE_SEQUENCE_PTG_INERTIAL.second, EIVE_SEQUENCE_IDLE.first)), + ctxc); +} + } // namespace -- 2.43.0 From 9672d6d6cca3ad7369bb4b06fd91a7f17a0f9db9 Mon Sep 17 00:00:00 2001 From: Robin Mueller Date: Wed, 26 Apr 2023 11:11:09 +0200 Subject: [PATCH 02/36] changelog --- CHANGELOG.md | 6 ++++++ tmtc | 2 +- 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 756b0709..3c5127ae 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -16,6 +16,12 @@ will consitute of a breaking change warranting a new major release: # [unreleased] +# [v2.0.4] 2023-04-19 + +## Fixed + +- The dual lane assembly datasets were not marked invalid properly on OFF transitions. + # [v2.0.3] 2023-04-17 - eive-tmtc: v3.1.1 diff --git a/tmtc b/tmtc index 0c6a9677..5fbd19bb 160000 --- a/tmtc +++ b/tmtc @@ -1 +1 @@ -Subproject commit 0c6a9677e1b9b86456efff2e11ba31f99e15ac2a +Subproject commit 5fbd19bb6cca0790373a809d78f2307adca9d0c8 -- 2.43.0 From 4040304ef09a172f9d2bef42547d6b1effb8ca76 Mon Sep 17 00:00:00 2001 From: Robin Mueller Date: Wed, 26 Apr 2023 13:15:42 +0200 Subject: [PATCH 03/36] this is annoying --- bsp_hosted/ObjectFactory.cpp | 2 +- mission/genericFactory.cpp | 5 +++-- mission/genericFactory.h | 2 +- 3 files changed, 5 insertions(+), 4 deletions(-) diff --git a/bsp_hosted/ObjectFactory.cpp b/bsp_hosted/ObjectFactory.cpp index 3d618cdb..bdbd577b 100644 --- a/bsp_hosted/ObjectFactory.cpp +++ b/bsp_hosted/ObjectFactory.cpp @@ -64,7 +64,7 @@ void ObjectFactory::produce(void* args) { PersistentTmStores persistentStores; auto sdcMan = new DummySdCardManager("/tmp"); ObjectFactory::produceGenericObjects(nullptr, &pusFunnel, &cfdpFunnel, *sdcMan, &ipcStore, - &tmStore, persistentStores); + &tmStore, persistentStores, 120); auto* dummyGpioIF = new DummyGpioIF(); auto* dummySwitcher = new DummyPowerSwitcher(objects::PCDU_HANDLER, 18, 0); diff --git a/mission/genericFactory.cpp b/mission/genericFactory.cpp index 06f1220e..2dd00ee6 100644 --- a/mission/genericFactory.cpp +++ b/mission/genericFactory.cpp @@ -96,9 +96,10 @@ std::atomic_bool tcs::TCS_BOARD_SHORTLY_UNAVAILABLE = false; void ObjectFactory::produceGenericObjects(HealthTableIF** healthTable_, PusTmFunnel** pusFunnel, CfdpTmFunnel** cfdpFunnel, SdCardMountedIF& sdcMan, StorageManagerIF** ipcStore, StorageManagerIF** tmStore, - PersistentTmStores& stores) { + PersistentTmStores& stores, + uint32_t eventManagerQueueDepth) { // Framework objects - new EventManager(objects::EVENT_MANAGER, 160); + new EventManager(objects::EVENT_MANAGER, eventManagerQueueDepth); auto healthTable = new HealthTable(objects::HEALTH_TABLE); if (healthTable_ != nullptr) { *healthTable_ = healthTable; diff --git a/mission/genericFactory.h b/mission/genericFactory.h index 6cd2068d..a3a52704 100644 --- a/mission/genericFactory.h +++ b/mission/genericFactory.h @@ -45,7 +45,7 @@ namespace ObjectFactory { void produceGenericObjects(HealthTableIF** healthTable, PusTmFunnel** pusFunnel, CfdpTmFunnel** cfdpFunnel, SdCardMountedIF& sdcMan, StorageManagerIF** ipcStore, StorageManagerIF** tmStore, - PersistentTmStores& stores); + PersistentTmStores& stores, uint32_t eventManagerQueueDepth); void createGenericHeaterComponents(GpioIF& gpioIF, PowerSwitchIF& pwrSwitcher, HeaterHandler*& heaterHandler); -- 2.43.0 From 13142686823bedee1a79ae5f851f124968822a54 Mon Sep 17 00:00:00 2001 From: Robin Mueller Date: Wed, 26 Apr 2023 16:23:50 +0200 Subject: [PATCH 04/36] host build requires dedicated live TM task.. --- bsp_hosted/scheduling.cpp | 20 ++++++++++++-------- 1 file changed, 12 insertions(+), 8 deletions(-) diff --git a/bsp_hosted/scheduling.cpp b/bsp_hosted/scheduling.cpp index 0a5f1c35..5b9177f3 100644 --- a/bsp_hosted/scheduling.cpp +++ b/bsp_hosted/scheduling.cpp @@ -59,19 +59,15 @@ void scheduling::initTasks() { "DIST", 60, PeriodicTaskIF::MINIMUM_STACK_SIZE, 0.2, missedDeadlineFunc); ReturnValue_t result = tmtcDistributor->addComponent(objects::CCSDS_PACKET_DISTRIBUTOR); if (result != returnvalue::OK) { - sif::error << "adding CCSDS distributor failed" << std::endl; + sif::error << "Adding CCSDS distributor failed" << std::endl; } result = tmtcDistributor->addComponent(objects::PUS_PACKET_DISTRIBUTOR); if (result != returnvalue::OK) { - sif::error << "adding PUS distributor failed" << std::endl; - } - result = tmtcDistributor->addComponent(objects::TM_FUNNEL); - if (result != returnvalue::OK) { - sif::error << "adding TM funnel failed" << std::endl; + sif::error << "Adding PUS distributor failed" << std::endl; } result = tmtcDistributor->addComponent(objects::CFDP_DISTRIBUTOR); if (result != returnvalue::OK) { - sif::error << "adding CFDP distributor failed" << std::endl; + sif::error << "Adding CFDP distributor failed" << std::endl; } result = tmtcDistributor->addComponent(objects::UDP_TMTC_SERVER); if (result != returnvalue::OK) { @@ -94,6 +90,13 @@ void scheduling::initTasks() { if (result != returnvalue::OK) { sif::error << "Add component UDP Polling failed" << std::endl; } + // All the TM store tasks run in permanent loops, frequency does not matter + PeriodicTaskIF* liveTmTask = factory->createPeriodicTask( + "LIVE_TM", 55, PeriodicTaskIF::MINIMUM_STACK_SIZE, 1.0, nullptr, &RR_SCHEDULING); + result = liveTmTask->addComponent(objects::LIVE_TM_TASK); + if (result != returnvalue::OK) { + scheduling::printAddObjectError("LIVE_TM", objects::LIVE_TM_TASK); + } PeriodicTaskIF* pusHighPrio = factory->createPeriodicTask( "PUS_HIGH_PRIO", 60, PeriodicTaskIF::MINIMUM_STACK_SIZE, 0.200, missedDeadlineFunc); @@ -149,7 +152,7 @@ void scheduling::initTasks() { "THERMAL_CTL_TASK", 40, PeriodicTaskIF::MINIMUM_STACK_SIZE, 1.0, missedDeadlineFunc); result = thermalTask->addComponent(objects::CORE_CONTROLLER); if (result != returnvalue::OK) { - scheduling::printAddObjectError("Core controller dummy", objects::CORE_CONTROLLER); + scheduling::printAddObjectError("CORE_CTRL", objects::CORE_CONTROLLER); } result = thermalTask->addComponent(objects::THERMAL_CONTROLLER); if (result != returnvalue::OK) { @@ -217,6 +220,7 @@ void scheduling::initTasks() { tmtcDistributor->startTask(); udpPollingTask->startTask(); tcpPollingTask->startTask(); + liveTmTask->startTask(); pusHighPrio->startTask(); pusMedPrio->startTask(); -- 2.43.0 From 641b8e847d2b63ad11f28c4a37434a6161443690 Mon Sep 17 00:00:00 2001 From: Robin Mueller Date: Wed, 26 Apr 2023 16:41:40 +0200 Subject: [PATCH 05/36] add back tm funnel handler for hosted build --- bsp_hosted/ObjectFactory.cpp | 1 + 1 file changed, 1 insertion(+) diff --git a/bsp_hosted/ObjectFactory.cpp b/bsp_hosted/ObjectFactory.cpp index bdbd577b..d792b57b 100644 --- a/bsp_hosted/ObjectFactory.cpp +++ b/bsp_hosted/ObjectFactory.cpp @@ -66,6 +66,7 @@ void ObjectFactory::produce(void* args) { ObjectFactory::produceGenericObjects(nullptr, &pusFunnel, &cfdpFunnel, *sdcMan, &ipcStore, &tmStore, persistentStores, 120); + new TmFunnelHandler(objects::LIVE_TM_TASK, *pusFunnel, *cfdpFunnel); auto* dummyGpioIF = new DummyGpioIF(); auto* dummySwitcher = new DummyPowerSwitcher(objects::PCDU_HANDLER, 18, 0); std::vector switcherList; -- 2.43.0 From 7d630ebcf3894a9a9896d1c3f05548d5ef230333 Mon Sep 17 00:00:00 2001 From: Robin Mueller Date: Wed, 26 Apr 2023 17:00:04 +0200 Subject: [PATCH 06/36] EM adaptions --- bsp_q7s/em/emObjectFactory.cpp | 3 +++ dummies/helperFactory.cpp | 4 +++- dummies/helperFactory.h | 1 + 3 files changed, 7 insertions(+), 1 deletion(-) diff --git a/bsp_q7s/em/emObjectFactory.cpp b/bsp_q7s/em/emObjectFactory.cpp index 05a3fee0..96f541da 100644 --- a/bsp_q7s/em/emObjectFactory.cpp +++ b/bsp_q7s/em/emObjectFactory.cpp @@ -57,6 +57,9 @@ void ObjectFactory::produce(void* args) { #if OBSW_ADD_GOMSPACE_PCDU == 1 dummyCfg.addPowerDummies = false; #endif +#if OBSW_ADD_BPX_BATTERY_HANDLER == 1 + dummyCfg.addBpxBattDummy = false; +#endif #if OBSW_ADD_ACS_BOARD == 1 dummyCfg.addAcsBoardDummies = false; #endif diff --git a/dummies/helperFactory.cpp b/dummies/helperFactory.cpp index 98d2ecfa..ff18370a 100644 --- a/dummies/helperFactory.cpp +++ b/dummies/helperFactory.cpp @@ -45,7 +45,9 @@ void dummy::createDummies(DummyCfg cfg, PowerSwitchIF& pwrSwitcher, GpioIF* gpioIF) { new ComIFDummy(objects::DUMMY_COM_IF); auto* comCookieDummy = new ComCookieDummy(); - new BpxDummy(objects::BPX_BATT_HANDLER, objects::DUMMY_COM_IF, comCookieDummy); + if (cfg.addBpxBattDummy) { + new BpxDummy(objects::BPX_BATT_HANDLER, objects::DUMMY_COM_IF, comCookieDummy); + } if (cfg.addCoreCtrlCfg) { new CoreControllerDummy(objects::CORE_CONTROLLER); } diff --git a/dummies/helperFactory.h b/dummies/helperFactory.h index 2181c79c..dc272650 100644 --- a/dummies/helperFactory.h +++ b/dummies/helperFactory.h @@ -9,6 +9,7 @@ namespace dummy { struct DummyCfg { bool addCoreCtrlCfg = true; bool addPowerDummies = true; + bool addBpxBattDummy = true; bool addSyrlinksDummies = true; bool addAcsBoardDummies = true; bool addSusDummies = true; -- 2.43.0 From 83f07a6e16cbbf5fc4a9ccb2e7d92c3fdffb172b Mon Sep 17 00:00:00 2001 From: Robin Mueller Date: Wed, 26 Apr 2023 17:26:32 +0200 Subject: [PATCH 07/36] configurable event manager queue depth --- bsp_q7s/em/emObjectFactory.cpp | 3 ++- bsp_q7s/fmObjectFactory.cpp | 3 ++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/bsp_q7s/em/emObjectFactory.cpp b/bsp_q7s/em/emObjectFactory.cpp index 96f541da..0859b520 100644 --- a/bsp_q7s/em/emObjectFactory.cpp +++ b/bsp_q7s/em/emObjectFactory.cpp @@ -36,7 +36,8 @@ void ObjectFactory::produce(void* args) { PersistentTmStores stores; ObjectFactory::produceGenericObjects(&healthTable, &pusFunnel, &cfdpFunnel, - *SdCardManager::instance(), &ipcStore, &tmStore, stores); + *SdCardManager::instance(), &ipcStore, &tmStore, stores, + 200); LinuxLibgpioIF* gpioComIF = nullptr; SerialComIF* uartComIF = nullptr; diff --git a/bsp_q7s/fmObjectFactory.cpp b/bsp_q7s/fmObjectFactory.cpp index 5cb7c751..927c807e 100644 --- a/bsp_q7s/fmObjectFactory.cpp +++ b/bsp_q7s/fmObjectFactory.cpp @@ -32,7 +32,8 @@ void ObjectFactory::produce(void* args) { PersistentTmStores stores; ObjectFactory::produceGenericObjects(&healthTable, &pusFunnel, &cfdpFunnel, - *SdCardManager::instance(), &ipcStore, &tmStore, stores); + *SdCardManager::instance(), &ipcStore, &tmStore, stores, + 200); LinuxLibgpioIF* gpioComIF = nullptr; SerialComIF* uartComIF = nullptr; -- 2.43.0 From a296f16e5ce9d803ce5db54d9602e396dad7ebce Mon Sep 17 00:00:00 2001 From: Robin Mueller Date: Wed, 26 Apr 2023 17:36:38 +0200 Subject: [PATCH 08/36] host SW works properly again --- dummies/helperFactory.cpp | 8 ++++---- mission/scheduling.cpp | 10 ++++++---- 2 files changed, 10 insertions(+), 8 deletions(-) diff --git a/dummies/helperFactory.cpp b/dummies/helperFactory.cpp index ff18370a..e517426a 100644 --- a/dummies/helperFactory.cpp +++ b/dummies/helperFactory.cpp @@ -197,10 +197,10 @@ void dummy::createDummies(DummyCfg cfg, PowerSwitchIF& pwrSwitcher, GpioIF* gpio objects::TMP1075_HANDLER_PLPCDU_0, new Tmp1075Dummy(objects::TMP1075_HANDLER_PLPCDU_0, objects::DUMMY_COM_IF, comCookieDummy)); // damaged. - // tmpSensorDummies.emplace( - // objects::TMP1075_HANDLER_PLPCDU_1, - // new Tmp1075Dummy(objects::TMP1075_HANDLER_PLPCDU_1, objects::DUMMY_COM_IF, - // comCookieDummy)); + // tmpSensorDummies.emplace( + // objects::TMP1075_HANDLER_PLPCDU_1, + // new Tmp1075Dummy(objects::TMP1075_HANDLER_PLPCDU_1, objects::DUMMY_COM_IF, + // comCookieDummy)); tmpSensorDummies.emplace( objects::TMP1075_HANDLER_IF_BOARD, new Tmp1075Dummy(objects::TMP1075_HANDLER_IF_BOARD, objects::DUMMY_COM_IF, comCookieDummy)); diff --git a/mission/scheduling.cpp b/mission/scheduling.cpp index f89ce711..27a6417c 100644 --- a/mission/scheduling.cpp +++ b/mission/scheduling.cpp @@ -5,10 +5,12 @@ #include "fsfw/tasks/PeriodicTaskIF.h" void scheduling::scheduleTmpTempSensors(PeriodicTaskIF* tmpTask) { - const std::array tmpIds = { - objects::TMP1075_HANDLER_TCS_0, objects::TMP1075_HANDLER_TCS_1, - objects::TMP1075_HANDLER_PLPCDU_0, objects::TMP1075_HANDLER_PLPCDU_1, - objects::TMP1075_HANDLER_IF_BOARD}; + const std::array tmpIds = {objects::TMP1075_HANDLER_TCS_0, + objects::TMP1075_HANDLER_TCS_1, + objects::TMP1075_HANDLER_PLPCDU_0, + // damaged. + // objects::TMP1075_HANDLER_PLPCDU_1, + objects::TMP1075_HANDLER_IF_BOARD}; for (const auto& tmpId : tmpIds) { tmpTask->addComponent(tmpId, DeviceHandlerIF::PERFORM_OPERATION); tmpTask->addComponent(tmpId, DeviceHandlerIF::SEND_WRITE); -- 2.43.0 From 03762f962020b55188d445ee3dd429b6e1a32135 Mon Sep 17 00:00:00 2001 From: Robin Mueller Date: Wed, 26 Apr 2023 17:38:06 +0200 Subject: [PATCH 09/36] lower live TM handler frequency --- bsp_hosted/scheduling.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/bsp_hosted/scheduling.cpp b/bsp_hosted/scheduling.cpp index 5b9177f3..5fd53906 100644 --- a/bsp_hosted/scheduling.cpp +++ b/bsp_hosted/scheduling.cpp @@ -90,9 +90,9 @@ void scheduling::initTasks() { if (result != returnvalue::OK) { sif::error << "Add component UDP Polling failed" << std::endl; } - // All the TM store tasks run in permanent loops, frequency does not matter + PeriodicTaskIF* liveTmTask = factory->createPeriodicTask( - "LIVE_TM", 55, PeriodicTaskIF::MINIMUM_STACK_SIZE, 1.0, nullptr, &RR_SCHEDULING); + "LIVE_TM", 55, PeriodicTaskIF::MINIMUM_STACK_SIZE, 0.4, nullptr, &RR_SCHEDULING); result = liveTmTask->addComponent(objects::LIVE_TM_TASK); if (result != returnvalue::OK) { scheduling::printAddObjectError("LIVE_TM", objects::LIVE_TM_TASK); -- 2.43.0 From 2daca272f8f0397125349c0f6c193e22d0a26383 Mon Sep 17 00:00:00 2001 From: Robin Mueller Date: Thu, 27 Apr 2023 11:29:18 +0200 Subject: [PATCH 10/36] changelog --- CHANGELOG.md | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 3c5127ae..6658e0b5 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -16,6 +16,16 @@ will consitute of a breaking change warranting a new major release: # [unreleased] +## Changed + +- Event Manager queue depth is configurable now. +- Do not construct and schedule broken TMP1075 device anymore. + +## Fixed + +- Host build is working again. Added reduced live TM helper which schedules the PUS and CFDP + funnel. + # [v2.0.4] 2023-04-19 ## Fixed -- 2.43.0 From 6c326489cbc59f2d70993542f05676472ca0102f Mon Sep 17 00:00:00 2001 From: Robin Mueller Date: Fri, 28 Apr 2023 10:18:46 +0200 Subject: [PATCH 11/36] adapt EM SW: GS PCDU added, but use dummy for ACU --- CMakeLists.txt | 5 ++++- bsp_q7s/OBSWConfig.h.in | 3 +++ bsp_q7s/core/ObjectFactory.cpp | 7 +++++-- bsp_q7s/em/emObjectFactory.cpp | 4 +++- dummies/helperFactory.cpp | 3 ++- dummies/helperFactory.h | 3 +++ 6 files changed, 20 insertions(+), 5 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 8f632d2d..6f67e669 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -146,8 +146,11 @@ set(OBSW_ADD_TMP_DEVICES ${INIT_VAL} CACHE STRING "Add TMP devices") set(OBSW_ADD_GOMSPACE_PCDU - ${INIT_VAL} + 1 CACHE STRING "Add GomSpace PCDU modules") +set(OBSW_ADD_GOMSPACE_ACU + ${INIT_VAL} + CACHE STRING "Add GomSpace ACU submodule") set(OBSW_ADD_RW ${INIT_VAL} CACHE STRING "Add RW modules") diff --git a/bsp_q7s/OBSWConfig.h.in b/bsp_q7s/OBSWConfig.h.in index 3502a7bb..51ed8828 100644 --- a/bsp_q7s/OBSWConfig.h.in +++ b/bsp_q7s/OBSWConfig.h.in @@ -22,6 +22,9 @@ #define OBSW_COMMAND_SAFE_MODE_AT_STARTUP 1 #define OBSW_ADD_GOMSPACE_PCDU @OBSW_ADD_GOMSPACE_PCDU@ +// This define is necessary because the EM setup has the P60 dock module, but no ACU on the P60 +// module because it broke. +#define OBSW_ADD_GOMSPACE_ACU @OBSW_ADD_GOMSPACE_ACU@ #define OBSW_ADD_MGT @OBSW_ADD_MGT@ #define OBSW_ADD_BPX_BATTERY_HANDLER @OBSW_ADD_BPX_BATTERY_HANDLER@ #define OBSW_ADD_STAR_TRACKER @OBSW_ADD_STAR_TRACKER@ diff --git a/bsp_q7s/core/ObjectFactory.cpp b/bsp_q7s/core/ObjectFactory.cpp index 964d728b..dd363e3d 100644 --- a/bsp_q7s/core/ObjectFactory.cpp +++ b/bsp_q7s/core/ObjectFactory.cpp @@ -189,7 +189,6 @@ void ObjectFactory::createCommunicationInterfaces(LinuxLibgpioIF** gpioComIF, *i2cComIF = new I2cComIF(objects::I2C_COM_IF); *uartComIF = new SerialComIF(objects::UART_COM_IF); *spiMainComIF = new SpiComIF(objects::SPI_MAIN_COM_IF, q7s::SPI_DEFAULT_DEV, **gpioComIF); - //*spiRWComIF = new SpiComIF(objects::SPI_RW_COM_IF, q7s::SPI_RW_DEV, **gpioComIF); } void ObjectFactory::createPcduComponents(LinuxLibgpioIF* gpioComIF, PowerSwitchIF** pwrSwitcher, @@ -197,7 +196,6 @@ void ObjectFactory::createPcduComponents(LinuxLibgpioIF* gpioComIF, PowerSwitchI CspCookie* p60DockCspCookie = new CspCookie(P60Dock::MAX_REPLY_SIZE, addresses::P60DOCK, 500); CspCookie* pdu1CspCookie = new CspCookie(PDU::MAX_REPLY_SIZE, addresses::PDU1, 500); CspCookie* pdu2CspCookie = new CspCookie(PDU::MAX_REPLY_SIZE, addresses::PDU2, 500); - CspCookie* acuCspCookie = new CspCookie(ACU::MAX_REPLY_SIZE, addresses::ACU, 500); auto p60Fdir = new GomspacePowerFdir(objects::P60DOCK_HANDLER); P60DockHandler* p60dockhandler = new P60DockHandler(objects::P60DOCK_HANDLER, objects::CSP_COM_IF, @@ -211,9 +209,12 @@ void ObjectFactory::createPcduComponents(LinuxLibgpioIF* gpioComIF, PowerSwitchI Pdu2Handler* pdu2handler = new Pdu2Handler(objects::PDU2_HANDLER, objects::CSP_COM_IF, pdu2CspCookie, pdu2Fdir, enableHkSets); +#if OBSW_ADD_GOMSPACE_ACU == 1 + CspCookie* acuCspCookie = new CspCookie(ACU::MAX_REPLY_SIZE, addresses::ACU, 500); auto acuFdir = new GomspacePowerFdir(objects::ACU_HANDLER); ACUHandler* acuhandler = new ACUHandler(objects::ACU_HANDLER, objects::CSP_COM_IF, acuCspCookie, acuFdir, enableHkSets); +#endif auto pcduHandler = new PcduHandler(objects::PCDU_HANDLER, 50); /** @@ -223,7 +224,9 @@ void ObjectFactory::createPcduComponents(LinuxLibgpioIF* gpioComIF, PowerSwitchI p60dockhandler->setModeNormal(); pdu1handler->setModeNormal(); pdu2handler->setModeNormal(); +#if OBSW_ADD_GOMSPACE_ACU == 1 acuhandler->setModeNormal(); +#endif if (pwrSwitcher != nullptr) { *pwrSwitcher = pcduHandler; } diff --git a/bsp_q7s/em/emObjectFactory.cpp b/bsp_q7s/em/emObjectFactory.cpp index 05a3fee0..c0211478 100644 --- a/bsp_q7s/em/emObjectFactory.cpp +++ b/bsp_q7s/em/emObjectFactory.cpp @@ -56,6 +56,8 @@ void ObjectFactory::produce(void* args) { #endif #if OBSW_ADD_GOMSPACE_PCDU == 1 dummyCfg.addPowerDummies = false; + // The ACU broke. + dummyCfg.addOnlyAcuDummy = true; #endif #if OBSW_ADD_ACS_BOARD == 1 dummyCfg.addAcsBoardDummies = false; @@ -89,7 +91,7 @@ void ObjectFactory::produce(void* args) { // createRadSensorComponent(gpioComIF); #if OBSW_ADD_ACS_BOARD == 1 - createAcsBoardComponents(*spiMainComIF, gpioComIF, uartComIF, *pwrSwitcher); + createAcsBoardComponents(*spiMainComIF, gpioComIF, uartComIF, *pwrSwitcher, true); #else // Still add all GPIOs for EM. GpioCookie* acsBoardGpios = new GpioCookie(); diff --git a/dummies/helperFactory.cpp b/dummies/helperFactory.cpp index 98d2ecfa..bda847d7 100644 --- a/dummies/helperFactory.cpp +++ b/dummies/helperFactory.cpp @@ -75,8 +75,9 @@ void dummy::createDummies(DummyCfg cfg, PowerSwitchIF& pwrSwitcher, GpioIF* gpio auto* imtqDummy = new ImtqDummy(objects::IMTQ_HANDLER, objects::DUMMY_COM_IF, comCookieDummy); imtqDummy->enableThermalModule(ThermalStateCfg()); imtqDummy->connectModeTreeParent(*imtqAssy); - if (cfg.addPowerDummies) { + if (cfg.addOnlyAcuDummy) { new AcuDummy(objects::ACU_HANDLER, objects::DUMMY_COM_IF, comCookieDummy); + } else if (cfg.addPowerDummies) { new PduDummy(objects::PDU1_HANDLER, objects::DUMMY_COM_IF, comCookieDummy); new PduDummy(objects::PDU2_HANDLER, objects::DUMMY_COM_IF, comCookieDummy); new P60DockDummy(objects::P60DOCK_HANDLER, objects::DUMMY_COM_IF, comCookieDummy); diff --git a/dummies/helperFactory.h b/dummies/helperFactory.h index 2181c79c..e4953a32 100644 --- a/dummies/helperFactory.h +++ b/dummies/helperFactory.h @@ -6,8 +6,11 @@ class GpioIF; namespace dummy { +// Default values targeted towards EM. struct DummyCfg { bool addCoreCtrlCfg = true; + // Special variant because the ACU broke. Overrides addPowerDummies, only ACU dummy will be added. + bool addOnlyAcuDummy = false; bool addPowerDummies = true; bool addSyrlinksDummies = true; bool addAcsBoardDummies = true; -- 2.43.0 From a12794281bfc2ebb27a02bbc151696023e69a9f0 Mon Sep 17 00:00:00 2001 From: Robin Mueller Date: Fri, 28 Apr 2023 10:20:31 +0200 Subject: [PATCH 12/36] changelog --- CHANGELOG.md | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 3c5127ae..5de8f514 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -16,6 +16,11 @@ will consitute of a breaking change warranting a new major release: # [unreleased] +## Changed + +- Adapt EM configuration to include all GomSpace PCDU devices except the ACU. For the ACU + (which broke), a dummy will still be used. + # [v2.0.4] 2023-04-19 ## Fixed -- 2.43.0 From 74d5d70973b46c70d1483077e71e2820d3ca4ad6 Mon Sep 17 00:00:00 2001 From: Robin Mueller Date: Fri, 28 Apr 2023 13:58:08 +0200 Subject: [PATCH 13/36] this bugfix might be super important --- mission/system/acs/DualLaneAssemblyBase.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/mission/system/acs/DualLaneAssemblyBase.cpp b/mission/system/acs/DualLaneAssemblyBase.cpp index 7d22fbd1..dd9cef3c 100644 --- a/mission/system/acs/DualLaneAssemblyBase.cpp +++ b/mission/system/acs/DualLaneAssemblyBase.cpp @@ -183,11 +183,11 @@ void DualLaneAssemblyBase::handleModeTransitionFailed(ReturnValue_t result) { // transition to dual mode. if (not tryingOtherSide) { triggerEvent(CANT_KEEP_MODE, mode, submode); - startTransition(mode, nextSubmode); + startTransition(targetMode, nextSubmode); tryingOtherSide = true; } else { - triggerEvent(transitionOtherSideFailedEvent, mode, targetSubmode); - startTransition(mode, Submodes::DUAL_MODE); + triggerEvent(transitionOtherSideFailedEvent, targetMode, targetSubmode); + startTransition(targetMode, Submodes::DUAL_MODE); } } -- 2.43.0 From 02ea8a7298ff14c8acab55b2f693e8593c277624 Mon Sep 17 00:00:00 2001 From: Robin Mueller Date: Fri, 28 Apr 2023 14:22:21 +0200 Subject: [PATCH 14/36] changelog --- CHANGELOG.md | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 6658e0b5..6bc511cd 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -25,6 +25,11 @@ will consitute of a breaking change warranting a new major release: - Host build is working again. Added reduced live TM helper which schedules the PUS and CFDP funnel. +- The dual lane assembly transition failed handler started new transitions towards the current mode + instead of the target mode. This means that if the dual lane assembly never reached the initial + submode (e.g. mode normal and submode dual side), it will transition back to the current mode, + which is `MODE_OFF`. Furthermore, this lead to invalid internal states, so the subsequent + recovery handling becomes stuck in the custom recovery sequence when swichting power back on. # [v2.0.4] 2023-04-19 -- 2.43.0 From c66cef9129586e8708a8f2679ff86b3c9977c5f5 Mon Sep 17 00:00:00 2001 From: Robin Mueller Date: Fri, 28 Apr 2023 14:23:21 +0200 Subject: [PATCH 15/36] changelog --- CHANGELOG.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 6bc511cd..dbd5fbdd 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -28,7 +28,7 @@ will consitute of a breaking change warranting a new major release: - The dual lane assembly transition failed handler started new transitions towards the current mode instead of the target mode. This means that if the dual lane assembly never reached the initial submode (e.g. mode normal and submode dual side), it will transition back to the current mode, - which is `MODE_OFF`. Furthermore, this lead to invalid internal states, so the subsequent + which miht be `MODE_OFF`. Furthermore, this can lead to invalid internal states, so the subsequent recovery handling becomes stuck in the custom recovery sequence when swichting power back on. # [v2.0.4] 2023-04-19 -- 2.43.0 From 383849c5cb62b1543037ab07c904b2725c91be13 Mon Sep 17 00:00:00 2001 From: Robin Mueller Date: Fri, 28 Apr 2023 14:25:14 +0200 Subject: [PATCH 16/36] that is more robust --- mission/system/acs/DualLaneAssemblyBase.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/mission/system/acs/DualLaneAssemblyBase.cpp b/mission/system/acs/DualLaneAssemblyBase.cpp index dd9cef3c..dc97908f 100644 --- a/mission/system/acs/DualLaneAssemblyBase.cpp +++ b/mission/system/acs/DualLaneAssemblyBase.cpp @@ -205,7 +205,8 @@ bool DualLaneAssemblyBase::checkAndHandleRecovery() { opCode = pwrStateMachine.fsm(); if (opCode == OpCodes::TO_OFF_DONE or opCode == OpCodes::TIMEOUT_OCCURED) { customRecoveryStates = RecoveryCustomStates::POWER_SWITCHING_ON; - pwrStateMachine.start(targetMode, targetSubmode); + // Command power back on in any case. + pwrStateMachine.start(HasModesIF::MODE_ON, targetSubmode); } } if (customRecoveryStates == POWER_SWITCHING_ON) { -- 2.43.0 From b10275ca43f13ee68be013c7ece3b63acf762130 Mon Sep 17 00:00:00 2001 From: Robin Mueller Date: Fri, 28 Apr 2023 14:28:05 +0200 Subject: [PATCH 17/36] changelog --- CHANGELOG.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index dbd5fbdd..a0d085bd 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -30,6 +30,8 @@ will consitute of a breaking change warranting a new major release: submode (e.g. mode normal and submode dual side), it will transition back to the current mode, which miht be `MODE_OFF`. Furthermore, this can lead to invalid internal states, so the subsequent recovery handling becomes stuck in the custom recovery sequence when swichting power back on. +- The dual lane custom recovery handling was adapted to always perform proper power switch handling + irrespective of current or target modes. # [v2.0.4] 2023-04-19 -- 2.43.0 From 23796345d966787f6f43c1d89b9555413bfe583a Mon Sep 17 00:00:00 2001 From: Robin Mueller Date: Fri, 28 Apr 2023 15:04:30 +0200 Subject: [PATCH 18/36] changelog and stop payload tracking --- CHANGELOG.md | 1 + mission/system/systemTree.cpp | 6 ------ 2 files changed, 1 insertion(+), 6 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 6658e0b5..6c170ca0 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -20,6 +20,7 @@ will consitute of a breaking change warranting a new major release: - Event Manager queue depth is configurable now. - Do not construct and schedule broken TMP1075 device anymore. +- Do not track payload modes in system mode tables. ## Fixed diff --git a/mission/system/systemTree.cpp b/mission/system/systemTree.cpp index 1b5b6c4b..41bf3216 100644 --- a/mission/system/systemTree.cpp +++ b/mission/system/systemTree.cpp @@ -184,7 +184,6 @@ void buildSafeSequence(Subsystem& ss, ModeListEntry& eh) { // Do no track submode to allow transitions to DETUMBLE submode. iht(objects::ACS_SUBSYSTEM, acs::AcsMode::SAFE, 0, EIVE_TABLE_SAFE_TGT.second, true); - iht(objects::PL_SUBSYSTEM, OFF, 0, EIVE_TABLE_SAFE_TGT.second); check(ss.addTable(TableEntry(EIVE_TABLE_SAFE_TGT.first, &EIVE_TABLE_SAFE_TGT.second)), ctxc); // Build SAFE transition 0. @@ -226,7 +225,6 @@ void buildIdleSequence(Subsystem& ss, ModeListEntry& eh) { // Build IDLE transition 0 iht(objects::TCS_SUBSYSTEM, NML, 0, EIVE_TABLE_IDLE_TRANS_0.second); - iht(objects::PL_SUBSYSTEM, OFF, 0, EIVE_TABLE_IDLE_TRANS_0.second); iht(objects::ACS_SUBSYSTEM, acs::AcsMode::PTG_IDLE, 0, EIVE_TABLE_IDLE_TRANS_0.second); check(ss.addTable(TableEntry(EIVE_TABLE_IDLE_TRANS_0.first, &EIVE_TABLE_IDLE_TRANS_0.second)), ctxc); @@ -264,7 +262,6 @@ void buildPtgNadirSequence(Subsystem& ss, ModeListEntry& eh) { // Build PTG_NADIR transition 0 iht(objects::TCS_SUBSYSTEM, NML, 0, EIVE_TABLE_PTG_NADIR_TRANS_0.second); - iht(objects::PL_SUBSYSTEM, OFF, 0, EIVE_TABLE_PTG_NADIR_TRANS_0.second); iht(objects::ACS_SUBSYSTEM, acs::AcsMode::PTG_NADIR, 0, EIVE_TABLE_PTG_NADIR_TRANS_0.second); check(ss.addTable( TableEntry(EIVE_TABLE_PTG_NADIR_TRANS_0.first, &EIVE_TABLE_PTG_NADIR_TRANS_0.second)), @@ -303,7 +300,6 @@ void buildPtgTargetSequence(Subsystem& ss, ModeListEntry& eh) { // Build PTG_TARGET transition 0 iht(objects::TCS_SUBSYSTEM, NML, 0, EIVE_TABLE_PTG_TARGET_TRANS_0.second); - iht(objects::PL_SUBSYSTEM, OFF, 0, EIVE_TABLE_PTG_TARGET_TRANS_0.second); iht(objects::ACS_SUBSYSTEM, acs::AcsMode::PTG_TARGET, 0, EIVE_TABLE_PTG_TARGET_TRANS_0.second); check(ss.addTable( TableEntry(EIVE_TABLE_PTG_TARGET_TRANS_0.first, &EIVE_TABLE_PTG_TARGET_TRANS_0.second)), @@ -343,7 +339,6 @@ void buildPtgTargetGsSequence(Subsystem& ss, ModeListEntry& eh) { // Build PTG_TARGET_GS transition 0 iht(objects::TCS_SUBSYSTEM, NML, 0, EIVE_TABLE_PTG_TARGET_GS_TRANS_0.second); - iht(objects::PL_SUBSYSTEM, OFF, 0, EIVE_TABLE_PTG_TARGET_GS_TRANS_0.second); iht(objects::ACS_SUBSYSTEM, acs::AcsMode::PTG_TARGET_GS, 0, EIVE_TABLE_PTG_TARGET_GS_TRANS_0.second); check(ss.addTable(TableEntry(EIVE_TABLE_PTG_TARGET_GS_TRANS_0.first, @@ -385,7 +380,6 @@ void buildPtgInertialSequence(Subsystem& ss, ModeListEntry& eh) { // Build PTG_INERTIAL transition 0 iht(objects::TCS_SUBSYSTEM, NML, 0, EIVE_TABLE_PTG_INERTIAL_TRANS_0.second); - iht(objects::PL_SUBSYSTEM, OFF, 0, EIVE_TABLE_PTG_INERTIAL_TRANS_0.second); iht(objects::ACS_SUBSYSTEM, acs::AcsMode::PTG_INERTIAL, 0, EIVE_TABLE_PTG_INERTIAL_TRANS_0.second); check(ss.addTable(TableEntry(EIVE_TABLE_PTG_INERTIAL_TRANS_0.first, -- 2.43.0 From 37b9615525637294118266910979236127f8a8ce Mon Sep 17 00:00:00 2001 From: Robin Mueller Date: Fri, 28 Apr 2023 15:18:16 +0200 Subject: [PATCH 19/36] changelog --- CHANGELOG.md | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 6c170ca0..712facce 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -22,6 +22,10 @@ will consitute of a breaking change warranting a new major release: - Do not construct and schedule broken TMP1075 device anymore. - Do not track payload modes in system mode tables. +## Added + +- Add the remaining system modes derives from the ACS modes. + ## Fixed - Host build is working again. Added reduced live TM helper which schedules the PUS and CFDP -- 2.43.0 From 7045b6034afdb819f4978f91f697d7f23806ab89 Mon Sep 17 00:00:00 2001 From: Robin Mueller Date: Fri, 28 Apr 2023 15:18:47 +0200 Subject: [PATCH 20/36] changelog --- CHANGELOG.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 712facce..307f5f74 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -24,7 +24,7 @@ will consitute of a breaking change warranting a new major release: ## Added -- Add the remaining system modes derives from the ACS modes. +- Add the remaining system modes derived from the ACS modes. ## Fixed -- 2.43.0 From 14baa3563c3dc6499bac49bb83c08ba98bfad171 Mon Sep 17 00:00:00 2001 From: Robin Mueller Date: Fri, 28 Apr 2023 15:30:09 +0200 Subject: [PATCH 21/36] hello --- CHANGELOG.md | 3 ++- mission/acs/defs.h | 13 +++++++------ mission/sysDefs.h | 21 +++++++++++++-------- 3 files changed, 22 insertions(+), 15 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 307f5f74..b4e6659e 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -21,10 +21,11 @@ will consitute of a breaking change warranting a new major release: - Event Manager queue depth is configurable now. - Do not construct and schedule broken TMP1075 device anymore. - Do not track payload modes in system mode tables. +- ACS modes derived from system modes. ## Added -- Add the remaining system modes derived from the ACS modes. +- Add the remaining system modes. ## Fixed diff --git a/mission/acs/defs.h b/mission/acs/defs.h index 7748562d..41d09976 100644 --- a/mission/acs/defs.h +++ b/mission/acs/defs.h @@ -3,6 +3,7 @@ #include #include +#include namespace acs { @@ -11,12 +12,12 @@ enum class SimpleSensorMode { NORMAL = 0, OFF = 1 }; // These modes are the modes of the ACS controller and of the ACS subsystem. enum AcsMode : Mode_t { OFF = HasModesIF::MODE_OFF, - SAFE = 10, - PTG_IDLE = 11, - PTG_NADIR = 12, - PTG_TARGET = 13, - PTG_TARGET_GS = 14, - PTG_INERTIAL = 15, + SAFE = satsystem::Mode::SAFE, + PTG_IDLE = satsystem::Mode::PTG_IDLE, + PTG_NADIR = satsystem::Mode::PTG_NADIR, + PTG_TARGET = satsystem::Mode::PTG_TARGET, + PTG_TARGET_GS = satsystem::Mode::PTG_TARGET_GS, + PTG_INERTIAL = satsystem::Mode::PTG_INERTIAL, }; enum SafeSubmode : Submode_t { DEFAULT = 0, DETUMBLE = 1 }; diff --git a/mission/sysDefs.h b/mission/sysDefs.h index a74cf369..c84c237f 100644 --- a/mission/sysDefs.h +++ b/mission/sysDefs.h @@ -1,9 +1,13 @@ #ifndef MISSION_SYSDEFS_H_ #define MISSION_SYSDEFS_H_ -#include +#include +#include +#include +#include -#include "acs/defs.h" +#include +#include extern std::atomic_uint16_t I2C_FATAL_ERRORS; @@ -11,12 +15,13 @@ namespace satsystem { enum Mode : Mode_t { BOOT = 5, - SAFE = acs::AcsMode::SAFE, - PTG_IDLE = acs::AcsMode::PTG_IDLE, - PTG_NADIR = acs::AcsMode::PTG_NADIR, - PTG_TARGET = acs::AcsMode::PTG_TARGET, - PTG_TARGET_GS = acs::AcsMode::PTG_TARGET_GS, - PTG_INERTIAL = acs::AcsMode::PTG_INERTIAL, + // DO NOT CHANGE THE ORDER starting from here, breaks ACS mode checks. + SAFE = 10, + PTG_IDLE = 11, + PTG_NADIR = 12, + PTG_TARGET = 13, + PTG_TARGET_GS = 14, + PTG_INERTIAL = 15, }; } -- 2.43.0 From a17f57cbb587f960366baae7059309d18619cdc4 Mon Sep 17 00:00:00 2001 From: Robin Mueller Date: Fri, 28 Apr 2023 15:34:45 +0200 Subject: [PATCH 22/36] changelog --- CHANGELOG.md | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index a0d085bd..ba80d0fe 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -16,6 +16,10 @@ will consitute of a breaking change warranting a new major release: # [unreleased] +# [v2.2.0] to be released + +# [v2.1.0] to be released + ## Changed - Event Manager queue depth is configurable now. @@ -25,6 +29,9 @@ will consitute of a breaking change warranting a new major release: - Host build is working again. Added reduced live TM helper which schedules the PUS and CFDP funnel. + +# [v2.0.5] to be released + - The dual lane assembly transition failed handler started new transitions towards the current mode instead of the target mode. This means that if the dual lane assembly never reached the initial submode (e.g. mode normal and submode dual side), it will transition back to the current mode, -- 2.43.0 From 8e1b5d034fa1237505f50df495096085caa2f618 Mon Sep 17 00:00:00 2001 From: Robin Mueller Date: Tue, 2 May 2023 13:42:20 +0200 Subject: [PATCH 23/36] add HK request command --- linux/payload/PlocMpsocHandler.cpp | 47 ++++++++++++++++++++++++++---- linux/payload/PlocMpsocHandler.h | 9 ++---- linux/payload/plocMpscoDefs.h | 14 +++++++++ 3 files changed, 58 insertions(+), 12 deletions(-) diff --git a/linux/payload/PlocMpsocHandler.cpp b/linux/payload/PlocMpsocHandler.cpp index 72f2355f..29656c59 100644 --- a/linux/payload/PlocMpsocHandler.cpp +++ b/linux/payload/PlocMpsocHandler.cpp @@ -247,6 +247,10 @@ ReturnValue_t PlocMPSoCHandler::buildCommandFromCommand(DeviceCommandId_t device result = prepareTcReplayWriteSequence(commandData, commandDataLen); break; } + case (mpsoc::TC_GET_HK_REPORT): { + result = prepareTcGetHkReport(); + break; + } case (mpsoc::TC_MODE_REPLAY): { result = prepareTcModeReplay(); break; @@ -304,6 +308,7 @@ 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::TC_GET_HK_REPORT); this->insertInCommandMap(mpsoc::RELEASE_UART_TX); this->insertInCommandMap(mpsoc::SET_UART_TX_TRISTATE); this->insertInCommandMap(mpsoc::TC_CAM_TAKE_PIC); @@ -313,6 +318,7 @@ void PlocMPSoCHandler::fillCommandAndReplyMap() { 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); + this->insertInReplyMap(mpsoc::TM_GET_HK_REPORT, 2, nullptr, 0); this->insertInReplyMap(mpsoc::TM_CAM_CMD_RPT, 2, nullptr, mpsoc::SP_MAX_SIZE); } @@ -346,9 +352,15 @@ ReturnValue_t PlocMPSoCHandler::scanForReply(const uint8_t* start, size_t remain break; case (mpsoc::apid::TM_CAM_CMD_RPT): *foundLen = spacePacket.getFullPacketLen(); - tmCamCmdRpt.rememberSpacePacketSize = *foundLen; + foundPacketLen = *foundLen; *foundId = mpsoc::TM_CAM_CMD_RPT; break; + case (mpsoc::apid::TM_HK_GET_REPORT): { + *foundLen = spacePacket.getFullPacketLen(); + foundPacketLen = *foundLen; + *foundId = mpsoc::TM_GET_HK_REPORT; + break; + } case (mpsoc::apid::EXE_SUCCESS): *foundLen = mpsoc::SIZE_EXE_REPORT; *foundId = mpsoc::EXE_REPORT; @@ -386,6 +398,10 @@ ReturnValue_t PlocMPSoCHandler::interpretDeviceReply(DeviceCommandId_t id, const result = handleMemoryReadReport(packet); break; } + case (mpsoc::TM_GET_HK_REPORT): { + result = handleGetHkReport(packet); + break; + } case (mpsoc::TM_CAM_CMD_RPT): { result = handleCamCmdRpt(packet); break; @@ -512,6 +528,17 @@ ReturnValue_t PlocMPSoCHandler::prepareTcDownlinkPwrOff() { return returnvalue::OK; } +ReturnValue_t PlocMPSoCHandler::prepareTcGetHkReport() { + ReturnValue_t result = returnvalue::OK; + mpsoc::TcGetHkReport tcDownlinkPwrOff(spParams, sequenceCount); + result = tcDownlinkPwrOff.buildPacket(); + if (result != returnvalue::OK) { + return result; + } + finishTcPrep(tcDownlinkPwrOff.getFullPacketLen()); + return returnvalue::OK; +} + ReturnValue_t PlocMPSoCHandler::prepareTcReplayWriteSequence(const uint8_t* commandData, size_t commandDataLen) { ReturnValue_t result = returnvalue::OK; @@ -724,17 +751,25 @@ ReturnValue_t PlocMPSoCHandler::handleMemoryReadReport(const uint8_t* data) { return result; } +ReturnValue_t PlocMPSoCHandler::handleGetHkReport(const uint8_t* data) { + ReturnValue_t result = verifyPacket(data, foundPacketLen); + if (result != returnvalue::OK) { + return result; + } + SpacePacketReader packetReader(data, foundPacketLen); + return returnvalue::OK; +} + ReturnValue_t PlocMPSoCHandler::handleCamCmdRpt(const uint8_t* data) { ReturnValue_t result = returnvalue::OK; - result = verifyPacket(data, tmCamCmdRpt.rememberSpacePacketSize); + ReturnValue_t result = verifyPacket(data, foundPacketLen); if (result == MPSoCReturnValuesIF::CRC_FAILURE) { sif::warning << "PlocMPSoCHandler::handleCamCmdRpt: CRC failure" << std::endl; } - SpacePacketReader packetReader(data, tmCamCmdRpt.rememberSpacePacketSize); + SpacePacketReader packetReader(data, foundPacketLen); const uint8_t* dataFieldPtr = data + mpsoc::SPACE_PACKET_HEADER_SIZE + sizeof(uint16_t); - std::string camCmdRptMsg( - reinterpret_cast(dataFieldPtr), - tmCamCmdRpt.rememberSpacePacketSize - mpsoc::SPACE_PACKET_HEADER_SIZE - sizeof(uint16_t) - 3); + std::string camCmdRptMsg(reinterpret_cast(dataFieldPtr), + foundPacketLen - mpsoc::SPACE_PACKET_HEADER_SIZE - sizeof(uint16_t) - 3); #if OBSW_DEBUG_PLOC_MPSOC == 1 uint8_t ackValue = *(packetReader.getFullData() + packetReader.getFullPacketLen() - 2); sif::info << "PlocMPSoCHandler: CamCmdRpt message: " << camCmdRptMsg << std::endl; diff --git a/linux/payload/PlocMpsocHandler.h b/linux/payload/PlocMpsocHandler.h index 10e6bd5d..e11f05eb 100644 --- a/linux/payload/PlocMpsocHandler.h +++ b/linux/payload/PlocMpsocHandler.h @@ -138,17 +138,12 @@ class PlocMPSoCHandler : public DeviceHandlerBase, public CommandsActionsIF { TmMemReadReport tmMemReadReport; - struct TmCamCmdRpt { - size_t rememberSpacePacketSize = 0; - }; - - TmCamCmdRpt tmCamCmdRpt; - struct TelemetryBuffer { uint16_t length = 0; uint8_t buffer[mpsoc::SP_MAX_SIZE]; }; + size_t foundPacketLen = 0; TelemetryBuffer tmBuffer; enum class PowerState { OFF, BOOTING, SHUTDOWN, ON }; @@ -167,6 +162,7 @@ class PlocMPSoCHandler : public DeviceHandlerBase, public CommandsActionsIF { ReturnValue_t prepareTcReplayStop(); ReturnValue_t prepareTcDownlinkPwrOn(const uint8_t* commandData, size_t commandDataLen); ReturnValue_t prepareTcDownlinkPwrOff(); + ReturnValue_t prepareTcGetHkReport(); ReturnValue_t prepareTcReplayWriteSequence(const uint8_t* commandData, size_t commandDataLen); ReturnValue_t prepareTcCamCmdSend(const uint8_t* commandData, size_t commandDataLen); ReturnValue_t prepareTcModeIdle(); @@ -213,6 +209,7 @@ class PlocMPSoCHandler : public DeviceHandlerBase, public CommandsActionsIF { */ ReturnValue_t handleMemoryReadReport(const uint8_t* data); + ReturnValue_t handleGetHkReport(const uint8_t* data); ReturnValue_t handleCamCmdRpt(const uint8_t* data); /** diff --git a/linux/payload/plocMpscoDefs.h b/linux/payload/plocMpscoDefs.h index 975dad32..e6acf4bf 100644 --- a/linux/payload/plocMpscoDefs.h +++ b/linux/payload/plocMpscoDefs.h @@ -37,6 +37,8 @@ static const DeviceCommandId_t TC_CAM_TAKE_PIC = 22; static const DeviceCommandId_t TC_SIMPLEX_SEND_FILE = 23; static const DeviceCommandId_t TC_DOWNLINK_DATA_MODULATE = 24; static const DeviceCommandId_t TC_MODE_SNAPSHOT = 25; +static const DeviceCommandId_t TC_GET_HK_REPORT = 26; +static const DeviceCommandId_t TM_GET_HK_REPORT = 27; // Will reset the sequence count of the OBSW static const DeviceCommandId_t OBSW_RESET_SEQ_COUNT = 50; @@ -45,6 +47,7 @@ static const uint16_t SIZE_ACK_REPORT = 14; static const uint16_t SIZE_EXE_REPORT = 14; static const uint16_t SIZE_TM_MEM_READ_REPORT = 18; static const uint16_t SIZE_TM_CAM_CMD_RPT = 18; +static constexpr size_t SIZE_TM_HK_REPORT = 369; /** * SpacePacket apids of PLOC telecommands and telemetry. @@ -65,6 +68,8 @@ static const uint16_t TC_MODE_IDLE = 0x11E; static const uint16_t TC_MODE_REPLAY = 0x11F; static const uint16_t TC_MODE_SNAPSHOT = 0x120; static const uint16_t TC_DOWNLINK_DATA_MODULATE = 0x121; +static constexpr uint16_t TC_HK_GET_REPORT = 0x123; +static constexpr uint16_t TM_HK_GET_REPORT = 0x408; static const uint16_t TC_DOWNLINK_PWR_OFF = 0x124; static const uint16_t TC_CAM_CMD_SEND = 0x12C; static const uint16_t TC_SIMPLEX_SEND_FILE = 0x130; @@ -561,6 +566,15 @@ class TcDownlinkPwrOn : public TcBase { } }; +/** + * @brief Class to build replay stop space packet. + */ +class TcGetHkReport : public TcBase { + public: + TcGetHkReport(ploc::SpTcParams params, uint16_t sequenceCount) + : TcBase(params, apid::TC_HK_GET_REPORT, sequenceCount) {} +}; + /** * @brief Class to build replay stop space packet. */ -- 2.43.0 From 76cd602bd4c9c9f5e67c32ad8261c4ccf03c71ce Mon Sep 17 00:00:00 2001 From: Robin Mueller Date: Tue, 2 May 2023 15:04:14 +0200 Subject: [PATCH 24/36] add new set --- linux/payload/PlocMpsocHandler.cpp | 44 +++++++++++- linux/payload/PlocMpsocHandler.h | 40 ++++++++++- linux/payload/plocMpscoDefs.h | 103 +++++++++++++++++++++++++++++ mission/tcs/Tmp1075Definitions.h | 2 +- 4 files changed, 186 insertions(+), 3 deletions(-) diff --git a/linux/payload/PlocMpsocHandler.cpp b/linux/payload/PlocMpsocHandler.cpp index 29656c59..b0c56667 100644 --- a/linux/payload/PlocMpsocHandler.cpp +++ b/linux/payload/PlocMpsocHandler.cpp @@ -11,6 +11,7 @@ PlocMPSoCHandler::PlocMPSoCHandler(object_id_t objectId, object_id_t uartComIFid CookieIF* comCookie, PlocMPSoCHelper* plocMPSoCHelper, Gpio uartIsolatorSwitch, object_id_t supervisorHandler) : DeviceHandlerBase(objectId, uartComIFid, comCookie), + hkReport(this), plocMPSoCHelper(plocMPSoCHelper), uartIsolatorSwitch(uartIsolatorSwitch), supervisorHandler(supervisorHandler), @@ -425,6 +426,41 @@ uint32_t PlocMPSoCHandler::getTransitionDelayMs(Mode_t modeFrom, Mode_t modeTo) ReturnValue_t PlocMPSoCHandler::initializeLocalDataPool(localpool::DataPool& localDataPoolMap, LocalDataPoolManager& poolManager) { + localDataPoolMap.emplace(mpsoc::poolid::STATUS, &peStatus); + localDataPoolMap.emplace(mpsoc::poolid::MODE, &peMode); + localDataPoolMap.emplace(mpsoc::poolid::MODE, &peMode); + localDataPoolMap.emplace(mpsoc::poolid::DOWNLINK_PWR_ON, &peDownlinkPwrOn); + localDataPoolMap.emplace(mpsoc::poolid::DOWNLINK_JESD_SYNC_STATUS, &peDownlinkJesdSyncStatus); + localDataPoolMap.emplace(mpsoc::poolid::DOWNLINK_DAC_STATUS, &peDownlinkDacStatus); + localDataPoolMap.emplace(mpsoc::poolid::CAM_STATUS, &peCameraStatus); + localDataPoolMap.emplace(mpsoc::poolid::CAM_SDI_STATUS, &peCameraSdiStatus); + localDataPoolMap.emplace(mpsoc::poolid::CAM_FPGA_TEMP, &peCameraFpgaTemp); + localDataPoolMap.emplace(mpsoc::poolid::CAM_SOC_TEMP, &peCameraSocTemp); + localDataPoolMap.emplace(mpsoc::poolid::SYSMON_TEMP, &peSysmonTemp); + localDataPoolMap.emplace(mpsoc::poolid::SYSMON_VCCINT, &peSysmonVccInt); + localDataPoolMap.emplace(mpsoc::poolid::SYSMON_VCCAUX, &peSysmonVccAux); + localDataPoolMap.emplace(mpsoc::poolid::SYSMON_VCCBRAM, &peSysmonVccBram); + localDataPoolMap.emplace(mpsoc::poolid::SYSMON_VCCPAUX, &peSysmonVccPaux); + localDataPoolMap.emplace(mpsoc::poolid::SYSMON_VCCPINT, &peSysmonVccPint); + localDataPoolMap.emplace(mpsoc::poolid::SYSMON_VCCPDRO, &peSysmonVccPdro); + localDataPoolMap.emplace(mpsoc::poolid::SYSMON_MB12V, &peSysmonMb12V); + localDataPoolMap.emplace(mpsoc::poolid::SYSMON_MB3V3, &peSysmonMb3V3); + localDataPoolMap.emplace(mpsoc::poolid::SYSMON_MB1V8, &peSysmonMb1V8); + localDataPoolMap.emplace(mpsoc::poolid::SYSMON_VCC12V, &peSysmonVcc12V); + localDataPoolMap.emplace(mpsoc::poolid::SYSMON_VCC3V3, &peSysmonVcc3V3); + localDataPoolMap.emplace(mpsoc::poolid::SYSMON_VCC3V3VA, &peSysmonVcc3V3VA); + localDataPoolMap.emplace(mpsoc::poolid::SYSMON_VCC2V5DDR, &peSysmonVcc2V5DDR); + localDataPoolMap.emplace(mpsoc::poolid::SYSMON_VCC1V2DDR, &peSysmonVcc1V2DDR); + localDataPoolMap.emplace(mpsoc::poolid::SYSMON_VCC0V9, &peSysmonVcc0V9); + localDataPoolMap.emplace(mpsoc::poolid::SYSMON_VCC0V6VTT, &peSysmonVcc0V6VTT); + localDataPoolMap.emplace(mpsoc::poolid::SYSMON_SAFE_COTS_CUR, &peSysmonSafeCotsCur); + localDataPoolMap.emplace(mpsoc::poolid::SYSMON_NVM4_XO_CUR, &peSysmonNvm4XoCur); + localDataPoolMap.emplace(mpsoc::poolid::SEM_UNCORRECTABLE_ERRS, &peSemUncorrectableErrs); + localDataPoolMap.emplace(mpsoc::poolid::SEM_CORRECTABLE_ERRS, &peSemCorrectableErrs); + localDataPoolMap.emplace(mpsoc::poolid::SEM_STATUS, &peSemStatus); + localDataPoolMap.emplace(mpsoc::poolid::REBOOT_MPSOC_REQUIRED, &peRebootMpsocRequired); + poolManager.subscribeForRegularPeriodicPacket( + subdp::RegularHkPeriodicParams(hkReport.getSid(), false, 10.0)); return returnvalue::OK; } @@ -761,7 +797,6 @@ ReturnValue_t PlocMPSoCHandler::handleGetHkReport(const uint8_t* data) { } ReturnValue_t PlocMPSoCHandler::handleCamCmdRpt(const uint8_t* data) { - ReturnValue_t result = returnvalue::OK; ReturnValue_t result = verifyPacket(data, foundPacketLen); if (result == MPSoCReturnValuesIF::CRC_FAILURE) { sif::warning << "PlocMPSoCHandler::handleCamCmdRpt: CRC failure" << std::endl; @@ -1143,6 +1178,13 @@ void PlocMPSoCHandler::handleActionCommandFailure(ActionId_t actionId) { return; } +LocalPoolDataSetBase* PlocMPSoCHandler::getDataSetHandle(sid_t sid) { + if (sid == hkReport.getSid()) { + return &hkReport; + } + return nullptr; +} + std::string PlocMPSoCHandler::getStatusString(uint16_t status) { switch (status) { case (mpsoc::status_code::UNKNOWN_APID): { diff --git a/linux/payload/PlocMpsocHandler.h b/linux/payload/PlocMpsocHandler.h index e11f05eb..c9850e18 100644 --- a/linux/payload/PlocMpsocHandler.h +++ b/linux/payload/PlocMpsocHandler.h @@ -77,7 +77,8 @@ class PlocMPSoCHandler : public DeviceHandlerBase, public CommandsActionsIF { uint8_t expectedReplies = 1, bool useAlternateId = false, DeviceCommandId_t alternateReplyID = 0) override; size_t getNextReplyLength(DeviceCommandId_t deviceCommand) override; - virtual ReturnValue_t doSendReadHook() override; + ReturnValue_t doSendReadHook() override; + LocalPoolDataSetBase* getDataSetHandle(sid_t sid) override; private: static const uint8_t SUBSYSTEM_ID = SUBSYSTEM_ID::PLOC_MPSOC_HANDLER; @@ -105,6 +106,8 @@ class PlocMPSoCHandler : public DeviceHandlerBase, public CommandsActionsIF { static const uint16_t PACKET_SEQUENCE_COUNT_MASK = 0x3FFF; static const uint8_t STATUS_OFFSET = 10; + mpsoc::HkReport hkReport; + MessageQueueIF* eventQueue = nullptr; MessageQueueIF* commandActionHelperQueue = nullptr; @@ -114,6 +117,41 @@ class PlocMPSoCHandler : public DeviceHandlerBase, public CommandsActionsIF { SpacePacketCreator creator; ploc::SpTcParams spParams = ploc::SpTcParams(creator); + PoolEntry peStatus = PoolEntry(); + PoolEntry peMode = PoolEntry(); + PoolEntry peDownlinkPwrOn = PoolEntry(); + PoolEntry peDownlinkReplyActive = PoolEntry(); + PoolEntry peDownlinkJesdSyncStatus = PoolEntry(); + PoolEntry peDownlinkDacStatus = PoolEntry(); + PoolEntry peCameraStatus = PoolEntry(); + PoolEntry peCameraSdiStatus = PoolEntry(); + PoolEntry peCameraFpgaTemp = PoolEntry(); + PoolEntry peCameraSocTemp = PoolEntry(); + PoolEntry peSysmonTemp = PoolEntry(); + PoolEntry peSysmonVccInt = PoolEntry(); + PoolEntry peSysmonVccAux = PoolEntry(); + PoolEntry peSysmonVccBram = PoolEntry(); + PoolEntry peSysmonVccPaux = PoolEntry(); + PoolEntry peSysmonVccPint = PoolEntry(); + PoolEntry peSysmonVccPdro = PoolEntry(); + PoolEntry peSysmonMb12V = PoolEntry(); + PoolEntry peSysmonMb3V3 = PoolEntry(); + PoolEntry peSysmonMb1V8 = PoolEntry(); + PoolEntry peSysmonVcc12V = PoolEntry(); + PoolEntry peSysmonVcc5V = PoolEntry(); + PoolEntry peSysmonVcc3V3 = PoolEntry(); + PoolEntry peSysmonVcc3V3VA = PoolEntry(); + PoolEntry peSysmonVcc2V5DDR = PoolEntry(); + PoolEntry peSysmonVcc1V2DDR = PoolEntry(); + PoolEntry peSysmonVcc0V9 = PoolEntry(); + PoolEntry peSysmonVcc0V6VTT = PoolEntry(); + PoolEntry peSysmonSafeCotsCur = PoolEntry(); + PoolEntry peSysmonNvm4XoCur = PoolEntry(); + PoolEntry peSemUncorrectableErrs = PoolEntry(); + PoolEntry peSemCorrectableErrs = PoolEntry(); + PoolEntry peSemStatus = PoolEntry(); + PoolEntry peRebootMpsocRequired = PoolEntry(); + /** * This variable is used to store the id of the next reply to receive. This is necessary * because the PLOC sends as reply to each command at least one acknowledgment and execution diff --git a/linux/payload/plocMpscoDefs.h b/linux/payload/plocMpscoDefs.h index e6acf4bf..1ef72bf5 100644 --- a/linux/payload/plocMpscoDefs.h +++ b/linux/payload/plocMpscoDefs.h @@ -1,6 +1,7 @@ #ifndef MISSION_DEVICES_DEVICEDEFINITIONS_PLOCMPSOCDEFINITIONS_H_ #define MISSION_DEVICES_DEVICEDEFINITIONS_PLOCMPSOCDEFINITIONS_H_ +#include #include #include #include @@ -12,6 +13,47 @@ namespace mpsoc { +static constexpr uint32_t HK_SET_ID = 0; + +namespace poolid { +enum { + STATUS = 0, + MODE = 1, + DOWNLINK_PWR_ON = 2, + DOWNLINK_REPLY_ACTIIVE = 3, + DOWNLINK_JESD_SYNC_STATUS = 4, + DOWNLINK_DAC_STATUS = 5, + CAM_STATUS = 6, + CAM_SDI_STATUS = 7, + CAM_FPGA_TEMP = 8, + CAM_SOC_TEMP = 9, + SYSMON_TEMP = 10, + SYSMON_VCCINT = 11, + SYSMON_VCCAUX = 12, + SYSMON_VCCBRAM = 13, + SYSMON_VCCPAUX = 14, + SYSMON_VCCPINT = 15, + SYSMON_VCCPDRO = 16, + SYSMON_MB12V = 17, + SYSMON_MB3V3 = 18, + SYSMON_MB1V8 = 19, + SYSMON_VCC12V = 20, + SYSMON_VCC5V = 21, + SYSMON_VCC3V3 = 22, + SYSMON_VCC3V3VA = 23, + SYSMON_VCC2V5DDR = 24, + SYSMON_VCC1V2DDR = 25, + SYSMON_VCC0V9 = 26, + SYSMON_VCC0V6VTT = 27, + SYSMON_SAFE_COTS_CUR = 28, + SYSMON_NVM4_XO_CUR = 29, + SEM_UNCORRECTABLE_ERRS = 30, + SEM_CORRECTABLE_ERRS = 31, + SEM_STATUS = 32, + REBOOT_MPSOC_REQUIRED = 33, +}; +} + static const DeviceCommandId_t NONE = 0; static const DeviceCommandId_t TC_MEM_WRITE = 1; static const DeviceCommandId_t TC_MEM_READ = 2; @@ -788,6 +830,67 @@ class TcCamcmdSend : public TcBase { static const uint8_t CARRIAGE_RETURN = 0xD; }; +class HkReport : public StaticLocalDataSet<36> { + public: + HkReport(HasLocalDataPoolIF* owner) : StaticLocalDataSet(owner, HK_SET_ID) {} + + HkReport(object_id_t objectId) : StaticLocalDataSet(sid_t(objectId, HK_SET_ID)) {} + + lp_var_t status = lp_var_t(sid.objectId, mpsoc::poolid::STATUS, this); + lp_var_t mode = lp_var_t(sid.objectId, mpsoc::poolid::MODE, this); + lp_var_t downlinkPwrOn = + lp_var_t(sid.objectId, mpsoc::poolid::DOWNLINK_PWR_ON, this); + lp_var_t downlinkReplyActive = + lp_var_t(sid.objectId, mpsoc::poolid::DOWNLINK_REPLY_ACTIIVE, this); + lp_var_t downlinkJesdSyncStatus = + lp_var_t(sid.objectId, mpsoc::poolid::DOWNLINK_JESD_SYNC_STATUS, this); + lp_var_t downlinkDacStatus = + lp_var_t(sid.objectId, mpsoc::poolid::DOWNLINK_DAC_STATUS, this); + lp_var_t camStatus = lp_var_t(sid.objectId, mpsoc::poolid::CAM_STATUS, this); + lp_var_t camSdiStatus = + lp_var_t(sid.objectId, mpsoc::poolid::CAM_SDI_STATUS, this); + lp_var_t camFpgaTemp = lp_var_t(sid.objectId, mpsoc::poolid::CAM_FPGA_TEMP, this); + lp_var_t camSocTemp = lp_var_t(sid.objectId, mpsoc::poolid::CAM_SOC_TEMP, this); + lp_var_t sysmonTemp = lp_var_t(sid.objectId, mpsoc::poolid::SYSMON_TEMP, this); + lp_var_t sysmonVccInt = lp_var_t(sid.objectId, mpsoc::poolid::SYSMON_VCCINT, this); + lp_var_t sysmonVccAux = lp_var_t(sid.objectId, mpsoc::poolid::SYSMON_VCCAUX, this); + lp_var_t sysmonVccBram = + lp_var_t(sid.objectId, mpsoc::poolid::SYSMON_VCCBRAM, this); + lp_var_t sysmonVccPaux = + lp_var_t(sid.objectId, mpsoc::poolid::SYSMON_VCCPAUX, this); + lp_var_t sysmonVccPint = + lp_var_t(sid.objectId, mpsoc::poolid::SYSMON_VCCPINT, this); + lp_var_t sysmonVccPdro = + lp_var_t(sid.objectId, mpsoc::poolid::SYSMON_VCCPDRO, this); + lp_var_t sysmonMb12V = lp_var_t(sid.objectId, mpsoc::poolid::SYSMON_MB12V, this); + lp_var_t sysmonMb3V3 = lp_var_t(sid.objectId, mpsoc::poolid::SYSMON_MB3V3, this); + lp_var_t sysmonMb1V8 = lp_var_t(sid.objectId, mpsoc::poolid::SYSMON_MB1V8, this); + lp_var_t sysmonVcc12V = lp_var_t(sid.objectId, mpsoc::poolid::SYSMON_VCC12V, this); + lp_var_t sysmonVcc5V = lp_var_t(sid.objectId, mpsoc::poolid::SYSMON_VCC5V, this); + lp_var_t sysmonVcc3V3 = lp_var_t(sid.objectId, mpsoc::poolid::SYSMON_VCC3V3, this); + lp_var_t sysmonVcc3V3VA = + lp_var_t(sid.objectId, mpsoc::poolid::SYSMON_VCC3V3VA, this); + lp_var_t sysmonVcc2V5DDR = + lp_var_t(sid.objectId, mpsoc::poolid::SYSMON_VCC2V5DDR, this); + lp_var_t sysmonVcc1V2DDR = + lp_var_t(sid.objectId, mpsoc::poolid::SYSMON_VCC1V2DDR, this); + lp_var_t sysmonVcc0V9 = lp_var_t(sid.objectId, mpsoc::poolid::SYSMON_VCC0V9, this); + lp_var_t sysmonVcc0V6VTT = + lp_var_t(sid.objectId, mpsoc::poolid::SYSMON_VCC0V6VTT, this); + lp_var_t sysmonSafeCotsCur = + lp_var_t(sid.objectId, mpsoc::poolid::SYSMON_SAFE_COTS_CUR, this); + lp_var_t sysmonNvm4XoCur = + lp_var_t(sid.objectId, mpsoc::poolid::SYSMON_NVM4_XO_CUR, this); + lp_var_t semUncorrectableErrs = + lp_var_t(sid.objectId, mpsoc::poolid::SEM_UNCORRECTABLE_ERRS, this); + lp_var_t semCorrectableErrs = + lp_var_t(sid.objectId, mpsoc::poolid::SEM_CORRECTABLE_ERRS, this); + lp_var_t semStatus = + lp_var_t(sid.objectId, mpsoc::poolid::SEM_CORRECTABLE_ERRS, this); + lp_var_t rebootMpsocRequired = + lp_var_t(sid.objectId, mpsoc::poolid::REBOOT_MPSOC_REQUIRED, this); +}; + } // namespace mpsoc #endif /* MISSION_DEVICES_DEVICEDEFINITIONS_PLOCMPSOCDEFINITIONS_H_ */ diff --git a/mission/tcs/Tmp1075Definitions.h b/mission/tcs/Tmp1075Definitions.h index 946ac82e..345146e6 100644 --- a/mission/tcs/Tmp1075Definitions.h +++ b/mission/tcs/Tmp1075Definitions.h @@ -29,7 +29,7 @@ static const uint8_t MAX_REPLY_LENGTH = GET_TEMP_REPLY_SIZE; enum Tmp1075PoolIds : lp_id_t { TEMPERATURE_C_TMP1075 }; -class Tmp1075Dataset : public StaticLocalDataSet { +class Tmp1075Dataset : public StaticLocalDataSet<2> { public: Tmp1075Dataset(HasLocalDataPoolIF* owner) : StaticLocalDataSet(owner, TMP1075_DATA_SET_ID) {} -- 2.43.0 From 34b171ac1f9ec7f634c4406cb71f9519c9e3c418 Mon Sep 17 00:00:00 2001 From: Robin Mueller Date: Wed, 3 May 2023 13:26:47 +0200 Subject: [PATCH 25/36] bugfxi by marius --- linux/payload/PlocMpsocHandler.cpp | 1 - 1 file changed, 1 deletion(-) diff --git a/linux/payload/PlocMpsocHandler.cpp b/linux/payload/PlocMpsocHandler.cpp index b0c56667..b9d97e90 100644 --- a/linux/payload/PlocMpsocHandler.cpp +++ b/linux/payload/PlocMpsocHandler.cpp @@ -428,7 +428,6 @@ ReturnValue_t PlocMPSoCHandler::initializeLocalDataPool(localpool::DataPool& loc LocalDataPoolManager& poolManager) { localDataPoolMap.emplace(mpsoc::poolid::STATUS, &peStatus); localDataPoolMap.emplace(mpsoc::poolid::MODE, &peMode); - localDataPoolMap.emplace(mpsoc::poolid::MODE, &peMode); localDataPoolMap.emplace(mpsoc::poolid::DOWNLINK_PWR_ON, &peDownlinkPwrOn); localDataPoolMap.emplace(mpsoc::poolid::DOWNLINK_JESD_SYNC_STATUS, &peDownlinkJesdSyncStatus); localDataPoolMap.emplace(mpsoc::poolid::DOWNLINK_DAC_STATUS, &peDownlinkDacStatus); -- 2.43.0 From a253f61a70eb13744ddc24c64af4d05cda1f8abb Mon Sep 17 00:00:00 2001 From: Robin Mueller Date: Wed, 3 May 2023 13:37:20 +0200 Subject: [PATCH 26/36] mpsoc update --- linux/payload/PlocMpsocHandler.cpp | 55 ++++++++++++++++-------------- 1 file changed, 29 insertions(+), 26 deletions(-) diff --git a/linux/payload/PlocMpsocHandler.cpp b/linux/payload/PlocMpsocHandler.cpp index b9d97e90..c1cb4bde 100644 --- a/linux/payload/PlocMpsocHandler.cpp +++ b/linux/payload/PlocMpsocHandler.cpp @@ -822,6 +822,16 @@ ReturnValue_t PlocMPSoCHandler::enableReplyInReplyMap(DeviceCommandMap::iterator uint8_t enabledReplies = 0; + auto enableThreeReplies = [&](DeviceCommandId_t replyId) { + enabledReplies = 3; + result = DeviceHandlerBase::enableReplyInReplyMap(command, enabledReplies, true, replyId); + if (result != returnvalue::OK) { + sif::debug << "PlocMPSoCHandler::enableReplyInReplyMap: Reply with id " + << mpsoc::TM_MEMORY_READ_REPORT << " not in replyMap" << std::endl; + return result; + } + break; + }; switch (command->first) { case mpsoc::TC_MEM_WRITE: case mpsoc::TC_FLASHDELETE: @@ -838,26 +848,16 @@ ReturnValue_t PlocMPSoCHandler::enableReplyInReplyMap(DeviceCommandMap::iterator case mpsoc::TC_MODE_SNAPSHOT: enabledReplies = 2; break; + case mpsoc::TC_GET_HK_REPORT: { + enableThreeReplies(mpsoc::TM_GET_HK_REPORT); + break; + } case mpsoc::TC_MEM_READ: { - enabledReplies = 3; - result = DeviceHandlerBase::enableReplyInReplyMap(command, enabledReplies, true, - mpsoc::TM_MEMORY_READ_REPORT); - if (result != returnvalue::OK) { - sif::debug << "PlocMPSoCHandler::enableReplyInReplyMap: Reply with id " - << mpsoc::TM_MEMORY_READ_REPORT << " not in replyMap" << std::endl; - return result; - } + enableThreeReplies(mpsoc::TM_MEMORY_READ_REPORT); break; } case mpsoc::TC_CAM_CMD_SEND: { - enabledReplies = 3; - result = DeviceHandlerBase::enableReplyInReplyMap(command, enabledReplies, true, - mpsoc::TM_CAM_CMD_RPT); - if (result != returnvalue::OK) { - sif::debug << "PlocMPSoCHandler::enableReplyInReplyMap: Reply with id " - << mpsoc::TM_CAM_CMD_RPT << " not in replyMap" << std::endl; - return result; - } + enableThreeReplies(mpsoc::TM_CAM_CMD_RPT); break; } case mpsoc::OBSW_RESET_SEQ_COUNT: @@ -1065,6 +1065,13 @@ void PlocMPSoCHandler::disableAllReplies() { DeviceCommandId_t commandId = getPendingCommand(); + auto disableCommandWithReply = [](DeviceCommandId_t replyId) { + iter = deviceReplyMap.find(replyId); + info = &(iter->second); + info->delayCycles = 0; + info->active = false; + info->command = deviceCommandMap.end(); + }; /* If the command expects a telemetry packet the appropriate tm reply will be disabled here */ switch (commandId) { case TC_MEM_WRITE: @@ -1082,19 +1089,15 @@ void PlocMPSoCHandler::disableAllReplies() { case TC_MODE_SNAPSHOT: break; case TC_MEM_READ: { - iter = deviceReplyMap.find(TM_MEMORY_READ_REPORT); - info = &(iter->second); - info->delayCycles = 0; - info->active = false; - info->command = deviceCommandMap.end(); + disableCommandWithReply(TM_MEMORY_READ_REPORT); + break; + } + case TC_GET_HK_REPORT: { + disableCommandWithReply(TM_GET_HK_REPORT); break; } case TC_CAM_CMD_SEND: { - iter = deviceReplyMap.find(TM_CAM_CMD_RPT); - info = &(iter->second); - info->delayCycles = 0; - info->active = false; - info->command = deviceCommandMap.end(); + disableCommandWithReply(TM_CAM_CMD_RPT); break; } default: { -- 2.43.0 From 3c2aa35c85af96307d1321a699c9473422b12b25 Mon Sep 17 00:00:00 2001 From: Robin Mueller Date: Wed, 3 May 2023 14:17:48 +0200 Subject: [PATCH 27/36] MPSoC HK packet --- CHANGELOG.md | 1 + linux/payload/PlocMpsocHandler.cpp | 188 ++++++++++++++++++++++++++++- 2 files changed, 184 insertions(+), 5 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index db78de99..e38b7998 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -28,6 +28,7 @@ will consitute of a breaking change warranting a new major release: - Do not construct and schedule broken TMP1075 device anymore. - Do not track payload modes in system mode tables. - ACS modes derived from system modes. +- Add support for MPSoC HK packet. ## Added diff --git a/linux/payload/PlocMpsocHandler.cpp b/linux/payload/PlocMpsocHandler.cpp index c1cb4bde..e4c91a4a 100644 --- a/linux/payload/PlocMpsocHandler.cpp +++ b/linux/payload/PlocMpsocHandler.cpp @@ -792,6 +792,175 @@ ReturnValue_t PlocMPSoCHandler::handleGetHkReport(const uint8_t* data) { return result; } SpacePacketReader packetReader(data, foundPacketLen); + const uint8_t* dataStart = data + 6; + PoolReadGuard pg(&hkReport); + size_t deserLen = mpsoc::SIZE_TM_HK_REPORT; + SerializeIF::Endianness endianness = SerializeIF::Endianness::NETWORK; + result = SerializeAdapter::deSerialize(&hkReport.status.value, &dataStart, &deserLen, endianness); + if (result != returnvalue::OK) { + return result; + } + result = SerializeAdapter::deSerialize(&hkReport.mode.value, &dataStart, &deserLen, endianness); + if (result != returnvalue::OK) { + return result; + } + result = SerializeAdapter::deSerialize(&hkReport.downlinkPwrOn.value, &dataStart, &deserLen, + endianness); + if (result != returnvalue::OK) { + return result; + } + result = SerializeAdapter::deSerialize(&hkReport.downlinkReplyActive.value, &dataStart, &deserLen, + endianness); + if (result != returnvalue::OK) { + return result; + } + result = SerializeAdapter::deSerialize(&hkReport.downlinkJesdSyncStatus.value, &dataStart, + &deserLen, endianness); + if (result != returnvalue::OK) { + return result; + } + result = SerializeAdapter::deSerialize(&hkReport.downlinkDacStatus.value, &dataStart, &deserLen, + endianness); + if (result != returnvalue::OK) { + return result; + } + result = + SerializeAdapter::deSerialize(&hkReport.camStatus.value, &dataStart, &deserLen, endianness); + if (result != returnvalue::OK) { + return result; + } + result = SerializeAdapter::deSerialize(&hkReport.camSdiStatus.value, &dataStart, &deserLen, + endianness); + if (result != returnvalue::OK) { + return result; + } + result = + SerializeAdapter::deSerialize(&hkReport.camFpgaTemp.value, &dataStart, &deserLen, endianness); + if (result != returnvalue::OK) { + return result; + } + result = + SerializeAdapter::deSerialize(&hkReport.sysmonTemp.value, &dataStart, &deserLen, endianness); + if (result != returnvalue::OK) { + return result; + } + result = SerializeAdapter::deSerialize(&hkReport.sysmonVccInt.value, &dataStart, &deserLen, + endianness); + if (result != returnvalue::OK) { + return result; + } + result = SerializeAdapter::deSerialize(&hkReport.sysmonVccAux.value, &dataStart, &deserLen, + endianness); + if (result != returnvalue::OK) { + return result; + } + result = SerializeAdapter::deSerialize(&hkReport.sysmonVccBram.value, &dataStart, &deserLen, + endianness); + if (result != returnvalue::OK) { + return result; + } + result = SerializeAdapter::deSerialize(&hkReport.sysmonVccPaux.value, &dataStart, &deserLen, + endianness); + if (result != returnvalue::OK) { + return result; + } + result = SerializeAdapter::deSerialize(&hkReport.sysmonVccPint.value, &dataStart, &deserLen, + endianness); + if (result != returnvalue::OK) { + return result; + } + result = SerializeAdapter::deSerialize(&hkReport.sysmonVccPdro.value, &dataStart, &deserLen, + endianness); + if (result != returnvalue::OK) { + return result; + } + result = + SerializeAdapter::deSerialize(&hkReport.sysmonMb12V.value, &dataStart, &deserLen, endianness); + if (result != returnvalue::OK) { + return result; + } + result = + SerializeAdapter::deSerialize(&hkReport.sysmonMb3V3.value, &dataStart, &deserLen, endianness); + if (result != returnvalue::OK) { + return result; + } + result = + SerializeAdapter::deSerialize(&hkReport.sysmonMb1V8.value, &dataStart, &deserLen, endianness); + if (result != returnvalue::OK) { + return result; + } + result = SerializeAdapter::deSerialize(&hkReport.sysmonVcc12V.value, &dataStart, &deserLen, + endianness); + if (result != returnvalue::OK) { + return result; + } + result = + SerializeAdapter::deSerialize(&hkReport.sysmonVcc5V.value, &dataStart, &deserLen, endianness); + if (result != returnvalue::OK) { + return result; + } + result = SerializeAdapter::deSerialize(&hkReport.sysmonVcc3V3.value, &dataStart, &deserLen, + endianness); + if (result != returnvalue::OK) { + return result; + } + result = SerializeAdapter::deSerialize(&hkReport.sysmonVcc3V3VA.value, &dataStart, &deserLen, + endianness); + if (result != returnvalue::OK) { + return result; + } + result = SerializeAdapter::deSerialize(&hkReport.sysmonVcc2V5DDR.value, &dataStart, &deserLen, + endianness); + if (result != returnvalue::OK) { + return result; + } + result = SerializeAdapter::deSerialize(&hkReport.sysmonVcc1V2DDR.value, &dataStart, &deserLen, + endianness); + if (result != returnvalue::OK) { + return result; + } + result = SerializeAdapter::deSerialize(&hkReport.sysmonVcc0V9.value, &dataStart, &deserLen, + endianness); + if (result != returnvalue::OK) { + return result; + } + result = SerializeAdapter::deSerialize(&hkReport.sysmonVcc0V6VTT.value, &dataStart, &deserLen, + endianness); + if (result != returnvalue::OK) { + return result; + } + result = SerializeAdapter::deSerialize(&hkReport.sysmonSafeCotsCur.value, &dataStart, &deserLen, + endianness); + if (result != returnvalue::OK) { + return result; + } + result = SerializeAdapter::deSerialize(&hkReport.sysmonNvm4XoCur.value, &dataStart, &deserLen, + endianness); + if (result != returnvalue::OK) { + return result; + } + result = SerializeAdapter::deSerialize(&hkReport.semUncorrectableErrs.value, &dataStart, + &deserLen, endianness); + if (result != returnvalue::OK) { + return result; + } + result = SerializeAdapter::deSerialize(&hkReport.semCorrectableErrs.value, &dataStart, &deserLen, + endianness); + if (result != returnvalue::OK) { + return result; + } + result = + SerializeAdapter::deSerialize(&hkReport.semStatus.value, &dataStart, &deserLen, endianness); + if (result != returnvalue::OK) { + return result; + } + // Skip the weird filename + dataStart += 256; + result = SerializeAdapter::deSerialize(&hkReport.rebootMpsocRequired, &dataStart, &deserLen, + endianness); + if (result != returnvalue::OK) { + return result; + } return returnvalue::OK; } @@ -830,7 +999,7 @@ ReturnValue_t PlocMPSoCHandler::enableReplyInReplyMap(DeviceCommandMap::iterator << mpsoc::TM_MEMORY_READ_REPORT << " not in replyMap" << std::endl; return result; } - break; + return returnvalue::OK; }; switch (command->first) { case mpsoc::TC_MEM_WRITE: @@ -849,15 +1018,24 @@ ReturnValue_t PlocMPSoCHandler::enableReplyInReplyMap(DeviceCommandMap::iterator enabledReplies = 2; break; case mpsoc::TC_GET_HK_REPORT: { - enableThreeReplies(mpsoc::TM_GET_HK_REPORT); + result = enableThreeReplies(mpsoc::TM_GET_HK_REPORT); + if (result != returnvalue::OK) { + return result; + } break; } case mpsoc::TC_MEM_READ: { - enableThreeReplies(mpsoc::TM_MEMORY_READ_REPORT); + result = enableThreeReplies(mpsoc::TM_MEMORY_READ_REPORT); + if (result != returnvalue::OK) { + return result; + } break; } case mpsoc::TC_CAM_CMD_SEND: { - enableThreeReplies(mpsoc::TM_CAM_CMD_RPT); + result = enableThreeReplies(mpsoc::TM_CAM_CMD_RPT); + if (result != returnvalue::OK) { + return result; + } break; } case mpsoc::OBSW_RESET_SEQ_COUNT: @@ -1065,7 +1243,7 @@ void PlocMPSoCHandler::disableAllReplies() { DeviceCommandId_t commandId = getPendingCommand(); - auto disableCommandWithReply = [](DeviceCommandId_t replyId) { + auto disableCommandWithReply = [&](DeviceCommandId_t replyId) { iter = deviceReplyMap.find(replyId); info = &(iter->second); info->delayCycles = 0; -- 2.43.0 From 329027f9f82b3632dad2363d919c53ffdef0a279 Mon Sep 17 00:00:00 2001 From: Robin Mueller Date: Wed, 3 May 2023 14:19:15 +0200 Subject: [PATCH 28/36] request HK regularly now --- linux/payload/PlocMpsocHandler.cpp | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/linux/payload/PlocMpsocHandler.cpp b/linux/payload/PlocMpsocHandler.cpp index e4c91a4a..2e708496 100644 --- a/linux/payload/PlocMpsocHandler.cpp +++ b/linux/payload/PlocMpsocHandler.cpp @@ -202,8 +202,10 @@ void PlocMPSoCHandler::doShutDown() { #endif } + ReturnValue_t PlocMPSoCHandler::buildNormalDeviceCommand(DeviceCommandId_t* id) { - return NOTHING_TO_SEND; + *id = mpsoc::TC_GET_HK_REPORT; + return buildCommandFromCommand(*id, nullptr, 0); } ReturnValue_t PlocMPSoCHandler::buildTransitionDeviceCommand(DeviceCommandId_t* id) { -- 2.43.0 From 98ede40d44831d6b8296509cfbdcb16d4c550eba Mon Sep 17 00:00:00 2001 From: Robin Mueller Date: Wed, 3 May 2023 14:29:02 +0200 Subject: [PATCH 29/36] start adding dir content report --- linux/payload/plocMpscoDefs.h | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/linux/payload/plocMpscoDefs.h b/linux/payload/plocMpscoDefs.h index 1ef72bf5..4df6037a 100644 --- a/linux/payload/plocMpscoDefs.h +++ b/linux/payload/plocMpscoDefs.h @@ -81,6 +81,8 @@ static const DeviceCommandId_t TC_DOWNLINK_DATA_MODULATE = 24; static const DeviceCommandId_t TC_MODE_SNAPSHOT = 25; static const DeviceCommandId_t TC_GET_HK_REPORT = 26; static const DeviceCommandId_t TM_GET_HK_REPORT = 27; +static const DeviceCommandId_t TC_FLASH_GET_DIRECTORY_CONTENT = 28; +static const DeviceCommandId_t TM_FLASH_DIRECTORY_CONTENT = 29; // Will reset the sequence count of the OBSW static const DeviceCommandId_t OBSW_RESET_SEQ_COUNT = 50; @@ -105,6 +107,7 @@ static const uint16_t TC_CAM_TAKE_PIC = 0x116; static const uint16_t TC_FLASHWRITE = 0x117; static const uint16_t TC_FLASHFOPEN = 0x119; static const uint16_t TC_FLASHFCLOSE = 0x11A; +static constexpr uint16_t TC_FLASH_GET_DIRECTORY_CONTENT = 0x11B; static const uint16_t TC_FLASHDELETE = 0x11C; static const uint16_t TC_MODE_IDLE = 0x11E; static const uint16_t TC_MODE_REPLAY = 0x11F; @@ -120,6 +123,7 @@ static const uint16_t ACK_SUCCESS = 0x400; static const uint16_t ACK_FAILURE = 0x401; static const uint16_t EXE_SUCCESS = 0x402; static const uint16_t EXE_FAILURE = 0x403; +static constexpr uint16_t TM_FLASH_DIRECTORY_CONTENT = 0x406; static const uint16_t TM_CAM_CMD_RPT = 0x407; } // namespace apid -- 2.43.0 From e62fd523c8464249b3a0eeecb5e1054b8192304e Mon Sep 17 00:00:00 2001 From: Robin Mueller Date: Wed, 3 May 2023 14:31:47 +0200 Subject: [PATCH 30/36] add some more commands --- linux/payload/PlocMpsocHandler.cpp | 1 - linux/payload/plocMpscoDefs.h | 4 +++- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/linux/payload/PlocMpsocHandler.cpp b/linux/payload/PlocMpsocHandler.cpp index 2e708496..3c605d2d 100644 --- a/linux/payload/PlocMpsocHandler.cpp +++ b/linux/payload/PlocMpsocHandler.cpp @@ -202,7 +202,6 @@ void PlocMPSoCHandler::doShutDown() { #endif } - ReturnValue_t PlocMPSoCHandler::buildNormalDeviceCommand(DeviceCommandId_t* id) { *id = mpsoc::TC_GET_HK_REPORT; return buildCommandFromCommand(*id, nullptr, 0); diff --git a/linux/payload/plocMpscoDefs.h b/linux/payload/plocMpscoDefs.h index 4df6037a..c2c5d570 100644 --- a/linux/payload/plocMpscoDefs.h +++ b/linux/payload/plocMpscoDefs.h @@ -109,15 +109,17 @@ static const uint16_t TC_FLASHFOPEN = 0x119; static const uint16_t TC_FLASHFCLOSE = 0x11A; static constexpr uint16_t TC_FLASH_GET_DIRECTORY_CONTENT = 0x11B; static const uint16_t TC_FLASHDELETE = 0x11C; +static constexpr uint16_t TC_FLASH_CREATE_DIR = 0x11D; static const uint16_t TC_MODE_IDLE = 0x11E; static const uint16_t TC_MODE_REPLAY = 0x11F; static const uint16_t TC_MODE_SNAPSHOT = 0x120; static const uint16_t TC_DOWNLINK_DATA_MODULATE = 0x121; static constexpr uint16_t TC_HK_GET_REPORT = 0x123; -static constexpr uint16_t TM_HK_GET_REPORT = 0x408; static const uint16_t TC_DOWNLINK_PWR_OFF = 0x124; static const uint16_t TC_CAM_CMD_SEND = 0x12C; +static constexpr uint16_t TC_FLASH_COPY_FILE = 0x12E; static const uint16_t TC_SIMPLEX_SEND_FILE = 0x130; +static constexpr uint16_t TM_HK_GET_REPORT = 0x408; static const uint16_t TM_MEMORY_READ_REPORT = 0x404; static const uint16_t ACK_SUCCESS = 0x400; static const uint16_t ACK_FAILURE = 0x401; -- 2.43.0 From dff622ebd79cb6d613e5c76da5f7dc32e927cc7c Mon Sep 17 00:00:00 2001 From: Robin Mueller Date: Wed, 3 May 2023 15:24:47 +0200 Subject: [PATCH 31/36] implement dir content report in OBSW --- linux/payload/PlocMpsocHandler.cpp | 83 +++++++++++++++++++++++------- linux/payload/PlocMpsocHandler.h | 3 +- linux/payload/plocMpscoDefs.h | 17 ++++++ 3 files changed, 83 insertions(+), 20 deletions(-) diff --git a/linux/payload/PlocMpsocHandler.cpp b/linux/payload/PlocMpsocHandler.cpp index 3c605d2d..0caebea3 100644 --- a/linux/payload/PlocMpsocHandler.cpp +++ b/linux/payload/PlocMpsocHandler.cpp @@ -253,6 +253,10 @@ ReturnValue_t PlocMPSoCHandler::buildCommandFromCommand(DeviceCommandId_t device result = prepareTcGetHkReport(); break; } + case (mpsoc::TC_FLASH_GET_DIRECTORY_CONTENT): { + result = prepareTcGetDirContent(commandData, commandDataLen); + break; + } case (mpsoc::TC_MODE_REPLAY): { result = prepareTcModeReplay(); break; @@ -314,14 +318,16 @@ void PlocMPSoCHandler::fillCommandAndReplyMap() { this->insertInCommandMap(mpsoc::RELEASE_UART_TX); this->insertInCommandMap(mpsoc::SET_UART_TX_TRISTATE); this->insertInCommandMap(mpsoc::TC_CAM_TAKE_PIC); + this->insertInCommandMap(mpsoc::TC_FLASH_GET_DIRECTORY_CONTENT); this->insertInCommandMap(mpsoc::TC_SIMPLEX_SEND_FILE); this->insertInCommandMap(mpsoc::TC_DOWNLINK_DATA_MODULATE); this->insertInCommandMap(mpsoc::TC_MODE_SNAPSHOT); 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); - this->insertInReplyMap(mpsoc::TM_GET_HK_REPORT, 2, nullptr, 0); + this->insertInReplyMap(mpsoc::TM_GET_HK_REPORT, 2, nullptr, mpsoc::SIZE_TM_HK_REPORT); this->insertInReplyMap(mpsoc::TM_CAM_CMD_RPT, 2, nullptr, mpsoc::SP_MAX_SIZE); + this->insertInReplyMap(mpsoc::TM_FLASH_DIRECTORY_CONTENT, 2, nullptr, 0); } ReturnValue_t PlocMPSoCHandler::scanForReply(const uint8_t* start, size_t remainingSize, @@ -339,6 +345,11 @@ ReturnValue_t PlocMPSoCHandler::scanForReply(const uint8_t* start, size_t remain } uint16_t apid = spacePacket.getApid(); + auto handleDedicatedReply = [&](DeviceCommandId_t replyId) { + *foundLen = spacePacket.getFullPacketLen(); + foundPacketLen = *foundLen; + *foundId = replyId; + }; switch (apid) { case (mpsoc::apid::ACK_SUCCESS): *foundLen = mpsoc::SIZE_ACK_REPORT; @@ -353,14 +364,14 @@ ReturnValue_t PlocMPSoCHandler::scanForReply(const uint8_t* start, size_t remain *foundId = mpsoc::TM_MEMORY_READ_REPORT; break; case (mpsoc::apid::TM_CAM_CMD_RPT): - *foundLen = spacePacket.getFullPacketLen(); - foundPacketLen = *foundLen; - *foundId = mpsoc::TM_CAM_CMD_RPT; + handleDedicatedReply(mpsoc::TM_CAM_CMD_RPT); break; case (mpsoc::apid::TM_HK_GET_REPORT): { - *foundLen = spacePacket.getFullPacketLen(); - foundPacketLen = *foundLen; - *foundId = mpsoc::TM_GET_HK_REPORT; + handleDedicatedReply(mpsoc::TM_GET_HK_REPORT); + break; + } + case (mpsoc::apid::TM_FLASH_DIRECTORY_CONTENT): { + handleDedicatedReply(mpsoc::TM_FLASH_DIRECTORY_CONTENT); break; } case (mpsoc::apid::EXE_SUCCESS): @@ -408,6 +419,18 @@ ReturnValue_t PlocMPSoCHandler::interpretDeviceReply(DeviceCommandId_t id, const result = handleCamCmdRpt(packet); break; } + case (mpsoc::TM_FLASH_DIRECTORY_CONTENT): { + result = verifyPacket(packet, foundPacketLen); + if (result == MPSoCReturnValuesIF::CRC_FAILURE) { + sif::warning << "PLOC MPSoC: Flash directory content reply invalid CRC" << std::endl; + } + /** Send data to commanding queue */ + handleDeviceTm(packet + mpsoc::DATA_FIELD_OFFSET, + foundPacketLen - mpsoc::DATA_FIELD_OFFSET - mpsoc::CRC_SIZE, + mpsoc::TM_FLASH_DIRECTORY_CONTENT); + nextReplyId = mpsoc::EXE_REPORT; + return result; + } case (mpsoc::EXE_REPORT): { result = handleExecutionReport(packet); break; @@ -421,7 +444,10 @@ ReturnValue_t PlocMPSoCHandler::interpretDeviceReply(DeviceCommandId_t id, const return result; } -void PlocMPSoCHandler::setNormalDatapoolEntriesInvalid() {} +void PlocMPSoCHandler::setNormalDatapoolEntriesInvalid() { + PoolReadGuard pg(&hkReport); + hkReport.setValidity(false, true); +} uint32_t PlocMPSoCHandler::getTransitionDelayMs(Mode_t modeFrom, Mode_t modeTo) { return 5000; } @@ -624,9 +650,8 @@ ReturnValue_t PlocMPSoCHandler::prepareTcCamCmdSend(const uint8_t* commandData, ReturnValue_t PlocMPSoCHandler::prepareTcCamTakePic(const uint8_t* commandData, size_t commandDataLen) { - ReturnValue_t result = returnvalue::OK; mpsoc::TcCamTakePic tcCamTakePic(spParams, sequenceCount); - result = tcCamTakePic.buildPacket(commandData, commandDataLen); + ReturnValue_t result = tcCamTakePic.buildPacket(commandData, commandDataLen); if (result != returnvalue::OK) { return result; } @@ -636,9 +661,8 @@ ReturnValue_t PlocMPSoCHandler::prepareTcCamTakePic(const uint8_t* commandData, ReturnValue_t PlocMPSoCHandler::prepareTcSimplexSendFile(const uint8_t* commandData, size_t commandDataLen) { - ReturnValue_t result = returnvalue::OK; mpsoc::TcSimplexSendFile tcSimplexSendFile(spParams, sequenceCount); - result = tcSimplexSendFile.buildPacket(commandData, commandDataLen); + ReturnValue_t result = tcSimplexSendFile.buildPacket(commandData, commandDataLen); if (result != returnvalue::OK) { return result; } @@ -646,11 +670,21 @@ ReturnValue_t PlocMPSoCHandler::prepareTcSimplexSendFile(const uint8_t* commandD return returnvalue::OK; } +ReturnValue_t PlocMPSoCHandler::prepareTcGetDirContent(const uint8_t* commandData, + size_t commandDataLen) { + mpsoc::TcGetDirContent tcGetDirContent(spParams, sequenceCount); + ReturnValue_t result = tcGetDirContent.buildPacket(commandData, commandDataLen); + if (result != returnvalue::OK) { + return result; + } + finishTcPrep(tcGetDirContent.getFullPacketLen()); + return returnvalue::OK; +} + ReturnValue_t PlocMPSoCHandler::prepareTcDownlinkDataModulate(const uint8_t* commandData, size_t commandDataLen) { - ReturnValue_t result = returnvalue::OK; mpsoc::TcDownlinkDataModulate tcDownlinkDataModulate(spParams, sequenceCount); - result = tcDownlinkDataModulate.buildPacket(commandData, commandDataLen); + ReturnValue_t result = tcDownlinkDataModulate.buildPacket(commandData, commandDataLen); if (result != returnvalue::OK) { return result; } @@ -659,9 +693,8 @@ ReturnValue_t PlocMPSoCHandler::prepareTcDownlinkDataModulate(const uint8_t* com } ReturnValue_t PlocMPSoCHandler::prepareTcModeSnapshot() { - ReturnValue_t result = returnvalue::OK; mpsoc::TcModeSnapshot tcModeSnapshot(spParams, sequenceCount); - result = tcModeSnapshot.buildPacket(); + ReturnValue_t result = tcModeSnapshot.buildPacket(); if (result != returnvalue::OK) { return result; } @@ -781,7 +814,7 @@ ReturnValue_t PlocMPSoCHandler::handleMemoryReadReport(const uint8_t* data) { uint16_t memLen = *(data + mpsoc::MEM_READ_RPT_LEN_OFFSET) << 8 | *(data + mpsoc::MEM_READ_RPT_LEN_OFFSET + 1); /** Send data to commanding queue */ - handleDeviceTM(data + mpsoc::DATA_FIELD_OFFSET, mpsoc::SIZE_MEM_READ_RPT_FIX + memLen * 4, + handleDeviceTm(data + mpsoc::DATA_FIELD_OFFSET, mpsoc::SIZE_MEM_READ_RPT_FIX + memLen * 4, mpsoc::TM_MEMORY_READ_REPORT); nextReplyId = mpsoc::EXE_REPORT; return result; @@ -980,7 +1013,7 @@ ReturnValue_t PlocMPSoCHandler::handleCamCmdRpt(const uint8_t* data) { sif::info << "PlocMPSoCHandler: CamCmdRpt Ack value: 0x" << std::hex << static_cast(ackValue) << std::endl; #endif /* OBSW_DEBUG_PLOC_MPSOC == 1 */ - handleDeviceTM(packetReader.getPacketData() + sizeof(uint16_t), + handleDeviceTm(packetReader.getPacketData() + sizeof(uint16_t), packetReader.getPacketDataLen() - 1, mpsoc::TM_CAM_CMD_RPT); return result; } @@ -1039,6 +1072,13 @@ ReturnValue_t PlocMPSoCHandler::enableReplyInReplyMap(DeviceCommandMap::iterator } break; } + case mpsoc::TC_FLASH_GET_DIRECTORY_CONTENT: { + result = enableThreeReplies(mpsoc::TM_FLASH_DIRECTORY_CONTENT); + if (result != returnvalue::OK) { + return result; + } + break; + } case mpsoc::OBSW_RESET_SEQ_COUNT: break; default: @@ -1105,6 +1145,7 @@ void PlocMPSoCHandler::setNextReplyId() { break; } } + size_t PlocMPSoCHandler::getNextReplyLength(DeviceCommandId_t commandId) { size_t replyLen = 0; @@ -1206,7 +1247,7 @@ void PlocMPSoCHandler::completionFailedReceived(ActionId_t actionId, ReturnValue handleActionCommandFailure(actionId); } -void PlocMPSoCHandler::handleDeviceTM(const uint8_t* data, size_t dataSize, +void PlocMPSoCHandler::handleDeviceTm(const uint8_t* data, size_t dataSize, DeviceCommandId_t replyId) { ReturnValue_t result = returnvalue::OK; @@ -1275,6 +1316,10 @@ void PlocMPSoCHandler::disableAllReplies() { disableCommandWithReply(TM_GET_HK_REPORT); break; } + case TC_FLASH_GET_DIRECTORY_CONTENT: { + disableCommandWithReply(TM_FLASH_DIRECTORY_CONTENT); + break; + } case TC_CAM_CMD_SEND: { disableCommandWithReply(TM_CAM_CMD_RPT); break; diff --git a/linux/payload/PlocMpsocHandler.h b/linux/payload/PlocMpsocHandler.h index c9850e18..a6a866ef 100644 --- a/linux/payload/PlocMpsocHandler.h +++ b/linux/payload/PlocMpsocHandler.h @@ -201,6 +201,7 @@ class PlocMPSoCHandler : public DeviceHandlerBase, public CommandsActionsIF { ReturnValue_t prepareTcDownlinkPwrOn(const uint8_t* commandData, size_t commandDataLen); ReturnValue_t prepareTcDownlinkPwrOff(); ReturnValue_t prepareTcGetHkReport(); + ReturnValue_t prepareTcGetDirContent(const uint8_t* commandData, size_t commandDataLen); ReturnValue_t prepareTcReplayWriteSequence(const uint8_t* commandData, size_t commandDataLen); ReturnValue_t prepareTcCamCmdSend(const uint8_t* commandData, size_t commandDataLen); ReturnValue_t prepareTcModeIdle(); @@ -266,7 +267,7 @@ class PlocMPSoCHandler : public DeviceHandlerBase, public CommandsActionsIF { * @param dataSize Size of telemetry in bytes. * @param replyId Id of the reply. This will be added to the ActionMessage. */ - void handleDeviceTM(const uint8_t* data, size_t dataSize, DeviceCommandId_t replyId); + void handleDeviceTm(const uint8_t* data, size_t dataSize, DeviceCommandId_t replyId); /** * @brief In case an acknowledgment failure reply has been received this function disables diff --git a/linux/payload/plocMpscoDefs.h b/linux/payload/plocMpscoDefs.h index c2c5d570..5d89360c 100644 --- a/linux/payload/plocMpscoDefs.h +++ b/linux/payload/plocMpscoDefs.h @@ -623,6 +623,23 @@ class TcGetHkReport : public TcBase { : TcBase(params, apid::TC_HK_GET_REPORT, sequenceCount) {} }; +class TcGetDirContent : public TcBase { + public: + TcGetDirContent(ploc::SpTcParams params, uint16_t sequenceCount) + : TcBase(params, apid::TC_FLASH_GET_DIRECTORY_CONTENT, sequenceCount) {} + + ReturnValue_t initPacket(const uint8_t* commandData, size_t commandDataLen) { + ReturnValue_t result = returnvalue::OK; + spParams.setFullPayloadLen(commandDataLen + sizeof(NULL_TERMINATOR) + CRC_SIZE); + if (result != returnvalue::OK) { + return result; + } + std::memcpy(payloadStart, commandData, commandDataLen); + *(payloadStart + commandDataLen) = NULL_TERMINATOR; + return result; + } +}; + /** * @brief Class to build replay stop space packet. */ -- 2.43.0 From 934f0694e2375cbf7a83454f94e18062ee2f1abf Mon Sep 17 00:00:00 2001 From: Robin Mueller Date: Wed, 3 May 2023 15:30:30 +0200 Subject: [PATCH 32/36] i think that should do the job --- linux/payload/PlocMpsocHandler.cpp | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/linux/payload/PlocMpsocHandler.cpp b/linux/payload/PlocMpsocHandler.cpp index 0caebea3..ec2877a6 100644 --- a/linux/payload/PlocMpsocHandler.cpp +++ b/linux/payload/PlocMpsocHandler.cpp @@ -1170,6 +1170,10 @@ size_t PlocMPSoCHandler::getNextReplyLength(DeviceCommandId_t commandId) { // report is not fixed replyLen = mpsoc::SP_MAX_SIZE; break; + case mpsoc::TM_FLASH_DIRECTORY_CONTENT: + // I think the reply size is not fixed either. + replyLen = mpsoc::SP_MAX_SIZE; + break; default: { replyLen = iter->second.replyLen; break; -- 2.43.0 From 618b68685a44cfe39aede3eb102011de4ce2aea0 Mon Sep 17 00:00:00 2001 From: Robin Mueller Date: Wed, 3 May 2023 15:31:54 +0200 Subject: [PATCH 33/36] changelog --- CHANGELOG.md | 1 + 1 file changed, 1 insertion(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index e38b7998..c853a1a5 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -29,6 +29,7 @@ will consitute of a breaking change warranting a new major release: - Do not track payload modes in system mode tables. - ACS modes derived from system modes. - Add support for MPSoC HK packet. +- Add support for MPSoC Flash Directory Content Report. ## Added -- 2.43.0 From 1ecaa4e3fc3ab2ce3f0ab642f608945e21019244 Mon Sep 17 00:00:00 2001 From: Robin Mueller Date: Wed, 3 May 2023 16:42:24 +0200 Subject: [PATCH 34/36] dynamically enable/disable MPSoC --- linux/payload/PlocMpsocHandler.cpp | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/linux/payload/PlocMpsocHandler.cpp b/linux/payload/PlocMpsocHandler.cpp index ec2877a6..96f6c50d 100644 --- a/linux/payload/PlocMpsocHandler.cpp +++ b/linux/payload/PlocMpsocHandler.cpp @@ -160,6 +160,7 @@ void PlocMPSoCHandler::doStartUp() { powerState = PowerState::BOOTING; break; case PowerState::ON: + hkReport.setReportingEnabled(true); setMode(_MODE_TO_ON); uartIsolatorSwitch.pullHigh(); break; @@ -168,11 +169,13 @@ void PlocMPSoCHandler::doStartUp() { } #else powerState = PowerState::ON; + hkReport.setReportingEnabled(true); setMode(_MODE_TO_ON); uartIsolatorSwitch.pullHigh(); #endif /* not MSPOC_JTAG_BOOT == 1 */ #else powerState = PowerState::ON; + hkReport.setReportingEnabled(true); setMode(_MODE_TO_ON); #endif /* XIPHOS_Q7S */ } @@ -188,6 +191,7 @@ void PlocMPSoCHandler::doShutDown() { break; case PowerState::OFF: sequenceCount = 0; + hkReport.setReportingEnabled(false); setMode(_MODE_POWER_DOWN); break; default: @@ -196,6 +200,7 @@ void PlocMPSoCHandler::doShutDown() { #else sequenceCount = 0; uartIsolatorSwitch.pullLow(); + hkReport.setReportingEnabled(false); setMode(_MODE_POWER_DOWN); powerState = PowerState::OFF; #endif -- 2.43.0 From 254ce784141ce305da2eea5848d0941aaf447cb9 Mon Sep 17 00:00:00 2001 From: Robin Mueller Date: Wed, 3 May 2023 16:42:24 +0200 Subject: [PATCH 35/36] dynamically enable/disable MPSoC --- linux/payload/PlocMpsocHandler.cpp | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/linux/payload/PlocMpsocHandler.cpp b/linux/payload/PlocMpsocHandler.cpp index 2e708496..cd405fa6 100644 --- a/linux/payload/PlocMpsocHandler.cpp +++ b/linux/payload/PlocMpsocHandler.cpp @@ -160,6 +160,7 @@ void PlocMPSoCHandler::doStartUp() { powerState = PowerState::BOOTING; break; case PowerState::ON: + hkReport.setReportingEnabled(true); setMode(_MODE_TO_ON); uartIsolatorSwitch.pullHigh(); break; @@ -168,11 +169,13 @@ void PlocMPSoCHandler::doStartUp() { } #else powerState = PowerState::ON; + hkReport.setReportingEnabled(true); setMode(_MODE_TO_ON); uartIsolatorSwitch.pullHigh(); #endif /* not MSPOC_JTAG_BOOT == 1 */ #else powerState = PowerState::ON; + hkReport.setReportingEnabled(true); setMode(_MODE_TO_ON); #endif /* XIPHOS_Q7S */ } @@ -188,6 +191,7 @@ void PlocMPSoCHandler::doShutDown() { break; case PowerState::OFF: sequenceCount = 0; + hkReport.setReportingEnabled(false); setMode(_MODE_POWER_DOWN); break; default: @@ -196,6 +200,7 @@ void PlocMPSoCHandler::doShutDown() { #else sequenceCount = 0; uartIsolatorSwitch.pullLow(); + hkReport.setReportingEnabled(false); setMode(_MODE_POWER_DOWN); powerState = PowerState::OFF; #endif -- 2.43.0 From 75e74811417ee7d2126490b8d02a7aa2913b8758 Mon Sep 17 00:00:00 2001 From: Robin Mueller Date: Wed, 3 May 2023 16:45:14 +0200 Subject: [PATCH 36/36] changelog --- CHANGELOG.md | 1 + 1 file changed, 1 insertion(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index e38b7998..37bd4af4 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -29,6 +29,7 @@ will consitute of a breaking change warranting a new major release: - Do not track payload modes in system mode tables. - ACS modes derived from system modes. - Add support for MPSoC HK packet. +- Dynamically enable and disable HK packets for MPSoC on `ON` and `OFF` commands. ## Added -- 2.43.0