Title: Interrupts
1Interrupts
2Two levels of interrupt management
3Level 0 Interrupt Management
- Static creation of interrupt vector table for the
interrupt controller mechanism with interrupt
handlers of all other peripheral interrupts - Libgen statically creates the interrupt vector
table based on all interrupt handlers declared
4Level 1 interrupt management
- Libgen does nothing
- User must dynamically register interrupts
handlers and enable/disable interrupts - You probably dont want to do this
5Interrupt Handlers
- You have to write your own interrupt handlers (or
interrupt service routines) - The main interrupt handler needs to be tagged
with interrupt_handler attributes so the
microblaze knows where to go in case of an
interrupt being raised - If you use an interrupt controller, Libgen will
do the tagging for you
6Interrupt Controller
- A peripheral you can add to your system
- If you specify any interrupts on uarts or timers
during system generation, the base system builder
will automatically throw in an interrupt
controller, free of charge - On any interrupt, the controller interrupt
handler will call the ISRs you have specified for
that particular inerrupt - If more than one device interrupts, highest
priority device will be handled first
7Interrupt Controller
8Enabling interrupts
- Whenever you need to enable interrupts, call
microblaze_enable_interrupts() - Strangely enough, microblaze_disable_interrupts()
will disable interrupts.
9Single Interrupt System
- If you only have one interrupt, an interrupt
controller is not needed - You can still use one if you feel like it
- Need to hook up the interrupt port on your device
with the interrupt port on the microblaze - You also must specify the interrupt handler in
the MSS file
10MSS File
BEGIN DRIVER PARAMETER DRIVER_NAME tmrctr
PARAMETER DRIVER_VER 1.00.b PARAMETER
HW_INSTANCE opb_timer_1 PARAMETER int_handler
timer_int_handler, int_port Interrupt END
11MHS File
BEGIN microblaze PARAMETER INSTANCE
microblaze_0 PARAMETER HW_VER 2.00.a
PARAMETER C_DEBUG_ENABLED 0 PARAMETER
C_NUMBER_OF_PC_BRK 1 PARAMETER
C_NUMBER_OF_RD_ADDR_BRK 0 PARAMETER
C_NUMBER_OF_WR_ADDR_BRK 0 BUS_INTERFACE DOPB
mb_opb BUS_INTERFACE IOPB mb_opb
BUS_INTERFACE DLMB dlmb BUS_INTERFACE ILMB
ilmb PORT CLK sys_clk_s PORT Interrupt
interrupt END
12MHS File cont
BEGIN opb_timer PARAMETER INSTANCE
opb_timer_1 PARAMETER HW_VER 1.00.b PARAMETER
C_COUNT_WIDTH 32 PARAMETER C_ONE_TIMER_ONLY
0 PARAMETER C_BASEADDR 0x00006300 PARAMETER
C_HIGHADDR 0x000063ff BUS_INTERFACE SOPB
mb_opb PORT OPB_Clk sys_clk_s PORT Interrupt
interrupt END
13code
void timer_int_handler(void baseaddr_p)
int baseaddr (int )baseaddr_p Blah blah
blah junk blah blah