📄 i2c.h
字号:
/*------------------------------------------------------------------------
$Workfile: I2C.H $
$Date: 6/20/97 3:48p $
$Revision: 6 $
* Purpose:
* Header for I2C support routines.
* Notes:
* This header also define bit definitions for I2C bus control
* register on ADV601 evaluation board.
*
$History: I2C.H $
*
* ***************** Version 6 *****************
* User: Stevel Date: 6/20/97 Time: 3:48p
* Updated in $/601cman
* remove some of the Video Lab Card Control register bit definition to
* vlab.h.
*
* ***************** Version 5 *****************
* User: Dstarr Date: 5/29/96 Time: 8:35a
* Updated in $/601cman
* Add #define DMA_ENABLE bit to the 22v10 Pal control register. Improve
* comments on other bit names.
*
* ***************** Version 4 *****************
* User: Dstarr Date: 4/09/96 Time: 9:42a
* Updated in $/601cman
* Catch 32 fix. See lengthy comment in i2c.c Callers of set & clr mcsr
* bit should be recompiled.
*
*
* ***************** Version 3 *****************
* User: Dstarr Date: 4/03/96 Time: 11:57a
* Updated in $/601cman
* clr and set mcscr bit now return the bit pattern they wrote to the main
* cmd & status register. This is of interest to 601test, but probably no
* one else.
*
* ***************** Version 2 *****************
* User: Stevel Date: 3/10/96 Time: 10:14p
* Updated in $/601cman
* Add DLLEXPORT keyword to export functions for diagnostic test.
*
* ***************** Version 1 *****************
* User: Stevel Date: 3/06/96 Time: 7:55p
* Created in $/601cman
* Initial release
This code and information is provided "as is" without warranty of any
kind, either expressed or implied, including but not limited to the
implied warranties of merchantability and/or fitness for a particular
purpose.
1996 Analog Devices, Inc.
-------------------------------------------------------------------------*/
/* I2c error code symbolic names */
#define I2C_BAD_ADDR_WR 2
#define I2C_BAD_ACK 4
#define I2C_BAD_DATA_WR 8
#define I2C_BAD_CHIPID 0x10
#define I2C_BAD_DATA_RD 0x20
#define I2C_STUCK_CLK 0x40
#define DLLEXPORT __declspec(dllexport)
//=================================================================
// I2C Function prototypes
//=================================================================
DLLEXPORT int I2CInit(dword * ptr);
DLLEXPORT void Delay(int);
DLLEXPORT int I2CStart(void);
DLLEXPORT int I2CStop(void);
DLLEXPORT int I2CWriteAck(void);
DLLEXPORT int I2CReadAck(void);
DLLEXPORT int I2CBitWrite(byte);
DLLEXPORT byte I2CBitRead(void);
DLLEXPORT int I2CWriteAddr(byte);
DLLEXPORT int I2CWriteData(byte);
DLLEXPORT byte I2CReadData(void);
DLLEXPORT dword ClockCycleCalibrate();
DLLEXPORT int rite_i2c_chip(void * ptr, int subaddr,int nreg );
DLLEXPORT int readhard_i2c_chip(void * hisptr, int subaddr,int nreg );
DLLEXPORT int read_i2c_chip(void * ptr, int subaddr,int nreg );
DLLEXPORT word set_mcsrbit (word);
DLLEXPORT word clr_mcsrbit (word);
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -