[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

RE: what happens if 2 INTs occur at same time



Many thanks to Thomas J. Merritt. This information really helps in
bringing forward our project. In general literature spend a lot of time
to describe the interrupt behavior based on PC architecture. It doesn't
come to my mind that the interruptackn. cycle isn't a must.

Hans-Jürgen Klemt
design engineer
ADVA AG (cellware broardband)
jk@cellware.de
tel. +49-30-670 080 167
fax. +49-30-670 080 108

> -----Original Message-----
> From: Thomas J. Merritt [mailto:tjm@codegen.com]
> Sent: Thursday, April 13, 2000 4:23 PM
> To: Jürgen Klemt
> Cc: PCI Mailing List
> Subject: Re: what happens if 2 INTs occur at same time
>
> The first confusion is that an interrupt acknowledge cycle will or needs
> to be done after the interrupt line is raised.  The interrupt ack cycle
> are primarily for backwards compatability with older PC hardware.  In
> these system the 8259 interrupt controler was across the PCI bus and in
> order for the processesor interrupt ack cycles to get to the 8259 they
> needed to traverse the PCI bus.  The mechanism used is the interrupt
> ack. PCI cycle.  The interrupt ack mechanism is only used for getting
> interrupt vectors from an interrupt controller and is NOT used for
> getting a vector from an interrupting device.  Your CPCI boards will
> not be generating vectors.  See the EPIC section of the 8240 users manual
> for the details on 8240 interrupt handling..
>
> If the CPCI interrupt lines will be routed to the 8240 with the 8240
> in direct IRQ mode then, if two interrupt sources kick the same line
> at the same time the 8240 will vector to just one interrupt service routine.
> In that interrupt service routine you will need to check both devices that
> are connected on that line for an interrupt condition.  In general
> interrupt handling logic looks like the following.
>
> 	void
> 	handle_IRQ0()
> 	{
> 	    struct handler_info *handlers;
>
> 	    for (handlers = interrupt_handlers[INTERRUPT_IRQ0]; handlers;
> 			handlers = handlers->next)
> 		(*handlers->func)(*handlers->arg);
> 	}
>
> Then in your interrupt handler you might do something like the following.
>
> 	void
> 	device_interrupt_handler(struct device_info *dev)
> 	{
> 	    while (1)
> 	    {
> 		int interrupts = dev->regs[DEV_INTERRUPT_STATUS];
>
> 		if (!interrupts)
> 		    return;
>
> 		if (interrupts & DEV_INTERRUPT_CONDITION1_BIT)
> 		    /* handle interrupt condition 1 here */
> 		else if (interrupts & DEV_INTERRUPT_CONDITION2_BIT)
> 		    /* handle interrupt condition 2 here */
> 		else
> 		    ...
> 	    }
> 	}
>
>
> Thomas J. Merritt
> Software Consultant
> CodeGen, Inc.
> tjm@codegen.com
> 1-415-834-9111
>