F´ Flight Software - C/C++ Documentation
A framework for building embedded system applications to NASA flight quality standards.
TlmChan.hpp
Go to the documentation of this file.
1 
13 #ifndef TELEMCHANIMPL_HPP_
14 #define TELEMCHANIMPL_HPP_
15 
16 #include <Fw/Tlm/TlmPacket.hpp>
18 #include <config/TlmChanImplCfg.hpp>
19 
20 namespace Svc {
21 
22 class TlmChan final : public TlmChanComponentBase {
23  friend class TlmChanTester;
24 
25  public:
26  TlmChan(const char* compName);
27  virtual ~TlmChan();
28 
29  protected:
31 
32  private:
33  // Port functions
34  void TlmRecv_handler(FwIndexType portNum, FwChanIdType id, Fw::Time& timeTag, Fw::TlmBuffer& val);
35  Fw::TlmValid TlmGet_handler(FwIndexType portNum, FwChanIdType id, Fw::Time& timeTag, Fw::TlmBuffer& val);
36  void Run_handler(FwIndexType portNum, U32 context);
39  void pingIn_handler(const FwIndexType portNum,
40  U32 key
41  );
42  enum class ActiveBuffer : U8 { Buffer_0 = 0, Buffer_1 = 1 };
43  struct TlmEntry {
44  FwChanIdType id;
45  bool updated;
46  Fw::Time lastUpdate;
47  Fw::TlmBuffer buffer;
48  TlmEntry* next;
49  bool used;
50  FwChanIdType bucketNo;
51  };
52 
53  struct TlmSet {
54  TlmEntry* slots[TLMCHAN_NUM_TLM_HASH_SLOTS];
55  TlmEntry buckets[TLMCHAN_HASH_BUCKETS];
56  FwChanIdType free;
57  } m_tlmEntries[2];
58 
59  U32 m_hashSeed; // !< per-boot random seed for telemetry hash
60 
61  U32 m_procCapCount; // !< per-epoch processing guard for Run_handler
62 
63  U32 m_chanIdSize; // !< the deployed channel size
64 
65  static const U32 MURMUR3_C1 = 0x85EBCA6BU; // Murmur3 32-bit finalizer multiplier 1
66  static const U32 MURMUR3_C2 = 0xC2B2AE35U; // Murmur3 32-bit finalizer multiplier 2
67  static const U16 WANG16_C1 = 0x2993U; // Wang 16-bit hash multiplier 1
68  static const U16 WANG16_C2 = 0xE877U; // Wang 16-bit hash multiplier 2
69  ActiveBuffer m_activeBuffer; // !< which buffer is active for storing telemetry
70 };
71 
72 } // namespace Svc
73 
74 #endif /* TELEMCHANIMPL_HPP_ */
TlmChan(const char *compName)
Definition: TlmChan.cpp:39
Auto-generated base for TlmChan component.
virtual ~TlmChan()
Definition: TlmChan.cpp:105
friend class TlmChanTester
Definition: TlmChan.hpp:23
FwIdType FwChanIdType
The type of a telemetry channel identifier.
uint8_t U8
8-bit unsigned integer
Definition: BasicTypes.h:54
PlatformIndexType FwIndexType
RateGroupDivider component implementation.
FwChanIdType doHash(FwChanIdType id) const
Definition: TlmChan.cpp:107