F´ Flight Software - C/C++ Documentation
A framework for building embedded system applications to NASA flight quality standards.
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"
25 
26 namespace Drv {
27 
32  {
33 
34  // ----------------------------------------------------------------------
35  // Friend classes
36  // ----------------------------------------------------------------------
37 
42 
43  PROTECTED:
44 
45  // ----------------------------------------------------------------------
46  // Constants
47  // ----------------------------------------------------------------------
48 
50  enum {
52  };
53 
55  enum {
60  };
61 
63  enum {
68  };
69 
71  enum {
73  };
74 
76  enum {
78  };
79 
80  public:
81 
82  // ----------------------------------------------------------------------
83  // Component initialization
84  // ----------------------------------------------------------------------
85 
87  void init(
88  FwEnumStoreType instance = 0
89  );
90 
91  public:
92 
93  // ----------------------------------------------------------------------
94  // Getters for typed input ports
95  // ----------------------------------------------------------------------
96 
101  FwIndexType portNum
102  );
103 
104  public:
105 
106  // ----------------------------------------------------------------------
107  // Connect input ports to special output ports
108  // ----------------------------------------------------------------------
109 
111  void set_Log_OutputPort(
112  FwIndexType portNum,
113  Fw::InputLogPort* port
114  );
115 
116 #if FW_ENABLE_TEXT_LOGGING == 1
117 
119  void set_LogText_OutputPort(
120  FwIndexType portNum,
121  Fw::InputLogTextPort* port
122  );
123 
124 #endif
125 
127  void set_Time_OutputPort(
128  FwIndexType portNum,
129  Fw::InputTimePort* port
130  );
131 
133  void set_Tlm_OutputPort(
134  FwIndexType portNum,
135  Fw::InputTlmPort* port
136  );
137 
138 #if FW_PORT_SERIALIZATION
139 
140  public:
141 
142  // ----------------------------------------------------------------------
143  // Connect serial input ports to special output ports
144  // ----------------------------------------------------------------------
145 
147  void set_Log_OutputPort(
148  FwIndexType portNum,
149  Fw::InputSerializePort* port
150  );
151 
152 #if FW_ENABLE_TEXT_LOGGING == 1
153 
155  void set_LogText_OutputPort(
156  FwIndexType portNum,
157  Fw::InputSerializePort* port
158  );
159 
160 #endif
161 
163  void set_Time_OutputPort(
164  FwIndexType portNum,
165  Fw::InputSerializePort* port
166  );
167 
169  void set_Tlm_OutputPort(
170  FwIndexType portNum,
171  Fw::InputSerializePort* port
172  );
173 
174 #endif
175 
176  PROTECTED:
177 
178  // ----------------------------------------------------------------------
179  // Component construction and destruction
180  // ----------------------------------------------------------------------
181 
184  const char* compName = ""
185  );
186 
189 
190  PROTECTED:
191 
192  // ----------------------------------------------------------------------
193  // Getters for numbers of typed input ports
194  // ----------------------------------------------------------------------
195 
200 
201  PROTECTED:
202 
203  // ----------------------------------------------------------------------
204  // Getters for numbers of special output ports
205  // ----------------------------------------------------------------------
206 
211 
212 #if FW_ENABLE_TEXT_LOGGING == 1
213 
217  FwIndexType getNum_LogText_OutputPorts() const;
218 
219 #endif
220 
225 
230 
231  PROTECTED:
232 
233  // ----------------------------------------------------------------------
234  // Connection status queries for special output ports
235  // ----------------------------------------------------------------------
236 
241  FwIndexType portNum
242  );
243 
244 #if FW_ENABLE_TEXT_LOGGING == 1
245 
249  bool isConnected_LogText_OutputPort(
250  FwIndexType portNum
251  );
252 
253 #endif
254 
259  FwIndexType portNum
260  );
261 
266  FwIndexType portNum
267  );
268 
269  PROTECTED:
270 
271  // ----------------------------------------------------------------------
272  // Handlers to implement for typed input ports
273  // ----------------------------------------------------------------------
274 
276  virtual void SpiReadWrite_handler(
277  FwIndexType portNum,
278  Fw::Buffer& writeBuffer,
279  Fw::Buffer& readBuffer
280  ) = 0;
281 
282  PROTECTED:
283 
284  // ----------------------------------------------------------------------
285  // Port handler base-class functions for typed input ports
286  //
287  // Call these functions directly to bypass the corresponding ports
288  // ----------------------------------------------------------------------
289 
292  FwIndexType portNum,
293  Fw::Buffer& writeBuffer,
294  Fw::Buffer& readBuffer
295  );
296 
297  PROTECTED:
298 
299  // ----------------------------------------------------------------------
300  // Event logging functions
301  // ----------------------------------------------------------------------
302 
307  I32 device,
308  I32 select,
309  I32 error
310  ) const;
311 
316  I32 device,
317  I32 select,
318  I32 error
319  ) const;
320 
325  I32 device,
326  I32 select,
327  I32 error
328  );
329 
334  I32 device,
335  I32 select
336  ) const;
337 
338  PROTECTED:
339 
340  // ----------------------------------------------------------------------
341  // Event throttle reset functions
342  // ----------------------------------------------------------------------
343 
346 
347  PROTECTED:
348 
349  // ----------------------------------------------------------------------
350  // Telemetry write functions
351  // ----------------------------------------------------------------------
352 
356  void tlmWrite_SPI_Bytes(
357  U32 arg,
358  Fw::Time _tlmTime = Fw::Time()
359  ) const;
360 
361  PROTECTED:
362 
363  // ----------------------------------------------------------------------
364  // Time
365  // ----------------------------------------------------------------------
366 
370  Fw::Time getTime() const;
371 
372  PRIVATE:
373 
374  // ----------------------------------------------------------------------
375  // Calls for messages received on typed input ports
376  // ----------------------------------------------------------------------
377 
379  static void m_p_SpiReadWrite_in(
380  Fw::PassiveComponentBase* callComp,
381  FwIndexType portNum,
382  Fw::Buffer& writeBuffer,
383  Fw::Buffer& readBuffer
384  );
385 
386  PRIVATE:
387 
388  // ----------------------------------------------------------------------
389  // Typed input ports
390  // ----------------------------------------------------------------------
391 
394 
395  PRIVATE:
396 
397  // ----------------------------------------------------------------------
398  // Special output ports
399  // ----------------------------------------------------------------------
400 
402  Fw::OutputLogPort m_Log_OutputPort[NUM_LOG_OUTPUT_PORTS];
403 
404 #if FW_ENABLE_TEXT_LOGGING == 1
405 
407  Fw::OutputLogTextPort m_LogText_OutputPort[NUM_LOGTEXT_OUTPUT_PORTS];
408 
409 #endif
410 
412  Fw::OutputTimePort m_Time_OutputPort[NUM_TIME_OUTPUT_PORTS];
413 
415  Fw::OutputTlmPort m_Tlm_OutputPort[NUM_TLM_OUTPUT_PORTS];
416 
417  PRIVATE:
418 
419  // ----------------------------------------------------------------------
420  // Counter values for event throttling
421  // ----------------------------------------------------------------------
422 
424  std::atomic<FwIndexType> m_SPI_WriteErrorThrottle;
425 
426  };
427 
428 }
429 
430 #endif
void SpiReadWrite_handlerBase(FwIndexType portNum, Fw::Buffer &writeBuffer, Fw::Buffer &readBuffer)
Handler base-class function for input port SpiReadWrite.
Definition: Time.hpp:9
void log_WARNING_HI_SPI_ConfigError(I32 device, I32 select, I32 error) const
I32 FwEnumStoreType
virtual void SpiReadWrite_handler(FwIndexType portNum, Fw::Buffer &writeBuffer, Fw::Buffer &readBuffer)=0
Handler for input port SpiReadWrite.
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 tlmWrite_SPI_Bytes(U32 arg, Fw::Time _tlmTime=Fw::Time()) const
void init()
Object initializer.
Definition: ObjBase.cpp:26
bool isConnected_Tlm_OutputPort(FwIndexType portNum)
void log_WARNING_HI_SPI_WriteError_ThrottleClear()
Reset throttle value for SPI_WriteError.
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
friend class LinuxSpiDriverComponentBaseFriend
Friend class for white-box testing.
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.