
E-14
DINK32 PowerPC ISA Debugger User’s Manual
For More Information On This Product,
Go to: www.freescale.com
MOTOROLA
MPC8240 I2C Driver Library
The functions are defined in the source file drivers/i2c/i2c1.c.
I2C_Status I2C_Initialize( unsigned char addr,
I2C_INTERRUPT_MODE en_int,
int (*app_print_function)(char *,...));
addr is the Kahlua chip's I2C slave device address
en_int controls the I2C interrupt enable status: I2C_INT_ENABLE = enable,
I2C_INT_DISABLE = disable
app_print_function is the address of the optional application's print function,
otherwise NULL if not available
Return: I2C_Status return value is either I2C_SUCCESS or I2C_ERROR.
Description:
Configure the I2C library prior to use, as follows:
The interrupt enable should be set to I2C_INT_DISABLE, the I2C library currently only
supports polling mode.
The slave address can be set to the I2C listening address of the device running the
application program, but the DLI does not yet support the application's device responding
as an I2C slave to another I2C master device.
The optional print function, if supplied by the application, must be similar to the C standard
library printf library function: accepts a format string and a variable number (zero or more)
of additional arguments. This optional function may be used by the I2C library functions to
report error and status condition information. If no print function is supplied by the
application, the call to I2C_Initialize must provide a NULL value for this parameter, in
which case the I2C library will not attempt to access a print function.
I2C_Status I2C_do_transaction( I2C_INTERRUPT_MODE en_int,
I2C_TRANSACTION_MODE act,
unsigned char i2c_addr,
unsigned char data_addr,
int len,
char *buffer,
I2C_STOP_MODE stop,
int retry,
I2C_RESTART_MODE rsta);
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
F
n
.