aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMike Leach <mike.leach@linaro.org>2017-09-07 17:08:49 +0100
committerMike Leach <mike.leach@linaro.org>2017-09-08 14:04:59 +0100
commit3a49f9c91deb64cbd2b509073478d243e853f7d9 (patch)
tree4a16771f1bdb079c0e1e0aa1081fe9741907d687
parent38c8514d86c1032a938ebe5da72a6d6cf73b4172 (diff)
opencsd: ptm: Bugfix on packet processor
Fixes issue with PTM packet processor incorrectly detecting ASYNC packets. Fixes incorrect intilisation issue. Signed-off-by: Mike Leach <mike.leach@linaro.org>
-rw-r--r--decoder/build/linux/makefile2
-rw-r--r--decoder/include/ptm/trc_pkt_proc_ptm.h1
-rw-r--r--decoder/source/ptm/trc_pkt_proc_ptm.cpp21
3 files changed, 16 insertions, 8 deletions
diff --git a/decoder/build/linux/makefile b/decoder/build/linux/makefile
index d578bbddd41e..c9724bbfb371 100644
--- a/decoder/build/linux/makefile
+++ b/decoder/build/linux/makefile
@@ -31,7 +31,7 @@
#
# command line options
# DEBUG=1 create a debug build
-# LINUX64=1 create a 64 bit build
+#
# Set project root - relative to build directory
ifeq ($(OCSD_ROOT),)
diff --git a/decoder/include/ptm/trc_pkt_proc_ptm.h b/decoder/include/ptm/trc_pkt_proc_ptm.h
index d26e7f58af6c..87e933a3225d 100644
--- a/decoder/include/ptm/trc_pkt_proc_ptm.h
+++ b/decoder/include/ptm/trc_pkt_proc_ptm.h
@@ -104,6 +104,7 @@ protected:
ocsd_datapath_resp_t waitASync(); //!< look for first synchronisation point in the packet stream
bool m_waitASyncSOPkt;
bool m_bAsyncRawOp;
+ bool m_bOPNotSyncPkt; //!< true if output not sync packet when waiting for ASYNC
// ** packet processing functions.
void pktASync();
diff --git a/decoder/source/ptm/trc_pkt_proc_ptm.cpp b/decoder/source/ptm/trc_pkt_proc_ptm.cpp
index 0961c1e88ee2..285592d51d47 100644
--- a/decoder/source/ptm/trc_pkt_proc_ptm.cpp
+++ b/decoder/source/ptm/trc_pkt_proc_ptm.cpp
@@ -171,7 +171,7 @@ ocsd_datapath_resp_t TrcPktProcPtm::processData( const ocsd_trc_index_t index,
ocsd_datapath_resp_t TrcPktProcPtm::onEOT()
{
ocsd_datapath_resp_t err = OCSD_RESP_FATAL_NOT_INIT;
- if(!checkInit())
+ if(checkInit())
{
err = OCSD_RESP_CONT;
if(m_currPacketData.size() > 0)
@@ -186,7 +186,7 @@ ocsd_datapath_resp_t TrcPktProcPtm::onEOT()
ocsd_datapath_resp_t TrcPktProcPtm::onReset()
{
ocsd_datapath_resp_t err = OCSD_RESP_FATAL_NOT_INIT;
- if(!checkInit())
+ if(checkInit())
{
InitProcessorState();
err = OCSD_RESP_CONT;
@@ -197,7 +197,7 @@ ocsd_datapath_resp_t TrcPktProcPtm::onReset()
ocsd_datapath_resp_t TrcPktProcPtm::onFlush()
{
ocsd_datapath_resp_t err = OCSD_RESP_FATAL_NOT_INIT;
- if(!checkInit())
+ if(checkInit())
{
err = OCSD_RESP_CONT;
}
@@ -223,6 +223,7 @@ void TrcPktProcPtm::InitProcessorState()
m_async_0 = 0;
m_waitASyncSOPkt = false;
m_bAsyncRawOp = false;
+ m_bOPNotSyncPkt = false;
m_curr_packet.ResetState();
InitPacketState();
@@ -319,7 +320,8 @@ ocsd_datapath_resp_t TrcPktProcPtm::waitASync()
if(m_pDataIn[m_dataInProcessed++] == 0x00)
{
m_waitASyncSOPkt = true;
- m_currPacketData.push_back(0);
+ m_currPacketData.push_back(0);
+ m_async_0 = 1;
}
else
{
@@ -352,10 +354,15 @@ ocsd_datapath_resp_t TrcPktProcPtm::waitASync()
}
outputRawPacketToMonitor(m_curr_pkt_index,&m_curr_packet,unsynced_bytes,m_pDataIn+unsync_scan_block_start);
}
- resp = outputDecodedPacket(m_curr_pkt_index,&m_curr_packet);
+ if (!m_bOPNotSyncPkt)
+ {
+ resp = outputDecodedPacket(m_curr_pkt_index, &m_curr_packet);
+ m_bOPNotSyncPkt = true;
+ }
unsync_scan_block_start += unsynced_bytes;
m_curr_pkt_index+= unsynced_bytes;
unsynced_bytes = 0;
+ bSendUnsyncedData = false;
}
// mark next packet as the ASYNC we are looking for.
@@ -394,7 +401,7 @@ void TrcPktProcPtm::pktASync()
TrcPktProcPtm::async_result_t TrcPktProcPtm::findAsync()
{
async_result_t async_res = NOT_ASYNC;
- bool bFound = false;
+ bool bFound = false; // found non-zero byte in sequence
bool bByteAvail = true;
uint8_t currByte;
@@ -417,7 +424,7 @@ TrcPktProcPtm::async_result_t TrcPktProcPtm::findAsync()
{
if(m_async_0 == 5)
async_res = ASYNC;
- else
+ else if(m_async_0 > 5)
async_res = ASYNC_EXTRA_0;
}
bFound = true;