comparison target-utils/c139explore/backlight.c @ 0:e7502631a0f9

initial import from freecalypso-sw rev 1033:5ab737ac3ad7
author Mychaela Falconia <falcon@freecalypso.org>
date Sat, 11 Jun 2016 00:13:35 +0000
parents
children 5d9d95530256
comparison
equal deleted inserted replaced
-1:000000000000 0:e7502631a0f9
1 #include <sys/types.h>
2 #include <string.h>
3 #include "types.h"
4 #include "abbdefs.h"
5
6 #define GPIO_OUT_REG (*(volatile u16 *) 0xfffe4802)
7 #define BACKLIGHT_GPIO_MASK 0x0002
8
9 #define AUXLED_KPBL_OFF 0x000
10 #define AUXLED_KPBL_ON 0x002
11
12 void
13 cmd_dbl(argbulk)
14 char *argbulk;
15 {
16 char *argv[2];
17
18 if (parse_args(argbulk, 1, 1, argv, 0) < 0)
19 return;
20 if (!strcmp(argv[0], "on"))
21 GPIO_OUT_REG |= BACKLIGHT_GPIO_MASK;
22 else if (!strcmp(argv[0], "off"))
23 GPIO_OUT_REG &= ~BACKLIGHT_GPIO_MASK;
24 else
25 printf("ERROR: \"on\" or \"off\" argument expected\n");
26 }
27
28 void
29 cmd_kpbl(argbulk)
30 char *argbulk;
31 {
32 char *argv[2];
33
34 if (parse_args(argbulk, 1, 1, argv, 0) < 0)
35 return;
36 if (!strcmp(argv[0], "on"))
37 abb_reg_write(AUXLED, AUXLED_KPBL_ON);
38 else if (!strcmp(argv[0], "off"))
39 abb_reg_write(AUXLED, AUXLED_KPBL_OFF);
40 else
41 printf("ERROR: \"on\" or \"off\" argument expected\n");
42 }