Zephyr API Documentation 4.5.99
A Scalable Open Source RTOS
Loading...
Searching...
No Matches
Devicetree Interrupt CPU API

Macros

#define DT_FOREACH_CPU(fn)
 Invokes fn for each CPU node in the devicetree's "/cpus" node.
#define DT_FOREACH_CPU_SEP(fn, sep)
 Invokes fn for each CPU node in the devicetree's "/cpus" node, with a separator.
#define DT_FOREACH_CPU_VARGS(fn, ...)
 Invokes fn for each CPU node in the devicetree's "/cpus" node, with multiple arguments.
#define DT_FOREACH_CPU_SEP_VARGS(fn, sep, ...)
 Invokes fn for each CPU node in the devicetree's "/cpus" node, with a separator and multiple arguments.
#define DT_FOREACH_CPU_STATUS_OKAY(fn)
 Invokes fn for each CPU node in the devicetree's "/cpus" node whose status is "okay".
#define DT_FOREACH_CPU_STATUS_OKAY_SEP(fn, sep)
 Invokes fn for each CPU node in the devicetree's "/cpus" node whose status is "okay", with a separator.
#define DT_FOREACH_CPU_STATUS_OKAY_SEP_VARGS(fn, sep, ...)
 Invokes fn for each CPU node in the devicetree's "/cpus" node whose status is "okay", with a separator and multiple arguments.

Detailed Description

Macro Definition Documentation

◆ DT_FOREACH_CPU

#define DT_FOREACH_CPU ( fn)

#include <zephyr/devicetree/cpu.h>

Value:
DT_FOREACH_CPU_HELPER(fn)

Invokes fn for each CPU node in the devicetree's "/cpus" node.

The macro fn must take one parameter, which will be the node identifier of a "/cpus/cpu@N" node. The list is determined at build time by the Python devicetree tooling (edt.cpus) using a structural check: direct children of "/cpus" whose name prefix is "cpu". Children of "/cpus" that do not match (e.g. "power-states") are excluded.

Example devicetree fragment:

cpus {
cpu0: cpu@0 {
device_type = "cpu";
reg = <0>;
};
cpu1: cpu@1 {
device_type = "cpu";
reg = <1>;
};
power-states {
idle: idle { ... };
};
};

Example usage:

#define REG_AND_COMMA(node_id) DT_REG_ADDR(node_id),
const uint32_t cpu_regs[] = {
DT_FOREACH_CPU(REG_AND_COMMA)
};
#define DT_FOREACH_CPU(fn)
Invokes fn for each CPU node in the devicetree's "/cpus" node.
Definition cpu.h:75
__UINT32_TYPE__ uint32_t
Definition stdint.h:90

This expands to:

const uint32_t cpu_regs[] = {
0, 1,
};

Notice that "power-states" is excluded.

Parameters
fnmacro to invoke

◆ DT_FOREACH_CPU_SEP

#define DT_FOREACH_CPU_SEP ( fn,
sep )

#include <zephyr/devicetree/cpu.h>

Value:
DT_FOREACH_CPU_SEP_HELPER(fn, sep)

Invokes fn for each CPU node in the devicetree's "/cpus" node, with a separator.

sep is placed after each invocation of fn, not between invocations. This means the expansion has a trailing sep, which is convenient for initializers since a trailing comma is legal.

Example usage:

const uint32_t cpu_regs[] = {
};
#define DT_FOREACH_CPU_SEP(fn, sep)
Invokes fn for each CPU node in the devicetree's "/cpus" node, with a separator.
Definition cpu.h:100
#define DT_REG_ADDR(node_id)
Get a node's (only) register block address.
Definition devicetree.h:2881
Parameters
fnmacro to invoke
sepSeparator (e.g. comma or semicolon) placed after each invocation of fn. Must be in parentheses; this is required to enable providing a comma as separator.
See also
DT_FOREACH_CPU

◆ DT_FOREACH_CPU_SEP_VARGS

#define DT_FOREACH_CPU_SEP_VARGS ( fn,
sep,
... )

#include <zephyr/devicetree/cpu.h>

Value:
DT_FOREACH_CPU_SEP_VARGS_HELPER(fn, sep, __VA_ARGS__)

Invokes fn for each CPU node in the devicetree's "/cpus" node, with a separator and multiple arguments.

Parameters
fnmacro to invoke
sepSeparator (e.g. comma or semicolon) placed after each invocation of fn. Must be in parentheses; this is required to enable providing a comma as separator.
...variable number of arguments to pass to fn
See also
DT_FOREACH_CPU_SEP

◆ DT_FOREACH_CPU_STATUS_OKAY

#define DT_FOREACH_CPU_STATUS_OKAY ( fn)

#include <zephyr/devicetree/cpu.h>

Value:
DT_FOREACH_CPU_OKAY_HELPER(fn)

Invokes fn for each CPU node in the devicetree's "/cpus" node whose status is "okay".

Parameters
fnmacro to invoke
See also
DT_FOREACH_CPU

◆ DT_FOREACH_CPU_STATUS_OKAY_SEP

#define DT_FOREACH_CPU_STATUS_OKAY_SEP ( fn,
sep )

#include <zephyr/devicetree/cpu.h>

Value:
DT_FOREACH_CPU_OKAY_SEP_HELPER(fn, sep)

Invokes fn for each CPU node in the devicetree's "/cpus" node whose status is "okay", with a separator.

Parameters
fnmacro to invoke
sepSeparator (e.g. comma or semicolon) placed after each invocation of fn. Must be in parentheses; this is required to enable providing a comma as separator.
See also
DT_FOREACH_CPU_SEP

◆ DT_FOREACH_CPU_STATUS_OKAY_SEP_VARGS

#define DT_FOREACH_CPU_STATUS_OKAY_SEP_VARGS ( fn,
sep,
... )

#include <zephyr/devicetree/cpu.h>

Value:
DT_FOREACH_CPU_OKAY_SEP_VARGS_HELPER(fn, sep, __VA_ARGS__)

Invokes fn for each CPU node in the devicetree's "/cpus" node whose status is "okay", with a separator and multiple arguments.

Parameters
fnmacro to invoke
sepSeparator (e.g. comma or semicolon) placed after each invocation of fn. Must be in parentheses; this is required to enable providing a comma as separator.
...variable number of arguments to pass to fn
See also
DT_FOREACH_CPU_STATUS_OKAY_SEP

◆ DT_FOREACH_CPU_VARGS

#define DT_FOREACH_CPU_VARGS ( fn,
... )

#include <zephyr/devicetree/cpu.h>

Value:
DT_FOREACH_CPU_VARGS_HELPER(fn, __VA_ARGS__)

Invokes fn for each CPU node in the devicetree's "/cpus" node, with multiple arguments.

The macro fn takes multiple arguments. The first should be the node identifier for the "/cpus" child node. The remaining are passed-in by the caller.

Parameters
fnmacro to invoke
...variable number of arguments to pass to fn
See also
DT_FOREACH_CPU