mirror of
https://github.com/plappermaul/realtek-doc.git
synced 2025-12-10 07:44:41 +01:00
248 lines
5.2 KiB
C
Executable file
248 lines
5.2 KiB
C
Executable file
/*
|
|
* Copyright (C) 2012 Realtek Semiconductor Corp.
|
|
* All Rights Reserved.
|
|
*
|
|
* This program is the proprietary software of Realtek Semiconductor
|
|
* Corporation and/or its licensors, and only be used, duplicated,
|
|
* modified or distributed under the authorized license from Realtek.
|
|
*
|
|
* ANY USE OF THE SOFTWARE OTHER THAN AS AUTHORIZED UNDER
|
|
* THIS LICENSE OR COPYRIGHT LAW IS PROHIBITED.
|
|
*
|
|
* $Revision: 54353 $
|
|
* $Date: 2014-12-25 20:03:23 +0800 (Thu, 25 Dec 2014) $
|
|
*
|
|
* Purpose : Definition of I2C API
|
|
*
|
|
* Feature : The file includes the following modules and sub-modules
|
|
* (1) I2C control
|
|
* (2) I2C read/write
|
|
*/
|
|
|
|
|
|
#ifndef __DAL_CA8279_I2C_H__
|
|
#define __DAL_CA8279_I2C_H__
|
|
|
|
|
|
/*
|
|
* Include Files
|
|
*/
|
|
#include <common/rt_type.h>
|
|
#include <rtk/i2c.h>
|
|
|
|
/*
|
|
* Symbol Definition
|
|
*/
|
|
|
|
|
|
/*
|
|
* Data Declaration
|
|
*/
|
|
|
|
|
|
/*
|
|
* Macro Declaration
|
|
*/
|
|
|
|
|
|
/*
|
|
* Function Declaration
|
|
*/
|
|
/* Function Name:
|
|
* dal_ca8279_i2c_init
|
|
* Description:
|
|
* Initialize i2c interface.
|
|
* Input:
|
|
* i2cPort - I2C port interface
|
|
* Output:
|
|
* None
|
|
* Return:
|
|
* RT_ERR_OK
|
|
* RT_ERR_FAILED
|
|
* Note:
|
|
* Must initialize before calling any other APIs.
|
|
*/
|
|
extern int32
|
|
dal_ca8279_i2c_init(rtk_i2c_port_t i2cPort);
|
|
|
|
/* Function Name:
|
|
* dal_ca8279_i2c_enable_get
|
|
* Description:
|
|
* Get I2C interface state.
|
|
* Input:
|
|
* i2cPort - I2C port interface
|
|
* pEnable - the pointer of enable/disable state
|
|
* Output:
|
|
* None
|
|
* Return:
|
|
* RT_ERR_OK
|
|
* RT_ERR_FAILED
|
|
* RT_ERR_NULL_POINTER
|
|
* Note:
|
|
*
|
|
*/
|
|
extern int32
|
|
dal_ca8279_i2c_enable_get (rtk_i2c_port_t i2cPort,rtk_enable_t* pEnable );
|
|
|
|
/* Function Name:
|
|
* dal_ca8279_i2c_enable_set
|
|
* Description:
|
|
* Enable/Disable I2C interface.
|
|
* Input:
|
|
* i2cPort - I2C port interface
|
|
* enable - enable/disable state
|
|
* Output:
|
|
* None
|
|
* Return:
|
|
* RT_ERR_OK
|
|
* RT_ERR_FAILED
|
|
* RT_ERR_INPUT
|
|
* Note:
|
|
*
|
|
*/
|
|
extern int32
|
|
dal_ca8279_i2c_enable_set(rtk_i2c_port_t i2cPort, rtk_enable_t enable);
|
|
|
|
/* Function Name:
|
|
* dal_ca8279_i2c_write
|
|
* Description:
|
|
* I2c write data.
|
|
* Input:
|
|
* i2cPort - I2C port interface
|
|
* devID - the device ID
|
|
* regAddr - register address
|
|
* data - data value
|
|
* Output:
|
|
* None
|
|
* Return:
|
|
* RT_ERR_OK
|
|
* RT_ERR_FAILED
|
|
* RT_ERR_INPUT
|
|
* Note:
|
|
*
|
|
*/
|
|
extern int32
|
|
dal_ca8279_i2c_write(rtk_i2c_port_t i2cPort, uint32 devID, uint32 regAddr, uint32 data);
|
|
|
|
/* Function Name:
|
|
* dal_ca8279_i2c_read
|
|
* Description:
|
|
* I2c read data.
|
|
* Input:
|
|
* i2cPort - I2C port interface
|
|
* devID - the device ID
|
|
* regAddr - register address
|
|
* pData - the pointer of returned data
|
|
* Output:
|
|
* None
|
|
* Return:
|
|
* RT_ERR_OK
|
|
* RT_ERR_FAILED
|
|
* RT_ERR_INPUT
|
|
* RT_ERR_NULL_POINTER
|
|
* Note:
|
|
*
|
|
*/
|
|
extern int32
|
|
dal_ca8279_i2c_read(rtk_i2c_port_t i2cPort, uint32 devID, uint32 regAddr, uint32 *pData);
|
|
|
|
/* Function Name:
|
|
* dal_ca8279_i2c_clock_get
|
|
* Description:
|
|
* Get the clock of I2C interface.
|
|
* Input:
|
|
* i2cPort - I2C port interface
|
|
* pClock - KMHz, 10-bit value
|
|
* Output:
|
|
* None
|
|
* Return:
|
|
* RT_ERR_OK
|
|
* RT_ERR_FAILED
|
|
* RT_ERR_NULL_POINTER
|
|
* Note:
|
|
*
|
|
*/
|
|
extern int32
|
|
dal_ca8279_i2c_clock_get(rtk_i2c_port_t i2cPort,uint32* pClock);
|
|
|
|
/* Function Name:
|
|
* dal_ca8279_i2c_clock_set
|
|
* Description:
|
|
* Set the clock of I2C interface.
|
|
* Input:
|
|
* i2cPort - I2C port interface
|
|
* clock - KHz, 10-bit value
|
|
* Output:
|
|
* None
|
|
* Return:
|
|
* RT_ERR_OK
|
|
* RT_ERR_FAILED
|
|
* RT_ERR_INPUT
|
|
* Note:
|
|
*
|
|
*/
|
|
extern int32
|
|
dal_ca8279_i2c_clock_set(rtk_i2c_port_t i2cPort,uint32 clock);
|
|
|
|
/* Function Name:
|
|
* dal_ca8279_i2c_seq_read
|
|
* Description:
|
|
* I2c read data.
|
|
* Input:
|
|
* i2cPort - I2C port interface
|
|
* devID - the device ID
|
|
* regAddr - register address
|
|
* pData - the pointer of returned data
|
|
* count - number of sequential read
|
|
* Output:
|
|
* None
|
|
* Return:
|
|
* RT_ERR_OK
|
|
* RT_ERR_FAILED
|
|
* RT_ERR_INPUT
|
|
* RT_ERR_NULL_POINTER
|
|
* RT_ERR_CHIP_NOT_SUPPORTED
|
|
* Note:
|
|
* The ASIC doesn't support sequential read opearation
|
|
* Use multiple random read to simulate the behavior
|
|
*/
|
|
extern int32
|
|
dal_ca8279_i2c_seq_read (
|
|
rtk_i2c_port_t i2cPort,
|
|
uint32 devID,
|
|
uint32 regAddr,
|
|
uint32 *pData,
|
|
uint32 count);
|
|
|
|
/* Function Name:
|
|
* dal_ca8279_i2c_seq_write
|
|
* Description:
|
|
* I2c read data.
|
|
* Input:
|
|
* i2cPort - I2C port interface
|
|
* devID - the device ID
|
|
* regAddr - register address
|
|
* pData - the pointer of returned data
|
|
* count - number of sequential read
|
|
* Output:
|
|
* None
|
|
* Return:
|
|
* RT_ERR_OK
|
|
* RT_ERR_FAILED
|
|
* RT_ERR_INPUT
|
|
* RT_ERR_NULL_POINTER
|
|
* RT_ERR_CHIP_NOT_SUPPORTED
|
|
* Note:
|
|
* The ASIC doesn't support sequential write opearation
|
|
* Use multiple random write to simulate the behavior
|
|
*/
|
|
extern int32
|
|
dal_ca8279_i2c_seq_write (
|
|
rtk_i2c_port_t i2cPort,
|
|
uint32 devID,
|
|
uint32 regAddr,
|
|
uint32 *pData,
|
|
uint32 count);
|
|
|
|
#endif /*#ifndef __DAL_CA8279_I2C_H__*/
|
|
|