]> git.saurik.com Git - apple/xnu.git/blame - iokit/IOKit/IOTypes.h
xnu-517.9.5.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 *
e5568f75
A
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.
1c79356b 11 *
e5568f75
A
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
1c79356b
A
14 * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
15 * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
e5568f75
A
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.
1c79356b
A
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
46extern "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
64typedef int bool;
65enum {
66 false = 0,
67 true = 1
68};
69#endif
70#endif
71#endif
72
73#endif /* __TYPES__ */
74#endif /* __MACTYPES__ */
75
76typedef UInt32 IOOptionBits;
77typedef SInt32 IOFixed;
78typedef UInt32 IOVersion;
79typedef UInt32 IOItemCount;
80typedef UInt32 IOCacheMode;
81
82typedef UInt32 IOByteCount;
83
84typedef vm_address_t IOVirtualAddress;
85typedef IOVirtualAddress IOLogicalAddress;
86
87#if 0
88
89typedef UInt64 IOPhysicalAddress;
90typedef UInt64 IOPhysicalLength;
91#define IOPhysical32( hi, lo ) ((UInt64) lo + ((UInt64)(hi) << 32))
92#define IOPhysSize 64
93
94#else
95
96typedef UInt32 IOPhysicalAddress;
97typedef UInt32 IOPhysicalLength;
98#define IOPhysical32( hi, lo ) (lo)
99#define IOPhysSize 32
100
101#endif
102
103#if __cplusplus
104struct IOVirtualRange
105{
106 IOVirtualAddress address;
107 IOByteCount length;
108};
109#else
110typedef 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 */
120typedef struct {
121 int value;
122 const char *name;
123} IONamedValue;
124
125
126/*
127 * Memory alignment -- specified as a power of two.
128 */
129typedef 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
145typedef struct OSObject * io_object_t;
146#else /* KERNEL */
147typedef mach_port_t io_object_t;
148#endif /* KERNEL */
149#endif /* __IOKIT_PORTS_DEFINED__ */
150
151#include <device/device_types.h>
152
153typedef io_object_t io_connect_t;
154typedef io_object_t io_iterator_t;
155typedef io_object_t io_registry_entry_t;
156typedef io_object_t io_service_t;
157
158typedef io_object_t io_enumerator_t;
159
160#endif /* MACH_KERNEL */
161
162// IOConnectMapMemory memoryTypes
163enum {
164 kIODefaultMemoryType = 0
165};
166
167enum {
168 kIODefaultCache = 0,
169 kIOInhibitCache = 1,
170 kIOWriteThruCache = 2,
55e303ae
A
171 kIOCopybackCache = 3,
172 kIOWriteCombineCache = 4
1c79356b
A
173};
174
175// IOMemory mapping options
176enum {
177 kIOMapAnywhere = 0x00000001,
178
55e303ae 179 kIOMapCacheMask = 0x00000700,
1c79356b 180 kIOMapCacheShift = 8,
55e303ae
A
181 kIOMapDefaultCache = kIODefaultCache << kIOMapCacheShift,
182 kIOMapInhibitCache = kIOInhibitCache << kIOMapCacheShift,
183 kIOMapWriteThruCache = kIOWriteThruCache << kIOMapCacheShift,
184 kIOMapCopybackCache = kIOCopybackCache << kIOMapCacheShift,
185 kIOMapWriteCombineCache = kIOWriteCombineCache << kIOMapCacheShift,
1c79356b
A
186
187 kIOMapUserOptionsMask = 0x00000fff,
188
189 kIOMapReadOnly = 0x00001000,
190
191 kIOMapStatic = 0x01000000,
192 kIOMapReference = 0x02000000
193};
194
195/*! @enum Scale Factors
196 @discussion Used when a scale_factor parameter is required to define a unit of time.
197 @constant kNanosecondScale Scale factor for nanosecond based times.
198 @constant kMicrosecondScale Scale factor for microsecond based times.
199 @constant kMillisecondScale Scale factor for millisecond based times.
200 @constant kSecondScale Scale factor for second based times. */
201
202enum {
203 kNanosecondScale = 1,
204 kMicrosecondScale = 1000,
205 kMillisecondScale = 1000 * 1000,
206 kSecondScale = 1000 * 1000 * 1000
207};
208
209/* compatibility types */
210
211#ifndef KERNEL
212/*
213 * Machine-independent caching specification.
214 */
215typedef enum {
216 IO_CacheOff, // cache inhibit
217 IO_WriteThrough,
218 IO_CopyBack
219} IOCache;
220
221//typedef char OSString[64];
222typedef unsigned int IODeviceNumber;
223typedef unsigned int IOObjectNumber;
224
225#endif
226
227#ifdef __cplusplus
228}
229#endif
230
231#endif /* ! __IOKIT_IOTYPES_H */