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 
271  }
272 
273  protected:
274 
275  // ----------------------------------------------------------------------
276  // Getters for numbers of typed input ports
277  // ----------------------------------------------------------------------
278 
282  static constexpr FwIndexType getNum_run_InputPorts() {
283  return NUM_RUN_INPUT_PORTS;
284  }
285 
286  protected:
287 
288  // ----------------------------------------------------------------------
289  // Getters for numbers of special output ports
290  // ----------------------------------------------------------------------
291 
297  }
298 
304  }
305 
309  static constexpr FwIndexType getNum_Log_OutputPorts() {
310  return NUM_LOG_OUTPUT_PORTS;
311  }
312 
313 #if FW_ENABLE_TEXT_LOGGING == 1
314 
318  static constexpr FwIndexType getNum_LogText_OutputPorts() {
320  }
321 
322 #endif
323 
328  return NUM_TIME_OUTPUT_PORTS;
329  }
330 
334  static constexpr FwIndexType getNum_Tlm_OutputPorts() {
335  return NUM_TLM_OUTPUT_PORTS;
336  }
337 
338  protected:
339 
340  // ----------------------------------------------------------------------
341  // Connection status queries for special output ports
342  // ----------------------------------------------------------------------
343 
348  FwIndexType portNum
349  );
350 
355  FwIndexType portNum
356  );
357 
362  FwIndexType portNum
363  );
364 
365 #if FW_ENABLE_TEXT_LOGGING == 1
366 
370  bool isConnected_LogText_OutputPort(
371  FwIndexType portNum
372  );
373 
374 #endif
375 
380  FwIndexType portNum
381  );
382 
387  FwIndexType portNum
388  );
389 
390  protected:
391 
392  // ----------------------------------------------------------------------
393  // Handlers to implement for typed input ports
394  // ----------------------------------------------------------------------
395 
397  virtual void run_handler(
398  FwIndexType portNum,
399  U32 context
400  ) = 0;
401 
402  protected:
403 
404  // ----------------------------------------------------------------------
405  // Port handler base-class functions for typed input ports
406  //
407  // Call these functions directly to bypass the corresponding ports
408  // ----------------------------------------------------------------------
409 
411  void run_handlerBase(
412  FwIndexType portNum,
413  U32 context
414  );
415 
416  protected:
417 
418  // ----------------------------------------------------------------------
419  // Command response
420  // ----------------------------------------------------------------------
421 
423  void cmdResponse_out(
424  FwOpcodeType opCode,
425  U32 cmdSeq,
426  Fw::CmdResponse response
427  );
428 
429  protected:
430 
431  // ----------------------------------------------------------------------
432  // Command handlers to implement
433  // ----------------------------------------------------------------------
434 
438  virtual void ENABLE_cmdHandler(
439  FwOpcodeType opCode,
440  U32 cmdSeq,
442  ) = 0;
443 
444  protected:
445 
446  // ----------------------------------------------------------------------
447  // Command handler base-class functions
448  //
449  // Call these functions directly to bypass the command input port
450  // ----------------------------------------------------------------------
451 
456  FwOpcodeType opCode,
457  U32 cmdSeq,
458  Fw::CmdArgBuffer& args
459  );
460 
461  protected:
462 
463  // ----------------------------------------------------------------------
464  // Telemetry write functions
465  // ----------------------------------------------------------------------
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 
487  U64 arg,
488  Fw::Time _tlmTime = Fw::Time()
489  ) const;
490 
495  U64 arg,
496  Fw::Time _tlmTime = Fw::Time()
497  ) const;
498 
502  void tlmWrite_CPU(
503  F32 arg,
504  Fw::Time _tlmTime = Fw::Time()
505  ) const;
506 
510  void tlmWrite_CPU_00(
511  F32 arg,
512  Fw::Time _tlmTime = Fw::Time()
513  ) const;
514 
518  void tlmWrite_CPU_01(
519  F32 arg,
520  Fw::Time _tlmTime = Fw::Time()
521  ) const;
522 
526  void tlmWrite_CPU_02(
527  F32 arg,
528  Fw::Time _tlmTime = Fw::Time()
529  ) const;
530 
534  void tlmWrite_CPU_03(
535  F32 arg,
536  Fw::Time _tlmTime = Fw::Time()
537  ) const;
538 
542  void tlmWrite_CPU_04(
543  F32 arg,
544  Fw::Time _tlmTime = Fw::Time()
545  ) const;
546 
550  void tlmWrite_CPU_05(
551  F32 arg,
552  Fw::Time _tlmTime = Fw::Time()
553  ) const;
554 
558  void tlmWrite_CPU_06(
559  F32 arg,
560  Fw::Time _tlmTime = Fw::Time()
561  ) const;
562 
566  void tlmWrite_CPU_07(
567  F32 arg,
568  Fw::Time _tlmTime = Fw::Time()
569  ) const;
570 
574  void tlmWrite_CPU_08(
575  F32 arg,
576  Fw::Time _tlmTime = Fw::Time()
577  ) const;
578 
582  void tlmWrite_CPU_09(
583  F32 arg,
584  Fw::Time _tlmTime = Fw::Time()
585  ) const;
586 
590  void tlmWrite_CPU_10(
591  F32 arg,
592  Fw::Time _tlmTime = Fw::Time()
593  ) const;
594 
598  void tlmWrite_CPU_11(
599  F32 arg,
600  Fw::Time _tlmTime = Fw::Time()
601  ) const;
602 
606  void tlmWrite_CPU_12(
607  F32 arg,
608  Fw::Time _tlmTime = Fw::Time()
609  ) const;
610 
614  void tlmWrite_CPU_13(
615  F32 arg,
616  Fw::Time _tlmTime = Fw::Time()
617  ) const;
618 
622  void tlmWrite_CPU_14(
623  F32 arg,
624  Fw::Time _tlmTime = Fw::Time()
625  ) const;
626 
630  void tlmWrite_CPU_15(
631  F32 arg,
632  Fw::Time _tlmTime = Fw::Time()
633  ) const;
634 
635  protected:
636 
637  // ----------------------------------------------------------------------
638  // Time
639  // ----------------------------------------------------------------------
640 
644  Fw::Time getTime() const;
645 
646  protected:
647 
648  // ----------------------------------------------------------------------
649  // Mutex operations for guarded ports
650  //
651  // You can override these operations to provide more sophisticated
652  // synchronization
653  // ----------------------------------------------------------------------
654 
656  virtual void lock();
657 
659  virtual void unLock();
660 
661  private:
662 
663  // ----------------------------------------------------------------------
664  // Calls for messages received on special input ports
665  // ----------------------------------------------------------------------
666 
668  static void m_p_CmdDisp_in(
669  Fw::PassiveComponentBase* callComp,
670  FwIndexType portNum,
671  FwOpcodeType opCode,
672  U32 cmdSeq,
673  Fw::CmdArgBuffer& args
674  );
675 
676  private:
677 
678  // ----------------------------------------------------------------------
679  // Calls for messages received on typed input ports
680  // ----------------------------------------------------------------------
681 
683  static void m_p_run_in(
684  Fw::PassiveComponentBase* callComp,
685  FwIndexType portNum,
686  U32 context
687  );
688 
689  private:
690 
691  // ----------------------------------------------------------------------
692  // Special input ports
693  // ----------------------------------------------------------------------
694 
696  Fw::InputCmdPort m_CmdDisp_InputPort[NUM_CMDDISP_INPUT_PORTS];
697 
698  private:
699 
700  // ----------------------------------------------------------------------
701  // Typed input ports
702  // ----------------------------------------------------------------------
703 
705  Svc::InputSchedPort m_run_InputPort[NUM_RUN_INPUT_PORTS];
706 
707  private:
708 
709  // ----------------------------------------------------------------------
710  // Special output ports
711  // ----------------------------------------------------------------------
712 
714  Fw::OutputCmdRegPort m_CmdReg_OutputPort[NUM_CMDREG_OUTPUT_PORTS];
715 
718 
720  Fw::OutputLogPort m_Log_OutputPort[NUM_LOG_OUTPUT_PORTS];
721 
722 #if FW_ENABLE_TEXT_LOGGING == 1
723 
725  Fw::OutputLogTextPort m_LogText_OutputPort[NUM_LOGTEXT_OUTPUT_PORTS];
726 
727 #endif
728 
730  Fw::OutputTimePort m_Time_OutputPort[NUM_TIME_OUTPUT_PORTS];
731 
733  Fw::OutputTlmPort m_Tlm_OutputPort[NUM_TLM_OUTPUT_PORTS];
734 
735  private:
736 
737  // ----------------------------------------------------------------------
738  // Mutexes
739  // ----------------------------------------------------------------------
740 
742  Os::Mutex m_guardedPortMutex;
743 
744  };
745 
746 }
747 
748 #endif
void set_CmdStatus_OutputPort(FwIndexType portNum, Fw::InputCmdResponsePort *port)
Connect port to CmdStatus[portNum].
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
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
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: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.
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)
static constexpr FwIndexType getNum_CmdDisp_InputPorts()
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
static constexpr FwIndexType getNum_Tlm_OutputPorts()
static constexpr FwIndexType getNum_run_InputPorts()
A command to enable or disable system resource telemetry.
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
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 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)
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