changeset 149:c81d0e9ac3b4

fc-tmsh: omw command and response handling added
author Mychaela Falconia <falcon@freecalypso.org>
date Sun, 05 Mar 2017 08:41:31 +0000
parents 0e7a85356130
children 45d8c175f9b5
files rvinterf/tmsh/Makefile rvinterf/tmsh/etmbasic.c rvinterf/tmsh/omw.c rvinterf/tmsh/usercmd.c
diffstat 4 files changed, 43 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/rvinterf/tmsh/Makefile	Mon Feb 27 08:34:31 2017 +0000
+++ b/rvinterf/tmsh/Makefile	Sun Mar 05 08:41:31 2017 +0000
@@ -2,7 +2,7 @@
 CFLAGS=	-O2 -I../include
 PROG=	fc-tmsh
 OBJS=	abb.o audiocmd.o etmbasic.o ffs2.o ffs2resp.o init.o l1cmd.o l1resp.o \
-	main.o misc.o omr.o oneshot.o pktsort.o rftablechk.o rftablerd.o \
+	main.o misc.o omr.o omw.o oneshot.o pktsort.o rftablechk.o rftablerd.o \
 	rftablewr.o saverftab.o tmcore.o usercmd.o
 LIBS=	../libasync/libasync.a
 INSTBIN=/opt/freecalypso/bin
--- a/rvinterf/tmsh/etmbasic.c	Mon Feb 27 08:34:31 2017 +0000
+++ b/rvinterf/tmsh/etmbasic.c	Sun Mar 05 08:41:31 2017 +0000
@@ -68,6 +68,9 @@
 			goto runt;
 		handle_omr_response();
 		return;
+	case MEM_WRITE:
+		l1tm_response_nodata("omw");
+		return;
 	/* L1TM */
 	case TM_INIT:
 		l1tm_response_nodata("tminit");
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/rvinterf/tmsh/omw.c	Sun Mar 05 08:41:31 2017 +0000
@@ -0,0 +1,37 @@
+/*
+ * Old-style memory write 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"
+#include "exitcodes.h"
+
+cmd_omw(argc, argv)
+	char **argv;
+{
+	u32 addr, v;
+	u_char cmdpkt[MAX_PKT_TO_TARGET];
+	int di;
+	char **ap;
+
+	addr = strtoul(argv[1], 0, 16);
+	cmdpkt[1] = MEM_WRITE;
+	cmdpkt[2] = addr;
+	cmdpkt[3] = addr >> 8;
+	cmdpkt[4] = addr >> 16;
+	cmdpkt[5] = addr >> 24;
+	di = 6;
+	for (ap = argv + 2; *ap; ap++) {
+		v = strtoul(*ap, 0, 16);
+		cmdpkt[di++] = v;
+	}
+	send_etm_cmd(cmdpkt, di - 1);
+	return(0);
+}
--- a/rvinterf/tmsh/usercmd.c	Mon Feb 27 08:34:31 2017 +0000
+++ b/rvinterf/tmsh/usercmd.c	Sun Mar 05 08:41:31 2017 +0000
@@ -22,6 +22,7 @@
 extern int cmd_mpr();
 extern int cmd_mpw();
 extern int cmd_omr();
+extern int cmd_omw();
 extern int cmd_ping();
 extern int cmd_r8();
 extern int cmd_r16();
@@ -77,6 +78,7 @@
 	{"mpr", 1, 1, cmd_mpr},
 	{"mpw", 2, 2, cmd_mpw},
 	{"omr", 2, 2, cmd_omr},
+	{"omw", 2, 129, cmd_omw},
 	{"ping", 0, 2, cmd_ping},
 	{"quit", 0, 0, cmd_exit},
 	{"r8", 1, 2, cmd_r8},