summaryrefslogtreecommitdiff
path: root/util/comm-i2c.c
diff options
context:
space:
mode:
authorRandall Spangler <rspangler@chromium.org>2013-07-02 11:25:22 -0700
committerChromeBot <chrome-bot@google.com>2013-07-03 18:23:09 -0700
commit5f30f40cb5a83bc900ce3400d6a5f3327bc96fdc (patch)
treee16e8104d83f9f3cc61e9212bd544aa85d5308a3 /util/comm-i2c.c
parent1b9a0ade1604b5ed9c6677eaef835014e2b55e3e (diff)
downloadchrome-ec-5f30f40cb5a83bc900ce3400d6a5f3327bc96fdc.tar.gz
Move protocol v2 constants to ec_commands.h
These constants are scattered around the various interface implementations and should be in one place. This will also clean up the u-boot side when ec_commands.h is copied there. BUG=chrome-os-partner:20257 BRANCH=none TEST=build link, spring, pit; test 'ectool hello' Change-Id: Ib1425db00ec8220538d8c5c65107ac9548009516 Signed-off-by: Randall Spangler <rspangler@chromium.org> Reviewed-on: https://gerrit.chromium.org/gerrit/60810 Reviewed-by: Bill Richardson <wfrichar@chromium.org> Reviewed-by: Simon Glass <sjg@chromium.org>
Diffstat (limited to 'util/comm-i2c.c')
-rw-r--r--util/comm-i2c.c13
1 files changed, 3 insertions, 10 deletions
diff --git a/util/comm-i2c.c b/util/comm-i2c.c
index eab48d2a99..91ceb555e2 100644
--- a/util/comm-i2c.c
+++ b/util/comm-i2c.c
@@ -32,15 +32,8 @@
#define debug(...)
#endif
-/* v2 protocol bytes
- * OUT: (version, command, size, ... request ..., checksum) */
-#define PROTO_V2_IN 4
-/* IN: (command, size, ... response ..., checkcum) */
-#define PROTO_V2_OUT 3
-
static int i2c_fd = -1;
-
/*
* Sends a command to the EC (protocol v2). Returns the command status code, or
* -1 if other error.
@@ -90,7 +83,7 @@ static int ec_command_i2c(int command, int version,
* allocate larger packet
* (version, command, size, ..., checksum)
*/
- req_len = outsize + PROTO_V2_IN;
+ req_len = outsize + EC_PROTO2_REQUEST_OVERHEAD;
req_buf = calloc(1, req_len);
if (!req_buf)
goto done;
@@ -115,7 +108,7 @@ static int ec_command_i2c(int command, int version,
* allocate larger packet
* (result, size, ..., checksum)
*/
- resp_len = insize + PROTO_V2_OUT;
+ resp_len = insize + EC_PROTO2_RESPONSE_OVERHEAD;
resp_buf = calloc(1, resp_len);
if (!resp_buf)
goto done;
@@ -213,7 +206,7 @@ int comm_init_i2c(void)
free(file_path);
ec_command = ec_command_i2c;
- ec_max_outsize = ec_max_insize = EC_HOST_PARAM_SIZE;
+ ec_max_outsize = ec_max_insize = EC_PROTO2_MAX_PARAM_SIZE;
return 0;
}