FreeCalypso > hg > freecalypso-sw
annotate target-utils/c139explore/backlight.c @ 995:c22afeecbf34
loadtools/scripts: D-Sample config added
author | Mychaela Falconia <falcon@ivan.Harhan.ORG> |
---|---|
date | Sat, 02 Jan 2016 04:05:51 +0000 |
parents | df1dccc0ef9c |
children |
rev | line source |
---|---|
949
df1dccc0ef9c
c139explore: GPIO init and backlight on/off control implemented
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
1 #include <sys/types.h> |
df1dccc0ef9c
c139explore: GPIO init and backlight on/off control implemented
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
2 #include <string.h> |
df1dccc0ef9c
c139explore: GPIO init and backlight on/off control implemented
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
3 #include "types.h" |
df1dccc0ef9c
c139explore: GPIO init and backlight on/off control implemented
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
4 #include "abbdefs.h" |
df1dccc0ef9c
c139explore: GPIO init and backlight on/off control implemented
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
5 |
df1dccc0ef9c
c139explore: GPIO init and backlight on/off control implemented
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
6 #define GPIO_OUT_REG (*(volatile u16 *) 0xfffe4802) |
df1dccc0ef9c
c139explore: GPIO init and backlight on/off control implemented
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
7 #define BACKLIGHT_GPIO_MASK 0x0002 |
df1dccc0ef9c
c139explore: GPIO init and backlight on/off control implemented
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
8 |
df1dccc0ef9c
c139explore: GPIO init and backlight on/off control implemented
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
9 #define AUXLED_KPBL_OFF 0x000 |
df1dccc0ef9c
c139explore: GPIO init and backlight on/off control implemented
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
10 #define AUXLED_KPBL_ON 0x002 |
df1dccc0ef9c
c139explore: GPIO init and backlight on/off control implemented
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
11 |
df1dccc0ef9c
c139explore: GPIO init and backlight on/off control implemented
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
12 void |
df1dccc0ef9c
c139explore: GPIO init and backlight on/off control implemented
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
13 cmd_dbl(argbulk) |
df1dccc0ef9c
c139explore: GPIO init and backlight on/off control implemented
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
14 char *argbulk; |
df1dccc0ef9c
c139explore: GPIO init and backlight on/off control implemented
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
15 { |
df1dccc0ef9c
c139explore: GPIO init and backlight on/off control implemented
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
16 char *argv[2]; |
df1dccc0ef9c
c139explore: GPIO init and backlight on/off control implemented
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
17 |
df1dccc0ef9c
c139explore: GPIO init and backlight on/off control implemented
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
18 if (parse_args(argbulk, 1, 1, argv, 0) < 0) |
df1dccc0ef9c
c139explore: GPIO init and backlight on/off control implemented
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
19 return; |
df1dccc0ef9c
c139explore: GPIO init and backlight on/off control implemented
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
20 if (!strcmp(argv[0], "on")) |
df1dccc0ef9c
c139explore: GPIO init and backlight on/off control implemented
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
21 GPIO_OUT_REG |= BACKLIGHT_GPIO_MASK; |
df1dccc0ef9c
c139explore: GPIO init and backlight on/off control implemented
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
22 else if (!strcmp(argv[0], "off")) |
df1dccc0ef9c
c139explore: GPIO init and backlight on/off control implemented
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
23 GPIO_OUT_REG &= ~BACKLIGHT_GPIO_MASK; |
df1dccc0ef9c
c139explore: GPIO init and backlight on/off control implemented
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
24 else |
df1dccc0ef9c
c139explore: GPIO init and backlight on/off control implemented
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
25 printf("ERROR: \"on\" or \"off\" argument expected\n"); |
df1dccc0ef9c
c139explore: GPIO init and backlight on/off control implemented
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
26 } |
df1dccc0ef9c
c139explore: GPIO init and backlight on/off control implemented
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
27 |
df1dccc0ef9c
c139explore: GPIO init and backlight on/off control implemented
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
28 void |
df1dccc0ef9c
c139explore: GPIO init and backlight on/off control implemented
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
29 cmd_kpbl(argbulk) |
df1dccc0ef9c
c139explore: GPIO init and backlight on/off control implemented
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
30 char *argbulk; |
df1dccc0ef9c
c139explore: GPIO init and backlight on/off control implemented
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
31 { |
df1dccc0ef9c
c139explore: GPIO init and backlight on/off control implemented
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
32 char *argv[2]; |
df1dccc0ef9c
c139explore: GPIO init and backlight on/off control implemented
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
33 |
df1dccc0ef9c
c139explore: GPIO init and backlight on/off control implemented
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
34 if (parse_args(argbulk, 1, 1, argv, 0) < 0) |
df1dccc0ef9c
c139explore: GPIO init and backlight on/off control implemented
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
35 return; |
df1dccc0ef9c
c139explore: GPIO init and backlight on/off control implemented
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
36 if (!strcmp(argv[0], "on")) |
df1dccc0ef9c
c139explore: GPIO init and backlight on/off control implemented
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
37 abb_reg_write(AUXLED, AUXLED_KPBL_ON); |
df1dccc0ef9c
c139explore: GPIO init and backlight on/off control implemented
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
38 else if (!strcmp(argv[0], "off")) |
df1dccc0ef9c
c139explore: GPIO init and backlight on/off control implemented
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
39 abb_reg_write(AUXLED, AUXLED_KPBL_OFF); |
df1dccc0ef9c
c139explore: GPIO init and backlight on/off control implemented
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
40 else |
df1dccc0ef9c
c139explore: GPIO init and backlight on/off control implemented
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
41 printf("ERROR: \"on\" or \"off\" argument expected\n"); |
df1dccc0ef9c
c139explore: GPIO init and backlight on/off control implemented
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
42 } |