devicetree: add DT_NODE_HAS_STATUS_OKAY
We already have `DT_HAS_COMPAT_STATUS_OKAY` and `DT_NUM_INST_STATUS_OKAY`, it seems intuitive to assume that `DT_NODE_HAS_STATUS_OKAY` exists, so much so that it was used before it's implemented. This patch implements `DT_NODE_HAS_STATUS_OKAY`, which is equivalent to: `DT_NODE_HAS_STATUS(<node_id>, okay)` Added test for it in `tests/lib/devicetree/api` Signed-off-by: Yong Cong Sin <ycsin@meta.com> Signed-off-by: Yong Cong Sin <yongcong.sin@gmail.com>
This commit is contained in:
parent
44d101acab
commit
5aebd1276d
2 changed files with 33 additions and 0 deletions
|
@ -366,6 +366,17 @@ ZTEST(devicetree_api, test_has_status)
|
|||
0, "");
|
||||
}
|
||||
|
||||
ZTEST(devicetree_api, test_has_status_okay)
|
||||
{
|
||||
zassert_equal(DT_NODE_HAS_STATUS_OKAY(DT_NODELABEL(test_gpio_1)), 1);
|
||||
|
||||
zassert_equal(DT_NODE_HAS_STATUS_OKAY(DT_NODELABEL(test_no_status)), 1);
|
||||
|
||||
zassert_equal(DT_NODE_HAS_STATUS_OKAY(DT_NODELABEL(disabled_gpio)), 0);
|
||||
|
||||
zassert_equal(DT_NODE_HAS_STATUS_OKAY(DT_NODELABEL(reserved_gpio)), 0);
|
||||
}
|
||||
|
||||
ZTEST(devicetree_api, test_bus)
|
||||
{
|
||||
int pin, flags;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue