FreeCalypso > hg > freecalypso-tools
diff rvinterf/tmsh/tmcore.c @ 811:4c7f3778dc24
fc-tmsh: add simple commands carried via ETM debug opcode
author | Mychaela Falconia <falcon@freecalypso.org> |
---|---|
date | Mon, 10 May 2021 00:59:15 +0000 |
parents | 2159f260ed13 |
children |
line wrap: on
line diff
--- a/rvinterf/tmsh/tmcore.c Mon May 10 00:56:23 2021 +0000 +++ b/rvinterf/tmsh/tmcore.c Mon May 10 00:59:15 2021 +0000 @@ -153,6 +153,29 @@ async_msg_output(buf); } +static void +etm_debug_response() +{ + char buf[80]; + + if (rvi_msg[3]) { + print_etm_pkt_raw("ETM debug command error"); + return; + } + switch (rvi_msg_len) { + case 6: + async_msg_output("ETM debug command successful"); + return; + case 10: + sprintf(buf, "ETM debug command response: %02X%02X%02X%02X", + rvi_msg[8], rvi_msg[7], rvi_msg[6], rvi_msg[5]); + async_msg_output(buf); + return; + default: + print_etm_pkt_raw("ETM debug response wrong length"); + } +} + void tmcore_msg_rx() { @@ -189,6 +212,9 @@ case TMCORE_OPC_DIEID: dieid_response(); return; + case TMCORE_OPC_DEBUG: + etm_debug_response(); + return; default: unknown: print_etm_pkt_raw("ETM_CORE resp"); @@ -447,3 +473,41 @@ send_etm_cmd(cmdpkt, 6); return(0); } + +cmd_rvf_dump(argc, argv) + char **argv; +{ + u_char cmdpkt[5]; + + cmdpkt[1] = ETM_CORE; + cmdpkt[2] = TMCORE_OPC_DEBUG; + cmdpkt[3] = TMDBG_OPC_RVF_DUMP; + send_etm_cmd(cmdpkt, 3); + return(0); +} + +/* the following commands are FreeCalypso additions */ + +cmd_pwr_key(argc, argv) + char **argv; +{ + u_char cmdpkt[5]; + + cmdpkt[1] = ETM_CORE; + cmdpkt[2] = TMCORE_OPC_DEBUG; + cmdpkt[3] = TMDBG_OPC_PWR_CYCLE; + send_etm_cmd(cmdpkt, 3); + return(0); +} + +cmd_phone_on(argc, argv) + char **argv; +{ + u_char cmdpkt[5]; + + cmdpkt[1] = ETM_CORE; + cmdpkt[2] = TMCORE_OPC_DEBUG; + cmdpkt[3] = TMDBG_OPC_PHONE_ON; + send_etm_cmd(cmdpkt, 3); + return(0); +}