|
ADC Home > Reference Library > Reference > Hardware & Drivers > I/O Kit Framework Reference
|
IOI2CInterface.h |
| Include Path: | <IOKit/i2c/IOI2CInterface.h> |
| Path: | /System/Library/Frameworks/IOKit.framework/Versions/A/Headers/i2c/IOI2CInterface.h |
This header contains data structures, functions, and classes related to I2C (I-squared-C, or Inter-IC) busses.
Returns an instance of an I2C bus interface, associated with an IOFramebuffer instance / bus index pair.
Returns a count of I2C interfaces available associated with an IOFramebuffer instance.
Closes an IOI2CConnectRef.
Opens an instance of an I2C bus interface, allowing I2C requests to be made.
Carries out the I2C transaction specified by an IOI2CRequest structure.
IOFBCopyI2CInterfaceForBus |
Returns an instance of an I2C bus interface, associated with an IOFramebuffer instance / bus index pair.
IOReturn IOFBCopyI2CInterfaceForBus( io_service_t framebuffer, IOOptionBits bus, io_service_t *interface );
busThe zero based index of the bus on the requested framebuffer.
interfaceThe interface instance is returned. The caller should release this instance with IOObjectRelease().
An IOReturn code.
Some graphics devices will allow access to an I2C bus routed through a display connector in order to control external devices on that bus. This function returns an instance of an I2C bus interface, associated with an IOFramebuffer instance / bus index pair. The number of I2C buses is available from the IOFBGetI2CInterfaceCount() call. The interface may be used with the IOI2CInterfaceOpen/Close/SendRequest() calls to carry out I2C transactions on that bus. Not all graphics devices support this functionality.
IOFBGetI2CInterfaceCount |
Returns a count of I2C interfaces available associated with an IOFramebuffer instance.
IOReturn IOFBGetI2CInterfaceCount( io_service_t framebuffer, IOItemCount *count );
framebufferThe io_service_t of an IOFramebuffer instance. CoreGraphics will provide this for a CGDisplay with the CGDisplayIOServicePort() call.
countInterface count is returned.
An IOReturn code.
Returns a count of I2C interfaces available associated with an IOFramebuffer instance.
IOI2CInterfaceClose |
Closes an IOI2CConnectRef.
IOReturn IOI2CInterfaceClose( IOI2CConnectRef connect, IOOptionBits options );
connectThe opaque IOI2CConnectRef returned by IOI2CInterfaceOpen().
optionsPass kNilOptions.
An IOReturn code.
Frees the resources associated with an IOI2CConnectRef.
IOI2CInterfaceOpen |
Opens an instance of an I2C bus interface, allowing I2C requests to be made.
IOReturn IOI2CInterfaceOpen( io_service_t interface, IOOptionBits options, IOI2CConnectRef *connect );
interfaceAn I2C bus interface (see IOFBCopyI2CInterfaceForBus). The interface may be released after this call is made.
optionsPass kNilOptions.
connectThe opaque IOI2CConnectRef is returned, for use with IOI2CSendRequest() and IOI2CInterfaceClose().
An IOReturn code.
An instance of an I2C bus interface, obtained by IOFBCopyI2CInterfaceForBus, is opened with this function allowing I2C requests to be made.
IOI2CSendRequest |
Carries out the I2C transaction specified by an IOI2CRequest structure.
IOReturn IOI2CSendRequest( IOI2CConnectRef connect, IOOptionBits options, IOI2CRequest *request );
connectThe opaque IOI2CConnectRef returned by IOI2CInterfaceOpen().
optionsPass kNilOptions.
requestPass a pointer to a IOI2CRequest structure describing the request. If an asynchronous request (with a non-NULL completion routine) the request structure must be valid for the life of the request.
An IOReturn code reflecting only the result of starting the transaction. If the result of IOI2CSendRequest() is kIOReturnSuccess, the I2C transaction result is returned in the result field of the request structure.
Frees the resources associated with an IOI2CConnectRef.
IOI2CBusTiming |
A structure defining low level timing for an I2C bus.
struct IOI2CBusTiming { AbsoluteTime bitTimeout; AbsoluteTime byteTimeout; AbsoluteTime acknowledgeTimeout; AbsoluteTime startTimeout; AbsoluteTime holdTime; AbsoluteTime riseFallTime; UInt32 __reservedA[8]; };
bitTimeoutMaximum time a slave can delay (by pulling the clock line low) a single bit response.
byteTimeoutMaximum time a slave can delay (by pulling the clock line low) the first bit of a byte response.
acknowledgeTimeoutMaximum time to wait for a slave to respond with an ACK after writing a byte.
startTimeoutMaximum time to wait for a slave to respond after a start signal.
riseFallTimeTime to wait after any change in output signal.
__reservedASet to zero.
This structure is used to specify timeouts and pulse widths for an I2C bus implementation.
IOI2CRequest |
A structure defining an I2C bus transaction.
struct IOI2CRequest { UInt64 __reservedA; IOReturn result; IOI2CRequestCompletion completion; IOOptionBits commFlags; uint64_t minReplyDelay; UInt8 sendAddress; UInt8 sendSubAddress; UInt8 __reservedB[2]; IOOptionBits sendTransactionType; vm_address_t sendBuffer; IOByteCount sendBytes; UInt8 replyAddress; UInt8 replySubAddress; UInt8 __reservedC[2]; IOOptionBits replyTransactionType; vm_address_t replyBuffer; IOByteCount replyBytes; UInt32 __reservedD[16]; };
__reservedASet to zero.
resultThe result of the transaction. Common errors are kIOReturnNoDevice if there is no device responding at the given address, kIOReturnUnsupportedMode if the type of transaction is unsupported on the requested bus.
completionA completion routine to be executed when the request completes. If NULL is passed, the request is synchronous, otherwise it may execute asynchronously.
commFlagsFlags that modify the I2C transaction type. The following flags are defined:
kIOI2CUseSubAddressCommFlag Transaction includes a subaddress.
minReplyDelayMinimum delay as absolute time between send and reply transactions.
sendAddressI2C address to write.
sendSubAddressI2C subaddress to write.
__reservedBSet to zero.
sendTransactionTypeThe following types of transaction are defined for the send part of the request:
kIOI2CNoTransactionType No send transaction to perform.
kIOI2CSimpleTransactionType Simple I2C message.
kIOI2CCombinedTransactionType Combined format I2C R/~W transaction.
sendBufferPointer to the send buffer.
sendBytesNumber of bytes to send. Set to actual bytes sent on completion of the request.
replyAddressI2C Address from which to read.
replySubAddressI2C Address from which to read.
__reservedCSet to zero.
replyTransactionTypeThe following types of transaction are defined for the reply part of the request:
kIOI2CNoTransactionType No reply transaction to perform.
kIOI2CSimpleTransactionType Simple I2C message.
kIOI2CDDCciReplyTransactionType DDC/ci message (with embedded length). See VESA DDC/ci specification.
kIOI2CCombinedTransactionType Combined format I2C R/~W transaction.
replyBufferPointer to the reply buffer.
replyBytesMax bytes to reply (size of replyBuffer). Set to actual bytes received on completion of the request.
__reservedDSet to zero.
This structure is used to request an I2C transaction consisting of a send (write) to and reply (read) from a device, either of which is optional, to be carried out atomically on an I2C bus.
|
Last Updated: 2009-02-23