F´ Flight Software - C/C++ Documentation
A framework for building embedded system applications to NASA flight quality standards.
ActivePhaserComponentAc.hpp
Go to the documentation of this file.
1 // ======================================================================
2 // \title ActivePhaserComponentAc.hpp
3 // \author Generated by fpp-to-cpp
4 // \brief hpp file for ActivePhaser component base class
5 // ======================================================================
6 
7 #ifndef Svc_ActivePhaserComponentAc_HPP
8 #define Svc_ActivePhaserComponentAc_HPP
9 
10 #include <atomic>
11 
13 #include "Fw/FPrimeBasicTypes.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"
22 #include "Fw/Tlm/TlmPortAc.hpp"
27 
28 namespace Svc {
29 
36  {
37 
38  // ----------------------------------------------------------------------
39  // Friend classes
40  // ----------------------------------------------------------------------
41 
43  friend class ActivePhaserTesterBase;
45  friend class ActivePhaserTester;
46 
47  protected:
48 
49  // ----------------------------------------------------------------------
50  // Constants
51  // ----------------------------------------------------------------------
52 
54  enum {
56  };
57 
59  enum {
64  };
65 
67  enum {
69  };
70 
72  enum {
74  };
75 
77  enum {
79  };
80 
81  public:
82 
83  // ----------------------------------------------------------------------
84  // Component initialization
85  // ----------------------------------------------------------------------
86 
88  void init(
89  FwSizeType queueDepth,
90  FwEnumStoreType instance = 0
91  );
92 
93  public:
94 
95  // ----------------------------------------------------------------------
96  // Getters for typed input ports
97  // ----------------------------------------------------------------------
98 
103  FwIndexType portNum
104  );
105 
106  public:
107 
108  // ----------------------------------------------------------------------
109  // Connect input ports to special output ports
110  // ----------------------------------------------------------------------
111 
114  FwIndexType portNum,
115  Fw::InputLogPort* port
116  );
117 
118 #if FW_ENABLE_TEXT_LOGGING == 1
119 
121  void set_logTextOut_OutputPort(
122  FwIndexType portNum,
123  Fw::InputLogTextPort* port
124  );
125 
126 #endif
127 
130  FwIndexType portNum,
131  Fw::InputTimePort* port
132  );
133 
136  FwIndexType portNum,
137  Fw::InputTlmPort* port
138  );
139 
140  public:
141 
142  // ----------------------------------------------------------------------
143  // Connect typed input ports to typed output ports
144  // ----------------------------------------------------------------------
145 
148  FwIndexType portNum,
149  Svc::InputSchedPort* port
150  );
151 
152 #if FW_PORT_SERIALIZATION
153 
154  public:
155 
156  // ----------------------------------------------------------------------
157  // Connect serial input ports to special output ports
158  // ----------------------------------------------------------------------
159 
162  FwIndexType portNum,
163  Fw::InputSerializePort* port
164  );
165 
166 #if FW_ENABLE_TEXT_LOGGING == 1
167 
169  void set_logTextOut_OutputPort(
170  FwIndexType portNum,
171  Fw::InputSerializePort* port
172  );
173 
174 #endif
175 
178  FwIndexType portNum,
179  Fw::InputSerializePort* port
180  );
181 
184  FwIndexType portNum,
185  Fw::InputSerializePort* port
186  );
187 
188 #endif
189 
190 #if FW_PORT_SERIALIZATION
191 
192  public:
193 
194  // ----------------------------------------------------------------------
195  // Connect serial input ports to typed output ports
196  // ----------------------------------------------------------------------
197 
200  FwIndexType portNum,
201  Fw::InputSerializePort* port
202  );
203 
204 #endif
205 
206  protected:
207 
208  // ----------------------------------------------------------------------
209  // Component construction and destruction
210  // ----------------------------------------------------------------------
211 
214  const char* compName = ""
215  );
216 
218  virtual ~ActivePhaserComponentBase();
219 
220  protected:
221 
222  // ----------------------------------------------------------------------
223  // Getters for numbers of typed input ports
224  // ----------------------------------------------------------------------
225 
231  }
232 
233  protected:
234 
235  // ----------------------------------------------------------------------
236  // Getters for numbers of special output ports
237  // ----------------------------------------------------------------------
238 
244  }
245 
246 #if FW_ENABLE_TEXT_LOGGING == 1
247 
251  static constexpr FwIndexType getNum_logTextOut_OutputPorts() {
253  }
254 
255 #endif
256 
262  }
263 
269  }
270 
271  protected:
272 
273  // ----------------------------------------------------------------------
274  // Getters for numbers of typed output ports
275  // ----------------------------------------------------------------------
276 
282  }
283 
284  protected:
285 
286  // ----------------------------------------------------------------------
287  // Connection status queries for special output ports
288  // ----------------------------------------------------------------------
289 
294  FwIndexType portNum
295  );
296 
297 #if FW_ENABLE_TEXT_LOGGING == 1
298 
302  bool isConnected_logTextOut_OutputPort(
303  FwIndexType portNum
304  );
305 
306 #endif
307 
312  FwIndexType portNum
313  );
314 
319  FwIndexType portNum
320  );
321 
322  protected:
323 
324  // ----------------------------------------------------------------------
325  // Connection status queries for typed output ports
326  // ----------------------------------------------------------------------
327 
332  FwIndexType portNum
333  );
334 
335  protected:
336 
337  // ----------------------------------------------------------------------
338  // Handlers to implement for typed input ports
339  // ----------------------------------------------------------------------
340 
342  virtual void CycleIn_handler(
343  FwIndexType portNum,
344  Os::RawTime& cycleStart
345  ) = 0;
346 
347  protected:
348 
349  // ----------------------------------------------------------------------
350  // Port handler base-class functions for typed input ports
351  //
352  // Call these functions directly to bypass the corresponding ports
353  // ----------------------------------------------------------------------
354 
356  void CycleIn_handlerBase(
357  FwIndexType portNum,
358  Os::RawTime& cycleStart
359  );
360 
361  protected:
362 
363  // ----------------------------------------------------------------------
364  // Pre-message hooks for typed async input ports
365  //
366  // Each of these functions is invoked just before processing a message
367  // on the corresponding port. By default, they do nothing. You can
368  // override them to provide specific pre-message behavior.
369  // ----------------------------------------------------------------------
370 
372  virtual void CycleIn_preMsgHook(
373  FwIndexType portNum,
374  Os::RawTime& cycleStart
375  );
376 
377  protected:
378 
379  // ----------------------------------------------------------------------
380  // Invocation functions for typed output ports
381  // ----------------------------------------------------------------------
382 
384  void PhaserMemberOut_out(
385  FwIndexType portNum,
386  U32 context
387  );
388 
389  protected:
390 
391  // ----------------------------------------------------------------------
392  // Internal interface handlers
393  // ----------------------------------------------------------------------
394 
396  virtual void Tick_internalInterfaceHandler() = 0;
397 
398  protected:
399 
400  // ----------------------------------------------------------------------
401  // Internal interface base-class functions
402  // ----------------------------------------------------------------------
403 
406 
407  protected:
408 
409  // ----------------------------------------------------------------------
410  // Event logging functions
411  // ----------------------------------------------------------------------
412 
417  FwIndexType p,
418  U32 start,
419  U32 length,
420  U32 ticks
421  );
422 
423  protected:
424 
425  // ----------------------------------------------------------------------
426  // Event throttle reset functions
427  // ----------------------------------------------------------------------
428 
431 
432  protected:
433 
434  // ----------------------------------------------------------------------
435  // Time
436  // ----------------------------------------------------------------------
437 
441  Fw::Time getTime() const;
442 
443  private:
444 
445  // ----------------------------------------------------------------------
446  // Message dispatch functions
447  // ----------------------------------------------------------------------
448 
450  virtual MsgDispatchStatus doDispatch();
451 
452  private:
453 
454  // ----------------------------------------------------------------------
455  // Calls for messages received on typed input ports
456  // ----------------------------------------------------------------------
457 
459  static void m_p_CycleIn_in(
460  Fw::PassiveComponentBase* callComp,
461  FwIndexType portNum,
462  Os::RawTime& cycleStart
463  );
464 
465  private:
466 
467  // ----------------------------------------------------------------------
468  // Typed input ports
469  // ----------------------------------------------------------------------
470 
472  Svc::InputCyclePort m_CycleIn_InputPort[NUM_CYCLEIN_INPUT_PORTS];
473 
474  private:
475 
476  // ----------------------------------------------------------------------
477  // Special output ports
478  // ----------------------------------------------------------------------
479 
481  Fw::OutputLogPort m_logOut_OutputPort[NUM_LOGOUT_OUTPUT_PORTS];
482 
483 #if FW_ENABLE_TEXT_LOGGING == 1
484 
486  Fw::OutputLogTextPort m_logTextOut_OutputPort[NUM_LOGTEXTOUT_OUTPUT_PORTS];
487 
488 #endif
489 
491  Fw::OutputTimePort m_timeCaller_OutputPort[NUM_TIMECALLER_OUTPUT_PORTS];
492 
494  Fw::OutputTlmPort m_tlmOut_OutputPort[NUM_TLMOUT_OUTPUT_PORTS];
495 
496  private:
497 
498  // ----------------------------------------------------------------------
499  // Typed output ports
500  // ----------------------------------------------------------------------
501 
503  Svc::OutputSchedPort m_PhaserMemberOut_OutputPort[NUM_PHASERMEMBEROUT_OUTPUT_PORTS];
504 
505  private:
506 
507  // ----------------------------------------------------------------------
508  // Counter values for event throttling
509  // ----------------------------------------------------------------------
510 
512  std::atomic<FwIndexType> m_MissedDeadlineThrottle;
513 
514  };
515 
516 }
517 
518 #endif
static constexpr FwIndexType getNum_CycleIn_InputPorts()
void set_tlmOut_OutputPort(FwIndexType portNum, Fw::InputTlmPort *port)
Connect port to tlmOut[portNum].
PlatformSizeType FwSizeType
I32 FwEnumStoreType
Warning event that rate group has had a missed deadline.
void set_logOut_OutputPort(FwIndexType portNum, Fw::InputLogPort *port)
Connect port to logOut[portNum].
void set_PhaserMemberOut_OutputPort(FwIndexType portNum, Svc::InputSchedPort *port)
Connect port to PhaserMemberOut[portNum].
bool isConnected_PhaserMemberOut_OutputPort(FwIndexType portNum)
void init()
Object initializer.
Definition: ObjBase.cpp:24
bool isConnected_logOut_OutputPort(FwIndexType portNum)
ActivePhaserComponentBase(const char *compName="")
Construct ActivePhaserComponentBase object.
static constexpr FwIndexType getNum_tlmOut_OutputPorts()
virtual ~ActivePhaserComponentBase()
Destroy ActivePhaserComponentBase object.
friend class ActivePhaserTester
Friend class tester implementation to support white-box testing.
void PhaserMemberOut_out(FwIndexType portNum, U32 context)
Invoke output port PhaserMemberOut.
void Tick_internalInterfaceInvoke()
Internal interface base-class function for Tick.
Svc::InputCyclePort * get_CycleIn_InputPort(FwIndexType portNum)
friend class ActivePhaserTesterBase
Friend class tester to support autocoded test harness.
bool isConnected_timeCaller_OutputPort(FwIndexType portNum)
Auto-generated base for ActivePhaser component.
PlatformIndexType FwIndexType
virtual void Tick_internalInterfaceHandler()=0
Internal interface handler for Tick.
static constexpr FwIndexType getNum_PhaserMemberOut_OutputPorts()
void log_WARNING_HI_MissedDeadline_ThrottleClear()
Reset throttle value for MissedDeadline.
void CycleIn_handlerBase(FwIndexType portNum, Os::RawTime &cycleStart)
Handler base-class function for input port CycleIn.
virtual void CycleIn_handler(FwIndexType portNum, Os::RawTime &cycleStart)=0
Handler for input port CycleIn.
RateGroupDivider component implementation.
void set_timeCaller_OutputPort(FwIndexType portNum, Fw::InputTimePort *port)
Connect port to timeCaller[portNum].
virtual void CycleIn_preMsgHook(FwIndexType portNum, Os::RawTime &cycleStart)
Pre-message hook for async input port CycleIn.
void start(FwTaskPriorityType priority=Os::Task::TASK_PRIORITY_DEFAULT, FwSizeType stackSize=Os::Task::TASK_DEFAULT, FwSizeType cpuAffinity=Os::Task::TASK_DEFAULT, FwTaskIdType identifier=static_cast< FwTaskIdType >(Os::Task::TASK_DEFAULT))
called by instantiator when task is to be started
static constexpr FwIndexType getNum_timeCaller_OutputPorts()
bool isConnected_tlmOut_OutputPort(FwIndexType portNum)
static constexpr FwIndexType getNum_logOut_OutputPorts()
void log_WARNING_HI_MissedDeadline(FwIndexType p, U32 start, U32 length, U32 ticks)