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