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 File: Types.h 34 35 Contains: Basic Macintosh data types. 36 37 Version: Technology: PowerSurge 1.0.2. 38 Package: Universal Interfaces 2.1.2 on ETO #20 39 40 Copyright: � 1984-1995 by Apple Computer, Inc. 41 All rights reserved. 42 43 Bugs?: If you find a problem with this file, use the Apple Bug Reporter 44 stack. Include the file and version information (from above) 45 in the problem description and send to: 46 Internet: apple.bugs@applelink.apple.com 47 AppleLink: APPLE.BUGS 48 49*/ 50 51#ifndef _IOKIT_IOMACOSTYPES_H 52#define _IOKIT_IOMACOSTYPES_H 53#ifndef __MACTYPES__ 54 55#include <IOKit/IOTypes.h> 56 57#ifdef __cplusplus 58extern "C" { 59#endif 60 61#ifndef __LP64__ 62#pragma options align=mac68k 63#endif 64 65#ifndef NULL 66#if !defined(__cplusplus) && (defined(__SC__) || defined(THINK_C)) 67#define NULL ((void *) 0) 68#else 69#define NULL 0 70#endif 71#endif 72 73enum { 74 noErr = 0 75}; 76 77typedef unsigned char Byte; 78 79typedef signed char SignedByte; 80 81typedef UInt16 UniChar; 82 83typedef char *Ptr; 84 85typedef Ptr *Handle; 86 87typedef UInt32 Fixed; 88 89typedef Fixed *FixedPtr; 90 91typedef UInt32 Fract; 92 93typedef Fract *FractPtr; 94 95/* 96enum { 97 false, 98 true 99}; 100#if !__option(bool) 101 #ifndef true 102 #define true 1 103 #endif 104 #ifndef false 105 #define false 0 106 #endif 107#endif 108 109typedef unsigned char Boolean; 110*/ 111 112 113typedef short OSErr; 114 115typedef unsigned int FourCharCode; 116 117typedef FourCharCode OSType; 118 119typedef FourCharCode ResType; 120 121typedef OSType *OSTypePtr; 122 123typedef ResType *ResTypePtr; 124 125struct Rect { 126 short top; 127 short left; 128 short bottom; 129 short right; 130}; 131typedef struct Rect Rect; 132 133typedef Rect *RectPtr; 134 135// Quickdraw.i 136 137/* 138 kVariableLengthArray is used in array bounds to specify a variable length array. 139 It is ususally used in variable length structs when the last field is an array 140 of any size. Before ANSI C, we used zero as the bounds of variable length 141 array, but that is illegal in ANSI C. Example: 142 143 struct FooList 144 { 145 short listLength; 146 Foo elements[kVariableLengthArray]; 147 }; 148*/ 149 150enum { 151 kVariableLengthArray = 1 152}; 153 154/* Numeric version part of 'vers' resource */ 155struct NumVersion { 156 UInt8 majorRev; /*1st part of version number in BCD*/ 157 UInt8 minorAndBugRev; /*2nd & 3rd part of version number share a byte*/ 158 UInt8 stage; /*stage code: dev, alpha, beta, final*/ 159 UInt8 nonRelRev; /*revision level of non-released version*/ 160}; 161typedef struct NumVersion NumVersion; 162 163typedef struct OpaqueRef *KernelID; 164 165typedef UInt8 *BytePtr; 166 167typedef IOByteCount ByteCount; 168 169typedef IOItemCount ItemCount; 170 171typedef void *LogicalAddress; 172 173#if !defined(__LP64__) 174typedef void *PhysicalAddress; 175#endif 176 177typedef UInt32 PBVersion; 178 179typedef SInt32 Duration; 180 181#define kInvalidID 0 182 183enum { 184 kNilOptions = 0 185}; 186 187 188typedef unsigned char Str31[32]; 189 190 191/* 192From: 193 File: DriverFamilyMatching.i <18> 194 Copyright: � 1995-1996 by Apple Computer, Inc., all rights reserved. 195*/ 196 197//############################################## 198// Well known properties in the Name Registry 199//############################################## 200 201#define kPropertyName "name" 202#define kPropertyCompatible "compatible" 203#define kPropertyDriverPtr "driver-ptr" 204#define kPropertyDriverDesc "driver-description" 205#define kPropertyReg "reg" 206#define kPropertyAAPLAddress "AAPL,address" 207#define kPropertyMatching "matching" 208 209 210//######################################################### 211// Descriptor for Drivers and NDRVs 212//######################################################### 213/* Driver Typing Information Used to Match Drivers With Devices */ 214struct DriverType { 215 Str31 nameInfoStr; /* Driver Name/Info String*/ 216 NumVersion version; /* Driver Version Number*/ 217}; 218typedef struct DriverType DriverType; 219typedef DriverType * DriverTypePtr; 220 221/* OS Runtime Information Used to Setup and Maintain a Driver's Runtime Environment */ 222typedef IOOptionBits RuntimeOptions; 223 224 225enum { 226 kDriverIsLoadedUponDiscovery = 0x00000001, /* auto-load driver when discovered*/ 227 kDriverIsOpenedUponLoad = 0x00000002, /* auto-open driver when loaded*/ 228 kDriverIsUnderExpertControl = 0x00000004, /* I/O expert handles loads/opens*/ 229 kDriverIsConcurrent = 0x00000008, /* supports concurrent requests*/ 230 kDriverQueuesIOPB = 0x00000010, /* device manager doesn't queue IOPB*/ 231 kDriverIsLoadedAtBoot = 0x00000020, /* Driver is loaded at the boot time */ 232 kDriverIsForVirtualDevice = 0x00000040, /* Driver is for a virtual Device */ 233 kDriverSupportDMSuspendAndResume = 0x00000080 /* Driver supports Device Manager Suspend and Resume command */ 234}; 235 236struct DriverOSRuntime { 237 RuntimeOptions driverRuntime; /* Options for OS Runtime*/ 238 Str31 driverName; /* Driver's name to the OS*/ 239 UInt32 driverDescReserved[8]; /* Reserved area*/ 240}; 241typedef struct DriverOSRuntime DriverOSRuntime; 242typedef DriverOSRuntime * DriverOSRuntimePtr; 243 244/* OS Service Information Used To Declare What APIs a Driver Supports */ 245typedef UInt32 ServiceCount; 246 247struct DriverServiceInfo { 248 OSType serviceCategory; /* Service Category Name*/ 249 OSType serviceType; /* Type within Category*/ 250 NumVersion serviceVersion; /* Version of service*/ 251}; 252typedef struct DriverServiceInfo DriverServiceInfo; 253typedef DriverServiceInfo * DriverServiceInfoPtr; 254 255struct DriverOSService { 256 ServiceCount nServices; /* Number of Services Supported*/ 257 DriverServiceInfo service[1]; /* The List of Services (at least one)*/ 258}; 259typedef struct DriverOSService DriverOSService; 260typedef DriverOSService * DriverOSServicePtr; 261 262/* Categories */ 263 264enum { 265 kServiceCategoryDisplay = 'disp', /* Display Manager*/ 266 kServiceCategoryOpenTransport = 'otan', /* Open Transport*/ 267 kServiceCategoryBlockStorage = 'blok', /* Block Storage*/ 268 kServiceCategoryNdrvDriver = 'ndrv', /* Generic Native Driver*/ 269 kServiceCategoryScsiSIM = 'scsi', /* SCSI */ 270 kServiceCategoryFileManager = 'file', /* File Manager */ 271 kServiceCategoryIDE = 'ide-', /* ide */ 272 kServiceCategoryADB = 'adb-', /* adb */ 273 kServiceCategoryPCI = 'pci-', /* pci bus */ 274 /* Nu Bus */ 275 kServiceCategoryDFM = 'dfm-', /* DFM */ 276 kServiceCategoryMotherBoard = 'mrbd', /* mother Board */ 277 kServiceCategoryKeyboard = 'kybd', /* Keyboard */ 278 kServiceCategoryPointing = 'poit', /* Pointing */ 279 kServiceCategoryRTC = 'rtc-', /* RTC */ 280 kServiceCategoryNVRAM = 'nram', /* NVRAM */ 281 kServiceCategorySound = 'sond', /* Sound (1/3/96 MCS) */ 282 kServiceCategoryPowerMgt = 'pgmt', /* Power Management */ 283 kServiceCategoryGeneric = 'genr' /* Generic Service Category to receive general Events */ 284}; 285 286/* Ndrv ServiceCategory Types */ 287enum { 288 kNdrvTypeIsGeneric = 'genr', /* generic*/ 289 kNdrvTypeIsVideo = 'vido', /* video*/ 290 kNdrvTypeIsBlockStorage = 'blok', /* block storage*/ 291 kNdrvTypeIsNetworking = 'netw', /* networking*/ 292 kNdrvTypeIsSerial = 'serl', /* serial*/ 293 kNdrvTypeIsParallel = 'parl', /* parallel */ 294 kNdrvTypeIsSound = 'sond', /* sound*/ 295 kNdrvTypeIsBusBridge = 'brdg' 296}; 297 298typedef UInt32 DriverDescVersion; 299 300/* The Driver Description */ 301enum { 302 kInitialDriverDescriptor = 0, 303 kVersionOneDriverDescriptor = 1 304}; 305 306enum { 307 kTheDescriptionSignature = 'mtej', 308 kDriverDescriptionSignature = 'pdes' 309}; 310 311 312struct DriverDescription { 313 OSType driverDescSignature; /* Signature field of this structure*/ 314 DriverDescVersion driverDescVersion; /* Version of this data structure*/ 315 DriverType driverType; /* Type of Driver*/ 316 DriverOSRuntime driverOSRuntimeInfo; /* OS Runtime Requirements of Driver*/ 317 DriverOSService driverServices; /* Apple Service API Membership*/ 318}; 319typedef struct DriverDescription DriverDescription; 320typedef DriverDescription * DriverDescriptionPtr; 321 322 323#ifndef __LP64__ 324#pragma options align=reset 325#endif 326 327#ifdef __cplusplus 328} 329#endif 330 331#endif /* __MACTYPES__ */ 332 333#ifndef __QUICKDRAW__ 334 335#ifdef __cplusplus 336extern "C" { 337#endif 338 339#ifndef __LP64__ 340#pragma options align=mac68k 341#endif 342 343struct RGBColor { 344 unsigned short red; /*magnitude of red component*/ 345 unsigned short green; /*magnitude of green component*/ 346 unsigned short blue; /*magnitude of blue component*/ 347}; 348typedef struct RGBColor RGBColor; 349typedef RGBColor *RGBColorPtr; 350typedef RGBColorPtr *RGBColorHdl; 351 352struct ColorSpec { 353 short value; /*index or other value*/ 354 RGBColor rgb; /*true color*/ 355}; 356 357typedef struct ColorSpec ColorSpec; 358typedef ColorSpec *ColorSpecPtr; 359 360struct GammaTbl { 361 short gVersion; /*gamma version number*/ 362 short gType; /*gamma data type*/ 363 short gFormulaSize; /*Formula data size*/ 364 short gChanCnt; /*number of channels of data*/ 365 short gDataCnt; /*number of values/channel*/ 366 short gDataWidth; /*bits/corrected value (data packed to next larger byte size)*/ 367 short gFormulaData[1]; /*data for formulas followed by gamma values*/ 368}; 369typedef struct GammaTbl GammaTbl; 370typedef GammaTbl *GammaTblPtr; 371 372struct RegEntryID 373{ 374 void * opaque[4]; 375}; 376typedef struct RegEntryID RegEntryID; 377typedef RegEntryID * RegEntryIDPtr; 378 379/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ 380 381struct IONDRVControlParameters { 382 UInt8 __reservedA[0x1a]; 383 UInt16 code; 384 void * params; 385 UInt8 __reservedB[0x12]; 386}; 387 388enum { 389 kIONDRVOpenCommand = 128 + 0, 390 kIONDRVCloseCommand = 128 + 1, 391 kIONDRVReadCommand = 128 + 2, 392 kIONDRVWriteCommand = 128 + 3, 393 kIONDRVControlCommand = 128 + 4, 394 kIONDRVStatusCommand = 128 + 5, 395 kIONDRVKillIOCommand = 128 + 6, 396 kIONDRVInitializeCommand = 128 + 7, /* init driver and device*/ 397 kIONDRVFinalizeCommand = 128 + 8, /* shutdown driver and device*/ 398 kIONDRVReplaceCommand = 128 + 9, /* replace an old driver*/ 399 kIONDRVSupersededCommand = 128 + 10 /* prepare to be replaced by a new driver*/ 400}; 401enum { 402 kIONDRVSynchronousIOCommandKind = 0x00000001, 403 kIONDRVAsynchronousIOCommandKind = 0x00000002, 404 kIONDRVImmediateIOCommandKind = 0x00000004 405}; 406 407/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ 408 409#ifndef __LP64__ 410#pragma options align=reset 411#endif 412 413#ifdef __cplusplus 414} 415#endif 416 417#endif /* __QUICKDRAW__ */ 418 419#endif /* _IOKIT_IOMACOSTYPES_H */ 420