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"
16 #include "Os/Mutex.hpp"
17 
18 namespace Drv {
19 
24  {
25 
26  // ----------------------------------------------------------------------
27  // Friend classes
28  // ----------------------------------------------------------------------
29 
33  friend class LinuxI2cDriverTester;
34 
35  protected:
36 
37  // ----------------------------------------------------------------------
38  // Constants
39  // ----------------------------------------------------------------------
40 
42  enum {
46  };
47 
48  public:
49 
50  // ----------------------------------------------------------------------
51  // Component initialization
52  // ----------------------------------------------------------------------
53 
55  void init(
56  FwEnumStoreType instance = 0
57  );
58 
59  public:
60 
61  // ----------------------------------------------------------------------
62  // Getters for typed input ports
63  // ----------------------------------------------------------------------
64 
69  FwIndexType portNum
70  );
71 
76  FwIndexType portNum
77  );
78 
83  FwIndexType portNum
84  );
85 
86  protected:
87 
88  // ----------------------------------------------------------------------
89  // Component construction and destruction
90  // ----------------------------------------------------------------------
91 
94  const char* compName = ""
95  );
96 
99 
100  protected:
101 
102  // ----------------------------------------------------------------------
103  // Getters for numbers of typed input ports
104  // ----------------------------------------------------------------------
105 
109  static constexpr FwIndexType getNum_read_InputPorts() {
110  return NUM_READ_INPUT_PORTS;
111  }
112 
117  return NUM_WRITE_INPUT_PORTS;
118  }
119 
125  }
126 
127  protected:
128 
129  // ----------------------------------------------------------------------
130  // Handlers to implement for typed input ports
131  // ----------------------------------------------------------------------
132 
135  FwIndexType portNum,
136  U32 addr,
137  Fw::Buffer& serBuffer
138  ) = 0;
139 
142  FwIndexType portNum,
143  U32 addr,
144  Fw::Buffer& serBuffer
145  ) = 0;
146 
149  FwIndexType portNum,
150  U32 addr,
151  Fw::Buffer& writeBuffer,
152  Fw::Buffer& readBuffer
153  ) = 0;
154 
155  protected:
156 
157  // ----------------------------------------------------------------------
158  // Port handler base-class functions for typed input ports
159  //
160  // Call these functions directly to bypass the corresponding ports
161  // ----------------------------------------------------------------------
162 
165  FwIndexType portNum,
166  U32 addr,
167  Fw::Buffer& serBuffer
168  );
169 
172  FwIndexType portNum,
173  U32 addr,
174  Fw::Buffer& serBuffer
175  );
176 
179  FwIndexType portNum,
180  U32 addr,
181  Fw::Buffer& writeBuffer,
182  Fw::Buffer& readBuffer
183  );
184 
185  protected:
186 
187  // ----------------------------------------------------------------------
188  // Mutex operations for guarded ports
189  //
190  // You can override these operations to provide more sophisticated
191  // synchronization
192  // ----------------------------------------------------------------------
193 
195  virtual void lock();
196 
198  virtual void unLock();
199 
200  private:
201 
202  // ----------------------------------------------------------------------
203  // Calls for messages received on typed input ports
204  // ----------------------------------------------------------------------
205 
207  static Drv::I2cStatus m_p_read_in(
208  Fw::PassiveComponentBase* callComp,
209  FwIndexType portNum,
210  U32 addr,
211  Fw::Buffer& serBuffer
212  );
213 
215  static Drv::I2cStatus m_p_write_in(
216  Fw::PassiveComponentBase* callComp,
217  FwIndexType portNum,
218  U32 addr,
219  Fw::Buffer& serBuffer
220  );
221 
223  static Drv::I2cStatus m_p_writeRead_in(
224  Fw::PassiveComponentBase* callComp,
225  FwIndexType portNum,
226  U32 addr,
227  Fw::Buffer& writeBuffer,
228  Fw::Buffer& readBuffer
229  );
230 
231  private:
232 
233  // ----------------------------------------------------------------------
234  // Typed input ports
235  // ----------------------------------------------------------------------
236 
238  Drv::InputI2cPort m_read_InputPort[NUM_READ_INPUT_PORTS];
239 
241  Drv::InputI2cPort m_write_InputPort[NUM_WRITE_INPUT_PORTS];
242 
245 
246  private:
247 
248  // ----------------------------------------------------------------------
249  // Mutexes
250  // ----------------------------------------------------------------------
251 
253  Os::Mutex m_guardedPortMutex;
254 
255  };
256 
257 }
258 
259 #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.