1 /*********************************************************************
2 * FILE PURPOSE: I2C API definition
3 *********************************************************************
4 * FILE NAME: i2c.h
5 *
6 * DESCRIPTION: Defines the i2c API
7 *
8 * @file i2c.h
9 *
10 * @brief
11 * Defines the i2c API
12 *
13 *********************************************************************/
14 #include "types.h"
16 typedef UINT16 I2C_RET;
19 #define I2C_RET_OK 0
20 #define I2C_RET_LOST_ARB 1
21 #define I2C_RET_NO_ACK 2
22 #define I2C_RET_IDLE_TIMEOUT 3
23 #define I2C_RET_BAD_REQUEST 4
24 #define I2C_RET_CLOCK_STUCK_LOW 5
25 #define I2C_RET_GEN_ERROR 99
28 enum {
29 I2C_RELEASE_BUS,
30 I2C_DO_NOT_RELEASE_BUS
31 };
34 void hwI2Cinit (UINT16 coreFreqMhz, UINT16 moduleDivisor, UINT16 clkFreqKhz, UINT16 ownAddr);
35 I2C_RET hwI2cMasterWrite (UINT16 eeprom_i2c_id, UINT8 *eData, UINT16 nbytes, UINT16 endBusState, BOOL busIsMine);
36 I2C_RET hwI2cMasterRead (UINT32 byte_addr, UINT32 byte_len, UINT8 *p_packed_bytes, UINT16 eeprom_i2c_id, UINT16 address_delay);