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 
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 
220 
225 
226  PROTECTED:
227 
228  // ----------------------------------------------------------------------
229  // Getters for numbers of special output ports
230  // ----------------------------------------------------------------------
231 
236 
237 #if FW_ENABLE_TEXT_LOGGING == 1
238 
242  FwIndexType getNum_LogText_OutputPorts() const;
243 
244 #endif
245 
250 
251  PROTECTED:
252 
253  // ----------------------------------------------------------------------
254  // Getters for numbers of typed output ports
255  // ----------------------------------------------------------------------
256 
261 
262  PROTECTED:
263 
264  // ----------------------------------------------------------------------
265  // Connection status queries for special output ports
266  // ----------------------------------------------------------------------
267 
272  FwIndexType portNum
273  );
274 
275 #if FW_ENABLE_TEXT_LOGGING == 1
276 
280  bool isConnected_LogText_OutputPort(
281  FwIndexType portNum
282  );
283 
284 #endif
285 
290  FwIndexType portNum
291  );
292 
293  PROTECTED:
294 
295  // ----------------------------------------------------------------------
296  // Connection status queries for typed output ports
297  // ----------------------------------------------------------------------
298 
303  FwIndexType portNum
304  );
305 
306  PROTECTED:
307 
308  // ----------------------------------------------------------------------
309  // Handlers to implement for typed input ports
310  // ----------------------------------------------------------------------
311 
314  FwIndexType portNum,
315  Fw::Logic& state
316  ) = 0;
317 
320  FwIndexType portNum,
321  const Fw::Logic& state
322  ) = 0;
323 
324  PROTECTED:
325 
326  // ----------------------------------------------------------------------
327  // Port handler base-class functions for typed input ports
328  //
329  // Call these functions directly to bypass the corresponding ports
330  // ----------------------------------------------------------------------
331 
334  FwIndexType portNum,
335  Fw::Logic& state
336  );
337 
340  FwIndexType portNum,
341  const Fw::Logic& state
342  );
343 
344  PROTECTED:
345 
346  // ----------------------------------------------------------------------
347  // Invocation functions for typed output ports
348  // ----------------------------------------------------------------------
349 
351  void gpioInterrupt_out(
352  FwIndexType portNum,
353  Os::RawTime& cycleStart
354  );
355 
356  PROTECTED:
357 
358  // ----------------------------------------------------------------------
359  // Event logging functions
360  // ----------------------------------------------------------------------
361 
364  const Fw::StringBase& chip,
365  const Fw::StringBase& chipLabel,
366  U32 pin,
367  const Fw::StringBase& pinMessage
368  ) const;
369 
372  const Fw::StringBase& chip,
373  Os::FileStatus status
374  ) const;
375 
378  const Fw::StringBase& chip,
379  U32 pin,
380  const Fw::StringBase& pinMessage,
381  Os::FileStatus status
382  ) const;
383 
386  U32 expected,
387  U32 got
388  ) const;
389 
391  void log_WARNING_HI_PollingError(I32 error_number) const;
392 
393  PROTECTED:
394 
395  // ----------------------------------------------------------------------
396  // Time
397  // ----------------------------------------------------------------------
398 
402  Fw::Time getTime() const;
403 
404  PRIVATE:
405 
406  // ----------------------------------------------------------------------
407  // Calls for messages received on typed input ports
408  // ----------------------------------------------------------------------
409 
411  static Drv::GpioStatus m_p_gpioRead_in(
412  Fw::PassiveComponentBase* callComp,
413  FwIndexType portNum,
414  Fw::Logic& state
415  );
416 
418  static Drv::GpioStatus m_p_gpioWrite_in(
419  Fw::PassiveComponentBase* callComp,
420  FwIndexType portNum,
421  const Fw::Logic& state
422  );
423 
424  PRIVATE:
425 
426  // ----------------------------------------------------------------------
427  // Typed input ports
428  // ----------------------------------------------------------------------
429 
431  Drv::InputGpioReadPort m_gpioRead_InputPort[NUM_GPIOREAD_INPUT_PORTS];
432 
434  Drv::InputGpioWritePort m_gpioWrite_InputPort[NUM_GPIOWRITE_INPUT_PORTS];
435 
436  PRIVATE:
437 
438  // ----------------------------------------------------------------------
439  // Special output ports
440  // ----------------------------------------------------------------------
441 
443  Fw::OutputLogPort m_Log_OutputPort[NUM_LOG_OUTPUT_PORTS];
444 
445 #if FW_ENABLE_TEXT_LOGGING == 1
446 
448  Fw::OutputLogTextPort m_LogText_OutputPort[NUM_LOGTEXT_OUTPUT_PORTS];
449 
450 #endif
451 
453  Fw::OutputTimePort m_Time_OutputPort[NUM_TIME_OUTPUT_PORTS];
454 
455  PRIVATE:
456 
457  // ----------------------------------------------------------------------
458  // Typed output ports
459  // ----------------------------------------------------------------------
460 
462  Svc::OutputCyclePort m_gpioInterrupt_OutputPort[NUM_GPIOINTERRUPT_OUTPUT_PORTS];
463 
464  };
465 
466 }
467 
468 #endif
Drv::InputGpioReadPort * get_gpioRead_InputPort(FwIndexType portNum)
bool isConnected_gpioInterrupt_OutputPort(FwIndexType portNum)
Definition: Time.hpp:9
Drv::InputGpioWritePort * get_gpioWrite_InputPort(FwIndexType portNum)
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.
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:26
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.
bool isConnected_Log_OutputPort(FwIndexType portNum)
Auto-generated base for LinuxGpioDriver component.
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.
friend class LinuxGpioDriverComponentBaseFriend
Friend class for white-box testing.