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

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

?? if_cx.c

?? 基于組件方式開發操作系統的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"#if NCX > 0#include <bpfilter.h>#include <sys/param.h>#include <sys/systm.h>#include <sys/kernel.h>#include <sys/mbuf.h>#include <sys/ioctl.h>#include <sys/socket.h>#include <sys/conf.h>#include <sys/errno.h>#include <net/if.h>#include <net/if_types.h>#if NBPFILTER > 0#include <net/bpf.h>#include <net/bpfdesc.h>#endif#ifdef __FreeBSD__#   include <i386/isa/isa_device.h>#   if __FreeBSD__ < 2#      include <machine/pio.h>#   else#      include <machine/cpufunc.h>#      include <sys/devconf.h>#   endif#   define init_func_t     void(*)(int)#   define watchdog_func_t void(*)(int)#   define start_func_t    void(*)(struct ifnet*)#endif#ifdef __bsdi__#   if INET#      include <netinet/in.h>#      include <netinet/in_systm.h>#      include <netinet/ip.h>#   endif#   include <sys/device.h>#   include <i386/isa/isavar.h>#   include <i386/isa/icu.h>#   include <machine/inline.h>#   include <net/if_slvar.h>#   include <net/if_p2p.h>#   define timeout_func_t  void(*)()#   define init_func_t     int(*)()#   define watchdog_func_t int(*)()#   define start_func_t    int(*)()struct cxsoftc {	struct device dev;      /* base device */	struct isadev isadev;   /* ISA device */	struct intrhand intr;   /* interrupt vectoring */};#endif#include <net/if_sppp.h>#include <machine/cronyx.h>#include <i386/isa/cxreg.h>#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. */#ifdef __bsdi__#   define SPPPSZ       (sizeof (struct sppp))#   define P2PSZ        (sizeof (struct p2pcom))#   define IFSTRUCTSZ   (SPPPSZ>P2PSZ ? SPPPSZ : P2PSZ)#else#   define IFSTRUCTSZ   (sizeof (struct sppp))#endif#define IFNETSZ         (sizeof (struct ifnet))int cxsioctl (struct ifnet *ifp, int cmd, caddr_t data);void cxinit (int unit);void cxstart (struct ifnet *ifp);void cxwatchdog (int unit);void cxinput (cx_chan_t *c, void *buf, unsigned len);int cxrinta (cx_chan_t *c);void cxtinta (cx_chan_t *c);void cxmint (cx_chan_t *c);void cxtimeout (caddr_t a);void cxdown (cx_chan_t *c);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,};#if __FreeBSD__ >= 2static char cxdescription [80];struct kern_devconf kdc_cx [NCX] = { {	0, 0, 0, "cx", 0, { MDDT_ISA, 0, "net" },	isa_generic_externalize, 0, 0, ISA_EXTERNALLEN, &kdc_isa0, 0,	DC_IDLE, cxdescription, DC_CLS_SERIAL} };#endif/* * 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 += n;		len -= n;	}	return (m);}/* * Test the presence of the adapter on the given i/o port. */#ifdef __FreeBSD__int cxprobe (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;#endif#ifdef __bsdi__int cxprobe (struct device *parent, struct cfdata *cf, void *aux){	int unit = cf->cf_unit;	int iobase = ((struct isa_attach_args*)aux)->ia_iobase;	int irq = ((struct isa_attach_args*)aux)->ia_irq;	int drq = ((struct isa_attach_args*)aux)->ia_drq;	int irqnum, i;	for (i=0; i<NCX; ++i)		if (i != unit && cxboard[i].port == iobase)			return (0);	if (irq == IRQUNK) {		irq = isa_irqalloc (IRQ3|IRQ5|IRQ7|IRQ10|IRQ11|IRQ12|IRQ15);		if (! irq)			return (0);		((struct isa_attach_args*)aux)->ia_irq = irq;	}#endif	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 __FreeBSD__int cxattach (struct isa_device *id){	int unit = id->id_unit;	int iobase = id->id_iobase;	int irq = id->id_irq;	int drq = id->id_drq;#endif#ifdef __bsdi__void cxattach (struct device *parent, struct device *self, void *aux){	int unit = self->dv_unit;	int iobase = ((struct isa_attach_args*)aux)->ia_iobase;	int irq = ((struct isa_attach_args*)aux)->ia_irq;	int drq = ((struct isa_attach_args*)aux)->ia_drq;	struct cxsoftc *sc = (struct cxsoftc*) self;	void cxintr (cx_board_t *b);#endif	cx_board_t *b = cxboard + unit;	int i;	/* 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_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? */			c->ifp->if_init = (init_func_t) cxinit;			sppp_attach (c->ifp);			if_attach (c->ifp);#if NBPFILTER > 0			/* If BPF is in the kernel, call the attach for it. */			bpfattach (&c->bpf, c->ifp, DLT_PPP, PPP_HEADER_LEN);#endif		}	}	/* Reset the adapter. */	cx_setup_board (b);	/* Activate the timeout routine. */	if (unit == 0)		timeout ((timeout_func_t) cxtimeout, 0, hz*5);#if __FreeBSD__ >= 2	if (unit != 0)		kdc_cx[unit] = kdc_cx[0];	kdc_cx[unit].kdc_unit = unit;	kdc_cx[unit].kdc_isa = id;	sprintf (cxdescription, "Cronyx-Sigma-%s sync/async serial adapter",		b->name);	dev_attach (&kdc_cx[unit]);#endif#ifdef __FreeBSD__	printf ("cx%d: <Cronyx-%s>\n", unit, b->name);	return (1);#endif#ifdef __bsdi__	printf (": <Cronyx-%s>\n", b->name);	isa_establish (&sc->isadev, &sc->dev);	sc->intr.ih_fun = (int(*)()) cxintr;	sc->intr.ih_arg = (void*) b;	intr_establish (irq, &sc->intr, DV_NET);#endif}#ifdef __FreeBSD__struct isa_driver cxdriver = { cxprobe, cxattach, "cx" };#endif#ifdef __bsdi__struct cfdriver cxcd = { 0, "cx", cxprobe, cxattach, sizeof (struct cxsoftc) };#endif/* * Process an ioctl request. */int cxsioctl (struct ifnet *ifp, int cmd, caddr_t data){	cx_chan_t *q, *c = cxchan[ifp->if_unit];	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;#ifdef __bsdi__	if (c->sopt.ext)		error = p2p_ioctl (ifp, cmd, data);	else#endif	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(). */void cxdown (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(). */void cxup (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));

