]>
Commit | Line | Data |
---|---|---|
1c79356b | 1 | /* |
39236c6e | 2 | * Copyright (c) 1998-2012 Apple Computer, Inc. All rights reserved. |
1c79356b | 3 | * |
2d21ac55 | 4 | * @APPLE_OSREFERENCE_LICENSE_HEADER_START@ |
1c79356b | 5 | * |
2d21ac55 A |
6 | * This file contains Original Code and/or Modifications of Original Code |
7 | * as defined in and that are subject to the Apple Public Source License | |
8 | * Version 2.0 (the 'License'). You may not use this file except in | |
9 | * compliance with the License. The rights granted to you under the License | |
10 | * may not be used to create, or enable the creation or redistribution of, | |
11 | * unlawful or unlicensed copies of an Apple operating system, or to | |
12 | * circumvent, violate, or enable the circumvention or violation of, any | |
13 | * terms of an Apple operating system software license agreement. | |
8f6c56a5 | 14 | * |
2d21ac55 A |
15 | * Please obtain a copy of the License at |
16 | * http://www.opensource.apple.com/apsl/ and read it before using this file. | |
17 | * | |
18 | * The Original Code and all software distributed under the License are | |
19 | * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER | |
8f6c56a5 A |
20 | * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES, |
21 | * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY, | |
2d21ac55 A |
22 | * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT. |
23 | * Please see the License for the specific language governing rights and | |
24 | * limitations under the License. | |
8f6c56a5 | 25 | * |
2d21ac55 | 26 | * @APPLE_OSREFERENCE_LICENSE_HEADER_END@ |
1c79356b | 27 | */ |
1c79356b A |
28 | #ifndef __IOKIT_IOTYPES_H |
29 | #define __IOKIT_IOTYPES_H | |
30 | ||
31 | #ifndef IOKIT | |
32 | #define IOKIT 1 | |
33 | #endif /* !IOKIT */ | |
34 | ||
35 | #if KERNEL | |
36 | #include <IOKit/system.h> | |
37 | #else | |
38 | #include <mach/message.h> | |
39 | #include <mach/vm_types.h> | |
40 | #endif | |
41 | ||
42 | #include <IOKit/IOReturn.h> | |
43 | ||
44 | #ifdef __cplusplus | |
45 | extern "C" { | |
46 | #endif | |
47 | ||
48 | #ifndef NULL | |
2d21ac55 | 49 | #if defined (__cplusplus) |
1c79356b | 50 | #define NULL 0 |
2d21ac55 A |
51 | #else |
52 | #define NULL ((void *)0) | |
53 | #endif | |
1c79356b A |
54 | #endif |
55 | ||
56 | /* | |
57 | * Simple data types. | |
58 | */ | |
0c530ab8 | 59 | #include <stdbool.h> |
1c79356b A |
60 | #include <libkern/OSTypes.h> |
61 | ||
2d21ac55 A |
62 | #if KERNEL |
63 | #include <libkern/OSBase.h> | |
64 | #endif | |
65 | ||
1c79356b A |
66 | typedef UInt32 IOOptionBits; |
67 | typedef SInt32 IOFixed; | |
68 | typedef UInt32 IOVersion; | |
69 | typedef UInt32 IOItemCount; | |
70 | typedef UInt32 IOCacheMode; | |
71 | ||
b0d623f7 A |
72 | typedef UInt32 IOByteCount32; |
73 | typedef UInt64 IOByteCount64; | |
1c79356b | 74 | |
b0d623f7 A |
75 | typedef UInt32 IOPhysicalAddress32; |
76 | typedef UInt64 IOPhysicalAddress64; | |
77 | typedef UInt32 IOPhysicalLength32; | |
78 | typedef UInt64 IOPhysicalLength64; | |
1c79356b | 79 | |
39236c6e | 80 | #if !defined(__arm__) && !defined(__i386__) |
b0d623f7 A |
81 | typedef mach_vm_address_t IOVirtualAddress; |
82 | #else | |
83 | typedef vm_address_t IOVirtualAddress; | |
84 | #endif | |
85 | ||
39236c6e | 86 | #if !defined(__arm__) && !defined(__i386__) && !(defined(__x86_64__) && !defined(KERNEL)) |
b0d623f7 A |
87 | typedef IOByteCount64 IOByteCount; |
88 | #else | |
89 | typedef IOByteCount32 IOByteCount; | |
90 | #endif | |
1c79356b | 91 | |
b0d623f7 A |
92 | typedef IOVirtualAddress IOLogicalAddress; |
93 | ||
39236c6e | 94 | #if !defined(__arm__) && !defined(__i386__) && !(defined(__x86_64__) && !defined(KERNEL)) |
b0d623f7 A |
95 | |
96 | typedef IOPhysicalAddress64 IOPhysicalAddress; | |
97 | typedef IOPhysicalLength64 IOPhysicalLength; | |
1c79356b A |
98 | #define IOPhysical32( hi, lo ) ((UInt64) lo + ((UInt64)(hi) << 32)) |
99 | #define IOPhysSize 64 | |
100 | ||
101 | #else | |
102 | ||
b0d623f7 A |
103 | typedef IOPhysicalAddress32 IOPhysicalAddress; |
104 | typedef IOPhysicalLength32 IOPhysicalLength; | |
1c79356b A |
105 | #define IOPhysical32( hi, lo ) (lo) |
106 | #define IOPhysSize 32 | |
107 | ||
108 | #endif | |
109 | ||
2d21ac55 | 110 | |
b0d623f7 | 111 | typedef struct |
1c79356b | 112 | { |
b0d623f7 | 113 | IOPhysicalAddress address; |
1c79356b | 114 | IOByteCount length; |
b0d623f7 A |
115 | } IOPhysicalRange; |
116 | ||
1c79356b A |
117 | typedef struct |
118 | { | |
119 | IOVirtualAddress address; | |
120 | IOByteCount length; | |
121 | } IOVirtualRange; | |
0c530ab8 | 122 | |
39236c6e | 123 | #if !defined(__arm__) && !defined(__i386__) |
b0d623f7 | 124 | typedef IOVirtualRange IOAddressRange; |
39236c6e | 125 | #else |
2d21ac55 | 126 | typedef struct |
0c530ab8 A |
127 | { |
128 | mach_vm_address_t address; | |
129 | mach_vm_size_t length; | |
2d21ac55 | 130 | } IOAddressRange; |
39236c6e | 131 | #endif |
1c79356b A |
132 | |
133 | /* | |
134 | * Map between #defined or enum'd constants and text description. | |
135 | */ | |
136 | typedef struct { | |
137 | int value; | |
138 | const char *name; | |
139 | } IONamedValue; | |
140 | ||
141 | ||
142 | /* | |
143 | * Memory alignment -- specified as a power of two. | |
144 | */ | |
145 | typedef unsigned int IOAlignment; | |
146 | ||
147 | #define IO_NULL_VM_TASK ((vm_task_t)0) | |
148 | ||
149 | ||
150 | /* | |
151 | * Pull in machine specific stuff. | |
152 | */ | |
153 | ||
154 | //#include <IOKit/machine/IOTypes.h> | |
155 | ||
156 | #ifndef MACH_KERNEL | |
157 | ||
158 | #ifndef __IOKIT_PORTS_DEFINED__ | |
159 | #define __IOKIT_PORTS_DEFINED__ | |
160 | #ifdef KERNEL | |
6d2010ae A |
161 | #ifdef __cplusplus |
162 | class OSObject; | |
163 | typedef OSObject * io_object_t; | |
164 | #else | |
1c79356b | 165 | typedef struct OSObject * io_object_t; |
6d2010ae | 166 | #endif |
1c79356b A |
167 | #else /* KERNEL */ |
168 | typedef mach_port_t io_object_t; | |
169 | #endif /* KERNEL */ | |
170 | #endif /* __IOKIT_PORTS_DEFINED__ */ | |
171 | ||
172 | #include <device/device_types.h> | |
173 | ||
174 | typedef io_object_t io_connect_t; | |
91447636 | 175 | typedef io_object_t io_enumerator_t; |
1c79356b A |
176 | typedef io_object_t io_iterator_t; |
177 | typedef io_object_t io_registry_entry_t; | |
178 | typedef io_object_t io_service_t; | |
179 | ||
91447636 | 180 | #define IO_OBJECT_NULL ((io_object_t) 0) |
1c79356b A |
181 | |
182 | #endif /* MACH_KERNEL */ | |
183 | ||
184 | // IOConnectMapMemory memoryTypes | |
185 | enum { | |
186 | kIODefaultMemoryType = 0 | |
187 | }; | |
188 | ||
189 | enum { | |
190 | kIODefaultCache = 0, | |
191 | kIOInhibitCache = 1, | |
192 | kIOWriteThruCache = 2, | |
55e303ae | 193 | kIOCopybackCache = 3, |
316670eb | 194 | kIOWriteCombineCache = 4, |
5ba3f43e A |
195 | kIOCopybackInnerCache = 5, |
196 | kIOPostedWrite = 6 | |
1c79356b A |
197 | }; |
198 | ||
199 | // IOMemory mapping options | |
200 | enum { | |
201 | kIOMapAnywhere = 0x00000001, | |
202 | ||
55e303ae | 203 | kIOMapCacheMask = 0x00000700, |
1c79356b | 204 | kIOMapCacheShift = 8, |
316670eb A |
205 | kIOMapDefaultCache = kIODefaultCache << kIOMapCacheShift, |
206 | kIOMapInhibitCache = kIOInhibitCache << kIOMapCacheShift, | |
207 | kIOMapWriteThruCache = kIOWriteThruCache << kIOMapCacheShift, | |
208 | kIOMapCopybackCache = kIOCopybackCache << kIOMapCacheShift, | |
209 | kIOMapWriteCombineCache = kIOWriteCombineCache << kIOMapCacheShift, | |
210 | kIOMapCopybackInnerCache = kIOCopybackInnerCache << kIOMapCacheShift, | |
5ba3f43e | 211 | kIOMapPostedWrite = kIOPostedWrite << kIOMapCacheShift, |
1c79356b A |
212 | |
213 | kIOMapUserOptionsMask = 0x00000fff, | |
214 | ||
215 | kIOMapReadOnly = 0x00001000, | |
216 | ||
217 | kIOMapStatic = 0x01000000, | |
91447636 | 218 | kIOMapReference = 0x02000000, |
fe8ab488 | 219 | kIOMapUnique = 0x04000000, |
b0d623f7 | 220 | #ifdef XNU_KERNEL_PRIVATE |
fe8ab488 | 221 | kIOMap64Bit = 0x08000000, |
b0d623f7 | 222 | #endif |
fe8ab488 | 223 | kIOMapPrefault = 0x10000000, |
3e170ce0 | 224 | kIOMapOverwrite = 0x20000000 |
1c79356b A |
225 | }; |
226 | ||
227 | /*! @enum Scale Factors | |
228 | @discussion Used when a scale_factor parameter is required to define a unit of time. | |
229 | @constant kNanosecondScale Scale factor for nanosecond based times. | |
230 | @constant kMicrosecondScale Scale factor for microsecond based times. | |
231 | @constant kMillisecondScale Scale factor for millisecond based times. | |
91447636 | 232 | @constant kTickScale Scale factor for the standard (100Hz) tick. |
1c79356b A |
233 | @constant kSecondScale Scale factor for second based times. */ |
234 | ||
235 | enum { | |
236 | kNanosecondScale = 1, | |
237 | kMicrosecondScale = 1000, | |
238 | kMillisecondScale = 1000 * 1000, | |
91447636 A |
239 | kSecondScale = 1000 * 1000 * 1000, |
240 | kTickScale = (kSecondScale / 100) | |
1c79356b A |
241 | }; |
242 | ||
ebb1b9f4 A |
243 | enum { |
244 | kIOConnectMethodVarOutputSize = -3 | |
245 | }; | |
246 | ||
1c79356b A |
247 | /* compatibility types */ |
248 | ||
249 | #ifndef KERNEL | |
1c79356b | 250 | |
1c79356b | 251 | typedef unsigned int IODeviceNumber; |
1c79356b A |
252 | |
253 | #endif | |
254 | ||
255 | #ifdef __cplusplus | |
256 | } | |
257 | #endif | |
258 | ||
259 | #endif /* ! __IOKIT_IOTYPES_H */ |