Zephyr API Documentation
3.7.0
A Scalable Open Source RTOS
|
Macros | |
#define | DT_SPI_HAS_CS_GPIOS(spi) DT_NODE_HAS_PROP(spi, cs_gpios) |
Does a SPI controller node have chip select GPIOs configured? | |
#define | DT_SPI_NUM_CS_GPIOS(spi) |
Number of chip select GPIOs in a SPI controller's cs-gpios property. | |
#define | DT_SPI_DEV_HAS_CS_GPIOS(spi_dev) DT_SPI_HAS_CS_GPIOS(DT_BUS(spi_dev)) |
Does a SPI device have a chip select line configured? Example devicetree fragment: | |
#define | DT_SPI_DEV_CS_GPIOS_CTLR(spi_dev) DT_GPIO_CTLR_BY_IDX(DT_BUS(spi_dev), cs_gpios, DT_REG_ADDR(spi_dev)) |
Get a SPI device's chip select GPIO controller's node identifier. | |
#define | DT_SPI_DEV_CS_GPIOS_PIN(spi_dev) DT_GPIO_PIN_BY_IDX(DT_BUS(spi_dev), cs_gpios, DT_REG_ADDR(spi_dev)) |
Get a SPI device's chip select GPIO pin number. | |
#define | DT_SPI_DEV_CS_GPIOS_FLAGS(spi_dev) DT_GPIO_FLAGS_BY_IDX(DT_BUS(spi_dev), cs_gpios, DT_REG_ADDR(spi_dev)) |
Get a SPI device's chip select GPIO flags. | |
#define | DT_INST_SPI_DEV_HAS_CS_GPIOS(inst) DT_SPI_DEV_HAS_CS_GPIOS(DT_DRV_INST(inst)) |
Equivalent to DT_SPI_DEV_HAS_CS_GPIOS(DT_DRV_INST(inst)). | |
#define | DT_INST_SPI_DEV_CS_GPIOS_CTLR(inst) DT_SPI_DEV_CS_GPIOS_CTLR(DT_DRV_INST(inst)) |
Get GPIO controller node identifier for a SPI device instance This is equivalent to DT_SPI_DEV_CS_GPIOS_CTLR(DT_DRV_INST(inst)). | |
#define | DT_INST_SPI_DEV_CS_GPIOS_PIN(inst) DT_SPI_DEV_CS_GPIOS_PIN(DT_DRV_INST(inst)) |
Equivalent to DT_SPI_DEV_CS_GPIOS_PIN(DT_DRV_INST(inst)). | |
#define | DT_INST_SPI_DEV_CS_GPIOS_FLAGS(inst) DT_SPI_DEV_CS_GPIOS_FLAGS(DT_DRV_INST(inst)) |
DT_SPI_DEV_CS_GPIOS_FLAGS(DT_DRV_INST(inst)). | |
#define DT_INST_SPI_DEV_CS_GPIOS_CTLR | ( | inst | ) | DT_SPI_DEV_CS_GPIOS_CTLR(DT_DRV_INST(inst)) |
#include <zephyr/devicetree/spi.h>
Get GPIO controller node identifier for a SPI device instance This is equivalent to DT_SPI_DEV_CS_GPIOS_CTLR(DT_DRV_INST(inst)).
inst | DT_DRV_COMPAT instance number |
#define DT_INST_SPI_DEV_CS_GPIOS_FLAGS | ( | inst | ) | DT_SPI_DEV_CS_GPIOS_FLAGS(DT_DRV_INST(inst)) |
#include <zephyr/devicetree/spi.h>
DT_SPI_DEV_CS_GPIOS_FLAGS(DT_DRV_INST(inst)).
inst | DT_DRV_COMPAT instance number |
#define DT_INST_SPI_DEV_CS_GPIOS_PIN | ( | inst | ) | DT_SPI_DEV_CS_GPIOS_PIN(DT_DRV_INST(inst)) |
#include <zephyr/devicetree/spi.h>
Equivalent to DT_SPI_DEV_CS_GPIOS_PIN(DT_DRV_INST(inst)).
inst | DT_DRV_COMPAT instance number |
#define DT_INST_SPI_DEV_HAS_CS_GPIOS | ( | inst | ) | DT_SPI_DEV_HAS_CS_GPIOS(DT_DRV_INST(inst)) |
#include <zephyr/devicetree/spi.h>
Equivalent to DT_SPI_DEV_HAS_CS_GPIOS(DT_DRV_INST(inst)).
inst | DT_DRV_COMPAT instance number |
#define DT_SPI_DEV_CS_GPIOS_CTLR | ( | spi_dev | ) | DT_GPIO_CTLR_BY_IDX(DT_BUS(spi_dev), cs_gpios, DT_REG_ADDR(spi_dev)) |
#include <zephyr/devicetree/spi.h>
Get a SPI device's chip select GPIO controller's node identifier.
Example devicetree fragment:
gpio1: gpio@... { ... }; gpio2: gpio@... { ... }; spi@... { compatible = "vnd,spi"; cs-gpios = <&gpio1 10 GPIO_ACTIVE_LOW>, <&gpio2 20 GPIO_ACTIVE_LOW>; a: spi-dev-a@0 { reg = <0>; }; b: spi-dev-b@1 { reg = <1>; }; };
Example usage:
DT_SPI_DEV_CS_GPIOS_CTLR(DT_NODELABEL(a)) // DT_NODELABEL(gpio1) DT_SPI_DEV_CS_GPIOS_CTLR(DT_NODELABEL(b)) // DT_NODELABEL(gpio2)
spi_dev | a SPI device node identifier |
#define DT_SPI_DEV_CS_GPIOS_FLAGS | ( | spi_dev | ) | DT_GPIO_FLAGS_BY_IDX(DT_BUS(spi_dev), cs_gpios, DT_REG_ADDR(spi_dev)) |
#include <zephyr/devicetree/spi.h>
Get a SPI device's chip select GPIO flags.
Example devicetree fragment:
spi1: spi@... { compatible = "vnd,spi"; cs-gpios = <&gpio1 10 GPIO_ACTIVE_LOW>; a: spi-dev-a@0 { reg = <0>; }; };
Example usage:
DT_SPI_DEV_CS_GPIOS_FLAGS(DT_NODELABEL(a)) // GPIO_ACTIVE_LOW
If the GPIO specifier for spi_dev's entry in its bus node's cs-gpios property has no flags cell, this expands to zero.
spi_dev | a SPI device node identifier |
#define DT_SPI_DEV_CS_GPIOS_PIN | ( | spi_dev | ) | DT_GPIO_PIN_BY_IDX(DT_BUS(spi_dev), cs_gpios, DT_REG_ADDR(spi_dev)) |
#include <zephyr/devicetree/spi.h>
Get a SPI device's chip select GPIO pin number.
It's an error if the GPIO specifier for spi_dev's entry in its bus node's cs-gpios property has no pin cell.
Example devicetree fragment:
spi1: spi@... { compatible = "vnd,spi"; cs-gpios = <&gpio1 10 GPIO_ACTIVE_LOW>, <&gpio2 20 GPIO_ACTIVE_LOW>; a: spi-dev-a@0 { reg = <0>; }; b: spi-dev-b@1 { reg = <1>; }; };
Example usage:
DT_SPI_DEV_CS_GPIOS_PIN(DT_NODELABEL(a)) // 10 DT_SPI_DEV_CS_GPIOS_PIN(DT_NODELABEL(b)) // 20
spi_dev | a SPI device node identifier |
#define DT_SPI_DEV_HAS_CS_GPIOS | ( | spi_dev | ) | DT_SPI_HAS_CS_GPIOS(DT_BUS(spi_dev)) |
#include <zephyr/devicetree/spi.h>
Does a SPI device have a chip select line configured? Example devicetree fragment:
spi1: spi@... { compatible = "vnd,spi"; cs-gpios = <&gpio1 10 GPIO_ACTIVE_LOW>, <&gpio2 20 GPIO_ACTIVE_LOW>; a: spi-dev-a@0 { reg = <0>; }; b: spi-dev-b@1 { reg = <1>; }; }; spi2: spi@... { compatible = "vnd,spi"; c: spi-dev-c@0 { reg = <0>; }; };
Example usage:
DT_SPI_DEV_HAS_CS_GPIOS(DT_NODELABEL(a)) // 1 DT_SPI_DEV_HAS_CS_GPIOS(DT_NODELABEL(b)) // 1 DT_SPI_DEV_HAS_CS_GPIOS(DT_NODELABEL(c)) // 0
spi_dev | a SPI device node identifier |
#define DT_SPI_HAS_CS_GPIOS | ( | spi | ) | DT_NODE_HAS_PROP(spi, cs_gpios) |
#include <zephyr/devicetree/spi.h>
Does a SPI controller node have chip select GPIOs configured?
SPI bus controllers use the "cs-gpios" property for configuring chip select GPIOs. Its value is a phandle-array which specifies the chip select lines.
Example devicetree fragment:
spi1: spi@... { compatible = "vnd,spi"; cs-gpios = <&gpio1 10 GPIO_ACTIVE_LOW>, <&gpio2 20 GPIO_ACTIVE_LOW>; }; spi2: spi@... { compatible = "vnd,spi"; };
Example usage:
DT_SPI_HAS_CS_GPIOS(DT_NODELABEL(spi1)) // 1 DT_SPI_HAS_CS_GPIOS(DT_NODELABEL(spi2)) // 0
spi | a SPI bus controller node identifier |
#define DT_SPI_NUM_CS_GPIOS | ( | spi | ) |
#include <zephyr/devicetree/spi.h>
Number of chip select GPIOs in a SPI controller's cs-gpios property.
Example devicetree fragment:
spi1: spi@... { compatible = "vnd,spi"; cs-gpios = <&gpio1 10 GPIO_ACTIVE_LOW>, <&gpio2 20 GPIO_ACTIVE_LOW>; }; spi2: spi@... { compatible = "vnd,spi"; };
Example usage:
DT_SPI_NUM_CS_GPIOS(DT_NODELABEL(spi1)) // 2 DT_SPI_NUM_CS_GPIOS(DT_NODELABEL(spi2)) // 0
spi | a SPI bus controller node identifier |