1 /* 2 * Copyright (c) 2017 Oticon A/S 3 * 4 * SPDX-License-Identifier: Apache-2.0 5 */ 6 7 #ifndef _IRQ_CTRL_H 8 #define _IRQ_CTRL_H 9 10 #include <stdint.h> 11 12 #ifdef __cplusplus 13 extern "C" { 14 #endif 15 16 void hw_irq_ctrl_init(void); 17 void hw_irq_ctrl_cleanup(void); 18 void hw_irq_ctrl_raise_im(uint32_t irq); 19 uint64_t hw_irq_ctrl_get_irq_status(); 20 void hw_irq_ctrl_clear_all_irqs(); 21 void hw_irq_ctrl_clear_irq(unsigned int irq); 22 void hw_irq_ctrl_reeval_level_irq(unsigned int irq); 23 void hw_irq_controller_set_irq_mask(uint64_t mask); 24 uint64_t hw_irq_ctrl_get_irq_mask(); 25 void hw_irq_ctrl_enable_irq(unsigned int irq); 26 void hw_irq_ctrl_disable_irq(unsigned int irq); 27 int hw_irq_ctrl_is_irq_enabled(unsigned int irq); 28 void hw_irq_ctrl_timer_triggered(); 29 void hw_irq_ctrl_set_irq(unsigned int irq); 30 void hw_irq_ctrl_raise_level_irq_line(unsigned int irq); 31 void hw_irq_ctrl_lower_level_irq_line(unsigned int irq); 32 void hw_irq_ctrl_raise_im(unsigned int irq); 33 void hw_irq_ctrl_raise_im_from_sw(unsigned int irq); 34 uint32_t hw_irq_ctrl_get_current_lock(void); 35 int hw_irq_ctrl_get_highest_prio_irq(void); 36 int hw_irq_ctrl_get_cur_prio(void); 37 void hw_irq_ctrl_set_cur_prio(int new); 38 uint8_t hw_irq_ctrl_get_prio(unsigned int irq); 39 void hw_irq_ctrl_prio_set(unsigned int irq, unsigned int prio); 40 uint32_t hw_irq_ctrl_change_lock(uint32_t new_lock); 41 const char *hw_irq_ctrl_get_name(unsigned int irq); 42 43 /* 44 * This interrupt will awake the CPU if IRQs are not locked, 45 * This interrupt does not have an associated status bit or handler 46 */ 47 #define PHONY_WEAK_IRQ 0xFFFE 48 /* 49 * This interrupt will awake the CPU even if IRQs are locked, 50 * This interrupt does not have an associated status bit or handler 51 * (the lock is only ignored when the interrupt is raised from the HW models, 52 * SW threads should not try to use this) 53 */ 54 #define PHONY_HARD_IRQ 0xFFFF 55 56 #define NRF_HW_NBR_IRQs 47 57 58 #ifdef __cplusplus 59 } 60 #endif 61 62 #endif 63