]>
Commit | Line | Data |
---|---|---|
1c79356b A |
1 | /* |
2 | * Copyright (c) 1998-2000 Apple Computer, Inc. All rights reserved. | |
3 | * | |
8ad349bb | 4 | * @APPLE_LICENSE_OSREFERENCE_HEADER_START@ |
1c79356b | 5 | * |
8ad349bb A |
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 | |
14 | * agreement. | |
15 | * | |
16 | * Please obtain a copy of the License at | |
17 | * http://www.opensource.apple.com/apsl/ and read it before using this | |
18 | * file. | |
19 | * | |
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. | |
27 | * | |
28 | * @APPLE_LICENSE_OSREFERENCE_HEADER_END@ | |
1c79356b A |
29 | */ |
30 | /* | |
31 | * Copyright (c) 1999 Apple Computer, Inc. All rights reserved. | |
32 | * | |
33 | * DRI: Josh de Cesare | |
34 | * | |
35 | */ | |
36 | ||
37 | ||
38 | #ifndef _IOKIT_IOINTERRUPTCONTROLLER_H | |
39 | #define _IOKIT_IOINTERRUPTCONTROLLER_H | |
40 | ||
41 | #include <IOKit/IOLocks.h> | |
42 | #include <IOKit/IOService.h> | |
43 | #include <IOKit/IOInterrupts.h> | |
44 | ||
45 | ||
46 | class IOSharedInterruptController; | |
47 | ||
48 | struct IOInterruptVector { | |
49 | volatile char interruptActive; | |
50 | volatile char interruptDisabledSoft; | |
51 | volatile char interruptDisabledHard; | |
52 | volatile char interruptRegistered; | |
53 | IOLock * interruptLock; | |
54 | IOService * nub; | |
55 | long source; | |
56 | void * target; | |
57 | IOInterruptHandler handler; | |
58 | void * refCon; | |
59 | IOSharedInterruptController *sharedController; | |
60 | }; | |
61 | ||
62 | typedef struct IOInterruptVector IOInterruptVector; | |
63 | ||
64 | ||
65 | class IOInterruptController : public IOService | |
66 | { | |
67 | OSDeclareAbstractStructors(IOInterruptController); | |
68 | ||
69 | protected: | |
70 | IOInterruptVector *vectors; | |
71 | IOSimpleLock *controllerLock; | |
72 | ||
73 | struct ExpansionData { }; | |
74 | ExpansionData *reserved; | |
75 | ||
76 | public: | |
77 | virtual IOReturn registerInterrupt(IOService *nub, int source, | |
78 | void *target, | |
79 | IOInterruptHandler handler, | |
80 | void *refCon); | |
81 | virtual IOReturn unregisterInterrupt(IOService *nub, int source); | |
82 | ||
83 | virtual IOReturn getInterruptType(IOService *nub, int source, | |
84 | int *interruptType); | |
85 | ||
86 | virtual IOReturn enableInterrupt(IOService *nub, int source); | |
87 | virtual IOReturn disableInterrupt(IOService *nub, int source); | |
88 | virtual IOReturn causeInterrupt(IOService *nub, int source); | |
89 | ||
90 | virtual IOInterruptAction getInterruptHandlerAddress(void); | |
91 | virtual IOReturn handleInterrupt(void *refCon, IOService *nub, | |
92 | int source); | |
93 | ||
94 | // Methods to be overridden for simplifed interrupt controller subclasses. | |
95 | ||
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); | |
102 | ||
103 | OSMetaClassDeclareReservedUnused(IOInterruptController, 0); | |
104 | OSMetaClassDeclareReservedUnused(IOInterruptController, 1); | |
105 | OSMetaClassDeclareReservedUnused(IOInterruptController, 2); | |
106 | OSMetaClassDeclareReservedUnused(IOInterruptController, 3); | |
107 | OSMetaClassDeclareReservedUnused(IOInterruptController, 4); | |
108 | OSMetaClassDeclareReservedUnused(IOInterruptController, 5); | |
109 | }; | |
110 | ||
111 | ||
112 | class IOSharedInterruptController : public IOInterruptController | |
113 | { | |
114 | OSDeclareDefaultStructors(IOSharedInterruptController); | |
115 | ||
116 | private: | |
117 | IOService *provider; | |
118 | int numVectors; | |
119 | int vectorsRegistered; | |
120 | int vectorsEnabled; | |
121 | volatile long controllerDisabled; | |
122 | bool sourceIsLevel; | |
123 | ||
124 | struct ExpansionData { }; | |
125 | ExpansionData *reserved; | |
126 | ||
127 | public: | |
128 | virtual IOReturn initInterruptController(IOInterruptController *parentController, OSData *parentSource); | |
129 | ||
130 | virtual IOReturn registerInterrupt(IOService *nub, int source, | |
131 | void *target, | |
132 | IOInterruptHandler handler, | |
133 | void *refCon); | |
134 | virtual IOReturn unregisterInterrupt(IOService *nub, int source); | |
135 | ||
136 | virtual IOReturn getInterruptType(IOService *nub, int source, | |
137 | int *interruptType); | |
138 | ||
139 | virtual IOReturn enableInterrupt(IOService *nub, int source); | |
140 | virtual IOReturn disableInterrupt(IOService *nub, int source); | |
141 | ||
142 | virtual IOInterruptAction getInterruptHandlerAddress(void); | |
143 | virtual IOReturn handleInterrupt(void *refCon, IOService *nub, int source); | |
144 | ||
145 | OSMetaClassDeclareReservedUnused(IOSharedInterruptController, 0); | |
146 | OSMetaClassDeclareReservedUnused(IOSharedInterruptController, 1); | |
147 | OSMetaClassDeclareReservedUnused(IOSharedInterruptController, 2); | |
148 | OSMetaClassDeclareReservedUnused(IOSharedInterruptController, 3); | |
149 | }; | |
150 | ||
151 | ||
152 | #endif /* ! _IOKIT_IOINTERRUPTCONTROLLER_H */ |