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

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

?? scc.c

?? TCPIP協議包
?? C
?? 第 1 頁 / 共 4 頁
字號:
	WRREG(scc->ctrl,ERR_RES);
}

/* Interrupt handlers for sdlc mode (AX.25) */

/* Transmitter interrupt handler */
static void
scc_sdlctx(scc)
register struct sccchan *scc;
{
	register struct mbuf *bp;

	scc->txints++;

	switch(scc->a.tstate){		/* look at transmitter state */
	case ACTIVE:			/* busy sending data bytes */
		while ((bp = scc->tbp)->cnt == 0){	/* nothing left in this mbuf? */
			bp = bp->next;			/* save link to next */
			free_mbuf(&scc->tbp);	/*KM*/
			if((scc->tbp = bp) == NULL){/* see if more mbufs follow */
				if(RDREG(scc->ctrl) & TxEOM){	/* check tx underrun status */
					scc->rovers++;		/* oops, an underrun! count them */
					WRREG(scc->ctrl,SEND_ABORT);/* send an abort to be sure */
					scc->a.tstate = TAIL;	/* key down tx after TAILTIME */
					scc->timercount = scc->a.tailtime;
					return;
				}
				cl(scc,R10,ABUNDER);		/* frame complete, allow CRC transmit */
				scc->a.tstate = FLUSH;
				WRREG(scc->ctrl,RES_Tx_P);	/* reset pending int */
				return;
			}
		}
		/* now bp = scc->tbp (either from while or from if stmt above) */
		WRREG(scc->data,*(bp->data++)); /* send the character */
		bp->cnt--;			/* decrease mbuf byte count */
		return;
	case FLUSH:	/* CRC just went out, more to send? */
		or(scc,R10,ABUNDER);		/* re-install underrun protection */
		/* verify that we are not exeeding max tx time (if defined) */
		if((scc->timercount != 0 || scc->a.maxkeyup == 0) &&
		 (scc->tbp = scc->sndq) != NULL){ /* dequeue a frame */
			scc->sndq = scc->sndq->anext;
			WRREG(scc->ctrl,RES_Tx_CRC); /* reset the TX CRC generator */
			scc->a.tstate = ACTIVE;
			scc_sdlctx(scc);		/* write 1st byte */
			WRREG(scc->ctrl,RES_EOM_L); /* reset the EOM latch */
			return;
		}
		scc->a.tstate = TAIL;		/* no more, key down tx after TAILTIME */
		scc->timercount = scc->a.tailtime;
		WRREG(scc->ctrl,RES_Tx_P);
		return;
	default:				/* another state */
		WRREG(scc->ctrl,RES_Tx_P);	/* then don't send anything */
		return;
	}
}

/* External/Status interrupt handler */
static void
scc_sdlcex(scc)
register struct sccchan *scc;
{
	register unsigned char status,changes;

	scc->exints++;
	status = RDREG(scc->ctrl);
	changes = status ^ scc->status;

	if(changes & BRK_ABRT){		/* Received an ABORT */
		if(status & BRK_ABRT){		/* is this the beginning? */
			if(scc->rbp != NULL){/* did we receive something? */
				/* check if a significant amount of data came in */
				/* this is because the drop of DCD tends to generate an ABORT */
				if(scc->rbp->next != NULL || scc->rbp->cnt > 0)
				scc->rxerrs++;	/* then count it as an error */
				scc_tossb(scc);		/* throw away buffer */
			}
			VOID(RDREG(scc->data));	/* flush the FIFO */
			VOID(RDREG(scc->data));
			VOID(RDREG(scc->data));
		}
	}
	if(changes & CTS){			/* CTS input changed state */
		if(status & CTS){		/* CTS is now ON */
			if(scc->a.tstate == KEYWT &&
				scc->a.txdelay == 0) /* zero TXDELAY = wait for CTS */
			scc->timercount = 1;	/* it will start within 10 ms */
		}
	}
	if(changes & DCD){			/* DCD input changed state */
		if(status & DCD){		/* DCD is now ON */
			if (!scc->extclock)
				WRSCC(scc->ctrl,R14,SEARCH|scc->wreg[R14]); /* DPLL: enter search mode */
			or(scc,R3,ENT_HM|RxENABLE); /* enable the receiver, hunt mode */
		} else {			/* DCD is now OFF */
			cl(scc,R3,ENT_HM|RxENABLE); /* disable the receiver */
			VOID(RDREG(scc->data));	/* flush the FIFO */
			VOID(RDREG(scc->data));
			VOID(RDREG(scc->data));
			if(scc->rbp != NULL){/* did we receive something? */
				/* check if a significant amount of data came in */
				/* this is because some characters precede the drop of DCD */
				if(scc->rbp->next != NULL || scc->rbp->cnt > 0)
				scc->rxerrs++;	/* then count it as an error */
				scc_tossb(scc);		/* throw away buffer */
			}
		}
	}
	scc->status = status;
	WRREG(scc->ctrl,RES_EXT_INT);
}

