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

? 歡迎來到蟲蟲下載站! | ?? 資源下載 ?? 資源專輯 ?? 關(guān)于我們
? 蟲蟲下載站

?? if_cx.c

?? 基于組件方式開發(fā)操作系統(tǒng)的OSKIT源代碼
?? C
?? 第 1 頁 / 共 2 頁
字號:
/* * Cronyx-Sigma adapter driver for FreeBSD. * Supports PPP/HDLC and Cisco/HDLC protocol in synchronous mode, * and asyncronous channels with full modem control. * Keepalive protocol implemented in both Cisco and PPP modes. * * 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"#include "bpfilter.h"#include "opt_devfs.h"#include "sppp.h"#if NSPPP <= 0#error The device 'cx' requires sppp.#endif#include <sys/param.h>#include <sys/systm.h>#include <sys/kernel.h>#include <sys/malloc.h>#include <sys/mbuf.h>#include <sys/sockio.h>#include <sys/socket.h>#include <sys/conf.h>#include <net/if.h>#if NBPFILTER > 0#include <net/bpf.h>#endif#include <i386/isa/isa_device.h>#ifdef DEVFSextern struct cdevsw cx_cdevsw;#include <sys/devfsext.h>#endif /*DEVFS*/#define watchdog_func_t void(*)(struct ifnet *)#define start_func_t    void(*)(struct ifnet*)#include <net/if_sppp.h>#include <machine/cronyx.h>#include <i386/isa/cxreg.h>/* XXX exported. */void cxswitch (cx_chan_t *c, cx_soft_opt_t new);static int cxprobe __P((struct isa_device *id));static int cxattach __P((struct isa_device *id));static void cxput __P((cx_chan_t *c, char b));static void cxsend __P((cx_chan_t *c));static void cxrinth __P((cx_chan_t *c));static ointhand2_t cxintr;static int cxtinth __P((cx_chan_t *c));#ifdef DEBUG#   define print(s)     printf s#else#   define print(s)     {/*void*/}#endif#define TXTIMEOUT       10              /* transmit timeout in seconds */#define DMABUFSZ        (6*256)         /* buffer size */#define PPP_HEADER_LEN  4               /* size of PPP header *//* * Under BSDI it's possible to use general p2p protocol scheme, * as well as our own one.  Switching is done via IFF_ALTPHYS flag. * Our ifnet pointer holds the buffer large enough to contain * any of sppp and p2p structures. */#define IFSTRUCTSZ   (sizeof (struct sppp))#define IFNETSZ         (sizeof (struct ifnet))static int cxsioctl (struct ifnet *ifp, u_long cmd, caddr_t data);static void cxstart (struct ifnet *ifp);static void cxwatchdog (struct ifnet *ifp);static void cxinput (cx_chan_t *c, void *buf, unsigned len);extern int cxrinta (cx_chan_t *c);extern void cxtinta (cx_chan_t *c);extern void cxmint (cx_chan_t *c);extern timeout_t cxtimeout;static void cxdown (cx_chan_t *c);static void cxup (cx_chan_t *c);cx_board_t cxboard [NCX];           /* adapter state structures */cx_chan_t *cxchan [NCX*NCHAN];      /* unit to channel struct pointer */static unsigned short irq_valid_values [] = { 3, 5, 7, 10, 11, 12, 15, 0 };static unsigned short drq_valid_values [] = { 5, 6, 7, 0 };static unsigned short port_valid_values [] = {	0x240, 0x260, 0x280, 0x300, 0x320, 0x380, 0x3a0, 0,};/* * Check that the value is contained in the list of correct values. */static int valid (unsigned short value, unsigned short *list){	while (*list)		if (value == *list++)			return (1);	return (0);}/* * Print the mbuf chain, for debug purposes only. */static void printmbuf (struct mbuf *m){	printf ("mbuf:");	for (; m; m=m->m_next) {		if (m->m_flags & M_PKTHDR)			printf (" HDR %d:", m->m_pkthdr.len);		if (m->m_flags & M_EXT)			printf (" EXT:");		printf (" %d", m->m_len);	}	printf ("\n");}/* * Make an mbuf from data. */static struct mbuf *makembuf (void *buf, unsigned len){	struct mbuf *m, *o, *p;	MGETHDR (m, M_DONTWAIT, MT_DATA);	if (! m)		return (0);	if (len >= MINCLSIZE)		MCLGET (m, M_DONTWAIT);	m->m_pkthdr.len = len;	m->m_len = 0;	p = m;	while (len) {		unsigned n = M_TRAILINGSPACE (p);		if (n > len)			n = len;		if (! n) {			/* Allocate new mbuf. */			o = p;			MGET (p, M_DONTWAIT, MT_DATA);			if (! p) {				m_freem (m);				return (0);			}			if (len >= MINCLSIZE)				MCLGET (p, M_DONTWAIT);			p->m_len = 0;			o->m_next = p;			n = M_TRAILINGSPACE (p);			if (n > len)				n = len;		}		bcopy (buf, mtod (p, caddr_t) + p->m_len, n);		p->m_len += n;		buf = (char *)buf + n;		len -= n;	}	return (m);}/* * Test the presence of the adapter on the given i/o port. */static intcxprobe (struct isa_device *id){	int unit = id->id_unit;	int iobase = id->id_iobase;	int irq = id->id_irq;	int drq = id->id_drq;	int irqnum;	irqnum = ffs (irq) - 1;	print (("cx%d: probe iobase=0x%x irq=%d drq=%d\n",		unit, iobase, irqnum, drq));	if (! valid (irqnum, irq_valid_values)) {		printf ("cx%d: Incorrect IRQ: %d\n", unit, irqnum);		return (0);	}	if (! valid (iobase, port_valid_values)) {		printf ("cx%d: Incorrect port address: 0x%x\n", unit, iobase);		return (0);	}	if (! valid (drq, drq_valid_values)) {		printf ("cx%d: Incorrect DMA channel: %d\n", unit, drq);		return (0);	}	if (! cx_probe_board (iobase))		return (0);	return (1);}/* * The adapter is present, initialize the driver structures. */#ifdef DEVFSstatic void *cx_devfs_token;#endif static intcxattach (struct isa_device *id){	int unit = id->id_unit;	int iobase = id->id_iobase;	int irq = id->id_irq;	int drq = id->id_drq;	cx_board_t *b = cxboard + unit;	int i;	struct sppp *sp;	id->id_ointr = cxintr;	/* Initialize the board structure. */	cx_init (b, unit, iobase, ffs(irq)-1, drq);	for (i=0; i<NCHAN; ++i) {		cx_chan_t *c = b->chan + i;		int u = b->num*NCHAN + i;		cxchan[u] = c;		if (c->type == T_NONE)			continue;		/* Allocate the buffer memory. */		c->arbuf = malloc (DMABUFSZ, M_DEVBUF, M_NOWAIT);		c->brbuf = malloc (DMABUFSZ, M_DEVBUF, M_NOWAIT);		c->atbuf = malloc (DMABUFSZ, M_DEVBUF, M_NOWAIT);		c->btbuf = malloc (DMABUFSZ, M_DEVBUF, M_NOWAIT);		/* All buffers should be located in lower 16M of memory! */		if (!c->arbuf || !c->brbuf || !c->atbuf || !c->btbuf) {			printf ("cx%d.%d: No memory for channel buffers\n",				c->board->num, c->num);			c->type = T_NONE;		}		switch (c->type) {		case T_SYNC_RS232:		case T_SYNC_V35:		case T_SYNC_RS449:		case T_UNIV_RS232:		case T_UNIV_RS449:		case T_UNIV_V35:			c->ifp = malloc (IFSTRUCTSZ, M_DEVBUF, M_NOWAIT);			if (! c->ifp) {				printf ("cx%d.%d: No memory for ifnet buffer\n",					c->board->num, c->num);				c->type = T_NONE;				continue;			}			bzero (c->ifp, IFSTRUCTSZ);			c->master = c->ifp;			c->ifp->if_softc = c;			c->ifp->if_unit = u;			c->ifp->if_name = "cx";			c->ifp->if_mtu = PP_MTU;			c->ifp->if_flags = IFF_POINTOPOINT | IFF_MULTICAST;			c->ifp->if_ioctl = cxsioctl;			c->ifp->if_start = (start_func_t) cxstart;			c->ifp->if_watchdog = (watchdog_func_t) cxwatchdog;			/* Init routine is never called by upper level? */			sppp_attach (c->ifp);			if_attach (c->ifp);			sp = (struct sppp*) c->ifp;#if NBPFILTER > 0			/* If BPF is in the kernel, call the attach for it. */			bpfattach (c->ifp, DLT_PPP, PPP_HEADER_LEN);#endif		}	}	/* Reset the adapter. */	cx_setup_board (b);	/* Activate the timeout routine. */	if (unit == 0)		timeout (cxtimeout, 0, hz*5);	printf ("cx%d: <Cronyx-%s>\n", unit, b->name);#ifdef DEVFS	cx_devfs_token =		devfs_add_devswf(&cx_cdevsw, 0, DV_CHR, 0, 0, 0600, "cx");#endif	return (1);}struct isa_driver cxdriver = { cxprobe, cxattach, "cx" };/* * Process an ioctl request. */static intcxsioctl (struct ifnet *ifp, u_long cmd, caddr_t data){	cx_chan_t *q, *c = ifp->if_softc;	int error, s, was_up, should_be_up;	/*	 * No socket ioctls while the channel is in async mode.	 */	if (c->type==T_NONE || c->mode==M_ASYNC)		return (EINVAL);	/*	 * Socket ioctls on slave subchannels are not allowed.	 */	if (c->master != c->ifp)		return (EBUSY);	was_up = (ifp->if_flags & IFF_RUNNING) != 0;	error = sppp_ioctl (ifp, cmd, data);	if (error)		return (error);	print (("cxioctl (%d.%d, ", c->board->num, c->num));	switch (cmd) {	default:		print (("0x%x)\n", cmd));		return (0);	case SIOCADDMULTI:		print (("SIOCADDMULTI)\n"));		return (0);	case SIOCDELMULTI:		print (("SIOCDELMULTI)\n"));		return (0);	case SIOCSIFFLAGS:		print (("SIOCSIFFLAGS)\n"));		break;	case SIOCSIFADDR:		print (("SIOCSIFADDR)\n"));		break;	}	/* We get here only in case of SIFFLAGS or SIFADDR. */	s = splimp ();	should_be_up = (ifp->if_flags & IFF_RUNNING) != 0;	if (!was_up && should_be_up) {		/* Interface goes up -- start it. */		cxup (c);		/* Start all slave subchannels. */		for (q=c->slaveq; q; q=q->slaveq)			cxup (q);		cxstart (c->ifp);	} else if (was_up && !should_be_up) {		/* Interface is going down -- stop it. */		cxdown (c);		/* Stop all slave subchannels. */		for (q=c->slaveq; q; q=q->slaveq)			cxdown (q);		/* Flush the interface output queue */		if (! c->sopt.ext)			sppp_flush (c->ifp);	}	splx (s);	return (0);}/* * Stop the interface.  Called on splimp(). */static voidcxdown (cx_chan_t *c){	unsigned short port = c->chip->port;	print (("cx%d.%d: cxdown\n", c->board->num, c->num));	/* The interface is down, stop it */	c->ifp->if_flags &= ~IFF_OACTIVE;	/* Reset the channel (for sync modes only) */		outb (CAR(port), c->num & 3);		outb (STCR(port), STC_ABORTTX | STC_SNDSPC);	cx_setup_chan (c);}/* * Start the interface.  Called on splimp(). */static voidcxup (cx_chan_t *c){	unsigned short port = c->chip->port;		/* The interface is up, start it */	        print (("cx%d.%d: cxup\n", c->board->num, c->num));		/* Initialize channel, enable receiver and transmitter */		cx_cmd (port, CCR_INITCH | CCR_ENRX | CCR_ENTX);		/* Repeat the command, to avoid the rev.H bug */		cx_cmd (port, CCR_INITCH | CCR_ENRX | CCR_ENTX);		/* Start receiver */

