Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions doc/guides/kconfig/preprocessor-functions.rst
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ while the ``*_hex`` version returns a hexadecimal value starting with ``0x``.
$(dt_compat_enabled,<compatible string>)
$(dt_chosen_enabled,<property in /chosen>)
$(dt_node_has_bool_prop,<node path>,<prop>)
$(dt_node_has_prop,<node path>,<prop>)


Example Usage
Expand Down
24 changes: 24 additions & 0 deletions scripts/kconfig/kconfigfunctions.py
Original file line number Diff line number Diff line change
Expand Up @@ -324,6 +324,29 @@ def dt_node_has_bool_prop(kconf, _, path, prop):

return "n"

def dt_node_has_prop(kconf, _, label, prop):
"""
This function takes a 'label' and looks for an EDT node for that label. If
it finds an EDT node, it will look to see if that node has a property
by the name of 'prop'. If the 'prop' exists it will return "y" otherwise
we return "n".
"""

if doc_mode or edt is None:
return "n"

try:
node = edt.label2node.get(label)
except edtlib.EDTError:
return "n"

if node is None:
return "n"

if prop in node.props:
return "y"

return "n"

def dt_node_int_prop(kconf, name, path, prop):
"""
Expand Down Expand Up @@ -445,6 +468,7 @@ def shields_list_contains(kconf, _, shield):
"dt_node_reg_size_int": (dt_node_reg, 1, 3),
"dt_node_reg_size_hex": (dt_node_reg, 1, 3),
"dt_node_has_bool_prop": (dt_node_has_bool_prop, 2, 2),
"dt_node_has_prop": (dt_node_has_prop, 2, 2),
"dt_node_int_prop_int": (dt_node_int_prop, 2, 2),
"dt_node_int_prop_hex": (dt_node_int_prop, 2, 2),
"dt_nodelabel_has_compat": (dt_nodelabel_has_compat, 2, 2),
Expand Down