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

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

?? bw-qcam.c

?? powerpc內核mpc8241linux系統下char驅動程序
?? C
?? 第 1 頁 / 共 2 頁
字號:
/* *    QuickCam Driver For Video4Linux. * *	This version only works as a module. * *	Video4Linux conversion work by Alan Cox. *	Parport compatibility by Phil Blundell. *	Busy loop avoidance by Mark Cooke. * *    Module parameters: * *	maxpoll=<1 - 5000> * *	  When polling the QuickCam for a response, busy-wait for a *	  maximum of this many loops. The default of 250 gives little *	  impact on interactive response. * *	  NOTE: If this parameter is set too high, the processor *		will busy wait until this loop times out, and then *		slowly poll for a further 5 seconds before failing *		the transaction. You have been warned. * *	yieldlines=<1 - 250> * *	  When acquiring a frame from the camera, the data gathering *	  loop will yield back to the scheduler after completing *	  this many lines. The default of 4 provides a trade-off *	  between increased frame acquisition time and impact on *	  interactive response. *//* qcam-lib.c -- Library for programming with the Connectix QuickCam. * See the included documentation for usage instructions and details * of the protocol involved. *//* Version 0.5, August 4, 1996 *//* Version 0.7, August 27, 1996 *//* Version 0.9, November 17, 1996 *//******************************************************************Copyright (C) 1996 by Scott LairdPermission is hereby granted, free of charge, to any person obtaininga copy of this software and associated documentation files (the"Software"), to deal in the Software without restriction, includingwithout limitation the rights to use, copy, modify, merge, publish,distribute, sublicense, and/or sell copies of the Software, and topermit persons to whom the Software is furnished to do so, subject tothe following conditions:The above copyright notice and this permission notice shall beincluded in all copies or substantial portions of the Software.THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OFMERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.IN NO EVENT SHALL SCOTT LAIRD BE LIABLE FOR ANY CLAIM, DAMAGES OROTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OROTHER DEALINGS IN THE SOFTWARE.******************************************************************/#include <linux/module.h>#include <linux/delay.h>#include <linux/errno.h>#include <linux/fs.h>#include <linux/init.h>#include <linux/kernel.h>#include <linux/malloc.h>#include <linux/mm.h>#include <linux/parport.h>#include <linux/sched.h>#include <linux/version.h>#include <linux/videodev.h>#include <asm/uaccess.h>#include "bw-qcam.h"#if LINUX_VERSION_CODE >= 0x020117MODULE_PARM(maxpoll,"i");MODULE_PARM(yieldlines,"i");   #endifstatic unsigned int maxpoll=250;   /* Maximum busy-loop count for qcam I/O */static unsigned int yieldlines=4;  /* Yield after this many during capture */extern __inline__ int read_lpstatus(struct qcam_device *q){	return parport_read_status(q->pport);}extern __inline__ int read_lpcontrol(struct qcam_device *q){	return parport_read_control(q->pport);}extern __inline__ int read_lpdata(struct qcam_device *q){	return parport_read_data(q->pport);}extern __inline__ void write_lpdata(struct qcam_device *q, int d){	parport_write_data(q->pport, d);}extern __inline__ void write_lpcontrol(struct qcam_device *q, int d){	parport_write_control(q->pport, d);}static int qc_waithand(struct qcam_device *q, int val);static int qc_command(struct qcam_device *q, int command);static int qc_readparam(struct qcam_device *q);static int qc_setscanmode(struct qcam_device *q);static int qc_readbytes(struct qcam_device *q, char buffer[]);static struct video_device qcam_template;static int qc_calibrate(struct qcam_device *q){	/*	 *	Bugfix by Hanno Mueller hmueller@kabel.de, Mai 21 96	 *	The white balance is an individiual value for each	 *	quickcam.	 */	int value;	int count = 0;	qc_command(q, 27);	/* AutoAdjustOffset */	qc_command(q, 0);	/* Dummy Parameter, ignored by the camera */	/* GetOffset (33) will read 255 until autocalibration */	/* is finished. After that, a value of 1-254 will be */	/* returned. */	do {		qc_command(q, 33);		value = qc_readparam(q);		mdelay(1);		schedule();		count++;	} while (value == 0xff && count<2048);	q->whitebal = value;	return value;}/* Initialize the QuickCam driver control structure.  This is where * defaults are set for people who don't have a config file.*/static struct qcam_device *qcam_init(struct parport *port){	struct qcam_device *q;		q = kmalloc(sizeof(struct qcam_device), GFP_KERNEL);	q->pport = port;	q->pdev = parport_register_device(port, "bw-qcam", NULL, NULL,					  NULL, 0, NULL);	if (q->pdev == NULL) 	{		printk(KERN_ERR "bw-qcam: couldn't register for %s.\n",		       port->name);		kfree(q);		return NULL;	}		memcpy(&q->vdev, &qcam_template, sizeof(qcam_template));	q->port_mode = (QC_ANY | QC_NOTSET);	q->width = 320;	q->height = 240;	q->bpp = 4;	q->transfer_scale = 2;	q->contrast = 192;	q->brightness = 180;	q->whitebal = 105;	q->top = 1;	q->left = 14;	q->mode = -1;	q->status = QC_PARAM_CHANGE;	return q;}/* qc_command is probably a bit of a misnomer -- it's used to send * bytes *to* the camera.  Generally, these bytes are either commands * or arguments to commands, so the name fits, but it still bugs me a * bit.  See the documentation for a list of commands. */static int qc_command(struct qcam_device *q, int command){	int n1, n2;	int cmd;	write_lpdata(q, command);	write_lpcontrol(q, 6);	n1 = qc_waithand(q, 1);	write_lpcontrol(q, 0xe);	n2 = qc_waithand(q, 0);	cmd = (n1 & 0xf0) | ((n2 & 0xf0) >> 4);	return cmd;}static int qc_readparam(struct qcam_device *q){	int n1, n2;	int cmd;	write_lpcontrol(q, 6);	n1 = qc_waithand(q, 1);	write_lpcontrol(q, 0xe);	n2 = qc_waithand(q, 0);	cmd = (n1 & 0xf0) | ((n2 & 0xf0) >> 4);	return cmd;}/* qc_waithand busy-waits for a handshake signal from the QuickCam. * Almost all communication with the camera requires handshaking. */static int qc_waithand(struct qcam_device *q, int val){	int status;	int runs=0;	if (val)	{		while (!((status = read_lpstatus(q)) & 8))		{			/* 1000 is enough spins on the I/O for all normal			   cases, at that point we start to poll slowly 			   until the camera wakes up. However, we are			   busy blocked until the camera responds, so			   setting it lower is much better for interactive			   response. */			   			if(runs++>maxpoll)			{				current->state=TASK_INTERRUPTIBLE;				schedule_timeout(HZ/200);			}			if(runs>(maxpoll+1000)) /* 5 seconds */				return -1;		}	}	else	{		while (((status = read_lpstatus(q)) & 8))		{			/* 1000 is enough spins on the I/O for all normal			   cases, at that point we start to poll slowly 			   until the camera wakes up. However, we are			   busy blocked until the camera responds, so			   setting it lower is much better for interactive			   response. */			   			if(runs++>maxpoll)			{				current->state=TASK_INTERRUPTIBLE;				schedule_timeout(HZ/200);			}			if(runs++>(maxpoll+1000)) /* 5 seconds */				return -1;		}	}	return status;}/* Waithand2 is used when the qcam is in bidirectional mode, and the * handshaking signal is CamRdy2 (bit 0 of data reg) instead of CamRdy1 * (bit 3 of status register).  It also returns the last value read, * since this data is useful. */static unsigned int qc_waithand2(struct qcam_device *q, int val){	unsigned int status;	int runs=0;		do 	{		status = read_lpdata(q);		/* 1000 is enough spins on the I/O for all normal		   cases, at that point we start to poll slowly 		   until the camera wakes up. However, we are		   busy blocked until the camera responds, so		   setting it lower is much better for interactive		   response. */		   		if(runs++>maxpoll)		{			current->state=TASK_INTERRUPTIBLE;			schedule_timeout(HZ/200);		}		if(runs++>(maxpoll+1000)) /* 5 seconds */			return 0;	}	while ((status & 1) != val);	return status;}/* Try to detect a QuickCam.  It appears to flash the upper 4 bits of   the status register at 5-10 Hz.  This is only used in the autoprobe   code.  Be aware that this isn't the way Connectix detects the   camera (they send a reset and try to handshake), but this should be   almost completely safe, while their method screws up my printer if   I plug it in before the camera. */static int qc_detect(struct qcam_device *q){	int reg, lastreg;	int count = 0;	int i;	lastreg = reg = read_lpstatus(q) & 0xf0;	for (i = 0; i < 500; i++) 	{		reg = read_lpstatus(q) & 0xf0;		if (reg != lastreg)			count++;		lastreg = reg;		mdelay(2);	}#if 0	/* Force camera detection during testing. Sometimes the camera	   won't be flashing these bits. Possibly unloading the module	   in the middle of a grab? Or some timeout condition?	   I've seen this parameter as low as 19 on my 450Mhz box - mpc */	printk("Debugging: QCam detection counter <30-200 counts as detected>: %d\n", count);	return 1;#endif	/* Be (even more) liberal in what you accept...  *//*	if (count > 30 && count < 200) */	if (count > 20 && count < 300)		return 1;	/* found */	else		return 0;	/* not found */}/* Reset the QuickCam.  This uses the same sequence the Windows * QuickPic program uses.  Someone with a bi-directional port should * check that bi-directional mode is detected right, and then * implement bi-directional mode in qc_readbyte(). */static void qc_reset(struct qcam_device *q){	switch (q->port_mode & QC_FORCE_MASK) 	{		case QC_FORCE_UNIDIR:			q->port_mode = (q->port_mode & ~QC_MODE_MASK) | QC_UNIDIR;			break;		case QC_FORCE_BIDIR:			q->port_mode = (q->port_mode & ~QC_MODE_MASK) | QC_BIDIR;			break;		case QC_ANY:			write_lpcontrol(q, 0x20);			write_lpdata(q, 0x75);				if (read_lpdata(q) != 0x75) {				q->port_mode = (q->port_mode & ~QC_MODE_MASK) | QC_BIDIR;			} else {				q->port_mode = (q->port_mode & ~QC_MODE_MASK) | QC_UNIDIR;			}			break;	}	write_lpcontrol(q, 0xb);	udelay(250);	write_lpcontrol(q, 0xe);	qc_setscanmode(q);		/* in case port_mode changed */}/* Decide which scan mode to use.  There's no real requirement that * the scanmode match the resolution in q->height and q-> width -- the * camera takes the picture at the resolution specified in the * "scanmode" and then returns the image at the resolution specified * with the resolution commands.  If the scan is bigger than the * requested resolution, the upper-left hand corner of the scan is * returned.  If the scan is smaller, then the rest of the image * returned contains garbage. */static int qc_setscanmode(struct qcam_device *q){	int old_mode = q->mode;		switch (q->transfer_scale) 	{		case 1:			q->mode = 0;			break;		case 2:			q->mode = 4;			break;		case 4:			q->mode = 8;			break;	}	switch (q->bpp) 	{		case 4:			break;		case 6:			q->mode += 2;			break;	}	switch (q->port_mode & QC_MODE_MASK) 	{		case QC_BIDIR:			q->mode += 1;			break;		case QC_NOTSET:		case QC_UNIDIR:			break;	}		if (q->mode != old_mode)		q->status |= QC_PARAM_CHANGE;		return 0;}/* Reset the QuickCam and program for brightness, contrast, * white-balance, and resolution. */void qc_set(struct qcam_device *q){	int val;	int val2;	qc_reset(q);	/* Set the brightness.  Yes, this is repetitive, but it works.	 * Shorter versions seem to fail subtly.  Feel free to try :-). */	/* I think the problem was in qc_command, not here -- bls */		qc_command(q, 0xb);	qc_command(q, q->brightness);	val = q->height / q->transfer_scale;	qc_command(q, 0x11);	qc_command(q, val);	if ((q->port_mode & QC_MODE_MASK) == QC_UNIDIR && q->bpp == 6) {		/* The normal "transfers per line" calculation doesn't seem to work		   as expected here (and yet it works fine in qc_scan).  No idea		   why this case is the odd man out.  Fortunately, Laird's original		   working version gives me a good way to guess at working values.		   -- bls */		val = q->width;		val2 = q->transfer_scale * 4;	} else {		val = q->width * q->bpp;		val2 = (((q->port_mode & QC_MODE_MASK) == QC_BIDIR) ? 24 : 8) *		    q->transfer_scale;	}	val = (val + val2 - 1) / val2;	qc_command(q, 0x13);	qc_command(q, val);	/* Setting top and left -- bls */	qc_command(q, 0xd);	qc_command(q, q->top);	qc_command(q, 0xf);	qc_command(q, q->left / 2);	qc_command(q, 0x19);	qc_command(q, q->contrast);	qc_command(q, 0x1f);	qc_command(q, q->whitebal);	/* Clear flag that we must update the grabbing parameters on the camera	   before we grab the next frame */	q->status &= (~QC_PARAM_CHANGE);}/* Qc_readbytes reads some bytes from the QC and puts them in   the supplied buffer.  It returns the number of bytes read,   or -1 on error. */extern __inline__ int qc_readbytes(struct qcam_device *q, char buffer[]){	int ret=1;	unsigned int hi, lo;	unsigned int hi2, lo2;	static int state = 0;	if (buffer == NULL) 	{		state = 0;		return 0;	}		switch (q->port_mode & QC_MODE_MASK) 	{		case QC_BIDIR:		/* Bi-directional Port */			write_lpcontrol(q, 0x26);			lo = (qc_waithand2(q, 1) >> 1);			hi = (read_lpstatus(q) >> 3) & 0x1f;			write_lpcontrol(q, 0x2e);			lo2 = (qc_waithand2(q, 0) >> 1);			hi2 = (read_lpstatus(q) >> 3) & 0x1f;			switch (q->bpp) 			{				case 4:					buffer[0] = lo & 0xf;

