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

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

?? iso.c

?? 1394在linux下單獨的驅動程序代碼
?? C
字號:
/** IEEE 1394 for Linux** kernel ISO transmission/reception** Copyright (C) 2002 Maas Digital LLC** This code is licensed under the GPL.  See the file COPYING in the root* directory of the kernel sources for details.*/#include <linux/slab.h>#include <linux/sched.h>#include "iso.h"void hpsb_iso_stop(struct hpsb_iso *iso){	if (!(iso->flags & HPSB_ISO_DRIVER_STARTED))		return;		iso->host->driver->isoctl(iso, iso->type == HPSB_ISO_XMIT ?XMIT_STOP : RECV_STOP, 0);	iso->flags &= ~HPSB_ISO_DRIVER_STARTED;}void hpsb_iso_shutdown(struct hpsb_iso *iso){	if (iso->flags & HPSB_ISO_DRIVER_INIT) {		hpsb_iso_stop(iso);		iso->host->driver->isoctl(iso, iso->type == HPSB_ISO_XMIT ?XMIT_SHUTDOWN : RECV_SHUTDOWN, 0);		iso->flags &= ~HPSB_ISO_DRIVER_INIT;	}		dma_region_free(&iso->data_buf);	kfree(iso);}static struct hpsb_iso* hpsb_iso_common_init(struct hpsb_host *host, enum hpsb_iso_type type,											 unsigned int data_buf_size,											 unsigned int buf_packets,											 int channel,											 int irq_interval,											 void (*callback)(struct hpsb_iso*)){	struct hpsb_iso *iso;	int dma_direction;		/* make sure driver supports the ISO API */	if (!host->driver->isoctl) {		printk(KERN_INFO "ieee1394: host driver '%s' does not support the rawiso API\n",			host->driver->name);		return NULL;	}		/* sanitize parameters */		if (buf_packets < 2)		buf_packets = 2;		if (irq_interval < 1 || irq_interval > buf_packets / 2)		irq_interval = buf_packets / 2;		if (channel < -1 || channel >= 64)		return NULL;		/* channel = -1 is OK for multi-channel recv but not for xmit */	if (type == HPSB_ISO_XMIT && channel < 0)		return NULL;		/* allocate and write the struct hpsb_iso */		iso = kmalloc(sizeof(*iso) + buf_packets * sizeof(struct hpsb_iso_packet_info), GFP_KERNEL);	if (!iso)		return NULL;		iso->infos = (struct hpsb_iso_packet_info *)(iso + 1);		iso->type = type;	iso->host = host;	iso->hostdata = NULL;	iso->callback = callback;	init_waitqueue_head(&iso->waitq);	iso->channel = channel;	iso->irq_interval = irq_interval;	dma_region_init(&iso->data_buf);	iso->buf_size = round_up_to_page(data_buf_size);	iso->buf_packets = buf_packets;	iso->pkt_dma = 0;	iso->first_packet = 0;	spin_lock_init(&iso->lock);		if (iso->type == HPSB_ISO_XMIT) {		iso->n_ready_packets = iso->buf_packets;		dma_direction = PCI_DMA_TODEVICE;	} else {		iso->n_ready_packets = 0;		dma_direction = PCI_DMA_FROMDEVICE;	}		atomic_set(&iso->overflows, 0);	iso->flags = 0;	iso->prebuffer = 0;		/* allocate the packet buffer */	if (dma_region_alloc(&iso->data_buf, iso->buf_size, host->pdev, dma_direction))		goto err;		return iso;	err:	hpsb_iso_shutdown(iso);	return NULL;}int hpsb_iso_n_ready(struct hpsb_iso* iso){	unsigned long flags;	int val;		spin_lock_irqsave(&iso->lock, flags);	val = iso->n_ready_packets;	spin_unlock_irqrestore(&iso->lock, flags);		return val;}struct hpsb_iso* hpsb_iso_xmit_init(struct hpsb_host *host,									unsigned int data_buf_size,									unsigned int buf_packets,									int channel,									int speed,									int irq_interval,									void (*callback)(struct hpsb_iso*)){	struct hpsb_iso *iso = hpsb_iso_common_init(host, HPSB_ISO_XMIT,		data_buf_size, buf_packets,		channel, irq_interval, callback);	if (!iso)		return NULL;		iso->speed = speed;		/* tell the driver to start working */	if (host->driver->isoctl(iso, XMIT_INIT, 0))		goto err;		iso->flags |= HPSB_ISO_DRIVER_INIT;	return iso;	err:	hpsb_iso_shutdown(iso);	return NULL;}struct hpsb_iso* hpsb_iso_recv_init(struct hpsb_host *host,									unsigned int data_buf_size,									unsigned int buf_packets,									int channel,									int irq_interval,									void (*callback)(struct hpsb_iso*)){	struct hpsb_iso *iso = hpsb_iso_common_init(host, HPSB_ISO_RECV,		data_buf_size, buf_packets,		channel, irq_interval, callback);	if (!iso)		return NULL;		/* tell the driver to start working */	if (host->driver->isoctl(iso, RECV_INIT, 0))		goto err;		iso->flags |= HPSB_ISO_DRIVER_INIT;	return iso;	err:	hpsb_iso_shutdown(iso);	return NULL;}int hpsb_iso_recv_listen_channel(struct hpsb_iso *iso, unsigned char channel){	if (iso->type != HPSB_ISO_RECV || iso->channel != -1 || channel >= 64)		return -EINVAL;	return iso->host->driver->isoctl(iso, RECV_LISTEN_CHANNEL, channel);}int hpsb_iso_recv_unlisten_channel(struct hpsb_iso *iso, unsigned char channel){	if (iso->type != HPSB_ISO_RECV || iso->channel != -1 || channel >= 64)		return -EINVAL;	return iso->host->driver->isoctl(iso, RECV_UNLISTEN_CHANNEL, channel);}int hpsb_iso_recv_set_channel_mask(struct hpsb_iso *iso, u64 mask){	if (iso->type != HPSB_ISO_RECV || iso->channel != -1)		return -EINVAL;	return iso->host->driver->isoctl(iso, RECV_SET_CHANNEL_MASK, (unsigned long) &mask);}int hpsb_iso_recv_flush(struct hpsb_iso *iso){	if (iso->type != HPSB_ISO_RECV)		return -EINVAL;	return iso->host->driver->isoctl(iso, RECV_FLUSH, 0);}static int do_iso_xmit_start(struct hpsb_iso *iso, int cycle){	int retval = iso->host->driver->isoctl(iso, XMIT_START, cycle);	if (retval)		return retval;		iso->flags |= HPSB_ISO_DRIVER_STARTED;	return retval;}int hpsb_iso_xmit_start(struct hpsb_iso *iso, int cycle, int prebuffer){	if (iso->type != HPSB_ISO_XMIT)		return -1;		if (iso->flags & HPSB_ISO_DRIVER_STARTED)		return 0;		if (cycle < -1)		cycle = -1;	else if (cycle >= 8000)		cycle %= 8000;		iso->xmit_cycle = cycle;		if (prebuffer < 0)		prebuffer = iso->buf_packets;	else if (prebuffer == 0)		prebuffer = 1;		if (prebuffer > iso->buf_packets)		prebuffer = iso->buf_packets;		iso->prebuffer = prebuffer;		/* remember the starting cycle; DMA will commence from xmit_queue_packets()	   once enough packets have been buffered */	iso->start_cycle = cycle;		return 0;}int hpsb_iso_recv_start(struct hpsb_iso *iso, int cycle, int tag_mask, int sync){	int retval = 0;	int isoctl_args[3];		if (iso->type != HPSB_ISO_RECV)		return -1;		if (iso->flags & HPSB_ISO_DRIVER_STARTED)		return 0;		if (cycle < -1)		cycle = -1;	else if (cycle >= 8000)		cycle %= 8000;		isoctl_args[0] = cycle;		if (tag_mask < 0)		/* match all tags */		tag_mask = 0xF;	isoctl_args[1] = tag_mask;		isoctl_args[2] = sync;		retval = iso->host->driver->isoctl(iso, RECV_START, (unsigned long) &isoctl_args[0]);	if (retval)		return retval;		iso->flags |= HPSB_ISO_DRIVER_STARTED;	return retval;}/* check to make sure the user has not supplied bogus values of offset/lenthat would cause the kernel to access memory outside the buffer */static int hpsb_iso_check_offset_len(struct hpsb_iso *iso,									 unsigned int offset, unsigned short len,									 unsigned int *out_offset, unsigned short *out_len){	if (offset >= iso->buf_size)		return -EFAULT;		/* make sure the packet does not go beyond the end of the buffer */	if (offset + len > iso->buf_size)		return -EFAULT;		/* check for wrap-around */	if (offset + len < offset)		return -EFAULT;		/* now we can trust 'offset' and 'length' */	*out_offset = offset;	*out_len = len;		return 0;}int hpsb_iso_xmit_queue_packet(struct hpsb_iso *iso, u32 offset, u16 len, u8 tag, u8 sy){	struct hpsb_iso_packet_info *info;	unsigned long flags;	int rv;		if (iso->type != HPSB_ISO_XMIT)		return -EINVAL;		/* is there space in the buffer? */	if (iso->n_ready_packets <= 0) {		return -EBUSY;	}		info = &iso->infos[iso->first_packet];		/* check for bogus offset/length */	if (hpsb_iso_check_offset_len(iso, offset, len, &info->offset, &info->len))		return -EFAULT;		info->tag = tag;	info->sy = sy;		spin_lock_irqsave(&iso->lock, flags);		rv = iso->host->driver->isoctl(iso, XMIT_QUEUE, (unsigned long) info);	if (rv)		goto out;		/* increment cursors */	iso->first_packet = (iso->first_packet+1) % iso->buf_packets;	iso->xmit_cycle = (iso->xmit_cycle+1) % 8000;	iso->n_ready_packets--;		if (iso->prebuffer != 0) {		iso->prebuffer--;		if (iso->prebuffer <= 0) {			iso->prebuffer = 0;			rv = do_iso_xmit_start(iso, iso->start_cycle);		}	}	out:		spin_unlock_irqrestore(&iso->lock, flags);	return rv;}int hpsb_iso_xmit_sync(struct hpsb_iso *iso){	if (iso->type != HPSB_ISO_XMIT)		return -EINVAL;		return wait_event_interruptible(iso->waitq, hpsb_iso_n_ready(iso) == iso->buf_packets);}void hpsb_iso_packet_sent(struct hpsb_iso *iso, int cycle, int error){	unsigned long flags;	spin_lock_irqsave(&iso->lock, flags);		/* predict the cycle of the next packet to be queued */		/* jump ahead by the number of packets that are already buffered */	cycle += iso->buf_packets - iso->n_ready_packets;	cycle %= 8000;		iso->xmit_cycle = cycle;	iso->n_ready_packets++;	iso->pkt_dma = (iso->pkt_dma + 1) % iso->buf_packets;		if (iso->n_ready_packets == iso->buf_packets || error != 0) {		/* the buffer has run empty! */		atomic_inc(&iso->overflows);	}		spin_unlock_irqrestore(&iso->lock, flags);}void hpsb_iso_packet_received(struct hpsb_iso *iso, u32 offset, u16 len,							  u16 cycle, u8 channel, u8 tag, u8 sy){	unsigned long flags;	spin_lock_irqsave(&iso->lock, flags);		if (iso->n_ready_packets == iso->buf_packets) {		/* overflow! */		atomic_inc(&iso->overflows);	} else {		struct hpsb_iso_packet_info *info = &iso->infos[iso->pkt_dma];		info->offset = offset;		info->len = len;		info->cycle = cycle;		info->channel = channel;		info->tag = tag;		info->sy = sy;				iso->pkt_dma = (iso->pkt_dma+1) % iso->buf_packets;		iso->n_ready_packets++;	}		spin_unlock_irqrestore(&iso->lock, flags);}int hpsb_iso_recv_release_packets(struct hpsb_iso *iso, unsigned int n_packets){	unsigned long flags;	unsigned int i;	int rv = 0;		if (iso->type != HPSB_ISO_RECV)		return -1;		spin_lock_irqsave(&iso->lock, flags);	for (i = 0; i < n_packets; i++) {		rv = iso->host->driver->isoctl(iso, RECV_RELEASE,					       (unsigned long) &iso->infos[iso->first_packet]);		if (rv)			break;				iso->first_packet = (iso->first_packet+1) % iso->buf_packets;		iso->n_ready_packets--;	}	spin_unlock_irqrestore(&iso->lock, flags);	return rv;}void hpsb_iso_wake(struct hpsb_iso *iso){	wake_up_interruptible(&iso->waitq);		if (iso->callback)		iso->callback(iso);}

