scripts: kconfig: introduce dt_nodelabel_exists
Add a new function to check if a nodelabel exists in devicetree. Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
This commit is contained in:
parent
b617418532
commit
b99ae6c7d9
2 changed files with 14 additions and 0 deletions
1
doc/build/kconfig/preprocessor-functions.rst
vendored
1
doc/build/kconfig/preprocessor-functions.rst
vendored
|
@ -65,6 +65,7 @@ while the ``*_hex`` version returns a hexadecimal value starting with ``0x``.
|
|||
$(dt_nodelabel_bool_prop,<node label>,<prop>)
|
||||
$(dt_nodelabel_enabled,<node label>)
|
||||
$(dt_nodelabel_enabled_with_compat,<node label>,<compatible string>)
|
||||
$(dt_nodelabel_exists,<node label>)
|
||||
$(dt_nodelabel_has_compat,<node label>,<compatible string>)
|
||||
$(dt_nodelabel_has_prop,<node label>,<prop>)
|
||||
$(dt_nodelabel_path,<node label>)
|
||||
|
|
|
@ -149,6 +149,18 @@ def dt_node_enabled(kconf, name, node):
|
|||
return "y" if node and node.status == "okay" else "n"
|
||||
|
||||
|
||||
def dt_nodelabel_exists(kconf, _, label):
|
||||
"""
|
||||
This function returns "y" if a nodelabel exists and "n" otherwise.
|
||||
"""
|
||||
if doc_mode or edt is None:
|
||||
return "n"
|
||||
|
||||
node = edt.label2node.get(label)
|
||||
|
||||
return "y" if node else "n"
|
||||
|
||||
|
||||
def dt_nodelabel_enabled(kconf, _, label):
|
||||
"""
|
||||
This function is like dt_node_enabled(), but the 'label' argument
|
||||
|
@ -1030,6 +1042,7 @@ functions = {
|
|||
"dt_chosen_has_compat": (dt_chosen_has_compat, 2, 2),
|
||||
"dt_path_enabled": (dt_node_enabled, 1, 1),
|
||||
"dt_alias_enabled": (dt_node_enabled, 1, 1),
|
||||
"dt_nodelabel_exists": (dt_nodelabel_exists, 1, 1),
|
||||
"dt_nodelabel_enabled": (dt_nodelabel_enabled, 1, 1),
|
||||
"dt_nodelabel_enabled_with_compat": (dt_nodelabel_enabled_with_compat, 2, 2),
|
||||
"dt_chosen_reg_addr_int": (dt_chosen_reg, 1, 3),
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue