ngscopeclient v0.2.2
Loading...
Searching...
No Matches
SDCmdDecoder.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
36#ifndef SDCmdDecoder_h
37#define SDCmdDecoder_h
38
39#include "PacketDecoder.h"
40
42{
43public:
44 enum stype
45 {
46 TYPE_HEADER,
47 TYPE_COMMAND,
48 TYPE_COMMAND_ARGS,
49 TYPE_RESPONSE_ARGS,
50 TYPE_CRC_OK,
51 TYPE_CRC_BAD,
52
53 TYPE_ERROR
54 };
55
57 {}
58
60 : m_stype(t)
61 , m_data(d)
62 , m_extdata1(e)
63 , m_extdata2(f)
64 , m_extdata3(g)
65 {}
66
67 stype m_stype;
68 uint32_t m_data;
69
70 //Extended data for a few special responses
71 uint32_t m_extdata1;
72 uint32_t m_extdata2;
73 uint32_t m_extdata3;
74
75 bool operator== (const SDCmdSymbol& s) const
76 {
77 return (m_stype == s.m_stype) && (m_data == s.m_data) &&
78 (m_extdata1 == s.m_extdata1) && (m_extdata2 == s.m_extdata2) && (m_extdata3 == s.m_extdata3);
79 }
80};
81
82class SDCmdWaveform : public SparseWaveform<SDCmdSymbol>
83{
84public:
86 virtual std::string GetText(size_t) override;
87 virtual std::string GetColor(size_t) override;
88
89 FilterParameter& m_cardTypeParam;
90};
91
92
97{
98public:
99 SDCmdDecoder(const std::string& color);
100
101 virtual void Refresh(vk::raii::CommandBuffer& cmdBuf, std::shared_ptr<QueueHandle> queue) override;
102
103 static std::string GetProtocolName();
104
105 virtual bool GetShowDataColumn() override;
106
107 std::vector<std::string> GetHeaders() override;
108
109 virtual bool CanMerge(Packet* first, Packet* cur, Packet* next) override;
110 virtual Packet* CreateMergedHeader(Packet* pack, size_t i) override;
111
112 enum CardType
113 {
114 SD_GENERIC,
115 SD_EMMC
116 };
117
118 PROTOCOL_DECODER_INITPROC(SDCmdDecoder)
119
120protected:
121 FilterParameter& m_cardtype;
122};
123
124#endif
Definition AcceleratorBuffer.h:204
A parameter to a filter.
Definition FilterParameter.h:86
Definition PacketDecoder.h:85
Definition PacketDecoder.h:40
Decodes the SD card command bus protocol.
Definition SDCmdDecoder.h:97
virtual Packet * CreateMergedHeader(Packet *pack, size_t i) override
Creates a summary packet for one or more merged packets.
Definition SDCmdDecoder.cpp:1354
virtual bool CanMerge(Packet *first, Packet *cur, Packet *next) override
Checks if multiple packets can be merged under a single heading in the protocol analyzer view.
Definition SDCmdDecoder.cpp:1305
Definition SDCmdDecoder.h:42
Definition SDCmdDecoder.h:83
virtual std::string GetColor(size_t) override
Returns the displayed color (in HTML #rrggbb or #rrggbbaa notation) of a given protocol sample.
Definition SDCmdDecoder.cpp:388
virtual std::string GetText(size_t) override
Returns the text representation of a given protocol sample.
Definition SDCmdDecoder.cpp:415
A waveform sampled at irregular intervals.
Definition Waveform.h:514