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
22 #include "Fw/Time/TimePortAc.hpp"
23 #include "Fw/Tlm/TlmPortAc.hpp"
24 #include "Fw/Tlm/TlmString.hpp"
25 #include "Os/Mutex.hpp"
28 
29 namespace Svc {
30 
35  {
36 
37  // ----------------------------------------------------------------------
38  // Friend classes
39  // ----------------------------------------------------------------------
40 
44  friend class SystemResourcesTester;
45 
46  PROTECTED:
47 
48  // ----------------------------------------------------------------------
49  // Constants
50  // ----------------------------------------------------------------------
51 
53  enum {
55  };
56 
58  enum {
60  };
61 
63  enum {
70  };
71 
73  enum {
74  OPCODE_ENABLE = 0x0,
75  };
76 
78  enum {
83  CHANNELID_CPU = 0x4,
100  };
101 
102  public:
103 
104  // ----------------------------------------------------------------------
105  // Component initialization
106  // ----------------------------------------------------------------------
107 
109  void init(
110  FwEnumStoreType instance = 0
111  );
112 
113  public:
114 
115  // ----------------------------------------------------------------------
116  // Getters for special input ports
117  // ----------------------------------------------------------------------
118 
123  FwIndexType portNum
124  );
125 
126  public:
127 
128  // ----------------------------------------------------------------------
129  // Getters for typed input ports
130  // ----------------------------------------------------------------------
131 
136  FwIndexType portNum
137  );
138 
139  public:
140 
141  // ----------------------------------------------------------------------
142  // Connect input ports to special output ports
143  // ----------------------------------------------------------------------
144 
147  FwIndexType portNum,
148  Fw::InputCmdRegPort* port
149  );
150 
153  FwIndexType portNum,
155  );
156 
158  void set_Log_OutputPort(
159  FwIndexType portNum,
160  Fw::InputLogPort* port
161  );
162 
163 #if FW_ENABLE_TEXT_LOGGING == 1
164 
166  void set_LogText_OutputPort(
167  FwIndexType portNum,
168  Fw::InputLogTextPort* port
169  );
170 
171 #endif
172 
174  void set_Time_OutputPort(
175  FwIndexType portNum,
176  Fw::InputTimePort* port
177  );
178 
180  void set_Tlm_OutputPort(
181  FwIndexType portNum,
182  Fw::InputTlmPort* port
183  );
184 
185 #if FW_PORT_SERIALIZATION
186 
187  public:
188 
189  // ----------------------------------------------------------------------
190  // Connect serial input ports to special output ports
191  // ----------------------------------------------------------------------
192 
195  FwIndexType portNum,
196  Fw::InputSerializePort* port
197  );
198 
201  FwIndexType portNum,
202  Fw::InputSerializePort* port
203  );
204 
206  void set_Log_OutputPort(
207  FwIndexType portNum,
208  Fw::InputSerializePort* port
209  );
210 
211 #if FW_ENABLE_TEXT_LOGGING == 1
212 
214  void set_LogText_OutputPort(
215  FwIndexType portNum,
216  Fw::InputSerializePort* port
217  );
218 
219 #endif
220 
222  void set_Time_OutputPort(
223  FwIndexType portNum,
224  Fw::InputSerializePort* port
225  );
226 
228  void set_Tlm_OutputPort(
229  FwIndexType portNum,
230  Fw::InputSerializePort* port
231  );
232 
233 #endif
234 
235  public:
236 
237  // ----------------------------------------------------------------------
238  // Command registration
239  // ----------------------------------------------------------------------
240 
244  void regCommands();
245 
246  PROTECTED:
247 
248  // ----------------------------------------------------------------------
249  // Component construction and destruction
250  // ----------------------------------------------------------------------
251 
254  const char* compName = ""
255  );
256 
259 
260  PROTECTED:
261 
262  // ----------------------------------------------------------------------
263  // Getters for numbers of special input ports
264  // ----------------------------------------------------------------------
265 
270 
271  PROTECTED:
272 
273  // ----------------------------------------------------------------------
274  // Getters for numbers of typed input ports
275  // ----------------------------------------------------------------------
276 
281 
282  PROTECTED:
283 
284  // ----------------------------------------------------------------------
285  // Getters for numbers of special output ports
286  // ----------------------------------------------------------------------
287 
292 
297 
302 
303 #if FW_ENABLE_TEXT_LOGGING == 1
304 
308  FwIndexType getNum_LogText_OutputPorts() const;
309 
310 #endif
311 
316 
321 
322  PROTECTED:
323 
324  // ----------------------------------------------------------------------
325  // Connection status queries for special output ports
326  // ----------------------------------------------------------------------
327 
332  FwIndexType portNum
333  );
334 
339  FwIndexType portNum
340  );
341 
346  FwIndexType portNum
347  );
348 
349 #if FW_ENABLE_TEXT_LOGGING == 1
350 
354  bool isConnected_LogText_OutputPort(
355  FwIndexType portNum
356  );
357 
358 #endif
359 
364  FwIndexType portNum
365  );
366 
371  FwIndexType portNum
372  );
373 
374  PROTECTED:
375 
376  // ----------------------------------------------------------------------
377  // Handlers to implement for typed input ports
378  // ----------------------------------------------------------------------
379 
381  virtual void run_handler(
382  FwIndexType portNum,
383  U32 context
384  ) = 0;
385 
386  PROTECTED:
387 
388  // ----------------------------------------------------------------------
389  // Port handler base-class functions for typed input ports
390  //
391  // Call these functions directly to bypass the corresponding ports
392  // ----------------------------------------------------------------------
393 
395  void run_handlerBase(
396  FwIndexType portNum,
397  U32 context
398  );
399 
400  PROTECTED:
401 
402  // ----------------------------------------------------------------------
403  // Command response
404  // ----------------------------------------------------------------------
405 
407  void cmdResponse_out(
408  FwOpcodeType opCode,
409  U32 cmdSeq,
410  Fw::CmdResponse response
411  );
412 
413  PROTECTED:
414 
415  // ----------------------------------------------------------------------
416  // Command handlers to implement
417  // ----------------------------------------------------------------------
418 
422  virtual void ENABLE_cmdHandler(
423  FwOpcodeType opCode,
424  U32 cmdSeq,
426  ) = 0;
427 
428  PROTECTED:
429 
430  // ----------------------------------------------------------------------
431  // Command handler base-class functions
432  //
433  // Call these functions directly to bypass the command input port
434  // ----------------------------------------------------------------------
435 
440  FwOpcodeType opCode,
441  U32 cmdSeq,
442  Fw::CmdArgBuffer& args
443  );
444 
445  PROTECTED:
446 
447  // ----------------------------------------------------------------------
448  // Telemetry write functions
449  // ----------------------------------------------------------------------
450 
455  U64 arg,
456  Fw::Time _tlmTime = Fw::Time()
457  ) const;
458 
463  U64 arg,
464  Fw::Time _tlmTime = Fw::Time()
465  ) const;
466 
471  U64 arg,
472  Fw::Time _tlmTime = Fw::Time()
473  ) const;
474 
479  U64 arg,
480  Fw::Time _tlmTime = Fw::Time()
481  ) const;
482 
486  void tlmWrite_CPU(
487  F32 arg,
488  Fw::Time _tlmTime = Fw::Time()
489  ) const;
490 
494  void tlmWrite_CPU_00(
495  F32 arg,
496  Fw::Time _tlmTime = Fw::Time()
497  ) const;
498 
502  void tlmWrite_CPU_01(
503  F32 arg,
504  Fw::Time _tlmTime = Fw::Time()
505  ) const;
506 
510  void tlmWrite_CPU_02(
511  F32 arg,
512  Fw::Time _tlmTime = Fw::Time()
513  ) const;
514 
518  void tlmWrite_CPU_03(
519  F32 arg,
520  Fw::Time _tlmTime = Fw::Time()
521  ) const;
522 
526  void tlmWrite_CPU_04(
527  F32 arg,
528  Fw::Time _tlmTime = Fw::Time()
529  ) const;
530 
534  void tlmWrite_CPU_05(
535  F32 arg,
536  Fw::Time _tlmTime = Fw::Time()
537  ) const;
538 
542  void tlmWrite_CPU_06(
543  F32 arg,
544  Fw::Time _tlmTime = Fw::Time()
545  ) const;
546 
550  void tlmWrite_CPU_07(
551  F32 arg,
552  Fw::Time _tlmTime = Fw::Time()
553  ) const;
554 
558  void tlmWrite_CPU_08(
559  F32 arg,
560  Fw::Time _tlmTime = Fw::Time()
561  ) const;
562 
566  void tlmWrite_CPU_09(
567  F32 arg,
568  Fw::Time _tlmTime = Fw::Time()
569  ) const;
570 
574  void tlmWrite_CPU_10(
575  F32 arg,
576  Fw::Time _tlmTime = Fw::Time()
577  ) const;
578 
582  void tlmWrite_CPU_11(
583  F32 arg,
584  Fw::Time _tlmTime = Fw::Time()
585  ) const;
586 
590  void tlmWrite_CPU_12(
591  F32 arg,
592  Fw::Time _tlmTime = Fw::Time()
593  ) const;
594 
598  void tlmWrite_CPU_13(
599  F32 arg,
600  Fw::Time _tlmTime = Fw::Time()
601  ) const;
602 
606  void tlmWrite_CPU_14(
607  F32 arg,
608  Fw::Time _tlmTime = Fw::Time()
609  ) const;
610 
614  void tlmWrite_CPU_15(
615  F32 arg,
616  Fw::Time _tlmTime = Fw::Time()
617  ) const;
618 
619  PROTECTED:
620 
621  // ----------------------------------------------------------------------
622  // Time
623  // ----------------------------------------------------------------------
624 
628  Fw::Time getTime() const;
629 
630  PROTECTED:
631 
632  // ----------------------------------------------------------------------
633  // Mutex operations for guarded ports
634  //
635  // You can override these operations to provide more sophisticated
636  // synchronization
637  // ----------------------------------------------------------------------
638 
640  virtual void lock();
641 
643  virtual void unLock();
644 
645  PRIVATE:
646 
647  // ----------------------------------------------------------------------
648  // Calls for messages received on special input ports
649  // ----------------------------------------------------------------------
650 
652  static void m_p_CmdDisp_in(
653  Fw::PassiveComponentBase* callComp,
654  FwIndexType portNum,
655  FwOpcodeType opCode,
656  U32 cmdSeq,
657  Fw::CmdArgBuffer& args
658  );
659 
660  PRIVATE:
661 
662  // ----------------------------------------------------------------------
663  // Calls for messages received on typed input ports
664  // ----------------------------------------------------------------------
665 
667  static void m_p_run_in(
668  Fw::PassiveComponentBase* callComp,
669  FwIndexType portNum,
670  U32 context
671  );
672 
673  PRIVATE:
674 
675  // ----------------------------------------------------------------------
676  // Special input ports
677  // ----------------------------------------------------------------------
678 
680  Fw::InputCmdPort m_CmdDisp_InputPort[NUM_CMDDISP_INPUT_PORTS];
681 
682  PRIVATE:
683 
684  // ----------------------------------------------------------------------
685  // Typed input ports
686  // ----------------------------------------------------------------------
687 
689  Svc::InputSchedPort m_run_InputPort[NUM_RUN_INPUT_PORTS];
690 
691  PRIVATE:
692 
693  // ----------------------------------------------------------------------
694  // Special output ports
695  // ----------------------------------------------------------------------
696 
698  Fw::OutputCmdRegPort m_CmdReg_OutputPort[NUM_CMDREG_OUTPUT_PORTS];
699 
702 
704  Fw::OutputLogPort m_Log_OutputPort[NUM_LOG_OUTPUT_PORTS];
705 
706 #if FW_ENABLE_TEXT_LOGGING == 1
707 
709  Fw::OutputLogTextPort m_LogText_OutputPort[NUM_LOGTEXT_OUTPUT_PORTS];
710 
711 #endif
712 
714  Fw::OutputTimePort m_Time_OutputPort[NUM_TIME_OUTPUT_PORTS];
715 
717  Fw::OutputTlmPort m_Tlm_OutputPort[NUM_TLM_OUTPUT_PORTS];
718 
719  PRIVATE:
720 
721  // ----------------------------------------------------------------------
722  // Mutexes
723  // ----------------------------------------------------------------------
724 
726  Os::Mutex m_guardedPortMutex;
727 
728  };
729 
730 }
731 
732 #endif
void set_CmdStatus_OutputPort(FwIndexType portNum, Fw::InputCmdResponsePort *port)
Connect port to CmdStatus[portNum].
Definition: Time.hpp:9
bool isConnected_CmdReg_OutputPort(FwIndexType 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
virtual void ENABLE_cmdHandler(FwOpcodeType opCode, U32 cmdSeq, Svc::SystemResourceEnabled enable)=0
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
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].
bool isConnected_Log_OutputPort(FwIndexType 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)
void tlmWrite_CPU_10(F32 arg, Fw::Time _tlmTime=Fw::Time()) const
void init()
Object initializer.
Definition: ObjBase.cpp:26
float F32
32-bit floating point
Definition: BasicTypes.h:86
friend class SystemResourcesTester
Friend class tester implementation to support white-box testing.
SystemResourcesComponentBase(const char *compName="")
Construct SystemResourcesComponentBase object.
bool isConnected_Tlm_OutputPort(FwIndexType portNum)
void tlmWrite_CPU_13(F32 arg, Fw::Time _tlmTime=Fw::Time()) const
void tlmWrite_CPU_11(F32 arg, Fw::Time _tlmTime=Fw::Time()) const
Svc::InputSchedPort * get_run_InputPort(FwIndexType portNum)
A command to enable or disable system resource telemetry.
virtual void run_handler(FwIndexType portNum, U32 context)=0
Handler for input port run.
virtual void unLock()
Unlock the guarded mutex.
void cmdResponse_out(FwOpcodeType opCode, U32 cmdSeq, Fw::CmdResponse response)
Emit command response.
void tlmWrite_CPU_14(F32 arg, Fw::Time _tlmTime=Fw::Time()) const
friend class SystemResourcesTesterBase
Friend class tester to support autocoded test harness.
void tlmWrite_CPU_15(F32 arg, Fw::Time _tlmTime=Fw::Time()) const
bool isConnected_CmdStatus_OutputPort(FwIndexType portNum)
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
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 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
virtual void lock()
Lock the guarded mutex.
bool isConnected_Time_OutputPort(FwIndexType portNum)
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:180