diff target-utils/lunadrv/backlight.c @ 700:db9a8e88e63f

target-utils lunadrv program written, compiles
author Mychaela Falconia <falcon@freecalypso.org>
date Thu, 07 May 2020 02:19:51 +0000
parents
children
line wrap: on
line diff
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/target-utils/lunadrv/backlight.c	Thu May 07 02:19:51 2020 +0000
@@ -0,0 +1,22 @@
+#include <sys/types.h>
+#include <strings.h>
+#include "types.h"
+
+#define	GPIO_OUT_REG		(*(volatile u16 *) 0xfffe4802)
+#define	BACKLIGHT_GPIO_MASK	0x0200
+
+void
+cmd_dbl(argbulk)
+	char *argbulk;
+{
+	char *argv[2];
+
+	if (parse_args(argbulk, 1, 1, argv, 0) < 0)
+		return;
+	if (!strcmp(argv[0], "on"))
+		GPIO_OUT_REG |= BACKLIGHT_GPIO_MASK;
+	else if (!strcmp(argv[0], "off"))
+		GPIO_OUT_REG &= ~BACKLIGHT_GPIO_MASK;
+	else
+		printf("ERROR: \"on\" or \"off\" argument expected\n");
+}