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

Macros

#define DT_CLOCKS_CTLR_BY_IDX(node_id, idx)    DT_PHANDLE_BY_IDX(node_id, clocks, idx)
 Get the node identifier for the controller phandle from a "clocks" phandle-array property at an index. More...
 
#define DT_CLOCKS_CTLR(node_id)   DT_CLOCKS_CTLR_BY_IDX(node_id, 0)
 Equivalent to DT_CLOCKS_CTLR_BY_IDX(node_id, 0) More...
 
#define DT_CLOCKS_CTLR_BY_NAME(node_id, name)    DT_PHANDLE_BY_NAME(node_id, clocks, name)
 Get the node identifier for the controller phandle from a clocks phandle-array property at an index. More...
 
#define DT_CLOCKS_LABEL_BY_IDX(node_id, idx)
 Get a label property from the node referenced by a pwms property at an index. More...
 
#define DT_CLOCKS_LABEL_BY_NAME(node_id, name)
 Get a label property from a clocks property by name. More...
 
#define DT_CLOCKS_LABEL(node_id)   __DEPRECATED_MACRO DT_CLOCKS_LABEL_BY_IDX(node_id, 0)
 Equivalent to DT_CLOCKS_LABEL_BY_IDX(node_id, 0) More...
 
#define DT_CLOCKS_CELL_BY_IDX(node_id, idx, cell)    DT_PHA_BY_IDX(node_id, clocks, idx, cell)
 Get a clock specifier's cell value at an index. More...
 
#define DT_CLOCKS_CELL_BY_NAME(node_id, name, cell)    DT_PHA_BY_NAME(node_id, clocks, name, cell)
 Get a clock specifier's cell value by name. More...
 
#define DT_CLOCKS_CELL(node_id, cell)   DT_CLOCKS_CELL_BY_IDX(node_id, 0, cell)
 Equivalent to DT_CLOCKS_CELL_BY_IDX(node_id, 0, cell) More...
 
#define DT_INST_CLOCKS_CTLR_BY_IDX(inst, idx)    DT_CLOCKS_CTLR_BY_IDX(DT_DRV_INST(inst), idx)
 Get the node identifier for the controller phandle from a "clocks" phandle-array property at an index. More...
 
#define DT_INST_CLOCKS_CTLR(inst)   DT_INST_CLOCKS_CTLR_BY_IDX(inst, 0)
 Equivalent to DT_INST_CLOCKS_CTLR_BY_IDX(inst, 0) More...
 
#define DT_INST_CLOCKS_CTLR_BY_NAME(inst, name)    DT_CLOCKS_CTLR_BY_NAME(DT_DRV_INST(inst), name)
 Get the node identifier for the controller phandle from a clocks phandle-array property by name. More...
 
#define DT_INST_CLOCKS_LABEL_BY_IDX(inst, idx)
 Get a label property from a DT_DRV_COMPAT instance's clocks property at an index. More...
 
#define DT_INST_CLOCKS_LABEL_BY_NAME(inst, name)
 Get a label property from a DT_DRV_COMPAT instance's clocks property by name. More...
 
#define DT_INST_CLOCKS_LABEL(inst)   DT_INST_CLOCKS_LABEL_BY_IDX(inst, 0) __DEPRECATED_MACRO
 Equivalent to DT_INST_CLOCKS_LABEL_BY_IDX(inst, 0) More...
 
#define DT_INST_CLOCKS_CELL_BY_IDX(inst, idx, cell)    DT_CLOCKS_CELL_BY_IDX(DT_DRV_INST(inst), idx, cell)
 Get a DT_DRV_COMPAT instance's clock specifier's cell value at an index. More...
 
#define DT_INST_CLOCKS_CELL_BY_NAME(inst, name, cell)    DT_CLOCKS_CELL_BY_NAME(DT_DRV_INST(inst), name, cell)
 Get a DT_DRV_COMPAT instance's clock specifier's cell value by name. More...
 
#define DT_INST_CLOCKS_CELL(inst, cell)    DT_INST_CLOCKS_CELL_BY_IDX(inst, 0, cell)
 Equivalent to DT_INST_CLOCKS_CELL_BY_IDX(inst, 0, cell) More...
 

Detailed Description

Macro Definition Documentation

◆ DT_CLOCKS_CELL

#define DT_CLOCKS_CELL (   node_id,
  cell 
)    DT_CLOCKS_CELL_BY_IDX(node_id, 0, cell)

