changeset 150:45d8c175f9b5

fc-tmsh: oabbr and oabbw command sending implemented
author Mychaela Falconia <falcon@freecalypso.org>
date Sun, 05 Mar 2017 09:07:01 +0000
parents c81d0e9ac3b4
children 74b9aeb25d79
files rvinterf/tmsh/Makefile rvinterf/tmsh/abbtm3.c rvinterf/tmsh/usercmd.c
diffstat 3 files changed, 65 insertions(+), 3 deletions(-) [+]
line wrap: on
line diff
--- a/rvinterf/tmsh/Makefile	Sun Mar 05 08:41:31 2017 +0000
+++ b/rvinterf/tmsh/Makefile	Sun Mar 05 09:07:01 2017 +0000
@@ -1,9 +1,9 @@
 CC=	gcc
 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 omw.o oneshot.o pktsort.o rftablechk.o rftablerd.o \
-	rftablewr.o saverftab.o tmcore.o usercmd.o
+OBJS=	abb.o abbtm3.o audiocmd.o etmbasic.o ffs2.o ffs2resp.o init.o l1cmd.o \
+	l1resp.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
 
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/rvinterf/tmsh/abbtm3.c	Sun Mar 05 09:07:01 2017 +0000
@@ -0,0 +1,58 @@
+/*
+ * Old TM3 versions of ABB register read and write commands
+ */
+
+#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"
+
+extern u_char rvi_msg[];
+extern int rvi_msg_len;
+
+cmd_oabbr(argc, argv)
+	char **argv;
+{
+	u32 page, reg;
+	u_char cmdpkt[5];
+
+	page = strtoul(argv[1], 0, 0);
+	reg = strtoul(argv[2], 0, 0);
+	if (page > 1 || reg > 31) {
+		printf("error: argument(s) out of range\n");
+		return(ERROR_USAGE);
+	}
+	cmdpkt[1] = CODEC_READ;
+	cmdpkt[2] = page << 5 | reg;
+	cmdpkt[3] = 0;
+	send_etm_cmd(cmdpkt, 3);
+	return(0);
+}
+
+cmd_oabbw(argc, argv)
+	char **argv;
+{
+	u32 page, reg, val;
+	u_char cmdpkt[7];
+
+	page = strtoul(argv[1], 0, 0);
+	reg = strtoul(argv[2], 0, 0);
+	val = strtoul(argv[3], 0, 16);
+	if (page > 1 || reg > 31 || val > 0x3FF) {
+		printf("error: argument(s) out of range\n");
+		return(ERROR_USAGE);
+	}
+	cmdpkt[1] = CODEC_WRITE;
+	cmdpkt[2] = page << 5 | reg;
+	cmdpkt[3] = 0;
+	cmdpkt[4] = val;
+	cmdpkt[5] = val >> 8;
+	send_etm_cmd(cmdpkt, 5);
+	return(0);
+}
--- a/rvinterf/tmsh/usercmd.c	Sun Mar 05 08:41:31 2017 +0000
+++ b/rvinterf/tmsh/usercmd.c	Sun Mar 05 09:07:01 2017 +0000
@@ -21,6 +21,8 @@
 extern int cmd_me();
 extern int cmd_mpr();
 extern int cmd_mpw();
+extern int cmd_oabbr();
+extern int cmd_oabbw();
 extern int cmd_omr();
 extern int cmd_omw();
 extern int cmd_ping();
@@ -77,6 +79,8 @@
 	{"me", 1, 1, cmd_me},
 	{"mpr", 1, 1, cmd_mpr},
 	{"mpw", 2, 2, cmd_mpw},
+	{"oabbr", 2, 2, cmd_oabbr},
+	{"oabbw", 3, 3, cmd_oabbw},
 	{"omr", 2, 2, cmd_omr},
 	{"omw", 2, 129, cmd_omw},
 	{"ping", 0, 2, cmd_ping},