?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
久久精品久久综合| 成人国产精品免费网站| 国产女主播一区| 7777精品伊人久久久大香线蕉的| 91亚洲永久精品| 91麻豆蜜桃一区二区三区| 91啪九色porn原创视频在线观看| 97久久精品人人爽人人爽蜜臀| 成人黄色在线看| 91色乱码一区二区三区| 一本色道a无线码一区v| 欧美人与禽zozo性伦| 日韩欧美资源站| 久久久久国产精品免费免费搜索| 国产欧美一区二区三区沐欲| 成人免费一区二区三区在线观看| **欧美大码日韩| 视频一区二区三区入口| 久久国产欧美日韩精品| 风流少妇一区二区| 91久久一区二区| 日韩区在线观看| 成人免费在线观看入口| 日韩中文字幕区一区有砖一区| 日韩电影在线免费观看| 国产一区二区三区在线观看精品| 国产精品中文字幕一区二区三区| 99久久婷婷国产精品综合| 欧美日韩国产小视频在线观看| 精品剧情在线观看| 中文字幕第一区二区| 亚洲一区二区三区国产| 午夜精品一区二区三区免费视频 | 欧美日韩亚洲不卡| 日韩一区二区三区观看| 亚洲色图欧美偷拍| 麻豆免费看一区二区三区| 成人自拍视频在线| 日韩一级欧美一级| 一区二区三区精品在线观看| 紧缚捆绑精品一区二区| 欧美亚洲一区二区在线| 中文字幕第一页久久| 琪琪一区二区三区| 欧美专区在线观看一区| 国产精品久久久久久一区二区三区| 丝袜诱惑亚洲看片| 色婷婷综合久久久中文一区二区| 337p日本欧洲亚洲大胆精品| 亚洲第一狼人社区| 色欧美乱欧美15图片| 中文在线免费一区三区高中清不卡| 日本在线不卡视频一二三区| 在线观看日产精品| 中文字幕一区在线| 成人伦理片在线| 精品福利av导航| 久久精品国产久精国产| 欧美日韩一卡二卡三卡| 亚洲综合色成人| 色94色欧美sute亚洲13| 亚洲欧美在线观看| 99精品黄色片免费大全| 欧美激情在线一区二区三区| 国产一区二区0| 成人免费观看av| 精品国产亚洲在线| 久久精工是国产品牌吗| 91精品国产丝袜白色高跟鞋| 婷婷综合在线观看| 欧美一区二区三区电影| 日本成人中文字幕| 91精品国产手机| 久久精品久久综合| 久久久久99精品国产片| 国产精品一卡二卡| 国产精品久久久久三级| 色综合中文字幕| 国产成人精品www牛牛影视| 欧美一区二区三区视频在线| 免费观看在线综合色| 日韩欧美一级二级三级| 国产米奇在线777精品观看| 国产日韩欧美一区二区三区乱码| 国产不卡在线播放| 最新中文字幕一区二区三区| 色综合一区二区| 亚洲va欧美va人人爽| 欧美男男青年gay1069videost| 日韩中文字幕区一区有砖一区| 欧美一级日韩一级| 国产激情一区二区三区| 亚洲色图在线看| 91精品国产色综合久久ai换脸 | 欧美精品一二三四| 蜜臀av性久久久久蜜臀aⅴ四虎| 日韩一区二区免费电影| 国产成人精品一区二区三区网站观看| 精品国产乱码久久久久久浪潮| 色屁屁一区二区| 久久欧美中文字幕| 高清不卡一二三区| 精品三级av在线| 成人中文字幕电影| 亚洲一区二区三区视频在线| 精品国产sm最大网站免费看 | 538在线一区二区精品国产| 麻豆精品视频在线| 亚洲免费电影在线| 日韩精品中文字幕在线一区| 9人人澡人人爽人人精品| 日韩精品久久理论片| 国产精品三级电影| 欧美一卡2卡3卡4卡| 成人毛片视频在线观看| 天天影视涩香欲综合网| 国产精品每日更新在线播放网址| 欧美精品第一页| 91蜜桃免费观看视频| 国产麻豆9l精品三级站| 午夜视频在线观看一区二区三区| 国产精品免费人成网站| 日韩一级二级三级精品视频| 欧美性受xxxx| 99re这里只有精品首页| 国内精品国产成人| 日韩精品高清不卡| 久久先锋影音av鲁色资源网| 欧洲国内综合视频| 97精品久久久久中文字幕| 国产乱理伦片在线观看夜一区| 亚洲成人一区在线| 日本一区二区视频在线| 制服视频三区第一页精品| 91视频国产观看| 99久久精品国产毛片| 国产98色在线|日韩| 国产一区二区三区观看| 麻豆91免费观看| 另类中文字幕网| 免费成人在线视频观看| 免费观看一级欧美片| 日韩中文字幕av电影| 亚洲超碰97人人做人人爱| 亚洲午夜精品在线| 亚洲欧美日韩在线| 亚洲精品国产成人久久av盗摄| 中文字幕一区二区三区不卡在线 | 久久精品日产第一区二区三区高清版 | 日韩伦理免费电影| 亚洲欧美综合在线精品| 中文字幕一区二区三区不卡| 中文字幕av一区二区三区高| 中文字幕精品一区二区精品绿巨人 | 欧美成人video| 欧美不卡一区二区三区四区| 日韩美女视频在线| 精品对白一区国产伦| 久久久精品黄色| 久久精品欧美一区二区三区麻豆| 国产精品久久一卡二卡| 成人免费视频在线观看| 亚洲精品第一国产综合野| 亚洲国产精品天堂| 日本午夜一区二区| 国产综合一区二区| 成人黄色在线看| 色婷婷久久久久swag精品 | 亚洲电影一级片| 午夜欧美视频在线观看| 裸体健美xxxx欧美裸体表演| 久久97超碰色| 国产激情一区二区三区四区| 色综合色综合色综合色综合色综合| 欧美日韩精品系列| 欧美精品一区二区在线播放| 国产精品嫩草99a| 性久久久久久久| 国产成人av电影免费在线观看| 91麻豆蜜桃一区二区三区| 欧美一区二区日韩| 国产精品网站在线观看| 午夜精品久久久久久久| 国产精品996| 在线观看免费亚洲| ww久久中文字幕| 香蕉加勒比综合久久| 懂色av中文字幕一区二区三区| 欧美影院一区二区三区| 国产亚洲女人久久久久毛片| 亚洲一区二区三区四区在线| 国产一区二区精品久久91| 91国偷自产一区二区使用方法| 精品国产乱码久久久久久图片| 亚洲激情中文1区| 国产一区二区看久久| 欧美高清视频在线高清观看mv色露露十八 | 国产麻豆成人传媒免费观看| 欧美亚一区二区| 中文无字幕一区二区三区|