]> git.saurik.com Git - apple/xnu.git/blame - iokit/IOKit/IOTypes.h
xnu-344.49.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 *
43866e37 6 * Copyright (c) 1999-2003 Apple Computer, Inc. All Rights Reserved.
1c79356b 7 *
43866e37
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,
43866e37
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,
de355530 174 kIOCopybackCache = 3
1c79356b
A
175};
176
177// IOMemory mapping options
178enum {
179 kIOMapAnywhere = 0x00000001,
180
de355530 181 kIOMapCacheMask = 0x00000300,
1c79356b 182 kIOMapCacheShift = 8,
de355530
A
183 kIOMapDefaultCache = kIODefaultCache << kIOMapCacheShift,
184 kIOMapInhibitCache = kIOInhibitCache << kIOMapCacheShift,
185 kIOMapWriteThruCache = kIOWriteThruCache << kIOMapCacheShift,
186 kIOMapCopybackCache = kIOCopybackCache << kIOMapCacheShift,
1c79356b
A
187
188 kIOMapUserOptionsMask = 0x00000fff,
189
190 kIOMapReadOnly = 0x00001000,
191
192 kIOMapStatic = 0x01000000,
193 kIOMapReference = 0x02000000
194};
195
196/*! @enum Scale Factors
197 @discussion Used when a scale_factor parameter is required to define a unit of time.
198 @constant kNanosecondScale Scale factor for nanosecond based times.
199 @constant kMicrosecondScale Scale factor for microsecond based times.
200 @constant kMillisecondScale Scale factor for millisecond based times.
201 @constant kSecondScale Scale factor for second based times. */
202
203enum {
204 kNanosecondScale = 1,
205 kMicrosecondScale = 1000,
206 kMillisecondScale = 1000 * 1000,
207 kSecondScale = 1000 * 1000 * 1000
208};
209
210/* compatibility types */
211
212#ifndef KERNEL
213/*
214 * Machine-independent caching specification.
215 */
216typedef enum {
217 IO_CacheOff, // cache inhibit
218 IO_WriteThrough,
219 IO_CopyBack
220} IOCache;
221
222//typedef char OSString[64];
223typedef unsigned int IODeviceNumber;
224typedef unsigned int IOObjectNumber;
225
226#endif
227
228#ifdef __cplusplus
229}
230#endif
231
232#endif /* ! __IOKIT_IOTYPES_H */