F´ Flight Software - C/C++ Documentation
A framework for building embedded system applications to NASA flight quality standards.
SystemResourcesComponentAc.hpp
Go to the documentation of this file.
1 // ======================================================================
2 // \title SystemResourcesComponentAc.hpp
3 // \author Generated by fpp-to-cpp
4 // \brief hpp file for SystemResources component base class
5 // ======================================================================
6 
7 #ifndef Svc_SystemResourcesComponentAc_HPP
8 #define Svc_SystemResourcesComponentAc_HPP
9 
10 #include "Fw/Cmd/CmdPortAc.hpp"
11 #include "Fw/Cmd/CmdRegPortAc.hpp"
13 #include "Fw/Cmd/CmdString.hpp"
15 #include "Fw/FPrimeBasicTypes.hpp"
16 #include "Fw/Log/LogPortAc.hpp"
17 #include "Fw/Log/LogTextPortAc.hpp"
18 #if !FW_DIRECT_PORT_CALLS
20 #endif
21 #if !FW_DIRECT_PORT_CALLS
23 #endif
24 #include "Fw/Time/TimePortAc.hpp"
25 #include "Fw/Tlm/TlmPortAc.hpp"
26 #include "Fw/Tlm/TlmString.hpp"
27 #include "Os/Mutex.hpp"
30 
31 namespace Svc {
32 
37  {
38 
39  // ----------------------------------------------------------------------
40  // Friend classes
41  // ----------------------------------------------------------------------
42 
46  friend class SystemResourcesTester;
47 
48  protected:
49 
50  // ----------------------------------------------------------------------
51  // Constants
52  // ----------------------------------------------------------------------
53 
55  enum {
57  };
58 
60  enum {
62  };
63 
65  enum {
72  };
73 
75  enum {
76  OPCODE_ENABLE = 0x0,
77  };
78 
80  enum {
85  CHANNELID_CPU = 0x4,
102  };
103 
104  public:
105 
106  // ----------------------------------------------------------------------
107  // Component initialization
108  // ----------------------------------------------------------------------
109 
111  void init(
112  FwEnumStoreType instance = 0
113  );
114 
115 #if !FW_DIRECT_PORT_CALLS
116 
117  public:
118 
119  // ----------------------------------------------------------------------
120  // Getters for special input ports
121  // ----------------------------------------------------------------------
122 
127  FwIndexType portNum
128  );
129 
130 #endif
131 
132 #if !FW_DIRECT_PORT_CALLS
133 
134  public:
135 
136  // ----------------------------------------------------------------------
137  // Getters for typed input ports
138  // ----------------------------------------------------------------------
139 
144  FwIndexType portNum
145  );
146 
147 #endif
148 
149 #if !FW_DIRECT_PORT_CALLS
150 
151  public:
152 
153  // ----------------------------------------------------------------------
154  // Connect input ports to special output ports
155  // ----------------------------------------------------------------------
156 
159  FwIndexType portNum,
160  Fw::InputCmdRegPort* port
161  );
162 
165  FwIndexType portNum,
167  );
168 
170  void set_Log_OutputPort(
171  FwIndexType portNum,
172  Fw::InputLogPort* port
173  );
174 
175 #if FW_ENABLE_TEXT_LOGGING == 1
176 
178  void set_LogText_OutputPort(
179  FwIndexType portNum,
180  Fw::InputLogTextPort* port
181  );
182 
183 #endif
184 
186  void set_Time_OutputPort(
187  FwIndexType portNum,
188  Fw::InputTimePort* port
189  );
190 
192  void set_Tlm_OutputPort(
193  FwIndexType portNum,
194  Fw::InputTlmPort* port
195  );
196 
197 #endif
198 
199 #if !FW_DIRECT_PORT_CALLS && FW_PORT_SERIALIZATION
200 
201  public:
202 
203  // ----------------------------------------------------------------------
204  // Connect serial input ports to special output ports
205  // ----------------------------------------------------------------------
206 
209  FwIndexType portNum,
210  Fw::InputSerializePort* port
211  );
212 
215  FwIndexType portNum,
216  Fw::InputSerializePort* port
217  );
218 
220  void set_Log_OutputPort(
221  FwIndexType portNum,
222  Fw::InputSerializePort* port
223  );
224 
225 #if FW_ENABLE_TEXT_LOGGING == 1
226 
228  void set_LogText_OutputPort(
229  FwIndexType portNum,
230  Fw::InputSerializePort* port
231  );
232 
233 #endif
234 
236  void set_Time_OutputPort(
237  FwIndexType portNum,
238  Fw::InputSerializePort* port
239  );
240 
242  void set_Tlm_OutputPort(
243  FwIndexType portNum,
244  Fw::InputSerializePort* port
245  );
246 
247 #endif
248 
249  public:
250 
251  // ----------------------------------------------------------------------
252  // Command registration
253  // ----------------------------------------------------------------------
254 
258  void regCommands();
259 
260  protected:
261 
262  // ----------------------------------------------------------------------
263  // Component construction and destruction
264  // ----------------------------------------------------------------------
265 
268  const char* compName = ""
269  );
270 
273 
274  protected:
275 
276  // ----------------------------------------------------------------------
277  // Getters for numbers of special input ports
278  // ----------------------------------------------------------------------
279 
285  }
286 
287  protected:
288 
289  // ----------------------------------------------------------------------
290  // Getters for numbers of typed input ports
291  // ----------------------------------------------------------------------
292 
296  static constexpr FwIndexType getNum_run_InputPorts() {
297  return NUM_RUN_INPUT_PORTS;
298  }
299 
300  protected:
301 
302  // ----------------------------------------------------------------------
303  // Getters for numbers of special output ports
304  // ----------------------------------------------------------------------
305 
311  }
312 
318  }
319 
323  static constexpr FwIndexType getNum_Log_OutputPorts() {
324  return NUM_LOG_OUTPUT_PORTS;
325  }
326 
327 #if FW_ENABLE_TEXT_LOGGING == 1
328 
332  static constexpr FwIndexType getNum_LogText_OutputPorts() {
334  }
335 
336 #endif
337 
342  return NUM_TIME_OUTPUT_PORTS;
343  }
344 
348  static constexpr FwIndexType getNum_Tlm_OutputPorts() {
349  return NUM_TLM_OUTPUT_PORTS;
350  }
351 
352  protected:
353 
354  // ----------------------------------------------------------------------
355  // Connection status queries for special output ports
356  // ----------------------------------------------------------------------
357 
362  FwIndexType portNum
363  ) const;
364 
369  FwIndexType portNum
370  ) const;
371 
376  FwIndexType portNum
377  ) const;
378 
379 #if FW_ENABLE_TEXT_LOGGING == 1
380 
384  bool isConnected_LogText_OutputPort(
385  FwIndexType portNum
386  ) const;
387 
388 #endif
389 
394  FwIndexType portNum
395  ) const;
396 
401  FwIndexType portNum
402  ) const;
403 
404 #if FW_DIRECT_PORT_CALLS
405  public:
406 #else
407  protected:
408 #endif
409 
410  // ----------------------------------------------------------------------
411  // Port handler base-class functions for special input ports
412  //
413  // Call these functions directly to bypass the corresponding ports
414  // ----------------------------------------------------------------------
415 
417  void CmdDisp_handlerBase(
418  FwIndexType portNum,
419  FwOpcodeType opCode,
420  U32 cmdSeq,
421  Fw::CmdArgBuffer& args
422  );
423 
424  protected:
425 
426  // ----------------------------------------------------------------------
427  // Handlers to implement for typed input ports
428  // ----------------------------------------------------------------------
429 
431  virtual void run_handler(
432  FwIndexType portNum,
433  U32 context
434  ) = 0;
435 
436 #if FW_DIRECT_PORT_CALLS
437  public:
438 #else
439  protected:
440 #endif
441 
442  // ----------------------------------------------------------------------
443  // Port handler base-class functions for typed input ports
444  //
445  // Call these functions directly to bypass the corresponding ports
446  // ----------------------------------------------------------------------
447 
449  void run_handlerBase(
450  FwIndexType portNum,
451  U32 context
452  );
453 
454  protected:
455 
456  // ----------------------------------------------------------------------
457  // Command response
458  // ----------------------------------------------------------------------
459 
461  void cmdResponse_out(
462  FwOpcodeType opCode,
463  U32 cmdSeq,
464  Fw::CmdResponse response
465  );
466 
467  protected:
468 
469  // ----------------------------------------------------------------------
470  // Command handlers to implement
471  // ----------------------------------------------------------------------
472 
476  virtual void ENABLE_cmdHandler(
477  FwOpcodeType opCode,
478  U32 cmdSeq,
480  ) = 0;
481 
482  protected:
483 
484  // ----------------------------------------------------------------------
485  // Command handler base-class functions
486  //
487  // Call these functions directly to bypass the command input port
488  // ----------------------------------------------------------------------
489 
494  FwOpcodeType opCode,
495  U32 cmdSeq,
496  Fw::CmdArgBuffer& args
497  );
498 
499  protected:
500 
501  // ----------------------------------------------------------------------
502  // Telemetry serialized write
503  // ----------------------------------------------------------------------
504 
509  void tlmWrite(
510  FwChanIdType id,
511  Fw::TlmBuffer& _tlmBuff,
512  Fw::Time _tlmTime = Fw::Time()
513  ) const;
514 
515  protected:
516 
517  // ----------------------------------------------------------------------
518  // Telemetry write functions
519  // ----------------------------------------------------------------------
520 
525  U64 arg,
526  Fw::Time _tlmTime = Fw::Time()
527  ) const;
528 
533  U64 arg,
534  Fw::Time _tlmTime = Fw::Time()
535  ) const;
536 
541  U64 arg,
542  Fw::Time _tlmTime = Fw::Time()
543  ) const;
544 
549  U64 arg,
550  Fw::Time _tlmTime = Fw::Time()
551  ) const;
552 
556  void tlmWrite_CPU(
557  F32 arg,
558  Fw::Time _tlmTime = Fw::Time()
559  ) const;
560 
564  void tlmWrite_CPU_00(
565  F32 arg,
566  Fw::Time _tlmTime = Fw::Time()
567  ) const;
568 
572  void tlmWrite_CPU_01(
573  F32 arg,
574  Fw::Time _tlmTime = Fw::Time()
575  ) const;
576 
580  void tlmWrite_CPU_02(
581  F32 arg,
582  Fw::Time _tlmTime = Fw::Time()
583  ) const;
584 
588  void tlmWrite_CPU_03(
589  F32 arg,
590  Fw::Time _tlmTime = Fw::Time()
591  ) const;
592 
596  void tlmWrite_CPU_04(
597  F32 arg,
598  Fw::Time _tlmTime = Fw::Time()
599  ) const;
600 
604  void tlmWrite_CPU_05(
605  F32 arg,
606  Fw::Time _tlmTime = Fw::Time()
607  ) const;
608 
612  void tlmWrite_CPU_06(
613  F32 arg,
614  Fw::Time _tlmTime = Fw::Time()
615  ) const;
616 
620  void tlmWrite_CPU_07(
621  F32 arg,
622  Fw::Time _tlmTime = Fw::Time()
623  ) const;
624 
628  void tlmWrite_CPU_08(
629  F32 arg,
630  Fw::Time _tlmTime = Fw::Time()
631  ) const;
632 
636  void tlmWrite_CPU_09(
637  F32 arg,
638  Fw::Time _tlmTime = Fw::Time()
639  ) const;
640 
644  void tlmWrite_CPU_10(
645  F32 arg,
646  Fw::Time _tlmTime = Fw::Time()
647  ) const;
648 
652  void tlmWrite_CPU_11(
653  F32 arg,
654  Fw::Time _tlmTime = Fw::Time()
655  ) const;
656 
660  void tlmWrite_CPU_12(
661  F32 arg,
662  Fw::Time _tlmTime = Fw::Time()
663  ) const;
664 
668  void tlmWrite_CPU_13(
669  F32 arg,
670  Fw::Time _tlmTime = Fw::Time()
671  ) const;
672 
676  void tlmWrite_CPU_14(
677  F32 arg,
678  Fw::Time _tlmTime = Fw::Time()
679  ) const;
680 
684  void tlmWrite_CPU_15(
685  F32 arg,
686  Fw::Time _tlmTime = Fw::Time()
687  ) const;
688 
689  protected:
690 
691  // ----------------------------------------------------------------------
692  // Time
693  // ----------------------------------------------------------------------
694 
698  Fw::Time getTime() const;
699 
700  protected:
701 
702  // ----------------------------------------------------------------------
703  // Mutex operations for guarded ports
704  //
705  // You can override these operations to provide more sophisticated
706  // synchronization
707  // ----------------------------------------------------------------------
708 
710  virtual void lock();
711 
713  virtual void unLock();
714 
715  private:
716 
717  // ----------------------------------------------------------------------
718  // Calls for messages received on special input ports
719  // ----------------------------------------------------------------------
720 
722  static void m_p_CmdDisp_in(
723  Fw::PassiveComponentBase* callComp,
724  FwIndexType portNum,
725  FwOpcodeType opCode,
726  U32 cmdSeq,
727  Fw::CmdArgBuffer& args
728  );
729 
730  private:
731 
732  // ----------------------------------------------------------------------
733  // Calls for messages received on typed input ports
734  // ----------------------------------------------------------------------
735 
737  static void m_p_run_in(
738  Fw::PassiveComponentBase* callComp,
739  FwIndexType portNum,
740  U32 context
741  );
742 
743  private:
744 
745  // ----------------------------------------------------------------------
746  // Invocation functions for special output ports
747  // ----------------------------------------------------------------------
748 
750  void CmdReg_out(
751  FwIndexType portNum,
752  FwOpcodeType opCode
753  ) const;
754 
756  void CmdStatus_out(
757  FwIndexType portNum,
758  FwOpcodeType opCode,
759  U32 cmdSeq,
760  const Fw::CmdResponse& response
761  ) const;
762 
764  void Time_out(
765  FwIndexType portNum,
766  Fw::Time& time
767  ) const;
768 
770  void Tlm_out(
771  FwIndexType portNum,
772  FwChanIdType id,
773  Fw::Time& timeTag,
774  Fw::TlmBuffer& val
775  ) const;
776 
777 #if !FW_DIRECT_PORT_CALLS
778 
779  private:
780 
781  // ----------------------------------------------------------------------
782  // Special input ports
783  // ----------------------------------------------------------------------
784 
786  Fw::InputCmdPort m_CmdDisp_InputPort[NUM_CMDDISP_INPUT_PORTS];
787 
788 #endif
789 
790 #if !FW_DIRECT_PORT_CALLS
791 
792  private:
793 
794  // ----------------------------------------------------------------------
795  // Typed input ports
796  // ----------------------------------------------------------------------
797 
799  Svc::InputSchedPort m_run_InputPort[NUM_RUN_INPUT_PORTS];
800 
801 #endif
802 
803 #if !FW_DIRECT_PORT_CALLS
804 
805  private:
806 
807  // ----------------------------------------------------------------------
808  // Special output ports
809  // ----------------------------------------------------------------------
810 
812  Fw::OutputCmdRegPort m_CmdReg_OutputPort[NUM_CMDREG_OUTPUT_PORTS];
813 
816 
818  Fw::OutputLogPort m_Log_OutputPort[NUM_LOG_OUTPUT_PORTS];
819 
820 #if FW_ENABLE_TEXT_LOGGING == 1
821 
823  Fw::OutputLogTextPort m_LogText_OutputPort[NUM_LOGTEXT_OUTPUT_PORTS];
824 
825 #endif
826 
828  Fw::OutputTimePort m_Time_OutputPort[NUM_TIME_OUTPUT_PORTS];
829 
831  Fw::OutputTlmPort m_Tlm_OutputPort[NUM_TLM_OUTPUT_PORTS];
832 
833 #endif
834 
835  private:
836 
837  // ----------------------------------------------------------------------
838  // Mutexes
839  // ----------------------------------------------------------------------
840 
842  Os::Mutex m_guardedPortMutex;
843 
844  };
845 
846 }
847 
848 #endif
void set_CmdStatus_OutputPort(FwIndexType portNum, Fw::InputCmdResponsePort *port)
Connect port to CmdStatus[portNum].
FwIdType FwOpcodeType
The type of a command opcode.
void tlmWrite_CPU_00(F32 arg, Fw::Time _tlmTime=Fw::Time()) const
void tlmWrite_CPU(F32 arg, Fw::Time _tlmTime=Fw::Time()) const
I32 FwEnumStoreType
static constexpr FwIndexType getNum_Time_OutputPorts()
virtual void ENABLE_cmdHandler(FwOpcodeType opCode, U32 cmdSeq, Svc::SystemResourceEnabled enable)=0
static constexpr FwIndexType getNum_CmdStatus_OutputPorts()
void tlmWrite_MEMORY_USED(U64 arg, Fw::Time _tlmTime=Fw::Time()) const
void tlmWrite_NON_VOLATILE_FREE(U64 arg, Fw::Time _tlmTime=Fw::Time()) const
bool isConnected_Time_OutputPort(FwIndexType portNum) const
void tlmWrite_CPU_09(F32 arg, Fw::Time _tlmTime=Fw::Time()) const
void set_Tlm_OutputPort(FwIndexType portNum, Fw::InputTlmPort *port)
Connect port to Tlm[portNum].
void tlmWrite_CPU_02(F32 arg, Fw::Time _tlmTime=Fw::Time()) const
Enum representing a command response.
Fw::InputCmdPort * get_CmdDisp_InputPort(FwIndexType portNum)
bool isConnected_Log_OutputPort(FwIndexType portNum) const
void tlmWrite_CPU_10(F32 arg, Fw::Time _tlmTime=Fw::Time()) const
void init()
Object initializer.
Definition: ObjBase.cpp:24
float F32
32-bit floating point
Definition: BasicTypes.h:84
friend class SystemResourcesTester
Friend class tester implementation to support white-box testing.
SystemResourcesComponentBase(const char *compName="")
Construct SystemResourcesComponentBase object.
void tlmWrite_CPU_13(F32 arg, Fw::Time _tlmTime=Fw::Time()) const
void tlmWrite_CPU_11(F32 arg, Fw::Time _tlmTime=Fw::Time()) const
void CmdDisp_handlerBase(FwIndexType portNum, FwOpcodeType opCode, U32 cmdSeq, Fw::CmdArgBuffer &args)
Handler base-class function for input port CmdDisp.
Svc::InputSchedPort * get_run_InputPort(FwIndexType portNum)
static constexpr FwIndexType getNum_CmdDisp_InputPorts()
virtual void run_handler(FwIndexType portNum, U32 context)=0
Handler for input port run.
FwIdType FwChanIdType
The type of a telemetry channel identifier.
virtual void unLock()
Unlock the guarded mutex.
void cmdResponse_out(FwOpcodeType opCode, U32 cmdSeq, Fw::CmdResponse response)
Emit command response.
bool isConnected_Tlm_OutputPort(FwIndexType portNum) const
void tlmWrite_CPU_14(F32 arg, Fw::Time _tlmTime=Fw::Time()) const
static constexpr FwIndexType getNum_Tlm_OutputPorts()
static constexpr FwIndexType getNum_run_InputPorts()
friend class SystemResourcesTesterBase
Friend class tester to support autocoded test harness.
bool isConnected_CmdStatus_OutputPort(FwIndexType portNum) const
void tlmWrite_CPU_15(F32 arg, Fw::Time _tlmTime=Fw::Time()) const
void tlmWrite_CPU_01(F32 arg, Fw::Time _tlmTime=Fw::Time()) const
Auto-generated base for SystemResources component.
void tlmWrite_CPU_07(F32 arg, Fw::Time _tlmTime=Fw::Time()) const
static constexpr FwIndexType getNum_CmdReg_OutputPorts()
PlatformIndexType FwIndexType
void tlmWrite_CPU_04(F32 arg, Fw::Time _tlmTime=Fw::Time()) const
void ENABLE_cmdHandlerBase(FwOpcodeType opCode, U32 cmdSeq, Fw::CmdArgBuffer &args)
void tlmWrite_CPU_08(F32 arg, Fw::Time _tlmTime=Fw::Time()) const
RateGroupDivider component implementation.
void set_Log_OutputPort(FwIndexType portNum, Fw::InputLogPort *port)
Connect port to Log[portNum].
void regCommands()
Register commands with the Command Dispatcher.
virtual ~SystemResourcesComponentBase()
Destroy SystemResourcesComponentBase object.
void tlmWrite_CPU_06(F32 arg, Fw::Time _tlmTime=Fw::Time()) const
void set_CmdReg_OutputPort(FwIndexType portNum, Fw::InputCmdRegPort *port)
Connect port to CmdReg[portNum].
void tlmWrite_CPU_12(F32 arg, Fw::Time _tlmTime=Fw::Time()) const
void tlmWrite_CPU_03(F32 arg, Fw::Time _tlmTime=Fw::Time()) const
void tlmWrite(FwChanIdType id, Fw::TlmBuffer &_tlmBuff, Fw::Time _tlmTime=Fw::Time()) const
void run_handlerBase(FwIndexType portNum, U32 context)
Handler base-class function for input port run.
void tlmWrite_MEMORY_TOTAL(U64 arg, Fw::Time _tlmTime=Fw::Time()) const
bool isConnected_CmdReg_OutputPort(FwIndexType portNum) const
virtual void lock()
Lock the guarded mutex.
static constexpr FwIndexType getNum_Log_OutputPorts()
void tlmWrite_NON_VOLATILE_TOTAL(U64 arg, Fw::Time _tlmTime=Fw::Time()) const
A command to enable or disable system resource telemetry.
void tlmWrite_CPU_05(F32 arg, Fw::Time _tlmTime=Fw::Time()) const
void set_Time_OutputPort(FwIndexType portNum, Fw::InputTimePort *port)
Connect port to Time[portNum].
#define U64(C)
Definition: sha.h:181