2 * Copyright (c) 1998-2000 Apple Computer, Inc. All rights reserved.
4 * @APPLE_LICENSE_OSREFERENCE_HEADER_START@
6 * This file contains Original Code and/or Modifications of Original Code
7 * as defined in and that are subject to the Apple Public Source License
8 * Version 2.0 (the 'License'). You may not use this file except in
9 * compliance with the License. The rights granted to you under the
10 * License may not be used to create, or enable the creation or
11 * redistribution of, unlawful or unlicensed copies of an Apple operating
12 * system, or to circumvent, violate, or enable the circumvention or
13 * violation of, any terms of an Apple operating system software license
16 * Please obtain a copy of the License at
17 * http://www.opensource.apple.com/apsl/ and read it before using this
20 * The Original Code and all software distributed under the License are
21 * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
22 * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
23 * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
24 * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
25 * Please see the License for the specific language governing rights and
26 * limitations under the License.
28 * @APPLE_LICENSE_OSREFERENCE_HEADER_END@
31 * Copyright (c) 1999 Apple Computer, Inc. All rights reserved.
38 #ifndef _IOKIT_IOINTERRUPTCONTROLLER_H
39 #define _IOKIT_IOINTERRUPTCONTROLLER_H
41 #include <IOKit/IOLocks.h>
42 #include <IOKit/IOService.h>
43 #include <IOKit/IOInterrupts.h>
46 class IOSharedInterruptController
;
48 struct IOInterruptVector
{
49 volatile char interruptActive
;
50 volatile char interruptDisabledSoft
;
51 volatile char interruptDisabledHard
;
52 volatile char interruptRegistered
;
53 IOLock
* interruptLock
;
57 IOInterruptHandler handler
;
59 IOSharedInterruptController
*sharedController
;
62 typedef struct IOInterruptVector IOInterruptVector
;
65 class IOInterruptController
: public IOService
67 OSDeclareAbstractStructors(IOInterruptController
);
70 IOInterruptVector
*vectors
;
71 IOSimpleLock
*controllerLock
;
73 struct ExpansionData
{ };
74 ExpansionData
*reserved
;
77 virtual IOReturn
registerInterrupt(IOService
*nub
, int source
,
79 IOInterruptHandler handler
,
81 virtual IOReturn
unregisterInterrupt(IOService
*nub
, int source
);
83 virtual IOReturn
getInterruptType(IOService
*nub
, int source
,
86 virtual IOReturn
enableInterrupt(IOService
*nub
, int source
);
87 virtual IOReturn
disableInterrupt(IOService
*nub
, int source
);
88 virtual IOReturn
causeInterrupt(IOService
*nub
, int source
);
90 virtual IOInterruptAction
getInterruptHandlerAddress(void);
91 virtual IOReturn
handleInterrupt(void *refCon
, IOService
*nub
,
94 // Methods to be overridden for simplifed interrupt controller subclasses.
96 virtual bool vectorCanBeShared(long vectorNumber
, IOInterruptVector
*vector
);
97 virtual void initVector(long vectorNumber
, IOInterruptVector
*vector
);
98 virtual int getVectorType(long vectorNumber
, IOInterruptVector
*vector
);
99 virtual void disableVectorHard(long vectorNumber
, IOInterruptVector
*vector
);
100 virtual void enableVector(long vectorNumber
, IOInterruptVector
*vector
);
101 virtual void causeVector(long vectorNumber
, IOInterruptVector
*vector
);
103 OSMetaClassDeclareReservedUnused(IOInterruptController
, 0);
104 OSMetaClassDeclareReservedUnused(IOInterruptController
, 1);
105 OSMetaClassDeclareReservedUnused(IOInterruptController
, 2);
106 OSMetaClassDeclareReservedUnused(IOInterruptController
, 3);
107 OSMetaClassDeclareReservedUnused(IOInterruptController
, 4);
108 OSMetaClassDeclareReservedUnused(IOInterruptController
, 5);
112 class IOSharedInterruptController
: public IOInterruptController
114 OSDeclareDefaultStructors(IOSharedInterruptController
);
119 int vectorsRegistered
;
121 volatile long controllerDisabled
;
124 struct ExpansionData
{ };
125 ExpansionData
*reserved
;
128 virtual IOReturn
initInterruptController(IOInterruptController
*parentController
, OSData
*parentSource
);
130 virtual IOReturn
registerInterrupt(IOService
*nub
, int source
,
132 IOInterruptHandler handler
,
134 virtual IOReturn
unregisterInterrupt(IOService
*nub
, int source
);
136 virtual IOReturn
getInterruptType(IOService
*nub
, int source
,
139 virtual IOReturn
enableInterrupt(IOService
*nub
, int source
);
140 virtual IOReturn
disableInterrupt(IOService
*nub
, int source
);
142 virtual IOInterruptAction
getInterruptHandlerAddress(void);
143 virtual IOReturn
handleInterrupt(void *refCon
, IOService
*nub
, int source
);
145 OSMetaClassDeclareReservedUnused(IOSharedInterruptController
, 0);
146 OSMetaClassDeclareReservedUnused(IOSharedInterruptController
, 1);
147 OSMetaClassDeclareReservedUnused(IOSharedInterruptController
, 2);
148 OSMetaClassDeclareReservedUnused(IOSharedInterruptController
, 3);
152 #endif /* ! _IOKIT_IOINTERRUPTCONTROLLER_H */