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

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

?? iso.c

?? libraw1394-1.1.0.tar.gz 1394的一個庫文件
?? C
字號:
/* * libraw1394 - library for raw access to the 1394 bus with the Linux subsystem. * * Copyright (C) 1999,2000,2001,2002 Andreas Bombe *        new ISO API by Dan Maas * * This library is licensed under the GNU Lesser General Public License (LGPL), * version 2.1 or later. See the file COPYING.LIB in the distribution for * details. */#include <config.h>#include <errno.h>#include <unistd.h>#include <string.h>#include <fcntl.h>#include <sys/ioctl.h>#include <sys/mman.h>#include <malloc.h>#include "raw1394.h"#include "kernel-raw1394.h"#include "raw1394_private.h"/* old ISO API - kept for backwards compatibility */static int do_iso_listen(struct raw1394_handle *handle, int channel){        struct sync_cb_data sd = { 0, 0 };        struct raw1394_reqhandle rh = { (req_callback_t)_raw1394_sync_cb, &sd };        int err;        struct raw1394_request req;        CLEAR_REQ(&req);        req.type = RAW1394_REQ_ISO_LISTEN;        req.generation = handle->generation;        req.misc = channel;        req.tag = ptr2int(&rh);        req.recvb = ptr2int(handle->buffer);        req.length = HBUF_SIZE;        err = write(handle->fd, &req, sizeof(req));        while (!sd.done) {                if (err < 0) return err;                err = raw1394_loop_iterate(handle);        }        switch (sd.errcode) {        case RAW1394_ERROR_ALREADY:                errno = EALREADY;                return -1;        case RAW1394_ERROR_INVALID_ARG:                errno = EINVAL;                return -1;        default:                errno = 0;                return sd.errcode;        }}int raw1394_start_iso_rcv(struct raw1394_handle *handle, unsigned int channel){        if (channel > 63) {                errno = EINVAL;                return -1;        }        return do_iso_listen(handle, channel);}int raw1394_stop_iso_rcv(struct raw1394_handle *handle, unsigned int channel){        if (channel > 63) {                errno = EINVAL;                return -1;        }        return do_iso_listen(handle, ~channel);}/* new ISO API *//* reset the dropped counter each time it is seen */static unsigned int _raw1394_iso_dropped(raw1394handle_t handle){	unsigned int retval = handle->iso_packets_dropped;	handle->iso_packets_dropped = 0;	return retval;}/* common code for iso_xmit_init and iso_recv_init */static int do_iso_init(raw1394handle_t handle,		       unsigned int buf_packets,		       unsigned int max_packet_size,		       int channel,		       enum raw1394_iso_speed speed,		       enum raw1394_iso_dma_recv_mode mode,		       int irq_interval,		       int cmd){	unsigned int stride;	/* already initialized? */	if(handle->iso_mode != ISO_INACTIVE)		return -1;	/* choose a power-of-two stride for the packet data buffer,	   so that an even number of packets fits on one page */	for(stride = 4; stride < max_packet_size; stride *= 2);	if(stride > getpagesize()) {		errno = ENOMEM;		return -1;	}	handle->iso_buf_stride = stride;	handle->iso_status.config.data_buf_size = stride * buf_packets;	handle->iso_status.config.buf_packets = buf_packets;	handle->iso_status.config.channel = channel;	handle->iso_status.config.speed = speed;	handle->iso_status.config.irq_interval = irq_interval;	handle->iso_status.config.dma_mode = mode;	if(ioctl(handle->fd, cmd, &handle->iso_status))		return -1;	/* mmap the DMA buffer */	/* (we assume the kernel sets buf_size to an even number of pages) */	handle->iso_buffer = mmap(NULL,				  handle->iso_status.config.data_buf_size,				  PROT_READ | PROT_WRITE,				  MAP_SHARED, handle->fd, 0);	if(handle->iso_buffer == (unsigned char*) MAP_FAILED) {		handle->iso_buffer = NULL;		ioctl(handle->fd, RAW1394_IOC_ISO_SHUTDOWN, 0);		return -1;	}	handle->iso_status.overflows = 0;	handle->iso_packets_dropped = 0;	handle->iso_xmit_handler = NULL;	handle->iso_recv_handler = NULL;	handle->iso_state = ISO_STOP;	return 0;			}int raw1394_iso_xmit_init(raw1394handle_t handle,			  raw1394_iso_xmit_handler_t handler,			  unsigned int buf_packets,			  unsigned int max_packet_size,			  unsigned char channel,			  enum raw1394_iso_speed speed,			  int irq_interval){	if (do_iso_init(handle, buf_packets, max_packet_size, channel, speed, RAW1394_DMA_DEFAULT,		       irq_interval, RAW1394_IOC_ISO_XMIT_INIT))		return -1;	handle->iso_mode = ISO_XMIT;	handle->iso_xmit_handler = handler;	handle->next_packet = 0;	return 0;}int raw1394_iso_recv_init(raw1394handle_t handle,			  raw1394_iso_recv_handler_t handler,			  unsigned int buf_packets,			  unsigned int max_packet_size,			  unsigned char channel,		          enum raw1394_iso_dma_recv_mode mode,			  int irq_interval){	/* any speed will work */	if (do_iso_init(handle, buf_packets, max_packet_size, channel, RAW1394_ISO_SPEED_100, mode,		       irq_interval, RAW1394_IOC_ISO_RECV_INIT))		return -1;	handle->iso_mode = ISO_RECV;	handle->iso_recv_handler = handler;	return 0;}int raw1394_iso_multichannel_recv_init(raw1394handle_t handle,				       raw1394_iso_recv_handler_t handler,				       unsigned int buf_packets,				       unsigned int max_packet_size,				       int irq_interval){	/* any speed will work */	if (do_iso_init(handle, buf_packets, max_packet_size, -1, RAW1394_ISO_SPEED_100,			RAW1394_DMA_BUFFERFILL,		       irq_interval, RAW1394_IOC_ISO_RECV_INIT))		return -1;	handle->iso_mode = ISO_RECV;	handle->iso_recv_handler = handler;	return 0;}int raw1394_iso_recv_listen_channel(raw1394handle_t handle, unsigned char channel){	if (handle->iso_mode != ISO_RECV) {		errno = EINVAL;		return -1;	}	return ioctl(handle->fd, RAW1394_IOC_ISO_RECV_LISTEN_CHANNEL, channel);}int raw1394_iso_recv_unlisten_channel(raw1394handle_t handle, unsigned char channel){	if (handle->iso_mode != ISO_RECV) {		errno = EINVAL;		return -1;	}	return ioctl(handle->fd, RAW1394_IOC_ISO_RECV_UNLISTEN_CHANNEL, channel);}int raw1394_iso_recv_flush(raw1394handle_t handle){	if (handle->iso_mode != ISO_RECV) {		errno = EINVAL;		return -1;	}	return ioctl(handle->fd, RAW1394_IOC_ISO_RECV_FLUSH, 0);}int raw1394_iso_recv_set_channel_mask(raw1394handle_t handle, u_int64_t mask){	if (handle->iso_mode != ISO_RECV) {		errno = EINVAL;		return -1;	}	return ioctl(handle->fd, RAW1394_IOC_ISO_RECV_SET_CHANNEL_MASK, (void*) &mask);}int raw1394_iso_recv_start(raw1394handle_t handle, int start_on_cycle, int tag_mask, int sync){	int args[3];	if(handle->iso_mode != ISO_RECV) {		errno = EINVAL;		return -1;	}	args[0] = start_on_cycle;	args[1] = tag_mask;	args[2] = sync;	if(ioctl(handle->fd, RAW1394_IOC_ISO_RECV_START, &args[0]))		return -1;	handle->iso_state = ISO_GO;	return 0;}static int _raw1394_iso_xmit_queue_packets(raw1394handle_t handle){	struct raw1394_iso_status *stat = &handle->iso_status;	struct raw1394_iso_packets packets;	int retval = -1;	int stop_sync = 0;	if(handle->iso_mode != ISO_XMIT) {		errno = EINVAL;		goto out;	}	/* we could potentially send up to stat->n_packets packets */	packets.n_packets = 0;	packets.infos = malloc(stat->n_packets * sizeof(struct raw1394_iso_packet_info));	if(packets.infos == NULL)		goto out;	while(stat->n_packets > 0) {		enum raw1394_iso_disposition disp;		unsigned int len;				struct raw1394_iso_packet_info *info = &packets.infos[packets.n_packets];		info->offset = handle->iso_buf_stride * handle->next_packet;				/* call handler */		disp = handle->iso_xmit_handler(handle,						handle->iso_buffer + info->offset,						&len,						&info->tag, &info->sy,						stat->xmit_cycle,						_raw1394_iso_dropped(handle));		info->len = len;				/* advance packet cursors and cycle counter */		stat->n_packets--;		handle->next_packet = (handle->next_packet + 1) % stat->config.buf_packets;		if(stat->xmit_cycle != -1)			stat->xmit_cycle = (stat->xmit_cycle + 1) % 8000;		packets.n_packets++;		if(disp == RAW1394_ISO_DEFER) {			/* queue an event so that we don't hang in the next read() */			if(ioctl(handle->fd, RAW1394_IOC_ISO_QUEUE_ACTIVITY, 0))				goto out_produce;			break;		} else if(disp == RAW1394_ISO_STOP) {			stop_sync = 1;			break;		} else if(disp == RAW1394_ISO_STOP_NOSYNC) {			raw1394_iso_stop(handle);			break;		} else if(disp == RAW1394_ISO_ERROR) {			goto out_produce;		}	}	/* success */	retval = 0;out_produce:	if(packets.n_packets > 0) {		if(ioctl(handle->fd, RAW1394_IOC_ISO_XMIT_PACKETS, &packets))			retval = -1;	}	free(packets.infos);out:	if(stop_sync) {		if(raw1394_iso_xmit_sync(handle))			return -1;		raw1394_iso_stop(handle);	}		return retval;}int raw1394_iso_xmit_write(raw1394handle_t handle, unsigned char *data, unsigned int len,			   unsigned char tag, unsigned char sy){	struct raw1394_iso_status *stat = &handle->iso_status;	struct raw1394_iso_packets packets;	struct raw1394_iso_packet_info info;	if(handle->iso_mode != ISO_XMIT || handle->iso_xmit_handler != NULL) {		errno = EINVAL;		return -1;	}	/* wait until buffer space is available */	while(handle->iso_status.n_packets == 0) {		/* if the file descriptor has been set non-blocking,		   return immediately */		if(fcntl(handle->fd, F_GETFL) & O_NONBLOCK) {			errno = EAGAIN;			return -1;		}					if(raw1394_loop_iterate(handle)) {			return -1;		}	}	/* copy the data to the packet buffer */	info.offset = handle->next_packet * handle->iso_buf_stride;	info.len = len;	info.tag = tag;	info.sy = sy;		memcpy(handle->iso_buffer + info.offset, data, len);		packets.n_packets = 1;	packets.infos = &info;	if(ioctl(handle->fd, RAW1394_IOC_ISO_XMIT_PACKETS, &packets))		return -1;	stat->n_packets--;	handle->next_packet = (handle->next_packet + 1) % stat->config.buf_packets;	if(stat->xmit_cycle != -1)		stat->xmit_cycle = (stat->xmit_cycle + 1) % 8000;	return 0;}int raw1394_iso_xmit_start(raw1394handle_t handle, int start_on_cycle, int prebuffer_packets){	int args[2];	if(handle->iso_mode != ISO_XMIT) {		errno = EINVAL;		return -1;	}	args[0] = start_on_cycle;	args[1] = prebuffer_packets;	if(ioctl(handle->fd, RAW1394_IOC_ISO_XMIT_START, &args[0]))		return -1;	handle->iso_state = ISO_GO;	return 0;}int raw1394_iso_xmit_sync(raw1394handle_t handle){	if(handle->iso_mode != ISO_XMIT) {		errno = EINVAL;		return -1;	}	return ioctl(handle->fd, RAW1394_IOC_ISO_XMIT_SYNC, 0);}void raw1394_iso_stop(raw1394handle_t handle){	if(handle->iso_mode == ISO_INACTIVE) {		return;	}	ioctl(handle->fd, RAW1394_IOC_ISO_XMIT_RECV_STOP, 0);	handle->iso_state = ISO_STOP;}void raw1394_iso_shutdown(raw1394handle_t handle){	if(handle->iso_buffer) {		munmap(handle->iso_buffer, handle->iso_status.config.data_buf_size);		handle->iso_buffer = NULL;	}		if(handle->iso_mode != ISO_INACTIVE) {		raw1394_iso_stop(handle);		ioctl(handle->fd, RAW1394_IOC_ISO_SHUTDOWN, 0);	}	handle->iso_mode = ISO_INACTIVE;}static int _raw1394_iso_recv_packets(raw1394handle_t handle){	struct raw1394_iso_status *stat = &handle->iso_status;	struct raw1394_iso_packets packets;	int retval = -1, packets_done = 0;	if(handle->iso_mode != ISO_RECV) {		errno = EINVAL;		return -1;	}		/* ask the kernel to fill an array with packet info structs */	packets.n_packets = stat->n_packets;	packets.infos = malloc(packets.n_packets * sizeof(struct raw1394_iso_packet_info));	if(packets.infos == NULL)		goto out;	if(ioctl(handle->fd, RAW1394_IOC_ISO_RECV_PACKETS, &packets) < 0)		goto out_free;	while(stat->n_packets > 0) {		struct raw1394_iso_packet_info *info;		enum raw1394_iso_disposition disp;		info = &packets.infos[packets_done];		/* call handler */		disp = handle->iso_recv_handler(handle,						handle->iso_buffer + info->offset,						info->len, info->channel,						info->tag, info->sy,						info->cycle,						_raw1394_iso_dropped(handle));		/* advance packet cursors */		stat->n_packets--;		packets_done++;				if(disp == RAW1394_ISO_DEFER) {			/* queue an event so that we don't hang in the next read() */			if(ioctl(handle->fd, RAW1394_IOC_ISO_QUEUE_ACTIVITY, 0))				goto out_consume;			break;		} else if(disp == RAW1394_ISO_STOP || disp == RAW1394_ISO_STOP_NOSYNC) {			raw1394_iso_stop(handle);			break;		} else if(disp == RAW1394_ISO_ERROR) {			goto out_consume;		}	}	/* success */	retval = 0;out_consume:	if(packets_done > 0) {		if(ioctl(handle->fd, RAW1394_IOC_ISO_RECV_RELEASE_PACKETS, packets_done))			retval = -1;	}out_free:	free(packets.infos);out:		return retval;}/* run the ISO state machine; called from raw1394_loop_iterate()  */int _raw1394_iso_iterate(raw1394handle_t handle){	int err;	if(handle->iso_mode == ISO_INACTIVE)		return 0;	err = ioctl(handle->fd, RAW1394_IOC_ISO_GET_STATUS, &handle->iso_status);	if(err != 0)		return err;	handle->iso_packets_dropped += handle->iso_status.overflows;	if(handle->iso_state == ISO_GO) {		if(handle->iso_mode == ISO_XMIT) {			if(handle->iso_xmit_handler) {				return _raw1394_iso_xmit_queue_packets(handle);			}		}		if(handle->iso_mode == ISO_RECV) {			if(handle->iso_recv_handler) {				return _raw1394_iso_recv_packets(handle);			}		}	}	return 0;}