?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
暴力调教一区二区三区| 无码av免费一区二区三区试看| 免费成人在线网站| 欧美男人的天堂一二区| 亚洲第一综合色| 555夜色666亚洲国产免| 久久精品国产精品青草| 精品国产乱码久久久久久蜜臀| 精彩视频一区二区| 2020国产精品| av午夜精品一区二区三区| 亚洲精品视频免费看| 欧美日韩免费视频| 轻轻草成人在线| 国产亚洲综合在线| a美女胸又www黄视频久久| 亚洲乱码日产精品bd| 制服.丝袜.亚洲.中文.综合| 看片网站欧美日韩| 国产精品美女久久久久aⅴ| 91久久精品一区二区二区| 爽好多水快深点欧美视频| 欧美福利视频导航| 国产精品99久久久久| 综合久久久久久久| 欧美一区二区三区免费在线看 | 激情综合网天天干| 日本一区二区免费在线观看视频| 不卡av电影在线播放| 天堂一区二区在线免费观看| 中文字幕在线免费不卡| 在线观看视频一区二区| 国产在线观看免费一区| ...xxx性欧美| 7777精品伊人久久久大香线蕉经典版下载 | 久久综合九色综合欧美98| 91亚洲国产成人精品一区二三| 亚洲成人黄色影院| 国产欧美一区二区在线观看| 欧美日韩在线播放一区| 国产91精品一区二区麻豆网站| 亚洲影视在线播放| 国产网站一区二区三区| 欧美日韩午夜在线| 懂色一区二区三区免费观看| 午夜一区二区三区视频| 亚洲欧美自拍偷拍| 亚洲精品在线网站| 欧美色成人综合| 国产91精品免费| 美腿丝袜亚洲综合| 亚洲黄色录像片| 国产精品午夜免费| 亚洲精品一区二区三区影院| 欧美系列亚洲系列| 97se亚洲国产综合自在线不卡| 精品综合免费视频观看| 污片在线观看一区二区 | 国产精品久久久久一区二区三区 | 国产精品女上位| 日韩一区二区电影在线| 91麻豆福利精品推荐| 国产91对白在线观看九色| 蜜臀久久99精品久久久久宅男| 亚洲精品免费在线| 亚洲婷婷在线视频| 国产精品麻豆久久久| 欧美精品一区二区三| 欧美一级黄色大片| 中文字幕欧美区| 精品毛片乱码1区2区3区| 欧美日韩亚洲丝袜制服| 欧美亚洲动漫精品| 在线免费av一区| 日本精品视频一区二区| 99精品热视频| 99riav久久精品riav| 粉嫩久久99精品久久久久久夜| 国产精品综合二区| 国产高清在线精品| 国产麻豆精品95视频| 狠狠狠色丁香婷婷综合久久五月| 热久久国产精品| 久久精品免费看| 久久99日本精品| 国产美女久久久久| 粉嫩高潮美女一区二区三区| 国产很黄免费观看久久| 成人av网址在线观看| 一本大道久久a久久综合婷婷| 色噜噜久久综合| 欧美浪妇xxxx高跟鞋交| 欧美一卡2卡三卡4卡5免费| 欧美tickling网站挠脚心| 久久久久99精品一区| 中文字幕制服丝袜一区二区三区| 国产精品入口麻豆原神| 综合色天天鬼久久鬼色| 亚洲自拍偷拍网站| 日韩av一级电影| 国产一区三区三区| 丰满白嫩尤物一区二区| 91国在线观看| 在线电影院国产精品| 久久在线免费观看| 国产精品成人在线观看| 亚洲成a人片在线观看中文| 蜜桃久久av一区| 成人精品gif动图一区| 在线日韩一区二区| 欧美一区二区三区四区在线观看| 久久综合国产精品| 亚洲免费资源在线播放| 喷白浆一区二区| 国产成人av电影在线| 欧美亚洲一区三区| 精品少妇一区二区| 成人免费一区二区三区在线观看| 亚洲福利视频三区| 国产成人在线视频网站| 欧洲一区在线电影| 精品国产乱码久久| 亚洲嫩草精品久久| 国产尤物一区二区| 欧美三区免费完整视频在线观看| 26uuu国产电影一区二区| 一区二区三区四区国产精品| 美女视频一区在线观看| 91丨九色丨国产丨porny| 日韩理论片一区二区| 亚洲va欧美va人人爽午夜| 国产成人在线视频播放| 欧美精品久久久久久久久老牛影院| 久久精品一区二区三区四区| 午夜久久久久久久久久一区二区| 国产成人免费xxxxxxxx| 91精品久久久久久久久99蜜臂| 亚洲欧洲av色图| 国产伦精一区二区三区| 欧美精品在线视频| 中文字幕人成不卡一区| 国产乱对白刺激视频不卡| 制服视频三区第一页精品| 一区二区三区视频在线观看| 国产寡妇亲子伦一区二区| 日韩欧美综合在线| 亚洲超丰满肉感bbw| 北条麻妃国产九九精品视频| 精品欧美久久久| 日韩成人免费电影| 在线观看日韩电影| 综合色中文字幕| 99久久99久久精品免费观看| 久久久精品tv| 国产在线观看一区二区| 日韩视频一区二区在线观看| 亚洲国产中文字幕在线视频综合| 99久久亚洲一区二区三区青草 | 懂色av一区二区三区蜜臀| 欧美日韩电影在线播放| 一区二区高清视频在线观看| 成人app软件下载大全免费| 久久久久一区二区三区四区| 日本网站在线观看一区二区三区 | 欧美激情一区二区三区不卡| 精品午夜一区二区三区在线观看| 91精品黄色片免费大全| 亚洲国产毛片aaaaa无费看| 欧美综合一区二区三区| 亚洲精品日韩一| 91免费观看国产| 成人欧美一区二区三区1314| 91影院在线免费观看| 国产精品色在线观看| 国产高清视频一区| 国产精品色噜噜| av电影一区二区| 亚洲欧美影音先锋| 91视频在线看| 亚洲一区在线电影| 欧美日韩日日摸| 免费日本视频一区| 日韩美女视频一区二区在线观看| 男人的天堂久久精品| 精品国产乱码久久久久久1区2区| 久久99国产精品成人| 久久蜜臀精品av| 成人免费高清视频在线观看| √…a在线天堂一区| 欧洲国产伦久久久久久久| 午夜久久久久久久久| 欧美电影免费提供在线观看| 国产一区91精品张津瑜| 综合久久久久综合| 欧美视频在线一区二区三区 | 亚洲一区中文在线| 欧美一级二级在线观看| 国产成人在线色| 亚洲欧美另类小说| 91精品国产欧美一区二区18|