summaryrefslogtreecommitdiff
path: root/zephyr/shim/include/zephyr_host_command.h
diff options
context:
space:
mode:
authorFabio Baltieri <fabiobaltieri@google.com>2022-04-14 13:12:36 +0000
committerChromeos LUCI <chromeos-scoped@luci-project-accounts.iam.gserviceaccount.com>2022-04-21 20:24:54 +0000
commit33be9c52c6910c4805fb1ef67b4e1d23e81471fd (patch)
treea2f7b9cb37e2e06df48df9d46193386cd6f9759c /zephyr/shim/include/zephyr_host_command.h
parent2fae2c312151cfb33d9a243efe12570e9b69960f (diff)
downloadchrome-ec-33be9c52c6910c4805fb1ef67b4e1d23e81471fd.tar.gz
zephyr: tasks: run HOSTCMD in main thread
Add an option to run the host command loop in the main thread, taking over the entire thread and reusing its thread support code and stack. This is still optional and automatically disabled on tests as test code actually needs main() to run the test code itself. The code ensures that the main thread is switched to the correct priority for the HOSTCMD code and changes the thread name as well. BRANCH=none BUG=b:223044986 TEST=zmake testall TEST=build and run on brya Signed-off-by: Fabio Baltieri <fabiobaltieri@google.com> Change-Id: Ib2b3ba3d8a6fb883876ecdd432068ca3300e5344 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3593779 Reviewed-by: Jack Rosenthal <jrosenth@chromium.org> Reviewed-by: Keith Short <keithshort@chromium.org>
Diffstat (limited to 'zephyr/shim/include/zephyr_host_command.h')
-rw-r--r--zephyr/shim/include/zephyr_host_command.h10
1 files changed, 10 insertions, 0 deletions
diff --git a/zephyr/shim/include/zephyr_host_command.h b/zephyr/shim/include/zephyr_host_command.h
index 138c8636c7..1f07ac34d2 100644
--- a/zephyr/shim/include/zephyr_host_command.h
+++ b/zephyr/shim/include/zephyr_host_command.h
@@ -11,6 +11,16 @@
#define __CROS_EC_ZEPHYR_HOST_COMMAND_H
#include <init.h>
+#include <stdbool.h>
+
+/* Initializes and runs the host command handler loop. */
+void host_command_task(void *u);
+
+/* Takes over the main thread and runs the host command loop. */
+void host_command_main(void);
+
+/* True if running in the main thread. */
+bool in_host_command_main(void);
#ifdef CONFIG_PLATFORM_EC_HOSTCMD