?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
91精品国产综合久久小美女| 丁香亚洲综合激情啪啪综合| 麻豆免费看一区二区三区| 国产在线国偷精品免费看| va亚洲va日韩不卡在线观看| 欧美性欧美巨大黑白大战| 精品少妇一区二区三区在线视频| 国产女同互慰高潮91漫画| 亚洲激情第一区| 精品一区二区久久久| 99视频有精品| 欧美成人欧美edvon| 国产精品国产自产拍高清av王其| 亚洲在线免费播放| 国产精品中文有码| 欧美亚洲一区三区| 日本一区免费视频| 日韩精品久久理论片| 国产aⅴ精品一区二区三区色成熟| 日本高清不卡一区| 久久久蜜桃精品| 天天影视色香欲综合网老头| 国产69精品久久99不卡| 欧美三电影在线| 国产精品电影院| 久久精品国产久精国产爱| 91视频精品在这里| 国产午夜精品福利| 日韩激情视频在线观看| 色婷婷久久久亚洲一区二区三区| 26uuu精品一区二区| 亚洲va韩国va欧美va| 国产成人精品亚洲日本在线桃色| 91精品午夜视频| 一区二区三区91| 不卡一区二区在线| 久久久久久97三级| 美女视频免费一区| 欧美精品丝袜中出| 亚洲一区二区影院| 99热99精品| 国产人成亚洲第一网站在线播放 | 国产69精品久久99不卡| 欧美一区二区三区日韩| 亚洲国产一区二区a毛片| 99热这里都是精品| 日本一区二区三级电影在线观看 | 精品99久久久久久| 日本亚洲三级在线| 欧美情侣在线播放| 夜夜精品浪潮av一区二区三区| 成人黄色电影在线| 久久综合久久久久88| 另类的小说在线视频另类成人小视频在线 | 欧美精品日韩一区| 一区二区高清免费观看影视大全| 成人av影院在线| 国产欧美一区在线| 国产成人精品影视| 国产香蕉久久精品综合网| 国内精品不卡在线| 久久只精品国产| 国产精品白丝jk白祙喷水网站| 精品国产一区二区三区久久久蜜月| 奇米影视一区二区三区小说| 欧美精品电影在线播放| 日韩高清在线一区| 91麻豆精品国产自产在线观看一区 | 91丝袜国产在线播放| 国产精品网站导航| www.日韩av| 亚洲天天做日日做天天谢日日欢| 91一区二区在线观看| 日韩伦理电影网| 色综合久久九月婷婷色综合| 一区二区视频在线| 欧美在线观看禁18| 亚洲福利视频导航| 欧美一区二区三区思思人| 首页欧美精品中文字幕| 日韩一级在线观看| 国产自产视频一区二区三区| 国产三级欧美三级日产三级99 | 国产精品久久久久久久久搜平片 | 夜夜精品浪潮av一区二区三区| 91黄色激情网站| 亚洲电影第三页| 欧美一三区三区四区免费在线看 | 久久先锋资源网| 国产一区二区0| 国产精品久久久久影院| 一本大道久久a久久精品综合| 亚洲午夜久久久| 日韩一本二本av| 国产超碰在线一区| 一区二区三区四区在线播放| 欧美日韩一级大片网址| 美国欧美日韩国产在线播放| 精品乱人伦一区二区三区| 国产v综合v亚洲欧| 一区二区三区在线观看网站| 欧美三级电影网| 国产资源在线一区| 亚洲丝袜精品丝袜在线| 欧美日韩1区2区| 国内精品久久久久影院一蜜桃| 中文字幕在线观看不卡| 在线影院国内精品| 成人晚上爱看视频| 亚洲人午夜精品天堂一二香蕉| 欧美男女性生活在线直播观看| 国产原创一区二区| 亚洲视频你懂的| 日韩小视频在线观看专区| 国产mv日韩mv欧美| 午夜伦欧美伦电影理论片| 久久精品视频一区| 欧美午夜免费电影| 国产高清不卡一区二区| 一区二区三区不卡在线观看| 亚洲精品一区二区三区精华液| 99久久精品国产一区| 日韩国产在线观看一区| 中文字幕成人av| 3atv在线一区二区三区| 国产91精品久久久久久久网曝门| 亚洲成人激情av| 中文字幕亚洲一区二区av在线| 91精品婷婷国产综合久久性色| av资源网一区| 久久av老司机精品网站导航| 亚洲精品免费播放| 精品国产伦一区二区三区免费| 91久久线看在观草草青青| 久88久久88久久久| 亚洲高清不卡在线观看| 中文字幕一区在线观看视频| 欧美一二三四区在线| 色哟哟亚洲精品| 国产东北露脸精品视频| 三级久久三级久久| 日韩毛片一二三区| 国产午夜一区二区三区| 日韩限制级电影在线观看| 在线观看三级视频欧美| 成人手机在线视频| 激情综合五月婷婷| 日本视频免费一区| 亚洲综合色噜噜狠狠| 国产精品免费丝袜| 久久日韩粉嫩一区二区三区| 在线综合亚洲欧美在线视频| 欧美在线一区二区| 91蝌蚪porny成人天涯| 国产成人一级电影| 久久成人精品无人区| 亚欧色一区w666天堂| 1区2区3区欧美| 日本一区二区三区四区| 欧美成人三级在线| 欧美一级日韩不卡播放免费| 欧美三级一区二区| 在线免费观看日韩欧美| 91视频免费看| 97久久久精品综合88久久| 成人av免费网站| 成人小视频在线观看| 精品午夜久久福利影院| 激情五月婷婷综合网| 免费在线观看一区| 日本大胆欧美人术艺术动态| 亚洲h精品动漫在线观看| 亚洲国产欧美在线| 亚洲午夜电影在线| 亚洲午夜精品17c| 亚洲国产日产av| 午夜欧美2019年伦理| 亚洲成人av电影| 石原莉奈一区二区三区在线观看| 午夜免费久久看| 日韩精品乱码免费| 免费成人av资源网| 久久爱www久久做| 国产美女在线精品| 国产一区二区不卡在线| 国产成人久久精品77777最新版本 国产成人鲁色资源国产91色综 | 99综合影院在线| 色综合久久中文综合久久牛| 91在线视频官网| 日本乱人伦一区| 欧美人妇做爰xxxⅹ性高电影| 欧美日韩国产免费一区二区| 在线播放一区二区三区| 91精品国产91久久久久久一区二区| 91精品在线免费观看| 久久这里只有精品6| 国产精品麻豆99久久久久久| 亚洲视频小说图片| 亚洲成人一区在线| 久久疯狂做爰流白浆xx|