diff options
Diffstat (limited to 'src/core')
-rw-r--r-- | src/core/ao.h | 3 | ||||
-rw-r--r-- | src/core/ao_cmd.c | 31 | ||||
-rw-r--r-- | src/core/ao_task.c | 2 | ||||
-rw-r--r-- | src/core/ao_task.h | 4 |
4 files changed, 34 insertions, 6 deletions
diff --git a/src/core/ao.h b/src/core/ao.h index 977e10b8..548e8738 100644 --- a/src/core/ao.h +++ b/src/core/ao.h @@ -145,6 +145,9 @@ extern __pdata char ao_cmd_lex_c; extern __pdata enum ao_cmd_status ao_cmd_status; void +ao_put_string(__code char *s); + +void ao_cmd_lex(void); void diff --git a/src/core/ao_cmd.c b/src/core/ao_cmd.c index 3d086a57..de5ccc35 100644 --- a/src/core/ao_cmd.c +++ b/src/core/ao_cmd.c @@ -16,6 +16,7 @@ */ #include "ao.h" +#include "ao_task.h" __pdata uint16_t ao_cmd_lex_i; __pdata uint32_t ao_cmd_lex_u32; @@ -28,8 +29,8 @@ static __xdata char cmd_line[CMD_LEN]; static __pdata uint8_t cmd_len; static __pdata uint8_t cmd_i; -static void -put_string(__code char *s) +void +ao_put_string(__code char *s) { char c; while ((c = *s++)) @@ -39,7 +40,7 @@ put_string(__code char *s) static void backspace(void) { - put_string ("\010 \010"); + ao_put_string ("\010 \010"); } static void @@ -47,7 +48,7 @@ readline(void) { char c; if (ao_echo()) - put_string("> "); + ao_put_string("> "); cmd_len = 0; for (;;) { flush(); @@ -262,6 +263,11 @@ ao_reboot(void) ao_panic(AO_PANIC_REBOOT); } +#ifndef HAS_VERSION +#define HAS_VERSION 1 +#endif + +#if HAS_VERSION static void version(void) { @@ -289,6 +295,7 @@ version(void) #endif printf("software-version %s\n", ao_version); } +#endif #ifndef NUM_CMDS #define NUM_CMDS 11 @@ -303,13 +310,21 @@ help(void) __pdata uint8_t cmds; __pdata uint8_t cmd; __code struct ao_cmds * __pdata cs; - const char *h; + __code char *h; + uint8_t e; for (cmds = 0; cmds < ao_ncmds; cmds++) { cs = ao_cmds[cmds]; for (cmd = 0; cs[cmd].func; cmd++) { h = cs[cmd].help; - printf("%-45s %s\n", h, h + 1 + strlen(h)); + ao_put_string(h); + e = strlen(h); + h += e + 1; + e = 45 - e; + while (e--) + putchar(' '); + ao_put_string(h); + putchar('\n'); } } } @@ -374,10 +389,14 @@ __xdata struct ao_task ao_cmd_task; __code struct ao_cmds ao_base_cmds[] = { { help, "?\0Help" }, +#if HAS_TASK_INFO { ao_task_info, "T\0Tasks" }, +#endif { echo, "E <0 off, 1 on>\0Echo" }, { ao_reboot, "r eboot\0Reboot" }, +#if HAS_VERSION { version, "v\0Version" }, +#endif { 0, NULL }, }; diff --git a/src/core/ao_task.c b/src/core/ao_task.c index 9cb074b5..e1d35d67 100644 --- a/src/core/ao_task.c +++ b/src/core/ao_task.c @@ -512,6 +512,7 @@ ao_exit(void) /* we'll never get back here */ } +#if HAS_TASK_INFO void ao_task_info(void) { @@ -528,6 +529,7 @@ ao_task_info(void) ao_task_validate(); #endif } +#endif void ao_start_scheduler(void) diff --git a/src/core/ao_task.h b/src/core/ao_task.h index 50bfb220..1a4b5b6b 100644 --- a/src/core/ao_task.h +++ b/src/core/ao_task.h @@ -21,6 +21,10 @@ #include <ao_list.h> #endif +#ifndef HAS_TASK_INFO +#define HAS_TASK_INFO 1 +#endif + /* An AltOS task */ struct ao_task { __xdata void *wchan; /* current wait channel (NULL if running) */ |