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();
17 void hw_irq_ctrl_raise_im(uint32_t irq);
18 uint64_t hw_irq_ctrl_get_irq_status();
19 void hw_irq_ctrl_clear_all_irqs();
20 void hw_irq_ctrl_clear_irq(unsigned int irq);
21 void hw_irq_controller_set_irq_mask(uint64_t mask);
22 uint64_t hw_irq_ctrl_get_irq_mask();
23 void hw_irq_ctrl_enable_irq(unsigned int irq);
24 void hw_irq_ctrl_disable_irq(unsigned int irq);
25 int hw_irq_ctrl_is_irq_enabled(unsigned int irq);
26 void hw_irq_ctrl_timer_triggered();
27 void hw_irq_ctrl_set_irq(unsigned int irq);
28 void hw_irq_ctrl_raise_im(unsigned int irq);
29 void hw_irq_ctrl_raise_im_from_sw(unsigned int irq);
30 uint32_t hw_irq_ctrl_get_current_lock(void);
31 int hw_irq_ctrl_get_highest_prio_irq(void);
32 int hw_irq_ctrl_get_cur_prio(void);
33 void hw_irq_ctrl_set_cur_prio(int new);
34 uint8_t hw_irq_ctrl_get_prio(unsigned int irq);
35 void hw_irq_ctrl_prio_set(unsigned int irq, unsigned int prio);
36 uint32_t hw_irq_ctrl_change_lock(uint32_t new_lock);
37 
38 /*
39  * This interrupt will awake the CPU if IRQs are not locked,
40  * This interrupt does not have an associated status bit or handler
41  */
42 #define PHONY_WEAK_IRQ 0xFFFE
43 /*
44  * This interrupt will awake the CPU even if IRQs are locked,
45  * This interrupt does not have an associated status bit or handler
46  * (the lock is only ignored when the interrupt is raised from the HW models,
47  * SW threads should not try to use this)
48  */
49 #define PHONY_HARD_IRQ 0xFFFF
50 
51 #define NRF_HW_NBR_IRQs 32
52 
53 #ifdef __cplusplus
54 }
55 #endif
56 
57 #endif
58