F´ Flight Software - C/C++ Documentation devel
A framework for building embedded system applications to NASA flight quality standards.
All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
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
37 void init(const NATIVE_INT_TYPE instance = 0
38 );
39
46 BAUD_115K=115200,
47 BAUD_230K=230400,
48#ifdef TGT_OS_TYPE_LINUX
49 BAUD_460K=460800,
50 BAUD_921K=921600,
51 BAUD_1000K=1000000000,
52 BAUD_1152K=1152000000,
53 BAUD_1500K=1500000000,
54 BAUD_2000K=2000000000,
55#ifdef B2500000
56 BAUD_2500K=2500000000,
57#endif
58#ifdef B3000000
59 BAUD_3000K=3000000000,
60#endif
61#ifdef B3500000
62 BAUD_3500K=3500000000,
63#endif
64#ifdef B4000000
65 BAUD_4000K=4000000000
66#endif
67#endif
68 };
69
71
73
74 // Open device with specified baud and flow control.
75 bool open(const char* const device, UartBaudRate baud, UartFlowControl fc, UartParity parity, NATIVE_INT_TYPE allocationSize);
76
83
85 void quitReadThread();
86
88 Os::Task::TaskStatus join(void** value_ptr);
89
93
94 PRIVATE:
95 // ----------------------------------------------------------------------
96 // Handler implementations for user-defined typed input ports
97 // ----------------------------------------------------------------------
98
101 Drv::SendStatus send_handler(NATIVE_INT_TYPE portNum,
102 Fw::Buffer& serBuffer);
103
104
105 NATIVE_INT_TYPE m_fd;
106 NATIVE_INT_TYPE m_allocationSize;
107 const char* m_device;
108
110 static void serialReadTaskEntry(void* ptr);
111
112 Os::Task m_readTask;
113
114
115 bool m_quitReadThread;
116};
117
118} // end namespace Drv
119
120#endif
PlatformIntType NATIVE_INT_TYPE
Definition BasicTypes.h:51
PlatformUIntType NATIVE_UINT_TYPE
Definition BasicTypes.h:52
Auto-generated base for LinuxUartDriver component.
void quitReadThread()
Quit thread.
bool open(const char *const device, UartBaudRate baud, UartFlowControl fc, UartParity parity, NATIVE_INT_TYPE allocationSize)
LinuxUartDriver(const char *const compName)
Os::Task::TaskStatus join(void **value_ptr)
Join thread.
UartBaudRate
Configure UART parameters.
void startReadThread(NATIVE_UINT_TYPE priority=Os::Task::TASK_DEFAULT, NATIVE_UINT_TYPE stackSize=Os::Task::TASK_DEFAULT, NATIVE_UINT_TYPE cpuAffinity=Os::Task::TASK_DEFAULT)
Status returned by the send call.
void init()
Object initializer.
Definition ObjBase.cpp:27
forward declaration
Definition Task.hpp:15
static const NATIVE_UINT_TYPE TASK_DEFAULT
Definition Task.hpp:17
TaskStatus
Definition Task.hpp:18