summaryrefslogtreecommitdiff
path: root/zephyr/shim/src/host_command.c
diff options
context:
space:
mode:
authorWealian Liao <whliao@nuvoton.corp-partner.google.com>2020-12-18 13:05:11 +0800
committerCommit Bot <commit-bot@chromium.org>2021-01-19 20:50:51 +0000
commitd64d5ca86d1fd6274011146e33597ef01bf551b1 (patch)
tree232fe457ea9237fb0f2c6cddf5db70d81015d22e /zephyr/shim/src/host_command.c
parent409116ad8d07b5607e2643350d42b2e5f239d2d0 (diff)
downloadchrome-ec-d64d5ca86d1fd6274011146e33597ef01bf551b1.tar.gz
zephyr: Shim the DECLARE_HOST_COMMAND
Shim the DECLARE_HOST_COMMAND so that host commands can be declared and found. BUG=b:177065174, b:172678200 BRANCH=none TEST=build & boot EC for Volteer 0x0d & 0xa4 don't have error message. 21-01-11 16:42:09.226 [1.528500 HC 0x0d] 21-01-11 16:42:09.227 [1.532100 HC 0xa4] Signed-off-by: Wealian Liao <whliao@nuvoton.corp-partner.google.com> Signed-off-by: Simon Glass <sjg@chromium.org> Change-Id: Ief3b5768715dcc164bcb25ae0d1c8de749514f92 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2620729 Reviewed-by: Jack Rosenthal <jrosenth@chromium.org> Commit-Queue: Jack Rosenthal <jrosenth@chromium.org> Tested-by: Jack Rosenthal <jrosenth@chromium.org>
Diffstat (limited to 'zephyr/shim/src/host_command.c')
-rw-r--r--zephyr/shim/src/host_command.c37
1 files changed, 37 insertions, 0 deletions
diff --git a/zephyr/shim/src/host_command.c b/zephyr/shim/src/host_command.c
new file mode 100644
index 0000000000..6d586f225a
--- /dev/null
+++ b/zephyr/shim/src/host_command.c
@@ -0,0 +1,37 @@
+/* Copyright 2021 The Chromium OS Authors. All rights reserved.
+ * Use of this source code is governed by a BSD-style license that can be
+ * found in the LICENSE file.
+ */
+
+#include "host_command.h"
+
+static struct zshim_host_command_node *host_command_head;
+
+void zshim_setup_host_command(
+ int command,
+ enum ec_status (*routine)(struct host_cmd_handler_args *args),
+ int version_mask, struct zshim_host_command_node *entry)
+{
+ struct zshim_host_command_node **loc = &host_command_head;
+
+ /* Setup the entry */
+ entry->cmd->handler = routine;
+ entry->cmd->command = command;
+ entry->cmd->version_mask = version_mask;
+ entry->next = *loc;
+
+ /* Insert the entry */
+ *loc = entry;
+}
+
+struct host_command *zephyr_find_host_command(int command)
+{
+ struct zshim_host_command_node *p;
+
+ for (p = host_command_head; p != NULL; p = p->next) {
+ if (p->cmd->command == command)
+ return p->cmd;
+ }
+
+ return NULL;
+}