F´ Flight Software - C/C++ Documentation  devel
A framework for building embedded system applications to NASA flight quality standards.
All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
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  FwEnumStoreType instance = 0
104  );
105 
106  public:
107 
108  // ----------------------------------------------------------------------
109  // Getters for typed input ports
110  // ----------------------------------------------------------------------
111 
116  FwIndexType portNum
117  );
118 
119  public:
120 
121  // ----------------------------------------------------------------------
122  // Connect input ports to special output ports
123  // ----------------------------------------------------------------------
124 
126  void set_Log_OutputPort(
127  FwIndexType portNum,
128  Fw::InputLogPort* port
129  );
130 
131 #if FW_ENABLE_TEXT_LOGGING == 1
132 
134  void set_LogText_OutputPort(
135  FwIndexType portNum,
136  Fw::InputLogTextPort* port
137  );
138 
139 #endif
140 
142  void set_Time_OutputPort(
143  FwIndexType portNum,
144  Fw::InputTimePort* port
145  );
146 
148  void set_Tlm_OutputPort(
149  FwIndexType portNum,
150  Fw::InputTlmPort* port
151  );
152 
153  public:
154 
155  // ----------------------------------------------------------------------
156  // Connect typed input ports to typed output ports
157  // ----------------------------------------------------------------------
158 
161  FwIndexType portNum,
163  );
164 
167  FwIndexType portNum,
169  );
170 
173  FwIndexType portNum,
175  );
176 
178  void set_recv_OutputPort(
179  FwIndexType 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  FwIndexType portNum,
194  Fw::InputSerializePort* port
195  );
196 
197 #if FW_ENABLE_TEXT_LOGGING == 1
198 
200  void set_LogText_OutputPort(
201  FwIndexType portNum,
202  Fw::InputSerializePort* port
203  );
204 
205 #endif
206 
208  void set_Time_OutputPort(
209  FwIndexType portNum,
210  Fw::InputSerializePort* port
211  );
212 
214  void set_Tlm_OutputPort(
215  FwIndexType 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  FwIndexType portNum,
232  Fw::InputSerializePort* port
233  );
234 
237  FwIndexType portNum,
238  Fw::InputSerializePort* port
239  );
240 
242  void set_recv_OutputPort(
243  FwIndexType 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  FwIndexType 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  FwIndexType portNum
341  );
342 
343 #if FW_ENABLE_TEXT_LOGGING == 1
344 
348  bool isConnected_LogText_OutputPort(
349  FwIndexType portNum
350  );
351 
352 #endif
353 
358  FwIndexType portNum
359  );
360 
365  FwIndexType portNum
366  );
367 
368  PROTECTED:
369 
370  // ----------------------------------------------------------------------
371  // Connection status queries for typed output ports
372  // ----------------------------------------------------------------------
373 
378  FwIndexType portNum
379  );
380 
385  FwIndexType portNum
386  );
387 
392  FwIndexType portNum
393  );
394 
399  FwIndexType portNum
400  );
401 
402  PROTECTED:
403 
404  // ----------------------------------------------------------------------
405  // Handlers to implement for typed input ports
406  // ----------------------------------------------------------------------
407 
410  FwIndexType 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  FwIndexType portNum,
425  Fw::Buffer& sendBuffer
426  );
427 
428  PROTECTED:
429 
430  // ----------------------------------------------------------------------
431  // Invocation functions for typed output ports
432  // ----------------------------------------------------------------------
433 
436  FwIndexType portNum,
437  U32 size
438  );
439 
441  void deallocate_out(
442  FwIndexType portNum,
443  Fw::Buffer& fwBuffer
444  );
445 
447  void ready_out(
448  FwIndexType portNum
449  );
450 
452  void recv_out(
453  FwIndexType 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::StringBase& device,
469  I32 error,
470  const Fw::StringBase& name
471  );
472 
477  const Fw::StringBase& device,
478  I32 error
479  );
480 
485  const Fw::StringBase& device,
486  I32 error
487  );
488 
493  const Fw::StringBase& device,
494  I32 error
495  );
496 
501  const Fw::StringBase& device
502  );
503 
508  const Fw::StringBase& device
509  );
510 
515  const Fw::StringBase& 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  FwIndexType 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  FwIndexType m_WriteErrorThrottle;
653 
655  FwIndexType m_ReadErrorThrottle;
656 
658  FwIndexType m_NoBuffersThrottle;
659 
660  PRIVATE:
661 
662  // ----------------------------------------------------------------------
663  // Mutexes
664  // ----------------------------------------------------------------------
665 
667  Os::Mutex m_guardedPortMutex;
668 
669  };
670 
671 }
672 
673 #endif
I32 FwEnumStoreType
Definition: FpConfig.h:64
PlatformIndexType FwIndexType
Definition: FpConfig.h:25
C++-compatible configuration header for fprime configuration.
Auto-generated base for LinuxUartDriver component.
void deallocate_out(FwIndexType portNum, Fw::Buffer &fwBuffer)
Invoke output port deallocate.
void log_WARNING_HI_WriteError_ThrottleClear()
Reset throttle value for WriteError.
@ EVENTID_WRITEERROR_THROTTLE
Throttle reset count for WriteError.
@ EVENTID_READERROR_THROTTLE
Throttle reset count for ReadError.
@ EVENTID_NOBUFFERS_THROTTLE
Throttle reset count for NoBuffers.
@ EVENTID_BUFFERTOOSMALL
UART ran out of buffers.
LinuxUartDriverComponentBase(const char *compName="")
Construct LinuxUartDriverComponentBase object.
void log_WARNING_HI_OpenError(const Fw::StringBase &device, I32 error, const Fw::StringBase &name)
bool isConnected_Time_OutputPort(FwIndexType portNum)
void log_WARNING_HI_BufferTooSmall(const Fw::StringBase &device, U32 size, U32 needed)
Drv::InputByteStreamSendPort * get_send_InputPort(FwIndexType portNum)
bool isConnected_deallocate_OutputPort(FwIndexType portNum)
void log_WARNING_HI_NoBuffers_ThrottleClear()
Reset throttle value for NoBuffers.
bool isConnected_Tlm_OutputPort(FwIndexType portNum)
void ready_out(FwIndexType portNum)
Invoke output port ready.
void set_Tlm_OutputPort(FwIndexType portNum, Fw::InputTlmPort *port)
Connect port to Tlm[portNum].
void tlmWrite_BytesSent(U32 arg, Fw::Time _tlmTime=Fw::Time())
Drv::SendStatus send_handlerBase(FwIndexType portNum, Fw::Buffer &sendBuffer)
Handler base-class function for input port send.
void set_Log_OutputPort(FwIndexType portNum, Fw::InputLogPort *port)
Connect port to Log[portNum].
void log_WARNING_HI_ReadError_ThrottleClear()
Reset throttle value for ReadError.
void log_WARNING_HI_WriteError(const Fw::StringBase &device, I32 error)
void recv_out(FwIndexType portNum, Fw::Buffer &recvBuffer, const Drv::RecvStatus &recvStatus)
Invoke output port recv.
bool isConnected_Log_OutputPort(FwIndexType portNum)
void log_WARNING_HI_ConfigError(const Fw::StringBase &device, I32 error)
void tlmWrite_BytesRecv(U32 arg, Fw::Time _tlmTime=Fw::Time())
void log_WARNING_HI_NoBuffers(const Fw::StringBase &device)
void log_ACTIVITY_HI_PortOpened(const Fw::StringBase &device)
friend class LinuxUartDriverComponentBaseFriend
Friend class for white-box testing.
@ CHANNELID_BYTESRECV
Channel ID for BytesRecv.
@ CHANNELID_BYTESSENT
Channel ID for BytesSent.
bool isConnected_recv_OutputPort(FwIndexType portNum)
bool isConnected_allocate_OutputPort(FwIndexType portNum)
bool isConnected_ready_OutputPort(FwIndexType portNum)
virtual Drv::SendStatus send_handler(FwIndexType portNum, Fw::Buffer &sendBuffer)=0
Handler for input port send.
void set_allocate_OutputPort(FwIndexType portNum, Fw::InputBufferGetPort *port)
Connect port to allocate[portNum].
Fw::Buffer allocate_out(FwIndexType portNum, U32 size)
Invoke output port allocate.
void set_recv_OutputPort(FwIndexType portNum, Drv::InputByteStreamRecvPort *port)
Connect port to recv[portNum].
virtual ~LinuxUartDriverComponentBase()
Destroy LinuxUartDriverComponentBase object.
void set_ready_OutputPort(FwIndexType portNum, Drv::InputByteStreamReadyPort *port)
Connect port to ready[portNum].
void set_deallocate_OutputPort(FwIndexType portNum, Fw::InputBufferSendPort *port)
Connect port to deallocate[portNum].
virtual void lock()
Lock the guarded mutex.
void set_Time_OutputPort(FwIndexType portNum, Fw::InputTimePort *port)
Connect port to Time[portNum].
virtual void unLock()
Unlock the guarded mutex.
void log_WARNING_HI_ReadError(const Fw::StringBase &device, I32 error)
Status associated with the received data.
Status returned by the send call.
void init()
Object initializer.
Definition: ObjBase.cpp:27
Definition: Time.hpp:9