23 m_computed(INITIAL_COMPUTED_VALUE),
32 this->m_computed = INITIAL_COMPUTED_VALUE;
40 this->m_computed =
update_crc_32(this->m_computed, buffer[index]);
47 this->m_computed = ~this->m_computed;
57 bool CmdSequencerComponentImpl::FPrimeSequence ::
61 if (this->m_crc.m_stored != this->m_crc.m_computed) {
62 this->m_events.fileCRCFailure(
64 this->m_crc.m_computed
78 this->setFileName(fileName);
80 const bool status = this->readFile()
81 and this->validateCRC()
82 and this->m_header.validateTime(this->m_component)
83 and this->validateRecords();
92 return this->m_buffer.getBuffLeft() > 0;
105 this->m_buffer.resetDeser();
111 this->m_buffer.resetSer();
114 bool CmdSequencerComponentImpl::FPrimeSequence ::
121 this->m_fileName.toChar(),
126 result = this->readOpenFile();
128 this->m_events.fileNotFound();
131 this->m_events.fileReadError();
135 this->m_sequenceFile.close();
140 bool CmdSequencerComponentImpl::FPrimeSequence ::
143 U8 *
const buffAddr = this->m_buffer.getBuffAddr();
145 bool status = this->readHeader();
148 status = this->deserializeHeader()
149 and this->readRecordsAndCRC()
150 and this->extractCRC();
154 this->m_crc.update(buffAddr, buffLen);
155 this->m_crc.finalize();
160 bool CmdSequencerComponentImpl::FPrimeSequence ::
164 Os::File& file = this->m_sequenceFile;
183 this->m_events.fileInvalid(
184 Events::FileReadStage::READ_HEADER,
191 this->m_events.fileInvalid(
192 Events::FileReadStage::READ_HEADER_SIZE,
210 bool CmdSequencerComponentImpl::FPrimeSequence ::
211 deserializeHeader(
void)
214 Header& header = this->m_header;
219 this->m_events.fileInvalid(
220 Events::FileReadStage::DESER_SIZE,
226 this->m_events.fileSizeError(header.m_fileSize);
230 serializeStatus = buffer.
deserialize(header.m_numRecords);
232 this->m_events.fileInvalid(
233 Events::FileReadStage::DESER_NUM_RECORDS,
242 this->m_events.fileInvalid(
243 Events::FileReadStage::DESER_TIME_BASE,
248 header.m_timeBase =
static_cast<TimeBase>(tbase);
250 serializeStatus = buffer.
deserialize(header.m_timeContext);
252 this->m_events.fileInvalid(
253 Events::FileReadStage::DESER_TIME_CONTEXT,
261 bool CmdSequencerComponentImpl::FPrimeSequence ::
262 readRecordsAndCRC(
void)
264 Os::File& file = this->m_sequenceFile;
275 this->m_events.fileInvalid(
276 Events::FileReadStage::READ_SEQ_DATA,
283 this->m_events.fileInvalid(
284 Events::FileReadStage::READ_SEQ_DATA_SIZE,
296 bool CmdSequencerComponentImpl::FPrimeSequence ::
300 U32& crc = this->m_crc.m_stored;
304 const U32 crcSize =
sizeof(crc);
306 if (buffSize < crcSize) {
307 this->m_events.fileInvalid(
308 Events::FileReadStage::READ_SEQ_CRC,
313 FW_ASSERT(buffSize >= crcSize, buffSize, crcSize);
320 status = crcBuff.deserialize(crc);
329 deserializeRecord(Record& record)
334 this->deserializeDescriptor(record.m_descriptor);
338 record.m_descriptor == Record::END_OF_SEQUENCE
344 status = this->deserializeTimeTag(record.m_timeTag);
347 status = this->deserializeRecordSize(recordSize);
350 status = this->copyCommand(record.m_command, recordSize);
357 deserializeDescriptor(Record::Descriptor& descriptor)
371 descriptor =
static_cast<Record::Descriptor
>(descEntry);
377 deserializeTimeTag(
Fw::Time& timeTag)
380 U32 seconds, useconds;
386 timeTag.
set(seconds,useconds);
392 deserializeRecordSize(U32& recordSize)
422 bool CmdSequencerComponentImpl::FPrimeSequence ::
423 validateRecords(
void)
426 const U32 numRecords = this->m_header.m_numRecords;
427 Sequence::Record record;
430 for (
NATIVE_UINT_TYPE recordNumber = 0; recordNumber < numRecords; recordNumber++) {
433 this->m_events.recordInvalid(recordNumber, status);
439 if (buffLeftSize > 0) {
440 this->m_events.recordMismatch(numRecords, buffLeftSize);