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

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

?? iso.c

?? 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/pci.h>#include <linux/sched.h>#include <linux/slab.h>#include "hosts.h"#include "iso.h"/** * hpsb_iso_stop - stop DMA */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;}/** * hpsb_iso_shutdown - deallocate buffer and DMA context */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;}/** * hpsb_iso_n_ready - returns number of packets ready to send or receive */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;}/** * hpsb_iso_xmit_init - allocate the buffer and DMA context */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;}/** * hpsb_iso_recv_init - allocate the buffer and DMA context * * Note, if channel = -1, multi-channel receive is enabled. */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;}/** * hpsb_iso_recv_listen_channel * * multi-channel only */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);}/** * hpsb_iso_recv_unlisten_channel * * multi-channel only */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);}/** * hpsb_iso_recv_set_channel_mask * * multi-channel only */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);}/** * hpsb_iso_recv_flush - check for arrival of new packets * * check for arrival of new packets immediately (even if irq_interval * has not yet been reached) */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;}/** * hpsb_iso_xmit_start - start DMA */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;}/** * hpsb_iso_recv_start - start DMA */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;}/** * hpsb_iso_xmit_queue_packet - queue a packet for transmission. * * @offset is relative to the beginning of the DMA buffer, where the packet's * data payload should already have been placed. */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;}/** * hpsb_iso_xmit_sync - wait until all queued packets have been transmitted */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);}/** * hpsb_iso_packet_sent * * Available to low-level drivers. * * Call after a packet has been transmitted to the bus (interrupt context is * OK).  @cycle is the _exact_ cycle the packet was sent on.  @error should be * non-zero if some sort of error occurred when sending the packet. */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);}/** * hpsb_iso_packet_received * * Available to low-level drivers. * * Call after a packet has been received (interrupt context is OK). */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);}/** * hpsb_iso_recv_release_packets - release packets, reuse buffer * * @n_packets have been read out of the buffer, re-use the buffer space */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;}/** * hpsb_iso_wake * * Available to low-level drivers. * * Call to wake waiting processes after buffer space has opened up. */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一区二区三区免费野_久草精品视频
91免费国产在线| 一区二区在线观看不卡| 91视频国产观看| 午夜欧美大尺度福利影院在线看| 国产欧美精品日韩区二区麻豆天美| 日韩欧美在线观看一区二区三区| 欧美高清视频一二三区| 欧美日本一区二区| 3d成人动漫网站| 日韩免费观看高清完整版| 成人免费看黄yyy456| 亚洲视频一二区| 伊人色综合久久天天人手人婷| 尤物av一区二区| 欧美午夜宅男影院| 欧美精品电影在线播放| 欧美一卡二卡三卡| 国产三级精品视频| 国产精品免费人成网站| 国产精品久久久久久久岛一牛影视| 国产精品久久福利| 亚洲亚洲人成综合网络| 婷婷激情综合网| 久久成人av少妇免费| 国产精品资源网站| 色94色欧美sute亚洲线路一ni| 欧美日韩国产免费| 精品国产污污免费网站入口 | 成人激情文学综合网| 一本色道久久加勒比精品| 欧美久久一区二区| 久久久三级国产网站| 中文字幕在线免费不卡| 亚洲第一主播视频| 国产一区二区三区观看| 色婷婷综合久久久久中文| 6080日韩午夜伦伦午夜伦| 精品久久久久久久久久久久久久久| 中文字幕av一区二区三区高| 亚洲国产wwwccc36天堂| 国产麻豆一精品一av一免费| 91福利在线播放| 精品国产乱码久久久久久老虎| 中文字幕中文字幕一区| 免费高清在线一区| 91亚洲精品久久久蜜桃| 大陆成人av片| 一本高清dvd不卡在线观看| 欧美一级理论片| 亚洲欧洲精品一区二区三区| 亚洲国产一区二区三区 | 极品尤物av久久免费看| 99视频一区二区| 精品99999| 天天av天天翘天天综合网| 粉嫩13p一区二区三区| 日韩一区二区三区视频| 亚洲男同1069视频| 国产成人午夜高潮毛片| 欧美亚洲国产一区二区三区va | 国产午夜精品一区二区| 夜夜嗨av一区二区三区四季av| 国产福利一区在线| 日韩免费看的电影| 亚洲成人www| 成人黄色片在线观看| 久久免费午夜影院| 美国一区二区三区在线播放| 欧美亚洲高清一区| 一区二区三区四区高清精品免费观看 | 久久机这里只有精品| 欧美久久久久久久久| 亚洲最新视频在线观看| 一本久道中文字幕精品亚洲嫩| 亚洲特级片在线| 91在线观看视频| 中文字幕亚洲一区二区av在线 | 97aⅴ精品视频一二三区| 久久尤物电影视频在线观看| 久久99精品久久久| 337p粉嫩大胆噜噜噜噜噜91av| 午夜国产精品影院在线观看| 国产精品每日更新| 国产激情一区二区三区四区 | 久久精品国产网站| 精品理论电影在线观看 | 亚洲国产日韩a在线播放性色| 成人av电影免费在线播放| 日本一区二区免费在线| 国产成人高清视频| 国产精品福利一区二区| 91免费视频网| 日韩精品成人一区二区三区| 欧美一区欧美二区| 国产乱码精品一区二区三区av| 欧美大白屁股肥臀xxxxxx| 免费美女久久99| 2024国产精品视频| 成人福利在线看| 亚洲一区二区在线视频| 51精品久久久久久久蜜臀| 免费成人在线观看视频| 国产偷国产偷精品高清尤物| 成+人+亚洲+综合天堂| 亚洲三级视频在线观看| 欧美剧情片在线观看| 九九久久精品视频| 国产精品久久网站| 欧美精品在线一区二区三区| 激情欧美日韩一区二区| 亚洲国产精品成人综合| 欧美手机在线视频| 国产剧情一区在线| 亚洲综合免费观看高清在线观看| 日韩小视频在线观看专区| 国产伦理精品不卡| 亚洲乱码国产乱码精品精的特点| 777午夜精品免费视频| 福利91精品一区二区三区| 亚洲亚洲精品在线观看| 国产欧美精品一区二区三区四区| 欧美日韩成人高清| 丰满少妇久久久久久久| 丝袜亚洲另类欧美综合| 国产精品久久久久久久蜜臀| 日韩一级黄色大片| 日本道免费精品一区二区三区| 久久99精品久久久久久国产越南| 欧美肥妇毛茸茸| 国产乱码精品一区二区三| 亚洲成人综合网站| 国产清纯白嫩初高生在线观看91 | 国产精品国产精品国产专区不片| 69av一区二区三区| 91一区在线观看| 国产在线精品一区二区夜色 | 国产欧美久久久精品影院| 91 com成人网| 欧美综合天天夜夜久久| 国产一区二区三区视频在线播放| 一区二区三区四区视频精品免费 | 成人免费视频caoporn| 国内久久婷婷综合| 美女在线一区二区| 午夜欧美大尺度福利影院在线看| 伊人性伊人情综合网| 日韩一区欧美小说| 久久免费视频一区| 久久综合99re88久久爱| 26uuu精品一区二区| 欧美日本一区二区| 欧美日韩中字一区| 91视频国产观看| 91搞黄在线观看| 欧美亚洲禁片免费| 欧美日韩亚洲综合| 欧美亚洲国产怡红院影院| av在线不卡免费看| 99精品视频在线观看| 成人app下载| 91一区二区在线观看| 91黄色小视频| 欧美亚洲一区二区三区四区| 欧美日韩久久一区| 欧美人伦禁忌dvd放荡欲情| 色丁香久综合在线久综合在线观看| aaa欧美大片| 在线视频中文字幕一区二区| 91麻豆国产自产在线观看| 99国产精品99久久久久久| 91小视频免费看| 欧美日韩一区二区三区在线| 91精品国产综合久久精品| 在线播放91灌醉迷j高跟美女 | 久久精品免费在线观看| 国产日韩av一区二区| 一区二区三区精品在线观看| 成人午夜伦理影院| 91麻豆国产精品久久| 一本在线高清不卡dvd| 欧美高清一级片在线| 欧美精品一区二区三区四区| 国产精品久久久久影院老司| 亚洲综合清纯丝袜自拍| 蜜桃av一区二区三区电影| 国产精品一区2区| 91在线看国产| 欧美日韩高清一区二区三区| 精品欧美乱码久久久久久1区2区 | 国产在线麻豆精品观看| 成人高清视频在线| 欧美一区二区视频在线观看2022 | 在线不卡中文字幕播放| 欧美videos大乳护士334| 精品国产凹凸成av人导航| 亚洲免费av高清| 韩国女主播一区| 色婷婷亚洲精品| 久久久美女毛片| 亚洲一区二区视频在线|