F´ Flight Software - C/C++ Documentation  NASA-v1.6.0
A framework for building embedded system applications to NASA flight quality standards.
All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
TlmChanImpl.cpp
Go to the documentation of this file.
1 
13 #include <cstring>
14 #include <Fw/Types/BasicTypes.hpp>
15 #include <Fw/Types/Assert.hpp>
16 #include <Fw/Com/ComBuffer.hpp>
17 
18 #include <cstdio>
19 
20 namespace Svc {
21 
22  TlmChanImpl::TlmChanImpl(const char* name) : TlmChanComponentBase(name)
23  {
24  // clear data
25  this->m_activeBuffer = 0;
26  // clear slot pointers
27  for (NATIVE_UINT_TYPE entry = 0; entry < TLMCHAN_NUM_TLM_HASH_SLOTS; entry++) {
28  this->m_tlmEntries[0].slots[entry] = nullptr;
29  this->m_tlmEntries[1].slots[entry] = nullptr;
30  }
31  // clear buckets
32  for (NATIVE_UINT_TYPE entry = 0; entry < TLMCHAN_HASH_BUCKETS; entry++) {
33  this->m_tlmEntries[0].buckets[entry].used = false;
34  this->m_tlmEntries[0].buckets[entry].updated = false;
35  this->m_tlmEntries[0].buckets[entry].bucketNo = entry;
36  this->m_tlmEntries[0].buckets[entry].next = nullptr;
37  this->m_tlmEntries[0].buckets[entry].id = 0;
38  this->m_tlmEntries[1].buckets[entry].used = false;
39  this->m_tlmEntries[1].buckets[entry].updated = false;
40  this->m_tlmEntries[1].buckets[entry].bucketNo = entry;
41  this->m_tlmEntries[1].buckets[entry].next = nullptr;
42  this->m_tlmEntries[1].buckets[entry].id = 0;
43  }
44  // clear free index
45  this->m_tlmEntries[0].free = 0;
46  this->m_tlmEntries[1].free = 0;
47 
48 
49  }
50 
52  }
53 
55  NATIVE_INT_TYPE queueDepth,
56  NATIVE_INT_TYPE instance
57  ) {
58  TlmChanComponentBase::init(queueDepth,instance);
59  }
60 
62  return (id % TLMCHAN_HASH_MOD_VALUE)%TLMCHAN_NUM_TLM_HASH_SLOTS;
63  }
64 
65  void TlmChanImpl::pingIn_handler(
66  const NATIVE_INT_TYPE portNum,
67  U32 key
68  )
69  {
70  // return key
71  this->pingOut_out(0,key);
72  }
73 
74 
75 }
TlmChanImpl.hpp
Component that stores telemetry channel values.
NATIVE_UINT_TYPE
unsigned int NATIVE_UINT_TYPE
native unsigned integer type declaration
Definition: BasicTypes.hpp:28
ComBuffer.hpp
Svc::TlmChanImpl::init
void init(NATIVE_INT_TYPE queueDepth, NATIVE_INT_TYPE instance)
Definition: TlmChanImpl.cpp:54
FwChanIdType
#define FwChanIdType
Type representation for a channel id.
Definition: FpConfig.hpp:66
NATIVE_INT_TYPE
int NATIVE_INT_TYPE
native integer type declaration
Definition: BasicTypes.hpp:27
Svc::TlmChanImpl::TlmChanImpl
TlmChanImpl(const char *compName)
Definition: TlmChanImpl.cpp:22
Svc
Definition: ActiveRateGroupCfg.hpp:18
Svc::TlmChanImpl::~TlmChanImpl
virtual ~TlmChanImpl()
Definition: TlmChanImpl.cpp:51
Svc::TlmChanImpl::doHash
virtual NATIVE_UINT_TYPE doHash(FwChanIdType id)
Definition: TlmChanImpl.cpp:61