F´ Flight Software - C/C++ Documentation
A framework for building embedded system applications to NASA flight quality standards.
LinuxGpioDriverComponentAc.hpp
Go to the documentation of this file.
1 // ======================================================================
2 // \title LinuxGpioDriverComponentAc.hpp
3 // \author Generated by fpp-to-cpp
4 // \brief hpp file for LinuxGpioDriver component base class
5 // ======================================================================
6 
7 #ifndef Drv_LinuxGpioDriverComponentAc_HPP
8 #define Drv_LinuxGpioDriverComponentAc_HPP
9 
10 #include <atomic>
11 
15 #include "Fw/FPrimeBasicTypes.hpp"
16 #include "Fw/Log/LogPortAc.hpp"
17 #include "Fw/Log/LogString.hpp"
18 #if FW_ENABLE_TEXT_LOGGING == 1
19 #include "Fw/Log/LogTextPortAc.hpp"
20 #endif
23 #include "Fw/Time/TimePortAc.hpp"
26 
27 namespace Drv {
28 
33  {
34 
35  // ----------------------------------------------------------------------
36  // Friend classes
37  // ----------------------------------------------------------------------
38 
42  friend class LinuxGpioDriverTester;
43 
44  protected:
45 
46  // ----------------------------------------------------------------------
47  // Constants
48  // ----------------------------------------------------------------------
49 
51  enum {
54  };
55 
57  enum {
61  };
62 
64  enum {
66  };
67 
69  enum {
75  };
76 
77  public:
78 
79  // ----------------------------------------------------------------------
80  // Component initialization
81  // ----------------------------------------------------------------------
82 
84  void init(
85  FwEnumStoreType instance = 0
86  );
87 
88  public:
89 
90  // ----------------------------------------------------------------------
91  // Getters for typed input ports
92  // ----------------------------------------------------------------------
93 
98  FwIndexType portNum
99  );
100 
105  FwIndexType portNum
106  );
107 
108  public:
109 
110  // ----------------------------------------------------------------------
111  // Connect input ports to special output ports
112  // ----------------------------------------------------------------------
113 
115  void set_Log_OutputPort(
116  FwIndexType portNum,
117  Fw::InputLogPort* port
118  );
119 
120 #if FW_ENABLE_TEXT_LOGGING == 1
121 
123  void set_LogText_OutputPort(
124  FwIndexType portNum,
125  Fw::InputLogTextPort* port
126  );
127 
128 #endif
129 
131  void set_Time_OutputPort(
132  FwIndexType portNum,
133  Fw::InputTimePort* port
134  );
135 
136  public:
137 
138  // ----------------------------------------------------------------------
139  // Connect typed input ports to typed output ports
140  // ----------------------------------------------------------------------
141 
144  FwIndexType portNum,
145  Svc::InputCyclePort* port
146  );
147 
148 #if FW_PORT_SERIALIZATION
149 
150  public:
151 
152  // ----------------------------------------------------------------------
153  // Connect serial input ports to special output ports
154  // ----------------------------------------------------------------------
155 
157  void set_Log_OutputPort(
158  FwIndexType portNum,
159  Fw::InputSerializePort* port
160  );
161 
162 #if FW_ENABLE_TEXT_LOGGING == 1
163 
165  void set_LogText_OutputPort(
166  FwIndexType portNum,
167  Fw::InputSerializePort* port
168  );
169 
170 #endif
171 
173  void set_Time_OutputPort(
174  FwIndexType portNum,
175  Fw::InputSerializePort* port
176  );
177 
178 #endif
179 
180 #if FW_PORT_SERIALIZATION
181 
182  public:
183 
184  // ----------------------------------------------------------------------
185  // Connect serial input ports to typed output ports
186  // ----------------------------------------------------------------------
187 
190  FwIndexType portNum,
191  Fw::InputSerializePort* port
192  );
193 
194 #endif
195 
196  protected:
197 
198  // ----------------------------------------------------------------------
199  // Component construction and destruction
200  // ----------------------------------------------------------------------
201 
204  const char* compName = ""
205  );
206 
209 
210  protected:
211 
212  // ----------------------------------------------------------------------
213  // Getters for numbers of typed input ports
214  // ----------------------------------------------------------------------
215 
221  }
222 
228  }
229 
230  protected:
231 
232  // ----------------------------------------------------------------------
233  // Getters for numbers of special output ports
234  // ----------------------------------------------------------------------
235 
239  static constexpr FwIndexType getNum_Log_OutputPorts() {
240  return NUM_LOG_OUTPUT_PORTS;
241  }
242 
243 #if FW_ENABLE_TEXT_LOGGING == 1
244 
248  static constexpr FwIndexType getNum_LogText_OutputPorts() {
250  }
251 
252 #endif
253 
258  return NUM_TIME_OUTPUT_PORTS;
259  }
260 
261  protected:
262 
263  // ----------------------------------------------------------------------
264  // Getters for numbers of typed output ports
265  // ----------------------------------------------------------------------
266 
272  }
273 
274  protected:
275 
276  // ----------------------------------------------------------------------
277  // Connection status queries for special output ports
278  // ----------------------------------------------------------------------
279 
284  FwIndexType portNum
285  );
286 
287 #if FW_ENABLE_TEXT_LOGGING == 1
288 
292  bool isConnected_LogText_OutputPort(
293  FwIndexType portNum
294  );
295 
296 #endif
297 
302  FwIndexType portNum
303  );
304 
305  protected:
306 
307  // ----------------------------------------------------------------------
308  // Connection status queries for typed output ports
309  // ----------------------------------------------------------------------
310 
315  FwIndexType portNum
316  );
317 
318  protected:
319 
320  // ----------------------------------------------------------------------
321  // Handlers to implement for typed input ports
322  // ----------------------------------------------------------------------
323 
326  FwIndexType portNum,
327  Fw::Logic& state
328  ) = 0;
329 
332  FwIndexType portNum,
333  const Fw::Logic& state
334  ) = 0;
335 
336  protected:
337 
338  // ----------------------------------------------------------------------
339  // Port handler base-class functions for typed input ports
340  //
341  // Call these functions directly to bypass the corresponding ports
342  // ----------------------------------------------------------------------
343 
346  FwIndexType portNum,
347  Fw::Logic& state
348  );
349 
352  FwIndexType portNum,
353  const Fw::Logic& state
354  );
355 
356  protected:
357 
358  // ----------------------------------------------------------------------
359  // Invocation functions for typed output ports
360  // ----------------------------------------------------------------------
361 
363  void gpioInterrupt_out(
364  FwIndexType portNum,
365  Os::RawTime& cycleStart
366  );
367 
368  protected:
369 
370  // ----------------------------------------------------------------------
371  // Event logging functions
372  // ----------------------------------------------------------------------
373 
376  const Fw::StringBase& chip,
377  const Fw::StringBase& chipLabel,
378  U32 pin,
379  const Fw::StringBase& pinMessage
380  ) const;
381 
384  const Fw::StringBase& chip,
385  Os::FileStatus status
386  ) const;
387 
390  const Fw::StringBase& chip,
391  U32 pin,
392  const Fw::StringBase& pinMessage,
393  Os::FileStatus status
394  ) const;
395 
398  U32 expected,
399  U32 got
400  ) const;
401 
403  void log_WARNING_HI_PollingError(I32 error_number) const;
404 
405  protected:
406 
407  // ----------------------------------------------------------------------
408  // Time
409  // ----------------------------------------------------------------------
410 
414  Fw::Time getTime() const;
415 
416  private:
417 
418  // ----------------------------------------------------------------------
419  // Calls for messages received on typed input ports
420  // ----------------------------------------------------------------------
421 
423  static Drv::GpioStatus m_p_gpioRead_in(
424  Fw::PassiveComponentBase* callComp,
425  FwIndexType portNum,
426  Fw::Logic& state
427  );
428 
430  static Drv::GpioStatus m_p_gpioWrite_in(
431  Fw::PassiveComponentBase* callComp,
432  FwIndexType portNum,
433  const Fw::Logic& state
434  );
435 
436  private:
437 
438  // ----------------------------------------------------------------------
439  // Typed input ports
440  // ----------------------------------------------------------------------
441 
443  Drv::InputGpioReadPort m_gpioRead_InputPort[NUM_GPIOREAD_INPUT_PORTS];
444 
446  Drv::InputGpioWritePort m_gpioWrite_InputPort[NUM_GPIOWRITE_INPUT_PORTS];
447 
448  private:
449 
450  // ----------------------------------------------------------------------
451  // Special output ports
452  // ----------------------------------------------------------------------
453 
455  Fw::OutputLogPort m_Log_OutputPort[NUM_LOG_OUTPUT_PORTS];
456 
457 #if FW_ENABLE_TEXT_LOGGING == 1
458 
460  Fw::OutputLogTextPort m_LogText_OutputPort[NUM_LOGTEXT_OUTPUT_PORTS];
461 
462 #endif
463 
465  Fw::OutputTimePort m_Time_OutputPort[NUM_TIME_OUTPUT_PORTS];
466 
467  private:
468 
469  // ----------------------------------------------------------------------
470  // Typed output ports
471  // ----------------------------------------------------------------------
472 
474  Svc::OutputCyclePort m_gpioInterrupt_OutputPort[NUM_GPIOINTERRUPT_OUTPUT_PORTS];
475 
476  };
477 
478 }
479 
480 #endif
Drv::InputGpioReadPort * get_gpioRead_InputPort(FwIndexType portNum)
bool isConnected_gpioInterrupt_OutputPort(FwIndexType portNum)
static constexpr FwIndexType getNum_Time_OutputPorts()
Drv::InputGpioWritePort * get_gpioWrite_InputPort(FwIndexType portNum)
static constexpr FwIndexType getNum_gpioRead_InputPorts()
I32 FwEnumStoreType
void log_WARNING_HI_InterruptReadError(U32 expected, U32 got) const
Log event InterruptReadError.
LinuxGpioDriverComponentBase(const char *compName="")
Construct LinuxGpioDriverComponentBase object.
Input GpioWrite port.
void set_gpioInterrupt_OutputPort(FwIndexType portNum, Svc::InputCyclePort *port)
Connect port to gpioInterrupt[portNum].
Drv::GpioStatus gpioWrite_handlerBase(FwIndexType portNum, const Fw::Logic &state)
Handler base-class function for input port gpioWrite.
static constexpr FwIndexType getNum_gpioInterrupt_OutputPorts()
virtual Drv::GpioStatus gpioWrite_handler(FwIndexType portNum, const Fw::Logic &state)=0
Handler for input port gpioWrite.
void log_WARNING_HI_OpenPinError(const Fw::StringBase &chip, U32 pin, const Fw::StringBase &pinMessage, Os::FileStatus status) const
Log event OpenPinError.
virtual Drv::GpioStatus gpioRead_handler(FwIndexType portNum, Fw::Logic &state)=0
Handler for input port gpioRead.
void init()
Object initializer.
Definition: ObjBase.cpp:24
void set_Time_OutputPort(FwIndexType portNum, Fw::InputTimePort *port)
Connect port to Time[portNum].
Drv::GpioStatus gpioRead_handlerBase(FwIndexType portNum, Fw::Logic &state)
Handler base-class function for input port gpioRead.
friend class LinuxGpioDriverTester
Friend class tester implementation to support white-box testing.
static constexpr FwIndexType getNum_gpioWrite_InputPorts()
bool isConnected_Log_OutputPort(FwIndexType portNum)
Auto-generated base for LinuxGpioDriver component.
static constexpr FwIndexType getNum_Log_OutputPorts()
bool isConnected_Time_OutputPort(FwIndexType portNum)
void log_WARNING_HI_OpenChipError(const Fw::StringBase &chip, Os::FileStatus status) const
Log event OpenChipError.
void log_DIAGNOSTIC_OpenChip(const Fw::StringBase &chip, const Fw::StringBase &chipLabel, U32 pin, const Fw::StringBase &pinMessage) const
Log event OpenChip.
void gpioInterrupt_out(FwIndexType portNum, Os::RawTime &cycleStart)
Invoke output port gpioInterrupt.
Input GpioRead port.
void set_Log_OutputPort(FwIndexType portNum, Fw::InputLogPort *port)
Connect port to Log[portNum].
PlatformIndexType FwIndexType
void log_WARNING_HI_PollingError(I32 error_number) const
Log event PollingError.
friend class LinuxGpioDriverTesterBase
Friend class tester to support autocoded test harness.
Logic states.
Definition: LogicEnumAc.hpp:17
virtual ~LinuxGpioDriverComponentBase()
Destroy LinuxGpioDriverComponentBase object.
FPP shadow-enum representing Os::File::Status.