|
|
1.1 root 1: /*
2: * Copyright (c) 1998-2000 Apple Computer, Inc. All rights reserved.
3: *
4: * @APPLE_LICENSE_HEADER_START@
5: *
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.
11: *
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
14: * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
15: * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
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.
19: *
20: * @APPLE_LICENSE_HEADER_END@
21: */
22: /*
23: * Copyright (c) 1999 Apple Computer, Inc. All rights reserved.
24: *
25: * HISTORY
26: *
27: */
28:
29:
30: #ifndef _IOKIT_IOUSBUSERCLIENT_H
31: #define _IOKIT_IOUSBUSERCLIENT_H
32:
33: #include <IOKit/IOUserClient.h>
34: #include <IOKit/usb/USB.h>
35:
36: class IOUSBDevice;
37: class IOUSBInterface;
38: class OSSet;
39:
40: class IOUSBUserClient : public IOUserClient
41: {
42: OSDeclareDefaultStructors(IOUSBUserClient)
43:
44: protected:
45: task_t fTask;
46: IOExternalMethod fMethods[ kNumUSBMethods ];
47: IOExternalAsyncMethod fAsyncMethods[ kNumUSBMethods ];
48: IOUSBPipe * fPipes[kUSBMaxPipes];
49:
50: static void ReqComplete(void *obj, void *param, IOReturn status,
51: UInt32 remaining);
52:
53: public:
54: virtual IOExternalMethod * getExternalMethodForIndex( UInt32 index );
55: virtual IOExternalAsyncMethod * getExternalAsyncMethodForIndex( UInt32 index );
56:
57:
58: virtual bool start( IOService * provider );
59:
60: /*
61: * There's a limit of max 6 arguments to user client methods,
62: * so the type, recipient and request are packed into one 16 bit integer
63: */
64: virtual IOReturn ControlReqIn(UInt32 pipe, UInt16 bmreqtypeRequest, UInt16 wValue,
65: UInt16 wIndex, void *buf, UInt32 *size);
66: virtual IOReturn ControlReqOut(UInt32 pipe, UInt16 bmreqtypeRequest, UInt16 wValue,
67: UInt16 wIndex, void *buf, UInt32 size);
68: /*
69: * Way too many arguments, and the data is out of line anyway.
70: * Arguments are passed in a parameter block
71: */
72: virtual IOReturn ControlReqInOOL(DevReqOOL *req, UInt32 *sizeOut,
73: IOByteCount inCount, IOByteCount *outCount);
74: virtual IOReturn ControlReqOutOOL(DevReqOOL *req, IOByteCount inCount);
75:
76: virtual IOReturn ControlReqInAsync(OSAsyncReference asyncRef,
77: DevReqOOL *req, IOByteCount inCount);
78: virtual IOReturn ControlReqOutAsync(OSAsyncReference asyncRef,
79: DevReqOOL *req, IOByteCount inCount);
80:
81: virtual IOReturn ReadPipe(UInt32 pipe, void *buf, UInt32 *size);
82: virtual IOReturn WritePipe(UInt32 pipe, void *buf, UInt32 size);
83: virtual IOReturn ReadPipeOOL(UInt32 pipe, void *buf,
84: UInt32 sizeIn, UInt32 *sizeOut);
85: virtual IOReturn WritePipeOOL(UInt32 pipe, void *buf, UInt32 size);
86:
87: virtual IOReturn ReadPipeAsync(OSAsyncReference asyncRef,
88: UInt32 pipe, void *buf, UInt32 size);
89: virtual IOReturn WritePipeAsync(OSAsyncReference asyncRef,
90: UInt32 pipe, void *buf, UInt32 size);
91:
92: // Controlling pipe state
93: virtual IOReturn getPipeStatus(UInt32 pipe);
94: virtual IOReturn abortPipe(UInt32 pipe);
95: virtual IOReturn resetPipe(UInt32 pipe);
96: virtual IOReturn setPipeIdle(UInt32 pipe);
97: virtual IOReturn setPipeActive(UInt32 pipe);
98: virtual IOReturn clearPipeStall(UInt32 pipe);
99:
100: virtual IOReturn ClosePipe(UInt32 pipe);
101: virtual IOReturn OpenPipe(UInt32 configIndex,
102: UInt32 intNo, UInt32 altSet,UInt32 endPtNo, UInt32 *pipe) = 0;
103: virtual IOReturn GetConfigDescriptor(UInt8 configIndex,
104: IOUSBConfigurationDescriptorPtr desc, UInt32 *size) = 0;
105: };
106:
107: class IOUSBDeviceUserClient : public IOUSBUserClient
108: {
109: OSDeclareDefaultStructors(IOUSBDeviceUserClient)
110:
111: protected:
112: IOUSBDevice * fOwner;
113: OSSet * fInterfaces;
114:
115: public:
116: static IOUSBDeviceUserClient *withTask(task_t owningTask);
117:
118: virtual IOReturn clientClose( void );
119:
120: virtual bool start( IOService * provider );
121:
122: virtual IOReturn GetConfigDescriptor(UInt8 configIndex,
123: IOUSBConfigurationDescriptorPtr desc, UInt32 *size);
124:
125: virtual IOReturn OpenPipe(UInt32 configIndex,
126: UInt32 intNo, UInt32 altSet,UInt32 endPtNo, UInt32 *pipe);
127: };
128:
129: class IOUSBInterfaceUserClient : public IOUSBUserClient
130: {
131: OSDeclareDefaultStructors(IOUSBInterfaceUserClient)
132:
133: protected:
134: IOUSBInterface * fOwner;
135: bool fOpen;
136:
137: public:
138: static IOUSBInterfaceUserClient *withTask(task_t owningTask);
139:
140: virtual IOReturn clientClose( void );
141:
142: virtual bool start( IOService * provider );
143:
144: virtual IOReturn GetConfigDescriptor(UInt8 configIndex,
145: IOUSBConfigurationDescriptorPtr desc, UInt32 *size);
146:
147: virtual IOReturn OpenPipe(UInt32 configIndex,
148: UInt32 intNo, UInt32 altSet,UInt32 endPtNo, UInt32 *pipe);
149: };
150:
151: #endif /* ! _IOKIT_IOUSBUSERCLIENT_H */
152:
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.