F´ Flight Software - C/C++ Documentation  devel
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 
12 #include "FpConfig.hpp"
14 #include "Fw/Log/LogPortAc.hpp"
15 #include "Fw/Log/LogString.hpp"
16 #if FW_ENABLE_TEXT_LOGGING == 1
17 #include "Fw/Log/LogTextPortAc.hpp"
18 #endif
21 #include "Fw/Time/TimePortAc.hpp"
23 
24 namespace Drv {
25 
30  {
31 
32  // ----------------------------------------------------------------------
33  // Friend classes
34  // ----------------------------------------------------------------------
35 
38 
39  PROTECTED:
40 
41  // ----------------------------------------------------------------------
42  // Constants
43  // ----------------------------------------------------------------------
44 
46  enum {
49  };
50 
52  enum {
56  };
57 
59  enum {
61  };
62 
64  enum {
72  };
73 
75  enum {
78  };
79 
80  public:
81 
82  // ----------------------------------------------------------------------
83  // Component initialization
84  // ----------------------------------------------------------------------
85 
87  void init(
88  FwEnumStoreType instance = 0
89  );
90 
91  public:
92 
93  // ----------------------------------------------------------------------
94  // Getters for typed input ports
95  // ----------------------------------------------------------------------
96 
101  FwIndexType portNum
102  );
103 
108  FwIndexType portNum
109  );
110 
111  public:
112 
113  // ----------------------------------------------------------------------
114  // Connect input ports to special output ports
115  // ----------------------------------------------------------------------
116 
118  void set_Log_OutputPort(
119  FwIndexType portNum,
120  Fw::InputLogPort* port
121  );
122 
123 #if FW_ENABLE_TEXT_LOGGING == 1
124 
126  void set_LogText_OutputPort(
127  FwIndexType portNum,
128  Fw::InputLogTextPort* port
129  );
130 
131 #endif
132 
134  void set_Time_OutputPort(
135  FwIndexType portNum,
136  Fw::InputTimePort* port
137  );
138 
139  public:
140 
141  // ----------------------------------------------------------------------
142  // Connect typed input ports to typed output ports
143  // ----------------------------------------------------------------------
144 
147  FwIndexType portNum,
148  Svc::InputCyclePort* port
149  );
150 
151 #if FW_PORT_SERIALIZATION
152 
153  public:
154 
155  // ----------------------------------------------------------------------
156  // Connect serial input ports to special output ports
157  // ----------------------------------------------------------------------
158 
160  void set_Log_OutputPort(
161  FwIndexType portNum,
162  Fw::InputSerializePort* port
163  );
164 
165 #if FW_ENABLE_TEXT_LOGGING == 1
166 
168  void set_LogText_OutputPort(
169  FwIndexType portNum,
170  Fw::InputSerializePort* port
171  );
172 
173 #endif
174 
176  void set_Time_OutputPort(
177  FwIndexType portNum,
178  Fw::InputSerializePort* port
179  );
180 
181 #endif
182 
183 #if FW_PORT_SERIALIZATION
184 
185  public:
186 
187  // ----------------------------------------------------------------------
188  // Connect serial input ports to typed output ports
189  // ----------------------------------------------------------------------
190 
193  FwIndexType portNum,
194  Fw::InputSerializePort* port
195  );
196 
197 #endif
198 
199  PROTECTED:
200 
201  // ----------------------------------------------------------------------
202  // Component construction and destruction
203  // ----------------------------------------------------------------------
204 
207  const char* compName = ""
208  );
209 
212 
213  PROTECTED:
214 
215  // ----------------------------------------------------------------------
216  // Getters for numbers of typed input ports
217  // ----------------------------------------------------------------------
218 
223 
228 
229  PROTECTED:
230 
231  // ----------------------------------------------------------------------
232  // Getters for numbers of special output ports
233  // ----------------------------------------------------------------------
234 
239 
240 #if FW_ENABLE_TEXT_LOGGING == 1
241 
245  FwIndexType getNum_LogText_OutputPorts() const;
246 
247 #endif
248 
253 
254  PROTECTED:
255 
256  // ----------------------------------------------------------------------
257  // Getters for numbers of typed output ports
258  // ----------------------------------------------------------------------
259 
264 
265  PROTECTED:
266 
267  // ----------------------------------------------------------------------
268  // Connection status queries for special output ports
269  // ----------------------------------------------------------------------
270 
275  FwIndexType portNum
276  );
277 
278 #if FW_ENABLE_TEXT_LOGGING == 1
279 
283  bool isConnected_LogText_OutputPort(
284  FwIndexType portNum
285  );
286 
287 #endif
288 
293  FwIndexType portNum
294  );
295 
296  PROTECTED:
297 
298  // ----------------------------------------------------------------------
299  // Connection status queries for typed output ports
300  // ----------------------------------------------------------------------
301 
306  FwIndexType portNum
307  );
308 
309  PROTECTED:
310 
311  // ----------------------------------------------------------------------
312  // Handlers to implement for typed input ports
313  // ----------------------------------------------------------------------
314 
316  virtual void gpioRead_handler(
317  FwIndexType portNum,
318  Fw::Logic& state
319  ) = 0;
320 
322  virtual void gpioWrite_handler(
323  FwIndexType portNum,
324  const Fw::Logic& state
325  ) = 0;
326 
327  PROTECTED:
328 
329  // ----------------------------------------------------------------------
330  // Port handler base-class functions for typed input ports
331  //
332  // Call these functions directly to bypass the corresponding ports
333  // ----------------------------------------------------------------------
334 
337  FwIndexType portNum,
338  Fw::Logic& state
339  );
340 
343  FwIndexType portNum,
344  const Fw::Logic& state
345  );
346 
347  PROTECTED:
348 
349  // ----------------------------------------------------------------------
350  // Invocation functions for typed output ports
351  // ----------------------------------------------------------------------
352 
354  void intOut_out(
355  FwIndexType portNum,
356  Svc::TimerVal& cycleStart
357  );
358 
359  PROTECTED:
360 
361  // ----------------------------------------------------------------------
362  // Event logging functions
363  // ----------------------------------------------------------------------
364 
369  I32 gpio,
370  I32 error,
371  const Fw::StringBase& msg
372  );
373 
378  I32 gpio,
379  I32 error
380  );
381 
386  I32 gpio,
387  I32 error
388  );
389 
394  I32 gpio,
395  I32 error
396  );
397 
402  I32 gpio
403  );
404 
409  I32 gpio
410  );
411 
416  I32 gpio
417  );
418 
419  PROTECTED:
420 
421  // ----------------------------------------------------------------------
422  // Event throttle reset functions
423  // ----------------------------------------------------------------------
424 
427 
430 
431  PROTECTED:
432 
433  // ----------------------------------------------------------------------
434  // Time
435  // ----------------------------------------------------------------------
436 
440  Fw::Time getTime();
441 
442  PRIVATE:
443 
444  // ----------------------------------------------------------------------
445  // Calls for messages received on typed input ports
446  // ----------------------------------------------------------------------
447 
449  static void m_p_gpioRead_in(
450  Fw::PassiveComponentBase* callComp,
451  FwIndexType portNum,
452  Fw::Logic& state
453  );
454 
456  static void m_p_gpioWrite_in(
457  Fw::PassiveComponentBase* callComp,
458  FwIndexType portNum,
459  const Fw::Logic& state
460  );
461 
462  PRIVATE:
463 
464  // ----------------------------------------------------------------------
465  // Typed input ports
466  // ----------------------------------------------------------------------
467 
469  Drv::InputGpioReadPort m_gpioRead_InputPort[NUM_GPIOREAD_INPUT_PORTS];
470 
472  Drv::InputGpioWritePort m_gpioWrite_InputPort[NUM_GPIOWRITE_INPUT_PORTS];
473 
474  PRIVATE:
475 
476  // ----------------------------------------------------------------------
477  // Special output ports
478  // ----------------------------------------------------------------------
479 
481  Fw::OutputLogPort m_Log_OutputPort[NUM_LOG_OUTPUT_PORTS];
482 
483 #if FW_ENABLE_TEXT_LOGGING == 1
484 
486  Fw::OutputLogTextPort m_LogText_OutputPort[NUM_LOGTEXT_OUTPUT_PORTS];
487 
488 #endif
489 
491  Fw::OutputTimePort m_Time_OutputPort[NUM_TIME_OUTPUT_PORTS];
492 
493  PRIVATE:
494 
495  // ----------------------------------------------------------------------
496  // Typed output ports
497  // ----------------------------------------------------------------------
498 
500  Svc::OutputCyclePort m_intOut_OutputPort[NUM_INTOUT_OUTPUT_PORTS];
501 
502  PRIVATE:
503 
504  // ----------------------------------------------------------------------
505  // Counter values for event throttling
506  // ----------------------------------------------------------------------
507 
509  FwIndexType m_GP_WriteErrorThrottle;
510 
512  FwIndexType m_GP_ReadErrorThrottle;
513 
514  };
515 
516 }
517 
518 #endif
I32 FwEnumStoreType
Definition: FpConfig.h:51
PlatformIndexType FwIndexType
Definition: FpConfig.h:20
C++-compatible configuration header for fprime configuration.
Input GpioRead port.
Input GpioWrite port.
Auto-generated base for LinuxGpioDriver component.
virtual void gpioRead_handler(FwIndexType portNum, Fw::Logic &state)=0
Handler for input port gpioRead.
void gpioWrite_handlerBase(FwIndexType portNum, const Fw::Logic &state)
Handler base-class function for input port gpioWrite.
Drv::InputGpioWritePort * get_gpioWrite_InputPort(FwIndexType portNum)
@ EVENTID_GP_INTSTARTERROR
GPIO interrupt start error notification.
@ EVENTID_GP_INTWAITERROR
GPIO interrupt wait error notification.
@ EVENTID_GP_PORTOPENED
GPIO opened notification.
void intOut_out(FwIndexType portNum, Svc::TimerVal &cycleStart)
Invoke output port intOut.
void set_intOut_OutputPort(FwIndexType portNum, Svc::InputCyclePort *port)
Connect port to intOut[portNum].
virtual ~LinuxGpioDriverComponentBase()
Destroy LinuxGpioDriverComponentBase object.
virtual void gpioWrite_handler(FwIndexType portNum, const Fw::Logic &state)=0
Handler for input port gpioWrite.
@ EVENTID_GP_READERROR_THROTTLE
Throttle reset count for GP_ReadError.
@ EVENTID_GP_WRITEERROR_THROTTLE
Throttle reset count for GP_WriteError.
friend class LinuxGpioDriverComponentBaseFriend
Friend class for white-box testing.
bool isConnected_intOut_OutputPort(FwIndexType portNum)
void log_WARNING_HI_GP_ReadError(I32 gpio, I32 error)
void log_WARNING_HI_GP_ReadError_ThrottleClear()
Reset throttle value for GP_ReadError.
void set_Time_OutputPort(FwIndexType portNum, Fw::InputTimePort *port)
Connect port to Time[portNum].
Drv::InputGpioReadPort * get_gpioRead_InputPort(FwIndexType portNum)
void log_WARNING_HI_GP_OpenError(I32 gpio, I32 error, const Fw::StringBase &msg)
void log_WARNING_HI_GP_WriteError(I32 gpio, I32 error)
void gpioRead_handlerBase(FwIndexType portNum, Fw::Logic &state)
Handler base-class function for input port gpioRead.
void log_WARNING_HI_GP_WriteError_ThrottleClear()
Reset throttle value for GP_WriteError.
void set_Log_OutputPort(FwIndexType portNum, Fw::InputLogPort *port)
Connect port to Log[portNum].
void log_WARNING_HI_GP_ConfigError(I32 gpio, I32 error)
bool isConnected_Time_OutputPort(FwIndexType portNum)
bool isConnected_Log_OutputPort(FwIndexType portNum)
LinuxGpioDriverComponentBase(const char *compName="")
Construct LinuxGpioDriverComponentBase object.
Logic states.
Definition: LogicEnumAc.hpp:19
void init()
Object initializer.
Definition: ObjBase.cpp:27
Definition: Time.hpp:9
Serializable class for carrying timer values.
Definition: TimerVal.hpp:22