mirror of
https://github.com/nasa/fprime.git
synced 2025-12-10 16:29:04 -06:00
Removed Unnecessary .gcov files (#708)
* Removed gcov files from output folder in Svc * Removed gcov files in ActiveRateGroupComponent * removed more gcov files * Deleted more gcov files * Deleted more gcov files * Deleted more gcov files * More gcov files * Removed more gcov files * Updated Svc/ActiveLogger sdd.md file Unit Tests section * Updated Svc/ActiveRateGroup sdd.md file Unit Tests section * Updated Svc/CmdSequencer unit tests section * Updated Svc/PolyDb sdd.md file Unit Tests section * Updated Svc/RateGroupDriver sdd.md file Unit Tests section * Updated Svc/TlmChan sdd.md file Unit Tests section * Updated Svc/PrmDb sdd.md file Unit Tests section * Updated Svc/Health sdd.md file nit Test section
This commit is contained in:
parent
48d355a0b1
commit
b86e9baf0d
@ -102,13 +102,7 @@ Unit Test Checklist | [Link](Checklist_Unit_test.xlsx)
|
||||
|
||||
## 6. Unit Testing
|
||||
|
||||
[Unit Test Output](../test/ut/output/test.txt)
|
||||
|
||||
[Coverage Output - `ActiveLoggerImpl.cpp`](../test/ut/output/ActiveLoggerImpl.cpp.gcov)
|
||||
|
||||
[Coverage Output - `ActiveLoggerComponentAc.cpp`](../test/ut/output/ActiveLoggerComponentAc.cpp.gcov)
|
||||
|
||||
[Report](../test/ut/output/SvcActiveLogger_gcov.txt)
|
||||
To see unit test coverage run fprime-util check --coverage
|
||||
|
||||
## 7. Change Log
|
||||
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@ -1,536 +0,0 @@
|
||||
-: 0:Source:/home/tim/source/isf/Svc/ActiveLogger/ActiveLoggerImpl.cpp
|
||||
-: 0:Programs:2
|
||||
-: 1:/*
|
||||
-: 2: * TestCommand1Impl.cpp
|
||||
-: 3: *
|
||||
-: 4: * Created on: Mar 28, 2014
|
||||
-: 5: * Author: tcanham
|
||||
-: 6: */
|
||||
-: 7:
|
||||
-: 8:#include <Svc/ActiveLogger/ActiveLoggerImpl.hpp>
|
||||
-: 9:#include <Fw/Types/Assert.hpp>
|
||||
-: 10:#include <Os/File.hpp>
|
||||
-: 11:
|
||||
-: 12:namespace Svc {
|
||||
-: 13:
|
||||
-: 14:#if FW_OBJECT_NAMES == 1
|
||||
8: 15: ActiveLoggerImpl::ActiveLoggerImpl(const char* name) : ActiveLoggerComponentBase(name)
|
||||
-: 16:#else
|
||||
-: 17: ActiveLoggerImpl::ActiveLoggerImpl() :
|
||||
-: 18: ActiveLoggerComponentBase()
|
||||
-: 19:#endif
|
||||
-: 20: ,m_fatalHead(0)
|
||||
-: 21: ,m_warningHiHead(0)
|
||||
-: 22: ,m_warningLoHead(0)
|
||||
-: 23: ,m_commandHead(0)
|
||||
-: 24: ,m_activityHiHead(0)
|
||||
-: 25: ,m_activityLoHead(0)
|
||||
8: 26: ,m_diagnosticHead(0)
|
||||
-: 27: {
|
||||
-: 28: // set input filter defaults
|
||||
-: 29: this->m_inFilterState[INPUT_WARNING_HI].enabled =
|
||||
8: 30: INPUT_WARNING_HI_DEFAULT?INPUT_ENABLED:INPUT_DISABLED;
|
||||
-: 31: this->m_inFilterState[INPUT_WARNING_LO].enabled =
|
||||
8: 32: INPUT_WARNING_LO_DEFAULT?INPUT_ENABLED:INPUT_DISABLED;
|
||||
-: 33: this->m_inFilterState[INPUT_COMMAND].enabled =
|
||||
8: 34: INPUT_COMMAND_DEFAULT?INPUT_ENABLED:INPUT_DISABLED;
|
||||
-: 35: this->m_inFilterState[INPUT_ACTIVITY_HI].enabled =
|
||||
8: 36: INPUT_ACTIVITY_HI_DEFAULT?INPUT_ENABLED:INPUT_DISABLED;
|
||||
-: 37: this->m_inFilterState[INPUT_ACTIVITY_LO].enabled =
|
||||
8: 38: INPUT_ACTIVITY_LO_DEFAULT?INPUT_ENABLED:INPUT_DISABLED;
|
||||
-: 39: this->m_inFilterState[INPUT_DIAGNOSTIC].enabled =
|
||||
8: 40: INPUT_DIAGNOSTIC_DEFAULT?INPUT_ENABLED:INPUT_DISABLED;
|
||||
-: 41: // set send filter defaults
|
||||
-: 42: this->m_sendFilterState[SEND_WARNING_HI].enabled =
|
||||
8: 43: SEND_WARNING_HI_DEFAULT?SEND_ENABLED:SEND_DISABLED;
|
||||
-: 44: this->m_sendFilterState[SEND_WARNING_LO].enabled =
|
||||
8: 45: SEND_WARNING_LO_DEFAULT?SEND_ENABLED:SEND_DISABLED;
|
||||
-: 46: this->m_sendFilterState[SEND_COMMAND].enabled =
|
||||
8: 47: SEND_COMMAND_DEFAULT?SEND_ENABLED:SEND_DISABLED;
|
||||
-: 48: this->m_sendFilterState[SEND_ACTIVITY_HI].enabled =
|
||||
8: 49: SEND_ACTIVITY_HI_DEFAULT?SEND_ENABLED:SEND_DISABLED;
|
||||
-: 50: this->m_sendFilterState[SEND_ACTIVITY_LO].enabled =
|
||||
8: 51: SEND_ACTIVITY_LO_DEFAULT?SEND_ENABLED:SEND_DISABLED;
|
||||
-: 52: this->m_sendFilterState[SEND_DIAGNOSTIC].enabled =
|
||||
8: 53: SEND_DIAGNOSTIC_DEFAULT?SEND_ENABLED:SEND_DISABLED;
|
||||
-: 54:
|
||||
8: 55: memset(m_filteredIDs,0,sizeof(m_filteredIDs));
|
||||
-: 56:
|
||||
8: 57: }
|
||||
-: 58:
|
||||
8: 59: ActiveLoggerImpl::~ActiveLoggerImpl() {
|
||||
8: 60: }
|
||||
-: 61:
|
||||
8: 62: void ActiveLoggerImpl::init(NATIVE_INT_TYPE queueDepth) {
|
||||
8: 63: ActiveLoggerComponentBase::init(queueDepth);
|
||||
8: 64: }
|
||||
-: 65:
|
||||
199: 66: void ActiveLoggerImpl::LogRecv_handler(NATIVE_INT_TYPE portNum, FwEventIdType id, Fw::Time &timeTag, Fw::LogSeverity severity, Fw::LogBuffer &args) {
|
||||
-: 67:
|
||||
-: 68: // make sure ID is not zero. Zero is reserved for ID filter.
|
||||
199: 69: FW_ASSERT(id != 0);
|
||||
-: 70:
|
||||
199: 71: switch (severity) {
|
||||
-: 72: case Fw::LOG_FATAL: // always pass FATAL
|
||||
9: 73: break;
|
||||
-: 74: case Fw::LOG_WARNING_HI:
|
||||
15: 75: if (this->m_inFilterState[INPUT_WARNING_HI].enabled == INPUT_DISABLED) {
|
||||
1: 76: return;
|
||||
-: 77: }
|
||||
14: 78: break;
|
||||
-: 79: case Fw::LOG_WARNING_LO:
|
||||
24: 80: if (this->m_inFilterState[INPUT_WARNING_LO].enabled == INPUT_DISABLED) {
|
||||
1: 81: return;
|
||||
-: 82: }
|
||||
23: 83: break;
|
||||
-: 84: case Fw::LOG_COMMAND:
|
||||
24: 85: if (this->m_inFilterState[INPUT_COMMAND].enabled == INPUT_DISABLED) {
|
||||
1: 86: return;
|
||||
-: 87: }
|
||||
23: 88: break;
|
||||
-: 89: case Fw::LOG_ACTIVITY_HI:
|
||||
49: 90: if (this->m_inFilterState[INPUT_ACTIVITY_HI].enabled == INPUT_DISABLED) {
|
||||
1: 91: return;
|
||||
-: 92: }
|
||||
48: 93: break;
|
||||
-: 94: case Fw::LOG_ACTIVITY_LO:
|
||||
24: 95: if (this->m_inFilterState[INPUT_ACTIVITY_LO].enabled == INPUT_DISABLED) {
|
||||
1: 96: return;
|
||||
-: 97: }
|
||||
23: 98: break;
|
||||
-: 99: case Fw::LOG_DIAGNOSTIC:
|
||||
54: 100: if (this->m_inFilterState[INPUT_DIAGNOSTIC].enabled == INPUT_DISABLED) {
|
||||
1: 101: return;
|
||||
-: 102: }
|
||||
53: 103: break;
|
||||
-: 104: default:
|
||||
#####: 105: FW_ASSERT(0,static_cast<NATIVE_INT_TYPE>(severity));
|
||||
#####: 106: return;
|
||||
-: 107: }
|
||||
-: 108:
|
||||
-: 109: // check ID filters
|
||||
4693: 110: for (NATIVE_INT_TYPE entry = 0; entry < TELEM_ID_FILTER_SIZE; entry++) {
|
||||
4525: 111: if (
|
||||
4551: 112: (m_filteredIDs[entry] == id) &&
|
||||
-: 113: (severity != Fw::LOG_FATAL)
|
||||
-: 114: ) {
|
||||
25: 115: return;
|
||||
-: 116: }
|
||||
-: 117: }
|
||||
-: 118:
|
||||
-: 119: // send event to the logger thread
|
||||
168: 120: this->loqQueue_internalInterfaceInvoke(id,timeTag,static_cast<QueueLogSeverity>(severity),args);
|
||||
-: 121:
|
||||
-: 122: // if connected, announce the FATAL
|
||||
168: 123: if (Fw::LOG_FATAL == severity) {
|
||||
9: 124: if (this->isConnected_FatalAnnounce_OutputPort(0)) {
|
||||
9: 125: this->FatalAnnounce_out(0,id);
|
||||
-: 126: }
|
||||
-: 127: }
|
||||
-: 128: }
|
||||
-: 129:
|
||||
168: 130: void ActiveLoggerImpl::loqQueue_internalInterfaceHandler(FwEventIdType id, Fw::Time &timeTag, QueueLogSeverity severity, Fw::LogBuffer &args) {
|
||||
-: 131:
|
||||
-: 132: // Serialize event
|
||||
168: 133: this->m_logPacket.setId(id);
|
||||
168: 134: this->m_logPacket.setTimeTag(timeTag);
|
||||
168: 135: this->m_logPacket.setLogBuffer(args);
|
||||
168: 136: this->m_comBuffer.resetSer();
|
||||
168: 137: Fw::SerializeStatus stat = this->m_logPacket.serialize(this->m_comBuffer);
|
||||
168: 138: FW_ASSERT(Fw::FW_SERIALIZE_OK == stat,static_cast<NATIVE_INT_TYPE>(stat));
|
||||
-: 139:
|
||||
168: 140: switch (severity) {
|
||||
-: 141: case QUEUE_LOG_FATAL: // always pass FATAL
|
||||
9: 142: this->m_fatalCb[this->m_fatalHead] = this->m_comBuffer;
|
||||
9: 143: this->m_fatalHead = (this->m_fatalHead + 1)%FW_NUM_ARRAY_ELEMENTS(this->m_fatalCb);
|
||||
9: 144: break;
|
||||
-: 145: case QUEUE_LOG_WARNING_HI:
|
||||
14: 146: this->m_warningHiCb[this->m_warningHiHead] = this->m_comBuffer;
|
||||
14: 147: this->m_warningHiHead = (this->m_warningHiHead + 1)%FW_NUM_ARRAY_ELEMENTS(this->m_warningHiCb);
|
||||
14: 148: if (this->m_sendFilterState[SEND_WARNING_HI].enabled == SEND_DISABLED) {
|
||||
1: 149: return;
|
||||
-: 150: }
|
||||
13: 151: break;
|
||||
-: 152: case QUEUE_LOG_WARNING_LO:
|
||||
23: 153: this->m_warningLoCb[this->m_warningLoHead] = this->m_comBuffer;
|
||||
23: 154: this->m_warningLoHead = (this->m_warningLoHead + 1)%FW_NUM_ARRAY_ELEMENTS(this->m_warningLoCb);
|
||||
23: 155: if (this->m_sendFilterState[SEND_WARNING_LO].enabled == SEND_DISABLED) {
|
||||
1: 156: return;
|
||||
-: 157: }
|
||||
22: 158: break;
|
||||
-: 159: case QUEUE_LOG_COMMAND:
|
||||
23: 160: this->m_commandCb[this->m_commandHead] = this->m_comBuffer;
|
||||
23: 161: this->m_commandHead = (this->m_commandHead + 1)%FW_NUM_ARRAY_ELEMENTS(this->m_commandCb);
|
||||
23: 162: if (this->m_sendFilterState[SEND_COMMAND].enabled == SEND_DISABLED) {
|
||||
1: 163: return;
|
||||
-: 164: }
|
||||
22: 165: break;
|
||||
-: 166: case QUEUE_LOG_ACTIVITY_HI:
|
||||
23: 167: this->m_activityHiCb[this->m_activityHiHead] = this->m_comBuffer;
|
||||
23: 168: this->m_activityHiHead = (this->m_activityHiHead + 1)%FW_NUM_ARRAY_ELEMENTS(this->m_activityHiCb);
|
||||
23: 169: if (this->m_sendFilterState[SEND_ACTIVITY_HI].enabled == SEND_DISABLED) {
|
||||
1: 170: return;
|
||||
-: 171: }
|
||||
22: 172: break;
|
||||
-: 173: case QUEUE_LOG_ACTIVITY_LO:
|
||||
23: 174: this->m_activityLoCb[this->m_activityLoHead] = this->m_comBuffer;
|
||||
23: 175: this->m_activityLoHead = (this->m_activityLoHead + 1)%FW_NUM_ARRAY_ELEMENTS(this->m_activityLoCb);
|
||||
23: 176: if (this->m_sendFilterState[SEND_ACTIVITY_LO].enabled == SEND_DISABLED) {
|
||||
1: 177: return;
|
||||
-: 178: }
|
||||
22: 179: break;
|
||||
-: 180: case QUEUE_LOG_DIAGNOSTIC:
|
||||
53: 181: this->m_diagnosticCb[this->m_diagnosticHead] = this->m_comBuffer;
|
||||
53: 182: this->m_diagnosticHead = (this->m_diagnosticHead + 1)%FW_NUM_ARRAY_ELEMENTS(this->m_diagnosticCb);
|
||||
53: 183: if (this->m_sendFilterState[SEND_DIAGNOSTIC].enabled == SEND_DISABLED) {
|
||||
1: 184: return;
|
||||
-: 185: }
|
||||
52: 186: break;
|
||||
-: 187: default:
|
||||
#####: 188: FW_ASSERT(0,static_cast<NATIVE_INT_TYPE>(severity));
|
||||
#####: 189: return;
|
||||
-: 190: }
|
||||
-: 191:
|
||||
162: 192: if (this->isConnected_PktSend_OutputPort(0)) {
|
||||
162: 193: this->PktSend_out(0, this->m_comBuffer,0);
|
||||
-: 194: }
|
||||
-: 195: }
|
||||
-: 196:
|
||||
52: 197: void ActiveLoggerImpl::ALOG_SET_EVENT_REPORT_FILTER_cmdHandler(FwOpcodeType opCode, U32 cmdSeq, InputFilterLevel FilterLevel, InputFilterEnabled FilterEnable) {
|
||||
103: 198: if ( (FilterLevel > INPUT_DIAGNOSTIC) or
|
||||
101: 199: (FilterLevel < INPUT_WARNING_HI) or
|
||||
99: 200: (FilterEnable < INPUT_ENABLED) or
|
||||
49: 201: (FilterEnable > INPUT_DISABLED)) {
|
||||
4: 202: this->cmdResponse_out(opCode,cmdSeq,Fw::COMMAND_VALIDATION_ERROR);
|
||||
56: 203: return;
|
||||
-: 204: }
|
||||
48: 205: this->m_inFilterState[FilterLevel].enabled = FilterEnable;
|
||||
48: 206: this->cmdResponse_out(opCode,cmdSeq,Fw::COMMAND_OK);
|
||||
-: 207: }
|
||||
-: 208:
|
||||
52: 209: void ActiveLoggerImpl::ALOG_SET_EVENT_SEND_FILTER_cmdHandler(FwOpcodeType opCode, U32 cmdSeq, SendFilterLevel FilterLevel, SendFilterEnabled FilterEnable) {
|
||||
103: 210: if ( (FilterLevel > SEND_DIAGNOSTIC) or
|
||||
101: 211: (FilterLevel < SEND_WARNING_HI) or
|
||||
99: 212: (FilterEnable < SEND_ENABLED) or
|
||||
49: 213: (FilterEnable > SEND_DISABLED)) {
|
||||
4: 214: this->cmdResponse_out(opCode,cmdSeq,Fw::COMMAND_VALIDATION_ERROR);
|
||||
56: 215: return;
|
||||
-: 216: }
|
||||
48: 217: this->m_sendFilterState[FilterLevel].enabled = FilterEnable;
|
||||
48: 218: this->cmdResponse_out(opCode,cmdSeq,Fw::COMMAND_OK);
|
||||
-: 219: }
|
||||
-: 220:
|
||||
17: 221: void ActiveLoggerImpl::ALOG_DUMP_EVENT_LOG_cmdHandler(FwOpcodeType opCode, U32 cmdSeq, const Fw::CmdStringArg& filename) {
|
||||
-: 222: // Walk through each event type and write it to the file
|
||||
-: 223:
|
||||
-: 224: static const BYTE delimiter = 0xA5;
|
||||
-: 225: // open the file
|
||||
17: 226: Os::File file;
|
||||
17: 227: Os::File::Status stat = file.open(filename.toChar(),Os::File::OPEN_WRITE);
|
||||
17: 228: if (stat != Os::File::OP_OK) {
|
||||
1: 229: this->log_WARNING_HI_ALOG_FILE_WRITE_ERR(LOG_WRITE_OPEN,(I32)stat);
|
||||
1: 230: this->cmdResponse_out(opCode,cmdSeq,Fw::COMMAND_EXECUTION_ERROR);
|
||||
1: 231: return;
|
||||
-: 232: }
|
||||
-: 233:
|
||||
16: 234: NATIVE_UINT_TYPE numRecords = 0;
|
||||
-: 235:
|
||||
-: 236: NATIVE_INT_TYPE fileWriteSize;
|
||||
-: 237: // write FATAL
|
||||
34: 238: for (NATIVE_UINT_TYPE entry = 0; entry < FW_NUM_ARRAY_ELEMENTS(this->m_fatalCb); entry++) {
|
||||
-: 239:
|
||||
-: 240: // if there is data, write it
|
||||
33: 241: if (this->m_fatalCb[entry].getBuffLength() != 0) {
|
||||
-: 242: // write delimiter
|
||||
20: 243: fileWriteSize = sizeof(delimiter);
|
||||
20: 244: stat = file.write(&delimiter,fileWriteSize);
|
||||
20: 245: if (stat != Os::File::OP_OK) {
|
||||
1: 246: this->log_WARNING_HI_ALOG_FILE_WRITE_ERR(LOG_WRITE_FATAL_DELIMITER,stat);
|
||||
1: 247: this->cmdResponse_out(opCode,cmdSeq,Fw::COMMAND_EXECUTION_ERROR);
|
||||
1: 248: file.close();
|
||||
1: 249: return;
|
||||
-: 250: }
|
||||
-: 251:
|
||||
-: 252: // write event record
|
||||
19: 253: fileWriteSize = this->m_fatalCb[entry].getBuffLength();
|
||||
19: 254: stat = file.write(this->m_fatalCb[entry].getBuffAddr(),fileWriteSize);
|
||||
19: 255: if (stat != Os::File::OP_OK) {
|
||||
1: 256: this->log_WARNING_HI_ALOG_FILE_WRITE_ERR(LOG_WRITE_FATAL_RECORD,stat);
|
||||
1: 257: this->cmdResponse_out(opCode,cmdSeq,Fw::COMMAND_EXECUTION_ERROR);
|
||||
1: 258: file.close();
|
||||
1: 259: return;
|
||||
-: 260: }
|
||||
18: 261: numRecords++;
|
||||
-: 262: } else {
|
||||
-: 263: // if the entry is empty, that means it is only a partially filled list, so quit writing
|
||||
13: 264: break;
|
||||
-: 265: }
|
||||
-: 266: }
|
||||
-: 267:
|
||||
-: 268: // write WARNING HI
|
||||
35: 269: for (NATIVE_UINT_TYPE entry = 0; entry < FW_NUM_ARRAY_ELEMENTS(this->m_warningHiCb); entry++) {
|
||||
-: 270: // if there is data, write it
|
||||
34: 271: if (this->m_warningHiCb[entry].getBuffLength() != 0) {
|
||||
-: 272: // write delimiter
|
||||
23: 273: fileWriteSize = sizeof(delimiter);
|
||||
23: 274: stat = file.write(&delimiter,fileWriteSize);
|
||||
23: 275: if (stat != Os::File::OP_OK) {
|
||||
1: 276: this->log_WARNING_HI_ALOG_FILE_WRITE_ERR(LOG_WRITE_WARNING_HI_DELIMITER,stat);
|
||||
1: 277: this->cmdResponse_out(opCode,cmdSeq,Fw::COMMAND_EXECUTION_ERROR);
|
||||
1: 278: file.close();
|
||||
1: 279: return;
|
||||
-: 280: }
|
||||
-: 281:
|
||||
-: 282: // write event record
|
||||
22: 283: fileWriteSize = this->m_warningHiCb[entry].getBuffLength();
|
||||
22: 284: stat = file.write(this->m_warningHiCb[entry].getBuffAddr(),fileWriteSize);
|
||||
22: 285: if (stat != Os::File::OP_OK) {
|
||||
1: 286: this->log_WARNING_HI_ALOG_FILE_WRITE_ERR(LOG_WRITE_WARNING_HI_RECORD,stat);
|
||||
1: 287: this->cmdResponse_out(opCode,cmdSeq,Fw::COMMAND_EXECUTION_ERROR);
|
||||
1: 288: file.close();
|
||||
1: 289: return;
|
||||
-: 290: }
|
||||
21: 291: numRecords++;
|
||||
-: 292: } else {
|
||||
-: 293: // if the entry is empty, that means it is only a partially filled list, so quit writing
|
||||
11: 294: break;
|
||||
-: 295: }
|
||||
-: 296: }
|
||||
-: 297:
|
||||
-: 298: // write WARNING LO
|
||||
41: 299: for (NATIVE_UINT_TYPE entry = 0; entry < FW_NUM_ARRAY_ELEMENTS(this->m_warningLoCb); entry++) {
|
||||
-: 300: // if there is data, write it
|
||||
40: 301: if (this->m_warningLoCb[entry].getBuffLength() != 0) {
|
||||
-: 302: // write delimiter
|
||||
31: 303: fileWriteSize = sizeof(delimiter);
|
||||
31: 304: stat = file.write(&delimiter,fileWriteSize);
|
||||
31: 305: if (stat != Os::File::OP_OK) {
|
||||
1: 306: this->log_WARNING_HI_ALOG_FILE_WRITE_ERR(LOG_WRITE_WARNING_LO_DELIMITER,stat);
|
||||
1: 307: this->cmdResponse_out(opCode,cmdSeq,Fw::COMMAND_EXECUTION_ERROR);
|
||||
1: 308: file.close();
|
||||
1: 309: return;
|
||||
-: 310: }
|
||||
-: 311:
|
||||
-: 312: // write event record
|
||||
30: 313: fileWriteSize = this->m_warningLoCb[entry].getBuffLength();
|
||||
30: 314: stat = file.write(this->m_warningLoCb[entry].getBuffAddr(),fileWriteSize);
|
||||
30: 315: if (stat != Os::File::OP_OK) {
|
||||
1: 316: this->log_WARNING_HI_ALOG_FILE_WRITE_ERR(LOG_WRITE_WARNING_LO_RECORD,stat);
|
||||
1: 317: this->cmdResponse_out(opCode,cmdSeq,Fw::COMMAND_EXECUTION_ERROR);
|
||||
1: 318: file.close();
|
||||
1: 319: return;
|
||||
-: 320: }
|
||||
29: 321: numRecords++;
|
||||
-: 322: } else {
|
||||
-: 323: // if the entry is empty, that means it is only a partially filled list, so quit writing
|
||||
9: 324: break;
|
||||
-: 325: }
|
||||
-: 326: }
|
||||
-: 327:
|
||||
-: 328: // write COMMAND
|
||||
37: 329: for (NATIVE_UINT_TYPE entry = 0; entry < FW_NUM_ARRAY_ELEMENTS(this->m_commandCb); entry++) {
|
||||
-: 330: // if there is data, write it
|
||||
36: 331: if (this->m_commandCb[entry].getBuffLength() != 0) {
|
||||
-: 332: // write delimiter
|
||||
29: 333: fileWriteSize = sizeof(delimiter);
|
||||
29: 334: stat = file.write(&delimiter,fileWriteSize);
|
||||
29: 335: if (stat != Os::File::OP_OK) {
|
||||
1: 336: this->log_WARNING_HI_ALOG_FILE_WRITE_ERR(LOG_WRITE_COMMAND_DELIMITER,stat);
|
||||
1: 337: this->cmdResponse_out(opCode,cmdSeq,Fw::COMMAND_EXECUTION_ERROR);
|
||||
1: 338: file.close();
|
||||
1: 339: return;
|
||||
-: 340: }
|
||||
-: 341:
|
||||
-: 342: // write event record
|
||||
28: 343: fileWriteSize = this->m_commandCb[entry].getBuffLength();
|
||||
28: 344: stat = file.write(this->m_commandCb[entry].getBuffAddr(),fileWriteSize);
|
||||
28: 345: if (stat != Os::File::OP_OK) {
|
||||
1: 346: this->log_WARNING_HI_ALOG_FILE_WRITE_ERR(LOG_WRITE_COMMAND_RECORD,stat);
|
||||
1: 347: this->cmdResponse_out(opCode,cmdSeq,Fw::COMMAND_EXECUTION_ERROR);
|
||||
1: 348: file.close();
|
||||
1: 349: return;
|
||||
-: 350: }
|
||||
27: 351: numRecords++;
|
||||
-: 352: } else {
|
||||
-: 353: // if the entry is empty, that means it is only a partially filled list, so quit writing
|
||||
7: 354: break;
|
||||
-: 355: }
|
||||
-: 356: }
|
||||
-: 357:
|
||||
-: 358: // write ACTIVITY HI
|
||||
33: 359: for (NATIVE_UINT_TYPE entry = 0; entry < FW_NUM_ARRAY_ELEMENTS(this->m_activityHiCb); entry++) {
|
||||
-: 360: // if there is data, write it
|
||||
32: 361: if (this->m_activityHiCb[entry].getBuffLength() != 0) {
|
||||
-: 362: // write delimiter
|
||||
27: 363: fileWriteSize = sizeof(delimiter);
|
||||
27: 364: stat = file.write(&delimiter,fileWriteSize);
|
||||
27: 365: if (stat != Os::File::OP_OK) {
|
||||
1: 366: this->log_WARNING_HI_ALOG_FILE_WRITE_ERR(LOG_WRITE_ACTIVITY_HI_DELIMITER,stat);
|
||||
1: 367: this->cmdResponse_out(opCode,cmdSeq,Fw::COMMAND_EXECUTION_ERROR);
|
||||
1: 368: file.close();
|
||||
1: 369: return;
|
||||
-: 370: }
|
||||
-: 371:
|
||||
-: 372: // write event record
|
||||
26: 373: fileWriteSize = this->m_activityHiCb[entry].getBuffLength();
|
||||
26: 374: stat = file.write(this->m_activityHiCb[entry].getBuffAddr(),fileWriteSize);
|
||||
26: 375: if (stat != Os::File::OP_OK) {
|
||||
1: 376: this->log_WARNING_HI_ALOG_FILE_WRITE_ERR(LOG_WRITE_ACTIVITY_HI_RECORD,stat);
|
||||
1: 377: this->cmdResponse_out(opCode,cmdSeq,Fw::COMMAND_EXECUTION_ERROR);
|
||||
1: 378: file.close();
|
||||
1: 379: return;
|
||||
-: 380: }
|
||||
25: 381: numRecords++;
|
||||
-: 382: } else {
|
||||
-: 383: // if the entry is empty, that means it is only a partially filled list, so quit writing
|
||||
5: 384: break;
|
||||
-: 385: }
|
||||
-: 386: }
|
||||
-: 387:
|
||||
-: 388: // write ACTIVITY LO
|
||||
29: 389: for (NATIVE_UINT_TYPE entry = 0; entry < FW_NUM_ARRAY_ELEMENTS(this->m_activityLoCb); entry++) {
|
||||
-: 390: // if there is data, write it
|
||||
28: 391: if (this->m_activityLoCb[entry].getBuffLength() != 0) {
|
||||
-: 392: // write delimiter
|
||||
25: 393: fileWriteSize = sizeof(delimiter);
|
||||
25: 394: stat = file.write(&delimiter,fileWriteSize);
|
||||
25: 395: if (stat != Os::File::OP_OK) {
|
||||
1: 396: this->log_WARNING_HI_ALOG_FILE_WRITE_ERR(LOG_WRITE_ACTIVITY_LO_DELIMITER,stat);
|
||||
1: 397: this->cmdResponse_out(opCode,cmdSeq,Fw::COMMAND_EXECUTION_ERROR);
|
||||
1: 398: file.close();
|
||||
1: 399: return;
|
||||
-: 400: }
|
||||
-: 401:
|
||||
-: 402: // write event record
|
||||
24: 403: fileWriteSize = this->m_activityLoCb[entry].getBuffLength();
|
||||
24: 404: stat = file.write(this->m_activityLoCb[entry].getBuffAddr(),fileWriteSize);
|
||||
24: 405: if (stat != Os::File::OP_OK) {
|
||||
1: 406: this->log_WARNING_HI_ALOG_FILE_WRITE_ERR(LOG_WRITE_ACTIVITY_LO_RECORD,stat);
|
||||
1: 407: this->cmdResponse_out(opCode,cmdSeq,Fw::COMMAND_EXECUTION_ERROR);
|
||||
1: 408: file.close();
|
||||
1: 409: return;
|
||||
-: 410: }
|
||||
23: 411: numRecords++;
|
||||
-: 412: } else {
|
||||
-: 413: // if the entry is empty, that means it is only a partially filled list, so quit writing
|
||||
3: 414: break;
|
||||
-: 415: }
|
||||
-: 416: }
|
||||
-: 417:
|
||||
-: 418: // write DIAGNOSTIC
|
||||
55: 419: for (NATIVE_UINT_TYPE entry = 0; entry < FW_NUM_ARRAY_ELEMENTS(this->m_diagnosticCb); entry++) {
|
||||
-: 420: // if there is data, write it
|
||||
54: 421: if (this->m_diagnosticCb[entry].getBuffLength() != 0) {
|
||||
-: 422: // write delimiter
|
||||
53: 423: fileWriteSize = sizeof(delimiter);
|
||||
53: 424: stat = file.write(&delimiter,fileWriteSize);
|
||||
53: 425: if (stat != Os::File::OP_OK) {
|
||||
1: 426: this->log_WARNING_HI_ALOG_FILE_WRITE_ERR(LOG_WRITE_DIAGNOSTIC_DELIMITER,stat);
|
||||
1: 427: this->cmdResponse_out(opCode,cmdSeq,Fw::COMMAND_EXECUTION_ERROR);
|
||||
1: 428: file.close();
|
||||
1: 429: return;
|
||||
-: 430: }
|
||||
-: 431:
|
||||
-: 432: // write event record
|
||||
52: 433: fileWriteSize = this->m_diagnosticCb[entry].getBuffLength();
|
||||
52: 434: stat = file.write(this->m_diagnosticCb[entry].getBuffAddr(),fileWriteSize);
|
||||
52: 435: if (stat != Os::File::OP_OK) {
|
||||
1: 436: this->log_WARNING_HI_ALOG_FILE_WRITE_ERR(LOG_WRITE_DIAGNOSTIC_RECORD,stat);
|
||||
1: 437: this->cmdResponse_out(opCode,cmdSeq,Fw::COMMAND_EXECUTION_ERROR);
|
||||
1: 438: file.close();
|
||||
1: 439: return;
|
||||
-: 440: }
|
||||
51: 441: numRecords++;
|
||||
-: 442: } else {
|
||||
-: 443: // if the entry is empty, that means it is only a partially filled list, so quit writing
|
||||
1: 444: break;
|
||||
-: 445: }
|
||||
-: 446: }
|
||||
-: 447:
|
||||
2: 448: file.close();
|
||||
-: 449:
|
||||
2: 450: this->log_ACTIVITY_HI_ALOG_FILE_WRITE_COMPLETE(numRecords);
|
||||
-: 451:
|
||||
2: 452: this->cmdResponse_out(opCode,cmdSeq,Fw::COMMAND_OK);
|
||||
-: 453: }
|
||||
-: 454:
|
||||
81: 455: void ActiveLoggerImpl::ALOG_SET_ID_FILTER_cmdHandler(
|
||||
-: 456: FwOpcodeType opCode, //!< The opcode
|
||||
-: 457: U32 cmdSeq, //!< The command sequence number
|
||||
-: 458: U32 ID,
|
||||
-: 459: IdFilterEnabled IdFilterEnable //!< ID filter state
|
||||
-: 460: ) {
|
||||
-: 461:
|
||||
-: 462: // check parameter
|
||||
81: 463: switch (IdFilterEnable) {
|
||||
-: 464: case ID_ENABLED:
|
||||
-: 465: case ID_DISABLED:
|
||||
80: 466: break;
|
||||
-: 467: default:
|
||||
1: 468: this->cmdResponse_out(opCode,cmdSeq,Fw::COMMAND_VALIDATION_ERROR);
|
||||
1: 469: return;
|
||||
-: 470: }
|
||||
-: 471:
|
||||
80: 472: if (ID_ENABLED == IdFilterEnable) { // add ID
|
||||
-: 473: // search list for existing entry
|
||||
1079: 474: for (NATIVE_INT_TYPE entry = 0; entry < TELEM_ID_FILTER_SIZE; entry++) {
|
||||
1050: 475: if (this->m_filteredIDs[entry] == ID) {
|
||||
25: 476: this->cmdResponse_out(opCode,cmdSeq,Fw::COMMAND_OK);
|
||||
25: 477: this->log_ACTIVITY_HI_ALOG_ID_FILTER_ENABLED(ID);
|
||||
25: 478: return;
|
||||
-: 479: }
|
||||
-: 480: }
|
||||
-: 481: // if not already a match, search for an open slot
|
||||
357: 482: for (NATIVE_INT_TYPE entry = 0; entry < TELEM_ID_FILTER_SIZE; entry++) {
|
||||
356: 483: if (this->m_filteredIDs[entry] == 0) {
|
||||
28: 484: this->m_filteredIDs[entry] = ID;
|
||||
28: 485: this->cmdResponse_out(opCode,cmdSeq,Fw::COMMAND_OK);
|
||||
28: 486: this->log_ACTIVITY_HI_ALOG_ID_FILTER_ENABLED(ID);
|
||||
28: 487: return;
|
||||
-: 488: }
|
||||
-: 489: }
|
||||
-: 490: // if an empty slot was not found, send an error event
|
||||
1: 491: this->log_WARNING_LO_ALOG_ID_FILTER_LIST_FULL(ID);
|
||||
1: 492: this->cmdResponse_out(opCode,cmdSeq,Fw::COMMAND_EXECUTION_ERROR);
|
||||
-: 493: } else { // remove ID
|
||||
-: 494: // search list for existing entry
|
||||
351: 495: for (NATIVE_INT_TYPE entry = 0; entry < TELEM_ID_FILTER_SIZE; entry++) {
|
||||
350: 496: if (this->m_filteredIDs[entry] == ID) {
|
||||
25: 497: this->m_filteredIDs[entry] = 0; // zero entry
|
||||
25: 498: this->cmdResponse_out(opCode,cmdSeq,Fw::COMMAND_OK);
|
||||
25: 499: this->log_ACTIVITY_HI_ALOG_ID_FILTER_REMOVED(ID);
|
||||
25: 500: return;
|
||||
-: 501: }
|
||||
-: 502: }
|
||||
-: 503: // if it gets here, wasn't found
|
||||
1: 504: this->log_WARNING_LO_ALOG_ID_FILTER_NOT_FOUND(ID);
|
||||
1: 505: this->cmdResponse_out(opCode,cmdSeq,Fw::COMMAND_EXECUTION_ERROR);
|
||||
-: 506: }
|
||||
-: 507:
|
||||
-: 508: }
|
||||
-: 509:
|
||||
1: 510: void ActiveLoggerImpl::ALOG_DUMP_FILTER_STATE_cmdHandler(
|
||||
-: 511: FwOpcodeType opCode, //!< The opcode
|
||||
-: 512: U32 cmdSeq //!< The command sequence number
|
||||
-: 513: ) {
|
||||
-: 514:
|
||||
-: 515: // first, iterate through severity filters
|
||||
7: 516: for (NATIVE_INT_TYPE filter = 0; filter < InputFilterLevel_MAX; filter++) {
|
||||
-: 517: this->log_ACTIVITY_LO_ALOG_SEVERITY_FILTER_STATE(
|
||||
-: 518: static_cast<EventFilterState>(filter),
|
||||
-: 519: INPUT_ENABLED == this->m_inFilterState[filter].enabled,
|
||||
-: 520: SEND_ENABLED == this->m_sendFilterState[filter].enabled
|
||||
6: 521: );
|
||||
-: 522: }
|
||||
-: 523:
|
||||
-: 524: // iterate through ID filter
|
||||
26: 525: for (NATIVE_INT_TYPE entry = 0; entry < TELEM_ID_FILTER_SIZE; entry++) {
|
||||
25: 526: if (this->m_filteredIDs[entry] != 0) {
|
||||
3: 527: this->log_ACTIVITY_HI_ALOG_ID_FILTER_ENABLED(this->m_filteredIDs[entry]);
|
||||
-: 528: }
|
||||
-: 529: }
|
||||
-: 530:
|
||||
1: 531: this->cmdResponse_out(opCode,cmdSeq,Fw::COMMAND_OK);
|
||||
1: 532: }
|
||||
-: 533:
|
||||
-: 534:} // namespace Svc
|
||||
@ -1,9 +0,0 @@
|
||||
File '/home/tim/source/isf/Svc/ActiveLogger/ActiveLoggerImpl.cpp'
|
||||
Lines executed:98.61% of 288
|
||||
Creating 'ActiveLoggerImpl.cpp.gcov'
|
||||
|
||||
File '/home/tim/source/isf/Svc/ActiveLogger/ActiveLoggerComponentAc.cpp'
|
||||
Lines executed:80.95% of 567
|
||||
Creating 'ActiveLoggerComponentAc.cpp.gcov'
|
||||
|
||||
Lines executed:86.90% of 855
|
||||
@ -1,165 +0,0 @@
|
||||
Running /home/tcanham/source/isf/Svc/ActiveLogger/test/ut/linux-cygwin-x86-ut-gnu-bin/test_ut
|
||||
[==========] Running 8 tests from 1 test case.
|
||||
[----------] Global test environment set-up.
|
||||
[----------] 8 tests from ActiveLoggerTest
|
||||
[ RUN ] ActiveLoggerTest.NominalEventSend
|
||||
|
||||
***************************************
|
||||
TESTCASE 100.1.1: Nominal Event Logging
|
||||
***************************************
|
||||
|
||||
***************************************
|
||||
(RQ) ISF-AL-001
|
||||
***************************************
|
||||
[ OK ] ActiveLoggerTest.NominalEventSend (3 ms)
|
||||
[ RUN ] ActiveLoggerTest.FilteredEventSend
|
||||
|
||||
***************************************
|
||||
TESTCASE 100.1.2: Nominal Event Filtering
|
||||
***************************************
|
||||
|
||||
***************************************
|
||||
(RQ) ISF-AL-004
|
||||
***************************************
|
||||
|
||||
***************************************
|
||||
(RQ) ISF-AL-005
|
||||
***************************************
|
||||
|
||||
***************************************
|
||||
(RQ) ISF-AL-006
|
||||
***************************************
|
||||
|
||||
***************************************
|
||||
(RQ) ISF-AL-004
|
||||
***************************************
|
||||
|
||||
***************************************
|
||||
(RQ) ISF-AL-005
|
||||
***************************************
|
||||
|
||||
***************************************
|
||||
(RQ) ISF-AL-006
|
||||
***************************************
|
||||
|
||||
***************************************
|
||||
(RQ) ISF-AL-004
|
||||
***************************************
|
||||
|
||||
***************************************
|
||||
(RQ) ISF-AL-005
|
||||
***************************************
|
||||
|
||||
***************************************
|
||||
(RQ) ISF-AL-006
|
||||
***************************************
|
||||
|
||||
***************************************
|
||||
(RQ) ISF-AL-004
|
||||
***************************************
|
||||
|
||||
***************************************
|
||||
(RQ) ISF-AL-005
|
||||
***************************************
|
||||
|
||||
***************************************
|
||||
(RQ) ISF-AL-006
|
||||
***************************************
|
||||
|
||||
***************************************
|
||||
(RQ) ISF-AL-004
|
||||
***************************************
|
||||
|
||||
***************************************
|
||||
(RQ) ISF-AL-005
|
||||
***************************************
|
||||
|
||||
***************************************
|
||||
(RQ) ISF-AL-006
|
||||
***************************************
|
||||
|
||||
***************************************
|
||||
(RQ) ISF-AL-004
|
||||
***************************************
|
||||
|
||||
***************************************
|
||||
(RQ) ISF-AL-005
|
||||
***************************************
|
||||
|
||||
***************************************
|
||||
(RQ) ISF-AL-006
|
||||
***************************************
|
||||
[ OK ] ActiveLoggerTest.FilteredEventSend (2 ms)
|
||||
[ RUN ] ActiveLoggerTest.FilterIdTest
|
||||
|
||||
***************************************
|
||||
TESTCASE 100.1.3: Filter events by ID
|
||||
***************************************
|
||||
|
||||
***************************************
|
||||
(RQ) ISF-AL-007
|
||||
***************************************
|
||||
[ OK ] ActiveLoggerTest.FilterIdTest (4 ms)
|
||||
[ RUN ] ActiveLoggerTest.FilterDumpTest
|
||||
|
||||
***************************************
|
||||
TESTCASE 100.1.3: Dump filter values
|
||||
***************************************
|
||||
[ OK ] ActiveLoggerTest.FilterDumpTest (2 ms)
|
||||
[ RUN ] ActiveLoggerTest.InvalidCommands
|
||||
|
||||
***************************************
|
||||
TESTCASE 100.2.1: Off-Nominal Invalid Commands
|
||||
***************************************
|
||||
[ OK ] ActiveLoggerTest.InvalidCommands (3 ms)
|
||||
[ RUN ] ActiveLoggerTest.FatalTesting
|
||||
|
||||
***************************************
|
||||
TESTCASE 100.2.2: Off-Nominal FATAL processing
|
||||
***************************************
|
||||
[ OK ] ActiveLoggerTest.FatalTesting (3 ms)
|
||||
[ RUN ] ActiveLoggerTest.CircularBufferDump
|
||||
|
||||
***************************************
|
||||
TESTCASE 100.1.3: File dump of event circular buffers
|
||||
***************************************
|
||||
|
||||
***************************************
|
||||
(RQ) ISF-AL-002
|
||||
***************************************
|
||||
|
||||
***************************************
|
||||
(RQ) ISF-AL-003
|
||||
***************************************
|
||||
[ OK ] ActiveLoggerTest.CircularBufferDump (6 ms)
|
||||
[ RUN ] ActiveLoggerTest.CircularBufferDumpWithErrors
|
||||
|
||||
***************************************
|
||||
TESTCASE 100.2.3: File dump of event circular buffers with errors
|
||||
***************************************
|
||||
EVENT: (512) (0:0,0) WARNING_HI: (ActiveLoggerImpl) ALOG_FILE_WRITE_ERR : Event buffer write failed in stage 0 with error 1
|
||||
EVENT: (512) (0:0,0) WARNING_HI: (ActiveLoggerImpl) ALOG_FILE_WRITE_ERR : Event buffer write failed in stage 1 with error 5
|
||||
EVENT: (512) (0:0,0) WARNING_HI: (ActiveLoggerImpl) ALOG_FILE_WRITE_ERR : Event buffer write failed in stage 2 with error 5
|
||||
EVENT: (512) (0:0,0) WARNING_HI: (ActiveLoggerImpl) ALOG_FILE_WRITE_ERR : Event buffer write failed in stage 3 with error 5
|
||||
EVENT: (512) (0:0,0) WARNING_HI: (ActiveLoggerImpl) ALOG_FILE_WRITE_ERR : Event buffer write failed in stage 4 with error 5
|
||||
EVENT: (512) (0:0,0) WARNING_HI: (ActiveLoggerImpl) ALOG_FILE_WRITE_ERR : Event buffer write failed in stage 5 with error 5
|
||||
EVENT: (512) (0:0,0) WARNING_HI: (ActiveLoggerImpl) ALOG_FILE_WRITE_ERR : Event buffer write failed in stage 6 with error 5
|
||||
EVENT: (512) (0:0,0) WARNING_HI: (ActiveLoggerImpl) ALOG_FILE_WRITE_ERR : Event buffer write failed in stage 7 with error 5
|
||||
EVENT: (512) (0:0,0) WARNING_HI: (ActiveLoggerImpl) ALOG_FILE_WRITE_ERR : Event buffer write failed in stage 8 with error 5
|
||||
EVENT: (512) (0:0,0) WARNING_HI: (ActiveLoggerImpl) ALOG_FILE_WRITE_ERR : Event buffer write failed in stage 9 with error 5
|
||||
EVENT: (512) (0:0,0) WARNING_HI: (ActiveLoggerImpl) ALOG_FILE_WRITE_ERR : Event buffer write failed in stage 10 with error 5
|
||||
EVENT: (512) (0:0,0) WARNING_HI: (ActiveLoggerImpl) ALOG_FILE_WRITE_ERR : Event buffer write failed in stage 11 with error 5
|
||||
EVENT: (512) (0:0,0) WARNING_HI: (ActiveLoggerImpl) ALOG_FILE_WRITE_ERR : Event buffer write failed in stage 12 with error 5
|
||||
EVENT: (512) (0:0,0) WARNING_HI: (ActiveLoggerImpl) ALOG_FILE_WRITE_ERR : Event buffer write failed in stage 13 with error 5
|
||||
EVENT: (512) (0:0,0) WARNING_HI: (ActiveLoggerImpl) ALOG_FILE_WRITE_ERR : Event buffer write failed in stage 14 with error 5
|
||||
EVENT: (513) (0:0,0) ACTIVITY_HI: (ActiveLoggerImpl) ALOG_FILE_WRITE_COMPLETE : Event buffer write complete. Wrote 7 records.
|
||||
[ OK ] ActiveLoggerTest.CircularBufferDumpWithErrors (10 ms)
|
||||
[----------] 8 tests from ActiveLoggerTest (33 ms total)
|
||||
|
||||
[----------] Global test environment tear-down
|
||||
[==========] 8 tests from 1 test case ran. (34 ms total)
|
||||
[ PASSED ] 8 tests.
|
||||
make[1]: Leaving directory '/home/tcanham/source/isf/Svc/ActiveLogger'
|
||||
|
||||
08:04:52 Build Finished (took 2s.934ms)
|
||||
|
||||
@ -78,12 +78,7 @@ Unit Test Checklist | [Link](Checklist_Unit_Test.xlsx)
|
||||
|
||||
## 6. Unit Testing
|
||||
|
||||
The unit test results are as follows:
|
||||
|
||||
Log|Link
|
||||
---|----
|
||||
Test Output|[Link](../test/ut/output/test.txt)
|
||||
Coverage Output|[Link](../test/ut/output/ActiveRateGroupImpl.cpp.gcov)
|
||||
To see unit test coverage run fprime-util check --coverage
|
||||
|
||||
## 7. Change Log
|
||||
|
||||
|
||||
@ -1,996 +0,0 @@
|
||||
-: 0:Source:/home/tcanham/source/isf/Svc/ActiveRateGroup/ActiveRateGroupComponentAc.cpp
|
||||
-: 0:Programs:10
|
||||
-: 1:// ======================================================================
|
||||
-: 2:// \title ActiveRateGroupComponentAc.hpp
|
||||
-: 3:// \author Auto-generated
|
||||
-: 4:// \brief cpp file for ActiveRateGroup component base class
|
||||
-: 5://
|
||||
-: 6:// \copyright
|
||||
-: 7:// Copyright 2009-2015, by the California Institute of Technology.
|
||||
-: 8:// ALL RIGHTS RESERVED. United States Government Sponsorship
|
||||
-: 9:// acknowledged.
|
||||
-: 11://
|
||||
-: 18:// ======================================================================
|
||||
-: 19:
|
||||
-: 20:#include <stdio.h>
|
||||
-: 21:#include <FpConfig.hpp>
|
||||
-: 22:#include <Svc/ActiveRateGroup/ActiveRateGroupComponentAc.hpp>
|
||||
-: 23:#include <Fw/Types/Assert.hpp>
|
||||
-: 24:#if FW_ENABLE_TEXT_LOGGING
|
||||
-: 25:#include <Fw/Types/EightyCharString.hpp>
|
||||
-: 26:#endif
|
||||
-: 27:
|
||||
-: 28:
|
||||
-: 29:namespace Svc {
|
||||
-: 30:
|
||||
-: 31: // ----------------------------------------------------------------------
|
||||
-: 32: // Anonymous namespace to prevent name collisions
|
||||
-: 33: // ----------------------------------------------------------------------
|
||||
-: 34:
|
||||
-: 35: namespace {
|
||||
-: 36:
|
||||
-: 37: typedef enum {
|
||||
-: 38: ACTIVERATEGROUP_COMPONENT_EXIT = Fw::ActiveComponentBase::ACTIVE_COMPONENT_EXIT,
|
||||
-: 39: CYCLEIN_CYCLE
|
||||
-: 40: } MsgTypeEnum;
|
||||
-: 41:
|
||||
-: 42: // Get the max size by doing a union of the input port serialization sizes.
|
||||
-: 43:
|
||||
-: 44: typedef union {
|
||||
-: 45: BYTE port1[Svc::InputCyclePort::SERIALIZED_SIZE];
|
||||
-: 46: } BuffUnion;
|
||||
-: 47:
|
||||
-: 48: // Define a message buffer class large enough to handle all the
|
||||
-: 49: // asynchronous inputs to the component
|
||||
-: 50:
|
||||
750: 51: class ComponentIpcSerializableBuffer :
|
||||
-: 52: public Fw::SerializeBufferBase
|
||||
-: 53: {
|
||||
-: 54:
|
||||
-: 55: public:
|
||||
-: 56:
|
||||
-: 57: enum {
|
||||
-: 58: // Max. message size = size of data + message id + port
|
||||
-: 59: SERIALIZATION_SIZE =
|
||||
-: 60: sizeof(BuffUnion) +
|
||||
-: 61: sizeof(NATIVE_INT_TYPE) +
|
||||
-: 62: sizeof(NATIVE_INT_TYPE)
|
||||
-: 63: };
|
||||
-: 64:
|
||||
1230: 65: NATIVE_UINT_TYPE getBuffCapacity(void) const {
|
||||
1230: 66: return sizeof(m_buff);
|
||||
-: 67: }
|
||||
-: 68:
|
||||
7635: 69: U8* getBuffAddr(void) {
|
||||
7635: 70: return m_buff;
|
||||
-: 71: }
|
||||
-: 72:
|
||||
240: 73: const U8* getBuffAddr(void) const {
|
||||
240: 74: return m_buff;
|
||||
-: 75: }
|
||||
-: 76:
|
||||
-: 77: private:
|
||||
-: 78: // Should be the max of all the input ports serialized sizes...
|
||||
-: 79: U8 m_buff[SERIALIZATION_SIZE];
|
||||
-: 80:
|
||||
-: 81: };
|
||||
-: 82:
|
||||
-: 83: }
|
||||
-: 84:
|
||||
-: 85: // ----------------------------------------------------------------------
|
||||
-: 86: // Getters for numbers of input ports
|
||||
-: 87: // ----------------------------------------------------------------------
|
||||
-: 88:
|
||||
30: 89: Svc::InputCyclePort *ActiveRateGroupComponentBase ::
|
||||
-: 90: get_CycleIn_InputPort(NATIVE_INT_TYPE portNum)
|
||||
-: 91: {
|
||||
30: 92: FW_ASSERT(portNum < this->getNum_CycleIn_InputPorts());
|
||||
30: 93: return &this->m_CycleIn_InputPort[portNum];
|
||||
-: 94: }
|
||||
-: 95:
|
||||
-: 96: // ----------------------------------------------------------------------
|
||||
-: 97: // Typed connectors for output ports
|
||||
-: 98: // ----------------------------------------------------------------------
|
||||
-: 99:
|
||||
150: 100: void ActiveRateGroupComponentBase ::
|
||||
-: 101: set_RateGroupMemberOut_OutputPort(
|
||||
-: 102: NATIVE_INT_TYPE portNum,
|
||||
-: 103: Svc::InputSchedPort* port
|
||||
-: 104: )
|
||||
-: 105: {
|
||||
150: 106: FW_ASSERT(portNum < this->getNum_RateGroupMemberOut_OutputPorts());
|
||||
150: 107: this->m_RateGroupMemberOut_OutputPort[portNum].addCallPort(port);
|
||||
150: 108: }
|
||||
-: 109:
|
||||
30: 110: void ActiveRateGroupComponentBase ::
|
||||
-: 111: set_Tlm_OutputPort(
|
||||
-: 112: NATIVE_INT_TYPE portNum,
|
||||
-: 113: Fw::InputTlmPort* port
|
||||
-: 114: )
|
||||
-: 115: {
|
||||
30: 116: FW_ASSERT(portNum < this->getNum_Tlm_OutputPorts());
|
||||
30: 117: this->m_Tlm_OutputPort[portNum].addCallPort(port);
|
||||
30: 118: }
|
||||
-: 119:
|
||||
30: 120: void ActiveRateGroupComponentBase ::
|
||||
-: 121: set_Time_OutputPort(
|
||||
-: 122: NATIVE_INT_TYPE portNum,
|
||||
-: 123: Fw::InputTimePort* port
|
||||
-: 124: )
|
||||
-: 125: {
|
||||
30: 126: FW_ASSERT(portNum < this->getNum_Time_OutputPorts());
|
||||
30: 127: this->m_Time_OutputPort[portNum].addCallPort(port);
|
||||
30: 128: }
|
||||
-: 129:
|
||||
30: 130: void ActiveRateGroupComponentBase ::
|
||||
-: 131: set_Log_OutputPort(
|
||||
-: 132: NATIVE_INT_TYPE portNum,
|
||||
-: 133: Fw::InputLogPort* port
|
||||
-: 134: )
|
||||
-: 135: {
|
||||
30: 136: FW_ASSERT(portNum < this->getNum_Log_OutputPorts());
|
||||
30: 137: this->m_Log_OutputPort[portNum].addCallPort(port);
|
||||
30: 138: }
|
||||
-: 139:
|
||||
-: 140:#if FW_ENABLE_TEXT_LOGGING == 1
|
||||
30: 141: void ActiveRateGroupComponentBase ::
|
||||
-: 142: set_LogText_OutputPort(
|
||||
-: 143: NATIVE_INT_TYPE portNum,
|
||||
-: 144: Fw::InputLogTextPort* port
|
||||
-: 145: )
|
||||
-: 146: {
|
||||
30: 147: FW_ASSERT(portNum < this->getNum_LogText_OutputPorts());
|
||||
30: 148: this->m_LogText_OutputPort[portNum].addCallPort(port);
|
||||
30: 149: }
|
||||
-: 150:#endif
|
||||
-: 151:
|
||||
-: 152: // ----------------------------------------------------------------------
|
||||
-: 153: // Serialization connectors for output ports
|
||||
-: 154: // ----------------------------------------------------------------------
|
||||
-: 155:
|
||||
-: 156:#if FW_PORT_SERIALIZATION
|
||||
-: 157:
|
||||
#####: 158: void ActiveRateGroupComponentBase ::
|
||||
-: 159: set_RateGroupMemberOut_OutputPort(
|
||||
-: 160: NATIVE_INT_TYPE portNum,
|
||||
-: 161: Fw::InputSerializePort *port
|
||||
-: 162: )
|
||||
-: 163: {
|
||||
#####: 164: FW_ASSERT(portNum < this->getNum_RateGroupMemberOut_OutputPorts());
|
||||
#####: 165: return this->m_RateGroupMemberOut_OutputPort[portNum].registerSerialPort(port);
|
||||
-: 166: }
|
||||
-: 167:
|
||||
#####: 168: void ActiveRateGroupComponentBase ::
|
||||
-: 169: set_Tlm_OutputPort(
|
||||
-: 170: NATIVE_INT_TYPE portNum,
|
||||
-: 171: Fw::InputSerializePort *port
|
||||
-: 172: )
|
||||
-: 173: {
|
||||
#####: 174: FW_ASSERT(portNum < this->getNum_Tlm_OutputPorts());
|
||||
#####: 175: return this->m_Tlm_OutputPort[portNum].registerSerialPort(port);
|
||||
-: 176: }
|
||||
-: 177:
|
||||
#####: 178: void ActiveRateGroupComponentBase ::
|
||||
-: 179: set_Time_OutputPort(
|
||||
-: 180: NATIVE_INT_TYPE portNum,
|
||||
-: 181: Fw::InputSerializePort *port
|
||||
-: 182: )
|
||||
-: 183: {
|
||||
#####: 184: FW_ASSERT(portNum < this->getNum_Time_OutputPorts());
|
||||
#####: 185: return this->m_Time_OutputPort[portNum].registerSerialPort(port);
|
||||
-: 186: }
|
||||
-: 187:
|
||||
#####: 188: void ActiveRateGroupComponentBase ::
|
||||
-: 189: set_Log_OutputPort(
|
||||
-: 190: NATIVE_INT_TYPE portNum,
|
||||
-: 191: Fw::InputSerializePort *port
|
||||
-: 192: )
|
||||
-: 193: {
|
||||
#####: 194: FW_ASSERT(portNum < this->getNum_Log_OutputPorts());
|
||||
#####: 195: return this->m_Log_OutputPort[portNum].registerSerialPort(port);
|
||||
-: 196: }
|
||||
-: 197:
|
||||
-: 198:#if FW_ENABLE_TEXT_LOGGING == 1
|
||||
#####: 199: void ActiveRateGroupComponentBase ::
|
||||
-: 200: set_LogText_OutputPort(
|
||||
-: 201: NATIVE_INT_TYPE portNum,
|
||||
-: 202: Fw::InputSerializePort *port
|
||||
-: 203: )
|
||||
-: 204: {
|
||||
#####: 205: FW_ASSERT(portNum < this->getNum_LogText_OutputPorts());
|
||||
#####: 206: return this->m_LogText_OutputPort[portNum].registerSerialPort(port);
|
||||
-: 207: }
|
||||
-: 208:#endif
|
||||
-: 209:
|
||||
-: 210:#endif
|
||||
-: 211:
|
||||
-: 212: // ----------------------------------------------------------------------
|
||||
-: 213: // Component construction, initialization, and destruction
|
||||
-: 214: // ----------------------------------------------------------------------
|
||||
-: 215:
|
||||
30: 216: ActiveRateGroupComponentBase ::
|
||||
-: 217:#if FW_OBJECT_NAMES == 1
|
||||
-: 218: ActiveRateGroupComponentBase(const char* compName) :
|
||||
30: 219: Fw::ActiveComponentBase(compName)
|
||||
-: 220:#else
|
||||
-: 221: ActiveRateGroupComponentBase() :
|
||||
-: 222: Fw::ActiveComponentBase()
|
||||
-: 223:#endif
|
||||
-: 224: {
|
||||
-: 225:
|
||||
-: 226: // Initialize telemetry channel RgMaxTime
|
||||
30: 227: this->m_first_update_RgMaxTime = true;
|
||||
30: 228: this->m_last_RgMaxTime = 0;
|
||||
-: 229:
|
||||
-: 230: // Initialize telemetry channel RgCycleSlips
|
||||
30: 231: this->m_first_update_RgCycleSlips = true;
|
||||
30: 232: this->m_last_RgCycleSlips = 0;
|
||||
-: 233:
|
||||
30: 234: }
|
||||
-: 235:
|
||||
30: 236: void ActiveRateGroupComponentBase ::
|
||||
-: 237: init(
|
||||
-: 238: NATIVE_INT_TYPE queueDepth,
|
||||
-: 239: NATIVE_INT_TYPE instance
|
||||
-: 240: )
|
||||
-: 241: {
|
||||
-: 242:
|
||||
-: 243: // Initialize base class
|
||||
30: 244: Fw::ActiveComponentBase::init(instance);
|
||||
-: 245:
|
||||
-: 246: // Connect input port CycleIn
|
||||
120: 247: for (
|
||||
30: 248: NATIVE_INT_TYPE port = 0;
|
||||
60: 249: port < this->getNum_CycleIn_InputPorts();
|
||||
-: 250: port++
|
||||
-: 251: ) {
|
||||
-: 252:
|
||||
30: 253: this->m_CycleIn_InputPort[port].init();
|
||||
-: 254: this->m_CycleIn_InputPort[port].addCallComp(
|
||||
-: 255: this,
|
||||
-: 256: m_p_CycleIn_in
|
||||
30: 257: );
|
||||
30: 258: this->m_CycleIn_InputPort[port].setPortNum(port);
|
||||
-: 259:
|
||||
-: 260:#if FW_OBJECT_NAMES == 1
|
||||
-: 261: char portName[80];
|
||||
-: 262: (void) snprintf(
|
||||
-: 263: portName,
|
||||
-: 264: sizeof(portName),
|
||||
-: 265: "%s_CycleIn_InputPort[%d]",
|
||||
-: 266: this->m_objName,
|
||||
-: 267: port
|
||||
30: 268: );
|
||||
30: 269: this->m_CycleIn_InputPort[port].setObjName(portName);
|
||||
-: 270:#endif
|
||||
-: 271:
|
||||
-: 272: }
|
||||
-: 273:
|
||||
-: 274: // Initialize output port RateGroupMemberOut
|
||||
360: 275: for (
|
||||
30: 276: NATIVE_INT_TYPE port = 0;
|
||||
180: 277: port < this->getNum_RateGroupMemberOut_OutputPorts();
|
||||
-: 278: port++
|
||||
-: 279: ) {
|
||||
150: 280: this->m_RateGroupMemberOut_OutputPort[port].init();
|
||||
-: 281:
|
||||
-: 282:#if FW_OBJECT_NAMES == 1
|
||||
-: 283: char portName[80];
|
||||
-: 284: (void) snprintf(
|
||||
-: 285: portName,
|
||||
-: 286: sizeof(portName),
|
||||
-: 287: "%s_RateGroupMemberOut_OutputPort[%d]",
|
||||
-: 288: this->m_objName,
|
||||
-: 289: port
|
||||
150: 290: );
|
||||
150: 291: this->m_RateGroupMemberOut_OutputPort[port].setObjName(portName);
|
||||
-: 292:#endif
|
||||
-: 293:
|
||||
-: 294: }
|
||||
-: 295:
|
||||
-: 296: // Initialize output port Tlm
|
||||
120: 297: for (
|
||||
30: 298: NATIVE_INT_TYPE port = 0;
|
||||
60: 299: port < this->getNum_Tlm_OutputPorts();
|
||||
-: 300: port++
|
||||
-: 301: ) {
|
||||
30: 302: this->m_Tlm_OutputPort[port].init();
|
||||
-: 303:
|
||||
-: 304:#if FW_OBJECT_NAMES == 1
|
||||
-: 305: char portName[80];
|
||||
-: 306: (void) snprintf(
|
||||
-: 307: portName,
|
||||
-: 308: sizeof(portName),
|
||||
-: 309: "%s_Tlm_OutputPort[%d]",
|
||||
-: 310: this->m_objName,
|
||||
-: 311: port
|
||||
30: 312: );
|
||||
30: 313: this->m_Tlm_OutputPort[port].setObjName(portName);
|
||||
-: 314:#endif
|
||||
-: 315:
|
||||
-: 316: }
|
||||
-: 317:
|
||||
-: 318: // Initialize output port Time
|
||||
120: 319: for (
|
||||
30: 320: NATIVE_INT_TYPE port = 0;
|
||||
60: 321: port < this->getNum_Time_OutputPorts();
|
||||
-: 322: port++
|
||||
-: 323: ) {
|
||||
30: 324: this->m_Time_OutputPort[port].init();
|
||||
-: 325:
|
||||
-: 326:#if FW_OBJECT_NAMES == 1
|
||||
-: 327: char portName[80];
|
||||
-: 328: (void) snprintf(
|
||||
-: 329: portName,
|
||||
-: 330: sizeof(portName),
|
||||
-: 331: "%s_Time_OutputPort[%d]",
|
||||
-: 332: this->m_objName,
|
||||
-: 333: port
|
||||
30: 334: );
|
||||
30: 335: this->m_Time_OutputPort[port].setObjName(portName);
|
||||
-: 336:#endif
|
||||
-: 337:
|
||||
-: 338: }
|
||||
-: 339:
|
||||
-: 340: // Initialize output port Log
|
||||
120: 341: for (
|
||||
30: 342: NATIVE_INT_TYPE port = 0;
|
||||
60: 343: port < this->getNum_Log_OutputPorts();
|
||||
-: 344: port++
|
||||
-: 345: ) {
|
||||
30: 346: this->m_Log_OutputPort[port].init();
|
||||
-: 347:
|
||||
-: 348:#if FW_OBJECT_NAMES == 1
|
||||
-: 349: char portName[80];
|
||||
-: 350: (void) snprintf(
|
||||
-: 351: portName,
|
||||
-: 352: sizeof(portName),
|
||||
-: 353: "%s_Log_OutputPort[%d]",
|
||||
-: 354: this->m_objName,
|
||||
-: 355: port
|
||||
30: 356: );
|
||||
30: 357: this->m_Log_OutputPort[port].setObjName(portName);
|
||||
-: 358:#endif
|
||||
-: 359:
|
||||
-: 360: }
|
||||
-: 361:
|
||||
-: 362: // Initialize output port LogText
|
||||
-: 363:#if FW_ENABLE_TEXT_LOGGING == 1
|
||||
120: 364: for (
|
||||
30: 365: NATIVE_INT_TYPE port = 0;
|
||||
60: 366: port < this->getNum_LogText_OutputPorts();
|
||||
-: 367: port++
|
||||
-: 368: ) {
|
||||
30: 369: this->m_LogText_OutputPort[port].init();
|
||||
-: 370:
|
||||
-: 371:#if FW_OBJECT_NAMES == 1
|
||||
-: 372: char portName[80];
|
||||
-: 373: (void) snprintf(
|
||||
-: 374: portName,
|
||||
-: 375: sizeof(portName),
|
||||
-: 376: "%s_LogText_OutputPort[%d]",
|
||||
-: 377: this->m_objName,
|
||||
-: 378: port
|
||||
30: 379: );
|
||||
30: 380: this->m_LogText_OutputPort[port].setObjName(portName);
|
||||
-: 381:#endif
|
||||
-: 382:
|
||||
-: 383: }
|
||||
-: 384:#endif
|
||||
-: 385:
|
||||
-: 386: Os::Queue::QueueStatus qStat =
|
||||
-: 387: this->createQueue(
|
||||
-: 388: queueDepth,
|
||||
-: 389: ComponentIpcSerializableBuffer::SERIALIZATION_SIZE
|
||||
30: 390: );
|
||||
30: 391: FW_ASSERT(
|
||||
-: 392: Os::Queue::QUEUE_OK == qStat,
|
||||
-: 393: static_cast<NATIVE_INT_TYPE>(qStat)
|
||||
60: 394: );
|
||||
-: 395:
|
||||
30: 396: }
|
||||
-: 397:
|
||||
30: 398: ActiveRateGroupComponentBase::
|
||||
30: 399: ~ActiveRateGroupComponentBase() {
|
||||
-: 400:
|
||||
30: 401: }
|
||||
-: 402:
|
||||
-: 403: // ----------------------------------------------------------------------
|
||||
-: 404: // Invocation functions for output ports
|
||||
-: 405: // ----------------------------------------------------------------------
|
||||
-: 406:
|
||||
675: 407: void ActiveRateGroupComponentBase ::
|
||||
-: 408: RateGroupMemberOut_out(
|
||||
-: 409: NATIVE_INT_TYPE portNum,
|
||||
-: 410: NATIVE_UINT_TYPE context
|
||||
-: 411: )
|
||||
-: 412: {
|
||||
675: 413: FW_ASSERT(portNum < this->getNum_RateGroupMemberOut_OutputPorts());
|
||||
675: 414: m_RateGroupMemberOut_OutputPort[portNum].invoke(context);
|
||||
675: 415: }
|
||||
-: 416:
|
||||
-: 417: // ----------------------------------------------------------------------
|
||||
-: 418: // Getters for numbers of ports
|
||||
-: 419: // ----------------------------------------------------------------------
|
||||
-: 420:
|
||||
330: 421: NATIVE_INT_TYPE ActiveRateGroupComponentBase ::
|
||||
-: 422: getNum_CycleIn_InputPorts(void)
|
||||
-: 423: {
|
||||
330: 424: return (NATIVE_INT_TYPE) FW_NUM_ARRAY_ELEMENTS(
|
||||
-: 425: this->m_CycleIn_InputPort
|
||||
-: 426: );
|
||||
-: 427: }
|
||||
-: 428:
|
||||
2730: 429: NATIVE_INT_TYPE ActiveRateGroupComponentBase ::
|
||||
-: 430: getNum_RateGroupMemberOut_OutputPorts(void)
|
||||
-: 431: {
|
||||
2730: 432: return (NATIVE_INT_TYPE) FW_NUM_ARRAY_ELEMENTS(
|
||||
-: 433: this->m_RateGroupMemberOut_OutputPort
|
||||
-: 434: );
|
||||
-: 435: }
|
||||
-: 436:
|
||||
90: 437: NATIVE_INT_TYPE ActiveRateGroupComponentBase ::
|
||||
-: 438: getNum_Tlm_OutputPorts(void)
|
||||
-: 439: {
|
||||
90: 440: return (NATIVE_INT_TYPE) FW_NUM_ARRAY_ELEMENTS(
|
||||
-: 441: this->m_Tlm_OutputPort
|
||||
-: 442: );
|
||||
-: 443: }
|
||||
-: 444:
|
||||
90: 445: NATIVE_INT_TYPE ActiveRateGroupComponentBase ::
|
||||
-: 446: getNum_Time_OutputPorts(void)
|
||||
-: 447: {
|
||||
90: 448: return (NATIVE_INT_TYPE) FW_NUM_ARRAY_ELEMENTS(
|
||||
-: 449: this->m_Time_OutputPort
|
||||
-: 450: );
|
||||
-: 451: }
|
||||
-: 452:
|
||||
90: 453: NATIVE_INT_TYPE ActiveRateGroupComponentBase ::
|
||||
-: 454: getNum_Log_OutputPorts(void)
|
||||
-: 455: {
|
||||
90: 456: return (NATIVE_INT_TYPE) FW_NUM_ARRAY_ELEMENTS(
|
||||
-: 457: this->m_Log_OutputPort
|
||||
-: 458: );
|
||||
-: 459: }
|
||||
-: 460:
|
||||
-: 461:#if FW_ENABLE_TEXT_LOGGING == 1
|
||||
90: 462: NATIVE_INT_TYPE ActiveRateGroupComponentBase ::
|
||||
-: 463: getNum_LogText_OutputPorts(void)
|
||||
-: 464: {
|
||||
90: 465: return (NATIVE_INT_TYPE) FW_NUM_ARRAY_ELEMENTS(
|
||||
-: 466: this->m_LogText_OutputPort
|
||||
-: 467: );
|
||||
-: 468: }
|
||||
-: 469:#endif
|
||||
-: 470:
|
||||
-: 471: // ----------------------------------------------------------------------
|
||||
-: 472: // Port connection status queries
|
||||
-: 473: // ----------------------------------------------------------------------
|
||||
-: 474:
|
||||
675: 475: bool ActiveRateGroupComponentBase ::
|
||||
-: 476: isConnected_RateGroupMemberOut_OutputPort(NATIVE_INT_TYPE portNum)
|
||||
-: 477: {
|
||||
1350: 478: FW_ASSERT(
|
||||
-: 479: portNum < this->getNum_RateGroupMemberOut_OutputPorts(),
|
||||
-: 480: portNum
|
||||
1350: 481: );
|
||||
675: 482: return this->m_RateGroupMemberOut_OutputPort[portNum].isConnected();
|
||||
-: 483: }
|
||||
-: 484:
|
||||
#####: 485: bool ActiveRateGroupComponentBase ::
|
||||
-: 486: isConnected_Tlm_OutputPort(NATIVE_INT_TYPE portNum)
|
||||
-: 487: {
|
||||
#####: 488: FW_ASSERT(
|
||||
-: 489: portNum < this->getNum_Tlm_OutputPorts(),
|
||||
-: 490: portNum
|
||||
#####: 491: );
|
||||
#####: 492: return this->m_Tlm_OutputPort[portNum].isConnected();
|
||||
-: 493: }
|
||||
-: 494:
|
||||
#####: 495: bool ActiveRateGroupComponentBase ::
|
||||
-: 496: isConnected_Time_OutputPort(NATIVE_INT_TYPE portNum)
|
||||
-: 497: {
|
||||
#####: 498: FW_ASSERT(
|
||||
-: 499: portNum < this->getNum_Time_OutputPorts(),
|
||||
-: 500: portNum
|
||||
#####: 501: );
|
||||
#####: 502: return this->m_Time_OutputPort[portNum].isConnected();
|
||||
-: 503: }
|
||||
-: 504:
|
||||
#####: 505: bool ActiveRateGroupComponentBase ::
|
||||
-: 506: isConnected_Log_OutputPort(NATIVE_INT_TYPE portNum)
|
||||
-: 507: {
|
||||
#####: 508: FW_ASSERT(
|
||||
-: 509: portNum < this->getNum_Log_OutputPorts(),
|
||||
-: 510: portNum
|
||||
#####: 511: );
|
||||
#####: 512: return this->m_Log_OutputPort[portNum].isConnected();
|
||||
-: 513: }
|
||||
-: 514:
|
||||
-: 515:#if FW_ENABLE_TEXT_LOGGING == 1
|
||||
#####: 516: bool ActiveRateGroupComponentBase ::
|
||||
-: 517: isConnected_LogText_OutputPort(NATIVE_INT_TYPE portNum)
|
||||
-: 518: {
|
||||
#####: 519: FW_ASSERT(
|
||||
-: 520: portNum < this->getNum_LogText_OutputPorts(),
|
||||
-: 521: portNum
|
||||
#####: 522: );
|
||||
#####: 523: return this->m_LogText_OutputPort[portNum].isConnected();
|
||||
-: 524: }
|
||||
-: 525:#endif
|
||||
-: 526:
|
||||
-: 527: // ----------------------------------------------------------------------
|
||||
-: 528: // Telemetry write functions
|
||||
-: 529: // ----------------------------------------------------------------------
|
||||
-: 530:
|
||||
135: 531: void ActiveRateGroupComponentBase ::
|
||||
-: 532: tlmWrite_RgMaxTime(U32& arg)
|
||||
-: 533: {
|
||||
-: 534:
|
||||
-: 535: // Check to see if it is the first time
|
||||
135: 536: if (not this->m_first_update_RgMaxTime) {
|
||||
-: 537: // Check to see if value has changed. If not, don't write it.
|
||||
105: 538: if (arg == this->m_last_RgMaxTime) {
|
||||
180: 539: return;
|
||||
-: 540: } else {
|
||||
60: 541: this->m_last_RgMaxTime = arg;
|
||||
-: 542: }
|
||||
-: 543: }
|
||||
-: 544: else {
|
||||
30: 545: this->m_first_update_RgMaxTime = false;
|
||||
30: 546: this->m_last_RgMaxTime = arg;
|
||||
-: 547: }
|
||||
-: 548:
|
||||
90: 549: if (this->m_Tlm_OutputPort[0].isConnected()) {
|
||||
90: 550: Fw::Time _timeTag = this->getTime();
|
||||
180: 551: Fw::TlmBuffer _tlmBuff;
|
||||
90: 552: Fw::SerializeStatus _stat = _tlmBuff.serialize(arg);
|
||||
90: 553: FW_ASSERT(
|
||||
-: 554: _stat == Fw::FW_SERIALIZE_OK,
|
||||
-: 555: static_cast<NATIVE_INT_TYPE>(_stat)
|
||||
180: 556: );
|
||||
-: 557:
|
||||
-: 558: FwChanIdType _id;
|
||||
-: 559:
|
||||
90: 560: switch (this->getInstance()) {
|
||||
-: 561: case 0:
|
||||
30: 562: _id = CHANNELID_RGMAXTIME_0;
|
||||
30: 563: break;
|
||||
-: 564: case 1:
|
||||
30: 565: _id = CHANNELID_RGMAXTIME_1;
|
||||
30: 566: break;
|
||||
-: 567: case 2:
|
||||
30: 568: _id = CHANNELID_RGMAXTIME_2;
|
||||
30: 569: break;
|
||||
-: 570: default:
|
||||
#####: 571: FW_ASSERT(0,this->getInstance());
|
||||
#####: 572: break;
|
||||
-: 573: }
|
||||
-: 574:
|
||||
-: 575: this->m_Tlm_OutputPort[0].invoke(
|
||||
-: 576: _id,
|
||||
-: 577: _timeTag,
|
||||
-: 578: _tlmBuff
|
||||
180: 579: );
|
||||
-: 580: }
|
||||
-: 581:
|
||||
-: 582: }
|
||||
-: 583:
|
||||
105: 584: void ActiveRateGroupComponentBase ::
|
||||
-: 585: tlmWrite_RgCycleSlips(U32& arg)
|
||||
-: 586: {
|
||||
-: 587:
|
||||
-: 588: // Check to see if it is the first time
|
||||
105: 589: if (not this->m_first_update_RgCycleSlips) {
|
||||
-: 590: // Check to see if value has changed. If not, don't write it.
|
||||
90: 591: if (arg == this->m_last_RgCycleSlips) {
|
||||
105: 592: return;
|
||||
-: 593: } else {
|
||||
90: 594: this->m_last_RgCycleSlips = arg;
|
||||
-: 595: }
|
||||
-: 596: }
|
||||
-: 597: else {
|
||||
15: 598: this->m_first_update_RgCycleSlips = false;
|
||||
15: 599: this->m_last_RgCycleSlips = arg;
|
||||
-: 600: }
|
||||
-: 601:
|
||||
105: 602: if (this->m_Tlm_OutputPort[0].isConnected()) {
|
||||
105: 603: Fw::Time _timeTag = this->getTime();
|
||||
210: 604: Fw::TlmBuffer _tlmBuff;
|
||||
105: 605: Fw::SerializeStatus _stat = _tlmBuff.serialize(arg);
|
||||
105: 606: FW_ASSERT(
|
||||
-: 607: _stat == Fw::FW_SERIALIZE_OK,
|
||||
-: 608: static_cast<NATIVE_INT_TYPE>(_stat)
|
||||
210: 609: );
|
||||
-: 610:
|
||||
-: 611: FwChanIdType _id;
|
||||
-: 612:
|
||||
105: 613: switch (this->getInstance()) {
|
||||
-: 614: case 0:
|
||||
35: 615: _id = CHANNELID_RGCYCLESLIPS_0;
|
||||
35: 616: break;
|
||||
-: 617: case 1:
|
||||
35: 618: _id = CHANNELID_RGCYCLESLIPS_1;
|
||||
35: 619: break;
|
||||
-: 620: case 2:
|
||||
35: 621: _id = CHANNELID_RGCYCLESLIPS_2;
|
||||
35: 622: break;
|
||||
-: 623: default:
|
||||
#####: 624: FW_ASSERT(0,this->getInstance());
|
||||
#####: 625: break;
|
||||
-: 626: }
|
||||
-: 627:
|
||||
-: 628: this->m_Tlm_OutputPort[0].invoke(
|
||||
-: 629: _id,
|
||||
-: 630: _timeTag,
|
||||
-: 631: _tlmBuff
|
||||
210: 632: );
|
||||
-: 633: }
|
||||
-: 634:
|
||||
-: 635: }
|
||||
-: 636:
|
||||
-: 637: // ----------------------------------------------------------------------
|
||||
-: 638: // Time
|
||||
-: 639: // ----------------------------------------------------------------------
|
||||
-: 640:
|
||||
195: 641: Fw::Time ActiveRateGroupComponentBase ::
|
||||
-: 642: getTime(void)
|
||||
-: 643: {
|
||||
195: 644: if (this->m_Time_OutputPort[0].isConnected()) {
|
||||
195: 645: return this->m_Time_OutputPort[0].invoke();
|
||||
-: 646: } else {
|
||||
#####: 647: return Fw::Time(TB_NONE,0,0);
|
||||
-: 648: }
|
||||
-: 649: }
|
||||
-: 650:
|
||||
-: 651: // ----------------------------------------------------------------------
|
||||
-: 652: // Event handling functions
|
||||
-: 653: // ----------------------------------------------------------------------
|
||||
-: 654:
|
||||
30: 655: void ActiveRateGroupComponentBase ::
|
||||
-: 656: log_DIAGNOSTIC_RateGroupStarted(
|
||||
-: 657: void
|
||||
-: 658: )
|
||||
-: 659: {
|
||||
-: 660:
|
||||
-: 661: // Get the time
|
||||
30: 662: Fw::Time _logTime;
|
||||
30: 663: if (this->m_Time_OutputPort[0].isConnected()) {
|
||||
30: 664: _logTime = this->m_Time_OutputPort[0].invoke();
|
||||
-: 665: }
|
||||
-: 666:
|
||||
-: 667: FwEventIdType _id;
|
||||
-: 668:
|
||||
30: 669: switch (this->getInstance()) {
|
||||
-: 670: case 0:
|
||||
10: 671: _id = EVENTID_RATEGROUPSTARTED_0;
|
||||
10: 672: break;
|
||||
-: 673: case 1:
|
||||
10: 674: _id = EVENTID_RATEGROUPSTARTED_1;
|
||||
10: 675: break;
|
||||
-: 676: case 2:
|
||||
10: 677: _id = EVENTID_RATEGROUPSTARTED_2;
|
||||
10: 678: break;
|
||||
-: 679: default:
|
||||
#####: 680: FW_ASSERT(0,this->getInstance());
|
||||
#####: 681: break;
|
||||
-: 682: };
|
||||
-: 683:
|
||||
-: 684: // Emit the event on the log port
|
||||
30: 685: if (this->m_Log_OutputPort[0].isConnected()) {
|
||||
-: 686:
|
||||
30: 687: Fw::LogBuffer _logBuff;
|
||||
-: 688:
|
||||
-: 689:
|
||||
-: 690: this->m_Log_OutputPort[0].invoke(
|
||||
-: 691: _id,
|
||||
-: 692: _logTime,Fw::LOG_DIAGNOSTIC,
|
||||
-: 693: _logBuff
|
||||
30: 694: );
|
||||
-: 695:
|
||||
-: 696: }
|
||||
-: 697:
|
||||
-: 698: // Emit the event on the text log port
|
||||
-: 699:#if FW_ENABLE_TEXT_LOGGING
|
||||
30: 700: if (this->m_LogText_OutputPort[0].isConnected()) {
|
||||
-: 701:
|
||||
-: 702:#if FW_OBJECT_NAMES == 1
|
||||
-: 703: const char* _formatString =
|
||||
30: 704: "(%s) %s: Rate group started.";
|
||||
-: 705:#else
|
||||
-: 706: const char* _formatString =
|
||||
-: 707: "%s: Rate group started.";
|
||||
-: 708:#endif
|
||||
-: 709:
|
||||
-: 710: char _textBuffer[FW_LOG_TEXT_BUFFER_SIZE];
|
||||
-: 711:
|
||||
-: 712: (void) snprintf(
|
||||
-: 713: _textBuffer,
|
||||
-: 714: FW_LOG_TEXT_BUFFER_SIZE,
|
||||
-: 715: _formatString,
|
||||
-: 716:#if FW_OBJECT_NAMES == 1
|
||||
-: 717: this->m_objName,
|
||||
-: 718:#endif
|
||||
-: 719: "RateGroupStarted "
|
||||
30: 720: );
|
||||
-: 721:
|
||||
-: 722: // Null terminate
|
||||
30: 723: _textBuffer[FW_LOG_TEXT_BUFFER_SIZE-1] = 0;
|
||||
30: 724: Fw::TextLogString _logString = _textBuffer;
|
||||
-: 725: this->m_LogText_OutputPort[0].invoke(
|
||||
-: 726: _id,
|
||||
-: 727: _logTime,Fw::TEXT_LOG_DIAGNOSTIC,
|
||||
-: 728: _logString
|
||||
30: 729: );
|
||||
-: 730:
|
||||
30: 731: }
|
||||
-: 732:#endif
|
||||
-: 733:
|
||||
30: 734: }
|
||||
-: 735:
|
||||
90: 736: void ActiveRateGroupComponentBase ::
|
||||
-: 737: log_WARNING_HI_RateGroupCycleSlip(
|
||||
-: 738: U32 cycle
|
||||
-: 739: )
|
||||
-: 740: {
|
||||
-: 741:
|
||||
-: 742: // Get the time
|
||||
90: 743: Fw::Time _logTime;
|
||||
90: 744: if (this->m_Time_OutputPort[0].isConnected()) {
|
||||
90: 745: _logTime = this->m_Time_OutputPort[0].invoke();
|
||||
-: 746: }
|
||||
-: 747:
|
||||
-: 748: FwEventIdType _id;
|
||||
-: 749:
|
||||
90: 750: switch (this->getInstance()) {
|
||||
-: 751: case 0:
|
||||
30: 752: _id = EVENTID_RATEGROUPCYCLESLIP_0;
|
||||
30: 753: break;
|
||||
-: 754: case 1:
|
||||
30: 755: _id = EVENTID_RATEGROUPCYCLESLIP_1;
|
||||
30: 756: break;
|
||||
-: 757: case 2:
|
||||
30: 758: _id = EVENTID_RATEGROUPCYCLESLIP_2;
|
||||
30: 759: break;
|
||||
-: 760: default:
|
||||
#####: 761: FW_ASSERT(0,this->getInstance());
|
||||
#####: 762: break;
|
||||
-: 763: };
|
||||
-: 764:
|
||||
-: 765: // Emit the event on the log port
|
||||
90: 766: if (this->m_Log_OutputPort[0].isConnected()) {
|
||||
-: 767:
|
||||
90: 768: Fw::LogBuffer _logBuff;
|
||||
-: 769: Fw::SerializeStatus _status;
|
||||
-: 770:
|
||||
-: 771:#if FW_AMPCS_COMPATIBLE
|
||||
-: 772: // Serialize the number of arguments
|
||||
-: 773: _status = _logBuff.serialize(static_cast<U8>(1));
|
||||
-: 774: FW_ASSERT(
|
||||
-: 775: _status == Fw::FW_SERIALIZE_OK,
|
||||
-: 776: static_cast<NATIVE_INT_TYPE>(_status)
|
||||
-: 777: );
|
||||
-: 778:#endif
|
||||
-: 779:
|
||||
-: 780:#if FW_AMPCS_COMPATIBLE
|
||||
-: 781: // Serialize the argument size
|
||||
-: 782: _status = _logBuff.serialize(
|
||||
-: 783: static_cast<U8>(sizeof(cycle))
|
||||
-: 784: );
|
||||
-: 785: FW_ASSERT(
|
||||
-: 786: _status == Fw::FW_SERIALIZE_OK,
|
||||
-: 787: static_cast<NATIVE_INT_TYPE>(_status)
|
||||
-: 788: );
|
||||
-: 789:#endif
|
||||
-: 790:
|
||||
90: 791: _status = _logBuff.serialize(cycle);
|
||||
90: 792: FW_ASSERT(
|
||||
-: 793: _status == Fw::FW_SERIALIZE_OK,
|
||||
-: 794: static_cast<NATIVE_INT_TYPE>(_status)
|
||||
180: 795: );
|
||||
-: 796:
|
||||
-: 797:
|
||||
-: 798: this->m_Log_OutputPort[0].invoke(
|
||||
-: 799: _id,
|
||||
-: 800: _logTime,Fw::LOG_WARNING_HI,
|
||||
-: 801: _logBuff
|
||||
90: 802: );
|
||||
-: 803:
|
||||
-: 804: }
|
||||
-: 805:
|
||||
-: 806: // Emit the event on the text log port
|
||||
-: 807:#if FW_ENABLE_TEXT_LOGGING
|
||||
90: 808: if (this->m_LogText_OutputPort[0].isConnected()) {
|
||||
-: 809:
|
||||
-: 810:#if FW_OBJECT_NAMES == 1
|
||||
-: 811: const char* _formatString =
|
||||
90: 812: "(%s) %s: Rate group cycle slipped on cycle %d";
|
||||
-: 813:#else
|
||||
-: 814: const char* _formatString =
|
||||
-: 815: "%s: Rate group cycle slipped on cycle %d";
|
||||
-: 816:#endif
|
||||
-: 817:
|
||||
-: 818: char _textBuffer[FW_LOG_TEXT_BUFFER_SIZE];
|
||||
-: 819:
|
||||
-: 820: (void) snprintf(
|
||||
-: 821: _textBuffer,
|
||||
-: 822: FW_LOG_TEXT_BUFFER_SIZE,
|
||||
-: 823: _formatString,
|
||||
-: 824:#if FW_OBJECT_NAMES == 1
|
||||
-: 825: this->m_objName,
|
||||
-: 826:#endif
|
||||
-: 827: "RateGroupCycleSlip "
|
||||
-: 828: , cycle
|
||||
90: 829: );
|
||||
-: 830:
|
||||
-: 831: // Null terminate
|
||||
90: 832: _textBuffer[FW_LOG_TEXT_BUFFER_SIZE-1] = 0;
|
||||
90: 833: Fw::TextLogString _logString = _textBuffer;
|
||||
-: 834: this->m_LogText_OutputPort[0].invoke(
|
||||
-: 835: _id,
|
||||
-: 836: _logTime,Fw::TEXT_LOG_WARNING_HI,
|
||||
-: 837: _logString
|
||||
90: 838: );
|
||||
-: 839:
|
||||
90: 840: }
|
||||
-: 841:#endif
|
||||
-: 842:
|
||||
90: 843: }
|
||||
-: 844:
|
||||
-: 845: // ----------------------------------------------------------------------
|
||||
-: 846: // Calls for messages received on typed input ports
|
||||
-: 847: // ----------------------------------------------------------------------
|
||||
-: 848:
|
||||
240: 849: void ActiveRateGroupComponentBase ::
|
||||
-: 850: m_p_CycleIn_in(
|
||||
-: 851: Fw::PassiveComponentBase* callComp,
|
||||
-: 852: NATIVE_INT_TYPE portNum,
|
||||
-: 853: Svc::TimerVal cycle_start
|
||||
-: 854: )
|
||||
-: 855: {
|
||||
240: 856: FW_ASSERT(callComp);
|
||||
-: 857: ActiveRateGroupComponentBase* compPtr =
|
||||
240: 858: (ActiveRateGroupComponentBase*) callComp;
|
||||
240: 859: compPtr->CycleIn_handlerBase(portNum, cycle_start);
|
||||
240: 860: }
|
||||
-: 861:
|
||||
-: 862: // ----------------------------------------------------------------------
|
||||
-: 863: // Port handler base-class functions for typed input ports
|
||||
-: 864: // ----------------------------------------------------------------------
|
||||
-: 865:
|
||||
240: 866: void ActiveRateGroupComponentBase ::
|
||||
-: 867: CycleIn_handlerBase(
|
||||
-: 868: NATIVE_INT_TYPE portNum,
|
||||
-: 869: Svc::TimerVal cycle_start
|
||||
-: 870: )
|
||||
-: 871: {
|
||||
-: 872:
|
||||
-: 873: // Make sure port number is valid
|
||||
240: 874: FW_ASSERT(portNum < this->getNum_CycleIn_InputPorts());
|
||||
-: 875:
|
||||
-: 876: // Call pre-message hook
|
||||
-: 877: CycleIn_preMsgHook(
|
||||
-: 878: portNum,
|
||||
-: 879: cycle_start
|
||||
240: 880: );
|
||||
-: 881:
|
||||
240: 882: ComponentIpcSerializableBuffer msg;
|
||||
-: 883: Fw::SerializeStatus _status;
|
||||
-: 884:
|
||||
-: 885: _status = msg.serialize(
|
||||
-: 886: static_cast<NATIVE_INT_TYPE>(CYCLEIN_CYCLE)
|
||||
240: 887: );
|
||||
240: 888: FW_ASSERT (
|
||||
-: 889: _status == Fw::FW_SERIALIZE_OK,
|
||||
-: 890: static_cast<NATIVE_INT_TYPE>(_status)
|
||||
480: 891: );
|
||||
-: 892:
|
||||
240: 893: _status = msg.serialize(portNum);
|
||||
240: 894: FW_ASSERT (
|
||||
-: 895: _status == Fw::FW_SERIALIZE_OK,
|
||||
-: 896: static_cast<NATIVE_INT_TYPE>(_status)
|
||||
480: 897: );
|
||||
-: 898:
|
||||
-: 899: // Serialize argument cycle_start
|
||||
240: 900: _status = msg.serialize(cycle_start);
|
||||
240: 901: FW_ASSERT(
|
||||
-: 902: _status == Fw::FW_SERIALIZE_OK,
|
||||
-: 903: static_cast<NATIVE_INT_TYPE>(_status)
|
||||
480: 904: );
|
||||
-: 905:
|
||||
-: 906: Os::Queue::QueueStatus qStatus =
|
||||
240: 907: this->m_queue.send(msg, 0);
|
||||
240: 908: FW_ASSERT(
|
||||
-: 909: qStatus == Os::Queue::QUEUE_OK,
|
||||
-: 910: static_cast<NATIVE_INT_TYPE>(qStatus)
|
||||
720: 911: );
|
||||
240: 912: }
|
||||
-: 913:
|
||||
-: 914: // ----------------------------------------------------------------------
|
||||
-: 915: // Pre-message hooks for async input ports
|
||||
-: 916: // ----------------------------------------------------------------------
|
||||
-: 917:
|
||||
#####: 918: void ActiveRateGroupComponentBase ::
|
||||
-: 919: CycleIn_preMsgHook(
|
||||
-: 920: NATIVE_INT_TYPE portNum,
|
||||
-: 921: Svc::TimerVal cycle_start
|
||||
-: 922: )
|
||||
-: 923: {
|
||||
-: 924: // Default: no-op
|
||||
#####: 925: }
|
||||
-: 926:
|
||||
-: 927: // ----------------------------------------------------------------------
|
||||
-: 928: // Message dispatch method for active and queued components. Called
|
||||
-: 929: // by active component thread or implementation code for queued components
|
||||
-: 930: // ----------------------------------------------------------------------
|
||||
-: 931:
|
||||
135: 932: Fw::QueuedComponentBase::MsgDispatchStatus ActiveRateGroupComponentBase ::
|
||||
-: 933: doDispatch(void)
|
||||
-: 934: {
|
||||
-: 935:
|
||||
135: 936: ComponentIpcSerializableBuffer msg;
|
||||
-: 937: NATIVE_INT_TYPE priority;
|
||||
-: 938:
|
||||
135: 939: Os::Queue::QueueStatus msgStatus = this->m_queue.receive(msg,priority);
|
||||
135: 940: FW_ASSERT(
|
||||
-: 941: msgStatus == Os::Queue::QUEUE_OK,
|
||||
-: 942: static_cast<NATIVE_INT_TYPE>(msgStatus)
|
||||
270: 943: );
|
||||
-: 944:
|
||||
-: 945: // Reset to beginning of buffer
|
||||
135: 946: msg.resetDeser();
|
||||
-: 947:
|
||||
-: 948: NATIVE_INT_TYPE desMsg;
|
||||
135: 949: Fw::SerializeStatus deserStatus = msg.deserialize(desMsg);
|
||||
135: 950: FW_ASSERT(
|
||||
-: 951: deserStatus == Fw::FW_SERIALIZE_OK,
|
||||
-: 952: static_cast<NATIVE_INT_TYPE>(deserStatus)
|
||||
270: 953: );
|
||||
-: 954:
|
||||
135: 955: MsgTypeEnum msgType = static_cast<MsgTypeEnum>(desMsg);
|
||||
-: 956:
|
||||
135: 957: if (msgType == ACTIVERATEGROUP_COMPONENT_EXIT) {
|
||||
#####: 958: return MSG_DISPATCH_EXIT;
|
||||
-: 959: }
|
||||
-: 960:
|
||||
-: 961: NATIVE_INT_TYPE portNum;
|
||||
135: 962: deserStatus = msg.deserialize(portNum);
|
||||
135: 963: FW_ASSERT(
|
||||
-: 964: deserStatus == Fw::FW_SERIALIZE_OK,
|
||||
-: 965: static_cast<NATIVE_INT_TYPE>(deserStatus)
|
||||
270: 966: );
|
||||
-: 967:
|
||||
135: 968: switch (msgType) {
|
||||
-: 969:
|
||||
-: 970: // Handle async input port CycleIn
|
||||
-: 971: case CYCLEIN_CYCLE: {
|
||||
-: 972:
|
||||
-: 973: // Deserialize argument cycle_start
|
||||
135: 974: Svc::TimerVal cycle_start;
|
||||
135: 975: deserStatus = msg.deserialize(cycle_start);
|
||||
135: 976: FW_ASSERT(
|
||||
-: 977: deserStatus == Fw::FW_SERIALIZE_OK,
|
||||
-: 978: static_cast<NATIVE_INT_TYPE>(deserStatus)
|
||||
270: 979: );
|
||||
-: 980:
|
||||
-: 981: // Call handler function
|
||||
-: 982: this->CycleIn_handler(
|
||||
-: 983: portNum,
|
||||
-: 984: cycle_start
|
||||
135: 985: );
|
||||
-: 986:
|
||||
135: 987: break;
|
||||
-: 988:
|
||||
-: 989: }
|
||||
-: 990:
|
||||
-: 991: default:
|
||||
#####: 992: return MSG_DISPATCH_ERROR;
|
||||
-: 993:
|
||||
-: 994: }
|
||||
-: 995:
|
||||
270: 996: return MSG_DISPATCH_OK;
|
||||
-: 997:
|
||||
-: 998: }
|
||||
-: 999:
|
||||
-: 1000:}
|
||||
-: 1001:
|
||||
@ -1,109 +0,0 @@
|
||||
-: 0:Source:/home/tcanham/source/isf/Svc/ActiveRateGroup/ActiveRateGroupImpl.cpp
|
||||
-: 0:Programs:10
|
||||
-: 1:/*
|
||||
-: 2:* \author: Tim Canham
|
||||
-: 3:* \file:
|
||||
-: 4:* \brief
|
||||
-: 5:*
|
||||
-: 6:* This file implements the ActiveRateGroup component,
|
||||
-: 7:* which invokes a set of components the comprise the rate group.
|
||||
-: 8:*
|
||||
-: 9:* Copyright 2014-2015, by the California Institute of Technology.
|
||||
-: 10:* ALL RIGHTS RESERVED. United States Government Sponsorship
|
||||
-: 11:* acknowledged.
|
||||
-: 13:*
|
||||
-: 19:*/
|
||||
-: 20:
|
||||
-: 21:#include <Svc/ActiveRateGroup/ActiveRateGroupImpl.hpp>
|
||||
-: 22:#include <ActiveRateGroupImplCfg.hpp>
|
||||
-: 23:#include <Fw/Types/BasicTypes.hpp>
|
||||
-: 24:#include <Fw/Types/Assert.hpp>
|
||||
-: 25:#include <Os/Log.hpp>
|
||||
-: 26:
|
||||
-: 27:namespace Svc {
|
||||
-: 28:
|
||||
-: 29:#if FW_OBJECT_NAMES == 1
|
||||
30: 30: ActiveRateGroupImpl::ActiveRateGroupImpl(const char* compName, NATIVE_UINT_TYPE contexts[], NATIVE_UINT_TYPE numContexts) :
|
||||
-: 31: ActiveRateGroupComponentBase(compName),
|
||||
-: 32:#else
|
||||
-: 33: ActiveRateGroupImpl::ActiveRateGroupImpl(NATIVE_UINT_TYPE contexts[], NATIVE_UINT_TYPE numContexts) :
|
||||
-: 34:#endif
|
||||
30: 35: m_cycles(0), m_maxTime(0),m_cycleStarted(false),m_overrunThrottle(0),m_cycleSlips(0) {
|
||||
30: 36: FW_ASSERT(contexts);
|
||||
30: 37: FW_ASSERT(numContexts == static_cast<NATIVE_UINT_TYPE>(this->getNum_RateGroupMemberOut_OutputPorts()),numContexts,this->getNum_RateGroupMemberOut_OutputPorts());
|
||||
60: 38: FW_ASSERT(FW_NUM_ARRAY_ELEMENTS(this->m_contexts) == this->getNum_RateGroupMemberOut_OutputPorts(),
|
||||
-: 39: static_cast<NATIVE_INT_TYPE>(FW_NUM_ARRAY_ELEMENTS(this->m_contexts)),
|
||||
60: 40: this->getNum_RateGroupMemberOut_OutputPorts());
|
||||
-: 41:
|
||||
-: 42: // copy context values
|
||||
180: 43: for (NATIVE_INT_TYPE entry = 0; entry < this->getNum_RateGroupMemberOut_OutputPorts(); entry++) {
|
||||
150: 44: this->m_contexts[entry] = contexts[entry];
|
||||
-: 45: }
|
||||
30: 46: }
|
||||
-: 47:
|
||||
30: 48: void ActiveRateGroupImpl::init(NATIVE_INT_TYPE queueDepth, NATIVE_INT_TYPE instance) {
|
||||
30: 49: ActiveRateGroupComponentBase::init(queueDepth,instance);
|
||||
30: 50: }
|
||||
-: 51:
|
||||
30: 52: ActiveRateGroupImpl::~ActiveRateGroupImpl(void) {
|
||||
-: 53:
|
||||
30: 54: }
|
||||
-: 55:
|
||||
30: 56: void ActiveRateGroupImpl::preamble(void) {
|
||||
30: 57: this->log_DIAGNOSTIC_RateGroupStarted();
|
||||
30: 58: }
|
||||
-: 59:
|
||||
135: 60: void ActiveRateGroupImpl::CycleIn_handler(NATIVE_INT_TYPE portNum, Svc::TimerVal cycle_start) {
|
||||
-: 61:
|
||||
135: 62: TimerVal end;
|
||||
-: 63:
|
||||
135: 64: this->m_cycleStarted = false;
|
||||
-: 65:
|
||||
-: 66: // invoke any members of the rate group
|
||||
810: 67: for (NATIVE_INT_TYPE port = 0; port < this->getNum_RateGroupMemberOut_OutputPorts(); port++) {
|
||||
675: 68: if (this->isConnected_RateGroupMemberOut_OutputPort(port)) {
|
||||
675: 69: this->RateGroupMemberOut_out(port,this->m_contexts[port]);
|
||||
-: 70: }
|
||||
-: 71: }
|
||||
-: 72:
|
||||
-: 73: // grab timer for end of cycle
|
||||
135: 74: end.take();
|
||||
-: 75:
|
||||
-: 76: // get rate group execution time
|
||||
135: 77: U32 cycle_time = end.diffUSec(cycle_start);
|
||||
-: 78:
|
||||
-: 79: // check to see if the time has exceeded the previous maximum
|
||||
135: 80: if (cycle_time > this->m_maxTime) {
|
||||
90: 81: this->m_maxTime = cycle_time;
|
||||
-: 82: }
|
||||
-: 83:
|
||||
-: 84: // update cycle telemetry
|
||||
135: 85: this->tlmWrite_RgMaxTime(this->m_maxTime);
|
||||
-: 86:
|
||||
-: 87: // check for cycle slip. That will happen if new cycle message has been received
|
||||
-: 88: // which will cause flag will be set again.
|
||||
135: 89: if (this->m_cycleStarted) {
|
||||
105: 90: this->m_cycleSlips++;
|
||||
105: 91: if (this->m_overrunThrottle < ACTIVE_RATE_GROUP_OVERRUN_THROTTLE) {
|
||||
90: 92: this->log_WARNING_HI_RateGroupCycleSlip(this->m_cycles);
|
||||
90: 93: this->m_overrunThrottle++;
|
||||
-: 94: }
|
||||
-: 95: // update cycle cycle slips
|
||||
105: 96: this->tlmWrite_RgCycleSlips(this->m_cycleSlips);
|
||||
-: 97: } else { // if cycle is okay start decrementing throttle value
|
||||
30: 98: if (this->m_overrunThrottle > 0) {
|
||||
15: 99: this->m_overrunThrottle--;
|
||||
-: 100: }
|
||||
-: 101: }
|
||||
-: 102:
|
||||
-: 103: // increment cycle
|
||||
135: 104: this->m_cycles++;
|
||||
-: 105:
|
||||
135: 106: }
|
||||
-: 107:
|
||||
240: 108: void ActiveRateGroupImpl::CycleIn_preMsgHook(NATIVE_INT_TYPE portNum, Svc::TimerVal cycle_start) {
|
||||
-: 109: // set flag to indicate cycle has started. Check in thread for overflow.
|
||||
240: 110: this->m_cycleStarted = true;
|
||||
240: 111: }
|
||||
-: 112:
|
||||
-: 113:}
|
||||
@ -1,13 +0,0 @@
|
||||
File '/home/tcanham/source/isf/Svc/ActiveRateGroup/ActiveRateGroupImpl.cpp'
|
||||
Lines executed:100.00% of 41
|
||||
Creating 'ActiveRateGroupImpl.cpp.gcov'
|
||||
|
||||
File '/home/tcanham/source/isf/Svc/Cycle/TimerVal.hpp'
|
||||
Lines executed:0.00% of 1
|
||||
Creating 'TimerVal.hpp.gcov'
|
||||
|
||||
File '/home/tcanham/source/isf/Svc/ActiveRateGroup/ActiveRateGroupComponentAc.cpp'
|
||||
Lines executed:84.51% of 284
|
||||
Creating 'ActiveRateGroupComponentAc.cpp.gcov'
|
||||
|
||||
Lines executed:86.20% of 326
|
||||
@ -1,161 +0,0 @@
|
||||
Running /home/tcanham/source/isf/Svc/ActiveRateGroup/test/ut/linux-cygwin-x86-ut-gnu-bin/test_ut
|
||||
profiling:/home/tcanham/source/isf/gtest/src/linux-cygwin-x86-ut-gnu-bin/gtest-all.gcda:Version mismatch - expected 504* got 409*
|
||||
[==========] Running 3 tests from 1 test case.
|
||||
[----------] Global test environment set-up.
|
||||
[----------] 3 tests from ActiveRateGroupTest
|
||||
[ RUN ] ActiveRateGroupTest.NominalSchedule
|
||||
|
||||
***************************************
|
||||
TESTCASE 101.1.1: Run nominal rate group execution
|
||||
***************************************
|
||||
|
||||
***************************************
|
||||
(RQ) ISF-ARG-001
|
||||
***************************************
|
||||
|
||||
***************************************
|
||||
(RQ) ISF-ARG-002
|
||||
***************************************
|
||||
|
||||
***************************************
|
||||
(RQ) ISF-ARG-003
|
||||
***************************************
|
||||
|
||||
***************************************
|
||||
TESTCASE 101.1.1: Run nominal rate group execution
|
||||
***************************************
|
||||
|
||||
***************************************
|
||||
(RQ) ISF-ARG-001
|
||||
***************************************
|
||||
|
||||
***************************************
|
||||
(RQ) ISF-ARG-002
|
||||
***************************************
|
||||
|
||||
***************************************
|
||||
(RQ) ISF-ARG-003
|
||||
***************************************
|
||||
|
||||
***************************************
|
||||
TESTCASE 101.1.1: Run nominal rate group execution
|
||||
***************************************
|
||||
|
||||
***************************************
|
||||
(RQ) ISF-ARG-001
|
||||
***************************************
|
||||
|
||||
***************************************
|
||||
(RQ) ISF-ARG-002
|
||||
***************************************
|
||||
|
||||
***************************************
|
||||
(RQ) ISF-ARG-003
|
||||
***************************************
|
||||
[ OK ] ActiveRateGroupTest.NominalSchedule (0 ms)
|
||||
[ RUN ] ActiveRateGroupTest.CycleOverrun
|
||||
|
||||
***************************************
|
||||
TESTCASE 101.2.1: Run cycle slip scenario
|
||||
***************************************
|
||||
|
||||
***************************************
|
||||
(RQ) ISF-ARG-004
|
||||
***************************************
|
||||
|
||||
***************************************
|
||||
(RQ) ISF-ARG-004
|
||||
***************************************
|
||||
|
||||
***************************************
|
||||
(RQ) ISF-ARG-004
|
||||
***************************************
|
||||
|
||||
***************************************
|
||||
profiling:/home/tcanham/source/isf/Svc/ActiveRateGroup/test/ut/linux-cygwin-x86-ut-gnu-bin/ActiveRateGroupTester.gcda:Version mismatch - expected 504* got 409*
|
||||
(RQ) ISF-ARG-004
|
||||
profiling:/home/tcanham/source/isf/Svc/ActiveRateGroup/test/ut/linux-cygwin-x86-ut-gnu-bin/ActiveRateGroupImplTester.gcda:Version mismatch - expected 504* got 409*
|
||||
***************************************
|
||||
profiling:/home/tcanham/source/isf/Svc/ActiveRateGroup/test/ut/linux-cygwin-x86-ut-gnu-bin/TesterBase.gcda:Version mismatch - expected 504* got 409*
|
||||
|
||||
profiling:/home/tcanham/source/isf/Svc/ActiveRateGroup/test/ut/linux-cygwin-x86-ut-gnu-bin/GTestBase.gcda:Version mismatch - expected 504* got 409*
|
||||
***************************************
|
||||
profiling:/home/tcanham/source/isf/Svc/ActiveRateGroup/linux-cygwin-x86-ut-gnu-bin/ActiveRateGroupImpl.gcda:Version mismatch - expected 504* got 409*
|
||||
(RQ) ISF-ARG-004
|
||||
profiling:/home/tcanham/source/isf/Svc/ActiveRateGroup/linux-cygwin-x86-ut-gnu-bin/ActiveRateGroupComponentAc.gcda:Version mismatch - expected 504* got 409*
|
||||
***************************************
|
||||
|
||||
***************************************
|
||||
TESTCASE 101.2.1: Run cycle slip scenario
|
||||
***************************************
|
||||
|
||||
***************************************
|
||||
(RQ) ISF-ARG-004
|
||||
***************************************
|
||||
|
||||
***************************************
|
||||
(RQ) ISF-ARG-004
|
||||
***************************************
|
||||
|
||||
***************************************
|
||||
(RQ) ISF-ARG-004
|
||||
***************************************
|
||||
|
||||
***************************************
|
||||
(RQ) ISF-ARG-004
|
||||
***************************************
|
||||
|
||||
profiling:/home/tcanham/source/isf/Svc/Cycle/linux-cygwin-x86-ut-gnu-bin/TimerVal.gcda:Version mismatch - expected 504* got 409*
|
||||
***************************************
|
||||
profiling:/home/tcanham/source/isf/Svc/Cycle/linux-cygwin-x86-ut-gnu-bin/CyclePortAc.gcda:Version mismatch - expected 504* got 409*
|
||||
(RQ) ISF-ARG-004
|
||||
***************************************
|
||||
|
||||
***************************************
|
||||
TESTCASE 101.2.1: Run cycle slip scenario
|
||||
profiling:/home/tcanham/source/isf/Fw/Tlm/linux-cygwin-x86-ut-gnu-bin/TlmBuffer.gcda:Version mismatch - expected 504* got 409*
|
||||
***************************************
|
||||
profiling:/home/tcanham/source/isf/Fw/Tlm/linux-cygwin-x86-ut-gnu-bin/TlmPortAc.gcda:Version mismatch - expected 504* got 409*
|
||||
|
||||
***************************************
|
||||
(RQ) ISF-ARG-004
|
||||
***************************************
|
||||
|
||||
profiling:/home/tcanham/source/isf/Fw/Port/linux-cygwin-x86-ut-gnu-bin/PortBase.gcda:Version mismatch - expected 504* got 409*
|
||||
***************************************
|
||||
profiling:/home/tcanham/source/isf/Fw/Port/linux-cygwin-x86-ut-gnu-bin/InputPortBase.gcda:Version mismatch - expected 504* got 409*
|
||||
(RQ) ISF-ARG-004
|
||||
***************************************
|
||||
|
||||
***************************************
|
||||
(RQ) ISF-ARG-004
|
||||
profiling:/home/tcanham/source/isf/Fw/Port/linux-cygwin-x86-ut-gnu-bin/OutputPortBase.gcda:Version mismatch - expected 504* got 409*
|
||||
***************************************
|
||||
profiling:/home/tcanham/source/isf/Fw/Comp/linux-cygwin-x86-ut-gnu-bin/PassiveComponentBase.gcda:Version mismatch - expected 504* got 409*
|
||||
|
||||
profiling:/home/tcanham/source/isf/Fw/Obj/linux-cygwin-x86-ut-gnu-bin/ObjBase.gcda:Version mismatch - expected 504* got 409*
|
||||
***************************************
|
||||
profiling:/home/tcanham/source/isf/Fw/Time/linux-cygwin-x86-ut-gnu-bin/Time.gcda:Version mismatch - expected 504* got 409*
|
||||
(RQ) ISF-ARG-004
|
||||
profiling:/home/tcanham/source/isf/Fw/Types/linux-cygwin-x86-ut-gnu-bin/StringType.gcda:Version mismatch - expected 504* got 409*
|
||||
***************************************
|
||||
|
||||
***************************************
|
||||
(RQ) ISF-ARG-004
|
||||
profiling:/home/tcanham/source/isf/Fw/Types/linux-cygwin-x86-ut-gnu-bin/Serializable.gcda:Version mismatch - expected 504* got 409*
|
||||
***************************************
|
||||
profiling:/home/tcanham/source/isf/Fw/Types/linux-cygwin-x86-ut-gnu-bin/Assert.gcda:Version mismatch - expected 504* got 409*
|
||||
[ OK ] ActiveRateGroupTest.CycleOverrun (1 ms)
|
||||
profiling:/home/tcanham/source/isf/Os/linux-cygwin-x86-ut-gnu-bin/LogPrintf.gcda:Version mismatch - expected 504* got 409*
|
||||
[ RUN ] ActiveRateGroupTest.PingPort
|
||||
profiling:/home/tcanham/source/isf/Os/Linux/linux-cygwin-x86-ut-gnu-bin/IntervalTimer.gcda:Version mismatch - expected 504* got 409*
|
||||
[ OK ] ActiveRateGroupTest.PingPort (0 ms)
|
||||
[----------] 3 tests from ActiveRateGroupTest (3 ms total)
|
||||
|
||||
[----------] Global test environment tear-down
|
||||
[==========] 3 tests from 1 test case ran. (3 ms total)
|
||||
[ PASSED ] 3 tests.
|
||||
make[1]: Leaving directory '/home/tcanham/source/isf/Svc/ActiveRateGroup'
|
||||
|
||||
08:52:19 Build Finished (took 7s.999ms)
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@ -1,141 +0,0 @@
|
||||
-: 0:Source:/home/tcanham/source/isf/Svc/AssertFatalAdapter/AssertFatalAdapterComponentImpl.cpp
|
||||
-: 0:Programs:2
|
||||
-: 1:// ======================================================================
|
||||
-: 2:// \title AssertFatalAdapterImpl.cpp
|
||||
-: 3:// \author tcanham
|
||||
-: 4:// \brief cpp file for AssertFatalAdapter 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.
|
||||
-: 11://
|
||||
-: 18:// ======================================================================
|
||||
-: 19:
|
||||
-: 20:
|
||||
-: 21:#include <Svc/AssertFatalAdapter/AssertFatalAdapterComponentImpl.hpp>
|
||||
-: 22:#include "Fw/Types/BasicTypes.hpp"
|
||||
-: 23:#include <Fw/Types/Assert.hpp>
|
||||
-: 24:#include <stdio.h>
|
||||
-: 25:
|
||||
-: 26:namespace Svc {
|
||||
-: 27:
|
||||
-: 28: // ----------------------------------------------------------------------
|
||||
-: 29: // Construction, initialization, and destruction
|
||||
-: 30: // ----------------------------------------------------------------------
|
||||
-: 31:
|
||||
1: 32: AssertFatalAdapterComponentImpl ::
|
||||
-: 33:#if FW_OBJECT_NAMES == 1
|
||||
-: 34: AssertFatalAdapterComponentImpl(
|
||||
-: 35: const char *const compName
|
||||
-: 36: ) :
|
||||
1: 37: AssertFatalAdapterComponentBase(compName)
|
||||
-: 38:#else
|
||||
-: 39: AssertFatalAdapterImpl(void)
|
||||
-: 40:#endif
|
||||
-: 41: {
|
||||
-: 42: // register component with adapter
|
||||
1: 43: this->m_adapter.regAssertReporter(this);
|
||||
-: 44: // register adapter
|
||||
1: 45: this->m_adapter.registerHook();
|
||||
-: 46:
|
||||
1: 47: }
|
||||
-: 48:
|
||||
1: 49: void AssertFatalAdapterComponentImpl ::
|
||||
-: 50: init(
|
||||
-: 51: const NATIVE_INT_TYPE instance
|
||||
-: 52: )
|
||||
-: 53: {
|
||||
1: 54: AssertFatalAdapterComponentBase::init(instance);
|
||||
1: 55: }
|
||||
-: 56:
|
||||
1: 57: AssertFatalAdapterComponentImpl ::
|
||||
1: 58: ~AssertFatalAdapterComponentImpl(void)
|
||||
-: 59: {
|
||||
-: 60:
|
||||
1: 61: }
|
||||
-: 62:
|
||||
7: 63: void AssertFatalAdapterComponentImpl::AssertFatalAdapter::reportAssert(
|
||||
-: 64: FILE_NAME_ARG file,
|
||||
-: 65: NATIVE_UINT_TYPE lineNo,
|
||||
-: 66: NATIVE_UINT_TYPE numArgs,
|
||||
-: 67: AssertArg arg1,
|
||||
-: 68: AssertArg arg2,
|
||||
-: 69: AssertArg arg3,
|
||||
-: 70: AssertArg arg4,
|
||||
-: 71: AssertArg arg5,
|
||||
-: 72: AssertArg arg6
|
||||
-: 73: ) {
|
||||
-: 74:
|
||||
7: 75: if (m_compPtr) {
|
||||
7: 76: m_compPtr->reportAssert(file,lineNo,numArgs,
|
||||
7: 77: arg1,arg2,arg3,arg4,arg5,arg6);
|
||||
-: 78: } else {
|
||||
-: 79: // Can't assert, what else can we do? Maybe somebody will see it.
|
||||
#####: 80: printf("Svc::AssertFatalAdapter not registered!\n");
|
||||
-: 81: }
|
||||
7: 82: }
|
||||
-: 83:
|
||||
1: 84: void AssertFatalAdapterComponentImpl::AssertFatalAdapter::regAssertReporter(AssertFatalAdapterComponentImpl* compPtr) {
|
||||
1: 85: this->m_compPtr = compPtr;
|
||||
1: 86: }
|
||||
-: 87:
|
||||
1: 88: AssertFatalAdapterComponentImpl::AssertFatalAdapter::AssertFatalAdapter() {
|
||||
1: 89: }
|
||||
-: 90:
|
||||
1: 91: AssertFatalAdapterComponentImpl::AssertFatalAdapter::~AssertFatalAdapter() {
|
||||
1: 92: }
|
||||
-: 93:
|
||||
7: 94: void AssertFatalAdapterComponentImpl::AssertFatalAdapter::doAssert(void) {
|
||||
-: 95: // do nothing since there will be a FATAL
|
||||
7: 96: }
|
||||
-: 97:
|
||||
8: 98: void AssertFatalAdapterComponentImpl::reportAssert(
|
||||
-: 99: FILE_NAME_ARG file,
|
||||
-: 100: NATIVE_UINT_TYPE lineNo,
|
||||
-: 101: NATIVE_UINT_TYPE numArgs,
|
||||
-: 102: AssertArg arg1,
|
||||
-: 103: AssertArg arg2,
|
||||
-: 104: AssertArg arg3,
|
||||
-: 105: AssertArg arg4,
|
||||
-: 106: AssertArg arg5,
|
||||
-: 107: AssertArg arg6
|
||||
-: 108: ) {
|
||||
-: 109:
|
||||
-: 110:
|
||||
-: 111:#if FW_ASSERT_LEVEL == FW_FILEID_ASSERT
|
||||
-: 112: Fw::LogStringArg fileArg;
|
||||
-: 113: fileArg.format("%d",file);
|
||||
-: 114:#else
|
||||
16: 115: Fw::LogStringArg fileArg((const char*)file);
|
||||
-: 116:#endif
|
||||
-: 117:
|
||||
8: 118: switch (numArgs) {
|
||||
-: 119: case 0:
|
||||
1: 120: this->log_FATAL_AF_ASSERT_0(fileArg,lineNo);
|
||||
1: 121: break;
|
||||
-: 122: case 1:
|
||||
1: 123: this->log_FATAL_AF_ASSERT_1(fileArg,lineNo,arg1);
|
||||
1: 124: break;
|
||||
-: 125: case 2:
|
||||
1: 126: this->log_FATAL_AF_ASSERT_2(fileArg,lineNo,arg1,arg2);
|
||||
1: 127: break;
|
||||
-: 128: case 3:
|
||||
1: 129: this->log_FATAL_AF_ASSERT_3(fileArg,lineNo,arg1,arg2,arg3);
|
||||
1: 130: break;
|
||||
-: 131: case 4:
|
||||
1: 132: this->log_FATAL_AF_ASSERT_4(fileArg,lineNo,arg1,arg2,arg3,arg4);
|
||||
1: 133: break;
|
||||
-: 134: case 5:
|
||||
1: 135: this->log_FATAL_AF_ASSERT_5(fileArg,lineNo,arg1,arg2,arg3,arg4,arg5);
|
||||
1: 136: break;
|
||||
-: 137: case 6:
|
||||
1: 138: this->log_FATAL_AF_ASSERT_6(fileArg,lineNo,arg1,arg2,arg3,arg4,arg5,arg6);
|
||||
1: 139: break;
|
||||
-: 140: default:
|
||||
1: 141: this->log_FATAL_AF_UNEXPECTED_ASSERT(fileArg,lineNo,numArgs);
|
||||
1: 142: break;
|
||||
-: 143: }
|
||||
-: 144:
|
||||
8: 145: }
|
||||
3: 146:} // end namespace Svc
|
||||
@ -1,20 +0,0 @@
|
||||
Running /home/tcanham/source/isf/Svc/AssertFatalAdapter/test/ut/linux-linux-x86-debug-gnu-ut-bin/test_ut
|
||||
[==========] Running 1 test from 1 test case.
|
||||
[----------] Global test environment set-up.
|
||||
[----------] 1 test from Nominal
|
||||
[ RUN ] Nominal.NominalInit
|
||||
EVENT: (0) (0:0,0) FATAL: (AssertFatalAdapter) AF_ASSERT_0 : Assert in file /home/tcanham/source/isf/Svc/AssertFatalAdapter/test/ut/Tester.cpp, line 59
|
||||
EVENT: (1) (0:0,0) FATAL: (AssertFatalAdapter) AF_ASSERT_1 : Assert in file /home/tcanham/source/isf/Svc/AssertFatalAdapter/test/ut/Tester.cpp, line 65: 1
|
||||
EVENT: (2) (0:0,0) FATAL: (AssertFatalAdapter) AF_ASSERT_2 : Assert in file /home/tcanham/source/isf/Svc/AssertFatalAdapter/test/ut/Tester.cpp, line 71: 1 2
|
||||
EVENT: (3) (0:0,0) FATAL: (AssertFatalAdapter) AF_ASSERT_3 : Assert in file /home/tcanham/source/isf/Svc/AssertFatalAdapter/test/ut/Tester.cpp, line 77: 1 2 3
|
||||
EVENT: (4) (0:0,0) FATAL: (AssertFatalAdapter) AF_ASSERT_4 : Assert in file /home/tcanham/source/isf/Svc/AssertFatalAdapter/test/ut/Tester.cpp, line 83: 1 2 3 4
|
||||
EVENT: (5) (0:0,0) FATAL: (AssertFatalAdapter) AF_ASSERT_5 : Assert in file /home/tcanham/source/isf/Svc/AssertFatalAdapter/test/ut/Tester.cpp, line 89: 1 2 3 4 5
|
||||
EVENT: (6) (0:0,0) FATAL: (AssertFatalAdapter) AF_ASSERT_6 : Assert in file /home/tcanham/source/isf/Svc/AssertFatalAdapter/test/ut/Tester.cpp, line 95: 1 2 3 4 5 6
|
||||
EVENT: (7) (0:0,0) FATAL: (AssertFatalAdapter) AF_UNEXPECTED_ASSERT : Unexpected assert in file foo, line 1000, args 10
|
||||
[ OK ] Nominal.NominalInit (0 ms)
|
||||
Build Time: 0:00.70
|
||||
[----------] 1 test from Nominal (7 ms total)
|
||||
|
||||
[----------] Global test environment tear-down
|
||||
[==========] 1 test from 1 test case ran. (10 ms total)
|
||||
[ PASSED ] 1 test.
|
||||
@ -320,9 +320,7 @@ TBD
|
||||
|
||||
## 5 Unit Testing
|
||||
|
||||
[CmdSequencerImpl.cpp](../test/ut/output/CmdSequencerImpl.cpp.gcov)
|
||||
|
||||
[CmdSequencerComponentAc.cpp](../test/ut/output/CmdSequencerComponentAc.cpp.gcov)
|
||||
To see unit test coverage run fprime-util check --coverage
|
||||
|
||||
## 6 Change log
|
||||
Date | Change Description
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@ -1,771 +0,0 @@
|
||||
-: 0:Source:/home/tim/source/isf/Svc/CmdSequencer/CmdSequencerImpl.cpp
|
||||
-: 0:Programs:11
|
||||
-: 1:// ======================================================================
|
||||
-: 2:// \title CmdSequencerImpl.cpp
|
||||
-: 3:// \author Bocchino/Canham
|
||||
-: 4:// \brief cpp file for CmdDispatcherComponentBase component implementation class
|
||||
-: 5://
|
||||
-: 6:// \copyright
|
||||
-: 7:// Copyright (C) 2009-2016 California Institute of Technology.
|
||||
-: 8:// ALL RIGHTS RESERVED. United States Government Sponsorship
|
||||
-: 9:// acknowledged.
|
||||
-: 11://
|
||||
-: 18:// ======================================================================
|
||||
-: 19:
|
||||
-: 20:#include <Fw/Types/Assert.hpp>
|
||||
-: 21:#include <Fw/Types/SerialBuffer.hpp>
|
||||
-: 22:#include <Svc/CmdSequencer/CmdSequencerImpl.hpp>
|
||||
-: 23:#include <Fw/Com/ComPacket.hpp>
|
||||
-: 24:#include <Fw/Types/Serializable.hpp>
|
||||
-: 25:extern "C" {
|
||||
-: 26: #include <Utils/Hash/libcrc/lib_crc.h>
|
||||
-: 27:}
|
||||
-: 28:
|
||||
-: 29:namespace Svc {
|
||||
-: 30:
|
||||
-: 31: // ----------------------------------------------------------------------
|
||||
-: 32: // Construction, initialization, and destruction
|
||||
-: 33: // ----------------------------------------------------------------------
|
||||
-: 34:
|
||||
96: 35: CmdSequencerComponentImpl::
|
||||
-: 36:#if FW_OBJECT_NAMES == 1
|
||||
-: 37: CmdSequencerComponentImpl(const char* name) :
|
||||
-: 38: CmdSequencerComponentBase(name),
|
||||
-: 39:#else
|
||||
-: 40: CmdSequencerComponentImpl(void) :
|
||||
-: 41: CmdSequencerComponentBase(),
|
||||
-: 42:#endif
|
||||
-: 43: m_numRecords(0),
|
||||
-: 44: m_timeBase(TB_DONT_CARE),
|
||||
-: 45: m_timeContext(FW_CONTEXT_DONT_CARE),
|
||||
-: 46: m_fileCRC(0),
|
||||
-: 47: m_allocatorId(0),
|
||||
-: 48: m_loadCmdCount(0),
|
||||
-: 49: m_cancelCmdCount(0),
|
||||
-: 50: m_errorCount(0),
|
||||
-: 51: m_queueDepth(0),
|
||||
-: 52: m_runMode(STOPPED),
|
||||
-: 53: m_stepMode(AUTO),
|
||||
-: 54: m_executedCount(0),
|
||||
-: 55: m_totalExecutedCount(0),
|
||||
-: 56: m_sequencesCompletedCount(0),
|
||||
96: 57: m_timeout(0)
|
||||
-: 58: {
|
||||
-: 59:
|
||||
96: 60: }
|
||||
-: 61:
|
||||
96: 62: void CmdSequencerComponentImpl::init(const NATIVE_INT_TYPE queueDepth,
|
||||
-: 63: const NATIVE_INT_TYPE instance) {
|
||||
96: 64: CmdSequencerComponentBase::init(queueDepth, instance);
|
||||
96: 65: }
|
||||
-: 66:
|
||||
48: 67: void CmdSequencerComponentImpl::setTimeout(NATIVE_UINT_TYPE timeout) {
|
||||
48: 68: this->m_timeout = timeout;
|
||||
48: 69: }
|
||||
-: 70:
|
||||
96: 71: void CmdSequencerComponentImpl::allocateBuffer(NATIVE_INT_TYPE identifier, Fw::MemAllocator& allocator, NATIVE_UINT_TYPE bytes) {
|
||||
-: 72: // has to be at least as big as a header
|
||||
96: 73: FW_ASSERT(bytes >= SEQ_FILE_HEADER_SIZE);
|
||||
96: 74: this->m_allocatorId = identifier;
|
||||
96: 75: this->m_seqBuffer.setExtBuffer(static_cast<U8*>(allocator.allocate(identifier,bytes)),bytes);
|
||||
96: 76: }
|
||||
-: 77:
|
||||
87: 78: void CmdSequencerComponentImpl::deallocateBuffer(Fw::MemAllocator& allocator) {
|
||||
87: 79: allocator.deallocate(this->m_allocatorId,this->m_seqBuffer.getBuffAddr());
|
||||
87: 80: this->m_seqBuffer.clear();
|
||||
87: 81: }
|
||||
-: 82:
|
||||
96: 83: CmdSequencerComponentImpl::~CmdSequencerComponentImpl(void) {
|
||||
-: 84:
|
||||
96: 85: }
|
||||
-: 86:
|
||||
-: 87: // ----------------------------------------------------------------------
|
||||
-: 88: // Handler implementations
|
||||
-: 89: // ----------------------------------------------------------------------
|
||||
-: 90:
|
||||
84: 91: void CmdSequencerComponentImpl::CS_Run_cmdHandler(
|
||||
-: 92: FwOpcodeType opCode,
|
||||
-: 93: U32 cmdSeq,
|
||||
-: 94: const Fw::CmdStringArg& fileName) {
|
||||
-: 95:
|
||||
84: 96: if (!this->requireRunMode(STOPPED)) {
|
||||
4: 97: this->cmdResponse_out(opCode, cmdSeq, Fw::COMMAND_EXECUTION_ERROR);
|
||||
4: 98: return;
|
||||
-: 99: }
|
||||
-: 100:
|
||||
-: 101: // load commands
|
||||
80: 102: if (not this->performCmd_Load(fileName)) {
|
||||
36: 103: this->cmdResponse_out(opCode, cmdSeq, Fw::COMMAND_EXECUTION_ERROR);
|
||||
36: 104: return;
|
||||
-: 105: }
|
||||
-: 106:
|
||||
44: 107: this->m_executedCount = 0;
|
||||
-: 108:
|
||||
-: 109: // Check the step mode. If it is auto, start the sequence
|
||||
44: 110: if (AUTO == this->m_stepMode) {
|
||||
36: 111: this->m_runMode = RUNNING;
|
||||
36: 112: this->performCmd_Step();
|
||||
-: 113: }
|
||||
-: 114:
|
||||
44: 115: this->cmdResponse_out(opCode, cmdSeq, Fw::COMMAND_OK);
|
||||
-: 116: }
|
||||
-: 117:
|
||||
104: 118: void CmdSequencerComponentImpl::CS_Validate_cmdHandler(
|
||||
-: 119: FwOpcodeType opCode, /*!< The opcode*/
|
||||
-: 120: U32 cmdSeq, /*!< The command sequence number*/
|
||||
-: 121: const Fw::CmdStringArg& fileName) { /*!< The name of the sequence file*/
|
||||
-: 122:
|
||||
104: 123: if (!this->requireRunMode(STOPPED)) {
|
||||
4: 124: this->cmdResponse_out(opCode, cmdSeq, Fw::COMMAND_EXECUTION_ERROR);
|
||||
4: 125: return;
|
||||
-: 126: }
|
||||
-: 127:
|
||||
-: 128: // load commands
|
||||
100: 129: if (not this->performCmd_Load(fileName)) {
|
||||
52: 130: this->cmdResponse_out(opCode, cmdSeq, Fw::COMMAND_EXECUTION_ERROR);
|
||||
52: 131: return;
|
||||
-: 132: }
|
||||
-: 133:
|
||||
-: 134: // reset buffer
|
||||
48: 135: this->m_seqBuffer.resetSer();
|
||||
-: 136:
|
||||
48: 137: this->log_ACTIVITY_HI_CS_SequenceValid(this->m_logFileName);
|
||||
-: 138:
|
||||
48: 139: this->cmdResponse_out(opCode, cmdSeq, Fw::COMMAND_OK);
|
||||
-: 140:
|
||||
-: 141: }
|
||||
-: 142:
|
||||
-: 143: //! Handler for input port seqRunIn
|
||||
12: 144: void CmdSequencerComponentImpl::seqRunIn_handler(
|
||||
-: 145: NATIVE_INT_TYPE portNum, /*!< The port number*/
|
||||
-: 146: Fw::EightyCharString &filename /*!< The sequence file*/
|
||||
-: 147: ) {
|
||||
-: 148:
|
||||
12: 149: if (!this->requireRunMode(STOPPED)) {
|
||||
4: 150: this->seqDone_out(0,0,0,Fw::COMMAND_EXECUTION_ERROR);
|
||||
12: 151: return;
|
||||
-: 152: }
|
||||
-: 153:
|
||||
-: 154: // load commands
|
||||
12: 155: Fw::CmdStringArg cmdStr(filename);
|
||||
8: 156: if (not this->performCmd_Load(cmdStr)) {
|
||||
4: 157: this->seqDone_out(0,0,0,Fw::COMMAND_EXECUTION_ERROR);
|
||||
4: 158: return;
|
||||
-: 159: }
|
||||
-: 160:
|
||||
4: 161: this->m_executedCount = 0;
|
||||
-: 162:
|
||||
-: 163: // Check the step mode. If it is auto, start the sequence
|
||||
4: 164: if (AUTO == this->m_stepMode) {
|
||||
4: 165: this->m_runMode = RUNNING;
|
||||
4: 166: this->performCmd_Step();
|
||||
-: 167: }
|
||||
-: 168:
|
||||
4: 169: this->log_ACTIVITY_HI_CS_PortSequenceStarted(this->m_logFileName);
|
||||
-: 170: }
|
||||
-: 171:
|
||||
8: 172: void CmdSequencerComponentImpl::CS_Cancel_cmdHandler(
|
||||
-: 173: FwOpcodeType opCode, U32 cmdSeq) {
|
||||
8: 174: if (RUNNING == this->m_runMode) {
|
||||
4: 175: this->performCmd_Cancel();
|
||||
8: 176: Fw::LogStringArg logStringArg(this->m_fileName);
|
||||
4: 177: this->log_ACTIVITY_HI_CS_SequenceCanceled(logStringArg);
|
||||
4: 178: ++this->m_cancelCmdCount;
|
||||
4: 179: this->tlmWrite_CS_CancelCommands(this->m_cancelCmdCount);
|
||||
-: 180: } else {
|
||||
4: 181: this->log_WARNING_LO_CS_NoSequenceActive();
|
||||
-: 182: }
|
||||
8: 183: this->cmdResponse_out(opCode, cmdSeq, Fw::COMMAND_OK);
|
||||
8: 184: }
|
||||
-: 185:
|
||||
-: 186: // ----------------------------------------------------------------------
|
||||
-: 187: // Private helper methods
|
||||
-: 188: // ----------------------------------------------------------------------
|
||||
-: 189:
|
||||
92: 190: void CmdSequencerComponentImpl::error(void) {
|
||||
92: 191: ++this->m_errorCount;
|
||||
92: 192: this->m_fileName = "";
|
||||
92: 193: this->m_logFileName = "";
|
||||
92: 194: this->tlmWrite_CS_Errors(m_errorCount);
|
||||
92: 195: }
|
||||
-: 196:
|
||||
28: 197: void CmdSequencerComponentImpl::eventFileInvalid(FileReadStage stage, I32 error) {
|
||||
28: 198: this->log_WARNING_HI_CS_FileInvalid(this->m_logFileName,stage,error);
|
||||
28: 199: this->error();
|
||||
28: 200: }
|
||||
-: 201:
|
||||
4: 202: void CmdSequencerComponentImpl::eventTimeBaseMismatch(U32 currTimeBase, U32 seqTimeBase) {
|
||||
4: 203: this->log_WARNING_HI_CS_TimeBaseMismatch(this->m_logFileName,currTimeBase,seqTimeBase);
|
||||
4: 204: this->error();
|
||||
4: 205: }
|
||||
-: 206:
|
||||
4: 207: void CmdSequencerComponentImpl::eventTimeContextMismatch(U32 currTimeContext, U32 seqTimeContext) {
|
||||
4: 208: this->log_WARNING_HI_CS_TimeContextMismatch(this->m_logFileName,currTimeContext,seqTimeContext);
|
||||
4: 209: this->error();
|
||||
4: 210: }
|
||||
-: 211:
|
||||
4: 212: void CmdSequencerComponentImpl::eventFileReadError(void) {
|
||||
4: 213: this->log_WARNING_HI_CS_FileReadError(this->m_logFileName);
|
||||
4: 214: this->error();
|
||||
4: 215: }
|
||||
-: 216:
|
||||
4: 217: void CmdSequencerComponentImpl::eventFileSizeError(U32 size) {
|
||||
4: 218: this->log_WARNING_HI_CS_FileSizeError(this->m_logFileName,size);
|
||||
4: 219: this->error();
|
||||
4: 220: }
|
||||
-: 221:
|
||||
32: 222: void CmdSequencerComponentImpl::eventRecordInvalid(U32 n, I32 error) {
|
||||
32: 223: this->log_WARNING_HI_CS_RecordInvalid(this->m_logFileName, n, error);
|
||||
32: 224: this->error();
|
||||
32: 225: }
|
||||
-: 226:
|
||||
12: 227: void CmdSequencerComponentImpl::performCmd_Cancel(void) {
|
||||
12: 228: this->m_seqBuffer.resetDeser();
|
||||
12: 229: this->m_runMode = STOPPED;
|
||||
12: 230: this->m_cmdTimer.clear();
|
||||
12: 231: this->m_cmdTimeoutTimer.clear();
|
||||
12: 232: this->m_executedCount = 0;
|
||||
-: 233: // write sequence done port with error, if connected
|
||||
12: 234: if (this->isConnected_seqDone_OutputPort(0)) {
|
||||
12: 235: this->seqDone_out(0,0,0,Fw::COMMAND_EXECUTION_ERROR);
|
||||
-: 236: }
|
||||
-: 237:
|
||||
12: 238: }
|
||||
-: 239:
|
||||
188: 240: bool CmdSequencerComponentImpl::performCmd_Load(const Fw::CmdStringArg& fileName) {
|
||||
-: 241:
|
||||
-: 242: // make sure there is a buffer allocated
|
||||
188: 243: FW_ASSERT(this->m_seqBuffer.getBuffAddr());
|
||||
-: 244:
|
||||
188: 245: this->m_fileName = fileName;
|
||||
-: 246: // copy for events
|
||||
188: 247: this->m_logFileName = fileName;
|
||||
-: 248:
|
||||
188: 249: if (!this->readSequenceFile()) {
|
||||
52: 250: return false;
|
||||
-: 251: }
|
||||
-: 252:
|
||||
136: 253: if (!this->validateBuffer()) {
|
||||
40: 254: return false;
|
||||
-: 255: }
|
||||
-: 256:
|
||||
96: 257: this->log_ACTIVITY_LO_CS_SequenceLoaded(this->m_logFileName);
|
||||
96: 258: ++this->m_loadCmdCount;
|
||||
96: 259: this->tlmWrite_CS_LoadCommands(this->m_loadCmdCount);
|
||||
-: 260:
|
||||
96: 261: return true;
|
||||
-: 262:
|
||||
-: 263: }
|
||||
-: 264:
|
||||
188: 265: bool CmdSequencerComponentImpl::readSequenceFile(void) {
|
||||
-: 266:
|
||||
-: 267: bool result;
|
||||
-: 268:
|
||||
188: 269: Os::File::Status status = this->m_sequenceFile.open(
|
||||
188: 270: this->m_fileName.toChar(), Os::File::OPEN_READ);
|
||||
-: 271:
|
||||
188: 272: if (status == Os::File::OP_OK) {
|
||||
176: 273: result = this->readOpenSequenceFile();
|
||||
12: 274: } else if (status == Os::File::DOESNT_EXIST) {
|
||||
8: 275: this->log_WARNING_HI_CS_FileNotFound(this->m_logFileName);
|
||||
8: 276: this->error();
|
||||
8: 277: result = false;
|
||||
-: 278: } else {
|
||||
4: 279: this->eventFileReadError();
|
||||
4: 280: result = false;
|
||||
-: 281: }
|
||||
-: 282:
|
||||
188: 283: this->m_sequenceFile.close();
|
||||
188: 284: return result;
|
||||
-: 285:
|
||||
-: 286: }
|
||||
-: 287:
|
||||
176: 288: bool CmdSequencerComponentImpl::readOpenSequenceFile(void) {
|
||||
-: 289:
|
||||
-: 290: U32 fileSize;
|
||||
-: 291:
|
||||
176: 292: NATIVE_INT_TYPE readLen = SEQ_FILE_HEADER_SIZE;
|
||||
-: 293: // temporarily borrow sequence buffer for header
|
||||
176: 294: Os::File::Status status = this->m_sequenceFile.read(this->m_seqBuffer.getBuffAddr(),readLen);
|
||||
-: 295:
|
||||
-: 296: // check read status
|
||||
176: 297: if (status != Os::File::OP_OK) {
|
||||
4: 298: this->eventFileInvalid(SEQ_READ_HEADER,this->m_sequenceFile.getLastError());
|
||||
4: 299: return false;
|
||||
-: 300: }
|
||||
-: 301:
|
||||
-: 302: // check read size
|
||||
172: 303: if (SEQ_FILE_HEADER_SIZE != readLen) {
|
||||
4: 304: this->eventFileInvalid(SEQ_READ_HEADER_SIZE,readLen);
|
||||
4: 305: return false;
|
||||
-: 306: }
|
||||
-: 307:
|
||||
-: 308: // set buffer length to read size
|
||||
168: 309: FW_ASSERT(Fw::FW_SERIALIZE_OK == this->m_seqBuffer.setBuffLen(readLen));
|
||||
-: 310:
|
||||
-: 311: // deserialize size of file
|
||||
168: 312: Fw::SerializeStatus stat = this->m_seqBuffer.deserialize(fileSize);
|
||||
168: 313: if (stat != Fw::FW_SERIALIZE_OK) {
|
||||
#####: 314: this->eventFileInvalid(SEQ_DESER_SIZE,stat);
|
||||
#####: 315: return false;
|
||||
-: 316: }
|
||||
-: 317:
|
||||
168: 318: if (fileSize > this->m_seqBuffer.getBuffCapacity()) {
|
||||
4: 319: this->eventFileSizeError(fileSize);
|
||||
4: 320: return false;
|
||||
-: 321: }
|
||||
-: 322:
|
||||
-: 323: // deserialize number of records
|
||||
164: 324: stat = this->m_seqBuffer.deserialize(this->m_numRecords);
|
||||
164: 325: if (stat != Fw::FW_SERIALIZE_OK) {
|
||||
#####: 326: this->eventFileInvalid(SEQ_DESER_NUM_RECORDS,stat);
|
||||
#####: 327: return false;
|
||||
-: 328: }
|
||||
-: 329:
|
||||
-: 330: // deserialize time base of sequence
|
||||
-: 331: FwTimeBaseStoreType tbase;
|
||||
164: 332: stat = this->m_seqBuffer.deserialize(tbase);
|
||||
164: 333: if (stat != Fw::FW_SERIALIZE_OK) {
|
||||
#####: 334: this->eventFileInvalid(SEQ_DESER_TIME_BASE,stat);
|
||||
#####: 335: return false;
|
||||
-: 336: }
|
||||
-: 337:
|
||||
164: 338: this->m_timeBase = static_cast<IsfTimeBase>(tbase);
|
||||
-: 339:
|
||||
-: 340: // check time base
|
||||
328: 341: Fw::Time check = this->getTime();
|
||||
164: 342: if (
|
||||
168: 343: (check.getTimeBase() != this->m_timeBase) and
|
||||
4: 344: (this->m_timeBase != TB_DONT_CARE)
|
||||
-: 345: ) {
|
||||
4: 346: this->eventTimeBaseMismatch(check.getTimeBase(),this->m_timeBase);
|
||||
4: 347: return false;
|
||||
-: 348: }
|
||||
-: 349: // set to actual time base for later
|
||||
160: 350: this->m_timeBase = check.getTimeBase();
|
||||
-: 351:
|
||||
-: 352: // deserialize time context
|
||||
160: 353: stat = this->m_seqBuffer.deserialize(this->m_timeContext);
|
||||
160: 354: if (stat != Fw::FW_SERIALIZE_OK) {
|
||||
#####: 355: this->eventFileInvalid(SEQ_DESER_TIME_CONTEXT,stat);
|
||||
#####: 356: return false;
|
||||
-: 357: }
|
||||
-: 358:
|
||||
-: 359: // check time context
|
||||
160: 360: if (
|
||||
164: 361: (check.getContext() != this->m_timeContext) and
|
||||
4: 362: (this->m_timeContext != FW_CONTEXT_DONT_CARE)
|
||||
-: 363: ) {
|
||||
4: 364: this->eventTimeContextMismatch(check.getContext(),this->m_timeContext);
|
||||
4: 365: return false;
|
||||
-: 366: }
|
||||
-: 367:
|
||||
-: 368: // set to actual time context for later
|
||||
156: 369: this->m_timeContext = check.getContext();
|
||||
-: 370:
|
||||
-: 371: // compute CRC over header
|
||||
156: 372: this->initCrc(this->m_fileCRC);
|
||||
-: 373:
|
||||
156: 374: this->updateCRC(this->m_fileCRC,this->m_seqBuffer.getBuffAddr(),SEQ_FILE_HEADER_SIZE);
|
||||
-: 375:
|
||||
-: 376: // read sequence data
|
||||
-: 377:
|
||||
156: 378: readLen = fileSize;
|
||||
156: 379: status = this->m_sequenceFile.read(this->m_seqBuffer.getBuffAddr(),readLen);
|
||||
-: 380: // check read status
|
||||
156: 381: if (status != Os::File::OP_OK) {
|
||||
4: 382: this->eventFileInvalid(SEQ_READ_SEQ_DATA,this->m_sequenceFile.getLastError());
|
||||
4: 383: return false;
|
||||
-: 384: }
|
||||
-: 385:
|
||||
-: 386: // check read size
|
||||
152: 387: if ((NATIVE_INT_TYPE)fileSize != readLen) {
|
||||
4: 388: this->eventFileInvalid(SEQ_READ_SEQ_DATA_SIZE,readLen);
|
||||
4: 389: return false;
|
||||
-: 390: }
|
||||
-: 391:
|
||||
-: 392: // set sequence buffer size
|
||||
148: 393: FW_ASSERT(Fw::FW_SERIALIZE_OK == this->m_seqBuffer.setBuffLen(fileSize));
|
||||
-: 394:
|
||||
-: 395: // compute CRC over rest of file. Will be checked in validateBuffer()
|
||||
-: 396:
|
||||
-: 397: // buffer should be at least as large as a CRC
|
||||
148: 398: if (this->m_seqBuffer.getBuffLength() < sizeof(this->m_fileCRC)) {
|
||||
12: 399: this->eventFileInvalid(SEQ_READ_SEQ_CRC,this->m_seqBuffer.getBuffLength());
|
||||
12: 400: return false;
|
||||
-: 401: } else {
|
||||
272: 402: this->updateCRC(this->m_fileCRC,
|
||||
136: 403: this->m_seqBuffer.getBuffAddr(),
|
||||
136: 404: fileSize-sizeof(this->m_fileCRC));
|
||||
-: 405:
|
||||
-: 406: // finalize CRC
|
||||
136: 407: this->finalizeCRC(this->m_fileCRC);
|
||||
136: 408: return true;
|
||||
-: 409: }
|
||||
-: 410:
|
||||
-: 411:
|
||||
-: 412: }
|
||||
-: 413:
|
||||
136: 414: bool CmdSequencerComponentImpl::validateBuffer(void) {
|
||||
-: 415:
|
||||
-: 416: // validate CRC
|
||||
-: 417:
|
||||
-: 418: // Get CRC from the data file
|
||||
-: 419: U32 storedCrc;
|
||||
-: 420:
|
||||
-: 421: // point at CRC bytes
|
||||
136: 422: Fw::ExternalSerializeBuffer crcBuff(&this->m_seqBuffer.getBuffAddr()[this->m_seqBuffer.getBuffLength()-sizeof(storedCrc)],
|
||||
272: 423: sizeof(storedCrc));
|
||||
-: 424: // set buffer size to length of CRC
|
||||
136: 425: FW_ASSERT(Fw::FW_SERIALIZE_OK == crcBuff.setBuffLen(sizeof(storedCrc)));
|
||||
-: 426:
|
||||
-: 427: // deserialize CRC value
|
||||
136: 428: Fw::SerializeStatus stat = crcBuff.deserialize(storedCrc);
|
||||
136: 429: FW_ASSERT(stat == Fw::FW_SERIALIZE_OK,stat);
|
||||
-: 430:
|
||||
-: 431: // compare CRC
|
||||
136: 432: if (storedCrc != this->m_fileCRC) {
|
||||
4: 433: this->log_WARNING_HI_CS_FileCrcFailure(this->m_logFileName,storedCrc,this->m_fileCRC);
|
||||
4: 434: this->error();
|
||||
4: 435: return false;
|
||||
-: 436: }
|
||||
-: 437:
|
||||
264: 438: CmdRecord rec;
|
||||
-: 439:
|
||||
592: 440: for (NATIVE_UINT_TYPE record = 0; record < this->m_numRecords; record++) {
|
||||
492: 441: Fw::SerializeStatus stat = rec.deserialize(this->m_seqBuffer);
|
||||
492: 442: if (stat != Fw::FW_SERIALIZE_OK) {
|
||||
32: 443: this->eventRecordInvalid(record,stat);
|
||||
32: 444: return false;
|
||||
-: 445: }
|
||||
-: 446: }
|
||||
-: 447:
|
||||
-: 448: // there should only be the CRC left
|
||||
100: 449: if (this->m_seqBuffer.getBuffLeft() != sizeof(this->m_fileCRC)) {
|
||||
4: 450: this->log_WARNING_HI_CS_RecordMismatch(this->m_logFileName,this->m_numRecords,this->m_seqBuffer.getBuffLeft()-sizeof(this->m_fileCRC));
|
||||
4: 451: return false;
|
||||
-: 452: }
|
||||
-: 453:
|
||||
-: 454: // rewind deserialization
|
||||
96: 455: this->m_seqBuffer.resetDeser();
|
||||
-: 456: // set buffer to size minus CRC now that it's validated
|
||||
96: 457: FW_ASSERT(Fw::FW_SERIALIZE_OK == this->m_seqBuffer.setBuffLen(this->m_seqBuffer.getBuffLength()-sizeof(this->m_fileCRC)));
|
||||
-: 458:
|
||||
96: 459: return true;
|
||||
-: 460:
|
||||
-: 461: }
|
||||
-: 462:
|
||||
152: 463: void CmdSequencerComponentImpl::cmdResponseIn_handler(
|
||||
-: 464: NATIVE_INT_TYPE portNum,
|
||||
-: 465: FwOpcodeType opcode, U32 cmdSeq, Fw::CommandResponse response) {
|
||||
-: 466: // check to see if sequencer is running
|
||||
-: 467:
|
||||
152: 468: if (this->m_runMode == STOPPED) {
|
||||
4: 469: this->log_WARNING_HI_CS_UnexpectedCompletion(opcode);
|
||||
-: 470: } else {
|
||||
-: 471: // clear command timeout
|
||||
148: 472: this->m_cmdTimeoutTimer.clear();
|
||||
148: 473: if (response != Fw::COMMAND_OK) {
|
||||
4: 474: this->commandError(this->m_executedCount, opcode, response);
|
||||
4: 475: this->performCmd_Cancel();
|
||||
144: 476: } else if (this->m_runMode == RUNNING && this->m_stepMode == AUTO) {
|
||||
108: 477: this->commandComplete(opcode);
|
||||
-: 478: // check to see if there is any data left
|
||||
216: 479: if (this->m_seqBuffer.getBuffLeft() == 0) {
|
||||
8: 480: this->m_runMode = STOPPED;
|
||||
8: 481: this->sequenceComplete();
|
||||
-: 482: } else {
|
||||
100: 483: this->performCmd_Step();
|
||||
-: 484: }
|
||||
-: 485: } else { // manual step mode
|
||||
36: 486: this->commandComplete(opcode);
|
||||
36: 487: if (this->m_seqBuffer.getBuffLeft() == 0) {
|
||||
4: 488: this->m_runMode = STOPPED;
|
||||
4: 489: this->sequenceComplete();
|
||||
-: 490: }
|
||||
-: 491: }
|
||||
-: 492: }
|
||||
152: 493: }
|
||||
-: 494:
|
||||
48: 495: void CmdSequencerComponentImpl::schedIn_handler(NATIVE_INT_TYPE portNum,
|
||||
-: 496: NATIVE_UINT_TYPE order) {
|
||||
-: 497:
|
||||
96: 498: Fw::Time currTime = this->getTime();
|
||||
-: 499: // check to see if a command time is pending
|
||||
48: 500: if (this->m_cmdTimer.isExpiredAt(currTime)) {
|
||||
20: 501: this->comCmdOut_out(0, m_cmdRecord.m_command, 0);
|
||||
20: 502: this->m_cmdTimer.clear();
|
||||
-: 503: // start command timeout timer
|
||||
20: 504: this->setCmdTimeout(currTime);
|
||||
28: 505: } else if (this->m_cmdTimeoutTimer.isExpiredAt(this->getTime())) { // check for command timeout
|
||||
4: 506: this->log_WARNING_HI_CS_SequenceTimeout(m_logFileName,this->m_executedCount);
|
||||
-: 507: // If there is a command timeout, cancel the sequence
|
||||
4: 508: this->performCmd_Cancel();
|
||||
-: 509: }
|
||||
48: 510: }
|
||||
-: 511:
|
||||
16: 512: void CmdSequencerComponentImpl::CS_Start_cmdHandler(
|
||||
-: 513: FwOpcodeType opcode, U32 cmdSeq) {
|
||||
-: 514:
|
||||
-: 515: // make sure a sequence is loaded
|
||||
16: 516: if (this->m_seqBuffer.getBuffLength() == 0) {
|
||||
4: 517: this->log_WARNING_LO_CS_NoSequenceActive();
|
||||
4: 518: this->cmdResponse_out(opcode, cmdSeq, Fw::COMMAND_EXECUTION_ERROR);
|
||||
4: 519: return;
|
||||
-: 520: }
|
||||
12: 521: if (!this->requireRunMode(STOPPED)) {
|
||||
4: 522: this->cmdResponse_out(opcode, cmdSeq, Fw::COMMAND_EXECUTION_ERROR);
|
||||
4: 523: return;
|
||||
-: 524: }
|
||||
8: 525: this->m_runMode = RUNNING;
|
||||
8: 526: this->performCmd_Step();
|
||||
8: 527: this->log_ACTIVITY_HI_CS_CmdStarted(this->m_logFileName);
|
||||
8: 528: this->cmdResponse_out(opcode, cmdSeq, Fw::COMMAND_OK);
|
||||
-: 529: }
|
||||
-: 530:
|
||||
36: 531: void CmdSequencerComponentImpl::CS_Step_cmdHandler(
|
||||
-: 532: FwOpcodeType opcode, U32 cmdSeq) {
|
||||
36: 533: if (this->requireRunMode(RUNNING)) {
|
||||
32: 534: this->performCmd_Step();
|
||||
-: 535: // check for special case where end of sequence entry was encountered
|
||||
32: 536: if (this->m_runMode != STOPPED) {
|
||||
28: 537: this->log_ACTIVITY_HI_CS_CmdStepped(this->m_logFileName,this->m_executedCount);
|
||||
-: 538: }
|
||||
32: 539: this->cmdResponse_out(opcode, cmdSeq, Fw::COMMAND_OK);
|
||||
-: 540: } else {
|
||||
4: 541: this->cmdResponse_out(opcode, cmdSeq, Fw::COMMAND_EXECUTION_ERROR);
|
||||
-: 542: }
|
||||
36: 543: }
|
||||
-: 544:
|
||||
8: 545: void CmdSequencerComponentImpl::CS_Auto_cmdHandler(
|
||||
-: 546: FwOpcodeType opcode, U32 cmdSeq) {
|
||||
8: 547: if (this->requireRunMode(STOPPED)) {
|
||||
4: 548: this->m_stepMode = AUTO;
|
||||
4: 549: this->log_ACTIVITY_HI_CS_ModeSwitched(SEQ_AUTO_MODE);
|
||||
4: 550: this->cmdResponse_out(opcode, cmdSeq, Fw::COMMAND_OK);
|
||||
-: 551: } else {
|
||||
4: 552: this->cmdResponse_out(opcode, cmdSeq, Fw::COMMAND_EXECUTION_ERROR);
|
||||
-: 553: }
|
||||
8: 554: }
|
||||
-: 555:
|
||||
12: 556: void CmdSequencerComponentImpl::CS_Manual_cmdHandler(
|
||||
-: 557: FwOpcodeType opcode, U32 cmdSeq) {
|
||||
12: 558: if (this->requireRunMode(STOPPED)) {
|
||||
8: 559: this->m_stepMode = MANUAL;
|
||||
8: 560: this->log_ACTIVITY_HI_CS_ModeSwitched(SEQ_STEP_MODE);
|
||||
8: 561: this->cmdResponse_out(opcode, cmdSeq, Fw::COMMAND_OK);
|
||||
-: 562: } else {
|
||||
4: 563: this->cmdResponse_out(opcode, cmdSeq, Fw::COMMAND_EXECUTION_ERROR);
|
||||
-: 564: }
|
||||
12: 565: }
|
||||
-: 566:
|
||||
-: 567: // ----------------------------------------------------------------------
|
||||
-: 568: // Helper methods
|
||||
-: 569: // ----------------------------------------------------------------------
|
||||
-: 570:
|
||||
268: 571: bool CmdSequencerComponentImpl::requireRunMode(RunMode mode) {
|
||||
268: 572: if (this->m_runMode == mode) {
|
||||
240: 573: return true;
|
||||
-: 574: } else {
|
||||
28: 575: this->log_WARNING_HI_CS_InvalidMode();
|
||||
28: 576: return false;
|
||||
-: 577: }
|
||||
-: 578: }
|
||||
-: 579:
|
||||
4: 580: void CmdSequencerComponentImpl::commandError(const U32 number,
|
||||
-: 581: const U32 opCode, const U32 error) {
|
||||
8: 582: Fw::LogStringArg fileStr(this->m_fileName);
|
||||
4: 583: this->log_WARNING_HI_CS_CommandError(fileStr,number, opCode, error);
|
||||
4: 584: this->error();
|
||||
4: 585: }
|
||||
-: 586:
|
||||
180: 587: void CmdSequencerComponentImpl::performCmd_Step(void) {
|
||||
-: 588:
|
||||
-: 589: // deserialize next record. The buffer was previously validated,
|
||||
-: 590: // so a failure here should be asserted
|
||||
-: 591:
|
||||
180: 592: Fw::SerializeStatus stat = this->m_cmdRecord.deserialize(this->m_seqBuffer);
|
||||
180: 593: FW_ASSERT(Fw::FW_SERIALIZE_OK == stat,stat);
|
||||
-: 594: // set clock time base and context from value set when sequence was loaded
|
||||
180: 595: this->m_cmdRecord.m_timeTag.setTimeBase(this->m_timeBase);
|
||||
180: 596: this->m_cmdRecord.m_timeTag.setTimeContext(this->m_timeContext);
|
||||
-: 597:
|
||||
360: 598: Fw::Time currentTime = this->getTime();
|
||||
180: 599: switch (this->m_cmdRecord.m_descriptor) {
|
||||
-: 600: case END_OF_SEQUENCE:
|
||||
20: 601: this->m_runMode = STOPPED;
|
||||
20: 602: this->sequenceComplete();
|
||||
20: 603: break;
|
||||
-: 604: case RELATIVE:
|
||||
156: 605: this->performCmd_Step_RELATIVE(currentTime);
|
||||
156: 606: break;
|
||||
-: 607: case ABSOLUTE:
|
||||
4: 608: this->performCmd_Step_ABSOLUTE(currentTime);
|
||||
4: 609: break;
|
||||
-: 610: default:
|
||||
#####: 611: FW_ASSERT(0, m_cmdRecord.m_descriptor);
|
||||
-: 612: }
|
||||
180: 613: }
|
||||
-: 614:
|
||||
32: 615: void CmdSequencerComponentImpl::sequenceComplete(void) {
|
||||
32: 616: ++this->m_sequencesCompletedCount;
|
||||
-: 617: // reset buffer
|
||||
32: 618: this->m_seqBuffer.resetSer();
|
||||
64: 619: Fw::LogStringArg fileStr(this->m_fileName);
|
||||
32: 620: this->log_ACTIVITY_HI_CS_SequenceComplete(fileStr);
|
||||
32: 621: this->tlmWrite_CS_SequencesCompleted(this->m_sequencesCompletedCount);
|
||||
32: 622: this->m_executedCount = 0;
|
||||
-: 623: // write sequence done port, if connected
|
||||
32: 624: if (this->isConnected_seqDone_OutputPort(0)) {
|
||||
32: 625: this->seqDone_out(0,0,0,Fw::COMMAND_OK);
|
||||
-: 626: }
|
||||
32: 627: }
|
||||
-: 628:
|
||||
144: 629: void CmdSequencerComponentImpl::commandComplete(const U32 opcode) {
|
||||
288: 630: Fw::LogStringArg fileStr(this->m_fileName);
|
||||
144: 631: this->log_ACTIVITY_LO_CS_CommandComplete(fileStr,this->m_executedCount, opcode);
|
||||
144: 632: ++this->m_executedCount;
|
||||
144: 633: ++this->m_totalExecutedCount;
|
||||
144: 634: this->tlmWrite_CS_CommandsExecuted(this->m_totalExecutedCount);
|
||||
144: 635: }
|
||||
-: 636:
|
||||
156: 637: void CmdSequencerComponentImpl::performCmd_Step_RELATIVE(
|
||||
-: 638: Fw::Time& currentTime) {
|
||||
-: 639:
|
||||
156: 640: this->m_cmdRecord.m_timeTag.add(currentTime.getSeconds(),currentTime.getUSeconds());
|
||||
156: 641: this->performCmd_Step_ABSOLUTE(currentTime);
|
||||
156: 642: }
|
||||
-: 643:
|
||||
160: 644: void CmdSequencerComponentImpl::performCmd_Step_ABSOLUTE(
|
||||
-: 645: Fw::Time& currentTime) {
|
||||
-: 646:
|
||||
160: 647: if (currentTime >= this->m_cmdRecord.m_timeTag) {
|
||||
140: 648: this->comCmdOut_out(0, m_cmdRecord.m_command, 0);
|
||||
140: 649: this->setCmdTimeout(currentTime);
|
||||
-: 650: } else {
|
||||
20: 651: this->m_cmdTimer.set(this->m_cmdRecord.m_timeTag);
|
||||
-: 652: }
|
||||
160: 653: }
|
||||
-: 654:
|
||||
80: 655: void CmdSequencerComponentImpl::preamble(void){
|
||||
-: 656: // make sure a buffer has been allocated
|
||||
80: 657: FW_ASSERT(this->m_seqBuffer.getBuffAddr());
|
||||
80: 658: FW_ASSERT(this->m_seqBuffer.getBuffCapacity());
|
||||
80: 659: }
|
||||
-: 660:
|
||||
#####: 661: Fw::SerializeStatus CmdSequencerComponentImpl::CmdRecord::serialize(Fw::SerializeBufferBase& buffer) const {
|
||||
-: 662:
|
||||
-: 663: // shouldn't ever be serialized
|
||||
#####: 664: FW_ASSERT(0);
|
||||
#####: 665: return Fw::FW_DESERIALIZE_TYPE_MISMATCH;
|
||||
-: 666: }
|
||||
-: 667:
|
||||
672: 668: Fw::SerializeStatus CmdSequencerComponentImpl::CmdRecord::deserialize(Fw::SerializeBufferBase& buffer) {
|
||||
-: 669:
|
||||
-: 670: U8 descEntry;
|
||||
-: 671:
|
||||
-: 672: // read the descriptor
|
||||
672: 673: Fw::SerializeStatus stat = buffer.deserialize(descEntry);
|
||||
672: 674: if (stat != Fw::FW_SERIALIZE_OK) {
|
||||
#####: 675: return stat;
|
||||
-: 676: }
|
||||
-: 677: // check the descriptor value
|
||||
672: 678: switch (descEntry) {
|
||||
-: 679: case ABSOLUTE...END_OF_SEQUENCE: // okay
|
||||
664: 680: break;
|
||||
-: 681: default:
|
||||
8: 682: return Fw::FW_DESERIALIZE_FORMAT_ERROR;
|
||||
-: 683: }
|
||||
-: 684: // cast it
|
||||
664: 685: this->m_descriptor = static_cast<CmdRecordDescriptor>(descEntry);
|
||||
-: 686: // if the descriptor is END_OF_SEQUENCE, quit
|
||||
664: 687: if (END_OF_SEQUENCE == this->m_descriptor) {
|
||||
88: 688: return Fw::FW_SERIALIZE_OK;
|
||||
-: 689: }
|
||||
-: 690: // next is time field
|
||||
-: 691:
|
||||
-: 692: U32 seconds;
|
||||
576: 693: stat = buffer.deserialize(seconds);
|
||||
576: 694: if (stat != Fw::FW_SERIALIZE_OK) {
|
||||
#####: 695: return stat;
|
||||
-: 696: }
|
||||
-: 697:
|
||||
-: 698: U32 useconds;
|
||||
-: 699:
|
||||
576: 700: stat = buffer.deserialize(useconds);
|
||||
576: 701: if (stat != Fw::FW_SERIALIZE_OK) {
|
||||
8: 702: return stat;
|
||||
-: 703: }
|
||||
-: 704:
|
||||
-: 705: // set time value for record
|
||||
568: 706: this->m_timeTag.set(seconds,useconds);
|
||||
-: 707:
|
||||
-: 708: // read the command buffer record size
|
||||
-: 709: U32 recordSize;
|
||||
568: 710: stat = buffer.deserialize(recordSize);
|
||||
568: 711: if (stat != Fw::FW_SERIALIZE_OK) {
|
||||
8: 712: return stat;
|
||||
-: 713: }
|
||||
-: 714: // validate the record size. It shouldn't be longer than the remaining buffer
|
||||
-: 715: // or longer than destination ComBuffer
|
||||
-: 716:
|
||||
560: 717: if (
|
||||
1112: 718: (recordSize > buffer.getBuffLeft()) ||
|
||||
552: 719: (recordSize > Fw::ComBuffer::SERIALIZED_SIZE - sizeof(FwPacketDescriptorType))
|
||||
-: 720:
|
||||
-: 721: ) {
|
||||
-: 722:
|
||||
8: 723: return Fw::FW_DESERIALIZE_SIZE_MISMATCH;
|
||||
-: 724: }
|
||||
-: 725:
|
||||
-: 726: // next is command buffer
|
||||
552: 727: this->m_command.resetSer();
|
||||
-: 728:
|
||||
552: 729: stat = buffer.deserialize(this->m_command.getBuffAddr(),recordSize,true);
|
||||
552: 730: if (stat != Fw::FW_SERIALIZE_OK) {
|
||||
#####: 731: return stat;
|
||||
-: 732: }
|
||||
-: 733: // set length of command buffer
|
||||
552: 734: FW_ASSERT(Fw::FW_SERIALIZE_OK == this->m_command.setBuffLen(recordSize));
|
||||
-: 735:
|
||||
552: 736: return Fw::FW_SERIALIZE_OK;
|
||||
-: 737: }
|
||||
-: 738:
|
||||
4: 739: void CmdSequencerComponentImpl::pingIn_handler(
|
||||
-: 740: NATIVE_INT_TYPE portNum, /*!< The port number*/
|
||||
-: 741: U32 key /*!< Value to return to pinger*/
|
||||
-: 742: ) {
|
||||
-: 743: // send ping response
|
||||
4: 744: this->pingOut_out(0,key);
|
||||
4: 745: }
|
||||
-: 746:
|
||||
-: 747: //! initialize CRC
|
||||
240: 748: void CmdSequencerComponentImpl::initCrc(U32 &crc) {
|
||||
240: 749: crc = 0xFFFFFFFF;
|
||||
240: 750: }
|
||||
-: 751:
|
||||
-: 752: //! update CRC
|
||||
376: 753: void CmdSequencerComponentImpl::updateCRC(U32 &crc, const BYTE* buffer, NATIVE_UINT_TYPE bufferSize) {
|
||||
376: 754: FW_ASSERT(buffer);
|
||||
19904: 755: for(NATIVE_UINT_TYPE index = 0; index < bufferSize; index++) {
|
||||
19528: 756: crc = update_crc_32(crc, buffer[index]);
|
||||
-: 757: }
|
||||
376: 758: }
|
||||
-: 759:
|
||||
-: 760: //! finalize CRC
|
||||
220: 761: void CmdSequencerComponentImpl::finalizeCRC(U32 &crc) {
|
||||
220: 762: crc = ~crc;
|
||||
220: 763: }
|
||||
-: 764:
|
||||
160: 765: void CmdSequencerComponentImpl::setCmdTimeout(const Fw::Time ¤tTime) {
|
||||
-: 766: // start timeout timer if enabled and not in step mode
|
||||
160: 767: if ((this->m_timeout > 0) and (AUTO == this->m_stepMode)) {
|
||||
144: 768: Fw::Time expTime = currentTime;
|
||||
72: 769: expTime.add(this->m_timeout,0);
|
||||
72: 770: this->m_cmdTimeoutTimer.set(expTime);
|
||||
-: 771: }
|
||||
160: 772: }
|
||||
-: 773:
|
||||
-: 774:
|
||||
12: 775:}
|
||||
-: 776:
|
||||
@ -1,9 +0,0 @@
|
||||
File '/home/tim/source/isf/Svc/CmdSequencer/CmdSequencerImpl.cpp'
|
||||
Lines executed:96.11% of 386
|
||||
Creating 'CmdSequencerImpl.cpp.gcov'
|
||||
|
||||
File '/home/tim/source/isf/Svc/CmdSequencer/CmdSequencerComponentAc.cpp'
|
||||
Lines executed:93.35% of 1369
|
||||
Creating 'CmdSequencerComponentAc.cpp.gcov'
|
||||
|
||||
Lines executed:94.04% of 1778
|
||||
@ -1,350 +0,0 @@
|
||||
Compiling ut_CYGWIN unit test for SvcCmdSequencer
|
||||
make[1]: Entering directory '/home/tim/source/isf/Svc/CmdSequencer'
|
||||
make[1]: Nothing to be done for 'test_SvcCmdSequencertestut'.
|
||||
make[1]: Leaving directory '/home/tim/source/isf/Svc/CmdSequencer'
|
||||
Running unit test for SvcCmdSequencer
|
||||
make[1]: Entering directory '/home/tim/source/isf/Svc/CmdSequencer'
|
||||
Running test/ut/runtest_CYGWIN with output dir linux-cygwin-x86-ut-gnu-bin
|
||||
test/ut/runtest_CYGWIN linux-cygwin-x86-ut-gnu-bin
|
||||
Running /home/tim/source/isf/Svc/CmdSequencer/test/ut/linux-cygwin-x86-ut-gnu-bin/test_ut
|
||||
[==========] Running 24 tests from 2 test cases.
|
||||
[----------] Global test environment set-up.
|
||||
[----------] 9 tests from Nominal
|
||||
[ RUN ] Nominal.InitTest
|
||||
|
||||
***************************************
|
||||
TESTCASE 103.1.1: Nominal Initialization
|
||||
***************************************
|
||||
[ OK ] Nominal.InitTest (0 ms)
|
||||
[ RUN ] Nominal.NominalImmediate
|
||||
|
||||
***************************************
|
||||
TESTCASE 103.1.2: Nominal Immediate Commands
|
||||
***************************************
|
||||
|
||||
***************************************
|
||||
(RQ) ISF-CMDS-001
|
||||
***************************************
|
||||
|
||||
***************************************
|
||||
(RQ) ISF-CMDS-003
|
||||
***************************************
|
||||
EVENT: (0) (2:1,1) ACTIVITY_LO: (CmdSequencer) CS_SequenceLoaded : Loaded sequence SeqF/NomImm.seq
|
||||
EVENT: (19) (2:1,1) ACTIVITY_HI: (CmdSequencer) CS_SequenceValid : Sequence SeqF/NomImm.seq is valid.
|
||||
EVENT: (0) (2:1,1) ACTIVITY_LO: (CmdSequencer) CS_SequenceLoaded : Loaded sequence SeqF/NomImm.seq
|
||||
REC 0
|
||||
EVENT: (8) (2:1,1) ACTIVITY_LO: (CmdSequencer) CS_CommandComplete : Sequence file SeqF/NomImm.seq: Command 0 (opcode 0) complete
|
||||
REC 1
|
||||
EVENT: (8) (2:1,1) ACTIVITY_LO: (CmdSequencer) CS_CommandComplete : Sequence file SeqF/NomImm.seq: Command 1 (opcode 1) complete
|
||||
REC 2
|
||||
EVENT: (8) (2:1,1) ACTIVITY_LO: (CmdSequencer) CS_CommandComplete : Sequence file SeqF/NomImm.seq: Command 2 (opcode 2) complete
|
||||
REC 3
|
||||
EVENT: (8) (2:1,1) ACTIVITY_LO: (CmdSequencer) CS_CommandComplete : Sequence file SeqF/NomImm.seq: Command 3 (opcode 3) complete
|
||||
EVENT: (9) (2:1,1) ACTIVITY_HI: (CmdSequencer) CS_SequenceComplete : Sequence file SeqF/NomImm.seq complete
|
||||
[ OK ] Nominal.NominalImmediate (2 ms)
|
||||
[ RUN ] Nominal.NominalRelative
|
||||
|
||||
***************************************
|
||||
TESTCASE 103.1.3: Nominal Relative Commands
|
||||
***************************************
|
||||
EVENT: (0) (2:0,0) ACTIVITY_LO: (CmdSequencer) CS_SequenceLoaded : Loaded sequence SeqF/NomRel.seq
|
||||
EVENT: (19) (2:0,0) ACTIVITY_HI: (CmdSequencer) CS_SequenceValid : Sequence SeqF/NomRel.seq is valid.
|
||||
EVENT: (0) (2:0,0) ACTIVITY_LO: (CmdSequencer) CS_SequenceLoaded : Loaded sequence SeqF/NomRel.seq
|
||||
EVENT: (8) (2:3,0) ACTIVITY_LO: (CmdSequencer) CS_CommandComplete : Sequence file SeqF/NomRel.seq: Command 0 (opcode 0) complete
|
||||
EVENT: (8) (2:5,0) ACTIVITY_LO: (CmdSequencer) CS_CommandComplete : Sequence file SeqF/NomRel.seq: Command 1 (opcode 1) complete
|
||||
EVENT: (8) (2:7,0) ACTIVITY_LO: (CmdSequencer) CS_CommandComplete : Sequence file SeqF/NomRel.seq: Command 2 (opcode 2) complete
|
||||
EVENT: (9) (2:7,0) ACTIVITY_HI: (CmdSequencer) CS_SequenceComplete : Sequence file SeqF/NomRel.seq complete
|
||||
[ OK ] Nominal.NominalRelative (1 ms)
|
||||
[ RUN ] Nominal.NominalTimedRelative
|
||||
|
||||
***************************************
|
||||
TESTCASE 103.1.4: Nominal Timed Relative Commands
|
||||
***************************************
|
||||
EVENT: (0) (2:0,0) ACTIVITY_LO: (CmdSequencer) CS_SequenceLoaded : Loaded sequence SeqF/NomTimedRel.seq
|
||||
EVENT: (19) (2:0,0) ACTIVITY_HI: (CmdSequencer) CS_SequenceValid : Sequence SeqF/NomTimedRel.seq is valid.
|
||||
EVENT: (0) (2:0,0) ACTIVITY_LO: (CmdSequencer) CS_SequenceLoaded : Loaded sequence SeqF/NomTimedRel.seq
|
||||
EVENT: (8) (2:3,0) ACTIVITY_LO: (CmdSequencer) CS_CommandComplete : Sequence file SeqF/NomTimedRel.seq: Command 0 (opcode 0) complete
|
||||
EVENT: (8) (2:3,0) ACTIVITY_LO: (CmdSequencer) CS_CommandComplete : Sequence file SeqF/NomTimedRel.seq: Command 1 (opcode 2) complete
|
||||
EVENT: (8) (2:5,0) ACTIVITY_LO: (CmdSequencer) CS_CommandComplete : Sequence file SeqF/NomTimedRel.seq: Command 2 (opcode 4) complete
|
||||
EVENT: (8) (2:5,0) ACTIVITY_LO: (CmdSequencer) CS_CommandComplete : Sequence file SeqF/NomTimedRel.seq: Command 3 (opcode 6) complete
|
||||
EVENT: (9) (2:5,0) ACTIVITY_HI: (CmdSequencer) CS_SequenceComplete : Sequence file SeqF/NomTimedRel.seq complete
|
||||
[ OK ] Nominal.NominalTimedRelative (2 ms)
|
||||
[ RUN ] Nominal.NominalImmediatePort
|
||||
|
||||
***************************************
|
||||
TESTCASE 103.1.5: Nominal Immediate Port Sequence
|
||||
***************************************
|
||||
EVENT: (0) (2:1,1) ACTIVITY_LO: (CmdSequencer) CS_SequenceLoaded : Loaded sequence SeqF/NomImm.seq
|
||||
EVENT: (19) (2:1,1) ACTIVITY_HI: (CmdSequencer) CS_SequenceValid : Sequence SeqF/NomImm.seq is valid.
|
||||
EVENT: (0) (2:1,1) ACTIVITY_LO: (CmdSequencer) CS_SequenceLoaded : Loaded sequence SeqF/NomImm.seq
|
||||
EVENT: (15) (2:1,1) ACTIVITY_HI: (CmdSequencer) CS_PortSequenceStarted : Local request for sequence SeqF/NomImm.seq started.
|
||||
REC 0
|
||||
EVENT: (8) (2:1,1) ACTIVITY_LO: (CmdSequencer) CS_CommandComplete : Sequence file SeqF/NomImm.seq: Command 0 (opcode 0) complete
|
||||
REC 1
|
||||
EVENT: (8) (2:1,1) ACTIVITY_LO: (CmdSequencer) CS_CommandComplete : Sequence file SeqF/NomImm.seq: Command 1 (opcode 1) complete
|
||||
REC 2
|
||||
EVENT: (8) (2:1,1) ACTIVITY_LO: (CmdSequencer) CS_CommandComplete : Sequence file SeqF/NomImm.seq: Command 2 (opcode 2) complete
|
||||
REC 3
|
||||
EVENT: (8) (2:1,1) ACTIVITY_LO: (CmdSequencer) CS_CommandComplete : Sequence file SeqF/NomImm.seq: Command 3 (opcode 3) complete
|
||||
EVENT: (9) (2:1,1) ACTIVITY_HI: (CmdSequencer) CS_SequenceComplete : Sequence file SeqF/NomImm.seq complete
|
||||
[ OK ] Nominal.NominalImmediatePort (1 ms)
|
||||
[ RUN ] Nominal.CancelCommand
|
||||
|
||||
***************************************
|
||||
TESTCASE 103.1.6: Nominal Sequence Cancel
|
||||
***************************************
|
||||
|
||||
***************************************
|
||||
(RQ) ISF-CMDS-005
|
||||
***************************************
|
||||
EVENT: (0) (2:1,1) ACTIVITY_LO: (CmdSequencer) CS_SequenceLoaded : Loaded sequence SeqF/NomImm.seq
|
||||
EVENT: (19) (2:1,1) ACTIVITY_HI: (CmdSequencer) CS_SequenceValid : Sequence SeqF/NomImm.seq is valid.
|
||||
EVENT: (0) (2:1,1) ACTIVITY_LO: (CmdSequencer) CS_SequenceLoaded : Loaded sequence SeqF/NomImm.seq
|
||||
REC 0
|
||||
EVENT: (8) (2:1,1) ACTIVITY_LO: (CmdSequencer) CS_CommandComplete : Sequence file SeqF/NomImm.seq: Command 0 (opcode 0) complete
|
||||
REC 1
|
||||
EVENT: (8) (2:1,1) ACTIVITY_LO: (CmdSequencer) CS_CommandComplete : Sequence file SeqF/NomImm.seq: Command 1 (opcode 1) complete
|
||||
REC 2
|
||||
EVENT: (8) (2:1,1) ACTIVITY_LO: (CmdSequencer) CS_CommandComplete : Sequence file SeqF/NomImm.seq: Command 2 (opcode 2) complete
|
||||
EVENT: (1) (2:1,1) ACTIVITY_HI: (CmdSequencer) CS_SequenceCanceled : Sequence file SeqF/NomImm.seq canceled
|
||||
[ OK ] Nominal.CancelCommand (2 ms)
|
||||
[ RUN ] Nominal.ManualImmediate
|
||||
|
||||
***************************************
|
||||
TESTCASE 103.1.7: Nominal Manual Sequence Stepping
|
||||
***************************************
|
||||
EVENT: (0) (2:1,1) ACTIVITY_LO: (CmdSequencer) CS_SequenceLoaded : Loaded sequence SeqF/NomImm.seq
|
||||
EVENT: (19) (2:1,1) ACTIVITY_HI: (CmdSequencer) CS_SequenceValid : Sequence SeqF/NomImm.seq is valid.
|
||||
EVENT: (17) (2:1,1) ACTIVITY_HI: (CmdSequencer) CS_ModeSwitched : Sequencer switched to 0 step mode
|
||||
EVENT: (0) (2:1,1) ACTIVITY_LO: (CmdSequencer) CS_SequenceLoaded : Loaded sequence SeqF/NomImm.seq
|
||||
EVENT: (22) (2:1,1) ACTIVITY_HI: (CmdSequencer) CS_CmdStarted : Sequence SeqF/NomImm.seq started
|
||||
REC 0
|
||||
EVENT: (8) (2:1,1) ACTIVITY_LO: (CmdSequencer) CS_CommandComplete : Sequence file SeqF/NomImm.seq: Command 0 (opcode 0) complete
|
||||
EVENT: (21) (2:1,1) ACTIVITY_HI: (CmdSequencer) CS_CmdStepped : Sequence SeqF/NomImm.seq command 1 stepped
|
||||
REC 1
|
||||
EVENT: (8) (2:1,1) ACTIVITY_LO: (CmdSequencer) CS_CommandComplete : Sequence file SeqF/NomImm.seq: Command 1 (opcode 1) complete
|
||||
EVENT: (21) (2:1,1) ACTIVITY_HI: (CmdSequencer) CS_CmdStepped : Sequence SeqF/NomImm.seq command 2 stepped
|
||||
REC 2
|
||||
EVENT: (8) (2:1,1) ACTIVITY_LO: (CmdSequencer) CS_CommandComplete : Sequence file SeqF/NomImm.seq: Command 2 (opcode 2) complete
|
||||
EVENT: (21) (2:1,1) ACTIVITY_HI: (CmdSequencer) CS_CmdStepped : Sequence SeqF/NomImm.seq command 3 stepped
|
||||
REC 3
|
||||
EVENT: (8) (2:1,1) ACTIVITY_LO: (CmdSequencer) CS_CommandComplete : Sequence file SeqF/NomImm.seq: Command 3 (opcode 3) complete
|
||||
EVENT: (9) (2:1,1) ACTIVITY_HI: (CmdSequencer) CS_SequenceComplete : Sequence file SeqF/NomImm.seq complete
|
||||
EVENT: (11) (2:1,1) WARNING_HI: (CmdSequencer) CS_InvalidMode : Invalid mode
|
||||
EVENT: (17) (2:1,1) ACTIVITY_HI: (CmdSequencer) CS_ModeSwitched : Sequencer switched to 1 step mode
|
||||
[ OK ] Nominal.ManualImmediate (1 ms)
|
||||
[ RUN ] Nominal.ManualImmediate2
|
||||
|
||||
***************************************
|
||||
TESTCASE 103.1.8: Nominal Manual Sequence Stepping - No end of sequence marker
|
||||
***************************************
|
||||
EVENT: (0) (2:1,1) ACTIVITY_LO: (CmdSequencer) CS_SequenceLoaded : Loaded sequence SeqF/NomImm.seq
|
||||
EVENT: (19) (2:1,1) ACTIVITY_HI: (CmdSequencer) CS_SequenceValid : Sequence SeqF/NomImm.seq is valid.
|
||||
EVENT: (17) (2:1,1) ACTIVITY_HI: (CmdSequencer) CS_ModeSwitched : Sequencer switched to 0 step mode
|
||||
EVENT: (0) (2:1,1) ACTIVITY_LO: (CmdSequencer) CS_SequenceLoaded : Loaded sequence SeqF/NomImm.seq
|
||||
EVENT: (22) (2:1,1) ACTIVITY_HI: (CmdSequencer) CS_CmdStarted : Sequence SeqF/NomImm.seq started
|
||||
REC 0
|
||||
EVENT: (8) (2:1,1) ACTIVITY_LO: (CmdSequencer) CS_CommandComplete : Sequence file SeqF/NomImm.seq: Command 0 (opcode 0) complete
|
||||
EVENT: (21) (2:1,1) ACTIVITY_HI: (CmdSequencer) CS_CmdStepped : Sequence SeqF/NomImm.seq command 1 stepped
|
||||
REC 1
|
||||
EVENT: (8) (2:1,1) ACTIVITY_LO: (CmdSequencer) CS_CommandComplete : Sequence file SeqF/NomImm.seq: Command 1 (opcode 1) complete
|
||||
EVENT: (21) (2:1,1) ACTIVITY_HI: (CmdSequencer) CS_CmdStepped : Sequence SeqF/NomImm.seq command 2 stepped
|
||||
REC 2
|
||||
EVENT: (8) (2:1,1) ACTIVITY_LO: (CmdSequencer) CS_CommandComplete : Sequence file SeqF/NomImm.seq: Command 2 (opcode 2) complete
|
||||
EVENT: (21) (2:1,1) ACTIVITY_HI: (CmdSequencer) CS_CmdStepped : Sequence SeqF/NomImm.seq command 3 stepped
|
||||
REC 3
|
||||
EVENT: (8) (2:1,1) ACTIVITY_LO: (CmdSequencer) CS_CommandComplete : Sequence file SeqF/NomImm.seq: Command 3 (opcode 3) complete
|
||||
EVENT: (21) (2:1,1) ACTIVITY_HI: (CmdSequencer) CS_CmdStepped : Sequence SeqF/NomImm.seq command 4 stepped
|
||||
REC 4
|
||||
EVENT: (8) (2:1,1) ACTIVITY_LO: (CmdSequencer) CS_CommandComplete : Sequence file SeqF/NomImm.seq: Command 4 (opcode 4) complete
|
||||
EVENT: (9) (2:1,1) ACTIVITY_HI: (CmdSequencer) CS_SequenceComplete : Sequence file SeqF/NomImm.seq complete
|
||||
[ OK ] Nominal.ManualImmediate2 (2 ms)
|
||||
[ RUN ] Nominal.PingTest
|
||||
|
||||
***************************************
|
||||
TESTCASE 103.1.9: Nominal ping test
|
||||
***************************************
|
||||
[ OK ] Nominal.PingTest (0 ms)
|
||||
[----------] 9 tests from Nominal (11 ms total)
|
||||
|
||||
[----------] 15 tests from OffNominal
|
||||
[ RUN ] OffNominal.MissingFile
|
||||
|
||||
***************************************
|
||||
TESTCASE 103.2.1: Off-Nominal Missing File
|
||||
***************************************
|
||||
EVENT: (6) (0:0,0) WARNING_HI: (CmdSequencer) CS_FileNotFound : Sequence file SeqF/bad_file_name.seq not found.
|
||||
[ OK ] OffNominal.MissingFile (1 ms)
|
||||
[ RUN ] OffNominal.BadFileCrc
|
||||
|
||||
***************************************
|
||||
TESTCASE 103.2.2: Off-Nominal Bad File CRC
|
||||
***************************************
|
||||
|
||||
***************************************
|
||||
(RQ) ISF-CMDS-002
|
||||
***************************************
|
||||
EVENT: (7) (2:0,0) WARNING_HI: (CmdSequencer) CS_FileCrcFailure : Sequence file SeqF/BadCrcFile.seq had invalid CRC. Stored 0x00000020, Computed 0x4D0AC4E8.
|
||||
[ OK ] OffNominal.BadFileCrc (1 ms)
|
||||
[ RUN ] OffNominal.EmptySequenceFile
|
||||
|
||||
***************************************
|
||||
TESTCASE 103.2.3: Off-Nominal Empty Sequence File
|
||||
***************************************
|
||||
EVENT: (3) (0:0,0) WARNING_HI: (CmdSequencer) CS_FileInvalid : Sequence file SeqF/empty.seq invalid. Stage: 1 Error: 0
|
||||
[ OK ] OffNominal.EmptySequenceFile (1 ms)
|
||||
[ RUN ] OffNominal.InvalidRecord
|
||||
|
||||
***************************************
|
||||
TESTCASE 103.2.4: Off-Nominal Invalid Records
|
||||
***************************************
|
||||
EVENT: (3) (2:0,0) WARNING_HI: (CmdSequencer) CS_FileInvalid : Sequence file SeqF/invalid_record.seq invalid. Stage: 6 Error: 1
|
||||
EVENT: (3) (2:0,0) WARNING_HI: (CmdSequencer) CS_FileInvalid : Sequence file SeqF/invalid_record.seq invalid. Stage: 6 Error: 1
|
||||
EVENT: (3) (2:0,0) WARNING_HI: (CmdSequencer) CS_FileInvalid : Sequence file SeqF/invalid_record.seq invalid. Stage: 6 Error: 1
|
||||
[ OK ] OffNominal.InvalidRecord (1 ms)
|
||||
[ RUN ] OffNominal.FileTooLarge
|
||||
|
||||
***************************************
|
||||
TESTCASE 103.2.5: Off-Nominal File Too Large
|
||||
***************************************
|
||||
EVENT: (5) (2:0,0) WARNING_HI: (CmdSequencer) CS_FileSizeError : Sequence file SeqF/too_large.seq too large. Size: 512
|
||||
[ OK ] OffNominal.FileTooLarge (1 ms)
|
||||
[ RUN ] OffNominal.FailedCommand
|
||||
|
||||
***************************************
|
||||
TESTCASE 103.2.6: Off-Nominal failed command
|
||||
***************************************
|
||||
|
||||
***************************************
|
||||
(RQ) ISF-CMDS-004
|
||||
***************************************
|
||||
EVENT: (0) (2:1,1) ACTIVITY_LO: (CmdSequencer) CS_SequenceLoaded : Loaded sequence SeqF/NomImm.seq
|
||||
EVENT: (19) (2:1,1) ACTIVITY_HI: (CmdSequencer) CS_SequenceValid : Sequence SeqF/NomImm.seq is valid.
|
||||
EVENT: (0) (2:1,1) ACTIVITY_LO: (CmdSequencer) CS_SequenceLoaded : Loaded sequence SeqF/NomImm.seq
|
||||
EVENT: (8) (2:1,1) ACTIVITY_LO: (CmdSequencer) CS_CommandComplete : Sequence file SeqF/NomImm.seq: Command 0 (opcode 0) complete
|
||||
EVENT: (10) (2:1,1) WARNING_HI: (CmdSequencer) CS_CommandError : Sequence file SeqF/NomImm.seq: Command 1 (opcode 1) completed with error 4
|
||||
[ OK ] OffNominal.FailedCommand (2 ms)
|
||||
[ RUN ] OffNominal.InvalidMode
|
||||
|
||||
***************************************
|
||||
TESTCASE 103.2.7: Off-Nominal invalid modes
|
||||
***************************************
|
||||
EVENT: (0) (2:1,1) ACTIVITY_LO: (CmdSequencer) CS_SequenceLoaded : Loaded sequence SeqF/NomImm.seq
|
||||
EVENT: (19) (2:1,1) ACTIVITY_HI: (CmdSequencer) CS_SequenceValid : Sequence SeqF/NomImm.seq is valid.
|
||||
EVENT: (0) (2:1,1) ACTIVITY_LO: (CmdSequencer) CS_SequenceLoaded : Loaded sequence SeqF/NomImm.seq
|
||||
REC 0
|
||||
EVENT: (11) (2:1,1) WARNING_HI: (CmdSequencer) CS_InvalidMode : Invalid mode
|
||||
EVENT: (11) (2:1,1) WARNING_HI: (CmdSequencer) CS_InvalidMode : Invalid mode
|
||||
EVENT: (11) (2:1,1) WARNING_HI: (CmdSequencer) CS_InvalidMode : Invalid mode
|
||||
EVENT: (8) (2:1,1) ACTIVITY_LO: (CmdSequencer) CS_CommandComplete : Sequence file SeqF/NomImm.seq: Command 0 (opcode 0) complete
|
||||
REC 1
|
||||
EVENT: (8) (2:1,1) ACTIVITY_LO: (CmdSequencer) CS_CommandComplete : Sequence file SeqF/NomImm.seq: Command 1 (opcode 1) complete
|
||||
REC 2
|
||||
EVENT: (8) (2:1,1) ACTIVITY_LO: (CmdSequencer) CS_CommandComplete : Sequence file SeqF/NomImm.seq: Command 2 (opcode 2) complete
|
||||
REC 3
|
||||
EVENT: (8) (2:1,1) ACTIVITY_LO: (CmdSequencer) CS_CommandComplete : Sequence file SeqF/NomImm.seq: Command 3 (opcode 3) complete
|
||||
EVENT: (9) (2:1,1) ACTIVITY_HI: (CmdSequencer) CS_SequenceComplete : Sequence file SeqF/NomImm.seq complete
|
||||
[ OK ] OffNominal.InvalidMode (1 ms)
|
||||
[ RUN ] OffNominal.NoSequenceActive
|
||||
|
||||
***************************************
|
||||
TESTCASE 103.2.8: Off-Nominal no active sequence
|
||||
***************************************
|
||||
EVENT: (18) (0:0,0) WARNING_LO: (CmdSequencer) CS_NoSequenceActive : No sequence active.
|
||||
[ OK ] OffNominal.NoSequenceActive (0 ms)
|
||||
[ RUN ] OffNominal.InvalidRecordEntries
|
||||
|
||||
***************************************
|
||||
TESTCASE 103.2.9: Invalid Record entries
|
||||
***************************************
|
||||
EVENT: (4) (2:1,1) WARNING_HI: (CmdSequencer) CS_RecordInvalid : Sequence file SeqF/BadRecord.seq: Record 0 invalid. Err: 4
|
||||
EVENT: (4) (2:1,1) WARNING_HI: (CmdSequencer) CS_RecordInvalid : Sequence file SeqF/BadRecord.seq: Record 0 invalid. Err: 4
|
||||
EVENT: (4) (2:1,1) WARNING_HI: (CmdSequencer) CS_RecordInvalid : Sequence file SeqF/BadRecord.seq: Record 0 invalid. Err: 5
|
||||
EVENT: (4) (2:1,1) WARNING_HI: (CmdSequencer) CS_RecordInvalid : Sequence file SeqF/BadRecord.seq: Record 0 invalid. Err: 5
|
||||
EVENT: (4) (2:1,1) WARNING_HI: (CmdSequencer) CS_RecordInvalid : Sequence file SeqF/BadRecord.seq: Record 0 invalid. Err: 5
|
||||
EVENT: (4) (2:1,1) WARNING_HI: (CmdSequencer) CS_RecordInvalid : Sequence file SeqF/BadRecord.seq: Record 0 invalid. Err: 5
|
||||
EVENT: (4) (2:1,1) WARNING_HI: (CmdSequencer) CS_RecordInvalid : Sequence file SeqF/BadRecord.seq: Record 0 invalid. Err: 5
|
||||
EVENT: (4) (2:1,1) WARNING_HI: (CmdSequencer) CS_RecordInvalid : Sequence file SeqF/BadRecord.seq: Record 0 invalid. Err: 5
|
||||
[ OK ] OffNominal.InvalidRecordEntries (5 ms)
|
||||
[ RUN ] OffNominal.InvalidSequenceTime
|
||||
|
||||
***************************************
|
||||
TESTCASE 103.2.10: Invalid sequence time
|
||||
***************************************
|
||||
EVENT: (13) (2:1,1) WARNING_HI: (CmdSequencer) CS_TimeBaseMismatch : Sequence file SeqF/NomImm.seq: Current time base doesn't match sequence time: base: 2 seq: 1
|
||||
EVENT: (14) (2:1,1) WARNING_HI: (CmdSequencer) CS_TimeContextMismatch : Sequence file SeqF/NomImm.seq: Current time context doesn't match sequence context: base: 0 seq: 1
|
||||
[ OK ] OffNominal.InvalidSequenceTime (2 ms)
|
||||
[ RUN ] OffNominal.UnexpectedCompletion
|
||||
|
||||
***************************************
|
||||
TESTCASE 103.2.11: Unexpected completion after completed sequence
|
||||
***************************************
|
||||
EVENT: (0) (2:1,1) ACTIVITY_LO: (CmdSequencer) CS_SequenceLoaded : Loaded sequence SeqF/NomImm.seq
|
||||
EVENT: (19) (2:1,1) ACTIVITY_HI: (CmdSequencer) CS_SequenceValid : Sequence SeqF/NomImm.seq is valid.
|
||||
EVENT: (0) (2:1,1) ACTIVITY_LO: (CmdSequencer) CS_SequenceLoaded : Loaded sequence SeqF/NomImm.seq
|
||||
REC 0
|
||||
EVENT: (8) (2:1,1) ACTIVITY_LO: (CmdSequencer) CS_CommandComplete : Sequence file SeqF/NomImm.seq: Command 0 (opcode 0) complete
|
||||
REC 1
|
||||
EVENT: (8) (2:1,1) ACTIVITY_LO: (CmdSequencer) CS_CommandComplete : Sequence file SeqF/NomImm.seq: Command 1 (opcode 1) complete
|
||||
REC 2
|
||||
EVENT: (8) (2:1,1) ACTIVITY_LO: (CmdSequencer) CS_CommandComplete : Sequence file SeqF/NomImm.seq: Command 2 (opcode 2) complete
|
||||
REC 3
|
||||
EVENT: (8) (2:1,1) ACTIVITY_LO: (CmdSequencer) CS_CommandComplete : Sequence file SeqF/NomImm.seq: Command 3 (opcode 3) complete
|
||||
EVENT: (9) (2:1,1) ACTIVITY_HI: (CmdSequencer) CS_SequenceComplete : Sequence file SeqF/NomImm.seq complete
|
||||
EVENT: (16) (2:1,1) WARNING_HI: (CmdSequencer) CS_UnexpectedCompletion : Command complete status received while no sequences active. Opcode: 16
|
||||
[ OK ] OffNominal.UnexpectedCompletion (2 ms)
|
||||
[ RUN ] OffNominal.SequenceTimeout
|
||||
|
||||
***************************************
|
||||
TESTCASE 103.2.12: Sequence timeout
|
||||
***************************************
|
||||
|
||||
***************************************
|
||||
(RQ) ISF-CMDS-006
|
||||
***************************************
|
||||
EVENT: (0) (2:1,1) ACTIVITY_LO: (CmdSequencer) CS_SequenceLoaded : Loaded sequence SeqF/NomImm.seq
|
||||
EVENT: (19) (2:1,1) ACTIVITY_HI: (CmdSequencer) CS_SequenceValid : Sequence SeqF/NomImm.seq is valid.
|
||||
EVENT: (0) (2:1,1) ACTIVITY_LO: (CmdSequencer) CS_SequenceLoaded : Loaded sequence SeqF/NomImm.seq
|
||||
EVENT: (20) (2:200,1) WARNING_HI: (CmdSequencer) CS_SequenceTimeout : Sequence SeqF/NomImm.seq timed out on command 0
|
||||
[ OK ] OffNominal.SequenceTimeout (1 ms)
|
||||
[ RUN ] OffNominal.InvalidManualModes
|
||||
|
||||
***************************************
|
||||
TESTCASE 103.2.13: Invalid Manual Modes
|
||||
***************************************
|
||||
EVENT: (18) (2:1,1) WARNING_LO: (CmdSequencer) CS_NoSequenceActive : No sequence active.
|
||||
EVENT: (0) (2:1,1) ACTIVITY_LO: (CmdSequencer) CS_SequenceLoaded : Loaded sequence SeqF/NomImm.seq
|
||||
EVENT: (19) (2:1,1) ACTIVITY_HI: (CmdSequencer) CS_SequenceValid : Sequence SeqF/NomImm.seq is valid.
|
||||
EVENT: (0) (2:1,1) ACTIVITY_LO: (CmdSequencer) CS_SequenceLoaded : Loaded sequence SeqF/NomImm.seq
|
||||
EVENT: (11) (2:1,1) WARNING_HI: (CmdSequencer) CS_InvalidMode : Invalid mode
|
||||
EVENT: (11) (2:1,1) WARNING_HI: (CmdSequencer) CS_InvalidMode : Invalid mode
|
||||
EVENT: (11) (2:1,1) WARNING_HI: (CmdSequencer) CS_InvalidMode : Invalid mode
|
||||
[ OK ] OffNominal.InvalidManualModes (2 ms)
|
||||
[ RUN ] OffNominal.FileLoadErrors
|
||||
|
||||
***************************************
|
||||
TESTCASE 103.2.14: File Load errors
|
||||
***************************************
|
||||
EVENT: (6) (2:1,1) WARNING_HI: (CmdSequencer) CS_FileNotFound : Sequence file SeqF/NomImm.seq not found.
|
||||
EVENT: (2) (2:1,1) WARNING_HI: (CmdSequencer) CS_FileReadError : Error reading sequence file SeqF/NomImm.seq
|
||||
EVENT: (3) (2:1,1) WARNING_HI: (CmdSequencer) CS_FileInvalid : Sequence file SeqF/NomImm.seq invalid. Stage: 0 Error: 2
|
||||
EVENT: (3) (2:1,1) WARNING_HI: (CmdSequencer) CS_FileInvalid : Sequence file SeqF/NomImm.seq invalid. Stage: 7 Error: 2
|
||||
EVENT: (3) (2:1,1) WARNING_HI: (CmdSequencer) CS_FileInvalid : Sequence file SeqF/NomImm.seq invalid. Stage: 8 Error: 2
|
||||
[ OK ] OffNominal.FileLoadErrors (1 ms)
|
||||
[ RUN ] OffNominal.ExtraData
|
||||
|
||||
***************************************
|
||||
TESTCASE 103.2.15: Extra Data after records
|
||||
***************************************
|
||||
|
||||
***************************************
|
||||
(RQ) ISF-CMDS-001
|
||||
***************************************
|
||||
EVENT: (12) (2:1,1) WARNING_HI: (CmdSequencer) CS_RecordMismatch : Sequence file SeqF/NomImm.seq header records mismatch: 5 in header, found 8 extra bytes.
|
||||
[ OK ] OffNominal.ExtraData (1 ms)
|
||||
[----------] 15 tests from OffNominal (22 ms total)
|
||||
|
||||
[----------] Global test environment tear-down
|
||||
[==========] 24 tests from 2 test cases ran. (33 ms total)
|
||||
[ PASSED ] 24 tests.
|
||||
make[1]: Leaving directory '/home/tim/source/isf/Svc/CmdSequencer'
|
||||
@ -147,11 +147,9 @@ This test is similar to `6.1.8`, but it includes a nominal running of the SchedI
|
||||
|
||||
This set of test cases verifies the remaining off-nominal error cases. Each test case is simulated and validated individually.
|
||||
|
||||
## 6.2 Unit Test Output
|
||||
[Unit Test Output](../test/ut/ut_output.txt)
|
||||
## 6.2 Unit Test Coverage
|
||||
|
||||
## 6.3 Unit Test Coverage
|
||||
[Coverage Output](../test/ut/SvcHealth_gcov.txt)
|
||||
To see unit test coverage run fprime-util check --coverage
|
||||
|
||||
|
||||
## 7. Change Log
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@ -1,233 +0,0 @@
|
||||
-: 0:Source:/home/tim/source/isf/Svc/Health/HealthComponentImpl.cpp
|
||||
-: 0:Programs:2
|
||||
-: 1:// ======================================================================
|
||||
-: 2:// \title Health.hpp
|
||||
-: 3:// \author Tim
|
||||
-: 4:// \brief hpp file for Health 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.
|
||||
-: 11://
|
||||
-: 18:// ======================================================================
|
||||
-: 19:
|
||||
-: 20:#include <Svc/Health/HealthComponentImpl.hpp>
|
||||
-: 21:#include "Fw/Types/BasicTypes.hpp"
|
||||
-: 22:#include <iostream>
|
||||
-: 23:#include <stdio.h>
|
||||
-: 24:#include <Fw/Types/Assert.hpp>
|
||||
-: 25:
|
||||
-: 26:namespace Svc {
|
||||
-: 27:
|
||||
-: 28: // ----------------------------------------------------------------------
|
||||
-: 29: // Construction, initialization, and destruction
|
||||
-: 30: // ----------------------------------------------------------------------
|
||||
-: 31:
|
||||
10: 32: HealthImpl::HealthImpl(
|
||||
-: 33:#if FW_OBJECT_NAMES == 1
|
||||
-: 34: const char * const compName
|
||||
-: 35:#endif
|
||||
-: 36: ) :
|
||||
-: 37:#if FW_OBJECT_NAMES == 1
|
||||
-: 38: HealthComponentBase(compName),
|
||||
-: 39:#endif
|
||||
-: 40: m_numPingEntries(0),
|
||||
-: 41: m_key(0),
|
||||
-: 42: m_watchDogCode(0),
|
||||
-: 43: m_warnings(0),
|
||||
-: 44: m_enabled(HLTH_CHK_ENABLED),
|
||||
10: 45: queue_depth(0) {
|
||||
-: 46: // clear tracker by disabling pings
|
||||
110: 47: for (NATIVE_UINT_TYPE entry = 0;
|
||||
110: 48: entry < FW_NUM_ARRAY_ELEMENTS(this->m_pingTrackerEntries);
|
||||
-: 49: entry++) {
|
||||
100: 50: this->m_pingTrackerEntries[entry].enabled = HLTH_PING_DISABLED;
|
||||
-: 51: }
|
||||
10: 52: }
|
||||
-: 53:
|
||||
10: 54: void HealthImpl::init(const NATIVE_INT_TYPE queueDepth, const NATIVE_INT_TYPE instance) {
|
||||
10: 55: HealthComponentBase::init(queueDepth, instance);
|
||||
10: 56: this->queue_depth = queueDepth;
|
||||
-: 57:
|
||||
10: 58: }
|
||||
-: 59:
|
||||
10: 60: void HealthImpl::setPingEntries(PingEntry* pingEntries, NATIVE_INT_TYPE numPingEntries, U32 watchDogCode) {
|
||||
-: 61:
|
||||
10: 62: FW_ASSERT(pingEntries);
|
||||
-: 63: // make sure not asking for more pings than ports
|
||||
10: 64: FW_ASSERT(numPingEntries <= NUM_PINGSEND_OUTPUT_PORTS);
|
||||
-: 65:
|
||||
10: 66: this->m_numPingEntries = numPingEntries;
|
||||
10: 67: this->m_watchDogCode = watchDogCode;
|
||||
-: 68:
|
||||
-: 69: // copy entries to private data
|
||||
110: 70: for (NATIVE_INT_TYPE entry = 0; entry < numPingEntries; entry++) {
|
||||
100: 71: FW_ASSERT(pingEntries[entry].warnCycles <= pingEntries[entry].fatalCycles, pingEntries[entry].warnCycles, pingEntries[entry].fatalCycles);
|
||||
100: 72: this->m_pingTrackerEntries[entry].entry = pingEntries[entry];
|
||||
100: 73: this->m_pingTrackerEntries[entry].cycleCount = 0;
|
||||
100: 74: this->m_pingTrackerEntries[entry].enabled = HLTH_PING_ENABLED;
|
||||
100: 75: this->m_pingTrackerEntries[entry].key = 0;
|
||||
-: 76: }
|
||||
10: 77: }
|
||||
-: 78:
|
||||
10: 79: HealthImpl::~HealthImpl(void) {
|
||||
-: 80:
|
||||
10: 81: }
|
||||
-: 82:
|
||||
-: 83: // ----------------------------------------------------------------------
|
||||
-: 84: // Handler implementations for user-defined typed input ports
|
||||
-: 85: // ----------------------------------------------------------------------
|
||||
-: 86:
|
||||
281: 87: void HealthImpl::PingReturn_handler(const NATIVE_INT_TYPE portNum, U32 key) {
|
||||
-: 88: // verify the key value
|
||||
281: 89: if (key != this->m_pingTrackerEntries[portNum].key) {
|
||||
20: 90: Fw::LogStringArg _arg = this->m_pingTrackerEntries[portNum].entry.entryName;
|
||||
10: 91: this->log_FATAL_HLTH_PING_WRONG_KEY(_arg,key);
|
||||
-: 92: } else {
|
||||
-: 93: // reset the counter and clear the key
|
||||
271: 94: this->m_pingTrackerEntries[portNum].cycleCount = 0;
|
||||
271: 95: this->m_pingTrackerEntries[portNum].key = 0;
|
||||
-: 96: }
|
||||
-: 97:
|
||||
281: 98: }
|
||||
-: 99:
|
||||
302: 100: void HealthImpl::Run_handler(const NATIVE_INT_TYPE portNum, NATIVE_UINT_TYPE context) {
|
||||
-: 101: //dispatch messages
|
||||
563: 102: for (NATIVE_UINT_TYPE i = 0; i < this->queue_depth; i++) {
|
||||
563: 103: MsgDispatchStatus stat = this->doDispatch();
|
||||
563: 104: if (MSG_DISPATCH_EMPTY == stat) {
|
||||
302: 105: break;
|
||||
-: 106: }
|
||||
261: 107: FW_ASSERT(MSG_DISPATCH_OK == stat);
|
||||
-: 108: }
|
||||
-: 109:
|
||||
302: 110: if (this->m_enabled) {
|
||||
-: 111: // cycle through ping table, pinging ports that are not awaiting a reply
|
||||
-: 112: // for ports that are awaiting a reply, decrement their counters
|
||||
-: 113: // and check for violations
|
||||
-: 114:
|
||||
2222: 115: for (NATIVE_UINT_TYPE entry = 0; entry < this->m_numPingEntries; entry++) {
|
||||
2020: 116: if (HLTH_PING_ENABLED == this->m_pingTrackerEntries[entry].enabled) {
|
||||
-: 117: // If clear entry
|
||||
1920: 118: if (0 == this->m_pingTrackerEntries[entry].cycleCount) {
|
||||
-: 119: // start a ping
|
||||
421: 120: this->m_pingTrackerEntries[entry].key = this->m_key;
|
||||
-: 121: // send ping
|
||||
421: 122: this->PingSend_out(entry, this->m_pingTrackerEntries[entry].key);
|
||||
-: 123: // increment key
|
||||
421: 124: this->m_key++;
|
||||
-: 125: // increment cycles for the entry
|
||||
421: 126: this->m_pingTrackerEntries[entry].cycleCount++;
|
||||
-: 127: } else {
|
||||
-: 128: // check to see if it is at warning threshold and decrement cycle count
|
||||
2998: 129: if (this->m_pingTrackerEntries[entry].cycleCount++ ==
|
||||
1499: 130: this->m_pingTrackerEntries[entry].entry.warnCycles) {
|
||||
42: 131: Fw::LogStringArg _arg = this->m_pingTrackerEntries[entry].entry.entryName;
|
||||
21: 132: this->log_WARNING_HI_HLTH_PING_WARN(_arg);
|
||||
21: 133: this->tlmWrite_PingLateWarnings(++this->m_warnings);
|
||||
-: 134: } else {
|
||||
-: 135: // check for FATAL timeout value
|
||||
2956: 136: if (this->m_pingTrackerEntries[entry].entry.fatalCycles ==
|
||||
1478: 137: this->m_pingTrackerEntries[entry].cycleCount) {
|
||||
40: 138: Fw::LogStringArg _arg = this->m_pingTrackerEntries[entry].entry.entryName;
|
||||
20: 139: this->log_FATAL_HLTH_PING_LATE(_arg);
|
||||
-: 140: }
|
||||
-: 141: } // if at warning or fatal threshold
|
||||
-: 142: } // if clear entry
|
||||
-: 143: } // if entry has ping enabled
|
||||
-: 144: } // for each entry
|
||||
-: 145:
|
||||
-: 146: // do other specialized platform checks (e.g. VxWorks suspended tasks)
|
||||
202: 147: this->doOtherChecks();
|
||||
-: 148:
|
||||
-: 149: } // If health checking is enabled
|
||||
-: 150:
|
||||
-: 151: // stroke watchdog.
|
||||
302: 152: if (this->isConnected_WdogStroke_OutputPort(0)) {
|
||||
302: 153: this->WdogStroke_out(0,this->m_watchDogCode);
|
||||
-: 154: }
|
||||
302: 155: }
|
||||
-: 156:
|
||||
-: 157: // ----------------------------------------------------------------------
|
||||
-: 158: // Command handler implementations
|
||||
-: 159: // ----------------------------------------------------------------------
|
||||
-: 160:
|
||||
5: 161: void HealthImpl::HLTH_ENABLE_cmdHandler(const FwOpcodeType opCode, U32 cmdSeq, HealthEnabled enable) {
|
||||
5: 162: this->m_enabled = enable;
|
||||
5: 163: HealthIsEnabled isEnabled = HEALTH_CHECK_DISABLED;
|
||||
5: 164: if (enable) {
|
||||
2: 165: isEnabled = HEALTH_CHECK_ENABLED;
|
||||
-: 166: }
|
||||
5: 167: this->log_ACTIVITY_HI_HLTH_CHECK_ENABLE(isEnabled);
|
||||
5: 168: this->cmdResponse_out(opCode,cmdSeq,Fw::COMMAND_OK);
|
||||
5: 169: }
|
||||
-: 170:
|
||||
-: 171:
|
||||
23: 172: void HealthImpl::HLTH_PING_ENABLE_cmdHandler(const FwOpcodeType opCode, U32 cmdSeq, const Fw::CmdStringArg& entry, PingEnabled enable) {
|
||||
-: 173: // check to see if entry is in range
|
||||
23: 174: NATIVE_INT_TYPE entryIndex = this->findEntry(entry);
|
||||
-: 175:
|
||||
23: 176: if (-1 == entryIndex) {
|
||||
1: 177: this->cmdResponse_out(opCode,cmdSeq,Fw::COMMAND_VALIDATION_ERROR);
|
||||
3: 178: return;
|
||||
-: 179: }
|
||||
-: 180:
|
||||
-: 181: // check enable value
|
||||
22: 182: if (enable != HealthImpl::HLTH_PING_DISABLED && enable != HealthImpl::HLTH_PING_ENABLED) {
|
||||
1: 183: this->cmdResponse_out(opCode,cmdSeq,Fw::COMMAND_VALIDATION_ERROR);
|
||||
1: 184: return;
|
||||
-: 185: }
|
||||
-: 186:
|
||||
21: 187: this->m_pingTrackerEntries[entryIndex].enabled = enable;
|
||||
21: 188: HealthPingIsEnabled isEnabled = HEALTH_PING_DISABLED;
|
||||
21: 189: if (enable) {
|
||||
10: 190: isEnabled = HEALTH_PING_ENABLED;
|
||||
-: 191: }
|
||||
42: 192: Fw::LogStringArg arg;
|
||||
21: 193: arg = entry;
|
||||
21: 194: this->log_ACTIVITY_HI_HLTH_CHECK_PING(isEnabled,arg);
|
||||
21: 195: this->cmdResponse_out(opCode,cmdSeq,Fw::COMMAND_OK);
|
||||
-: 196: }
|
||||
-: 197:
|
||||
13: 198: void HealthImpl::HLTH_CHNG_PING_cmdHandler(const FwOpcodeType opCode, U32 cmdSeq, const Fw::CmdStringArg& entry, U32 warningValue, U32 fatalValue) {
|
||||
-: 199: // check to see if entry is in range
|
||||
13: 200: NATIVE_INT_TYPE entryIndex = this->findEntry(entry);
|
||||
13: 201: if (-1 == entryIndex) {
|
||||
1: 202: this->cmdResponse_out(opCode,cmdSeq,Fw::COMMAND_VALIDATION_ERROR);
|
||||
3: 203: return;
|
||||
-: 204: }
|
||||
-: 205:
|
||||
-: 206: //check to see if warningValue less than or equal to fatalValue
|
||||
12: 207: if (warningValue > fatalValue) {
|
||||
2: 208: Fw::LogStringArg arg;
|
||||
1: 209: arg = entry;
|
||||
1: 210: this->log_WARNING_HI_HLTH_PING_INVALID_VALUES(arg,warningValue,fatalValue);
|
||||
1: 211: this->cmdResponse_out(opCode,cmdSeq,Fw::COMMAND_VALIDATION_ERROR);
|
||||
1: 212: return;
|
||||
-: 213: }
|
||||
-: 214:
|
||||
11: 215: this->m_pingTrackerEntries[entryIndex].entry.warnCycles = warningValue;
|
||||
11: 216: this->m_pingTrackerEntries[entryIndex].entry.fatalCycles = fatalValue;
|
||||
22: 217: Fw::LogStringArg arg = entry;
|
||||
11: 218: this->log_ACTIVITY_HI_HLTH_PING_UPDATED(arg,warningValue,fatalValue);
|
||||
11: 219: this->cmdResponse_out(opCode,cmdSeq,Fw::COMMAND_OK);
|
||||
-: 220: }
|
||||
-: 221:
|
||||
36: 222: NATIVE_INT_TYPE HealthImpl::findEntry(Fw::CmdStringArg entry) {
|
||||
-: 223:
|
||||
-: 224: // walk through entries
|
||||
191: 225: for (NATIVE_UINT_TYPE tableEntry = 0; tableEntry < NUM_PINGSEND_OUTPUT_PORTS; tableEntry++) {
|
||||
189: 226: if (entry == this->m_pingTrackerEntries[tableEntry].entry.entryName) {
|
||||
34: 227: return tableEntry;
|
||||
-: 228: }
|
||||
-: 229: }
|
||||
4: 230: Fw::LogStringArg arg = entry;
|
||||
2: 231: this->log_WARNING_LO_HLTH_CHECK_LOOKUP_ERROR(arg);
|
||||
-: 232:
|
||||
2: 233: return -1;
|
||||
-: 234: }
|
||||
-: 235:
|
||||
-: 236:
|
||||
-: 237:
|
||||
3: 238:} // end namespace Svc
|
||||
@ -1,165 +0,0 @@
|
||||
-: 0:Source:/home/tim/source/isf/Svc/Health/HealthComponentImpl.hpp
|
||||
-: 0:Programs:2
|
||||
-: 1:// ======================================================================
|
||||
-: 2:// \title Health.hpp
|
||||
-: 3:// \author Tim, J.Perez
|
||||
-: 4:// \brief hpp file for Health 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.
|
||||
-: 11://
|
||||
-: 18:// ======================================================================
|
||||
-: 19:
|
||||
-: 20:#ifndef Health_HPP
|
||||
-: 21:#define Health_HPP
|
||||
-: 22:
|
||||
-: 23:#include <Svc/Health/HealthComponentAc.hpp>
|
||||
-: 24:#include <Fw/Types/EightyCharString.hpp>
|
||||
-: 25:
|
||||
-: 26:namespace Svc {
|
||||
-: 27:
|
||||
-: 28: //! \class HealthImpl
|
||||
-: 29: //! \brief Health component implementation class
|
||||
-: 30: //!
|
||||
-: 31: //! The health component iterates through each entry
|
||||
-: 32: //! in its table and checks its status. If an ping entry
|
||||
-: 33: //! tracker is enabled, it will ping its corresponding port
|
||||
-: 34: //! with a provided key. If a ping return is outstanding,
|
||||
-: 35: //! a counter is decremented, and its value is checked
|
||||
-: 36: //! against warning and fault thresholds. A watchdog is
|
||||
-: 37: //! always stroked in the run handler.
|
||||
-: 38:
|
||||
-: 39: class HealthImpl: public HealthComponentBase {
|
||||
-: 40:
|
||||
-: 41: public:
|
||||
-: 42: //! \brief struct for ping entry
|
||||
-: 43: //!
|
||||
-: 44: //! struct for ping entry thresholds.
|
||||
-: 45: //! Countdown is via calls to the run()
|
||||
-: 46: //! port. If no response by warnCycles,
|
||||
-: 47: //! an EVR will be generated and telemetry
|
||||
-: 48: //! count will be updated. If no response
|
||||
-: 49: //! by fatalCycles, component will send FATAL
|
||||
-: 50: //! event. A descriptive name is stored in entryName
|
||||
-: 51: //! for events.
|
||||
100: 52: struct PingEntry {
|
||||
-: 53: NATIVE_UINT_TYPE warnCycles; //!< number of cycles before WARNING
|
||||
-: 54: NATIVE_UINT_TYPE fatalCycles; //!< number of cycles before FATAL
|
||||
-: 55: Fw::EightyCharString entryName; //!< the name of the entry
|
||||
-: 56: };
|
||||
-: 57:
|
||||
-: 58: //! \brief HealthImpl constructor
|
||||
-: 59: //!
|
||||
-: 60: //! The constructor for Health
|
||||
-: 61: //!
|
||||
-: 62: //! \param compName component name
|
||||
-: 63: HealthImpl(
|
||||
-: 64:#if FW_OBJECT_NAMES == 1
|
||||
-: 65: const char * const compName //!< The component name
|
||||
-: 66:#endif
|
||||
-: 67: );
|
||||
-: 68:
|
||||
-: 69: //! \brief HealthImpl initialization function
|
||||
-: 70: //!
|
||||
-: 71: //! Initializes the autocoded base class, ping table, and data members
|
||||
-: 72: //!
|
||||
-: 73: //! \param queueDepth Depth of queue
|
||||
-: 74: //! \param instance The instance number
|
||||
-: 75: void init(const NATIVE_INT_TYPE queueDepth, const NATIVE_INT_TYPE instance);
|
||||
-: 76:
|
||||
-: 77: //! \brief Set ping entry tables
|
||||
-: 78: //!
|
||||
-: 79: //! Provides a table of ping entries
|
||||
-: 80: //!
|
||||
-: 81: //! \param pingEntries Pointer to provided ping table entries
|
||||
-: 82: //! \param numPingEntries Number of ping entries in table
|
||||
-: 83: //! \param watchDogCode Value that is sent to watchdog
|
||||
-: 84: void setPingEntries(PingEntry* pingEntries, NATIVE_INT_TYPE numPingEntries, U32 watchDogCode);
|
||||
-: 85:
|
||||
-: 86: //! \brief Component destructor
|
||||
-: 87: //!
|
||||
-: 88: //! The destructor for HealthImpl is empty
|
||||
-: 89: ~HealthImpl(void);
|
||||
-: 90:
|
||||
-: 91: PROTECTED:
|
||||
-: 92:
|
||||
-: 93: //! \brief additional checks function
|
||||
-: 94: //!
|
||||
-: 95: //! Does additional checks based on the platform
|
||||
-: 96: virtual void doOtherChecks(void);
|
||||
-: 97:
|
||||
-: 98: PRIVATE:
|
||||
-: 99:
|
||||
-: 100: //! \brief ping return handler
|
||||
-: 101: //!
|
||||
-: 102: //! Handler implementation for pingReturn
|
||||
-: 103: //!
|
||||
-: 104: //! \param portNum Port number
|
||||
-: 105: //! \param key Key value
|
||||
-: 106: void PingReturn_handler(const NATIVE_INT_TYPE portNum, U32 key);
|
||||
-: 107:
|
||||
-: 108: //! \brief run handler
|
||||
-: 109: //!
|
||||
-: 110: //! Handler implementation for run
|
||||
-: 111: //!
|
||||
-: 112: //! \param portNum Port number
|
||||
-: 113: //! \param context Port Context
|
||||
-: 114: void Run_handler(const NATIVE_INT_TYPE portNum, NATIVE_UINT_TYPE context);
|
||||
-: 115:
|
||||
-: 116: //! \brief HLTH_ENABLE handler
|
||||
-: 117: //!
|
||||
-: 118: //! Implementation for HLTH_ENABLE command handler
|
||||
-: 119: //!
|
||||
-: 120: //! \param opCode Command opcode
|
||||
-: 121: //! \param cmdSeq Command sequence
|
||||
-: 122: //! \param enable Enum for enabling/disabling tracker
|
||||
-: 123: void HLTH_ENABLE_cmdHandler(const FwOpcodeType opCode, U32 cmdSeq, HealthEnabled enable);
|
||||
-: 124:
|
||||
-: 125: //! \brief HLTH_PING_ENABLE handler
|
||||
-: 126: //!
|
||||
-: 127: //! Handler for command HLTH_PING_ENABLE
|
||||
-: 128: //!
|
||||
-: 129: //! \param opCode Command opcode
|
||||
-: 130: //! \param cmdSeq Command sequence
|
||||
-: 131: //! \param entry Ping entry number
|
||||
-: 132: //! \param enable Enum for enabling/disabling tracker
|
||||
-: 133: void HLTH_PING_ENABLE_cmdHandler(FwOpcodeType opCode, U32 cmdSeq, const Fw::CmdStringArg& entry, PingEnabled enable);
|
||||
-: 134:
|
||||
-: 135: //! \brief HLTH_CHNG_PING handler
|
||||
-: 136: //!
|
||||
-: 137: //! Implementation for HLTH_CHNG_PING command handler
|
||||
-: 138: //!
|
||||
-: 139: //! \param opCode Command opcode
|
||||
-: 140: //! \param cmdSeq Command sequence
|
||||
-: 141: //! \param entry Ping entry number
|
||||
-: 142: //! \param warningValue Warning threshold value
|
||||
-: 143: //! \param fatalValue Fatal threshold value
|
||||
-: 144: void HLTH_CHNG_PING_cmdHandler(const FwOpcodeType opCode, U32 cmdSeq, const Fw::CmdStringArg& entry, U32 warningValue, U32 fatalValue);
|
||||
-: 145:
|
||||
-: 146: //! \brief ping tracker struct
|
||||
-: 147: //!
|
||||
-: 148: //! Array for storing ping table entries
|
||||
200: 149: struct PingTracker {
|
||||
-: 150: PingEntry entry; //!< entry passed by user
|
||||
-: 151: U32 cycleCount; //!< current cycle count
|
||||
-: 152: U32 key; //!< key passed to ping
|
||||
-: 153: PingEnabled enabled; //!< if current ping result is checked
|
||||
-: 154: } m_pingTrackerEntries[NUM_PINGSEND_OUTPUT_PORTS];
|
||||
-: 155:
|
||||
-: 156: NATIVE_INT_TYPE findEntry(Fw::CmdStringArg entry);
|
||||
-: 157:
|
||||
-: 158: //! Private member data
|
||||
-: 159: U32 m_numPingEntries; //!< stores number of entries passed to constructor
|
||||
-: 160: U32 m_key; //!< current key value. Just increments for each ping entry.
|
||||
-: 161: U32 m_watchDogCode; //!< stores code used for watchdog stroking
|
||||
-: 162: U32 m_warnings; //!< number of slip warnings issued
|
||||
-: 163: HealthEnabled m_enabled; //!< if the pinger is enabled
|
||||
-: 164: U32 queue_depth; //!< queue depth passed by user
|
||||
-: 165:
|
||||
-: 166: };
|
||||
-: 167:
|
||||
-: 168:} // end namespace Svc
|
||||
-: 169:
|
||||
-: 170:#endif
|
||||
@ -1,33 +0,0 @@
|
||||
File '/home/tim/source/isf/Svc/Health/HealthComponentImpl.cpp'
|
||||
Lines executed:100.00% of 106
|
||||
Creating 'HealthComponentImpl.cpp.gcov'
|
||||
|
||||
File '/usr/lib/gcc/i686-pc-cygwin/5.4.0/include/c++/iostream'
|
||||
Lines executed:100.00% of 1
|
||||
Creating 'iostream.gcov'
|
||||
|
||||
File '/home/tim/source/isf/Fw/Log/LogString.hpp'
|
||||
Lines executed:0.00% of 1
|
||||
Creating 'LogString.hpp.gcov'
|
||||
|
||||
File '/home/tim/source/isf/Fw/Cmd/CmdString.hpp'
|
||||
Lines executed:100.00% of 1
|
||||
Creating 'CmdString.hpp.gcov'
|
||||
|
||||
File '/home/tim/source/isf/Fw/Types/StringType.hpp'
|
||||
Lines executed:0.00% of 1
|
||||
Creating 'StringType.hpp.gcov'
|
||||
|
||||
File '/home/tim/source/isf/Fw/Types/Serializable.hpp'
|
||||
Lines executed:0.00% of 1
|
||||
Creating 'Serializable.hpp.gcov'
|
||||
|
||||
File '/home/tim/source/isf/Svc/Health/HealthComponentImpl.hpp'
|
||||
Lines executed:100.00% of 2
|
||||
Creating 'HealthComponentImpl.hpp.gcov'
|
||||
|
||||
File '/home/tim/source/isf/Svc/Health/HealthComponentAc.cpp'
|
||||
Lines executed:85.21% of 676
|
||||
Creating 'HealthComponentAc.cpp.gcov'
|
||||
|
||||
Lines executed:86.95% of 789
|
||||
@ -1,240 +0,0 @@
|
||||
Running unit test for SvcHealth
|
||||
make[1]: Entering directory '/home/tim/source/isf/Svc/Health'
|
||||
Running test/ut/runtest_CYGWIN with output dir linux-cygwin-x86-ut-gnu-bin
|
||||
test/ut/runtest_CYGWIN linux-cygwin-x86-ut-gnu-bin
|
||||
Running /home/tim/source/isf/Svc/Health/test/ut/linux-cygwin-x86-ut-gnu-bin/test_ut
|
||||
[==========] Running 10 tests from 1 test case.
|
||||
[----------] Global test environment set-up.
|
||||
[----------] 10 tests from Test
|
||||
[ RUN ] Test.NominalTlm
|
||||
|
||||
***************************************
|
||||
TESTCASE 900.1.1: Nominal Telemetry
|
||||
***************************************
|
||||
|
||||
***************************************
|
||||
(RQ) ISF-HTH-001
|
||||
***************************************
|
||||
|
||||
***************************************
|
||||
The Svc::Health component shall ping each output port specified in the provided table.
|
||||
***************************************
|
||||
[ OK ] Test.NominalTlm (1 ms)
|
||||
[ RUN ] Test.WarningTlm
|
||||
|
||||
***************************************
|
||||
TESTCASE 900.1.2: Warning Telemetry
|
||||
***************************************
|
||||
|
||||
***************************************
|
||||
(RQ) ISF-HTH-002
|
||||
***************************************
|
||||
|
||||
***************************************
|
||||
The Svc::Health component shall track the timeout cycles for each component.
|
||||
***************************************
|
||||
[ OK ] Test.WarningTlm (0 ms)
|
||||
[ RUN ] Test.FaultTlm
|
||||
|
||||
***************************************
|
||||
TESTCASE 900.1.3: Fault Telemetry
|
||||
***************************************
|
||||
|
||||
***************************************
|
||||
(RQ) ISF-HTH-003
|
||||
***************************************
|
||||
|
||||
***************************************
|
||||
The Svc::Health component shall issue a FATAL event if a component fails to return a ping by the specified timeout.
|
||||
***************************************
|
||||
EVENT: (0) (0:0,0) WARNING_HI: (Health) HLTH_PING_WARN : Ping entry task0 late warning
|
||||
EVENT: (0) (0:0,0) WARNING_HI: (Health) HLTH_PING_WARN : Ping entry task1 late warning
|
||||
EVENT: (0) (0:0,0) WARNING_HI: (Health) HLTH_PING_WARN : Ping entry task2 late warning
|
||||
EVENT: (0) (0:0,0) WARNING_HI: (Health) HLTH_PING_WARN : Ping entry task3 late warning
|
||||
EVENT: (0) (0:0,0) WARNING_HI: (Health) HLTH_PING_WARN : Ping entry task4 late warning
|
||||
EVENT: (0) (0:0,0) WARNING_HI: (Health) HLTH_PING_WARN : Ping entry task5 late warning
|
||||
EVENT: (0) (0:0,0) WARNING_HI: (Health) HLTH_PING_WARN : Ping entry task6 late warning
|
||||
EVENT: (0) (0:0,0) WARNING_HI: (Health) HLTH_PING_WARN : Ping entry task7 late warning
|
||||
EVENT: (0) (0:0,0) WARNING_HI: (Health) HLTH_PING_WARN : Ping entry task8 late warning
|
||||
EVENT: (0) (0:0,0) WARNING_HI: (Health) HLTH_PING_WARN : Ping entry task9 late warning
|
||||
EVENT: (1) (0:0,0) FATAL: (Health) HLTH_PING_LATE : Ping entry task0 did not respond
|
||||
EVENT: (1) (0:0,0) FATAL: (Health) HLTH_PING_LATE : Ping entry task1 did not respond
|
||||
EVENT: (1) (0:0,0) FATAL: (Health) HLTH_PING_LATE : Ping entry task2 did not respond
|
||||
EVENT: (1) (0:0,0) FATAL: (Health) HLTH_PING_LATE : Ping entry task3 did not respond
|
||||
EVENT: (1) (0:0,0) FATAL: (Health) HLTH_PING_LATE : Ping entry task4 did not respond
|
||||
EVENT: (1) (0:0,0) FATAL: (Health) HLTH_PING_LATE : Ping entry task5 did not respond
|
||||
EVENT: (1) (0:0,0) FATAL: (Health) HLTH_PING_LATE : Ping entry task6 did not respond
|
||||
EVENT: (1) (0:0,0) FATAL: (Health) HLTH_PING_LATE : Ping entry task7 did not respond
|
||||
EVENT: (1) (0:0,0) FATAL: (Health) HLTH_PING_LATE : Ping entry task8 did not respond
|
||||
EVENT: (1) (0:0,0) FATAL: (Health) HLTH_PING_LATE : Ping entry task9 did not respond
|
||||
[ OK ] Test.FaultTlm (1 ms)
|
||||
[ RUN ] Test.DisableAllMonitoring
|
||||
|
||||
***************************************
|
||||
TESTCASE 900.1.4: Enable/Disable all monitoring
|
||||
***************************************
|
||||
|
||||
***************************************
|
||||
(RQ) ISF-HTH-004
|
||||
***************************************
|
||||
|
||||
***************************************
|
||||
The Svc::Health component shall have a command to enable or disable all monitoring.
|
||||
***************************************
|
||||
EVENT: (0) (0:0,0) WARNING_HI: (Health) HLTH_PING_WARN : Ping entry task0 late warning
|
||||
EVENT: (0) (0:0,0) WARNING_HI: (Health) HLTH_PING_WARN : Ping entry task1 late warning
|
||||
EVENT: (0) (0:0,0) WARNING_HI: (Health) HLTH_PING_WARN : Ping entry task2 late warning
|
||||
EVENT: (0) (0:0,0) WARNING_HI: (Health) HLTH_PING_WARN : Ping entry task3 late warning
|
||||
EVENT: (0) (0:0,0) WARNING_HI: (Health) HLTH_PING_WARN : Ping entry task4 late warning
|
||||
EVENT: (0) (0:0,0) WARNING_HI: (Health) HLTH_PING_WARN : Ping entry task5 late warning
|
||||
EVENT: (0) (0:0,0) WARNING_HI: (Health) HLTH_PING_WARN : Ping entry task6 late warning
|
||||
EVENT: (0) (0:0,0) WARNING_HI: (Health) HLTH_PING_WARN : Ping entry task7 late warning
|
||||
EVENT: (0) (0:0,0) WARNING_HI: (Health) HLTH_PING_WARN : Ping entry task8 late warning
|
||||
EVENT: (0) (0:0,0) WARNING_HI: (Health) HLTH_PING_WARN : Ping entry task9 late warning
|
||||
EVENT: (3) (0:0,0) ACTIVITY_HI: (Health) HLTH_CHECK_ENABLE : Health checking set to 0
|
||||
EVENT: (3) (0:0,0) ACTIVITY_HI: (Health) HLTH_CHECK_ENABLE : Health checking set to 1
|
||||
EVENT: (1) (0:0,0) FATAL: (Health) HLTH_PING_LATE : Ping entry task0 did not respond
|
||||
EVENT: (1) (0:0,0) FATAL: (Health) HLTH_PING_LATE : Ping entry task1 did not respond
|
||||
EVENT: (1) (0:0,0) FATAL: (Health) HLTH_PING_LATE : Ping entry task2 did not respond
|
||||
EVENT: (1) (0:0,0) FATAL: (Health) HLTH_PING_LATE : Ping entry task3 did not respond
|
||||
EVENT: (1) (0:0,0) FATAL: (Health) HLTH_PING_LATE : Ping entry task4 did not respond
|
||||
EVENT: (1) (0:0,0) FATAL: (Health) HLTH_PING_LATE : Ping entry task5 did not respond
|
||||
EVENT: (1) (0:0,0) FATAL: (Health) HLTH_PING_LATE : Ping entry task6 did not respond
|
||||
EVENT: (1) (0:0,0) FATAL: (Health) HLTH_PING_LATE : Ping entry task7 did not respond
|
||||
EVENT: (1) (0:0,0) FATAL: (Health) HLTH_PING_LATE : Ping entry task8 did not respond
|
||||
EVENT: (1) (0:0,0) FATAL: (Health) HLTH_PING_LATE : Ping entry task9 did not respond
|
||||
[ OK ] Test.DisableAllMonitoring (0 ms)
|
||||
[ RUN ] Test.DisableOneMonitoring
|
||||
|
||||
***************************************
|
||||
TESTCASE 900.1.5: Enable/Disable individual monitors
|
||||
***************************************
|
||||
|
||||
***************************************
|
||||
(RQ) ISF-HTH-005
|
||||
***************************************
|
||||
|
||||
***************************************
|
||||
The Svc::Health component shall have a command to enable or disable monitoring for a particular port.
|
||||
***************************************
|
||||
EVENT: (4) (0:0,0) ACTIVITY_HI: (Health) HLTH_CHECK_PING : Health checking set to 0 for task0
|
||||
EVENT: (4) (0:0,0) ACTIVITY_HI: (Health) HLTH_CHECK_PING : Health checking set to 1 for task0
|
||||
EVENT: (4) (0:0,0) ACTIVITY_HI: (Health) HLTH_CHECK_PING : Health checking set to 0 for task1
|
||||
EVENT: (4) (0:0,0) ACTIVITY_HI: (Health) HLTH_CHECK_PING : Health checking set to 1 for task1
|
||||
EVENT: (4) (0:0,0) ACTIVITY_HI: (Health) HLTH_CHECK_PING : Health checking set to 0 for task2
|
||||
EVENT: (4) (0:0,0) ACTIVITY_HI: (Health) HLTH_CHECK_PING : Health checking set to 1 for task2
|
||||
EVENT: (4) (0:0,0) ACTIVITY_HI: (Health) HLTH_CHECK_PING : Health checking set to 0 for task3
|
||||
EVENT: (4) (0:0,0) ACTIVITY_HI: (Health) HLTH_CHECK_PING : Health checking set to 1 for task3
|
||||
EVENT: (4) (0:0,0) ACTIVITY_HI: (Health) HLTH_CHECK_PING : Health checking set to 0 for task4
|
||||
EVENT: (4) (0:0,0) ACTIVITY_HI: (Health) HLTH_CHECK_PING : Health checking set to 1 for task4
|
||||
EVENT: (4) (0:0,0) ACTIVITY_HI: (Health) HLTH_CHECK_PING : Health checking set to 0 for task5
|
||||
EVENT: (4) (0:0,0) ACTIVITY_HI: (Health) HLTH_CHECK_PING : Health checking set to 1 for task5
|
||||
EVENT: (4) (0:0,0) ACTIVITY_HI: (Health) HLTH_CHECK_PING : Health checking set to 0 for task6
|
||||
EVENT: (4) (0:0,0) ACTIVITY_HI: (Health) HLTH_CHECK_PING : Health checking set to 1 for task6
|
||||
EVENT: (4) (0:0,0) ACTIVITY_HI: (Health) HLTH_CHECK_PING : Health checking set to 0 for task7
|
||||
EVENT: (4) (0:0,0) ACTIVITY_HI: (Health) HLTH_CHECK_PING : Health checking set to 1 for task7
|
||||
EVENT: (4) (0:0,0) ACTIVITY_HI: (Health) HLTH_CHECK_PING : Health checking set to 0 for task8
|
||||
EVENT: (4) (0:0,0) ACTIVITY_HI: (Health) HLTH_CHECK_PING : Health checking set to 1 for task8
|
||||
EVENT: (4) (0:0,0) ACTIVITY_HI: (Health) HLTH_CHECK_PING : Health checking set to 0 for task9
|
||||
EVENT: (4) (0:0,0) ACTIVITY_HI: (Health) HLTH_CHECK_PING : Health checking set to 1 for task9
|
||||
[ OK ] Test.DisableOneMonitoring (1 ms)
|
||||
[ RUN ] Test.UpdatePingTimeout
|
||||
|
||||
***************************************
|
||||
TESTCASE 900.1.6: Update ping timeouts
|
||||
***************************************
|
||||
|
||||
***************************************
|
||||
(RQ) ISF-HTH-006
|
||||
***************************************
|
||||
|
||||
***************************************
|
||||
The Svc::Health component shall have a command to update ping timeout values for a port
|
||||
***************************************
|
||||
EVENT: (6) (0:0,0) ACTIVITY_HI: (Health) HLTH_PING_UPDATED : Health ping for task0 changed to WARN 40 FATAL 50
|
||||
EVENT: (6) (0:0,0) ACTIVITY_HI: (Health) HLTH_PING_UPDATED : Health ping for task1 changed to WARN 41 FATAL 51
|
||||
EVENT: (6) (0:0,0) ACTIVITY_HI: (Health) HLTH_PING_UPDATED : Health ping for task2 changed to WARN 42 FATAL 52
|
||||
EVENT: (6) (0:0,0) ACTIVITY_HI: (Health) HLTH_PING_UPDATED : Health ping for task3 changed to WARN 43 FATAL 53
|
||||
EVENT: (6) (0:0,0) ACTIVITY_HI: (Health) HLTH_PING_UPDATED : Health ping for task4 changed to WARN 44 FATAL 54
|
||||
EVENT: (6) (0:0,0) ACTIVITY_HI: (Health) HLTH_PING_UPDATED : Health ping for task5 changed to WARN 45 FATAL 55
|
||||
EVENT: (6) (0:0,0) ACTIVITY_HI: (Health) HLTH_PING_UPDATED : Health ping for task6 changed to WARN 46 FATAL 56
|
||||
EVENT: (6) (0:0,0) ACTIVITY_HI: (Health) HLTH_PING_UPDATED : Health ping for task7 changed to WARN 47 FATAL 57
|
||||
EVENT: (6) (0:0,0) ACTIVITY_HI: (Health) HLTH_PING_UPDATED : Health ping for task8 changed to WARN 48 FATAL 58
|
||||
EVENT: (6) (0:0,0) ACTIVITY_HI: (Health) HLTH_PING_UPDATED : Health ping for task9 changed to WARN 49 FATAL 59
|
||||
[ OK ] Test.UpdatePingTimeout (1 ms)
|
||||
[ RUN ] Test.WatchdogCheck
|
||||
|
||||
***************************************
|
||||
TESTCASE 900.1.7: Watchdog check
|
||||
***************************************
|
||||
|
||||
***************************************
|
||||
(RQ) ISF-HTH-007
|
||||
***************************************
|
||||
|
||||
***************************************
|
||||
The Svc::Health component shall stroke a watchdog port while all ping replies are within their limit and health checks pass
|
||||
***************************************
|
||||
[ OK ] Test.WatchdogCheck (0 ms)
|
||||
[ RUN ] Test.NominalCmd
|
||||
|
||||
***************************************
|
||||
TESTCASE 900.1.8: Nominal Command
|
||||
***************************************
|
||||
|
||||
***************************************
|
||||
Process command during quiescent (no telemetry readout) period.
|
||||
***************************************
|
||||
EVENT: (3) (0:0,0) ACTIVITY_HI: (Health) HLTH_CHECK_ENABLE : Health checking set to 0
|
||||
EVENT: (3) (0:0,0) ACTIVITY_HI: (Health) HLTH_CHECK_ENABLE : Health checking set to 1
|
||||
EVENT: (4) (0:0,0) ACTIVITY_HI: (Health) HLTH_CHECK_PING : Health checking set to 0 for task0
|
||||
EVENT: (6) (0:0,0) ACTIVITY_HI: (Health) HLTH_PING_UPDATED : Health ping for task0 changed to WARN 9 FATAL 99
|
||||
[ OK ] Test.NominalCmd (0 ms)
|
||||
[ RUN ] Test.Nominal2CmdsDuringTlm
|
||||
|
||||
***************************************
|
||||
TESTCASE 900.1.9: Nominal 2 commands called during telemetry readouts.
|
||||
***************************************
|
||||
|
||||
***************************************
|
||||
Process commands during busy (telemetry readout) period.
|
||||
***************************************
|
||||
EVENT: (3) (0:0,0) ACTIVITY_HI: (Health) HLTH_CHECK_ENABLE : Health checking set to 0
|
||||
[ OK ] Test.Nominal2CmdsDuringTlm (1 ms)
|
||||
[ RUN ] Test.Miscellaneous
|
||||
|
||||
***************************************
|
||||
TESTCASE 900.1.10: Miscellaneous remaining tests.
|
||||
***************************************
|
||||
|
||||
***************************************
|
||||
Case 1: Ping port anomalies.
|
||||
***************************************
|
||||
EVENT: (2) (0:0,0) FATAL: (Health) HLTH_PING_WRONG_KEY : Ping entry task0 responded with wrong key 0x00000032
|
||||
EVENT: (2) (0:0,0) FATAL: (Health) HLTH_PING_WRONG_KEY : Ping entry task1 responded with wrong key 0x00000032
|
||||
EVENT: (2) (0:0,0) FATAL: (Health) HLTH_PING_WRONG_KEY : Ping entry task2 responded with wrong key 0x00000032
|
||||
EVENT: (2) (0:0,0) FATAL: (Health) HLTH_PING_WRONG_KEY : Ping entry task3 responded with wrong key 0x00000032
|
||||
EVENT: (2) (0:0,0) FATAL: (Health) HLTH_PING_WRONG_KEY : Ping entry task4 responded with wrong key 0x00000032
|
||||
EVENT: (2) (0:0,0) FATAL: (Health) HLTH_PING_WRONG_KEY : Ping entry task5 responded with wrong key 0x00000032
|
||||
EVENT: (2) (0:0,0) FATAL: (Health) HLTH_PING_WRONG_KEY : Ping entry task6 responded with wrong key 0x00000032
|
||||
EVENT: (2) (0:0,0) FATAL: (Health) HLTH_PING_WRONG_KEY : Ping entry task7 responded with wrong key 0x00000032
|
||||
EVENT: (2) (0:0,0) FATAL: (Health) HLTH_PING_WRONG_KEY : Ping entry task8 responded with wrong key 0x00000032
|
||||
EVENT: (2) (0:0,0) FATAL: (Health) HLTH_PING_WRONG_KEY : Ping entry task9 responded with wrong key 0x00000032
|
||||
|
||||
***************************************
|
||||
Case 2: Command input anomalies.
|
||||
***************************************
|
||||
EVENT: (5) (0:0,0) WARNING_LO: (Health) HLTH_CHECK_LOOKUP_ERROR : Couldn't find entry notask
|
||||
EVENT: (7) (0:0,0) WARNING_HI: (Health) HLTH_PING_INVALID_VALUES : Health ping for task0 invalid values: WARN 10 FATAL 9
|
||||
EVENT: (5) (0:0,0) WARNING_LO: (Health) HLTH_CHECK_LOOKUP_ERROR : Couldn't find entry sometask
|
||||
|
||||
***************************************
|
||||
Case 3: All ping ports except one respond to ping requests.
|
||||
***************************************
|
||||
EVENT: (0) (0:0,0) WARNING_HI: (Health) HLTH_PING_WARN : Ping entry task9 late warning
|
||||
[ OK ] Test.Miscellaneous (2 ms)
|
||||
[----------] 10 tests from Test (7 ms total)
|
||||
|
||||
[----------] Global test environment tear-down
|
||||
[==========] 10 tests from 1 test case ran. (7 ms total)
|
||||
[ PASSED ] 10 tests.
|
||||
@ -71,13 +71,7 @@ Unit Test Checklist | [Link](Checklist_Unit_Test.xlsx)
|
||||
|
||||
## 5. Unit Testing
|
||||
|
||||
[Unit Test Output](../test/ut/output/test.txt)
|
||||
|
||||
[Coverage Summary](../test/ut/output/SvcPolyDb_gcov.txt)
|
||||
|
||||
[PolyDbImpl.cpp Coverage](../test/ut/output/PolyDbImpl.cpp.gcov)
|
||||
|
||||
[PolyDbComponentAc.cpp Coverage](../test/ut/output/PolyDbComponentAc.cpp.gcov)
|
||||
To see unit test coverage run fprime-util check --coverage
|
||||
|
||||
## 6. Change Log
|
||||
|
||||
|
||||
@ -1,141 +0,0 @@
|
||||
-: 0:Source:/home/tcanham/source/isf/Svc/PolyDb/PolyDbComponentAc.cpp
|
||||
-: 0:Programs:6
|
||||
-: 1:#include <stdio.h>
|
||||
-: 2:#include <FpConfig.hpp>
|
||||
-: 3:#include <Svc/PolyDb/PolyDbComponentAc.hpp>
|
||||
-: 4:#include <Fw/Types/Assert.hpp>
|
||||
-: 5:
|
||||
-: 6:#if FW_ENABLE_TEXT_LOGGING
|
||||
-: 7:#include <Fw/Types/EightyCharString.hpp>
|
||||
-: 8:#endif
|
||||
-: 9:// Namespace code
|
||||
-: 10:namespace Svc {
|
||||
-: 11:
|
||||
-: 12:// public methods
|
||||
-: 13:
|
||||
3: 14: Svc::InputPolyPort *PolyDbComponentBase::get_getValue_InputPort(NATIVE_INT_TYPE portNum) {
|
||||
3: 15: FW_ASSERT(portNum < this->getNum_getValue_InputPorts());
|
||||
3: 16: return &this->m_getValue_InputPort[portNum];
|
||||
-: 17: }
|
||||
-: 18:
|
||||
3: 19: Svc::InputPolyPort *PolyDbComponentBase::get_setValue_InputPort(NATIVE_INT_TYPE portNum) {
|
||||
3: 20: FW_ASSERT(portNum < this->getNum_setValue_InputPorts());
|
||||
3: 21: return &this->m_setValue_InputPort[portNum];
|
||||
-: 22: }
|
||||
-: 23:#if FW_PORT_SERIALIZATION
|
||||
-: 24:#endif
|
||||
-: 25:
|
||||
-: 26:
|
||||
-: 27:
|
||||
-: 28:// protected methods
|
||||
-: 29:#if FW_OBJECT_NAMES == 1
|
||||
3: 30: PolyDbComponentBase::PolyDbComponentBase(const char* compName) : Fw::PassiveComponentBase(compName) {
|
||||
-: 31:#else
|
||||
-: 32: PolyDbComponentBase::PolyDbComponentBase() : Fw::PassiveComponentBase() {
|
||||
-: 33:#endif
|
||||
3: 34:}
|
||||
-: 35:
|
||||
-: 36:
|
||||
3: 37: void PolyDbComponentBase::init(NATIVE_INT_TYPE instance) {
|
||||
-: 38:
|
||||
-: 39:
|
||||
-: 40: // initialize base class
|
||||
3: 41: Fw::PassiveComponentBase::init(instance);
|
||||
-: 42: // Input ports attached to component here with external component interfaces
|
||||
6: 43: for (NATIVE_INT_TYPE port = 0; port < this->getNum_getValue_InputPorts(); port++) {
|
||||
3: 44: this->m_getValue_InputPort[port].init();
|
||||
-: 45:
|
||||
3: 46: this->m_getValue_InputPort[port].addCallComp(this, m_p_getValue_in);
|
||||
-: 47:
|
||||
3: 48: this->m_getValue_InputPort[port].setPortNum(port);
|
||||
-: 49:#if FW_OBJECT_NAMES == 1
|
||||
-: 50: char portName[80];
|
||||
3: 51: (void)snprintf(portName, sizeof(portName), "%s_getValue_InputPort[%d]", this->m_objName, port);
|
||||
3: 52: this->m_getValue_InputPort[port].setObjName(portName);
|
||||
-: 53:#endif
|
||||
-: 54: }
|
||||
6: 55: for (NATIVE_INT_TYPE port = 0; port < this->getNum_setValue_InputPorts(); port++) {
|
||||
3: 56: this->m_setValue_InputPort[port].init();
|
||||
-: 57:
|
||||
3: 58: this->m_setValue_InputPort[port].addCallComp(this, m_p_setValue_in);
|
||||
-: 59:
|
||||
3: 60: this->m_setValue_InputPort[port].setPortNum(port);
|
||||
-: 61:#if FW_OBJECT_NAMES == 1
|
||||
-: 62: char portName[80];
|
||||
3: 63: (void)snprintf(portName, sizeof(portName), "%s_setValue_InputPort[%d]", this->m_objName, port);
|
||||
3: 64: this->m_setValue_InputPort[port].setObjName(portName);
|
||||
-: 65:#endif
|
||||
-: 66: }
|
||||
-: 67:
|
||||
-: 68: // Set output ports
|
||||
-: 69:
|
||||
-: 70:
|
||||
3: 71: }
|
||||
-: 72:
|
||||
3: 73: PolyDbComponentBase::~PolyDbComponentBase() {
|
||||
3: 74: }
|
||||
-: 75:
|
||||
-: 76: // Up-calls, calls for output ports
|
||||
134: 77: NATIVE_INT_TYPE PolyDbComponentBase::getNum_getValue_InputPorts(void) {
|
||||
134: 78: return (NATIVE_INT_TYPE) FW_NUM_ARRAY_ELEMENTS(this->m_getValue_InputPort);
|
||||
-: 79: }
|
||||
134: 80: NATIVE_INT_TYPE PolyDbComponentBase::getNum_setValue_InputPorts(void) {
|
||||
134: 81: return (NATIVE_INT_TYPE) FW_NUM_ARRAY_ELEMENTS(this->m_setValue_InputPort);
|
||||
-: 82: }
|
||||
-: 83:
|
||||
-: 84:
|
||||
-: 85: // lock mutex for guarded ports
|
||||
250: 86: void PolyDbComponentBase::lock(void) {
|
||||
250: 87: this->m_guardedPortMutex.lock();
|
||||
250: 88: }
|
||||
-: 89:
|
||||
-: 90: // unlock mutex for guarded ports
|
||||
250: 91: void PolyDbComponentBase::unLock(void) {
|
||||
250: 92: this->m_guardedPortMutex.unLock();
|
||||
250: 93: }
|
||||
-: 94:// private methods
|
||||
-: 95:
|
||||
-: 96: // call for incoming port getValue
|
||||
125: 97: void PolyDbComponentBase::m_p_getValue_in(Fw::PassiveComponentBase* callComp, NATIVE_INT_TYPE portNum, U32 entry, MeasurementStatus &status, Fw::Time &time, Fw::PolyType &val) {
|
||||
125: 98: FW_ASSERT(callComp);
|
||||
125: 99: PolyDbComponentBase* compPtr = (PolyDbComponentBase*)callComp;
|
||||
125: 100: compPtr->getValue_handlerBase(portNum, entry, status, time, val);
|
||||
125: 101: }
|
||||
-: 102:
|
||||
125: 103: void PolyDbComponentBase::getValue_handlerBase(NATIVE_INT_TYPE portNum, U32 entry, MeasurementStatus &status, Fw::Time &time, Fw::PolyType &val) {
|
||||
-: 104:
|
||||
-: 105: // make sure port number is valid
|
||||
125: 106: FW_ASSERT(portNum < this->getNum_getValue_InputPorts());
|
||||
-: 107:
|
||||
-: 108: // Lock guard mutex before calling
|
||||
125: 109: this->lock();
|
||||
-: 110: // Down call to pure virtual handler method implemented in Impl class
|
||||
125: 111: this->getValue_handler(portNum, entry, status, time, val);
|
||||
-: 112:
|
||||
-: 113: // Unlock guard mutex
|
||||
125: 114: this->unLock();
|
||||
125: 115: }
|
||||
-: 116:
|
||||
-: 117: // call for incoming port setValue
|
||||
125: 118: void PolyDbComponentBase::m_p_setValue_in(Fw::PassiveComponentBase* callComp, NATIVE_INT_TYPE portNum, U32 entry, MeasurementStatus &status, Fw::Time &time, Fw::PolyType &val) {
|
||||
125: 119: FW_ASSERT(callComp);
|
||||
125: 120: PolyDbComponentBase* compPtr = (PolyDbComponentBase*)callComp;
|
||||
125: 121: compPtr->setValue_handlerBase(portNum, entry, status, time, val);
|
||||
125: 122: }
|
||||
-: 123:
|
||||
125: 124: void PolyDbComponentBase::setValue_handlerBase(NATIVE_INT_TYPE portNum, U32 entry, MeasurementStatus &status, Fw::Time &time, Fw::PolyType &val) {
|
||||
-: 125:
|
||||
-: 126: // make sure port number is valid
|
||||
125: 127: FW_ASSERT(portNum < this->getNum_setValue_InputPorts());
|
||||
-: 128:
|
||||
-: 129: // Lock guard mutex before calling
|
||||
125: 130: this->lock();
|
||||
-: 131: // Down call to pure virtual handler method implemented in Impl class
|
||||
125: 132: this->setValue_handler(portNum, entry, status, time, val);
|
||||
-: 133:
|
||||
-: 134: // Unlock guard mutex
|
||||
125: 135: this->unLock();
|
||||
125: 136: }
|
||||
-: 137:
|
||||
-: 138:}
|
||||
-: 139:
|
||||
@ -1,42 +0,0 @@
|
||||
-: 0:Source:/home/tcanham/source/isf/Svc/PolyDb/PolyDbImpl.hpp
|
||||
-: 0:Programs:6
|
||||
-: 1:/*
|
||||
-: 2: * PolyDbImpl.hpp
|
||||
-: 3: *
|
||||
-: 4: * Created on: February 19, 2015
|
||||
-: 5: * Author: Timothy Canham
|
||||
-: 6: */
|
||||
-: 7:
|
||||
-: 8:#ifndef POLYDBIMPL_HPP_
|
||||
-: 9:#define POLYDBIMPL_HPP_
|
||||
-: 10:
|
||||
-: 11:#include <Svc/PolyDb/PolyDbComponentAc.hpp>
|
||||
-: 12:#include <Fw/Types/PolyType.hpp>
|
||||
-: 13:#include <PolyDbImplCfg.hpp>
|
||||
-: 14:
|
||||
-: 15:namespace Svc {
|
||||
-: 16: class PolyDbImpl : public PolyDbComponentBase {
|
||||
-: 17: public:
|
||||
-: 18:
|
||||
-: 19:#if FW_OBJECT_NAMES == 1
|
||||
-: 20: PolyDbImpl(const char* name);
|
||||
-: 21:#else
|
||||
-: 22: PolyDbImpl();
|
||||
-: 23:#endif
|
||||
-: 24: void init(void);
|
||||
-: 25: virtual ~PolyDbImpl();
|
||||
-: 26: protected:
|
||||
-: 27: private:
|
||||
-: 28: void getValue_handler(NATIVE_INT_TYPE portNum, U32 entry, MeasurementStatus &status, Fw::Time &time, Fw::PolyType &val);
|
||||
-: 29: void setValue_handler(NATIVE_INT_TYPE portNum, U32 entry, MeasurementStatus &status, Fw::Time &time, Fw::PolyType &val);
|
||||
-: 30:
|
||||
150: 31: struct t_dbStruct {
|
||||
-: 32: MeasurementStatus status;
|
||||
-: 33: Fw::PolyType val;
|
||||
-: 34: Fw::Time time;
|
||||
-: 35: } m_db[POLYDB_NUM_DB_ENTRIES];
|
||||
-: 36:
|
||||
-: 37: };
|
||||
-: 38:}
|
||||
-: 39:
|
||||
-: 40:#endif /* POLYDBIMPL_HPP_ */
|
||||
@ -1,13 +0,0 @@
|
||||
File '/home/tcanham/source/isf/Svc/PolyDb/PolyDbImpl.cpp'
|
||||
Lines executed:100.00% of 21
|
||||
Creating 'PolyDbImpl.cpp.gcov'
|
||||
|
||||
File '/home/tcanham/source/isf/Svc/PolyDb/PolyDbImpl.hpp'
|
||||
Lines executed:100.00% of 1
|
||||
Creating 'PolyDbImpl.hpp.gcov'
|
||||
|
||||
File '/home/tcanham/source/isf/Svc/PolyDb/PolyDbComponentAc.cpp'
|
||||
Lines executed:100.00% of 57
|
||||
Creating 'PolyDbComponentAc.cpp.gcov'
|
||||
|
||||
Lines executed:100.00% of 79
|
||||
@ -1,49 +0,0 @@
|
||||
07:10:40 **** Build of configuration Default for project Svc ****
|
||||
make ut run_ut
|
||||
Compiling ut_CYGWIN unit test for SvcPolyDb
|
||||
make[1]: Entering directory '/home/tcanham/source/isf/Svc/PolyDb'
|
||||
make[1]: Nothing to be done for 'test_SvcPolyDbtestut'.
|
||||
make[1]: Leaving directory '/home/tcanham/source/isf/Svc/PolyDb'
|
||||
Running unit test for SvcPolyDb
|
||||
make[1]: Entering directory '/home/tcanham/source/isf/Svc/PolyDb'
|
||||
Running test/ut/runtest_CYGWIN with output dir linux-cygwin-x86-ut-gnu-bin
|
||||
test/ut/runtest_CYGWIN linux-cygwin-x86-ut-gnu-bin
|
||||
Running /home/tcanham/source/isf/Svc/PolyDb/test/ut/linux-cygwin-x86-ut-gnu-bin/test_ut
|
||||
[==========] Running 1 test from 1 test case.
|
||||
[----------] Global test environment set-up.
|
||||
[----------] 1 test from CmdDispTestNominal
|
||||
[ RUN ] CmdDispTestNominal.NominalReadWrite
|
||||
|
||||
***************************************
|
||||
TESTCASE 104.1.1: PolyDb Nominal Read/Write Test
|
||||
***************************************
|
||||
|
||||
***************************************
|
||||
Read and write values to the database while varying the measurement statuses.
|
||||
***************************************
|
||||
|
||||
***************************************
|
||||
(RQ) ISF-PDB-001
|
||||
***************************************
|
||||
|
||||
***************************************
|
||||
(RQ) ISF-PDB-003
|
||||
***************************************
|
||||
|
||||
***************************************
|
||||
(RQ) ISF-PDB-002
|
||||
***************************************
|
||||
|
||||
***************************************
|
||||
(RQ) ISF-PDB-004
|
||||
***************************************
|
||||
[ OK ] CmdDispTestNominal.NominalReadWrite (0 ms)
|
||||
[----------] 1 test from CmdDispTestNominal (1 ms total)
|
||||
|
||||
[----------] Global test environment tear-down
|
||||
[==========] 1 test from 1 test case ran. (1 ms total)
|
||||
[ PASSED ] 1 test.
|
||||
make[1]: Leaving directory '/home/tcanham/source/isf/Svc/PolyDb'
|
||||
|
||||
07:10:42 Build Finished (took 2s.492ms)
|
||||
|
||||
@ -94,13 +94,7 @@ TBD
|
||||
|
||||
## 6. Unit Testing
|
||||
|
||||
[Unit Test Output](../test/ut/output/test.txt)
|
||||
|
||||
[Coverage Output - `PrmDbImpl.cpp`](../test/ut/output/PrmDbImpl.cpp.gcov)
|
||||
|
||||
[Coverage Output - `PrmDbComponentAc.cpp`](../test/ut/output/PrmDbComponentAc.cpp.gcov)
|
||||
|
||||
[Report](../test/ut/output/SvcPrmDb_gcov.txt)
|
||||
To see unit test coverage run fprime-util check --coverage
|
||||
|
||||
## 7. Change Log
|
||||
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@ -1,370 +0,0 @@
|
||||
-: 0:Source:/home/tcanham/source/isf/Svc/PrmDb/PrmDbImpl.cpp
|
||||
-: 0:Programs:13
|
||||
-: 1:/*
|
||||
-: 2: * PrmDbImpl.cpp
|
||||
-: 3: *
|
||||
-: 4: * Created on: March 9, 2015
|
||||
-: 5: * Author: Timothy Canham
|
||||
-: 6: */
|
||||
-: 7:
|
||||
-: 8:#include <Svc/PrmDb/PrmDbImpl.hpp>
|
||||
-: 9:#include <Fw/Types/Assert.hpp>
|
||||
-: 10:#include <Fw/Types/EightyCharString.hpp>
|
||||
-: 11:
|
||||
-: 12:#include <Os/File.hpp>
|
||||
-: 13:
|
||||
-: 14:#include <cstring>
|
||||
-: 15:#include <stdio.h>
|
||||
-: 16:
|
||||
-: 17:namespace Svc {
|
||||
-: 18:
|
||||
-: 19: // anonymous namespace for buffer declaration
|
||||
-: 20: namespace {
|
||||
42: 21: class WorkingBuffer : public Fw::SerializeBufferBase {
|
||||
-: 22: public:
|
||||
-: 23:
|
||||
25: 24: NATIVE_UINT_TYPE getBuffCapacity(void) const {
|
||||
25: 25: return sizeof(m_buff);
|
||||
-: 26: }
|
||||
-: 27:
|
||||
154: 28: U8* getBuffAddr(void) {
|
||||
154: 29: return m_buff;
|
||||
-: 30: }
|
||||
-: 31:
|
||||
#####: 32: const U8* getBuffAddr(void) const {
|
||||
#####: 33: return m_buff;
|
||||
-: 34: }
|
||||
-: 35:
|
||||
-: 36: private:
|
||||
-: 37: // Set to max of parameter buffer + id
|
||||
-: 38: U8 m_buff[FW_PARAM_BUFFER_MAX_SIZE + sizeof(FwPrmIdType)];
|
||||
-: 39: };
|
||||
-: 40: }
|
||||
-: 41:
|
||||
-: 42:
|
||||
-: 43:#if FW_OBJECT_NAMES == 1
|
||||
6: 44: PrmDbImpl::PrmDbImpl(const char* name, const char* file) : PrmDbComponentBase(name) {
|
||||
-: 45:#else
|
||||
-: 46: PrmDbImpl::PrmDbImpl(const char* file) {
|
||||
-: 47:#endif
|
||||
6: 48: this->clearDb();
|
||||
6: 49: this->m_fileName = file;
|
||||
6: 50: }
|
||||
-: 51:
|
||||
6: 52: void PrmDbImpl::init(NATIVE_INT_TYPE queueDepth, NATIVE_INT_TYPE instance) {
|
||||
6: 53: PrmDbComponentBase::init(queueDepth,instance);
|
||||
6: 54: }
|
||||
-: 55:
|
||||
23: 56: void PrmDbImpl::clearDb(void) {
|
||||
598: 57: for (I32 entry = 0; entry < PRMDB_NUM_DB_ENTRIES; entry++) {
|
||||
575: 58: this->m_db[entry].used = false;
|
||||
575: 59: this->m_db[entry].id = 0;
|
||||
-: 60: }
|
||||
23: 61: }
|
||||
-: 62:
|
||||
-: 63: // If ports are no longer guarded, these accesses need to be protected from each other
|
||||
-: 64: // If there are a lot of accesses, perhaps an interrupt lock could be used instead of guarded ports
|
||||
-: 65:
|
||||
13: 66: Fw::ParamValid PrmDbImpl::getPrm_handler(NATIVE_INT_TYPE portNum, FwPrmIdType id, Fw::ParamBuffer &val) {
|
||||
-: 67: // search for entry
|
||||
13: 68: Fw::ParamValid stat = Fw::PARAM_INVALID;
|
||||
-: 69:
|
||||
39: 70: for (I32 entry = 0; entry < PRMDB_NUM_DB_ENTRIES; entry++) {
|
||||
38: 71: if (this->m_db[entry].used) {
|
||||
15: 72: if (this->m_db[entry].id == id) {
|
||||
12: 73: val = this->m_db[entry].val;
|
||||
12: 74: stat = Fw::PARAM_VALID;
|
||||
12: 75: break;
|
||||
-: 76: }
|
||||
-: 77: }
|
||||
-: 78: }
|
||||
-: 79:
|
||||
-: 80: // if unable to find parameter, send error message
|
||||
13: 81: if (Fw::PARAM_INVALID == stat) {
|
||||
1: 82: this->log_WARNING_LO_PrmIdNotFound(id);
|
||||
-: 83: }
|
||||
-: 84:
|
||||
13: 85: return stat;
|
||||
-: 86: }
|
||||
-: 87:
|
||||
41: 88: void PrmDbImpl::setPrm_handler(NATIVE_INT_TYPE portNum, FwPrmIdType id, Fw::ParamBuffer &val) {
|
||||
-: 89:
|
||||
41: 90: this->lock();
|
||||
-: 91:
|
||||
-: 92: // search for existing entry
|
||||
-: 93:
|
||||
41: 94: bool existingEntry = false;
|
||||
41: 95: bool noSlots = true;
|
||||
-: 96:
|
||||
941: 97: for (NATIVE_INT_TYPE entry = 0; entry < PRMDB_NUM_DB_ENTRIES; entry++) {
|
||||
905: 98: if ((this->m_db[entry].used) && (id == this->m_db[entry].id)) {
|
||||
5: 99: this->m_db[entry].val = val;
|
||||
5: 100: existingEntry = true;
|
||||
5: 101: break;
|
||||
-: 102: }
|
||||
-: 103: }
|
||||
-: 104:
|
||||
-: 105: // if there is no existing entry, add one
|
||||
41: 106: if (!existingEntry) {
|
||||
366: 107: for (I32 entry = 0; entry < PRMDB_NUM_DB_ENTRIES; entry++) {
|
||||
365: 108: if (!(this->m_db[entry].used)) {
|
||||
35: 109: this->m_db[entry].val = val;
|
||||
35: 110: this->m_db[entry].id = id;
|
||||
35: 111: this->m_db[entry].used = true;
|
||||
35: 112: noSlots = false;
|
||||
35: 113: break;
|
||||
-: 114: }
|
||||
-: 115: }
|
||||
-: 116: }
|
||||
-: 117:
|
||||
41: 118: this->unLock();
|
||||
-: 119:
|
||||
41: 120: if (existingEntry) {
|
||||
5: 121: this->log_ACTIVITY_HI_PrmIdUpdated(id);
|
||||
36: 122: } else if (noSlots) {
|
||||
1: 123: this->log_FATAL_PrmDbFull(id);
|
||||
-: 124: } else {
|
||||
35: 125: this->log_ACTIVITY_HI_PrmIdAdded(id);
|
||||
-: 126: }
|
||||
-: 127:
|
||||
41: 128: }
|
||||
-: 129:
|
||||
10: 130: void PrmDbImpl::PRM_SAVE_FILE_cmdHandler(FwOpcodeType opCode, U32 cmdSeq) {
|
||||
-: 131:
|
||||
10: 132: Os::File paramFile;
|
||||
11: 133: WorkingBuffer buff;
|
||||
-: 134:
|
||||
10: 135: Os::File::Status stat = paramFile.open(this->m_fileName.toChar(),Os::File::OPEN_WRITE);
|
||||
10: 136: if (stat != Os::File::OP_OK) {
|
||||
1: 137: this->log_WARNING_HI_PrmFileWriteError(PRM_WRITE_OPEN,0,stat);
|
||||
1: 138: this->cmdResponse_out(opCode,cmdSeq,Fw::COMMAND_EXECUTION_ERROR);
|
||||
1: 139: return;
|
||||
-: 140: }
|
||||
-: 141:
|
||||
9: 142: this->lock();
|
||||
-: 143:
|
||||
-: 144: // Traverse the parameter list, saving each entry
|
||||
-: 145:
|
||||
9: 146: U32 numRecords = 0;
|
||||
-: 147:
|
||||
34: 148: for (NATIVE_UINT_TYPE entry = 0; entry < FW_NUM_ARRAY_ELEMENTS(this->m_db); entry++) {
|
||||
33: 149: if (this->m_db[entry].used) {
|
||||
-: 150: // write delimiter
|
||||
-: 151: static const U8 delim = PRMDB_ENTRY_DELIMITER;
|
||||
10: 152: NATIVE_INT_TYPE writeSize = sizeof(delim);
|
||||
10: 153: stat = paramFile.write(&delim,writeSize,true);
|
||||
10: 154: if (stat != Os::File::OP_OK) {
|
||||
1: 155: this->unLock();
|
||||
1: 156: this->log_WARNING_HI_PrmFileWriteError(PRM_WRITE_DELIMITER,numRecords,stat);
|
||||
1: 157: this->cmdResponse_out(opCode,cmdSeq,Fw::COMMAND_EXECUTION_ERROR);
|
||||
9: 158: return;
|
||||
-: 159: }
|
||||
9: 160: if (writeSize != sizeof(delim)) {
|
||||
1: 161: this->unLock();
|
||||
1: 162: this->log_WARNING_HI_PrmFileWriteError(PRM_WRITE_DELIMITER_SIZE,numRecords,writeSize);
|
||||
1: 163: this->cmdResponse_out(opCode,cmdSeq,Fw::COMMAND_EXECUTION_ERROR);
|
||||
1: 164: return;
|
||||
-: 165: }
|
||||
-: 166: // serialize record size = id field + data
|
||||
8: 167: U32 recordSize = sizeof(FwPrmIdType) + this->m_db[entry].val.getBuffLength();
|
||||
-: 168:
|
||||
-: 169: // reset buffer
|
||||
8: 170: buff.resetSer();
|
||||
8: 171: Fw::SerializeStatus serStat = buff.serialize(recordSize);
|
||||
-: 172: // should always work
|
||||
8: 173: FW_ASSERT(Fw::FW_SERIALIZE_OK == serStat,(NATIVE_INT_TYPE)serStat);
|
||||
-: 174:
|
||||
-: 175: // write record size
|
||||
8: 176: writeSize = buff.getBuffLength();
|
||||
8: 177: stat = paramFile.write(buff.getBuffAddr(),writeSize,true);
|
||||
8: 178: if (stat != Os::File::OP_OK) {
|
||||
1: 179: this->unLock();
|
||||
1: 180: this->log_WARNING_HI_PrmFileWriteError(PRM_WRITE_RECORD_SIZE,numRecords,stat);
|
||||
1: 181: this->cmdResponse_out(opCode,cmdSeq,Fw::COMMAND_EXECUTION_ERROR);
|
||||
1: 182: return;
|
||||
-: 183: }
|
||||
7: 184: if (writeSize != sizeof(writeSize)) {
|
||||
1: 185: this->unLock();
|
||||
1: 186: this->log_WARNING_HI_PrmFileWriteError(PRM_WRITE_RECORD_SIZE_SIZE,numRecords,writeSize);
|
||||
1: 187: this->cmdResponse_out(opCode,cmdSeq,Fw::COMMAND_EXECUTION_ERROR);
|
||||
1: 188: return;
|
||||
-: 189: }
|
||||
-: 190:
|
||||
-: 191: // reset buffer
|
||||
6: 192: buff.resetSer();
|
||||
-: 193:
|
||||
-: 194: // serialize parameter id
|
||||
-: 195:
|
||||
6: 196: serStat = buff.serialize(this->m_db[entry].id);
|
||||
-: 197: // should always work
|
||||
6: 198: FW_ASSERT(Fw::FW_SERIALIZE_OK == serStat,(NATIVE_INT_TYPE)serStat);
|
||||
-: 199:
|
||||
-: 200: // write parameter ID
|
||||
6: 201: writeSize = buff.getBuffLength();
|
||||
6: 202: stat = paramFile.write(buff.getBuffAddr(),writeSize,true);
|
||||
6: 203: if (stat != Os::File::OP_OK) {
|
||||
1: 204: this->unLock();
|
||||
1: 205: this->log_WARNING_HI_PrmFileWriteError(PRM_WRITE_PARAMETER_ID,numRecords,stat);
|
||||
1: 206: this->cmdResponse_out(opCode,cmdSeq,Fw::COMMAND_EXECUTION_ERROR);
|
||||
1: 207: return;
|
||||
-: 208: }
|
||||
5: 209: if (writeSize != (NATIVE_INT_TYPE)buff.getBuffLength()) {
|
||||
1: 210: this->unLock();
|
||||
1: 211: this->log_WARNING_HI_PrmFileWriteError(PRM_WRITE_PARAMETER_ID_SIZE,numRecords,writeSize);
|
||||
1: 212: this->cmdResponse_out(opCode,cmdSeq,Fw::COMMAND_EXECUTION_ERROR);
|
||||
1: 213: return;
|
||||
-: 214: }
|
||||
-: 215:
|
||||
-: 216: // write serialized parameter value
|
||||
-: 217:
|
||||
4: 218: writeSize = this->m_db[entry].val.getBuffLength();
|
||||
4: 219: stat = paramFile.write(this->m_db[entry].val.getBuffAddr(),writeSize,true);
|
||||
4: 220: if (stat != Os::File::OP_OK) {
|
||||
1: 221: this->unLock();
|
||||
1: 222: this->log_WARNING_HI_PrmFileWriteError(PRM_WRITE_PARAMETER_VALUE,numRecords,stat);
|
||||
1: 223: this->cmdResponse_out(opCode,cmdSeq,Fw::COMMAND_EXECUTION_ERROR);
|
||||
1: 224: return;
|
||||
-: 225: }
|
||||
3: 226: if (writeSize != (NATIVE_INT_TYPE)this->m_db[entry].val.getBuffLength()) {
|
||||
1: 227: this->unLock();
|
||||
1: 228: this->log_WARNING_HI_PrmFileWriteError(PRM_WRITE_PARAMETER_VALUE_SIZE,numRecords,writeSize);
|
||||
1: 229: this->cmdResponse_out(opCode,cmdSeq,Fw::COMMAND_EXECUTION_ERROR);
|
||||
1: 230: return;
|
||||
-: 231: }
|
||||
2: 232: numRecords++;
|
||||
-: 233: } // end if record in use
|
||||
-: 234: } // end for each record
|
||||
-: 235:
|
||||
1: 236: this->unLock();
|
||||
1: 237: this->log_ACTIVITY_HI_PrmFileSaveComplete(numRecords);
|
||||
2: 238: this->cmdResponse_out(opCode,cmdSeq,Fw::COMMAND_OK);
|
||||
-: 239:
|
||||
-: 240: }
|
||||
-: 241:
|
||||
6: 242: PrmDbImpl::~PrmDbImpl() {
|
||||
6: 243: }
|
||||
-: 244:
|
||||
12: 245: void PrmDbImpl::readParamFile(void) {
|
||||
-: 246: // load file. FIXME: Put more robust file checking, such as a CRC.
|
||||
12: 247: Os::File paramFile;
|
||||
-: 248:
|
||||
12: 249: Os::File::Status stat = paramFile.open(this->m_fileName.toChar(),Os::File::OPEN_READ);
|
||||
12: 250: if (stat != Os::File::OP_OK) {
|
||||
1: 251: this->log_WARNING_HI_PrmFileReadError(PRM_READ_OPEN,0,stat);
|
||||
1: 252: return;
|
||||
-: 253: }
|
||||
-: 254:
|
||||
12: 255: WorkingBuffer buff;
|
||||
-: 256:
|
||||
11: 257: U32 recordNum = 0;
|
||||
-: 258:
|
||||
11: 259: this->clearDb();
|
||||
-: 260:
|
||||
26: 261: for (NATIVE_INT_TYPE entry = 0; entry < PRMDB_NUM_DB_ENTRIES; entry++) {
|
||||
-: 262:
|
||||
-: 263: U8 delimiter;
|
||||
13: 264: NATIVE_INT_TYPE readSize = sizeof(delimiter);
|
||||
-: 265:
|
||||
-: 266: // read delimiter
|
||||
13: 267: Os::File::Status fStat = paramFile.read(&delimiter,readSize,true);
|
||||
-: 268:
|
||||
-: 269: // check for end of file (read size 0)
|
||||
13: 270: if (0 == readSize) {
|
||||
1: 271: break;
|
||||
-: 272: }
|
||||
-: 273:
|
||||
12: 274: if (fStat != Os::File::OP_OK) {
|
||||
1: 275: this->log_WARNING_HI_PrmFileReadError(PRM_READ_DELIMITER,recordNum,fStat);
|
||||
11: 276: return;
|
||||
-: 277: }
|
||||
-: 278:
|
||||
11: 279: if (sizeof(delimiter) != readSize) {
|
||||
1: 280: this->log_WARNING_HI_PrmFileReadError(PRM_READ_DELIMITER_SIZE,recordNum,readSize);
|
||||
1: 281: return;
|
||||
-: 282: }
|
||||
-: 283:
|
||||
10: 284: if (PRMDB_ENTRY_DELIMITER != delimiter) {
|
||||
1: 285: this->log_WARNING_HI_PrmFileReadError(PRM_READ_DELIMITER_VALUE,recordNum,delimiter);
|
||||
1: 286: return;
|
||||
-: 287: }
|
||||
-: 288:
|
||||
-: 289: U32 recordSize;
|
||||
-: 290: // read record size
|
||||
9: 291: readSize = sizeof(recordSize);
|
||||
-: 292:
|
||||
9: 293: fStat = paramFile.read(buff.getBuffAddr(),readSize,true);
|
||||
9: 294: if (fStat != Os::File::OP_OK) {
|
||||
1: 295: this->log_WARNING_HI_PrmFileReadError(PRM_READ_RECORD_SIZE,recordNum,fStat);
|
||||
1: 296: return;
|
||||
-: 297: }
|
||||
8: 298: if (sizeof(recordSize) != readSize) {
|
||||
1: 299: this->log_WARNING_HI_PrmFileReadError(PRM_READ_RECORD_SIZE_SIZE,recordNum,readSize);
|
||||
1: 300: return;
|
||||
-: 301: }
|
||||
-: 302: // set serialized size to read size
|
||||
7: 303: Fw::SerializeStatus desStat = buff.setBuffLen(readSize);
|
||||
-: 304: // should never fail
|
||||
7: 305: FW_ASSERT(Fw::FW_SERIALIZE_OK == desStat,(NATIVE_INT_TYPE)desStat);
|
||||
-: 306: // reset deserialization
|
||||
7: 307: buff.resetDeser();
|
||||
-: 308: // deserialize, since record size is serialized in file
|
||||
7: 309: FW_ASSERT(Fw::FW_SERIALIZE_OK == buff.deserialize(recordSize));
|
||||
-: 310:
|
||||
-: 311: // sanity check value. It can't be larger than the maximum parameter buffer size + id
|
||||
-: 312: // or smaller than the record id
|
||||
7: 313: if ((recordSize > FW_PARAM_BUFFER_MAX_SIZE + sizeof(U32)) or (recordSize < sizeof(U32))) {
|
||||
1: 314: this->log_WARNING_HI_PrmFileReadError(PRM_READ_RECORD_SIZE_VALUE,recordNum,recordSize);
|
||||
1: 315: return;
|
||||
-: 316: }
|
||||
-: 317:
|
||||
-: 318: // read the parameter ID
|
||||
6: 319: FwPrmIdType parameterId = 0;
|
||||
6: 320: readSize = sizeof(FwPrmIdType);
|
||||
-: 321:
|
||||
6: 322: fStat = paramFile.read(buff.getBuffAddr(),readSize,true);
|
||||
6: 323: if (fStat != Os::File::OP_OK) {
|
||||
1: 324: this->log_WARNING_HI_PrmFileReadError(PRM_READ_PARAMETER_ID,recordNum,fStat);
|
||||
1: 325: return;
|
||||
-: 326: }
|
||||
5: 327: if (sizeof(parameterId) != static_cast<NATIVE_INT_TYPE>(readSize)) {
|
||||
1: 328: this->log_WARNING_HI_PrmFileReadError(PRM_READ_PARAMETER_ID_SIZE,recordNum,readSize);
|
||||
1: 329: return;
|
||||
-: 330: }
|
||||
-: 331:
|
||||
-: 332: // set serialized size to read parameter ID
|
||||
4: 333: desStat = buff.setBuffLen(readSize);
|
||||
-: 334: // should never fail
|
||||
4: 335: FW_ASSERT(Fw::FW_SERIALIZE_OK == desStat,(NATIVE_INT_TYPE)desStat);
|
||||
-: 336: // reset deserialization
|
||||
4: 337: buff.resetDeser();
|
||||
-: 338: // deserialize, since parameter ID is serialized in file
|
||||
4: 339: FW_ASSERT(Fw::FW_SERIALIZE_OK == buff.deserialize(parameterId));
|
||||
-: 340:
|
||||
-: 341: // copy parameter
|
||||
4: 342: this->m_db[entry].used = true;
|
||||
4: 343: this->m_db[entry].id = parameterId;
|
||||
4: 344: readSize = recordSize-sizeof(parameterId);
|
||||
-: 345:
|
||||
4: 346: fStat = paramFile.read(this->m_db[entry].val.getBuffAddr(),readSize);
|
||||
-: 347:
|
||||
4: 348: if (fStat != Os::File::OP_OK) {
|
||||
1: 349: this->log_WARNING_HI_PrmFileReadError(PRM_READ_PARAMETER_VALUE,recordNum,fStat);
|
||||
1: 350: return;
|
||||
-: 351: }
|
||||
3: 352: if (static_cast<U32>(readSize) != recordSize-sizeof(parameterId)) {
|
||||
1: 353: this->log_WARNING_HI_PrmFileReadError(PRM_READ_PARAMETER_VALUE_SIZE,recordNum,readSize);
|
||||
1: 354: return;
|
||||
-: 355: }
|
||||
-: 356:
|
||||
-: 357: // set serialized size to read size
|
||||
2: 358: desStat = this->m_db[entry].val.setBuffLen(readSize);
|
||||
-: 359: // should never fail
|
||||
2: 360: FW_ASSERT(Fw::FW_SERIALIZE_OK == desStat,(NATIVE_INT_TYPE)desStat);
|
||||
2: 361: recordNum++;
|
||||
-: 362:
|
||||
-: 363: }
|
||||
-: 364:
|
||||
2: 365: this->log_ACTIVITY_HI_PrmFileLoadComplete(recordNum);
|
||||
-: 366: }
|
||||
-: 367:
|
||||
-: 368:}
|
||||
@ -1,17 +0,0 @@
|
||||
File '/home/tcanham/source/isf/Svc/PrmDb/PrmDbImpl.cpp'
|
||||
Lines executed:98.96% of 192
|
||||
Creating 'PrmDbImpl.cpp.gcov'
|
||||
|
||||
File '/home/tcanham/source/isf/Fw/Types/EightyCharString.hpp'
|
||||
Lines executed:100.00% of 1
|
||||
Creating 'EightyCharString.hpp.gcov'
|
||||
|
||||
File '/home/tcanham/source/isf/Svc/PrmDb/PrmDbImpl.hpp'
|
||||
Lines executed:100.00% of 1
|
||||
Creating 'PrmDbImpl.hpp.gcov'
|
||||
|
||||
File '/home/tcanham/source/isf/Svc/PrmDb/PrmDbComponentAc.cpp'
|
||||
Lines executed:88.21% of 458
|
||||
Creating 'PrmDbComponentAc.cpp.gcov'
|
||||
|
||||
Lines executed:91.41% of 652
|
||||
@ -1,91 +0,0 @@
|
||||
Running test/ut/runtest_CYGWIN with output dir linux-cygwin-x86-ut-gnu-bin
|
||||
test/ut/runtest_CYGWIN linux-cygwin-x86-ut-gnu-bin
|
||||
Running /home/tcanham/source/isf/Svc/PrmDb/test/ut/linux-cygwin-x86-ut-gnu-bin/test_ut
|
||||
[==========] Running 6 tests from 1 test case.
|
||||
[----------] Global test environment set-up.
|
||||
[----------] 6 tests from ParameterDbTest
|
||||
[ RUN ] ParameterDbTest.NominalPopulateTest
|
||||
|
||||
***************************************
|
||||
TESTCASE 105.1.1: Nominal populate test
|
||||
***************************************
|
||||
|
||||
***************************************
|
||||
Write values to the parameter database and verify that they were written correctly
|
||||
***************************************
|
||||
|
||||
***************************************
|
||||
(RQ) ISF-PDB-003
|
||||
***************************************
|
||||
|
||||
***************************************
|
||||
(RQ) ISF-PDB-002
|
||||
***************************************
|
||||
[ OK ] ParameterDbTest.NominalPopulateTest (4 ms)
|
||||
[ RUN ] ParameterDbTest.NominalFileSaveTest
|
||||
|
||||
***************************************
|
||||
TESTCASE 105.1.2: Nominal file save test
|
||||
***************************************
|
||||
|
||||
***************************************
|
||||
Write values to the parameter database and save them to a file.
|
||||
***************************************
|
||||
|
||||
***************************************
|
||||
(RQ) ISF-PDB-004
|
||||
***************************************
|
||||
[ OK ] ParameterDbTest.NominalFileSaveTest (3 ms)
|
||||
[ RUN ] ParameterDbTest.NominalFileLoadTest
|
||||
|
||||
***************************************
|
||||
TESTCASE 105.1.3: Nominal file load test
|
||||
***************************************
|
||||
|
||||
***************************************
|
||||
Read values from the created file and verify they are correct.
|
||||
***************************************
|
||||
|
||||
***************************************
|
||||
(RQ) ISF-PDB-001
|
||||
***************************************
|
||||
[ OK ] ParameterDbTest.NominalFileLoadTest (4 ms)
|
||||
[ RUN ] ParameterDbTest.PrmMissingExtraParamsTest
|
||||
|
||||
***************************************
|
||||
TESTCASE 105.2.1: Missing and too many parameters test
|
||||
***************************************
|
||||
|
||||
***************************************
|
||||
Attempt to read a non-existent parameter and write too many parameters
|
||||
***************************************
|
||||
[ OK ] ParameterDbTest.PrmMissingExtraParamsTest (3 ms)
|
||||
[ RUN ] ParameterDbTest.PrmFileReadError
|
||||
|
||||
***************************************
|
||||
TESTCASE 105.2.2: File read errors
|
||||
***************************************
|
||||
|
||||
***************************************
|
||||
Induce errors at various stages of reading the file
|
||||
***************************************
|
||||
[ OK ] ParameterDbTest.PrmFileReadError (4 ms)
|
||||
[ RUN ] ParameterDbTest.PrmFileWriteError
|
||||
|
||||
***************************************
|
||||
TESTCASE 105.2.3: File write errors
|
||||
***************************************
|
||||
|
||||
***************************************
|
||||
Induce errors at various stages of writing the file
|
||||
***************************************
|
||||
[ OK ] ParameterDbTest.PrmFileWriteError (11 ms)
|
||||
[----------] 6 tests from ParameterDbTest (29 ms total)
|
||||
|
||||
[----------] Global test environment tear-down
|
||||
[==========] 6 tests from 1 test case ran. (29 ms total)
|
||||
[ PASSED ] 6 tests.
|
||||
make[1]: Leaving directory '/home/tcanham/source/isf/Svc/PrmDb'
|
||||
|
||||
12:24:11 Build Finished (took 6s.295ms)
|
||||
|
||||
@ -87,9 +87,7 @@ Unit Test Checklist | [Link](Checklist_Unit_Test.xlsx)
|
||||
|
||||
## 6. Unit Testing
|
||||
|
||||
[Unit Test Output](../test/ut/output/test.txt)
|
||||
|
||||
[Coverage Output - `RateGroupDriverImpl.cpp`](../test/ut/output/RateGroupDriverImpl.cpp.gcov)
|
||||
To see unit test coverage run fprime-util check --coverage
|
||||
|
||||
## 7. Change Log
|
||||
|
||||
|
||||
@ -1,116 +0,0 @@
|
||||
-: 0:Source:/home/tcanham/source/isf/Svc/RateGroupDriver/RateGroupDriverComponentAc.cpp
|
||||
-: 0:Programs:4
|
||||
-: 1:#include <stdio.h>
|
||||
-: 2:#include <FpConfig.hpp>
|
||||
-: 3:#include <Svc/RateGroupDriver/RateGroupDriverComponentAc.hpp>
|
||||
-: 4:#include <Fw/Types/Assert.hpp>
|
||||
-: 5:
|
||||
-: 6:#if FW_ENABLE_TEXT_LOGGING
|
||||
-: 7:#include <Fw/Types/EightyCharString.hpp>
|
||||
-: 8:#endif
|
||||
-: 9:// Namespace code
|
||||
-: 10:namespace Svc {
|
||||
-: 11:
|
||||
-: 12:// public methods
|
||||
-: 13:
|
||||
2: 14: Svc::InputCyclePort *RateGroupDriverComponentBase::get_CycleIn_InputPort(NATIVE_INT_TYPE portNum) {
|
||||
2: 15: FW_ASSERT(portNum < this->getNum_CycleIn_InputPorts());
|
||||
2: 16: return &this->m_CycleIn_InputPort[portNum];
|
||||
-: 17: }
|
||||
6: 18: void RateGroupDriverComponentBase::set_CycleOut_OutputPort(NATIVE_INT_TYPE portNum, Svc::InputCyclePort* port) {
|
||||
6: 19: FW_ASSERT(portNum < this->getNum_CycleOut_OutputPorts());
|
||||
6: 20: this->m_CycleOut_OutputPort[portNum].addCallPort(port);
|
||||
6: 21: }
|
||||
-: 22:
|
||||
-: 23:#if FW_PORT_SERIALIZATION
|
||||
-: 24:
|
||||
#####: 25: void RateGroupDriverComponentBase::set_CycleOut_OutputPort(NATIVE_INT_TYPE portNum, Fw::InputSerializePort *port) {
|
||||
#####: 26: FW_ASSERT(portNum < this->getNum_CycleOut_OutputPorts());
|
||||
#####: 27: return this->m_CycleOut_OutputPort[portNum].registerSerialPort(port);
|
||||
-: 28: }
|
||||
-: 29:#endif
|
||||
-: 30:
|
||||
-: 31:
|
||||
-: 32:
|
||||
-: 33:// protected methods
|
||||
-: 34:#if FW_OBJECT_NAMES == 1
|
||||
2: 35: RateGroupDriverComponentBase::RateGroupDriverComponentBase(const char* compName) : Fw::PassiveComponentBase(compName) {
|
||||
-: 36:#else
|
||||
-: 37: RateGroupDriverComponentBase::RateGroupDriverComponentBase() : Fw::PassiveComponentBase() {
|
||||
-: 38:#endif
|
||||
2: 39:}
|
||||
-: 40:
|
||||
-: 41:
|
||||
2: 42: void RateGroupDriverComponentBase::init(NATIVE_INT_TYPE instance) {
|
||||
-: 43:
|
||||
-: 44:
|
||||
-: 45: // initialize base class
|
||||
2: 46: Fw::PassiveComponentBase::init(instance);
|
||||
-: 47: // Input ports attached to component here with external component interfaces
|
||||
4: 48: for (NATIVE_INT_TYPE port = 0; port < this->getNum_CycleIn_InputPorts(); port++) {
|
||||
2: 49: this->m_CycleIn_InputPort[port].init();
|
||||
-: 50:
|
||||
2: 51: this->m_CycleIn_InputPort[port].addCallComp(this, m_p_CycleIn_in);
|
||||
-: 52:
|
||||
2: 53: this->m_CycleIn_InputPort[port].setPortNum(port);
|
||||
-: 54:#if FW_OBJECT_NAMES == 1
|
||||
-: 55: char portName[80];
|
||||
2: 56: (void)snprintf(portName, sizeof(portName), "%s_CycleIn_InputPort[%d]", this->m_objName, port);
|
||||
2: 57: this->m_CycleIn_InputPort[port].setObjName(portName);
|
||||
-: 58:#endif
|
||||
-: 59: }
|
||||
-: 60:
|
||||
-: 61: // Set output ports
|
||||
8: 62: for (NATIVE_INT_TYPE port = 0; port < this->getNum_CycleOut_OutputPorts(); port++) {
|
||||
6: 63: this->m_CycleOut_OutputPort[port].init();
|
||||
-: 64:#if FW_OBJECT_NAMES == 1
|
||||
-: 65: char portName[80];
|
||||
6: 66: (void)snprintf(portName, sizeof(portName), "%s_CycleOut_OutputPort[%d]", this->m_objName, port);
|
||||
6: 67: this->m_CycleOut_OutputPort[port].setObjName(portName);
|
||||
-: 68:#endif
|
||||
-: 69: }
|
||||
-: 70:
|
||||
-: 71:
|
||||
-: 72:
|
||||
2: 73: }
|
||||
-: 74:
|
||||
2: 75: RateGroupDriverComponentBase::~RateGroupDriverComponentBase() {
|
||||
2: 76: }
|
||||
-: 77:
|
||||
-: 78: // Up-calls, calls for output ports
|
||||
-: 79:
|
||||
220: 80: void RateGroupDriverComponentBase::CycleOut_out(NATIVE_INT_TYPE portNum, Svc::TimerVal cycle_start) {
|
||||
220: 81: FW_ASSERT(portNum < this->getNum_CycleOut_OutputPorts());
|
||||
220: 82: m_CycleOut_OutputPort[portNum].invoke(cycle_start);
|
||||
220: 83: }
|
||||
126: 84: NATIVE_INT_TYPE RateGroupDriverComponentBase::getNum_CycleIn_InputPorts(void) {
|
||||
126: 85: return (NATIVE_INT_TYPE) FW_NUM_ARRAY_ELEMENTS(this->m_CycleIn_InputPort);
|
||||
-: 86: }
|
||||
596: 87: NATIVE_INT_TYPE RateGroupDriverComponentBase::getNum_CycleOut_OutputPorts(void) {
|
||||
596: 88: return (NATIVE_INT_TYPE) FW_NUM_ARRAY_ELEMENTS(this->m_CycleOut_OutputPort);
|
||||
-: 89: }
|
||||
360: 90: bool RateGroupDriverComponentBase::isConnected_CycleOut_OutputPort(NATIVE_INT_TYPE portNum) {
|
||||
360: 91: FW_ASSERT(portNum < this->getNum_CycleOut_OutputPorts(),portNum);
|
||||
360: 92: return this->m_CycleOut_OutputPort[portNum].isConnected();
|
||||
-: 93: }
|
||||
-: 94:
|
||||
-: 95:// private methods
|
||||
-: 96:
|
||||
-: 97: // call for incoming port CycleIn
|
||||
120: 98: void RateGroupDriverComponentBase::m_p_CycleIn_in(Fw::PassiveComponentBase* callComp, NATIVE_INT_TYPE portNum, Svc::TimerVal cycle_start) {
|
||||
120: 99: FW_ASSERT(callComp);
|
||||
120: 100: RateGroupDriverComponentBase* compPtr = (RateGroupDriverComponentBase*)callComp;
|
||||
120: 101: compPtr->CycleIn_handlerBase(portNum, cycle_start);
|
||||
120: 102: }
|
||||
-: 103:
|
||||
120: 104: void RateGroupDriverComponentBase::CycleIn_handlerBase(NATIVE_INT_TYPE portNum, Svc::TimerVal cycle_start) {
|
||||
-: 105:
|
||||
-: 106: // make sure port number is valid
|
||||
120: 107: FW_ASSERT(portNum < this->getNum_CycleIn_InputPorts());
|
||||
-: 108: // Down call to pure virtual handler method implemented in Impl class
|
||||
120: 109: this->CycleIn_handler(portNum, cycle_start);
|
||||
120: 110: }
|
||||
-: 111:
|
||||
-: 112:
|
||||
-: 113:}
|
||||
-: 114:
|
||||
@ -1,71 +0,0 @@
|
||||
-: 0:Source:/home/tcanham/source/isf/Svc/RateGroupDriver/RateGroupDriverImpl.cpp
|
||||
-: 0:Programs:4
|
||||
-: 1:#include <Svc/RateGroupDriver/RateGroupDriverImpl.hpp>
|
||||
-: 2:#include <Fw/Types/BasicTypes.hpp>
|
||||
-: 3:#include <cstring>
|
||||
-: 4:#include <Fw/Types/Assert.hpp>
|
||||
-: 5:#include <stdio.h>
|
||||
-: 6:
|
||||
-: 7:namespace Svc {
|
||||
-: 8:
|
||||
-: 9:#if FW_OBJECT_NAMES == 1
|
||||
2: 10: RateGroupDriverImpl::RateGroupDriverImpl(const char* compName, I32 dividers[], I32 numDividers) :
|
||||
-: 11: RateGroupDriverComponentBase(compName),
|
||||
-: 12:#else
|
||||
-: 13: RateGroupDriverImpl::RateGroupDriverImpl(I32 dividers[], I32 numDividers) :
|
||||
-: 14:#endif
|
||||
2: 15: m_ticks(0),m_rollover(1)
|
||||
-: 16: {
|
||||
-: 17:
|
||||
-: 18: // double check arguments
|
||||
2: 19: FW_ASSERT(dividers);
|
||||
4: 20: FW_ASSERT(numDividers <= static_cast<NATIVE_INT_TYPE>(FW_NUM_ARRAY_ELEMENTS(this->m_dividers)),
|
||||
-: 21: numDividers,
|
||||
4: 22: static_cast<NATIVE_INT_TYPE>(FW_NUM_ARRAY_ELEMENTS(this->m_dividers)));
|
||||
-: 23: // verify port/table size matches
|
||||
4: 24: FW_ASSERT(FW_NUM_ARRAY_ELEMENTS(this->m_dividers) == this->getNum_CycleOut_OutputPorts(),
|
||||
-: 25: static_cast<NATIVE_INT_TYPE>(FW_NUM_ARRAY_ELEMENTS(this->m_dividers)),
|
||||
4: 26: this->getNum_CycleOut_OutputPorts());
|
||||
-: 27: // clear table
|
||||
2: 28: ::memset(this->m_dividers,0,sizeof(this->m_dividers));
|
||||
8: 29: for (NATIVE_INT_TYPE entry = 0; entry < numDividers; entry++) {
|
||||
6: 30: this->m_dividers[entry] = dividers[entry];
|
||||
-: 31: // rollover value should be product of all dividers to make sure integer rollover doesn't jump cycles
|
||||
-: 32: // only use non-zero dividers
|
||||
6: 33: if (dividers[entry] != 0) {
|
||||
6: 34: this->m_rollover *= dividers[entry];
|
||||
-: 35: }
|
||||
-: 36: }
|
||||
-: 37:
|
||||
2: 38: }
|
||||
-: 39:
|
||||
2: 40: RateGroupDriverImpl::~RateGroupDriverImpl(void) {
|
||||
-: 41:
|
||||
2: 42: }
|
||||
-: 43:
|
||||
2: 44: void RateGroupDriverImpl::init(void) {
|
||||
2: 45: RateGroupDriverComponentBase::init();
|
||||
2: 46: }
|
||||
-: 47:
|
||||
120: 48: void RateGroupDriverImpl::CycleIn_handler(NATIVE_INT_TYPE portNum, Svc::TimerVal cycle_start) {
|
||||
-: 49:
|
||||
-: 50: // Loop through each divider. For a given port, the port will be called when the divider value
|
||||
-: 51: // divides evenly into the number of ticks. For example, if the divider value for a port is 4,
|
||||
-: 52: // it would be called every fourth invocation of the CycleIn port.
|
||||
480: 53: for (NATIVE_INT_TYPE entry = 0; entry < static_cast<NATIVE_INT_TYPE>(FW_NUM_ARRAY_ELEMENTS(this->m_dividers)); entry++) {
|
||||
360: 54: if (this->m_dividers[entry] != 0) {
|
||||
360: 55: if (this->isConnected_CycleOut_OutputPort(entry)) {
|
||||
360: 56: if ((this->m_ticks % this->m_dividers[entry]) == 0) {
|
||||
220: 57: this->CycleOut_out(entry,cycle_start);
|
||||
-: 58: }
|
||||
-: 59: }
|
||||
-: 60: }
|
||||
-: 61: }
|
||||
-: 62:
|
||||
-: 63: // rollover the tick value when the tick count reaches the rollover value
|
||||
-: 64: // the rollover value is the product of all the dividers. See comment in constructor.
|
||||
120: 65: this->m_ticks = (this->m_ticks + 1) % this->m_rollover;
|
||||
-: 66:
|
||||
120: 67: }
|
||||
-: 68:
|
||||
-: 69:}
|
||||
@ -1,13 +0,0 @@
|
||||
File '/home/tcanham/source/isf/Svc/RateGroupDriver/RateGroupDriverImpl.cpp'
|
||||
Lines executed:100.00% of 26
|
||||
Creating 'RateGroupDriverImpl.cpp.gcov'
|
||||
|
||||
File '/home/tcanham/source/isf/Svc/Cycle/TimerVal.hpp'
|
||||
Lines executed:0.00% of 1
|
||||
Creating 'TimerVal.hpp.gcov'
|
||||
|
||||
File '/home/tcanham/source/isf/Svc/RateGroupDriver/RateGroupDriverComponentAc.cpp'
|
||||
Lines executed:93.62% of 47
|
||||
Creating 'RateGroupDriverComponentAc.cpp.gcov'
|
||||
|
||||
Lines executed:94.59% of 74
|
||||
@ -1,31 +0,0 @@
|
||||
Running test/ut/runtest_CYGWIN with output dir linux-cygwin-x86-ut-gnu-bin
|
||||
test/ut/runtest_CYGWIN linux-cygwin-x86-ut-gnu-bin
|
||||
Running /home/tcanham/source/isf/Svc/RateGroupDriver/test/ut/linux-cygwin-x86-ut-gnu-bin/test_ut
|
||||
[==========] Running 1 test from 1 test case.
|
||||
[----------] Global test environment set-up.
|
||||
[----------] 1 test from RateGroupDriverTest
|
||||
[ RUN ] RateGroupDriverTest.NominalSchedule
|
||||
|
||||
***************************************
|
||||
TESTCASE 106.1.1: Nominal Execution
|
||||
***************************************
|
||||
|
||||
***************************************
|
||||
Call the port with enough ticks that the internal rollover value will roll over.
|
||||
Verify that the output ports are being called correctly.
|
||||
|
||||
***************************************
|
||||
|
||||
***************************************
|
||||
(RQ) ISF-RGD-001
|
||||
***************************************
|
||||
[ OK ] RateGroupDriverTest.NominalSchedule (0 ms)
|
||||
[----------] 1 test from RateGroupDriverTest (0 ms total)
|
||||
|
||||
[----------] Global test environment tear-down
|
||||
[==========] 1 test from 1 test case ran. (1 ms total)
|
||||
[ PASSED ] 1 test.
|
||||
make[1]: Leaving directory '/home/tcanham/source/isf/Svc/RateGroupDriver'
|
||||
|
||||
14:16:26 Build Finished (took 9s.806ms)
|
||||
|
||||
@ -85,14 +85,7 @@ Unit Test Checklist | [Link](Checklist_Unit_Test.xlsx)
|
||||
|
||||
## 6. Unit Testing
|
||||
|
||||
File | Contents
|
||||
---- | --------
|
||||
Unit Test Output | [Link](../test/ut/output/test.txt)
|
||||
Coverage - TlmChanImpl.cpp | [Link](../test/ut/output/TlmChanImpl.cpp.gcov)
|
||||
Coverage - TlmChanImplGet.cpp | [Link](../test/ut/output/TlmChanImplGet.cpp.gcov)
|
||||
Coverage - TlmChanImplRecv.cpp | [Link](../test/ut/output/TlmChanImplRecv.cpp.gcov)
|
||||
Coverage - TlmChanImplTask.cpp | [Link](../test/ut/output/TlmChanImplTask.cpp.gcov)
|
||||
Coverage - TlmChanComponentAc.cpp | [Link](../test/ut/output/TlmChanComponentAc.cpp.gcov)
|
||||
To see unit test coverage run fprime-util check --coverage
|
||||
|
||||
## 7. Change Log
|
||||
|
||||
|
||||
@ -1,25 +0,0 @@
|
||||
File '/home/tim/source/isf/Svc/TlmChan/TlmChanImpl.cpp'
|
||||
Lines executed:100.00% of 24
|
||||
Creating 'TlmChanImpl.cpp.gcov'
|
||||
|
||||
File '/home/tim/source/isf/Svc/TlmChan/TlmChanImpl.hpp'
|
||||
Lines executed:100.00% of 2
|
||||
Creating 'TlmChanImpl.hpp.gcov'
|
||||
|
||||
File '/home/tim/source/isf/Svc/TlmChan/TlmChanImplRecv.cpp'
|
||||
Lines executed:100.00% of 28
|
||||
Creating 'TlmChanImplRecv.cpp.gcov'
|
||||
|
||||
File '/home/tim/source/isf/Svc/TlmChan/TlmChanImplGet.cpp'
|
||||
Lines executed:100.00% of 14
|
||||
Creating 'TlmChanImplGet.cpp.gcov'
|
||||
|
||||
File '/home/tim/source/isf/Svc/TlmChan/TlmChanImplTask.cpp'
|
||||
Lines executed:100.00% of 19
|
||||
Creating 'TlmChanImplTask.cpp.gcov'
|
||||
|
||||
File '/home/tim/source/isf/Svc/TlmChan/TlmChanComponentAc.cpp'
|
||||
Lines executed:96.60% of 147
|
||||
Creating 'TlmChanComponentAc.cpp.gcov'
|
||||
|
||||
Lines executed:97.86% of 234
|
||||
@ -1,589 +0,0 @@
|
||||
-: 0:Source:/home/tim/source/isf/Svc/TlmChan/TlmChanComponentAc.cpp
|
||||
-: 0:Programs:5
|
||||
-: 1:// ======================================================================
|
||||
-: 2:// \title TlmChanComponentAc.hpp
|
||||
-: 3:// \author Auto-generated
|
||||
-: 4:// \brief cpp file for TlmChan component base class
|
||||
-: 5://
|
||||
-: 6:// \copyright
|
||||
-: 7:// Copyright 2009-2015, by the California Institute of Technology.
|
||||
-: 8:// ALL RIGHTS RESERVED. United States Government Sponsorship
|
||||
-: 9:// acknowledged.
|
||||
-: 11://
|
||||
-: 18:// ======================================================================
|
||||
-: 19:
|
||||
-: 20:#include <stdio.h>
|
||||
-: 21:#include <FpConfig.hpp>
|
||||
-: 22:#include <Svc/TlmChan/TlmChanComponentAc.hpp>
|
||||
-: 23:#include <Fw/Types/Assert.hpp>
|
||||
-: 24:#if FW_ENABLE_TEXT_LOGGING
|
||||
-: 25:#include <Fw/Types/EightyCharString.hpp>
|
||||
-: 26:#endif
|
||||
-: 27:
|
||||
-: 28:
|
||||
-: 29:namespace Svc {
|
||||
-: 30:
|
||||
-: 31: // ----------------------------------------------------------------------
|
||||
-: 32: // Anonymous namespace to prevent name collisions
|
||||
-: 33: // ----------------------------------------------------------------------
|
||||
-: 34:
|
||||
-: 35: namespace {
|
||||
-: 36:
|
||||
-: 37: typedef enum {
|
||||
-: 38: TLMCHAN_COMPONENT_EXIT = Fw::ActiveComponentBase::ACTIVE_COMPONENT_EXIT,
|
||||
-: 39: RUN_SCHED
|
||||
-: 40: } MsgTypeEnum;
|
||||
-: 41:
|
||||
-: 42: // Get the max size by doing a union of the input port serialization sizes.
|
||||
-: 43:
|
||||
-: 44: typedef union {
|
||||
-: 45: BYTE port1[Svc::InputSchedPort::SERIALIZED_SIZE];
|
||||
-: 46: } BuffUnion;
|
||||
-: 47:
|
||||
-: 48: // Define a message buffer class large enough to handle all the
|
||||
-: 49: // asynchronous inputs to the component
|
||||
-: 50:
|
||||
12: 51: class ComponentIpcSerializableBuffer :
|
||||
-: 52: public Fw::SerializeBufferBase
|
||||
-: 53: {
|
||||
-: 54:
|
||||
-: 55: public:
|
||||
-: 56:
|
||||
-: 57: enum {
|
||||
-: 58: // Max. message size = size of data + message id + port
|
||||
-: 59: SERIALIZATION_SIZE =
|
||||
-: 60: sizeof(BuffUnion) +
|
||||
-: 61: sizeof(NATIVE_INT_TYPE) +
|
||||
-: 62: sizeof(NATIVE_INT_TYPE)
|
||||
-: 63: };
|
||||
-: 64:
|
||||
15: 65: NATIVE_UINT_TYPE getBuffCapacity(void) const {
|
||||
15: 66: return sizeof(m_buff);
|
||||
-: 67: }
|
||||
-: 68:
|
||||
93: 69: U8* getBuffAddr(void) {
|
||||
93: 70: return m_buff;
|
||||
-: 71: }
|
||||
-: 72:
|
||||
3: 73: const U8* getBuffAddr(void) const {
|
||||
3: 74: return m_buff;
|
||||
-: 75: }
|
||||
-: 76:
|
||||
-: 77: private:
|
||||
-: 78: // Should be the max of all the input ports serialized sizes...
|
||||
-: 79: U8 m_buff[SERIALIZATION_SIZE];
|
||||
-: 80:
|
||||
-: 81: };
|
||||
-: 82:
|
||||
-: 83: }
|
||||
-: 84:
|
||||
-: 85: // ----------------------------------------------------------------------
|
||||
-: 86: // Getters for numbers of input ports
|
||||
-: 87: // ----------------------------------------------------------------------
|
||||
-: 88:
|
||||
4: 89: Fw::InputTlmPort *TlmChanComponentBase ::
|
||||
-: 90: get_TlmRecv_InputPort(NATIVE_INT_TYPE portNum)
|
||||
-: 91: {
|
||||
4: 92: FW_ASSERT(portNum < this->getNum_TlmRecv_InputPorts(),static_cast<AssertArg>(portNum));
|
||||
4: 93: return &this->m_TlmRecv_InputPort[portNum];
|
||||
-: 94: }
|
||||
-: 95:
|
||||
4: 96: Fw::InputTlmPort *TlmChanComponentBase ::
|
||||
-: 97: get_TlmGet_InputPort(NATIVE_INT_TYPE portNum)
|
||||
-: 98: {
|
||||
4: 99: FW_ASSERT(portNum < this->getNum_TlmGet_InputPorts(),static_cast<AssertArg>(portNum));
|
||||
4: 100: return &this->m_TlmGet_InputPort[portNum];
|
||||
-: 101: }
|
||||
-: 102:
|
||||
4: 103: Svc::InputSchedPort *TlmChanComponentBase ::
|
||||
-: 104: get_Run_InputPort(NATIVE_INT_TYPE portNum)
|
||||
-: 105: {
|
||||
4: 106: FW_ASSERT(portNum < this->getNum_Run_InputPorts(),static_cast<AssertArg>(portNum));
|
||||
4: 107: return &this->m_Run_InputPort[portNum];
|
||||
-: 108: }
|
||||
-: 109:
|
||||
-: 110: // ----------------------------------------------------------------------
|
||||
-: 111: // Typed connectors for output ports
|
||||
-: 112: // ----------------------------------------------------------------------
|
||||
-: 113:
|
||||
4: 114: void TlmChanComponentBase ::
|
||||
-: 115: set_PktSend_OutputPort(
|
||||
-: 116: NATIVE_INT_TYPE portNum,
|
||||
-: 117: Fw::InputComPort* port
|
||||
-: 118: )
|
||||
-: 119: {
|
||||
4: 120: FW_ASSERT(portNum < this->getNum_PktSend_OutputPorts(),static_cast<AssertArg>(portNum));
|
||||
4: 121: this->m_PktSend_OutputPort[portNum].addCallPort(port);
|
||||
4: 122: }
|
||||
-: 123:
|
||||
-: 124: // ----------------------------------------------------------------------
|
||||
-: 125: // Serialization connectors for output ports
|
||||
-: 126: // ----------------------------------------------------------------------
|
||||
-: 127:
|
||||
-: 128:#if FW_PORT_SERIALIZATION
|
||||
-: 129:
|
||||
#####: 130: void TlmChanComponentBase ::
|
||||
-: 131: set_PktSend_OutputPort(
|
||||
-: 132: NATIVE_INT_TYPE portNum,
|
||||
-: 133: Fw::InputSerializePort *port
|
||||
-: 134: )
|
||||
-: 135: {
|
||||
#####: 136: FW_ASSERT(portNum < this->getNum_PktSend_OutputPorts(),static_cast<AssertArg>(portNum));
|
||||
#####: 137: return this->m_PktSend_OutputPort[portNum].registerSerialPort(port);
|
||||
-: 138: }
|
||||
-: 139:
|
||||
-: 140:#endif
|
||||
-: 141:
|
||||
-: 142: // ----------------------------------------------------------------------
|
||||
-: 143: // Component construction, initialization, and destruction
|
||||
-: 144: // ----------------------------------------------------------------------
|
||||
-: 145:
|
||||
4: 146: TlmChanComponentBase ::
|
||||
-: 147:#if FW_OBJECT_NAMES == 1
|
||||
-: 148: TlmChanComponentBase(const char* compName) :
|
||||
4: 149: Fw::ActiveComponentBase(compName)
|
||||
-: 150:#else
|
||||
-: 151: TlmChanComponentBase() :
|
||||
-: 152: Fw::ActiveComponentBase()
|
||||
-: 153:#endif
|
||||
-: 154: {
|
||||
-: 155:
|
||||
4: 156: }
|
||||
-: 157:
|
||||
4: 158: void TlmChanComponentBase ::
|
||||
-: 159: init(
|
||||
-: 160: NATIVE_INT_TYPE queueDepth,
|
||||
-: 161: NATIVE_INT_TYPE instance
|
||||
-: 162: )
|
||||
-: 163: {
|
||||
-: 164:
|
||||
-: 165: // Initialize base class
|
||||
4: 166: Fw::ActiveComponentBase::init(instance);
|
||||
-: 167:
|
||||
-: 168: // Connect input port TlmRecv
|
||||
16: 169: for (
|
||||
4: 170: NATIVE_INT_TYPE port = 0;
|
||||
8: 171: port < this->getNum_TlmRecv_InputPorts();
|
||||
-: 172: port++
|
||||
-: 173: ) {
|
||||
-: 174:
|
||||
4: 175: this->m_TlmRecv_InputPort[port].init();
|
||||
-: 176: this->m_TlmRecv_InputPort[port].addCallComp(
|
||||
-: 177: this,
|
||||
-: 178: m_p_TlmRecv_in
|
||||
4: 179: );
|
||||
4: 180: this->m_TlmRecv_InputPort[port].setPortNum(port);
|
||||
-: 181:
|
||||
-: 182:#if FW_OBJECT_NAMES == 1
|
||||
-: 183: char portName[80];
|
||||
-: 184: (void) snprintf(
|
||||
-: 185: portName,
|
||||
-: 186: sizeof(portName),
|
||||
-: 187: "%s_TlmRecv_InputPort[%d]",
|
||||
-: 188: this->m_objName,
|
||||
-: 189: port
|
||||
4: 190: );
|
||||
4: 191: this->m_TlmRecv_InputPort[port].setObjName(portName);
|
||||
-: 192:#endif
|
||||
-: 193:
|
||||
-: 194: }
|
||||
-: 195:
|
||||
-: 196: // Connect input port TlmGet
|
||||
16: 197: for (
|
||||
4: 198: NATIVE_INT_TYPE port = 0;
|
||||
8: 199: port < this->getNum_TlmGet_InputPorts();
|
||||
-: 200: port++
|
||||
-: 201: ) {
|
||||
-: 202:
|
||||
4: 203: this->m_TlmGet_InputPort[port].init();
|
||||
-: 204: this->m_TlmGet_InputPort[port].addCallComp(
|
||||
-: 205: this,
|
||||
-: 206: m_p_TlmGet_in
|
||||
4: 207: );
|
||||
4: 208: this->m_TlmGet_InputPort[port].setPortNum(port);
|
||||
-: 209:
|
||||
-: 210:#if FW_OBJECT_NAMES == 1
|
||||
-: 211: char portName[80];
|
||||
-: 212: (void) snprintf(
|
||||
-: 213: portName,
|
||||
-: 214: sizeof(portName),
|
||||
-: 215: "%s_TlmGet_InputPort[%d]",
|
||||
-: 216: this->m_objName,
|
||||
-: 217: port
|
||||
4: 218: );
|
||||
4: 219: this->m_TlmGet_InputPort[port].setObjName(portName);
|
||||
-: 220:#endif
|
||||
-: 221:
|
||||
-: 222: }
|
||||
-: 223:
|
||||
-: 224: // Connect input port Run
|
||||
16: 225: for (
|
||||
4: 226: NATIVE_INT_TYPE port = 0;
|
||||
8: 227: port < this->getNum_Run_InputPorts();
|
||||
-: 228: port++
|
||||
-: 229: ) {
|
||||
-: 230:
|
||||
4: 231: this->m_Run_InputPort[port].init();
|
||||
-: 232: this->m_Run_InputPort[port].addCallComp(
|
||||
-: 233: this,
|
||||
-: 234: m_p_Run_in
|
||||
4: 235: );
|
||||
4: 236: this->m_Run_InputPort[port].setPortNum(port);
|
||||
-: 237:
|
||||
-: 238:#if FW_OBJECT_NAMES == 1
|
||||
-: 239: char portName[80];
|
||||
-: 240: (void) snprintf(
|
||||
-: 241: portName,
|
||||
-: 242: sizeof(portName),
|
||||
-: 243: "%s_Run_InputPort[%d]",
|
||||
-: 244: this->m_objName,
|
||||
-: 245: port
|
||||
4: 246: );
|
||||
4: 247: this->m_Run_InputPort[port].setObjName(portName);
|
||||
-: 248:#endif
|
||||
-: 249:
|
||||
-: 250: }
|
||||
-: 251:
|
||||
-: 252: // Initialize output port PktSend
|
||||
16: 253: for (
|
||||
4: 254: NATIVE_INT_TYPE port = 0;
|
||||
8: 255: port < this->getNum_PktSend_OutputPorts();
|
||||
-: 256: port++
|
||||
-: 257: ) {
|
||||
4: 258: this->m_PktSend_OutputPort[port].init();
|
||||
-: 259:
|
||||
-: 260:#if FW_OBJECT_NAMES == 1
|
||||
-: 261: char portName[80];
|
||||
-: 262: (void) snprintf(
|
||||
-: 263: portName,
|
||||
-: 264: sizeof(portName),
|
||||
-: 265: "%s_PktSend_OutputPort[%d]",
|
||||
-: 266: this->m_objName,
|
||||
-: 267: port
|
||||
4: 268: );
|
||||
4: 269: this->m_PktSend_OutputPort[port].setObjName(portName);
|
||||
-: 270:#endif
|
||||
-: 271:
|
||||
-: 272: }
|
||||
-: 273:
|
||||
-: 274: Os::Queue::QueueStatus qStat =
|
||||
-: 275: this->createQueue(
|
||||
-: 276: queueDepth,
|
||||
-: 277: ComponentIpcSerializableBuffer::SERIALIZATION_SIZE
|
||||
4: 278: );
|
||||
-: 279: FW_ASSERT(
|
||||
-: 280: Os::Queue::QUEUE_OK == qStat,
|
||||
-: 281: static_cast<AssertArg>(qStat)
|
||||
4: 282: );
|
||||
-: 283:
|
||||
4: 284: }
|
||||
-: 285:
|
||||
4: 286: TlmChanComponentBase::
|
||||
4: 287: ~TlmChanComponentBase() {
|
||||
-: 288:
|
||||
4: 289: }
|
||||
-: 290:
|
||||
-: 291: // ----------------------------------------------------------------------
|
||||
-: 292: // Invocation functions for output ports
|
||||
-: 293: // ----------------------------------------------------------------------
|
||||
-: 294:
|
||||
23: 295: void TlmChanComponentBase ::
|
||||
-: 296: PktSend_out(
|
||||
-: 297: NATIVE_INT_TYPE portNum,
|
||||
-: 298: Fw::ComBuffer &data, U32 context
|
||||
-: 299: )
|
||||
-: 300: {
|
||||
23: 301: FW_ASSERT(portNum < this->getNum_PktSend_OutputPorts(),static_cast<AssertArg>(portNum));
|
||||
23: 302: m_PktSend_OutputPort[portNum].invoke(data, context);
|
||||
23: 303: }
|
||||
-: 304:
|
||||
-: 305: // ----------------------------------------------------------------------
|
||||
-: 306: // Getters for numbers of ports
|
||||
-: 307: // ----------------------------------------------------------------------
|
||||
-: 308:
|
||||
86: 309: NATIVE_INT_TYPE TlmChanComponentBase ::
|
||||
-: 310: getNum_TlmRecv_InputPorts(void)
|
||||
-: 311: {
|
||||
86: 312: return (NATIVE_INT_TYPE) FW_NUM_ARRAY_ELEMENTS(
|
||||
-: 313: this->m_TlmRecv_InputPort
|
||||
-: 314: );
|
||||
-: 315: }
|
||||
-: 316:
|
||||
87: 317: NATIVE_INT_TYPE TlmChanComponentBase ::
|
||||
-: 318: getNum_TlmGet_InputPorts(void)
|
||||
-: 319: {
|
||||
87: 320: return (NATIVE_INT_TYPE) FW_NUM_ARRAY_ELEMENTS(
|
||||
-: 321: this->m_TlmGet_InputPort
|
||||
-: 322: );
|
||||
-: 323: }
|
||||
-: 324:
|
||||
15: 325: NATIVE_INT_TYPE TlmChanComponentBase ::
|
||||
-: 326: getNum_Run_InputPorts(void)
|
||||
-: 327: {
|
||||
15: 328: return (NATIVE_INT_TYPE) FW_NUM_ARRAY_ELEMENTS(
|
||||
-: 329: this->m_Run_InputPort
|
||||
-: 330: );
|
||||
-: 331: }
|
||||
-: 332:
|
||||
38: 333: NATIVE_INT_TYPE TlmChanComponentBase ::
|
||||
-: 334: getNum_PktSend_OutputPorts(void)
|
||||
-: 335: {
|
||||
38: 336: return (NATIVE_INT_TYPE) FW_NUM_ARRAY_ELEMENTS(
|
||||
-: 337: this->m_PktSend_OutputPort
|
||||
-: 338: );
|
||||
-: 339: }
|
||||
-: 340:
|
||||
-: 341: // ----------------------------------------------------------------------
|
||||
-: 342: // Port connection status queries
|
||||
-: 343: // ----------------------------------------------------------------------
|
||||
-: 344:
|
||||
3: 345: bool TlmChanComponentBase ::
|
||||
-: 346: isConnected_PktSend_OutputPort(NATIVE_INT_TYPE portNum)
|
||||
-: 347: {
|
||||
3: 348: FW_ASSERT(
|
||||
-: 349: portNum < this->getNum_PktSend_OutputPorts(),
|
||||
-: 350: static_cast<AssertArg>(portNum)
|
||||
3: 351: );
|
||||
3: 352: return this->m_PktSend_OutputPort[portNum].isConnected();
|
||||
-: 353: }
|
||||
-: 354:
|
||||
-: 355: // ----------------------------------------------------------------------
|
||||
-: 356: // Mutex functions for guarded ports
|
||||
-: 357: // ----------------------------------------------------------------------
|
||||
-: 358:
|
||||
152: 359: void TlmChanComponentBase ::
|
||||
-: 360: lock(void)
|
||||
-: 361: {
|
||||
152: 362: this->m_guardedPortMutex.lock();
|
||||
152: 363: }
|
||||
-: 364:
|
||||
152: 365: void TlmChanComponentBase ::
|
||||
-: 366: unLock(void)
|
||||
-: 367: {
|
||||
152: 368: this->m_guardedPortMutex.unLock();
|
||||
152: 369: }
|
||||
-: 370:
|
||||
-: 371: // ----------------------------------------------------------------------
|
||||
-: 372: // Calls for messages received on typed input ports
|
||||
-: 373: // ----------------------------------------------------------------------
|
||||
-: 374:
|
||||
74: 375: void TlmChanComponentBase ::
|
||||
-: 376: m_p_TlmRecv_in(
|
||||
-: 377: Fw::PassiveComponentBase* callComp,
|
||||
-: 378: NATIVE_INT_TYPE portNum,
|
||||
-: 379: FwChanIdType id, Fw::Time &timeTag, Fw::TlmBuffer &val
|
||||
-: 380: )
|
||||
-: 381: {
|
||||
74: 382: FW_ASSERT(callComp);
|
||||
-: 383: TlmChanComponentBase* compPtr =
|
||||
74: 384: (TlmChanComponentBase*) callComp;
|
||||
74: 385: compPtr->TlmRecv_handlerBase(portNum, id, timeTag, val);
|
||||
74: 386: }
|
||||
-: 387:
|
||||
75: 388: void TlmChanComponentBase ::
|
||||
-: 389: m_p_TlmGet_in(
|
||||
-: 390: Fw::PassiveComponentBase* callComp,
|
||||
-: 391: NATIVE_INT_TYPE portNum,
|
||||
-: 392: FwChanIdType id, Fw::Time &timeTag, Fw::TlmBuffer &val
|
||||
-: 393: )
|
||||
-: 394: {
|
||||
75: 395: FW_ASSERT(callComp);
|
||||
-: 396: TlmChanComponentBase* compPtr =
|
||||
75: 397: (TlmChanComponentBase*) callComp;
|
||||
75: 398: compPtr->TlmGet_handlerBase(portNum, id, timeTag, val);
|
||||
75: 399: }
|
||||
-: 400:
|
||||
3: 401: void TlmChanComponentBase ::
|
||||
-: 402: m_p_Run_in(
|
||||
-: 403: Fw::PassiveComponentBase* callComp,
|
||||
-: 404: NATIVE_INT_TYPE portNum,
|
||||
-: 405: NATIVE_UINT_TYPE context
|
||||
-: 406: )
|
||||
-: 407: {
|
||||
3: 408: FW_ASSERT(callComp);
|
||||
-: 409: TlmChanComponentBase* compPtr =
|
||||
3: 410: (TlmChanComponentBase*) callComp;
|
||||
3: 411: compPtr->Run_handlerBase(portNum, context);
|
||||
3: 412: }
|
||||
-: 413:
|
||||
-: 414: // ----------------------------------------------------------------------
|
||||
-: 415: // Port handler base-class functions for typed input ports
|
||||
-: 416: // ----------------------------------------------------------------------
|
||||
-: 417:
|
||||
74: 418: void TlmChanComponentBase ::
|
||||
-: 419: TlmRecv_handlerBase(
|
||||
-: 420: NATIVE_INT_TYPE portNum,
|
||||
-: 421: FwChanIdType id, Fw::Time &timeTag, Fw::TlmBuffer &val
|
||||
-: 422: )
|
||||
-: 423: {
|
||||
-: 424:
|
||||
-: 425: // Make sure port number is valid
|
||||
74: 426: FW_ASSERT(portNum < this->getNum_TlmRecv_InputPorts(),static_cast<AssertArg>(portNum));
|
||||
-: 427:
|
||||
-: 428: // Lock guard mutex before calling
|
||||
74: 429: this->lock();
|
||||
-: 430:
|
||||
-: 431: // Down call to pure virtual handler method implemented in Impl class
|
||||
74: 432: this->TlmRecv_handler(portNum, id, timeTag, val);
|
||||
-: 433:
|
||||
-: 434: // Unlock guard mutex
|
||||
74: 435: this->unLock();
|
||||
-: 436:
|
||||
74: 437: }
|
||||
-: 438:
|
||||
75: 439: void TlmChanComponentBase ::
|
||||
-: 440: TlmGet_handlerBase(
|
||||
-: 441: NATIVE_INT_TYPE portNum,
|
||||
-: 442: FwChanIdType id, Fw::Time &timeTag, Fw::TlmBuffer &val
|
||||
-: 443: )
|
||||
-: 444: {
|
||||
-: 445:
|
||||
-: 446: // Make sure port number is valid
|
||||
75: 447: FW_ASSERT(portNum < this->getNum_TlmGet_InputPorts(),static_cast<AssertArg>(portNum));
|
||||
-: 448:
|
||||
-: 449: // Lock guard mutex before calling
|
||||
75: 450: this->lock();
|
||||
-: 451:
|
||||
-: 452: // Down call to pure virtual handler method implemented in Impl class
|
||||
75: 453: this->TlmGet_handler(portNum, id, timeTag, val);
|
||||
-: 454:
|
||||
-: 455: // Unlock guard mutex
|
||||
75: 456: this->unLock();
|
||||
-: 457:
|
||||
75: 458: }
|
||||
-: 459:
|
||||
3: 460: void TlmChanComponentBase ::
|
||||
-: 461: Run_handlerBase(
|
||||
-: 462: NATIVE_INT_TYPE portNum,
|
||||
-: 463: NATIVE_UINT_TYPE context
|
||||
-: 464: )
|
||||
-: 465: {
|
||||
-: 466:
|
||||
-: 467: // Make sure port number is valid
|
||||
3: 468: FW_ASSERT(portNum < this->getNum_Run_InputPorts(),static_cast<AssertArg>(portNum));
|
||||
-: 469:
|
||||
-: 470: // Call pre-message hook
|
||||
-: 471: Run_preMsgHook(
|
||||
-: 472: portNum,
|
||||
-: 473: context
|
||||
3: 474: );
|
||||
-: 475:
|
||||
3: 476: ComponentIpcSerializableBuffer msg;
|
||||
-: 477: Fw::SerializeStatus _status;
|
||||
-: 478:
|
||||
-: 479: _status = msg.serialize(
|
||||
-: 480: static_cast<NATIVE_INT_TYPE>(RUN_SCHED)
|
||||
3: 481: );
|
||||
-: 482: FW_ASSERT (
|
||||
-: 483: _status == Fw::FW_SERIALIZE_OK,
|
||||
-: 484: static_cast<AssertArg>(_status)
|
||||
3: 485: );
|
||||
-: 486:
|
||||
3: 487: _status = msg.serialize(portNum);
|
||||
-: 488: FW_ASSERT (
|
||||
-: 489: _status == Fw::FW_SERIALIZE_OK,
|
||||
-: 490: static_cast<AssertArg>(_status)
|
||||
3: 491: );
|
||||
-: 492:
|
||||
-: 493: // Serialize argument context
|
||||
3: 494: _status = msg.serialize(context);
|
||||
-: 495: FW_ASSERT(
|
||||
-: 496: _status == Fw::FW_SERIALIZE_OK,
|
||||
-: 497: static_cast<AssertArg>(_status)
|
||||
3: 498: );
|
||||
-: 499:
|
||||
-: 500: Os::Queue::QueueStatus qStatus =
|
||||
3: 501: this->m_queue.send(msg, 0);
|
||||
-: 502: FW_ASSERT(
|
||||
-: 503: qStatus == Os::Queue::QUEUE_OK,
|
||||
-: 504: static_cast<AssertArg>(qStatus)
|
||||
3: 505: );
|
||||
3: 506: }
|
||||
-: 507:
|
||||
-: 508: // ----------------------------------------------------------------------
|
||||
-: 509: // Pre-message hooks for async input ports
|
||||
-: 510: // ----------------------------------------------------------------------
|
||||
-: 511:
|
||||
3: 512: void TlmChanComponentBase ::
|
||||
-: 513: Run_preMsgHook(
|
||||
-: 514: NATIVE_INT_TYPE portNum,
|
||||
-: 515: NATIVE_UINT_TYPE context
|
||||
-: 516: )
|
||||
-: 517: {
|
||||
-: 518: // Default: no-op
|
||||
3: 519: }
|
||||
-: 520:
|
||||
-: 521: // ----------------------------------------------------------------------
|
||||
-: 522: // Message dispatch method for active and queued components. Called
|
||||
-: 523: // by active component thread or implementation code for queued components
|
||||
-: 524: // ----------------------------------------------------------------------
|
||||
-: 525:
|
||||
3: 526: Fw::QueuedComponentBase::MsgDispatchStatus TlmChanComponentBase ::
|
||||
-: 527: doDispatch(void)
|
||||
-: 528: {
|
||||
-: 529:
|
||||
3: 530: ComponentIpcSerializableBuffer msg;
|
||||
-: 531: NATIVE_INT_TYPE priority;
|
||||
-: 532:
|
||||
3: 533: Os::Queue::QueueStatus msgStatus = this->m_queue.receive(msg,priority);
|
||||
-: 534: FW_ASSERT(
|
||||
-: 535: msgStatus == Os::Queue::QUEUE_OK,
|
||||
-: 536: static_cast<AssertArg>(msgStatus)
|
||||
3: 537: );
|
||||
-: 538:
|
||||
-: 539: // Reset to beginning of buffer
|
||||
3: 540: msg.resetDeser();
|
||||
-: 541:
|
||||
-: 542: NATIVE_INT_TYPE desMsg;
|
||||
3: 543: Fw::SerializeStatus deserStatus = msg.deserialize(desMsg);
|
||||
-: 544: FW_ASSERT(
|
||||
-: 545: deserStatus == Fw::FW_SERIALIZE_OK,
|
||||
-: 546: static_cast<AssertArg>(deserStatus)
|
||||
3: 547: );
|
||||
-: 548:
|
||||
3: 549: MsgTypeEnum msgType = static_cast<MsgTypeEnum>(desMsg);
|
||||
-: 550:
|
||||
3: 551: if (msgType == TLMCHAN_COMPONENT_EXIT) {
|
||||
#####: 552: return MSG_DISPATCH_EXIT;
|
||||
-: 553: }
|
||||
-: 554:
|
||||
-: 555: NATIVE_INT_TYPE portNum;
|
||||
3: 556: deserStatus = msg.deserialize(portNum);
|
||||
-: 557: FW_ASSERT(
|
||||
-: 558: deserStatus == Fw::FW_SERIALIZE_OK,
|
||||
-: 559: static_cast<AssertArg>(deserStatus)
|
||||
3: 560: );
|
||||
-: 561:
|
||||
3: 562: switch (msgType) {
|
||||
-: 563:
|
||||
-: 564: // Handle async input port Run
|
||||
-: 565: case RUN_SCHED: {
|
||||
-: 566:
|
||||
-: 567: // Deserialize argument context
|
||||
-: 568: NATIVE_UINT_TYPE context;
|
||||
3: 569: deserStatus = msg.deserialize(context);
|
||||
-: 570: FW_ASSERT(
|
||||
-: 571: deserStatus == Fw::FW_SERIALIZE_OK,
|
||||
-: 572: static_cast<AssertArg>(deserStatus)
|
||||
3: 573: );
|
||||
-: 574:
|
||||
-: 575: // Call handler function
|
||||
-: 576: this->Run_handler(
|
||||
-: 577: portNum,
|
||||
-: 578: context
|
||||
3: 579: );
|
||||
-: 580:
|
||||
3: 581: break;
|
||||
-: 582:
|
||||
-: 583: }
|
||||
-: 584:
|
||||
-: 585: default:
|
||||
#####: 586: return MSG_DISPATCH_ERROR;
|
||||
-: 587:
|
||||
-: 588: }
|
||||
-: 589:
|
||||
6: 590: return MSG_DISPATCH_OK;
|
||||
-: 591:
|
||||
-: 592: }
|
||||
-: 593:
|
||||
-: 594:} // end namespace Svc
|
||||
@ -1,66 +0,0 @@
|
||||
-: 0:Source:/home/tim/source/isf/Svc/TlmChan/TlmChanImpl.cpp
|
||||
-: 0:Programs:5
|
||||
-: 1:/**
|
||||
-: 2: * \file
|
||||
-: 3: * \author T. Canham
|
||||
-: 4: * \brief Implementation file for channelized telemetry storage component
|
||||
-: 5: *
|
||||
-: 6: * \copyright
|
||||
-: 7: * Copyright 2009-2015, by the California Institute of Technology.
|
||||
-: 8: * ALL RIGHTS RESERVED. United States Government Sponsorship
|
||||
-: 9: * acknowledged.
|
||||
-: 11: * <br /><br />
|
||||
-: 18: */
|
||||
-: 19:#include <Svc/TlmChan/TlmChanImpl.hpp>
|
||||
-: 20:#include <cstring>
|
||||
-: 21:#include <Fw/Types/BasicTypes.hpp>
|
||||
-: 22:#include <Fw/Types/Assert.hpp>
|
||||
-: 23:#include <Fw/Com/ComBuffer.hpp>
|
||||
-: 24:
|
||||
-: 25:#include <stdio.h>
|
||||
-: 26:
|
||||
-: 27:namespace Svc {
|
||||
-: 28:
|
||||
-: 29:#if FW_OBJECT_NAMES == 1
|
||||
4: 30: TlmChanImpl::TlmChanImpl(const char* name) : TlmChanComponentBase(name)
|
||||
-: 31:#else
|
||||
-: 32: TlmChanImpl::TlmChanImpl()
|
||||
-: 33:#endif
|
||||
-: 34: {
|
||||
-: 35: // clear data
|
||||
4: 36: this->m_activeBuffer = 0;
|
||||
-: 37: // clear slot pointers
|
||||
64: 38: for (NATIVE_UINT_TYPE entry = 0; entry < TLMCHAN_NUM_TLM_HASH_SLOTS; entry++) {
|
||||
60: 39: this->m_tlmEntries[0].slots[entry] = 0;
|
||||
60: 40: this->m_tlmEntries[1].slots[entry] = 0;
|
||||
-: 41: }
|
||||
-: 42: // clear buckets
|
||||
204: 43: for (NATIVE_UINT_TYPE entry = 0; entry < TLMCHAN_HASH_BUCKETS; entry++) {
|
||||
200: 44: this->m_tlmEntries[0].buckets[entry].used = false;
|
||||
200: 45: this->m_tlmEntries[0].buckets[entry].bucketNo = entry;
|
||||
200: 46: this->m_tlmEntries[0].buckets[entry].next = 0;
|
||||
200: 47: this->m_tlmEntries[0].buckets[entry].id = 0;
|
||||
200: 48: this->m_tlmEntries[1].buckets[entry].used = false;
|
||||
200: 49: this->m_tlmEntries[1].buckets[entry].bucketNo = entry;
|
||||
200: 50: this->m_tlmEntries[1].buckets[entry].next = 0;
|
||||
200: 51: this->m_tlmEntries[1].buckets[entry].id = 0;
|
||||
-: 52: }
|
||||
-: 53: // clear free index
|
||||
4: 54: this->m_tlmEntries[0].free = 0;
|
||||
4: 55: this->m_tlmEntries[1].free = 0;
|
||||
-: 56:
|
||||
-: 57:
|
||||
4: 58: }
|
||||
-: 59:
|
||||
4: 60: TlmChanImpl::~TlmChanImpl() {
|
||||
4: 61: }
|
||||
-: 62:
|
||||
4: 63: void TlmChanImpl::init(NATIVE_INT_TYPE queueDepth) {
|
||||
4: 64: TlmChanComponentBase::init(queueDepth);
|
||||
4: 65: }
|
||||
-: 66:
|
||||
149: 67: NATIVE_UINT_TYPE TlmChanImpl::doHash(FwChanIdType id) {
|
||||
149: 68: return (id % TLMCHAN_HASH_MOD_VALUE)%TLMCHAN_NUM_TLM_HASH_SLOTS;
|
||||
-: 69: }
|
||||
-: 70:
|
||||
-: 71:}
|
||||
@ -1,73 +0,0 @@
|
||||
-: 0:Source:/home/tim/source/isf/Svc/TlmChan/TlmChanImpl.hpp
|
||||
-: 0:Programs:5
|
||||
-: 1:/**
|
||||
-: 2: * \file
|
||||
-: 3: * \author T. Canham
|
||||
-: 4: * \brief Component that stores telemetry channel values
|
||||
-: 5: *
|
||||
-: 6: * \copyright
|
||||
-: 7: * Copyright 2009-2015, by the California Institute of Technology.
|
||||
-: 8: * ALL RIGHTS RESERVED. United States Government Sponsorship
|
||||
-: 9: * acknowledged.
|
||||
-: 11: * <br /><br />
|
||||
-: 18: */
|
||||
-: 19:
|
||||
-: 20:#ifndef TELEMCHANIMPL_HPP_
|
||||
-: 21:#define TELEMCHANIMPL_HPP_
|
||||
-: 22:
|
||||
-: 23:#include <Svc/TlmChan/TlmChanComponentAc.hpp>
|
||||
-: 24:#include <TlmChanImplCfg.hpp>
|
||||
-: 25:#include <Os/Mutex.hpp>
|
||||
-: 26:#include <Fw/Tlm/TlmPacket.hpp>
|
||||
-: 27:
|
||||
-: 28:namespace Svc {
|
||||
-: 29:
|
||||
-: 30: class TlmChanImpl: public TlmChanComponentBase {
|
||||
-: 31: public:
|
||||
-: 32: friend class TlmChanImplTester;
|
||||
-: 33: #if FW_OBJECT_NAMES == 1
|
||||
-: 34: TlmChanImpl(const char* compName);
|
||||
-: 35: #else
|
||||
-: 36: TlmChanImpl();
|
||||
-: 37: #endif
|
||||
-: 38: virtual ~TlmChanImpl();
|
||||
-: 39: void init(NATIVE_INT_TYPE queueDepth);
|
||||
-: 40: PROTECTED:
|
||||
-: 41:
|
||||
-: 42: // can be overridden for alternate algorithms
|
||||
-: 43: virtual NATIVE_UINT_TYPE doHash(FwChanIdType id);
|
||||
-: 44:
|
||||
-: 45: PRIVATE:
|
||||
-: 46:
|
||||
-: 47: // Port functions
|
||||
-: 48: void TlmRecv_handler(NATIVE_INT_TYPE portNum, FwChanIdType id, Fw::Time &timeTag, Fw::TlmBuffer &val);
|
||||
-: 49: void TlmGet_handler(NATIVE_INT_TYPE portNum, FwChanIdType id, Fw::Time &timeTag, Fw::TlmBuffer &val);
|
||||
-: 50: void Run_handler(NATIVE_INT_TYPE portNum, NATIVE_UINT_TYPE context);
|
||||
-: 51:
|
||||
800: 52: typedef struct tlmEntry {
|
||||
-: 53: FwChanIdType id; //!< telemetry id stored in slot
|
||||
-: 54: bool updated; //!< set whenever a value has been written. Used to skip if writing out values for downlinking
|
||||
-: 55: Fw::Time lastUpdate; //!< last updated time
|
||||
-: 56: Fw::TlmBuffer buffer; //!< buffer to store serialized telemetry
|
||||
-: 57: tlmEntry* next; //!< pointer to next bucket in table
|
||||
-: 58: bool used; //!< if entry has been used
|
||||
-: 59: NATIVE_UINT_TYPE bucketNo; //!< for testing
|
||||
-: 60: } TlmEntry;
|
||||
-: 61:
|
||||
16: 62: struct TlmSet {
|
||||
-: 63: TlmEntry* slots[TLMCHAN_NUM_TLM_HASH_SLOTS]; //!< set of hash slots in hash table
|
||||
-: 64: TlmEntry buckets[TLMCHAN_HASH_BUCKETS]; //!< set of buckets used in hash table
|
||||
-: 65: NATIVE_INT_TYPE free; //!< next free bucket
|
||||
-: 66: } m_tlmEntries[2];
|
||||
-: 67:
|
||||
-: 68: U32 m_activeBuffer; // !< which buffer is active for storing telemetry
|
||||
-: 69:
|
||||
-: 70: // work variables
|
||||
-: 71: Fw::ComBuffer m_comBuffer;
|
||||
-: 72: Fw::TlmPacket m_tlmPacket;
|
||||
-: 73:
|
||||
-: 74: };
|
||||
-: 75:
|
||||
-: 76:}
|
||||
-: 77:
|
||||
-: 78:#endif /* TELEMCHANIMPL_HPP_ */
|
||||
@ -1,47 +0,0 @@
|
||||
-: 0:Source:/home/tim/source/isf/Svc/TlmChan/TlmChanImplGet.cpp
|
||||
-: 0:Programs:5
|
||||
-: 1:/*
|
||||
-: 2: * TelemChanImpl.cpp
|
||||
-: 3: *
|
||||
-: 4: * Created on: Mar 28, 2014
|
||||
-: 5: * Author: tcanham
|
||||
-: 6: */
|
||||
-: 7:
|
||||
-: 8:#include <Svc/TlmChan/TlmChanImpl.hpp>
|
||||
-: 9:#include <cstring>
|
||||
-: 10:#include <Fw/Types/BasicTypes.hpp>
|
||||
-: 11:#include <Fw/Types/Assert.hpp>
|
||||
-: 12:
|
||||
-: 13:#include <stdio.h>
|
||||
-: 14:
|
||||
-: 15:namespace Svc {
|
||||
-: 16:
|
||||
75: 17: void TlmChanImpl::TlmGet_handler(NATIVE_INT_TYPE portNum, FwChanIdType id, Fw::Time &timeTag, Fw::TlmBuffer &val) {
|
||||
-: 18:
|
||||
-: 19: // Compute index for entry
|
||||
-: 20:
|
||||
75: 21: NATIVE_UINT_TYPE index = this->doHash(id);
|
||||
-: 22:
|
||||
-: 23: // Search to see if channel has been stored
|
||||
75: 24: TlmEntry *entryToUse = this->m_tlmEntries[this->m_activeBuffer].slots[index];
|
||||
141: 25: for (NATIVE_UINT_TYPE bucket = 0; bucket < TLMCHAN_HASH_BUCKETS; bucket++) {
|
||||
141: 26: if (entryToUse) { // If bucket exists, check id
|
||||
140: 27: if (entryToUse->id == id) {
|
||||
74: 28: break;
|
||||
-: 29: } else { // otherwise go to next bucket
|
||||
66: 30: entryToUse = entryToUse->next;
|
||||
-: 31: }
|
||||
-: 32: } else { // no buckets left to search
|
||||
1: 33: break;
|
||||
-: 34: }
|
||||
-: 35: }
|
||||
-: 36:
|
||||
75: 37: if (entryToUse) {
|
||||
74: 38: val = entryToUse->buffer;
|
||||
74: 39: timeTag = entryToUse->lastUpdate;
|
||||
-: 40: } else { // requested entry may not be written yet; empty buffer
|
||||
1: 41: val.resetSer();
|
||||
-: 42: }
|
||||
-: 43:
|
||||
75: 44: }
|
||||
-: 45:}
|
||||
@ -1,67 +0,0 @@
|
||||
-: 0:Source:/home/tim/source/isf/Svc/TlmChan/TlmChanImplRecv.cpp
|
||||
-: 0:Programs:5
|
||||
-: 1:/*
|
||||
-: 2: * TelemChanImpl.cpp
|
||||
-: 3: *
|
||||
-: 4: * Created on: Mar 28, 2014
|
||||
-: 5: * Author: tcanham
|
||||
-: 6: */
|
||||
-: 7:
|
||||
-: 8:#include <Svc/TlmChan/TlmChanImpl.hpp>
|
||||
-: 9:#include <cstring>
|
||||
-: 10:#include <Fw/Types/BasicTypes.hpp>
|
||||
-: 11:#include <Fw/Types/Assert.hpp>
|
||||
-: 12:
|
||||
-: 13:#include <stdio.h>
|
||||
-: 14:
|
||||
-: 15:namespace Svc {
|
||||
-: 16:
|
||||
74: 17: void TlmChanImpl::TlmRecv_handler(NATIVE_INT_TYPE portNum, FwChanIdType id, Fw::Time &timeTag, Fw::TlmBuffer &val) {
|
||||
-: 18:
|
||||
-: 19: // Compute index for entry
|
||||
-: 20:
|
||||
74: 21: NATIVE_UINT_TYPE index = this->doHash(id);
|
||||
74: 22: TlmEntry* entryToUse = 0;
|
||||
74: 23: TlmEntry* prevEntry = 0;
|
||||
-: 24:
|
||||
-: 25: // Search to see if channel has already been stored or a bucket needs to be added
|
||||
74: 26: if (this->m_tlmEntries[this->m_activeBuffer].slots[index]) {
|
||||
42: 27: entryToUse = this->m_tlmEntries[this->m_activeBuffer].slots[index];
|
||||
108: 28: for (NATIVE_UINT_TYPE bucket = 0; bucket < TLMCHAN_HASH_BUCKETS; bucket++) {
|
||||
108: 29: if (entryToUse) {
|
||||
67: 30: if (entryToUse->id == id) { // found the matching entry
|
||||
1: 31: break;
|
||||
-: 32: } else { // try next entry
|
||||
66: 33: prevEntry = entryToUse;
|
||||
66: 34: entryToUse = entryToUse->next;
|
||||
-: 35: }
|
||||
-: 36: } else {
|
||||
-: 37: // Make sure that we haven't run out of buckets
|
||||
41: 38: FW_ASSERT(this->m_tlmEntries[this->m_activeBuffer].free < TLMCHAN_HASH_BUCKETS);
|
||||
-: 39: // add new bucket from free list
|
||||
41: 40: entryToUse = &this->m_tlmEntries[this->m_activeBuffer].buckets[this->m_tlmEntries[this->m_activeBuffer].free++];
|
||||
41: 41: prevEntry->next = entryToUse;
|
||||
-: 42: // clear next pointer
|
||||
41: 43: entryToUse->next = 0;
|
||||
41: 44: break;
|
||||
-: 45: }
|
||||
-: 46: }
|
||||
-: 47: } else {
|
||||
-: 48: // Make sure that we haven't run out of buckets
|
||||
32: 49: FW_ASSERT(this->m_tlmEntries[this->m_activeBuffer].free < TLMCHAN_HASH_BUCKETS);
|
||||
-: 50: // create new entry at slot head
|
||||
32: 51: this->m_tlmEntries[this->m_activeBuffer].slots[index] = &this->m_tlmEntries[this->m_activeBuffer].buckets[this->m_tlmEntries[this->m_activeBuffer].free++];
|
||||
32: 52: entryToUse = this->m_tlmEntries[this->m_activeBuffer].slots[index];
|
||||
32: 53: entryToUse->next = 0;
|
||||
-: 54: }
|
||||
-: 55:
|
||||
-: 56: // copy into entry
|
||||
74: 57: FW_ASSERT(entryToUse);
|
||||
74: 58: entryToUse->used = true;
|
||||
74: 59: entryToUse->id = id;
|
||||
74: 60: entryToUse->updated = true;
|
||||
74: 61: entryToUse->lastUpdate = timeTag;
|
||||
74: 62: entryToUse->buffer = val;
|
||||
-: 63:
|
||||
74: 64: }
|
||||
-: 65:}
|
||||
@ -1,59 +0,0 @@
|
||||
-: 0:Source:/home/tim/source/isf/Svc/TlmChan/TlmChanImplTask.cpp
|
||||
-: 0:Programs:5
|
||||
-: 1:/**
|
||||
-: 2: * \file
|
||||
-: 3: * \author T. Canham
|
||||
-: 4: * \brief Implementation for telemetry channel component thread.
|
||||
-: 5: *
|
||||
-: 6: * \copyright
|
||||
-: 7: * Copyright 2009-2015, by the California Institute of Technology.
|
||||
-: 8: * ALL RIGHTS RESERVED. United States Government Sponsorship
|
||||
-: 9: * acknowledged.
|
||||
-: 11: * <br /><br />
|
||||
-: 18: */
|
||||
-: 19:
|
||||
-: 20:#include <Svc/TlmChan/TlmChanImpl.hpp>
|
||||
-: 21:#include <cstring>
|
||||
-: 22:#include <Fw/Types/BasicTypes.hpp>
|
||||
-: 23:#include <Fw/Types/Assert.hpp>
|
||||
-: 24:#include <Fw/Tlm/TlmPacket.hpp>
|
||||
-: 25:#include <Fw/Com/ComBuffer.hpp>
|
||||
-: 26:
|
||||
-: 27:#include <stdio.h>
|
||||
-: 28:
|
||||
-: 29:namespace Svc {
|
||||
-: 30:
|
||||
3: 31: void TlmChanImpl::Run_handler(NATIVE_INT_TYPE portNum, NATIVE_UINT_TYPE context) {
|
||||
-: 32: // Only write packets if connected
|
||||
3: 33: if (not this->isConnected_PktSend_OutputPort(0)) {
|
||||
3: 34: return;
|
||||
-: 35: }
|
||||
-: 36:
|
||||
-: 37: // lock mutex long enough to modify active telemetry buffer
|
||||
-: 38: // so the data can be read without worrying about updates
|
||||
3: 39: this->lock();
|
||||
3: 40: this->m_activeBuffer = 1 - this->m_activeBuffer;
|
||||
-: 41: // set activeBuffer to not updated
|
||||
153: 42: for (U32 entry = 0; entry < TLMCHAN_HASH_BUCKETS; entry++) {
|
||||
150: 43: this->m_tlmEntries[this->m_activeBuffer].buckets[entry].updated = false;
|
||||
-: 44: }
|
||||
3: 45: this->unLock();
|
||||
-: 46:
|
||||
-: 47: // go through each entry and send a packet if it has been updated
|
||||
-: 48:
|
||||
153: 49: for (U32 entry = 0; entry < TLMCHAN_HASH_BUCKETS; entry++) {
|
||||
150: 50: TlmEntry* p_entry = &this->m_tlmEntries[1-this->m_activeBuffer].buckets[entry];
|
||||
150: 51: if ((p_entry->updated) && (p_entry->used)) {
|
||||
23: 52: this->m_tlmPacket.setId(p_entry->id);
|
||||
23: 53: this->m_tlmPacket.setTimeTag(p_entry->lastUpdate);
|
||||
23: 54: this->m_tlmPacket.setTlmBuffer(p_entry->buffer);
|
||||
23: 55: this->m_comBuffer.resetSer();
|
||||
23: 56: Fw::SerializeStatus stat = this->m_tlmPacket.serialize(this->m_comBuffer);
|
||||
23: 57: FW_ASSERT(Fw::FW_SERIALIZE_OK == stat,static_cast<NATIVE_INT_TYPE>(stat));
|
||||
23: 58: p_entry->updated = false;
|
||||
23: 59: this->PktSend_out(0,this->m_comBuffer,0);
|
||||
-: 60: }
|
||||
-: 61: }
|
||||
-: 62: }
|
||||
-: 63:
|
||||
-: 64:}
|
||||
@ -1,104 +0,0 @@
|
||||
Running test/ut/runtest_CYGWIN with output dir linux-cygwin-x86-ut-gnu-bin
|
||||
test/ut/runtest_CYGWIN linux-cygwin-x86-ut-gnu-bin
|
||||
Running /home/tcanham/source/isf/Svc/TlmChan/test/ut/linux-cygwin-x86-ut-gnu-bin/test_ut
|
||||
[==========] Running 4 tests from 1 test case.
|
||||
[----------] Global test environment set-up.
|
||||
[----------] 4 tests from TlmChanTest
|
||||
[ RUN ] TlmChanTest.NominalChannelTest
|
||||
|
||||
***************************************
|
||||
TESTCASE 107.1.1: Nominal channelized telemetry
|
||||
***************************************
|
||||
|
||||
***************************************
|
||||
Write a single channel and verify it is read back and pushed correctly.
|
||||
***************************************
|
||||
|
||||
***************************************
|
||||
(RQ) ISF-TLC-001
|
||||
***************************************
|
||||
|
||||
***************************************
|
||||
(RQ) ISF-TLC-002
|
||||
***************************************
|
||||
|
||||
***************************************
|
||||
(RQ) ISF-TLC-004
|
||||
***************************************
|
||||
|
||||
***************************************
|
||||
(RQ) ISF-TLC-003
|
||||
***************************************
|
||||
[ OK ] TlmChanTest.NominalChannelTest (4 ms)
|
||||
[ RUN ] TlmChanTest.MultiChannelTest
|
||||
|
||||
***************************************
|
||||
TESTCASE 107.1.2: Nominal Multi-channel channelized telemetry
|
||||
***************************************
|
||||
|
||||
***************************************
|
||||
Write multiple channels and verify they are read back and pushed correctly.
|
||||
***************************************
|
||||
Slot: 0
|
||||
Entry Ptr: 0x28a1a4 id: 0x00000300 bucket: 10 next: 0x28a4b4
|
||||
Entry Ptr: 0x28a4b4 id: 0x00000102 bucket: 17 next: 0x0
|
||||
Slot: 1
|
||||
Entry Ptr: 0x28a214 id: 0x00000301 bucket: 11 next: 0x28a524
|
||||
Entry Ptr: 0x28a524 id: 0x00000103 bucket: 18 next: 0x0
|
||||
Slot: 2
|
||||
Entry Ptr: 0x28a594 id: 0x00000104 bucket: 19 next: 0x0
|
||||
Slot: 3
|
||||
Entry Ptr: 0x28a604 id: 0x00000105 bucket: 20 next: 0x0
|
||||
Slot: 4
|
||||
Entry Ptr: 0x28a284 id: 0x00000400 bucket: 12 next: 0x0
|
||||
Slot: 5
|
||||
Entry Ptr: 0x289fe4 id: 0x00001100 bucket: 6 next: 0x28a2f4
|
||||
Entry Ptr: 0x28a2f4 id: 0x00000401 bucket: 13 next: 0x0
|
||||
Slot: 6
|
||||
Entry Ptr: 0x28a054 id: 0x00001101 bucket: 7 next: 0x28a364
|
||||
Entry Ptr: 0x28a364 id: 0x00000402 bucket: 14 next: 0x0
|
||||
Slot: 7
|
||||
Entry Ptr: 0x289d44 id: 0x00001000 bucket: 0 next: 0x28a0c4
|
||||
Entry Ptr: 0x28a0c4 id: 0x00001102 bucket: 8 next: 0x0
|
||||
Slot: 8
|
||||
Entry Ptr: 0x289db4 id: 0x00001001 bucket: 1 next: 0x28a134
|
||||
Entry Ptr: 0x28a134 id: 0x00001103 bucket: 9 next: 0x0
|
||||
Slot: 9
|
||||
Entry Ptr: 0x289e24 id: 0x00001002 bucket: 2 next: 0x0
|
||||
Slot: 10
|
||||
Entry Ptr: 0x289e94 id: 0x00001003 bucket: 3 next: 0x0
|
||||
Slot: 11
|
||||
Entry Ptr: 0x289f04 id: 0x00001004 bucket: 4 next: 0x0
|
||||
Slot: 12
|
||||
Entry Ptr: 0x289f74 id: 0x00001005 bucket: 5 next: 0x0
|
||||
Slot: 13
|
||||
Entry Ptr: 0x28a3d4 id: 0x00000100 bucket: 15 next: 0x0
|
||||
Slot: 14
|
||||
Entry Ptr: 0x28a444 id: 0x00000101 bucket: 16 next: 0x0
|
||||
|
||||
[ OK ] TlmChanTest.MultiChannelTest (3 ms)
|
||||
[ RUN ] TlmChanTest.OffNominal
|
||||
|
||||
***************************************
|
||||
TESTCASE 107.2.1: Off-nominal channelized telemetry
|
||||
***************************************
|
||||
|
||||
***************************************
|
||||
Attempt to read a channel that hasn't been written.
|
||||
***************************************
|
||||
[ OK ] TlmChanTest.OffNominal (3 ms)
|
||||
[ RUN ] TlmChanTest.TooManyChannels
|
||||
|
||||
***************************************
|
||||
Too Many Channel Test
|
||||
***************************************
|
||||
[ OK ] TlmChanTest.TooManyChannels (3 ms)
|
||||
[----------] 4 tests from TlmChanTest (13 ms total)
|
||||
|
||||
[----------] Global test environment tear-down
|
||||
[==========] 4 tests from 1 test case ran. (13 ms total)
|
||||
[ PASSED ] 4 tests.
|
||||
make[1]: Leaving directory '/home/tcanham/source/isf/Svc/TlmChan'
|
||||
|
||||
08:35:49 Build Finished (took 7s.48ms)
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user