devicetree: Add DT_HAS_ALIAS macro

Add 'DT_HAS_ALIAS' macro to verify node alias existence.

Signed-off-by: James Roy <rruuaanng@outlook.com>
This commit is contained in:
James Roy 2024-11-06 21:02:21 +08:00 committed by Anas Nashif
commit 28238d03ad
3 changed files with 11 additions and 0 deletions

View file

@ -127,6 +127,8 @@ ZTEST(devicetree_api, test_path_props)
ZTEST(devicetree_api, test_alias_props)
{
zassert_equal(DT_HAS_ALIAS(test_alias), 1, "");
zassert_equal(DT_HAS_ALIAS(test_alias_none), 0, "");
zassert_equal(DT_NUM_REGS(TEST_ALIAS), 1, "");
zassert_equal(DT_REG_ADDR(TEST_ALIAS), 0xdeadbeef, "");
zassert_equal(DT_REG_SIZE(TEST_ALIAS), 0x1000, "");