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

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

?? iso.c

?? ieee1394驅動,不多說了!直接可以在linux2.6內核中使用
?? 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/pci.h>#include <linux/slab.h>#include "hosts.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 dma_mode,					     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 ((dma_mode < HPSB_ISO_DMA_DEFAULT)	    || (dma_mode > HPSB_ISO_DMA_PACKET_PER_BUFFER))		dma_mode = HPSB_ISO_DMA_DEFAULT;	if ((irq_interval < 0) || (irq_interval > buf_packets / 4))		irq_interval = buf_packets / 4;	if (irq_interval == 0)	/* really interrupt for each packet */		irq_interval = 1;	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;	iso->dma_mode = dma_mode;	dma_region_init(&iso->data_buf);	iso->buf_size = PAGE_ALIGN(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->bytes_discarded = 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,						    HPSB_ISO_DMA_DEFAULT,						    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 dma_mode,				    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, dma_mode,						    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 - 1;	else if (prebuffer == 0)		prebuffer = 1;	if (prebuffer >= iso->buf_packets)		prebuffer = iso->buf_packets - 1;	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/len   that 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 total_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);		/* Record size of this discarded packet */		iso->bytes_discarded += total_len;	} else {		struct hpsb_iso_packet_info *info = &iso->infos[iso->pkt_dma];		info->offset = offset;		info->len = len;		info->total_len = total_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--;		/* release memory from packets discarded when queue was full  */		if (iso->n_ready_packets == 0) {	/* Release only after all prior packets handled */			if (iso->bytes_discarded != 0) {				struct hpsb_iso_packet_info inf;				inf.total_len = iso->bytes_discarded;				iso->host->driver->isoctl(iso, RECV_RELEASE,							  (unsigned long)&inf);				iso->bytes_discarded = 0;			}		}	}	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一区二区三区免费野_久草精品视频
亚洲欧美精品午睡沙发| 成人av网站在线| 午夜电影一区二区三区| 一区二区三区四区在线播放 | 成人午夜又粗又硬又大| 国产一区二区三区在线看麻豆| 久久99精品一区二区三区三区| 日韩精品91亚洲二区在线观看| 午夜精品影院在线观看| 亚洲电影一级黄| 午夜精品一区二区三区三上悠亚| 亚洲成人精品一区| 免费成人av在线| 国产东北露脸精品视频| 99国产精品久久久久久久久久久 | 久久精品亚洲国产奇米99| 亚洲精品一区二区在线观看| 精品久久国产97色综合| 精品福利视频一区二区三区| 国产丝袜美腿一区二区三区| 国产蜜臀av在线一区二区三区| 国产精品麻豆久久久| 亚洲欧美激情一区二区| 午夜精品成人在线视频| 麻豆国产精品视频| 国产**成人网毛片九色| 91精品福利视频| 日韩一区二区三区四区| 久久久www成人免费毛片麻豆| 亚洲图片欧美激情| 婷婷成人激情在线网| 美女视频免费一区| 福利一区福利二区| 欧美性大战久久| 精品美女在线观看| 1区2区3区精品视频| 亚州成人在线电影| 国产精品系列在线观看| 色婷婷av久久久久久久| 这里是久久伊人| 国产精品天美传媒| 亚洲va韩国va欧美va精品| 国产一区激情在线| 91国偷自产一区二区使用方法| 日韩一区二区在线观看| 中文字幕欧美激情| 日韩精品亚洲一区| 成人一级片在线观看| 欧美日韩免费观看一区二区三区| 久久综合九色综合97_久久久| 亚洲欧美国产高清| 韩国一区二区在线观看| 91豆麻精品91久久久久久| 日韩精品一区二区三区在线观看 | 久久精品国产一区二区三区免费看| 成人免费视频国产在线观看| 在线播放中文一区| 国产精品久久久久影院| 秋霞午夜av一区二区三区| 成人动漫一区二区三区| 精品久久久网站| 夜夜夜精品看看| 成人美女在线视频| 日韩精品一区二区三区swag| 一区二区三区色| 丰满放荡岳乱妇91ww| 欧美精品三级在线观看| **欧美大码日韩| 国产一区欧美二区| 7777精品久久久大香线蕉| 亚洲色图制服诱惑| 成人做爰69片免费看网站| 日韩一级二级三级| 亚洲高清不卡在线| 成人动漫av在线| 国产亚洲精品bt天堂精选| 天天av天天翘天天综合网 | 在线观看日韩一区| 中文字幕欧美日本乱码一线二线| 伦理电影国产精品| 欧美日韩一区三区| 亚洲美女屁股眼交3| 粉嫩aⅴ一区二区三区四区| 欧美不卡123| 免费欧美在线视频| 欧美人妖巨大在线| 亚洲国产视频网站| 在线国产亚洲欧美| 亚洲另类春色校园小说| 成人三级伦理片| 欧美国产激情一区二区三区蜜月 | 欧美电影影音先锋| 一级日本不卡的影视| 91蜜桃免费观看视频| 国产精品免费aⅴ片在线观看| 国产一区二区三区免费播放| 欧美不卡一区二区| 国产在线精品一区二区三区不卡| 日韩亚洲欧美在线| 久久精品国产77777蜜臀| 欧美一级精品在线| 免费视频一区二区| 精品少妇一区二区三区| 国产在线国偷精品产拍免费yy| 日本伊人精品一区二区三区观看方式| 欧美日本一区二区三区四区 | 成人动漫一区二区在线| 国产精品网站一区| www.综合网.com| 国产精品久久久久久户外露出| 国产suv一区二区三区88区| 国产日本欧洲亚洲| 国产成人免费网站| 中文字幕在线不卡| 色婷婷av一区二区三区软件 | 欧美日本在线看| 蜜桃视频在线观看一区| 久久综合九色综合欧美98| 国产91清纯白嫩初高中在线观看| 国产欧美日韩不卡免费| av不卡一区二区三区| 亚洲人成影院在线观看| 欧美三级蜜桃2在线观看| 免费观看30秒视频久久| 精品国产123| 99这里都是精品| 亚洲一二三四区不卡| 制服丝袜成人动漫| 国产美女一区二区| 1024精品合集| 欧美日韩久久久一区| 国产一区二区三区在线观看精品| 国产精品人妖ts系列视频| 在线视频国内自拍亚洲视频| 日韩和的一区二区| 欧美极品aⅴ影院| 91美女在线观看| 青青草国产成人av片免费| 精品国产乱码久久久久久闺蜜| 成人精品免费网站| 香蕉成人伊视频在线观看| 久久影院视频免费| 色吧成人激情小说| 久久se精品一区精品二区| 国产精品免费aⅴ片在线观看| 欧美美女一区二区在线观看| 国内精品不卡在线| 一区二区三区不卡视频| 亚洲精品一区二区三区蜜桃下载| av亚洲精华国产精华精华| 免费观看91视频大全| 中文字幕一区免费在线观看 | 亚洲电影在线播放| 久久久久久麻豆| 欧美在线观看18| 国产久卡久卡久卡久卡视频精品| 亚洲免费视频中文字幕| 欧美成人女星排行榜| 一本到不卡免费一区二区| 老司机免费视频一区二区| 亚洲美女电影在线| 国产三级精品三级在线专区| 欧美日韩国产另类一区| 波多野结衣一区二区三区 | 欧美日韩激情在线| 大尺度一区二区| 日韩国产高清影视| 亚洲色图欧美偷拍| 国产清纯白嫩初高生在线观看91 | 青青国产91久久久久久 | 色综合久久88色综合天天6| 精品亚洲免费视频| 亚洲国产wwwccc36天堂| 国产精品视频一二三| 欧美不卡视频一区| 欧美精品日韩一本| 91国偷自产一区二区开放时间 | 国产精品久久久久久久久免费樱桃| 555www色欧美视频| 色一情一乱一乱一91av| 国产99精品国产| 免费美女久久99| 亚洲午夜激情网页| 亚洲欧洲综合另类在线| 国产精品五月天| 久久久国产一区二区三区四区小说| 欧美精品一卡二卡| 欧洲精品中文字幕| 91日韩在线专区| 成人av片在线观看| 丁香婷婷综合激情五月色| 国产在线视频一区二区| 免费观看在线综合色| 日本不卡高清视频| 亚洲动漫第一页| 亚洲成av人综合在线观看| 一区二区三区在线免费观看| 中文字幕佐山爱一区二区免费| 中文字幕av不卡| 中文字幕亚洲欧美在线不卡|