ngscopeclient v0.2.1
Loading...
Searching...
No Matches
IBM8b10bWaveform.h
Go to the documentation of this file.
1/***********************************************************************************************************************
2* *
3* libscopeprotocols *
4* *
5* Copyright (c) 2012-2026 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
35#ifndef IBM8b10bWaveform_h
36#define IBM8b10bWaveform_h
37
45{
46public:
48 {}
49
50 enum flags
51 {
52 FLAG_ERROR_3 = 0x1, //Invalid 3b4b sub-code
53 FLAG_ERROR_5 = 0x2, //Invalid 5b6b sub-code
54 FLAG_ERROR_DISP = 0x4, //Invalid disparity
55 FLAG_ERROR_MASK = 0x7, //Any error
56
57 FLAG_CONTROL = 0x40, //K character
58 FLAG_DISP_POS = 0x80 //Disparity positive
59 };
60
61 IBM8b10bSymbol(bool b, bool e5, bool e3, bool ed, uint8_t d, int8_t disp)
62 : m_data(d)
63 , m_flags(0)
64 {
65 if(b)
66 m_flags |= FLAG_CONTROL;
67 if(e5)
68 m_flags |= FLAG_ERROR_5;
69 if(e3)
70 m_flags |= FLAG_ERROR_3;
71 if(ed)
72 m_flags |= FLAG_ERROR_DISP;
73 if(disp > 0)
74 m_flags |= FLAG_DISP_POS;
75 }
76
77 uint8_t m_data;
78 uint8_t m_flags;
79
80 bool operator== (const IBM8b10bSymbol& s) const
81 { return (m_flags == s.m_flags) && (m_data == s.m_data); }
82};
83
84class IBM8b10bWaveform : public SparseWaveform<IBM8b10bSymbol>
85{
86public:
89 m_displayFormat(FORMAT_DOTTED)
90 {};
91 virtual std::string GetText(size_t) override;
92 virtual std::string GetColor(size_t) override;
93 static FilterParameter MakeIBM8b10bDisplayFormatParameter();
94
95 enum DisplayFormat
96 {
97 FORMAT_DOTTED,
98 FORMAT_HEX
99 };
100
101 void SetDisplayFormat(DisplayFormat format)
102 { m_displayFormat = format; }
103
104protected:
105 DisplayFormat m_displayFormat;
106};
107
108#endif
Definition AcceleratorBuffer.h:204
A parameter to a filter.
Definition FilterParameter.h:86
A single 8b/10b symbol.
Definition IBM8b10bWaveform.h:45
Definition IBM8b10bWaveform.h:85
virtual std::string GetText(size_t) override
Returns the text representation of a given protocol sample.
Definition IBM8b10bWaveform.cpp:52
virtual std::string GetColor(size_t) override
Returns the displayed color (in HTML #rrggbb or #rrggbbaa notation) of a given protocol sample.
Definition IBM8b10bWaveform.cpp:40
A waveform sampled at irregular intervals.
Definition Waveform.h:514