Zephyr API Documentation  3.6.99
A Scalable Open Source RTOS
Loading...
Searching...
No Matches
interrupts property

Macros

#define DT_NUM_IRQS(node_id)   DT_CAT(node_id, _IRQ_NUM)
 Get the number of interrupt sources for the node.
 
#define DT_IRQ_LEVEL(node_id)   DT_CAT(node_id, _IRQ_LEVEL)
 Get the interrupt level for the node.
 
#define DT_IRQ_HAS_IDX(node_id, idx)    IS_ENABLED(DT_CAT4(node_id, _IRQ_IDX_, idx, _EXISTS))
 Is idx a valid interrupt index?
 
#define DT_IRQ_HAS_CELL_AT_IDX(node_id, idx, cell)    IS_ENABLED(DT_CAT6(node_id, _IRQ_IDX_, idx, _VAL_, cell, _EXISTS))
 Does an interrupts property have a named cell specifier at an index? If this returns 1, then DT_IRQ_BY_IDX(node_id, idx, cell) is valid.
 
#define DT_IRQ_HAS_CELL(node_id, cell)   DT_IRQ_HAS_CELL_AT_IDX(node_id, 0, cell)
 Equivalent to DT_IRQ_HAS_CELL_AT_IDX(node_id, 0, cell)
 
#define DT_IRQ_HAS_NAME(node_id, name)    IS_ENABLED(DT_CAT4(node_id, _IRQ_NAME_, name, _VAL_irq_EXISTS))
 Does an interrupts property have a named specifier value at an index? If this returns 1, then DT_IRQ_BY_NAME(node_id, name, cell) is valid.
 
#define DT_IRQ_BY_IDX(node_id, idx, cell)    DT_CAT5(node_id, _IRQ_IDX_, idx, _VAL_, cell)
 Get a value within an interrupt specifier at an index.
 
#define DT_IRQ_BY_NAME(node_id, name, cell)    DT_CAT5(node_id, _IRQ_NAME_, name, _VAL_, cell)
 Get a value within an interrupt specifier by name.
 
#define DT_IRQ(node_id, cell)   DT_IRQ_BY_IDX(node_id, 0, cell)
 Get an interrupt specifier's value Equivalent to DT_IRQ_BY_IDX(node_id, 0, cell).
 
#define DT_IRQ_INTC_BY_IDX(node_id, idx)    DT_CAT4(node_id, _IRQ_IDX_, idx, _CONTROLLER)
 Get an interrupt specifier's interrupt controller by index.
 
#define DT_IRQ_INTC_BY_NAME(node_id, name)    DT_CAT4(node_id, _IRQ_NAME_, name, _CONTROLLER)
 Get an interrupt specifier's interrupt controller by name.
 
#define DT_IRQ_INTC(node_id)    DT_IRQ_INTC_BY_IDX(node_id, 0)
 Get an interrupt specifier's interrupt controller.
 
#define DT_IRQN_BY_IDX(node_id, idx)
 Get the node's Zephyr interrupt number at index If CONFIG_MULTI_LEVEL_INTERRUPTS is enabled, the interrupt number at index will be multi-level encoded.
 
#define DT_IRQN(node_id)   DT_IRQN_BY_IDX(node_id, 0)
 Get a node's (only) irq number.
 

Detailed Description

Macro Definition Documentation

◆ DT_IRQ

#define DT_IRQ (   node_id,
  cell 
)    DT_IRQ_BY_IDX(node_id, 0, cell)

#include <zephyr/devicetree.h>

Get an interrupt specifier's value Equivalent to DT_IRQ_BY_IDX(node_id, 0, cell).

Parameters
node_idnode identifier
cellcell name specifier
Returns
the named value at that index

◆ DT_IRQ_BY_IDX

#define DT_IRQ_BY_IDX (   node_id,
  idx,
  cell 
)     DT_CAT5(node_id, _IRQ_IDX_, idx, _VAL_, cell)

#include <zephyr/devicetree.h>

Get a value within an interrupt specifier at an index.

It might help to read the argument order as being similar to "node->interrupts[index].cell".

This can be used to get information about an individual interrupt when a device generates more than one.

Example devicetree fragment:

my-serial: serial@abcd1234 {
interrupts = < 33 0 >, < 34 1 >;
};

Assuming the node's interrupt domain has "#interrupt-cells = <2>;" and the individual cells in each interrupt specifier are named "irq" and "priority" by the node's binding, here are some examples:

#define SERIAL DT_NODELABEL(my_serial)

Example usage                       Value
-------------                       -----
DT_IRQ_BY_IDX(SERIAL, 0, irq)          33
DT_IRQ_BY_IDX(SERIAL, 0, priority)      0
DT_IRQ_BY_IDX(SERIAL, 1, irq,          34
DT_IRQ_BY_IDX(SERIAL, 1, priority)      1
Parameters
node_idnode identifier
idxlogical index into the interrupt specifier array
cellcell name specifier
Returns
the named value at the specifier given by the index

◆ DT_IRQ_BY_NAME

#define DT_IRQ_BY_NAME (   node_id,
  name,
  cell 
)     DT_CAT5(node_id, _IRQ_NAME_, name, _VAL_, cell)

