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: 288f33f53bfe
Choose a base ref
...
head repository: ngscopeclient/scopehal
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: 79f9cd47e0a0
Choose a head ref
  • 1 commit
  • 1 file changed
  • 1 contributor

Commits on May 16, 2021

  1. Copy the full SHA
    79f9cd4 View commit details
Showing with 24 additions and 6 deletions.
  1. +24 −6 scopeprotocols/ClockRecoveryFilter.cpp
30 changes: 24 additions & 6 deletions scopeprotocols/ClockRecoveryFilter.cpp
Original file line number Diff line number Diff line change
@@ -65,7 +65,9 @@ bool ClockRecoveryFilter::ValidateChannel(size_t i, StreamDescriptor stream)
case 0:
if(stream.m_channel == NULL)
return false;
return (stream.m_channel->GetType() == OscilloscopeChannel::CHANNEL_TYPE_ANALOG);
return
(stream.m_channel->GetType() == OscilloscopeChannel::CHANNEL_TYPE_ANALOG) ||
(stream.m_channel->GetType() == OscilloscopeChannel::CHANNEL_TYPE_DIGITAL);

case 1:
if(stream.m_channel == NULL) //null is legal for gate
@@ -124,12 +126,16 @@ void ClockRecoveryFilter::Refresh()
return;
}

auto din = GetAnalogInputWaveform(0);
auto adin = GetAnalogInputWaveform(0);
auto ddin = GetDigitalInputWaveform(0);
auto gate = GetDigitalInputWaveform(1);

//Timestamps of the edges
vector<int64_t> edges;
FindZeroCrossings(din, m_parameters[m_threshname].GetFloatVal(), edges);
if(adin)
FindZeroCrossings(adin, m_parameters[m_threshname].GetFloatVal(), edges);
else
FindZeroCrossings(ddin, edges);
if(edges.empty())
{
SetData(NULL, 0);
@@ -141,14 +147,26 @@ void ClockRecoveryFilter::Refresh()

//Create the output waveform and copy our timescales
auto cap = new DigitalWaveform;
cap->m_startTimestamp = din->m_startTimestamp;
cap->m_startFemtoseconds = din->m_startFemtoseconds;
if(adin)
{
cap->m_startTimestamp = adin->m_startTimestamp;
cap->m_startFemtoseconds = adin->m_startFemtoseconds;
}
else
{
cap->m_startTimestamp = ddin->m_startTimestamp;
cap->m_startFemtoseconds = ddin->m_startFemtoseconds;
}
cap->m_triggerPhase = 0;
cap->m_timescale = 1; //recovered clock time scale is single femtoseconds

//The actual PLL NCO
//TODO: use the real fibre channel PLL.
int64_t tend = din->m_offsets[din->m_offsets.size() - 1] * din->m_timescale;
int64_t tend;
if(adin)
tend = adin->m_offsets[adin->m_offsets.size() - 1] * adin->m_timescale;
else
tend = ddin->m_offsets[ddin->m_offsets.size() - 1] * ddin->m_timescale;
size_t nedge = 1;
//LogDebug("n, delta, period, freq_ghz\n");
int64_t edgepos = edges[0];