14 #include "Fw/Types/BasicTypes.hpp"
15 #include <Fw/Types/Assert.hpp>
24 HealthComponentBase(compName),
35 this->m_pingTrackerEntries[entry].enabled = Fw::Enabled::DISABLED;
40 HealthComponentBase::init(queueDepth, instance);
41 this->queue_depth = queueDepth;
49 FW_ASSERT(numPingEntries <= NUM_PINGSEND_OUTPUT_PORTS);
51 this->m_numPingEntries = numPingEntries;
52 this->m_watchDogCode = watchDogCode;
56 FW_ASSERT(pingEntries[entry].warnCycles <= pingEntries[entry].fatalCycles, pingEntries[entry].warnCycles, pingEntries[entry].fatalCycles);
57 this->m_pingTrackerEntries[entry].entry = pingEntries[entry];
58 this->m_pingTrackerEntries[entry].cycleCount = 0;
59 this->m_pingTrackerEntries[entry].enabled = Fw::Enabled::ENABLED;
60 this->m_pingTrackerEntries[entry].key = 0;
72 void HealthImpl::PingReturn_handler(
const NATIVE_INT_TYPE portNum, U32 key) {
74 if (key != this->m_pingTrackerEntries[portNum].key) {
76 this->log_FATAL_HLTH_PING_WRONG_KEY(_arg,key);
79 this->m_pingTrackerEntries[portNum].cycleCount = 0;
80 this->m_pingTrackerEntries[portNum].key = 0;
88 MsgDispatchStatus stat = this->doDispatch();
89 if (MSG_DISPATCH_EMPTY == stat) {
95 if (this->m_enabled == Fw::Enabled::ENABLED) {
101 if (Fw::Enabled::ENABLED == this->m_pingTrackerEntries[entry].enabled) {
103 if (0 == this->m_pingTrackerEntries[entry].cycleCount) {
105 this->m_pingTrackerEntries[entry].key = this->m_key;
107 this->PingSend_out(entry, this->m_pingTrackerEntries[entry].key);
111 this->m_pingTrackerEntries[entry].cycleCount++;
114 if (this->m_pingTrackerEntries[entry].cycleCount ==
115 this->m_pingTrackerEntries[entry].entry.warnCycles) {
117 this->log_WARNING_HI_HLTH_PING_WARN(_arg);
118 this->tlmWrite_PingLateWarnings(++this->m_warnings);
121 if (this->m_pingTrackerEntries[entry].entry.fatalCycles ==
122 this->m_pingTrackerEntries[entry].cycleCount) {
124 this->log_FATAL_HLTH_PING_LATE(_arg);
128 this->m_pingTrackerEntries[entry].cycleCount++;
139 if (this->isConnected_WdogStroke_OutputPort(0)) {
140 this->WdogStroke_out(0,this->m_watchDogCode);
149 this->m_enabled = enable;
151 if (enable == Fw::Enabled::ENABLED) {
152 isEnabled = Fw::Enabled::ENABLED;
154 this->log_ACTIVITY_HI_HLTH_CHECK_ENABLE(isEnabled);
163 if (-1 == entryIndex) {
164 this->cmdResponse_out(opCode,cmdSeq,Fw::CmdResponse::VALIDATION_ERROR);
169 if (enable != Fw::Enabled::DISABLED && enable != Fw::Enabled::ENABLED) {
170 this->cmdResponse_out(opCode,cmdSeq,Fw::CmdResponse::VALIDATION_ERROR);
174 this->m_pingTrackerEntries[entryIndex].enabled = enable.e;
176 if (enable == Fw::Enabled::ENABLED) {
177 isEnabled = Fw::Enabled::ENABLED;
181 this->log_ACTIVITY_HI_HLTH_CHECK_PING(isEnabled,arg);
185 void HealthImpl::HLTH_CHNG_PING_cmdHandler(
const FwOpcodeType opCode, U32 cmdSeq,
const Fw::CmdStringArg& entry, U32 warningValue, U32 fatalValue) {
188 if (-1 == entryIndex) {
189 this->cmdResponse_out(opCode,cmdSeq,Fw::CmdResponse::VALIDATION_ERROR);
194 if (warningValue > fatalValue) {
197 this->log_WARNING_HI_HLTH_PING_INVALID_VALUES(arg,warningValue,fatalValue);
198 this->cmdResponse_out(opCode,cmdSeq,Fw::CmdResponse::VALIDATION_ERROR);
202 this->m_pingTrackerEntries[entryIndex].entry.warnCycles = warningValue;
203 this->m_pingTrackerEntries[entryIndex].entry.fatalCycles = fatalValue;
205 this->log_ACTIVITY_HI_HLTH_PING_UPDATED(arg,warningValue,fatalValue);
212 for (
NATIVE_UINT_TYPE tableEntry = 0; tableEntry < NUM_PINGSEND_OUTPUT_PORTS; tableEntry++) {
213 if (entry == this->m_pingTrackerEntries[tableEntry].entry.entryName) {
218 this->log_WARNING_LO_HLTH_CHECK_LOOKUP_ERROR(arg);