summaryrefslogtreecommitdiff
path: root/include/console.h
diff options
context:
space:
mode:
authorJack Rosenthal <jrosenth@chromium.org>2020-09-23 08:26:42 -0600
committerCommit Bot <commit-bot@chromium.org>2020-10-01 19:14:34 +0000
commitee4037ea734103169bd1cae24ab3b6a5e2e71f67 (patch)
tree9d5cee6b4d01b099e38822443bef181990cf81ce /include/console.h
parent1434fa7a1d5fed910c86f479aab75fee6521bb5d (diff)
downloadchrome-ec-ee4037ea734103169bd1cae24ab3b6a5e2e71f67.tar.gz
zephyr: shim in the zephyr shell as the EC console
This provides compatible macros for DECLARE_CONSOLE_COMMAND, DECLARE_SAFE_CONSOLE_COMMAND, and DECLARE_CONSOLE_COMMAND_FLAGS. Note: the concept of command flags and command restriction are not enabled currently for Zephyr. We simply define everything for now. These macros use the Zephyr shell subsystem as the backend for commands. In addition, cprints, cprintf, and cputs have been redirected to the shell for CC_CONSOLE channel outputs, and printk for all other outputs. We will look at using Zephyr's logging subsystem instead of printk for the other channels in the future. BUG=b:167590251 BRANCH=none TEST=run "gettime" and "timerinfo" commands with follow-up CLs Signed-off-by: Jack Rosenthal <jrosenth@chromium.org> Change-Id: I17caedcd0b84a21dd2b135312f683885eaf694af Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2427097 Reviewed-by: Jett Rink <jettrink@chromium.org>
Diffstat (limited to 'include/console.h')
-rw-r--r--include/console.h8
1 files changed, 6 insertions, 2 deletions
diff --git a/include/console.h b/include/console.h
index 178309812c..2c8503f0ee 100644
--- a/include/console.h
+++ b/include/console.h
@@ -11,6 +11,10 @@
#include "common.h"
#include "config.h"
+#ifdef CONFIG_ZEPHYR
+#include "zephyr_console_shim.h"
+#endif
+
/*
* The EC code base has been using %h to print a hex buffer. Encode the
* parameters to do that in a pointer to a structure that's passed as the
@@ -164,14 +168,14 @@ void console_has_input(void);
* @param help String with one-line description of command, or NULL.
* @param flags Per-command flags, if needed.
*/
-#ifndef HAS_TASK_CONSOLE
+#if !defined(HAS_TASK_CONSOLE) && !defined(CONFIG_ZEPHYR)
#define DECLARE_CONSOLE_COMMAND(NAME, ROUTINE, ARGDESC, HELP) \
int (ROUTINE)(int argc, char **argv) __attribute__((unused))
#define DECLARE_SAFE_CONSOLE_COMMAND(NAME, ROUTINE, ARGDESC, HELP) \
int (ROUTINE)(int argc, char **argv) __attribute__((unused))
#define DECLARE_CONSOLE_COMMAND_FLAGS(NAME, ROUTINE, ARGDESC, HELP, FLAGS) \
int (ROUTINE)(int argc, char **argv) __attribute__((unused))
-#else
+#elif defined(HAS_TASK_CONSOLE)
/* We always provde help args, but we may discard them to save space. */
#if defined(CONFIG_CONSOLE_CMDHELP)