1 /*
2  * Copyright (c) 2024 Meta
3  *
4  * SPDX-License-Identifier: Apache-2.0
5  */
6 
7 /**
8  * @file
9  * @brief Interrupt controller devicetree macro public API header file.
10  */
11 
12 #ifndef ZEPHYR_INCLUDE_DEVICETREE_INTERRUPT_CONTROLLER_H_
13 #define ZEPHYR_INCLUDE_DEVICETREE_INTERRUPT_CONTROLLER_H_
14 
15 #ifdef __cplusplus
16 extern "C" {
17 #endif
18 
19 #include <zephyr/devicetree.h>
20 #include <zephyr/sys/util_macro.h>
21 
22 /**
23  * @defgroup devicetree-interrupt_controller Devicetree Interrupt Controller API
24  * @ingroup devicetree
25  * @{
26  */
27 
28 /**
29  * @brief Get the aggregator level of an interrupt controller
30  *
31  * @note Aggregator level is equivalent to IRQ_LEVEL + 1 (a 2nd level aggregator has Zephyr level 1
32  * IRQ encoding)
33  *
34  * @param node_id node identifier of an interrupt controller
35  *
36  * @return Level of the interrupt controller
37  */
38 #define DT_INTC_GET_AGGREGATOR_LEVEL(node_id) UTIL_INC(DT_IRQ_LEVEL(node_id))
39 
40 /**
41  * @brief Get the aggregator level of a `DT_DRV_COMPAT` interrupt controller
42  *
43  * @note Aggregator level is equivalent to IRQ_LEVEL + 1 (a 2nd level aggregator has Zephyr level 1
44  * IRQ encoding)
45  *
46  * @param inst instance of an interrupt controller
47  *
48  * @return Level of the interrupt controller
49  */
50 #define DT_INST_INTC_GET_AGGREGATOR_LEVEL(inst) DT_INTC_GET_AGGREGATOR_LEVEL(DT_DRV_INST(inst))
51 
52 /**
53  * @}
54  */
55 
56 #ifdef __cplusplus
57 }
58 #endif
59 
60 #endif /* ZEPHYR_INCLUDE_DEVICETREE_INTERRUPT_CONTROLLER_H_ */
61