Add Freescale Nexus decoder implementation
[babeltrace.git] / converter / nexus / NxMessage.h
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 NXMESSAGE_H
24 #define NXMESSAGE_H
25
26 #include "NxPacketSet.h"
27 #include "NxMessageVisitor.h"
28 #include "SizedAddress.h"
29 #include <inttypes.h>
30 #include <string>
31
32 using std::string;
33
34 /*!
35 Base class for all types of Nexus Message structures. Type is based on a TCODE value.
36 */
37 class NxMessage
38 {
39 public:
40 /*!
41 @abstract Constructor
42 @param tcode Set the TCODE value. Default 0x3f which is an unused (unlikely) code value.
43 */
44 NxMessage(uint32_t tcode) :
45 tcode_(tcode), source_id_(0), timestamp_(0)
46 {
47 }
48 virtual ~NxMessage()
49 {
50 }
51
52 // NxMessage implements the standard visitor pattern.
53 virtual void accept(NxMessageVisitor &v) = 0;
54
55 /*!
56 @abstract Returns the TCODE value
57 @return the tcode for this message
58 */
59 uint32_t tcode() const
60 {
61 return tcode_;
62 }
63
64 /*!
65 @abstract Returns the TCODE string
66 @return the tcode as a string
67 */
68 virtual string tcodeString() const;
69
70 /*!
71 @abstract Returns the SRC_ID value
72 @return the source_id for this message
73 */
74 uint32_t sourceId() const
75 {
76 return source_id_;
77 }
78
79 /*!
80 @abstract Annotates the SRC_ID as string
81 @return the SRC_ID as a string
82 */
83 const char * sourceIdString() const;
84
85 /*!
86 @abstract Returns the TIMESTAMP value
87 @return the timestamp for this message
88 */
89 uint32_t timestamp() const
90 {
91 return timestamp_;
92 }
93
94 /*!
95 @abstract Determines if the TIMESTAMP value needs correction
96 @return True if the timestamp needs correction
97 */
98 bool timestampNeedsCorrection() const;
99
100 /*!
101 @abstract Returns the corrected TIMESTAMP value
102 @return the corrected timestamp for this message
103 */
104 uint32_t correctedTimestamp() const;
105
106 /*!
107 @abstract Output timestamp information as a string
108 @return a string representing the timestamp
109 */
110 string timestampAsString() const;
111
112 /*!
113 @abstract Decode Nexus message info from the packet set
114 @param pkt_set Reference to a NxPackageSet containing the data to be decoded
115 @return True if no error
116 */
117 virtual bool decode(NxPacketSet &pkt_set) = 0;
118
119 /*!
120 @abstract Output message information as a string
121 @return a string representing the Nexus message content
122 */
123 virtual string asString() const;
124
125 protected:
126
127 /*!
128 @abstract Decode the SRC ID from the packet set
129 @param pkt_set Reference to a NxPackageSet containing the data to be decoded
130 @return the SRC ID value
131 */
132 uint32_t decodeSourceId(NxPacketSet &pkt_set);
133
134 /*!
135 @abstract Decode the TIMESTAMP value from the packet set at index
136 @param pkt_set Reference to a NxPackageSet containing the data to be decoded
137 @param index The index of the NxPacket in the NxPacketSet collection
138 @return the TIMESTAMP value
139 */
140 uint32_t decodeTimestamp(NxPacketSet &pkt_set, uint32_t index);
141
142 /*! @var tcode_ contains the TCODE value which determines the type of NxMessage */
143 uint32_t tcode_;
144
145 /*! @var source_id_ contains the SRC ID value */
146 uint32_t source_id_;
147
148 /*! @var timestamp_ contains the optional TIMESTAMP value */
149 uint32_t timestamp_;
150 };
151
152 // This type is the default for all unknown message types
153 class NxDefaultMessage: public NxMessage
154 {
155 public:
156 NxDefaultMessage(uint32_t tcode) :
157 NxMessage(tcode)
158 {
159 }
160 ~NxDefaultMessage()
161 {
162 }
163
164 // NxMessage implements the standard visitor pattern.
165 virtual void accept(NxMessageVisitor &v)
166 {
167 v.visit(this);
168 }
169
170 // decode message info from the packet set
171 virtual bool decode(NxPacketSet &pkt_set)
172 {
173 return true;
174 }
175 };
176
177 class NxDebugStatusMessage: public NxMessage
178 {
179 public:
180 NxDebugStatusMessage() :
181 NxMessage(0), status_(0)
182 {
183 }
184 ~NxDebugStatusMessage()
185 {
186 }
187
188 // NxMessage implements the standard visitor pattern.
189 virtual void accept(NxMessageVisitor &v)
190 {
191 v.visit(this);
192 }
193
194 /*!
195 @abstract Returns the TCODE string
196 @return the tcode as a string
197 */
198 virtual string tcodeString() const
199 {
200 return "Debug Status Message";
201 }
202
203 // decode message info from the packet set
204 virtual bool decode(NxPacketSet &pkt_set);
205
206 // output message information as a string
207 virtual string asString() const;
208
209 private:
210
211 // STATUS
212 uint32_t status_;
213 };
214
215 class NxDeviceIDMessage: public NxMessage
216 {
217 public:
218 NxDeviceIDMessage() :
219 NxMessage(1)
220 {
221 }
222 ~NxDeviceIDMessage()
223 {
224 }
225
226 // NxMessage implements the standard visitor pattern.
227 virtual void accept(NxMessageVisitor &v)
228 {
229 v.visit(this);
230 }
231
232 /*!
233 @abstract Returns the TCODE string
234 @return the tcode as a string
235 */
236 virtual string tcodeString() const
237 {
238 return "Device ID Message";
239 }
240
241 // decode message info from the packet set
242 virtual bool decode(NxPacketSet &pkt_set);
243
244 // output message information as a string
245 virtual string asString() const;
246
247 private:
248
249 };
250
251 class NxOwnershipTraceMessage: public NxMessage
252 {
253 public:
254 NxOwnershipTraceMessage() :
255 NxMessage(2), pid_index_(0), pid_value_(0)
256 {
257 }
258 ~NxOwnershipTraceMessage()
259 {
260 }
261
262 // NxMessage implements the standard visitor pattern.
263 virtual void accept(NxMessageVisitor &v)
264 {
265 v.visit(this);
266 }
267
268 /*!
269 @abstract Returns the TCODE string
270 @return the tcode as a string
271 */
272 virtual string tcodeString() const
273 {
274 return "Ownership Trace Message";
275 }
276
277 // decode message info from the packet set
278 virtual bool decode(NxPacketSet &pkt_set);
279
280 // output message information as a string
281 virtual string asString() const;
282
283 // decode the data as a string
284 const char * pidIndexString() const;
285
286 // decode the data as a string
287 const char * pidValueString() const;
288
289 private:
290
291 // PROCESS subfields
292 uint32_t pid_index_;
293 uint64_t pid_value_;
294
295 };
296
297 class NxDataAcquisitionMessage: public NxMessage
298 {
299 public:
300 NxDataAcquisitionMessage() :
301 NxMessage(7), idtag_(0), dqdata_(0)
302 {
303 }
304 ~NxDataAcquisitionMessage()
305 {
306 }
307
308 // NxMessage implements the standard visitor pattern.
309 virtual void accept(NxMessageVisitor &v)
310 {
311 v.visit(this);
312 }
313
314 /*!
315 @abstract Returns the TCODE string
316 @return the tcode as a string
317 */
318 virtual string tcodeString() const
319 {
320 return "Data Acquisition Message";
321 }
322
323 // decode message info from the packet set
324 virtual bool decode(NxPacketSet &pkt_set);
325
326 // output message information as a string
327 virtual string asString() const;
328
329 // decode the data as a string
330 const char * idtagString() const;
331
332 // decode the data as a string
333 string dqdataString() const;
334
335 private:
336
337 // IDTAG
338 uint32_t idtag_;
339
340 // DQDATA
341 uint32_t dqdata_;
342 };
343
344 class NxErrorMessage: public NxMessage
345 {
346 public:
347 NxErrorMessage() :
348 NxMessage(8), etype_(0), ecode_(0)
349 {
350 }
351 ~NxErrorMessage()
352 {
353 }
354
355 // NxMessage implements the standard visitor pattern.
356 virtual void accept(NxMessageVisitor &v)
357 {
358 v.visit(this);
359 }
360
361 /*!
362 @abstract Returns the TCODE string
363 @return the tcode as a string
364 */
365 virtual string tcodeString() const
366 {
367 return "Error Message";
368 }
369
370 // decode message info from the packet set
371 virtual bool decode(NxPacketSet &pkt_set);
372
373 // output message information as a string
374 virtual string asString() const;
375
376 // decode the data as a string
377 const char * etypeString() const;
378
379 // decode the data as a string
380 string ecodeString() const;
381
382 private:
383
384 // IDTAG
385 uint32_t etype_;
386
387 // DQDATA
388 uint32_t ecode_;
389 };
390
391 // NxProgramTraceSync
392 class NxProgramTraceSync: public NxMessage
393 {
394 public:
395 NxProgramTraceSync() :
396 NxMessage(9), map_(0), icnt_(0), hist_(0)
397 {
398 }
399 ~NxProgramTraceSync()
400 {
401 }
402
403 // NxMessage implements the standard visitor pattern.
404 virtual void accept(NxMessageVisitor &v)
405 {
406 v.visit(this);
407 }
408
409 /*!
410 @abstract Returns the TCODE string
411 @return the tcode as a string
412 */
413 virtual string tcodeString() const
414 {
415 return "Program Trace Synchronization";
416 }
417
418 // decode message info from the packet set
419 virtual bool decode(NxPacketSet &pkt_set);
420
421 // output message information as a string
422 virtual string asString() const;
423
424 // get the address value
425 const SizedAddress& address() const
426 {
427 return pc_;
428 }
429
430 private:
431
432 // MAP
433 uint32_t map_;
434
435 // I-CNT
436 uint32_t icnt_;
437
438 // PC
439 SizedAddress pc_;
440
441 // HIST
442 uint32_t hist_;
443 };
444
445 // NxDataTrace Base class
446 class NxDataTraceBase: public NxMessage
447 {
448 public:
449 NxDataTraceBase(uint32_t tcode) :
450 NxMessage(tcode),
451 dsz_(0),
452 addr_(0),
453 data_(0)
454 {
455 }
456 virtual ~NxDataTraceBase()
457 {
458 }
459
460 protected:
461
462 // decode the data as a string
463 const char * dszString() const;
464
465 // DSZ
466 uint32_t dsz_;
467
468 // ADDR
469 uint64_t addr_;
470
471 // Data
472 uint64_t data_;
473
474 };
475
476 // NxDataTraceWrite
477 class NxDataTraceWrite: public NxDataTraceBase
478 {
479 public:
480 NxDataTraceWrite() :
481 NxDataTraceBase(5)
482 {
483 }
484 ~NxDataTraceWrite()
485 {
486 }
487
488 // NxMessage implements the standard visitor pattern.
489 virtual void accept(NxMessageVisitor &v)
490 {
491 v.visit(this);
492 }
493
494 /*!
495 @abstract Returns the TCODE string
496 @return the tcode as a string
497 */
498 virtual string tcodeString() const
499 {
500 return "Data Trace - Data Write";
501 }
502
503 // decode message info from the packet set
504 virtual bool decode(NxPacketSet &pkt_set);
505
506 // output message information as a string
507 virtual string asString() const;
508
509 private:
510
511 };
512
513 // NxDataTraceRead
514 class NxDataTraceRead: public NxDataTraceBase
515 {
516 public:
517 NxDataTraceRead() :
518 NxDataTraceBase(6)
519 {
520 }
521 ~NxDataTraceRead()
522 {
523 }
524
525 // NxMessage implements the standard visitor pattern.
526 virtual void accept(NxMessageVisitor &v)
527 {
528 v.visit(this);
529 }
530
531 /*!
532 @abstract Returns the TCODE string
533 @return the tcode as a string
534 */
535 virtual string tcodeString() const
536 {
537 return "Data Trace - Data Read";
538 }
539
540 // decode message info from the packet set
541 virtual bool decode(NxPacketSet &pkt_set);
542
543 // output message information as a string
544 virtual string asString() const;
545
546 private:
547
548 };
549
550 // NxDataTraceWriteSync
551 class NxDataTraceWriteSync: public NxDataTraceBase
552 {
553 public:
554 NxDataTraceWriteSync() :
555 NxDataTraceBase(13)
556 {
557 }
558 ~NxDataTraceWriteSync()
559 {
560 }
561
562 // NxMessage implements the standard visitor pattern.
563 virtual void accept(NxMessageVisitor &v)
564 {
565 v.visit(this);
566 }
567
568 /*!
569 @abstract Returns the TCODE string
570 @return the tcode as a string
571 */
572 virtual string tcodeString() const
573 {
574 return "Data Trace - Data Write w/sync";
575 }
576
577 // decode message info from the packet set
578 virtual bool decode(NxPacketSet &pkt_set);
579
580 // output message information as a string
581 virtual string asString() const;
582
583 private:
584
585 };
586
587 // NxDataTraceReadSync
588 class NxDataTraceReadSync: public NxDataTraceBase
589 {
590 public:
591 NxDataTraceReadSync() :
592 NxDataTraceBase(14)
593 {
594 }
595 ~NxDataTraceReadSync()
596 {
597 }
598
599 // NxMessage implements the standard visitor pattern.
600 virtual void accept(NxMessageVisitor &v)
601 {
602 v.visit(this);
603 }
604
605 /*!
606 @abstract Returns the TCODE string
607 @return the tcode as a string
608 */
609 virtual string tcodeString() const
610 {
611 return "Data Trace - Data Read w/sync";
612 }
613
614 // decode message info from the packet set
615 virtual bool decode(NxPacketSet &pkt_set);
616
617 // output message information as a string
618 virtual string asString() const;
619
620 private:
621
622 };
623
624 // NxWatchpointMessage
625 class NxWatchpointMessage: public NxMessage
626 {
627 public:
628 NxWatchpointMessage() :
629 NxMessage(15), wphit_(0), wphit_size_(16)
630 {
631 }
632 ~NxWatchpointMessage()
633 {
634 }
635
636 // NxMessage implements the standard visitor pattern.
637 virtual void accept(NxMessageVisitor &v)
638 {
639 v.visit(this);
640 }
641
642 /*!
643 @abstract Returns the TCODE string
644 @return the tcode as a string
645 */
646 virtual string tcodeString() const
647 {
648 return "Watchpoint Message";
649 }
650
651 // decode message info from the packet set
652 virtual bool decode(NxPacketSet &pkt_set);
653
654 // output message information as a string
655 virtual string asString() const;
656
657 // decode the data as a string
658 string wphitString() const;
659
660 private:
661
662 // Watchpoint Hit
663 uint32_t wphit_;
664
665 // Watchpoint Hit bit size
666 uint32_t wphit_size_;
667 };
668
669 class NxResourceFullMessage: public NxMessage
670 {
671 public:
672 NxResourceFullMessage() :
673 NxMessage(27), rcode_(0), rdata_(0)
674 {
675 }
676 ~NxResourceFullMessage()
677 {
678 }
679
680 // NxMessage implements the standard visitor pattern.
681 virtual void accept(NxMessageVisitor &v)
682 {
683 v.visit(this);
684 }
685
686 /*!
687 @abstract Returns the TCODE string
688 @return the tcode as a string
689 */
690 virtual string tcodeString() const
691 {
692 return "Resource Full Message";
693 }
694
695 // decode message info from the packet set
696 virtual bool decode(NxPacketSet &pkt_set);
697
698 // output message information as a string
699 virtual string asString() const;
700
701 // decode the data as a string
702 const char * rcodeString() const;
703
704 private:
705
706 // RCODE
707 uint32_t rcode_;
708
709 // RDATA
710 uint32_t rdata_;
711
712 };
713
714 class NxProgramTraceIndirectBranch: public NxMessage
715 {
716 public:
717 NxProgramTraceIndirectBranch() :
718 NxMessage(28), btype_(0), icnt_(0), hist_(0)
719 {
720 }
721 ~NxProgramTraceIndirectBranch()
722 {
723 }
724
725 // NxMessage implements the standard visitor pattern.
726 virtual void accept(NxMessageVisitor &v)
727 {
728 v.visit(this);
729 }
730
731 /*!
732 @abstract Returns the TCODE string
733 @return the tcode as a string
734 */
735 virtual string tcodeString() const
736 {
737 return "Program Trace - Indirect Branch History";
738 }
739
740 // decode message info from the packet set
741 virtual bool decode(NxPacketSet &pkt_set);
742
743 // output message information as a string
744 virtual string asString() const;
745
746 // decode the data as a string
747 const char * btypeString() const;
748
749 // get the address value
750 const SizedAddress& address() const
751 {
752 return uaddr_;
753 }
754
755 private:
756
757 // BTYPE
758 uint32_t btype_;
759
760 // I-CNT
761 uint32_t icnt_;
762
763 // U-ADDR
764 SizedAddress uaddr_;
765
766 // HIST
767 uint32_t hist_;
768 };
769
770 class NxProgramTraceIndirectBranchSync: public NxMessage
771 {
772 public:
773 NxProgramTraceIndirectBranchSync() :
774 NxMessage(29), btype_(0), icnt_(0), hist_(0)
775 {
776 }
777 ~NxProgramTraceIndirectBranchSync()
778 {
779 }
780
781 // NxMessage implements the standard visitor pattern.
782 virtual void accept(NxMessageVisitor &v)
783 {
784 v.visit(this);
785 }
786
787 /*!
788 @abstract Returns the TCODE string
789 @return the tcode as a string
790 */
791 virtual string tcodeString() const
792 {
793 return "Program Trace - Indirect Branch History w/sync";
794 }
795
796 // decode message info from the packet set
797 virtual bool decode(NxPacketSet &pkt_set);
798
799 // output message information as a string
800 virtual string asString() const;
801
802 // decode the data as a string
803 const char * btypeString() const;
804
805 // get the address value
806 const SizedAddress& address() const
807 {
808 return faddr_;
809 }
810
811 private:
812
813 // BTYPE
814 uint32_t btype_;
815
816 // I-CNT
817 uint32_t icnt_;
818
819 // F-ADDR
820 SizedAddress faddr_;
821
822 // HIST
823 uint32_t hist_;
824 };
825
826 class NxProgramTraceCorrelation: public NxMessage
827 {
828 public:
829 NxProgramTraceCorrelation() :
830 NxMessage(33), evcode_(0), icnt_(0), cdata_(0)
831 {
832 }
833 ~NxProgramTraceCorrelation()
834 {
835 }
836
837 // NxMessage implements the standard visitor pattern.
838 virtual void accept(NxMessageVisitor &v)
839 {
840 v.visit(this);
841 }
842
843 /*!
844 @abstract Returns the TCODE string
845 @return the tcode as a string
846 */
847 virtual string tcodeString() const
848 {
849 return "Program Trace - Program Correlation";
850 }
851
852 // decode message info from the packet set
853 virtual bool decode(NxPacketSet &pkt_set);
854
855 // output message information as a string
856 virtual string asString() const;
857
858 // decode the data as a string
859 const char * evcodeString() const;
860
861 private:
862
863 // EVCODE
864 uint32_t evcode_;
865
866 // I-CNT
867 uint32_t icnt_;
868
869 // CDATA
870 uint32_t cdata_;
871 };
872
873 // Abstract base class for all ICT types
874 class NxInCircuitTraceBase: public NxMessage
875 {
876 public:
877 NxInCircuitTraceBase(uint32_t tcode) :
878 NxMessage(tcode)
879 {
880 }
881 virtual ~NxInCircuitTraceBase()
882 {
883 }
884
885 /*!
886 @abstract Returns the TCODE string
887 @return the tcode as a string
888 */
889 virtual string tcodeString() const;
890
891 // return true if this ICT Message has a "Sync" tcode
892 virtual bool isSyncMessage() const
893 {
894 return (tcode_ == 35);
895 }
896 };
897
898 class NxDAMInCircuitTraceMessage: public NxInCircuitTraceBase
899 {
900 public:
901 NxDAMInCircuitTraceMessage(uint32_t tcode) :
902 NxInCircuitTraceBase(tcode),
903 ddrmid_(0),
904 ddrsid_(0),
905 ddrtt_(0),
906 ddrsz_(0),
907 ddraddr_(0),
908 dddiec_(0)
909 {
910 }
911 ~NxDAMInCircuitTraceMessage()
912 {
913 }
914
915 // NxMessage implements the standard visitor pattern.
916 virtual void accept(NxMessageVisitor &v)
917 {
918 v.visit(this);
919 }
920
921 /*!
922 @abstract Returns the ICT Message Type detail
923 @return the ICT Message type
924 */
925 virtual const char * ICTMessageType() const
926 {
927 return "DDR Terse/Verbose Message (DAM)";
928 }
929
930 // decode message info from the packet set
931 virtual bool decode(NxPacketSet &pkt_set);
932
933 // output message information as a string
934 virtual string asString() const;
935
936 // decode the type data as a string
937 const char * ddrttString() const;
938
939 // decode the size data as a string
940 string ddrszString() const;
941
942 private:
943 uint32_t ddrmid_;
944 uint32_t ddrsid_;
945 uint32_t ddrtt_;
946 uint32_t ddrsz_;
947 uint64_t ddraddr_;
948 uint32_t dddiec_;
949 };
950
951 // DataPath Queuing Message (DPQM) In Circuit Trace
952 class NxDPQMInCircuitTraceMessage: public NxInCircuitTraceBase
953 {
954 public:
955 NxDPQMInCircuitTraceMessage(uint32_t tcode) :
956 NxInCircuitTraceBase(tcode),
957 verb_(0),
958 dpdm_(0),
959 fqid_(0),
960 cnum_(0),
961 pnum_(0),
962 ptype_(0),
963 qet_(0),
964 orf_(0),
965 erf_(0),
966 err_(0),
967 fmbpid_(0),
968 fmsc_(0),
969 fmol_(0),
970 fmfmt_(0),
971 fmpid_(0),
972 fmaddr_(0)
973 {
974 }
975 ~NxDPQMInCircuitTraceMessage()
976 {
977 }
978
979 // NxMessage implements the standard visitor pattern.
980 virtual void accept(NxMessageVisitor &v)
981 {
982 v.visit(this);
983 }
984
985 // returns the ICT Message type
986 virtual const char * ICTMessageType() const
987 {
988 return "DataPath Queuing Message (DPQM)";
989 }
990
991 // decode the queue event type as a string
992 const char * queueEventTypeString() const;
993
994 // decode the enqueue rejection response code as a string
995 const char * enqueueRejectionString() const;
996
997 // decode message info from the packet set
998 virtual bool decode(NxPacketSet &pkt_set);
999
1000 // output message information as a string
1001 virtual string asString() const;
1002
1003 private:
1004 uint32_t verb_;
1005 uint32_t dpdm_;
1006 uint32_t fqid_;
1007 uint32_t cnum_;
1008 uint32_t pnum_;
1009 uint32_t ptype_;
1010 uint32_t qet_;
1011 uint32_t orf_;
1012 uint32_t erf_;
1013 uint32_t err_;
1014
1015 // additional verbose fields
1016 uint32_t fmbpid_;
1017 uint32_t fmsc_;
1018 uint32_t fmol_;
1019 uint32_t fmfmt_;
1020 uint32_t fmpid_;
1021 uint64_t fmaddr_;
1022 };
1023
1024 // DataPath Frame Message (DPFM) In Circuit Trace
1025 class NxDPFMInCircuitTraceMessage: public NxInCircuitTraceBase
1026 {
1027 public:
1028 NxDPFMInCircuitTraceMessage(uint32_t tcode) :
1029 NxInCircuitTraceBase(tcode),
1030 fmsel_(0),
1031 lbeat_(0),
1032 btcnt_(0)
1033 {
1034 for (int i = 0; i < 4; i++ )
1035 context_[i] = 0;
1036
1037 }
1038 ~NxDPFMInCircuitTraceMessage()
1039 {
1040 }
1041
1042 // NxMessage implements the standard visitor pattern.
1043 virtual void accept(NxMessageVisitor &v)
1044 {
1045 v.visit(this);
1046 }
1047
1048 // returns the ICT Message type
1049 virtual const char * ICTMessageType() const
1050 {
1051 return "DataPath Frame Message (DPFM)";
1052 }
1053
1054 // decode message info from the packet set
1055 virtual bool decode(NxPacketSet &pkt_set);
1056
1057 // output message information as a string
1058 virtual string asString() const;
1059
1060 // acessors
1061 uint32_t getFmsel() const
1062 {
1063 return fmsel_;
1064 }
1065 uint32_t getLbeat() const
1066 {
1067 return lbeat_;
1068 }
1069 uint32_t getBtcnt() const
1070 {
1071 return btcnt_;
1072 }
1073 const uint32_t * getContext() const
1074 {
1075 return context_;
1076 }
1077
1078 private:
1079 uint32_t fmsel_;
1080 uint32_t lbeat_;
1081 uint32_t btcnt_;
1082 uint32_t context_[4]; // 128 bits of context
1083
1084 };
1085
1086 // Core Performance Profile Message
1087 class NxCoreInCircuitTraceMessage: public NxInCircuitTraceBase
1088 {
1089 public:
1090 NxCoreInCircuitTraceMessage(uint32_t tcode) :
1091 NxInCircuitTraceBase(tcode),
1092 cksrc_(0),
1093 sync_(0),
1094 ckdf_(0),
1095 ckdata1_(0),
1096 ckdata2_(0)
1097 {
1098 }
1099 ~NxCoreInCircuitTraceMessage()
1100 {
1101 }
1102
1103 // NxMessage implements the standard visitor pattern.
1104 virtual void accept(NxMessageVisitor &v)
1105 {
1106 v.visit(this);
1107 }
1108
1109 // returns the ICT Message type
1110 virtual const char * ICTMessageType() const
1111 {
1112 return "Core Performance Profile Message (ICT)";
1113 }
1114
1115 // decode message info from the packet set
1116 virtual bool decode(NxPacketSet &pkt_set);
1117
1118 // output message information as a string
1119 virtual string asString() const;
1120
1121 // decode the sync code as a string
1122 const char * syncString() const;
1123
1124 // decode the cksrc code as a string
1125 const char * cksrcString() const;
1126
1127 private:
1128 uint32_t cksrc_;
1129 uint32_t sync_;
1130 uint32_t ckdf_;
1131 uint32_t ckdata1_;
1132 uint32_t ckdata2_;
1133 };
1134
1135 // Prototype for a ICT message type. Also a default for an
1136 // un-decoded type.
1137 class NxInCircuitTraceMessage: public NxInCircuitTraceBase
1138 {
1139 public:
1140 NxInCircuitTraceMessage(uint32_t tcode) :
1141 NxInCircuitTraceBase(tcode)
1142 {
1143 }
1144 ~NxInCircuitTraceMessage()
1145 {
1146 }
1147
1148 // NxMessage implements the standard visitor pattern.
1149 virtual void accept(NxMessageVisitor &v)
1150 {
1151 v.visit(this);
1152 }
1153
1154 /*!
1155 @abstract Returns the ICT Message Type detail
1156 @return the ICT Message type
1157 */
1158 virtual const char * ICTMessageType() const
1159 {
1160 return "Generic In-Circuit Trace Message";
1161 }
1162
1163 // decode message info from the packet set
1164 virtual bool decode(NxPacketSet &pkt_set);
1165
1166 // output message information as a string
1167 virtual string asString() const;
1168
1169 private:
1170
1171 };
1172
1173 class NxTimeStampCorrelation: public NxMessage
1174 {
1175 public:
1176 NxTimeStampCorrelation() :
1177 NxMessage(56), tcorr_(0), ttype_(0)
1178 {
1179 }
1180 ~NxTimeStampCorrelation()
1181 {
1182 }
1183
1184 // NxMessage implements the standard visitor pattern.
1185 virtual void accept(NxMessageVisitor &v)
1186 {
1187 v.visit(this);
1188 }
1189
1190 /*!
1191 @abstract Returns the TCODE string
1192 @return the tcode as a string
1193 */
1194 virtual string tcodeString() const
1195 {
1196 return "Time Stamp Correlation";
1197 }
1198
1199 // decode message info from the packet set
1200 virtual bool decode(NxPacketSet &pkt_set);
1201
1202 // output message information as a string
1203 virtual string asString() const;
1204
1205 // decode the data as a string
1206 const char * ttypeString() const;
1207
1208 private:
1209 uint32_t tcorr_;
1210 uint32_t ttype_;
1211 };
1212
1213 #endif // NXMESSAGE_H
This page took 0.070439 seconds and 4 git commands to generate.