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

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

?? hs.c

?? 用于底層開發的TCPIP協議棧源代碼
?? C
?? 第 1 頁 / 共 2 頁
字號:
/* Interface driver for the DRSI PCPA or the Eagle 8530 boards for the IBM PC
 * connected to a WA4DSY 56kbps modem. Uses polling-loop transfers with
 * interrupts disabled for maximum speed.
 *
 * This driver is a bit of a kludge. A DMA-driven card and driver (e.g.,
 * the PI) is much better, but this is better than nothing if all you have
 * is a "dumb" 8530 card.
 *
 */
#include <stdio.h>
#include <dos.h>
#include "global.h"
#include "mbuf.h"
#include "iface.h"
#include "pktdrvr.h"
#include "netuser.h"
#include "hs.h"
#include "z8530.h"
#include "ax25.h"
#include "trace.h"
#include "nospc.h"
#include "proc.h"
#include "devparam.h"

static void flushrx(uint16 data);
static void hdlcparam(struct hdlc *hp);
static void hexint(struct hdlc *hp);
static void hrxint(struct hdlc *hp);
static int hs_stop(struct iface *iface);
static int hs_raw(struct iface *iface,struct mbuf **bpp);
static int32 hs_ctl(struct iface *,int cmd,int set,int32 val);
static void hstxoff(struct hdlc *hp);
static void hstxon(struct hdlc *hp);
static void htxint(struct hdlc *hp);
static void init_delay(void);
static void msdelay(void);

static struct hs Hs[NHS];
static INTERRUPT (*Hshandle[])() = { hs0vec };
static struct hdlc Hdlc[2*NHS];
static uint16 Nhs;

/* Master interrupt handler for the PC-100 card. All interrupts come
 * here first, then are switched out to the appropriate routine.
 */
INTERRUPT (far *(hsint)(dev))()
int dev;
{
	register char iv;
	uint16 hsbase;
	struct hs *hsp;
	register struct hdlc *hp;
	
	hsp = &Hs[dev];
	hsp->ints++;
	hsbase = hsp->addr;

#ifdef	foo
	outportb(hsbase+4,0x8+0x10);	/* HIT EAGLE INTACK */
	(void)inportb(hsbase+CHANA+CTL,R0);
	outportb(hsbase+4,0x8);		/***/
#endif

	/* Read interrupt status from channel A */
	while((iv = read_scc(hsbase+CHANA+CTL,R3)) != 0){
		if(iv & CHARxIP){
			/* Channel A Rcv Interrupt Pending */
			hp = &Hdlc[2*dev];
			hrxint(hp);
		} else if(iv & CHATxIP){
			/* Channel A Transmit Int Pending */
			hp = &Hdlc[2*dev];
			htxint(hp);
		} else if(iv & CHAEXT){
			/* Channel A External Status Int */
			hp = &Hdlc[2*dev];
			hexint(hp);
		} else if(iv & CHBRxIP){
			/* Channel B Rcv Interrupt Pending */
			hp = &Hdlc[(2*dev)+1];
			hrxint(hp);
		} else if(iv & CHBTxIP){
			/* Channel B Transmit Int Pending */
			hp = &Hdlc[(2*dev)+1];
			htxint(hp);
		} else if(iv & CHBEXT){
			/* Channel B External Status Int */
			hp = &Hdlc[(2*dev)+1];
			hexint(hp);
		}
		/* Reset interrupt pending state */
		write_scc(hp->ctl,R0,RES_H_IUS);
		outportb(hsbase+CHANA+CTL,0);	/* Restore pointer to 0 */
		outportb(hsbase+CHANB+CTL,0);	/* Restore pointer to 0 */
	}
	outportb(hsbase+CHANA+CTL,0);	/* Restore pointer to 0 */
	outportb(hsbase+CHANB+CTL,0);	/* Restore pointer to 0 */
	return hsp->chain ? hsp->save.vec : NULL;
}
/* HDLC SIO External/Status interrupts
 * The only one that can happen in this driver is a DCD change
 */
