Chameleon

Chameleon Svn Source Tree

Root/branches/ErmaC/Enoch_Modules/i386/include/IOKit/stream/IOStreamShared.h

1/*
2 * IOStreamShared.h
3 * IOStreamFamily
4 *
5 * Copyright 2006 Apple Computer, Inc. All rights reserved.
6 *
7 */
8
9#if !defined(__IOKIT_IOSTREAMSHARED_H)
10#define __IOKIT_IOSTREAMSHARED_H
11
12#include <sys/cdefs.h>
13
14#include <IOKit/IOTypes.h>
15
16/*!
17 @header IOStreamShared.h
18 IOStream definitions shared between kernel and user space.
19 */
20
21__BEGIN_DECLS
22
23// Buffer numbers are guaranteed to go from 0 to bufferCount - 1.
24/*!
25 @typedef IOStreamBufferID
26 */
27typedef UInt32 IOStreamBufferID;
28#define kIOStreamBufferIDInvalid (~0)
29
30// This is the header for the shared-memory queue used to send buffer notifications
31// from kernel to user space or vice versa.
32
33// Queue entry in input or output queue
34
35#ifdef __cplusplus
36
37/*!
38 @struct IOStreamBufferQueueEntry
39 @field bufferID The ID of the buffer passed in this queue entry.
40 @field dataLength The length of the valid data in the buffer.
41 @field reserved Reserved for future use.
42*/
43
44struct IOStreamBufferQueueEntry {
45 IOStreamBufferID bufferID;
46 UInt32 dataOffset;
47 UInt32 dataLength;
48 UInt32 controlOffset;
49 UInt32 controlLength;
50 UInt32 reserved[3];
51};
52
53
54/*!
55 @struct IOStreamBufferQueue
56 @field entryCount The number of queue entries in the queue.
57 @field headIndex The index of the next queue slot that will be filled in by the queue writer.
58 @field tailIndex The index of the next queue slot that can be read by the queue reader.
59 @field reserved Reserved for future use.
60 @field queue The array of queue entries.
61 */
62
63struct IOStreamBufferQueue {
64 UInt32 entryCount;
65 volatile UInt32 headIndex;
66 volatile UInt32 tailIndex;
67 UInt32 reserved;
68 IOStreamBufferQueueEntry queue[0];
69};
70
71#else
72
73typedef struct __IOStreamBufferQueueEntry {
74 IOStreamBufferID bufferID;
75 UInt32 dataOffset;
76 UInt32 dataLength;
77 UInt32 controlOffset;
78 UInt32 controlLength;
79 UInt32 reserved[3];
80} IOStreamBufferQueueEntry;
81
82typedef struct __IOStreamBufferQueue {
83 UInt32 entryCount;
84 volatile UInt32 headIndex;
85 volatile UInt32 tailIndex;
86 UInt32 reserved;
87 IOStreamBufferQueueEntry queue[0];
88} IOStreamBufferQueue;
89
90#endif
91
92/*!
93 @enum Memory mapping types
94 @constant kIOStreamMemoryTypeOutputQueue
95 @constant kIOStreamMemoryTypeInputQueue
96 @constant kIOStreamMemoryTypeBufferData
97 @constant kIOStreamMemoryTypeBufferControl
98 @constant kIOStreamBufferIDMask
99 @constant kIOStreamMemoryTypeMask
100 @abstract Memory types used with IOConnectMapMemory().
101 */
102enum {
103 kIOStreamMemoryTypeOutputQueue = 0x10000000,
104 kIOStreamMemoryTypeInputQueue = 0x20000000,
105 kIOStreamMemoryTypeBufferData = 0x30000000,
106 kIOStreamMemoryTypeBufferControl = 0x40000000,
107 kIOStreamBufferIDMask = 0x0FFFFFFF,
108 kIOStreamMemoryTypeMask = 0xF0000000
109};
110
111/*!
112 @enum Mach port types
113 @constant kIOStreamPortTypeOutput
114 @constant kIOStreamPortTypeInput
115 @abstract Port types used with IOConnectSetNotificationPort().
116 */
117enum {
118 kIOStreamPortTypeOutput,
119 kIOStreamPortTypeInput
120};
121
122/*!
123 @enum IOStream open options
124 */
125
126enum {
127 kIOStreamOptionOpenExclusive = 0x00010000,
128 kIOStreamOptionOpenShared = 0x00020000
129};
130
131/*!
132 @enum User client methods
133 @constant kIOStreamMethodOpen
134 @constant kIOStreamMethodClose
135 @constant kIOStreamMethodStart
136 @constant kIOStreamMethodStop
137 @constant kIOStreamMethodSuspend
138 @constant kIOStreamMethodGetMode
139 @constant kIOStreamMethodSetMode
140
141 @abstract Client method numbers used with IOConnectMethod...() functions.
142 */
143enum {
144 kIOStreamMethodOpen,
145 kIOStreamMethodClose,
146 kIOStreamMethodStart,
147 kIOStreamMethodStop,
148 kIOStreamMethodSuspend,
149 kIOStreamMethodGetMode,
150 kIOStreamMethodSetMode,
151 kIOStreamMethodGetBufferCount
152};
153
154/*!
155 @enum User client traps
156 @constant kIOStreamEnqueueInputTrap
157 @constant kIOStreamEnqueueInputSyncTrap
158 @abstract Client trap numbers used with IOConnectTrap..() functions.
159 */
160enum {
161 kIOStreamEnqueueInputTrap,
162 kIOStreamEnqueueInputSyncTrap
163};
164
165typedef enum {
166 kIOStreamModeInput, // From user to kernel space
167 kIOStreamModeOutput, // From kernel to user space
168 kIOStreamModeInputOutput // bidirectional
169} IOStreamMode;
170
171
172__END_DECLS
173
174#endif /* ! __IOKIT_IOSTREAMSHARED_H */
175
176

Archive Download this file

Revision: 2238