|
|
1.1 ! root 1: /* ! 2: * Copyright (c) 1998-2000 Apple Computer, Inc. All rights reserved. ! 3: * ! 4: * @APPLE_LICENSE_HEADER_START@ ! 5: * ! 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. ! 11: * ! 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 ! 18: * under the License. ! 19: * ! 20: * @APPLE_LICENSE_HEADER_END@ ! 21: */ ! 22: /* ! 23: * Copyright (c) 1999 Apple Computer, Inc. All rights reserved. ! 24: * ! 25: * DRI: Josh de Cesare ! 26: * ! 27: */ ! 28: ! 29: ! 30: #ifndef _IOKIT_IOINTERRUPTCONTROLLER_H ! 31: #define _IOKIT_IOINTERRUPTCONTROLLER_H ! 32: ! 33: #include <IOKit/IOLocks.h> ! 34: #include <IOKit/IOService.h> ! 35: #include <IOKit/IOInterrupts.h> ! 36: ! 37: ! 38: class IOSharedInterruptController; ! 39: ! 40: struct IOInterruptVector { ! 41: volatile char interruptActive; ! 42: volatile char interruptDisabledSoft; ! 43: volatile char interruptDisabledHard; ! 44: volatile char interruptRegistered; ! 45: IOLock * interruptLock; ! 46: IOService * nub; ! 47: long source; ! 48: void * target; ! 49: IOInterruptHandler handler; ! 50: void * refCon; ! 51: IOSharedInterruptController *sharedController; ! 52: }; ! 53: ! 54: typedef struct IOInterruptVector IOInterruptVector; ! 55: ! 56: ! 57: class IOInterruptController : public IOService ! 58: { ! 59: OSDeclareAbstractStructors(IOInterruptController); ! 60: ! 61: protected: ! 62: IOInterruptVector *vectors; ! 63: ! 64: public: ! 65: virtual IOReturn registerInterrupt(IOService *nub, int source, ! 66: void *target, ! 67: IOInterruptHandler handler, ! 68: void *refCon); ! 69: virtual IOReturn unregisterInterrupt(IOService *nub, int source); ! 70: ! 71: virtual IOReturn getInterruptType(IOService *nub, int source, ! 72: int *interruptType); ! 73: ! 74: virtual IOReturn enableInterrupt(IOService *nub, int source); ! 75: virtual IOReturn disableInterrupt(IOService *nub, int source); ! 76: virtual IOReturn causeInterrupt(IOService *nub, int source); ! 77: ! 78: virtual IOInterruptAction getInterruptHandlerAddress(void); ! 79: virtual IOReturn handleInterrupt(void *refCon, IOService *nub, ! 80: int source); ! 81: ! 82: // Methods to be overridden for simplifed interrupt controller subclasses. ! 83: ! 84: virtual bool vectorCanBeShared(long vectorNumber, IOInterruptVector *vector); ! 85: virtual void initVector(long vectorNumber, IOInterruptVector *vector); ! 86: virtual int getVectorType(long vectorNumber, IOInterruptVector *vector); ! 87: virtual void disableVectorHard(long vectorNumber, IOInterruptVector *vector); ! 88: virtual void enableVector(long vectorNumber, IOInterruptVector *vector); ! 89: virtual void causeVector(long vectorNumber, IOInterruptVector *vector); ! 90: }; ! 91: ! 92: ! 93: class IOSharedInterruptController : public IOInterruptController ! 94: { ! 95: OSDeclareDefaultStructors(IOSharedInterruptController); ! 96: ! 97: private: ! 98: IOService *provider; ! 99: int numVectors; ! 100: int vectorsRegistered; ! 101: int vectorsEnabled; ! 102: volatile long controllerDisabled; ! 103: bool sourceIsLevel; ! 104: ! 105: public: ! 106: virtual IOReturn initInterruptController(IOInterruptController *parentController, OSData *parentSource); ! 107: ! 108: virtual IOReturn registerInterrupt(IOService *nub, int source, ! 109: void *target, ! 110: IOInterruptHandler handler, ! 111: void *refCon); ! 112: virtual IOReturn unregisterInterrupt(IOService *nub, int source); ! 113: ! 114: virtual IOReturn getInterruptType(IOService *nub, int source, ! 115: int *interruptType); ! 116: ! 117: virtual IOReturn enableInterrupt(IOService *nub, int source); ! 118: virtual IOReturn disableInterrupt(IOService *nub, int source); ! 119: ! 120: virtual IOInterruptAction getInterruptHandlerAddress(void); ! 121: virtual IOReturn handleInterrupt(void *refCon, IOService *nub, int source); ! 122: }; ! 123: ! 124: ! 125: #endif /* ! _IOKIT_IOINTERRUPTCONTROLLER_H */
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.