Commit | Line | Data |
---|---|---|
9a2167bd CB |
1 | /* |
2 | * Copyright (C) 2013 Freescale Semiconductor, Inc. | |
3 | * | |
4 | * Permission is hereby granted, free of charge, to any person obtaining a copy | |
5 | * of this software and associated documentation files (the "Software"), to deal | |
6 | * in the Software without restriction, including without limitation the rights | |
7 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | |
8 | * copies of the Software, and to permit persons to whom the Software is | |
9 | * furnished to do so, subject to the following conditions: | |
10 | * | |
11 | * The above copyright notice and this permission notice shall be included | |
12 | * in all copies or substantial portions of the Software. | |
13 | * | |
14 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | |
15 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | |
16 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE | |
17 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER | |
18 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, | |
19 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS | |
20 | * IN THE SOFTWARE. | |
21 | */ | |
22 | ||
23 | #ifndef FULLADDRESSVISITOR_h | |
24 | #define FULLADDRESSVISITOR_h | |
25 | ||
26 | #include <vector> | |
27 | #include <string> | |
28 | #include <map> | |
29 | #include "NxMessageVisitor.h" | |
30 | #include "SizedAddress.h" | |
31 | ||
32 | using std::vector; | |
33 | using std::string; | |
34 | using std::map; | |
35 | ||
36 | class NxDefaultMessage; | |
37 | class NxDebugStatusMessage; | |
38 | class NxDeviceIDMessage; | |
39 | class NxOwnershipTraceMessage; | |
40 | class NxDataAcquisitionMessage; | |
41 | class NxErrorMessage; | |
42 | class NxProgramTraceSync; | |
43 | class NxDataTraceWrite; | |
44 | class NxDataTraceRead; | |
45 | class NxDataTraceWriteSync; | |
46 | class NxDataTraceReadSync; | |
47 | class NxWatchpointMessage; | |
48 | class NxResourceFullMessage; | |
49 | class NxProgramTraceIndirectBranch; | |
50 | class NxProgramTraceIndirectBranchSync; | |
51 | class NxProgramTraceCorrelation; | |
52 | class NxDAMInCircuitTraceMessage; | |
53 | class NxCAMInCircuitTraceMessage; | |
54 | class NxCDMInCircuitTraceMessage; | |
55 | class NxDPQMInCircuitTraceMessage; | |
56 | class NxDPFMInCircuitTraceMessage; | |
57 | class NxCoreInCircuitTraceMessage; | |
58 | class NxInCircuitTraceMessage; | |
59 | class NxTimeStampCorrelation; | |
60 | ||
61 | ||
62 | // Keeps track of the Full Address as calculated from the | |
63 | // compressed addresses for the various components | |
64 | class FullAddressVisitor: public NxMessageVisitor | |
65 | { | |
66 | public: | |
67 | ||
68 | FullAddressVisitor() : data_mismatch_(false) | |
69 | { | |
70 | } | |
71 | virtual ~FullAddressVisitor() | |
72 | { | |
73 | } | |
74 | ||
75 | virtual void visit(NxDefaultMessage *m){useful_visit_ = false;} | |
76 | virtual void visit(NxDebugStatusMessage *m){useful_visit_ = false;} | |
77 | virtual void visit(NxDeviceIDMessage *m){useful_visit_ = false;} | |
78 | virtual void visit(NxOwnershipTraceMessage *m){useful_visit_ = false;} | |
79 | virtual void visit(NxDataAcquisitionMessage *m){useful_visit_ = false;} | |
80 | virtual void visit(NxErrorMessage *m){useful_visit_ = false;} | |
81 | virtual void visit(NxDataTraceWrite *m){useful_visit_ = false;} | |
82 | virtual void visit(NxDataTraceRead *m){useful_visit_ = false;} | |
83 | virtual void visit(NxDataTraceWriteSync *m){useful_visit_ = false;} | |
84 | virtual void visit(NxDataTraceReadSync *m){useful_visit_ = false;} | |
85 | virtual void visit(NxWatchpointMessage *m){useful_visit_ = false;} | |
86 | virtual void visit(NxResourceFullMessage *m){useful_visit_ = false;} | |
87 | virtual void visit(NxProgramTraceCorrelation *m){useful_visit_ = false;} | |
88 | virtual void visit(NxDPQMInCircuitTraceMessage *m){useful_visit_ = false;} | |
89 | virtual void visit(NxDPFMInCircuitTraceMessage *m){useful_visit_ = false;} | |
90 | virtual void visit(NxCoreInCircuitTraceMessage *m){useful_visit_ = false;} | |
91 | virtual void visit(NxInCircuitTraceMessage *m){useful_visit_ = false;} | |
92 | virtual void visit(NxTimeStampCorrelation *m){useful_visit_ = false;} | |
93 | ||
94 | // implement the specific visit | |
95 | virtual void visit(NxProgramTraceSync *m); | |
96 | ||
97 | // implement the specific visit | |
98 | virtual void visit(NxProgramTraceIndirectBranch *m); | |
99 | ||
100 | // implement the specific visit | |
101 | virtual void visit(NxProgramTraceIndirectBranchSync *m); | |
102 | ||
103 | // implement the specific visit | |
104 | virtual void visit(NxDAMInCircuitTraceMessage *m); | |
105 | ||
106 | // implement the specific visit | |
107 | virtual void visit(NxCDMInCircuitTraceMessage *m); | |
108 | ||
109 | // implement the specific visit | |
110 | virtual void visit(NxCAMInCircuitTraceMessage *m); | |
111 | ||
112 | // output message information as a string | |
113 | virtual string asString() const; | |
114 | ||
115 | private: | |
116 | ||
117 | string last_key_; | |
118 | ||
119 | // track addresses per source name | |
120 | map <string, SizedAddress> source_addr_; | |
121 | ||
122 | // address mismatch | |
123 | mutable bool data_mismatch_; | |
124 | SizedAddress mismatch_addr_; | |
125 | }; | |
126 | ||
127 | #endif // FULLADDRESSVISITOR_h |