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