diff --git a/include/irq_nextlevel.h b/include/irq_nextlevel.h index d118d9c7cd..ccda57d8e8 100644 --- a/include/irq_nextlevel.h +++ b/include/irq_nextlevel.h @@ -25,12 +25,15 @@ typedef void (*irq_next_level_func_t)(struct device *dev, unsigned int irq); typedef unsigned int (*irq_next_level_get_state_t)(struct device *dev); typedef void (*irq_next_level_priority_t)(struct device *dev, unsigned int irq, unsigned int prio, u32_t flags); +typedef int (*irq_next_level_get_line_state_t)(struct device *dev, + unsigned int irq); struct irq_next_level_api { irq_next_level_func_t intr_enable; irq_next_level_func_t intr_disable; irq_next_level_get_state_t intr_get_state; irq_next_level_priority_t intr_set_priority; + irq_next_level_get_line_state_t intr_get_line_state; }; /** * @endcond @@ -109,6 +112,24 @@ static inline void irq_set_priority_next_level(struct device *dev, u32_t irq, api->intr_set_priority(dev, irq, prio, flags); } +/** + * @brief Get IRQ line enable state. + * + * Query if a particular IRQ line is enabled. + * + * @param dev Pointer to the device structure for the driver instance. + * @param irq IRQ line to be queried. + * + * @return interrupt enable state, true or false + */ +static inline unsigned int irq_line_is_enabled_next_level(struct device *dev, + unsigned int irq) +{ + const struct irq_next_level_api *api = dev->driver_api; + + return api->intr_get_line_state(dev, irq); +} + /** * @} */