F´ Flight Software - C/C++ Documentation  devel
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 
11 #include "FpConfig.hpp"
13 #include "Fw/Log/LogPortAc.hpp"
14 #include "Fw/Log/LogString.hpp"
15 #if FW_ENABLE_TEXT_LOGGING == 1
16 #include "Fw/Log/LogTextPortAc.hpp"
17 #endif
20 #include "Fw/Time/TimePortAc.hpp"
21 #include "Fw/Tlm/TlmPortAc.hpp"
22 #include "Fw/Tlm/TlmString.hpp"
23 
24 namespace Drv {
25 
30  {
31 
32  // ----------------------------------------------------------------------
33  // Friend classes
34  // ----------------------------------------------------------------------
35 
38 
39  PROTECTED:
40 
41  // ----------------------------------------------------------------------
42  // Constants
43  // ----------------------------------------------------------------------
44 
46  enum {
48  };
49 
51  enum {
56  };
57 
59  enum {
64  };
65 
67  enum {
69  };
70 
72  enum {
74  };
75 
76  public:
77 
78  // ----------------------------------------------------------------------
79  // Component initialization
80  // ----------------------------------------------------------------------
81 
83  void init(
84  FwEnumStoreType instance = 0
85  );
86 
87  public:
88 
89  // ----------------------------------------------------------------------
90  // Getters for typed input ports
91  // ----------------------------------------------------------------------
92 
97  FwIndexType portNum
98  );
99 
100  public:
101 
102  // ----------------------------------------------------------------------
103  // Connect input ports to special output ports
104  // ----------------------------------------------------------------------
105 
107  void set_Log_OutputPort(
108  FwIndexType portNum,
109  Fw::InputLogPort* port
110  );
111 
112 #if FW_ENABLE_TEXT_LOGGING == 1
113 
115  void set_LogText_OutputPort(
116  FwIndexType portNum,
117  Fw::InputLogTextPort* port
118  );
119 
120 #endif
121 
123  void set_Time_OutputPort(
124  FwIndexType portNum,
125  Fw::InputTimePort* port
126  );
127 
129  void set_Tlm_OutputPort(
130  FwIndexType portNum,
131  Fw::InputTlmPort* port
132  );
133 
134 #if FW_PORT_SERIALIZATION
135 
136  public:
137 
138  // ----------------------------------------------------------------------
139  // Connect serial input ports to special output ports
140  // ----------------------------------------------------------------------
141 
143  void set_Log_OutputPort(
144  FwIndexType portNum,
145  Fw::InputSerializePort* port
146  );
147 
148 #if FW_ENABLE_TEXT_LOGGING == 1
149 
151  void set_LogText_OutputPort(
152  FwIndexType portNum,
153  Fw::InputSerializePort* port
154  );
155 
156 #endif
157 
159  void set_Time_OutputPort(
160  FwIndexType portNum,
161  Fw::InputSerializePort* port
162  );
163 
165  void set_Tlm_OutputPort(
166  FwIndexType portNum,
167  Fw::InputSerializePort* port
168  );
169 
170 #endif
171 
172  PROTECTED:
173 
174  // ----------------------------------------------------------------------
175  // Component construction and destruction
176  // ----------------------------------------------------------------------
177 
180  const char* compName = ""
181  );
182 
185 
186  PROTECTED:
187 
188  // ----------------------------------------------------------------------
189  // Getters for numbers of typed input ports
190  // ----------------------------------------------------------------------
191 
196 
197  PROTECTED:
198 
199  // ----------------------------------------------------------------------
200  // Getters for numbers of special output ports
201  // ----------------------------------------------------------------------
202 
207 
208 #if FW_ENABLE_TEXT_LOGGING == 1
209 
213  FwIndexType getNum_LogText_OutputPorts() const;
214 
215 #endif
216 
221 
226 
227  PROTECTED:
228 
229  // ----------------------------------------------------------------------
230  // Connection status queries for special output ports
231  // ----------------------------------------------------------------------
232 
237  FwIndexType portNum
238  );
239 
240 #if FW_ENABLE_TEXT_LOGGING == 1
241 
245  bool isConnected_LogText_OutputPort(
246  FwIndexType portNum
247  );
248 
249 #endif
250 
255  FwIndexType portNum
256  );
257 
262  FwIndexType portNum
263  );
264 
265  PROTECTED:
266 
267  // ----------------------------------------------------------------------
268  // Handlers to implement for typed input ports
269  // ----------------------------------------------------------------------
270 
272  virtual void SpiReadWrite_handler(
273  FwIndexType portNum,
274  Fw::Buffer& writeBuffer,
275  Fw::Buffer& readBuffer
276  ) = 0;
277 
278  PROTECTED:
279 
280  // ----------------------------------------------------------------------
281  // Port handler base-class functions for typed input ports
282  //
283  // Call these functions directly to bypass the corresponding ports
284  // ----------------------------------------------------------------------
285 
288  FwIndexType portNum,
289  Fw::Buffer& writeBuffer,
290  Fw::Buffer& readBuffer
291  );
292 
293  PROTECTED:
294 
295  // ----------------------------------------------------------------------
296  // Event logging functions
297  // ----------------------------------------------------------------------
298 
303  I32 device,
304  I32 select,
305  I32 error
306  );
307 
312  I32 device,
313  I32 select,
314  I32 error
315  );
316 
321  I32 device,
322  I32 select,
323  I32 error
324  );
325 
330  I32 device,
331  I32 select
332  );
333 
334  PROTECTED:
335 
336  // ----------------------------------------------------------------------
337  // Event throttle reset functions
338  // ----------------------------------------------------------------------
339 
342 
343  PROTECTED:
344 
345  // ----------------------------------------------------------------------
346  // Telemetry write functions
347  // ----------------------------------------------------------------------
348 
352  void tlmWrite_SPI_Bytes(
353  U32 arg,
354  Fw::Time _tlmTime = Fw::Time()
355  );
356 
357  PROTECTED:
358 
359  // ----------------------------------------------------------------------
360  // Time
361  // ----------------------------------------------------------------------
362 
366  Fw::Time getTime();
367 
368  PRIVATE:
369 
370  // ----------------------------------------------------------------------
371  // Calls for messages received on typed input ports
372  // ----------------------------------------------------------------------
373 
375  static void m_p_SpiReadWrite_in(
376  Fw::PassiveComponentBase* callComp,
377  FwIndexType portNum,
378  Fw::Buffer& writeBuffer,
379  Fw::Buffer& readBuffer
380  );
381 
382  PRIVATE:
383 
384  // ----------------------------------------------------------------------
385  // Typed input ports
386  // ----------------------------------------------------------------------
387 
390 
391  PRIVATE:
392 
393  // ----------------------------------------------------------------------
394  // Special output ports
395  // ----------------------------------------------------------------------
396 
398  Fw::OutputLogPort m_Log_OutputPort[NUM_LOG_OUTPUT_PORTS];
399 
400 #if FW_ENABLE_TEXT_LOGGING == 1
401 
403  Fw::OutputLogTextPort m_LogText_OutputPort[NUM_LOGTEXT_OUTPUT_PORTS];
404 
405 #endif
406 
408  Fw::OutputTimePort m_Time_OutputPort[NUM_TIME_OUTPUT_PORTS];
409 
411  Fw::OutputTlmPort m_Tlm_OutputPort[NUM_TLM_OUTPUT_PORTS];
412 
413  PRIVATE:
414 
415  // ----------------------------------------------------------------------
416  // Counter values for event throttling
417  // ----------------------------------------------------------------------
418 
420  FwIndexType m_SPI_WriteErrorThrottle;
421 
422  };
423 
424 }
425 
426 #endif
I32 FwEnumStoreType
Definition: FpConfig.h:64
PlatformIndexType FwIndexType
Definition: FpConfig.h:25
C++-compatible configuration header for fprime configuration.
Input SpiReadWrite port.
Auto-generated base for LinuxSpiDriver component.
void log_WARNING_HI_SPI_WriteError(I32 device, I32 select, I32 error)
void set_Time_OutputPort(FwIndexType portNum, Fw::InputTimePort *port)
Connect port to Time[portNum].
void set_Tlm_OutputPort(FwIndexType portNum, Fw::InputTlmPort *port)
Connect port to Tlm[portNum].
LinuxSpiDriverComponentBase(const char *compName="")
Construct LinuxSpiDriverComponentBase object.
void tlmWrite_SPI_Bytes(U32 arg, Fw::Time _tlmTime=Fw::Time())
void log_WARNING_HI_SPI_WriteError_ThrottleClear()
Reset throttle value for SPI_WriteError.
Drv::InputSpiReadWritePort * get_SpiReadWrite_InputPort(FwIndexType portNum)
void log_WARNING_HI_SPI_ConfigError(I32 device, I32 select, I32 error)
bool isConnected_Tlm_OutputPort(FwIndexType portNum)
void log_ACTIVITY_HI_SPI_PortOpened(I32 device, I32 select)
@ CHANNELID_SPI_BYTES
Channel ID for SPI_Bytes.
bool isConnected_Log_OutputPort(FwIndexType portNum)
friend class LinuxSpiDriverComponentBaseFriend
Friend class for white-box testing.
bool isConnected_Time_OutputPort(FwIndexType portNum)
@ EVENTID_SPI_WRITEERROR_THROTTLE
Throttle reset count for SPI_WriteError.
virtual ~LinuxSpiDriverComponentBase()
Destroy LinuxSpiDriverComponentBase object.
virtual void SpiReadWrite_handler(FwIndexType portNum, Fw::Buffer &writeBuffer, Fw::Buffer &readBuffer)=0
Handler for input port SpiReadWrite.
void set_Log_OutputPort(FwIndexType portNum, Fw::InputLogPort *port)
Connect port to Log[portNum].
void SpiReadWrite_handlerBase(FwIndexType portNum, Fw::Buffer &writeBuffer, Fw::Buffer &readBuffer)
Handler base-class function for input port SpiReadWrite.
void log_WARNING_HI_SPI_OpenError(I32 device, I32 select, I32 error)
void init()
Object initializer.
Definition: ObjBase.cpp:27
Definition: Time.hpp:9