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

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

?? cx.c

?? 基于組件方式開發操作系統的OSKIT源代碼
?? C
?? 第 1 頁 / 共 2 頁
字號:
/* * Cronyx-Sigma adapter driver for FreeBSD. * Supports PPP/HDLC protocol in synchronous mode, * and asyncronous channels with full modem control. * * Copyright (C) 1994 Cronyx Ltd. * Author: Serge Vakulenko, <vak@zebub.msk.su> * * This software is distributed with NO WARRANTIES, not even the implied * warranties for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. * * Authors grant any other persons or organisations permission to use * or modify this software as long as this message is kept with the software, * all derivative works or modified versions. * * Version 1.9, Wed Oct  4 18:58:15 MSK 1995 */#undef DEBUG#include "cx.h"#if NCX > 0#include <sys/param.h>#include <sys/systm.h>#include <sys/kernel.h>#include <sys/fcntl.h>#include <sys/conf.h>#include <sys/proc.h>#include <sys/tty.h>#include <sys/socket.h>#include <net/if.h>#ifdef __FreeBSD__#   if __FreeBSD__ < 2#      include <machine/pio.h>#      define RB_GETC(q) getc(q)#   endif#endif#ifdef __bsdi__#   include <sys/ttystats.h>#   include <machine/inline.h>#   define tsleep(tp,pri,msg,x) ((tp)->t_state |= TS_WOPEN,\		ttysleep (tp, (caddr_t)&tp->t_rawq, pri, msg, x))#endif#if !defined (__FreeBSD__) || __FreeBSD__ >= 2#      define t_out t_outq#      define RB_LEN(q) ((q).c_cc)#      define RB_GETC(q) getc(&q)#ifndef TSA_CARR_ON /* FreeBSD 2.x before not long after 2.0.5 */#      define TSA_CARR_ON(tp) tp#      define TSA_OLOWAT(q) ((caddr_t)&(q)->t_out)#endif#endif#include <machine/cronyx.h>#include <i386/isa/cxreg.h>/* XXX imported from if_cx.c. */void cxswitch (cx_chan_t *c, cx_soft_opt_t new);/* XXX exported. */void cxmint (cx_chan_t *c);int cxrinta (cx_chan_t *c);void cxtinta (cx_chan_t *c);timeout_t cxtimeout;#ifdef DEBUG#   define print(s)     printf s#else#   define print(s)     {/*void*/}#endif#define DMABUFSZ        (6*256)         /* buffer size */#define BYTE            *(unsigned char*)&#define UNIT(u)         ((u) & 077)#define UNIT_CTL        077extern cx_board_t cxboard [NCX];        /* adapter state structures */extern cx_chan_t *cxchan [NCX*NCHAN];   /* unit to channel struct pointer */#if __FreeBSD__ >= 2static struct tty cx_tty [NCX*NCHAN];          /* tty data */static	d_open_t	cxopen;static	d_close_t	cxclose;static	d_read_t	cxread;static	d_write_t	cxwrite;static	d_ioctl_t	cxioctl;static	d_stop_t	cxstop;static	d_devtotty_t	cxdevtotty;#define	CDEV_MAJOR	42/* Don't make this static, since if_cx.c uses it. */struct cdevsw	cx_cdevsw = {	cxopen,		cxclose,	cxread,		cxwrite,	cxioctl,	cxstop,		nullreset,	cxdevtotty,	ttpoll,		nommap,		NULL,		"cx",	NULL,		-1,		nodump,		nopsize,	D_TTY,};#elsestruct tty *cx_tty [NCX*NCHAN];         /* tty data */#endifstatic void cxoproc (struct tty *tp);static int cxparam (struct tty *tp, struct termios *t);int cxopen (dev_t dev, int flag, int mode, struct proc *p){	int unit = UNIT (dev);	cx_chan_t *c = cxchan[unit];	unsigned short port;	struct tty *tp;	int error = 0;	if (unit == UNIT_CTL) {		print (("cx: cxopen /dev/cronyx\n"));		return (0);	}	if (unit >= NCX*NCHAN || !c || c->type==T_NONE)		return (ENXIO);	port = c->chip->port;	print (("cx%d.%d: cxopen unit=%d\n", c->board->num, c->num, unit));	if (c->mode != M_ASYNC)		return (EBUSY);	if (! c->ttyp) {#ifdef __FreeBSD__#if __FreeBSD__ >= 2		c->ttyp = &cx_tty[unit];#else		c->ttyp = cx_tty[unit] = ttymalloc (cx_tty[unit]);#endif#else		MALLOC (cx_tty[unit], struct tty*, sizeof (struct tty), M_DEVBUF, M_WAITOK);		bzero (cx_tty[unit], sizeof (*cx_tty[unit]));		c->ttyp = cx_tty[unit];#endif		c->ttyp->t_oproc = cxoproc;		c->ttyp->t_param = cxparam;	}#ifdef __bsdi__	if (! c->ttydev) {		MALLOC (c->ttydev, struct ttydevice_tmp*,			sizeof (struct ttydevice_tmp), M_DEVBUF, M_WAITOK);		bzero (c->ttydev, sizeof (*c->ttydev));		strcpy (c->ttydev->tty_name, "cx");		c->ttydev->tty_unit = unit;		c->ttydev->tty_base = unit;		c->ttydev->tty_count = 1;		c->ttydev->tty_ttys = c->ttyp;		tty_attach (c->ttydev);	}#endif	tp = c->ttyp;	tp->t_dev = dev;	if ((tp->t_state & TS_ISOPEN) && (tp->t_state & TS_XCLUDE) &&	    p->p_ucred->cr_uid != 0)		return (EBUSY);	if (! (tp->t_state & TS_ISOPEN)) {		ttychars (tp);		if (tp->t_ispeed == 0) {#ifdef __bsdi__			tp->t_termios = deftermios;#else			tp->t_iflag = 0;			tp->t_oflag = 0;			tp->t_lflag = 0;			tp->t_cflag = CREAD | CS8 | HUPCL;			tp->t_ispeed = c->rxbaud;			tp->t_ospeed = c->txbaud;#endif		}		cxparam (tp, &tp->t_termios);		ttsetwater (tp);	}	spltty ();	if (! (tp->t_state & TS_ISOPEN)) {		/*		 * Compute optimal receiver buffer length.		 * The best choice is rxbaud/400.		 * Make it even, to avoid byte-wide DMA transfers.		 * --------------------------		 * Baud rate    Buffer length		 * --------------------------		 *      300     4		 *     1200     4		 *     9600     24		 *    19200     48		 *    38400     96		 *    57600     192		 *   115200     288		 * --------------------------		 */		int rbsz = (c->rxbaud + 800 - 1) / 800 * 2;		if (rbsz < 4)			rbsz = 4;		else if (rbsz > DMABUFSZ)			rbsz = DMABUFSZ;		/* Initialize channel, enable receiver. */		cx_cmd (port, CCR_INITCH | CCR_ENRX);		cx_cmd (port, CCR_INITCH | CCR_ENRX);		/* Start receiver. */		outw (ARBCNT(port), rbsz);		outw (BRBCNT(port), rbsz);		outw (ARBSTS(port), BSTS_OWN24);		outw (BRBSTS(port), BSTS_OWN24);		/* Enable interrupts. */		outb (IER(port), IER_RXD | IER_RET | IER_TXD | IER_MDM);		cx_chan_dtr (c, 1);		cx_chan_rts (c, 1);	}	if (cx_chan_cd (c))		(*linesw[tp->t_line].l_modem)(tp, 1);	if (! (flag & O_NONBLOCK)) {		/* Lock the channel against cxconfig while we are		 * waiting for carrier. */		c->sopt.lock = 1;		while (!(tp->t_cflag & CLOCAL) && !(tp->t_state & TS_CARR_ON))			if ((error = tsleep (TSA_CARR_ON(tp), TTIPRI | PCATCH,			    "cxdcd", 0)))				break;		c->sopt.lock = 0;       /* Unlock the channel. */	}	print (("cx%d.%d: cxopen done csr=%b\n", c->board->num, c->num,		inb(CSR(c->chip->port)), CSRA_BITS));	spl0 ();	if (error)		return (error);#if __FreeBSD__ >= 2	error = (*linesw[tp->t_line].l_open) (dev, tp);#else	error = (*linesw[tp->t_line].l_open) (dev, tp, 0);#endif	return (error);}int cxclose (dev_t dev, int flag, int mode, struct proc *p){	int unit = UNIT (dev);	cx_chan_t *c = cxchan[unit];	struct tty *tp;	int s;	if (unit == UNIT_CTL)		return (0);	tp = c->ttyp;	(*linesw[tp->t_line].l_close) (tp, flag);	/* Disable receiver.	 * Transmitter continues sending the queued data. */	s = spltty ();	outb (CAR(c->chip->port), c->num & 3);	outb (IER(c->chip->port), IER_TXD | IER_MDM);	cx_cmd (c->chip->port, CCR_DISRX);	/* Clear DTR and RTS. */	if ((tp->t_cflag & HUPCL) || ! (tp->t_state & TS_ISOPEN)) {		cx_chan_dtr (c, 0);		cx_chan_rts (c, 0);	}	/* Stop sending break. */	if (c->brk == BRK_SEND) {		c->brk = BRK_STOP;		if (! (tp->t_state & TS_BUSY))			cxoproc (tp);	}	splx (s);	ttyclose (tp);	return (0);}int cxread (dev_t dev, struct uio *uio, int flag){	int unit = UNIT (dev);	struct tty *tp;	if (unit == UNIT_CTL)		return (EIO);	tp = cxchan[unit]->ttyp;	return ((*linesw[tp->t_line].l_read) (tp, uio, flag));}int cxwrite (dev_t dev, struct uio *uio, int flag){	int unit = UNIT (dev);	struct tty *tp;	if (unit == UNIT_CTL)		return (EIO);	tp = cxchan[unit]->ttyp;	return ((*linesw[tp->t_line].l_write) (tp, uio, flag));}int cxioctl (dev_t dev, u_long cmd, caddr_t data, int flag, struct proc *p){	int unit = UNIT (dev);	cx_chan_t *c, *m;	cx_stat_t *st;	struct tty *tp;	int error, s;	unsigned char msv;	struct ifnet *master;	if (unit == UNIT_CTL) {		/* Process an ioctl request on /dev/cronyx */		cx_options_t *o = (cx_options_t*) data;		if (o->board >= NCX || o->channel >= NCHAN)			return (EINVAL);		c = &cxboard[o->board].chan[o->channel];		if (c->type == T_NONE)			return (ENXIO);		switch (cmd) {		default:			return (EINVAL);		case CXIOCSETMODE:			print (("cx%d.%d: CXIOCSETMODE\n", o->board, o->channel));			if (c->type == T_NONE)				return (EINVAL);			if (c->type == T_ASYNC && o->mode != M_ASYNC)				return (EINVAL);			if (o->mode == M_ASYNC)				switch (c->type) {				case T_SYNC_RS232:				case T_SYNC_V35:				case T_SYNC_RS449:					return (EINVAL);				}			/* Somebody is waiting for carrier? */			if (c->sopt.lock)				return (EBUSY);			/* /dev/ttyXX is already opened by someone? */			if (c->mode == M_ASYNC && c->ttyp &&			    (c->ttyp->t_state & TS_ISOPEN))				return (EBUSY);			/* Network interface is up? */			if (c->mode != M_ASYNC && (c->ifp->if_flags & IFF_UP))				return (EBUSY);			/* Find the master interface. */			master = *o->master ? ifunit (o->master) : c->ifp;			if (! master)				return (EINVAL);			m = cxchan[master->if_unit];			/* Leave the previous master queue. */			if (c->master != c->ifp) {				cx_chan_t *p = cxchan[c->master->if_unit];				for (; p; p=p->slaveq)					if (p->slaveq == c)						p->slaveq = c->slaveq;			}			/* Set up new master. */			c->master = master;			c->slaveq = 0;			/* Join the new master queue. */			if (c->master != c->ifp) {				c->slaveq = m->slaveq;				m->slaveq = c;			}			c->mode   = o->mode;			c->rxbaud = o->rxbaud;			c->txbaud = o->txbaud;			c->opt    = o->opt;			c->aopt   = o->aopt;			c->hopt   = o->hopt;			c->bopt   = o->bopt;			c->xopt   = o->xopt;			switch (c->num) {			case 0: c->board->if0type = o->iftype; break;			case 8: c->board->if8type = o->iftype; break;			}			s = spltty ();			cxswitch (c, o->sopt);			cx_setup_chan (c);			outb (IER(c->chip->port), 0);			splx (s);			break;		case CXIOCGETSTAT:			st = (cx_stat_t*) data;			st->rintr  = c->stat->rintr;			st->tintr  = c->stat->tintr;			st->mintr  = c->stat->mintr;			st->ibytes = c->stat->ibytes;			st->ipkts  = c->stat->ipkts;			st->ierrs  = c->stat->ierrs;			st->obytes = c->stat->obytes;			st->opkts  = c->stat->opkts;			st->oerrs  = c->stat->oerrs;			break;		case CXIOCGETMODE:			print (("cx%d.%d: CXIOCGETMODE\n", o->board, o->channel));			o->type   = c->type;			o->mode   = c->mode;			o->rxbaud = c->rxbaud;			o->txbaud = c->txbaud;			o->opt    = c->opt;			o->aopt   = c->aopt;			o->hopt   = c->hopt;			o->bopt   = c->bopt;			o->xopt   = c->xopt;			o->sopt   = c->sopt;			switch (c->num) {			case 0: o->iftype = c->board->if0type; break;			case 8: o->iftype = c->board->if8type; break;			}			if (c->master != c->ifp)				snprintf (o->master, sizeof(o->master),				    "%s%d", c->master->if_name,					c->master->if_unit);			else				*o->master = 0;			break;		}		return (0);	}	c = cxchan[unit];	tp = c->ttyp;	if (! tp)		return (EINVAL);#if __FreeBSD__ >= 2	error = (*linesw[tp->t_line].l_ioctl) (tp, cmd, data, flag, p);#else	error = (*linesw[tp->t_line].l_ioctl) (tp, cmd, data, flag);#endif	if (error != ENOIOCTL)		return (error);	error = ttioctl (tp, cmd, data, flag);	if (error != ENOIOCTL)		return (error);	s = spltty ();	switch (cmd) {	default:		splx (s);		return (ENOTTY);	case TIOCSBRK:          /* Start sending line break */		c->brk = BRK_SEND;		if (! (tp->t_state & TS_BUSY))			cxoproc (tp);		break;	case TIOCCBRK:          /* Stop sending line break */		c->brk = BRK_STOP;		if (! (tp->t_state & TS_BUSY))			cxoproc (tp);		break;	case TIOCSDTR:          /* Set DTR */		cx_chan_dtr (c, 1);		break;	case TIOCCDTR:          /* Clear DTR */		cx_chan_dtr (c, 0);		break;	case TIOCMSET:          /* Set DTR/RTS */		cx_chan_dtr (c, (*(int*)data & TIOCM_DTR) ? 1 : 0);		cx_chan_rts (c, (*(int*)data & TIOCM_RTS) ? 1 : 0);		break;	case TIOCMBIS:          /* Add DTR/RTS */		if (*(int*)data & TIOCM_DTR) cx_chan_dtr (c, 1);		if (*(int*)data & TIOCM_RTS) cx_chan_rts (c, 1);		break;	case TIOCMBIC:          /* Clear DTR/RTS */		if (*(int*)data & TIOCM_DTR) cx_chan_dtr (c, 0);		if (*(int*)data & TIOCM_RTS) cx_chan_rts (c, 0);		break;	case TIOCMGET:          /* Get modem status */		msv = inb (MSVR(c->chip->port));		*(int*)data = TIOCM_LE; /* always enabled while open */		if (msv & MSV_DSR) *(int*)data |= TIOCM_DSR;		if (msv & MSV_CTS) *(int*)data |= TIOCM_CTS;		if (msv & MSV_CD)  *(int*)data |= TIOCM_CD;		if (c->dtr)        *(int*)data |= TIOCM_DTR;		if (c->rts)        *(int*)data |= TIOCM_RTS;		break;	}	splx (s);	return (0);}/*

