summaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
Diffstat (limited to 'include')
-rw-r--r--include/common.h11
-rw-r--r--include/console.h25
2 files changed, 31 insertions, 5 deletions
diff --git a/include/common.h b/include/common.h
index 291b950e48..91a1a126a1 100644
--- a/include/common.h
+++ b/include/common.h
@@ -35,6 +35,17 @@ enum ec_error_list {
EC_ERROR_INVAL = 5,
/* Already in use */
EC_ERROR_BUSY = 6,
+ /* Invalid console command param (PARAMn means parameter n is bad) */
+ EC_ERROR_PARAM1 = 11,
+ EC_ERROR_PARAM2 = 12,
+ EC_ERROR_PARAM3 = 13,
+ EC_ERROR_PARAM4 = 14,
+ EC_ERROR_PARAM5 = 15,
+ EC_ERROR_PARAM6 = 16,
+ EC_ERROR_PARAM7 = 17,
+ EC_ERROR_PARAM8 = 18,
+ EC_ERROR_PARAM9 = 19,
+ EC_ERROR_PARAM_COUNT = 20, /* Wrong number of params */
/* Module-internal error codes may use this range. */
EC_ERROR_INTERNAL_FIRST = 0x10000,
diff --git a/include/console.h b/include/console.h
index 4a655387da..3ad4150fe4 100644
--- a/include/console.h
+++ b/include/console.h
@@ -8,6 +8,7 @@
#ifndef __CROS_EC_CONSOLE_H
#define __CROS_EC_CONSOLE_H
+#include "board.h"
#include "common.h"
/* Console command; used by DECLARE_CONSOLE_COMMAND macro. */
@@ -16,6 +17,12 @@ struct console_command {
const char *name;
/* Handler for the command. argv[0] will be the command name. */
int (*handler)(int argc, char **argv);
+#ifdef CONFIG_CONSOLE_CMDHELP
+ /* Description of args */
+ const char *argdesc;
+ /* Short help for command */
+ const char *shorthelp;
+#endif
};
@@ -80,10 +87,18 @@ void console_has_input(void);
* Register a console command handler. Note that `name' must never be a
* beginning of another existing command name.
*/
-#define DECLARE_CONSOLE_COMMAND(name, routine) \
- static const char __con_cmd_label_##name[] = #name; \
- const struct console_command __con_cmd_##name \
- __attribute__((section(".rodata.cmds." #name))) \
- = {__con_cmd_label_##name, routine}
+#ifdef CONFIG_CONSOLE_CMDHELP
+#define DECLARE_CONSOLE_COMMAND(name, routine, argdesc, shorthelp, longhelp) \
+ static const char __con_cmd_label_##name[] = #name; \
+ const struct console_command __con_cmd_##name \
+ __attribute__((section(".rodata.cmds." #name))) \
+ = {__con_cmd_label_##name, routine, argdesc, shorthelp}
+#else
+#define DECLARE_CONSOLE_COMMAND(name, routine, argdesc, shorthelp, longhelp) \
+ static const char __con_cmd_label_##name[] = #name; \
+ const struct console_command __con_cmd_##name \
+ __attribute__((section(".rodata.cmds." #name))) \
+ = {__con_cmd_label_##name, routine}
+#endif
#endif /* __CROS_EC_CONSOLE_H */