PATH 
ADC Home > Documentation > Hardware > Device Managers and Drivers > PCI Card Services > Designing PCI Cards and Drivers for Power Macintosh Computers


  

Interrupt Dispatching

ISRs do all of the actual processing to service a hardware interrupt. When a device generates a hardware interrupt request, the interrupt dispatching process designates the root member of the IST the current parent member and invokes its ISR routine. The ISR decides which of the root member's child members should be designated as the current parent member for continued categorization of the interrupt and returns the InterruptMemberNumber value of that child member. As each subsequent child member is designated as the current parent member, its ISR is invoked to decide which of its child members should next be designated in the same way. Ultimately a leaf member is reached, which represents the specific interrupt source. When the leaf member's ISR is invoked, it services the specific requesting interrupt source. It then signals that processing for the interrupt is completed by returning the kIsrIsComplete constant. If there is no ISR attached to the leaf member, the interrupt request is dismissed as a spurious interrupt and system error is returned.

Consider an example using the simplified IST diagrammed in Figure 11-2. Assume that the interrupt source represented by the IST member set D, InterruptMemberNumber value 1, requests an interruption. Interrupt dispatching begins by invoking the ISR of member set A, InterruptMemberNumber value 1, which returns an InterruptMemberNumber value of 2. This invokes the ISR of member set B, InterruptMemberNumber value 2, which returns an InterruptMemberNumber value of 3. The ISR of member set C, InterruptMemberNumber 3 is then invoked, and it returns an InterruptMemberNumber of 1. Finally, the ISR of IST member set D, InterruptMemberNumber 1, is invoked, which tries to service the requesting device. The ISR returns kIsrIsComplete if the device was successfully serviced and kIsrIsNotComplete if it was not successfully serviced.

Mac OS expects an ISR to return a value of kIsrIsComplete if it believes that the hardware associated with the ISR caused, or may have caused the interrupt. Only if an ISR is certain that its hardware did not cause the interrupt, should it return a value of kIsrIsNotComplete. This is true for all ISRs, unless a driver has created its own sub-tree that would allow the children of that tree to return whatever is desired by the parent node in that tree. The parent of that sub-tree is still required to follow the aforementioned rules regarding what the Mac OS expects from an ISR.

At this point the dispatching process is not complete; the tree must now be traversed back to the root. This must be done because each interrupt member set can have dispatching options attached to the set that modifies dispatching behavior. Once a leaf member's ISR has been invoked, the traversal path must be retraced toward the root to see if any parent members on the path belong to an interrupt set with dispatching options. These options can take two forms:

Using kIsrIsComplete

Using kIsrIsNotComplete

Interrupt Priority


© 1999 Apple Computer, Inc. – (Last Updated 26 March 99)