From 316971c6bc9e754339f87b743b3587c6814eca5d Mon Sep 17 00:00:00 2001 From: Jakob Meier Date: Mon, 27 Feb 2023 07:49:09 +0100 Subject: [PATCH] * added event when transmitter is turned on due to bitlock detection * added event when tx timer has expired --- common/config/eive/eventSubsystemIds.h | 1 + linux/ipcore/PdecHandler.cpp | 4 +--- mission/system/objects/ComSubsystem.cpp | 2 ++ mission/system/objects/ComSubsystem.h | 13 +++++++++++-- 4 files changed, 15 insertions(+), 5 deletions(-) diff --git a/common/config/eive/eventSubsystemIds.h b/common/config/eive/eventSubsystemIds.h index 32397f9f..923a06ad 100644 --- a/common/config/eive/eventSubsystemIds.h +++ b/common/config/eive/eventSubsystemIds.h @@ -37,6 +37,7 @@ enum : uint8_t { CONFIGHANDLER = 139, CORE = 140, TCS_CONTROLLER = 141, + COM_SUBSYSTEM = 142, COMMON_SUBSYSTEM_ID_END }; diff --git a/linux/ipcore/PdecHandler.cpp b/linux/ipcore/PdecHandler.cpp index 3c901b42..db93bd6e 100644 --- a/linux/ipcore/PdecHandler.cpp +++ b/linux/ipcore/PdecHandler.cpp @@ -187,7 +187,6 @@ ReturnValue_t PdecHandler::irqOperation() { switch (state) { case State::INIT: { handleInitState(); - checkLocks(); break; } case State::PDEC_RESET: { @@ -199,6 +198,7 @@ ReturnValue_t PdecHandler::irqOperation() { break; } case State::RUNNING: { + checkLocks(); checkAndHandleIrqs(fd, info); break; } @@ -251,7 +251,6 @@ ReturnValue_t PdecHandler::checkAndHandleIrqs(int fd, uint32_t& info) { int ret = poll(&fds, 1, IRQ_TIMEOUT_MS); if (ret == 0) { // No TCs for timeout period - checkLocks(); genericCheckCd.resetTimer(); resetIrqLimiters(); } else if (ret >= 1) { @@ -278,7 +277,6 @@ ReturnValue_t PdecHandler::checkAndHandleIrqs(int fd, uint32_t& info) { static_cast(dummy); if (genericCheckCd.hasTimedOut()) { - checkLocks(); genericCheckCd.resetTimer(); if (interruptWindowCd.hasTimedOut()) { if (interruptCounter >= MAX_ALLOWED_IRQS_PER_WINDOW) { diff --git a/mission/system/objects/ComSubsystem.cpp b/mission/system/objects/ComSubsystem.cpp index a30f441b..9df7e72b 100644 --- a/mission/system/objects/ComSubsystem.cpp +++ b/mission/system/objects/ComSubsystem.cpp @@ -166,6 +166,7 @@ void ComSubsystem::handleBitLockEvent() { rememberBitLock = true; return; } + triggerEvent(BIT_LOCK_TX_ON); startRxAndTxLowRateSeq(); } @@ -183,6 +184,7 @@ void ComSubsystem::startRxAndTxLowRateSeq() { void ComSubsystem::checkTransmitterCountdown() { if (transmitterCountdown.hasTimedOut()) { + triggerEvent(TX_TIMER_EXPIRED, transmitterTimeout); startTransition(com::Submode::RX_ONLY, SUBMODE_NONE); countdownActive = false; } diff --git a/mission/system/objects/ComSubsystem.h b/mission/system/objects/ComSubsystem.h index fb97f226..831b4cec 100644 --- a/mission/system/objects/ComSubsystem.h +++ b/mission/system/objects/ComSubsystem.h @@ -5,11 +5,21 @@ #include #include #include +#include #include "mission/comDefs.h" class ComSubsystem : public Subsystem, public ReceivesParameterMessagesIF { public: + + static const uint8_t SUBSYSTEM_ID = SUBSYSTEM_ID::COM_SUBSYSTEM; + + //! [EXPORT] : [COMMENT] The transmit timer to protect the Syrlinks expired + //! P1: The current timer value + static const Event TX_TIMER_EXPIRED = MAKE_EVENT(1, severity::INFO); + //! [EXPORT] : [COMMENT] Transmitter will be turned on due to detection of bitlock + static const Event BIT_LOCK_TX_ON = MAKE_EVENT(2, severity::INFO); + /** * @brief Constructor * @@ -17,8 +27,7 @@ class ComSubsystem : public Subsystem, public ReceivesParameterMessagesIF { * @param maxNumberOfSequences * @param maxNumberOfTables * @param transmitterTimeout Maximum time the transmitter of the syrlinks - * will - * be enabled + * will be enabled */ ComSubsystem(object_id_t setObjectId, uint32_t maxNumberOfSequences, uint32_t maxNumberOfTables, uint32_t transmitterTimeout);