LCOV - code coverage report
Current view: top level - zephyr - irq_nextlevel.h Coverage Total Hit
Test: new.info Lines: 100.0 % 6 6
Test Date: 2025-09-05 20:47:19

            Line data    Source code
       1            1 : /*
       2              :  * Copyright (c) 2017 Intel corporation
       3              :  *
       4              :  * SPDX-License-Identifier: Apache-2.0
       5              :  */
       6              : 
       7              : /**
       8              :  * @file
       9              :  * @brief Public interface for configuring interrupts
      10              :  */
      11              : #ifndef ZEPHYR_INCLUDE_IRQ_NEXTLEVEL_H_
      12              : #define ZEPHYR_INCLUDE_IRQ_NEXTLEVEL_H_
      13              : 
      14              : #ifdef __cplusplus
      15              : extern "C" {
      16              : #endif
      17              : 
      18              : #if defined(CONFIG_MULTI_LEVEL_INTERRUPTS) || defined(__DOXYGEN__)
      19              : /**
      20              :  * @cond INTERNAL_HIDDEN
      21              :  *
      22              :  * These are for internal use only, so skip these in
      23              :  * public documentation.
      24              :  */
      25              : typedef void (*irq_next_level_func_t)(const struct device *dev,
      26              :                                       unsigned int irq);
      27              : typedef unsigned int (*irq_next_level_get_state_t)(const struct device *dev);
      28              : typedef void (*irq_next_level_priority_t)(const struct device *dev,
      29              :                                           unsigned int irq, unsigned int prio,
      30              :                                           uint32_t flags);
      31              : typedef int (*irq_next_level_get_line_state_t)(const struct device *dev,
      32              :                                                unsigned int irq);
      33              : 
      34              : struct 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              : };
      41              : /**
      42              :  * @endcond
      43              :  */
      44              : 
      45              : /**
      46              :  * @brief Enable an IRQ in the next level.
      47              :  *
      48              :  * This routine enables interrupts present in the interrupt controller.
      49              :  *
      50              :  * @param dev Pointer to the device structure for the driver instance.
      51              :  * @param irq IRQ to be enabled.
      52              :  */
      53            1 : static 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              : 
      62              : /**
      63              :  * @brief Disable an IRQ in the next level.
      64              :  *
      65              :  * This routine disables interrupts present in the interrupt controller.
      66              :  *
      67              :  * @param dev Pointer to the device structure for the driver instance.
      68              :  * @param irq IRQ to be disabled.
      69              :  */
      70            1 : static 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              : 
      79              : /**
      80              :  * @brief Get IRQ enable state.
      81              :  *
      82              :  * This routine indicates if any interrupts are enabled in the interrupt
      83              :  * controller.
      84              :  *
      85              :  * @param dev Pointer to the device structure for the driver instance.
      86              :  *
      87              :  * @return interrupt enable state, true or false
      88              :  */
      89            1 : static 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              : 
      97              : /**
      98              :  * @brief Set IRQ priority.
      99              :  *
     100              :  * This routine indicates if any interrupts are enabled in the interrupt
     101              :  * controller.
     102              :  *
     103              :  * @param dev Pointer to the device structure for the driver instance.
     104              :  * @param irq IRQ to be disabled.
     105              :  * @param prio priority for irq in the interrupt controller.
     106              :  * @param flags controller specific flags.
     107              :  */
     108            1 : static 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              : }
     119              : 
     120              : /**
     121              :  * @brief Get IRQ line enable state.
     122              :  *
     123              :  * Query if a particular IRQ line is enabled.
     124              :  *
     125              :  * @param dev Pointer to the device structure for the driver instance.
     126              :  * @param irq IRQ line to be queried.
     127              :  *
     128              :  * @return interrupt enable state, true or false
     129              :  */
     130            1 : static inline unsigned int irq_line_is_enabled_next_level(const struct device *dev,
     131              :                                                           unsigned int irq)
     132              : {
     133              :         const struct irq_next_level_api *api =
     134              :                 (const struct irq_next_level_api *)dev->api;
     135              : 
     136              :         return api->intr_get_line_state(dev, irq);
     137              : }
     138              : 
     139              : #endif /* CONFIG_MULTI_LEVEL_INTERRUPTS */
     140              : #ifdef __cplusplus
     141              : }
     142              : #endif
     143              : 
     144              : #endif /* ZEPHYR_INCLUDE_IRQ_NEXTLEVEL_H_ */
        

Generated by: LCOV version 2.0-1