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