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

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

?? ov511.c

?? 本源代碼為USB攝像頭的驅(qū)動程序
?? C
?? 第 1 頁 / 共 5 頁
字號:
			goto error;		}	}	return 0;error:	err("i2c write: error %d", rc);	return rc;}/* NOTE: Do not call this function directly! * The OV518 I2C I/O procedure is different, hence, this function. * This is normally only called from ov51x_i2c_read(). Note that this function * always succeeds regardless of whether the sensor is present and working. */static int ov518_i2c_read_internal(struct usb_device *dev, unsigned char reg){	int rc, value;	/* Select camera register */	rc = ov511_reg_write(dev, OV511_REG_I2C_SUB_ADDRESS_2_BYTE, reg);	if (rc < 0) goto error;	/* Initiate 2-byte write cycle */	rc = ov511_reg_write(dev, OV518_REG_I2C_CONTROL, 0x03);	if (rc < 0) goto error;	/* Initiate 2-byte read cycle */	rc = ov511_reg_write(dev, OV518_REG_I2C_CONTROL, 0x05);	if (rc < 0) goto error;	value = ov511_reg_read(dev, OV511_REG_I2C_DATA_PORT);	PDEBUG(5, "0x%02X:0x%02X", reg, value);	return value;error:	err("ov518 i2c read: error %d", rc);	return rc;}/* NOTE: Do not call this function directly! * returns: negative is error, pos or zero is data */static int ov511_i2c_read_internal(struct usb_device *dev, unsigned char reg){	int rc, value, retries;	/* Two byte write cycle */	for (retries = OV511_I2C_RETRIES; ; ) {		/* Select camera register */		rc = ov511_reg_write(dev, OV511_REG_I2C_SUB_ADDRESS_2_BYTE,				     reg);		if (rc < 0) goto error;		/* Initiate 2-byte write cycle */		rc = ov511_reg_write(dev, OV511_REG_I2C_CONTROL, 0x03);		if (rc < 0) goto error;		do rc = ov511_reg_read(dev, OV511_REG_I2C_CONTROL);		while (rc > 0 && ((rc&1) == 0)); /* Retry until idle */		if (rc < 0) goto error;		if ((rc&2) == 0) /* Ack? */			break;		/* I2C abort */			ov511_reg_write(dev, OV511_REG_I2C_CONTROL, 0x10);		if (--retries < 0) {			err("i2c write retries exhausted");			rc = -1;			goto error;		}	}	/* Two byte read cycle */	for (retries = OV511_I2C_RETRIES; ; ) {		/* Initiate 2-byte read cycle */		rc = ov511_reg_write(dev, OV511_REG_I2C_CONTROL, 0x05);		if (rc < 0) goto error;		do rc = ov511_reg_read(dev, OV511_REG_I2C_CONTROL);		while (rc > 0 && ((rc&1) == 0)); /* Retry until idle */		if (rc < 0) goto error;		if ((rc&2) == 0) /* Ack? */			break;		/* I2C abort */			rc = ov511_reg_write(dev, OV511_REG_I2C_CONTROL, 0x10);		if (rc < 0) goto error;		if (--retries < 0) {			err("i2c read retries exhausted");			rc = -1;			goto error;		}	}	value = ov511_reg_read(dev, OV511_REG_I2C_DATA_PORT);	PDEBUG(5, "0x%02X:0x%02X", reg, value);			/* This is needed to make ov51x_i2c_write() work */	rc = ov511_reg_write(dev, OV511_REG_I2C_CONTROL, 0x05);	if (rc < 0)		goto error;		return value;error:	err("i2c read: error %d", rc);	return rc;}/* returns: negative is error, pos or zero is data */static int ov51x_i2c_read(struct usb_ov511 *ov511, unsigned char reg){	int rc;	struct usb_device *dev = ov511->dev;	down(&ov511->i2c_lock);	if (dev->descriptor.idProduct == PROD_OV518 ||	    dev->descriptor.idProduct == PROD_OV518PLUS)		rc = ov518_i2c_read_internal(dev, reg);	else		rc = ov511_i2c_read_internal(dev, reg);	up(&ov511->i2c_lock);	return rc;}static int ov51x_i2c_write(struct usb_ov511 *ov511,		unsigned char reg,		unsigned char value){	int rc;	struct usb_device *dev = ov511->dev;	down(&ov511->i2c_lock);	if (dev->descriptor.idProduct == PROD_OV518 ||	    dev->descriptor.idProduct == PROD_OV518PLUS)		rc = ov518_i2c_write_internal(dev, reg, value);	else		rc = ov511_i2c_write_internal(dev, reg, value);	up(&ov511->i2c_lock);	return rc;}/* Do not call this function directly! */static int ov51x_i2c_write_mask_internal(struct usb_device *dev,			      unsigned char reg,			      unsigned char value,			      unsigned char mask){	int rc;	unsigned char oldval, newval;	if (mask == 0xff) {		newval = value;	} else {		if (dev->descriptor.idProduct == PROD_OV518 ||		    dev->descriptor.idProduct == PROD_OV518PLUS)			rc = ov518_i2c_read_internal(dev, reg);		else			rc = ov511_i2c_read_internal(dev, reg);		if (rc < 0)			return rc;		oldval = (unsigned char) rc;		oldval &= (~mask);		/* Clear the masked bits */		value &= mask;			/* Enforce mask on value */		newval = oldval | value;	/* Set the desired bits */	}	if (dev->descriptor.idProduct == PROD_OV518 ||	    dev->descriptor.idProduct == PROD_OV518PLUS)		return (ov518_i2c_write_internal(dev, reg, newval));	else		return (ov511_i2c_write_internal(dev, reg, newval));}/* Writes bits at positions specified by mask to an I2C reg. Bits that are in * the same position as 1's in "mask" are cleared and set to "value". Bits * that are in the same position as 0's in "mask" are preserved, regardless  * of their respective state in "value". */static int ov51x_i2c_write_mask(struct usb_ov511 *ov511,		     unsigned char reg,		     unsigned char value,		     unsigned char mask){	int rc;	struct usb_device *dev = ov511->dev;	down(&ov511->i2c_lock);	rc = ov51x_i2c_write_mask_internal(dev, reg, value, mask);	up(&ov511->i2c_lock);	return rc;}/* Write to a specific I2C slave ID and register, using the specified mask */static int ov51x_i2c_write_slave(struct usb_ov511 *ov511,		      unsigned char slave,		      unsigned char reg,		      unsigned char value,		      unsigned char mask){	int rc = 0;	struct usb_device *dev = ov511->dev;	down(&ov511->i2c_lock);	/* Set new slave IDs */	if (ov511_reg_write(dev, OV511_REG_I2C_SLAVE_ID_WRITE, slave) < 0) {		rc = -EIO;		goto out;	}	if (ov511_reg_write(dev, OV511_REG_I2C_SLAVE_ID_READ, slave + 1) < 0) {		rc = -EIO;		goto out;	}	rc = ov51x_i2c_write_mask_internal(dev, reg, value, mask);	/* Don't bail out yet if error; IDs must be restored */	/* Restore primary IDs */	slave = ov511->primary_i2c_slave;	if (ov511_reg_write(dev, OV511_REG_I2C_SLAVE_ID_WRITE, slave) < 0) {		rc = -EIO;		goto out;	}	if (ov511_reg_write(dev, OV511_REG_I2C_SLAVE_ID_READ, slave + 1) < 0) {		rc = -EIO;		goto out;	}out:	up(&ov511->i2c_lock);	return rc;}/* Read from a specific I2C slave ID and register */static int ov51x_i2c_read_slave(struct usb_ov511 *ov511,		     unsigned char slave,		     unsigned char reg){	int rc;	struct usb_device *dev = ov511->dev;	down(&ov511->i2c_lock);	/* Set new slave IDs */	if (ov511_reg_write(dev, OV511_REG_I2C_SLAVE_ID_WRITE, slave) < 0) {		rc = -EIO;		goto out;	}	if (ov511_reg_write(dev, OV511_REG_I2C_SLAVE_ID_READ, slave + 1) < 0) {		rc = -EIO;		goto out;	}	if (dev->descriptor.idProduct == PROD_OV518 ||	    dev->descriptor.idProduct == PROD_OV518PLUS)		rc = ov518_i2c_read_internal(dev, reg);	else		rc = ov511_i2c_read_internal(dev, reg);	/* Don't bail out yet if error; IDs must be restored */	/* Restore primary IDs */	slave = ov511->primary_i2c_slave;	if (ov511_reg_write(dev, OV511_REG_I2C_SLAVE_ID_WRITE, slave) < 0) {		rc = -EIO;		goto out;	}	if (ov511_reg_write(dev, OV511_REG_I2C_SLAVE_ID_READ, slave + 1) < 0) {		rc = -EIO;		goto out;	}out:	up(&ov511->i2c_lock);	return rc;}static int ov511_write_regvals(struct usb_ov511 *ov511,		    struct ov511_regvals * pRegvals){	int rc;	struct usb_device *dev = ov511->dev;	while (pRegvals->bus != OV511_DONE_BUS) {		if (pRegvals->bus == OV511_REG_BUS) {			if ((rc = ov511_reg_write(dev, pRegvals->reg,			                          pRegvals->val)) < 0)				goto error;		} else if (pRegvals->bus == OV511_I2C_BUS) {			if ((rc = ov51x_i2c_write(ov511, pRegvals->reg, 			                          pRegvals->val)) < 0)				goto error;		} else {			err("Bad regval array");			rc = -1;			goto error;		}		pRegvals++;	}	return 0;error:	err("write regvals: error %d", rc);	return rc;}#ifdef OV511_DEBUG static void ov511_dump_i2c_range(struct usb_ov511 *ov511, int reg1, int regn){	int i;	int rc;	for (i = reg1; i <= regn; i++) {		rc = ov51x_i2c_read(ov511, i);		info("OV7610[0x%X] = 0x%X", i, rc);	}}static void ov51x_dump_i2c_regs(struct usb_ov511 *ov511){	info("I2C REGS");	ov511_dump_i2c_range(ov511, 0x00, 0x7C);}static void ov511_dump_reg_range(struct usb_device *dev, int reg1, int regn){	int i;	int rc;	for (i = reg1; i <= regn; i++) {	  rc = ov511_reg_read(dev, i);	  info("OV511[0x%X] = 0x%X", i, rc);	}}static void ov511_dump_regs(struct usb_device *dev){	info("CAMERA INTERFACE REGS");	ov511_dump_reg_range(dev, 0x10, 0x1f);	info("DRAM INTERFACE REGS");	ov511_dump_reg_range(dev, 0x20, 0x23);	info("ISO FIFO REGS");	ov511_dump_reg_range(dev, 0x30, 0x31);	info("PIO REGS");	ov511_dump_reg_range(dev, 0x38, 0x39);	ov511_dump_reg_range(dev, 0x3e, 0x3e);	info("I2C REGS");	ov511_dump_reg_range(dev, 0x40, 0x49);	info("SYSTEM CONTROL REGS");	ov511_dump_reg_range(dev, 0x50, 0x55);	ov511_dump_reg_range(dev, 0x5e, 0x5f);	info("OmniCE REGS");	ov511_dump_reg_range(dev, 0x70, 0x79);	/* NOTE: Quantization tables are not readable. You will get the value	 * in reg. 0x79 for every table register */	ov511_dump_reg_range(dev, 0x80, 0x9f);	ov511_dump_reg_range(dev, 0xa0, 0xbf);}#endif/********************************************************************** * * Kernel I2C Interface * **********************************************************************//* For as-yet unimplemented I2C interface */static void call_i2c_clients(struct usb_ov511 *ov511, unsigned int cmd,		 void *arg){	/* Do nothing */}/*****************************************************************************/static int ov511_reset(struct usb_ov511 *ov511, unsigned char reset_type){	int rc;			/* Setting bit 0 not allowed on 518/518Plus */	if (ov511->bridge == BRG_OV518 ||	    ov511->bridge == BRG_OV518PLUS)		reset_type &= 0xfe;	PDEBUG(4, "Reset: type=0x%X", reset_type);	rc = ov511_reg_write(ov511->dev, OV511_REG_SYSTEM_RESET, reset_type);	rc = ov511_reg_write(ov511->dev, OV511_REG_SYSTEM_RESET, 0);	if (rc < 0)		err("reset: command failed");	return rc;}/* Temporarily stops OV511 from functioning. Must do this before changing * registers while the camera is streaming */static inline int ov511_stop(struct usb_ov511 *ov511){	PDEBUG(4, "stopping");	ov511->stopped = 1;		if (ov511->bridge == BRG_OV518 ||	    ov511->bridge == BRG_OV518PLUS)		return (ov511_reg_write(ov511->dev, OV511_REG_SYSTEM_RESET,					0x3a));	else		return (ov511_reg_write(ov511->dev, OV511_REG_SYSTEM_RESET,					0x3d));}/* Restarts OV511 after ov511_stop() is called. Has no effect if it is not * actually stopped (for performance). */static inline int ov511_restart(struct usb_ov511 *ov511){	if (ov511->stopped) {		PDEBUG(4, "restarting");		ov511->stopped = 0;			/* Reinitialize the stream */		if (ov511->bridge == BRG_OV518 ||		    ov511->bridge == BRG_OV518PLUS)			ov511_reg_write(ov511->dev, 0x2f, 0x80);		return (ov511_reg_write(ov511->dev, OV511_REG_SYSTEM_RESET,					0x00));	}	return 0;}/* Resets the hardware snapshot button */static void ov51x_clear_snapshot(struct usb_ov511 *ov511){	if (ov511->bridge == BRG_OV511 || ov511->bridge == BRG_OV511PLUS) {		ov511_reg_write(ov511->dev, OV511_REG_SYSTEM_SNAPSHOT, 0x01);		ov511_reg_write(ov511->dev, OV511_REG_SYSTEM_SNAPSHOT, 0x03);		ov511_reg_write(ov511->dev, OV511_REG_SYSTEM_SNAPSHOT, 0x01);	} else if (ov511->bridge == BRG_OV518 ||		   ov511->bridge == BRG_OV518PLUS) {		warn("snapshot reset not supported yet on OV518(+)");	} else {		err("clear snap: invalid bridge type");	}	}/* Checks the status of the snapshot button. Returns 1 if it was pressed since * it was last cleared, and zero in all other cases (including errors) */static int ov51x_check_snapshot(struct usb_ov511 *ov511){	int ret, status = 0;	if (ov511->bridge == BRG_OV511 || ov511->bridge == BRG_OV511PLUS) {		ret = ov511_reg_read(ov511->dev, OV511_REG_SYSTEM_SNAPSHOT);		if (ret < 0) {			err("Error checking snspshot status (%d)", ret);		} else if (ret & 0x08) {			status = 1;		}	} else if (ov511->bridge == BRG_OV518 ||		   ov511->bridge == BRG_OV518PLUS) {		warn("snapshot check not supported yet on OV518(+)");	} else {		err("check snap: invalid bridge type");	}	return status;}/* Sets I2C read and write slave IDs. Returns <0 for error */

