F´ Flight Software - C/C++ Documentation
A framework for building embedded system applications to NASA flight quality standards.
All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
LinuxSpiDriverComponentAc.hpp
Go to the documentation of this file.
1 // ======================================================================
2 // \title LinuxSpiDriverComponentAc.hpp
3 // \author Generated by fpp-to-cpp
4 // \brief hpp file for LinuxSpiDriver component base class
5 // ======================================================================
6 
7 #ifndef Drv_LinuxSpiDriverComponentAc_HPP
8 #define Drv_LinuxSpiDriverComponentAc_HPP
9 
10 #include <atomic>
11 
14 #include "Fw/FPrimeBasicTypes.hpp"
15 #include "Fw/Log/LogPortAc.hpp"
16 #include "Fw/Log/LogString.hpp"
17 #if FW_ENABLE_TEXT_LOGGING == 1
18 #include "Fw/Log/LogTextPortAc.hpp"
19 #endif
22 #include "Fw/Time/TimePortAc.hpp"
23 #include "Fw/Tlm/TlmPortAc.hpp"
24 #include "Fw/Tlm/TlmString.hpp"
26 
27 namespace Drv {
28 
33  {
34 
35  // ----------------------------------------------------------------------
36  // Friend classes
37  // ----------------------------------------------------------------------
38 
42  friend class LinuxSpiDriverTester;
43 
44  protected:
45 
46  // ----------------------------------------------------------------------
47  // Constants
48  // ----------------------------------------------------------------------
49 
51  enum {
53  };
54 
56  enum {
61  };
62 
64  enum {
69  };
70 
72  enum {
74  };
75 
77  enum {
79  };
80 
81  public:
82 
83  // ----------------------------------------------------------------------
84  // Component initialization
85  // ----------------------------------------------------------------------
86 
88  void init(
89  FwEnumStoreType instance = 0
90  );
91 
92  public:
93 
94  // ----------------------------------------------------------------------
95  // Getters for typed input ports
96  // ----------------------------------------------------------------------
97 
102  FwIndexType portNum
103  );
104 
105  public:
106 
107  // ----------------------------------------------------------------------
108  // Connect input ports to special output ports
109  // ----------------------------------------------------------------------
110 
112  void set_Log_OutputPort(
113  FwIndexType portNum,
114  Fw::InputLogPort* port
115  );
116 
117 #if FW_ENABLE_TEXT_LOGGING == 1
118 
120  void set_LogText_OutputPort(
121  FwIndexType portNum,
122  Fw::InputLogTextPort* port
123  );
124 
125 #endif
126 
128  void set_Time_OutputPort(
129  FwIndexType portNum,
130  Fw::InputTimePort* port
131  );
132 
134  void set_Tlm_OutputPort(
135  FwIndexType portNum,
136  Fw::InputTlmPort* port
137  );
138 
139 #if FW_PORT_SERIALIZATION
140 
141  public:
142 
143  // ----------------------------------------------------------------------
144  // Connect serial input ports to special output ports
145  // ----------------------------------------------------------------------
146 
148  void set_Log_OutputPort(
149  FwIndexType portNum,
150  Fw::InputSerializePort* port
151  );
152 
153 #if FW_ENABLE_TEXT_LOGGING == 1
154 
156  void set_LogText_OutputPort(
157  FwIndexType portNum,
158  Fw::InputSerializePort* port
159  );
160 
161 #endif
162 
164  void set_Time_OutputPort(
165  FwIndexType portNum,
166  Fw::InputSerializePort* port
167  );
168 
170  void set_Tlm_OutputPort(
171  FwIndexType portNum,
172  Fw::InputSerializePort* port
173  );
174 
175 #endif
176 
177  protected:
178 
179  // ----------------------------------------------------------------------
180  // Component construction and destruction
181  // ----------------------------------------------------------------------
182 
185  const char* compName = ""
186  );
187 
190 
191  protected:
192 
193  // ----------------------------------------------------------------------
194  // Getters for numbers of typed input ports
195  // ----------------------------------------------------------------------
196 
201 
202  protected:
203 
204  // ----------------------------------------------------------------------
205  // Getters for numbers of special output ports
206  // ----------------------------------------------------------------------
207 
212 
213 #if FW_ENABLE_TEXT_LOGGING == 1
214 
218  FwIndexType getNum_LogText_OutputPorts() const;
219 
220 #endif
221 
226 
231 
232  protected:
233 
234  // ----------------------------------------------------------------------
235  // Connection status queries for special output ports
236  // ----------------------------------------------------------------------
237 
242  FwIndexType portNum
243  );
244 
245 #if FW_ENABLE_TEXT_LOGGING == 1
246 
250  bool isConnected_LogText_OutputPort(
251  FwIndexType portNum
252  );
253 
254 #endif
255 
260  FwIndexType portNum
261  );
262 
267  FwIndexType portNum
268  );
269 
270  protected:
271 
272  // ----------------------------------------------------------------------
273  // Handlers to implement for typed input ports
274  // ----------------------------------------------------------------------
275 
277  virtual void SpiReadWrite_handler(
278  FwIndexType portNum,
279  Fw::Buffer& writeBuffer,
280  Fw::Buffer& readBuffer
281  ) = 0;
282 
283  protected:
284 
285  // ----------------------------------------------------------------------
286  // Port handler base-class functions for typed input ports
287  //
288  // Call these functions directly to bypass the corresponding ports
289  // ----------------------------------------------------------------------
290 
293  FwIndexType portNum,
294  Fw::Buffer& writeBuffer,
295  Fw::Buffer& readBuffer
296  );
297 
298  protected:
299 
300  // ----------------------------------------------------------------------
301  // Event logging functions
302  // ----------------------------------------------------------------------
303 
308  I32 device,
309  I32 select,
310  I32 error
311  ) const;
312 
317  I32 device,
318  I32 select,
319  I32 error
320  ) const;
321 
326  I32 device,
327  I32 select,
328  I32 error
329  );
330 
335  I32 device,
336  I32 select
337  ) const;
338 
339  protected:
340 
341  // ----------------------------------------------------------------------
342  // Event throttle reset functions
343  // ----------------------------------------------------------------------
344 
347 
348  protected:
349 
350  // ----------------------------------------------------------------------
351  // Telemetry write functions
352  // ----------------------------------------------------------------------
353 
357  void tlmWrite_SPI_Bytes(
358  FwSizeType arg,
359  Fw::Time _tlmTime = Fw::Time()
360  ) const;
361 
362  protected:
363 
364  // ----------------------------------------------------------------------
365  // Time
366  // ----------------------------------------------------------------------
367 
371  Fw::Time getTime() const;
372 
373  private:
374 
375  // ----------------------------------------------------------------------
376  // Calls for messages received on typed input ports
377  // ----------------------------------------------------------------------
378 
380  static void m_p_SpiReadWrite_in(
381  Fw::PassiveComponentBase* callComp,
382  FwIndexType portNum,
383  Fw::Buffer& writeBuffer,
384  Fw::Buffer& readBuffer
385  );
386 
387  private:
388 
389  // ----------------------------------------------------------------------
390  // Typed input ports
391  // ----------------------------------------------------------------------
392 
395 
396  private:
397 
398  // ----------------------------------------------------------------------
399  // Special output ports
400  // ----------------------------------------------------------------------
401 
403  Fw::OutputLogPort m_Log_OutputPort[NUM_LOG_OUTPUT_PORTS];
404 
405 #if FW_ENABLE_TEXT_LOGGING == 1
406 
408  Fw::OutputLogTextPort m_LogText_OutputPort[NUM_LOGTEXT_OUTPUT_PORTS];
409 
410 #endif
411 
413  Fw::OutputTimePort m_Time_OutputPort[NUM_TIME_OUTPUT_PORTS];
414 
416  Fw::OutputTlmPort m_Tlm_OutputPort[NUM_TLM_OUTPUT_PORTS];
417 
418  private:
419 
420  // ----------------------------------------------------------------------
421  // Counter values for event throttling
422  // ----------------------------------------------------------------------
423 
425  std::atomic<FwIndexType> m_SPI_WriteErrorThrottle;
426 
427  };
428 
429 }
430 
431 #endif
void SpiReadWrite_handlerBase(FwIndexType portNum, Fw::Buffer &writeBuffer, Fw::Buffer &readBuffer)
Handler base-class function for input port SpiReadWrite.
void log_WARNING_HI_SPI_ConfigError(I32 device, I32 select, I32 error) const
PlatformSizeType FwSizeType
I32 FwEnumStoreType
virtual void SpiReadWrite_handler(FwIndexType portNum, Fw::Buffer &writeBuffer, Fw::Buffer &readBuffer)=0
Handler for input port SpiReadWrite.
friend class LinuxSpiDriverTester
Friend class tester implementation to support white-box testing.
void log_WARNING_HI_SPI_WriteError(I32 device, I32 select, I32 error)
friend class LinuxSpiDriverTesterBase
Friend class tester to support autocoded test harness.
virtual ~LinuxSpiDriverComponentBase()
Destroy LinuxSpiDriverComponentBase object.
void set_Time_OutputPort(FwIndexType portNum, Fw::InputTimePort *port)
Connect port to Time[portNum].
void init()
Object initializer.
Definition: ObjBase.cpp:24
bool isConnected_Tlm_OutputPort(FwIndexType portNum)
void log_WARNING_HI_SPI_WriteError_ThrottleClear()
Reset throttle value for SPI_WriteError.
void tlmWrite_SPI_Bytes(FwSizeType arg, Fw::Time _tlmTime=Fw::Time()) const
Drv::InputSpiReadWritePort * get_SpiReadWrite_InputPort(FwIndexType portNum)
Auto-generated base for LinuxSpiDriver component.
bool isConnected_Time_OutputPort(FwIndexType portNum)
LinuxSpiDriverComponentBase(const char *compName="")
Construct LinuxSpiDriverComponentBase object.
void log_ACTIVITY_HI_SPI_PortOpened(I32 device, I32 select) const
void set_Log_OutputPort(FwIndexType portNum, Fw::InputLogPort *port)
Connect port to Log[portNum].
void log_WARNING_HI_SPI_OpenError(I32 device, I32 select, I32 error) const
void set_Tlm_OutputPort(FwIndexType portNum, Fw::InputTlmPort *port)
Connect port to Tlm[portNum].
bool isConnected_Log_OutputPort(FwIndexType portNum)
PlatformIndexType FwIndexType
Input SpiReadWrite port.