?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
91精品国产91久久综合桃花| 亚洲一级二级三级| 欧美日韩成人高清| 色婷婷亚洲一区二区三区| 成人app软件下载大全免费| 国产乱人伦偷精品视频免下载| 美女免费视频一区| 精品一区二区免费在线观看| 麻豆一区二区三| 另类小说欧美激情| 国产精品一区在线观看乱码| 国产一区二区在线看| 国内精品视频666| 成人久久18免费网站麻豆| www.色精品| 91福利在线导航| 日韩一级大片在线观看| www激情久久| 国产精品久久看| 成人欧美一区二区三区1314| 一区二区三区四区视频精品免费 | 精品污污网站免费看| 欧美日韩视频专区在线播放| 日韩小视频在线观看专区| 久久免费的精品国产v∧| 中文字幕第一区| 夜夜嗨av一区二区三区| 日韩成人午夜精品| 国v精品久久久网| 在线中文字幕一区| 精品乱人伦小说| 亚洲欧美欧美一区二区三区| 三级影片在线观看欧美日韩一区二区 | 91同城在线观看| 91精品国产91综合久久蜜臀| 国产精品久久久久影院亚瑟| 亚洲电影第三页| 国产宾馆实践打屁股91| 欧美日韩你懂的| 欧美激情综合五月色丁香小说| 一区二区成人在线观看| 精品亚洲porn| 欧美日精品一区视频| 久久久久久影视| 亚洲午夜精品久久久久久久久| 国产一区二区中文字幕| 欧美精选午夜久久久乱码6080| 欧美国产日韩亚洲一区| 日韩av中文在线观看| 99精品国产热久久91蜜凸| 日韩欧美国产精品| 亚洲综合色自拍一区| 成人免费毛片app| 精品动漫一区二区三区在线观看| 一区二区三区中文免费| 国产一区二区在线视频| 日韩精品一区二区在线| 亚洲国产精品一区二区尤物区| 麻豆91精品视频| 欧美综合天天夜夜久久| ...xxx性欧美| 成人午夜av电影| 久久香蕉国产线看观看99| 日韩精品91亚洲二区在线观看| 色婷婷综合久久久中文一区二区| 中文字幕五月欧美| 成人三级在线视频| 中文字幕精品一区二区精品绿巨人 | 在线不卡的av| 亚洲成人免费视频| 欧美亚洲自拍偷拍| 一区二区三区在线免费观看| 91香蕉视频污| 一区二区三区高清在线| 在线看国产一区二区| 亚洲男人的天堂av| 91麻豆国产精品久久| 亚洲欧美国产77777| 91影院在线免费观看| 亚洲欧洲综合另类在线| 97久久超碰精品国产| 最新国产の精品合集bt伙计| aaa国产一区| 亚洲六月丁香色婷婷综合久久 | 亚洲婷婷在线视频| 色综合激情五月| 爽好多水快深点欧美视频| 777色狠狠一区二区三区| 蜜桃一区二区三区四区| 精品国产精品网麻豆系列| 国产一区二区精品久久99| 国产日本亚洲高清| aaa亚洲精品| 亚洲电影一区二区三区| 日韩一区二区在线观看| 国产盗摄精品一区二区三区在线 | 91精品91久久久中77777| 亚洲va欧美va国产va天堂影院| 91精品在线免费| 精彩视频一区二区三区| 国产欧美精品日韩区二区麻豆天美| 国产成人精品一区二区三区四区| 亚洲色图在线播放| 欧美美女一区二区在线观看| 免费av成人在线| 国产精品免费久久| 欧美日韩1区2区| 成人的网站免费观看| 亚洲午夜视频在线观看| 精品国产一区二区亚洲人成毛片| av网站一区二区三区| 免费在线观看成人| 亚洲人成小说网站色在线| 日韩欧美国产三级| 一本色道久久综合亚洲91| 久久成人免费网| 一区二区三区在线免费观看| 精品国产sm最大网站免费看| 色哟哟在线观看一区二区三区| 国产真实乱偷精品视频免| 亚洲精品日韩综合观看成人91| 日韩欧美国产wwwww| 99久久久国产精品| 激情小说欧美图片| 亚洲一区二区综合| 国产精品伦理在线| 欧美精品一区二区三区四区 | 亚洲精品在线一区二区| 在线观看不卡视频| 成人av电影在线| 国产成人午夜视频| 免费成人在线播放| 日韩在线a电影| 一区二区三区在线影院| 国产精品久久久久精k8| 337p粉嫩大胆噜噜噜噜噜91av| 欧美日韩大陆一区二区| 在线视频中文字幕一区二区| 99久久99精品久久久久久| 国产成人亚洲综合a∨婷婷图片| 久久精品国产久精国产| 日本视频在线一区| 午夜视黄欧洲亚洲| 午夜在线电影亚洲一区| 一区二区三区在线视频免费观看| 国产精品短视频| 国产精品网曝门| 欧美国产一区在线| 中文字幕免费观看一区| 国产精品色哟哟网站| 国产精品无遮挡| 国产精品久久久久永久免费观看| 中文字幕乱码一区二区免费| 国产精品女同一区二区三区| 国产欧美日韩综合| 欧美高清在线精品一区| 国产精品美女www爽爽爽| 国产精品妹子av| 亚洲同性gay激情无套| 一区二区三区国产精华| 亚洲国产综合人成综合网站| 丝袜美腿高跟呻吟高潮一区| 免费看日韩精品| 国产在线一区二区| 成人一区二区三区视频| 91毛片在线观看| 欧美色偷偷大香| 日韩一级完整毛片| 久久久久久麻豆| 亚洲视频在线一区| 亚洲一区二区精品视频| 男男成人高潮片免费网站| 精品一区二区三区欧美| 成人午夜在线播放| 欧美亚洲动漫制服丝袜| 日韩欧美国产综合| 国产精品久久影院| 亚洲第一搞黄网站| 久久97超碰色| 色偷偷88欧美精品久久久| 在线成人av影院| 国产精品不卡在线| 亚洲成av人片在线| 国产一区91精品张津瑜| 色婷婷激情一区二区三区| 69av一区二区三区| 国产精品免费久久久久| 日本在线播放一区二区三区| 高清不卡一区二区| 欧美视频在线不卡| 国产日产欧美一区二区视频| 亚洲h动漫在线| 成人一道本在线| 日韩亚洲欧美一区二区三区| 成人欧美一区二区三区白人| 日本亚洲免费观看| 色天天综合久久久久综合片| 欧美电影免费观看高清完整版| 国产精品久久久久久妇女6080| 日本sm残虐另类|