#include <zephyr/devicetree.h>

Get a value within an interrupt specifier by name.

It might help to read the argument order as being similar to node->interrupts.name.cell.

This can be used to get information about an individual interrupt when a device generates more than one, if the bindings give each interrupt specifier a name.

Parameters
node_idnode identifier
namelowercase-and-underscores interrupt specifier name
cellcell name specifier
Returns
the named value at the specifier given by the index

◆ DT_IRQ_HAS_CELL

#define DT_IRQ_HAS_CELL (   node_id,
  cell 
)    DT_IRQ_HAS_CELL_AT_IDX(node_id, 0, cell)

#include <zephyr/devicetree.h>

Equivalent to DT_IRQ_HAS_CELL_AT_IDX(node_id, 0, cell)

Parameters
node_idnode identifier
cellnamed cell value whose existence to check
Returns
1 if the named cell exists in the interrupt specifier at index 0 0 otherwise.

◆ DT_IRQ_HAS_CELL_AT_IDX

#define DT_IRQ_HAS_CELL_AT_IDX (   node_id,
  idx,
  cell 
)     IS_ENABLED(DT_CAT6(node_id, _IRQ_IDX_, idx, _VAL_, cell, _EXISTS))

#include <zephyr/devicetree.h>

Does an interrupts property have a named cell specifier at an index? If this returns 1, then DT_IRQ_BY_IDX(node_id, idx, cell) is valid.

If it returns 0, it is an error to use that macro.

Parameters
node_idnode identifier
idxindex to check
cellnamed cell value whose existence to check
Returns
1 if the named cell exists in the interrupt specifier at index idx 0 otherwise.

◆ DT_IRQ_HAS_IDX

#define DT_IRQ_HAS_IDX (   node_id,
  idx 
)     IS_ENABLED(DT_CAT4(node_id, _IRQ_IDX_, idx, _EXISTS))

#include <zephyr/devicetree.h>

Is idx a valid interrupt index?

If this returns 1, then DT_IRQ_BY_IDX(node_id, idx) is valid. If it returns 0, it is an error to use that macro with this index.

Parameters
node_idnode identifier
idxindex to check
Returns
1 if the idx is valid for the interrupt property 0 otherwise.

◆ DT_IRQ_HAS_NAME

#define DT_IRQ_HAS_NAME (   node_id,
  name 
)     IS_ENABLED(DT_CAT4(node_id, _IRQ_NAME_, name, _VAL_irq_EXISTS))

#include <zephyr/devicetree.h>

Does an interrupts property have a named specifier value at an index? If this returns 1, then DT_IRQ_BY_NAME(node_id, name, cell) is valid.

If it returns 0, it is an error to use that macro.

Parameters
node_idnode identifier
namelowercase-and-underscores interrupt specifier name
Returns
1 if "name" is a valid named specifier 0 otherwise.

◆ DT_IRQ_INTC

#define DT_IRQ_INTC (   node_id)     DT_IRQ_INTC_BY_IDX(node_id, 0)

#include <zephyr/devicetree.h>

Get an interrupt specifier's interrupt controller.

Note
Equivalent to DT_IRQ_INTC_BY_IDX(node_id, 0)
gpio0: gpio0 {
interrupt-controller;
#interrupt-cells = <2>;
};
foo: foo {
interrupt-parent = <&gpio0>;
interrupts = <1 1>;
};
bar: bar {
interrupts-extended = <&gpio0 3 3>;
};
pic0: pic0 {
interrupt-controller;
#interrupt-cells = <1>;
qux: qux {
interrupts = <5>;
};
};

Example usage:

DT_IRQ_INTC(DT_NODELABEL(foo)) // &gpio0
DT_IRQ_INTC(DT_NODELABEL(bar)) // &gpio0
DT_IRQ_INTC(DT_NODELABEL(qux)) // &pic0
Parameters
node_idnode identifier
Returns
node_id of interrupt specifier's interrupt controller
See also
DT_IRQ_INTC_BY_IDX()

◆ DT_IRQ_INTC_BY_IDX

#define DT_IRQ_INTC_BY_IDX (   node_id,
  idx 
)     DT_CAT4(node_id, _IRQ_IDX_, idx, _CONTROLLER)

#include <zephyr/devicetree.h>

Get an interrupt specifier's interrupt controller by index.

gpio0: gpio0 {
interrupt-controller;
#interrupt-cells = <2>;
};
foo: foo {
interrupt-parent = <&gpio0>;
interrupts = <1 1>, <2 2>;
};
bar: bar {
interrupts-extended = <&gpio0 3 3>, <&pic0 4>;
};
pic0: pic0 {
interrupt-controller;
#interrupt-cells = <1>;
qux: qux {
interrupts = <5>, <6>;
interrupt-names = "int1", "int2";
};
};