?? 快捷鍵說明

復(fù)制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
成人综合在线观看| av在线一区二区| 99九九99九九九视频精品| 欧美日韩一级片在线观看| 国产日产欧产精品推荐色| 亚洲一区二区三区中文字幕| 国产一区二区中文字幕| 欧美日韩精品电影| 中文字幕欧美国产| 九九视频精品免费| 欧美视频在线一区二区三区 | 日本欧美加勒比视频| www.性欧美| 精品久久久久久久久久久久包黑料 | 久久久久国产精品人| 丝袜脚交一区二区| 欧美中文字幕亚洲一区二区va在线 | 色综合视频在线观看| 久久综合中文字幕| 日韩av一区二区在线影视| 在线亚洲一区观看| 日韩一区欧美小说| 国产激情视频一区二区三区欧美 | 国产在线观看免费一区| 91精品国产综合久久精品图片 | 337p亚洲精品色噜噜噜| 亚洲国产精品久久久男人的天堂| 91麻豆自制传媒国产之光| 国产精品女人毛片| 成人av电影观看| 国产精品久久久久一区| 成人一区二区三区视频| 亚洲国产成人午夜在线一区| 粉嫩在线一区二区三区视频| 亚洲国产成人私人影院tom| 亚洲精品视频一区| 5858s免费视频成人| 亚洲精品一区二区三区精华液 | 精品国产百合女同互慰| 久久精品国产久精国产| 日韩亚洲欧美成人一区| 蜜臀国产一区二区三区在线播放 | 捆绑调教美女网站视频一区| 欧美刺激午夜性久久久久久久| 麻豆一区二区在线| 26uuu国产在线精品一区二区| 九九热在线视频观看这里只有精品| 26uuu久久天堂性欧美| 国产精品一品二品| 成人免费在线观看入口| 色欧美乱欧美15图片| 午夜视频一区二区| 日韩一区二区电影在线| 国产伦理精品不卡| 亚洲品质自拍视频网站| 欧美日韩一区二区三区在线 | 一区二区三区四区视频精品免费 | 日韩不卡一区二区三区| 日韩精品一区国产麻豆| 成人污视频在线观看| 亚洲线精品一区二区三区| 制服丝袜亚洲网站| 国产69精品久久久久毛片| 亚洲精品视频在线观看网站| 日韩写真欧美这视频| 成熟亚洲日本毛茸茸凸凹| 亚洲一二三区在线观看| 精品国产成人系列| 日本道色综合久久| 国产真实乱子伦精品视频| 亚洲欧美另类小说| 26uuu亚洲| 91福利视频网站| 老司机一区二区| 中文字幕日韩av资源站| 欧美成人精品高清在线播放| 99精品视频免费在线观看| 免费人成黄页网站在线一区二区| 国产精品色眯眯| 日韩视频免费直播| 色婷婷国产精品| 国产传媒欧美日韩成人| 日韩**一区毛片| 一区二区三区精品久久久| 精品成人一区二区| 欧美精品在线一区二区| 99久久国产综合精品色伊| 国内偷窥港台综合视频在线播放| 亚洲欧美一区二区久久| 国产亚洲一区二区三区在线观看| 欧美日韩国产小视频在线观看| 粉嫩aⅴ一区二区三区四区| 日本91福利区| 亚洲va欧美va人人爽| 亚洲少妇屁股交4| 欧美激情一区二区三区不卡| 欧美zozo另类异族| 欧美日韩你懂得| 欧美综合一区二区| 91亚洲午夜精品久久久久久| 成人夜色视频网站在线观看| 美女脱光内衣内裤视频久久网站| 亚洲成人自拍一区| 亚洲综合久久久久| 亚洲女同一区二区| 最新日韩在线视频| 国产精品不卡在线| 中文在线一区二区| 亚洲国产精品精华液2区45| 久久久久久久久免费| 精品国产一区二区三区久久久蜜月 | 麻豆视频一区二区| 免费欧美在线视频| 蜜桃视频在线一区| 蜜桃av噜噜一区| 久久9热精品视频| 狠狠色狠狠色综合系列| 国产在线不卡一区| 国产成人精品影视| 不卡电影一区二区三区| 97se亚洲国产综合自在线不卡| 成人av午夜电影| 91麻豆国产精品久久| 99re热这里只有精品免费视频| 成人av手机在线观看| 99视频国产精品| 色久综合一二码| 欧美日韩一区不卡| 欧美电影免费观看高清完整版在线 | 91精品综合久久久久久| 欧美成人欧美edvon| 国产清纯白嫩初高生在线观看91 | 欧美日韩中文一区| 欧美精品丝袜久久久中文字幕| 91麻豆精品国产91久久久使用方法| 日韩一区二区三区电影| 久久免费偷拍视频| 日韩理论片中文av| 日韩激情一二三区| 国产精品一区一区三区| 一本色道久久综合狠狠躁的推荐 | 欧美色电影在线| 日韩三级电影网址| 中文字幕高清不卡| 亚洲一区二区成人在线观看| 日本不卡视频一二三区| 福利视频网站一区二区三区| 欧洲在线/亚洲| 精品国产乱码久久| 亚洲男人的天堂在线aⅴ视频| 免费成人在线网站| 成人高清视频免费观看| 在线电影国产精品| 国产精品国产三级国产aⅴ中文| 亚洲国产精品影院| 国产成人啪午夜精品网站男同| 欧美在线三级电影| 国产情人综合久久777777| 天堂精品中文字幕在线| 国产v综合v亚洲欧| 91精品国模一区二区三区| 国产精品国产三级国产三级人妇| 日本系列欧美系列| 91丝袜美女网| 久久蜜桃香蕉精品一区二区三区| 亚洲激情成人在线| 国产成人精品aa毛片| 日韩一区二区影院| 夜夜夜精品看看| 成人午夜免费av| 亚洲精品一区二区三区福利 | 久久久国产一区二区三区四区小说| 一区二区三区欧美激情| 国产成人在线视频网站| 日韩一卡二卡三卡国产欧美| 亚洲精品国产a| 成人动漫一区二区在线| 久久蜜臀中文字幕| 久久成人免费电影| 欧美日韩高清一区二区不卡| 亚洲少妇30p| 99久久免费精品高清特色大片| 久久亚洲捆绑美女| 日日摸夜夜添夜夜添国产精品 | 国产精品99久久久久久有的能看 | 欧美麻豆精品久久久久久| 亚洲免费观看高清完整版在线观看 | 91精品国产综合久久精品| 亚洲一区二区三区爽爽爽爽爽| av综合在线播放| 国产精品高潮久久久久无| 丰满白嫩尤物一区二区| 日本一区二区免费在线观看视频| 国产精品自拍一区| 久久影院电视剧免费观看| 精品亚洲欧美一区| 精品av久久707| 国产精品白丝jk黑袜喷水| 久久网站最新地址| 国产乱国产乱300精品|