#ifndef _IOKIT_IOI2CINTERFACE_H
#define _IOKIT_IOI2CINTERFACE_H
typedef struct IOI2CRequest IOI2CRequest;
typedef struct IOI2CBuffer IOI2CBuffer;
typedef void (*IOI2CRequestCompletion) (IOI2CRequest * request);
enum {
kIOI2CNoTransactionType = 0,
kIOI2CSimpleTransactionType = 1,
kIOI2CDDCciReplyTransactionType = 2,
kIOI2CCombinedTransactionType = 3
};
enum {
kIOI2CUseSubAddressCommFlag = 0x00000002
};
struct IOI2CRequest
{
UInt64 i2cBusID;
IOReturn result;
IOI2CRequestCompletion completion;
IOOptionBits commFlags;
uint64_t minReplyDelay;
UInt8 sendAddress;
UInt8 sendSubAddress;
UInt8 __reservedA[2];
IOOptionBits sendTransactionType;
vm_address_t sendBuffer;
IOByteCount sendBytes;
UInt8 replyAddress;
UInt8 replySubAddress;
UInt8 __reservedB[2];
IOOptionBits replyTransactionType;
vm_address_t replyBuffer;
IOByteCount replyBytes;
UInt32 __reservedC[16];
};
#define kIOI2CInterfaceClassName "IOI2CInterface"
#define kIOI2CInterfaceIDKey "IOI2CInterfaceID"
#define kIOI2CBusTypeKey "IOI2CBusType"
#define kIOI2CTransactionTypesKey "IOI2CTransactionTypes"
#define kIOI2CSupportedCommFlagsKey "IOI2CSupportedCommFlags"
#define kIOFBI2CInterfaceIDsKey "IOFBI2CInterfaceIDs"
enum {
kIOI2CBusTypeI2C = 1
};
#ifndef KERNEL
enum {
kIOI2CBusNumberMask = 0x000000ff
};
IOReturn IOFBGetI2CInterfaceCount( io_service_t framebuffer, IOItemCount * count );
IOReturn IOFBCopyI2CInterfaceForBus( io_service_t framebuffer, IOOptionBits bus, io_service_t * interface );
typedef struct IOI2CConnect * IOI2CConnectRef;
IOReturn IOI2CCopyInterfaceForID( CFTypeRef identifier, io_service_t * interface );
IOReturn IOI2CInterfaceOpen( io_service_t interface, IOOptionBits options,
IOI2CConnectRef * connect );
IOReturn IOI2CInterfaceClose( IOI2CConnectRef connect, IOOptionBits options );
IOReturn IOI2CSendRequest( IOI2CConnectRef connect, IOOptionBits options,
IOI2CRequest * request );
#else
class IOI2CInterface : public IOService
{
OSDeclareDefaultStructors(IOI2CInterface)
protected:
UInt64 fID;
public:
IOReturn newUserClient( task_t owningTask,
void * security_id,
UInt32 type,
IOUserClient ** handler );
bool registerI2C( UInt64 id );
virtual IOReturn startIO( IOI2CRequest * request ) = 0;
};
#endif
#endif