1c1dac77fSApple OSS Distributions /*
2c1dac77fSApple OSS Distributions  * Copyright (c) 1998-2000 Apple Computer, Inc. All rights reserved.
3c1dac77fSApple OSS Distributions  *
4*e13b1fa5SApple OSS Distributions  * @APPLE_OSREFERENCE_LICENSE_HEADER_START@
5c1dac77fSApple OSS Distributions  *
6*e13b1fa5SApple OSS Distributions  * This file contains Original Code and/or Modifications of Original Code
7*e13b1fa5SApple OSS Distributions  * as defined in and that are subject to the Apple Public Source License
8*e13b1fa5SApple OSS Distributions  * Version 2.0 (the 'License'). You may not use this file except in
9*e13b1fa5SApple OSS Distributions  * compliance with the License. The rights granted to you under the License
10*e13b1fa5SApple OSS Distributions  * may not be used to create, or enable the creation or redistribution of,
11*e13b1fa5SApple OSS Distributions  * unlawful or unlicensed copies of an Apple operating system, or to
12*e13b1fa5SApple OSS Distributions  * circumvent, violate, or enable the circumvention or violation of, any
13*e13b1fa5SApple OSS Distributions  * terms of an Apple operating system software license agreement.
14c1dac77fSApple OSS Distributions  *
15*e13b1fa5SApple OSS Distributions  * Please obtain a copy of the License at
16*e13b1fa5SApple OSS Distributions  * http://www.opensource.apple.com/apsl/ and read it before using this file.
17*e13b1fa5SApple OSS Distributions  *
18*e13b1fa5SApple OSS Distributions  * The Original Code and all software distributed under the License are
19*e13b1fa5SApple OSS Distributions  * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
20c1dac77fSApple OSS Distributions  * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
21c1dac77fSApple OSS Distributions  * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
22*e13b1fa5SApple OSS Distributions  * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
23*e13b1fa5SApple OSS Distributions  * Please see the License for the specific language governing rights and
24*e13b1fa5SApple OSS Distributions  * limitations under the License.
25c1dac77fSApple OSS Distributions  *
26*e13b1fa5SApple OSS Distributions  * @APPLE_OSREFERENCE_LICENSE_HEADER_END@
27c1dac77fSApple OSS Distributions  */
28c1dac77fSApple OSS Distributions /*
29c1dac77fSApple OSS Distributions  * Copyright (c) 1999 Apple Computer, Inc.  All rights reserved.
30c1dac77fSApple OSS Distributions  *
31c1dac77fSApple OSS Distributions  *  DRI: Josh de Cesare
32c1dac77fSApple OSS Distributions  *
33c1dac77fSApple OSS Distributions  */
34c1dac77fSApple OSS Distributions 
35c1dac77fSApple OSS Distributions #ifndef _IOKIT_GENERICINTERRUPTCONTROLLER_H
36c1dac77fSApple OSS Distributions #define _IOKIT_GENERICINTERRUPTCONTROLLER_H
37c1dac77fSApple OSS Distributions 
38c1dac77fSApple OSS Distributions #include <IOKit/IOInterrupts.h>
39c1dac77fSApple OSS Distributions #include <IOKit/IOInterruptController.h>
40c1dac77fSApple OSS Distributions 
41c1dac77fSApple OSS Distributions class GenericInterruptController : public IOInterruptController
42c1dac77fSApple OSS Distributions {
43c1dac77fSApple OSS Distributions 	IODeclareDefaultStructors(GenericInterruptController);
44c1dac77fSApple OSS Distributions 
45c1dac77fSApple OSS Distributions public:
46c1dac77fSApple OSS Distributions // There should be a method to start or init the controller.
47c1dac77fSApple OSS Distributions // Its nature is up to you.
48c1dac77fSApple OSS Distributions 	virtual bool start(IOService *provider);
49c1dac77fSApple OSS Distributions 
50c1dac77fSApple OSS Distributions // Returns the type of a vector: level or edge.  This will probably get
51c1dac77fSApple OSS Distributions // replaced but a default method and a new method getVectorType.
52c1dac77fSApple OSS Distributions 	virtual IOReturn getInterruptType(IOService *nub, int source,
53c1dac77fSApple OSS Distributions 	    int *interruptType);
54c1dac77fSApple OSS Distributions 
55c1dac77fSApple OSS Distributions // Returns a function pointer for the interrupt handler.
56c1dac77fSApple OSS Distributions // Sadly, egcs prevents this from being done by the base class.
57c1dac77fSApple OSS Distributions 	virtual IOInterruptAction getInterruptHandlerAddress(void);
58c1dac77fSApple OSS Distributions 
59c1dac77fSApple OSS Distributions // The actual interrupt handler.
60c1dac77fSApple OSS Distributions 	virtual IOReturn handleInterrupt(void *refCon,
61c1dac77fSApple OSS Distributions 	    IOService *nub, int source);
62c1dac77fSApple OSS Distributions 
63c1dac77fSApple OSS Distributions 
64c1dac77fSApple OSS Distributions // Should return true if this vector can be shared.
65c1dac77fSApple OSS Distributions // The base class return false, so this method only need to be implemented
66c1dac77fSApple OSS Distributions // if the controller needs to support shared interrupts.
67c1dac77fSApple OSS Distributions // No other work is required to support shared interrupts.
68c1dac77fSApple OSS Distributions 	virtual bool vectorCanBeShared(long vectorNumber, IOInterruptVector *vector);
69c1dac77fSApple OSS Distributions 
70c1dac77fSApple OSS Distributions // Do any hardware initalization for this vector.  Leave the vector
71c1dac77fSApple OSS Distributions // hard disabled.
72c1dac77fSApple OSS Distributions 	virtual void initVector(long vectorNumber, IOInterruptVector *vector);
73c1dac77fSApple OSS Distributions 
74c1dac77fSApple OSS Distributions // Disable this vector at the hardware.
75c1dac77fSApple OSS Distributions 	virtual void disableVectorHard(long vectorNumber, IOInterruptVector *vector);
76c1dac77fSApple OSS Distributions 
77c1dac77fSApple OSS Distributions // Enable this vector at the hardware.
78c1dac77fSApple OSS Distributions 	virtual void enableVector(long vectorNumber, IOInterruptVector *vector);
79c1dac77fSApple OSS Distributions 
80c1dac77fSApple OSS Distributions // Cause an interrupt on this vector.
81c1dac77fSApple OSS Distributions 	virtual void causeVector(long vectorNumber, IOInterruptVector *vector);
82c1dac77fSApple OSS Distributions };
83c1dac77fSApple OSS Distributions 
84c1dac77fSApple OSS Distributions #endif /* ! _IOKIT_GENERICINTERRUPTCONTROLLER_H */
85