Annotation of kernel/bsd/dev/ppc/drvUSBCMD/Library/uslexpert.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:           uslExpert.c
        !            27: 
        !            28:        Contains:       xxx put contents here xxx
        !            29: 
        !            30:        Version:        xxx put version here xxx
        !            31: 
        !            32:        Copyright:      � 1998 by Apple Computer, Inc., all rights reserved.
        !            33: 
        !            34:        File Ownership:
        !            35: 
        !            36:                DRI:                            xxx put dri here xxx
        !            37: 
        !            38:                Other Contact:          xxx put other contact here xxx
        !            39: 
        !            40:                Technology:                     xxx put technology here xxx
        !            41: 
        !            42:        Writers:
        !            43: 
        !            44:                (CJK)   Craig Keithley
        !            45:                (DF)    David Ferguson
        !            46:                (BT)    Barry Twycross
        !            47: 
        !            48:        Change History (most recent first):
        !            49: 
        !            50:          <USB7>         9/28/98        BT              Add device reset function
        !            51:          <USB6>         6/11/98        CJK             add reserved params to USBExpertSetDevicePowerStatus. Wanted to
        !            52:                                                                        get it into the USB.i before freezing C1
        !            53:          <USB5>         6/11/98        BT              Add power state notification message
        !            54:          <USB4>          6/8/98        CJK             add USBExpertSetDevicePowerStatus
        !            55:          <USB3>          6/6/98        DF              Change parameter for USBExpertInstallInterfaceDriver from hubRef
        !            56:                                                                        to deviceRef
        !            57:          <USB2>         5/12/98        BT              New interface handling
        !            58:          <USB1>         4/26/98        BT              first checked in
        !            59: */
        !            60: 
        !            61: //#include <errors.h>
        !            62: #include "../USB.h"
        !            63: #include "../USBpriv.h"
        !            64: #include "../driverservices.h"
        !            65: #include "uslpriv.h"
        !            66: #include "../uimpriv.h"
        !            67: 
        !            68: 
        !            69: static ExpertNotificationProcPtr expert;
        !            70: 
        !            71: void SetExpertFunction(void *exProc)
        !            72: {
        !            73:        expert = exProc;
        !            74: }
        !            75: 
        !            76: OSStatus USBExpertNotify(void *note)
        !            77: {
        !            78:        if(expert == nil)
        !            79:        {
        !            80:                return(kUSBInternalErr);        // make up a not inited err
        !            81:        }
        !            82:        return(*expert)(note);
        !            83: }
        !            84: 
        !            85: OSStatus USBExpertStatus(USBDeviceRef ref, void *pointer, UInt32 value)
        !            86: {
        !            87: ExpertNotificationData note;
        !            88:        note.notification = kNotifyStatus;
        !            89:        note.deviceRef = &ref;
        !            90:        note.data = pointer;
        !            91:        note.info2 = value;
        !            92:        return(USBExpertNotify(&note));
        !            93: }
        !            94: 
        !            95: OSStatus USBExpertFatalError(USBDeviceRef ref, OSStatus status, void *pointer, UInt32 value)
        !            96: {
        !            97: ExpertNotificationData note;
        !            98:        note.notification = kNotifyFatalError;
        !            99:        note.deviceRef = &ref;
        !           100:        note.data = pointer;
        !           101:        note.info1 = status;
        !           102:        note.info2 = value;
        !           103:        return(USBExpertNotify(&note));
        !           104: }
        !           105: 
        !           106: 
        !           107: OSStatus USBExpertInstallInterfaceDriver(USBDeviceRef ref, USBDeviceDescriptor *desc, 
        !           108:                                                        USBInterfaceDescriptor *interface,
        !           109:                                                        USBReference deviceRef, UInt32 busPowerAvailable)
        !           110: {
        !           111: ExpertNotificationData note;
        !           112:        note.notification = kNotifyAddInterface;
        !           113:        note.deviceRef = &ref;
        !           114:        note.data = interface;
        !           115:        note.info1 = deviceRef;
        !           116:        note.info2 = (UInt32) desc;
        !           117:        note.busPowerAvailable = busPowerAvailable;
        !           118:        return(USBExpertNotify(&note));
        !           119: }
        !           120: 
        !           121: OSStatus USBExpertInstallDeviceDriver(USBDeviceRef ref, USBDeviceDescriptor *desc, 
        !           122:                                                        USBReference hubRef, UInt32 port,
        !           123:                                                        UInt32 busPowerAvailable)
        !           124: {
        !           125: ExpertNotificationData note;
        !           126:        note.notification = kNotifyAddDevice;
        !           127:        note.deviceRef = &ref;
        !           128:        note.data = desc;
        !           129:        note.info1 = hubRef;
        !           130:        note.info2 = port;
        !           131:        note.busPowerAvailable = busPowerAvailable;
        !           132:        return(USBExpertNotify(&note));
        !           133: }
        !           134: 
        !           135: OSStatus USBExpertRemoveDeviceDriver(USBDeviceRef ref)
        !           136: {
        !           137: ExpertNotificationData note;
        !           138:        note.notification = kNotifyRemoveDevice;
        !           139:        note.deviceRef = &ref;
        !           140:        return(USBExpertNotify(&note));
        !           141: }
        !           142: 
        !           143: OSStatus USBExpertRemoveInterfaceDriver(USBDeviceRef ref)
        !           144: {
        !           145: ExpertNotificationData note;
        !           146:        note.notification = kNotifyRemoveInterface;
        !           147:        note.deviceRef = &ref;
        !           148:        return(USBExpertNotify(&note));
        !           149: }
        !           150: 
        !           151: OSStatus USBExpertSetDevicePowerStatus(USBDeviceRef ref, UInt32 reserved1, UInt32 reserved2, UInt32 powerStatus, UInt32 busPowerAvailable, UInt32 busPowerNeeded )
        !           152: {
        !           153: #pragma unused (reserved1)
        !           154: #pragma unused (reserved2)
        !           155: 
        !           156: ExpertNotificationData note;
        !           157:        note.notification = kNotifyPowerState;
        !           158:        note.deviceRef = &ref;
        !           159:        note.info1 = powerStatus;
        !           160:        note.busPowerAvailable = busPowerAvailable;
        !           161:        note.info2 = busPowerNeeded;
        !           162:        USBExpertStatus(0,"USL - sending power note to expert", powerStatus);
        !           163: 
        !           164:        return(USBExpertNotify(&note));
        !           165: }
        !           166: 
        !           167: OSStatus USBExpertNotifyParentMsg(USBReference reference, void *pointer)
        !           168: {
        !           169: ExpertNotificationData note;
        !           170: 
        !           171:        note.notification = kNotifyParentNotify;
        !           172:        note.deviceRef = &reference;
        !           173:        note.data = pointer;
        !           174:        return(USBExpertNotify(&note));
        !           175: }
        !           176: 

unix.superglobalmegacorp.com

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