From d3e3552f65db6f6961e0963084838ebe2c89f911 Mon Sep 17 00:00:00 2001 From: Daniel Leung Date: Tue, 27 Aug 2019 11:07:19 -0700 Subject: [PATCH] irq_nextlevel: add API to query if an IRQ line is enabled There is an API to query if any IRQ is enabled but there is none to query individual IRQ line. So add one. Signed-off-by: Daniel Leung --- include/irq_nextlevel.h | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) 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); +} + /** * @} */