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"
27 
28 namespace Drv {
29 
34  {
35 
36  // ----------------------------------------------------------------------
37  // Friend classes
38  // ----------------------------------------------------------------------
39 
43  friend class LinuxGpioDriverTester;
44 
45  protected:
46 
47  // ----------------------------------------------------------------------
48  // Constants
49  // ----------------------------------------------------------------------
50 
52  enum {
55  };
56 
58  enum {
62  };
63 
65  enum {
67  };
68 
70  enum {
76  };
77 
78  public:
79 
80  // ----------------------------------------------------------------------
81  // Component initialization
82  // ----------------------------------------------------------------------
83 
85  void init(
86  FwEnumStoreType instance = 0
87  );
88 
89  public:
90 
91  // ----------------------------------------------------------------------
92  // Getters for typed input ports
93  // ----------------------------------------------------------------------
94 
99  FwIndexType portNum
100  );
101 
106  FwIndexType portNum
107  );
108 
109  public:
110 
111  // ----------------------------------------------------------------------
112  // Connect input ports to special output ports
113  // ----------------------------------------------------------------------
114 
116  void set_Log_OutputPort(
117  FwIndexType portNum,
118  Fw::InputLogPort* port
119  );
120 
121 #if FW_ENABLE_TEXT_LOGGING == 1
122 
124  void set_LogText_OutputPort(
125  FwIndexType portNum,
126  Fw::InputLogTextPort* port
127  );
128 
129 #endif
130 
132  void set_Time_OutputPort(
133  FwIndexType portNum,
134  Fw::InputTimePort* port
135  );
136 
137  public:
138 
139  // ----------------------------------------------------------------------
140  // Connect typed input ports to typed output ports
141  // ----------------------------------------------------------------------
142 
145  FwIndexType portNum,
146  Svc::InputCyclePort* port
147  );
148 
149 #if FW_PORT_SERIALIZATION
150 
151  public:
152 
153  // ----------------------------------------------------------------------
154  // Connect serial input ports to special output ports
155  // ----------------------------------------------------------------------
156 
158  void set_Log_OutputPort(
159  FwIndexType portNum,
160  Fw::InputSerializePort* port
161  );
162 
163 #if FW_ENABLE_TEXT_LOGGING == 1
164 
166  void set_LogText_OutputPort(
167  FwIndexType portNum,
168  Fw::InputSerializePort* port
169  );
170 
171 #endif
172 
174  void set_Time_OutputPort(
175  FwIndexType portNum,
176  Fw::InputSerializePort* port
177  );
178 
179 #endif
180 
181 #if FW_PORT_SERIALIZATION
182 
183  public:
184 
185  // ----------------------------------------------------------------------
186  // Connect serial input ports to typed output ports
187  // ----------------------------------------------------------------------
188 
191  FwIndexType portNum,
192  Fw::InputSerializePort* port
193  );
194 
195 #endif
196 
197  protected:
198 
199  // ----------------------------------------------------------------------
200  // Component construction and destruction
201  // ----------------------------------------------------------------------
202 
205  const char* compName = ""
206  );
207 
210 
211  protected:
212 
213  // ----------------------------------------------------------------------
214  // Getters for numbers of typed input ports
215  // ----------------------------------------------------------------------
216 
222  }
223 
229  }
230 
231  protected:
232 
233  // ----------------------------------------------------------------------
234  // Getters for numbers of special output ports
235  // ----------------------------------------------------------------------
236 
240  static constexpr FwIndexType getNum_Log_OutputPorts() {
241  return NUM_LOG_OUTPUT_PORTS;
242  }
243 
244 #if FW_ENABLE_TEXT_LOGGING == 1
245 
249  static constexpr FwIndexType getNum_LogText_OutputPorts() {
251  }
252 
253 #endif
254 
259  return NUM_TIME_OUTPUT_PORTS;
260  }
261 
262  protected:
263 
264  // ----------------------------------------------------------------------
265  // Getters for numbers of typed output ports
266  // ----------------------------------------------------------------------
267 
273  }
274 
275  protected:
276 
277  // ----------------------------------------------------------------------
278  // Connection status queries for special output ports
279  // ----------------------------------------------------------------------
280 
285  FwIndexType portNum
286  );
287 
288 #if FW_ENABLE_TEXT_LOGGING == 1
289 
293  bool isConnected_LogText_OutputPort(
294  FwIndexType portNum
295  );
296 
297 #endif
298 
303  FwIndexType portNum
304  );
305 
306  protected:
307 
308  // ----------------------------------------------------------------------
309  // Connection status queries for typed output ports
310  // ----------------------------------------------------------------------
311 
316  FwIndexType portNum
317  );
318 
319  protected:
320 
321  // ----------------------------------------------------------------------
322  // Handlers to implement for typed input ports
323  // ----------------------------------------------------------------------
324 
327  FwIndexType portNum,
328  Fw::Logic& state
329  ) = 0;
330 
333  FwIndexType portNum,
334  const Fw::Logic& state
335  ) = 0;
336 
337  protected:
338 
339  // ----------------------------------------------------------------------
340  // Port handler base-class functions for typed input ports
341  //
342  // Call these functions directly to bypass the corresponding ports
343  // ----------------------------------------------------------------------
344 
347  FwIndexType portNum,
348  Fw::Logic& state
349  );
350 
353  FwIndexType portNum,
354  const Fw::Logic& state
355  );
356 
357  protected:
358 
359  // ----------------------------------------------------------------------
360  // Invocation functions for typed output ports
361  // ----------------------------------------------------------------------
362 
364  void gpioInterrupt_out(
365  FwIndexType portNum,
366  Os::RawTime& cycleStart
367  );
368 
369  protected:
370 
371  // ----------------------------------------------------------------------
372  // Event logging functions
373  // ----------------------------------------------------------------------
374 
377  const Fw::StringBase& chip,
378  const Fw::StringBase& chipLabel,
379  U32 pin,
380  const Fw::StringBase& pinMessage
381  ) const;
382 
385  const Fw::StringBase& chip,
386  Os::FileStatus status
387  ) const;
388 
391  const Fw::StringBase& chip,
392  U32 pin,
393  const Fw::StringBase& pinMessage,
394  Os::FileStatus status
395  ) const;
396 
399  U32 expected,
400  U32 got
401  ) const;
402 
404  void log_WARNING_HI_PollingError(I32 error_number) const;
405 
406  protected:
407 
408  // ----------------------------------------------------------------------
409  // Time
410  // ----------------------------------------------------------------------
411 
415  Fw::Time getTime() const;
416 
417  private:
418 
419  // ----------------------------------------------------------------------
420  // Calls for messages received on typed input ports
421  // ----------------------------------------------------------------------
422 
424  static Drv::GpioStatus m_p_gpioRead_in(
425  Fw::PassiveComponentBase* callComp,
426  FwIndexType portNum,
427  Fw::Logic& state
428  );
429 
431  static Drv::GpioStatus m_p_gpioWrite_in(
432  Fw::PassiveComponentBase* callComp,
433  FwIndexType portNum,
434  const Fw::Logic& state
435  );
436 
437  private:
438 
439  // ----------------------------------------------------------------------
440  // Typed input ports
441  // ----------------------------------------------------------------------
442 
444  Drv::InputGpioReadPort m_gpioRead_InputPort[NUM_GPIOREAD_INPUT_PORTS];
445 
447  Drv::InputGpioWritePort m_gpioWrite_InputPort[NUM_GPIOWRITE_INPUT_PORTS];
448 
449  private:
450 
451  // ----------------------------------------------------------------------
452  // Special output ports
453  // ----------------------------------------------------------------------
454 
456  Fw::OutputLogPort m_Log_OutputPort[NUM_LOG_OUTPUT_PORTS];
457 
458 #if FW_ENABLE_TEXT_LOGGING == 1
459 
461  Fw::OutputLogTextPort m_LogText_OutputPort[NUM_LOGTEXT_OUTPUT_PORTS];
462 
463 #endif
464 
466  Fw::OutputTimePort m_Time_OutputPort[NUM_TIME_OUTPUT_PORTS];
467 
468  private:
469 
470  // ----------------------------------------------------------------------
471  // Typed output ports
472  // ----------------------------------------------------------------------
473 
475  Svc::OutputCyclePort m_gpioInterrupt_OutputPort[NUM_GPIOINTERRUPT_OUTPUT_PORTS];
476 
477  };
478 
479 }
480 
481 #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.