]> git.sur5r.net Git - freertos/blob - FreeRTOS/Demo/CORTEX_A9_Zynq_ZC702/RTOSDemo_bsp/ps7_cortexa9_0/libsrc/scugic_v2_1/src/xscugic_hw.h
Add back Zynq demo - this time using SDK V14.2.
[freertos] / FreeRTOS / Demo / CORTEX_A9_Zynq_ZC702 / RTOSDemo_bsp / ps7_cortexa9_0 / libsrc / scugic_v2_1 / src / xscugic_hw.h
1 /******************************************************************************
2 *
3 * (c) Copyright 2010-2014 Xilinx, Inc. All rights reserved.
4 *
5 * This file contains confidential and proprietary information of Xilinx, Inc.
6 * and is protected under U.S. and international copyright and other
7 * intellectual property laws.
8 *
9 * DISCLAIMER
10 * This disclaimer is not a license and does not grant any rights to the
11 * materials distributed herewith. Except as otherwise provided in a valid
12 * license issued to you by Xilinx, and to the maximum extent permitted by
13 * applicable law: (1) THESE MATERIALS ARE MADE AVAILABLE "AS IS" AND WITH ALL
14 * FAULTS, AND XILINX HEREBY DISCLAIMS ALL WARRANTIES AND CONDITIONS, EXPRESS,
15 * IMPLIED, OR STATUTORY, INCLUDING BUT NOT LIMITED TO WARRANTIES OF
16 * MERCHANTABILITY, NON-INFRINGEMENT, OR FITNESS FOR ANY PARTICULAR PURPOSE;
17 * and (2) Xilinx shall not be liable (whether in contract or tort, including
18 * negligence, or under any other theory of liability) for any loss or damage
19 * of any kind or nature related to, arising under or in connection with these
20 * materials, including for any direct, or any indirect, special, incidental,
21 * or consequential loss or damage (including loss of data, profits, goodwill,
22 * or any type of loss or damage suffered as a result of any action brought by
23 * a third party) even if such damage or loss was reasonably foreseeable or
24 * Xilinx had been advised of the possibility of the same.
25 *
26 * CRITICAL APPLICATIONS
27 * Xilinx products are not designed or intended to be fail-safe, or for use in
28 * any application requiring fail-safe performance, such as life-support or
29 * safety devices or systems, Class III medical devices, nuclear facilities,
30 * applications related to the deployment of airbags, or any other applications
31 * that could lead to death, personal injury, or severe property or
32 * environmental damage (individually and collectively, "Critical
33 * Applications"). Customer assumes the sole risk and liability of any use of
34 * Xilinx products in Critical Applications, subject only to applicable laws
35 * and regulations governing limitations on product liability.
36 *
37 * THIS COPYRIGHT NOTICE AND DISCLAIMER MUST BE RETAINED AS PART OF THIS FILE
38 * AT ALL TIMES.
39 *
40 ******************************************************************************/
41 /*****************************************************************************/
42 /**
43 *
44 * @file xscugic_hw.h
45 *
46 * This header file contains identifiers and HW access functions (or
47 * macros) that can be used to access the device.  The user should refer to the
48 * hardware device specification for more details of the device operation.
49 * The driver functions/APIs are defined in xscugic.h.
50 *
51 * This GIC device has two parts, a distributor and CPU interface(s). Each part
52 * has separate register definition sections.
53 *
54 *
55 * <pre>
56 * MODIFICATION HISTORY:
57 *
58 * Ver   Who  Date     Changes
59 * ----- ---- -------- -----------------------------------------------------
60 * 1.00a drg  01/19/10 First release
61 * 1.01a sdm  11/09/11 "xil_exception.h" added as include.
62 *                     Macros XScuGic_EnableIntr and XScuGic_DisableIntr are
63 *                     added to enable or disable interrupts based on
64 *                     Distributor Register base address. Normally users use
65 *                     XScuGic instance and call XScuGic_Enable or
66 *                     XScuGic_Disable to enable/disable interrupts. These
67 *                     new macros are provided when user does not want to
68 *                     use an instance pointer but still wants to enable or
69 *                     disable interrupts.
70 *                     Function prototypes for functions (present in newly
71 *                     added file xscugic_hw.c) are added.
72 * 1.03a srt  02/27/13 Moved Offset calculation macros from *_hw.c (CR
73 *                     702687).
74 * 1.04a hk   05/04/13 Fix for CR#705621. Moved function prototypes
75 *                         XScuGic_SetPriTrigTypeByDistAddr and
76 *             XScuGic_GetPriTrigTypeByDistAddr here from xscugic.h
77 *
78 * </pre>
79 *
80 ******************************************************************************/
81
82 #ifndef XSCUGIC_HW_H /* prevent circular inclusions */
83 #define XSCUGIC_HW_H /* by using protection macros */
84
85 #ifdef __cplusplus
86 extern "C" {
87 #endif
88
89 /***************************** Include Files *********************************/
90
91 #include "xil_types.h"
92 #include "xil_assert.h"
93 #include "xil_io.h"
94 #include "xil_exception.h"
95
96 /************************** Constant Definitions *****************************/
97
98 /*
99  * The maximum number of interrupts supported by the hardware.
100  */
101 #define XSCUGIC_MAX_NUM_INTR_INPUTS     95
102
103 /*
104  * The maximum priority value that can be used in the GIC.
105  */
106 #define XSCUGIC_MAX_INTR_PRIO_VAL       248
107 #define XSCUGIC_INTR_PRIO_MASK                  0xF8
108
109 /** @name Distributor Interface Register Map
110  *
111  * Define the offsets from the base address for all Distributor registers of
112  * the interrupt controller, some registers may be reserved in the hardware
113  * device.
114  * @{
115  */
116 #define XSCUGIC_DIST_EN_OFFSET          0x00000000 /**< Distributor Enable
117                                                         Register */
118 #define XSCUGIC_IC_TYPE_OFFSET          0x00000004 /**< Interrupt Controller
119                                                         Type Register */
120 #define XSCUGIC_DIST_IDENT_OFFSET       0x00000008 /**< Implementor ID
121                                                         Register */
122 #define XSCUGIC_SECURITY_OFFSET         0x00000080 /**< Interrupt Security
123                                                         Register */
124 #define XSCUGIC_ENABLE_SET_OFFSET       0x00000100 /**< Enable Set
125                                                         Register */
126 #define XSCUGIC_DISABLE_OFFSET          0x00000180 /**< Enable Clear Register */
127 #define XSCUGIC_PENDING_SET_OFFSET      0x00000200 /**< Pending Set
128                                                         Register */
129 #define XSCUGIC_PENDING_CLR_OFFSET      0x00000280 /**< Pending Clear
130                                                         Register */
131 #define XSCUGIC_ACTIVE_OFFSET           0x00000300 /**< Active Status Register */
132 #define XSCUGIC_PRIORITY_OFFSET         0x00000400 /**< Priority Level Register */
133 #define XSCUGIC_SPI_TARGET_OFFSET       0x00000800 /**< SPI Target
134                                                         Register 0x800-0x8FB */
135 #define XSCUGIC_INT_CFG_OFFSET          0x00000C00 /**< Interrupt Configuration
136                                                         Register 0xC00-0xCFC */
137 #define XSCUGIC_PPI_STAT_OFFSET         0x00000D00 /**< PPI Status Register */
138 #define XSCUGIC_SPI_STAT_OFFSET         0x00000D04 /**< SPI Status Register
139                                                         0xd04-0xd7C */
140 #define XSCUGIC_AHB_CONFIG_OFFSET       0x00000D80 /**< AHB Configuration
141                                                         Register */
142 #define XSCUGIC_SFI_TRIG_OFFSET         0x00000F00 /**< Software Triggered
143                                                         Interrupt Register */
144 #define XSCUGIC_PERPHID_OFFSET          0x00000FD0 /**< Peripheral ID Reg */
145 #define XSCUGIC_PCELLID_OFFSET          0x00000FF0 /**< Pcell ID Register */
146 /* @} */
147
148 /** @name  Distributor Enable Register
149  * Controls if the distributor response to external interrupt inputs.
150  * @{
151  */
152 #define XSCUGIC_EN_INT_MASK             0x00000001 /**< Interrupt In Enable */
153 /* @} */
154
155 /** @name  Interrupt Controller Type Register
156  * @{
157  */
158 #define XSCUGIC_LSPI_MASK       0x0000F800 /**< Number of Lockable
159                                                 Shared Peripheral
160                                                 Interrupts*/
161 #define XSCUGIC_DOMAIN_MASK     0x00000400 /**< Number os Security domains*/
162 #define XSCUGIC_CPU_NUM_MASK    0x000000E0 /**< Number of CPU Interfaces */
163 #define XSCUGIC_NUM_INT_MASK    0x0000001F /**< Number of Interrupt IDs */
164 /* @} */
165
166 /** @name  Implementor ID Register
167  * Implementor and revision information.
168  * @{
169  */
170 #define XSCUGIC_REV_MASK        0x00FFF000 /**< Revision Number */
171 #define XSCUGIC_IMPL_MASK       0x00000FFF /**< Implementor */
172 /* @} */
173
174 /** @name  Interrupt Security Registers
175  * Each bit controls the security level of an interrupt, either secure or non
176  * secure. These registers can only be accessed using secure read and write.
177  * There are registers for each of the CPU interfaces at offset 0x080.  A
178  * register set for the SPI interrupts is available to all CPU interfaces.
179  * There are up to 32 of these registers staring at location 0x084.
180  * @{
181  */
182 #define XSCUGIC_INT_NS_MASK     0x00000001 /**< Each bit corresponds to an
183                                                 INT_ID */
184 /* @} */
185
186 /** @name  Enable Set Register
187  * Each bit controls the enabling of an interrupt, a 0 is disabled, a 1 is
188  * enabled. Writing a 0 has no effect. Use the ENABLE_CLR register to set a
189  * bit to 0.
190  * There are registers for each of the CPU interfaces at offset 0x100. With up
191  * to 8 registers aliased to the same address. A register set for the SPI
192  * interrupts is available to all CPU interfaces.
193  * There are up to 32 of these registers staring at location 0x104.
194  * @{
195  */
196 #define XSCUGIC_INT_EN_MASK     0x00000001 /**< Each bit corresponds to an
197                                                 INT_ID */
198 /* @} */
199
200 /** @name  Enable Clear Register
201  * Each bit controls the disabling of an interrupt, a 0 is disabled, a 1 is
202  * enabled. Writing a 0 has no effect. Writing a 1 disables an interrupt and
203  * sets the corresponding bit to 0.
204  * There are registers for each of the CPU interfaces at offset 0x180. With up
205  * to 8 registers aliased to the same address.
206  * A register set for the SPI interrupts is available to all CPU interfaces.
207  * There are up to 32 of these registers staring at location 0x184.
208  * @{
209  */
210 #define XSCUGIC_INT_CLR_MASK    0x00000001 /**< Each bit corresponds to an
211                                                 INT_ID */
212 /* @} */
213
214 /** @name  Pending Set Register
215  * Each bit controls the Pending or Active and Pending state of an interrupt, a
216  * 0 is not pending, a 1 is pending. Writing a 0 has no effect. Writing a 1 sets
217  * an interrupt to the pending state.
218  * There are registers for each of the CPU interfaces at offset 0x200. With up
219  * to 8 registers aliased to the same address.
220  * A register set for the SPI interrupts is available to all CPU interfaces.
221  * There are up to 32 of these registers staring at location 0x204.
222  * @{
223  */
224 #define XSCUGIC_PEND_SET_MASK   0x00000001 /**< Each bit corresponds to an
225                                                 INT_ID */
226 /* @} */
227
228 /** @name  Pending Clear Register
229  * Each bit can clear the Pending or Active and Pending state of an interrupt, a
230  * 0 is not pending, a 1 is pending. Writing a 0 has no effect. Writing a 1
231  * clears the pending state of an interrupt.
232  * There are registers for each of the CPU interfaces at offset 0x280. With up
233  * to 8 registers aliased to the same address.
234  * A register set for the SPI interrupts is available to all CPU interfaces.
235  * There are up to 32 of these registers staring at location 0x284.
236  * @{
237  */
238 #define XSCUGIC_PEND_CLR_MASK   0x00000001 /**< Each bit corresponds to an
239                                                 INT_ID */
240 /* @} */
241
242 /** @name  Active Status Register
243  * Each bit provides the Active status of an interrupt, a
244  * 0 is not Active, a 1 is Active. This is a read only register.
245  * There are registers for each of the CPU interfaces at offset 0x300. With up
246  * to 8 registers aliased to each address.
247  * A register set for the SPI interrupts is available to all CPU interfaces.
248  * There are up to 32 of these registers staring at location 0x380.
249  * @{
250  */
251 #define XSCUGIC_ACTIVE_MASK     0x00000001 /**< Each bit corresponds to an
252                                               INT_ID */
253 /* @} */
254
255 /** @name  Priority Level Register
256  * Each byte in a Priority Level Register sets the priority level of an
257  * interrupt. Reading the register provides the priority level of an interrupt.
258  * There are registers for each of the CPU interfaces at offset 0x400 through
259  * 0x41C. With up to 8 registers aliased to each address.
260  * 0 is highest priority, 0xFF is lowest.
261  * A register set for the SPI interrupts is available to all CPU interfaces.
262  * There are up to 255 of these registers staring at location 0x420.
263  * @{
264  */
265 #define XSCUGIC_PRIORITY_MASK   0x000000FF /**< Each Byte corresponds to an
266                                                 INT_ID */
267 #define XSCUGIC_PRIORITY_MAX    0x000000FF /**< Highest value of a priority
268                                                 actually the lowest priority*/
269 /* @} */
270
271 /** @name  SPI Target Register 0x800-0x8FB
272  * Each byte references a separate SPI and programs which of the up to 8 CPU
273  * interfaces are sent a Pending interrupt.
274  * There are registers for each of the CPU interfaces at offset 0x800 through
275  * 0x81C. With up to 8 registers aliased to each address.
276  * A register set for the SPI interrupts is available to all CPU interfaces.
277  * There are up to 255 of these registers staring at location 0x820.
278  *
279  * This driver does not support multiple CPU interfaces. These are included
280  * for complete documentation.
281  * @{
282  */
283 #define XSCUGIC_SPI_CPU7_MASK   0x00000080 /**< CPU 7 Mask*/
284 #define XSCUGIC_SPI_CPU6_MASK   0x00000040 /**< CPU 6 Mask*/
285 #define XSCUGIC_SPI_CPU5_MASK   0x00000020 /**< CPU 5 Mask*/
286 #define XSCUGIC_SPI_CPU4_MASK   0x00000010 /**< CPU 4 Mask*/
287 #define XSCUGIC_SPI_CPU3_MASK   0x00000008 /**< CPU 3 Mask*/
288 #define XSCUGIC_SPI_CPU2_MASK   0x00000003 /**< CPU 2 Mask*/
289 #define XSCUGIC_SPI_CPU1_MASK   0x00000002 /**< CPU 1 Mask*/
290 #define XSCUGIC_SPI_CPU0_MASK   0x00000001 /**< CPU 0 Mask*/
291 /* @} */
292
293 /** @name  Interrupt Configuration Register 0xC00-0xCFC
294  * The interrupt configuration registers program an SFI to be active HIGH level
295  * sensitive or rising edge sensitive.
296  * Each bit pair describes the configuration for an INT_ID.
297  * SFI    Read Only    b10 always
298  * PPI    Read Only    depending on how the PPIs are configured.
299  *                    b01    Active HIGH level sensitive
300  *                    b11 Rising edge sensitive
301  * SPI                LSB is read only.
302  *                    b01    Active HIGH level sensitive
303  *                    b11 Rising edge sensitive/
304  * There are registers for each of the CPU interfaces at offset 0xC00 through
305  * 0xC04. With up to 8 registers aliased to each address.
306  * A register set for the SPI interrupts is available to all CPU interfaces.
307  * There are up to 255 of these registers staring at location 0xC08.
308  * @{
309  */
310 #define XSCUGIC_INT_CFG_MASK    0x00000003    /**< */
311 /* @} */
312
313 /** @name  PPI Status Register
314  * Enables an external AMBA master to access the status of the PPI inputs.
315  * A CPU can only read the status of its local PPI signals and cannot read the
316  * status for other CPUs.
317  * This register is aliased for each CPU interface.
318  * @{
319  */
320 #define XSCUGIC_PPI_C15_MASK    0x00008000    /**< PPI Status */
321 #define XSCUGIC_PPI_C14_MASK    0x00004000    /**< PPI Status */
322 #define XSCUGIC_PPI_C13_MASK    0x00002000    /**< PPI Status */
323 #define XSCUGIC_PPI_C12_MASK    0x00001000    /**< PPI Status */
324 #define XSCUGIC_PPI_C11_MASK    0x00000800    /**< PPI Status */
325 #define XSCUGIC_PPI_C10_MASK    0x00000400    /**< PPI Status */
326 #define XSCUGIC_PPI_C09_MASK    0x00000200    /**< PPI Status */
327 #define XSCUGIC_PPI_C08_MASK    0x00000100    /**< PPI Status */
328 #define XSCUGIC_PPI_C07_MASK    0x00000080    /**< PPI Status */
329 #define XSCUGIC_PPI_C06_MASK    0x00000040    /**< PPI Status */
330 #define XSCUGIC_PPI_C05_MASK    0x00000020    /**< PPI Status */
331 #define XSCUGIC_PPI_C04_MASK    0x00000010    /**< PPI Status */
332 #define XSCUGIC_PPI_C03_MASK    0x00000008    /**< PPI Status */
333 #define XSCUGIC_PPI_C02_MASK    0x00000004    /**< PPI Status */
334 #define XSCUGIC_PPI_C01_MASK    0x00000002    /**< PPI Status */
335 #define XSCUGIC_PPI_C00_MASK    0x00000001    /**< PPI Status */
336 /* @} */
337
338 /** @name  SPI Status Register 0xd04-0xd7C
339  * Enables an external AMBA master to access the status of the SPI inputs.
340  * There are up to 63 registers if the maximum number of SPI inputs are
341  * configured.
342  * @{
343  */
344 #define XSCUGIC_SPI_N_MASK    0x00000001    /**< Each bit corresponds to an SPI
345                                              input */
346 /* @} */
347
348 /** @name  AHB Configuration Register
349  * Provides the status of the CFGBIGEND input signal and allows the endianess
350  * of the GIC to be set.
351  * @{
352  */
353 #define XSCUGIC_AHB_END_MASK       0x00000004    /**< 0-GIC uses little Endian,
354                                                   1-GIC uses Big Endian */
355 #define XSCUGIC_AHB_ENDOVR_MASK    0x00000002    /**< 0-Uses CFGBIGEND control,
356                                                   1-use the AHB_END bit */
357 #define XSCUGIC_AHB_TIE_OFF_MASK   0x00000001    /**< State of CFGBIGEND */
358
359 /* @} */
360
361 /** @name  Software Triggered Interrupt Register
362  * Controls issueing of software interrupts.
363  * @{
364  */
365 #define XSCUGIC_SFI_SELFTRIG_MASK       0x02010000
366 #define XSCUGIC_SFI_TRIG_TRGFILT_MASK    0x03000000    /**< Target List filter
367                                                             b00-Use the target List
368                                                             b01-All CPUs except requester
369                                                             b10-To Requester
370                                                             b11-reserved */
371 #define XSCUGIC_SFI_TRIG_CPU_MASK       0x00FF0000    /**< CPU Target list */
372 #define XSCUGIC_SFI_TRIG_SATT_MASK      0x00008000    /**< 0= Use a secure interrupt */
373 #define XSCUGIC_SFI_TRIG_INTID_MASK     0x0000000F    /**< Set to the INTID
374                                                         signaled to the CPU*/
375 /* @} */
376
377 /** @name CPU Interface Register Map
378  *
379  * Define the offsets from the base address for all CPU registers of the
380  * interrupt controller, some registers may be reserved in the hardware device.
381  * @{
382  */
383 #define XSCUGIC_CONTROL_OFFSET          0x00000000 /**< CPU Interface Control
384                                                         Register */
385 #define XSCUGIC_CPU_PRIOR_OFFSET        0x00000004 /**< Priority Mask Reg */
386 #define XSCUGIC_BIN_PT_OFFSET           0x00000008 /**< Binary Point Register */
387 #define XSCUGIC_INT_ACK_OFFSET          0x0000000C /**< Interrupt ACK Reg */
388 #define XSCUGIC_EOI_OFFSET              0x00000010 /**< End of Interrupt Reg */
389 #define XSCUGIC_RUN_PRIOR_OFFSET        0x00000014 /**< Running Priority Reg */
390 #define XSCUGIC_HI_PEND_OFFSET          0x00000018 /**< Highest Pending Interrupt
391                                                         Register */
392 #define XSCUGIC_ALIAS_BIN_PT_OFFSET     0x0000001C /**< Aliased non-Secure
393                                                         Binary Point Register */
394
395 /**<  0x00000020 to 0x00000FBC are reserved and should not be read or written
396  * to. */
397 /* @} */
398
399
400 /** @name Control Register
401  * CPU Interface Control register definitions
402  * All bits are defined here although some are not available in the non-secure
403  * mode.
404  * @{
405  */
406 #define XSCUGIC_CNTR_SBPR_MASK  0x00000010    /**< Secure Binary Pointer,
407                                                  0=separate registers,
408                                                  1=both use bin_pt_s */
409 #define XSCUGIC_CNTR_FIQEN_MASK 0x00000008    /**< Use nFIQ_C for secure
410                                                   interrupts,
411                                                   0= use IRQ for both,
412                                                   1=Use FIQ for secure, IRQ for non*/
413 #define XSCUGIC_CNTR_ACKCTL_MASK        0x00000004    /**< Ack control for secure or non secure */
414 #define XSCUGIC_CNTR_EN_NS_MASK         0x00000002    /**< Non Secure enable */
415 #define XSCUGIC_CNTR_EN_S_MASK          0x00000001    /**< Secure enable, 0=Disabled, 1=Enabled */
416 /* @} */
417
418 /** @name Priority Mask Register
419  * Priority Mask register definitions
420  * The CPU interface does not send interrupt if the level of the interrupt is
421  * lower than the level of the register.
422  * @{
423  */
424 #define XSCUGIC_PRIORITY_MASK           0x000000FF    /**< All interrupts */
425 /* @} */
426
427 /** @name Binary Point Register
428  * Binary Point register definitions
429  * @{
430  */
431
432 #define XSCUGIC_BIN_PT_MASK     0x00000007  /**< Binary point mask value
433                                                 Value  Secure  Non-secure
434                                                 b000    0xFE    0xFF
435                                                 b001    0xFC    0xFE
436                                                 b010    0xF8    0xFC
437                                                 b011    0xF0    0xF8
438                                                 b100    0xE0    0xF0
439                                                 b101    0xC0    0xE0
440                                                 b110    0x80    0xC0
441                                                 b111    0x00    0x80
442                                                 */
443 /*@}*/
444
445 /** @name Interrupt Acknowledge Register
446  * Interrupt Acknowledge register definitions
447  * Identifies the current Pending interrupt, and the CPU ID for software
448  * interrupts.
449  */
450 #define XSCUGIC_ACK_INTID_MASK          0x000003FF /**< Interrupt ID */
451 #define XSCUGIC_CPUID_MASK              0x00000C00 /**< CPU ID */
452 /* @} */
453
454 /** @name End of Interrupt Register
455  * End of Interrupt register definitions
456  * Allows the CPU to signal the GIC when it completes an interrupt service
457  * routine.
458  */
459 #define XSCUGIC_EOI_INTID_MASK          0x000003FF /**< Interrupt ID */
460
461 /* @} */
462
463 /** @name Running Priority Register
464  * Running Priority register definitions
465  * Identifies the interrupt priority level of the highest priority active
466  * interrupt.
467  */
468 #define XSCUGIC_RUN_PRIORITY_MASK       0x00000FF    /**< Interrupt Priority */
469 /* @} */
470
471 /*
472  * Highest Pending Interrupt register definitions
473  * Identifies the interrupt priority of the highest priority pending interupt
474  */
475 #define XSCUGIC_PEND_INTID_MASK         0x000003FF /**< Pending Interrupt ID */
476 #define XSCUGIC_CPUID_MASK              0x00000C00 /**< CPU ID */
477 /* @} */
478
479 /***************** Macros (Inline Functions) Definitions *********************/
480
481 /****************************************************************************/
482 /**
483 *
484 * Read the Interrupt Configuration Register offset for an interrupt id.
485 *
486 * @param        InterruptID is the interrupt number.
487 *
488 * @return       The 32-bit value of the offset
489 *
490 * @note
491 *
492 *****************************************************************************/
493 #define XSCUGIC_INT_CFG_OFFSET_CALC(InterruptID) \
494         (XSCUGIC_INT_CFG_OFFSET + ((InterruptID/16) * 4))
495
496 /****************************************************************************/
497 /**
498 *
499 * Read the Interrupt Priority Register offset for an interrupt id.
500 *
501 * @param        InterruptID is the interrupt number.
502 *
503 * @return       The 32-bit value of the offset
504 *
505 * @note
506 *
507 *****************************************************************************/
508 #define XSCUGIC_PRIORITY_OFFSET_CALC(InterruptID) \
509         (XSCUGIC_PRIORITY_OFFSET + ((InterruptID/4) * 4))
510
511 /****************************************************************************/
512 /**
513 *
514 * Read the SPI Target Register offset for an interrupt id.
515 *
516 * @param        InterruptID is the interrupt number.
517 *
518 * @return       The 32-bit value of the offset
519 *
520 * @note
521 *
522 *****************************************************************************/
523 #define XSCUGIC_SPI_TARGET_OFFSET_CALC(InterruptID) \
524         (XSCUGIC_SPI_TARGET_OFFSET + ((InterruptID/4) * 4))
525
526 /****************************************************************************/
527 /**
528 *
529 * Read the Interrupt Clear-Enable Register offset for an interrupt ID
530 *
531 * @param        Register is the register offset for the clear/enable bank.
532 * @param        InterruptID is the interrupt number.
533 *
534 * @return       The 32-bit value of the offset
535 *
536 * @note
537 *
538 *****************************************************************************/
539 #define XSCUGIC_ENABLE_DISABLE_OFFSET_CALC(Register, InterruptID) \
540         (Register + ((InterruptID/32) * 4))
541
542 /****************************************************************************/
543 /**
544 *
545 * Read the given Intc register.
546 *
547 * @param        BaseAddress is the base address of the device.
548 * @param        RegOffset is the register offset to be read
549 *
550 * @return       The 32-bit value of the register
551 *
552 * @note
553 * C-style signature:
554 *    u32 XScuGic_ReadReg(u32 BaseAddress, u32 RegOffset)
555 *
556 *****************************************************************************/
557 #define XScuGic_ReadReg(BaseAddress, RegOffset) \
558         (Xil_In32((BaseAddress) + (RegOffset)))
559
560
561 /****************************************************************************/
562 /**
563 *
564 * Write the given Intc register.
565 *
566 * @param        BaseAddress is the base address of the device.
567 * @param        RegOffset is the register offset to be written
568 * @param        Data is the 32-bit value to write to the register
569 *
570 * @return       None.
571 *
572 * @note
573 * C-style signature:
574 *    void XScuGic_WriteReg(u32 BaseAddress, u32 RegOffset, u32 Data)
575 *
576 *****************************************************************************/
577 #define XScuGic_WriteReg(BaseAddress, RegOffset, Data) \
578         (Xil_Out32(((BaseAddress) + (RegOffset)), ((u32)Data)))
579
580
581 /****************************************************************************/
582 /**
583 *
584 * Enable specific interrupt(s) in the interrupt controller.
585 *
586 * @param        DistBaseAddress is the Distributor Register base address of the
587 *               device
588 * @param        Int_Id is the ID of the interrupt source and should be in the
589 *               range of 0 to XSCUGIC_MAX_NUM_INTR_INPUTS - 1
590 *
591 * @return       None.
592 *
593 * @note         C-style signature:
594 *               void XScuGic_EnableIntr(u32 DistBaseAddress, u32 Int_Id);
595 *
596 *****************************************************************************/
597 #define XScuGic_EnableIntr(DistBaseAddress, Int_Id) \
598         XScuGic_WriteReg((DistBaseAddress), \
599                          XSCUGIC_ENABLE_SET_OFFSET + ((Int_Id / 32) * 4), \
600                          (1 << (Int_Id % 32)))
601
602 /****************************************************************************/
603 /**
604 *
605 * Disable specific interrupt(s) in the interrupt controller.
606 *
607 * @param        DistBaseAddress is the Distributor Register base address of the
608 *               device
609 * @param        Int_Id is the ID of the interrupt source and should be in the
610 *               range of 0 to XSCUGIC_MAX_NUM_INTR_INPUTS - 1
611 *
612 *
613 * @return       None.
614 *
615 * @note         C-style signature:
616 *               void XScuGic_DisableIntr(u32 DistBaseAddress, u32 Int_Id);
617 *
618 *****************************************************************************/
619 #define XScuGic_DisableIntr(DistBaseAddress, Int_Id) \
620         XScuGic_WriteReg((DistBaseAddress), \
621                          XSCUGIC_DISABLE_OFFSET + ((Int_Id / 32) * 4), \
622                          (1 << (Int_Id % 32)))
623
624
625 /************************** Function Prototypes ******************************/
626
627 void XScuGic_DeviceInterruptHandler(void *DeviceId);
628 int  XScuGic_DeviceInitialize(u32 DeviceId);
629 void XScuGic_RegisterHandler(u32 BaseAddress, int InterruptId,
630                              Xil_InterruptHandler Handler, void *CallBackRef);
631 void XScuGic_SetPriTrigTypeByDistAddr(u32 DistBaseAddress, u32 Int_Id,
632                                         u8 Priority, u8 Trigger);
633 void XScuGic_GetPriTrigTypeByDistAddr(u32 DistBaseAddress, u32 Int_Id,
634                                         u8 *Priority, u8 *Trigger);
635 /************************** Variable Definitions *****************************/
636 #ifdef __cplusplus
637 }
638 #endif
639
640 #endif            /* end of protection macro */
641