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

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

?? stallion.c

?? powerpc內核mpc8241linux系統下char驅動程序
?? C
?? 第 1 頁 / 共 5 頁
字號:
/* *	Allocate a new board structure. Fill out the basic info in it. */static stlbrd_t *stl_allocbrd(){	stlbrd_t	*brdp;	brdp = (stlbrd_t *) stl_memalloc(sizeof(stlbrd_t));	if (brdp == (stlbrd_t *) NULL) {		printk("STALLION: failed to allocate memory (size=%d)\n",			sizeof(stlbrd_t));		return((stlbrd_t *) NULL);	}	memset(brdp, 0, sizeof(stlbrd_t));	brdp->magic = STL_BOARDMAGIC;	return(brdp);}/*****************************************************************************/static int stl_open(struct tty_struct *tty, struct file *filp){	stlport_t	*portp;	stlbrd_t	*brdp;	unsigned int	minordev;	int		brdnr, panelnr, portnr, rc;#if DEBUG	printk("stl_open(tty=%x,filp=%x): device=%x\n", (int) tty,		(int) filp, tty->device);#endif	minordev = MINOR(tty->device);	brdnr = MINOR2BRD(minordev);	if (brdnr >= stl_nrbrds)		return(-ENODEV);	brdp = stl_brds[brdnr];	if (brdp == (stlbrd_t *) NULL)		return(-ENODEV);	minordev = MINOR2PORT(minordev);	for (portnr = -1, panelnr = 0; (panelnr < STL_MAXPANELS); panelnr++) {		if (brdp->panels[panelnr] == (stlpanel_t *) NULL)			break;		if (minordev < brdp->panels[panelnr]->nrports) {			portnr = minordev;			break;		}		minordev -= brdp->panels[panelnr]->nrports;	}	if (portnr < 0)		return(-ENODEV);	portp = brdp->panels[panelnr]->ports[portnr];	if (portp == (stlport_t *) NULL)		return(-ENODEV);	MOD_INC_USE_COUNT;/* *	On the first open of the device setup the port hardware, and *	initialize the per port data structure. */	portp->tty = tty;	tty->driver_data = portp;	portp->refcount++;	if ((portp->flags & ASYNC_INITIALIZED) == 0) {		if (portp->tx.buf == (char *) NULL) {			portp->tx.buf = (char *) stl_memalloc(STL_TXBUFSIZE);			if (portp->tx.buf == (char *) NULL)				return(-ENOMEM);			portp->tx.head = portp->tx.buf;			portp->tx.tail = portp->tx.buf;		}		stl_setport(portp, tty->termios);		portp->sigs = stl_getsignals(portp);		stl_setsignals(portp, 1, 1);		stl_enablerxtx(portp, 1, 1);		stl_startrxtx(portp, 1, 0);		clear_bit(TTY_IO_ERROR, &tty->flags);		portp->flags |= ASYNC_INITIALIZED;	}/* *	Check if this port is in the middle of closing. If so then wait *	until it is closed then return error status, based on flag settings. *	The sleep here does not need interrupt protection since the wakeup *	for it is done with the same context. */	if (portp->flags & ASYNC_CLOSING) {		interruptible_sleep_on(&portp->close_wait);		if (portp->flags & ASYNC_HUP_NOTIFY)			return(-EAGAIN);		return(-ERESTARTSYS);	}/* *	Based on type of open being done check if it can overlap with any *	previous opens still in effect. If we are a normal serial device *	then also we might have to wait for carrier. */	if (tty->driver.subtype == STL_DRVTYPCALLOUT) {		if (portp->flags & ASYNC_NORMAL_ACTIVE)			return(-EBUSY);		if (portp->flags & ASYNC_CALLOUT_ACTIVE) {			if ((portp->flags & ASYNC_SESSION_LOCKOUT) &&			    (portp->session != current->session))				return(-EBUSY);			if ((portp->flags & ASYNC_PGRP_LOCKOUT) &&			    (portp->pgrp != current->pgrp))				return(-EBUSY);		}		portp->flags |= ASYNC_CALLOUT_ACTIVE;	} else {		if (filp->f_flags & O_NONBLOCK) {			if (portp->flags & ASYNC_CALLOUT_ACTIVE)				return(-EBUSY);		} else {			if ((rc = stl_waitcarrier(portp, filp)) != 0)				return(rc);		}		portp->flags |= ASYNC_NORMAL_ACTIVE;	}	if ((portp->refcount == 1) && (portp->flags & ASYNC_SPLIT_TERMIOS)) {		if (tty->driver.subtype == STL_DRVTYPSERIAL)			*tty->termios = portp->normaltermios;		else			*tty->termios = portp->callouttermios;		stl_setport(portp, tty->termios);	}	portp->session = current->session;	portp->pgrp = current->pgrp;	return(0);}/*****************************************************************************//* *	Possibly need to wait for carrier (DCD signal) to come high. Say *	maybe because if we are clocal then we don't need to wait... */static int stl_waitcarrier(stlport_t *portp, struct file *filp){	unsigned long	flags;	int		rc, doclocal;#if DEBUG	printk("stl_waitcarrier(portp=%x,filp=%x)\n", (int) portp, (int) filp);#endif	rc = 0;	doclocal = 0;	if (portp->flags & ASYNC_CALLOUT_ACTIVE) {		if (portp->normaltermios.c_cflag & CLOCAL)			doclocal++;	} else {		if (portp->tty->termios->c_cflag & CLOCAL)			doclocal++;	}	save_flags(flags);	cli();	portp->openwaitcnt++;	if (! tty_hung_up_p(filp))		portp->refcount--;	for (;;) {		if ((portp->flags & ASYNC_CALLOUT_ACTIVE) == 0)			stl_setsignals(portp, 1, 1);		if (tty_hung_up_p(filp) ||		    ((portp->flags & ASYNC_INITIALIZED) == 0)) {			if (portp->flags & ASYNC_HUP_NOTIFY)				rc = -EBUSY;			else				rc = -ERESTARTSYS;			break;		}		if (((portp->flags & ASYNC_CALLOUT_ACTIVE) == 0) &&		    ((portp->flags & ASYNC_CLOSING) == 0) &&		    (doclocal || (portp->sigs & TIOCM_CD))) {			break;		}		if (signal_pending(current)) {			rc = -ERESTARTSYS;			break;		}		interruptible_sleep_on(&portp->open_wait);	}	if (! tty_hung_up_p(filp))		portp->refcount++;	portp->openwaitcnt--;	restore_flags(flags);	return(rc);}/*****************************************************************************/static void stl_close(struct tty_struct *tty, struct file *filp){	stlport_t	*portp;	unsigned long	flags;#if DEBUG	printk("stl_close(tty=%x,filp=%x)\n", (int) tty, (int) filp);#endif	portp = tty->driver_data;	if (portp == (stlport_t *) NULL)		return;	save_flags(flags);	cli();	if (tty_hung_up_p(filp)) {		MOD_DEC_USE_COUNT;		restore_flags(flags);		return;	}	if ((tty->count == 1) && (portp->refcount != 1))		portp->refcount = 1;	if (portp->refcount-- > 1) {		MOD_DEC_USE_COUNT;		restore_flags(flags);		return;	}	portp->refcount = 0;	portp->flags |= ASYNC_CLOSING;	if (portp->flags & ASYNC_NORMAL_ACTIVE)		portp->normaltermios = *tty->termios;	if (portp->flags & ASYNC_CALLOUT_ACTIVE)		portp->callouttermios = *tty->termios;/* *	May want to wait for any data to drain before closing. The BUSY *	flag keeps track of whether we are still sending or not - it is *	very accurate for the cd1400, not quite so for the sc26198. *	(The sc26198 has no "end-of-data" interrupt only empty FIFO) */	tty->closing = 1;	if (portp->closing_wait != ASYNC_CLOSING_WAIT_NONE)		tty_wait_until_sent(tty, portp->closing_wait);	stl_waituntilsent(tty, (HZ / 2));	portp->flags &= ~ASYNC_INITIALIZED;	stl_disableintrs(portp);	if (tty->termios->c_cflag & HUPCL)		stl_setsignals(portp, 0, 0);	stl_enablerxtx(portp, 0, 0);	stl_flushbuffer(tty);	portp->istate = 0;	if (portp->tx.buf != (char *) NULL) {		kfree_s(portp->tx.buf, STL_TXBUFSIZE);		portp->tx.buf = (char *) NULL;		portp->tx.head = (char *) NULL;		portp->tx.tail = (char *) NULL;	}	set_bit(TTY_IO_ERROR, &tty->flags);	if (tty->ldisc.flush_buffer)		(tty->ldisc.flush_buffer)(tty);	tty->closing = 0;	portp->tty = (struct tty_struct *) NULL;	if (portp->openwaitcnt) {		if (portp->close_delay)			stl_delay(portp->close_delay);		wake_up_interruptible(&portp->open_wait);	}	portp->flags &= ~(ASYNC_CALLOUT_ACTIVE | ASYNC_NORMAL_ACTIVE |		ASYNC_CLOSING);	wake_up_interruptible(&portp->close_wait);	MOD_DEC_USE_COUNT;	restore_flags(flags);}/*****************************************************************************//* *	Wait for a specified delay period, this is not a busy-loop. It will *	give up the processor while waiting. Unfortunately this has some *	rather intimate knowledge of the process management stuff. */static void stl_delay(int len){#if DEBUG	printk("stl_delay(len=%d)\n", len);#endif	if (len > 0) {		current->state = TASK_INTERRUPTIBLE;		schedule_timeout(len);		current->state = TASK_RUNNING;	}}/*****************************************************************************//* *	Write routine. Take data and stuff it in to the TX ring queue. *	If transmit interrupts are not running then start them. */static int stl_write(struct tty_struct *tty, int from_user, const unsigned char *buf, int count){	stlport_t	*portp;	unsigned int	len, stlen;	unsigned char	*chbuf;	char		*head, *tail;#if DEBUG	printk("stl_write(tty=%x,from_user=%d,buf=%x,count=%d)\n",		(int) tty, from_user, (int) buf, count);#endif	if ((tty == (struct tty_struct *) NULL) ||	    (stl_tmpwritebuf == (char *) NULL))		return(0);	portp = tty->driver_data;	if (portp == (stlport_t *) NULL)		return(0);	if (portp->tx.buf == (char *) NULL)		return(0);/* *	If copying direct from user space we must cater for page faults, *	causing us to "sleep" here for a while. To handle this copy in all *	the data we need now, into a local buffer. Then when we got it all *	copy it into the TX buffer. */	chbuf = (unsigned char *) buf;	if (from_user) {		head = portp->tx.head;		tail = portp->tx.tail;		len = (head >= tail) ? (STL_TXBUFSIZE - (head - tail) - 1) :			(tail - head - 1);		count = MIN(len, count);				down(&stl_tmpwritesem);		copy_from_user(stl_tmpwritebuf, chbuf, count);		chbuf = &stl_tmpwritebuf[0];	}	head = portp->tx.head;	tail = portp->tx.tail;	if (head >= tail) {		len = STL_TXBUFSIZE - (head - tail) - 1;		stlen = STL_TXBUFSIZE - (head - portp->tx.buf);	} else {		len = tail - head - 1;		stlen = len;	}	len = MIN(len, count);	count = 0;	while (len > 0) {		stlen = MIN(len, stlen);		memcpy(head, chbuf, stlen);		len -= stlen;		chbuf += stlen;		count += stlen;		head += stlen;		if (head >= (portp->tx.buf + STL_TXBUFSIZE)) {			head = portp->tx.buf;			stlen = tail - head;		}	}	portp->tx.head = head;	clear_bit(ASYI_TXLOW, &portp->istate);	stl_startrxtx(portp, -1, 1);	if (from_user)		up(&stl_tmpwritesem);	return(count);}/*****************************************************************************/static void stl_putchar(struct tty_struct *tty, unsigned char ch){	stlport_t	*portp;	unsigned int	len;	char		*head, *tail;#if DEBUG	printk("stl_putchar(tty=%x,ch=%x)\n", (int) tty, (int) ch);#endif	if (tty == (struct tty_struct *) NULL)		return;	portp = tty->driver_data;	if (portp == (stlport_t *) NULL)		return;	if (portp->tx.buf == (char *) NULL)		return;	head = portp->tx.head;	tail = portp->tx.tail;	len = (head >= tail) ? (STL_TXBUFSIZE - (head - tail)) : (tail - head);	len--;	if (len > 0) {		*head++ = ch;		if (head >= (portp->tx.buf + STL_TXBUFSIZE))			head = portp->tx.buf;	}		portp->tx.head = head;}/*****************************************************************************//* *	If there are any characters in the buffer then make sure that TX *	interrupts are on and get'em out. Normally used after the putchar *	routine has been called. */static void stl_flushchars(struct tty_struct *tty){	stlport_t	*portp;#if DEBUG	printk("stl_flushchars(tty=%x)\n", (int) tty);#endif	if (tty == (struct tty_struct *) NULL)		return;	portp = tty->driver_data;	if (portp == (stlport_t *) NULL)		return;	if (portp->tx.buf == (char *) NULL)		return;#if 0	if (tty->stopped || tty->hw_stopped ||	    (portp->tx.head == portp->tx.tail))		return;#endif	stl_startrxtx(portp, -1, 1);}/*****************************************************************************/static int stl_writeroom(struct tty_struct *tty){	stlport_t	*portp;	char		*head, *tail;#if DEBUG	printk("stl_writeroom(tty=%x)\n", (int) tty);#endif	if (tty == (struct tty_struct *) NULL)		return(0);	portp = tty->driver_data;	if (portp == (stlport_t *) NULL)		return(0);	if (portp->tx.buf == (char *) NULL)		return(0);	head = portp->tx.head;	tail = portp->tx.tail;	return((head >= tail) ? (STL_TXBUFSIZE - (head - tail) - 1) : (tail - head - 1));}/*****************************************************************************//* *	Return number of chars in the TX buffer. Normally we would just *	calculate the number of chars in the buffer and return that, but if *	the buffer is empty and TX interrupts are still on then we return *	that the buffer still has 1 char in it. This way whoever called us *	will not think that ALL chars have drained - since the UART still *	must have some chars in it (we are busy after all). */static int stl_charsinbuffer(struct tty_struct *tty){	stlport_t	*portp;	unsigned int	size;	char		*head, *tail;#if DEBUG

?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
日韩午夜电影在线观看| 久久综合色8888| 成人福利视频网站| 国产一区二区三区美女| 国产在线不卡一卡二卡三卡四卡| 日韩高清欧美激情| 麻豆视频一区二区| 国产成人精品一区二区三区四区 | 欧美乱妇23p| 精品视频免费在线| 欧美一区二区三区视频免费播放| 欧美日韩第一区日日骚| 制服丝袜av成人在线看| 日韩欧美亚洲国产精品字幕久久久| 91精品国产色综合久久ai换脸| 91精品国产麻豆国产自产在线| 日韩三级视频中文字幕| 久久日一线二线三线suv| 欧美国产亚洲另类动漫| 亚洲男人的天堂在线aⅴ视频| 一个色妞综合视频在线观看| 天使萌一区二区三区免费观看| 日本网站在线观看一区二区三区| 美女一区二区在线观看| 国产精品自拍在线| 在线免费观看视频一区| 欧美大白屁股肥臀xxxxxx| 国产丝袜美腿一区二区三区| 亚洲色图在线视频| 日韩av中文字幕一区二区| 国产成人aaaa| 欧美日韩一级二级| 久久久噜噜噜久久中文字幕色伊伊| 中文字幕五月欧美| 日韩在线一区二区三区| 成人精品小蝌蚪| 91麻豆精品国产91久久久资源速度| 精品国产乱码久久久久久闺蜜| 亚洲欧美日本韩国| 激情六月婷婷久久| 欧美日韩一区二区三区四区五区| 精品国产亚洲在线| 亚洲一区二区欧美日韩 | 亚洲另类春色国产| 美美哒免费高清在线观看视频一区二区| 国产99一区视频免费| 91精品国产91久久久久久一区二区| 国产欧美精品在线观看| 亚洲国产aⅴ成人精品无吗| 国产成人福利片| 欧美电影免费观看高清完整版在 | 日韩免费性生活视频播放| 日韩美女久久久| 国产一区二区不卡| 制服丝袜成人动漫| 性感美女久久精品| 色激情天天射综合网| 中文字幕欧美区| 国内国产精品久久| 日韩欧美色综合| 日本麻豆一区二区三区视频| 91在线高清观看| 国产欧美日韩综合| 韩国av一区二区三区四区| 日韩一区二区精品| 奇米精品一区二区三区四区| 欧美色图一区二区三区| 亚洲精品一二三| thepron国产精品| 欧美激情一区二区三区四区| 国产乱码精品一区二区三区忘忧草 | 成人午夜视频在线| 国产婷婷色一区二区三区在线| 免费一级片91| 6080日韩午夜伦伦午夜伦| 亚洲伊人色欲综合网| 欧美亚洲动漫另类| 视频一区在线视频| 91麻豆精品久久久久蜜臀| 日韩电影在线观看一区| 91麻豆精品国产91| 久久er99精品| 国产色婷婷亚洲99精品小说| 国产精品1区2区3区在线观看| 国产亚洲制服色| caoporn国产精品| 亚洲美女精品一区| 欧美另类videos死尸| 丝袜亚洲另类欧美综合| 欧美成人精品高清在线播放| 国产精品伊人色| 综合久久国产九一剧情麻豆| 91福利视频久久久久| 日韩高清在线不卡| 久久久综合精品| 99精品视频一区二区| 亚洲一区二区三区视频在线播放| 欧美高清一级片在线| 久久成人免费电影| 中文字幕一区二区三区在线观看| 色噜噜狠狠成人中文综合| 日韩二区三区在线观看| 国产欧美日韩中文久久| 欧美亚洲国产一区二区三区va| 日韩av电影天堂| 日本一区二区久久| 欧美久久久久久久久久| 国产精品一卡二卡在线观看| 最新中文字幕一区二区三区| 91精品国产综合久久香蕉的特点| 国产美女在线精品| 亚洲午夜一二三区视频| 国产视频不卡一区| 7878成人国产在线观看| 丁香婷婷综合色啪| 日本欧美一区二区三区| 国产精品午夜免费| 日韩美女主播在线视频一区二区三区| 国产成人精品三级麻豆| 午夜亚洲福利老司机| 中国色在线观看另类| 欧美成人性战久久| 欧美日韩国产一二三| www.激情成人| 国产精品中文欧美| 麻豆视频一区二区| 亚洲一二三四在线观看| 国产欧美一区二区精品性| 91.麻豆视频| 在线免费观看成人短视频| 成人午夜看片网址| 国产一区二区毛片| 久久精品国产久精国产| 亚洲不卡av一区二区三区| 亚洲人成人一区二区在线观看 | 亚洲少妇30p| 久久久电影一区二区三区| 欧美一区在线视频| 91精品黄色片免费大全| 欧美日韩激情一区| 欧美视频自拍偷拍| 亚洲一区二区欧美日韩| 一本色道久久综合亚洲aⅴ蜜桃 | 亚洲综合久久av| 亚洲成av人影院| 激情综合色播激情啊| 成人国产精品免费| 欧美性生活一区| 精品国产一二三区| 一区二区三区美女视频| 麻豆一区二区三| 色偷偷一区二区三区| 日韩精品影音先锋| 国产精品久久久久久久久动漫| 亚洲无人区一区| 国产传媒久久文化传媒| 欧美日本视频在线| 国产精品五月天| 免费美女久久99| 色狠狠桃花综合| 精品成人一区二区三区| 亚洲国产视频一区二区| 国产一区二区三区精品欧美日韩一区二区三区 | 天天综合色天天| 高清在线观看日韩| 日韩欧美一区二区视频| 亚洲色图一区二区三区| 久久国产综合精品| 欧美性感一区二区三区| 欧美国产禁国产网站cc| 日本欧美在线看| 日本久久电影网| 中文av一区特黄| 韩日欧美一区二区三区| 欧美午夜寂寞影院| 日韩毛片视频在线看| 国产成人亚洲精品青草天美| 欧美一区二区三区在线| 亚洲激情成人在线| 成人av网站在线观看免费| 精品国产成人在线影院| 免费三级欧美电影| 在线不卡免费欧美| 亚洲一区二区三区四区在线免费观看 | 国产精品你懂的| 国产在线观看免费一区| 欧美一级二级三级蜜桃| 亚洲成在线观看| 在线欧美日韩国产| 一卡二卡欧美日韩| 99国产精品久久久久久久久久| 国产日本欧洲亚洲| 国产福利一区二区三区视频在线 | 玖玖九九国产精品| 欧美日高清视频| 亚洲v精品v日韩v欧美v专区| 在线中文字幕不卡| 一区二区三区中文字幕精品精品| 成人短视频下载| 亚洲人成小说网站色在线|