diff rvinterf/etmsync/memops.c @ 921:38c7078712ab

fc-dspapidump utility written, compiles
author Mychaela Falconia <falcon@ivan.Harhan.ORG>
date Sun, 18 Oct 2015 21:41:01 +0000
parents f50c71442d50
children ce0ded19a769
line wrap: on
line diff
--- a/rvinterf/etmsync/memops.c	Tue Sep 08 23:33:38 2015 +0000
+++ b/rvinterf/etmsync/memops.c	Sun Oct 18 21:41:01 2015 +0000
@@ -55,6 +55,46 @@
 	return(0);
 }
 
+do_memory_read_16(memaddr, databuf, nwords)
+	u32 memaddr;
+	u_char *databuf;
+{
+	u_char cmdpkt[10];
+	int rc;
+
+	if (nwords > MAX_MEMREAD_16BIT) {
+		printf("error: # of 16-bit words to read may not exceed %d\n",
+			MAX_MEMREAD_16BIT);
+		return(ERROR_USAGE);
+	}
+	cmdpkt[1] = ETM_CORE;
+	cmdpkt[2] = TMCORE_OPC_MEM;
+	cmdpkt[3] = 0x02;
+	cmdpkt[4] = nwords;
+	cmdpkt[5] = memaddr;
+	cmdpkt[6] = memaddr >> 8;
+	cmdpkt[7] = memaddr >> 16;
+	cmdpkt[8] = memaddr >> 24;
+	rc = etm_pkt_exch(cmdpkt, 8);
+	if (rc)
+		return(rc);
+	if (rvi_msg[3]) {
+		printf("ETM error response to mem read 16 request: 0x%02X\n",
+			rvi_msg[3]);
+		return(ERROR_TARGET);
+	}
+	if (rvi_msg_len != nwords * 2 + 7) {
+		printf("error: mem read 16 response has wrong length\n");
+		return(ERROR_TARGET);
+	}
+	if (rvi_msg[4] != TMCORE_OPC_MEM || rvi_msg[5] != 0x02) {
+		printf("error: mem read 16 response has wrong opcode\n");
+		return(ERROR_TARGET);
+	}
+	bcopy(rvi_msg + 6, databuf, nwords * 2);
+	return(0);
+}
+
 do_dieid_read(databuf)
 	u_char *databuf;
 {