Zephyr API Documentation
3.6.99
A Scalable Open Source RTOS
|
Macros | |
#define | DT_GPIO_CTLR_BY_IDX(node_id, gpio_pha, idx) DT_PHANDLE_BY_IDX(node_id, gpio_pha, idx) |
Get the node identifier for the controller phandle from a gpio phandle-array property at an index. | |
#define | DT_GPIO_CTLR(node_id, gpio_pha) DT_GPIO_CTLR_BY_IDX(node_id, gpio_pha, 0) |
Equivalent to DT_GPIO_CTLR_BY_IDX(node_id, gpio_pha, 0) | |
#define | DT_GPIO_PIN_BY_IDX(node_id, gpio_pha, idx) DT_PHA_BY_IDX(node_id, gpio_pha, idx, pin) |
Get a GPIO specifier's pin cell at an index. | |
#define | DT_GPIO_PIN(node_id, gpio_pha) DT_GPIO_PIN_BY_IDX(node_id, gpio_pha, 0) |
Equivalent to DT_GPIO_PIN_BY_IDX(node_id, gpio_pha, 0) | |
#define | DT_GPIO_FLAGS_BY_IDX(node_id, gpio_pha, idx) DT_PHA_BY_IDX_OR(node_id, gpio_pha, idx, flags, 0) |
Get a GPIO specifier's flags cell at an index. | |
#define | DT_GPIO_FLAGS(node_id, gpio_pha) DT_GPIO_FLAGS_BY_IDX(node_id, gpio_pha, 0) |
Equivalent to DT_GPIO_FLAGS_BY_IDX(node_id, gpio_pha, 0) | |
#define | DT_NUM_GPIO_HOGS(node_id) |
Get the number of GPIO hogs in a node. | |
#define | DT_GPIO_HOG_PIN_BY_IDX(node_id, idx) DT_CAT4(node_id, _GPIO_HOGS_IDX_, idx, _VAL_pin) |
Get a GPIO hog specifier's pin cell at an index. | |
#define | DT_GPIO_HOG_FLAGS_BY_IDX(node_id, idx) |
Get a GPIO hog specifier's flags cell at an index. | |
#define | DT_INST_GPIO_PIN_BY_IDX(inst, gpio_pha, idx) DT_GPIO_PIN_BY_IDX(DT_DRV_INST(inst), gpio_pha, idx) |
Get a DT_DRV_COMPAT instance's GPIO specifier's pin cell value at an index. | |
#define | DT_INST_GPIO_PIN(inst, gpio_pha) DT_INST_GPIO_PIN_BY_IDX(inst, gpio_pha, 0) |
Equivalent to DT_INST_GPIO_PIN_BY_IDX(inst, gpio_pha, 0) | |
#define | DT_INST_GPIO_FLAGS_BY_IDX(inst, gpio_pha, idx) DT_GPIO_FLAGS_BY_IDX(DT_DRV_INST(inst), gpio_pha, idx) |
Get a DT_DRV_COMPAT instance's GPIO specifier's flags cell at an index. | |
#define | DT_INST_GPIO_FLAGS(inst, gpio_pha) DT_INST_GPIO_FLAGS_BY_IDX(inst, gpio_pha, 0) |
Equivalent to DT_INST_GPIO_FLAGS_BY_IDX(inst, gpio_pha, 0) | |
#define DT_GPIO_CTLR | ( | node_id, | |
gpio_pha | |||
) | DT_GPIO_CTLR_BY_IDX(node_id, gpio_pha, 0) |
#include <zephyr/devicetree/gpio.h>
Equivalent to DT_GPIO_CTLR_BY_IDX(node_id, gpio_pha, 0)
node_id | node identifier |
gpio_pha | lowercase-and-underscores GPIO property with type "phandle-array" |
#define DT_GPIO_CTLR_BY_IDX | ( | node_id, | |
gpio_pha, | |||
idx | |||
) | DT_PHANDLE_BY_IDX(node_id, gpio_pha, idx) |
#include <zephyr/devicetree/gpio.h>
Get the node identifier for the controller phandle from a gpio phandle-array property at an index.
Example devicetree fragment:
gpio1: gpio@... { }; gpio2: gpio@... { }; n: node { gpios = <&gpio1 10 GPIO_ACTIVE_LOW>, <&gpio2 30 GPIO_ACTIVE_HIGH>; };
Example usage:
DT_GPIO_CTLR_BY_IDX(DT_NODELABEL(n), gpios, 1) // DT_NODELABEL(gpio2)
node_id | node identifier |
gpio_pha | lowercase-and-underscores GPIO property with type "phandle-array" |
idx | logical index into "gpio_pha" |
#define DT_GPIO_FLAGS | ( | node_id, | |
gpio_pha | |||
) | DT_GPIO_FLAGS_BY_IDX(node_id, gpio_pha, 0) |
#include <zephyr/devicetree/gpio.h>
Equivalent to DT_GPIO_FLAGS_BY_IDX(node_id, gpio_pha, 0)
node_id | node identifier |
gpio_pha | lowercase-and-underscores GPIO property with type "phandle-array" |
#define DT_GPIO_FLAGS_BY_IDX | ( | node_id, | |
gpio_pha, | |||
idx | |||
) | DT_PHA_BY_IDX_OR(node_id, gpio_pha, idx, flags, 0) |
#include <zephyr/devicetree/gpio.h>
Get a GPIO specifier's flags cell at an index.
This macro expects GPIO specifiers with cells named "flags". If there is no "flags" cell in the GPIO specifier, zero is returned. Refer to the node's binding to check specifier cell names if necessary.
Example devicetree fragment:
gpio1: gpio@... { compatible = "vnd,gpio"; #gpio-cells = <2>; }; gpio2: gpio@... { compatible = "vnd,gpio"; #gpio-cells = <2>; }; n: node { gpios = <&gpio1 10 GPIO_ACTIVE_LOW>, <&gpio2 30 GPIO_ACTIVE_HIGH>; };
Bindings fragment for the vnd,gpio compatible:
gpio-cells: - pin - flags
Example usage:
DT_GPIO_FLAGS_BY_IDX(DT_NODELABEL(n), gpios, 0) // GPIO_ACTIVE_LOW DT_GPIO_FLAGS_BY_IDX(DT_NODELABEL(n), gpios, 1) // GPIO_ACTIVE_HIGH
node_id | node identifier |
gpio_pha | lowercase-and-underscores GPIO property with type "phandle-array" |
idx | logical index into "gpio_pha" |
#define DT_GPIO_HOG_FLAGS_BY_IDX | ( | node_id, | |
idx | |||
) |
#include <zephyr/devicetree/gpio.h>
Get a GPIO hog specifier's flags cell at an index.
This macro expects GPIO specifiers with cells named "flags". If there is no "flags" cell in the GPIO specifier, zero is returned. Refer to the node's binding to check specifier cell names if necessary.
Example devicetree fragment:
gpio1: gpio@... { compatible = "vnd,gpio"; #gpio-cells = <2>; n1: node-1 { gpio-hog; gpios = <0 GPIO_ACTIVE_HIGH>, <1 GPIO_ACTIVE_LOW>; output-high; }; n2: node-2 { gpio-hog; gpios = <3 GPIO_ACTIVE_HIGH>; output-low; }; };
Bindings fragment for the vnd,gpio compatible:
gpio-cells: - pin - flags
Example usage:
DT_GPIO_HOG_FLAGS_BY_IDX(DT_NODELABEL(n1), 0) // GPIO_ACTIVE_HIGH DT_GPIO_HOG_FLAGS_BY_IDX(DT_NODELABEL(n1), 1) // GPIO_ACTIVE_LOW DT_GPIO_HOG_FLAGS_BY_IDX(DT_NODELABEL(n2), 0) // GPIO_ACTIVE_HIGH
node_id | node identifier |
idx | logical index into "gpios" |
#define DT_GPIO_HOG_PIN_BY_IDX | ( | node_id, | |
idx | |||
) | DT_CAT4(node_id, _GPIO_HOGS_IDX_, idx, _VAL_pin) |
#include <zephyr/devicetree/gpio.h>
Get a GPIO hog specifier's pin cell at an index.
This macro only works for GPIO specifiers with cells named "pin". Refer to the node's binding to check if necessary.
Example devicetree fragment:
gpio1: gpio@... { compatible = "vnd,gpio"; #gpio-cells = <2>; n1: node-1 { gpio-hog; gpios = <0 GPIO_ACTIVE_HIGH>, <1 GPIO_ACTIVE_LOW>; output-high; }; n2: node-2 { gpio-hog; gpios = <3 GPIO_ACTIVE_HIGH>; output-low; }; };
Bindings fragment for the vnd,gpio compatible:
gpio-cells: - pin - flags
Example usage:
DT_GPIO_HOG_PIN_BY_IDX(DT_NODELABEL(n1), 0) // 0 DT_GPIO_HOG_PIN_BY_IDX(DT_NODELABEL(n1), 1) // 1 DT_GPIO_HOG_PIN_BY_IDX(DT_NODELABEL(n2), 0) // 3
node_id | node identifier |
idx | logical index into "gpios" |
#define DT_GPIO_PIN | ( | node_id, | |
gpio_pha | |||
) | DT_GPIO_PIN_BY_IDX(node_id, gpio_pha, 0) |
#include <zephyr/devicetree/gpio.h>
Equivalent to DT_GPIO_PIN_BY_IDX(node_id, gpio_pha, 0)
node_id | node identifier |
gpio_pha | lowercase-and-underscores GPIO property with type "phandle-array" |
#define DT_GPIO_PIN_BY_IDX | ( | node_id, | |
gpio_pha, | |||
idx | |||
) | DT_PHA_BY_IDX(node_id, gpio_pha, idx, pin) |
#include <zephyr/devicetree/gpio.h>
Get a GPIO specifier's pin cell at an index.
This macro only works for GPIO specifiers with cells named "pin". Refer to the node's binding to check if necessary.
Example devicetree fragment:
gpio1: gpio@... { compatible = "vnd,gpio"; #gpio-cells = <2>; }; gpio2: gpio@... { compatible = "vnd,gpio"; #gpio-cells = <2>; }; n: node { gpios = <&gpio1 10 GPIO_ACTIVE_LOW>, <&gpio2 30 GPIO_ACTIVE_HIGH>; };
Bindings fragment for the vnd,gpio compatible:
gpio-cells: - pin - flags
Example usage:
DT_GPIO_PIN_BY_IDX(DT_NODELABEL(n), gpios, 0) // 10 DT_GPIO_PIN_BY_IDX(DT_NODELABEL(n), gpios, 1) // 30
node_id | node identifier |
gpio_pha | lowercase-and-underscores GPIO property with type "phandle-array" |
idx | logical index into "gpio_pha" |
#define DT_INST_GPIO_FLAGS | ( | inst, | |
gpio_pha | |||
) | DT_INST_GPIO_FLAGS_BY_IDX(inst, gpio_pha, 0) |
#include <zephyr/devicetree/gpio.h>
Equivalent to DT_INST_GPIO_FLAGS_BY_IDX(inst, gpio_pha, 0)
inst | DT_DRV_COMPAT instance number |
gpio_pha | lowercase-and-underscores GPIO property with type "phandle-array" |
#define DT_INST_GPIO_FLAGS_BY_IDX | ( | inst, | |
gpio_pha, | |||
idx | |||
) | DT_GPIO_FLAGS_BY_IDX(DT_DRV_INST(inst), gpio_pha, idx) |
#include <zephyr/devicetree/gpio.h>
Get a DT_DRV_COMPAT instance's GPIO specifier's flags cell at an index.
inst | DT_DRV_COMPAT instance number |
gpio_pha | lowercase-and-underscores GPIO property with type "phandle-array" |
idx | logical index into "gpio_pha" |
#define DT_INST_GPIO_PIN | ( | inst, | |
gpio_pha | |||
) | DT_INST_GPIO_PIN_BY_IDX(inst, gpio_pha, 0) |
#include <zephyr/devicetree/gpio.h>
Equivalent to DT_INST_GPIO_PIN_BY_IDX(inst, gpio_pha, 0)
inst | DT_DRV_COMPAT instance number |
gpio_pha | lowercase-and-underscores GPIO property with type "phandle-array" |
#define DT_INST_GPIO_PIN_BY_IDX | ( | inst, | |
gpio_pha, | |||
idx | |||
) | DT_GPIO_PIN_BY_IDX(DT_DRV_INST(inst), gpio_pha, idx) |
#include <zephyr/devicetree/gpio.h>
Get a DT_DRV_COMPAT instance's GPIO specifier's pin cell value at an index.
inst | DT_DRV_COMPAT instance number |
gpio_pha | lowercase-and-underscores GPIO property with type "phandle-array" |
idx | logical index into "gpio_pha" |
#define DT_NUM_GPIO_HOGS | ( | node_id | ) |
#include <zephyr/devicetree/gpio.h>
Get the number of GPIO hogs in a node.
This expands to the number of hogged GPIOs, or zero if there are none.
Example devicetree fragment:
gpio1: gpio@... { compatible = "vnd,gpio"; #gpio-cells = <2>; n1: node-1 { gpio-hog; gpios = <0 GPIO_ACTIVE_HIGH>, <1 GPIO_ACTIVE_LOW>; output-high; }; n2: node-2 { gpio-hog; gpios = <3 GPIO_ACTIVE_HIGH>; output-low; }; };
Bindings fragment for the vnd,gpio compatible:
gpio-cells: - pin - flags
Example usage:
DT_NUM_GPIO_HOGS(DT_NODELABEL(n1)) // 2 DT_NUM_GPIO_HOGS(DT_NODELABEL(n2)) // 1
node_id | node identifier; may or may not be a GPIO hog node. |