亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频

? 歡迎來到蟲蟲下載站! | ?? 資源下載 ?? 資源專輯 ?? 關于我們
? 蟲蟲下載站

?? i2c-algo-ite.c

?? linux和2410結合開發 用他可以生成2410所需的zImage文件
?? C
?? 第 1 頁 / 共 2 頁
字號:
/*   -------------------------------------------------------------------------   i2c-algo-ite.c i2c driver algorithms for ITE adapters	          Hai-Pao Fan, MontaVista Software, Inc.   hpfan@mvista.com or source@mvista.com   Copyright 2000 MontaVista Software Inc.   ---------------------------------------------------------------------------   This file was highly leveraged from i2c-algo-pcf.c, which was created   by Simon G. Vogl and Hans Berglund:     Copyright (C) 1995-1997 Simon G. Vogl                   1998-2000 Hans Berglund    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    the Free Software Foundation; either version 2 of the 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 warranty 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., 675 Mass Ave, Cambridge, MA 02139, USA.		     *//* ------------------------------------------------------------------------- *//* With some changes from Ky鰏ti M鋖kki <kmalkki@cc.hut.fi> and    Frodo Looijaard <frodol@dds.nl> ,and also from Martin Bailey   <mbailey@littlefeet-inc.com> */#include <linux/kernel.h>#include <linux/module.h>#include <linux/delay.h>#include <linux/slab.h>#include <linux/version.h>#include <linux/init.h>#include <asm/uaccess.h>#include <linux/ioport.h>#include <linux/errno.h>#include <linux/sched.h>#include <linux/i2c.h>#include <linux/i2c-algo-ite.h>#include "i2c-ite.h"#define	PM_DSR		IT8172_PCI_IO_BASE + IT_PM_DSR#define	PM_IBSR		IT8172_PCI_IO_BASE + IT_PM_DSR + 0x04 #define GPIO_CCR	IT8172_PCI_IO_BASE + IT_GPCCR/* ----- global defines ----------------------------------------------- */#define DEB(x) if (i2c_debug>=1) x#define DEB2(x) if (i2c_debug>=2) x#define DEB3(x) if (i2c_debug>=3) x /* print several statistical values*/#define DEBPROTO(x) if (i2c_debug>=9) x; 	/* debug the protocol by showing transferred bits */#define DEF_TIMEOUT 16/* debugging - slow down transfer to have a look at the data .. 	*//* I use this with two leds&resistors, each one connected to sda,scl 	*//* respectively. This makes sure that the algorithm works. Some chips   *//* might not like this, as they have an internal timeout of some mils	*//*#define SLO_IO      jif=jiffies;while(jiffies<=jif+i2c_table[minor].veryslow)\                        if (need_resched) schedule();*//* ----- global variables ---------------------------------------------	*/#ifdef SLO_IO	int jif;#endif/* module parameters: */static int i2c_debug=1;static int iic_test=0;	/* see if the line-setting functions work	*/static int iic_scan=0;	/* have a look at what's hanging 'round		*//* --- setting states on the bus with the right timing: ---------------	*/#define get_clock(adap) adap->getclock(adap->data)#define iic_outw(adap, reg, val) adap->setiic(adap->data, reg, val)#define iic_inw(adap, reg) adap->getiic(adap->data, reg)/* --- other auxiliary functions --------------------------------------	*/static void iic_start(struct i2c_algo_iic_data *adap){	iic_outw(adap,ITE_I2CHCR,ITE_CMD);}static void iic_stop(struct i2c_algo_iic_data *adap){	iic_outw(adap,ITE_I2CHCR,0);	iic_outw(adap,ITE_I2CHSR,ITE_I2CHSR_TDI);}static void iic_reset(struct i2c_algo_iic_data *adap){	iic_outw(adap, PM_IBSR, iic_inw(adap, PM_IBSR) | 0x80);}static int wait_for_bb(struct i2c_algo_iic_data *adap){	int timeout = DEF_TIMEOUT;	short status;	status = iic_inw(adap, ITE_I2CHSR);#ifndef STUB_I2C	while (timeout-- && (status & ITE_I2CHSR_HB)) {		udelay(1000); /* How much is this? */		status = iic_inw(adap, ITE_I2CHSR);	}#endif	if (timeout<=0) {		printk(KERN_ERR "Timeout, host is busy\n");		iic_reset(adap);	}	return(timeout<=0);}/* * Puts this process to sleep for a period equal to timeout  */static inline void iic_sleep(unsigned long timeout){	schedule_timeout( timeout * HZ);}/* After we issue a transaction on the IIC bus, this function * is called.  It puts this process to sleep until we get an interrupt from * from the controller telling us that the transaction we requested in complete. */static int wait_for_pin(struct i2c_algo_iic_data *adap, short *status) {	int timeout = DEF_TIMEOUT;		timeout = wait_for_bb(adap);	if (timeout) {  		DEB2(printk("Timeout waiting for host not busy\n");)  		return -EIO;	}                           	timeout = DEF_TIMEOUT;	*status = iic_inw(adap, ITE_I2CHSR);#ifndef STUB_I2C	while (timeout-- && !(*status & ITE_I2CHSR_TDI)) {	   adap->waitforpin();	   *status = iic_inw(adap, ITE_I2CHSR);	}#endif	if (timeout <= 0)		return(-1);	else		return(0);}static int wait_for_fe(struct i2c_algo_iic_data *adap, short *status){	int timeout = DEF_TIMEOUT;	*status = iic_inw(adap, ITE_I2CFSR);#ifndef STUB_I2C 	while (timeout-- && (*status & ITE_I2CFSR_FE)) {		udelay(1000);		iic_inw(adap, ITE_I2CFSR);	}#endif	if (timeout <= 0) 		return(-1);	else		return(0);}static int iic_init (struct i2c_algo_iic_data *adap){	short i;	/* Clear bit 7 to set I2C to normal operation mode */	i=iic_inw(adap, PM_DSR)& 0xff7f;	iic_outw(adap, PM_DSR, i);	/* set IT_GPCCR port C bit 2&3 as function 2 */	i = iic_inw(adap, GPIO_CCR) & 0xfc0f;	iic_outw(adap,GPIO_CCR,i);	/* Clear slave address/sub-address */	iic_outw(adap,ITE_I2CSAR, 0);	iic_outw(adap,ITE_I2CSSAR, 0);	/* Set clock counter register */	iic_outw(adap,ITE_I2CCKCNT, get_clock(adap));	/* Set START/reSTART/STOP time registers */	iic_outw(adap,ITE_I2CSHDR, 0x0a);	iic_outw(adap,ITE_I2CRSUR, 0x0a);	iic_outw(adap,ITE_I2CPSUR, 0x0a);	/* Enable interrupts on completing the current transaction */	iic_outw(adap,ITE_I2CHCR, ITE_I2CHCR_IE | ITE_I2CHCR_HCE);	/* Clear transfer count */	iic_outw(adap,ITE_I2CFBCR, 0x0);	DEB2(printk("iic_init: Initialized IIC on ITE 0x%x\n",		iic_inw(adap, ITE_I2CHSR)));	return 0;}/* * Sanity check for the adapter hardware - check the reaction of * the bus lines only if it seems to be idle. */static int test_bus(struct i2c_algo_iic_data *adap, char *name) {#if 0	int scl,sda;	sda=getsda(adap);	if (adap->getscl==NULL) {		printk("test_bus: Warning: Adapter can't read from clock line - skipping test.\n");		return 0;			}	scl=getscl(adap);	printk("test_bus: Adapter: %s scl: %d  sda: %d -- testing...\n",	name,getscl(adap),getsda(adap));	if (!scl || !sda ) {		printk("test_bus: %s seems to be busy.\n",adap->name);		goto bailout;	}	sdalo(adap);	printk("test_bus:1 scl: %d  sda: %d \n",getscl(adap),	       getsda(adap));	if ( 0 != getsda(adap) ) {		printk("test_bus: %s SDA stuck high!\n",name);		sdahi(adap);		goto bailout;	}	if ( 0 == getscl(adap) ) {		printk("test_bus: %s SCL unexpected low while pulling SDA low!\n",			name);		goto bailout;	}			sdahi(adap);	printk("test_bus:2 scl: %d  sda: %d \n",getscl(adap),	       getsda(adap));	if ( 0 == getsda(adap) ) {		printk("test_bus: %s SDA stuck low!\n",name);		sdahi(adap);		goto bailout;	}	if ( 0 == getscl(adap) ) {		printk("test_bus: %s SCL unexpected low while SDA high!\n",		       adap->name);	goto bailout;	}	scllo(adap);	printk("test_bus:3 scl: %d  sda: %d \n",getscl(adap),	       getsda(adap));	if ( 0 != getscl(adap) ) {		sclhi(adap);		goto bailout;	}	if ( 0 == getsda(adap) ) {		printk("test_bus: %s SDA unexpected low while pulling SCL low!\n",			name);		goto bailout;	}	sclhi(adap);	printk("test_bus:4 scl: %d  sda: %d \n",getscl(adap),	       getsda(adap));	if ( 0 == getscl(adap) ) {		printk("test_bus: %s SCL stuck low!\n",name);		sclhi(adap);		goto bailout;	}	if ( 0 == getsda(adap) ) {		printk("test_bus: %s SDA unexpected low while SCL high!\n",			name);		goto bailout;	}	printk("test_bus: %s passed test.\n",name);	return 0;bailout:	sdahi(adap);	sclhi(adap);	return -ENODEV;#endif	return (0);}/* ----- Utility functions *//* Verify the device we want to talk to on the IIC bus really exists. */static inline int try_address(struct i2c_algo_iic_data *adap,		       unsigned int addr, int retries){	int i, ret = -1;	short status;	for (i=0;i<retries;i++) {		iic_outw(adap, ITE_I2CSAR, addr);		iic_start(adap);		if (wait_for_pin(adap, &status) == 0) {			if ((status & ITE_I2CHSR_DNE) == 0) { 				iic_stop(adap);				iic_outw(adap, ITE_I2CFCR, ITE_I2CFCR_FLUSH);				ret=1;				break;	/* success! */			}		}		iic_stop(adap);		udelay(adap->udelay);	}	DEB2(if (i) printk("try_address: needed %d retries for 0x%x\n",i,	                   addr));	return ret;}static int iic_sendbytes(struct i2c_adapter *i2c_adap,const char *buf,                         int count){	struct i2c_algo_iic_data *adap = i2c_adap->algo_data;	int wrcount=0, timeout;	short status;	int loops, remainder, i, j;	union {		char byte[2];		unsigned short word;	} tmp;   	iic_outw(adap, ITE_I2CSSAR, (unsigned short)buf[wrcount++]);	count--;	if (count == 0)		return -EIO;	loops =  count / 32;		/* 32-byte FIFO */	remainder = count % 32;	if(loops) {		for(i=0; i<loops; i++) {			iic_outw(adap, ITE_I2CFBCR, 32);			for(j=0; j<32/2; j++) {				tmp.byte[1] = buf[wrcount++];				tmp.byte[0] = buf[wrcount++];				iic_outw(adap, ITE_I2CFDR, tmp.word); 			}			/* status FIFO overrun */			iic_inw(adap, ITE_I2CFSR);			iic_inw(adap, ITE_I2CFBCR);			iic_outw(adap, ITE_I2CHCR, ITE_WRITE);	/* Issue WRITE command */			/* Wait for transmission to complete */			timeout = wait_for_pin(adap, &status);			if(timeout) {				iic_stop(adap);				printk("iic_sendbytes: %s write timeout.\n", i2c_adap->name);				return -EREMOTEIO; /* got a better one ?? */     	}			if (status & ITE_I2CHSR_DB) {				iic_stop(adap);				printk("iic_sendbytes: %s write error - no ack.\n", i2c_adap->name);				return -EREMOTEIO; /* got a better one ?? */			}		}	}	if(remainder) {		iic_outw(adap, ITE_I2CFBCR, remainder);		for(i=0; i<remainder/2; i++) {			tmp.byte[1] = buf[wrcount++];			tmp.byte[0] = buf[wrcount++];			iic_outw(adap, ITE_I2CFDR, tmp.word);		}		/* status FIFO overrun */		iic_inw(adap, ITE_I2CFSR);		iic_inw(adap, ITE_I2CFBCR);		iic_outw(adap, ITE_I2CHCR, ITE_WRITE);  /* Issue WRITE command */		timeout = wait_for_pin(adap, &status);		if(timeout) {			iic_stop(adap);			printk("iic_sendbytes: %s write timeout.\n", i2c_adap->name);			return -EREMOTEIO; /* got a better one ?? */		}#ifndef STUB_I2C		if (status & ITE_I2CHSR_DB) { 			iic_stop(adap);			printk("iic_sendbytes: %s write error - no ack.\n", i2c_adap->name);			return -EREMOTEIO; /* got a better one ?? */		}#endif	}	iic_stop(adap);	return wrcount;}static int iic_readbytes(struct i2c_adapter *i2c_adap, char *buf, int count,	int sread){	int rdcount=0, i, timeout;	short status;	struct i2c_algo_iic_data *adap = i2c_adap->algo_data;	int loops, remainder, j;	union {		char byte[2];		unsigned short word;	} tmp;			loops = count / 32;				/* 32-byte FIFO */	remainder = count % 32;	if(loops) {		for(i=0; i<loops; i++) {			iic_outw(adap, ITE_I2CFBCR, 32);			if (sread)				iic_outw(adap, ITE_I2CHCR, ITE_SREAD);			else				iic_outw(adap, ITE_I2CHCR, ITE_READ);		/* Issue READ command */

