F´ Flight Software - C/C++ Documentation NASA-v1.6.0
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
7#include <cstdio>
8
10#include "Fw/Types/Assert.hpp"
11#if FW_ENABLE_TEXT_LOGGING
12#include "Fw/Types/String.hpp"
13#endif
14
15namespace Svc {
16
17 namespace {
18 // Get the max size by doing a union of the input and internal port serialization sizes
19 union BuffUnion {
22 };
23
24 // Define a message buffer class large enough to handle all the
25 // asynchronous inputs to the component
26 class ComponentIpcSerializableBuffer :
28 {
29
30 public:
31
32 enum {
33 // Max. message size = size of data + message id + port
34 SERIALIZATION_SIZE =
35 sizeof(BuffUnion) +
36 sizeof(NATIVE_INT_TYPE) +
37 sizeof(NATIVE_INT_TYPE)
38 };
39
40 NATIVE_UINT_TYPE getBuffCapacity() const {
41 return sizeof(m_buff);
42 }
43
44 U8* getBuffAddr() {
45 return m_buff;
46 }
47
48 const U8* getBuffAddr() const {
49 return m_buff;
50 }
51
52 private:
53 // Should be the max of all the input ports serialized sizes...
54 U8 m_buff[SERIALIZATION_SIZE];
55
56 };
57 }
58
59 // ----------------------------------------------------------------------
60 // Component initialization
61 // ----------------------------------------------------------------------
62
63 void SystemResourcesComponentBase ::
64 init(NATIVE_INT_TYPE instance)
65 {
66 // Initialize base class
68
69 // Connect input port CmdDisp
70 for (
71 PlatformIntType port = 0;
72 port < static_cast<PlatformIntType>(this->getNum_CmdDisp_InputPorts());
73 port++
74 ) {
75 this->m_CmdDisp_InputPort[port].init();
76 this->m_CmdDisp_InputPort[port].addCallComp(
77 this,
78 m_p_CmdDisp_in
79 );
80 this->m_CmdDisp_InputPort[port].setPortNum(port);
81
82#if FW_OBJECT_NAMES == 1
83 char portName[120];
84 (void) snprintf(
85 portName,
86 sizeof(portName),
87 "%s_CmdDisp_InputPort[%" PRI_PlatformIntType "]",
88 this->m_objName,
89 port
90 );
91 this->m_CmdDisp_InputPort[port].setObjName(portName);
92#endif
93 }
94
95 // Connect input port run
96 for (
97 PlatformIntType port = 0;
98 port < static_cast<PlatformIntType>(this->getNum_run_InputPorts());
99 port++
100 ) {
101 this->m_run_InputPort[port].init();
102 this->m_run_InputPort[port].addCallComp(
103 this,
104 m_p_run_in
105 );
106 this->m_run_InputPort[port].setPortNum(port);
107
108#if FW_OBJECT_NAMES == 1
109 char portName[120];
110 (void) snprintf(
111 portName,
112 sizeof(portName),
113 "%s_run_InputPort[%" PRI_PlatformIntType "]",
114 this->m_objName,
115 port
116 );
117 this->m_run_InputPort[port].setObjName(portName);
118#endif
119 }
120
121 // Connect output port CmdReg
122 for (
123 PlatformIntType port = 0;
124 port < static_cast<PlatformIntType>(this->getNum_CmdReg_OutputPorts());
125 port++
126 ) {
127 this->m_CmdReg_OutputPort[port].init();
128
129#if FW_OBJECT_NAMES == 1
130 char portName[120];
131 (void) snprintf(
132 portName,
133 sizeof(portName),
134 "%s_CmdReg_OutputPort[%" PRI_PlatformIntType "]",
135 this->m_objName,
136 port
137 );
138 this->m_CmdReg_OutputPort[port].setObjName(portName);
139#endif
140 }
141
142 // Connect output port CmdStatus
143 for (
144 PlatformIntType port = 0;
145 port < static_cast<PlatformIntType>(this->getNum_CmdStatus_OutputPorts());
146 port++
147 ) {
148 this->m_CmdStatus_OutputPort[port].init();
149
150#if FW_OBJECT_NAMES == 1
151 char portName[120];
152 (void) snprintf(
153 portName,
154 sizeof(portName),
155 "%s_CmdStatus_OutputPort[%" PRI_PlatformIntType "]",
156 this->m_objName,
157 port
158 );
159 this->m_CmdStatus_OutputPort[port].setObjName(portName);
160#endif
161 }
162
163 // Connect output port Log
164 for (
165 PlatformIntType port = 0;
166 port < static_cast<PlatformIntType>(this->getNum_Log_OutputPorts());
167 port++
168 ) {
169 this->m_Log_OutputPort[port].init();
170
171#if FW_OBJECT_NAMES == 1
172 char portName[120];
173 (void) snprintf(
174 portName,
175 sizeof(portName),
176 "%s_Log_OutputPort[%" PRI_PlatformIntType "]",
177 this->m_objName,
178 port
179 );
180 this->m_Log_OutputPort[port].setObjName(portName);
181#endif
182 }
183
184#if FW_ENABLE_TEXT_LOGGING == 1
185 // Connect output port LogText
186 for (
187 PlatformIntType port = 0;
188 port < static_cast<PlatformIntType>(this->getNum_LogText_OutputPorts());
189 port++
190 ) {
191 this->m_LogText_OutputPort[port].init();
192
193#if FW_OBJECT_NAMES == 1
194 char portName[120];
195 (void) snprintf(
196 portName,
197 sizeof(portName),
198 "%s_LogText_OutputPort[%" PRI_PlatformIntType "]",
199 this->m_objName,
200 port
201 );
202 this->m_LogText_OutputPort[port].setObjName(portName);
203#endif
204 }
205#endif
206
207 // Connect output port Time
208 for (
209 PlatformIntType port = 0;
210 port < static_cast<PlatformIntType>(this->getNum_Time_OutputPorts());
211 port++
212 ) {
213 this->m_Time_OutputPort[port].init();
214
215#if FW_OBJECT_NAMES == 1
216 char portName[120];
217 (void) snprintf(
218 portName,
219 sizeof(portName),
220 "%s_Time_OutputPort[%" PRI_PlatformIntType "]",
221 this->m_objName,
222 port
223 );
224 this->m_Time_OutputPort[port].setObjName(portName);
225#endif
226 }
227
228 // Connect output port Tlm
229 for (
230 PlatformIntType port = 0;
231 port < static_cast<PlatformIntType>(this->getNum_Tlm_OutputPorts());
232 port++
233 ) {
234 this->m_Tlm_OutputPort[port].init();
235
236#if FW_OBJECT_NAMES == 1
237 char portName[120];
238 (void) snprintf(
239 portName,
240 sizeof(portName),
241 "%s_Tlm_OutputPort[%" PRI_PlatformIntType "]",
242 this->m_objName,
243 port
244 );
245 this->m_Tlm_OutputPort[port].setObjName(portName);
246#endif
247 }
248 }
249
250 // ----------------------------------------------------------------------
251 // Getters for special input ports
252 // ----------------------------------------------------------------------
253
254 Fw::InputCmdPort* SystemResourcesComponentBase ::
255 get_CmdDisp_InputPort(NATIVE_INT_TYPE portNum)
256 {
257 FW_ASSERT(
258 portNum < this->getNum_CmdDisp_InputPorts(),
259 static_cast<FwAssertArgType>(portNum)
260 );
261
262 return &this->m_CmdDisp_InputPort[portNum];
263 }
264
265 // ----------------------------------------------------------------------
266 // Getters for typed input ports
267 // ----------------------------------------------------------------------
268
269 Svc::InputSchedPort* SystemResourcesComponentBase ::
270 get_run_InputPort(NATIVE_INT_TYPE portNum)
271 {
272 FW_ASSERT(
273 portNum < this->getNum_run_InputPorts(),
274 static_cast<FwAssertArgType>(portNum)
275 );
276
277 return &this->m_run_InputPort[portNum];
278 }
279
280 // ----------------------------------------------------------------------
281 // Connect special input ports to special output ports
282 // ----------------------------------------------------------------------
283
284 void SystemResourcesComponentBase ::
285 set_CmdReg_OutputPort(
286 NATIVE_INT_TYPE portNum,
288 )
289 {
290 FW_ASSERT(
291 portNum < this->getNum_CmdReg_OutputPorts(),
292 static_cast<FwAssertArgType>(portNum)
293 );
294
295 this->m_CmdReg_OutputPort[portNum].addCallPort(port);
296 }
297
298 void SystemResourcesComponentBase ::
299 set_CmdStatus_OutputPort(
300 NATIVE_INT_TYPE portNum,
302 )
303 {
304 FW_ASSERT(
305 portNum < this->getNum_CmdStatus_OutputPorts(),
306 static_cast<FwAssertArgType>(portNum)
307 );
308
309 this->m_CmdStatus_OutputPort[portNum].addCallPort(port);
310 }
311
312 void SystemResourcesComponentBase ::
313 set_Log_OutputPort(
314 NATIVE_INT_TYPE portNum,
315 Fw::InputLogPort* port
316 )
317 {
318 FW_ASSERT(
319 portNum < this->getNum_Log_OutputPorts(),
320 static_cast<FwAssertArgType>(portNum)
321 );
322
323 this->m_Log_OutputPort[portNum].addCallPort(port);
324 }
325
326#if FW_ENABLE_TEXT_LOGGING == 1
327
328 void SystemResourcesComponentBase ::
329 set_LogText_OutputPort(
330 NATIVE_INT_TYPE portNum,
332 )
333 {
334 FW_ASSERT(
335 portNum < this->getNum_LogText_OutputPorts(),
336 static_cast<FwAssertArgType>(portNum)
337 );
338
339 this->m_LogText_OutputPort[portNum].addCallPort(port);
340 }
341
342#endif
343
344 void SystemResourcesComponentBase ::
345 set_Time_OutputPort(
346 NATIVE_INT_TYPE portNum,
348 )
349 {
350 FW_ASSERT(
351 portNum < this->getNum_Time_OutputPorts(),
352 static_cast<FwAssertArgType>(portNum)
353 );
354
355 this->m_Time_OutputPort[portNum].addCallPort(port);
356 }
357
358 void SystemResourcesComponentBase ::
359 set_Tlm_OutputPort(
360 NATIVE_INT_TYPE portNum,
361 Fw::InputTlmPort* port
362 )
363 {
364 FW_ASSERT(
365 portNum < this->getNum_Tlm_OutputPorts(),
366 static_cast<FwAssertArgType>(portNum)
367 );
368
369 this->m_Tlm_OutputPort[portNum].addCallPort(port);
370 }
371
372#if FW_PORT_SERIALIZATION
373
374 // ----------------------------------------------------------------------
375 // Connect serial input ports to special output ports
376 // ----------------------------------------------------------------------
377
378 void SystemResourcesComponentBase ::
379 set_CmdReg_OutputPort(
380 NATIVE_INT_TYPE portNum,
381 Fw::InputSerializePort* port
382 )
383 {
384 FW_ASSERT(
385 portNum < this->getNum_CmdReg_OutputPorts(),
386 static_cast<FwAssertArgType>(portNum)
387 );
388
389 this->m_CmdReg_OutputPort[portNum].registerSerialPort(port);
390 }
391
392 void SystemResourcesComponentBase ::
393 set_CmdStatus_OutputPort(
394 NATIVE_INT_TYPE portNum,
395 Fw::InputSerializePort* port
396 )
397 {
398 FW_ASSERT(
399 portNum < this->getNum_CmdStatus_OutputPorts(),
400 static_cast<FwAssertArgType>(portNum)
401 );
402
403 this->m_CmdStatus_OutputPort[portNum].registerSerialPort(port);
404 }
405
406 void SystemResourcesComponentBase ::
407 set_Log_OutputPort(
408 NATIVE_INT_TYPE portNum,
409 Fw::InputSerializePort* port
410 )
411 {
412 FW_ASSERT(
413 portNum < this->getNum_Log_OutputPorts(),
414 static_cast<FwAssertArgType>(portNum)
415 );
416
417 this->m_Log_OutputPort[portNum].registerSerialPort(port);
418 }
419
420#if FW_ENABLE_TEXT_LOGGING == 1
421
422 void SystemResourcesComponentBase ::
423 set_LogText_OutputPort(
424 NATIVE_INT_TYPE portNum,
425 Fw::InputSerializePort* port
426 )
427 {
428 FW_ASSERT(
429 portNum < this->getNum_LogText_OutputPorts(),
430 static_cast<FwAssertArgType>(portNum)
431 );
432
433 this->m_LogText_OutputPort[portNum].registerSerialPort(port);
434 }
435
436#endif
437
438 void SystemResourcesComponentBase ::
439 set_Time_OutputPort(
440 NATIVE_INT_TYPE portNum,
441 Fw::InputSerializePort* port
442 )
443 {
444 FW_ASSERT(
445 portNum < this->getNum_Time_OutputPorts(),
446 static_cast<FwAssertArgType>(portNum)
447 );
448
449 this->m_Time_OutputPort[portNum].registerSerialPort(port);
450 }
451
452 void SystemResourcesComponentBase ::
453 set_Tlm_OutputPort(
454 NATIVE_INT_TYPE portNum,
455 Fw::InputSerializePort* port
456 )
457 {
458 FW_ASSERT(
459 portNum < this->getNum_Tlm_OutputPorts(),
460 static_cast<FwAssertArgType>(portNum)
461 );
462
463 this->m_Tlm_OutputPort[portNum].registerSerialPort(port);
464 }
465
466#endif
467
468 // ----------------------------------------------------------------------
469 // Command registration
470 // ----------------------------------------------------------------------
471
472 void SystemResourcesComponentBase ::
473 regCommands()
474 {
475 FW_ASSERT(this->m_CmdReg_OutputPort[0].isConnected());
476
477 this->m_CmdReg_OutputPort[0].invoke(
478 this->getIdBase() + OPCODE_ENABLE
479 );
480
481 this->m_CmdReg_OutputPort[0].invoke(
482 this->getIdBase() + OPCODE_VERSION
483 );
484 }
485
486 // ----------------------------------------------------------------------
487 // Component construction and destruction
488 // ----------------------------------------------------------------------
489
490 SystemResourcesComponentBase ::
491 SystemResourcesComponentBase(const char* compName) :
492 Fw::PassiveComponentBase(compName)
493 {
494
495 }
496
497 SystemResourcesComponentBase ::
498 ~SystemResourcesComponentBase()
499 {
500
501 }
502
503 // ----------------------------------------------------------------------
504 // Getters for numbers of special input ports
505 // ----------------------------------------------------------------------
506
507 NATIVE_INT_TYPE SystemResourcesComponentBase ::
508 getNum_CmdDisp_InputPorts()
509 {
510 return static_cast<NATIVE_INT_TYPE>(FW_NUM_ARRAY_ELEMENTS(this->m_CmdDisp_InputPort));
511 }
512
513 // ----------------------------------------------------------------------
514 // Getters for numbers of typed input ports
515 // ----------------------------------------------------------------------
516
517 NATIVE_INT_TYPE SystemResourcesComponentBase ::
518 getNum_run_InputPorts()
519 {
520 return static_cast<NATIVE_INT_TYPE>(FW_NUM_ARRAY_ELEMENTS(this->m_run_InputPort));
521 }
522
523 // ----------------------------------------------------------------------
524 // Getters for numbers of special output ports
525 // ----------------------------------------------------------------------
526
527 NATIVE_INT_TYPE SystemResourcesComponentBase ::
528 getNum_CmdReg_OutputPorts()
529 {
530 return static_cast<NATIVE_INT_TYPE>(FW_NUM_ARRAY_ELEMENTS(this->m_CmdReg_OutputPort));
531 }
532
533 NATIVE_INT_TYPE SystemResourcesComponentBase ::
534 getNum_CmdStatus_OutputPorts()
535 {
536 return static_cast<NATIVE_INT_TYPE>(FW_NUM_ARRAY_ELEMENTS(this->m_CmdStatus_OutputPort));
537 }
538
539 NATIVE_INT_TYPE SystemResourcesComponentBase ::
540 getNum_Log_OutputPorts()
541 {
542 return static_cast<NATIVE_INT_TYPE>(FW_NUM_ARRAY_ELEMENTS(this->m_Log_OutputPort));
543 }
544
545#if FW_ENABLE_TEXT_LOGGING == 1
546
547 NATIVE_INT_TYPE SystemResourcesComponentBase ::
548 getNum_LogText_OutputPorts()
549 {
550 return static_cast<NATIVE_INT_TYPE>(FW_NUM_ARRAY_ELEMENTS(this->m_LogText_OutputPort));
551 }
552
553#endif
554
555 NATIVE_INT_TYPE SystemResourcesComponentBase ::
556 getNum_Time_OutputPorts()
557 {
558 return static_cast<NATIVE_INT_TYPE>(FW_NUM_ARRAY_ELEMENTS(this->m_Time_OutputPort));
559 }
560
561 NATIVE_INT_TYPE SystemResourcesComponentBase ::
562 getNum_Tlm_OutputPorts()
563 {
564 return static_cast<NATIVE_INT_TYPE>(FW_NUM_ARRAY_ELEMENTS(this->m_Tlm_OutputPort));
565 }
566
567 // ----------------------------------------------------------------------
568 // Connection status queries for special output ports
569 // ----------------------------------------------------------------------
570
571 bool SystemResourcesComponentBase ::
572 isConnected_CmdReg_OutputPort(NATIVE_INT_TYPE portNum)
573 {
574 FW_ASSERT(
575 portNum < this->getNum_CmdReg_OutputPorts(),
576 static_cast<FwAssertArgType>(portNum)
577 );
578
579 return this->m_CmdReg_OutputPort[portNum].isConnected();
580 }
581
582 bool SystemResourcesComponentBase ::
583 isConnected_CmdStatus_OutputPort(NATIVE_INT_TYPE portNum)
584 {
585 FW_ASSERT(
586 portNum < this->getNum_CmdStatus_OutputPorts(),
587 static_cast<FwAssertArgType>(portNum)
588 );
589
590 return this->m_CmdStatus_OutputPort[portNum].isConnected();
591 }
592
593 bool SystemResourcesComponentBase ::
594 isConnected_Log_OutputPort(NATIVE_INT_TYPE portNum)
595 {
596 FW_ASSERT(
597 portNum < this->getNum_Log_OutputPorts(),
598 static_cast<FwAssertArgType>(portNum)
599 );
600
601 return this->m_Log_OutputPort[portNum].isConnected();
602 }
603
604#if FW_ENABLE_TEXT_LOGGING == 1
605
606 bool SystemResourcesComponentBase ::
607 isConnected_LogText_OutputPort(NATIVE_INT_TYPE portNum)
608 {
609 FW_ASSERT(
610 portNum < this->getNum_LogText_OutputPorts(),
611 static_cast<FwAssertArgType>(portNum)
612 );
613
614 return this->m_LogText_OutputPort[portNum].isConnected();
615 }
616
617#endif
618
619 bool SystemResourcesComponentBase ::
620 isConnected_Time_OutputPort(NATIVE_INT_TYPE portNum)
621 {
622 FW_ASSERT(
623 portNum < this->getNum_Time_OutputPorts(),
624 static_cast<FwAssertArgType>(portNum)
625 );
626
627 return this->m_Time_OutputPort[portNum].isConnected();
628 }
629
630 bool SystemResourcesComponentBase ::
631 isConnected_Tlm_OutputPort(NATIVE_INT_TYPE portNum)
632 {
633 FW_ASSERT(
634 portNum < this->getNum_Tlm_OutputPorts(),
635 static_cast<FwAssertArgType>(portNum)
636 );
637
638 return this->m_Tlm_OutputPort[portNum].isConnected();
639 }
640
641 // ----------------------------------------------------------------------
642 // Port handler base-class functions for typed input ports
643 //
644 // Call these functions directly to bypass the corresponding ports
645 // ----------------------------------------------------------------------
646
647 void SystemResourcesComponentBase ::
648 run_handlerBase(
649 NATIVE_INT_TYPE portNum,
650 NATIVE_UINT_TYPE context
651 )
652 {
653 // Make sure port number is valid
654 FW_ASSERT(
655 portNum < this->getNum_run_InputPorts(),
656 static_cast<FwAssertArgType>(portNum)
657 );
658
659 // Lock guard mutex before calling
660 this->lock();
661
662 // Down call to pure virtual handler method implemented in Impl class
663 this->run_handler(
664 portNum,
665 context
666 );
667
668 // Unlock guard mutex
669 this->unLock();
670 }
671
672 // ----------------------------------------------------------------------
673 // Command response
674 // ----------------------------------------------------------------------
675
676 void SystemResourcesComponentBase ::
677 cmdResponse_out(
678 FwOpcodeType opCode,
679 U32 cmdSeq,
680 Fw::CmdResponse response
681 )
682 {
683 FW_ASSERT(this->m_CmdStatus_OutputPort[0].isConnected());
684 this->m_CmdStatus_OutputPort[0].invoke(opCode, cmdSeq, response);
685 }
686
687 // ----------------------------------------------------------------------
688 // Command handler base-class functions
689 //
690 // Call these functions directly to bypass the command input port
691 // ----------------------------------------------------------------------
692
693 void SystemResourcesComponentBase ::
694 ENABLE_cmdHandlerBase(
695 FwOpcodeType opCode,
696 U32 cmdSeq,
697 Fw::CmdArgBuffer& args
698 )
699 {
700 // Deserialize the arguments
702
703 // Reset the buffer
704 args.resetDeser();
705
707 _status = args.deserialize(enable);
708 if (_status != Fw::FW_SERIALIZE_OK) {
709 if (this->m_CmdStatus_OutputPort[0].isConnected()) {
710 this->m_CmdStatus_OutputPort[0].invoke(
711 opCode,
712 cmdSeq,
714 );
715 }
716 return;
717 }
718
719#if FW_CMD_CHECK_RESIDUAL
720 // Make sure there was no data left over.
721 // That means the argument buffer size was incorrect.
722 if (args.getBuffLeft() != 0) {
723 if (this->m_CmdStatus_OutputPort[0].isConnected()) {
724 this->m_CmdStatus_OutputPort[0].invoke(
725 opCode,
726 cmdSeq,
728 );
729 }
730 return;
731 }
732#endif
733
734 this->lock();
735
736 this->ENABLE_cmdHandler(
737 opCode, cmdSeq,
738 enable
739 );
740
741 this->unLock();
742 }
743
744 void SystemResourcesComponentBase ::
745 VERSION_cmdHandlerBase(
746 FwOpcodeType opCode,
747 U32 cmdSeq,
748 Fw::CmdArgBuffer& args
749 )
750 {
751#if FW_CMD_CHECK_RESIDUAL
752 // Make sure there was no data left over.
753 // That means the argument buffer size was incorrect.
754 if (args.getBuffLeft() != 0) {
755 if (this->m_CmdStatus_OutputPort[0].isConnected()) {
756 this->m_CmdStatus_OutputPort[0].invoke(
757 opCode,
758 cmdSeq,
760 );
761 }
762 return;
763 }
764#endif
765
766 this->lock();
767
768 this->VERSION_cmdHandler(opCode, cmdSeq);
769
770 this->unLock();
771 }
772
773 // ----------------------------------------------------------------------
774 // Event logging functions
775 // ----------------------------------------------------------------------
776
777 void SystemResourcesComponentBase ::
778 log_ACTIVITY_LO_FRAMEWORK_VERSION(const Fw::LogStringArg& version)
779 {
780 // Get the time
781 Fw::Time _logTime;
782 if (this->m_Time_OutputPort[0].isConnected()) {
783 this->m_Time_OutputPort[0].invoke(_logTime);
784 }
785
786 FwEventIdType _id = static_cast<FwEventIdType>(0);
787
788 _id = this->getIdBase() + EVENTID_FRAMEWORK_VERSION;
789
790 // Emit the event on the log port
791 if (this->m_Log_OutputPort[0].isConnected()) {
792 Fw::LogBuffer _logBuff;
794
795#if FW_AMPCS_COMPATIBLE
796 // Serialize the number of arguments
797 _status = _logBuff.serialize(static_cast<U8>(1));
798 FW_ASSERT(
799 _status == Fw::FW_SERIALIZE_OK,
800 static_cast<FwAssertArgType>(_status)
801 );
802#endif
803
804 _status = version.serialize(_logBuff, 40);
805 FW_ASSERT(
806 _status == Fw::FW_SERIALIZE_OK,
807 static_cast<FwAssertArgType>(_status)
808 );
809
810 this->m_Log_OutputPort[0].invoke(
811 _id,
812 _logTime,
814 _logBuff
815 );
816 }
817
818 // Emit the event on the text log port
819#if FW_ENABLE_TEXT_LOGGING
820 if (this->m_LogText_OutputPort[0].isConnected()) {
821#if FW_OBJECT_NAMES == 1
822 const char* _formatString =
823 "(%s) %s: Framework Version: [%s]";
824#else
825 const char* _formatString =
826 "%s: Framework Version: [%s]";
827#endif
828
829 char _textBuffer[FW_LOG_TEXT_BUFFER_SIZE];
830
831 (void) snprintf(
832 _textBuffer,
834 _formatString,
835#if FW_OBJECT_NAMES == 1
836 this->m_objName,
837#endif
838 "FRAMEWORK_VERSION ",
839 version.toChar()
840 );
841
842 // Null terminate
843 _textBuffer[FW_LOG_TEXT_BUFFER_SIZE-1] = 0;
844 Fw::TextLogString _logString = _textBuffer;
845 this->m_LogText_OutputPort[0].invoke(
846 _id,
847 _logTime,
849 _logString
850 );
851 }
852#endif
853 }
854
855 void SystemResourcesComponentBase ::
856 log_ACTIVITY_LO_PROJECT_VERSION(const Fw::LogStringArg& version)
857 {
858 // Get the time
859 Fw::Time _logTime;
860 if (this->m_Time_OutputPort[0].isConnected()) {
861 this->m_Time_OutputPort[0].invoke(_logTime);
862 }
863
864 FwEventIdType _id = static_cast<FwEventIdType>(0);
865
866 _id = this->getIdBase() + EVENTID_PROJECT_VERSION;
867
868 // Emit the event on the log port
869 if (this->m_Log_OutputPort[0].isConnected()) {
870 Fw::LogBuffer _logBuff;
872
873#if FW_AMPCS_COMPATIBLE
874 // Serialize the number of arguments
875 _status = _logBuff.serialize(static_cast<U8>(1));
876 FW_ASSERT(
877 _status == Fw::FW_SERIALIZE_OK,
878 static_cast<FwAssertArgType>(_status)
879 );
880#endif
881
882 _status = version.serialize(_logBuff, 40);
883 FW_ASSERT(
884 _status == Fw::FW_SERIALIZE_OK,
885 static_cast<FwAssertArgType>(_status)
886 );
887
888 this->m_Log_OutputPort[0].invoke(
889 _id,
890 _logTime,
892 _logBuff
893 );
894 }
895
896 // Emit the event on the text log port
897#if FW_ENABLE_TEXT_LOGGING
898 if (this->m_LogText_OutputPort[0].isConnected()) {
899#if FW_OBJECT_NAMES == 1
900 const char* _formatString =
901 "(%s) %s: Project Version: [%s]";
902#else
903 const char* _formatString =
904 "%s: Project Version: [%s]";
905#endif
906
907 char _textBuffer[FW_LOG_TEXT_BUFFER_SIZE];
908
909 (void) snprintf(
910 _textBuffer,
912 _formatString,
913#if FW_OBJECT_NAMES == 1
914 this->m_objName,
915#endif
916 "PROJECT_VERSION ",
917 version.toChar()
918 );
919
920 // Null terminate
921 _textBuffer[FW_LOG_TEXT_BUFFER_SIZE-1] = 0;
922 Fw::TextLogString _logString = _textBuffer;
923 this->m_LogText_OutputPort[0].invoke(
924 _id,
925 _logTime,
927 _logString
928 );
929 }
930#endif
931 }
932
933 // ----------------------------------------------------------------------
934 // Telemetry write functions
935 // ----------------------------------------------------------------------
936
937 void SystemResourcesComponentBase ::
938 tlmWrite_MEMORY_TOTAL(
939 U64 arg,
940 Fw::Time _tlmTime
941 )
942 {
943 if (this->m_Tlm_OutputPort[0].isConnected()) {
944 if (
945 this->m_Time_OutputPort[0].isConnected() &&
946 (_tlmTime == Fw::ZERO_TIME)
947 ) {
948 this->m_Time_OutputPort[0].invoke(_tlmTime);
949 }
950
951 Fw::TlmBuffer _tlmBuff;
952 Fw::SerializeStatus _stat = _tlmBuff.serialize(arg);
953 FW_ASSERT(
954 _stat == Fw::FW_SERIALIZE_OK,
955 static_cast<FwAssertArgType>(_stat)
956 );
957
958 FwChanIdType _id;
959
960 _id = this->getIdBase() + CHANNELID_MEMORY_TOTAL;
961
962 this->m_Tlm_OutputPort[0].invoke(
963 _id,
964 _tlmTime,
965 _tlmBuff
966 );
967 }
968 }
969
970 void SystemResourcesComponentBase ::
971 tlmWrite_MEMORY_USED(
972 U64 arg,
973 Fw::Time _tlmTime
974 )
975 {
976 if (this->m_Tlm_OutputPort[0].isConnected()) {
977 if (
978 this->m_Time_OutputPort[0].isConnected() &&
979 (_tlmTime == Fw::ZERO_TIME)
980 ) {
981 this->m_Time_OutputPort[0].invoke(_tlmTime);
982 }
983
984 Fw::TlmBuffer _tlmBuff;
985 Fw::SerializeStatus _stat = _tlmBuff.serialize(arg);
986 FW_ASSERT(
987 _stat == Fw::FW_SERIALIZE_OK,
988 static_cast<FwAssertArgType>(_stat)
989 );
990
991 FwChanIdType _id;
992
993 _id = this->getIdBase() + CHANNELID_MEMORY_USED;
994
995 this->m_Tlm_OutputPort[0].invoke(
996 _id,
997 _tlmTime,
998 _tlmBuff
999 );
1000 }
1001 }
1002
1003 void SystemResourcesComponentBase ::
1004 tlmWrite_NON_VOLATILE_TOTAL(
1005 U64 arg,
1006 Fw::Time _tlmTime
1007 )
1008 {
1009 if (this->m_Tlm_OutputPort[0].isConnected()) {
1010 if (
1011 this->m_Time_OutputPort[0].isConnected() &&
1012 (_tlmTime == Fw::ZERO_TIME)
1013 ) {
1014 this->m_Time_OutputPort[0].invoke(_tlmTime);
1015 }
1016
1017 Fw::TlmBuffer _tlmBuff;
1018 Fw::SerializeStatus _stat = _tlmBuff.serialize(arg);
1019 FW_ASSERT(
1020 _stat == Fw::FW_SERIALIZE_OK,
1021 static_cast<FwAssertArgType>(_stat)
1022 );
1023
1024 FwChanIdType _id;
1025
1026 _id = this->getIdBase() + CHANNELID_NON_VOLATILE_TOTAL;
1027
1028 this->m_Tlm_OutputPort[0].invoke(
1029 _id,
1030 _tlmTime,
1031 _tlmBuff
1032 );
1033 }
1034 }
1035
1036 void SystemResourcesComponentBase ::
1037 tlmWrite_NON_VOLATILE_FREE(
1038 U64 arg,
1039 Fw::Time _tlmTime
1040 )
1041 {
1042 if (this->m_Tlm_OutputPort[0].isConnected()) {
1043 if (
1044 this->m_Time_OutputPort[0].isConnected() &&
1045 (_tlmTime == Fw::ZERO_TIME)
1046 ) {
1047 this->m_Time_OutputPort[0].invoke(_tlmTime);
1048 }
1049
1050 Fw::TlmBuffer _tlmBuff;
1051 Fw::SerializeStatus _stat = _tlmBuff.serialize(arg);
1052 FW_ASSERT(
1053 _stat == Fw::FW_SERIALIZE_OK,
1054 static_cast<FwAssertArgType>(_stat)
1055 );
1056
1057 FwChanIdType _id;
1058
1059 _id = this->getIdBase() + CHANNELID_NON_VOLATILE_FREE;
1060
1061 this->m_Tlm_OutputPort[0].invoke(
1062 _id,
1063 _tlmTime,
1064 _tlmBuff
1065 );
1066 }
1067 }
1068
1069 void SystemResourcesComponentBase ::
1070 tlmWrite_CPU(
1071 F32 arg,
1072 Fw::Time _tlmTime
1073 )
1074 {
1075 if (this->m_Tlm_OutputPort[0].isConnected()) {
1076 if (
1077 this->m_Time_OutputPort[0].isConnected() &&
1078 (_tlmTime == Fw::ZERO_TIME)
1079 ) {
1080 this->m_Time_OutputPort[0].invoke(_tlmTime);
1081 }
1082
1083 Fw::TlmBuffer _tlmBuff;
1084 Fw::SerializeStatus _stat = _tlmBuff.serialize(arg);
1085 FW_ASSERT(
1086 _stat == Fw::FW_SERIALIZE_OK,
1087 static_cast<FwAssertArgType>(_stat)
1088 );
1089
1090 FwChanIdType _id;
1091
1092 _id = this->getIdBase() + CHANNELID_CPU;
1093
1094 this->m_Tlm_OutputPort[0].invoke(
1095 _id,
1096 _tlmTime,
1097 _tlmBuff
1098 );
1099 }
1100 }
1101
1102 void SystemResourcesComponentBase ::
1103 tlmWrite_CPU_00(
1104 F32 arg,
1105 Fw::Time _tlmTime
1106 )
1107 {
1108 if (this->m_Tlm_OutputPort[0].isConnected()) {
1109 if (
1110 this->m_Time_OutputPort[0].isConnected() &&
1111 (_tlmTime == Fw::ZERO_TIME)
1112 ) {
1113 this->m_Time_OutputPort[0].invoke(_tlmTime);
1114 }
1115
1116 Fw::TlmBuffer _tlmBuff;
1117 Fw::SerializeStatus _stat = _tlmBuff.serialize(arg);
1118 FW_ASSERT(
1119 _stat == Fw::FW_SERIALIZE_OK,
1120 static_cast<FwAssertArgType>(_stat)
1121 );
1122
1123 FwChanIdType _id;
1124
1125 _id = this->getIdBase() + CHANNELID_CPU_00;
1126
1127 this->m_Tlm_OutputPort[0].invoke(
1128 _id,
1129 _tlmTime,
1130 _tlmBuff
1131 );
1132 }
1133 }
1134
1135 void SystemResourcesComponentBase ::
1136 tlmWrite_CPU_01(
1137 F32 arg,
1138 Fw::Time _tlmTime
1139 )
1140 {
1141 if (this->m_Tlm_OutputPort[0].isConnected()) {
1142 if (
1143 this->m_Time_OutputPort[0].isConnected() &&
1144 (_tlmTime == Fw::ZERO_TIME)
1145 ) {
1146 this->m_Time_OutputPort[0].invoke(_tlmTime);
1147 }
1148
1149 Fw::TlmBuffer _tlmBuff;
1150 Fw::SerializeStatus _stat = _tlmBuff.serialize(arg);
1151 FW_ASSERT(
1152 _stat == Fw::FW_SERIALIZE_OK,
1153 static_cast<FwAssertArgType>(_stat)
1154 );
1155
1156 FwChanIdType _id;
1157
1158 _id = this->getIdBase() + CHANNELID_CPU_01;
1159
1160 this->m_Tlm_OutputPort[0].invoke(
1161 _id,
1162 _tlmTime,
1163 _tlmBuff
1164 );
1165 }
1166 }
1167
1168 void SystemResourcesComponentBase ::
1169 tlmWrite_CPU_02(
1170 F32 arg,
1171 Fw::Time _tlmTime
1172 )
1173 {
1174 if (this->m_Tlm_OutputPort[0].isConnected()) {
1175 if (
1176 this->m_Time_OutputPort[0].isConnected() &&
1177 (_tlmTime == Fw::ZERO_TIME)
1178 ) {
1179 this->m_Time_OutputPort[0].invoke(_tlmTime);
1180 }
1181
1182 Fw::TlmBuffer _tlmBuff;
1183 Fw::SerializeStatus _stat = _tlmBuff.serialize(arg);
1184 FW_ASSERT(
1185 _stat == Fw::FW_SERIALIZE_OK,
1186 static_cast<FwAssertArgType>(_stat)
1187 );
1188
1189 FwChanIdType _id;
1190
1191 _id = this->getIdBase() + CHANNELID_CPU_02;
1192
1193 this->m_Tlm_OutputPort[0].invoke(
1194 _id,
1195 _tlmTime,
1196 _tlmBuff
1197 );
1198 }
1199 }
1200
1201 void SystemResourcesComponentBase ::
1202 tlmWrite_CPU_03(
1203 F32 arg,
1204 Fw::Time _tlmTime
1205 )
1206 {
1207 if (this->m_Tlm_OutputPort[0].isConnected()) {
1208 if (
1209 this->m_Time_OutputPort[0].isConnected() &&
1210 (_tlmTime == Fw::ZERO_TIME)
1211 ) {
1212 this->m_Time_OutputPort[0].invoke(_tlmTime);
1213 }
1214
1215 Fw::TlmBuffer _tlmBuff;
1216 Fw::SerializeStatus _stat = _tlmBuff.serialize(arg);
1217 FW_ASSERT(
1218 _stat == Fw::FW_SERIALIZE_OK,
1219 static_cast<FwAssertArgType>(_stat)
1220 );
1221
1222 FwChanIdType _id;
1223
1224 _id = this->getIdBase() + CHANNELID_CPU_03;
1225
1226 this->m_Tlm_OutputPort[0].invoke(
1227 _id,
1228 _tlmTime,
1229 _tlmBuff
1230 );
1231 }
1232 }
1233
1234 void SystemResourcesComponentBase ::
1235 tlmWrite_CPU_04(
1236 F32 arg,
1237 Fw::Time _tlmTime
1238 )
1239 {
1240 if (this->m_Tlm_OutputPort[0].isConnected()) {
1241 if (
1242 this->m_Time_OutputPort[0].isConnected() &&
1243 (_tlmTime == Fw::ZERO_TIME)
1244 ) {
1245 this->m_Time_OutputPort[0].invoke(_tlmTime);
1246 }
1247
1248 Fw::TlmBuffer _tlmBuff;
1249 Fw::SerializeStatus _stat = _tlmBuff.serialize(arg);
1250 FW_ASSERT(
1251 _stat == Fw::FW_SERIALIZE_OK,
1252 static_cast<FwAssertArgType>(_stat)
1253 );
1254
1255 FwChanIdType _id;
1256
1257 _id = this->getIdBase() + CHANNELID_CPU_04;
1258
1259 this->m_Tlm_OutputPort[0].invoke(
1260 _id,
1261 _tlmTime,
1262 _tlmBuff
1263 );
1264 }
1265 }
1266
1267 void SystemResourcesComponentBase ::
1268 tlmWrite_CPU_05(
1269 F32 arg,
1270 Fw::Time _tlmTime
1271 )
1272 {
1273 if (this->m_Tlm_OutputPort[0].isConnected()) {
1274 if (
1275 this->m_Time_OutputPort[0].isConnected() &&
1276 (_tlmTime == Fw::ZERO_TIME)
1277 ) {
1278 this->m_Time_OutputPort[0].invoke(_tlmTime);
1279 }
1280
1281 Fw::TlmBuffer _tlmBuff;
1282 Fw::SerializeStatus _stat = _tlmBuff.serialize(arg);
1283 FW_ASSERT(
1284 _stat == Fw::FW_SERIALIZE_OK,
1285 static_cast<FwAssertArgType>(_stat)
1286 );
1287
1288 FwChanIdType _id;
1289
1290 _id = this->getIdBase() + CHANNELID_CPU_05;
1291
1292 this->m_Tlm_OutputPort[0].invoke(
1293 _id,
1294 _tlmTime,
1295 _tlmBuff
1296 );
1297 }
1298 }
1299
1300 void SystemResourcesComponentBase ::
1301 tlmWrite_CPU_06(
1302 F32 arg,
1303 Fw::Time _tlmTime
1304 )
1305 {
1306 if (this->m_Tlm_OutputPort[0].isConnected()) {
1307 if (
1308 this->m_Time_OutputPort[0].isConnected() &&
1309 (_tlmTime == Fw::ZERO_TIME)
1310 ) {
1311 this->m_Time_OutputPort[0].invoke(_tlmTime);
1312 }
1313
1314 Fw::TlmBuffer _tlmBuff;
1315 Fw::SerializeStatus _stat = _tlmBuff.serialize(arg);
1316 FW_ASSERT(
1317 _stat == Fw::FW_SERIALIZE_OK,
1318 static_cast<FwAssertArgType>(_stat)
1319 );
1320
1321 FwChanIdType _id;
1322
1323 _id = this->getIdBase() + CHANNELID_CPU_06;
1324
1325 this->m_Tlm_OutputPort[0].invoke(
1326 _id,
1327 _tlmTime,
1328 _tlmBuff
1329 );
1330 }
1331 }
1332
1333 void SystemResourcesComponentBase ::
1334 tlmWrite_CPU_07(
1335 F32 arg,
1336 Fw::Time _tlmTime
1337 )
1338 {
1339 if (this->m_Tlm_OutputPort[0].isConnected()) {
1340 if (
1341 this->m_Time_OutputPort[0].isConnected() &&
1342 (_tlmTime == Fw::ZERO_TIME)
1343 ) {
1344 this->m_Time_OutputPort[0].invoke(_tlmTime);
1345 }
1346
1347 Fw::TlmBuffer _tlmBuff;
1348 Fw::SerializeStatus _stat = _tlmBuff.serialize(arg);
1349 FW_ASSERT(
1350 _stat == Fw::FW_SERIALIZE_OK,
1351 static_cast<FwAssertArgType>(_stat)
1352 );
1353
1354 FwChanIdType _id;
1355
1356 _id = this->getIdBase() + CHANNELID_CPU_07;
1357
1358 this->m_Tlm_OutputPort[0].invoke(
1359 _id,
1360 _tlmTime,
1361 _tlmBuff
1362 );
1363 }
1364 }
1365
1366 void SystemResourcesComponentBase ::
1367 tlmWrite_CPU_08(
1368 F32 arg,
1369 Fw::Time _tlmTime
1370 )
1371 {
1372 if (this->m_Tlm_OutputPort[0].isConnected()) {
1373 if (
1374 this->m_Time_OutputPort[0].isConnected() &&
1375 (_tlmTime == Fw::ZERO_TIME)
1376 ) {
1377 this->m_Time_OutputPort[0].invoke(_tlmTime);
1378 }
1379
1380 Fw::TlmBuffer _tlmBuff;
1381 Fw::SerializeStatus _stat = _tlmBuff.serialize(arg);
1382 FW_ASSERT(
1383 _stat == Fw::FW_SERIALIZE_OK,
1384 static_cast<FwAssertArgType>(_stat)
1385 );
1386
1387 FwChanIdType _id;
1388
1389 _id = this->getIdBase() + CHANNELID_CPU_08;
1390
1391 this->m_Tlm_OutputPort[0].invoke(
1392 _id,
1393 _tlmTime,
1394 _tlmBuff
1395 );
1396 }
1397 }
1398
1399 void SystemResourcesComponentBase ::
1400 tlmWrite_CPU_09(
1401 F32 arg,
1402 Fw::Time _tlmTime
1403 )
1404 {
1405 if (this->m_Tlm_OutputPort[0].isConnected()) {
1406 if (
1407 this->m_Time_OutputPort[0].isConnected() &&
1408 (_tlmTime == Fw::ZERO_TIME)
1409 ) {
1410 this->m_Time_OutputPort[0].invoke(_tlmTime);
1411 }
1412
1413 Fw::TlmBuffer _tlmBuff;
1414 Fw::SerializeStatus _stat = _tlmBuff.serialize(arg);
1415 FW_ASSERT(
1416 _stat == Fw::FW_SERIALIZE_OK,
1417 static_cast<FwAssertArgType>(_stat)
1418 );
1419
1420 FwChanIdType _id;
1421
1422 _id = this->getIdBase() + CHANNELID_CPU_09;
1423
1424 this->m_Tlm_OutputPort[0].invoke(
1425 _id,
1426 _tlmTime,
1427 _tlmBuff
1428 );
1429 }
1430 }
1431
1432 void SystemResourcesComponentBase ::
1433 tlmWrite_CPU_10(
1434 F32 arg,
1435 Fw::Time _tlmTime
1436 )
1437 {
1438 if (this->m_Tlm_OutputPort[0].isConnected()) {
1439 if (
1440 this->m_Time_OutputPort[0].isConnected() &&
1441 (_tlmTime == Fw::ZERO_TIME)
1442 ) {
1443 this->m_Time_OutputPort[0].invoke(_tlmTime);
1444 }
1445
1446 Fw::TlmBuffer _tlmBuff;
1447 Fw::SerializeStatus _stat = _tlmBuff.serialize(arg);
1448 FW_ASSERT(
1449 _stat == Fw::FW_SERIALIZE_OK,
1450 static_cast<FwAssertArgType>(_stat)
1451 );
1452
1453 FwChanIdType _id;
1454
1455 _id = this->getIdBase() + CHANNELID_CPU_10;
1456
1457 this->m_Tlm_OutputPort[0].invoke(
1458 _id,
1459 _tlmTime,
1460 _tlmBuff
1461 );
1462 }
1463 }
1464
1465 void SystemResourcesComponentBase ::
1466 tlmWrite_CPU_11(
1467 F32 arg,
1468 Fw::Time _tlmTime
1469 )
1470 {
1471 if (this->m_Tlm_OutputPort[0].isConnected()) {
1472 if (
1473 this->m_Time_OutputPort[0].isConnected() &&
1474 (_tlmTime == Fw::ZERO_TIME)
1475 ) {
1476 this->m_Time_OutputPort[0].invoke(_tlmTime);
1477 }
1478
1479 Fw::TlmBuffer _tlmBuff;
1480 Fw::SerializeStatus _stat = _tlmBuff.serialize(arg);
1481 FW_ASSERT(
1482 _stat == Fw::FW_SERIALIZE_OK,
1483 static_cast<FwAssertArgType>(_stat)
1484 );
1485
1486 FwChanIdType _id;
1487
1488 _id = this->getIdBase() + CHANNELID_CPU_11;
1489
1490 this->m_Tlm_OutputPort[0].invoke(
1491 _id,
1492 _tlmTime,
1493 _tlmBuff
1494 );
1495 }
1496 }
1497
1498 void SystemResourcesComponentBase ::
1499 tlmWrite_CPU_12(
1500 F32 arg,
1501 Fw::Time _tlmTime
1502 )
1503 {
1504 if (this->m_Tlm_OutputPort[0].isConnected()) {
1505 if (
1506 this->m_Time_OutputPort[0].isConnected() &&
1507 (_tlmTime == Fw::ZERO_TIME)
1508 ) {
1509 this->m_Time_OutputPort[0].invoke(_tlmTime);
1510 }
1511
1512 Fw::TlmBuffer _tlmBuff;
1513 Fw::SerializeStatus _stat = _tlmBuff.serialize(arg);
1514 FW_ASSERT(
1515 _stat == Fw::FW_SERIALIZE_OK,
1516 static_cast<FwAssertArgType>(_stat)
1517 );
1518
1519 FwChanIdType _id;
1520
1521 _id = this->getIdBase() + CHANNELID_CPU_12;
1522
1523 this->m_Tlm_OutputPort[0].invoke(
1524 _id,
1525 _tlmTime,
1526 _tlmBuff
1527 );
1528 }
1529 }
1530
1531 void SystemResourcesComponentBase ::
1532 tlmWrite_CPU_13(
1533 F32 arg,
1534 Fw::Time _tlmTime
1535 )
1536 {
1537 if (this->m_Tlm_OutputPort[0].isConnected()) {
1538 if (
1539 this->m_Time_OutputPort[0].isConnected() &&
1540 (_tlmTime == Fw::ZERO_TIME)
1541 ) {
1542 this->m_Time_OutputPort[0].invoke(_tlmTime);
1543 }
1544
1545 Fw::TlmBuffer _tlmBuff;
1546 Fw::SerializeStatus _stat = _tlmBuff.serialize(arg);
1547 FW_ASSERT(
1548 _stat == Fw::FW_SERIALIZE_OK,
1549 static_cast<FwAssertArgType>(_stat)
1550 );
1551
1552 FwChanIdType _id;
1553
1554 _id = this->getIdBase() + CHANNELID_CPU_13;
1555
1556 this->m_Tlm_OutputPort[0].invoke(
1557 _id,
1558 _tlmTime,
1559 _tlmBuff
1560 );
1561 }
1562 }
1563
1564 void SystemResourcesComponentBase ::
1565 tlmWrite_CPU_14(
1566 F32 arg,
1567 Fw::Time _tlmTime
1568 )
1569 {
1570 if (this->m_Tlm_OutputPort[0].isConnected()) {
1571 if (
1572 this->m_Time_OutputPort[0].isConnected() &&
1573 (_tlmTime == Fw::ZERO_TIME)
1574 ) {
1575 this->m_Time_OutputPort[0].invoke(_tlmTime);
1576 }
1577
1578 Fw::TlmBuffer _tlmBuff;
1579 Fw::SerializeStatus _stat = _tlmBuff.serialize(arg);
1580 FW_ASSERT(
1581 _stat == Fw::FW_SERIALIZE_OK,
1582 static_cast<FwAssertArgType>(_stat)
1583 );
1584
1585 FwChanIdType _id;
1586
1587 _id = this->getIdBase() + CHANNELID_CPU_14;
1588
1589 this->m_Tlm_OutputPort[0].invoke(
1590 _id,
1591 _tlmTime,
1592 _tlmBuff
1593 );
1594 }
1595 }
1596
1597 void SystemResourcesComponentBase ::
1598 tlmWrite_CPU_15(
1599 F32 arg,
1600 Fw::Time _tlmTime
1601 )
1602 {
1603 if (this->m_Tlm_OutputPort[0].isConnected()) {
1604 if (
1605 this->m_Time_OutputPort[0].isConnected() &&
1606 (_tlmTime == Fw::ZERO_TIME)
1607 ) {
1608 this->m_Time_OutputPort[0].invoke(_tlmTime);
1609 }
1610
1611 Fw::TlmBuffer _tlmBuff;
1612 Fw::SerializeStatus _stat = _tlmBuff.serialize(arg);
1613 FW_ASSERT(
1614 _stat == Fw::FW_SERIALIZE_OK,
1615 static_cast<FwAssertArgType>(_stat)
1616 );
1617
1618 FwChanIdType _id;
1619
1620 _id = this->getIdBase() + CHANNELID_CPU_15;
1621
1622 this->m_Tlm_OutputPort[0].invoke(
1623 _id,
1624 _tlmTime,
1625 _tlmBuff
1626 );
1627 }
1628 }
1629
1630 void SystemResourcesComponentBase ::
1631 tlmWrite_FRAMEWORK_VERSION(
1632 const Fw::TlmString& arg,
1633 Fw::Time _tlmTime
1634 )
1635 {
1636 if (this->m_Tlm_OutputPort[0].isConnected()) {
1637 if (
1638 this->m_Time_OutputPort[0].isConnected() &&
1639 (_tlmTime == Fw::ZERO_TIME)
1640 ) {
1641 this->m_Time_OutputPort[0].invoke(_tlmTime);
1642 }
1643
1644 Fw::TlmBuffer _tlmBuff;
1645 Fw::SerializeStatus _stat = arg.serialize(_tlmBuff, 40);
1646 FW_ASSERT(
1647 _stat == Fw::FW_SERIALIZE_OK,
1648 static_cast<FwAssertArgType>(_stat)
1649 );
1650
1651 FwChanIdType _id;
1652
1653 _id = this->getIdBase() + CHANNELID_FRAMEWORK_VERSION;
1654
1655 this->m_Tlm_OutputPort[0].invoke(
1656 _id,
1657 _tlmTime,
1658 _tlmBuff
1659 );
1660 }
1661 }
1662
1663 void SystemResourcesComponentBase ::
1664 tlmWrite_PROJECT_VERSION(
1665 const Fw::TlmString& arg,
1666 Fw::Time _tlmTime
1667 )
1668 {
1669 if (this->m_Tlm_OutputPort[0].isConnected()) {
1670 if (
1671 this->m_Time_OutputPort[0].isConnected() &&
1672 (_tlmTime == Fw::ZERO_TIME)
1673 ) {
1674 this->m_Time_OutputPort[0].invoke(_tlmTime);
1675 }
1676
1677 Fw::TlmBuffer _tlmBuff;
1678 Fw::SerializeStatus _stat = arg.serialize(_tlmBuff, 40);
1679 FW_ASSERT(
1680 _stat == Fw::FW_SERIALIZE_OK,
1681 static_cast<FwAssertArgType>(_stat)
1682 );
1683
1684 FwChanIdType _id;
1685
1686 _id = this->getIdBase() + CHANNELID_PROJECT_VERSION;
1687
1688 this->m_Tlm_OutputPort[0].invoke(
1689 _id,
1690 _tlmTime,
1691 _tlmBuff
1692 );
1693 }
1694 }
1695
1696 // ----------------------------------------------------------------------
1697 // Time
1698 // ----------------------------------------------------------------------
1699
1700 Fw::Time SystemResourcesComponentBase ::
1701 getTime()
1702 {
1703 if (this->m_Time_OutputPort[0].isConnected()) {
1704 Fw::Time _time;
1705 this->m_Time_OutputPort[0].invoke(_time);
1706 return _time;
1707 }
1708 else {
1709 return Fw::Time(TB_NONE, 0, 0);
1710 }
1711 }
1712
1713 // ----------------------------------------------------------------------
1714 // Mutex operations for guarded ports
1715 //
1716 // You can override these operations to provide more sophisticated
1717 // synchronization
1718 // ----------------------------------------------------------------------
1719
1720 void SystemResourcesComponentBase ::
1721 lock()
1722 {
1723 this->m_guardedPortMutex.lock();
1724 }
1725
1726 void SystemResourcesComponentBase ::
1727 unLock()
1728 {
1729 this->m_guardedPortMutex.unLock();
1730 }
1731
1732 // ----------------------------------------------------------------------
1733 // Calls for messages received on special input ports
1734 // ----------------------------------------------------------------------
1735
1736 void SystemResourcesComponentBase ::
1737 m_p_CmdDisp_in(
1738 Fw::PassiveComponentBase* callComp,
1739 NATIVE_INT_TYPE portNum,
1740 FwOpcodeType opCode,
1741 U32 cmdSeq,
1742 Fw::CmdArgBuffer& args
1743 )
1744 {
1745 FW_ASSERT(callComp);
1746 SystemResourcesComponentBase* compPtr = static_cast<SystemResourcesComponentBase*>(callComp);
1747
1748 const U32 idBase = callComp->getIdBase();
1749 FW_ASSERT(opCode >= idBase, opCode, idBase);
1750
1751 // Select base class function based on opcode
1752 switch (opCode - idBase) {
1753 case OPCODE_ENABLE: {
1754 compPtr->ENABLE_cmdHandlerBase(
1755 opCode,
1756 cmdSeq,
1757 args
1758 );
1759 break;
1760 }
1761
1762 case OPCODE_VERSION: {
1763 compPtr->VERSION_cmdHandlerBase(
1764 opCode,
1765 cmdSeq,
1766 args
1767 );
1768 break;
1769 }
1770 }
1771 }
1772
1773 // ----------------------------------------------------------------------
1774 // Calls for messages received on typed input ports
1775 // ----------------------------------------------------------------------
1776
1777 void SystemResourcesComponentBase ::
1778 m_p_run_in(
1779 Fw::PassiveComponentBase* callComp,
1780 NATIVE_INT_TYPE portNum,
1781 NATIVE_UINT_TYPE context
1782 )
1783 {
1784 FW_ASSERT(callComp);
1785 SystemResourcesComponentBase* compPtr = static_cast<SystemResourcesComponentBase*>(callComp);
1786 compPtr->run_handlerBase(
1787 portNum,
1788 context
1789 );
1790 }
1791
1792}
#define FW_ASSERT(...)
Definition Assert.hpp:7
PlatformIntType NATIVE_INT_TYPE
Definition BasicTypes.h:51
U8 BYTE
byte type
Definition BasicTypes.h:27
float F32
32-bit floating point
Definition BasicTypes.h:45
uint8_t U8
8-bit unsigned integer
Definition BasicTypes.h:26
#define FW_NUM_ARRAY_ELEMENTS(a)
number of elements in an array
Definition BasicTypes.h:66
PlatformUIntType NATIVE_UINT_TYPE
Definition BasicTypes.h:52
int PlatformIntType
DefaultTypes.hpp provides fallback defaults for the platform types.
#define PRI_PlatformIntType
@ TB_NONE
No time base has been established.
Definition FpConfig.h:39
PlatformAssertArgType FwAssertArgType
Definition FpConfig.h:21
U32 FwChanIdType
Definition FpConfig.h:59
U32 FwEventIdType
Definition FpConfig.h:62
U32 FwOpcodeType
Definition FpConfig.h:56
#define FW_LOG_TEXT_BUFFER_SIZE
Max size of string for text log message.
Definition FpConfig.h:291
#define FW_OBJECT_NAMES
Indicates whether or not object names are stored (more memory, can be used for tracking objects)
Definition FpConfig.h:82
Enum representing a command response.
@ FORMAT_ERROR
Command failed to deserialize.
@ SERIALIZED_SIZE
The size of the serial representations of the port arguments.
Definition CmdPortAc.hpp:37
@ ACTIVITY_LO
Less important informational events.
const char * toChar() const override
Definition LogString.cpp:49
SerializeStatus serialize(SerializeBufferBase &buffer) const override
serialization function
Definition LogString.cpp:57
void init()
Object initializer.
Definition ObjBase.cpp:27
NATIVE_UINT_TYPE getBuffLeft() const
returns how much deserialization buffer is left
void resetDeser()
reset deserialization to beginning
SerializeStatus deserialize(U8 &val)
deserialize 8-bit unsigned int
SerializeStatus serialize(U8 val)
serialize 8-bit unsigned int
SerializeStatus serialize(SerializeBufferBase &buffer) const override
serialization function
Definition TlmString.cpp:56
@ SERIALIZED_SIZE
The size of the serial representations of the port arguments.
Auto-generated base for SystemResources component.
void ENABLE_cmdHandlerBase(FwOpcodeType opCode, U32 cmdSeq, Fw::CmdArgBuffer &args)
void run_handlerBase(NATIVE_INT_TYPE portNum, NATIVE_UINT_TYPE context)
Handler base-class function for input port run.
void VERSION_cmdHandlerBase(FwOpcodeType opCode, U32 cmdSeq, Fw::CmdArgBuffer &args)
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