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 
230 
231  protected:
232 
233  // ----------------------------------------------------------------------
234  // Getters for numbers of special output ports
235  // ----------------------------------------------------------------------
236 
241 
242 #if FW_ENABLE_TEXT_LOGGING == 1
243 
247  FwIndexType getNum_logTextOut_OutputPorts() const;
248 
249 #endif
250 
255 
260 
261  protected:
262 
263  // ----------------------------------------------------------------------
264  // Getters for numbers of typed output ports
265  // ----------------------------------------------------------------------
266 
271 
272  protected:
273 
274  // ----------------------------------------------------------------------
275  // Connection status queries for special output ports
276  // ----------------------------------------------------------------------
277 
282  FwIndexType portNum
283  );
284 
285 #if FW_ENABLE_TEXT_LOGGING == 1
286 
290  bool isConnected_logTextOut_OutputPort(
291  FwIndexType portNum
292  );
293 
294 #endif
295 
300  FwIndexType portNum
301  );
302 
307  FwIndexType portNum
308  );
309 
310  protected:
311 
312  // ----------------------------------------------------------------------
313  // Connection status queries for typed output ports
314  // ----------------------------------------------------------------------
315 
320  FwIndexType portNum
321  );
322 
323  protected:
324 
325  // ----------------------------------------------------------------------
326  // Handlers to implement for typed input ports
327  // ----------------------------------------------------------------------
328 
330  virtual void CycleIn_handler(
331  FwIndexType portNum,
332  Os::RawTime& cycleStart
333  ) = 0;
334 
335  protected:
336 
337  // ----------------------------------------------------------------------
338  // Port handler base-class functions for typed input ports
339  //
340  // Call these functions directly to bypass the corresponding ports
341  // ----------------------------------------------------------------------
342 
344  void CycleIn_handlerBase(
345  FwIndexType portNum,
346  Os::RawTime& cycleStart
347  );
348 
349  protected:
350 
351  // ----------------------------------------------------------------------
352  // Pre-message hooks for typed async input ports
353  //
354  // Each of these functions is invoked just before processing a message
355  // on the corresponding port. By default, they do nothing. You can
356  // override them to provide specific pre-message behavior.
357  // ----------------------------------------------------------------------
358 
360  virtual void CycleIn_preMsgHook(
361  FwIndexType portNum,
362  Os::RawTime& cycleStart
363  );
364 
365  protected:
366 
367  // ----------------------------------------------------------------------
368  // Invocation functions for typed output ports
369  // ----------------------------------------------------------------------
370 
372  void PhaserMemberOut_out(
373  FwIndexType portNum,
374  U32 context
375  );
376 
377  protected:
378 
379  // ----------------------------------------------------------------------
380  // Internal interface handlers
381  // ----------------------------------------------------------------------
382 
384  virtual void Tick_internalInterfaceHandler() = 0;
385 
386  protected:
387 
388  // ----------------------------------------------------------------------
389  // Internal interface base-class functions
390  // ----------------------------------------------------------------------
391 
394 
395  protected:
396 
397  // ----------------------------------------------------------------------
398  // Event logging functions
399  // ----------------------------------------------------------------------
400 
405  FwIndexType p,
406  U32 start,
407  U32 length,
408  U32 ticks
409  );
410 
411  protected:
412 
413  // ----------------------------------------------------------------------
414  // Event throttle reset functions
415  // ----------------------------------------------------------------------
416 
419 
420  protected:
421 
422  // ----------------------------------------------------------------------
423  // Time
424  // ----------------------------------------------------------------------
425 
429  Fw::Time getTime() const;
430 
431  private:
432 
433  // ----------------------------------------------------------------------
434  // Message dispatch functions
435  // ----------------------------------------------------------------------
436 
438  virtual MsgDispatchStatus doDispatch();
439 
440  private:
441 
442  // ----------------------------------------------------------------------
443  // Calls for messages received on typed input ports
444  // ----------------------------------------------------------------------
445 
447  static void m_p_CycleIn_in(
448  Fw::PassiveComponentBase* callComp,
449  FwIndexType portNum,
450  Os::RawTime& cycleStart
451  );
452 
453  private:
454 
455  // ----------------------------------------------------------------------
456  // Typed input ports
457  // ----------------------------------------------------------------------
458 
460  Svc::InputCyclePort m_CycleIn_InputPort[NUM_CYCLEIN_INPUT_PORTS];
461 
462  private:
463 
464  // ----------------------------------------------------------------------
465  // Special output ports
466  // ----------------------------------------------------------------------
467 
469  Fw::OutputLogPort m_logOut_OutputPort[NUM_LOGOUT_OUTPUT_PORTS];
470 
471 #if FW_ENABLE_TEXT_LOGGING == 1
472 
474  Fw::OutputLogTextPort m_logTextOut_OutputPort[NUM_LOGTEXTOUT_OUTPUT_PORTS];
475 
476 #endif
477 
479  Fw::OutputTimePort m_timeCaller_OutputPort[NUM_TIMECALLER_OUTPUT_PORTS];
480 
482  Fw::OutputTlmPort m_tlmOut_OutputPort[NUM_TLMOUT_OUTPUT_PORTS];
483 
484  private:
485 
486  // ----------------------------------------------------------------------
487  // Typed output ports
488  // ----------------------------------------------------------------------
489 
491  Svc::OutputSchedPort m_PhaserMemberOut_OutputPort[NUM_PHASERMEMBEROUT_OUTPUT_PORTS];
492 
493  private:
494 
495  // ----------------------------------------------------------------------
496  // Counter values for event throttling
497  // ----------------------------------------------------------------------
498 
500  std::atomic<FwIndexType> m_MissedDeadlineThrottle;
501 
502  };
503 
504 }
505 
506 #endif
void set_tlmOut_OutputPort(FwIndexType portNum, Fw::InputTlmPort *port)
Connect port to tlmOut[portNum].
PlatformSizeType FwSizeType
I32 FwEnumStoreType
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
Warning event that rate group has had a missed deadline.
bool isConnected_logOut_OutputPort(FwIndexType portNum)
ActivePhaserComponentBase(const char *compName="")
Construct ActivePhaserComponentBase object.
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)
FwIndexType getNum_PhaserMemberOut_OutputPorts() const
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.
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
bool isConnected_tlmOut_OutputPort(FwIndexType portNum)
void log_WARNING_HI_MissedDeadline(FwIndexType p, U32 start, U32 length, U32 ticks)