Zephyr API Documentation 4.0.99
A Scalable Open Source RTOS
Loading...
Searching...
No Matches
irq_nextlevel.h
Go to the documentation of this file.
1/*
2 * Copyright (c) 2017 Intel corporation
3 *
4 * SPDX-License-Identifier: Apache-2.0
5 */
6
11#ifndef ZEPHYR_INCLUDE_IRQ_NEXTLEVEL_H_
12#define ZEPHYR_INCLUDE_IRQ_NEXTLEVEL_H_
13
14#ifdef __cplusplus
15extern "C" {
16#endif
17
18#if defined(CONFIG_MULTI_LEVEL_INTERRUPTS) || defined(__DOXYGEN__)
25typedef void (*irq_next_level_func_t)(const struct device *dev,
26 unsigned int irq);
27typedef unsigned int (*irq_next_level_get_state_t)(const struct device *dev);
28typedef void (*irq_next_level_priority_t)(const struct device *dev,
29 unsigned int irq, unsigned int prio,
31typedef int (*irq_next_level_get_line_state_t)(const struct device *dev,
32 unsigned int irq);
33
34struct irq_next_level_api {
35 irq_next_level_func_t intr_enable;
36 irq_next_level_func_t intr_disable;
37 irq_next_level_get_state_t intr_get_state;
38 irq_next_level_priority_t intr_set_priority;
39 irq_next_level_get_line_state_t intr_get_line_state;
40};
53static inline void irq_enable_next_level(const struct device *dev,
54 uint32_t irq)
55{
56 const struct irq_next_level_api *api =
57 (const struct irq_next_level_api *)dev->api;
58
59 api->intr_enable(dev, irq);
60}
61
70static inline void irq_disable_next_level(const struct device *dev,
71 uint32_t irq)
72{
73 const struct irq_next_level_api *api =
74 (const struct irq_next_level_api *)dev->api;
75
76 api->intr_disable(dev, irq);
77}
78
89static inline unsigned int irq_is_enabled_next_level(const struct device *dev)
90{
91 const struct irq_next_level_api *api =
92 (const struct irq_next_level_api *)dev->api;
93
94 return api->intr_get_state(dev);
95}
96
108static inline void irq_set_priority_next_level(const struct device *dev,
109 uint32_t irq,
110 uint32_t prio, uint32_t flags)
111{
112 const struct irq_next_level_api *api =
113 (const struct irq_next_level_api *)dev->api;
114
115 if (api->intr_set_priority)
116 api->intr_set_priority(dev, irq, prio, flags);
117}
118
129static inline unsigned int irq_line_is_enabled_next_level(const struct device *dev,
130 unsigned int irq)
131{
132 const struct irq_next_level_api *api =
133 (const struct irq_next_level_api *)dev->api;
134
135 return api->intr_get_line_state(dev, irq);
136}
137
138#endif /* CONFIG_MULTI_LEVEL_INTERRUPTS */
139#ifdef __cplusplus
140}
141#endif
142
143#endif /* ZEPHYR_INCLUDE_IRQ_NEXTLEVEL_H_ */
static void irq_enable_next_level(const struct device *dev, uint32_t irq)
Enable an IRQ in the next level.
Definition irq_nextlevel.h:53
static unsigned int irq_line_is_enabled_next_level(const struct device *dev, unsigned int irq)
Get IRQ line enable state.
Definition irq_nextlevel.h:129
static unsigned int irq_is_enabled_next_level(const struct device *dev)
Get IRQ enable state.
Definition irq_nextlevel.h:89
static void irq_disable_next_level(const struct device *dev, uint32_t irq)
Disable an IRQ in the next level.
Definition irq_nextlevel.h:70
static void irq_set_priority_next_level(const struct device *dev, uint32_t irq, uint32_t prio, uint32_t flags)
Set IRQ priority.
Definition irq_nextlevel.h:108
flags
Definition parser.h:96
__UINT32_TYPE__ uint32_t
Definition stdint.h:90
Runtime device structure (in ROM) per driver instance.
Definition device.h:411
const void * api
Address of the API structure exposed by the device instance.
Definition device.h:417