ngscopeclient 0.1-dev+51fbda87c
DSIPacketDecoder.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
35#ifndef DSIPacketDecoder_h
36#define DSIPacketDecoder_h
37
38#include "PacketDecoder.h"
39
41{
42public:
43
44 enum stype
45 {
46 TYPE_VC,
47 TYPE_IDENTIFIER,
48 TYPE_LEN,
49 TYPE_DATA,
50 TYPE_ECC_OK,
51 TYPE_ECC_BAD,
52 TYPE_CHECKSUM_OK,
53 TYPE_CHECKSUM_BAD,
54 TYPE_ERROR
55 } m_stype;
56
57 uint16_t m_data;
58
59 DSISymbol(stype t = TYPE_ERROR, uint16_t data = 0)
60 : m_stype(t)
61 , m_data(data)
62 {}
63
64 bool operator== (const DSISymbol& s) const
65 {
66 return (m_stype == s.m_stype) && (m_data == s.m_data);
67 }
68};
69
70class DSIWaveform : public SparseWaveform<DSISymbol>
71{
72public:
74 virtual std::string GetText(size_t) override;
75 virtual std::string GetColor(size_t) override;
76};
77
82{
83public:
84 DSIPacketDecoder(const std::string& color);
85
86 virtual void Refresh() override;
87
88 static std::string GetProtocolName();
89
90 virtual bool ValidateChannel(size_t i, StreamDescriptor stream) override;
91
92 std::vector<std::string> GetHeaders() override;
93
94 virtual Packet* CreateMergedHeader(Packet* pack, size_t i) override;
95 virtual bool CanMerge(Packet* first, Packet* cur, Packet* next) override;
96
97 //From table 16
98 enum
99 {
100 //Short
101 TYPE_VSYNC_START = 0x01,
102 TYPE_VSYNC_END = 0x11,
103 TYPE_HSYNC_START = 0x21,
104 TYPE_HSYNC_END = 0x31,
105 TYPE_EOTP = 0x08,
106 TYPE_CM_OFF = 0x02,
107 TYPE_CM_ON = 0x12,
108 TYPE_SHUT_DOWN = 0x22,
109 TYPE_TURN_ON = 0x32,
110 TYPE_GENERIC_SHORT_WRITE_0PARAM = 0x03,
111 TYPE_GENERIC_SHORT_WRITE_1PARAM = 0x13,
112 TYPE_GENERIC_SHORT_WRITE_2PARAM = 0x23,
113 TYPE_GENERIC_READ_0PARAM = 0x04,
114 TYPE_GENERIC_READ_1PARAM = 0x14,
115 TYPE_GENERIC_READ_2PARAM = 0x24,
116 TYPE_DCS_SHORT_WRITE_0PARAM = 0x05,
117 TYPE_DCS_SHORT_WRITE_1PARAM = 0x15,
118 TYPE_DCS_READ = 0x06,
119 TYPE_SET_MAX_RETURN_SIZE = 0x37,
120
121 //Long
122 TYPE_NULL = 0x09,
123 TYPE_BLANKING = 0x19,
124 TYPE_GENERIC_LONG_WRITE = 0x29,
125 TYPE_DCS_LONG_WRITE = 0x39,
126 TYPE_PACKED_PIXEL_RGB565 = 0x0e,
127 TYPE_PACKED_PIXEL_RGB666 = 0x1e,
128 TYPE_LOOSE_PIXEL_RGB666 = 0x2e,
129 TYPE_PACKED_PIXEL_RGB888 = 0x3e
130 };
131
132protected:
133 uint16_t UpdateCRC(uint16_t crc, uint8_t data);
134
135public:
136 PROTOCOL_DECODER_INITPROC(DSIPacketDecoder)
137};
138
139#endif
Decodes MIPI DSI from a D-PHY data stream.
Definition: DSIPacketDecoder.h:82
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: DSIPacketDecoder.cpp:639
virtual void Refresh() override
Evaluates a filter graph node.
Definition: DSIPacketDecoder.cpp:70
virtual Packet * CreateMergedHeader(Packet *pack, size_t i) override
Creates a summary packet for one or more merged packets.
Definition: DSIPacketDecoder.cpp:686
Definition: DSIPacketDecoder.h:41
Definition: DSIPacketDecoder.h:71
virtual std::string GetText(size_t) override
Returns the text representation of a given protocol sample.
Definition: DSIPacketDecoder.cpp:537
virtual std::string GetColor(size_t) override
Returns the displayed color (in HTML #rrggbb or #rrggbbaa notation) of a given protocol sample.
Definition: DSIPacketDecoder.cpp:510
Definition: PacketDecoder.h:85
Definition: PacketDecoder.h:40
A waveform sampled at irregular intervals.
Definition: Waveform.h:460
Descriptor for a single stream coming off a channel.
Definition: StreamDescriptor.h:46