Skip to content
Permalink

Comparing changes

Choose two branches to see what’s changed or to start a new pull request. If you need to, you can also or learn more about diff comparisons.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also . Learn more about diff comparisons here.
base repository: ngscopeclient/scopehal
Failed to load repositories. Confirm that selected base ref is valid, then try again.
Loading
base: 31d32d927ad5
Choose a base ref
...
head repository: ngscopeclient/scopehal
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: fcb6df020427
Choose a head ref
  • 1 commit
  • 2 files changed
  • 1 contributor

Commits on Oct 26, 2020

  1. Proper handling of EOT

    azonenberg committed Oct 26, 2020
    Copy the full SHA
    fcb6df0 View commit details
Showing with 42 additions and 1 deletion.
  1. +41 −1 scopeprotocols/DPhyDataDecoder.cpp
  2. +1 −0 scopeprotocols/DPhyDataDecoder.h
42 changes: 41 additions & 1 deletion scopeprotocols/DPhyDataDecoder.cpp
Original file line number Diff line number Diff line change
@@ -149,7 +149,6 @@ void DPhyDataDecoder::Refresh()
size_t nlast = cap->m_samples.size()-1;
int64_t tend = data->m_offsets[idata] + data->m_durations[idata];
int64_t tclkstart = clk->m_offsets[iclk];
int64_t tclkend = tclkstart + clk->m_durations[iclk];

//Look for clock edges
bool clock_rising = false;
@@ -322,7 +321,42 @@ void DPhyDataDecoder::Refresh()

//End of packet
else if(cur_data.m_type == DPhySymbol::STATE_LP11)
{
//Trim garbage at end of packet
if(cap->m_offsets.size() >= 4)
{
//Discard last 3 bytes of data
for(size_t i=0; i<3; i++)
{
cap->m_offsets.pop_back();
cap->m_durations.pop_back();
cap->m_samples.pop_back();
}

//Discard all bytes with the same value
size_t endlen = cap->m_samples.size()-1;
uint8_t last = cap->m_samples[endlen].m_data;
while(cap->m_samples[endlen].m_data == last)
{
cap->m_offsets.pop_back();
cap->m_durations.pop_back();
cap->m_samples.pop_back();

endlen --;
if(endlen == 0)
break;
}

//Add a new "end" sample
endlen = cap->m_samples.size()-1;
tstart = cap->m_offsets[endlen] + cap->m_durations[endlen];
cap->m_offsets.push_back(tstart);
cap->m_durations.push_back(tclkstart - tstart);
cap->m_samples.push_back(DPhyDataSymbol(DPhyDataSymbol::TYPE_EOT));
}

state = STATE_IDLE;
}

//Something illegal
else
@@ -362,6 +396,9 @@ Gdk::Color DPhyDataDecoder::GetColor(int i)
case DPhyDataSymbol::TYPE_SOT:
return m_standardColors[COLOR_PREAMBLE];

case DPhyDataSymbol::TYPE_EOT:
return m_standardColors[COLOR_IDLE];

case DPhyDataSymbol::TYPE_HS_DATA:
return m_standardColors[COLOR_DATA];

@@ -388,6 +425,9 @@ string DPhyDataDecoder::GetText(int i)
case DPhyDataSymbol::TYPE_SOT:
return "SOT";

case DPhyDataSymbol::TYPE_EOT:
return "EOT";

case DPhyDataSymbol::TYPE_HS_DATA:
snprintf(tmp, sizeof(tmp), "%02x", s.m_data);
return tmp;
1 change: 1 addition & 0 deletions scopeprotocols/DPhyDataDecoder.h
Original file line number Diff line number Diff line change
@@ -45,6 +45,7 @@ class DPhyDataSymbol
TYPE_TURNAROUND_REQUEST,
TYPE_HS_DATA,
TYPE_LS_DATA,
TYPE_EOT,
TYPE_ERROR
};