2 * Copyright (c) 1998-2000 Apple Computer, Inc. All rights reserved.
4 * @APPLE_LICENSE_HEADER_START@
6 * The contents of this file constitute Original Code as defined in and
7 * are subject to the Apple Public Source License Version 1.1 (the
8 * "License"). You may not use this file except in compliance with the
9 * License. Please obtain a copy of the License at
10 * http://www.apple.com/publicsource and read it before using this file.
12 * This Original Code and all software distributed under the License are
13 * distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY KIND, EITHER
14 * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
15 * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
16 * FITNESS FOR A PARTICULAR PURPOSE OR NON-INFRINGEMENT. Please see the
17 * License for the specific language governing rights and limitations
20 * @APPLE_LICENSE_HEADER_END@
23 * Copyright (c) 1999 Apple Computer, Inc. All rights reserved.
30 #ifndef _IOKIT_IOINTERRUPTCONTROLLER_H
31 #define _IOKIT_IOINTERRUPTCONTROLLER_H
33 #include <IOKit/IOLocks.h>
34 #include <IOKit/IOService.h>
35 #include <IOKit/IOInterrupts.h>
38 class IOSharedInterruptController
;
40 struct IOInterruptVector
{
41 volatile char interruptActive
;
42 volatile char interruptDisabledSoft
;
43 volatile char interruptDisabledHard
;
44 volatile char interruptRegistered
;
45 IOLock
* interruptLock
;
49 IOInterruptHandler handler
;
51 IOSharedInterruptController
*sharedController
;
54 typedef struct IOInterruptVector IOInterruptVector
;
57 class IOInterruptController
: public IOService
59 OSDeclareAbstractStructors(IOInterruptController
);
62 IOInterruptVector
*vectors
;
63 IOSimpleLock
*controllerLock
;
65 struct ExpansionData
{ };
66 ExpansionData
*reserved
;
69 virtual IOReturn
registerInterrupt(IOService
*nub
, int source
,
71 IOInterruptHandler handler
,
73 virtual IOReturn
unregisterInterrupt(IOService
*nub
, int source
);
75 virtual IOReturn
getInterruptType(IOService
*nub
, int source
,
78 virtual IOReturn
enableInterrupt(IOService
*nub
, int source
);
79 virtual IOReturn
disableInterrupt(IOService
*nub
, int source
);
80 virtual IOReturn
causeInterrupt(IOService
*nub
, int source
);
82 virtual IOInterruptAction
getInterruptHandlerAddress(void);
83 virtual IOReturn
handleInterrupt(void *refCon
, IOService
*nub
,
86 // Methods to be overridden for simplifed interrupt controller subclasses.
88 virtual bool vectorCanBeShared(long vectorNumber
, IOInterruptVector
*vector
);
89 virtual void initVector(long vectorNumber
, IOInterruptVector
*vector
);
90 virtual int getVectorType(long vectorNumber
, IOInterruptVector
*vector
);
91 virtual void disableVectorHard(long vectorNumber
, IOInterruptVector
*vector
);
92 virtual void enableVector(long vectorNumber
, IOInterruptVector
*vector
);
93 virtual void causeVector(long vectorNumber
, IOInterruptVector
*vector
);
95 OSMetaClassDeclareReservedUnused(IOInterruptController
, 0);
96 OSMetaClassDeclareReservedUnused(IOInterruptController
, 1);
97 OSMetaClassDeclareReservedUnused(IOInterruptController
, 2);
98 OSMetaClassDeclareReservedUnused(IOInterruptController
, 3);
99 OSMetaClassDeclareReservedUnused(IOInterruptController
, 4);
100 OSMetaClassDeclareReservedUnused(IOInterruptController
, 5);
104 class IOSharedInterruptController
: public IOInterruptController
106 OSDeclareDefaultStructors(IOSharedInterruptController
);
111 int vectorsRegistered
;
113 volatile long controllerDisabled
;
116 struct ExpansionData
{ };
117 ExpansionData
*reserved
;
120 virtual IOReturn
initInterruptController(IOInterruptController
*parentController
, OSData
*parentSource
);
122 virtual IOReturn
registerInterrupt(IOService
*nub
, int source
,
124 IOInterruptHandler handler
,
126 virtual IOReturn
unregisterInterrupt(IOService
*nub
, int source
);
128 virtual IOReturn
getInterruptType(IOService
*nub
, int source
,
131 virtual IOReturn
enableInterrupt(IOService
*nub
, int source
);
132 virtual IOReturn
disableInterrupt(IOService
*nub
, int source
);
134 virtual IOInterruptAction
getInterruptHandlerAddress(void);
135 virtual IOReturn
handleInterrupt(void *refCon
, IOService
*nub
, int source
);
137 OSMetaClassDeclareReservedUnused(IOSharedInterruptController
, 0);
138 OSMetaClassDeclareReservedUnused(IOSharedInterruptController
, 1);
139 OSMetaClassDeclareReservedUnused(IOSharedInterruptController
, 2);
140 OSMetaClassDeclareReservedUnused(IOSharedInterruptController
, 3);
144 #endif /* ! _IOKIT_IOINTERRUPTCONTROLLER_H */