projects
/
cortex-from-scratch
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
eeprom, cases for n=1, n=2 and n>2
[cortex-from-scratch]
/
term.c
diff --git
a/term.c
b/term.c
index
51eb9cf
..
7ce25ce
100644
(file)
--- a/
term.c
+++ b/
term.c
@@
-8,6
+8,7
@@
#include <lib/stdio.h>
#include <lib/string.h>
#include <lib/regfunc.h>
#include <lib/stdio.h>
#include <lib/string.h>
#include <lib/regfunc.h>
+#include <lib/tinyprintf.h>
#include <drivers/led.h>
#include <drivers/led.h>
@@
-15,14
+16,15
@@
#define BUFSIZE 200
#define MAXARGS 5
#define WHITESPACE "\t\r\n "
#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
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
* */
* show [ADDRESS-ADDRESS] -- shows SRAM range
* switchmode -- switch to unprivileged mode
* */
@@
-37,11
+39,18
@@
struct cmd {
struct cmd builtincmds[4];
struct cmd builtincmds[4];
-int
help
(int argc, char ** argsv) {
+int
info
(int argc, char ** argsv) {
sysinfo();
return 0;
}
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) {
int led(int argc, char ** argsv) {
@@
-116,8
+125,8
@@
int exec_cmd(char * buf) {
void terminal() {
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[1].name = "led";
builtincmds[1].function = led;
@@
-125,8
+134,12
@@
void terminal() {
builtincmds[2].name = "show";
builtincmds[2].function = show;
builtincmds[2].name = "show";
builtincmds[2].function = show;
+ builtincmds[3].name = "uptime";
+ builtincmds[3].function = uptime;
+
+
char *buf;
char *buf;
- cputs("WELCOME TO ROBSYS!\n");
+
//
cputs("WELCOME TO ROBSYS!\n");
while (1) {
buf = readline("root# ");
while (1) {
buf = readline("root# ");