F´ Flight Software - C/C++ Documentation  devel
A framework for building embedded system applications to NASA flight quality standards.
LinuxUartDriverComponentAc.hpp
Go to the documentation of this file.
1 // ======================================================================
2 // \title LinuxUartDriverComponentAc.hpp
3 // \author Generated by fpp-to-cpp
4 // \brief hpp file for LinuxUartDriver component base class
5 // ======================================================================
6 
7 #ifndef Drv_LinuxUartDriverComponentAc_HPP
8 #define Drv_LinuxUartDriverComponentAc_HPP
9 
13 #include "FpConfig.hpp"
17 #include "Fw/Log/LogPortAc.hpp"
18 #include "Fw/Log/LogString.hpp"
19 #if FW_ENABLE_TEXT_LOGGING == 1
20 #include "Fw/Log/LogTextPortAc.hpp"
21 #endif
24 #include "Fw/Time/TimePortAc.hpp"
25 #include "Fw/Tlm/TlmPortAc.hpp"
26 #include "Fw/Tlm/TlmString.hpp"
27 #include "Os/Mutex.hpp"
28 
29 namespace Drv {
30 
35  {
36 
37  // ----------------------------------------------------------------------
38  // Friend classes
39  // ----------------------------------------------------------------------
40 
43 
44  PROTECTED:
45 
46  // ----------------------------------------------------------------------
47  // Constants
48  // ----------------------------------------------------------------------
49 
51  enum {
53  };
54 
56  enum {
61  };
62 
64  enum {
69  };
70 
72  enum {
80  };
81 
83  enum {
87  };
88 
90  enum {
93  };
94 
95  public:
96 
97  // ----------------------------------------------------------------------
98  // Component initialization
99  // ----------------------------------------------------------------------
100 
102  void init(
103  NATIVE_INT_TYPE instance = 0
104  );
105 
106  public:
107 
108  // ----------------------------------------------------------------------
109  // Getters for typed input ports
110  // ----------------------------------------------------------------------
111 
116  NATIVE_INT_TYPE portNum
117  );
118 
119  public:
120 
121  // ----------------------------------------------------------------------
122  // Connect input ports to special output ports
123  // ----------------------------------------------------------------------
124 
126  void set_Log_OutputPort(
127  NATIVE_INT_TYPE portNum,
128  Fw::InputLogPort* port
129  );
130 
131 #if FW_ENABLE_TEXT_LOGGING == 1
132 
134  void set_LogText_OutputPort(
135  NATIVE_INT_TYPE portNum,
136  Fw::InputLogTextPort* port
137  );
138 
139 #endif
140 
142  void set_Time_OutputPort(
143  NATIVE_INT_TYPE portNum,
144  Fw::InputTimePort* port
145  );
146 
148  void set_Tlm_OutputPort(
149  NATIVE_INT_TYPE portNum,
150  Fw::InputTlmPort* port
151  );
152 
153  public:
154 
155  // ----------------------------------------------------------------------
156  // Connect typed input ports to typed output ports
157  // ----------------------------------------------------------------------
158 
161  NATIVE_INT_TYPE portNum,
163  );
164 
167  NATIVE_INT_TYPE portNum,
169  );
170 
173  NATIVE_INT_TYPE portNum,
175  );
176 
178  void set_recv_OutputPort(
179  NATIVE_INT_TYPE portNum,
181  );
182 
183 #if FW_PORT_SERIALIZATION
184 
185  public:
186 
187  // ----------------------------------------------------------------------
188  // Connect serial input ports to special output ports
189  // ----------------------------------------------------------------------
190 
192  void set_Log_OutputPort(
193  NATIVE_INT_TYPE portNum,
194  Fw::InputSerializePort* port
195  );
196 
197 #if FW_ENABLE_TEXT_LOGGING == 1
198 
200  void set_LogText_OutputPort(
201  NATIVE_INT_TYPE portNum,
202  Fw::InputSerializePort* port
203  );
204 
205 #endif
206 
208  void set_Time_OutputPort(
209  NATIVE_INT_TYPE portNum,
210  Fw::InputSerializePort* port
211  );
212 
214  void set_Tlm_OutputPort(
215  NATIVE_INT_TYPE portNum,
216  Fw::InputSerializePort* port
217  );
218 
219 #endif
220 
221 #if FW_PORT_SERIALIZATION
222 
223  public:
224 
225  // ----------------------------------------------------------------------
226  // Connect serial input ports to typed output ports
227  // ----------------------------------------------------------------------
228 
231  NATIVE_INT_TYPE portNum,
232  Fw::InputSerializePort* port
233  );
234 
237  NATIVE_INT_TYPE portNum,
238  Fw::InputSerializePort* port
239  );
240 
242  void set_recv_OutputPort(
243  NATIVE_INT_TYPE portNum,
244  Fw::InputSerializePort* port
245  );
246 
247 #endif
248 
249  PROTECTED:
250 
251  // ----------------------------------------------------------------------
252  // Component construction and destruction
253  // ----------------------------------------------------------------------
254 
257  const char* compName = ""
258  );
259 
262 
263  PROTECTED:
264 
265  // ----------------------------------------------------------------------
266  // Getters for numbers of typed input ports
267  // ----------------------------------------------------------------------
268 
273 
274  PROTECTED:
275 
276  // ----------------------------------------------------------------------
277  // Getters for numbers of special output ports
278  // ----------------------------------------------------------------------
279 
284 
285 #if FW_ENABLE_TEXT_LOGGING == 1
286 
290  NATIVE_INT_TYPE getNum_LogText_OutputPorts() const;
291 
292 #endif
293 
298 
303 
304  PROTECTED:
305 
306  // ----------------------------------------------------------------------
307  // Getters for numbers of typed output ports
308  // ----------------------------------------------------------------------
309 
314 
319 
324 
329 
330  PROTECTED:
331 
332  // ----------------------------------------------------------------------
333  // Connection status queries for special output ports
334  // ----------------------------------------------------------------------
335 
340  NATIVE_INT_TYPE portNum
341  );
342 
343 #if FW_ENABLE_TEXT_LOGGING == 1
344 
348  bool isConnected_LogText_OutputPort(
349  NATIVE_INT_TYPE portNum
350  );
351 
352 #endif
353 
358  NATIVE_INT_TYPE portNum
359  );
360 
365  NATIVE_INT_TYPE portNum
366  );
367 
368  PROTECTED:
369 
370  // ----------------------------------------------------------------------
371  // Connection status queries for typed output ports
372  // ----------------------------------------------------------------------
373 
378  NATIVE_INT_TYPE portNum
379  );
380 
385  NATIVE_INT_TYPE portNum
386  );
387 
392  NATIVE_INT_TYPE portNum
393  );
394 
399  NATIVE_INT_TYPE portNum
400  );
401 
402  PROTECTED:
403 
404  // ----------------------------------------------------------------------
405  // Handlers to implement for typed input ports
406  // ----------------------------------------------------------------------
407 
410  NATIVE_INT_TYPE portNum,
411  Fw::Buffer& sendBuffer
412  ) = 0;
413 
414  PROTECTED:
415 
416  // ----------------------------------------------------------------------
417  // Port handler base-class functions for typed input ports
418  //
419  // Call these functions directly to bypass the corresponding ports
420  // ----------------------------------------------------------------------
421 
424  NATIVE_INT_TYPE portNum,
425  Fw::Buffer& sendBuffer
426  );
427 
428  PROTECTED:
429 
430  // ----------------------------------------------------------------------
431  // Invocation functions for typed output ports
432  // ----------------------------------------------------------------------
433 
436  NATIVE_INT_TYPE portNum,
437  U32 size
438  );
439 
441  void deallocate_out(
442  NATIVE_INT_TYPE portNum,
443  Fw::Buffer& fwBuffer
444  );
445 
447  void ready_out(
448  NATIVE_INT_TYPE portNum
449  );
450 
452  void recv_out(
453  NATIVE_INT_TYPE portNum,
454  Fw::Buffer& recvBuffer,
455  const Drv::RecvStatus& recvStatus
456  );
457 
458  PROTECTED:
459 
460  // ----------------------------------------------------------------------
461  // Event logging functions
462  // ----------------------------------------------------------------------
463 
468  const Fw::LogStringArg& device,
469  I32 error,
470  const Fw::LogStringArg& name
471  );
472 
477  const Fw::LogStringArg& device,
478  I32 error
479  );
480 
485  const Fw::LogStringArg& device,
486  I32 error
487  );
488 
493  const Fw::LogStringArg& device,
494  I32 error
495  );
496 
501  const Fw::LogStringArg& device
502  );
503 
508  const Fw::LogStringArg& device
509  );
510 
515  const Fw::LogStringArg& device,
516  U32 size,
517  U32 needed
518  );
519 
520  PROTECTED:
521 
522  // ----------------------------------------------------------------------
523  // Event throttle reset functions
524  // ----------------------------------------------------------------------
525 
528 
531 
534 
535  PROTECTED:
536 
537  // ----------------------------------------------------------------------
538  // Telemetry write functions
539  // ----------------------------------------------------------------------
540 
544  void tlmWrite_BytesSent(
545  U32 arg,
546  Fw::Time _tlmTime = Fw::Time()
547  );
548 
552  void tlmWrite_BytesRecv(
553  U32 arg,
554  Fw::Time _tlmTime = Fw::Time()
555  );
556 
557  PROTECTED:
558 
559  // ----------------------------------------------------------------------
560  // Time
561  // ----------------------------------------------------------------------
562 
566  Fw::Time getTime();
567 
568  PROTECTED:
569 
570  // ----------------------------------------------------------------------
571  // Mutex operations for guarded ports
572  //
573  // You can override these operations to provide more sophisticated
574  // synchronization
575  // ----------------------------------------------------------------------
576 
578  virtual void lock();
579 
581  virtual void unLock();
582 
583  PRIVATE:
584 
585  // ----------------------------------------------------------------------
586  // Calls for messages received on typed input ports
587  // ----------------------------------------------------------------------
588 
590  static Drv::SendStatus m_p_send_in(
591  Fw::PassiveComponentBase* callComp,
592  NATIVE_INT_TYPE portNum,
593  Fw::Buffer& sendBuffer
594  );
595 
596  PRIVATE:
597 
598  // ----------------------------------------------------------------------
599  // Typed input ports
600  // ----------------------------------------------------------------------
601 
604 
605  PRIVATE:
606 
607  // ----------------------------------------------------------------------
608  // Special output ports
609  // ----------------------------------------------------------------------
610 
612  Fw::OutputLogPort m_Log_OutputPort[NUM_LOG_OUTPUT_PORTS];
613 
614 #if FW_ENABLE_TEXT_LOGGING == 1
615 
617  Fw::OutputLogTextPort m_LogText_OutputPort[NUM_LOGTEXT_OUTPUT_PORTS];
618 
619 #endif
620 
622  Fw::OutputTimePort m_Time_OutputPort[NUM_TIME_OUTPUT_PORTS];
623 
625  Fw::OutputTlmPort m_Tlm_OutputPort[NUM_TLM_OUTPUT_PORTS];
626 
627  PRIVATE:
628 
629  // ----------------------------------------------------------------------
630  // Typed output ports
631  // ----------------------------------------------------------------------
632 
634  Fw::OutputBufferGetPort m_allocate_OutputPort[NUM_ALLOCATE_OUTPUT_PORTS];
635 
637  Fw::OutputBufferSendPort m_deallocate_OutputPort[NUM_DEALLOCATE_OUTPUT_PORTS];
638 
641 
644 
645  PRIVATE:
646 
647  // ----------------------------------------------------------------------
648  // Counter values for event throttling
649  // ----------------------------------------------------------------------
650 
652  NATIVE_UINT_TYPE m_WriteErrorThrottle;
653 
655  NATIVE_UINT_TYPE m_ReadErrorThrottle;
656 
658  NATIVE_UINT_TYPE m_NoBuffersThrottle;
659 
660  PRIVATE:
661 
662  // ----------------------------------------------------------------------
663  // Mutexes
664  // ----------------------------------------------------------------------
665 
667  Os::Mutex m_guardedPortMutex;
668 
669  };
670 
671 }
672 
673 #endif
PlatformIntType NATIVE_INT_TYPE
Definition: BasicTypes.h:51
PlatformUIntType NATIVE_UINT_TYPE
Definition: BasicTypes.h:52
C++-compatible configuration header for fprime configuration.
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)
friend class LinuxUartDriverComponentBaseFriend
Friend class for white-box testing.
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.
Status associated with the received data.
Status returned by the send call.
void init()
Object initializer.
Definition: ObjBase.cpp:27
Definition: Time.hpp:9