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#ifndef __APPLEUSBCDCECM__ 26#define __APPLEUSBCDCECM__ 27 28#include "AppleUSBCDCCommon.h" 29 30#define LDEBUG 0 // for debugging 31#define USE_ELG 0 // to Event LoG (via kprintf and Firewire) - LDEBUG must also be set 32#define USE_IOL 0 // to IOLog - LDEBUG must also be set 33#define LOG_DATA 0 // logs data to the appropriate log - LDEBUG must also be set 34#define DUMPALL 0 // Dumps all the data to the log - LOG_DATA must also be set 35 36#define Sleep_Time 20 37 38#define Log IOLog 39#if USE_ELG 40 #undef Log 41 #define Log kprintf 42#endif 43 44#if LDEBUG 45 #if USE_ELG 46 #define XTRACE(ID,A,B,STRING) {Log("%8p %8x %8x " DEBUG_NAME ": " STRING "\n",(void *)(ID),(unsigned int)(A),(unsigned int)(B));} 47 #define XTRACEP(ID,A,B,STRING) {Log("%8p %8p %8p " DEBUG_NAME ": " STRING "\n",(void *)(ID),(void *)(A),(void *)(B));} 48 #else /* not USE_ELG */ 49 #if USE_IOL 50 #define XTRACE(ID,A,B,STRING) {Log("%8p %8x %8x " DEBUG_NAME ": " STRING "\n",(void *)(ID),(unsigned int)(A),(unsigned int)(B)); IOSleep(Sleep_Time);} 51 #define XTRACEP(ID,A,B,STRING) {Log("%8p %8p %8p " DEBUG_NAME ": " STRING "\n",(void *)(ID),(void *)(A),(void *)(B)); IOSleep(Sleep_Time);} 52 #else 53 #define XTRACE(id, x, y, msg) 54 #define XTRACEP(id, x, y, msg) 55 #endif /* USE_IOL */ 56 #endif /* USE_ELG */ 57 #if LOG_DATA 58 #define LogData(D, C, b) USBLogData((UInt8)D, (SInt32)C, (char *)b) 59 #define meLogData(D, C, b) me->USBLogData((UInt8)D, (SInt32)C, (char *)b) 60 #define DumpData(b, C) dumpData(char *)b, (SInt32)C) 61 #define meDumpData(b, C) me->dumpData(char *)b, (SInt32)C) 62 #else /* not LOG_DATA */ 63 #define LogData(D, C, b) 64 #define meLogData(D, C, b) 65 #define DumpData(b, C) 66 #define meDumpData(b, C) 67 #endif /* LOG_DATA */ 68#else /* not LDEBUG */ 69 #define XTRACE(id, x, y, msg) 70 #define XTRACEP(id, x, y, msg) 71 #define LogData(D, C, b) 72 #define meLogData(D, C, b) 73 #define DumpData(b, C) 74 #define meDumpData(b, C) 75 #undef USE_ELG 76 #undef USE_IOL 77 #undef LOG_DATA 78#endif /* LDEBUG */ 79 80#define ALERT(A,B,STRING) Log("%8x %8x " DEBUG_NAME ": " STRING "\n", (unsigned int)(A), (unsigned int)(B)) 81 82enum 83{ 84 kDataIn = 0, 85 kDataOut, 86 kDataOther, 87 kDataNone 88}; 89 90 // Reset states 91 92enum 93{ 94 kResetNormal = 0, 95 kResetNeeded, 96 kResetDone 97}; 98 99 // Link state 100 101enum 102{ 103 kLinkDown = 0, 104 kLinkUp 105}; 106#endif