diff options
author | Keith Packard <keithp@keithp.com> | 2009-11-05 21:45:00 -0800 |
---|---|---|
committer | Keith Packard <keithp@keithp.com> | 2009-11-05 21:45:00 -0800 |
commit | 83afdbdc154fe013bfe35ce5ecf1d61570b04ed6 (patch) | |
tree | 375508051764dff1195a4f0ef091840f761418cf /src/ao_cmd.c | |
parent | 0358988ac0ee25a564d48af79b1c3fb0c0fe0a88 (diff) |
Add reboot command.
This resets the processor using the watchdog timer.
Signed-off-by: Keith Packard <keithp@keithp.com>
Diffstat (limited to 'src/ao_cmd.c')
-rw-r--r-- | src/ao_cmd.c | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/src/ao_cmd.c b/src/ao_cmd.c index 81a52708..58039f3a 100644 --- a/src/ao_cmd.c +++ b/src/ao_cmd.c @@ -200,6 +200,17 @@ echo(void) } static void +ao_reboot(void) +{ + ao_cmd_white(); + if (!ao_match_word("eboot")) + return; + WDCTL = WDCTL_EN | WDCTL_MODE_WATCHDOG | WDCTL_INT_64; + ao_sleep(AO_SEC_TO_TICKS(2)); + ao_panic(AO_PANIC_REBOOT); +} + +static void version(void) { printf("manufacturer %s\n", ao_manufacturer); @@ -292,6 +303,7 @@ __code struct ao_cmds ao_base_cmds[] = { { '?', help, "? Print this message" }, { 'T', ao_task_info, "T Show task states" }, { 'E', echo, "E <0 off, 1 on> Set command echo mode" }, + { 'r', ao_reboot, "r eboot Reboot" }, { 'v', version, "v Show version" }, { 0, help, NULL }, }; |