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#ifndef _IOKIT_IOI2CINTERFACEPRIVATE_H 24#define _IOKIT_IOI2CINTERFACEPRIVATE_H 25 26#ifdef KERNEL 27#include <IOKit/IOLib.h> 28#include <IOKit/IOUserClient.h> 29#include <IOKit/ndrvsupport/IONDRVFramebuffer.h> 30#endif /* KERNEL */ 31 32#include <IOKit/i2c/IOI2CInterface.h> 33 34/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ 35 36enum { kIOI2CInlineBufferBytes = 1024 }; 37 38struct IOI2CBuffer 39{ 40 IOI2CRequest request; 41 UInt8 inlineBuffer[ kIOI2CInlineBufferBytes ]; 42}; 43 44/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ 45 46#ifdef KERNEL 47 48#pragma pack(push, 4) 49 50struct IOI2CRequest_10_5_0 51{ 52 UInt64 __reservedA; 53 IOReturn result; 54 uint32_t completion; 55 IOOptionBits commFlags; 56 uint64_t minReplyDelay; 57 uint8_t sendAddress; 58 uint8_t sendSubAddress; 59 uint8_t __reservedB[2]; 60 IOOptionBits sendTransactionType; 61 uint32_t sendBuffer; 62 uint32_t sendBytes; 63 uint8_t replyAddress; 64 uint8_t replySubAddress; 65 uint8_t __reservedC[2]; 66 IOOptionBits replyTransactionType; 67 uint32_t replyBuffer; 68 uint32_t replyBytes; 69 uint32_t __reservedD[16]; 70#ifdef __ppc__ 71 uint32_t __reservedE; 72#endif 73}; 74 75#pragma pack(pop) 76 77/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ 78 79class IOI2CInterfaceUserClient : public IOUserClient 80{ 81 OSDeclareDefaultStructors(IOI2CInterfaceUserClient) 82 83protected: 84 task_t fTask; 85 86public: 87 // IOUserClient methods 88 virtual IOReturn clientClose( void ); 89 90 virtual IOService * getService( void ); 91 92 virtual IOExternalMethod * getTargetAndMethodForIndex( 93 IOService ** targetP, UInt32 index ); 94 static IOI2CInterfaceUserClient * withTask( task_t owningTask ); 95 virtual bool start( IOService * provider ); 96 virtual IOReturn setProperties( OSObject * properties ); 97 98 // others 99 100 virtual IOReturn extAcquireBus( void ); 101 virtual IOReturn extReleaseBus( void ); 102 virtual IOReturn extIO( void * inStruct, void * outStruct, 103 IOByteCount inSize, IOByteCount * outSize ); 104}; 105 106/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ 107 108#endif /* KERNEL */ 109 110#endif /* ! _IOKIT_IOI2CINTERFACEPRIVATE_H */ 111 112