Zephyr API Documentation  2.7.0-rc2
A Scalable Open Source RTOS
Devicetree IO Channels API

Macros

#define DT_IO_CHANNELS_LABEL_BY_IDX(node_id, idx)
 Get a label property from the node referenced by an io-channels property at an index. More...
 
#define DT_IO_CHANNELS_LABEL_BY_NAME(node_id, name)
 Get a label property from an io-channels property by name. More...
 
#define DT_IO_CHANNELS_LABEL(node_id)    __DEPRECATED_MACRO DT_IO_CHANNELS_LABEL_BY_IDX(node_id, 0)
 Equivalent to DT_IO_CHANNELS_LABEL_BY_IDX(node_id, 0) More...
 
#define DT_IO_CHANNELS_CTLR_BY_IDX(node_id, idx)    DT_PHANDLE_BY_IDX(node_id, io_channels, idx)
 Get the node identifier for the node referenced by an io-channels property at an index. More...
 
#define DT_IO_CHANNELS_CTLR_BY_NAME(node_id, name)    DT_PHANDLE_BY_NAME(node_id, io_channels, name)
 Get the node identifier for the node referenced by an io-channels property by name. More...
 
#define DT_IO_CHANNELS_CTLR(node_id)   DT_IO_CHANNELS_CTLR_BY_IDX(node_id, 0)
 Equivalent to DT_IO_CHANNELS_CTLR_BY_IDX(node_id, 0) More...
 
#define DT_INST_IO_CHANNELS_LABEL_BY_IDX(inst, idx)
 Get a label property from a DT_DRV_COMPAT instance's io-channels property at an index. More...
 
#define DT_INST_IO_CHANNELS_LABEL_BY_NAME(inst, name)
 Get a label property from a DT_DRV_COMPAT instance's io-channels property by name. More...
 
#define DT_INST_IO_CHANNELS_LABEL(inst)    __DEPRECATED_MACRO DT_INST_IO_CHANNELS_LABEL_BY_IDX(inst, 0)
 Equivalent to DT_INST_IO_CHANNELS_LABEL_BY_IDX(inst, 0) More...
 
#define DT_INST_IO_CHANNELS_CTLR_BY_IDX(inst, idx)    DT_IO_CHANNELS_CTLR_BY_IDX(DT_DRV_INST(inst), idx)
 Get the node identifier from a DT_DRV_COMPAT instance's io-channels property at an index. More...
 
#define DT_INST_IO_CHANNELS_CTLR_BY_NAME(inst, name)    DT_IO_CHANNELS_CTLR_BY_NAME(DT_DRV_INST(inst), name)
 Get the node identifier from a DT_DRV_COMPAT instance's io-channels property by name. More...
 
#define DT_INST_IO_CHANNELS_CTLR(inst)   DT_INST_IO_CHANNELS_CTLR_BY_IDX(inst, 0)
 Equivalent to DT_INST_IO_CHANNELS_CTLR_BY_IDX(inst, 0) More...
 
#define DT_IO_CHANNELS_INPUT_BY_IDX(node_id, idx)    DT_PHA_BY_IDX(node_id, io_channels, idx, input)
 Get an io-channels specifier input cell at an index. More...
 
#define DT_IO_CHANNELS_INPUT_BY_NAME(node_id, name)    DT_PHA_BY_NAME(node_id, io_channels, name, input)
 Get an io-channels specifier input cell by name. More...
 
#define DT_IO_CHANNELS_INPUT(node_id)   DT_IO_CHANNELS_INPUT_BY_IDX(node_id, 0)
 Equivalent to DT_IO_CHANNELS_INPUT_BY_IDX(node_id, 0) More...
 
#define DT_INST_IO_CHANNELS_INPUT_BY_IDX(inst, idx)    DT_IO_CHANNELS_INPUT_BY_IDX(DT_DRV_INST(inst), idx)
 Get an input cell from the "DT_DRV_INST(inst)" io-channels property at an index. More...
 
#define DT_INST_IO_CHANNELS_INPUT_BY_NAME(inst, name)    DT_IO_CHANNELS_INPUT_BY_NAME(DT_DRV_INST(inst), name)
 Get an input cell from the "DT_DRV_INST(inst)" io-channels property by name. More...
 
#define DT_INST_IO_CHANNELS_INPUT(inst)   DT_INST_IO_CHANNELS_INPUT_BY_IDX(inst, 0)
 Equivalent to DT_INST_IO_CHANNELS_INPUT_BY_IDX(inst, 0) More...
 

Detailed Description

Macro Definition Documentation

◆ DT_INST_IO_CHANNELS_CTLR

#define DT_INST_IO_CHANNELS_CTLR (   inst)    DT_INST_IO_CHANNELS_CTLR_BY_IDX(inst, 0)

#include <include/devicetree/io-channels.h>

