F´ Flight Software - C/C++ Documentation NASA-v1.6.0
A framework for building embedded system applications to NASA flight quality standards.
Loading...
Searching...
No Matches
TlmPacketizer.hpp
Go to the documentation of this file.
1// ======================================================================
2// \title TlmPacketizerImpl.hpp
3// \author tcanham
4// \brief hpp file for TlmPacketizer component implementation class
5//
6// \copyright
7// Copyright 2009-2015, by the California Institute of Technology.
8// ALL RIGHTS RESERVED. United States Government Sponsorship
9// acknowledged.
10
11#ifndef TlmPacketizer_HPP
12#define TlmPacketizer_HPP
13
14#include "Os/Mutex.hpp"
15#include "Svc/TlmPacketizer/TlmPacketizerComponentAc.hpp"
17#include "TlmPacketizerCfg.hpp"
18
19namespace Svc {
20
21class TlmPacketizer : public TlmPacketizerComponentBase {
22 public:
23 // ----------------------------------------------------------------------
24 // Construction, initialization, and destruction
25 // ----------------------------------------------------------------------
26
29 TlmPacketizer(const char* const compName
30 );
31
34 void init(const NATIVE_INT_TYPE queueDepth,
35 const NATIVE_INT_TYPE instance = 0
36 );
37
38 void setPacketList(
39 const TlmPacketizerPacketList& packetList, // channels to packetize
40 const Svc::TlmPacketizerPacket& ignoreList, // channels to ignore (i.e. no warning event if not packetized)
41 const NATIVE_UINT_TYPE startLevel); // starting level of packets to send
42
45 ~TlmPacketizer(void);
46
47 PRIVATE:
48 // ----------------------------------------------------------------------
49 // Handler implementations for user-defined typed input ports
50 // ----------------------------------------------------------------------
51
54 void TlmRecv_handler(const NATIVE_INT_TYPE portNum,
55 FwChanIdType id,
56 Fw::Time& timeTag,
57 Fw::TlmBuffer& val
58 );
59
62 void Run_handler(const NATIVE_INT_TYPE portNum,
63 NATIVE_UINT_TYPE context
64 );
65
68 void pingIn_handler(const NATIVE_INT_TYPE portNum,
69 U32 key
70 );
71
74 void SET_LEVEL_cmdHandler(const FwOpcodeType opCode,
75 const U32 cmdSeq,
76 U32 level
77 );
78
81 void SEND_PKT_cmdHandler(const FwOpcodeType opCode,
82 const U32 cmdSeq,
83 U32 id
84 );
85
86 // number of packets to fill
87 NATIVE_UINT_TYPE m_numPackets;
88 // Array of packet buffers to send
89 // Double-buffered to fill one while sending one
90
91 struct BufferEntry {
92 Fw::ComBuffer buffer;
93 Fw::Time latestTime;
95 NATIVE_UINT_TYPE level;
96 bool updated;
97 bool requested;
98 };
99
100 // buffers for filling with telemetry
101 BufferEntry m_fillBuffers[MAX_PACKETIZER_PACKETS];
102 // buffers for sending - will be copied from fill buffers
103 BufferEntry m_sendBuffers[MAX_PACKETIZER_PACKETS];
104
105 struct TlmEntry {
106 FwChanIdType id;
107 // Offsets into packet buffers.
108 // -1 means that channel is not in that packet
110 TlmEntry* next;
111 bool used;
112 bool ignored;
113 NATIVE_UINT_TYPE bucketNo;
114 };
115
116 struct TlmSet {
117 TlmEntry* slots[TLMPACKETIZER_NUM_TLM_HASH_SLOTS];
118 TlmEntry buckets[TLMPACKETIZER_HASH_BUCKETS];
119 NATIVE_UINT_TYPE free;
120 } m_tlmEntries;
121
122 // hash function for looking up telemetry channel
124
125 Os::Mutex m_lock;
126
127 bool m_configured;
128
129 struct MissingTlmChan {
130 FwChanIdType id;
131 bool checked;
132 } m_missTlmCheck[TLMPACKETIZER_MAX_MISSING_TLM_CHECK];
133
134 void missingChannel(FwChanIdType id);
135
136 TlmEntry* findBucket(FwChanIdType id);
137
138 NATIVE_UINT_TYPE m_startLevel;
139 NATIVE_UINT_TYPE m_maxLevel;
140};
141
142} // end namespace Svc
143
144#endif
PlatformIntType NATIVE_INT_TYPE
Definition BasicTypes.h:51
PlatformUIntType NATIVE_UINT_TYPE
Definition BasicTypes.h:52
U32 FwChanIdType
Definition FpConfig.h:59
U32 FwOpcodeType
Definition FpConfig.h:56
void setPacketList(const TlmPacketizerPacketList &packetList, const Svc::TlmPacketizerPacket &ignoreList, const NATIVE_UINT_TYPE startLevel)
void init(const NATIVE_INT_TYPE queueDepth, const NATIVE_INT_TYPE instance=0)
static const NATIVE_UINT_TYPE TLMPACKETIZER_MAX_MISSING_TLM_CHECK
static const NATIVE_UINT_TYPE TLMPACKETIZER_HASH_BUCKETS
static const NATIVE_UINT_TYPE MAX_PACKETIZER_PACKETS
static const NATIVE_UINT_TYPE TLMPACKETIZER_NUM_TLM_HASH_SLOTS