F´ Flight Software - C/C++ Documentation NASA-v1.6.0
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
16#include <Drv/LinuxUartDriver/LinuxUartDriverComponentAc.hpp>
17#include <Os/Mutex.hpp>
18#include <Os/Task.hpp>
19
20namespace Drv {
21
22class LinuxUartDriver : public LinuxUartDriverComponentBase {
23 public:
24 // ----------------------------------------------------------------------
25 // Construction, initialization, and destruction
26 // ----------------------------------------------------------------------
27
30 LinuxUartDriver(const char* const compName
31 );
32
35 void init(const NATIVE_INT_TYPE instance = 0
36 );
37
39 enum UartBaudRate { BAUD_9600=9600, BAUD_19200=19200, BAUD_38400=38400, BAUD_57600=57600, BAUD_115K=115200, BAUD_230K=230400, BAUD_460K=460800, BAUD_921K=921600};
40
42
44
45 // Open device with specified baud and flow control.
46 bool open(const char* const device, UartBaudRate baud, UartFlowControl fc, UartParity parity, NATIVE_INT_TYPE allocationSize);
47
54
56 void quitReadThread();
57
59 Os::Task::TaskStatus join(void** value_ptr);
60
64
65 PRIVATE:
66 // ----------------------------------------------------------------------
67 // Handler implementations for user-defined typed input ports
68 // ----------------------------------------------------------------------
69
72 Drv::SendStatus send_handler(NATIVE_INT_TYPE portNum,
73 Fw::Buffer& serBuffer);
74
75
76 NATIVE_INT_TYPE m_fd;
77 NATIVE_INT_TYPE m_allocationSize;
78 const char* m_device;
79
81 static void serialReadTaskEntry(void* ptr);
82
83 Os::Task m_readTask;
84
85
86 bool m_quitReadThread;
87};
88
89} // end namespace Drv
90
91#endif
PlatformIntType NATIVE_INT_TYPE
Definition BasicTypes.h:51
PlatformUIntType NATIVE_UINT_TYPE
Definition BasicTypes.h:52
void quitReadThread()
Quit thread.
bool open(const char *const device, UartBaudRate baud, UartFlowControl fc, UartParity parity, NATIVE_INT_TYPE allocationSize)
void init(const NATIVE_INT_TYPE instance=0)
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)
forward declaration
Definition Task.hpp:15
static const NATIVE_UINT_TYPE TASK_DEFAULT
Definition Task.hpp:17
TaskStatus
Definition Task.hpp:18