summaryrefslogtreecommitdiff
path: root/util/cros_ec_dev.h
diff options
context:
space:
mode:
authorBill Richardson <wfrichar@chromium.org>2013-05-29 18:00:03 -0700
committerChromeBot <chrome-bot@google.com>2013-06-05 14:12:23 -0700
commitd0d1564434ae991ac99a6ce54f6f3360f47017a8 (patch)
tree68ce6707147fbf828fef543222fcde756da1acf2 /util/cros_ec_dev.h
parent26475135b551a742f2d148d426c4aa18b338f5ca (diff)
downloadchrome-ec-d0d1564434ae991ac99a6ce54f6f3360f47017a8.tar.gz
ectool prefers /dev/cros_ec, then falls back to i2c, lpc
This is preparation for the common userspace EC interface. If/when that appears, this will be ready. BUG=chromium:239197 BRANCH=all TEST=manual Build, install, run it. Shouldn't be any change. Change-Id: I9fa78515ec5443ba659f10a66bbaadcb7f4802b0 Signed-off-by: Bill Richardson <wfrichar@chromium.org> Reviewed-on: https://gerrit.chromium.org/gerrit/56131
Diffstat (limited to 'util/cros_ec_dev.h')
-rw-r--r--util/cros_ec_dev.h53
1 files changed, 53 insertions, 0 deletions
diff --git a/util/cros_ec_dev.h b/util/cros_ec_dev.h
new file mode 100644
index 0000000000..f56c3ef67f
--- /dev/null
+++ b/util/cros_ec_dev.h
@@ -0,0 +1,53 @@
+/* Copyright (c) 2013 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.
+ */
+
+#ifndef _CROS_EC_DEV_H_
+#define _CROS_EC_DEV_H_
+
+#include <linux/ioctl.h>
+#include <linux/types.h>
+
+#define CROS_EC_DEV_NAME "cros_ec"
+#define CROS_EC_DEV_VERSION "1.0.0"
+
+
+/*
+ * @version: Command version number (often 0)
+ * @command: Command to send (EC_CMD_...)
+ * @outdata: Outgoing data to EC
+ * @outsize: Outgoing length in bytes
+ * @indata: Where to put the incoming data from EC
+ * @insize: Incoming length in bytes (filled in by EC)
+ * @result: EC's response to the command (separate from communication failure)
+ * ioctl returns zero on success, negative on error
+ */
+struct cros_ec_command {
+ uint32_t version;
+ uint32_t command;
+ uint8_t *outdata;
+ uint32_t outsize;
+ uint8_t *indata;
+ uint32_t insize;
+ uint32_t result;
+};
+
+/*
+ * @offset: within EC_LPC_ADDR_MEMMAP region
+ * @bytes: number of bytes to read. zero means "read a string" (including '\0')
+ * (at most only EC_MEMMAP_SIZE bytes can be read)
+ * @buffer: where to store the result
+ * ioctl returns the number of bytes read, negative on error
+ */
+struct cros_ec_readmem {
+ uint32_t offset;
+ uint32_t bytes;
+ char *buffer;
+};
+
+#define CROS_EC_DEV_IOC ':'
+#define CROS_EC_DEV_IOCXCMD _IOWR(':', 0, struct cros_ec_command)
+#define CROS_EC_DEV_IOCRDMEM _IOWR(':', 1, struct cros_ec_readmem)
+
+#endif /* _CROS_EC_DEV_H_ */