Equivalent to DT_INST_IO_CHANNELS_CTLR_BY_IDX(inst, 0)

Parameters
instDT_DRV_COMPAT instance number
Returns
the node identifier for the node referenced at index 0 in the node's "io-channels" property
See also
DT_IO_CHANNELS_CTLR_BY_IDX()

◆ DT_INST_IO_CHANNELS_CTLR_BY_IDX

#define DT_INST_IO_CHANNELS_CTLR_BY_IDX (   inst,
  idx 
)     DT_IO_CHANNELS_CTLR_BY_IDX(DT_DRV_INST(inst), idx)

#include <include/devicetree/io-channels.h>

Get the node identifier from a DT_DRV_COMPAT instance's io-channels property at an index.

Parameters
instDT_DRV_COMPAT instance number
idxlogical index into io-channels property
Returns
the node identifier for the node referenced at index "idx"
See also
DT_IO_CHANNELS_CTLR_BY_IDX()

◆ DT_INST_IO_CHANNELS_CTLR_BY_NAME

#define DT_INST_IO_CHANNELS_CTLR_BY_NAME (   inst,
  name 
)     DT_IO_CHANNELS_CTLR_BY_NAME(DT_DRV_INST(inst), name)

#include <include/devicetree/io-channels.h>

Get the node identifier from a DT_DRV_COMPAT instance's io-channels property by name.

Parameters
instDT_DRV_COMPAT instance number
namelowercase-and-underscores name of an io-channels element as defined by the node's io-channel-names property
Returns
the node identifier for the node referenced at the named element
See also
DT_IO_CHANNELS_CTLR_BY_NAME()

◆ DT_INST_IO_CHANNELS_INPUT

#define DT_INST_IO_CHANNELS_INPUT (   inst)    DT_INST_IO_CHANNELS_INPUT_BY_IDX(inst, 0)

#include <include/devicetree/io-channels.h>

Equivalent to DT_INST_IO_CHANNELS_INPUT_BY_IDX(inst, 0)

Parameters
instDT_DRV_COMPAT instance number
Returns
the input cell in the specifier at index 0

◆ DT_INST_IO_CHANNELS_INPUT_BY_IDX

#define DT_INST_IO_CHANNELS_INPUT_BY_IDX (   inst,
  idx 
)     DT_IO_CHANNELS_INPUT_BY_IDX(DT_DRV_INST(inst), idx)

#include <include/devicetree/io-channels.h>

Get an input cell from the "DT_DRV_INST(inst)" io-channels property at an index.

Parameters
instDT_DRV_COMPAT instance number
idxlogical index into io-channels property
Returns
the input cell in the specifier at index "idx"
See also
DT_IO_CHANNELS_INPUT_BY_IDX()

◆ DT_INST_IO_CHANNELS_INPUT_BY_NAME

#define DT_INST_IO_CHANNELS_INPUT_BY_NAME (   inst,
  name 
)     DT_IO_CHANNELS_INPUT_BY_NAME(DT_DRV_INST(inst), name)

#include <include/devicetree/io-channels.h>

Get an input cell from the "DT_DRV_INST(inst)" io-channels property by name.

Parameters
instDT_DRV_COMPAT instance number
namelowercase-and-underscores name of an io-channels element as defined by the instance's io-channel-names property
Returns
the input cell in the specifier at the named element
See also
DT_IO_CHANNELS_INPUT_BY_NAME()

◆ DT_INST_IO_CHANNELS_LABEL

#define DT_INST_IO_CHANNELS_LABEL (   inst)     __DEPRECATED_MACRO DT_INST_IO_CHANNELS_LABEL_BY_IDX(inst, 0)

#include <include/devicetree/io-channels.h>

Equivalent to DT_INST_IO_CHANNELS_LABEL_BY_IDX(inst, 0)

Parameters
instDT_DRV_COMPAT instance number
Returns
the label property of the node referenced at index 0

◆ DT_INST_IO_CHANNELS_LABEL_BY_IDX

#define DT_INST_IO_CHANNELS_LABEL_BY_IDX (   inst,
  idx 
)

#include <include/devicetree/io-channels.h>

Value:
#define DT_DRV_INST(inst)
Node identifier for an instance of a DT_DRV_COMPAT compatible.
Definition: devicetree.h:2073
#define DT_IO_CHANNELS_LABEL_BY_IDX(node_id, idx)
Get a label property from the node referenced by an io-channels property at an index.
Definition: io-channels.h:55

Get a label property from a DT_DRV_COMPAT instance's io-channels property at an index.

Parameters
instDT_DRV_COMPAT instance number
idxlogical index into io-channels property
Returns
the label property of the node referenced at index "idx"
See also
DT_IO_CHANNELS_LABEL_BY_IDX()

◆ DT_INST_IO_CHANNELS_LABEL_BY_NAME

