Skip to content

Commit

Permalink
added code to detect the last disable event when there are no more tr…
Browse files Browse the repository at this point in the history
…ansitions on the clock channel.
  • Loading branch information
Marcus10110 committed Jan 28, 2021
1 parent 77cf042 commit 3be7270
Showing 1 changed file with 27 additions and 6 deletions.
33 changes: 27 additions & 6 deletions src/SpiAnalyzer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -177,12 +177,7 @@ bool SpiAnalyzer::WouldAdvancingTheClockToggleEnable( bool add_disable_frame, U6
if( mEnable == NULL )
return false;

U64 next_edge = mClock->GetSampleOfNextEdge();
bool enable_will_toggle = mEnable->WouldAdvancingToAbsPositionCauseTransition( next_edge );

if( enable_will_toggle )
{
U64 enable_edge = mEnable->GetSampleOfNextEdge();
auto log_disable_event = [&]( U64 enable_edge ) {
if( add_disable_frame )
{
FrameV2 frame_v2_end_of_transaction;
Expand All @@ -192,6 +187,32 @@ bool SpiAnalyzer::WouldAdvancingTheClockToggleEnable( bool add_disable_frame, U6
{
*disable_frame = enable_edge;
}
};

// if the enable is currently active, and there are no more clock transitions in the capture, attempt to capture the final disable event
if( !mClock->DoMoreTransitionsExistInCurrentData() && mEnable->GetBitState() == mSettings->mEnableActiveState )
{
if( mEnable->DoMoreTransitionsExistInCurrentData() )
{
U64 next_enable_edge = mEnable->GetSampleOfNextEdge();
// double check that the clock line actually processed all samples up to the next enable edge.
// double check is required becase data is getting processed while we're running, it's possible more has already become
// available.
if( !mClock->WouldAdvancingToAbsPositionCauseTransition( next_enable_edge ) )
{
log_disable_event( next_enable_edge );
return true;
}
}
}

U64 next_edge = mClock->GetSampleOfNextEdge();
bool enable_will_toggle = mEnable->WouldAdvancingToAbsPositionCauseTransition( next_edge );

if( enable_will_toggle )
{
U64 enable_edge = mEnable->GetSampleOfNextEdge();
log_disable_event( enable_edge );
}

if( enable_will_toggle == false )
Expand Down

0 comments on commit 3be7270

Please sign in to comment.