annotate target-utils/flash-boot-test/watchdog.c @ 752:c79aaed75bd8

compile-fc-batt: allow possible third field in source lines Battery tables maintained in the fc-battery-conf repository will now have a third field added, defining thresholds for the battery bars icon, and there will be a new utility to compile them into the new /etc/batterytab2 file read by the FC Tourmaline version of our FCHG driver. For backward compatibility with the original Magnetite version of FCHG, compile-fc-batt remains the tool for compiling the original /etc/batterytab file format, and it needs to ignore the newly added third field in battery table sources.
author Mychaela Falconia <falcon@freecalypso.org>
date Thu, 05 Nov 2020 20:37:55 +0000
parents 3d7b546c710c
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
490
3d7b546c710c target-utils/flash-boot-test: more watchdog experimentation commands
Mychaela Falconia <falcon@freecalypso.org>
parents: 488
diff changeset
1 #include <sys/types.h>
488
cd900b885eb2 target-utils/flash-boot-test: added wd (watchdog disable) command
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
2 #include "types.h"
cd900b885eb2 target-utils/flash-boot-test: added wd (watchdog disable) command
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
3
cd900b885eb2 target-utils/flash-boot-test: added wd (watchdog disable) command
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
4 void
490
3d7b546c710c target-utils/flash-boot-test: more watchdog experimentation commands
Mychaela Falconia <falcon@freecalypso.org>
parents: 488
diff changeset
5 cmd_wd()
488
cd900b885eb2 target-utils/flash-boot-test: added wd (watchdog disable) command
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
6 {
cd900b885eb2 target-utils/flash-boot-test: added wd (watchdog disable) command
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
7 /* stop/disable the watchdog timer */
cd900b885eb2 target-utils/flash-boot-test: added wd (watchdog disable) command
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
8 *(volatile u16 *)0xFFFFF804 = 0xF5;
cd900b885eb2 target-utils/flash-boot-test: added wd (watchdog disable) command
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
9 *(volatile u16 *)0xFFFFF804 = 0xA0;
cd900b885eb2 target-utils/flash-boot-test: added wd (watchdog disable) command
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
10 }
490
3d7b546c710c target-utils/flash-boot-test: more watchdog experimentation commands
Mychaela Falconia <falcon@freecalypso.org>
parents: 488
diff changeset
11
3d7b546c710c target-utils/flash-boot-test: more watchdog experimentation commands
Mychaela Falconia <falcon@freecalypso.org>
parents: 488
diff changeset
12 void
3d7b546c710c target-utils/flash-boot-test: more watchdog experimentation commands
Mychaela Falconia <falcon@freecalypso.org>
parents: 488
diff changeset
13 cmd_we()
3d7b546c710c target-utils/flash-boot-test: more watchdog experimentation commands
Mychaela Falconia <falcon@freecalypso.org>
parents: 488
diff changeset
14 {
3d7b546c710c target-utils/flash-boot-test: more watchdog experimentation commands
Mychaela Falconia <falcon@freecalypso.org>
parents: 488
diff changeset
15 /* watchdog enable */
3d7b546c710c target-utils/flash-boot-test: more watchdog experimentation commands
Mychaela Falconia <falcon@freecalypso.org>
parents: 488
diff changeset
16 *(volatile u16 *)0xFFFFF804 = 0x8000;
3d7b546c710c target-utils/flash-boot-test: more watchdog experimentation commands
Mychaela Falconia <falcon@freecalypso.org>
parents: 488
diff changeset
17 }
3d7b546c710c target-utils/flash-boot-test: more watchdog experimentation commands
Mychaela Falconia <falcon@freecalypso.org>
parents: 488
diff changeset
18
3d7b546c710c target-utils/flash-boot-test: more watchdog experimentation commands
Mychaela Falconia <falcon@freecalypso.org>
parents: 488
diff changeset
19 void
3d7b546c710c target-utils/flash-boot-test: more watchdog experimentation commands
Mychaela Falconia <falcon@freecalypso.org>
parents: 488
diff changeset
20 cmd_wr()
3d7b546c710c target-utils/flash-boot-test: more watchdog experimentation commands
Mychaela Falconia <falcon@freecalypso.org>
parents: 488
diff changeset
21 {
3d7b546c710c target-utils/flash-boot-test: more watchdog experimentation commands
Mychaela Falconia <falcon@freecalypso.org>
parents: 488
diff changeset
22 /* read and display watchdog downcount register */
3d7b546c710c target-utils/flash-boot-test: more watchdog experimentation commands
Mychaela Falconia <falcon@freecalypso.org>
parents: 488
diff changeset
23 printf("%04X\n", *(volatile u16 *)0xFFFFF802);
3d7b546c710c target-utils/flash-boot-test: more watchdog experimentation commands
Mychaela Falconia <falcon@freecalypso.org>
parents: 488
diff changeset
24 }
3d7b546c710c target-utils/flash-boot-test: more watchdog experimentation commands
Mychaela Falconia <falcon@freecalypso.org>
parents: 488
diff changeset
25
3d7b546c710c target-utils/flash-boot-test: more watchdog experimentation commands
Mychaela Falconia <falcon@freecalypso.org>
parents: 488
diff changeset
26 void
3d7b546c710c target-utils/flash-boot-test: more watchdog experimentation commands
Mychaela Falconia <falcon@freecalypso.org>
parents: 488
diff changeset
27 cmd_ww(argbulk)
3d7b546c710c target-utils/flash-boot-test: more watchdog experimentation commands
Mychaela Falconia <falcon@freecalypso.org>
parents: 488
diff changeset
28 char *argbulk;
3d7b546c710c target-utils/flash-boot-test: more watchdog experimentation commands
Mychaela Falconia <falcon@freecalypso.org>
parents: 488
diff changeset
29 {
3d7b546c710c target-utils/flash-boot-test: more watchdog experimentation commands
Mychaela Falconia <falcon@freecalypso.org>
parents: 488
diff changeset
30 /* single or double write to WATCHDOG_TIM_MODE */
3d7b546c710c target-utils/flash-boot-test: more watchdog experimentation commands
Mychaela Falconia <falcon@freecalypso.org>
parents: 488
diff changeset
31 char *argv[3];
3d7b546c710c target-utils/flash-boot-test: more watchdog experimentation commands
Mychaela Falconia <falcon@freecalypso.org>
parents: 488
diff changeset
32 u_long w1, w2;
3d7b546c710c target-utils/flash-boot-test: more watchdog experimentation commands
Mychaela Falconia <falcon@freecalypso.org>
parents: 488
diff changeset
33
3d7b546c710c target-utils/flash-boot-test: more watchdog experimentation commands
Mychaela Falconia <falcon@freecalypso.org>
parents: 488
diff changeset
34 if (parse_args(argbulk, 1, 2, argv, 0) < 0)
3d7b546c710c target-utils/flash-boot-test: more watchdog experimentation commands
Mychaela Falconia <falcon@freecalypso.org>
parents: 488
diff changeset
35 return;
3d7b546c710c target-utils/flash-boot-test: more watchdog experimentation commands
Mychaela Falconia <falcon@freecalypso.org>
parents: 488
diff changeset
36 if (parse_hexarg(argv[0], 4, &w1) < 0) {
3d7b546c710c target-utils/flash-boot-test: more watchdog experimentation commands
Mychaela Falconia <falcon@freecalypso.org>
parents: 488
diff changeset
37 printf("ERROR: arg1 must be a valid 16-bit hex value\n");
3d7b546c710c target-utils/flash-boot-test: more watchdog experimentation commands
Mychaela Falconia <falcon@freecalypso.org>
parents: 488
diff changeset
38 return;
3d7b546c710c target-utils/flash-boot-test: more watchdog experimentation commands
Mychaela Falconia <falcon@freecalypso.org>
parents: 488
diff changeset
39 }
3d7b546c710c target-utils/flash-boot-test: more watchdog experimentation commands
Mychaela Falconia <falcon@freecalypso.org>
parents: 488
diff changeset
40 if (argv[1] && parse_hexarg(argv[1], 4, &w2) < 0) {
3d7b546c710c target-utils/flash-boot-test: more watchdog experimentation commands
Mychaela Falconia <falcon@freecalypso.org>
parents: 488
diff changeset
41 printf("ERROR: arg2 must be a valid 16-bit hex value\n");
3d7b546c710c target-utils/flash-boot-test: more watchdog experimentation commands
Mychaela Falconia <falcon@freecalypso.org>
parents: 488
diff changeset
42 return;
3d7b546c710c target-utils/flash-boot-test: more watchdog experimentation commands
Mychaela Falconia <falcon@freecalypso.org>
parents: 488
diff changeset
43 }
3d7b546c710c target-utils/flash-boot-test: more watchdog experimentation commands
Mychaela Falconia <falcon@freecalypso.org>
parents: 488
diff changeset
44 /* do it */
3d7b546c710c target-utils/flash-boot-test: more watchdog experimentation commands
Mychaela Falconia <falcon@freecalypso.org>
parents: 488
diff changeset
45 *(volatile u16 *)0xFFFFF804 = w1;
3d7b546c710c target-utils/flash-boot-test: more watchdog experimentation commands
Mychaela Falconia <falcon@freecalypso.org>
parents: 488
diff changeset
46 if (argv[1])
3d7b546c710c target-utils/flash-boot-test: more watchdog experimentation commands
Mychaela Falconia <falcon@freecalypso.org>
parents: 488
diff changeset
47 *(volatile u16 *)0xFFFFF804 = w2;
3d7b546c710c target-utils/flash-boot-test: more watchdog experimentation commands
Mychaela Falconia <falcon@freecalypso.org>
parents: 488
diff changeset
48 }