changeset 771:9c1d580b50fb

simagent: Rx byte timeout test implemented
author Mychaela Falconia <falcon@freecalypso.org>
date Fri, 12 Mar 2021 20:39:18 +0000
parents 81f9e4b4f55c
children 2e16284d5029
files target-utils/simagent/Makefile target-utils/simagent/byterx.c target-utils/simagent/cmdtab.c
diffstat 3 files changed, 29 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/target-utils/simagent/Makefile	Fri Mar 12 20:11:39 2021 +0000
+++ b/target-utils/simagent/Makefile	Fri Mar 12 20:39:18 2021 +0000
@@ -7,7 +7,7 @@
 INSTDIR=/opt/freecalypso/target-bin
 
 PROG=	simagent
-OBJS=	crt0.o cmdtab.o main.o simup.o
+OBJS=	crt0.o byterx.o cmdtab.o main.o simup.o
 LIBS=	../libcommon/libcommon.a ../libprintf/libprintf.a ../libbase/libbase.a \
 	../libc/libc.a
 LIBGCC=	`${CC} -print-file-name=libgcc.a`
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/target-utils/simagent/byterx.c	Fri Mar 12 20:39:18 2021 +0000
@@ -0,0 +1,26 @@
+#include <stdlib.h>
+#include "types.h"
+#include "simregs.h"
+
+rx_sim_byte(count)
+	unsigned count;
+{
+	for (; count; count--) {
+		if (!(SIMREGS.stat & SIM_STAT_FEMPTY))
+			return SIMREGS.drx;
+	}
+	return(-1);
+}
+
+void
+cmd_sertimeout(argbulk)
+	char *argbulk;
+{
+	char *argv[2];
+	int count;
+
+	if (parse_args(argbulk, 1, 1, argv, 0) < 0)
+		return;
+	count = atoi(argv[0]);
+	rx_sim_byte(count);
+}
--- a/target-utils/simagent/cmdtab.c	Fri Mar 12 20:11:39 2021 +0000
+++ b/target-utils/simagent/cmdtab.c	Fri Mar 12 20:39:18 2021 +0000
@@ -7,6 +7,7 @@
 extern void cmd_r8();
 extern void cmd_r16();
 extern void cmd_r32();
+extern void cmd_sertimeout();
 extern void cmd_sim_up();
 extern void cmd_w8();
 extern void cmd_w16();
@@ -27,6 +28,7 @@
 	{"r8", cmd_r8},
 	{"r16", cmd_r16},
 	{"r32", cmd_r32},
+	{"sertimeout", cmd_sertimeout},
 	{"sim-up", cmd_sim_up},
 	{"w8", cmd_w8},
 	{"w16", cmd_w16},