diff options
author | Randall Spangler <rspangler@chromium.org> | 2013-06-27 13:06:19 -0700 |
---|---|---|
committer | ChromeBot <chrome-bot@google.com> | 2013-07-01 16:14:15 -0700 |
commit | 267dbb74d28e4d5d13e892488563ab439398513d (patch) | |
tree | 965efc83f6ae8f15442e4670d4bc35205c99aa97 /util/ec_flash.h | |
parent | 23dd3f5f9bfa1af12efd1bf2b122647c8d54a1f9 (diff) | |
download | chrome-ec-267dbb74d28e4d5d13e892488563ab439398513d.tar.gz |
Add common interface to EC flash commands
ectool and burn_my_ec need to use the same lower-level interface to
the EC flash commands, rather than duplicating calling the low-level
flash read/write/erase commands.
This is a precursor to refactoring the low-level commands to support
SPI/STM32L in a follow-up CL.
BUG=chrome-os-partner:20571
BRANCH=none
TEST=in a root shell, burn_my_ec flashes both RO and RW EC code
Change-Id: I4c72690100d86dbff03b7dacc2fb248b571d3820
Signed-off-by: Randall Spangler <rspangler@chromium.org>
Reviewed-on: https://gerrit.chromium.org/gerrit/60266
Diffstat (limited to 'util/ec_flash.h')
-rw-r--r-- | util/ec_flash.h | 52 |
1 files changed, 52 insertions, 0 deletions
diff --git a/util/ec_flash.h b/util/ec_flash.h new file mode 100644 index 0000000000..68a40fe466 --- /dev/null +++ b/util/ec_flash.h @@ -0,0 +1,52 @@ +/* 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. + */ + +#ifndef __CROS_EC_EC_FLASH_H +#define __CROS_EC_EC_FLASH_H + +/** + * Read EC flash memory + * + * @param buf Destination buffer + * @param offset Offset in EC flash to read + * @param size Number of bytes to read + * + * @return 0 if success, negative if error. + */ +int ec_flash_read(uint8_t *buf, int offset, int size); + +/** + * Verify EC flash memory + * + * @param buf Source buffer to verify against EC flash + * @param offset Offset in EC flash to check + * @param size Number of bytes to check + * + * @return 0 if success, negative if error. + */ +int ec_flash_verify(const uint8_t *buf, int offset, int size); + +/** + * Write EC flash memory + * + * @param buf Source buffer + * @param offset Offset in EC flash to write + * @param size Number of bytes to write + * + * @return 0 if success, negative if error. + */ +int ec_flash_write(const uint8_t *buf, int offset, int size); + +/** + * Erase EC flash memory + * + * @param offset Offset in EC flash to erase + * @param size Number of bytes to erase + * + * @return 0 if success, negative if error. + */ +int ec_flash_erase(int offset, int size); + +#endif |