diff options
Diffstat (limited to 'zephyr/test/drivers/default/src/flash.c')
-rw-r--r-- | zephyr/test/drivers/default/src/flash.c | 28 |
1 files changed, 28 insertions, 0 deletions
diff --git a/zephyr/test/drivers/default/src/flash.c b/zephyr/test/drivers/default/src/flash.c index 6bb9d89d99..2660963d3c 100644 --- a/zephyr/test/drivers/default/src/flash.c +++ b/zephyr/test/drivers/default/src/flash.c @@ -251,6 +251,34 @@ ZTEST_USER(flash, test_hostcmd_flash_region_info_active_invalid) zassert_equal(host_command_process(&args), EC_RES_INVALID_PARAM, NULL); } +ZTEST_USER(flash, test_hostcmd_flash_info) +{ + struct ec_response_flash_info_1 response; + struct host_cmd_handler_args args = + BUILD_HOST_COMMAND_RESPONSE(EC_CMD_FLASH_INFO, 1, response); + + /* Get the flash info. */ + zassert_ok(host_command_process(&args), NULL); + zassert_equal(response.flash_size, + CONFIG_FLASH_SIZE_BYTES - EC_FLASH_REGION_START, + "response.flash_size = %d", response.flash_size); + zassert_equal(response.flags, 0, "response.flags = %d", response.flags); + zassert_equal(response.write_block_size, CONFIG_FLASH_WRITE_SIZE, + "response.write_block_size = %d", + response.write_block_size); + zassert_equal(response.erase_block_size, CONFIG_FLASH_ERASE_SIZE, + "response.erase_block_size = %d", + response.erase_block_size); + zassert_equal(response.protect_block_size, CONFIG_FLASH_BANK_SIZE, + "response.protect_block_size = %d", + response.protect_block_size); + zassert_equal( + response.write_ideal_size, + (args.response_max - sizeof(struct ec_params_flash_write)) & + ~(CONFIG_FLASH_WRITE_SIZE - 1), + "response.write_ideal_size = %d", response.write_ideal_size); +} + static void flash_reset(void) { /* Set the GPIO WP_L to default */ |