home *** CD-ROM | disk | FTP | other *** search
- /* InitializeInterrupts.c */
- /*
- * InitializeInterrupts.c
- * Copyright © 1994 Apple Computer Inc. All rights reserved.
- *
- */
- /* .___________________________________________________________________________________.
- | This function retrieves the interrupt-service property from the Name Registry |
- | It then installs a primary interrupt service routine and enables interrupts. |
- | It is independent of the specifics of the framework sample driver. |
- .___________________________________________________________________________________.
- */
-
- #include "NCRDriverPrivate.h"
-
-
- /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
- * GetDeviceInterruptPropertyInfo retrieves the interrupt-service property information
- * from the System Registry. If successful, it installs our primary interrupt service
- * routine (PCIInterruptServiceRoutine)
- */
- OSErr
- InstallDriverInterruptFunction(
- RegEntryIDPtr regEntryIDPtr, /* Driver's Name Registery ID */
- InterruptHandler interruptHandlerFunction, /* Function to install */
- InterruptSetMember *interruptSetMemberPtr, /* Gets interrupt set member */
- void **refCon, /* Gets old RefCon */
- InterruptHandler *oldHandlerFunction, /* Gets old interrrupt handler */
- InterruptEnabler *oldEnableFunction, /* Gets old enabler */
- InterruptDisabler *oldDisableFunction /* Gets old disabler */
- )
- {
- OSErr status;
- OSStatus osStatus;
- RegPropertyValueSize size;
- StringPtr failureMsg;
-
- Trace(InstallDriverInterruptFunction);
- failureMsg = NULL;
- size = sizeof (InterruptSetMember);
- status = RegistryPropertyGet(
- regEntryIDPtr,
- kISTPropertyName,
- (RegPropertyValue *) interruptSetMemberPtr,
- &size
- );
- CheckStatus(status, "\pGet interrupt set property");
- if (status != noErr)
- failureMsg = "\pCan't get interrupt set member";
- if (status == noErr) {
- /*
- * Fetch the current functions for this interrupt set.
- */
- osStatus = GetInterruptFunctions(
- interruptSetMemberPtr->setID,
- interruptSetMemberPtr->member,
- refCon,
- oldHandlerFunction,
- oldEnableFunction,
- oldDisableFunction
- );
- CheckStatus(osStatus, "\pGetInterruptFunctions");
- if (osStatus != noErr) {
- status = osStatus;
- failureMsg = "\pGetInterruptFunctions failed";
- }
- }
- if (status == noErr) {
- /*
- * Install our interrupt function for this set and member.
- */
- osStatus = InstallInterruptFunctions(
- interruptSetMemberPtr->setID,
- interruptSetMemberPtr->member,
- NULL, /* RefCon - ignored */
- interruptHandlerFunction, /* Our interrupt service func. */
- NULL, /* No new interrupt enabler */
- NULL /* No new interrupt disabler */
- );
- CheckStatus(osStatus, "\pInstallInterruptFunctions");
- if (osStatus != noErr) {
- status = osStatus;
- failureMsg = "\pInstallInterruptFunctions failed";
- }
- }
- if (status == noErr) /* Success: enable interrupts */
- (*oldEnableFunction)(*interruptSetMemberPtr, *refCon);
- else {
- PublishInitFailureMsg(status, failureMsg);
- }
- return (status);
- }
-
-
-
-
-