ngscopeclient v0.1.1
PCIeTransportDecoder.h
Go to the documentation of this file.
1/***********************************************************************************************************************
2* *
3* libscopeprotocols *
4* *
5* Copyright (c) 2012-2025 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 PCIeTransportDecoder_h
37#define PCIeTransportDecoder_h
38
39#include "../scopehal/PacketDecoder.h"
40
42{
43public:
44
45 //Symbol type fields
46 enum SymbolType
47 {
48 TYPE_TLP_TYPE,
49 TYPE_TRAFFIC_CLASS,
50 TYPE_FLAGS,
51 TYPE_LENGTH,
52 TYPE_REQUESTER_ID,
53 TYPE_TAG,
54 TYPE_LAST_BYTE_ENABLE,
55 TYPE_FIRST_BYTE_ENABLE,
56 TYPE_ADDRESS_X32,
57 TYPE_ADDRESS_X64,
58 TYPE_DATA,
59 TYPE_COMPLETER_ID,
60 TYPE_COMPLETION_STATUS,
61 TYPE_BYTE_COUNT,
62 TYPE_MESSAGE_CODE,
63 TYPE_ERROR
64 } m_type;
65
66 //TLP type fields
67 enum TlpType
68 {
69 TYPE_MEM_RD,
70 TYPE_MEM_RD_LK,
71 TYPE_MEM_WR,
72 TYPE_IO_RD,
73 TYPE_IO_WR,
74 TYPE_CFG_RD_0,
75 TYPE_CFG_WR_0,
76 TYPE_CFG_RD_1,
77 TYPE_CFG_WR_1,
78 TYPE_MSG,
79 TYPE_MSG_DATA,
80 TYPE_COMPLETION,
81 TYPE_COMPLETION_DATA,
82 TYPE_COMPLETION_LOCKED_ERROR,
83 TYPE_COMPLETION_LOCKED_DATA,
84
85 TYPE_INVALID
86 };
87
88 //TLP flags
89 enum TlpFlags
90 {
91 FLAG_DIGEST_PRESENT = 0x80,
92 FLAG_POISONED = 0x40,
93 FLAG_RELAXED_ORDERING = 0x20,
94 FLAG_NO_SNOOP = 0x10
95 };
96
97 uint64_t m_data;
98
100 {}
101
102 PCIeTransportSymbol(SymbolType type, uint64_t data = 0)
103 : m_type(type)
104 , m_data(data)
105 {}
106
107
108 bool operator==(const PCIeTransportSymbol& s) const
109 {
110 return (m_type == s.m_type) && (m_data == s.m_data);
111 }
112};
113
114class PCIeTransportWaveform : public SparseWaveform<PCIeTransportSymbol>
115{
116public:
118 virtual std::string GetText(size_t) override;
119 virtual std::string GetColor(size_t) override;
120};
121
126{
127public:
128 PCIeTransportDecoder(const std::string& color);
129 virtual ~PCIeTransportDecoder();
130
131 virtual void Refresh() override;
132
133 static std::string GetProtocolName();
134
135 virtual bool ValidateChannel(size_t i, StreamDescriptor stream) override;
136
137 virtual std::vector<std::string> GetHeaders() override;
138
139 PROTOCOL_DECODER_INITPROC(PCIeTransportDecoder)
140
141 static std::string FormatID(uint16_t id);
142};
143
144#endif
Decoder for PCIe transport layer.
Definition: PCIeTransportDecoder.h:126
virtual void Refresh() override
Evaluates a filter graph node.
Definition: PCIeTransportDecoder.cpp:80
Definition: PCIeTransportDecoder.h:42
Definition: PCIeTransportDecoder.h:115
virtual std::string GetText(size_t) override
Returns the text representation of a given protocol sample.
Definition: PCIeTransportDecoder.cpp:1099
virtual std::string GetColor(size_t) override
Returns the displayed color (in HTML #rrggbb or #rrggbbaa notation) of a given protocol sample.
Definition: PCIeTransportDecoder.cpp:1061
Definition: PacketDecoder.h:85
A waveform sampled at irregular intervals.
Definition: Waveform.h:481
Descriptor for a single stream coming off a channel.
Definition: StreamDescriptor.h:46