Zephyr API Documentation 4.0.0
A Scalable Open Source RTOS
|
Macros | |
#define | DT_PINCTRL_BY_IDX(node_id, pc_idx, idx) |
Get a node identifier for a phandle in a pinctrl property by index. | |
#define | DT_PINCTRL_0(node_id, idx) |
Get a node identifier from a pinctrl-0 property. | |
#define | DT_PINCTRL_BY_NAME(node_id, name, idx) |
Get a node identifier for a phandle inside a pinctrl node by name. | |
#define | DT_PINCTRL_NAME_TO_IDX(node_id, name) |
Convert a pinctrl name to its corresponding index. | |
#define | DT_PINCTRL_IDX_TO_NAME_TOKEN(node_id, pc_idx) |
Convert a pinctrl property index to its name as a token. | |
#define | DT_PINCTRL_IDX_TO_NAME_UPPER_TOKEN(node_id, pc_idx) |
Like DT_PINCTRL_IDX_TO_NAME_TOKEN(), but with an uppercased result. | |
#define | DT_NUM_PINCTRLS_BY_IDX(node_id, pc_idx) |
Get the number of phandles in a pinctrl property. | |
#define | DT_NUM_PINCTRLS_BY_NAME(node_id, name) |
Like DT_NUM_PINCTRLS_BY_IDX(), but by name instead. | |
#define | DT_NUM_PINCTRL_STATES(node_id) |
Get the number of pinctrl properties in a node. | |
#define | DT_PINCTRL_HAS_IDX(node_id, pc_idx) |
Test if a node has a pinctrl property with an index. | |
#define | DT_PINCTRL_HAS_NAME(node_id, name) |
Test if a node has a pinctrl property with a name. | |
#define | DT_INST_PINCTRL_BY_IDX(inst, pc_idx, idx) |
Get a node identifier for a phandle in a pinctrl property by index for a DT_DRV_COMPAT instance. | |
#define | DT_INST_PINCTRL_0(inst, idx) |
Get a node identifier from a pinctrl-0 property for a DT_DRV_COMPAT instance. | |
#define | DT_INST_PINCTRL_BY_NAME(inst, name, idx) |
Get a node identifier for a phandle inside a pinctrl node for a DT_DRV_COMPAT instance. | |
#define | DT_INST_PINCTRL_NAME_TO_IDX(inst, name) |
Convert a pinctrl name to its corresponding index for a DT_DRV_COMPAT instance. | |
#define | DT_INST_PINCTRL_IDX_TO_NAME_TOKEN(inst, pc_idx) |
Convert a pinctrl index to its name as an uppercased token. | |
#define | DT_INST_PINCTRL_IDX_TO_NAME_UPPER_TOKEN(inst, pc_idx) |
Convert a pinctrl index to its name as an uppercased token. | |
#define | DT_INST_NUM_PINCTRLS_BY_IDX(inst, pc_idx) |
Get the number of phandles in a pinctrl property for a DT_DRV_COMPAT instance. | |
#define | DT_INST_NUM_PINCTRLS_BY_NAME(inst, name) |
Like DT_INST_NUM_PINCTRLS_BY_IDX(), but by name instead. | |
#define | DT_INST_NUM_PINCTRL_STATES(inst) |
Get the number of pinctrl properties in a DT_DRV_COMPAT instance. | |
#define | DT_INST_PINCTRL_HAS_IDX(inst, pc_idx) |
Test if a DT_DRV_COMPAT instance has a pinctrl property with an index. | |
#define | DT_INST_PINCTRL_HAS_NAME(inst, name) |
Test if a DT_DRV_COMPAT instance has a pinctrl property with a name. | |
#define DT_INST_NUM_PINCTRL_STATES | ( | inst | ) |
#include <zephyr/devicetree/pinctrl.h>
Get the number of pinctrl properties in a DT_DRV_COMPAT instance.
This is equivalent to DT_NUM_PINCTRL_STATES(DT_DRV_INST(inst)).
inst | instance number |
#define DT_INST_NUM_PINCTRLS_BY_IDX | ( | inst, | |
pc_idx ) |
#include <zephyr/devicetree/pinctrl.h>
Get the number of phandles in a pinctrl property for a DT_DRV_COMPAT instance.
This is equivalent to DT_NUM_PINCTRLS_BY_IDX(DT_DRV_INST(inst), pc_idx).
inst | instance number |
pc_idx | index of the pinctrl property itself |
#define DT_INST_NUM_PINCTRLS_BY_NAME | ( | inst, | |
name ) |
#include <zephyr/devicetree/pinctrl.h>
Like DT_INST_NUM_PINCTRLS_BY_IDX(), but by name instead.
This is equivalent to DT_NUM_PINCTRLS_BY_NAME(DT_DRV_INST(inst), name).
inst | instance number |
name | lowercase-and-underscores name of the pinctrl property |
#define DT_INST_PINCTRL_0 | ( | inst, | |
idx ) |
#include <zephyr/devicetree/pinctrl.h>
Get a node identifier from a pinctrl-0 property for a DT_DRV_COMPAT instance.
This is equivalent to:
DT_PINCTRL_BY_IDX(DT_DRV_INST(inst), 0, idx)
It is provided for convenience since pinctrl-0 is commonly used.
inst | instance number |
idx | index into the pinctrl-0 property |
#define DT_INST_PINCTRL_BY_IDX | ( | inst, | |
pc_idx, | |||
idx ) |
#include <zephyr/devicetree/pinctrl.h>
Get a node identifier for a phandle in a pinctrl property by index for a DT_DRV_COMPAT instance.
This is equivalent to DT_PINCTRL_BY_IDX(DT_DRV_INST(inst), pc_idx, idx).
inst | instance number |
pc_idx | index of the pinctrl property itself |
idx | index into the value of the pinctrl property |
#define DT_INST_PINCTRL_BY_NAME | ( | inst, | |
name, | |||
idx ) |
#include <zephyr/devicetree/pinctrl.h>
Get a node identifier for a phandle inside a pinctrl node for a DT_DRV_COMPAT instance.
This is equivalent to DT_PINCTRL_BY_NAME(DT_DRV_INST(inst), name, idx).
inst | instance number |
name | lowercase-and-underscores pinctrl property name |
idx | index into the value of the named pinctrl property |
#define DT_INST_PINCTRL_HAS_IDX | ( | inst, | |
pc_idx ) |
#include <zephyr/devicetree/pinctrl.h>
Test if a DT_DRV_COMPAT instance has a pinctrl property with an index.
This is equivalent to DT_PINCTRL_HAS_IDX(DT_DRV_INST(inst), pc_idx).
inst | instance number |
pc_idx | index of a pinctrl property whose existence to check |
#define DT_INST_PINCTRL_HAS_NAME | ( | inst, | |
name ) |
#include <zephyr/devicetree/pinctrl.h>
Test if a DT_DRV_COMPAT instance has a pinctrl property with a name.
This is equivalent to DT_PINCTRL_HAS_NAME(DT_DRV_INST(inst), name).
inst | instance number |
name | lowercase-and-underscores pinctrl property name to check |
#define DT_INST_PINCTRL_IDX_TO_NAME_TOKEN | ( | inst, | |
pc_idx ) |
#include <zephyr/devicetree/pinctrl.h>
Convert a pinctrl index to its name as an uppercased token.
This is equivalent to DT_PINCTRL_IDX_TO_NAME_TOKEN(DT_DRV_INST(inst), pc_idx).
inst | instance number |
pc_idx | index of the pinctrl property itself |
#define DT_INST_PINCTRL_IDX_TO_NAME_UPPER_TOKEN | ( | inst, | |
pc_idx ) |
#include <zephyr/devicetree/pinctrl.h>
Convert a pinctrl index to its name as an uppercased token.
This is equivalent to DT_PINCTRL_IDX_TO_NAME_UPPER_TOKEN(DT_DRV_INST(inst), idx).
inst | instance number |
pc_idx | index of the pinctrl property itself |
#define DT_INST_PINCTRL_NAME_TO_IDX | ( | inst, | |
name ) |
#include <zephyr/devicetree/pinctrl.h>
Convert a pinctrl name to its corresponding index for a DT_DRV_COMPAT instance.
This is equivalent to DT_PINCTRL_NAME_TO_IDX(DT_DRV_INST(inst), name).
inst | instance number |
name | lowercase-and-underscores name of the pinctrl whose index to get |
#define DT_NUM_PINCTRL_STATES | ( | node_id | ) |
#include <zephyr/devicetree/pinctrl.h>
Get the number of pinctrl properties in a node.
This expands to 0 if there are no pinctrl-i properties. Otherwise, it expands to the number of such properties.
Example devicetree fragment:
n1: node-1 { pinctrl-0 = <...>; pinctrl-1 = <...>; }; n2: node-2 { };
Example usage:
DT_NUM_PINCTRL_STATES(DT_NODELABEL(n1)) // 2 DT_NUM_PINCTRL_STATES(DT_NODELABEL(n2)) // 0
node_id | node identifier; may or may not have any pinctrl properties |
#define DT_NUM_PINCTRLS_BY_IDX | ( | node_id, | |
pc_idx ) |
#include <zephyr/devicetree/pinctrl.h>
Get the number of phandles in a pinctrl property.
Example devicetree fragment:
n1: node-1 { pinctrl-0 = <&foo &bar>; }; n2: node-2 { pinctrl-0 = <&baz>; };
Example usage:
DT_NUM_PINCTRLS_BY_IDX(DT_NODELABEL(n1), 0) // 2 DT_NUM_PINCTRLS_BY_IDX(DT_NODELABEL(n2), 0) // 1
node_id | node identifier with a pinctrl property |
pc_idx | index of the pinctrl property itself |
#define DT_NUM_PINCTRLS_BY_NAME | ( | node_id, | |
name ) |
#include <zephyr/devicetree/pinctrl.h>
Like DT_NUM_PINCTRLS_BY_IDX(), but by name instead.
Example devicetree fragment:
n: node { pinctrl-0 = <&foo &bar>; pinctrl-1 = <&baz> pinctrl-names = "default", "sleep"; };
Example usage:
DT_NUM_PINCTRLS_BY_NAME(DT_NODELABEL(n), default) // 2 DT_NUM_PINCTRLS_BY_NAME(DT_NODELABEL(n), sleep) // 1
node_id | node identifier with a pinctrl property |
name | lowercase-and-underscores name name of the pinctrl property |
#define DT_PINCTRL_0 | ( | node_id, | |
idx ) |
#include <zephyr/devicetree/pinctrl.h>
Get a node identifier from a pinctrl-0 property.
This is equivalent to:
DT_PINCTRL_BY_IDX(node_id, 0, idx)
It is provided for convenience since pinctrl-0 is commonly used.
node_id | node with a pinctrl-0 property |
idx | index into the pinctrl-0 property |
#define DT_PINCTRL_BY_IDX | ( | node_id, | |
pc_idx, | |||
idx ) |
#include <zephyr/devicetree/pinctrl.h>
Get a node identifier for a phandle in a pinctrl property by index.
Example devicetree fragment:
n: node { pinctrl-0 = <&foo &bar>; pinctrl-1 = <&baz &blub>; }
Example usage:
DT_PINCTRL_BY_IDX(DT_NODELABEL(n), 0, 1) // DT_NODELABEL(bar) DT_PINCTRL_BY_IDX(DT_NODELABEL(n), 1, 0) // DT_NODELABEL(baz)
node_id | node with a pinctrl-'pc_idx' property |
pc_idx | index of the pinctrl property itself |
idx | index into the value of the pinctrl property |
#define DT_PINCTRL_BY_NAME | ( | node_id, | |
name, | |||
idx ) |
#include <zephyr/devicetree/pinctrl.h>
Get a node identifier for a phandle inside a pinctrl node by name.
Example devicetree fragment:
n: node { pinctrl-0 = <&foo &bar>; pinctrl-1 = <&baz &blub>; pinctrl-names = "default", "sleep"; };
Example usage:
DT_PINCTRL_BY_NAME(DT_NODELABEL(n), default, 1) // DT_NODELABEL(bar) DT_PINCTRL_BY_NAME(DT_NODELABEL(n), sleep, 0) // DT_NODELABEL(baz)
node_id | node with a named pinctrl property |
name | lowercase-and-underscores pinctrl property name |
idx | index into the value of the named pinctrl property |
#define DT_PINCTRL_HAS_IDX | ( | node_id, | |
pc_idx ) |
#include <zephyr/devicetree/pinctrl.h>
Test if a node has a pinctrl property with an index.
This expands to 1 if the pinctrl-'idx' property exists. Otherwise, it expands to 0.
Example devicetree fragment:
n1: node-1 { pinctrl-0 = <...>; pinctrl-1 = <...>; }; n2: node-2 { };
Example usage:
DT_PINCTRL_HAS_IDX(DT_NODELABEL(n1), 0) // 1 DT_PINCTRL_HAS_IDX(DT_NODELABEL(n1), 1) // 1 DT_PINCTRL_HAS_IDX(DT_NODELABEL(n1), 2) // 0 DT_PINCTRL_HAS_IDX(DT_NODELABEL(n2), 0) // 0
node_id | node identifier; may or may not have any pinctrl properties |
pc_idx | index of a pinctrl property whose existence to check |
#define DT_PINCTRL_HAS_NAME | ( | node_id, | |
name ) |
#include <zephyr/devicetree/pinctrl.h>
Test if a node has a pinctrl property with a name.
This expands to 1 if the named pinctrl property exists. Otherwise, it expands to 0.
Example devicetree fragment:
n1: node-1 { pinctrl-0 = <...>; pinctrl-names = "default"; }; n2: node-2 { };
Example usage:
DT_PINCTRL_HAS_NAME(DT_NODELABEL(n1), default) // 1 DT_PINCTRL_HAS_NAME(DT_NODELABEL(n1), sleep) // 0 DT_PINCTRL_HAS_NAME(DT_NODELABEL(n2), default) // 0
node_id | node identifier; may or may not have any pinctrl properties |
name | lowercase-and-underscores pinctrl property name to check |
#define DT_PINCTRL_IDX_TO_NAME_TOKEN | ( | node_id, | |
pc_idx ) |
#include <zephyr/devicetree/pinctrl.h>
Convert a pinctrl property index to its name as a token.
This allows you to get a pinctrl property's name, and "remove the quotes" from it.
DT_PINCTRL_IDX_TO_NAME_TOKEN() can only be used if the node has a pinctrl-'pc_idx' property and a pinctrl-names property element for that index. It is an error to use it in other circumstances.
Example devicetree fragment:
n: node { pinctrl-0 = <...>; pinctrl-1 = <...>; pinctrl-names = "default", "f.o.o2"; };
Example usage:
DT_PINCTRL_IDX_TO_NAME_TOKEN(DT_NODELABEL(n), 0) // default DT_PINCTRL_IDX_TO_NAME_TOKEN(DT_NODELABEL(n), 1) // f_o_o2
The same caveats and restrictions that apply to DT_STRING_TOKEN()'s return value also apply here.
node_id | node identifier |
pc_idx | index of a pinctrl property in that node |
#define DT_PINCTRL_IDX_TO_NAME_UPPER_TOKEN | ( | node_id, | |
pc_idx ) |
#include <zephyr/devicetree/pinctrl.h>
Like DT_PINCTRL_IDX_TO_NAME_TOKEN(), but with an uppercased result.
This does the a similar conversion as DT_PINCTRL_IDX_TO_NAME_TOKEN(node_id, pc_idx). The only difference is that alphabetical characters in the result are uppercased.
Example devicetree fragment:
n: node { pinctrl-0 = <...>; pinctrl-1 = <...>; pinctrl-names = "default", "f.o.o2"; };
Example usage:
DT_PINCTRL_IDX_TO_NAME_TOKEN(DT_NODELABEL(n), 0) // DEFAULT DT_PINCTRL_IDX_TO_NAME_TOKEN(DT_NODELABEL(n), 1) // F_O_O2
The same caveats and restrictions that apply to DT_STRING_UPPER_TOKEN()'s return value also apply here.
#define DT_PINCTRL_NAME_TO_IDX | ( | node_id, | |
name ) |
#include <zephyr/devicetree/pinctrl.h>
Convert a pinctrl name to its corresponding index.
Example devicetree fragment:
n: node { pinctrl-0 = <&foo &bar>; pinctrl-1 = <&baz &blub>; pinctrl-names = "default", "sleep"; };
Example usage:
DT_PINCTRL_NAME_TO_IDX(DT_NODELABEL(n), default) // 0 DT_PINCTRL_NAME_TO_IDX(DT_NODELABEL(n), sleep) // 1
node_id | node identifier with a named pinctrl property |
name | lowercase-and-underscores name name of the pinctrl whose index to get |