F´ Flight Software - C/C++ Documentation
A framework for building embedded system applications to NASA flight quality standards.
Loading...
Searching...
No Matches
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
8#include "Fw/Types/Assert.hpp"
10#if FW_ENABLE_TEXT_LOGGING
11#include "Fw/Types/String.hpp"
12#endif
13
14namespace Svc {
15
16 // ----------------------------------------------------------------------
17 // Component initialization
18 // ----------------------------------------------------------------------
19
20 void SystemResourcesComponentBase ::
21 init(FwEnumStoreType instance)
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_PlatformIntType "]",
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_PlatformIntType "]",
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_PlatformIntType "]",
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_PlatformIntType "]",
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_PlatformIntType "]",
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_PlatformIntType "]",
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_PlatformIntType "]",
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_PlatformIntType "]",
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
195 Fw::InputCmdPort* SystemResourcesComponentBase ::
196 get_CmdDisp_InputPort(FwIndexType portNum)
197 {
198 FW_ASSERT(
199 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
210 Svc::InputSchedPort* SystemResourcesComponentBase ::
211 get_run_InputPort(FwIndexType portNum)
212 {
213 FW_ASSERT(
214 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
225 void SystemResourcesComponentBase ::
226 set_CmdReg_OutputPort(
227 FwIndexType portNum,
229 )
230 {
231 FW_ASSERT(
232 portNum < this->getNum_CmdReg_OutputPorts(),
233 static_cast<FwAssertArgType>(portNum)
234 );
235
236 this->m_CmdReg_OutputPort[portNum].addCallPort(port);
237 }
238
239 void SystemResourcesComponentBase ::
240 set_CmdStatus_OutputPort(
241 FwIndexType portNum,
243 )
244 {
245 FW_ASSERT(
246 portNum < this->getNum_CmdStatus_OutputPorts(),
247 static_cast<FwAssertArgType>(portNum)
248 );
249
250 this->m_CmdStatus_OutputPort[portNum].addCallPort(port);
251 }
252
253 void SystemResourcesComponentBase ::
254 set_Log_OutputPort(
255 FwIndexType portNum,
256 Fw::InputLogPort* port
257 )
258 {
259 FW_ASSERT(
260 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 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
285 void SystemResourcesComponentBase ::
286 set_Time_OutputPort(
287 FwIndexType portNum,
289 )
290 {
291 FW_ASSERT(
292 portNum < this->getNum_Time_OutputPorts(),
293 static_cast<FwAssertArgType>(portNum)
294 );
295
296 this->m_Time_OutputPort[portNum].addCallPort(port);
297 }
298
299 void SystemResourcesComponentBase ::
300 set_Tlm_OutputPort(
301 FwIndexType portNum,
302 Fw::InputTlmPort* port
303 )
304 {
305 FW_ASSERT(
306 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
319 void SystemResourcesComponentBase ::
320 set_CmdReg_OutputPort(
321 FwIndexType portNum,
322 Fw::InputSerializePort* port
323 )
324 {
325 FW_ASSERT(
326 portNum < this->getNum_CmdReg_OutputPorts(),
327 static_cast<FwAssertArgType>(portNum)
328 );
329
330 this->m_CmdReg_OutputPort[portNum].registerSerialPort(port);
331 }
332
333 void SystemResourcesComponentBase ::
334 set_CmdStatus_OutputPort(
335 FwIndexType portNum,
336 Fw::InputSerializePort* port
337 )
338 {
339 FW_ASSERT(
340 portNum < this->getNum_CmdStatus_OutputPorts(),
341 static_cast<FwAssertArgType>(portNum)
342 );
343
344 this->m_CmdStatus_OutputPort[portNum].registerSerialPort(port);
345 }
346
347 void SystemResourcesComponentBase ::
348 set_Log_OutputPort(
349 FwIndexType portNum,
350 Fw::InputSerializePort* port
351 )
352 {
353 FW_ASSERT(
354 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 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
379 void SystemResourcesComponentBase ::
380 set_Time_OutputPort(
381 FwIndexType portNum,
382 Fw::InputSerializePort* port
383 )
384 {
385 FW_ASSERT(
386 portNum < this->getNum_Time_OutputPorts(),
387 static_cast<FwAssertArgType>(portNum)
388 );
389
390 this->m_Time_OutputPort[portNum].registerSerialPort(port);
391 }
392
393 void SystemResourcesComponentBase ::
394 set_Tlm_OutputPort(
395 FwIndexType portNum,
396 Fw::InputSerializePort* port
397 )
398 {
399 FW_ASSERT(
400 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
413 void SystemResourcesComponentBase ::
414 regCommands()
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
427 SystemResourcesComponentBase ::
428 SystemResourcesComponentBase(const char* compName) :
429 Fw::PassiveComponentBase(compName)
430 {
431
432 }
433
434 SystemResourcesComponentBase ::
435 ~SystemResourcesComponentBase()
436 {
437
438 }
439
440 // ----------------------------------------------------------------------
441 // Getters for numbers of special input ports
442 // ----------------------------------------------------------------------
443
444 FwIndexType SystemResourcesComponentBase ::
445 getNum_CmdDisp_InputPorts() const
446 {
447 return static_cast<FwIndexType>(FW_NUM_ARRAY_ELEMENTS(this->m_CmdDisp_InputPort));
448 }
449
450 // ----------------------------------------------------------------------
451 // Getters for numbers of typed input ports
452 // ----------------------------------------------------------------------
453
454 FwIndexType SystemResourcesComponentBase ::
455 getNum_run_InputPorts() const
456 {
457 return static_cast<FwIndexType>(FW_NUM_ARRAY_ELEMENTS(this->m_run_InputPort));
458 }
459
460 // ----------------------------------------------------------------------
461 // Getters for numbers of special output ports
462 // ----------------------------------------------------------------------
463
464 FwIndexType SystemResourcesComponentBase ::
465 getNum_CmdReg_OutputPorts() const
466 {
467 return static_cast<FwIndexType>(FW_NUM_ARRAY_ELEMENTS(this->m_CmdReg_OutputPort));
468 }
469
470 FwIndexType SystemResourcesComponentBase ::
471 getNum_CmdStatus_OutputPorts() const
472 {
473 return static_cast<FwIndexType>(FW_NUM_ARRAY_ELEMENTS(this->m_CmdStatus_OutputPort));
474 }
475
476 FwIndexType SystemResourcesComponentBase ::
477 getNum_Log_OutputPorts() const
478 {
479 return static_cast<FwIndexType>(FW_NUM_ARRAY_ELEMENTS(this->m_Log_OutputPort));
480 }
481
482#if FW_ENABLE_TEXT_LOGGING == 1
483
484 FwIndexType SystemResourcesComponentBase ::
485 getNum_LogText_OutputPorts() const
486 {
487 return static_cast<FwIndexType>(FW_NUM_ARRAY_ELEMENTS(this->m_LogText_OutputPort));
488 }
489
490#endif
491
492 FwIndexType SystemResourcesComponentBase ::
493 getNum_Time_OutputPorts() const
494 {
495 return static_cast<FwIndexType>(FW_NUM_ARRAY_ELEMENTS(this->m_Time_OutputPort));
496 }
497
498 FwIndexType SystemResourcesComponentBase ::
499 getNum_Tlm_OutputPorts() const
500 {
501 return static_cast<FwIndexType>(FW_NUM_ARRAY_ELEMENTS(this->m_Tlm_OutputPort));
502 }
503
504 // ----------------------------------------------------------------------
505 // Connection status queries for special output ports
506 // ----------------------------------------------------------------------
507
508 bool SystemResourcesComponentBase ::
509 isConnected_CmdReg_OutputPort(FwIndexType portNum)
510 {
511 FW_ASSERT(
512 portNum < this->getNum_CmdReg_OutputPorts(),
513 static_cast<FwAssertArgType>(portNum)
514 );
515
516 return this->m_CmdReg_OutputPort[portNum].isConnected();
517 }
518
519 bool SystemResourcesComponentBase ::
520 isConnected_CmdStatus_OutputPort(FwIndexType portNum)
521 {
522 FW_ASSERT(
523 portNum < this->getNum_CmdStatus_OutputPorts(),
524 static_cast<FwAssertArgType>(portNum)
525 );
526
527 return this->m_CmdStatus_OutputPort[portNum].isConnected();
528 }
529
530 bool SystemResourcesComponentBase ::
531 isConnected_Log_OutputPort(FwIndexType portNum)
532 {
533 FW_ASSERT(
534 portNum < this->getNum_Log_OutputPorts(),
535 static_cast<FwAssertArgType>(portNum)
536 );
537
538 return this->m_Log_OutputPort[portNum].isConnected();
539 }
540
541#if FW_ENABLE_TEXT_LOGGING == 1
542
543 bool SystemResourcesComponentBase ::
544 isConnected_LogText_OutputPort(FwIndexType portNum)
545 {
546 FW_ASSERT(
547 portNum < this->getNum_LogText_OutputPorts(),
548 static_cast<FwAssertArgType>(portNum)
549 );
550
551 return this->m_LogText_OutputPort[portNum].isConnected();
552 }
553
554#endif
555
556 bool SystemResourcesComponentBase ::
557 isConnected_Time_OutputPort(FwIndexType portNum)
558 {
559 FW_ASSERT(
560 portNum < this->getNum_Time_OutputPorts(),
561 static_cast<FwAssertArgType>(portNum)
562 );
563
564 return this->m_Time_OutputPort[portNum].isConnected();
565 }
566
567 bool SystemResourcesComponentBase ::
568 isConnected_Tlm_OutputPort(FwIndexType portNum)
569 {
570 FW_ASSERT(
571 portNum < this->getNum_Tlm_OutputPorts(),
572 static_cast<FwAssertArgType>(portNum)
573 );
574
575 return this->m_Tlm_OutputPort[portNum].isConnected();
576 }
577
578 // ----------------------------------------------------------------------
579 // Port handler base-class functions for typed input ports
580 //
581 // Call these functions directly to bypass the corresponding ports
582 // ----------------------------------------------------------------------
583
584 void SystemResourcesComponentBase ::
585 run_handlerBase(
586 FwIndexType portNum,
587 U32 context
588 )
589 {
590 // Make sure port number is valid
591 FW_ASSERT(
592 portNum < this->getNum_run_InputPorts(),
593 static_cast<FwAssertArgType>(portNum)
594 );
595
596 // Lock guard mutex before calling
597 this->lock();
598
599 // Call handler function
600 this->run_handler(
601 portNum,
602 context
603 );
604
605 // Unlock guard mutex
606 this->unLock();
607 }
608
609 // ----------------------------------------------------------------------
610 // Command response
611 // ----------------------------------------------------------------------
612
613 void SystemResourcesComponentBase ::
614 cmdResponse_out(
615 FwOpcodeType opCode,
616 U32 cmdSeq,
617 Fw::CmdResponse response
618 )
619 {
620 FW_ASSERT(this->m_CmdStatus_OutputPort[0].isConnected());
621 this->m_CmdStatus_OutputPort[0].invoke(opCode, cmdSeq, response);
622 }
623
624 // ----------------------------------------------------------------------
625 // Command handler base-class functions
626 //
627 // Call these functions directly to bypass the command input port
628 // ----------------------------------------------------------------------
629
630 void SystemResourcesComponentBase ::
631 ENABLE_cmdHandlerBase(
632 FwOpcodeType opCode,
633 U32 cmdSeq,
634 Fw::CmdArgBuffer& args
635 )
636 {
637 // Deserialize the arguments
639
640 // Reset the buffer
641 args.resetDeser();
642
644 _status = args.deserialize(enable);
645 if (_status != Fw::FW_SERIALIZE_OK) {
646 if (this->m_CmdStatus_OutputPort[0].isConnected()) {
647 this->m_CmdStatus_OutputPort[0].invoke(
648 opCode,
649 cmdSeq,
651 );
652 }
653 return;
654 }
655
656#if FW_CMD_CHECK_RESIDUAL
657 // Make sure there was no data left over.
658 // That means the argument buffer size was incorrect.
659 if (args.getBuffLeft() != 0) {
660 if (this->m_CmdStatus_OutputPort[0].isConnected()) {
661 this->m_CmdStatus_OutputPort[0].invoke(
662 opCode,
663 cmdSeq,
665 );
666 }
667 return;
668 }
669#endif
670
671 this->lock();
672
673 this->ENABLE_cmdHandler(
674 opCode, cmdSeq,
675 enable
676 );
677
678 this->unLock();
679 }
680
681 // ----------------------------------------------------------------------
682 // Telemetry write functions
683 // ----------------------------------------------------------------------
684
685 void SystemResourcesComponentBase ::
686 tlmWrite_MEMORY_TOTAL(
687 U64 arg,
688 Fw::Time _tlmTime
689 ) const
690 {
691 if (this->m_Tlm_OutputPort[0].isConnected()) {
692 if (
693 this->m_Time_OutputPort[0].isConnected() &&
694 (_tlmTime == Fw::ZERO_TIME)
695 ) {
696 this->m_Time_OutputPort[0].invoke(_tlmTime);
697 }
698
699 Fw::TlmBuffer _tlmBuff;
700 Fw::SerializeStatus _stat = _tlmBuff.serialize(arg);
701 FW_ASSERT(
702 _stat == Fw::FW_SERIALIZE_OK,
703 static_cast<FwAssertArgType>(_stat)
704 );
705
706 FwChanIdType _id;
707
708 _id = this->getIdBase() + CHANNELID_MEMORY_TOTAL;
709
710 this->m_Tlm_OutputPort[0].invoke(
711 _id,
712 _tlmTime,
713 _tlmBuff
714 );
715 }
716 }
717
718 void SystemResourcesComponentBase ::
719 tlmWrite_MEMORY_USED(
720 U64 arg,
721 Fw::Time _tlmTime
722 ) const
723 {
724 if (this->m_Tlm_OutputPort[0].isConnected()) {
725 if (
726 this->m_Time_OutputPort[0].isConnected() &&
727 (_tlmTime == Fw::ZERO_TIME)
728 ) {
729 this->m_Time_OutputPort[0].invoke(_tlmTime);
730 }
731
732 Fw::TlmBuffer _tlmBuff;
733 Fw::SerializeStatus _stat = _tlmBuff.serialize(arg);
734 FW_ASSERT(
735 _stat == Fw::FW_SERIALIZE_OK,
736 static_cast<FwAssertArgType>(_stat)
737 );
738
739 FwChanIdType _id;
740
741 _id = this->getIdBase() + CHANNELID_MEMORY_USED;
742
743 this->m_Tlm_OutputPort[0].invoke(
744 _id,
745 _tlmTime,
746 _tlmBuff
747 );
748 }
749 }
750
751 void SystemResourcesComponentBase ::
752 tlmWrite_NON_VOLATILE_TOTAL(
753 U64 arg,
754 Fw::Time _tlmTime
755 ) const
756 {
757 if (this->m_Tlm_OutputPort[0].isConnected()) {
758 if (
759 this->m_Time_OutputPort[0].isConnected() &&
760 (_tlmTime == Fw::ZERO_TIME)
761 ) {
762 this->m_Time_OutputPort[0].invoke(_tlmTime);
763 }
764
765 Fw::TlmBuffer _tlmBuff;
766 Fw::SerializeStatus _stat = _tlmBuff.serialize(arg);
767 FW_ASSERT(
768 _stat == Fw::FW_SERIALIZE_OK,
769 static_cast<FwAssertArgType>(_stat)
770 );
771
772 FwChanIdType _id;
773
774 _id = this->getIdBase() + CHANNELID_NON_VOLATILE_TOTAL;
775
776 this->m_Tlm_OutputPort[0].invoke(
777 _id,
778 _tlmTime,
779 _tlmBuff
780 );
781 }
782 }
783
784 void SystemResourcesComponentBase ::
785 tlmWrite_NON_VOLATILE_FREE(
786 U64 arg,
787 Fw::Time _tlmTime
788 ) const
789 {
790 if (this->m_Tlm_OutputPort[0].isConnected()) {
791 if (
792 this->m_Time_OutputPort[0].isConnected() &&
793 (_tlmTime == Fw::ZERO_TIME)
794 ) {
795 this->m_Time_OutputPort[0].invoke(_tlmTime);
796 }
797
798 Fw::TlmBuffer _tlmBuff;
799 Fw::SerializeStatus _stat = _tlmBuff.serialize(arg);
800 FW_ASSERT(
801 _stat == Fw::FW_SERIALIZE_OK,
802 static_cast<FwAssertArgType>(_stat)
803 );
804
805 FwChanIdType _id;
806
807 _id = this->getIdBase() + CHANNELID_NON_VOLATILE_FREE;
808
809 this->m_Tlm_OutputPort[0].invoke(
810 _id,
811 _tlmTime,
812 _tlmBuff
813 );
814 }
815 }
816
817 void SystemResourcesComponentBase ::
818 tlmWrite_CPU(
819 F32 arg,
820 Fw::Time _tlmTime
821 ) const
822 {
823 if (this->m_Tlm_OutputPort[0].isConnected()) {
824 if (
825 this->m_Time_OutputPort[0].isConnected() &&
826 (_tlmTime == Fw::ZERO_TIME)
827 ) {
828 this->m_Time_OutputPort[0].invoke(_tlmTime);
829 }
830
831 Fw::TlmBuffer _tlmBuff;
832 Fw::SerializeStatus _stat = _tlmBuff.serialize(arg);
833 FW_ASSERT(
834 _stat == Fw::FW_SERIALIZE_OK,
835 static_cast<FwAssertArgType>(_stat)
836 );
837
838 FwChanIdType _id;
839
840 _id = this->getIdBase() + CHANNELID_CPU;
841
842 this->m_Tlm_OutputPort[0].invoke(
843 _id,
844 _tlmTime,
845 _tlmBuff
846 );
847 }
848 }
849
850 void SystemResourcesComponentBase ::
851 tlmWrite_CPU_00(
852 F32 arg,
853 Fw::Time _tlmTime
854 ) const
855 {
856 if (this->m_Tlm_OutputPort[0].isConnected()) {
857 if (
858 this->m_Time_OutputPort[0].isConnected() &&
859 (_tlmTime == Fw::ZERO_TIME)
860 ) {
861 this->m_Time_OutputPort[0].invoke(_tlmTime);
862 }
863
864 Fw::TlmBuffer _tlmBuff;
865 Fw::SerializeStatus _stat = _tlmBuff.serialize(arg);
866 FW_ASSERT(
867 _stat == Fw::FW_SERIALIZE_OK,
868 static_cast<FwAssertArgType>(_stat)
869 );
870
871 FwChanIdType _id;
872
873 _id = this->getIdBase() + CHANNELID_CPU_00;
874
875 this->m_Tlm_OutputPort[0].invoke(
876 _id,
877 _tlmTime,
878 _tlmBuff
879 );
880 }
881 }
882
883 void SystemResourcesComponentBase ::
884 tlmWrite_CPU_01(
885 F32 arg,
886 Fw::Time _tlmTime
887 ) const
888 {
889 if (this->m_Tlm_OutputPort[0].isConnected()) {
890 if (
891 this->m_Time_OutputPort[0].isConnected() &&
892 (_tlmTime == Fw::ZERO_TIME)
893 ) {
894 this->m_Time_OutputPort[0].invoke(_tlmTime);
895 }
896
897 Fw::TlmBuffer _tlmBuff;
898 Fw::SerializeStatus _stat = _tlmBuff.serialize(arg);
899 FW_ASSERT(
900 _stat == Fw::FW_SERIALIZE_OK,
901 static_cast<FwAssertArgType>(_stat)
902 );
903
904 FwChanIdType _id;
905
906 _id = this->getIdBase() + CHANNELID_CPU_01;
907
908 this->m_Tlm_OutputPort[0].invoke(
909 _id,
910 _tlmTime,
911 _tlmBuff
912 );
913 }
914 }
915
916 void SystemResourcesComponentBase ::
917 tlmWrite_CPU_02(
918 F32 arg,
919 Fw::Time _tlmTime
920 ) const
921 {
922 if (this->m_Tlm_OutputPort[0].isConnected()) {
923 if (
924 this->m_Time_OutputPort[0].isConnected() &&
925 (_tlmTime == Fw::ZERO_TIME)
926 ) {
927 this->m_Time_OutputPort[0].invoke(_tlmTime);
928 }
929
930 Fw::TlmBuffer _tlmBuff;
931 Fw::SerializeStatus _stat = _tlmBuff.serialize(arg);
932 FW_ASSERT(
933 _stat == Fw::FW_SERIALIZE_OK,
934 static_cast<FwAssertArgType>(_stat)
935 );
936
937 FwChanIdType _id;
938
939 _id = this->getIdBase() + CHANNELID_CPU_02;
940
941 this->m_Tlm_OutputPort[0].invoke(
942 _id,
943 _tlmTime,
944 _tlmBuff
945 );
946 }
947 }
948
949 void SystemResourcesComponentBase ::
950 tlmWrite_CPU_03(
951 F32 arg,
952 Fw::Time _tlmTime
953 ) const
954 {
955 if (this->m_Tlm_OutputPort[0].isConnected()) {
956 if (
957 this->m_Time_OutputPort[0].isConnected() &&
958 (_tlmTime == Fw::ZERO_TIME)
959 ) {
960 this->m_Time_OutputPort[0].invoke(_tlmTime);
961 }
962
963 Fw::TlmBuffer _tlmBuff;
964 Fw::SerializeStatus _stat = _tlmBuff.serialize(arg);
965 FW_ASSERT(
966 _stat == Fw::FW_SERIALIZE_OK,
967 static_cast<FwAssertArgType>(_stat)
968 );
969
970 FwChanIdType _id;
971
972 _id = this->getIdBase() + CHANNELID_CPU_03;
973
974 this->m_Tlm_OutputPort[0].invoke(
975 _id,
976 _tlmTime,
977 _tlmBuff
978 );
979 }
980 }
981
982 void SystemResourcesComponentBase ::
983 tlmWrite_CPU_04(
984 F32 arg,
985 Fw::Time _tlmTime
986 ) const
987 {
988 if (this->m_Tlm_OutputPort[0].isConnected()) {
989 if (
990 this->m_Time_OutputPort[0].isConnected() &&
991 (_tlmTime == Fw::ZERO_TIME)
992 ) {
993 this->m_Time_OutputPort[0].invoke(_tlmTime);
994 }
995
996 Fw::TlmBuffer _tlmBuff;
997 Fw::SerializeStatus _stat = _tlmBuff.serialize(arg);
998 FW_ASSERT(
999 _stat == Fw::FW_SERIALIZE_OK,
1000 static_cast<FwAssertArgType>(_stat)
1001 );
1002
1003 FwChanIdType _id;
1004
1005 _id = this->getIdBase() + CHANNELID_CPU_04;
1006
1007 this->m_Tlm_OutputPort[0].invoke(
1008 _id,
1009 _tlmTime,
1010 _tlmBuff
1011 );
1012 }
1013 }
1014
1015 void SystemResourcesComponentBase ::
1016 tlmWrite_CPU_05(
1017 F32 arg,
1018 Fw::Time _tlmTime
1019 ) const
1020 {
1021 if (this->m_Tlm_OutputPort[0].isConnected()) {
1022 if (
1023 this->m_Time_OutputPort[0].isConnected() &&
1024 (_tlmTime == Fw::ZERO_TIME)
1025 ) {
1026 this->m_Time_OutputPort[0].invoke(_tlmTime);
1027 }
1028
1029 Fw::TlmBuffer _tlmBuff;
1030 Fw::SerializeStatus _stat = _tlmBuff.serialize(arg);
1031 FW_ASSERT(
1032 _stat == Fw::FW_SERIALIZE_OK,
1033 static_cast<FwAssertArgType>(_stat)
1034 );
1035
1036 FwChanIdType _id;
1037
1038 _id = this->getIdBase() + CHANNELID_CPU_05;
1039
1040 this->m_Tlm_OutputPort[0].invoke(
1041 _id,
1042 _tlmTime,
1043 _tlmBuff
1044 );
1045 }
1046 }
1047
1048 void SystemResourcesComponentBase ::
1049 tlmWrite_CPU_06(
1050 F32 arg,
1051 Fw::Time _tlmTime
1052 ) const
1053 {
1054 if (this->m_Tlm_OutputPort[0].isConnected()) {
1055 if (
1056 this->m_Time_OutputPort[0].isConnected() &&
1057 (_tlmTime == Fw::ZERO_TIME)
1058 ) {
1059 this->m_Time_OutputPort[0].invoke(_tlmTime);
1060 }
1061
1062 Fw::TlmBuffer _tlmBuff;
1063 Fw::SerializeStatus _stat = _tlmBuff.serialize(arg);
1064 FW_ASSERT(
1065 _stat == Fw::FW_SERIALIZE_OK,
1066 static_cast<FwAssertArgType>(_stat)
1067 );
1068
1069 FwChanIdType _id;
1070
1071 _id = this->getIdBase() + CHANNELID_CPU_06;
1072
1073 this->m_Tlm_OutputPort[0].invoke(
1074 _id,
1075 _tlmTime,
1076 _tlmBuff
1077 );
1078 }
1079 }
1080
1081 void SystemResourcesComponentBase ::
1082 tlmWrite_CPU_07(
1083 F32 arg,
1084 Fw::Time _tlmTime
1085 ) const
1086 {
1087 if (this->m_Tlm_OutputPort[0].isConnected()) {
1088 if (
1089 this->m_Time_OutputPort[0].isConnected() &&
1090 (_tlmTime == Fw::ZERO_TIME)
1091 ) {
1092 this->m_Time_OutputPort[0].invoke(_tlmTime);
1093 }
1094
1095 Fw::TlmBuffer _tlmBuff;
1096 Fw::SerializeStatus _stat = _tlmBuff.serialize(arg);
1097 FW_ASSERT(
1098 _stat == Fw::FW_SERIALIZE_OK,
1099 static_cast<FwAssertArgType>(_stat)
1100 );
1101
1102 FwChanIdType _id;
1103
1104 _id = this->getIdBase() + CHANNELID_CPU_07;
1105
1106 this->m_Tlm_OutputPort[0].invoke(
1107 _id,
1108 _tlmTime,
1109 _tlmBuff
1110 );
1111 }
1112 }
1113
1114 void SystemResourcesComponentBase ::
1115 tlmWrite_CPU_08(
1116 F32 arg,
1117 Fw::Time _tlmTime
1118 ) const
1119 {
1120 if (this->m_Tlm_OutputPort[0].isConnected()) {
1121 if (
1122 this->m_Time_OutputPort[0].isConnected() &&
1123 (_tlmTime == Fw::ZERO_TIME)
1124 ) {
1125 this->m_Time_OutputPort[0].invoke(_tlmTime);
1126 }
1127
1128 Fw::TlmBuffer _tlmBuff;
1129 Fw::SerializeStatus _stat = _tlmBuff.serialize(arg);
1130 FW_ASSERT(
1131 _stat == Fw::FW_SERIALIZE_OK,
1132 static_cast<FwAssertArgType>(_stat)
1133 );
1134
1135 FwChanIdType _id;
1136
1137 _id = this->getIdBase() + CHANNELID_CPU_08;
1138
1139 this->m_Tlm_OutputPort[0].invoke(
1140 _id,
1141 _tlmTime,
1142 _tlmBuff
1143 );
1144 }
1145 }
1146
1147 void SystemResourcesComponentBase ::
1148 tlmWrite_CPU_09(
1149 F32 arg,
1150 Fw::Time _tlmTime
1151 ) const
1152 {
1153 if (this->m_Tlm_OutputPort[0].isConnected()) {
1154 if (
1155 this->m_Time_OutputPort[0].isConnected() &&
1156 (_tlmTime == Fw::ZERO_TIME)
1157 ) {
1158 this->m_Time_OutputPort[0].invoke(_tlmTime);
1159 }
1160
1161 Fw::TlmBuffer _tlmBuff;
1162 Fw::SerializeStatus _stat = _tlmBuff.serialize(arg);
1163 FW_ASSERT(
1164 _stat == Fw::FW_SERIALIZE_OK,
1165 static_cast<FwAssertArgType>(_stat)
1166 );
1167
1168 FwChanIdType _id;
1169
1170 _id = this->getIdBase() + CHANNELID_CPU_09;
1171
1172 this->m_Tlm_OutputPort[0].invoke(
1173 _id,
1174 _tlmTime,
1175 _tlmBuff
1176 );
1177 }
1178 }
1179
1180 void SystemResourcesComponentBase ::
1181 tlmWrite_CPU_10(
1182 F32 arg,
1183 Fw::Time _tlmTime
1184 ) const
1185 {
1186 if (this->m_Tlm_OutputPort[0].isConnected()) {
1187 if (
1188 this->m_Time_OutputPort[0].isConnected() &&
1189 (_tlmTime == Fw::ZERO_TIME)
1190 ) {
1191 this->m_Time_OutputPort[0].invoke(_tlmTime);
1192 }
1193
1194 Fw::TlmBuffer _tlmBuff;
1195 Fw::SerializeStatus _stat = _tlmBuff.serialize(arg);
1196 FW_ASSERT(
1197 _stat == Fw::FW_SERIALIZE_OK,
1198 static_cast<FwAssertArgType>(_stat)
1199 );
1200
1201 FwChanIdType _id;
1202
1203 _id = this->getIdBase() + CHANNELID_CPU_10;
1204
1205 this->m_Tlm_OutputPort[0].invoke(
1206 _id,
1207 _tlmTime,
1208 _tlmBuff
1209 );
1210 }
1211 }
1212
1213 void SystemResourcesComponentBase ::
1214 tlmWrite_CPU_11(
1215 F32 arg,
1216 Fw::Time _tlmTime
1217 ) const
1218 {
1219 if (this->m_Tlm_OutputPort[0].isConnected()) {
1220 if (
1221 this->m_Time_OutputPort[0].isConnected() &&
1222 (_tlmTime == Fw::ZERO_TIME)
1223 ) {
1224 this->m_Time_OutputPort[0].invoke(_tlmTime);
1225 }
1226
1227 Fw::TlmBuffer _tlmBuff;
1228 Fw::SerializeStatus _stat = _tlmBuff.serialize(arg);
1229 FW_ASSERT(
1230 _stat == Fw::FW_SERIALIZE_OK,
1231 static_cast<FwAssertArgType>(_stat)
1232 );
1233
1234 FwChanIdType _id;
1235
1236 _id = this->getIdBase() + CHANNELID_CPU_11;
1237
1238 this->m_Tlm_OutputPort[0].invoke(
1239 _id,
1240 _tlmTime,
1241 _tlmBuff
1242 );
1243 }
1244 }
1245
1246 void SystemResourcesComponentBase ::
1247 tlmWrite_CPU_12(
1248 F32 arg,
1249 Fw::Time _tlmTime
1250 ) const
1251 {
1252 if (this->m_Tlm_OutputPort[0].isConnected()) {
1253 if (
1254 this->m_Time_OutputPort[0].isConnected() &&
1255 (_tlmTime == Fw::ZERO_TIME)
1256 ) {
1257 this->m_Time_OutputPort[0].invoke(_tlmTime);
1258 }
1259
1260 Fw::TlmBuffer _tlmBuff;
1261 Fw::SerializeStatus _stat = _tlmBuff.serialize(arg);
1262 FW_ASSERT(
1263 _stat == Fw::FW_SERIALIZE_OK,
1264 static_cast<FwAssertArgType>(_stat)
1265 );
1266
1267 FwChanIdType _id;
1268
1269 _id = this->getIdBase() + CHANNELID_CPU_12;
1270
1271 this->m_Tlm_OutputPort[0].invoke(
1272 _id,
1273 _tlmTime,
1274 _tlmBuff
1275 );
1276 }
1277 }
1278
1279 void SystemResourcesComponentBase ::
1280 tlmWrite_CPU_13(
1281 F32 arg,
1282 Fw::Time _tlmTime
1283 ) const
1284 {
1285 if (this->m_Tlm_OutputPort[0].isConnected()) {
1286 if (
1287 this->m_Time_OutputPort[0].isConnected() &&
1288 (_tlmTime == Fw::ZERO_TIME)
1289 ) {
1290 this->m_Time_OutputPort[0].invoke(_tlmTime);
1291 }
1292
1293 Fw::TlmBuffer _tlmBuff;
1294 Fw::SerializeStatus _stat = _tlmBuff.serialize(arg);
1295 FW_ASSERT(
1296 _stat == Fw::FW_SERIALIZE_OK,
1297 static_cast<FwAssertArgType>(_stat)
1298 );
1299
1300 FwChanIdType _id;
1301
1302 _id = this->getIdBase() + CHANNELID_CPU_13;
1303
1304 this->m_Tlm_OutputPort[0].invoke(
1305 _id,
1306 _tlmTime,
1307 _tlmBuff
1308 );
1309 }
1310 }
1311
1312 void SystemResourcesComponentBase ::
1313 tlmWrite_CPU_14(
1314 F32 arg,
1315 Fw::Time _tlmTime
1316 ) const
1317 {
1318 if (this->m_Tlm_OutputPort[0].isConnected()) {
1319 if (
1320 this->m_Time_OutputPort[0].isConnected() &&
1321 (_tlmTime == Fw::ZERO_TIME)
1322 ) {
1323 this->m_Time_OutputPort[0].invoke(_tlmTime);
1324 }
1325
1326 Fw::TlmBuffer _tlmBuff;
1327 Fw::SerializeStatus _stat = _tlmBuff.serialize(arg);
1328 FW_ASSERT(
1329 _stat == Fw::FW_SERIALIZE_OK,
1330 static_cast<FwAssertArgType>(_stat)
1331 );
1332
1333 FwChanIdType _id;
1334
1335 _id = this->getIdBase() + CHANNELID_CPU_14;
1336
1337 this->m_Tlm_OutputPort[0].invoke(
1338 _id,
1339 _tlmTime,
1340 _tlmBuff
1341 );
1342 }
1343 }
1344
1345 void SystemResourcesComponentBase ::
1346 tlmWrite_CPU_15(
1347 F32 arg,
1348 Fw::Time _tlmTime
1349 ) const
1350 {
1351 if (this->m_Tlm_OutputPort[0].isConnected()) {
1352 if (
1353 this->m_Time_OutputPort[0].isConnected() &&
1354 (_tlmTime == Fw::ZERO_TIME)
1355 ) {
1356 this->m_Time_OutputPort[0].invoke(_tlmTime);
1357 }
1358
1359 Fw::TlmBuffer _tlmBuff;
1360 Fw::SerializeStatus _stat = _tlmBuff.serialize(arg);
1361 FW_ASSERT(
1362 _stat == Fw::FW_SERIALIZE_OK,
1363 static_cast<FwAssertArgType>(_stat)
1364 );
1365
1366 FwChanIdType _id;
1367
1368 _id = this->getIdBase() + CHANNELID_CPU_15;
1369
1370 this->m_Tlm_OutputPort[0].invoke(
1371 _id,
1372 _tlmTime,
1373 _tlmBuff
1374 );
1375 }
1376 }
1377
1378 // ----------------------------------------------------------------------
1379 // Time
1380 // ----------------------------------------------------------------------
1381
1382 Fw::Time SystemResourcesComponentBase ::
1383 getTime()
1384 {
1385 if (this->m_Time_OutputPort[0].isConnected()) {
1386 Fw::Time _time;
1387 this->m_Time_OutputPort[0].invoke(_time);
1388 return _time;
1389 }
1390 else {
1391 return Fw::Time(TB_NONE, 0, 0);
1392 }
1393 }
1394
1395 // ----------------------------------------------------------------------
1396 // Mutex operations for guarded ports
1397 //
1398 // You can override these operations to provide more sophisticated
1399 // synchronization
1400 // ----------------------------------------------------------------------
1401
1402 void SystemResourcesComponentBase ::
1403 lock()
1404 {
1405 this->m_guardedPortMutex.lock();
1406 }
1407
1408 void SystemResourcesComponentBase ::
1409 unLock()
1410 {
1411 this->m_guardedPortMutex.unLock();
1412 }
1413
1414 // ----------------------------------------------------------------------
1415 // Calls for messages received on special input ports
1416 // ----------------------------------------------------------------------
1417
1418 void SystemResourcesComponentBase ::
1419 m_p_CmdDisp_in(
1420 Fw::PassiveComponentBase* callComp,
1421 FwIndexType portNum,
1422 FwOpcodeType opCode,
1423 U32 cmdSeq,
1424 Fw::CmdArgBuffer& args
1425 )
1426 {
1427 FW_ASSERT(callComp);
1428 SystemResourcesComponentBase* compPtr = static_cast<SystemResourcesComponentBase*>(callComp);
1429
1430 const U32 idBase = callComp->getIdBase();
1431 FW_ASSERT(opCode >= idBase, static_cast<FwAssertArgType>(opCode), static_cast<FwAssertArgType>(idBase));
1432
1433 // Select base class function based on opcode
1434 switch (opCode - idBase) {
1435 case OPCODE_ENABLE: {
1436 compPtr->ENABLE_cmdHandlerBase(
1437 opCode,
1438 cmdSeq,
1439 args
1440 );
1441 break;
1442 }
1443 }
1444 }
1445
1446 // ----------------------------------------------------------------------
1447 // Calls for messages received on typed input ports
1448 // ----------------------------------------------------------------------
1449
1450 void SystemResourcesComponentBase ::
1451 m_p_run_in(
1452 Fw::PassiveComponentBase* callComp,
1453 FwIndexType portNum,
1454 U32 context
1455 )
1456 {
1457 FW_ASSERT(callComp);
1458 SystemResourcesComponentBase* compPtr = static_cast<SystemResourcesComponentBase*>(callComp);
1459 compPtr->run_handlerBase(
1460 portNum,
1461 context
1462 );
1463 }
1464
1465}
#define FW_ASSERT(...)
Definition Assert.hpp:14
float F32
32-bit floating point
Definition BasicTypes.h:49
#define FW_NUM_ARRAY_ELEMENTS(a)
number of elements in an array
Definition BasicTypes.h:70
#define PRI_PlatformIntType
@ TB_NONE
No time base has been established.
Definition FpConfig.h:70
I32 FwEnumStoreType
Definition FpConfig.h:64
PlatformAssertArgType FwAssertArgType
Definition FpConfig.h:39
U32 FwChanIdType
Definition FpConfig.h:95
U32 FwOpcodeType
Definition FpConfig.h:91
PlatformIndexType FwIndexType
Definition FpConfig.h:25
Enum representing a command response.
@ FORMAT_ERROR
Command failed to deserialize.
void init()
Object initializer.
Definition ObjBase.cpp:27
const char * toChar() const
void resetDeser()
reset deserialization to beginning
Serializable::SizeType getBuffLeft() const
returns how much deserialization buffer is left
SerializeStatus deserialize(U8 &val)
deserialize 8-bit unsigned int
SerializeStatus serialize(U8 val)
serialize 8-bit unsigned int
void format(const CHAR *formatString,...)
write formatted string to buffer
Auto-generated base for SystemResources component.
void ENABLE_cmdHandlerBase(FwOpcodeType opCode, U32 cmdSeq, Fw::CmdArgBuffer &args)
void run_handlerBase(FwIndexType portNum, U32 context)
Handler base-class function for input port run.
SerializeStatus
forward declaration for string
@ FW_SERIALIZE_OK
Serialization/Deserialization operation was successful.
const Time ZERO_TIME
Definition Time.cpp:5
#define U64(C)
Definition sha.h:176