F´ Flight Software - C/C++ Documentation
A framework for building embedded system applications to NASA flight quality standards.
Loading...
Searching...
No Matches
LinuxUartDriver.hpp
Go to the documentation of this file.
1// ======================================================================
2// \title LinuxUartDriverImpl.hpp
3// \author tcanham
4// \brief hpp file for LinuxUartDriver component implementation class
5//
6// \copyright
7// Copyright 2009-2015, by the California Institute of Technology.
8// ALL RIGHTS RESERVED. United States Government Sponsorship
9// acknowledged.
10//
11// ======================================================================
12
13#ifndef LinuxUartDriver_HPP
14#define LinuxUartDriver_HPP
15
17#include <Os/Mutex.hpp>
18#include <Os/Task.hpp>
19
20#include <termios.h>
21
22namespace Drv {
23
25 public:
26 // ----------------------------------------------------------------------
27 // Construction, initialization, and destruction
28 // ----------------------------------------------------------------------
29
32 LinuxUartDriver(const char* const compName
33 );
34
41 BAUD_115K=115200,
42 BAUD_230K=230400,
43#ifdef TGT_OS_TYPE_LINUX
44 BAUD_460K=460800,
45 BAUD_921K=921600,
46 BAUD_1000K=1000000000,
47 BAUD_1152K=1152000000,
48 BAUD_1500K=1500000000,
49 BAUD_2000K=2000000000,
50#ifdef B2500000
51 BAUD_2500K=2500000000,
52#endif
53#ifdef B3000000
54 BAUD_3000K=3000000000,
55#endif
56#ifdef B3500000
57 BAUD_3500K=3500000000,
58#endif
59#ifdef B4000000
60 BAUD_4000K=4000000000
61#endif
62#endif
63 };
64
66
68
69 // Open device with specified baud and flow control.
70 bool open(const char* const device, UartBaudRate baud, UartFlowControl fc, UartParity parity, U32 allocationSize);
71
78
80 void quitReadThread();
81
84
88
89 PRIVATE:
90 // ----------------------------------------------------------------------
91 // Handler implementations for user-defined typed input ports
92 // ----------------------------------------------------------------------
93
96 Drv::SendStatus send_handler(NATIVE_INT_TYPE portNum,
97 Fw::Buffer& serBuffer);
98
99
100 NATIVE_INT_TYPE m_fd;
101 U32 m_allocationSize;
102 const char* m_device;
103
105 static void serialReadTaskEntry(void* ptr);
106
107 Os::Task m_readTask;
108
109
110 bool m_quitReadThread;
111};
112
113} // end namespace Drv
114
115#endif
PlatformIntType NATIVE_INT_TYPE
Definition BasicTypes.h:55
Auto-generated base for LinuxUartDriver component.
void quitReadThread()
Quit thread.
Os::Task::Status join()
Join thread.
UartBaudRate
Configure UART parameters.
void start(Os::Task::ParamType priority=Os::Task::TASK_DEFAULT, Os::Task::ParamType stackSize=Os::Task::TASK_DEFAULT, Os::Task::ParamType cpuAffinity=Os::Task::TASK_DEFAULT)
bool open(const char *const device, UartBaudRate baud, UartFlowControl fc, UartParity parity, U32 allocationSize)
Status returned by the send call.
FwSizeType ParamType
backwards-compatible parameter type
Definition Task.hpp:219
static constexpr FwSizeType TASK_DEFAULT
Definition Task.hpp:28