]> git.saurik.com Git - apple/xnu.git/blob - iokit/IOKit/IOTypes.h
6a5f344f22146954a9fa20862b3c67ea3d147115
[apple/xnu.git] / iokit / IOKit / IOTypes.h
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) 1998 Apple Computer, Inc. All rights reserved.
24 *
25 * HISTORY
26 *
27 */
28
29 #ifndef __IOKIT_IOTYPES_H
30 #define __IOKIT_IOTYPES_H
31
32 #ifndef IOKIT
33 #define IOKIT 1
34 #endif /* !IOKIT */
35
36 #if KERNEL
37 #include <IOKit/system.h>
38 #else
39 #include <mach/message.h>
40 #include <mach/vm_types.h>
41 #endif
42
43 #include <IOKit/IOReturn.h>
44
45 #ifdef __cplusplus
46 extern "C" {
47 #endif
48
49 #ifndef NULL
50 #define NULL 0
51 #endif
52
53 /*
54 * Simple data types.
55 */
56 #ifndef __MACTYPES__ /* CF MacTypes.h */
57 #ifndef __TYPES__ /* guess... Mac Types.h */
58
59 #include <libkern/OSTypes.h>
60
61 #ifndef __cplusplus
62 #if !TYPE_BOOL
63 #ifdef KERNEL
64 typedef int bool;
65 enum {
66 false = 0,
67 true = 1
68 };
69 #endif
70 #endif
71 #endif
72
73 #endif /* __TYPES__ */
74 #endif /* __MACTYPES__ */
75
76 typedef UInt32 IOOptionBits;
77 typedef SInt32 IOFixed;
78 typedef UInt32 IOVersion;
79 typedef UInt32 IOItemCount;
80 typedef UInt32 IOCacheMode;
81
82 typedef UInt32 IOByteCount;
83
84 typedef vm_address_t IOVirtualAddress;
85 typedef IOVirtualAddress IOLogicalAddress;
86
87 #if 0
88
89 typedef UInt64 IOPhysicalAddress;
90 typedef UInt64 IOPhysicalLength;
91 #define IOPhysical32( hi, lo ) ((UInt64) lo + ((UInt64)(hi) << 32))
92 #define IOPhysSize 64
93
94 #else
95
96 typedef UInt32 IOPhysicalAddress;
97 typedef UInt32 IOPhysicalLength;
98 #define IOPhysical32( hi, lo ) (lo)
99 #define IOPhysSize 32
100
101 #endif
102
103 #if __cplusplus
104 struct IOVirtualRange
105 {
106 IOVirtualAddress address;
107 IOByteCount length;
108 };
109 #else
110 typedef struct
111 {
112 IOVirtualAddress address;
113 IOByteCount length;
114 } IOVirtualRange;
115 #endif
116
117 /*
118 * Map between #defined or enum'd constants and text description.
119 */
120 typedef struct {
121 int value;
122 const char *name;
123 } IONamedValue;
124
125
126 /*
127 * Memory alignment -- specified as a power of two.
128 */
129 typedef unsigned int IOAlignment;
130
131 #define IO_NULL_VM_TASK ((vm_task_t)0)
132
133
134 /*
135 * Pull in machine specific stuff.
136 */
137
138 //#include <IOKit/machine/IOTypes.h>
139
140 #ifndef MACH_KERNEL
141
142 #ifndef __IOKIT_PORTS_DEFINED__
143 #define __IOKIT_PORTS_DEFINED__
144 #ifdef KERNEL
145 typedef struct OSObject * io_object_t;
146 #else /* KERNEL */
147 typedef mach_port_t io_object_t;
148 #endif /* KERNEL */
149 #endif /* __IOKIT_PORTS_DEFINED__ */
150
151 #include <device/device_types.h>
152
153 typedef io_object_t io_connect_t;
154 typedef io_object_t io_iterator_t;
155 typedef io_object_t io_registry_entry_t;
156 typedef io_object_t io_service_t;
157
158 typedef io_object_t io_enumerator_t;
159
160 #endif /* MACH_KERNEL */
161
162 // IOConnectMapMemory memoryTypes
163 enum {
164 kIODefaultMemoryType = 0
165 };
166
167 enum {
168 kIODefaultCache = 0,
169 kIOInhibitCache = 1,
170 kIOWriteThruCache = 2,
171 kIOCopybackCache = 3
172 };
173
174 // IOMemory mapping options
175 enum {
176 kIOMapAnywhere = 0x00000001,
177
178 kIOMapCacheMask = 0x00000300,
179 kIOMapCacheShift = 8,
180 kIOMapDefaultCache = kIODefaultCache << kIOMapCacheShift,
181 kIOMapInhibitCache = kIOInhibitCache << kIOMapCacheShift,
182 kIOMapWriteThruCache = kIOWriteThruCache << kIOMapCacheShift,
183 kIOMapCopybackCache = kIOCopybackCache << kIOMapCacheShift,
184
185 kIOMapUserOptionsMask = 0x00000fff,
186
187 kIOMapReadOnly = 0x00001000,
188
189 kIOMapStatic = 0x01000000,
190 kIOMapReference = 0x02000000
191 };
192
193 /*! @enum Scale Factors
194 @discussion Used when a scale_factor parameter is required to define a unit of time.
195 @constant kNanosecondScale Scale factor for nanosecond based times.
196 @constant kMicrosecondScale Scale factor for microsecond based times.
197 @constant kMillisecondScale Scale factor for millisecond based times.
198 @constant kSecondScale Scale factor for second based times. */
199
200 enum {
201 kNanosecondScale = 1,
202 kMicrosecondScale = 1000,
203 kMillisecondScale = 1000 * 1000,
204 kSecondScale = 1000 * 1000 * 1000
205 };
206
207 /* compatibility types */
208
209 #ifndef KERNEL
210 /*
211 * Machine-independent caching specification.
212 */
213 typedef enum {
214 IO_CacheOff, // cache inhibit
215 IO_WriteThrough,
216 IO_CopyBack
217 } IOCache;
218
219 //typedef char OSString[64];
220 typedef unsigned int IODeviceNumber;
221 typedef unsigned int IOObjectNumber;
222
223 #endif
224
225 #ifdef __cplusplus
226 }
227 #endif
228
229 #endif /* ! __IOKIT_IOTYPES_H */