1 /*
2 *********************************************************************************************************
3 *                                                AR100 SYSTEM
4 *                                     AR100 Software System Develop Kits
5 *                                              interrupt  module
6 *
7 *                                    (c) Copyright 2012-2016, Sunny China
8 *                                             All Rights Reserved
9 *
10 * File    : intc.h
11 * By      : Sunny
12 * Version : v1.0
13 * Date    : 2012-4-27
14 * Descript: interrupt controller public header.
15 * Update  : date                auther      ver     notes
16 *           2012-4-27 10:52:56  Sunny       1.0     Create this file.
17 *********************************************************************************************************
18 */
19 
20 #ifndef __INTC_H__
21 #define __INTC_H__
22 
23 #include <hal_interrupt.h>
24 #include <sunxi_hal_common.h>
25 
26 /*
27 *********************************************************************************************************
28 *                                       INIT INTERRUPT MANAGER
29 *
30 * Description:  initialize interrupt manager.
31 *
32 * Arguments  :  none.
33 *
34 * Returns    :  OK if initialize interrupt manager succeeded, others if failed.
35 *********************************************************************************************************
36 */
37 s32 interrupt_init(void);
38 
39 /*
40 *********************************************************************************************************
41 *                                       EXIT INTERRUPT MANAGER
42 *
43 * Description:  exit interrupt manager.
44 *
45 * Arguments  :  none.
46 *
47 * Returns    :  OK if exit interrupt manager succeeded, others if failed.
48 *********************************************************************************************************
49 */
50 s32 interrupt_exit(void);
51 
52 /*
53 *********************************************************************************************************
54 *                                           ENABLE INTERRUPT
55 *
56 * Description:  enable a specific interrupt.
57 *
58 * Arguments  :  intno : the number of interrupt which we want to enable.
59 *
60 * Returns    :  OK if enable interrupt succeeded, others if failed.
61 *********************************************************************************************************
62 */
63 s32 interrupt_enable(u32 intno);
64 
65 /*
66 *********************************************************************************************************
67 *                                           DISABLE INTERRUPT
68 *
69 * Description:  disable a specific interrupt.
70 *
71 * Arguments  :  intno : the number of interrupt which we want to disable.
72 *
73 * Returns    :  OK if disable interrupt succeeded, others if failed.
74 *********************************************************************************************************
75 */
76 s32 interrupt_disable(u32 intno);
77 
78 /*
79 *********************************************************************************************************
80 *                                           SET NMI TRIGGER
81 *
82 * Description:  set nmi trigger.
83 *
84 * Arguments  :  type : the trigger type.
85 *
86 * Returns    :  OK if set trigger type succeeded, others if failed.
87 *********************************************************************************************************
88 */
89 s32 interrupt_set_nmi_trigger(u32 type);
90 
91 s32 interrupt_set_mask(u32 intno, u32 mask);
92 s32 interrupt_set_group_config(u32 grp_irq_num, u32 mask);
93 /*
94 *********************************************************************************************************
95 *                                           INSTALL ISR
96 *
97 * Description:  install ISR for a specific interrupt.
98 *
99 * Arguments  :  intno   : the number of interrupt which we want to install ISR.
100 *               pisr    : the ISR which to been install.
101 *               parg    : the argument for the ISR.
102 *
103 * Returns    :  OK if install ISR succeeded, others if failed.
104 *
105 * Note       :  the ISR execute entironment : CPU disable interrupt response.
106 *********************************************************************************************************
107 */
108 s32 install_isr(u32 intno, __pISR_hdle_t pisr, void *parg);
109 
110 /*
111 *********************************************************************************************************
112 *                                           UNINSTALL ISR
113 *
114 * Description:  uninstall ISR for a specific interrupt.
115 *
116 * Arguments  :  intno   : the number of interrupt which we want to uninstall ISR.
117 *               pisr    : the ISR which to been uninstall.
118 *
119 * Returns    :  OK if uninstall ISR succeeded, others if failed.
120 *********************************************************************************************************
121 */
122 s32 uninstall_isr(u32 intno, __pISR_hdle_t pisr);
123 
124 
125 /*
126 *********************************************************************************************************
127 *                                           INTERRUPT ENTRY
128 *
129 * Description:  the entry of CPU IRQ, mainly for CPU IRQ exception.
130 *
131 * Arguments  :  none.
132 *
133 * Returns    :  OK if process CPU IRQ succeeded, others if failed.
134 *********************************************************************************************************
135 */
136 s32 interrupt_entry(void);
137 
138 s32 interrupt_query_pending(u32 intno);
139 s32 interrupt_clear_pending(u32 intno);
140 
141 u32 interrupt_get_current_intno(void);
142 
143 s32 interrupt_standby_enter(void);
144 s32 interrupt_standby_exit(void);
145 
146 #endif /* __INTC_H__ */
147