From 4b972a220fc1db416c25bd9507e03f66156ab29f Mon Sep 17 00:00:00 2001 From: Dawid Niedzwiecki Date: Fri, 2 Jul 2021 08:50:22 +0200 Subject: 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 Change-Id: I9ab38c17c66373c3a38f45c8080c8166a2a9d09f Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3001270 Reviewed-by: Keith Short --- include/console.h | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) (limited to 'include') 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 #ifdef CONFIG_ZEPHYR #include "zephyr_console_shim.h" @@ -136,6 +137,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. * -- cgit v1.2.1