# HG changeset patch # User Mychaela Falconia # Date 1684900818 0 # Node ID f4e6f6b6548e0f25c1819490d00294f223fb739a # Parent d203a9c7c4e6b58961c28b8062035188dad69618 rvinterf TM log: decode ETM_CORE commands diff -r d203a9c7c4e6 -r f4e6f6b6548e rvinterf/lowlevel/rviftmode.c --- a/rvinterf/lowlevel/rviftmode.c Tue May 23 07:51:13 2023 +0000 +++ b/rvinterf/lowlevel/rviftmode.c Wed May 24 04:00:18 2023 +0000 @@ -40,8 +40,61 @@ unsigned pktlen; char *outbuf; { - /* classification code to be filled */ - strcpy(outbuf, "ETM_CORE"); + if (pktlen < 4) { +runt: strcpy(outbuf, "ETM_CORE runt"); + return; + } + switch (pkt[2]) { + case TMCORE_OPC_MEM: + if (pktlen < 5) + goto runt; + switch (pkt[3]) { + case 0x01: + strcpy(outbuf, "r8"); + return; + case 0x02: + strcpy(outbuf, "r16"); + return; + case 0x04: + strcpy(outbuf, "r32"); + return; + case 0x11: + strcpy(outbuf, "w8"); + return; + case 0x12: + strcpy(outbuf, "w16"); + return; + case 0x14: + strcpy(outbuf, "w32"); + return; + default: + sprintf(outbuf, "ETM_CORE mem opcode 0x%02X", pkt[3]); + } + return; + case TMCORE_OPC_ECHO: + strcpy(outbuf, "ping"); + return; + case TMCORE_OPC_RESET: + strcpy(outbuf, "tgtreset"); + return; + case TMCORE_OPC_DEBUG: + strcpy(outbuf, "ETM_CORE debug opc"); + return; + case TMCORE_OPC_VERSION: + strcpy(outbuf, "version"); + return; + case TMCORE_OPC_CODEC_RD: + strcpy(outbuf, "abbr"); + return; + case TMCORE_OPC_CODEC_WR: + strcpy(outbuf, "abbw"); + return; + case TMCORE_OPC_DIEID: + strcpy(outbuf, "dieid"); + return; + default: + sprintf(outbuf, "ETM_CORE opcode 0x%02X", pkt[2]); + } } static void