26.02.2014 Views

Getting Started with QNX Neutrino - QNX Software Systems

Getting Started with QNX Neutrino - QNX Software Systems

Getting Started with QNX Neutrino - QNX Software Systems

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

© 2009, <strong>QNX</strong> <strong>Software</strong> <strong>Systems</strong> GmbH & Co. KG. <strong>Neutrino</strong> and interrupts<br />

Time<br />

Hardware interrupt<br />

request line<br />

1<br />

4<br />

1<br />

2<br />

2<br />

ISR x<br />

3<br />

3<br />

Process<br />

Edge-sensitive interrupt assertion.<br />

Even if the ISR fails to clear the source of the interrupt, when the kernel sends the EOI<br />

to the PIC (step 2 in the diagram), the PIC wouldn’t re-interrupt the kernel, because<br />

there isn’t another active-going edge transition after the EOI. In order to recognize<br />

another interrupt on that line, the line must first go inactive (step 4), and then active<br />

(step 1).<br />

Well, it seems all our problems have been solved! Simply use edge-sensitive for all<br />

interrupts.<br />

Unfortunately, edge-sensitive mode has a problem of its own.<br />

Suppose your ISR fails to clear the cause of the interrupt. The hardware would still<br />

have the interrupt line asserted when the kernel issues the EOI to the PIC. However,<br />

because the PIC is operating in edge-sensitive mode, it never sees another interrupt<br />

from that device.<br />

Now what kind of bozo would write an ISR that forgot to clear the source of the<br />

interrupt? Unfortunately it isn’t that cut-and-dried. Consider a case where two devices<br />

(let’s say a SCSI bus adapter and an Ethernet card) are sharing the same interrupt line,<br />

on a hardware bus architecture that allows that. (Now you’re asking, “Who’d set up a<br />

machine like that?!?” Well, it happens, especially if the number of interrupt sources on<br />

the PIC is in short supply!) In this case, the two ISR routines would be attached to the<br />

same interrupt vector (this is legal, by the way), and the kernel would call them in turn<br />

whenever it got an interrupt from the PIC for that hardware interrupt level.<br />

April 30, 2009 Chapter 4 • Interrupts 173

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!