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 
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 
110 
115 
120 
121  PROTECTED:
122 
123  // ----------------------------------------------------------------------
124  // Handlers to implement for typed input ports
125  // ----------------------------------------------------------------------
126 
129  FwIndexType portNum,
130  U32 addr,
131  Fw::Buffer& serBuffer
132  ) = 0;
133 
136  FwIndexType portNum,
137  U32 addr,
138  Fw::Buffer& serBuffer
139  ) = 0;
140 
143  FwIndexType portNum,
144  U32 addr,
145  Fw::Buffer& writeBuffer,
146  Fw::Buffer& readBuffer
147  ) = 0;
148 
149  PROTECTED:
150 
151  // ----------------------------------------------------------------------
152  // Port handler base-class functions for typed input ports
153  //
154  // Call these functions directly to bypass the corresponding ports
155  // ----------------------------------------------------------------------
156 
159  FwIndexType portNum,
160  U32 addr,
161  Fw::Buffer& serBuffer
162  );
163 
166  FwIndexType portNum,
167  U32 addr,
168  Fw::Buffer& serBuffer
169  );
170 
173  FwIndexType portNum,
174  U32 addr,
175  Fw::Buffer& writeBuffer,
176  Fw::Buffer& readBuffer
177  );
178 
179  PROTECTED:
180 
181  // ----------------------------------------------------------------------
182  // Mutex operations for guarded ports
183  //
184  // You can override these operations to provide more sophisticated
185  // synchronization
186  // ----------------------------------------------------------------------
187 
189  virtual void lock();
190 
192  virtual void unLock();
193 
194  PRIVATE:
195 
196  // ----------------------------------------------------------------------
197  // Calls for messages received on typed input ports
198  // ----------------------------------------------------------------------
199 
201  static Drv::I2cStatus m_p_read_in(
202  Fw::PassiveComponentBase* callComp,
203  FwIndexType portNum,
204  U32 addr,
205  Fw::Buffer& serBuffer
206  );
207 
209  static Drv::I2cStatus m_p_write_in(
210  Fw::PassiveComponentBase* callComp,
211  FwIndexType portNum,
212  U32 addr,
213  Fw::Buffer& serBuffer
214  );
215 
217  static Drv::I2cStatus m_p_writeRead_in(
218  Fw::PassiveComponentBase* callComp,
219  FwIndexType portNum,
220  U32 addr,
221  Fw::Buffer& writeBuffer,
222  Fw::Buffer& readBuffer
223  );
224 
225  PRIVATE:
226 
227  // ----------------------------------------------------------------------
228  // Typed input ports
229  // ----------------------------------------------------------------------
230 
232  Drv::InputI2cPort m_read_InputPort[NUM_READ_INPUT_PORTS];
233 
235  Drv::InputI2cPort m_write_InputPort[NUM_WRITE_INPUT_PORTS];
236 
239 
240  PRIVATE:
241 
242  // ----------------------------------------------------------------------
243  // Mutexes
244  // ----------------------------------------------------------------------
245 
247  Os::Mutex m_guardedPortMutex;
248 
249  };
250 
251 }
252 
253 #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.
I32 FwEnumStoreType
Drv::InputI2cPort * get_read_InputPort(FwIndexType portNum)
void init()
Object initializer.
Definition: ObjBase.cpp:26
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
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 LinuxI2cDriverComponentBaseFriend
Friend class for white-box testing.
friend class LinuxI2cDriverTesterBase
Friend class tester to support autocoded test harness.