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

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

?? 6pack.c

?? ARM S3C2410 linux2.4 內核源碼
?? C
?? 第 1 頁 / 共 2 頁
字號:
		count--;		if (fp && *fp++) {			if (!test_and_set_bit(SIXPF_ERROR, &sp->flags))				sp->stats.rx_errors++;			continue;		}	}	sixpack_decode(sp, buf, count1);}/* * Open the high-level part of the 6pack channel. * This function is called by the TTY module when the * 6pack line discipline is called for.  Because we are * sure the tty line exists, we only have to link it to * a free 6pcack channel... */static int sixpack_open(struct tty_struct *tty){	struct sixpack *sp = (struct sixpack *) tty->disc_data;	int err;	/* First make sure we're not already connected. */	if (sp && sp->magic == SIXPACK_MAGIC)		return -EEXIST;	/* OK.  Find a free 6pack channel to use. */	if ((sp = sp_alloc()) == NULL)		return -ENFILE;	sp->tty = tty;	tty->disc_data = sp;	if (tty->driver.flush_buffer)		tty->driver.flush_buffer(tty);	if (tty->ldisc.flush_buffer)		tty->ldisc.flush_buffer(tty);	/* Restore default settings */	sp->dev->type = ARPHRD_AX25;	/* Perform the low-level 6pack initialization. */	if ((err = sp_open(sp->dev)))		return err;	/* Done.  We have linked the TTY line to a channel. */	tnc_init(sp);	return sp->dev->base_addr;}/* * Close down a 6pack channel. * This means flushing out any pending queues, and then restoring the * TTY line discipline to what it was before it got hooked to 6pack * (which usually is TTY again). */static void sixpack_close(struct tty_struct *tty){	struct sixpack *sp = (struct sixpack *) tty->disc_data;	/* First make sure we're connected. */	if (!sp || sp->magic != SIXPACK_MAGIC)		return;	rtnl_lock();	dev_close(sp->dev);	del_timer(&sp->tx_t);	del_timer(&sp->resync_t);	tty->disc_data = 0;	sp->tty = NULL;	sp_free(sp);	unregister_netdevice(sp->dev);	rtnl_unlock();}static struct net_device_stats *sp_get_stats(struct net_device *dev){	struct sixpack *sp = (struct sixpack *) dev->priv;	return &sp->stats;}static int sp_set_mac_address(struct net_device *dev, void *addr){	return copy_from_user(dev->dev_addr, addr, AX25_ADDR_LEN) ? -EFAULT : 0;}static int sp_set_dev_mac_address(struct net_device *dev, void *addr){	struct sockaddr *sa = addr;	memcpy(dev->dev_addr, sa->sa_data, AX25_ADDR_LEN);	return 0;}/* Perform I/O control on an active 6pack channel. */static int sixpack_ioctl(struct tty_struct *tty, void *file, int cmd, void *arg){	struct sixpack *sp = (struct sixpack *) tty->disc_data;	unsigned int tmp;	/* First make sure we're connected. */	if (!sp || sp->magic != SIXPACK_MAGIC)		return -EINVAL;	switch(cmd) {	case SIOCGIFNAME:		return copy_to_user(arg, sp->dev->name, strlen(sp->dev->name) + 1) ? -EFAULT : 0;	case SIOCGIFENCAP:		return put_user(0, (int *)arg);	case SIOCSIFENCAP:		if (get_user(tmp, (int *) arg))			return -EFAULT;		sp->mode = tmp;		sp->dev->addr_len        = AX25_ADDR_LEN;	  /* sizeof an AX.25 addr */		sp->dev->hard_header_len = AX25_KISS_HEADER_LEN + AX25_MAX_HEADER_LEN + 3;		sp->dev->type            = ARPHRD_AX25;		return 0;	 case SIOCSIFHWADDR:		return sp_set_mac_address(sp->dev, arg);	/* Allow stty to read, but not set, the serial port */	case TCGETS:	case TCGETA:		return n_tty_ioctl(tty, (struct file *) file, cmd, (unsigned long) arg);	default:		return -ENOIOCTLCMD;	}}static int sp_open_dev(struct net_device *dev){	struct sixpack *sp = (struct sixpack *) dev->priv;	if (sp->tty == NULL)		return -ENODEV;	return 0;}/* Fill in our line protocol discipline */static struct tty_ldisc sp_ldisc = {	magic:		TTY_LDISC_MAGIC,	name:		"6pack",	open:		sixpack_open,	close:		sixpack_close,	ioctl:		(int (*)(struct tty_struct *, struct file *,			unsigned int, unsigned long)) sixpack_ioctl,	receive_buf:	sixpack_receive_buf,	receive_room:	sixpack_receive_room,	write_wakeup:	sixpack_write_wakeup,};/* Initialize 6pack control device -- register 6pack line discipline */static char msg_banner[]  __initdata = KERN_INFO "AX.25: 6pack driver, " SIXPACK_VERSION " (dynamic channels, max=%d)\n";static char msg_nomem[]   __initdata = KERN_ERR  "6pack: can't allocate sixpack_ctrls[] array! No 6pack available.\n";static char msg_regfail[] __initdata = KERN_ERR  "6pack: can't register line discipline (err = %d)\n";static int __init sixpack_init_driver(void){	int status;	/* Do sanity checks on maximum device parameter. */	if (sixpack_maxdev < 4)		sixpack_maxdev = 4;	printk(msg_banner, sixpack_maxdev);	sixpack_ctrls = (sixpack_ctrl_t **) kmalloc(sizeof(void*)*sixpack_maxdev, GFP_KERNEL);	if (sixpack_ctrls == NULL) {		printk(msg_nomem);		return -ENOMEM;	}	/* Clear the pointer array, we allocate devices when we need them */	memset(sixpack_ctrls, 0, sizeof(void*)*sixpack_maxdev); /* Pointers */	/* Register the provided line protocol discipline */	if ((status = tty_register_ldisc(N_6PACK, &sp_ldisc)) != 0) {		printk(msg_regfail, status);		kfree(sixpack_ctrls);	}	return status;}static const char msg_unregfail[] __exitdata = KERN_ERR "6pack: can't unregister line discipline (err = %d)\n";static void __exit sixpack_exit_driver(void){	int i;	if ((i = tty_register_ldisc(N_6PACK, NULL)))		printk(msg_unregfail, i);	for (i = 0; i < sixpack_maxdev; i++) {		if (sixpack_ctrls[i]) {			/*			* VSV = if dev->start==0, then device			* unregistered while close proc.			*/			if (netif_running(&sixpack_ctrls[i]->dev))				 unregister_netdev(&sixpack_ctrls[i]->dev);			kfree(sixpack_ctrls[i]);		}	}	kfree(sixpack_ctrls);}/* Initialize the 6pack driver.  Called by DDI. */static int sixpack_init(struct net_device *dev){	struct sixpack *sp = (struct sixpack *) dev->priv;	static char ax25_bcast[AX25_ADDR_LEN] =		{'Q'<<1,'S'<<1,'T'<<1,' '<<1,' '<<1,' '<<1,'0'<<1};	static char ax25_test[AX25_ADDR_LEN] =		{'L'<<1,'I'<<1,'N'<<1,'U'<<1,'X'<<1,' '<<1,'1'<<1};	if (sp == NULL)		/* Allocation failed ?? */		return -ENODEV;	/* Set up the "6pack Control Block". (And clear statistics) */	memset(sp, 0, sizeof (struct sixpack));	sp->magic  = SIXPACK_MAGIC;	sp->dev	   = dev;	/* Finish setting up the DEVICE info. */	dev->mtu		= SIXP_MTU;	dev->hard_start_xmit	= sp_xmit;	dev->open		= sp_open_dev;	dev->stop		= sp_close;	dev->hard_header	= sp_header;	dev->get_stats	        = sp_get_stats;	dev->set_mac_address    = sp_set_dev_mac_address;	dev->hard_header_len	= AX25_MAX_HEADER_LEN;	dev->addr_len		= AX25_ADDR_LEN;	dev->type		= ARPHRD_AX25;	dev->tx_queue_len	= 10;	dev->rebuild_header	= sp_rebuild_header;	dev->tx_timeout		= NULL;	memcpy(dev->broadcast, ax25_bcast, AX25_ADDR_LEN);	/* Only activated in AX.25 mode */	memcpy(dev->dev_addr, ax25_test, AX25_ADDR_LEN);	/*    ""      ""       ""    "" */	/* New-style flags. */	dev->flags		= 0;	return 0;}/* ----> 6pack timer interrupt handler and friends. <---- */static void sp_start_tx_timer(struct sixpack *sp){	int when = sp->slottime;	del_timer(&sp->tx_t);	sp->tx_t.data = (unsigned long) sp;	sp->tx_t.function = sp_xmit_on_air;	sp->tx_t.expires = jiffies + ((when+1)*HZ)/100;	add_timer(&sp->tx_t);}/* encode an AX.25 packet into 6pack */static int encode_sixpack(unsigned char *tx_buf, unsigned char *tx_buf_raw, int length, unsigned char tx_delay){	int count = 0;	unsigned char checksum = 0, buf[400];	int raw_count = 0;	tx_buf_raw[raw_count++] = SIXP_PRIO_CMD_MASK | SIXP_TX_MASK;	tx_buf_raw[raw_count++] = SIXP_SEOF;	buf[0] = tx_delay;	for (count = 1; count < length; count++)		buf[count] = tx_buf[count];	for (count = 0; count < length; count++)		checksum += buf[count];	buf[length] = (unsigned char) 0xff - checksum;	for (count = 0; count <= length; count++) {		if ((count % 3) == 0) {			tx_buf_raw[raw_count++] = (buf[count] & 0x3f);			tx_buf_raw[raw_count] = ((buf[count] >> 2) & 0x30);		} else if ((count % 3) == 1) {			tx_buf_raw[raw_count++] |= (buf[count] & 0x0f);			tx_buf_raw[raw_count] =	((buf[count] >> 2) & 0x3c);		} else {			tx_buf_raw[raw_count++] |= (buf[count] & 0x03);			tx_buf_raw[raw_count++] = (buf[count] >> 2);		}	}	if ((length % 3) != 2)		raw_count++;	tx_buf_raw[raw_count++] = SIXP_SEOF;	return raw_count;}/* decode a 6pack packet */static voidsixpack_decode(struct sixpack *sp, unsigned char pre_rbuff[], int count){	unsigned char inbyte;	int count1;	for (count1 = 0; count1 < count; count1++) {		inbyte = pre_rbuff[count1];		if (inbyte == SIXP_FOUND_TNC) {			printk(KERN_INFO "6pack: TNC found.\n");			sp->tnc_ok = 1;			del_timer(&sp->resync_t);		}		if ((inbyte & SIXP_PRIO_CMD_MASK) != 0)			decode_prio_command(inbyte, sp);		else if ((inbyte & SIXP_STD_CMD_MASK) != 0)			decode_std_command(inbyte, sp);		else if ((sp->status & SIXP_RX_DCD_MASK) == SIXP_RX_DCD_MASK)			decode_data(inbyte, sp);	}}static int tnc_init(struct sixpack *sp){	unsigned char inbyte = 0xe8;	sp->tty->driver.write(sp->tty, 0, &inbyte, 1);	del_timer(&sp->resync_t);	sp->resync_t.data = (unsigned long) sp;	sp->resync_t.function = resync_tnc;	sp->resync_t.expires = jiffies + SIXP_RESYNC_TIMEOUT;	add_timer(&sp->resync_t);	return 0;}/* identify and execute a 6pack priority command byte */static void decode_prio_command(unsigned char cmd, struct sixpack *sp){	unsigned char channel;	int actual;	channel = cmd & SIXP_CHN_MASK;	if ((cmd & SIXP_PRIO_DATA_MASK) != 0) {     /* idle ? */	/* RX and DCD flags can only be set in the same prio command,	   if the DCD flag has been set without the RX flag in the previous	   prio command. If DCD has not been set before, something in the	   transmission has gone wrong. In this case, RX and DCD are	   cleared in order to prevent the decode_data routine from	   reading further data that might be corrupt. */		if (((sp->status & SIXP_DCD_MASK) == 0) &&			((cmd & SIXP_RX_DCD_MASK) == SIXP_RX_DCD_MASK)) {				if (sp->status != 1)					printk(KERN_DEBUG "6pack: protocol violation\n");				else					sp->status = 0;				cmd &= !SIXP_RX_DCD_MASK;		}		sp->status = cmd & SIXP_PRIO_DATA_MASK;	}	else { /* output watchdog char if idle */		if ((sp->status2 != 0) && (sp->duplex == 1)) {			sp->led_state = 0x70;			sp->tty->driver.write(sp->tty, 0, &sp->led_state, 1);			sp->tx_enable = 1;			actual = sp->tty->driver.write(sp->tty, 0, sp->xbuff, sp->status2);			sp->xleft -= actual;			sp->xhead += actual;			sp->led_state = 0x60;			sp->status2 = 0;		}	}	/* needed to trigger the TNC watchdog */	sp->tty->driver.write(sp->tty, 0, &sp->led_state, 1);        /* if the state byte has been received, the TNC is present,           so the resync timer can be reset. */	if (sp->tnc_ok == 1) {		del_timer(&sp->resync_t);		sp->resync_t.data = (unsigned long) sp;		sp->resync_t.function = resync_tnc;		sp->resync_t.expires = jiffies + SIXP_INIT_RESYNC_TIMEOUT;		add_timer(&sp->resync_t);	}	sp->status1 = cmd & SIXP_PRIO_DATA_MASK;}/* try to resync the TNC. Called by the resync timer defined in  decode_prio_command */static void resync_tnc(unsigned long channel){	static char resync_cmd = 0xe8;	struct sixpack *sp = (struct sixpack *) channel;	printk(KERN_INFO "6pack: resyncing TNC\n");	/* clear any data that might have been received */	sp->rx_count = 0;	sp->rx_count_cooked = 0;	/* reset state machine */	sp->status = 1;	sp->status1 = 1;	sp->status2 = 0;	sp->tnc_ok = 0;	/* resync the TNC */	sp->led_state = 0x60;	sp->tty->driver.write(sp->tty, 0, &sp->led_state, 1);	sp->tty->driver.write(sp->tty, 0, &resync_cmd, 1);	/* Start resync timer again -- the TNC might be still absent */	del_timer(&sp->resync_t);	sp->resync_t.data = (unsigned long) sp;	sp->resync_t.function = resync_tnc;	sp->resync_t.expires = jiffies + SIXP_RESYNC_TIMEOUT;	add_timer(&sp->resync_t);}/* identify and execute a standard 6pack command byte */static void decode_std_command(unsigned char cmd, struct sixpack *sp){	unsigned char checksum = 0, rest = 0, channel;	short i;	channel = cmd & SIXP_CHN_MASK;	switch (cmd & SIXP_CMD_MASK) {     /* normal command */		case SIXP_SEOF:			if ((sp->rx_count == 0) && (sp->rx_count_cooked == 0)) {				if ((sp->status & SIXP_RX_DCD_MASK) ==					SIXP_RX_DCD_MASK) {					sp->led_state = 0x68;					sp->tty->driver.write(sp->tty, 0, &sp->led_state, 1);				}			} else {				sp->led_state = 0x60;				/* fill trailing bytes with zeroes */				sp->tty->driver.write(sp->tty, 0, &sp->led_state, 1);				rest = sp->rx_count;				if (rest != 0)					 for (i = rest; i <= 3; i++)						decode_data(0, sp);				if (rest == 2)					sp->rx_count_cooked -= 2;				else if (rest == 3)					sp->rx_count_cooked -= 1;				for (i = 0; i < sp->rx_count_cooked; i++)					checksum += sp->cooked_buf[i];				if (checksum != SIXP_CHKSUM) {					printk(KERN_DEBUG "6pack: bad checksum %2.2x\n", checksum);				} else {					sp->rcount = sp->rx_count_cooked-2;					sp_bump(sp, 0);				}				sp->rx_count_cooked = 0;			}			break;		case SIXP_TX_URUN: printk(KERN_DEBUG "6pack: TX underrun\n");			break;		case SIXP_RX_ORUN: printk(KERN_DEBUG "6pack: RX overrun\n");			break;		case SIXP_RX_BUF_OVL:			printk(KERN_DEBUG "6pack: RX buffer overflow\n");	}}/* decode 4 sixpack-encoded bytes into 3 data bytes */static void decode_data(unsigned char inbyte, struct sixpack *sp){	unsigned char *buf;	if (sp->rx_count != 3)		sp->raw_buf[sp->rx_count++] = inbyte;	else {		buf = sp->raw_buf;		sp->cooked_buf[sp->rx_count_cooked++] =			buf[0] | ((buf[1] << 2) & 0xc0);		sp->cooked_buf[sp->rx_count_cooked++] =			(buf[1] & 0x0f) | ((buf[2] << 2) & 0xf0);		sp->cooked_buf[sp->rx_count_cooked++] =			(buf[2] & 0x03) | (inbyte << 2);		sp->rx_count = 0;	}}MODULE_AUTHOR("Andreas K鰊sgen <ajk@ccac.rwth-aachen.de>");MODULE_DESCRIPTION("6pack driver for AX.25");MODULE_LICENSE("GPL");module_init(sixpack_init_driver);module_exit(sixpack_exit_driver);

