Annotation of kernel/bsd/dev/ppc/drvUSBCMD/HubClassDriver/HubDriverShell1.c, revision 1.1

1.1     ! root        1: /*
        !             2:  * Copyright (c) 1999 Apple Computer, Inc. All rights reserved.
        !             3:  *
        !             4:  * @APPLE_LICENSE_HEADER_START@
        !             5:  * 
        !             6:  * Portions Copyright (c) 1999 Apple Computer, Inc.  All Rights
        !             7:  * Reserved.  This file contains Original Code and/or Modifications of
        !             8:  * Original Code as defined in and that are subject to the Apple Public
        !             9:  * Source License Version 1.1 (the "License").  You may not use this file
        !            10:  * except in compliance with the License.  Please obtain a copy of the
        !            11:  * License at http://www.apple.com/publicsource and read it before using
        !            12:  * this file.
        !            13:  * 
        !            14:  * The Original Code and all software distributed under the License are
        !            15:  * distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY KIND, EITHER
        !            16:  * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
        !            17:  * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
        !            18:  * FITNESS FOR A PARTICULAR PURPOSE OR NON-INFRINGEMENT.  Please see the
        !            19:  * License for the specific language governing rights and limitations
        !            20:  * under the License.
        !            21:  * 
        !            22:  * @APPLE_LICENSE_HEADER_END@
        !            23:  */
        !            24: 
        !            25: /*
        !            26:        File:           HubDriverShell.c
        !            27: 
        !            28:        Contains:       Toms wrapper for BT's hub driver. Just the header block etc
        !            29: 
        !            30:        Version:        Neptune 1.0
        !            31: 
        !            32:        Copyright:      � 1997-1998 by Apple Computer, Inc., all rights reserved.
        !            33: 
        !            34:        File Ownership:
        !            35: 
        !            36:                DRI:                            Barry Twycross
        !            37: 
        !            38:                Other Contact:          xxx put other contact here xxx
        !            39: 
        !            40:                Technology:                     USB
        !            41: 
        !            42:        Writers:
        !            43: 
        !            44:                (TC)    Tom Clark
        !            45:                (CJK)   Craig Keithley
        !            46:                (BT)    Barry Twycross
        !            47: 
        !            48:        Change History (most recent first):
        !            49: 
        !            50:          <USB9>         9/10/98        BT              Add are we finished
        !            51:          <USB8>          9/4/98        TC              Update hubDriverNotifyProc to use version 1.1 of dispatch table.
        !            52:          <USB7>         4/14/98        BT              Do removed devices when killed
        !            53:          <USB6>         4/11/98        CJK             remove usbpriv.h include
        !            54:          <USB5>          4/9/98        BT              Use USB.h
        !            55:                 <4>      3/6/98        CJK             get version info from HubClassVersion.h
        !            56:                 <3>     2/25/98        BT              Add Apple Vendor cods.
        !            57:                 <2>     2/24/98        BT              Change Apple vendor ID.
        !            58:                 <1>     2/24/98        BT              first checked in
        !            59:           <15*>         2/19/98        BT              Add debbugger
        !            60:                <15>      2/8/98        BT              Power allocation stuff
        !            61:                <14>      2/6/98        BT              Power allocation stuff
        !            62:                <13>      2/4/98        BT              Clean up after TOms changes
        !            63:                <12>      2/3/98        TC              Update to use latest DispatchTable definition.
        !            64:                <11>      2/2/98        TC              Make vendor,product & version match root hub simulator
        !            65:                <10>     1/26/98        CJK             Change to use USBDeviceDescriptor (instead of just
        !            66:                                                                        devicedescriptor)
        !            67:                 <9>     1/26/98        BT              Fix name changes
        !            68:                 <8>     1/26/98        BT              Mangle names after design review
        !            69:                 <7>     1/15/98        CJK             Change include of USL.h to USBServicesLib.h
        !            70:                 <6>     1/14/98        BT              Change to USBClassDriver.h
        !            71:                 <5>     1/13/98        BT              Making timers internal
        !            72:                 <4>    12/18/97        BT              Changes to dispatch table. Add notify and tickle
        !            73:                 <3>    12/17/97        CJK             Change to use USBDeviceDefines for Class & Subclass values.
        !            74:                 <2>    12/17/97        BT              Add file header
        !            75:                 <1>    12/17/97        BT              First time checkin
        !            76: */
        !            77: 
        !            78: #include <Types.h>
        !            79: #include <Devices.h>
        !            80: #include <DriverServices.h>
        !            81: 
        !            82: #include <USB.h>
        !            83: #include "hub.h"
        !            84: #include "HubClassVersion.h"
        !            85: 
        !            86: //------------------------------------------------------
        !            87: //
        !            88: // Protos
        !            89: //
        !            90: //------------------------------------------------------
        !            91: static OSStatus hubDriverValidateHW(USBDeviceRef device, USBDeviceDescriptorPtr pDesc);
        !            92: static OSStatus hubDriverInitialize(USBDeviceRef device, USBDeviceDescriptorPtr pDesc,
        !            93:                                                                        UInt32 busPowerAvailable);
        !            94: static OSStatus hubDriverInitInterface(
        !            95:                        UInt32                                          interfaceNum, 
        !            96:                        USBInterfaceDescriptorPtr       pInterface, 
        !            97:                        USBDeviceDescriptorPtr          pDevice, 
        !            98:                        USBDeviceRef                            device);
        !            99: static OSStatus hubDriverFinalize(USBDeviceRef device, USBDeviceDescriptorPtr pDesc);
        !           100: static OSStatus        hubDriverNotifyProc(UInt32      notification, void *pointer, UInt32 refcon);
        !           101: 
        !           102: //------------------------------------------------------
        !           103: //
        !           104: //     This is the driver description structure that the expert looks for first.
        !           105: //  If it's here, the information within is used to match the driver
        !           106: //  to the device whose descriptor was passed to the expert.
        !           107: //     Information in this block is also used by the expert when an
        !           108: //  entry is created in the Name Registry.
        !           109: //
        !           110: //------------------------------------------------------
        !           111: USBDriverDescription   TheUSBDriverDescription = 
        !           112: {
        !           113:        // Signature info
        !           114:        kTheUSBDriverDescriptionSignature,
        !           115:        kInitialUSBDriverDescriptor,
        !           116:        
        !           117:        // Device Info
        !           118:        1452,                                                                   // vendor = Apple (1452 decimal, swapped)
        !           119:        0x8001,                                                                 // product = CMD chip
        !           120:        0x0001,                                                                 // version of product = 1.00 (swapped)
        !           121:        0,                                                                              // protocol = not device specific
        !           122:        
        !           123:        // Interface Info       (* I don't think this would always be required...*)                             
        !           124:        0,                                                                              // Configuration Value
        !           125:        0,                                                                              // Interface Number
        !           126:        0,                                                                              // Interface Class
        !           127:        0,                                                                              // Interface SubClass
        !           128:        0,                                                                              // Interface Protocol
        !           129:                
        !           130:        
        !           131:        // Driver Info
        !           132:        "\pUSBHub1Apple",                                               // Driver name for Name Registry
        !           133:        kUSBHubClass,                                                   // Device Class  (from USBDeviceDefines.h)
        !           134:        kUSBHubSubClass,                                                // Device Subclass 
        !           135:        kHUBHexMajorVers, 
        !           136:        kHUBHexMinorVers, 
        !           137:        kHUBCurrentRelease, 
        !           138:        kHUBReleaseStage,                                               // version of driver
        !           139:        
        !           140:        // Driver Loading Info
        !           141:        0 //kUSBDoNotMatchGenericDevice                 // Flags (currently undefined)
        !           142: };
        !           143: 
        !           144:        
        !           145: USBClassDriverPluginDispatchTable TheClassDriverPluginDispatchTable =
        !           146: {
        !           147:        kClassDriverPluginVersion,                              // Version of this structure
        !           148:        hubDriverValidateHW,                                    // Hardware Validation Procedure
        !           149:        hubDriverInitialize,                                    // Initialization Procedure
        !           150:        hubDriverInitInterface,                                 // Interface Initialization Procedure
        !           151:        hubDriverFinalize,                                              // Finalization Procedure
        !           152:        hubDriverNotifyProc,                                    // Driver Notification Procedure
        !           153: };
        !           154: 
        !           155: // Hardware Validation
        !           156: // Called upon load by Expert
        !           157: OSStatus hubDriverValidateHW(USBDeviceRef device, USBDeviceDescriptor *desc)
        !           158: {
        !           159:        device = 0;
        !           160:        desc = 0;
        !           161:        return (OSStatus)noErr;
        !           162: }
        !           163: 
        !           164: // Initialization function
        !           165: // Called upon load by Expert
        !           166: static OSStatus hubDriverInitialize(USBDeviceRef device, USBDeviceDescriptorPtr pDesc,
        !           167:                                                                        UInt32 busPowerAvailable)
        !           168: {
        !           169:        HubDriverEntry(device, pDesc, busPowerAvailable);
        !           170:        return (OSStatus)noErr;
        !           171: }
        !           172: 
        !           173: 
        !           174: // hubDriverInitInterface function
        !           175: // Called to initialize driver for an individual interface - either by expert or
        !           176: // internally by driver
        !           177: OSStatus hubDriverInitInterface(
        !           178:                        UInt32                                          interfaceNum, 
        !           179:                        USBInterfaceDescriptor          *interfaceDesc, 
        !           180:                        USBDeviceDescriptor                     *deviceDesc, 
        !           181:                        USBDeviceRef                            device)
        !           182: {
        !           183:        interfaceNum = 0;
        !           184:        interfaceDesc = 0;
        !           185:        deviceDesc = 0;
        !           186:        device = 0;
        !           187:        
        !           188:        return (OSStatus)noErr;
        !           189: }
        !           190: 
        !           191: 
        !           192: // Termination function
        !           193: // Called by Expert when driver is being shut down
        !           194: OSStatus hubDriverFinalize(USBDeviceRef device, USBDeviceDescriptorPtr pDesc)
        !           195: {
        !           196:        pDesc = 0;      // Not used, saves message
        !           197:        return(killHub(device));
        !           198: }
        !           199: 
        !           200: 
        !           201: static OSStatus        hubDriverNotifyProc(UInt32      notification, void *pointer, UInt32 refcon)
        !           202: {
        !           203: OSStatus       status = noErr;
        !           204: 
        !           205:        switch (notification)
        !           206:        {
        !           207:                case kNotifyDriverBeingRemoved:
        !           208:                        break;
        !           209:                case kNotifyHubEnumQuery:
        !           210:                                return(HubAreWeFinishedYet());
        !           211:                        break;
        !           212:                default:
        !           213:                        break;
        !           214:        
        !           215:        
        !           216:        } // switch
        !           217:        
        !           218:        pointer = 0;
        !           219:        refcon = 0;
        !           220:        return(status);
        !           221: }

unix.superglobalmegacorp.com

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