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