#include <include/devicetree/clocks.h>

Equivalent to DT_CLOCKS_CELL_BY_IDX(node_id, 0, cell)

Parameters
node_idnode identifier for a node with a clocks property
celllowercase-and-underscores cell name
Returns
the cell value at index 0
See also
DT_CLOCKS_CELL_BY_IDX()

◆ DT_CLOCKS_CELL_BY_IDX

#define DT_CLOCKS_CELL_BY_IDX (   node_id,
  idx,
  cell 
)     DT_PHA_BY_IDX(node_id, clocks, idx, cell)

#include <include/devicetree/clocks.h>

Get a clock specifier's cell value at an index.

Example devicetree fragment:

clk1: clock-controller@... {
        compatible = "vnd,clock";
        #clock-cells = < 2 >;
};

n: node {
        clocks = < &clk1 10 20 >, < &clk1 30 40 >;
};

Bindings fragment for the vnd,clock compatible:

clock-cells:
  - bus
  - bits

Example usage:

DT_CLOCKS_CELL_BY_IDX(DT_NODELABEL(n), 0, bus) // 10
DT_CLOCKS_CELL_BY_IDX(DT_NODELABEL(n), 1, bits) // 40
Parameters
node_idnode identifier for a node with a clocks property
idxlogical index into clocks property
celllowercase-and-underscores cell name
Returns
the cell value at index "idx"
See also
DT_PHA_BY_IDX()

◆ DT_CLOCKS_CELL_BY_NAME

#define DT_CLOCKS_CELL_BY_NAME (   node_id,
  name,
  cell 
)     DT_PHA_BY_NAME(node_id, clocks, name, cell)

#include <include/devicetree/clocks.h>

Get a clock specifier's cell value by name.

Example devicetree fragment:

clk1: clock-controller@... {
        compatible = "vnd,clock";
        #clock-cells = < 2 >;
};

n: node {
        clocks = < &clk1 10 20 >, < &clk1 30 40 >;
        clock-names = "alpha", "beta";
};

Bindings fragment for the vnd,clock compatible:

clock-cells:
  - bus
  - bits

Example usage:

DT_CLOCKS_CELL_BY_NAME(DT_NODELABEL(n), alpha, bus) // 10
DT_CLOCKS_CELL_BY_NAME(DT_NODELABEL(n), beta, bits) // 40
Parameters
node_idnode identifier for a node with a clocks property
namelowercase-and-underscores name of a clocks element as defined by the node's clock-names property
celllowercase-and-underscores cell name
Returns
the cell value in the specifier at the named element
See also
DT_PHA_BY_NAME()

◆ DT_CLOCKS_CTLR

#define DT_CLOCKS_CTLR (   node_id)    DT_CLOCKS_CTLR_BY_IDX(node_id, 0)

#include <include/devicetree/clocks.h>

Equivalent to DT_CLOCKS_CTLR_BY_IDX(node_id, 0)

Parameters
node_idnode identifier
Returns
a node identifier for the clocks controller at index 0 in "clocks"
See also
DT_CLOCKS_CTLR_BY_IDX()

◆ DT_CLOCKS_CTLR_BY_IDX

#define DT_CLOCKS_CTLR_BY_IDX (   node_id,
  idx 
)     DT_PHANDLE_BY_IDX(node_id, clocks, idx)

#include <include/devicetree/clocks.h>

Get the node identifier for the controller phandle from a "clocks" phandle-array property at an index.

Example devicetree fragment:

clk1: clock-controller@... { ... };

clk2: clock-controller@... { ... };

n: node {
        clocks = <&clk1 10 20>, <&clk2 30 40>;
};

Example usage:

DT_CLOCKS_CTLR_BY_IDX(DT_NODELABEL(n), 0)) // DT_NODELABEL(clk1)
DT_CLOCKS_CTLR_BY_IDX(DT_NODELABEL(n), 1)) // DT_NODELABEL(clk2)
Parameters
node_idnode identifier
idxlogical index into "clocks"
Returns
the node identifier for the clock controller referenced at index "idx"
See also
DT_PHANDLE_BY_IDX()

◆ DT_CLOCKS_CTLR_BY_NAME

#define DT_CLOCKS_CTLR_BY_NAME (   node_id,
  name 
)     DT_PHANDLE_BY_NAME(node_id, clocks, name)

