ngscopeclient 0.1-dev+51fbda87c
CDR8B10BTrigger.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 CDR8B10BTrigger_h
37#define CDR8B10BTrigger_h
38
39#include "CDRTrigger.h"
40
46{
47public:
49 virtual ~CDR8B10BTrigger();
50
51 static std::string GetTriggerName();
52 TRIGGER_INITPROC(CDR8B10BTrigger);
53
56 {
59
62 };
63
66 {
69
72 };
73
80 { m_parameters[m_matchModeName].SetIntVal(mode); }
81
84 { return static_cast<MatchMode>(m_parameters[m_matchModeName].GetIntVal()); }
85
92 { m_parameters[m_patternModeName].SetIntVal(mode); }
93
96 { return static_cast<PatternMode>(m_parameters[m_patternModeName].GetIntVal()); }
97
103 void SetSymbolCount(size_t count)
104 { m_parameters[m_patternLengthName].SetIntVal(count); }
105
108 { return m_parameters[m_patternLengthName].GetIntVal(); }
109
111 std::vector<T8B10BSymbol> GetPattern()
112 { return m_parameters[m_patternName].Get8B10BPattern(); }
113
119 void SetPattern(const std::vector<T8B10BSymbol>& pattern)
120 { return m_parameters[m_patternName].Set8B10BPattern(pattern); }
121
122protected:
123 void OnLengthChanged();
124 void OnModeChanged();
125
127 std::string m_patternModeName;
128
130 std::string m_patternName;
131
134
136 std::string m_matchModeName;
137};
138
139#endif
Declaration of CDRTrigger.
A hardware 8B/10B pattern trigger.
Definition: CDR8B10BTrigger.h:46
std::string m_patternLengthName
Name of the "pattern length" parameter.
Definition: CDR8B10BTrigger.h:133
MatchMode
Trigger on matched or unmatched data.
Definition: CDR8B10BTrigger.h:66
@ MATCH_INCLUDE
Trigger on a match.
Definition: CDR8B10BTrigger.h:68
@ MATCH_EXCLUDE
Trigger if no match found.
Definition: CDR8B10BTrigger.h:71
MatchMode GetMatchMode()
Get the match mode.
Definition: CDR8B10BTrigger.h:83
std::string m_patternName
Name of the "pattern" parameter.
Definition: CDR8B10BTrigger.h:130
void SetSymbolCount(size_t count)
Sets the length of the serial pattern, or size of the set of symbols to match.
Definition: CDR8B10BTrigger.h:103
PatternMode GetPatternMode()
Gets the type of pattern being searched for.
Definition: CDR8B10BTrigger.h:95
std::string m_patternModeName
Name of the "pattern mode" parameter.
Definition: CDR8B10BTrigger.h:127
void SetPatternMode(PatternMode mode)
Sets the type of pattern to look for.
Definition: CDR8B10BTrigger.h:91
CDR8B10BTrigger(Oscilloscope *scope)
Create a new 8B/10B trigger.
Definition: CDR8B10BTrigger.cpp:51
void SetPattern(const std::vector< T8B10BSymbol > &pattern)
Sets the pattern or list of symbols to match.
Definition: CDR8B10BTrigger.h:119
void SetMatchMode(MatchMode mode)
Sets whether to trigger on pattern match or pattern not found.
Definition: CDR8B10BTrigger.h:79
PatternMode
Type of pattern to look for.
Definition: CDR8B10BTrigger.h:56
@ PATTERN_LIST
Match any of several symbols in a list.
Definition: CDR8B10BTrigger.h:61
@ PATTERN_SEQUENCE
Match a sequence of consecutive symbols.
Definition: CDR8B10BTrigger.h:58
void OnLengthChanged()
Handles a change to the pattern length by creating/destroying symbol fields.
Definition: CDR8B10BTrigger.cpp:101
std::vector< T8B10BSymbol > GetPattern()
Gets the pattern or list of symbols to match.
Definition: CDR8B10BTrigger.h:111
std::string m_matchModeName
Name of the "mode" parameter.
Definition: CDR8B10BTrigger.h:136
size_t GetSymbolCount()
Gets the length of the serial pattern or size of the symbol set.
Definition: CDR8B10BTrigger.h:107
void OnModeChanged()
Handles a change to the match mode by changing the max allowed pattern length.
Definition: CDR8B10BTrigger.cpp:113
Base class for triggers involving hardware clock/data recovery pattern matching.
Definition: CDRTrigger.h:44
Generic representation of an oscilloscope, logic analyzer, or spectrum analyzer.
Definition: Oscilloscope.h:50