Lines Matching +full:prop +full:- +full:2
1 # Copyright (c) 2018-2019 Linaro
4 # SPDX-License-Identifier: Apache-2.0
15 ZEPHYR_BASE = str(Path(__file__).resolve().parents[2])
17 "python-devicetree", "src"))
157 foo: some-node { ... };
199 def _node_int_prop(node, prop, unit=None): argument
202 property called 'prop' and if that 'prop' is an integer type will return
203 the value of the property 'prop' as either a string int or string hex
218 if prop not in node.props:
221 if node.props[prop].type != "int":
224 return node.props[prop].val >> _dt_units_to_scale(unit)
227 def _node_array_prop(node, prop, index=0, unit=None): argument
230 property called 'prop' and if that 'prop' is an array type will return
231 the value of the property 'prop' at the given 'index' as either a string int
232 or string hex value. If the property 'prop' is not found or the given 'index'
244 if prop not in node.props:
246 if node.props[prop].type != "array":
248 if int(index) >= len(node.props[prop].val):
250 return node.props[prop].val[int(index)] >> _dt_units_to_scale(unit)
252 def _node_ph_array_prop(node, prop, index, cell, unit=None): argument
254 This function takes a 'node', a property name ('prop'), index ('index') and
256 called 'prop' and if that 'prop' is an phandle-array type.
270 if prop not in node.props:
272 if node.props[prop].type != "phandle-array":
274 if int(index) >= len(node.props[prop].val):
276 if cell not in node.props[prop].val[int(index)].data.keys():
278 return node.props[prop].val[int(index)].data[cell] >> _dt_units_to_scale(unit)
456 foo: some-node { ... };
473 def _dt_node_bool_prop_generic(node_search_function, search_arg, prop): argument
476 a node with 'search_arg' and if node exists, checks if 'prop' exists
488 if prop not in node.props:
491 if node.props[prop].type != "boolean":
494 if node.props[prop].val:
499 def dt_node_bool_prop(kconf, _, path, prop): argument
503 by the name of 'prop'. If the 'prop' exists it will return "y" otherwise
509 return _dt_node_bool_prop_generic(edt.get_node, path, prop)
511 def dt_nodelabel_bool_prop(kconf, _, label, prop): argument
515 property by the name of 'prop'. If the 'prop' exists it will return "y"
521 return _dt_node_bool_prop_generic(edt.label2node.get, label, prop)
523 def dt_chosen_bool_prop(kconf, _, chosen, prop): argument
527 property 'prop', it returns "y". Otherwise, it returns "n".
532 return _dt_node_bool_prop_generic(edt.chosen_node, chosen, prop)
534 def _dt_node_has_prop_generic(node_search_function, search_arg, prop): argument
537 a node with 'search_arg' and if node exists, then checks if 'prop'
548 if prop in node.props:
553 def dt_node_has_prop(kconf, _, path, prop): argument
557 by the name of 'prop'. If the 'prop' exists it will return "y" otherwise
563 return _dt_node_has_prop_generic(edt.get_node, path, prop)
565 def dt_nodelabel_has_prop(kconf, _, label, prop): argument
569 by the name of 'prop'. If the 'prop' exists it will return "y" otherwise
575 return _dt_node_has_prop_generic(edt.label2node.get, label, prop)
577 def dt_node_int_prop(kconf, name, path, prop, unit=None): argument
579 This function takes a 'path' and property name ('prop') looks for an EDT
581 node has a property called 'prop' and if that 'prop' is an integer type
582 will return the value of the property 'prop' as either a string int or
603 return str(_node_int_prop(node, prop, unit))
605 return hex(_node_int_prop(node, prop, unit))
608 def dt_node_array_prop(kconf, name, path, prop, index, unit=None): argument
610 This function takes a 'path', property name ('prop') and index ('index')
612 look to see if that node has a property called 'prop' and if that 'prop'
613 is an array type will return the value of the property 'prop' at the given
630 return str(_node_array_prop(node, prop, index, unit))
632 return hex(_node_array_prop(node, prop, index, unit))
635 def dt_node_ph_array_prop(kconf, name, path, prop, index, cell, unit=None): argument
637 This function takes a 'path', property name ('prop'), index ('index') and
640 called 'prop' and if that 'prop' is an phandle-array type.
659 return str(_node_ph_array_prop(node, prop, index, cell, unit))
661 return hex(_node_ph_array_prop(node, prop, index, cell, unit))
663 def dt_node_ph_prop_path(kconf, name, path, prop): argument
665 This function takes a 'path' and a property name ('prop') and
667 it will look to see if that node has a property called 'prop'
668 and if that 'prop' is an phandle type. Then it will return the
669 path to the pointed-to node, or an empty string if there is
680 if prop not in node.props:
682 if node.props[prop].type != "phandle":
685 phandle = node.props[prop].val
689 def dt_node_str_prop_equals(kconf, _, path, prop, val): argument
691 This function takes a 'path' and property name ('prop') looks for an EDT
693 node has a property 'prop' of type string. If that 'prop' is equal to 'val'
705 if prop not in node.props:
708 if node.props[prop].type != "string":
711 if node.props[prop].val == val:
754 def dt_compat_any_has_prop(kconf, _, compat, prop, value=None): argument
756 This function takes a 'compat', a 'prop', and a 'value'.
758 enabled node with compatible 'compat' also has a valid property 'prop'.
760 also has a valid property 'prop' with value 'value'.
768 if prop in node.props:
771 elif str(node.props[prop].val) == value:
775 def dt_compat_any_not_has_prop(kconf, _, compat, prop): argument
777 This function takes a 'compat', and a 'prop'.
779 does NOT contain the property 'prop'.
787 if prop not in node.props:
845 def dt_nodelabel_array_prop_has_val(kconf, _, label, prop, val): argument
849 'prop' with type "array". If so, and the property contains
858 if not node or (prop not in node.props) or (node.props[prop].type != "array"):
861 return "y" if int(val, base=0) in node.props[prop].val else "n"
913 Normalize the string, so that the string only contains alpha-numeric
914 characters or underscores. All non-alpha-numeric characters are replaced
918 return re.sub(r'[^a-zA-Z0-9_]', '_', string).upper()
956 $(add, 10, 3) # -> 13
957 $(add, 10, 3, 2) # -> 15
958 $(sub, 10, 3) # -> 7
959 $(sub, 10, 3, 2) # -> 5
960 $(mul, 10, 3) # -> 30
961 $(mul, 10, 3, 2) # -> 60
962 $(div, 10, 3) # -> 3
963 $(div, 10, 3, 2) # -> 1
964 $(mod, 10, 3) # -> 1
965 $(mod, 10, 3, 2) # -> 1
966 $(inc, 1) # -> 2
967 $(inc, 1, 1) # -> "2,2"
968 $(inc, $(inc, 1, 1)) # -> "3,3"
969 $(dec, 1) # -> 0
970 $(dec, 1, 1) # -> "0,0"
971 $(dec, $(dec, 1, 1)) # -> "-1,-1"
972 $(add, $(inc, 1, 1)) # -> 4
1007 return ",".join(map(lambda a: str(a - 1), intarray))
1024 "dt_compat_on_bus": (dt_compat_on_bus, 2, 2),
1025 "dt_compat_any_has_prop": (dt_compat_any_has_prop, 2, 3),
1026 "dt_compat_any_not_has_prop": (dt_compat_any_not_has_prop, 2, 2),
1030 "dt_chosen_has_compat": (dt_chosen_has_compat, 2, 2),
1034 "dt_nodelabel_enabled_with_compat": (dt_nodelabel_enabled_with_compat, 2, 2),
1047 "dt_node_bool_prop": (dt_node_bool_prop, 2, 2),
1048 "dt_nodelabel_bool_prop": (dt_nodelabel_bool_prop, 2, 2),
1049 "dt_chosen_bool_prop": (dt_chosen_bool_prop, 2, 2),
1050 "dt_node_has_prop": (dt_node_has_prop, 2, 2),
1051 "dt_nodelabel_has_prop": (dt_nodelabel_has_prop, 2, 2),
1052 "dt_node_int_prop_int": (dt_node_int_prop, 2, 3),
1053 "dt_node_int_prop_hex": (dt_node_int_prop, 2, 3),
1058 "dt_node_ph_prop_path": (dt_node_ph_prop_path, 2, 2),
1060 "dt_nodelabel_has_compat": (dt_nodelabel_has_compat, 2, 2),
1061 "dt_node_has_compat": (dt_node_has_compat, 2, 2),
1070 "substring": (substring, 2, 3),