F´ Flight Software - C/C++ Documentation  devel
A framework for building embedded system applications to NASA flight quality standards.
All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
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"
24 
25 namespace Drv {
26 
31  {
32 
33  // ----------------------------------------------------------------------
34  // Friend classes
35  // ----------------------------------------------------------------------
36 
39 
40  PROTECTED:
41 
42  // ----------------------------------------------------------------------
43  // Constants
44  // ----------------------------------------------------------------------
45 
47  enum {
50  };
51 
53  enum {
57  };
58 
60  enum {
62  };
63 
65  enum {
71  };
72 
73  public:
74 
75  // ----------------------------------------------------------------------
76  // Component initialization
77  // ----------------------------------------------------------------------
78 
80  void init(
81  FwEnumStoreType instance = 0
82  );
83 
84  public:
85 
86  // ----------------------------------------------------------------------
87  // Getters for typed input ports
88  // ----------------------------------------------------------------------
89 
94  FwIndexType portNum
95  );
96 
101  FwIndexType portNum
102  );
103 
104  public:
105 
106  // ----------------------------------------------------------------------
107  // Connect input ports to special output ports
108  // ----------------------------------------------------------------------
109 
111  void set_Log_OutputPort(
112  FwIndexType portNum,
113  Fw::InputLogPort* port
114  );
115 
116 #if FW_ENABLE_TEXT_LOGGING == 1
117 
119  void set_LogText_OutputPort(
120  FwIndexType portNum,
121  Fw::InputLogTextPort* port
122  );
123 
124 #endif
125 
127  void set_Time_OutputPort(
128  FwIndexType portNum,
129  Fw::InputTimePort* port
130  );
131 
132  public:
133 
134  // ----------------------------------------------------------------------
135  // Connect typed input ports to typed output ports
136  // ----------------------------------------------------------------------
137 
140  FwIndexType portNum,
141  Svc::InputCyclePort* port
142  );
143 
144 #if FW_PORT_SERIALIZATION
145 
146  public:
147 
148  // ----------------------------------------------------------------------
149  // Connect serial input ports to special output ports
150  // ----------------------------------------------------------------------
151 
153  void set_Log_OutputPort(
154  FwIndexType portNum,
155  Fw::InputSerializePort* port
156  );
157 
158 #if FW_ENABLE_TEXT_LOGGING == 1
159 
161  void set_LogText_OutputPort(
162  FwIndexType portNum,
163  Fw::InputSerializePort* port
164  );
165 
166 #endif
167 
169  void set_Time_OutputPort(
170  FwIndexType portNum,
171  Fw::InputSerializePort* port
172  );
173 
174 #endif
175 
176 #if FW_PORT_SERIALIZATION
177 
178  public:
179 
180  // ----------------------------------------------------------------------
181  // Connect serial input ports to typed output ports
182  // ----------------------------------------------------------------------
183 
186  FwIndexType portNum,
187  Fw::InputSerializePort* port
188  );
189 
190 #endif
191 
192  PROTECTED:
193 
194  // ----------------------------------------------------------------------
195  // Component construction and destruction
196  // ----------------------------------------------------------------------
197 
200  const char* compName = ""
201  );
202 
205 
206  PROTECTED:
207 
208  // ----------------------------------------------------------------------
209  // Getters for numbers of typed input ports
210  // ----------------------------------------------------------------------
211 
216 
221 
222  PROTECTED:
223 
224  // ----------------------------------------------------------------------
225  // Getters for numbers of special output ports
226  // ----------------------------------------------------------------------
227 
232 
233 #if FW_ENABLE_TEXT_LOGGING == 1
234 
238  FwIndexType getNum_LogText_OutputPorts() const;
239 
240 #endif
241 
246 
247  PROTECTED:
248 
249  // ----------------------------------------------------------------------
250  // Getters for numbers of typed output ports
251  // ----------------------------------------------------------------------
252 
257 
258  PROTECTED:
259 
260  // ----------------------------------------------------------------------
261  // Connection status queries for special output ports
262  // ----------------------------------------------------------------------
263 
268  FwIndexType portNum
269  );
270 
271 #if FW_ENABLE_TEXT_LOGGING == 1
272 
276  bool isConnected_LogText_OutputPort(
277  FwIndexType portNum
278  );
279 
280 #endif
281 
286  FwIndexType portNum
287  );
288 
289  PROTECTED:
290 
291  // ----------------------------------------------------------------------
292  // Connection status queries for typed output ports
293  // ----------------------------------------------------------------------
294 
299  FwIndexType portNum
300  );
301 
302  PROTECTED:
303 
304  // ----------------------------------------------------------------------
305  // Handlers to implement for typed input ports
306  // ----------------------------------------------------------------------
307 
310  FwIndexType portNum,
311  Fw::Logic& state
312  ) = 0;
313 
316  FwIndexType portNum,
317  const Fw::Logic& state
318  ) = 0;
319 
320  PROTECTED:
321 
322  // ----------------------------------------------------------------------
323  // Port handler base-class functions for typed input ports
324  //
325  // Call these functions directly to bypass the corresponding ports
326  // ----------------------------------------------------------------------
327 
330  FwIndexType portNum,
331  Fw::Logic& state
332  );
333 
336  FwIndexType portNum,
337  const Fw::Logic& state
338  );
339 
340  PROTECTED:
341 
342  // ----------------------------------------------------------------------
343  // Invocation functions for typed output ports
344  // ----------------------------------------------------------------------
345 
347  void gpioInterrupt_out(
348  FwIndexType portNum,
349  Os::RawTime& cycleStart
350  );
351 
352  PROTECTED:
353 
354  // ----------------------------------------------------------------------
355  // Event logging functions
356  // ----------------------------------------------------------------------
357 
360  const Fw::StringBase& chip,
361  const Fw::StringBase& chipLabel,
362  U32 pin,
363  const Fw::StringBase& pinMessage
364  );
365 
368  const Fw::StringBase& chip,
369  Os::FileStatus status
370  );
371 
374  const Fw::StringBase& chip,
375  U32 pin,
376  const Fw::StringBase& pinMessage,
377  Os::FileStatus status
378  );
379 
382  U32 expected,
383  U32 got
384  );
385 
387  void log_WARNING_HI_PollingError(I32 error_number);
388 
389  PROTECTED:
390 
391  // ----------------------------------------------------------------------
392  // Time
393  // ----------------------------------------------------------------------
394 
398  Fw::Time getTime();
399 
400  PRIVATE:
401 
402  // ----------------------------------------------------------------------
403  // Calls for messages received on typed input ports
404  // ----------------------------------------------------------------------
405 
407  static Drv::GpioStatus m_p_gpioRead_in(
408  Fw::PassiveComponentBase* callComp,
409  FwIndexType portNum,
410  Fw::Logic& state
411  );
412 
414  static Drv::GpioStatus m_p_gpioWrite_in(
415  Fw::PassiveComponentBase* callComp,
416  FwIndexType portNum,
417  const Fw::Logic& state
418  );
419 
420  PRIVATE:
421 
422  // ----------------------------------------------------------------------
423  // Typed input ports
424  // ----------------------------------------------------------------------
425 
427  Drv::InputGpioReadPort m_gpioRead_InputPort[NUM_GPIOREAD_INPUT_PORTS];
428 
430  Drv::InputGpioWritePort m_gpioWrite_InputPort[NUM_GPIOWRITE_INPUT_PORTS];
431 
432  PRIVATE:
433 
434  // ----------------------------------------------------------------------
435  // Special output ports
436  // ----------------------------------------------------------------------
437 
439  Fw::OutputLogPort m_Log_OutputPort[NUM_LOG_OUTPUT_PORTS];
440 
441 #if FW_ENABLE_TEXT_LOGGING == 1
442 
444  Fw::OutputLogTextPort m_LogText_OutputPort[NUM_LOGTEXT_OUTPUT_PORTS];
445 
446 #endif
447 
449  Fw::OutputTimePort m_Time_OutputPort[NUM_TIME_OUTPUT_PORTS];
450 
451  PRIVATE:
452 
453  // ----------------------------------------------------------------------
454  // Typed output ports
455  // ----------------------------------------------------------------------
456 
458  Svc::OutputCyclePort m_gpioInterrupt_OutputPort[NUM_GPIOINTERRUPT_OUTPUT_PORTS];
459 
460  };
461 
462 }
463 
464 #endif
I32 FwEnumStoreType
Definition: FpConfig.h:64
PlatformIndexType FwIndexType
Definition: FpConfig.h:25
C++-compatible configuration header for fprime configuration.
Input GpioRead port.
Input GpioWrite port.
Auto-generated base for LinuxGpioDriver component.
Drv::InputGpioWritePort * get_gpioWrite_InputPort(FwIndexType portNum)
void set_gpioInterrupt_OutputPort(FwIndexType portNum, Svc::InputCyclePort *port)
Connect port to gpioInterrupt[portNum].
virtual ~LinuxGpioDriverComponentBase()
Destroy LinuxGpioDriverComponentBase object.
void log_DIAGNOSTIC_OpenChip(const Fw::StringBase &chip, const Fw::StringBase &chipLabel, U32 pin, const Fw::StringBase &pinMessage)
Log event OpenChip.
Drv::GpioStatus gpioRead_handlerBase(FwIndexType portNum, Fw::Logic &state)
Handler base-class function for input port gpioRead.
friend class LinuxGpioDriverComponentBaseFriend
Friend class for white-box testing.
void log_WARNING_HI_OpenPinError(const Fw::StringBase &chip, U32 pin, const Fw::StringBase &pinMessage, Os::FileStatus status)
Log event OpenPinError.
Drv::GpioStatus gpioWrite_handlerBase(FwIndexType portNum, const Fw::Logic &state)
Handler base-class function for input port gpioWrite.
void log_WARNING_HI_OpenChipError(const Fw::StringBase &chip, Os::FileStatus status)
Log event OpenChipError.
void log_WARNING_HI_InterruptReadError(U32 expected, U32 got)
Log event InterruptReadError.
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_PollingError(I32 error_number)
Log event PollingError.
void set_Log_OutputPort(FwIndexType portNum, Fw::InputLogPort *port)
Connect port to Log[portNum].
bool isConnected_Time_OutputPort(FwIndexType portNum)
bool isConnected_gpioInterrupt_OutputPort(FwIndexType portNum)
bool isConnected_Log_OutputPort(FwIndexType portNum)
void gpioInterrupt_out(FwIndexType portNum, Os::RawTime &cycleStart)
Invoke output port gpioInterrupt.
LinuxGpioDriverComponentBase(const char *compName="")
Construct LinuxGpioDriverComponentBase object.
virtual Drv::GpioStatus gpioWrite_handler(FwIndexType portNum, const Fw::Logic &state)=0
Handler for input port gpioWrite.
virtual Drv::GpioStatus gpioRead_handler(FwIndexType portNum, Fw::Logic &state)=0
Handler for input port gpioRead.
Logic states.
Definition: LogicEnumAc.hpp:19
void init()
Object initializer.
Definition: ObjBase.cpp:27
Definition: Time.hpp:9
FPP shadow-enum representing Os::File::Status.