Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 5 additions & 2 deletions Drv/LinuxUartDriver/LinuxUartDriver.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand All @@ -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<FwSizeType>(stat);
this->tlmWrite_BytesSent(this->m_bytesSent);
}
}
// Return the buffer back to the caller
Expand Down Expand Up @@ -362,7 +366,6 @@ void LinuxUartDriver ::serialReadTaskEntry(void* ptr) {
buff.setSize(static_cast<U32>(stat));
status = ByteStreamStatus::OP_OK; // added by m.chase 03.06.2017
comp->m_bytesReceived += static_cast<FwSizeType>(stat);
comp->tlmWrite_BytesRecv(comp->m_bytesReceived);
} else {
status = ByteStreamStatus::OTHER_ERROR; // Simply to return the buffer
}
Expand Down
3 changes: 3 additions & 0 deletions Drv/LinuxUartDriver/LinuxUartDriver.fpp
Original file line number Diff line number Diff line change
Expand Up @@ -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
# ----------------------------------------------------------------------
Expand Down
14 changes: 11 additions & 3 deletions Drv/LinuxUartDriver/LinuxUartDriver.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
#include <Os/Task.hpp>

#include <termios.h>
#include <atomic>

namespace Drv {

Expand Down Expand Up @@ -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*/
Expand All @@ -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<FwSizeType> m_bytesSent; //!< number of bytes sent
std::atomic<FwSizeType> m_bytesReceived; //!< number of bytes received
bool m_quitReadThread; //!< flag to quit thread
};

} // end namespace Drv
Expand Down
Loading