F´ Flight Software - C/C++ Documentation  devel
A framework for building embedded system applications to NASA flight quality standards.
LinuxI2cDriverComponentAc.hpp
Go to the documentation of this file.
1 // ======================================================================
2 // \title LinuxI2cDriverComponentAc.hpp
3 // \author Generated by fpp-to-cpp
4 // \brief hpp file for LinuxI2cDriver component base class
5 // ======================================================================
6 
7 #ifndef Drv_LinuxI2cDriverComponentAc_HPP
8 #define Drv_LinuxI2cDriverComponentAc_HPP
9 
10 #include "Drv/Ports/I2cPortAc.hpp"
12 #include "FpConfig.hpp"
16 #include "Os/Mutex.hpp"
17 
18 namespace Drv {
19 
24  {
25 
26  // ----------------------------------------------------------------------
27  // Friend classes
28  // ----------------------------------------------------------------------
29 
32 
33  PROTECTED:
34 
35  // ----------------------------------------------------------------------
36  // Constants
37  // ----------------------------------------------------------------------
38 
40  enum {
44  };
45 
46  public:
47 
48  // ----------------------------------------------------------------------
49  // Component initialization
50  // ----------------------------------------------------------------------
51 
53  void init(
54  FwEnumStoreType instance = 0
55  );
56 
57  public:
58 
59  // ----------------------------------------------------------------------
60  // Getters for typed input ports
61  // ----------------------------------------------------------------------
62 
67  FwIndexType portNum
68  );
69 
74  FwIndexType portNum
75  );
76 
81  FwIndexType portNum
82  );
83 
84  PROTECTED:
85 
86  // ----------------------------------------------------------------------
87  // Component construction and destruction
88  // ----------------------------------------------------------------------
89 
92  const char* compName = ""
93  );
94 
97 
98  PROTECTED:
99 
100  // ----------------------------------------------------------------------
101  // Getters for numbers of typed input ports
102  // ----------------------------------------------------------------------
103 
108 
113 
118 
119  PROTECTED:
120 
121  // ----------------------------------------------------------------------
122  // Handlers to implement for typed input ports
123  // ----------------------------------------------------------------------
124 
127  FwIndexType portNum,
128  U32 addr,
129  Fw::Buffer& serBuffer
130  ) = 0;
131 
134  FwIndexType portNum,
135  U32 addr,
136  Fw::Buffer& serBuffer
137  ) = 0;
138 
141  FwIndexType portNum,
142  U32 addr,
143  Fw::Buffer& writeBuffer,
144  Fw::Buffer& readBuffer
145  ) = 0;
146 
147  PROTECTED:
148 
149  // ----------------------------------------------------------------------
150  // Port handler base-class functions for typed input ports
151  //
152  // Call these functions directly to bypass the corresponding ports
153  // ----------------------------------------------------------------------
154 
157  FwIndexType portNum,
158  U32 addr,
159  Fw::Buffer& serBuffer
160  );
161 
164  FwIndexType portNum,
165  U32 addr,
166  Fw::Buffer& serBuffer
167  );
168 
171  FwIndexType portNum,
172  U32 addr,
173  Fw::Buffer& writeBuffer,
174  Fw::Buffer& readBuffer
175  );
176 
177  PROTECTED:
178 
179  // ----------------------------------------------------------------------
180  // Mutex operations for guarded ports
181  //
182  // You can override these operations to provide more sophisticated
183  // synchronization
184  // ----------------------------------------------------------------------
185 
187  virtual void lock();
188 
190  virtual void unLock();
191 
192  PRIVATE:
193 
194  // ----------------------------------------------------------------------
195  // Calls for messages received on typed input ports
196  // ----------------------------------------------------------------------
197 
199  static Drv::I2cStatus m_p_read_in(
200  Fw::PassiveComponentBase* callComp,
201  FwIndexType portNum,
202  U32 addr,
203  Fw::Buffer& serBuffer
204  );
205 
207  static Drv::I2cStatus m_p_write_in(
208  Fw::PassiveComponentBase* callComp,
209  FwIndexType portNum,
210  U32 addr,
211  Fw::Buffer& serBuffer
212  );
213 
215  static Drv::I2cStatus m_p_writeRead_in(
216  Fw::PassiveComponentBase* callComp,
217  FwIndexType portNum,
218  U32 addr,
219  Fw::Buffer& writeBuffer,
220  Fw::Buffer& readBuffer
221  );
222 
223  PRIVATE:
224 
225  // ----------------------------------------------------------------------
226  // Typed input ports
227  // ----------------------------------------------------------------------
228 
230  Drv::InputI2cPort m_read_InputPort[NUM_READ_INPUT_PORTS];
231 
233  Drv::InputI2cPort m_write_InputPort[NUM_WRITE_INPUT_PORTS];
234 
237 
238  PRIVATE:
239 
240  // ----------------------------------------------------------------------
241  // Mutexes
242  // ----------------------------------------------------------------------
243 
245  Os::Mutex m_guardedPortMutex;
246 
247  };
248 
249 }
250 
251 #endif
I32 FwEnumStoreType
Definition: FpConfig.h:64
PlatformIndexType FwIndexType
Definition: FpConfig.h:25
C++-compatible configuration header for fprime configuration.
Input I2c port.
Definition: I2cPortAc.hpp:26
Auto-generated base for LinuxI2cDriver component.
Drv::I2cStatus read_handlerBase(FwIndexType portNum, U32 addr, Fw::Buffer &serBuffer)
Handler base-class function for input port read.
Drv::InputI2cPort * get_read_InputPort(FwIndexType portNum)
Drv::InputI2cWriteReadPort * get_writeRead_InputPort(FwIndexType portNum)
LinuxI2cDriverComponentBase(const char *compName="")
Construct LinuxI2cDriverComponentBase object.
virtual void lock()
Lock the guarded mutex.
virtual Drv::I2cStatus writeRead_handler(FwIndexType portNum, U32 addr, Fw::Buffer &writeBuffer, Fw::Buffer &readBuffer)=0
Handler for input port writeRead.
Drv::I2cStatus write_handlerBase(FwIndexType portNum, U32 addr, Fw::Buffer &serBuffer)
Handler base-class function for input port write.
virtual void unLock()
Unlock the guarded mutex.
virtual Drv::I2cStatus write_handler(FwIndexType portNum, U32 addr, Fw::Buffer &serBuffer)=0
Handler for input port write.
Drv::I2cStatus writeRead_handlerBase(FwIndexType portNum, U32 addr, Fw::Buffer &writeBuffer, Fw::Buffer &readBuffer)
Handler base-class function for input port writeRead.
Drv::InputI2cPort * get_write_InputPort(FwIndexType portNum)
virtual Drv::I2cStatus read_handler(FwIndexType portNum, U32 addr, Fw::Buffer &serBuffer)=0
Handler for input port read.
friend class LinuxI2cDriverComponentBaseFriend
Friend class for white-box testing.
virtual ~LinuxI2cDriverComponentBase()
Destroy LinuxI2cDriverComponentBase object.
void init()
Object initializer.
Definition: ObjBase.cpp:27