F´ Flight Software - C/C++ Documentation
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"
13 #include "Fw/FPrimeBasicTypes.hpp"
14 #if !FW_DIRECT_PORT_CALLS
16 #endif
17 #if !FW_DIRECT_PORT_CALLS
19 #endif
20 #include "Os/Mutex.hpp"
21 
22 namespace Drv {
23 
28  {
29 
30  // ----------------------------------------------------------------------
31  // Friend classes
32  // ----------------------------------------------------------------------
33 
37  friend class LinuxI2cDriverTester;
38 
39  protected:
40 
41  // ----------------------------------------------------------------------
42  // Constants
43  // ----------------------------------------------------------------------
44 
46  enum {
50  };
51 
52  public:
53 
54  // ----------------------------------------------------------------------
55  // Component initialization
56  // ----------------------------------------------------------------------
57 
59  void init(
60  FwEnumStoreType instance = 0
61  );
62 
63 #if !FW_DIRECT_PORT_CALLS
64 
65  public:
66 
67  // ----------------------------------------------------------------------
68  // Getters for typed input ports
69  // ----------------------------------------------------------------------
70 
75  FwIndexType portNum
76  );
77 
82  FwIndexType portNum
83  );
84 
89  FwIndexType portNum
90  );
91 
92 #endif
93 
94  protected:
95 
96  // ----------------------------------------------------------------------
97  // Component construction and destruction
98  // ----------------------------------------------------------------------
99 
102  const char* compName = ""
103  );
104 
107 
108  protected:
109 
110  // ----------------------------------------------------------------------
111  // Getters for numbers of typed input ports
112  // ----------------------------------------------------------------------
113 
117  static constexpr FwIndexType getNum_read_InputPorts() {
118  return NUM_READ_INPUT_PORTS;
119  }
120 
125  return NUM_WRITE_INPUT_PORTS;
126  }
127 
133  }
134 
135  protected:
136 
137  // ----------------------------------------------------------------------
138  // Handlers to implement for typed input ports
139  // ----------------------------------------------------------------------
140 
143  FwIndexType portNum,
144  U32 addr,
145  Fw::Buffer& serBuffer
146  ) = 0;
147 
150  FwIndexType portNum,
151  U32 addr,
152  Fw::Buffer& serBuffer
153  ) = 0;
154 
157  FwIndexType portNum,
158  U32 addr,
159  Fw::Buffer& writeBuffer,
160  Fw::Buffer& readBuffer
161  ) = 0;
162 
163 #if FW_DIRECT_PORT_CALLS
164  public:
165 #else
166  protected:
167 #endif
168 
169  // ----------------------------------------------------------------------
170  // Port handler base-class functions for typed input ports
171  //
172  // Call these functions directly to bypass the corresponding ports
173  // ----------------------------------------------------------------------
174 
177  FwIndexType portNum,
178  U32 addr,
179  Fw::Buffer& serBuffer
180  );
181 
184  FwIndexType portNum,
185  U32 addr,
186  Fw::Buffer& serBuffer
187  );
188 
191  FwIndexType portNum,
192  U32 addr,
193  Fw::Buffer& writeBuffer,
194  Fw::Buffer& readBuffer
195  );
196 
197  protected:
198 
199  // ----------------------------------------------------------------------
200  // Mutex operations for guarded ports
201  //
202  // You can override these operations to provide more sophisticated
203  // synchronization
204  // ----------------------------------------------------------------------
205 
207  virtual void lock();
208 
210  virtual void unLock();
211 
212  private:
213 
214  // ----------------------------------------------------------------------
215  // Calls for messages received on typed input ports
216  // ----------------------------------------------------------------------
217 
219  static Drv::I2cStatus m_p_read_in(
220  Fw::PassiveComponentBase* callComp,
221  FwIndexType portNum,
222  U32 addr,
223  Fw::Buffer& serBuffer
224  );
225 
227  static Drv::I2cStatus m_p_write_in(
228  Fw::PassiveComponentBase* callComp,
229  FwIndexType portNum,
230  U32 addr,
231  Fw::Buffer& serBuffer
232  );
233 
235  static Drv::I2cStatus m_p_writeRead_in(
236  Fw::PassiveComponentBase* callComp,
237  FwIndexType portNum,
238  U32 addr,
239  Fw::Buffer& writeBuffer,
240  Fw::Buffer& readBuffer
241  );
242 
243 #if !FW_DIRECT_PORT_CALLS
244 
245  private:
246 
247  // ----------------------------------------------------------------------
248  // Typed input ports
249  // ----------------------------------------------------------------------
250 
252  Drv::InputI2cPort m_read_InputPort[NUM_READ_INPUT_PORTS];
253 
255  Drv::InputI2cPort m_write_InputPort[NUM_WRITE_INPUT_PORTS];
256 
259 
260 #endif
261 
262  private:
263 
264  // ----------------------------------------------------------------------
265  // Mutexes
266  // ----------------------------------------------------------------------
267 
269  Os::Mutex m_guardedPortMutex;
270 
271  };
272 
273 }
274 
275 #endif
virtual void lock()
Lock the guarded mutex.
Drv::InputI2cPort * get_write_InputPort(FwIndexType portNum)
Drv::I2cStatus read_handlerBase(FwIndexType portNum, U32 addr, Fw::Buffer &serBuffer)
Handler base-class function for input port read.
friend class LinuxI2cDriverTester
Friend class tester implementation to support white-box testing.
I32 FwEnumStoreType
Drv::InputI2cPort * get_read_InputPort(FwIndexType portNum)
static constexpr FwIndexType getNum_writeRead_InputPorts()
void init()
Object initializer.
Definition: ObjBase.cpp:24
virtual void unLock()
Unlock the guarded mutex.
Drv::I2cStatus write_handlerBase(FwIndexType portNum, U32 addr, Fw::Buffer &serBuffer)
Handler base-class function for input port write.
LinuxI2cDriverComponentBase(const char *compName="")
Construct LinuxI2cDriverComponentBase object.
virtual Drv::I2cStatus writeRead_handler(FwIndexType portNum, U32 addr, Fw::Buffer &writeBuffer, Fw::Buffer &readBuffer)=0
Handler for input port writeRead.
Drv::InputI2cWriteReadPort * get_writeRead_InputPort(FwIndexType portNum)
Auto-generated base for LinuxI2cDriver component.
Drv::I2cStatus writeRead_handlerBase(FwIndexType portNum, U32 addr, Fw::Buffer &writeBuffer, Fw::Buffer &readBuffer)
Handler base-class function for input port writeRead.
virtual Drv::I2cStatus read_handler(FwIndexType portNum, U32 addr, Fw::Buffer &serBuffer)=0
Handler for input port read.
PlatformIndexType FwIndexType
static constexpr FwIndexType getNum_write_InputPorts()
static constexpr FwIndexType getNum_read_InputPorts()
virtual Drv::I2cStatus write_handler(FwIndexType portNum, U32 addr, Fw::Buffer &serBuffer)=0
Handler for input port write.
virtual ~LinuxI2cDriverComponentBase()
Destroy LinuxI2cDriverComponentBase object.
Input I2c port.
Definition: I2cPortAc.hpp:24
friend class LinuxI2cDriverTesterBase
Friend class tester to support autocoded test harness.