2 * Copyright (C) 2013 Freescale Semiconductor, Inc.
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:
11 * The above copyright notice and this permission notice shall be included
12 * in all copies or substantial portions of the Software.
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
23 #include "NxPacketDecoder.h"
28 void NxPacketDecoder::decodeICT_(uint32_t tcode
, uint32_t source_id
,
31 // allocate the correct NxInCircuitTraceMessage
32 // based on the source_id.
33 if ((source_id
& 0x1) == 0) {
34 // all cores have source ids where LSB = 0
35 msg
= new NxCoreInCircuitTraceMessage(tcode
);
39 // "Data Path Queueing Message";
40 msg
= new NxDPQMInCircuitTraceMessage(tcode
);
43 // "Data Path Frame Message";
44 msg
= new NxDPFMInCircuitTraceMessage(tcode
);
47 // "Data Path Cycle Trace Message";
48 msg
= new NxInCircuitTraceMessage(tcode
);
51 // "DDR Terse/Verbose Message";
52 msg
= new NxDAMInCircuitTraceMessage(tcode
);
55 // "Ocean Terse Address/Verbose Address/Header/Data";
56 msg
= new NxInCircuitTraceMessage(tcode
);
59 // "CCSR IPM Address/IPM Data DCSR IPM Address/IPM Data";
60 msg
= new NxInCircuitTraceMessage(tcode
);
63 // "EPU Counter Trace Message";
64 msg
= new NxInCircuitTraceMessage(tcode
);
68 msg
= new NxInCircuitTraceMessage(tcode
);
74 // decode the packet set into a NxMessage
75 bool NxPacketDecoder::decode(NxPacketSet
&pkt_set
, NxMessage
* &msg
)
79 // get the tcode from the packet since its needed
80 // to create the correct NxMessage
81 uint32_t tcode
= pkt_set
.tcode();
83 // allocate the correct NxMessage from the tcode.
88 m
= new NxDebugStatusMessage();
92 m
= new NxDeviceIDMessage();
96 m
= new NxOwnershipTraceMessage();
100 m
= new NxDataTraceWrite();
104 m
= new NxDataTraceRead();
108 m
= new NxDataAcquisitionMessage();
112 m
= new NxErrorMessage();
116 m
= new NxProgramTraceSync();
120 m
= new NxDataTraceWriteSync();
124 m
= new NxDataTraceReadSync();
128 m
= new NxWatchpointMessage();
132 m
= new NxResourceFullMessage();
136 m
= new NxProgramTraceIndirectBranch();
140 m
= new NxProgramTraceIndirectBranchSync();
144 m
= new NxProgramTraceCorrelation();
148 uint32_t src
= pkt_set
.src();
149 decodeICT_(tcode
, src
, m
);
153 uint32_t src
= pkt_set
.src();
154 decodeICT_(tcode
, src
, m
);
158 m
= new NxTimeStampCorrelation();
161 m
= new NxDefaultMessage(tcode
);
165 // decode the rest of the data
166 ret
= m
->decode(pkt_set
);
169 // Assign and return the message
170 // The caller will take ownership of the memory
174 cout
<< "Failed to decode NxPacketSet data into NxMessage with TCODE: "
This page took 0.032617 seconds and 4 git commands to generate.