ngscopeclient 0.1-dev+51fbda87c
CDRTrigger.h
Go to the documentation of this file.
1/***********************************************************************************************************************
2* *
3* libscopehal *
4* *
5* Copyright (c) 2012-2024 Andrew D. Zonenberg and contributors *
6* All rights reserved. *
7* *
8* Redistribution and use in source and binary forms, with or without modification, are permitted provided that the *
9* following conditions are met: *
10* *
11* * Redistributions of source code must retain the above copyright notice, this list of conditions, and the *
12* following disclaimer. *
13* *
14* * Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the *
15* following disclaimer in the documentation and/or other materials provided with the distribution. *
16* *
17* * Neither the name of the author nor the names of any contributors may be used to endorse or promote products *
18* derived from this software without specific prior written permission. *
19* *
20* THIS SOFTWARE IS PROVIDED BY THE AUTHORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED *
21* TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL *
22* THE AUTHORS BE HELD LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES *
23* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR *
24* BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT *
25* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE *
26* POSSIBILITY OF SUCH DAMAGE. *
27* *
28***********************************************************************************************************************/
29
36#ifndef CDRTrigger_h
37#define CDRTrigger_h
38
43class CDRTrigger : public Trigger
44{
45public:
47 virtual ~CDRTrigger();
48
49 virtual bool ValidateChannel(size_t i, StreamDescriptor stream);
50
56 void SetBitRate(int64_t rate)
57 { m_parameters[m_bitRateName].SetIntVal(rate); }
58
60 int64_t GetBitRate()
61 { return m_parameters[m_bitRateName].GetIntVal(); }
62
65 { m_calculateBitRateSignal.emit(); }
66
68 sigc::signal<void()> signal_calculateBitRate()
69 { return m_calculateBitRateSignal; }
70
73
75 bool IsCDRLocked();
76
78 const std::string GetBitRateName()
79 { return m_bitRateName; }
80
87 {
90
93
96
99 };
100
103 {
106
109 };
110
113 {
116
119 };
120
123 { return static_cast<TriggerPosition>(m_parameters[m_positionName].GetIntVal()); }
124
131 { m_parameters[m_positionName].SetIntVal(p); }
132
139 { return static_cast<LeCroyEqualizerMode>(m_parameters[m_lecroyEqName].GetIntVal()); }
140
147 { m_parameters[m_lecroyEqName].SetIntVal(mode); }
148
151 { return static_cast<Polarity>(m_parameters[m_polarityName].GetIntVal()); }
152
159 { m_parameters[m_polarityName].SetIntVal(mode); }
160
161protected:
162
164 std::string m_bitRateName;
165
167 std::string m_positionName;
168
170 std::string m_lecroyEqName;
171
173 std::string m_polarityName;
174
176 sigc::signal<void()> m_calculateBitRateSignal;
177};
178
179#endif
180
Base class for triggers involving hardware clock/data recovery pattern matching.
Definition: CDRTrigger.h:44
TriggerPosition GetTriggerPosition()
Gets the position of the trigger, relative to the serial bit pattern.
Definition: CDRTrigger.h:122
const std::string GetBitRateName()
Gets the name of the bit rate parameter.
Definition: CDRTrigger.h:78
LeCroyEqualizerMode GetEqualizerMode()
Gets the RX equalizer mode.
Definition: CDRTrigger.h:138
std::string m_polarityName
Name of the polarity inversion parameter.
Definition: CDRTrigger.h:173
CDRTrigger(Oscilloscope *scope)
Creates a new CDR trigger.
Definition: CDRTrigger.cpp:50
void SetEqualizerMode(LeCroyEqualizerMode mode)
Sets the RX equalizer mode.
Definition: CDRTrigger.h:146
std::string m_lecroyEqName
Name of the equalizer mode parameter.
Definition: CDRTrigger.h:170
bool IsCDRLocked()
Queries hardware PLL lock status.
Definition: CDRTrigger.cpp:127
LeCroyEqualizerMode
RX equalizer settings for LeCroy SDA 8Zi GTX trigger board.
Definition: CDRTrigger.h:87
@ LECROY_EQ_LOW
2 dB boost
Definition: CDRTrigger.h:92
@ LECROY_EQ_MEDIUM
5 dB boost
Definition: CDRTrigger.h:95
@ LECROY_EQ_HIGH
9 dB boost
Definition: CDRTrigger.h:98
@ LECROY_EQ_NONE
No equalization.
Definition: CDRTrigger.h:89
std::string m_bitRateName
Name of the bit rate parameter.
Definition: CDRTrigger.h:164
void CalculateBitRate()
Automatically calculates the bit rate of the incoming signal, if possible.
Definition: CDRTrigger.h:64
bool IsAutomaticBitRateCalculationAvailable()
Checks if automatic bit rate calculation is available.
Definition: CDRTrigger.cpp:98
int64_t GetBitRate()
Returns the nominal CDR PLL data rate.
Definition: CDRTrigger.h:60
sigc::signal< void()> signal_calculateBitRate()
Signal emitted every time autobaud is requested.
Definition: CDRTrigger.h:68
void SetPolarity(Polarity mode)
Gets the polarity inversion.
Definition: CDRTrigger.h:158
void SetTriggerPosition(TriggerPosition p)
Sets the position of the trigger, relative to the serial bit pattern.
Definition: CDRTrigger.h:130
void SetBitRate(int64_t rate)
Sets the nominal baud rate the PLL should attempt to lock to.
Definition: CDRTrigger.h:56
std::string m_positionName
Name of the trigger position parameter.
Definition: CDRTrigger.h:167
TriggerPosition
Where to position the reported trigger point, relative to the serial bit pattern.
Definition: CDRTrigger.h:103
@ POSITION_END
Trigger is reported at the end of the pattern.
Definition: CDRTrigger.h:105
@ POSITION_START
Trigger is reported at the start of the pattern.
Definition: CDRTrigger.h:108
Polarity GetPolarity()
Gets the polarity inversion.
Definition: CDRTrigger.h:150
Polarity
Polarity inversion for the input.
Definition: CDRTrigger.h:113
@ POLARITY_INVERTED
Definition: CDRTrigger.h:118
@ POLARITY_NORMAL
Definition: CDRTrigger.h:115
sigc::signal< void()> m_calculateBitRateSignal
Signal requesting an auto-baud calculation.
Definition: CDRTrigger.h:176
Generic representation of an oscilloscope, logic analyzer, or spectrum analyzer.
Definition: Oscilloscope.h:50
Descriptor for a single stream coming off a channel.
Definition: StreamDescriptor.h:46
Abstract base class for oscilloscope / logic analyzer trigger inputs.
Definition: Trigger.h:46