#include <include/devicetree/clocks.h>

Get the node identifier for the controller phandle from a clocks phandle-array property at an index.

Example devicetree fragment:

clk1: clock-controller@... { ... };

clk2: clock-controller@... { ... };

n: node {
        clocks = <&clk1 10 20>, <&clk2 30 40>;
        clock-names = "alpha", "beta";
};

Example usage:

DT_CLOCKS_CTLR_BY_NAME(DT_NODELABEL(n), beta) // DT_NODELABEL(clk2)
Parameters
node_idnode identifier
namelowercase-and-underscores name of a clocks element as defined by the node's clock-names property
Returns
the node identifier for the clock controller referenced by name
See also
DT_PHANDLE_BY_NAME()

◆ DT_CLOCKS_LABEL

#define DT_CLOCKS_LABEL (   node_id)    __DEPRECATED_MACRO DT_CLOCKS_LABEL_BY_IDX(node_id, 0)

#include <include/devicetree/clocks.h>

Equivalent to DT_CLOCKS_LABEL_BY_IDX(node_id, 0)

Parameters
node_idnode identifier for a node with a clocks property
Returns
the label property of the node referenced at index 0
See also
DT_CLOCKS_LABEL_BY_IDX()

◆ DT_CLOCKS_LABEL_BY_IDX

#define DT_CLOCKS_LABEL_BY_IDX (   node_id,
  idx 
)

#include <include/devicetree/clocks.h>

Value:
DT_PROP_BY_PHANDLE_IDX(node_id, clocks, 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 a pwms property at an index.

It's an error if the clock controller node referenced by the phandle in node_id's clocks property at index "idx" has no label property.

Example devicetree fragment:

clk1: clock-controller@... {
        label = "CLK_1";
};

clk2: clock-controller@... {
        label = "CLK_2";
};

n: node {
        clocks = <&clk1 10 20>, <&clk2 30 40>;
};

Example usage:

DT_CLOCKS_LABEL_BY_IDX(DT_NODELABEL(n), 1) // "CLK_2"
Parameters
node_idnode identifier for a node with a clocks property
idxlogical index into clocks property
Returns
the label property of the node referenced at index "idx"
See also
DT_PROP_BY_PHANDLE_IDX()

◆ DT_CLOCKS_LABEL_BY_NAME

#define DT_CLOCKS_LABEL_BY_NAME (   node_id,
  name 
)

#include <include/devicetree/clocks.h>

Value:
DT_PROP(DT_PHANDLE_BY_NAME(node_id, clocks, 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 a clocks property by name.

It's an error if the clock controller node referenced by the phandle in node_id's clocks property at the element named "name" has no label property.

Example devicetree fragment:

clk1: clock-controller@... {
        label = "CLK_1";
};

clk2: clock-controller@... {
        label = "CLK_2";
};

n: node {
        clocks = <&clk1 10 20>, <&clk2 30 40>;
        clock-names = "alpha", "beta";
};

Example usage:

DT_CLOCKS_LABEL_BY_NAME(DT_NODELABEL(n), beta) // "CLK_2"
Parameters
node_idnode identifier for a node with a clocks property
namelowercase-and-underscores name of a clocks element as defined by the node's clock-names property
Returns
the label property of the node referenced at the named element
See also
DT_PHANDLE_BY_NAME()

◆ DT_INST_CLOCKS_CELL

#define DT_INST_CLOCKS_CELL (   inst,
  cell 
)     DT_INST_CLOCKS_CELL_BY_IDX(inst, 0, cell)

#include <include/devicetree/clocks.h>

Equivalent to DT_INST_CLOCKS_CELL_BY_IDX(inst, 0, cell)

Parameters
instDT_DRV_COMPAT instance number
celllowercase-and-underscores cell name
Returns
the value of the cell inside the specifier at index 0

◆ DT_INST_CLOCKS_CELL_BY_IDX

#define DT_INST_CLOCKS_CELL_BY_IDX (   inst,
  idx,
  cell 
)     DT_CLOCKS_CELL_BY_IDX(DT_DRV_INST(inst), idx, cell)

#include <include/devicetree/clocks.h>

Get a DT_DRV_COMPAT instance's clock specifier's cell value at an index.

Parameters
instDT_DRV_COMPAT instance number
idxlogical index into clocks property
celllowercase-and-underscores cell name
Returns
the cell value at index "idx"
See also
DT_CLOCKS_CELL_BY_IDX()