static void
hexint(hp)
register struct hdlc *hp;
{
	struct mbuf *rcvbuf;
	char *cp;
	int cnt,data;
	register int ctl;

	ctl = hp->ctl;
	data = hp->data;
	hp->exints++;

	/* Allocate a receive buffer */
	if((rcvbuf = alloc_mbuf(hp->bufsiz+sizeof(struct iface *))) == NULL){
		/* Alloc failed; refuse to proceed */
		hp->nomem++;
		write_scc(ctl,R3,ENT_HM|RxENABLE|RxCRC_ENAB|Rx8);
		write_scc(ctl,R0,RES_EXT_INT);
		return;
	}
	/* Allow space for descriptor on front */
	rcvbuf->data += sizeof(struct iface *);
	cnt = 0;

	/* Disable DCDIE bit so we can track changes in DCD */
	write_scc(ctl,R15,0);

	write_scc(ctl,R3,ENT_HM|RxENABLE|RxCRC_ENAB|Rx8);
	flushrx(data);
	while((cnt = rx8530(ctl,data,cp,hp->bufsiz)) != -1){
		if(cnt > 4){
			/* Good frame */
			hp->good++;
			/* Toss crc */
			rcvbuf->cnt = cnt - 1;
			net_route(hp->iface,&rcvbuf);
			/* Replenish buffer */
			rcvbuf = alloc_mbuf(hp->bufsiz + sizeof(struct iface *));
		}
		/* Start new buffer */
		if(rcvbuf == NULL)
			break;	/* alloc failed */
		rcvbuf->data +=  sizeof(struct iface *);
	}	
	write_scc(ctl,R0,RES_EXT_INT);
	write_scc(ctl,R15,DCDIE);	/* Re-enable DCD */
	write_scc(ctl,R3,ENT_HM|RxENABLE|RxCRC_ENAB|Rx8);

	/* Get rid of fragmentary buffer */
	free_p(&rcvbuf);
}
static void
flushrx(data)
register uint16 data;
{
	register int i = 5;
	while(i-- != 0)
		(void)inportb(data);
}
/* HDLC receiver interrupt handler.
 * Not used in this driver
 */
static void
hrxint(hp)
register struct hdlc *hp;
{
}
/* HDLC transmit interrupt service routine
 * Not used in this driver
 */
static void
htxint(hp)
register struct hdlc *hp;
{
}

