|
| 1 | +/* |
| 2 | + * Copyright (c) 2025 Nordic Semiconductor ASA |
| 3 | + * |
| 4 | + * SPDX-License-Identifier: LicenseRef-Nordic-5-Clause |
| 5 | + */ |
| 6 | + |
| 7 | +#include <zephyr/device.h> |
| 8 | +#include <zephyr/drivers/mspi.h> |
| 9 | +#include <zephyr/drivers/mspi_emul.h> |
| 10 | +#include <zephyr/ztest.h> |
| 11 | + |
| 12 | +#define MSPI_BUS_NODE DT_NODELABEL(sdp_mspi) |
| 13 | + |
| 14 | +static const struct device *mspi_devices[] = { |
| 15 | + DT_FOREACH_CHILD_STATUS_OKAY_SEP(MSPI_BUS_NODE, DEVICE_DT_GET, (,)) |
| 16 | +}; |
| 17 | + |
| 18 | +static struct mspi_dev_cfg device_cfg[] = { |
| 19 | + DT_FOREACH_CHILD_STATUS_OKAY_SEP(MSPI_BUS_NODE, MSPI_DEVICE_CONFIG_DT, (,)) |
| 20 | +}; |
| 21 | + |
| 22 | +ZTEST(hpf_trap_handler, test_trap_handler) |
| 23 | +{ |
| 24 | + int ret = 0; |
| 25 | + const struct device *mspi_bus = DEVICE_DT_GET(MSPI_BUS_NODE); |
| 26 | + const struct mspi_dev_id dev_id = { |
| 27 | + .dev_idx = 0xFF, |
| 28 | + }; |
| 29 | + |
| 30 | + zassert_true(device_is_ready(mspi_bus), "mspi_bus is not ready"); |
| 31 | + zassert_true(device_is_ready(mspi_devices[0]), "mspi_device is not ready"); |
| 32 | + |
| 33 | + /* Push wrong device id to trigger assert on flpr app side */ |
| 34 | + ret = mspi_dev_config(mspi_bus, &dev_id, MSPI_DEVICE_CONFIG_ALL, &device_cfg[0]); |
| 35 | + zassert_equal(ret, -ETIMEDOUT, "Assert not triggered?"); |
| 36 | +} |
| 37 | + |
| 38 | +ZTEST_SUITE(hpf_trap_handler, NULL, NULL, NULL, NULL, NULL); |
0 commit comments