diff rvinterf/etmsync/memops.c @ 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 38c7078712ab
line wrap: on
line diff
--- 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);
+}