Specifications

Embedded System Tools Guide (EDK 6.2i) www.xilinx.com 333
UG111 (v1.4) January 30, 2004 1-800-255-7778
Example Systems
R
end
Example MSS File snippet
PARAMETER int_handler = global_int_handler, int_port = interrupt_in1
Example C Program
#include <xparameters.h>
/* global interrupt service routine */
void global_int_handler(void * arg) {
/* Handle the global interrupts here */
}
void
main() {
/* Enable microblaze interrupts */
microblaze_enable_interrupts();
/* 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 the interrupt input of MicroBlaze.
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