F´ Flight Software - C/C++ Documentation  devel
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 
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 
15 namespace Drv {
16 
17  // ----------------------------------------------------------------------
18  // Component initialization
19  // ----------------------------------------------------------------------
20 
22  init(NATIVE_INT_TYPE instance)
23  {
24  // Initialize base class
26 
27  // Connect input port send
28  for (
29  PlatformIntType port = 0;
30  port < static_cast<PlatformIntType>(this->getNum_send_InputPorts());
31  port++
32  ) {
33  this->m_send_InputPort[port].init();
34  this->m_send_InputPort[port].addCallComp(
35  this,
36  m_p_send_in
37  );
38  this->m_send_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_send_InputPort[%" PRI_PlatformIntType "]",
52  this->m_objName,
53  port
54  );
55  this->m_send_InputPort[port].setObjName(portName);
56 #endif
57  }
58 
59  // Connect output port Log
60  for (
61  PlatformIntType port = 0;
62  port < static_cast<PlatformIntType>(this->getNum_Log_OutputPorts());
63  port++
64  ) {
65  this->m_Log_OutputPort[port].init();
66 
67 #if FW_OBJECT_NAMES == 1
68  // The port name consists of this->m_objName and some extra info.
69  // We expect all of this to fit in FW_OBJ_NAME_MAX_SIZE bytes.
70  // However, the compiler may assume that this->m_objName fills
71  // the entire array, whose size is FW_OBJ_NAME_MAX_SIZE. So to
72  // avoid a compiler warning, we provide an extra FW_OBJ_NAME_MAX_SIZE
73  // bytes to cover the extra info.
74  char portName[2*FW_OBJ_NAME_MAX_SIZE];
75  (void) snprintf(
76  portName,
77  sizeof(portName),
78  "%s_Log_OutputPort[%" PRI_PlatformIntType "]",
79  this->m_objName,
80  port
81  );
82  this->m_Log_OutputPort[port].setObjName(portName);
83 #endif
84  }
85 
86 #if FW_ENABLE_TEXT_LOGGING == 1
87  // Connect output port LogText
88  for (
89  PlatformIntType port = 0;
90  port < static_cast<PlatformIntType>(this->getNum_LogText_OutputPorts());
91  port++
92  ) {
93  this->m_LogText_OutputPort[port].init();
94 
95 #if FW_OBJECT_NAMES == 1
96  // The port name consists of this->m_objName and some extra info.
97  // We expect all of this to fit in FW_OBJ_NAME_MAX_SIZE bytes.
98  // However, the compiler may assume that this->m_objName fills
99  // the entire array, whose size is FW_OBJ_NAME_MAX_SIZE. So to
100  // avoid a compiler warning, we provide an extra FW_OBJ_NAME_MAX_SIZE
101  // bytes to cover the extra info.
102  char portName[2*FW_OBJ_NAME_MAX_SIZE];
103  (void) snprintf(
104  portName,
105  sizeof(portName),
106  "%s_LogText_OutputPort[%" PRI_PlatformIntType "]",
107  this->m_objName,
108  port
109  );
110  this->m_LogText_OutputPort[port].setObjName(portName);
111 #endif
112  }
113 #endif
114 
115  // Connect output port Time
116  for (
117  PlatformIntType port = 0;
118  port < static_cast<PlatformIntType>(this->getNum_Time_OutputPorts());
119  port++
120  ) {
121  this->m_Time_OutputPort[port].init();
122 
123 #if FW_OBJECT_NAMES == 1
124  // The port name consists of this->m_objName and some extra info.
125  // We expect all of this to fit in FW_OBJ_NAME_MAX_SIZE bytes.
126  // However, the compiler may assume that this->m_objName fills
127  // the entire array, whose size is FW_OBJ_NAME_MAX_SIZE. So to
128  // avoid a compiler warning, we provide an extra FW_OBJ_NAME_MAX_SIZE
129  // bytes to cover the extra info.
130  char portName[2*FW_OBJ_NAME_MAX_SIZE];
131  (void) snprintf(
132  portName,
133  sizeof(portName),
134  "%s_Time_OutputPort[%" PRI_PlatformIntType "]",
135  this->m_objName,
136  port
137  );
138  this->m_Time_OutputPort[port].setObjName(portName);
139 #endif
140  }
141 
142  // Connect output port Tlm
143  for (
144  PlatformIntType port = 0;
145  port < static_cast<PlatformIntType>(this->getNum_Tlm_OutputPorts());
146  port++
147  ) {
148  this->m_Tlm_OutputPort[port].init();
149 
150 #if FW_OBJECT_NAMES == 1
151  // The port name consists of this->m_objName and some extra info.
152  // We expect all of this to fit in FW_OBJ_NAME_MAX_SIZE bytes.
153  // However, the compiler may assume that this->m_objName fills
154  // the entire array, whose size is FW_OBJ_NAME_MAX_SIZE. So to
155  // avoid a compiler warning, we provide an extra FW_OBJ_NAME_MAX_SIZE
156  // bytes to cover the extra info.
157  char portName[2*FW_OBJ_NAME_MAX_SIZE];
158  (void) snprintf(
159  portName,
160  sizeof(portName),
161  "%s_Tlm_OutputPort[%" PRI_PlatformIntType "]",
162  this->m_objName,
163  port
164  );
165  this->m_Tlm_OutputPort[port].setObjName(portName);
166 #endif
167  }
168 
169  // Connect output port allocate
170  for (
171  PlatformIntType port = 0;
172  port < static_cast<PlatformIntType>(this->getNum_allocate_OutputPorts());
173  port++
174  ) {
175  this->m_allocate_OutputPort[port].init();
176 
177 #if FW_OBJECT_NAMES == 1
178  // The port name consists of this->m_objName and some extra info.
179  // We expect all of this to fit in FW_OBJ_NAME_MAX_SIZE bytes.
180  // However, the compiler may assume that this->m_objName fills
181  // the entire array, whose size is FW_OBJ_NAME_MAX_SIZE. So to
182  // avoid a compiler warning, we provide an extra FW_OBJ_NAME_MAX_SIZE
183  // bytes to cover the extra info.
184  char portName[2*FW_OBJ_NAME_MAX_SIZE];
185  (void) snprintf(
186  portName,
187  sizeof(portName),
188  "%s_allocate_OutputPort[%" PRI_PlatformIntType "]",
189  this->m_objName,
190  port
191  );
192  this->m_allocate_OutputPort[port].setObjName(portName);
193 #endif
194  }
195 
196  // Connect output port deallocate
197  for (
198  PlatformIntType port = 0;
199  port < static_cast<PlatformIntType>(this->getNum_deallocate_OutputPorts());
200  port++
201  ) {
202  this->m_deallocate_OutputPort[port].init();
203 
204 #if FW_OBJECT_NAMES == 1
205  // The port name consists of this->m_objName and some extra info.
206  // We expect all of this to fit in FW_OBJ_NAME_MAX_SIZE bytes.
207  // However, the compiler may assume that this->m_objName fills
208  // the entire array, whose size is FW_OBJ_NAME_MAX_SIZE. So to
209  // avoid a compiler warning, we provide an extra FW_OBJ_NAME_MAX_SIZE
210  // bytes to cover the extra info.
211  char portName[2*FW_OBJ_NAME_MAX_SIZE];
212  (void) snprintf(
213  portName,
214  sizeof(portName),
215  "%s_deallocate_OutputPort[%" PRI_PlatformIntType "]",
216  this->m_objName,
217  port
218  );
219  this->m_deallocate_OutputPort[port].setObjName(portName);
220 #endif
221  }
222 
223  // Connect output port ready
224  for (
225  PlatformIntType port = 0;
226  port < static_cast<PlatformIntType>(this->getNum_ready_OutputPorts());
227  port++
228  ) {
229  this->m_ready_OutputPort[port].init();
230 
231 #if FW_OBJECT_NAMES == 1
232  // The port name consists of this->m_objName and some extra info.
233  // We expect all of this to fit in FW_OBJ_NAME_MAX_SIZE bytes.
234  // However, the compiler may assume that this->m_objName fills
235  // the entire array, whose size is FW_OBJ_NAME_MAX_SIZE. So to
236  // avoid a compiler warning, we provide an extra FW_OBJ_NAME_MAX_SIZE
237  // bytes to cover the extra info.
238  char portName[2*FW_OBJ_NAME_MAX_SIZE];
239  (void) snprintf(
240  portName,
241  sizeof(portName),
242  "%s_ready_OutputPort[%" PRI_PlatformIntType "]",
243  this->m_objName,
244  port
245  );
246  this->m_ready_OutputPort[port].setObjName(portName);
247 #endif
248  }
249 
250  // Connect output port recv
251  for (
252  PlatformIntType port = 0;
253  port < static_cast<PlatformIntType>(this->getNum_recv_OutputPorts());
254  port++
255  ) {
256  this->m_recv_OutputPort[port].init();
257 
258 #if FW_OBJECT_NAMES == 1
259  // The port name consists of this->m_objName and some extra info.
260  // We expect all of this to fit in FW_OBJ_NAME_MAX_SIZE bytes.
261  // However, the compiler may assume that this->m_objName fills
262  // the entire array, whose size is FW_OBJ_NAME_MAX_SIZE. So to
263  // avoid a compiler warning, we provide an extra FW_OBJ_NAME_MAX_SIZE
264  // bytes to cover the extra info.
265  char portName[2*FW_OBJ_NAME_MAX_SIZE];
266  (void) snprintf(
267  portName,
268  sizeof(portName),
269  "%s_recv_OutputPort[%" PRI_PlatformIntType "]",
270  this->m_objName,
271  port
272  );
273  this->m_recv_OutputPort[port].setObjName(portName);
274 #endif
275  }
276  }
277 
278  // ----------------------------------------------------------------------
279  // Getters for typed input ports
280  // ----------------------------------------------------------------------
281 
284  {
285  FW_ASSERT(
286  portNum < this->getNum_send_InputPorts(),
287  static_cast<FwAssertArgType>(portNum)
288  );
289 
290  return &this->m_send_InputPort[portNum];
291  }
292 
293  // ----------------------------------------------------------------------
294  // Connect input ports to special output ports
295  // ----------------------------------------------------------------------
296 
299  NATIVE_INT_TYPE portNum,
300  Fw::InputLogPort* port
301  )
302  {
303  FW_ASSERT(
304  portNum < this->getNum_Log_OutputPorts(),
305  static_cast<FwAssertArgType>(portNum)
306  );
307 
308  this->m_Log_OutputPort[portNum].addCallPort(port);
309  }
310 
311 #if FW_ENABLE_TEXT_LOGGING == 1
312 
313  void LinuxUartDriverComponentBase ::
314  set_LogText_OutputPort(
315  NATIVE_INT_TYPE portNum,
317  )
318  {
319  FW_ASSERT(
320  portNum < this->getNum_LogText_OutputPorts(),
321  static_cast<FwAssertArgType>(portNum)
322  );
323 
324  this->m_LogText_OutputPort[portNum].addCallPort(port);
325  }
326 
327 #endif
328 
331  NATIVE_INT_TYPE portNum,
332  Fw::InputTimePort* port
333  )
334  {
335  FW_ASSERT(
336  portNum < this->getNum_Time_OutputPorts(),
337  static_cast<FwAssertArgType>(portNum)
338  );
339 
340  this->m_Time_OutputPort[portNum].addCallPort(port);
341  }
342 
345  NATIVE_INT_TYPE portNum,
346  Fw::InputTlmPort* port
347  )
348  {
349  FW_ASSERT(
350  portNum < this->getNum_Tlm_OutputPorts(),
351  static_cast<FwAssertArgType>(portNum)
352  );
353 
354  this->m_Tlm_OutputPort[portNum].addCallPort(port);
355  }
356 
357  // ----------------------------------------------------------------------
358  // Connect typed input ports to typed output ports
359  // ----------------------------------------------------------------------
360 
363  NATIVE_INT_TYPE portNum,
365  )
366  {
367  FW_ASSERT(
368  portNum < this->getNum_allocate_OutputPorts(),
369  static_cast<FwAssertArgType>(portNum)
370  );
371 
372  this->m_allocate_OutputPort[portNum].addCallPort(port);
373  }
374 
377  NATIVE_INT_TYPE portNum,
379  )
380  {
381  FW_ASSERT(
382  portNum < this->getNum_deallocate_OutputPorts(),
383  static_cast<FwAssertArgType>(portNum)
384  );
385 
386  this->m_deallocate_OutputPort[portNum].addCallPort(port);
387  }
388 
391  NATIVE_INT_TYPE portNum,
393  )
394  {
395  FW_ASSERT(
396  portNum < this->getNum_ready_OutputPorts(),
397  static_cast<FwAssertArgType>(portNum)
398  );
399 
400  this->m_ready_OutputPort[portNum].addCallPort(port);
401  }
402 
405  NATIVE_INT_TYPE portNum,
407  )
408  {
409  FW_ASSERT(
410  portNum < this->getNum_recv_OutputPorts(),
411  static_cast<FwAssertArgType>(portNum)
412  );
413 
414  this->m_recv_OutputPort[portNum].addCallPort(port);
415  }
416 
417 #if FW_PORT_SERIALIZATION
418 
419  // ----------------------------------------------------------------------
420  // Connect serial input ports to special output ports
421  // ----------------------------------------------------------------------
422 
425  NATIVE_INT_TYPE portNum,
426  Fw::InputSerializePort* port
427  )
428  {
429  FW_ASSERT(
430  portNum < this->getNum_Log_OutputPorts(),
431  static_cast<FwAssertArgType>(portNum)
432  );
433 
434  this->m_Log_OutputPort[portNum].registerSerialPort(port);
435  }
436 
437 #if FW_ENABLE_TEXT_LOGGING == 1
438 
439  void LinuxUartDriverComponentBase ::
440  set_LogText_OutputPort(
441  NATIVE_INT_TYPE portNum,
442  Fw::InputSerializePort* port
443  )
444  {
445  FW_ASSERT(
446  portNum < this->getNum_LogText_OutputPorts(),
447  static_cast<FwAssertArgType>(portNum)
448  );
449 
450  this->m_LogText_OutputPort[portNum].registerSerialPort(port);
451  }
452 
453 #endif
454 
457  NATIVE_INT_TYPE portNum,
458  Fw::InputSerializePort* port
459  )
460  {
461  FW_ASSERT(
462  portNum < this->getNum_Time_OutputPorts(),
463  static_cast<FwAssertArgType>(portNum)
464  );
465 
466  this->m_Time_OutputPort[portNum].registerSerialPort(port);
467  }
468 
471  NATIVE_INT_TYPE portNum,
472  Fw::InputSerializePort* port
473  )
474  {
475  FW_ASSERT(
476  portNum < this->getNum_Tlm_OutputPorts(),
477  static_cast<FwAssertArgType>(portNum)
478  );
479 
480  this->m_Tlm_OutputPort[portNum].registerSerialPort(port);
481  }
482 
483 #endif
484 
485 #if FW_PORT_SERIALIZATION
486 
487  // ----------------------------------------------------------------------
488  // Connect serial input ports to typed output ports
489  // ----------------------------------------------------------------------
490 
493  NATIVE_INT_TYPE portNum,
494  Fw::InputSerializePort* port
495  )
496  {
497  FW_ASSERT(
498  portNum < this->getNum_deallocate_OutputPorts(),
499  static_cast<FwAssertArgType>(portNum)
500  );
501 
502  this->m_deallocate_OutputPort[portNum].registerSerialPort(port);
503  }
504 
507  NATIVE_INT_TYPE portNum,
508  Fw::InputSerializePort* port
509  )
510  {
511  FW_ASSERT(
512  portNum < this->getNum_ready_OutputPorts(),
513  static_cast<FwAssertArgType>(portNum)
514  );
515 
516  this->m_ready_OutputPort[portNum].registerSerialPort(port);
517  }
518 
521  NATIVE_INT_TYPE portNum,
522  Fw::InputSerializePort* port
523  )
524  {
525  FW_ASSERT(
526  portNum < this->getNum_recv_OutputPorts(),
527  static_cast<FwAssertArgType>(portNum)
528  );
529 
530  this->m_recv_OutputPort[portNum].registerSerialPort(port);
531  }
532 
533 #endif
534 
535  // ----------------------------------------------------------------------
536  // Component construction and destruction
537  // ----------------------------------------------------------------------
538 
540  LinuxUartDriverComponentBase(const char* compName) :
541  Fw::PassiveComponentBase(compName)
542  {
543  this->m_WriteErrorThrottle = 0;
544  this->m_ReadErrorThrottle = 0;
545  this->m_NoBuffersThrottle = 0;
546  }
547 
550  {
551 
552  }
553 
554  // ----------------------------------------------------------------------
555  // Getters for numbers of typed input ports
556  // ----------------------------------------------------------------------
557 
560  {
561  return static_cast<NATIVE_INT_TYPE>(FW_NUM_ARRAY_ELEMENTS(this->m_send_InputPort));
562  }
563 
564  // ----------------------------------------------------------------------
565  // Getters for numbers of special output ports
566  // ----------------------------------------------------------------------
567 
570  {
571  return static_cast<NATIVE_INT_TYPE>(FW_NUM_ARRAY_ELEMENTS(this->m_Log_OutputPort));
572  }
573 
574 #if FW_ENABLE_TEXT_LOGGING == 1
575 
576  NATIVE_INT_TYPE LinuxUartDriverComponentBase ::
577  getNum_LogText_OutputPorts() const
578  {
579  return static_cast<NATIVE_INT_TYPE>(FW_NUM_ARRAY_ELEMENTS(this->m_LogText_OutputPort));
580  }
581 
582 #endif
583 
586  {
587  return static_cast<NATIVE_INT_TYPE>(FW_NUM_ARRAY_ELEMENTS(this->m_Time_OutputPort));
588  }
589 
592  {
593  return static_cast<NATIVE_INT_TYPE>(FW_NUM_ARRAY_ELEMENTS(this->m_Tlm_OutputPort));
594  }
595 
596  // ----------------------------------------------------------------------
597  // Getters for numbers of typed output ports
598  // ----------------------------------------------------------------------
599 
602  {
603  return static_cast<NATIVE_INT_TYPE>(FW_NUM_ARRAY_ELEMENTS(this->m_allocate_OutputPort));
604  }
605 
608  {
609  return static_cast<NATIVE_INT_TYPE>(FW_NUM_ARRAY_ELEMENTS(this->m_deallocate_OutputPort));
610  }
611 
614  {
615  return static_cast<NATIVE_INT_TYPE>(FW_NUM_ARRAY_ELEMENTS(this->m_ready_OutputPort));
616  }
617 
620  {
621  return static_cast<NATIVE_INT_TYPE>(FW_NUM_ARRAY_ELEMENTS(this->m_recv_OutputPort));
622  }
623 
624  // ----------------------------------------------------------------------
625  // Connection status queries for special output ports
626  // ----------------------------------------------------------------------
627 
630  {
631  FW_ASSERT(
632  portNum < this->getNum_Log_OutputPorts(),
633  static_cast<FwAssertArgType>(portNum)
634  );
635 
636  return this->m_Log_OutputPort[portNum].isConnected();
637  }
638 
639 #if FW_ENABLE_TEXT_LOGGING == 1
640 
641  bool LinuxUartDriverComponentBase ::
642  isConnected_LogText_OutputPort(NATIVE_INT_TYPE portNum)
643  {
644  FW_ASSERT(
645  portNum < this->getNum_LogText_OutputPorts(),
646  static_cast<FwAssertArgType>(portNum)
647  );
648 
649  return this->m_LogText_OutputPort[portNum].isConnected();
650  }
651 
652 #endif
653 
656  {
657  FW_ASSERT(
658  portNum < this->getNum_Time_OutputPorts(),
659  static_cast<FwAssertArgType>(portNum)
660  );
661 
662  return this->m_Time_OutputPort[portNum].isConnected();
663  }
664 
667  {
668  FW_ASSERT(
669  portNum < this->getNum_Tlm_OutputPorts(),
670  static_cast<FwAssertArgType>(portNum)
671  );
672 
673  return this->m_Tlm_OutputPort[portNum].isConnected();
674  }
675 
676  // ----------------------------------------------------------------------
677  // Connection status queries for typed output ports
678  // ----------------------------------------------------------------------
679 
682  {
683  FW_ASSERT(
684  portNum < this->getNum_allocate_OutputPorts(),
685  static_cast<FwAssertArgType>(portNum)
686  );
687 
688  return this->m_allocate_OutputPort[portNum].isConnected();
689  }
690 
693  {
694  FW_ASSERT(
695  portNum < this->getNum_deallocate_OutputPorts(),
696  static_cast<FwAssertArgType>(portNum)
697  );
698 
699  return this->m_deallocate_OutputPort[portNum].isConnected();
700  }
701 
704  {
705  FW_ASSERT(
706  portNum < this->getNum_ready_OutputPorts(),
707  static_cast<FwAssertArgType>(portNum)
708  );
709 
710  return this->m_ready_OutputPort[portNum].isConnected();
711  }
712 
715  {
716  FW_ASSERT(
717  portNum < this->getNum_recv_OutputPorts(),
718  static_cast<FwAssertArgType>(portNum)
719  );
720 
721  return this->m_recv_OutputPort[portNum].isConnected();
722  }
723 
724  // ----------------------------------------------------------------------
725  // Port handler base-class functions for typed input ports
726  //
727  // Call these functions directly to bypass the corresponding ports
728  // ----------------------------------------------------------------------
729 
732  NATIVE_INT_TYPE portNum,
733  Fw::Buffer& sendBuffer
734  )
735  {
736  // Make sure port number is valid
737  FW_ASSERT(
738  portNum < this->getNum_send_InputPorts(),
739  static_cast<FwAssertArgType>(portNum)
740  );
741 
742  Drv::SendStatus retVal;
743 
744  // Lock guard mutex before calling
745  this->lock();
746 
747  // Call handler function
748  retVal = this->send_handler(
749  portNum,
750  sendBuffer
751  );
752 
753  // Unlock guard mutex
754  this->unLock();
755 
756  return retVal;
757  }
758 
759  // ----------------------------------------------------------------------
760  // Invocation functions for typed output ports
761  // ----------------------------------------------------------------------
762 
765  NATIVE_INT_TYPE portNum,
766  U32 size
767  )
768  {
769  FW_ASSERT(
770  portNum < this->getNum_allocate_OutputPorts(),
771  static_cast<FwAssertArgType>(portNum)
772  );
773  return this->m_allocate_OutputPort[portNum].invoke(
774  size
775  );
776  }
777 
780  NATIVE_INT_TYPE portNum,
781  Fw::Buffer& fwBuffer
782  )
783  {
784  FW_ASSERT(
785  portNum < this->getNum_deallocate_OutputPorts(),
786  static_cast<FwAssertArgType>(portNum)
787  );
788  this->m_deallocate_OutputPort[portNum].invoke(
789  fwBuffer
790  );
791  }
792 
795  {
796  FW_ASSERT(
797  portNum < this->getNum_ready_OutputPorts(),
798  static_cast<FwAssertArgType>(portNum)
799  );
800  this->m_ready_OutputPort[portNum].invoke();
801  }
802 
804  recv_out(
805  NATIVE_INT_TYPE portNum,
806  Fw::Buffer& recvBuffer,
807  const Drv::RecvStatus& recvStatus
808  )
809  {
810  FW_ASSERT(
811  portNum < this->getNum_recv_OutputPorts(),
812  static_cast<FwAssertArgType>(portNum)
813  );
814  this->m_recv_OutputPort[portNum].invoke(
815  recvBuffer,
816  recvStatus
817  );
818  }
819 
820  // ----------------------------------------------------------------------
821  // Event logging functions
822  // ----------------------------------------------------------------------
823 
826  const Fw::LogStringArg& device,
827  I32 error,
828  const Fw::LogStringArg& name
829  )
830  {
831  // Get the time
832  Fw::Time _logTime;
833  if (this->m_Time_OutputPort[0].isConnected()) {
834  this->m_Time_OutputPort[0].invoke(_logTime);
835  }
836 
837  FwEventIdType _id = static_cast<FwEventIdType>(0);
838 
839  _id = this->getIdBase() + EVENTID_OPENERROR;
840 
841  // Emit the event on the log port
842  if (this->m_Log_OutputPort[0].isConnected()) {
843  Fw::LogBuffer _logBuff;
845 
846 #if FW_AMPCS_COMPATIBLE
847  // Serialize the number of arguments
848  _status = _logBuff.serialize(static_cast<U8>(3));
849  FW_ASSERT(
850  _status == Fw::FW_SERIALIZE_OK,
851  static_cast<FwAssertArgType>(_status)
852  );
853 #endif
854 
855  _status = device.serialize(_logBuff, 40);
856  FW_ASSERT(
857  _status == Fw::FW_SERIALIZE_OK,
858  static_cast<FwAssertArgType>(_status)
859  );
860 
861 #if FW_AMPCS_COMPATIBLE
862  // Serialize the argument size
863  _status = _logBuff.serialize(
864  static_cast<U8>(sizeof(I32))
865  );
866  FW_ASSERT(
867  _status == Fw::FW_SERIALIZE_OK,
868  static_cast<FwAssertArgType>(_status)
869  );
870 #endif
871  _status = _logBuff.serialize(error);
872  FW_ASSERT(
873  _status == Fw::FW_SERIALIZE_OK,
874  static_cast<FwAssertArgType>(_status)
875  );
876 
877  _status = name.serialize(_logBuff, 40);
878  FW_ASSERT(
879  _status == Fw::FW_SERIALIZE_OK,
880  static_cast<FwAssertArgType>(_status)
881  );
882 
883  this->m_Log_OutputPort[0].invoke(
884  _id,
885  _logTime,
887  _logBuff
888  );
889  }
890 
891  // Emit the event on the text log port
892 #if FW_ENABLE_TEXT_LOGGING
893  if (this->m_LogText_OutputPort[0].isConnected()) {
894 #if FW_OBJECT_NAMES == 1
895  const char* _formatString =
896  "(%s) %s: Error opening UART device %s: %" PRIi32 " %s";
897 #else
898  const char* _formatString =
899  "%s: Error opening UART device %s: %" PRIi32 " %s";
900 #endif
901 
902  char _textBuffer[FW_LOG_TEXT_BUFFER_SIZE];
903 
904  (void) snprintf(
905  _textBuffer,
907  _formatString,
908 #if FW_OBJECT_NAMES == 1
909  this->m_objName,
910 #endif
911  "OpenError ",
912  device.toChar(),
913  error,
914  name.toChar()
915  );
916 
917  // Null terminate
918  _textBuffer[FW_LOG_TEXT_BUFFER_SIZE-1] = 0;
919  Fw::TextLogString _logString = _textBuffer;
920  this->m_LogText_OutputPort[0].invoke(
921  _id,
922  _logTime,
924  _logString
925  );
926  }
927 #endif
928  }
929 
932  const Fw::LogStringArg& device,
933  I32 error
934  )
935  {
936  // Get the time
937  Fw::Time _logTime;
938  if (this->m_Time_OutputPort[0].isConnected()) {
939  this->m_Time_OutputPort[0].invoke(_logTime);
940  }
941 
942  FwEventIdType _id = static_cast<FwEventIdType>(0);
943 
944  _id = this->getIdBase() + EVENTID_CONFIGERROR;
945 
946  // Emit the event on the log port
947  if (this->m_Log_OutputPort[0].isConnected()) {
948  Fw::LogBuffer _logBuff;
950 
951 #if FW_AMPCS_COMPATIBLE
952  // Serialize the number of arguments
953  _status = _logBuff.serialize(static_cast<U8>(2));
954  FW_ASSERT(
955  _status == Fw::FW_SERIALIZE_OK,
956  static_cast<FwAssertArgType>(_status)
957  );
958 #endif
959 
960  _status = device.serialize(_logBuff, 40);
961  FW_ASSERT(
962  _status == Fw::FW_SERIALIZE_OK,
963  static_cast<FwAssertArgType>(_status)
964  );
965 
966 #if FW_AMPCS_COMPATIBLE
967  // Serialize the argument size
968  _status = _logBuff.serialize(
969  static_cast<U8>(sizeof(I32))
970  );
971  FW_ASSERT(
972  _status == Fw::FW_SERIALIZE_OK,
973  static_cast<FwAssertArgType>(_status)
974  );
975 #endif
976  _status = _logBuff.serialize(error);
977  FW_ASSERT(
978  _status == Fw::FW_SERIALIZE_OK,
979  static_cast<FwAssertArgType>(_status)
980  );
981 
982  this->m_Log_OutputPort[0].invoke(
983  _id,
984  _logTime,
986  _logBuff
987  );
988  }
989 
990  // Emit the event on the text log port
991 #if FW_ENABLE_TEXT_LOGGING
992  if (this->m_LogText_OutputPort[0].isConnected()) {
993 #if FW_OBJECT_NAMES == 1
994  const char* _formatString =
995  "(%s) %s: Error configuring UART device %s: %" PRIi32 "";
996 #else
997  const char* _formatString =
998  "%s: Error configuring UART device %s: %" PRIi32 "";
999 #endif
1000 
1001  char _textBuffer[FW_LOG_TEXT_BUFFER_SIZE];
1002 
1003  (void) snprintf(
1004  _textBuffer,
1006  _formatString,
1007 #if FW_OBJECT_NAMES == 1
1008  this->m_objName,
1009 #endif
1010  "ConfigError ",
1011  device.toChar(),
1012  error
1013  );
1014 
1015  // Null terminate
1016  _textBuffer[FW_LOG_TEXT_BUFFER_SIZE-1] = 0;
1017  Fw::TextLogString _logString = _textBuffer;
1018  this->m_LogText_OutputPort[0].invoke(
1019  _id,
1020  _logTime,
1022  _logString
1023  );
1024  }
1025 #endif
1026  }
1027 
1030  const Fw::LogStringArg& device,
1031  I32 error
1032  )
1033  {
1034  // Check throttle value
1035  if (this->m_WriteErrorThrottle >= EVENTID_WRITEERROR_THROTTLE) {
1036  return;
1037  }
1038  else {
1039  this->m_WriteErrorThrottle++;
1040  }
1041 
1042  // Get the time
1043  Fw::Time _logTime;
1044  if (this->m_Time_OutputPort[0].isConnected()) {
1045  this->m_Time_OutputPort[0].invoke(_logTime);
1046  }
1047 
1048  FwEventIdType _id = static_cast<FwEventIdType>(0);
1049 
1050  _id = this->getIdBase() + EVENTID_WRITEERROR;
1051 
1052  // Emit the event on the log port
1053  if (this->m_Log_OutputPort[0].isConnected()) {
1054  Fw::LogBuffer _logBuff;
1056 
1057 #if FW_AMPCS_COMPATIBLE
1058  // Serialize the number of arguments
1059  _status = _logBuff.serialize(static_cast<U8>(2));
1060  FW_ASSERT(
1061  _status == Fw::FW_SERIALIZE_OK,
1062  static_cast<FwAssertArgType>(_status)
1063  );
1064 #endif
1065 
1066  _status = device.serialize(_logBuff, 40);
1067  FW_ASSERT(
1068  _status == Fw::FW_SERIALIZE_OK,
1069  static_cast<FwAssertArgType>(_status)
1070  );
1071 
1072 #if FW_AMPCS_COMPATIBLE
1073  // Serialize the argument size
1074  _status = _logBuff.serialize(
1075  static_cast<U8>(sizeof(I32))
1076  );
1077  FW_ASSERT(
1078  _status == Fw::FW_SERIALIZE_OK,
1079  static_cast<FwAssertArgType>(_status)
1080  );
1081 #endif
1082  _status = _logBuff.serialize(error);
1083  FW_ASSERT(
1084  _status == Fw::FW_SERIALIZE_OK,
1085  static_cast<FwAssertArgType>(_status)
1086  );
1087 
1088  this->m_Log_OutputPort[0].invoke(
1089  _id,
1090  _logTime,
1092  _logBuff
1093  );
1094  }
1095 
1096  // Emit the event on the text log port
1097 #if FW_ENABLE_TEXT_LOGGING
1098  if (this->m_LogText_OutputPort[0].isConnected()) {
1099 #if FW_OBJECT_NAMES == 1
1100  const char* _formatString =
1101  "(%s) %s: Error writing UART device %s: %" PRIi32 "";
1102 #else
1103  const char* _formatString =
1104  "%s: Error writing UART device %s: %" PRIi32 "";
1105 #endif
1106 
1107  char _textBuffer[FW_LOG_TEXT_BUFFER_SIZE];
1108 
1109  (void) snprintf(
1110  _textBuffer,
1112  _formatString,
1113 #if FW_OBJECT_NAMES == 1
1114  this->m_objName,
1115 #endif
1116  "WriteError ",
1117  device.toChar(),
1118  error
1119  );
1120 
1121  // Null terminate
1122  _textBuffer[FW_LOG_TEXT_BUFFER_SIZE-1] = 0;
1123  Fw::TextLogString _logString = _textBuffer;
1124  this->m_LogText_OutputPort[0].invoke(
1125  _id,
1126  _logTime,
1128  _logString
1129  );
1130  }
1131 #endif
1132  }
1133 
1136  const Fw::LogStringArg& device,
1137  I32 error
1138  )
1139  {
1140  // Check throttle value
1141  if (this->m_ReadErrorThrottle >= EVENTID_READERROR_THROTTLE) {
1142  return;
1143  }
1144  else {
1145  this->m_ReadErrorThrottle++;
1146  }
1147 
1148  // Get the time
1149  Fw::Time _logTime;
1150  if (this->m_Time_OutputPort[0].isConnected()) {
1151  this->m_Time_OutputPort[0].invoke(_logTime);
1152  }
1153 
1154  FwEventIdType _id = static_cast<FwEventIdType>(0);
1155 
1156  _id = this->getIdBase() + EVENTID_READERROR;
1157 
1158  // Emit the event on the log port
1159  if (this->m_Log_OutputPort[0].isConnected()) {
1160  Fw::LogBuffer _logBuff;
1162 
1163 #if FW_AMPCS_COMPATIBLE
1164  // Serialize the number of arguments
1165  _status = _logBuff.serialize(static_cast<U8>(2));
1166  FW_ASSERT(
1167  _status == Fw::FW_SERIALIZE_OK,
1168  static_cast<FwAssertArgType>(_status)
1169  );
1170 #endif
1171 
1172  _status = device.serialize(_logBuff, 40);
1173  FW_ASSERT(
1174  _status == Fw::FW_SERIALIZE_OK,
1175  static_cast<FwAssertArgType>(_status)
1176  );
1177 
1178 #if FW_AMPCS_COMPATIBLE
1179  // Serialize the argument size
1180  _status = _logBuff.serialize(
1181  static_cast<U8>(sizeof(I32))
1182  );
1183  FW_ASSERT(
1184  _status == Fw::FW_SERIALIZE_OK,
1185  static_cast<FwAssertArgType>(_status)
1186  );
1187 #endif
1188  _status = _logBuff.serialize(error);
1189  FW_ASSERT(
1190  _status == Fw::FW_SERIALIZE_OK,
1191  static_cast<FwAssertArgType>(_status)
1192  );
1193 
1194  this->m_Log_OutputPort[0].invoke(
1195  _id,
1196  _logTime,
1198  _logBuff
1199  );
1200  }
1201 
1202  // Emit the event on the text log port
1203 #if FW_ENABLE_TEXT_LOGGING
1204  if (this->m_LogText_OutputPort[0].isConnected()) {
1205 #if FW_OBJECT_NAMES == 1
1206  const char* _formatString =
1207  "(%s) %s: Error reading UART device %s: %" PRIi32 "";
1208 #else
1209  const char* _formatString =
1210  "%s: Error reading UART device %s: %" PRIi32 "";
1211 #endif
1212 
1213  char _textBuffer[FW_LOG_TEXT_BUFFER_SIZE];
1214 
1215  (void) snprintf(
1216  _textBuffer,
1218  _formatString,
1219 #if FW_OBJECT_NAMES == 1
1220  this->m_objName,
1221 #endif
1222  "ReadError ",
1223  device.toChar(),
1224  error
1225  );
1226 
1227  // Null terminate
1228  _textBuffer[FW_LOG_TEXT_BUFFER_SIZE-1] = 0;
1229  Fw::TextLogString _logString = _textBuffer;
1230  this->m_LogText_OutputPort[0].invoke(
1231  _id,
1232  _logTime,
1234  _logString
1235  );
1236  }
1237 #endif
1238  }
1239 
1242  {
1243  // Get the time
1244  Fw::Time _logTime;
1245  if (this->m_Time_OutputPort[0].isConnected()) {
1246  this->m_Time_OutputPort[0].invoke(_logTime);
1247  }
1248 
1249  FwEventIdType _id = static_cast<FwEventIdType>(0);
1250 
1251  _id = this->getIdBase() + EVENTID_PORTOPENED;
1252 
1253  // Emit the event on the log port
1254  if (this->m_Log_OutputPort[0].isConnected()) {
1255  Fw::LogBuffer _logBuff;
1257 
1258 #if FW_AMPCS_COMPATIBLE
1259  // Serialize the number of arguments
1260  _status = _logBuff.serialize(static_cast<U8>(1));
1261  FW_ASSERT(
1262  _status == Fw::FW_SERIALIZE_OK,
1263  static_cast<FwAssertArgType>(_status)
1264  );
1265 #endif
1266 
1267  _status = device.serialize(_logBuff, 40);
1268  FW_ASSERT(
1269  _status == Fw::FW_SERIALIZE_OK,
1270  static_cast<FwAssertArgType>(_status)
1271  );
1272 
1273  this->m_Log_OutputPort[0].invoke(
1274  _id,
1275  _logTime,
1277  _logBuff
1278  );
1279  }
1280 
1281  // Emit the event on the text log port
1282 #if FW_ENABLE_TEXT_LOGGING
1283  if (this->m_LogText_OutputPort[0].isConnected()) {
1284 #if FW_OBJECT_NAMES == 1
1285  const char* _formatString =
1286  "(%s) %s: UART Device %s configured";
1287 #else
1288  const char* _formatString =
1289  "%s: UART Device %s configured";
1290 #endif
1291 
1292  char _textBuffer[FW_LOG_TEXT_BUFFER_SIZE];
1293 
1294  (void) snprintf(
1295  _textBuffer,
1297  _formatString,
1298 #if FW_OBJECT_NAMES == 1
1299  this->m_objName,
1300 #endif
1301  "PortOpened ",
1302  device.toChar()
1303  );
1304 
1305  // Null terminate
1306  _textBuffer[FW_LOG_TEXT_BUFFER_SIZE-1] = 0;
1307  Fw::TextLogString _logString = _textBuffer;
1308  this->m_LogText_OutputPort[0].invoke(
1309  _id,
1310  _logTime,
1312  _logString
1313  );
1314  }
1315 #endif
1316  }
1317 
1320  {
1321  // Check throttle value
1322  if (this->m_NoBuffersThrottle >= EVENTID_NOBUFFERS_THROTTLE) {
1323  return;
1324  }
1325  else {
1326  this->m_NoBuffersThrottle++;
1327  }
1328 
1329  // Get the time
1330  Fw::Time _logTime;
1331  if (this->m_Time_OutputPort[0].isConnected()) {
1332  this->m_Time_OutputPort[0].invoke(_logTime);
1333  }
1334 
1335  FwEventIdType _id = static_cast<FwEventIdType>(0);
1336 
1337  _id = this->getIdBase() + EVENTID_NOBUFFERS;
1338 
1339  // Emit the event on the log port
1340  if (this->m_Log_OutputPort[0].isConnected()) {
1341  Fw::LogBuffer _logBuff;
1343 
1344 #if FW_AMPCS_COMPATIBLE
1345  // Serialize the number of arguments
1346  _status = _logBuff.serialize(static_cast<U8>(1));
1347  FW_ASSERT(
1348  _status == Fw::FW_SERIALIZE_OK,
1349  static_cast<FwAssertArgType>(_status)
1350  );
1351 #endif
1352 
1353  _status = device.serialize(_logBuff, 40);
1354  FW_ASSERT(
1355  _status == Fw::FW_SERIALIZE_OK,
1356  static_cast<FwAssertArgType>(_status)
1357  );
1358 
1359  this->m_Log_OutputPort[0].invoke(
1360  _id,
1361  _logTime,
1363  _logBuff
1364  );
1365  }
1366 
1367  // Emit the event on the text log port
1368 #if FW_ENABLE_TEXT_LOGGING
1369  if (this->m_LogText_OutputPort[0].isConnected()) {
1370 #if FW_OBJECT_NAMES == 1
1371  const char* _formatString =
1372  "(%s) %s: UART Device %s ran out of buffers";
1373 #else
1374  const char* _formatString =
1375  "%s: UART Device %s ran out of buffers";
1376 #endif
1377 
1378  char _textBuffer[FW_LOG_TEXT_BUFFER_SIZE];
1379 
1380  (void) snprintf(
1381  _textBuffer,
1383  _formatString,
1384 #if FW_OBJECT_NAMES == 1
1385  this->m_objName,
1386 #endif
1387  "NoBuffers ",
1388  device.toChar()
1389  );
1390 
1391  // Null terminate
1392  _textBuffer[FW_LOG_TEXT_BUFFER_SIZE-1] = 0;
1393  Fw::TextLogString _logString = _textBuffer;
1394  this->m_LogText_OutputPort[0].invoke(
1395  _id,
1396  _logTime,
1398  _logString
1399  );
1400  }
1401 #endif
1402  }
1403 
1406  const Fw::LogStringArg& device,
1407  U32 size,
1408  U32 needed
1409  )
1410  {
1411  // Get the time
1412  Fw::Time _logTime;
1413  if (this->m_Time_OutputPort[0].isConnected()) {
1414  this->m_Time_OutputPort[0].invoke(_logTime);
1415  }
1416 
1417  FwEventIdType _id = static_cast<FwEventIdType>(0);
1418 
1419  _id = this->getIdBase() + EVENTID_BUFFERTOOSMALL;
1420 
1421  // Emit the event on the log port
1422  if (this->m_Log_OutputPort[0].isConnected()) {
1423  Fw::LogBuffer _logBuff;
1425 
1426 #if FW_AMPCS_COMPATIBLE
1427  // Serialize the number of arguments
1428  _status = _logBuff.serialize(static_cast<U8>(3));
1429  FW_ASSERT(
1430  _status == Fw::FW_SERIALIZE_OK,
1431  static_cast<FwAssertArgType>(_status)
1432  );
1433 #endif
1434 
1435  _status = device.serialize(_logBuff, 40);
1436  FW_ASSERT(
1437  _status == Fw::FW_SERIALIZE_OK,
1438  static_cast<FwAssertArgType>(_status)
1439  );
1440 
1441 #if FW_AMPCS_COMPATIBLE
1442  // Serialize the argument size
1443  _status = _logBuff.serialize(
1444  static_cast<U8>(sizeof(U32))
1445  );
1446  FW_ASSERT(
1447  _status == Fw::FW_SERIALIZE_OK,
1448  static_cast<FwAssertArgType>(_status)
1449  );
1450 #endif
1451  _status = _logBuff.serialize(size);
1452  FW_ASSERT(
1453  _status == Fw::FW_SERIALIZE_OK,
1454  static_cast<FwAssertArgType>(_status)
1455  );
1456 
1457 #if FW_AMPCS_COMPATIBLE
1458  // Serialize the argument size
1459  _status = _logBuff.serialize(
1460  static_cast<U8>(sizeof(U32))
1461  );
1462  FW_ASSERT(
1463  _status == Fw::FW_SERIALIZE_OK,
1464  static_cast<FwAssertArgType>(_status)
1465  );
1466 #endif
1467  _status = _logBuff.serialize(needed);
1468  FW_ASSERT(
1469  _status == Fw::FW_SERIALIZE_OK,
1470  static_cast<FwAssertArgType>(_status)
1471  );
1472 
1473  this->m_Log_OutputPort[0].invoke(
1474  _id,
1475  _logTime,
1477  _logBuff
1478  );
1479  }
1480 
1481  // Emit the event on the text log port
1482 #if FW_ENABLE_TEXT_LOGGING
1483  if (this->m_LogText_OutputPort[0].isConnected()) {
1484 #if FW_OBJECT_NAMES == 1
1485  const char* _formatString =
1486  "(%s) %s: UART Device %s target buffer too small. Size: %" PRIu32 " Needs: %" PRIu32 "";
1487 #else
1488  const char* _formatString =
1489  "%s: UART Device %s target buffer too small. Size: %" PRIu32 " Needs: %" PRIu32 "";
1490 #endif
1491 
1492  char _textBuffer[FW_LOG_TEXT_BUFFER_SIZE];
1493 
1494  (void) snprintf(
1495  _textBuffer,
1497  _formatString,
1498 #if FW_OBJECT_NAMES == 1
1499  this->m_objName,
1500 #endif
1501  "BufferTooSmall ",
1502  device.toChar(),
1503  size,
1504  needed
1505  );
1506 
1507  // Null terminate
1508  _textBuffer[FW_LOG_TEXT_BUFFER_SIZE-1] = 0;
1509  Fw::TextLogString _logString = _textBuffer;
1510  this->m_LogText_OutputPort[0].invoke(
1511  _id,
1512  _logTime,
1514  _logString
1515  );
1516  }
1517 #endif
1518  }
1519 
1520  // ----------------------------------------------------------------------
1521  // Event throttle reset functions
1522  // ----------------------------------------------------------------------
1523 
1526  {
1527  // Reset throttle counter
1528  this->m_WriteErrorThrottle = 0;
1529  }
1530 
1533  {
1534  // Reset throttle counter
1535  this->m_ReadErrorThrottle = 0;
1536  }
1537 
1540  {
1541  // Reset throttle counter
1542  this->m_NoBuffersThrottle = 0;
1543  }
1544 
1545  // ----------------------------------------------------------------------
1546  // Telemetry write functions
1547  // ----------------------------------------------------------------------
1548 
1551  U32 arg,
1552  Fw::Time _tlmTime
1553  )
1554  {
1555  if (this->m_Tlm_OutputPort[0].isConnected()) {
1556  if (
1557  this->m_Time_OutputPort[0].isConnected() &&
1558  (_tlmTime == Fw::ZERO_TIME)
1559  ) {
1560  this->m_Time_OutputPort[0].invoke(_tlmTime);
1561  }
1562 
1563  Fw::TlmBuffer _tlmBuff;
1564  Fw::SerializeStatus _stat = _tlmBuff.serialize(arg);
1565  FW_ASSERT(
1566  _stat == Fw::FW_SERIALIZE_OK,
1567  static_cast<FwAssertArgType>(_stat)
1568  );
1569 
1570  FwChanIdType _id;
1571 
1572  _id = this->getIdBase() + CHANNELID_BYTESSENT;
1573 
1574  this->m_Tlm_OutputPort[0].invoke(
1575  _id,
1576  _tlmTime,
1577  _tlmBuff
1578  );
1579  }
1580  }
1581 
1584  U32 arg,
1585  Fw::Time _tlmTime
1586  )
1587  {
1588  if (this->m_Tlm_OutputPort[0].isConnected()) {
1589  if (
1590  this->m_Time_OutputPort[0].isConnected() &&
1591  (_tlmTime == Fw::ZERO_TIME)
1592  ) {
1593  this->m_Time_OutputPort[0].invoke(_tlmTime);
1594  }
1595 
1596  Fw::TlmBuffer _tlmBuff;
1597  Fw::SerializeStatus _stat = _tlmBuff.serialize(arg);
1598  FW_ASSERT(
1599  _stat == Fw::FW_SERIALIZE_OK,
1600  static_cast<FwAssertArgType>(_stat)
1601  );
1602 
1603  FwChanIdType _id;
1604 
1605  _id = this->getIdBase() + CHANNELID_BYTESRECV;
1606 
1607  this->m_Tlm_OutputPort[0].invoke(
1608  _id,
1609  _tlmTime,
1610  _tlmBuff
1611  );
1612  }
1613  }
1614 
1615  // ----------------------------------------------------------------------
1616  // Time
1617  // ----------------------------------------------------------------------
1618 
1620  getTime()
1621  {
1622  if (this->m_Time_OutputPort[0].isConnected()) {
1623  Fw::Time _time;
1624  this->m_Time_OutputPort[0].invoke(_time);
1625  return _time;
1626  }
1627  else {
1628  return Fw::Time(TB_NONE, 0, 0);
1629  }
1630  }
1631 
1632  // ----------------------------------------------------------------------
1633  // Mutex operations for guarded ports
1634  //
1635  // You can override these operations to provide more sophisticated
1636  // synchronization
1637  // ----------------------------------------------------------------------
1638 
1640  lock()
1641  {
1642  this->m_guardedPortMutex.lock();
1643  }
1644 
1646  unLock()
1647  {
1648  this->m_guardedPortMutex.unLock();
1649  }
1650 
1651  // ----------------------------------------------------------------------
1652  // Calls for messages received on typed input ports
1653  // ----------------------------------------------------------------------
1654 
1655  Drv::SendStatus LinuxUartDriverComponentBase ::
1656  m_p_send_in(
1657  Fw::PassiveComponentBase* callComp,
1658  NATIVE_INT_TYPE portNum,
1659  Fw::Buffer& sendBuffer
1660  )
1661  {
1662  FW_ASSERT(callComp);
1663  LinuxUartDriverComponentBase* compPtr = static_cast<LinuxUartDriverComponentBase*>(callComp);
1664  return compPtr->send_handlerBase(
1665  portNum,
1666  sendBuffer
1667  );
1668  }
1669 
1670 }
#define FW_ASSERT(...)
Definition: Assert.hpp:14
PlatformIntType NATIVE_INT_TYPE
Definition: BasicTypes.h:51
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
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
#define FW_LOG_TEXT_BUFFER_SIZE
Max size of string for text log message.
Definition: FpConfig.h:299
#define FW_OBJ_NAME_MAX_SIZE
Size of object name (if object names enabled). AC Limits to 80, truncation occurs above 80.
Definition: FpConfig.h:184
#define FW_OBJECT_NAMES
Indicates whether or not object names are stored (more memory, can be used for tracking objects)
Definition: FpConfig.h:88
void init()
Initialization function.
void addCallComp(Fw::PassiveComponentBase *callComp, CompFuncPtr funcPtr)
Register a component.
Auto-generated base for LinuxUartDriver component.
Drv::SendStatus send_handlerBase(NATIVE_INT_TYPE portNum, Fw::Buffer &sendBuffer)
Handler base-class function for input port send.
void deallocate_out(NATIVE_INT_TYPE portNum, Fw::Buffer &fwBuffer)
Invoke output port deallocate.
void log_WARNING_HI_WriteError_ThrottleClear()
Reset throttle value for WriteError.
bool isConnected_deallocate_OutputPort(NATIVE_INT_TYPE portNum)
void log_WARNING_HI_WriteError(const Fw::LogStringArg &device, I32 error)
void log_ACTIVITY_HI_PortOpened(const Fw::LogStringArg &device)
bool isConnected_Log_OutputPort(NATIVE_INT_TYPE portNum)
@ CHANNELID_BYTESRECV
Channel ID for BytesRecv.
@ CHANNELID_BYTESSENT
Channel ID for BytesSent.
LinuxUartDriverComponentBase(const char *compName="")
Construct LinuxUartDriverComponentBase object.
@ EVENTID_BUFFERTOOSMALL
UART ran out of buffers.
void log_WARNING_HI_ConfigError(const Fw::LogStringArg &device, I32 error)
void log_WARNING_HI_NoBuffers_ThrottleClear()
Reset throttle value for NoBuffers.
@ EVENTID_WRITEERROR_THROTTLE
Throttle reset count for WriteError.
@ EVENTID_READERROR_THROTTLE
Throttle reset count for ReadError.
@ EVENTID_NOBUFFERS_THROTTLE
Throttle reset count for NoBuffers.
void tlmWrite_BytesSent(U32 arg, Fw::Time _tlmTime=Fw::Time())
void log_WARNING_HI_ReadError_ThrottleClear()
Reset throttle value for ReadError.
void set_Time_OutputPort(NATIVE_INT_TYPE portNum, Fw::InputTimePort *port)
Connect port to Time[portNum].
void set_deallocate_OutputPort(NATIVE_INT_TYPE portNum, Fw::InputBufferSendPort *port)
Connect port to deallocate[portNum].
void log_WARNING_HI_OpenError(const Fw::LogStringArg &device, I32 error, const Fw::LogStringArg &name)
void tlmWrite_BytesRecv(U32 arg, Fw::Time _tlmTime=Fw::Time())
bool isConnected_Time_OutputPort(NATIVE_INT_TYPE portNum)
void set_Log_OutputPort(NATIVE_INT_TYPE portNum, Fw::InputLogPort *port)
Connect port to Log[portNum].
void log_WARNING_HI_ReadError(const Fw::LogStringArg &device, I32 error)
Fw::Buffer allocate_out(NATIVE_INT_TYPE portNum, U32 size)
Invoke output port allocate.
bool isConnected_Tlm_OutputPort(NATIVE_INT_TYPE portNum)
bool isConnected_recv_OutputPort(NATIVE_INT_TYPE portNum)
void set_ready_OutputPort(NATIVE_INT_TYPE portNum, Drv::InputByteStreamReadyPort *port)
Connect port to ready[portNum].
void recv_out(NATIVE_INT_TYPE portNum, Fw::Buffer &recvBuffer, const Drv::RecvStatus &recvStatus)
Invoke output port recv.
void set_recv_OutputPort(NATIVE_INT_TYPE portNum, Drv::InputByteStreamRecvPort *port)
Connect port to recv[portNum].
bool isConnected_allocate_OutputPort(NATIVE_INT_TYPE portNum)
void log_WARNING_HI_NoBuffers(const Fw::LogStringArg &device)
virtual ~LinuxUartDriverComponentBase()
Destroy LinuxUartDriverComponentBase object.
void ready_out(NATIVE_INT_TYPE portNum)
Invoke output port ready.
void set_allocate_OutputPort(NATIVE_INT_TYPE portNum, Fw::InputBufferGetPort *port)
Connect port to allocate[portNum].
void log_WARNING_HI_BufferTooSmall(const Fw::LogStringArg &device, U32 size, U32 needed)
virtual Drv::SendStatus send_handler(NATIVE_INT_TYPE portNum, Fw::Buffer &sendBuffer)=0
Handler for input port send.
bool isConnected_ready_OutputPort(NATIVE_INT_TYPE portNum)
Drv::InputByteStreamSendPort * get_send_InputPort(NATIVE_INT_TYPE portNum)
void set_Tlm_OutputPort(NATIVE_INT_TYPE portNum, Fw::InputTlmPort *port)
Connect port to Tlm[portNum].
virtual void lock()
Lock the guarded mutex.
virtual void unLock()
Unlock the guarded mutex.
void invoke()
Invoke a port interface.
void addCallPort(InputByteStreamReadyPort *callPort)
Register an input port.
void init()
Initialization function.
void init()
Initialization function.
void addCallPort(InputByteStreamRecvPort *callPort)
Register an input port.
void invoke(Fw::Buffer &recvBuffer, const Drv::RecvStatus &recvStatus)
Invoke a port interface.
Status associated with the received data.
Status returned by the send call.
void setPortNum(NATIVE_INT_TYPE portNum)
@ WARNING_HI
A serious but recoverable event.
@ ACTIVITY_HI
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
void init()
Initialization function.
void addCallPort(InputBufferGetPort *callPort)
Register an input port.
Fw::Buffer invoke(U32 size)
Invoke a port interface.
void addCallPort(InputBufferSendPort *callPort)
Register an input port.
void invoke(Fw::Buffer &fwBuffer)
Invoke a port interface.
void init()
Initialization function.
void init()
Initialization function.
Definition: LogPortAc.cpp:151
void invoke(FwEventIdType id, Fw::Time &timeTag, const Fw::LogSeverity &severity, Fw::LogBuffer &args)
Invoke a port interface.
Definition: LogPortAc.cpp:170
void addCallPort(InputLogPort *callPort)
Register an input port.
Definition: LogPortAc.cpp:157
void addCallPort(InputTimePort *callPort)
Register an input port.
Definition: TimePortAc.cpp:134
void invoke(Fw::Time &time)
Invoke a port interface.
Definition: TimePortAc.cpp:147
void init()
Initialization function.
Definition: TimePortAc.cpp:128
void addCallPort(InputTlmPort *callPort)
Register an input port.
Definition: TlmPortAc.cpp:150
void init()
Initialization function.
Definition: TlmPortAc.cpp:144
void invoke(FwChanIdType id, Fw::Time &timeTag, Fw::TlmBuffer &val)
Invoke a port interface.
Definition: TlmPortAc.cpp:163
bool isConnected()
Definition: PortBase.cpp:41
SerializeStatus serialize(U8 val)
serialize 8-bit unsigned int
Definition: Time.hpp:9
void unLock()
unlock the mutex
Definition: Mutex.cpp:13
void lock()
lock the mutex
Definition: Mutex.cpp:12
SerializeStatus
forward declaration for string
@ FW_SERIALIZE_OK
Serialization/Deserialization operation was successful.
const Time ZERO_TIME
Definition: Time.cpp:5