summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorTim Lin <tim2.lin@ite.corp-partner.google.com>2021-06-04 14:11:25 +0800
committerCommit Bot <commit-bot@chromium.org>2021-06-09 18:54:47 +0000
commit670bd7e258d352a2ea197e055e46b60690935afc (patch)
tree9a223dbbdde5e822f63475fdb0a39c0dc1300112 /test
parent3bf7cf9dfe738f1f156d6b9dc5ade87290d1d78e (diff)
downloadchrome-ec-670bd7e258d352a2ea197e055e46b60690935afc.tar.gz
include/flash: rename the APIs
The names conflict when enabling both Zephyr's flash driver and CONFIG_FLASH_CROS option. Rename all the APIs in include/flash.h BUG=b:187192628 BRANCH=none TEST=make buildall -j4 Signed-off-by: Tim Lin <tim2.lin@ite.corp-partner.google.com> Change-Id: If1fd0ea28fa9f5cec1c1daa8f72f63eb7a0e6500 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2931749 Commit-Queue: Keith Short <keithshort@chromium.org> Reviewed-by: Keith Short <keithshort@chromium.org> Reviewed-by: Denis Brockus <dbrockus@chromium.org>
Diffstat (limited to 'test')
-rw-r--r--test/flash.c12
-rw-r--r--test/flash_write_protect.c6
-rw-r--r--test/rollback.c3
3 files changed, 11 insertions, 10 deletions
diff --git a/test/flash.c b/test/flash.c
index 1b55d236d9..4f9ca74016 100644
--- a/test/flash.c
+++ b/test/flash.c
@@ -253,7 +253,7 @@ static int test_read(void)
#endif
/* The first few bytes in the flash should always contain some code */
- TEST_ASSERT(!flash_is_erased(0, sizeof(buf)));
+ TEST_ASSERT(!crec_flash_is_erased(0, sizeof(buf)));
TEST_ASSERT(host_command_read(0, sizeof(buf), buf) == EC_RES_SUCCESS);
TEST_ASSERT_ARRAY_EQ(buf, (char *)CONFIG_PROGRAM_MEMORY_BASE,
@@ -268,11 +268,11 @@ static int test_is_erased(void)
#ifdef EMU_BUILD
memset(__host_flash, 0xff, 1024);
- TEST_ASSERT(flash_is_erased(0, 1024));
+ TEST_ASSERT(crec_flash_is_erased(0, 1024));
for (i = 0; i < 1024; ++i) {
__host_flash[i] = 0xec;
- TEST_ASSERT(!flash_is_erased(0, 1024));
+ TEST_ASSERT(!crec_flash_is_erased(0, 1024));
__host_flash[i] = 0xff;
}
#else
@@ -400,9 +400,9 @@ static int test_write_protect(void)
ASSERT_WP_FLAGS(EC_FLASH_PROTECT_ALL_NOW | EC_FLASH_PROTECT_RO_AT_BOOT);
/* Check we cannot erase anything */
- TEST_ASSERT(flash_physical_erase(CONFIG_RO_STORAGE_OFF,
+ TEST_ASSERT(crec_flash_physical_erase(CONFIG_RO_STORAGE_OFF,
CONFIG_FLASH_ERASE_SIZE) != EC_SUCCESS);
- TEST_ASSERT(flash_physical_erase(CONFIG_RW_STORAGE_OFF,
+ TEST_ASSERT(crec_flash_physical_erase(CONFIG_RW_STORAGE_OFF,
CONFIG_FLASH_ERASE_SIZE) != EC_SUCCESS);
/* We should not even try to write/erase */
@@ -418,7 +418,7 @@ static int test_boot_write_protect(void)
{
/* Check write protect state persists through reboot */
ASSERT_WP_FLAGS(EC_FLASH_PROTECT_RO_NOW | EC_FLASH_PROTECT_RO_AT_BOOT);
- TEST_ASSERT(flash_physical_erase(CONFIG_RO_STORAGE_OFF,
+ TEST_ASSERT(crec_flash_physical_erase(CONFIG_RO_STORAGE_OFF,
CONFIG_FLASH_ERASE_SIZE) != EC_SUCCESS);
return EC_SUCCESS;
diff --git a/test/flash_write_protect.c b/test/flash_write_protect.c
index 2b69484e93..2bf801c9b0 100644
--- a/test/flash_write_protect.c
+++ b/test/flash_write_protect.c
@@ -42,8 +42,8 @@ test_static int test_flash_write_protect_enable(void)
TEST_EQ(check_image_and_hardware_write_protect(), EC_SUCCESS, "%d");
/* Equivalent of ectool --name=cros_fp flashprotect enable */
- rv = flash_set_protect(EC_FLASH_PROTECT_RO_AT_BOOT,
- EC_FLASH_PROTECT_RO_AT_BOOT);
+ rv = crec_flash_set_protect(EC_FLASH_PROTECT_RO_AT_BOOT,
+ EC_FLASH_PROTECT_RO_AT_BOOT);
return rv;
}
@@ -55,7 +55,7 @@ test_static int test_flash_write_protect_disable(void)
TEST_EQ(check_image_and_hardware_write_protect(), EC_SUCCESS, "%d");
/* Equivalent of ectool --name=cros_fp flashprotect disable */
- rv = flash_set_protect(EC_FLASH_PROTECT_RO_AT_BOOT, 0);
+ rv = crec_flash_set_protect(EC_FLASH_PROTECT_RO_AT_BOOT, 0);
TEST_NE(rv, EC_SUCCESS, "%d");
return EC_SUCCESS;
diff --git a/test/rollback.c b/test/rollback.c
index 50c65e876d..2038333311 100644
--- a/test/rollback.c
+++ b/test/rollback.c
@@ -46,7 +46,8 @@ test_static int read_rollback_region(const struct rollback_info *info,
info->region_1_offset;
for (i = 0; i < info->region_size_bytes; i++) {
- if (flash_read(offset + i, sizeof(data), &data) == EC_SUCCESS)
+ if (crec_flash_read(offset + i, sizeof(data), &data) ==
+ EC_SUCCESS)
bytes_read++;
}