F´ Flight Software - C/C++ Documentation
A framework for building embedded system applications to NASA flight quality standards.
SystemResourcesComponentAc.cpp
Go to the documentation of this file.
1 // ======================================================================
2 // \title SystemResourcesComponentAc.cpp
3 // \author Generated by fpp-to-cpp
4 // \brief cpp file for SystemResources component base class
5 // ======================================================================
6 
7 #include "Fw/Types/Assert.hpp"
9 #if FW_ENABLE_TEXT_LOGGING
10 #include "Fw/Types/String.hpp"
11 #endif
13 
14 namespace Svc {
15 
16  // ----------------------------------------------------------------------
17  // Component initialization
18  // ----------------------------------------------------------------------
19 
22  {
23  // Initialize base class
25 
26  // Connect input port CmdDisp
27  for (
28  FwIndexType port = 0;
29  port < static_cast<FwIndexType>(this->getNum_CmdDisp_InputPorts());
30  port++
31  ) {
32  this->m_CmdDisp_InputPort[port].init();
33  this->m_CmdDisp_InputPort[port].addCallComp(
34  this,
35  m_p_CmdDisp_in
36  );
37  this->m_CmdDisp_InputPort[port].setPortNum(port);
38 
39 #if FW_OBJECT_NAMES == 1
40  Fw::ObjectName portName;
41  portName.format(
42  "%s_CmdDisp_InputPort[%" PRI_FwIndexType "]",
43  this->m_objName.toChar(),
44  port
45  );
46  this->m_CmdDisp_InputPort[port].setObjName(portName.toChar());
47 #endif
48  }
49 
50  // Connect input port run
51  for (
52  FwIndexType port = 0;
53  port < static_cast<FwIndexType>(this->getNum_run_InputPorts());
54  port++
55  ) {
56  this->m_run_InputPort[port].init();
57  this->m_run_InputPort[port].addCallComp(
58  this,
59  m_p_run_in
60  );
61  this->m_run_InputPort[port].setPortNum(port);
62 
63 #if FW_OBJECT_NAMES == 1
64  Fw::ObjectName portName;
65  portName.format(
66  "%s_run_InputPort[%" PRI_FwIndexType "]",
67  this->m_objName.toChar(),
68  port
69  );
70  this->m_run_InputPort[port].setObjName(portName.toChar());
71 #endif
72  }
73 
74  // Connect output port CmdReg
75  for (
76  FwIndexType port = 0;
77  port < static_cast<FwIndexType>(this->getNum_CmdReg_OutputPorts());
78  port++
79  ) {
80  this->m_CmdReg_OutputPort[port].init();
81 
82 #if FW_OBJECT_NAMES == 1
83  Fw::ObjectName portName;
84  portName.format(
85  "%s_CmdReg_OutputPort[%" PRI_FwIndexType "]",
86  this->m_objName.toChar(),
87  port
88  );
89  this->m_CmdReg_OutputPort[port].setObjName(portName.toChar());
90 #endif
91  }
92 
93  // Connect output port CmdStatus
94  for (
95  FwIndexType port = 0;
96  port < static_cast<FwIndexType>(this->getNum_CmdStatus_OutputPorts());
97  port++
98  ) {
99  this->m_CmdStatus_OutputPort[port].init();
100 
101 #if FW_OBJECT_NAMES == 1
102  Fw::ObjectName portName;
103  portName.format(
104  "%s_CmdStatus_OutputPort[%" PRI_FwIndexType "]",
105  this->m_objName.toChar(),
106  port
107  );
108  this->m_CmdStatus_OutputPort[port].setObjName(portName.toChar());
109 #endif
110  }
111 
112  // Connect output port Log
113  for (
114  FwIndexType port = 0;
115  port < static_cast<FwIndexType>(this->getNum_Log_OutputPorts());
116  port++
117  ) {
118  this->m_Log_OutputPort[port].init();
119 
120 #if FW_OBJECT_NAMES == 1
121  Fw::ObjectName portName;
122  portName.format(
123  "%s_Log_OutputPort[%" PRI_FwIndexType "]",
124  this->m_objName.toChar(),
125  port
126  );
127  this->m_Log_OutputPort[port].setObjName(portName.toChar());
128 #endif
129  }
130 
131 #if FW_ENABLE_TEXT_LOGGING == 1
132  // Connect output port LogText
133  for (
134  FwIndexType port = 0;
135  port < static_cast<FwIndexType>(this->getNum_LogText_OutputPorts());
136  port++
137  ) {
138  this->m_LogText_OutputPort[port].init();
139 
140 #if FW_OBJECT_NAMES == 1
141  Fw::ObjectName portName;
142  portName.format(
143  "%s_LogText_OutputPort[%" PRI_FwIndexType "]",
144  this->m_objName.toChar(),
145  port
146  );
147  this->m_LogText_OutputPort[port].setObjName(portName.toChar());
148 #endif
149  }
150 #endif
151 
152  // Connect output port Time
153  for (
154  FwIndexType port = 0;
155  port < static_cast<FwIndexType>(this->getNum_Time_OutputPorts());
156  port++
157  ) {
158  this->m_Time_OutputPort[port].init();
159 
160 #if FW_OBJECT_NAMES == 1
161  Fw::ObjectName portName;
162  portName.format(
163  "%s_Time_OutputPort[%" PRI_FwIndexType "]",
164  this->m_objName.toChar(),
165  port
166  );
167  this->m_Time_OutputPort[port].setObjName(portName.toChar());
168 #endif
169  }
170 
171  // Connect output port Tlm
172  for (
173  FwIndexType port = 0;
174  port < static_cast<FwIndexType>(this->getNum_Tlm_OutputPorts());
175  port++
176  ) {
177  this->m_Tlm_OutputPort[port].init();
178 
179 #if FW_OBJECT_NAMES == 1
180  Fw::ObjectName portName;
181  portName.format(
182  "%s_Tlm_OutputPort[%" PRI_FwIndexType "]",
183  this->m_objName.toChar(),
184  port
185  );
186  this->m_Tlm_OutputPort[port].setObjName(portName.toChar());
187 #endif
188  }
189  }
190 
191  // ----------------------------------------------------------------------
192  // Getters for special input ports
193  // ----------------------------------------------------------------------
194 
197  {
198  FW_ASSERT(
199  (0 <= portNum) && (portNum < this->getNum_CmdDisp_InputPorts()),
200  static_cast<FwAssertArgType>(portNum)
201  );
202 
203  return &this->m_CmdDisp_InputPort[portNum];
204  }
205 
206  // ----------------------------------------------------------------------
207  // Getters for typed input ports
208  // ----------------------------------------------------------------------
209 
212  {
213  FW_ASSERT(
214  (0 <= portNum) && (portNum < this->getNum_run_InputPorts()),
215  static_cast<FwAssertArgType>(portNum)
216  );
217 
218  return &this->m_run_InputPort[portNum];
219  }
220 
221  // ----------------------------------------------------------------------
222  // Connect input ports to special output ports
223  // ----------------------------------------------------------------------
224 
227  FwIndexType portNum,
228  Fw::InputCmdRegPort* port
229  )
230  {
231  FW_ASSERT(
232  (0 <= portNum) && (portNum < this->getNum_CmdReg_OutputPorts()),
233  static_cast<FwAssertArgType>(portNum)
234  );
235 
236  this->m_CmdReg_OutputPort[portNum].addCallPort(port);
237  }
238 
241  FwIndexType portNum,
243  )
244  {
245  FW_ASSERT(
246  (0 <= portNum) && (portNum < this->getNum_CmdStatus_OutputPorts()),
247  static_cast<FwAssertArgType>(portNum)
248  );
249 
250  this->m_CmdStatus_OutputPort[portNum].addCallPort(port);
251  }
252 
255  FwIndexType portNum,
256  Fw::InputLogPort* port
257  )
258  {
259  FW_ASSERT(
260  (0 <= portNum) && (portNum < this->getNum_Log_OutputPorts()),
261  static_cast<FwAssertArgType>(portNum)
262  );
263 
264  this->m_Log_OutputPort[portNum].addCallPort(port);
265  }
266 
267 #if FW_ENABLE_TEXT_LOGGING == 1
268 
269  void SystemResourcesComponentBase ::
270  set_LogText_OutputPort(
271  FwIndexType portNum,
273  )
274  {
275  FW_ASSERT(
276  (0 <= portNum) && (portNum < this->getNum_LogText_OutputPorts()),
277  static_cast<FwAssertArgType>(portNum)
278  );
279 
280  this->m_LogText_OutputPort[portNum].addCallPort(port);
281  }
282 
283 #endif
284 
287  FwIndexType portNum,
288  Fw::InputTimePort* port
289  )
290  {
291  FW_ASSERT(
292  (0 <= portNum) && (portNum < this->getNum_Time_OutputPorts()),
293  static_cast<FwAssertArgType>(portNum)
294  );
295 
296  this->m_Time_OutputPort[portNum].addCallPort(port);
297  }
298 
301  FwIndexType portNum,
302  Fw::InputTlmPort* port
303  )
304  {
305  FW_ASSERT(
306  (0 <= portNum) && (portNum < this->getNum_Tlm_OutputPorts()),
307  static_cast<FwAssertArgType>(portNum)
308  );
309 
310  this->m_Tlm_OutputPort[portNum].addCallPort(port);
311  }
312 
313 #if FW_PORT_SERIALIZATION
314 
315  // ----------------------------------------------------------------------
316  // Connect serial input ports to special output ports
317  // ----------------------------------------------------------------------
318 
321  FwIndexType portNum,
322  Fw::InputSerializePort* port
323  )
324  {
325  FW_ASSERT(
326  (0 <= portNum) && (portNum < this->getNum_CmdReg_OutputPorts()),
327  static_cast<FwAssertArgType>(portNum)
328  );
329 
330  this->m_CmdReg_OutputPort[portNum].registerSerialPort(port);
331  }
332 
335  FwIndexType portNum,
336  Fw::InputSerializePort* port
337  )
338  {
339  FW_ASSERT(
340  (0 <= portNum) && (portNum < this->getNum_CmdStatus_OutputPorts()),
341  static_cast<FwAssertArgType>(portNum)
342  );
343 
344  this->m_CmdStatus_OutputPort[portNum].registerSerialPort(port);
345  }
346 
349  FwIndexType portNum,
350  Fw::InputSerializePort* port
351  )
352  {
353  FW_ASSERT(
354  (0 <= portNum) && (portNum < this->getNum_Log_OutputPorts()),
355  static_cast<FwAssertArgType>(portNum)
356  );
357 
358  this->m_Log_OutputPort[portNum].registerSerialPort(port);
359  }
360 
361 #if FW_ENABLE_TEXT_LOGGING == 1
362 
363  void SystemResourcesComponentBase ::
364  set_LogText_OutputPort(
365  FwIndexType portNum,
366  Fw::InputSerializePort* port
367  )
368  {
369  FW_ASSERT(
370  (0 <= portNum) && (portNum < this->getNum_LogText_OutputPorts()),
371  static_cast<FwAssertArgType>(portNum)
372  );
373 
374  this->m_LogText_OutputPort[portNum].registerSerialPort(port);
375  }
376 
377 #endif
378 
381  FwIndexType portNum,
382  Fw::InputSerializePort* port
383  )
384  {
385  FW_ASSERT(
386  (0 <= portNum) && (portNum < this->getNum_Time_OutputPorts()),
387  static_cast<FwAssertArgType>(portNum)
388  );
389 
390  this->m_Time_OutputPort[portNum].registerSerialPort(port);
391  }
392 
395  FwIndexType portNum,
396  Fw::InputSerializePort* port
397  )
398  {
399  FW_ASSERT(
400  (0 <= portNum) && (portNum < this->getNum_Tlm_OutputPorts()),
401  static_cast<FwAssertArgType>(portNum)
402  );
403 
404  this->m_Tlm_OutputPort[portNum].registerSerialPort(port);
405  }
406 
407 #endif
408 
409  // ----------------------------------------------------------------------
410  // Command registration
411  // ----------------------------------------------------------------------
412 
415  {
416  FW_ASSERT(this->m_CmdReg_OutputPort[0].isConnected());
417 
418  this->m_CmdReg_OutputPort[0].invoke(
419  this->getIdBase() + OPCODE_ENABLE
420  );
421  }
422 
423  // ----------------------------------------------------------------------
424  // Component construction and destruction
425  // ----------------------------------------------------------------------
426 
428  SystemResourcesComponentBase(const char* compName) :
429  Fw::PassiveComponentBase(compName)
430  {
431 
432  }
433 
436  {
437 
438  }
439 
440  // ----------------------------------------------------------------------
441  // Connection status queries for special output ports
442  // ----------------------------------------------------------------------
443 
446  {
447  FW_ASSERT(
448  (0 <= portNum) && (portNum < this->getNum_CmdReg_OutputPorts()),
449  static_cast<FwAssertArgType>(portNum)
450  );
451 
452  return this->m_CmdReg_OutputPort[portNum].isConnected();
453  }
454 
457  {
458  FW_ASSERT(
459  (0 <= portNum) && (portNum < this->getNum_CmdStatus_OutputPorts()),
460  static_cast<FwAssertArgType>(portNum)
461  );
462 
463  return this->m_CmdStatus_OutputPort[portNum].isConnected();
464  }
465 
468  {
469  FW_ASSERT(
470  (0 <= portNum) && (portNum < this->getNum_Log_OutputPorts()),
471  static_cast<FwAssertArgType>(portNum)
472  );
473 
474  return this->m_Log_OutputPort[portNum].isConnected();
475  }
476 
477 #if FW_ENABLE_TEXT_LOGGING == 1
478 
479  bool SystemResourcesComponentBase ::
480  isConnected_LogText_OutputPort(FwIndexType portNum)
481  {
482  FW_ASSERT(
483  (0 <= portNum) && (portNum < this->getNum_LogText_OutputPorts()),
484  static_cast<FwAssertArgType>(portNum)
485  );
486 
487  return this->m_LogText_OutputPort[portNum].isConnected();
488  }
489 
490 #endif
491 
494  {
495  FW_ASSERT(
496  (0 <= portNum) && (portNum < this->getNum_Time_OutputPorts()),
497  static_cast<FwAssertArgType>(portNum)
498  );
499 
500  return this->m_Time_OutputPort[portNum].isConnected();
501  }
502 
505  {
506  FW_ASSERT(
507  (0 <= portNum) && (portNum < this->getNum_Tlm_OutputPorts()),
508  static_cast<FwAssertArgType>(portNum)
509  );
510 
511  return this->m_Tlm_OutputPort[portNum].isConnected();
512  }
513 
514  // ----------------------------------------------------------------------
515  // Port handler base-class functions for typed input ports
516  //
517  // Call these functions directly to bypass the corresponding ports
518  // ----------------------------------------------------------------------
519 
522  FwIndexType portNum,
523  U32 context
524  )
525  {
526  // Make sure port number is valid
527  FW_ASSERT(
528  (0 <= portNum) && (portNum < this->getNum_run_InputPorts()),
529  static_cast<FwAssertArgType>(portNum)
530  );
531 
532  // Lock guard mutex before calling
533  this->lock();
534 
535  // Call handler function
536  this->run_handler(
537  portNum,
538  context
539  );
540 
541  // Unlock guard mutex
542  this->unLock();
543  }
544 
545  // ----------------------------------------------------------------------
546  // Command response
547  // ----------------------------------------------------------------------
548 
551  FwOpcodeType opCode,
552  U32 cmdSeq,
553  Fw::CmdResponse response
554  )
555  {
556  FW_ASSERT(this->m_CmdStatus_OutputPort[0].isConnected());
557  this->m_CmdStatus_OutputPort[0].invoke(opCode, cmdSeq, response);
558  }
559 
560  // ----------------------------------------------------------------------
561  // Command handler base-class functions
562  //
563  // Call these functions directly to bypass the command input port
564  // ----------------------------------------------------------------------
565 
568  FwOpcodeType opCode,
569  U32 cmdSeq,
570  Fw::CmdArgBuffer& args
571  )
572  {
573  // Deserialize the arguments
575 
576  // Reset the buffer
577  args.resetDeser();
578 
580  _status = args.deserializeTo(enable);
581  if (_status != Fw::FW_SERIALIZE_OK) {
582  if (this->m_CmdStatus_OutputPort[0].isConnected()) {
583  this->m_CmdStatus_OutputPort[0].invoke(
584  opCode,
585  cmdSeq,
587  );
588  }
589  return;
590  }
591 
592 #if FW_CMD_CHECK_RESIDUAL
593  // Make sure there was no data left over.
594  // That means the argument buffer size was incorrect.
595  if (args.getDeserializeSizeLeft() != 0) {
596  if (this->m_CmdStatus_OutputPort[0].isConnected()) {
597  this->m_CmdStatus_OutputPort[0].invoke(
598  opCode,
599  cmdSeq,
601  );
602  }
603  return;
604  }
605 #endif
606 
607  this->lock();
608 
609  this->ENABLE_cmdHandler(
610  opCode, cmdSeq,
611  enable
612  );
613 
614  this->unLock();
615  }
616 
617  // ----------------------------------------------------------------------
618  // Telemetry write functions
619  // ----------------------------------------------------------------------
620 
623  U64 arg,
624  Fw::Time _tlmTime
625  ) const
626  {
627  if (this->m_Tlm_OutputPort[0].isConnected()) {
628  if (
629  this->m_Time_OutputPort[0].isConnected() &&
630  (_tlmTime == Fw::ZERO_TIME)
631  ) {
632  this->m_Time_OutputPort[0].invoke(_tlmTime);
633  }
634 
635  Fw::TlmBuffer _tlmBuff;
636  Fw::SerializeStatus _stat = _tlmBuff.serializeFrom(arg);
637  FW_ASSERT(
638  _stat == Fw::FW_SERIALIZE_OK,
639  static_cast<FwAssertArgType>(_stat)
640  );
641 
642  FwChanIdType _id;
643 
644  _id = this->getIdBase() + CHANNELID_MEMORY_TOTAL;
645 
646  this->m_Tlm_OutputPort[0].invoke(
647  _id,
648  _tlmTime,
649  _tlmBuff
650  );
651  }
652  }
653 
656  U64 arg,
657  Fw::Time _tlmTime
658  ) const
659  {
660  if (this->m_Tlm_OutputPort[0].isConnected()) {
661  if (
662  this->m_Time_OutputPort[0].isConnected() &&
663  (_tlmTime == Fw::ZERO_TIME)
664  ) {
665  this->m_Time_OutputPort[0].invoke(_tlmTime);
666  }
667 
668  Fw::TlmBuffer _tlmBuff;
669  Fw::SerializeStatus _stat = _tlmBuff.serializeFrom(arg);
670  FW_ASSERT(
671  _stat == Fw::FW_SERIALIZE_OK,
672  static_cast<FwAssertArgType>(_stat)
673  );
674 
675  FwChanIdType _id;
676 
677  _id = this->getIdBase() + CHANNELID_MEMORY_USED;
678 
679  this->m_Tlm_OutputPort[0].invoke(
680  _id,
681  _tlmTime,
682  _tlmBuff
683  );
684  }
685  }
686 
689  U64 arg,
690  Fw::Time _tlmTime
691  ) const
692  {
693  if (this->m_Tlm_OutputPort[0].isConnected()) {
694  if (
695  this->m_Time_OutputPort[0].isConnected() &&
696  (_tlmTime == Fw::ZERO_TIME)
697  ) {
698  this->m_Time_OutputPort[0].invoke(_tlmTime);
699  }
700 
701  Fw::TlmBuffer _tlmBuff;
702  Fw::SerializeStatus _stat = _tlmBuff.serializeFrom(arg);
703  FW_ASSERT(
704  _stat == Fw::FW_SERIALIZE_OK,
705  static_cast<FwAssertArgType>(_stat)
706  );
707 
708  FwChanIdType _id;
709 
710  _id = this->getIdBase() + CHANNELID_NON_VOLATILE_TOTAL;
711 
712  this->m_Tlm_OutputPort[0].invoke(
713  _id,
714  _tlmTime,
715  _tlmBuff
716  );
717  }
718  }
719 
722  U64 arg,
723  Fw::Time _tlmTime
724  ) const
725  {
726  if (this->m_Tlm_OutputPort[0].isConnected()) {
727  if (
728  this->m_Time_OutputPort[0].isConnected() &&
729  (_tlmTime == Fw::ZERO_TIME)
730  ) {
731  this->m_Time_OutputPort[0].invoke(_tlmTime);
732  }
733 
734  Fw::TlmBuffer _tlmBuff;
735  Fw::SerializeStatus _stat = _tlmBuff.serializeFrom(arg);
736  FW_ASSERT(
737  _stat == Fw::FW_SERIALIZE_OK,
738  static_cast<FwAssertArgType>(_stat)
739  );
740 
741  FwChanIdType _id;
742 
743  _id = this->getIdBase() + CHANNELID_NON_VOLATILE_FREE;
744 
745  this->m_Tlm_OutputPort[0].invoke(
746  _id,
747  _tlmTime,
748  _tlmBuff
749  );
750  }
751  }
752 
755  F32 arg,
756  Fw::Time _tlmTime
757  ) const
758  {
759  if (this->m_Tlm_OutputPort[0].isConnected()) {
760  if (
761  this->m_Time_OutputPort[0].isConnected() &&
762  (_tlmTime == Fw::ZERO_TIME)
763  ) {
764  this->m_Time_OutputPort[0].invoke(_tlmTime);
765  }
766 
767  Fw::TlmBuffer _tlmBuff;
768  Fw::SerializeStatus _stat = _tlmBuff.serializeFrom(arg);
769  FW_ASSERT(
770  _stat == Fw::FW_SERIALIZE_OK,
771  static_cast<FwAssertArgType>(_stat)
772  );
773 
774  FwChanIdType _id;
775 
776  _id = this->getIdBase() + CHANNELID_CPU;
777 
778  this->m_Tlm_OutputPort[0].invoke(
779  _id,
780  _tlmTime,
781  _tlmBuff
782  );
783  }
784  }
785 
788  F32 arg,
789  Fw::Time _tlmTime
790  ) const
791  {
792  if (this->m_Tlm_OutputPort[0].isConnected()) {
793  if (
794  this->m_Time_OutputPort[0].isConnected() &&
795  (_tlmTime == Fw::ZERO_TIME)
796  ) {
797  this->m_Time_OutputPort[0].invoke(_tlmTime);
798  }
799 
800  Fw::TlmBuffer _tlmBuff;
801  Fw::SerializeStatus _stat = _tlmBuff.serializeFrom(arg);
802  FW_ASSERT(
803  _stat == Fw::FW_SERIALIZE_OK,
804  static_cast<FwAssertArgType>(_stat)
805  );
806 
807  FwChanIdType _id;
808 
809  _id = this->getIdBase() + CHANNELID_CPU_00;
810 
811  this->m_Tlm_OutputPort[0].invoke(
812  _id,
813  _tlmTime,
814  _tlmBuff
815  );
816  }
817  }
818 
821  F32 arg,
822  Fw::Time _tlmTime
823  ) const
824  {
825  if (this->m_Tlm_OutputPort[0].isConnected()) {
826  if (
827  this->m_Time_OutputPort[0].isConnected() &&
828  (_tlmTime == Fw::ZERO_TIME)
829  ) {
830  this->m_Time_OutputPort[0].invoke(_tlmTime);
831  }
832 
833  Fw::TlmBuffer _tlmBuff;
834  Fw::SerializeStatus _stat = _tlmBuff.serializeFrom(arg);
835  FW_ASSERT(
836  _stat == Fw::FW_SERIALIZE_OK,
837  static_cast<FwAssertArgType>(_stat)
838  );
839 
840  FwChanIdType _id;
841 
842  _id = this->getIdBase() + CHANNELID_CPU_01;
843 
844  this->m_Tlm_OutputPort[0].invoke(
845  _id,
846  _tlmTime,
847  _tlmBuff
848  );
849  }
850  }
851 
854  F32 arg,
855  Fw::Time _tlmTime
856  ) const
857  {
858  if (this->m_Tlm_OutputPort[0].isConnected()) {
859  if (
860  this->m_Time_OutputPort[0].isConnected() &&
861  (_tlmTime == Fw::ZERO_TIME)
862  ) {
863  this->m_Time_OutputPort[0].invoke(_tlmTime);
864  }
865 
866  Fw::TlmBuffer _tlmBuff;
867  Fw::SerializeStatus _stat = _tlmBuff.serializeFrom(arg);
868  FW_ASSERT(
869  _stat == Fw::FW_SERIALIZE_OK,
870  static_cast<FwAssertArgType>(_stat)
871  );
872 
873  FwChanIdType _id;
874 
875  _id = this->getIdBase() + CHANNELID_CPU_02;
876 
877  this->m_Tlm_OutputPort[0].invoke(
878  _id,
879  _tlmTime,
880  _tlmBuff
881  );
882  }
883  }
884 
887  F32 arg,
888  Fw::Time _tlmTime
889  ) const
890  {
891  if (this->m_Tlm_OutputPort[0].isConnected()) {
892  if (
893  this->m_Time_OutputPort[0].isConnected() &&
894  (_tlmTime == Fw::ZERO_TIME)
895  ) {
896  this->m_Time_OutputPort[0].invoke(_tlmTime);
897  }
898 
899  Fw::TlmBuffer _tlmBuff;
900  Fw::SerializeStatus _stat = _tlmBuff.serializeFrom(arg);
901  FW_ASSERT(
902  _stat == Fw::FW_SERIALIZE_OK,
903  static_cast<FwAssertArgType>(_stat)
904  );
905 
906  FwChanIdType _id;
907 
908  _id = this->getIdBase() + CHANNELID_CPU_03;
909 
910  this->m_Tlm_OutputPort[0].invoke(
911  _id,
912  _tlmTime,
913  _tlmBuff
914  );
915  }
916  }
917 
920  F32 arg,
921  Fw::Time _tlmTime
922  ) const
923  {
924  if (this->m_Tlm_OutputPort[0].isConnected()) {
925  if (
926  this->m_Time_OutputPort[0].isConnected() &&
927  (_tlmTime == Fw::ZERO_TIME)
928  ) {
929  this->m_Time_OutputPort[0].invoke(_tlmTime);
930  }
931 
932  Fw::TlmBuffer _tlmBuff;
933  Fw::SerializeStatus _stat = _tlmBuff.serializeFrom(arg);
934  FW_ASSERT(
935  _stat == Fw::FW_SERIALIZE_OK,
936  static_cast<FwAssertArgType>(_stat)
937  );
938 
939  FwChanIdType _id;
940 
941  _id = this->getIdBase() + CHANNELID_CPU_04;
942 
943  this->m_Tlm_OutputPort[0].invoke(
944  _id,
945  _tlmTime,
946  _tlmBuff
947  );
948  }
949  }
950 
953  F32 arg,
954  Fw::Time _tlmTime
955  ) const
956  {
957  if (this->m_Tlm_OutputPort[0].isConnected()) {
958  if (
959  this->m_Time_OutputPort[0].isConnected() &&
960  (_tlmTime == Fw::ZERO_TIME)
961  ) {
962  this->m_Time_OutputPort[0].invoke(_tlmTime);
963  }
964 
965  Fw::TlmBuffer _tlmBuff;
966  Fw::SerializeStatus _stat = _tlmBuff.serializeFrom(arg);
967  FW_ASSERT(
968  _stat == Fw::FW_SERIALIZE_OK,
969  static_cast<FwAssertArgType>(_stat)
970  );
971 
972  FwChanIdType _id;
973 
974  _id = this->getIdBase() + CHANNELID_CPU_05;
975 
976  this->m_Tlm_OutputPort[0].invoke(
977  _id,
978  _tlmTime,
979  _tlmBuff
980  );
981  }
982  }
983 
986  F32 arg,
987  Fw::Time _tlmTime
988  ) const
989  {
990  if (this->m_Tlm_OutputPort[0].isConnected()) {
991  if (
992  this->m_Time_OutputPort[0].isConnected() &&
993  (_tlmTime == Fw::ZERO_TIME)
994  ) {
995  this->m_Time_OutputPort[0].invoke(_tlmTime);
996  }
997 
998  Fw::TlmBuffer _tlmBuff;
999  Fw::SerializeStatus _stat = _tlmBuff.serializeFrom(arg);
1000  FW_ASSERT(
1001  _stat == Fw::FW_SERIALIZE_OK,
1002  static_cast<FwAssertArgType>(_stat)
1003  );
1004 
1005  FwChanIdType _id;
1006 
1007  _id = this->getIdBase() + CHANNELID_CPU_06;
1008 
1009  this->m_Tlm_OutputPort[0].invoke(
1010  _id,
1011  _tlmTime,
1012  _tlmBuff
1013  );
1014  }
1015  }
1016 
1019  F32 arg,
1020  Fw::Time _tlmTime
1021  ) const
1022  {
1023  if (this->m_Tlm_OutputPort[0].isConnected()) {
1024  if (
1025  this->m_Time_OutputPort[0].isConnected() &&
1026  (_tlmTime == Fw::ZERO_TIME)
1027  ) {
1028  this->m_Time_OutputPort[0].invoke(_tlmTime);
1029  }
1030 
1031  Fw::TlmBuffer _tlmBuff;
1032  Fw::SerializeStatus _stat = _tlmBuff.serializeFrom(arg);
1033  FW_ASSERT(
1034  _stat == Fw::FW_SERIALIZE_OK,
1035  static_cast<FwAssertArgType>(_stat)
1036  );
1037 
1038  FwChanIdType _id;
1039 
1040  _id = this->getIdBase() + CHANNELID_CPU_07;
1041 
1042  this->m_Tlm_OutputPort[0].invoke(
1043  _id,
1044  _tlmTime,
1045  _tlmBuff
1046  );
1047  }
1048  }
1049 
1052  F32 arg,
1053  Fw::Time _tlmTime
1054  ) const
1055  {
1056  if (this->m_Tlm_OutputPort[0].isConnected()) {
1057  if (
1058  this->m_Time_OutputPort[0].isConnected() &&
1059  (_tlmTime == Fw::ZERO_TIME)
1060  ) {
1061  this->m_Time_OutputPort[0].invoke(_tlmTime);
1062  }
1063 
1064  Fw::TlmBuffer _tlmBuff;
1065  Fw::SerializeStatus _stat = _tlmBuff.serializeFrom(arg);
1066  FW_ASSERT(
1067  _stat == Fw::FW_SERIALIZE_OK,
1068  static_cast<FwAssertArgType>(_stat)
1069  );
1070 
1071  FwChanIdType _id;
1072 
1073  _id = this->getIdBase() + CHANNELID_CPU_08;
1074 
1075  this->m_Tlm_OutputPort[0].invoke(
1076  _id,
1077  _tlmTime,
1078  _tlmBuff
1079  );
1080  }
1081  }
1082 
1085  F32 arg,
1086  Fw::Time _tlmTime
1087  ) const
1088  {
1089  if (this->m_Tlm_OutputPort[0].isConnected()) {
1090  if (
1091  this->m_Time_OutputPort[0].isConnected() &&
1092  (_tlmTime == Fw::ZERO_TIME)
1093  ) {
1094  this->m_Time_OutputPort[0].invoke(_tlmTime);
1095  }
1096 
1097  Fw::TlmBuffer _tlmBuff;
1098  Fw::SerializeStatus _stat = _tlmBuff.serializeFrom(arg);
1099  FW_ASSERT(
1100  _stat == Fw::FW_SERIALIZE_OK,
1101  static_cast<FwAssertArgType>(_stat)
1102  );
1103 
1104  FwChanIdType _id;
1105 
1106  _id = this->getIdBase() + CHANNELID_CPU_09;
1107 
1108  this->m_Tlm_OutputPort[0].invoke(
1109  _id,
1110  _tlmTime,
1111  _tlmBuff
1112  );
1113  }
1114  }
1115 
1118  F32 arg,
1119  Fw::Time _tlmTime
1120  ) const
1121  {
1122  if (this->m_Tlm_OutputPort[0].isConnected()) {
1123  if (
1124  this->m_Time_OutputPort[0].isConnected() &&
1125  (_tlmTime == Fw::ZERO_TIME)
1126  ) {
1127  this->m_Time_OutputPort[0].invoke(_tlmTime);
1128  }
1129 
1130  Fw::TlmBuffer _tlmBuff;
1131  Fw::SerializeStatus _stat = _tlmBuff.serializeFrom(arg);
1132  FW_ASSERT(
1133  _stat == Fw::FW_SERIALIZE_OK,
1134  static_cast<FwAssertArgType>(_stat)
1135  );
1136 
1137  FwChanIdType _id;
1138 
1139  _id = this->getIdBase() + CHANNELID_CPU_10;
1140 
1141  this->m_Tlm_OutputPort[0].invoke(
1142  _id,
1143  _tlmTime,
1144  _tlmBuff
1145  );
1146  }
1147  }
1148 
1151  F32 arg,
1152  Fw::Time _tlmTime
1153  ) const
1154  {
1155  if (this->m_Tlm_OutputPort[0].isConnected()) {
1156  if (
1157  this->m_Time_OutputPort[0].isConnected() &&
1158  (_tlmTime == Fw::ZERO_TIME)
1159  ) {
1160  this->m_Time_OutputPort[0].invoke(_tlmTime);
1161  }
1162 
1163  Fw::TlmBuffer _tlmBuff;
1164  Fw::SerializeStatus _stat = _tlmBuff.serializeFrom(arg);
1165  FW_ASSERT(
1166  _stat == Fw::FW_SERIALIZE_OK,
1167  static_cast<FwAssertArgType>(_stat)
1168  );
1169 
1170  FwChanIdType _id;
1171 
1172  _id = this->getIdBase() + CHANNELID_CPU_11;
1173 
1174  this->m_Tlm_OutputPort[0].invoke(
1175  _id,
1176  _tlmTime,
1177  _tlmBuff
1178  );
1179  }
1180  }
1181 
1184  F32 arg,
1185  Fw::Time _tlmTime
1186  ) const
1187  {
1188  if (this->m_Tlm_OutputPort[0].isConnected()) {
1189  if (
1190  this->m_Time_OutputPort[0].isConnected() &&
1191  (_tlmTime == Fw::ZERO_TIME)
1192  ) {
1193  this->m_Time_OutputPort[0].invoke(_tlmTime);
1194  }
1195 
1196  Fw::TlmBuffer _tlmBuff;
1197  Fw::SerializeStatus _stat = _tlmBuff.serializeFrom(arg);
1198  FW_ASSERT(
1199  _stat == Fw::FW_SERIALIZE_OK,
1200  static_cast<FwAssertArgType>(_stat)
1201  );
1202 
1203  FwChanIdType _id;
1204 
1205  _id = this->getIdBase() + CHANNELID_CPU_12;
1206 
1207  this->m_Tlm_OutputPort[0].invoke(
1208  _id,
1209  _tlmTime,
1210  _tlmBuff
1211  );
1212  }
1213  }
1214 
1217  F32 arg,
1218  Fw::Time _tlmTime
1219  ) const
1220  {
1221  if (this->m_Tlm_OutputPort[0].isConnected()) {
1222  if (
1223  this->m_Time_OutputPort[0].isConnected() &&
1224  (_tlmTime == Fw::ZERO_TIME)
1225  ) {
1226  this->m_Time_OutputPort[0].invoke(_tlmTime);
1227  }
1228 
1229  Fw::TlmBuffer _tlmBuff;
1230  Fw::SerializeStatus _stat = _tlmBuff.serializeFrom(arg);
1231  FW_ASSERT(
1232  _stat == Fw::FW_SERIALIZE_OK,
1233  static_cast<FwAssertArgType>(_stat)
1234  );
1235 
1236  FwChanIdType _id;
1237 
1238  _id = this->getIdBase() + CHANNELID_CPU_13;
1239 
1240  this->m_Tlm_OutputPort[0].invoke(
1241  _id,
1242  _tlmTime,
1243  _tlmBuff
1244  );
1245  }
1246  }
1247 
1250  F32 arg,
1251  Fw::Time _tlmTime
1252  ) const
1253  {
1254  if (this->m_Tlm_OutputPort[0].isConnected()) {
1255  if (
1256  this->m_Time_OutputPort[0].isConnected() &&
1257  (_tlmTime == Fw::ZERO_TIME)
1258  ) {
1259  this->m_Time_OutputPort[0].invoke(_tlmTime);
1260  }
1261 
1262  Fw::TlmBuffer _tlmBuff;
1263  Fw::SerializeStatus _stat = _tlmBuff.serializeFrom(arg);
1264  FW_ASSERT(
1265  _stat == Fw::FW_SERIALIZE_OK,
1266  static_cast<FwAssertArgType>(_stat)
1267  );
1268 
1269  FwChanIdType _id;
1270 
1271  _id = this->getIdBase() + CHANNELID_CPU_14;
1272 
1273  this->m_Tlm_OutputPort[0].invoke(
1274  _id,
1275  _tlmTime,
1276  _tlmBuff
1277  );
1278  }
1279  }
1280 
1283  F32 arg,
1284  Fw::Time _tlmTime
1285  ) const
1286  {
1287  if (this->m_Tlm_OutputPort[0].isConnected()) {
1288  if (
1289  this->m_Time_OutputPort[0].isConnected() &&
1290  (_tlmTime == Fw::ZERO_TIME)
1291  ) {
1292  this->m_Time_OutputPort[0].invoke(_tlmTime);
1293  }
1294 
1295  Fw::TlmBuffer _tlmBuff;
1296  Fw::SerializeStatus _stat = _tlmBuff.serializeFrom(arg);
1297  FW_ASSERT(
1298  _stat == Fw::FW_SERIALIZE_OK,
1299  static_cast<FwAssertArgType>(_stat)
1300  );
1301 
1302  FwChanIdType _id;
1303 
1304  _id = this->getIdBase() + CHANNELID_CPU_15;
1305 
1306  this->m_Tlm_OutputPort[0].invoke(
1307  _id,
1308  _tlmTime,
1309  _tlmBuff
1310  );
1311  }
1312  }
1313 
1314  // ----------------------------------------------------------------------
1315  // Time
1316  // ----------------------------------------------------------------------
1317 
1319  getTime() const
1320  {
1321  if (this->m_Time_OutputPort[0].isConnected()) {
1322  Fw::Time _time;
1323  this->m_Time_OutputPort[0].invoke(_time);
1324  return _time;
1325  }
1326  else {
1327  return Fw::Time(TimeBase::TB_NONE, 0, 0);
1328  }
1329  }
1330 
1331  // ----------------------------------------------------------------------
1332  // Mutex operations for guarded ports
1333  //
1334  // You can override these operations to provide more sophisticated
1335  // synchronization
1336  // ----------------------------------------------------------------------
1337 
1340  {
1341  this->m_guardedPortMutex.lock();
1342  }
1343 
1346  {
1347  this->m_guardedPortMutex.unLock();
1348  }
1349 
1350  // ----------------------------------------------------------------------
1351  // Calls for messages received on special input ports
1352  // ----------------------------------------------------------------------
1353 
1354  void SystemResourcesComponentBase ::
1355  m_p_CmdDisp_in(
1356  Fw::PassiveComponentBase* callComp,
1357  FwIndexType portNum,
1358  FwOpcodeType opCode,
1359  U32 cmdSeq,
1360  Fw::CmdArgBuffer& args
1361  )
1362  {
1363  FW_ASSERT(callComp);
1364  SystemResourcesComponentBase* compPtr = static_cast<SystemResourcesComponentBase*>(callComp);
1365 
1366  const U32 idBase = callComp->getIdBase();
1367  FW_ASSERT(opCode >= idBase, static_cast<FwAssertArgType>(opCode), static_cast<FwAssertArgType>(idBase));
1368 
1369  // Select base class function based on opcode
1370  switch (opCode - idBase) {
1371  case OPCODE_ENABLE: {
1372  compPtr->ENABLE_cmdHandlerBase(
1373  opCode,
1374  cmdSeq,
1375  args
1376  );
1377  break;
1378  }
1379  }
1380  }
1381 
1382  // ----------------------------------------------------------------------
1383  // Calls for messages received on typed input ports
1384  // ----------------------------------------------------------------------
1385 
1386  void SystemResourcesComponentBase ::
1387  m_p_run_in(
1388  Fw::PassiveComponentBase* callComp,
1389  FwIndexType portNum,
1390  U32 context
1391  )
1392  {
1393  FW_ASSERT(callComp);
1394  SystemResourcesComponentBase* compPtr = static_cast<SystemResourcesComponentBase*>(callComp);
1395  compPtr->run_handlerBase(
1396  portNum,
1397  context
1398  );
1399  }
1400 
1401 }
void set_CmdStatus_OutputPort(FwIndexType portNum, Fw::InputCmdResponsePort *port)
Connect port to CmdStatus[portNum].
Serialization/Deserialization operation was successful.
void addCallPort(InputTimePort *callPort)
Register an input port.
Definition: TimePortAc.cpp:134
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
SerializeStatus serializeFrom(U8 val, Endianness mode=Endianness::BIG) override
Serialize an 8-bit unsigned integer value.
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
void init()
Initialization function.
Definition: SchedPortAc.cpp:56
static constexpr FwIndexType getNum_CmdStatus_OutputPorts()
void init()
Initialization function.
Definition: CmdPortAc.cpp:56
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 unLock()
unlock the mutex and assert success
Definition: Mutex.cpp:41
void tlmWrite_CPU_09(F32 arg, Fw::Time _tlmTime=Fw::Time()) const
const Time ZERO_TIME
Definition: Time.cpp:5
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
void init()
Initialization function.
Definition: TlmPortAc.cpp:144
Enum representing a command response.
No time base has been established (Required)
void addCallPort(InputCmdRegPort *callPort)
Register an input port.
Fw::InputCmdPort * get_CmdDisp_InputPort(FwIndexType portNum)
void tlmWrite_CPU_10(F32 arg, Fw::Time _tlmTime=Fw::Time()) const
void addCallPort(InputTlmPort *callPort)
Register an input port.
Definition: TlmPortAc.cpp:150
void init()
Object initializer.
Definition: ObjBase.cpp:24
SerializeStatus
forward declaration for string
void addCallComp(Fw::PassiveComponentBase *callComp, CompFuncPtr funcPtr)
Register a component.
Definition: CmdPortAc.cpp:62
float F32
32-bit floating point
Definition: BasicTypes.h:83
SystemResourcesComponentBase(const char *compName="")
Construct SystemResourcesComponentBase object.
bool isConnected_Tlm_OutputPort(FwIndexType portNum)
void invoke(FwOpcodeType opCode) const
Invoke a port interface.
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 init()
Initialization function.
Definition: TimePortAc.cpp:128
Svc::InputSchedPort * get_run_InputPort(FwIndexType portNum)
static constexpr FwIndexType getNum_CmdDisp_InputPorts()
void invoke(Fw::Time &time) const
Invoke a port interface.
Definition: TimePortAc.cpp:147
Serializable::SizeType getDeserializeSizeLeft() const override
Get remaining deserialization buffer size.
const char * toChar() const
Convert to a C-style char*.
Definition: ObjectName.hpp:50
void invoke(FwOpcodeType opCode, U32 cmdSeq, const Fw::CmdResponse &response) const
Invoke a port interface.
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.
void resetDeser() override
Reset deserialization pointer to beginning of buffer.
void tlmWrite_CPU_14(F32 arg, Fw::Time _tlmTime=Fw::Time()) const
static constexpr FwIndexType getNum_Tlm_OutputPorts()
void invoke(FwChanIdType id, Fw::Time &timeTag, Fw::TlmBuffer &val) const
Invoke a port interface.
Definition: TlmPortAc.cpp:163
bool isConnected() const
Definition: PortBase.cpp:38
static constexpr FwIndexType getNum_run_InputPorts()
#define PRI_FwIndexType
FormatStatus format(const CHAR *formatString,...)
write formatted string to buffer
Definition: StringBase.cpp:39
void init()
Initialization function.
Definition: LogPortAc.cpp:151
A command to enable or disable system resource telemetry.
void setPortNum(FwIndexType portNum)
Command failed to deserialize.
void tlmWrite_CPU_15(F32 arg, Fw::Time _tlmTime=Fw::Time()) const
void addCallComp(Fw::PassiveComponentBase *callComp, CompFuncPtr funcPtr)
Register a component.
Definition: SchedPortAc.cpp:62
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 addCallPort(InputLogPort *callPort)
Register an input port.
Definition: LogPortAc.cpp:157
void init()
Initialization function.
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.
SerializeStatus deserializeTo(U8 &val, Endianness mode=Endianness::BIG) override
Deserialize an 8-bit unsigned integer value.
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
Implementation of malloc based allocator.
void tlmWrite_CPU_03(F32 arg, Fw::Time _tlmTime=Fw::Time()) const
void init()
Initialization function.
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.
#define FW_ASSERT(...)
Definition: Assert.hpp:14
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 addCallPort(InputCmdResponsePort *callPort)
Register an input port.
void lock()
lock the mutex and assert success
Definition: Mutex.cpp:34
void set_Time_OutputPort(FwIndexType portNum, Fw::InputTimePort *port)
Connect port to Time[portNum].
#define U64(C)
Definition: sha.h:181