|
|
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: <USB6> 9/10/98 BT Add are we finished
51: <USB5> 9/4/98 TC Hack to test DriverNotify.
52: <USB4> 4/14/98 BT Do removed devices when killed
53: <USB3> 4/9/98 BT Use USB.h
54: <2> 3/6/98 CJK change to get driver version number from version.h
55: <1> 2/24/98 BT first checked in
56: <15*> 2/19/98 BT Add debbugger
57: <15> 2/8/98 BT Power allocation stuff
58: <14> 2/6/98 BT Power allocation stuff
59: <13> 2/4/98 BT Clean up after TOms changes
60: <12> 2/3/98 TC Update to use latest DispatchTable definition.
61: <11> 2/2/98 TC Make vendor,product & version match root hub simulator
62: <10> 1/26/98 CJK Change to use USBDeviceDescriptor (instead of just
63: devicedescriptor)
64: <9> 1/26/98 BT Fix name changes
65: <8> 1/26/98 BT Mangle names after design review
66: <7> 1/15/98 CJK Change include of USL.h to USBServicesLib.h
67: <6> 1/14/98 BT Change to USBClassDriver.h
68: <5> 1/13/98 BT Making timers internal
69: <4> 12/18/97 BT Changes to dispatch table. Add notify and tickle
70: <3> 12/17/97 CJK Change to use USBDeviceDefines for Class & Subclass values.
71: <2> 12/17/97 BT Add file header
72: <1> 12/17/97 BT First time checkin
73: */
74:
75: #include <Types.h>
76: #include <Devices.h>
77: #include <DriverServices.h>
78:
79: #include <USB.h>
80: #include "hub.h"
81: #include "HubClassVersion.h"
82:
83: //------------------------------------------------------
84: //
85: // Protos
86: //
87: //------------------------------------------------------
88: static OSStatus hubDriverValidateHW(USBDeviceRef device, USBDeviceDescriptorPtr pDesc);
89: static OSStatus hubDriverInitialize(USBDeviceRef device, USBDeviceDescriptorPtr pDesc,
90: UInt32 busPowerAvailable);
91: static OSStatus hubDriverInitInterface(
92: UInt32 interfaceNum,
93: USBInterfaceDescriptorPtr pInterface,
94: USBDeviceDescriptorPtr pDevice,
95: USBDeviceRef device);
96: static OSStatus hubDriverFinalize(USBDeviceRef device, USBDeviceDescriptorPtr pDesc);
97: static OSStatus hubDriverNotifyProc(UInt32 notification, void *pointer, UInt32 refcon);
98:
99: //------------------------------------------------------
100: //
101: // This is the driver description structure that the expert looks for first.
102: // If it's here, the information within is used to match the driver
103: // to the device whose descriptor was passed to the expert.
104: // Information in this block is also used by the expert when an
105: // entry is created in the Name Registry.
106: //
107: //------------------------------------------------------
108: USBDriverDescription TheUSBDriverDescription =
109: {
110: // Signature info
111: kTheUSBDriverDescriptionSignature,
112: kInitialUSBDriverDescriptor,
113:
114: // Device Info
115: 0x03e8, // vendor = Atmel
116: 0x3312, // product, hub in Yosemite
117: 0x0001, // version of product
118: 0, // protocol = not device specific
119:
120: // Interface Info (* I don't think this would always be required...*)
121: 0, // Configuration Value
122: 0, // Interface Number
123: 0, // Interface Class
124: 0, // Interface SubClass
125: 0, // Interface Protocol
126:
127:
128: // Driver Info
129: "\pUSBHub0Apple", // Driver name for Name Registry
130: kUSBHubClass, // Device Class (from USBDeviceDefines.h)
131: 0, // Device Subclass (for hubs that use zero)
132: kHUBHexMajorVers,
133: kHUBHexMinorVers,
134: kHUBCurrentRelease,
135: kHUBReleaseStage, // version of driver
136:
137: // Driver Loading Info
138: 0 //kUSBDoNotMatchGenericDevice // Flags (currently undefined)
139: };
140:
141:
142: USBClassDriverPluginDispatchTable TheClassDriverPluginDispatchTable =
143: {
144: kClassDriverPluginVersion, // Version of this structure
145: hubDriverValidateHW, // Hardware Validation Procedure
146: hubDriverInitialize, // Initialization Procedure
147: hubDriverInitInterface, // Interface Initialization Procedure
148: hubDriverFinalize, // Finalization Procedure
149: hubDriverNotifyProc, // Driver Notification Procedure
150: };
151:
152: // Hardware Validation
153: // Called upon load by Expert
154: OSStatus hubDriverValidateHW(USBDeviceRef device, USBDeviceDescriptor *desc)
155: {
156: device = 0;
157: desc = 0;
158: return (OSStatus)noErr;
159: }
160:
161: // Initialization function
162: // Called upon load by Expert
163: static OSStatus hubDriverInitialize(USBDeviceRef device, USBDeviceDescriptorPtr pDesc,
164: UInt32 busPowerAvailable)
165: {
166: HubDriverEntry(device, pDesc, busPowerAvailable);
167: return (OSStatus)noErr;
168: }
169:
170:
171: // hubDriverInitInterface function
172: // Called to initialize driver for an individual interface - either by expert or
173: // internally by driver
174: OSStatus hubDriverInitInterface(
175: UInt32 interfaceNum,
176: USBInterfaceDescriptor *interfaceDesc,
177: USBDeviceDescriptor *deviceDesc,
178: USBDeviceRef device)
179: {
180: interfaceNum = 0;
181: interfaceDesc = 0;
182: deviceDesc = 0;
183: device = 0;
184:
185: return (OSStatus)noErr;
186: }
187:
188:
189: // Termination function
190: // Called by Expert when driver is being shut down
191: OSStatus hubDriverFinalize(USBDeviceRef device, USBDeviceDescriptorPtr pDesc)
192: {
193: pDesc = 0; // Not used, saves message
194: return(killHub(device));
195: }
196:
197:
198: static OSStatus hubDriverNotifyProc(UInt32 notification, void *pointer, UInt32 refcon)
199: {
200: OSStatus status = noErr;
201:
202: switch (notification)
203: {
204: case kNotifyDriverBeingRemoved:
205: break;
206: case kNotifyHubEnumQuery:
207: return(HubAreWeFinishedYet());
208: break;
209: default:
210: break;
211:
212:
213: } // switch
214:
215: pointer = 0;
216: refcon = 0;
217: return(status);
218: }
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.