summaryrefslogtreecommitdiff
path: root/util/comm-host.h
diff options
context:
space:
mode:
authorRandall Spangler <rspangler@chromium.org>2014-07-14 16:12:32 -0700
committerchrome-internal-fetch <chrome-internal-fetch@google.com>2014-07-16 07:16:47 +0000
commit241cc626850175acac7a2e95cddbeb269f75c1ba (patch)
tree96f9ae3d712371c976286d574302aa8f78aa59e7 /util/comm-host.h
parent9ef82030e6a005df990f8f2924cf54076cd2e8da (diff)
downloadchrome-ec-241cc626850175acac7a2e95cddbeb269f75c1ba.tar.gz
samus: add options for device passthru and interface
This allows sending host commands to the PD chip through the EC. The --interface option allows forcing a particular host interface. This is necessary at present because the crosec device driver doesn't support host protocol v3 so only has 8-bit command numbers. BUG=chrome-os-partner:30079 BRANCH=none TEST=from EC console, ectool version -> prints EC version ectool --interface=lpc --dev=0 version -> prints EC version ectool --interface=lpc --dev=1 version -> prints PD version ectool --interface=lpc --dev=2 version -> prints error ectool --interface=i2c version -> can't find EC ectool --interface=dev version -> prints EC version Change-Id: I9dd10578dac77e3e104d19e2f37759814eec6ca2 Signed-off-by: Randall Spangler <rspangler@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/207948
Diffstat (limited to 'util/comm-host.h')
-rw-r--r--util/comm-host.h36
1 files changed, 31 insertions, 5 deletions
diff --git a/util/comm-host.h b/util/comm-host.h
index 1e01d58e40..30c6acee67 100644
--- a/util/comm-host.h
+++ b/util/comm-host.h
@@ -25,19 +25,45 @@ extern int ec_max_outsize, ec_max_insize;
extern void *ec_outbuf;
extern void *ec_inbuf;
+/* Interfaces to allow for comm_init() */
+enum comm_interface {
+ COMM_DEV = (1 << 0),
+ COMM_LPC = (1 << 1),
+ COMM_I2C = (1 << 2),
+ COMM_ALL = -1
+};
+
/**
* Perform initializations needed for subsequent requests
*
- * returns 0 in case of success or error code. */
-int comm_init(void);
+ * @param interfaces Interfaces to try; use COMM_ALL to try all of them.
+ * @return 0 in case of success, or error code.
+ */
+int comm_init(int interfaces);
/**
* Send a command to the EC. Returns the length of output data returned (0 if
* none), or negative on error.
*/
-extern int (*ec_command)(int command, int version,
- const void *outdata, int outsize, /* to the EC */
- void *indata, int insize); /* from the EC */
+int ec_command(int command, int version,
+ const void *outdata, int outsize, /* to the EC */
+ void *indata, int insize); /* from the EC */
+
+/**
+ * Set the offset to be applied to the command number when ec_command() calls
+ * ec_command_proto().
+ */
+void set_command_offset(int offset);
+
+/**
+ * Send a command to the EC. Returns the length of output data returned (0 if
+ * none), or negative on error. This is the low-level interface implemented
+ * by the protocol-specific driver. DO NOT call this version directly from
+ * anywhere but ec_command(), or the --device option will not work.
+ */
+extern int (*ec_command_proto)(int command, int version,
+ const void *outdata, int outsize, /* to EC */
+ void *indata, int insize); /* from EC */
/**
* Return the content of the EC information area mapped as "memory".