#include <lib/stdio.h>
#include <lib/string.h>
#include <lib/regfunc.h>
+#include <lib/tinyprintf.h>
#include <drivers/led.h>
#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
* */
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) {
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;
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# ");