FreeCalypso > hg > freecalypso-sw
changeset 912:f50c71442d50
etmsync: die ID read implemented
author | Space Falcon <falcon@ivan.Harhan.ORG> |
---|---|
date | Tue, 08 Sep 2015 08:18:42 +0000 |
parents | 42719fa3e6af |
children | 091ebd46a9cc |
files | rvinterf/etmsync/fscmdtab.c rvinterf/etmsync/memcmd.c rvinterf/etmsync/memops.c |
diffstat | 3 files changed, 44 insertions(+), 1 deletions(-) [+] |
line wrap: on
line diff
--- a/rvinterf/etmsync/fscmdtab.c Tue Sep 08 07:52:29 2015 +0000 +++ b/rvinterf/etmsync/fscmdtab.c Tue Sep 08 08:18:42 2015 +0000 @@ -7,6 +7,7 @@ extern int cmd_cpout(); extern int cmd_cpout_file(); extern int cmd_delete(); +extern int cmd_dieid(); extern int cmd_exec(); extern int cmd_exit(); extern int cmd_fd(); @@ -32,6 +33,7 @@ {"cpout", 2, 2, cmd_cpout}, {"cpout-file", 2, 2, cmd_cpout_file}, {"delete", 1, 1, cmd_delete}, + {"dieid", 0, 0, cmd_dieid}, {"exec", 1, 1, cmd_exec}, {"exit", 0, 0, cmd_exit}, {"fd", 2, 3, cmd_fd},
--- a/rvinterf/etmsync/memcmd.c Tue Sep 08 07:52:29 2015 +0000 +++ b/rvinterf/etmsync/memcmd.c Tue Sep 08 08:18:42 2015 +0000 @@ -12,7 +12,7 @@ #include "localtypes.h" #include "exitcodes.h" -void +static void memdump_line(addr, buf, len) u32 addr; u_char *buf; @@ -57,3 +57,16 @@ } return(0); } + +cmd_dieid() +{ + u_char buf[8]; + int rc; + + rc = do_dieid_read(buf); + if (rc) + return(rc); + printf("%02X %02X %02X %02X %02X %02X %02X %02X\n", buf[0], buf[1], + buf[2], buf[3], buf[4], buf[5], buf[6], buf[7]); + return(0); +}
--- a/rvinterf/etmsync/memops.c Tue Sep 08 07:52:29 2015 +0000 +++ b/rvinterf/etmsync/memops.c Tue Sep 08 08:18:42 2015 +0000 @@ -54,3 +54,31 @@ bcopy(rvi_msg + 6, databuf, nbytes); return(0); } + +do_dieid_read(databuf) + u_char *databuf; +{ + u_char cmdpkt[4]; + int rc; + + cmdpkt[1] = ETM_CORE; + cmdpkt[2] = TMCORE_OPC_DIEID; + rc = etm_pkt_exch(cmdpkt, 2); + if (rc) + return(rc); + if (rvi_msg[3]) { + printf("ETM error response to die ID read request: 0x%02X\n", + rvi_msg[3]); + return(ERROR_TARGET); + } + if (rvi_msg_len != 14) { + printf("error: die ID read response has wrong length\n"); + return(ERROR_TARGET); + } + if (rvi_msg[4] != TMCORE_OPC_DIEID) { + printf("error: die ID read response has wrong opcode\n"); + return(ERROR_TARGET); + } + bcopy(rvi_msg + 5, databuf, 8); + return(0); +}