[comp.os.os2.programmer] Sharing Interrupts on a PS/2

gerry@dialogic.com (Gerry Lachac) (06/01/91)

I have a question concerning the sharing of interrupts by a device
driver on a PS/2.  If I have two drivers that request the same
interrupt using the SetIRQ DevHlp, which ISR (interrupt service
routine) is called first?  For example :

	Driver A calls  SetIRQ(3,ISRa) and later,
	Driver B calls  SetIRQ(3,ISRb)


When an interrupt 3 comes in, does OS/2 call Driver A's ISR first
(since it was the first set) or Driver B's?



-gerry




-- 
uunet!dialogic!gerry   | "Even a dead plant turns  |	Dialogic Corporation
	OR	       |  over a new leaf 	   |	300 Littleton Rd
gerry@dialogic.UUCP    |  when the wind blows."	   |	Parsippany, NJ 07054 
		       |  			   |	(201)334-8450

klos@bcrvmpc3.vnet.ibm.com (Marty Klos) (06/01/91)

References: <1991May31.194019.3122@dialogic.com>

gerry@dialogic.com (Gerry Lachac) writes:
>                    If I have two drivers that request the same
> interrupt using the SetIRQ DevHlp, which ISR (interrupt service
> routine) is called first?

According to the book (see note *):
  "POSITION RULE An interrupt handler that shares an interrupt level
      must not depend on its position int the list of handlers for that
      interrupt level."

My interpretation is that the order is undefined.  Unfortunately,
this does not help you predict how long after an interrupt occurs
before a particular interrupt handler gets control.

* - page 2-20, IBM OS/2 Programming Tools and Information,
    Version 1.2, I/O Subsystems and Device Support,
    Volume 1, Device Drivers

Marty Klos                           | Disclaimer: The statements above
IBM, Boca Raton, FL                  | are my own and not necessarily
Internet: klos@bcrvmpc3.vnet.ibm.com | those of my employer.

gerry@dialogic.com (Gerry Lachac) (06/03/91)

In article <9105312050.AA16347@ucbvax.Berkeley.EDU> klos@bcrvmpc3.vnet.ibm.com (Marty Klos) writes:
>
>According to the book (see note *):
>  "POSITION RULE An interrupt handler that shares an interrupt level
>      must not depend on its position int the list of handlers for that
>      interrupt level."
>
>My interpretation is that the order is undefined.  Unfortunately,
>this does not help you predict how long after an interrupt occurs
>before a particular interrupt handler gets control.

Agreed.   After looking into this furthur, running some tests, setting
some breakpoints (and looking at the IBM docs - thanks :-), it seems
to me that the interrupt handlers are called at seemingly random
times.  I would venture to guess that maybe the interrupt routines are
called in some round-robin manner for performance reasons.  That seems
reasonable to me.

In level-sensitive mode, the 8259 interrupt controller locks out the
interrupt level if a number of spurious interrupts are received.  Is
it possible to alter this number or disable this feature under OS/2?



-- 
uunet!dialogic!gerry   | "Even a dead plant turns  |	Dialogic Corporation
	OR	       |  over a new leaf 	   |	300 Littleton Rd
gerry@dialogic.UUCP    |  when the wind blows."	   |	Parsippany, NJ 07054 
		       |  			   |	(201)334-8450

jjr@sgtech.UUCP (John Radigan) (06/04/91)

From article <1991May31.194019.3122@dialogic.com>, by gerry@dialogic.com (Gerry Lachac):
> 	Driver A calls  SetIRQ(3,ISRa) and later,
> 	Driver B calls  SetIRQ(3,ISRb)
> 
> 
> When an interrupt 3 comes in, does OS/2 call Driver A's ISR first
> (since it was the first set) or Driver B's?

I quote from IBM OS/2 Programming Tools and Information 1.2, I/O Subsystems and
Device Support, Volume 1, page 2-20. 

   "POSITION RULE An interrupt handler that shares an interrupt level must
         not depend on its position in the list of handlers for that inter-
         rupt level."

There is no mention of the calling sequence applied by the interrupt manager.


--
John Radigan, Star Gate Technologies, Inc., Solon, Ohio  
Email: jjr@sgtech.uucp		Telephone: (216) 349-1860 x666