|
|
1.1 ! root 1: /* ! 2: * Copyright (c) 1998-2000 Apple Computer, Inc. All rights reserved. ! 3: * ! 4: * @APPLE_LICENSE_HEADER_START@ ! 5: * ! 6: * The contents of this file constitute Original Code as defined in and ! 7: * are subject to the Apple Public Source License Version 1.1 (the ! 8: * "License"). You may not use this file except in compliance with the ! 9: * License. Please obtain a copy of the License at ! 10: * http://www.apple.com/publicsource and read it before using this file. ! 11: * ! 12: * This Original Code and all software distributed under the License are ! 13: * distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY KIND, EITHER ! 14: * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES, ! 15: * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY, ! 16: * FITNESS FOR A PARTICULAR PURPOSE OR NON-INFRINGEMENT. Please see the ! 17: * License for the specific language governing rights and limitations ! 18: * under the License. ! 19: * ! 20: * @APPLE_LICENSE_HEADER_END@ ! 21: */ ! 22: /* ! 23: * 18 June 1998 sdouglas Start IOKit version. ! 24: * 12 Nov 1998 suurballe Port objc protocol to c++ abstract class. ! 25: */ ! 26: #ifndef _IOKIT_ADBCONTROLLER_H ! 27: #define _IOKIT_ADBCONTROLLER_H ! 28: ! 29: #include <IOKit/IOService.h> ! 30: #include <IOKit/adb/adb.h> ! 31: #include <IOKit/adb/IOADBBus.h> ! 32: ! 33: // referenced in subclasses: ! 34: void autopollHandler ( IOService *, UInt8, IOByteCount, UInt8 * ); ! 35: ! 36: class IOADBDevice; ! 37: ! 38: /* ! 39: * Results ! 40: */ ! 41: ! 42: #define ADB_RET_OK 0 /* Successful */ ! 43: #define ADB_RET_INUSE 1 /* ADB Device in use */ ! 44: #define ADB_RET_NOTPRESENT 2 /* ADB Device not present */ ! 45: #define ADB_RET_TIMEOUT 3 /* ADB Timeout */ ! 46: #define ADB_RET_UNEXPECTED_RESULT 4 /* Unknown result */ ! 47: #define ADB_RET_REQUEST_ERROR 5 /* Packet Request Error */ ! 48: #define ADB_RET_BUS_ERROR 6 /* ADB Bus Error */ ! 49: ! 50: class IOADBController: public IOADBBus ! 51: { ! 52: OSDeclareAbstractStructors(IOADBController) ! 53: ! 54: public: ! 55: ! 56: bool start ( IOService * nub ); ! 57: IOReturn setOwner ( void * device, IOService * client, ADB_callback_func handler ); ! 58: virtual IOReturn claimDevice ( unsigned long, IOService *, ADB_callback_func ); ! 59: virtual IOReturn releaseDevice ( unsigned long ); ! 60: virtual IOReturn readDeviceForUser(unsigned long, unsigned long, UInt8 *, IOByteCount *); ! 61: virtual IOReturn writeDeviceForUser(unsigned long, unsigned long, UInt8 *, IOByteCount *); ! 62: virtual IOReturn setAutoPollPeriod (int microseconds) = 0; ! 63: virtual IOReturn getAutoPollPeriod (int * microseconds) = 0; ! 64: virtual IOReturn setAutoPollList(UInt16 activeAddressMask) = 0; ! 65: virtual IOReturn getAutoPollList(UInt16 * activeAddressMask) = 0; ! 66: virtual IOReturn setAutoPollEnable(bool enable) = 0; ! 67: virtual IOReturn resetBus(void) = 0; ! 68: virtual IOReturn flushDevice(IOADBAddress address) = 0; ! 69: virtual IOReturn readFromDevice(IOADBAddress address, IOADBRegister adbRegister, ! 70: UInt8 * data, IOByteCount * length) = 0; ! 71: virtual IOReturn writeToDevice(IOADBAddress address, IOADBRegister adbRegister, ! 72: UInt8 * data, IOByteCount * length) = 0; ! 73: void packet ( UInt8 * data, IOByteCount length, UInt8 adbCommand ); ! 74: ! 75: IOReturn flush ( ADBDeviceControl * busRef ); ! 76: IOReturn readRegister ( ADBDeviceControl * busRef, IOADBRegister adbRegister, ! 77: UInt8 * data, IOByteCount * length ); ! 78: IOReturn writeRegister ( ADBDeviceControl * busRef, IOADBRegister adbRegister, ! 79: UInt8 * data, IOByteCount * length ); ! 80: IOADBAddress address ( ADBDeviceControl * busRef ); ! 81: IOADBAddress defaultAddress ( ADBDeviceControl * busRef ); ! 82: UInt8 handlerID ( ADBDeviceControl * busRef ); ! 83: UInt8 defaultHandlerID ( ADBDeviceControl * busRef ); ! 84: IOReturn setHandlerID ( ADBDeviceControl * busRef, UInt8 handlerID ); ! 85: bool matchNubWithPropertyTable( IOService * device, OSDictionary * propertyTable ); ! 86: IOReturn newUserClient( task_t, void *, UInt32, IOUserClient ** ); ! 87: ! 88: IOReturn clearOwner ( void * ); ! 89: ! 90: private: ! 91: ! 92: bool claimed_devices[16]; // true if a device has been claimed by user ! 93: ! 94: IOReturn probeBus ( void ); ! 95: bool probeAddress ( IOADBAddress addr ); ! 96: bool moveDeviceFrom ( IOADBAddress from, IOADBAddress to, bool check ); ! 97: unsigned int firstBit ( unsigned int mask ); ! 98: int getURLComponentUnit ( IOService * device, char * path, int maxLen ); ! 99: }; ! 100: ! 101: #endif /* ! _IOKIT_ADBCONTROLLER_H */
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.