summaryrefslogtreecommitdiff
path: root/util/comm-host.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/comm-host.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/comm-host.h')
-rw-r--r--util/comm-host.h27
1 files changed, 12 insertions, 15 deletions
diff --git a/util/comm-host.h b/util/comm-host.h
index a16057abf5..d890156af0 100644
--- a/util/comm-host.h
+++ b/util/comm-host.h
@@ -1,6 +1,9 @@
-/* Copyright (c) 2012 The Chromium OS Authors. All rights reserved.
+/* 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.
+ *
+ * For hysterical raisins, there are several mechanisms for communicating with
+ * the EC. This abstracts them.
*/
#ifndef COMM_HOST_H
@@ -16,24 +19,18 @@ int comm_init(void);
/*
* Send a command to the EC. Returns the length of output data returned (0 if
- * none), or a negative number if error; errors are -EC_RES_* constants from
- * ec_commands.h.
+ * none), or negative on error.
*/
-int ec_command(int command, int version, const void *indata, int insize,
- void *outdata, int outsize);
+extern int (*ec_command)(int command, int version,
+ const void *outdata, int outsize, /* to the EC */
+ void *indata, int insize); /* from the EC */
/*
* Return the content of the EC information area mapped as "memory".
- * The offsets are defined by the EC_MEMMAP_ constants.
- */
-uint8_t read_mapped_mem8(uint8_t offset);
-uint16_t read_mapped_mem16(uint8_t offset);
-uint32_t read_mapped_mem32(uint8_t offset);
-/*
- * Read a memory-mapped string at the specified offset and store into buf,
- * which must be at least size EC_MEMMAP_TEXT_MAX. Returns the length of
- * the copied string, not counting the terminating '\0', or <0 if error.
+ * The offsets are defined by the EC_MEMMAP_ constants. Returns the number
+ * of bytes read, or negative on error. Specifying bytes=0 will read a
+ * string (always including the trailing '\0').
*/
-int read_mapped_string(uint8_t offset, char *buf);
+extern int (*ec_readmem)(int offset, int bytes, void *dest);
#endif /* COMM_HOST_H */