F´ Flight Software - C/C++ Documentation
A framework for building embedded system applications to NASA flight quality standards.
LinuxUartDriverComponentAc.cpp
Go to the documentation of this file.
1 // ======================================================================
2 // \title LinuxUartDriverComponentAc.cpp
3 // \author Generated by fpp-to-cpp
4 // \brief cpp file for LinuxUartDriver component base class
5 // ======================================================================
6 
8 #include "Fw/Types/Assert.hpp"
10 #if FW_ENABLE_TEXT_LOGGING
11 #include "Fw/Types/String.hpp"
12 #endif
13 
14 namespace Drv {
15 
16  // ----------------------------------------------------------------------
17  // Component initialization
18  // ----------------------------------------------------------------------
19 
22  {
23  // Initialize base class
25 
26 #if !FW_DIRECT_PORT_CALLS
27  // Connect input port recvReturnIn
28  for (
29  FwIndexType port = 0;
30  port < static_cast<FwIndexType>(this->getNum_recvReturnIn_InputPorts());
31  port++
32  ) {
33  this->m_recvReturnIn_InputPort[port].init();
34  this->m_recvReturnIn_InputPort[port].addCallComp(
35  this,
36  m_p_recvReturnIn_in
37  );
38  this->m_recvReturnIn_InputPort[port].setPortNum(port);
39 
40 #if FW_OBJECT_NAMES == 1
41  Fw::ObjectName portName;
42  portName.format(
43  "%s_recvReturnIn_InputPort[%" PRI_FwIndexType "]",
44  this->m_objName.toChar(),
45  port
46  );
47  this->m_recvReturnIn_InputPort[port].setObjName(portName.toChar());
48 #endif
49  }
50 #endif
51 
52 #if !FW_DIRECT_PORT_CALLS
53  // Connect input port run
54  for (
55  FwIndexType port = 0;
56  port < static_cast<FwIndexType>(this->getNum_run_InputPorts());
57  port++
58  ) {
59  this->m_run_InputPort[port].init();
60  this->m_run_InputPort[port].addCallComp(
61  this,
62  m_p_run_in
63  );
64  this->m_run_InputPort[port].setPortNum(port);
65 
66 #if FW_OBJECT_NAMES == 1
67  Fw::ObjectName portName;
68  portName.format(
69  "%s_run_InputPort[%" PRI_FwIndexType "]",
70  this->m_objName.toChar(),
71  port
72  );
73  this->m_run_InputPort[port].setObjName(portName.toChar());
74 #endif
75  }
76 #endif
77 
78 #if !FW_DIRECT_PORT_CALLS
79  // Connect input port send
80  for (
81  FwIndexType port = 0;
82  port < static_cast<FwIndexType>(this->getNum_send_InputPorts());
83  port++
84  ) {
85  this->m_send_InputPort[port].init();
86  this->m_send_InputPort[port].addCallComp(
87  this,
88  m_p_send_in
89  );
90  this->m_send_InputPort[port].setPortNum(port);
91 
92 #if FW_OBJECT_NAMES == 1
93  Fw::ObjectName portName;
94  portName.format(
95  "%s_send_InputPort[%" PRI_FwIndexType "]",
96  this->m_objName.toChar(),
97  port
98  );
99  this->m_send_InputPort[port].setObjName(portName.toChar());
100 #endif
101  }
102 #endif
103 
104 #if !FW_DIRECT_PORT_CALLS
105  // Connect output port Log
106  for (
107  FwIndexType port = 0;
108  port < static_cast<FwIndexType>(this->getNum_Log_OutputPorts());
109  port++
110  ) {
111  this->m_Log_OutputPort[port].init();
112 
113 #if FW_OBJECT_NAMES == 1
114  Fw::ObjectName portName;
115  portName.format(
116  "%s_Log_OutputPort[%" PRI_FwIndexType "]",
117  this->m_objName.toChar(),
118  port
119  );
120  this->m_Log_OutputPort[port].setObjName(portName.toChar());
121 #endif
122  }
123 #endif
124 
125 #if !FW_DIRECT_PORT_CALLS && FW_ENABLE_TEXT_LOGGING
126  // Connect output port LogText
127  for (
128  FwIndexType port = 0;
129  port < static_cast<FwIndexType>(this->getNum_LogText_OutputPorts());
130  port++
131  ) {
132  this->m_LogText_OutputPort[port].init();
133 
134 #if FW_OBJECT_NAMES == 1
135  Fw::ObjectName portName;
136  portName.format(
137  "%s_LogText_OutputPort[%" PRI_FwIndexType "]",
138  this->m_objName.toChar(),
139  port
140  );
141  this->m_LogText_OutputPort[port].setObjName(portName.toChar());
142 #endif
143  }
144 #endif
145 
146 #if !FW_DIRECT_PORT_CALLS
147  // Connect output port Time
148  for (
149  FwIndexType port = 0;
150  port < static_cast<FwIndexType>(this->getNum_Time_OutputPorts());
151  port++
152  ) {
153  this->m_Time_OutputPort[port].init();
154 
155 #if FW_OBJECT_NAMES == 1
156  Fw::ObjectName portName;
157  portName.format(
158  "%s_Time_OutputPort[%" PRI_FwIndexType "]",
159  this->m_objName.toChar(),
160  port
161  );
162  this->m_Time_OutputPort[port].setObjName(portName.toChar());
163 #endif
164  }
165 #endif
166 
167 #if !FW_DIRECT_PORT_CALLS
168  // Connect output port Tlm
169  for (
170  FwIndexType port = 0;
171  port < static_cast<FwIndexType>(this->getNum_Tlm_OutputPorts());
172  port++
173  ) {
174  this->m_Tlm_OutputPort[port].init();
175 
176 #if FW_OBJECT_NAMES == 1
177  Fw::ObjectName portName;
178  portName.format(
179  "%s_Tlm_OutputPort[%" PRI_FwIndexType "]",
180  this->m_objName.toChar(),
181  port
182  );
183  this->m_Tlm_OutputPort[port].setObjName(portName.toChar());
184 #endif
185  }
186 #endif
187 
188 #if !FW_DIRECT_PORT_CALLS
189  // Connect output port allocate
190  for (
191  FwIndexType port = 0;
192  port < static_cast<FwIndexType>(this->getNum_allocate_OutputPorts());
193  port++
194  ) {
195  this->m_allocate_OutputPort[port].init();
196 
197 #if FW_OBJECT_NAMES == 1
198  Fw::ObjectName portName;
199  portName.format(
200  "%s_allocate_OutputPort[%" PRI_FwIndexType "]",
201  this->m_objName.toChar(),
202  port
203  );
204  this->m_allocate_OutputPort[port].setObjName(portName.toChar());
205 #endif
206  }
207 #endif
208 
209 #if !FW_DIRECT_PORT_CALLS
210  // Connect output port deallocate
211  for (
212  FwIndexType port = 0;
213  port < static_cast<FwIndexType>(this->getNum_deallocate_OutputPorts());
214  port++
215  ) {
216  this->m_deallocate_OutputPort[port].init();
217 
218 #if FW_OBJECT_NAMES == 1
219  Fw::ObjectName portName;
220  portName.format(
221  "%s_deallocate_OutputPort[%" PRI_FwIndexType "]",
222  this->m_objName.toChar(),
223  port
224  );
225  this->m_deallocate_OutputPort[port].setObjName(portName.toChar());
226 #endif
227  }
228 #endif
229 
230 #if !FW_DIRECT_PORT_CALLS
231  // Connect output port ready
232  for (
233  FwIndexType port = 0;
234  port < static_cast<FwIndexType>(this->getNum_ready_OutputPorts());
235  port++
236  ) {
237  this->m_ready_OutputPort[port].init();
238 
239 #if FW_OBJECT_NAMES == 1
240  Fw::ObjectName portName;
241  portName.format(
242  "%s_ready_OutputPort[%" PRI_FwIndexType "]",
243  this->m_objName.toChar(),
244  port
245  );
246  this->m_ready_OutputPort[port].setObjName(portName.toChar());
247 #endif
248  }
249 #endif
250 
251 #if !FW_DIRECT_PORT_CALLS
252  // Connect output port recv
253  for (
254  FwIndexType port = 0;
255  port < static_cast<FwIndexType>(this->getNum_recv_OutputPorts());
256  port++
257  ) {
258  this->m_recv_OutputPort[port].init();
259 
260 #if FW_OBJECT_NAMES == 1
261  Fw::ObjectName portName;
262  portName.format(
263  "%s_recv_OutputPort[%" PRI_FwIndexType "]",
264  this->m_objName.toChar(),
265  port
266  );
267  this->m_recv_OutputPort[port].setObjName(portName.toChar());
268 #endif
269  }
270 #endif
271  }
272 
273 #if !FW_DIRECT_PORT_CALLS
274 
275  // ----------------------------------------------------------------------
276  // Getters for typed input ports
277  // ----------------------------------------------------------------------
278 
281  {
282  FW_ASSERT(
283  (0 <= portNum) && (portNum < this->getNum_recvReturnIn_InputPorts()),
284  static_cast<FwAssertArgType>(portNum)
285  );
286 
287  return &this->m_recvReturnIn_InputPort[portNum];
288  }
289 
292  {
293  FW_ASSERT(
294  (0 <= portNum) && (portNum < this->getNum_run_InputPorts()),
295  static_cast<FwAssertArgType>(portNum)
296  );
297 
298  return &this->m_run_InputPort[portNum];
299  }
300 
303  {
304  FW_ASSERT(
305  (0 <= portNum) && (portNum < this->getNum_send_InputPorts()),
306  static_cast<FwAssertArgType>(portNum)
307  );
308 
309  return &this->m_send_InputPort[portNum];
310  }
311 
312 #endif
313 
314 #if !FW_DIRECT_PORT_CALLS
315 
316  // ----------------------------------------------------------------------
317  // Connect input ports to special output ports
318  // ----------------------------------------------------------------------
319 
322  FwIndexType portNum,
323  Fw::InputLogPort* port
324  )
325  {
326  FW_ASSERT(
327  (0 <= portNum) && (portNum < this->getNum_Log_OutputPorts()),
328  static_cast<FwAssertArgType>(portNum)
329  );
330 
331  this->m_Log_OutputPort[portNum].addCallPort(port);
332  }
333 
334 #if FW_ENABLE_TEXT_LOGGING == 1
335 
336  void LinuxUartDriverComponentBase ::
337  set_LogText_OutputPort(
338  FwIndexType portNum,
340  )
341  {
342  FW_ASSERT(
343  (0 <= portNum) && (portNum < this->getNum_LogText_OutputPorts()),
344  static_cast<FwAssertArgType>(portNum)
345  );
346 
347  this->m_LogText_OutputPort[portNum].addCallPort(port);
348  }
349 
350 #endif
351 
354  FwIndexType portNum,
355  Fw::InputTimePort* port
356  )
357  {
358  FW_ASSERT(
359  (0 <= portNum) && (portNum < this->getNum_Time_OutputPorts()),
360  static_cast<FwAssertArgType>(portNum)
361  );
362 
363  this->m_Time_OutputPort[portNum].addCallPort(port);
364  }
365 
368  FwIndexType portNum,
369  Fw::InputTlmPort* port
370  )
371  {
372  FW_ASSERT(
373  (0 <= portNum) && (portNum < this->getNum_Tlm_OutputPorts()),
374  static_cast<FwAssertArgType>(portNum)
375  );
376 
377  this->m_Tlm_OutputPort[portNum].addCallPort(port);
378  }
379 
380 #endif
381 
382 #if !FW_DIRECT_PORT_CALLS
383 
384  // ----------------------------------------------------------------------
385  // Connect typed input ports to typed output ports
386  // ----------------------------------------------------------------------
387 
390  FwIndexType portNum,
392  )
393  {
394  FW_ASSERT(
395  (0 <= portNum) && (portNum < this->getNum_allocate_OutputPorts()),
396  static_cast<FwAssertArgType>(portNum)
397  );
398 
399  this->m_allocate_OutputPort[portNum].addCallPort(port);
400  }
401 
404  FwIndexType portNum,
406  )
407  {
408  FW_ASSERT(
409  (0 <= portNum) && (portNum < this->getNum_deallocate_OutputPorts()),
410  static_cast<FwAssertArgType>(portNum)
411  );
412 
413  this->m_deallocate_OutputPort[portNum].addCallPort(port);
414  }
415 
418  FwIndexType portNum,
420  )
421  {
422  FW_ASSERT(
423  (0 <= portNum) && (portNum < this->getNum_ready_OutputPorts()),
424  static_cast<FwAssertArgType>(portNum)
425  );
426 
427  this->m_ready_OutputPort[portNum].addCallPort(port);
428  }
429 
432  FwIndexType portNum,
434  )
435  {
436  FW_ASSERT(
437  (0 <= portNum) && (portNum < this->getNum_recv_OutputPorts()),
438  static_cast<FwAssertArgType>(portNum)
439  );
440 
441  this->m_recv_OutputPort[portNum].addCallPort(port);
442  }
443 
444 #endif
445 
446 #if !FW_DIRECT_PORT_CALLS && FW_PORT_SERIALIZATION
447 
448  // ----------------------------------------------------------------------
449  // Connect serial input ports to special output ports
450  // ----------------------------------------------------------------------
451 
454  FwIndexType portNum,
455  Fw::InputSerializePort* port
456  )
457  {
458  FW_ASSERT(
459  (0 <= portNum) && (portNum < this->getNum_Log_OutputPorts()),
460  static_cast<FwAssertArgType>(portNum)
461  );
462 
463  this->m_Log_OutputPort[portNum].registerSerialPort(port);
464  }
465 
466 #if FW_ENABLE_TEXT_LOGGING == 1
467 
468  void LinuxUartDriverComponentBase ::
469  set_LogText_OutputPort(
470  FwIndexType portNum,
471  Fw::InputSerializePort* port
472  )
473  {
474  FW_ASSERT(
475  (0 <= portNum) && (portNum < this->getNum_LogText_OutputPorts()),
476  static_cast<FwAssertArgType>(portNum)
477  );
478 
479  this->m_LogText_OutputPort[portNum].registerSerialPort(port);
480  }
481 
482 #endif
483 
486  FwIndexType portNum,
487  Fw::InputSerializePort* port
488  )
489  {
490  FW_ASSERT(
491  (0 <= portNum) && (portNum < this->getNum_Time_OutputPorts()),
492  static_cast<FwAssertArgType>(portNum)
493  );
494 
495  this->m_Time_OutputPort[portNum].registerSerialPort(port);
496  }
497 
500  FwIndexType portNum,
501  Fw::InputSerializePort* port
502  )
503  {
504  FW_ASSERT(
505  (0 <= portNum) && (portNum < this->getNum_Tlm_OutputPorts()),
506  static_cast<FwAssertArgType>(portNum)
507  );
508 
509  this->m_Tlm_OutputPort[portNum].registerSerialPort(port);
510  }
511 
512 #endif
513 
514 #if !FW_DIRECT_PORT_CALLS && FW_PORT_SERIALIZATION
515 
516  // ----------------------------------------------------------------------
517  // Connect serial input ports to typed output ports
518  // ----------------------------------------------------------------------
519 
522  FwIndexType portNum,
523  Fw::InputSerializePort* port
524  )
525  {
526  FW_ASSERT(
527  (0 <= portNum) && (portNum < this->getNum_deallocate_OutputPorts()),
528  static_cast<FwAssertArgType>(portNum)
529  );
530 
531  this->m_deallocate_OutputPort[portNum].registerSerialPort(port);
532  }
533 
536  FwIndexType portNum,
537  Fw::InputSerializePort* port
538  )
539  {
540  FW_ASSERT(
541  (0 <= portNum) && (portNum < this->getNum_ready_OutputPorts()),
542  static_cast<FwAssertArgType>(portNum)
543  );
544 
545  this->m_ready_OutputPort[portNum].registerSerialPort(port);
546  }
547 
550  FwIndexType portNum,
551  Fw::InputSerializePort* port
552  )
553  {
554  FW_ASSERT(
555  (0 <= portNum) && (portNum < this->getNum_recv_OutputPorts()),
556  static_cast<FwAssertArgType>(portNum)
557  );
558 
559  this->m_recv_OutputPort[portNum].registerSerialPort(port);
560  }
561 
562 #endif
563 
564  // ----------------------------------------------------------------------
565  // Component construction and destruction
566  // ----------------------------------------------------------------------
567 
569  LinuxUartDriverComponentBase(const char* compName) :
570  Fw::PassiveComponentBase(compName)
571  {
572  this->m_WriteErrorThrottle = 0;
573  this->m_ReadErrorThrottle = 0;
574  this->m_NoBuffersThrottle = 0;
575  }
576 
579  {
580 
581  }
582 
583 #if !FW_DIRECT_PORT_CALLS
584 
585  // ----------------------------------------------------------------------
586  // Connection status queries for special output ports
587  // ----------------------------------------------------------------------
588 
591  {
592  FW_ASSERT(
593  (0 <= portNum) && (portNum < this->getNum_Log_OutputPorts()),
594  static_cast<FwAssertArgType>(portNum)
595  );
596 
597  return this->m_Log_OutputPort[portNum].isConnected();
598  }
599 
600 #if FW_ENABLE_TEXT_LOGGING == 1
601 
602  bool LinuxUartDriverComponentBase ::
603  isConnected_LogText_OutputPort(FwIndexType portNum) const
604  {
605  FW_ASSERT(
606  (0 <= portNum) && (portNum < this->getNum_LogText_OutputPorts()),
607  static_cast<FwAssertArgType>(portNum)
608  );
609 
610  return this->m_LogText_OutputPort[portNum].isConnected();
611  }
612 
613 #endif
614 
617  {
618  FW_ASSERT(
619  (0 <= portNum) && (portNum < this->getNum_Time_OutputPorts()),
620  static_cast<FwAssertArgType>(portNum)
621  );
622 
623  return this->m_Time_OutputPort[portNum].isConnected();
624  }
625 
628  {
629  FW_ASSERT(
630  (0 <= portNum) && (portNum < this->getNum_Tlm_OutputPorts()),
631  static_cast<FwAssertArgType>(portNum)
632  );
633 
634  return this->m_Tlm_OutputPort[portNum].isConnected();
635  }
636 
637 #endif
638 
639 #if !FW_DIRECT_PORT_CALLS
640 
641  // ----------------------------------------------------------------------
642  // Connection status queries for typed output ports
643  // ----------------------------------------------------------------------
644 
647  {
648  FW_ASSERT(
649  (0 <= portNum) && (portNum < this->getNum_allocate_OutputPorts()),
650  static_cast<FwAssertArgType>(portNum)
651  );
652 
653  return this->m_allocate_OutputPort[portNum].isConnected();
654  }
655 
658  {
659  FW_ASSERT(
660  (0 <= portNum) && (portNum < this->getNum_deallocate_OutputPorts()),
661  static_cast<FwAssertArgType>(portNum)
662  );
663 
664  return this->m_deallocate_OutputPort[portNum].isConnected();
665  }
666 
669  {
670  FW_ASSERT(
671  (0 <= portNum) && (portNum < this->getNum_ready_OutputPorts()),
672  static_cast<FwAssertArgType>(portNum)
673  );
674 
675  return this->m_ready_OutputPort[portNum].isConnected();
676  }
677 
680  {
681  FW_ASSERT(
682  (0 <= portNum) && (portNum < this->getNum_recv_OutputPorts()),
683  static_cast<FwAssertArgType>(portNum)
684  );
685 
686  return this->m_recv_OutputPort[portNum].isConnected();
687  }
688 
689 #endif
690 
691  // ----------------------------------------------------------------------
692  // Port handler base-class functions for typed input ports
693  //
694  // Call these functions directly to bypass the corresponding ports
695  // ----------------------------------------------------------------------
696 
699  FwIndexType portNum,
700  Fw::Buffer& fwBuffer
701  )
702  {
703  // Make sure port number is valid
704  FW_ASSERT(
705  (0 <= portNum) && (portNum < this->getNum_recvReturnIn_InputPorts()),
706  static_cast<FwAssertArgType>(portNum)
707  );
708 
709  // Lock guard mutex before calling
710  this->lock();
711 
712  // Call handler function
713  this->recvReturnIn_handler(
714  portNum,
715  fwBuffer
716  );
717 
718  // Unlock guard mutex
719  this->unLock();
720  }
721 
724  FwIndexType portNum,
725  U32 context
726  )
727  {
728  // Make sure port number is valid
729  FW_ASSERT(
730  (0 <= portNum) && (portNum < this->getNum_run_InputPorts()),
731  static_cast<FwAssertArgType>(portNum)
732  );
733 
734  // Call handler function
735  this->run_handler(
736  portNum,
737  context
738  );
739  }
740 
743  FwIndexType portNum,
744  Fw::Buffer& sendBuffer
745  )
746  {
747  // Make sure port number is valid
748  FW_ASSERT(
749  (0 <= portNum) && (portNum < this->getNum_send_InputPorts()),
750  static_cast<FwAssertArgType>(portNum)
751  );
752 
753  Drv::ByteStreamStatus retVal;
754 
755  // Lock guard mutex before calling
756  this->lock();
757 
758  // Call handler function
759  retVal = this->send_handler(
760  portNum,
761  sendBuffer
762  );
763 
764  // Unlock guard mutex
765  this->unLock();
766 
767  return retVal;
768  }
769 
770 #if !FW_DIRECT_PORT_CALLS
771 
772  // ----------------------------------------------------------------------
773  // Invocation functions for typed output ports
774  // ----------------------------------------------------------------------
775 
778  FwIndexType portNum,
779  FwSizeType size
780  ) const
781  {
782  FW_ASSERT(
783  (0 <= portNum) && (portNum < this->getNum_allocate_OutputPorts()),
784  static_cast<FwAssertArgType>(portNum)
785  );
786 
787  FW_ASSERT(
788  this->m_allocate_OutputPort[portNum].isConnected(),
789  static_cast<FwAssertArgType>(portNum)
790  );
791  return this->m_allocate_OutputPort[portNum].invoke(
792  size
793  );
794  }
795 
798  FwIndexType portNum,
799  Fw::Buffer& fwBuffer
800  ) const
801  {
802  FW_ASSERT(
803  (0 <= portNum) && (portNum < this->getNum_deallocate_OutputPorts()),
804  static_cast<FwAssertArgType>(portNum)
805  );
806 
807  FW_ASSERT(
808  this->m_deallocate_OutputPort[portNum].isConnected(),
809  static_cast<FwAssertArgType>(portNum)
810  );
811  this->m_deallocate_OutputPort[portNum].invoke(
812  fwBuffer
813  );
814  }
815 
817  ready_out(FwIndexType portNum) const
818  {
819  FW_ASSERT(
820  (0 <= portNum) && (portNum < this->getNum_ready_OutputPorts()),
821  static_cast<FwAssertArgType>(portNum)
822  );
823 
824  FW_ASSERT(
825  this->m_ready_OutputPort[portNum].isConnected(),
826  static_cast<FwAssertArgType>(portNum)
827  );
828  this->m_ready_OutputPort[portNum].invoke();
829  }
830 
833  FwIndexType portNum,
834  Fw::Buffer& buffer,
835  const Drv::ByteStreamStatus& status
836  ) const
837  {
838  FW_ASSERT(
839  (0 <= portNum) && (portNum < this->getNum_recv_OutputPorts()),
840  static_cast<FwAssertArgType>(portNum)
841  );
842 
843  FW_ASSERT(
844  this->m_recv_OutputPort[portNum].isConnected(),
845  static_cast<FwAssertArgType>(portNum)
846  );
847  this->m_recv_OutputPort[portNum].invoke(
848  buffer,
849  status
850  );
851  }
852 
853 #endif
854 
855  // ----------------------------------------------------------------------
856  // Event logging functions
857  // ----------------------------------------------------------------------
858 
861  const Fw::StringBase& device,
862  I32 error,
863  const Fw::StringBase& name
864  ) const
865  {
866  // Get the time
867  Fw::Time _logTime;
868  if (this->isConnected_Time_OutputPort(0)) {
869  this->Time_out(0, _logTime);
870  }
871 
872  const FwEventIdType _id = this->getIdBase() + EVENTID_OPENERROR;
873 
874  // Emit the event on the log port
875  if (this->isConnected_Log_OutputPort(0)) {
876  Fw::LogBuffer _logBuff;
878 
879 #if FW_AMPCS_COMPATIBLE
880  // Serialize the number of arguments
881  _status = _logBuff.serializeFrom(static_cast<U8>(3));
882  FW_ASSERT(
883  _status == Fw::FW_SERIALIZE_OK,
884  static_cast<FwAssertArgType>(_status)
885  );
886 #endif
887 
888  _status = device.serializeTo(
889  _logBuff,
890  FW_MIN(static_cast<FwSizeType>(FW_LOG_STRING_MAX_SIZE), 40)
891  );
892  FW_ASSERT(
893  _status == Fw::FW_SERIALIZE_OK,
894  static_cast<FwAssertArgType>(_status)
895  );
896 
897 #if FW_AMPCS_COMPATIBLE
898  // Serialize the argument size
899  _status = _logBuff.serializeFrom(
900  static_cast<U8>(sizeof(I32))
901  );
902  FW_ASSERT(
903  _status == Fw::FW_SERIALIZE_OK,
904  static_cast<FwAssertArgType>(_status)
905  );
906 #endif
907  _status = _logBuff.serializeFrom(error);
908  FW_ASSERT(
909  _status == Fw::FW_SERIALIZE_OK,
910  static_cast<FwAssertArgType>(_status)
911  );
912 
913  _status = name.serializeTo(
914  _logBuff,
915  FW_MIN(static_cast<FwSizeType>(FW_LOG_STRING_MAX_SIZE), 40)
916  );
917  FW_ASSERT(
918  _status == Fw::FW_SERIALIZE_OK,
919  static_cast<FwAssertArgType>(_status)
920  );
921 
922  this->Log_out(
923  0,
924  _id,
925  _logTime,
927  _logBuff
928  );
929  }
930 
931  // Emit the event on the text log port
932 #if FW_ENABLE_TEXT_LOGGING
933  if (this->isConnected_LogText_OutputPort(0)) {
934 #if FW_OBJECT_NAMES == 1
935  const char* _formatString =
936  "(%s) %s: Error opening UART device %s: %" PRIi32 " %s";
937 #else
938  const char* _formatString =
939  "%s: Error opening UART device %s: %" PRIi32 " %s";
940 #endif
941 
942  Fw::TextLogString _logString;
943  _logString.format(
944  _formatString,
945 #if FW_OBJECT_NAMES == 1
946  this->m_objName.toChar(),
947 #endif
948  "OpenError ",
949  device.toChar(),
950  error,
951  name.toChar()
952  );
953 
954  this->LogText_out(
955  0,
956  _id,
957  _logTime,
959  _logString
960  );
961  }
962 #endif
963  }
964 
967  const Fw::StringBase& device,
968  I32 error
969  ) const
970  {
971  // Get the time
972  Fw::Time _logTime;
973  if (this->isConnected_Time_OutputPort(0)) {
974  this->Time_out(0, _logTime);
975  }
976 
977  const FwEventIdType _id = this->getIdBase() + EVENTID_CONFIGERROR;
978 
979  // Emit the event on the log port
980  if (this->isConnected_Log_OutputPort(0)) {
981  Fw::LogBuffer _logBuff;
983 
984 #if FW_AMPCS_COMPATIBLE
985  // Serialize the number of arguments
986  _status = _logBuff.serializeFrom(static_cast<U8>(2));
987  FW_ASSERT(
988  _status == Fw::FW_SERIALIZE_OK,
989  static_cast<FwAssertArgType>(_status)
990  );
991 #endif
992 
993  _status = device.serializeTo(
994  _logBuff,
995  FW_MIN(static_cast<FwSizeType>(FW_LOG_STRING_MAX_SIZE), 40)
996  );
997  FW_ASSERT(
998  _status == Fw::FW_SERIALIZE_OK,
999  static_cast<FwAssertArgType>(_status)
1000  );
1001 
1002 #if FW_AMPCS_COMPATIBLE
1003  // Serialize the argument size
1004  _status = _logBuff.serializeFrom(
1005  static_cast<U8>(sizeof(I32))
1006  );
1007  FW_ASSERT(
1008  _status == Fw::FW_SERIALIZE_OK,
1009  static_cast<FwAssertArgType>(_status)
1010  );
1011 #endif
1012  _status = _logBuff.serializeFrom(error);
1013  FW_ASSERT(
1014  _status == Fw::FW_SERIALIZE_OK,
1015  static_cast<FwAssertArgType>(_status)
1016  );
1017 
1018  this->Log_out(
1019  0,
1020  _id,
1021  _logTime,
1023  _logBuff
1024  );
1025  }
1026 
1027  // Emit the event on the text log port
1028 #if FW_ENABLE_TEXT_LOGGING
1029  if (this->isConnected_LogText_OutputPort(0)) {
1030 #if FW_OBJECT_NAMES == 1
1031  const char* _formatString =
1032  "(%s) %s: Error configuring UART device %s: %" PRIi32 "";
1033 #else
1034  const char* _formatString =
1035  "%s: Error configuring UART device %s: %" PRIi32 "";
1036 #endif
1037 
1038  Fw::TextLogString _logString;
1039  _logString.format(
1040  _formatString,
1041 #if FW_OBJECT_NAMES == 1
1042  this->m_objName.toChar(),
1043 #endif
1044  "ConfigError ",
1045  device.toChar(),
1046  error
1047  );
1048 
1049  this->LogText_out(
1050  0,
1051  _id,
1052  _logTime,
1054  _logString
1055  );
1056  }
1057 #endif
1058  }
1059 
1062  const Fw::StringBase& device,
1063  I32 error
1064  )
1065  {
1066  // Check throttle value
1067  if (this->m_WriteErrorThrottle >= EVENTID_WRITEERROR_THROTTLE) {
1068  return;
1069  }
1070  else {
1071  this->m_WriteErrorThrottle++;
1072  }
1073 
1074  // Get the time
1075  Fw::Time _logTime;
1076  if (this->isConnected_Time_OutputPort(0)) {
1077  this->Time_out(0, _logTime);
1078  }
1079 
1080  const FwEventIdType _id = this->getIdBase() + EVENTID_WRITEERROR;
1081 
1082  // Emit the event on the log port
1083  if (this->isConnected_Log_OutputPort(0)) {
1084  Fw::LogBuffer _logBuff;
1086 
1087 #if FW_AMPCS_COMPATIBLE
1088  // Serialize the number of arguments
1089  _status = _logBuff.serializeFrom(static_cast<U8>(2));
1090  FW_ASSERT(
1091  _status == Fw::FW_SERIALIZE_OK,
1092  static_cast<FwAssertArgType>(_status)
1093  );
1094 #endif
1095 
1096  _status = device.serializeTo(
1097  _logBuff,
1098  FW_MIN(static_cast<FwSizeType>(FW_LOG_STRING_MAX_SIZE), 40)
1099  );
1100  FW_ASSERT(
1101  _status == Fw::FW_SERIALIZE_OK,
1102  static_cast<FwAssertArgType>(_status)
1103  );
1104 
1105 #if FW_AMPCS_COMPATIBLE
1106  // Serialize the argument size
1107  _status = _logBuff.serializeFrom(
1108  static_cast<U8>(sizeof(I32))
1109  );
1110  FW_ASSERT(
1111  _status == Fw::FW_SERIALIZE_OK,
1112  static_cast<FwAssertArgType>(_status)
1113  );
1114 #endif
1115  _status = _logBuff.serializeFrom(error);
1116  FW_ASSERT(
1117  _status == Fw::FW_SERIALIZE_OK,
1118  static_cast<FwAssertArgType>(_status)
1119  );
1120 
1121  this->Log_out(
1122  0,
1123  _id,
1124  _logTime,
1126  _logBuff
1127  );
1128  }
1129 
1130  // Emit the event on the text log port
1131 #if FW_ENABLE_TEXT_LOGGING
1132  if (this->isConnected_LogText_OutputPort(0)) {
1133 #if FW_OBJECT_NAMES == 1
1134  const char* _formatString =
1135  "(%s) %s: Error writing UART device %s: %" PRIi32 "";
1136 #else
1137  const char* _formatString =
1138  "%s: Error writing UART device %s: %" PRIi32 "";
1139 #endif
1140 
1141  Fw::TextLogString _logString;
1142  _logString.format(
1143  _formatString,
1144 #if FW_OBJECT_NAMES == 1
1145  this->m_objName.toChar(),
1146 #endif
1147  "WriteError ",
1148  device.toChar(),
1149  error
1150  );
1151 
1152  this->LogText_out(
1153  0,
1154  _id,
1155  _logTime,
1157  _logString
1158  );
1159  }
1160 #endif
1161  }
1162 
1165  const Fw::StringBase& device,
1166  I32 error
1167  )
1168  {
1169  // Check throttle value
1170  if (this->m_ReadErrorThrottle >= EVENTID_READERROR_THROTTLE) {
1171  return;
1172  }
1173  else {
1174  this->m_ReadErrorThrottle++;
1175  }
1176 
1177  // Get the time
1178  Fw::Time _logTime;
1179  if (this->isConnected_Time_OutputPort(0)) {
1180  this->Time_out(0, _logTime);
1181  }
1182 
1183  const FwEventIdType _id = this->getIdBase() + EVENTID_READERROR;
1184 
1185  // Emit the event on the log port
1186  if (this->isConnected_Log_OutputPort(0)) {
1187  Fw::LogBuffer _logBuff;
1189 
1190 #if FW_AMPCS_COMPATIBLE
1191  // Serialize the number of arguments
1192  _status = _logBuff.serializeFrom(static_cast<U8>(2));
1193  FW_ASSERT(
1194  _status == Fw::FW_SERIALIZE_OK,
1195  static_cast<FwAssertArgType>(_status)
1196  );
1197 #endif
1198 
1199  _status = device.serializeTo(
1200  _logBuff,
1201  FW_MIN(static_cast<FwSizeType>(FW_LOG_STRING_MAX_SIZE), 40)
1202  );
1203  FW_ASSERT(
1204  _status == Fw::FW_SERIALIZE_OK,
1205  static_cast<FwAssertArgType>(_status)
1206  );
1207 
1208 #if FW_AMPCS_COMPATIBLE
1209  // Serialize the argument size
1210  _status = _logBuff.serializeFrom(
1211  static_cast<U8>(sizeof(I32))
1212  );
1213  FW_ASSERT(
1214  _status == Fw::FW_SERIALIZE_OK,
1215  static_cast<FwAssertArgType>(_status)
1216  );
1217 #endif
1218  _status = _logBuff.serializeFrom(error);
1219  FW_ASSERT(
1220  _status == Fw::FW_SERIALIZE_OK,
1221  static_cast<FwAssertArgType>(_status)
1222  );
1223 
1224  this->Log_out(
1225  0,
1226  _id,
1227  _logTime,
1229  _logBuff
1230  );
1231  }
1232 
1233  // Emit the event on the text log port
1234 #if FW_ENABLE_TEXT_LOGGING
1235  if (this->isConnected_LogText_OutputPort(0)) {
1236 #if FW_OBJECT_NAMES == 1
1237  const char* _formatString =
1238  "(%s) %s: Error reading UART device %s: %" PRIi32 "";
1239 #else
1240  const char* _formatString =
1241  "%s: Error reading UART device %s: %" PRIi32 "";
1242 #endif
1243 
1244  Fw::TextLogString _logString;
1245  _logString.format(
1246  _formatString,
1247 #if FW_OBJECT_NAMES == 1
1248  this->m_objName.toChar(),
1249 #endif
1250  "ReadError ",
1251  device.toChar(),
1252  error
1253  );
1254 
1255  this->LogText_out(
1256  0,
1257  _id,
1258  _logTime,
1260  _logString
1261  );
1262  }
1263 #endif
1264  }
1265 
1268  {
1269  // Get the time
1270  Fw::Time _logTime;
1271  if (this->isConnected_Time_OutputPort(0)) {
1272  this->Time_out(0, _logTime);
1273  }
1274 
1275  const FwEventIdType _id = this->getIdBase() + EVENTID_PORTOPENED;
1276 
1277  // Emit the event on the log port
1278  if (this->isConnected_Log_OutputPort(0)) {
1279  Fw::LogBuffer _logBuff;
1281 
1282 #if FW_AMPCS_COMPATIBLE
1283  // Serialize the number of arguments
1284  _status = _logBuff.serializeFrom(static_cast<U8>(1));
1285  FW_ASSERT(
1286  _status == Fw::FW_SERIALIZE_OK,
1287  static_cast<FwAssertArgType>(_status)
1288  );
1289 #endif
1290 
1291  _status = device.serializeTo(
1292  _logBuff,
1293  FW_MIN(static_cast<FwSizeType>(FW_LOG_STRING_MAX_SIZE), 40)
1294  );
1295  FW_ASSERT(
1296  _status == Fw::FW_SERIALIZE_OK,
1297  static_cast<FwAssertArgType>(_status)
1298  );
1299 
1300  this->Log_out(
1301  0,
1302  _id,
1303  _logTime,
1305  _logBuff
1306  );
1307  }
1308 
1309  // Emit the event on the text log port
1310 #if FW_ENABLE_TEXT_LOGGING
1311  if (this->isConnected_LogText_OutputPort(0)) {
1312 #if FW_OBJECT_NAMES == 1
1313  const char* _formatString =
1314  "(%s) %s: UART Device %s configured";
1315 #else
1316  const char* _formatString =
1317  "%s: UART Device %s configured";
1318 #endif
1319 
1320  Fw::TextLogString _logString;
1321  _logString.format(
1322  _formatString,
1323 #if FW_OBJECT_NAMES == 1
1324  this->m_objName.toChar(),
1325 #endif
1326  "PortOpened ",
1327  device.toChar()
1328  );
1329 
1330  this->LogText_out(
1331  0,
1332  _id,
1333  _logTime,
1335  _logString
1336  );
1337  }
1338 #endif
1339  }
1340 
1343  {
1344  // Check throttle value
1345  if (this->m_NoBuffersThrottle >= EVENTID_NOBUFFERS_THROTTLE) {
1346  return;
1347  }
1348  else {
1349  this->m_NoBuffersThrottle++;
1350  }
1351 
1352  // Get the time
1353  Fw::Time _logTime;
1354  if (this->isConnected_Time_OutputPort(0)) {
1355  this->Time_out(0, _logTime);
1356  }
1357 
1358  const FwEventIdType _id = this->getIdBase() + EVENTID_NOBUFFERS;
1359 
1360  // Emit the event on the log port
1361  if (this->isConnected_Log_OutputPort(0)) {
1362  Fw::LogBuffer _logBuff;
1364 
1365 #if FW_AMPCS_COMPATIBLE
1366  // Serialize the number of arguments
1367  _status = _logBuff.serializeFrom(static_cast<U8>(1));
1368  FW_ASSERT(
1369  _status == Fw::FW_SERIALIZE_OK,
1370  static_cast<FwAssertArgType>(_status)
1371  );
1372 #endif
1373 
1374  _status = device.serializeTo(
1375  _logBuff,
1376  FW_MIN(static_cast<FwSizeType>(FW_LOG_STRING_MAX_SIZE), 40)
1377  );
1378  FW_ASSERT(
1379  _status == Fw::FW_SERIALIZE_OK,
1380  static_cast<FwAssertArgType>(_status)
1381  );
1382 
1383  this->Log_out(
1384  0,
1385  _id,
1386  _logTime,
1388  _logBuff
1389  );
1390  }
1391 
1392  // Emit the event on the text log port
1393 #if FW_ENABLE_TEXT_LOGGING
1394  if (this->isConnected_LogText_OutputPort(0)) {
1395 #if FW_OBJECT_NAMES == 1
1396  const char* _formatString =
1397  "(%s) %s: UART Device %s ran out of buffers";
1398 #else
1399  const char* _formatString =
1400  "%s: UART Device %s ran out of buffers";
1401 #endif
1402 
1403  Fw::TextLogString _logString;
1404  _logString.format(
1405  _formatString,
1406 #if FW_OBJECT_NAMES == 1
1407  this->m_objName.toChar(),
1408 #endif
1409  "NoBuffers ",
1410  device.toChar()
1411  );
1412 
1413  this->LogText_out(
1414  0,
1415  _id,
1416  _logTime,
1418  _logString
1419  );
1420  }
1421 #endif
1422  }
1423 
1426  const Fw::StringBase& device,
1427  U32 size,
1428  U32 needed
1429  ) const
1430  {
1431  // Get the time
1432  Fw::Time _logTime;
1433  if (this->isConnected_Time_OutputPort(0)) {
1434  this->Time_out(0, _logTime);
1435  }
1436 
1437  const FwEventIdType _id = this->getIdBase() + EVENTID_BUFFERTOOSMALL;
1438 
1439  // Emit the event on the log port
1440  if (this->isConnected_Log_OutputPort(0)) {
1441  Fw::LogBuffer _logBuff;
1443 
1444 #if FW_AMPCS_COMPATIBLE
1445  // Serialize the number of arguments
1446  _status = _logBuff.serializeFrom(static_cast<U8>(3));
1447  FW_ASSERT(
1448  _status == Fw::FW_SERIALIZE_OK,
1449  static_cast<FwAssertArgType>(_status)
1450  );
1451 #endif
1452 
1453  _status = device.serializeTo(
1454  _logBuff,
1455  FW_MIN(static_cast<FwSizeType>(FW_LOG_STRING_MAX_SIZE), 40)
1456  );
1457  FW_ASSERT(
1458  _status == Fw::FW_SERIALIZE_OK,
1459  static_cast<FwAssertArgType>(_status)
1460  );
1461 
1462 #if FW_AMPCS_COMPATIBLE
1463  // Serialize the argument size
1464  _status = _logBuff.serializeFrom(
1465  static_cast<U8>(sizeof(U32))
1466  );
1467  FW_ASSERT(
1468  _status == Fw::FW_SERIALIZE_OK,
1469  static_cast<FwAssertArgType>(_status)
1470  );
1471 #endif
1472  _status = _logBuff.serializeFrom(size);
1473  FW_ASSERT(
1474  _status == Fw::FW_SERIALIZE_OK,
1475  static_cast<FwAssertArgType>(_status)
1476  );
1477 
1478 #if FW_AMPCS_COMPATIBLE
1479  // Serialize the argument size
1480  _status = _logBuff.serializeFrom(
1481  static_cast<U8>(sizeof(U32))
1482  );
1483  FW_ASSERT(
1484  _status == Fw::FW_SERIALIZE_OK,
1485  static_cast<FwAssertArgType>(_status)
1486  );
1487 #endif
1488  _status = _logBuff.serializeFrom(needed);
1489  FW_ASSERT(
1490  _status == Fw::FW_SERIALIZE_OK,
1491  static_cast<FwAssertArgType>(_status)
1492  );
1493 
1494  this->Log_out(
1495  0,
1496  _id,
1497  _logTime,
1499  _logBuff
1500  );
1501  }
1502 
1503  // Emit the event on the text log port
1504 #if FW_ENABLE_TEXT_LOGGING
1505  if (this->isConnected_LogText_OutputPort(0)) {
1506 #if FW_OBJECT_NAMES == 1
1507  const char* _formatString =
1508  "(%s) %s: UART Device %s target buffer too small. Size: %" PRIu32 " Needs: %" PRIu32 "";
1509 #else
1510  const char* _formatString =
1511  "%s: UART Device %s target buffer too small. Size: %" PRIu32 " Needs: %" PRIu32 "";
1512 #endif
1513 
1514  Fw::TextLogString _logString;
1515  _logString.format(
1516  _formatString,
1517 #if FW_OBJECT_NAMES == 1
1518  this->m_objName.toChar(),
1519 #endif
1520  "BufferTooSmall ",
1521  device.toChar(),
1522  size,
1523  needed
1524  );
1525 
1526  this->LogText_out(
1527  0,
1528  _id,
1529  _logTime,
1531  _logString
1532  );
1533  }
1534 #endif
1535  }
1536 
1537  // ----------------------------------------------------------------------
1538  // Event throttle reset functions
1539  // ----------------------------------------------------------------------
1540 
1543  {
1544  // Reset throttle counter
1545  this->m_WriteErrorThrottle = 0;
1546  }
1547 
1550  {
1551  // Reset throttle counter
1552  this->m_ReadErrorThrottle = 0;
1553  }
1554 
1557  {
1558  // Reset throttle counter
1559  this->m_NoBuffersThrottle = 0;
1560  }
1561 
1562  // ----------------------------------------------------------------------
1563  // Telemetry serialized write
1564  // ----------------------------------------------------------------------
1565 
1568  FwChanIdType id,
1569  Fw::TlmBuffer& _tlmBuff,
1570  Fw::Time _tlmTime
1571  ) const
1572  {
1573  if (this->isConnected_Tlm_OutputPort(0)) {
1574  if (
1575  this->isConnected_Time_OutputPort(0) &&
1576  (_tlmTime == Fw::ZERO_TIME)
1577  ) {
1578  this->Time_out(0, _tlmTime);
1579  }
1580 
1581  FwChanIdType _id;
1582  _id = this->getIdBase() + id;
1583 
1584  this->Tlm_out(
1585  0,
1586  _id,
1587  _tlmTime,
1588  _tlmBuff
1589  );
1590  }
1591  }
1592 
1593  // ----------------------------------------------------------------------
1594  // Telemetry write functions
1595  // ----------------------------------------------------------------------
1596 
1599  FwSizeType arg,
1600  Fw::Time _tlmTime
1601  ) const
1602  {
1603  if (this->isConnected_Tlm_OutputPort(0)) {
1604  Fw::TlmBuffer _tlmBuff;
1605  Fw::SerializeStatus _stat = _tlmBuff.serializeFrom(arg);
1606  FW_ASSERT(
1607  _stat == Fw::FW_SERIALIZE_OK,
1608  static_cast<FwAssertArgType>(_stat)
1609  );
1610 
1611  this->tlmWrite(
1613  _tlmBuff,
1614  _tlmTime
1615  );
1616  }
1617  }
1618 
1621  FwSizeType arg,
1622  Fw::Time _tlmTime
1623  ) const
1624  {
1625  if (this->isConnected_Tlm_OutputPort(0)) {
1626  Fw::TlmBuffer _tlmBuff;
1627  Fw::SerializeStatus _stat = _tlmBuff.serializeFrom(arg);
1628  FW_ASSERT(
1629  _stat == Fw::FW_SERIALIZE_OK,
1630  static_cast<FwAssertArgType>(_stat)
1631  );
1632 
1633  this->tlmWrite(
1635  _tlmBuff,
1636  _tlmTime
1637  );
1638  }
1639  }
1640 
1641  // ----------------------------------------------------------------------
1642  // Time
1643  // ----------------------------------------------------------------------
1644 
1646  getTime() const
1647  {
1648  if (this->isConnected_Time_OutputPort(0)) {
1649  Fw::Time _time;
1650  this->Time_out(0, _time);
1651  return _time;
1652  }
1653  else {
1654  return Fw::Time(TimeBase::TB_NONE, 0, 0);
1655  }
1656  }
1657 
1658  // ----------------------------------------------------------------------
1659  // Mutex operations for guarded ports
1660  //
1661  // You can override these operations to provide more sophisticated
1662  // synchronization
1663  // ----------------------------------------------------------------------
1664 
1667  {
1668  this->m_guardedPortMutex.lock();
1669  }
1670 
1673  {
1674  this->m_guardedPortMutex.unLock();
1675  }
1676 
1677  // ----------------------------------------------------------------------
1678  // Calls for messages received on typed input ports
1679  // ----------------------------------------------------------------------
1680 
1681  void LinuxUartDriverComponentBase ::
1682  m_p_recvReturnIn_in(
1683  Fw::PassiveComponentBase* callComp,
1684  FwIndexType portNum,
1685  Fw::Buffer& fwBuffer
1686  )
1687  {
1688  FW_ASSERT(callComp);
1689  LinuxUartDriverComponentBase* compPtr = static_cast<LinuxUartDriverComponentBase*>(callComp);
1690  compPtr->recvReturnIn_handlerBase(
1691  portNum,
1692  fwBuffer
1693  );
1694  }
1695 
1696  void LinuxUartDriverComponentBase ::
1697  m_p_run_in(
1698  Fw::PassiveComponentBase* callComp,
1699  FwIndexType portNum,
1700  U32 context
1701  )
1702  {
1703  FW_ASSERT(callComp);
1704  LinuxUartDriverComponentBase* compPtr = static_cast<LinuxUartDriverComponentBase*>(callComp);
1705  compPtr->run_handlerBase(
1706  portNum,
1707  context
1708  );
1709  }
1710 
1711  Drv::ByteStreamStatus LinuxUartDriverComponentBase ::
1712  m_p_send_in(
1713  Fw::PassiveComponentBase* callComp,
1714  FwIndexType portNum,
1715  Fw::Buffer& sendBuffer
1716  )
1717  {
1718  FW_ASSERT(callComp);
1719  LinuxUartDriverComponentBase* compPtr = static_cast<LinuxUartDriverComponentBase*>(callComp);
1720  return compPtr->send_handlerBase(
1721  portNum,
1722  sendBuffer
1723  );
1724  }
1725 
1726 #if !FW_DIRECT_PORT_CALLS
1727 
1728  // ----------------------------------------------------------------------
1729  // Invocation functions for special output ports
1730  // ----------------------------------------------------------------------
1731 
1732  void LinuxUartDriverComponentBase ::
1733  Log_out(
1734  FwIndexType portNum,
1735  FwEventIdType id,
1736  Fw::Time& timeTag,
1737  const Fw::LogSeverity& severity,
1738  Fw::LogBuffer& args
1739  ) const
1740  {
1741  FW_ASSERT(
1742  (0 <= portNum) && (portNum < this->getNum_Log_OutputPorts()),
1743  static_cast<FwAssertArgType>(portNum)
1744  );
1745 
1746  FW_ASSERT(
1747  this->m_Log_OutputPort[portNum].isConnected(),
1748  static_cast<FwAssertArgType>(portNum)
1749  );
1750  this->m_Log_OutputPort[portNum].invoke(
1751  id,
1752  timeTag,
1753  severity,
1754  args
1755  );
1756  }
1757 
1758 #if FW_ENABLE_TEXT_LOGGING
1759 
1760  void LinuxUartDriverComponentBase ::
1761  LogText_out(
1762  FwIndexType portNum,
1763  FwEventIdType id,
1764  Fw::Time& timeTag,
1765  const Fw::LogSeverity& severity,
1766  Fw::TextLogString& text
1767  ) const
1768  {
1769  FW_ASSERT(
1770  (0 <= portNum) && (portNum < this->getNum_LogText_OutputPorts()),
1771  static_cast<FwAssertArgType>(portNum)
1772  );
1773 
1774  FW_ASSERT(
1775  this->m_LogText_OutputPort[portNum].isConnected(),
1776  static_cast<FwAssertArgType>(portNum)
1777  );
1778  this->m_LogText_OutputPort[portNum].invoke(
1779  id,
1780  timeTag,
1781  severity,
1782  text
1783  );
1784  }
1785 
1786 #endif
1787 
1788  void LinuxUartDriverComponentBase ::
1789  Time_out(
1790  FwIndexType portNum,
1791  Fw::Time& time
1792  ) const
1793  {
1794  FW_ASSERT(
1795  (0 <= portNum) && (portNum < this->getNum_Time_OutputPorts()),
1796  static_cast<FwAssertArgType>(portNum)
1797  );
1798 
1799  FW_ASSERT(
1800  this->m_Time_OutputPort[portNum].isConnected(),
1801  static_cast<FwAssertArgType>(portNum)
1802  );
1803  this->m_Time_OutputPort[portNum].invoke(
1804  time
1805  );
1806  }
1807 
1808  void LinuxUartDriverComponentBase ::
1809  Tlm_out(
1810  FwIndexType portNum,
1811  FwChanIdType id,
1812  Fw::Time& timeTag,
1813  Fw::TlmBuffer& val
1814  ) const
1815  {
1816  FW_ASSERT(
1817  (0 <= portNum) && (portNum < this->getNum_Tlm_OutputPorts()),
1818  static_cast<FwAssertArgType>(portNum)
1819  );
1820 
1821  FW_ASSERT(
1822  this->m_Tlm_OutputPort[portNum].isConnected(),
1823  static_cast<FwAssertArgType>(portNum)
1824  );
1825  this->m_Tlm_OutputPort[portNum].invoke(
1826  id,
1827  timeTag,
1828  val
1829  );
1830  }
1831 
1832 #endif
1833 
1834 }
virtual void lock()
Lock the guarded mutex.
Serialization/Deserialization operation was successful.
virtual void unLock()
Unlock the guarded mutex.
void ready_out(FwIndexType portNum) const
Invoke output port ready.
void addCallPort(InputTimePort *callPort)
Register an input port.
Definition: TimePortAc.cpp:157
void addCallPort(InputByteStreamReadyPort *callPort)
Register an input port.
void log_WARNING_HI_BufferTooSmall(const Fw::StringBase &device, U32 size, U32 needed) const
static constexpr FwIndexType getNum_deallocate_OutputPorts()
SerializeStatus serializeFrom(U8 val, Endianness mode=Endianness::BIG) override
Serialize an 8-bit unsigned integer value.
void recvReturnIn_handlerBase(FwIndexType portNum, Fw::Buffer &fwBuffer)
Handler base-class function for input port recvReturnIn.
PlatformSizeType FwSizeType
Drv::ByteStreamStatus send_handlerBase(FwIndexType portNum, Fw::Buffer &sendBuffer)
Handler base-class function for input port send.
I32 FwEnumStoreType
Drv::InputByteStreamSendPort * get_send_InputPort(FwIndexType portNum)
void set_Tlm_OutputPort(FwIndexType portNum, Fw::InputTlmPort *port)
Connect port to Tlm[portNum].
void init()
Initialization function.
Definition: SchedPortAc.cpp:73
void addCallComp(Fw::PassiveComponentBase *callComp, CompFuncPtr funcPtr)
Register a component.
virtual void recvReturnIn_handler(FwIndexType portNum, Fw::Buffer &fwBuffer)=0
Handler for input port recvReturnIn.
static constexpr FwIndexType getNum_recv_OutputPorts()
void unLock()
unlock the mutex and assert success
Definition: Mutex.cpp:41
void tlmWrite_BytesRecv(FwSizeType arg, Fw::Time _tlmTime=Fw::Time()) const
bool isConnected_ready_OutputPort(FwIndexType portNum) const
virtual const CHAR * toChar() const =0
Convert to a C-style char*.
const Time ZERO_TIME
Definition: Time.cpp:5
void recv_out(FwIndexType portNum, Fw::Buffer &buffer, const Drv::ByteStreamStatus &status) const
Invoke output port recv.
bool isConnected_Log_OutputPort(FwIndexType portNum) const
LinuxUartDriverComponentBase(const char *compName="")
Construct LinuxUartDriverComponentBase object.
bool isConnected_allocate_OutputPort(FwIndexType portNum) const
void init()
Initialization function.
Definition: TlmPortAc.cpp:171
Auto-generated base for LinuxUartDriver component.
No time base has been established (Required)
static constexpr FwIndexType getNum_Log_OutputPorts()
void log_WARNING_HI_WriteError(const Fw::StringBase &device, I32 error)
void addCallPort(InputTlmPort *callPort)
Register an input port.
Definition: TlmPortAc.cpp:177
void set_ready_OutputPort(FwIndexType portNum, Drv::InputByteStreamReadyPort *port)
Connect port to ready[portNum].
void init()
Object initializer.
Definition: ObjBase.cpp:24
void log_WARNING_HI_ReadError(const Fw::StringBase &device, I32 error)
SerializeStatus
forward declaration for string
void addCallPort(InputBufferGetPort *callPort)
Register an input port.
void addCallPort(InputByteStreamDataPort *callPort)
Register an input port.
Fw::InputBufferSendPort * get_recvReturnIn_InputPort(FwIndexType portNum)
FwIdType FwEventIdType
The type of an event identifier.
void deallocate_out(FwIndexType portNum, Fw::Buffer &fwBuffer) const
Invoke output port deallocate.
Status returned by the send call.
#define FW_OBJECT_NAMES
Indicates whether or not object names are stored (more memory, can be used for tracking objects) ...
Definition: FpConfig.h:40
void init()
Initialization function.
Definition: TimePortAc.cpp:151
static constexpr FwIndexType getNum_ready_OutputPorts()
#define FW_MIN(a, b)
MIN macro (deprecated in C++, use std::min)
Definition: BasicTypes.h:94
void invoke(Fw::Buffer &buffer, const Drv::ByteStreamStatus &status) const
Invoke a port connection.
void invoke(Fw::Buffer &fwBuffer) const
Invoke a port connection.
void init()
Initialization function.
void addCallPort(InputBufferSendPort *callPort)
Register an input port.
void invoke(Fw::Time &time) const
Invoke a port connection.
Definition: TimePortAc.cpp:170
static constexpr FwIndexType getNum_recvReturnIn_InputPorts()
void set_Log_OutputPort(FwIndexType portNum, Fw::InputLogPort *port)
Connect port to Log[portNum].
void log_WARNING_HI_WriteError_ThrottleClear()
Reset throttle value for WriteError.
const char * toChar() const
Convert to a C-style char*.
Definition: ObjectName.hpp:50
FwIdType FwChanIdType
The type of a telemetry channel identifier.
void log_WARNING_HI_OpenError(const Fw::StringBase &device, I32 error, const Fw::StringBase &name) const
static constexpr FwIndexType getNum_run_InputPorts()
virtual Drv::ByteStreamStatus send_handler(FwIndexType portNum, Fw::Buffer &sendBuffer)=0
Handler for input port send.
A serious but recoverable event.
void log_ACTIVITY_HI_PortOpened(const Fw::StringBase &device) const
void invoke(FwChanIdType id, Fw::Time &timeTag, Fw::TlmBuffer &val) const
Invoke a port connection.
Definition: TlmPortAc.cpp:190
bool isConnected() const
Definition: PortBase.cpp:38
Enum representing event severity.
void set_allocate_OutputPort(FwIndexType portNum, Fw::InputBufferGetPort *port)
Connect port to allocate[portNum].
#define PRI_FwIndexType
FormatStatus format(const CHAR *formatString,...)
write formatted string to buffer
Definition: StringBase.cpp:39
void init()
Initialization function.
Definition: LogPortAc.cpp:180
void log_WARNING_HI_NoBuffers(const Fw::StringBase &device)
void setPortNum(FwIndexType portNum)
bool isConnected_deallocate_OutputPort(FwIndexType portNum) const
void tlmWrite(FwChanIdType id, Fw::TlmBuffer &_tlmBuff, Fw::Time _tlmTime=Fw::Time()) const
void addCallComp(Fw::PassiveComponentBase *callComp, CompFuncPtr funcPtr)
Register a component.
static constexpr FwIndexType getNum_allocate_OutputPorts()
static constexpr FwIndexType getNum_Time_OutputPorts()
Fw::Buffer invoke(FwSizeType size) const
static constexpr FwIndexType getNum_Tlm_OutputPorts()
virtual void run_handler(FwIndexType portNum, U32 context)=0
Handler for input port run.
Important informational events.
Svc::InputSchedPort * get_run_InputPort(FwIndexType portNum)
void init()
Initialization function.
void addCallComp(Fw::PassiveComponentBase *callComp, CompFuncPtr funcPtr)
Register a component.
Definition: SchedPortAc.cpp:79
void invoke(FwEventIdType id, Fw::Time &timeTag, const Fw::LogSeverity &severity, Fw::LogBuffer &args) const
Invoke a port connection.
Definition: LogPortAc.cpp:199
void run_handlerBase(FwIndexType portNum, U32 context)
Handler base-class function for input port run.
bool isConnected_Time_OutputPort(FwIndexType portNum) const
void init()
Initialization function.
void set_deallocate_OutputPort(FwIndexType portNum, Fw::InputBufferSendPort *port)
Connect port to deallocate[portNum].
bool isConnected_Tlm_OutputPort(FwIndexType portNum) const
PlatformIndexType FwIndexType
void invoke() const
Invoke a port connection.
void addCallPort(InputLogPort *callPort)
Register an input port.
Definition: LogPortAc.cpp:186
void init()
Initialization function.
void init()
Initialization function.
void set_Time_OutputPort(FwIndexType portNum, Fw::InputTimePort *port)
Connect port to Time[portNum].
virtual ~LinuxUartDriverComponentBase()
Destroy LinuxUartDriverComponentBase object.
void log_WARNING_HI_NoBuffers_ThrottleClear()
Reset throttle value for NoBuffers.
Implementation of malloc based allocator.
void set_recv_OutputPort(FwIndexType portNum, Drv::InputByteStreamDataPort *port)
Connect port to recv[portNum].
void tlmWrite_BytesSent(FwSizeType arg, Fw::Time _tlmTime=Fw::Time()) const
bool isConnected_recv_OutputPort(FwIndexType portNum) const
void init()
Initialization function.
#define FW_ASSERT(...)
Definition: Assert.hpp:14
Fw::Buffer allocate_out(FwIndexType portNum, FwSizeType size) const
Invoke output port allocate.
void lock()
lock the mutex and assert success
Definition: Mutex.cpp:34
void log_WARNING_HI_ReadError_ThrottleClear()
Reset throttle value for ReadError.
SerializeStatus serializeTo(SerialBufferBase &buffer, Endianness mode=Endianness::BIG) const override
Serialize the contents of this object to a buffer.
void log_WARNING_HI_ConfigError(const Fw::StringBase &device, I32 error) const
static constexpr FwIndexType getNum_send_InputPorts()