Annotation of kernel/bsd/dev/ppc/drvUSBCMD/kbd/KeyboardModuleHeader.c, revision 1.1.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:           KeyboardModuleHeader.c
                     27: 
                     28:        Contains:       Keyboard Module Header file
                     29: 
                     30:        Version:        xxx put version here xxx
                     31: 
                     32:        Copyright:      � 1997-1998 by Apple Computer, Inc., all rights reserved.
                     33: 
                     34:        File Ownership:
                     35: 
                     36:                DRI:                            Craig Keithley
                     37: 
                     38:                Other Contact:          xxx put other contact here xxx
                     39: 
                     40:                Technology:                     xxx put technology here xxx
                     41: 
                     42:        Writers:
                     43: 
                     44:                (TC)    Tom Clark
                     45:                (CJK)   Craig Keithley
                     46: 
                     47:        Change History (most recent first):
                     48: 
                     49:         <USB12>         6/17/98        CJK             add pipe abort in finalize
                     50:         <USB11>         6/11/98        CJK             change display of status to display of interfaceRef (in finalize
                     51:                                                                        routine)
                     52:         <USB10>         6/11/98        CJK             investigate interface driver load time call of routines
                     53:          <USB9>          6/8/98        CJK             deallocation of full configuration structure
                     54:          <USB8>         5/20/98        CJK             change target name from USBKeyboardModule to
                     55:                                                                        USBHIDKeyboardModule
                     56:          <USB7>         4/27/98        TC              Implement a USBDriverLoadingOption to enforce protocol matching.
                     57:          <USB6>          4/9/98        CJK             remove include of USBDeviceDefines.h
                     58:                 <5>     3/17/98        CJK             fix pragma unuseds (MW needs parens around the variable name).
                     59:                 <4>      3/5/98        CJK             use version info defined in KeyboardModuleVersion.h
                     60:                 <3>      3/2/98        CJK             remove include of KBDHIDEmulation.h
                     61:                 <2>     2/10/98        CJK             Correct change history (to reflect the keyboard module changes)
                     62:                 <1>     2/10/98        CJK             First time check in.  Cloned from Mouse HID Module.
                     63: */
                     64: 
                     65: //#include <Types.h>
                     66: //#include <Devices.h>
                     67: #include "../driverservices.h"
                     68: #include "../USB.h"
                     69: 
                     70: #include "KeyboardModule.h"
                     71: #include "KeyboardModuleVersion.h"
                     72: 
                     73: static         OSStatus        KeyboardModuleInitialize (USBDeviceRef device, USBDeviceDescriptorPtr pDesc, UInt32 busPowerAvailable);
                     74: static         OSStatus        KeyboardModuleFinalize(USBDeviceRef device, USBDeviceDescriptorPtr pDesc);
                     75: static         OSStatus        KeyboardInterfaceInitialize (UInt32 interfacenum, USBInterfaceDescriptorPtr pInterface, USBDeviceDescriptorPtr pDesc, USBDeviceRef device);
                     76: 
                     77: extern usbKeyboardPBStruct myKeyboardPB;
                     78: 
                     79: //------------------------------------------------------
                     80: //
                     81: //     This is the driver description structure that the expert looks for first.
                     82: //  If it's here, the information within is used to match the driver
                     83: //  to the device whose descriptor was passed to the expert.
                     84: //     Information in this block is also used by the expert when an
                     85: //  entry is created in the Name Registry.
                     86: //
                     87: //------------------------------------------------------
                     88: USBDriverDescription   TheUSBDriverDescription = 
                     89: {
                     90:        // Signature info
                     91:        kTheUSBDriverDescriptionSignature,
                     92:        kInitialUSBDriverDescriptor,
                     93:        
                     94:        // Device Info
                     95:        0,                                                                              // vendor = not device specific
                     96:        0,                                                                              // product = not device specific
                     97:        0,                                                                              // version of product = not device specific
                     98:        kUSBKeyboardInterfaceProtocol,                          // protocol = not device specific
                     99:        
                    100:        // Interface Info       (* I don't think this would always be required...*)                             
                    101:        0,                                                                              // Configuration Value
                    102:        0,                                                                              // Interface Number
                    103:        kUSBHIDInterfaceClass,                                  // Interface Class
                    104:        kUSBBootInterfaceSubClass,                              // Interface SubClass
                    105:        kUSBKeyboardInterfaceProtocol,                          // Interface Protocol
                    106:                
                    107:        
                    108:        // Driver Info
                    109:        "USBHIDKeyboardModule",                         // Driver name for Name Registry
                    110:        kUSBHIDInterfaceClass,                                  // Device Class  (from USBDeviceDefines.h)
                    111:        kUSBBootInterfaceSubClass,                              // Device Subclass 
                    112:        kKBDHexMajorVers, 
                    113:        kKBDHexMinorVers, 
                    114:        kKBDCurrentRelease, 
                    115:        kKBDReleaseStage,                                               // version of driver
                    116:        
                    117:        // Driver Loading Info
                    118:        kUSBProtocolMustMatch                                   // Flags 
                    119: };
                    120: /*naga
                    121: USBClassDriverPluginDispatchTable TheClassDriverPluginDispatchTable =
                    122: {
                    123:        kClassDriverPluginVersion,                              // Version of this structure
                    124:        0,                                                                              // Hardware Validation Procedure
                    125:        KeyboardModuleInitialize,                                       // Initialization Procedure
                    126:        KeyboardInterfaceInitialize,                            // Interface Initialization Procedure
                    127:        KeyboardModuleFinalize,                                 // Finalization Procedure
                    128:        0,                                                                              // Driver Notification Procedure
                    129: };
                    130:        
                    131: */
                    132:        
                    133: // Initialization function
                    134: // Called upon load by Expert
                    135: static         OSStatus        KeyboardModuleInitialize (USBDeviceRef device, USBDeviceDescriptorPtr pDesc, UInt32 busPowerAvailable)
                    136: {
                    137: #pragma unused (busPowerAvailable)
                    138: #pragma unused (pDesc)
                    139:        USBExpertStatus(device, "USBHIDKeyboardModule: Entered via KeyboardModuleInitialize", device);
                    140:        return (OSStatus)noErr;
                    141: }
                    142: 
                    143: // Interface Initialization Initialization function
                    144: // Called upon load by Expert
                    145: static         OSStatus        KeyboardInterfaceInitialize (UInt32 interfacenum, USBInterfaceDescriptorPtr pInterface, USBDeviceDescriptorPtr pDesc, USBDeviceRef device)
                    146: {
                    147:        InterfaceEntry(interfacenum, pInterface, pDesc, device);
                    148:        return (OSStatus)noErr;
                    149: }
                    150: 
                    151: 
                    152: 
                    153: // Termination function
                    154: // Called by Expert when driver is being shut down
                    155: static OSStatus KeyboardModuleFinalize(USBDeviceRef theDeviceRef, USBDeviceDescriptorPtr pDesc)
                    156: {
                    157: #pragma unused (pDesc)
                    158: 
                    159: OSStatus myErr;
                    160: 
                    161:        USBExpertStatus(theDeviceRef, "USBHIDKeyboardModule: Finalize", theDeviceRef);
                    162:        if (myKeyboardPB.pFullConfigDescriptor != nil)
                    163:        {
                    164:                if (myKeyboardPB.pipeRef)
                    165:                {
                    166:                        USBExpertStatus(theDeviceRef, "USBHIDKeyboardModule: Aborting interrupt pipe", theDeviceRef);
                    167:                        USBAbortPipeByReference(myKeyboardPB.pipeRef);
                    168:                }
                    169:                        
                    170:                myKeyboardPB.pb.usbReference = theDeviceRef;
                    171:                myKeyboardPB.pb.pbVersion = kUSBCurrentPBVersion;
                    172:                myKeyboardPB.pb.usbFlags = 0;
                    173:                myKeyboardPB.pb.usbRefcon = 0;                  
                    174:                myKeyboardPB.pb.usbBuffer = myKeyboardPB.pFullConfigDescriptor;         
                    175:                myKeyboardPB.pb.usbCompletion = (USBCompletion)-1;
                    176:                
                    177:                myErr = USBDeallocMem(&myKeyboardPB.pb);
                    178:        };
                    179:        return (OSStatus)noErr;
                    180: }
                    181: 

unix.superglobalmegacorp.com

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