Annotation of XNU/iokit/IOKit/usb/IOUSBLib.h, revision 1.1

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: #ifndef _IOUSBLIB_H
        !            23: #define _IOUSBLIB_H
        !            24: 
        !            25: #include <IOKit/usb/USB.h>
        !            26: #include <IOKit/IOKitLib.h>
        !            27: 
        !            28: #ifdef __cplusplus
        !            29: extern "C" {
        !            30: #endif
        !            31: 
        !            32: // IOKit structures eequivalent to various descriptors
        !            33: typedef struct IOUSBConfiguration IOUSBConfiguration;
        !            34: typedef struct IOUSBInterface IOUSBInterface;
        !            35: typedef struct IOUSBEndpoint IOUSBEndpoint;
        !            36: typedef struct IOUSBDevice IOUSBDevice;
        !            37: 
        !            38: struct IOUSBEndpoint {
        !            39:     IOUSBEndpointDescriptor    *descriptor;
        !            40:     IOUSBDevice                        *device;
        !            41:     IOUSBInterface             *interface;
        !            42:     UInt8                      number;
        !            43:     UInt8                      direction;      // in, out
        !            44:     UInt8                      transferType;   // cntrl, bulk, isoc, int
        !            45:     UInt16                     maxPacketSize;
        !            46:     UInt8                      interval;
        !            47: };
        !            48: 
        !            49: struct IOUSBInterface {
        !            50:     IOUSBInterfaceDescriptor   *descriptor;
        !            51:     IOUSBDevice                        *device;
        !            52:     IOUSBConfiguration                 *config;
        !            53:     IOUSBEndpoint              **endpoints;
        !            54: };
        !            55: 
        !            56: struct IOUSBConfiguration {
        !            57:     IOUSBConfigurationDescriptor *descriptor;
        !            58:     IOUSBDevice                        *device;
        !            59:     IOUSBInterface             **interfaces;
        !            60: };
        !            61: 
        !            62: typedef struct {
        !            63:     UInt8 theClass;            // requested class,    0 = don't care
        !            64:     UInt8 subClass;            // requested subclass; 0 = don't care
        !            65:     UInt8 protocol;            // requested protocol; 0 = don't care
        !            66:     UInt8 busPowered:2;                // 1 = not bus powered, 2 = bus powered,
        !            67:                                 // 0 = don't care
        !            68:     UInt8 selfPowered:2;       // 1 = not self powered, 2 = self powered,
        !            69:                                 // 0 = don't care
        !            70:     UInt8 remoteWakeup:2;      // 1 = doesn't support remote wakeup; 2 = does
        !            71:                                 // 0 = don't care
        !            72:     UInt8 reserved:2;
        !            73:     UInt8 maxPower;            // max power in 2ma increments; 0 = don't care
        !            74:     UInt8 alternateIndex;      // alternate #; 0xff = find first only
        !            75:     UInt8 configIndex;         // 0 = start at beginning
        !            76:     UInt8 interfaceIndex;      // 0 = start at beginning
        !            77: } IOUSBFindInterfaceRequest;
        !            78: 
        !            79: 
        !            80:     
        !            81: struct IOUSBUserPipe;  // Not same definition as Kernel IOUSBPipe.
        !            82: 
        !            83: typedef struct IOUSBDeviceIterator * IOUSBIteratorRef;
        !            84: typedef IOUSBDevice * IOUSBDeviceRef;
        !            85: typedef struct IOUSBUserPipe * IOUSBPipeRef;
        !            86: 
        !            87: IOReturn IOUSBCreateIterator(mach_port_t master_device_port, mach_port_t port,
        !            88:                IOUSBMatch * descMatch, IOUSBIteratorRef * iter);
        !            89: IOReturn IOUSBIteratorNext(IOUSBIteratorRef iter);
        !            90: IOReturn IOUSBDisposeIterator(IOUSBIteratorRef iter);
        !            91: 
        !            92: // Sets *isIntf to 1 if iter is an interface, 0 if it is a device.
        !            93: IOReturn IOUSBIsInterface(IOUSBIteratorRef iter, int *isIntf);
        !            94: 
        !            95: IOReturn IOUSBGetDeviceDescriptor(IOUSBIteratorRef iter,
        !            96:                        IOUSBDeviceDescriptorPtr desc, UInt32 size);
        !            97: IOReturn IOUSBGetInterfaceDescriptor(IOUSBIteratorRef iter,
        !            98:                             IOUSBInterfaceDescriptorPtr desc, UInt32 size);
        !            99: 
        !           100: 
        !           101: IOReturn IOUSBNewDeviceRef(IOUSBIteratorRef iter, IOUSBDeviceRef *newDevice);
        !           102: IOReturn IOUSBDisposeRef(IOUSBDeviceRef object);
        !           103: 
        !           104: // Device is in a really bad state - reset it
        !           105: // (as if it was unplugged then plugged in again)
        !           106: IOReturn IOUSBResetDevice(IOUSBDeviceRef object);
        !           107: 
        !           108: IOReturn IOUSBGetConfigDescriptor(IOUSBDeviceRef device, UInt8 configIndex,
        !           109:                         IOUSBConfigurationDescriptorPtr *desc);
        !           110: 
        !           111: 
        !           112: IOReturn IOUSBSetConfiguration(IOUSBDeviceRef device, UInt8 config);
        !           113: IOReturn IOUSBGetConfiguration(IOUSBDeviceRef device, UInt8 *config);
        !           114: 
        !           115: IOUSBInterface *IOUSBGetInterface(IOUSBDeviceRef device, UInt8 configIndex,
        !           116:                              UInt8 interfaceIndex, UInt8 alternateIndex);
        !           117: 
        !           118: IOUSBInterface *IOUSBFindNextInterface(IOUSBDeviceRef device,
        !           119:                                IOUSBFindInterfaceRequest *request);
        !           120: 
        !           121: void IOUSBDisposeInterface(IOUSBInterface * interface);
        !           122: 
        !           123: IOReturn IOUSBOpenPipe(IOUSBDeviceRef device, IOUSBEndpoint * endpoint,
        !           124:                                                         IOUSBPipeRef *pipe);
        !           125: 
        !           126: IOReturn IOUSBClosePipe(IOUSBPipeRef pipe);
        !           127: 
        !           128: IOReturn IOUSBReadPipe(IOUSBPipeRef pipe, void *buf, UInt32 *size);
        !           129: IOReturn IOUSBWritePipe(IOUSBPipeRef pipe, void *buf, UInt32 size);
        !           130: 
        !           131: // Generic control request
        !           132: // wValue and wIndex are host-endian
        !           133: IOReturn IOUSBControlRequest(IOUSBPipeRef pipe, UInt8 bmreqtype,
        !           134:        UInt8 request, UInt16 wValue, UInt16 wIndex, void *buf, UInt16 *size);
        !           135: 
        !           136:     // Controlling pipe state
        !           137: IOReturn IOUSBGetPipeStatus(IOUSBPipeRef pipe);
        !           138: IOReturn IOUSBAbortPipe(IOUSBPipeRef pipe);
        !           139: IOReturn IOUSBResetPipe(IOUSBPipeRef pipe);
        !           140: IOReturn IOUSBSetPipeIdle(IOUSBPipeRef pipe);
        !           141: IOReturn IOUSBSetPipeActive(IOUSBPipeRef pipe);
        !           142: IOReturn IOUSBClearPipeStall(IOUSBPipeRef pipe);
        !           143: 
        !           144: UInt8 USBMakeBMRequestType(UInt8       rqDirection,
        !           145:                            UInt8       rqType,
        !           146:                            UInt8       rqRecipient);
        !           147: 
        !           148: // Generic device request
        !           149: // wValue and wIndex are host-endian
        !           150: IOReturn IOUSBDeviceRequest(IOUSBDeviceRef device, UInt8 bmreqtype,
        !           151:        UInt8 request, UInt16 wValue, UInt16 wIndex, void *buf, UInt16 *size);
        !           152: 
        !           153: 
        !           154: #ifdef __cplusplus
        !           155: }
        !           156: #endif
        !           157: 
        !           158: #endif /* ! _IOUSBLIB_H */

unix.superglobalmegacorp.com

This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.