- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic to the Top
- Bookmark
- Subscribe
- Printer Friendly Page
Informatio n Regarding How to use Interrupts in Virtex2pro (for powerpc)
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content
04-22-2012 09:28 PM
hello,
I am using virtex2pro board. I want to configure DIP switches as interrupt source so i selected interrupt option in BSB under Dip switches. Now i need to write the C code for using the interrupt Since more than one peripheral is used as in the number therefore Interrupt Controller is being used. I have written the following code after going thorugh the pdf related to interrupts
#include "xparameters.h"
#include "xgpio.h"
#include "stdio.h"
#include "xstatus.h"
#include "xuartlite_l.h"
#include "xgpio_l.h"
#include "xintc_l.h"
#include "xintc.h"
#define XPAR_LEDS_4BIT_DEVICE_ID 0
#define XPAR_DIPSWS_4BIT_DEVICE_ID 1
XGpio GpioOutput_Led;
XIntc InterruptController;
void delay()
{
int i,j;
for(i=0;i<200;i++)
{
for(j=i;j<100;j++)
{
}
}
}
void gpio_int_handler(void *baseAddr_p)
{
XGpio_mSetDataReg(XPAR_LEDS_
xil_printf("interrupt working");
}
int main()
{
/* Initialize exception handling */
XExc_Init();
/* connect the GPIO interrupt */
XIntc_RegisterHandler(XPAR_XPS_INTC_0_BASEADDR,XPA
/* Start the interrupt controller */
XIntc_mMasterEnable(XPAR_XPS_INTC_0_BASEADDR);
/* Enable dipswitch interrupts in the interrupt controller */
XIntc_mEnableIntr(XPAR_XPS_INTC_0_BASEADDR, XPAR_DIPSWS_4BIT_IP2INTC_IRPT_MASK);
/* Enable PPC non-critical interrupts */
XGpio_Initialize(&GpioOutput_Led,XPAR_LEDS_4BIT_DE
XGpio_SetDataDirection(&GpioOutput_Led,1, 0x00);
XGpio_mSetDataReg(XPAR_LEDS_4BIT_BASEADDR, 1, 0x00000000);
delay();
while(1)
{
}
}
BEGIN ppc405
PARAMETER INSTANCE = ppc405_0
PARAMETER HW_VER = 3.00.a
PARAMETER C_FASTEST_PLB_CLOCK = DPLB0
BUS_INTERFACE DPLB0 = plb0
BUS_INTERFACE IPLB0 = plb0
BUS_INTERFACE JTAGPPC = jtagppc_cntlr_0_0
BUS_INTERFACE RESETPPC = ppc_reset_bus
PORT CPMC405CLOCK = sys_clk_s
PORT EICC405EXTINPUTIRQ = EICC405EXTINPUTIRQ
END
PARAMETER INSTANCE = xps_intc_0
PARAMETER HW_VER = 1.00.a
PARAMETER C_BASEADDR = 0x81800000
PARAMETER C_HIGHADDR = 0x8180ffff
BUS_INTERFACE SPLB = plb0
PORT Irq = EICC405EXTINPUTIRQ
PORT Intr = DIPSWs_4Bit_IP2INTC_Irpt
END

Re: Informatio n Regarding How to use Interrupts in Virtex2pro (for powerpc)
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content
05-06-2012 02:19 AM
see attached pdf (a modified version of xapp778)











