i2c-mp200.h

来自「The attached file is the driver of I2C」· C头文件 代码 · 共 128 行

H
128
字号
/* *  File Name       : linux/drivers/i2c/busses/i2c-mp200.h *  Function        : i2c *  Release Version : Ver 1.01 *  Release Date    : 2006/01/31 * *  Copyright (C) NEC Electronics Corporation 2005-2006 * * *  This program is free software;you can redistribute it and/or modify it under the terms of *  the GNU General Public License as published by Free Softwere Foundation; either version 2 *  of License, or (at your option) any later version. * *  This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; *  without even the implied warrnty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. *  See the GNU General Public License for more details. * *  You should have received a copy of the GNU General Public License along with this program; *  If not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, *  MA 02111-1307, USA. * */#ifndef __DRIVERS_I2C_BUSSES_I2C_MP200_H#define __DRIVERS_I2C_BUSSES_I2C_MP200_H/* INTC Reg Start */#define MP200_I2C_INTC_ADDR	IO_ADDRESS(MP200_INTC_IT0_BASE)#define MP200_I2C_INTC_REG(OFF)	(MP200_I2C_INTC_ADDR + OFF)#define MP200_I2C_INTC_IT0_RAW1	MP200_I2C_INTC_REG(0x14)#define MP200_I2C_INTC_IT0_IIR1	MP200_I2C_INTC_REG(0x28)/* INTC Reg End */#define MP200_I2C_INTC_MST_35	0x0008#define I2C_ADDR		IO_ADDRESS (MP200_I2C_BASE)#define MP200_I2C_REG(OFF)	(I2C_ADDR + OFF)#define I2C_IOSIZE		(0x2b)#define I2C_REG_IIC0		MP200_I2C_REG(0x00)	/* IIC0 shift */#define I2C_REG_IICC0		MP200_I2C_REG(0x08)	/* IIC0 control */#define I2C_REG_SVA0		MP200_I2C_REG(0x0c)	/* slave address */#define I2C_REG_IICCL0		MP200_I2C_REG(0x10)	/* IIC0 clock select */#define I2C_REG_IICX0		MP200_I2C_REG(0x14)	/* IIC0 extended function */#define I2C_REG_IICSE0		MP200_I2C_REG(0x1c)	/* For emulation */#define I2C_REG_IICF0		MP200_I2C_REG(0x28)	/* IIC flag *//* I2C IICC0 Masks (Even address) */#define I2C_BIT_IICE0		0x0080#define I2C_BIT_LREL0		0x0040#define I2C_BIT_WREL0		0x0020#define I2C_BIT_SPIE0		0x0010#define I2C_BIT_WTIM0		0x0008#define I2C_BIT_ACKE0		0x0004#define I2C_BIT_STT0		0x0002#define I2C_BIT_SPT0		0x0001/* I2C IICCL0 Masks (Even address) */#define I2C_BIT_CLD0		0x0020#define I2C_BIT_DAD0		0x0010#define I2C_BIT_SMC0		0x0008#define I2C_BIT_DFC0		0x0004#define I2C_BIT_CLO1		0x0002#define I2C_BIT_CLO0		0x0001/* I2C IICX0 Masks (Odd address) */#define I2C_BIT_CLX0		0x0100/* I2C IICSE0 Masks (Odd address) */#define I2C_BIT_MSTS0		0x8000#define I2C_BIT_ALD0		0x4000#define I2C_BIT_EXC0		0x2000#define I2C_BIT_COI0		0x1000#define I2C_BIT_TRC0		0x0800#define I2C_BIT_ACKD0		0x0400#define I2C_BIT_STD0		0x0200#define I2C_BIT_SPD0		0x0100/* I2C IICF0 Masks (Even address) */#define I2C_BIT_STCF		0x0080#define I2C_BIT_IICBSY		0x0040#define I2C_BIT_STCEN		0x0002#define I2C_BIT_IICRSV		0x0001#define I2C_M_RECV_LEN		0x0400	/* length will be first received byte */#define I2C_SMBUS_BLOCK_MAX	32	/* As specified in SMBus standard */#define I2C_SMBUS_I2C_BLOCK_MAX	32	/* Not specified but we use same structure *//* For setting of sending and receiving */#define I2C_DIR_SHIFT		1#define I2C_DIR_R		0x01#define I2C_DIR_W		0x00typedef struct i2c_ctrl {	unsigned char smc;	/* mode */	unsigned char dfc;	/* digital filter */	unsigned char clo;	/* clock speed */	unsigned char clx;	/* clock extended */} i2c_ctrl_t;/* mode */#define I2C_SMC_NORMAL_SPEED	1	/* nomal mode(maximum transfer rate 70kbit/s)(default) */#define I2C_SMC_HIGH_SPEED	2	/* high-speed mode(maximum transfer rate 250kbit/s) *//* digital filter */#define I2C_DFC_OFF		1	/* digital filter OFF (default) */#define I2C_DFC_ON		2	/* digital filter ON *//* clock speed */#define I2C_CLO_1		1	/* if nomal mode,      2.00MHz <= Fxx <= 4.19MHz (default)					   if high-speed mode, 4.00MHz <= Fxx <= 8.38MHz */#define I2C_CLO_2		2	/* if nomal mode,      4.19MHz <= Fxx <= 8.38MHz					   if high-speed mode, 4.00MHz <= Fxx <= 8.38MHz */#define I2C_CLO_3		3	/* if nomal mode,      4.19MHz <= Fxx <= 8.38MHz					   if high-speed mode, 4.00MHz <= Fxx <= 8.38MHz */#define I2C_CLO_4		4	/* if nomal mode,      6.4MHz support					   if high-speed mode, 6.4MHz support *//* clock extended */#define I2C_CLX_NORMAL		1	/* above speed (default) */#define I2C_CLX_HIGH		2	/* speedup for high-speed mode */#define I2C_SET_CTRL		_IOW('i', 0x01, struct i2c_ctrl *)#define I2C_GET_CTRL		_IOR('i', 0x02, struct i2c_ctrl *)/* mp200 wait */#define MP200_I2C_WAIT		6	/* wait 6us after STT0 */#endif				/* __DRIVERS_I2C_BUSSES_I2C_MP200_H */

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?