?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
精品一区二区三区日韩| 蜜桃一区二区三区在线观看| 欧美精品tushy高清| 国产综合久久久久影院| 亚洲美女免费在线| xf在线a精品一区二区视频网站| 成人晚上爱看视频| 免费在线欧美视频| 一区二区三区蜜桃网| 精品国产髙清在线看国产毛片 | 亚洲日本在线视频观看| 欧美性感一类影片在线播放| 麻豆成人av在线| 亚洲视频你懂的| 日韩美女在线视频| 国产成人午夜精品5599| 亚洲在线中文字幕| 国产精品不卡一区| 日韩欧美国产午夜精品| 91女厕偷拍女厕偷拍高清| 麻豆国产欧美日韩综合精品二区 | 一区二区三区蜜桃网| 精品国产精品网麻豆系列| 91福利视频在线| 丰满白嫩尤物一区二区| k8久久久一区二区三区| 天堂精品中文字幕在线| 国产精品福利电影一区二区三区四区| 欧美久久婷婷综合色| 成人性生交大片免费看视频在线| 亚洲第一电影网| 亚洲男人的天堂网| 欧美激情一区二区三区四区| 欧美一级日韩免费不卡| 欧美在线观看你懂的| 91伊人久久大香线蕉| 国产成人午夜99999| 日本伊人精品一区二区三区观看方式| 亚洲你懂的在线视频| 国产精品久久三区| 欧美国产综合色视频| 久久综合狠狠综合久久综合88 | 欧美在线999| 国产精品乱码一区二区三区软件| 色噜噜狠狠色综合中国| 99re66热这里只有精品3直播| 26uuu欧美| 7777精品伊人久久久大香线蕉| 91成人免费在线| 国产精品乱人伦| 成人免费看的视频| 国产精品高潮呻吟| 成人黄色电影在线| 国产丝袜欧美中文另类| 国产在线日韩欧美| 欧美不卡一二三| 国产精品1区二区.| 国产婷婷色一区二区三区| 国产精品伊人色| 国产片一区二区| 不卡的av电影| 亚洲男人天堂一区| 欧美婷婷六月丁香综合色| 香蕉久久一区二区不卡无毒影院 | 色综合久久综合网| 一区二区久久久久| 欧美日韩另类一区| 爽好多水快深点欧美视频| 91精品国产福利在线观看 | 国产精品欧美久久久久一区二区| 成人精品国产福利| 洋洋av久久久久久久一区| 欧美精品xxxxbbbb| 国产盗摄女厕一区二区三区| 17c精品麻豆一区二区免费| 91视频国产资源| 午夜私人影院久久久久| 日韩欧美一区二区在线视频| 精品亚洲欧美一区| ㊣最新国产の精品bt伙计久久| 在线观看视频一区二区欧美日韩| 一区二区三区在线免费播放| 欧美一区二区三区免费大片| 美腿丝袜亚洲综合| 国产精品国产成人国产三级| 欧美亚洲动漫精品| 久久国产视频网| 成人免费视频在线观看| 日韩一卡二卡三卡四卡| proumb性欧美在线观看| 蜜臀91精品一区二区三区 | 日韩一区二区不卡| 99久久er热在这里只有精品15| 亚洲综合免费观看高清完整版| 日韩欧美国产wwwww| 97久久人人超碰| 精品无人码麻豆乱码1区2区| 中文字幕欧美一区| 日韩欧美国产一区二区在线播放| 国产精品羞羞答答xxdd| 婷婷六月综合亚洲| 专区另类欧美日韩| 久久综合色之久久综合| 欧美三级三级三级| 国产成人小视频| 久久国产精品区| 亚洲成在人线免费| 国产精品美女一区二区在线观看| 在线观看国产一区二区| 成人教育av在线| 亚洲不卡在线观看| 中文字幕日韩av资源站| 久久精品人人做人人爽97| 8v天堂国产在线一区二区| 91美女福利视频| 国产成人精品一区二区三区网站观看| 午夜精品成人在线视频| 亚洲激情一二三区| 中文幕一区二区三区久久蜜桃| 欧美一区二区三区喷汁尤物| 欧美日免费三级在线| 91九色02白丝porn| 91在线无精精品入口| 99久久综合狠狠综合久久| 国产**成人网毛片九色 | 亚洲三级在线播放| 国产精品久久久久久亚洲毛片 | 91在线观看污| caoporn国产一区二区| 国产精品18久久久久久久网站| 日韩电影在线免费看| 午夜影院久久久| 午夜一区二区三区在线观看| 亚洲国产cao| 亚洲国产日韩在线一区模特| 亚洲一区在线播放| 亚洲在线视频网站| 亚洲一区免费在线观看| 五月天一区二区| 日韩av在线发布| 视频一区在线播放| 美洲天堂一区二卡三卡四卡视频| 美女网站视频久久| 九九精品视频在线看| 国产中文字幕一区| 成人午夜av电影| 国产一区二区三区观看| 国产成人欧美日韩在线电影 | 国产在线不卡一区| 大胆亚洲人体视频| 91片黄在线观看| 欧美三区在线观看| 在线观看91精品国产麻豆| 精品日韩在线观看| 中文字幕不卡的av| 玉米视频成人免费看| 婷婷久久综合九色综合伊人色| 人人超碰91尤物精品国产| 国产精品一区免费在线观看| 国产成a人亚洲精品| 色婷婷激情一区二区三区| 69av一区二区三区| 国产婷婷一区二区| 亚洲福利一二三区| 国产一区二区福利视频| 99久久精品国产精品久久| 99国产精品国产精品久久| 色8久久精品久久久久久蜜| 欧美日本韩国一区| 欧美白人最猛性xxxxx69交| 亚洲欧美另类在线| 久久66热偷产精品| 91丝袜呻吟高潮美腿白嫩在线观看| 欧美日韩一区二区三区在线 | 国产在线国偷精品免费看| 99久久久无码国产精品| 欧美一级片在线| 国产精品成人一区二区艾草| 日韩专区欧美专区| 99re视频这里只有精品| 91精品婷婷国产综合久久性色 | 理论电影国产精品| voyeur盗摄精品| 精品人伦一区二区色婷婷| 亚洲国产精品麻豆| 国产成人精品一区二区三区网站观看| 色狠狠一区二区三区香蕉| 久久品道一品道久久精品| 一区二区在线看| 国产精品白丝jk黑袜喷水| 在线影院国内精品| 亚洲国产精品二十页| 韩国三级电影一区二区| 欧美卡1卡2卡| 亚洲桃色在线一区| 777奇米成人网| 综合色天天鬼久久鬼色| 国产高清一区日本| 欧美一级欧美三级| 性欧美疯狂xxxxbbbb|