
E-36
DINK32 PowerPC ISA Debugger User’s Manual
For More Information On This Product,
Go to: www.freescale.com
MOTOROLA
MPC8240 I2O Doorbell Driver
I2C_STOP_MODE stop,
int retry,
I2C_RESTART_MODE rsta);
Where:
en_int controls the I2C interrupt enable status (currently use I2C_INT_DISABLE
only, polling mode)
act is the type of transaction: I2C_MASTER_RCV or I2C_MASTER_XMIT
i2c_addr is the I2C address of the slave device
data_addr is the address of the data on the slave device
len is the length in bytes of the data
buffer is a pointer to the buffer that contains the data (xmit mode) or receives the data
(rcv mode)
stop controls sending an I2C STOP signal after completion (curently use I2C_STOP
only)
retry is the timeout retry value (currently ignored)
rsta controls I2C restart (currently use I2C_NO_RESTART only)
Return: I2C_Status return value is either I2C_SUCCESS or I2C_ERROR.
Description:
Act as the I2C master to transmit (or receive) a buffer of data to (or from) an I2C slave
device.
This function currently only implements a simple master-transmit or a master-receive
transaction. It does not yet support the application retaining I2C bus ownership between
transactions, operating in interrupt mode, or acting as an I2C slave device.
E.3.2.3.2
API Example Usage
The ROM monitor program DINK32 uses the I2C API in both currently implemented
modes: master-transmit and master-receive. The DINK32 program runs interactively to
allow the user to transmit or receive a buffer of data from an I2C device at address 0x50 on
the Kahlua PMC card. DINK32 obtains information from the user as follows: read/write
mode, I2C device address for the data (this is the address of the data on the I2C device, not
the I2C bus address of the device itself, which is hard-coded in DINK32), the raw data (if
in write mode), and the length of the data to transfer to or from the device. Note that the
initialization call to configure the I2C interface is actually made only once, the first time
the user requests an I2C transmit or receive operation. Each transmit or receive operation
is performed by a single call to an I2C API function. The DINK32 program is an interactive
application, so it gives the I2C library access to its own print output function.
F
n
.