?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
亚洲视频香蕉人妖| 视频精品一区二区| 国产成人综合网| 2024国产精品| 黄色日韩网站视频| 国产偷国产偷亚洲高清人白洁| 国产乱码一区二区三区| 中文字幕av一区二区三区| 99久久久精品| 亚洲综合一区二区三区| 91精品国产综合久久精品性色| 久色婷婷小香蕉久久| 国产欧美一区二区在线| 色综合咪咪久久| 午夜精品福利一区二区三区av| 日韩美女主播在线视频一区二区三区| 国产一区中文字幕| 亚洲日穴在线视频| 91精品国产高清一区二区三区 | 日韩精品电影一区亚洲| 日韩一区二区电影在线| 国产成人av电影| 一个色在线综合| 精品国产乱码久久久久久影片| 成人97人人超碰人人99| 一区二区三区在线影院| 久久综合中文字幕| 色老汉av一区二区三区| 久久99精品久久久久久| 国产精品国产馆在线真实露脸 | 亚洲男人的天堂一区二区| 欧美天堂一区二区三区| 国产在线精品免费| 亚洲精品国产品国语在线app| 欧美一区午夜视频在线观看| 成人av手机在线观看| 青椒成人免费视频| 亚洲女同ⅹxx女同tv| 2017欧美狠狠色| 欧美日韩和欧美的一区二区| 国产91富婆露脸刺激对白| 亚洲国产视频直播| 中文字幕电影一区| 欧美一二三四在线| 日本精品视频一区二区三区| 国产在线观看一区二区 | 日日夜夜精品免费视频| 国产精品麻豆久久久| 日韩精品资源二区在线| 欧美午夜电影一区| 99re66热这里只有精品3直播 | 在线免费观看日本一区| 国产福利一区二区三区视频在线 | 日韩欧美色综合网站| 欧洲亚洲国产日韩| 成人污污视频在线观看| 午夜精品久久久久久久久| 中文字幕在线不卡视频| 国产日韩综合av| 精品欧美一区二区久久| 欧美一区二区人人喊爽| 欧美亚洲高清一区二区三区不卡| 国产成人一区二区精品非洲| 韩国女主播成人在线观看| 日韩av高清在线观看| 亚洲精品老司机| 综合在线观看色| 欧美国产精品劲爆| 日本一区二区在线不卡| 久久久美女艺术照精彩视频福利播放| 日韩一级高清毛片| 91精品久久久久久久91蜜桃| 欧美日韩午夜精品| 欧亚洲嫩模精品一区三区| 91蜜桃婷婷狠狠久久综合9色| 成人av网站免费观看| 99久久国产免费看| 99久久777色| 欧美一区二区三区喷汁尤物| 欧美剧情片在线观看| 色呦呦网站一区| 99精品国产91久久久久久| 成人精品电影在线观看| av一区二区久久| eeuss国产一区二区三区| caoporn国产一区二区| 99久久精品免费| 欧美在线999| 欧美精选一区二区| 日韩免费视频线观看| 久久久777精品电影网影网| 久久久亚洲午夜电影| 国产精品私人自拍| 亚洲精品中文字幕在线观看| 亚洲一二三区在线观看| 蜜桃av一区二区在线观看| 麻豆精品国产传媒mv男同| 国产一区不卡视频| www.综合网.com| 欧美在线高清视频| 精品国产乱码久久久久久久| 日本一区二区视频在线观看| 综合激情成人伊人| 热久久一区二区| 国产高清在线精品| 日本二三区不卡| 欧美一区二区三区视频在线 | 久久电影网站中文字幕| 日韩电影免费一区| 免费日韩伦理电影| 成人综合在线观看| 欧美三级电影在线看| 精品日韩99亚洲| 综合色天天鬼久久鬼色| 男人操女人的视频在线观看欧美| 精品一区二区免费在线观看| 不卡高清视频专区| 欧美一二三四区在线| 国产精品乱码妇女bbbb| 亚洲第一福利一区| 国产成人超碰人人澡人人澡| 色综合久久中文综合久久牛| 日韩一区二区视频在线观看| 成人欧美一区二区三区黑人麻豆 | 久久99国产精品免费网站| 99麻豆久久久国产精品免费 | 色婷婷亚洲综合| 精品久久久久一区| 91色.com| 欧美精品第1页| 国产精品美女久久久久久| 日韩制服丝袜av| 99国产精品久| 欧美精品一区二区久久婷婷| 一区二区三区日韩欧美| 高清不卡一二三区| 欧美一区二区国产| 一区二区成人在线| 成人av第一页| 欧美成人一级视频| 三级欧美韩日大片在线看| 成人精品在线视频观看| 日韩精品中午字幕| 亚洲韩国一区二区三区| 成人av在线播放网址| 久久综合狠狠综合| 美脚の诱脚舐め脚责91| 欧美日韩一卡二卡三卡| 亚洲免费视频中文字幕| 国产91精品一区二区麻豆网站 | 欧美午夜在线观看| 国产精品女主播在线观看| 久久99九九99精品| 日韩午夜激情av| 亚洲高清免费视频| 欧美亚洲动漫精品| 亚洲在线观看免费| 日本大香伊一区二区三区| 国产精品久久网站| 丁香五精品蜜臀久久久久99网站| 欧美精品一区二区久久久| 久久精品国产免费看久久精品| 欧美日韩国产大片| 亚洲chinese男男1069| 欧美视频中文字幕| 亚洲综合色视频| 欧美日韩国产综合一区二区 | 天堂在线一区二区| 欧美色欧美亚洲另类二区| 亚洲韩国精品一区| 欧美夫妻性生活| 婷婷一区二区三区| 欧美一区二区三区日韩视频| 看电影不卡的网站| 久久久亚洲高清| 国产99久久久久久免费看农村| 国产欧美日韩精品在线| 不卡一区二区在线| 亚洲人精品午夜| 欧美日韩国产影片| 久久精品99国产精品日本| 久久久亚洲精品石原莉奈 | 亚洲欧美日韩系列| 在线看一区二区| 日韩精品五月天| 欧美成人vps| 成人精品电影在线观看| 一级精品视频在线观看宜春院| 欧美日韩国产欧美日美国产精品| 人人精品人人爱| 欧美国产在线观看| 欧美在线免费观看视频| 免费成人av资源网| 国产网站一区二区| 色综合激情五月| 精品一区二区三区的国产在线播放| 久久精品亚洲一区二区三区浴池| 99re热视频精品| 久久精品国产**网站演员| 国产精品视频线看|