ngscopeclient 0.1-dev+51fbda87c
PCIeTransportDecoder.h
Go to the documentation of this file.
1/***********************************************************************************************************************
2* *
3* libscopeprotocols *
4* *
5* Copyright (c) 2012-2022 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_ERROR
63 } m_type;
64
65 //TLP type fields
66 enum TlpType
67 {
68 TYPE_MEM_RD,
69 TYPE_MEM_RD_LK,
70 TYPE_MEM_WR,
71 TYPE_IO_RD,
72 TYPE_IO_WR,
73 TYPE_CFG_RD_0,
74 TYPE_CFG_WR_0,
75 TYPE_CFG_RD_1,
76 TYPE_CFG_WR_1,
77 TYPE_MSG,
78 TYPE_MSG_DATA,
79 TYPE_COMPLETION,
80 TYPE_COMPLETION_DATA,
81 TYPE_COMPLETION_LOCKED_ERROR,
82 TYPE_COMPLETION_LOCKED_DATA,
83
84 TYPE_INVALID
85 };
86
87 //TLP flags
88 enum TlpFlags
89 {
90 FLAG_DIGEST_PRESENT = 0x80,
91 FLAG_POISONED = 0x40,
92 FLAG_RELAXED_ORDERING = 0x20,
93 FLAG_NO_SNOOP = 0x10
94 };
95
96 uint64_t m_data;
97
99 {}
100
101 PCIeTransportSymbol(SymbolType type, uint64_t data = 0)
102 : m_type(type)
103 , m_data(data)
104 {}
105
106
107 bool operator==(const PCIeTransportSymbol& s) const
108 {
109 return (m_type == s.m_type) && (m_data == s.m_data);
110 }
111};
112
113class PCIeTransportWaveform : public SparseWaveform<PCIeTransportSymbol>
114{
115public:
117 virtual std::string GetText(size_t) override;
118 virtual std::string GetColor(size_t) override;
119};
120
125{
126public:
127 PCIeTransportDecoder(const std::string& color);
128 virtual ~PCIeTransportDecoder();
129
130 virtual void Refresh() override;
131
132 static std::string GetProtocolName();
133
134 virtual bool ValidateChannel(size_t i, StreamDescriptor stream) override;
135
136 virtual std::vector<std::string> GetHeaders() override;
137
138 PROTOCOL_DECODER_INITPROC(PCIeTransportDecoder)
139
140 static std::string FormatID(uint16_t id);
141};
142
143#endif
Decoder for PCIe transport layer.
Definition: PCIeTransportDecoder.h:125
virtual void Refresh() override
Evaluates a filter graph node.
Definition: PCIeTransportDecoder.cpp:80
Definition: PCIeTransportDecoder.h:42
Definition: PCIeTransportDecoder.h:114
virtual std::string GetText(size_t) override
Returns the text representation of a given protocol sample.
Definition: PCIeTransportDecoder.cpp:953
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:916
Definition: PacketDecoder.h:85
A waveform sampled at irregular intervals.
Definition: Waveform.h:460
Descriptor for a single stream coming off a channel.
Definition: StreamDescriptor.h:46