25 this->m_tlmEntries.slots[entry] =
nullptr;
29 this->m_tlmEntries.buckets[entry].used =
false;
30 this->m_tlmEntries.buckets[entry].bucketNo = entry;
31 this->m_tlmEntries.buckets[entry].next =
nullptr;
32 this->m_tlmEntries.buckets[entry].id = 0;
35 this->m_tlmEntries.free = 0;
38 this->m_missTlmCheck[entry].checked =
false;
39 this->m_missTlmCheck[entry].id = 0;
44 this->m_fillBuffers[buffer].updated =
false;
45 this->m_fillBuffers[buffer].requested =
false;
46 this->m_sendBuffers[buffer].updated =
false;
64 FW_ASSERT(packetList.
list[pktEntry]->
list, static_cast<FwAssertArgType>(pktEntry));
69 TlmEntry* entryToUse = this->findBucket(
id);
72 entryToUse->used =
true;
74 entryToUse->ignored =
false;
77 entryToUse->packetOffset[pktEntry] =
static_cast<NATIVE_INT_TYPE>(packetLen);
79 packetLen += packetList.
list[pktEntry]->
list[tlmEntry].
size;
84 memset(this->m_fillBuffers[pktEntry].buffer.getBuffAddr(), 0, packetLen);
89 stat = this->m_fillBuffers[pktEntry].buffer.serialize(packetList.
list[pktEntry]->
id);
92 stat = this->m_fillBuffers[pktEntry].buffer.setBuffLen(packetLen);
95 this->m_fillBuffers[pktEntry].id = packetList.
list[pktEntry]->
id;
97 this->m_fillBuffers[pktEntry].level = packetList.
list[pktEntry]->
level;
99 if (packetList.
list[pktEntry]->
level > this->m_maxLevel) {
100 this->m_maxLevel = packetList.
list[pktEntry]->
level;
103 this->m_startLevel = startLevel;
112 TlmEntry* entryToUse = this->findBucket(
id);
116 entryToUse->used =
true;
118 entryToUse->ignored =
true;
126 this->m_configured =
true;
129 TlmPacketizer::TlmEntry* TlmPacketizer::findBucket(
FwChanIdType id) {
132 TlmEntry* entryToUse =
nullptr;
133 TlmEntry* prevEntry =
nullptr;
136 if (this->m_tlmEntries.slots[index]) {
137 entryToUse = this->m_tlmEntries.slots[index];
140 if (entryToUse->id ==
id) {
143 prevEntry = entryToUse;
144 entryToUse = entryToUse->next;
150 entryToUse = &this->m_tlmEntries.buckets[this->m_tlmEntries.free++];
153 prevEntry->next = entryToUse;
155 entryToUse->next =
nullptr;
158 entryToUse->packetOffset[pktOffsetEntry] = -1;
167 this->m_tlmEntries.slots[index] = &this->m_tlmEntries.buckets[this->m_tlmEntries.free++];
168 entryToUse = this->m_tlmEntries.slots[index];
169 entryToUse->next =
nullptr;
172 entryToUse->packetOffset[pktOffsetEntry] = -1;
190 TlmEntry* entryToUse =
nullptr;
193 entryToUse = this->m_tlmEntries.slots[index];
196 if (not entryToUse) {
197 this->missingChannel(
id);
203 if (entryToUse->id ==
id) {
205 if (entryToUse->ignored) {
210 entryToUse = entryToUse->next;
214 this->missingChannel(
id);
222 if (entryToUse->packetOffset[pkt] != -1) {
225 this->m_fillBuffers[pkt].updated =
true;
226 this->m_fillBuffers[pkt].latestTime = timeTag;
227 U8* ptr = &this->m_fillBuffers[pkt].buffer.getBuffAddr()[entryToUse->packetOffset[pkt]];
234 void TlmPacketizer ::Run_handler(
const NATIVE_INT_TYPE portNum, U32 context) {
247 if ((this->m_fillBuffers[pkt].updated) and
248 ((this->m_fillBuffers[pkt].level <= this->m_startLevel) or (this->m_fillBuffers[pkt].requested))) {
249 this->m_sendBuffers[pkt] = this->m_fillBuffers[pkt];
251 this->m_fillBuffers[pkt].updated =
false;
253 this->m_fillBuffers[pkt].requested =
false;
256 (this->m_fillBuffers[pkt].level <= this->m_startLevel)) {
257 this->m_sendBuffers[pkt] = this->m_fillBuffers[pkt];
258 this->m_sendBuffers[pkt].updated =
true;
260 this->m_sendBuffers[pkt].updated =
false;
267 if (this->m_sendBuffers[pkt].updated) {
270 &this->m_sendBuffers[pkt]
276 this->
PktSend_out(0, this->m_sendBuffers[pkt].buffer, 0);
281 void TlmPacketizer ::pingIn_handler(
const NATIVE_INT_TYPE portNum, U32 key) {
290 void TlmPacketizer ::SET_LEVEL_cmdHandler(
const FwOpcodeType opCode,
const U32 cmdSeq, U32 level) {
291 this->m_startLevel = level;
292 if (level > this->m_maxLevel) {
300 void TlmPacketizer ::SEND_PKT_cmdHandler(
const FwOpcodeType opCode,
const U32 cmdSeq, U32
id) {
302 for (pkt = 0; pkt < this->m_numPackets; pkt++) {
303 if (this->m_fillBuffers[pkt].
id ==
id) {
305 this->m_fillBuffers[pkt].updated =
true;
306 this->m_fillBuffers[pkt].latestTime = this->
getTime();
307 this->m_fillBuffers[pkt].requested =
true;
316 if (pkt == this->m_numPackets) {
333 if (this->m_missTlmCheck[slot].checked and (this->m_missTlmCheck[slot].
id ==
id)) {
335 }
else if (not this->m_missTlmCheck[slot].checked) {
336 this->m_missTlmCheck[slot].checked =
true;
337 this->m_missTlmCheck[slot].id = id;
void setPacketList(const TlmPacketizerPacketList &packetList, const Svc::TlmPacketizerPacket &ignoreList, const NATIVE_UINT_TYPE startLevel)
PlatformUIntType NATIVE_UINT_TYPE
Serialization/Deserialization operation was successful.
TlmPacketizer(const char *const compName)
NATIVE_UINT_TYPE numEntries
FwTlmPacketizeIdType id
packet ID
SerializeStatus serialize(U8 val)
serialize 8-bit unsigned int
PlatformIntType NATIVE_INT_TYPE
const TlmPacketizerPacket * list[MAX_PACKETIZER_PACKETS]
void unLock()
unlock the mutex and assert success
void PktSend_out(FwIndexType portNum, Fw::ComBuffer &data, U32 context)
Invoke output port PktSend.
void cmdResponse_out(FwOpcodeType opCode, U32 cmdSeq, Fw::CmdResponse response)
Emit command response.
const TlmPacketizerChannelEntry * list
pointer to a channel entry
static const NATIVE_UINT_TYPE TLMPACKETIZER_HASH_BUCKETS
SerializeStatus
forward declaration for string
U32 FwPacketDescriptorType
FwChanIdType id
Id of channel.
Serializable::SizeType getBuffLength() const
returns current buffer size
void log_WARNING_LO_NoChan(U32 Id) const
static const PacketUpdateMode PACKET_UPDATE_MODE
NATIVE_UINT_TYPE size
serialized size of channel in bytes
External serialize buffer with no copy semantics.
#define FW_COM_BUFFER_MAX_SIZE
U8 * getBuffAddr()
gets buffer address for data filling
void log_WARNING_LO_PacketNotFound(U32 id) const
static const NATIVE_UINT_TYPE TLMPACKETIZER_NUM_TLM_HASH_SLOTS
static const NATIVE_UINT_TYPE TLMPACKETIZER_MAX_MISSING_TLM_CHECK
Command successfully executed.
void log_WARNING_LO_MaxLevelExceed(U32 level, U32 max) const
C++-compatible configuration header for fprime configuration.
uint8_t U8
8-bit unsigned integer
void tlmWrite_SendLevel(U32 arg, Fw::Time _tlmTime=Fw::Time()) const
static const NATIVE_UINT_TYPE MAX_PACKETIZER_PACKETS
static const NATIVE_UINT_TYPE TLMPACKETIZER_HASH_MOD_VALUE
NATIVE_UINT_TYPE numEntries
number of channels in packet
Command failed validation.
bool isConnected_PktSend_OutputPort(FwIndexType portNum)
void log_ACTIVITY_HI_LevelSet(U32 id) const
void log_ACTIVITY_LO_PacketSent(U32 id) const
void pingOut_out(FwIndexType portNum, U32 key)
Invoke output port pingOut.
void lock()
lock the mutex and assert success
NATIVE_UINT_TYPE level
packet level - used to select set of packets to send
Auto-generated base for TlmPacketizer component.