From 5f30f40cb5a83bc900ce3400d6a5f3327bc96fdc Mon Sep 17 00:00:00 2001 From: Randall Spangler Date: Tue, 2 Jul 2013 11:25:22 -0700 Subject: 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 Reviewed-on: https://gerrit.chromium.org/gerrit/60810 Reviewed-by: Bill Richardson Reviewed-by: Simon Glass --- util/comm-i2c.c | 13 +++---------- 1 file changed, 3 insertions(+), 10 deletions(-) (limited to 'util/comm-i2c.c') 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; } -- cgit v1.2.1