00001
00007
00008
00009 #include <kernel.h>
00010 #include <gpio.h>
00011 #include <stdio.h>
00012 #include <string.h>
00013
00023 command xsh_reset(ushort stdin, ushort stdout, ushort stderr,
00024 ushort nargs, char *args[])
00025 {
00026 struct gpio_csreg *pgcsr;
00027
00028
00029 if (nargs == 2 && strncmp(args[1],"--help",6) == 0)
00030 {
00031 fprintf(stdout, "Usage: reset\n");
00032 fprintf(stdout, "Performs a soft reset of the router.\n");
00033 fprintf(stdout, "\t--help\t display this help and exit\n");
00034 return SYSERR;
00035 }
00036
00037
00038 if (nargs > 1)
00039 {
00040 fprintf(stderr, "reset: too many arguments\n");
00041 fprintf(stderr, "Try 'reset --help' for more information\n");
00042 return SYSERR;
00043 }
00044
00045
00046 pgcsr = (struct gpio_csreg *)GPIO_BASE;
00047
00048
00049 pgcsr->input |= GPIO_BUT_RESET;
00050
00051 return OK;
00052 }