Zephyr API Documentation  2.7.0-rc2
A Scalable Open Source RTOS
interrupts property

Macros

#define DT_NUM_IRQS(node_id)   DT_CAT(node_id, _IRQ_NUM)
 Get the number of interrupt sources for the node. More...
 
#define DT_IRQ_HAS_IDX(node_id, idx)    IS_ENABLED(DT_CAT(node_id, _IRQ_IDX_##idx##_EXISTS))
 Is "idx" a valid interrupt index? More...
 
#define DT_IRQ_HAS_CELL_AT_IDX(node_id, idx, cell)    IS_ENABLED(DT_CAT(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. If it returns 0, it is an error to use that macro. More...
 
#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) More...
 
#define DT_IRQ_HAS_NAME(node_id, name)    IS_ENABLED(DT_CAT(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. If it returns 0, it is an error to use that macro. More...
 
#define DT_IRQ_BY_IDX(node_id, idx, cell)    DT_CAT(node_id, _IRQ_IDX_##idx##_VAL_##cell)
 Get a value within an interrupt specifier at an index. More...
 
#define DT_IRQ_BY_NAME(node_id, name, cell)    DT_CAT(node_id, _IRQ_NAME_##name##_VAL_##cell)
 Get a value within an interrupt specifier by name. More...
 
#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). More...
 
#define DT_IRQN(node_id)   DT_IRQ(node_id, irq)
 Get a node's (only) irq number. More...
 

Detailed Description

Macro Definition Documentation

◆ DT_IRQ

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

#include <include/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_CAT(node_id, _IRQ_IDX_##idx##_VAL_##cell)

#include <include/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@... {
        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_CAT(node_id, _IRQ_NAME_##name##_VAL_##cell)

#include <include/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 <include/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_CAT(node_id, _IRQ_IDX_##idx##_VAL_##cell##_EXISTS))

#include <include/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_CAT(node_id, _IRQ_IDX_##idx##_EXISTS))

#include <include/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_CAT(node_id, _IRQ_NAME_##name##_VAL_irq_EXISTS))

#include <include/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_IRQN

#define DT_IRQN (   node_id)    DT_IRQ(node_id, irq)

#include <include/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_NUM_IRQS

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

#include <include/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.