changeset 40:7ecb70b0ac36

c139explore: vibe command added that works like buz
author Mychaela Falconia <falcon@freecalypso.org>
date Wed, 26 Oct 2016 01:59:32 +0000
parents 280826b807e3
children 2c9ea966edb9
files target-utils/c139explore/cmdtab.c target-utils/c139explore/dac.c
diffstat 2 files changed, 26 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/target-utils/c139explore/cmdtab.c	Wed Oct 26 01:53:12 2016 +0000
+++ b/target-utils/c139explore/cmdtab.c	Wed Oct 26 01:59:32 2016 +0000
@@ -18,6 +18,7 @@
 extern void cmd_r16();
 extern void cmd_r32();
 extern void cmd_vbars();
+extern void cmd_vibe();
 extern void cmd_w8();
 extern void cmd_w16();
 extern void cmd_w32();
@@ -48,6 +49,7 @@
 	{"r16", cmd_r16},
 	{"r32", cmd_r32},
 	{"vbars", cmd_vbars},
+	{"vibe", cmd_vibe},
 	{"w8", cmd_w8},
 	{"w16", cmd_w16},
 	{"w32", cmd_w32},
--- a/target-utils/c139explore/dac.c	Wed Oct 26 01:53:12 2016 +0000
+++ b/target-utils/c139explore/dac.c	Wed Oct 26 01:59:32 2016 +0000
@@ -29,3 +29,27 @@
 	}
 	abb_reg_write(AUXDAC, val);
 }
+
+void
+cmd_vibe(argbulk)
+	char *argbulk;
+{
+	char *argv[2];
+	u32 val;
+	int c;
+
+	if (parse_args(argbulk, 1, 1, argv, 0) < 0)
+		return;
+	val = strtoul(argv[0], 0, 0);
+	if (val > 0x3FF) {
+		printf("ERROR: argument out of range\n");
+		return;
+	}
+	abb_reg_write(AUXDAC, val);
+	for (;;) {
+		c = serial_in_poll();
+		if (c >= 0)
+			break;
+	}
+	abb_reg_write(AUXDAC, 0);
+}