◆ DT_INST_CLOCKS_CELL_BY_NAME

#define DT_INST_CLOCKS_CELL_BY_NAME (   inst,
  name,
  cell 
)     DT_CLOCKS_CELL_BY_NAME(DT_DRV_INST(inst), name, cell)

#include <include/devicetree/clocks.h>

Get a DT_DRV_COMPAT instance's clock specifier's cell value by name.

Parameters
instDT_DRV_COMPAT instance number
namelowercase-and-underscores name of a clocks element as defined by the node's clock-names property
celllowercase-and-underscores cell name
Returns
the cell value in the specifier at the named element
See also
DT_CLOCKS_CELL_BY_NAME()

◆ DT_INST_CLOCKS_CTLR

#define DT_INST_CLOCKS_CTLR (   inst)    DT_INST_CLOCKS_CTLR_BY_IDX(inst, 0)

#include <include/devicetree/clocks.h>

Equivalent to DT_INST_CLOCKS_CTLR_BY_IDX(inst, 0)

Parameters
instinstance number
Returns
a node identifier for the clocks controller at index 0 in "clocks"
See also
DT_CLOCKS_CTLR()

◆ DT_INST_CLOCKS_CTLR_BY_IDX

#define DT_INST_CLOCKS_CTLR_BY_IDX (   inst,
  idx 
)     DT_CLOCKS_CTLR_BY_IDX(DT_DRV_INST(inst), idx)

#include <include/devicetree/clocks.h>

Get the node identifier for the controller phandle from a "clocks" phandle-array property at an index.

Parameters
instinstance number
idxlogical index into "clocks"
Returns
the node identifier for the clock controller referenced at index "idx"
See also
DT_CLOCKS_CTLR_BY_IDX()

◆ DT_INST_CLOCKS_CTLR_BY_NAME

#define DT_INST_CLOCKS_CTLR_BY_NAME (   inst,
  name 
)     DT_CLOCKS_CTLR_BY_NAME(DT_DRV_INST(inst), name)

#include <include/devicetree/clocks.h>

Get the node identifier for the controller phandle from a clocks phandle-array property by name.

Parameters
instinstance number
namelowercase-and-underscores name of a clocks element as defined by the node's clock-names property
Returns
the node identifier for the clock controller referenced by the named element
See also
DT_CLOCKS_CTLR_BY_NAME()

◆ DT_INST_CLOCKS_LABEL

#define DT_INST_CLOCKS_LABEL (   inst)    DT_INST_CLOCKS_LABEL_BY_IDX(inst, 0) __DEPRECATED_MACRO

#include <include/devicetree/clocks.h>

Equivalent to DT_INST_CLOCKS_LABEL_BY_IDX(inst, 0)

Parameters
instDT_DRV_COMPAT instance number
Returns
the label property of the node referenced at index 0
See also
DT_CLOCKS_LABEL_BY_IDX()

◆ DT_INST_CLOCKS_LABEL_BY_IDX

#define DT_INST_CLOCKS_LABEL_BY_IDX (   inst,
  idx 
)

#include <include/devicetree/clocks.h>

Value:
#define DT_CLOCKS_LABEL_BY_IDX(node_id, idx)
Get a label property from the node referenced by a pwms property at an index.
Definition: clocks.h:122
#define DT_DRV_INST(inst)
Node identifier for an instance of a DT_DRV_COMPAT compatible.
Definition: devicetree.h:2073

Get a label property from a DT_DRV_COMPAT instance's clocks property at an index.

Parameters
instDT_DRV_COMPAT instance number
idxlogical index into clocks property
Returns
the label property of the node referenced at index "idx"
See also
DT_CLOCKS_LABEL_BY_IDX()

◆ DT_INST_CLOCKS_LABEL_BY_NAME

#define DT_INST_CLOCKS_LABEL_BY_NAME (   inst,
  name 
)

#include <include/devicetree/clocks.h>

Value:
#define DT_CLOCKS_LABEL_BY_NAME(node_id, name)
Get a label property from a clocks property by name.
Definition: clocks.h:158

Get a label property from a DT_DRV_COMPAT instance's clocks property by name.

Parameters
instDT_DRV_COMPAT instance number
namelowercase-and-underscores name of a clocks element as defined by the node's clock-names property
Returns
the label property of the node referenced at the named element
See also
DT_CLOCKS_LABEL_BY_NAME()