diff target-utils/simagent/byterx.c @ 771:9c1d580b50fb

simagent: Rx byte timeout test implemented
author Mychaela Falconia <falcon@freecalypso.org>
date Fri, 12 Mar 2021 20:39:18 +0000
parents
children badc5399d641
line wrap: on
line diff
--- /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);
+}