/* Receiver interrupt handler */
static void
scc_sdlcrx(scc)
register struct sccchan *scc;
{
	register struct mbuf *bp;

	scc->rxints++;

	if((bp = scc->rbp1) == NULL){ /* no buffer available now */
		if(scc->rbp == NULL){
			if((bp = alloc_mbuf(scc->bufsiz+sizeof(struct iface *))) != NULL){
				scc->rbp = scc->rbp1 = bp;
				bp->cnt = 0;
			}
		} else if((bp = alloc_mbuf(scc->bufsiz)) != NULL){
			scc->rbp1 = bp;
			for(bp = scc->rbp; bp->next != NULL; bp = bp->next)
				;
			bp->next = scc->rbp1;
			bp = scc->rbp1;
		}
		if(bp == NULL){
			VOID(RDREG(scc->data));	/* so we have to discard the char */
			or(scc,R3,ENT_HM);		/* enter hunt mode for next flag */
			scc_tossb(scc);		/* put buffers back on pool */
			scc->nospace++;		/* count these events */
			return;
		}
	}

	/* now, we have a buffer (at bp). read character and store it */
	bp->data[bp->cnt++] = RDREG(scc->data);

	if(bp->cnt == bp->size)		/* buffer full? */
		scc->rbp1 = NULL;	/* acquire a new one next time */
}

/* Receive Special Condition interrupt handler */
static void
scc_sdlcsp(scc)
register struct sccchan *scc;
{
	register unsigned char status;
	register struct mbuf *bp;

	scc->spints++;

	status = rd(scc,R1);		/* read receiver status */
	VOID(RDREG(scc->data));		/* flush offending character */

	if(status & Rx_OVR){		/* receiver overrun */
		scc->rovers++;			/* count them */
		or(scc,R3,ENT_HM);		/* enter hunt mode for next flag */
		scc_tossb(scc);			/* rewind the buffer and toss */
	}
	if(status & END_FR &&		/* end of frame */
	scc->rbp != NULL){	/* at least received something */
		if((status & CRC_ERR) == 0 &&	/* no CRC error is indicated */
		(status & 0xe) == RES8 &&	/* 8 bits in last byte */
		scc->rbp->cnt > 0){

			/* we seem to have a good frame. but the last byte received */
			/* from rx interrupt is in fact a CRC byte, so discard it */
			if(scc->rbp1 != NULL){
				scc->rbp1->cnt--;	/* current mbuf was not full */
			} else {
				for(bp = scc->rbp; bp->next != NULL; bp = bp->next);
					/* find last mbuf */

				bp->cnt--;		/* last byte is first CRC byte */
			}

			net_route(scc->iface,&scc->rbp);

			scc->rbp = scc->rbp1 = NULL;
			scc->rxframes++;
		} else {			/* a bad frame */
			scc_tossb(scc);		/* throw away frame */
			scc->rxerrs++;
		}
	}
	WRREG(scc->ctrl,ERR_RES);
}

/* Throw away receive mbuf(s) when an error occurred */
static void
scc_tossb (scc)
register struct sccchan *scc;
{
	register struct mbuf *bp;
	
	if((bp = scc->rbp) != NULL){
		free_p(&bp->next);
		free_p(&bp->dup);	/* Should be NULL */
		bp->next = NULL;
		scc->rbp1 = bp;		/* Don't throw this one away */
		bp->cnt = 0;	/* Simply rewind it */
	}
}