Example usage:

DT_IRQ_INTC_BY_IDX(DT_NODELABEL(foo), 0) // &gpio0
DT_IRQ_INTC_BY_IDX(DT_NODELABEL(foo), 1) // &gpio0
DT_IRQ_INTC_BY_IDX(DT_NODELABEL(bar), 0) // &gpio0
DT_IRQ_INTC_BY_IDX(DT_NODELABEL(bar), 1) // &pic0
DT_IRQ_INTC_BY_IDX(DT_NODELABEL(qux), 0) // &pic0
DT_IRQ_INTC_BY_IDX(DT_NODELABEL(qux), 1) // &pic0
Parameters
node_idnode identifier
idxinterrupt specifier's index
Returns
node_id of interrupt specifier's interrupt controller

◆ DT_IRQ_INTC_BY_NAME

#define DT_IRQ_INTC_BY_NAME (   node_id,
  name 
)     DT_CAT4(node_id, _IRQ_NAME_, name, _CONTROLLER)

#include <zephyr/devicetree.h>

Get an interrupt specifier's interrupt controller by name.

gpio0: gpio0 {
interrupt-controller;
#interrupt-cells = <2>;
};
foo: foo {
interrupt-parent = <&gpio0>;
interrupts = <1 1>, <2 2>;
interrupt-names = "int1", "int2";
};
bar: bar {
interrupts-extended = <&gpio0 3 3>, <&pic0 4>;
interrupt-names = "int1", "int2";
};
pic0: pic0 {
interrupt-controller;
#interrupt-cells = <1>;
qux: qux {
interrupts = <5>, <6>;
interrupt-names = "int1", "int2";
};
};

Example usage:

DT_IRQ_INTC_BY_NAME(DT_NODELABEL(foo), int1) // &gpio0
DT_IRQ_INTC_BY_NAME(DT_NODELABEL(foo), int2) // &gpio0
DT_IRQ_INTC_BY_NAME(DT_NODELABEL(bar), int1) // &gpio0
DT_IRQ_INTC_BY_NAME(DT_NODELABEL(bar), int2) // &pic0
DT_IRQ_INTC_BY_NAME(DT_NODELABEL(qux), int1) // &pic0
DT_IRQ_INTC_BY_NAME(DT_NODELABEL(qux), int2) // &pic0
Parameters
node_idnode identifier
nameinterrupt specifier's name
Returns
node_id of interrupt specifier's interrupt controller

◆ DT_IRQ_LEVEL

#define DT_IRQ_LEVEL (   node_id)    DT_CAT(node_id, _IRQ_LEVEL)

#include <zephyr/devicetree.h>

Get the interrupt level for the node.

Parameters
node_idnode identifier
Returns
interrupt level

◆ DT_IRQN

#define DT_IRQN (   node_id)    DT_IRQN_BY_IDX(node_id, 0)

#include <zephyr/devicetree.h>

Get a node's (only) irq number.

Equivalent to DT_IRQ(node_id, irq). This is provided as a convenience for the common case where a node generates exactly one interrupt, and the IRQ number is in a cell named irq.

Parameters
node_idnode identifier
Returns
the interrupt number for the node's only interrupt

◆ DT_IRQN_BY_IDX

#define DT_IRQN_BY_IDX (   node_id,
  idx 
)

#include <zephyr/devicetree.h>

Value:
COND_CODE_1(IS_ENABLED(CONFIG_MULTI_LEVEL_INTERRUPTS), \
(DT_MULTI_LEVEL_IRQN_INTERNAL(node_id, idx)), \
(DT_IRQ_BY_IDX(node_id, idx, irq)))
#define DT_IRQ_BY_IDX(node_id, idx, cell)
Get a value within an interrupt specifier at an index.
Definition: devicetree.h:2382
#define IS_ENABLED(config_macro)
Check for macro definition in compiler-visible expressions.
Definition: util_macro.h:124
#define COND_CODE_1(_flag, _if_1_code, _else_code)
Insert code depending on whether _flag expands to 1 or not.
Definition: util_macro.h:179

Get the node's Zephyr interrupt number at index If CONFIG_MULTI_LEVEL_INTERRUPTS is enabled, the interrupt number at index will be multi-level encoded.

Parameters
node_idnode identifier
idxlogical index into the interrupt specifier array
Returns
the Zephyr interrupt number

◆ DT_NUM_IRQS

#define DT_NUM_IRQS (   node_id)    DT_CAT(node_id, _IRQ_NUM)

#include <zephyr/devicetree.h>

Get the number of interrupt sources for the node.

Use this instead of DT_PROP_LEN(node_id, interrupts).

Parameters
node_idnode identifier
Returns
Number of interrupt specifiers in the node's "interrupts" property.