LCOV - code coverage report
Current view: top level - zephyr - shared_irq.h Hit Total Coverage
Test: new.info Lines: 3 12 25.0 %
Date: 2024-12-22 00:14:23

          Line data    Source code
       1           0 : /* 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
      15             : extern "C" {
      16             : #endif
      17             : 
      18           0 : typedef int (*isr_t)(const struct device *dev, unsigned int irq_number);
      19             : 
      20             : /* driver API definition */
      21           0 : typedef int (*shared_irq_register_t)(const struct device *dev,
      22             :                                      isr_t isr_func,
      23             :                                      const struct device *isr_dev);
      24           0 : typedef int (*shared_irq_enable_t)(const struct device *dev,
      25             :                                    const struct device *isr_dev);
      26           0 : typedef int (*shared_irq_disable_t)(const struct device *dev,
      27             :                                     const struct device *isr_dev);
      28             : 
      29           0 : __subsystem struct shared_irq_driver_api {
      30           0 :         shared_irq_register_t isr_register;
      31           0 :         shared_irq_enable_t enable;
      32           0 :         shared_irq_disable_t disable;
      33             : };
      34             : 
      35             : /**
      36             :  *  @brief Register a device ISR
      37             :  *  @param dev Pointer to device structure for SHARED_IRQ driver instance.
      38             :  *  @param isr_func Pointer to the ISR function for the device.
      39             :  *  @param isr_dev Pointer to the device that will service the interrupt.
      40             :  */
      41           1 : static 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             : 
      51             : /**
      52             :  *  @brief Enable ISR for device
      53             :  *  @param dev Pointer to device structure for SHARED_IRQ driver instance.
      54             :  *  @param isr_dev Pointer to the device that will service the interrupt.
      55             :  */
      56           1 : static 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             : 
      65             : /**
      66             :  *  @brief Disable ISR for device
      67             :  *  @param dev Pointer to device structure for SHARED_IRQ driver instance.
      68             :  *  @param isr_dev Pointer to the device that will service the interrupt.
      69             :  */
      70           1 : static 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_ */

Generated by: LCOV version 1.14