1 /******************************************************************************
2 ** File Name: I2C_drv_new.h *
5 ** Copyright: 2010 Spreatrum, Incoporated. All Rights Reserved. *
6 ** Description: This file define the basic interfaces of I2C device. *
7 ******************************************************************************
9 ******************************************************************************
11 ** ------------------------------------------------------------------------- *
12 ** DATE NAME DESCRIPTION *
13 ** 06/28/2010 liuhao Create. *
14 ******************************************************************************/
15 #ifndef _I2C_DRVAPI_H_
16 #define _I2C_DRVAPI_H_
18 /**---------------------------------------------------------------------------*
20 **---------------------------------------------------------------------------*/
22 /**---------------------------------------------------------------------------*
24 **---------------------------------------------------------------------------*/
26 /**---------------------------------------------------------------------------*
28 **---------------------------------------------------------------------------*/
34 #include "asm/arch/sci_types.h"
36 /**---------------------------------------------------------------------------*
38 **---------------------------------------------------------------------------*/
50 /**---------------------------------------------------------------------------*
52 **---------------------------------------------------------------------------*/
53 #define I2C_CTL_G_FREQ 0x20 /*get frequency*/
54 #define I2C_CTL_S_FREQ 0x21 /*set frequency*/
55 #define I2C_CTL_G_PORT 0x22 /*get port*/
56 #define I2C_CTL_S_PORT 0x23 /*set port*/
57 #define I2C_CTL_STOP_BUS 0x24 /*stop i2c bus*/
59 /**---------------------------------------------------------------------------*
61 **---------------------------------------------------------------------------*/
62 /*********************************************************************************************************
71 *********************************************************************************************************/
72 int32 I2C_HAL_Open (I2C_DEV *dev);
74 /*********************************************************************************************************
83 *********************************************************************************************************/
84 int32 I2C_HAL_Close (uint32 handle);
86 /*********************************************************************************************************
95 *********************************************************************************************************/
96 uint32 I2C_HAL_Read (uint32 handle, uint8 *reg_addr, uint8 *buffer, uint32 bytes);
98 /*********************************************************************************************************
105 ** output parameters:
107 *********************************************************************************************************/
108 uint32 I2C_HAL_Write (uint32 handle, uint8 *reg_addr, uint8 *buffer, uint32 bytes);
110 /*********************************************************************************************************
117 ** output parameters:
119 *********************************************************************************************************/
120 uint32 I2C_HAL_Ioctl (uint32 handle, uint32 cmd, uint32 *arg);
122 /**---------------------------------------------------------------------------*
124 **---------------------------------------------------------------------------*/