#ifndef __APPLEUSBCDCACM__
#define __APPLEUSBCDCACM__
#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 LOG_DATA 0 // logs data to the appropriate log - LDEBUG must also be set
#define DUMPALL 0 // Dumps all the data to the log - LOG_DATA must also be set
#define Sleep_Time 20
#if LDEBUG
#define Log IOLog
#else
#define Log
#endif
#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
#if LOG_DATA
#if DUMPALL
#define LogData(D, C, b) dumpData((UInt8)D, (char *)b, (SInt32)C)
#define meLogData(D, C, b) me->dumpData((UInt8)D, (char *)b, (SInt32)C)
#else
#define LogData(D, C, b) USBLogData((UInt8)D, (SInt32)C, (char *)b)
#define meLogData(D, C, b) me->USBLogData((UInt8)D, (SInt32)C, (char *)b)
#endif
#define DumpData(D, C, b) dumpData((UInt8)D, (char *)b, (SInt32)C)
#else
#define LogData(D, C, b)
#define meLogData(D, C, b)
#define DumpData(D, C, b)
#endif
#else
#define XTRACE(id, x, y, msg)
#define LogData(D, C, b)
#define meLogData(D, C, b)
#define DumpData(D, C, b)
#undef USE_ELG
#undef USE_IOL
#undef LOG_DAT
#undef DUMPALL
#endif
#define ALERT(A,B,STRING) IOLog("%8x %8x " DEBUG_NAME ": " STRING "\n", (unsigned int)(A), (unsigned int)(B))
enum
{
kDataIn = 0,
kDataOut,
kDataOther,
kDataNone
};
#define kUSBbRxCarrier 0x01 // Carrier Detect
#define kUSBDCD kUSBbRxCarrier
#define kUSBbTxCarrier 0x02 // Data Set Ready
#define kUSBDSR kUSBbTxCarrier
#define kUSBbBreak 0x04
#define kUSBbRingSignal 0x08
#define kUSBbFraming 0x10
#define kUSBbParity 0x20
#define kUSBbOverRun 0x40
#define kDTROff 0
#define kRTSOff 0
#define kDTROn 1
#define kRTSOn 2
typedef struct
{
UInt32 dwDTERate;
UInt8 bCharFormat;
UInt8 bParityType;
UInt8 bDataBits;
} LineCoding;
#define dwDTERateOffset 0
#define wValueOffset 2
#define wIndexOffset 4
#define wLengthOffset 6
#endif