summaryrefslogtreecommitdiff
path: root/include/host_command.h
diff options
context:
space:
mode:
authorRandall Spangler <rspangler@chromium.org>2012-02-28 13:44:03 -0800
committerRandall Spangler <rspangler@chromium.org>2012-02-28 13:58:34 -0800
commit4c89ccd89eea60092118e49ca6b68a04d21d8870 (patch)
tree19cbd88927df9b8839bd11a6d760ebae20241476 /include/host_command.h
parente632029ed045e2b4922e3131898b0137d3a79972 (diff)
downloadchrome-ec-4c89ccd89eea60092118e49ca6b68a04d21d8870.tar.gz
Register host commands the same clever way we do console commands
BUG=none TEST=run assorted ectool commands Change-Id: I830d3cbf2d1557b3ab455ec8736d3de5e5d3e697
Diffstat (limited to 'include/host_command.h')
-rw-r--r--include/host_command.h18
1 files changed, 17 insertions, 1 deletions
diff --git a/include/host_command.h b/include/host_command.h
index 9c2dda2a69..c00df1a93d 100644
--- a/include/host_command.h
+++ b/include/host_command.h
@@ -1,4 +1,4 @@
-/* Copyright (c) 2011 The Chromium OS Authors. All rights reserved.
+/* Copyright (c) 2012 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.
*/
@@ -9,9 +9,25 @@
#define __CROS_EC_HOST_COMMAND_H
#include "common.h"
+#include "lpc_commands.h"
+
+/* Host command */
+struct host_command {
+ /* Command code. */
+ int command;
+ /* Handler for the command; data points to parameters/response. */
+ enum lpc_status (*handler)(uint8_t *data);
+};
+
/* Called by LPC module when a command is written to one of the
command slots (0=kernel, 1=user). */
void host_command_received(int slot, int command);
+/* Register a host command handler */
+#define DECLARE_HOST_COMMAND(command, routine) \
+ const struct host_command __host_cmd_##command \
+ __attribute__((section(".rodata.hcmds"))) \
+ = {command, routine}
+
#endif /* __CROS_EC_HOST_COMMAND_H */