Annotation of XNU/iokit/Families/IONDRVSupport/IONDRV.h, revision 1.1.1.1

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) 1997 Apple Computer, Inc.
                     24:  *
                     25:  *
                     26:  * HISTORY
                     27:  *
                     28:  * sdouglas  22 Oct 97 - first checked in.
                     29:  * sdouglas  21 July 98 - start IOKit
                     30:  */
                     31: 
                     32: 
                     33: #ifndef __IONDRVINTERFACE__
                     34: #define __IONDRVINTERFACE__
                     35: 
                     36: #include <IOKit/IORegistryEntry.h>
                     37: #include <IOKit/IOInterruptEventSource.h>
                     38: 
                     39: #include <IOKit/ndrvsupport/IOMacOSTypes.h>
                     40: 
                     41: #pragma options align=mac68k
                     42: 
                     43: #ifdef __cplusplus
                     44: extern "C" {
                     45: #endif
                     46: 
                     47: typedef void * RegEntryID[4];
                     48: 
                     49: struct DriverInitInfo {
                     50:     UInt16                          refNum;
                     51:     RegEntryID                      deviceEntry;
                     52: };
                     53: 
                     54: #define MAKE_REG_ENTRY(regEntryID,obj)                         \
                     55:        regEntryID[ 0 ] = (void *) obj;                 \
                     56:        regEntryID[ 1 ] = (void *) ~(UInt32)obj;        \
                     57:        regEntryID[ 2 ] = (void *) 0x53696d65;          \
                     58:        regEntryID[ 3 ] = (void *) 0x52756c7a;
                     59: 
                     60: #define REG_ENTRY_TO_OBJ(regEntryID,obj)                               \
                     61:        if( (UInt32)((obj = ((IORegistryEntry **)regEntryID)[ 0 ]))     \
                     62:         != ~((UInt32 *)regEntryID)[ 1 ] )                              \
                     63:            return( -2538);
                     64: 
                     65: #define REG_ENTRY_TO_OBJ_RET(regEntryID,obj,ret)                       \
                     66:        if( (UInt32)((obj = ((IORegistryEntry **)regEntryID)[ 0 ]))     \
                     67:         != ~((UInt32 *)regEntryID)[ 1 ] )                              \
                     68:            return( ret);
                     69: 
                     70: #define REG_ENTRY_TO_PT(regEntryID,obj)                                \
                     71:        IORegistryEntry * obj;                                          \
                     72:        if( (UInt32)((obj = ((IORegistryEntry **)regEntryID)[ 0 ]))     \
                     73:         != ~((UInt32 *)regEntryID)[ 1 ] )                              \
                     74:            return( -2538);
                     75: 
                     76: #define REG_ENTRY_TO_SERVICE(regEntryID,type,obj)                      \
                     77:        IORegistryEntry * regEntry;                                     \
                     78:        type            * obj;                                          \
                     79:        if( (UInt32)((regEntry = ((IORegistryEntry **)regEntryID)[ 0 ])) \
                     80:         != ~((UInt32 *)regEntryID)[ 1 ] )                              \
                     81:            return( -2538);                                             \
                     82:        if( 0 == (obj = OSDynamicCast( type, regEntry)))                \
                     83:            return( -2542);
                     84: 
                     85: struct CntrlParam {
                     86:     void *                          qLink;
                     87:     short                           qType;
                     88:     short                           ioTrap;
                     89:     void *                          ioCmdAddr;
                     90:     void *                          ioCompletion;
                     91:     short                           ioResult;
                     92:     char *                          ioNamePtr;
                     93:     short                           ioVRefNum;
                     94:     short                           ioCRefNum;
                     95:     short                           csCode;
                     96:     void *                          csParams;
                     97:     short                           csParam[9];
                     98: };
                     99: typedef struct CntrlParam CntrlParam, *CntrlParamPtr;
                    100: 
                    101: #pragma options align=reset
                    102: 
                    103: enum {
                    104:     kOpenCommand                = 0,
                    105:     kCloseCommand               = 1,
                    106:     kReadCommand                = 2,
                    107:     kWriteCommand               = 3,
                    108:     kControlCommand             = 4,
                    109:     kStatusCommand              = 5,
                    110:     kKillIOCommand              = 6,
                    111:     kInitializeCommand          = 7,                            /* init driver and device*/
                    112:     kFinalizeCommand            = 8,                            /* shutdown driver and device*/
                    113:     kReplaceCommand             = 9,                            /* replace an old driver*/
                    114:     kSupersededCommand          = 10                            /* prepare to be replaced by a new driver*/
                    115: };
                    116: enum {
                    117:     kSynchronousIOCommandKind   = 0x00000001,
                    118:     kAsynchronousIOCommandKind  = 0x00000002,
                    119:     kImmediateIOCommandKind     = 0x00000004
                    120: };
                    121: 
                    122: struct InterruptSetMember {
                    123:        void *          setID;
                    124:        UInt32          member;
                    125: };
                    126: typedef struct InterruptSetMember InterruptSetMember;
                    127: 
                    128: typedef SInt32 (*InterruptHandler)( InterruptSetMember setMember, void *refCon, UInt32 theIntCount);
                    129: typedef void    (*InterruptEnabler)( InterruptSetMember setMember, void *refCon);
                    130: typedef Boolean (*InterruptDisabler)( InterruptSetMember setMember, void *refCon);
                    131: 
                    132: enum {
                    133:     kFirstMemberNumber                 = 1,
                    134:     kIsrIsComplete                     = 0,
                    135:     kIsrIsNotComplete                  = -1,
                    136:     kMemberNumberParent                        = -2
                    137: };
                    138: 
                    139: enum {
                    140:     kReturnToParentWhenComplete                = 0x00000001,
                    141:     kReturnToParentWhenNotComplete     = 0x00000002
                    142: };
                    143: 
                    144: enum {
                    145:     kISTChipInterruptSource            = 0,
                    146:     kISTOutputDMAInterruptSource       = 1,
                    147:     kISTInputDMAInterruptSource                = 2,
                    148:     kISTPropertyMemberCount            = 3
                    149: };
                    150: #define kISTPropertyName       "driver-ist" 
                    151: 
                    152: extern OSStatus    CallTVector( 
                    153:            void * p1, void * p2, void * p3, void * p4, void * p5, void * p6,
                    154:            struct TVector * entry );
                    155: 
                    156: #ifdef __cplusplus
                    157: }
                    158: #endif
                    159: 
                    160: 
                    161: class IONDRV : public OSObject
                    162: {
                    163:     OSDeclareDefaultStructors(IONDRV)
                    164: 
                    165: private:
                    166:     void *                     pcInst;
                    167:     struct TVector *           fDoDriverIO;
                    168:     struct DriverDescription * theDriverDesc;
                    169: 
                    170: public:
                    171:     static IONDRV * instantiate( IOLogicalAddress container,
                    172:                                        IOByteCount containerSize );
                    173: 
                    174:     static IONDRV * fromRegistryEntry( IORegistryEntry * regEntry );
                    175: 
                    176:     virtual void free( void );
                    177: 
                    178:     virtual IOReturn getSymbol( const char * symbolName,
                    179:                                IOLogicalAddress * address );
                    180: 
                    181:     virtual const char * driverName( void );
                    182: 
                    183:     virtual IOReturn doDriverIO( UInt32 commandID, void * contents,
                    184:                                UInt32 commandCode, UInt32 commandKind );
                    185: 
                    186: };
                    187: 
                    188: struct IONDRVInterruptSource {
                    189:     void *             refCon;
                    190:     struct TVector *   handler;
                    191:     struct TVector *   enabler;
                    192:     struct TVector *   disabler;
                    193:     bool               enabled;
                    194: };
                    195: 
                    196: class IONDRVInterruptSet : public OSObject {
                    197: 
                    198:     OSDeclareDefaultStructors(IONDRVInterruptSet)
                    199: 
                    200: public:
                    201:     IOService *                        provider;
                    202:     IOOptionBits               options;
                    203:     UInt32                     count;
                    204:     IONDRVInterruptSource *    sources;
                    205:     IONDRVInterruptSet *       child;
                    206: 
                    207:     static IONDRVInterruptSet * with(IOService * provider,
                    208:                                     IOOptionBits options, SInt32 count);
                    209:     void free();
                    210: };
                    211: 
                    212: #endif /* __IONDRVINTERFACE__ */
                    213: 

unix.superglobalmegacorp.com

This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.