/* (re)Initialize HDLC controller parameters */
static void
hdlcparam(hp)
register struct hdlc *hp;
{
	register uint16 ctl;
	int i_state;

	/* Initialize 8530 channel for SDLC operation */
	ctl = hp->ctl;
	i_state = dirps();

#ifdef	foo
	switch(ctl & 2){
	case CHANA:
		write_scc(ctl,R9,CHRA);	/* Reset channel A */
		break;
	case CHANB:
		write_scc(ctl,R9,CHRB);	/* Reset channel B */
		break;
	}
	ppause(1L);	/* Allow plenty of time for resetting */
#endif

	/* Deselect interrupts for now */
	write_scc(ctl,R1,0);
	write_scc(ctl,R15,0);

	/* X1 clock, SDLC mode, Sync modes enable, parity disable */
	write_scc(ctl,R4,X1CLK | SDLC | SYNC_ENAB);

	/* CRC preset 1, NRZ encoding, no active on poll, flag idle,
	 * flag on underrun, no loop mode, 8 bit sync
	 */
	write_scc(ctl,R10,CRCPS|NRZ);

	/* 8530 gets both tx and rx clock from modem.
	 * By default, TRxC = transmit clock, RTxC = receive clock
	 * (swapped 11 Feb 1990 to use new DRSI wiring) UNLESS
	 * the 'r' parameter is specified
	 */
	if(!hp->clkrev)
		write_scc(ctl,R11,RCRTxCP | TCTRxCP);
	else
		write_scc(ctl,R11,RCTRxCP | TCRTxCP);

	/* Note: baud rate generator not used */

	/* Null out SDLC start address */
	write_scc(ctl,R6,0);

	/* SDLC flag */
	write_scc(ctl,R7,FLAG);

	/* DTR On, 8 bit TX chars, no break, TX enable, SDLC CRC,
	 * RTS off, TxCRC enable
	 */
	write_scc(ctl,R5,DTR|Tx8|TxENAB|TxCRC_ENAB);

	/* 8 bit RX chars, auto enables off, no hunt mode, RxCRC enable,
	 * no address search, no inhibit sync chars, disable RX. Rx is
	 * started only by an actual DCD interrupt
	 */
	write_scc(ctl,R3,RxENABLE|RxCRC_ENAB|Rx8);

	/* Dummy interrupt vector
	 * (This probably isn't necessary)
	 */
	write_scc(ctl,R2,0);

	/* Enable only the external interrupts (modem interrupts) since
	 * polling is used for all actual tx/rx operations
	 */
	write_scc(ctl,R1,EXT_INT_ENAB);

	/* Enable only DCD interrupts */
	write_scc(ctl,R15,DCDIE);

	/* No reset, status low, master int enable, enable lower chain,
	 * no vector
	 */
	write_scc(ctl,R9,MIE|NV);

	restore(i_state);
}
/* Attach a high speed iterface to the system
 * argv[0]: hardware type, must be "hs"
 * argv[1]: I/O address, e.g., "0x380"
 * argv[2]: vector, e.g., "2"
 * argv[3]: mode, must be "ax25"
 * argv[4]: interface base label, e.g., "drsi0". Driver appends "a" and "b".
 * argv[5]: receiver packet buffer size in bytes
 * argv[6]: maximum transmission unit, bytes
 * argv[7]: keyup delay, milliseconds
 * argv[8]: persistence value, 0-255
 * argv[9]: "r" to reverse sense of clock leads (optional)
 */
