summaryrefslogtreecommitdiff
path: root/test/flash.c
diff options
context:
space:
mode:
authorRandall Spangler <rspangler@chromium.org>2013-06-26 16:02:02 -0700
committerChromeBot <chrome-bot@google.com>2013-07-01 16:14:16 -0700
commit177dc398d39c1156182cb8e59a4092bd8a18ad93 (patch)
treedcaac91130b259baafa19e9fc26d07c815f0c4ce /test/flash.c
parent2730daa5679bc0d2a048a60055a7dc89d060076e (diff)
downloadchrome-ec-177dc398d39c1156182cb8e59a4092bd8a18ad93.tar.gz
Allow bigger flash write commands
Version 1 of EC_CMD_FLASH_WRITE will use as big a write as possible given the available command parameter space. Falls back to 64 byte writes on old platforms. BUG=chrome-os-partner:20571 BRANCH=none TEST=Copy burn_my_ec onto a link and run it. Write size should be 64 bytes for the first half of the update (since the old EC doesn't support ver.1 of the write command) and 240 bytes for the second half of the update. Change-Id: I5900de3a5700d7c82a2e0c3cf9921b7ced1c0343 Signed-off-by: Randall Spangler <rspangler@chromium.org> Reviewed-on: https://gerrit.chromium.org/gerrit/60511
Diffstat (limited to 'test/flash.c')
-rw-r--r--test/flash.c14
1 files changed, 8 insertions, 6 deletions
diff --git a/test/flash.c b/test/flash.c
index d38520ffc7..ae1d6432df 100644
--- a/test/flash.c
+++ b/test/flash.c
@@ -179,14 +179,16 @@ static int verify_write(int offset, int size, const char *data)
int host_command_write(int offset, int size, const char *data)
{
- struct ec_params_flash_write params;
+ uint8_t buf[256];
+ struct ec_params_flash_write *params =
+ (struct ec_params_flash_write *)buf;
- params.offset = offset;
- params.size = size;
- memcpy(params.data, data, size);
+ params->offset = offset;
+ params->size = size;
+ memcpy(params + 1, data, size);
- return test_send_host_command(EC_CMD_FLASH_WRITE, 0, &params,
- sizeof(params), NULL, 0);
+ return test_send_host_command(EC_CMD_FLASH_WRITE, EC_VER_FLASH_WRITE,
+ buf, size + sizeof(*params), NULL, 0);
}
int host_command_erase(int offset, int size)