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 #if FW_ENABLE_TEXT_LOGGING == 1
18 #include "Fw/Log/LogTextPortAc.hpp"
19 #endif
20 #if !FW_DIRECT_PORT_CALLS
22 #endif
23 #if !FW_DIRECT_PORT_CALLS
25 #endif
26 #include "Fw/Time/TimePortAc.hpp"
27 #include "Fw/Tlm/TlmPortAc.hpp"
28 #include "Fw/Tlm/TlmString.hpp"
29 #include "Os/Mutex.hpp"
32 
33 namespace Svc {
34 
39  {
40 
41  // ----------------------------------------------------------------------
42  // Friend classes
43  // ----------------------------------------------------------------------
44 
48  friend class SystemResourcesTester;
49 
50  protected:
51 
52  // ----------------------------------------------------------------------
53  // Constants
54  // ----------------------------------------------------------------------
55 
57  enum {
59  };
60 
62  enum {
64  };
65 
67  enum {
74  };
75 
77  enum {
78  OPCODE_ENABLE = 0x0,
79  };
80 
82  enum {
87  CHANNELID_CPU = 0x4,
104  };
105 
106  public:
107 
108  // ----------------------------------------------------------------------
109  // Component initialization
110  // ----------------------------------------------------------------------
111 
113  void init(
114  FwEnumStoreType instance = 0
115  );
116 
117 #if !FW_DIRECT_PORT_CALLS
118 
119  public:
120 
121  // ----------------------------------------------------------------------
122  // Getters for special input ports
123  // ----------------------------------------------------------------------
124 
129  FwIndexType portNum
130  );
131 
132 #endif
133 
134 #if !FW_DIRECT_PORT_CALLS
135 
136  public:
137 
138  // ----------------------------------------------------------------------
139  // Getters for typed input ports
140  // ----------------------------------------------------------------------
141 
146  FwIndexType portNum
147  );
148 
149 #endif
150 
151 #if !FW_DIRECT_PORT_CALLS
152 
153  public:
154 
155  // ----------------------------------------------------------------------
156  // Connect input ports to special output ports
157  // ----------------------------------------------------------------------
158 
161  FwIndexType portNum,
162  Fw::InputCmdRegPort* port
163  );
164 
167  FwIndexType portNum,
169  );
170 
172  void set_Log_OutputPort(
173  FwIndexType portNum,
174  Fw::InputLogPort* port
175  );
176 
177 #if FW_ENABLE_TEXT_LOGGING == 1
178 
180  void set_LogText_OutputPort(
181  FwIndexType portNum,
182  Fw::InputLogTextPort* port
183  );
184 
185 #endif
186 
188  void set_Time_OutputPort(
189  FwIndexType portNum,
190  Fw::InputTimePort* port
191  );
192 
194  void set_Tlm_OutputPort(
195  FwIndexType portNum,
196  Fw::InputTlmPort* port
197  );
198 
199 #endif
200 
201 #if !FW_DIRECT_PORT_CALLS && FW_PORT_SERIALIZATION
202 
203  public:
204 
205  // ----------------------------------------------------------------------
206  // Connect serial input ports to special output ports
207  // ----------------------------------------------------------------------
208 
211  FwIndexType portNum,
212  Fw::InputSerializePort* port
213  );
214 
217  FwIndexType portNum,
218  Fw::InputSerializePort* port
219  );
220 
222  void set_Log_OutputPort(
223  FwIndexType portNum,
224  Fw::InputSerializePort* port
225  );
226 
227 #if FW_ENABLE_TEXT_LOGGING == 1
228 
230  void set_LogText_OutputPort(
231  FwIndexType portNum,
232  Fw::InputSerializePort* port
233  );
234 
235 #endif
236 
238  void set_Time_OutputPort(
239  FwIndexType portNum,
240  Fw::InputSerializePort* port
241  );
242 
244  void set_Tlm_OutputPort(
245  FwIndexType portNum,
246  Fw::InputSerializePort* port
247  );
248 
249 #endif
250 
251  public:
252 
253  // ----------------------------------------------------------------------
254  // Command registration
255  // ----------------------------------------------------------------------
256 
260  void regCommands();
261 
262  protected:
263 
264  // ----------------------------------------------------------------------
265  // Component construction and destruction
266  // ----------------------------------------------------------------------
267 
270  const char* compName = ""
271  );
272 
275 
276  protected:
277 
278  // ----------------------------------------------------------------------
279  // Getters for numbers of special input ports
280  // ----------------------------------------------------------------------
281 
287  }
288 
289  protected:
290 
291  // ----------------------------------------------------------------------
292  // Getters for numbers of typed input ports
293  // ----------------------------------------------------------------------
294 
298  static constexpr FwIndexType getNum_run_InputPorts() {
299  return NUM_RUN_INPUT_PORTS;
300  }
301 
302  protected:
303 
304  // ----------------------------------------------------------------------
305  // Getters for numbers of special output ports
306  // ----------------------------------------------------------------------
307 
313  }
314 
320  }
321 
325  static constexpr FwIndexType getNum_Log_OutputPorts() {
326  return NUM_LOG_OUTPUT_PORTS;
327  }
328 
329 #if FW_ENABLE_TEXT_LOGGING == 1
330 
334  static constexpr FwIndexType getNum_LogText_OutputPorts() {
336  }
337 
338 #endif
339 
344  return NUM_TIME_OUTPUT_PORTS;
345  }
346 
350  static constexpr FwIndexType getNum_Tlm_OutputPorts() {
351  return NUM_TLM_OUTPUT_PORTS;
352  }
353 
354  protected:
355 
356  // ----------------------------------------------------------------------
357  // Connection status queries for special output ports
358  // ----------------------------------------------------------------------
359 
364  FwIndexType portNum
365  ) const;
366 
371  FwIndexType portNum
372  ) const;
373 
378  FwIndexType portNum
379  ) const;
380 
381 #if FW_ENABLE_TEXT_LOGGING == 1
382 
386  bool isConnected_LogText_OutputPort(
387  FwIndexType portNum
388  ) const;
389 
390 #endif
391 
396  FwIndexType portNum
397  ) const;
398 
403  FwIndexType portNum
404  ) const;
405 
406 #if FW_DIRECT_PORT_CALLS
407  public:
408 #else
409  protected:
410 #endif
411 
412  // ----------------------------------------------------------------------
413  // Port handler base-class functions for special input ports
414  //
415  // Call these functions directly to bypass the corresponding ports
416  // ----------------------------------------------------------------------
417 
419  void CmdDisp_handlerBase(
420  FwIndexType portNum,
421  FwOpcodeType opCode,
422  U32 cmdSeq,
423  Fw::CmdArgBuffer& args
424  );
425 
426  protected:
427 
428  // ----------------------------------------------------------------------
429  // Handlers to implement for typed input ports
430  // ----------------------------------------------------------------------
431 
433  virtual void run_handler(
434  FwIndexType portNum,
435  U32 context
436  ) = 0;
437 
438 #if FW_DIRECT_PORT_CALLS
439  public:
440 #else
441  protected:
442 #endif
443 
444  // ----------------------------------------------------------------------
445  // Port handler base-class functions for typed input ports
446  //
447  // Call these functions directly to bypass the corresponding ports
448  // ----------------------------------------------------------------------
449 
451  void run_handlerBase(
452  FwIndexType portNum,
453  U32 context
454  );
455 
456  protected:
457 
458  // ----------------------------------------------------------------------
459  // Command response
460  // ----------------------------------------------------------------------
461 
463  void cmdResponse_out(
464  FwOpcodeType opCode,
465  U32 cmdSeq,
466  Fw::CmdResponse response
467  );
468 
469  protected:
470 
471  // ----------------------------------------------------------------------
472  // Command handlers to implement
473  // ----------------------------------------------------------------------
474 
478  virtual void ENABLE_cmdHandler(
479  FwOpcodeType opCode,
480  U32 cmdSeq,
482  ) = 0;
483 
484  protected:
485 
486  // ----------------------------------------------------------------------
487  // Command handler base-class functions
488  //
489  // Call these functions directly to bypass the command input port
490  // ----------------------------------------------------------------------
491 
496  FwOpcodeType opCode,
497  U32 cmdSeq,
498  Fw::CmdArgBuffer& args
499  );
500 
501  protected:
502 
503  // ----------------------------------------------------------------------
504  // Telemetry serialized write
505  // ----------------------------------------------------------------------
506 
511  void tlmWrite(
512  FwChanIdType id,
513  Fw::TlmBuffer& _tlmBuff,
514  Fw::Time _tlmTime = Fw::Time()
515  ) const;
516 
517  protected:
518 
519  // ----------------------------------------------------------------------
520  // Telemetry write functions
521  // ----------------------------------------------------------------------
522 
527  U64 arg,
528  Fw::Time _tlmTime = Fw::Time()
529  ) const;
530 
535  U64 arg,
536  Fw::Time _tlmTime = Fw::Time()
537  ) const;
538 
543  U64 arg,
544  Fw::Time _tlmTime = Fw::Time()
545  ) const;
546 
551  U64 arg,
552  Fw::Time _tlmTime = Fw::Time()
553  ) const;
554 
558  void tlmWrite_CPU(
559  F32 arg,
560  Fw::Time _tlmTime = Fw::Time()
561  ) const;
562 
566  void tlmWrite_CPU_00(
567  F32 arg,
568  Fw::Time _tlmTime = Fw::Time()
569  ) const;
570 
574  void tlmWrite_CPU_01(
575  F32 arg,
576  Fw::Time _tlmTime = Fw::Time()
577  ) const;
578 
582  void tlmWrite_CPU_02(
583  F32 arg,
584  Fw::Time _tlmTime = Fw::Time()
585  ) const;
586 
590  void tlmWrite_CPU_03(
591  F32 arg,
592  Fw::Time _tlmTime = Fw::Time()
593  ) const;
594 
598  void tlmWrite_CPU_04(
599  F32 arg,
600  Fw::Time _tlmTime = Fw::Time()
601  ) const;
602 
606  void tlmWrite_CPU_05(
607  F32 arg,
608  Fw::Time _tlmTime = Fw::Time()
609  ) const;
610 
614  void tlmWrite_CPU_06(
615  F32 arg,
616  Fw::Time _tlmTime = Fw::Time()
617  ) const;
618 
622  void tlmWrite_CPU_07(
623  F32 arg,
624  Fw::Time _tlmTime = Fw::Time()
625  ) const;
626 
630  void tlmWrite_CPU_08(
631  F32 arg,
632  Fw::Time _tlmTime = Fw::Time()
633  ) const;
634 
638  void tlmWrite_CPU_09(
639  F32 arg,
640  Fw::Time _tlmTime = Fw::Time()
641  ) const;
642 
646  void tlmWrite_CPU_10(
647  F32 arg,
648  Fw::Time _tlmTime = Fw::Time()
649  ) const;
650 
654  void tlmWrite_CPU_11(
655  F32 arg,
656  Fw::Time _tlmTime = Fw::Time()
657  ) const;
658 
662  void tlmWrite_CPU_12(
663  F32 arg,
664  Fw::Time _tlmTime = Fw::Time()
665  ) const;
666 
670  void tlmWrite_CPU_13(
671  F32 arg,
672  Fw::Time _tlmTime = Fw::Time()
673  ) const;
674 
678  void tlmWrite_CPU_14(
679  F32 arg,
680  Fw::Time _tlmTime = Fw::Time()
681  ) const;
682 
686  void tlmWrite_CPU_15(
687  F32 arg,
688  Fw::Time _tlmTime = Fw::Time()
689  ) const;
690 
691  protected:
692 
693  // ----------------------------------------------------------------------
694  // Time
695  // ----------------------------------------------------------------------
696 
700  Fw::Time getTime() const;
701 
702  protected:
703 
704  // ----------------------------------------------------------------------
705  // Mutex operations for guarded ports
706  //
707  // You can override these operations to provide more sophisticated
708  // synchronization
709  // ----------------------------------------------------------------------
710 
712  virtual void lock();
713 
715  virtual void unLock();
716 
717  private:
718 
719  // ----------------------------------------------------------------------
720  // Calls for messages received on special input ports
721  // ----------------------------------------------------------------------
722 
724  static void m_p_CmdDisp_in(
725  Fw::PassiveComponentBase* callComp,
726  FwIndexType portNum,
727  FwOpcodeType opCode,
728  U32 cmdSeq,
729  Fw::CmdArgBuffer& args
730  );
731 
732  private:
733 
734  // ----------------------------------------------------------------------
735  // Calls for messages received on typed input ports
736  // ----------------------------------------------------------------------
737 
739  static void m_p_run_in(
740  Fw::PassiveComponentBase* callComp,
741  FwIndexType portNum,
742  U32 context
743  );
744 
745  private:
746 
747  // ----------------------------------------------------------------------
748  // Invocation functions for special output ports
749  // ----------------------------------------------------------------------
750 
752  void CmdReg_out(
753  FwIndexType portNum,
754  FwOpcodeType opCode
755  ) const;
756 
758  void CmdStatus_out(
759  FwIndexType portNum,
760  FwOpcodeType opCode,
761  U32 cmdSeq,
762  const Fw::CmdResponse& response
763  ) const;
764 
766  void Time_out(
767  FwIndexType portNum,
768  Fw::Time& time
769  ) const;
770 
772  void Tlm_out(
773  FwIndexType portNum,
774  FwChanIdType id,
775  Fw::Time& timeTag,
776  Fw::TlmBuffer& val
777  ) const;
778 
779 #if !FW_DIRECT_PORT_CALLS
780 
781  private:
782 
783  // ----------------------------------------------------------------------
784  // Special input ports
785  // ----------------------------------------------------------------------
786 
788  Fw::InputCmdPort m_CmdDisp_InputPort[NUM_CMDDISP_INPUT_PORTS];
789 
790 #endif
791 
792 #if !FW_DIRECT_PORT_CALLS
793 
794  private:
795 
796  // ----------------------------------------------------------------------
797  // Typed input ports
798  // ----------------------------------------------------------------------
799 
801  Svc::InputSchedPort m_run_InputPort[NUM_RUN_INPUT_PORTS];
802 
803 #endif
804 
805 #if !FW_DIRECT_PORT_CALLS
806 
807  private:
808 
809  // ----------------------------------------------------------------------
810  // Special output ports
811  // ----------------------------------------------------------------------
812 
814  Fw::OutputCmdRegPort m_CmdReg_OutputPort[NUM_CMDREG_OUTPUT_PORTS];
815 
818 
820  Fw::OutputLogPort m_Log_OutputPort[NUM_LOG_OUTPUT_PORTS];
821 
822 #if FW_ENABLE_TEXT_LOGGING == 1
823 
825  Fw::OutputLogTextPort m_LogText_OutputPort[NUM_LOGTEXT_OUTPUT_PORTS];
826 
827 #endif
828 
830  Fw::OutputTimePort m_Time_OutputPort[NUM_TIME_OUTPUT_PORTS];
831 
833  Fw::OutputTlmPort m_Tlm_OutputPort[NUM_TLM_OUTPUT_PORTS];
834 
835 #endif
836 
837  private:
838 
839  // ----------------------------------------------------------------------
840  // Mutexes
841  // ----------------------------------------------------------------------
842 
844  Os::Mutex m_guardedPortMutex;
845 
846  };
847 
848 }
849 
850 #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:83
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()
A command to enable or disable system resource telemetry.
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
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