changeset 779:8196bba46318

simagent: set-spenh test command implemented
author Mychaela Falconia <falcon@freecalypso.org>
date Sat, 13 Mar 2021 19:47:06 +0000
parents 3ba64341137b
children 8a94593fb7ef
files target-utils/simagent/Makefile target-utils/simagent/cmdtab.c target-utils/simagent/spenh.c
diffstat 3 files changed, 26 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/target-utils/simagent/Makefile	Sat Mar 13 19:31:53 2021 +0000
+++ b/target-utils/simagent/Makefile	Sat Mar 13 19:47:06 2021 +0000
@@ -7,7 +7,8 @@
 INSTDIR=/opt/freecalypso/target-bin
 
 PROG=	simagent
-OBJS=	crt0.o byterx.o cmdtab.o invtable.o main.o simup.o stringarg.o tx.o
+OBJS=	crt0.o byterx.o cmdtab.o invtable.o main.o simup.o spenh.o stringarg.o \
+	tx.o
 LIBS=	../libcommon/libcommon.a ../libprintf/libprintf.a ../libbase/libbase.a \
 	../libc/libc.a
 LIBGCC=	`${CC} -print-file-name=libgcc.a`
--- a/target-utils/simagent/cmdtab.c	Sat Mar 13 19:31:53 2021 +0000
+++ b/target-utils/simagent/cmdtab.c	Sat Mar 13 19:47:06 2021 +0000
@@ -8,6 +8,7 @@
 extern void cmd_r16();
 extern void cmd_r32();
 extern void cmd_sertimeout();
+extern void cmd_set_spenh();
 extern void cmd_sim_up();
 extern void cmd_tx();
 extern void cmd_w8();
@@ -32,6 +33,7 @@
 	{"r16", cmd_r16},
 	{"r32", cmd_r32},
 	{"sertimeout", cmd_sertimeout},
+	{"set-spenh", cmd_set_spenh},
 	{"sim-up", cmd_sim_up},
 	{"tx", cmd_tx},
 	{"w8", cmd_w8},
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/target-utils/simagent/spenh.c	Sat Mar 13 19:47:06 2021 +0000
@@ -0,0 +1,22 @@
+#include <sys/types.h>
+#include <strings.h>
+#include "types.h"
+#include "simregs.h"
+
+extern u16 conf1_reg;
+
+void
+cmd_set_spenh(argbulk)
+	char *argbulk;
+{
+	char *argv[2];
+
+	if (parse_args(argbulk, 1, 1, argv, 0) < 0)
+		return;
+	if (!strcmp(argv[0], "0"))
+		SIMREGS.conf1 = conf1_reg &= ~SIM_CONF1_ETU;
+	else if (!strcmp(argv[0], "1"))
+		SIMREGS.conf1 = conf1_reg |= SIM_CONF1_ETU;
+	else
+		printf("ERROR: \"0\" or \"1\" argument expected\n");
+}