changeset 39:280826b807e3

c139explore: dac and dacon commands added for exercising the vibrator
author Mychaela Falconia <falcon@freecalypso.org>
date Wed, 26 Oct 2016 01:53:12 +0000
parents c90b1fff224a
children 7ecb70b0ac36
files target-utils/c139explore/Makefile target-utils/c139explore/cmdtab.c target-utils/c139explore/dac.c
diffstat 3 files changed, 37 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/target-utils/c139explore/Makefile	Wed Oct 26 01:09:20 2016 +0000
+++ b/target-utils/c139explore/Makefile	Wed Oct 26 01:53:12 2016 +0000
@@ -5,7 +5,8 @@
 OBJCOPY=arm-elf-objcopy
 
 PROG=	c139explore
-OBJS=	crt0.o backlight.o cmdtab.o lcd.o main.o mygetchar.o uartbase.o uwire.o
+OBJS=	crt0.o backlight.o cmdtab.o dac.o lcd.o main.o mygetchar.o uartbase.o \
+	uwire.o
 LIBS=	../libcommon/libcommon.a ../libprintf/libprintf.a ../libbase/libbase.a
 LDS=	../env/compalram.lds
 
--- a/target-utils/c139explore/cmdtab.c	Wed Oct 26 01:09:20 2016 +0000
+++ b/target-utils/c139explore/cmdtab.c	Wed Oct 26 01:53:12 2016 +0000
@@ -4,6 +4,8 @@
 extern void cmd_abbw();
 extern void cmd_buz();
 extern void cmd_buzlev();
+extern void cmd_dac();
+extern void cmd_dacon();
 extern void cmd_dbl();
 extern void cmd_hbars();
 extern void cmd_jump();
@@ -30,6 +32,8 @@
 	{"abbw", cmd_abbw},
 	{"buz", cmd_buz},
 	{"buzlev", cmd_buzlev},
+	{"dac", cmd_dac},
+	{"dacon", cmd_dacon},
 	{"dbl", cmd_dbl},
 	{"dump", cmd_memdump_human},
 	{"hbars", cmd_hbars},
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/target-utils/c139explore/dac.c	Wed Oct 26 01:53:12 2016 +0000
@@ -0,0 +1,31 @@
+/*
+ * Code for exercising Motorola's vibrator, which is driven
+ * via the Iota auxiliary DAC on this phone.
+ */
+
+#include <sys/types.h>
+#include "types.h"
+#include "abbdefs.h"
+
+void
+cmd_dacon()
+{
+	abb_reg_write(TOGBR1, 0x20);
+}
+
+void
+cmd_dac(argbulk)
+	char *argbulk;
+{
+	char *argv[2];
+	u32 val;
+
+	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);
+}