diff --git a/Drv/LinuxUartDriver/LinuxUartDriver.cpp b/Drv/LinuxUartDriver/LinuxUartDriver.cpp index 7decbd4ec88..f362b868947 100644 --- a/Drv/LinuxUartDriver/LinuxUartDriver.cpp +++ b/Drv/LinuxUartDriver/LinuxUartDriver.cpp @@ -295,6 +295,11 @@ LinuxUartDriver ::~LinuxUartDriver() { // Handler implementations for user-defined typed input ports // ---------------------------------------------------------------------- +void LinuxUartDriver ::run_handler(FwIndexType portNum, U32 context) { + this->tlmWrite_BytesSent(this->m_bytesSent); + this->tlmWrite_BytesRecv(this->m_bytesReceived); +} + void LinuxUartDriver ::send_handler(const FwIndexType portNum, Fw::Buffer& serBuffer) { Drv::ByteStreamStatus status = Drv::ByteStreamStatus::OP_OK; if (this->m_fd == -1 || serBuffer.getData() == nullptr || serBuffer.getSize() == 0) { @@ -312,7 +317,6 @@ void LinuxUartDriver ::send_handler(const FwIndexType portNum, Fw::Buffer& serBu status = Drv::ByteStreamStatus::OTHER_ERROR; } else { this->m_bytesSent += static_cast(stat); - this->tlmWrite_BytesSent(this->m_bytesSent); } } // Return the buffer back to the caller @@ -362,7 +366,6 @@ void LinuxUartDriver ::serialReadTaskEntry(void* ptr) { buff.setSize(static_cast(stat)); status = ByteStreamStatus::OP_OK; // added by m.chase 03.06.2017 comp->m_bytesReceived += static_cast(stat); - comp->tlmWrite_BytesRecv(comp->m_bytesReceived); } else { status = ByteStreamStatus::OTHER_ERROR; // Simply to return the buffer } diff --git a/Drv/LinuxUartDriver/LinuxUartDriver.fpp b/Drv/LinuxUartDriver/LinuxUartDriver.fpp index 30ad5f914cd..873dbedaa30 100644 --- a/Drv/LinuxUartDriver/LinuxUartDriver.fpp +++ b/Drv/LinuxUartDriver/LinuxUartDriver.fpp @@ -14,6 +14,9 @@ module Drv { @ Deallocation of allocated buffers output port deallocate: Fw.BufferSend + @ The rate group input for sending telemetry + sync input port run: Svc.Sched + # ---------------------------------------------------------------------- # Special ports # ---------------------------------------------------------------------- diff --git a/Drv/LinuxUartDriver/LinuxUartDriver.hpp b/Drv/LinuxUartDriver/LinuxUartDriver.hpp index f9b2bd788a4..12575dcc6cb 100644 --- a/Drv/LinuxUartDriver/LinuxUartDriver.hpp +++ b/Drv/LinuxUartDriver/LinuxUartDriver.hpp @@ -18,6 +18,7 @@ #include #include +#include namespace Drv { @@ -95,6 +96,13 @@ class LinuxUartDriver final : public LinuxUartDriverComponentBase { // Handler implementations for user-defined typed input ports // ---------------------------------------------------------------------- + //! Handler implementation for run + //! + //! The rate group input for sending telemetry + void run_handler(FwIndexType portNum, //!< The port number + U32 context //!< The call order + ) override; + //! Handler implementation for serialSend //! void send_handler(FwIndexType portNum, /*!< The port number*/ @@ -116,9 +124,9 @@ class LinuxUartDriver final : public LinuxUartDriverComponentBase { Os::Task m_readTask; //!< task instance for thread to read serial port - FwSizeType m_bytesSent; //!< number of bytes sent - FwSizeType m_bytesReceived; //!< number of bytes received - bool m_quitReadThread; //!< flag to quit thread + std::atomic m_bytesSent; //!< number of bytes sent + std::atomic m_bytesReceived; //!< number of bytes received + bool m_quitReadThread; //!< flag to quit thread }; } // end namespace Drv