Interrupts
From RCSWiki
Hardware Connections
- Open up xps. (9.1 or 9.2 tools - doesnt make a difference)
- Create a basic base system with ML410, powerPC at 300 MHz, bus frequency 100 MHz memory components and some peripherals.
- Check for interrupt while selecting the UART. If you dont want to add UART to your system, dont worry...no problem.
- Now while creating the core, make sure to select on interrupt control uder IPIF Services page.
- Add your core to the system.
- In xps under system assembly view, under Bus interfaces option, make sure that the intc is connected to a bus. If you are using the 9.2 tools, it will be as xps_intc_0 connected to the PLB. In the 9.1 tools, it will opb_intc_0 connected to the OPB. (**if you cannot find the interrupt controller, click onIPcatalog on the left and under Clock, Reset and Interrupt, double click on xps interrupt controller.
- Make sure to connect the intc to the bus.
- Next ckick on Cports and under ppc405_0, make sure to have port EICC405EXTINPUTIRQ connected to L to H: EICC405EXTINPUTIRQ ( this is the connection between the intc and the ppc)
- Under the intc port, make sure to connect Irq port to EICC405EXTINPUTIRQ. You should get these options using the drop down box.
- Next go to your core and connect the intr port to the interrupt signal form the core.
- If you click on the intr port on the onterrupt controller, you should be able to see all the inerrupts signals connected to it with their priorities.
- synthesize.
Software Code
- Couple of functions are required.
- XExc_Init(); -- initializes the exception handling in the powerpc.
- XIntc_mMasterEnable(XPAR_OPB_INTC_0_BASEADDR); -- enables the interrupt controller.
- XExc_RegisterHandler(XEXC_ID_NON_CRITICAL_INT, XIntc_DeviceInterruptHandler, (void *)0);
- XIntc_RegisterHandler(XPAR_INTC_0_BASEADDR, <interrupt name form xparameters.h>, <isr function name>,(void)*0);
- XIntc_mEnableIntr(XPAR_INTC_0_BASEADDR, <name of the interrupt mask form xparameters.h>); -- enable the interrupt controller in the user core. This function is in the core's driver in the drivers directory.
- Make sure to disbale the interrupts in the isr or it will loop infinitely.
DONE!!!
