]> git.saurik.com Git - apple/xnu.git/blob - iokit/IOKit/IOTypes.h
xnu-792.6.56.tar.gz
[apple/xnu.git] / iokit / IOKit / IOTypes.h
1 /*
2 * Copyright (c) 1998-2004 Apple Computer, Inc. All rights reserved.
3 *
4 * @APPLE_LICENSE_HEADER_START@
5 *
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. Please obtain a copy of the License at
10 * http://www.opensource.apple.com/apsl/ and read it before using this
11 * file.
12 *
13 * The Original Code and all software distributed under the License are
14 * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
15 * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
16 * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
17 * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
18 * Please see the License for the specific language governing rights and
19 * limitations under the License.
20 *
21 * @APPLE_LICENSE_HEADER_END@
22 */
23 /*
24 * Copyright (c) 1998 Apple Computer, Inc. All rights reserved.
25 *
26 * HISTORY
27 *
28 */
29
30 #ifndef __IOKIT_IOTYPES_H
31 #define __IOKIT_IOTYPES_H
32
33 #ifndef IOKIT
34 #define IOKIT 1
35 #endif /* !IOKIT */
36
37 #if KERNEL
38 #include <IOKit/system.h>
39 #else
40 #include <mach/message.h>
41 #include <mach/vm_types.h>
42 #endif
43
44 #include <IOKit/IOReturn.h>
45
46 #ifdef __cplusplus
47 extern "C" {
48 #endif
49
50 #ifndef NULL
51 #define NULL 0
52 #endif
53
54 /*
55 * Simple data types.
56 */
57 #ifndef __MACTYPES__ /* CF MacTypes.h */
58 #ifndef __TYPES__ /* guess... Mac Types.h */
59
60 #include <libkern/OSTypes.h>
61
62 #ifndef __cplusplus
63 #if !TYPE_BOOL
64 #ifdef KERNEL
65 typedef int bool;
66 enum {
67 false = 0,
68 true = 1
69 };
70 #endif
71 #endif
72 #endif
73
74 #endif /* __TYPES__ */
75 #endif /* __MACTYPES__ */
76
77 typedef UInt32 IOOptionBits;
78 typedef SInt32 IOFixed;
79 typedef UInt32 IOVersion;
80 typedef UInt32 IOItemCount;
81 typedef UInt32 IOCacheMode;
82
83 typedef UInt32 IOByteCount;
84
85 /* LP64todo - these will need to expand to mach_vm_address_t */
86 typedef vm_address_t IOVirtualAddress;
87 typedef IOVirtualAddress IOLogicalAddress;
88
89 #if 0
90
91 typedef UInt64 IOPhysicalAddress;
92 typedef UInt64 IOPhysicalLength;
93 #define IOPhysical32( hi, lo ) ((UInt64) lo + ((UInt64)(hi) << 32))
94 #define IOPhysSize 64
95
96 #else
97
98 typedef UInt32 IOPhysicalAddress;
99 typedef UInt32 IOPhysicalLength;
100 #define IOPhysical32( hi, lo ) (lo)
101 #define IOPhysSize 32
102
103 #endif
104
105 #if __cplusplus
106 struct IOVirtualRange
107 {
108 IOVirtualAddress address;
109 IOByteCount length;
110 };
111 #else
112 typedef struct
113 {
114 IOVirtualAddress address;
115 IOByteCount length;
116 } IOVirtualRange;
117 #endif
118
119 /*
120 * Map between #defined or enum'd constants and text description.
121 */
122 typedef struct {
123 int value;
124 const char *name;
125 } IONamedValue;
126
127
128 /*
129 * Memory alignment -- specified as a power of two.
130 */
131 typedef unsigned int IOAlignment;
132
133 #define IO_NULL_VM_TASK ((vm_task_t)0)
134
135
136 /*
137 * Pull in machine specific stuff.
138 */
139
140 //#include <IOKit/machine/IOTypes.h>
141
142 #ifndef MACH_KERNEL
143
144 #ifndef __IOKIT_PORTS_DEFINED__
145 #define __IOKIT_PORTS_DEFINED__
146 #ifdef KERNEL
147 typedef struct OSObject * io_object_t;
148 #else /* KERNEL */
149 typedef mach_port_t io_object_t;
150 #endif /* KERNEL */
151 #endif /* __IOKIT_PORTS_DEFINED__ */
152
153 #include <device/device_types.h>
154
155 typedef io_object_t io_connect_t;
156 typedef io_object_t io_enumerator_t;
157 typedef io_object_t io_iterator_t;
158 typedef io_object_t io_registry_entry_t;
159 typedef io_object_t io_service_t;
160
161 #define IO_OBJECT_NULL ((io_object_t) 0)
162
163 #endif /* MACH_KERNEL */
164
165 // IOConnectMapMemory memoryTypes
166 enum {
167 kIODefaultMemoryType = 0
168 };
169
170 enum {
171 kIODefaultCache = 0,
172 kIOInhibitCache = 1,
173 kIOWriteThruCache = 2,
174 kIOCopybackCache = 3,
175 kIOWriteCombineCache = 4
176 };
177
178 // IOMemory mapping options
179 enum {
180 kIOMapAnywhere = 0x00000001,
181
182 kIOMapCacheMask = 0x00000700,
183 kIOMapCacheShift = 8,
184 kIOMapDefaultCache = kIODefaultCache << kIOMapCacheShift,
185 kIOMapInhibitCache = kIOInhibitCache << kIOMapCacheShift,
186 kIOMapWriteThruCache = kIOWriteThruCache << kIOMapCacheShift,
187 kIOMapCopybackCache = kIOCopybackCache << kIOMapCacheShift,
188 kIOMapWriteCombineCache = kIOWriteCombineCache << kIOMapCacheShift,
189
190 kIOMapUserOptionsMask = 0x00000fff,
191
192 kIOMapReadOnly = 0x00001000,
193
194 kIOMapStatic = 0x01000000,
195 kIOMapReference = 0x02000000,
196 kIOMapUnique = 0x04000000
197 };
198
199 /*! @enum Scale Factors
200 @discussion Used when a scale_factor parameter is required to define a unit of time.
201 @constant kNanosecondScale Scale factor for nanosecond based times.
202 @constant kMicrosecondScale Scale factor for microsecond based times.
203 @constant kMillisecondScale Scale factor for millisecond based times.
204 @constant kTickScale Scale factor for the standard (100Hz) tick.
205 @constant kSecondScale Scale factor for second based times. */
206
207 enum {
208 kNanosecondScale = 1,
209 kMicrosecondScale = 1000,
210 kMillisecondScale = 1000 * 1000,
211 kSecondScale = 1000 * 1000 * 1000,
212 kTickScale = (kSecondScale / 100)
213 };
214
215 /* compatibility types */
216
217 #ifndef KERNEL
218 /*
219 * Machine-independent caching specification.
220 */
221 typedef enum {
222 IO_CacheOff, // cache inhibit
223 IO_WriteThrough,
224 IO_CopyBack
225 } IOCache;
226
227 //typedef char OSString[64];
228 typedef unsigned int IODeviceNumber;
229 typedef unsigned int IOObjectNumber;
230
231 #endif
232
233 #ifdef __cplusplus
234 }
235 #endif
236
237 #endif /* ! __IOKIT_IOTYPES_H */