1/* 2 * 3 * @APPLE_LICENSE_HEADER_START@ 4 * 5 * Copyright (c) 1998-2003 Apple Computer, Inc. All Rights Reserved. 6 * 7 * This file contains Original Code and/or Modifications of Original Code 8 * as defined in and that are subject to the Apple Public Source License 9 * Version 2.0 (the 'License'). You may not use this file except in 10 * compliance with the License. Please obtain a copy of the License at 11 * http://www.opensource.apple.com/apsl/ and read it before using this 12 * 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, QUIET ENJOYMENT OR NON-INFRINGEMENT. 19 * Please see the License for the specific language governing rights and 20 * limitations under the License. 21 * 22 * @APPLE_LICENSE_HEADER_END@ 23 */ 24 25 /*AppleUSBCDC.h - This file contains the class definition for the */ 26 /* USB Communication Device Class (CDC) driver */ 27 28class AppleUSBCDC : public IOService 29{ 30 OSDeclareDefaultStructors(AppleUSBCDC); // Constructor & Destructor stuff 31 32private: 33 bool fTerminate; // Are we being terminated (ie the device was unplugged) 34 bool fStopping; // Are we being "stopped" 35// UInt8 fCDCInterfaceNumber; // CDC interface number (the first one found) 36 UInt8 fConfig; // The current Configuration value 37 IOCommandGate *fCommandGate; 38 IOWorkLoop *fWorkLoop; 39 40public: 41 42 IOUSBDevice *fpDevice; 43 UInt8 fbmAttributes; 44 UInt8 fCacheEaddr[6]; 45 UInt8 fDevClass; 46 UInt8 fDevSubClass; 47 UInt8 fDevProtocol; 48 bool fIAD; // Set if we're looking at a device with an IAD descriptor 49 UInt8 bFirstInterface; // First Interface if MBIM 50 UInt8 bInterfaceCount; // Number of Interfaces that make up this function (Per the Spec Number of **contiguous** interfaces that are associated with this function.) 51 52 UInt8 fDataInterfaceNumber; // Data interface number (if there's only one) 53 54 // IOKit methods 55 56 virtual IOService *probe(IOService *provider, SInt32 *score); 57 virtual bool start(IOService *provider); 58 virtual void free(void); 59 virtual void stop(IOService *provider); 60 virtual IOReturn message(UInt32 type, IOService *provider, void *argument = 0); 61 virtual IOReturn setProperties( OSObject * properties ); 62 static IOReturn setPropertiesAction( OSObject *owner,void *arg1, void *arg2,void *arg3,void *arg4 ); 63 virtual IOReturn setPropertiesWL( OSObject * properties ); 64 virtual IOCommandGate *getCommandGate() const; 65 66 // CDC Driver Methods 67 68 UInt8 Asciihex_to_binary(char c); 69 virtual IOUSBDevice *getCDCDevice(void); 70 bool checkDevice(IOUSBDevice *theDevice); 71 bool initDevice(UInt8 numConfigs); 72 virtual IOReturn reInitDevice(void); 73 bool checkACM(IOUSBInterface *Comm, UInt8 cInterfaceNumber, UInt8 dataInterfaceNum); 74 bool checkECM(IOUSBInterface *Comm, UInt8 cInterfaceNumber, UInt8 dataInterfaceNum); 75 bool checkWMC(IOUSBInterface *Comm, UInt8 cInterfaceNumber, UInt8 dataInterfaceNum); 76 bool checkDMM(IOUSBInterface *Comm, UInt8 cInterfaceNumber, UInt8 dataInterfaceNum); 77 bool checkMBIM(IOUSBInterface *Comm, UInt8 cInterfaceNumber, UInt8 dataInterfaceNum); 78 virtual bool confirmDriver(UInt8 subClass, UInt8 dataInterface); 79 virtual bool confirmControl(UInt8 subClass, IOUSBInterface *CInterface); 80 81}; /* end class */