FreeCalypso > hg > freecalypso-tools
comparison target-utils/lunadrv/regcmd.c @ 702:36e6a1ff9608
lunadrv: rd and wr commands added
author | Mychaela Falconia <falcon@freecalypso.org> |
---|---|
date | Thu, 07 May 2020 02:40:13 +0000 |
parents | |
children |
comparison
equal
deleted
inserted
replaced
701:39e7b3001946 | 702:36e6a1ff9608 |
---|---|
1 /* | |
2 * Handy commands for reading and writing LCD controller registers. | |
3 */ | |
4 | |
5 #include <sys/types.h> | |
6 #include "types.h" | |
7 #include "luna.h" | |
8 | |
9 void | |
10 cmd_rd(argbulk) | |
11 char *argbulk; | |
12 { | |
13 char *argv[2]; | |
14 u_long regno; | |
15 | |
16 if (parse_args(argbulk, 1, 1, argv, 0) < 0) | |
17 return; | |
18 if (parse_hexarg(argv[0], 4, ®no) < 0) { | |
19 printf("ERROR: regno argument must be a valid 16-bit hex word\n"); | |
20 return; | |
21 } | |
22 LCD_IR = regno; | |
23 printf("%04X\n", LCD_DR); | |
24 } | |
25 | |
26 void | |
27 cmd_wr(argbulk) | |
28 char *argbulk; | |
29 { | |
30 char *argv[3]; | |
31 u_long regno, value; | |
32 | |
33 if (parse_args(argbulk, 2, 2, argv, 0) < 0) | |
34 return; | |
35 if (parse_hexarg(argv[0], 4, ®no) < 0) { | |
36 printf("ERROR: regno argument must be a valid 16-bit hex word\n"); | |
37 return; | |
38 } | |
39 if (parse_hexarg(argv[1], 4, &value) < 0) { | |
40 printf("ERROR: value argument must be a valid 16-bit hex word\n"); | |
41 return; | |
42 } | |
43 LCD_IR = regno; | |
44 LCD_DR = value; | |
45 } |