Annotation of XNU/iokit/IOKit/usb/USBHub.h, revision 1.1.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 _USBHUB_H
                     23: #define _USBHUB_H
                     24: 
                     25: /* Hub defines*/
                     26: 
                     27: 
                     28: enum {
                     29:        kUSBHubDescriptorType           = 0x29
                     30: };
                     31: 
                     32: enum {
                     33:                                                
                     34:        kUSBHubLocalPowerChangeFeature          = 0,    /* Hub features */
                     35:        kUSBHubOverCurrentChangeFeature         = 1,
                     36: 
                     37:        kUSBHubPortConnectionFeature            = 0,    /* port features */
                     38:        kUSBHubPortEnableFeature                = 1,
                     39:        kUSBHubPortSuspendFeature               = 2,
                     40:        kUSBHubPortOverCurrentFeature           = 3,
                     41:        kUSBHubPortResetFeature                 = 4,
                     42:        kUSBHubPortPowerFeature                 = 8,
                     43:        kUSBHubPortLowSpeedFeature              = 9,
                     44:        kUSBHubPortConnectionChangeFeature      = 16,
                     45:        kUSBHubPortEnableChangeFeature          = 17,
                     46:        kUSBHubPortSuspendChangeFeature         = 18,
                     47:        kUSBHubPortOverCurrentChangeFeature     = 19,
                     48:        kUSBHubPortResetChangeFeature           = 20
                     49: };
                     50: 
                     51: enum {
                     52:        kHubPortConnection              = 1,
                     53:        kHubPortEnabled                 = 2,
                     54:        kHubPortSuspend                 = 4,
                     55:        kHubPortOverCurrent             = 8,
                     56:        kHubPortBeingReset              = 16,
                     57:        kHubPortPower                   = 0x0100,
                     58:        kHubPortSpeed                   = 0x0200
                     59: };
                     60: 
                     61: 
                     62: enum {
                     63:        kHubLocalPowerStatus            = 1,
                     64:        kHubOverCurrentIndicator        = 2,
                     65:        kHubLocalPowerStatusChange      = 1,
                     66:        kHubOverCurrentIndicatorChange  = 2
                     67: };
                     68: 
                     69: // hub characteristics
                     70: enum {
                     71:     kPerPortSwitchingBit       = (1 << 0),
                     72:     kNoPowerSwitchingBit               = (1 << 1),
                     73:     kCompoundDeviceBit                 = (1 << 2),
                     74:     kPerPortOverCurrentBit     = (1 << 3),
                     75:     kNoOverCurrentBit          = (1 << 4)
                     76: };
                     77: 
                     78: enum {
                     79: /*
                     80:  Class-specific Requests
                     81: 
                     82: Request        bmRequestType bRequest      wValue  wIndex wLength Data
                     83: ClearHubFeature  0010 0000B CLEAR_FEATURE  Feature Zero    Zero   None
                     84: ClearPortFeature 0010 0011B                Feature Port    Zero   None
                     85: 
                     86: GetBusState      1010 0011B GET_STATE      Zero    Port    One    Port Bus State
                     87: 
                     88: GetHubDescriptor 1010 0000B GET_DESCRIPTOR Type    Zero    Length Descriptor
                     89: 
                     90: GetHubStatus     1010 0000B GET_STATUS     Zero    Zero    Four   Hub Status
                     91: GetPortStatus    1010 0011B                Zero    Port    Four   Port Status
                     92: 
                     93: SetHubDescriptor 0010 0000B SET_DESCRIPTOR Type    Zero    Length Descriptor
                     94: 
                     95: SetHubFeature    0010 0000B SET_FEATURE    Feature Zero    Zero   None
                     96: SetPortFeature   0010 0011B                Feature Port    Zero   None
                     97: */
                     98:     kClearHubFeature
                     99:         = EncodeRequest(kUSBRqClearFeature,  kUSBOut, kUSBClass, kUSBDevice),
                    100:     kClearPortFeature
                    101:         = EncodeRequest(kUSBRqClearFeature,  kUSBOut, kUSBClass, kUSBOther),
                    102:     kGetPortState
                    103:         = EncodeRequest(kUSBRqGetState,      kUSBIn,  kUSBClass, kUSBOther),
                    104:     kGetHubDescriptor
                    105:         = EncodeRequest(kUSBRqGetDescriptor, kUSBIn,  kUSBClass, kUSBDevice),
                    106:     kGetHubStatus
                    107:         = EncodeRequest(kUSBRqGetStatus,     kUSBIn,  kUSBClass, kUSBDevice),
                    108:     kGetPortStatus
                    109:         = EncodeRequest(kUSBRqGetStatus,     kUSBIn,  kUSBClass, kUSBOther),
                    110:     kSetHubDescriptor
                    111:         = EncodeRequest(kUSBRqGetDescriptor, kUSBOut, kUSBClass, kUSBDevice),
                    112:     kSetHubFeature
                    113:         = EncodeRequest(kUSBRqSetFeature,    kUSBOut, kUSBClass, kUSBDevice),
                    114:     kSetPortFeature
                    115:         = EncodeRequest(kUSBRqSetFeature,    kUSBOut, kUSBClass, kUSBOther),
                    116: };
                    117: 
                    118: 
                    119: struct IOUSBHubDescriptor {
                    120:        UInt8   length;
                    121:        UInt8   hubType;
                    122:        UInt8   numPorts;
                    123:         UInt16         characteristics __attribute__((packed));
                    124:        UInt8   powerOnToGood;  /* Port settling time, in 2ms */
                    125:        UInt8   hubCurrent;
                    126: 
                    127:        /* These are received packed, will have to be unpacked */
                    128:        UInt8   removablePortFlags[8];
                    129:        UInt8   pwrCtlPortFlags[8];
                    130: };
                    131: 
                    132: typedef struct IOUSBHubDescriptor IOUSBHubDescriptor;
                    133: 
                    134: struct IOUSBHubStatus {
                    135:     UInt16                     statusFlags;    /* Port status flags */
                    136:     UInt16                     changeFlags;    /* Port changed flags */
                    137: };
                    138: typedef struct IOUSBHubStatus  IOUSBHubStatus;
                    139: typedef IOUSBHubStatus *       IOUSBHubStatusPtr;
                    140: 
                    141: typedef struct IOUSBHubStatus  IOUSBHubPortStatus;
                    142: typedef IOUSBHubPortStatus *   IOUSBHubPortStatusPtr;
                    143: 
                    144: #endif /* _USBHUB_H */

unix.superglobalmegacorp.com

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