|
|
1.1 ! root 1: /* ! 2: * Copyright (c) 1999 Apple Computer, Inc. All rights reserved. ! 3: * ! 4: * @APPLE_LICENSE_HEADER_START@ ! 5: * ! 6: * Portions Copyright (c) 1999 Apple Computer, Inc. All Rights ! 7: * Reserved. This file contains Original Code and/or Modifications of ! 8: * Original Code as defined in and that are subject to the Apple Public ! 9: * Source License Version 1.1 (the "License"). You may not use this file ! 10: * except in compliance with the License. Please obtain a copy of the ! 11: * License at http://www.apple.com/publicsource and read it before using ! 12: * this file. ! 13: * ! 14: * The Original Code and all software distributed under the License are ! 15: * distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY KIND, EITHER ! 16: * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES, ! 17: * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY, ! 18: * FITNESS FOR A PARTICULAR PURPOSE OR NON-INFRINGEMENT. Please see the ! 19: * License for the specific language governing rights and limitations ! 20: * under the License. ! 21: * ! 22: * @APPLE_LICENSE_HEADER_END@ ! 23: */ ! 24: ! 25: typedef UInt16 UnitNumber; ! 26: ! 27: typedef UInt32 DriverOpenCount; ! 28: ! 29: typedef SInt16 DriverRefNum; ! 30: ! 31: typedef SInt16 DriverFlags; ! 32: ! 33: typedef UInt32 IOCommandCode; ! 34: ! 35: ! 36: enum { ! 37: kOpenCommand = 0, ! 38: kCloseCommand = 1, ! 39: kReadCommand = 2, ! 40: kWriteCommand = 3, ! 41: kControlCommand = 4, ! 42: kStatusCommand = 5, ! 43: kKillIOCommand = 6, ! 44: kInitializeCommand = 7, /* init driver and device*/ ! 45: kFinalizeCommand = 8, /* shutdown driver and device*/ ! 46: kReplaceCommand = 9, /* replace an old driver*/ ! 47: kSupersededCommand = 10 /* prepare to be replaced by a new driver*/ ! 48: }; ! 49: //naga ! 50: //typedef KernelID IOCommandID; ! 51: ! 52: typedef UInt32 IOCommandKind; ! 53: //naga ! 54: typedef int RegEntryID; ! 55: ! 56: enum { ! 57: kSynchronousIOCommandKind = 0x00000001, ! 58: kAsynchronousIOCommandKind = 0x00000002, ! 59: kImmediateIOCommandKind = 0x00000004 ! 60: }; ! 61: ! 62: struct DriverInitInfo { ! 63: DriverRefNum refNum; ! 64: RegEntryID deviceEntry; ! 65: }; ! 66: struct DriverFinalInfo { ! 67: DriverRefNum refNum; ! 68: RegEntryID deviceEntry; ! 69: }; ! 70: typedef struct DriverInitInfo DriverInitInfo, *DriverInitInfoPtr; ! 71: ! 72: typedef struct DriverInitInfo DriverReplaceInfo, *DriverReplaceInfoPtr; ! 73: ! 74: typedef struct DriverFinalInfo DriverFinalInfo, *DriverFinalInfoPtr; ! 75: ! 76: typedef struct DriverFinalInfo DriverSupersededInfo, *DriverSupersededInfoPtr; ! 77: ! 78: /* Contents are command specific*/ ! 79: union IOCommandContents { ! 80: //nagaParmBlkPtr pb; ! 81: DriverInitInfoPtr initialInfo; ! 82: DriverFinalInfoPtr finalInfo; ! 83: DriverReplaceInfoPtr replaceInfo; ! 84: DriverSupersededInfoPtr supersededInfo; ! 85: }; ! 86: typedef union IOCommandContents IOCommandContents; ! 87: ! 88: //nagatypedef OSErr (DriverEntryPoint)(AddressSpaceID SpaceID, IOCommandID CommandID, IOCommandContents Contents, IOCommandCode Code, IOCommandKind Kind); ! 89: ! 90: /* Driver Typing Information Used to Match Drivers With Devices */ ! 91: struct DriverType { ! 92: Str31 nameInfoStr; /* Driver Name/Info String*/ ! 93: NumVersion version; /* Driver Version Number*/ ! 94: }; ! 95: typedef struct DriverType DriverType, *DriverTypePtr; ! 96: ! 97: /* OS Runtime Information Used to Setup and Maintain a Driver's Runtime Environment */ ! 98: typedef OptionBits RuntimeOptions; ! 99: ! 100: ! 101: enum { ! 102: kDriverIsLoadedUponDiscovery = 0x00000001, /* auto-load driver when discovered*/ ! 103: kDriverIsOpenedUponLoad = 0x00000002, /* auto-open driver when loaded*/ ! 104: kDriverIsUnderExpertControl = 0x00000004, /* I/O expert handles loads/opens*/ ! 105: kDriverIsConcurrent = 0x00000008, /* supports concurrent requests*/ ! 106: kDriverQueuesIOPB = 0x00000010 /* device manager doesn't queue IOPB*/ ! 107: }; ! 108: ! 109: struct DriverOSRuntime { ! 110: RuntimeOptions driverRuntime; /* Options for OS Runtime*/ ! 111: Str31 driverName; /* Driver's name to the OS*/ ! 112: UInt32 driverDescReserved[8]; /* Reserved area*/ ! 113: }; ! 114: typedef struct DriverOSRuntime DriverOSRuntime, *DriverOSRuntimePtr; ! 115: ! 116: /* OS Service Information Used To Declare What APIs a Driver Supports */ ! 117: typedef UInt32 ServiceCount; ! 118: ! 119: struct DriverServiceInfo { ! 120: OSType serviceCategory; /* Service Category Name*/ ! 121: OSType serviceType; /* Type within Category*/ ! 122: NumVersion serviceVersion; /* Version of service*/ ! 123: }; ! 124: typedef struct DriverServiceInfo DriverServiceInfo, *DriverServiceInfoPtr; ! 125: ! 126: struct DriverOSService { ! 127: ServiceCount nServices; /* Number of Services Supported*/ ! 128: DriverServiceInfo service[1]; /* The List of Services (at least one)*/ ! 129: }; ! 130: typedef struct DriverOSService DriverOSService, *DriverOSServicePtr; ! 131: ! 132: /* Categories */ ! 133: ! 134: enum { ! 135: kServiceCategoryDisplay = 'disp', /* Display Manager*/ ! 136: kServiceCategoryOpenTransport = 'otan', /* Open Transport*/ ! 137: kServiceCategoryBlockStorage = 'blok', /* Block Storage*/ ! 138: kServiceCategoryNdrvDriver = 'ndrv', /* Generic Native Driver*/ ! 139: kServiceCategoryScsiSIM = 'scsi' ! 140: }; ! 141: ! 142: /* Ndrv ServiceCategory Types */ ! 143: enum { ! 144: kNdrvTypeIsGeneric = 'genr', /* generic*/ ! 145: kNdrvTypeIsVideo = 'vido', /* video*/ ! 146: kNdrvTypeIsBlockStorage = 'blok', /* block storage*/ ! 147: kNdrvTypeIsNetworking = 'netw', /* networking*/ ! 148: kNdrvTypeIsSerial = 'serl', /* serial*/ ! 149: kNdrvTypeIsSound = 'sond', /* sound*/ ! 150: kNdrvTypeIsBusBridge = 'brdg' ! 151: }; ! 152: ! 153: /* The Driver Description */ ! 154: enum { ! 155: kTheDescriptionSignature = 'mtej' ! 156: }; ! 157: ! 158: typedef UInt32 DriverDescVersion; ! 159: ! 160: ! 161: enum { ! 162: kInitialDriverDescriptor = 0 ! 163: }; ! 164: ! 165: struct DriverDescription { ! 166: OSType driverDescSignature; /* Signature field of this structure*/ ! 167: DriverDescVersion driverDescVersion; /* Version of this data structure*/ ! 168: DriverType driverType; /* Type of Driver*/ ! 169: DriverOSRuntime driverOSRuntimeInfo; /* OS Runtime Requirements of Driver*/ ! 170: DriverOSService driverServices; /* Apple Service API Membership*/ ! 171: }; ! 172: typedef struct DriverDescription DriverDescription, *DriverDescriptionPtr; ! 173: ! 174: #if 0 ! 175: /* Driver Loader API */ ! 176: #define DECLARE_DRIVERDESCRIPTION(N_ADDITIONAL_SERVICES) \ ! 177: struct { \ ! 178: DriverDescription fixed; \ ! 179: DriverServiceInfo additional_service[N_ADDITIONAL_SERVICES-1]; \ ! 180: }; ! 181: extern SInt16 HigherDriverVersion(NumVersion *driverVersion1, NumVersion *driverVersion2); ! 182: extern OSErr VerifyFragmentAsDriver(CFragConnectionID fragmentConnID, DriverEntryPointPtr *fragmentMain, DriverDescriptionPtr *driverDesc); ! 183: extern OSErr GetDriverMemoryFragment(Ptr memAddr, long length, ConstStr63Param fragName, CFragConnectionID *fragmentConnID, DriverEntryPointPtr *fragmentMain, DriverDescriptionPtr *driverDesc); ! 184: extern OSErr GetDriverDiskFragment(FSSpecPtr fragmentSpec, CFragConnectionID *fragmentConnID, DriverEntryPointPtr *fragmentMain, DriverDescriptionPtr *driverDesc); ! 185: extern OSErr InstallDriverFromFragment(CFragConnectionID fragmentConnID, RegEntryIDPtr device, UnitNumber beginningUnit, UnitNumber endingUnit, DriverRefNum *refNum); ! 186: extern OSErr InstallDriverFromFile(FSSpecPtr fragmentSpec, RegEntryIDPtr device, UnitNumber beginningUnit, UnitNumber endingUnit, DriverRefNum *refNum); ! 187: extern OSErr InstallDriverFromMemory(Ptr memory, long length, ConstStr63Param fragName, RegEntryIDPtr device, UnitNumber beginningUnit, UnitNumber endingUnit, DriverRefNum *refNum); ! 188: extern OSErr InstallDriverFromDisk(Ptr theDriverName, RegEntryIDPtr theDevice, UnitNumber theBeginningUnit, UnitNumber theEndingUnit, DriverRefNum *theRefNum); ! 189: extern OSErr FindDriversForDevice(RegEntryIDPtr device, FSSpec *fragmentSpec, DriverDescription *fileDriverDesc, Ptr *memAddr, long *length, StringPtr fragName, DriverDescription *memDriverDesc); ! 190: extern OSErr FindDriverCandidates(RegEntryIDPtr deviceID, Ptr *propBasedDriver, RegPropertyValueSize *propBasedDriverSize, StringPtr deviceName, DriverType *propBasedDriverType, Boolean *gotPropBasedDriver, FileBasedDriverRecordPtr fileBasedDrivers, ItemCount *nFileBasedDrivers); ! 191: extern OSErr ScanDriverCandidates(RegEntryIDPtr deviceID, FileBasedDriverRecordPtr fileBasedDrivers, ItemCount nFileBasedDrivers, FileBasedDriverRecordPtr matchingDrivers, ItemCount *nMatchingDrivers); ! 192: extern OSErr GetDriverForDevice(RegEntryIDPtr device, CFragConnectionID *fragmentConnID, DriverEntryPointPtr *fragmentMain, DriverDescriptionPtr *driverDesc); ! 193: extern OSErr InstallDriverForDevice(RegEntryIDPtr device, UnitNumber beginningUnit, UnitNumber endingUnit, DriverRefNum *refNum); ! 194: extern OSErr SetDriverClosureMemory(CFragConnectionID fragmentConnID, Boolean holdDriverMemory); ! 195: extern OSErr ReplaceDriverWithFragment(DriverRefNum theRefNum, CFragConnectionID fragmentConnID); ! 196: extern OSErr GetDriverInformation(DriverRefNum refNum, UnitNumber *unitNum, DriverFlags *flags, DriverOpenCount *count, StringPtr name, RegEntryID *device, CFragHFSLocator *driverLoadLocation, CFragConnectionID *fragmentConnID, DriverEntryPointPtr *fragmentMain, DriverDescription *driverDesc); ! 197: extern OSErr OpenInstalledDriver(DriverRefNum refNum, SInt8 ioPermission); ! 198: extern OSErr RenameDriver(DriverRefNum refNum, StringPtr newDriverName); ! 199: extern OSErr RemoveDriver(DriverRefNum refNum, Boolean immediate); ! 200: extern OSErr LookupDrivers(UnitNumber beginningUnit, UnitNumber endingUnit, Boolean emptyUnits, ItemCount *returnedRefNums, DriverRefNum *refNums); ! 201: extern UnitNumber HighestUnitNumber(void); ! 202: extern OSErr DriverGestaltOn(DriverRefNum refNum); ! 203: extern OSErr DriverGestaltOff(DriverRefNum refNum); ! 204: extern Boolean DriverGestaltIsOn(DriverFlags flags); ! 205: ! 206: enum { ! 207: uppControlPanelDefProcInfo = kPascalStackBased ! 208: | RESULT_SIZE(SIZE_CODE(sizeof(long))) ! 209: | STACK_ROUTINE_PARAMETER(1, SIZE_CODE(sizeof(short))) ! 210: | STACK_ROUTINE_PARAMETER(2, SIZE_CODE(sizeof(short))) ! 211: | STACK_ROUTINE_PARAMETER(3, SIZE_CODE(sizeof(short))) ! 212: | STACK_ROUTINE_PARAMETER(4, SIZE_CODE(sizeof(short))) ! 213: | STACK_ROUTINE_PARAMETER(5, SIZE_CODE(sizeof(EventRecord*))) ! 214: | STACK_ROUTINE_PARAMETER(6, SIZE_CODE(sizeof(long))) ! 215: | STACK_ROUTINE_PARAMETER(7, SIZE_CODE(sizeof(DialogPtr))) ! 216: }; ! 217: #endif
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.