summaryrefslogtreecommitdiffstats
path: root/bsps/arm/altera-cyclone-v/include/bsp/alt_interrupt_common.h
blob: 004fd3188ca581d3f2825821d82faf5329262996 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
/******************************************************************************
*
* Copyright 2013 Altera Corporation. All Rights Reserved.
* 
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
* 
* 1. Redistributions of source code must retain the above copyright notice,
* this list of conditions and the following disclaimer.
* 
* 2. Redistributions in binary form must reproduce the above copyright notice,
* this list of conditions and the following disclaimer in the documentation
* and/or other materials provided with the distribution.
* 
* 3. The name of the author may not be used to endorse or promote products
* derived from this software without specific prior written permission.
* 
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDER "AS IS" AND ANY EXPRESS OR
* IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
* MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE, ARE DISCLAIMED. IN NO
* EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT
* OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
* IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY
* OF SUCH DAMAGE.
* 
******************************************************************************/

#ifndef __ALT_INT_COMMON_H__
#define __ALT_INT_COMMON_H__

#include "hwlib.h"
#include <stdbool.h>
#include <stddef.h>

#ifdef __cplusplus
extern "C"
{
#endif

/*!
 * \addtogroup INT_COMMON Interrupt Controller Common Definitions
 *
 * This module contains the definitions common to the Interrupt Controller
 * Low-Level API and Interrupt Controller Manager Interface.
 *
 * @{
 */

/*!
 * This type definition enumerates all the interrupt identification types.
 */
typedef enum ALT_INT_INTERRUPT_e
{
    ALT_INT_INTERRUPT_SGI0  =  0, /*!< # */
    ALT_INT_INTERRUPT_SGI1  =  1, /*!< # */
    ALT_INT_INTERRUPT_SGI2  =  2, /*!< # */
    ALT_INT_INTERRUPT_SGI3  =  3, /*!< # */
    ALT_INT_INTERRUPT_SGI4  =  4, /*!< # */
    ALT_INT_INTERRUPT_SGI5  =  5, /*!< # */
    ALT_INT_INTERRUPT_SGI6  =  6, /*!< # */
    ALT_INT_INTERRUPT_SGI7  =  7, /*!< # */
    ALT_INT_INTERRUPT_SGI8  =  8, /*!< # */
    ALT_INT_INTERRUPT_SGI9  =  9, /*!< # */
    ALT_INT_INTERRUPT_SGI10 = 10, /*!< # */
    ALT_INT_INTERRUPT_SGI11 = 11, /*!< # */
    ALT_INT_INTERRUPT_SGI12 = 12, /*!< # */
    ALT_INT_INTERRUPT_SGI13 = 13, /*!< # */
    ALT_INT_INTERRUPT_SGI14 = 14, /*!< # */
    ALT_INT_INTERRUPT_SGI15 = 15,
    /*!<
     * Software Generated Interrupts (SGI), 0 - 15.
     *  * All interrupts in this group are software triggered.
     */

    ALT_INT_INTERRUPT_PPI_TIMER_GLOBAL   = 27, /*!< # */
    ALT_INT_INTERRUPT_PPI_TIMER_PRIVATE  = 29, /*!< # */
    ALT_INT_INTERRUPT_PPI_TIMER_WATCHDOG = 30, /*!< # */
    /*!<
     * Private Peripheral Interrupts (PPI) for the Global Timer, per CPU
     * private timer, and watchdog timer.
     *  * All interrupts in this group are edge triggered.
     */

    ALT_INT_INTERRUPT_CPU0_PARITYFAIL         = 32, /*!< # */
    ALT_INT_INTERRUPT_CPU0_PARITYFAIL_BTAC    = 33, /*!< # */
    ALT_INT_INTERRUPT_CPU0_PARITYFAIL_GHB     = 34, /*!< # */
    ALT_INT_INTERRUPT_CPU0_PARITYFAIL_I_TAG   = 35, /*!< # */
    ALT_INT_INTERRUPT_CPU0_PARITYFAIL_I_DATA  = 36, /*!< # */
    ALT_INT_INTERRUPT_CPU0_PARITYFAIL_TLB     = 37, /*!< # */
    ALT_INT_INTERRUPT_CPU0_PARITYFAIL_D_OUTER = 38, /*!< # */
    ALT_INT_INTERRUPT_CPU0_PARITYFAIL_D_TAG   = 39, /*!< # */
    ALT_INT_INTERRUPT_CPU0_PARITYFAIL_D_DATA  = 40, /*!< # */
    ALT_INT_INTERRUPT_CPU0_DEFLAGS0           = 41, /*!< # */
    ALT_INT_INTERRUPT_CPU0_DEFLAGS1           = 42, /*!< # */
    ALT_INT_INTERRUPT_CPU0_DEFLAGS2           = 43, /*!< # */
    ALT_INT_INTERRUPT_CPU0_DEFLAGS3           = 44, /*!< # */
    ALT_INT_INTERRUPT_CPU0_DEFLAGS4           = 45, /*!< # */
    ALT_INT_INTERRUPT_CPU0_DEFLAGS5           = 46, /*!< # */
    ALT_INT_INTERRUPT_CPU0_DEFLAGS6           = 47,
    /*!<
     * Interrupts sourced from CPU0.
     *
     * The ALT_INT_INTERRUPT_CPU0_PARITYFAIL interrupt combines the
     * BTAC, GHB, I_TAG, I_DATA, TLB, D_OUTER, D_TAG, and D_DATA interrupts
     * for CPU0.
     *
     *  * PARITYFAIL interrupts in this group are edge triggered.
     *  * DEFFLAGS interrupts in this group are level triggered.
     */

    ALT_INT_INTERRUPT_CPU1_PARITYFAIL         = 48, /*!< # */
    ALT_INT_INTERRUPT_CPU1_PARITYFAIL_BTAC    = 49, /*!< # */
    ALT_INT_INTERRUPT_CPU1_PARITYFAIL_GHB     = 50, /*!< # */
    ALT_INT_INTERRUPT_CPU1_PARITYFAIL_I_TAG   = 51, /*!< # */
    ALT_INT_INTERRUPT_CPU1_PARITYFAIL_I_DATA  = 52, /*!< # */
    ALT_INT_INTERRUPT_CPU1_PARITYFAIL_TLB     = 53, /*!< # */
    ALT_INT_INTERRUPT_CPU1_PARITYFAIL_D_OUTER = 54, /*!< # */
    ALT_INT_INTERRUPT_CPU1_PARITYFAIL_D_TAG   = 55, /*!< # */
    ALT_INT_INTERRUPT_CPU1_PARITYFAIL_D_DATA  = 56, /*!< # */
    ALT_INT_INTERRUPT_CPU1_DEFLAGS0           = 57, /*!< # */
    ALT_INT_INTERRUPT_CPU1_DEFLAGS1           = 58, /*!< # */
    ALT_INT_INTERRUPT_CPU1_DEFLAGS2           = 59, /*!< # */
    ALT_INT_INTERRUPT_CPU1_DEFLAGS3           = 60, /*!< # */
    ALT_INT_INTERRUPT_CPU1_DEFLAGS4           = 61, /*!< # */
    ALT_INT_INTERRUPT_CPU1_DEFLAGS5           = 62, /*!< # */
    ALT_INT_INTERRUPT_CPU1_DEFLAGS6           = 63,
    /*!<
     * Interrupts sourced from CPU1.
     *
     * The ALT_INT_INTERRUPT_CPU1_PARITYFAIL interrupt combines the
     * BTAC, GHB, I_TAG, I_DATA, TLB, D_OUTER, D_TAG, and D_DATA interrupts
     * for CPU1.
     *
     *  * PARITYFAIL interrupts in this group are edge triggered.
     *  * DEFFLAGS interrupts in this group are level triggered.
     */
    
    ALT_INT_INTERRUPT_SCU_PARITYFAIL0 =  64, /*!< # */
    ALT_INT_INTERRUPT_SCU_PARITYFAIL1 =  65, /*!< # */
    ALT_INT_INTERRUPT_SCU_EV_ABORT    =  66,
    /*!<
     * Interrupts sourced from the Snoop Control Unit (SCU).
     *  * All interrupts in this group are edge triggered.
     */
    
    ALT_INT_INTERRUPT_L2_ECC_BYTE_WR_IRQ     = 67, /*!< # */
    ALT_INT_INTERRUPT_L2_ECC_CORRECTED_IRQ   = 68, /*!< # */
    ALT_INT_INTERRUPT_L2_ECC_UNCORRECTED_IRQ = 69, /*!< # */
    ALT_INT_INTERRUPT_L2_COMBINED_IRQ        = 70,
    /*!<
     * Interrupts sourced from the L2 Cache Controller.
     *
     * The ALT_INT_INTERRUPT_L2_COMBINED_IRQ interrupt combines the cache
     * controller internal DECERRINTR, ECNTRINTR, ERRRDINTR, ERRRTINTR,
     * ERRWDINTR, ERRWTINTR, PARRDINTR, PARRTINTR, and SLVERRINTR interrupts.
     * Consult the L2C documentation for information on these interrupts.
     *
     *  * ECC interrupts in this group are edge triggered.
     *  * Other interrupts in this group are level triggered.
     */

    ALT_INT_INTERRUPT_DDR_ECC_ERROR_IRQ =  71,
    /*!<
     * Interrupts sourced from the SDRAM Controller.
     *  * All interrupts in this group are level triggered.
     */

    ALT_INT_INTERRUPT_F2S_FPGA_IRQ0  =  72, /*!< # */
    ALT_INT_INTERRUPT_F2S_FPGA_IRQ1  =  73, /*!< # */
    ALT_INT_INTERRUPT_F2S_FPGA_IRQ2  =  74, /*!< # */
    ALT_INT_INTERRUPT_F2S_FPGA_IRQ3  =  75, /*!< # */
    ALT_INT_INTERRUPT_F2S_FPGA_IRQ4  =  76, /*!< # */
    ALT_INT_INTERRUPT_F2S_FPGA_IRQ5  =  77, /*!< # */
    ALT_INT_INTERRUPT_F2S_FPGA_IRQ6  =  78, /*!< # */
    ALT_INT_INTERRUPT_F2S_FPGA_IRQ7  =  79, /*!< # */
    ALT_INT_INTERRUPT_F2S_FPGA_IRQ8  =  80, /*!< # */
    ALT_INT_INTERRUPT_F2S_FPGA_IRQ9  =  81, /*!< # */
    ALT_INT_INTERRUPT_F2S_FPGA_IRQ10 =  82, /*!< # */
    ALT_INT_INTERRUPT_F2S_FPGA_IRQ11 =  83, /*!< # */
    ALT_INT_INTERRUPT_F2S_FPGA_IRQ12 =  84, /*!< # */
    ALT_INT_INTERRUPT_F2S_FPGA_IRQ13 =  85, /*!< # */
    ALT_INT_INTERRUPT_F2S_FPGA_IRQ14 =  86, /*!< # */
    ALT_INT_INTERRUPT_F2S_FPGA_IRQ15 =  87, /*!< # */
    ALT_INT_INTERRUPT_F2S_FPGA_IRQ16 =  88, /*!< # */
    ALT_INT_INTERRUPT_F2S_FPGA_IRQ17 =  89, /*!< # */
    ALT_INT_INTERRUPT_F2S_FPGA_IRQ18 =  90, /*!< # */
    ALT_INT_INTERRUPT_F2S_FPGA_IRQ19 =  91, /*!< # */
    ALT_INT_INTERRUPT_F2S_FPGA_IRQ20 =  92, /*!< # */
    ALT_INT_INTERRUPT_F2S_FPGA_IRQ21 =  93, /*!< # */
    ALT_INT_INTERRUPT_F2S_FPGA_IRQ22 =  94, /*!< # */
    ALT_INT_INTERRUPT_F2S_FPGA_IRQ23 =  95, /*!< # */
    ALT_INT_INTERRUPT_F2S_FPGA_IRQ24 =  96, /*!< # */
    ALT_INT_INTERRUPT_F2S_FPGA_IRQ25 =  97, /*!< # */
    ALT_INT_INTERRUPT_F2S_FPGA_IRQ26 =  98, /*!< # */
    ALT_INT_INTERRUPT_F2S_FPGA_IRQ27 =  99, /*!< # */
    ALT_INT_INTERRUPT_F2S_FPGA_IRQ28 = 100, /*!< # */
    ALT_INT_INTERRUPT_F2S_FPGA_IRQ29 = 101, /*!< # */
    ALT_INT_INTERRUPT_F2S_FPGA_IRQ30 = 102, /*!< # */
    ALT_INT_INTERRUPT_F2S_FPGA_IRQ31 = 103, /*!< # */
    ALT_INT_INTERRUPT_F2S_FPGA_IRQ32 = 104, /*!< # */
    ALT_INT_INTERRUPT_F2S_FPGA_IRQ33 = 105, /*!< # */
    ALT_INT_INTERRUPT_F2S_FPGA_IRQ34 = 106, /*!< # */
    ALT_INT_INTERRUPT_F2S_FPGA_IRQ35 = 107, /*!< # */
    ALT_INT_INTERRUPT_F2S_FPGA_IRQ36 = 108, /*!< # */
    ALT_INT_INTERRUPT_F2S_FPGA_IRQ37 = 109, /*!< # */
    ALT_INT_INTERRUPT_F2S_FPGA_IRQ38 = 110, /*!< # */
    ALT_INT_INTERRUPT_F2S_FPGA_IRQ39 = 111, /*!< # */
    ALT_INT_INTERRUPT_F2S_FPGA_IRQ40 = 112, /*!< # */
    ALT_INT_INTERRUPT_F2S_FPGA_IRQ41 = 113, /*!< # */
    ALT_INT_INTERRUPT_F2S_FPGA_IRQ42 = 114, /*!< # */
    ALT_INT_INTERRUPT_F2S_FPGA_IRQ43 = 115, /*!< # */
    ALT_INT_INTERRUPT_F2S_FPGA_IRQ44 = 116, /*!< # */
    ALT_INT_INTERRUPT_F2S_FPGA_IRQ45 = 117, /*!< # */
    ALT_INT_INTERRUPT_F2S_FPGA_IRQ46 = 118, /*!< # */
    ALT_INT_INTERRUPT_F2S_FPGA_IRQ47 = 119, /*!< # */
    ALT_INT_INTERRUPT_F2S_FPGA_IRQ48 = 120, /*!< # */
    ALT_INT_INTERRUPT_F2S_FPGA_IRQ49 = 121, /*!< # */
    ALT_INT_INTERRUPT_F2S_FPGA_IRQ50 = 122, /*!< # */
    ALT_INT_INTERRUPT_F2S_FPGA_IRQ51 = 123, /*!< # */
    ALT_INT_INTERRUPT_F2S_FPGA_IRQ52 = 124, /*!< # */
    ALT_INT_INTERRUPT_F2S_FPGA_IRQ53 = 125, /*!< # */
    ALT_INT_INTERRUPT_F2S_FPGA_IRQ54 = 126, /*!< # */
    ALT_INT_INTERRUPT_F2S_FPGA_IRQ55 = 127, /*!< # */
    ALT_INT_INTERRUPT_F2S_FPGA_IRQ56 = 128, /*!< # */
    ALT_INT_INTERRUPT_F2S_FPGA_IRQ57 = 129, /*!< # */
    ALT_INT_INTERRUPT_F2S_FPGA_IRQ58 = 130, /*!< # */
    ALT_INT_INTERRUPT_F2S_FPGA_IRQ59 = 131, /*!< # */
    ALT_INT_INTERRUPT_F2S_FPGA_IRQ60 = 132, /*!< # */
    ALT_INT_INTERRUPT_F2S_FPGA_IRQ61 = 133, /*!< # */
    ALT_INT_INTERRUPT_F2S_FPGA_IRQ62 = 134, /*!< # */
    ALT_INT_INTERRUPT_F2S_FPGA_IRQ63 = 135,
    /*!<
     * Interrupt request from the FPGA logic, 0 - 63.
     *  * Trigger type depends on the implementation in the FPGA.
     */

    ALT_INT_INTERRUPT_DMA_IRQ0                = 136, /*!< # */
    ALT_INT_INTERRUPT_DMA_IRQ1                = 137, /*!< # */
    ALT_INT_INTERRUPT_DMA_IRQ2                = 138, /*!< # */
    ALT_INT_INTERRUPT_DMA_IRQ3                = 139, /*!< # */
    ALT_INT_INTERRUPT_DMA_IRQ4                = 140, /*!< # */
    ALT_INT_INTERRUPT_DMA_IRQ5                = 141, /*!< # */
    ALT_INT_INTERRUPT_DMA_IRQ6                = 142, /*!< # */
    ALT_INT_INTERRUPT_DMA_IRQ7                = 143, /*!< # */
    ALT_INT_INTERRUPT_DMA_IRQ_ABORT           = 144, /*!< # */
    ALT_INT_INTERRUPT_DMA_ECC_CORRECTED_IRQ   = 145, /*!< # */
    ALT_INT_INTERRUPT_DMA_ECC_UNCORRECTED_IRQ = 146,
    /*!<
     * Interrupts sourced from the DMA Controller.
     *  * All interrupts in this group are level triggered.
     */

    ALT_INT_INTERRUPT_EMAC0_IRQ                    = 147, /*!< # */
    ALT_INT_INTERRUPT_EMAC0_TX_ECC_CORRECTED_IRQ   = 148, /*!< # */
    ALT_INT_INTERRUPT_EMAC0_TX_ECC_UNCORRECTED_IRQ = 149, /*!< # */
    ALT_INT_INTERRUPT_EMAC0_RX_ECC_CORRECTED_IRQ   = 150, /*!< # */
    ALT_INT_INTERRUPT_EMAC0_RX_ECC_UNCORRECTED_IRQ = 151,
    /*!<
     * Interrupts sourced from the Ethernet MAC 0 (EMAC0).
     *  * All interrupts in this group are level triggered.
     */

    ALT_INT_INTERRUPT_EMAC1_IRQ                    = 152, /*!< # */
    ALT_INT_INTERRUPT_EMAC1_TX_ECC_CORRECTED_IRQ   = 153, /*!< # */
    ALT_INT_INTERRUPT_EMAC1_TX_ECC_UNCORRECTED_IRQ = 154, /*!< # */
    ALT_INT_INTERRUPT_EMAC1_RX_ECC_CORRECTED_IRQ   = 155, /*!< # */
    ALT_INT_INTERRUPT_EMAC1_RX_ECC_UNCORRECTED_IRQ = 156,
    /*!<
     * Interrupts sourced from the Ethernet MAC 1 (EMAC1).
     *  * All interrupts in this group are level triggered.
     */

    ALT_INT_INTERRUPT_USB0_IRQ             = 157, /*!< # */
    ALT_INT_INTERRUPT_USB0_ECC_CORRECTED   = 158, /*!< # */
    ALT_INT_INTERRUPT_USB0_ECC_UNCORRECTED = 159,
    /*!<
     * Interrupts sourced from the USB OTG 0.
     *  * All interrupts in this group are level triggered.
     */

    ALT_INT_INTERRUPT_USB1_IRQ             = 160, /*!< # */
    ALT_INT_INTERRUPT_USB1_ECC_CORRECTED   = 161, /*!< # */
    ALT_INT_INTERRUPT_USB1_ECC_UNCORRECTED = 162,
    /*!<
     * Interrupts sourced from the USB OTG 1.
     *  * All interrupts in this group are level triggered.
     */

    ALT_INT_INTERRUPT_CAN0_STS_IRQ             = 163, /*!< # */
    ALT_INT_INTERRUPT_CAN0_MO_IRQ              = 164, /*!< # */
    ALT_INT_INTERRUPT_CAN0_ECC_CORRECTED_IRQ   = 165, /*!< # */
    ALT_INT_INTERRUPT_CAN0_ECC_UNCORRECTED_IRQ = 166,
    /*!<
     * Interrupts sourced from the CAN Controller 0.
     *  * All interrupts in this group are level triggered.
     */

    ALT_INT_INTERRUPT_CAN1_STS_IRQ             = 167, /*!< # */
    ALT_INT_INTERRUPT_CAN1_MO_IRQ              = 168, /*!< # */
    ALT_INT_INTERRUPT_CAN1_ECC_CORRECTED_IRQ   = 169, /*!< # */
    ALT_INT_INTERRUPT_CAN1_ECC_UNCORRECTED_IRQ = 170,
    /*!<
     * Interrupts sourced from the CAN Controller 1.
     *  * All interrupts in this group are level triggered.
     */

    ALT_INT_INTERRUPT_SDMMC_IRQ                   = 171, /*!< # */
    ALT_INT_INTERRUPT_SDMMC_PORTA_ECC_CORRECTED   = 172, /*!< # */
    ALT_INT_INTERRUPT_SDMMC_PORTA_ECC_UNCORRECTED = 173, /*!< # */
    ALT_INT_INTERRUPT_SDMMC_PORTB_ECC_CORRECTED   = 174, /*!< # */
    ALT_INT_INTERRUPT_SDMMC_PORTB_ECC_UNCORRECTED = 175,
    /*!<
     * Interrupts sourced from the SDMMC Controller.
     *  * All interrupts in this group are level triggered.
     */

    ALT_INT_INTERRUPT_NAND_IRQ                  = 176, /*!< # */
    ALT_INT_INTERRUPT_NANDR_ECC_CORRECTED_IRQ   = 177, /*!< # */
    ALT_INT_INTERRUPT_NANDR_ECC_UNCORRECTED_IRQ = 178, /*!< # */
    ALT_INT_INTERRUPT_NANDW_ECC_CORRECTED_IRQ   = 179, /*!< # */
    ALT_INT_INTERRUPT_NANDW_ECC_UNCORRECTED_IRQ = 180, /*!< # */
    ALT_INT_INTERRUPT_NANDE_ECC_CORRECTED_IRQ   = 181, /*!< # */
    ALT_INT_INTERRUPT_NANDE_ECC_UNCORRECTED_IRQ = 182,
    /*!<
     * Interrupts sourced from the NAND Controller.
     *  * All interrupts in this group are level triggered.
     */

    ALT_INT_INTERRUPT_QSPI_IRQ                 = 183, /*!< # */
    ALT_INT_INTERRUPT_QSPI_ECC_CORRECTED_IRQ   = 184, /*!< # */
    ALT_INT_INTERRUPT_QSPI_ECC_UNCORRECTED_IRQ = 185,
    /*!<
     * Interrupts sourced from the QSPI Controller.
     *  * All interrupts in this group are level triggered.
     */

    ALT_INT_INTERRUPT_SPI0_IRQ = 186, /*!< # */
    ALT_INT_INTERRUPT_SPI1_IRQ = 187, /*!< # */
    ALT_INT_INTERRUPT_SPI2_IRQ = 188, /*!< # */
    ALT_INT_INTERRUPT_SPI3_IRQ = 189,
    /*!<
     * Interrupts sourced from the SPI Controllers 0 - 3.
     * SPI0_IRQ corresponds to SPIM0. SPI1_IRQ corresponds to SPIM1.
     * SPI2_IRQ corresponds to SPIS0. SPI3_IRQ corresponds to SPIS1.
     *  * All interrupts in this group are level triggered.
     */

    ALT_INT_INTERRUPT_I2C0_IRQ = 190, /*!< # */
    ALT_INT_INTERRUPT_I2C1_IRQ = 191, /*!< # */
    ALT_INT_INTERRUPT_I2C2_IRQ = 192, /*!< # */
    ALT_INT_INTERRUPT_I2C3_IRQ = 193,
    /*!<
     * Interrupts sourced from the I2C Controllers 0 - 3.
     *  * All interrupts in this group are level triggered.
     */

    ALT_INT_INTERRUPT_UART0 = 194, /*!< # */
    ALT_INT_INTERRUPT_UART1 = 195,
    /*!<
     * Interrupts sourced from the UARTs 0 - 1.
     *  * All interrupts in this group are level triggered.
     */

    ALT_INT_INTERRUPT_GPIO0 = 196, /*!< # */
    ALT_INT_INTERRUPT_GPIO1 = 197, /*!< # */
    ALT_INT_INTERRUPT_GPIO2 = 198,
    /*!<
     * Interrupts sourced from the GPIO 0 - 2.
     *  * All interrupts in this group are level triggered.
     */
    
    ALT_INT_INTERRUPT_TIMER_L4SP_0_IRQ = 199, /*!< # */
    ALT_INT_INTERRUPT_TIMER_L4SP_1_IRQ = 200, /*!< # */
    ALT_INT_INTERRUPT_TIMER_OSC1_0_IRQ = 201, /*!< # */
    ALT_INT_INTERRUPT_TIMER_OSC1_1_IRQ = 202,
    /*!<
     * Interrupts sourced from the Timer controllers.
     *  * All interrupts in this group are level triggered.
     */

    ALT_INT_INTERRUPT_WDOG0_IRQ = 203, /*!< # */
    ALT_INT_INTERRUPT_WDOG1_IRQ = 204,
    /*!<
     * Interrupts sourced from the Watchdog Timers 0 - 1.
     *  * All interrupts in this group are level triggered.
     */

    ALT_INT_INTERRUPT_CLKMGR_IRQ = 205,
    /*!<
     * Interrupts sourced from the Clock Manager.
     *  * All interrupts in this group are level triggered.
     */

    ALT_INT_INTERRUPT_MPUWAKEUP_IRQ = 206,
    /*!<
     * Interrupts sourced from the Clock Manager MPU Wakeup.
     *  * All interrupts in this group are level triggered.
     */

    ALT_INT_INTERRUPT_FPGA_MAN_IRQ = 207,
    /*!<
     * Interrupts sourced from the FPGA Manager.
     *  * All interrupts in this group are level triggered.
     */

    ALT_INT_INTERRUPT_NCTIIRQ0 = 208, /*!< # */
    ALT_INT_INTERRUPT_NCTIIRQ1 = 209,
    /*!<
     * Interrupts sourced from the CoreSight for CPU0 and CPU1's CTI.
     *  * All interrupts in this group are level triggered.
     */

    ALT_INT_INTERRUPT_RAM_ECC_CORRECTED_IRQ   = 210, /*!< # */
    ALT_INT_INTERRUPT_RAM_ECC_UNCORRECTED_IRQ = 211
    /*!<
     * Interrupts sourced from the On-chip RAM.
     *  * All interrupts in this group are level triggered.
     */

} ALT_INT_INTERRUPT_t;

/*!
 * This is the CPU target type. It is used to specify a set of CPUs on the
 * system. If only bit 0 is set then it specifies a set of CPUs containing
 * only CPU 0. Multiple CPUs can be specified by setting the appropriate bit
 * up to the number of CPUs on the system.
 */
typedef uint32_t alt_int_cpu_target_t;

/*!
 * This type definition enumerates all the interrupt trigger types.
 */
typedef enum ALT_INT_TRIGGER_e
{
    /*!
     * Edge triggered interrupt. This applies to Private Peripheral Interrupts
     * (PPI) and Shared Peripheral Interrupts (SPI) only, with interrupt IDs
     * 16 - 1019.
     */
    ALT_INT_TRIGGER_EDGE,

    /*!
     * Level triggered interrupt. This applies to Private Peripheral
     * Interrupts (PPI) and Shared Peripheral Interrupts (SPI) only, with
     * interrupt IDs 16 - 1019.
     */
    ALT_INT_TRIGGER_LEVEL,

    /*!
     * Software triggered interrupt. This applies to Software Generated
     * Interrupts (SGI) only, with interrupt IDs 0 - 15.
     */
    ALT_INT_TRIGGER_SOFTWARE,

    /*!
     * All triggering types except for those in the Shared Peripheral Interrupts
     * (SPI) F2S FPGA family interrupts can be determined by the system
     * automatically. In all functions which ask for the triggering type, the
     * ALT_INT_TRIGGER_AUTODETECT can be used to select the correct trigger
     * type for all non F2S interrupt types.
     */
    ALT_INT_TRIGGER_AUTODETECT,

    /*!
     * The interrupt triggering information is not applicable. This is possibly
     * due to querying an invalid interrupt identifier.
     */
    ALT_INT_TRIGGER_NA
}
ALT_INT_TRIGGER_t;

/*!
 * This type definition enumerates all the target list filter options. This is
 * used by the trigger Software Generated Interrupt (SGI) feature to issue a
 * SGI to the specified processor(s) in the system. Depending on the target
 * list filter and the target list, interrupts can be routed to any
 * combinations of CPUs.
 */
typedef enum ALT_INT_SGI_TARGET_e
{
    /*!
     * This filter list uses the target list parameter to specify which CPUs
     * to send the interrupt to. If target list is 0, no interrupts are sent.
     */
    ALT_INT_SGI_TARGET_LIST,

    /*!
     * This filter list sends the interrupt all CPUs except the current CPU.
     * The target list parameter is ignored.
     */
    ALT_INT_SGI_TARGET_ALL_EXCL_SENDER,

    /*!
     * This filter list sends the interrupt to the current CPU only. The
     * target list parameter is ignored.
     */
    ALT_INT_SGI_TARGET_SENDER_ONLY
}
ALT_INT_SGI_TARGET_t;

/*!
 * Extracts the CPUID field from the ICCIAR register.
 */
#define ALT_INT_ICCIAR_CPUID_GET(icciar)    ((icciar >> 10) & 0x7)

/*!
 * Extracts the ACKINTID field from the ICCIAR register.
 */
#define ALT_INT_ICCIAR_ACKINTID_GET(icciar) (icciar & 0x3FF)

/*!
 * The callback to use when an interrupt needs to be serviced.
 *
 * \param       icciar          The Interrupt Controller CPU Interrupt
 *                              Acknowledgement Register value (ICCIAR) value
 *                              corresponding to the current interrupt.
 *
 * \param       context         The user provided context.
 */
typedef void (*alt_int_callback_t)(uint32_t icciar, void * context);

/*!
 * @}
 */

#ifdef __cplusplus
}
#endif

#endif /* __ALT_INT_COMMON_H__ */