annotate target-utils/lunadrv/regcmd.c @ 732:4c19ca123c97

CHANGES: tiffs IVA additions
author Mychaela Falconia <falcon@freecalypso.org>
date Fri, 28 Aug 2020 06:07:53 +0000
parents 36e6a1ff9608
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
702
36e6a1ff9608 lunadrv: rd and wr commands added
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
1 /*
36e6a1ff9608 lunadrv: rd and wr commands added
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
2 * Handy commands for reading and writing LCD controller registers.
36e6a1ff9608 lunadrv: rd and wr commands added
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
3 */
36e6a1ff9608 lunadrv: rd and wr commands added
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
4
36e6a1ff9608 lunadrv: rd and wr commands added
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
5 #include <sys/types.h>
36e6a1ff9608 lunadrv: rd and wr commands added
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
6 #include "types.h"
36e6a1ff9608 lunadrv: rd and wr commands added
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
7 #include "luna.h"
36e6a1ff9608 lunadrv: rd and wr commands added
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
8
36e6a1ff9608 lunadrv: rd and wr commands added
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
9 void
36e6a1ff9608 lunadrv: rd and wr commands added
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
10 cmd_rd(argbulk)
36e6a1ff9608 lunadrv: rd and wr commands added
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
11 char *argbulk;
36e6a1ff9608 lunadrv: rd and wr commands added
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
12 {
36e6a1ff9608 lunadrv: rd and wr commands added
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
13 char *argv[2];
36e6a1ff9608 lunadrv: rd and wr commands added
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
14 u_long regno;
36e6a1ff9608 lunadrv: rd and wr commands added
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
15
36e6a1ff9608 lunadrv: rd and wr commands added
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
16 if (parse_args(argbulk, 1, 1, argv, 0) < 0)
36e6a1ff9608 lunadrv: rd and wr commands added
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
17 return;
36e6a1ff9608 lunadrv: rd and wr commands added
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
18 if (parse_hexarg(argv[0], 4, &regno) < 0) {
36e6a1ff9608 lunadrv: rd and wr commands added
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
19 printf("ERROR: regno argument must be a valid 16-bit hex word\n");
36e6a1ff9608 lunadrv: rd and wr commands added
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
20 return;
36e6a1ff9608 lunadrv: rd and wr commands added
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
21 }
36e6a1ff9608 lunadrv: rd and wr commands added
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
22 LCD_IR = regno;
36e6a1ff9608 lunadrv: rd and wr commands added
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
23 printf("%04X\n", LCD_DR);
36e6a1ff9608 lunadrv: rd and wr commands added
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
24 }
36e6a1ff9608 lunadrv: rd and wr commands added
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
25
36e6a1ff9608 lunadrv: rd and wr commands added
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
26 void
36e6a1ff9608 lunadrv: rd and wr commands added
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
27 cmd_wr(argbulk)
36e6a1ff9608 lunadrv: rd and wr commands added
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
28 char *argbulk;
36e6a1ff9608 lunadrv: rd and wr commands added
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
29 {
36e6a1ff9608 lunadrv: rd and wr commands added
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
30 char *argv[3];
36e6a1ff9608 lunadrv: rd and wr commands added
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
31 u_long regno, value;
36e6a1ff9608 lunadrv: rd and wr commands added
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
32
36e6a1ff9608 lunadrv: rd and wr commands added
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
33 if (parse_args(argbulk, 2, 2, argv, 0) < 0)
36e6a1ff9608 lunadrv: rd and wr commands added
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
34 return;
36e6a1ff9608 lunadrv: rd and wr commands added
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
35 if (parse_hexarg(argv[0], 4, &regno) < 0) {
36e6a1ff9608 lunadrv: rd and wr commands added
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
36 printf("ERROR: regno argument must be a valid 16-bit hex word\n");
36e6a1ff9608 lunadrv: rd and wr commands added
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
37 return;
36e6a1ff9608 lunadrv: rd and wr commands added
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
38 }
36e6a1ff9608 lunadrv: rd and wr commands added
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
39 if (parse_hexarg(argv[1], 4, &value) < 0) {
36e6a1ff9608 lunadrv: rd and wr commands added
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
40 printf("ERROR: value argument must be a valid 16-bit hex word\n");
36e6a1ff9608 lunadrv: rd and wr commands added
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
41 return;
36e6a1ff9608 lunadrv: rd and wr commands added
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
42 }
36e6a1ff9608 lunadrv: rd and wr commands added
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
43 LCD_IR = regno;
36e6a1ff9608 lunadrv: rd and wr commands added
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
44 LCD_DR = value;
36e6a1ff9608 lunadrv: rd and wr commands added
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
45 }