/* Switch the SCC to "transmit" mode */
/* Only to be called from an interrupt handler, while in AX.25 mode */
static void
scc_txon(scc)
register struct sccchan *scc;
{
    if (!scc->fulldup && !scc->extclock){ /* no fulldup divider? */
		cl(scc,R3,RxENABLE);		/* then switch off receiver */
		cl(scc,R5,TxENAB);		/* transmitter off during switch */
		scc_speed(scc,1,scc->speed);	/* reprogram baudrate generator */
	}
	or(scc,R5,RTS|TxENAB);		/* set the RTS line and enable TX */
	if(Sccinfo.hwtype & HWPRIMUS)	/* PRIMUS has another PTT bit... */
		WRREG(scc->ctrl + 4,Sccinfo.hwparam | 0x80); /* set that bit! */
}

/* Switch the SCC to "receive" mode (or: switch off transmitter)
 * Only to be called from an interrupt handler, while in AX.25 mode
 */
static void
scc_txoff(scc)
register struct sccchan *scc;
{
	cl(scc,R5,RTS);			/* turn off RTS line */
	if(Sccinfo.hwtype & HWPRIMUS)	/* PRIMUS has another PTT bit... */
		WRREG(scc->ctrl + 4,Sccinfo.hwparam); /* clear that bit! */

    if (!scc->fulldup && !scc->extclock){ /* no fulldup divider? */
		cl(scc,R5,TxENAB);		/* then disable the transmitter */
		scc_speed(scc,32,scc->speed);	/* back to receiver baudrate */
	}
}

/* SCC timer interrupt handler. Will be called every 1/TPS s by the 
 * routine systick in pc.c
 */
void scctimer()
{
	register struct sccchan *scc;
	register struct sccchan **sccp;
	int i_state;

	i_state = dirps();
	for(sccp = Sccchan + Sccinfo.maxchan; sccp >= Sccchan; sccp--){
		if((scc = *sccp) != NULL &&
		  scc->timercount != 0 &&
		  --(scc->timercount) == 0){
			/* handle an SCC timer event for this SCC channel
			 * this can only happen when the channel is AX.25 type
			 * (the SLIP/KISS driver does not use timers)
			 */
			switch(scc->a.tstate){
			case IDLE:			/* it was idle, this is FULLDUP2 timeout */
				scc_txoff(scc);		/* switch-off the transmitter */
				break;
			case DEFER:			/* trying to get the channel */
				/* operation is as follows:
				 * CSMA: when channel clear AND persistence randomgenerator
				 *	 wins, AND group restrictions allow it:
				 *		keyup the transmitter
				 *	 if not, delay one SLOTTIME and try again
				 * FULL: always keyup the transmitter
				 */
				if(scc->a.fulldup == 0){
					Random = 21 * Random + 53;
					if(scc->status & DCD || scc->a.persist < Random){
						/* defer transmission again. check for limit */
defer_it:					if(--(scc->a.maxdefer) == 0){
							/* deferred too long. choice is to:
							 * - throw away pending frames, or
							 * - smash-on the transmitter and send them.
							 * the first would be the choice in a clean
							 * environment, but in the amateur radio world
							 * a distant faulty station could tie us up
							 * forever, so the second may be better...
							*/
#ifdef THROW_AWAY_AFTER_DEFER_TIMEOUT
							struct mbuf *bp,*bp1;

							while ((bp = scc->sndq) != NULL){
								scc->sndq = scc->sndq->anext;
								free_p(&bp);
							}
#else
							goto keyup; /* just keyup the transmitter... */
#endif
						}
						scc->timercount = scc->a.slottime;
						break;
					}
					if(scc->group != NOGROUP){
						int i;
						struct sccchan *scc2;

						for(i = 0; i <= Sccinfo.maxchan; i++)
							if((scc2 = Sccchan[i]) != NULL &&
							 scc2 != scc &&
							 scc2->group & scc->group &&
							 ((scc->group & TXGROUP && scc2->wreg[R5] & RTS) ||
							 (scc->group & RXGROUP && scc2->status & DCD))){
								goto defer_it;
							}
					}
				}
			case KEYUP:			/* keyup transmitter (note fallthrough) */
keyup:				if((scc->wreg[R5] & RTS) == 0){ /* when not yet keyed */
					scc->a.tstate = KEYWT;
					scc->timercount = scc->a.txdelay; /* 0 if CTSwait */
					scc_txon(scc);
					break;
				}
				/* when already keyed, directly fall through */
			case KEYWT:			/* waited for CTS or TXDELAY */
				/* when a frame is available (it should be...):
				 * - dequeue it from the send queue
				 * - reset the transmitter CRC generator
				 * - set a timeout on transmission length, if defined
				 * - send the first byte of the frame
				 * - reset the EOM latch
				 * when no frame available, proceed to TAIL handling
				 */
				if((scc->tbp = scc->sndq) != NULL){
					scc->sndq = scc->sndq->anext;
					WRREG(scc->ctrl,RES_Tx_CRC);
					scc->a.tstate = ACTIVE;
					scc->timercount = TPS * scc->a.maxkeyup;
					scc_sdlctx(scc);
					WRREG(scc->ctrl,RES_EOM_L);
					break;
				}
				/* when no frame queued, fall through to TAIL case */
			case TAIL:			/* at end of frame */
				/* when fulldup is 0 or 1, switch off the transmitter.
				 * when frames are still queued (because of transmit time limit),
				 * restart the procedure to get the channel after MINTIME.
				 * when fulldup is 2, the transmitter remains keyed and we
				 * continue sending.	IDLETIME is an idle timeout in this case.
				 */	
				if(scc->a.fulldup < 2){
					scc->a.tstate = IDLE;
					scc_txoff(scc);

					if(scc->sndq != NULL){
						scc->a.tstate = DEFER;
						scc->a.maxdefer = TPS * scc->a.idletime /
						 scc->a.slottime;
						scc->timercount = TPS * scc->a.mintime;
					}
					break;
				}
				if(scc->sndq != NULL){ /* still frames on the queue? */
					scc->a.tstate = KEYWT; /* continue sending */
					scc->timercount = TPS * scc->a.mintime; /* after mintime */
				} else {
					scc->a.tstate = IDLE;
					scc->timercount = TPS * scc->a.idletime;
				}
				break;
			case ACTIVE:	/* max keyup time expired */
			case FLUSH:	/* same while in flush mode */
				break;	/* no action required yet */
			default:			/* unexpected state */
				scc->a.tstate = IDLE; /* that should not happen, but... */
				scc_txoff(scc);		/* at least stop the transmitter */
				break;
			}
		}
	}
	restore(i_state);
}

