Zephyr API Documentation 4.2.99
A Scalable Open Source RTOS
Loading...
Searching...
No Matches
Devicetree HW spinlock API

Macros

#define DT_HWSPINLOCK_CTRL_BY_IDX(node_id, idx)
 Get the node identifier for the hardware spinlock controller from a hwlocks property by id.
#define DT_HWSPINLOCK_CTRL_BY_NAME(node_id, name)
 Get the node identifier for the hardware spinlock controller from a hwlocks property by name.
#define DT_HWSPINLOCK_ID_BY_NAME(node_id, name)
 Get a hardware spinlock id by name.
#define DT_HWSPINLOCK_ID_BY_IDX(node_id, idx)
 Get a hardware spinlock id by index.

Detailed Description

Macro Definition Documentation

◆ DT_HWSPINLOCK_CTRL_BY_IDX

#define DT_HWSPINLOCK_CTRL_BY_IDX ( node_id,
idx )

#include <zephyr/devicetree/hwspinlock.h>

Value:
DT_PHANDLE_BY_IDX(node_id, hwlocks, idx)
#define DT_PHANDLE_BY_IDX(node_id, prop, idx)
Get a node identifier for a phandle in a property.
Definition devicetree.h:1785

Get the node identifier for the hardware spinlock controller from a hwlocks property by id.

Example devicetree fragment:

hwlock1: hwspinlock-controller@... { ... };
hwlock2: hwspinlock-controller@... { ... };

n: node {
        hwlocks = <&hwlock1 8>,
                  <&hwlock2 1>;
        hwlock-names = "rd", "wr";
};

Example usage:

DT_HWSPINLOCK_CTRL_BY_IDX(DT_NODELABEL(n), 0) // DT_NODELABEL(hwlock1)
DT_HWSPINLOCK_CTRL_BY_IDX(DT_NODELABEL(n), 1) // DT_NODELABEL(hwlock2)
Parameters
node_idnode identifier for a node with a hwlocks property
idxindex of a hwlocks element in the hwlocks
Returns
the node identifier for the hardware spinlock controller in the named element
See also
DT_PHANDLE_BY_IDX()

◆ DT_HWSPINLOCK_CTRL_BY_NAME

#define DT_HWSPINLOCK_CTRL_BY_NAME ( node_id,
name )

#include <zephyr/devicetree/hwspinlock.h>

Value:
DT_PHANDLE_BY_NAME(node_id, hwlocks, name)
#define DT_PHANDLE_BY_NAME(node_id, pha, name)
Get a phandle's node identifier from a phandle array by name.
Definition devicetree.h:1733

Get the node identifier for the hardware spinlock controller from a hwlocks property by name.

Example devicetree fragment:

hwlock1: hwspinlock-controller@... { ... };
hwlock2: hwspinlock-controller@... { ... };

n: node {
        hwlocks = <&hwlock1 8>,
                  <&hwlock2 1>;
        hwlock-names = "rd", "wr";
};

Example usage:

DT_HWSPINLOCK_CTRL_BY_NAME(DT_NODELABEL(n), rd) // DT_NODELABEL(hwlock1)
DT_HWSPINLOCK_CTRL_BY_NAME(DT_NODELABEL(n), wr) // DT_NODELABEL(hwlock2)
Parameters
node_idnode identifier for a node with a hwlocks property
namelowercase-and-underscores name of a hwlocks element as defined by the node's hwlocks-names property
Returns
the node identifier for the hardware spinlock controller in the named element
See also
DT_PHANDLE_BY_NAME()

◆ DT_HWSPINLOCK_ID_BY_IDX

#define DT_HWSPINLOCK_ID_BY_IDX ( node_id,
idx )

#include <zephyr/devicetree/hwspinlock.h>

Value:
DT_PHA_BY_IDX(node_id, hwlocks, idx, id)
#define DT_PHA_BY_IDX(node_id, pha, idx, cell)
Get a phandle-array specifier cell value at an index.
Definition devicetree.h:1564

Get a hardware spinlock id by index.

Example devicetree fragment:

hwlock1: hwspinlock-controller@... {
        #hwlock-cells = <1>;
};

n: node {
        hwlocks = <&hwlock1 1>,
                  <&hwlock1 6>;
};

Example usage:

DT_HWSPINLOCK_ID_BY_IDX(DT_NODELABEL(n), 0) // 1
DT_HWSPINLOCK_ID_BY_IDX(DT_NODELABEL(n), 1) // 6
Parameters
node_idnode identifier for a node with a hwlocks property
idxindex of a hwlocks element in the hwlocks
Returns
the channel value in the specifier at the named element or 0 if no channels are supported
See also
DT_PHA_BY_IDX()

◆ DT_HWSPINLOCK_ID_BY_NAME

#define DT_HWSPINLOCK_ID_BY_NAME ( node_id,
name )

#include <zephyr/devicetree/hwspinlock.h>

Value:
DT_PHA_BY_NAME(node_id, hwlocks, name, id)
#define DT_PHA_BY_NAME(node_id, pha, name, cell)
Get a value within a phandle-array specifier by name.
Definition devicetree.h:1659

Get a hardware spinlock id by name.

Example devicetree fragment:

hwlock1: hwspinlock-controller@... {
        #hwlock-cells = <1>;
};

n: node {
        hwlocks = <&hwlock1 1>,
                  <&hwlock1 6>;
        hwlock-names = "rd", "wr";
};

Bindings fragment for the hwspinlock compatible:

hwlock-cells:
  - id

Example usage:

DT_HWSPINLOCK_ID_BY_NAME(DT_NODELABEL(n), rd) // 1
DT_HWSPINLOCK_ID_BY_NAME(DT_NODELABEL(n), wr) // 6
Parameters
node_idnode identifier for a node with a hwlocks property
namelowercase-and-underscores name of a hwlocks element as defined by the node's hwlock-names property
Returns
the channel value in the specifier at the named element or 0 if no channels are supported
See also
DT_PHA_BY_NAME()