
MOTOROLA
Appendix E. MPC8240 Drivers
E-35
— how the function is called (i.e., function prototype)
— parameter definition
— possible return values
— brief description of what the function does
E.3.2.3
I2C Application Program Interface (API)
E.3.2.3.1
API Functions Description
The I2C API function prototypes, defined return values, and enumerated input parameter
values are declared in drivers/i2c/i2c_export.h. 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,
F
Freescale Semiconductor, Inc.
For More Information On This Product,
Go to: www.freescale.com
n
.