diff rvinterf/tmsh/omr.c @ 978:1ee80bcb0fd0

fc-tmsh: omr (old-style memory read) command implemented
author Mychaela Falconia <falcon@ivan.Harhan.ORG>
date Thu, 10 Dec 2015 04:05:55 +0000
parents
children ebdf5afa9fb5
line wrap: on
line diff
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/rvinterf/tmsh/omr.c	Thu Dec 10 04:05:55 2015 +0000
@@ -0,0 +1,41 @@
+/*
+ * Old-style memory read command
+ */
+
+#include <sys/types.h>
+#include <stdio.h>
+#include <string.h>
+#include <strings.h>
+#include <stdlib.h>
+#include "pktmux.h"
+#include "limits.h"
+#include "localtypes.h"
+#include "tm3.h"
+
+extern u_char rvi_msg[];
+extern int rvi_msg_len;
+
+void
+cmd_omr(argc, argv)
+	char **argv;
+{
+	u32 addr, size;
+	u_char cmdpkt[11];
+
+	addr = strtoul(argv[1], 0, 16);
+	size = strtoul(argv[2], 0, 0);
+	if (size < 1 || size > TM3_MEMREAD_MAX) {
+		printf("error: count argument outside valid range\n");
+		return;
+	}
+	cmdpkt[1] = MEM_READ;
+	cmdpkt[2] = addr;
+	cmdpkt[3] = addr >> 8;
+	cmdpkt[4] = addr >> 16;
+	cmdpkt[5] = addr >> 24;
+	cmdpkt[6] = size;
+	cmdpkt[7] = 0;
+	cmdpkt[8] = 0;
+	cmdpkt[9] = 0;
+	send_etm_cmd(cmdpkt, 9);
+}