1 /******************************************************************************
2 ** File Name: I2C_phy.h *
5 ** Copyright: 2010 Spreatrum, Incoporated. All Rights Reserved. *
6 ** Description: This file define the basic hw interfaces of I2C device. *
7 ******************************************************************************
9 ******************************************************************************
11 ** ------------------------------------------------------------------------- *
12 ** DATE NAME DESCRIPTION *
13 ** 06/28/2010 liuhao Create. *
14 ******************************************************************************/
18 /*----------------------------------------------------------------------------*
20 **------------------------------------------------------------------------- */
22 #include "asm/arch/sci_types.h"
25 /**---------------------------------------------------------------------------*
27 **--------------------------------------------------------------------------*/
32 /**---------------------------------------------------------------------------*
34 **---------------------------------------------------------------------------*/
35 //I2C error code define
38 ERR_I2C_NONE = 0, // Success,no error
39 ERR_I2C_ACK_TIMEOUT, // I2C wait ACK timeout
40 ERR_I2C_INT_TIMEOUT, // I2C wait INT timeout
41 ERR_I2C_BUSY_TIMEOUT, // I2C wait BUSY timeout
42 ERR_I2C_DEVICE_NOT_FOUND, // I2C device not found
43 ERR_I2C_NO_MUTEX // No mutex created
46 typedef ERR_I2C_E (*_init) (uint32 phy_id, uint32 freq, uint32 port);
47 typedef ERR_I2C_E (*_start) (uint32 phy_id, uint8 addr, BOOLEAN rw, BOOLEAN ack_en);
48 typedef ERR_I2C_E (*_write) (uint32 phy_id, uint8 *pCmd, uint32 len, BOOLEAN ack_en, BOOLEAN no_stop);
49 typedef ERR_I2C_E (*_read) (uint32 phy_id, uint8 *pCmd, uint32 len, BOOLEAN ack_en);
50 typedef ERR_I2C_E (*_stop) (uint32 phy_id);
51 typedef ERR_I2C_E (*_sendack) (uint32 phy_id);
52 typedef ERR_I2C_E (*_getack) (uint32 phy_id);
65 /**----------------------------------------------------------------------------*
66 ** Local Function Prototype **
67 **----------------------------------------------------------------------------*/
70 /**----------------------------------------------------------------------------*
71 ** Function Prototype **
72 **----------------------------------------------------------------------------*/
74 /**----------------------------------------------------------------------------*
76 **----------------------------------------------------------------------------*/
80 /**---------------------------------------------------------------------------*/