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

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

?? ircomm_tty.c

?? 優龍2410linux2.6.8內核源代碼
?? C
?? 第 1 頁 / 共 3 頁
字號:
/********************************************************************* *                 * Filename:      ircomm_tty.c * Version:       1.0 * Description:   IrCOMM serial TTY driver * Status:        Experimental. * Author:        Dag Brattli <dagb@cs.uit.no> * Created at:    Sun Jun  6 21:00:56 1999 * Modified at:   Wed Feb 23 00:09:02 2000 * Modified by:   Dag Brattli <dagb@cs.uit.no> * Sources:       serial.c and previous IrCOMM work by Takahide Higuchi *  *     Copyright (c) 1999-2000 Dag Brattli, All Rights Reserved. *     Copyright (c) 2000-2003 Jean Tourrilhes <jt@hpl.hp.com> *      *     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., 59 Temple Place, Suite 330, Boston,  *     MA 02111-1307 USA *      ********************************************************************/#include <linux/config.h>#include <linux/init.h>#include <linux/module.h>#include <linux/fs.h>#include <linux/sched.h>#include <linux/termios.h>#include <linux/tty.h>#include <linux/interrupt.h>#include <linux/device.h>		/* for MODULE_ALIAS_CHARDEV_MAJOR */#include <asm/uaccess.h>#include <net/irda/irda.h>#include <net/irda/irmod.h>#include <net/irda/ircomm_core.h>#include <net/irda/ircomm_param.h>#include <net/irda/ircomm_tty_attach.h>#include <net/irda/ircomm_tty.h>static int  ircomm_tty_open(struct tty_struct *tty, struct file *filp);static void ircomm_tty_close(struct tty_struct * tty, struct file *filp);static int  ircomm_tty_write(struct tty_struct * tty, int from_user,			     const unsigned char *buf, int count);static int  ircomm_tty_write_room(struct tty_struct *tty);static void ircomm_tty_throttle(struct tty_struct *tty);static void ircomm_tty_unthrottle(struct tty_struct *tty);static int  ircomm_tty_chars_in_buffer(struct tty_struct *tty);static void ircomm_tty_flush_buffer(struct tty_struct *tty);static void ircomm_tty_send_xchar(struct tty_struct *tty, char ch);static void ircomm_tty_wait_until_sent(struct tty_struct *tty, int timeout);static void ircomm_tty_hangup(struct tty_struct *tty);static void ircomm_tty_do_softint(void *private_);static void ircomm_tty_shutdown(struct ircomm_tty_cb *self);static int ircomm_tty_data_indication(void *instance, void *sap,				      struct sk_buff *skb);static int ircomm_tty_control_indication(void *instance, void *sap,					 struct sk_buff *skb);static void ircomm_tty_flow_indication(void *instance, void *sap, 				       LOCAL_FLOW cmd);#ifdef CONFIG_PROC_FSstatic int ircomm_tty_read_proc(char *buf, char **start, off_t offset, int len,				int *eof, void *unused);#endif /* CONFIG_PROC_FS */static struct tty_driver *driver;hashbin_t *ircomm_tty = NULL;static struct tty_operations ops = {	.open            = ircomm_tty_open,	.close           = ircomm_tty_close,	.write           = ircomm_tty_write,	.write_room      = ircomm_tty_write_room,	.chars_in_buffer = ircomm_tty_chars_in_buffer,	.flush_buffer    = ircomm_tty_flush_buffer,	.ioctl           = ircomm_tty_ioctl,	/* ircomm_tty_ioctl.c */	.tiocmget        = ircomm_tty_tiocmget,	/* ircomm_tty_ioctl.c */	.tiocmset        = ircomm_tty_tiocmset,	/* ircomm_tty_ioctl.c */	.throttle        = ircomm_tty_throttle,	.unthrottle      = ircomm_tty_unthrottle,	.send_xchar      = ircomm_tty_send_xchar,	.set_termios     = ircomm_tty_set_termios,	.stop            = ircomm_tty_stop,	.start           = ircomm_tty_start,	.hangup          = ircomm_tty_hangup,	.wait_until_sent = ircomm_tty_wait_until_sent,#ifdef CONFIG_PROC_FS	.read_proc       = ircomm_tty_read_proc,#endif /* CONFIG_PROC_FS */};/* * Function ircomm_tty_init() * *    Init IrCOMM TTY layer/driver * */int __init ircomm_tty_init(void){	driver = alloc_tty_driver(IRCOMM_TTY_PORTS);	if (!driver)		return -ENOMEM;	ircomm_tty = hashbin_new(HB_LOCK); 	if (ircomm_tty == NULL) {		ERROR("%s(), can't allocate hashbin!\n", __FUNCTION__);		put_tty_driver(driver);		return -ENOMEM;	}	driver->owner		= THIS_MODULE;	driver->driver_name     = "ircomm";	driver->name            = "ircomm";	driver->devfs_name      = "ircomm";	driver->major           = IRCOMM_TTY_MAJOR;	driver->minor_start     = IRCOMM_TTY_MINOR;	driver->type            = TTY_DRIVER_TYPE_SERIAL;	driver->subtype         = SERIAL_TYPE_NORMAL;	driver->init_termios    = tty_std_termios;	driver->init_termios.c_cflag = B9600 | CS8 | CREAD | HUPCL | CLOCAL;	driver->flags           = TTY_DRIVER_REAL_RAW;	tty_set_operations(driver, &ops);	if (tty_register_driver(driver)) {		ERROR("%s(): Couldn't register serial driver\n", __FUNCTION__);		put_tty_driver(driver);		return -1;	}	return 0;}static void __exit __ircomm_tty_cleanup(struct ircomm_tty_cb *self){	IRDA_DEBUG(0, "%s()\n", __FUNCTION__ );	ASSERT(self != NULL, return;);	ASSERT(self->magic == IRCOMM_TTY_MAGIC, return;);	ircomm_tty_shutdown(self);	self->magic = 0;	kfree(self);}/* * Function ircomm_tty_cleanup () * *    Remove IrCOMM TTY layer/driver * */void __exit ircomm_tty_cleanup(void){	int ret;	IRDA_DEBUG(4, "%s()\n", __FUNCTION__ );		ret = tty_unregister_driver(driver);        if (ret) {                ERROR("%s(), failed to unregister driver\n", __FUNCTION__);		return;	}	hashbin_delete(ircomm_tty, (FREE_FUNC) __ircomm_tty_cleanup);	put_tty_driver(driver);}/* * Function ircomm_startup (self) * *     * */static int ircomm_tty_startup(struct ircomm_tty_cb *self){	notify_t notify;	int ret = -ENODEV;	IRDA_DEBUG(2, "%s()\n", __FUNCTION__ );	ASSERT(self != NULL, return -1;);	ASSERT(self->magic == IRCOMM_TTY_MAGIC, return -1;);	/* Check if already open */	if (test_and_set_bit(ASYNC_B_INITIALIZED, &self->flags)) {		IRDA_DEBUG(2, "%s(), already open so break out!\n", __FUNCTION__ );		return 0;	}	/* Register with IrCOMM */	irda_notify_init(&notify);	/* These callbacks we must handle ourselves */	notify.data_indication       = ircomm_tty_data_indication;	notify.udata_indication      = ircomm_tty_control_indication; 	notify.flow_indication       = ircomm_tty_flow_indication;	/* Use the ircomm_tty interface for these ones */ 	notify.disconnect_indication = ircomm_tty_disconnect_indication;	notify.connect_confirm       = ircomm_tty_connect_confirm; 	notify.connect_indication    = ircomm_tty_connect_indication;	strlcpy(notify.name, "ircomm_tty", sizeof(notify.name));	notify.instance = self;	if (!self->ircomm) {		self->ircomm = ircomm_open(&notify, self->service_type, 					   self->line);	}	if (!self->ircomm)		goto err;	self->slsap_sel = self->ircomm->slsap_sel;	/* Connect IrCOMM link with remote device */	ret = ircomm_tty_attach_cable(self);	if (ret < 0) {		ERROR("%s(), error attaching cable!\n", __FUNCTION__);		goto err;	}	return 0;err:	clear_bit(ASYNC_B_INITIALIZED, &self->flags);	return ret;}/* * Function ircomm_block_til_ready (self, filp) * *     * */static int ircomm_tty_block_til_ready(struct ircomm_tty_cb *self, 				      struct file *filp){	DECLARE_WAITQUEUE(wait, current);	int		retval;	int		do_clocal = 0, extra_count = 0;	unsigned long	flags;	struct tty_struct *tty;		IRDA_DEBUG(2, "%s()\n", __FUNCTION__ );	tty = self->tty;	/*	 * If non-blocking mode is set, or the port is not enabled,	 * then make the check up front and then exit.	 */		if (filp->f_flags & O_NONBLOCK || tty->flags & (1 << TTY_IO_ERROR)){		/* nonblock mode is set or port is not enabled */		self->flags |= ASYNC_NORMAL_ACTIVE;		IRDA_DEBUG(1, "%s(), O_NONBLOCK requested!\n", __FUNCTION__ );		return 0;	}	if (tty->termios->c_cflag & CLOCAL) {		IRDA_DEBUG(1, "%s(), doing CLOCAL!\n", __FUNCTION__ );		do_clocal = 1;	}		/* Wait for carrier detect and the line to become	 * free (i.e., not in use by the callout).  While we are in	 * this loop, self->open_count is dropped by one, so that	 * mgsl_close() knows when to free things.  We restore it upon	 * exit, either normal or abnormal.	 */	 	retval = 0;	add_wait_queue(&self->open_wait, &wait);		IRDA_DEBUG(2, "%s(%d):block_til_ready before block on %s open_count=%d\n",	      __FILE__,__LINE__, tty->driver->name, self->open_count );	/* As far as I can see, we protect open_count - Jean II */	spin_lock_irqsave(&self->spinlock, flags);	if (!tty_hung_up_p(filp)) {		extra_count = 1;		self->open_count--;	}	spin_unlock_irqrestore(&self->spinlock, flags);	self->blocked_open++;		while (1) {		if (tty->termios->c_cflag & CBAUD) {			/* Here, we use to lock those two guys, but			 * as ircomm_param_request() does it itself,			 * I don't see the point (and I see the deadlock).			 * Jean II */			self->settings.dte |= IRCOMM_RTS + IRCOMM_DTR;		 				ircomm_param_request(self, IRCOMM_DTE, TRUE);		}				current->state = TASK_INTERRUPTIBLE;				if (tty_hung_up_p(filp) ||		    !test_bit(ASYNC_B_INITIALIZED, &self->flags)) {			retval = (self->flags & ASYNC_HUP_NOTIFY) ?					-EAGAIN : -ERESTARTSYS;			break;		}				/*  		 * Check if link is ready now. Even if CLOCAL is		 * specified, we cannot return before the IrCOMM link is		 * ready 		 */ 		if (!test_bit(ASYNC_B_CLOSING, &self->flags) && 		    (do_clocal || (self->settings.dce & IRCOMM_CD)) &&		    self->state == IRCOMM_TTY_READY)		{ 			break;		}					if (signal_pending(current)) {			retval = -ERESTARTSYS;			break;		}				IRDA_DEBUG(1, "%s(%d):block_til_ready blocking on %s open_count=%d\n",		      __FILE__,__LINE__, tty->driver->name, self->open_count );				schedule();	}		__set_current_state(TASK_RUNNING);	remove_wait_queue(&self->open_wait, &wait);		if (extra_count) {		/* ++ is not atomic, so this should be protected - Jean II */		spin_lock_irqsave(&self->spinlock, flags);		self->open_count++;		spin_unlock_irqrestore(&self->spinlock, flags);	}	self->blocked_open--;		IRDA_DEBUG(1, "%s(%d):block_til_ready after blocking on %s open_count=%d\n",	      __FILE__,__LINE__, tty->driver->name, self->open_count);			 	if (!retval)		self->flags |= ASYNC_NORMAL_ACTIVE;			return retval;	}/* * Function ircomm_tty_open (tty, filp) * *    This routine is called when a particular tty device is opened. This *    routine is mandatory; if this routine is not filled in, the attempted *    open will fail with ENODEV. */static int ircomm_tty_open(struct tty_struct *tty, struct file *filp){	struct ircomm_tty_cb *self;	unsigned int line;	unsigned long	flags;	int ret;	IRDA_DEBUG(2, "%s()\n", __FUNCTION__ );	line = tty->index;	if ((line < 0) || (line >= IRCOMM_TTY_PORTS)) {		return -ENODEV;	}	/* Check if instance already exists */	self = hashbin_lock_find(ircomm_tty, line, NULL);	if (!self) {		/* No, so make new instance */		self = kmalloc(sizeof(struct ircomm_tty_cb), GFP_KERNEL);		if (self == NULL) {			ERROR("%s(), kmalloc failed!\n", __FUNCTION__);			return -ENOMEM;		}		memset(self, 0, sizeof(struct ircomm_tty_cb));				self->magic = IRCOMM_TTY_MAGIC;		self->flow = FLOW_STOP;		self->line = line;		INIT_WORK(&self->tqueue, ircomm_tty_do_softint, self);		self->max_header_size = IRCOMM_TTY_HDR_UNINITIALISED;		self->max_data_size = IRCOMM_TTY_DATA_UNINITIALISED;		self->close_delay = 5*HZ/10;		self->closing_wait = 30*HZ;		/* Init some important stuff */		init_timer(&self->watchdog_timer);		init_waitqueue_head(&self->open_wait); 		init_waitqueue_head(&self->close_wait);		spin_lock_init(&self->spinlock);		/* 		 * Force TTY into raw mode by default which is usually what		 * we want for IrCOMM and IrLPT. This way applications will		 * not have to twiddle with printcap etc.  		 */		tty->termios->c_iflag = 0;		tty->termios->c_oflag = 0;		/* Insert into hash */		hashbin_insert(ircomm_tty, (irda_queue_t *) self, line, NULL);	}	/* ++ is not atomic, so this should be protected - Jean II */	spin_lock_irqsave(&self->spinlock, flags);	self->open_count++;	tty->driver_data = self;	self->tty = tty;	spin_unlock_irqrestore(&self->spinlock, flags);	IRDA_DEBUG(1, "%s(), %s%d, count = %d\n", __FUNCTION__ , tty->driver->name, 		   self->line, self->open_count);	/* Not really used by us, but lets do it anyway */	self->tty->low_latency = (self->flags & ASYNC_LOW_LATENCY) ? 1 : 0;	/*	 * If the port is the middle of closing, bail out now	 */	if (tty_hung_up_p(filp) ||	    test_bit(ASYNC_B_CLOSING, &self->flags)) {		/* Hm, why are we blocking on ASYNC_CLOSING if we		 * do return -EAGAIN/-ERESTARTSYS below anyway?		 * IMHO it's either not needed in the first place		 * or for some reason we need to make sure the async		 * closing has been finished - if so, wouldn't we		 * probably better sleep uninterruptible?		 */		if (wait_event_interruptible(self->close_wait, !test_bit(ASYNC_B_CLOSING, &self->flags))) {			WARNING("%s - got signal while blocking on ASYNC_CLOSING!\n",				__FUNCTION__);			return -ERESTARTSYS;		}#ifdef SERIAL_DO_RESTART		return ((self->flags & ASYNC_HUP_NOTIFY) ?			-EAGAIN : -ERESTARTSYS);#else		return -EAGAIN;#endif	}	/* Check if this is a "normal" ircomm device, or an irlpt device */	if (line < 0x10) {		self->service_type = IRCOMM_3_WIRE | IRCOMM_9_WIRE;		self->settings.service_type = IRCOMM_9_WIRE; /* 9 wire as default */		/* Jan Kiszka -> add DSR/RI -> Conform to IrCOMM spec */		self->settings.dce = IRCOMM_CTS | IRCOMM_CD | IRCOMM_DSR | IRCOMM_RI; /* Default line settings */		IRDA_DEBUG(2, "%s(), IrCOMM device\n", __FUNCTION__ );	} else {		IRDA_DEBUG(2, "%s(), IrLPT device\n", __FUNCTION__ );		self->service_type = IRCOMM_3_WIRE_RAW;		self->settings.service_type = IRCOMM_3_WIRE_RAW; /* Default */	}	ret = ircomm_tty_startup(self);	if (ret)		return ret;	ret = ircomm_tty_block_til_ready(self, filp);	if (ret) {

