tests: drivers: flash_simulator: use DEVICE_DT_GET
Obtain the flash controller at compile time using DEVICE_DT_GET. Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
This commit is contained in:
parent
a5a768ec0f
commit
6135c164f7
|
@ -32,7 +32,7 @@
|
||||||
(((((((0xff & pat) << 8) | (0xff & pat)) << 8) | \
|
(((((((0xff & pat) << 8) | (0xff & pat)) << 8) | \
|
||||||
(0xff & pat)) << 8) | (0xff & pat))
|
(0xff & pat)) << 8) | (0xff & pat))
|
||||||
|
|
||||||
static const struct device *flash_dev;
|
static const struct device *flash_dev = DEVICE_DT_GET(DT_CHOSEN(zephyr_flash_controller));
|
||||||
static uint8_t test_read_buf[TEST_SIM_FLASH_SIZE];
|
static uint8_t test_read_buf[TEST_SIM_FLASH_SIZE];
|
||||||
|
|
||||||
static uint32_t p32_inc;
|
static uint32_t p32_inc;
|
||||||
|
@ -76,10 +76,8 @@ static void test_init(void)
|
||||||
{
|
{
|
||||||
int rc;
|
int rc;
|
||||||
|
|
||||||
flash_dev = device_get_binding(DT_CHOSEN_ZEPHYR_FLASH_CONTROLLER_LABEL);
|
zassert_true(device_is_ready(flash_dev),
|
||||||
|
"Simulated flash device not ready");
|
||||||
zassert_true(flash_dev != NULL,
|
|
||||||
"Simulated flash driver was not found!");
|
|
||||||
|
|
||||||
rc = flash_erase(flash_dev, FLASH_SIMULATOR_BASE_OFFSET,
|
rc = flash_erase(flash_dev, FLASH_SIMULATOR_BASE_OFFSET,
|
||||||
FLASH_SIMULATOR_FLASH_SIZE);
|
FLASH_SIMULATOR_FLASH_SIZE);
|
||||||
|
|
Loading…
Reference in a new issue