X-Git-Url: https://robinkrens.nl/gitweb/?a=blobdiff_plain;f=term.c;h=7ce25ce6fc8e326704d61f52066abdcafcb72331;hb=23b0b4e65ecb3e9f8b42c057087ad87a1c219f39;hp=51eb9cf38ed0da93e56d5c0d9ad5e9ead747cc19;hpb=094f4defd7ee3b672f9c690f57125893a64901c8;p=cortex-from-scratch diff --git a/term.c b/term.c index 51eb9cf..7ce25ce 100644 --- a/term.c +++ b/term.c @@ -8,6 +8,7 @@ #include #include #include +#include #include @@ -15,14 +16,15 @@ #define BUFSIZE 200 #define MAXARGS 5 #define WHITESPACE "\t\r\n " -#define BUILTINCMDS 3 +#define BUILTINCMDS 4 int help(int, char**); /* * Built in commands * info -- shows basic info of system - * reset -- software reset + * uptime -- uptime; read from the RTC register + * reset -- software reset TODO * show [ADDRESS-ADDRESS] -- shows SRAM range * switchmode -- switch to unprivileged mode * */ @@ -37,11 +39,18 @@ struct cmd { struct cmd builtincmds[4]; -int help(int argc, char ** argsv) { +int info(int argc, char ** argsv) { sysinfo(); return 0; } +int uptime(int arg, char ** argsv) { + //cputs("CURRENT UPTIME: "); + //cputs(regtohex(*RTC_CNTL)); + //cputchar('\n'); + printf("CURRENT UPTIME: %p\n", *RTC_CNTL); +} + int led(int argc, char ** argsv) { @@ -116,8 +125,8 @@ int exec_cmd(char * buf) { void terminal() { - builtincmds[0].name = "help"; - builtincmds[0].function = help; + builtincmds[0].name = "info"; + builtincmds[0].function = info; builtincmds[1].name = "led"; builtincmds[1].function = led; @@ -125,8 +134,12 @@ void terminal() { builtincmds[2].name = "show"; builtincmds[2].function = show; + builtincmds[3].name = "uptime"; + builtincmds[3].function = uptime; + + char *buf; - cputs("WELCOME TO ROBSYS!\n"); + //cputs("WELCOME TO ROBSYS!\n"); while (1) { buf = readline("root# ");