We need to be able to access pinctrl-<index> property contents by name, convert names to indexes, convert indexes to names, and perform existence checks by name and by index. This is currently not possible because we don't track these properties the same way we do other named properties. That in turn is because they are different then the usual named properties. The usual case looks like this, picking DMAs just for the sake of example: dmas = <&dma0 ...>, <&dma1 ...>; dma-names = "tx", "rx"; So "tx" is the name for the <&dma0 ...> element, and "rx" is the name for the <&dma1 ...> element, all in a single "dmas" property. By contrast, pinctrl properties look like this: pinctrl-0 = <&foo &bar ...>; pinctrl-1 = <&baz &blub ...>; pinctrl-names = "default", "sleep"; Here, "default" is the name for the entire pinctrl-0 property. Similarly, "sleep" is the name of the pinctrl-1 property. It's a strange situation where the node itself is kind of a container for an array of pin control properties, which Zephyr's bindings language can't really capture and has some special case handling in edtlib. This is easiest to handle with ad-hoc code. Add special case macros for pinctrls. Signed-off-by: Martí Bolívar <marti.bolivar@nordicsemi.no> |
||
|---|---|---|
| .. | ||
| python-devicetree | ||
| gen_defines.py | ||
| README.txt | ||
This directory used to contain the edtlib.py and dtlib.py libraries
and tests, alongside the gen_defines.py script that uses them for
converting DTS to the C macros used by Zephyr.
The libraries and tests have now been moved to the 'python-devicetree'
subdirectory.
We are now in the process of extracting edtlib and dtlib into a
standalone source code library that we intend to share with other
projects.
Links related to the work making this standalone:
https://pypi.org/project/devicetree/
https://python-devicetree.readthedocs.io/en/latest/
https://github.com/zephyrproject-rtos/python-devicetree
The 'python-devicetree' subdirectory you find here next to this
README.txt matches the standalone python-devicetree repository linked
above.
For now, the 'main' copy will continue to be hosted here in the zephyr
repository. We will mirror changes into the standalone repository as
needed; you can just ignore it for now.
Code in the zephyr repository which needs these libraries will import
devicetree.edtlib from now on, but the code will continue to be found
by manipulating sys.path for now.
Eventually, as APIs stabilize, the python-devicetree code in this
repository will disappear, and a standalone repository will be the
'main' one.