?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
一区二区三区视频在线看| 中文字幕乱码日本亚洲一区二区| 一区二区三区色| 欧美亚男人的天堂| 亚洲一级电影视频| 这里是久久伊人| 国内精品视频一区二区三区八戒| 精品国产乱码久久久久久牛牛| 国产伦精品一区二区三区视频青涩| 久久一夜天堂av一区二区三区| 国产福利不卡视频| 亚洲免费视频成人| 91精品在线麻豆| 国模冰冰炮一区二区| 国产精品妹子av| 欧美系列一区二区| 久久99精品国产.久久久久| 中文字幕国产一区| 欧美色精品天天在线观看视频| 美脚の诱脚舐め脚责91| 中文一区一区三区高中清不卡| 色视频成人在线观看免| 日本怡春院一区二区| 国产网站一区二区| 欧美日韩一区二区欧美激情| 韩国女主播成人在线观看| 亚洲青青青在线视频| 日韩欧美美女一区二区三区| 懂色av中文一区二区三区| 亚洲一区二区免费视频| 久久蜜桃香蕉精品一区二区三区| av电影在线观看完整版一区二区| 午夜欧美电影在线观看| 国产亚洲一区二区三区四区| 欧美影院一区二区| 国产精品资源在线观看| 亚洲成av人综合在线观看| 久久久三级国产网站| 欧美日韩中文字幕一区二区| 国产成人亚洲综合a∨婷婷图片| 亚洲一区二区三区在线| 国产情人综合久久777777| 欧美老人xxxx18| 不卡的看片网站| 国产一区二区三区久久悠悠色av| 亚洲国产精品久久久男人的天堂| 久久久精品免费免费| 在线播放一区二区三区| 99麻豆久久久国产精品免费优播| 精品一区在线看| 亚洲电影视频在线| 亚洲精品国产品国语在线app| 久久老女人爱爱| 日韩一区二区三免费高清| 色综合视频一区二区三区高清| 久久91精品久久久久久秒播| 天天影视涩香欲综合网| 亚洲免费观看在线观看| 国产精品进线69影院| 欧美精品一区在线观看| 91精品免费观看| 欧美系列日韩一区| 91丨porny丨首页| 成人av在线影院| 粉嫩久久99精品久久久久久夜| 久久精品国产免费看久久精品| 亚洲动漫第一页| 亚洲综合一区二区三区| 亚洲精品视频免费看| 国产精品国产三级国产普通话99| 久久伊人中文字幕| 久久久精品中文字幕麻豆发布| 日韩免费高清视频| 欧美一区三区四区| 欧美一区二区三区人| 欧美一区二区精品久久911| 欧美高清你懂得| 欧美高清性hdvideosex| 5月丁香婷婷综合| 欧美日本在线播放| 欧美一三区三区四区免费在线看| 欧美电影影音先锋| 91精品在线麻豆| 欧美大片顶级少妇| 久久精品一区二区三区四区| 国产午夜亚洲精品不卡| 久久久久久麻豆| 中文在线免费一区三区高中清不卡| 国产欧美日韩精品一区| 国产精品久久久久久亚洲毛片| 国产精品传媒在线| 亚洲欧美国产77777| 亚洲一区在线观看网站| 日本午夜精品一区二区三区电影| 免费观看日韩av| 国产一区二区三区四区五区入口| 国产激情91久久精品导航| 风间由美中文字幕在线看视频国产欧美| 国产精品羞羞答答xxdd| 91麻豆国产福利在线观看| 91国偷自产一区二区使用方法| 欧美日韩五月天| 欧美变态凌虐bdsm| 国产精品三级在线观看| 亚洲伦理在线免费看| 奇米色一区二区| 国产寡妇亲子伦一区二区| 91视频在线看| 欧美一区二区免费| 国产精品国产三级国产普通话99| 亚洲伊人伊色伊影伊综合网| 久久精品国产精品亚洲精品| 成人白浆超碰人人人人| 欧美日韩国产成人在线免费| 精品乱人伦一区二区三区| 中文字幕日本乱码精品影院| 亚洲一区中文日韩| 国产精品1区二区.| 欧美色图一区二区三区| 久久久久久久久久久黄色| 亚洲小说欧美激情另类| 国产一区二区电影| 色系网站成人免费| 精品国产不卡一区二区三区| 亚洲欧美日韩国产成人精品影院| 美女网站色91| 色老综合老女人久久久| 久久色.com| 视频一区在线播放| 97久久超碰精品国产| 久久综合九色综合欧美就去吻| 亚洲综合一区二区三区| 国产成人丝袜美腿| 欧美成人三级在线| 亚洲电影一区二区三区| 不卡的av电影| 久久综合久久99| 婷婷国产v国产偷v亚洲高清| 不卡av电影在线播放| 久久欧美一区二区| 捆绑变态av一区二区三区| 欧美三级中文字幕在线观看| 国产欧美日韩中文久久| 麻豆91在线观看| 欧美日韩中文精品| 亚洲理论在线观看| 99久久伊人久久99| 久久久亚洲国产美女国产盗摄 | 91国偷自产一区二区使用方法| 欧美成人女星排名| 日本亚洲视频在线| 欧美日韩免费不卡视频一区二区三区| 国产精品亲子伦对白| 国产一区免费电影| 精品国产免费人成电影在线观看四季 | 欧美日韩aaaaa| 亚洲精品美腿丝袜| 一本大道久久a久久综合| 中文字幕一区三区| 成人午夜视频网站| 欧美激情一区二区三区| 国产一区二区三区在线看麻豆| 日韩精品专区在线影院重磅| 天堂av在线一区| 666欧美在线视频| 日本亚洲免费观看| 欧美一区二区三区免费视频 | 色8久久人人97超碰香蕉987| 一色桃子久久精品亚洲| 91色porny| 亚洲美女区一区| 欧美中文字幕一区| 亚洲综合在线五月| 欧美日韩国产色站一区二区三区| 亚洲精品美国一| 欧美日韩精品欧美日韩精品一| 天天做天天摸天天爽国产一区| 欧美日韩电影一区| 蜜桃91丨九色丨蝌蚪91桃色| 欧美不卡一区二区三区四区| 精品在线视频一区| 国产欧美一区二区三区在线看蜜臀 | 午夜在线成人av| 欧美一区二区三区爱爱| 精品在线一区二区三区| 国产午夜精品一区二区| proumb性欧美在线观看| 亚洲精品你懂的| 欧美一区二区日韩| 国产一区二区剧情av在线| 欧美经典三级视频一区二区三区| 99麻豆久久久国产精品免费优播| 一区二区三区在线视频播放| 9191成人精品久久| 国产在线不卡一区| 亚洲乱码国产乱码精品精的特点 | 91麻豆国产在线观看| 亚洲成人av一区二区三区| 日韩欧美高清一区| 国产91富婆露脸刺激对白|