int
hs_attach(argc,argv,p)
int argc;
char *argv[];
void *p;
{
	register struct iface *if_hsa,*if_hsb;
	struct hdlc *hp;
	int dev;
	char *cp;

	if(Nhs >= NHS){
		printf("Too many hs controllers\n");
		return -1;
	}
	if(if_lookup(argv[4]) != NULL){
		printf("Interface %s already exists\n",argv[4]);
		return -1;
	}
	if(setencap(NULL,argv[3]) == -1){
		printf("Unknown encapsulation %s\n",argv[3]);
		return -1;
	}
	if(Mycall[0] == '\0'){
		printf("set mycall first\n");
		return -1;
	}		
	dev = Nhs++;

	/* Initialize hardware-level control structure */
	Hs[dev].addr = htoi(argv[1]);
	Hs[dev].vec = atoi(argv[2]);
	if(strchr(argv[2],'c') != NULL)
		Hs[dev].chain = 1;
	else
		Hs[dev].chain = 0;

	/* Save original interrupt vector */
	Hs[dev].save.vec = getirq(Hs[dev].vec);
	/* Set new interrupt vector */
	if(setirq(Hs[dev].vec,Hshandle[dev]) == -1){
		printf("IRQ %u out of range\n",Hs[dev].vec);
		Nhs--;
		return -1;
	}
	/* Create interface structures and fill in details */
	if_hsa = (struct iface *)callocw(1,sizeof(struct iface));
	if_hsb = (struct iface *)callocw(1,sizeof(struct iface));

	if_hsa->addr = if_hsb->addr = Ip_addr;
	if_hsa->name = mallocw(strlen(argv[4])+2);
	strcpy(if_hsa->name,argv[4]);
	strcat(if_hsa->name,"a");
	if_hsb->name = mallocw(strlen(argv[4])+2);
	strcpy(if_hsb->name,argv[4]);
	strcat(if_hsb->name,"b");
	if_hsb->mtu = if_hsa->mtu = atoi(argv[6]);
	if_hsa->dev = 2*dev;
	if_hsb->dev = 2*dev + 1;
	if_hsb->stop = if_hsa->stop = hs_stop;
	if_hsb->raw = if_hsa->raw = hs_raw;
	if_hsa->ioctl = if_hsb->ioctl = hs_ctl;

	setencap(if_hsa,argv[3]);
	setencap(if_hsb,argv[3]);
	if(if_hsb->hwaddr == NULL)
		if_hsb->hwaddr = mallocw(AXALEN);
	memcpy(if_hsb->hwaddr,Mycall,AXALEN);
	if(if_hsa->hwaddr == NULL)
		if_hsa->hwaddr = mallocw(AXALEN);
	memcpy(if_hsa->hwaddr,Mycall,AXALEN);
	if_hsa->next = if_hsb;
	if_hsb->next = Ifaces;
	Ifaces = if_hsa;

	write_scc(Hs[dev].addr+CHANA+CTL,R9,FHWRES);
	hp = &Hdlc[2*dev+1];
	hp->ctl = Hs[dev].addr + CHANB + CTL;
	hp->data = Hs[dev].addr + CHANB + DATA;
	hp->bufsiz = atoi(argv[5]);
	if(argc > 7)

?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
久久99精品国产.久久久久 | 国产一区二区三区黄视频| 99久久综合精品| 欧洲国内综合视频| 精品国产乱码久久久久久图片 | 欧美亚洲一区二区在线| 欧美日韩夫妻久久| 久久一夜天堂av一区二区三区| 国产精品成人免费精品自在线观看| 尤物在线观看一区| 日本vs亚洲vs韩国一区三区| 成人一区二区三区中文字幕| 日本道精品一区二区三区| 91精品国产日韩91久久久久久| 久久久久久夜精品精品免费| 亚洲精品国产一区二区精华液| 亚洲国产精品久久久男人的天堂| 国产乱码精品一区二区三区五月婷| 色综合色狠狠天天综合色| 国产欧美1区2区3区| 蜜臀精品久久久久久蜜臀| 久久综合狠狠综合久久综合88 | 欧美午夜在线观看| 最好看的中文字幕久久| 精品一区二区综合| 日韩一卡二卡三卡| 日本不卡高清视频| 日韩精品最新网址| 日韩电影在线观看电影| 欧美日韩亚洲综合| 亚洲国产成人av网| 欧美在线一区二区三区| 亚洲午夜成aⅴ人片| 欧美色图片你懂的| 国产精品456| 国产精品三级av在线播放| 北条麻妃国产九九精品视频| 国产精品国产三级国产普通话蜜臀 | 欧美一卡2卡3卡4卡| 国产成人精品亚洲午夜麻豆| 在线精品观看国产| 亚洲精品videosex极品| 99亚偷拍自图区亚洲| 国产精品国产精品国产专区不片| 另类调教123区| 欧美一卡二卡三卡| 欧美体内she精高潮| 中文字幕制服丝袜一区二区三区| 国产成人自拍高清视频在线免费播放 | 久久人人爽爽爽人久久久| 成人sese在线| 肉色丝袜一区二区| 国产精品传媒入口麻豆| 欧美精品1区2区3区| 免费观看成人av| 亚洲欧洲日韩女同| 亚洲精品一区在线观看| aaa欧美日韩| 国产专区欧美精品| 亚洲午夜久久久久久久久久久| 日韩女优制服丝袜电影| 99精品久久久久久| 国产成人精品亚洲日本在线桃色| 亚洲与欧洲av电影| 欧美一区二区三区在线视频| 欧美欧美欧美欧美| 在线不卡中文字幕| 精品剧情v国产在线观看在线| 日韩一区二区三区免费看 | 日韩精品成人一区二区三区| 综合久久国产九一剧情麻豆| 26uuu亚洲综合色欧美| 欧美一二区视频| 日韩一区二区视频| 日韩午夜在线观看| 日韩欧美亚洲另类制服综合在线| 欧美日韩极品在线观看一区| 欧美激情自拍偷拍| 久久久99久久精品欧美| 久久青草欧美一区二区三区| 久久精品日产第一区二区三区高清版| 日韩欧美一区在线| 久久久精品中文字幕麻豆发布| 国产清纯美女被跳蛋高潮一区二区久久w| 精品成人a区在线观看| 久久久久99精品一区| 亚洲视频综合在线| 午夜精品久久久久久久99水蜜桃| 五月天久久比比资源色| 激情久久五月天| 91免费看片在线观看| 欧美一区二区三区在线观看视频| 日韩欧美亚洲一区二区| 久久午夜老司机| 亚洲自拍欧美精品| 狠狠狠色丁香婷婷综合激情 | 日本欧美一区二区三区乱码| 国模大尺度一区二区三区| 成人黄色在线看| 91精品国产欧美一区二区| 精品成人在线观看| 午夜精品久久久久久久99水蜜桃 | 五月天丁香久久| 成人一区二区三区在线观看| 正在播放亚洲一区| 一区二区三区中文免费| 国产成人av一区二区三区在线| 欧美人与z0zoxxxx视频| 亚洲三级电影网站| 国产伦精品一区二区三区免费| www久久久久| 精品一区二区免费| 欧美一级片在线观看| 亚洲成a人v欧美综合天堂| 9色porny自拍视频一区二区| 国产香蕉久久精品综合网| 久久国产婷婷国产香蕉| 欧美成人福利视频| 麻豆精品一区二区av白丝在线| 欧美性色黄大片手机版| 亚洲欧美日韩久久| 99国产精品国产精品久久| 中文字幕欧美三区| 97精品国产露脸对白| 最新欧美精品一区二区三区| 色综合久久综合中文综合网| 亚洲乱码国产乱码精品精小说| 色综合久久久网| 香蕉乱码成人久久天堂爱免费| 91精品在线观看入口| 久久成人免费日本黄色| 国产欧美视频在线观看| 色网站国产精品| 日韩精品亚洲一区二区三区免费| 欧美一区二区视频免费观看| 国产精品一区久久久久| 亚洲欧美国产77777| 91精品婷婷国产综合久久性色 | 国产精品女上位| 精品一区二区在线播放| 亚洲高清三级视频| 亚洲午夜激情av| 亚洲第一久久影院| 一区二区在线观看免费| 久久精品视频在线免费观看| 欧美精选午夜久久久乱码6080| 国产伦精品一区二区三区免费迷| 亚洲午夜一二三区视频| 国产欧美精品一区| 一级女性全黄久久生活片免费| 久久精品欧美日韩| 欧美一级二级三级蜜桃| 91美女在线看| 不卡欧美aaaaa| 国产一区二区福利视频| 婷婷国产在线综合| 亚洲电影一级黄| 亚洲最大色网站| 亚洲国产aⅴ成人精品无吗| 亚洲v精品v日韩v欧美v专区| 亚洲欧洲成人精品av97| 国产精品久久久久婷婷二区次| 久久久久久一二三区| 国产精品亲子乱子伦xxxx裸| 国产人成一区二区三区影院| 欧美国产欧美亚州国产日韩mv天天看完整 | 9i在线看片成人免费| 国产精品888| 国产一区二区导航在线播放| 免费一级片91| 麻豆精品一二三| 国产一区二区三区黄视频| 国产一区二区三区黄视频 | 日韩精品乱码免费| 国模套图日韩精品一区二区| 色婷婷精品大视频在线蜜桃视频| 91精品婷婷国产综合久久竹菊| 国产丝袜在线精品| 日韩精品免费专区| heyzo一本久久综合| 欧美三级乱人伦电影| 欧美日韩国产区一| 久久美女艺术照精彩视频福利播放 | 国产欧美日韩中文久久| 国产精品久久久久久妇女6080| 亚洲欧美日韩人成在线播放| 91麻豆免费在线观看| 56国语精品自产拍在线观看| 久久影院电视剧免费观看| 综合久久久久久久| 久草热8精品视频在线观看| 波多野结衣中文字幕一区| 欧美性极品少妇| 日本一区二区电影| 另类中文字幕网| 欧美人妇做爰xxxⅹ性高电影| 久久久精品综合| 毛片基地黄久久久久久天堂| 99在线精品视频| 国产人成亚洲第一网站在线播放|