Annotation of XNU/iokit/Families/IOUSBBus/IOUSBHub.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: /*
        !            23:  * Copyright (c) 1998 Apple Computer, Inc.  All rights reserved.
        !            24:  *
        !            25:  * HISTORY
        !            26:  *
        !            27:  */
        !            28: 
        !            29: 
        !            30: #ifndef _IOKIT_IOUSBHUB_H
        !            31: #define _IOKIT_IOUSBHUB_H
        !            32: 
        !            33: #include <IOKit/IOLib.h>
        !            34: #include <IOKit/IOService.h>
        !            35: #include <IOKit/IOBufferMemoryDescriptor.h>
        !            36: 
        !            37: #include <IOKit/usb/USB.h>
        !            38: #include <IOKit/usb/USBHub.h>
        !            39: 
        !            40: enum{
        !            41:       kErrataCaptiveOK = 1
        !            42: };
        !            43: 
        !            44: 
        !            45: class IOUSBController;
        !            46: class IOUSBDevice;
        !            47: class IOUSBInterface;
        !            48: class IOUSBPipe;
        !            49: 
        !            50: class IOUSBHub : public IOService
        !            51: {
        !            52:     OSDeclareDefaultStructors(IOUSBHub)
        !            53: 
        !            54:     friend class               IOUSBHubPort;
        !            55: 
        !            56:     IOUSBController *          _bus;
        !            57:     IOUSBDevice *              _device;
        !            58:     IOUSBInterface *           _hubInterface;
        !            59:     IOUSBConfigurationDescriptor *_configDescriptor;
        !            60:     IOUSBHubDescriptor         _hubDescriptor;
        !            61:     USBDeviceAddress                   _address;
        !            62:     IOUSBHubStatus             _hubStatus;
        !            63:     IOUSBPipe *                _interruptPipe;
        !            64:     IOBufferMemoryDescriptor * _buffer;
        !            65: 
        !            66:     // Power stuff
        !            67:     bool                       _busPowered;
        !            68:     bool                       _selfPowered;
        !            69:     bool                       _busPowerGood;
        !            70:     bool                               _selfPowerGood;
        !            71:     UInt32                     _powerForCaptive;
        !            72: 
        !            73:     // Port stuff
        !            74:     IOUSBHubPort **            _ports;         // Allocated at runtime
        !            75:     UInt8                      _numCaptive;
        !            76: 
        !            77:     UInt32                     _errataBits;
        !            78: 
        !            79: public:
        !            80: 
        !            81:     bool               init(OSDictionary * propTable );
        !            82:     virtual bool       start(IOService * provider);
        !            83:     virtual void       stop(IOService *  provider);
        !            84: 
        !            85:     // Hub functions
        !            86:     void       UnpackPortFlags(void);
        !            87:     void       CountCaptivePorts(void);
        !            88:     bool       CheckPortPowerRequirements(void);
        !            89:     bool       AllocatePortMemory(void);
        !            90:     bool       StartPorts(void);
        !            91:     bool       StopPorts(void);
        !            92:     bool       StartHandler(void);
        !            93:     bool       statusChanged(void);
        !            94:     const UInt8 * getStatusChanged(void);
        !            95: 
        !            96:     IOReturn   GetHubDescriptor(IOUSBHubDescriptor *desc);
        !            97:     IOReturn   GetHubStatus(IOUSBHubStatus *status);
        !            98:     IOReturn   ClearHubFeature(UInt16 feature);
        !            99: 
        !           100:     IOReturn   GetPortStatus(IOUSBHubPortStatus *status, UInt16 port);
        !           101:     IOReturn   GetPortState(UInt8 *state, UInt16 port);
        !           102:     IOReturn   SetPortFeature(UInt16 feature, UInt16 port);
        !           103:     IOReturn   ClearPortFeature(UInt16 feature, UInt16 port);
        !           104: 
        !           105:     void PrintHubDescriptor(IOUSBHubDescriptor *desc);
        !           106: 
        !           107:     void       fatalError(IOReturn err, char *str);
        !           108: };
        !           109: 
        !           110: /*****************************************************
        !           111:  * Port Stuff
        !           112:  *****************************************************/
        !           113: 
        !           114: 
        !           115: typedef IOReturn (IOUSBHubPort::*ChangeHandlerFuncPtr)(UInt16 changeFlags);
        !           116: 
        !           117: 
        !           118: typedef struct {
        !           119:     ChangeHandlerFuncPtr handler;
        !           120:     UInt32 bit;
        !           121:     UInt32 clearFeature;
        !           122: } portStatusChangeVector;
        !           123: 
        !           124: enum{
        !           125:     kNumChangeHandlers = 5
        !           126: };
        !           127: 
        !           128: 
        !           129: class IOUSBHubPort
        !           130: {
        !           131:     IOUSBController            *_bus;
        !           132:     IOUSBHub                   *_hub;
        !           133:     IOUSBHubDescriptor         *_hubDesc;
        !           134:     IOUSBDevice                        *_portDevice;
        !           135:     bool                       _devZero;
        !           136: 
        !           137:     portStatusChangeVector     _changeHandler[kNumChangeHandlers];
        !           138: 
        !           139: public:
        !           140: 
        !           141:     IOUSBDeviceDescriptor      _desc;
        !           142:     UInt8                      _speed; // 1 = kUSBLowSpeed, 0 = kUSBHighSpeed
        !           143:     UInt32                     _portPowerAvailable;
        !           144: 
        !           145:     int                        _portNum;
        !           146: 
        !           147:     void        init(IOUSBHub *        parent,
        !           148:                      int       portNum,
        !           149:                      UInt32    powerAvailable);
        !           150:     IOReturn   start(void);
        !           151:     void       stop(void);
        !           152: 
        !           153:     IOReturn addDevice(void);
        !           154:     void removeDevice(void);
        !           155: 
        !           156:     // Reset the device, then restore the old address
        !           157:     IOReturn resetDevice();
        !           158: 
        !           159:     bool statusChanged(void);
        !           160:     IOReturn statusChangeHandler(UInt16 changeFlags);
        !           161: 
        !           162:     void initPortVectors(void);
        !           163:     void setPortVector(ChangeHandlerFuncPtr    routine,
        !           164:                        UInt32                  condition);
        !           165:     IOReturn defaultOverCrntChangeHandler(UInt16 changeFlags);
        !           166:     IOReturn defaultResetChangeHandler(UInt16 changeFlags);
        !           167:     IOReturn defaultSuspendChangeHandler(UInt16 changeFlags);
        !           168:     IOReturn defaultEnableChangeHandler(UInt16 changeFlags);
        !           169:     IOReturn defaultConnectionChangeHandler(UInt16 changeFlags);
        !           170:     IOReturn addDeviceResetChangeHandler(UInt16 changeFlags);
        !           171:     IOReturn handleResetDevice(UInt16 changeFlags);
        !           172: 
        !           173:     void fatalError(IOReturn err, char *str);
        !           174: };
        !           175: 
        !           176: #endif _IOKIT_IOUSBHUB_H

unix.superglobalmegacorp.com

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