Zephyr API Documentation  2.7.0-rc2
A Scalable Open Source RTOS
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
24typedef void (*irq_next_level_func_t)(const struct device *dev,
25 unsigned int irq);
26typedef unsigned int (*irq_next_level_get_state_t)(const struct device *dev);
27typedef void (*irq_next_level_priority_t)(const struct device *dev,
28 unsigned int irq, unsigned int prio,
30typedef int (*irq_next_level_get_line_state_t)(const struct device *dev,
31 unsigned int irq);
32
33struct irq_next_level_api {
34 irq_next_level_func_t intr_enable;
35 irq_next_level_func_t intr_disable;
36 irq_next_level_get_state_t intr_get_state;
37 irq_next_level_priority_t intr_set_priority;
38 irq_next_level_get_line_state_t intr_get_line_state;
39};
54static inline void irq_enable_next_level(const struct device *dev,
55 uint32_t irq)
56{
57 const struct irq_next_level_api *api =
58 (const struct irq_next_level_api *)dev->api;
59
60 api->intr_enable(dev, irq);
61}
62
73static inline void irq_disable_next_level(const struct device *dev,
74 uint32_t irq)
75{
76 const struct irq_next_level_api *api =
77 (const struct irq_next_level_api *)dev->api;
78
79 api->intr_disable(dev, irq);
80}
81
92static inline unsigned int irq_is_enabled_next_level(const struct device *dev)
93{
94 const struct irq_next_level_api *api =
95 (const struct irq_next_level_api *)dev->api;
96
97 return api->intr_get_state(dev);
98}
99
113static inline void irq_set_priority_next_level(const struct device *dev,
114 uint32_t irq,
115 uint32_t prio, uint32_t flags)
116{
117 const struct irq_next_level_api *api =
118 (const struct irq_next_level_api *)dev->api;
119
120 if (api->intr_set_priority)
121 api->intr_set_priority(dev, irq, prio, flags);
122}
123
134static inline unsigned int irq_line_is_enabled_next_level(const struct device *dev,
135 unsigned int irq)
136{
137 const struct irq_next_level_api *api =
138 (const struct irq_next_level_api *)dev->api;
139
140 return api->intr_get_line_state(dev, irq);
141}
142
143#ifdef __cplusplus
144}
145#endif
146
147#endif /* ZEPHYR_INCLUDE_IRQ_NEXTLEVEL_H_ */
void
Definition: eswifi_shell.c:15
flags
Definition: http_parser.h:131
static void irq_enable_next_level(const struct device *dev, uint32_t irq)
Enable an IRQ in the next level.
Definition: irq_nextlevel.h:54
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:134
static unsigned int irq_is_enabled_next_level(const struct device *dev)
Get IRQ enable state.
Definition: irq_nextlevel.h:92
static void irq_disable_next_level(const struct device *dev, uint32_t irq)
Disable an IRQ in the next level.
Definition: irq_nextlevel.h:73
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:113
__UINT32_TYPE__ uint32_t
Definition: stdint.h:60
Runtime device structure (in ROM) per driver instance.
Definition: device.h:367
const void * api
Definition: device.h:373