summaryrefslogtreecommitdiff
path: root/util/comm-host.h
diff options
context:
space:
mode:
authorRandall Spangler <rspangler@chromium.org>2013-06-27 14:42:39 -0700
committerChromeBot <chrome-bot@google.com>2013-07-01 16:14:15 -0700
commit2730daa5679bc0d2a048a60055a7dc89d060076e (patch)
tree8b8326fb10cf694ab551d955bd8c1bcb8ecff1cc /util/comm-host.h
parent267dbb74d28e4d5d13e892488563ab439398513d (diff)
downloadchrome-ec-2730daa5679bc0d2a048a60055a7dc89d060076e.tar.gz
Comm interface now provides max I/O sizes and preallocated buffers
The maximum packet / param size differs depending on interface and protocol version. Commands can now ask the comm interface what the limits are, and can use preallocated buffers to avoid needless malloc/free. BUG=chrome-os-partner:20571 BRANCH=none TEST=the following all work on link burn_my_ec ectool version ectool chargedump ectool console ectool i2cxfer 5 0x41 2 Change-Id: Ib847994da3f79721e7fb4e347231b9147a3f485f Signed-off-by: Randall Spangler <rspangler@chromium.org> Reviewed-on: https://gerrit.chromium.org/gerrit/60275
Diffstat (limited to 'util/comm-host.h')
-rw-r--r--util/comm-host.h17
1 files changed, 14 insertions, 3 deletions
diff --git a/util/comm-host.h b/util/comm-host.h
index d890156af0..695fc33c4f 100644
--- a/util/comm-host.h
+++ b/util/comm-host.h
@@ -12,12 +12,23 @@
#include "common.h"
#include "ec_commands.h"
-/* Perform initializations needed for subsequent requests
+/* Maximum output and input sizes for EC command, in bytes */
+extern int ec_max_outsize, ec_max_insize;
+
+/*
+ * Maximum-size output and input buffers, for use by callers. This saves each
+ * caller needing to allocate/free its own buffers.
+ */
+extern void *ec_outbuf;
+extern void *ec_inbuf;
+
+/**
+ * Perform initializations needed for subsequent requests
*
* returns 0 in case of success or error code. */
int comm_init(void);
-/*
+/**
* Send a command to the EC. Returns the length of output data returned (0 if
* none), or negative on error.
*/
@@ -25,7 +36,7 @@ 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. Returns the number
* of bytes read, or negative on error. Specifying bytes=0 will read a