#define DT_INST_IO_CHANNELS_LABEL_BY_NAME (   inst,
  name 
)

#include <include/devicetree/io-channels.h>

Value:
#define DT_IO_CHANNELS_LABEL_BY_NAME(node_id, name)
Get a label property from an io-channels property by name.
Definition: io-channels.h:91

Get a label property from a DT_DRV_COMPAT instance's io-channels property by name.

Parameters
instDT_DRV_COMPAT instance number
namelowercase-and-underscores name of an io-channels element as defined by the instance's io-channel-names property
Returns
the label property of the node referenced at the named element
See also
DT_IO_CHANNELS_LABEL_BY_NAME()

◆ DT_IO_CHANNELS_CTLR

#define DT_IO_CHANNELS_CTLR (   node_id)    DT_IO_CHANNELS_CTLR_BY_IDX(node_id, 0)

#include <include/devicetree/io-channels.h>

Equivalent to DT_IO_CHANNELS_CTLR_BY_IDX(node_id, 0)

Parameters
node_idnode identifier for a node with an io-channels property
Returns
the node identifier for the node referenced at index 0 in the node's "io-channels" property
See also
DT_IO_CHANNELS_CTLR_BY_IDX()

◆ DT_IO_CHANNELS_CTLR_BY_IDX

#define DT_IO_CHANNELS_CTLR_BY_IDX (   node_id,
  idx 
)     DT_PHANDLE_BY_IDX(node_id, io_channels, idx)

#include <include/devicetree/io-channels.h>

Get the node identifier for the node referenced by an io-channels property at an index.

Example devicetree fragment:

adc1: adc@... { ... };

adc2: adc@... { ... };

n: node {
        io-channels = <&adc1 10>, <&adc2 20>;
};

Example usage:

DT_IO_CHANNELS_CTLR_BY_IDX(DT_NODELABEL(n), 0) // DT_NODELABEL(adc1)
DT_IO_CHANNELS_CTLR_BY_IDX(DT_NODELABEL(n), 1) // DT_NODELABEL(adc2)
Parameters
node_idnode identifier for a node with an io-channels property
idxlogical index into io-channels property
Returns
the node identifier for the node referenced at index "idx"
See also
DT_PROP_BY_PHANDLE_IDX()

◆ DT_IO_CHANNELS_CTLR_BY_NAME

#define DT_IO_CHANNELS_CTLR_BY_NAME (   node_id,
  name 
)     DT_PHANDLE_BY_NAME(node_id, io_channels, name)

#include <include/devicetree/io-channels.h>

Get the node identifier for the node referenced by an io-channels property by name.

Example devicetree fragment:

adc1: adc@... { ... };

adc2: adc@... { ... };

n: node {
        io-channels = <&adc1 10>, <&adc2 20>;
        io-channel-names = "SENSOR", "BANDGAP";
};

Example usage:

DT_IO_CHANNELS_CTLR_BY_NAME(DT_NODELABEL(n), sensor) // DT_NODELABEL(adc1) DT_IO_CHANNELS_CTLR_BY_NAME(DT_NODELABEL(n), bandgap) // DT_NODELABEL(adc2)

Parameters
node_idnode identifier for a node with an io-channels property
namelowercase-and-underscores name of an io-channels element as defined by the node's io-channel-names property
Returns
the node identifier for the node referenced at the named element
See also
DT_PHANDLE_BY_NAME()

◆ DT_IO_CHANNELS_INPUT

#define DT_IO_CHANNELS_INPUT (   node_id)    DT_IO_CHANNELS_INPUT_BY_IDX(node_id, 0)

#include <include/devicetree/io-channels.h>

Equivalent to DT_IO_CHANNELS_INPUT_BY_IDX(node_id, 0)

Parameters
node_idnode identifier for a node with an io-channels property
Returns
the input cell in the specifier at index 0
See also
DT_IO_CHANNELS_INPUT_BY_IDX()

◆ DT_IO_CHANNELS_INPUT_BY_IDX

#define DT_IO_CHANNELS_INPUT_BY_IDX (   node_id,
  idx 
)     DT_PHA_BY_IDX(node_id, io_channels, idx, input)

#include <include/devicetree/io-channels.h>

Get an io-channels specifier input cell at an index.

This macro only works for io-channels specifiers with cells named "input". Refer to the node's binding to check if necessary.

Example devicetree fragment:

adc1: adc@... {
        compatible = "vnd,adc";
        #io-channel-cells = <1>;
};

adc2: adc@... {
        compatible = "vnd,adc";
        #io-channel-cells = <1>;
};

n: node {
        io-channels = <&adc1 10>, <&adc2 20>;
};

Bindings fragment for the vnd,adc compatible:

io-channel-cells:

  • input

Example usage:

DT_IO_CHANNELS_INPUT_BY_IDX(DT_NODELABEL(n), 0) // 10
DT_IO_CHANNELS_INPUT_BY_IDX(DT_NODELABEL(n), 1) // 20
Parameters
node_idnode identifier for a node with an io-channels property
idxlogical index into io-channels property
Returns
the input cell in the specifier at index "idx"
See also
DT_PHA_BY_IDX()

◆ DT_IO_CHANNELS_INPUT_BY_NAME

#define DT_IO_CHANNELS_INPUT_BY_NAME (   node_id,
  name 
)     DT_PHA_BY_NAME(node_id, io_channels, name, input)

#include <include/devicetree/io-channels.h>

Get an io-channels specifier input cell by name.

This macro only works for io-channels specifiers with cells named "input". Refer to the node's binding to check if necessary.

Example devicetree fragment:

adc1: adc@... {
        compatible = "vnd,adc";
        #io-channel-cells = <1>;
};

adc2: adc@... {
        compatible = "vnd,adc";
        #io-channel-cells = <1>;
};

n: node {
        io-channels = <&adc1 10>, <&adc2 20>;
        io-channel-names = "SENSOR", "BANDGAP";
};

Bindings fragment for the vnd,adc compatible:

io-channel-cells:

  • input

Example usage:

DT_IO_CHANNELS_INPUT_BY_NAME(DT_NODELABEL(n), sensor) // 10
DT_IO_CHANNELS_INPUT_BY_NAME(DT_NODELABEL(n), bandgap) // 20
Parameters
node_idnode identifier for a node with an io-channels property
namelowercase-and-underscores name of an io-channels element as defined by the node's io-channel-names property
Returns
the input cell in the specifier at the named element
See also
DT_PHA_BY_NAME()

◆ DT_IO_CHANNELS_LABEL

#define DT_IO_CHANNELS_LABEL (   node_id)     __DEPRECATED_MACRO DT_IO_CHANNELS_LABEL_BY_IDX(node_id, 0)

#include <include/devicetree/io-channels.h>

Equivalent to DT_IO_CHANNELS_LABEL_BY_IDX(node_id, 0)

Parameters
node_idnode identifier for a node with an io-channels property
Returns
the label property of the node referenced at index 0
See also
DT_IO_CHANNELS_LABEL_BY_IDX()

◆ DT_IO_CHANNELS_LABEL_BY_IDX

#define DT_IO_CHANNELS_LABEL_BY_IDX (   node_id,
  idx 
)

#include <include/devicetree/io-channels.h>

Value:
DT_PROP_BY_PHANDLE_IDX(node_id, io_channels, idx, label)
#define DT_PROP_BY_PHANDLE_IDX(node_id, phs, idx, prop)
Get a property value from a phandle in a property.
Definition: devicetree.h:987

Get a label property from the node referenced by an io-channels property at an index.

It's an error if the node referenced by the phandle in node_id's io-channels property at index "idx" has no label property.

Example devicetree fragment:

adc1: adc@... {
        label = "ADC_1";
};

adc2: adc@... {
        label = "ADC_2";
};

n: node {
        io-channels = <&adc1 10>, <&adc2 20>;
};

Example usage:

DT_IO_CHANNELS_LABEL_BY_IDX(DT_NODELABEL(n), 1) // "ADC_2"
Parameters
node_idnode identifier for a node with an io-channels property
idxlogical index into io-channels property
Returns
the label property of the node referenced at index "idx"
See also
DT_PROP_BY_PHANDLE_IDX()

◆ DT_IO_CHANNELS_LABEL_BY_NAME

#define DT_IO_CHANNELS_LABEL_BY_NAME (   node_id,
  name 
)

#include <include/devicetree/io-channels.h>

Value:
DT_PROP(DT_PHANDLE_BY_NAME(node_id, io_channels, name), label)
#define DT_PHANDLE_BY_NAME(node_id, pha, name)
Get a phandle's node identifier from a phandle array by name.
Definition: devicetree.h:1229
#define DT_PROP(node_id, prop)
Get a devicetree property value.
Definition: devicetree.h:531

Get a label property from an io-channels property by name.

It's an error if the node referenced by the phandle in node_id's io-channels property at the element named "name" has no label property.

Example devicetree fragment:

adc1: adc@... {
        label = "ADC_1";
};

adc2: adc@... {
        label = "ADC_2";
};

n: node {
        io-channels = <&adc1 10>, <&adc2 20>;
        io-channel-names = "SENSOR", "BANDGAP";
};

Example usage:

DT_IO_CHANNELS_LABEL_BY_NAME(DT_NODELABEL(n), bandgap) // "ADC_2"
Parameters
node_idnode identifier for a node with an io-channels property
namelowercase-and-underscores name of an io-channels element as defined by the node's io-channel-names property
Returns
the label property of the node referenced at the named element
See also
DT_PHANDLE_BY_NAME()