2 * \file trc_frame_deformatter.cpp
5 * \copyright Copyright (c) 2015, ARM Limited. All Rights Reserved.
9 * Redistribution and use in source and binary forms, with or without modification,
10 * are permitted provided that the following conditions are met:
12 * 1. Redistributions of source code must retain the above copyright notice,
13 * this list of conditions and the following disclaimer.
15 * 2. Redistributions in binary form must reproduce the above copyright notice,
16 * this list of conditions and the following disclaimer in the documentation
17 * and/or other materials provided with the distribution.
19 * 3. Neither the name of the copyright holder nor the names of its contributors
20 * may be used to endorse or promote products derived from this software without
21 * specific prior written permission.
23 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 'AS IS' AND
24 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
25 * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
26 * IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
27 * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
28 * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
29 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
30 * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
31 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
32 * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
36 #include "common/trc_frame_deformatter.h"
37 #include "trc_frame_deformatter_impl.h"
39 /***************************************************************/
41 /***************************************************************/
44 // G++ doesn't like the ## pasting
45 #define DEFORMATTER_NAME "DFMT_CSFRAMES"
48 #define DEFORMATTER_NAME OCSD_CMPNAME_PREFIX_FRAMEDEFORMATTER##"_CSFRAMES"
51 TraceFmtDcdImpl::TraceFmtDcdImpl() : TraceComponent(DEFORMATTER_NAME),
54 m_use_force_sync(false),
55 m_alignment(16), // assume frame aligned data as default.
56 m_b_output_packed_raw(false),
57 m_b_output_unpacked_raw(false)
61 setRawChanFilterAll(true);
64 TraceFmtDcdImpl::TraceFmtDcdImpl(int instNum) : TraceComponent(DEFORMATTER_NAME, instNum),
67 m_use_force_sync(false),
71 setRawChanFilterAll(true);
74 TraceFmtDcdImpl::~TraceFmtDcdImpl()
78 ocsd_datapath_resp_t TraceFmtDcdImpl::TraceDataIn(
79 const ocsd_datapath_op_t op,
80 const ocsd_trc_index_t index,
81 const uint32_t dataBlockSize,
82 const uint8_t *pDataBlock,
83 uint32_t *numBytesProcessed)
85 ocsd_datapath_resp_t resp = OCSD_RESP_FATAL_INVALID_OP;
86 InitCollateDataPathResp();
88 m_b_output_packed_raw = m_RawTraceFrame.num_attached() && ((m_cfgFlags & OCSD_DFRMTR_PACKED_RAW_OUT) != 0);
89 m_b_output_unpacked_raw = m_RawTraceFrame.num_attached() && ((m_cfgFlags & OCSD_DFRMTR_UNPACKED_RAW_OUT) != 0);
102 // local 'flush' here?
103 // pass on EOT to connected ID streams
104 resp = executeNoneDataOpAllIDs(OCSD_OP_EOT);
108 if((dataBlockSize <= 0) || ( pDataBlock == 0) || (numBytesProcessed == 0))
109 resp = OCSD_RESP_FATAL_INVALID_PARAM;
111 resp = processTraceData(index,dataBlockSize, pDataBlock, numBytesProcessed);
121 /* enable / disable ID streams - default as all enabled */
122 ocsd_err_t TraceFmtDcdImpl::OutputFilterIDs(std::vector<uint8_t> &id_list, bool bEnable)
124 ocsd_err_t err = OCSD_OK;
125 std::vector<uint8_t>::iterator iter = id_list.begin();
128 while((iter < id_list.end()) && (err == OCSD_OK))
132 err = OCSD_ERR_INVALID_ID;
135 m_IDStreams[id].set_enabled(bEnable);
136 m_raw_chan_enable[id] = bEnable;
143 ocsd_err_t TraceFmtDcdImpl::OutputFilterAllIDs(bool bEnable)
145 for(uint8_t id = 0; id < 128; id++)
147 m_IDStreams[id].set_enabled(bEnable);
149 setRawChanFilterAll(bEnable);
153 void TraceFmtDcdImpl::setRawChanFilterAll(bool bEnable)
155 for(int i=0; i<128; i++)
157 m_raw_chan_enable[i] = bEnable;
161 const bool TraceFmtDcdImpl::rawChanEnabled(const uint8_t id) const
164 return m_raw_chan_enable[id];
169 ocsd_datapath_resp_t TraceFmtDcdImpl::Reset()
172 InitCollateDataPathResp();
173 return executeNoneDataOpAllIDs(OCSD_OP_RESET);
176 ocsd_datapath_resp_t TraceFmtDcdImpl::Flush()
178 executeNoneDataOpAllIDs(OCSD_OP_FLUSH); // flush any upstream data.
180 outputFrame(); // try to flush any partial frame data remaining
181 return highestDataPathResp();
184 ocsd_datapath_resp_t TraceFmtDcdImpl::executeNoneDataOpAllIDs(ocsd_datapath_op_t op,
185 const ocsd_trc_index_t index /* = 0*/)
187 ITrcDataIn *pTrcComp = 0;
188 for(uint8_t id = 0; id < 128; id++)
190 if(m_IDStreams[id].num_attached())
192 pTrcComp = m_IDStreams[id].first();
195 CollateDataPathResp(pTrcComp->TraceDataIn(op,index,0,0,0));
196 pTrcComp = m_IDStreams[id].next();
201 if( m_RawTraceFrame.num_attached())
203 if(m_RawTraceFrame.first())
204 m_RawTraceFrame.first()->TraceRawFrameIn(op,0,OCSD_FRM_NONE,0,0,0);
206 return highestDataPathResp();
209 void TraceFmtDcdImpl::outputRawMonBytes(const ocsd_datapath_op_t op,
210 const ocsd_trc_index_t index,
211 const ocsd_rawframe_elem_t frame_element,
212 const int dataBlockSize,
213 const uint8_t *pDataBlock,
214 const uint8_t traceID)
216 if( m_RawTraceFrame.num_attached())
218 if(m_RawTraceFrame.first())
219 m_RawTraceFrame.first()->TraceRawFrameIn(op,index,frame_element,dataBlockSize, pDataBlock,traceID);
223 void TraceFmtDcdImpl::CollateDataPathResp(const ocsd_datapath_resp_t resp)
225 // simple most severe error across multiple IDs.
226 if(resp > m_highestResp) m_highestResp = resp;
229 ocsd_datapath_resp_t TraceFmtDcdImpl::processTraceData(
230 const ocsd_trc_index_t index,
231 const uint32_t dataBlockSize,
232 const uint8_t *pDataBlock,
233 uint32_t *numBytesProcessed
238 if(!m_first_data) // is this the initial data block?
240 m_trc_curr_idx = index;
244 if(m_trc_curr_idx != index) // none continuous trace data - throw an error.
245 throw ocsdError(OCSD_ERR_SEV_ERROR,OCSD_ERR_DFMTR_NOTCONTTRACE,index);
248 if(dataBlockSize % m_alignment) // must be correctly aligned data
250 ocsdError err(OCSD_ERR_SEV_ERROR, OCSD_ERR_INVALID_PARAM_VAL);
252 sprintf(msg_buffer,"Input block incorrect size, must be %d byte multiple", m_alignment);
253 err.setMessage(msg_buffer);
254 throw ocsdError(&err);
257 // record the incoming block for extraction routines to use.
258 m_in_block_base = pDataBlock;
259 m_in_block_size = dataBlockSize;
260 m_in_block_processed = 0;
262 // processing loop...
265 bool bProcessing = true;
268 bProcessing = extractFrame(); // will stop on end of input data.
270 bProcessing = unpackFrame();
272 bProcessing = outputFrame(); // will stop on data path halt.
276 catch(const ocsdError &err) {
278 CollateDataPathResp(OCSD_RESP_FATAL_INVALID_DATA);
281 LogError(ocsdError(OCSD_ERR_SEV_ERROR, OCSD_ERR_FAIL));
282 CollateDataPathResp(OCSD_RESP_FATAL_SYS_ERR);
288 // update the outputs.
289 *numBytesProcessed = m_in_block_processed;
291 return highestDataPathResp();
294 ocsd_err_t TraceFmtDcdImpl::DecodeConfigure(uint32_t flags)
296 const char *pszErrMsg = "";
297 ocsd_err_t err = OCSD_OK;
299 if((flags & ~OCSD_DFRMTR_VALID_MASK) != 0)
301 err = OCSD_ERR_INVALID_PARAM_VAL;
302 pszErrMsg = "Unknown Config Flags";
305 if((flags & OCSD_DFRMTR_VALID_MASK) == 0)
307 err = OCSD_ERR_INVALID_PARAM_VAL;
308 pszErrMsg = "No Config Flags Set";
311 if((flags & (OCSD_DFRMTR_HAS_FSYNCS | OCSD_DFRMTR_HAS_HSYNCS)) &&
312 (flags & OCSD_DFRMTR_FRAME_MEM_ALIGN)
315 err = OCSD_ERR_INVALID_PARAM_VAL;
316 pszErrMsg = "Invalid Config Flag Combination Set";
321 ocsdError errObj(OCSD_ERR_SEV_ERROR,OCSD_ERR_INVALID_PARAM_VAL);
322 errObj.setMessage(pszErrMsg);
329 if(flags & OCSD_DFRMTR_HAS_FSYNCS)
331 else if(flags & OCSD_DFRMTR_HAS_HSYNCS)
337 void TraceFmtDcdImpl::resetStateParams()
339 // overall dynamic state - intra frame
340 m_trc_curr_idx = OCSD_BAD_TRC_INDEX; /* source index of current trace data */
341 m_frame_synced = false;
342 m_first_data = false;
343 m_curr_src_ID = OCSD_BAD_CS_SRC_ID;
345 // current frame processing
346 m_ex_frm_n_bytes = 0;
347 m_trc_curr_idx_sof = OCSD_BAD_TRC_INDEX;
350 bool TraceFmtDcdImpl::checkForSync()
353 // 16 byte alignment - standard input buffers such as ETB
354 // FSYNC packets in the stream
355 // forced index programmed into the object.
356 uint32_t unsynced_bytes = 0;
362 // is the force sync point in this block?
363 if((m_force_sync_idx >= m_trc_curr_idx) && (m_force_sync_idx < (m_trc_curr_idx + m_in_block_size)))
365 unsynced_bytes = m_force_sync_idx - m_trc_curr_idx;
366 m_frame_synced = true;
370 unsynced_bytes = m_in_block_size;
373 else if( m_cfgFlags & OCSD_DFRMTR_HAS_FSYNCS) // memory aligned data
375 unsynced_bytes = findfirstFSync();
380 // OCSD_DFRMTR_FRAME_MEM_ALIGN - this has guaranteed 16 byte frame size and alignment.
381 m_frame_synced = true;
386 outputUnsyncedBytes(unsynced_bytes);
387 m_in_block_processed = unsynced_bytes;
388 m_trc_curr_idx += unsynced_bytes;
391 return m_frame_synced;
394 uint32_t TraceFmtDcdImpl::findfirstFSync()
396 uint32_t processed = 0;
397 const uint32_t FSYNC_PATTERN = 0x7FFFFFFF; // LE host pattern for FSYNC
398 const uint8_t *dataPtr = m_in_block_base;
400 while (processed < (m_in_block_size - 3))
402 if (*((uint32_t *)(dataPtr)) == FSYNC_PATTERN)
404 m_frame_synced = true;
413 void TraceFmtDcdImpl::outputUnsyncedBytes(uint32_t /*num_bytes*/)
418 int TraceFmtDcdImpl::checkForResetFSyncPatterns()
420 const uint32_t FSYNC_PATTERN = 0x7FFFFFFF; // LE host pattern for FSYNC
421 bool check_for_fsync = true;
423 const uint8_t *dataPtr = m_in_block_base + m_in_block_processed;
425 while (check_for_fsync && (m_in_block_processed < m_in_block_size))
427 // look for consecutive fsyncs as padding or for reset downstream - both cases will reset downstream....
428 if (*((uint32_t *)(dataPtr)) == FSYNC_PATTERN)
430 dataPtr += sizeof(uint32_t);
434 check_for_fsync = false;
439 printf("Frame deformatter: Found %d FSYNCS\n",num_fsyncs);
440 if ((num_fsyncs % 4) == 0)
442 // reset the upstream decoders
443 executeNoneDataOpAllIDs(OCSD_OP_RESET,m_trc_curr_idx);
445 // reset the intra frame parameters
446 m_curr_src_ID = OCSD_BAD_CS_SRC_ID;
447 m_ex_frm_n_bytes = 0;
448 m_trc_curr_idx_sof = OCSD_BAD_TRC_INDEX;
452 // TBD: throw processing error, none frame size block of fsyncs
455 return num_fsyncs * 4;
459 bool TraceFmtDcdImpl::extractFrame()
461 const uint32_t FSYNC_PATTERN = 0x7FFFFFFF; // LE host pattern for FSYNC
462 const uint16_t HSYNC_PATTERN = 0x7FFF; // LE host pattern for HSYNC
465 bool cont_process = true; // continue processing after extraction.
466 uint32_t f_sync_bytes = 0; // skipped f sync bytes
467 uint32_t h_sync_bytes = 0; // skipped h sync bytes
468 uint32_t ex_bytes = 0; // extracted this pass (may be filling out part frame)
470 // memory aligned sources are always multiples of frames, aligned to start.
471 if( m_cfgFlags & OCSD_DFRMTR_FRAME_MEM_ALIGN)
473 // some linux drivers (e.g. for perf) will insert FSYNCS to pad or differentiate
474 // between blocks of aligned data, always in frame aligned complete 16 byte frames.
475 if (m_cfgFlags & OCSD_DFRMTR_RESET_ON_4X_FSYNC)
477 f_sync_bytes = checkForResetFSyncPatterns();
479 /* in this case the FSYNC pattern is output on both packed and unpacked cases */
480 if (f_sync_bytes && (m_b_output_packed_raw || m_b_output_unpacked_raw))
482 outputRawMonBytes(OCSD_OP_DATA,
486 m_in_block_base + m_in_block_processed,
491 if((m_in_block_processed+f_sync_bytes) == m_in_block_size)
493 m_ex_frm_n_bytes = 0;
494 cont_process = false; // end of input data.
498 // always a complete frame.
499 m_ex_frm_n_bytes = OCSD_DFRMTR_FRAME_SIZE;
500 memcpy(m_ex_frm_data, m_in_block_base + m_in_block_processed + f_sync_bytes, m_ex_frm_n_bytes);
501 m_trc_curr_idx_sof = m_trc_curr_idx + f_sync_bytes;
502 ex_bytes = OCSD_DFRMTR_FRAME_SIZE;
507 // extract data accounting for frame syncs and hsyncs if present.
508 // we know we are aligned at this point - could be FSYNC or HSYNCs here.
510 // check what we a looking for
511 bool hasFSyncs = ((m_cfgFlags & OCSD_DFRMTR_HAS_FSYNCS) == OCSD_DFRMTR_HAS_FSYNCS);
512 bool hasHSyncs = ((m_cfgFlags & OCSD_DFRMTR_HAS_HSYNCS) == OCSD_DFRMTR_HAS_HSYNCS);
514 const uint8_t *dataPtr = m_in_block_base+m_in_block_processed;
515 const uint8_t *eodPtr = m_in_block_base+m_in_block_size;
517 cont_process = (bool)(dataPtr < eodPtr);
519 // can have FSYNCS at start of frame (in middle is an error).
520 if(hasFSyncs && cont_process && (m_ex_frm_n_bytes == 0))
522 while((*((uint32_t *)(dataPtr)) == FSYNC_PATTERN) && cont_process)
526 cont_process = (bool)(dataPtr < eodPtr);
531 while((m_ex_frm_n_bytes < OCSD_DFRMTR_FRAME_SIZE) && cont_process)
533 // check for illegal out of sequence FSYNC
534 if((m_ex_frm_n_bytes % 4) == 0)
536 if(*((uint32_t *)(dataPtr)) == FSYNC_PATTERN)
538 // throw an illegal FSYNC error
539 throw ocsdError(OCSD_ERR_SEV_ERROR, OCSD_ERR_DFMTR_BAD_FHSYNC, m_trc_curr_idx, "Bad FSYNC in frame.");
543 // mark start of frame after FSyncs
544 if(m_ex_frm_n_bytes == 0)
545 m_trc_curr_idx_sof = m_trc_curr_idx + f_sync_bytes;
547 m_ex_frm_data[m_ex_frm_n_bytes] = dataPtr[0];
548 m_ex_frm_data[m_ex_frm_n_bytes+1] = dataPtr[1];
552 // check pair is not HSYNC
553 if(*((uint16_t *)(dataPtr)) == HSYNC_PATTERN)
563 // throw illegal HSYNC error.
564 throw ocsdError(OCSD_ERR_SEV_ERROR, OCSD_ERR_DFMTR_BAD_FHSYNC, m_trc_curr_idx, "Bad HSYNC in frame.");
569 cont_process = (bool)(dataPtr < eodPtr);
572 // if we hit the end of data but still have a complete frame waiting,
573 // need to continue processing to allow it to be used.
574 if(!cont_process && (m_ex_frm_n_bytes == OCSD_DFRMTR_FRAME_SIZE))
578 // total bytes processed this pass
579 uint32_t total_processed = ex_bytes + f_sync_bytes + h_sync_bytes;
581 // output raw data on raw frame channel - packed raw.
582 if (((m_ex_frm_n_bytes == OCSD_DFRMTR_FRAME_SIZE) || !cont_process) && m_b_output_packed_raw)
584 outputRawMonBytes( OCSD_OP_DATA,
588 m_in_block_base+m_in_block_processed,
592 // update the processed count for the buffer
593 m_in_block_processed += total_processed;
595 // update index past the processed data
596 m_trc_curr_idx += total_processed;
601 bool TraceFmtDcdImpl::unpackFrame()
603 // unpack cannot fail as never called on incomplete frame.
604 uint8_t frameFlagBit = 0x1;
605 uint8_t newSrcID = OCSD_BAD_CS_SRC_ID;
606 bool PrevIDandIDChange = false;
608 // init output processing
612 // set up first out data packet...
613 m_out_data[m_out_data_idx].id = m_curr_src_ID;
614 m_out_data[m_out_data_idx].valid = 0;
615 m_out_data[m_out_data_idx].index = m_trc_curr_idx_sof;
616 m_out_data[m_out_data_idx].used = 0;
618 // work on byte pairs - bytes 0 - 13.
619 for(int i = 0; i < 14; i+=2)
621 PrevIDandIDChange = false;
624 if(m_ex_frm_data[i] & 0x1)
626 newSrcID = (m_ex_frm_data[i] >> 1) & 0x7f;
627 if(newSrcID != m_curr_src_ID) // ID change
629 PrevIDandIDChange = ((frameFlagBit & m_ex_frm_data[15]) != 0);
631 // following byte for old id?
632 if(PrevIDandIDChange)
633 // 2nd byte always data
634 m_out_data[m_out_data_idx].data[m_out_data[m_out_data_idx].valid++] = m_ex_frm_data[i+1];
637 m_curr_src_ID = newSrcID;
639 // if we already have data in this buffer
640 if(m_out_data[m_out_data_idx].valid > 0)
642 m_out_data_idx++; // move to next buffer
643 m_out_data[m_out_data_idx].valid = 0;
644 m_out_data[m_out_data_idx].used = 0;
645 m_out_data[m_out_data_idx].index = m_trc_curr_idx_sof + i;
648 // set new ID on buffer
649 m_out_data[m_out_data_idx].id = m_curr_src_ID;
651 /// TBD - ID indexing in here.
657 m_out_data[m_out_data_idx].data[m_out_data[m_out_data_idx].valid++] = m_ex_frm_data[i] | ((frameFlagBit & m_ex_frm_data[15]) ? 0x1 : 0x0);
660 // 2nd byte always data
661 if(!PrevIDandIDChange) // output only if we didn't for an ID change + prev ID.
662 m_out_data[m_out_data_idx].data[m_out_data[m_out_data_idx].valid++] = m_ex_frm_data[i+1];
670 if(m_ex_frm_data[14] & 0x1)
672 // no matter if change or not, no associated data in byte 15 anyway so just set.
673 m_curr_src_ID = (m_ex_frm_data[14] >> 1) & 0x7f;
678 m_out_data[m_out_data_idx].data[m_out_data[m_out_data_idx].valid++] = m_ex_frm_data[14] | ((frameFlagBit & m_ex_frm_data[15]) ? 0x1 : 0x0);
680 m_ex_frm_n_bytes = 0; // mark frame as empty;
684 // output data to channels.
685 bool TraceFmtDcdImpl::outputFrame()
687 bool cont_processing = true;
688 ITrcDataIn *pDataIn = 0;
691 // output each valid ID within the frame - stopping if we get a wait or error
692 while((m_out_processed < (m_out_data_idx + 1)) && cont_processing)
695 // may have data prior to a valid ID appearing
696 if(m_out_data[m_out_processed].id != OCSD_BAD_CS_SRC_ID)
698 if((pDataIn = m_IDStreams[m_out_data[m_out_processed].id].first()) != 0)
700 // log the stuff we are about to put out early so as to make it visible before interpretation
701 // however, don't re-output if only part used first time round.
702 if(m_b_output_unpacked_raw && (m_out_data[m_out_processed].used == 0) && rawChanEnabled( m_out_data[m_out_processed].id))
704 outputRawMonBytes( OCSD_OP_DATA,
705 m_out_data[m_out_processed].index,
707 m_out_data[m_out_processed].valid,
708 m_out_data[m_out_processed].data,
709 m_out_data[m_out_processed].id);
712 // output to the connected packet process
713 CollateDataPathResp(pDataIn->TraceDataIn(OCSD_OP_DATA,
714 m_out_data[m_out_processed].index + m_out_data[m_out_processed].used,
715 m_out_data[m_out_processed].valid - m_out_data[m_out_processed].used,
716 m_out_data[m_out_processed].data + m_out_data[m_out_processed].used,
721 cont_processing = false;
722 m_out_data[m_out_processed].used += bytes_used;
723 if(m_out_data[m_out_processed].used == m_out_data[m_out_processed].valid)
724 m_out_processed++; // we have used up all this data.
728 m_out_processed++; // we have sent this data;
733 // optional raw output for debugging / monitor tools
734 if(m_b_output_unpacked_raw && rawChanEnabled( m_out_data[m_out_processed].id))
736 outputRawMonBytes( OCSD_OP_DATA,
737 m_out_data[m_out_processed].index,
739 m_out_data[m_out_processed].valid,
740 m_out_data[m_out_processed].data,
741 m_out_data[m_out_processed].id);
743 m_out_processed++; // skip past this data.
748 // optional raw output for debugging / monitor tools of unknown src ID data
749 if(m_b_output_unpacked_raw)
751 outputRawMonBytes( OCSD_OP_DATA,
752 m_out_data[m_out_processed].index,
754 m_out_data[m_out_processed].valid,
755 m_out_data[m_out_processed].data,
756 m_out_data[m_out_processed].id);
758 m_out_processed++; // skip past this data.
761 return cont_processing;
764 /***************************************************************/
766 /***************************************************************/
767 TraceFormatterFrameDecoder::TraceFormatterFrameDecoder() : m_pDecoder(0)
772 TraceFormatterFrameDecoder::TraceFormatterFrameDecoder(int instNum) : m_pDecoder(0)
777 TraceFormatterFrameDecoder::~TraceFormatterFrameDecoder()
786 /* the data input interface from the reader / source */
787 ocsd_datapath_resp_t TraceFormatterFrameDecoder::TraceDataIn( const ocsd_datapath_op_t op,
788 const ocsd_trc_index_t index,
789 const uint32_t dataBlockSize,
790 const uint8_t *pDataBlock,
791 uint32_t *numBytesProcessed)
793 return (m_pDecoder == 0) ? OCSD_RESP_FATAL_NOT_INIT : m_pDecoder->TraceDataIn(op,index,dataBlockSize,pDataBlock,numBytesProcessed);
796 /* attach a data processor to a stream ID output */
797 componentAttachPt<ITrcDataIn> *TraceFormatterFrameDecoder::getIDStreamAttachPt(uint8_t ID)
799 componentAttachPt<ITrcDataIn> *pAttachPt = 0;
800 if((ID < 128) && (m_pDecoder != 0))
801 pAttachPt = &(m_pDecoder->m_IDStreams[ID]);
805 /* attach a data processor to the raw frame output */
806 componentAttachPt<ITrcRawFrameIn> *TraceFormatterFrameDecoder::getTrcRawFrameAttachPt()
808 return (m_pDecoder != 0) ? &m_pDecoder->m_RawTraceFrame : 0;
812 componentAttachPt<ITrcSrcIndexCreator> *TraceFormatterFrameDecoder::getTrcSrcIndexAttachPt()
814 return (m_pDecoder != 0) ? &m_pDecoder->m_SrcIndexer : 0;
817 componentAttachPt<ITraceErrorLog> *TraceFormatterFrameDecoder::getErrLogAttachPt()
819 return (m_pDecoder != 0) ? m_pDecoder->getErrorLogAttachPt() : 0;
822 /* configuration - set operational mode for incoming stream (has FSYNCS etc) */
823 ocsd_err_t TraceFormatterFrameDecoder::Configure(uint32_t cfg_flags)
828 m_pDecoder = new (std::nothrow) TraceFmtDcdImpl(m_instNum);
830 m_pDecoder = new (std::nothrow) TraceFmtDcdImpl();
831 if(!m_pDecoder) return OCSD_ERR_MEM;
833 m_pDecoder->DecodeConfigure(cfg_flags);
837 const uint32_t TraceFormatterFrameDecoder::getConfigFlags() const
841 flags = m_pDecoder->m_cfgFlags;
846 /* enable / disable ID streams - default as all enabled */
847 ocsd_err_t TraceFormatterFrameDecoder::OutputFilterIDs(std::vector<uint8_t> &id_list, bool bEnable)
849 return (m_pDecoder == 0) ? OCSD_ERR_NOT_INIT : m_pDecoder->OutputFilterIDs(id_list,bEnable);
852 ocsd_err_t TraceFormatterFrameDecoder::OutputFilterAllIDs(bool bEnable)
854 return (m_pDecoder == 0) ? OCSD_ERR_NOT_INIT : m_pDecoder->OutputFilterAllIDs(bEnable);
858 ocsd_datapath_resp_t TraceFormatterFrameDecoder::Reset()
860 return (m_pDecoder == 0) ? OCSD_RESP_FATAL_NOT_INIT : m_pDecoder->Reset();
863 ocsd_datapath_resp_t TraceFormatterFrameDecoder::Flush()
865 return (m_pDecoder == 0) ? OCSD_RESP_FATAL_NOT_INIT : m_pDecoder->Flush();
869 /* End of File trc_frame_deformatter.cpp */