?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
av一区二区三区四区| 91麻豆精品国产91久久久久 | 奇米一区二区三区| 国产成人精品免费在线| 欧美日韩一卡二卡| 国产精品理论片在线观看| 麻豆精品久久精品色综合| 欧美在线观看一区| 亚洲国产精品成人综合 | 亚洲老妇xxxxxx| 国产美女精品在线| 欧美一级黄色录像| 亚洲精品视频一区二区| 高清beeg欧美| 欧美电影免费观看高清完整版 | 久久婷婷综合激情| 亚瑟在线精品视频| 91色porny在线视频| 久久人人爽爽爽人久久久| 美女尤物国产一区| 欧美日韩国产天堂| 亚洲一区二区3| 国产精品三级电影| 国产精品天干天干在线综合| 秋霞影院一区二区| 91精品久久久久久久91蜜桃| 亚洲成人激情综合网| 色国产综合视频| 亚洲日本免费电影| 91在线云播放| 亚洲免费高清视频在线| 国产精品中文字幕日韩精品| 欧美成人猛片aaaaaaa| 免费在线观看一区二区三区| 欧美美女激情18p| 天天综合网天天综合色| 欧美日韩黄色一区二区| 一片黄亚洲嫩模| 日本丶国产丶欧美色综合| 亚洲丝袜另类动漫二区| 97久久超碰精品国产| 亚洲精品免费在线播放| 91麻豆国产福利在线观看| 亚洲视频 欧洲视频| 91在线免费看| 亚洲精品日韩综合观看成人91| 一本大道av伊人久久综合| 亚洲一区视频在线| 91精品国产日韩91久久久久久| 天堂av在线一区| 日韩精品中文字幕一区二区三区 | 中文在线免费一区三区高中清不卡| 国产剧情av麻豆香蕉精品| 韩国v欧美v日本v亚洲v| 99免费精品视频| 亚洲美女淫视频| 51精品秘密在线观看| 久久精品国产77777蜜臀| 久久亚洲春色中文字幕久久久| 国产精品1区2区3区在线观看| 国产精品久久久久三级| 欧美日韩亚洲综合一区二区三区| 久久 天天综合| 中文字幕一区三区| 欧美精品久久久久久久多人混战 | 日韩欧美中文字幕精品| 国产尤物一区二区| 亚洲人精品一区| 91精品国产综合久久精品性色 | 99久久免费国产| 亚洲国产精品嫩草影院| 精品美女一区二区三区| www.久久精品| 另类小说视频一区二区| 亚洲欧洲国产日韩| 日韩欧美一区中文| 99久久免费视频.com| 久久精品免费看| 亚洲美女一区二区三区| 久久综合丝袜日本网| 日本高清不卡aⅴ免费网站| 久久精品国产在热久久| 一区二区三区四区视频精品免费| 日韩午夜av一区| 色偷偷成人一区二区三区91| 国内一区二区视频| 午夜伦理一区二区| 国产精品国产三级国产aⅴ中文 | 国产精品色哟哟网站| 欧美精品久久99久久在免费线| 福利一区二区在线观看| 九九**精品视频免费播放| 亚洲国产欧美一区二区三区丁香婷| 国产欧美精品一区aⅴ影院 | 欧美日韩国产综合久久| 成人精品视频一区二区三区尤物| 青青草国产精品亚洲专区无| 亚洲品质自拍视频| 国产精品理伦片| 亚洲精品一线二线三线无人区| 欧美日韩亚洲综合在线| 91福利精品视频| 99精品在线免费| 精品一二线国产| 久久99国产精品麻豆| 欧美a级理论片| 日韩精品成人一区二区三区| 亚洲与欧洲av电影| 亚洲伦在线观看| 中文字幕日韩欧美一区二区三区| 国产欧美日韩另类视频免费观看| 欧美一区二区三区小说| 911精品产国品一二三产区| 欧美日韩一本到| 久久九九久久九九| 欧美电影免费观看高清完整版在线观看 | 日韩一区中文字幕| 日韩毛片一二三区| 亚洲色图欧洲色图| 亚洲日本护士毛茸茸| 亚洲天堂av老司机| 亚洲精品老司机| 一区二区三区国产豹纹内裤在线 | 久久久综合激的五月天| 久久久一区二区三区捆绑**| 2020日本不卡一区二区视频| 国产午夜精品美女毛片视频| 久久久久久久免费视频了| 亚洲国产精品99久久久久久久久| 国产日韩欧美精品一区| 国产欧美久久久精品影院| 亚洲欧洲精品一区二区三区不卡| 亚洲欧洲av另类| 亚洲综合色自拍一区| 午夜电影网一区| 极品瑜伽女神91| 成人深夜在线观看| 在线看日本不卡| 4438x亚洲最大成人网| 精品成人一区二区| 亚洲欧洲性图库| 日韩av不卡一区二区| 老司机精品视频线观看86| 高清av一区二区| 欧美日韩亚洲丝袜制服| 精品国产凹凸成av人网站| 国产精品日日摸夜夜摸av| 一区二区三区加勒比av| 美女网站一区二区| 不卡av在线网| 制服丝袜国产精品| 欧美激情中文字幕一区二区| 亚洲一区二区三区国产| 久久99精品久久久| 色噜噜偷拍精品综合在线| 日韩欧美国产午夜精品| 国产精品福利av | 五月综合激情网| 极品少妇一区二区| 欧美性感一类影片在线播放| 久久综合久久综合久久| 亚洲精品国产精品乱码不99| 国产一区二区三区美女| 欧美性猛片xxxx免费看久爱| 国产欧美日韩综合| 美女性感视频久久| 欧美偷拍一区二区| 欧美激情在线一区二区| 奇米777欧美一区二区| 91在线无精精品入口| 亚洲精品一区在线观看| 天天综合网天天综合色| 91最新地址在线播放| 久久先锋影音av| 婷婷夜色潮精品综合在线| av亚洲产国偷v产偷v自拍| 精品久久一区二区三区| 亚洲综合成人网| 99视频一区二区| 久久综合色8888| 免费成人美女在线观看.| 色琪琪一区二区三区亚洲区| 国产精品乱码妇女bbbb| 国产自产视频一区二区三区 | 欧美色网站导航| 国产精品成人免费精品自在线观看| 毛片不卡一区二区| 欧美男男青年gay1069videost | 美女网站色91| 欧美高清性hdvideosex| 亚洲自拍另类综合| 一本到高清视频免费精品| 国产精品视频线看| 成人18精品视频| 国产精品视频yy9299一区| 高清国产午夜精品久久久久久| 国产亚洲欧美一区在线观看| 国产原创一区二区| 精品国产百合女同互慰| 国产永久精品大片wwwapp|