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