FreeCalypso > hg > freecalypso-tools
changeset 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 |
files | rvinterf/lowlevel/rviftmode.c |
diffstat | 1 files changed, 55 insertions(+), 2 deletions(-) [+] |
line wrap: on
line diff
--- 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