?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
色婷婷国产精品| 成人久久18免费网站麻豆| 精品视频全国免费看| 亚洲精品ww久久久久久p站| 一本色道久久加勒比精品| 一级中文字幕一区二区| 欧美日韩激情一区二区三区| 婷婷久久综合九色综合绿巨人| 欧美一区三区四区| 国产一区二区三区不卡在线观看| 久久午夜免费电影| 日本福利一区二区| 蜜桃av一区二区| 国产欧美一区二区三区网站 | 精品一区二区三区免费毛片爱 | 欧美伊人久久久久久久久影院 | 国产女人18水真多18精品一级做| 99久久精品国产观看| 亚洲成人午夜电影| 久久久午夜电影| 99re这里只有精品首页| 三级不卡在线观看| 国产精品美女久久久久高潮| 欧美丝袜丝nylons| 韩国欧美国产一区| 亚洲美女精品一区| 欧美电影免费提供在线观看| 成人国产精品免费观看| 视频一区欧美日韩| 亚洲欧美在线另类| 日韩欧美在线123| 97se亚洲国产综合自在线观| 婷婷国产在线综合| 国产精品久久久久久久久动漫| 欧美乱妇一区二区三区不卡视频| 成人妖精视频yjsp地址| 青青草成人在线观看| 亚洲欧洲国产专区| 久久嫩草精品久久久久| 欧美日韩aaaaaa| 99精品视频在线免费观看| 麻豆极品一区二区三区| 亚洲国产精品视频| 亚洲欧洲av色图| 国产午夜亚洲精品不卡| 日韩一级二级三级精品视频| 一本大道久久a久久综合| 国产精品一二三四五| 日日骚欧美日韩| 夜夜精品视频一区二区| 欧美激情中文字幕一区二区| 日韩一级大片在线| 欧美视频在线一区| 色诱视频网站一区| 成人国产在线观看| 国产成人99久久亚洲综合精品| 秋霞国产午夜精品免费视频| 一区二区三区 在线观看视频 | 亚洲人成在线播放网站岛国| 欧美国产日韩在线观看| 久久久精品蜜桃| 精品国产乱码久久久久久夜甘婷婷| 欧美中文字幕不卡| 91国偷自产一区二区开放时间 | 国产精品自在欧美一区| 另类人妖一区二区av| 青青草成人在线观看| 日韩在线播放一区二区| 亚洲午夜在线视频| 亚洲一线二线三线视频| 亚洲另类春色国产| 亚洲精品乱码久久久久久黑人| 亚洲欧美日韩一区二区 | 日本强好片久久久久久aaa| 亚洲一区二区三区精品在线| 一区二区三区日韩欧美| 亚洲精品伦理在线| 亚洲成人综合视频| 日韩av在线播放中文字幕| 午夜视频一区在线观看| 午夜精品视频一区| 麻豆精品精品国产自在97香蕉| 麻豆91在线看| 国产精品一区三区| www.成人在线| 在线观看欧美精品| 欧美人妇做爰xxxⅹ性高电影| 欧美精品一卡两卡| 精品电影一区二区| 日本一区二区三区高清不卡| 18成人在线视频| 亚洲一线二线三线视频| 奇米影视一区二区三区小说| 国产一区久久久| 成人久久久精品乱码一区二区三区| 99热在这里有精品免费| 欧洲一区在线电影| 91精品国产色综合久久ai换脸| 日韩亚洲欧美高清| 国产精品高清亚洲| 亚洲成人手机在线| 国产美女在线精品| 99国产精品久久久久久久久久久| 在线一区二区三区四区| 欧美一级在线视频| 国产精品视频线看| 性做久久久久久| 国产精品亚洲第一| 色天天综合久久久久综合片| 日韩视频中午一区| 亚洲欧洲日产国产综合网| 日本伊人色综合网| 成人污视频在线观看| 色999日韩国产欧美一区二区| 日韩亚洲欧美中文三级| 中文字幕中文字幕一区| 日韩国产在线观看| 成人高清视频在线| 欧美一区二区三区免费视频| 国产精品每日更新| 日韩av一区二| 99久久久精品免费观看国产蜜| 91精品国产综合久久精品| 中文字幕在线一区| 麻豆精品在线看| 日本高清免费不卡视频| 久久精品视频在线看| 亚洲一二三专区| av亚洲精华国产精华精华| 91精品国产免费| 亚洲精品国产a| 国产91精品露脸国语对白| 制服视频三区第一页精品| 日韩美女视频一区二区| 国产在线视频一区二区| 精品视频一区三区九区| 最近日韩中文字幕| 国产美女精品人人做人人爽| 欧美日韩成人高清| 亚洲另类色综合网站| 成人午夜激情视频| 精品国产亚洲一区二区三区在线观看| 亚洲三级在线观看| 成人黄色国产精品网站大全在线免费观看| 在线不卡免费欧美| 夜夜嗨av一区二区三区中文字幕| 国产凹凸在线观看一区二区| 日韩午夜电影在线观看| 亚洲va在线va天堂| 色噜噜狠狠色综合欧洲selulu| 中文欧美字幕免费| 国产激情一区二区三区| 亚洲精品一区二区三区精华液 | aaa亚洲精品| 国产亚洲精品福利| 九一久久久久久| 日韩欧美黄色影院| 另类欧美日韩国产在线| 欧美一二三在线| 免费观看在线色综合| 337p亚洲精品色噜噜噜| 一区二区理论电影在线观看| 日本精品视频一区二区三区| 中文字幕色av一区二区三区| av激情综合网| 中文字幕一区二区三中文字幕| 成人高清免费在线播放| 国产精品激情偷乱一区二区∴| 成人一区二区三区视频在线观看| 国产亚洲制服色| 国产白丝精品91爽爽久久| 日本一区二区三区四区| gogo大胆日本视频一区| 亚洲另类在线制服丝袜| 欧美在线免费视屏| 日韩和欧美一区二区三区| 91精品国产综合久久蜜臀| 精品在线免费视频| 久久色在线观看| 成人精品小蝌蚪| 一区二区三区四区高清精品免费观看 | 日韩亚洲国产中文字幕欧美| 美腿丝袜亚洲综合| 久久女同精品一区二区| eeuss鲁片一区二区三区| 亚洲欧美乱综合| 在线电影国产精品| 激情深爱一区二区| 国产精品超碰97尤物18| 欧美在线免费观看视频| 蜜桃视频免费观看一区| 久久精品亚洲精品国产欧美| 91亚洲资源网| 午夜一区二区三区视频| 精品乱人伦小说| 一本大道综合伊人精品热热| 日本亚洲三级在线| 欧美激情在线一区二区| 在线看国产日韩| 国内精品嫩模私拍在线|