#ifndef __APPLEUSBCDCWCM__
#define __APPLEUSBCDCWCM__
#include "AppleUSBCDCCommon.h"
#define LDEBUG 0 // for debugging
#define USE_ELG 0 // to Event LoG (via kprintf and Firewire) - LDEBUG must also be set
#define USE_IOL 0 // to IOLog - LDEBUG must also be set
#define Sleep_Time 20
#define Log IOLog
#if USE_ELG
#undef Log
#define Log kprintf
#endif
#if LDEBUG
#if USE_ELG
#define XTRACE(ID,A,B,STRING) {Log("%8x %8x %8x %8x " DEBUG_NAME ": " STRING "\n",(unsigned int)(ID),(unsigned int)(A),(unsigned int)(B), (unsigned int)IOThreadSelf());}
#else
#if USE_IOL
#define XTRACE(ID,A,B,STRING) {Log("%8x %8x %8x %8x " DEBUG_NAME ": " STRING "\n",(unsigned int)(ID),(unsigned int)(A),(unsigned int)(B), (unsigned int)IOThreadSelf()); IOSleep(Sleep_Time);}
#else
#define XTRACE(id, x, y, msg)
#endif
#endif
#else
#define XTRACE(id, x, y, msg)
#undef USE_ELG
#undef USE_IOL
#endif
#define ALERT(A,B,STRING) Log("%8x %8x " DEBUG_NAME ": " STRING "\n", (unsigned int)(A), (unsigned int)(B))
#define kDeviceSelfPowered 1
enum
{
kCDCPowerOffState = 0,
kCDCPowerOnState = 1,
kNumCDCStates = 2
};
class AppleUSBCDCWCM : public IOService
{
OSDeclareDefaultStructors(AppleUSBCDCWCM);
private:
bool fTerminate; bool fStopping; UInt8 fPowerState; UInt8 fSubClass; UInt8 fInterfaceNumber; UInt16 fControlLen; UInt8 *fControlMap;
public:
IOUSBInterface *fInterface;
virtual IOService *probe(IOService *provider, SInt32 *score);
virtual bool start(IOService *provider);
virtual void stop(IOService *provider);
virtual IOReturn message(UInt32 type, IOService *provider, void *argument = 0);
bool configureWHCM(void);
bool configureDevice(void);
bool getFunctionalDescriptors(void);
bool allocateResources(void);
void releaseResources(void);
void resetLogicalHandset(void);
bool initForPM(IOService *provider);
unsigned long initialPowerStateForDomainState(IOPMPowerFlags flags);
IOReturn setPowerState(unsigned long powerStateOrdinal, IOService *whatDevice);
};
#endif