comparison rvinterf/lowlevel/rviftmode.c @ 936:f4e6f6b6548e

rvinterf TM log: decode ETM_CORE commands
author Mychaela Falconia <falcon@freecalypso.org>
date Wed, 24 May 2023 04:00:18 +0000
parents d203a9c7c4e6
children 06f96627ac9a
comparison
equal deleted inserted replaced
935:d203a9c7c4e6 936:f4e6f6b6548e
38 etm_core_classify(pkt, pktlen, outbuf) 38 etm_core_classify(pkt, pktlen, outbuf)
39 u_char *pkt; 39 u_char *pkt;
40 unsigned pktlen; 40 unsigned pktlen;
41 char *outbuf; 41 char *outbuf;
42 { 42 {
43 /* classification code to be filled */ 43 if (pktlen < 4) {
44 strcpy(outbuf, "ETM_CORE"); 44 runt: strcpy(outbuf, "ETM_CORE runt");
45 return;
46 }
47 switch (pkt[2]) {
48 case TMCORE_OPC_MEM:
49 if (pktlen < 5)
50 goto runt;
51 switch (pkt[3]) {
52 case 0x01:
53 strcpy(outbuf, "r8");
54 return;
55 case 0x02:
56 strcpy(outbuf, "r16");
57 return;
58 case 0x04:
59 strcpy(outbuf, "r32");
60 return;
61 case 0x11:
62 strcpy(outbuf, "w8");
63 return;
64 case 0x12:
65 strcpy(outbuf, "w16");
66 return;
67 case 0x14:
68 strcpy(outbuf, "w32");
69 return;
70 default:
71 sprintf(outbuf, "ETM_CORE mem opcode 0x%02X", pkt[3]);
72 }
73 return;
74 case TMCORE_OPC_ECHO:
75 strcpy(outbuf, "ping");
76 return;
77 case TMCORE_OPC_RESET:
78 strcpy(outbuf, "tgtreset");
79 return;
80 case TMCORE_OPC_DEBUG:
81 strcpy(outbuf, "ETM_CORE debug opc");
82 return;
83 case TMCORE_OPC_VERSION:
84 strcpy(outbuf, "version");
85 return;
86 case TMCORE_OPC_CODEC_RD:
87 strcpy(outbuf, "abbr");
88 return;
89 case TMCORE_OPC_CODEC_WR:
90 strcpy(outbuf, "abbw");
91 return;
92 case TMCORE_OPC_DIEID:
93 strcpy(outbuf, "dieid");
94 return;
95 default:
96 sprintf(outbuf, "ETM_CORE opcode 0x%02X", pkt[2]);
97 }
45 } 98 }
46 99
47 static void 100 static void
48 tmffs2_cmd_classify(pkt, pktlen, outbuf) 101 tmffs2_cmd_classify(pkt, pktlen, outbuf)
49 u_char *pkt; 102 u_char *pkt;