Zephyr API Documentation 4.0.99
A Scalable Open Source RTOS
Loading...
Searching...
No Matches
shared_irq.h
Go to the documentation of this file.
1/* shared_irq - Shared interrupt driver */
2
3/*
4 * Copyright (c) 2015 - 2023 Intel corporation
5 *
6 * SPDX-License-Identifier: Apache-2.0
7 */
8
9#ifndef ZEPHYR_INCLUDE_SHARED_IRQ_H_
10#define ZEPHYR_INCLUDE_SHARED_IRQ_H_
11
12#include <zephyr/device.h>
13
14#ifdef __cplusplus
15extern "C" {
16#endif
17
18typedef int (*isr_t)(const struct device *dev, unsigned int irq_number);
19
20/* driver API definition */
21typedef int (*shared_irq_register_t)(const struct device *dev,
22 isr_t isr_func,
23 const struct device *isr_dev);
24typedef int (*shared_irq_enable_t)(const struct device *dev,
25 const struct device *isr_dev);
26typedef int (*shared_irq_disable_t)(const struct device *dev,
27 const struct device *isr_dev);
28
34
41static inline int shared_irq_isr_register(const struct device *dev,
42 isr_t isr_func,
43 const struct device *isr_dev)
44{
45 const struct shared_irq_driver_api *api =
46 (const struct shared_irq_driver_api *)dev->api;
47
48 return api->isr_register(dev, isr_func, isr_dev);
49}
50
56static inline int shared_irq_enable(const struct device *dev,
57 const struct device *isr_dev)
58{
59 const struct shared_irq_driver_api *api =
60 (const struct shared_irq_driver_api *)dev->api;
61
62 return api->enable(dev, isr_dev);
63}
64
70static inline int shared_irq_disable(const struct device *dev,
71 const struct device *isr_dev)
72{
73 const struct shared_irq_driver_api *api =
74 (const struct shared_irq_driver_api *)dev->api;
75
76 return api->disable(dev, isr_dev);
77}
78
79#ifdef __cplusplus
80}
81#endif
82
83#endif /* ZEPHYR_INCLUDE_SHARED_IRQ_H_ */
int(* shared_irq_enable_t)(const struct device *dev, const struct device *isr_dev)
Definition shared_irq.h:24
int(* shared_irq_disable_t)(const struct device *dev, const struct device *isr_dev)
Definition shared_irq.h:26
static int shared_irq_isr_register(const struct device *dev, isr_t isr_func, const struct device *isr_dev)
Register a device ISR.
Definition shared_irq.h:41
static int shared_irq_disable(const struct device *dev, const struct device *isr_dev)
Disable ISR for device.
Definition shared_irq.h:70
int(* shared_irq_register_t)(const struct device *dev, isr_t isr_func, const struct device *isr_dev)
Definition shared_irq.h:21
static int shared_irq_enable(const struct device *dev, const struct device *isr_dev)
Enable ISR for device.
Definition shared_irq.h:56
int(* isr_t)(const struct device *dev, unsigned int irq_number)
Definition shared_irq.h:18
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
Definition shared_irq.h:29
shared_irq_disable_t disable
Definition shared_irq.h:32
shared_irq_enable_t enable
Definition shared_irq.h:31
shared_irq_register_t isr_register
Definition shared_irq.h:30