Skip to content

Commit

Permalink
[WIP] USB HS hacks
Browse files Browse the repository at this point in the history
  • Loading branch information
miek committed Jun 3, 2020
1 parent 4b43648 commit 9a298d5
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 5 deletions.
15 changes: 12 additions & 3 deletions scopeprotocols/USB2PCSDecoder.cpp
Expand Up @@ -204,7 +204,7 @@ void USB2PCSDecoder::RefreshIterationIdle(
}

state = STATE_SYNC;
count = 1;
count = 0;
break;

case USB2PMASymbol::TYPE_SE0:
Expand Down Expand Up @@ -240,7 +240,7 @@ void USB2PCSDecoder::RefreshIterationSync(
auto sin = din->m_samples[nin];

//Odd numbered position
if( (count == 1) || (count == 3) || (count == 5) )
if (count & 1 && count < 30)
{
//Should be one UI long, and a J. Complain if not.
if( (sample_width_ui > 1.5) || (sample_width_ui < 0.5) ||
Expand All @@ -263,7 +263,7 @@ void USB2PCSDecoder::RefreshIterationSync(
}

//Even numbered position, but not the last
else if( (count == 2) || (count == 4) )
else if( count < 30 )
{
//Should be one UI long, and a K. Complain if not.
if( (sample_width_ui > 1.5) || (sample_width_ui < 0.5) ||
Expand Down Expand Up @@ -416,6 +416,15 @@ void USB2PCSDecoder::RefreshIterationData(
//Process the actual data
size_t num_bits = round(sample_width_ui);
size_t last_num_bits = round(last_sample_width_ui);
if(num_bits > 6) {
//Bitstuff error, treat as EOP
size_t duration = din->m_durations[nin];
cap->m_offsets.push_back(offset);
cap->m_durations.push_back(duration);
cap->m_samples.push_back(USB2PCSSymbol(USB2PCSSymbol::TYPE_EOP, 0));
return;

}
for(size_t i=0; i<num_bits; i++)
{
//First bit is either a bitstuff or 0 bit
Expand Down
4 changes: 2 additions & 2 deletions scopeprotocols/USB2PMADecoder.cpp
Expand Up @@ -130,8 +130,8 @@ void USB2PMADecoder::Refresh()
auto cap = new USB2PMAWaveform;
for(size_t i=0; i<len; i++)
{
bool bp = (din_p->m_samples[i] > 0.4);
bool bn = (din_n->m_samples[i] > 0.4);
bool bp = (din_p->m_samples[i] > 0.2);
bool bn = (din_n->m_samples[i] > 0.2);

USB2PMASymbol::SegmentType type = USB2PMASymbol::TYPE_SE1;
if(bp && bn)
Expand Down

0 comments on commit 9a298d5

Please sign in to comment.