• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 // Copyright (C) 2022 Beken Corporation
2 //
3 // Licensed under the Apache License, Version 2.0 (the "License");
4 // you may not use this file except in compliance with the License.
5 // You may obtain a copy of the License at
6 //
7 //     http://www.apache.org/licenses/LICENSE-2.0
8 //
9 // Unless required by applicable law or agreed to in writing, software
10 // distributed under the License is distributed on an "AS IS" BASIS,
11 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 // See the License for the specific language governing permissions and
13 // limitations under the License.
14 
15 #pragma once
16 
17 #ifdef __cplusplus
18 extern "C" {
19 #endif
20 
21 #include <common/bk_generic.h>
22 
23 #if (CONFIG_SOC_BK7271)
24 #define FIQ_MAX_COUNT                         8
25 #define IRQ_MAX_COUNT                         32
26 
27 #define FIQ_MAC_WAKEUP                        (31) /* IRQ actually, compatible with legacy name */
28 #define FIQ_MAC_GENERAL                       (30)
29 #define FIQ_MAC_PROT_TRIGGER                  (29)
30 #define FIQ_MAC_TX_TRIGGER                    (28)
31 #define FIQ_MAC_RX_TRIGGER                    (27)
32 #define FIQ_MAC_TX_RX_MISC                    (26)
33 #define FIQ_MAC_TX_RX_TIMER                   (25)
34 #define FIQ_MODEM                             (24)
35 #define FIQ_SECURITY                          (23) /* IRQ actually, compatible with legacy name */
36 #define IRQ_MAILBOX2                          (22)
37 #define IRQ_MAILBOX1                          (21)
38 #define IRQ_GENERDMA                          (20)
39 #define FIQ_SDIO_DMA                          (19) /* IRQ actually, compatible with legacy name */
40 #define IRQ_USB2                              (18)
41 #define IRQ_QSPI                              (17)
42 #define IRQ_SARADC                            (16)
43 #define IRQ_PWM2                              (15)
44 #define IRQ_PWM                               (14)
45 #define IRQ_TIMER                             (13)
46 #define IRQ_IRDA                              (12)
47 #define IRQ_GPIO                              (11)
48 #define IRQ_SPI3                              (10)
49 #define IRQ_SPI2                              (9)
50 #define IRQ_SPI1                              (8)
51 #define IRQ_USB1                              (7)
52 #define IRQ_SDIO                              (6)
53 #define IRQ_I2C2                              (5)
54 #define IRQ_I2C1                              (4)
55 #define IRQ_FM_I2C                            (3)
56 #define IRQ_UART3                             (2)
57 #define IRQ_UART2                             (1)
58 #define IRQ_UART1                             (0)
59 
60 #define FIQ_JPEG_ENCODER                      (IRQ_MAX_COUNT + 7)
61 #define FIQ_CEC                               (IRQ_MAX_COUNT + 6)
62 #define FIQ_TOUCH                             (IRQ_MAX_COUNT + 5)
63 #define FIQ_RTC                               (IRQ_MAX_COUNT + 4)
64 #define FIQ_DSP_WATCHDOG                      (IRQ_MAX_COUNT + 3)
65 #define FIQ_BT_WATCHDOG                       (IRQ_MAX_COUNT + 2)
66 #define FIQ_USB_PLUG_INOUT                    (IRQ_MAX_COUNT + 1)
67 #define FIQ_DPLL_UNLOCK                       (IRQ_MAX_COUNT + 0)
68 #elif (CONFIG_SOC_BK7231N) || (CONFIG_SOC_BK7256XX)
69 #define FIQ_BT                           (31)
70 #define FIQ_BLE                          (30)
71 #define FIQ_BTDM                         (29)
72 #define FIQ_DPLL_UNLOCK                  (28)
73 #define FIQ_MAC_WAKEUP                   (26)
74 #define FIQ_MAC_GENERAL                  (22)
75 #define FIQ_MAC_PROT_TRIGGER             (21)
76 #define FIQ_MAC_TX_TRIGGER               (20)
77 #define FIQ_MAC_RX_TRIGGER               (19)
78 #define FIQ_MAC_TX_RX_MISC               (18)
79 #define FIQ_MAC_TX_RX_TIMER              (17)
80 #define FIQ_MODEM                        (16)
81 
82 #define IRQ_GENERDMA                     (15)
83 #define IRQ_LA                           (14)
84 #define IRQ_SEC                          (13)
85 #define IRQ_SDIO                         (12)
86 #define IRQ_SARADC                       (11)
87 #define IRQ_PWM                          (9)
88 #define IRQ_TIMER                        (8)
89 #define IRQ_GPIO                         (7)
90 #define IRQ_SPI                          (6)
91 #define IRQ_I2C2                         (5)
92 #define IRQ_IRDA                         (3)
93 #define IRQ_I2C1                         (2)
94 #define IRQ_UART2                        (1)
95 #define IRQ_UART1                        (0)
96 #elif (CONFIG_SOC_BK7236A)
97 #define FIQ_BT                           (31)
98 #define FIQ_BLE                          (30)
99 #define FIQ_BTDM                         (29)
100 #define FIQ_DPLL_UNLOCK                  (28)
101 #define FIQ_MAC_WAKEUP                   (26)
102 #define FIQ_MAC_HSU                      (24)
103 #define FIQ_MAC_GENERAL                  (23)
104 #define FIQ_MAC_PROT_TRIGGER             (22)
105 #define FIQ_MAC_TX_TRIGGER               (21)
106 #define FIQ_MAC_RX_TRIGGER               (20)
107 #define FIQ_MAC_TX_RX_MISC               (19)
108 #define FIQ_MAC_TX_RX_TIMER              (18)
109 #define FIQ_RC                           (17)
110 #define FIQ_MODEM                        (16)
111 
112 #define IRQ_GENERDMA                     (15)
113 #define IRQ_LA                           (14)
114 #define IRQ_SEC                          (13)
115 #define IRQ_SDIO                         (12)
116 #define IRQ_SARADC                       (11)
117 #define IRQ_JPEG_ENCODER                 (10)
118 #define IRQ_PWM                          (9)
119 #define IRQ_TIMER                        (8)
120 #define IRQ_GPIO                         (7)
121 #define IRQ_SPI                          (6)
122 #define IRQ_I2C2                         (5)
123 #define IRQ_IRDA                         (3)
124 #define IRQ_I2C1                         (2)
125 #define IRQ_UART2                        (1)
126 #define IRQ_UART1                        (0)
127 #else
128 #define FIQ_PSRAM                        (31)
129 #define FIQ_BLE                          (30)
130 #define FIQ_JPEG_ENCODER                 (29)
131 #define FIQ_DPLL_UNLOCK                  (28)
132 #define FIQ_SPI_DMA                      (27)
133 #define FIQ_MAC_WAKEUP                   (26)
134 #if (CONFIG_SOC_BK7251)
135 #define FIQ_SECURITY                     (25)
136 #define FIQ_USB_PLUG_INOUT               (24)
137 #else
138 #define FIQ_MAILBOX1                     (25)
139 #define FIQ_MAILBOX0                     (24)
140 #endif
141 #define FIQ_SDIO_DMA                     (23)
142 #define FIQ_MAC_GENERAL                  (22)
143 #define FIQ_MAC_PROT_TRIGGER             (21)
144 #define FIQ_MAC_TX_TRIGGER               (20)
145 #define FIQ_MAC_RX_TRIGGER               (19)
146 #define FIQ_MAC_TX_RX_MISC               (18)
147 #define FIQ_MAC_TX_RX_TIMER              (17)
148 #define FIQ_MODEM                        (16)
149 
150 #define IRQ_GENERDMA                     (15)
151 #define IRQ_FFT                          (14)
152 #define IRQ_USB                          (13)
153 #define IRQ_SD                           (12)
154 #define IRQ_SARADC                       (11)
155 #define IRQ_AUDIO                        (10)
156 #define IRQ_PWM                          (9)
157 
158 #if (CONFIG_SOC_BK7231)
159 #define IRQ_TL410_WATCHDOG               (8)
160 #else
161 #define IRQ_TIMER                        (8)
162 #endif
163 
164 #define IRQ_GPIO                         (7)
165 #define IRQ_SPI                          (6)
166 #define IRQ_I2C2                         (5)
167 #define IRQ_I2S_PCM                      (4)
168 #define IRQ_IRDA                         (3)
169 #define IRQ_I2C1                         (2)
170 #define IRQ_UART2                        (1)
171 #define IRQ_UART1                        (0)
172 #endif
173 
174 #if (CONFIG_SOC_BK7231N) || (CONFIG_SOC_BK7236A) || (CONFIG_SOC_BK7256XX)
175 #define PRI_FIQ_BT                           (7)
176 #define PRI_FIQ_BLE                          (8)
177 #define PRI_FIQ_BTDM                         (13)
178 #define PRI_FIQ_DPLL_UNLOCK                  (29)
179 #define PRI_FIQ_MAC_WAKEUP                   (9)
180 #define PRI_FIQ_MAC_GENERAL                  (1)
181 #define PRI_FIQ_MAC_PROT_TRIGGER             (6)
182 #define PRI_FIQ_MAC_TX_TRIGGER               (3)
183 #define PRI_FIQ_MAC_RX_TRIGGER               (4)
184 #define PRI_FIQ_MAC_TX_RX_MISC               (5)
185 #define PRI_FIQ_MAC_TX_RX_TIMER              (2)
186 #define PRI_FIQ_MODEM                        (10)
187 #if (CONFIG_SOC_BK7236A)
188 #define PRI_FIQ_HSU                          (11)
189 #define PRI_FIQ_RC                           (12)
190 #endif
191 
192 #define PRI_IRQ_GENERDMA                     (28)
193 #define PRI_IRQ_LA                           (29)
194 #define PRI_IRQ_SEC                          (21)
195 #define PRI_IRQ_SDIO                         (22)
196 #define PRI_IRQ_SARADC                       (16)
197 #define PRI_JPEG_ENCODER                     (20)
198 #define PRI_IRQ_PWM                          (17)
199 #define PRI_IRQ_TIMER                        (18)
200 #define PRI_IRQ_GPIO                         (19)
201 #define PRI_IRQ_SPI                          (20)
202 #define PRI_IRQ_I2C2                         (21)
203 #define PRI_IRQ_IRDA                         (23)
204 #define PRI_IRQ_I2C1                         (24)
205 #define PRI_IRQ_UART2                        (25)
206 #define PRI_IRQ_UART1                        (26)
207 #else
208 #define PRI_FIQ_BLE                          (31)
209 #define PRI_FIQ_JPEG_DECODER                 (30)
210 #define PRI_FIQ_DPLL_UNLOCK                  (29)
211 #define PRI_FIQ_SPI_DMA                      (7)
212 #define PRI_FIQ_MAC_WAKEUP                   (9)
213 
214 #if (CONFIG_SOC_BK7251) || (CONFIG_SOC_BK7271)
215 #define PRI_FIQ_SECURITY                     (12)
216 #define PRI_FIQ_USB_PLUG_INOUT               (11)
217 #else
218 #define PRI_FIQ_MAILBOX1                     (12)
219 #define PRI_FIQ_MAILBOX0                     (11)
220 #endif
221 
222 #define PRI_FIQ_SDIO_DMA                     (8)
223 #define PRI_FIQ_MAC_GENERAL                  (1)
224 #define PRI_FIQ_MAC_PROT_TRIGGER             (6)
225 #define PRI_FIQ_MAC_TX_TRIGGER               (3)
226 #define PRI_FIQ_MAC_RX_TRIGGER               (4)
227 #define PRI_FIQ_MAC_TX_RX_MISC               (5)
228 #define PRI_FIQ_MAC_TX_RX_TIMER              (2)
229 #define PRI_FIQ_MODEM                        (10)
230 
231 #define PRI_IRQ_GENERDMA                     (28)
232 #define PRI_IRQ_FFT                          (13)
233 #define PRI_IRQ_USB                          (14)
234 #define PRI_IRQ_SD                           (15)
235 #define PRI_IRQ_SARADC                       (16)
236 #define PRI_IRQ_AUDIO                        (27)
237 #define PRI_IRQ_PWM                          (17)
238 
239 #if (CONFIG_SOC_BK7231)
240 #define PRI_IRQ_TL410_WATCHDOG               (18)
241 #else
242 #define PRI_IRQ_TIMER                        (18)
243 #endif
244 
245 #define PRI_IRQ_GPIO                         (19)
246 #define PRI_IRQ_SPI                          (20)
247 #define PRI_IRQ_I2C2                         (21)
248 #define PRI_IRQ_I2S_PCM                      (22)
249 #define PRI_IRQ_IRDA                         (23)
250 #define PRI_IRQ_I2C1                         (24)
251 #define PRI_IRQ_UART2                        (25)
252 #define PRI_IRQ_UART1                        (26)
253 #define PRI_IRQ_QSPI                         (27)
254 
255 #if (CONFIG_SOC_BK7271)
256 #define PRI_IRQ_MAILBOX                      (11)
257 #define PRI_IRQ_UART3                        (32)
258 #define PRI_IRQ_MAILBOX1                     (33)
259 #endif
260 #endif // (CONFIG_SOC_BK7231N) || (CONFIG_SOC_BK7236A)
261 
262 //void intc_service_register(UINT8 int_num, UINT8 int_pri, FUNCPTR isr);
263 //void intc_spurious(void);
264 void intc_enable(int index);
265 void intc_disable(int index);
266 
267 #ifdef __cplusplus
268 }
269 #endif
270