Specifications
Embedded System Tools Guide (EDK 6.2i) www.xilinx.com 341
UG111 (v1.4) January 30, 2004 1-800-255-7778
Example Systems for PowerPC
R
Example C Program
#include <xparameters.h>
/* global interrupt service routine */
void global_int_handler(void * arg) {
/* Handle the global interrupts here */
}
void
main() {
/* Initialize exception handling */
 XExc_Init();
 /* Register external interrupt handler */
 XExc_RegisterHandler(XEXC_ID_NON_CRITICAL_INT, 
(XExceptionHandler)global_int_handler, (void *)0);
/* Wait for interrupts to occur */
 while (1)
 ;
}
System with an Interrupt Controller (One or More Interrupt Signals)
An Interrupt Controller peripheral (intc) should be present if more than one interrupt can 
be raised. When an interrupt is raised, the interrupt handler for the Interrupt Controller 
(XIntc_DeviceInterruptHandler) is called. This function then accesses the interrupt 
controller to find the highest priority device that raised an interrupt. This is done via the 
vector table created automatically by LibGen. On return from the peripheral interrupt 
handler, intc interrupt handler acknowledges the interrupt. It then handles any lower 
priority interrupts, if they exist. 
Procedure
To set up a system with one or more interrupting devices and an interrupt controller, the 
following steps must be taken:
1. The MHS and MSS files must be set up as follows:
i The interrupt signals of all the peripherals must be assigned to the Intr port of the 
interrupt controller in the MHS file. The interrupt signal output of intc is then 
connected to one of the interrupt inputs (critical or no-critical) of PowerPC.
i The peripherals must be given instance names using the INSTANCE keyword in 
the MHS file. Libgen creates a definition in xparameters.h for 
XPAR_INTC_INSTANCE_INSTANCE_NAME_BASEADDR mapped to the base 
address of each peripheral for use in the user program. Libgen also creates an 
interrupt mask and interrupt ID for each interrupt signal using the priorities as 
XPAR_INTC_INSTANCE_INSTANCE_NAME_INTERRUPT_SIGNAL_NAME_M
ASK and XPAR_INTC_INSTANCE_NAME_INTERRUPT_SIGNAL_INTR. This 
can be used to enable or disable interrupts.
2. The interrupt handler functions for each interruptible peripheral must be written.










