summaryrefslogtreecommitdiff
path: root/include/console.h
diff options
context:
space:
mode:
authorDawid Niedzwiecki <dn@semihalf.com>2021-07-02 08:50:22 +0200
committerCommit Bot <commit-bot@chromium.org>2021-07-08 13:22:54 +0000
commit4b972a220fc1db416c25bd9507e03f66156ab29f (patch)
tree5cf52060fb446cc0011d01cebdfa2dc28e763403 /include/console.h
parente32d244db05fc5fb4f2d3643418282c668d6fd45 (diff)
downloadchrome-ec-4b972a220fc1db416c25bd9507e03f66156ab29f.tar.gz
console: use functions to check console channels
Create a function to check if a console channel is disabled. It allows checking a channel outside the console_output.c, which is needed in Zephyr. BUG=b:191724484 BRANCH=none TEST=Check if console channels works Signed-off-by: Dawid Niedzwiecki <dn@semihalf.com> Change-Id: I9ab38c17c66373c3a38f45c8080c8166a2a9d09f Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3001270 Reviewed-by: Keith Short <keithshort@chromium.org>
Diffstat (limited to 'include/console.h')
-rw-r--r--include/console.h17
1 files changed, 17 insertions, 0 deletions
diff --git a/include/console.h b/include/console.h
index 91800103b6..5bb1f2541f 100644
--- a/include/console.h
+++ b/include/console.h
@@ -10,6 +10,7 @@
#include "common.h"
#include "config.h"
+#include <stdbool.h>
#ifdef CONFIG_ZEPHYR
#include "zephyr_console_shim.h"
@@ -137,6 +138,22 @@ void console_channel_enable(const char *name);
void console_channel_disable(const char *name);
/**
+ * Check if channel is disabled.
+ *
+ * @param channel Output channel
+ *
+ * @return true if channel is disabled, false if not.
+ */
+#ifdef CONFIG_CONSOLE_CHANNEL
+bool console_channel_is_disabled(enum console_channel channel);
+#else
+static inline bool console_channel_is_disabled(enum console_channel channel)
+{
+ return false;
+}
+#endif
+
+/**
* Put a string to the console channel.
*
* @param channel Output chanel