?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
一本到三区不卡视频| 久久久久久久久久电影| 久久伊人中文字幕| 亚洲激情一二三区| 国产一区视频网站| 欧美男生操女生| 136国产福利精品导航| 久久99久久精品欧美| 色悠悠亚洲一区二区| 久久免费午夜影院| 蜜臀av一区二区在线免费观看| 国产99久久久国产精品潘金 | 日本中文在线一区| 99这里都是精品| 久久日一线二线三线suv| 三级欧美韩日大片在线看| 岛国av在线一区| 久久天堂av综合合色蜜桃网 | 夜夜精品视频一区二区| 国产精品99久久久| 欧美sm美女调教| 免费在线看成人av| 91精品国产黑色紧身裤美女| 亚洲男人电影天堂| 91视视频在线观看入口直接观看www | 欧美性受xxxx黑人xyx性爽| 国产精品美女久久久久久2018| 韩国女主播成人在线观看| 91精品国产91综合久久蜜臀| 亚洲午夜视频在线| 欧美午夜在线观看| 一区二区三区不卡视频| 99久久99久久久精品齐齐| 国产精品国模大尺度视频| 国产黄人亚洲片| 亚洲国产激情av| 99精品视频在线免费观看| 欧美激情自拍偷拍| 国产成人免费xxxxxxxx| 欧美激情一二三区| 成人黄色国产精品网站大全在线免费观看 | 欧美亚洲愉拍一区二区| 亚洲成人免费观看| 日韩欧美成人一区| 精品亚洲成a人| 亚洲国产精品成人综合| a级高清视频欧美日韩| 成人欧美一区二区三区1314| 91视视频在线观看入口直接观看www| ㊣最新国产の精品bt伙计久久| 99国产一区二区三精品乱码| 亚洲免费观看高清完整版在线| 色综合天天综合色综合av| 夜夜嗨av一区二区三区中文字幕| 欧美日韩精品一区二区在线播放| 日韩激情一二三区| 久久婷婷成人综合色| jizzjizzjizz欧美| 午夜亚洲国产au精品一区二区| 欧美一区二区三区四区在线观看 | 天天做天天摸天天爽国产一区| 欧美一级日韩一级| 懂色av一区二区在线播放| 日韩理论在线观看| 51久久夜色精品国产麻豆| 国产精品一区二区久久不卡 | 国产欧美一区二区精品婷婷 | 一区二区三区在线观看国产| 69成人精品免费视频| 国产成人在线免费| 亚洲国产成人porn| 国产午夜亚洲精品理论片色戒| 91丝袜国产在线播放| 久久精品久久久精品美女| 亚洲欧洲日韩av| 欧美xxxx老人做受| 91麻豆文化传媒在线观看| 免费观看一级特黄欧美大片| 中文字幕一区二区三区在线播放| 欧美日韩在线电影| 成人91在线观看| 日韩国产一二三区| 亚洲欧美日韩国产综合| 26uuu精品一区二区三区四区在线| 93久久精品日日躁夜夜躁欧美| 美腿丝袜在线亚洲一区| 亚洲精品精品亚洲| 国产区在线观看成人精品| 91麻豆精品国产91久久久更新时间| 成人av网址在线| 成人毛片老司机大片| 亚洲愉拍自拍另类高清精品| 中文字幕的久久| 精品噜噜噜噜久久久久久久久试看 | 久久嫩草精品久久久久| 7777精品伊人久久久大香线蕉经典版下载| 粉嫩久久99精品久久久久久夜| 另类小说色综合网站| 亚洲成a人片综合在线| 亚洲欧美一区二区三区孕妇| 久久精品人人做人人综合 | 国产精品国产三级国产普通话蜜臀| 欧美一级久久久| 欧美人与性动xxxx| 欧美曰成人黄网| 一本到不卡免费一区二区| 99re视频精品| 97精品久久久午夜一区二区三区 | 日韩理论片一区二区| 国产色婷婷亚洲99精品小说| 337p日本欧洲亚洲大胆精品| 久久综合久久鬼色| 精品福利在线导航| 久久久综合视频| 国产视频在线观看一区二区三区| 久久蜜桃一区二区| 国产欧美日韩不卡免费| 国产精品理伦片| 1区2区3区精品视频| 亚洲美女屁股眼交| 亚洲四区在线观看| 一区二区三区蜜桃| 亚洲成人午夜影院| 久草热8精品视频在线观看| 国产尤物一区二区| 国产成人免费网站| 色综合色狠狠天天综合色| 色88888久久久久久影院按摩| 91久久一区二区| 91精选在线观看| 欧美精品一区二区三区四区| 中文一区在线播放| 一区二区三区在线播放| 日韩精品国产精品| 国模一区二区三区白浆| 不卡一区二区中文字幕| 一本高清dvd不卡在线观看| 欧美亚洲自拍偷拍| 久久婷婷国产综合精品青草| 欧美激情在线一区二区| 亚洲最色的网站| 蜜臂av日日欢夜夜爽一区| 福利91精品一区二区三区| 97国产一区二区| 91精品国产综合久久久久久漫画 | 午夜精品爽啪视频| 极品销魂美女一区二区三区| 高清av一区二区| 欧美天天综合网| 久久九九久久九九| 一区二区三区中文在线观看| 麻豆精品视频在线| 91美女精品福利| 精品国产乱码久久久久久久久| 国产精品女主播av| 丝袜a∨在线一区二区三区不卡| 久久黄色级2电影| 色综合久久久久网| 久久女同性恋中文字幕| 亚洲成av人片在www色猫咪| 狠狠色综合色综合网络| 色综合视频在线观看| 久久丝袜美腿综合| 亚洲电影一区二区| 成+人+亚洲+综合天堂| 欧美va在线播放| 亚洲成人av电影在线| 成人性生交大片免费看视频在线 | 91九色最新地址| 久久精品水蜜桃av综合天堂| 午夜精品一区二区三区电影天堂| 成人综合在线视频| 日韩欧美第一区| 天堂久久久久va久久久久| 91网站最新网址| 国产欧美一区二区精品性| 另类中文字幕网| 欧美日韩国产一二三| 亚洲人成精品久久久久| 国产在线精品一区二区不卡了| 欧美性xxxxx极品少妇| 亚洲欧美日韩久久精品| 9色porny自拍视频一区二区| 久久精品一二三| 国产乱码精品一区二区三 | 亚洲伦在线观看| 国产凹凸在线观看一区二区| 91精品国产乱码| 丝袜美腿亚洲综合| 欧美美女一区二区| 亚洲成人午夜电影| 欧美三级电影网站| 亚洲影院理伦片| 在线视频综合导航| 一区二区三区在线观看动漫| 91亚洲资源网| 樱花草国产18久久久久| 在线一区二区观看| 亚洲福中文字幕伊人影院| 在线视频国产一区|