changeset 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 ce0ded19a769
children ebdf5afa9fb5
files rvinterf/tmsh/Makefile rvinterf/tmsh/omr.c rvinterf/tmsh/usercmd.c
diffstat 3 files changed, 44 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/rvinterf/tmsh/Makefile	Thu Dec 10 04:00:08 2015 +0000
+++ b/rvinterf/tmsh/Makefile	Thu Dec 10 04:05:55 2015 +0000
@@ -5,7 +5,7 @@
 LIBS=	../libasync/libasync.a
 
 TMSH_OBJS=	abb.o etmbasic.o ffs2.o ffs2resp.o ffs2wr.o init.o main.o \
-		misc.o pktsort.o tmcore.o usercmd.o
+		misc.o omr.o pktsort.o tmcore.o usercmd.o
 
 all:	${PROGS}
 
--- /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);
+}
--- a/rvinterf/tmsh/usercmd.c	Thu Dec 10 04:00:08 2015 +0000
+++ b/rvinterf/tmsh/usercmd.c	Thu Dec 10 04:05:55 2015 +0000
@@ -17,6 +17,7 @@
 extern void cmd_dieid();
 extern void cmd_etmpkt();
 extern void cmd_ffs2();
+extern void cmd_omr();
 extern void cmd_ping();
 extern void cmd_r8();
 extern void cmd_r16();
@@ -50,6 +51,7 @@
 	{"etmpkt", 1, 253, cmd_etmpkt},
 	{"exit", 0, 0, cmd_exit},
 	{"ffs2", 1, 3, cmd_ffs2},
+	{"omr", 2, 2, cmd_omr},
 	{"ping", 0, 2, cmd_ping},
 	{"quit", 0, 0, cmd_exit},
 	{"r8", 1, 2, cmd_r8},