changeset 112:2825d79bb151

fc-tmsh: beginning of L1TM command support
author Mychaela Falconia <falcon@freecalypso.org>
date Mon, 16 Jan 2017 18:44:24 +0000
parents 10ff8b38c7fd
children 816d91739a32
files rvinterf/tmsh/Makefile rvinterf/tmsh/l1cmd.c rvinterf/tmsh/usercmd.c
diffstat 3 files changed, 62 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/rvinterf/tmsh/Makefile	Sat Nov 26 01:05:17 2016 +0000
+++ b/rvinterf/tmsh/Makefile	Mon Jan 16 18:44:24 2017 +0000
@@ -1,8 +1,8 @@
 CC=	gcc
 CFLAGS=	-O2 -I../include
 PROG=	fc-tmsh
-OBJS=	abb.o audiocmd.o etmbasic.o ffs2.o ffs2resp.o init.o main.o misc.o \
-	omr.o oneshot.o pktsort.o tmcore.o usercmd.o
+OBJS=	abb.o audiocmd.o etmbasic.o ffs2.o ffs2resp.o init.o l1cmd.o main.o \
+	misc.o omr.o oneshot.o pktsort.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/l1cmd.c	Mon Jan 16 18:44:24 2017 +0000
@@ -0,0 +1,54 @@
+/*
+ * In this module we are going to implement commands which send
+ * TM3 command packets to the L1TM firmware component: RF calibration
+ * and test modes.
+ */
+
+#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_tminit(argc, argv)
+	char **argv;
+{
+	u_char cmdpkt[3];
+
+	cmdpkt[1] = TM_INIT;
+	send_etm_cmd(cmdpkt, 1);
+	return(0);
+}
+
+cmd_tms(argc, argv)
+	char **argv;
+{
+	u16 arg;
+	u_char cmdpkt[5];
+
+	arg = strtoul(argv[1], 0, 0);
+	cmdpkt[1] = TM_MODE_SET;
+	cmdpkt[2] = arg;
+	cmdpkt[3] = arg >> 8;
+	send_etm_cmd(cmdpkt, 3);
+	return(0);
+}
+
+cmd_tm3ver(argc, argv)
+	char **argv;
+{
+	u16 arg;
+	u_char cmdpkt[5];
+
+	arg = strtoul(argv[1], 0, 16);
+	cmdpkt[1] = VERSION_GET;
+	cmdpkt[2] = arg;
+	cmdpkt[3] = arg >> 8;
+	send_etm_cmd(cmdpkt, 3);
+	return(0);
+}
--- a/rvinterf/tmsh/usercmd.c	Sat Nov 26 01:05:17 2016 +0000
+++ b/rvinterf/tmsh/usercmd.c	Mon Jan 16 18:44:24 2017 +0000
@@ -24,7 +24,10 @@
 extern int cmd_r16();
 extern int cmd_r32();
 extern int cmd_tgtreset();
+extern int cmd_tm3ver();
+extern int cmd_tminit();
 extern int cmd_tmpkt();
+extern int cmd_tms();
 extern int cmd_version();
 extern int cmd_w8();
 extern int cmd_w16();
@@ -57,7 +60,10 @@
 	{"r16", 1, 2, cmd_r16},
 	{"r32", 1, 2, cmd_r32},
 	{"tgtreset", 0, 0, cmd_tgtreset},
+	{"tm3ver", 1, 1, cmd_tm3ver},
+	{"tminit", 0, 0, cmd_tminit},
 	{"tmpkt", 1, 253, cmd_tmpkt},
+	{"tms", 1, 1, cmd_tms},
 	{"version", 1, 1, cmd_version},
 	{"w8", 2, 246, cmd_w8},
 	{"w16", 2, 123, cmd_w16},