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

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

?? 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"#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一区二区三区免费野_久草精品视频
中文字幕在线不卡视频| 国产美女娇喘av呻吟久久| 国产91丝袜在线18| 精品处破学生在线二十三| 五月激情六月综合| 精品视频免费看| 亚洲精品五月天| 欧美日产国产精品| 日本成人超碰在线观看| 精品国产制服丝袜高跟| 国产精品亚洲专一区二区三区 | 亚洲男人的天堂在线aⅴ视频| 91在线观看视频| 一区二区久久久久久| 欧美三级三级三级| 激情综合网激情| 亚洲色图欧洲色图婷婷| 欧美日韩二区三区| 国产一区二区三区精品视频| 久久久久久电影| 色天天综合久久久久综合片| 亚洲国产成人91porn| 欧美一区二区三区精品| 国产成人自拍网| 亚洲国产va精品久久久不卡综合| 日韩免费在线观看| 91年精品国产| 国产精品一区二区三区乱码| 国产精品国产三级国产普通话蜜臀 | 国产精品美日韩| 亚洲精品在线网站| 欧美日韩中文国产| 成人av在线影院| 紧缚捆绑精品一区二区| 亚洲一二三四区| 亚洲人成伊人成综合网小说| 日韩视频一区二区在线观看| 色婷婷精品久久二区二区蜜臀av | 日本亚洲三级在线| 亚洲精品第1页| ㊣最新国产の精品bt伙计久久| 日韩欧美一区二区不卡| 精品视频在线看| 欧美日韩精品一区二区在线播放| 国产一区二区三区四| 天堂午夜影视日韩欧美一区二区| 亚洲免费观看高清完整版在线观看熊| 国产拍揄自揄精品视频麻豆| 日韩免费看的电影| 日韩免费观看高清完整版| 精品视频一区三区九区| 欧美在线视频日韩| 欧美精品v日韩精品v韩国精品v| 欧美影视一区在线| 欧美日韩中文精品| 日韩视频123| 日韩欧美中文字幕精品| 久久一留热品黄| 中文字幕av不卡| 亚洲天天做日日做天天谢日日欢| 久久蜜桃一区二区| 精品日韩成人av| 久久免费国产精品| 中文字幕巨乱亚洲| 亚洲欧美另类久久久精品2019| 亚洲精品国产成人久久av盗摄 | 亚洲国产精品成人综合| 1024国产精品| 麻豆成人91精品二区三区| 国产精品原创巨作av| 色悠悠久久综合| 91麻豆精品国产| 国产亚洲自拍一区| 亚洲免费观看高清在线观看| 亚洲成av人综合在线观看| 精品一区二区三区视频在线观看| 国产剧情在线观看一区二区| 色视频一区二区| 日韩精品一区二区三区中文不卡| 国产精品福利在线播放| 蜜臀av一区二区| 在线视频中文字幕一区二区| 91精品国产一区二区三区蜜臀 | 亚洲欧美激情插| 青青青伊人色综合久久| 99久久er热在这里只有精品15| 欧美精选一区二区| 国产精品盗摄一区二区三区| 日韩成人午夜精品| 欧美日韩视频在线一区二区| 亚洲欧洲av在线| 国产在线一区观看| 精品国产一区二区精华| 精品国产91亚洲一区二区三区婷婷| 亚洲一区二区三区中文字幕在线| av中文字幕在线不卡| 国产欧美一区二区精品秋霞影院 | 国产成人激情av| 日韩一区二区三区在线观看 | 综合久久久久久| 国产99久久久国产精品免费看| 欧美成人午夜电影| 国产精品一区在线观看你懂的| 日韩午夜三级在线| 久久成人羞羞网站| 欧美本精品男人aⅴ天堂| 日韩激情中文字幕| 欧美精品久久99久久在免费线 | 99精品久久只有精品| 自拍偷拍亚洲激情| 成人免费视频网站在线观看| 亚洲人xxxx| 91精品国产综合久久久久久| 美女视频一区在线观看| 国产午夜精品在线观看| av不卡一区二区三区| 亚洲成人一区在线| 国产欧美日韩在线| 日本韩国欧美在线| 丝袜诱惑亚洲看片| 欧美激情一区二区三区全黄 | 水蜜桃久久夜色精品一区的特点| 日韩欧美的一区二区| 不卡av免费在线观看| 石原莉奈在线亚洲三区| 国产精品女人毛片| 色欧美88888久久久久久影院| 午夜精品福利视频网站| 69堂亚洲精品首页| 色狠狠av一区二区三区| 日韩精品视频网| 中文字幕一区二区三区不卡在线 | 国产不卡在线视频| 亚洲午夜激情网页| 69堂国产成人免费视频| 国产麻豆视频精品| 午夜欧美大尺度福利影院在线看| 99久久婷婷国产精品综合| 蜜臀av一区二区| 亚洲伦理在线精品| 亚洲欧洲综合另类在线| 欧美美女一区二区三区| 91在线视频播放| 福利91精品一区二区三区| 日韩高清不卡在线| 一区二区三区影院| 国产亚洲精久久久久久| 91麻豆精品国产91久久久| 欧美日韩综合不卡| 色综合天天综合网国产成人综合天| 婷婷夜色潮精品综合在线| 成人欧美一区二区三区小说| 国产日韩欧美在线一区| 欧美刺激午夜性久久久久久久| 欧美日韩一级二级三级| 91精品福利在线| 欧美色手机在线观看| 欧美日韩激情一区| 日韩一级片网址| 欧美激情中文字幕一区二区| 久久精品欧美一区二区三区不卡 | 国产成人av一区二区三区在线观看| 日本女人一区二区三区| 久久成人免费日本黄色| 国产福利一区二区三区| eeuss影院一区二区三区| 欧美图片一区二区三区| 91精品蜜臀在线一区尤物| 久久亚洲欧美国产精品乐播 | 一区二区三区日韩欧美精品| 午夜激情久久久| 成人手机电影网| 91精品婷婷国产综合久久竹菊| 日韩精品一区二区三区三区免费| 亚洲国产电影在线观看| 亚洲自拍欧美精品| 国产成人在线看| 制服丝袜一区二区三区| 国产精品国产三级国产a| 亚洲一二三四在线观看| 国产一区91精品张津瑜| 欧美日韩在线一区二区| 中文字幕第一页久久| 午夜在线成人av| 色诱视频网站一区| 亚洲欧洲日韩女同| 久久精品国产一区二区| 欧美人与禽zozo性伦| 亚洲视频一区二区免费在线观看| 日韩av电影免费观看高清完整版| 91黄色免费看| 一区二区三区中文字幕精品精品| 成人中文字幕电影| 久久一区二区三区国产精品| 久久国产精品99久久久久久老狼 | 亚洲精品视频免费看| 99精品视频一区| 亚洲男人的天堂在线aⅴ视频| 菠萝蜜视频在线观看一区| 国产欧美一区二区三区网站|